@fluentui/react-dialog 9.1.1 → 9.1.2
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 +54 -1
- package/CHANGELOG.md +16 -2
- package/dist/index.d.ts +0 -1
- package/lib/components/Dialog/useDialog.js +0 -1
- package/lib/components/Dialog/useDialog.js.map +1 -1
- package/lib/components/Dialog/useDialogContextValues.js +0 -2
- package/lib/components/Dialog/useDialogContextValues.js.map +1 -1
- package/lib/components/DialogContent/useDialogContent.js +0 -3
- package/lib/components/DialogContent/useDialogContent.js.map +1 -1
- package/lib/components/DialogSurface/useDialogSurface.js +0 -2
- package/lib/components/DialogSurface/useDialogSurface.js.map +1 -1
- package/lib/components/DialogTrigger/useDialogTrigger.js +2 -1
- package/lib/components/DialogTrigger/useDialogTrigger.js.map +1 -1
- package/lib/contexts/dialogContext.js.map +1 -1
- package/lib-amd/Dialog.js +6 -0
- package/lib-amd/Dialog.js.map +1 -0
- package/lib-amd/DialogActions.js +6 -0
- package/lib-amd/DialogActions.js.map +1 -0
- package/lib-amd/DialogBody.js +6 -0
- package/lib-amd/DialogBody.js.map +1 -0
- package/lib-amd/DialogContent.js +6 -0
- package/lib-amd/DialogContent.js.map +1 -0
- package/lib-amd/DialogSurface.js +6 -0
- package/lib-amd/DialogSurface.js.map +1 -0
- package/lib-amd/DialogTitle.js +6 -0
- package/lib-amd/DialogTitle.js.map +1 -0
- package/lib-amd/DialogTrigger.js +6 -0
- package/lib-amd/DialogTrigger.js.map +1 -0
- package/lib-amd/components/Dialog/Dialog.js +19 -0
- package/lib-amd/components/Dialog/Dialog.js.map +1 -0
- package/lib-amd/components/Dialog/Dialog.types.js +5 -0
- package/lib-amd/components/Dialog/Dialog.types.js.map +1 -0
- package/lib-amd/components/Dialog/index.js +9 -0
- package/lib-amd/components/Dialog/index.js.map +1 -0
- package/lib-amd/components/Dialog/renderDialog.js +17 -0
- package/lib-amd/components/Dialog/renderDialog.js.map +1 -0
- package/lib-amd/components/Dialog/useDialog.js +77 -0
- package/lib-amd/components/Dialog/useDialog.js.map +1 -0
- package/lib-amd/components/Dialog/useDialogContextValues.js +24 -0
- package/lib-amd/components/Dialog/useDialogContextValues.js.map +1 -0
- package/lib-amd/components/DialogActions/DialogActions.js +16 -0
- package/lib-amd/components/DialogActions/DialogActions.js.map +1 -0
- package/lib-amd/components/DialogActions/DialogActions.types.js +5 -0
- package/lib-amd/components/DialogActions/DialogActions.types.js.map +1 -0
- package/lib-amd/components/DialogActions/index.js +10 -0
- package/lib-amd/components/DialogActions/index.js.map +1 -0
- package/lib-amd/components/DialogActions/renderDialogActions.js +15 -0
- package/lib-amd/components/DialogActions/renderDialogActions.js.map +1 -0
- package/lib-amd/components/DialogActions/useDialogActions.js +26 -0
- package/lib-amd/components/DialogActions/useDialogActions.js.map +1 -0
- package/lib-amd/components/DialogActions/useDialogActionsStyles.js +27 -0
- package/lib-amd/components/DialogActions/useDialogActionsStyles.js.map +1 -0
- package/lib-amd/components/DialogBody/DialogBody.js +16 -0
- package/lib-amd/components/DialogBody/DialogBody.js.map +1 -0
- package/lib-amd/components/DialogBody/DialogBody.types.js +5 -0
- package/lib-amd/components/DialogBody/DialogBody.types.js.map +1 -0
- package/lib-amd/components/DialogBody/index.js +10 -0
- package/lib-amd/components/DialogBody/index.js.map +1 -0
- package/lib-amd/components/DialogBody/renderDialogBody.js +15 -0
- package/lib-amd/components/DialogBody/renderDialogBody.js.map +1 -0
- package/lib-amd/components/DialogBody/useDialogBody.js +25 -0
- package/lib-amd/components/DialogBody/useDialogBody.js.map +1 -0
- package/lib-amd/components/DialogBody/useDialogBodyStyles.js +31 -0
- package/lib-amd/components/DialogBody/useDialogBodyStyles.js.map +1 -0
- package/lib-amd/components/DialogContent/DialogContent.js +16 -0
- package/lib-amd/components/DialogContent/DialogContent.js.map +1 -0
- package/lib-amd/components/DialogContent/DialogContent.types.js +5 -0
- package/lib-amd/components/DialogContent/DialogContent.types.js.map +1 -0
- package/lib-amd/components/DialogContent/index.js +10 -0
- package/lib-amd/components/DialogContent/index.js.map +1 -0
- package/lib-amd/components/DialogContent/renderDialogContent.js +14 -0
- package/lib-amd/components/DialogContent/renderDialogContent.js.map +1 -0
- package/lib-amd/components/DialogContent/useDialogContent.js +25 -0
- package/lib-amd/components/DialogContent/useDialogContent.js.map +1 -0
- package/lib-amd/components/DialogContent/useDialogContentStyles.js +24 -0
- package/lib-amd/components/DialogContent/useDialogContentStyles.js.map +1 -0
- package/lib-amd/components/DialogSurface/DialogSurface.js +17 -0
- package/lib-amd/components/DialogSurface/DialogSurface.js.map +1 -0
- package/lib-amd/components/DialogSurface/DialogSurface.types.js +5 -0
- package/lib-amd/components/DialogSurface/DialogSurface.types.js.map +1 -0
- package/lib-amd/components/DialogSurface/index.js +10 -0
- package/lib-amd/components/DialogSurface/index.js.map +1 -0
- package/lib-amd/components/DialogSurface/renderDialogSurface.js +17 -0
- package/lib-amd/components/DialogSurface/renderDialogSurface.js.map +1 -0
- package/lib-amd/components/DialogSurface/useDialogSurface.js +66 -0
- package/lib-amd/components/DialogSurface/useDialogSurface.js.map +1 -0
- package/lib-amd/components/DialogSurface/useDialogSurfaceContextValues.js +11 -0
- package/lib-amd/components/DialogSurface/useDialogSurfaceContextValues.js.map +1 -0
- package/lib-amd/components/DialogSurface/useDialogSurfaceStyles.js +44 -0
- package/lib-amd/components/DialogSurface/useDialogSurfaceStyles.js.map +1 -0
- package/lib-amd/components/DialogTitle/DialogTitle.js +16 -0
- package/lib-amd/components/DialogTitle/DialogTitle.js.map +1 -0
- package/lib-amd/components/DialogTitle/DialogTitle.types.js +5 -0
- package/lib-amd/components/DialogTitle/DialogTitle.types.js.map +1 -0
- package/lib-amd/components/DialogTitle/index.js +10 -0
- package/lib-amd/components/DialogTitle/index.js.map +1 -0
- package/lib-amd/components/DialogTitle/renderDialogTitle.js +16 -0
- package/lib-amd/components/DialogTitle/renderDialogTitle.js.map +1 -0
- package/lib-amd/components/DialogTitle/useDialogTitle.js +36 -0
- package/lib-amd/components/DialogTitle/useDialogTitle.js.map +1 -0
- package/lib-amd/components/DialogTitle/useDialogTitleStyles.js +37 -0
- package/lib-amd/components/DialogTitle/useDialogTitleStyles.js.map +1 -0
- package/lib-amd/components/DialogTrigger/DialogTrigger.js +24 -0
- package/lib-amd/components/DialogTrigger/DialogTrigger.js.map +1 -0
- package/lib-amd/components/DialogTrigger/DialogTrigger.types.js +5 -0
- package/lib-amd/components/DialogTrigger/DialogTrigger.types.js.map +1 -0
- package/lib-amd/components/DialogTrigger/index.js +9 -0
- package/lib-amd/components/DialogTrigger/index.js.map +1 -0
- package/lib-amd/components/DialogTrigger/renderDialogTrigger.js +13 -0
- package/lib-amd/components/DialogTrigger/renderDialogTrigger.js.map +1 -0
- package/lib-amd/components/DialogTrigger/useDialogTrigger.js +37 -0
- package/lib-amd/components/DialogTrigger/useDialogTrigger.js.map +1 -0
- package/lib-amd/contexts/constants.js +16 -0
- package/lib-amd/contexts/constants.js.map +1 -0
- package/lib-amd/contexts/dialogContext.js +25 -0
- package/lib-amd/contexts/dialogContext.js.map +1 -0
- package/lib-amd/contexts/dialogSurfaceContext.js +11 -0
- package/lib-amd/contexts/dialogSurfaceContext.js.map +1 -0
- package/lib-amd/contexts/index.js +8 -0
- package/lib-amd/contexts/index.js.map +1 -0
- package/lib-amd/index.js +37 -0
- package/lib-amd/index.js.map +1 -0
- package/lib-amd/utils/index.js +8 -0
- package/lib-amd/utils/index.js.map +1 -0
- package/lib-amd/utils/isEscapeKeyDown.js +13 -0
- package/lib-amd/utils/isEscapeKeyDown.js.map +1 -0
- package/lib-amd/utils/useDisableBodyScroll.js +52 -0
- package/lib-amd/utils/useDisableBodyScroll.js.map +1 -0
- package/lib-amd/utils/useFocusFirstElement.js +38 -0
- package/lib-amd/utils/useFocusFirstElement.js.map +1 -0
- package/lib-commonjs/components/Dialog/useDialog.js +0 -1
- package/lib-commonjs/components/Dialog/useDialog.js.map +1 -1
- package/lib-commonjs/components/Dialog/useDialogContextValues.js +0 -2
- package/lib-commonjs/components/Dialog/useDialogContextValues.js.map +1 -1
- package/lib-commonjs/components/DialogContent/useDialogContent.js +0 -4
- package/lib-commonjs/components/DialogContent/useDialogContent.js.map +1 -1
- package/lib-commonjs/components/DialogSurface/useDialogSurface.js +0 -2
- package/lib-commonjs/components/DialogSurface/useDialogSurface.js.map +1 -1
- package/lib-commonjs/components/DialogTrigger/useDialogTrigger.js +2 -1
- package/lib-commonjs/components/DialogTrigger/useDialogTrigger.js.map +1 -1
- package/lib-commonjs/contexts/dialogContext.js.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,60 @@
|
|
|
2
2
|
"name": "@fluentui/react-dialog",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Thu, 17 Nov 2022 23:02:36 GMT",
|
|
6
|
+
"tag": "@fluentui/react-dialog_v9.1.2",
|
|
7
|
+
"version": "9.1.2",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "bernardo.sunderhus@gmail.com",
|
|
12
|
+
"package": "@fluentui/react-dialog",
|
|
13
|
+
"commit": "a510bccdb429d1a038f5c28b84bf3e98b51906b3",
|
|
14
|
+
"comment": "feat: removes aria-haspopup"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "beachball",
|
|
18
|
+
"package": "@fluentui/react-dialog",
|
|
19
|
+
"comment": "Bump @fluentui/react-utilities to v9.2.2",
|
|
20
|
+
"commit": "94e156be5d3b5790d82dccf08c32672733fb9335"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "beachball",
|
|
24
|
+
"package": "@fluentui/react-dialog",
|
|
25
|
+
"comment": "Bump @fluentui/react-context-selector to v9.1.2",
|
|
26
|
+
"commit": "94e156be5d3b5790d82dccf08c32672733fb9335"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"author": "beachball",
|
|
30
|
+
"package": "@fluentui/react-dialog",
|
|
31
|
+
"comment": "Bump @fluentui/react-aria to v9.3.2",
|
|
32
|
+
"commit": "94e156be5d3b5790d82dccf08c32672733fb9335"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"author": "beachball",
|
|
36
|
+
"package": "@fluentui/react-dialog",
|
|
37
|
+
"comment": "Bump @fluentui/react-tabster to v9.3.1",
|
|
38
|
+
"commit": "94e156be5d3b5790d82dccf08c32672733fb9335"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"author": "beachball",
|
|
42
|
+
"package": "@fluentui/react-dialog",
|
|
43
|
+
"comment": "Bump @fluentui/react-portal to v9.0.11",
|
|
44
|
+
"commit": "94e156be5d3b5790d82dccf08c32672733fb9335"
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
"none": [
|
|
48
|
+
{
|
|
49
|
+
"author": "martinhochel@microsoft.com",
|
|
50
|
+
"package": "@fluentui/react-dialog",
|
|
51
|
+
"commit": "ea768501802d65d63ddc63fff3816fb6b5008ae4",
|
|
52
|
+
"comment": "chore: update package scaffold"
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"date": "Fri, 11 Nov 2022 14:58:02 GMT",
|
|
6
59
|
"tag": "@fluentui/react-dialog_v9.1.1",
|
|
7
60
|
"version": "9.1.1",
|
|
8
61
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,26 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-dialog
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Thu, 17 Nov 2022 23:02:36 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.1.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-dialog_v9.1.2)
|
|
8
|
+
|
|
9
|
+
Thu, 17 Nov 2022 23:02:36 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-dialog_v9.1.1..@fluentui/react-dialog_v9.1.2)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- feat: removes aria-haspopup ([PR #25611](https://github.com/microsoft/fluentui/pull/25611) by bernardo.sunderhus@gmail.com)
|
|
15
|
+
- Bump @fluentui/react-utilities to v9.2.2 ([PR #25683](https://github.com/microsoft/fluentui/pull/25683) by beachball)
|
|
16
|
+
- Bump @fluentui/react-context-selector to v9.1.2 ([PR #25683](https://github.com/microsoft/fluentui/pull/25683) by beachball)
|
|
17
|
+
- Bump @fluentui/react-aria to v9.3.2 ([PR #25683](https://github.com/microsoft/fluentui/pull/25683) by beachball)
|
|
18
|
+
- Bump @fluentui/react-tabster to v9.3.1 ([PR #25683](https://github.com/microsoft/fluentui/pull/25683) by beachball)
|
|
19
|
+
- Bump @fluentui/react-portal to v9.0.11 ([PR #25683](https://github.com/microsoft/fluentui/pull/25683) by beachball)
|
|
20
|
+
|
|
7
21
|
## [9.1.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-dialog_v9.1.1)
|
|
8
22
|
|
|
9
|
-
Fri, 11 Nov 2022 14:
|
|
23
|
+
Fri, 11 Nov 2022 14:58:02 GMT
|
|
10
24
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-dialog_v9.1.0..@fluentui/react-dialog_v9.1.1)
|
|
11
25
|
|
|
12
26
|
### Patches
|
package/dist/index.d.ts
CHANGED
|
@@ -99,7 +99,6 @@ export declare type DialogContentState = ComponentState<DialogContentSlots>;
|
|
|
99
99
|
|
|
100
100
|
declare type DialogContextValue = {
|
|
101
101
|
open: boolean;
|
|
102
|
-
dialogContentId?: string;
|
|
103
102
|
dialogTitleId?: string;
|
|
104
103
|
isNestedDialog: boolean;
|
|
105
104
|
dialogRef: React_2.Ref<DialogSurfaceElement>;
|
|
@@ -49,7 +49,6 @@ export const useDialog_unstable = props => {
|
|
|
49
49
|
content: open ? content : null,
|
|
50
50
|
trigger,
|
|
51
51
|
requestOpenChange,
|
|
52
|
-
dialogContentId: useId('dialog-content-'),
|
|
53
52
|
dialogTitleId: useId('dialog-title-'),
|
|
54
53
|
isNestedDialog: useHasParentContext(DialogContext),
|
|
55
54
|
dialogRef: focusRef
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-dialog/src/components/Dialog/useDialog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,oBAAT,EAA+B,gBAA/B,EAAiD,KAAjD,EAAwD,yBAAxD,QAAyF,2BAAzF;AACA,SAAS,mBAAT,QAAoC,kCAApC;AACA,SAAS,oBAAT,EAA+B,oBAA/B,QAA2D,aAA3D;AACA,SAAS,aAAT,QAA8B,gBAA9B;AAIA;;;;;;;AAOG;;AACH,OAAO,MAAM,kBAAkB,GAAI,KAAD,IAAoC;EACpE,MAAM;IAAE,QAAF;IAAY,SAAS,GAAG,OAAxB;IAAiC;EAAjC,IAAkD,KAAxD;EAEA,MAAM,CAAC,OAAD,EAAU,OAAV,IAAqB,2BAA2B,CAAC,QAAD,CAAtD;EAEA,MAAM,CAAC,IAAD,EAAO,OAAP,IAAkB,oBAAoB,CAAC;IAC3C,KAAK,EAAE,KAAK,CAAC,IAD8B;IAE3C,YAAY,EAAE,KAAK,CAAC,WAFuB;IAG3C,YAAY,EAAE;EAH6B,CAAD,CAA5C;EAMA,MAAM,iBAAiB,GAAG,gBAAgB,CAAE,IAAD,IAA+B;IACxE,YAAY,KAAA,IAAZ,IAAA,YAAY,KAAA,KAAA,CAAZ,GAAY,KAAA,CAAZ,GAAA,YAAY,CAAG,IAAI,CAAC,KAAR,EAAe,IAAf,CAAZ,CADwE,CAGxE;IACA;;IACA,IAAI,CAAC,IAAI,CAAC,KAAL,CAAW,kBAAX,EAAL,EAAsC;MACpC,OAAO,CAAC,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AAO,CAAC,IAAR,CACE,+DACE,4EAFJ;IAID;EACF;;EACD,QAAQ,aAAa,CAAC,MAAtB;IACE;IACA,KAAK,CAAL;MACE,OAAO,aAAP;IACF;;IACA,KAAK,CAAL;MACE,OAAO,CAAC,SAAD,EAAY,aAAa,CAAC,CAAD,CAAzB,CAAP;IACF;;IACA;MACE,OAAO,CAAC,SAAD,EAAY,SAAZ,CAAP;EATJ;AAWD","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';\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 } = 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 return {\n components: {\n backdrop: 'div',\n },\n open,\n modalType,\n content: open ? content : null,\n trigger,\n requestOpenChange,\n dialogTitleId: useId('dialog-title-'),\n isNestedDialog: useHasParentContext(DialogContext),\n dialogRef: focusRef,\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(\n 'Dialog must contain at least one child <DialogSurface/>,\\n' +\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"],"sourceRoot":"../src/"}
|
|
@@ -2,7 +2,6 @@ export function useDialogContextValues_unstable(state) {
|
|
|
2
2
|
const {
|
|
3
3
|
modalType,
|
|
4
4
|
open,
|
|
5
|
-
dialogContentId,
|
|
6
5
|
dialogRef,
|
|
7
6
|
dialogTitleId,
|
|
8
7
|
isNestedDialog,
|
|
@@ -17,7 +16,6 @@ export function useDialogContextValues_unstable(state) {
|
|
|
17
16
|
open,
|
|
18
17
|
modalType,
|
|
19
18
|
dialogRef,
|
|
20
|
-
dialogContentId,
|
|
21
19
|
dialogTitleId,
|
|
22
20
|
isNestedDialog,
|
|
23
21
|
requestOpenChange
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-dialog/src/components/Dialog/useDialogContextValues.ts"],"names":[],"mappings":"AAGA,OAAM,SAAU,+BAAV,CAA0C,KAA1C,EAA4D;EAChE,MAAM;IAAE,SAAF;IAAa,IAAb;IAAmB,
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-dialog/src/components/Dialog/useDialogContextValues.ts"],"names":[],"mappings":"AAGA,OAAM,SAAU,+BAAV,CAA0C,KAA1C,EAA4D;EAChE,MAAM;IAAE,SAAF;IAAa,IAAb;IAAmB,SAAnB;IAA8B,aAA9B;IAA6C,cAA7C;IAA6D;EAA7D,IAAmF,KAAzF;EAEA;;;AAGG;;EACH,MAAM,MAAM,GAAuB;IACjC,IADiC;IAEjC,SAFiC;IAGjC,SAHiC;IAIjC,aAJiC;IAKjC,cALiC;IAMjC;EANiC,CAAnC;EASA,MAAM,aAAa,GAA8B,KAAjD;EAEA,OAAO;IAAE,MAAF;IAAU;EAAV,CAAP;AACD","sourcesContent":["import type { DialogContextValue, DialogSurfaceContextValue } from '../../contexts';\nimport type { DialogContextValues, DialogState } from './Dialog.types';\n\nexport function useDialogContextValues_unstable(state: DialogState): DialogContextValues {\n const { modalType, open, dialogRef, dialogTitleId, isNestedDialog, requestOpenChange } = state;\n\n /**\n * This context is created with \"@fluentui/react-context-selector\",\n * there is no sense to memoize it\n */\n const dialog: DialogContextValue = {\n open,\n modalType,\n dialogRef,\n dialogTitleId,\n isNestedDialog,\n requestOpenChange,\n };\n\n const dialogSurface: DialogSurfaceContextValue = false;\n\n return { dialog, dialogSurface };\n}\n"],"sourceRoot":"../src/"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { getNativeElementProps } from '@fluentui/react-utilities';
|
|
2
|
-
import { useDialogContext_unstable } from '../../contexts';
|
|
3
2
|
/**
|
|
4
3
|
* Create the state required to render DialogBody.
|
|
5
4
|
*
|
|
@@ -13,14 +12,12 @@ import { useDialogContext_unstable } from '../../contexts';
|
|
|
13
12
|
export const useDialogContent_unstable = (props, ref) => {
|
|
14
13
|
var _a;
|
|
15
14
|
|
|
16
|
-
const dialogContentId = useDialogContext_unstable(ctx => ctx.dialogContentId);
|
|
17
15
|
return {
|
|
18
16
|
components: {
|
|
19
17
|
root: 'div'
|
|
20
18
|
},
|
|
21
19
|
root: getNativeElementProps((_a = props.as) !== null && _a !== void 0 ? _a : 'div', {
|
|
22
20
|
ref,
|
|
23
|
-
id: dialogContentId,
|
|
24
21
|
...props
|
|
25
22
|
})
|
|
26
23
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-dialog/src/components/DialogContent/useDialogContent.ts"],"names":[],"mappings":"AACA,SAAS,qBAAT,QAAsC,2BAAtC;
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-dialog/src/components/DialogContent/useDialogContent.ts"],"names":[],"mappings":"AACA,SAAS,qBAAT,QAAsC,2BAAtC;AAGA;;;;;;;;AAQG;;AACH,OAAO,MAAM,yBAAyB,GAAG,CACvC,KADuC,EAEvC,GAFuC,KAGjB;;;EACtB,OAAO;IACL,UAAU,EAAE;MACV,IAAI,EAAE;IADI,CADP;IAIL,IAAI,EAAE,qBAAqB,CAAC,CAAA,EAAA,GAAA,KAAK,CAAC,EAAN,MAAQ,IAAR,IAAQ,EAAA,KAAA,KAAA,CAAR,GAAQ,EAAR,GAAY,KAAb,EAAoB;MAC7C,GAD6C;MAE7C,GAAG;IAF0C,CAApB;EAJtB,CAAP;AASD,CAbM","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps } from '@fluentui/react-utilities';\nimport { DialogContentProps, DialogContentState } from './DialogContent.types';\n\n/**\n * Create the state required to render DialogBody.\n *\n * The returned state can be modified with hooks such as useDialogBodyStyles_unstable,\n * before being passed to renderDialogBody_unstable.\n *\n * @param props - props from this instance of DialogBody\n * @param ref - reference to root HTMLElement of DialogBody\n */\nexport const useDialogContent_unstable = (\n props: DialogContentProps,\n ref: React.Ref<HTMLElement>,\n): DialogContentState => {\n return {\n components: {\n root: 'div',\n },\n root: getNativeElementProps(props.as ?? 'div', {\n ref,\n ...props,\n }),\n };\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -22,7 +22,6 @@ export const useDialogSurface_unstable = (props, ref) => {
|
|
|
22
22
|
const open = useDialogContext_unstable(ctx => ctx.open);
|
|
23
23
|
const requestOpenChange = useDialogContext_unstable(ctx => ctx.requestOpenChange);
|
|
24
24
|
const dialogTitleID = useDialogContext_unstable(ctx => ctx.dialogTitleId);
|
|
25
|
-
const dialogContentId = useDialogContext_unstable(ctx => ctx.dialogContentId);
|
|
26
25
|
const handledBackdropClick = useEventCallback(event => {
|
|
27
26
|
var _a, _b;
|
|
28
27
|
|
|
@@ -75,7 +74,6 @@ export const useDialogSurface_unstable = (props, ref) => {
|
|
|
75
74
|
tabIndex: -1,
|
|
76
75
|
'aria-modal': modalType !== 'non-modal',
|
|
77
76
|
role: modalType === 'alert' ? 'alertdialog' : 'dialog',
|
|
78
|
-
'aria-describedby': dialogContentId,
|
|
79
77
|
'aria-labelledby': props['aria-label'] ? undefined : dialogTitleID,
|
|
80
78
|
...props,
|
|
81
79
|
...modalAttributes,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-dialog/src/components/DialogSurface/useDialogSurface.ts"],"names":[],"mappings":"AACA,SACE,qBADF,EAEE,gBAFF,EAGE,gBAHF,EAIE,aAJF,EAKE,mBALF,QAMO,2BANP;AAaA,SAAS,yBAAT,QAA0C,gBAA1C;AACA,SAAS,kBAAT,QAAmC,aAAnC;AACA,SAAS,kBAAT,QAAmC,yBAAnC;AAEA;;;;;;;;AAQG;;AACH,OAAO,MAAM,yBAAyB,GAAG,CACvC,KADuC,EAEvC,GAFuC,KAGjB;EACtB,MAAM;IAAE,QAAF;IAAY;EAAZ,IAAmB,KAAzB;EACA,MAAM,SAAS,GAAG,yBAAyB,CAAC,GAAG,IAAI,GAAG,CAAC,SAAZ,CAA3C;EACA,MAAM,SAAS,GAAG,yBAAyB,CAAC,GAAG,IAAI,GAAG,CAAC,SAAZ,CAA3C;EACA,MAAM,IAAI,GAAG,yBAAyB,CAAC,GAAG,IAAI,GAAG,CAAC,IAAZ,CAAtC;EACA,MAAM,iBAAiB,GAAG,yBAAyB,CAAC,GAAG,IAAI,GAAG,CAAC,iBAAZ,CAAnD;EACA,MAAM,aAAa,GAAG,yBAAyB,CAAC,GAAG,IAAI,GAAG,CAAC,aAAZ,CA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vC,GAAG,EAAE,aAAa,CAAC,GAAD,EAAM,SAAN;IARqB,CAAd;EAZtB,CAAP;AAuBD,CAhEM","sourcesContent":["import * as React from 'react';\nimport {\n getNativeElementProps,\n resolveShorthand,\n useEventCallback,\n useMergedRefs,\n isResolvedShorthand,\n} from '@fluentui/react-utilities';\nimport type {\n DialogSurfaceElement,\n DialogSurfaceElementIntersection,\n DialogSurfaceProps,\n DialogSurfaceState,\n} from './DialogSurface.types';\nimport { useDialogContext_unstable } from '../../contexts';\nimport { isEscapeKeyDismiss } from '../../utils';\nimport { useModalAttributes } from '@fluentui/react-tabster';\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 { backdrop, as } = props;\n const modalType = useDialogContext_unstable(ctx => ctx.modalType);\n const dialogRef = useDialogContext_unstable(ctx => ctx.dialogRef);\n const open = useDialogContext_unstable(ctx => ctx.open);\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<DialogSurfaceElementIntersection>) => {\n props.onKeyDown?.(event);\n\n if (isEscapeKeyDismiss(event, modalType)) {\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.stopPropagation();\n }\n });\n\n const { modalAttributes } = useModalAttributes({ trapFocus: modalType !== 'non-modal' });\n\n return {\n components: {\n backdrop: 'div',\n root: 'div',\n },\n backdrop: resolveShorthand(backdrop, {\n required: open && modalType !== 'non-modal',\n defaultProps: {\n 'aria-hidden': 'true',\n onClick: handledBackdropClick,\n },\n }),\n root: getNativeElementProps(as ?? '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 ref: useMergedRefs(ref, dialogRef),\n }),\n };\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -18,6 +18,7 @@ export const useDialogTrigger_unstable = props => {
|
|
|
18
18
|
} = props;
|
|
19
19
|
const child = getTriggerChild(children);
|
|
20
20
|
const requestOpenChange = useDialogContext_unstable(ctx => ctx.requestOpenChange);
|
|
21
|
+
const open = useDialogContext_unstable(ctx => ctx.open);
|
|
21
22
|
const {
|
|
22
23
|
triggerAttributes
|
|
23
24
|
} = useModalAttributes();
|
|
@@ -35,7 +36,7 @@ export const useDialogTrigger_unstable = props => {
|
|
|
35
36
|
}
|
|
36
37
|
});
|
|
37
38
|
const triggerChildProps = { ...(child === null || child === void 0 ? void 0 : child.props),
|
|
38
|
-
'aria-
|
|
39
|
+
'aria-expanded': open,
|
|
39
40
|
ref: child === null || child === void 0 ? void 0 : child.ref,
|
|
40
41
|
onClick: handleClick,
|
|
41
42
|
...triggerAttributes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-dialog/src/components/DialogTrigger/useDialogTrigger.ts"],"names":[],"mappings":"AACA,SAAS,kBAAT,QAAmC,yBAAnC;AACA,SAAS,2BAAT,EAAsC,eAAtC,EAAuD,gBAAvD,QAA+E,2BAA/E;AAE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AK,KAAA,CAAL,GAAA,KAAK,CAAE,KAAV,CADwB;IAExB,iBAAiB,IAFO;IAGxB,GAAG,EAAE,KAAK,KAAA,IAAL,IAAA,KAAK,KAAA,KAAA,CAAL,GAAK,KAAA,CAAL,GAAA,KAAK,CAAE,GAHY;IAIxB,OAAO,EAAE,WAJe;IAKxB,GAAG;EALqB,CAA1B;EAQA,MAAM,2BAA2B,GAAG,kBAAkB,CACpD,CAAA,KAAK,KAAA,IAAL,IAAA,KAAK,KAAA,KAAA,CAAL,GAAK,KAAA,CAAL,GAAA,KAAK,CAAE,IAAP,MAAgB,QAAhB,IAA4B,CAAA,KAAK,KAAA,IAAL,IAAA,KAAK,KAAA,KAAA,CAAL,GAAK,KAAA,CAAL,GAAA,KAAK,CAAE,IAAP,MAAgB,GAA5C,GAAkD,KAAK,CAAC,IAAxD,GAA+D,KADX,EAEpD,EACE,GAAG,iBADL;IAEE,IAAI,EAAE;EAFR,CAFoD,CAAtD;EAQA,OAAO;IACL,QAAQ,EAAE,2BAA2B,CACnC,QADmC,EAEnC,wBAAwB,GAAG,iBAAH,GAAuB,2BAFZ;EADhC,CAAP;AAMD,CA/CM","sourcesContent":["import * as React from 'react';\nimport { useModalAttributes } from '@fluentui/react-tabster';\nimport { applyTriggerPropsToChildren, getTriggerChild, useEventCallback } from '@fluentui/react-utilities';\nimport type { DialogTriggerProps, DialogTriggerState } from './DialogTrigger.types';\nimport { useDialogContext_unstable, useDialogSurfaceContext_unstable } from '../../contexts';\nimport { useARIAButtonProps } from '@fluentui/react-aria';\n\n/**\n * Create the state required to render DialogTrigger.\n * Clones the only child component and adds necessary event handling behaviours to open a popup Dialog\n *\n * @param props - props from this instance of DialogTrigger\n */\nexport const useDialogTrigger_unstable = (props: DialogTriggerProps): DialogTriggerState => {\n const isInsideSurfaceDialog = useDialogSurfaceContext_unstable();\n\n const { children, disableButtonEnhancement = false, action = isInsideSurfaceDialog ? 'close' : 'open' } = props;\n\n const child = getTriggerChild(children);\n\n const requestOpenChange = useDialogContext_unstable(ctx => ctx.requestOpenChange);\n const open = useDialogContext_unstable(ctx => ctx.open);\n\n const { triggerAttributes } = useModalAttributes();\n\n const handleClick = useEventCallback(\n (event: React.MouseEvent<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>) => {\n child?.props.onClick?.(event);\n if (!event.isDefaultPrevented()) {\n requestOpenChange({\n event,\n type: 'triggerClick',\n open: action === 'open',\n });\n }\n },\n );\n\n const triggerChildProps = {\n ...child?.props,\n 'aria-expanded': open,\n ref: child?.ref,\n onClick: handleClick,\n ...triggerAttributes,\n } as const;\n\n const ariaButtonTriggerChildProps = useARIAButtonProps(\n child?.type === 'button' || child?.type === 'a' ? child.type : 'div',\n {\n ...triggerChildProps,\n type: 'button',\n },\n );\n\n return {\n children: applyTriggerPropsToChildren(\n children,\n disableButtonEnhancement ? triggerChildProps : ariaButtonTriggerChildProps,\n ),\n };\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-dialog/src/contexts/dialogContext.ts"],"names":[],"mappings":"AACA,SAAS,aAAT,EAAyC,kBAAzC,QAAmE,kCAAnE;
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-dialog/src/contexts/dialogContext.ts"],"names":[],"mappings":"AACA,SAAS,aAAT,EAAyC,kBAAzC,QAAmE,kCAAnE;AAiBA,MAAM,mBAAmB,GAAuB;EAC9C,IAAI,EAAE,KADwC;EAE9C,SAAS,EAAE,OAFmC;EAG9C,cAAc,EAAE,KAH8B;EAI9C,SAAS,EAAE;IAAE,OAAO,EAAE;EAAX,CAJmC;;EAK9C,iBAAiB,GAAA;IACf;EACD;;AAP6C,CAAhD,C,CAUA;;AACA,OAAO,MAAM,aAAa,gBAA4C,aAAa,CACjF,SADiF,CAA5E;AAIP,OAAO,MAAM,cAAc,GAAG,aAAa,CAAC,QAArC;AACP,OAAO,MAAM,yBAAyB,GAAO,QAAJ,IACvC,kBAAkB,CAAC,aAAD,EAAgB,CAAC,GAAG,GAAG,mBAAP,KAA+B,QAAQ,CAAC,GAAD,CAAvD,CADb","sourcesContent":["import * as React from 'react';\nimport { createContext, ContextSelector, useContextSelector } from '@fluentui/react-context-selector';\nimport { DialogSurfaceElement } from '../DialogSurface';\nimport type { Context } from '@fluentui/react-context-selector';\nimport type { DialogModalType, DialogOpenChangeData } from '../Dialog';\n\nexport type DialogContextValue = {\n open: boolean;\n dialogTitleId?: string;\n isNestedDialog: boolean;\n dialogRef: React.Ref<DialogSurfaceElement>;\n modalType: DialogModalType;\n /**\n * Requests dialog main component to update it's internal open state\n */\n requestOpenChange: (data: DialogOpenChangeData) => void;\n};\n\nconst defaultContextValue: DialogContextValue = {\n open: false,\n modalType: 'modal',\n isNestedDialog: false,\n dialogRef: { current: null },\n requestOpenChange() {\n /* noop */\n },\n};\n\n// Contexts should default to undefined\nexport const DialogContext: Context<DialogContextValue | undefined> = createContext<DialogContextValue | undefined>(\n undefined,\n);\n\nexport const DialogProvider = DialogContext.Provider;\nexport const useDialogContext_unstable = <T>(selector: ContextSelector<DialogContextValue, T>): T =>\n useContextSelector(DialogContext, (ctx = defaultContextValue) => selector(ctx));\n"],"sourceRoot":"../src/"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
define(["require", "exports", "tslib", "./components/Dialog/index"], function (require, exports, tslib_1, index_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
tslib_1.__exportStar(index_1, exports);
|
|
5
|
+
});
|
|
6
|
+
//# sourceMappingURL=Dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-dialog/src/Dialog.ts"],"names":[],"mappings":";;;IAAA,uCAA0C","sourcesContent":["export * from './components/Dialog/index';\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
define(["require", "exports", "tslib", "./components/DialogActions/index"], function (require, exports, tslib_1, index_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
tslib_1.__exportStar(index_1, exports);
|
|
5
|
+
});
|
|
6
|
+
//# sourceMappingURL=DialogActions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialogActions.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-dialog/src/DialogActions.ts"],"names":[],"mappings":";;;IAAA,uCAAiD","sourcesContent":["export * from './components/DialogActions/index';\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
define(["require", "exports", "tslib", "./components/DialogBody/index"], function (require, exports, tslib_1, index_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
tslib_1.__exportStar(index_1, exports);
|
|
5
|
+
});
|
|
6
|
+
//# sourceMappingURL=DialogBody.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialogBody.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-dialog/src/DialogBody.ts"],"names":[],"mappings":";;;IAAA,uCAA8C","sourcesContent":["export * from './components/DialogBody/index';\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
define(["require", "exports", "tslib", "./components/DialogContent/index"], function (require, exports, tslib_1, index_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
tslib_1.__exportStar(index_1, exports);
|
|
5
|
+
});
|
|
6
|
+
//# sourceMappingURL=DialogContent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialogContent.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-dialog/src/DialogContent.ts"],"names":[],"mappings":";;;IAAA,uCAAiD","sourcesContent":["export * from './components/DialogContent/index';\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
define(["require", "exports", "tslib", "./components/DialogSurface/index"], function (require, exports, tslib_1, index_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
tslib_1.__exportStar(index_1, exports);
|
|
5
|
+
});
|
|
6
|
+
//# sourceMappingURL=DialogSurface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialogSurface.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-dialog/src/DialogSurface.ts"],"names":[],"mappings":";;;IAAA,uCAAiD","sourcesContent":["export * from './components/DialogSurface/index';\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
define(["require", "exports", "tslib", "./components/DialogTitle/index"], function (require, exports, tslib_1, index_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
tslib_1.__exportStar(index_1, exports);
|
|
5
|
+
});
|
|
6
|
+
//# sourceMappingURL=DialogTitle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialogTitle.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-dialog/src/DialogTitle.ts"],"names":[],"mappings":";;;IAAA,uCAA+C","sourcesContent":["export * from './components/DialogTitle/index';\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
define(["require", "exports", "tslib", "./components/DialogTrigger/index"], function (require, exports, tslib_1, index_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
tslib_1.__exportStar(index_1, exports);
|
|
5
|
+
});
|
|
6
|
+
//# sourceMappingURL=DialogTrigger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialogTrigger.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-dialog/src/DialogTrigger.ts"],"names":[],"mappings":";;;IAAA,uCAAiD","sourcesContent":["export * from './components/DialogTrigger/index';\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
define(["require", "exports", "react", "./useDialog", "./renderDialog", "./useDialogContextValues"], function (require, exports, React, useDialog_1, renderDialog_1, useDialogContextValues_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Dialog = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* The `Dialog` root level component serves as an interface for interaction with all possible behaviors exposed.
|
|
7
|
+
* It provides context down the hierarchy to `children` compound components to allow functionality.
|
|
8
|
+
* This component expects to receive as children either a `DialogSurface` or a `DialogTrigger`
|
|
9
|
+
* and a `DialogSurface` (or some component that will eventually render one of those compound components)
|
|
10
|
+
* in this specific order
|
|
11
|
+
*/
|
|
12
|
+
exports.Dialog = React.memo(function (props) {
|
|
13
|
+
var state = useDialog_1.useDialog_unstable(props);
|
|
14
|
+
var contextValues = useDialogContextValues_1.useDialogContextValues_unstable(state);
|
|
15
|
+
return renderDialog_1.renderDialog_unstable(state, contextValues);
|
|
16
|
+
});
|
|
17
|
+
exports.Dialog.displayName = 'Dialog';
|
|
18
|
+
});
|
|
19
|
+
//# sourceMappingURL=Dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-dialog/src/components/Dialog/Dialog.tsx"],"names":[],"mappings":";;;;IAMA;;;;;;OAMG;IACU,QAAA,MAAM,GAA0B,KAAK,CAAC,IAAI,CAAC,UAAA,KAAK;QAC3D,IAAM,KAAK,GAAG,8BAAkB,CAAC,KAAK,CAAC,CAAC;QACxC,IAAM,aAAa,GAAG,wDAA+B,CAAC,KAAK,CAAC,CAAC;QAE7D,OAAO,oCAAqB,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;IAEH,cAAM,CAAC,WAAW,GAAG,QAAQ,CAAC","sourcesContent":["import * as React from 'react';\nimport { useDialog_unstable } from './useDialog';\nimport { renderDialog_unstable } from './renderDialog';\nimport type { DialogProps } from './Dialog.types';\nimport { useDialogContextValues_unstable } from './useDialogContextValues';\n\n/**\n * The `Dialog` root level component serves as an interface for interaction with all possible behaviors exposed.\n * It provides context down the hierarchy to `children` compound components to allow functionality.\n * This component expects to receive as children either a `DialogSurface` or a `DialogTrigger`\n * and a `DialogSurface` (or some component that will eventually render one of those compound components)\n * in this specific order\n */\nexport const Dialog: React.FC<DialogProps> = React.memo(props => {\n const state = useDialog_unstable(props);\n const contextValues = useDialogContextValues_unstable(state);\n\n return renderDialog_unstable(state, contextValues);\n});\n\nDialog.displayName = 'Dialog';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dialog.types.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-dialog/src/components/Dialog/Dialog.types.ts"],"names":[],"mappings":"","sourcesContent":["import type * as React from 'react';\nimport type { ComponentProps, ComponentState } from '@fluentui/react-utilities';\nimport type { DialogContextValue, DialogSurfaceContextValue } from '../../contexts';\nimport type { DialogSurfaceElement } from '../DialogSurface/DialogSurface.types';\n\nexport type DialogSlots = {};\n\nexport type DialogOpenChangeEvent = DialogOpenChangeData['event'];\n\nexport type DialogOpenChangeData =\n | {\n type: 'escapeKeyDown';\n open: boolean;\n event: React.KeyboardEvent<DialogSurfaceElement>;\n }\n | {\n type: 'backdropClick';\n open: boolean;\n event: React.MouseEvent<DialogSurfaceElement>;\n }\n | {\n type: 'triggerClick';\n open: boolean;\n event: React.MouseEvent<DialogSurfaceElement>;\n };\n\nexport type DialogModalType = 'modal' | 'non-modal' | 'alert';\n\n/**\n * Callback fired when the component changes value from open state.\n *\n * @param event - a React's Synthetic event or a KeyboardEvent in case of `documentEscapeKeyDown`\n * @param data - A data object with relevant information,\n * such as open value and type of interaction that created the event\n */\nexport type DialogOpenChangeEventHandler = (event: DialogOpenChangeEvent, data: DialogOpenChangeData) => void;\n\nexport type DialogContextValues = {\n dialog: DialogContextValue;\n /**\n * dialogSurface context is provided by Dialog as false\n * to ensure components inside Dialog but outside DialogSurface will consume this as false\n */\n dialogSurface: DialogSurfaceContextValue;\n};\n\nexport type DialogProps = ComponentProps<Partial<DialogSlots>> & {\n /**\n * Dialog variations.\n *\n * `modal`: When this type of dialog is open, the rest of the page is dimmed out and cannot be interacted with.\n * The tab sequence is kept within the dialog and moving the focus outside\n * the dialog will imply closing it. This is the default type of the component.\n *\n * `non-modal`: When a non-modal dialog is open, the rest of the page is not dimmed out\n * and users can interact with the rest of the page.\n * This also implies that the tab focus can move outside the dialog when it reaches the last focusable element.\n *\n * `alert`: is a special type of modal dialogs that interrupts the user's workflow\n * to communicate an important message or ask for a decision.\n * Unlike a typical modal dialog, the user must take an action through the options given to dismiss the dialog,\n * and it cannot be dismissed through the dimmed background or escape key.\n *\n * @default modal\n */\n modalType?: DialogModalType;\n /**\n * Controls the open state of the dialog\n * @default false\n */\n open?: boolean;\n /**\n * Default value for the uncontrolled open state of the dialog.\n * @default false\n */\n defaultOpen?: boolean;\n /**\n * Callback fired when the component changes value from open state.\n *\n * @param event - a React's Synthetic event or a KeyboardEvent in case of `documentEscapeKeyDown`\n * @param data - A data object with relevant information,\n * such as open value and type of interaction that created the event\n */\n onOpenChange?: DialogOpenChangeEventHandler;\n /**\n * Can contain two children including {@link DialogTrigger} and {@link DialogSurface}.\n * Alternatively can only contain {@link DialogSurface} if using trigger outside dialog, or controlling state.\n */\n children: [JSX.Element, JSX.Element] | JSX.Element;\n};\n\nexport type DialogState = ComponentState<DialogSlots> &\n DialogContextValue & {\n content: React.ReactNode;\n trigger: React.ReactNode;\n };\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
define(["require", "exports", "tslib", "./Dialog", "./Dialog.types", "./renderDialog", "./useDialog"], function (require, exports, tslib_1, Dialog_1, Dialog_types_1, renderDialog_1, useDialog_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
tslib_1.__exportStar(Dialog_1, exports);
|
|
5
|
+
tslib_1.__exportStar(Dialog_types_1, exports);
|
|
6
|
+
tslib_1.__exportStar(renderDialog_1, exports);
|
|
7
|
+
tslib_1.__exportStar(useDialog_1, exports);
|
|
8
|
+
});
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-dialog/src/components/Dialog/index.ts"],"names":[],"mappings":";;;IAAA,wCAAyB;IACzB,8CAA+B;IAC/B,8CAA+B;IAC/B,2CAA4B","sourcesContent":["export * from './Dialog';\nexport * from './Dialog.types';\nexport * from './renderDialog';\nexport * from './useDialog';\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
define(["require", "exports", "react", "../../contexts"], function (require, exports, React, contexts_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.renderDialog_unstable = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* Render the final JSX of Dialog
|
|
7
|
+
*/
|
|
8
|
+
var renderDialog_unstable = function (state, contextValues) {
|
|
9
|
+
var content = state.content, trigger = state.trigger;
|
|
10
|
+
return (React.createElement(contexts_1.DialogProvider, { value: contextValues.dialog },
|
|
11
|
+
React.createElement(contexts_1.DialogSurfaceProvider, { value: contextValues.dialogSurface },
|
|
12
|
+
trigger,
|
|
13
|
+
content)));
|
|
14
|
+
};
|
|
15
|
+
exports.renderDialog_unstable = renderDialog_unstable;
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=renderDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderDialog.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-dialog/src/components/Dialog/renderDialog.tsx"],"names":[],"mappings":";;;;IAIA;;OAEG;IACI,IAAM,qBAAqB,GAAG,UAAC,KAAkB,EAAE,aAAkC;QAClF,IAAA,OAAO,GAAc,KAAK,QAAnB,EAAE,OAAO,GAAK,KAAK,QAAV,CAAW;QAEnC,OAAO,CACL,oBAAC,yBAAc,IAAC,KAAK,EAAE,aAAa,CAAC,MAAM;YACzC,oBAAC,gCAAqB,IAAC,KAAK,EAAE,aAAa,CAAC,aAAa;gBACtD,OAAO;gBACP,OAAO,CACc,CACT,CAClB,CAAC;IACJ,CAAC,CAAC;IAXW,QAAA,qBAAqB,yBAWhC","sourcesContent":["import * as React from 'react';\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"]}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
define(["require", "exports", "react", "@fluentui/react-utilities", "@fluentui/react-context-selector", "../../utils", "../../contexts"], function (require, exports, React, react_utilities_1, react_context_selector_1, utils_1, contexts_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.useDialog_unstable = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* Create the state required to render Dialog.
|
|
7
|
+
*
|
|
8
|
+
* The returned state can be modified with hooks such as useDialogStyles_unstable,
|
|
9
|
+
* before being passed to renderDialog_unstable.
|
|
10
|
+
*
|
|
11
|
+
* @param props - props from this instance of Dialog
|
|
12
|
+
*/
|
|
13
|
+
var useDialog_unstable = function (props) {
|
|
14
|
+
var children = props.children, _a = props.modalType, modalType = _a === void 0 ? 'modal' : _a, onOpenChange = props.onOpenChange;
|
|
15
|
+
var _b = childrenToTriggerAndContent(children), trigger = _b[0], content = _b[1];
|
|
16
|
+
var _c = react_utilities_1.useControllableState({
|
|
17
|
+
state: props.open,
|
|
18
|
+
defaultState: props.defaultOpen,
|
|
19
|
+
initialState: false,
|
|
20
|
+
}), open = _c[0], setOpen = _c[1];
|
|
21
|
+
var requestOpenChange = react_utilities_1.useEventCallback(function (data) {
|
|
22
|
+
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(data.event, data);
|
|
23
|
+
// if user prevents default then do not change state value
|
|
24
|
+
// otherwise updates state value and trigger reference to the element that caused the opening
|
|
25
|
+
if (!data.event.isDefaultPrevented()) {
|
|
26
|
+
setOpen(data.open);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
var focusRef = utils_1.useFocusFirstElement(open, modalType);
|
|
30
|
+
var disableBodyScroll = utils_1.useDisableBodyScroll();
|
|
31
|
+
var isBodyScrollLocked = Boolean(open && modalType !== 'non-modal');
|
|
32
|
+
react_utilities_1.useIsomorphicLayoutEffect(function () {
|
|
33
|
+
if (isBodyScrollLocked) {
|
|
34
|
+
return disableBodyScroll();
|
|
35
|
+
}
|
|
36
|
+
}, [disableBodyScroll, isBodyScrollLocked]);
|
|
37
|
+
return {
|
|
38
|
+
components: {
|
|
39
|
+
backdrop: 'div',
|
|
40
|
+
},
|
|
41
|
+
open: open,
|
|
42
|
+
modalType: modalType,
|
|
43
|
+
content: open ? content : null,
|
|
44
|
+
trigger: trigger,
|
|
45
|
+
requestOpenChange: requestOpenChange,
|
|
46
|
+
dialogTitleId: react_utilities_1.useId('dialog-title-'),
|
|
47
|
+
isNestedDialog: react_context_selector_1.useHasParentContext(contexts_1.DialogContext),
|
|
48
|
+
dialogRef: focusRef,
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
exports.useDialog_unstable = useDialog_unstable;
|
|
52
|
+
/**
|
|
53
|
+
* Extracts trigger and content from children
|
|
54
|
+
*/
|
|
55
|
+
function childrenToTriggerAndContent(children) {
|
|
56
|
+
var childrenArray = React.Children.toArray(children);
|
|
57
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
58
|
+
if (childrenArray.length !== 1 && childrenArray.length !== 2) {
|
|
59
|
+
// eslint-disable-next-line no-console
|
|
60
|
+
console.warn('Dialog must contain at least one child <DialogSurface/>,\n' +
|
|
61
|
+
'and at most two children <DialogTrigger/> <DialogSurface/> (in this order)');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
switch (childrenArray.length) {
|
|
65
|
+
// case where there's a trigger followed by content
|
|
66
|
+
case 2:
|
|
67
|
+
return childrenArray;
|
|
68
|
+
// case where there's only content
|
|
69
|
+
case 1:
|
|
70
|
+
return [undefined, childrenArray[0]];
|
|
71
|
+
// unknown case
|
|
72
|
+
default:
|
|
73
|
+
return [undefined, undefined];
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
//# sourceMappingURL=useDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDialog.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-dialog/src/components/Dialog/useDialog.ts"],"names":[],"mappings":";;;;IAQA;;;;;;;OAOG;IACI,IAAM,kBAAkB,GAAG,UAAC,KAAkB;QAC3C,IAAA,QAAQ,GAAwC,KAAK,SAA7C,EAAE,KAAsC,KAAK,UAAxB,EAAnB,SAAS,mBAAG,OAAO,KAAA,EAAE,YAAY,GAAK,KAAK,aAAV,CAAW;QAExD,IAAA,KAAqB,2BAA2B,CAAC,QAAQ,CAAC,EAAzD,OAAO,QAAA,EAAE,OAAO,QAAyC,CAAC;QAE3D,IAAA,KAAkB,sCAAoB,CAAC;YAC3C,KAAK,EAAE,KAAK,CAAC,IAAI;YACjB,YAAY,EAAE,KAAK,CAAC,WAAW;YAC/B,YAAY,EAAE,KAAK;SACpB,CAAC,EAJK,IAAI,QAAA,EAAE,OAAO,QAIlB,CAAC;QAEH,IAAM,iBAAiB,GAAG,kCAAgB,CAAC,UAAC,IAA0B;YACpE,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAG,IAA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AsC;gBACtC,OAAO,CAAC,IAAI,CACV,4DAA4D;oBAC1D,4EAA4E,CAC/E,CAAC;aACH;SACF;QACD,QAAQ,aAAa,CAAC,MAAM,EAAE;YAC5B,mDAAmD;YACnD,KAAK,CAAC;gBACJ,OAAO,aAAqE,CAAC;YAC/E,kCAAkC;YAClC,KAAK,CAAC;gBACJ,OAAO,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;YACvC,eAAe;YACf;gBACE,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;SACjC;IACH,CAAC","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';\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 } = 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 return {\n components: {\n backdrop: 'div',\n },\n open,\n modalType,\n content: open ? content : null,\n trigger,\n requestOpenChange,\n dialogTitleId: useId('dialog-title-'),\n isNestedDialog: useHasParentContext(DialogContext),\n dialogRef: focusRef,\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(\n 'Dialog must contain at least one child <DialogSurface/>,\\n' +\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"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
define(["require", "exports"], function (require, exports) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.useDialogContextValues_unstable = void 0;
|
|
5
|
+
function useDialogContextValues_unstable(state) {
|
|
6
|
+
var modalType = state.modalType, open = state.open, dialogRef = state.dialogRef, dialogTitleId = state.dialogTitleId, isNestedDialog = state.isNestedDialog, requestOpenChange = state.requestOpenChange;
|
|
7
|
+
/**
|
|
8
|
+
* This context is created with "@fluentui/react-context-selector",
|
|
9
|
+
* there is no sense to memoize it
|
|
10
|
+
*/
|
|
11
|
+
var dialog = {
|
|
12
|
+
open: open,
|
|
13
|
+
modalType: modalType,
|
|
14
|
+
dialogRef: dialogRef,
|
|
15
|
+
dialogTitleId: dialogTitleId,
|
|
16
|
+
isNestedDialog: isNestedDialog,
|
|
17
|
+
requestOpenChange: requestOpenChange,
|
|
18
|
+
};
|
|
19
|
+
var dialogSurface = false;
|
|
20
|
+
return { dialog: dialog, dialogSurface: dialogSurface };
|
|
21
|
+
}
|
|
22
|
+
exports.useDialogContextValues_unstable = useDialogContextValues_unstable;
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=useDialogContextValues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDialogContextValues.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-dialog/src/components/Dialog/useDialogContextValues.ts"],"names":[],"mappings":";;;;IAGA,SAAgB,+BAA+B,CAAC,KAAkB;QACxD,IAAA,SAAS,GAAwE,KAAK,UAA7E,EAAE,IAAI,GAAkE,KAAK,KAAvE,EAAE,SAAS,GAAuD,KAAK,UAA5D,EAAE,aAAa,GAAwC,KAAK,cAA7C,EAAE,cAAc,GAAwB,KAAK,eAA7B,EAAE,iBAAiB,GAAK,KAAK,kBAAV,CAAW;QAE/F;;;WAGG;QACH,IAAM,MAAM,GAAuB;YACjC,IAAI,MAAA;YACJ,SAAS,WAAA;YACT,SAAS,WAAA;YACT,aAAa,eAAA;YACb,cAAc,gBAAA;YACd,iBAAiB,mBAAA;SAClB,CAAC;QAEF,IAAM,aAAa,GAA8B,KAAK,CAAC;QAEvD,OAAO,EAAE,MAAM,QAAA,EAAE,aAAa,eAAA,EAAE,CAAC;IACnC,CAAC;IAnBD,0EAmBC","sourcesContent":["import type { DialogContextValue, DialogSurfaceContextValue } from '../../contexts';\nimport type { DialogContextValues, DialogState } from './Dialog.types';\n\nexport function useDialogContextValues_unstable(state: DialogState): DialogContextValues {\n const { modalType, open, dialogRef, dialogTitleId, isNestedDialog, requestOpenChange } = state;\n\n /**\n * This context is created with \"@fluentui/react-context-selector\",\n * there is no sense to memoize it\n */\n const dialog: DialogContextValue = {\n open,\n modalType,\n dialogRef,\n dialogTitleId,\n isNestedDialog,\n requestOpenChange,\n };\n\n const dialogSurface: DialogSurfaceContextValue = false;\n\n return { dialog, dialogSurface };\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
define(["require", "exports", "react", "./useDialogActions", "./renderDialogActions", "./useDialogActionsStyles"], function (require, exports, React, useDialogActions_1, renderDialogActions_1, useDialogActionsStyles_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.DialogActions = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* `DialogActions` is a container for the actions of the dialog.
|
|
7
|
+
* Apart from styling, this component does not have other behavior.
|
|
8
|
+
*/
|
|
9
|
+
exports.DialogActions = React.forwardRef(function (props, ref) {
|
|
10
|
+
var state = useDialogActions_1.useDialogActions_unstable(props, ref);
|
|
11
|
+
useDialogActionsStyles_1.useDialogActionsStyles_unstable(state);
|
|
12
|
+
return renderDialogActions_1.renderDialogActions_unstable(state);
|
|
13
|
+
});
|
|
14
|
+
exports.DialogActions.displayName = 'DialogActions';
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=DialogActions.js.map
|