-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat(react-drawer): make dialog slot to be used for composition only #29392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
marcosmoura
merged 31 commits into
microsoft:master
from
marcosmoura:feat/react-drawer/drawer-overlay-surface
Oct 6, 2023
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
8af5416
feat(react-drawer): make dialog slot to be used for composition only
marcosmoura 322eb4b
fix: change type
marcosmoura 368edcb
Merge branch 'master' into feat/react-drawer/make-dialog-slot-interna…
marcosmoura 770b998
feat: create abstraction over DialogSurface
marcosmoura a2a52bf
fix: merge backdrop refs
marcosmoura 6f6329d
fix: generate API
marcosmoura 7593b14
fix: add outline styles
marcosmoura e7e1660
fix: rename nested var
marcosmoura 642f459
Merge branch 'master' into feat/react-drawer/drawer-overlay-surface
marcosmoura b3701aa
fix: unify component, state and renderization
marcosmoura dfbfaf0
fix: rename variable
marcosmoura 166130a
fix: wrong imports and types
marcosmoura ce59ebf
fix: add changefile
marcosmoura 48344c2
fix: use token instead of hardcoded style
marcosmoura 4d7c927
Merge branch 'master' into feat/react-drawer/drawer-overlay-surface
marcosmoura 9e28ae6
Discard changes to packages/react-components/react-dialog/src/compone…
marcosmoura fcfd86d
Discard changes to packages/react-components/react-dialog/src/index.ts
marcosmoura 3ffc170
Discard changes to packages/react-components/react-dialog/etc/react-d…
marcosmoura dbfedaa
Discard changes to packages/react-components/react-dialog/src/compone…
marcosmoura 06d4251
Merge branch 'master' into feat/react-drawer/drawer-overlay-surface
marcosmoura 5d87fbf
fix: use values already present on dialog state
marcosmoura 1477140
fix: remove duplicated backdrop class name
marcosmoura 13a20d6
Discard changes to change/@fluentui-react-dialog-04ca4ed5-a856-4939-b…
marcosmoura e0af5ed
fix: dependency mismatch
marcosmoura be009b7
Merge branch 'master' into feat/react-drawer/drawer-overlay-surface
marcosmoura 8960a49
fix: generate API
marcosmoura 325e42d
fix: use tokens for transparent colors
marcosmoura 5f49913
fix: unify style in order to minimize atomic classes
marcosmoura f298094
fix: cypress tests
marcosmoura 0183421
fix: improve types and generate API file
marcosmoura 4d0a102
fix: dependency mismatch
marcosmoura File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
change/@fluentui-react-drawer-840c300d-046b-4ec7-b733-f88067df7dea.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "type": "prerelease", | ||
| "comment": "feat: make dialog slot internal to be used for composition only", | ||
| "packageName": "@fluentui/react-drawer", | ||
| "email": "[email protected]", | ||
| "dependentChangeType": "patch" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...s/react-drawer/src/components/DrawerOverlay/DrawerOverlaySurface/DrawerOverlaySurface.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import * as React from 'react'; | ||
| import type { ForwardRefComponent } from '@fluentui/react-utilities'; | ||
| import { | ||
| useDialogSurface_unstable, | ||
| useDialogSurfaceContextValues_unstable, | ||
| renderDialogSurface_unstable, | ||
| } from '@fluentui/react-dialog'; | ||
|
|
||
| import { useDrawerOverlaySurfaceStyles_unstable } from './useDrawerOverlaySurfaceStyles.styles'; | ||
| import type { DrawerOverlaySurfaceProps } from './DrawerOverlaySurface.types'; | ||
|
|
||
| /** | ||
| * @internal | ||
| * DrawerOverlaySurface is a proxy for DialogSurface as is only meant to be used internally for Drawer. | ||
| */ | ||
| export const DrawerOverlaySurface: ForwardRefComponent<DrawerOverlaySurfaceProps> = React.forwardRef((props, ref) => { | ||
| const dialogSurfaceState = useDialogSurface_unstable(props, ref); | ||
| const dialogSurfaceContextValues = useDialogSurfaceContextValues_unstable(dialogSurfaceState); | ||
|
|
||
| useDrawerOverlaySurfaceStyles_unstable(dialogSurfaceState); | ||
|
|
||
| return renderDialogSurface_unstable(dialogSurfaceState, dialogSurfaceContextValues); | ||
| }); | ||
|
|
||
| DrawerOverlaySurface.displayName = 'DrawerOverlaySurface'; |
17 changes: 17 additions & 0 deletions
17
...ct-drawer/src/components/DrawerOverlay/DrawerOverlaySurface/DrawerOverlaySurface.types.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import type { DialogSurfaceSlots, DialogSurfaceState } from '@fluentui/react-dialog'; | ||
| import type { ComponentProps, ComponentState } from '@fluentui/react-utilities'; | ||
|
|
||
| /** | ||
| * DrawerOverlaySurface slots | ||
| */ | ||
| export type DrawerOverlaySurfaceSlots = DialogSurfaceSlots; | ||
|
|
||
| /** | ||
| * DrawerOverlaySurface Props | ||
| */ | ||
| export type DrawerOverlaySurfaceProps = ComponentProps<DrawerOverlaySurfaceSlots>; | ||
|
|
||
| /** | ||
| * State used in rendering DrawerOverlaySurface | ||
| */ | ||
| export type DrawerOverlaySurfaceState = ComponentState<DrawerOverlaySurfaceSlots> & DialogSurfaceState; |
2 changes: 2 additions & 0 deletions
2
.../react-components/react-drawer/src/components/DrawerOverlay/DrawerOverlaySurface/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| export * from './DrawerOverlaySurface'; | ||
| export * from './DrawerOverlaySurface.types'; |
43 changes: 43 additions & 0 deletions
43
...src/components/DrawerOverlay/DrawerOverlaySurface/useDrawerOverlaySurfaceStyles.styles.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import { makeResetStyles, makeStyles, mergeClasses, shorthands } from '@griffel/react'; | ||
| import type { SlotClassNames } from '@fluentui/react-utilities'; | ||
| import { tokens } from '@fluentui/react-theme'; | ||
|
|
||
| import type { DrawerOverlaySurfaceSlots, DrawerOverlaySurfaceState } from './DrawerOverlaySurface.types'; | ||
|
|
||
| export const drawerOverlaySurfaceClassNames: SlotClassNames<DrawerOverlaySurfaceSlots> = { | ||
| root: 'fui-DrawerOverlaySurface', | ||
| backdrop: 'fui-DrawerOverlaySurface__backdrop', | ||
| }; | ||
|
|
||
| /** | ||
| * Styles for the backdrop slot | ||
| */ | ||
| const useBackdropResetStyles = makeResetStyles({ | ||
| ...shorthands.inset('0px'), | ||
| position: 'fixed', | ||
| backgroundColor: 'rgba(0, 0, 0, 0.4)', | ||
| }); | ||
|
|
||
| const useBackdropStyles = makeStyles({ | ||
| nested: { | ||
| backgroundColor: tokens.colorTransparentBackground, | ||
| }, | ||
| }); | ||
|
|
||
| /** | ||
| * Apply styling to the DrawerOverlaySurface slots based on the state | ||
| */ | ||
| export const useDrawerOverlaySurfaceStyles_unstable = (state: DrawerOverlaySurfaceState): DrawerOverlaySurfaceState => { | ||
| const backdropResetStyles = useBackdropResetStyles(); | ||
| const backdropStyles = useBackdropStyles(); | ||
|
|
||
| if (state.backdrop) { | ||
| state.backdrop.className = mergeClasses( | ||
| backdropResetStyles, | ||
| state.isNestedDialog && backdropStyles.nested, | ||
| state.backdrop.className, | ||
| ); | ||
| } | ||
|
|
||
| return state; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.