@fluentui/react-dialog 9.1.0 → 9.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +137 -1
- package/CHANGELOG.md +35 -2
- package/dist/index.d.ts +0 -8
- package/lib/components/Dialog/Dialog.types.js.map +1 -1
- package/lib/components/Dialog/useDialog.js +0 -1
- package/lib/components/Dialog/useDialog.js.map +1 -1
- package/lib/components/Dialog/useDialogContextValues.js +0 -2
- package/lib/components/Dialog/useDialogContextValues.js.map +1 -1
- package/lib/components/DialogContent/useDialogContent.js +0 -3
- package/lib/components/DialogContent/useDialogContent.js.map +1 -1
- package/lib/components/DialogSurface/useDialogSurface.js +0 -2
- package/lib/components/DialogSurface/useDialogSurface.js.map +1 -1
- package/lib/components/DialogTrigger/useDialogTrigger.js +2 -1
- package/lib/components/DialogTrigger/useDialogTrigger.js.map +1 -1
- package/lib/contexts/dialogContext.js.map +1 -1
- package/lib-amd/Dialog.js +6 -0
- package/lib-amd/Dialog.js.map +1 -0
- package/lib-amd/DialogActions.js +6 -0
- package/lib-amd/DialogActions.js.map +1 -0
- package/lib-amd/DialogBody.js +6 -0
- package/lib-amd/DialogBody.js.map +1 -0
- package/lib-amd/DialogContent.js +6 -0
- package/lib-amd/DialogContent.js.map +1 -0
- package/lib-amd/DialogSurface.js +6 -0
- package/lib-amd/DialogSurface.js.map +1 -0
- package/lib-amd/DialogTitle.js +6 -0
- package/lib-amd/DialogTitle.js.map +1 -0
- package/lib-amd/DialogTrigger.js +6 -0
- package/lib-amd/DialogTrigger.js.map +1 -0
- package/lib-amd/components/Dialog/Dialog.js +19 -0
- package/lib-amd/components/Dialog/Dialog.js.map +1 -0
- package/lib-amd/components/Dialog/Dialog.types.js +5 -0
- package/lib-amd/components/Dialog/Dialog.types.js.map +1 -0
- package/lib-amd/components/Dialog/index.js +9 -0
- package/lib-amd/components/Dialog/index.js.map +1 -0
- package/lib-amd/components/Dialog/renderDialog.js +17 -0
- package/lib-amd/components/Dialog/renderDialog.js.map +1 -0
- package/lib-amd/components/Dialog/useDialog.js +77 -0
- package/lib-amd/components/Dialog/useDialog.js.map +1 -0
- package/lib-amd/components/Dialog/useDialogContextValues.js +24 -0
- package/lib-amd/components/Dialog/useDialogContextValues.js.map +1 -0
- package/lib-amd/components/DialogActions/DialogActions.js +16 -0
- package/lib-amd/components/DialogActions/DialogActions.js.map +1 -0
- package/lib-amd/components/DialogActions/DialogActions.types.js +5 -0
- package/lib-amd/components/DialogActions/DialogActions.types.js.map +1 -0
- package/lib-amd/components/DialogActions/index.js +10 -0
- package/lib-amd/components/DialogActions/index.js.map +1 -0
- package/lib-amd/components/DialogActions/renderDialogActions.js +15 -0
- package/lib-amd/components/DialogActions/renderDialogActions.js.map +1 -0
- package/lib-amd/components/DialogActions/useDialogActions.js +26 -0
- package/lib-amd/components/DialogActions/useDialogActions.js.map +1 -0
- package/lib-amd/components/DialogActions/useDialogActionsStyles.js +27 -0
- package/lib-amd/components/DialogActions/useDialogActionsStyles.js.map +1 -0
- package/lib-amd/components/DialogBody/DialogBody.js +16 -0
- package/lib-amd/components/DialogBody/DialogBody.js.map +1 -0
- package/lib-amd/components/DialogBody/DialogBody.types.js +5 -0
- package/lib-amd/components/DialogBody/DialogBody.types.js.map +1 -0
- package/lib-amd/components/DialogBody/index.js +10 -0
- package/lib-amd/components/DialogBody/index.js.map +1 -0
- package/lib-amd/components/DialogBody/renderDialogBody.js +15 -0
- package/lib-amd/components/DialogBody/renderDialogBody.js.map +1 -0
- package/lib-amd/components/DialogBody/useDialogBody.js +25 -0
- package/lib-amd/components/DialogBody/useDialogBody.js.map +1 -0
- package/lib-amd/components/DialogBody/useDialogBodyStyles.js +31 -0
- package/lib-amd/components/DialogBody/useDialogBodyStyles.js.map +1 -0
- package/lib-amd/components/DialogContent/DialogContent.js +16 -0
- package/lib-amd/components/DialogContent/DialogContent.js.map +1 -0
- package/lib-amd/components/DialogContent/DialogContent.types.js +5 -0
- package/lib-amd/components/DialogContent/DialogContent.types.js.map +1 -0
- package/lib-amd/components/DialogContent/index.js +10 -0
- package/lib-amd/components/DialogContent/index.js.map +1 -0
- package/lib-amd/components/DialogContent/renderDialogContent.js +14 -0
- package/lib-amd/components/DialogContent/renderDialogContent.js.map +1 -0
- package/lib-amd/components/DialogContent/useDialogContent.js +25 -0
- package/lib-amd/components/DialogContent/useDialogContent.js.map +1 -0
- package/lib-amd/components/DialogContent/useDialogContentStyles.js +24 -0
- package/lib-amd/components/DialogContent/useDialogContentStyles.js.map +1 -0
- package/lib-amd/components/DialogSurface/DialogSurface.js +17 -0
- package/lib-amd/components/DialogSurface/DialogSurface.js.map +1 -0
- package/lib-amd/components/DialogSurface/DialogSurface.types.js +5 -0
- package/lib-amd/components/DialogSurface/DialogSurface.types.js.map +1 -0
- package/lib-amd/components/DialogSurface/index.js +10 -0
- package/lib-amd/components/DialogSurface/index.js.map +1 -0
- package/lib-amd/components/DialogSurface/renderDialogSurface.js +17 -0
- package/lib-amd/components/DialogSurface/renderDialogSurface.js.map +1 -0
- package/lib-amd/components/DialogSurface/useDialogSurface.js +66 -0
- package/lib-amd/components/DialogSurface/useDialogSurface.js.map +1 -0
- package/lib-amd/components/DialogSurface/useDialogSurfaceContextValues.js +11 -0
- package/lib-amd/components/DialogSurface/useDialogSurfaceContextValues.js.map +1 -0
- package/lib-amd/components/DialogSurface/useDialogSurfaceStyles.js +44 -0
- package/lib-amd/components/DialogSurface/useDialogSurfaceStyles.js.map +1 -0
- package/lib-amd/components/DialogTitle/DialogTitle.js +16 -0
- package/lib-amd/components/DialogTitle/DialogTitle.js.map +1 -0
- package/lib-amd/components/DialogTitle/DialogTitle.types.js +5 -0
- package/lib-amd/components/DialogTitle/DialogTitle.types.js.map +1 -0
- package/lib-amd/components/DialogTitle/index.js +10 -0
- package/lib-amd/components/DialogTitle/index.js.map +1 -0
- package/lib-amd/components/DialogTitle/renderDialogTitle.js +16 -0
- package/lib-amd/components/DialogTitle/renderDialogTitle.js.map +1 -0
- package/lib-amd/components/DialogTitle/useDialogTitle.js +36 -0
- package/lib-amd/components/DialogTitle/useDialogTitle.js.map +1 -0
- package/lib-amd/components/DialogTitle/useDialogTitleStyles.js +37 -0
- package/lib-amd/components/DialogTitle/useDialogTitleStyles.js.map +1 -0
- package/lib-amd/components/DialogTrigger/DialogTrigger.js +24 -0
- package/lib-amd/components/DialogTrigger/DialogTrigger.js.map +1 -0
- package/lib-amd/components/DialogTrigger/DialogTrigger.types.js +5 -0
- package/lib-amd/components/DialogTrigger/DialogTrigger.types.js.map +1 -0
- package/lib-amd/components/DialogTrigger/index.js +9 -0
- package/lib-amd/components/DialogTrigger/index.js.map +1 -0
- package/lib-amd/components/DialogTrigger/renderDialogTrigger.js +13 -0
- package/lib-amd/components/DialogTrigger/renderDialogTrigger.js.map +1 -0
- package/lib-amd/components/DialogTrigger/useDialogTrigger.js +37 -0
- package/lib-amd/components/DialogTrigger/useDialogTrigger.js.map +1 -0
- package/lib-amd/contexts/constants.js +16 -0
- package/lib-amd/contexts/constants.js.map +1 -0
- package/lib-amd/contexts/dialogContext.js +25 -0
- package/lib-amd/contexts/dialogContext.js.map +1 -0
- package/lib-amd/contexts/dialogSurfaceContext.js +11 -0
- package/lib-amd/contexts/dialogSurfaceContext.js.map +1 -0
- package/lib-amd/contexts/index.js +8 -0
- package/lib-amd/contexts/index.js.map +1 -0
- package/lib-amd/index.js +37 -0
- package/lib-amd/index.js.map +1 -0
- package/lib-amd/utils/index.js +8 -0
- package/lib-amd/utils/index.js.map +1 -0
- package/lib-amd/utils/isEscapeKeyDown.js +13 -0
- package/lib-amd/utils/isEscapeKeyDown.js.map +1 -0
- package/lib-amd/utils/useDisableBodyScroll.js +52 -0
- package/lib-amd/utils/useDisableBodyScroll.js.map +1 -0
- package/lib-amd/utils/useFocusFirstElement.js +38 -0
- package/lib-amd/utils/useFocusFirstElement.js.map +1 -0
- package/lib-commonjs/components/Dialog/useDialog.js +0 -1
- package/lib-commonjs/components/Dialog/useDialog.js.map +1 -1
- package/lib-commonjs/components/Dialog/useDialogContextValues.js +0 -2
- package/lib-commonjs/components/Dialog/useDialogContextValues.js.map +1 -1
- package/lib-commonjs/components/DialogContent/useDialogContent.js +0 -4
- package/lib-commonjs/components/DialogContent/useDialogContent.js.map +1 -1
- package/lib-commonjs/components/DialogSurface/useDialogSurface.js +0 -2
- package/lib-commonjs/components/DialogSurface/useDialogSurface.js.map +1 -1
- package/lib-commonjs/components/DialogTrigger/useDialogTrigger.js +2 -1
- package/lib-commonjs/components/DialogTrigger/useDialogTrigger.js.map +1 -1
- package/lib-commonjs/contexts/dialogContext.js.map +1 -1
- package/package.json +14 -13
- package/Spec.md +0 -537
- package/assets/AlertDialogKeyboardInteraction.png +0 -0
- package/assets/AlertDialogMouseInteraction.png +0 -0
- package/assets/ModalDialogKeyboardInteraction.png +0 -0
- package/assets/ModalDialogMouseInteraction.png +0 -0
- package/assets/NonModalDialogKeyboardInteraction.png +0 -0
- package/assets/NonModalDialogMouseInteraction.png +0 -0
package/lib-amd/index.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
define(["require", "exports", "./Dialog", "./DialogTrigger", "./DialogActions", "./DialogBody", "./DialogTitle", "./DialogSurface", "./DialogContent"], function (require, exports, Dialog_1, DialogTrigger_1, DialogActions_1, DialogBody_1, DialogTitle_1, DialogSurface_1, DialogContent_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.renderDialogContent_unstable = exports.useDialogContentStyles_unstable = exports.useDialogContent_unstable = exports.dialogContentClassNames = exports.DialogContent = exports.renderDialogSurface_unstable = exports.useDialogSurfaceStyles_unstable = exports.useDialogSurface_unstable = exports.dialogSurfaceClassNames = exports.DialogSurface = exports.renderDialogTitle_unstable = exports.useDialogTitleStyles_unstable = exports.useDialogTitle_unstable = exports.dialogTitleClassNames = exports.DialogTitle = exports.renderDialogBody_unstable = exports.useDialogBodyStyles_unstable = exports.useDialogBody_unstable = exports.dialogBodyClassNames = exports.DialogBody = exports.renderDialogActions_unstable = exports.useDialogActionsStyles_unstable = exports.useDialogActions_unstable = exports.dialogActionsClassNames = exports.DialogActions = exports.renderDialogTrigger_unstable = exports.useDialogTrigger_unstable = exports.DialogTrigger = exports.useDialog_unstable = exports.renderDialog_unstable = exports.Dialog = void 0;
|
|
5
|
+
Object.defineProperty(exports, "Dialog", { enumerable: true, get: function () { return Dialog_1.Dialog; } });
|
|
6
|
+
Object.defineProperty(exports, "renderDialog_unstable", { enumerable: true, get: function () { return Dialog_1.renderDialog_unstable; } });
|
|
7
|
+
Object.defineProperty(exports, "useDialog_unstable", { enumerable: true, get: function () { return Dialog_1.useDialog_unstable; } });
|
|
8
|
+
Object.defineProperty(exports, "DialogTrigger", { enumerable: true, get: function () { return DialogTrigger_1.DialogTrigger; } });
|
|
9
|
+
Object.defineProperty(exports, "useDialogTrigger_unstable", { enumerable: true, get: function () { return DialogTrigger_1.useDialogTrigger_unstable; } });
|
|
10
|
+
Object.defineProperty(exports, "renderDialogTrigger_unstable", { enumerable: true, get: function () { return DialogTrigger_1.renderDialogTrigger_unstable; } });
|
|
11
|
+
Object.defineProperty(exports, "DialogActions", { enumerable: true, get: function () { return DialogActions_1.DialogActions; } });
|
|
12
|
+
Object.defineProperty(exports, "dialogActionsClassNames", { enumerable: true, get: function () { return DialogActions_1.dialogActionsClassNames; } });
|
|
13
|
+
Object.defineProperty(exports, "useDialogActions_unstable", { enumerable: true, get: function () { return DialogActions_1.useDialogActions_unstable; } });
|
|
14
|
+
Object.defineProperty(exports, "useDialogActionsStyles_unstable", { enumerable: true, get: function () { return DialogActions_1.useDialogActionsStyles_unstable; } });
|
|
15
|
+
Object.defineProperty(exports, "renderDialogActions_unstable", { enumerable: true, get: function () { return DialogActions_1.renderDialogActions_unstable; } });
|
|
16
|
+
Object.defineProperty(exports, "DialogBody", { enumerable: true, get: function () { return DialogBody_1.DialogBody; } });
|
|
17
|
+
Object.defineProperty(exports, "dialogBodyClassNames", { enumerable: true, get: function () { return DialogBody_1.dialogBodyClassNames; } });
|
|
18
|
+
Object.defineProperty(exports, "useDialogBody_unstable", { enumerable: true, get: function () { return DialogBody_1.useDialogBody_unstable; } });
|
|
19
|
+
Object.defineProperty(exports, "useDialogBodyStyles_unstable", { enumerable: true, get: function () { return DialogBody_1.useDialogBodyStyles_unstable; } });
|
|
20
|
+
Object.defineProperty(exports, "renderDialogBody_unstable", { enumerable: true, get: function () { return DialogBody_1.renderDialogBody_unstable; } });
|
|
21
|
+
Object.defineProperty(exports, "DialogTitle", { enumerable: true, get: function () { return DialogTitle_1.DialogTitle; } });
|
|
22
|
+
Object.defineProperty(exports, "dialogTitleClassNames", { enumerable: true, get: function () { return DialogTitle_1.dialogTitleClassNames; } });
|
|
23
|
+
Object.defineProperty(exports, "useDialogTitle_unstable", { enumerable: true, get: function () { return DialogTitle_1.useDialogTitle_unstable; } });
|
|
24
|
+
Object.defineProperty(exports, "useDialogTitleStyles_unstable", { enumerable: true, get: function () { return DialogTitle_1.useDialogTitleStyles_unstable; } });
|
|
25
|
+
Object.defineProperty(exports, "renderDialogTitle_unstable", { enumerable: true, get: function () { return DialogTitle_1.renderDialogTitle_unstable; } });
|
|
26
|
+
Object.defineProperty(exports, "DialogSurface", { enumerable: true, get: function () { return DialogSurface_1.DialogSurface; } });
|
|
27
|
+
Object.defineProperty(exports, "dialogSurfaceClassNames", { enumerable: true, get: function () { return DialogSurface_1.dialogSurfaceClassNames; } });
|
|
28
|
+
Object.defineProperty(exports, "useDialogSurface_unstable", { enumerable: true, get: function () { return DialogSurface_1.useDialogSurface_unstable; } });
|
|
29
|
+
Object.defineProperty(exports, "useDialogSurfaceStyles_unstable", { enumerable: true, get: function () { return DialogSurface_1.useDialogSurfaceStyles_unstable; } });
|
|
30
|
+
Object.defineProperty(exports, "renderDialogSurface_unstable", { enumerable: true, get: function () { return DialogSurface_1.renderDialogSurface_unstable; } });
|
|
31
|
+
Object.defineProperty(exports, "DialogContent", { enumerable: true, get: function () { return DialogContent_1.DialogContent; } });
|
|
32
|
+
Object.defineProperty(exports, "dialogContentClassNames", { enumerable: true, get: function () { return DialogContent_1.dialogContentClassNames; } });
|
|
33
|
+
Object.defineProperty(exports, "useDialogContent_unstable", { enumerable: true, get: function () { return DialogContent_1.useDialogContent_unstable; } });
|
|
34
|
+
Object.defineProperty(exports, "useDialogContentStyles_unstable", { enumerable: true, get: function () { return DialogContent_1.useDialogContentStyles_unstable; } });
|
|
35
|
+
Object.defineProperty(exports, "renderDialogContent_unstable", { enumerable: true, get: function () { return DialogContent_1.renderDialogContent_unstable; } });
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-dialog/src/index.ts"],"names":[],"mappings":";;;;IAAS,gGAAA,MAAM,OAAA;IAAE,+GAAA,qBAAqB,OAAA;IAAE,4GAAA,kBAAkB,OAAA;IAUjD,8GAAA,aAAa,OAAA;IAAE,0HAAA,yBAAyB,OAAA;IAAE,6HAAA,4BAA4B,OAAA;IAS7E,8GAAA,aAAa,OAAA;IACb,wHAAA,uBAAuB,OAAA;IACvB,0HAAA,yBAAyB,OAAA;IACzB,gIAAA,+BAA+B,OAAA;IAC/B,6HAAA,4BAA4B,OAAA;IAU5B,wGAAA,UAAU,OAAA;IACV,kHAAA,oBAAoB,OAAA;IACpB,oHAAA,sBAAsB,OAAA;IACtB,0HAAA,4BAA4B,OAAA;IAC5B,uHAAA,yBAAyB,OAAA;IAKzB,0GAAA,WAAW,OAAA;IACX,oHAAA,qBAAqB,OAAA;IACrB,sHAAA,uBAAuB,OAAA;IACvB,4HAAA,6BAA6B,OAAA;IAC7B,yHAAA,0BAA0B,OAAA;IAK1B,8GAAA,aAAa,OAAA;IACb,wHAAA,uBAAuB,OAAA;IACvB,0HAAA,yBAAyB,OAAA;IACzB,gIAAA,+BAA+B,OAAA;IAC/B,6HAAA,4BAA4B,OAAA;IAK5B,8GAAA,aAAa,OAAA;IACb,wHAAA,uBAAuB,OAAA;IACvB,0HAAA,yBAAyB,OAAA;IACzB,gIAAA,+BAA+B,OAAA;IAC/B,6HAAA,4BAA4B,OAAA","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 renderDialogSurface_unstable,\n} from './DialogSurface';\nexport type { DialogSurfaceProps, DialogSurfaceSlots, DialogSurfaceState, DialogSurfaceElement } 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"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
define(["require", "exports", "tslib", "./isEscapeKeyDown", "./useDisableBodyScroll", "./useFocusFirstElement"], function (require, exports, tslib_1, isEscapeKeyDown_1, useDisableBodyScroll_1, useFocusFirstElement_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
tslib_1.__exportStar(isEscapeKeyDown_1, exports);
|
|
5
|
+
tslib_1.__exportStar(useDisableBodyScroll_1, exports);
|
|
6
|
+
tslib_1.__exportStar(useFocusFirstElement_1, exports);
|
|
7
|
+
});
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-dialog/src/utils/index.ts"],"names":[],"mappings":";;;IAAA,iDAAkC;IAClC,sDAAuC;IACvC,sDAAuC","sourcesContent":["export * from './isEscapeKeyDown';\nexport * from './useDisableBodyScroll';\nexport * from './useFocusFirstElement';\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
define(["require", "exports", "@fluentui/keyboard-keys"], function (require, exports, keyboard_keys_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.isEscapeKeyDismiss = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* Checks if keydown event is a proper Escape key dismiss
|
|
7
|
+
*/
|
|
8
|
+
function isEscapeKeyDismiss(event, modalType) {
|
|
9
|
+
return event.key === keyboard_keys_1.Escape && modalType !== 'alert' && !event.isDefaultPrevented();
|
|
10
|
+
}
|
|
11
|
+
exports.isEscapeKeyDismiss = isEscapeKeyDismiss;
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=isEscapeKeyDown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isEscapeKeyDown.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-dialog/src/utils/isEscapeKeyDown.ts"],"names":[],"mappings":";;;;IAKA;;OAEG;IACH,SAAgB,kBAAkB,CAChC,KAAgD,EAChD,SAA0B;QAE1B,OAAO,KAAK,CAAC,GAAG,KAAK,sBAAM,IAAI,SAAS,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,kBAAkB,EAAE,CAAC;IACtF,CAAC;IALD,gDAKC","sourcesContent":["import * as React from 'react';\nimport { Escape } from '@fluentui/keyboard-keys';\nimport type { DialogModalType } from '../components/Dialog/Dialog.types';\nimport { DialogSurfaceElement } from '../DialogSurface';\n\n/**\n * Checks if keydown event is a proper Escape key dismiss\n */\nexport function isEscapeKeyDismiss(\n event: React.KeyboardEvent<DialogSurfaceElement>,\n modalType: DialogModalType,\n): boolean {\n return event.key === Escape && modalType !== 'alert' && !event.isDefaultPrevented();\n}\n"]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
define(["require", "exports", "@fluentui/react-shared-contexts", "react"], function (require, exports, react_shared_contexts_1, react_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.disableScroll = exports.useDisableBodyScroll = void 0;
|
|
5
|
+
var disableScrollElementProp = '__fluentDisableScrollElement';
|
|
6
|
+
/**
|
|
7
|
+
* hook that disables body scrolling through `overflow: hidden` CSS property
|
|
8
|
+
*/
|
|
9
|
+
function useDisableBodyScroll() {
|
|
10
|
+
var targetDocument = react_shared_contexts_1.useFluent_unstable().targetDocument;
|
|
11
|
+
return react_1.useCallback(function () {
|
|
12
|
+
if (targetDocument) {
|
|
13
|
+
return disableScroll(targetDocument.body);
|
|
14
|
+
}
|
|
15
|
+
}, [targetDocument]);
|
|
16
|
+
}
|
|
17
|
+
exports.useDisableBodyScroll = useDisableBodyScroll;
|
|
18
|
+
/**
|
|
19
|
+
* disables scrolling from a given element through `overflow: hidden` CSS property
|
|
20
|
+
* @param target - element to disable scrolling from
|
|
21
|
+
* @returns a method for enabling scrolling again
|
|
22
|
+
*/
|
|
23
|
+
function disableScroll(target) {
|
|
24
|
+
var _a, _b;
|
|
25
|
+
var clientWidth = target.ownerDocument.documentElement.clientWidth;
|
|
26
|
+
var innerWidth = (_b = (_a = target.ownerDocument.defaultView) === null || _a === void 0 ? void 0 : _a.innerWidth) !== null && _b !== void 0 ? _b : 0;
|
|
27
|
+
assertIsDisableScrollElement(target);
|
|
28
|
+
if (target[disableScrollElementProp].count === 0) {
|
|
29
|
+
target.style.overflow = 'hidden';
|
|
30
|
+
target.style.paddingRight = innerWidth - clientWidth + "px";
|
|
31
|
+
}
|
|
32
|
+
target[disableScrollElementProp].count++;
|
|
33
|
+
return function () {
|
|
34
|
+
target[disableScrollElementProp].count--;
|
|
35
|
+
if (target[disableScrollElementProp].count === 0) {
|
|
36
|
+
target.style.overflow = target[disableScrollElementProp].previousOverflowStyle;
|
|
37
|
+
target.style.paddingRight = target[disableScrollElementProp].previousPaddingRightStyle;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
exports.disableScroll = disableScroll;
|
|
42
|
+
function assertIsDisableScrollElement(element) {
|
|
43
|
+
var _a;
|
|
44
|
+
var _b;
|
|
45
|
+
(_a = (_b = element)[disableScrollElementProp]) !== null && _a !== void 0 ? _a : (_b[disableScrollElementProp] = {
|
|
46
|
+
count: 0,
|
|
47
|
+
previousOverflowStyle: element.style.overflow,
|
|
48
|
+
previousPaddingRightStyle: element.style.paddingRight,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
//# sourceMappingURL=useDisableBodyScroll.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDisableBodyScroll.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-dialog/src/utils/useDisableBodyScroll.ts"],"names":[],"mappings":";;;;IAGA,IAAM,wBAAwB,GAAG,8B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AwB,wCAAxB,wBAAwB,IAAM;YACpE,KAAK,EAAE,CAAC;YACR,qBAAqB,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ;YAC7C,yBAAyB,EAAE,OAAO,CAAC,KAAK,CAAC,YAAY;SACtD,EAAC;IACJ,CAAC","sourcesContent":["import { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport { useCallback } from 'react';\n\nconst disableScrollElementProp = '__fluentDisableScrollElement' as const;\n\ntype FluentDisableScrollElement = HTMLElement & {\n [disableScrollElementProp]: {\n count: number;\n previousOverflowStyle: string;\n previousPaddingRightStyle: string;\n };\n};\n\n/**\n * hook that disables body scrolling through `overflow: hidden` CSS property\n */\nexport function useDisableBodyScroll() {\n const { targetDocument } = useFluent_unstable();\n return useCallback(() => {\n if (targetDocument) {\n return disableScroll(targetDocument.body);\n }\n }, [targetDocument]);\n}\n\n/**\n * disables scrolling from a given element through `overflow: hidden` CSS property\n * @param target - element to disable scrolling from\n * @returns a method for enabling scrolling again\n */\nexport function disableScroll(target: HTMLElement) {\n const { clientWidth } = target.ownerDocument.documentElement;\n const innerWidth = target.ownerDocument.defaultView?.innerWidth ?? 0;\n assertIsDisableScrollElement(target);\n if (target[disableScrollElementProp].count === 0) {\n target.style.overflow = 'hidden';\n target.style.paddingRight = `${innerWidth - clientWidth}px`;\n }\n target[disableScrollElementProp].count++;\n return () => {\n target[disableScrollElementProp].count--;\n if (target[disableScrollElementProp].count === 0) {\n target.style.overflow = target[disableScrollElementProp].previousOverflowStyle;\n target.style.paddingRight = target[disableScrollElementProp].previousPaddingRightStyle;\n }\n };\n}\n\nfunction assertIsDisableScrollElement(element: HTMLElement): asserts element is FluentDisableScrollElement {\n (element as FluentDisableScrollElement)[disableScrollElementProp] ??= {\n count: 0,\n previousOverflowStyle: element.style.overflow,\n previousPaddingRightStyle: element.style.paddingRight,\n };\n}\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
define(["require", "exports", "react", "@fluentui/react-tabster", "@fluentui/react-shared-contexts"], function (require, exports, React, react_tabster_1, react_shared_contexts_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.useFocusFirstElement = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* Focus first element on content when dialog is opened,
|
|
7
|
+
*/
|
|
8
|
+
function useFocusFirstElement(open, modalType) {
|
|
9
|
+
var findFirstFocusable = react_tabster_1.useFocusFinders().findFirstFocusable;
|
|
10
|
+
var targetDocument = react_shared_contexts_1.useFluent_unstable().targetDocument;
|
|
11
|
+
var dialogRef = React.useRef(null);
|
|
12
|
+
var triggerRef = React.useRef();
|
|
13
|
+
React.useEffect(function () {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
if (!open) {
|
|
16
|
+
return (_a = triggerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
17
|
+
}
|
|
18
|
+
triggerRef.current = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement;
|
|
19
|
+
var element = dialogRef.current && findFirstFocusable(dialogRef.current);
|
|
20
|
+
if (element) {
|
|
21
|
+
element.focus();
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
(_b = dialogRef.current) === null || _b === void 0 ? void 0 : _b.focus(); // https://github.com/microsoft/fluentui/issues/25150
|
|
25
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
26
|
+
// eslint-disable-next-line no-console
|
|
27
|
+
console.warn([
|
|
28
|
+
'@fluentui/react-dialog: a Dialog should have at least one focusable element inside DialogSurface.',
|
|
29
|
+
'Please add at least a close button either on `DialogTitle` action slot or inside `DialogActions`',
|
|
30
|
+
].join('\n'));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}, [findFirstFocusable, open, modalType, targetDocument]);
|
|
34
|
+
return dialogRef;
|
|
35
|
+
}
|
|
36
|
+
exports.useFocusFirstElement = useFocusFirstElement;
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=useFocusFirstElement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFocusFirstElement.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-dialog/src/utils/useFocusFirstElement.ts"],"names":[],"mappings":";;;;IAMA;;OAEG;IACH,SAAgB,oBAAoB,CAAC,IAAa,EAAE,SAA0B;QACpE,IAAA,kBAAkB,GAAK,+BAAe,EAAE,mBAAtB,CAAuB;QACzC,IAAA,cAAc,GAAK,0CAAkB,EAAE,eAAzB,CAA0B;QAChD,IAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAuB,IAAI,CAAC,CAAC;QAC3D,IAAM,UAAU,GAAG,KAAK,CAAC,MAAM,EAAe,CAAC;QAE/C,KAAK,CAAC,SAAS,CAAC;;YACd,IAAI,CAAC,IAAI,EAAE;gBACT,OAAO,MAAA,UAAU,CAAC,OAAO,0CAAE,KAAK,EAAE,CAAC;aACpC;YACD,UAAU,CAAC,OAAO,GAAG,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,aAAwC,CAAC;YAC9E,IAAM,OAAO,GAAG,SAAS,CAAC,OAAO,IAAI,kBAAkB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;YAC3E,IAAI,OAAO,EAAE;gBACX,OAAO,CAAC,KAAK,EAAE,CAAC;aACjB;iBAAM;gBACL,MAAA,SAAS,CAAC,OAAO,0CAAE,KAAK,EAAE,CAAC,CAAC,qDAAqD;gBACjF,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;oBACzC,sCAAsC;oBACtC,OAAO,CAAC,IAAI,CACV;wBACE,mGAAmG;wBACnG,kGAAkG;qBACnG,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;iBACH;aACF;QACH,CAAC,EAAE,CAAC,kBAAkB,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC;QAE1D,OAAO,SAAS,CAAC;IACnB,CAAC;IA7BD,oDA6BC","sourcesContent":["import * as React from 'react';\nimport { useFocusFinders } from '@fluentui/react-tabster';\nimport { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport type { DialogSurfaceElement } from '../DialogSurface';\nimport type { DialogModalType } from '../Dialog';\n\n/**\n * Focus first element on content when dialog is opened,\n */\nexport function useFocusFirstElement(open: boolean, modalType: DialogModalType) {\n const { findFirstFocusable } = useFocusFinders();\n const { targetDocument } = useFluent_unstable();\n const dialogRef = React.useRef<DialogSurfaceElement>(null);\n const triggerRef = React.useRef<HTMLElement>();\n\n React.useEffect(() => {\n if (!open) {\n return triggerRef.current?.focus();\n }\n triggerRef.current = targetDocument?.activeElement as HTMLElement | undefined;\n const element = dialogRef.current && findFirstFocusable(dialogRef.current);\n if (element) {\n element.focus();\n } else {\n dialogRef.current?.focus(); // https://github.com/microsoft/fluentui/issues/25150\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.warn(\n [\n '@fluentui/react-dialog: a Dialog should have at least one focusable element inside DialogSurface.',\n 'Please add at least a close button either on `DialogTitle` action slot or inside `DialogActions`',\n ].join('\\n'),\n );\n }\n }\n }, [findFirstFocusable, open, modalType, targetDocument]);\n\n return dialogRef;\n}\n"]}
|
|
@@ -61,7 +61,6 @@ const useDialog_unstable = props => {
|
|
|
61
61
|
content: open ? content : null,
|
|
62
62
|
trigger,
|
|
63
63
|
requestOpenChange,
|
|
64
|
-
dialogContentId: react_utilities_1.useId('dialog-content-'),
|
|
65
64
|
dialogTitleId: react_utilities_1.useId('dialog-title-'),
|
|
66
65
|
isNestedDialog: react_context_selector_1.useHasParentContext(contexts_1.DialogContext),
|
|
67
66
|
dialogRef: focusRef
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-dialog/src/components/Dialog/useDialog.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;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P;IACF;;IACA;MACE,OAAO,CAAC,SAAD,EAAY,SAAZ,CAAP;EATJ;AAWD","sourcesContent":["import * as React from 'react';\nimport { useControllableState, useEventCallback, useId, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport { useHasParentContext } from '@fluentui/react-context-selector';\nimport { useDisableBodyScroll, useFocusFirstElement } from '../../utils';\nimport { DialogContext } from '../../contexts';\n\nimport type { DialogOpenChangeData, DialogProps, DialogState } from './Dialog.types';\n\n/**\n * Create the state required to render Dialog.\n *\n * The returned state can be modified with hooks such as useDialogStyles_unstable,\n * before being passed to renderDialog_unstable.\n *\n * @param props - props from this instance of Dialog\n */\nexport const useDialog_unstable = (props: DialogProps): DialogState => {\n const { children, modalType = 'modal', onOpenChange } = props;\n\n const [trigger, content] = childrenToTriggerAndContent(children);\n\n const [open, setOpen] = useControllableState({\n state: props.open,\n defaultState: props.defaultOpen,\n initialState: false,\n });\n\n const requestOpenChange = useEventCallback((data: DialogOpenChangeData) => {\n onOpenChange?.(data.event, data);\n\n // if user prevents default then do not change state value\n // otherwise updates state value and trigger reference to the element that caused the opening\n if (!data.event.isDefaultPrevented()) {\n setOpen(data.open);\n }\n });\n\n const focusRef = useFocusFirstElement(open, modalType);\n const disableBodyScroll = useDisableBodyScroll();\n const isBodyScrollLocked = Boolean(open && modalType !== 'non-modal');\n\n useIsomorphicLayoutEffect(() => {\n if (isBodyScrollLocked) {\n return disableBodyScroll();\n }\n }, [disableBodyScroll, isBodyScrollLocked]);\n\n return {\n components: {\n backdrop: 'div',\n },\n open,\n modalType,\n content: open ? content : null,\n trigger,\n requestOpenChange,\n dialogTitleId: useId('dialog-title-'),\n isNestedDialog: useHasParentContext(DialogContext),\n dialogRef: focusRef,\n };\n};\n\n/**\n * Extracts trigger and content from children\n */\nfunction childrenToTriggerAndContent(\n children: React.ReactNode,\n): readonly [trigger: React.ReactNode, content: React.ReactNode] {\n const childrenArray = React.Children.toArray(children) as React.ReactElement[];\n if (process.env.NODE_ENV !== 'production') {\n if (childrenArray.length !== 1 && childrenArray.length !== 2) {\n // eslint-disable-next-line no-console\n console.warn(\n 'Dialog must contain at least one child <DialogSurface/>,\\n' +\n 'and at most two children <DialogTrigger/> <DialogSurface/> (in this order)',\n );\n }\n }\n switch (childrenArray.length) {\n // case where there's a trigger followed by content\n case 2:\n return childrenArray as [trigger: React.ReactNode, content: React.ReactNode];\n // case where there's only content\n case 1:\n return [undefined, childrenArray[0]];\n // unknown case\n default:\n return [undefined, undefined];\n }\n}\n"],"sourceRoot":"../src/"}
|
|
@@ -9,7 +9,6 @@ function useDialogContextValues_unstable(state) {
|
|
|
9
9
|
const {
|
|
10
10
|
modalType,
|
|
11
11
|
open,
|
|
12
|
-
dialogContentId,
|
|
13
12
|
dialogRef,
|
|
14
13
|
dialogTitleId,
|
|
15
14
|
isNestedDialog,
|
|
@@ -24,7 +23,6 @@ function useDialogContextValues_unstable(state) {
|
|
|
24
23
|
open,
|
|
25
24
|
modalType,
|
|
26
25
|
dialogRef,
|
|
27
|
-
dialogContentId,
|
|
28
26
|
dialogTitleId,
|
|
29
27
|
isNestedDialog,
|
|
30
28
|
requestOpenChange
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-dialog/src/components/Dialog/useDialogContextValues.ts"],"names":[],"mappings":";;;;;;;AAGA,SAAgB,+BAAhB,CAAgD,KAAhD,EAAkE;EAChE,MAAM;IAAE,SAAF;IAAa,IAAb;IAAmB,
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-dialog/src/components/Dialog/useDialogContextValues.ts"],"names":[],"mappings":";;;;;;;AAGA,SAAgB,+BAAhB,CAAgD,KAAhD,EAAkE;EAChE,MAAM;IAAE,SAAF;IAAa,IAAb;IAAmB,SAAnB;IAA8B,aAA9B;IAA6C,cAA7C;IAA6D;EAA7D,IAAmF,KAAzF;EAEA;;;AAGG;;EACH,MAAM,MAAM,GAAuB;IACjC,IADiC;IAEjC,SAFiC;IAGjC,SAHiC;IAIjC,aAJiC;IAKjC,cALiC;IAMjC;EANiC,CAAnC;EASA,MAAM,aAAa,GAA8B,KAAjD;EAEA,OAAO;IAAE,MAAF;IAAU;EAAV,CAAP;AACD;;AAnBD,OAAA,CAAA,+BAAA,GAAA,+BAAA","sourcesContent":["import type { DialogContextValue, DialogSurfaceContextValue } from '../../contexts';\nimport type { DialogContextValues, DialogState } from './Dialog.types';\n\nexport function useDialogContextValues_unstable(state: DialogState): DialogContextValues {\n const { modalType, open, dialogRef, dialogTitleId, isNestedDialog, requestOpenChange } = state;\n\n /**\n * This context is created with \"@fluentui/react-context-selector\",\n * there is no sense to memoize it\n */\n const dialog: DialogContextValue = {\n open,\n modalType,\n dialogRef,\n dialogTitleId,\n isNestedDialog,\n requestOpenChange,\n };\n\n const dialogSurface: DialogSurfaceContextValue = false;\n\n return { dialog, dialogSurface };\n}\n"],"sourceRoot":"../src/"}
|
|
@@ -6,8 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useDialogContent_unstable = void 0;
|
|
7
7
|
|
|
8
8
|
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
|
9
|
-
|
|
10
|
-
const contexts_1 = /*#__PURE__*/require("../../contexts");
|
|
11
9
|
/**
|
|
12
10
|
* Create the state required to render DialogBody.
|
|
13
11
|
*
|
|
@@ -22,14 +20,12 @@ const contexts_1 = /*#__PURE__*/require("../../contexts");
|
|
|
22
20
|
const useDialogContent_unstable = (props, ref) => {
|
|
23
21
|
var _a;
|
|
24
22
|
|
|
25
|
-
const dialogContentId = contexts_1.useDialogContext_unstable(ctx => ctx.dialogContentId);
|
|
26
23
|
return {
|
|
27
24
|
components: {
|
|
28
25
|
root: 'div'
|
|
29
26
|
},
|
|
30
27
|
root: react_utilities_1.getNativeElementProps((_a = props.as) !== null && _a !== void 0 ? _a : 'div', {
|
|
31
28
|
ref,
|
|
32
|
-
id: dialogContentId,
|
|
33
29
|
...props
|
|
34
30
|
})
|
|
35
31
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-dialog/src/components/DialogContent/useDialogContent.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-dialog/src/components/DialogContent/useDialogContent.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAGA;;;;;;;;AAQG;;;AACI,MAAM,yBAAyB,GAAG,CACvC,KADuC,EAEvC,GAFuC,KAGjB;;;EACtB,OAAO;IACL,UAAU,EAAE;MACV,IAAI,EAAE;IADI,CADP;IAIL,IAAI,EAAE,iBAAA,CAAA,qBAAA,CAAsB,CAAA,EAAA,GAAA,KAAK,CAAC,EAAN,MAAQ,IAAR,IAAQ,EAAA,KAAA,KAAA,CAAR,GAAQ,EAAR,GAAY,KAAlC,EAAyC;MAC7C,GAD6C;MAE7C,GAAG;IAF0C,CAAzC;EAJD,CAAP;AASD,CAbM;;AAAM,OAAA,CAAA,yBAAA,GAAyB,yBAAzB","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps } from '@fluentui/react-utilities';\nimport { DialogContentProps, DialogContentState } from './DialogContent.types';\n\n/**\n * Create the state required to render DialogBody.\n *\n * The returned state can be modified with hooks such as useDialogBodyStyles_unstable,\n * before being passed to renderDialogBody_unstable.\n *\n * @param props - props from this instance of DialogBody\n * @param ref - reference to root HTMLElement of DialogBody\n */\nexport const useDialogContent_unstable = (\n props: DialogContentProps,\n ref: React.Ref<HTMLElement>,\n): DialogContentState => {\n return {\n components: {\n root: 'div',\n },\n root: getNativeElementProps(props.as ?? 'div', {\n ref,\n ...props,\n }),\n };\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -33,7 +33,6 @@ const useDialogSurface_unstable = (props, ref) => {
|
|
|
33
33
|
const open = contexts_1.useDialogContext_unstable(ctx => ctx.open);
|
|
34
34
|
const requestOpenChange = contexts_1.useDialogContext_unstable(ctx => ctx.requestOpenChange);
|
|
35
35
|
const dialogTitleID = contexts_1.useDialogContext_unstable(ctx => ctx.dialogTitleId);
|
|
36
|
-
const dialogContentId = contexts_1.useDialogContext_unstable(ctx => ctx.dialogContentId);
|
|
37
36
|
const handledBackdropClick = react_utilities_1.useEventCallback(event => {
|
|
38
37
|
var _a, _b;
|
|
39
38
|
|
|
@@ -86,7 +85,6 @@ const useDialogSurface_unstable = (props, ref) => {
|
|
|
86
85
|
tabIndex: -1,
|
|
87
86
|
'aria-modal': modalType !== 'non-modal',
|
|
88
87
|
role: modalType === 'alert' ? 'alertdialog' : 'dialog',
|
|
89
|
-
'aria-describedby': dialogContentId,
|
|
90
88
|
'aria-labelledby': props['aria-label'] ? undefined : dialogTitleID,
|
|
91
89
|
...props,
|
|
92
90
|
...modalAttributes,
|
|
@@ -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;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;
|
|
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;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,GAA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,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,mBAAmB,KAAK,CAAC,YAAD,CAAL,GAAsB,SAAtB,GAAkC,aAJd;MAKvC,GAAG,KALoC;MAMvC,GAAG,eANoC;MAOvC,SAAS,EAAE,aAP4B;MAQvC,GAAG,EAAE,iBAAA,CAAA,aAAA,CAAc,GAAd,EAAmB,SAAnB;IARkC,CAAnC;EAZD,CAAP;AAuBD,CAhEM;;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\n const handledBackdropClick = useEventCallback((event: React.MouseEvent<HTMLDivElement>) => {\n if (isResolvedShorthand(props.backdrop)) {\n props.backdrop.onClick?.(event);\n }\n if (modalType === 'modal' && !event.isDefaultPrevented()) {\n requestOpenChange({\n event,\n open: false,\n type: 'backdropClick',\n });\n }\n });\n\n const handleKeyDown = useEventCallback((event: React.KeyboardEvent<DialogSurfaceElementIntersection>) => {\n props.onKeyDown?.(event);\n\n if (isEscapeKeyDismiss(event, modalType)) {\n requestOpenChange({\n event,\n open: false,\n type: 'escapeKeyDown',\n });\n // stop propagation to avoid conflicting with other elements that listen for `Escape`\n // e,g: nested Dialog, Popover, Menu and Tooltip\n event.stopPropagation();\n }\n });\n\n const { modalAttributes } = useModalAttributes({ trapFocus: modalType !== 'non-modal' });\n\n return {\n components: {\n backdrop: 'div',\n root: 'div',\n },\n backdrop: resolveShorthand(backdrop, {\n required: open && modalType !== 'non-modal',\n defaultProps: {\n 'aria-hidden': 'true',\n onClick: handledBackdropClick,\n },\n }),\n root: getNativeElementProps(as ?? 'div', {\n tabIndex: -1, // https://github.com/microsoft/fluentui/issues/25150\n 'aria-modal': modalType !== 'non-modal',\n role: modalType === 'alert' ? 'alertdialog' : 'dialog',\n 'aria-labelledby': props['aria-label'] ? undefined : dialogTitleID,\n ...props,\n ...modalAttributes,\n onKeyDown: handleKeyDown,\n ref: useMergedRefs(ref, dialogRef),\n }),\n };\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -29,6 +29,7 @@ const useDialogTrigger_unstable = props => {
|
|
|
29
29
|
} = props;
|
|
30
30
|
const child = react_utilities_1.getTriggerChild(children);
|
|
31
31
|
const requestOpenChange = contexts_1.useDialogContext_unstable(ctx => ctx.requestOpenChange);
|
|
32
|
+
const open = contexts_1.useDialogContext_unstable(ctx => ctx.open);
|
|
32
33
|
const {
|
|
33
34
|
triggerAttributes
|
|
34
35
|
} = react_tabster_1.useModalAttributes();
|
|
@@ -46,7 +47,7 @@ const useDialogTrigger_unstable = props => {
|
|
|
46
47
|
}
|
|
47
48
|
});
|
|
48
49
|
const triggerChildProps = { ...(child === null || child === void 0 ? void 0 : child.props),
|
|
49
|
-
'aria-
|
|
50
|
+
'aria-expanded': open,
|
|
50
51
|
ref: child === null || child === void 0 ? void 0 : child.ref,
|
|
51
52
|
onClick: handleClick,
|
|
52
53
|
...triggerAttributes
|
|
@@ -1 +1 @@
|
|
|
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,wBAAwB,GAAG,KAAvC;IAA8C,MAAM,GAAG,qBAAqB,GAAG,OAAH,GAAa;EAAzF,IAAoG,KAA1G;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,IAAo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AApC;EAQA,OAAO;IACL,QAAQ,EAAE,iBAAA,CAAA,2BAAA,CACR,QADQ,EAER,wBAAwB,GAAG,iBAAH,GAAuB,2BAFvC;EADL,CAAP;AAMD,CA/CM;;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, disableButtonEnhancement = false, action = isInsideSurfaceDialog ? 'close' : 'open' } = props;\n\n const child = getTriggerChild(children);\n\n const requestOpenChange = useDialogContext_unstable(ctx => ctx.requestOpenChange);\n const open = useDialogContext_unstable(ctx => ctx.open);\n\n const { triggerAttributes } = useModalAttributes();\n\n const handleClick = useEventCallback(\n (event: React.MouseEvent<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>) => {\n child?.props.onClick?.(event);\n if (!event.isDefaultPrevented()) {\n requestOpenChange({\n event,\n type: 'triggerClick',\n open: action === 'open',\n });\n }\n },\n );\n\n const triggerChildProps = {\n ...child?.props,\n 'aria-expanded': open,\n ref: child?.ref,\n onClick: handleClick,\n ...triggerAttributes,\n } as const;\n\n const ariaButtonTriggerChildProps = useARIAButtonProps(\n child?.type === 'button' || child?.type === 'a' ? child.type : 'div',\n {\n ...triggerChildProps,\n type: 'button',\n },\n );\n\n return {\n children: applyTriggerPropsToChildren(\n children,\n disableButtonEnhancement ? triggerChildProps : ariaButtonTriggerChildProps,\n ),\n };\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-dialog/src/contexts/dialogContext.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,wBAAA,gBAAA,OAAA,CAAA,kCAAA,CAAA;;
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-dialog/src/contexts/dialogContext.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,wBAAA,gBAAA,OAAA,CAAA,kCAAA,CAAA;;AAiBA,MAAM,mBAAmB,GAAuB;EAC9C,IAAI,EAAE,KADwC;EAE9C,SAAS,EAAE,OAFmC;EAG9C,cAAc,EAAE,KAH8B;EAI9C,SAAS,EAAE;IAAE,OAAO,EAAE;EAAX,CAJmC;;EAK9C,iBAAiB,GAAA;IACf;EACD;;AAP6C,CAAhD,C,CAUA;;AACa,OAAA,CAAA,aAAA,gBAAyD,wBAAA,CAAA,aAAA,CACpE,SADoE,CAAzD;AAIA,OAAA,CAAA,cAAA,GAAiB,OAAA,CAAA,aAAA,CAAc,QAA/B;;AACN,MAAM,yBAAyB,GAAO,QAAJ,IACvC,wBAAA,CAAA,kBAAA,CAAmB,OAAA,CAAA,aAAnB,EAAkC,CAAC,GAAG,GAAG,mBAAP,KAA+B,QAAQ,CAAC,GAAD,CAAzE,CADK;;AAAM,OAAA,CAAA,yBAAA,GAAyB,yBAAzB","sourcesContent":["import * as React from 'react';\nimport { createContext, ContextSelector, useContextSelector } from '@fluentui/react-context-selector';\nimport { DialogSurfaceElement } from '../DialogSurface';\nimport type { Context } from '@fluentui/react-context-selector';\nimport type { DialogModalType, DialogOpenChangeData } from '../Dialog';\n\nexport type DialogContextValue = {\n open: boolean;\n dialogTitleId?: string;\n isNestedDialog: boolean;\n dialogRef: React.Ref<DialogSurfaceElement>;\n modalType: DialogModalType;\n /**\n * Requests dialog main component to update it's internal open state\n */\n requestOpenChange: (data: DialogOpenChangeData) => void;\n};\n\nconst defaultContextValue: DialogContextValue = {\n open: false,\n modalType: 'modal',\n isNestedDialog: false,\n dialogRef: { current: null },\n requestOpenChange() {\n /* noop */\n },\n};\n\n// Contexts should default to undefined\nexport const DialogContext: Context<DialogContextValue | undefined> = createContext<DialogContextValue | undefined>(\n undefined,\n);\n\nexport const DialogProvider = DialogContext.Provider;\nexport const useDialogContext_unstable = <T>(selector: ContextSelector<DialogContextValue, T>): T =>\n useContextSelector(DialogContext, (ctx = defaultContextValue) => selector(ctx));\n"],"sourceRoot":"../src/"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-dialog",
|
|
3
|
-
"version": "9.1.
|
|
3
|
+
"version": "9.1.2",
|
|
4
4
|
"description": "Dialog component for Fluent UI React",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
7
|
-
"typings": "dist/index.d.ts",
|
|
7
|
+
"typings": "./dist/index.d.ts",
|
|
8
8
|
"sideEffects": false,
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -29,20 +29,20 @@
|
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@fluentui/eslint-plugin": "*",
|
|
31
31
|
"@fluentui/react-conformance": "*",
|
|
32
|
-
"@fluentui/react-conformance-griffel": "9.0.0-beta.
|
|
32
|
+
"@fluentui/react-conformance-griffel": "9.0.0-beta.18",
|
|
33
33
|
"@fluentui/scripts": "^1.0.0"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@griffel/react": "^1.4.2",
|
|
37
|
-
"@fluentui/react-utilities": "^9.2.
|
|
38
|
-
"@fluentui/keyboard-keys": "^9.0.
|
|
39
|
-
"@fluentui/react-context-selector": "^9.1.
|
|
40
|
-
"@fluentui/react-shared-contexts": "^9.1.
|
|
41
|
-
"@fluentui/react-aria": "^9.3.
|
|
37
|
+
"@fluentui/react-utilities": "^9.2.2",
|
|
38
|
+
"@fluentui/keyboard-keys": "^9.0.1",
|
|
39
|
+
"@fluentui/react-context-selector": "^9.1.2",
|
|
40
|
+
"@fluentui/react-shared-contexts": "^9.1.1",
|
|
41
|
+
"@fluentui/react-aria": "^9.3.2",
|
|
42
42
|
"@fluentui/react-icons": "^2.0.175",
|
|
43
|
-
"@fluentui/react-tabster": "^9.
|
|
44
|
-
"@fluentui/react-theme": "^9.1.
|
|
45
|
-
"@fluentui/react-portal": "^9.0.
|
|
43
|
+
"@fluentui/react-tabster": "^9.3.1",
|
|
44
|
+
"@fluentui/react-theme": "^9.1.2",
|
|
45
|
+
"@fluentui/react-portal": "^9.0.11",
|
|
46
46
|
"tslib": "^2.1.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
@@ -59,9 +59,10 @@
|
|
|
59
59
|
},
|
|
60
60
|
"exports": {
|
|
61
61
|
".": {
|
|
62
|
-
"types": "./
|
|
62
|
+
"types": "./dist/index.d.ts",
|
|
63
63
|
"import": "./lib/index.js",
|
|
64
64
|
"require": "./lib-commonjs/index.js"
|
|
65
|
-
}
|
|
65
|
+
},
|
|
66
|
+
"./package.json": "./package.json"
|
|
66
67
|
}
|
|
67
68
|
}
|