@fluentui/react-dialog 9.10.5 → 9.10.7
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.md +30 -2
- package/dist/index.d.ts +6 -1
- package/lib/components/Dialog/index.js +1 -0
- package/lib/components/Dialog/index.js.map +1 -1
- package/lib/components/Dialog/renderDialog.js +7 -17
- package/lib/components/Dialog/renderDialog.js.map +1 -1
- package/lib/components/DialogBackdropMotion.js +23 -0
- package/lib/components/DialogBackdropMotion.js.map +1 -0
- package/lib/components/DialogSurface/DialogSurface.types.js.map +1 -1
- package/lib/components/DialogSurface/renderDialogSurface.js +7 -2
- package/lib/components/DialogSurface/renderDialogSurface.js.map +1 -1
- package/lib/components/DialogSurface/useDialogSurface.js +12 -16
- package/lib/components/DialogSurface/useDialogSurface.js.map +1 -1
- package/lib/components/DialogSurface/useDialogSurfaceStyles.styles.js +9 -79
- package/lib/components/DialogSurface/useDialogSurfaceStyles.styles.js.map +1 -1
- package/lib/components/DialogSurfaceMotion.js +28 -0
- package/lib/components/DialogSurfaceMotion.js.map +1 -0
- package/lib/components/DialogTitle/useDialogTitleStyles.styles.js +3 -3
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib-commonjs/components/Dialog/index.js +1 -0
- package/lib-commonjs/components/Dialog/index.js.map +1 -1
- package/lib-commonjs/components/Dialog/renderDialog.js +8 -17
- package/lib-commonjs/components/Dialog/renderDialog.js.map +1 -1
- package/lib-commonjs/components/DialogBackdropMotion.js +33 -0
- package/lib-commonjs/components/DialogBackdropMotion.js.map +1 -0
- package/lib-commonjs/components/DialogSurface/renderDialogSurface.js +7 -2
- package/lib-commonjs/components/DialogSurface/renderDialogSurface.js.map +1 -1
- package/lib-commonjs/components/DialogSurface/useDialogSurface.js +12 -16
- package/lib-commonjs/components/DialogSurface/useDialogSurface.js.map +1 -1
- package/lib-commonjs/components/DialogSurface/useDialogSurfaceStyles.styles.js +24 -106
- package/lib-commonjs/components/DialogSurface/useDialogSurfaceStyles.styles.js.map +1 -1
- package/lib-commonjs/components/DialogSurfaceMotion.js +38 -0
- package/lib-commonjs/components/DialogSurfaceMotion.js.map +1 -0
- package/lib-commonjs/components/DialogTitle/useDialogTitleStyles.styles.js +13 -13
- package/lib-commonjs/components/DialogTitle/useDialogTitleStyles.styles.js.map +1 -1
- package/lib-commonjs/index.js +3 -0
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +10 -10
- package/lib/contexts/dialogTransitionContext.js +0 -17
- package/lib/contexts/dialogTransitionContext.js.map +0 -1
- package/lib-commonjs/contexts/dialogTransitionContext.js +0 -32
- package/lib-commonjs/contexts/dialogTransitionContext.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,40 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-dialog
|
|
2
2
|
|
|
3
|
-
This log was last generated on Thu,
|
|
3
|
+
This log was last generated on Thu, 23 May 2024 07:57:54 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.10.7](https://github.com/microsoft/fluentui/tree/@fluentui/react-dialog_v9.10.7)
|
|
8
|
+
|
|
9
|
+
Thu, 23 May 2024 07:57:54 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-dialog_v9.10.6..@fluentui/react-dialog_v9.10.7)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- chore(Dialog): migrate to new motion APIs ([PR #31380](https://github.com/microsoft/fluentui/pull/31380) by olfedias@microsoft.com)
|
|
15
|
+
- Bump @fluentui/react-aria to v9.11.4 ([commit](https://github.com/microsoft/fluentui/commit/10e6758b203de79c53ce31ba264e137f83f50ff4) by beachball)
|
|
16
|
+
- Bump @fluentui/react-tabster to v9.21.4 ([commit](https://github.com/microsoft/fluentui/commit/10e6758b203de79c53ce31ba264e137f83f50ff4) by beachball)
|
|
17
|
+
- Bump @fluentui/react-portal to v9.4.26 ([commit](https://github.com/microsoft/fluentui/commit/10e6758b203de79c53ce31ba264e137f83f50ff4) by beachball)
|
|
18
|
+
|
|
19
|
+
## [9.10.6](https://github.com/microsoft/fluentui/tree/@fluentui/react-dialog_v9.10.6)
|
|
20
|
+
|
|
21
|
+
Mon, 20 May 2024 12:44:55 GMT
|
|
22
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-dialog_v9.10.5..@fluentui/react-dialog_v9.10.6)
|
|
23
|
+
|
|
24
|
+
### Patches
|
|
25
|
+
|
|
26
|
+
- chore: bump @griffel/react ([PR #31258](https://github.com/microsoft/fluentui/pull/31258) by olfedias@microsoft.com)
|
|
27
|
+
- Bump @fluentui/react-utilities to v9.18.9 ([PR #26682](https://github.com/microsoft/fluentui/pull/26682) by beachball)
|
|
28
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.38 ([PR #26682](https://github.com/microsoft/fluentui/pull/26682) by beachball)
|
|
29
|
+
- Bump @fluentui/react-context-selector to v9.1.60 ([PR #26682](https://github.com/microsoft/fluentui/pull/26682) by beachball)
|
|
30
|
+
- Bump @fluentui/react-shared-contexts to v9.19.0 ([PR #26682](https://github.com/microsoft/fluentui/pull/26682) by beachball)
|
|
31
|
+
- Bump @fluentui/react-aria to v9.11.3 ([PR #26682](https://github.com/microsoft/fluentui/pull/26682) by beachball)
|
|
32
|
+
- Bump @fluentui/react-tabster to v9.21.3 ([PR #26682](https://github.com/microsoft/fluentui/pull/26682) by beachball)
|
|
33
|
+
- Bump @fluentui/react-portal to v9.4.25 ([PR #26682](https://github.com/microsoft/fluentui/pull/26682) by beachball)
|
|
34
|
+
|
|
7
35
|
## [9.10.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-dialog_v9.10.5)
|
|
8
36
|
|
|
9
|
-
Thu, 16 May 2024 09:
|
|
37
|
+
Thu, 16 May 2024 09:25:14 GMT
|
|
10
38
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-dialog_v9.10.4..@fluentui/react-dialog_v9.10.5)
|
|
11
39
|
|
|
12
40
|
### Patches
|
package/dist/index.d.ts
CHANGED
|
@@ -117,7 +117,7 @@ export declare type DialogContextValue = {
|
|
|
117
117
|
requestOpenChange: (data: DialogOpenChangeData) => void;
|
|
118
118
|
} & Partial<ReturnType<typeof useModalAttributes>>;
|
|
119
119
|
|
|
120
|
-
declare type DialogContextValues = {
|
|
120
|
+
export declare type DialogContextValues = {
|
|
121
121
|
dialog: DialogContextValue;
|
|
122
122
|
/**
|
|
123
123
|
* dialogSurface context is provided by Dialog as false
|
|
@@ -256,9 +256,12 @@ export declare type DialogSurfaceSlots = {
|
|
|
256
256
|
* State used in rendering DialogSurface
|
|
257
257
|
*/
|
|
258
258
|
export declare type DialogSurfaceState = ComponentState<DialogSurfaceSlots> & Pick<DialogContextValue, 'isNestedDialog'> & Pick<PortalProps, 'mountNode'> & {
|
|
259
|
+
open?: boolean;
|
|
259
260
|
/**
|
|
260
261
|
* Transition status for animation.
|
|
261
262
|
* In test environment, this is always `undefined`.
|
|
263
|
+
*
|
|
264
|
+
* @deprecated Will be always `undefined`.
|
|
262
265
|
*/
|
|
263
266
|
transitionStatus?: 'entering' | 'entered' | 'idle' | 'exiting' | 'exited' | 'unmounted';
|
|
264
267
|
};
|
|
@@ -431,6 +434,8 @@ export declare const useDialogContentStyles_unstable: (state: DialogContentState
|
|
|
431
434
|
|
|
432
435
|
export declare const useDialogContext_unstable: <T>(selector: ContextSelector<DialogContextValue, T>) => T;
|
|
433
436
|
|
|
437
|
+
export declare function useDialogContextValues_unstable(state: DialogState): DialogContextValues;
|
|
438
|
+
|
|
434
439
|
/**
|
|
435
440
|
* Create the state required to render DialogSurface.
|
|
436
441
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './Dialog';\nexport * from './Dialog.types';\nexport * from './renderDialog';\nexport * from './useDialog';\n"],"names":[],"mappings":"AAAA,cAAc,WAAW;AACzB,cAAc,iBAAiB;AAC/B,cAAc,iBAAiB;AAC/B,cAAc,cAAc"}
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './Dialog';\nexport * from './Dialog.types';\nexport * from './renderDialog';\nexport * from './useDialog';\nexport * from './useDialogContextValues';\n"],"names":[],"mappings":"AAAA,cAAc,WAAW;AACzB,cAAc,iBAAiB;AAC/B,cAAc,iBAAiB;AAC/B,cAAc,cAAc;AAC5B,cAAc,2BAA2B"}
|
|
@@ -1,32 +1,22 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
import { DialogProvider, DialogSurfaceProvider } from '../../contexts';
|
|
4
|
-
import {
|
|
4
|
+
import { DialogSurfaceMotion } from '../DialogSurfaceMotion';
|
|
5
5
|
/**
|
|
6
6
|
* Render the final JSX of Dialog
|
|
7
7
|
*/ export const renderDialog_unstable = (state, contextValues)=>{
|
|
8
|
-
const { content, trigger } = state;
|
|
8
|
+
const { content, open, trigger } = state;
|
|
9
9
|
return /*#__PURE__*/ _jsx(DialogProvider, {
|
|
10
10
|
value: contextValues.dialog,
|
|
11
11
|
children: /*#__PURE__*/ _jsxs(DialogSurfaceProvider, {
|
|
12
12
|
value: contextValues.dialogSurface,
|
|
13
13
|
children: [
|
|
14
14
|
trigger,
|
|
15
|
-
|
|
16
|
-
value: undefined,
|
|
17
|
-
children: content
|
|
18
|
-
}) : /*#__PURE__*/ _jsx(Transition, {
|
|
19
|
-
mountOnEnter: true,
|
|
20
|
-
unmountOnExit: true,
|
|
21
|
-
in: state.open,
|
|
22
|
-
nodeRef: state.dialogRef,
|
|
15
|
+
content && /*#__PURE__*/ _jsx(DialogSurfaceMotion, {
|
|
23
16
|
appear: true,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
children:
|
|
27
|
-
value: status,
|
|
28
|
-
children: content
|
|
29
|
-
})
|
|
17
|
+
visible: open,
|
|
18
|
+
unmountOnExit: true,
|
|
19
|
+
children: content
|
|
30
20
|
})
|
|
31
21
|
]
|
|
32
22
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderDialog.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport
|
|
1
|
+
{"version":3,"sources":["renderDialog.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport * as React from 'react';\n\nimport { DialogProvider, DialogSurfaceProvider } from '../../contexts';\nimport { DialogSurfaceMotion } from '../DialogSurfaceMotion';\nimport type { DialogState, DialogContextValues } from './Dialog.types';\n\n/**\n * Render the final JSX of Dialog\n */\nexport const renderDialog_unstable = (state: DialogState, contextValues: DialogContextValues) => {\n const { content, open, trigger } = state;\n\n return (\n <DialogProvider value={contextValues.dialog}>\n <DialogSurfaceProvider value={contextValues.dialogSurface}>\n {trigger}\n {content && (\n <DialogSurfaceMotion appear visible={open} unmountOnExit>\n {/* Casting here as content should be equivalent to <DialogSurface/> */}\n {/* FIXME: content should not be ReactNode it should be ReactElement instead. */}\n {content as React.ReactElement}\n </DialogSurfaceMotion>\n )}\n </DialogSurfaceProvider>\n </DialogProvider>\n );\n};\n"],"names":["React","DialogProvider","DialogSurfaceProvider","DialogSurfaceMotion","renderDialog_unstable","state","contextValues","content","open","trigger","value","dialog","dialogSurface","appear","visible","unmountOnExit"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,YAAYA,WAAW,QAAQ;AAE/B,SAASC,cAAc,EAAEC,qBAAqB,QAAQ,iBAAiB;AACvE,SAASC,mBAAmB,QAAQ,yBAAyB;AAG7D;;CAEC,GACD,OAAO,MAAMC,wBAAwB,CAACC,OAAoBC;IACxD,MAAM,EAAEC,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAE,GAAGJ;IAEnC,qBACE,KAACJ;QAAeS,OAAOJ,cAAcK,MAAM;kBACzC,cAAA,MAACT;YAAsBQ,OAAOJ,cAAcM,aAAa;;gBACtDH;gBACAF,yBACC,KAACJ;oBAAoBU,MAAM;oBAACC,SAASN;oBAAMO,aAAa;8BAGrDR;;;;;AAMb,EAAE"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createPresenceComponent, motionTokens } from '@fluentui/react-motions-preview';
|
|
2
|
+
const keyframes = [
|
|
3
|
+
{
|
|
4
|
+
opacity: 0
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
opacity: 1
|
|
8
|
+
}
|
|
9
|
+
];
|
|
10
|
+
export const DialogBackdropMotion = createPresenceComponent({
|
|
11
|
+
enter: {
|
|
12
|
+
keyframes,
|
|
13
|
+
easing: motionTokens.curveLinear,
|
|
14
|
+
duration: motionTokens.durationGentle
|
|
15
|
+
},
|
|
16
|
+
exit: {
|
|
17
|
+
keyframes: [
|
|
18
|
+
...keyframes
|
|
19
|
+
].reverse(),
|
|
20
|
+
easing: motionTokens.curveLinear,
|
|
21
|
+
duration: motionTokens.durationGentle
|
|
22
|
+
}
|
|
23
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["DialogBackdropMotion.ts"],"sourcesContent":["import { createPresenceComponent, motionTokens } from '@fluentui/react-motions-preview';\n\nconst keyframes = [{ opacity: 0 }, { opacity: 1 }];\n\nexport const DialogBackdropMotion = createPresenceComponent({\n enter: {\n keyframes,\n easing: motionTokens.curveLinear,\n duration: motionTokens.durationGentle,\n },\n exit: {\n keyframes: [...keyframes].reverse(),\n easing: motionTokens.curveLinear,\n duration: motionTokens.durationGentle,\n },\n});\n"],"names":["createPresenceComponent","motionTokens","keyframes","opacity","DialogBackdropMotion","enter","easing","curveLinear","duration","durationGentle","exit","reverse"],"mappings":"AAAA,SAASA,uBAAuB,EAAEC,YAAY,QAAQ,kCAAkC;AAExF,MAAMC,YAAY;IAAC;QAAEC,SAAS;IAAE;IAAG;QAAEA,SAAS;IAAE;CAAE;AAElD,OAAO,MAAMC,uBAAuBJ,wBAAwB;IAC1DK,OAAO;QACLH;QACAI,QAAQL,aAAaM,WAAW;QAChCC,UAAUP,aAAaQ,cAAc;IACvC;IACAC,MAAM;QACJR,WAAW;eAAIA;SAAU,CAACS,OAAO;QACjCL,QAAQL,aAAaM,WAAW;QAChCC,UAAUP,aAAaQ,cAAc;IACvC;AACF,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DialogSurface.types.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["DialogSurface.types.ts"],"sourcesContent":["import type { PortalProps } from '@fluentui/react-portal';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nimport { DialogContextValue, DialogSurfaceContextValue } from '../../contexts';\n\nexport type DialogSurfaceSlots = {\n /**\n * Dimmed background of dialog.\n * The default backdrop is rendered as a `<div>` with styling.\n * This slot expects a `<div>` element which will replace the default backdrop.\n * The backdrop should have `aria-hidden=\"true\"`.\n *\n */\n backdrop?: Slot<'div'>;\n root: Slot<'div'>;\n};\n\n/**\n * Union between all possible semantic element that represent a DialogSurface\n */\nexport type DialogSurfaceElement = HTMLElement;\n\n/**\n * DialogSurface Props\n */\nexport type DialogSurfaceProps = ComponentProps<DialogSurfaceSlots> & Pick<PortalProps, 'mountNode'>;\n\nexport type DialogSurfaceContextValues = {\n dialogSurface: DialogSurfaceContextValue;\n};\n\n/**\n * State used in rendering DialogSurface\n */\nexport type DialogSurfaceState = ComponentState<DialogSurfaceSlots> &\n // This is only partial to avoid breaking changes, it should be mandatory and in fact it is always defined internally.\n Pick<DialogContextValue, 'isNestedDialog'> &\n Pick<PortalProps, 'mountNode'> & {\n open?: boolean;\n\n /**\n * Transition status for animation.\n * In test environment, this is always `undefined`.\n *\n * @deprecated Will be always `undefined`.\n */\n transitionStatus?: 'entering' | 'entered' | 'idle' | 'exiting' | 'exited' | 'unmounted';\n };\n"],"names":[],"mappings":"AAAA,WA+CI"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
|
+
import { Portal } from '@fluentui/react-portal';
|
|
2
3
|
import { assertSlots } from '@fluentui/react-utilities';
|
|
3
4
|
import { DialogSurfaceProvider } from '../../contexts';
|
|
4
|
-
import {
|
|
5
|
+
import { DialogBackdropMotion } from '../DialogBackdropMotion';
|
|
5
6
|
/**
|
|
6
7
|
* Render the final JSX of DialogSurface
|
|
7
8
|
*/ export const renderDialogSurface_unstable = (state, contextValues)=>{
|
|
@@ -9,7 +10,11 @@ import { Portal } from '@fluentui/react-portal';
|
|
|
9
10
|
return /*#__PURE__*/ _jsxs(Portal, {
|
|
10
11
|
mountNode: state.mountNode,
|
|
11
12
|
children: [
|
|
12
|
-
state.backdrop && /*#__PURE__*/ _jsx(
|
|
13
|
+
state.backdrop && /*#__PURE__*/ _jsx(DialogBackdropMotion, {
|
|
14
|
+
appear: true,
|
|
15
|
+
visible: state.open,
|
|
16
|
+
children: /*#__PURE__*/ _jsx(state.backdrop, {})
|
|
17
|
+
}),
|
|
13
18
|
/*#__PURE__*/ _jsx(DialogSurfaceProvider, {
|
|
14
19
|
value: contextValues.dialogSurface,
|
|
15
20
|
children: /*#__PURE__*/ _jsx(state.root, {})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderDialogSurface.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport {
|
|
1
|
+
{"version":3,"sources":["renderDialogSurface.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { Portal } from '@fluentui/react-portal';\nimport { assertSlots } from '@fluentui/react-utilities';\n\nimport { DialogSurfaceProvider } from '../../contexts';\nimport { DialogBackdropMotion } from '../DialogBackdropMotion';\nimport type { DialogSurfaceState, DialogSurfaceSlots, DialogSurfaceContextValues } from './DialogSurface.types';\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 && (\n <DialogBackdropMotion appear visible={state.open}>\n <state.backdrop />\n </DialogBackdropMotion>\n )}\n <DialogSurfaceProvider value={contextValues.dialogSurface}>\n <state.root />\n </DialogSurfaceProvider>\n </Portal>\n );\n};\n"],"names":["Portal","assertSlots","DialogSurfaceProvider","DialogBackdropMotion","renderDialogSurface_unstable","state","contextValues","mountNode","backdrop","appear","visible","open","value","dialogSurface","root"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,MAAM,QAAQ,yBAAyB;AAChD,SAASC,WAAW,QAAQ,4BAA4B;AAExD,SAASC,qBAAqB,QAAQ,iBAAiB;AACvD,SAASC,oBAAoB,QAAQ,0BAA0B;AAG/D;;CAEC,GACD,OAAO,MAAMC,+BAA+B,CAACC,OAA2BC;IACtEL,YAAgCI;IAEhC,qBACE,MAACL;QAAOO,WAAWF,MAAME,SAAS;;YAC/BF,MAAMG,QAAQ,kBACb,KAACL;gBAAqBM,MAAM;gBAACC,SAASL,MAAMM,IAAI;0BAC9C,cAAA,KAACN,MAAMG,QAAQ;;0BAGnB,KAACN;gBAAsBU,OAAON,cAAcO,aAAa;0BACvD,cAAA,KAACR,MAAMS,IAAI;;;;AAInB,EAAE"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Escape } from '@fluentui/keyboard-keys';
|
|
2
2
|
import { useEventCallback, useMergedRefs, isResolvedShorthand, slot, getIntrinsicElementProps, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';
|
|
3
|
+
import * as React from 'react';
|
|
3
4
|
import { useDialogContext_unstable } from '../../contexts';
|
|
4
|
-
import { Escape } from '@fluentui/keyboard-keys';
|
|
5
|
-
import { useDialogTransitionContext_unstable } from '../../contexts/dialogTransitionContext';
|
|
6
5
|
import { useDisableBodyScroll } from '../../utils/useDisableBodyScroll';
|
|
7
6
|
/**
|
|
8
7
|
* Create the state required to render DialogSurface.
|
|
@@ -15,7 +14,6 @@ import { useDisableBodyScroll } from '../../utils/useDisableBodyScroll';
|
|
|
15
14
|
*/ export const useDialogSurface_unstable = (props, ref)=>{
|
|
16
15
|
const modalType = useDialogContext_unstable((ctx)=>ctx.modalType);
|
|
17
16
|
const isNestedDialog = useDialogContext_unstable((ctx)=>ctx.isNestedDialog);
|
|
18
|
-
const transitionStatus = useDialogTransitionContext_unstable();
|
|
19
17
|
const modalAttributes = useDialogContext_unstable((ctx)=>ctx.modalAttributes);
|
|
20
18
|
const dialogRef = useDialogContext_unstable((ctx)=>ctx.dialogRef);
|
|
21
19
|
const requestOpenChange = useDialogContext_unstable((ctx)=>ctx.requestOpenChange);
|
|
@@ -59,32 +57,28 @@ import { useDisableBodyScroll } from '../../utils/useDisableBodyScroll';
|
|
|
59
57
|
backdrop.onClick = handledBackdropClick;
|
|
60
58
|
}
|
|
61
59
|
const { disableBodyScroll, enableBodyScroll } = useDisableBodyScroll();
|
|
62
|
-
const isBodyScrollLocked = Boolean(open && modalType !== 'non-modal');
|
|
63
60
|
useIsomorphicLayoutEffect(()=>{
|
|
64
|
-
if (isNestedDialog) {
|
|
61
|
+
if (isNestedDialog || modalType === 'non-modal') {
|
|
65
62
|
return;
|
|
66
63
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
} else if (transitionStatus === 'exited') {
|
|
64
|
+
disableBodyScroll();
|
|
65
|
+
return ()=>{
|
|
70
66
|
enableBodyScroll();
|
|
71
|
-
}
|
|
67
|
+
};
|
|
72
68
|
}, [
|
|
73
|
-
disableBodyScroll,
|
|
74
69
|
enableBodyScroll,
|
|
75
|
-
isBodyScrollLocked,
|
|
76
70
|
isNestedDialog,
|
|
77
|
-
|
|
78
|
-
|
|
71
|
+
disableBodyScroll,
|
|
72
|
+
modalType
|
|
79
73
|
]);
|
|
80
74
|
return {
|
|
81
75
|
components: {
|
|
82
76
|
backdrop: 'div',
|
|
83
77
|
root: 'div'
|
|
84
78
|
},
|
|
79
|
+
open,
|
|
85
80
|
backdrop,
|
|
86
81
|
isNestedDialog,
|
|
87
|
-
transitionStatus,
|
|
88
82
|
mountNode: props.mountNode,
|
|
89
83
|
root: slot.always(getIntrinsicElementProps('div', {
|
|
90
84
|
tabIndex: -1,
|
|
@@ -100,6 +94,8 @@ import { useDisableBodyScroll } from '../../utils/useDisableBodyScroll';
|
|
|
100
94
|
ref: useMergedRefs(ref, dialogRef)
|
|
101
95
|
}), {
|
|
102
96
|
elementType: 'div'
|
|
103
|
-
})
|
|
97
|
+
}),
|
|
98
|
+
// Deprecated properties
|
|
99
|
+
transitionStatus: undefined
|
|
104
100
|
};
|
|
105
101
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useDialogSurface.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["useDialogSurface.ts"],"sourcesContent":["import { Escape } from '@fluentui/keyboard-keys';\nimport {\n useEventCallback,\n useMergedRefs,\n isResolvedShorthand,\n slot,\n getIntrinsicElementProps,\n useIsomorphicLayoutEffect,\n} from '@fluentui/react-utilities';\nimport * as React from 'react';\n\nimport { useDialogContext_unstable } from '../../contexts';\nimport { useDisableBodyScroll } from '../../utils/useDisableBodyScroll';\nimport type { DialogSurfaceElement, DialogSurfaceProps, DialogSurfaceState } from './DialogSurface.types';\n\n/**\n * Create the state required to render DialogSurface.\n *\n * The returned state can be modified with hooks such as useDialogSurfaceStyles_unstable,\n * before being passed to renderDialogSurface_unstable.\n *\n * @param props - props from this instance of DialogSurface\n * @param ref - reference to root HTMLElement of DialogSurface\n */\nexport const useDialogSurface_unstable = (\n props: DialogSurfaceProps,\n ref: React.Ref<DialogSurfaceElement>,\n): DialogSurfaceState => {\n const modalType = useDialogContext_unstable(ctx => ctx.modalType);\n const isNestedDialog = useDialogContext_unstable(ctx => ctx.isNestedDialog);\n\n const modalAttributes = useDialogContext_unstable(ctx => ctx.modalAttributes);\n const dialogRef = useDialogContext_unstable(ctx => ctx.dialogRef);\n const requestOpenChange = useDialogContext_unstable(ctx => ctx.requestOpenChange);\n const dialogTitleID = useDialogContext_unstable(ctx => ctx.dialogTitleId);\n const open = useDialogContext_unstable(ctx => ctx.open);\n\n const handledBackdropClick = useEventCallback((event: React.MouseEvent<HTMLDivElement>) => {\n if (isResolvedShorthand(props.backdrop)) {\n props.backdrop.onClick?.(event);\n }\n if (modalType === 'modal' && !event.isDefaultPrevented()) {\n requestOpenChange({\n event,\n open: false,\n type: 'backdropClick',\n });\n }\n });\n\n const handleKeyDown = useEventCallback((event: React.KeyboardEvent<HTMLDivElement>) => {\n props.onKeyDown?.(event);\n\n if (event.key === Escape && !event.isDefaultPrevented()) {\n requestOpenChange({\n event,\n open: false,\n type: 'escapeKeyDown',\n });\n // stop propagation to avoid conflicting with other elements that listen for `Escape`\n // e,g: nested Dialog, Popover, Menu and Tooltip\n event.preventDefault();\n }\n });\n\n const backdrop = slot.optional(props.backdrop, {\n renderByDefault: modalType !== 'non-modal',\n defaultProps: {\n 'aria-hidden': 'true',\n },\n elementType: 'div',\n });\n if (backdrop) {\n backdrop.onClick = handledBackdropClick;\n }\n\n const { disableBodyScroll, enableBodyScroll } = useDisableBodyScroll();\n\n useIsomorphicLayoutEffect(() => {\n if (isNestedDialog || modalType === 'non-modal') {\n return;\n }\n\n disableBodyScroll();\n\n return () => {\n enableBodyScroll();\n };\n }, [enableBodyScroll, isNestedDialog, disableBodyScroll, modalType]);\n\n return {\n components: { backdrop: 'div', root: 'div' },\n open,\n backdrop,\n isNestedDialog,\n mountNode: props.mountNode,\n root: slot.always(\n getIntrinsicElementProps('div', {\n tabIndex: -1, // https://github.com/microsoft/fluentui/issues/25150\n 'aria-modal': modalType !== 'non-modal',\n role: modalType === 'alert' ? 'alertdialog' : 'dialog',\n 'aria-labelledby': props['aria-label'] ? undefined : dialogTitleID,\n ...props,\n ...modalAttributes,\n onKeyDown: handleKeyDown,\n // FIXME:\n // `DialogSurfaceElement` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: useMergedRefs(ref, dialogRef) as React.Ref<HTMLDivElement>,\n }),\n { elementType: 'div' },\n ),\n\n // Deprecated properties\n transitionStatus: undefined,\n };\n};\n"],"names":["Escape","useEventCallback","useMergedRefs","isResolvedShorthand","slot","getIntrinsicElementProps","useIsomorphicLayoutEffect","React","useDialogContext_unstable","useDisableBodyScroll","useDialogSurface_unstable","props","ref","modalType","ctx","isNestedDialog","modalAttributes","dialogRef","requestOpenChange","dialogTitleID","dialogTitleId","open","handledBackdropClick","event","backdrop","onClick","isDefaultPrevented","type","handleKeyDown","onKeyDown","key","preventDefault","optional","renderByDefault","defaultProps","elementType","disableBodyScroll","enableBodyScroll","components","root","mountNode","always","tabIndex","role","undefined","transitionStatus"],"mappings":"AAAA,SAASA,MAAM,QAAQ,0BAA0B;AACjD,SACEC,gBAAgB,EAChBC,aAAa,EACbC,mBAAmB,EACnBC,IAAI,EACJC,wBAAwB,EACxBC,yBAAyB,QACpB,4BAA4B;AACnC,YAAYC,WAAW,QAAQ;AAE/B,SAASC,yBAAyB,QAAQ,iBAAiB;AAC3D,SAASC,oBAAoB,QAAQ,mCAAmC;AAGxE;;;;;;;;CAQC,GACD,OAAO,MAAMC,4BAA4B,CACvCC,OACAC;IAEA,MAAMC,YAAYL,0BAA0BM,CAAAA,MAAOA,IAAID,SAAS;IAChE,MAAME,iBAAiBP,0BAA0BM,CAAAA,MAAOA,IAAIC,cAAc;IAE1E,MAAMC,kBAAkBR,0BAA0BM,CAAAA,MAAOA,IAAIE,eAAe;IAC5E,MAAMC,YAAYT,0BAA0BM,CAAAA,MAAOA,IAAIG,SAAS;IAChE,MAAMC,oBAAoBV,0BAA0BM,CAAAA,MAAOA,IAAII,iBAAiB;IAChF,MAAMC,gBAAgBX,0BAA0BM,CAAAA,MAAOA,IAAIM,aAAa;IACxE,MAAMC,OAAOb,0BAA0BM,CAAAA,MAAOA,IAAIO,IAAI;IAEtD,MAAMC,uBAAuBrB,iBAAiB,CAACsB;QAC7C,IAAIpB,oBAAoBQ,MAAMa,QAAQ,GAAG;gBACvCb,yBAAAA;aAAAA,0BAAAA,CAAAA,kBAAAA,MAAMa,QAAQ,EAACC,OAAO,cAAtBd,8CAAAA,6BAAAA,iBAAyBY;QAC3B;QACA,IAAIV,cAAc,WAAW,CAACU,MAAMG,kBAAkB,IAAI;YACxDR,kBAAkB;gBAChBK;gBACAF,MAAM;gBACNM,MAAM;YACR;QACF;IACF;IAEA,MAAMC,gBAAgB3B,iBAAiB,CAACsB;YACtCZ;SAAAA,mBAAAA,MAAMkB,SAAS,cAAflB,uCAAAA,sBAAAA,OAAkBY;QAElB,IAAIA,MAAMO,GAAG,KAAK9B,UAAU,CAACuB,MAAMG,kBAAkB,IAAI;YACvDR,kBAAkB;gBAChBK;gBACAF,MAAM;gBACNM,MAAM;YACR;YACA,qFAAqF;YACrF,gDAAgD;YAChDJ,MAAMQ,cAAc;QACtB;IACF;IAEA,MAAMP,WAAWpB,KAAK4B,QAAQ,CAACrB,MAAMa,QAAQ,EAAE;QAC7CS,iBAAiBpB,cAAc;QAC/BqB,cAAc;YACZ,eAAe;QACjB;QACAC,aAAa;IACf;IACA,IAAIX,UAAU;QACZA,SAASC,OAAO,GAAGH;IACrB;IAEA,MAAM,EAAEc,iBAAiB,EAAEC,gBAAgB,EAAE,GAAG5B;IAEhDH,0BAA0B;QACxB,IAAIS,kBAAkBF,cAAc,aAAa;YAC/C;QACF;QAEAuB;QAEA,OAAO;YACLC;QACF;IACF,GAAG;QAACA;QAAkBtB;QAAgBqB;QAAmBvB;KAAU;IAEnE,OAAO;QACLyB,YAAY;YAAEd,UAAU;YAAOe,MAAM;QAAM;QAC3ClB;QACAG;QACAT;QACAyB,WAAW7B,MAAM6B,SAAS;QAC1BD,MAAMnC,KAAKqC,MAAM,CACfpC,yBAAyB,OAAO;YAC9BqC,UAAU,CAAC;YACX,cAAc7B,cAAc;YAC5B8B,MAAM9B,cAAc,UAAU,gBAAgB;YAC9C,mBAAmBF,KAAK,CAAC,aAAa,GAAGiC,YAAYzB;YACrD,GAAGR,KAAK;YACR,GAAGK,eAAe;YAClBa,WAAWD;YACX,SAAS;YACT,6FAA6F;YAC7F,4FAA4F;YAC5FhB,KAAKV,cAAcU,KAAKK;QAC1B,IACA;YAAEkB,aAAa;QAAM;QAGvB,wBAAwB;QACxBU,kBAAkBD;IACpB;AACF,EAAE"}
|
|
@@ -9,85 +9,17 @@ export const dialogSurfaceClassNames = {
|
|
|
9
9
|
/**
|
|
10
10
|
* Styles for the root slot
|
|
11
11
|
*/
|
|
12
|
-
const useRootBaseStyle = /*#__PURE__*/__resetStyles("
|
|
13
|
-
r: [".
|
|
14
|
-
s: ["@media (forced-colors: active){.
|
|
12
|
+
const useRootBaseStyle = /*#__PURE__*/__resetStyles("r1svjbtt", "r131yuoq", {
|
|
13
|
+
r: [".r1svjbtt{inset:0;padding:24px;margin:auto;border-style:none;overflow:unset;border:1px solid var(--colorTransparentStroke);border-radius:var(--borderRadiusXLarge);display:block;-webkit-user-select:unset;-moz-user-select:unset;user-select:unset;visibility:unset;position:fixed;height:fit-content;max-width:600px;max-height:100vh;box-sizing:border-box;background-color:var(--colorNeutralBackground1);color:var(--colorNeutralForeground1);}", ".r1svjbtt:focus{outline-style:none;}", ".r1svjbtt:focus-visible{outline-style:none;}", ".r1svjbtt[data-fui-focus-visible]{border-top-color:transparent;border-right-color:transparent;border-bottom-color:transparent;border-left-color:transparent;}", ".r1svjbtt[data-fui-focus-visible]::after{content:\"\";position:absolute;pointer-events:none;z-index:1;border:2px solid var(--colorStrokeFocus2);border-radius:var(--borderRadiusMedium);top:calc(2px * -1);right:calc(2px * -1);bottom:calc(2px * -1);left:calc(2px * -1);}", ".r131yuoq{inset:0;padding:24px;margin:auto;border-style:none;overflow:unset;border:1px solid var(--colorTransparentStroke);border-radius:var(--borderRadiusXLarge);display:block;-webkit-user-select:unset;-moz-user-select:unset;user-select:unset;visibility:unset;position:fixed;height:fit-content;max-width:600px;max-height:100vh;box-sizing:border-box;background-color:var(--colorNeutralBackground1);color:var(--colorNeutralForeground1);}", ".r131yuoq:focus{outline-style:none;}", ".r131yuoq:focus-visible{outline-style:none;}", ".r131yuoq[data-fui-focus-visible]{border-top-color:transparent;border-left-color:transparent;border-bottom-color:transparent;border-right-color:transparent;}", ".r131yuoq[data-fui-focus-visible]::after{content:\"\";position:absolute;pointer-events:none;z-index:1;border:2px solid var(--colorStrokeFocus2);border-radius:var(--borderRadiusMedium);top:calc(2px * -1);left:calc(2px * -1);bottom:calc(2px * -1);right:calc(2px * -1);}"],
|
|
14
|
+
s: ["@media (forced-colors: active){.r1svjbtt[data-fui-focus-visible]::after{border-top-color:Highlight;border-right-color:Highlight;border-bottom-color:Highlight;border-left-color:Highlight;}}", "@media screen and (max-width: 480px){.r1svjbtt{max-width:100vw;}}", "@media screen and (max-height: 359px){.r1svjbtt{overflow-y:auto;padding-right:calc(24px - 4px);border-right-width:4px;border-top-width:4px;border-bottom-width:4px;}}", "@media (forced-colors: active){.r131yuoq[data-fui-focus-visible]::after{border-top-color:Highlight;border-left-color:Highlight;border-bottom-color:Highlight;border-right-color:Highlight;}}", "@media screen and (max-width: 480px){.r131yuoq{max-width:100vw;}}", "@media screen and (max-height: 359px){.r131yuoq{overflow-y:auto;padding-left:calc(24px - 4px);border-left-width:4px;border-top-width:4px;border-bottom-width:4px;}}"]
|
|
15
15
|
});
|
|
16
|
-
const
|
|
17
|
-
boxShadow: tokens.shadow64,
|
|
18
|
-
transform: 'scale(1) translateZ(0)',
|
|
19
|
-
opacity: 1
|
|
20
|
-
};
|
|
21
|
-
const rootWhenAnimating = {
|
|
22
|
-
transitionDuration: tokens.durationGentle,
|
|
23
|
-
transitionProperty: 'opacity, transform, box-shadow',
|
|
24
|
-
// // FIXME: https://github.com/microsoft/fluentui/issues/29473
|
|
25
|
-
transitionTimingFunction: tokens.curveDecelerateMid
|
|
26
|
-
};
|
|
27
|
-
const useRootStyles = /*#__PURE__*/__styles({
|
|
28
|
-
animated: {
|
|
29
|
-
abs64n: "fk73vx1",
|
|
30
|
-
E5pizo: "f1yzz98r",
|
|
31
|
-
Bz10aip: "f15ofi6c"
|
|
32
|
-
},
|
|
33
|
-
"static": {
|
|
34
|
-
E5pizo: "f10nrhrw"
|
|
35
|
-
},
|
|
36
|
-
unmounted: {},
|
|
37
|
-
entering: {
|
|
38
|
-
B3o57yi: "fc397y7",
|
|
39
|
-
Bmy1vo4: "f1b86uth",
|
|
40
|
-
Bkqvd7p: "f18ad807",
|
|
41
|
-
E5pizo: "f10nrhrw",
|
|
42
|
-
Bz10aip: "f186d0ee",
|
|
43
|
-
abs64n: "f5p0z4x"
|
|
44
|
-
},
|
|
45
|
-
entered: {
|
|
46
|
-
E5pizo: "f10nrhrw",
|
|
47
|
-
Bz10aip: "f186d0ee",
|
|
48
|
-
abs64n: "f5p0z4x"
|
|
49
|
-
},
|
|
50
|
-
idle: {
|
|
51
|
-
E5pizo: "f10nrhrw",
|
|
52
|
-
Bz10aip: "f186d0ee",
|
|
53
|
-
abs64n: "f5p0z4x"
|
|
54
|
-
},
|
|
55
|
-
exiting: {
|
|
56
|
-
B3o57yi: "fc397y7",
|
|
57
|
-
Bmy1vo4: "f1b86uth",
|
|
58
|
-
Bkqvd7p: "f1mfizis"
|
|
59
|
-
},
|
|
60
|
-
exited: {}
|
|
61
|
-
}, {
|
|
62
|
-
d: [".fk73vx1{opacity:0;}", ".f1yzz98r{box-shadow:0px 0px 0px 0px rgba(0, 0, 0, 0.1);}", ".f15ofi6c{transform:scale(0.85) translateZ(0);}", ".f10nrhrw{box-shadow:var(--shadow64);}", ".fc397y7{transition-duration:var(--durationGentle);}", ".f1b86uth{transition-property:opacity,transform,box-shadow;}", ".f18ad807{transition-timing-function:var(--curveDecelerateMid);}", ".f186d0ee{transform:scale(1) translateZ(0);}", ".f5p0z4x{opacity:1;}", ".f1mfizis{transition-timing-function:var(--curveAccelerateMin);}"]
|
|
63
|
-
});
|
|
64
|
-
/**
|
|
65
|
-
* Styles for the backdrop slot
|
|
66
|
-
*/
|
|
67
|
-
const backdropVisible = {
|
|
68
|
-
opacity: 1
|
|
69
|
-
};
|
|
70
|
-
const useBackdropBaseStyle = /*#__PURE__*/__resetStyles("r19ug08i", null, [".r19ug08i{inset:0px;background-color:rgba(0, 0, 0, 0.4);position:fixed;transition-duration:var(--durationGentle);transition-timing-function:var(--curveLinear);transition-property:opacity;will-change:opacity;opacity:0;}"]);
|
|
16
|
+
const useBackdropBaseStyle = /*#__PURE__*/__resetStyles("rsptlh5", null, [".rsptlh5{inset:0px;background-color:rgba(0, 0, 0, 0.4);position:fixed;}"]);
|
|
71
17
|
const useBackdropStyles = /*#__PURE__*/__styles({
|
|
72
18
|
nestedDialogBackdrop: {
|
|
73
19
|
De3pzq: "f1c21dwh"
|
|
74
|
-
}
|
|
75
|
-
unmounted: {},
|
|
76
|
-
entering: {
|
|
77
|
-
abs64n: "f5p0z4x"
|
|
78
|
-
},
|
|
79
|
-
entered: {
|
|
80
|
-
abs64n: "f5p0z4x"
|
|
81
|
-
},
|
|
82
|
-
idle: {
|
|
83
|
-
abs64n: "f5p0z4x"
|
|
84
|
-
},
|
|
85
|
-
exiting: {
|
|
86
|
-
Bkqvd7p: "f1mfizis"
|
|
87
|
-
},
|
|
88
|
-
exited: {}
|
|
20
|
+
}
|
|
89
21
|
}, {
|
|
90
|
-
d: [".f1c21dwh{background-color:var(--colorTransparentBackground);}"
|
|
22
|
+
d: [".f1c21dwh{background-color:var(--colorTransparentBackground);}"]
|
|
91
23
|
});
|
|
92
24
|
/**
|
|
93
25
|
* Apply styling to the DialogSurface slots based on the state
|
|
@@ -96,16 +28,14 @@ export const useDialogSurfaceStyles_unstable = state => {
|
|
|
96
28
|
const {
|
|
97
29
|
isNestedDialog,
|
|
98
30
|
root,
|
|
99
|
-
backdrop
|
|
100
|
-
transitionStatus
|
|
31
|
+
backdrop
|
|
101
32
|
} = state;
|
|
102
33
|
const rootBaseStyle = useRootBaseStyle();
|
|
103
|
-
const rootStyles = useRootStyles();
|
|
104
34
|
const backdropBaseStyle = useBackdropBaseStyle();
|
|
105
35
|
const backdropStyles = useBackdropStyles();
|
|
106
|
-
root.className = mergeClasses(dialogSurfaceClassNames.root, rootBaseStyle,
|
|
36
|
+
root.className = mergeClasses(dialogSurfaceClassNames.root, rootBaseStyle, root.className);
|
|
107
37
|
if (backdrop) {
|
|
108
|
-
backdrop.className = mergeClasses(dialogSurfaceClassNames.backdrop, backdropBaseStyle, isNestedDialog && backdropStyles.nestedDialogBackdrop,
|
|
38
|
+
backdrop.className = mergeClasses(dialogSurfaceClassNames.backdrop, backdropBaseStyle, isNestedDialog && backdropStyles.nestedDialogBackdrop, backdrop.className);
|
|
109
39
|
}
|
|
110
40
|
return state;
|
|
111
41
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__resetStyles","__styles","mergeClasses","tokens","createFocusOutlineStyle","FULLSCREEN_DIALOG_SCROLLBAR_OFFSET","MEDIA_QUERY_BREAKPOINT_SELECTOR","MEDIA_QUERY_SHORT_SCREEN","SURFACE_BORDER_WIDTH","SURFACE_PADDING","dialogSurfaceClassNames","root","backdrop","useRootBaseStyle","r","s","
|
|
1
|
+
{"version":3,"names":["__resetStyles","__styles","mergeClasses","tokens","createFocusOutlineStyle","FULLSCREEN_DIALOG_SCROLLBAR_OFFSET","MEDIA_QUERY_BREAKPOINT_SELECTOR","MEDIA_QUERY_SHORT_SCREEN","SURFACE_BORDER_WIDTH","SURFACE_PADDING","dialogSurfaceClassNames","root","backdrop","useRootBaseStyle","r","s","useBackdropBaseStyle","useBackdropStyles","nestedDialogBackdrop","De3pzq","d","useDialogSurfaceStyles_unstable","state","isNestedDialog","rootBaseStyle","backdropBaseStyle","backdropStyles","className"],"sources":["useDialogSurfaceStyles.styles.js"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { FULLSCREEN_DIALOG_SCROLLBAR_OFFSET, MEDIA_QUERY_BREAKPOINT_SELECTOR, MEDIA_QUERY_SHORT_SCREEN, SURFACE_BORDER_WIDTH, SURFACE_PADDING } from '../../contexts';\nexport const dialogSurfaceClassNames = {\n root: 'fui-DialogSurface',\n backdrop: 'fui-DialogSurface__backdrop'\n};\n/**\n * Styles for the root slot\n */ const useRootBaseStyle = makeResetStyles({\n ...createFocusOutlineStyle(),\n inset: 0,\n padding: SURFACE_PADDING,\n margin: 'auto',\n borderStyle: 'none',\n overflow: 'unset',\n border: `${SURFACE_BORDER_WIDTH} solid ${tokens.colorTransparentStroke}`,\n borderRadius: tokens.borderRadiusXLarge,\n display: 'block',\n userSelect: 'unset',\n visibility: 'unset',\n position: 'fixed',\n height: 'fit-content',\n maxWidth: '600px',\n maxHeight: '100vh',\n boxSizing: 'border-box',\n backgroundColor: tokens.colorNeutralBackground1,\n color: tokens.colorNeutralForeground1,\n [MEDIA_QUERY_BREAKPOINT_SELECTOR]: {\n maxWidth: '100vw'\n },\n [MEDIA_QUERY_SHORT_SCREEN]: {\n overflowY: 'auto',\n // We need to offset the scrollbar by adding transparent borders otherwise\n // it conflicts with the border radius.\n paddingRight: `calc(${SURFACE_PADDING} - ${FULLSCREEN_DIALOG_SCROLLBAR_OFFSET})`,\n borderRightWidth: FULLSCREEN_DIALOG_SCROLLBAR_OFFSET,\n borderTopWidth: FULLSCREEN_DIALOG_SCROLLBAR_OFFSET,\n borderBottomWidth: FULLSCREEN_DIALOG_SCROLLBAR_OFFSET\n }\n});\nconst useBackdropBaseStyle = makeResetStyles({\n inset: '0px',\n backgroundColor: 'rgba(0, 0, 0, 0.4)',\n position: 'fixed'\n});\nconst useBackdropStyles = makeStyles({\n nestedDialogBackdrop: {\n backgroundColor: tokens.colorTransparentBackground\n }\n});\n/**\n * Apply styling to the DialogSurface slots based on the state\n */ export const useDialogSurfaceStyles_unstable = (state)=>{\n const { isNestedDialog, root, backdrop } = state;\n const rootBaseStyle = useRootBaseStyle();\n const backdropBaseStyle = useBackdropBaseStyle();\n const backdropStyles = useBackdropStyles();\n root.className = mergeClasses(dialogSurfaceClassNames.root, rootBaseStyle, root.className);\n if (backdrop) {\n backdrop.className = mergeClasses(dialogSurfaceClassNames.backdrop, backdropBaseStyle, isNestedDialog && backdropStyles.nestedDialogBackdrop, backdrop.className);\n }\n return state;\n};\n"],"mappings":"AAAA,SAAAA,aAAA,EAAAC,QAAA,EAAsCC,YAAY,QAAQ,gBAAgB;AAC1E,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,uBAAuB,QAAQ,yBAAyB;AACjE,SAASC,kCAAkC,EAAEC,+BAA+B,EAAEC,wBAAwB,EAAEC,oBAAoB,EAAEC,eAAe,QAAQ,gBAAgB;AACrK,OAAO,MAAMC,uBAAuB,GAAG;EACnCC,IAAI,EAAE,mBAAmB;EACzBC,QAAQ,EAAE;AACd,CAAC;AACD;AACA;AACA;AAAI,MAAMC,gBAAgB,gBAAGb,aAAA;EAAAc,CAAA;EAAAC,CAAA;AAAA,CA+B5B,CAAC;AACF,MAAMC,oBAAoB,gBAAGhB,aAAA,6FAI5B,CAAC;AACF,MAAMiB,iBAAiB,gBAAGhB,QAAA;EAAAiB,oBAAA;IAAAC,MAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,CAIzB,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMC,+BAA+B,GAAIC,KAAK,IAAG;EACxD,MAAM;IAAEC,cAAc;IAAEZ,IAAI;IAAEC;EAAS,CAAC,GAAGU,KAAK;EAChD,MAAME,aAAa,GAAGX,gBAAgB,CAAC,CAAC;EACxC,MAAMY,iBAAiB,GAAGT,oBAAoB,CAAC,CAAC;EAChD,MAAMU,cAAc,GAAGT,iBAAiB,CAAC,CAAC;EAC1CN,IAAI,CAACgB,SAAS,GAAGzB,YAAY,CAACQ,uBAAuB,CAACC,IAAI,EAAEa,aAAa,EAAEb,IAAI,CAACgB,SAAS,CAAC;EAC1F,IAAIf,QAAQ,EAAE;IACVA,QAAQ,CAACe,SAAS,GAAGzB,YAAY,CAACQ,uBAAuB,CAACE,QAAQ,EAAEa,iBAAiB,EAAEF,cAAc,IAAIG,cAAc,CAACR,oBAAoB,EAAEN,QAAQ,CAACe,SAAS,CAAC;EACrK;EACA,OAAOL,KAAK;AAChB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createPresenceComponent, motionTokens } from '@fluentui/react-motions-preview';
|
|
2
|
+
import { tokens } from '@fluentui/react-theme';
|
|
3
|
+
const keyframes = [
|
|
4
|
+
{
|
|
5
|
+
opacity: 0,
|
|
6
|
+
boxShadow: '0px 0px 0px 0px rgba(0, 0, 0, 0.1)',
|
|
7
|
+
transform: 'scale(0.85) translateZ(0)'
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
boxShadow: tokens.shadow64,
|
|
11
|
+
transform: 'scale(1) translateZ(0)',
|
|
12
|
+
opacity: 1
|
|
13
|
+
}
|
|
14
|
+
];
|
|
15
|
+
export const DialogSurfaceMotion = createPresenceComponent({
|
|
16
|
+
enter: {
|
|
17
|
+
keyframes,
|
|
18
|
+
easing: motionTokens.curveDecelerateMid,
|
|
19
|
+
duration: motionTokens.durationGentle
|
|
20
|
+
},
|
|
21
|
+
exit: {
|
|
22
|
+
keyframes: [
|
|
23
|
+
...keyframes
|
|
24
|
+
].reverse(),
|
|
25
|
+
easing: motionTokens.curveAccelerateMin,
|
|
26
|
+
duration: motionTokens.durationGentle
|
|
27
|
+
}
|
|
28
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["DialogSurfaceMotion.ts"],"sourcesContent":["import { createPresenceComponent, motionTokens } from '@fluentui/react-motions-preview';\nimport { tokens } from '@fluentui/react-theme';\n\nconst keyframes = [\n { opacity: 0, boxShadow: '0px 0px 0px 0px rgba(0, 0, 0, 0.1)', transform: 'scale(0.85) translateZ(0)' },\n {\n boxShadow: tokens.shadow64,\n transform: 'scale(1) translateZ(0)',\n opacity: 1,\n },\n];\n\nexport const DialogSurfaceMotion = createPresenceComponent({\n enter: {\n keyframes,\n easing: motionTokens.curveDecelerateMid,\n duration: motionTokens.durationGentle,\n },\n exit: {\n keyframes: [...keyframes].reverse(),\n easing: motionTokens.curveAccelerateMin,\n duration: motionTokens.durationGentle,\n },\n});\n"],"names":["createPresenceComponent","motionTokens","tokens","keyframes","opacity","boxShadow","transform","shadow64","DialogSurfaceMotion","enter","easing","curveDecelerateMid","duration","durationGentle","exit","reverse","curveAccelerateMin"],"mappings":"AAAA,SAASA,uBAAuB,EAAEC,YAAY,QAAQ,kCAAkC;AACxF,SAASC,MAAM,QAAQ,wBAAwB;AAE/C,MAAMC,YAAY;IAChB;QAAEC,SAAS;QAAGC,WAAW;QAAsCC,WAAW;IAA4B;IACtG;QACED,WAAWH,OAAOK,QAAQ;QAC1BD,WAAW;QACXF,SAAS;IACX;CACD;AAED,OAAO,MAAMI,sBAAsBR,wBAAwB;IACzDS,OAAO;QACLN;QACAO,QAAQT,aAAaU,kBAAkB;QACvCC,UAAUX,aAAaY,cAAc;IACvC;IACAC,MAAM;QACJX,WAAW;eAAIA;SAAU,CAACY,OAAO;QACjCL,QAAQT,aAAae,kBAAkB;QACvCJ,UAAUX,aAAaY,cAAc;IACvC;AACF,GAAG"}
|
|
@@ -24,9 +24,9 @@ const useActionResetStyles = /*#__PURE__*/__resetStyles("r13kcrze", null, [".r13
|
|
|
24
24
|
* Styles to be applied on internal elements used by default action on non-modal Dialog
|
|
25
25
|
* @internal
|
|
26
26
|
*/
|
|
27
|
-
export const useDialogTitleInternalStyles = /*#__PURE__*/__resetStyles("
|
|
28
|
-
r: [".
|
|
29
|
-
s: ["@media (forced-colors: active){.
|
|
27
|
+
export const useDialogTitleInternalStyles = /*#__PURE__*/__resetStyles("r2avt6e", "roj2bbc", {
|
|
28
|
+
r: [".r2avt6e{overflow:visible;padding:0;border-style:none;position:relative;box-sizing:content-box;background-color:inherit;color:inherit;font-family:inherit;font-size:inherit;cursor:pointer;line-height:0;-webkit-appearance:button;text-align:unset;}", ".r2avt6e:focus{outline-style:none;}", ".r2avt6e:focus-visible{outline-style:none;}", ".r2avt6e[data-fui-focus-visible]{border-top-color:transparent;border-right-color:transparent;border-bottom-color:transparent;border-left-color:transparent;}", ".r2avt6e[data-fui-focus-visible]::after{content:\"\";position:absolute;pointer-events:none;z-index:1;border:2px solid var(--colorStrokeFocus2);border-radius:var(--borderRadiusMedium);top:calc(2px * -1);right:calc(2px * -1);bottom:calc(2px * -1);left:calc(2px * -1);}", ".roj2bbc{overflow:visible;padding:0;border-style:none;position:relative;box-sizing:content-box;background-color:inherit;color:inherit;font-family:inherit;font-size:inherit;cursor:pointer;line-height:0;-webkit-appearance:button;text-align:unset;}", ".roj2bbc:focus{outline-style:none;}", ".roj2bbc:focus-visible{outline-style:none;}", ".roj2bbc[data-fui-focus-visible]{border-top-color:transparent;border-left-color:transparent;border-bottom-color:transparent;border-right-color:transparent;}", ".roj2bbc[data-fui-focus-visible]::after{content:\"\";position:absolute;pointer-events:none;z-index:1;border:2px solid var(--colorStrokeFocus2);border-radius:var(--borderRadiusMedium);top:calc(2px * -1);left:calc(2px * -1);bottom:calc(2px * -1);right:calc(2px * -1);}"],
|
|
29
|
+
s: ["@media (forced-colors: active){.r2avt6e[data-fui-focus-visible]::after{border-top-color:Highlight;border-right-color:Highlight;border-bottom-color:Highlight;border-left-color:Highlight;}}", "@media (forced-colors: active){.roj2bbc[data-fui-focus-visible]::after{border-top-color:Highlight;border-left-color:Highlight;border-bottom-color:Highlight;border-right-color:Highlight;}}"]
|
|
30
30
|
});
|
|
31
31
|
/**
|
|
32
32
|
* Apply styling to the DialogTitle slots based on the state
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Dialog, renderDialog_unstable, useDialog_unstable } from './Dialog';
|
|
1
|
+
export { Dialog, renderDialog_unstable, useDialog_unstable, useDialogContextValues_unstable } from './Dialog';
|
|
2
2
|
export { DialogTrigger, useDialogTrigger_unstable, renderDialogTrigger_unstable } from './DialogTrigger';
|
|
3
3
|
export { DialogActions, dialogActionsClassNames, useDialogActions_unstable, useDialogActionsStyles_unstable, renderDialogActions_unstable } from './DialogActions';
|
|
4
4
|
export { DialogBody, dialogBodyClassNames, useDialogBody_unstable, useDialogBodyStyles_unstable, renderDialogBody_unstable } from './DialogBody';
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export { Dialog, renderDialog_unstable, useDialog_unstable } from './Dialog';\nexport type {\n DialogSlots,\n DialogProps,\n DialogState,\n DialogOpenChangeData,\n DialogOpenChangeEvent,\n DialogOpenChangeEventHandler,\n} from './Dialog';\n\nexport { DialogTrigger, useDialogTrigger_unstable, renderDialogTrigger_unstable } from './DialogTrigger';\nexport type {\n DialogTriggerProps,\n DialogTriggerChildProps,\n DialogTriggerState,\n DialogTriggerAction,\n} from './DialogTrigger';\n\nexport {\n DialogActions,\n dialogActionsClassNames,\n useDialogActions_unstable,\n useDialogActionsStyles_unstable,\n renderDialogActions_unstable,\n} from './DialogActions';\nexport type {\n DialogActionsProps,\n DialogActionsSlots,\n DialogActionsState,\n DialogActionsPosition,\n} from './DialogActions';\n\nexport {\n DialogBody,\n dialogBodyClassNames,\n useDialogBody_unstable,\n useDialogBodyStyles_unstable,\n renderDialogBody_unstable,\n} from './DialogBody';\nexport type { DialogBodyProps, DialogBodySlots, DialogBodyState } from './DialogBody';\n\nexport {\n DialogTitle,\n dialogTitleClassNames,\n useDialogTitle_unstable,\n useDialogTitleStyles_unstable,\n renderDialogTitle_unstable,\n} from './DialogTitle';\nexport type { DialogTitleProps, DialogTitleSlots, DialogTitleState } from './DialogTitle';\n\nexport {\n DialogSurface,\n dialogSurfaceClassNames,\n useDialogSurface_unstable,\n useDialogSurfaceStyles_unstable,\n useDialogSurfaceContextValues_unstable,\n renderDialogSurface_unstable,\n} from './DialogSurface';\nexport type {\n DialogSurfaceProps,\n DialogSurfaceSlots,\n DialogSurfaceState,\n DialogSurfaceElement,\n DialogSurfaceContextValues,\n} from './DialogSurface';\n\nexport {\n DialogContent,\n dialogContentClassNames,\n useDialogContent_unstable,\n useDialogContentStyles_unstable,\n renderDialogContent_unstable,\n} from './DialogContent';\nexport type { DialogContentProps, DialogContentSlots, DialogContentState } from './DialogContent';\n\nexport {\n useDialogContext_unstable,\n useDialogSurfaceContext_unstable,\n DialogProvider,\n DialogSurfaceProvider,\n} from './contexts/index';\n\nexport type { DialogContextValue, DialogSurfaceContextValue } from './contexts/index';\n"],"names":["Dialog","renderDialog_unstable","useDialog_unstable","DialogTrigger","useDialogTrigger_unstable","renderDialogTrigger_unstable","DialogActions","dialogActionsClassNames","useDialogActions_unstable","useDialogActionsStyles_unstable","renderDialogActions_unstable","DialogBody","dialogBodyClassNames","useDialogBody_unstable","useDialogBodyStyles_unstable","renderDialogBody_unstable","DialogTitle","dialogTitleClassNames","useDialogTitle_unstable","useDialogTitleStyles_unstable","renderDialogTitle_unstable","DialogSurface","dialogSurfaceClassNames","useDialogSurface_unstable","useDialogSurfaceStyles_unstable","useDialogSurfaceContextValues_unstable","renderDialogSurface_unstable","DialogContent","dialogContentClassNames","useDialogContent_unstable","useDialogContentStyles_unstable","renderDialogContent_unstable","useDialogContext_unstable","useDialogSurfaceContext_unstable","DialogProvider","DialogSurfaceProvider"],"mappings":"AAAA,SAASA,MAAM,EAAEC,qBAAqB,EAAEC,kBAAkB,QAAQ,WAAW;
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export { Dialog, renderDialog_unstable, useDialog_unstable, useDialogContextValues_unstable } from './Dialog';\nexport type {\n DialogContextValues,\n DialogSlots,\n DialogProps,\n DialogState,\n DialogOpenChangeData,\n DialogOpenChangeEvent,\n DialogOpenChangeEventHandler,\n} from './Dialog';\n\nexport { DialogTrigger, useDialogTrigger_unstable, renderDialogTrigger_unstable } from './DialogTrigger';\nexport type {\n DialogTriggerProps,\n DialogTriggerChildProps,\n DialogTriggerState,\n DialogTriggerAction,\n} from './DialogTrigger';\n\nexport {\n DialogActions,\n dialogActionsClassNames,\n useDialogActions_unstable,\n useDialogActionsStyles_unstable,\n renderDialogActions_unstable,\n} from './DialogActions';\nexport type {\n DialogActionsProps,\n DialogActionsSlots,\n DialogActionsState,\n DialogActionsPosition,\n} from './DialogActions';\n\nexport {\n DialogBody,\n dialogBodyClassNames,\n useDialogBody_unstable,\n useDialogBodyStyles_unstable,\n renderDialogBody_unstable,\n} from './DialogBody';\nexport type { DialogBodyProps, DialogBodySlots, DialogBodyState } from './DialogBody';\n\nexport {\n DialogTitle,\n dialogTitleClassNames,\n useDialogTitle_unstable,\n useDialogTitleStyles_unstable,\n renderDialogTitle_unstable,\n} from './DialogTitle';\nexport type { DialogTitleProps, DialogTitleSlots, DialogTitleState } from './DialogTitle';\n\nexport {\n DialogSurface,\n dialogSurfaceClassNames,\n useDialogSurface_unstable,\n useDialogSurfaceStyles_unstable,\n useDialogSurfaceContextValues_unstable,\n renderDialogSurface_unstable,\n} from './DialogSurface';\nexport type {\n DialogSurfaceProps,\n DialogSurfaceSlots,\n DialogSurfaceState,\n DialogSurfaceElement,\n DialogSurfaceContextValues,\n} from './DialogSurface';\n\nexport {\n DialogContent,\n dialogContentClassNames,\n useDialogContent_unstable,\n useDialogContentStyles_unstable,\n renderDialogContent_unstable,\n} from './DialogContent';\nexport type { DialogContentProps, DialogContentSlots, DialogContentState } from './DialogContent';\n\nexport {\n useDialogContext_unstable,\n useDialogSurfaceContext_unstable,\n DialogProvider,\n DialogSurfaceProvider,\n} from './contexts/index';\n\nexport type { DialogContextValue, DialogSurfaceContextValue } from './contexts/index';\n"],"names":["Dialog","renderDialog_unstable","useDialog_unstable","useDialogContextValues_unstable","DialogTrigger","useDialogTrigger_unstable","renderDialogTrigger_unstable","DialogActions","dialogActionsClassNames","useDialogActions_unstable","useDialogActionsStyles_unstable","renderDialogActions_unstable","DialogBody","dialogBodyClassNames","useDialogBody_unstable","useDialogBodyStyles_unstable","renderDialogBody_unstable","DialogTitle","dialogTitleClassNames","useDialogTitle_unstable","useDialogTitleStyles_unstable","renderDialogTitle_unstable","DialogSurface","dialogSurfaceClassNames","useDialogSurface_unstable","useDialogSurfaceStyles_unstable","useDialogSurfaceContextValues_unstable","renderDialogSurface_unstable","DialogContent","dialogContentClassNames","useDialogContent_unstable","useDialogContentStyles_unstable","renderDialogContent_unstable","useDialogContext_unstable","useDialogSurfaceContext_unstable","DialogProvider","DialogSurfaceProvider"],"mappings":"AAAA,SAASA,MAAM,EAAEC,qBAAqB,EAAEC,kBAAkB,EAAEC,+BAA+B,QAAQ,WAAW;AAW9G,SAASC,aAAa,EAAEC,yBAAyB,EAAEC,4BAA4B,QAAQ,kBAAkB;AAQzG,SACEC,aAAa,EACbC,uBAAuB,EACvBC,yBAAyB,EACzBC,+BAA+B,EAC/BC,4BAA4B,QACvB,kBAAkB;AAQzB,SACEC,UAAU,EACVC,oBAAoB,EACpBC,sBAAsB,EACtBC,4BAA4B,EAC5BC,yBAAyB,QACpB,eAAe;AAGtB,SACEC,WAAW,EACXC,qBAAqB,EACrBC,uBAAuB,EACvBC,6BAA6B,EAC7BC,0BAA0B,QACrB,gBAAgB;AAGvB,SACEC,aAAa,EACbC,uBAAuB,EACvBC,yBAAyB,EACzBC,+BAA+B,EAC/BC,sCAAsC,EACtCC,4BAA4B,QACvB,kBAAkB;AASzB,SACEC,aAAa,EACbC,uBAAuB,EACvBC,yBAAyB,EACzBC,+BAA+B,EAC/BC,4BAA4B,QACvB,kBAAkB;AAGzB,SACEC,yBAAyB,EACzBC,gCAAgC,EAChCC,cAAc,EACdC,qBAAqB,QAChB,mBAAmB"}
|
|
@@ -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":";;;;;uBAAc;uBACA;uBACA;uBACA"}
|
|
1
|
+
{"version":3,"sources":["index.js"],"sourcesContent":["export * from './Dialog';\nexport * from './Dialog.types';\nexport * from './renderDialog';\nexport * from './useDialog';\nexport * from './useDialogContextValues';\n"],"names":[],"mappings":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA"}
|