@fluentui/react-dialog 9.0.0-beta.9 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +141 -2
- package/CHANGELOG.md +47 -3
- package/README.md +41 -1
- package/dist/index.d.ts +27 -21
- package/lib/components/Dialog/Dialog.types.js.map +1 -1
- package/lib/components/Dialog/useDialog.js +5 -6
- package/lib/components/Dialog/useDialog.js.map +1 -1
- package/lib/components/Dialog/useDialogContextValues.js +4 -4
- package/lib/components/Dialog/useDialogContextValues.js.map +1 -1
- package/lib/components/DialogBody/useDialogBody.js +3 -3
- package/lib/components/DialogBody/useDialogBody.js.map +1 -1
- package/lib/components/DialogBody/useDialogBodyStyles.js +25 -17
- package/lib/components/DialogBody/useDialogBodyStyles.js.map +1 -1
- package/lib/components/DialogContent/DialogContent.js +2 -1
- package/lib/components/DialogContent/DialogContent.js.map +1 -1
- package/lib/components/DialogContent/DialogContent.types.js.map +1 -1
- package/lib/components/DialogContent/renderDialogContent.js +1 -2
- package/lib/components/DialogContent/renderDialogContent.js.map +1 -1
- package/lib/components/DialogContent/useDialogContent.js +11 -10
- package/lib/components/DialogContent/useDialogContent.js.map +1 -1
- package/lib/components/DialogContent/useDialogContentStyles.js +23 -9
- package/lib/components/DialogContent/useDialogContentStyles.js.map +1 -1
- package/lib/components/DialogSurface/DialogSurface.types.js.map +1 -1
- package/lib/components/DialogSurface/useDialogSurface.js +10 -81
- package/lib/components/DialogSurface/useDialogSurface.js.map +1 -1
- package/lib/components/DialogSurface/useDialogSurfaceStyles.js +61 -59
- package/lib/components/DialogSurface/useDialogSurfaceStyles.js.map +1 -1
- package/lib/components/DialogTitle/DialogTitle.types.js.map +1 -1
- package/lib/components/DialogTitle/useDialogTitle.js +1 -1
- package/lib/components/DialogTitle/useDialogTitle.js.map +1 -1
- package/lib/components/DialogTitle/useDialogTitleStyles.js +29 -29
- package/lib/components/DialogTrigger/DialogTrigger.types.js.map +1 -1
- package/lib/components/DialogTrigger/useDialogTrigger.js +4 -3
- package/lib/components/DialogTrigger/useDialogTrigger.js.map +1 -1
- package/lib/contexts/constants.js +1 -1
- package/lib/contexts/constants.js.map +1 -1
- package/lib/contexts/dialogContext.js.map +1 -1
- package/lib/utils/index.js +0 -2
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/isEscapeKeyDown.js +1 -4
- package/lib/utils/isEscapeKeyDown.js.map +1 -1
- package/lib/utils/useFocusFirstElement.js +7 -8
- package/lib/utils/useFocusFirstElement.js.map +1 -1
- package/lib-commonjs/components/Dialog/useDialog.js +3 -4
- package/lib-commonjs/components/Dialog/useDialog.js.map +1 -1
- package/lib-commonjs/components/Dialog/useDialogContextValues.js +4 -4
- package/lib-commonjs/components/Dialog/useDialogContextValues.js.map +1 -1
- package/lib-commonjs/components/DialogBody/useDialogBody.js +3 -4
- package/lib-commonjs/components/DialogBody/useDialogBody.js.map +1 -1
- package/lib-commonjs/components/DialogBody/useDialogBodyStyles.js +25 -18
- package/lib-commonjs/components/DialogBody/useDialogBodyStyles.js.map +1 -1
- package/lib-commonjs/components/DialogContent/DialogContent.js +2 -1
- package/lib-commonjs/components/DialogContent/DialogContent.js.map +1 -1
- package/lib-commonjs/components/DialogContent/renderDialogContent.js +1 -2
- package/lib-commonjs/components/DialogContent/renderDialogContent.js.map +1 -1
- package/lib-commonjs/components/DialogContent/useDialogContent.js +12 -10
- package/lib-commonjs/components/DialogContent/useDialogContent.js.map +1 -1
- package/lib-commonjs/components/DialogContent/useDialogContentStyles.js +24 -8
- package/lib-commonjs/components/DialogContent/useDialogContentStyles.js.map +1 -1
- package/lib-commonjs/components/DialogSurface/useDialogSurface.js +10 -81
- package/lib-commonjs/components/DialogSurface/useDialogSurface.js.map +1 -1
- package/lib-commonjs/components/DialogSurface/useDialogSurfaceStyles.js +62 -60
- package/lib-commonjs/components/DialogSurface/useDialogSurfaceStyles.js.map +1 -1
- package/lib-commonjs/components/DialogTitle/useDialogTitle.js +1 -1
- package/lib-commonjs/components/DialogTitle/useDialogTitle.js.map +1 -1
- package/lib-commonjs/components/DialogTitle/useDialogTitleStyles.js +29 -29
- package/lib-commonjs/components/DialogTrigger/useDialogTrigger.js +4 -4
- package/lib-commonjs/components/DialogTrigger/useDialogTrigger.js.map +1 -1
- package/lib-commonjs/contexts/constants.js +2 -2
- package/lib-commonjs/contexts/constants.js.map +1 -1
- package/lib-commonjs/contexts/dialogContext.js.map +1 -1
- package/lib-commonjs/utils/index.js +0 -4
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/isEscapeKeyDown.js +1 -5
- package/lib-commonjs/utils/isEscapeKeyDown.js.map +1 -1
- package/lib-commonjs/utils/useFocusFirstElement.js +7 -9
- package/lib-commonjs/utils/useFocusFirstElement.js.map +1 -1
- package/package.json +9 -11
- package/lib/utils/isHTMLDialogElement.js +0 -4
- package/lib/utils/isHTMLDialogElement.js.map +0 -1
- package/lib/utils/useControlNativeDialogOpenState.js +0 -20
- package/lib/utils/useControlNativeDialogOpenState.js.map +0 -1
- package/lib-commonjs/utils/isHTMLDialogElement.js +0 -13
- package/lib-commonjs/utils/isHTMLDialogElement.js.map +0 -1
- package/lib-commonjs/utils/useControlNativeDialogOpenState.js +0 -31
- package/lib-commonjs/utils/useControlNativeDialogOpenState.js.map +0 -1
|
@@ -7,18 +7,36 @@ exports.useDialogContentStyles_unstable = exports.dialogContentClassNames = void
|
|
|
7
7
|
|
|
8
8
|
const react_1 = /*#__PURE__*/require("@griffel/react");
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
const constants_1 = /*#__PURE__*/require("../../contexts/constants");
|
|
11
|
+
|
|
12
|
+
const react_theme_1 = /*#__PURE__*/require("@fluentui/react-theme");
|
|
13
13
|
|
|
14
|
+
exports.dialogContentClassNames = {
|
|
15
|
+
root: 'fui-DialogContent'
|
|
14
16
|
};
|
|
15
17
|
/**
|
|
16
18
|
* Styles for the root slot
|
|
17
19
|
*/
|
|
18
20
|
|
|
19
21
|
const useStyles = /*#__PURE__*/react_1.__styles({
|
|
20
|
-
"root": {
|
|
21
|
-
|
|
22
|
+
"root": {
|
|
23
|
+
"a9b677": "fly5x3f",
|
|
24
|
+
"Bqenvij": "f1l02sjl",
|
|
25
|
+
"Bmxbyg5": "f5zp4f",
|
|
26
|
+
"sshi5w": "f1nxs5xn",
|
|
27
|
+
"B7ck84d": "f1ewtqcl",
|
|
28
|
+
"Ijaq50": "f6owso0",
|
|
29
|
+
"Br312pm": "fupswjn",
|
|
30
|
+
"nk6f5a": "foucsne",
|
|
31
|
+
"Bw0ie65": "f1ka72gx",
|
|
32
|
+
"Bahqtrf": "fk6fouc",
|
|
33
|
+
"Be2twd7": "fkhj508",
|
|
34
|
+
"Bhrd7zp": "figsok6",
|
|
35
|
+
"Bg96gwp": "f1i3iumi"
|
|
36
|
+
}
|
|
37
|
+
}, {
|
|
38
|
+
"d": [".fly5x3f{width:100%;}", ".f1l02sjl{height:100%;}", ".f5zp4f{overflow-y:auto;}", ".f1nxs5xn{min-height:32px;}", ".f1ewtqcl{box-sizing:border-box;}", ".f6owso0{grid-row-start:body;}", ".fupswjn{grid-column-start:body;}", ".foucsne{grid-row-end:body;}", ".f1ka72gx{grid-column-end:body;}", ".fk6fouc{font-family:var(--fontFamilyBase);}", ".fkhj508{font-size:var(--fontSizeBase300);}", ".figsok6{font-weight:var(--fontWeightRegular);}", ".f1i3iumi{line-height:var(--lineHeightBase300);}"]
|
|
39
|
+
});
|
|
22
40
|
/**
|
|
23
41
|
* Apply styling to the DialogContent slots based on the state
|
|
24
42
|
*/
|
|
@@ -26,9 +44,7 @@ const useStyles = /*#__PURE__*/react_1.__styles({
|
|
|
26
44
|
|
|
27
45
|
const useDialogContentStyles_unstable = state => {
|
|
28
46
|
const styles = useStyles();
|
|
29
|
-
state.root.className = react_1.mergeClasses(exports.dialogContentClassNames.root, styles.root, state.root.className);
|
|
30
|
-
// state.mySlot.className = mergeClasses(styles.mySlot, state.mySlot.className);
|
|
31
|
-
|
|
47
|
+
state.root.className = react_1.mergeClasses(exports.dialogContentClassNames.root, styles.root, state.root.className);
|
|
32
48
|
return state;
|
|
33
49
|
};
|
|
34
50
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-dialog/src/components/DialogContent/useDialogContentStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-dialog/src/components/DialogContent/useDialogContentStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AAGA,MAAA,WAAA,gBAAA,OAAA,CAAA,0BAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AAEa,OAAA,CAAA,uBAAA,GAA8D;EACzE,IAAI,EAAE;AADmE,CAA9D;AAIb;;AAEG;;AACH,MAAM,SAAS,gBAAG,OAAA,SAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAAlB;AAYA;;AAEG;;;AACI,MAAM,+BAA+B,GAAI,KAAD,IAAkD;EAC/F,MAAM,MAAM,GAAG,SAAS,EAAxB;EACA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,OAAA,CAAA,YAAA,CAAa,OAAA,CAAA,uBAAA,CAAwB,IAArC,EAA2C,MAAM,CAAC,IAAlD,EAAwD,KAAK,CAAC,IAAN,CAAW,SAAnE,CAAvB;EACA,OAAO,KAAP;AACD,CAJM;;AAAM,OAAA,CAAA,+BAAA,GAA+B,+BAA/B","sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport type { DialogContentSlots, DialogContentState } from './DialogContent.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { CONTENT_GRID_AREA } from '../../contexts/constants';\nimport { typographyStyles } from '@fluentui/react-theme';\n\nexport const dialogContentClassNames: SlotClassNames<DialogContentSlots> = {\n root: 'fui-DialogContent',\n};\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n width: '100%',\n height: '100%',\n overflowY: 'auto',\n minHeight: '32px',\n boxSizing: 'border-box',\n ...shorthands.gridArea(CONTENT_GRID_AREA),\n ...typographyStyles.body1,\n },\n});\n\n/**\n * Apply styling to the DialogContent slots based on the state\n */\nexport const useDialogContentStyles_unstable = (state: DialogContentState): DialogContentState => {\n const styles = useStyles();\n state.root.className = mergeClasses(dialogContentClassNames.root, styles.root, state.root.className);\n return state;\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -28,78 +28,12 @@ const useDialogSurface_unstable = (props, ref) => {
|
|
|
28
28
|
backdrop,
|
|
29
29
|
as
|
|
30
30
|
} = props;
|
|
31
|
-
const isNativeDialog = as === 'dialog' || as === undefined;
|
|
32
31
|
const modalType = contexts_1.useDialogContext_unstable(ctx => ctx.modalType);
|
|
33
32
|
const dialogRef = contexts_1.useDialogContext_unstable(ctx => ctx.dialogRef);
|
|
34
33
|
const open = contexts_1.useDialogContext_unstable(ctx => ctx.open);
|
|
35
34
|
const requestOpenChange = contexts_1.useDialogContext_unstable(ctx => ctx.requestOpenChange);
|
|
36
|
-
const dialogTitleID = contexts_1.useDialogContext_unstable(ctx => ctx.
|
|
37
|
-
const
|
|
38
|
-
const handleNativeClick = react_utilities_1.useEventCallback(event => {
|
|
39
|
-
var _a;
|
|
40
|
-
|
|
41
|
-
(_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, event);
|
|
42
|
-
|
|
43
|
-
if (modalType === 'alert' || event.target !== event.currentTarget) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const {
|
|
48
|
-
clientX,
|
|
49
|
-
clientY
|
|
50
|
-
} = event;
|
|
51
|
-
const {
|
|
52
|
-
top,
|
|
53
|
-
left,
|
|
54
|
-
width,
|
|
55
|
-
height
|
|
56
|
-
} = event.currentTarget.getBoundingClientRect();
|
|
57
|
-
const isBackdropClick = top > clientY || clientY > top + height || left > clientX || clientX > left + width;
|
|
58
|
-
|
|
59
|
-
if (isBackdropClick) {
|
|
60
|
-
requestOpenChange({
|
|
61
|
-
event,
|
|
62
|
-
open: false,
|
|
63
|
-
type: 'backdropClick'
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
const handleNativeCancel = react_utilities_1.useEventCallback(event => {
|
|
68
|
-
var _a, _b;
|
|
69
|
-
|
|
70
|
-
(_b = (_a = props).onCancel) === null || _b === void 0 ? void 0 : _b.call(_a, event);
|
|
71
|
-
|
|
72
|
-
if (event.currentTarget !== event.target) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
if (modalType !== 'alert') {
|
|
77
|
-
requestOpenChange({
|
|
78
|
-
event,
|
|
79
|
-
open: false,
|
|
80
|
-
type: 'dialogCancel'
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
event.preventDefault();
|
|
85
|
-
});
|
|
86
|
-
const handleNativeClose = react_utilities_1.useEventCallback(event => {
|
|
87
|
-
var _a, _b;
|
|
88
|
-
|
|
89
|
-
(_b = (_a = props).onClose) === null || _b === void 0 ? void 0 : _b.call(_a, event); // Ensure dialog remains open if force closed by close event
|
|
90
|
-
|
|
91
|
-
if (event.currentTarget.open !== open) {
|
|
92
|
-
if (open) {
|
|
93
|
-
if (modalType === 'non-modal') {
|
|
94
|
-
event.currentTarget.show();
|
|
95
|
-
} else {
|
|
96
|
-
event.currentTarget.showModal();
|
|
97
|
-
}
|
|
98
|
-
} else {
|
|
99
|
-
event.currentTarget.close();
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
});
|
|
35
|
+
const dialogTitleID = contexts_1.useDialogContext_unstable(ctx => ctx.dialogTitleId);
|
|
36
|
+
const dialogContentId = contexts_1.useDialogContext_unstable(ctx => ctx.dialogContentId);
|
|
103
37
|
const handledBackdropClick = react_utilities_1.useEventCallback(event => {
|
|
104
38
|
var _a, _b;
|
|
105
39
|
|
|
@@ -139,29 +73,24 @@ const useDialogSurface_unstable = (props, ref) => {
|
|
|
139
73
|
return {
|
|
140
74
|
components: {
|
|
141
75
|
backdrop: 'div',
|
|
142
|
-
root: '
|
|
76
|
+
root: 'div'
|
|
143
77
|
},
|
|
144
78
|
backdrop: react_utilities_1.resolveShorthand(backdrop, {
|
|
145
|
-
required:
|
|
79
|
+
required: open && modalType !== 'non-modal',
|
|
146
80
|
defaultProps: {
|
|
147
81
|
'aria-hidden': 'true',
|
|
148
82
|
onClick: handledBackdropClick
|
|
149
83
|
}
|
|
150
84
|
}),
|
|
151
|
-
root: react_utilities_1.getNativeElementProps(as !== null && as !== void 0 ? as : '
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
'aria-modal': modalType !== 'non-modal',
|
|
158
|
-
role: modalType === 'alert' ? 'alertdialog' : 'dialog'
|
|
159
|
-
}),
|
|
85
|
+
root: react_utilities_1.getNativeElementProps(as !== null && as !== void 0 ? as : 'div', {
|
|
86
|
+
tabIndex: -1,
|
|
87
|
+
'aria-modal': modalType !== 'non-modal',
|
|
88
|
+
role: modalType === 'alert' ? 'alertdialog' : 'dialog',
|
|
89
|
+
'aria-describedby': dialogContentId,
|
|
90
|
+
'aria-labelledby': props['aria-label'] ? undefined : dialogTitleID,
|
|
160
91
|
...props,
|
|
161
92
|
...modalAttributes,
|
|
162
93
|
onKeyDown: handleKeyDown,
|
|
163
|
-
'aria-describedby': dialogBodyID,
|
|
164
|
-
'aria-labelledby': props['aria-label'] ? undefined : dialogTitleID,
|
|
165
94
|
ref: react_utilities_1.useMergedRefs(ref, dialogRef)
|
|
166
95
|
})
|
|
167
96
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-dialog/src/components/DialogSurface/useDialogSurface.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAaA,MAAA,UAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AACA,MAAA,OAAA,gBAAA,OAAA,CAAA,aAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-dialog/src/components/DialogSurface/useDialogSurface.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAaA,MAAA,UAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AACA,MAAA,OAAA,gBAAA,OAAA,CAAA,aAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;AAEA;;;;;;;;AAQG;;;AACI,MAAM,yBAAyB,GAAG,CACvC,KADuC,EAEvC,GAFuC,KAGjB;EACtB,MAAM;IAAE,QAAF;IAAY;EAAZ,IAAmB,KAAzB;EACA,MAAM,SAAS,GAAG,UAAA,CAAA,yBAAA,CAA0B,GAAG,IAAI,GAAG,CAAC,SAArC,CAAlB;EACA,MAAM,SAAS,GAAG,UAAA,CAAA,yBAAA,CAA0B,GAAG,IAAI,GAAG,CAAC,SAArC,CAAlB;EACA,MAAM,IAAI,GAAG,UAAA,CAAA,yBAAA,CAA0B,GAAG,IAAI,GAAG,CAAC,IAArC,CAAb;EACA,MAAM,iBAAiB,GAAG,UAAA,CAAA,yBAAA,CAA0B,GAAG,IAAI,GAAG,CAAC,iBAArC,CAA1B;EACA,MAAM,aAAa,GAAG,UAAA,CAAA,yBAAA,CAA0B,GAAG,IAAI,GAAG,CAAC,aAArC,CAAtB;EACA,MAAM,eAAe,GAAG,UAAA,CAAA,yBAAA,CAA0B,GAAG,IAAI,GAAG,CAAC,eAArC,CAAxB;EAEA,MAAM,oBAAoB,GAAG,iBAAA,CAAA,gBAAA,CAAkB,KAAD,IAA4C;;;IACxF,IAAI,iBAAA,CAAA,mBAAA,CAAoB,KAAK,CAAC,QAA1B,CAAJ,EAAyC;MACvC,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,KAAK,CAAC,QAAN,EAAe,OAAf,MAAsB,IAAtB,IAAsB,EAAA,KAAA,KAAA,CAAtB,GAAsB,KAAA,CAAtB,GAAsB,EAAA,CAAA,IAAA,CAAA,EAAA,EAAG,KAAH,CAAtB;IACD;;IACD,IAAI,SAAS,KAAK,OAAd,IAAyB,CAAC,KAAK,CAAC,kBAAN,EAA9B,EAA0D;MACxD,iBAAiB,CAAC;QAChB,KADgB;QAEhB,IAAI,EAAE,KAFU;QAGhB,IAAI,EAAE;MAHU,CAAD,CAAjB;IAKD;EACF,CAX4B,CAA7B;EAaA,MAAM,aAAa,GAAG,iBAAA,CAAA,gBAAA,CAAkB,KAAD,IAAiE;;;IACtG,CAAA,EAAA,GAAA,KAAK,CAAC,SAAN,MAAe,IAAf,IAAe,EAAA,KAAA,KAAA,CAAf,GAAe,KAAA,CAAf,GAAe,EAAA,CAAA,IAAA,CAAf,KAAe,EAAG,KAAH,CAAf;;IAEA,IAAI,OAAA,CAAA,kBAAA,CAAmB,KAAnB,EAA0B,SAA1B,CAAJ,EAA0C;MACxC,iBAAiB,CAAC;QAChB,KADgB;QAEhB,IAAI,EAAE,KAFU;QAGhB,IAAI,EAAE;MAHU,CAAD,CAAjB,CADwC,CAMxC;MACA;;MACA,KAAK,CAAC,eAAN;IACD;EACF,CAbqB,CAAtB;EAeA,MAAM;IAAE;EAAF,IAAsB,eAAA,CAAA,kBAAA,CAAmB;IAAE,SAAS,EAAE,SAAS,KAAK;EAA3B,CAAnB,CAA5B;EAEA,OAAO;IACL,UAAU,EAAE;MACV,QAAQ,EAAE,KADA;MAEV,IAAI,EAAE;IAFI,CADP;IAKL,QAAQ,EAAE,iBAAA,CAAA,gBAAA,CAAiB,QAAjB,EAA2B;MACnC,QAAQ,EAAE,IAAI,IAAI,SAAS,KAAK,WADG;MAEnC,YAAY,EAAE;QACZ,eAAe,MADH;QAEZ,OAAO,EAAE;MAFG;IAFqB,CAA3B,CALL;IAYL,IAAI,EAAE,iBAAA,CAAA,qBAAA,CAAsB,EAAE,KAAA,IAAF,IAAA,EAAE,KAAA,KAAA,CAAF,GAAA,EAAA,GAAM,KAA5B,EAAmC;MACvC,QAAQ,EAAE,CAAC,CAD4B;MAEvC,cAAc,SAAS,KAAK,WAFW;MAGvC,IAAI,EAAE,SAAS,KAAK,OAAd,GAAwB,aAAxB,GAAwC,QAHP;MAIvC,oBAAoB,eAJmB;MAKvC,mBAAmB,KAAK,CAAC,YAAD,CAAL,GAAsB,SAAtB,GAAkC,aALd;MAMvC,GAAG,KANoC;MAOvC,GAAG,eAPoC;MAQvC,SAAS,EAAE,aAR4B;MASvC,GAAG,EAAE,iBAAA,CAAA,aAAA,CAAc,GAAd,EAAmB,SAAnB;IATkC,CAAnC;EAZD,CAAP;AAwBD,CAlEM;;AAAM,OAAA,CAAA,yBAAA,GAAyB,yBAAzB","sourcesContent":["import * as React from 'react';\nimport {\n getNativeElementProps,\n resolveShorthand,\n useEventCallback,\n useMergedRefs,\n isResolvedShorthand,\n} from '@fluentui/react-utilities';\nimport type {\n DialogSurfaceElement,\n DialogSurfaceElementIntersection,\n DialogSurfaceProps,\n DialogSurfaceState,\n} from './DialogSurface.types';\nimport { useDialogContext_unstable } from '../../contexts';\nimport { isEscapeKeyDismiss } from '../../utils';\nimport { useModalAttributes } from '@fluentui/react-tabster';\n\n/**\n * Create the state required to render DialogSurface.\n *\n * The returned state can be modified with hooks such as useDialogSurfaceStyles_unstable,\n * before being passed to renderDialogSurface_unstable.\n *\n * @param props - props from this instance of DialogSurface\n * @param ref - reference to root HTMLElement of DialogSurface\n */\nexport const useDialogSurface_unstable = (\n props: DialogSurfaceProps,\n ref: React.Ref<DialogSurfaceElement>,\n): DialogSurfaceState => {\n const { backdrop, as } = props;\n const modalType = useDialogContext_unstable(ctx => ctx.modalType);\n const dialogRef = useDialogContext_unstable(ctx => ctx.dialogRef);\n const open = useDialogContext_unstable(ctx => ctx.open);\n const requestOpenChange = useDialogContext_unstable(ctx => ctx.requestOpenChange);\n const dialogTitleID = useDialogContext_unstable(ctx => ctx.dialogTitleId);\n const dialogContentId = useDialogContext_unstable(ctx => ctx.dialogContentId);\n\n const handledBackdropClick = useEventCallback((event: React.MouseEvent<HTMLDivElement>) => {\n if (isResolvedShorthand(props.backdrop)) {\n props.backdrop.onClick?.(event);\n }\n if (modalType === 'modal' && !event.isDefaultPrevented()) {\n requestOpenChange({\n event,\n open: false,\n type: 'backdropClick',\n });\n }\n });\n\n const handleKeyDown = useEventCallback((event: React.KeyboardEvent<DialogSurfaceElementIntersection>) => {\n props.onKeyDown?.(event);\n\n if (isEscapeKeyDismiss(event, modalType)) {\n requestOpenChange({\n event,\n open: false,\n type: 'escapeKeyDown',\n });\n // stop propagation to avoid conflicting with other elements that listen for `Escape`\n // e,g: nested Dialog, Popover, Menu and Tooltip\n event.stopPropagation();\n }\n });\n\n const { modalAttributes } = useModalAttributes({ trapFocus: modalType !== 'non-modal' });\n\n return {\n components: {\n backdrop: 'div',\n root: 'div',\n },\n backdrop: resolveShorthand(backdrop, {\n required: open && modalType !== 'non-modal',\n defaultProps: {\n 'aria-hidden': 'true',\n onClick: handledBackdropClick,\n },\n }),\n root: getNativeElementProps(as ?? 'div', {\n tabIndex: -1, // https://github.com/microsoft/fluentui/issues/25150\n 'aria-modal': modalType !== 'non-modal',\n role: modalType === 'alert' ? 'alertdialog' : 'dialog',\n 'aria-describedby': dialogContentId,\n 'aria-labelledby': props['aria-label'] ? undefined : dialogTitleID,\n ...props,\n ...modalAttributes,\n onKeyDown: handleKeyDown,\n ref: useMergedRefs(ref, dialogRef),\n }),\n };\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -9,9 +9,9 @@ const react_1 = /*#__PURE__*/require("@griffel/react");
|
|
|
9
9
|
|
|
10
10
|
const react_theme_1 = /*#__PURE__*/require("@fluentui/react-theme");
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const react_tabster_1 = /*#__PURE__*/require("@fluentui/react-tabster");
|
|
13
13
|
|
|
14
|
-
const
|
|
14
|
+
const contexts_1 = /*#__PURE__*/require("../../contexts");
|
|
15
15
|
|
|
16
16
|
exports.dialogSurfaceClassNames = {
|
|
17
17
|
root: 'fui-DialogSurface',
|
|
@@ -22,7 +22,61 @@ exports.dialogSurfaceClassNames = {
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
const useStyles = /*#__PURE__*/react_1.__styles({
|
|
25
|
+
"focusOutline": {
|
|
26
|
+
"Brovlpu": "ftqa4ok",
|
|
27
|
+
"B486eqv": "f2hkw1w",
|
|
28
|
+
"B8q5s1w": "f8hki3x",
|
|
29
|
+
"Bci5o5g": ["f1d2448m", "ffh67wi"],
|
|
30
|
+
"n8qw10": "f1bjia2o",
|
|
31
|
+
"Bdrgwmp": ["ffh67wi", "f1d2448m"],
|
|
32
|
+
"Bm4h7ae": "f15bsgw9",
|
|
33
|
+
"B7ys5i9": "f14e48fq",
|
|
34
|
+
"Busjfv9": "f18yb2kv",
|
|
35
|
+
"Bhk32uz": "fd6o370",
|
|
36
|
+
"Bf4ptjt": "fh1cnn4",
|
|
37
|
+
"kclons": ["fy7oxxb", "f184ne2d"],
|
|
38
|
+
"Bhdgwq3": "fpukqih",
|
|
39
|
+
"Blkhhs4": ["f184ne2d", "fy7oxxb"],
|
|
40
|
+
"Bqtpl0w": "frrh606",
|
|
41
|
+
"clg4pj": ["f1v5zibi", "fo2hd23"],
|
|
42
|
+
"hgwjuy": "ful5kiu",
|
|
43
|
+
"Bonggc9": ["fo2hd23", "f1v5zibi"],
|
|
44
|
+
"B1tsrr9": ["f1jqcqds", "ftffrms"],
|
|
45
|
+
"Dah5zi": ["ftffrms", "f1jqcqds"],
|
|
46
|
+
"Bkh64rk": ["f2e7qr6", "fsr1zz6"],
|
|
47
|
+
"qqdqy8": ["fsr1zz6", "f2e7qr6"],
|
|
48
|
+
"B6dhp37": "f1dvezut",
|
|
49
|
+
"i03rao": ["fd0oaoj", "f1cwg4i8"],
|
|
50
|
+
"Boxcth7": "fjvm52t",
|
|
51
|
+
"Bsom6fd": ["f1cwg4i8", "fd0oaoj"],
|
|
52
|
+
"J0r882": "fdiulkx",
|
|
53
|
+
"Bjwuhne": "f1yalx80",
|
|
54
|
+
"Ghsupd": ["fq22d5a", "f1jw7pan"],
|
|
55
|
+
"Bule8hv": ["f1jw7pan", "fq22d5a"]
|
|
56
|
+
},
|
|
25
57
|
"root": {
|
|
58
|
+
"mc9l5x": "ftgm304",
|
|
59
|
+
"famaaq": "f1c515w",
|
|
60
|
+
"Bcdw1i0": "f1bitti",
|
|
61
|
+
"Bhzewxz": "f15twtuk",
|
|
62
|
+
"j35jbq": ["f1e31b4d", "f1vgc2s3"],
|
|
63
|
+
"B5kzvoi": "f1yab3r1",
|
|
64
|
+
"oyh7mz": ["f1vgc2s3", "f1e31b4d"],
|
|
65
|
+
"z8tnut": "fuq56rw",
|
|
66
|
+
"z189sj": ["f15kemlc", "fdgang7"],
|
|
67
|
+
"Byoj8tv": "fl2zwns",
|
|
68
|
+
"uwmqm3": ["fdgang7", "f15kemlc"],
|
|
69
|
+
"B6of3ja": "fgr6219",
|
|
70
|
+
"t21cq0": ["f1ujusj6", "fcgxt0o"],
|
|
71
|
+
"jrapky": "f10jk5vf",
|
|
72
|
+
"Frg6f3": ["fcgxt0o", "f1ujusj6"],
|
|
73
|
+
"icvyot": "fzkkow9",
|
|
74
|
+
"vrafjx": ["fcdblym", "fjik90z"],
|
|
75
|
+
"oivjwe": "fg706s2",
|
|
76
|
+
"wvpqe5": ["fjik90z", "fcdblym"],
|
|
77
|
+
"B68tc82": "f1ln0qer",
|
|
78
|
+
"Bmxbyg5": "fa2wlxz",
|
|
79
|
+
"fshzfu": "f120kxnn",
|
|
26
80
|
"qhf8xq": "f19dog8a",
|
|
27
81
|
"a9b677": "fly5x3f",
|
|
28
82
|
"Bqenvij": "f3052tw",
|
|
@@ -32,16 +86,10 @@ const useStyles = /*#__PURE__*/react_1.__styles({
|
|
|
32
86
|
"E5pizo": "f10nrhrw",
|
|
33
87
|
"De3pzq": "fxugw4r",
|
|
34
88
|
"sj55zd": "f19n0e5",
|
|
35
|
-
"i8kkvl": "f4px1ci",
|
|
36
|
-
"Belr9w4": "fn67r4l",
|
|
37
89
|
"B4j52fo": "f5ogflp",
|
|
38
90
|
"Bekrc4i": ["f1hqa2wf", "finvdd3"],
|
|
39
91
|
"Bn0qgzm": "f1f09k3d",
|
|
40
92
|
"ibv6hh": ["finvdd3", "f1hqa2wf"],
|
|
41
|
-
"icvyot": "fzkkow9",
|
|
42
|
-
"vrafjx": ["fcdblym", "fjik90z"],
|
|
43
|
-
"oivjwe": "fg706s2",
|
|
44
|
-
"wvpqe5": ["fjik90z", "fcdblym"],
|
|
45
93
|
"g2u3we": "fghlq4f",
|
|
46
94
|
"h3c5rm": ["f1gn591s", "fjscplz"],
|
|
47
95
|
"B9xav0g": "fb073pr",
|
|
@@ -50,51 +98,7 @@ const useStyles = /*#__PURE__*/react_1.__styles({
|
|
|
50
98
|
"Beyfa6y": ["f1ehz9de", "f1erghxr"],
|
|
51
99
|
"B7oj6ja": ["f1spoy8", "fmb70yw"],
|
|
52
100
|
"Btl43ni": ["fmb70yw", "f1spoy8"],
|
|
53
|
-
"
|
|
54
|
-
"t21cq0": ["f1ujusj6", "fcgxt0o"],
|
|
55
|
-
"jrapky": "f10jk5vf",
|
|
56
|
-
"Frg6f3": ["fcgxt0o", "f1ujusj6"],
|
|
57
|
-
"mc9l5x": "f13qh94s",
|
|
58
|
-
"wkccdc": "f874eam",
|
|
59
|
-
"Budl1dq": "fjj47a5",
|
|
60
|
-
"zoa1oz": "f16o7v7l",
|
|
61
|
-
"z8tnut": "fuq56rw",
|
|
62
|
-
"z189sj": ["f15kemlc", "fdgang7"],
|
|
63
|
-
"Byoj8tv": "fl2zwns",
|
|
64
|
-
"uwmqm3": ["fdgang7", "f15kemlc"],
|
|
65
|
-
"B5xtmjs": "ff54dml",
|
|
66
|
-
"Bqu9lor": "f52bj20",
|
|
67
|
-
"B06wobe": "f1dangjo"
|
|
68
|
-
},
|
|
69
|
-
"dialog": {
|
|
70
|
-
"mc9l5x": "ftgm304",
|
|
71
|
-
"qhf8xq": "f19dog8a",
|
|
72
|
-
"oyh7mz": ["f1vgc2s3", "f1e31b4d"],
|
|
73
|
-
"j35jbq": ["f1e31b4d", "f1vgc2s3"],
|
|
74
|
-
"Bhzewxz": "f15twtuk",
|
|
75
|
-
"B5kzvoi": "f1yab3r1",
|
|
76
|
-
"a9b677": "f1acs6jw",
|
|
77
|
-
"Bqenvij": "f3052tw",
|
|
78
|
-
"De3pzq": "f1k92xex",
|
|
79
|
-
"B2u0y6b": "fheyfof",
|
|
80
|
-
"Bxyxcbc": "f1xxuklu",
|
|
81
|
-
"famaaq": "f1c515w",
|
|
82
|
-
"Bcdw1i0": "f1bitti",
|
|
83
|
-
"z8tnut": "f1g0x7ka",
|
|
84
|
-
"z189sj": ["fhxju0i", "f1cnd47f"],
|
|
85
|
-
"Byoj8tv": "f1qch9an",
|
|
86
|
-
"uwmqm3": ["f1cnd47f", "fhxju0i"],
|
|
87
|
-
"B6of3ja": "fgr6219",
|
|
88
|
-
"t21cq0": ["f1ujusj6", "fcgxt0o"],
|
|
89
|
-
"jrapky": "f10jk5vf",
|
|
90
|
-
"Frg6f3": ["fcgxt0o", "f1ujusj6"],
|
|
91
|
-
"icvyot": "f1ern45e",
|
|
92
|
-
"vrafjx": ["f1n71otn", "f1deefiw"],
|
|
93
|
-
"oivjwe": "f1h8hb77",
|
|
94
|
-
"wvpqe5": ["f1deefiw", "f1n71otn"],
|
|
95
|
-
"B68tc82": "f1ln0qer",
|
|
96
|
-
"Bmxbyg5": "fa2wlxz",
|
|
97
|
-
"fshzfu": "f120kxnn"
|
|
101
|
+
"B5xtmjs": "ff54dml"
|
|
98
102
|
},
|
|
99
103
|
"backdrop": {
|
|
100
104
|
"qhf8xq": "f19dog8a",
|
|
@@ -111,13 +115,11 @@ const useStyles = /*#__PURE__*/react_1.__styles({
|
|
|
111
115
|
"fshzfu": "foe20jx"
|
|
112
116
|
}
|
|
113
117
|
}, {
|
|
114
|
-
"
|
|
118
|
+
"f": [".ftqa4ok:focus{outline-style:none;}"],
|
|
119
|
+
"i": [".f2hkw1w:focus-visible{outline-style:none;}"],
|
|
120
|
+
"d": [".f8hki3x[data-fui-focus-visible]{border-top-color:transparent;}", ".f1d2448m[data-fui-focus-visible]{border-right-color:transparent;}", ".ffh67wi[data-fui-focus-visible]{border-left-color:transparent;}", ".f1bjia2o[data-fui-focus-visible]{border-bottom-color:transparent;}", ".f15bsgw9[data-fui-focus-visible]::after{content:\"\";}", ".f14e48fq[data-fui-focus-visible]::after{position:absolute;}", ".f18yb2kv[data-fui-focus-visible]::after{pointer-events:none;}", ".fd6o370[data-fui-focus-visible]::after{z-index:1;}", ".fh1cnn4[data-fui-focus-visible]::after{border-top-style:solid;}", ".fy7oxxb[data-fui-focus-visible]::after{border-right-style:solid;}", ".f184ne2d[data-fui-focus-visible]::after{border-left-style:solid;}", ".fpukqih[data-fui-focus-visible]::after{border-bottom-style:solid;}", ".frrh606[data-fui-focus-visible]::after{border-top-width:2px;}", ".f1v5zibi[data-fui-focus-visible]::after{border-right-width:2px;}", ".fo2hd23[data-fui-focus-visible]::after{border-left-width:2px;}", ".ful5kiu[data-fui-focus-visible]::after{border-bottom-width:2px;}", ".f1jqcqds[data-fui-focus-visible]::after{border-bottom-right-radius:var(--borderRadiusMedium);}", ".ftffrms[data-fui-focus-visible]::after{border-bottom-left-radius:var(--borderRadiusMedium);}", ".f2e7qr6[data-fui-focus-visible]::after{border-top-right-radius:var(--borderRadiusMedium);}", ".fsr1zz6[data-fui-focus-visible]::after{border-top-left-radius:var(--borderRadiusMedium);}", ".f1dvezut[data-fui-focus-visible]::after{border-top-color:var(--colorStrokeFocus2);}", ".fd0oaoj[data-fui-focus-visible]::after{border-right-color:var(--colorStrokeFocus2);}", ".f1cwg4i8[data-fui-focus-visible]::after{border-left-color:var(--colorStrokeFocus2);}", ".fjvm52t[data-fui-focus-visible]::after{border-bottom-color:var(--colorStrokeFocus2);}", ".fdiulkx[data-fui-focus-visible]::after{top:-2px;}", ".f1yalx80[data-fui-focus-visible]::after{bottom:-2px;}", ".fq22d5a[data-fui-focus-visible]::after{left:-2px;}", ".f1jw7pan[data-fui-focus-visible]::after{right:-2px;}", ".ftgm304{display:block;}", ".f1c515w{-webkit-user-select:unset;-moz-user-select:unset;-ms-user-select:unset;user-select:unset;}", ".f1bitti{visibility:unset;}", ".f15twtuk{top:0;}", ".f1e31b4d{right:0;}", ".f1vgc2s3{left:0;}", ".f1yab3r1{bottom:0;}", ".fuq56rw{padding-top:24px;}", ".f15kemlc{padding-right:24px;}", ".fdgang7{padding-left:24px;}", ".fl2zwns{padding-bottom:24px;}", ".fgr6219{margin-top:auto;}", ".f1ujusj6{margin-right:auto;}", ".fcgxt0o{margin-left:auto;}", ".f10jk5vf{margin-bottom:auto;}", ".fzkkow9{border-top-style:solid;}", ".fcdblym{border-right-style:solid;}", ".fjik90z{border-left-style:solid;}", ".fg706s2{border-bottom-style:solid;}", ".f1ln0qer{overflow-x:unset;}", ".fa2wlxz{overflow-y:unset;}", ".f120kxnn::backdrop{background-color:rgba(0, 0, 0, 0.4);}", ".f19dog8a{position:fixed;}", ".fly5x3f{width:100%;}", ".f3052tw{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;}", ".fvgz9i8{max-width:600px;}", ".f6a9g1z{max-height:100vh;}", ".f1ewtqcl{box-sizing:border-box;}", ".f10nrhrw{box-shadow:var(--shadow64);}", ".fxugw4r{background-color:var(--colorNeutralBackground1);}", ".f19n0e5{color:var(--colorNeutralForeground1);}", ".f5ogflp{border-top-width:1px;}", ".f1hqa2wf{border-right-width:1px;}", ".finvdd3{border-left-width:1px;}", ".f1f09k3d{border-bottom-width:1px;}", ".fghlq4f{border-top-color:var(--colorTransparentStroke);}", ".f1gn591s{border-right-color:var(--colorTransparentStroke);}", ".fjscplz{border-left-color:var(--colorTransparentStroke);}", ".fb073pr{border-bottom-color:var(--colorTransparentStroke);}", ".f1erghxr{border-bottom-right-radius:8px;}", ".f1ehz9de{border-bottom-left-radius:8px;}", ".f1spoy8{border-top-right-radius:8px;}", ".fmb70yw{border-top-left-radius:8px;}", ".fju19wo{background-color:rgba(0, 0, 0, 0.4);}", ".f113wtx2{top:0px;}", ".f10k790i{right:0px;}", ".f1xynx9j{left:0px;}", ".f5gq2j6{bottom:0px;}", ".f3rmtva{background-color:transparent;}", ".foe20jx::backdrop{background-color:transparent;}"],
|
|
115
121
|
"m": [["@media screen and (max-width: 480px){.ff54dml{max-width:100vw;}}", {
|
|
116
122
|
"m": "screen and (max-width: 480px)"
|
|
117
|
-
}], ["@media screen and (max-width: 480px){.f52bj20{grid-template-rows:auto 1fr auto auto;}}", {
|
|
118
|
-
"m": "screen and (max-width: 480px)"
|
|
119
|
-
}], ["@media screen and (max-width: 480px){.f1dangjo{grid-template-areas:\"title title close-button\" \"body body body\" \"actions-start actions-start actions-start\" \"actions-end actions-end actions-end\";}}", {
|
|
120
|
-
"m": "screen and (max-width: 480px)"
|
|
121
123
|
}]]
|
|
122
124
|
});
|
|
123
125
|
/**
|
|
@@ -127,8 +129,8 @@ const useStyles = /*#__PURE__*/react_1.__styles({
|
|
|
127
129
|
|
|
128
130
|
const useDialogSurfaceStyles_unstable = state => {
|
|
129
131
|
const styles = useStyles();
|
|
130
|
-
const isNestedDialog =
|
|
131
|
-
state.root.className = react_1.mergeClasses(exports.dialogSurfaceClassNames.root, styles.
|
|
132
|
+
const isNestedDialog = contexts_1.useDialogContext_unstable(ctx => ctx.isNestedDialog);
|
|
133
|
+
state.root.className = react_1.mergeClasses(exports.dialogSurfaceClassNames.root, styles.root, styles.focusOutline, isNestedDialog && styles.nestedNativeDialogBackdrop, state.root.className);
|
|
132
134
|
|
|
133
135
|
if (state.backdrop) {
|
|
134
136
|
state.backdrop.className = react_1.mergeClasses(exports.dialogSurfaceClassNames.backdrop, styles.backdrop, isNestedDialog && styles.nestedDialogBackdrop, state.backdrop.className);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-dialog/src/components/DialogSurface/useDialogSurfaceStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AAEA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AACA,MAAA,
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-dialog/src/components/DialogSurface/useDialogSurfaceStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AAEA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;;AACA,MAAA,UAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AASa,OAAA,CAAA,uBAAA,GAA8D;EACzE,IAAI,EAAE,mBADmE;EAEzE,QAAQ,EAAE;AAF+D,CAA9D;AAKb;;AAEG;;AACH,MAAM,SAAS,gBAAG,OAAA,SAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;EAAA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;EAAA;AAAA,EAAlB;AA6CA;;AAEG;;;AACI,MAAM,+BAA+B,GAAI,KAAD,IAAkD;EAC/F,MAAM,MAAM,GAAG,SAAS,EAAxB;EACA,MAAM,cAAc,GAAG,UAAA,CAAA,yBAAA,CAA0B,GAAG,IAAI,GAAG,CAAC,cAArC,CAAvB;EAEA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,OAAA,CAAA,YAAA,CACrB,OAAA,CAAA,uBAAA,CAAwB,IADH,EAErB,MAAM,CAAC,IAFc,EAGrB,MAAM,CAAC,YAHc,EAIrB,cAAc,IAAI,MAAM,CAAC,0BAJJ,EAKrB,KAAK,CAAC,IAAN,CAAW,SALU,CAAvB;;EAOA,IAAI,KAAK,CAAC,QAAV,EAAoB;IAClB,KAAK,CAAC,QAAN,CAAe,SAAf,GAA2B,OAAA,CAAA,YAAA,CACzB,OAAA,CAAA,uBAAA,CAAwB,QADC,EAEzB,MAAM,CAAC,QAFkB,EAGzB,cAAc,IAAI,MAAM,CAAC,oBAHA,EAIzB,KAAK,CAAC,QAAN,CAAe,SAJU,CAA3B;EAMD;;EACD,OAAO,KAAP;AACD,CApBM;;AAAM,OAAA,CAAA,+BAAA,GAA+B,+BAA/B","sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { tokens } from '@fluentui/react-theme';\nimport { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport {\n MEDIA_QUERY_BREAKPOINT_SELECTOR,\n SURFACE_BORDER_RADIUS,\n SURFACE_BORDER_WIDTH,\n SURFACE_PADDING,\n useDialogContext_unstable,\n} from '../../contexts';\nimport type { DialogSurfaceSlots, DialogSurfaceState } from './DialogSurface.types';\n\nexport const dialogSurfaceClassNames: SlotClassNames<DialogSurfaceSlots> = {\n root: 'fui-DialogSurface',\n backdrop: 'fui-DialogSurface__backdrop',\n};\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n focusOutline: createFocusOutlineStyle(),\n root: {\n display: 'block',\n userSelect: 'unset',\n visibility: 'unset',\n ...shorthands.inset(0),\n ...shorthands.padding(0),\n ...shorthands.padding(SURFACE_PADDING),\n ...shorthands.margin('auto'),\n ...shorthands.borderStyle('none'),\n ...shorthands.overflow('unset'),\n '&::backdrop': {\n backgroundColor: 'rgba(0, 0, 0, 0.4)',\n },\n position: 'fixed',\n width: '100%',\n height: 'fit-content',\n maxWidth: '600px',\n maxHeight: '100vh',\n boxSizing: 'border-box',\n boxShadow: tokens.shadow64,\n backgroundColor: tokens.colorNeutralBackground1,\n color: tokens.colorNeutralForeground1,\n ...shorthands.border(SURFACE_BORDER_WIDTH, 'solid', tokens.colorTransparentStroke),\n ...shorthands.borderRadius(SURFACE_BORDER_RADIUS),\n [MEDIA_QUERY_BREAKPOINT_SELECTOR]: {\n maxWidth: '100vw',\n },\n },\n backdrop: {\n position: 'fixed',\n backgroundColor: 'rgba(0, 0, 0, 0.4)',\n ...shorthands.inset('0px'),\n },\n nestedDialogBackdrop: {\n backgroundColor: 'transparent',\n },\n nestedNativeDialogBackdrop: {\n '&::backdrop': {\n backgroundColor: 'transparent',\n },\n },\n});\n\n/**\n * Apply styling to the DialogSurface slots based on the state\n */\nexport const useDialogSurfaceStyles_unstable = (state: DialogSurfaceState): DialogSurfaceState => {\n const styles = useStyles();\n const isNestedDialog = useDialogContext_unstable(ctx => ctx.isNestedDialog);\n\n state.root.className = mergeClasses(\n dialogSurfaceClassNames.root,\n styles.root,\n styles.focusOutline,\n isNestedDialog && styles.nestedNativeDialogBackdrop,\n state.root.className,\n );\n if (state.backdrop) {\n state.backdrop.className = mergeClasses(\n dialogSurfaceClassNames.backdrop,\n styles.backdrop,\n isNestedDialog && styles.nestedDialogBackdrop,\n state.backdrop.className,\n );\n }\n return state;\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -43,7 +43,7 @@ const useDialogTitle_unstable = (props, ref) => {
|
|
|
43
43
|
},
|
|
44
44
|
root: react_utilities_1.getNativeElementProps(as !== null && as !== void 0 ? as : 'div', {
|
|
45
45
|
ref,
|
|
46
|
-
id: dialogContext_1.useDialogContext_unstable(ctx => ctx.
|
|
46
|
+
id: dialogContext_1.useDialogContext_unstable(ctx => ctx.dialogTitleId),
|
|
47
47
|
...props
|
|
48
48
|
}),
|
|
49
49
|
action: react_utilities_2.resolveShorthand(action, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-dialog/src/components/DialogTitle/useDialogTitle.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAEA,MAAA,eAAA,gBAAA,OAAA,CAAA,8BAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,gCAAA,CAAA;;AACA,MAAA,sBAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;AAEA;;;;;;;;AAQG;;;AACI,MAAM,uBAAuB,GAAG,CAAC,KAAD,EAA0B,GAA1B,KAA2E;EAChH,MAAM;IAAE,EAAF;IAAM;EAAN,IAAiB,KAAvB;EACA,MAAM,SAAS,GAAG,eAAA,CAAA,yBAAA,CAA0B,GAAG,IAAI,GAAG,CAAC,SAArC,CAAlB;EACA,MAAM,cAAc,GAAG,sBAAA,CAAA,4BAAA,EAAvB;EAEA,OAAO;IACL,UAAU,EAAE;MACV,IAAI,EAAE,KADI;MAEV,MAAM,EAAE;IAFE,CADP;IAKL,IAAI,EAAE,iBAAA,CAAA,qBAAA,CAAsB,EAAE,KAAA,IAAF,IAAA,EAAE,KAAA,KAAA,CAAF,GAAA,EAAA,GAAM,KAA5B,EAAmC;MACvC,GADuC;MAEvC,EAAE,EAAE,eAAA,CAAA,yBAAA,CAA0B,GAAG,IAAI,GAAG,CAAC,aAArC,CAFmC;MAGvC,GAAG;IAHoC,CAAnC,CALD;IAUL,MAAM,EAAE,iBAAA,CAAA,gBAAA,CAAiB,MAAjB,EAAyB;MAC/B,QAAQ,EAAE,SAAS,KAAK,WADO;MAE/B,YAAY,EAAE;QACZ,QAAQ,EACN,KAAA,CAAA,aAAA,CAAC,eAAA,CAAA,aAAD,EAAc;UAAC,MAAM,EAAC;QAAR,CAAd,EACE,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA;UACE,SAAS,EAAE,cAAc,CAAC,MAD5B;UACkC,cAErB;QAHb,CAAA,EAKE,KAAA,CAAA,aAAA,CAAC,aAAA,CAAA,gBAAD,EAAiB,IAAjB,CALF,CADF;MAFU;IAFiB,CAAzB;EAVH,CAAP;AA2BD,CAhCM;;AAAM,OAAA,CAAA,uBAAA,GAAuB,uBAAvB","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps } from '@fluentui/react-utilities';\nimport type { DialogTitleProps, DialogTitleState } from './DialogTitle.types';\nimport { useDialogContext_unstable } from '../../contexts/dialogContext';\nimport { Dismiss24Regular } from '@fluentui/react-icons';\nimport { resolveShorthand } from '@fluentui/react-utilities';\nimport { DialogTrigger } from '../DialogTrigger/DialogTrigger';\nimport { useDialogTitleInternalStyles } from './useDialogTitleStyles';\n\n/**\n * Create the state required to render DialogTitle.\n *\n * The returned state can be modified with hooks such as useDialogTitleStyles_unstable,\n * before being passed to renderDialogTitle_unstable.\n *\n * @param props - props from this instance of DialogTitle\n * @param ref - reference to root HTMLElement of DialogTitle\n */\nexport const useDialogTitle_unstable = (props: DialogTitleProps, ref: React.Ref<HTMLElement>): DialogTitleState => {\n const { as, action } = props;\n const modalType = useDialogContext_unstable(ctx => ctx.modalType);\n const internalStyles = useDialogTitleInternalStyles();\n\n return {\n components: {\n root: 'div',\n action: 'div',\n },\n root: getNativeElementProps(as ?? 'div', {\n ref,\n id: useDialogContext_unstable(ctx => ctx.
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-dialog/src/components/DialogTitle/useDialogTitle.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAEA,MAAA,eAAA,gBAAA,OAAA,CAAA,8BAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,gCAAA,CAAA;;AACA,MAAA,sBAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;AAEA;;;;;;;;AAQG;;;AACI,MAAM,uBAAuB,GAAG,CAAC,KAAD,EAA0B,GAA1B,KAA2E;EAChH,MAAM;IAAE,EAAF;IAAM;EAAN,IAAiB,KAAvB;EACA,MAAM,SAAS,GAAG,eAAA,CAAA,yBAAA,CAA0B,GAAG,IAAI,GAAG,CAAC,SAArC,CAAlB;EACA,MAAM,cAAc,GAAG,sBAAA,CAAA,4BAAA,EAAvB;EAEA,OAAO;IACL,UAAU,EAAE;MACV,IAAI,EAAE,KADI;MAEV,MAAM,EAAE;IAFE,CADP;IAKL,IAAI,EAAE,iBAAA,CAAA,qBAAA,CAAsB,EAAE,KAAA,IAAF,IAAA,EAAE,KAAA,KAAA,CAAF,GAAA,EAAA,GAAM,KAA5B,EAAmC;MACvC,GADuC;MAEvC,EAAE,EAAE,eAAA,CAAA,yBAAA,CAA0B,GAAG,IAAI,GAAG,CAAC,aAArC,CAFmC;MAGvC,GAAG;IAHoC,CAAnC,CALD;IAUL,MAAM,EAAE,iBAAA,CAAA,gBAAA,CAAiB,MAAjB,EAAyB;MAC/B,QAAQ,EAAE,SAAS,KAAK,WADO;MAE/B,YAAY,EAAE;QACZ,QAAQ,EACN,KAAA,CAAA,aAAA,CAAC,eAAA,CAAA,aAAD,EAAc;UAAC,MAAM,EAAC;QAAR,CAAd,EACE,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA;UACE,SAAS,EAAE,cAAc,CAAC,MAD5B;UACkC,cAErB;QAHb,CAAA,EAKE,KAAA,CAAA,aAAA,CAAC,aAAA,CAAA,gBAAD,EAAiB,IAAjB,CALF,CADF;MAFU;IAFiB,CAAzB;EAVH,CAAP;AA2BD,CAhCM;;AAAM,OAAA,CAAA,uBAAA,GAAuB,uBAAvB","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps } from '@fluentui/react-utilities';\nimport type { DialogTitleProps, DialogTitleState } from './DialogTitle.types';\nimport { useDialogContext_unstable } from '../../contexts/dialogContext';\nimport { Dismiss24Regular } from '@fluentui/react-icons';\nimport { resolveShorthand } from '@fluentui/react-utilities';\nimport { DialogTrigger } from '../DialogTrigger/DialogTrigger';\nimport { useDialogTitleInternalStyles } from './useDialogTitleStyles';\n\n/**\n * Create the state required to render DialogTitle.\n *\n * The returned state can be modified with hooks such as useDialogTitleStyles_unstable,\n * before being passed to renderDialogTitle_unstable.\n *\n * @param props - props from this instance of DialogTitle\n * @param ref - reference to root HTMLElement of DialogTitle\n */\nexport const useDialogTitle_unstable = (props: DialogTitleProps, ref: React.Ref<HTMLElement>): DialogTitleState => {\n const { as, action } = props;\n const modalType = useDialogContext_unstable(ctx => ctx.modalType);\n const internalStyles = useDialogTitleInternalStyles();\n\n return {\n components: {\n root: 'div',\n action: 'div',\n },\n root: getNativeElementProps(as ?? 'div', {\n ref,\n id: useDialogContext_unstable(ctx => ctx.dialogTitleId),\n ...props,\n }),\n action: resolveShorthand(action, {\n required: modalType === 'non-modal',\n defaultProps: {\n children: (\n <DialogTrigger action=\"close\">\n <button\n className={internalStyles.button}\n // TODO: find a better way to add internal labels\n aria-label=\"close\"\n >\n <Dismiss24Regular />\n </button>\n </DialogTrigger>\n ),\n },\n }),\n };\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -76,37 +76,37 @@ exports.useDialogTitleInternalStyles = /*#__PURE__*/react_1.__styles({
|
|
|
76
76
|
"fsow6f": "fgusgyc",
|
|
77
77
|
"Brovlpu": "ftqa4ok",
|
|
78
78
|
"B486eqv": "f2hkw1w",
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"
|
|
105
|
-
"
|
|
106
|
-
"
|
|
79
|
+
"B8q5s1w": "f8hki3x",
|
|
80
|
+
"Bci5o5g": ["f1d2448m", "ffh67wi"],
|
|
81
|
+
"n8qw10": "f1bjia2o",
|
|
82
|
+
"Bdrgwmp": ["ffh67wi", "f1d2448m"],
|
|
83
|
+
"Bm4h7ae": "f15bsgw9",
|
|
84
|
+
"B7ys5i9": "f14e48fq",
|
|
85
|
+
"Busjfv9": "f18yb2kv",
|
|
86
|
+
"Bhk32uz": "fd6o370",
|
|
87
|
+
"Bf4ptjt": "fh1cnn4",
|
|
88
|
+
"kclons": ["fy7oxxb", "f184ne2d"],
|
|
89
|
+
"Bhdgwq3": "fpukqih",
|
|
90
|
+
"Blkhhs4": ["f184ne2d", "fy7oxxb"],
|
|
91
|
+
"Bqtpl0w": "frrh606",
|
|
92
|
+
"clg4pj": ["f1v5zibi", "fo2hd23"],
|
|
93
|
+
"hgwjuy": "ful5kiu",
|
|
94
|
+
"Bonggc9": ["fo2hd23", "f1v5zibi"],
|
|
95
|
+
"B1tsrr9": ["f1jqcqds", "ftffrms"],
|
|
96
|
+
"Dah5zi": ["ftffrms", "f1jqcqds"],
|
|
97
|
+
"Bkh64rk": ["f2e7qr6", "fsr1zz6"],
|
|
98
|
+
"qqdqy8": ["fsr1zz6", "f2e7qr6"],
|
|
99
|
+
"B6dhp37": "f1dvezut",
|
|
100
|
+
"i03rao": ["fd0oaoj", "f1cwg4i8"],
|
|
101
|
+
"Boxcth7": "fjvm52t",
|
|
102
|
+
"Bsom6fd": ["f1cwg4i8", "fd0oaoj"],
|
|
103
|
+
"J0r882": "fdiulkx",
|
|
104
|
+
"Bjwuhne": "f1yalx80",
|
|
105
|
+
"Ghsupd": ["fq22d5a", "f1jw7pan"],
|
|
106
|
+
"Bule8hv": ["f1jw7pan", "fq22d5a"]
|
|
107
107
|
}
|
|
108
108
|
}, {
|
|
109
|
-
"d": [".f10pi13n{position:relative;}", ".f1e4lqlz{box-sizing:content-box;}", ".f1u2r49w{background-color:inherit;}", ".f1ym3bx4{color:inherit;}", ".f1mo0ibp{font-family:inherit;}", ".fjoy568{font-size:inherit;}", ".fez10in{line-height:0;}", ".f1mtd64y{overflow-x:visible;}", ".f1y7q3j9{overflow-y:visible;}", ".f1g0x7ka{padding-top:0;}", ".fhxju0i{padding-right:0;}", ".f1cnd47f{padding-left:0;}", ".f1qch9an{padding-bottom:0;}", ".f1ern45e{border-top-style:none;}", ".f1n71otn{border-right-style:none;}", ".f1deefiw{border-left-style:none;}", ".f1h8hb77{border-bottom-style:none;}", ".f37px4s{-webkit-appearance:button;}", ".fgusgyc{text-align:unset;}", ".
|
|
109
|
+
"d": [".f10pi13n{position:relative;}", ".f1e4lqlz{box-sizing:content-box;}", ".f1u2r49w{background-color:inherit;}", ".f1ym3bx4{color:inherit;}", ".f1mo0ibp{font-family:inherit;}", ".fjoy568{font-size:inherit;}", ".fez10in{line-height:0;}", ".f1mtd64y{overflow-x:visible;}", ".f1y7q3j9{overflow-y:visible;}", ".f1g0x7ka{padding-top:0;}", ".fhxju0i{padding-right:0;}", ".f1cnd47f{padding-left:0;}", ".f1qch9an{padding-bottom:0;}", ".f1ern45e{border-top-style:none;}", ".f1n71otn{border-right-style:none;}", ".f1deefiw{border-left-style:none;}", ".f1h8hb77{border-bottom-style:none;}", ".f37px4s{-webkit-appearance:button;}", ".fgusgyc{text-align:unset;}", ".f8hki3x[data-fui-focus-visible]{border-top-color:transparent;}", ".f1d2448m[data-fui-focus-visible]{border-right-color:transparent;}", ".ffh67wi[data-fui-focus-visible]{border-left-color:transparent;}", ".f1bjia2o[data-fui-focus-visible]{border-bottom-color:transparent;}", ".f15bsgw9[data-fui-focus-visible]::after{content:\"\";}", ".f14e48fq[data-fui-focus-visible]::after{position:absolute;}", ".f18yb2kv[data-fui-focus-visible]::after{pointer-events:none;}", ".fd6o370[data-fui-focus-visible]::after{z-index:1;}", ".fh1cnn4[data-fui-focus-visible]::after{border-top-style:solid;}", ".fy7oxxb[data-fui-focus-visible]::after{border-right-style:solid;}", ".f184ne2d[data-fui-focus-visible]::after{border-left-style:solid;}", ".fpukqih[data-fui-focus-visible]::after{border-bottom-style:solid;}", ".frrh606[data-fui-focus-visible]::after{border-top-width:2px;}", ".f1v5zibi[data-fui-focus-visible]::after{border-right-width:2px;}", ".fo2hd23[data-fui-focus-visible]::after{border-left-width:2px;}", ".ful5kiu[data-fui-focus-visible]::after{border-bottom-width:2px;}", ".f1jqcqds[data-fui-focus-visible]::after{border-bottom-right-radius:var(--borderRadiusMedium);}", ".ftffrms[data-fui-focus-visible]::after{border-bottom-left-radius:var(--borderRadiusMedium);}", ".f2e7qr6[data-fui-focus-visible]::after{border-top-right-radius:var(--borderRadiusMedium);}", ".fsr1zz6[data-fui-focus-visible]::after{border-top-left-radius:var(--borderRadiusMedium);}", ".f1dvezut[data-fui-focus-visible]::after{border-top-color:var(--colorStrokeFocus2);}", ".fd0oaoj[data-fui-focus-visible]::after{border-right-color:var(--colorStrokeFocus2);}", ".f1cwg4i8[data-fui-focus-visible]::after{border-left-color:var(--colorStrokeFocus2);}", ".fjvm52t[data-fui-focus-visible]::after{border-bottom-color:var(--colorStrokeFocus2);}", ".fdiulkx[data-fui-focus-visible]::after{top:-2px;}", ".f1yalx80[data-fui-focus-visible]::after{bottom:-2px;}", ".fq22d5a[data-fui-focus-visible]::after{left:-2px;}", ".f1jw7pan[data-fui-focus-visible]::after{right:-2px;}"],
|
|
110
110
|
"f": [".ftqa4ok:focus{outline-style:none;}"],
|
|
111
111
|
"i": [".f2hkw1w:focus-visible{outline-style:none;}"]
|
|
112
112
|
});
|
|
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useDialogTrigger_unstable = void 0;
|
|
7
7
|
|
|
8
|
-
const React = /*#__PURE__*/require("react");
|
|
9
|
-
|
|
10
8
|
const react_tabster_1 = /*#__PURE__*/require("@fluentui/react-tabster");
|
|
11
9
|
|
|
12
10
|
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
|
@@ -28,7 +26,7 @@ const useDialogTrigger_unstable = props => {
|
|
|
28
26
|
children,
|
|
29
27
|
action = isInsideSurfaceDialog ? 'close' : 'open'
|
|
30
28
|
} = props;
|
|
31
|
-
const child =
|
|
29
|
+
const child = react_utilities_1.getTriggerChild(children);
|
|
32
30
|
const requestOpenChange = contexts_1.useDialogContext_unstable(ctx => ctx.requestOpenChange);
|
|
33
31
|
const {
|
|
34
32
|
triggerAttributes
|
|
@@ -47,7 +45,9 @@ const useDialogTrigger_unstable = props => {
|
|
|
47
45
|
}
|
|
48
46
|
});
|
|
49
47
|
return {
|
|
50
|
-
children: react_utilities_1.applyTriggerPropsToChildren(children, react_aria_1.useARIAButtonProps((child === null || child === void 0 ? void 0 : child.type) === 'button' || (child === null || child === void 0 ? void 0 : child.type) === 'a' ? child.type : 'div', {
|
|
48
|
+
children: react_utilities_1.applyTriggerPropsToChildren(children, react_aria_1.useARIAButtonProps((child === null || child === void 0 ? void 0 : child.type) === 'button' || (child === null || child === void 0 ? void 0 : child.type) === 'a' ? child.type : 'div', {
|
|
49
|
+
type: 'button',
|
|
50
|
+
...(child === null || child === void 0 ? void 0 : child.props),
|
|
51
51
|
'aria-haspopup': action === 'close' ? undefined : 'dialog',
|
|
52
52
|
ref: child === null || child === void 0 ? void 0 : child.ref,
|
|
53
53
|
onClick: handleClick,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-dialog/src/components/DialogTrigger/useDialogTrigger.ts"],"names":[],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-dialog/src/components/DialogTrigger/useDialogTrigger.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAEA,MAAA,UAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AACA,MAAA,YAAA,gBAAA,OAAA,CAAA,sBAAA,CAAA;AAEA;;;;;AAKG;;;AACI,MAAM,yBAAyB,GAAI,KAAD,IAAkD;EACzF,MAAM,qBAAqB,GAAG,UAAA,CAAA,gCAAA,EAA9B;EAEA,MAAM;IAAE,QAAF;IAAY,MAAM,GAAG,qBAAqB,GAAG,OAAH,GAAa;EAAvD,IAAkE,KAAxE;EAEA,MAAM,KAAK,GAAG,iBAAA,CAAA,eAAA,CAAgB,QAAhB,CAAd;EAEA,MAAM,iBAAiB,GAAG,UAAA,CAAA,yBAAA,CAA0B,GAAG,IAAI,GAAG,CAAC,iBAArC,CAA1B;EAEA,MAAM;IAAE;EAAF,IAAwB,eAAA,CAAA,kBAAA,EAA9B;EAEA,MAAM,WAAW,GAAG,iBAAA,CAAA,gBAAA,CACjB,KAAD,IAAoF;;;IAClF,CAAA,EAAA,GAAA,KAAK,KAAA,IAAL,IAAA,KAAK,KAAA,KAAA,CAAL,GAAK,KAAA,CAAL,GAAK,CAAA,EAAA,GAAL,KAAK,CAAE,KAAF,EAAQ,OAAb,MAAoB,IAApB,IAAoB,EAAA,KAAA,KAAA,CAApB,GAAoB,KAAA,CAApB,GAAoB,EAAA,CAAA,IAAA,CAAA,EAAA,EAAG,KAAH,CAApB;;IACA,IAAI,CAAC,KAAK,CAAC,kBAAN,EAAL,EAAiC;MAC/B,iBAAiB,CAAC;QAChB,KADgB;QAEhB,IAAI,EAAE,cAFU;QAGhB,IAAI,EAAE,MAAM,KAAK;MAHD,CAAD,CAAjB;IAKD;EACF,CAViB,CAApB;EAaA,OAAO;IACL,QAAQ,EAAE,iBAAA,CAAA,2BAAA,CACR,QADQ,EAER,YAAA,CAAA,kBAAA,CAAmB,CAAA,KAAK,KAAA,IAAL,IAAA,KAAK,KAAA,KAAA,CAAL,GAAK,KAAA,CAAL,GAAA,KAAK,CAAE,IAAP,MAAgB,QAAhB,IAA4B,CAAA,KAAK,KAAA,IAAL,IAAA,KAAK,KAAA,KAAA,CAAL,GAAK,KAAA,CAAL,GAAA,KAAK,CAAE,IAAP,MAAgB,GAA5C,GAAkD,KAAK,CAAC,IAAxD,GAA+D,KAAlF,EAAyF;MACvF,IAAI,EAAE,QADiF;MAEvF,IAAG,KAAK,KAAA,IAAL,IAAA,KAAK,KAAA,KAAA,CAAL,GAAK,KAAA,CAAL,GAAA,KAAK,CAAE,KAAV,CAFuF;MAGvF,iBAAiB,MAAM,KAAK,OAAX,GAAqB,SAArB,GAAiC,QAHqC;MAIvF,GAAG,EAAE,KAAK,KAAA,IAAL,IAAA,KAAK,KAAA,KAAA,CAAL,GAAK,KAAA,CAAL,GAAA,KAAK,CAAE,GAJ2E;MAKvF,OAAO,EAAE,WAL8E;MAMvF,GAAG;IANoF,CAAzF,CAFQ;EADL,CAAP;AAaD,CArCM;;AAAM,OAAA,CAAA,yBAAA,GAAyB,yBAAzB","sourcesContent":["import * as React from 'react';\nimport { useModalAttributes } from '@fluentui/react-tabster';\nimport { applyTriggerPropsToChildren, getTriggerChild, useEventCallback } from '@fluentui/react-utilities';\nimport type { DialogTriggerProps, DialogTriggerState } from './DialogTrigger.types';\nimport { useDialogContext_unstable, useDialogSurfaceContext_unstable } from '../../contexts';\nimport { useARIAButtonProps } from '@fluentui/react-aria';\n\n/**\n * Create the state required to render DialogTrigger.\n * Clones the only child component and adds necessary event handling behaviours to open a popup Dialog\n *\n * @param props - props from this instance of DialogTrigger\n */\nexport const useDialogTrigger_unstable = (props: DialogTriggerProps): DialogTriggerState => {\n const isInsideSurfaceDialog = useDialogSurfaceContext_unstable();\n\n const { children, action = isInsideSurfaceDialog ? 'close' : 'open' } = props;\n\n const child = getTriggerChild(children);\n\n const requestOpenChange = useDialogContext_unstable(ctx => ctx.requestOpenChange);\n\n const { triggerAttributes } = useModalAttributes();\n\n const handleClick = useEventCallback(\n (event: React.MouseEvent<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>) => {\n child?.props.onClick?.(event);\n if (!event.isDefaultPrevented()) {\n requestOpenChange({\n event,\n type: 'triggerClick',\n open: action === 'open',\n });\n }\n },\n );\n\n return {\n children: applyTriggerPropsToChildren(\n children,\n useARIAButtonProps(child?.type === 'button' || child?.type === 'a' ? child.type : 'div', {\n type: 'button',\n ...child?.props,\n 'aria-haspopup': action === 'close' ? undefined : 'dialog',\n ref: child?.ref,\n onClick: handleClick,\n ...triggerAttributes,\n }),\n ),\n };\n};\n"],"sourceRoot":"../src/"}
|