@fluentui/react-dialog 9.7.9 → 9.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +82 -2
- package/CHANGELOG.md +28 -3
- package/dist/index.d.ts +3 -1
- package/lib/components/Dialog/renderDialog.js +14 -1
- package/lib/components/Dialog/renderDialog.js.map +1 -1
- package/lib/components/Dialog/useDialog.js +1 -1
- package/lib/components/Dialog/useDialog.js.map +1 -1
- package/lib/components/DialogSurface/DialogSurface.types.js.map +1 -1
- package/lib/components/DialogSurface/useDialogSurface.js +4 -2
- package/lib/components/DialogSurface/useDialogSurface.js.map +1 -1
- package/lib/components/DialogSurface/useDialogSurfaceStyles.styles.js +48 -15
- package/lib/components/DialogSurface/useDialogSurfaceStyles.styles.js.map +1 -1
- package/lib/contexts/dialogTransitionContext.js +17 -0
- package/lib/contexts/dialogTransitionContext.js.map +1 -0
- package/lib-commonjs/components/Dialog/renderDialog.js +14 -1
- package/lib-commonjs/components/Dialog/renderDialog.js.map +1 -1
- package/lib-commonjs/components/Dialog/useDialog.js +1 -1
- package/lib-commonjs/components/Dialog/useDialog.js.map +1 -1
- package/lib-commonjs/components/DialogSurface/useDialogSurface.js +4 -2
- package/lib-commonjs/components/DialogSurface/useDialogSurface.js.map +1 -1
- package/lib-commonjs/components/DialogSurface/useDialogSurfaceStyles.styles.js +62 -27
- package/lib-commonjs/components/DialogSurface/useDialogSurfaceStyles.styles.js.map +1 -1
- package/lib-commonjs/contexts/dialogTransitionContext.js +32 -0
- package/lib-commonjs/contexts/dialogTransitionContext.js.map +1 -0
- package/package.json +8 -7
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,87 @@
|
|
|
2
2
|
"name": "@fluentui/react-dialog",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Mon, 23 Oct 2023 09:48:55 GMT",
|
|
6
|
+
"tag": "@fluentui/react-dialog_v9.8.0",
|
|
7
|
+
"version": "9.8.0",
|
|
8
|
+
"comments": {
|
|
9
|
+
"minor": [
|
|
10
|
+
{
|
|
11
|
+
"author": "bernardo.sunderhus@gmail.com",
|
|
12
|
+
"package": "@fluentui/react-dialog",
|
|
13
|
+
"commit": "4ac68a632b61c2cb1886f32a6293c3218bf07c0e",
|
|
14
|
+
"comment": "feat: adds motion to DialogSurface"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "beachball",
|
|
18
|
+
"package": "@fluentui/react-dialog",
|
|
19
|
+
"comment": "Bump @fluentui/react-tabster to v9.14.1",
|
|
20
|
+
"commit": "e4ef1febe8a185dddc10f8936944d177d50bc396"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "beachball",
|
|
24
|
+
"package": "@fluentui/react-dialog",
|
|
25
|
+
"comment": "Bump @fluentui/react-portal to v9.3.25",
|
|
26
|
+
"commit": "e4ef1febe8a185dddc10f8936944d177d50bc396"
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"date": "Wed, 18 Oct 2023 17:54:03 GMT",
|
|
33
|
+
"tag": "@fluentui/react-dialog_v9.7.10",
|
|
34
|
+
"version": "9.7.10",
|
|
35
|
+
"comments": {
|
|
36
|
+
"none": [
|
|
37
|
+
{
|
|
38
|
+
"author": "lingfangao@hotmail.com",
|
|
39
|
+
"package": "@fluentui/react-dialog",
|
|
40
|
+
"commit": "aa6771ed95c5af78f413b3c20068867f032cf4c4",
|
|
41
|
+
"comment": "chore: Add e2e tests for virtual parents"
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
"patch": [
|
|
45
|
+
{
|
|
46
|
+
"author": "beachball",
|
|
47
|
+
"package": "@fluentui/react-dialog",
|
|
48
|
+
"comment": "Bump @fluentui/react-utilities to v9.15.1",
|
|
49
|
+
"commit": "c0d3065982e1646c54ba00c1d524248b792dbcad"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"author": "beachball",
|
|
53
|
+
"package": "@fluentui/react-dialog",
|
|
54
|
+
"comment": "Bump @fluentui/react-jsx-runtime to v9.0.18",
|
|
55
|
+
"commit": "c0d3065982e1646c54ba00c1d524248b792dbcad"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"author": "beachball",
|
|
59
|
+
"package": "@fluentui/react-dialog",
|
|
60
|
+
"comment": "Bump @fluentui/react-context-selector to v9.1.41",
|
|
61
|
+
"commit": "c0d3065982e1646c54ba00c1d524248b792dbcad"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"author": "beachball",
|
|
65
|
+
"package": "@fluentui/react-dialog",
|
|
66
|
+
"comment": "Bump @fluentui/react-aria to v9.3.43",
|
|
67
|
+
"commit": "c0d3065982e1646c54ba00c1d524248b792dbcad"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"author": "beachball",
|
|
71
|
+
"package": "@fluentui/react-dialog",
|
|
72
|
+
"comment": "Bump @fluentui/react-tabster to v9.14.0",
|
|
73
|
+
"commit": "c0d3065982e1646c54ba00c1d524248b792dbcad"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"author": "beachball",
|
|
77
|
+
"package": "@fluentui/react-dialog",
|
|
78
|
+
"comment": "Bump @fluentui/react-portal to v9.3.24",
|
|
79
|
+
"commit": "c0d3065982e1646c54ba00c1d524248b792dbcad"
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"date": "Thu, 12 Oct 2023 14:55:44 GMT",
|
|
6
86
|
"tag": "@fluentui/react-dialog_v9.7.9",
|
|
7
87
|
"version": "9.7.9",
|
|
8
88
|
"comments": {
|
|
@@ -11,7 +91,7 @@
|
|
|
11
91
|
"author": "beachball",
|
|
12
92
|
"package": "@fluentui/react-dialog",
|
|
13
93
|
"comment": "Bump @fluentui/react-jsx-runtime to v9.0.17",
|
|
14
|
-
"commit": "
|
|
94
|
+
"commit": "8178c3cae60005bc21137aa1f3e766e18cdb4a30"
|
|
15
95
|
}
|
|
16
96
|
]
|
|
17
97
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,17 +1,42 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-dialog
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Mon, 23 Oct 2023 09:48:55 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.8.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-dialog_v9.8.0)
|
|
8
|
+
|
|
9
|
+
Mon, 23 Oct 2023 09:48:55 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-dialog_v9.7.10..@fluentui/react-dialog_v9.8.0)
|
|
11
|
+
|
|
12
|
+
### Minor changes
|
|
13
|
+
|
|
14
|
+
- feat: adds motion to DialogSurface ([PR #29391](https://github.com/microsoft/fluentui/pull/29391) by bernardo.sunderhus@gmail.com)
|
|
15
|
+
- Bump @fluentui/react-tabster to v9.14.1 ([commit](https://github.com/microsoft/fluentui/commit/e4ef1febe8a185dddc10f8936944d177d50bc396) by beachball)
|
|
16
|
+
- Bump @fluentui/react-portal to v9.3.25 ([commit](https://github.com/microsoft/fluentui/commit/e4ef1febe8a185dddc10f8936944d177d50bc396) by beachball)
|
|
17
|
+
|
|
18
|
+
## [9.7.10](https://github.com/microsoft/fluentui/tree/@fluentui/react-dialog_v9.7.10)
|
|
19
|
+
|
|
20
|
+
Wed, 18 Oct 2023 17:54:03 GMT
|
|
21
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-dialog_v9.7.9..@fluentui/react-dialog_v9.7.10)
|
|
22
|
+
|
|
23
|
+
### Patches
|
|
24
|
+
|
|
25
|
+
- Bump @fluentui/react-utilities to v9.15.1 ([PR #29560](https://github.com/microsoft/fluentui/pull/29560) by beachball)
|
|
26
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.18 ([PR #29560](https://github.com/microsoft/fluentui/pull/29560) by beachball)
|
|
27
|
+
- Bump @fluentui/react-context-selector to v9.1.41 ([PR #29560](https://github.com/microsoft/fluentui/pull/29560) by beachball)
|
|
28
|
+
- Bump @fluentui/react-aria to v9.3.43 ([PR #29560](https://github.com/microsoft/fluentui/pull/29560) by beachball)
|
|
29
|
+
- Bump @fluentui/react-tabster to v9.14.0 ([PR #29560](https://github.com/microsoft/fluentui/pull/29560) by beachball)
|
|
30
|
+
- Bump @fluentui/react-portal to v9.3.24 ([PR #29560](https://github.com/microsoft/fluentui/pull/29560) by beachball)
|
|
31
|
+
|
|
7
32
|
## [9.7.9](https://github.com/microsoft/fluentui/tree/@fluentui/react-dialog_v9.7.9)
|
|
8
33
|
|
|
9
|
-
Thu, 12 Oct 2023 14:
|
|
34
|
+
Thu, 12 Oct 2023 14:55:44 GMT
|
|
10
35
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-dialog_v9.7.8..@fluentui/react-dialog_v9.7.9)
|
|
11
36
|
|
|
12
37
|
### Patches
|
|
13
38
|
|
|
14
|
-
- Bump @fluentui/react-jsx-runtime to v9.0.17 ([PR #
|
|
39
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.17 ([PR #29513](https://github.com/microsoft/fluentui/pull/29513) by beachball)
|
|
15
40
|
|
|
16
41
|
## [9.7.8](https://github.com/microsoft/fluentui/tree/@fluentui/react-dialog_v9.7.8)
|
|
17
42
|
|
package/dist/index.d.ts
CHANGED
|
@@ -255,7 +255,9 @@ export declare type DialogSurfaceSlots = {
|
|
|
255
255
|
/**
|
|
256
256
|
* State used in rendering DialogSurface
|
|
257
257
|
*/
|
|
258
|
-
export declare type DialogSurfaceState = ComponentState<DialogSurfaceSlots> &
|
|
258
|
+
export declare type DialogSurfaceState = ComponentState<DialogSurfaceSlots> & Pick<DialogContextValue, 'isNestedDialog'> & Pick<PortalProps, 'mountNode'> & {
|
|
259
|
+
transitionStatus?: 'entering' | 'entered' | 'idle' | 'exiting' | 'exited' | 'unmounted';
|
|
260
|
+
};
|
|
259
261
|
|
|
260
262
|
/**
|
|
261
263
|
* The `DialogTitle` component expects to have a title/header
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
|
+
import { Transition } from 'react-transition-group';
|
|
2
3
|
import { DialogProvider, DialogSurfaceProvider } from '../../contexts';
|
|
4
|
+
import { DialogTransitionProvider } from '../../contexts/dialogTransitionContext';
|
|
3
5
|
/**
|
|
4
6
|
* Render the final JSX of Dialog
|
|
5
7
|
*/ export const renderDialog_unstable = (state, contextValues)=>{
|
|
@@ -10,7 +12,18 @@ import { DialogProvider, DialogSurfaceProvider } from '../../contexts';
|
|
|
10
12
|
value: contextValues.dialogSurface,
|
|
11
13
|
children: [
|
|
12
14
|
trigger,
|
|
13
|
-
|
|
15
|
+
/*#__PURE__*/ _jsx(Transition, {
|
|
16
|
+
mountOnEnter: true,
|
|
17
|
+
unmountOnExit: true,
|
|
18
|
+
in: state.open,
|
|
19
|
+
nodeRef: state.dialogRef,
|
|
20
|
+
// FIXME: this should not be hardcoded tokens.durationGentle
|
|
21
|
+
timeout: 250,
|
|
22
|
+
children: (status)=>/*#__PURE__*/ _jsx(DialogTransitionProvider, {
|
|
23
|
+
value: status,
|
|
24
|
+
children: content
|
|
25
|
+
})
|
|
26
|
+
})
|
|
14
27
|
]
|
|
15
28
|
})
|
|
16
29
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderDialog.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { DialogProvider, DialogSurfaceProvider } from '../../contexts';\nimport type { DialogState, DialogContextValues } from './Dialog.types';\n\n/**\n * Render the final JSX of Dialog\n */\nexport const renderDialog_unstable = (state: DialogState, contextValues: DialogContextValues) => {\n const { content, trigger } = state;\n\n return (\n <DialogProvider value={contextValues.dialog}>\n <DialogSurfaceProvider value={contextValues.dialogSurface}>\n {trigger}\n {content}\n </DialogSurfaceProvider>\n </DialogProvider>\n );\n};\n"],"names":["DialogProvider","DialogSurfaceProvider","renderDialog_unstable","state","contextValues","content","trigger","value","dialog","dialogSurface"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,cAAc,EAAEC,qBAAqB,QAAQ,iBAAiB;
|
|
1
|
+
{"version":3,"sources":["renderDialog.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { Transition } from 'react-transition-group';\nimport { DialogProvider, DialogSurfaceProvider } from '../../contexts';\nimport type { DialogState, DialogContextValues } from './Dialog.types';\nimport { DialogTransitionProvider } from '../../contexts/dialogTransitionContext';\n\n/**\n * Render the final JSX of Dialog\n */\nexport const renderDialog_unstable = (state: DialogState, contextValues: DialogContextValues) => {\n const { content, trigger } = state;\n\n return (\n <DialogProvider value={contextValues.dialog}>\n <DialogSurfaceProvider value={contextValues.dialogSurface}>\n {trigger}\n <Transition\n mountOnEnter\n unmountOnExit\n in={state.open}\n nodeRef={state.dialogRef}\n // FIXME: this should not be hardcoded tokens.durationGentle\n timeout={250}\n >\n {status => <DialogTransitionProvider value={status}>{content}</DialogTransitionProvider>}\n </Transition>\n </DialogSurfaceProvider>\n </DialogProvider>\n );\n};\n"],"names":["Transition","DialogProvider","DialogSurfaceProvider","DialogTransitionProvider","renderDialog_unstable","state","contextValues","content","trigger","value","dialog","dialogSurface","mountOnEnter","unmountOnExit","in","open","nodeRef","dialogRef","timeout","status"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,UAAU,QAAQ,yBAAyB;AACpD,SAASC,cAAc,EAAEC,qBAAqB,QAAQ,iBAAiB;AAEvE,SAASC,wBAAwB,QAAQ,yCAAyC;AAElF;;CAEC,GACD,OAAO,MAAMC,wBAAwB,CAACC,OAAoBC;IACxD,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAE,GAAGH;IAE7B,qBACE,KAACJ;QAAeQ,OAAOH,cAAcI,MAAM;kBACzC,cAAA,MAACR;YAAsBO,OAAOH,cAAcK,aAAa;;gBACtDH;8BACD,KAACR;oBACCY,YAAY;oBACZC,aAAa;oBACbC,IAAIT,MAAMU,IAAI;oBACdC,SAASX,MAAMY,SAAS;oBACxB,4DAA4D;oBAC5DC,SAAS;8BAERC,CAAAA,uBAAU,KAAChB;4BAAyBM,OAAOU;sCAASZ;;;;;;AAK/D,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useDialog.ts"],"sourcesContent":["import * as React from 'react';\nimport { useControllableState, useEventCallback, useId, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport { useHasParentContext } from '@fluentui/react-context-selector';\nimport { useDisableBodyScroll, useFocusFirstElement } from '../../utils';\nimport { DialogContext } from '../../contexts';\n\nimport type { DialogOpenChangeData, DialogProps, DialogState } from './Dialog.types';\nimport { useModalAttributes } from '@fluentui/react-tabster';\n\n/**\n * Create the state required to render Dialog.\n *\n * The returned state can be modified with hooks such as useDialogStyles_unstable,\n * before being passed to renderDialog_unstable.\n *\n * @param props - props from this instance of Dialog\n */\nexport const useDialog_unstable = (props: DialogProps): DialogState => {\n const { children, modalType = 'modal', onOpenChange, inertTrapFocus = false } = props;\n\n const [trigger, content] = childrenToTriggerAndContent(children);\n\n const [open, setOpen] = useControllableState({\n state: props.open,\n defaultState: props.defaultOpen,\n initialState: false,\n });\n\n const requestOpenChange = useEventCallback((data: DialogOpenChangeData) => {\n onOpenChange?.(data.event, data);\n\n // if user prevents default then do not change state value\n // otherwise updates state value and trigger reference to the element that caused the opening\n if (!data.event.isDefaultPrevented()) {\n setOpen(data.open);\n }\n });\n\n const focusRef = useFocusFirstElement(open, modalType);\n const disableBodyScroll = useDisableBodyScroll();\n const isBodyScrollLocked = Boolean(open && modalType !== 'non-modal');\n\n useIsomorphicLayoutEffect(() => {\n if (isBodyScrollLocked) {\n return disableBodyScroll();\n }\n }, [disableBodyScroll, isBodyScrollLocked]);\n\n const { modalAttributes, triggerAttributes } = useModalAttributes({\n trapFocus: modalType !== 'non-modal',\n legacyTrapFocus: !inertTrapFocus,\n });\n\n return {\n components: {\n backdrop: 'div',\n },\n inertTrapFocus,\n open,\n modalType,\n content
|
|
1
|
+
{"version":3,"sources":["useDialog.ts"],"sourcesContent":["import * as React from 'react';\nimport { useControllableState, useEventCallback, useId, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport { useHasParentContext } from '@fluentui/react-context-selector';\nimport { useDisableBodyScroll, useFocusFirstElement } from '../../utils';\nimport { DialogContext } from '../../contexts';\n\nimport type { DialogOpenChangeData, DialogProps, DialogState } from './Dialog.types';\nimport { useModalAttributes } from '@fluentui/react-tabster';\n\n/**\n * Create the state required to render Dialog.\n *\n * The returned state can be modified with hooks such as useDialogStyles_unstable,\n * before being passed to renderDialog_unstable.\n *\n * @param props - props from this instance of Dialog\n */\nexport const useDialog_unstable = (props: DialogProps): DialogState => {\n const { children, modalType = 'modal', onOpenChange, inertTrapFocus = false } = props;\n\n const [trigger, content] = childrenToTriggerAndContent(children);\n\n const [open, setOpen] = useControllableState({\n state: props.open,\n defaultState: props.defaultOpen,\n initialState: false,\n });\n\n const requestOpenChange = useEventCallback((data: DialogOpenChangeData) => {\n onOpenChange?.(data.event, data);\n\n // if user prevents default then do not change state value\n // otherwise updates state value and trigger reference to the element that caused the opening\n if (!data.event.isDefaultPrevented()) {\n setOpen(data.open);\n }\n });\n\n const focusRef = useFocusFirstElement(open, modalType);\n const disableBodyScroll = useDisableBodyScroll();\n const isBodyScrollLocked = Boolean(open && modalType !== 'non-modal');\n\n useIsomorphicLayoutEffect(() => {\n if (isBodyScrollLocked) {\n return disableBodyScroll();\n }\n }, [disableBodyScroll, isBodyScrollLocked]);\n\n const { modalAttributes, triggerAttributes } = useModalAttributes({\n trapFocus: modalType !== 'non-modal',\n legacyTrapFocus: !inertTrapFocus,\n });\n\n return {\n components: {\n backdrop: 'div',\n },\n inertTrapFocus,\n open,\n modalType,\n content,\n trigger,\n requestOpenChange,\n dialogTitleId: useId('dialog-title-'),\n isNestedDialog: useHasParentContext(DialogContext),\n dialogRef: focusRef,\n modalAttributes: modalType !== 'non-modal' ? modalAttributes : undefined,\n triggerAttributes,\n };\n};\n\n/**\n * Extracts trigger and content from children\n */\nfunction childrenToTriggerAndContent(\n children: React.ReactNode,\n): readonly [trigger: React.ReactNode, content: React.ReactNode] {\n const childrenArray = React.Children.toArray(children) as React.ReactElement[];\n if (process.env.NODE_ENV !== 'production') {\n if (childrenArray.length !== 1 && childrenArray.length !== 2) {\n // eslint-disable-next-line no-console\n console.warn(/* #__DE-INDENT__ */ `\n @fluentui/react-dialog [useDialog]:\n Dialog must contain at least one child <DialogSurface/>,\n and at most two children <DialogTrigger/> <DialogSurface/> (in this order).\n `);\n }\n }\n switch (childrenArray.length) {\n // case where there's a trigger followed by content\n case 2:\n return childrenArray as [trigger: React.ReactNode, content: React.ReactNode];\n // case where there's only content\n case 1:\n return [undefined, childrenArray[0]];\n // unknown case\n default:\n return [undefined, undefined];\n }\n}\n"],"names":["React","useControllableState","useEventCallback","useId","useIsomorphicLayoutEffect","useHasParentContext","useDisableBodyScroll","useFocusFirstElement","DialogContext","useModalAttributes","useDialog_unstable","props","children","modalType","onOpenChange","inertTrapFocus","trigger","content","childrenToTriggerAndContent","open","setOpen","state","defaultState","defaultOpen","initialState","requestOpenChange","data","event","isDefaultPrevented","focusRef","disableBodyScroll","isBodyScrollLocked","Boolean","modalAttributes","triggerAttributes","trapFocus","legacyTrapFocus","components","backdrop","dialogTitleId","isNestedDialog","dialogRef","undefined","childrenArray","Children","toArray","process","env","NODE_ENV","length","console","warn"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,oBAAoB,EAAEC,gBAAgB,EAAEC,KAAK,EAAEC,yBAAyB,QAAQ,4BAA4B;AACrH,SAASC,mBAAmB,QAAQ,mCAAmC;AACvE,SAASC,oBAAoB,EAAEC,oBAAoB,QAAQ,cAAc;AACzE,SAASC,aAAa,QAAQ,iBAAiB;AAG/C,SAASC,kBAAkB,QAAQ,0BAA0B;AAE7D;;;;;;;CAOC,GACD,OAAO,MAAMC,qBAAqB,CAACC;IACjC,MAAM,EAAEC,QAAQ,EAAEC,YAAY,OAAO,EAAEC,YAAY,EAAEC,iBAAiB,KAAK,EAAE,GAAGJ;IAEhF,MAAM,CAACK,SAASC,QAAQ,GAAGC,4BAA4BN;IAEvD,MAAM,CAACO,MAAMC,QAAQ,GAAGnB,qBAAqB;QAC3CoB,OAAOV,MAAMQ,IAAI;QACjBG,cAAcX,MAAMY,WAAW;QAC/BC,cAAc;IAChB;IAEA,MAAMC,oBAAoBvB,iBAAiB,CAACwB;QAC1CZ,yBAAAA,mCAAAA,aAAeY,KAAKC,KAAK,EAAED;QAE3B,0DAA0D;QAC1D,6FAA6F;QAC7F,IAAI,CAACA,KAAKC,KAAK,CAACC,kBAAkB,IAAI;YACpCR,QAAQM,KAAKP,IAAI;QACnB;IACF;IAEA,MAAMU,WAAWtB,qBAAqBY,MAAMN;IAC5C,MAAMiB,oBAAoBxB;IAC1B,MAAMyB,qBAAqBC,QAAQb,QAAQN,cAAc;IAEzDT,0BAA0B;QACxB,IAAI2B,oBAAoB;YACtB,OAAOD;QACT;IACF,GAAG;QAACA;QAAmBC;KAAmB;IAE1C,MAAM,EAAEE,eAAe,EAAEC,iBAAiB,EAAE,GAAGzB,mBAAmB;QAChE0B,WAAWtB,cAAc;QACzBuB,iBAAiB,CAACrB;IACpB;IAEA,OAAO;QACLsB,YAAY;YACVC,UAAU;QACZ;QACAvB;QACAI;QACAN;QACAI;QACAD;QACAS;QACAc,eAAepC,MAAM;QACrBqC,gBAAgBnC,oBAAoBG;QACpCiC,WAAWZ;QACXI,iBAAiBpB,cAAc,cAAcoB,kBAAkBS;QAC/DR;IACF;AACF,EAAE;AAEF;;CAEC,GACD,SAAShB,4BACPN,QAAyB;IAEzB,MAAM+B,gBAAgB3C,MAAM4C,QAAQ,CAACC,OAAO,CAACjC;IAC7C,IAAIkC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,IAAIL,cAAcM,MAAM,KAAK,KAAKN,cAAcM,MAAM,KAAK,GAAG;YAC5D,sCAAsC;YACtCC,QAAQC,IAAI,CAAsB,CAAC;;2EAInC,CAAC;QACH;IACF;IACA,OAAQR,cAAcM,MAAM;QAC1B,mDAAmD;QACnD,KAAK;YACH,OAAON;QACT,kCAAkC;QAClC,KAAK;YACH,OAAO;gBAACD;gBAAWC,aAAa,CAAC,EAAE;aAAC;QACtC,eAAe;QACf;YACE,OAAO;gBAACD;gBAAWA;aAAU;IACjC;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DialogSurface.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { PortalProps } from '@fluentui/react-portal';\nimport { DialogContextValue, DialogSurfaceContextValue } from '../../contexts';\n\nexport type DialogSurfaceSlots = {\n /**\n * Dimmed background of dialog.\n * The default backdrop is rendered as a `<div>` with styling.\n * This slot expects a `<div>` element which will replace the default backdrop.\n * The backdrop should have `aria-hidden=\"true\"`.\n *\n */\n backdrop?: Slot<'div'>;\n root: Slot<'div'>;\n};\n\n/**\n * Union between all possible semantic element that represent a DialogSurface\n */\nexport type DialogSurfaceElement = HTMLElement;\n\n/**\n * DialogSurface Props\n */\nexport type DialogSurfaceProps = ComponentProps<DialogSurfaceSlots> & Pick<PortalProps, 'mountNode'>;\n\nexport type DialogSurfaceContextValues = {\n dialogSurface: DialogSurfaceContextValue;\n};\n\n/**\n * State used in rendering DialogSurface\n */\nexport type DialogSurfaceState = ComponentState<DialogSurfaceSlots> &\n // This is only partial to avoid breaking changes, it should be mandatory and in fact it is always defined internally.\n
|
|
1
|
+
{"version":3,"sources":["DialogSurface.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { PortalProps } from '@fluentui/react-portal';\nimport { DialogContextValue, DialogSurfaceContextValue } from '../../contexts';\n\nexport type DialogSurfaceSlots = {\n /**\n * Dimmed background of dialog.\n * The default backdrop is rendered as a `<div>` with styling.\n * This slot expects a `<div>` element which will replace the default backdrop.\n * The backdrop should have `aria-hidden=\"true\"`.\n *\n */\n backdrop?: Slot<'div'>;\n root: Slot<'div'>;\n};\n\n/**\n * Union between all possible semantic element that represent a DialogSurface\n */\nexport type DialogSurfaceElement = HTMLElement;\n\n/**\n * DialogSurface Props\n */\nexport type DialogSurfaceProps = ComponentProps<DialogSurfaceSlots> & Pick<PortalProps, 'mountNode'>;\n\nexport type DialogSurfaceContextValues = {\n dialogSurface: DialogSurfaceContextValue;\n};\n\n/**\n * State used in rendering DialogSurface\n */\nexport type DialogSurfaceState = ComponentState<DialogSurfaceSlots> &\n // This is only partial to avoid breaking changes, it should be mandatory and in fact it is always defined internally.\n Pick<DialogContextValue, 'isNestedDialog'> &\n Pick<PortalProps, 'mountNode'> & {\n // This is only optional to avoid breaking changes, it should be mandatory and in fact it is always defined internally.\n transitionStatus?: 'entering' | 'entered' | 'idle' | 'exiting' | 'exited' | 'unmounted';\n };\n"],"names":[],"mappings":"AAAA,WAuCI"}
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { useEventCallback, useMergedRefs, isResolvedShorthand, slot, getIntrinsicElementProps } from '@fluentui/react-utilities';
|
|
3
3
|
import { useDialogContext_unstable } from '../../contexts';
|
|
4
4
|
import { Escape } from '@fluentui/keyboard-keys';
|
|
5
|
+
import { useDialogTransitionContext_unstable } from '../../contexts/dialogTransitionContext';
|
|
5
6
|
/**
|
|
6
7
|
* Create the state required to render DialogSurface.
|
|
7
8
|
*
|
|
@@ -13,9 +14,9 @@ import { Escape } from '@fluentui/keyboard-keys';
|
|
|
13
14
|
*/ export const useDialogSurface_unstable = (props, ref)=>{
|
|
14
15
|
const modalType = useDialogContext_unstable((ctx)=>ctx.modalType);
|
|
15
16
|
const isNestedDialog = useDialogContext_unstable((ctx)=>ctx.isNestedDialog);
|
|
17
|
+
const transitionStatus = useDialogTransitionContext_unstable();
|
|
16
18
|
const modalAttributes = useDialogContext_unstable((ctx)=>ctx.modalAttributes);
|
|
17
19
|
const dialogRef = useDialogContext_unstable((ctx)=>ctx.dialogRef);
|
|
18
|
-
const open = useDialogContext_unstable((ctx)=>ctx.open);
|
|
19
20
|
const requestOpenChange = useDialogContext_unstable((ctx)=>ctx.requestOpenChange);
|
|
20
21
|
const dialogTitleID = useDialogContext_unstable((ctx)=>ctx.dialogTitleId);
|
|
21
22
|
const handledBackdropClick = useEventCallback((event)=>{
|
|
@@ -46,7 +47,7 @@ import { Escape } from '@fluentui/keyboard-keys';
|
|
|
46
47
|
}
|
|
47
48
|
});
|
|
48
49
|
const backdrop = slot.optional(props.backdrop, {
|
|
49
|
-
renderByDefault:
|
|
50
|
+
renderByDefault: modalType !== 'non-modal',
|
|
50
51
|
defaultProps: {
|
|
51
52
|
'aria-hidden': 'true'
|
|
52
53
|
},
|
|
@@ -62,6 +63,7 @@ import { Escape } from '@fluentui/keyboard-keys';
|
|
|
62
63
|
},
|
|
63
64
|
backdrop,
|
|
64
65
|
isNestedDialog,
|
|
66
|
+
transitionStatus,
|
|
65
67
|
mountNode: props.mountNode,
|
|
66
68
|
root: slot.always(getIntrinsicElementProps('div', {
|
|
67
69
|
tabIndex: -1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useDialogSurface.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n useEventCallback,\n useMergedRefs,\n isResolvedShorthand,\n slot,\n getIntrinsicElementProps,\n} from '@fluentui/react-utilities';\nimport type { DialogSurfaceElement, DialogSurfaceProps, DialogSurfaceState } from './DialogSurface.types';\nimport { useDialogContext_unstable } from '../../contexts';\nimport { Escape } from '@fluentui/keyboard-keys';\n\n/**\n * Create the state required to render DialogSurface.\n *\n * The returned state can be modified with hooks such as useDialogSurfaceStyles_unstable,\n * before being passed to renderDialogSurface_unstable.\n *\n * @param props - props from this instance of DialogSurface\n * @param ref - reference to root HTMLElement of DialogSurface\n */\nexport const useDialogSurface_unstable = (\n props: DialogSurfaceProps,\n ref: React.Ref<DialogSurfaceElement>,\n): DialogSurfaceState => {\n const modalType = useDialogContext_unstable(ctx => ctx.modalType);\n const isNestedDialog = useDialogContext_unstable(ctx => ctx.isNestedDialog);\n const
|
|
1
|
+
{"version":3,"sources":["useDialogSurface.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n useEventCallback,\n useMergedRefs,\n isResolvedShorthand,\n slot,\n getIntrinsicElementProps,\n} from '@fluentui/react-utilities';\nimport type { DialogSurfaceElement, DialogSurfaceProps, DialogSurfaceState } from './DialogSurface.types';\nimport { useDialogContext_unstable } from '../../contexts';\nimport { Escape } from '@fluentui/keyboard-keys';\nimport { useDialogTransitionContext_unstable } from '../../contexts/dialogTransitionContext';\n\n/**\n * Create the state required to render DialogSurface.\n *\n * The returned state can be modified with hooks such as useDialogSurfaceStyles_unstable,\n * before being passed to renderDialogSurface_unstable.\n *\n * @param props - props from this instance of DialogSurface\n * @param ref - reference to root HTMLElement of DialogSurface\n */\nexport const useDialogSurface_unstable = (\n props: DialogSurfaceProps,\n ref: React.Ref<DialogSurfaceElement>,\n): DialogSurfaceState => {\n const modalType = useDialogContext_unstable(ctx => ctx.modalType);\n const isNestedDialog = useDialogContext_unstable(ctx => ctx.isNestedDialog);\n const transitionStatus = useDialogTransitionContext_unstable();\n const modalAttributes = useDialogContext_unstable(ctx => ctx.modalAttributes);\n const dialogRef = useDialogContext_unstable(ctx => ctx.dialogRef);\n const requestOpenChange = useDialogContext_unstable(ctx => ctx.requestOpenChange);\n const dialogTitleID = useDialogContext_unstable(ctx => ctx.dialogTitleId);\n\n const handledBackdropClick = useEventCallback((event: React.MouseEvent<HTMLDivElement>) => {\n if (isResolvedShorthand(props.backdrop)) {\n props.backdrop.onClick?.(event);\n }\n if (modalType === 'modal' && !event.isDefaultPrevented()) {\n requestOpenChange({\n event,\n open: false,\n type: 'backdropClick',\n });\n }\n });\n\n const handleKeyDown = useEventCallback((event: React.KeyboardEvent<HTMLDivElement>) => {\n props.onKeyDown?.(event);\n\n if (event.key === Escape && !event.isDefaultPrevented()) {\n requestOpenChange({\n event,\n open: false,\n type: 'escapeKeyDown',\n });\n // stop propagation to avoid conflicting with other elements that listen for `Escape`\n // e,g: nested Dialog, Popover, Menu and Tooltip\n event.preventDefault();\n }\n });\n\n const backdrop = slot.optional(props.backdrop, {\n renderByDefault: modalType !== 'non-modal',\n defaultProps: {\n 'aria-hidden': 'true',\n },\n elementType: 'div',\n });\n if (backdrop) {\n backdrop.onClick = handledBackdropClick;\n }\n return {\n components: { backdrop: 'div', root: 'div' },\n backdrop,\n isNestedDialog,\n transitionStatus,\n mountNode: props.mountNode,\n root: slot.always(\n getIntrinsicElementProps('div', {\n tabIndex: -1, // https://github.com/microsoft/fluentui/issues/25150\n 'aria-modal': modalType !== 'non-modal',\n role: modalType === 'alert' ? 'alertdialog' : 'dialog',\n 'aria-labelledby': props['aria-label'] ? undefined : dialogTitleID,\n ...props,\n ...modalAttributes,\n onKeyDown: handleKeyDown,\n // FIXME:\n // `DialogSurfaceElement` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: useMergedRefs(ref, dialogRef) as React.Ref<HTMLDivElement>,\n }),\n { elementType: 'div' },\n ),\n };\n};\n"],"names":["React","useEventCallback","useMergedRefs","isResolvedShorthand","slot","getIntrinsicElementProps","useDialogContext_unstable","Escape","useDialogTransitionContext_unstable","useDialogSurface_unstable","props","ref","modalType","ctx","isNestedDialog","transitionStatus","modalAttributes","dialogRef","requestOpenChange","dialogTitleID","dialogTitleId","handledBackdropClick","event","backdrop","onClick","isDefaultPrevented","open","type","handleKeyDown","onKeyDown","key","preventDefault","optional","renderByDefault","defaultProps","elementType","components","root","mountNode","always","tabIndex","role","undefined"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SACEC,gBAAgB,EAChBC,aAAa,EACbC,mBAAmB,EACnBC,IAAI,EACJC,wBAAwB,QACnB,4BAA4B;AAEnC,SAASC,yBAAyB,QAAQ,iBAAiB;AAC3D,SAASC,MAAM,QAAQ,0BAA0B;AACjD,SAASC,mCAAmC,QAAQ,yCAAyC;AAE7F;;;;;;;;CAQC,GACD,OAAO,MAAMC,4BAA4B,CACvCC,OACAC;IAEA,MAAMC,YAAYN,0BAA0BO,CAAAA,MAAOA,IAAID,SAAS;IAChE,MAAME,iBAAiBR,0BAA0BO,CAAAA,MAAOA,IAAIC,cAAc;IAC1E,MAAMC,mBAAmBP;IACzB,MAAMQ,kBAAkBV,0BAA0BO,CAAAA,MAAOA,IAAIG,eAAe;IAC5E,MAAMC,YAAYX,0BAA0BO,CAAAA,MAAOA,IAAII,SAAS;IAChE,MAAMC,oBAAoBZ,0BAA0BO,CAAAA,MAAOA,IAAIK,iBAAiB;IAChF,MAAMC,gBAAgBb,0BAA0BO,CAAAA,MAAOA,IAAIO,aAAa;IAExE,MAAMC,uBAAuBpB,iBAAiB,CAACqB;QAC7C,IAAInB,oBAAoBO,MAAMa,QAAQ,GAAG;gBACvCb,yBAAAA;aAAAA,0BAAAA,CAAAA,kBAAAA,MAAMa,QAAQ,EAACC,OAAO,cAAtBd,8CAAAA,6BAAAA,iBAAyBY;QAC3B;QACA,IAAIV,cAAc,WAAW,CAACU,MAAMG,kBAAkB,IAAI;YACxDP,kBAAkB;gBAChBI;gBACAI,MAAM;gBACNC,MAAM;YACR;QACF;IACF;IAEA,MAAMC,gBAAgB3B,iBAAiB,CAACqB;YACtCZ;SAAAA,mBAAAA,MAAMmB,SAAS,cAAfnB,uCAAAA,sBAAAA,OAAkBY;QAElB,IAAIA,MAAMQ,GAAG,KAAKvB,UAAU,CAACe,MAAMG,kBAAkB,IAAI;YACvDP,kBAAkB;gBAChBI;gBACAI,MAAM;gBACNC,MAAM;YACR;YACA,qFAAqF;YACrF,gDAAgD;YAChDL,MAAMS,cAAc;QACtB;IACF;IAEA,MAAMR,WAAWnB,KAAK4B,QAAQ,CAACtB,MAAMa,QAAQ,EAAE;QAC7CU,iBAAiBrB,cAAc;QAC/BsB,cAAc;YACZ,eAAe;QACjB;QACAC,aAAa;IACf;IACA,IAAIZ,UAAU;QACZA,SAASC,OAAO,GAAGH;IACrB;IACA,OAAO;QACLe,YAAY;YAAEb,UAAU;YAAOc,MAAM;QAAM;QAC3Cd;QACAT;QACAC;QACAuB,WAAW5B,MAAM4B,SAAS;QAC1BD,MAAMjC,KAAKmC,MAAM,CACflC,yBAAyB,OAAO;YAC9BmC,UAAU,CAAC;YACX,cAAc5B,cAAc;YAC5B6B,MAAM7B,cAAc,UAAU,gBAAgB;YAC9C,mBAAmBF,KAAK,CAAC,aAAa,GAAGgC,YAAYvB;YACrD,GAAGT,KAAK;YACR,GAAGM,eAAe;YAClBa,WAAWD;YACX,SAAS;YACT,6FAA6F;YAC7F,4FAA4F;YAC5FjB,KAAKT,cAAcS,KAAKM;QAC1B,IACA;YAAEkB,aAAa;QAAM;IAEzB;AACF,EAAE"}
|
|
@@ -9,31 +9,64 @@ export const dialogSurfaceClassNames = {
|
|
|
9
9
|
/**
|
|
10
10
|
* Styles for the root slot
|
|
11
11
|
*/
|
|
12
|
-
const
|
|
13
|
-
r: [".
|
|
14
|
-
s: ["@media screen and (max-width: 480px){.
|
|
12
|
+
const useRootBaseStyle = /*#__PURE__*/__resetStyles("r1xd7yeh", "r93c6rw", {
|
|
13
|
+
r: [".r1xd7yeh{top:0;right:0;bottom:0;left:0;padding-top:24px;padding-right:24px;padding-bottom:24px;padding-left:24px;margin-top:auto;margin-right:auto;margin-bottom:auto;margin-left:auto;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;overflow-x:unset;overflow-y:unset;border-top-width:1px;border-right-width:1px;border-bottom-width:1px;border-left-width:1px;border-top-color:var(--colorTransparentStroke);border-right-color:var(--colorTransparentStroke);border-bottom-color:var(--colorTransparentStroke);border-left-color:var(--colorTransparentStroke);border-bottom-right-radius:var(--borderRadiusXLarge);border-bottom-left-radius:var(--borderRadiusXLarge);border-top-right-radius:var(--borderRadiusXLarge);border-top-left-radius:var(--borderRadiusXLarge);contain:content;display:block;-webkit-user-select:unset;-moz-user-select:unset;-ms-user-select:unset;user-select:unset;visibility:unset;position:fixed;height:fit-content;max-width:600px;max-height:100vh;box-sizing:border-box;background-color:var(--colorNeutralBackground1);color:var(--colorNeutralForeground1);opacity:0;transition-duration:var(--durationGentle);transition-property:opacity,transform,box-shadow;transition-timing-function:var(--curveDecelerateMid);box-shadow:0px 0px 0px 0px rgba(0, 0, 0, 0.1);transform:scale(0.85) translateZ(0);}", ".r1xd7yeh:focus{outline-style:none;}", ".r1xd7yeh:focus-visible{outline-style:none;}", ".r1xd7yeh[data-fui-focus-visible]{border-top-color:transparent;border-right-color:transparent;border-bottom-color:transparent;border-left-color:transparent;}", ".r1xd7yeh[data-fui-focus-visible]::after{content:\"\";position:absolute;pointer-events:none;z-index:1;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-width:2px;border-right-width:2px;border-bottom-width:2px;border-left-width:2px;border-bottom-right-radius:var(--borderRadiusMedium);border-bottom-left-radius:var(--borderRadiusMedium);border-top-right-radius:var(--borderRadiusMedium);border-top-left-radius:var(--borderRadiusMedium);border-top-color:var(--colorStrokeFocus2);border-right-color:var(--colorStrokeFocus2);border-bottom-color:var(--colorStrokeFocus2);border-left-color:var(--colorStrokeFocus2);top:calc(2px * -1);right:calc(2px * -1);bottom:calc(2px * -1);left:calc(2px * -1);}", ".r93c6rw{top:0;left:0;bottom:0;right:0;padding-top:24px;padding-left:24px;padding-bottom:24px;padding-right:24px;margin-top:auto;margin-left:auto;margin-bottom:auto;margin-right:auto;border-top-style:solid;border-left-style:solid;border-bottom-style:solid;border-right-style:solid;overflow-x:unset;overflow-y:unset;border-top-width:1px;border-left-width:1px;border-bottom-width:1px;border-right-width:1px;border-top-color:var(--colorTransparentStroke);border-left-color:var(--colorTransparentStroke);border-bottom-color:var(--colorTransparentStroke);border-right-color:var(--colorTransparentStroke);border-bottom-left-radius:var(--borderRadiusXLarge);border-bottom-right-radius:var(--borderRadiusXLarge);border-top-left-radius:var(--borderRadiusXLarge);border-top-right-radius:var(--borderRadiusXLarge);contain:content;display:block;-webkit-user-select:unset;-moz-user-select:unset;-ms-user-select:unset;user-select:unset;visibility:unset;position:fixed;height:fit-content;max-width:600px;max-height:100vh;box-sizing:border-box;background-color:var(--colorNeutralBackground1);color:var(--colorNeutralForeground1);opacity:0;transition-duration:var(--durationGentle);transition-property:opacity,transform,box-shadow;transition-timing-function:var(--curveDecelerateMid);box-shadow:0px 0px 0px 0px rgba(0, 0, 0, 0.1);transform:scale(0.85) translateZ(0);}", ".r93c6rw:focus{outline-style:none;}", ".r93c6rw:focus-visible{outline-style:none;}", ".r93c6rw[data-fui-focus-visible]{border-top-color:transparent;border-left-color:transparent;border-bottom-color:transparent;border-right-color:transparent;}", ".r93c6rw[data-fui-focus-visible]::after{content:\"\";position:absolute;pointer-events:none;z-index:1;border-top-style:solid;border-left-style:solid;border-bottom-style:solid;border-right-style:solid;border-top-width:2px;border-left-width:2px;border-bottom-width:2px;border-right-width:2px;border-bottom-left-radius:var(--borderRadiusMedium);border-bottom-right-radius:var(--borderRadiusMedium);border-top-left-radius:var(--borderRadiusMedium);border-top-right-radius:var(--borderRadiusMedium);border-top-color:var(--colorStrokeFocus2);border-left-color:var(--colorStrokeFocus2);border-bottom-color:var(--colorStrokeFocus2);border-right-color:var(--colorStrokeFocus2);top:calc(2px * -1);left:calc(2px * -1);bottom:calc(2px * -1);right:calc(2px * -1);}"],
|
|
14
|
+
s: ["@media screen and (max-width: 480px){.r1xd7yeh{max-width:100vw;}}", "@media screen and (max-width: 480px){.r93c6rw{max-width:100vw;}}"]
|
|
15
15
|
});
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
const useRootStyles = /*#__PURE__*/__styles({
|
|
17
|
+
unmounted: {},
|
|
18
|
+
entering: {},
|
|
19
|
+
entered: {
|
|
20
|
+
E5pizo: "f10nrhrw",
|
|
21
|
+
Bz10aip: "f186d0ee",
|
|
22
|
+
abs64n: "f5p0z4x"
|
|
23
|
+
},
|
|
24
|
+
idle: {},
|
|
25
|
+
exiting: {
|
|
26
|
+
Bkqvd7p: "f1mfizis"
|
|
27
|
+
},
|
|
28
|
+
exited: {}
|
|
20
29
|
}, {
|
|
21
|
-
d: [".
|
|
30
|
+
d: [".f10nrhrw{box-shadow:var(--shadow64);}", ".f186d0ee{transform:scale(1) translateZ(0);}", ".f5p0z4x{opacity:1;}", ".f1mfizis{transition-timing-function:var(--curveAccelerateMin);}"]
|
|
22
31
|
});
|
|
23
32
|
/**
|
|
24
33
|
* Styles for the backdrop slot
|
|
25
34
|
*/
|
|
26
|
-
const
|
|
35
|
+
const useBackdropBaseStyle = /*#__PURE__*/__resetStyles("raidwwn", "r17vltcu", [".raidwwn{top:0px;right:0px;bottom:0px;left:0px;background-color:rgba(0, 0, 0, 0.4);position:fixed;transition-duration:var(--durationGentle);transition-timing-function:var(--curveLinear);transition-property:opacity;will-change:opacity;opacity:0;}", ".r17vltcu{top:0px;left:0px;bottom:0px;right:0px;background-color:rgba(0, 0, 0, 0.4);position:fixed;transition-duration:var(--durationGentle);transition-timing-function:var(--curveLinear);transition-property:opacity;will-change:opacity;opacity:0;}"]);
|
|
36
|
+
const useBackdropStyles = /*#__PURE__*/__styles({
|
|
37
|
+
nestedDialogBackdrop: {
|
|
38
|
+
De3pzq: "f1c21dwh"
|
|
39
|
+
},
|
|
40
|
+
unmounted: {},
|
|
41
|
+
entering: {},
|
|
42
|
+
entered: {
|
|
43
|
+
abs64n: "f5p0z4x"
|
|
44
|
+
},
|
|
45
|
+
idle: {},
|
|
46
|
+
exiting: {
|
|
47
|
+
Bkqvd7p: "f1mfizis"
|
|
48
|
+
},
|
|
49
|
+
exited: {}
|
|
50
|
+
}, {
|
|
51
|
+
d: [".f1c21dwh{background-color:var(--colorTransparentBackground);}", ".f5p0z4x{opacity:1;}", ".f1mfizis{transition-timing-function:var(--curveAccelerateMin);}"]
|
|
52
|
+
});
|
|
27
53
|
/**
|
|
28
54
|
* Apply styling to the DialogSurface slots based on the state
|
|
29
55
|
*/
|
|
30
56
|
export const useDialogSurfaceStyles_unstable = state => {
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
57
|
+
const {
|
|
58
|
+
isNestedDialog,
|
|
59
|
+
root,
|
|
60
|
+
backdrop,
|
|
61
|
+
transitionStatus = 'unmounted'
|
|
62
|
+
} = state;
|
|
63
|
+
const rootBaseStyle = useRootBaseStyle();
|
|
64
|
+
const rootStyles = useRootStyles();
|
|
65
|
+
const backdropBaseStyle = useBackdropBaseStyle();
|
|
66
|
+
const backdropStyles = useBackdropStyles();
|
|
67
|
+
root.className = mergeClasses(dialogSurfaceClassNames.root, rootBaseStyle, rootStyles[transitionStatus], root.className);
|
|
68
|
+
if (backdrop) {
|
|
69
|
+
backdrop.className = mergeClasses(dialogSurfaceClassNames.backdrop, backdropBaseStyle, isNestedDialog && backdropStyles.nestedDialogBackdrop, backdropStyles[transitionStatus], backdrop.className);
|
|
37
70
|
}
|
|
38
71
|
return state;
|
|
39
72
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__resetStyles","__styles","mergeClasses","shorthands","tokens","createFocusOutlineStyle","MEDIA_QUERY_BREAKPOINT_SELECTOR","SURFACE_BORDER_WIDTH","SURFACE_PADDING","dialogSurfaceClassNames","root","backdrop","
|
|
1
|
+
{"version":3,"names":["__resetStyles","__styles","mergeClasses","shorthands","tokens","createFocusOutlineStyle","MEDIA_QUERY_BREAKPOINT_SELECTOR","SURFACE_BORDER_WIDTH","SURFACE_PADDING","dialogSurfaceClassNames","root","backdrop","useRootBaseStyle","r","s","useRootStyles","unmounted","entering","entered","E5pizo","Bz10aip","abs64n","idle","exiting","Bkqvd7p","exited","d","useBackdropBaseStyle","useBackdropStyles","nestedDialogBackdrop","De3pzq","useDialogSurfaceStyles_unstable","state","isNestedDialog","transitionStatus","rootBaseStyle","rootStyles","backdropBaseStyle","backdropStyles","className"],"sources":["useDialogSurfaceStyles.styles.js"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { MEDIA_QUERY_BREAKPOINT_SELECTOR, SURFACE_BORDER_WIDTH, SURFACE_PADDING } from '../../contexts';\nexport const dialogSurfaceClassNames = {\n root: 'fui-DialogSurface',\n backdrop: 'fui-DialogSurface__backdrop'\n};\n/**\n * Styles for the root slot\n */ const useRootBaseStyle = makeResetStyles({\n ...createFocusOutlineStyle(),\n ...shorthands.inset(0),\n ...shorthands.padding(0),\n ...shorthands.padding(SURFACE_PADDING),\n ...shorthands.margin('auto'),\n ...shorthands.borderStyle('none'),\n ...shorthands.overflow('unset'),\n ...shorthands.border(SURFACE_BORDER_WIDTH, 'solid', tokens.colorTransparentStroke),\n ...shorthands.borderRadius(tokens.borderRadiusXLarge),\n contain: 'content',\n display: 'block',\n userSelect: 'unset',\n visibility: 'unset',\n position: 'fixed',\n height: 'fit-content',\n maxWidth: '600px',\n maxHeight: '100vh',\n boxSizing: 'border-box',\n backgroundColor: tokens.colorNeutralBackground1,\n color: tokens.colorNeutralForeground1,\n [MEDIA_QUERY_BREAKPOINT_SELECTOR]: {\n maxWidth: '100vw'\n },\n // initial style before animation:\n opacity: 0,\n transitionDuration: tokens.durationGentle,\n transitionProperty: 'opacity, transform, box-shadow',\n // // FIXME: https://github.com/microsoft/fluentui/issues/29473\n transitionTimingFunction: tokens.curveDecelerateMid,\n boxShadow: '0px 0px 0px 0px rgba(0, 0, 0, 0.1)',\n transform: 'scale(0.85) translateZ(0)'\n});\nconst useRootStyles = makeStyles({\n unmounted: {},\n entering: {},\n entered: {\n boxShadow: tokens.shadow64,\n transform: 'scale(1) translateZ(0)',\n opacity: 1\n },\n idle: {},\n exiting: {\n transitionTimingFunction: tokens.curveAccelerateMin\n },\n exited: {}\n});\n/**\n * Styles for the backdrop slot\n */ const useBackdropBaseStyle = makeResetStyles({\n ...shorthands.inset('0px'),\n backgroundColor: 'rgba(0, 0, 0, 0.4)',\n position: 'fixed',\n // initial style before animation:\n transitionDuration: tokens.durationGentle,\n transitionTimingFunction: tokens.curveLinear,\n transitionProperty: 'opacity',\n willChange: 'opacity',\n opacity: 0\n});\nconst useBackdropStyles = makeStyles({\n nestedDialogBackdrop: {\n backgroundColor: tokens.colorTransparentBackground\n },\n unmounted: {},\n entering: {},\n entered: {\n opacity: 1\n },\n idle: {},\n exiting: {\n transitionTimingFunction: tokens.curveAccelerateMin\n },\n exited: {}\n});\n/**\n * Apply styling to the DialogSurface slots based on the state\n */ export const useDialogSurfaceStyles_unstable = (state)=>{\n const { isNestedDialog, root, backdrop, transitionStatus = 'unmounted' } = state;\n const rootBaseStyle = useRootBaseStyle();\n const rootStyles = useRootStyles();\n const backdropBaseStyle = useBackdropBaseStyle();\n const backdropStyles = useBackdropStyles();\n root.className = mergeClasses(dialogSurfaceClassNames.root, rootBaseStyle, rootStyles[transitionStatus], root.className);\n if (backdrop) {\n backdrop.className = mergeClasses(dialogSurfaceClassNames.backdrop, backdropBaseStyle, isNestedDialog && backdropStyles.nestedDialogBackdrop, backdropStyles[transitionStatus], backdrop.className);\n }\n return state;\n};\n"],"mappings":"AAAA,SAAAA,aAAA,EAAAC,QAAA,EAAsCC,YAAY,EAAEC,UAAU,QAAQ,gBAAgB;AACtF,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,uBAAuB,QAAQ,yBAAyB;AACjE,SAASC,+BAA+B,EAAEC,oBAAoB,EAAEC,eAAe,QAAQ,gBAAgB;AACvG,OAAO,MAAMC,uBAAuB,GAAG;EACnCC,IAAI,EAAE,mBAAmB;EACzBC,QAAQ,EAAE;AACd,CAAC;AACD;AACA;AACA;AAAI,MAAMC,gBAAgB,gBAAGZ,aAAA;EAAAa,CAAA;EAAAC,CAAA;AAAA,CAgC5B,CAAC;AACF,MAAMC,aAAa,gBAAGd,QAAA;EAAAe,SAAA;EAAAC,QAAA;EAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;EAAA;EAAAC,IAAA;EAAAC,OAAA;IAAAC,OAAA;EAAA;EAAAC,MAAA;AAAA;EAAAC,CAAA;AAAA,CAarB,CAAC;AACF;AACA;AACA;AAAI,MAAMC,oBAAoB,gBAAG3B,aAAA,2gBAUhC,CAAC;AACF,MAAM4B,iBAAiB,gBAAG3B,QAAA;EAAA4B,oBAAA;IAAAC,MAAA;EAAA;EAAAd,SAAA;EAAAC,QAAA;EAAAC,OAAA;IAAAG,MAAA;EAAA;EAAAC,IAAA;EAAAC,OAAA;IAAAC,OAAA;EAAA;EAAAC,MAAA;AAAA;EAAAC,CAAA;AAAA,CAczB,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMK,+BAA+B,GAAIC,KAAK,IAAG;EACxD,MAAM;IAAEC,cAAc;IAAEvB,IAAI;IAAEC,QAAQ;IAAEuB,gBAAgB,GAAG;EAAY,CAAC,GAAGF,KAAK;EAChF,MAAMG,aAAa,GAAGvB,gBAAgB,CAAC,CAAC;EACxC,MAAMwB,UAAU,GAAGrB,aAAa,CAAC,CAAC;EAClC,MAAMsB,iBAAiB,GAAGV,oBAAoB,CAAC,CAAC;EAChD,MAAMW,cAAc,GAAGV,iBAAiB,CAAC,CAAC;EAC1ClB,IAAI,CAAC6B,SAAS,GAAGrC,YAAY,CAACO,uBAAuB,CAACC,IAAI,EAAEyB,aAAa,EAAEC,UAAU,CAACF,gBAAgB,CAAC,EAAExB,IAAI,CAAC6B,SAAS,CAAC;EACxH,IAAI5B,QAAQ,EAAE;IACVA,QAAQ,CAAC4B,SAAS,GAAGrC,YAAY,CAACO,uBAAuB,CAACE,QAAQ,EAAE0B,iBAAiB,EAAEJ,cAAc,IAAIK,cAAc,CAACT,oBAAoB,EAAES,cAAc,CAACJ,gBAAgB,CAAC,EAAEvB,QAAQ,CAAC4B,SAAS,CAAC;EACvM;EACA,OAAOP,KAAK;AAChB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/ const defaultContextValue = 'unmounted';
|
|
5
|
+
// Contexts should default to undefined
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/ export const DialogTransitionContext = React.createContext(undefined);
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
*/ export const DialogTransitionProvider = DialogTransitionContext.Provider;
|
|
12
|
+
/**
|
|
13
|
+
* @internal
|
|
14
|
+
*/ export const useDialogTransitionContext_unstable = ()=>{
|
|
15
|
+
var _React_useContext;
|
|
16
|
+
return (_React_useContext = React.useContext(DialogTransitionContext)) !== null && _React_useContext !== void 0 ? _React_useContext : defaultContextValue;
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["dialogTransitionContext.ts"],"sourcesContent":["import * as React from 'react';\nimport { TransitionStatus } from 'react-transition-group';\n\n/**\n * @internal\n */\nexport type DialogTransitionContextValue = TransitionStatus;\n\n/**\n * @internal\n */\nconst defaultContextValue: DialogTransitionContextValue = 'unmounted';\n\n// Contexts should default to undefined\n/**\n * @internal\n */\nexport const DialogTransitionContext: React.Context<DialogTransitionContextValue | undefined> = React.createContext<\n DialogTransitionContextValue | undefined\n>(undefined);\n\n/**\n * @internal\n */\nexport const DialogTransitionProvider = DialogTransitionContext.Provider;\n\n/**\n * @internal\n */\nexport const useDialogTransitionContext_unstable = (): DialogTransitionContextValue => {\n return React.useContext(DialogTransitionContext) ?? defaultContextValue;\n};\n"],"names":["React","defaultContextValue","DialogTransitionContext","createContext","undefined","DialogTransitionProvider","Provider","useDialogTransitionContext_unstable","useContext"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAQ/B;;CAEC,GACD,MAAMC,sBAAoD;AAE1D,uCAAuC;AACvC;;CAEC,GACD,OAAO,MAAMC,0BAAmFF,MAAMG,aAAa,CAEjHC,WAAW;AAEb;;CAEC,GACD,OAAO,MAAMC,2BAA2BH,wBAAwBI,QAAQ,CAAC;AAEzE;;CAEC,GACD,OAAO,MAAMC,sCAAsC;QAC1CP;IAAP,OAAOA,CAAAA,oBAAAA,MAAMQ,UAAU,CAACN,sCAAjBF,+BAAAA,oBAA6CC;AACtD,EAAE"}
|
|
@@ -9,7 +9,9 @@ Object.defineProperty(exports, "renderDialog_unstable", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
|
|
12
|
+
const _reacttransitiongroup = require("react-transition-group");
|
|
12
13
|
const _contexts = require("../../contexts");
|
|
14
|
+
const _dialogTransitionContext = require("../../contexts/dialogTransitionContext");
|
|
13
15
|
const renderDialog_unstable = (state, contextValues)=>{
|
|
14
16
|
const { content, trigger } = state;
|
|
15
17
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_contexts.DialogProvider, {
|
|
@@ -18,7 +20,18 @@ const renderDialog_unstable = (state, contextValues)=>{
|
|
|
18
20
|
value: contextValues.dialogSurface,
|
|
19
21
|
children: [
|
|
20
22
|
trigger,
|
|
21
|
-
|
|
23
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_reacttransitiongroup.Transition, {
|
|
24
|
+
mountOnEnter: true,
|
|
25
|
+
unmountOnExit: true,
|
|
26
|
+
in: state.open,
|
|
27
|
+
nodeRef: state.dialogRef,
|
|
28
|
+
// FIXME: this should not be hardcoded tokens.durationGentle
|
|
29
|
+
timeout: 250,
|
|
30
|
+
children: (status)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_dialogTransitionContext.DialogTransitionProvider, {
|
|
31
|
+
value: status,
|
|
32
|
+
children: content
|
|
33
|
+
})
|
|
34
|
+
})
|
|
22
35
|
]
|
|
23
36
|
})
|
|
24
37
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderDialog.js"],"sourcesContent":[" import { jsx as _jsx, jsxs as _jsxs } from \"@fluentui/react-jsx-runtime/jsx-runtime\";\nimport { DialogProvider, DialogSurfaceProvider } from '../../contexts';\n/**\n * Render the final JSX of Dialog\n */ export const renderDialog_unstable = (state, contextValues)=>{\n const { content, trigger } = state;\n return /*#__PURE__*/ _jsx(DialogProvider, {\n value: contextValues.dialog,\n children: /*#__PURE__*/ _jsxs(DialogSurfaceProvider, {\n value: contextValues.dialogSurface,\n children: [\n trigger,\n content\n ]\n })\n });\n};\n"],"names":["renderDialog_unstable","state","contextValues","content","trigger","_jsx","DialogProvider","value","dialog","children","_jsxs","DialogSurfaceProvider","dialogSurface"],"mappings":";;;;+
|
|
1
|
+
{"version":3,"sources":["renderDialog.js"],"sourcesContent":[" import { jsx as _jsx, jsxs as _jsxs } from \"@fluentui/react-jsx-runtime/jsx-runtime\";\nimport { Transition } from 'react-transition-group';\nimport { DialogProvider, DialogSurfaceProvider } from '../../contexts';\nimport { DialogTransitionProvider } from '../../contexts/dialogTransitionContext';\n/**\n * Render the final JSX of Dialog\n */ export const renderDialog_unstable = (state, contextValues)=>{\n const { content, trigger } = state;\n return /*#__PURE__*/ _jsx(DialogProvider, {\n value: contextValues.dialog,\n children: /*#__PURE__*/ _jsxs(DialogSurfaceProvider, {\n value: contextValues.dialogSurface,\n children: [\n trigger,\n /*#__PURE__*/ _jsx(Transition, {\n mountOnEnter: true,\n unmountOnExit: true,\n in: state.open,\n nodeRef: state.dialogRef,\n // FIXME: this should not be hardcoded tokens.durationGentle\n timeout: 250,\n children: (status)=>/*#__PURE__*/ _jsx(DialogTransitionProvider, {\n value: status,\n children: content\n })\n })\n ]\n })\n });\n};\n"],"names":["renderDialog_unstable","state","contextValues","content","trigger","_jsx","DialogProvider","value","dialog","children","_jsxs","DialogSurfaceProvider","dialogSurface","Transition","mountOnEnter","unmountOnExit","in","open","nodeRef","dialogRef","timeout","status","DialogTransitionProvider"],"mappings":";;;;+BAMiBA;;;eAAAA;;;4BAN4B;sCAClB;0BAC2B;yCACb;AAG9B,MAAMA,wBAAwB,CAACC,OAAOC;IAC7C,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAE,GAAGH;IAC7B,OAAO,WAAW,GAAGI,IAAAA,eAAI,EAACC,wBAAc,EAAE;QACtCC,OAAOL,cAAcM,MAAM;QAC3BC,UAAU,WAAW,GAAGC,IAAAA,gBAAK,EAACC,+BAAqB,EAAE;YACjDJ,OAAOL,cAAcU,aAAa;YAClCH,UAAU;gBACNL;gBACA,WAAW,GAAGC,IAAAA,eAAI,EAACQ,gCAAU,EAAE;oBAC3BC,cAAc;oBACdC,eAAe;oBACfC,IAAIf,MAAMgB,IAAI;oBACdC,SAASjB,MAAMkB,SAAS;oBACxB,4DAA4D;oBAC5DC,SAAS;oBACTX,UAAU,CAACY,SAAS,WAAW,GAAGhB,IAAAA,eAAI,EAACiB,iDAAwB,EAAE;4BACzDf,OAAOc;4BACPZ,UAAUN;wBACd;gBACR;aACH;QACL;IACJ;AACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useDialog.js"],"sourcesContent":["import * as React from 'react';\nimport { useControllableState, useEventCallback, useId, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport { useHasParentContext } from '@fluentui/react-context-selector';\nimport { useDisableBodyScroll, useFocusFirstElement } from '../../utils';\nimport { DialogContext } from '../../contexts';\nimport { useModalAttributes } from '@fluentui/react-tabster';\n/**\n * Create the state required to render Dialog.\n *\n * The returned state can be modified with hooks such as useDialogStyles_unstable,\n * before being passed to renderDialog_unstable.\n *\n * @param props - props from this instance of Dialog\n */ export const useDialog_unstable = (props)=>{\n const { children, modalType = 'modal', onOpenChange, inertTrapFocus = false } = props;\n const [trigger, content] = childrenToTriggerAndContent(children);\n const [open, setOpen] = useControllableState({\n state: props.open,\n defaultState: props.defaultOpen,\n initialState: false\n });\n const requestOpenChange = useEventCallback((data)=>{\n onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(data.event, data);\n // if user prevents default then do not change state value\n // otherwise updates state value and trigger reference to the element that caused the opening\n if (!data.event.isDefaultPrevented()) {\n setOpen(data.open);\n }\n });\n const focusRef = useFocusFirstElement(open, modalType);\n const disableBodyScroll = useDisableBodyScroll();\n const isBodyScrollLocked = Boolean(open && modalType !== 'non-modal');\n useIsomorphicLayoutEffect(()=>{\n if (isBodyScrollLocked) {\n return disableBodyScroll();\n }\n }, [\n disableBodyScroll,\n isBodyScrollLocked\n ]);\n const { modalAttributes, triggerAttributes } = useModalAttributes({\n trapFocus: modalType !== 'non-modal',\n legacyTrapFocus: !inertTrapFocus\n });\n return {\n components: {\n backdrop: 'div'\n },\n inertTrapFocus,\n open,\n modalType,\n content
|
|
1
|
+
{"version":3,"sources":["useDialog.js"],"sourcesContent":["import * as React from 'react';\nimport { useControllableState, useEventCallback, useId, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport { useHasParentContext } from '@fluentui/react-context-selector';\nimport { useDisableBodyScroll, useFocusFirstElement } from '../../utils';\nimport { DialogContext } from '../../contexts';\nimport { useModalAttributes } from '@fluentui/react-tabster';\n/**\n * Create the state required to render Dialog.\n *\n * The returned state can be modified with hooks such as useDialogStyles_unstable,\n * before being passed to renderDialog_unstable.\n *\n * @param props - props from this instance of Dialog\n */ export const useDialog_unstable = (props)=>{\n const { children, modalType = 'modal', onOpenChange, inertTrapFocus = false } = props;\n const [trigger, content] = childrenToTriggerAndContent(children);\n const [open, setOpen] = useControllableState({\n state: props.open,\n defaultState: props.defaultOpen,\n initialState: false\n });\n const requestOpenChange = useEventCallback((data)=>{\n onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(data.event, data);\n // if user prevents default then do not change state value\n // otherwise updates state value and trigger reference to the element that caused the opening\n if (!data.event.isDefaultPrevented()) {\n setOpen(data.open);\n }\n });\n const focusRef = useFocusFirstElement(open, modalType);\n const disableBodyScroll = useDisableBodyScroll();\n const isBodyScrollLocked = Boolean(open && modalType !== 'non-modal');\n useIsomorphicLayoutEffect(()=>{\n if (isBodyScrollLocked) {\n return disableBodyScroll();\n }\n }, [\n disableBodyScroll,\n isBodyScrollLocked\n ]);\n const { modalAttributes, triggerAttributes } = useModalAttributes({\n trapFocus: modalType !== 'non-modal',\n legacyTrapFocus: !inertTrapFocus\n });\n return {\n components: {\n backdrop: 'div'\n },\n inertTrapFocus,\n open,\n modalType,\n content,\n trigger,\n requestOpenChange,\n dialogTitleId: useId('dialog-title-'),\n isNestedDialog: useHasParentContext(DialogContext),\n dialogRef: focusRef,\n modalAttributes: modalType !== 'non-modal' ? modalAttributes : undefined,\n triggerAttributes\n };\n};\n/**\n * Extracts trigger and content from children\n */ function childrenToTriggerAndContent(children) {\n const childrenArray = React.Children.toArray(children);\n if (process.env.NODE_ENV !== 'production') {\n if (childrenArray.length !== 1 && childrenArray.length !== 2) {\n // eslint-disable-next-line no-console\n console.warn(`@fluentui/react-dialog [useDialog]:\nDialog must contain at least one child <DialogSurface/>,\nand at most two children <DialogTrigger/> <DialogSurface/> (in this order).`);\n }\n }\n switch(childrenArray.length){\n // case where there's a trigger followed by content\n case 2:\n return childrenArray;\n // case where there's only content\n case 1:\n return [\n undefined,\n childrenArray[0]\n ];\n // unknown case\n default:\n return [\n undefined,\n undefined\n ];\n }\n}\n"],"names":["useDialog_unstable","props","children","modalType","onOpenChange","inertTrapFocus","trigger","content","childrenToTriggerAndContent","open","setOpen","useControllableState","state","defaultState","defaultOpen","initialState","requestOpenChange","useEventCallback","data","event","isDefaultPrevented","focusRef","useFocusFirstElement","disableBodyScroll","useDisableBodyScroll","isBodyScrollLocked","Boolean","useIsomorphicLayoutEffect","modalAttributes","triggerAttributes","useModalAttributes","trapFocus","legacyTrapFocus","components","backdrop","dialogTitleId","useId","isNestedDialog","useHasParentContext","DialogContext","dialogRef","undefined","childrenArray","React","Children","toArray","process","env","NODE_ENV","length","console","warn"],"mappings":";;;;+BAaiBA;;;eAAAA;;;;iEAbM;gCACkE;sCACrD;uBACuB;0BAC7B;8BACK;AAQxB,MAAMA,qBAAqB,CAACC;IACnC,MAAM,EAAEC,QAAQ,EAAEC,YAAY,OAAO,EAAEC,YAAY,EAAEC,iBAAiB,KAAK,EAAE,GAAGJ;IAChF,MAAM,CAACK,SAASC,QAAQ,GAAGC,4BAA4BN;IACvD,MAAM,CAACO,MAAMC,QAAQ,GAAGC,IAAAA,oCAAoB,EAAC;QACzCC,OAAOX,MAAMQ,IAAI;QACjBI,cAAcZ,MAAMa,WAAW;QAC/BC,cAAc;IAClB;IACA,MAAMC,oBAAoBC,IAAAA,gCAAgB,EAAC,CAACC;QACxCd,iBAAiB,QAAQA,iBAAiB,KAAK,IAAI,KAAK,IAAIA,aAAac,KAAKC,KAAK,EAAED;QACrF,0DAA0D;QAC1D,6FAA6F;QAC7F,IAAI,CAACA,KAAKC,KAAK,CAACC,kBAAkB,IAAI;YAClCV,QAAQQ,KAAKT,IAAI;QACrB;IACJ;IACA,MAAMY,WAAWC,IAAAA,2BAAoB,EAACb,MAAMN;IAC5C,MAAMoB,oBAAoBC,IAAAA,2BAAoB;IAC9C,MAAMC,qBAAqBC,QAAQjB,QAAQN,cAAc;IACzDwB,IAAAA,yCAAyB,EAAC;QACtB,IAAIF,oBAAoB;YACpB,OAAOF;QACX;IACJ,GAAG;QACCA;QACAE;KACH;IACD,MAAM,EAAEG,eAAe,EAAEC,iBAAiB,EAAE,GAAGC,IAAAA,gCAAkB,EAAC;QAC9DC,WAAW5B,cAAc;QACzB6B,iBAAiB,CAAC3B;IACtB;IACA,OAAO;QACH4B,YAAY;YACRC,UAAU;QACd;QACA7B;QACAI;QACAN;QACAI;QACAD;QACAU;QACAmB,eAAeC,IAAAA,qBAAK,EAAC;QACrBC,gBAAgBC,IAAAA,yCAAmB,EAACC,uBAAa;QACjDC,WAAWnB;QACXO,iBAAiBzB,cAAc,cAAcyB,kBAAkBa;QAC/DZ;IACJ;AACJ;AACA;;CAEC,GAAG,SAASrB,4BAA4BN,QAAQ;IAC7C,MAAMwC,gBAAgBC,OAAMC,QAAQ,CAACC,OAAO,CAAC3C;IAC7C,IAAI4C,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACvC,IAAIN,cAAcO,MAAM,KAAK,KAAKP,cAAcO,MAAM,KAAK,GAAG;YAC1D,sCAAsC;YACtCC,QAAQC,IAAI,CAAC,CAAC;;2EAEiD,CAAC;QACpE;IACJ;IACA,OAAOT,cAAcO,MAAM;QACvB,mDAAmD;QACnD,KAAK;YACD,OAAOP;QACX,kCAAkC;QAClC,KAAK;YACD,OAAO;gBACHD;gBACAC,aAAa,CAAC,EAAE;aACnB;QACL,eAAe;QACf;YACI,OAAO;gBACHD;gBACAA;aACH;IACT;AACJ"}
|
|
@@ -13,12 +13,13 @@ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
|
13
13
|
const _reactutilities = require("@fluentui/react-utilities");
|
|
14
14
|
const _contexts = require("../../contexts");
|
|
15
15
|
const _keyboardkeys = require("@fluentui/keyboard-keys");
|
|
16
|
+
const _dialogTransitionContext = require("../../contexts/dialogTransitionContext");
|
|
16
17
|
const useDialogSurface_unstable = (props, ref)=>{
|
|
17
18
|
const modalType = (0, _contexts.useDialogContext_unstable)((ctx)=>ctx.modalType);
|
|
18
19
|
const isNestedDialog = (0, _contexts.useDialogContext_unstable)((ctx)=>ctx.isNestedDialog);
|
|
20
|
+
const transitionStatus = (0, _dialogTransitionContext.useDialogTransitionContext_unstable)();
|
|
19
21
|
const modalAttributes = (0, _contexts.useDialogContext_unstable)((ctx)=>ctx.modalAttributes);
|
|
20
22
|
const dialogRef = (0, _contexts.useDialogContext_unstable)((ctx)=>ctx.dialogRef);
|
|
21
|
-
const open = (0, _contexts.useDialogContext_unstable)((ctx)=>ctx.open);
|
|
22
23
|
const requestOpenChange = (0, _contexts.useDialogContext_unstable)((ctx)=>ctx.requestOpenChange);
|
|
23
24
|
const dialogTitleID = (0, _contexts.useDialogContext_unstable)((ctx)=>ctx.dialogTitleId);
|
|
24
25
|
const handledBackdropClick = (0, _reactutilities.useEventCallback)((event)=>{
|
|
@@ -49,7 +50,7 @@ const useDialogSurface_unstable = (props, ref)=>{
|
|
|
49
50
|
}
|
|
50
51
|
});
|
|
51
52
|
const backdrop = _reactutilities.slot.optional(props.backdrop, {
|
|
52
|
-
renderByDefault:
|
|
53
|
+
renderByDefault: modalType !== 'non-modal',
|
|
53
54
|
defaultProps: {
|
|
54
55
|
'aria-hidden': 'true'
|
|
55
56
|
},
|
|
@@ -65,6 +66,7 @@ const useDialogSurface_unstable = (props, ref)=>{
|
|
|
65
66
|
},
|
|
66
67
|
backdrop,
|
|
67
68
|
isNestedDialog,
|
|
69
|
+
transitionStatus,
|
|
68
70
|
mountNode: props.mountNode,
|
|
69
71
|
root: _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)('div', {
|
|
70
72
|
tabIndex: -1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useDialogSurface.js"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback, useMergedRefs, isResolvedShorthand, slot, getIntrinsicElementProps } from '@fluentui/react-utilities';\nimport { useDialogContext_unstable } from '../../contexts';\nimport { Escape } from '@fluentui/keyboard-keys';\n/**\n * Create the state required to render DialogSurface.\n *\n * The returned state can be modified with hooks such as useDialogSurfaceStyles_unstable,\n * before being passed to renderDialogSurface_unstable.\n *\n * @param props - props from this instance of DialogSurface\n * @param ref - reference to root HTMLElement of DialogSurface\n */ export const useDialogSurface_unstable = (props, ref)=>{\n const modalType = useDialogContext_unstable((ctx)=>ctx.modalType);\n const isNestedDialog = useDialogContext_unstable((ctx)=>ctx.isNestedDialog);\n const
|
|
1
|
+
{"version":3,"sources":["useDialogSurface.js"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback, useMergedRefs, isResolvedShorthand, slot, getIntrinsicElementProps } from '@fluentui/react-utilities';\nimport { useDialogContext_unstable } from '../../contexts';\nimport { Escape } from '@fluentui/keyboard-keys';\nimport { useDialogTransitionContext_unstable } from '../../contexts/dialogTransitionContext';\n/**\n * Create the state required to render DialogSurface.\n *\n * The returned state can be modified with hooks such as useDialogSurfaceStyles_unstable,\n * before being passed to renderDialogSurface_unstable.\n *\n * @param props - props from this instance of DialogSurface\n * @param ref - reference to root HTMLElement of DialogSurface\n */ export const useDialogSurface_unstable = (props, ref)=>{\n const modalType = useDialogContext_unstable((ctx)=>ctx.modalType);\n const isNestedDialog = useDialogContext_unstable((ctx)=>ctx.isNestedDialog);\n const transitionStatus = useDialogTransitionContext_unstable();\n const modalAttributes = useDialogContext_unstable((ctx)=>ctx.modalAttributes);\n const dialogRef = useDialogContext_unstable((ctx)=>ctx.dialogRef);\n const requestOpenChange = useDialogContext_unstable((ctx)=>ctx.requestOpenChange);\n const dialogTitleID = useDialogContext_unstable((ctx)=>ctx.dialogTitleId);\n const handledBackdropClick = useEventCallback((event)=>{\n if (isResolvedShorthand(props.backdrop)) {\n var _props_backdrop_onClick, _props_backdrop;\n (_props_backdrop_onClick = (_props_backdrop = props.backdrop).onClick) === null || _props_backdrop_onClick === void 0 ? void 0 : _props_backdrop_onClick.call(_props_backdrop, event);\n }\n if (modalType === 'modal' && !event.isDefaultPrevented()) {\n requestOpenChange({\n event,\n open: false,\n type: 'backdropClick'\n });\n }\n });\n const handleKeyDown = useEventCallback((event)=>{\n var _props_onKeyDown;\n (_props_onKeyDown = props.onKeyDown) === null || _props_onKeyDown === void 0 ? void 0 : _props_onKeyDown.call(props, event);\n if (event.key === Escape && !event.isDefaultPrevented()) {\n requestOpenChange({\n event,\n open: false,\n type: 'escapeKeyDown'\n });\n // stop propagation to avoid conflicting with other elements that listen for `Escape`\n // e,g: nested Dialog, Popover, Menu and Tooltip\n event.preventDefault();\n }\n });\n const backdrop = slot.optional(props.backdrop, {\n renderByDefault: modalType !== 'non-modal',\n defaultProps: {\n 'aria-hidden': 'true'\n },\n elementType: 'div'\n });\n if (backdrop) {\n backdrop.onClick = handledBackdropClick;\n }\n return {\n components: {\n backdrop: 'div',\n root: 'div'\n },\n backdrop,\n isNestedDialog,\n transitionStatus,\n mountNode: props.mountNode,\n root: slot.always(getIntrinsicElementProps('div', {\n tabIndex: -1,\n 'aria-modal': modalType !== 'non-modal',\n role: modalType === 'alert' ? 'alertdialog' : 'dialog',\n 'aria-labelledby': props['aria-label'] ? undefined : dialogTitleID,\n ...props,\n ...modalAttributes,\n onKeyDown: handleKeyDown,\n // FIXME:\n // `DialogSurfaceElement` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: useMergedRefs(ref, dialogRef)\n }), {\n elementType: 'div'\n })\n };\n};\n"],"names":["useDialogSurface_unstable","props","ref","modalType","useDialogContext_unstable","ctx","isNestedDialog","transitionStatus","useDialogTransitionContext_unstable","modalAttributes","dialogRef","requestOpenChange","dialogTitleID","dialogTitleId","handledBackdropClick","useEventCallback","event","isResolvedShorthand","backdrop","_props_backdrop_onClick","_props_backdrop","onClick","call","isDefaultPrevented","open","type","handleKeyDown","_props_onKeyDown","onKeyDown","key","Escape","preventDefault","slot","optional","renderByDefault","defaultProps","elementType","components","root","mountNode","always","getIntrinsicElementProps","tabIndex","role","undefined","useMergedRefs"],"mappings":";;;;+BAaiBA;;;eAAAA;;;;iEAbM;gCAC8E;0BAC3D;8BACnB;yCAC6B;AASzC,MAAMA,4BAA4B,CAACC,OAAOC;IACjD,MAAMC,YAAYC,IAAAA,mCAAyB,EAAC,CAACC,MAAMA,IAAIF,SAAS;IAChE,MAAMG,iBAAiBF,IAAAA,mCAAyB,EAAC,CAACC,MAAMA,IAAIC,cAAc;IAC1E,MAAMC,mBAAmBC,IAAAA,4DAAmC;IAC5D,MAAMC,kBAAkBL,IAAAA,mCAAyB,EAAC,CAACC,MAAMA,IAAII,eAAe;IAC5E,MAAMC,YAAYN,IAAAA,mCAAyB,EAAC,CAACC,MAAMA,IAAIK,SAAS;IAChE,MAAMC,oBAAoBP,IAAAA,mCAAyB,EAAC,CAACC,MAAMA,IAAIM,iBAAiB;IAChF,MAAMC,gBAAgBR,IAAAA,mCAAyB,EAAC,CAACC,MAAMA,IAAIQ,aAAa;IACxE,MAAMC,uBAAuBC,IAAAA,gCAAgB,EAAC,CAACC;QAC3C,IAAIC,IAAAA,mCAAmB,EAAChB,MAAMiB,QAAQ,GAAG;YACrC,IAAIC,yBAAyBC;YAC5BD,CAAAA,0BAA0B,AAACC,CAAAA,kBAAkBnB,MAAMiB,QAAQ,AAAD,EAAGG,OAAO,AAAD,MAAO,QAAQF,4BAA4B,KAAK,IAAI,KAAK,IAAIA,wBAAwBG,IAAI,CAACF,iBAAiBJ;QACnL;QACA,IAAIb,cAAc,WAAW,CAACa,MAAMO,kBAAkB,IAAI;YACtDZ,kBAAkB;gBACdK;gBACAQ,MAAM;gBACNC,MAAM;YACV;QACJ;IACJ;IACA,MAAMC,gBAAgBX,IAAAA,gCAAgB,EAAC,CAACC;QACpC,IAAIW;QACHA,CAAAA,mBAAmB1B,MAAM2B,SAAS,AAAD,MAAO,QAAQD,qBAAqB,KAAK,IAAI,KAAK,IAAIA,iBAAiBL,IAAI,CAACrB,OAAOe;QACrH,IAAIA,MAAMa,GAAG,KAAKC,oBAAM,IAAI,CAACd,MAAMO,kBAAkB,IAAI;YACrDZ,kBAAkB;gBACdK;gBACAQ,MAAM;gBACNC,MAAM;YACV;YACA,qFAAqF;YACrF,gDAAgD;YAChDT,MAAMe,cAAc;QACxB;IACJ;IACA,MAAMb,WAAWc,oBAAI,CAACC,QAAQ,CAAChC,MAAMiB,QAAQ,EAAE;QAC3CgB,iBAAiB/B,cAAc;QAC/BgC,cAAc;YACV,eAAe;QACnB;QACAC,aAAa;IACjB;IACA,IAAIlB,UAAU;QACVA,SAASG,OAAO,GAAGP;IACvB;IACA,OAAO;QACHuB,YAAY;YACRnB,UAAU;YACVoB,MAAM;QACV;QACApB;QACAZ;QACAC;QACAgC,WAAWtC,MAAMsC,SAAS;QAC1BD,MAAMN,oBAAI,CAACQ,MAAM,CAACC,IAAAA,wCAAwB,EAAC,OAAO;YAC9CC,UAAU,CAAC;YACX,cAAcvC,cAAc;YAC5BwC,MAAMxC,cAAc,UAAU,gBAAgB;YAC9C,mBAAmBF,KAAK,CAAC,aAAa,GAAG2C,YAAYhC;YACrD,GAAGX,KAAK;YACR,GAAGQ,eAAe;YAClBmB,WAAWF;YACX,SAAS;YACT,6FAA6F;YAC7F,4FAA4F;YAC5FxB,KAAK2C,IAAAA,6BAAa,EAAC3C,KAAKQ;QAC5B,IAAI;YACA0B,aAAa;QACjB;IACJ;AACJ"}
|
|
@@ -23,46 +23,81 @@ const dialogSurfaceClassNames = {
|
|
|
23
23
|
};
|
|
24
24
|
/**
|
|
25
25
|
* Styles for the root slot
|
|
26
|
-
*/ const
|
|
26
|
+
*/ const useRootBaseStyle = /*#__PURE__*/ (0, _react.__resetStyles)("r1xd7yeh", "r93c6rw", {
|
|
27
27
|
r: [
|
|
28
|
-
".
|
|
29
|
-
".
|
|
30
|
-
".
|
|
31
|
-
".
|
|
32
|
-
".
|
|
33
|
-
".
|
|
34
|
-
".
|
|
35
|
-
".
|
|
36
|
-
".
|
|
37
|
-
".
|
|
28
|
+
".r1xd7yeh{top:0;right:0;bottom:0;left:0;padding-top:24px;padding-right:24px;padding-bottom:24px;padding-left:24px;margin-top:auto;margin-right:auto;margin-bottom:auto;margin-left:auto;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;overflow-x:unset;overflow-y:unset;border-top-width:1px;border-right-width:1px;border-bottom-width:1px;border-left-width:1px;border-top-color:var(--colorTransparentStroke);border-right-color:var(--colorTransparentStroke);border-bottom-color:var(--colorTransparentStroke);border-left-color:var(--colorTransparentStroke);border-bottom-right-radius:var(--borderRadiusXLarge);border-bottom-left-radius:var(--borderRadiusXLarge);border-top-right-radius:var(--borderRadiusXLarge);border-top-left-radius:var(--borderRadiusXLarge);contain:content;display:block;-webkit-user-select:unset;-moz-user-select:unset;-ms-user-select:unset;user-select:unset;visibility:unset;position:fixed;height:fit-content;max-width:600px;max-height:100vh;box-sizing:border-box;background-color:var(--colorNeutralBackground1);color:var(--colorNeutralForeground1);opacity:0;transition-duration:var(--durationGentle);transition-property:opacity,transform,box-shadow;transition-timing-function:var(--curveDecelerateMid);box-shadow:0px 0px 0px 0px rgba(0, 0, 0, 0.1);transform:scale(0.85) translateZ(0);}",
|
|
29
|
+
".r1xd7yeh:focus{outline-style:none;}",
|
|
30
|
+
".r1xd7yeh:focus-visible{outline-style:none;}",
|
|
31
|
+
".r1xd7yeh[data-fui-focus-visible]{border-top-color:transparent;border-right-color:transparent;border-bottom-color:transparent;border-left-color:transparent;}",
|
|
32
|
+
".r1xd7yeh[data-fui-focus-visible]::after{content:\"\";position:absolute;pointer-events:none;z-index:1;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-width:2px;border-right-width:2px;border-bottom-width:2px;border-left-width:2px;border-bottom-right-radius:var(--borderRadiusMedium);border-bottom-left-radius:var(--borderRadiusMedium);border-top-right-radius:var(--borderRadiusMedium);border-top-left-radius:var(--borderRadiusMedium);border-top-color:var(--colorStrokeFocus2);border-right-color:var(--colorStrokeFocus2);border-bottom-color:var(--colorStrokeFocus2);border-left-color:var(--colorStrokeFocus2);top:calc(2px * -1);right:calc(2px * -1);bottom:calc(2px * -1);left:calc(2px * -1);}",
|
|
33
|
+
".r93c6rw{top:0;left:0;bottom:0;right:0;padding-top:24px;padding-left:24px;padding-bottom:24px;padding-right:24px;margin-top:auto;margin-left:auto;margin-bottom:auto;margin-right:auto;border-top-style:solid;border-left-style:solid;border-bottom-style:solid;border-right-style:solid;overflow-x:unset;overflow-y:unset;border-top-width:1px;border-left-width:1px;border-bottom-width:1px;border-right-width:1px;border-top-color:var(--colorTransparentStroke);border-left-color:var(--colorTransparentStroke);border-bottom-color:var(--colorTransparentStroke);border-right-color:var(--colorTransparentStroke);border-bottom-left-radius:var(--borderRadiusXLarge);border-bottom-right-radius:var(--borderRadiusXLarge);border-top-left-radius:var(--borderRadiusXLarge);border-top-right-radius:var(--borderRadiusXLarge);contain:content;display:block;-webkit-user-select:unset;-moz-user-select:unset;-ms-user-select:unset;user-select:unset;visibility:unset;position:fixed;height:fit-content;max-width:600px;max-height:100vh;box-sizing:border-box;background-color:var(--colorNeutralBackground1);color:var(--colorNeutralForeground1);opacity:0;transition-duration:var(--durationGentle);transition-property:opacity,transform,box-shadow;transition-timing-function:var(--curveDecelerateMid);box-shadow:0px 0px 0px 0px rgba(0, 0, 0, 0.1);transform:scale(0.85) translateZ(0);}",
|
|
34
|
+
".r93c6rw:focus{outline-style:none;}",
|
|
35
|
+
".r93c6rw:focus-visible{outline-style:none;}",
|
|
36
|
+
".r93c6rw[data-fui-focus-visible]{border-top-color:transparent;border-left-color:transparent;border-bottom-color:transparent;border-right-color:transparent;}",
|
|
37
|
+
".r93c6rw[data-fui-focus-visible]::after{content:\"\";position:absolute;pointer-events:none;z-index:1;border-top-style:solid;border-left-style:solid;border-bottom-style:solid;border-right-style:solid;border-top-width:2px;border-left-width:2px;border-bottom-width:2px;border-right-width:2px;border-bottom-left-radius:var(--borderRadiusMedium);border-bottom-right-radius:var(--borderRadiusMedium);border-top-left-radius:var(--borderRadiusMedium);border-top-right-radius:var(--borderRadiusMedium);border-top-color:var(--colorStrokeFocus2);border-left-color:var(--colorStrokeFocus2);border-bottom-color:var(--colorStrokeFocus2);border-right-color:var(--colorStrokeFocus2);top:calc(2px * -1);left:calc(2px * -1);bottom:calc(2px * -1);right:calc(2px * -1);}"
|
|
38
38
|
],
|
|
39
39
|
s: [
|
|
40
|
-
"@media screen and (max-width: 480px){.
|
|
41
|
-
"@media screen and (max-width: 480px){.
|
|
40
|
+
"@media screen and (max-width: 480px){.r1xd7yeh{max-width:100vw;}}",
|
|
41
|
+
"@media screen and (max-width: 480px){.r93c6rw{max-width:100vw;}}"
|
|
42
42
|
]
|
|
43
43
|
});
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
const useRootStyles = /*#__PURE__*/ (0, _react.__styles)({
|
|
45
|
+
unmounted: {},
|
|
46
|
+
entering: {},
|
|
47
|
+
entered: {
|
|
48
|
+
E5pizo: "f10nrhrw",
|
|
49
|
+
Bz10aip: "f186d0ee",
|
|
50
|
+
abs64n: "f5p0z4x"
|
|
51
|
+
},
|
|
52
|
+
idle: {},
|
|
53
|
+
exiting: {
|
|
54
|
+
Bkqvd7p: "f1mfizis"
|
|
55
|
+
},
|
|
56
|
+
exited: {}
|
|
48
57
|
}, {
|
|
49
58
|
d: [
|
|
50
|
-
".
|
|
59
|
+
".f10nrhrw{box-shadow:var(--shadow64);}",
|
|
60
|
+
".f186d0ee{transform:scale(1) translateZ(0);}",
|
|
61
|
+
".f5p0z4x{opacity:1;}",
|
|
62
|
+
".f1mfizis{transition-timing-function:var(--curveAccelerateMin);}"
|
|
51
63
|
]
|
|
52
64
|
});
|
|
53
65
|
/**
|
|
54
66
|
* Styles for the backdrop slot
|
|
55
|
-
*/ const
|
|
56
|
-
".
|
|
57
|
-
".
|
|
67
|
+
*/ const useBackdropBaseStyle = /*#__PURE__*/ (0, _react.__resetStyles)("raidwwn", "r17vltcu", [
|
|
68
|
+
".raidwwn{top:0px;right:0px;bottom:0px;left:0px;background-color:rgba(0, 0, 0, 0.4);position:fixed;transition-duration:var(--durationGentle);transition-timing-function:var(--curveLinear);transition-property:opacity;will-change:opacity;opacity:0;}",
|
|
69
|
+
".r17vltcu{top:0px;left:0px;bottom:0px;right:0px;background-color:rgba(0, 0, 0, 0.4);position:fixed;transition-duration:var(--durationGentle);transition-timing-function:var(--curveLinear);transition-property:opacity;will-change:opacity;opacity:0;}"
|
|
58
70
|
]);
|
|
71
|
+
const useBackdropStyles = /*#__PURE__*/ (0, _react.__styles)({
|
|
72
|
+
nestedDialogBackdrop: {
|
|
73
|
+
De3pzq: "f1c21dwh"
|
|
74
|
+
},
|
|
75
|
+
unmounted: {},
|
|
76
|
+
entering: {},
|
|
77
|
+
entered: {
|
|
78
|
+
abs64n: "f5p0z4x"
|
|
79
|
+
},
|
|
80
|
+
idle: {},
|
|
81
|
+
exiting: {
|
|
82
|
+
Bkqvd7p: "f1mfizis"
|
|
83
|
+
},
|
|
84
|
+
exited: {}
|
|
85
|
+
}, {
|
|
86
|
+
d: [
|
|
87
|
+
".f1c21dwh{background-color:var(--colorTransparentBackground);}",
|
|
88
|
+
".f5p0z4x{opacity:1;}",
|
|
89
|
+
".f1mfizis{transition-timing-function:var(--curveAccelerateMin);}"
|
|
90
|
+
]
|
|
91
|
+
});
|
|
59
92
|
const useDialogSurfaceStyles_unstable = (state)=>{
|
|
60
|
-
const
|
|
61
|
-
const
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
93
|
+
const { isNestedDialog, root, backdrop, transitionStatus = 'unmounted' } = state;
|
|
94
|
+
const rootBaseStyle = useRootBaseStyle();
|
|
95
|
+
const rootStyles = useRootStyles();
|
|
96
|
+
const backdropBaseStyle = useBackdropBaseStyle();
|
|
97
|
+
const backdropStyles = useBackdropStyles();
|
|
98
|
+
root.className = (0, _react.mergeClasses)(dialogSurfaceClassNames.root, rootBaseStyle, rootStyles[transitionStatus], root.className);
|
|
99
|
+
if (backdrop) {
|
|
100
|
+
backdrop.className = (0, _react.mergeClasses)(dialogSurfaceClassNames.backdrop, backdropBaseStyle, isNestedDialog && backdropStyles.nestedDialogBackdrop, backdropStyles[transitionStatus], backdrop.className);
|
|
66
101
|
}
|
|
67
102
|
return state;
|
|
68
103
|
}; //# sourceMappingURL=useDialogSurfaceStyles.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useDialogSurfaceStyles.styles.js"],"sourcesContent":["import { __resetStyles, __styles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { MEDIA_QUERY_BREAKPOINT_SELECTOR, SURFACE_BORDER_WIDTH, SURFACE_PADDING } from '../../contexts';\nexport const dialogSurfaceClassNames = {\n root: 'fui-DialogSurface',\n backdrop: 'fui-DialogSurface__backdrop'\n};\n/**\n * Styles for the root slot\n */\nconst
|
|
1
|
+
{"version":3,"sources":["useDialogSurfaceStyles.styles.js"],"sourcesContent":["import { __resetStyles, __styles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { MEDIA_QUERY_BREAKPOINT_SELECTOR, SURFACE_BORDER_WIDTH, SURFACE_PADDING } from '../../contexts';\nexport const dialogSurfaceClassNames = {\n root: 'fui-DialogSurface',\n backdrop: 'fui-DialogSurface__backdrop'\n};\n/**\n * Styles for the root slot\n */\nconst useRootBaseStyle = /*#__PURE__*/__resetStyles(\"r1xd7yeh\", \"r93c6rw\", {\n r: [\".r1xd7yeh{top:0;right:0;bottom:0;left:0;padding-top:24px;padding-right:24px;padding-bottom:24px;padding-left:24px;margin-top:auto;margin-right:auto;margin-bottom:auto;margin-left:auto;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;overflow-x:unset;overflow-y:unset;border-top-width:1px;border-right-width:1px;border-bottom-width:1px;border-left-width:1px;border-top-color:var(--colorTransparentStroke);border-right-color:var(--colorTransparentStroke);border-bottom-color:var(--colorTransparentStroke);border-left-color:var(--colorTransparentStroke);border-bottom-right-radius:var(--borderRadiusXLarge);border-bottom-left-radius:var(--borderRadiusXLarge);border-top-right-radius:var(--borderRadiusXLarge);border-top-left-radius:var(--borderRadiusXLarge);contain:content;display:block;-webkit-user-select:unset;-moz-user-select:unset;-ms-user-select:unset;user-select:unset;visibility:unset;position:fixed;height:fit-content;max-width:600px;max-height:100vh;box-sizing:border-box;background-color:var(--colorNeutralBackground1);color:var(--colorNeutralForeground1);opacity:0;transition-duration:var(--durationGentle);transition-property:opacity,transform,box-shadow;transition-timing-function:var(--curveDecelerateMid);box-shadow:0px 0px 0px 0px rgba(0, 0, 0, 0.1);transform:scale(0.85) translateZ(0);}\", \".r1xd7yeh:focus{outline-style:none;}\", \".r1xd7yeh:focus-visible{outline-style:none;}\", \".r1xd7yeh[data-fui-focus-visible]{border-top-color:transparent;border-right-color:transparent;border-bottom-color:transparent;border-left-color:transparent;}\", \".r1xd7yeh[data-fui-focus-visible]::after{content:\\\"\\\";position:absolute;pointer-events:none;z-index:1;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-width:2px;border-right-width:2px;border-bottom-width:2px;border-left-width:2px;border-bottom-right-radius:var(--borderRadiusMedium);border-bottom-left-radius:var(--borderRadiusMedium);border-top-right-radius:var(--borderRadiusMedium);border-top-left-radius:var(--borderRadiusMedium);border-top-color:var(--colorStrokeFocus2);border-right-color:var(--colorStrokeFocus2);border-bottom-color:var(--colorStrokeFocus2);border-left-color:var(--colorStrokeFocus2);top:calc(2px * -1);right:calc(2px * -1);bottom:calc(2px * -1);left:calc(2px * -1);}\", \".r93c6rw{top:0;left:0;bottom:0;right:0;padding-top:24px;padding-left:24px;padding-bottom:24px;padding-right:24px;margin-top:auto;margin-left:auto;margin-bottom:auto;margin-right:auto;border-top-style:solid;border-left-style:solid;border-bottom-style:solid;border-right-style:solid;overflow-x:unset;overflow-y:unset;border-top-width:1px;border-left-width:1px;border-bottom-width:1px;border-right-width:1px;border-top-color:var(--colorTransparentStroke);border-left-color:var(--colorTransparentStroke);border-bottom-color:var(--colorTransparentStroke);border-right-color:var(--colorTransparentStroke);border-bottom-left-radius:var(--borderRadiusXLarge);border-bottom-right-radius:var(--borderRadiusXLarge);border-top-left-radius:var(--borderRadiusXLarge);border-top-right-radius:var(--borderRadiusXLarge);contain:content;display:block;-webkit-user-select:unset;-moz-user-select:unset;-ms-user-select:unset;user-select:unset;visibility:unset;position:fixed;height:fit-content;max-width:600px;max-height:100vh;box-sizing:border-box;background-color:var(--colorNeutralBackground1);color:var(--colorNeutralForeground1);opacity:0;transition-duration:var(--durationGentle);transition-property:opacity,transform,box-shadow;transition-timing-function:var(--curveDecelerateMid);box-shadow:0px 0px 0px 0px rgba(0, 0, 0, 0.1);transform:scale(0.85) translateZ(0);}\", \".r93c6rw:focus{outline-style:none;}\", \".r93c6rw:focus-visible{outline-style:none;}\", \".r93c6rw[data-fui-focus-visible]{border-top-color:transparent;border-left-color:transparent;border-bottom-color:transparent;border-right-color:transparent;}\", \".r93c6rw[data-fui-focus-visible]::after{content:\\\"\\\";position:absolute;pointer-events:none;z-index:1;border-top-style:solid;border-left-style:solid;border-bottom-style:solid;border-right-style:solid;border-top-width:2px;border-left-width:2px;border-bottom-width:2px;border-right-width:2px;border-bottom-left-radius:var(--borderRadiusMedium);border-bottom-right-radius:var(--borderRadiusMedium);border-top-left-radius:var(--borderRadiusMedium);border-top-right-radius:var(--borderRadiusMedium);border-top-color:var(--colorStrokeFocus2);border-left-color:var(--colorStrokeFocus2);border-bottom-color:var(--colorStrokeFocus2);border-right-color:var(--colorStrokeFocus2);top:calc(2px * -1);left:calc(2px * -1);bottom:calc(2px * -1);right:calc(2px * -1);}\"],\n s: [\"@media screen and (max-width: 480px){.r1xd7yeh{max-width:100vw;}}\", \"@media screen and (max-width: 480px){.r93c6rw{max-width:100vw;}}\"]\n});\nconst useRootStyles = /*#__PURE__*/__styles({\n unmounted: {},\n entering: {},\n entered: {\n E5pizo: \"f10nrhrw\",\n Bz10aip: \"f186d0ee\",\n abs64n: \"f5p0z4x\"\n },\n idle: {},\n exiting: {\n Bkqvd7p: \"f1mfizis\"\n },\n exited: {}\n}, {\n d: [\".f10nrhrw{box-shadow:var(--shadow64);}\", \".f186d0ee{transform:scale(1) translateZ(0);}\", \".f5p0z4x{opacity:1;}\", \".f1mfizis{transition-timing-function:var(--curveAccelerateMin);}\"]\n});\n/**\n * Styles for the backdrop slot\n */\nconst useBackdropBaseStyle = /*#__PURE__*/__resetStyles(\"raidwwn\", \"r17vltcu\", [\".raidwwn{top:0px;right:0px;bottom:0px;left:0px;background-color:rgba(0, 0, 0, 0.4);position:fixed;transition-duration:var(--durationGentle);transition-timing-function:var(--curveLinear);transition-property:opacity;will-change:opacity;opacity:0;}\", \".r17vltcu{top:0px;left:0px;bottom:0px;right:0px;background-color:rgba(0, 0, 0, 0.4);position:fixed;transition-duration:var(--durationGentle);transition-timing-function:var(--curveLinear);transition-property:opacity;will-change:opacity;opacity:0;}\"]);\nconst useBackdropStyles = /*#__PURE__*/__styles({\n nestedDialogBackdrop: {\n De3pzq: \"f1c21dwh\"\n },\n unmounted: {},\n entering: {},\n entered: {\n abs64n: \"f5p0z4x\"\n },\n idle: {},\n exiting: {\n Bkqvd7p: \"f1mfizis\"\n },\n exited: {}\n}, {\n d: [\".f1c21dwh{background-color:var(--colorTransparentBackground);}\", \".f5p0z4x{opacity:1;}\", \".f1mfizis{transition-timing-function:var(--curveAccelerateMin);}\"]\n});\n/**\n * Apply styling to the DialogSurface slots based on the state\n */\nexport const useDialogSurfaceStyles_unstable = state => {\n const {\n isNestedDialog,\n root,\n backdrop,\n transitionStatus = 'unmounted'\n } = state;\n const rootBaseStyle = useRootBaseStyle();\n const rootStyles = useRootStyles();\n const backdropBaseStyle = useBackdropBaseStyle();\n const backdropStyles = useBackdropStyles();\n root.className = mergeClasses(dialogSurfaceClassNames.root, rootBaseStyle, rootStyles[transitionStatus], root.className);\n if (backdrop) {\n backdrop.className = mergeClasses(dialogSurfaceClassNames.backdrop, backdropBaseStyle, isNestedDialog && backdropStyles.nestedDialogBackdrop, backdropStyles[transitionStatus], backdrop.className);\n }\n return state;\n};\n//# sourceMappingURL=useDialogSurfaceStyles.styles.js.map"],"names":["dialogSurfaceClassNames","useDialogSurfaceStyles_unstable","root","backdrop","useRootBaseStyle","__resetStyles","r","s","useRootStyles","__styles","unmounted","entering","entered","E5pizo","Bz10aip","abs64n","idle","exiting","Bkqvd7p","exited","d","useBackdropBaseStyle","useBackdropStyles","nestedDialogBackdrop","De3pzq","state","isNestedDialog","transitionStatus","rootBaseStyle","rootStyles","backdropBaseStyle","backdropStyles","className","mergeClasses"],"mappings":";;;;;;;;;;;IAIaA,uBAAuB;eAAvBA;;IAmDAC,+BAA+B;eAA/BA;;;uBAvDqD;AAI3D,MAAMD,0BAA0B;IACrCE,MAAM;IACNC,UAAU;AACZ;AACA;;CAEC,GACD,MAAMC,mBAAmB,WAAW,GAAEC,IAAAA,oBAAa,EAAC,YAAY,WAAW;IACzEC,GAAG;QAAC;QAA20C;QAAwC;QAAgD;QAAiK;QAAmvB;QAA00C;QAAuC;QAA+C;QAAgK;KAAivB;IAC5mJC,GAAG;QAAC;QAAqE;KAAmE;AAC9I;AACA,MAAMC,gBAAgB,WAAW,GAAEC,IAAAA,eAAQ,EAAC;IAC1CC,WAAW,CAAC;IACZC,UAAU,CAAC;IACXC,SAAS;QACPC,QAAQ;QACRC,SAAS;QACTC,QAAQ;IACV;IACAC,MAAM,CAAC;IACPC,SAAS;QACPC,SAAS;IACX;IACAC,QAAQ,CAAC;AACX,GAAG;IACDC,GAAG;QAAC;QAA0C;QAAgD;QAAwB;KAAmE;AAC3L;AACA;;CAEC,GACD,MAAMC,uBAAuB,WAAW,GAAEhB,IAAAA,oBAAa,EAAC,WAAW,YAAY;IAAC;IAAyP;CAAyP;AAClkB,MAAMiB,oBAAoB,WAAW,GAAEb,IAAAA,eAAQ,EAAC;IAC9Cc,sBAAsB;QACpBC,QAAQ;IACV;IACAd,WAAW,CAAC;IACZC,UAAU,CAAC;IACXC,SAAS;QACPG,QAAQ;IACV;IACAC,MAAM,CAAC;IACPC,SAAS;QACPC,SAAS;IACX;IACAC,QAAQ,CAAC;AACX,GAAG;IACDC,GAAG;QAAC;QAAkE;QAAwB;KAAmE;AACnK;AAIO,MAAMnB,kCAAkCwB,CAAAA;IAC7C,MAAM,EACJC,cAAc,EACdxB,IAAI,EACJC,QAAQ,EACRwB,mBAAmB,WAAW,EAC/B,GAAGF;IACJ,MAAMG,gBAAgBxB;IACtB,MAAMyB,aAAarB;IACnB,MAAMsB,oBAAoBT;IAC1B,MAAMU,iBAAiBT;IACvBpB,KAAK8B,SAAS,GAAGC,IAAAA,mBAAY,EAACjC,wBAAwBE,IAAI,EAAE0B,eAAeC,UAAU,CAACF,iBAAiB,EAAEzB,KAAK8B,SAAS;IACvH,IAAI7B,UAAU;QACZA,SAAS6B,SAAS,GAAGC,IAAAA,mBAAY,EAACjC,wBAAwBG,QAAQ,EAAE2B,mBAAmBJ,kBAAkBK,eAAeR,oBAAoB,EAAEQ,cAAc,CAACJ,iBAAiB,EAAExB,SAAS6B,SAAS;IACpM;IACA,OAAOP;AACT,GACA,yDAAyD"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
DialogTransitionContext: function() {
|
|
13
|
+
return DialogTransitionContext;
|
|
14
|
+
},
|
|
15
|
+
DialogTransitionProvider: function() {
|
|
16
|
+
return DialogTransitionProvider;
|
|
17
|
+
},
|
|
18
|
+
useDialogTransitionContext_unstable: function() {
|
|
19
|
+
return useDialogTransitionContext_unstable;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
23
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
24
|
+
/**
|
|
25
|
+
* @internal
|
|
26
|
+
*/ const defaultContextValue = 'unmounted';
|
|
27
|
+
const DialogTransitionContext = /*#__PURE__*/ _react.createContext(undefined);
|
|
28
|
+
const DialogTransitionProvider = DialogTransitionContext.Provider;
|
|
29
|
+
const useDialogTransitionContext_unstable = ()=>{
|
|
30
|
+
var _React_useContext;
|
|
31
|
+
return (_React_useContext = _react.useContext(DialogTransitionContext)) !== null && _React_useContext !== void 0 ? _React_useContext : defaultContextValue;
|
|
32
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["dialogTransitionContext.js"],"sourcesContent":["import * as React from 'react';\n/**\n * @internal\n */ const defaultContextValue = 'unmounted';\n// Contexts should default to undefined\n/**\n * @internal\n */ export const DialogTransitionContext = React.createContext(undefined);\n/**\n * @internal\n */ export const DialogTransitionProvider = DialogTransitionContext.Provider;\n/**\n * @internal\n */ export const useDialogTransitionContext_unstable = ()=>{\n var _React_useContext;\n return (_React_useContext = React.useContext(DialogTransitionContext)) !== null && _React_useContext !== void 0 ? _React_useContext : defaultContextValue;\n};\n"],"names":["DialogTransitionContext","DialogTransitionProvider","useDialogTransitionContext_unstable","defaultContextValue","React","createContext","undefined","Provider","_React_useContext","useContext"],"mappings":";;;;;;;;;;;IAOiBA,uBAAuB;eAAvBA;;IAGAC,wBAAwB;eAAxBA;;IAGAC,mCAAmC;eAAnCA;;;;iEAbM;AACvB;;CAEC,GAAG,MAAMC,sBAAsB;AAIrB,MAAMH,wCAA0BI,OAAMC,aAAa,CAACC;AAGpD,MAAML,2BAA2BD,wBAAwBO,QAAQ;AAGjE,MAAML,sCAAsC;IACnD,IAAIM;IACJ,OAAO,AAACA,CAAAA,oBAAoBJ,OAAMK,UAAU,CAACT,wBAAuB,MAAO,QAAQQ,sBAAsB,KAAK,IAAIA,oBAAoBL;AAC1I"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-dialog",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.8.0",
|
|
4
4
|
"description": "Dialog component for Fluent UI React",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -36,16 +36,17 @@
|
|
|
36
36
|
"@fluentui/scripts-tasks": "*"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@fluentui/react-utilities": "^9.15.
|
|
40
|
-
"@fluentui/react-jsx-runtime": "^9.0.
|
|
39
|
+
"@fluentui/react-utilities": "^9.15.1",
|
|
40
|
+
"@fluentui/react-jsx-runtime": "^9.0.18",
|
|
41
|
+
"react-transition-group": "^4.4.1",
|
|
41
42
|
"@fluentui/keyboard-keys": "^9.0.6",
|
|
42
|
-
"@fluentui/react-context-selector": "^9.1.
|
|
43
|
+
"@fluentui/react-context-selector": "^9.1.41",
|
|
43
44
|
"@fluentui/react-shared-contexts": "^9.10.0",
|
|
44
|
-
"@fluentui/react-aria": "^9.3.
|
|
45
|
+
"@fluentui/react-aria": "^9.3.43",
|
|
45
46
|
"@fluentui/react-icons": "^2.0.217",
|
|
46
|
-
"@fluentui/react-tabster": "^9.
|
|
47
|
+
"@fluentui/react-tabster": "^9.14.1",
|
|
47
48
|
"@fluentui/react-theme": "^9.1.14",
|
|
48
|
-
"@fluentui/react-portal": "^9.3.
|
|
49
|
+
"@fluentui/react-portal": "^9.3.25",
|
|
49
50
|
"@griffel/react": "^1.5.14",
|
|
50
51
|
"@swc/helpers": "^0.5.1"
|
|
51
52
|
},
|