@fluentui/react-dialog 9.5.2 → 9.5.3
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 +34 -1
- package/CHANGELOG.md +14 -2
- package/dist/index.d.ts +5 -3
- package/lib/components/Dialog/useDialog.js +11 -1
- package/lib/components/Dialog/useDialog.js.map +1 -1
- package/lib/components/Dialog/useDialogContextValues.js +5 -1
- package/lib/components/Dialog/useDialogContextValues.js.map +1 -1
- package/lib/components/DialogSurface/useDialogSurface.js +1 -8
- package/lib/components/DialogSurface/useDialogSurface.js.map +1 -1
- package/lib/components/DialogTitle/DialogTitle.types.js.map +1 -1
- package/lib/components/DialogTitle/useDialogTitle.js +2 -2
- package/lib/components/DialogTitle/useDialogTitle.js.map +1 -1
- package/lib/components/DialogTitle/useDialogTitleStyles.js +6 -2
- package/lib/components/DialogTitle/useDialogTitleStyles.js.map +1 -1
- package/lib/components/DialogTrigger/useDialogTrigger.js +1 -4
- package/lib/components/DialogTrigger/useDialogTrigger.js.map +1 -1
- package/lib/contexts/dialogContext.js.map +1 -1
- package/lib-commonjs/components/Dialog/useDialog.js +8 -1
- package/lib-commonjs/components/Dialog/useDialog.js.map +1 -1
- package/lib-commonjs/components/Dialog/useDialogContextValues.js +3 -1
- package/lib-commonjs/components/Dialog/useDialogContextValues.js.map +1 -1
- package/lib-commonjs/components/DialogSurface/useDialogSurface.js +1 -6
- package/lib-commonjs/components/DialogSurface/useDialogSurface.js.map +1 -1
- package/lib-commonjs/components/DialogTitle/useDialogTitle.js +2 -2
- package/lib-commonjs/components/DialogTitle/useDialogTitle.js.map +1 -1
- package/lib-commonjs/components/DialogTitle/useDialogTitleStyles.js +15 -1
- package/lib-commonjs/components/DialogTitle/useDialogTitleStyles.js.map +1 -1
- package/lib-commonjs/components/DialogTrigger/useDialogTrigger.js +1 -2
- package/lib-commonjs/components/DialogTrigger/useDialogTrigger.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,40 @@
|
|
|
2
2
|
"name": "@fluentui/react-dialog",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "Mon,
|
|
5
|
+
"date": "Mon, 24 Apr 2023 08:09:10 GMT",
|
|
6
|
+
"tag": "@fluentui/react-dialog_v9.5.3",
|
|
7
|
+
"version": "9.5.3",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "bernardo.sunderhus@gmail.com",
|
|
12
|
+
"package": "@fluentui/react-dialog",
|
|
13
|
+
"commit": "b287dc6426477a8ec03b6a845ea0ee3ba0bfb726",
|
|
14
|
+
"comment": "bugfix: DialogTitle root as h2 by default"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "bernardo.sunderhus@gmail.com",
|
|
18
|
+
"package": "@fluentui/react-dialog",
|
|
19
|
+
"commit": "85c36e249b33b0bad79be4edd1a943dfc5233b11",
|
|
20
|
+
"comment": "bugfix: remove caret from react-jsx-runtime prerelease dependency"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "bernardo.sunderhus@gmail.com",
|
|
24
|
+
"package": "@fluentui/react-dialog",
|
|
25
|
+
"commit": "1227882a7a3813f21c45df6eb27aa65a89a5c45c",
|
|
26
|
+
"comment": "chore: hoist tabster modal attributes to Dialog component"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"author": "beachball",
|
|
30
|
+
"package": "@fluentui/react-dialog",
|
|
31
|
+
"comment": "Bump @fluentui/react-jsx-runtime to v9.0.0-alpha.2",
|
|
32
|
+
"commit": "948b5bf9871303d1742f1b9a17a3bd4006ce2fea"
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"date": "Mon, 17 Apr 2023 17:53:49 GMT",
|
|
6
39
|
"tag": "@fluentui/react-dialog_v9.5.2",
|
|
7
40
|
"version": "9.5.2",
|
|
8
41
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-dialog
|
|
2
2
|
|
|
3
|
-
This log was last generated on Mon,
|
|
3
|
+
This log was last generated on Mon, 24 Apr 2023 08:09:10 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.5.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-dialog_v9.5.3)
|
|
8
|
+
|
|
9
|
+
Mon, 24 Apr 2023 08:09:10 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-dialog_v9.5.2..@fluentui/react-dialog_v9.5.3)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- bugfix: DialogTitle root as h2 by default ([PR #27555](https://github.com/microsoft/fluentui/pull/27555) by bernardo.sunderhus@gmail.com)
|
|
15
|
+
- bugfix: remove caret from react-jsx-runtime prerelease dependency ([PR #27588](https://github.com/microsoft/fluentui/pull/27588) by bernardo.sunderhus@gmail.com)
|
|
16
|
+
- chore: hoist tabster modal attributes to Dialog component ([PR #27541](https://github.com/microsoft/fluentui/pull/27541) by bernardo.sunderhus@gmail.com)
|
|
17
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.0-alpha.2 ([PR #27632](https://github.com/microsoft/fluentui/pull/27632) by beachball)
|
|
18
|
+
|
|
7
19
|
## [9.5.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-dialog_v9.5.2)
|
|
8
20
|
|
|
9
|
-
Mon, 17 Apr 2023 17:
|
|
21
|
+
Mon, 17 Apr 2023 17:53:49 GMT
|
|
10
22
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-dialog_v9.5.1..@fluentui/react-dialog_v9.5.2)
|
|
11
23
|
|
|
12
24
|
### Patches
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { ReactElement } from 'react';
|
|
|
11
11
|
import type { Slot } from '@fluentui/react-utilities';
|
|
12
12
|
import type { SlotClassNames } from '@fluentui/react-utilities';
|
|
13
13
|
import type { TriggerProps } from '@fluentui/react-utilities';
|
|
14
|
+
import { useModalAttributes } from '@fluentui/react-tabster';
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* The `Dialog` root level component serves as an interface for interaction with all possible behaviors exposed.
|
|
@@ -111,7 +112,7 @@ declare type DialogContextValue = {
|
|
|
111
112
|
* Requests dialog main component to update it's internal open state
|
|
112
113
|
*/
|
|
113
114
|
requestOpenChange: (data: DialogOpenChangeData) => void;
|
|
114
|
-
}
|
|
115
|
+
} & Partial<ReturnType<typeof useModalAttributes>>;
|
|
115
116
|
|
|
116
117
|
declare type DialogContextValues = {
|
|
117
118
|
dialog: DialogContextValue;
|
|
@@ -264,9 +265,10 @@ export declare type DialogTitleProps = ComponentProps<DialogTitleSlots>;
|
|
|
264
265
|
|
|
265
266
|
export declare type DialogTitleSlots = {
|
|
266
267
|
/**
|
|
267
|
-
* By default this is a
|
|
268
|
+
* By default this is a h2, but can be any heading or div,
|
|
269
|
+
* if `div` is provided do not forget to also provide proper `role="heading"` and `aria-level` attributes
|
|
268
270
|
*/
|
|
269
|
-
root: Slot<'
|
|
271
|
+
root: Slot<'h2', 'h1' | 'h3' | 'h4' | 'h5' | 'h6' | 'div'>;
|
|
270
272
|
/**
|
|
271
273
|
* By default a Dialog with modalType='non-modal' will have a close button action
|
|
272
274
|
*/
|
|
@@ -3,6 +3,7 @@ import { useControllableState, useEventCallback, useId, useIsomorphicLayoutEffec
|
|
|
3
3
|
import { useHasParentContext } from '@fluentui/react-context-selector';
|
|
4
4
|
import { useDisableBodyScroll, useFocusFirstElement } from '../../utils';
|
|
5
5
|
import { DialogContext } from '../../contexts';
|
|
6
|
+
import { useModalAttributes } from '@fluentui/react-tabster';
|
|
6
7
|
/**
|
|
7
8
|
* Create the state required to render Dialog.
|
|
8
9
|
*
|
|
@@ -40,6 +41,13 @@ export const useDialog_unstable = props => {
|
|
|
40
41
|
return disableBodyScroll();
|
|
41
42
|
}
|
|
42
43
|
}, [disableBodyScroll, isBodyScrollLocked]);
|
|
44
|
+
const {
|
|
45
|
+
modalAttributes,
|
|
46
|
+
triggerAttributes
|
|
47
|
+
} = useModalAttributes({
|
|
48
|
+
trapFocus: modalType !== 'non-modal',
|
|
49
|
+
legacyTrapFocus: !inertTrapFocus
|
|
50
|
+
});
|
|
43
51
|
return {
|
|
44
52
|
components: {
|
|
45
53
|
backdrop: 'div'
|
|
@@ -52,7 +60,9 @@ export const useDialog_unstable = props => {
|
|
|
52
60
|
requestOpenChange,
|
|
53
61
|
dialogTitleId: useId('dialog-title-'),
|
|
54
62
|
isNestedDialog: useHasParentContext(DialogContext),
|
|
55
|
-
dialogRef: focusRef
|
|
63
|
+
dialogRef: focusRef,
|
|
64
|
+
modalAttributes: modalType !== 'non-modal' ? modalAttributes : undefined,
|
|
65
|
+
triggerAttributes
|
|
56
66
|
};
|
|
57
67
|
};
|
|
58
68
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useControllableState","useEventCallback","useId","useIsomorphicLayoutEffect","useHasParentContext","useDisableBodyScroll","useFocusFirstElement","DialogContext","useDialog_unstable","props","children","modalType","onOpenChange","inertTrapFocus","trigger","content","childrenToTriggerAndContent","open","setOpen","state","defaultState","defaultOpen","initialState","requestOpenChange","data","event","isDefaultPrevented","focusRef","disableBodyScroll","isBodyScrollLocked","Boolean","components","backdrop","dialogTitleId","isNestedDialog","dialogRef","childrenArray","Children","toArray","process","env","NODE_ENV","length","console","warn"
|
|
1
|
+
{"version":3,"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"],"sources":["../../../src/components/Dialog/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: open ? content : null,\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(\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"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,oBAAoB,EAAEC,gBAAgB,EAAEC,KAAK,EAAEC,yBAAyB,QAAQ;AACzF,SAASC,mBAAmB,QAAQ;AACpC,SAASC,oBAAoB,EAAEC,oBAAoB,QAAQ;AAC3D,SAASC,aAAa,QAAQ;AAG9B,SAASC,kBAAkB,QAAQ;AAEnC;;;;;;;;AAQA,OAAO,MAAMC,kBAAA,GAAsBC,KAAA,IAAoC;EACrE,MAAM;IAAEC,QAAA;IAAUC,SAAA,GAAY;IAASC,YAAA;IAAcC,cAAA,GAAiB;EAAK,CAAE,GAAGJ,KAAA;EAEhF,MAAM,CAACK,OAAA,EAASC,OAAA,CAAQ,GAAGC,2BAAA,CAA4BN,QAAA;EAEvD,MAAM,CAACO,IAAA,EAAMC,OAAA,CAAQ,GAAGnB,oBAAA,CAAqB;IAC3CoB,KAAA,EAAOV,KA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AQ,CAACC,OAAO,CAACjC,QAAA;EAC7C,IAAIkC,OAAA,CAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;IACzC,IAAIL,aAAA,CAAcM,MAAM,KAAK,KAAKN,aAAA,CAAcM,MAAM,KAAK,GAAG;MAC5D;MACAC,OAAA,CAAQC,IAAI,CACV,+DACE;IAEN;EACF;EACA,QAAQR,aAAA,CAAcM,MAAM;IAC1B;IACA,KAAK;MACH,OAAON,aAAA;IACT;IACA,KAAK;MACH,OAAO,CAACD,SAAA,EAAWC,aAAa,CAAC,EAAE,CAAC;IACtC;IACA;MACE,OAAO,CAACD,SAAA,EAAWA,SAAA,CAAU;EAAA;AAEnC"}
|
|
@@ -6,7 +6,9 @@ export function useDialogContextValues_unstable(state) {
|
|
|
6
6
|
dialogTitleId,
|
|
7
7
|
isNestedDialog,
|
|
8
8
|
inertTrapFocus,
|
|
9
|
-
requestOpenChange
|
|
9
|
+
requestOpenChange,
|
|
10
|
+
modalAttributes,
|
|
11
|
+
triggerAttributes
|
|
10
12
|
} = state;
|
|
11
13
|
/**
|
|
12
14
|
* This context is created with "@fluentui/react-context-selector",
|
|
@@ -19,6 +21,8 @@ export function useDialogContextValues_unstable(state) {
|
|
|
19
21
|
dialogTitleId,
|
|
20
22
|
isNestedDialog,
|
|
21
23
|
inertTrapFocus,
|
|
24
|
+
modalAttributes,
|
|
25
|
+
triggerAttributes,
|
|
22
26
|
requestOpenChange
|
|
23
27
|
};
|
|
24
28
|
const dialogSurface = false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useDialogContextValues_unstable","state","modalType","open","dialogRef","dialogTitleId","isNestedDialog","inertTrapFocus","requestOpenChange","dialog","dialogSurface"],"sources":["../../../src/components/Dialog/useDialogContextValues.ts"],"sourcesContent":["import type { DialogContextValue, DialogSurfaceContextValue } from '../../contexts';\nimport type { DialogContextValues, DialogState } from './Dialog.types';\n\nexport function useDialogContextValues_unstable(state: DialogState): DialogContextValues {\n const {
|
|
1
|
+
{"version":3,"names":["useDialogContextValues_unstable","state","modalType","open","dialogRef","dialogTitleId","isNestedDialog","inertTrapFocus","requestOpenChange","modalAttributes","triggerAttributes","dialog","dialogSurface"],"sources":["../../../src/components/Dialog/useDialogContextValues.ts"],"sourcesContent":["import type { DialogContextValue, DialogSurfaceContextValue } from '../../contexts';\nimport type { DialogContextValues, DialogState } from './Dialog.types';\n\nexport function useDialogContextValues_unstable(state: DialogState): DialogContextValues {\n const {\n modalType,\n open,\n dialogRef,\n dialogTitleId,\n isNestedDialog,\n inertTrapFocus,\n requestOpenChange,\n modalAttributes,\n triggerAttributes,\n } = 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 inertTrapFocus,\n modalAttributes,\n triggerAttributes,\n requestOpenChange,\n };\n\n const dialogSurface: DialogSurfaceContextValue = false;\n\n return { dialog, dialogSurface };\n}\n"],"mappings":"AAGA,OAAO,SAASA,gCAAgCC,KAAkB,EAAuB;EACvF,MAAM;IACJC,SAAA;IACAC,IAAA;IACAC,SAAA;IACAC,aAAA;IACAC,cAAA;IACAC,cAAA;IACAC,iBAAA;IACAC,eAAA;IACAC;EAAiB,CAClB,GAAGT,KAAA;EAEJ;;;;EAIA,MAAMU,MAAA,GAA6B;IACjCR,IAAA;IACAD,SAAA;IACAE,SAAA;IACAC,aAAA;IACAC,cAAA;IACAC,cAAA;IACAE,eAAA;IACAC,iBAAA;IACAF;EACF;EAEA,MAAMI,aAAA,GAA2C,KAAK;EAEtD,OAAO;IAAED,MAAA;IAAQC;EAAc;AACjC"}
|
|
@@ -2,7 +2,6 @@ import * as React from 'react';
|
|
|
2
2
|
import { getNativeElementProps, resolveShorthand, useEventCallback, useMergedRefs, isResolvedShorthand } from '@fluentui/react-utilities';
|
|
3
3
|
import { useDialogContext_unstable } from '../../contexts';
|
|
4
4
|
import { isEscapeKeyDismiss } from '../../utils';
|
|
5
|
-
import { useModalAttributes } from '@fluentui/react-tabster';
|
|
6
5
|
/**
|
|
7
6
|
* Create the state required to render DialogSurface.
|
|
8
7
|
*
|
|
@@ -18,7 +17,7 @@ export const useDialogSurface_unstable = (props, ref) => {
|
|
|
18
17
|
as
|
|
19
18
|
} = props;
|
|
20
19
|
const modalType = useDialogContext_unstable(ctx => ctx.modalType);
|
|
21
|
-
const
|
|
20
|
+
const modalAttributes = useDialogContext_unstable(ctx => ctx.modalAttributes);
|
|
22
21
|
const dialogRef = useDialogContext_unstable(ctx => ctx.dialogRef);
|
|
23
22
|
const open = useDialogContext_unstable(ctx => ctx.open);
|
|
24
23
|
const requestOpenChange = useDialogContext_unstable(ctx => ctx.requestOpenChange);
|
|
@@ -50,12 +49,6 @@ export const useDialogSurface_unstable = (props, ref) => {
|
|
|
50
49
|
event.stopPropagation();
|
|
51
50
|
}
|
|
52
51
|
});
|
|
53
|
-
const {
|
|
54
|
-
modalAttributes
|
|
55
|
-
} = useModalAttributes({
|
|
56
|
-
trapFocus: modalType !== 'non-modal',
|
|
57
|
-
legacyTrapFocus: !inertTrapFocus
|
|
58
|
-
});
|
|
59
52
|
return {
|
|
60
53
|
components: {
|
|
61
54
|
backdrop: 'div',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","getNativeElementProps","resolveShorthand","useEventCallback","useMergedRefs","isResolvedShorthand","useDialogContext_unstable","isEscapeKeyDismiss","
|
|
1
|
+
{"version":3,"names":["React","getNativeElementProps","resolveShorthand","useEventCallback","useMergedRefs","isResolvedShorthand","useDialogContext_unstable","isEscapeKeyDismiss","useDialogSurface_unstable","props","ref","backdrop","as","modalType","ctx","modalAttributes","dialogRef","open","requestOpenChange","dialogTitleID","dialogTitleId","handledBackdropClick","event","_props_backdrop","_props_backdrop_onClick","onClick","call","isDefaultPrevented","type","handleKeyDown","_props_onKeyDown","onKeyDown","stopPropagation","components","root","required","defaultProps","tabIndex","role","undefined"],"sources":["../../../src/components/DialogSurface/useDialogSurface.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n getNativeElementProps,\n resolveShorthand,\n useEventCallback,\n useMergedRefs,\n isResolvedShorthand,\n} from '@fluentui/react-utilities';\nimport type { DialogSurfaceElement, DialogSurfaceProps, DialogSurfaceState } from './DialogSurface.types';\nimport { useDialogContext_unstable } from '../../contexts';\nimport { isEscapeKeyDismiss } from '../../utils';\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 modalAttributes = useDialogContext_unstable(ctx => ctx.modalAttributes);\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<HTMLDivElement>) => {\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 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"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SACEC,qBAAqB,EACrBC,gBAAgB,EAChBC,gBAAgB,EAChBC,aAAa,EACbC,mBAAmB,QACd;AAEP,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,kBAAkB,QAAQ;AAEnC;;;;;;;;;AASA,OAAO,MAAMC,yBAAA,GAA4BA,CACvCC,KAAA,EACAC,GAAA,KACuB;EACvB,MAAM;IAAEC,QAAA;IAAUC;EAAE,CAAE,GAAGH,KAAA;EACzB,MAAMI,SAAA,GAAYP,yBAAA,CAA0BQ,GAAA,IAAOA,GAAA,CAAID,SAAS;EAChE,MAAME,eAAA,GAAkBT,yBAAA,CAA0BQ,GAAA,IAAOA,GAAA,CAAIC,eAAe;EAC5E,MAAMC,SAAA,GAAYV,yBAAA,CAA0BQ,GAAA,IAAOA,GAAA,CAAIE,SAAS;EAChE,MAAMC,IAAA,GAAOX,yBAAA,CAA0BQ,GAAA,IAAOA,GAAA,CAAIG,IAAI;EACtD,MAAMC,iBAAA,GAAoBZ,yBAAA,CAA0BQ,GAAA,IAAOA,GAAA,CAAII,iBAAiB;EAChF,MAAMC,aAAA,GAAgBb,yBAAA,CAA0BQ,GAAA,IAAOA,GAAA,CAAIM,aAAa;EAExE,MAAMC,oBAAA,GAAuBlB,gBAAA,CAAkBmB,KAAA,IAA4C;IACzF,IAAIjB,mBAAA,CAAoBI,KAAA,CAAME,QAAQ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MACR,GAAGM,eAAe;MAClBgB,SAAA,EAAWF,aAAA;MACXnB,GAAA,EAAKN,aAAA,CAAcM,GAAA,EAAKM,SAAA;IAC1B;EACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../../src/components/DialogTitle/DialogTitle.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type DialogTitleSlots = {\n /**\n * By default this is a
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/components/DialogTitle/DialogTitle.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type DialogTitleSlots = {\n /**\n * By default this is a h2, but can be any heading or div,\n * if `div` is provided do not forget to also provide proper `role=\"heading\"` and `aria-level` attributes\n */\n root: Slot<'h2', 'h1' | 'h3' | 'h4' | 'h5' | 'h6' | 'div'>;\n /**\n * By default a Dialog with modalType='non-modal' will have a close button action\n */\n action?: Slot<'div'>;\n};\n\n/**\n * DialogTitle Props\n */\nexport type DialogTitleProps = ComponentProps<DialogTitleSlots>;\n\n/**\n * State used in rendering DialogTitle\n */\nexport type DialogTitleState = ComponentState<DialogTitleSlots>;\n"],"mappings":"AAAA"}
|
|
@@ -23,10 +23,10 @@ export const useDialogTitle_unstable = (props, ref) => {
|
|
|
23
23
|
const internalStyles = useDialogTitleInternalStyles();
|
|
24
24
|
return {
|
|
25
25
|
components: {
|
|
26
|
-
root: '
|
|
26
|
+
root: 'h2',
|
|
27
27
|
action: 'div'
|
|
28
28
|
},
|
|
29
|
-
root: getNativeElementProps(as !== null && as !== void 0 ? as : '
|
|
29
|
+
root: getNativeElementProps(as !== null && as !== void 0 ? as : 'h2', {
|
|
30
30
|
ref,
|
|
31
31
|
id: useDialogContext_unstable(ctx => ctx.dialogTitleId),
|
|
32
32
|
...props
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","getNativeElementProps","useDialogContext_unstable","Dismiss24Regular","resolveShorthand","DialogTrigger","useDialogTitleInternalStyles","useDialogTitle_unstable","props","ref","as","action","modalType","ctx","internalStyles","components","root","id","dialogTitleId","required","defaultProps","children","createElement","disableButtonEnhancement","type","className","button"],"sources":["../../../src/components/DialogTitle/useDialogTitle.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps } from '@fluentui/react-utilities';\nimport type { DialogTitleProps, DialogTitleState } from './DialogTitle.types';\nimport { useDialogContext_unstable } from '../../contexts/dialogContext';\nimport { Dismiss24Regular } from '@fluentui/react-icons';\nimport { resolveShorthand } from '@fluentui/react-utilities';\nimport { DialogTrigger } from '../DialogTrigger/DialogTrigger';\nimport { useDialogTitleInternalStyles } from './useDialogTitleStyles';\n\n/**\n * Create the state required to render DialogTitle.\n *\n * The returned state can be modified with hooks such as useDialogTitleStyles_unstable,\n * before being passed to renderDialogTitle_unstable.\n *\n * @param props - props from this instance of DialogTitle\n * @param ref - reference to root HTMLElement of DialogTitle\n */\nexport const useDialogTitle_unstable = (props: DialogTitleProps, ref: React.Ref<HTMLElement>): DialogTitleState => {\n const { as, action } = props;\n const modalType = useDialogContext_unstable(ctx => ctx.modalType);\n const internalStyles = useDialogTitleInternalStyles();\n\n return {\n components: {\n root: '
|
|
1
|
+
{"version":3,"names":["React","getNativeElementProps","useDialogContext_unstable","Dismiss24Regular","resolveShorthand","DialogTrigger","useDialogTitleInternalStyles","useDialogTitle_unstable","props","ref","as","action","modalType","ctx","internalStyles","components","root","id","dialogTitleId","required","defaultProps","children","createElement","disableButtonEnhancement","type","className","button"],"sources":["../../../src/components/DialogTitle/useDialogTitle.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps } from '@fluentui/react-utilities';\nimport type { DialogTitleProps, DialogTitleState } from './DialogTitle.types';\nimport { useDialogContext_unstable } from '../../contexts/dialogContext';\nimport { Dismiss24Regular } from '@fluentui/react-icons';\nimport { resolveShorthand } from '@fluentui/react-utilities';\nimport { DialogTrigger } from '../DialogTrigger/DialogTrigger';\nimport { useDialogTitleInternalStyles } from './useDialogTitleStyles';\n\n/**\n * Create the state required to render DialogTitle.\n *\n * The returned state can be modified with hooks such as useDialogTitleStyles_unstable,\n * before being passed to renderDialogTitle_unstable.\n *\n * @param props - props from this instance of DialogTitle\n * @param ref - reference to root HTMLElement of DialogTitle\n */\nexport const useDialogTitle_unstable = (props: DialogTitleProps, ref: React.Ref<HTMLElement>): DialogTitleState => {\n const { as, action } = props;\n const modalType = useDialogContext_unstable(ctx => ctx.modalType);\n const internalStyles = useDialogTitleInternalStyles();\n\n return {\n components: {\n root: 'h2',\n action: 'div',\n },\n root: getNativeElementProps(as ?? 'h2', {\n ref,\n id: useDialogContext_unstable(ctx => ctx.dialogTitleId),\n ...props,\n }),\n action: resolveShorthand(action, {\n required: modalType === 'non-modal',\n defaultProps: {\n children: (\n <DialogTrigger disableButtonEnhancement action=\"close\">\n <button\n type=\"button\"\n className={internalStyles.button}\n // TODO: find a better way to add internal labels\n aria-label=\"close\"\n >\n <Dismiss24Regular />\n </button>\n </DialogTrigger>\n ),\n },\n }),\n };\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,qBAAqB,QAAQ;AAEtC,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,gBAAgB,QAAQ;AACjC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,aAAa,QAAQ;AAC9B,SAASC,4BAA4B,QAAQ;AAE7C;;;;;;;;;AASA,OAAO,MAAMC,uBAAA,GAA0BA,CAACC,KAAA,EAAyBC,GAAA,KAAkD;EACjH,MAAM;IAAEC,EAAA;IAAIC;EAAM,CAAE,GAAGH,KAAA;EACvB,MAAMI,SAAA,GAAYV,yBAAA,CAA0BW,GAAA,IAAOA,GAAA,CAAID,SAAS;EAChE,MAAME,cAAA,GAAiBR,4BAAA;EAEvB,OAAO;IACLS,UAAA,EAAY;MACVC,IAAA,EAAM;MACNL,MAAA,EAAQ;IACV;IACAK,IAAA,EAAMf,qBAAA,CAAsBS,EAAA,aAAAA,EAAA,cAAAA,EAAA,GAAM,IAAI,EAAE;MACtCD,GAAA;MACAQ,EAAA,EAAIf,yBAAA,CAA0BW,GAAA,IAAOA,GAAA,CAAIK,aAAa;MACtD,GAAGV;IACL;IACAG,MAAA,EAAQP,gBAAA,CAAiBO,MAAA,EAAQ;MAC/BQ,QAAA,EAAUP,SAAA,KAAc;MACxBQ,YAAA,EAAc;QACZC,QAAA,eACErB,KAAA,CAAAsB,aAAA,CAACjB,aAAA;UAAckB,wBAAA,MAAwB;UAACZ,MAAA,EAAO;wBAC7CX,KAAA,CAAAsB,aAAA,CAAC;UACCE,IAAA,EAAK;UACLC,SAAA,EAAWX,cAAA,CAAeY,MAAM;UAChC;UACA,cAAW;wBAEX1B,KAAA,CAAAsB,aAAA,CAACnB,gBAAA;MAIT;IACF;EACF;AACF"}
|
|
@@ -18,7 +18,11 @@ const useStyles = /*#__PURE__*/__styles({
|
|
|
18
18
|
Ijaq50: "faq1aip",
|
|
19
19
|
Br312pm: "f1m489tg",
|
|
20
20
|
nk6f5a: "fv2srd9",
|
|
21
|
-
Bw0ie65: "f1tz6hh8"
|
|
21
|
+
Bw0ie65: "f1tz6hh8",
|
|
22
|
+
B6of3ja: "f1hu3pq6",
|
|
23
|
+
t21cq0: ["f11qmguv", "f1tyq0we"],
|
|
24
|
+
jrapky: "f19f4twv",
|
|
25
|
+
Frg6f3: ["f1tyq0we", "f11qmguv"]
|
|
22
26
|
},
|
|
23
27
|
rootWithoutCloseButton: {
|
|
24
28
|
Ijaq50: "faq1aip",
|
|
@@ -33,7 +37,7 @@ const useStyles = /*#__PURE__*/__styles({
|
|
|
33
37
|
Bw0ie65: "f98d4vj"
|
|
34
38
|
}
|
|
35
39
|
}, {
|
|
36
|
-
d: [".fk6fouc{font-family:var(--fontFamilyBase);}", ".f1pp30po{font-size:var(--fontSizeBase500);}", ".fl43uef{font-weight:var(--fontWeightSemibold);}", ".f106mvju{line-height:var(--lineHeightBase500);}", ".faq1aip{grid-row-start:title;}", ".f1m489tg{grid-column-start:title;}", ".fv2srd9{grid-row-end:title;}", ".f1tz6hh8{grid-column-end:title;}", ".f11nczdl{grid-row-end:close-button;}", ".f98d4vj{grid-column-end:close-button;}", ".f1hysmiz{grid-row-start:close-button;}", ".f1379kmu{grid-column-start:close-button;}"]
|
|
40
|
+
d: [".fk6fouc{font-family:var(--fontFamilyBase);}", ".f1pp30po{font-size:var(--fontSizeBase500);}", ".fl43uef{font-weight:var(--fontWeightSemibold);}", ".f106mvju{line-height:var(--lineHeightBase500);}", ".faq1aip{grid-row-start:title;}", ".f1m489tg{grid-column-start:title;}", ".fv2srd9{grid-row-end:title;}", ".f1tz6hh8{grid-column-end:title;}", ".f1hu3pq6{margin-top:0;}", ".f11qmguv{margin-right:0;}", ".f1tyq0we{margin-left:0;}", ".f19f4twv{margin-bottom:0;}", ".f11nczdl{grid-row-end:close-button;}", ".f98d4vj{grid-column-end:close-button;}", ".f1hysmiz{grid-row-start:close-button;}", ".f1379kmu{grid-column-start:close-button;}"]
|
|
37
41
|
});
|
|
38
42
|
/**
|
|
39
43
|
* Styles to be applied on internal elements used by default action on non-modal Dialog
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__styles","mergeClasses","shorthands","typographyStyles","TITLE_ACTION_GRID_AREA","TITLE_GRID_AREA","createFocusOutlineStyle","dialogTitleClassNames","root","action","useStyles","Bahqtrf","Be2twd7","Bhrd7zp","Bg96gwp","Ijaq50","Br312pm","nk6f5a","Bw0ie65","rootWithoutCloseButton","d","useDialogTitleInternalStyles","button","qhf8xq","B7ck84d","De3pzq","sj55zd","Bceei9c","B68tc82","Bmxbyg5","z8tnut","z189sj","Byoj8tv","uwmqm3","icvyot","vrafjx","oivjwe","wvpqe5","Bv0vk6g","fsow6f","Brovlpu","B486eqv","B8q5s1w","Bci5o5g","n8qw10","Bdrgwmp","Bm4h7ae","B7ys5i9","Busjfv9","Bhk32uz","Bf4ptjt","kclons","Bhdgwq3","Blkhhs4","Bqtpl0w","clg4pj","hgwjuy","Bonggc9","B1tsrr9","Dah5zi","Bkh64rk","qqdqy8","B6dhp37","i03rao","Boxcth7","Bsom6fd","J0r882","Bjwuhne","Ghsupd","Bule8hv","f","i","useDialogTitleStyles_unstable","state","styles","className"],"sources":["../../../src/components/DialogTitle/useDialogTitleStyles.ts"],"sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport type { DialogTitleSlots, DialogTitleState } from './DialogTitle.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { typographyStyles } from '@fluentui/react-theme';\nimport { TITLE_ACTION_GRID_AREA, TITLE_GRID_AREA } from '../../contexts/constants';\nimport { createFocusOutlineStyle } from '@fluentui/react-tabster';\n\nexport const dialogTitleClassNames: SlotClassNames<DialogTitleSlots> = {\n root: 'fui-DialogTitle',\n action: 'fui-DialogTitle__action',\n};\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n ...typographyStyles.subtitle1,\n ...shorthands.gridArea(TITLE_GRID_AREA),\n },\n rootWithoutCloseButton: {\n ...shorthands.gridArea(TITLE_GRID_AREA, TITLE_GRID_AREA, TITLE_ACTION_GRID_AREA, TITLE_ACTION_GRID_AREA),\n },\n action: {\n ...shorthands.gridArea(TITLE_ACTION_GRID_AREA),\n },\n});\n\n/**\n * Styles to be applied on internal elements used by default action on non-modal Dialog\n * @internal\n */\nexport const useDialogTitleInternalStyles = makeStyles({\n button: {\n position: 'relative',\n boxSizing: 'content-box',\n backgroundColor: 'inherit',\n color: 'inherit',\n fontFamily: 'inherit',\n fontSize: 'inherit',\n cursor: 'pointer',\n lineHeight: 0,\n ...shorthands.overflow('visible'),\n ...shorthands.padding(0),\n ...shorthands.borderStyle('none'),\n WebkitAppearance: 'button',\n textAlign: 'unset',\n ...createFocusOutlineStyle(),\n },\n});\n\n/**\n * Apply styling to the DialogTitle slots based on the state\n */\nexport const useDialogTitleStyles_unstable = (state: DialogTitleState): DialogTitleState => {\n const styles = useStyles();\n state.root.className = mergeClasses(\n dialogTitleClassNames.root,\n styles.root,\n !state.action && styles.rootWithoutCloseButton,\n state.root.className,\n );\n if (state.action) {\n state.action.className = mergeClasses(dialogTitleClassNames.action, styles.action, state.action.className);\n }\n return state;\n};\n"],"mappings":"AAAA,SAAAA,QAAA,EAAqBC,YAAY,EAAEC,UAAU,QAAQ;AAGrD,SAASC,gBAAgB,QAAQ;AACjC,SAASC,sBAAsB,EAAEC,eAAe,QAAQ;AACxD,SAASC,uBAAuB,QAAQ;AAExC,OAAO,MAAMC,qBAAA,GAA0D;EACrEC,IAAA,EAAM;EACNC,MAAA,EAAQ;AACV;AAEA;;;AAGA,MAAMC,SAAA,gBAAYV,QAAA;EAAAQ,IAAA;IAAAG,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;EAAAC,sBAAA;
|
|
1
|
+
{"version":3,"names":["__styles","mergeClasses","shorthands","typographyStyles","TITLE_ACTION_GRID_AREA","TITLE_GRID_AREA","createFocusOutlineStyle","dialogTitleClassNames","root","action","useStyles","Bahqtrf","Be2twd7","Bhrd7zp","Bg96gwp","Ijaq50","Br312pm","nk6f5a","Bw0ie65","B6of3ja","t21cq0","jrapky","Frg6f3","rootWithoutCloseButton","d","useDialogTitleInternalStyles","button","qhf8xq","B7ck84d","De3pzq","sj55zd","Bceei9c","B68tc82","Bmxbyg5","z8tnut","z189sj","Byoj8tv","uwmqm3","icvyot","vrafjx","oivjwe","wvpqe5","Bv0vk6g","fsow6f","Brovlpu","B486eqv","B8q5s1w","Bci5o5g","n8qw10","Bdrgwmp","Bm4h7ae","B7ys5i9","Busjfv9","Bhk32uz","Bf4ptjt","kclons","Bhdgwq3","Blkhhs4","Bqtpl0w","clg4pj","hgwjuy","Bonggc9","B1tsrr9","Dah5zi","Bkh64rk","qqdqy8","B6dhp37","i03rao","Boxcth7","Bsom6fd","J0r882","Bjwuhne","Ghsupd","Bule8hv","f","i","useDialogTitleStyles_unstable","state","styles","className"],"sources":["../../../src/components/DialogTitle/useDialogTitleStyles.ts"],"sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport type { DialogTitleSlots, DialogTitleState } from './DialogTitle.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { typographyStyles } from '@fluentui/react-theme';\nimport { TITLE_ACTION_GRID_AREA, TITLE_GRID_AREA } from '../../contexts/constants';\nimport { createFocusOutlineStyle } from '@fluentui/react-tabster';\n\nexport const dialogTitleClassNames: SlotClassNames<DialogTitleSlots> = {\n root: 'fui-DialogTitle',\n action: 'fui-DialogTitle__action',\n};\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n ...typographyStyles.subtitle1,\n ...shorthands.gridArea(TITLE_GRID_AREA),\n ...shorthands.margin(0),\n },\n rootWithoutCloseButton: {\n ...shorthands.gridArea(TITLE_GRID_AREA, TITLE_GRID_AREA, TITLE_ACTION_GRID_AREA, TITLE_ACTION_GRID_AREA),\n },\n action: {\n ...shorthands.gridArea(TITLE_ACTION_GRID_AREA),\n },\n});\n\n/**\n * Styles to be applied on internal elements used by default action on non-modal Dialog\n * @internal\n */\nexport const useDialogTitleInternalStyles = makeStyles({\n button: {\n position: 'relative',\n boxSizing: 'content-box',\n backgroundColor: 'inherit',\n color: 'inherit',\n fontFamily: 'inherit',\n fontSize: 'inherit',\n cursor: 'pointer',\n lineHeight: 0,\n ...shorthands.overflow('visible'),\n ...shorthands.padding(0),\n ...shorthands.borderStyle('none'),\n WebkitAppearance: 'button',\n textAlign: 'unset',\n ...createFocusOutlineStyle(),\n },\n});\n\n/**\n * Apply styling to the DialogTitle slots based on the state\n */\nexport const useDialogTitleStyles_unstable = (state: DialogTitleState): DialogTitleState => {\n const styles = useStyles();\n state.root.className = mergeClasses(\n dialogTitleClassNames.root,\n styles.root,\n !state.action && styles.rootWithoutCloseButton,\n state.root.className,\n );\n if (state.action) {\n state.action.className = mergeClasses(dialogTitleClassNames.action, styles.action, state.action.className);\n }\n return state;\n};\n"],"mappings":"AAAA,SAAAA,QAAA,EAAqBC,YAAY,EAAEC,UAAU,QAAQ;AAGrD,SAASC,gBAAgB,QAAQ;AACjC,SAASC,sBAAsB,EAAEC,eAAe,QAAQ;AACxD,SAASC,uBAAuB,QAAQ;AAExC,OAAO,MAAMC,qBAAA,GAA0D;EACrEC,IAAA,EAAM;EACNC,MAAA,EAAQ;AACV;AAEA;;;AAGA,MAAMC,SAAA,gBAAYV,QAAA;EAAAQ,IAAA;IAAAG,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;EAAA;EAAAC,sBAAA;IAAAR,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;EAAAT,MAAA;IAAAM,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;AAAA;EAAAM,CAAA;AAAA,EAYlB;AAEA;;;;AAIA,OAAO,MAAMC,4BAAA,gBAA+BzB,QAAA;EAAA0B,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAnB,OAAA;IAAAC,OAAA;IAAAmB,OAAA;IAAAjB,OAAA;IAAAkB,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;AAAA;EAAAjD,CAAA;EAAAkD,CAAA;EAAAC,CAAA;AAAA,EAiB5C;AAEA;;;AAGA,OAAO,MAAMC,6BAAA,GAAiCC,KAAA,IAA8C;EAC1F,MAAMC,MAAA,GAASpE,SAAA;EACfmE,KAAA,CAAMrE,IAAI,CAACuE,SAAS,GAAG9E,YAAA,CACrBM,qBAAA,CAAsBC,IAAI,EAC1BsE,MAAA,CAAOtE,IAAI,EACX,CAACqE,KAAA,CAAMpE,MAAM,IAAIqE,MAAA,CAAOvD,sBAAsB,EAC9CsD,KAAA,CAAMrE,IAAI,CAACuE,SAAS;EAEtB,IAAIF,KAAA,CAAMpE,MAAM,EAAE;IAChBoE,KAAA,CAAMpE,MAAM,CAACsE,SAAS,GAAG9E,YAAA,CAAaM,qBAAA,CAAsBE,MAAM,EAAEqE,MAAA,CAAOrE,MAAM,EAAEoE,KAAA,CAAMpE,MAAM,CAACsE,SAAS;EAC3G;EACA,OAAOF,KAAA;AACT"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { useModalAttributes } from '@fluentui/react-tabster';
|
|
3
2
|
import { applyTriggerPropsToChildren, getTriggerChild, useEventCallback } from '@fluentui/react-utilities';
|
|
4
3
|
import { useDialogContext_unstable, useDialogSurfaceContext_unstable } from '../../contexts';
|
|
5
4
|
import { useARIAButtonProps } from '@fluentui/react-aria';
|
|
@@ -18,9 +17,7 @@ export const useDialogTrigger_unstable = props => {
|
|
|
18
17
|
} = props;
|
|
19
18
|
const child = getTriggerChild(children);
|
|
20
19
|
const requestOpenChange = useDialogContext_unstable(ctx => ctx.requestOpenChange);
|
|
21
|
-
const
|
|
22
|
-
triggerAttributes
|
|
23
|
-
} = useModalAttributes();
|
|
20
|
+
const triggerAttributes = useDialogContext_unstable(ctx => ctx.triggerAttributes);
|
|
24
21
|
const handleClick = useEventCallback(event => {
|
|
25
22
|
var _child_props, _child_props_onClick;
|
|
26
23
|
(_child_props_onClick = (_child_props = child === null || child === void 0 ? void 0 : child.props).onClick) === null || _child_props_onClick === void 0 ? void 0 : _child_props_onClick.call(_child_props, event);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","
|
|
1
|
+
{"version":3,"names":["React","applyTriggerPropsToChildren","getTriggerChild","useEventCallback","useDialogContext_unstable","useDialogSurfaceContext_unstable","useARIAButtonProps","useDialogTrigger_unstable","props","isInsideSurfaceDialog","children","disableButtonEnhancement","action","child","requestOpenChange","ctx","triggerAttributes","handleClick","event","_child_props","_child_props_onClick","onClick","call","isDefaultPrevented","type","open","triggerChildProps","ref","ariaButtonTriggerChildProps"],"sources":["../../../src/components/DialogTrigger/useDialogTrigger.ts"],"sourcesContent":["import * as React from 'react';\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 triggerAttributes = useDialogContext_unstable(ctx => ctx.triggerAttributes);\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 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"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,2BAA2B,EAAEC,eAAe,EAAEC,gBAAgB,QAAQ;AAE/E,SAASC,yBAAyB,EAAEC,gCAAgC,QAAQ;AAC5E,SAASC,kBAAkB,QAAQ;AAEnC;;;;;;AAMA,OAAO,MAAMC,yBAAA,GAA6BC,KAAA,IAAkD;EAC1F,MAAMC,qBAAA,GAAwBJ,gCAAA;EAE9B,MAAM;IAAEK,QAAA;IAAUC,wBAAA,GAA2B,KAAK;IAAEC,MAAA,GAASH,qBAAA,GAAwB,UAAU;EAAM,CAAE,GAAGD,KAAA;EAE1G,MAAMK,KAAA,GAAQX,eAAA,CAAgBQ,QAAA;EAE9B,MAAMI,iBAAA,GAAoBV,yBAAA,CAA0BW,GAAA,IAAOA,GAAA,CAAID,iBAAiB;EAChF,MAAME,iBAAA,GAAoBZ,yBAAA,CAA0BW,GAAA,IAAOA,GAAA,CAAIC,iBAAiB;EAEhF,MAAMC,WAAA,GAAcd,gBAAA,CACjBe,KAAA,IAAoF;QACnFC,YAAA,EAAAC,oBAAA;IAAA,CAAAA,oBAAA,IAAAD,YAAA,GAAAN,KAAA,aAAAA,KAAA,uBAAAA,KAAA,CAAOL,KAAK,EAACa,OAAO,cAApBD,oBAAA,uBAAAA,oBAAA,CAAAE,IAAA,CAAAH,YAAA,EAAuBD,KAAA;IACvB,IAAI,CAACA,KAAA,CAAMK,kBAAkB,IAAI;MAC/BT,iBAAA,CAAkB;QAChBI,KAAA;QACAM,IAAA,EAAM;QACNC,IAAA,EAAMb,MAAA,KAAW;MACnB;IACF;EACF;EAGF,MAAMc,iBAAA,GAAoB;IACxB,IAAGb,KAAA,aAAAA,KAAA,uBAAAA,KAAA,CAAOL,KAAK;IACfmB,GAAA,EAAKd,KAAA,aAAAA,KAAA,uBAAAA,KAAA,CAAOc,GAAG;IACfN,OAAA,EAASJ,WAAA;IACT,GAAGD;EACL;EAEA,MAAMY,2BAAA,GAA8BtB,kBAAA,CAClC,CAAAO,KAAA,aAAAA,KAAA,uBAAAA,KAAA,CAAOW,IAAI,MAAK,YAAY,CAAAX,KAAA,aAAAA,KAAA,uBAAAA,KAAA,CAAOW,IAAI,MAAK,MAAMX,KAAA,CAAMW,IAAI,GAAG,KAAK,EACpE;IACE,GAAGE,iBAAiB;IACpBF,IAAA,EAAM;EACR;EAGF,OAAO;IACLd,QAAA,EAAUT,2BAAA,CACRS,QAAA,EACAC,wBAAA,GAA2Be,iBAAA,GAAoBE,2BAA2B;EAE9E;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","createContext","useContextSelector","defaultContextValue","open","inertTrapFocus","modalType","isNestedDialog","dialogRef","current","requestOpenChange","DialogContext","undefined","DialogProvider","Provider","useDialogContext_unstable","selector","ctx"],"sources":["../../src/contexts/dialogContext.ts"],"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 inertTrapFocus: 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}
|
|
1
|
+
{"version":3,"names":["React","createContext","useContextSelector","defaultContextValue","open","inertTrapFocus","modalType","isNestedDialog","dialogRef","current","requestOpenChange","DialogContext","undefined","DialogProvider","Provider","useDialogContext_unstable","selector","ctx"],"sources":["../../src/contexts/dialogContext.ts"],"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';\nimport { useModalAttributes } from '@fluentui/react-tabster';\n\nexport type DialogContextValue = {\n open: boolean;\n inertTrapFocus: 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} & Partial<ReturnType<typeof useModalAttributes>>;\n\nconst defaultContextValue: DialogContextValue = {\n open: false,\n inertTrapFocus: 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"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,aAAa,EAAmBC,kBAAkB,QAAQ;AAmBnE,MAAMC,mBAAA,GAA0C;EAC9CC,IAAA,EAAM,KAAK;EACXC,cAAA,EAAgB,KAAK;EACrBC,SAAA,EAAW;EACXC,cAAA,EAAgB,KAAK;EACrBC,SAAA,EAAW;IAAEC,OAAA,EAAS;EAAK;EAC3BC,kBAAA,EAAoB;IAClB;AAEJ;AAEA;AACA,OAAO,MAAMC,aAAA,gBAAyDV,aAAA,CACpEW,SAAA;AAGF,OAAO,MAAMC,cAAA,GAAiBF,aAAA,CAAcG,QAAQ;AACpD,OAAO,MAAMC,yBAAA,GAAgCC,QAAA,IAC3Cd,kBAAA,CAAmBS,aAAA,EAAe,CAACM,GAAA,GAAMd,mBAAmB,KAAKa,QAAA,CAASC,GAAA"}
|
|
@@ -12,6 +12,7 @@ const _reactUtilities = require("@fluentui/react-utilities");
|
|
|
12
12
|
const _reactContextSelector = require("@fluentui/react-context-selector");
|
|
13
13
|
const _utils = require("../../utils");
|
|
14
14
|
const _contexts = require("../../contexts");
|
|
15
|
+
const _reactTabster = require("@fluentui/react-tabster");
|
|
15
16
|
const useDialog_unstable = (props)=>{
|
|
16
17
|
const { children , modalType ='modal' , onOpenChange , inertTrapFocus =false } = props;
|
|
17
18
|
const [trigger, content] = childrenToTriggerAndContent(children);
|
|
@@ -39,6 +40,10 @@ const useDialog_unstable = (props)=>{
|
|
|
39
40
|
disableBodyScroll,
|
|
40
41
|
isBodyScrollLocked
|
|
41
42
|
]);
|
|
43
|
+
const { modalAttributes , triggerAttributes } = (0, _reactTabster.useModalAttributes)({
|
|
44
|
+
trapFocus: modalType !== 'non-modal',
|
|
45
|
+
legacyTrapFocus: !inertTrapFocus
|
|
46
|
+
});
|
|
42
47
|
return {
|
|
43
48
|
components: {
|
|
44
49
|
backdrop: 'div'
|
|
@@ -51,7 +56,9 @@ const useDialog_unstable = (props)=>{
|
|
|
51
56
|
requestOpenChange,
|
|
52
57
|
dialogTitleId: (0, _reactUtilities.useId)('dialog-title-'),
|
|
53
58
|
isNestedDialog: (0, _reactContextSelector.useHasParentContext)(_contexts.DialogContext),
|
|
54
|
-
dialogRef: focusRef
|
|
59
|
+
dialogRef: focusRef,
|
|
60
|
+
modalAttributes: modalType !== 'non-modal' ? modalAttributes : undefined,
|
|
61
|
+
triggerAttributes
|
|
55
62
|
};
|
|
56
63
|
};
|
|
57
64
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../lib/components/Dialog/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';\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 => {\n const {\n children,\n modalType = 'modal',\n onOpenChange,\n inertTrapFocus = false\n } = 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 }, [disableBodyScroll, isBodyScrollLocked]);\n return {\n components: {\n backdrop: 'div'\n },\n inertTrapFocus,\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 * Extracts trigger and content from children\n */\nfunction 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('Dialog must contain at least one child <DialogSurface/>,\\n' + 'and 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 [undefined, childrenArray[0]];\n // unknown case\n default:\n return [undefined, undefined];\n }\n}\n//# sourceMappingURL=useDialog.js.map"],"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","components","backdrop","dialogTitleId","useId","isNestedDialog","useHasParentContext","DialogContext","dialogRef","childrenArray","React","Children","toArray","process","env","NODE_ENV","length","console","warn"
|
|
1
|
+
{"version":3,"sources":["../../../lib/components/Dialog/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 */\nexport const useDialog_unstable = props => {\n const {\n children,\n modalType = 'modal',\n onOpenChange,\n inertTrapFocus = false\n } = 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 }, [disableBodyScroll, isBodyScrollLocked]);\n const {\n modalAttributes,\n triggerAttributes\n } = 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: open ? content : null,\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 */\nfunction 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('Dialog must contain at least one child <DialogSurface/>,\\n' + 'and 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 [undefined, childrenArray[0]];\n // unknown case\n default:\n return [undefined, undefined];\n }\n}\n//# sourceMappingURL=useDialog.js.map"],"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":";;;;+BAcaA;;aAAAA;;;6DAdU;gCACkE;sCACrD;uBACuB;0BAC7B;8BACK;AAS5B,MAAMA,qBAAqBC,CAAAA,QAAS;IACzC,MAAM,EACJC,SAAQ,EACRC,WAAY,QAAO,EACnBC,aAAY,EACZC,gBAAiB,KAAK,CAAA,EACvB,GAAGJ;IACJ,MAAM,CAACK,SAASC,QAAQ,GAAGC,4BAA4BN;IACvD,MAAM,CAACO,MAAMC,QAAQ,GAAGC,IAAAA,oCAAoB,EAAC;QAC3CC,OAAOX,MAAMQ,IAAI;QACjBI,cAAcZ,MAAMa,WAAW;QAC/BC,cAAc,KAAK;IACrB;IACA,MAAMC,oBAAoBC,IAAAA,gCAAgB,EAACC,CAAAA,OAAQ;QACjDd,iBAAiB,IAAI,IAAIA,iBAAiB,KAAK,IAAI,KAAK,IAAIA,aAAac,KAAKC,KAAK,EAAED,KAAK;QAC1F,0DAA0D;QAC1D,6FAA6F;QAC7F,IAAI,CAACA,KAAKC,KAAK,CAACC,kBAAkB,IAAI;YACpCV,QAAQQ,KAAKT,IAAI;QACnB,CAAC;IACH;IACA,MAAMY,WAAWC,IAAAA,2BAAoB,EAACb,MAAMN;IAC5C,MAAMoB,oBAAoBC,IAAAA,2BAAoB;IAC9C,MAAMC,qBAAqBC,QAAQjB,QAAQN,cAAc;IACzDwB,IAAAA,yCAAyB,EAAC,IAAM;QAC9B,IAAIF,oBAAoB;YACtB,OAAOF;QACT,CAAC;IACH,GAAG;QAACA;QAAmBE;KAAmB;IAC1C,MAAM,EACJG,gBAAe,EACfC,kBAAiB,EAClB,GAAGC,IAAAA,gCAAkB,EAAC;QACrBC,WAAW5B,cAAc;QACzB6B,iBAAiB,CAAC3B;IACpB;IACA,OAAO;QACL4B,YAAY;YACVC,UAAU;QACZ;QACA7B;QACAI;QACAN;QACAI,SAASE,OAAOF,UAAU,IAAI;QAC9BD;QACAU;QACAmB,eAAeC,IAAAA,qBAAK,EAAC;QACrBC,gBAAgBC,IAAAA,yCAAmB,EAACC,uBAAa;QACjDC,WAAWnB;QACXO,iBAAiBzB,cAAc,cAAcyB,kBAAkBa,SAAS;QACxEZ;IACF;AACF;AACA;;CAEC,GACD,SAASrB,4BAA4BN,QAAQ,EAAE;IAC7C,MAAMwC,gBAAgBC,OAAMC,QAAQ,CAACC,OAAO,CAAC3C;IAC7C,IAAI4C,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,IAAIN,cAAcO,MAAM,KAAK,KAAKP,cAAcO,MAAM,KAAK,GAAG;YAC5D,sCAAsC;YACtCC,QAAQC,IAAI,CAAC,+DAA+D;QAC9E,CAAC;IACH,CAAC;IACD,OAAQT,cAAcO,MAAM;QAC1B,mDAAmD;QACnD,KAAK;YACH,OAAOP;QACT,kCAAkC;QAClC,KAAK;YACH,OAAO;gBAACD;gBAAWC,aAAa,CAAC,EAAE;aAAC;QACtC,eAAe;QACf;YACE,OAAO;gBAACD;gBAAWA;aAAU;IACjC;AACF,EACA,qCAAqC"}
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "useDialogContextValues_unstable", {
|
|
|
7
7
|
get: ()=>useDialogContextValues_unstable
|
|
8
8
|
});
|
|
9
9
|
function useDialogContextValues_unstable(state) {
|
|
10
|
-
const { modalType , open , dialogRef , dialogTitleId , isNestedDialog , inertTrapFocus , requestOpenChange } = state;
|
|
10
|
+
const { modalType , open , dialogRef , dialogTitleId , isNestedDialog , inertTrapFocus , requestOpenChange , modalAttributes , triggerAttributes } = state;
|
|
11
11
|
/**
|
|
12
12
|
* This context is created with "@fluentui/react-context-selector",
|
|
13
13
|
* there is no sense to memoize it
|
|
@@ -18,6 +18,8 @@ function useDialogContextValues_unstable(state) {
|
|
|
18
18
|
dialogTitleId,
|
|
19
19
|
isNestedDialog,
|
|
20
20
|
inertTrapFocus,
|
|
21
|
+
modalAttributes,
|
|
22
|
+
triggerAttributes,
|
|
21
23
|
requestOpenChange
|
|
22
24
|
};
|
|
23
25
|
const dialogSurface = false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../lib/components/Dialog/useDialogContextValues.js"],"sourcesContent":["export function useDialogContextValues_unstable(state) {\n const {\n modalType,\n open,\n dialogRef,\n dialogTitleId,\n isNestedDialog,\n inertTrapFocus,\n requestOpenChange\n } = state;\n /**\n * This context is created with \"@fluentui/react-context-selector\",\n * there is no sense to memoize it\n */\n const dialog = {\n open,\n modalType,\n dialogRef,\n dialogTitleId,\n isNestedDialog,\n inertTrapFocus,\n requestOpenChange\n };\n const dialogSurface = false;\n return {\n dialog,\n dialogSurface\n };\n}\n//# sourceMappingURL=useDialogContextValues.js.map"],"names":["useDialogContextValues_unstable","state","modalType","open","dialogRef","dialogTitleId","isNestedDialog","inertTrapFocus","requestOpenChange","dialog","dialogSurface"],"mappings":";;;;+BAAgBA;;aAAAA;;AAAT,SAASA,gCAAgCC,KAAK,EAAE;IACrD,MAAM,EACJC,UAAS,EACTC,KAAI,EACJC,UAAS,EACTC,cAAa,EACbC,eAAc,EACdC,eAAc,EACdC,kBAAiB,EAClB,
|
|
1
|
+
{"version":3,"sources":["../../../lib/components/Dialog/useDialogContextValues.js"],"sourcesContent":["export function useDialogContextValues_unstable(state) {\n const {\n modalType,\n open,\n dialogRef,\n dialogTitleId,\n isNestedDialog,\n inertTrapFocus,\n requestOpenChange,\n modalAttributes,\n triggerAttributes\n } = state;\n /**\n * This context is created with \"@fluentui/react-context-selector\",\n * there is no sense to memoize it\n */\n const dialog = {\n open,\n modalType,\n dialogRef,\n dialogTitleId,\n isNestedDialog,\n inertTrapFocus,\n modalAttributes,\n triggerAttributes,\n requestOpenChange\n };\n const dialogSurface = false;\n return {\n dialog,\n dialogSurface\n };\n}\n//# sourceMappingURL=useDialogContextValues.js.map"],"names":["useDialogContextValues_unstable","state","modalType","open","dialogRef","dialogTitleId","isNestedDialog","inertTrapFocus","requestOpenChange","modalAttributes","triggerAttributes","dialog","dialogSurface"],"mappings":";;;;+BAAgBA;;aAAAA;;AAAT,SAASA,gCAAgCC,KAAK,EAAE;IACrD,MAAM,EACJC,UAAS,EACTC,KAAI,EACJC,UAAS,EACTC,cAAa,EACbC,eAAc,EACdC,eAAc,EACdC,kBAAiB,EACjBC,gBAAe,EACfC,kBAAiB,EAClB,GAAGT;IACJ;;;EAGA,GACA,MAAMU,SAAS;QACbR;QACAD;QACAE;QACAC;QACAC;QACAC;QACAE;QACAC;QACAF;IACF;IACA,MAAMI,gBAAgB,KAAK;IAC3B,OAAO;QACLD;QACAC;IACF;AACF,EACA,kDAAkD"}
|
|
@@ -11,11 +11,10 @@ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
|
|
11
11
|
const _reactUtilities = require("@fluentui/react-utilities");
|
|
12
12
|
const _contexts = require("../../contexts");
|
|
13
13
|
const _utils = require("../../utils");
|
|
14
|
-
const _reactTabster = require("@fluentui/react-tabster");
|
|
15
14
|
const useDialogSurface_unstable = (props, ref)=>{
|
|
16
15
|
const { backdrop , as } = props;
|
|
17
16
|
const modalType = (0, _contexts.useDialogContext_unstable)((ctx)=>ctx.modalType);
|
|
18
|
-
const
|
|
17
|
+
const modalAttributes = (0, _contexts.useDialogContext_unstable)((ctx)=>ctx.modalAttributes);
|
|
19
18
|
const dialogRef = (0, _contexts.useDialogContext_unstable)((ctx)=>ctx.dialogRef);
|
|
20
19
|
const open = (0, _contexts.useDialogContext_unstable)((ctx)=>ctx.open);
|
|
21
20
|
const requestOpenChange = (0, _contexts.useDialogContext_unstable)((ctx)=>ctx.requestOpenChange);
|
|
@@ -47,10 +46,6 @@ const useDialogSurface_unstable = (props, ref)=>{
|
|
|
47
46
|
event.stopPropagation();
|
|
48
47
|
}
|
|
49
48
|
});
|
|
50
|
-
const { modalAttributes } = (0, _reactTabster.useModalAttributes)({
|
|
51
|
-
trapFocus: modalType !== 'non-modal',
|
|
52
|
-
legacyTrapFocus: !inertTrapFocus
|
|
53
|
-
});
|
|
54
49
|
return {
|
|
55
50
|
components: {
|
|
56
51
|
backdrop: 'div',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../lib/components/DialogSurface/useDialogSurface.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, resolveShorthand, useEventCallback, useMergedRefs, isResolvedShorthand } from '@fluentui/react-utilities';\nimport { useDialogContext_unstable } from '../../contexts';\nimport { isEscapeKeyDismiss } from '../../utils';\
|
|
1
|
+
{"version":3,"sources":["../../../lib/components/DialogSurface/useDialogSurface.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, resolveShorthand, useEventCallback, useMergedRefs, isResolvedShorthand } from '@fluentui/react-utilities';\nimport { useDialogContext_unstable } from '../../contexts';\nimport { isEscapeKeyDismiss } from '../../utils';\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 = (props, ref) => {\n const {\n backdrop,\n as\n } = props;\n const modalType = useDialogContext_unstable(ctx => ctx.modalType);\n const modalAttributes = useDialogContext_unstable(ctx => ctx.modalAttributes);\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 const handledBackdropClick = useEventCallback(event => {\n if (isResolvedShorthand(props.backdrop)) {\n var _props_backdrop, _props_backdrop_onClick;\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 (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 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 !== null && as !== void 0 ? as : '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 ref: useMergedRefs(ref, dialogRef)\n })\n };\n};\n//# sourceMappingURL=useDialogSurface.js.map"],"names":["useDialogSurface_unstable","props","ref","backdrop","as","modalType","useDialogContext_unstable","ctx","modalAttributes","dialogRef","open","requestOpenChange","dialogTitleID","dialogTitleId","handledBackdropClick","useEventCallback","event","isResolvedShorthand","_props_backdrop","_props_backdrop_onClick","onClick","call","isDefaultPrevented","type","handleKeyDown","_props_onKeyDown","onKeyDown","isEscapeKeyDismiss","stopPropagation","components","root","resolveShorthand","required","defaultProps","getNativeElementProps","tabIndex","role","undefined","useMergedRefs"],"mappings":";;;;+BAaaA;;aAAAA;;;6DAbU;gCACuF;0BACpE;uBACP;AAU5B,MAAMA,4BAA4B,CAACC,OAAOC,MAAQ;IACvD,MAAM,EACJC,SAAQ,EACRC,GAAE,EACH,GAAGH;IACJ,MAAMI,YAAYC,IAAAA,mCAAyB,EAACC,C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LC,YAAY;YACV1B,UAAU;YACV2B,MAAM;QACR;QACA3B,UAAU4B,IAAAA,gCAAgB,EAAC5B,UAAU;YACnC6B,UAAUtB,QAAQL,cAAc;YAChC4B,cAAc;gBACZ,eAAe;gBACfb,SAASN;YACX;QACF;QACAgB,MAAMI,IAAAA,qCAAqB,EAAC9B,OAAO,IAAI,IAAIA,OAAO,KAAK,IAAIA,KAAK,KAAK,EAAE;YACrE+B,UAAU,CAAC;YACX,cAAc9B,cAAc;YAC5B+B,MAAM/B,cAAc,UAAU,gBAAgB,QAAQ;YACtD,mBAAmBJ,KAAK,CAAC,aAAa,GAAGoC,YAAYzB,aAAa;YAClE,GAAGX,KAAK;YACR,GAAGO,eAAe;YAClBkB,WAAWF;YACXtB,KAAKoC,IAAAA,6BAAa,EAACpC,KAAKO;QAC1B;IACF;AACF,GACA,4CAA4C"}
|
|
@@ -19,10 +19,10 @@ const useDialogTitle_unstable = (props, ref)=>{
|
|
|
19
19
|
const internalStyles = (0, _useDialogTitleStyles.useDialogTitleInternalStyles)();
|
|
20
20
|
return {
|
|
21
21
|
components: {
|
|
22
|
-
root: '
|
|
22
|
+
root: 'h2',
|
|
23
23
|
action: 'div'
|
|
24
24
|
},
|
|
25
|
-
root: (0, _reactUtilities.getNativeElementProps)(as !== null && as !== void 0 ? as : '
|
|
25
|
+
root: (0, _reactUtilities.getNativeElementProps)(as !== null && as !== void 0 ? as : 'h2', {
|
|
26
26
|
ref,
|
|
27
27
|
id: (0, _dialogContext.useDialogContext_unstable)((ctx)=>ctx.dialogTitleId),
|
|
28
28
|
...props
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../lib/components/DialogTitle/useDialogTitle.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps } from '@fluentui/react-utilities';\nimport { useDialogContext_unstable } from '../../contexts/dialogContext';\nimport { Dismiss24Regular } from '@fluentui/react-icons';\nimport { resolveShorthand } from '@fluentui/react-utilities';\nimport { DialogTrigger } from '../DialogTrigger/DialogTrigger';\nimport { useDialogTitleInternalStyles } from './useDialogTitleStyles';\n/**\n * Create the state required to render DialogTitle.\n *\n * The returned state can be modified with hooks such as useDialogTitleStyles_unstable,\n * before being passed to renderDialogTitle_unstable.\n *\n * @param props - props from this instance of DialogTitle\n * @param ref - reference to root HTMLElement of DialogTitle\n */\nexport const useDialogTitle_unstable = (props, ref) => {\n const {\n as,\n action\n } = props;\n const modalType = useDialogContext_unstable(ctx => ctx.modalType);\n const internalStyles = useDialogTitleInternalStyles();\n return {\n components: {\n root: '
|
|
1
|
+
{"version":3,"sources":["../../../lib/components/DialogTitle/useDialogTitle.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps } from '@fluentui/react-utilities';\nimport { useDialogContext_unstable } from '../../contexts/dialogContext';\nimport { Dismiss24Regular } from '@fluentui/react-icons';\nimport { resolveShorthand } from '@fluentui/react-utilities';\nimport { DialogTrigger } from '../DialogTrigger/DialogTrigger';\nimport { useDialogTitleInternalStyles } from './useDialogTitleStyles';\n/**\n * Create the state required to render DialogTitle.\n *\n * The returned state can be modified with hooks such as useDialogTitleStyles_unstable,\n * before being passed to renderDialogTitle_unstable.\n *\n * @param props - props from this instance of DialogTitle\n * @param ref - reference to root HTMLElement of DialogTitle\n */\nexport const useDialogTitle_unstable = (props, ref) => {\n const {\n as,\n action\n } = props;\n const modalType = useDialogContext_unstable(ctx => ctx.modalType);\n const internalStyles = useDialogTitleInternalStyles();\n return {\n components: {\n root: 'h2',\n action: 'div'\n },\n root: getNativeElementProps(as !== null && as !== void 0 ? as : 'h2', {\n ref,\n id: useDialogContext_unstable(ctx => ctx.dialogTitleId),\n ...props\n }),\n action: resolveShorthand(action, {\n required: modalType === 'non-modal',\n defaultProps: {\n children: /*#__PURE__*/React.createElement(DialogTrigger, {\n disableButtonEnhancement: true,\n action: \"close\"\n }, /*#__PURE__*/React.createElement(\"button\", {\n type: \"button\",\n className: internalStyles.button,\n // TODO: find a better way to add internal labels\n \"aria-label\": \"close\"\n }, /*#__PURE__*/React.createElement(Dismiss24Regular, null)))\n }\n })\n };\n};\n//# sourceMappingURL=useDialogTitle.js.map"],"names":["useDialogTitle_unstable","props","ref","as","action","modalType","useDialogContext_unstable","ctx","internalStyles","useDialogTitleInternalStyles","components","root","getNativeElementProps","id","dialogTitleId","resolveShorthand","required","defaultProps","children","React","createElement","DialogTrigger","disableButtonEnhancement","type","className","button","Dismiss24Regular"],"mappings":";;;;+BAgBaA;;aAAAA;;;6DAhBU;gCACe;+BACI;4BACT;+BAEH;sCACe;AAUtC,MAAMA,0BAA0B,CAACC,OAAOC,MAAQ;IACrD,MAAM,EACJC,GAAE,EACFC,OAAM,EACP,GAAGH;IACJ,MAAMI,YAAYC,IAAAA,wCAAyB,EAACC,CAAAA,MAAOA,IAAIF,SAAS;IAChE,MAAMG,iBAAiBC,IAAAA,kDAA4B;IACnD,OAAO;QACLC,YAAY;YACVC,MAAM;YACNP,QAAQ;QACV;QACAO,MAAMC,IAAAA,qCAAqB,EAACT,OAAO,IAAI,IAAIA,OAAO,KAAK,IAAIA,KAAK,IAAI,EAAE;YACpED;YACAW,IAAIP,IAAAA,wCAAyB,EAACC,CAAAA,MAAOA,IAAIO,aAAa;YACtD,GAAGb,KAAK;QACV;QACAG,QAAQW,IAAAA,gCAAgB,EAACX,QAAQ;YAC/BY,UAAUX,cAAc;YACxBY,cAAc;gBACZC,UAAU,WAAW,GAAEC,OAAMC,aAAa,CAACC,4BAAa,EAAE;oBACxDC,0BAA0B,IAAI;oBAC9BlB,QAAQ;gBACV,GAAG,WAAW,GAAEe,OAAMC,aAAa,CAAC,UAAU;oBAC5CG,MAAM;oBACNC,WAAWhB,eAAeiB,MAAM;oBAChC,iDAAiD;oBACjD,cAAc;gBAChB,GAAG,WAAW,GAAEN,OAAMC,aAAa,CAACM,4BAAgB,EAAE,IAAI;YAC5D;QACF;IACF;AACF,GACA,0CAA0C"}
|
|
@@ -29,7 +29,17 @@ const dialogTitleClassNames = {
|
|
|
29
29
|
Ijaq50: "faq1aip",
|
|
30
30
|
Br312pm: "f1m489tg",
|
|
31
31
|
nk6f5a: "fv2srd9",
|
|
32
|
-
Bw0ie65: "f1tz6hh8"
|
|
32
|
+
Bw0ie65: "f1tz6hh8",
|
|
33
|
+
B6of3ja: "f1hu3pq6",
|
|
34
|
+
t21cq0: [
|
|
35
|
+
"f11qmguv",
|
|
36
|
+
"f1tyq0we"
|
|
37
|
+
],
|
|
38
|
+
jrapky: "f19f4twv",
|
|
39
|
+
Frg6f3: [
|
|
40
|
+
"f1tyq0we",
|
|
41
|
+
"f11qmguv"
|
|
42
|
+
]
|
|
33
43
|
},
|
|
34
44
|
rootWithoutCloseButton: {
|
|
35
45
|
Ijaq50: "faq1aip",
|
|
@@ -53,6 +63,10 @@ const dialogTitleClassNames = {
|
|
|
53
63
|
".f1m489tg{grid-column-start:title;}",
|
|
54
64
|
".fv2srd9{grid-row-end:title;}",
|
|
55
65
|
".f1tz6hh8{grid-column-end:title;}",
|
|
66
|
+
".f1hu3pq6{margin-top:0;}",
|
|
67
|
+
".f11qmguv{margin-right:0;}",
|
|
68
|
+
".f1tyq0we{margin-left:0;}",
|
|
69
|
+
".f19f4twv{margin-bottom:0;}",
|
|
56
70
|
".f11nczdl{grid-row-end:close-button;}",
|
|
57
71
|
".f98d4vj{grid-column-end:close-button;}",
|
|
58
72
|
".f1hysmiz{grid-row-start:close-button;}",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../lib/components/DialogTitle/useDialogTitleStyles.js"],"sourcesContent":["import { __styles, mergeClasses, shorthands } from '@griffel/react';\nimport { typographyStyles } from '@fluentui/react-theme';\nimport { TITLE_ACTION_GRID_AREA, TITLE_GRID_AREA } from '../../contexts/constants';\nimport { createFocusOutlineStyle } from '@fluentui/react-tabster';\nexport const dialogTitleClassNames = {\n root: 'fui-DialogTitle',\n action: 'fui-DialogTitle__action'\n};\n/**\n * Styles for the root slot\n */\nconst useStyles = /*#__PURE__*/__styles({\n root: {\n Bahqtrf: \"fk6fouc\",\n Be2twd7: \"f1pp30po\",\n Bhrd7zp: \"fl43uef\",\n Bg96gwp: \"f106mvju\",\n Ijaq50: \"faq1aip\",\n Br312pm: \"f1m489tg\",\n nk6f5a: \"fv2srd9\",\n Bw0ie65: \"f1tz6hh8\"\n },\n rootWithoutCloseButton: {\n Ijaq50: \"faq1aip\",\n Br312pm: \"f1m489tg\",\n nk6f5a: \"f11nczdl\",\n Bw0ie65: \"f98d4vj\"\n },\n action: {\n Ijaq50: \"f1hysmiz\",\n Br312pm: \"f1379kmu\",\n nk6f5a: \"f11nczdl\",\n Bw0ie65: \"f98d4vj\"\n }\n}, {\n d: [\".fk6fouc{font-family:var(--fontFamilyBase);}\", \".f1pp30po{font-size:var(--fontSizeBase500);}\", \".fl43uef{font-weight:var(--fontWeightSemibold);}\", \".f106mvju{line-height:var(--lineHeightBase500);}\", \".faq1aip{grid-row-start:title;}\", \".f1m489tg{grid-column-start:title;}\", \".fv2srd9{grid-row-end:title;}\", \".f1tz6hh8{grid-column-end:title;}\", \".f11nczdl{grid-row-end:close-button;}\", \".f98d4vj{grid-column-end:close-button;}\", \".f1hysmiz{grid-row-start:close-button;}\", \".f1379kmu{grid-column-start:close-button;}\"]\n});\n/**\n * Styles to be applied on internal elements used by default action on non-modal Dialog\n * @internal\n */\nexport const useDialogTitleInternalStyles = /*#__PURE__*/__styles({\n button: {\n qhf8xq: \"f10pi13n\",\n B7ck84d: \"f1e4lqlz\",\n De3pzq: \"f1u2r49w\",\n sj55zd: \"f1ym3bx4\",\n Bahqtrf: \"f1mo0ibp\",\n Be2twd7: \"fjoy568\",\n Bceei9c: \"f1k6fduh\",\n Bg96gwp: \"fez10in\",\n B68tc82: \"f1mtd64y\",\n Bmxbyg5: \"f1y7q3j9\",\n z8tnut: \"f1g0x7ka\",\n z189sj: [\"fhxju0i\", \"f1cnd47f\"],\n Byoj8tv: \"f1qch9an\",\n uwmqm3: [\"f1cnd47f\", \"fhxju0i\"],\n icvyot: \"f1ern45e\",\n vrafjx: [\"f1n71otn\", \"f1deefiw\"],\n oivjwe: \"f1h8hb77\",\n wvpqe5: [\"f1deefiw\", \"f1n71otn\"],\n Bv0vk6g: \"f37px4s\",\n fsow6f: \"fgusgyc\",\n Brovlpu: \"ftqa4ok\",\n B486eqv: \"f2hkw1w\",\n B8q5s1w: \"f8hki3x\",\n Bci5o5g: [\"f1d2448m\", \"ffh67wi\"],\n n8qw10: \"f1bjia2o\",\n Bdrgwmp: [\"ffh67wi\", \"f1d2448m\"],\n Bm4h7ae: \"f15bsgw9\",\n B7ys5i9: \"f14e48fq\",\n Busjfv9: \"f18yb2kv\",\n Bhk32uz: \"fd6o370\",\n Bf4ptjt: \"fh1cnn4\",\n kclons: [\"fy7oxxb\", \"f184ne2d\"],\n Bhdgwq3: \"fpukqih\",\n Blkhhs4: [\"f184ne2d\", \"fy7oxxb\"],\n Bqtpl0w: \"frrh606\",\n clg4pj: [\"f1v5zibi\", \"fo2hd23\"],\n hgwjuy: \"ful5kiu\",\n Bonggc9: [\"fo2hd23\", \"f1v5zibi\"],\n B1tsrr9: [\"f1jqcqds\", \"ftffrms\"],\n Dah5zi: [\"ftffrms\", \"f1jqcqds\"],\n Bkh64rk: [\"f2e7qr6\", \"fsr1zz6\"],\n qqdqy8: [\"fsr1zz6\", \"f2e7qr6\"],\n B6dhp37: \"f1dvezut\",\n i03rao: [\"fd0oaoj\", \"f1cwg4i8\"],\n Boxcth7: \"fjvm52t\",\n Bsom6fd: [\"f1cwg4i8\", \"fd0oaoj\"],\n J0r882: \"fdiulkx\",\n Bjwuhne: \"f1yalx80\",\n Ghsupd: [\"fq22d5a\", \"f1jw7pan\"],\n Bule8hv: [\"f1jw7pan\", \"fq22d5a\"]\n }\n}, {\n d: [\".f10pi13n{position:relative;}\", \".f1e4lqlz{box-sizing:content-box;}\", \".f1u2r49w{background-color:inherit;}\", \".f1ym3bx4{color:inherit;}\", \".f1mo0ibp{font-family:inherit;}\", \".fjoy568{font-size:inherit;}\", \".f1k6fduh{cursor:pointer;}\", \".fez10in{line-height:0;}\", \".f1mtd64y{overflow-x:visible;}\", \".f1y7q3j9{overflow-y:visible;}\", \".f1g0x7ka{padding-top:0;}\", \".fhxju0i{padding-right:0;}\", \".f1cnd47f{padding-left:0;}\", \".f1qch9an{padding-bottom:0;}\", \".f1ern45e{border-top-style:none;}\", \".f1n71otn{border-right-style:none;}\", \".f1deefiw{border-left-style:none;}\", \".f1h8hb77{border-bottom-style:none;}\", \".f37px4s{-webkit-appearance:button;}\", \".fgusgyc{text-align:unset;}\", \".f8hki3x[data-fui-focus-visible]{border-top-color:transparent;}\", \".f1d2448m[data-fui-focus-visible]{border-right-color:transparent;}\", \".ffh67wi[data-fui-focus-visible]{border-left-color:transparent;}\", \".f1bjia2o[data-fui-focus-visible]{border-bottom-color:transparent;}\", \".f15bsgw9[data-fui-focus-visible]::after{content:\\\"\\\";}\", \".f14e48fq[data-fui-focus-visible]::after{position:absolute;}\", \".f18yb2kv[data-fui-focus-visible]::after{pointer-events:none;}\", \".fd6o370[data-fui-focus-visible]::after{z-index:1;}\", \".fh1cnn4[data-fui-focus-visible]::after{border-top-style:solid;}\", \".fy7oxxb[data-fui-focus-visible]::after{border-right-style:solid;}\", \".f184ne2d[data-fui-focus-visible]::after{border-left-style:solid;}\", \".fpukqih[data-fui-focus-visible]::after{border-bottom-style:solid;}\", \".frrh606[data-fui-focus-visible]::after{border-top-width:2px;}\", \".f1v5zibi[data-fui-focus-visible]::after{border-right-width:2px;}\", \".fo2hd23[data-fui-focus-visible]::after{border-left-width:2px;}\", \".ful5kiu[data-fui-focus-visible]::after{border-bottom-width:2px;}\", \".f1jqcqds[data-fui-focus-visible]::after{border-bottom-right-radius:var(--borderRadiusMedium);}\", \".ftffrms[data-fui-focus-visible]::after{border-bottom-left-radius:var(--borderRadiusMedium);}\", \".f2e7qr6[data-fui-focus-visible]::after{border-top-right-radius:var(--borderRadiusMedium);}\", \".fsr1zz6[data-fui-focus-visible]::after{border-top-left-radius:var(--borderRadiusMedium);}\", \".f1dvezut[data-fui-focus-visible]::after{border-top-color:var(--colorStrokeFocus2);}\", \".fd0oaoj[data-fui-focus-visible]::after{border-right-color:var(--colorStrokeFocus2);}\", \".f1cwg4i8[data-fui-focus-visible]::after{border-left-color:var(--colorStrokeFocus2);}\", \".fjvm52t[data-fui-focus-visible]::after{border-bottom-color:var(--colorStrokeFocus2);}\", \".fdiulkx[data-fui-focus-visible]::after{top:-2px;}\", \".f1yalx80[data-fui-focus-visible]::after{bottom:-2px;}\", \".fq22d5a[data-fui-focus-visible]::after{left:-2px;}\", \".f1jw7pan[data-fui-focus-visible]::after{right:-2px;}\"],\n f: [\".ftqa4ok:focus{outline-style:none;}\"],\n i: [\".f2hkw1w:focus-visible{outline-style:none;}\"]\n});\n/**\n * Apply styling to the DialogTitle slots based on the state\n */\nexport const useDialogTitleStyles_unstable = state => {\n const styles = useStyles();\n state.root.className = mergeClasses(dialogTitleClassNames.root, styles.root, !state.action && styles.rootWithoutCloseButton, state.root.className);\n if (state.action) {\n state.action.className = mergeClasses(dialogTitleClassNames.action, styles.action, state.action.className);\n }\n return state;\n};\n//# sourceMappingURL=useDialogTitleStyles.js.map"],"names":["dialogTitleClassNames","useDialogTitleInternalStyles","useDialogTitleStyles_unstable","root","action","useStyles","__styles","Bahqtrf","Be2twd7","Bhrd7zp","Bg96gwp","Ijaq50","Br312pm","nk6f5a","Bw0ie65","rootWithoutCloseButton","d","button","qhf8xq","B7ck84d","De3pzq","sj55zd","Bceei9c","B68tc82","Bmxbyg5","z8tnut","z189sj","Byoj8tv","uwmqm3","icvyot","vrafjx","oivjwe","wvpqe5","Bv0vk6g","fsow6f","Brovlpu","B486eqv","B8q5s1w","Bci5o5g","n8qw10","Bdrgwmp","Bm4h7ae","B7ys5i9","Busjfv9","Bhk32uz","Bf4ptjt","kclons","Bhdgwq3","Blkhhs4","Bqtpl0w","clg4pj","hgwjuy","Bonggc9","B1tsrr9","Dah5zi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ACjJ,IAAIF,MAAM/D,MAAM,EAAE;QAChB+D,MAAM/D,MAAM,CAACiE,SAAS,GAAGC,IAAAA,mBAAY,EAACtE,sBAAsBI,MAAM,EAAEgE,OAAOhE,MAAM,EAAE+D,MAAM/D,MAAM,CAACiE,SAAS;IAC3G,CAAC;IACD,OAAOF;AACT,GACA,gDAAgD"}
|
|
1
|
+
{"version":3,"sources":["../../../lib/components/DialogTitle/useDialogTitleStyles.js"],"sourcesContent":["import { __styles, mergeClasses, shorthands } from '@griffel/react';\nimport { typographyStyles } from '@fluentui/react-theme';\nimport { TITLE_ACTION_GRID_AREA, TITLE_GRID_AREA } from '../../contexts/constants';\nimport { createFocusOutlineStyle } from '@fluentui/react-tabster';\nexport const dialogTitleClassNames = {\n root: 'fui-DialogTitle',\n action: 'fui-DialogTitle__action'\n};\n/**\n * Styles for the root slot\n */\nconst useStyles = /*#__PURE__*/__styles({\n root: {\n Bahqtrf: \"fk6fouc\",\n Be2twd7: \"f1pp30po\",\n Bhrd7zp: \"fl43uef\",\n Bg96gwp: \"f106mvju\",\n Ijaq50: \"faq1aip\",\n Br312pm: \"f1m489tg\",\n nk6f5a: \"fv2srd9\",\n Bw0ie65: \"f1tz6hh8\",\n B6of3ja: \"f1hu3pq6\",\n t21cq0: [\"f11qmguv\", \"f1tyq0we\"],\n jrapky: \"f19f4twv\",\n Frg6f3: [\"f1tyq0we\", \"f11qmguv\"]\n },\n rootWithoutCloseButton: {\n Ijaq50: \"faq1aip\",\n Br312pm: \"f1m489tg\",\n nk6f5a: \"f11nczdl\",\n Bw0ie65: \"f98d4vj\"\n },\n action: {\n Ijaq50: \"f1hysmiz\",\n Br312pm: \"f1379kmu\",\n nk6f5a: \"f11nczdl\",\n Bw0ie65: \"f98d4vj\"\n }\n}, {\n d: [\".fk6fouc{font-family:var(--fontFamilyBase);}\", \".f1pp30po{font-size:var(--fontSizeBase500);}\", \".fl43uef{font-weight:var(--fontWeightSemibold);}\", \".f106mvju{line-height:var(--lineHeightBase500);}\", \".faq1aip{grid-row-start:title;}\", \".f1m489tg{grid-column-start:title;}\", \".fv2srd9{grid-row-end:title;}\", \".f1tz6hh8{grid-column-end:title;}\", \".f1hu3pq6{margin-top:0;}\", \".f11qmguv{margin-right:0;}\", \".f1tyq0we{margin-left:0;}\", \".f19f4twv{margin-bottom:0;}\", \".f11nczdl{grid-row-end:close-button;}\", \".f98d4vj{grid-column-end:close-button;}\", \".f1hysmiz{grid-row-start:close-button;}\", \".f1379kmu{grid-column-start:close-button;}\"]\n});\n/**\n * Styles to be applied on internal elements used by default action on non-modal Dialog\n * @internal\n */\nexport const useDialogTitleInternalStyles = /*#__PURE__*/__styles({\n button: {\n qhf8xq: \"f10pi13n\",\n B7ck84d: \"f1e4lqlz\",\n De3pzq: \"f1u2r49w\",\n sj55zd: \"f1ym3bx4\",\n Bahqtrf: \"f1mo0ibp\",\n Be2twd7: \"fjoy568\",\n Bceei9c: \"f1k6fduh\",\n Bg96gwp: \"fez10in\",\n B68tc82: \"f1mtd64y\",\n Bmxbyg5: \"f1y7q3j9\",\n z8tnut: \"f1g0x7ka\",\n z189sj: [\"fhxju0i\", \"f1cnd47f\"],\n Byoj8tv: \"f1qch9an\",\n uwmqm3: [\"f1cnd47f\", \"fhxju0i\"],\n icvyot: \"f1ern45e\",\n vrafjx: [\"f1n71otn\", \"f1deefiw\"],\n oivjwe: \"f1h8hb77\",\n wvpqe5: [\"f1deefiw\", \"f1n71otn\"],\n Bv0vk6g: \"f37px4s\",\n fsow6f: \"fgusgyc\",\n Brovlpu: \"ftqa4ok\",\n B486eqv: \"f2hkw1w\",\n B8q5s1w: \"f8hki3x\",\n Bci5o5g: [\"f1d2448m\", \"ffh67wi\"],\n n8qw10: \"f1bjia2o\",\n Bdrgwmp: [\"ffh67wi\", \"f1d2448m\"],\n Bm4h7ae: \"f15bsgw9\",\n B7ys5i9: \"f14e48fq\",\n Busjfv9: \"f18yb2kv\",\n Bhk32uz: \"fd6o370\",\n Bf4ptjt: \"fh1cnn4\",\n kclons: [\"fy7oxxb\", \"f184ne2d\"],\n Bhdgwq3: \"fpukqih\",\n Blkhhs4: [\"f184ne2d\", \"fy7oxxb\"],\n Bqtpl0w: \"frrh606\",\n clg4pj: [\"f1v5zibi\", \"fo2hd23\"],\n hgwjuy: \"ful5kiu\",\n Bonggc9: [\"fo2hd23\", \"f1v5zibi\"],\n B1tsrr9: [\"f1jqcqds\", \"ftffrms\"],\n Dah5zi: [\"ftffrms\", \"f1jqcqds\"],\n Bkh64rk: [\"f2e7qr6\", \"fsr1zz6\"],\n qqdqy8: [\"fsr1zz6\", \"f2e7qr6\"],\n B6dhp37: \"f1dvezut\",\n i03rao: [\"fd0oaoj\", \"f1cwg4i8\"],\n Boxcth7: \"fjvm52t\",\n Bsom6fd: [\"f1cwg4i8\", \"fd0oaoj\"],\n J0r882: \"fdiulkx\",\n Bjwuhne: \"f1yalx80\",\n Ghsupd: [\"fq22d5a\", \"f1jw7pan\"],\n Bule8hv: [\"f1jw7pan\", \"fq22d5a\"]\n }\n}, {\n d: [\".f10pi13n{position:relative;}\", \".f1e4lqlz{box-sizing:content-box;}\", \".f1u2r49w{background-color:inherit;}\", \".f1ym3bx4{color:inherit;}\", \".f1mo0ibp{font-family:inherit;}\", \".fjoy568{font-size:inherit;}\", \".f1k6fduh{cursor:pointer;}\", \".fez10in{line-height:0;}\", \".f1mtd64y{overflow-x:visible;}\", \".f1y7q3j9{overflow-y:visible;}\", \".f1g0x7ka{padding-top:0;}\", \".fhxju0i{padding-right:0;}\", \".f1cnd47f{padding-left:0;}\", \".f1qch9an{padding-bottom:0;}\", \".f1ern45e{border-top-style:none;}\", \".f1n71otn{border-right-style:none;}\", \".f1deefiw{border-left-style:none;}\", \".f1h8hb77{border-bottom-style:none;}\", \".f37px4s{-webkit-appearance:button;}\", \".fgusgyc{text-align:unset;}\", \".f8hki3x[data-fui-focus-visible]{border-top-color:transparent;}\", \".f1d2448m[data-fui-focus-visible]{border-right-color:transparent;}\", \".ffh67wi[data-fui-focus-visible]{border-left-color:transparent;}\", \".f1bjia2o[data-fui-focus-visible]{border-bottom-color:transparent;}\", \".f15bsgw9[data-fui-focus-visible]::after{content:\\\"\\\";}\", \".f14e48fq[data-fui-focus-visible]::after{position:absolute;}\", \".f18yb2kv[data-fui-focus-visible]::after{pointer-events:none;}\", \".fd6o370[data-fui-focus-visible]::after{z-index:1;}\", \".fh1cnn4[data-fui-focus-visible]::after{border-top-style:solid;}\", \".fy7oxxb[data-fui-focus-visible]::after{border-right-style:solid;}\", \".f184ne2d[data-fui-focus-visible]::after{border-left-style:solid;}\", \".fpukqih[data-fui-focus-visible]::after{border-bottom-style:solid;}\", \".frrh606[data-fui-focus-visible]::after{border-top-width:2px;}\", \".f1v5zibi[data-fui-focus-visible]::after{border-right-width:2px;}\", \".fo2hd23[data-fui-focus-visible]::after{border-left-width:2px;}\", \".ful5kiu[data-fui-focus-visible]::after{border-bottom-width:2px;}\", \".f1jqcqds[data-fui-focus-visible]::after{border-bottom-right-radius:var(--borderRadiusMedium);}\", \".ftffrms[data-fui-focus-visible]::after{border-bottom-left-radius:var(--borderRadiusMedium);}\", \".f2e7qr6[data-fui-focus-visible]::after{border-top-right-radius:var(--borderRadiusMedium);}\", \".fsr1zz6[data-fui-focus-visible]::after{border-top-left-radius:var(--borderRadiusMedium);}\", \".f1dvezut[data-fui-focus-visible]::after{border-top-color:var(--colorStrokeFocus2);}\", \".fd0oaoj[data-fui-focus-visible]::after{border-right-color:var(--colorStrokeFocus2);}\", \".f1cwg4i8[data-fui-focus-visible]::after{border-left-color:var(--colorStrokeFocus2);}\", \".fjvm52t[data-fui-focus-visible]::after{border-bottom-color:var(--colorStrokeFocus2);}\", \".fdiulkx[data-fui-focus-visible]::after{top:-2px;}\", \".f1yalx80[data-fui-focus-visible]::after{bottom:-2px;}\", \".fq22d5a[data-fui-focus-visible]::after{left:-2px;}\", \".f1jw7pan[data-fui-focus-visible]::after{right:-2px;}\"],\n f: [\".ftqa4ok:focus{outline-style:none;}\"],\n i: [\".f2hkw1w:focus-visible{outline-style:none;}\"]\n});\n/**\n * Apply styling to the DialogTitle slots based on the state\n */\nexport const useDialogTitleStyles_unstable = state => {\n const styles = useStyles();\n state.root.className = mergeClasses(dialogTitleClassNames.root, styles.root, !state.action && styles.rootWithoutCloseButton, state.root.className);\n if (state.action) {\n state.action.className = mergeClasses(dialogTitleClassNames.action, styles.action, state.action.className);\n }\n return state;\n};\n//# sourceMappingURL=useDialogTitleStyles.js.map"],"names":["dialogTitleClassNames","useDialogTitleInternalStyles","useDialogTitleStyles_unstable","root","action","useStyles","__styles","Bahqtrf","Be2twd7","Bhrd7zp","Bg96gwp","Ijaq50","Br312pm","nk6f5a","Bw0ie65","B6of3ja","t21cq0","jrapky","Frg6f3","rootWithoutCloseButton","d","button","qhf8xq","B7ck84d","De3pzq","sj55zd","Bceei9c","B68tc82","Bmxbyg5","z8tnut","z189sj","Byoj8tv","uwmqm3","icvyot","vrafjx","oivjwe","wvpqe5","Bv0vk6g","fsow6f","Brovlpu","B486eqv","B8q5s1w","Bci5o5g","n8qw10","Bdrgwmp","Bm4h7ae","B7ys5i9","Busjfv9","Bhk32uz","Bf4ptjt","kclons","Bhdgwq3","Blkhhs4","Bqtpl0w","clg4pj","hgwjuy","Bonggc9","B1tsrr9","Dah5zi","Bkh64rk","qqdqy8","B6dhp37","i03rao","Boxcth7","Bsom6fd","J0r882","Bjwuhne","Ghsupd","Bule8hv","f","i","state","styles","className","mergeClasses"],"mappings":";;;;;;;;;;;IAIaA,qBAAqB,MAArBA;IAyCAC,4BAA4B,MAA5BA;IA6DAC,6BAA6B,MAA7BA;;uBA1GsC;AAI5C,MAAMF,wBAAwB;IACnCG,MAAM;IACNC,QAAQ;AACV;AACA;;CAEC,GACD,MAAMC,YAAY,WAAW,GAAEC,IAAAA,kBAAQ,EAAC;IACtCH,MAAM;QACJI,SAAS;QACTC,SAAS;QACTC,SAAS;QACTC,SAAS;QACTC,QAAQ;QACRC,SAAS;QACTC,QA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|
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
|
10
10
|
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
|
11
|
-
const _reactTabster = require("@fluentui/react-tabster");
|
|
12
11
|
const _reactUtilities = require("@fluentui/react-utilities");
|
|
13
12
|
const _contexts = require("../../contexts");
|
|
14
13
|
const _reactAria = require("@fluentui/react-aria");
|
|
@@ -17,7 +16,7 @@ const useDialogTrigger_unstable = (props)=>{
|
|
|
17
16
|
const { children , disableButtonEnhancement =false , action =isInsideSurfaceDialog ? 'close' : 'open' } = props;
|
|
18
17
|
const child = (0, _reactUtilities.getTriggerChild)(children);
|
|
19
18
|
const requestOpenChange = (0, _contexts.useDialogContext_unstable)((ctx)=>ctx.requestOpenChange);
|
|
20
|
-
const
|
|
19
|
+
const triggerAttributes = (0, _contexts.useDialogContext_unstable)((ctx)=>ctx.triggerAttributes);
|
|
21
20
|
const handleClick = (0, _reactUtilities.useEventCallback)((event)=>{
|
|
22
21
|
var _child_props, _child_props_onClick;
|
|
23
22
|
(_child_props_onClick = (_child_props = child === null || child === void 0 ? void 0 : child.props).onClick) === null || _child_props_onClick === void 0 ? void 0 : _child_props_onClick.call(_child_props, event);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../lib/components/DialogTrigger/useDialogTrigger.js"],"sourcesContent":["import * as React from 'react';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../lib/components/DialogTrigger/useDialogTrigger.js"],"sourcesContent":["import * as React from 'react';\nimport { applyTriggerPropsToChildren, getTriggerChild, useEventCallback } from '@fluentui/react-utilities';\nimport { useDialogContext_unstable, useDialogSurfaceContext_unstable } from '../../contexts';\nimport { useARIAButtonProps } from '@fluentui/react-aria';\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 => {\n const isInsideSurfaceDialog = useDialogSurfaceContext_unstable();\n const {\n children,\n disableButtonEnhancement = false,\n action = isInsideSurfaceDialog ? 'close' : 'open'\n } = props;\n const child = getTriggerChild(children);\n const requestOpenChange = useDialogContext_unstable(ctx => ctx.requestOpenChange);\n const triggerAttributes = useDialogContext_unstable(ctx => ctx.triggerAttributes);\n const handleClick = useEventCallback(event => {\n var _child_props, _child_props_onClick;\n (_child_props_onClick = (_child_props = child === null || child === void 0 ? void 0 : child.props).onClick) === null || _child_props_onClick === void 0 ? void 0 : _child_props_onClick.call(_child_props, event);\n if (!event.isDefaultPrevented()) {\n requestOpenChange({\n event,\n type: 'triggerClick',\n open: action === 'open'\n });\n }\n });\n const triggerChildProps = {\n ...(child === null || child === void 0 ? void 0 : child.props),\n ref: child === null || child === void 0 ? void 0 : child.ref,\n onClick: handleClick,\n ...triggerAttributes\n };\n const ariaButtonTriggerChildProps = useARIAButtonProps((child === null || child === void 0 ? void 0 : child.type) === 'button' || (child === null || child === void 0 ? void 0 : child.type) === 'a' ? child.type : 'div', {\n ...triggerChildProps,\n type: 'button'\n });\n return {\n children: applyTriggerPropsToChildren(children, disableButtonEnhancement ? triggerChildProps : ariaButtonTriggerChildProps)\n };\n};\n//# sourceMappingURL=useDialogTrigger.js.map"],"names":["useDialogTrigger_unstable","props","isInsideSurfaceDialog","useDialogSurfaceContext_unstable","children","disableButtonEnhancement","action","child","getTriggerChild","requestOpenChange","useDialogContext_unstable","ctx","triggerAttributes","handleClick","useEventCallback","event","_child_props","_child_props_onClick","onClick","call","isDefaultPrevented","type","open","triggerChildProps","ref","ariaButtonTriggerChildProps","useARIAButtonProps","applyTriggerPropsToChildren"],"mappings":";;;;+BAUaA;;aAAAA;;;6DAVU;gCACwD;0BACH;2BACzC;AAO5B,MAAMA,4BAA4BC,CAAAA,QAAS;IAChD,MAAMC,wBAAwBC,IAAAA,0CAAgC;IAC9D,MAAM,EACJC,SAAQ,EACRC,0BAA2B,KAAK,CAAA,EAChCC,QAASJ,wBAAwB,UAAU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kB,oBAAoBE,2BAA2B;IAC5H;AACF,GACA,4CAA4C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-dialog",
|
|
3
|
-
"version": "9.5.
|
|
3
|
+
"version": "9.5.3",
|
|
4
4
|
"description": "Dialog component for Fluent UI React",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@griffel/react": "^1.5.2",
|
|
39
39
|
"@fluentui/react-utilities": "^9.8.0",
|
|
40
|
-
"@fluentui/react-jsx-runtime": "
|
|
40
|
+
"@fluentui/react-jsx-runtime": "9.0.0-alpha.2",
|
|
41
41
|
"@fluentui/keyboard-keys": "^9.0.2",
|
|
42
42
|
"@fluentui/react-context-selector": "^9.1.18",
|
|
43
43
|
"@fluentui/react-shared-contexts": "^9.3.3",
|