@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.
Files changed (150) hide show
  1. package/CHANGELOG.json +137 -1
  2. package/CHANGELOG.md +35 -2
  3. package/dist/index.d.ts +0 -8
  4. package/lib/components/Dialog/Dialog.types.js.map +1 -1
  5. package/lib/components/Dialog/useDialog.js +0 -1
  6. package/lib/components/Dialog/useDialog.js.map +1 -1
  7. package/lib/components/Dialog/useDialogContextValues.js +0 -2
  8. package/lib/components/Dialog/useDialogContextValues.js.map +1 -1
  9. package/lib/components/DialogContent/useDialogContent.js +0 -3
  10. package/lib/components/DialogContent/useDialogContent.js.map +1 -1
  11. package/lib/components/DialogSurface/useDialogSurface.js +0 -2
  12. package/lib/components/DialogSurface/useDialogSurface.js.map +1 -1
  13. package/lib/components/DialogTrigger/useDialogTrigger.js +2 -1
  14. package/lib/components/DialogTrigger/useDialogTrigger.js.map +1 -1
  15. package/lib/contexts/dialogContext.js.map +1 -1
  16. package/lib-amd/Dialog.js +6 -0
  17. package/lib-amd/Dialog.js.map +1 -0
  18. package/lib-amd/DialogActions.js +6 -0
  19. package/lib-amd/DialogActions.js.map +1 -0
  20. package/lib-amd/DialogBody.js +6 -0
  21. package/lib-amd/DialogBody.js.map +1 -0
  22. package/lib-amd/DialogContent.js +6 -0
  23. package/lib-amd/DialogContent.js.map +1 -0
  24. package/lib-amd/DialogSurface.js +6 -0
  25. package/lib-amd/DialogSurface.js.map +1 -0
  26. package/lib-amd/DialogTitle.js +6 -0
  27. package/lib-amd/DialogTitle.js.map +1 -0
  28. package/lib-amd/DialogTrigger.js +6 -0
  29. package/lib-amd/DialogTrigger.js.map +1 -0
  30. package/lib-amd/components/Dialog/Dialog.js +19 -0
  31. package/lib-amd/components/Dialog/Dialog.js.map +1 -0
  32. package/lib-amd/components/Dialog/Dialog.types.js +5 -0
  33. package/lib-amd/components/Dialog/Dialog.types.js.map +1 -0
  34. package/lib-amd/components/Dialog/index.js +9 -0
  35. package/lib-amd/components/Dialog/index.js.map +1 -0
  36. package/lib-amd/components/Dialog/renderDialog.js +17 -0
  37. package/lib-amd/components/Dialog/renderDialog.js.map +1 -0
  38. package/lib-amd/components/Dialog/useDialog.js +77 -0
  39. package/lib-amd/components/Dialog/useDialog.js.map +1 -0
  40. package/lib-amd/components/Dialog/useDialogContextValues.js +24 -0
  41. package/lib-amd/components/Dialog/useDialogContextValues.js.map +1 -0
  42. package/lib-amd/components/DialogActions/DialogActions.js +16 -0
  43. package/lib-amd/components/DialogActions/DialogActions.js.map +1 -0
  44. package/lib-amd/components/DialogActions/DialogActions.types.js +5 -0
  45. package/lib-amd/components/DialogActions/DialogActions.types.js.map +1 -0
  46. package/lib-amd/components/DialogActions/index.js +10 -0
  47. package/lib-amd/components/DialogActions/index.js.map +1 -0
  48. package/lib-amd/components/DialogActions/renderDialogActions.js +15 -0
  49. package/lib-amd/components/DialogActions/renderDialogActions.js.map +1 -0
  50. package/lib-amd/components/DialogActions/useDialogActions.js +26 -0
  51. package/lib-amd/components/DialogActions/useDialogActions.js.map +1 -0
  52. package/lib-amd/components/DialogActions/useDialogActionsStyles.js +27 -0
  53. package/lib-amd/components/DialogActions/useDialogActionsStyles.js.map +1 -0
  54. package/lib-amd/components/DialogBody/DialogBody.js +16 -0
  55. package/lib-amd/components/DialogBody/DialogBody.js.map +1 -0
  56. package/lib-amd/components/DialogBody/DialogBody.types.js +5 -0
  57. package/lib-amd/components/DialogBody/DialogBody.types.js.map +1 -0
  58. package/lib-amd/components/DialogBody/index.js +10 -0
  59. package/lib-amd/components/DialogBody/index.js.map +1 -0
  60. package/lib-amd/components/DialogBody/renderDialogBody.js +15 -0
  61. package/lib-amd/components/DialogBody/renderDialogBody.js.map +1 -0
  62. package/lib-amd/components/DialogBody/useDialogBody.js +25 -0
  63. package/lib-amd/components/DialogBody/useDialogBody.js.map +1 -0
  64. package/lib-amd/components/DialogBody/useDialogBodyStyles.js +31 -0
  65. package/lib-amd/components/DialogBody/useDialogBodyStyles.js.map +1 -0
  66. package/lib-amd/components/DialogContent/DialogContent.js +16 -0
  67. package/lib-amd/components/DialogContent/DialogContent.js.map +1 -0
  68. package/lib-amd/components/DialogContent/DialogContent.types.js +5 -0
  69. package/lib-amd/components/DialogContent/DialogContent.types.js.map +1 -0
  70. package/lib-amd/components/DialogContent/index.js +10 -0
  71. package/lib-amd/components/DialogContent/index.js.map +1 -0
  72. package/lib-amd/components/DialogContent/renderDialogContent.js +14 -0
  73. package/lib-amd/components/DialogContent/renderDialogContent.js.map +1 -0
  74. package/lib-amd/components/DialogContent/useDialogContent.js +25 -0
  75. package/lib-amd/components/DialogContent/useDialogContent.js.map +1 -0
  76. package/lib-amd/components/DialogContent/useDialogContentStyles.js +24 -0
  77. package/lib-amd/components/DialogContent/useDialogContentStyles.js.map +1 -0
  78. package/lib-amd/components/DialogSurface/DialogSurface.js +17 -0
  79. package/lib-amd/components/DialogSurface/DialogSurface.js.map +1 -0
  80. package/lib-amd/components/DialogSurface/DialogSurface.types.js +5 -0
  81. package/lib-amd/components/DialogSurface/DialogSurface.types.js.map +1 -0
  82. package/lib-amd/components/DialogSurface/index.js +10 -0
  83. package/lib-amd/components/DialogSurface/index.js.map +1 -0
  84. package/lib-amd/components/DialogSurface/renderDialogSurface.js +17 -0
  85. package/lib-amd/components/DialogSurface/renderDialogSurface.js.map +1 -0
  86. package/lib-amd/components/DialogSurface/useDialogSurface.js +66 -0
  87. package/lib-amd/components/DialogSurface/useDialogSurface.js.map +1 -0
  88. package/lib-amd/components/DialogSurface/useDialogSurfaceContextValues.js +11 -0
  89. package/lib-amd/components/DialogSurface/useDialogSurfaceContextValues.js.map +1 -0
  90. package/lib-amd/components/DialogSurface/useDialogSurfaceStyles.js +44 -0
  91. package/lib-amd/components/DialogSurface/useDialogSurfaceStyles.js.map +1 -0
  92. package/lib-amd/components/DialogTitle/DialogTitle.js +16 -0
  93. package/lib-amd/components/DialogTitle/DialogTitle.js.map +1 -0
  94. package/lib-amd/components/DialogTitle/DialogTitle.types.js +5 -0
  95. package/lib-amd/components/DialogTitle/DialogTitle.types.js.map +1 -0
  96. package/lib-amd/components/DialogTitle/index.js +10 -0
  97. package/lib-amd/components/DialogTitle/index.js.map +1 -0
  98. package/lib-amd/components/DialogTitle/renderDialogTitle.js +16 -0
  99. package/lib-amd/components/DialogTitle/renderDialogTitle.js.map +1 -0
  100. package/lib-amd/components/DialogTitle/useDialogTitle.js +36 -0
  101. package/lib-amd/components/DialogTitle/useDialogTitle.js.map +1 -0
  102. package/lib-amd/components/DialogTitle/useDialogTitleStyles.js +37 -0
  103. package/lib-amd/components/DialogTitle/useDialogTitleStyles.js.map +1 -0
  104. package/lib-amd/components/DialogTrigger/DialogTrigger.js +24 -0
  105. package/lib-amd/components/DialogTrigger/DialogTrigger.js.map +1 -0
  106. package/lib-amd/components/DialogTrigger/DialogTrigger.types.js +5 -0
  107. package/lib-amd/components/DialogTrigger/DialogTrigger.types.js.map +1 -0
  108. package/lib-amd/components/DialogTrigger/index.js +9 -0
  109. package/lib-amd/components/DialogTrigger/index.js.map +1 -0
  110. package/lib-amd/components/DialogTrigger/renderDialogTrigger.js +13 -0
  111. package/lib-amd/components/DialogTrigger/renderDialogTrigger.js.map +1 -0
  112. package/lib-amd/components/DialogTrigger/useDialogTrigger.js +37 -0
  113. package/lib-amd/components/DialogTrigger/useDialogTrigger.js.map +1 -0
  114. package/lib-amd/contexts/constants.js +16 -0
  115. package/lib-amd/contexts/constants.js.map +1 -0
  116. package/lib-amd/contexts/dialogContext.js +25 -0
  117. package/lib-amd/contexts/dialogContext.js.map +1 -0
  118. package/lib-amd/contexts/dialogSurfaceContext.js +11 -0
  119. package/lib-amd/contexts/dialogSurfaceContext.js.map +1 -0
  120. package/lib-amd/contexts/index.js +8 -0
  121. package/lib-amd/contexts/index.js.map +1 -0
  122. package/lib-amd/index.js +37 -0
  123. package/lib-amd/index.js.map +1 -0
  124. package/lib-amd/utils/index.js +8 -0
  125. package/lib-amd/utils/index.js.map +1 -0
  126. package/lib-amd/utils/isEscapeKeyDown.js +13 -0
  127. package/lib-amd/utils/isEscapeKeyDown.js.map +1 -0
  128. package/lib-amd/utils/useDisableBodyScroll.js +52 -0
  129. package/lib-amd/utils/useDisableBodyScroll.js.map +1 -0
  130. package/lib-amd/utils/useFocusFirstElement.js +38 -0
  131. package/lib-amd/utils/useFocusFirstElement.js.map +1 -0
  132. package/lib-commonjs/components/Dialog/useDialog.js +0 -1
  133. package/lib-commonjs/components/Dialog/useDialog.js.map +1 -1
  134. package/lib-commonjs/components/Dialog/useDialogContextValues.js +0 -2
  135. package/lib-commonjs/components/Dialog/useDialogContextValues.js.map +1 -1
  136. package/lib-commonjs/components/DialogContent/useDialogContent.js +0 -4
  137. package/lib-commonjs/components/DialogContent/useDialogContent.js.map +1 -1
  138. package/lib-commonjs/components/DialogSurface/useDialogSurface.js +0 -2
  139. package/lib-commonjs/components/DialogSurface/useDialogSurface.js.map +1 -1
  140. package/lib-commonjs/components/DialogTrigger/useDialogTrigger.js +2 -1
  141. package/lib-commonjs/components/DialogTrigger/useDialogTrigger.js.map +1 -1
  142. package/lib-commonjs/contexts/dialogContext.js.map +1 -1
  143. package/package.json +14 -13
  144. package/Spec.md +0 -537
  145. package/assets/AlertDialogKeyboardInteraction.png +0 -0
  146. package/assets/AlertDialogMouseInteraction.png +0 -0
  147. package/assets/ModalDialogKeyboardInteraction.png +0 -0
  148. package/assets/ModalDialogMouseInteraction.png +0 -0
  149. package/assets/NonModalDialogKeyboardInteraction.png +0 -0
  150. package/assets/NonModalDialogMouseInteraction.png +0 -0
@@ -0,0 +1,10 @@
1
+ define(["require", "exports", "tslib", "./DialogSurface", "./DialogSurface.types", "./renderDialogSurface", "./useDialogSurface", "./useDialogSurfaceStyles"], function (require, exports, tslib_1, DialogSurface_1, DialogSurface_types_1, renderDialogSurface_1, useDialogSurface_1, useDialogSurfaceStyles_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ tslib_1.__exportStar(DialogSurface_1, exports);
5
+ tslib_1.__exportStar(DialogSurface_types_1, exports);
6
+ tslib_1.__exportStar(renderDialogSurface_1, exports);
7
+ tslib_1.__exportStar(useDialogSurface_1, exports);
8
+ tslib_1.__exportStar(useDialogSurfaceStyles_1, exports);
9
+ });
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-dialog/src/components/DialogSurface/index.ts"],"names":[],"mappings":";;;IAAA,+CAAgC;IAChC,qDAAsC;IACtC,qDAAsC;IACtC,kDAAmC;IACnC,wDAAyC","sourcesContent":["export * from './DialogSurface';\nexport * from './DialogSurface.types';\nexport * from './renderDialogSurface';\nexport * from './useDialogSurface';\nexport * from './useDialogSurfaceStyles';\n"]}
@@ -0,0 +1,17 @@
1
+ define(["require", "exports", "tslib", "react", "@fluentui/react-utilities", "../../contexts", "@fluentui/react-portal"], function (require, exports, tslib_1, React, react_utilities_1, contexts_1, react_portal_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.renderDialogSurface_unstable = void 0;
5
+ /**
6
+ * Render the final JSX of DialogSurface
7
+ */
8
+ var renderDialogSurface_unstable = function (state, contextValues) {
9
+ var _a = react_utilities_1.getSlots(state), slots = _a.slots, slotProps = _a.slotProps;
10
+ return (React.createElement(react_portal_1.Portal, null,
11
+ slots.backdrop && React.createElement(slots.backdrop, tslib_1.__assign({}, slotProps.backdrop)),
12
+ React.createElement(contexts_1.DialogSurfaceProvider, { value: contextValues.dialogSurface },
13
+ React.createElement(slots.root, tslib_1.__assign({}, slotProps.root)))));
14
+ };
15
+ exports.renderDialogSurface_unstable = renderDialogSurface_unstable;
16
+ });
17
+ //# sourceMappingURL=renderDialogSurface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderDialogSurface.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-dialog/src/components/DialogSurface/renderDialogSurface.tsx"],"names":[],"mappings":";;;;IAMA;;OAEG;IACI,IAAM,4BAA4B,GAAG,UAAC,KAAyB,EAAE,aAAyC;QACzG,IAAA,KAAuB,0BAAQ,CAAqB,KAAK,CAAC,EAAxD,KAAK,WAAA,EAAE,SAAS,eAAwC,CAAC;QAEjE,OAAO,CACL,oBAAC,qBAAM;YACJ,KAAK,CAAC,QAAQ,IAAI,oBAAC,KAAK,CAAC,QAAQ,uBAAK,SAAS,CAAC,QAAQ,EAAI;YAC7D,oBAAC,gCAAqB,IAAC,KAAK,EAAE,aAAa,CAAC,aAAa;gBACvD,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI,EAAI,CACZ,CACjB,CACV,CAAC;IACJ,CAAC,CAAC;IAXW,QAAA,4BAA4B,gCAWvC","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { DialogSurfaceState, DialogSurfaceSlots, DialogSurfaceContextValues } from './DialogSurface.types';\nimport { DialogSurfaceProvider } from '../../contexts';\nimport { Portal } from '@fluentui/react-portal';\n\n/**\n * Render the final JSX of DialogSurface\n */\nexport const renderDialogSurface_unstable = (state: DialogSurfaceState, contextValues: DialogSurfaceContextValues) => {\n const { slots, slotProps } = getSlots<DialogSurfaceSlots>(state);\n\n return (\n <Portal>\n {slots.backdrop && <slots.backdrop {...slotProps.backdrop} />}\n <DialogSurfaceProvider value={contextValues.dialogSurface}>\n <slots.root {...slotProps.root} />\n </DialogSurfaceProvider>\n </Portal>\n );\n};\n"]}
@@ -0,0 +1,66 @@
1
+ define(["require", "exports", "tslib", "@fluentui/react-utilities", "../../contexts", "../../utils", "@fluentui/react-tabster"], function (require, exports, tslib_1, react_utilities_1, contexts_1, utils_1, react_tabster_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useDialogSurface_unstable = void 0;
5
+ /**
6
+ * Create the state required to render DialogSurface.
7
+ *
8
+ * The returned state can be modified with hooks such as useDialogSurfaceStyles_unstable,
9
+ * before being passed to renderDialogSurface_unstable.
10
+ *
11
+ * @param props - props from this instance of DialogSurface
12
+ * @param ref - reference to root HTMLElement of DialogSurface
13
+ */
14
+ var useDialogSurface_unstable = function (props, ref) {
15
+ var backdrop = props.backdrop, as = props.as;
16
+ var modalType = contexts_1.useDialogContext_unstable(function (ctx) { return ctx.modalType; });
17
+ var dialogRef = contexts_1.useDialogContext_unstable(function (ctx) { return ctx.dialogRef; });
18
+ var open = contexts_1.useDialogContext_unstable(function (ctx) { return ctx.open; });
19
+ var requestOpenChange = contexts_1.useDialogContext_unstable(function (ctx) { return ctx.requestOpenChange; });
20
+ var dialogTitleID = contexts_1.useDialogContext_unstable(function (ctx) { return ctx.dialogTitleId; });
21
+ var handledBackdropClick = react_utilities_1.useEventCallback(function (event) {
22
+ var _a, _b;
23
+ if (react_utilities_1.isResolvedShorthand(props.backdrop)) {
24
+ (_b = (_a = props.backdrop).onClick) === null || _b === void 0 ? void 0 : _b.call(_a, event);
25
+ }
26
+ if (modalType === 'modal' && !event.isDefaultPrevented()) {
27
+ requestOpenChange({
28
+ event: event,
29
+ open: false,
30
+ type: 'backdropClick',
31
+ });
32
+ }
33
+ });
34
+ var handleKeyDown = react_utilities_1.useEventCallback(function (event) {
35
+ var _a;
36
+ (_a = props.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(props, event);
37
+ if (utils_1.isEscapeKeyDismiss(event, modalType)) {
38
+ requestOpenChange({
39
+ event: event,
40
+ open: false,
41
+ type: 'escapeKeyDown',
42
+ });
43
+ // stop propagation to avoid conflicting with other elements that listen for `Escape`
44
+ // e,g: nested Dialog, Popover, Menu and Tooltip
45
+ event.stopPropagation();
46
+ }
47
+ });
48
+ var modalAttributes = react_tabster_1.useModalAttributes({ trapFocus: modalType !== 'non-modal' }).modalAttributes;
49
+ return {
50
+ components: {
51
+ backdrop: 'div',
52
+ root: 'div',
53
+ },
54
+ backdrop: react_utilities_1.resolveShorthand(backdrop, {
55
+ required: open && modalType !== 'non-modal',
56
+ defaultProps: {
57
+ 'aria-hidden': 'true',
58
+ onClick: handledBackdropClick,
59
+ },
60
+ }),
61
+ root: react_utilities_1.getNativeElementProps(as !== null && as !== void 0 ? as : 'div', tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ tabIndex: -1, 'aria-modal': modalType !== 'non-modal', role: modalType === 'alert' ? 'alertdialog' : 'dialog', 'aria-labelledby': props['aria-label'] ? undefined : dialogTitleID }, props), modalAttributes), { onKeyDown: handleKeyDown, ref: react_utilities_1.useMergedRefs(ref, dialogRef) })),
62
+ };
63
+ };
64
+ exports.useDialogSurface_unstable = useDialogSurface_unstable;
65
+ });
66
+ //# sourceMappingURL=useDialogSurface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDialogSurface.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-dialog/src/components/DialogSurface/useDialogSurface.ts"],"names":[],"mappings":";;;;IAkBA;;;;;;;;OAQG;IACI,IAAM,yBAAyB,GAAG,UACvC,KAAyB,EACzB,GAAoC;QAE5B,IAAA,QAAQ,GAAS,KAAK,SAAd,EAAE,EAAE,GAAK,KAAK,GAAV,CAAW;QAC/B,IAAM,SAAS,GAAG,oCAAyB,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,SAAS,EAAb,CAAa,CAAC,CAAC;QAClE,IAAM,SAAS,GAAG,oCAAyB,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,SAAS,EAAb,CAAa,CAAC,CAAC;QAClE,IAAM,IAAI,GAAG,oCAAyB,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,IAAI,EAAR,CAAQ,CAAC,CAAC;QACxD,IAAM,iBAAiB,GAAG,oCAAyB,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,iBAAiB,EAArB,CAAqB,CAAC,CAAC;QAClF,IAAM,aAAa,GAAG,oCAAyB,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,aAAa,EAAjB,CAAiB,CAAC,CAAC;QAE1E,IAAM,oBAAoB,GAAG,kCAAgB,CAAC,UAAC,KAAuC;;YACpF,IAAI,qCAAmB,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE;gBACvC,MAAA,MAAA,KAAK,CAAC,QAAQ,EAAC,OAAO,mDAAG,KAAK,CAAC,CAAC;aACjC;YACD,IAAI,SAAS,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,kBAAkB,EAAE,EAAE;gBACxD,iBAAiB,CAAC;oBAChB,KAAK,OAAA;oBACL,IAAI,EAAE,KAAK;oBACX,IAAI,EAAE,eAAe;iBACtB,CAAC,CAAC;aACJ;QACH,CAAC,CAAC,CAAC;QAEH,IAAM,aAAa,GAAG,kCAAgB,CAAC,UAAC,KAA4D;;YAClG,MAAA,KAAK,CAAC,SAAS,+CAAf,KAAK,EAAa,KAAK,CAAC,CAAC;YAEzB,IAAI,0BAAkB,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE;gBACxC,iBAAiB,CAAC;oBAChB,KAAK,OAAA;oBACL,IAAI,EAAE,KAAK;oBACX,IAAI,EAAE,eAAe;iBACtB,CAAC,CAAC;gBACH,qFAAqF;gBACrF,gDAAgD;gBAChD,KAAK,CAAC,eAAe,EAAE,CAAC;aACzB;QACH,CAAC,CAAC,CAAC;QAEK,IAAA,eAAe,GAAK,kCAAkB,CAAC,EAAE,SAAS,EAAE,SAAS,KAAK,WAAW,EAAE,CAAC,gBAAjE,CAAkE;QAEzF,OAAO;YACL,UAAU,EAAE;gBACV,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,KAAK;aACZ;YACD,QAAQ,EAAE,kCAAgB,CAAC,QAAQ,EAAE;gBACnC,QAAQ,EAAE,IAAI,IAAI,SAAS,KAAK,WAAW;gBAC3C,YAAY,EAAE;oBACZ,aAAa,EAAE,MAAM;oBACrB,OAAO,EAAE,oBAAoB;iBAC9B;aACF,CAAC;YACF,IAAI,EAAE,uCAAqB,CAAC,EAAE,aAAF,EAAE,cAAF,EAAE,GAAI,KAAK,uDACrC,QAAQ,EAAE,CAAC,CAAC,EACZ,YAAY,EAAE,SAAS,KAAK,WAAW,EACvC,IAAI,EAAE,SAAS,KAAK,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,EACtD,iBAAiB,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,IAC/D,KAAK,GACL,eAAe,KAClB,SAAS,EAAE,aAAa,EACxB,GAAG,EAAE,+BAAa,CAAC,GAAG,EAAE,SAAS,CAAC,IAClC;SACH,CAAC;IACJ,CAAC,CAAC;IAhEW,QAAA,yBAAyB,6BAgEpC","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"]}
@@ -0,0 +1,11 @@
1
+ define(["require", "exports"], function (require, exports) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useDialogSurfaceContextValues_unstable = void 0;
5
+ function useDialogSurfaceContextValues_unstable(state) {
6
+ var dialogSurface = true;
7
+ return { dialogSurface: dialogSurface };
8
+ }
9
+ exports.useDialogSurfaceContextValues_unstable = useDialogSurfaceContextValues_unstable;
10
+ });
11
+ //# sourceMappingURL=useDialogSurfaceContextValues.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDialogSurfaceContextValues.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-dialog/src/components/DialogSurface/useDialogSurfaceContextValues.ts"],"names":[],"mappings":";;;;IAGA,SAAgB,sCAAsC,CAAC,KAAyB;QAC9E,IAAM,aAAa,GAA8B,IAAI,CAAC;QAEtD,OAAO,EAAE,aAAa,eAAA,EAAE,CAAC;IAC3B,CAAC;IAJD,wFAIC","sourcesContent":["import type { DialogSurfaceContextValues, DialogSurfaceState } from './DialogSurface.types';\nimport type { DialogSurfaceContextValue } from '../../contexts';\n\nexport function useDialogSurfaceContextValues_unstable(state: DialogSurfaceState): DialogSurfaceContextValues {\n const dialogSurface: DialogSurfaceContextValue = true;\n\n return { dialogSurface };\n}\n"]}
@@ -0,0 +1,44 @@
1
+ define(["require", "exports", "tslib", "@griffel/react", "@fluentui/react-theme", "@fluentui/react-tabster", "../../contexts"], function (require, exports, tslib_1, react_1, react_theme_1, react_tabster_1, contexts_1) {
2
+ "use strict";
3
+ var _a;
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.useDialogSurfaceStyles_unstable = exports.dialogSurfaceClassNames = void 0;
6
+ exports.dialogSurfaceClassNames = {
7
+ root: 'fui-DialogSurface',
8
+ backdrop: 'fui-DialogSurface__backdrop',
9
+ };
10
+ /**
11
+ * Styles for the root slot
12
+ */
13
+ var useStyles = react_1.makeStyles({
14
+ focusOutline: react_tabster_1.createFocusOutlineStyle(),
15
+ root: tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ display: 'block', userSelect: 'unset', visibility: 'unset' }, react_1.shorthands.inset(0)), react_1.shorthands.padding(0)), react_1.shorthands.padding(contexts_1.SURFACE_PADDING)), react_1.shorthands.margin('auto')), react_1.shorthands.borderStyle('none')), react_1.shorthands.overflow('unset')), { '&::backdrop': {
16
+ backgroundColor: 'rgba(0, 0, 0, 0.4)',
17
+ }, position: 'fixed', width: '100%', height: 'fit-content', maxWidth: '600px', maxHeight: '100vh', boxSizing: 'border-box', boxShadow: react_theme_1.tokens.shadow64, backgroundColor: react_theme_1.tokens.colorNeutralBackground1, color: react_theme_1.tokens.colorNeutralForeground1 }), react_1.shorthands.border(contexts_1.SURFACE_BORDER_WIDTH, 'solid', react_theme_1.tokens.colorTransparentStroke)), react_1.shorthands.borderRadius(contexts_1.SURFACE_BORDER_RADIUS)), (_a = {}, _a[contexts_1.MEDIA_QUERY_BREAKPOINT_SELECTOR] = {
18
+ maxWidth: '100vw',
19
+ }, _a)),
20
+ backdrop: tslib_1.__assign({ position: 'fixed', backgroundColor: 'rgba(0, 0, 0, 0.4)' }, react_1.shorthands.inset('0px')),
21
+ nestedDialogBackdrop: {
22
+ backgroundColor: 'transparent',
23
+ },
24
+ nestedNativeDialogBackdrop: {
25
+ '&::backdrop': {
26
+ backgroundColor: 'transparent',
27
+ },
28
+ },
29
+ });
30
+ /**
31
+ * Apply styling to the DialogSurface slots based on the state
32
+ */
33
+ var useDialogSurfaceStyles_unstable = function (state) {
34
+ var styles = useStyles();
35
+ var isNestedDialog = contexts_1.useDialogContext_unstable(function (ctx) { return ctx.isNestedDialog; });
36
+ state.root.className = react_1.mergeClasses(exports.dialogSurfaceClassNames.root, styles.root, styles.focusOutline, isNestedDialog && styles.nestedNativeDialogBackdrop, state.root.className);
37
+ if (state.backdrop) {
38
+ state.backdrop.className = react_1.mergeClasses(exports.dialogSurfaceClassNames.backdrop, styles.backdrop, isNestedDialog && styles.nestedDialogBackdrop, state.backdrop.className);
39
+ }
40
+ return state;
41
+ };
42
+ exports.useDialogSurfaceStyles_unstable = useDialogSurfaceStyles_unstable;
43
+ });
44
+ //# sourceMappingURL=useDialogSurfaceStyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDialogSurfaceStyles.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-dialog/src/components/DialogSurface/useDialogSurfaceStyles.ts"],"names":[],"mappings":";;;;;IAaa,QAAA,uBAAuB,GAAuC;QACzE,IAAI,EAAE,mBAAmB;QACzB,QAAQ,EAAE,6BAA6B;KACxC,CAAC;IAEF;;OAEG;IACH,IAAM,SAAS,GAAG,kBAAU,CAAC;QAC3B,YAAY,EAAE,uCAAuB,EAAE;QACvC,IAAI,8KACF,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,OAAO,EACnB,UAAU,EAAE,OAAO,IAChB,kBAAU,CAAC,KAAK,CAAC,CAAC,CAAC,GACnB,kBAAU,CAAC,OAAO,CAAC,CAAC,CAAC,GACrB,kBAAU,CAAC,OAAO,CAAC,0BAAe,CAAC,GACnC,kBAAU,CAAC,MAAM,CAAC,MAAM,CAAC,GACzB,kBAAU,CAAC,WAAW,CAAC,MAAM,CAAC,GAC9B,kBAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,KAC/B,aAAa,EAAE;gBACb,eAAe,EAAE,oBAAoB;aACtC,EACD,QAAQ,EAAE,OAAO,EACjB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,OAAO,EACjB,SAAS,EAAE,OAAO,EAClB,SAAS,EAAE,YAAY,EACvB,SAAS,EAAE,oBAAM,CAAC,QAAQ,EAC1B,eAAe,EAAE,oBAAM,CAAC,uBAAuB,EAC/C,KAAK,EAAE,oBAAM,CAAC,uBAAuB,KAClC,kBAAU,CAAC,MAAM,CAAC,+BAAoB,EAAE,OAAO,EAAE,oBAAM,CAAC,sBAAsB,CAAC,GAC/E,kBAAU,CAAC,YAAY,CAAC,gCAAqB,CAAC,gBAChD,0CAA+B,IAAG;YACjC,QAAQ,EAAE,OAAO;SAClB,MACF;QACD,QAAQ,qBACN,QAAQ,EAAE,OAAO,EACjB,eAAe,EAAE,oBAAoB,IAClC,kBAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAC3B;QACD,oBAAoB,EAAE;YACpB,eAAe,EAAE,aAAa;SAC/B;QACD,0BAA0B,EAAE;YAC1B,aAAa,EAAE;gBACb,eAAe,EAAE,aAAa;aAC/B;SACF;KACF,CAAC,CAAC;IAEH;;OAEG;IACI,IAAM,+BAA+B,GAAG,UAAC,KAAyB;QACvE,IAAM,MAAM,GAAG,SAAS,EAAE,CAAC;QAC3B,IAAM,cAAc,GAAG,oCAAyB,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,cAAc,EAAlB,CAAkB,CAAC,CAAC;QAE5E,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,oBAAY,CACjC,+BAAuB,CAAC,IAAI,EAC5B,MAAM,CAAC,IAAI,EACX,MAAM,CAAC,YAAY,EACnB,cAAc,IAAI,MAAM,CAAC,0BAA0B,EACnD,KAAK,CAAC,IAAI,CAAC,SAAS,CACrB,CAAC;QACF,IAAI,KAAK,CAAC,QAAQ,EAAE;YAClB,KAAK,CAAC,QAAQ,CAAC,SAAS,GAAG,oBAAY,CACrC,+BAAuB,CAAC,QAAQ,EAChC,MAAM,CAAC,QAAQ,EACf,cAAc,IAAI,MAAM,CAAC,oBAAoB,EAC7C,KAAK,CAAC,QAAQ,CAAC,SAAS,CACzB,CAAC;SACH;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IApBW,QAAA,+BAA+B,mCAoB1C","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"]}
@@ -0,0 +1,16 @@
1
+ define(["require", "exports", "react", "./useDialogTitle", "./renderDialogTitle", "./useDialogTitleStyles"], function (require, exports, React, useDialogTitle_1, renderDialogTitle_1, useDialogTitleStyles_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.DialogTitle = void 0;
5
+ /**
6
+ * The `DialogTitle` component expects to have a title/header
7
+ * and when `Dialog` is `non-modal` a close (X icon) button is provided through `action` slot by default.
8
+ */
9
+ exports.DialogTitle = React.forwardRef(function (props, ref) {
10
+ var state = useDialogTitle_1.useDialogTitle_unstable(props, ref);
11
+ useDialogTitleStyles_1.useDialogTitleStyles_unstable(state);
12
+ return renderDialogTitle_1.renderDialogTitle_unstable(state);
13
+ });
14
+ exports.DialogTitle.displayName = 'DialogTitle';
15
+ });
16
+ //# sourceMappingURL=DialogTitle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DialogTitle.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-dialog/src/components/DialogTitle/DialogTitle.tsx"],"names":[],"mappings":";;;;IAOA;;;OAGG;IACU,QAAA,WAAW,GAA0C,KAAK,CAAC,UAAU,CAAC,UAAC,KAAK,EAAE,GAAG;QAC5F,IAAM,KAAK,GAAG,wCAAuB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAElD,oDAA6B,CAAC,KAAK,CAAC,CAAC;QACrC,OAAO,8CAA0B,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,mBAAW,CAAC,WAAW,GAAG,aAAa,CAAC","sourcesContent":["import * as React from 'react';\nimport { useDialogTitle_unstable } from './useDialogTitle';\nimport { renderDialogTitle_unstable } from './renderDialogTitle';\nimport { useDialogTitleStyles_unstable } from './useDialogTitleStyles';\nimport type { DialogTitleProps } from './DialogTitle.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * The `DialogTitle` component expects to have a title/header\n * and when `Dialog` is `non-modal` a close (X icon) button is provided through `action` slot by default.\n */\nexport const DialogTitle: ForwardRefComponent<DialogTitleProps> = React.forwardRef((props, ref) => {\n const state = useDialogTitle_unstable(props, ref);\n\n useDialogTitleStyles_unstable(state);\n return renderDialogTitle_unstable(state);\n});\n\nDialogTitle.displayName = 'DialogTitle';\n"]}
@@ -0,0 +1,5 @@
1
+ define(["require", "exports"], function (require, exports) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ });
5
+ //# sourceMappingURL=DialogTitle.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DialogTitle.types.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-dialog/src/components/DialogTitle/DialogTitle.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type DialogTitleSlots = {\n /**\n * By default this is a div, but can be a heading.\n */\n root: Slot<'div', 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'>;\n /**\n * By default a Dialog with modalType='non-modal' will have a close button action\n */\n action?: Slot<'div'>;\n};\n\n/**\n * DialogTitle Props\n */\nexport type DialogTitleProps = ComponentProps<DialogTitleSlots>;\n\n/**\n * State used in rendering DialogTitle\n */\nexport type DialogTitleState = ComponentState<DialogTitleSlots>;\n"]}
@@ -0,0 +1,10 @@
1
+ define(["require", "exports", "tslib", "./DialogTitle", "./DialogTitle.types", "./renderDialogTitle", "./useDialogTitle", "./useDialogTitleStyles"], function (require, exports, tslib_1, DialogTitle_1, DialogTitle_types_1, renderDialogTitle_1, useDialogTitle_1, useDialogTitleStyles_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ tslib_1.__exportStar(DialogTitle_1, exports);
5
+ tslib_1.__exportStar(DialogTitle_types_1, exports);
6
+ tslib_1.__exportStar(renderDialogTitle_1, exports);
7
+ tslib_1.__exportStar(useDialogTitle_1, exports);
8
+ tslib_1.__exportStar(useDialogTitleStyles_1, exports);
9
+ });
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-dialog/src/components/DialogTitle/index.ts"],"names":[],"mappings":";;;IAAA,6CAA8B;IAC9B,mDAAoC;IACpC,mDAAoC;IACpC,gDAAiC;IACjC,sDAAuC","sourcesContent":["export * from './DialogTitle';\nexport * from './DialogTitle.types';\nexport * from './renderDialogTitle';\nexport * from './useDialogTitle';\nexport * from './useDialogTitleStyles';\n"]}
@@ -0,0 +1,16 @@
1
+ define(["require", "exports", "tslib", "react", "@fluentui/react-utilities"], function (require, exports, tslib_1, React, react_utilities_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.renderDialogTitle_unstable = void 0;
5
+ /**
6
+ * Render the final JSX of DialogTitle
7
+ */
8
+ var renderDialogTitle_unstable = function (state) {
9
+ var _a = react_utilities_1.getSlots(state), slots = _a.slots, slotProps = _a.slotProps;
10
+ return (React.createElement(React.Fragment, null,
11
+ React.createElement(slots.root, tslib_1.__assign({}, slotProps.root), slotProps.root.children),
12
+ slots.action && React.createElement(slots.action, tslib_1.__assign({}, slotProps.action))));
13
+ };
14
+ exports.renderDialogTitle_unstable = renderDialogTitle_unstable;
15
+ });
16
+ //# sourceMappingURL=renderDialogTitle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderDialogTitle.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-dialog/src/components/DialogTitle/renderDialogTitle.tsx"],"names":[],"mappings":";;;;IAIA;;OAEG;IACI,IAAM,0BAA0B,GAAG,UAAC,KAAuB;QAC1D,IAAA,KAAuB,0BAAQ,CAAmB,KAAK,CAAC,EAAtD,KAAK,WAAA,EAAE,SAAS,eAAsC,CAAC;QAE/D,OAAO,CACL;YACE,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAc;YACrE,KAAK,CAAC,MAAM,IAAI,oBAAC,KAAK,CAAC,MAAM,uBAAK,SAAS,CAAC,MAAM,EAAI,CACtD,CACJ,CAAC;IACJ,CAAC,CAAC;IATW,QAAA,0BAA0B,8BASrC","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { DialogTitleState, DialogTitleSlots } from './DialogTitle.types';\n\n/**\n * Render the final JSX of DialogTitle\n */\nexport const renderDialogTitle_unstable = (state: DialogTitleState) => {\n const { slots, slotProps } = getSlots<DialogTitleSlots>(state);\n\n return (\n <>\n <slots.root {...slotProps.root}>{slotProps.root.children}</slots.root>\n {slots.action && <slots.action {...slotProps.action} />}\n </>\n );\n};\n"]}
@@ -0,0 +1,36 @@
1
+ define(["require", "exports", "tslib", "react", "@fluentui/react-utilities", "../../contexts/dialogContext", "@fluentui/react-icons", "@fluentui/react-utilities", "../DialogTrigger/DialogTrigger", "./useDialogTitleStyles"], function (require, exports, tslib_1, React, react_utilities_1, dialogContext_1, react_icons_1, react_utilities_2, DialogTrigger_1, useDialogTitleStyles_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useDialogTitle_unstable = void 0;
5
+ /**
6
+ * Create the state required to render DialogTitle.
7
+ *
8
+ * The returned state can be modified with hooks such as useDialogTitleStyles_unstable,
9
+ * before being passed to renderDialogTitle_unstable.
10
+ *
11
+ * @param props - props from this instance of DialogTitle
12
+ * @param ref - reference to root HTMLElement of DialogTitle
13
+ */
14
+ var useDialogTitle_unstable = function (props, ref) {
15
+ var as = props.as, action = props.action;
16
+ var modalType = dialogContext_1.useDialogContext_unstable(function (ctx) { return ctx.modalType; });
17
+ var internalStyles = useDialogTitleStyles_1.useDialogTitleInternalStyles();
18
+ return {
19
+ components: {
20
+ root: 'div',
21
+ action: 'div',
22
+ },
23
+ root: react_utilities_1.getNativeElementProps(as !== null && as !== void 0 ? as : 'div', tslib_1.__assign({ ref: ref, id: dialogContext_1.useDialogContext_unstable(function (ctx) { return ctx.dialogTitleId; }) }, props)),
24
+ action: react_utilities_2.resolveShorthand(action, {
25
+ required: modalType === 'non-modal',
26
+ defaultProps: {
27
+ children: (React.createElement(DialogTrigger_1.DialogTrigger, { disableButtonEnhancement: true, action: "close" },
28
+ React.createElement("button", { className: internalStyles.button, "aria-label": "close" },
29
+ React.createElement(react_icons_1.Dismiss24Regular, null)))),
30
+ },
31
+ }),
32
+ };
33
+ };
34
+ exports.useDialogTitle_unstable = useDialogTitle_unstable;
35
+ });
36
+ //# sourceMappingURL=useDialogTitle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDialogTitle.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-dialog/src/components/DialogTitle/useDialogTitle.tsx"],"names":[],"mappings":";;;;IASA;;;;;;;;OAQG;IACI,IAAM,uBAAuB,GAAG,UAAC,KAAuB,EAAE,GAA2B;QAClF,IAAA,EAAE,GAAa,KAAK,GAAlB,EAAE,MAAM,GAAK,KAAK,OAAV,CAAW;QAC7B,IAAM,SAAS,GAAG,yCAAyB,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,SAAS,EAAb,CAAa,CAAC,CAAC;QAClE,IAAM,cAAc,GAAG,mDAA4B,EAAE,CAAC;QAEtD,OAAO;YACL,UAAU,EAAE;gBACV,IAAI,EAAE,KAAK;gBACX,MAAM,EAAE,KAAK;aACd;YACD,IAAI,EAAE,uCAAqB,CAAC,EAAE,aAAF,EAAE,cAAF,EAAE,GAAI,KAAK,qBACrC,GAAG,KAAA,EACH,EAAE,EAAE,yCAAyB,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,aAAa,EAAjB,CAAiB,CAAC,IACpD,KAAK,EACR;YACF,MAAM,EAAE,kCAAgB,CAAC,MAAM,EAAE;gBAC/B,QAAQ,EAAE,SAAS,KAAK,WAAW;gBACnC,YAAY,EAAE;oBACZ,QAAQ,EAAE,CACR,oBAAC,6BAAa,IAAC,wBAAwB,QAAC,MAAM,EAAC,OAAO;wBACpD,gCACE,SAAS,EAAE,cAAc,CAAC,MAAM,gBAErB,OAAO;4BAElB,oBAAC,8BAAgB,OAAG,CACb,CACK,CACjB;iBACF;aACF,CAAC;SACH,CAAC;IACJ,CAAC,CAAC;IAhCW,QAAA,uBAAuB,2BAgClC","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 disableButtonEnhancement 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"]}
@@ -0,0 +1,37 @@
1
+ define(["require", "exports", "tslib", "@griffel/react", "@fluentui/react-theme", "../../contexts/constants", "@fluentui/react-tabster"], function (require, exports, tslib_1, react_1, react_theme_1, constants_1, react_tabster_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useDialogTitleStyles_unstable = exports.useDialogTitleInternalStyles = exports.dialogTitleClassNames = void 0;
5
+ exports.dialogTitleClassNames = {
6
+ root: 'fui-DialogTitle',
7
+ action: 'fui-DialogTitle__action',
8
+ };
9
+ /**
10
+ * Styles for the root slot
11
+ */
12
+ var useStyles = react_1.makeStyles({
13
+ root: tslib_1.__assign(tslib_1.__assign({}, react_theme_1.typographyStyles.subtitle1), react_1.shorthands.gridArea(constants_1.TITLE_GRID_AREA)),
14
+ rootWithoutCloseButton: tslib_1.__assign({}, react_1.shorthands.gridArea(constants_1.TITLE_GRID_AREA, constants_1.TITLE_GRID_AREA, constants_1.TITLE_ACTION_GRID_AREA, constants_1.TITLE_ACTION_GRID_AREA)),
15
+ action: tslib_1.__assign({}, react_1.shorthands.gridArea(constants_1.TITLE_ACTION_GRID_AREA)),
16
+ });
17
+ /**
18
+ * Styles to be applied on internal elements used by default action on non-modal Dialog
19
+ * @internal
20
+ */
21
+ exports.useDialogTitleInternalStyles = react_1.makeStyles({
22
+ button: tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ position: 'relative', boxSizing: 'content-box', backgroundColor: 'inherit', color: 'inherit', fontFamily: 'inherit', fontSize: 'inherit', cursor: 'pointer', lineHeight: 0 }, react_1.shorthands.overflow('visible')), react_1.shorthands.padding(0)), react_1.shorthands.borderStyle('none')), { WebkitAppearance: 'button', textAlign: 'unset' }), react_tabster_1.createFocusOutlineStyle()),
23
+ });
24
+ /**
25
+ * Apply styling to the DialogTitle slots based on the state
26
+ */
27
+ var useDialogTitleStyles_unstable = function (state) {
28
+ var styles = useStyles();
29
+ state.root.className = react_1.mergeClasses(exports.dialogTitleClassNames.root, styles.root, !state.action && styles.rootWithoutCloseButton, state.root.className);
30
+ if (state.action) {
31
+ state.action.className = react_1.mergeClasses(exports.dialogTitleClassNames.action, styles.action, state.action.className);
32
+ }
33
+ return state;
34
+ };
35
+ exports.useDialogTitleStyles_unstable = useDialogTitleStyles_unstable;
36
+ });
37
+ //# sourceMappingURL=useDialogTitleStyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDialogTitleStyles.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-dialog/src/components/DialogTitle/useDialogTitleStyles.ts"],"names":[],"mappings":";;;;IAOa,QAAA,qBAAqB,GAAqC;QACrE,IAAI,EAAE,iBAAiB;QACvB,MAAM,EAAE,yBAAyB;KAClC,CAAC;IAEF;;OAEG;IACH,IAAM,SAAS,GAAG,kBAAU,CAAC;QAC3B,IAAI,wCACC,8BAAgB,CAAC,SAAS,GAC1B,kBAAU,CAAC,QAAQ,CAAC,2BAAe,CAAC,CACxC;QACD,sBAAsB,uBACjB,kBAAU,CAAC,QAAQ,CAAC,2BAAe,EAAE,2BAAe,EAAE,kCAAsB,EAAE,kCAAsB,CAAC,CACzG;QACD,MAAM,uBACD,kBAAU,CAAC,QAAQ,CAAC,kCAAsB,CAAC,CAC/C;KACF,CAAC,CAAC;IAEH;;;OAGG;IACU,QAAA,4BAA4B,GAAG,kBAAU,CAAC;QACrD,MAAM,yFACJ,QAAQ,EAAE,UAAU,EACpB,SAAS,EAAE,aAAa,EACxB,eAAe,EAAE,SAAS,EAC1B,KAAK,EAAE,SAAS,EAChB,UAAU,EAAE,SAAS,EACrB,QAAQ,EAAE,SAAS,EACnB,MAAM,EAAE,SAAS,EACjB,UAAU,EAAE,CAAC,IACV,kBAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,GAC9B,kBAAU,CAAC,OAAO,CAAC,CAAC,CAAC,GACrB,kBAAU,CAAC,WAAW,CAAC,MAAM,CAAC,KACjC,gBAAgB,EAAE,QAAQ,EAC1B,SAAS,EAAE,OAAO,KACf,uCAAuB,EAAE,CAC7B;KACF,CAAC,CAAC;IAEH;;OAEG;IACI,IAAM,6BAA6B,GAAG,UAAC,KAAuB;QACnE,IAAM,MAAM,GAAG,SAAS,EAAE,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,oBAAY,CACjC,6BAAqB,CAAC,IAAI,EAC1B,MAAM,CAAC,IAAI,EACX,CAAC,KAAK,CAAC,MAAM,IAAI,MAAM,CAAC,sBAAsB,EAC9C,KAAK,CAAC,IAAI,CAAC,SAAS,CACrB,CAAC;QACF,IAAI,KAAK,CAAC,MAAM,EAAE;YAChB,KAAK,CAAC,MAAM,CAAC,SAAS,GAAG,oBAAY,CAAC,6BAAqB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;SAC5G;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAZW,QAAA,6BAA6B,iCAYxC","sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport type { DialogTitleSlots, DialogTitleState } from './DialogTitle.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { typographyStyles } from '@fluentui/react-theme';\nimport { TITLE_ACTION_GRID_AREA, TITLE_GRID_AREA } from '../../contexts/constants';\nimport { createFocusOutlineStyle } from '@fluentui/react-tabster';\n\nexport const dialogTitleClassNames: SlotClassNames<DialogTitleSlots> = {\n root: 'fui-DialogTitle',\n action: 'fui-DialogTitle__action',\n};\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n ...typographyStyles.subtitle1,\n ...shorthands.gridArea(TITLE_GRID_AREA),\n },\n rootWithoutCloseButton: {\n ...shorthands.gridArea(TITLE_GRID_AREA, TITLE_GRID_AREA, TITLE_ACTION_GRID_AREA, TITLE_ACTION_GRID_AREA),\n },\n action: {\n ...shorthands.gridArea(TITLE_ACTION_GRID_AREA),\n },\n});\n\n/**\n * Styles to be applied on internal elements used by default action on non-modal Dialog\n * @internal\n */\nexport const useDialogTitleInternalStyles = makeStyles({\n button: {\n position: 'relative',\n boxSizing: 'content-box',\n backgroundColor: 'inherit',\n color: 'inherit',\n fontFamily: 'inherit',\n fontSize: 'inherit',\n cursor: 'pointer',\n lineHeight: 0,\n ...shorthands.overflow('visible'),\n ...shorthands.padding(0),\n ...shorthands.borderStyle('none'),\n WebkitAppearance: 'button',\n textAlign: 'unset',\n ...createFocusOutlineStyle(),\n },\n});\n\n/**\n * Apply styling to the DialogTitle slots based on the state\n */\nexport const useDialogTitleStyles_unstable = (state: DialogTitleState): DialogTitleState => {\n const styles = useStyles();\n state.root.className = mergeClasses(\n dialogTitleClassNames.root,\n styles.root,\n !state.action && styles.rootWithoutCloseButton,\n state.root.className,\n );\n if (state.action) {\n state.action.className = mergeClasses(dialogTitleClassNames.action, styles.action, state.action.className);\n }\n return state;\n};\n"]}
@@ -0,0 +1,24 @@
1
+ define(["require", "exports", "./useDialogTrigger", "./renderDialogTrigger"], function (require, exports, useDialogTrigger_1, renderDialogTrigger_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.DialogTrigger = void 0;
5
+ /**
6
+ * A non-visual component that wraps its child
7
+ * and configures them to be the trigger that will open or close a `Dialog`.
8
+ * This component should only accept one child.
9
+ *
10
+ * In case the trigger is used outside `Dialog` component
11
+ * it'll still provide basic ARIA related attributes
12
+ * to it's wrapped child, but it won't be able to alter the dialog `open` state anymore,
13
+ * in that case the user must provide a `controlled state`
14
+ */
15
+ var DialogTrigger = function (props) {
16
+ var state = useDialogTrigger_1.useDialogTrigger_unstable(props);
17
+ return renderDialogTrigger_1.renderDialogTrigger_unstable(state);
18
+ };
19
+ exports.DialogTrigger = DialogTrigger;
20
+ exports.DialogTrigger.displayName = 'DialogTrigger';
21
+ // type casting here is required to ensure internal type FluentTriggerComponent is not leaked
22
+ exports.DialogTrigger.isFluentTriggerComponent = true;
23
+ });
24
+ //# sourceMappingURL=DialogTrigger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DialogTrigger.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-dialog/src/components/DialogTrigger/DialogTrigger.tsx"],"names":[],"mappings":";;;;IAMA;;;;;;;;;OASG;IACI,IAAM,aAAa,GAAiC,UAAA,KAAK;QAC9D,IAAM,KAAK,GAAG,4CAAyB,CAAC,KAAK,CAAC,CAAC;QAE/C,OAAO,kDAA4B,CAAC,KAAK,CAAC,CAAC;IAC7C,CAAC,CAAC;IAJW,QAAA,aAAa,iBAIxB;IAEF,qBAAa,CAAC,WAAW,GAAG,eAAe,CAAC;IAC5C,6FAA6F;IAC5F,qBAAwC,CAAC,wBAAwB,GAAG,IAAI,CAAC","sourcesContent":["import * as React from 'react';\nimport { useDialogTrigger_unstable } from './useDialogTrigger';\nimport { renderDialogTrigger_unstable } from './renderDialogTrigger';\nimport type { DialogTriggerProps } from './DialogTrigger.types';\nimport type { FluentTriggerComponent } from '@fluentui/react-utilities';\n\n/**\n * A non-visual component that wraps its child\n * and configures them to be the trigger that will open or close a `Dialog`.\n * This component should only accept one child.\n *\n * In case the trigger is used outside `Dialog` component\n * it'll still provide basic ARIA related attributes\n * to it's wrapped child, but it won't be able to alter the dialog `open` state anymore,\n * in that case the user must provide a `controlled state`\n */\nexport const DialogTrigger: React.FC<DialogTriggerProps> = props => {\n const state = useDialogTrigger_unstable(props);\n\n return renderDialogTrigger_unstable(state);\n};\n\nDialogTrigger.displayName = 'DialogTrigger';\n// type casting here is required to ensure internal type FluentTriggerComponent is not leaked\n(DialogTrigger as FluentTriggerComponent).isFluentTriggerComponent = true;\n"]}
@@ -0,0 +1,5 @@
1
+ define(["require", "exports"], function (require, exports) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ });
5
+ //# sourceMappingURL=DialogTrigger.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DialogTrigger.types.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-dialog/src/components/DialogTrigger/DialogTrigger.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ARIAButtonResultProps, ARIAButtonType } from '@fluentui/react-aria';\nimport type { TriggerProps } from '@fluentui/react-utilities';\nimport * as React from 'react';\n\nexport type DialogTriggerAction = 'open' | 'close';\n\nexport type DialogTriggerProps = TriggerProps<DialogTriggerChildProps> & {\n /**\n * Explicitly declare if the trigger is responsible for opening or\n * closing a Dialog visibility state.\n *\n * If `DialogTrigger` is outside `DialogSurface` then it'll be `open` by default\n *\n * If `DialogTrigger` is inside `DialogSurface` then it'll be `close` by default\n */\n action?: DialogTriggerAction;\n /**\n * Disables internal trigger mechanism that ensures a child provided will be a compliant ARIA button.\n * @default false\n */\n disableButtonEnhancement?: boolean;\n};\n\n/**\n * Props that are passed to the child of the DialogTrigger when cloned to ensure correct behaviour for the Dialog\n */\nexport type DialogTriggerChildProps<Type extends ARIAButtonType = ARIAButtonType, Props = {}> = ARIAButtonResultProps<\n Type,\n Props & {\n 'aria-haspopup'?: 'dialog';\n }\n>;\n\nexport type DialogTriggerState = {\n children: React.ReactElement | null;\n};\n"]}
@@ -0,0 +1,9 @@
1
+ define(["require", "exports", "tslib", "./DialogTrigger", "./DialogTrigger.types", "./renderDialogTrigger", "./useDialogTrigger"], function (require, exports, tslib_1, DialogTrigger_1, DialogTrigger_types_1, renderDialogTrigger_1, useDialogTrigger_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ tslib_1.__exportStar(DialogTrigger_1, exports);
5
+ tslib_1.__exportStar(DialogTrigger_types_1, exports);
6
+ tslib_1.__exportStar(renderDialogTrigger_1, exports);
7
+ tslib_1.__exportStar(useDialogTrigger_1, exports);
8
+ });
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-dialog/src/components/DialogTrigger/index.ts"],"names":[],"mappings":";;;IAAA,+CAAgC;IAChC,qDAAsC;IACtC,qDAAsC;IACtC,kDAAmC","sourcesContent":["export * from './DialogTrigger';\nexport * from './DialogTrigger.types';\nexport * from './renderDialogTrigger';\nexport * from './useDialogTrigger';\n"]}
@@ -0,0 +1,13 @@
1
+ define(["require", "exports"], function (require, exports) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.renderDialogTrigger_unstable = void 0;
5
+ /**
6
+ * Render the final JSX of MenuTrigger
7
+ *
8
+ * Only renders children
9
+ */
10
+ var renderDialogTrigger_unstable = function (state) { return state.children; };
11
+ exports.renderDialogTrigger_unstable = renderDialogTrigger_unstable;
12
+ });
13
+ //# sourceMappingURL=renderDialogTrigger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderDialogTrigger.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-dialog/src/components/DialogTrigger/renderDialogTrigger.tsx"],"names":[],"mappings":";;;;IAEA;;;;OAIG;IACI,IAAM,4BAA4B,GAAG,UAAC,KAAyB,IAAK,OAAA,KAAK,CAAC,QAAQ,EAAd,CAAc,CAAC;IAA7E,QAAA,4BAA4B,gCAAiD","sourcesContent":["import type { DialogTriggerState } from './DialogTrigger.types';\n\n/**\n * Render the final JSX of MenuTrigger\n *\n * Only renders children\n */\nexport const renderDialogTrigger_unstable = (state: DialogTriggerState) => state.children;\n"]}
@@ -0,0 +1,37 @@
1
+ define(["require", "exports", "tslib", "@fluentui/react-tabster", "@fluentui/react-utilities", "../../contexts", "@fluentui/react-aria"], function (require, exports, tslib_1, react_tabster_1, react_utilities_1, contexts_1, react_aria_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useDialogTrigger_unstable = void 0;
5
+ /**
6
+ * Create the state required to render DialogTrigger.
7
+ * Clones the only child component and adds necessary event handling behaviours to open a popup Dialog
8
+ *
9
+ * @param props - props from this instance of DialogTrigger
10
+ */
11
+ var useDialogTrigger_unstable = function (props) {
12
+ var isInsideSurfaceDialog = contexts_1.useDialogSurfaceContext_unstable();
13
+ var children = props.children, _a = props.disableButtonEnhancement, disableButtonEnhancement = _a === void 0 ? false : _a, _b = props.action, action = _b === void 0 ? isInsideSurfaceDialog ? 'close' : 'open' : _b;
14
+ var child = react_utilities_1.getTriggerChild(children);
15
+ var requestOpenChange = contexts_1.useDialogContext_unstable(function (ctx) { return ctx.requestOpenChange; });
16
+ var open = contexts_1.useDialogContext_unstable(function (ctx) { return ctx.open; });
17
+ var triggerAttributes = react_tabster_1.useModalAttributes().triggerAttributes;
18
+ var handleClick = react_utilities_1.useEventCallback(function (event) {
19
+ var _a, _b;
20
+ (_b = child === null || child === void 0 ? void 0 : (_a = child.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a, event);
21
+ if (!event.isDefaultPrevented()) {
22
+ requestOpenChange({
23
+ event: event,
24
+ type: 'triggerClick',
25
+ open: action === 'open',
26
+ });
27
+ }
28
+ });
29
+ var triggerChildProps = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, child === null || child === void 0 ? void 0 : child.props), { 'aria-expanded': open, ref: child === null || child === void 0 ? void 0 : child.ref, onClick: handleClick }), triggerAttributes);
30
+ var ariaButtonTriggerChildProps = 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', tslib_1.__assign(tslib_1.__assign({}, triggerChildProps), { type: 'button' }));
31
+ return {
32
+ children: react_utilities_1.applyTriggerPropsToChildren(children, disableButtonEnhancement ? triggerChildProps : ariaButtonTriggerChildProps),
33
+ };
34
+ };
35
+ exports.useDialogTrigger_unstable = useDialogTrigger_unstable;
36
+ });
37
+ //# sourceMappingURL=useDialogTrigger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDialogTrigger.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-dialog/src/components/DialogTrigger/useDialogTrigger.ts"],"names":[],"mappings":";;;;IAOA;;;;;OAKG;IACI,IAAM,yBAAyB,GAAG,UAAC,KAAyB;QACjE,IAAM,qBAAqB,GAAG,2CAAgC,EAAE,CAAC;QAEzD,IAAA,QAAQ,GAA0F,KAAK,SAA/F,EAAE,KAAwF,KAAK,yBAA7D,EAAhC,wBAAwB,mBAAG,KAAK,KAAA,EAAE,KAAsD,KAAK,OAAV,EAAjD,MAAM,mBAAG,qBAAqB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,KAAA,CAAW;QAEhH,IAAM,KAAK,GAAG,iCAAe,CAAC,QAAQ,CAAC,CAAC;QAExC,IAAM,iBAAiB,GAAG,oCAAyB,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,iBAAiB,EAArB,CAAqB,CAAC,CAAC;QAClF,IAAM,IAAI,GAAG,oCAAyB,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,IAAI,EAAR,CAAQ,CAAC,CAAC;QAEhD,IAAA,iBAAiB,GAAK,kCAAkB,EAAE,kBAAzB,CAA0B;QAEnD,IAAM,WAAW,GAAG,kCAAgB,CAClC,UAAC,KAA+E;;YAC9E,MAAA,KAAK,aAAL,KAAK,6BAAL,KAAK,CAAE,KAAK,EAAC,OAAO,mDAAG,KAAK,CAAC,CAAC;YAC9B,IAAI,CAAC,KAAK,CAAC,kBAAkB,EAAE,EAAE;gBAC/B,iBAAiB,CAAC;oBAChB,KAAK,OAAA;oBACL,IAAI,EAAE,cAAc;oBACpB,IAAI,EAAE,MAAM,KAAK,MAAM;iBACxB,CAAC,CAAC;aACJ;QACH,CAAC,CACF,CAAC;QAEF,IAAM,iBAAiB,GAAG,uDACrB,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,KACf,eAAe,EAAE,IAAI,EACrB,GAAG,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,GAAG,EACf,OAAO,EAAE,WAAW,KACjB,iBAAiB,CACZ,CAAC;QAEX,IAAM,2BAA2B,GAAG,+BAAkB,CACpD,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,MAAK,QAAQ,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,MAAK,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,wCAE/D,iBAAiB,KACpB,IAAI,EAAE,QAAQ,IAEjB,CAAC;QAEF,OAAO;YACL,QAAQ,EAAE,6CAA2B,CACnC,QAAQ,EACR,wBAAwB,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,2BAA2B,CAC3E;SACF,CAAC;IACJ,CAAC,CAAC;IA/CW,QAAA,yBAAyB,6BA+CpC","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"]}
@@ -0,0 +1,16 @@
1
+ define(["require", "exports"], function (require, exports) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.CONTENT_GRID_AREA = exports.TITLE_ACTION_GRID_AREA = exports.TITLE_GRID_AREA = exports.ACTIONS_END_GRID_AREA = exports.ACTIONS_START_GRID_AREA = exports.SURFACE_BORDER_WIDTH = exports.SURFACE_BORDER_RADIUS = exports.DIALOG_GAP = exports.SURFACE_PADDING = exports.MEDIA_QUERY_BREAKPOINT_SELECTOR = void 0;
5
+ exports.MEDIA_QUERY_BREAKPOINT_SELECTOR = '@media screen and (max-width: 480px)';
6
+ exports.SURFACE_PADDING = '24px';
7
+ exports.DIALOG_GAP = '8px';
8
+ exports.SURFACE_BORDER_RADIUS = '8px';
9
+ exports.SURFACE_BORDER_WIDTH = '1px';
10
+ exports.ACTIONS_START_GRID_AREA = 'actions-start';
11
+ exports.ACTIONS_END_GRID_AREA = 'actions-end';
12
+ exports.TITLE_GRID_AREA = 'title';
13
+ exports.TITLE_ACTION_GRID_AREA = 'close-button';
14
+ exports.CONTENT_GRID_AREA = 'body';
15
+ });
16
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-dialog/src/contexts/constants.ts"],"names":[],"mappings":";;;;IAAa,QAAA,+BAA+B,GAAG,sCAAsC,CAAC;IACzE,QAAA,eAAe,GAAG,MAAM,CAAC;IACzB,QAAA,UAAU,GAAG,KAAK,CAAC;IACnB,QAAA,qBAAqB,GAAG,KAAK,CAAC;IAC9B,QAAA,oBAAoB,GAAG,KAAK,CAAC;IAE7B,QAAA,uBAAuB,GAAG,eAAe,CAAC;IAC1C,QAAA,qBAAqB,GAAG,aAAa,CAAC;IACtC,QAAA,eAAe,GAAG,OAAO,CAAC;IAC1B,QAAA,sBAAsB,GAAG,cAAc,CAAC;IACxC,QAAA,iBAAiB,GAAG,MAAM,CAAC","sourcesContent":["export const MEDIA_QUERY_BREAKPOINT_SELECTOR = '@media screen and (max-width: 480px)';\nexport const SURFACE_PADDING = '24px';\nexport const DIALOG_GAP = '8px';\nexport const SURFACE_BORDER_RADIUS = '8px';\nexport const SURFACE_BORDER_WIDTH = '1px';\n\nexport const ACTIONS_START_GRID_AREA = 'actions-start';\nexport const ACTIONS_END_GRID_AREA = 'actions-end';\nexport const TITLE_GRID_AREA = 'title';\nexport const TITLE_ACTION_GRID_AREA = 'close-button';\nexport const CONTENT_GRID_AREA = 'body';\n"]}
@@ -0,0 +1,25 @@
1
+ define(["require", "exports", "@fluentui/react-context-selector"], function (require, exports, react_context_selector_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useDialogContext_unstable = exports.DialogProvider = exports.DialogContext = void 0;
5
+ var defaultContextValue = {
6
+ open: false,
7
+ modalType: 'modal',
8
+ isNestedDialog: false,
9
+ dialogRef: { current: null },
10
+ requestOpenChange: function () {
11
+ /* noop */
12
+ },
13
+ };
14
+ // Contexts should default to undefined
15
+ exports.DialogContext = react_context_selector_1.createContext(undefined);
16
+ exports.DialogProvider = exports.DialogContext.Provider;
17
+ var useDialogContext_unstable = function (selector) {
18
+ return react_context_selector_1.useContextSelector(exports.DialogContext, function (ctx) {
19
+ if (ctx === void 0) { ctx = defaultContextValue; }
20
+ return selector(ctx);
21
+ });
22
+ };
23
+ exports.useDialogContext_unstable = useDialogContext_unstable;
24
+ });
25
+ //# sourceMappingURL=dialogContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialogContext.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-dialog/src/contexts/dialogContext.ts"],"names":[],"mappings":";;;;IAkBA,IAAM,mBAAmB,GAAuB;QAC9C,IAAI,EAAE,KAAK;QACX,SAAS,EAAE,OAAO;QAClB,cAAc,EAAE,KAAK;QACrB,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QAC5B,iBAAiB;YACf,UAAU;QACZ,CAAC;KACF,CAAC;IAEF,uCAAuC;IAC1B,QAAA,aAAa,GAA4C,sCAAa,CACjF,SAAS,CACV,CAAC;IAEW,QAAA,cAAc,GAAG,qBAAa,CAAC,QAAQ,CAAC;IAC9C,IAAM,yBAAyB,GAAG,UAAI,QAAgD;QAC3F,OAAA,2CAAkB,CAAC,qBAAa,EAAE,UAAC,GAAyB;YAAzB,oBAAA,EAAA,yBAAyB;YAAK,OAAA,QAAQ,CAAC,GAAG,CAAC;QAAb,CAAa,CAAC;IAA/E,CAA+E,CAAC;IADrE,QAAA,yBAAyB,6BAC4C","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"]}
@@ -0,0 +1,11 @@
1
+ define(["require", "exports", "react"], function (require, exports, react_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useDialogSurfaceContext_unstable = exports.DialogSurfaceProvider = exports.DialogSurfaceContext = void 0;
5
+ var defaultContextValue = false;
6
+ exports.DialogSurfaceContext = react_1.createContext(undefined);
7
+ exports.DialogSurfaceProvider = exports.DialogSurfaceContext.Provider;
8
+ var useDialogSurfaceContext_unstable = function () { var _a; return (_a = react_1.useContext(exports.DialogSurfaceContext)) !== null && _a !== void 0 ? _a : defaultContextValue; };
9
+ exports.useDialogSurfaceContext_unstable = useDialogSurfaceContext_unstable;
10
+ });
11
+ //# sourceMappingURL=dialogSurfaceContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialogSurfaceContext.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-dialog/src/contexts/dialogSurfaceContext.ts"],"names":[],"mappings":";;;;IAIA,IAAM,mBAAmB,GAA8B,KAAK,CAAC;IAEhD,QAAA,oBAAoB,GAAG,qBAAa,CAAwC,SAAS,CAAC,CAAC;IAEvF,QAAA,qBAAqB,GAAG,4BAAoB,CAAC,QAAQ,CAAC;IAE5D,IAAM,gCAAgC,GAAG,sBAAM,OAAA,MAAA,kBAAU,CAAC,4BAAoB,CAAC,mCAAI,mBAAmB,CAAA,EAAA,CAAC;IAAjG,QAAA,gCAAgC,oCAAiE","sourcesContent":["import { createContext, useContext } from 'react';\n\nexport type DialogSurfaceContextValue = boolean;\n\nconst defaultContextValue: DialogSurfaceContextValue = false;\n\nexport const DialogSurfaceContext = createContext<DialogSurfaceContextValue | undefined>(undefined);\n\nexport const DialogSurfaceProvider = DialogSurfaceContext.Provider;\n\nexport const useDialogSurfaceContext_unstable = () => useContext(DialogSurfaceContext) ?? defaultContextValue;\n"]}
@@ -0,0 +1,8 @@
1
+ define(["require", "exports", "tslib", "./constants", "./dialogContext", "./dialogSurfaceContext"], function (require, exports, tslib_1, constants_1, dialogContext_1, dialogSurfaceContext_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ tslib_1.__exportStar(constants_1, exports);
5
+ tslib_1.__exportStar(dialogContext_1, exports);
6
+ tslib_1.__exportStar(dialogSurfaceContext_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/contexts/index.ts"],"names":[],"mappings":";;;IAAA,2CAA4B;IAC5B,+CAAgC;IAChC,sDAAuC","sourcesContent":["export * from './constants';\nexport * from './dialogContext';\nexport * from './dialogSurfaceContext';\n"]}