@fluentui/react-dialog 9.6.0 → 9.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/CHANGELOG.json +88 -1
  2. package/CHANGELOG.md +23 -2
  3. package/lib/components/Dialog/Dialog.js.map +1 -1
  4. package/lib/components/Dialog/renderDialog.js +12 -7
  5. package/lib/components/Dialog/renderDialog.js.map +1 -1
  6. package/lib/components/Dialog/useDialog.js +7 -4
  7. package/lib/components/Dialog/useDialog.js.map +1 -1
  8. package/lib/components/Dialog/useDialogContextValues.js +1 -1
  9. package/lib/components/Dialog/useDialogContextValues.js.map +1 -1
  10. package/lib/components/DialogActions/DialogActions.js.map +1 -1
  11. package/lib/components/DialogActions/renderDialogActions.js +2 -2
  12. package/lib/components/DialogActions/renderDialogActions.js.map +1 -1
  13. package/lib/components/DialogActions/useDialogActions.js +1 -1
  14. package/lib/components/DialogActions/useDialogActions.js.map +1 -1
  15. package/lib/components/DialogActions/useDialogActionsStyles.styles.js +12 -2
  16. package/lib/components/DialogActions/useDialogActionsStyles.styles.js.map +1 -1
  17. package/lib/components/DialogBody/DialogBody.js.map +1 -1
  18. package/lib/components/DialogBody/renderDialogBody.js +2 -2
  19. package/lib/components/DialogBody/renderDialogBody.js.map +1 -1
  20. package/lib/components/DialogBody/useDialogBody.js.map +1 -1
  21. package/lib/components/DialogContent/DialogContent.js.map +1 -1
  22. package/lib/components/DialogContent/renderDialogContent.js +2 -2
  23. package/lib/components/DialogContent/renderDialogContent.js.map +1 -1
  24. package/lib/components/DialogContent/useDialogContent.js.map +1 -1
  25. package/lib/components/DialogSurface/DialogSurface.js.map +1 -1
  26. package/lib/components/DialogSurface/renderDialogSurface.js +11 -6
  27. package/lib/components/DialogSurface/renderDialogSurface.js.map +1 -1
  28. package/lib/components/DialogSurface/useDialogSurface.js +3 -3
  29. package/lib/components/DialogSurface/useDialogSurface.js.map +1 -1
  30. package/lib/components/DialogSurface/useDialogSurfaceContextValues.js.map +1 -1
  31. package/lib/components/DialogTitle/DialogTitle.js.map +1 -1
  32. package/lib/components/DialogTitle/renderDialogTitle.js +9 -2
  33. package/lib/components/DialogTitle/renderDialogTitle.js.map +1 -1
  34. package/lib/components/DialogTitle/useDialogTitle.js +1 -1
  35. package/lib/components/DialogTitle/useDialogTitle.js.map +1 -1
  36. package/lib/components/DialogTrigger/DialogTrigger.js.map +1 -1
  37. package/lib/components/DialogTrigger/useDialogTrigger.js +8 -7
  38. package/lib/components/DialogTrigger/useDialogTrigger.js.map +1 -1
  39. package/lib/contexts/dialogContext.js.map +1 -1
  40. package/lib/contexts/dialogSurfaceContext.js.map +1 -1
  41. package/lib/utils/useDisableBodyScroll.js +2 -2
  42. package/lib/utils/useDisableBodyScroll.js.map +1 -1
  43. package/lib/utils/useFocusFirstElement.js +5 -6
  44. package/lib/utils/useFocusFirstElement.js.map +1 -1
  45. package/lib-commonjs/Dialog.js +2 -2
  46. package/lib-commonjs/Dialog.js.map +1 -1
  47. package/lib-commonjs/DialogActions.js +2 -2
  48. package/lib-commonjs/DialogActions.js.map +1 -1
  49. package/lib-commonjs/DialogBody.js +2 -2
  50. package/lib-commonjs/DialogBody.js.map +1 -1
  51. package/lib-commonjs/DialogContent.js +2 -2
  52. package/lib-commonjs/DialogContent.js.map +1 -1
  53. package/lib-commonjs/DialogSurface.js +2 -2
  54. package/lib-commonjs/DialogSurface.js.map +1 -1
  55. package/lib-commonjs/DialogTitle.js +2 -2
  56. package/lib-commonjs/DialogTitle.js.map +1 -1
  57. package/lib-commonjs/DialogTrigger.js +2 -2
  58. package/lib-commonjs/DialogTrigger.js.map +1 -1
  59. package/lib-commonjs/components/Dialog/Dialog.js +5 -3
  60. package/lib-commonjs/components/Dialog/Dialog.js.map +1 -1
  61. package/lib-commonjs/components/Dialog/index.js +5 -5
  62. package/lib-commonjs/components/Dialog/index.js.map +1 -1
  63. package/lib-commonjs/components/Dialog/renderDialog.js +16 -9
  64. package/lib-commonjs/components/Dialog/renderDialog.js.map +1 -1
  65. package/lib-commonjs/components/Dialog/useDialog.js +20 -15
  66. package/lib-commonjs/components/Dialog/useDialog.js.map +1 -1
  67. package/lib-commonjs/components/Dialog/useDialogContextValues.js +4 -2
  68. package/lib-commonjs/components/Dialog/useDialogContextValues.js.map +1 -1
  69. package/lib-commonjs/components/DialogActions/DialogActions.js +9 -7
  70. package/lib-commonjs/components/DialogActions/DialogActions.js.map +1 -1
  71. package/lib-commonjs/components/DialogActions/index.js +6 -6
  72. package/lib-commonjs/components/DialogActions/index.js.map +1 -1
  73. package/lib-commonjs/components/DialogActions/renderDialogActions.js +8 -6
  74. package/lib-commonjs/components/DialogActions/renderDialogActions.js.map +1 -1
  75. package/lib-commonjs/components/DialogActions/useDialogActions.js +8 -6
  76. package/lib-commonjs/components/DialogActions/useDialogActions.js.map +1 -1
  77. package/lib-commonjs/components/DialogActions/useDialogActionsStyles.styles.js +31 -5
  78. package/lib-commonjs/components/DialogActions/useDialogActionsStyles.styles.js.map +1 -1
  79. package/lib-commonjs/components/DialogBody/DialogBody.js +9 -7
  80. package/lib-commonjs/components/DialogBody/DialogBody.js.map +1 -1
  81. package/lib-commonjs/components/DialogBody/index.js +6 -6
  82. package/lib-commonjs/components/DialogBody/index.js.map +1 -1
  83. package/lib-commonjs/components/DialogBody/renderDialogBody.js +8 -6
  84. package/lib-commonjs/components/DialogBody/renderDialogBody.js.map +1 -1
  85. package/lib-commonjs/components/DialogBody/useDialogBody.js +7 -5
  86. package/lib-commonjs/components/DialogBody/useDialogBody.js.map +1 -1
  87. package/lib-commonjs/components/DialogBody/useDialogBodyStyles.styles.js +7 -3
  88. package/lib-commonjs/components/DialogBody/useDialogBodyStyles.styles.js.map +1 -1
  89. package/lib-commonjs/components/DialogContent/DialogContent.js +9 -7
  90. package/lib-commonjs/components/DialogContent/DialogContent.js.map +1 -1
  91. package/lib-commonjs/components/DialogContent/index.js +6 -6
  92. package/lib-commonjs/components/DialogContent/index.js.map +1 -1
  93. package/lib-commonjs/components/DialogContent/renderDialogContent.js +8 -6
  94. package/lib-commonjs/components/DialogContent/renderDialogContent.js.map +1 -1
  95. package/lib-commonjs/components/DialogContent/useDialogContent.js +7 -5
  96. package/lib-commonjs/components/DialogContent/useDialogContent.js.map +1 -1
  97. package/lib-commonjs/components/DialogContent/useDialogContentStyles.styles.js +7 -3
  98. package/lib-commonjs/components/DialogContent/useDialogContentStyles.styles.js.map +1 -1
  99. package/lib-commonjs/components/DialogSurface/DialogSurface.js +9 -7
  100. package/lib-commonjs/components/DialogSurface/DialogSurface.js.map +1 -1
  101. package/lib-commonjs/components/DialogSurface/index.js +6 -6
  102. package/lib-commonjs/components/DialogSurface/index.js.map +1 -1
  103. package/lib-commonjs/components/DialogSurface/renderDialogSurface.js +18 -11
  104. package/lib-commonjs/components/DialogSurface/renderDialogSurface.js.map +1 -1
  105. package/lib-commonjs/components/DialogSurface/useDialogSurface.js +17 -15
  106. package/lib-commonjs/components/DialogSurface/useDialogSurface.js.map +1 -1
  107. package/lib-commonjs/components/DialogSurface/useDialogSurfaceContextValues.js +3 -1
  108. package/lib-commonjs/components/DialogSurface/useDialogSurfaceContextValues.js.map +1 -1
  109. package/lib-commonjs/components/DialogSurface/useDialogSurfaceStyles.styles.js +7 -3
  110. package/lib-commonjs/components/DialogSurface/useDialogSurfaceStyles.styles.js.map +1 -1
  111. package/lib-commonjs/components/DialogTitle/DialogTitle.js +9 -7
  112. package/lib-commonjs/components/DialogTitle/DialogTitle.js.map +1 -1
  113. package/lib-commonjs/components/DialogTitle/index.js +6 -6
  114. package/lib-commonjs/components/DialogTitle/index.js.map +1 -1
  115. package/lib-commonjs/components/DialogTitle/renderDialogTitle.js +15 -6
  116. package/lib-commonjs/components/DialogTitle/renderDialogTitle.js.map +1 -1
  117. package/lib-commonjs/components/DialogTitle/useDialogTitle.js +15 -13
  118. package/lib-commonjs/components/DialogTitle/useDialogTitle.js.map +1 -1
  119. package/lib-commonjs/components/DialogTitle/useDialogTitleStyles.styles.js +11 -5
  120. package/lib-commonjs/components/DialogTitle/useDialogTitleStyles.styles.js.map +1 -1
  121. package/lib-commonjs/components/DialogTrigger/DialogTrigger.js +5 -3
  122. package/lib-commonjs/components/DialogTrigger/DialogTrigger.js.map +1 -1
  123. package/lib-commonjs/components/DialogTrigger/DialogTrigger.types.js +2 -2
  124. package/lib-commonjs/components/DialogTrigger/DialogTrigger.types.js.map +1 -1
  125. package/lib-commonjs/components/DialogTrigger/index.js +5 -5
  126. package/lib-commonjs/components/DialogTrigger/index.js.map +1 -1
  127. package/lib-commonjs/components/DialogTrigger/renderDialogTrigger.js +3 -1
  128. package/lib-commonjs/components/DialogTrigger/renderDialogTrigger.js.map +1 -1
  129. package/lib-commonjs/components/DialogTrigger/useDialogTrigger.js +19 -16
  130. package/lib-commonjs/components/DialogTrigger/useDialogTrigger.js.map +1 -1
  131. package/lib-commonjs/contexts/constants.js +12 -4
  132. package/lib-commonjs/contexts/constants.js.map +1 -1
  133. package/lib-commonjs/contexts/dialogContext.js +14 -8
  134. package/lib-commonjs/contexts/dialogContext.js.map +1 -1
  135. package/lib-commonjs/contexts/dialogSurfaceContext.js +9 -3
  136. package/lib-commonjs/contexts/dialogSurfaceContext.js.map +1 -1
  137. package/lib-commonjs/contexts/index.js +4 -4
  138. package/lib-commonjs/contexts/index.js.map +1 -1
  139. package/lib-commonjs/index.js +100 -38
  140. package/lib-commonjs/index.js.map +1 -1
  141. package/lib-commonjs/utils/index.js +3 -3
  142. package/lib-commonjs/utils/index.js.map +1 -1
  143. package/lib-commonjs/utils/useDisableBodyScroll.js +9 -5
  144. package/lib-commonjs/utils/useDisableBodyScroll.js.map +1 -1
  145. package/lib-commonjs/utils/useFocusFirstElement.js +12 -11
  146. package/lib-commonjs/utils/useFocusFirstElement.js.map +1 -1
  147. package/package.json +15 -15
@@ -1 +1 @@
1
- {"version":3,"sources":["DialogTitle.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useDialogTitle_unstable } from './useDialogTitle';\nimport { renderDialogTitle_unstable } from './renderDialogTitle';\nimport { useDialogTitleStyles_unstable } from './useDialogTitleStyles.styles';\nimport type { DialogTitleProps } from './DialogTitle.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * The `DialogTitle` component expects to have a title/header\n * and when `Dialog` is `non-modal` a close (X icon) button is provided through `action` slot by default.\n */\nexport const DialogTitle: ForwardRefComponent<DialogTitleProps> = React.forwardRef((props, ref) => {\n const state = useDialogTitle_unstable(props, ref);\n\n useDialogTitleStyles_unstable(state);\n\n useCustomStyleHook_unstable('useDialogTitleStyles_unstable')(state);\n\n return renderDialogTitle_unstable(state);\n});\n\nDialogTitle.displayName = 'DialogTitle';\n"],"names":["React","useDialogTitle_unstable","renderDialogTitle_unstable","useDialogTitleStyles_unstable","useCustomStyleHook_unstable","DialogTitle","forwardRef","props","ref","state","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,uBAAuB,QAAQ,mBAAmB;AAC3D,SAASC,0BAA0B,QAAQ,sBAAsB;AACjE,SAASC,6BAA6B,QAAQ,gCAAgC;AAG9E,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;;CAGC,GACD,OAAO,MAAMC,4BAAqDL,MAAMM,UAAU,CAAC,CAACC,OAAOC,MAAQ;IACjG,MAAMC,QAAQR,wBAAwBM,OAAOC;IAE7CL,8BAA8BM;IAE9BL,4BAA4B,iCAAiCK;IAE7D,OAAOP,2BAA2BO;AACpC,GAAG;AAEHJ,YAAYK,WAAW,GAAG"}
1
+ {"version":3,"sources":["DialogTitle.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useDialogTitle_unstable } from './useDialogTitle';\nimport { renderDialogTitle_unstable } from './renderDialogTitle';\nimport { useDialogTitleStyles_unstable } from './useDialogTitleStyles.styles';\nimport type { DialogTitleProps } from './DialogTitle.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * The `DialogTitle` component expects to have a title/header\n * and when `Dialog` is `non-modal` a close (X icon) button is provided through `action` slot by default.\n */\nexport const DialogTitle: ForwardRefComponent<DialogTitleProps> = React.forwardRef((props, ref) => {\n const state = useDialogTitle_unstable(props, ref);\n\n useDialogTitleStyles_unstable(state);\n\n useCustomStyleHook_unstable('useDialogTitleStyles_unstable')(state);\n\n return renderDialogTitle_unstable(state);\n});\n\nDialogTitle.displayName = 'DialogTitle';\n"],"names":["React","useDialogTitle_unstable","renderDialogTitle_unstable","useDialogTitleStyles_unstable","useCustomStyleHook_unstable","DialogTitle","forwardRef","props","ref","state","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,uBAAuB,QAAQ,mBAAmB;AAC3D,SAASC,0BAA0B,QAAQ,sBAAsB;AACjE,SAASC,6BAA6B,QAAQ,gCAAgC;AAG9E,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;;CAGC,GACD,OAAO,MAAMC,4BAAqDL,MAAMM,UAAU,CAAC,CAACC,OAAOC;IACzF,MAAMC,QAAQR,wBAAwBM,OAAOC;IAE7CL,8BAA8BM;IAE9BL,4BAA4B,iCAAiCK;IAE7D,OAAOP,2BAA2BO;AACpC,GAAG;AAEHJ,YAAYK,WAAW,GAAG"}
@@ -1,8 +1,15 @@
1
- /** @jsxRuntime classic */ /** @jsxFrag Fragment */ /** @jsx createElement */ import { createElement, Fragment } from '@fluentui/react-jsx-runtime';
1
+ /** @jsxRuntime automatic */ /** @jsxImportSource @fluentui/react-jsx-runtime */ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@fluentui/react-jsx-runtime/jsx-runtime";
2
2
  import { assertSlots } from '@fluentui/react-utilities';
3
3
  /**
4
4
  * Render the final JSX of DialogTitle
5
5
  */ export const renderDialogTitle_unstable = (state)=>{
6
6
  assertSlots(state);
7
- return /*#__PURE__*/ createElement(Fragment, null, /*#__PURE__*/ createElement(state.root, null, state.root.children), state.action && /*#__PURE__*/ createElement(state.action, null));
7
+ return /*#__PURE__*/ _jsxs(_Fragment, {
8
+ children: [
9
+ /*#__PURE__*/ _jsx(state.root, {
10
+ children: state.root.children
11
+ }),
12
+ state.action && /*#__PURE__*/ _jsx(state.action, {})
13
+ ]
14
+ });
8
15
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["renderDialogTitle.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsxFrag Fragment */\n/** @jsx createElement */\n\nimport { createElement, Fragment } from '@fluentui/react-jsx-runtime';\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { DialogTitleState, DialogTitleSlots } from './DialogTitle.types';\n\n/**\n * Render the final JSX of DialogTitle\n */\nexport const renderDialogTitle_unstable = (state: DialogTitleState) => {\n assertSlots<DialogTitleSlots>(state);\n\n return (\n <>\n <state.root>{state.root.children}</state.root>\n {state.action && <state.action />}\n </>\n );\n};\n"],"names":["createElement","Fragment","assertSlots","renderDialogTitle_unstable","state","root","children","action"],"mappings":"AAAA,wBAAwB,GACxB,sBAAsB,GACtB,uBAAuB,GAEvB,SAASA,aAAa,EAAEC,QAAQ,QAAQ,8BAA8B;AAEtE,SAASC,WAAW,QAAQ,4BAA4B;AAGxD;;CAEC,GACD,OAAO,MAAMC,6BAA6B,CAACC,QAA4B;IACrEF,YAA8BE;IAE9B,qBACE,AAdJ,cADA,8BAgBM,AAfN,cAeOA,MAAMC,IAAI,QAAED,MAAMC,IAAI,CAACC,QAAQ,GAC/BF,MAAMG,MAAM,kBAAI,AAhBvB,cAgBwBH,MAAMG,MAAM;AAGpC,EAAE"}
1
+ {"version":3,"sources":["renderDialogTitle.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { DialogTitleState, DialogTitleSlots } from './DialogTitle.types';\n\n/**\n * Render the final JSX of DialogTitle\n */\nexport const renderDialogTitle_unstable = (state: DialogTitleState) => {\n assertSlots<DialogTitleSlots>(state);\n\n return (\n <>\n <state.root>{state.root.children}</state.root>\n {state.action && <state.action />}\n </>\n );\n};\n"],"names":["assertSlots","renderDialogTitle_unstable","state","root","children","action"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAGxD;;CAEC,GACD,OAAO,MAAMC,6BAA6B,CAACC;IACzCF,YAA8BE;IAE9B,qBACE;;0BACE,KAACA,MAAMC,IAAI;0BAAED,MAAMC,IAAI,CAACC,QAAQ;;YAC/BF,MAAMG,MAAM,kBAAI,KAACH,MAAMG,MAAM;;;AAGpC,EAAE"}
@@ -13,7 +13,7 @@ import { useDialogTitleInternalStyles } from './useDialogTitleStyles.styles';
13
13
  * @param props - props from this instance of DialogTitle
14
14
  * @param ref - reference to root HTMLElement of DialogTitle
15
15
  */ export const useDialogTitle_unstable = (props, ref)=>{
16
- const { as , action } = props;
16
+ const { as, action } = props;
17
17
  const modalType = useDialogContext_unstable((ctx)=>ctx.modalType);
18
18
  const internalStyles = useDialogTitleInternalStyles();
19
19
  return {
@@ -1 +1 @@
1
- {"version":3,"sources":["useDialogTitle.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, slot } from '@fluentui/react-utilities';\nimport type { DialogTitleProps, DialogTitleState } from './DialogTitle.types';\nimport { useDialogContext_unstable } from '../../contexts/dialogContext';\nimport { Dismiss20Regular } from '@fluentui/react-icons';\nimport { DialogTrigger } from '../DialogTrigger/DialogTrigger';\nimport { useDialogTitleInternalStyles } from './useDialogTitleStyles.styles';\n\n/**\n * Create the state required to render DialogTitle.\n *\n * The returned state can be modified with hooks such as useDialogTitleStyles_unstable,\n * before being passed to renderDialogTitle_unstable.\n *\n * @param props - props from this instance of DialogTitle\n * @param ref - reference to root HTMLElement of DialogTitle\n */\nexport const useDialogTitle_unstable = (props: DialogTitleProps, ref: React.Ref<HTMLDivElement>): DialogTitleState => {\n const { as, action } = props;\n const modalType = useDialogContext_unstable(ctx => ctx.modalType);\n const internalStyles = useDialogTitleInternalStyles();\n\n return {\n components: {\n root: 'h2',\n action: 'div',\n },\n root: slot.always(\n getNativeElementProps(as ?? 'h2', {\n ref,\n id: useDialogContext_unstable(ctx => ctx.dialogTitleId),\n ...props,\n }),\n { elementType: 'h2' },\n ),\n action: slot.optional(action, {\n renderByDefault: modalType === 'non-modal',\n defaultProps: {\n children: (\n <DialogTrigger disableButtonEnhancement action=\"close\">\n <button\n type=\"button\"\n className={internalStyles.button}\n // TODO: find a better way to add internal labels\n aria-label=\"close\"\n >\n <Dismiss20Regular />\n </button>\n </DialogTrigger>\n ),\n },\n elementType: 'div',\n }),\n };\n};\n"],"names":["React","getNativeElementProps","slot","useDialogContext_unstable","Dismiss20Regular","DialogTrigger","useDialogTitleInternalStyles","useDialogTitle_unstable","props","ref","as","action","modalType","ctx","internalStyles","components","root","always","id","dialogTitleId","elementType","optional","renderByDefault","defaultProps","children","disableButtonEnhancement","button","type","className","aria-label"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,EAAEC,IAAI,QAAQ,4BAA4B;AAExE,SAASC,yBAAyB,QAAQ,+BAA+B;AACzE,SAASC,gBAAgB,QAAQ,wBAAwB;AACzD,SAASC,aAAa,QAAQ,iCAAiC;AAC/D,SAASC,4BAA4B,QAAQ,gCAAgC;AAE7E;;;;;;;;CAQC,GACD,OAAO,MAAMC,0BAA0B,CAACC,OAAyBC,MAAqD;IACpH,MAAM,EAAEC,GAAE,EAAEC,OAAM,EAAE,GAAGH;IACvB,MAAMI,YAAYT,0BAA0BU,CAAAA,MAAOA,IAAID,SAAS;IAChE,MAAME,iBAAiBR;IAEvB,OAAO;QACLS,YAAY;YACVC,MAAM;YACNL,QAAQ;QACV;QACAK,MAAMd,KAAKe,MAAM,CACfhB,sBAAsBS,eAAAA,gBAAAA,KAAM,IAAI,EAAE;YAChCD;YACAS,IAAIf,0BAA0BU,CAAAA,MAAOA,IAAIM,aAAa;YACtD,GAAGX,KAAK;QACV,IACA;YAAEY,aAAa;QAAK;QAEtBT,QAAQT,KAAKmB,QAAQ,CAACV,QAAQ;YAC5BW,iBAAiBV,cAAc;YAC/BW,cAAc;gBACZC,wBACE,oBAACnB;oBAAcoB,0BAAAA,IAAwB;oBAACd,QAAO;iCAC7C,oBAACe;oBACCC,MAAK;oBACLC,WAAWd,eAAeY,MAAM;oBAChC,iDAAiD;oBACjDG,cAAW;iCAEX,oBAACzB;YAIT;YACAgB,aAAa;QACf;IACF;AACF,EAAE"}
1
+ {"version":3,"sources":["useDialogTitle.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, slot } from '@fluentui/react-utilities';\nimport type { DialogTitleProps, DialogTitleState } from './DialogTitle.types';\nimport { useDialogContext_unstable } from '../../contexts/dialogContext';\nimport { Dismiss20Regular } from '@fluentui/react-icons';\nimport { DialogTrigger } from '../DialogTrigger/DialogTrigger';\nimport { useDialogTitleInternalStyles } from './useDialogTitleStyles.styles';\n\n/**\n * Create the state required to render DialogTitle.\n *\n * The returned state can be modified with hooks such as useDialogTitleStyles_unstable,\n * before being passed to renderDialogTitle_unstable.\n *\n * @param props - props from this instance of DialogTitle\n * @param ref - reference to root HTMLElement of DialogTitle\n */\nexport const useDialogTitle_unstable = (props: DialogTitleProps, ref: React.Ref<HTMLDivElement>): DialogTitleState => {\n const { as, action } = props;\n const modalType = useDialogContext_unstable(ctx => ctx.modalType);\n const internalStyles = useDialogTitleInternalStyles();\n\n return {\n components: {\n root: 'h2',\n action: 'div',\n },\n root: slot.always(\n getNativeElementProps(as ?? 'h2', {\n ref,\n id: useDialogContext_unstable(ctx => ctx.dialogTitleId),\n ...props,\n }),\n { elementType: 'h2' },\n ),\n action: slot.optional(action, {\n renderByDefault: modalType === 'non-modal',\n defaultProps: {\n children: (\n <DialogTrigger disableButtonEnhancement action=\"close\">\n <button\n type=\"button\"\n className={internalStyles.button}\n // TODO: find a better way to add internal labels\n aria-label=\"close\"\n >\n <Dismiss20Regular />\n </button>\n </DialogTrigger>\n ),\n },\n elementType: 'div',\n }),\n };\n};\n"],"names":["React","getNativeElementProps","slot","useDialogContext_unstable","Dismiss20Regular","DialogTrigger","useDialogTitleInternalStyles","useDialogTitle_unstable","props","ref","as","action","modalType","ctx","internalStyles","components","root","always","id","dialogTitleId","elementType","optional","renderByDefault","defaultProps","children","disableButtonEnhancement","button","type","className","aria-label"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,EAAEC,IAAI,QAAQ,4BAA4B;AAExE,SAASC,yBAAyB,QAAQ,+BAA+B;AACzE,SAASC,gBAAgB,QAAQ,wBAAwB;AACzD,SAASC,aAAa,QAAQ,iCAAiC;AAC/D,SAASC,4BAA4B,QAAQ,gCAAgC;AAE7E;;;;;;;;CAQC,GACD,OAAO,MAAMC,0BAA0B,CAACC,OAAyBC;IAC/D,MAAM,EAAEC,EAAE,EAAEC,MAAM,EAAE,GAAGH;IACvB,MAAMI,YAAYT,0BAA0BU,CAAAA,MAAOA,IAAID,SAAS;IAChE,MAAME,iBAAiBR;IAEvB,OAAO;QACLS,YAAY;YACVC,MAAM;YACNL,QAAQ;QACV;QACAK,MAAMd,KAAKe,MAAM,CACfhB,sBAAsBS,eAAAA,gBAAAA,KAAM,MAAM;YAChCD;YACAS,IAAIf,0BAA0BU,CAAAA,MAAOA,IAAIM,aAAa;YACtD,GAAGX,KAAK;QACV,IACA;YAAEY,aAAa;QAAK;QAEtBT,QAAQT,KAAKmB,QAAQ,CAACV,QAAQ;YAC5BW,iBAAiBV,cAAc;YAC/BW,cAAc;gBACZC,wBACE,oBAACnB;oBAAcoB,0BAAAA;oBAAyBd,QAAO;iCAC7C,oBAACe;oBACCC,MAAK;oBACLC,WAAWd,eAAeY,MAAM;oBAChC,iDAAiD;oBACjDG,cAAW;iCAEX,oBAACzB;YAIT;YACAgB,aAAa;QACf;IACF;AACF,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["DialogTrigger.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useDialogTrigger_unstable } from './useDialogTrigger';\nimport { renderDialogTrigger_unstable } from './renderDialogTrigger';\nimport type { DialogTriggerProps } from './DialogTrigger.types';\nimport type { FluentTriggerComponent } from '@fluentui/react-utilities';\n\n/**\n * A non-visual component that wraps its child\n * and configures them to be the trigger that will open or close a `Dialog`.\n * This component should only accept one child.\n *\n * This component sole purpose is to avoid opting out of the internal controlled open state of a `Dialog`\n * Besides being a trigger that opens/close a dialog through context this component doesn't do much,\n * making it basically unnecessary in cases where the trigger is outside of the `Dialog` component.\n */\nexport const DialogTrigger: React.FC<DialogTriggerProps> = props => {\n const state = useDialogTrigger_unstable(props);\n\n return renderDialogTrigger_unstable(state);\n};\n\nDialogTrigger.displayName = 'DialogTrigger';\n// type casting here is required to ensure internal type FluentTriggerComponent is not leaked\n(DialogTrigger as FluentTriggerComponent).isFluentTriggerComponent = true;\n"],"names":["React","useDialogTrigger_unstable","renderDialogTrigger_unstable","DialogTrigger","props","state","displayName","isFluentTriggerComponent"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,yBAAyB,QAAQ,qBAAqB;AAC/D,SAASC,4BAA4B,QAAQ,wBAAwB;AAIrE;;;;;;;;CAQC,GACD,OAAO,MAAMC,gBAA8CC,CAAAA,QAAS;IAClE,MAAMC,QAAQJ,0BAA0BG;IAExC,OAAOF,6BAA6BG;AACtC,EAAE;AAEFF,cAAcG,WAAW,GAAG;AAC5B,6FAA6F;AAC5FH,cAAyCI,wBAAwB,GAAG,IAAI"}
1
+ {"version":3,"sources":["DialogTrigger.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useDialogTrigger_unstable } from './useDialogTrigger';\nimport { renderDialogTrigger_unstable } from './renderDialogTrigger';\nimport type { DialogTriggerProps } from './DialogTrigger.types';\nimport type { FluentTriggerComponent } from '@fluentui/react-utilities';\n\n/**\n * A non-visual component that wraps its child\n * and configures them to be the trigger that will open or close a `Dialog`.\n * This component should only accept one child.\n *\n * This component sole purpose is to avoid opting out of the internal controlled open state of a `Dialog`\n * Besides being a trigger that opens/close a dialog through context this component doesn't do much,\n * making it basically unnecessary in cases where the trigger is outside of the `Dialog` component.\n */\nexport const DialogTrigger: React.FC<DialogTriggerProps> = props => {\n const state = useDialogTrigger_unstable(props);\n\n return renderDialogTrigger_unstable(state);\n};\n\nDialogTrigger.displayName = 'DialogTrigger';\n// type casting here is required to ensure internal type FluentTriggerComponent is not leaked\n(DialogTrigger as FluentTriggerComponent).isFluentTriggerComponent = true;\n"],"names":["React","useDialogTrigger_unstable","renderDialogTrigger_unstable","DialogTrigger","props","state","displayName","isFluentTriggerComponent"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,yBAAyB,QAAQ,qBAAqB;AAC/D,SAASC,4BAA4B,QAAQ,wBAAwB;AAIrE;;;;;;;;CAQC,GACD,OAAO,MAAMC,gBAA8CC,CAAAA;IACzD,MAAMC,QAAQJ,0BAA0BG;IAExC,OAAOF,6BAA6BG;AACtC,EAAE;AAEFF,cAAcG,WAAW,GAAG;AAC5B,6FAA6F;AAC5FH,cAAyCI,wBAAwB,GAAG"}
@@ -9,14 +9,15 @@ import { useModalAttributes } from '@fluentui/react-tabster';
9
9
  *
10
10
  * @param props - props from this instance of DialogTrigger
11
11
  */ export const useDialogTrigger_unstable = (props)=>{
12
+ var _child, _child1, _child2, _child3;
12
13
  const isInsideSurfaceDialog = useDialogSurfaceContext_unstable();
13
- const { children , disableButtonEnhancement =false , action =isInsideSurfaceDialog ? 'close' : 'open' } = props;
14
+ const { children, disableButtonEnhancement = false, action = isInsideSurfaceDialog ? 'close' : 'open' } = props;
14
15
  const child = getTriggerChild(children);
15
16
  const requestOpenChange = useDialogContext_unstable((ctx)=>ctx.requestOpenChange);
16
- const { triggerAttributes } = useModalAttributes();
17
+ const { triggerAttributes } = useModalAttributes();
17
18
  const handleClick = useEventCallback((event)=>{
18
- var _child_props, _child_props_onClick;
19
- (_child_props_onClick = _child_props = child === null || child === void 0 ? void 0 : child.props.onClick) === null || _child_props_onClick === void 0 ? void 0 : _child_props_onClick.call(_child_props, event);
19
+ var _child_props_onClick, _child, _child_props;
20
+ (_child = child) === null || _child === void 0 ? void 0 : (_child_props_onClick = (_child_props = _child.props).onClick) === null || _child_props_onClick === void 0 ? void 0 : _child_props_onClick.call(_child_props, event);
20
21
  if (!event.isDefaultPrevented()) {
21
22
  requestOpenChange({
22
23
  event,
@@ -26,12 +27,12 @@ import { useModalAttributes } from '@fluentui/react-tabster';
26
27
  }
27
28
  });
28
29
  const triggerChildProps = {
29
- ...child === null || child === void 0 ? void 0 : child.props,
30
- ref: child === null || child === void 0 ? void 0 : child.ref,
30
+ ...(_child = child) === null || _child === void 0 ? void 0 : _child.props,
31
+ ref: (_child1 = child) === null || _child1 === void 0 ? void 0 : _child1.ref,
31
32
  onClick: handleClick,
32
33
  ...triggerAttributes
33
34
  };
34
- const ariaButtonTriggerChildProps = useARIAButtonProps((child === null || child === void 0 ? void 0 : child.type) === 'button' || (child === null || child === void 0 ? void 0 : child.type) === 'a' ? child.type : 'div', {
35
+ const ariaButtonTriggerChildProps = useARIAButtonProps(((_child2 = child) === null || _child2 === void 0 ? void 0 : _child2.type) === 'button' || ((_child3 = child) === null || _child3 === void 0 ? void 0 : _child3.type) === 'a' ? child.type : 'div', {
35
36
  ...triggerChildProps,
36
37
  type: 'button'
37
38
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["useDialogTrigger.ts"],"sourcesContent":["import * as React from 'react';\nimport { applyTriggerPropsToChildren, getTriggerChild, useEventCallback } from '@fluentui/react-utilities';\nimport type { DialogTriggerProps, DialogTriggerState } from './DialogTrigger.types';\nimport { useDialogContext_unstable, useDialogSurfaceContext_unstable } from '../../contexts';\nimport { useARIAButtonProps } from '@fluentui/react-aria';\nimport { useModalAttributes } from '@fluentui/react-tabster';\n\n/**\n * Create the state required to render DialogTrigger.\n * Clones the only child component and adds necessary event handling behaviours to open a popup Dialog\n *\n * @param props - props from this instance of DialogTrigger\n */\nexport const useDialogTrigger_unstable = (props: DialogTriggerProps): DialogTriggerState => {\n const isInsideSurfaceDialog = useDialogSurfaceContext_unstable();\n\n const { children, disableButtonEnhancement = false, action = isInsideSurfaceDialog ? 'close' : 'open' } = props;\n\n const child = getTriggerChild(children);\n\n const requestOpenChange = useDialogContext_unstable(ctx => ctx.requestOpenChange);\n const { triggerAttributes } = useModalAttributes();\n\n const handleClick = useEventCallback(\n (event: React.MouseEvent<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>) => {\n child?.props.onClick?.(event);\n if (!event.isDefaultPrevented()) {\n requestOpenChange({\n event,\n type: 'triggerClick',\n open: action === 'open',\n });\n }\n },\n );\n\n const triggerChildProps = {\n ...child?.props,\n ref: child?.ref,\n onClick: handleClick,\n ...triggerAttributes,\n } as const;\n\n const ariaButtonTriggerChildProps = useARIAButtonProps(\n child?.type === 'button' || child?.type === 'a' ? child.type : 'div',\n {\n ...triggerChildProps,\n type: 'button',\n },\n );\n\n return {\n children: applyTriggerPropsToChildren(\n children,\n disableButtonEnhancement ? triggerChildProps : ariaButtonTriggerChildProps,\n ),\n };\n};\n"],"names":["React","applyTriggerPropsToChildren","getTriggerChild","useEventCallback","useDialogContext_unstable","useDialogSurfaceContext_unstable","useARIAButtonProps","useModalAttributes","useDialogTrigger_unstable","props","isInsideSurfaceDialog","children","disableButtonEnhancement","action","child","requestOpenChange","ctx","triggerAttributes","handleClick","event","onClick","isDefaultPrevented","type","open","triggerChildProps","ref","ariaButtonTriggerChildProps"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,2BAA2B,EAAEC,eAAe,EAAEC,gBAAgB,QAAQ,4BAA4B;AAE3G,SAASC,yBAAyB,EAAEC,gCAAgC,QAAQ,iBAAiB;AAC7F,SAASC,kBAAkB,QAAQ,uBAAuB;AAC1D,SAASC,kBAAkB,QAAQ,0BAA0B;AAE7D;;;;;CAKC,GACD,OAAO,MAAMC,4BAA4B,CAACC,QAAkD;IAC1F,MAAMC,wBAAwBL;IAE9B,MAAM,EAAEM,SAAQ,EAAEC,0BAA2B,KAAK,CAAA,EAAEC,QAASH,wBAAwB,UAAU,MAAM,CAAA,EAAE,GAAGD;IAE1G,MAAMK,QAAQZ,gBAAgBS;IAE9B,MAAMI,oBAAoBX,0BAA0BY,CAAAA,MAAOA,IAAID,iBAAiB;IAChF,MAAM,EAAEE,kBAAiB,EAAE,GAAGV;IAE9B,MAAMW,cAAcf,iBAClB,CAACgB,QAAoF;YACnFL,cAAAA;QAAAA,CAAAA,uBAAAA,eAAAA,kBAAAA,mBAAAA,KAAAA,IAAAA,MAAOL,KAAK,CAACW,OAAO,cAApBN,kCAAAA,KAAAA,IAAAA,qBAAAA,KAAAA,cAAuBK;QACvB,IAAI,CAACA,MAAME,kBAAkB,IAAI;YAC/BN,kBAAkB;gBAChBI;gBACAG,MAAM;gBACNC,MAAMV,WAAW;YACnB;QACF,CAAC;IACH;IAGF,MAAMW,oBAAoB;QACxB,GAAGV,kBAAAA,mBAAAA,KAAAA,IAAAA,MAAOL,KAAK;QACfgB,KAAKX,kBAAAA,mBAAAA,KAAAA,IAAAA,MAAOW,GAAG;QACfL,SAASF;QACT,GAAGD,iBAAiB;IACtB;IAEA,MAAMS,8BAA8BpB,mBAClCQ,CAAAA,kBAAAA,mBAAAA,KAAAA,IAAAA,MAAOQ,IAAI,AAAD,MAAM,YAAYR,CAAAA,kBAAAA,mBAAAA,KAAAA,IAAAA,MAAOQ,IAAI,AAAD,MAAM,MAAMR,MAAMQ,IAAI,GAAG,KAAK,EACpE;QACE,GAAGE,iBAAiB;QACpBF,MAAM;IACR;IAGF,OAAO;QACLX,UAAUV,4BACRU,UACAC,2BAA2BY,oBAAoBE,2BAA2B;IAE9E;AACF,EAAE"}
1
+ {"version":3,"sources":["useDialogTrigger.ts"],"sourcesContent":["import * as React from 'react';\nimport { applyTriggerPropsToChildren, getTriggerChild, useEventCallback } from '@fluentui/react-utilities';\nimport type { DialogTriggerProps, DialogTriggerState } from './DialogTrigger.types';\nimport { useDialogContext_unstable, useDialogSurfaceContext_unstable } from '../../contexts';\nimport { useARIAButtonProps } from '@fluentui/react-aria';\nimport { useModalAttributes } from '@fluentui/react-tabster';\n\n/**\n * Create the state required to render DialogTrigger.\n * Clones the only child component and adds necessary event handling behaviours to open a popup Dialog\n *\n * @param props - props from this instance of DialogTrigger\n */\nexport const useDialogTrigger_unstable = (props: DialogTriggerProps): DialogTriggerState => {\n const isInsideSurfaceDialog = useDialogSurfaceContext_unstable();\n\n const { children, disableButtonEnhancement = false, action = isInsideSurfaceDialog ? 'close' : 'open' } = props;\n\n const child = getTriggerChild(children);\n\n const requestOpenChange = useDialogContext_unstable(ctx => ctx.requestOpenChange);\n const { triggerAttributes } = useModalAttributes();\n\n const handleClick = useEventCallback(\n (event: React.MouseEvent<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>) => {\n child?.props.onClick?.(event);\n if (!event.isDefaultPrevented()) {\n requestOpenChange({\n event,\n type: 'triggerClick',\n open: action === 'open',\n });\n }\n },\n );\n\n const triggerChildProps = {\n ...child?.props,\n ref: child?.ref,\n onClick: handleClick,\n ...triggerAttributes,\n } as const;\n\n const ariaButtonTriggerChildProps = useARIAButtonProps(\n child?.type === 'button' || child?.type === 'a' ? child.type : 'div',\n {\n ...triggerChildProps,\n type: 'button',\n },\n );\n\n return {\n children: applyTriggerPropsToChildren(\n children,\n disableButtonEnhancement ? triggerChildProps : ariaButtonTriggerChildProps,\n ),\n };\n};\n"],"names":["React","applyTriggerPropsToChildren","getTriggerChild","useEventCallback","useDialogContext_unstable","useDialogSurfaceContext_unstable","useARIAButtonProps","useModalAttributes","useDialogTrigger_unstable","props","child","isInsideSurfaceDialog","children","disableButtonEnhancement","action","requestOpenChange","ctx","triggerAttributes","handleClick","event","onClick","isDefaultPrevented","type","open","triggerChildProps","ref","ariaButtonTriggerChildProps"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,2BAA2B,EAAEC,eAAe,EAAEC,gBAAgB,QAAQ,4BAA4B;AAE3G,SAASC,yBAAyB,EAAEC,gCAAgC,QAAQ,iBAAiB;AAC7F,SAASC,kBAAkB,QAAQ,uBAAuB;AAC1D,SAASC,kBAAkB,QAAQ,0BAA0B;AAE7D;;;;;CAKC,GACD,OAAO,MAAMC,4BAA4B,CAACC;QAwBnCC,QACEA,SAMLA,SAA4BA;IA9B9B,MAAMC,wBAAwBN;IAE9B,MAAM,EAAEO,QAAQ,EAAEC,2BAA2B,KAAK,EAAEC,SAASH,wBAAwB,UAAU,MAAM,EAAE,GAAGF;IAE1G,MAAMC,QAAQR,gBAAgBU;IAE9B,MAAMG,oBAAoBX,0BAA0BY,CAAAA,MAAOA,IAAID,iBAAiB;IAChF,MAAM,EAAEE,iBAAiB,EAAE,GAAGV;IAE9B,MAAMW,cAAcf,iBAClB,CAACgB;YACCT,sBAAAA,QAAAA;SAAAA,SAAAA,mBAAAA,8BAAAA,uBAAAA,CAAAA,eAAAA,OAAOD,KAAK,EAACW,OAAO,cAApBV,2CAAAA,0BAAAA,cAAuBS;QACvB,IAAI,CAACA,MAAME,kBAAkB,IAAI;YAC/BN,kBAAkB;gBAChBI;gBACAG,MAAM;gBACNC,MAAMT,WAAW;YACnB;QACF;IACF;IAGF,MAAMU,oBAAoB;YACrBd,SAAAA,mBAAAA,6BAAAA,OAAOD,KAAK,AAAf;QACAgB,GAAG,GAAEf,UAAAA,mBAAAA,8BAAAA,QAAOe,GAAG;QACfL,SAASF;QACT,GAAGD,iBAAiB;IACtB;IAEA,MAAMS,8BAA8BpB,mBAClCI,EAAAA,UAAAA,mBAAAA,8BAAAA,QAAOY,IAAI,MAAK,YAAYZ,EAAAA,UAAAA,mBAAAA,8BAAAA,QAAOY,IAAI,MAAK,MAAMZ,MAAMY,IAAI,GAAG,OAC/D;QACE,GAAGE,iBAAiB;QACpBF,MAAM;IACR;IAGF,OAAO;QACLV,UAAUX,4BACRW,UACAC,2BAA2BW,oBAAoBE;IAEnD;AACF,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["dialogContext.ts"],"sourcesContent":["import * as React from 'react';\nimport { createContext, ContextSelector, useContextSelector } from '@fluentui/react-context-selector';\nimport { DialogSurfaceElement } from '../DialogSurface';\nimport type { Context } from '@fluentui/react-context-selector';\nimport type { DialogModalType, DialogOpenChangeData } from '../Dialog';\nimport { useModalAttributes } from '@fluentui/react-tabster';\n\nexport type DialogContextValue = {\n open: boolean;\n inertTrapFocus: boolean;\n dialogTitleId?: string;\n isNestedDialog: boolean;\n dialogRef: React.Ref<DialogSurfaceElement>;\n modalType: DialogModalType;\n /**\n * Requests dialog main component to update it's internal open state\n */\n requestOpenChange: (data: DialogOpenChangeData) => void;\n} & Partial<ReturnType<typeof useModalAttributes>>;\n\nconst defaultContextValue: DialogContextValue = {\n open: false,\n inertTrapFocus: false,\n modalType: 'modal',\n isNestedDialog: false,\n dialogRef: { current: null },\n requestOpenChange() {\n /* noop */\n },\n};\n\n// Contexts should default to undefined\nexport const DialogContext: Context<DialogContextValue | undefined> = createContext<DialogContextValue | undefined>(\n undefined,\n);\n\nexport const DialogProvider = DialogContext.Provider;\nexport const useDialogContext_unstable = <T>(selector: ContextSelector<DialogContextValue, T>): T =>\n useContextSelector(DialogContext, (ctx = defaultContextValue) => selector(ctx));\n"],"names":["React","createContext","useContextSelector","defaultContextValue","open","inertTrapFocus","modalType","isNestedDialog","dialogRef","current","requestOpenChange","DialogContext","undefined","DialogProvider","Provider","useDialogContext_unstable","selector","ctx"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,aAAa,EAAmBC,kBAAkB,QAAQ,mCAAmC;AAmBtG,MAAMC,sBAA0C;IAC9CC,MAAM,KAAK;IACXC,gBAAgB,KAAK;IACrBC,WAAW;IACXC,gBAAgB,KAAK;IACrBC,WAAW;QAAEC,SAAS,IAAI;IAAC;IAC3BC,qBAAoB;IAClB,QAAQ,GACV;AACF;AAEA,uCAAuC;AACvC,OAAO,MAAMC,gBAAyDV,cACpEW,WACA;AAEF,OAAO,MAAMC,iBAAiBF,cAAcG,QAAQ,CAAC;AACrD,OAAO,MAAMC,4BAA4B,CAAIC,WAC3Cd,mBAAmBS,eAAe,CAACM,MAAMd,mBAAmB,GAAKa,SAASC,MAAM"}
1
+ {"version":3,"sources":["dialogContext.ts"],"sourcesContent":["import * as React from 'react';\nimport { createContext, ContextSelector, useContextSelector } from '@fluentui/react-context-selector';\nimport { DialogSurfaceElement } from '../DialogSurface';\nimport type { Context } from '@fluentui/react-context-selector';\nimport type { DialogModalType, DialogOpenChangeData } from '../Dialog';\nimport { useModalAttributes } from '@fluentui/react-tabster';\n\nexport type DialogContextValue = {\n open: boolean;\n inertTrapFocus: boolean;\n dialogTitleId?: string;\n isNestedDialog: boolean;\n dialogRef: React.Ref<DialogSurfaceElement>;\n modalType: DialogModalType;\n /**\n * Requests dialog main component to update it's internal open state\n */\n requestOpenChange: (data: DialogOpenChangeData) => void;\n} & Partial<ReturnType<typeof useModalAttributes>>;\n\nconst defaultContextValue: DialogContextValue = {\n open: false,\n inertTrapFocus: false,\n modalType: 'modal',\n isNestedDialog: false,\n dialogRef: { current: null },\n requestOpenChange() {\n /* noop */\n },\n};\n\n// Contexts should default to undefined\nexport const DialogContext: Context<DialogContextValue | undefined> = createContext<DialogContextValue | undefined>(\n undefined,\n);\n\nexport const DialogProvider = DialogContext.Provider;\nexport const useDialogContext_unstable = <T>(selector: ContextSelector<DialogContextValue, T>): T =>\n useContextSelector(DialogContext, (ctx = defaultContextValue) => selector(ctx));\n"],"names":["React","createContext","useContextSelector","defaultContextValue","open","inertTrapFocus","modalType","isNestedDialog","dialogRef","current","requestOpenChange","DialogContext","undefined","DialogProvider","Provider","useDialogContext_unstable","selector","ctx"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,aAAa,EAAmBC,kBAAkB,QAAQ,mCAAmC;AAmBtG,MAAMC,sBAA0C;IAC9CC,MAAM;IACNC,gBAAgB;IAChBC,WAAW;IACXC,gBAAgB;IAChBC,WAAW;QAAEC,SAAS;IAAK;IAC3BC;IACE,QAAQ,GACV;AACF;AAEA,uCAAuC;AACvC,OAAO,MAAMC,gBAAyDV,cACpEW,WACA;AAEF,OAAO,MAAMC,iBAAiBF,cAAcG,QAAQ,CAAC;AACrD,OAAO,MAAMC,4BAA4B,CAAIC,WAC3Cd,mBAAmBS,eAAe,CAACM,MAAMd,mBAAmB,GAAKa,SAASC,MAAM"}
@@ -1 +1 @@
1
- {"version":3,"sources":["dialogSurfaceContext.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\n\nexport type DialogSurfaceContextValue = boolean;\n\nconst defaultContextValue: DialogSurfaceContextValue = false;\n\nexport const DialogSurfaceContext = createContext<DialogSurfaceContextValue | undefined>(undefined);\n\nexport const DialogSurfaceProvider = DialogSurfaceContext.Provider;\n\nexport const useDialogSurfaceContext_unstable = () => useContext(DialogSurfaceContext) ?? defaultContextValue;\n"],"names":["createContext","useContext","defaultContextValue","DialogSurfaceContext","undefined","DialogSurfaceProvider","Provider","useDialogSurfaceContext_unstable"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,QAAQ;AAIlD,MAAMC,sBAAiD,KAAK;AAE5D,OAAO,MAAMC,uBAAuBH,cAAqDI,WAAW;AAEpG,OAAO,MAAMC,wBAAwBF,qBAAqBG,QAAQ,CAAC;IAEbL;AAAtD,OAAO,MAAMM,mCAAmC,IAAMN,CAAAA,cAAAA,WAAWE,mCAAXF,yBAAAA,cAAoCC,mBAAmB,CAAC"}
1
+ {"version":3,"sources":["dialogSurfaceContext.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\n\nexport type DialogSurfaceContextValue = boolean;\n\nconst defaultContextValue: DialogSurfaceContextValue = false;\n\nexport const DialogSurfaceContext = createContext<DialogSurfaceContextValue | undefined>(undefined);\n\nexport const DialogSurfaceProvider = DialogSurfaceContext.Provider;\n\nexport const useDialogSurfaceContext_unstable = () => useContext(DialogSurfaceContext) ?? defaultContextValue;\n"],"names":["createContext","useContext","defaultContextValue","DialogSurfaceContext","undefined","DialogSurfaceProvider","Provider","useDialogSurfaceContext_unstable"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,QAAQ;AAIlD,MAAMC,sBAAiD;AAEvD,OAAO,MAAMC,uBAAuBH,cAAqDI,WAAW;AAEpG,OAAO,MAAMC,wBAAwBF,qBAAqBG,QAAQ,CAAC;IAEbL;AAAtD,OAAO,MAAMM,mCAAmC,IAAMN,CAAAA,cAAAA,WAAWE,mCAAXF,yBAAAA,cAAoCC,oBAAoB"}
@@ -4,7 +4,7 @@ const disableScrollElementProp = '__fluentDisableScrollElement';
4
4
  /**
5
5
  * hook that disables body scrolling through `overflow: hidden` CSS property
6
6
  */ export function useDisableBodyScroll() {
7
- const { targetDocument } = useFluent_unstable();
7
+ const { targetDocument } = useFluent_unstable();
8
8
  return useCallback(()=>{
9
9
  if (targetDocument) {
10
10
  return disableScroll(targetDocument.body);
@@ -19,7 +19,7 @@ const disableScrollElementProp = '__fluentDisableScrollElement';
19
19
  * @returns a method for enabling scrolling again
20
20
  */ export function disableScroll(target) {
21
21
  var _target_ownerDocument_defaultView;
22
- const { clientWidth } = target.ownerDocument.documentElement;
22
+ const { clientWidth } = target.ownerDocument.documentElement;
23
23
  var _target_ownerDocument_defaultView_innerWidth;
24
24
  const innerWidth = (_target_ownerDocument_defaultView_innerWidth = (_target_ownerDocument_defaultView = target.ownerDocument.defaultView) === null || _target_ownerDocument_defaultView === void 0 ? void 0 : _target_ownerDocument_defaultView.innerWidth) !== null && _target_ownerDocument_defaultView_innerWidth !== void 0 ? _target_ownerDocument_defaultView_innerWidth : 0;
25
25
  assertIsDisableScrollElement(target);
@@ -1 +1 @@
1
- {"version":3,"sources":["useDisableBodyScroll.ts"],"sourcesContent":["import { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport { useCallback } from 'react';\n\nconst disableScrollElementProp = '__fluentDisableScrollElement' as const;\n\ntype FluentDisableScrollElement = HTMLElement & {\n [disableScrollElementProp]: {\n count: number;\n previousOverflowStyle: string;\n previousPaddingRightStyle: string;\n };\n};\n\n/**\n * hook that disables body scrolling through `overflow: hidden` CSS property\n */\nexport function useDisableBodyScroll() {\n const { targetDocument } = useFluent_unstable();\n return useCallback(() => {\n if (targetDocument) {\n return disableScroll(targetDocument.body);\n }\n }, [targetDocument]);\n}\n\n/**\n * disables scrolling from a given element through `overflow: hidden` CSS property\n * @param target - element to disable scrolling from\n * @returns a method for enabling scrolling again\n */\nexport function disableScroll(target: HTMLElement) {\n const { clientWidth } = target.ownerDocument.documentElement;\n const innerWidth = target.ownerDocument.defaultView?.innerWidth ?? 0;\n assertIsDisableScrollElement(target);\n if (target[disableScrollElementProp].count === 0) {\n target.style.overflow = 'hidden';\n target.style.paddingRight = `${innerWidth - clientWidth}px`;\n }\n target[disableScrollElementProp].count++;\n return () => {\n target[disableScrollElementProp].count--;\n if (target[disableScrollElementProp].count === 0) {\n target.style.overflow = target[disableScrollElementProp].previousOverflowStyle;\n target.style.paddingRight = target[disableScrollElementProp].previousPaddingRightStyle;\n }\n };\n}\n\nfunction assertIsDisableScrollElement(element: HTMLElement): asserts element is FluentDisableScrollElement {\n (element as FluentDisableScrollElement)[disableScrollElementProp] ??= {\n count: 0,\n previousOverflowStyle: element.style.overflow,\n previousPaddingRightStyle: element.style.paddingRight,\n };\n}\n"],"names":["useFluent_unstable","useCallback","disableScrollElementProp","useDisableBodyScroll","targetDocument","disableScroll","body","target","clientWidth","ownerDocument","documentElement","innerWidth","defaultView","assertIsDisableScrollElement","count","style","overflow","paddingRight","previousOverflowStyle","previousPaddingRightStyle","element"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,kCAAkC;AACrE,SAASC,WAAW,QAAQ,QAAQ;AAEpC,MAAMC,2BAA2B;AAUjC;;CAEC,GACD,OAAO,SAASC,uBAAuB;IACrC,MAAM,EAAEC,eAAc,EAAE,GAAGJ;IAC3B,OAAOC,YAAY,IAAM;QACvB,IAAIG,gBAAgB;YAClB,OAAOC,cAAcD,eAAeE,IAAI;QAC1C,CAAC;IACH,GAAG;QAACF;KAAe;AACrB,CAAC;AAED;;;;CAIC,GACD,OAAO,SAASC,cAAcE,MAAmB,EAAE;QAE9BA;IADnB,MAAM,EAAEC,YAAW,EAAE,GAAGD,OAAOE,aAAa,CAACC,eAAe;QACzCH;IAAnB,MAAMI,aAAaJ,CAAAA,+CAAAA,CAAAA,oCAAAA,OAAOE,aAAa,CAACG,WAAW,cAAhCL,+CAAAA,KAAAA,IAAAA,kCAAkCI,UAAU,cAA5CJ,0DAAAA,+CAAgD,CAAC;IACpEM,6BAA6BN;IAC7B,IAAIA,MAAM,CAACL,yBAAyB,CAACY,KAAK,KAAK,GAAG;QAChDP,OAAOQ,KAAK,CAACC,QAAQ,GAAG;QACxBT,OAAOQ,KAAK,CAACE,YAAY,GAAG,CAAC,EAAEN,aAAaH,YAAY,EAAE,CAAC;IAC7D,CAAC;IACDD,MAAM,CAACL,yBAAyB,CAACY,KAAK;IACtC,OAAO,IAAM;QACXP,MAAM,CAACL,yBAAyB,CAACY,KAAK;QACtC,IAAIP,MAAM,CAACL,yBAAyB,CAACY,KAAK,KAAK,GAAG;YAChDP,OAAOQ,KAAK,CAACC,QAAQ,GAAGT,MAAM,CAACL,yBAAyB,CAACgB,qBAAqB;YAC9EX,OAAOQ,KAAK,CAACE,YAAY,GAAGV,MAAM,CAACL,yBAAyB,CAACiB,yBAAyB;QACxF,CAAC;IACH;AACF,CAAC;AAED,SAASN,6BAA6BO,OAAoB,EAAiD;QACxGA,UAAuClB;;IAAxC,MAACkB,WAAAA,QAAsC,CAAClB,4BAAAA,yBAAyB,iCAAhEkB,QAAsC,CAAClB,0BAAyB,GAAK;QACpEY,OAAO;QACPI,uBAAuBE,QAAQL,KAAK,CAACC,QAAQ;QAC7CG,2BAA2BC,QAAQL,KAAK,CAACE,YAAY;IACvD,CAAC;AACH"}
1
+ {"version":3,"sources":["useDisableBodyScroll.ts"],"sourcesContent":["import { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport { useCallback } from 'react';\n\nconst disableScrollElementProp = '__fluentDisableScrollElement' as const;\n\ntype FluentDisableScrollElement = HTMLElement & {\n [disableScrollElementProp]: {\n count: number;\n previousOverflowStyle: string;\n previousPaddingRightStyle: string;\n };\n};\n\n/**\n * hook that disables body scrolling through `overflow: hidden` CSS property\n */\nexport function useDisableBodyScroll() {\n const { targetDocument } = useFluent_unstable();\n return useCallback(() => {\n if (targetDocument) {\n return disableScroll(targetDocument.body);\n }\n }, [targetDocument]);\n}\n\n/**\n * disables scrolling from a given element through `overflow: hidden` CSS property\n * @param target - element to disable scrolling from\n * @returns a method for enabling scrolling again\n */\nexport function disableScroll(target: HTMLElement) {\n const { clientWidth } = target.ownerDocument.documentElement;\n const innerWidth = target.ownerDocument.defaultView?.innerWidth ?? 0;\n assertIsDisableScrollElement(target);\n if (target[disableScrollElementProp].count === 0) {\n target.style.overflow = 'hidden';\n target.style.paddingRight = `${innerWidth - clientWidth}px`;\n }\n target[disableScrollElementProp].count++;\n return () => {\n target[disableScrollElementProp].count--;\n if (target[disableScrollElementProp].count === 0) {\n target.style.overflow = target[disableScrollElementProp].previousOverflowStyle;\n target.style.paddingRight = target[disableScrollElementProp].previousPaddingRightStyle;\n }\n };\n}\n\nfunction assertIsDisableScrollElement(element: HTMLElement): asserts element is FluentDisableScrollElement {\n (element as FluentDisableScrollElement)[disableScrollElementProp] ??= {\n count: 0,\n previousOverflowStyle: element.style.overflow,\n previousPaddingRightStyle: element.style.paddingRight,\n };\n}\n"],"names":["useFluent_unstable","useCallback","disableScrollElementProp","useDisableBodyScroll","targetDocument","disableScroll","body","target","clientWidth","ownerDocument","documentElement","innerWidth","defaultView","assertIsDisableScrollElement","count","style","overflow","paddingRight","previousOverflowStyle","previousPaddingRightStyle","element"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,kCAAkC;AACrE,SAASC,WAAW,QAAQ,QAAQ;AAEpC,MAAMC,2BAA2B;AAUjC;;CAEC,GACD,OAAO,SAASC;IACd,MAAM,EAAEC,cAAc,EAAE,GAAGJ;IAC3B,OAAOC,YAAY;QACjB,IAAIG,gBAAgB;YAClB,OAAOC,cAAcD,eAAeE,IAAI;QAC1C;IACF,GAAG;QAACF;KAAe;AACrB;AAEA;;;;CAIC,GACD,OAAO,SAASC,cAAcE,MAAmB;QAE5BA;IADnB,MAAM,EAAEC,WAAW,EAAE,GAAGD,OAAOE,aAAa,CAACC,eAAe;QACzCH;IAAnB,MAAMI,aAAaJ,CAAAA,gDAAAA,oCAAAA,OAAOE,aAAa,CAACG,WAAW,cAAhCL,wDAAAA,kCAAkCI,UAAU,cAA5CJ,0DAAAA,+CAAgD;IACnEM,6BAA6BN;IAC7B,IAAIA,MAAM,CAACL,yBAAyB,CAACY,KAAK,KAAK,GAAG;QAChDP,OAAOQ,KAAK,CAACC,QAAQ,GAAG;QACxBT,OAAOQ,KAAK,CAACE,YAAY,GAAG,CAAC,EAAEN,aAAaH,YAAY,EAAE,CAAC;IAC7D;IACAD,MAAM,CAACL,yBAAyB,CAACY,KAAK;IACtC,OAAO;QACLP,MAAM,CAACL,yBAAyB,CAACY,KAAK;QACtC,IAAIP,MAAM,CAACL,yBAAyB,CAACY,KAAK,KAAK,GAAG;YAChDP,OAAOQ,KAAK,CAACC,QAAQ,GAAGT,MAAM,CAACL,yBAAyB,CAACgB,qBAAqB;YAC9EX,OAAOQ,KAAK,CAACE,YAAY,GAAGV,MAAM,CAACL,yBAAyB,CAACiB,yBAAyB;QACxF;IACF;AACF;AAEA,SAASN,6BAA6BO,OAAoB;QACvDA,UAAuClB;;IAAxC,MAACkB,WAAAA,QAAsC,CAAClB,4BAAAA,yBAAyB,iCAAhEkB,QAAsC,CAAClB,0BAAyB,GAAK;QACpEY,OAAO;QACPI,uBAAuBE,QAAQL,KAAK,CAACC,QAAQ;QAC7CG,2BAA2BC,QAAQL,KAAK,CAACE,YAAY;IACvD;AACF"}
@@ -4,8 +4,8 @@ import { useFluent_unstable } from '@fluentui/react-shared-contexts';
4
4
  /**
5
5
  * Focus first element on content when dialog is opened,
6
6
  */ export function useFocusFirstElement(open, modalType) {
7
- const { findFirstFocusable } = useFocusFinders();
8
- const { targetDocument } = useFluent_unstable();
7
+ const { findFirstFocusable } = useFocusFinders();
8
+ const { targetDocument } = useFluent_unstable();
9
9
  const dialogRef = React.useRef(null);
10
10
  React.useEffect(()=>{
11
11
  if (!open) {
@@ -19,10 +19,9 @@ import { useFluent_unstable } from '@fluentui/react-shared-contexts';
19
19
  (_dialogRef_current = dialogRef.current) === null || _dialogRef_current === void 0 ? void 0 : _dialogRef_current.focus(); // https://github.com/microsoft/fluentui/issues/25150
20
20
  if (process.env.NODE_ENV !== 'production') {
21
21
  // eslint-disable-next-line no-console
22
- console.warn([
23
- '@fluentui/react-dialog: a Dialog should have at least one focusable element inside DialogSurface.',
24
- 'Please add at least a close button either on `DialogTitle` action slot or inside `DialogActions`'
25
- ].join('\n'));
22
+ console.warn(`@fluentui/react-dialog [useFocusFirstElement]:
23
+ A Dialog should have at least one focusable element inside DialogSurface.
24
+ Please add at least a close button either on \`DialogTitle\` action slot or inside \`DialogActions\``);
26
25
  }
27
26
  }
28
27
  }, [
@@ -1 +1 @@
1
- {"version":3,"sources":["useFocusFirstElement.ts"],"sourcesContent":["import * as React from 'react';\nimport { useFocusFinders } from '@fluentui/react-tabster';\nimport { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport type { DialogSurfaceElement } from '../DialogSurface';\nimport type { DialogModalType } from '../Dialog';\n\n/**\n * Focus first element on content when dialog is opened,\n */\nexport function useFocusFirstElement(open: boolean, modalType: DialogModalType) {\n const { findFirstFocusable } = useFocusFinders();\n const { targetDocument } = useFluent_unstable();\n const dialogRef = React.useRef<DialogSurfaceElement>(null);\n\n React.useEffect(() => {\n if (!open) {\n return;\n }\n const element = dialogRef.current && findFirstFocusable(dialogRef.current);\n if (element) {\n element.focus();\n } else {\n dialogRef.current?.focus(); // https://github.com/microsoft/fluentui/issues/25150\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.warn(\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"],"names":["React","useFocusFinders","useFluent_unstable","useFocusFirstElement","open","modalType","findFirstFocusable","targetDocument","dialogRef","useRef","useEffect","element","current","focus","process","env","NODE_ENV","console","warn","join"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,eAAe,QAAQ,0BAA0B;AAC1D,SAASC,kBAAkB,QAAQ,kCAAkC;AAIrE;;CAEC,GACD,OAAO,SAASC,qBAAqBC,IAAa,EAAEC,SAA0B,EAAE;IAC9E,MAAM,EAAEC,mBAAkB,EAAE,GAAGL;IAC/B,MAAM,EAAEM,eAAc,EAAE,GAAGL;IAC3B,MAAMM,YAAYR,MAAMS,MAAM,CAAuB,IAAI;IAEzDT,MAAMU,SAAS,CAAC,IAAM;QACpB,IAAI,CAACN,MAAM;YACT;QACF,CAAC;QACD,MAAMO,UAAUH,UAAUI,OAAO,IAAIN,mBAAmBE,UAAUI,OAAO;QACzE,IAAID,SAAS;YACXA,QAAQE,KAAK;QACf,OAAO;gBACLL;YAAAA,CAAAA,qBAAAA,UAAUI,OAAO,cAAjBJ,gCAAAA,KAAAA,IAAAA,mBAAmBK,SAAS,qDAAqD;YACjF,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;gBACzC,sCAAsC;gBACtCC,QAAQC,IAAI,CACV;oBACE;oBACA;iBACD,CAACC,IAAI,CAAC;YAEX,CAAC;QACH,CAAC;IACH,GAAG;QAACb;QAAoBF;QAAMC;QAAWE;KAAe;IAExD,OAAOC;AACT,CAAC"}
1
+ {"version":3,"sources":["useFocusFirstElement.ts"],"sourcesContent":["import * as React from 'react';\nimport { useFocusFinders } from '@fluentui/react-tabster';\nimport { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport type { DialogSurfaceElement } from '../DialogSurface';\nimport type { DialogModalType } from '../Dialog';\n\n/**\n * Focus first element on content when dialog is opened,\n */\nexport function useFocusFirstElement(open: boolean, modalType: DialogModalType) {\n const { findFirstFocusable } = useFocusFinders();\n const { targetDocument } = useFluent_unstable();\n const dialogRef = React.useRef<DialogSurfaceElement>(null);\n\n React.useEffect(() => {\n if (!open) {\n return;\n }\n const element = dialogRef.current && findFirstFocusable(dialogRef.current);\n if (element) {\n element.focus();\n } else {\n dialogRef.current?.focus(); // https://github.com/microsoft/fluentui/issues/25150\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.warn(/** #__DE-INDENT__ */ `\n @fluentui/react-dialog [useFocusFirstElement]:\n A Dialog should have at least one focusable element inside DialogSurface.\n Please add at least a close button either on \\`DialogTitle\\` action slot or inside \\`DialogActions\\`\n `);\n }\n }\n }, [findFirstFocusable, open, modalType, targetDocument]);\n\n return dialogRef;\n}\n"],"names":["React","useFocusFinders","useFluent_unstable","useFocusFirstElement","open","modalType","findFirstFocusable","targetDocument","dialogRef","useRef","useEffect","element","current","focus","process","env","NODE_ENV","console","warn"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,eAAe,QAAQ,0BAA0B;AAC1D,SAASC,kBAAkB,QAAQ,kCAAkC;AAIrE;;CAEC,GACD,OAAO,SAASC,qBAAqBC,IAAa,EAAEC,SAA0B;IAC5E,MAAM,EAAEC,kBAAkB,EAAE,GAAGL;IAC/B,MAAM,EAAEM,cAAc,EAAE,GAAGL;IAC3B,MAAMM,YAAYR,MAAMS,MAAM,CAAuB;IAErDT,MAAMU,SAAS,CAAC;QACd,IAAI,CAACN,MAAM;YACT;QACF;QACA,MAAMO,UAAUH,UAAUI,OAAO,IAAIN,mBAAmBE,UAAUI,OAAO;QACzE,IAAID,SAAS;YACXA,QAAQE,KAAK;QACf,OAAO;gBACLL;aAAAA,qBAAAA,UAAUI,OAAO,cAAjBJ,yCAAAA,mBAAmBK,KAAK,IAAI,qDAAqD;YACjF,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;gBACzC,sCAAsC;gBACtCC,QAAQC,IAAI,CAAuB,CAAC;;oGAIpC,CAAC;YACH;QACF;IACF,GAAG;QAACZ;QAAoBF;QAAMC;QAAWE;KAAe;IAExD,OAAOC;AACT"}
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
- _exportStar(require("./components/Dialog/index"), exports);
5
+ const _export_star = require("@swc/helpers/_/_export_star");
6
+ _export_star._(require("./components/Dialog/index"), exports);
@@ -1 +1 @@
1
- {"version":3,"sources":["Dialog.js"],"sourcesContent":["export * from './components/Dialog/index';\n"],"names":[],"mappings":";;;;;oBAAc"}
1
+ {"version":3,"sources":["Dialog.js"],"sourcesContent":["export * from './components/Dialog/index';\n"],"names":[],"mappings":";;;;;uBAAc"}
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
- _exportStar(require("./components/DialogActions/index"), exports);
5
+ const _export_star = require("@swc/helpers/_/_export_star");
6
+ _export_star._(require("./components/DialogActions/index"), exports);
@@ -1 +1 @@
1
- {"version":3,"sources":["DialogActions.js"],"sourcesContent":["export * from './components/DialogActions/index';\n"],"names":[],"mappings":";;;;;oBAAc"}
1
+ {"version":3,"sources":["DialogActions.js"],"sourcesContent":["export * from './components/DialogActions/index';\n"],"names":[],"mappings":";;;;;uBAAc"}
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
- _exportStar(require("./components/DialogBody/index"), exports);
5
+ const _export_star = require("@swc/helpers/_/_export_star");
6
+ _export_star._(require("./components/DialogBody/index"), exports);
@@ -1 +1 @@
1
- {"version":3,"sources":["DialogBody.js"],"sourcesContent":["export * from './components/DialogBody/index';\n"],"names":[],"mappings":";;;;;oBAAc"}
1
+ {"version":3,"sources":["DialogBody.js"],"sourcesContent":["export * from './components/DialogBody/index';\n"],"names":[],"mappings":";;;;;uBAAc"}
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
- _exportStar(require("./components/DialogContent/index"), exports);
5
+ const _export_star = require("@swc/helpers/_/_export_star");
6
+ _export_star._(require("./components/DialogContent/index"), exports);
@@ -1 +1 @@
1
- {"version":3,"sources":["DialogContent.js"],"sourcesContent":["export * from './components/DialogContent/index';\n"],"names":[],"mappings":";;;;;oBAAc"}
1
+ {"version":3,"sources":["DialogContent.js"],"sourcesContent":["export * from './components/DialogContent/index';\n"],"names":[],"mappings":";;;;;uBAAc"}
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
- _exportStar(require("./components/DialogSurface/index"), exports);
5
+ const _export_star = require("@swc/helpers/_/_export_star");
6
+ _export_star._(require("./components/DialogSurface/index"), exports);
@@ -1 +1 @@
1
- {"version":3,"sources":["DialogSurface.js"],"sourcesContent":["export * from './components/DialogSurface/index';\n"],"names":[],"mappings":";;;;;oBAAc"}
1
+ {"version":3,"sources":["DialogSurface.js"],"sourcesContent":["export * from './components/DialogSurface/index';\n"],"names":[],"mappings":";;;;;uBAAc"}
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
- _exportStar(require("./components/DialogTitle/index"), exports);
5
+ const _export_star = require("@swc/helpers/_/_export_star");
6
+ _export_star._(require("./components/DialogTitle/index"), exports);
@@ -1 +1 @@
1
- {"version":3,"sources":["DialogTitle.js"],"sourcesContent":["export * from './components/DialogTitle/index';\n"],"names":[],"mappings":";;;;;oBAAc"}
1
+ {"version":3,"sources":["DialogTitle.js"],"sourcesContent":["export * from './components/DialogTitle/index';\n"],"names":[],"mappings":";;;;;uBAAc"}
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
- _exportStar(require("./components/DialogTrigger/index"), exports);
5
+ const _export_star = require("@swc/helpers/_/_export_star");
6
+ _export_star._(require("./components/DialogTrigger/index"), exports);
@@ -1 +1 @@
1
- {"version":3,"sources":["DialogTrigger.js"],"sourcesContent":["export * from './components/DialogTrigger/index';\n"],"names":[],"mappings":";;;;;oBAAc"}
1
+ {"version":3,"sources":["DialogTrigger.js"],"sourcesContent":["export * from './components/DialogTrigger/index';\n"],"names":[],"mappings":";;;;;uBAAc"}
@@ -4,10 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "Dialog", {
6
6
  enumerable: true,
7
- get: ()=>Dialog
7
+ get: function() {
8
+ return Dialog;
9
+ }
8
10
  });
9
- const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
11
13
  const _useDialog = require("./useDialog");
12
14
  const _renderDialog = require("./renderDialog");
13
15
  const _useDialogContextValues = require("./useDialogContextValues");
@@ -1 +1 @@
1
- {"version":3,"sources":["Dialog.js"],"sourcesContent":["import * as React from 'react';\nimport { useDialog_unstable } from './useDialog';\nimport { renderDialog_unstable } from './renderDialog';\nimport { useDialogContextValues_unstable } from './useDialogContextValues';\n/**\n * The `Dialog` root level component serves as an interface for interaction with all possible behaviors exposed.\n * It provides context down the hierarchy to `children` compound components to allow functionality.\n * This component expects to receive as children either a `DialogSurface` or a `DialogTrigger`\n * and a `DialogSurface` (or some component that will eventually render one of those compound components)\n * in this specific order\n */ export const Dialog = /*#__PURE__*/ React.memo((props)=>{\n const state = useDialog_unstable(props);\n const contextValues = useDialogContextValues_unstable(state);\n return renderDialog_unstable(state, contextValues);\n});\nDialog.displayName = 'Dialog';\n"],"names":["Dialog","React","memo","props","state","useDialog_unstable","contextValues","useDialogContextValues_unstable","renderDialog_unstable","displayName"],"mappings":";;;;+BAUiBA;;aAAAA;;;6DAVM;2BACY;8BACG;wCACU;AAOrC,MAAMA,SAAS,WAAW,GAAGC,OAAMC,IAAI,CAAC,CAACC,QAAQ;IACxD,MAAMC,QAAQC,IAAAA,6BAAkB,EAACF;IACjC,MAAMG,gBAAgBC,IAAAA,uDAA+B,EAACH;IACtD,OAAOI,IAAAA,mCAAqB,EAACJ,OAAOE;AACxC;AACAN,OAAOS,WAAW,GAAG"}
1
+ {"version":3,"sources":["Dialog.js"],"sourcesContent":["import * as React from 'react';\nimport { useDialog_unstable } from './useDialog';\nimport { renderDialog_unstable } from './renderDialog';\nimport { useDialogContextValues_unstable } from './useDialogContextValues';\n/**\n * The `Dialog` root level component serves as an interface for interaction with all possible behaviors exposed.\n * It provides context down the hierarchy to `children` compound components to allow functionality.\n * This component expects to receive as children either a `DialogSurface` or a `DialogTrigger`\n * and a `DialogSurface` (or some component that will eventually render one of those compound components)\n * in this specific order\n */ export const Dialog = /*#__PURE__*/ React.memo((props)=>{\n const state = useDialog_unstable(props);\n const contextValues = useDialogContextValues_unstable(state);\n return renderDialog_unstable(state, contextValues);\n});\nDialog.displayName = 'Dialog';\n"],"names":["Dialog","React","memo","props","state","useDialog_unstable","contextValues","useDialogContextValues_unstable","renderDialog_unstable","displayName"],"mappings":";;;;+BAUiBA;;;eAAAA;;;;iEAVM;2BACY;8BACG;wCACU;AAOrC,MAAMA,SAAS,WAAW,GAAGC,OAAMC,IAAI,CAAC,CAACC;IAChD,MAAMC,QAAQC,IAAAA,6BAAkB,EAACF;IACjC,MAAMG,gBAAgBC,IAAAA,uDAA+B,EAACH;IACtD,OAAOI,IAAAA,mCAAqB,EAACJ,OAAOE;AACxC;AACAN,OAAOS,WAAW,GAAG"}
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
- _exportStar(require("./Dialog"), exports);
7
- _exportStar(require("./Dialog.types"), exports);
8
- _exportStar(require("./renderDialog"), exports);
9
- _exportStar(require("./useDialog"), exports);
5
+ const _export_star = require("@swc/helpers/_/_export_star");
6
+ _export_star._(require("./Dialog"), exports);
7
+ _export_star._(require("./Dialog.types"), exports);
8
+ _export_star._(require("./renderDialog"), exports);
9
+ _export_star._(require("./useDialog"), exports);
@@ -1 +1 @@
1
- {"version":3,"sources":["index.js"],"sourcesContent":["export * from './Dialog';\nexport * from './Dialog.types';\nexport * from './renderDialog';\nexport * from './useDialog';\n"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA"}
1
+ {"version":3,"sources":["index.js"],"sourcesContent":["export * from './Dialog';\nexport * from './Dialog.types';\nexport * from './renderDialog';\nexport * from './useDialog';\n"],"names":[],"mappings":";;;;;uBAAc;uBACA;uBACA;uBACA"}
@@ -1,18 +1,25 @@
1
- /** @jsxRuntime classic */ /** @jsx createElement */ "use strict";
1
+ /** @jsxRuntime automatic */ /** @jsxImportSource @fluentui/react-jsx-runtime */ "use strict";
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
5
  Object.defineProperty(exports, "renderDialog_unstable", {
6
6
  enumerable: true,
7
- get: ()=>renderDialog_unstable
7
+ get: function() {
8
+ return renderDialog_unstable;
9
+ }
8
10
  });
9
- const _reactJsxRuntime = require("@fluentui/react-jsx-runtime");
11
+ const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
10
12
  const _contexts = require("../../contexts");
11
13
  const renderDialog_unstable = (state, contextValues)=>{
12
- const { content , trigger } = state;
13
- return /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(_contexts.DialogProvider, {
14
- value: contextValues.dialog
15
- }, /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(_contexts.DialogSurfaceProvider, {
16
- value: contextValues.dialogSurface
17
- }, trigger, content));
14
+ const { content, trigger } = state;
15
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_contexts.DialogProvider, {
16
+ value: contextValues.dialog,
17
+ children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_contexts.DialogSurfaceProvider, {
18
+ value: contextValues.dialogSurface,
19
+ children: [
20
+ trigger,
21
+ content
22
+ ]
23
+ })
24
+ });
18
25
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["renderDialog.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';\nimport { DialogProvider, DialogSurfaceProvider } from '../../contexts';\n/**\n * Render the final JSX of Dialog\n */ export const renderDialog_unstable = (state, contextValues)=>{\n const { content , trigger } = state;\n return /*#__PURE__*/ createElement(DialogProvider, {\n value: contextValues.dialog\n }, /*#__PURE__*/ createElement(DialogSurfaceProvider, {\n value: contextValues.dialogSurface\n }, trigger, content));\n};\n"],"names":["renderDialog_unstable","state","contextValues","content","trigger","createElement","DialogProvider","value","dialog","DialogSurfaceProvider","dialogSurface"],"mappings":"AAAA,wBAAwB,GAAG,uBAAuB;;;;+BAIjCA;;aAAAA;;iCAJkE;0BAC7B;AAG3C,MAAMA,wBAAwB,CAACC,OAAOC,gBAAgB;IAC7D,MAAM,EAAEC,QAAO,EAAGC,QAAO,EAAG,GAAGH;IAC/B,OAAO,WAAW,GAAGI,IAAAA,8BAAa,EAACC,wBAAc,EAAE;QAC/CC,OAAOL,cAAcM,MAAM;IAC/B,GAAG,WAAW,GAAGH,IAAAA,8BAAa,EAACI,+BAAqB,EAAE;QAClDF,OAAOL,cAAcQ,aAAa;IACtC,GAAGN,SAASD;AAChB"}
1
+ {"version":3,"sources":["renderDialog.js"],"sourcesContent":["/** @jsxRuntime automatic */ /** @jsxImportSource @fluentui/react-jsx-runtime */ import { jsx as _jsx, jsxs as _jsxs } from \"@fluentui/react-jsx-runtime/jsx-runtime\";\nimport { DialogProvider, DialogSurfaceProvider } from '../../contexts';\n/**\n * Render the final JSX of Dialog\n */ export const renderDialog_unstable = (state, contextValues)=>{\n const { content, trigger } = state;\n return /*#__PURE__*/ _jsx(DialogProvider, {\n value: contextValues.dialog,\n children: /*#__PURE__*/ _jsxs(DialogSurfaceProvider, {\n value: contextValues.dialogSurface,\n children: [\n trigger,\n content\n ]\n })\n });\n};\n"],"names":["renderDialog_unstable","state","contextValues","content","trigger","_jsx","DialogProvider","value","dialog","children","_jsxs","DialogSurfaceProvider","dialogSurface"],"mappings":"AAAA,0BAA0B,GAAG,iDAAiD;;;;+BAI7DA;;;eAAAA;;;4BAJ2G;0BACtE;AAG3C,MAAMA,wBAAwB,CAACC,OAAOC;IAC7C,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAE,GAAGH;IAC7B,OAAO,WAAW,GAAGI,IAAAA,eAAI,EAACC,wBAAc,EAAE;QACtCC,OAAOL,cAAcM,MAAM;QAC3BC,UAAU,WAAW,GAAGC,IAAAA,gBAAK,EAACC,+BAAqB,EAAE;YACjDJ,OAAOL,cAAcU,aAAa;YAClCH,UAAU;gBACNL;gBACAD;aACH;QACL;IACJ;AACJ"}
@@ -4,25 +4,28 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "useDialog_unstable", {
6
6
  enumerable: true,
7
- get: ()=>useDialog_unstable
7
+ get: function() {
8
+ return useDialog_unstable;
9
+ }
8
10
  });
9
- const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
- const _reactUtilities = require("@fluentui/react-utilities");
12
- const _reactContextSelector = require("@fluentui/react-context-selector");
11
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
+ const _reactutilities = require("@fluentui/react-utilities");
14
+ const _reactcontextselector = require("@fluentui/react-context-selector");
13
15
  const _utils = require("../../utils");
14
16
  const _contexts = require("../../contexts");
15
- const _reactTabster = require("@fluentui/react-tabster");
17
+ const _reacttabster = require("@fluentui/react-tabster");
16
18
  const useDialog_unstable = (props)=>{
17
- const { children , modalType ='modal' , onOpenChange , inertTrapFocus =false } = props;
19
+ const { children, modalType = 'modal', onOpenChange, inertTrapFocus = false } = props;
18
20
  const [trigger, content] = childrenToTriggerAndContent(children);
19
- const [open, setOpen] = (0, _reactUtilities.useControllableState)({
21
+ const [open, setOpen] = (0, _reactutilities.useControllableState)({
20
22
  state: props.open,
21
23
  defaultState: props.defaultOpen,
22
24
  initialState: false
23
25
  });
24
- const requestOpenChange = (0, _reactUtilities.useEventCallback)((data)=>{
25
- onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(data.event, data);
26
+ const requestOpenChange = (0, _reactutilities.useEventCallback)((data)=>{
27
+ var _onOpenChange;
28
+ (_onOpenChange = onOpenChange) === null || _onOpenChange === void 0 ? void 0 : _onOpenChange(data.event, data);
26
29
  // if user prevents default then do not change state value
27
30
  // otherwise updates state value and trigger reference to the element that caused the opening
28
31
  if (!data.event.isDefaultPrevented()) {
@@ -32,7 +35,7 @@ const useDialog_unstable = (props)=>{
32
35
  const focusRef = (0, _utils.useFocusFirstElement)(open, modalType);
33
36
  const disableBodyScroll = (0, _utils.useDisableBodyScroll)();
34
37
  const isBodyScrollLocked = Boolean(open && modalType !== 'non-modal');
35
- (0, _reactUtilities.useIsomorphicLayoutEffect)(()=>{
38
+ (0, _reactutilities.useIsomorphicLayoutEffect)(()=>{
36
39
  if (isBodyScrollLocked) {
37
40
  return disableBodyScroll();
38
41
  }
@@ -40,7 +43,7 @@ const useDialog_unstable = (props)=>{
40
43
  disableBodyScroll,
41
44
  isBodyScrollLocked
42
45
  ]);
43
- const { modalAttributes , triggerAttributes } = (0, _reactTabster.useModalAttributes)({
46
+ const { modalAttributes, triggerAttributes } = (0, _reacttabster.useModalAttributes)({
44
47
  trapFocus: modalType !== 'non-modal',
45
48
  legacyTrapFocus: !inertTrapFocus
46
49
  });
@@ -54,8 +57,8 @@ const useDialog_unstable = (props)=>{
54
57
  content: open ? content : null,
55
58
  trigger,
56
59
  requestOpenChange,
57
- dialogTitleId: (0, _reactUtilities.useId)('dialog-title-'),
58
- isNestedDialog: (0, _reactContextSelector.useHasParentContext)(_contexts.DialogContext),
60
+ dialogTitleId: (0, _reactutilities.useId)('dialog-title-'),
61
+ isNestedDialog: (0, _reactcontextselector.useHasParentContext)(_contexts.DialogContext),
59
62
  dialogRef: focusRef,
60
63
  modalAttributes: modalType !== 'non-modal' ? modalAttributes : undefined,
61
64
  triggerAttributes
@@ -68,7 +71,9 @@ const useDialog_unstable = (props)=>{
68
71
  if (process.env.NODE_ENV !== 'production') {
69
72
  if (childrenArray.length !== 1 && childrenArray.length !== 2) {
70
73
  // eslint-disable-next-line no-console
71
- console.warn('Dialog must contain at least one child <DialogSurface/>,\n' + 'and at most two children <DialogTrigger/> <DialogSurface/> (in this order)');
74
+ console.warn(`@fluentui/react-dialog [useDialog]:
75
+ Dialog must contain at least one child <DialogSurface/>,
76
+ and at most two children <DialogTrigger/> <DialogSurface/> (in this order).`);
72
77
  }
73
78
  }
74
79
  switch(childrenArray.length){
@@ -1 +1 @@
1
- {"version":3,"sources":["useDialog.js"],"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';\nimport { useModalAttributes } from '@fluentui/react-tabster';\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 */ export const useDialog_unstable = (props)=>{\n const { children , modalType ='modal' , onOpenChange , inertTrapFocus =false } = props;\n const [trigger, content] = childrenToTriggerAndContent(children);\n const [open, setOpen] = useControllableState({\n state: props.open,\n defaultState: props.defaultOpen,\n initialState: false\n });\n const requestOpenChange = useEventCallback((data)=>{\n onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(data.event, data);\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 const focusRef = useFocusFirstElement(open, modalType);\n const disableBodyScroll = useDisableBodyScroll();\n const isBodyScrollLocked = Boolean(open && modalType !== 'non-modal');\n useIsomorphicLayoutEffect(()=>{\n if (isBodyScrollLocked) {\n return disableBodyScroll();\n }\n }, [\n disableBodyScroll,\n isBodyScrollLocked\n ]);\n const { modalAttributes , triggerAttributes } = useModalAttributes({\n trapFocus: modalType !== 'non-modal',\n legacyTrapFocus: !inertTrapFocus\n });\n return {\n components: {\n backdrop: 'div'\n },\n inertTrapFocus,\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 modalAttributes: modalType !== 'non-modal' ? modalAttributes : undefined,\n triggerAttributes\n };\n};\n/**\n * Extracts trigger and content from children\n */ function childrenToTriggerAndContent(children) {\n const childrenArray = React.Children.toArray(children);\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('Dialog must contain at least one child <DialogSurface/>,\\n' + 'and at most two children <DialogTrigger/> <DialogSurface/> (in this order)');\n }\n }\n switch(childrenArray.length){\n // case where there's a trigger followed by content\n case 2:\n return childrenArray;\n // case where there's only content\n case 1:\n return [\n undefined,\n childrenArray[0]\n ];\n // unknown case\n default:\n return [\n undefined,\n undefined\n ];\n }\n}\n"],"names":["useDialog_unstable","props","children","modalType","onOpenChange","inertTrapFocus","trigger","content","childrenToTriggerAndContent","open","setOpen","useControllableState","state","defaultState","defaultOpen","initialState","requestOpenChange","useEventCallback","data","event","isDefaultPrevented","focusRef","useFocusFirstElement","disableBodyScroll","useDisableBodyScroll","isBodyScrollLocked","Boolean","useIsomorphicLayoutEffect","modalAttributes","triggerAttributes","useModalAttributes","trapFocus","legacyTrapFocus","components","backdrop","dialogTitleId","useId","isNestedDialog","useHasParentContext","DialogContext","dialogRef","undefined","childrenArray","React","Children","toArray","process","env","NODE_ENV","length","console","warn"],"mappings":";;;;+BAaiBA;;aAAAA;;;6DAbM;gCACkE;sCACrD;uBACuB;0BAC7B;8BACK;AAQxB,MAAMA,qBAAqB,CAACC,QAAQ;IAC3C,MAAM,EAAEC,SAAQ,EAAGC,WAAW,QAAO,EAAGC,aAAY,EAAGC,gBAAgB,KAAK,CAAA,EAAG,GAAGJ;IAClF,MAAM,CAACK,SAASC,QAAQ,GAAGC,4BAA4BN;IACvD,MAAM,CAACO,MAAMC,QAAQ,GAAGC,IAAAA,oCAAoB,EAAC;QACzCC,OAAOX,MAAMQ,IAAI;QACjBI,cAAcZ,MAAMa,WAAW;QAC/BC,cAAc,KAAK;IACvB;IACA,MAAMC,oBAAoBC,IAAAA,gCAAgB,EAAC,CAACC,OAAO;QAC/Cd,iBAAiB,IAAI,IAAIA,iBAAiB,KAAK,IAAI,KAAK,IAAIA,aAAac,KAAKC,KAAK,EAAED,KAAK;QAC1F,0DAA0D;QAC1D,6FAA6F;QAC7F,IAAI,CAACA,KAAKC,KAAK,CAACC,kBAAkB,IAAI;YAClCV,QAAQQ,KAAKT,IAAI;QACrB,CAAC;IACL;IACA,MAAMY,WAAWC,IAAAA,2BAAoB,EAACb,MAAMN;IAC5C,MAAMoB,oBAAoBC,IAAAA,2BAAoB;IAC9C,MAAMC,qBAAqBC,QAAQjB,QAAQN,cAAc;IACzDwB,IAAAA,yCAAyB,EAAC,IAAI;QAC1B,IAAIF,oBAAoB;YACpB,OAAOF;QACX,CAAC;IACL,GAAG;QACCA;QACAE;KACH;IACD,MAAM,EAAEG,gBAAe,EAAGC,kBAAiB,EAAG,GAAGC,IAAAA,gCAAkB,EAAC;QAChEC,WAAW5B,cAAc;QACzB6B,iBAAiB,CAAC3B;IACtB;IACA,OAAO;QACH4B,YAAY;YACRC,UAAU;QACd;QACA7B;QACAI;QACAN;QACAI,SAASE,OAAOF,UAAU,IAAI;QAC9BD;QACAU;QACAmB,eAAeC,IAAAA,qBAAK,EAAC;QACrBC,gBAAgBC,IAAAA,yCAAmB,EAACC,uBAAa;QACjDC,WAAWnB;QACXO,iBAAiBzB,cAAc,cAAcyB,kBAAkBa,SAAS;QACxEZ;IACJ;AACJ;AACA;;CAEC,GAAG,SAASrB,4BAA4BN,QAAQ,EAAE;IAC/C,MAAMwC,gBAAgBC,OAAMC,QAAQ,CAACC,OAAO,CAAC3C;IAC7C,IAAI4C,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACvC,IAAIN,cAAcO,MAAM,KAAK,KAAKP,cAAcO,MAAM,KAAK,GAAG;YAC1D,sCAAsC;YACtCC,QAAQC,IAAI,CAAC,+DAA+D;QAChF,CAAC;IACL,CAAC;IACD,OAAOT,cAAcO,MAAM;QACvB,mDAAmD;QACnD,KAAK;YACD,OAAOP;QACX,kCAAkC;QAClC,KAAK;YACD,OAAO;gBACHD;gBACAC,aAAa,CAAC,EAAE;aACnB;QACL,eAAe;QACf;YACI,OAAO;gBACHD;gBACAA;aACH;IACT;AACJ"}
1
+ {"version":3,"sources":["useDialog.js"],"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';\nimport { useModalAttributes } from '@fluentui/react-tabster';\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 */ export const useDialog_unstable = (props)=>{\n const { children, modalType = 'modal', onOpenChange, inertTrapFocus = false } = props;\n const [trigger, content] = childrenToTriggerAndContent(children);\n const [open, setOpen] = useControllableState({\n state: props.open,\n defaultState: props.defaultOpen,\n initialState: false\n });\n const requestOpenChange = useEventCallback((data)=>{\n var _onOpenChange;\n (_onOpenChange = onOpenChange) === null || _onOpenChange === void 0 ? void 0 : _onOpenChange(data.event, data);\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 const focusRef = useFocusFirstElement(open, modalType);\n const disableBodyScroll = useDisableBodyScroll();\n const isBodyScrollLocked = Boolean(open && modalType !== 'non-modal');\n useIsomorphicLayoutEffect(()=>{\n if (isBodyScrollLocked) {\n return disableBodyScroll();\n }\n }, [\n disableBodyScroll,\n isBodyScrollLocked\n ]);\n const { modalAttributes, triggerAttributes } = useModalAttributes({\n trapFocus: modalType !== 'non-modal',\n legacyTrapFocus: !inertTrapFocus\n });\n return {\n components: {\n backdrop: 'div'\n },\n inertTrapFocus,\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 modalAttributes: modalType !== 'non-modal' ? modalAttributes : undefined,\n triggerAttributes\n };\n};\n/**\n * Extracts trigger and content from children\n */ function childrenToTriggerAndContent(children) {\n const childrenArray = React.Children.toArray(children);\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(`@fluentui/react-dialog [useDialog]:\nDialog must contain at least one child <DialogSurface/>,\nand at most two children <DialogTrigger/> <DialogSurface/> (in this order).`);\n }\n }\n switch(childrenArray.length){\n // case where there's a trigger followed by content\n case 2:\n return childrenArray;\n // case where there's only content\n case 1:\n return [\n undefined,\n childrenArray[0]\n ];\n // unknown case\n default:\n return [\n undefined,\n undefined\n ];\n }\n}\n"],"names":["useDialog_unstable","props","children","modalType","onOpenChange","inertTrapFocus","trigger","content","childrenToTriggerAndContent","open","setOpen","useControllableState","state","defaultState","defaultOpen","initialState","requestOpenChange","useEventCallback","data","_onOpenChange","event","isDefaultPrevented","focusRef","useFocusFirstElement","disableBodyScroll","useDisableBodyScroll","isBodyScrollLocked","Boolean","useIsomorphicLayoutEffect","modalAttributes","triggerAttributes","useModalAttributes","trapFocus","legacyTrapFocus","components","backdrop","dialogTitleId","useId","isNestedDialog","useHasParentContext","DialogContext","dialogRef","undefined","childrenArray","React","Children","toArray","process","env","NODE_ENV","length","console","warn"],"mappings":";;;;+BAaiBA;;;eAAAA;;;;iEAbM;gCACkE;sCACrD;uBACuB;0BAC7B;8BACK;AAQxB,MAAMA,qBAAqB,CAACC;IACnC,MAAM,EAAEC,QAAQ,EAAEC,YAAY,OAAO,EAAEC,YAAY,EAAEC,iBAAiB,KAAK,EAAE,GAAGJ;IAChF,MAAM,CAACK,SAASC,QAAQ,GAAGC,4BAA4BN;IACvD,MAAM,CAACO,MAAMC,QAAQ,GAAGC,IAAAA,oCAAoB,EAAC;QACzCC,OAAOX,MAAMQ,IAAI;QACjBI,cAAcZ,MAAMa,WAAW;QAC/BC,cAAc;IAClB;IACA,MAAMC,oBAAoBC,IAAAA,gCAAgB,EAAC,CAACC;QACxC,IAAIC;QACHA,CAAAA,gBAAgBf,YAAW,MAAO,QAAQe,kBAAkB,KAAK,IAAI,KAAK,IAAIA,cAAcD,KAAKE,KAAK,EAAEF;QACzG,0DAA0D;QAC1D,6FAA6F;QAC7F,IAAI,CAACA,KAAKE,KAAK,CAACC,kBAAkB,IAAI;YAClCX,QAAQQ,KAAKT,IAAI;QACrB;IACJ;IACA,MAAMa,WAAWC,IAAAA,2BAAoB,EAACd,MAAMN;IAC5C,MAAMqB,oBAAoBC,IAAAA,2BAAoB;IAC9C,MAAMC,qBAAqBC,QAAQlB,QAAQN,cAAc;IACzDyB,IAAAA,yCAAyB,EAAC;QACtB,IAAIF,oBAAoB;YACpB,OAAOF;QACX;IACJ,GAAG;QACCA;QACAE;KACH;IACD,MAAM,EAAEG,eAAe,EAAEC,iBAAiB,EAAE,GAAGC,IAAAA,gCAAkB,EAAC;QAC9DC,WAAW7B,cAAc;QACzB8B,iBAAiB,CAAC5B;IACtB;IACA,OAAO;QACH6B,YAAY;YACRC,UAAU;QACd;QACA9B;QACAI;QACAN;QACAI,SAASE,OAAOF,UAAU;QAC1BD;QACAU;QACAoB,eAAeC,IAAAA,qBAAK,EAAC;QACrBC,gBAAgBC,IAAAA,yCAAmB,EAACC,uBAAa;QACjDC,WAAWnB;QACXO,iBAAiB1B,cAAc,cAAc0B,kBAAkBa;QAC/DZ;IACJ;AACJ;AACA;;CAEC,GAAG,SAAStB,4BAA4BN,QAAQ;IAC7C,MAAMyC,gBAAgBC,OAAMC,QAAQ,CAACC,OAAO,CAAC5C;IAC7C,IAAI6C,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACvC,IAAIN,cAAcO,MAAM,KAAK,KAAKP,cAAcO,MAAM,KAAK,GAAG;YAC1D,sCAAsC;YACtCC,QAAQC,IAAI,CAAC,CAAC;;2EAEiD,CAAC;QACpE;IACJ;IACA,OAAOT,cAAcO,MAAM;QACvB,mDAAmD;QACnD,KAAK;YACD,OAAOP;QACX,kCAAkC;QAClC,KAAK;YACD,OAAO;gBACHD;gBACAC,aAAa,CAAC,EAAE;aACnB;QACL,eAAe;QACf;YACI,OAAO;gBACHD;gBACAA;aACH;IACT;AACJ"}
@@ -4,10 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "useDialogContextValues_unstable", {
6
6
  enumerable: true,
7
- get: ()=>useDialogContextValues_unstable
7
+ get: function() {
8
+ return useDialogContextValues_unstable;
9
+ }
8
10
  });
9
11
  function useDialogContextValues_unstable(state) {
10
- const { modalType , open , dialogRef , dialogTitleId , isNestedDialog , inertTrapFocus , requestOpenChange , modalAttributes , triggerAttributes } = state;
12
+ const { modalType, open, dialogRef, dialogTitleId, isNestedDialog, inertTrapFocus, requestOpenChange, modalAttributes, triggerAttributes } = state;
11
13
  /**
12
14
  * This context is created with "@fluentui/react-context-selector",
13
15
  * there is no sense to memoize it