@fluentui/react-dialog 9.1.5 → 9.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/CHANGELOG.json +113 -1
  2. package/CHANGELOG.md +30 -2
  3. package/lib/components/Dialog/Dialog.js +0 -1
  4. package/lib/components/Dialog/Dialog.js.map +1 -1
  5. package/lib/components/Dialog/renderDialog.js +0 -1
  6. package/lib/components/Dialog/renderDialog.js.map +1 -1
  7. package/lib/components/Dialog/useDialog.js +2 -8
  8. package/lib/components/Dialog/useDialog.js.map +1 -1
  9. package/lib/components/Dialog/useDialogContextValues.js +0 -1
  10. package/lib/components/Dialog/useDialogContextValues.js.map +1 -1
  11. package/lib/components/DialogActions/DialogActions.js +0 -1
  12. package/lib/components/DialogActions/DialogActions.js.map +1 -1
  13. package/lib/components/DialogActions/renderDialogActions.js +4 -4
  14. package/lib/components/DialogActions/renderDialogActions.js.map +1 -1
  15. package/lib/components/DialogActions/useDialogActions.js +0 -1
  16. package/lib/components/DialogActions/useDialogActions.js.map +1 -1
  17. package/lib/components/DialogActions/useDialogActionsStyles.js +24 -27
  18. package/lib/components/DialogActions/useDialogActionsStyles.js.map +1 -1
  19. package/lib/components/DialogBody/DialogBody.js +0 -1
  20. package/lib/components/DialogBody/DialogBody.js.map +1 -1
  21. package/lib/components/DialogBody/renderDialogBody.js +4 -4
  22. package/lib/components/DialogBody/renderDialogBody.js.map +1 -1
  23. package/lib/components/DialogBody/useDialogBody.js +0 -2
  24. package/lib/components/DialogBody/useDialogBody.js.map +1 -1
  25. package/lib/components/DialogBody/useDialogBodyStyles.js +23 -26
  26. package/lib/components/DialogBody/useDialogBodyStyles.js.map +1 -1
  27. package/lib/components/DialogContent/DialogContent.js +0 -1
  28. package/lib/components/DialogContent/DialogContent.js.map +1 -1
  29. package/lib/components/DialogContent/renderDialogContent.js +2 -2
  30. package/lib/components/DialogContent/renderDialogContent.js.map +1 -1
  31. package/lib/components/DialogContent/useDialogContent.js +0 -2
  32. package/lib/components/DialogContent/useDialogContent.js.map +1 -1
  33. package/lib/components/DialogContent/useDialogContentStyles.js +15 -18
  34. package/lib/components/DialogContent/useDialogContentStyles.js.map +1 -1
  35. package/lib/components/DialogSurface/DialogSurface.js +0 -1
  36. package/lib/components/DialogSurface/DialogSurface.js.map +1 -1
  37. package/lib/components/DialogSurface/renderDialogSurface.js +4 -3
  38. package/lib/components/DialogSurface/renderDialogSurface.js.map +1 -1
  39. package/lib/components/DialogSurface/useDialogSurface.js +2 -7
  40. package/lib/components/DialogSurface/useDialogSurface.js.map +1 -1
  41. package/lib/components/DialogSurface/useDialogSurfaceContextValues.js.map +1 -1
  42. package/lib/components/DialogSurface/useDialogSurfaceStyles.js +92 -97
  43. package/lib/components/DialogSurface/useDialogSurfaceStyles.js.map +1 -1
  44. package/lib/components/DialogTitle/DialogTitle.js +0 -1
  45. package/lib/components/DialogTitle/DialogTitle.js.map +1 -1
  46. package/lib/components/DialogTitle/renderDialogTitle.js +4 -3
  47. package/lib/components/DialogTitle/renderDialogTitle.js.map +1 -1
  48. package/lib/components/DialogTitle/useDialogTitle.js +0 -1
  49. package/lib/components/DialogTitle/useDialogTitle.js.map +1 -1
  50. package/lib/components/DialogTitle/useDialogTitleStyles.js +74 -80
  51. package/lib/components/DialogTitle/useDialogTitleStyles.js.map +1 -1
  52. package/lib/components/DialogTrigger/DialogTrigger.js +2 -3
  53. package/lib/components/DialogTrigger/DialogTrigger.js.map +1 -1
  54. package/lib/components/DialogTrigger/renderDialogTrigger.js.map +1 -1
  55. package/lib/components/DialogTrigger/useDialogTrigger.js +4 -5
  56. package/lib/components/DialogTrigger/useDialogTrigger.js.map +1 -1
  57. package/lib/contexts/dialogContext.js +2 -4
  58. package/lib/contexts/dialogContext.js.map +1 -1
  59. package/lib/contexts/dialogSurfaceContext.js +0 -1
  60. package/lib/contexts/dialogSurfaceContext.js.map +1 -1
  61. package/lib/index.js.map +1 -1
  62. package/lib/utils/isEscapeKeyDown.js +0 -1
  63. package/lib/utils/isEscapeKeyDown.js.map +1 -1
  64. package/lib/utils/useDisableBodyScroll.js +0 -9
  65. package/lib/utils/useDisableBodyScroll.js.map +1 -1
  66. package/lib/utils/useFocusFirstElement.js +0 -5
  67. package/lib/utils/useFocusFirstElement.js.map +1 -1
  68. package/lib-commonjs/Dialog.js +0 -2
  69. package/lib-commonjs/Dialog.js.map +1 -1
  70. package/lib-commonjs/DialogActions.js +0 -2
  71. package/lib-commonjs/DialogActions.js.map +1 -1
  72. package/lib-commonjs/DialogBody.js +0 -2
  73. package/lib-commonjs/DialogBody.js.map +1 -1
  74. package/lib-commonjs/DialogContent.js +0 -2
  75. package/lib-commonjs/DialogContent.js.map +1 -1
  76. package/lib-commonjs/DialogSurface.js +0 -2
  77. package/lib-commonjs/DialogSurface.js.map +1 -1
  78. package/lib-commonjs/DialogTitle.js +0 -2
  79. package/lib-commonjs/DialogTitle.js.map +1 -1
  80. package/lib-commonjs/DialogTrigger.js +0 -2
  81. package/lib-commonjs/DialogTrigger.js.map +1 -1
  82. package/lib-commonjs/components/Dialog/Dialog.js +0 -6
  83. package/lib-commonjs/components/Dialog/Dialog.js.map +1 -1
  84. package/lib-commonjs/components/Dialog/Dialog.types.js.map +1 -1
  85. package/lib-commonjs/components/Dialog/index.js +0 -5
  86. package/lib-commonjs/components/Dialog/index.js.map +1 -1
  87. package/lib-commonjs/components/Dialog/renderDialog.js +0 -5
  88. package/lib-commonjs/components/Dialog/renderDialog.js.map +1 -1
  89. package/lib-commonjs/components/Dialog/useDialog.js +2 -15
  90. package/lib-commonjs/components/Dialog/useDialog.js.map +1 -1
  91. package/lib-commonjs/components/Dialog/useDialogContextValues.js +0 -3
  92. package/lib-commonjs/components/Dialog/useDialogContextValues.js.map +1 -1
  93. package/lib-commonjs/components/DialogActions/DialogActions.js +0 -6
  94. package/lib-commonjs/components/DialogActions/DialogActions.js.map +1 -1
  95. package/lib-commonjs/components/DialogActions/DialogActions.types.js.map +1 -1
  96. package/lib-commonjs/components/DialogActions/index.js +0 -6
  97. package/lib-commonjs/components/DialogActions/index.js.map +1 -1
  98. package/lib-commonjs/components/DialogActions/renderDialogActions.js +4 -8
  99. package/lib-commonjs/components/DialogActions/renderDialogActions.js.map +1 -1
  100. package/lib-commonjs/components/DialogActions/useDialogActions.js +0 -4
  101. package/lib-commonjs/components/DialogActions/useDialogActions.js.map +1 -1
  102. package/lib-commonjs/components/DialogActions/useDialogActionsStyles.js +24 -31
  103. package/lib-commonjs/components/DialogActions/useDialogActionsStyles.js.map +1 -1
  104. package/lib-commonjs/components/DialogBody/DialogBody.js +0 -6
  105. package/lib-commonjs/components/DialogBody/DialogBody.js.map +1 -1
  106. package/lib-commonjs/components/DialogBody/DialogBody.types.js.map +1 -1
  107. package/lib-commonjs/components/DialogBody/index.js +0 -6
  108. package/lib-commonjs/components/DialogBody/index.js.map +1 -1
  109. package/lib-commonjs/components/DialogBody/renderDialogBody.js +4 -8
  110. package/lib-commonjs/components/DialogBody/renderDialogBody.js.map +1 -1
  111. package/lib-commonjs/components/DialogBody/useDialogBody.js +0 -5
  112. package/lib-commonjs/components/DialogBody/useDialogBody.js.map +1 -1
  113. package/lib-commonjs/components/DialogBody/useDialogBodyStyles.js +23 -30
  114. package/lib-commonjs/components/DialogBody/useDialogBodyStyles.js.map +1 -1
  115. package/lib-commonjs/components/DialogContent/DialogContent.js +0 -6
  116. package/lib-commonjs/components/DialogContent/DialogContent.js.map +1 -1
  117. package/lib-commonjs/components/DialogContent/DialogContent.types.js.map +1 -1
  118. package/lib-commonjs/components/DialogContent/index.js +0 -6
  119. package/lib-commonjs/components/DialogContent/index.js.map +1 -1
  120. package/lib-commonjs/components/DialogContent/renderDialogContent.js +2 -6
  121. package/lib-commonjs/components/DialogContent/renderDialogContent.js.map +1 -1
  122. package/lib-commonjs/components/DialogContent/useDialogContent.js +0 -5
  123. package/lib-commonjs/components/DialogContent/useDialogContent.js.map +1 -1
  124. package/lib-commonjs/components/DialogContent/useDialogContentStyles.js +15 -23
  125. package/lib-commonjs/components/DialogContent/useDialogContentStyles.js.map +1 -1
  126. package/lib-commonjs/components/DialogSurface/DialogSurface.js +0 -7
  127. package/lib-commonjs/components/DialogSurface/DialogSurface.js.map +1 -1
  128. package/lib-commonjs/components/DialogSurface/DialogSurface.types.js.map +1 -1
  129. package/lib-commonjs/components/DialogSurface/index.js +0 -6
  130. package/lib-commonjs/components/DialogSurface/index.js.map +1 -1
  131. package/lib-commonjs/components/DialogSurface/renderDialogSurface.js +4 -9
  132. package/lib-commonjs/components/DialogSurface/renderDialogSurface.js.map +1 -1
  133. package/lib-commonjs/components/DialogSurface/useDialogSurface.js +2 -13
  134. package/lib-commonjs/components/DialogSurface/useDialogSurface.js.map +1 -1
  135. package/lib-commonjs/components/DialogSurface/useDialogSurfaceContextValues.js +0 -2
  136. package/lib-commonjs/components/DialogSurface/useDialogSurfaceContextValues.js.map +1 -1
  137. package/lib-commonjs/components/DialogSurface/useDialogSurfaceStyles.js +92 -103
  138. package/lib-commonjs/components/DialogSurface/useDialogSurfaceStyles.js.map +1 -1
  139. package/lib-commonjs/components/DialogTitle/DialogTitle.js +0 -6
  140. package/lib-commonjs/components/DialogTitle/DialogTitle.js.map +1 -1
  141. package/lib-commonjs/components/DialogTitle/DialogTitle.types.js.map +1 -1
  142. package/lib-commonjs/components/DialogTitle/index.js +0 -6
  143. package/lib-commonjs/components/DialogTitle/index.js.map +1 -1
  144. package/lib-commonjs/components/DialogTitle/renderDialogTitle.js +4 -7
  145. package/lib-commonjs/components/DialogTitle/renderDialogTitle.js.map +1 -1
  146. package/lib-commonjs/components/DialogTitle/useDialogTitle.js +0 -10
  147. package/lib-commonjs/components/DialogTitle/useDialogTitle.js.map +1 -1
  148. package/lib-commonjs/components/DialogTitle/useDialogTitleStyles.js +74 -86
  149. package/lib-commonjs/components/DialogTitle/useDialogTitleStyles.js.map +1 -1
  150. package/lib-commonjs/components/DialogTrigger/DialogTrigger.js +2 -7
  151. package/lib-commonjs/components/DialogTrigger/DialogTrigger.js.map +1 -1
  152. package/lib-commonjs/components/DialogTrigger/DialogTrigger.types.js.map +1 -1
  153. package/lib-commonjs/components/DialogTrigger/index.js +0 -5
  154. package/lib-commonjs/components/DialogTrigger/index.js.map +1 -1
  155. package/lib-commonjs/components/DialogTrigger/renderDialogTrigger.js +0 -2
  156. package/lib-commonjs/components/DialogTrigger/renderDialogTrigger.js.map +1 -1
  157. package/lib-commonjs/components/DialogTrigger/useDialogTrigger.js +4 -11
  158. package/lib-commonjs/components/DialogTrigger/useDialogTrigger.js.map +1 -1
  159. package/lib-commonjs/contexts/constants.js.map +1 -1
  160. package/lib-commonjs/contexts/dialogContext.js +2 -8
  161. package/lib-commonjs/contexts/dialogContext.js.map +1 -1
  162. package/lib-commonjs/contexts/dialogSurfaceContext.js +0 -5
  163. package/lib-commonjs/contexts/dialogSurfaceContext.js.map +1 -1
  164. package/lib-commonjs/contexts/index.js +0 -4
  165. package/lib-commonjs/contexts/index.js.map +1 -1
  166. package/lib-commonjs/index.js +0 -14
  167. package/lib-commonjs/index.js.map +1 -1
  168. package/lib-commonjs/utils/index.js +0 -4
  169. package/lib-commonjs/utils/index.js.map +1 -1
  170. package/lib-commonjs/utils/isEscapeKeyDown.js +0 -4
  171. package/lib-commonjs/utils/isEscapeKeyDown.js.map +1 -1
  172. package/lib-commonjs/utils/useDisableBodyScroll.js +0 -14
  173. package/lib-commonjs/utils/useDisableBodyScroll.js.map +1 -1
  174. package/lib-commonjs/utils/useFocusFirstElement.js +0 -10
  175. package/lib-commonjs/utils/useFocusFirstElement.js.map +1 -1
  176. package/package.json +9 -9
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-dialog/src/components/DialogTrigger/renderDialogTrigger.tsx"],"names":[],"mappings":"AAEA;;;;AAIG;AACH,OAAO,MAAM,4BAA4B,GAAI,KAAD,IAA+B,KAAK,CAAC,QAA1E","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"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":"AAEA;;;;;AAKA,OAAO,MAAMA,4BAA4B,GAAIC,KAAyB,IAAKA,KAAK,CAACC,QAAQ","names":["renderDialogTrigger_unstable","state","children"],"sourceRoot":"../src/","sources":["packages/react-components/react-dialog/src/components/DialogTrigger/renderDialogTrigger.tsx"],"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"]}
@@ -8,7 +8,6 @@ import { useARIAButtonProps } from '@fluentui/react-aria';
8
8
  *
9
9
  * @param props - props from this instance of DialogTrigger
10
10
  */
11
-
12
11
  export const useDialogTrigger_unstable = props => {
13
12
  const isInsideSurfaceDialog = useDialogSurfaceContext_unstable();
14
13
  const {
@@ -24,9 +23,7 @@ export const useDialogTrigger_unstable = props => {
24
23
  } = useModalAttributes();
25
24
  const handleClick = useEventCallback(event => {
26
25
  var _a, _b;
27
-
28
26
  (_b = child === null || child === void 0 ? void 0 : (_a = child.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a, event);
29
-
30
27
  if (!event.isDefaultPrevented()) {
31
28
  requestOpenChange({
32
29
  event,
@@ -35,13 +32,15 @@ export const useDialogTrigger_unstable = props => {
35
32
  });
36
33
  }
37
34
  });
38
- const triggerChildProps = { ...(child === null || child === void 0 ? void 0 : child.props),
35
+ const triggerChildProps = {
36
+ ...(child === null || child === void 0 ? void 0 : child.props),
39
37
  'aria-expanded': open,
40
38
  ref: child === null || child === void 0 ? void 0 : child.ref,
41
39
  onClick: handleClick,
42
40
  ...triggerAttributes
43
41
  };
44
- 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', { ...triggerChildProps,
42
+ 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', {
43
+ ...triggerChildProps,
45
44
  type: 'button'
46
45
  });
47
46
  return {
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-dialog/src/components/DialogTrigger/useDialogTrigger.ts"],"names":[],"mappings":"AACA,SAAS,kBAAT,QAAmC,yBAAnC;AACA,SAAS,2BAAT,EAAsC,eAAtC,EAAuD,gBAAvD,QAA+E,2BAA/E;AAEA,SAAS,yBAAT,EAAoC,gCAApC,QAA4E,gBAA5E;AACA,SAAS,kBAAT,QAAmC,sBAAnC;AAEA;;;;;AAKG;;AACH,OAAO,MAAM,yBAAyB,GAAI,KAAD,IAAkD;EACzF,MAAM,qBAAqB,GAAG,gCAAgC,EAA9D;EAEA,MAAM;IAAE,QAAF;IAAY,wBAAwB,GAAG,KAAvC;IAA8C,MAAM,GAAG,qBAAqB,GAAG,OAAH,GAAa;EAAzF,IAAoG,KAA1G;EAEA,MAAM,KAAK,GAAG,eAAe,CAAC,QAAD,CAA7B;EAEA,MAAM,iBAAiB,GAAG,yBAAyB,CAAC,GAAG,IAAI,GAAG,CAAC,iBAAZ,CAAnD;EACA,MAAM,IAAI,GAAG,yBAAyB,CAAC,GAAG,IAAI,GAAG,CAAC,IAAZ,CAAtC;EAEA,MAAM;IAAE;EAAF,IAAwB,kBAAkB,EAAhD;EAEA,MAAM,WAAW,GAAG,gBAAgB,CACjC,KAAD,IAAoF;;;IAClF,CAAA,EAAA,GAAA,KAAK,KAAA,IAAL,IAAA,KAAK,KAAA,KAAA,CAAL,GAAK,KAAA,CAAL,GAAK,CAAA,EAAA,GAAL,KAAK,CAAE,KAAF,EAAQ,OAAb,MAAoB,IAApB,IAAoB,EAAA,KAAA,KAAA,CAApB,GAAoB,KAAA,CAApB,GAAoB,EAAA,CAAA,IAAA,CAAA,EAAA,EAAG,KAAH,CAApB;;IACA,IAAI,CAAC,KAAK,CAAC,kBAAN,EAAL,EAAiC;MAC/B,iBAAiB,CAAC;QAChB,KADgB;QAEhB,IAAI,EAAE,cAFU;QAGhB,IAAI,EAAE,MAAM,KAAK;MAHD,CAAD,CAAjB;IAKD;EACF,CAViC,CAApC;EAaA,MAAM,iBAAiB,GAAG,EACxB,IAAG,KAAK,KAAA,IAAL,IAAA,KAAK,KAAA,KAAA,CAAL,GAAK,KAAA,CAAL,GAAA,KAAK,CAAE,KAAV,CADwB;IAExB,iBAAiB,IAFO;IAGxB,GAAG,EAAE,KAAK,KAAA,IAAL,IAAA,KAAK,KAAA,KAAA,CAAL,GAAK,KAAA,CAAL,GAAA,KAAK,CAAE,GAHY;IAIxB,OAAO,EAAE,WAJe;IAKxB,GAAG;EALqB,CAA1B;EAQA,MAAM,2BAA2B,GAAG,kBAAkB,CACpD,CAAA,KAAK,KAAA,IAAL,IAAA,KAAK,KAAA,KAAA,CAAL,GAAK,KAAA,CAAL,GAAA,KAAK,CAAE,IAAP,MAAgB,QAAhB,IAA4B,CAAA,KAAK,KAAA,IAAL,IAAA,KAAK,KAAA,KAAA,CAAL,GAAK,KAAA,CAAL,GAAA,KAAK,CAAE,IAAP,MAAgB,GAA5C,GAAkD,KAAK,CAAC,IAAxD,GAA+D,KADX,EAEpD,EACE,GAAG,iBADL;IAEE,IAAI,EAAE;EAFR,CAFoD,CAAtD;EAQA,OAAO;IACL,QAAQ,EAAE,2BAA2B,CACnC,QADmC,EAEnC,wBAAwB,GAAG,iBAAH,GAAuB,2BAFZ;EADhC,CAAP;AAMD,CA/CM","sourcesContent":["import * as React from 'react';\nimport { useModalAttributes } from '@fluentui/react-tabster';\nimport { applyTriggerPropsToChildren, getTriggerChild, useEventCallback } from '@fluentui/react-utilities';\nimport type { DialogTriggerProps, DialogTriggerState } from './DialogTrigger.types';\nimport { useDialogContext_unstable, useDialogSurfaceContext_unstable } from '../../contexts';\nimport { useARIAButtonProps } from '@fluentui/react-aria';\n\n/**\n * Create the state required to render DialogTrigger.\n * Clones the only child component and adds necessary event handling behaviours to open a popup Dialog\n *\n * @param props - props from this instance of DialogTrigger\n */\nexport const useDialogTrigger_unstable = (props: DialogTriggerProps): DialogTriggerState => {\n const isInsideSurfaceDialog = useDialogSurfaceContext_unstable();\n\n const { children, disableButtonEnhancement = false, action = isInsideSurfaceDialog ? 'close' : 'open' } = props;\n\n const child = getTriggerChild(children);\n\n const requestOpenChange = useDialogContext_unstable(ctx => ctx.requestOpenChange);\n const open = useDialogContext_unstable(ctx => ctx.open);\n\n const { triggerAttributes } = useModalAttributes();\n\n const handleClick = useEventCallback(\n (event: React.MouseEvent<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>) => {\n child?.props.onClick?.(event);\n if (!event.isDefaultPrevented()) {\n requestOpenChange({\n event,\n type: 'triggerClick',\n open: action === 'open',\n });\n }\n },\n );\n\n const triggerChildProps = {\n ...child?.props,\n 'aria-expanded': open,\n ref: child?.ref,\n onClick: handleClick,\n ...triggerAttributes,\n } as const;\n\n const ariaButtonTriggerChildProps = useARIAButtonProps(\n child?.type === 'button' || child?.type === 'a' ? child.type : 'div',\n {\n ...triggerChildProps,\n type: 'button',\n },\n );\n\n return {\n children: applyTriggerPropsToChildren(\n children,\n disableButtonEnhancement ? triggerChildProps : ariaButtonTriggerChildProps,\n ),\n };\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":"AACA,SAASA,kBAAkB,QAAQ,yBAAyB;AAC5D,SAASC,2BAA2B,EAAEC,eAAe,EAAEC,gBAAgB,QAAQ,2BAA2B;AAE1G,SAASC,yBAAyB,EAAEC,gCAAgC,QAAQ,gBAAgB;AAC5F,SAASC,kBAAkB,QAAQ,sBAAsB;AAEzD;;;;;;AAMA,OAAO,MAAMC,yBAAyB,GAAIC,KAAyB,IAAwB;EACzF,MAAMC,qBAAqB,GAAGJ,gCAAgC,EAAE;EAEhE,MAAM;IAAEK,QAAQ;IAAEC,wBAAwB,GAAG,KAAK;IAAEC,MAAM,GAAGH,qBAAqB,GAAG,OAAO,GAAG;EAAM,CAAE,GAAGD,KAAK;EAE/G,MAAMK,KAAK,GAAGX,eAAe,CAACQ,QAAQ,CAAC;EAEvC,MAAMI,iBAAiB,GAAGV,yBAAyB,CAACW,GAAG,IAAIA,GAAG,CAACD,iBAAiB,CAAC;EACjF,MAAME,IAAI,GAAGZ,yBAAyB,CAACW,GAAG,IAAIA,GAAG,CAACC,IAAI,CAAC;EAEvD,MAAM;IAAEC;EAAiB,CAAE,GAAGjB,kBAAkB,EAAE;EAElD,MAAMkB,WAAW,GAAGf,gBAAgB,CACjCgB,KAA+E,IAAI;;IAClF,WAAK,aAALN,KAAK,6BAALA,KAAK,CAAEL,KAAK,EAACY,OAAO,mDAAGD,KAAK,CAAC;IAC7B,IAAI,CAACA,KAAK,CAACE,kBAAkB,EAAE,EAAE;MAC/BP,iBAAiB,CAAC;QAChBK,KAAK;QACLG,IAAI,EAAE,cAAc;QACpBN,IAAI,EAAEJ,MAAM,KAAK;OAClB,CAAC;;EAEN,CAAC,CACF;EAED,MAAMW,iBAAiB,GAAG;IACxB,IAAGV,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEL,KAAK;IACf,eAAe,EAAEQ,IAAI;IACrBQ,GAAG,EAAEX,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEW,GAAG;IACfJ,OAAO,EAAEF,WAAW;IACpB,GAAGD;GACK;EAEV,MAAMQ,2BAA2B,GAAGnB,kBAAkB,CACpD,MAAK,aAALO,KAAK,uBAALA,KAAK,CAAES,IAAI,MAAK,QAAQ,IAAI,MAAK,aAALT,KAAK,uBAALA,KAAK,CAAES,IAAI,MAAK,GAAG,GAAGT,KAAK,CAACS,IAAI,GAAG,KAAK,EACpE;IACE,GAAGC,iBAAiB;IACpBD,IAAI,EAAE;GACP,CACF;EAED,OAAO;IACLZ,QAAQ,EAAET,2BAA2B,CACnCS,QAAQ,EACRC,wBAAwB,GAAGY,iBAAiB,GAAGE,2BAA2B;GAE7E;AACH,CAAC","names":["useModalAttributes","applyTriggerPropsToChildren","getTriggerChild","useEventCallback","useDialogContext_unstable","useDialogSurfaceContext_unstable","useARIAButtonProps","useDialogTrigger_unstable","props","isInsideSurfaceDialog","children","disableButtonEnhancement","action","child","requestOpenChange","ctx","open","triggerAttributes","handleClick","event","onClick","isDefaultPrevented","type","triggerChildProps","ref","ariaButtonTriggerChildProps"],"sourceRoot":"../src/","sources":["packages/react-components/react-dialog/src/components/DialogTrigger/useDialogTrigger.ts"],"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"]}
@@ -6,13 +6,11 @@ const defaultContextValue = {
6
6
  dialogRef: {
7
7
  current: null
8
8
  },
9
-
10
9
  requestOpenChange() {
11
10
  /* noop */
12
11
  }
13
-
14
- }; // Contexts should default to undefined
15
-
12
+ };
13
+ // Contexts should default to undefined
16
14
  export const DialogContext = /*#__PURE__*/createContext(undefined);
17
15
  export const DialogProvider = DialogContext.Provider;
18
16
  export const useDialogContext_unstable = selector => useContextSelector(DialogContext, (ctx = defaultContextValue) => selector(ctx));
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-dialog/src/contexts/dialogContext.ts"],"names":[],"mappings":"AACA,SAAS,aAAT,EAAyC,kBAAzC,QAAmE,kCAAnE;AAiBA,MAAM,mBAAmB,GAAuB;EAC9C,IAAI,EAAE,KADwC;EAE9C,SAAS,EAAE,OAFmC;EAG9C,cAAc,EAAE,KAH8B;EAI9C,SAAS,EAAE;IAAE,OAAO,EAAE;EAAX,CAJmC;;EAK9C,iBAAiB,GAAA;IACf;EACD;;AAP6C,CAAhD,C,CAUA;;AACA,OAAO,MAAM,aAAa,gBAA4C,aAAa,CACjF,SADiF,CAA5E;AAIP,OAAO,MAAM,cAAc,GAAG,aAAa,CAAC,QAArC;AACP,OAAO,MAAM,yBAAyB,GAAO,QAAJ,IACvC,kBAAkB,CAAC,aAAD,EAAgB,CAAC,GAAG,GAAG,mBAAP,KAA+B,QAAQ,CAAC,GAAD,CAAvD,CADb","sourcesContent":["import * as React from 'react';\nimport { createContext, ContextSelector, useContextSelector } from '@fluentui/react-context-selector';\nimport { DialogSurfaceElement } from '../DialogSurface';\nimport type { Context } from '@fluentui/react-context-selector';\nimport type { DialogModalType, DialogOpenChangeData } from '../Dialog';\n\nexport type DialogContextValue = {\n open: boolean;\n dialogTitleId?: string;\n isNestedDialog: boolean;\n dialogRef: React.Ref<DialogSurfaceElement>;\n modalType: DialogModalType;\n /**\n * Requests dialog main component to update it's internal open state\n */\n requestOpenChange: (data: DialogOpenChangeData) => void;\n};\n\nconst defaultContextValue: DialogContextValue = {\n open: false,\n modalType: 'modal',\n isNestedDialog: false,\n dialogRef: { current: null },\n requestOpenChange() {\n /* noop */\n },\n};\n\n// Contexts should default to undefined\nexport const DialogContext: Context<DialogContextValue | undefined> = createContext<DialogContextValue | undefined>(\n undefined,\n);\n\nexport const DialogProvider = DialogContext.Provider;\nexport const useDialogContext_unstable = <T>(selector: ContextSelector<DialogContextValue, T>): T =>\n useContextSelector(DialogContext, (ctx = defaultContextValue) => selector(ctx));\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":"AACA,SAASA,aAAa,EAAmBC,kBAAkB,QAAQ,kCAAkC;AAiBrG,MAAMC,mBAAmB,GAAuB;EAC9CC,IAAI,EAAE,KAAK;EACXC,SAAS,EAAE,OAAO;EAClBC,cAAc,EAAE,KAAK;EACrBC,SAAS,EAAE;IAAEC,OAAO,EAAE;EAAI,CAAE;EAC5BC,iBAAiB;IACf;EAAA;CAEH;AAED;AACA,OAAO,MAAMC,aAAa,gBAA4CT,aAAa,CACjFU,SAAS,CACV;AAED,OAAO,MAAMC,cAAc,GAAGF,aAAa,CAACG,QAAQ;AACpD,OAAO,MAAMC,yBAAyB,GAAOC,QAAgD,IAC3Fb,kBAAkB,CAACQ,aAAa,EAAE,CAACM,GAAG,GAAGb,mBAAmB,KAAKY,QAAQ,CAACC,GAAG,CAAC,CAAC","names":["createContext","useContextSelector","defaultContextValue","open","modalType","isNestedDialog","dialogRef","current","requestOpenChange","DialogContext","undefined","DialogProvider","Provider","useDialogContext_unstable","selector","ctx"],"sourceRoot":"../src/","sources":["packages/react-components/react-dialog/src/contexts/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';\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"]}
@@ -4,7 +4,6 @@ export const DialogSurfaceContext = /*#__PURE__*/createContext(undefined);
4
4
  export const DialogSurfaceProvider = DialogSurfaceContext.Provider;
5
5
  export const useDialogSurfaceContext_unstable = () => {
6
6
  var _a;
7
-
8
7
  return (_a = useContext(DialogSurfaceContext)) !== null && _a !== void 0 ? _a : defaultContextValue;
9
8
  };
10
9
  //# sourceMappingURL=dialogSurfaceContext.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-dialog/src/contexts/dialogSurfaceContext.ts"],"names":[],"mappings":"AAAA,SAAS,aAAT,EAAwB,UAAxB,QAA0C,OAA1C;AAIA,MAAM,mBAAmB,GAA8B,KAAvD;AAEA,OAAO,MAAM,oBAAoB,gBAAG,aAAa,CAAwC,SAAxC,CAA1C;AAEP,OAAO,MAAM,qBAAqB,GAAG,oBAAoB,CAAC,QAAnD;AAEP,OAAO,MAAM,gCAAgC,GAAG,MAAK;EAAA,IAAA,EAAA;;EAAC,OAAA,CAAA,EAAA,GAAA,UAAU,CAAC,oBAAD,CAAV,MAAgC,IAAhC,IAAgC,EAAA,KAAA,KAAA,CAAhC,GAAgC,EAAhC,GAAoC,mBAApC;AAAuD,CAAtG","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"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,OAAO;AAIjD,MAAMC,mBAAmB,GAA8B,KAAK;AAE5D,OAAO,MAAMC,oBAAoB,gBAAGH,aAAa,CAAwCI,SAAS,CAAC;AAEnG,OAAO,MAAMC,qBAAqB,GAAGF,oBAAoB,CAACG,QAAQ;AAElE,OAAO,MAAMC,gCAAgC,GAAG,MAAK;EAAA;EAAC,uBAAU,CAACJ,oBAAoB,CAAC,mCAAID,mBAAmB;AAAA","names":["createContext","useContext","defaultContextValue","DialogSurfaceContext","undefined","DialogSurfaceProvider","Provider","useDialogSurfaceContext_unstable"],"sourceRoot":"../src/","sources":["packages/react-components/react-dialog/src/contexts/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"]}
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-dialog/src/index.ts"],"names":[],"mappings":"AAAA,SAAS,MAAT,EAAiB,qBAAjB,EAAwC,kBAAxC,QAAkE,UAAlE;AAUA,SAAS,aAAT,EAAwB,yBAAxB,EAAmD,4BAAnD,QAAuF,iBAAvF;AAQA,SACE,aADF,EAEE,uBAFF,EAGE,yBAHF,EAIE,+BAJF,EAKE,4BALF,QAMO,iBANP;AAcA,SACE,UADF,EAEE,oBAFF,EAGE,sBAHF,EAIE,4BAJF,EAKE,yBALF,QAMO,cANP;AASA,SACE,WADF,EAEE,qBAFF,EAGE,uBAHF,EAIE,6BAJF,EAKE,0BALF,QAMO,eANP;AASA,SACE,aADF,EAEE,uBAFF,EAGE,yBAHF,EAIE,+BAJF,EAKE,4BALF,QAMO,iBANP;AASA,SACE,aADF,EAEE,uBAFF,EAGE,yBAHF,EAIE,+BAJF,EAKE,4BALF,QAMO,iBANP","sourcesContent":["export { Dialog, renderDialog_unstable, useDialog_unstable } from './Dialog';\nexport type {\n DialogSlots,\n DialogProps,\n DialogState,\n DialogOpenChangeData,\n DialogOpenChangeEvent,\n DialogOpenChangeEventHandler,\n} from './Dialog';\n\nexport { DialogTrigger, useDialogTrigger_unstable, renderDialogTrigger_unstable } from './DialogTrigger';\nexport type {\n DialogTriggerProps,\n DialogTriggerChildProps,\n DialogTriggerState,\n DialogTriggerAction,\n} from './DialogTrigger';\n\nexport {\n DialogActions,\n dialogActionsClassNames,\n useDialogActions_unstable,\n useDialogActionsStyles_unstable,\n renderDialogActions_unstable,\n} from './DialogActions';\nexport type {\n DialogActionsProps,\n DialogActionsSlots,\n DialogActionsState,\n DialogActionsPosition,\n} from './DialogActions';\n\nexport {\n DialogBody,\n dialogBodyClassNames,\n useDialogBody_unstable,\n useDialogBodyStyles_unstable,\n renderDialogBody_unstable,\n} from './DialogBody';\nexport type { DialogBodyProps, DialogBodySlots, DialogBodyState } from './DialogBody';\n\nexport {\n DialogTitle,\n dialogTitleClassNames,\n useDialogTitle_unstable,\n useDialogTitleStyles_unstable,\n renderDialogTitle_unstable,\n} from './DialogTitle';\nexport type { DialogTitleProps, DialogTitleSlots, DialogTitleState } from './DialogTitle';\n\nexport {\n DialogSurface,\n dialogSurfaceClassNames,\n useDialogSurface_unstable,\n useDialogSurfaceStyles_unstable,\n renderDialogSurface_unstable,\n} from './DialogSurface';\nexport type { DialogSurfaceProps, DialogSurfaceSlots, DialogSurfaceState, DialogSurfaceElement } from './DialogSurface';\n\nexport {\n DialogContent,\n dialogContentClassNames,\n useDialogContent_unstable,\n useDialogContentStyles_unstable,\n renderDialogContent_unstable,\n} from './DialogContent';\nexport type { DialogContentProps, DialogContentSlots, DialogContentState } from './DialogContent';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":"AAAA,SAASA,MAAM,EAAEC,qBAAqB,EAAEC,kBAAkB,QAAQ,UAAU;AAU5E,SAASC,aAAa,EAAEC,yBAAyB,EAAEC,4BAA4B,QAAQ,iBAAiB;AAQxG,SACEC,aAAa,EACbC,uBAAuB,EACvBC,yBAAyB,EACzBC,+BAA+B,EAC/BC,4BAA4B,QACvB,iBAAiB;AAQxB,SACEC,UAAU,EACVC,oBAAoB,EACpBC,sBAAsB,EACtBC,4BAA4B,EAC5BC,yBAAyB,QACpB,cAAc;AAGrB,SACEC,WAAW,EACXC,qBAAqB,EACrBC,uBAAuB,EACvBC,6BAA6B,EAC7BC,0BAA0B,QACrB,eAAe;AAGtB,SACEC,aAAa,EACbC,uBAAuB,EACvBC,yBAAyB,EACzBC,+BAA+B,EAC/BC,4BAA4B,QACvB,iBAAiB;AAGxB,SACEC,aAAa,EACbC,uBAAuB,EACvBC,yBAAyB,EACzBC,+BAA+B,EAC/BC,4BAA4B,QACvB,iBAAiB","names":["Dialog","renderDialog_unstable","useDialog_unstable","DialogTrigger","useDialogTrigger_unstable","renderDialogTrigger_unstable","DialogActions","dialogActionsClassNames","useDialogActions_unstable","useDialogActionsStyles_unstable","renderDialogActions_unstable","DialogBody","dialogBodyClassNames","useDialogBody_unstable","useDialogBodyStyles_unstable","renderDialogBody_unstable","DialogTitle","dialogTitleClassNames","useDialogTitle_unstable","useDialogTitleStyles_unstable","renderDialogTitle_unstable","DialogSurface","dialogSurfaceClassNames","useDialogSurface_unstable","useDialogSurfaceStyles_unstable","renderDialogSurface_unstable","DialogContent","dialogContentClassNames","useDialogContent_unstable","useDialogContentStyles_unstable","renderDialogContent_unstable"],"sourceRoot":"../src/","sources":["packages/react-components/react-dialog/src/index.ts"],"sourcesContent":["export { Dialog, renderDialog_unstable, useDialog_unstable } from './Dialog';\nexport type {\n DialogSlots,\n DialogProps,\n DialogState,\n DialogOpenChangeData,\n DialogOpenChangeEvent,\n DialogOpenChangeEventHandler,\n} from './Dialog';\n\nexport { DialogTrigger, useDialogTrigger_unstable, renderDialogTrigger_unstable } from './DialogTrigger';\nexport type {\n DialogTriggerProps,\n DialogTriggerChildProps,\n DialogTriggerState,\n DialogTriggerAction,\n} from './DialogTrigger';\n\nexport {\n DialogActions,\n dialogActionsClassNames,\n useDialogActions_unstable,\n useDialogActionsStyles_unstable,\n renderDialogActions_unstable,\n} from './DialogActions';\nexport type {\n DialogActionsProps,\n DialogActionsSlots,\n DialogActionsState,\n DialogActionsPosition,\n} from './DialogActions';\n\nexport {\n DialogBody,\n dialogBodyClassNames,\n useDialogBody_unstable,\n useDialogBodyStyles_unstable,\n renderDialogBody_unstable,\n} from './DialogBody';\nexport type { DialogBodyProps, DialogBodySlots, DialogBodyState } from './DialogBody';\n\nexport {\n DialogTitle,\n dialogTitleClassNames,\n useDialogTitle_unstable,\n useDialogTitleStyles_unstable,\n renderDialogTitle_unstable,\n} from './DialogTitle';\nexport type { DialogTitleProps, DialogTitleSlots, DialogTitleState } from './DialogTitle';\n\nexport {\n DialogSurface,\n dialogSurfaceClassNames,\n useDialogSurface_unstable,\n useDialogSurfaceStyles_unstable,\n renderDialogSurface_unstable,\n} from './DialogSurface';\nexport type { DialogSurfaceProps, DialogSurfaceSlots, DialogSurfaceState, DialogSurfaceElement } from './DialogSurface';\n\nexport {\n DialogContent,\n dialogContentClassNames,\n useDialogContent_unstable,\n useDialogContentStyles_unstable,\n renderDialogContent_unstable,\n} from './DialogContent';\nexport type { DialogContentProps, DialogContentSlots, DialogContentState } from './DialogContent';\n"]}
@@ -2,7 +2,6 @@ import { Escape } from '@fluentui/keyboard-keys';
2
2
  /**
3
3
  * Checks if keydown event is a proper Escape key dismiss
4
4
  */
5
-
6
5
  export function isEscapeKeyDismiss(event, modalType) {
7
6
  return event.key === Escape && modalType !== 'alert' && !event.isDefaultPrevented();
8
7
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-dialog/src/utils/isEscapeKeyDown.ts"],"names":[],"mappings":"AACA,SAAS,MAAT,QAAuB,yBAAvB;AAIA;;AAEG;;AACH,OAAM,SAAU,kBAAV,CACJ,KADI,EAEJ,SAFI,EAEsB;EAE1B,OAAO,KAAK,CAAC,GAAN,KAAc,MAAd,IAAwB,SAAS,KAAK,OAAtC,IAAiD,CAAC,KAAK,CAAC,kBAAN,EAAzD;AACD","sourcesContent":["import * as React from 'react';\nimport { Escape } from '@fluentui/keyboard-keys';\nimport type { DialogModalType } from '../components/Dialog/Dialog.types';\nimport { DialogSurfaceElement } from '../DialogSurface';\n\n/**\n * Checks if keydown event is a proper Escape key dismiss\n */\nexport function isEscapeKeyDismiss(\n event: React.KeyboardEvent<DialogSurfaceElement>,\n modalType: DialogModalType,\n): boolean {\n return event.key === Escape && modalType !== 'alert' && !event.isDefaultPrevented();\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":"AACA,SAASA,MAAM,QAAQ,yBAAyB;AAIhD;;;AAGA,OAAM,SAAUC,kBAAkB,CAChCC,KAAgD,EAChDC,SAA0B;EAE1B,OAAOD,KAAK,CAACE,GAAG,KAAKJ,MAAM,IAAIG,SAAS,KAAK,OAAO,IAAI,CAACD,KAAK,CAACG,kBAAkB,EAAE;AACrF","names":["Escape","isEscapeKeyDismiss","event","modalType","key","isDefaultPrevented"],"sourceRoot":"../src/","sources":["packages/react-components/react-dialog/src/utils/isEscapeKeyDown.ts"],"sourcesContent":["import * as React from 'react';\nimport { Escape } from '@fluentui/keyboard-keys';\nimport type { DialogModalType } from '../components/Dialog/Dialog.types';\nimport { DialogSurfaceElement } from '../DialogSurface';\n\n/**\n * Checks if keydown event is a proper Escape key dismiss\n */\nexport function isEscapeKeyDismiss(\n event: React.KeyboardEvent<DialogSurfaceElement>,\n modalType: DialogModalType,\n): boolean {\n return event.key === Escape && modalType !== 'alert' && !event.isDefaultPrevented();\n}\n"]}
@@ -4,7 +4,6 @@ const disableScrollElementProp = '__fluentDisableScrollElement';
4
4
  /**
5
5
  * hook that disables body scrolling through `overflow: hidden` CSS property
6
6
  */
7
-
8
7
  export function useDisableBodyScroll() {
9
8
  const {
10
9
  targetDocument
@@ -20,37 +19,29 @@ export function useDisableBodyScroll() {
20
19
  * @param target - element to disable scrolling from
21
20
  * @returns a method for enabling scrolling again
22
21
  */
23
-
24
22
  export function disableScroll(target) {
25
23
  var _a, _b;
26
-
27
24
  const {
28
25
  clientWidth
29
26
  } = target.ownerDocument.documentElement;
30
27
  const innerWidth = (_b = (_a = target.ownerDocument.defaultView) === null || _a === void 0 ? void 0 : _a.innerWidth) !== null && _b !== void 0 ? _b : 0;
31
28
  assertIsDisableScrollElement(target);
32
-
33
29
  if (target[disableScrollElementProp].count === 0) {
34
30
  target.style.overflow = 'hidden';
35
31
  target.style.paddingRight = `${innerWidth - clientWidth}px`;
36
32
  }
37
-
38
33
  target[disableScrollElementProp].count++;
39
34
  return () => {
40
35
  target[disableScrollElementProp].count--;
41
-
42
36
  if (target[disableScrollElementProp].count === 0) {
43
37
  target.style.overflow = target[disableScrollElementProp].previousOverflowStyle;
44
38
  target.style.paddingRight = target[disableScrollElementProp].previousPaddingRightStyle;
45
39
  }
46
40
  };
47
41
  }
48
-
49
42
  function assertIsDisableScrollElement(element) {
50
43
  var _a;
51
-
52
44
  var _b;
53
-
54
45
  (_a = (_b = element)[disableScrollElementProp]) !== null && _a !== void 0 ? _a : _b[disableScrollElementProp] = {
55
46
  count: 0,
56
47
  previousOverflowStyle: element.style.overflow,
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-dialog/src/utils/useDisableBodyScroll.ts"],"names":[],"mappings":"AAAA,SAAS,kBAAT,QAAmC,iCAAnC;AACA,SAAS,WAAT,QAA4B,OAA5B;AAEA,MAAM,wBAAwB,GAAG,8BAAjC;AAUA;;AAEG;;AACH,OAAM,SAAU,oBAAV,GAA8B;EAClC,MAAM;IAAE;EAAF,IAAqB,kBAAkB,EAA7C;EACA,OAAO,WAAW,CAAC,MAAK;IACtB,IAAI,cAAJ,EAAoB;MAClB,OAAO,aAAa,CAAC,cAAc,CAAC,IAAhB,CAApB;IACD;EACF,CAJiB,EAIf,CAAC,cAAD,CAJe,CAAlB;AAKD;AAED;;;;AAIG;;AACH,OAAM,SAAU,aAAV,CAAwB,MAAxB,EAA2C;;;EAC/C,MAAM;IAAE;EAAF,IAAkB,MAAM,CAAC,aAAP,CAAqB,eAA7C;EACA,MAAM,UAAU,GAAG,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,MAAM,CAAC,aAAP,CAAqB,WAArB,MAAgC,IAAhC,IAAgC,EAAA,KAAA,KAAA,CAAhC,GAAgC,KAAA,CAAhC,GAAgC,EAAA,CAAE,UAAlC,MAA4C,IAA5C,IAA4C,EAAA,KAAA,KAAA,CAA5C,GAA4C,EAA5C,GAAgD,CAAnE;EACA,4BAA4B,CAAC,MAAD,CAA5B;;EACA,IAAI,MAAM,CAAC,wBAAD,CAAN,CAAiC,KAAjC,KAA2C,CAA/C,EAAkD;IAChD,MAAM,CAAC,KAAP,CAAa,QAAb,GAAwB,QAAxB;IACA,MAAM,CAAC,KAAP,CAAa,YAAb,GAA4B,GAAG,UAAU,GAAG,WAAW,IAAvD;EACD;;EACD,MAAM,CAAC,wBAAD,CAAN,CAAiC,KAAjC;EACA,OAAO,MAAK;IACV,MAAM,CAAC,wBAAD,CAAN,CAAiC,KAAjC;;IACA,IAAI,MAAM,CAAC,wBAAD,CAAN,CAAiC,KAAjC,KAA2C,CAA/C,EAAkD;MAChD,MAAM,CAAC,KAAP,CAAa,QAAb,GAAwB,MAAM,CAAC,wBAAD,CAAN,CAAiC,qBAAzD;MACA,MAAM,CAAC,KAAP,CAAa,YAAb,GAA4B,MAAM,CAAC,wBAAD,CAAN,CAAiC,yBAA7D;IACD;EACF,CAND;AAOD;;AAED,SAAS,4BAAT,CAAsC,OAAtC,EAA0D;;;;;EACxD,CAAA,EAAA,GAAA,CAAA,EAAA,GAAC,OAAD,EAAwC,wBAAxC,CAAA,MAAgE,IAAhE,IAAgE,EAAA,KAAA,KAAA,CAAhE,GAAgE,EAAhE,GAAgE,EAAA,CAAxB,wBAAwB,CAAA,GAAM;IACpE,KAAK,EAAE,CAD6D;IAEpE,qBAAqB,EAAE,OAAO,CAAC,KAAR,CAAc,QAF+B;IAGpE,yBAAyB,EAAE,OAAO,CAAC,KAAR,CAAc;EAH2B,CAAtE;AAKD","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"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":"AAAA,SAASA,kBAAkB,QAAQ,iCAAiC;AACpE,SAASC,WAAW,QAAQ,OAAO;AAEnC,MAAMC,wBAAwB,GAAG,8BAAuC;AAUxE;;;AAGA,OAAM,SAAUC,oBAAoB;EAClC,MAAM;IAAEC;EAAc,CAAE,GAAGJ,kBAAkB,EAAE;EAC/C,OAAOC,WAAW,CAAC,MAAK;IACtB,IAAIG,cAAc,EAAE;MAClB,OAAOC,aAAa,CAACD,cAAc,CAACE,IAAI,CAAC;;EAE7C,CAAC,EAAE,CAACF,cAAc,CAAC,CAAC;AACtB;AAEA;;;;;AAKA,OAAM,SAAUC,aAAa,CAACE,MAAmB;;EAC/C,MAAM;IAAEC;EAAW,CAAE,GAAGD,MAAM,CAACE,aAAa,CAACC,eAAe;EAC5D,MAAMC,UAAU,GAAG,kBAAM,CAACF,aAAa,CAACG,WAAW,0CAAED,UAAU,mCAAI,CAAC;EACpEE,4BAA4B,CAACN,MAAM,CAAC;EACpC,IAAIA,MAAM,CAACL,wBAAwB,CAAC,CAACY,KAAK,KAAK,CAAC,EAAE;IAChDP,MAAM,CAACQ,KAAK,CAACC,QAAQ,GAAG,QAAQ;IAChCT,MAAM,CAACQ,KAAK,CAACE,YAAY,GAAG,GAAGN,UAAU,GAAGH,WAAW,IAAI;;EAE7DD,MAAM,CAACL,wBAAwB,CAAC,CAACY,KAAK,EAAE;EACxC,OAAO,MAAK;IACVP,MAAM,CAACL,wBAAwB,CAAC,CAACY,KAAK,EAAE;IACxC,IAAIP,MAAM,CAACL,wBAAwB,CAAC,CAACY,KAAK,KAAK,CAAC,EAAE;MAChDP,MAAM,CAACQ,KAAK,CAACC,QAAQ,GAAGT,MAAM,CAACL,wBAAwB,CAAC,CAACgB,qBAAqB;MAC9EX,MAAM,CAACQ,KAAK,CAACE,YAAY,GAAGV,MAAM,CAACL,wBAAwB,CAAC,CAACiB,yBAAyB;;EAE1F,CAAC;AACH;AAEA,SAASN,4BAA4B,CAACO,OAAoB;;;EACxD,YAACA,OAAsC,EAAClB,wBAAwB,uCAAxBA,wBAAwB,IAAM;IACpEY,KAAK,EAAE,CAAC;IACRI,qBAAqB,EAAEE,OAAO,CAACL,KAAK,CAACC,QAAQ;IAC7CG,yBAAyB,EAAEC,OAAO,CAACL,KAAK,CAACE;GAC1C;AACH","names":["useFluent_unstable","useCallback","disableScrollElementProp","useDisableBodyScroll","targetDocument","disableScroll","body","target","clientWidth","ownerDocument","documentElement","innerWidth","defaultView","assertIsDisableScrollElement","count","style","overflow","paddingRight","previousOverflowStyle","previousPaddingRightStyle","element"],"sourceRoot":"../src/","sources":["packages/react-components/react-dialog/src/utils/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"]}
@@ -4,7 +4,6 @@ import { useFluent_unstable } from '@fluentui/react-shared-contexts';
4
4
  /**
5
5
  * Focus first element on content when dialog is opened,
6
6
  */
7
-
8
7
  export function useFocusFirstElement(open, modalType) {
9
8
  const {
10
9
  findFirstFocusable
@@ -16,19 +15,15 @@ export function useFocusFirstElement(open, modalType) {
16
15
  const triggerRef = React.useRef();
17
16
  React.useEffect(() => {
18
17
  var _a, _b;
19
-
20
18
  if (!open) {
21
19
  return (_a = triggerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
22
20
  }
23
-
24
21
  triggerRef.current = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement;
25
22
  const element = dialogRef.current && findFirstFocusable(dialogRef.current);
26
-
27
23
  if (element) {
28
24
  element.focus();
29
25
  } else {
30
26
  (_b = dialogRef.current) === null || _b === void 0 ? void 0 : _b.focus(); // https://github.com/microsoft/fluentui/issues/25150
31
-
32
27
  if (process.env.NODE_ENV !== 'production') {
33
28
  // eslint-disable-next-line no-console
34
29
  console.warn(['@fluentui/react-dialog: a Dialog should have at least one focusable element inside DialogSurface.', 'Please add at least a close button either on `DialogTitle` action slot or inside `DialogActions`'].join('\n'));
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-dialog/src/utils/useFocusFirstElement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,eAAT,QAAgC,yBAAhC;AACA,SAAS,kBAAT,QAAmC,iCAAnC;AAIA;;AAEG;;AACH,OAAM,SAAU,oBAAV,CAA+B,IAA/B,EAA8C,SAA9C,EAAwE;EAC5E,MAAM;IAAE;EAAF,IAAyB,eAAe,EAA9C;EACA,MAAM;IAAE;EAAF,IAAqB,kBAAkB,EAA7C;EACA,MAAM,SAAS,GAAG,KAAK,CAAC,MAAN,CAAmC,IAAnC,CAAlB;EACA,MAAM,UAAU,GAAG,KAAK,CAAC,MAAN,EAAnB;EAEA,KAAK,CAAC,SAAN,CAAgB,MAAK;;;IACnB,IAAI,CAAC,IAAL,EAAW;MACT,OAAO,CAAA,EAAA,GAAA,UAAU,CAAC,OAAX,MAAkB,IAAlB,IAAkB,EAAA,KAAA,KAAA,CAAlB,GAAkB,KAAA,CAAlB,GAAkB,EAAA,CAAE,KAAF,EAAzB;IACD;;IACD,UAAU,CAAC,OAAX,GAAqB,cAAc,KAAA,IAAd,IAAA,cAAc,KAAA,KAAA,CAAd,GAAc,KAAA,CAAd,GAAA,cAAc,CAAE,aAArC;IACA,MAAM,OAAO,GAAG,SAAS,CAAC,OAAV,IAAqB,kBAAkB,CAAC,SAAS,CAAC,OAAX,CAAvD;;IACA,IAAI,OAAJ,EAAa;MACX,OAAO,CAAC,KAAR;IACD,CAFD,MAEO;MACL,CAAA,EAAA,GAAA,SAAS,CAAC,OAAV,MAAiB,IAAjB,IAAiB,EAAA,KAAA,KAAA,CAAjB,GAAiB,KAAA,CAAjB,GAAiB,EAAA,CAAE,KAAF,EAAjB,CADK,CACuB;;MAC5B,IAAI,OAAO,CAAC,GAAR,CAAY,QAAZ,KAAyB,YAA7B,EAA2C;QACzC;QACA,OAAO,CAAC,IAAR,CACE,CACE,mGADF,EAEE,kGAFF,EAGE,IAHF,CAGO,IAHP,CADF;MAMD;IACF;EACF,CApBD,EAoBG,CAAC,kBAAD,EAAqB,IAArB,EAA2B,SAA3B,EAAsC,cAAtC,CApBH;EAsBA,OAAO,SAAP;AACD","sourcesContent":["import * as React from 'react';\nimport { useFocusFinders } from '@fluentui/react-tabster';\nimport { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport type { DialogSurfaceElement } from '../DialogSurface';\nimport type { DialogModalType } from '../Dialog';\n\n/**\n * Focus first element on content when dialog is opened,\n */\nexport function useFocusFirstElement(open: boolean, modalType: DialogModalType) {\n const { findFirstFocusable } = useFocusFinders();\n const { targetDocument } = useFluent_unstable();\n const dialogRef = React.useRef<DialogSurfaceElement>(null);\n const triggerRef = React.useRef<HTMLElement>();\n\n React.useEffect(() => {\n if (!open) {\n return triggerRef.current?.focus();\n }\n triggerRef.current = targetDocument?.activeElement as HTMLElement | undefined;\n const element = dialogRef.current && findFirstFocusable(dialogRef.current);\n if (element) {\n element.focus();\n } else {\n dialogRef.current?.focus(); // https://github.com/microsoft/fluentui/issues/25150\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.warn(\n [\n '@fluentui/react-dialog: a Dialog should have at least one focusable element inside DialogSurface.',\n 'Please add at least a close button either on `DialogTitle` action slot or inside `DialogActions`',\n ].join('\\n'),\n );\n }\n }\n }, [findFirstFocusable, open, modalType, targetDocument]);\n\n return dialogRef;\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,eAAe,QAAQ,yBAAyB;AACzD,SAASC,kBAAkB,QAAQ,iCAAiC;AAIpE;;;AAGA,OAAM,SAAUC,oBAAoB,CAACC,IAAa,EAAEC,SAA0B;EAC5E,MAAM;IAAEC;EAAkB,CAAE,GAAGL,eAAe,EAAE;EAChD,MAAM;IAAEM;EAAc,CAAE,GAAGL,kBAAkB,EAAE;EAC/C,MAAMM,SAAS,GAAGR,KAAK,CAACS,MAAM,CAAuB,IAAI,CAAC;EAC1D,MAAMC,UAAU,GAAGV,KAAK,CAACS,MAAM,EAAe;EAE9CT,KAAK,CAACW,SAAS,CAAC,MAAK;;IACnB,IAAI,CAACP,IAAI,EAAE;MACT,OAAO,gBAAU,CAACQ,OAAO,0CAAEC,KAAK,EAAE;;IAEpCH,UAAU,CAACE,OAAO,GAAGL,cAAc,aAAdA,cAAc,uBAAdA,cAAc,CAAEO,aAAwC;IAC7E,MAAMC,OAAO,GAAGP,SAAS,CAACI,OAAO,IAAIN,kBAAkB,CAACE,SAAS,CAACI,OAAO,CAAC;IAC1E,IAAIG,OAAO,EAAE;MACXA,OAAO,CAACF,KAAK,EAAE;KAChB,MAAM;MACL,eAAS,CAACD,OAAO,0CAAEC,KAAK,EAAE,CAAC,CAAC;MAC5B,IAAIG,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;QACzC;QACAC,OAAO,CAACC,IAAI,CACV,CACE,mGAAmG,EACnG,kGAAkG,CACnG,CAACC,IAAI,CAAC,IAAI,CAAC,CACb;;;EAGP,CAAC,EAAE,CAACf,kBAAkB,EAAEF,IAAI,EAAEC,SAAS,EAAEE,cAAc,CAAC,CAAC;EAEzD,OAAOC,SAAS;AAClB","names":["React","useFocusFinders","useFluent_unstable","useFocusFirstElement","open","modalType","findFirstFocusable","targetDocument","dialogRef","useRef","triggerRef","useEffect","current","focus","activeElement","element","process","env","NODE_ENV","console","warn","join"],"sourceRoot":"../src/","sources":["packages/react-components/react-dialog/src/utils/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 const triggerRef = React.useRef<HTMLElement>();\n\n React.useEffect(() => {\n if (!open) {\n return triggerRef.current?.focus();\n }\n triggerRef.current = targetDocument?.activeElement as HTMLElement | undefined;\n const element = dialogRef.current && findFirstFocusable(dialogRef.current);\n if (element) {\n element.focus();\n } else {\n dialogRef.current?.focus(); // https://github.com/microsoft/fluentui/issues/25150\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.warn(\n [\n '@fluentui/react-dialog: a Dialog should have at least one focusable element inside DialogSurface.',\n 'Please add at least a close button either on `DialogTitle` action slot or inside `DialogActions`',\n ].join('\\n'),\n );\n }\n }\n }, [findFirstFocusable, open, modalType, targetDocument]);\n\n return dialogRef;\n}\n"]}
@@ -3,8 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
6
  const tslib_1 = /*#__PURE__*/require("tslib");
8
-
9
7
  tslib_1.__exportStar(require("./components/Dialog/index"), exports);
10
8
  //# sourceMappingURL=Dialog.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-dialog/src/Dialog.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,2BAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/Dialog/index';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":";;;;;;AAAAA","names":["tslib_1"],"sourceRoot":"../src/","sources":["packages/react-components/react-dialog/src/Dialog.ts"],"sourcesContent":["export * from './components/Dialog/index';\n"]}
@@ -3,8 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
6
  const tslib_1 = /*#__PURE__*/require("tslib");
8
-
9
7
  tslib_1.__exportStar(require("./components/DialogActions/index"), exports);
10
8
  //# sourceMappingURL=DialogActions.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-dialog/src/DialogActions.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kCAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/DialogActions/index';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":";;;;;;AAAAA","names":["tslib_1"],"sourceRoot":"../src/","sources":["packages/react-components/react-dialog/src/DialogActions.ts"],"sourcesContent":["export * from './components/DialogActions/index';\n"]}
@@ -3,8 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
6
  const tslib_1 = /*#__PURE__*/require("tslib");
8
-
9
7
  tslib_1.__exportStar(require("./components/DialogBody/index"), exports);
10
8
  //# sourceMappingURL=DialogBody.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-dialog/src/DialogBody.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,+BAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/DialogBody/index';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":";;;;;;AAAAA","names":["tslib_1"],"sourceRoot":"../src/","sources":["packages/react-components/react-dialog/src/DialogBody.ts"],"sourcesContent":["export * from './components/DialogBody/index';\n"]}
@@ -3,8 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
6
  const tslib_1 = /*#__PURE__*/require("tslib");
8
-
9
7
  tslib_1.__exportStar(require("./components/DialogContent/index"), exports);
10
8
  //# sourceMappingURL=DialogContent.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-dialog/src/DialogContent.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kCAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/DialogContent/index';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":";;;;;;AAAAA","names":["tslib_1"],"sourceRoot":"../src/","sources":["packages/react-components/react-dialog/src/DialogContent.ts"],"sourcesContent":["export * from './components/DialogContent/index';\n"]}
@@ -3,8 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
6
  const tslib_1 = /*#__PURE__*/require("tslib");
8
-
9
7
  tslib_1.__exportStar(require("./components/DialogSurface/index"), exports);
10
8
  //# sourceMappingURL=DialogSurface.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-dialog/src/DialogSurface.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kCAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/DialogSurface/index';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":";;;;;;AAAAA","names":["tslib_1"],"sourceRoot":"../src/","sources":["packages/react-components/react-dialog/src/DialogSurface.ts"],"sourcesContent":["export * from './components/DialogSurface/index';\n"]}
@@ -3,8 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
6
  const tslib_1 = /*#__PURE__*/require("tslib");
8
-
9
7
  tslib_1.__exportStar(require("./components/DialogTitle/index"), exports);
10
8
  //# sourceMappingURL=DialogTitle.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-dialog/src/DialogTitle.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,gCAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/DialogTitle/index';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":";;;;;;AAAAA","names":["tslib_1"],"sourceRoot":"../src/","sources":["packages/react-components/react-dialog/src/DialogTitle.ts"],"sourcesContent":["export * from './components/DialogTitle/index';\n"]}
@@ -3,8 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
6
  const tslib_1 = /*#__PURE__*/require("tslib");
8
-
9
7
  tslib_1.__exportStar(require("./components/DialogTrigger/index"), exports);
10
8
  //# sourceMappingURL=DialogTrigger.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-dialog/src/DialogTrigger.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kCAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/DialogTrigger/index';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":";;;;;;AAAAA","names":["tslib_1"],"sourceRoot":"../src/","sources":["packages/react-components/react-dialog/src/DialogTrigger.ts"],"sourcesContent":["export * from './components/DialogTrigger/index';\n"]}
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.Dialog = void 0;
7
-
8
7
  const React = /*#__PURE__*/require("react");
9
-
10
8
  const useDialog_1 = /*#__PURE__*/require("./useDialog");
11
-
12
9
  const renderDialog_1 = /*#__PURE__*/require("./renderDialog");
13
-
14
10
  const useDialogContextValues_1 = /*#__PURE__*/require("./useDialogContextValues");
15
11
  /**
16
12
  * The `Dialog` root level component serves as an interface for interaction with all possible behaviors exposed.
@@ -19,8 +15,6 @@ const useDialogContextValues_1 = /*#__PURE__*/require("./useDialogContextValues"
19
15
  * and a `DialogSurface` (or some component that will eventually render one of those compound components)
20
16
  * in this specific order
21
17
  */
22
-
23
-
24
18
  exports.Dialog = /*#__PURE__*/React.memo(props => {
25
19
  const state = useDialog_1.useDialog_unstable(props);
26
20
  const contextValues = useDialogContextValues_1.useDialogContextValues_unstable(state);
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-dialog/src/components/Dialog/Dialog.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,WAAA,gBAAA,OAAA,CAAA,aAAA,CAAA;;AACA,MAAA,cAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AAEA,MAAA,wBAAA,gBAAA,OAAA,CAAA,0BAAA,CAAA;AAEA;;;;;;AAMG;;;AACU,OAAA,CAAA,MAAA,gBAAgC,KAAK,CAAC,IAAN,CAAW,KAAK,IAAG;EAC9D,MAAM,KAAK,GAAG,WAAA,CAAA,kBAAA,CAAmB,KAAnB,CAAd;EACA,MAAM,aAAa,GAAG,wBAAA,CAAA,+BAAA,CAAgC,KAAhC,CAAtB;EAEA,OAAO,cAAA,CAAA,qBAAA,CAAsB,KAAtB,EAA6B,aAA7B,CAAP;AACD,CAL4C,CAAhC;AAOb,OAAA,CAAA,MAAA,CAAO,WAAP,GAAqB,QAArB","sourcesContent":["import * as React from 'react';\nimport { useDialog_unstable } from './useDialog';\nimport { renderDialog_unstable } from './renderDialog';\nimport type { DialogProps } from './Dialog.types';\nimport { useDialogContextValues_unstable } from './useDialogContextValues';\n\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 */\nexport const Dialog: React.FC<DialogProps> = React.memo(props => {\n const state = useDialog_unstable(props);\n const contextValues = useDialogContextValues_unstable(state);\n\n return renderDialog_unstable(state, contextValues);\n});\n\nDialog.displayName = 'Dialog';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":";;;;;;AAAA;AACA;AACA;AAEA;AAEA;;;;;;;AAOaA,cAAM,gBAA0BC,KAAK,CAACC,IAAI,CAACC,KAAK,IAAG;EAC9D,MAAMC,KAAK,GAAGC,8BAAkB,CAACF,KAAK,CAAC;EACvC,MAAMG,aAAa,GAAGC,wDAA+B,CAACH,KAAK,CAAC;EAE5D,OAAOI,oCAAqB,CAACJ,KAAK,EAAEE,aAAa,CAAC;AACpD,CAAC,CAAC;AAEFN,cAAM,CAACS,WAAW,GAAG,QAAQ","names":["exports","React","memo","props","state","useDialog_1","contextValues","useDialogContextValues_1","renderDialog_1","displayName"],"sourceRoot":"../src/","sources":["packages/react-components/react-dialog/src/components/Dialog/Dialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useDialog_unstable } from './useDialog';\nimport { renderDialog_unstable } from './renderDialog';\nimport type { DialogProps } from './Dialog.types';\nimport { useDialogContextValues_unstable } from './useDialogContextValues';\n\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 */\nexport const Dialog: React.FC<DialogProps> = React.memo(props => {\n const state = useDialog_unstable(props);\n const contextValues = useDialogContextValues_unstable(state);\n\n return renderDialog_unstable(state, contextValues);\n});\n\nDialog.displayName = 'Dialog';\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":"../src/"}
1
+ {"version":3,"mappings":"","names":[],"sourceRoot":"../src/","sources":[],"sourcesContent":[]}
@@ -3,14 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
6
  const tslib_1 = /*#__PURE__*/require("tslib");
8
-
9
7
  tslib_1.__exportStar(require("./Dialog"), exports);
10
-
11
8
  tslib_1.__exportStar(require("./Dialog.types"), exports);
12
-
13
9
  tslib_1.__exportStar(require("./renderDialog"), exports);
14
-
15
10
  tslib_1.__exportStar(require("./useDialog"), exports);
16
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-dialog/src/components/Dialog/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,UAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,gBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,gBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,aAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './Dialog';\nexport * from './Dialog.types';\nexport * from './renderDialog';\nexport * from './useDialog';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":";;;;;;AAAAA;AACAA;AACAA;AACAA","names":["tslib_1"],"sourceRoot":"../src/","sources":["packages/react-components/react-dialog/src/components/Dialog/index.ts"],"sourcesContent":["export * from './Dialog';\nexport * from './Dialog.types';\nexport * from './renderDialog';\nexport * from './useDialog';\n"]}
@@ -4,15 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.renderDialog_unstable = void 0;
7
-
8
7
  const React = /*#__PURE__*/require("react");
9
-
10
8
  const contexts_1 = /*#__PURE__*/require("../../contexts");
11
9
  /**
12
10
  * Render the final JSX of Dialog
13
11
  */
14
-
15
-
16
12
  const renderDialog_unstable = (state, contextValues) => {
17
13
  const {
18
14
  content,
@@ -24,6 +20,5 @@ const renderDialog_unstable = (state, contextValues) => {
24
20
  value: contextValues.dialogSurface
25
21
  }, trigger, content));
26
22
  };
27
-
28
23
  exports.renderDialog_unstable = renderDialog_unstable;
29
24
  //# sourceMappingURL=renderDialog.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-dialog/src/components/Dialog/renderDialog.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,UAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,qBAAqB,GAAG,CAAC,KAAD,EAAqB,aAArB,KAA2D;EAC9F,MAAM;IAAE,OAAF;IAAW;EAAX,IAAuB,KAA7B;EAEA,OACE,KAAA,CAAA,aAAA,CAAC,UAAA,CAAA,cAAD,EAAe;IAAC,KAAK,EAAE,aAAa,CAAC;EAAtB,CAAf,EACE,KAAA,CAAA,aAAA,CAAC,UAAA,CAAA,qBAAD,EAAsB;IAAC,KAAK,EAAE,aAAa,CAAC;EAAtB,CAAtB,EACG,OADH,EAEG,OAFH,CADF,CADF;AAQD,CAXM;;AAAM,OAAA,CAAA,qBAAA,GAAqB,qBAArB","sourcesContent":["import * as React from 'react';\nimport { DialogProvider, DialogSurfaceProvider } from '../../contexts';\nimport type { DialogState, DialogContextValues } from './Dialog.types';\n\n/**\n * Render the final JSX of Dialog\n */\nexport const renderDialog_unstable = (state: DialogState, contextValues: DialogContextValues) => {\n const { content, trigger } = state;\n\n return (\n <DialogProvider value={contextValues.dialog}>\n <DialogSurfaceProvider value={contextValues.dialogSurface}>\n {trigger}\n {content}\n </DialogSurfaceProvider>\n </DialogProvider>\n );\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":";;;;;;AAAA;AACA;AAGA;;;AAGO,MAAMA,qBAAqB,GAAG,CAACC,KAAkB,EAAEC,aAAkC,KAAI;EAC9F,MAAM;IAAEC,OAAO;IAAEC;EAAO,CAAE,GAAGH,KAAK;EAElC,OACEI,oBAACC,yBAAc;IAACC,KAAK,EAAEL,aAAa,CAACM;EAAM,GACzCH,oBAACC,gCAAqB;IAACC,KAAK,EAAEL,aAAa,CAACO;EAAa,GACtDL,OAAO,EACPD,OAAO,CACc,CACT;AAErB,CAAC;AAXYO,6BAAqB","names":["renderDialog_unstable","state","contextValues","content","trigger","React","contexts_1","value","dialog","dialogSurface","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-dialog/src/components/Dialog/renderDialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport { DialogProvider, DialogSurfaceProvider } from '../../contexts';\nimport type { DialogState, DialogContextValues } from './Dialog.types';\n\n/**\n * Render the final JSX of Dialog\n */\nexport const renderDialog_unstable = (state: DialogState, contextValues: DialogContextValues) => {\n const { content, trigger } = state;\n\n return (\n <DialogProvider value={contextValues.dialog}>\n <DialogSurfaceProvider value={contextValues.dialogSurface}>\n {trigger}\n {content}\n </DialogSurfaceProvider>\n </DialogProvider>\n );\n};\n"]}
@@ -4,15 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.useDialog_unstable = void 0;
7
-
8
7
  const React = /*#__PURE__*/require("react");
9
-
10
8
  const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
11
-
12
9
  const react_context_selector_1 = /*#__PURE__*/require("@fluentui/react-context-selector");
13
-
14
10
  const utils_1 = /*#__PURE__*/require("../../utils");
15
-
16
11
  const contexts_1 = /*#__PURE__*/require("../../contexts");
17
12
  /**
18
13
  * Create the state required to render Dialog.
@@ -22,8 +17,6 @@ const contexts_1 = /*#__PURE__*/require("../../contexts");
22
17
  *
23
18
  * @param props - props from this instance of Dialog
24
19
  */
25
-
26
-
27
20
  const useDialog_unstable = props => {
28
21
  const {
29
22
  children,
@@ -37,9 +30,9 @@ const useDialog_unstable = props => {
37
30
  initialState: false
38
31
  });
39
32
  const requestOpenChange = react_utilities_1.useEventCallback(data => {
40
- onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(data.event, data); // if user prevents default then do not change state value
33
+ onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(data.event, data);
34
+ // if user prevents default then do not change state value
41
35
  // otherwise updates state value and trigger reference to the element that caused the opening
42
-
43
36
  if (!data.event.isDefaultPrevented()) {
44
37
  setOpen(data.open);
45
38
  }
@@ -66,32 +59,26 @@ const useDialog_unstable = props => {
66
59
  dialogRef: focusRef
67
60
  };
68
61
  };
69
-
70
62
  exports.useDialog_unstable = useDialog_unstable;
71
63
  /**
72
64
  * Extracts trigger and content from children
73
65
  */
74
-
75
66
  function childrenToTriggerAndContent(children) {
76
67
  const childrenArray = React.Children.toArray(children);
77
-
78
68
  if (process.env.NODE_ENV !== 'production') {
79
69
  if (childrenArray.length !== 1 && childrenArray.length !== 2) {
80
70
  // eslint-disable-next-line no-console
81
71
  console.warn('Dialog must contain at least one child <DialogSurface/>,\n' + 'and at most two children <DialogTrigger/> <DialogSurface/> (in this order)');
82
72
  }
83
73
  }
84
-
85
74
  switch (childrenArray.length) {
86
75
  // case where there's a trigger followed by content
87
76
  case 2:
88
77
  return childrenArray;
89
78
  // case where there's only content
90
-
91
79
  case 1:
92
80
  return [undefined, childrenArray[0]];
93
81
  // unknown case
94
-
95
82
  default:
96
83
  return [undefined, undefined];
97
84
  }