@fluentui/react-dialog 9.5.26 → 9.6.1
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 +139 -1
- package/CHANGELOG.md +38 -2
- package/dist/index.d.ts +3 -2
- package/lib/components/Dialog/Dialog.js.map +1 -1
- package/lib/components/Dialog/renderDialog.js +12 -7
- package/lib/components/Dialog/renderDialog.js.map +1 -1
- package/lib/components/Dialog/useDialog.js +7 -4
- package/lib/components/Dialog/useDialog.js.map +1 -1
- package/lib/components/Dialog/useDialogContextValues.js +1 -1
- package/lib/components/Dialog/useDialogContextValues.js.map +1 -1
- package/lib/components/DialogActions/DialogActions.js.map +1 -1
- package/lib/components/DialogActions/renderDialogActions.js +2 -2
- package/lib/components/DialogActions/renderDialogActions.js.map +1 -1
- package/lib/components/DialogActions/useDialogActions.js +1 -1
- package/lib/components/DialogActions/useDialogActions.js.map +1 -1
- package/lib/components/DialogActions/useDialogActionsStyles.styles.js +12 -2
- package/lib/components/DialogActions/useDialogActionsStyles.styles.js.map +1 -1
- package/lib/components/DialogBody/DialogBody.js.map +1 -1
- package/lib/components/DialogBody/renderDialogBody.js +2 -2
- package/lib/components/DialogBody/renderDialogBody.js.map +1 -1
- package/lib/components/DialogBody/useDialogBody.js.map +1 -1
- package/lib/components/DialogContent/DialogContent.js.map +1 -1
- package/lib/components/DialogContent/renderDialogContent.js +2 -2
- package/lib/components/DialogContent/renderDialogContent.js.map +1 -1
- package/lib/components/DialogContent/useDialogContent.js.map +1 -1
- package/lib/components/DialogSurface/DialogSurface.js.map +1 -1
- package/lib/components/DialogSurface/DialogSurface.types.js.map +1 -1
- package/lib/components/DialogSurface/renderDialogSurface.js +11 -4
- package/lib/components/DialogSurface/renderDialogSurface.js.map +1 -1
- package/lib/components/DialogSurface/useDialogSurface.js +4 -3
- package/lib/components/DialogSurface/useDialogSurface.js.map +1 -1
- package/lib/components/DialogSurface/useDialogSurfaceContextValues.js.map +1 -1
- package/lib/components/DialogTitle/DialogTitle.js.map +1 -1
- package/lib/components/DialogTitle/renderDialogTitle.js +9 -2
- package/lib/components/DialogTitle/renderDialogTitle.js.map +1 -1
- package/lib/components/DialogTitle/useDialogTitle.js +1 -1
- package/lib/components/DialogTitle/useDialogTitle.js.map +1 -1
- package/lib/components/DialogTrigger/DialogTrigger.js.map +1 -1
- package/lib/components/DialogTrigger/useDialogTrigger.js +8 -7
- package/lib/components/DialogTrigger/useDialogTrigger.js.map +1 -1
- package/lib/contexts/dialogContext.js.map +1 -1
- package/lib/contexts/dialogSurfaceContext.js.map +1 -1
- package/lib/utils/useDisableBodyScroll.js +2 -2
- package/lib/utils/useDisableBodyScroll.js.map +1 -1
- package/lib/utils/useFocusFirstElement.js +5 -6
- package/lib/utils/useFocusFirstElement.js.map +1 -1
- package/lib-commonjs/Dialog.js +2 -2
- package/lib-commonjs/Dialog.js.map +1 -1
- package/lib-commonjs/DialogActions.js +2 -2
- package/lib-commonjs/DialogActions.js.map +1 -1
- package/lib-commonjs/DialogBody.js +2 -2
- package/lib-commonjs/DialogBody.js.map +1 -1
- package/lib-commonjs/DialogContent.js +2 -2
- package/lib-commonjs/DialogContent.js.map +1 -1
- package/lib-commonjs/DialogSurface.js +2 -2
- package/lib-commonjs/DialogSurface.js.map +1 -1
- package/lib-commonjs/DialogTitle.js +2 -2
- package/lib-commonjs/DialogTitle.js.map +1 -1
- package/lib-commonjs/DialogTrigger.js +2 -2
- package/lib-commonjs/DialogTrigger.js.map +1 -1
- package/lib-commonjs/components/Dialog/Dialog.js +5 -3
- package/lib-commonjs/components/Dialog/Dialog.js.map +1 -1
- package/lib-commonjs/components/Dialog/index.js +5 -5
- package/lib-commonjs/components/Dialog/index.js.map +1 -1
- package/lib-commonjs/components/Dialog/renderDialog.js +16 -9
- package/lib-commonjs/components/Dialog/renderDialog.js.map +1 -1
- package/lib-commonjs/components/Dialog/useDialog.js +20 -15
- package/lib-commonjs/components/Dialog/useDialog.js.map +1 -1
- package/lib-commonjs/components/Dialog/useDialogContextValues.js +4 -2
- package/lib-commonjs/components/Dialog/useDialogContextValues.js.map +1 -1
- package/lib-commonjs/components/DialogActions/DialogActions.js +9 -7
- package/lib-commonjs/components/DialogActions/DialogActions.js.map +1 -1
- package/lib-commonjs/components/DialogActions/index.js +6 -6
- package/lib-commonjs/components/DialogActions/index.js.map +1 -1
- package/lib-commonjs/components/DialogActions/renderDialogActions.js +8 -6
- package/lib-commonjs/components/DialogActions/renderDialogActions.js.map +1 -1
- package/lib-commonjs/components/DialogActions/useDialogActions.js +8 -6
- package/lib-commonjs/components/DialogActions/useDialogActions.js.map +1 -1
- package/lib-commonjs/components/DialogActions/useDialogActionsStyles.styles.js +31 -5
- package/lib-commonjs/components/DialogActions/useDialogActionsStyles.styles.js.map +1 -1
- package/lib-commonjs/components/DialogBody/DialogBody.js +9 -7
- package/lib-commonjs/components/DialogBody/DialogBody.js.map +1 -1
- package/lib-commonjs/components/DialogBody/index.js +6 -6
- package/lib-commonjs/components/DialogBody/index.js.map +1 -1
- package/lib-commonjs/components/DialogBody/renderDialogBody.js +8 -6
- package/lib-commonjs/components/DialogBody/renderDialogBody.js.map +1 -1
- package/lib-commonjs/components/DialogBody/useDialogBody.js +7 -5
- package/lib-commonjs/components/DialogBody/useDialogBody.js.map +1 -1
- package/lib-commonjs/components/DialogBody/useDialogBodyStyles.styles.js +7 -3
- package/lib-commonjs/components/DialogBody/useDialogBodyStyles.styles.js.map +1 -1
- package/lib-commonjs/components/DialogContent/DialogContent.js +9 -7
- package/lib-commonjs/components/DialogContent/DialogContent.js.map +1 -1
- package/lib-commonjs/components/DialogContent/index.js +6 -6
- package/lib-commonjs/components/DialogContent/index.js.map +1 -1
- package/lib-commonjs/components/DialogContent/renderDialogContent.js +8 -6
- package/lib-commonjs/components/DialogContent/renderDialogContent.js.map +1 -1
- package/lib-commonjs/components/DialogContent/useDialogContent.js +7 -5
- package/lib-commonjs/components/DialogContent/useDialogContent.js.map +1 -1
- package/lib-commonjs/components/DialogContent/useDialogContentStyles.styles.js +7 -3
- package/lib-commonjs/components/DialogContent/useDialogContentStyles.styles.js.map +1 -1
- package/lib-commonjs/components/DialogSurface/DialogSurface.js +9 -7
- package/lib-commonjs/components/DialogSurface/DialogSurface.js.map +1 -1
- package/lib-commonjs/components/DialogSurface/index.js +6 -6
- package/lib-commonjs/components/DialogSurface/index.js.map +1 -1
- package/lib-commonjs/components/DialogSurface/renderDialogSurface.js +18 -9
- package/lib-commonjs/components/DialogSurface/renderDialogSurface.js.map +1 -1
- package/lib-commonjs/components/DialogSurface/useDialogSurface.js +18 -15
- package/lib-commonjs/components/DialogSurface/useDialogSurface.js.map +1 -1
- package/lib-commonjs/components/DialogSurface/useDialogSurfaceContextValues.js +3 -1
- package/lib-commonjs/components/DialogSurface/useDialogSurfaceContextValues.js.map +1 -1
- package/lib-commonjs/components/DialogSurface/useDialogSurfaceStyles.styles.js +7 -3
- package/lib-commonjs/components/DialogSurface/useDialogSurfaceStyles.styles.js.map +1 -1
- package/lib-commonjs/components/DialogTitle/DialogTitle.js +9 -7
- package/lib-commonjs/components/DialogTitle/DialogTitle.js.map +1 -1
- package/lib-commonjs/components/DialogTitle/index.js +6 -6
- package/lib-commonjs/components/DialogTitle/index.js.map +1 -1
- package/lib-commonjs/components/DialogTitle/renderDialogTitle.js +15 -6
- package/lib-commonjs/components/DialogTitle/renderDialogTitle.js.map +1 -1
- package/lib-commonjs/components/DialogTitle/useDialogTitle.js +15 -13
- package/lib-commonjs/components/DialogTitle/useDialogTitle.js.map +1 -1
- package/lib-commonjs/components/DialogTitle/useDialogTitleStyles.styles.js +11 -5
- package/lib-commonjs/components/DialogTitle/useDialogTitleStyles.styles.js.map +1 -1
- package/lib-commonjs/components/DialogTrigger/DialogTrigger.js +5 -3
- package/lib-commonjs/components/DialogTrigger/DialogTrigger.js.map +1 -1
- package/lib-commonjs/components/DialogTrigger/DialogTrigger.types.js +2 -2
- package/lib-commonjs/components/DialogTrigger/DialogTrigger.types.js.map +1 -1
- package/lib-commonjs/components/DialogTrigger/index.js +5 -5
- package/lib-commonjs/components/DialogTrigger/index.js.map +1 -1
- package/lib-commonjs/components/DialogTrigger/renderDialogTrigger.js +3 -1
- package/lib-commonjs/components/DialogTrigger/renderDialogTrigger.js.map +1 -1
- package/lib-commonjs/components/DialogTrigger/useDialogTrigger.js +19 -16
- package/lib-commonjs/components/DialogTrigger/useDialogTrigger.js.map +1 -1
- package/lib-commonjs/contexts/constants.js +12 -4
- package/lib-commonjs/contexts/constants.js.map +1 -1
- package/lib-commonjs/contexts/dialogContext.js +14 -8
- package/lib-commonjs/contexts/dialogContext.js.map +1 -1
- package/lib-commonjs/contexts/dialogSurfaceContext.js +9 -3
- package/lib-commonjs/contexts/dialogSurfaceContext.js.map +1 -1
- package/lib-commonjs/contexts/index.js +4 -4
- package/lib-commonjs/contexts/index.js.map +1 -1
- package/lib-commonjs/index.js +100 -38
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utils/index.js +3 -3
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/useDisableBodyScroll.js +9 -5
- package/lib-commonjs/utils/useDisableBodyScroll.js.map +1 -1
- package/lib-commonjs/utils/useFocusFirstElement.js +12 -11
- package/lib-commonjs/utils/useFocusFirstElement.js.map +1 -1
- package/package.json +15 -15
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @jsxRuntime
|
|
1
|
+
/** @jsxRuntime automatic */ /** @jsxImportSource @fluentui/react-jsx-runtime */ import { jsx as _jsx, jsxs as _jsxs } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
2
|
import { assertSlots } from '@fluentui/react-utilities';
|
|
3
3
|
import { DialogSurfaceProvider } from '../../contexts';
|
|
4
4
|
import { Portal } from '@fluentui/react-portal';
|
|
@@ -6,7 +6,14 @@ import { Portal } from '@fluentui/react-portal';
|
|
|
6
6
|
* Render the final JSX of DialogSurface
|
|
7
7
|
*/ export const renderDialogSurface_unstable = (state, contextValues)=>{
|
|
8
8
|
assertSlots(state);
|
|
9
|
-
return /*#__PURE__*/
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
return /*#__PURE__*/ _jsxs(Portal, {
|
|
10
|
+
mountNode: state.mountNode,
|
|
11
|
+
children: [
|
|
12
|
+
state.backdrop && /*#__PURE__*/ _jsx(state.backdrop, {}),
|
|
13
|
+
/*#__PURE__*/ _jsx(DialogSurfaceProvider, {
|
|
14
|
+
value: contextValues.dialogSurface,
|
|
15
|
+
children: /*#__PURE__*/ _jsx(state.root, {})
|
|
16
|
+
})
|
|
17
|
+
]
|
|
18
|
+
});
|
|
12
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderDialogSurface.tsx"],"sourcesContent":["/** @jsxRuntime
|
|
1
|
+
{"version":3,"sources":["renderDialogSurface.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { DialogSurfaceState, DialogSurfaceSlots, DialogSurfaceContextValues } from './DialogSurface.types';\nimport { DialogSurfaceProvider } from '../../contexts';\nimport { Portal } from '@fluentui/react-portal';\n\n/**\n * Render the final JSX of DialogSurface\n */\nexport const renderDialogSurface_unstable = (state: DialogSurfaceState, contextValues: DialogSurfaceContextValues) => {\n assertSlots<DialogSurfaceSlots>(state);\n\n return (\n <Portal mountNode={state.mountNode}>\n {state.backdrop && <state.backdrop />}\n <DialogSurfaceProvider value={contextValues.dialogSurface}>\n <state.root />\n </DialogSurfaceProvider>\n </Portal>\n );\n};\n"],"names":["assertSlots","DialogSurfaceProvider","Portal","renderDialogSurface_unstable","state","contextValues","mountNode","backdrop","value","dialogSurface","root"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAExD,SAASC,qBAAqB,QAAQ,iBAAiB;AACvD,SAASC,MAAM,QAAQ,yBAAyB;AAEhD;;CAEC,GACD,OAAO,MAAMC,+BAA+B,CAACC,OAA2BC;IACtEL,YAAgCI;IAEhC,qBACE,MAACF;QAAOI,WAAWF,MAAME,SAAS;;YAC/BF,MAAMG,QAAQ,kBAAI,KAACH,MAAMG,QAAQ;0BAClC,KAACN;gBAAsBO,OAAOH,cAAcI,aAAa;0BACvD,cAAA,KAACL,MAAMM,IAAI;;;;AAInB,EAAE"}
|
|
@@ -19,7 +19,7 @@ import { Escape } from '@fluentui/keyboard-keys';
|
|
|
19
19
|
const dialogTitleID = useDialogContext_unstable((ctx)=>ctx.dialogTitleId);
|
|
20
20
|
const handledBackdropClick = useEventCallback((event)=>{
|
|
21
21
|
if (isResolvedShorthand(props.backdrop)) {
|
|
22
|
-
var
|
|
22
|
+
var _props_backdrop_onClick, _props_backdrop;
|
|
23
23
|
(_props_backdrop_onClick = (_props_backdrop = props.backdrop).onClick) === null || _props_backdrop_onClick === void 0 ? void 0 : _props_backdrop_onClick.call(_props_backdrop, event);
|
|
24
24
|
}
|
|
25
25
|
if (modalType === 'modal' && !event.isDefaultPrevented()) {
|
|
@@ -31,8 +31,8 @@ import { Escape } from '@fluentui/keyboard-keys';
|
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
33
|
const handleKeyDown = useEventCallback((event)=>{
|
|
34
|
-
var _props_onKeyDown;
|
|
35
|
-
(_props_onKeyDown = props.onKeyDown) === null || _props_onKeyDown === void 0 ? void 0 : _props_onKeyDown.call(
|
|
34
|
+
var _props_onKeyDown, _props;
|
|
35
|
+
(_props_onKeyDown = (_props = props).onKeyDown) === null || _props_onKeyDown === void 0 ? void 0 : _props_onKeyDown.call(_props, event);
|
|
36
36
|
if (event.key === Escape && !event.isDefaultPrevented()) {
|
|
37
37
|
requestOpenChange({
|
|
38
38
|
event,
|
|
@@ -61,6 +61,7 @@ import { Escape } from '@fluentui/keyboard-keys';
|
|
|
61
61
|
root: 'div'
|
|
62
62
|
},
|
|
63
63
|
backdrop,
|
|
64
|
+
mountNode: props.mountNode,
|
|
64
65
|
root: slot.always(getNativeElementProps((_props_as = props.as) !== null && _props_as !== void 0 ? _props_as : 'div', {
|
|
65
66
|
tabIndex: -1,
|
|
66
67
|
'aria-modal': modalType !== 'non-modal',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useDialogSurface.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n getNativeElementProps,\n useEventCallback,\n useMergedRefs,\n isResolvedShorthand,\n slot,\n} from '@fluentui/react-utilities';\nimport type { DialogSurfaceElement, DialogSurfaceProps, DialogSurfaceState } from './DialogSurface.types';\nimport { useDialogContext_unstable } from '../../contexts';\nimport { Escape } from '@fluentui/keyboard-keys';\n\n/**\n * Create the state required to render DialogSurface.\n *\n * The returned state can be modified with hooks such as useDialogSurfaceStyles_unstable,\n * before being passed to renderDialogSurface_unstable.\n *\n * @param props - props from this instance of DialogSurface\n * @param ref - reference to root HTMLElement of DialogSurface\n */\nexport const useDialogSurface_unstable = (\n props: DialogSurfaceProps,\n ref: React.Ref<DialogSurfaceElement>,\n): DialogSurfaceState => {\n const modalType = useDialogContext_unstable(ctx => ctx.modalType);\n const 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 (event.key === Escape && !event.isDefaultPrevented()) {\n requestOpenChange({\n event,\n open: false,\n type: 'escapeKeyDown',\n });\n // stop propagation to avoid conflicting with other elements that listen for `Escape`\n // e,g: nested Dialog, Popover, Menu and Tooltip\n event.stopPropagation();\n }\n });\n\n const backdrop = slot.optional(props.backdrop, {\n renderByDefault: open && modalType !== 'non-modal',\n defaultProps: {\n 'aria-hidden': 'true',\n },\n elementType: 'div',\n });\n if (backdrop) {\n backdrop.onClick = handledBackdropClick;\n }\n return {\n components: { backdrop: 'div', root: 'div' },\n backdrop,\n root: slot.always(\n getNativeElementProps(props.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 { elementType: 'div' },\n ),\n };\n};\n"],"names":["React","getNativeElementProps","useEventCallback","useMergedRefs","isResolvedShorthand","slot","useDialogContext_unstable","Escape","useDialogSurface_unstable","props","ref","modalType","ctx","modalAttributes","dialogRef","open","requestOpenChange","dialogTitleID","dialogTitleId","handledBackdropClick","event","backdrop","onClick","isDefaultPrevented","type","handleKeyDown","onKeyDown","key","stopPropagation","optional","renderByDefault","defaultProps","elementType","components","root","always","as","tabIndex","role","undefined"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SACEC,qBAAqB,EACrBC,gBAAgB,EAChBC,aAAa,EACbC,mBAAmB,EACnBC,IAAI,QACC,4BAA4B;AAEnC,SAASC,yBAAyB,QAAQ,iBAAiB;AAC3D,SAASC,MAAM,QAAQ,0BAA0B;AAEjD;;;;;;;;CAQC,GACD,OAAO,MAAMC,4BAA4B,CACvCC,OACAC
|
|
1
|
+
{"version":3,"sources":["useDialogSurface.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n getNativeElementProps,\n useEventCallback,\n useMergedRefs,\n isResolvedShorthand,\n slot,\n} from '@fluentui/react-utilities';\nimport type { DialogSurfaceElement, DialogSurfaceProps, DialogSurfaceState } from './DialogSurface.types';\nimport { useDialogContext_unstable } from '../../contexts';\nimport { Escape } from '@fluentui/keyboard-keys';\n\n/**\n * Create the state required to render DialogSurface.\n *\n * The returned state can be modified with hooks such as useDialogSurfaceStyles_unstable,\n * before being passed to renderDialogSurface_unstable.\n *\n * @param props - props from this instance of DialogSurface\n * @param ref - reference to root HTMLElement of DialogSurface\n */\nexport const useDialogSurface_unstable = (\n props: DialogSurfaceProps,\n ref: React.Ref<DialogSurfaceElement>,\n): DialogSurfaceState => {\n const modalType = useDialogContext_unstable(ctx => ctx.modalType);\n const 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 (event.key === Escape && !event.isDefaultPrevented()) {\n requestOpenChange({\n event,\n open: false,\n type: 'escapeKeyDown',\n });\n // stop propagation to avoid conflicting with other elements that listen for `Escape`\n // e,g: nested Dialog, Popover, Menu and Tooltip\n event.stopPropagation();\n }\n });\n\n const backdrop = slot.optional(props.backdrop, {\n renderByDefault: open && modalType !== 'non-modal',\n defaultProps: {\n 'aria-hidden': 'true',\n },\n elementType: 'div',\n });\n if (backdrop) {\n backdrop.onClick = handledBackdropClick;\n }\n return {\n components: { backdrop: 'div', root: 'div' },\n backdrop,\n mountNode: props.mountNode,\n root: slot.always(\n getNativeElementProps(props.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 { elementType: 'div' },\n ),\n };\n};\n"],"names":["React","getNativeElementProps","useEventCallback","useMergedRefs","isResolvedShorthand","slot","useDialogContext_unstable","Escape","useDialogSurface_unstable","props","ref","modalType","ctx","modalAttributes","dialogRef","open","requestOpenChange","dialogTitleID","dialogTitleId","handledBackdropClick","event","backdrop","onClick","isDefaultPrevented","type","handleKeyDown","onKeyDown","key","stopPropagation","optional","renderByDefault","defaultProps","elementType","components","root","mountNode","always","as","tabIndex","role","undefined"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SACEC,qBAAqB,EACrBC,gBAAgB,EAChBC,aAAa,EACbC,mBAAmB,EACnBC,IAAI,QACC,4BAA4B;AAEnC,SAASC,yBAAyB,QAAQ,iBAAiB;AAC3D,SAASC,MAAM,QAAQ,0BAA0B;AAEjD;;;;;;;;CAQC,GACD,OAAO,MAAMC,4BAA4B,CACvCC,OACAC;IAEA,MAAMC,YAAYL,0BAA0BM,CAAAA,MAAOA,IAAID,SAAS;IAChE,MAAME,kBAAkBP,0BAA0BM,CAAAA,MAAOA,IAAIC,eAAe;IAC5E,MAAMC,YAAYR,0BAA0BM,CAAAA,MAAOA,IAAIE,SAAS;IAChE,MAAMC,OAAOT,0BAA0BM,CAAAA,MAAOA,IAAIG,IAAI;IACtD,MAAMC,oBAAoBV,0BAA0BM,CAAAA,MAAOA,IAAII,iBAAiB;IAChF,MAAMC,gBAAgBX,0BAA0BM,CAAAA,MAAOA,IAAIM,aAAa;IAExE,MAAMC,uBAAuBjB,iBAAiB,CAACkB;QAC7C,IAAIhB,oBAAoBK,MAAMY,QAAQ,GAAG;gBACvCZ,yBAAAA;aAAAA,0BAAAA,CAAAA,kBAAAA,MAAMY,QAAQ,EAACC,OAAO,cAAtBb,8CAAAA,6BAAAA,iBAAyBW;QAC3B;QACA,IAAIT,cAAc,WAAW,CAACS,MAAMG,kBAAkB,IAAI;YACxDP,kBAAkB;gBAChBI;gBACAL,MAAM;gBACNS,MAAM;YACR;QACF;IACF;IAEA,MAAMC,gBAAgBvB,iBAAiB,CAACkB;YACtCX,kBAAAA;SAAAA,mBAAAA,CAAAA,SAAAA,OAAMiB,SAAS,cAAfjB,uCAAAA,sBAAAA,QAAkBW;QAElB,IAAIA,MAAMO,GAAG,KAAKpB,UAAU,CAACa,MAAMG,kBAAkB,IAAI;YACvDP,kBAAkB;gBAChBI;gBACAL,MAAM;gBACNS,MAAM;YACR;YACA,qFAAqF;YACrF,gDAAgD;YAChDJ,MAAMQ,eAAe;QACvB;IACF;IAEA,MAAMP,WAAWhB,KAAKwB,QAAQ,CAACpB,MAAMY,QAAQ,EAAE;QAC7CS,iBAAiBf,QAAQJ,cAAc;QACvCoB,cAAc;YACZ,eAAe;QACjB;QACAC,aAAa;IACf;IACA,IAAIX,UAAU;QACZA,SAASC,OAAO,GAAGH;IACrB;QAM0BV;IAL1B,OAAO;QACLwB,YAAY;YAAEZ,UAAU;YAAOa,MAAM;QAAM;QAC3Cb;QACAc,WAAW1B,MAAM0B,SAAS;QAC1BD,MAAM7B,KAAK+B,MAAM,CACfnC,sBAAsBQ,CAAAA,YAAAA,MAAM4B,EAAE,cAAR5B,uBAAAA,YAAY,OAAO;YACvC6B,UAAU,CAAC;YACX,cAAc3B,cAAc;YAC5B4B,MAAM5B,cAAc,UAAU,gBAAgB;YAC9C,mBAAmBF,KAAK,CAAC,aAAa,GAAG+B,YAAYvB;YACrD,GAAGR,KAAK;YACR,GAAGI,eAAe;YAClBa,WAAWD;YACXf,KAAKP,cAAcO,KAAKI;QAC1B,IACA;YAAEkB,aAAa;QAAM;IAEzB;AACF,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useDialogSurfaceContextValues.ts"],"sourcesContent":["import type { DialogSurfaceContextValues, DialogSurfaceState } from './DialogSurface.types';\nimport type { DialogSurfaceContextValue } from '../../contexts';\n\nexport function useDialogSurfaceContextValues_unstable(state: DialogSurfaceState): DialogSurfaceContextValues {\n const dialogSurface: DialogSurfaceContextValue = true;\n\n return { dialogSurface };\n}\n"],"names":["useDialogSurfaceContextValues_unstable","state","dialogSurface"],"mappings":"AAGA,OAAO,SAASA,uCAAuCC,KAAyB
|
|
1
|
+
{"version":3,"sources":["useDialogSurfaceContextValues.ts"],"sourcesContent":["import type { DialogSurfaceContextValues, DialogSurfaceState } from './DialogSurface.types';\nimport type { DialogSurfaceContextValue } from '../../contexts';\n\nexport function useDialogSurfaceContextValues_unstable(state: DialogSurfaceState): DialogSurfaceContextValues {\n const dialogSurface: DialogSurfaceContextValue = true;\n\n return { dialogSurface };\n}\n"],"names":["useDialogSurfaceContextValues_unstable","state","dialogSurface"],"mappings":"AAGA,OAAO,SAASA,uCAAuCC,KAAyB;IAC9E,MAAMC,gBAA2C;IAEjD,OAAO;QAAEA;IAAc;AACzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DialogTitle.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useDialogTitle_unstable } from './useDialogTitle';\nimport { renderDialogTitle_unstable } from './renderDialogTitle';\nimport { useDialogTitleStyles_unstable } from './useDialogTitleStyles.styles';\nimport type { DialogTitleProps } from './DialogTitle.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * The `DialogTitle` component expects to have a title/header\n * and when `Dialog` is `non-modal` a close (X icon) button is provided through `action` slot by default.\n */\nexport const DialogTitle: ForwardRefComponent<DialogTitleProps> = React.forwardRef((props, ref) => {\n const state = useDialogTitle_unstable(props, ref);\n\n useDialogTitleStyles_unstable(state);\n\n useCustomStyleHook_unstable('useDialogTitleStyles_unstable')(state);\n\n return renderDialogTitle_unstable(state);\n});\n\nDialogTitle.displayName = 'DialogTitle';\n"],"names":["React","useDialogTitle_unstable","renderDialogTitle_unstable","useDialogTitleStyles_unstable","useCustomStyleHook_unstable","DialogTitle","forwardRef","props","ref","state","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,uBAAuB,QAAQ,mBAAmB;AAC3D,SAASC,0BAA0B,QAAQ,sBAAsB;AACjE,SAASC,6BAA6B,QAAQ,gCAAgC;AAG9E,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;;CAGC,GACD,OAAO,MAAMC,4BAAqDL,MAAMM,UAAU,CAAC,CAACC,OAAOC
|
|
1
|
+
{"version":3,"sources":["DialogTitle.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useDialogTitle_unstable } from './useDialogTitle';\nimport { renderDialogTitle_unstable } from './renderDialogTitle';\nimport { useDialogTitleStyles_unstable } from './useDialogTitleStyles.styles';\nimport type { DialogTitleProps } from './DialogTitle.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * The `DialogTitle` component expects to have a title/header\n * and when `Dialog` is `non-modal` a close (X icon) button is provided through `action` slot by default.\n */\nexport const DialogTitle: ForwardRefComponent<DialogTitleProps> = React.forwardRef((props, ref) => {\n const state = useDialogTitle_unstable(props, ref);\n\n useDialogTitleStyles_unstable(state);\n\n useCustomStyleHook_unstable('useDialogTitleStyles_unstable')(state);\n\n return renderDialogTitle_unstable(state);\n});\n\nDialogTitle.displayName = 'DialogTitle';\n"],"names":["React","useDialogTitle_unstable","renderDialogTitle_unstable","useDialogTitleStyles_unstable","useCustomStyleHook_unstable","DialogTitle","forwardRef","props","ref","state","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,uBAAuB,QAAQ,mBAAmB;AAC3D,SAASC,0BAA0B,QAAQ,sBAAsB;AACjE,SAASC,6BAA6B,QAAQ,gCAAgC;AAG9E,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;;CAGC,GACD,OAAO,MAAMC,4BAAqDL,MAAMM,UAAU,CAAC,CAACC,OAAOC;IACzF,MAAMC,QAAQR,wBAAwBM,OAAOC;IAE7CL,8BAA8BM;IAE9BL,4BAA4B,iCAAiCK;IAE7D,OAAOP,2BAA2BO;AACpC,GAAG;AAEHJ,YAAYK,WAAW,GAAG"}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
/** @jsxRuntime
|
|
1
|
+
/** @jsxRuntime automatic */ /** @jsxImportSource @fluentui/react-jsx-runtime */ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
2
|
import { assertSlots } from '@fluentui/react-utilities';
|
|
3
3
|
/**
|
|
4
4
|
* Render the final JSX of DialogTitle
|
|
5
5
|
*/ export const renderDialogTitle_unstable = (state)=>{
|
|
6
6
|
assertSlots(state);
|
|
7
|
-
return /*#__PURE__*/
|
|
7
|
+
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
8
|
+
children: [
|
|
9
|
+
/*#__PURE__*/ _jsx(state.root, {
|
|
10
|
+
children: state.root.children
|
|
11
|
+
}),
|
|
12
|
+
state.action && /*#__PURE__*/ _jsx(state.action, {})
|
|
13
|
+
]
|
|
14
|
+
});
|
|
8
15
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderDialogTitle.tsx"],"sourcesContent":["/** @jsxRuntime
|
|
1
|
+
{"version":3,"sources":["renderDialogTitle.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { DialogTitleState, DialogTitleSlots } from './DialogTitle.types';\n\n/**\n * Render the final JSX of DialogTitle\n */\nexport const renderDialogTitle_unstable = (state: DialogTitleState) => {\n assertSlots<DialogTitleSlots>(state);\n\n return (\n <>\n <state.root>{state.root.children}</state.root>\n {state.action && <state.action />}\n </>\n );\n};\n"],"names":["assertSlots","renderDialogTitle_unstable","state","root","children","action"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAGxD;;CAEC,GACD,OAAO,MAAMC,6BAA6B,CAACC;IACzCF,YAA8BE;IAE9B,qBACE;;0BACE,KAACA,MAAMC,IAAI;0BAAED,MAAMC,IAAI,CAACC,QAAQ;;YAC/BF,MAAMG,MAAM,kBAAI,KAACH,MAAMG,MAAM;;;AAGpC,EAAE"}
|
|
@@ -13,7 +13,7 @@ import { useDialogTitleInternalStyles } from './useDialogTitleStyles.styles';
|
|
|
13
13
|
* @param props - props from this instance of DialogTitle
|
|
14
14
|
* @param ref - reference to root HTMLElement of DialogTitle
|
|
15
15
|
*/ export const useDialogTitle_unstable = (props, ref)=>{
|
|
16
|
-
const { as
|
|
16
|
+
const { as, action } = props;
|
|
17
17
|
const modalType = useDialogContext_unstable((ctx)=>ctx.modalType);
|
|
18
18
|
const internalStyles = useDialogTitleInternalStyles();
|
|
19
19
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useDialogTitle.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, slot } from '@fluentui/react-utilities';\nimport type { DialogTitleProps, DialogTitleState } from './DialogTitle.types';\nimport { useDialogContext_unstable } from '../../contexts/dialogContext';\nimport { Dismiss20Regular } from '@fluentui/react-icons';\nimport { DialogTrigger } from '../DialogTrigger/DialogTrigger';\nimport { useDialogTitleInternalStyles } from './useDialogTitleStyles.styles';\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<HTMLDivElement>): 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: slot.always(\n getNativeElementProps(as ?? 'h2', {\n ref,\n id: useDialogContext_unstable(ctx => ctx.dialogTitleId),\n ...props,\n }),\n { elementType: 'h2' },\n ),\n action: slot.optional(action, {\n renderByDefault: 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 <Dismiss20Regular />\n </button>\n </DialogTrigger>\n ),\n },\n elementType: 'div',\n }),\n };\n};\n"],"names":["React","getNativeElementProps","slot","useDialogContext_unstable","Dismiss20Regular","DialogTrigger","useDialogTitleInternalStyles","useDialogTitle_unstable","props","ref","as","action","modalType","ctx","internalStyles","components","root","always","id","dialogTitleId","elementType","optional","renderByDefault","defaultProps","children","disableButtonEnhancement","button","type","className","aria-label"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,EAAEC,IAAI,QAAQ,4BAA4B;AAExE,SAASC,yBAAyB,QAAQ,+BAA+B;AACzE,SAASC,gBAAgB,QAAQ,wBAAwB;AACzD,SAASC,aAAa,QAAQ,iCAAiC;AAC/D,SAASC,4BAA4B,QAAQ,gCAAgC;AAE7E;;;;;;;;CAQC,GACD,OAAO,MAAMC,0BAA0B,CAACC,OAAyBC
|
|
1
|
+
{"version":3,"sources":["useDialogTitle.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, slot } from '@fluentui/react-utilities';\nimport type { DialogTitleProps, DialogTitleState } from './DialogTitle.types';\nimport { useDialogContext_unstable } from '../../contexts/dialogContext';\nimport { Dismiss20Regular } from '@fluentui/react-icons';\nimport { DialogTrigger } from '../DialogTrigger/DialogTrigger';\nimport { useDialogTitleInternalStyles } from './useDialogTitleStyles.styles';\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<HTMLDivElement>): 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: slot.always(\n getNativeElementProps(as ?? 'h2', {\n ref,\n id: useDialogContext_unstable(ctx => ctx.dialogTitleId),\n ...props,\n }),\n { elementType: 'h2' },\n ),\n action: slot.optional(action, {\n renderByDefault: 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 <Dismiss20Regular />\n </button>\n </DialogTrigger>\n ),\n },\n elementType: 'div',\n }),\n };\n};\n"],"names":["React","getNativeElementProps","slot","useDialogContext_unstable","Dismiss20Regular","DialogTrigger","useDialogTitleInternalStyles","useDialogTitle_unstable","props","ref","as","action","modalType","ctx","internalStyles","components","root","always","id","dialogTitleId","elementType","optional","renderByDefault","defaultProps","children","disableButtonEnhancement","button","type","className","aria-label"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,EAAEC,IAAI,QAAQ,4BAA4B;AAExE,SAASC,yBAAyB,QAAQ,+BAA+B;AACzE,SAASC,gBAAgB,QAAQ,wBAAwB;AACzD,SAASC,aAAa,QAAQ,iCAAiC;AAC/D,SAASC,4BAA4B,QAAQ,gCAAgC;AAE7E;;;;;;;;CAQC,GACD,OAAO,MAAMC,0BAA0B,CAACC,OAAyBC;IAC/D,MAAM,EAAEC,EAAE,EAAEC,MAAM,EAAE,GAAGH;IACvB,MAAMI,YAAYT,0BAA0BU,CAAAA,MAAOA,IAAID,SAAS;IAChE,MAAME,iBAAiBR;IAEvB,OAAO;QACLS,YAAY;YACVC,MAAM;YACNL,QAAQ;QACV;QACAK,MAAMd,KAAKe,MAAM,CACfhB,sBAAsBS,eAAAA,gBAAAA,KAAM,MAAM;YAChCD;YACAS,IAAIf,0BAA0BU,CAAAA,MAAOA,IAAIM,aAAa;YACtD,GAAGX,KAAK;QACV,IACA;YAAEY,aAAa;QAAK;QAEtBT,QAAQT,KAAKmB,QAAQ,CAACV,QAAQ;YAC5BW,iBAAiBV,cAAc;YAC/BW,cAAc;gBACZC,wBACE,oBAACnB;oBAAcoB,0BAAAA;oBAAyBd,QAAO;iCAC7C,oBAACe;oBACCC,MAAK;oBACLC,WAAWd,eAAeY,MAAM;oBAChC,iDAAiD;oBACjDG,cAAW;iCAEX,oBAACzB;YAIT;YACAgB,aAAa;QACf;IACF;AACF,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DialogTrigger.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useDialogTrigger_unstable } from './useDialogTrigger';\nimport { renderDialogTrigger_unstable } from './renderDialogTrigger';\nimport type { DialogTriggerProps } from './DialogTrigger.types';\nimport type { FluentTriggerComponent } from '@fluentui/react-utilities';\n\n/**\n * A non-visual component that wraps its child\n * and configures them to be the trigger that will open or close a `Dialog`.\n * This component should only accept one child.\n *\n * This component sole purpose is to avoid opting out of the internal controlled open state of a `Dialog`\n * Besides being a trigger that opens/close a dialog through context this component doesn't do much,\n * making it basically unnecessary in cases where the trigger is outside of the `Dialog` component.\n */\nexport const DialogTrigger: React.FC<DialogTriggerProps> = props => {\n const state = useDialogTrigger_unstable(props);\n\n return renderDialogTrigger_unstable(state);\n};\n\nDialogTrigger.displayName = 'DialogTrigger';\n// type casting here is required to ensure internal type FluentTriggerComponent is not leaked\n(DialogTrigger as FluentTriggerComponent).isFluentTriggerComponent = true;\n"],"names":["React","useDialogTrigger_unstable","renderDialogTrigger_unstable","DialogTrigger","props","state","displayName","isFluentTriggerComponent"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,yBAAyB,QAAQ,qBAAqB;AAC/D,SAASC,4BAA4B,QAAQ,wBAAwB;AAIrE;;;;;;;;CAQC,GACD,OAAO,MAAMC,gBAA8CC,CAAAA
|
|
1
|
+
{"version":3,"sources":["DialogTrigger.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useDialogTrigger_unstable } from './useDialogTrigger';\nimport { renderDialogTrigger_unstable } from './renderDialogTrigger';\nimport type { DialogTriggerProps } from './DialogTrigger.types';\nimport type { FluentTriggerComponent } from '@fluentui/react-utilities';\n\n/**\n * A non-visual component that wraps its child\n * and configures them to be the trigger that will open or close a `Dialog`.\n * This component should only accept one child.\n *\n * This component sole purpose is to avoid opting out of the internal controlled open state of a `Dialog`\n * Besides being a trigger that opens/close a dialog through context this component doesn't do much,\n * making it basically unnecessary in cases where the trigger is outside of the `Dialog` component.\n */\nexport const DialogTrigger: React.FC<DialogTriggerProps> = props => {\n const state = useDialogTrigger_unstable(props);\n\n return renderDialogTrigger_unstable(state);\n};\n\nDialogTrigger.displayName = 'DialogTrigger';\n// type casting here is required to ensure internal type FluentTriggerComponent is not leaked\n(DialogTrigger as FluentTriggerComponent).isFluentTriggerComponent = true;\n"],"names":["React","useDialogTrigger_unstable","renderDialogTrigger_unstable","DialogTrigger","props","state","displayName","isFluentTriggerComponent"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,yBAAyB,QAAQ,qBAAqB;AAC/D,SAASC,4BAA4B,QAAQ,wBAAwB;AAIrE;;;;;;;;CAQC,GACD,OAAO,MAAMC,gBAA8CC,CAAAA;IACzD,MAAMC,QAAQJ,0BAA0BG;IAExC,OAAOF,6BAA6BG;AACtC,EAAE;AAEFF,cAAcG,WAAW,GAAG;AAC5B,6FAA6F;AAC5FH,cAAyCI,wBAAwB,GAAG"}
|
|
@@ -9,14 +9,15 @@ import { useModalAttributes } from '@fluentui/react-tabster';
|
|
|
9
9
|
*
|
|
10
10
|
* @param props - props from this instance of DialogTrigger
|
|
11
11
|
*/ export const useDialogTrigger_unstable = (props)=>{
|
|
12
|
+
var _child, _child1, _child2, _child3;
|
|
12
13
|
const isInsideSurfaceDialog = useDialogSurfaceContext_unstable();
|
|
13
|
-
const { children
|
|
14
|
+
const { children, disableButtonEnhancement = false, action = isInsideSurfaceDialog ? 'close' : 'open' } = props;
|
|
14
15
|
const child = getTriggerChild(children);
|
|
15
16
|
const requestOpenChange = useDialogContext_unstable((ctx)=>ctx.requestOpenChange);
|
|
16
|
-
const { triggerAttributes
|
|
17
|
+
const { triggerAttributes } = useModalAttributes();
|
|
17
18
|
const handleClick = useEventCallback((event)=>{
|
|
18
|
-
var
|
|
19
|
-
(
|
|
19
|
+
var _child_props_onClick, _child, _child_props;
|
|
20
|
+
(_child = child) === null || _child === void 0 ? void 0 : (_child_props_onClick = (_child_props = _child.props).onClick) === null || _child_props_onClick === void 0 ? void 0 : _child_props_onClick.call(_child_props, event);
|
|
20
21
|
if (!event.isDefaultPrevented()) {
|
|
21
22
|
requestOpenChange({
|
|
22
23
|
event,
|
|
@@ -26,12 +27,12 @@ import { useModalAttributes } from '@fluentui/react-tabster';
|
|
|
26
27
|
}
|
|
27
28
|
});
|
|
28
29
|
const triggerChildProps = {
|
|
29
|
-
...child === null ||
|
|
30
|
-
ref: child === null ||
|
|
30
|
+
...(_child = child) === null || _child === void 0 ? void 0 : _child.props,
|
|
31
|
+
ref: (_child1 = child) === null || _child1 === void 0 ? void 0 : _child1.ref,
|
|
31
32
|
onClick: handleClick,
|
|
32
33
|
...triggerAttributes
|
|
33
34
|
};
|
|
34
|
-
const ariaButtonTriggerChildProps = useARIAButtonProps((child === null ||
|
|
35
|
+
const ariaButtonTriggerChildProps = useARIAButtonProps(((_child2 = child) === null || _child2 === void 0 ? void 0 : _child2.type) === 'button' || ((_child3 = child) === null || _child3 === void 0 ? void 0 : _child3.type) === 'a' ? child.type : 'div', {
|
|
35
36
|
...triggerChildProps,
|
|
36
37
|
type: 'button'
|
|
37
38
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["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';\nimport { useModalAttributes } from '@fluentui/react-tabster';\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 } = useModalAttributes();\n\n const handleClick = useEventCallback(\n (event: React.MouseEvent<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>) => {\n child?.props.onClick?.(event);\n if (!event.isDefaultPrevented()) {\n requestOpenChange({\n event,\n type: 'triggerClick',\n open: action === 'open',\n });\n }\n },\n );\n\n const triggerChildProps = {\n ...child?.props,\n 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"],"names":["React","applyTriggerPropsToChildren","getTriggerChild","useEventCallback","useDialogContext_unstable","useDialogSurfaceContext_unstable","useARIAButtonProps","useModalAttributes","useDialogTrigger_unstable","props","isInsideSurfaceDialog","children","disableButtonEnhancement","action","
|
|
1
|
+
{"version":3,"sources":["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';\nimport { useModalAttributes } from '@fluentui/react-tabster';\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 } = useModalAttributes();\n\n const handleClick = useEventCallback(\n (event: React.MouseEvent<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>) => {\n child?.props.onClick?.(event);\n if (!event.isDefaultPrevented()) {\n requestOpenChange({\n event,\n type: 'triggerClick',\n open: action === 'open',\n });\n }\n },\n );\n\n const triggerChildProps = {\n ...child?.props,\n 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"],"names":["React","applyTriggerPropsToChildren","getTriggerChild","useEventCallback","useDialogContext_unstable","useDialogSurfaceContext_unstable","useARIAButtonProps","useModalAttributes","useDialogTrigger_unstable","props","child","isInsideSurfaceDialog","children","disableButtonEnhancement","action","requestOpenChange","ctx","triggerAttributes","handleClick","event","onClick","isDefaultPrevented","type","open","triggerChildProps","ref","ariaButtonTriggerChildProps"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,2BAA2B,EAAEC,eAAe,EAAEC,gBAAgB,QAAQ,4BAA4B;AAE3G,SAASC,yBAAyB,EAAEC,gCAAgC,QAAQ,iBAAiB;AAC7F,SAASC,kBAAkB,QAAQ,uBAAuB;AAC1D,SAASC,kBAAkB,QAAQ,0BAA0B;AAE7D;;;;;CAKC,GACD,OAAO,MAAMC,4BAA4B,CAACC;QAwBnCC,QACEA,SAMLA,SAA4BA;IA9B9B,MAAMC,wBAAwBN;IAE9B,MAAM,EAAEO,QAAQ,EAAEC,2BAA2B,KAAK,EAAEC,SAASH,wBAAwB,UAAU,MAAM,EAAE,GAAGF;IAE1G,MAAMC,QAAQR,gBAAgBU;IAE9B,MAAMG,oBAAoBX,0BAA0BY,CAAAA,MAAOA,IAAID,iBAAiB;IAChF,MAAM,EAAEE,iBAAiB,EAAE,GAAGV;IAE9B,MAAMW,cAAcf,iBAClB,CAACgB;YACCT,sBAAAA,QAAAA;SAAAA,SAAAA,mBAAAA,8BAAAA,uBAAAA,CAAAA,eAAAA,OAAOD,KAAK,EAACW,OAAO,cAApBV,2CAAAA,0BAAAA,cAAuBS;QACvB,IAAI,CAACA,MAAME,kBAAkB,IAAI;YAC/BN,kBAAkB;gBAChBI;gBACAG,MAAM;gBACNC,MAAMT,WAAW;YACnB;QACF;IACF;IAGF,MAAMU,oBAAoB;YACrBd,SAAAA,mBAAAA,6BAAAA,OAAOD,KAAK,AAAf;QACAgB,GAAG,GAAEf,UAAAA,mBAAAA,8BAAAA,QAAOe,GAAG;QACfL,SAASF;QACT,GAAGD,iBAAiB;IACtB;IAEA,MAAMS,8BAA8BpB,mBAClCI,EAAAA,UAAAA,mBAAAA,8BAAAA,QAAOY,IAAI,MAAK,YAAYZ,EAAAA,UAAAA,mBAAAA,8BAAAA,QAAOY,IAAI,MAAK,MAAMZ,MAAMY,IAAI,GAAG,OAC/D;QACE,GAAGE,iBAAiB;QACpBF,MAAM;IACR;IAGF,OAAO;QACLV,UAAUX,4BACRW,UACAC,2BAA2BW,oBAAoBE;IAEnD;AACF,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["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"],"names":["React","createContext","useContextSelector","defaultContextValue","open","inertTrapFocus","modalType","isNestedDialog","dialogRef","current","requestOpenChange","DialogContext","undefined","DialogProvider","Provider","useDialogContext_unstable","selector","ctx"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,aAAa,EAAmBC,kBAAkB,QAAQ,mCAAmC;AAmBtG,MAAMC,sBAA0C;IAC9CC,MAAM
|
|
1
|
+
{"version":3,"sources":["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"],"names":["React","createContext","useContextSelector","defaultContextValue","open","inertTrapFocus","modalType","isNestedDialog","dialogRef","current","requestOpenChange","DialogContext","undefined","DialogProvider","Provider","useDialogContext_unstable","selector","ctx"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,aAAa,EAAmBC,kBAAkB,QAAQ,mCAAmC;AAmBtG,MAAMC,sBAA0C;IAC9CC,MAAM;IACNC,gBAAgB;IAChBC,WAAW;IACXC,gBAAgB;IAChBC,WAAW;QAAEC,SAAS;IAAK;IAC3BC;IACE,QAAQ,GACV;AACF;AAEA,uCAAuC;AACvC,OAAO,MAAMC,gBAAyDV,cACpEW,WACA;AAEF,OAAO,MAAMC,iBAAiBF,cAAcG,QAAQ,CAAC;AACrD,OAAO,MAAMC,4BAA4B,CAAIC,WAC3Cd,mBAAmBS,eAAe,CAACM,MAAMd,mBAAmB,GAAKa,SAASC,MAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["dialogSurfaceContext.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\n\nexport type DialogSurfaceContextValue = boolean;\n\nconst defaultContextValue: DialogSurfaceContextValue = false;\n\nexport const DialogSurfaceContext = createContext<DialogSurfaceContextValue | undefined>(undefined);\n\nexport const DialogSurfaceProvider = DialogSurfaceContext.Provider;\n\nexport const useDialogSurfaceContext_unstable = () => useContext(DialogSurfaceContext) ?? defaultContextValue;\n"],"names":["createContext","useContext","defaultContextValue","DialogSurfaceContext","undefined","DialogSurfaceProvider","Provider","useDialogSurfaceContext_unstable"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,QAAQ;AAIlD,MAAMC,sBAAiD
|
|
1
|
+
{"version":3,"sources":["dialogSurfaceContext.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\n\nexport type DialogSurfaceContextValue = boolean;\n\nconst defaultContextValue: DialogSurfaceContextValue = false;\n\nexport const DialogSurfaceContext = createContext<DialogSurfaceContextValue | undefined>(undefined);\n\nexport const DialogSurfaceProvider = DialogSurfaceContext.Provider;\n\nexport const useDialogSurfaceContext_unstable = () => useContext(DialogSurfaceContext) ?? defaultContextValue;\n"],"names":["createContext","useContext","defaultContextValue","DialogSurfaceContext","undefined","DialogSurfaceProvider","Provider","useDialogSurfaceContext_unstable"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,QAAQ;AAIlD,MAAMC,sBAAiD;AAEvD,OAAO,MAAMC,uBAAuBH,cAAqDI,WAAW;AAEpG,OAAO,MAAMC,wBAAwBF,qBAAqBG,QAAQ,CAAC;IAEbL;AAAtD,OAAO,MAAMM,mCAAmC,IAAMN,CAAAA,cAAAA,WAAWE,mCAAXF,yBAAAA,cAAoCC,oBAAoB"}
|
|
@@ -4,7 +4,7 @@ const disableScrollElementProp = '__fluentDisableScrollElement';
|
|
|
4
4
|
/**
|
|
5
5
|
* hook that disables body scrolling through `overflow: hidden` CSS property
|
|
6
6
|
*/ export function useDisableBodyScroll() {
|
|
7
|
-
const { targetDocument
|
|
7
|
+
const { targetDocument } = useFluent_unstable();
|
|
8
8
|
return useCallback(()=>{
|
|
9
9
|
if (targetDocument) {
|
|
10
10
|
return disableScroll(targetDocument.body);
|
|
@@ -19,7 +19,7 @@ const disableScrollElementProp = '__fluentDisableScrollElement';
|
|
|
19
19
|
* @returns a method for enabling scrolling again
|
|
20
20
|
*/ export function disableScroll(target) {
|
|
21
21
|
var _target_ownerDocument_defaultView;
|
|
22
|
-
const { clientWidth
|
|
22
|
+
const { clientWidth } = target.ownerDocument.documentElement;
|
|
23
23
|
var _target_ownerDocument_defaultView_innerWidth;
|
|
24
24
|
const innerWidth = (_target_ownerDocument_defaultView_innerWidth = (_target_ownerDocument_defaultView = target.ownerDocument.defaultView) === null || _target_ownerDocument_defaultView === void 0 ? void 0 : _target_ownerDocument_defaultView.innerWidth) !== null && _target_ownerDocument_defaultView_innerWidth !== void 0 ? _target_ownerDocument_defaultView_innerWidth : 0;
|
|
25
25
|
assertIsDisableScrollElement(target);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useDisableBodyScroll.ts"],"sourcesContent":["import { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport { useCallback } from 'react';\n\nconst disableScrollElementProp = '__fluentDisableScrollElement' as const;\n\ntype FluentDisableScrollElement = HTMLElement & {\n [disableScrollElementProp]: {\n count: number;\n previousOverflowStyle: string;\n previousPaddingRightStyle: string;\n };\n};\n\n/**\n * hook that disables body scrolling through `overflow: hidden` CSS property\n */\nexport function useDisableBodyScroll() {\n const { targetDocument } = useFluent_unstable();\n return useCallback(() => {\n if (targetDocument) {\n return disableScroll(targetDocument.body);\n }\n }, [targetDocument]);\n}\n\n/**\n * disables scrolling from a given element through `overflow: hidden` CSS property\n * @param target - element to disable scrolling from\n * @returns a method for enabling scrolling again\n */\nexport function disableScroll(target: HTMLElement) {\n const { clientWidth } = target.ownerDocument.documentElement;\n const innerWidth = target.ownerDocument.defaultView?.innerWidth ?? 0;\n assertIsDisableScrollElement(target);\n if (target[disableScrollElementProp].count === 0) {\n target.style.overflow = 'hidden';\n target.style.paddingRight = `${innerWidth - clientWidth}px`;\n }\n target[disableScrollElementProp].count++;\n return () => {\n target[disableScrollElementProp].count--;\n if (target[disableScrollElementProp].count === 0) {\n target.style.overflow = target[disableScrollElementProp].previousOverflowStyle;\n target.style.paddingRight = target[disableScrollElementProp].previousPaddingRightStyle;\n }\n };\n}\n\nfunction assertIsDisableScrollElement(element: HTMLElement): asserts element is FluentDisableScrollElement {\n (element as FluentDisableScrollElement)[disableScrollElementProp] ??= {\n count: 0,\n previousOverflowStyle: element.style.overflow,\n previousPaddingRightStyle: element.style.paddingRight,\n };\n}\n"],"names":["useFluent_unstable","useCallback","disableScrollElementProp","useDisableBodyScroll","targetDocument","disableScroll","body","target","clientWidth","ownerDocument","documentElement","innerWidth","defaultView","assertIsDisableScrollElement","count","style","overflow","paddingRight","previousOverflowStyle","previousPaddingRightStyle","element"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,kCAAkC;AACrE,SAASC,WAAW,QAAQ,QAAQ;AAEpC,MAAMC,2BAA2B;AAUjC;;CAEC,GACD,OAAO,SAASC
|
|
1
|
+
{"version":3,"sources":["useDisableBodyScroll.ts"],"sourcesContent":["import { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport { useCallback } from 'react';\n\nconst disableScrollElementProp = '__fluentDisableScrollElement' as const;\n\ntype FluentDisableScrollElement = HTMLElement & {\n [disableScrollElementProp]: {\n count: number;\n previousOverflowStyle: string;\n previousPaddingRightStyle: string;\n };\n};\n\n/**\n * hook that disables body scrolling through `overflow: hidden` CSS property\n */\nexport function useDisableBodyScroll() {\n const { targetDocument } = useFluent_unstable();\n return useCallback(() => {\n if (targetDocument) {\n return disableScroll(targetDocument.body);\n }\n }, [targetDocument]);\n}\n\n/**\n * disables scrolling from a given element through `overflow: hidden` CSS property\n * @param target - element to disable scrolling from\n * @returns a method for enabling scrolling again\n */\nexport function disableScroll(target: HTMLElement) {\n const { clientWidth } = target.ownerDocument.documentElement;\n const innerWidth = target.ownerDocument.defaultView?.innerWidth ?? 0;\n assertIsDisableScrollElement(target);\n if (target[disableScrollElementProp].count === 0) {\n target.style.overflow = 'hidden';\n target.style.paddingRight = `${innerWidth - clientWidth}px`;\n }\n target[disableScrollElementProp].count++;\n return () => {\n target[disableScrollElementProp].count--;\n if (target[disableScrollElementProp].count === 0) {\n target.style.overflow = target[disableScrollElementProp].previousOverflowStyle;\n target.style.paddingRight = target[disableScrollElementProp].previousPaddingRightStyle;\n }\n };\n}\n\nfunction assertIsDisableScrollElement(element: HTMLElement): asserts element is FluentDisableScrollElement {\n (element as FluentDisableScrollElement)[disableScrollElementProp] ??= {\n count: 0,\n previousOverflowStyle: element.style.overflow,\n previousPaddingRightStyle: element.style.paddingRight,\n };\n}\n"],"names":["useFluent_unstable","useCallback","disableScrollElementProp","useDisableBodyScroll","targetDocument","disableScroll","body","target","clientWidth","ownerDocument","documentElement","innerWidth","defaultView","assertIsDisableScrollElement","count","style","overflow","paddingRight","previousOverflowStyle","previousPaddingRightStyle","element"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,kCAAkC;AACrE,SAASC,WAAW,QAAQ,QAAQ;AAEpC,MAAMC,2BAA2B;AAUjC;;CAEC,GACD,OAAO,SAASC;IACd,MAAM,EAAEC,cAAc,EAAE,GAAGJ;IAC3B,OAAOC,YAAY;QACjB,IAAIG,gBAAgB;YAClB,OAAOC,cAAcD,eAAeE,IAAI;QAC1C;IACF,GAAG;QAACF;KAAe;AACrB;AAEA;;;;CAIC,GACD,OAAO,SAASC,cAAcE,MAAmB;QAE5BA;IADnB,MAAM,EAAEC,WAAW,EAAE,GAAGD,OAAOE,aAAa,CAACC,eAAe;QACzCH;IAAnB,MAAMI,aAAaJ,CAAAA,gDAAAA,oCAAAA,OAAOE,aAAa,CAACG,WAAW,cAAhCL,wDAAAA,kCAAkCI,UAAU,cAA5CJ,0DAAAA,+CAAgD;IACnEM,6BAA6BN;IAC7B,IAAIA,MAAM,CAACL,yBAAyB,CAACY,KAAK,KAAK,GAAG;QAChDP,OAAOQ,KAAK,CAACC,QAAQ,GAAG;QACxBT,OAAOQ,KAAK,CAACE,YAAY,GAAG,CAAC,EAAEN,aAAaH,YAAY,EAAE,CAAC;IAC7D;IACAD,MAAM,CAACL,yBAAyB,CAACY,KAAK;IACtC,OAAO;QACLP,MAAM,CAACL,yBAAyB,CAACY,KAAK;QACtC,IAAIP,MAAM,CAACL,yBAAyB,CAACY,KAAK,KAAK,GAAG;YAChDP,OAAOQ,KAAK,CAACC,QAAQ,GAAGT,MAAM,CAACL,yBAAyB,CAACgB,qBAAqB;YAC9EX,OAAOQ,KAAK,CAACE,YAAY,GAAGV,MAAM,CAACL,yBAAyB,CAACiB,yBAAyB;QACxF;IACF;AACF;AAEA,SAASN,6BAA6BO,OAAoB;QACvDA,UAAuClB;;IAAxC,MAACkB,WAAAA,QAAsC,CAAClB,4BAAAA,yBAAyB,iCAAhEkB,QAAsC,CAAClB,0BAAyB,GAAK;QACpEY,OAAO;QACPI,uBAAuBE,QAAQL,KAAK,CAACC,QAAQ;QAC7CG,2BAA2BC,QAAQL,KAAK,CAACE,YAAY;IACvD;AACF"}
|
|
@@ -4,8 +4,8 @@ import { useFluent_unstable } from '@fluentui/react-shared-contexts';
|
|
|
4
4
|
/**
|
|
5
5
|
* Focus first element on content when dialog is opened,
|
|
6
6
|
*/ export function useFocusFirstElement(open, modalType) {
|
|
7
|
-
const { findFirstFocusable
|
|
8
|
-
const { targetDocument
|
|
7
|
+
const { findFirstFocusable } = useFocusFinders();
|
|
8
|
+
const { targetDocument } = useFluent_unstable();
|
|
9
9
|
const dialogRef = React.useRef(null);
|
|
10
10
|
React.useEffect(()=>{
|
|
11
11
|
if (!open) {
|
|
@@ -19,10 +19,9 @@ import { useFluent_unstable } from '@fluentui/react-shared-contexts';
|
|
|
19
19
|
(_dialogRef_current = dialogRef.current) === null || _dialogRef_current === void 0 ? void 0 : _dialogRef_current.focus(); // https://github.com/microsoft/fluentui/issues/25150
|
|
20
20
|
if (process.env.NODE_ENV !== 'production') {
|
|
21
21
|
// eslint-disable-next-line no-console
|
|
22
|
-
console.warn([
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
].join('\n'));
|
|
22
|
+
console.warn(`@fluentui/react-dialog [useFocusFirstElement]:
|
|
23
|
+
A Dialog should have at least one focusable element inside DialogSurface.
|
|
24
|
+
Please add at least a close button either on \`DialogTitle\` action slot or inside \`DialogActions\``);
|
|
26
25
|
}
|
|
27
26
|
}
|
|
28
27
|
}, [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useFocusFirstElement.ts"],"sourcesContent":["import * as React from 'react';\nimport { useFocusFinders } from '@fluentui/react-tabster';\nimport { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport type { DialogSurfaceElement } from '../DialogSurface';\nimport type { DialogModalType } from '../Dialog';\n\n/**\n * Focus first element on content when dialog is opened,\n */\nexport function useFocusFirstElement(open: boolean, modalType: DialogModalType) {\n const { findFirstFocusable } = useFocusFinders();\n const { targetDocument } = useFluent_unstable();\n const dialogRef = React.useRef<DialogSurfaceElement>(null);\n\n React.useEffect(() => {\n if (!open) {\n return;\n }\n const element = dialogRef.current && findFirstFocusable(dialogRef.current);\n if (element) {\n element.focus();\n } else {\n dialogRef.current?.focus(); // https://github.com/microsoft/fluentui/issues/25150\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.warn(
|
|
1
|
+
{"version":3,"sources":["useFocusFirstElement.ts"],"sourcesContent":["import * as React from 'react';\nimport { useFocusFinders } from '@fluentui/react-tabster';\nimport { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport type { DialogSurfaceElement } from '../DialogSurface';\nimport type { DialogModalType } from '../Dialog';\n\n/**\n * Focus first element on content when dialog is opened,\n */\nexport function useFocusFirstElement(open: boolean, modalType: DialogModalType) {\n const { findFirstFocusable } = useFocusFinders();\n const { targetDocument } = useFluent_unstable();\n const dialogRef = React.useRef<DialogSurfaceElement>(null);\n\n React.useEffect(() => {\n if (!open) {\n return;\n }\n const element = dialogRef.current && findFirstFocusable(dialogRef.current);\n if (element) {\n element.focus();\n } else {\n dialogRef.current?.focus(); // https://github.com/microsoft/fluentui/issues/25150\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.warn(/** #__DE-INDENT__ */ `\n @fluentui/react-dialog [useFocusFirstElement]:\n A Dialog should have at least one focusable element inside DialogSurface.\n Please add at least a close button either on \\`DialogTitle\\` action slot or inside \\`DialogActions\\`\n `);\n }\n }\n }, [findFirstFocusable, open, modalType, targetDocument]);\n\n return dialogRef;\n}\n"],"names":["React","useFocusFinders","useFluent_unstable","useFocusFirstElement","open","modalType","findFirstFocusable","targetDocument","dialogRef","useRef","useEffect","element","current","focus","process","env","NODE_ENV","console","warn"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,eAAe,QAAQ,0BAA0B;AAC1D,SAASC,kBAAkB,QAAQ,kCAAkC;AAIrE;;CAEC,GACD,OAAO,SAASC,qBAAqBC,IAAa,EAAEC,SAA0B;IAC5E,MAAM,EAAEC,kBAAkB,EAAE,GAAGL;IAC/B,MAAM,EAAEM,cAAc,EAAE,GAAGL;IAC3B,MAAMM,YAAYR,MAAMS,MAAM,CAAuB;IAErDT,MAAMU,SAAS,CAAC;QACd,IAAI,CAACN,MAAM;YACT;QACF;QACA,MAAMO,UAAUH,UAAUI,OAAO,IAAIN,mBAAmBE,UAAUI,OAAO;QACzE,IAAID,SAAS;YACXA,QAAQE,KAAK;QACf,OAAO;gBACLL;aAAAA,qBAAAA,UAAUI,OAAO,cAAjBJ,yCAAAA,mBAAmBK,KAAK,IAAI,qDAAqD;YACjF,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;gBACzC,sCAAsC;gBACtCC,QAAQC,IAAI,CAAuB,CAAC;;oGAIpC,CAAC;YACH;QACF;IACF,GAAG;QAACZ;QAAoBF;QAAMC;QAAWE;KAAe;IAExD,OAAOC;AACT"}
|
package/lib-commonjs/Dialog.js
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
const
|
|
6
|
-
|
|
5
|
+
const _export_star = require("@swc/helpers/_/_export_star");
|
|
6
|
+
_export_star._(require("./components/Dialog/index"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Dialog.js"],"sourcesContent":["export * from './components/Dialog/index';\n"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"sources":["Dialog.js"],"sourcesContent":["export * from './components/Dialog/index';\n"],"names":[],"mappings":";;;;;uBAAc"}
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
const
|
|
6
|
-
|
|
5
|
+
const _export_star = require("@swc/helpers/_/_export_star");
|
|
6
|
+
_export_star._(require("./components/DialogActions/index"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DialogActions.js"],"sourcesContent":["export * from './components/DialogActions/index';\n"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"sources":["DialogActions.js"],"sourcesContent":["export * from './components/DialogActions/index';\n"],"names":[],"mappings":";;;;;uBAAc"}
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
const
|
|
6
|
-
|
|
5
|
+
const _export_star = require("@swc/helpers/_/_export_star");
|
|
6
|
+
_export_star._(require("./components/DialogBody/index"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DialogBody.js"],"sourcesContent":["export * from './components/DialogBody/index';\n"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"sources":["DialogBody.js"],"sourcesContent":["export * from './components/DialogBody/index';\n"],"names":[],"mappings":";;;;;uBAAc"}
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
const
|
|
6
|
-
|
|
5
|
+
const _export_star = require("@swc/helpers/_/_export_star");
|
|
6
|
+
_export_star._(require("./components/DialogContent/index"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DialogContent.js"],"sourcesContent":["export * from './components/DialogContent/index';\n"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"sources":["DialogContent.js"],"sourcesContent":["export * from './components/DialogContent/index';\n"],"names":[],"mappings":";;;;;uBAAc"}
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
const
|
|
6
|
-
|
|
5
|
+
const _export_star = require("@swc/helpers/_/_export_star");
|
|
6
|
+
_export_star._(require("./components/DialogSurface/index"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DialogSurface.js"],"sourcesContent":["export * from './components/DialogSurface/index';\n"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"sources":["DialogSurface.js"],"sourcesContent":["export * from './components/DialogSurface/index';\n"],"names":[],"mappings":";;;;;uBAAc"}
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
const
|
|
6
|
-
|
|
5
|
+
const _export_star = require("@swc/helpers/_/_export_star");
|
|
6
|
+
_export_star._(require("./components/DialogTitle/index"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DialogTitle.js"],"sourcesContent":["export * from './components/DialogTitle/index';\n"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"sources":["DialogTitle.js"],"sourcesContent":["export * from './components/DialogTitle/index';\n"],"names":[],"mappings":";;;;;uBAAc"}
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
const
|
|
6
|
-
|
|
5
|
+
const _export_star = require("@swc/helpers/_/_export_star");
|
|
6
|
+
_export_star._(require("./components/DialogTrigger/index"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DialogTrigger.js"],"sourcesContent":["export * from './components/DialogTrigger/index';\n"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"sources":["DialogTrigger.js"],"sourcesContent":["export * from './components/DialogTrigger/index';\n"],"names":[],"mappings":";;;;;uBAAc"}
|
|
@@ -4,10 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "Dialog", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return Dialog;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
|
-
const
|
|
10
|
-
const _react = /*#__PURE__*/
|
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
11
13
|
const _useDialog = require("./useDialog");
|
|
12
14
|
const _renderDialog = require("./renderDialog");
|
|
13
15
|
const _useDialogContextValues = require("./useDialogContextValues");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Dialog.js"],"sourcesContent":["import * as React from 'react';\nimport { useDialog_unstable } from './useDialog';\nimport { renderDialog_unstable } from './renderDialog';\nimport { useDialogContextValues_unstable } from './useDialogContextValues';\n/**\n * The `Dialog` root level component serves as an interface for interaction with all possible behaviors exposed.\n * It provides context down the hierarchy to `children` compound components to allow functionality.\n * This component expects to receive as children either a `DialogSurface` or a `DialogTrigger`\n * and a `DialogSurface` (or some component that will eventually render one of those compound components)\n * in this specific order\n */ export const Dialog = /*#__PURE__*/ React.memo((props)=>{\n const state = useDialog_unstable(props);\n const contextValues = useDialogContextValues_unstable(state);\n return renderDialog_unstable(state, contextValues);\n});\nDialog.displayName = 'Dialog';\n"],"names":["Dialog","React","memo","props","state","useDialog_unstable","contextValues","useDialogContextValues_unstable","renderDialog_unstable","displayName"],"mappings":";;;;+BAUiBA
|
|
1
|
+
{"version":3,"sources":["Dialog.js"],"sourcesContent":["import * as React from 'react';\nimport { useDialog_unstable } from './useDialog';\nimport { renderDialog_unstable } from './renderDialog';\nimport { useDialogContextValues_unstable } from './useDialogContextValues';\n/**\n * The `Dialog` root level component serves as an interface for interaction with all possible behaviors exposed.\n * It provides context down the hierarchy to `children` compound components to allow functionality.\n * This component expects to receive as children either a `DialogSurface` or a `DialogTrigger`\n * and a `DialogSurface` (or some component that will eventually render one of those compound components)\n * in this specific order\n */ export const Dialog = /*#__PURE__*/ React.memo((props)=>{\n const state = useDialog_unstable(props);\n const contextValues = useDialogContextValues_unstable(state);\n return renderDialog_unstable(state, contextValues);\n});\nDialog.displayName = 'Dialog';\n"],"names":["Dialog","React","memo","props","state","useDialog_unstable","contextValues","useDialogContextValues_unstable","renderDialog_unstable","displayName"],"mappings":";;;;+BAUiBA;;;eAAAA;;;;iEAVM;2BACY;8BACG;wCACU;AAOrC,MAAMA,SAAS,WAAW,GAAGC,OAAMC,IAAI,CAAC,CAACC;IAChD,MAAMC,QAAQC,IAAAA,6BAAkB,EAACF;IACjC,MAAMG,gBAAgBC,IAAAA,uDAA+B,EAACH;IACtD,OAAOI,IAAAA,mCAAqB,EAACJ,OAAOE;AACxC;AACAN,OAAOS,WAAW,GAAG"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
const _export_star = require("@swc/helpers/_/_export_star");
|
|
6
|
+
_export_star._(require("./Dialog"), exports);
|
|
7
|
+
_export_star._(require("./Dialog.types"), exports);
|
|
8
|
+
_export_star._(require("./renderDialog"), exports);
|
|
9
|
+
_export_star._(require("./useDialog"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.js"],"sourcesContent":["export * from './Dialog';\nexport * from './Dialog.types';\nexport * from './renderDialog';\nexport * from './useDialog';\n"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"sources":["index.js"],"sourcesContent":["export * from './Dialog';\nexport * from './Dialog.types';\nexport * from './renderDialog';\nexport * from './useDialog';\n"],"names":[],"mappings":";;;;;uBAAc;uBACA;uBACA;uBACA"}
|
|
@@ -1,18 +1,25 @@
|
|
|
1
|
-
/** @jsxRuntime
|
|
1
|
+
/** @jsxRuntime automatic */ /** @jsxImportSource @fluentui/react-jsx-runtime */ "use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "renderDialog_unstable", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return renderDialog_unstable;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
|
-
const
|
|
11
|
+
const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
|
|
10
12
|
const _contexts = require("../../contexts");
|
|
11
13
|
const renderDialog_unstable = (state, contextValues)=>{
|
|
12
|
-
const { content
|
|
13
|
-
return /*#__PURE__*/ (0,
|
|
14
|
-
value: contextValues.dialog
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
const { content, trigger } = state;
|
|
15
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_contexts.DialogProvider, {
|
|
16
|
+
value: contextValues.dialog,
|
|
17
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_contexts.DialogSurfaceProvider, {
|
|
18
|
+
value: contextValues.dialogSurface,
|
|
19
|
+
children: [
|
|
20
|
+
trigger,
|
|
21
|
+
content
|
|
22
|
+
]
|
|
23
|
+
})
|
|
24
|
+
});
|
|
18
25
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderDialog.js"],"sourcesContent":["/** @jsxRuntime
|
|
1
|
+
{"version":3,"sources":["renderDialog.js"],"sourcesContent":["/** @jsxRuntime automatic */ /** @jsxImportSource @fluentui/react-jsx-runtime */ import { jsx as _jsx, jsxs as _jsxs } from \"@fluentui/react-jsx-runtime/jsx-runtime\";\nimport { DialogProvider, DialogSurfaceProvider } from '../../contexts';\n/**\n * Render the final JSX of Dialog\n */ export const renderDialog_unstable = (state, contextValues)=>{\n const { content, trigger } = state;\n return /*#__PURE__*/ _jsx(DialogProvider, {\n value: contextValues.dialog,\n children: /*#__PURE__*/ _jsxs(DialogSurfaceProvider, {\n value: contextValues.dialogSurface,\n children: [\n trigger,\n content\n ]\n })\n });\n};\n"],"names":["renderDialog_unstable","state","contextValues","content","trigger","_jsx","DialogProvider","value","dialog","children","_jsxs","DialogSurfaceProvider","dialogSurface"],"mappings":"AAAA,0BAA0B,GAAG,iDAAiD;;;;+BAI7DA;;;eAAAA;;;4BAJ2G;0BACtE;AAG3C,MAAMA,wBAAwB,CAACC,OAAOC;IAC7C,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAE,GAAGH;IAC7B,OAAO,WAAW,GAAGI,IAAAA,eAAI,EAACC,wBAAc,EAAE;QACtCC,OAAOL,cAAcM,MAAM;QAC3BC,UAAU,WAAW,GAAGC,IAAAA,gBAAK,EAACC,+BAAqB,EAAE;YACjDJ,OAAOL,cAAcU,aAAa;YAClCH,UAAU;gBACNL;gBACAD;aACH;QACL;IACJ;AACJ"}
|