@fluentui/react-toast 9.2.0 → 9.2.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 (210) hide show
  1. package/CHANGELOG.json +70 -1
  2. package/CHANGELOG.md +20 -2
  3. package/lib/components/AriaLive/AriaLive.js.map +1 -1
  4. package/lib/components/AriaLive/renderAriaLive.js +7 -2
  5. package/lib/components/AriaLive/renderAriaLive.js.map +1 -1
  6. package/lib/components/AriaLive/useAriaLive.js +6 -4
  7. package/lib/components/AriaLive/useAriaLive.js.map +1 -1
  8. package/lib/components/Timer/Timer.js +1 -1
  9. package/lib/components/Timer/Timer.js.map +1 -1
  10. package/lib/components/Toast/Toast.js.map +1 -1
  11. package/lib/components/Toast/renderToast.js +5 -4
  12. package/lib/components/Toast/renderToast.js.map +1 -1
  13. package/lib/components/Toast/useToast.js.map +1 -1
  14. package/lib/components/Toast/useToastContextValues.js +1 -1
  15. package/lib/components/Toast/useToastContextValues.js.map +1 -1
  16. package/lib/components/ToastBody/ToastBody.js.map +1 -1
  17. package/lib/components/ToastBody/renderToastBody.js +7 -2
  18. package/lib/components/ToastBody/renderToastBody.js.map +1 -1
  19. package/lib/components/ToastBody/useToastBody.js +1 -1
  20. package/lib/components/ToastBody/useToastBody.js.map +1 -1
  21. package/lib/components/ToastContainer/ToastContainer.js.map +1 -1
  22. package/lib/components/ToastContainer/renderToastContainer.js +12 -7
  23. package/lib/components/ToastContainer/renderToastContainer.js.map +1 -1
  24. package/lib/components/ToastContainer/useToastContainer.js +15 -15
  25. package/lib/components/ToastContainer/useToastContainer.js.map +1 -1
  26. package/lib/components/ToastContainer/useToastContainerContextValues.js +1 -1
  27. package/lib/components/ToastContainer/useToastContainerContextValues.js.map +1 -1
  28. package/lib/components/ToastFooter/ToastFooter.js.map +1 -1
  29. package/lib/components/ToastFooter/renderToastFooter.js +2 -2
  30. package/lib/components/ToastFooter/renderToastFooter.js.map +1 -1
  31. package/lib/components/ToastFooter/useToastFooter.js.map +1 -1
  32. package/lib/components/ToastTitle/ToastTitle.js.map +1 -1
  33. package/lib/components/ToastTitle/renderToastTitle.js +8 -2
  34. package/lib/components/ToastTitle/renderToastTitle.js.map +1 -1
  35. package/lib/components/ToastTitle/useToastTitle.js +1 -1
  36. package/lib/components/ToastTitle/useToastTitle.js.map +1 -1
  37. package/lib/components/ToastTitle/useToastTitleStyles.styles.js.map +1 -1
  38. package/lib/components/ToastTrigger/ToastTrigger.js.map +1 -1
  39. package/lib/components/ToastTrigger/useToastTrigger.js +8 -7
  40. package/lib/components/ToastTrigger/useToastTrigger.js.map +1 -1
  41. package/lib/components/Toaster/Toaster.js.map +1 -1
  42. package/lib/components/Toaster/renderToaster.js +18 -7
  43. package/lib/components/Toaster/renderToaster.js.map +1 -1
  44. package/lib/components/Toaster/useToastAnnounce.js.map +1 -1
  45. package/lib/components/Toaster/useToaster.js +6 -6
  46. package/lib/components/Toaster/useToaster.js.map +1 -1
  47. package/lib/components/Toaster/useToasterFocusManagement.js +2 -2
  48. package/lib/components/Toaster/useToasterFocusManagement.js.map +1 -1
  49. package/lib/contexts/toastContainerContext.js.map +1 -1
  50. package/lib/state/useToastController.js +3 -2
  51. package/lib/state/useToastController.js.map +1 -1
  52. package/lib/state/useToaster.js +15 -11
  53. package/lib/state/useToaster.js.map +1 -1
  54. package/lib/state/vanilla/createToaster.js +7 -7
  55. package/lib/state/vanilla/createToaster.js.map +1 -1
  56. package/lib/state/vanilla/dismissAllToasts.js.map +1 -1
  57. package/lib/state/vanilla/dismissToast.js.map +1 -1
  58. package/lib/state/vanilla/dispatchToast.js.map +1 -1
  59. package/lib/state/vanilla/getPositionStyles.js +1 -1
  60. package/lib/state/vanilla/getPositionStyles.js.map +1 -1
  61. package/lib/state/vanilla/pauseToast.js.map +1 -1
  62. package/lib/state/vanilla/playToast.js.map +1 -1
  63. package/lib/state/vanilla/updateToast.js.map +1 -1
  64. package/lib-commonjs/AriaLive.js +2 -2
  65. package/lib-commonjs/AriaLive.js.map +1 -1
  66. package/lib-commonjs/Toast.js +2 -2
  67. package/lib-commonjs/Toast.js.map +1 -1
  68. package/lib-commonjs/ToastBody.js +2 -2
  69. package/lib-commonjs/ToastBody.js.map +1 -1
  70. package/lib-commonjs/ToastContainer.js +2 -2
  71. package/lib-commonjs/ToastContainer.js.map +1 -1
  72. package/lib-commonjs/ToastFooter.js +2 -2
  73. package/lib-commonjs/ToastFooter.js.map +1 -1
  74. package/lib-commonjs/ToastTitle.js +2 -2
  75. package/lib-commonjs/ToastTitle.js.map +1 -1
  76. package/lib-commonjs/ToastTrigger.js +2 -2
  77. package/lib-commonjs/ToastTrigger.js.map +1 -1
  78. package/lib-commonjs/Toaster.js +2 -2
  79. package/lib-commonjs/Toaster.js.map +1 -1
  80. package/lib-commonjs/components/AriaLive/AriaLive.js +7 -5
  81. package/lib-commonjs/components/AriaLive/AriaLive.js.map +1 -1
  82. package/lib-commonjs/components/AriaLive/AriaLive.types.js +2 -2
  83. package/lib-commonjs/components/AriaLive/AriaLive.types.js.map +1 -1
  84. package/lib-commonjs/components/AriaLive/index.js +6 -6
  85. package/lib-commonjs/components/AriaLive/index.js.map +1 -1
  86. package/lib-commonjs/components/AriaLive/renderAriaLive.js +13 -6
  87. package/lib-commonjs/components/AriaLive/renderAriaLive.js.map +1 -1
  88. package/lib-commonjs/components/AriaLive/useAriaLive.js +16 -12
  89. package/lib-commonjs/components/AriaLive/useAriaLive.js.map +1 -1
  90. package/lib-commonjs/components/AriaLive/useAriaLiveStyles.styles.js +7 -3
  91. package/lib-commonjs/components/AriaLive/useAriaLiveStyles.styles.js.map +1 -1
  92. package/lib-commonjs/components/Timer/Timer.js +8 -6
  93. package/lib-commonjs/components/Timer/Timer.js.map +1 -1
  94. package/lib-commonjs/components/Timer/index.js +2 -2
  95. package/lib-commonjs/components/Timer/index.js.map +1 -1
  96. package/lib-commonjs/components/Timer/useTimerStyles.styles.js +4 -2
  97. package/lib-commonjs/components/Timer/useTimerStyles.styles.js.map +1 -1
  98. package/lib-commonjs/components/Toast/Toast.js +7 -5
  99. package/lib-commonjs/components/Toast/Toast.js.map +1 -1
  100. package/lib-commonjs/components/Toast/index.js +6 -6
  101. package/lib-commonjs/components/Toast/index.js.map +1 -1
  102. package/lib-commonjs/components/Toast/renderToast.js +12 -9
  103. package/lib-commonjs/components/Toast/renderToast.js.map +1 -1
  104. package/lib-commonjs/components/Toast/useToast.js +7 -5
  105. package/lib-commonjs/components/Toast/useToast.js.map +1 -1
  106. package/lib-commonjs/components/Toast/useToastContextValues.js +4 -2
  107. package/lib-commonjs/components/Toast/useToastContextValues.js.map +1 -1
  108. package/lib-commonjs/components/Toast/useToastStyles.styles.js +8 -4
  109. package/lib-commonjs/components/Toast/useToastStyles.styles.js.map +1 -1
  110. package/lib-commonjs/components/ToastBody/ToastBody.js +7 -5
  111. package/lib-commonjs/components/ToastBody/ToastBody.js.map +1 -1
  112. package/lib-commonjs/components/ToastBody/index.js +6 -6
  113. package/lib-commonjs/components/ToastBody/index.js.map +1 -1
  114. package/lib-commonjs/components/ToastBody/renderToastBody.js +13 -6
  115. package/lib-commonjs/components/ToastBody/renderToastBody.js.map +1 -1
  116. package/lib-commonjs/components/ToastBody/useToastBody.js +11 -9
  117. package/lib-commonjs/components/ToastBody/useToastBody.js.map +1 -1
  118. package/lib-commonjs/components/ToastBody/useToastBodyStyles.styles.js +9 -5
  119. package/lib-commonjs/components/ToastBody/useToastBodyStyles.styles.js.map +1 -1
  120. package/lib-commonjs/components/ToastContainer/ToastContainer.js +7 -5
  121. package/lib-commonjs/components/ToastContainer/ToastContainer.js.map +1 -1
  122. package/lib-commonjs/components/ToastContainer/ToastContainer.types.js +2 -2
  123. package/lib-commonjs/components/ToastContainer/ToastContainer.types.js.map +1 -1
  124. package/lib-commonjs/components/ToastContainer/index.js +7 -7
  125. package/lib-commonjs/components/ToastContainer/index.js.map +1 -1
  126. package/lib-commonjs/components/ToastContainer/renderToastContainer.js +19 -12
  127. package/lib-commonjs/components/ToastContainer/renderToastContainer.js.map +1 -1
  128. package/lib-commonjs/components/ToastContainer/useToastContainer.js +42 -40
  129. package/lib-commonjs/components/ToastContainer/useToastContainer.js.map +1 -1
  130. package/lib-commonjs/components/ToastContainer/useToastContainerContextValues.js +6 -4
  131. package/lib-commonjs/components/ToastContainer/useToastContainerContextValues.js.map +1 -1
  132. package/lib-commonjs/components/ToastContainer/useToastContainerStyles.styles.js +8 -4
  133. package/lib-commonjs/components/ToastContainer/useToastContainerStyles.styles.js.map +1 -1
  134. package/lib-commonjs/components/ToastFooter/ToastFooter.js +7 -5
  135. package/lib-commonjs/components/ToastFooter/ToastFooter.js.map +1 -1
  136. package/lib-commonjs/components/ToastFooter/index.js +6 -6
  137. package/lib-commonjs/components/ToastFooter/index.js.map +1 -1
  138. package/lib-commonjs/components/ToastFooter/renderToastFooter.js +8 -6
  139. package/lib-commonjs/components/ToastFooter/renderToastFooter.js.map +1 -1
  140. package/lib-commonjs/components/ToastFooter/useToastFooter.js +7 -5
  141. package/lib-commonjs/components/ToastFooter/useToastFooter.js.map +1 -1
  142. package/lib-commonjs/components/ToastFooter/useToastFooterStyles.styles.js +7 -3
  143. package/lib-commonjs/components/ToastFooter/useToastFooterStyles.styles.js.map +1 -1
  144. package/lib-commonjs/components/ToastTitle/ToastTitle.js +7 -5
  145. package/lib-commonjs/components/ToastTitle/ToastTitle.js.map +1 -1
  146. package/lib-commonjs/components/ToastTitle/index.js +6 -6
  147. package/lib-commonjs/components/ToastTitle/index.js.map +1 -1
  148. package/lib-commonjs/components/ToastTitle/renderToastTitle.js +14 -6
  149. package/lib-commonjs/components/ToastTitle/renderToastTitle.js.map +1 -1
  150. package/lib-commonjs/components/ToastTitle/useToastTitle.js +17 -15
  151. package/lib-commonjs/components/ToastTitle/useToastTitle.js.map +1 -1
  152. package/lib-commonjs/components/ToastTitle/useToastTitleStyles.styles.js +13 -9
  153. package/lib-commonjs/components/ToastTitle/useToastTitleStyles.styles.js.map +1 -1
  154. package/lib-commonjs/components/ToastTrigger/ToastTrigger.js +5 -3
  155. package/lib-commonjs/components/ToastTrigger/ToastTrigger.js.map +1 -1
  156. package/lib-commonjs/components/ToastTrigger/ToastTrigger.types.js +2 -2
  157. package/lib-commonjs/components/ToastTrigger/ToastTrigger.types.js.map +1 -1
  158. package/lib-commonjs/components/ToastTrigger/index.js +5 -5
  159. package/lib-commonjs/components/ToastTrigger/index.js.map +1 -1
  160. package/lib-commonjs/components/ToastTrigger/renderToastTrigger.js +3 -1
  161. package/lib-commonjs/components/ToastTrigger/renderToastTrigger.js.map +1 -1
  162. package/lib-commonjs/components/ToastTrigger/useToastTrigger.js +18 -15
  163. package/lib-commonjs/components/ToastTrigger/useToastTrigger.js.map +1 -1
  164. package/lib-commonjs/components/Toaster/Toaster.js +7 -5
  165. package/lib-commonjs/components/Toaster/Toaster.js.map +1 -1
  166. package/lib-commonjs/components/Toaster/index.js +6 -6
  167. package/lib-commonjs/components/Toaster/index.js.map +1 -1
  168. package/lib-commonjs/components/Toaster/renderToaster.js +26 -13
  169. package/lib-commonjs/components/Toaster/renderToaster.js.map +1 -1
  170. package/lib-commonjs/components/Toaster/useToastAnnounce.js +8 -6
  171. package/lib-commonjs/components/Toaster/useToastAnnounce.js.map +1 -1
  172. package/lib-commonjs/components/Toaster/useToaster.js +24 -22
  173. package/lib-commonjs/components/Toaster/useToaster.js.map +1 -1
  174. package/lib-commonjs/components/Toaster/useToasterFocusManagement.js +19 -17
  175. package/lib-commonjs/components/Toaster/useToasterFocusManagement.js.map +1 -1
  176. package/lib-commonjs/components/Toaster/useToasterStyles.styles.js +7 -3
  177. package/lib-commonjs/components/Toaster/useToasterStyles.styles.js.map +1 -1
  178. package/lib-commonjs/contexts/toastContainerContext.js +8 -4
  179. package/lib-commonjs/contexts/toastContainerContext.js.map +1 -1
  180. package/lib-commonjs/index.js +93 -35
  181. package/lib-commonjs/index.js.map +1 -1
  182. package/lib-commonjs/state/constants.js +6 -2
  183. package/lib-commonjs/state/constants.js.map +1 -1
  184. package/lib-commonjs/state/index.js +10 -6
  185. package/lib-commonjs/state/index.js.map +1 -1
  186. package/lib-commonjs/state/types.js +2 -2
  187. package/lib-commonjs/state/types.js.map +1 -1
  188. package/lib-commonjs/state/useToastController.js +9 -6
  189. package/lib-commonjs/state/useToastController.js.map +1 -1
  190. package/lib-commonjs/state/useToaster.js +26 -20
  191. package/lib-commonjs/state/useToaster.js.map +1 -1
  192. package/lib-commonjs/state/vanilla/createToaster.js +14 -12
  193. package/lib-commonjs/state/vanilla/createToaster.js.map +1 -1
  194. package/lib-commonjs/state/vanilla/dismissAllToasts.js +3 -1
  195. package/lib-commonjs/state/vanilla/dismissAllToasts.js.map +1 -1
  196. package/lib-commonjs/state/vanilla/dismissToast.js +3 -1
  197. package/lib-commonjs/state/vanilla/dismissToast.js.map +1 -1
  198. package/lib-commonjs/state/vanilla/dispatchToast.js +3 -1
  199. package/lib-commonjs/state/vanilla/dispatchToast.js.map +1 -1
  200. package/lib-commonjs/state/vanilla/getPositionStyles.js +4 -2
  201. package/lib-commonjs/state/vanilla/getPositionStyles.js.map +1 -1
  202. package/lib-commonjs/state/vanilla/index.js +9 -9
  203. package/lib-commonjs/state/vanilla/index.js.map +1 -1
  204. package/lib-commonjs/state/vanilla/pauseToast.js +3 -1
  205. package/lib-commonjs/state/vanilla/pauseToast.js.map +1 -1
  206. package/lib-commonjs/state/vanilla/playToast.js +3 -1
  207. package/lib-commonjs/state/vanilla/playToast.js.map +1 -1
  208. package/lib-commonjs/state/vanilla/updateToast.js +3 -1
  209. package/lib-commonjs/state/vanilla/updateToast.js.map +1 -1
  210. package/package.json +14 -14
@@ -1 +1 @@
1
- {"version":3,"sources":["ToastFooter.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useToastFooter_unstable } from './useToastFooter';\nimport { renderToastFooter_unstable } from './renderToastFooter';\nimport { useToastFooterStyles_unstable } from './useToastFooterStyles.styles';\nimport type { ToastFooterProps } from './ToastFooter.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * ToastFooter component\n */\nexport const ToastFooter: ForwardRefComponent<ToastFooterProps> = React.forwardRef((props, ref) => {\n const state = useToastFooter_unstable(props, ref);\n\n useToastFooterStyles_unstable(state);\n return renderToastFooter_unstable(state);\n});\n\nToastFooter.displayName = 'ToastFooter';\n"],"names":["React","useToastFooter_unstable","renderToastFooter_unstable","useToastFooterStyles_unstable","ToastFooter","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;AAI9E;;CAEC,GACD,OAAO,MAAMC,4BAAqDJ,MAAMK,UAAU,CAAC,CAACC,OAAOC,MAAQ;IACjG,MAAMC,QAAQP,wBAAwBK,OAAOC;IAE7CJ,8BAA8BK;IAC9B,OAAON,2BAA2BM;AACpC,GAAG;AAEHJ,YAAYK,WAAW,GAAG"}
1
+ {"version":3,"sources":["ToastFooter.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useToastFooter_unstable } from './useToastFooter';\nimport { renderToastFooter_unstable } from './renderToastFooter';\nimport { useToastFooterStyles_unstable } from './useToastFooterStyles.styles';\nimport type { ToastFooterProps } from './ToastFooter.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * ToastFooter component\n */\nexport const ToastFooter: ForwardRefComponent<ToastFooterProps> = React.forwardRef((props, ref) => {\n const state = useToastFooter_unstable(props, ref);\n\n useToastFooterStyles_unstable(state);\n return renderToastFooter_unstable(state);\n});\n\nToastFooter.displayName = 'ToastFooter';\n"],"names":["React","useToastFooter_unstable","renderToastFooter_unstable","useToastFooterStyles_unstable","ToastFooter","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;AAI9E;;CAEC,GACD,OAAO,MAAMC,4BAAqDJ,MAAMK,UAAU,CAAC,CAACC,OAAOC;IACzF,MAAMC,QAAQP,wBAAwBK,OAAOC;IAE7CJ,8BAA8BK;IAC9B,OAAON,2BAA2BM;AACpC,GAAG;AAEHJ,YAAYK,WAAW,GAAG"}
@@ -1,8 +1,8 @@
1
- /** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';
1
+ /** @jsxRuntime automatic */ /** @jsxImportSource @fluentui/react-jsx-runtime */ import { jsx as _jsx } from "@fluentui/react-jsx-runtime/jsx-runtime";
2
2
  import { assertSlots } from '@fluentui/react-utilities';
3
3
  /**
4
4
  * Render the final JSX of ToastFooter
5
5
  */ export const renderToastFooter_unstable = (state)=>{
6
6
  assertSlots(state);
7
- return /*#__PURE__*/ createElement(state.root, null);
7
+ return /*#__PURE__*/ _jsx(state.root, {});
8
8
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["renderToastFooter.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { ToastFooterState, ToastFooterSlots } from './ToastFooter.types';\n\n/**\n * Render the final JSX of ToastFooter\n */\nexport const renderToastFooter_unstable = (state: ToastFooterState) => {\n assertSlots<ToastFooterSlots>(state);\n\n return <state.root />;\n};\n"],"names":["createElement","assertSlots","renderToastFooter_unstable","state","root"],"mappings":"AAAA,wBAAwB,GACxB,uBAAuB,GAEvB,SAASA,aAAa,QAAQ,8BAA8B;AAC5D,SAASC,WAAW,QAAQ,4BAA4B;AAGxD;;CAEC,GACD,OAAO,MAAMC,6BAA6B,CAACC,QAA4B;IACrEF,YAA8BE;IAE9B,qBAAO,AAZT,cAYUA,MAAMC,IAAI;AACpB,EAAE"}
1
+ {"version":3,"sources":["renderToastFooter.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { ToastFooterState, ToastFooterSlots } from './ToastFooter.types';\n\n/**\n * Render the final JSX of ToastFooter\n */\nexport const renderToastFooter_unstable = (state: ToastFooterState) => {\n assertSlots<ToastFooterSlots>(state);\n\n return <state.root />;\n};\n"],"names":["assertSlots","renderToastFooter_unstable","state","root"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AACjD,SAASA,WAAW,QAAQ,4BAA4B;AAGxD;;CAEC,GACD,OAAO,MAAMC,6BAA6B,CAACC;IACzCF,YAA8BE;IAE9B,qBAAO,KAACA,MAAMC,IAAI;AACpB,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["useToastFooter.ts"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, slot } from '@fluentui/react-utilities';\nimport type { ToastFooterProps, ToastFooterState } from './ToastFooter.types';\n\n/**\n * Create the state required to render ToastFooter.\n *\n * The returned state can be modified with hooks such as useToastFooterStyles_unstable,\n * before being passed to renderToastFooter_unstable.\n *\n * @param props - props from this instance of ToastFooter\n * @param ref - reference to root HTMLElement of ToastFooter\n */\nexport const useToastFooter_unstable = (props: ToastFooterProps, ref: React.Ref<HTMLElement>): ToastFooterState => {\n return {\n components: {\n root: 'div',\n },\n root: slot.always(\n getNativeElementProps('div', {\n ref,\n ...props,\n }),\n { elementType: 'div' },\n ),\n };\n};\n"],"names":["React","getNativeElementProps","slot","useToastFooter_unstable","props","ref","components","root","always","elementType"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,EAAEC,IAAI,QAAQ,4BAA4B;AAGxE;;;;;;;;CAQC,GACD,OAAO,MAAMC,0BAA0B,CAACC,OAAyBC,MAAkD;IACjH,OAAO;QACLC,YAAY;YACVC,MAAM;QACR;QACAA,MAAML,KAAKM,MAAM,CACfP,sBAAsB,OAAO;YAC3BI;YACA,GAAGD,KAAK;QACV,IACA;YAAEK,aAAa;QAAM;IAEzB;AACF,EAAE"}
1
+ {"version":3,"sources":["useToastFooter.ts"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, slot } from '@fluentui/react-utilities';\nimport type { ToastFooterProps, ToastFooterState } from './ToastFooter.types';\n\n/**\n * Create the state required to render ToastFooter.\n *\n * The returned state can be modified with hooks such as useToastFooterStyles_unstable,\n * before being passed to renderToastFooter_unstable.\n *\n * @param props - props from this instance of ToastFooter\n * @param ref - reference to root HTMLElement of ToastFooter\n */\nexport const useToastFooter_unstable = (props: ToastFooterProps, ref: React.Ref<HTMLElement>): ToastFooterState => {\n return {\n components: {\n root: 'div',\n },\n root: slot.always(\n getNativeElementProps('div', {\n ref,\n ...props,\n }),\n { elementType: 'div' },\n ),\n };\n};\n"],"names":["React","getNativeElementProps","slot","useToastFooter_unstable","props","ref","components","root","always","elementType"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,EAAEC,IAAI,QAAQ,4BAA4B;AAGxE;;;;;;;;CAQC,GACD,OAAO,MAAMC,0BAA0B,CAACC,OAAyBC;IAC/D,OAAO;QACLC,YAAY;YACVC,MAAM;QACR;QACAA,MAAML,KAAKM,MAAM,CACfP,sBAAsB,OAAO;YAC3BI;YACA,GAAGD,KAAK;QACV,IACA;YAAEK,aAAa;QAAM;IAEzB;AACF,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["ToastTitle.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useToastTitle_unstable } from './useToastTitle';\nimport { renderToastTitle_unstable } from './renderToastTitle';\nimport { useToastTitleStyles_unstable } from './useToastTitleStyles.styles';\nimport type { ToastTitleProps } from './ToastTitle.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * ToastTitle component\n */\nexport const ToastTitle: ForwardRefComponent<ToastTitleProps> = React.forwardRef((props, ref) => {\n const state = useToastTitle_unstable(props, ref);\n\n useToastTitleStyles_unstable(state);\n return renderToastTitle_unstable(state);\n});\n\nToastTitle.displayName = 'ToastTitle';\n"],"names":["React","useToastTitle_unstable","renderToastTitle_unstable","useToastTitleStyles_unstable","ToastTitle","forwardRef","props","ref","state","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,sBAAsB,QAAQ,kBAAkB;AACzD,SAASC,yBAAyB,QAAQ,qBAAqB;AAC/D,SAASC,4BAA4B,QAAQ,+BAA+B;AAI5E;;CAEC,GACD,OAAO,MAAMC,2BAAmDJ,MAAMK,UAAU,CAAC,CAACC,OAAOC,MAAQ;IAC/F,MAAMC,QAAQP,uBAAuBK,OAAOC;IAE5CJ,6BAA6BK;IAC7B,OAAON,0BAA0BM;AACnC,GAAG;AAEHJ,WAAWK,WAAW,GAAG"}
1
+ {"version":3,"sources":["ToastTitle.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useToastTitle_unstable } from './useToastTitle';\nimport { renderToastTitle_unstable } from './renderToastTitle';\nimport { useToastTitleStyles_unstable } from './useToastTitleStyles.styles';\nimport type { ToastTitleProps } from './ToastTitle.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * ToastTitle component\n */\nexport const ToastTitle: ForwardRefComponent<ToastTitleProps> = React.forwardRef((props, ref) => {\n const state = useToastTitle_unstable(props, ref);\n\n useToastTitleStyles_unstable(state);\n return renderToastTitle_unstable(state);\n});\n\nToastTitle.displayName = 'ToastTitle';\n"],"names":["React","useToastTitle_unstable","renderToastTitle_unstable","useToastTitleStyles_unstable","ToastTitle","forwardRef","props","ref","state","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,sBAAsB,QAAQ,kBAAkB;AACzD,SAASC,yBAAyB,QAAQ,qBAAqB;AAC/D,SAASC,4BAA4B,QAAQ,+BAA+B;AAI5E;;CAEC,GACD,OAAO,MAAMC,2BAAmDJ,MAAMK,UAAU,CAAC,CAACC,OAAOC;IACvF,MAAMC,QAAQP,uBAAuBK,OAAOC;IAE5CJ,6BAA6BK;IAC7B,OAAON,0BAA0BM;AACnC,GAAG;AAEHJ,WAAWK,WAAW,GAAG"}
@@ -1,8 +1,14 @@
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 ToastTitle
5
5
  */ export const renderToastTitle_unstable = (state)=>{
6
6
  assertSlots(state);
7
- return /*#__PURE__*/ createElement(Fragment, null, state.media ? /*#__PURE__*/ createElement(state.media, null) : null, /*#__PURE__*/ createElement(state.root, null), state.action ? /*#__PURE__*/ createElement(state.action, null) : null);
7
+ return /*#__PURE__*/ _jsxs(_Fragment, {
8
+ children: [
9
+ state.media ? /*#__PURE__*/ _jsx(state.media, {}) : null,
10
+ /*#__PURE__*/ _jsx(state.root, {}),
11
+ state.action ? /*#__PURE__*/ _jsx(state.action, {}) : null
12
+ ]
13
+ });
8
14
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["renderToastTitle.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsxFrag Fragment */\n/** @jsx createElement */\n\nimport { createElement, Fragment } from '@fluentui/react-jsx-runtime';\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { ToastTitleState, ToastTitleSlots } from './ToastTitle.types';\n\n/**\n * Render the final JSX of ToastTitle\n */\nexport const renderToastTitle_unstable = (state: ToastTitleState) => {\n assertSlots<ToastTitleSlots>(state);\n\n return (\n <>\n {state.media ? <state.media /> : null}\n <state.root />\n {state.action ? <state.action /> : null}\n </>\n );\n};\n"],"names":["createElement","Fragment","assertSlots","renderToastTitle_unstable","state","media","root","action"],"mappings":"AAAA,wBAAwB,GACxB,sBAAsB,GACtB,uBAAuB,GAEvB,SAASA,aAAa,EAAEC,QAAQ,QAAQ,8BAA8B;AACtE,SAASC,WAAW,QAAQ,4BAA4B;AAGxD;;CAEC,GACD,OAAO,MAAMC,4BAA4B,CAACC,QAA2B;IACnEF,YAA6BE;IAE7B,qBACE,AAbJ,cADA,gBAeOA,MAAMC,KAAK,iBAAG,AAdrB,cAcsBD,MAAMC,KAAK,UAAM,IAAI,gBACrC,AAfN,cAeOD,MAAME,IAAI,SACVF,MAAMG,MAAM,iBAAG,AAhBtB,cAgBuBH,MAAMG,MAAM,UAAM,IAAI;AAG7C,EAAE"}
1
+ {"version":3,"sources":["renderToastTitle.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { ToastTitleState, ToastTitleSlots } from './ToastTitle.types';\n\n/**\n * Render the final JSX of ToastTitle\n */\nexport const renderToastTitle_unstable = (state: ToastTitleState) => {\n assertSlots<ToastTitleSlots>(state);\n\n return (\n <>\n {state.media ? <state.media /> : null}\n <state.root />\n {state.action ? <state.action /> : null}\n </>\n );\n};\n"],"names":["assertSlots","renderToastTitle_unstable","state","media","root","action"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAGxD;;CAEC,GACD,OAAO,MAAMC,4BAA4B,CAACC;IACxCF,YAA6BE;IAE7B,qBACE;;YACGA,MAAMC,KAAK,iBAAG,KAACD,MAAMC,KAAK,QAAM;0BACjC,KAACD,MAAME,IAAI;YACVF,MAAMG,MAAM,iBAAG,KAACH,MAAMG,MAAM,QAAM;;;AAGzC,EAAE"}
@@ -12,7 +12,7 @@ import { useToastContainerContext } from '../../contexts/toastContainerContext';
12
12
  * @param props - props from this instance of ToastTitle
13
13
  * @param ref - reference to root HTMLElement of ToastTitle
14
14
  */ export const useToastTitle_unstable = (props, ref)=>{
15
- const { intent , titleId } = useToastContainerContext();
15
+ const { intent, titleId } = useToastContainerContext();
16
16
  const backgroundAppearance = useBackgroundAppearance();
17
17
  /** Determine the role and media to render based on the intent */ let defaultIcon;
18
18
  switch(intent){
@@ -1 +1 @@
1
- {"version":3,"sources":["useToastTitle.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { CheckmarkCircleFilled, DismissCircleFilled, InfoFilled, WarningFilled } from '@fluentui/react-icons';\nimport { getNativeElementProps, slot } from '@fluentui/react-utilities';\nimport { useBackgroundAppearance } from '@fluentui/react-shared-contexts';\n\nimport type { ToastTitleProps, ToastTitleState } from './ToastTitle.types';\nimport { useToastContainerContext } from '../../contexts/toastContainerContext';\n\n/**\n * Create the state required to render ToastTitle.\n *\n * The returned state can be modified with hooks such as useToastTitleStyles_unstable,\n * before being passed to renderToastTitle_unstable.\n *\n * @param props - props from this instance of ToastTitle\n * @param ref - reference to root HTMLElement of ToastTitle\n */\nexport const useToastTitle_unstable = (props: ToastTitleProps, ref: React.Ref<HTMLElement>): ToastTitleState => {\n const { intent, titleId } = useToastContainerContext();\n const backgroundAppearance = useBackgroundAppearance();\n\n /** Determine the role and media to render based on the intent */\n let defaultIcon;\n switch (intent) {\n case 'success':\n defaultIcon = <CheckmarkCircleFilled />;\n break;\n case 'error':\n defaultIcon = <DismissCircleFilled />;\n break;\n case 'warning':\n defaultIcon = <WarningFilled />;\n break;\n case 'info':\n defaultIcon = <InfoFilled />;\n break;\n }\n\n return {\n action: slot.optional(props.action, { elementType: 'div' }),\n components: { root: 'div', media: 'div', action: 'div' },\n media: slot.optional(props.media, {\n renderByDefault: !!intent,\n defaultProps: { children: defaultIcon },\n elementType: 'div',\n }),\n root: slot.always(\n getNativeElementProps('div', {\n ref,\n children: props.children,\n id: titleId,\n ...props,\n }),\n { elementType: 'div' },\n ),\n intent,\n backgroundAppearance,\n };\n};\n"],"names":["React","CheckmarkCircleFilled","DismissCircleFilled","InfoFilled","WarningFilled","getNativeElementProps","slot","useBackgroundAppearance","useToastContainerContext","useToastTitle_unstable","props","ref","intent","titleId","backgroundAppearance","defaultIcon","action","optional","elementType","components","root","media","renderByDefault","defaultProps","children","always","id"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,qBAAqB,EAAEC,mBAAmB,EAAEC,UAAU,EAAEC,aAAa,QAAQ,wBAAwB;AAC9G,SAASC,qBAAqB,EAAEC,IAAI,QAAQ,4BAA4B;AACxE,SAASC,uBAAuB,QAAQ,kCAAkC;AAG1E,SAASC,wBAAwB,QAAQ,uCAAuC;AAEhF;;;;;;;;CAQC,GACD,OAAO,MAAMC,yBAAyB,CAACC,OAAwBC,MAAiD;IAC9G,MAAM,EAAEC,OAAM,EAAEC,QAAO,EAAE,GAAGL;IAC5B,MAAMM,uBAAuBP;IAE7B,+DAA+D,GAC/D,IAAIQ;IACJ,OAAQH;QACN,KAAK;YACHG,4BAAc,oBAACd;YACf,KAAM;QACR,KAAK;YACHc,4BAAc,oBAACb;YACf,KAAM;QACR,KAAK;YACHa,4BAAc,oBAACX;YACf,KAAM;QACR,KAAK;YACHW,4BAAc,oBAACZ;YACf,KAAM;IACV;IAEA,OAAO;QACLa,QAAQV,KAAKW,QAAQ,CAACP,MAAMM,MAAM,EAAE;YAAEE,aAAa;QAAM;QACzDC,YAAY;YAAEC,MAAM;YAAOC,OAAO;YAAOL,QAAQ;QAAM;QACvDK,OAAOf,KAAKW,QAAQ,CAACP,MAAMW,KAAK,EAAE;YAChCC,iBAAiB,CAAC,CAACV;YACnBW,cAAc;gBAAEC,UAAUT;YAAY;YACtCG,aAAa;QACf;QACAE,MAAMd,KAAKmB,MAAM,CACfpB,sBAAsB,OAAO;YAC3BM;YACAa,UAAUd,MAAMc,QAAQ;YACxBE,IAAIb;YACJ,GAAGH,KAAK;QACV,IACA;YAAEQ,aAAa;QAAM;QAEvBN;QACAE;IACF;AACF,EAAE"}
1
+ {"version":3,"sources":["useToastTitle.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { CheckmarkCircleFilled, DismissCircleFilled, InfoFilled, WarningFilled } from '@fluentui/react-icons';\nimport { getNativeElementProps, slot } from '@fluentui/react-utilities';\nimport { useBackgroundAppearance } from '@fluentui/react-shared-contexts';\n\nimport type { ToastTitleProps, ToastTitleState } from './ToastTitle.types';\nimport { useToastContainerContext } from '../../contexts/toastContainerContext';\n\n/**\n * Create the state required to render ToastTitle.\n *\n * The returned state can be modified with hooks such as useToastTitleStyles_unstable,\n * before being passed to renderToastTitle_unstable.\n *\n * @param props - props from this instance of ToastTitle\n * @param ref - reference to root HTMLElement of ToastTitle\n */\nexport const useToastTitle_unstable = (props: ToastTitleProps, ref: React.Ref<HTMLElement>): ToastTitleState => {\n const { intent, titleId } = useToastContainerContext();\n const backgroundAppearance = useBackgroundAppearance();\n\n /** Determine the role and media to render based on the intent */\n let defaultIcon;\n switch (intent) {\n case 'success':\n defaultIcon = <CheckmarkCircleFilled />;\n break;\n case 'error':\n defaultIcon = <DismissCircleFilled />;\n break;\n case 'warning':\n defaultIcon = <WarningFilled />;\n break;\n case 'info':\n defaultIcon = <InfoFilled />;\n break;\n }\n\n return {\n action: slot.optional(props.action, { elementType: 'div' }),\n components: { root: 'div', media: 'div', action: 'div' },\n media: slot.optional(props.media, {\n renderByDefault: !!intent,\n defaultProps: { children: defaultIcon },\n elementType: 'div',\n }),\n root: slot.always(\n getNativeElementProps('div', {\n ref,\n children: props.children,\n id: titleId,\n ...props,\n }),\n { elementType: 'div' },\n ),\n intent,\n backgroundAppearance,\n };\n};\n"],"names":["React","CheckmarkCircleFilled","DismissCircleFilled","InfoFilled","WarningFilled","getNativeElementProps","slot","useBackgroundAppearance","useToastContainerContext","useToastTitle_unstable","props","ref","intent","titleId","backgroundAppearance","defaultIcon","action","optional","elementType","components","root","media","renderByDefault","defaultProps","children","always","id"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,qBAAqB,EAAEC,mBAAmB,EAAEC,UAAU,EAAEC,aAAa,QAAQ,wBAAwB;AAC9G,SAASC,qBAAqB,EAAEC,IAAI,QAAQ,4BAA4B;AACxE,SAASC,uBAAuB,QAAQ,kCAAkC;AAG1E,SAASC,wBAAwB,QAAQ,uCAAuC;AAEhF;;;;;;;;CAQC,GACD,OAAO,MAAMC,yBAAyB,CAACC,OAAwBC;IAC7D,MAAM,EAAEC,MAAM,EAAEC,OAAO,EAAE,GAAGL;IAC5B,MAAMM,uBAAuBP;IAE7B,+DAA+D,GAC/D,IAAIQ;IACJ,OAAQH;QACN,KAAK;YACHG,4BAAc,oBAACd;YACf;QACF,KAAK;YACHc,4BAAc,oBAACb;YACf;QACF,KAAK;YACHa,4BAAc,oBAACX;YACf;QACF,KAAK;YACHW,4BAAc,oBAACZ;YACf;IACJ;IAEA,OAAO;QACLa,QAAQV,KAAKW,QAAQ,CAACP,MAAMM,MAAM,EAAE;YAAEE,aAAa;QAAM;QACzDC,YAAY;YAAEC,MAAM;YAAOC,OAAO;YAAOL,QAAQ;QAAM;QACvDK,OAAOf,KAAKW,QAAQ,CAACP,MAAMW,KAAK,EAAE;YAChCC,iBAAiB,CAAC,CAACV;YACnBW,cAAc;gBAAEC,UAAUT;YAAY;YACtCG,aAAa;QACf;QACAE,MAAMd,KAAKmB,MAAM,CACfpB,sBAAsB,OAAO;YAC3BM;YACAa,UAAUd,MAAMc,QAAQ;YACxBE,IAAIb;YACJ,GAAGH,KAAK;QACV,IACA;YAAEQ,aAAa;QAAM;QAEvBN;QACAE;IACF;AACF,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"names":["__styles","__resetStyles","mergeClasses","tokens","toastTitleClassNames","root","media","action","useRootBaseClassName","useMediaBaseClassName","useActionBaseClassName","useInvertedStyles","sj55zd","d","useIntentIconStyles","success","error","warning","info","useIntentIconStylesInverted","useToastTitleStyles_unstable","state","rootBaseClassName","actionBaseClassName","mediaBaseClassName","intentIconStyles","intentIconStylesInverted","intent","invertedStyles","className","backgroundAppearance"],"sources":["useToastTitleStyles.styles.js"],"sourcesContent":["import { makeStyles, makeResetStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nexport const toastTitleClassNames = {\n root: 'fui-ToastTitle',\n media: 'fui-ToastTitle__media',\n action: 'fui-ToastTitle__action'\n};\nconst useRootBaseClassName = makeResetStyles({\n display: 'flex',\n alignItems: 'center',\n gridColumnEnd: 3,\n color: tokens.colorNeutralForeground1\n});\nconst useMediaBaseClassName = makeResetStyles({\n display: 'flex',\n alignItems: 'center',\n gridColumnEnd: 2,\n paddingRight: '8px',\n fontSize: '16px',\n color: tokens.colorNeutralForeground1\n});\nconst useActionBaseClassName = makeResetStyles({\n display: 'flex',\n alignItems: 'center',\n paddingLeft: '12px',\n gridColumnEnd: -1,\n color: tokens.colorBrandForeground1\n});\nconst useInvertedStyles = makeStyles({\n root: {\n color: tokens.colorNeutralForegroundInverted2\n },\n action: {\n color: tokens.colorBrandForegroundInverted\n },\n media: {\n color: tokens.colorNeutralForegroundInverted\n }\n});\nconst useIntentIconStyles = makeStyles({\n success: {\n // FIXME https://github.com/microsoft/fluentui/issues/28219\n color: tokens.colorPaletteGreenForeground3\n },\n error: {\n // FIXME https://github.com/microsoft/fluentui/issues/28219\n color: tokens.colorPaletteCranberryForeground2\n },\n warning: {\n // FIXME https://github.com/microsoft/fluentui/issues/28219\n color: tokens.colorPaletteDarkOrangeForeground1\n },\n info: {\n color: tokens.colorNeutralForeground2\n }\n});\nconst useIntentIconStylesInverted = makeStyles({\n success: {\n // FIXME https://github.com/microsoft/fluentui/issues/28219\n color: tokens.colorPaletteGreenForegroundInverted\n },\n error: {\n // FIXME https://github.com/microsoft/fluentui/issues/28219\n color: tokens.colorPaletteRedForegroundInverted\n },\n warning: {\n // FIXME https://github.com/microsoft/fluentui/issues/28219\n color: tokens.colorPaletteYellowForegroundInverted\n },\n info: {\n color: tokens.colorNeutralForegroundInverted2\n }\n});\n/**\n * Apply styling to the ToastTitle slots based on the state\n */ export const useToastTitleStyles_unstable = (state)=>{\n const rootBaseClassName = useRootBaseClassName();\n const actionBaseClassName = useActionBaseClassName();\n const mediaBaseClassName = useMediaBaseClassName();\n const intentIconStyles = useIntentIconStyles();\n const intentIconStylesInverted = useIntentIconStylesInverted();\n const { intent } = state;\n const invertedStyles = useInvertedStyles();\n state.root.className = mergeClasses(toastTitleClassNames.root, rootBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.root, state.root.className);\n if (state.media) {\n state.media.className = mergeClasses(toastTitleClassNames.media, mediaBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.media, state.media.className, intent && intentIconStyles[intent], intent && state.backgroundAppearance === 'inverted' && intentIconStylesInverted[intent]);\n }\n if (state.action) {\n state.action.className = mergeClasses(toastTitleClassNames.action, actionBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.action, state.action.className);\n }\n return state;\n};\n"],"mappings":"AAAA,SAAAA,QAAA,EAAAC,aAAA,EAAsCC,YAAY,QAAQ,gBAAgB;AAC1E,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,OAAO,MAAMC,oBAAoB,GAAG;EAChCC,IAAI,EAAE,gBAAgB;EACtBC,KAAK,EAAE,uBAAuB;EAC9BC,MAAM,EAAE;AACZ,CAAC;AACD,MAAMC,oBAAoB,gBAAGP,aAAA,yHAK5B,CAAC;AACF,MAAMQ,qBAAqB,gBAAGR,aAAA,kSAO7B,CAAC;AACF,MAAMS,sBAAsB,gBAAGT,aAAA,oQAM9B,CAAC;AACF,MAAMU,iBAAiB,gBAAGX,QAAA;EAAAK,IAAA;IAAAO,MAAA;EAAA;EAAAL,MAAA;IAAAK,MAAA;EAAA;EAAAN,KAAA;IAAAM,MAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,CAUzB,CAAC;AACF,MAAMC,mBAAmB,gBAAGd,QAAA;EAAAe,OAAA;IAAAH,MAAA;EAAA;EAAAI,KAAA;IAAAJ,MAAA;EAAA;EAAAK,OAAA;IAAAL,MAAA;EAAA;EAAAM,IAAA;IAAAN,MAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,CAgB3B,CAAC;AACF,MAAMM,2BAA2B,gBAAGnB,QAAA;EAAAe,OAAA;IAAAH,MAAA;EAAA;EAAAI,KAAA;IAAAJ,MAAA;EAAA;EAAAK,OAAA;IAAAL,MAAA;EAAA;EAAAM,IAAA;IAAAN,MAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,CAgBnC,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMO,4BAA4B,GAAIC,KAAK,IAAG;EACrD,MAAMC,iBAAiB,GAAGd,oBAAoB,CAAC,CAAC;EAChD,MAAMe,mBAAmB,GAAGb,sBAAsB,CAAC,CAAC;EACpD,MAAMc,kBAAkB,GAAGf,qBAAqB,CAAC,CAAC;EAClD,MAAMgB,gBAAgB,GAAGX,mBAAmB,CAAC,CAAC;EAC9C,MAAMY,wBAAwB,GAAGP,2BAA2B,CAAC,CAAC;EAC9D,MAAM;IAAEQ;EAAQ,CAAC,GAAGN,KAAK;EACzB,MAAMO,cAAc,GAAGjB,iBAAiB,CAAC,CAAC;EAC1CU,KAAK,CAAChB,IAAI,CAACwB,SAAS,GAAG3B,YAAY,CAACE,oBAAoB,CAACC,IAAI,EAAEiB,iBAAiB,EAAED,KAAK,CAACS,oBAAoB,KAAK,UAAU,IAAIF,cAAc,CAACvB,IAAI,EAAEgB,KAAK,CAAChB,IAAI,CAACwB,SAAS,CAAC;EACzK,IAAIR,KAAK,CAACf,KAAK,EAAE;IACbe,KAAK,CAACf,KAAK,CAACuB,SAAS,GAAG3B,YAAY,CAACE,oBAAoB,CAACE,KAAK,EAAEkB,kBAAkB,EAAEH,KAAK,CAACS,oBAAoB,KAAK,UAAU,IAAIF,cAAc,CAACtB,KAAK,EAAEe,KAAK,CAACf,KAAK,CAACuB,SAAS,EAAEF,MAAM,IAAIF,gBAAgB,CAACE,MAAM,CAAC,EAAEA,MAAM,IAAIN,KAAK,CAACS,oBAAoB,KAAK,UAAU,IAAIJ,wBAAwB,CAACC,MAAM,CAAC,CAAC;EAC/S;EACA,IAAIN,KAAK,CAACd,MAAM,EAAE;IACdc,KAAK,CAACd,MAAM,CAACsB,SAAS,GAAG3B,YAAY,CAACE,oBAAoB,CAACG,MAAM,EAAEgB,mBAAmB,EAAEF,KAAK,CAACS,oBAAoB,KAAK,UAAU,IAAIF,cAAc,CAACrB,MAAM,EAAEc,KAAK,CAACd,MAAM,CAACsB,SAAS,CAAC;EACvL;EACA,OAAOR,KAAK;AAChB,CAAC"}
1
+ {"version":3,"names":["__styles","__resetStyles","mergeClasses","tokens","toastTitleClassNames","root","media","action","useRootBaseClassName","useMediaBaseClassName","useActionBaseClassName","useInvertedStyles","sj55zd","d","useIntentIconStyles","success","error","warning","info","useIntentIconStylesInverted","useToastTitleStyles_unstable","state","rootBaseClassName","actionBaseClassName","mediaBaseClassName","intentIconStyles","intentIconStylesInverted","intent","invertedStyles","className","backgroundAppearance"],"sources":["useToastTitleStyles.styles.js"],"sourcesContent":["import { makeStyles, makeResetStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nexport const toastTitleClassNames = {\n root: 'fui-ToastTitle',\n media: 'fui-ToastTitle__media',\n action: 'fui-ToastTitle__action'\n};\nconst useRootBaseClassName = makeResetStyles({\n display: 'flex',\n alignItems: 'center',\n gridColumnEnd: 3,\n color: tokens.colorNeutralForeground1\n});\nconst useMediaBaseClassName = makeResetStyles({\n display: 'flex',\n alignItems: 'center',\n gridColumnEnd: 2,\n paddingRight: '8px',\n fontSize: '16px',\n color: tokens.colorNeutralForeground1\n});\nconst useActionBaseClassName = makeResetStyles({\n display: 'flex',\n alignItems: 'center',\n paddingLeft: '12px',\n gridColumnEnd: -1,\n color: tokens.colorBrandForeground1\n});\nconst useInvertedStyles = makeStyles({\n root: {\n color: tokens.colorNeutralForegroundInverted2\n },\n action: {\n color: tokens.colorBrandForegroundInverted\n },\n media: {\n color: tokens.colorNeutralForegroundInverted\n }\n});\nconst useIntentIconStyles = makeStyles({\n success: {\n // FIXME https://github.com/microsoft/fluentui/issues/28219\n color: tokens.colorPaletteGreenForeground3\n },\n error: {\n // FIXME https://github.com/microsoft/fluentui/issues/28219\n color: tokens.colorPaletteCranberryForeground2\n },\n warning: {\n // FIXME https://github.com/microsoft/fluentui/issues/28219\n color: tokens.colorPaletteDarkOrangeForeground1\n },\n info: {\n color: tokens.colorNeutralForeground2\n }\n});\nconst useIntentIconStylesInverted = makeStyles({\n success: {\n // FIXME https://github.com/microsoft/fluentui/issues/28219\n color: tokens.colorPaletteGreenForegroundInverted\n },\n error: {\n // FIXME https://github.com/microsoft/fluentui/issues/28219\n color: tokens.colorPaletteRedForegroundInverted\n },\n warning: {\n // FIXME https://github.com/microsoft/fluentui/issues/28219\n color: tokens.colorPaletteYellowForegroundInverted\n },\n info: {\n color: tokens.colorNeutralForegroundInverted2\n }\n});\n/**\n * Apply styling to the ToastTitle slots based on the state\n */ export const useToastTitleStyles_unstable = (state)=>{\n const rootBaseClassName = useRootBaseClassName();\n const actionBaseClassName = useActionBaseClassName();\n const mediaBaseClassName = useMediaBaseClassName();\n const intentIconStyles = useIntentIconStyles();\n const intentIconStylesInverted = useIntentIconStylesInverted();\n const { intent } = state;\n const invertedStyles = useInvertedStyles();\n state.root.className = mergeClasses(toastTitleClassNames.root, rootBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.root, state.root.className);\n if (state.media) {\n state.media.className = mergeClasses(toastTitleClassNames.media, mediaBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.media, state.media.className, intent && intentIconStyles[intent], intent && state.backgroundAppearance === 'inverted' && intentIconStylesInverted[intent]);\n }\n if (state.action) {\n state.action.className = mergeClasses(toastTitleClassNames.action, actionBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.action, state.action.className);\n }\n return state;\n};\n"],"mappings":"AAAA,SAAAA,QAAA,EAAAC,aAAA,EAAsCC,YAAY,QAAQ,gBAAgB;AAC1E,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,OAAO,MAAMC,oBAAoB,GAAG;EAChCC,IAAI,EAAE,gBAAgB;EACtBC,KAAK,EAAE,uBAAuB;EAC9BC,MAAM,EAAE;AACZ,CAAC;AACD,MAAMC,oBAAoB,gBAAGP,aAAA,yHAK5B,CAAC;AACF,MAAMQ,qBAAqB,gBAAGR,aAAA,kSAO7B,CAAC;AACF,MAAMS,sBAAsB,gBAAGT,aAAA,oQAM9B,CAAC;AACF,MAAMU,iBAAiB,gBAAGX,QAAA;EAAAK,IAAA;IAAAO,MAAA;EAAA;EAAAL,MAAA;IAAAK,MAAA;EAAA;EAAAN,KAAA;IAAAM,MAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,CAUzB,CAAC;AACF,MAAMC,mBAAmB,gBAAGd,QAAA;EAAAe,OAAA;IAAAH,MAAA;EAAA;EAAAI,KAAA;IAAAJ,MAAA;EAAA;EAAAK,OAAA;IAAAL,MAAA;EAAA;EAAAM,IAAA;IAAAN,MAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,CAgB3B,CAAC;AACF,MAAMM,2BAA2B,gBAAGnB,QAAA;EAAAe,OAAA;IAAAH,MAAA;EAAA;EAAAI,KAAA;IAAAJ,MAAA;EAAA;EAAAK,OAAA;IAAAL,MAAA;EAAA;EAAAM,IAAA;IAAAN,MAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,CAgBnC,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMO,4BAA4B,GAAIC,KAAK,IAAG;EACrD,MAAMC,iBAAiB,GAAGd,oBAAoB,CAAC,CAAC;EAChD,MAAMe,mBAAmB,GAAGb,sBAAsB,CAAC,CAAC;EACpD,MAAMc,kBAAkB,GAAGf,qBAAqB,CAAC,CAAC;EAClD,MAAMgB,gBAAgB,GAAGX,mBAAmB,CAAC,CAAC;EAC9C,MAAMY,wBAAwB,GAAGP,2BAA2B,CAAC,CAAC;EAC9D,MAAM;IAAEQ;EAAO,CAAC,GAAGN,KAAK;EACxB,MAAMO,cAAc,GAAGjB,iBAAiB,CAAC,CAAC;EAC1CU,KAAK,CAAChB,IAAI,CAACwB,SAAS,GAAG3B,YAAY,CAACE,oBAAoB,CAACC,IAAI,EAAEiB,iBAAiB,EAAED,KAAK,CAACS,oBAAoB,KAAK,UAAU,IAAIF,cAAc,CAACvB,IAAI,EAAEgB,KAAK,CAAChB,IAAI,CAACwB,SAAS,CAAC;EACzK,IAAIR,KAAK,CAACf,KAAK,EAAE;IACbe,KAAK,CAACf,KAAK,CAACuB,SAAS,GAAG3B,YAAY,CAACE,oBAAoB,CAACE,KAAK,EAAEkB,kBAAkB,EAAEH,KAAK,CAACS,oBAAoB,KAAK,UAAU,IAAIF,cAAc,CAACtB,KAAK,EAAEe,KAAK,CAACf,KAAK,CAACuB,SAAS,EAAEF,MAAM,IAAIF,gBAAgB,CAACE,MAAM,CAAC,EAAEA,MAAM,IAAIN,KAAK,CAACS,oBAAoB,KAAK,UAAU,IAAIJ,wBAAwB,CAACC,MAAM,CAAC,CAAC;EAC/S;EACA,IAAIN,KAAK,CAACd,MAAM,EAAE;IACdc,KAAK,CAACd,MAAM,CAACsB,SAAS,GAAG3B,YAAY,CAACE,oBAAoB,CAACG,MAAM,EAAEgB,mBAAmB,EAAEF,KAAK,CAACS,oBAAoB,KAAK,UAAU,IAAIF,cAAc,CAACrB,MAAM,EAAEc,KAAK,CAACd,MAAM,CAACsB,SAAS,CAAC;EACvL;EACA,OAAOR,KAAK;AAChB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["ToastTrigger.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useToastTrigger_unstable } from './useToastTrigger';\nimport { renderToastTrigger_unstable } from './renderToastTrigger';\nimport type { ToastTriggerProps } from './ToastTrigger.types';\n\n/**\n * ToastTrigger component\n */\nexport const ToastTrigger: React.FC<ToastTriggerProps> = props => {\n const state = useToastTrigger_unstable(props);\n\n return renderToastTrigger_unstable(state);\n};\n\nToastTrigger.displayName = 'ToastTrigger';\n"],"names":["React","useToastTrigger_unstable","renderToastTrigger_unstable","ToastTrigger","props","state","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,wBAAwB,QAAQ,oBAAoB;AAC7D,SAASC,2BAA2B,QAAQ,uBAAuB;AAGnE;;CAEC,GACD,OAAO,MAAMC,eAA4CC,CAAAA,QAAS;IAChE,MAAMC,QAAQJ,yBAAyBG;IAEvC,OAAOF,4BAA4BG;AACrC,EAAE;AAEFF,aAAaG,WAAW,GAAG"}
1
+ {"version":3,"sources":["ToastTrigger.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useToastTrigger_unstable } from './useToastTrigger';\nimport { renderToastTrigger_unstable } from './renderToastTrigger';\nimport type { ToastTriggerProps } from './ToastTrigger.types';\n\n/**\n * ToastTrigger component\n */\nexport const ToastTrigger: React.FC<ToastTriggerProps> = props => {\n const state = useToastTrigger_unstable(props);\n\n return renderToastTrigger_unstable(state);\n};\n\nToastTrigger.displayName = 'ToastTrigger';\n"],"names":["React","useToastTrigger_unstable","renderToastTrigger_unstable","ToastTrigger","props","state","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,wBAAwB,QAAQ,oBAAoB;AAC7D,SAASC,2BAA2B,QAAQ,uBAAuB;AAGnE;;CAEC,GACD,OAAO,MAAMC,eAA4CC,CAAAA;IACvD,MAAMC,QAAQJ,yBAAyBG;IAEvC,OAAOF,4BAA4BG;AACrC,EAAE;AAEFF,aAAaG,WAAW,GAAG"}
@@ -11,22 +11,23 @@ import { useToastContainerContext } from '../../contexts/toastContainerContext';
11
11
  * Besides being a trigger that closes a toast through context this component doesn't do much,
12
12
  * making it basically unnecessary in cases where the trigger is outside of a toast.
13
13
  */ export const useToastTrigger_unstable = (props)=>{
14
- const { children , disableButtonEnhancement =false } = props;
15
- const { close } = useToastContainerContext();
14
+ var _child, _child1, _child2, _child3;
15
+ const { children, disableButtonEnhancement = false } = props;
16
+ const { close } = useToastContainerContext();
16
17
  const child = getTriggerChild(children);
17
18
  const handleClick = useEventCallback((e)=>{
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, e);
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, e);
20
21
  if (!e.isDefaultPrevented()) {
21
22
  close();
22
23
  }
23
24
  });
24
25
  const triggerChildProps = {
25
- ...child === null || child === void 0 ? void 0 : child.props,
26
- ref: child === null || child === void 0 ? void 0 : child.ref,
26
+ ...(_child = child) === null || _child === void 0 ? void 0 : _child.props,
27
+ ref: (_child1 = child) === null || _child1 === void 0 ? void 0 : _child1.ref,
27
28
  onClick: handleClick
28
29
  };
29
- 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', {
30
+ 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', {
30
31
  ...triggerChildProps,
31
32
  type: 'button'
32
33
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["useToastTrigger.ts"],"sourcesContent":["import * as React from 'react';\nimport { applyTriggerPropsToChildren, getTriggerChild, useEventCallback } from '@fluentui/react-utilities';\nimport { useARIAButtonProps } from '@fluentui/react-aria';\nimport type { ToastTriggerProps, ToastTriggerState } from './ToastTrigger.types';\nimport { useToastContainerContext } from '../../contexts/toastContainerContext';\n\n/**\n * A non-visual component that wraps its child\n * and configures them to be the trigger that will close a `Toast`.\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 `Toast`\n * Besides being a trigger that closes a toast through context this component doesn't do much,\n * making it basically unnecessary in cases where the trigger is outside of a toast.\n */\nexport const useToastTrigger_unstable = (props: ToastTriggerProps): ToastTriggerState => {\n const { children, disableButtonEnhancement = false } = props;\n const { close } = useToastContainerContext();\n\n const child = getTriggerChild(children);\n\n const handleClick = useEventCallback(\n (e: React.MouseEvent<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>) => {\n child?.props.onClick?.(e);\n if (!e.isDefaultPrevented()) {\n close();\n }\n },\n );\n\n const triggerChildProps = {\n ...child?.props,\n ref: child?.ref,\n onClick: handleClick,\n };\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","useARIAButtonProps","useToastContainerContext","useToastTrigger_unstable","props","children","disableButtonEnhancement","close","child","handleClick","e","onClick","isDefaultPrevented","triggerChildProps","ref","ariaButtonTriggerChildProps","type"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,2BAA2B,EAAEC,eAAe,EAAEC,gBAAgB,QAAQ,4BAA4B;AAC3G,SAASC,kBAAkB,QAAQ,uBAAuB;AAE1D,SAASC,wBAAwB,QAAQ,uCAAuC;AAEhF;;;;;;;;CAQC,GACD,OAAO,MAAMC,2BAA2B,CAACC,QAAgD;IACvF,MAAM,EAAEC,SAAQ,EAAEC,0BAA2B,KAAK,CAAA,EAAE,GAAGF;IACvD,MAAM,EAAEG,MAAK,EAAE,GAAGL;IAElB,MAAMM,QAAQT,gBAAgBM;IAE9B,MAAMI,cAAcT,iBAClB,CAACU,IAAgF;YAC/EF,cAAAA;QAAAA,CAAAA,uBAAAA,eAAAA,kBAAAA,mBAAAA,KAAAA,IAAAA,MAAOJ,KAAK,CAACO,OAAO,cAApBH,kCAAAA,KAAAA,IAAAA,qBAAAA,KAAAA,cAAuBE;QACvB,IAAI,CAACA,EAAEE,kBAAkB,IAAI;YAC3BL;QACF,CAAC;IACH;IAGF,MAAMM,oBAAoB;QACxB,GAAGL,kBAAAA,mBAAAA,KAAAA,IAAAA,MAAOJ,KAAK;QACfU,KAAKN,kBAAAA,mBAAAA,KAAAA,IAAAA,MAAOM,GAAG;QACfH,SAASF;IACX;IAEA,MAAMM,8BAA8Bd,mBAClCO,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,GAAGH,iBAAiB;QACpBG,MAAM;IACR;IAGF,OAAO;QACLX,UAAUP,4BACRO,UACAC,2BAA2BO,oBAAoBE,2BAA2B;IAE9E;AACF,EAAE"}
1
+ {"version":3,"sources":["useToastTrigger.ts"],"sourcesContent":["import * as React from 'react';\nimport { applyTriggerPropsToChildren, getTriggerChild, useEventCallback } from '@fluentui/react-utilities';\nimport { useARIAButtonProps } from '@fluentui/react-aria';\nimport type { ToastTriggerProps, ToastTriggerState } from './ToastTrigger.types';\nimport { useToastContainerContext } from '../../contexts/toastContainerContext';\n\n/**\n * A non-visual component that wraps its child\n * and configures them to be the trigger that will close a `Toast`.\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 `Toast`\n * Besides being a trigger that closes a toast through context this component doesn't do much,\n * making it basically unnecessary in cases where the trigger is outside of a toast.\n */\nexport const useToastTrigger_unstable = (props: ToastTriggerProps): ToastTriggerState => {\n const { children, disableButtonEnhancement = false } = props;\n const { close } = useToastContainerContext();\n\n const child = getTriggerChild(children);\n\n const handleClick = useEventCallback(\n (e: React.MouseEvent<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>) => {\n child?.props.onClick?.(e);\n if (!e.isDefaultPrevented()) {\n close();\n }\n },\n );\n\n const triggerChildProps = {\n ...child?.props,\n ref: child?.ref,\n onClick: handleClick,\n };\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","useARIAButtonProps","useToastContainerContext","useToastTrigger_unstable","props","child","children","disableButtonEnhancement","close","handleClick","e","onClick","isDefaultPrevented","triggerChildProps","ref","ariaButtonTriggerChildProps","type"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,2BAA2B,EAAEC,eAAe,EAAEC,gBAAgB,QAAQ,4BAA4B;AAC3G,SAASC,kBAAkB,QAAQ,uBAAuB;AAE1D,SAASC,wBAAwB,QAAQ,uCAAuC;AAEhF;;;;;;;;CAQC,GACD,OAAO,MAAMC,2BAA2B,CAACC;QAgBlCC,QACEA,SAKLA,SAA4BA;IArB9B,MAAM,EAAEC,QAAQ,EAAEC,2BAA2B,KAAK,EAAE,GAAGH;IACvD,MAAM,EAAEI,KAAK,EAAE,GAAGN;IAElB,MAAMG,QAAQN,gBAAgBO;IAE9B,MAAMG,cAAcT,iBAClB,CAACU;YACCL,sBAAAA,QAAAA;SAAAA,SAAAA,mBAAAA,8BAAAA,uBAAAA,CAAAA,eAAAA,OAAOD,KAAK,EAACO,OAAO,cAApBN,2CAAAA,0BAAAA,cAAuBK;QACvB,IAAI,CAACA,EAAEE,kBAAkB,IAAI;YAC3BJ;QACF;IACF;IAGF,MAAMK,oBAAoB;YACrBR,SAAAA,mBAAAA,6BAAAA,OAAOD,KAAK,AAAf;QACAU,GAAG,GAAET,UAAAA,mBAAAA,8BAAAA,QAAOS,GAAG;QACfH,SAASF;IACX;IAEA,MAAMM,8BAA8Bd,mBAClCI,EAAAA,UAAAA,mBAAAA,8BAAAA,QAAOW,IAAI,MAAK,YAAYX,EAAAA,UAAAA,mBAAAA,8BAAAA,QAAOW,IAAI,MAAK,MAAMX,MAAMW,IAAI,GAAG,OAC/D;QACE,GAAGH,iBAAiB;QACpBG,MAAM;IACR;IAGF,OAAO;QACLV,UAAUR,4BACRQ,UACAC,2BAA2BM,oBAAoBE;IAEnD;AACF,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["Toaster.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useToaster_unstable } from './useToaster';\nimport { renderToaster_unstable } from './renderToaster';\nimport { useToasterStyles_unstable } from './useToasterStyles.styles';\nimport type { ToasterProps } from './Toaster.types';\n\n/**\n * Toaster component - renders a collection of toasts dispatched imperatively\n */\nexport const Toaster: React.FC<ToasterProps> = props => {\n const state = useToaster_unstable(props);\n\n useToasterStyles_unstable(state);\n return renderToaster_unstable(state);\n};\n\nToaster.displayName = 'Toaster';\n"],"names":["React","useToaster_unstable","renderToaster_unstable","useToasterStyles_unstable","Toaster","props","state","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,mBAAmB,QAAQ,eAAe;AACnD,SAASC,sBAAsB,QAAQ,kBAAkB;AACzD,SAASC,yBAAyB,QAAQ,4BAA4B;AAGtE;;CAEC,GACD,OAAO,MAAMC,UAAkCC,CAAAA,QAAS;IACtD,MAAMC,QAAQL,oBAAoBI;IAElCF,0BAA0BG;IAC1B,OAAOJ,uBAAuBI;AAChC,EAAE;AAEFF,QAAQG,WAAW,GAAG"}
1
+ {"version":3,"sources":["Toaster.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useToaster_unstable } from './useToaster';\nimport { renderToaster_unstable } from './renderToaster';\nimport { useToasterStyles_unstable } from './useToasterStyles.styles';\nimport type { ToasterProps } from './Toaster.types';\n\n/**\n * Toaster component - renders a collection of toasts dispatched imperatively\n */\nexport const Toaster: React.FC<ToasterProps> = props => {\n const state = useToaster_unstable(props);\n\n useToasterStyles_unstable(state);\n return renderToaster_unstable(state);\n};\n\nToaster.displayName = 'Toaster';\n"],"names":["React","useToaster_unstable","renderToaster_unstable","useToasterStyles_unstable","Toaster","props","state","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,mBAAmB,QAAQ,eAAe;AACnD,SAASC,sBAAsB,QAAQ,kBAAkB;AACzD,SAASC,yBAAyB,QAAQ,4BAA4B;AAGtE;;CAEC,GACD,OAAO,MAAMC,UAAkCC,CAAAA;IAC7C,MAAMC,QAAQL,oBAAoBI;IAElCF,0BAA0BG;IAC1B,OAAOJ,uBAAuBI;AAChC,EAAE;AAEFF,QAAQG,WAAW,GAAG"}
@@ -1,16 +1,27 @@
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
  import { Portal } from '@fluentui/react-portal';
4
4
  import { AriaLive } from '../AriaLive';
5
5
  /**
6
6
  * Render the final JSX of Toaster
7
7
  */ export const renderToaster_unstable = (state)=>{
8
- const { announceRef , renderAriaLive } = state;
8
+ const { announceRef, renderAriaLive } = state;
9
9
  assertSlots(state);
10
10
  const hasToasts = !!state.bottomStart || !!state.bottomEnd || !!state.topStart || !!state.topEnd;
11
- return /*#__PURE__*/ createElement(Fragment, null, renderAriaLive ? /*#__PURE__*/ createElement(AriaLive, {
12
- announceRef: announceRef
13
- }) : null, hasToasts ? /*#__PURE__*/ createElement(Portal, {
14
- mountNode: state.mountNode
15
- }, state.bottomStart ? /*#__PURE__*/ createElement(state.bottomStart, null) : null, state.bottomEnd ? /*#__PURE__*/ createElement(state.bottomEnd, null) : null, state.topStart ? /*#__PURE__*/ createElement(state.topStart, null) : null, state.topEnd ? /*#__PURE__*/ createElement(state.topEnd, null) : null) : null);
11
+ return /*#__PURE__*/ _jsxs(_Fragment, {
12
+ children: [
13
+ renderAriaLive ? /*#__PURE__*/ _jsx(AriaLive, {
14
+ announceRef: announceRef
15
+ }) : null,
16
+ hasToasts ? /*#__PURE__*/ _jsxs(Portal, {
17
+ mountNode: state.mountNode,
18
+ children: [
19
+ state.bottomStart ? /*#__PURE__*/ _jsx(state.bottomStart, {}) : null,
20
+ state.bottomEnd ? /*#__PURE__*/ _jsx(state.bottomEnd, {}) : null,
21
+ state.topStart ? /*#__PURE__*/ _jsx(state.topStart, {}) : null,
22
+ state.topEnd ? /*#__PURE__*/ _jsx(state.topEnd, {}) : null
23
+ ]
24
+ }) : null
25
+ ]
26
+ });
16
27
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["renderToaster.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsxFrag Fragment */\n/** @jsx createElement */\n\nimport { createElement, Fragment } from '@fluentui/react-jsx-runtime';\nimport { assertSlots } from '@fluentui/react-utilities';\nimport { Portal } from '@fluentui/react-portal';\nimport type { ToasterState, ToasterSlotsInternal } from './Toaster.types';\nimport { AriaLive } from '../AriaLive';\n\n/**\n * Render the final JSX of Toaster\n */\nexport const renderToaster_unstable = (state: ToasterState) => {\n const { announceRef, renderAriaLive } = state;\n assertSlots<ToasterSlotsInternal>(state);\n\n const hasToasts = !!state.bottomStart || !!state.bottomEnd || !!state.topStart || !!state.topEnd;\n\n return (\n <>\n {renderAriaLive ? <AriaLive announceRef={announceRef} /> : null}\n {hasToasts ? (\n <Portal mountNode={state.mountNode}>\n {state.bottomStart ? <state.bottomStart /> : null}\n {state.bottomEnd ? <state.bottomEnd /> : null}\n {state.topStart ? <state.topStart /> : null}\n {state.topEnd ? <state.topEnd /> : null}\n </Portal>\n ) : null}\n </>\n );\n};\n"],"names":["createElement","Fragment","assertSlots","Portal","AriaLive","renderToaster_unstable","state","announceRef","renderAriaLive","hasToasts","bottomStart","bottomEnd","topStart","topEnd","mountNode"],"mappings":"AAAA,wBAAwB,GACxB,sBAAsB,GACtB,uBAAuB,GAEvB,SAASA,aAAa,EAAEC,QAAQ,QAAQ,8BAA8B;AACtE,SAASC,WAAW,QAAQ,4BAA4B;AACxD,SAASC,MAAM,QAAQ,yBAAyB;AAEhD,SAASC,QAAQ,QAAQ,cAAc;AAEvC;;CAEC,GACD,OAAO,MAAMC,yBAAyB,CAACC,QAAwB;IAC7D,MAAM,EAAEC,YAAW,EAAEC,eAAc,EAAE,GAAGF;IACxCJ,YAAkCI;IAElC,MAAMG,YAAY,CAAC,CAACH,MAAMI,WAAW,IAAI,CAAC,CAACJ,MAAMK,SAAS,IAAI,CAAC,CAACL,MAAMM,QAAQ,IAAI,CAAC,CAACN,MAAMO,MAAM;IAEhG,qBACE,AAlBJ,cADA,gBAoBOL,+BAAiB,AAnBxB,cAmByBJ;QAASG,aAAaA;SAAkB,IAAI,EAC9DE,0BACC,AArBR,cAqBSN;QAAOW,WAAWR,MAAMQ,SAAS;OAC/BR,MAAMI,WAAW,iBAAG,AAtB/B,cAsBgCJ,MAAMI,WAAW,UAAM,IAAI,EAChDJ,MAAMK,SAAS,iBAAG,AAvB7B,cAuB8BL,MAAMK,SAAS,UAAM,IAAI,EAC5CL,MAAMM,QAAQ,iBAAG,AAxB5B,cAwB6BN,MAAMM,QAAQ,UAAM,IAAI,EAC1CN,MAAMO,MAAM,iBAAG,AAzB1B,cAyB2BP,MAAMO,MAAM,UAAM,IAAI,IAEvC,IAAI;AAGd,EAAE"}
1
+ {"version":3,"sources":["renderToaster.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport { Portal } from '@fluentui/react-portal';\nimport type { ToasterState, ToasterSlotsInternal } from './Toaster.types';\nimport { AriaLive } from '../AriaLive';\n\n/**\n * Render the final JSX of Toaster\n */\nexport const renderToaster_unstable = (state: ToasterState) => {\n const { announceRef, renderAriaLive } = state;\n assertSlots<ToasterSlotsInternal>(state);\n\n const hasToasts = !!state.bottomStart || !!state.bottomEnd || !!state.topStart || !!state.topEnd;\n\n return (\n <>\n {renderAriaLive ? <AriaLive announceRef={announceRef} /> : null}\n {hasToasts ? (\n <Portal mountNode={state.mountNode}>\n {state.bottomStart ? <state.bottomStart /> : null}\n {state.bottomEnd ? <state.bottomEnd /> : null}\n {state.topStart ? <state.topStart /> : null}\n {state.topEnd ? <state.topEnd /> : null}\n </Portal>\n ) : null}\n </>\n );\n};\n"],"names":["assertSlots","Portal","AriaLive","renderToaster_unstable","state","announceRef","renderAriaLive","hasToasts","bottomStart","bottomEnd","topStart","topEnd","mountNode"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AACxD,SAASC,MAAM,QAAQ,yBAAyB;AAEhD,SAASC,QAAQ,QAAQ,cAAc;AAEvC;;CAEC,GACD,OAAO,MAAMC,yBAAyB,CAACC;IACrC,MAAM,EAAEC,WAAW,EAAEC,cAAc,EAAE,GAAGF;IACxCJ,YAAkCI;IAElC,MAAMG,YAAY,CAAC,CAACH,MAAMI,WAAW,IAAI,CAAC,CAACJ,MAAMK,SAAS,IAAI,CAAC,CAACL,MAAMM,QAAQ,IAAI,CAAC,CAACN,MAAMO,MAAM;IAEhG,qBACE;;YACGL,+BAAiB,KAACJ;gBAASG,aAAaA;iBAAkB;YAC1DE,0BACC,MAACN;gBAAOW,WAAWR,MAAMQ,SAAS;;oBAC/BR,MAAMI,WAAW,iBAAG,KAACJ,MAAMI,WAAW,QAAM;oBAC5CJ,MAAMK,SAAS,iBAAG,KAACL,MAAMK,SAAS,QAAM;oBACxCL,MAAMM,QAAQ,iBAAG,KAACN,MAAMM,QAAQ,QAAM;oBACtCN,MAAMO,MAAM,iBAAG,KAACP,MAAMO,MAAM,QAAM;;iBAEnC;;;AAGV,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["useToastAnnounce.ts"],"sourcesContent":["import * as React from 'react';\nimport { Announce } from '../AriaLive';\nimport { isHTMLElement } from '@fluentui/react-utilities';\n\n/**\n * Wraps an aria live announcement function.\n * Aria live announcements can be detrimental once the user is already navigating\n * multiple toasts. Once the user is focused inside the toaster, the announecments should be disabled.\n * @param announce\n * @returns A function to announce a toast and a ref to attach to the toaster element\n */\nexport function useToastAnnounce(announce: Announce) {\n const activeRef = React.useRef(true);\n const cleanupRef = React.useRef<() => void>(() => undefined);\n const announceToast = React.useCallback<Announce>(\n (message, options) => {\n if (activeRef.current) {\n announce(message, options);\n }\n },\n [announce],\n );\n\n const toasterRef = React.useCallback((el: HTMLDivElement | null) => {\n if (!el) {\n cleanupRef.current();\n return;\n }\n\n const onFocusIn = (e: FocusEvent) => {\n if (\n isHTMLElement(e.currentTarget) &&\n e.currentTarget.contains(isHTMLElement(e.relatedTarget) ? e.relatedTarget : null)\n ) {\n return;\n }\n\n activeRef.current = false;\n };\n\n const onFocusOut = (e: FocusEvent) => {\n if (\n isHTMLElement(e.currentTarget) &&\n e.currentTarget.contains(isHTMLElement(e.relatedTarget) ? e.relatedTarget : null)\n ) {\n return;\n }\n\n activeRef.current = true;\n };\n\n el.addEventListener('focusin', onFocusIn);\n el.addEventListener('focusout', onFocusOut);\n\n cleanupRef.current = () => {\n el.removeEventListener('focusin', onFocusIn);\n el.removeEventListener('focusout', onFocusOut);\n };\n }, []);\n\n return {\n announceToast,\n toasterRef,\n };\n}\n"],"names":["React","isHTMLElement","useToastAnnounce","announce","activeRef","useRef","cleanupRef","undefined","announceToast","useCallback","message","options","current","toasterRef","el","onFocusIn","e","currentTarget","contains","relatedTarget","onFocusOut","addEventListener","removeEventListener"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,aAAa,QAAQ,4BAA4B;AAE1D;;;;;;CAMC,GACD,OAAO,SAASC,iBAAiBC,QAAkB,EAAE;IACnD,MAAMC,YAAYJ,MAAMK,MAAM,CAAC,IAAI;IACnC,MAAMC,aAAaN,MAAMK,MAAM,CAAa,IAAME;IAClD,MAAMC,gBAAgBR,MAAMS,WAAW,CACrC,CAACC,SAASC,UAAY;QACpB,IAAIP,UAAUQ,OAAO,EAAE;YACrBT,SAASO,SAASC;QACpB,CAAC;IACH,GACA;QAACR;KAAS;IAGZ,MAAMU,aAAab,MAAMS,WAAW,CAAC,CAACK,KAA8B;QAClE,IAAI,CAACA,IAAI;YACPR,WAAWM,OAAO;YAClB;QACF,CAAC;QAED,MAAMG,YAAY,CAACC,IAAkB;YACnC,IACEf,cAAce,EAAEC,aAAa,KAC7BD,EAAEC,aAAa,CAACC,QAAQ,CAACjB,cAAce,EAAEG,aAAa,IAAIH,EAAEG,aAAa,GAAG,IAAI,GAChF;gBACA;YACF,CAAC;YAEDf,UAAUQ,OAAO,GAAG,KAAK;QAC3B;QAEA,MAAMQ,aAAa,CAACJ,IAAkB;YACpC,IACEf,cAAce,EAAEC,aAAa,KAC7BD,EAAEC,aAAa,CAACC,QAAQ,CAACjB,cAAce,EAAEG,aAAa,IAAIH,EAAEG,aAAa,GAAG,IAAI,GAChF;gBACA;YACF,CAAC;YAEDf,UAAUQ,OAAO,GAAG,IAAI;QAC1B;QAEAE,GAAGO,gBAAgB,CAAC,WAAWN;QAC/BD,GAAGO,gBAAgB,CAAC,YAAYD;QAEhCd,WAAWM,OAAO,GAAG,IAAM;YACzBE,GAAGQ,mBAAmB,CAAC,WAAWP;YAClCD,GAAGQ,mBAAmB,CAAC,YAAYF;QACrC;IACF,GAAG,EAAE;IAEL,OAAO;QACLZ;QACAK;IACF;AACF,CAAC"}
1
+ {"version":3,"sources":["useToastAnnounce.ts"],"sourcesContent":["import * as React from 'react';\nimport { Announce } from '../AriaLive';\nimport { isHTMLElement } from '@fluentui/react-utilities';\n\n/**\n * Wraps an aria live announcement function.\n * Aria live announcements can be detrimental once the user is already navigating\n * multiple toasts. Once the user is focused inside the toaster, the announecments should be disabled.\n * @param announce\n * @returns A function to announce a toast and a ref to attach to the toaster element\n */\nexport function useToastAnnounce(announce: Announce) {\n const activeRef = React.useRef(true);\n const cleanupRef = React.useRef<() => void>(() => undefined);\n const announceToast = React.useCallback<Announce>(\n (message, options) => {\n if (activeRef.current) {\n announce(message, options);\n }\n },\n [announce],\n );\n\n const toasterRef = React.useCallback((el: HTMLDivElement | null) => {\n if (!el) {\n cleanupRef.current();\n return;\n }\n\n const onFocusIn = (e: FocusEvent) => {\n if (\n isHTMLElement(e.currentTarget) &&\n e.currentTarget.contains(isHTMLElement(e.relatedTarget) ? e.relatedTarget : null)\n ) {\n return;\n }\n\n activeRef.current = false;\n };\n\n const onFocusOut = (e: FocusEvent) => {\n if (\n isHTMLElement(e.currentTarget) &&\n e.currentTarget.contains(isHTMLElement(e.relatedTarget) ? e.relatedTarget : null)\n ) {\n return;\n }\n\n activeRef.current = true;\n };\n\n el.addEventListener('focusin', onFocusIn);\n el.addEventListener('focusout', onFocusOut);\n\n cleanupRef.current = () => {\n el.removeEventListener('focusin', onFocusIn);\n el.removeEventListener('focusout', onFocusOut);\n };\n }, []);\n\n return {\n announceToast,\n toasterRef,\n };\n}\n"],"names":["React","isHTMLElement","useToastAnnounce","announce","activeRef","useRef","cleanupRef","undefined","announceToast","useCallback","message","options","current","toasterRef","el","onFocusIn","e","currentTarget","contains","relatedTarget","onFocusOut","addEventListener","removeEventListener"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,aAAa,QAAQ,4BAA4B;AAE1D;;;;;;CAMC,GACD,OAAO,SAASC,iBAAiBC,QAAkB;IACjD,MAAMC,YAAYJ,MAAMK,MAAM,CAAC;IAC/B,MAAMC,aAAaN,MAAMK,MAAM,CAAa,IAAME;IAClD,MAAMC,gBAAgBR,MAAMS,WAAW,CACrC,CAACC,SAASC;QACR,IAAIP,UAAUQ,OAAO,EAAE;YACrBT,SAASO,SAASC;QACpB;IACF,GACA;QAACR;KAAS;IAGZ,MAAMU,aAAab,MAAMS,WAAW,CAAC,CAACK;QACpC,IAAI,CAACA,IAAI;YACPR,WAAWM,OAAO;YAClB;QACF;QAEA,MAAMG,YAAY,CAACC;YACjB,IACEf,cAAce,EAAEC,aAAa,KAC7BD,EAAEC,aAAa,CAACC,QAAQ,CAACjB,cAAce,EAAEG,aAAa,IAAIH,EAAEG,aAAa,GAAG,OAC5E;gBACA;YACF;YAEAf,UAAUQ,OAAO,GAAG;QACtB;QAEA,MAAMQ,aAAa,CAACJ;YAClB,IACEf,cAAce,EAAEC,aAAa,KAC7BD,EAAEC,aAAa,CAACC,QAAQ,CAACjB,cAAce,EAAEG,aAAa,IAAIH,EAAEG,aAAa,GAAG,OAC5E;gBACA;YACF;YAEAf,UAAUQ,OAAO,GAAG;QACtB;QAEAE,GAAGO,gBAAgB,CAAC,WAAWN;QAC/BD,GAAGO,gBAAgB,CAAC,YAAYD;QAEhCd,WAAWM,OAAO,GAAG;YACnBE,GAAGQ,mBAAmB,CAAC,WAAWP;YAClCD,GAAGQ,mBAAmB,CAAC,YAAYF;QACrC;IACF,GAAG,EAAE;IAEL,OAAO;QACLZ;QACAK;IACF;AACF"}
@@ -12,11 +12,11 @@ import { useToastAnnounce } from './useToastAnnounce';
12
12
  *
13
13
  * @param props - props from this instance of Toaster
14
14
  */ export const useToaster_unstable = (props)=>{
15
- const { offset , announce: announceProp , mountNode , ...rest } = props;
15
+ const { offset, announce: announceProp, mountNode, ...rest } = props;
16
16
  const announceRef = React.useRef(()=>null);
17
- const { toastsToRender , isToastVisible , pauseAllToasts , playAllToasts , tryRestoreFocus , closeAllToasts } = useToaster(rest);
17
+ const { toastsToRender, isToastVisible, pauseAllToasts, playAllToasts, tryRestoreFocus, closeAllToasts } = useToaster(rest);
18
18
  const announce = React.useCallback((message, options)=>announceRef.current(message, options), []);
19
- const { dir } = useFluent();
19
+ const { dir } = useFluent();
20
20
  const rootProps = slot.always(getNativeElementProps('div', rest), {
21
21
  elementType: 'div'
22
22
  });
@@ -27,17 +27,17 @@ import { useToastAnnounce } from './useToastAnnounce';
27
27
  }
28
28
  });
29
29
  const onKeyDown = useEventCallback((e)=>{
30
- var _props_onKeyDown;
30
+ var _props_onKeyDown, _props;
31
31
  if (e.key === Escape) {
32
32
  e.preventDefault();
33
33
  closeAllToasts();
34
34
  }
35
- (_props_onKeyDown = props.onKeyDown) === null || _props_onKeyDown === void 0 ? void 0 : _props_onKeyDown.call(props, e);
35
+ (_props_onKeyDown = (_props = props).onKeyDown) === null || _props_onKeyDown === void 0 ? void 0 : _props_onKeyDown.call(_props, e);
36
36
  });
37
37
  const usePositionSlot = (toastPosition)=>{
38
38
  var _toastsToRender_get;
39
39
  const focusManagementRef = useToasterFocusManagement_unstable(pauseAllToasts, playAllToasts);
40
- const { announceToast , toasterRef } = useToastAnnounce(announceProp !== null && announceProp !== void 0 ? announceProp : announce);
40
+ const { announceToast, toasterRef } = useToastAnnounce(announceProp !== null && announceProp !== void 0 ? announceProp : announce);
41
41
  return slot.optional(toastsToRender.has(toastPosition) ? rootProps : null, {
42
42
  defaultProps: {
43
43
  ref: useMergedRefs(focusManagementRef, toasterRef),
@@ -1 +1 @@
1
- {"version":3,"sources":["useToaster.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n ExtractSlotProps,\n Slot,\n getNativeElementProps,\n useEventCallback,\n useMergedRefs,\n slot,\n} from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useFocusableGroup } from '@fluentui/react-tabster';\nimport { Escape } from '@fluentui/keyboard-keys';\nimport type { ToasterProps, ToasterState } from './Toaster.types';\nimport { TOAST_POSITIONS, ToastPosition, useToaster } from '../../state';\nimport { Announce } from '../AriaLive';\nimport { ToastContainer } from '../ToastContainer';\nimport { useToasterFocusManagement_unstable } from './useToasterFocusManagement';\nimport { useToastAnnounce } from './useToastAnnounce';\n\n/**\n * Create the state required to render Toaster.\n *\n * @param props - props from this instance of Toaster\n */\nexport const useToaster_unstable = (props: ToasterProps): ToasterState => {\n const { offset, announce: announceProp, mountNode, ...rest } = props;\n const announceRef = React.useRef<Announce>(() => null);\n const { toastsToRender, isToastVisible, pauseAllToasts, playAllToasts, tryRestoreFocus, closeAllToasts } =\n useToaster<HTMLDivElement>(rest);\n const announce = React.useCallback<Announce>((message, options) => announceRef.current(message, options), []);\n const { dir } = useFluent();\n\n const rootProps = slot.always(getNativeElementProps('div', rest), { elementType: 'div' });\n const focusableGroupAttr = useFocusableGroup({\n tabBehavior: 'limited-trap-focus',\n ignoreDefaultKeydown: { Escape: true },\n });\n const onKeyDown = useEventCallback((e: React.KeyboardEvent<HTMLDivElement>) => {\n if (e.key === Escape) {\n e.preventDefault();\n closeAllToasts();\n }\n props.onKeyDown?.(e);\n });\n const usePositionSlot = (toastPosition: ToastPosition) => {\n const focusManagementRef = useToasterFocusManagement_unstable(pauseAllToasts, playAllToasts);\n const { announceToast, toasterRef } = useToastAnnounce(announceProp ?? announce);\n return slot.optional(toastsToRender.has(toastPosition) ? rootProps : null, {\n defaultProps: {\n ref: useMergedRefs(focusManagementRef, toasterRef),\n children: toastsToRender.get(toastPosition)?.map(toast => (\n <ToastContainer\n {...toast}\n tryRestoreFocus={tryRestoreFocus}\n intent={toast.intent}\n announce={announceToast}\n key={toast.toastId}\n visible={isToastVisible(toast.toastId)}\n >\n {toast.content as React.ReactNode}\n </ToastContainer>\n )),\n onKeyDown,\n ...focusableGroupAttr,\n 'data-toaster-position': toastPosition,\n role: 'list',\n // Explicitly casting because our slot types can't handle data attributes\n } as ExtractSlotProps<Slot<'div'>>,\n elementType: 'div',\n });\n };\n return {\n dir,\n mountNode,\n components: { root: 'div', bottomStart: 'div', bottomEnd: 'div', topStart: 'div', topEnd: 'div' },\n root: slot.always(rootProps, { elementType: 'div' }),\n bottomStart: usePositionSlot(TOAST_POSITIONS.bottomStart),\n bottomEnd: usePositionSlot(TOAST_POSITIONS.bottomEnd),\n topStart: usePositionSlot(TOAST_POSITIONS.topStart),\n topEnd: usePositionSlot(TOAST_POSITIONS.topEnd),\n announceRef,\n offset,\n announce: announceProp ?? announce,\n renderAriaLive: !announceProp,\n };\n};\n"],"names":["React","getNativeElementProps","useEventCallback","useMergedRefs","slot","useFluent_unstable","useFluent","useFocusableGroup","Escape","TOAST_POSITIONS","useToaster","ToastContainer","useToasterFocusManagement_unstable","useToastAnnounce","useToaster_unstable","props","offset","announce","announceProp","mountNode","rest","announceRef","useRef","toastsToRender","isToastVisible","pauseAllToasts","playAllToasts","tryRestoreFocus","closeAllToasts","useCallback","message","options","current","dir","rootProps","always","elementType","focusableGroupAttr","tabBehavior","ignoreDefaultKeydown","onKeyDown","e","key","preventDefault","usePositionSlot","toastPosition","focusManagementRef","announceToast","toasterRef","optional","has","defaultProps","ref","children","get","map","toast","intent","toastId","visible","content","role","components","root","bottomStart","bottomEnd","topStart","topEnd","renderAriaLive"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAGEC,qBAAqB,EACrBC,gBAAgB,EAChBC,aAAa,EACbC,IAAI,QACC,4BAA4B;AACnC,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAClF,SAASC,iBAAiB,QAAQ,0BAA0B;AAC5D,SAASC,MAAM,QAAQ,0BAA0B;AAEjD,SAASC,eAAe,EAAiBC,UAAU,QAAQ,cAAc;AAEzE,SAASC,cAAc,QAAQ,oBAAoB;AACnD,SAASC,kCAAkC,QAAQ,8BAA8B;AACjF,SAASC,gBAAgB,QAAQ,qBAAqB;AAEtD;;;;CAIC,GACD,OAAO,MAAMC,sBAAsB,CAACC,QAAsC;IACxE,MAAM,EAAEC,OAAM,EAAEC,UAAUC,aAAY,EAAEC,UAAS,EAAE,GAAGC,MAAM,GAAGL;IAC/D,MAAMM,cAAcrB,MAAMsB,MAAM,CAAW,IAAM,IAAI;IACrD,MAAM,EAAEC,eAAc,EAAEC,eAAc,EAAEC,eAAc,EAAEC,cAAa,EAAEC,gBAAe,EAAEC,eAAc,EAAE,GACtGlB,WAA2BU;IAC7B,MAAMH,WAAWjB,MAAM6B,WAAW,CAAW,CAACC,SAASC,UAAYV,YAAYW,OAAO,CAACF,SAASC,UAAU,EAAE;IAC5G,MAAM,EAAEE,IAAG,EAAE,GAAG3B;IAEhB,MAAM4B,YAAY9B,KAAK+B,MAAM,CAAClC,sBAAsB,OAAOmB,OAAO;QAAEgB,aAAa;IAAM;IACvF,MAAMC,qBAAqB9B,kBAAkB;QAC3C+B,aAAa;QACbC,sBAAsB;YAAE/B,QAAQ,IAAI;QAAC;IACvC;IACA,MAAMgC,YAAYtC,iBAAiB,CAACuC,IAA2C;YAK7E1B;QAJA,IAAI0B,EAAEC,GAAG,KAAKlC,QAAQ;YACpBiC,EAAEE,cAAc;YAChBf;QACF,CAAC;QACDb,CAAAA,mBAAAA,MAAMyB,SAAS,cAAfzB,8BAAAA,KAAAA,IAAAA,iBAAAA,KAAAA,OAAkB0B;IACpB;IACA,MAAMG,kBAAkB,CAACC,gBAAiC;YAM1CtB;QALd,MAAMuB,qBAAqBlC,mCAAmCa,gBAAgBC;QAC9E,MAAM,EAAEqB,cAAa,EAAEC,WAAU,EAAE,GAAGnC,iBAAiBK,yBAAAA,0BAAAA,eAAgBD,QAAQ;QAC/E,OAAOb,KAAK6C,QAAQ,CAAC1B,eAAe2B,GAAG,CAACL,iBAAiBX,YAAY,IAAI,EAAE;YACzEiB,cAAc;gBACZC,KAAKjD,cAAc2C,oBAAoBE;gBACvCK,QAAQ,EAAE9B,CAAAA,sBAAAA,eAAe+B,GAAG,CAACT,4BAAnBtB,iCAAAA,KAAAA,IAAAA,oBAAmCgC,IAAIC,CAAAA,sBAC/C,oBAAC7C;wBACE,GAAG6C,KAAK;wBACT7B,iBAAiBA;wBACjB8B,QAAQD,MAAMC,MAAM;wBACpBxC,UAAU8B;wBACVL,KAAKc,MAAME,OAAO;wBAClBC,SAASnC,eAAegC,MAAME,OAAO;uBAEpCF,MAAMI,OAAO;gBAGlBpB;gBACA,GAAGH,kBAAkB;gBACrB,yBAAyBQ;gBACzBgB,MAAM;YAER;YACAzB,aAAa;QACf;IACF;IACA,OAAO;QACLH;QACAd;QACA2C,YAAY;YAAEC,MAAM;YAAOC,aAAa;YAAOC,WAAW;YAAOC,UAAU;YAAOC,QAAQ;QAAM;QAChGJ,MAAM3D,KAAK+B,MAAM,CAACD,WAAW;YAAEE,aAAa;QAAM;QAClD4B,aAAapB,gBAAgBnC,gBAAgBuD,WAAW;QACxDC,WAAWrB,gBAAgBnC,gBAAgBwD,SAAS;QACpDC,UAAUtB,gBAAgBnC,gBAAgByD,QAAQ;QAClDC,QAAQvB,gBAAgBnC,gBAAgB0D,MAAM;QAC9C9C;QACAL;QACAC,UAAUC,yBAAAA,0BAAAA,eAAgBD,QAAQ;QAClCmD,gBAAgB,CAAClD;IACnB;AACF,EAAE"}
1
+ {"version":3,"sources":["useToaster.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n ExtractSlotProps,\n Slot,\n getNativeElementProps,\n useEventCallback,\n useMergedRefs,\n slot,\n} from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useFocusableGroup } from '@fluentui/react-tabster';\nimport { Escape } from '@fluentui/keyboard-keys';\nimport type { ToasterProps, ToasterState } from './Toaster.types';\nimport { TOAST_POSITIONS, ToastPosition, useToaster } from '../../state';\nimport { Announce } from '../AriaLive';\nimport { ToastContainer } from '../ToastContainer';\nimport { useToasterFocusManagement_unstable } from './useToasterFocusManagement';\nimport { useToastAnnounce } from './useToastAnnounce';\n\n/**\n * Create the state required to render Toaster.\n *\n * @param props - props from this instance of Toaster\n */\nexport const useToaster_unstable = (props: ToasterProps): ToasterState => {\n const { offset, announce: announceProp, mountNode, ...rest } = props;\n const announceRef = React.useRef<Announce>(() => null);\n const { toastsToRender, isToastVisible, pauseAllToasts, playAllToasts, tryRestoreFocus, closeAllToasts } =\n useToaster<HTMLDivElement>(rest);\n const announce = React.useCallback<Announce>((message, options) => announceRef.current(message, options), []);\n const { dir } = useFluent();\n\n const rootProps = slot.always(getNativeElementProps('div', rest), { elementType: 'div' });\n const focusableGroupAttr = useFocusableGroup({\n tabBehavior: 'limited-trap-focus',\n ignoreDefaultKeydown: { Escape: true },\n });\n const onKeyDown = useEventCallback((e: React.KeyboardEvent<HTMLDivElement>) => {\n if (e.key === Escape) {\n e.preventDefault();\n closeAllToasts();\n }\n props.onKeyDown?.(e);\n });\n const usePositionSlot = (toastPosition: ToastPosition) => {\n const focusManagementRef = useToasterFocusManagement_unstable(pauseAllToasts, playAllToasts);\n const { announceToast, toasterRef } = useToastAnnounce(announceProp ?? announce);\n return slot.optional(toastsToRender.has(toastPosition) ? rootProps : null, {\n defaultProps: {\n ref: useMergedRefs(focusManagementRef, toasterRef),\n children: toastsToRender.get(toastPosition)?.map(toast => (\n <ToastContainer\n {...toast}\n tryRestoreFocus={tryRestoreFocus}\n intent={toast.intent}\n announce={announceToast}\n key={toast.toastId}\n visible={isToastVisible(toast.toastId)}\n >\n {toast.content as React.ReactNode}\n </ToastContainer>\n )),\n onKeyDown,\n ...focusableGroupAttr,\n 'data-toaster-position': toastPosition,\n role: 'list',\n // Explicitly casting because our slot types can't handle data attributes\n } as ExtractSlotProps<Slot<'div'>>,\n elementType: 'div',\n });\n };\n return {\n dir,\n mountNode,\n components: { root: 'div', bottomStart: 'div', bottomEnd: 'div', topStart: 'div', topEnd: 'div' },\n root: slot.always(rootProps, { elementType: 'div' }),\n bottomStart: usePositionSlot(TOAST_POSITIONS.bottomStart),\n bottomEnd: usePositionSlot(TOAST_POSITIONS.bottomEnd),\n topStart: usePositionSlot(TOAST_POSITIONS.topStart),\n topEnd: usePositionSlot(TOAST_POSITIONS.topEnd),\n announceRef,\n offset,\n announce: announceProp ?? announce,\n renderAriaLive: !announceProp,\n };\n};\n"],"names":["React","getNativeElementProps","useEventCallback","useMergedRefs","slot","useFluent_unstable","useFluent","useFocusableGroup","Escape","TOAST_POSITIONS","useToaster","ToastContainer","useToasterFocusManagement_unstable","useToastAnnounce","useToaster_unstable","props","offset","announce","announceProp","mountNode","rest","announceRef","useRef","toastsToRender","isToastVisible","pauseAllToasts","playAllToasts","tryRestoreFocus","closeAllToasts","useCallback","message","options","current","dir","rootProps","always","elementType","focusableGroupAttr","tabBehavior","ignoreDefaultKeydown","onKeyDown","e","key","preventDefault","usePositionSlot","toastPosition","focusManagementRef","announceToast","toasterRef","optional","has","defaultProps","ref","children","get","map","toast","intent","toastId","visible","content","role","components","root","bottomStart","bottomEnd","topStart","topEnd","renderAriaLive"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAGEC,qBAAqB,EACrBC,gBAAgB,EAChBC,aAAa,EACbC,IAAI,QACC,4BAA4B;AACnC,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAClF,SAASC,iBAAiB,QAAQ,0BAA0B;AAC5D,SAASC,MAAM,QAAQ,0BAA0B;AAEjD,SAASC,eAAe,EAAiBC,UAAU,QAAQ,cAAc;AAEzE,SAASC,cAAc,QAAQ,oBAAoB;AACnD,SAASC,kCAAkC,QAAQ,8BAA8B;AACjF,SAASC,gBAAgB,QAAQ,qBAAqB;AAEtD;;;;CAIC,GACD,OAAO,MAAMC,sBAAsB,CAACC;IAClC,MAAM,EAAEC,MAAM,EAAEC,UAAUC,YAAY,EAAEC,SAAS,EAAE,GAAGC,MAAM,GAAGL;IAC/D,MAAMM,cAAcrB,MAAMsB,MAAM,CAAW,IAAM;IACjD,MAAM,EAAEC,cAAc,EAAEC,cAAc,EAAEC,cAAc,EAAEC,aAAa,EAAEC,eAAe,EAAEC,cAAc,EAAE,GACtGlB,WAA2BU;IAC7B,MAAMH,WAAWjB,MAAM6B,WAAW,CAAW,CAACC,SAASC,UAAYV,YAAYW,OAAO,CAACF,SAASC,UAAU,EAAE;IAC5G,MAAM,EAAEE,GAAG,EAAE,GAAG3B;IAEhB,MAAM4B,YAAY9B,KAAK+B,MAAM,CAAClC,sBAAsB,OAAOmB,OAAO;QAAEgB,aAAa;IAAM;IACvF,MAAMC,qBAAqB9B,kBAAkB;QAC3C+B,aAAa;QACbC,sBAAsB;YAAE/B,QAAQ;QAAK;IACvC;IACA,MAAMgC,YAAYtC,iBAAiB,CAACuC;YAKlC1B,kBAAAA;QAJA,IAAI0B,EAAEC,GAAG,KAAKlC,QAAQ;YACpBiC,EAAEE,cAAc;YAChBf;QACF;SACAb,mBAAAA,CAAAA,SAAAA,OAAMyB,SAAS,cAAfzB,uCAAAA,sBAAAA,QAAkB0B;IACpB;IACA,MAAMG,kBAAkB,CAACC;YAMTtB;QALd,MAAMuB,qBAAqBlC,mCAAmCa,gBAAgBC;QAC9E,MAAM,EAAEqB,aAAa,EAAEC,UAAU,EAAE,GAAGnC,iBAAiBK,yBAAAA,0BAAAA,eAAgBD;QACvE,OAAOb,KAAK6C,QAAQ,CAAC1B,eAAe2B,GAAG,CAACL,iBAAiBX,YAAY,MAAM;YACzEiB,cAAc;gBACZC,KAAKjD,cAAc2C,oBAAoBE;gBACvCK,QAAQ,GAAE9B,sBAAAA,eAAe+B,GAAG,CAACT,4BAAnBtB,0CAAAA,oBAAmCgC,GAAG,CAACC,CAAAA,sBAC/C,oBAAC7C;wBACE,GAAG6C,KAAK;wBACT7B,iBAAiBA;wBACjB8B,QAAQD,MAAMC,MAAM;wBACpBxC,UAAU8B;wBACVL,KAAKc,MAAME,OAAO;wBAClBC,SAASnC,eAAegC,MAAME,OAAO;uBAEpCF,MAAMI,OAAO;gBAGlBpB;gBACA,GAAGH,kBAAkB;gBACrB,yBAAyBQ;gBACzBgB,MAAM;YAER;YACAzB,aAAa;QACf;IACF;IACA,OAAO;QACLH;QACAd;QACA2C,YAAY;YAAEC,MAAM;YAAOC,aAAa;YAAOC,WAAW;YAAOC,UAAU;YAAOC,QAAQ;QAAM;QAChGJ,MAAM3D,KAAK+B,MAAM,CAACD,WAAW;YAAEE,aAAa;QAAM;QAClD4B,aAAapB,gBAAgBnC,gBAAgBuD,WAAW;QACxDC,WAAWrB,gBAAgBnC,gBAAgBwD,SAAS;QACpDC,UAAUtB,gBAAgBnC,gBAAgByD,QAAQ;QAClDC,QAAQvB,gBAAgBnC,gBAAgB0D,MAAM;QAC9C9C;QACAL;QACAC,UAAUC,yBAAAA,0BAAAA,eAAgBD;QAC1BmD,gBAAgB,CAAClD;IACnB;AACF,EAAE"}
@@ -7,7 +7,7 @@ const noop = ()=>undefined;
7
7
  /**
8
8
  * @internal
9
9
  */ export function useToasterFocusManagement_unstable(pauseAllToasts, playAllToasts) {
10
- const { targetDocument } = useFluent();
10
+ const { targetDocument } = useFluent();
11
11
  const cleanupListenersRef = React.useRef(noop);
12
12
  return React.useCallback((el)=>{
13
13
  if (!el || !targetDocument) {
@@ -29,7 +29,7 @@ const noop = ()=>undefined;
29
29
  * This is a temporary measure, Tabster does not have an API yet to enable mover arrow keys from within grouppers
30
30
  * Once tabster fully supports this use case, remove this hook
31
31
  */ const keydownListener = (e)=>{
32
- const { target , key } = e;
32
+ const { target, key } = e;
33
33
  if (!isHTMLElement(target)) {
34
34
  return;
35
35
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["useToasterFocusManagement.ts"],"sourcesContent":["import { isHTMLElement } from '@fluentui/react-utilities';\nimport * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { ArrowDown, ArrowUp } from '@fluentui/keyboard-keys';\nimport { toastContainerClassNames } from '../ToastContainer';\n\nconst noop = () => undefined;\n\n/**\n * @internal\n */\nexport function useToasterFocusManagement_unstable(pauseAllToasts: () => void, playAllToasts: () => void) {\n const { targetDocument } = useFluent();\n const cleanupListenersRef = React.useRef<() => void>(noop);\n\n return React.useCallback(\n (el: HTMLDivElement) => {\n if (!el || !targetDocument) {\n cleanupListenersRef.current();\n cleanupListenersRef.current = noop;\n return;\n }\n\n const toastContainerWalker = targetDocument.createTreeWalker(el, NodeFilter.SHOW_ELEMENT, {\n acceptNode(node: Node) {\n if (isHTMLElement(node) && node.classList.contains(toastContainerClassNames.root)) {\n return NodeFilter.FILTER_ACCEPT;\n }\n\n return NodeFilter.FILTER_SKIP;\n },\n });\n\n /**\n * FIXME: https://github.com/microsoft/tabster/issues/299\n * Toasts should be arrow navigable and focus should be trapped in a stack of tasts\n * This is a temporary measure, Tabster does not have an API yet to enable mover arrow keys from within grouppers\n * Once tabster fully supports this use case, remove this hook\n */\n const keydownListener = (e: KeyboardEvent) => {\n const { target, key } = e;\n if (!isHTMLElement(target)) {\n return;\n }\n\n if (key === ArrowDown) {\n toastContainerWalker.currentNode = target;\n let nextToastContainer = toastContainerWalker.nextNode();\n if (!nextToastContainer) {\n toastContainerWalker.currentNode = el;\n nextToastContainer = toastContainerWalker.nextNode();\n }\n\n if (isHTMLElement(nextToastContainer)) {\n nextToastContainer.focus();\n }\n }\n\n if (key === ArrowUp) {\n toastContainerWalker.currentNode = target;\n let prevToastContainer = toastContainerWalker.previousNode();\n if (prevToastContainer && prevToastContainer.contains(target)) {\n prevToastContainer = toastContainerWalker.previousNode();\n }\n\n if (!prevToastContainer) {\n toastContainerWalker.currentNode = el;\n prevToastContainer = toastContainerWalker.lastChild();\n }\n\n if (isHTMLElement(prevToastContainer)) {\n prevToastContainer.focus();\n }\n }\n };\n\n const focusInListener = (e: FocusEvent) => {\n if (\n isHTMLElement(e.currentTarget) &&\n !e.currentTarget.contains(isHTMLElement(e.relatedTarget) ? e.relatedTarget : null)\n ) {\n pauseAllToasts();\n }\n };\n\n const focusOutListener = (e: FocusEvent) => {\n if (\n isHTMLElement(e.currentTarget) &&\n !e.currentTarget.contains(isHTMLElement(e.relatedTarget) ? e.relatedTarget : null)\n ) {\n playAllToasts();\n }\n };\n\n el.addEventListener('keydown', keydownListener);\n el.addEventListener('focusin', focusInListener);\n el.addEventListener('focusout', focusOutListener);\n\n cleanupListenersRef.current = () => {\n el.removeEventListener('keydown', keydownListener);\n el.removeEventListener('focusin', focusInListener);\n el.removeEventListener('focusout', focusOutListener);\n };\n },\n [targetDocument, pauseAllToasts, playAllToasts],\n );\n}\n"],"names":["isHTMLElement","React","useFluent_unstable","useFluent","ArrowDown","ArrowUp","toastContainerClassNames","noop","undefined","useToasterFocusManagement_unstable","pauseAllToasts","playAllToasts","targetDocument","cleanupListenersRef","useRef","useCallback","el","current","toastContainerWalker","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","node","classList","contains","root","FILTER_ACCEPT","FILTER_SKIP","keydownListener","e","target","key","currentNode","nextToastContainer","nextNode","focus","prevToastContainer","previousNode","lastChild","focusInListener","currentTarget","relatedTarget","focusOutListener","addEventListener","removeEventListener"],"mappings":"AAAA,SAASA,aAAa,QAAQ,4BAA4B;AAC1D,YAAYC,WAAW,QAAQ;AAC/B,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAClF,SAASC,SAAS,EAAEC,OAAO,QAAQ,0BAA0B;AAC7D,SAASC,wBAAwB,QAAQ,oBAAoB;AAE7D,MAAMC,OAAO,IAAMC;AAEnB;;CAEC,GACD,OAAO,SAASC,mCAAmCC,cAA0B,EAAEC,aAAyB,EAAE;IACxG,MAAM,EAAEC,eAAc,EAAE,GAAGT;IAC3B,MAAMU,sBAAsBZ,MAAMa,MAAM,CAAaP;IAErD,OAAON,MAAMc,WAAW,CACtB,CAACC,KAAuB;QACtB,IAAI,CAACA,MAAM,CAACJ,gBAAgB;YAC1BC,oBAAoBI,OAAO;YAC3BJ,oBAAoBI,OAAO,GAAGV;YAC9B;QACF,CAAC;QAED,MAAMW,uBAAuBN,eAAeO,gBAAgB,CAACH,IAAII,WAAWC,YAAY,EAAE;YACxFC,YAAWC,IAAU,EAAE;gBACrB,IAAIvB,cAAcuB,SAASA,KAAKC,SAAS,CAACC,QAAQ,CAACnB,yBAAyBoB,IAAI,GAAG;oBACjF,OAAON,WAAWO,aAAa;gBACjC,CAAC;gBAED,OAAOP,WAAWQ,WAAW;YAC/B;QACF;QAEA;;;;;OAKC,GACD,MAAMC,kBAAkB,CAACC,IAAqB;YAC5C,MAAM,EAAEC,OAAM,EAAEC,IAAG,EAAE,GAAGF;YACxB,IAAI,CAAC9B,cAAc+B,SAAS;gBAC1B;YACF,CAAC;YAED,IAAIC,QAAQ5B,WAAW;gBACrBc,qBAAqBe,WAAW,GAAGF;gBACnC,IAAIG,qBAAqBhB,qBAAqBiB,QAAQ;gBACtD,IAAI,CAACD,oBAAoB;oBACvBhB,qBAAqBe,WAAW,GAAGjB;oBACnCkB,qBAAqBhB,qBAAqBiB,QAAQ;gBACpD,CAAC;gBAED,IAAInC,cAAckC,qBAAqB;oBACrCA,mBAAmBE,KAAK;gBAC1B,CAAC;YACH,CAAC;YAED,IAAIJ,QAAQ3B,SAAS;gBACnBa,qBAAqBe,WAAW,GAAGF;gBACnC,IAAIM,qBAAqBnB,qBAAqBoB,YAAY;gBAC1D,IAAID,sBAAsBA,mBAAmBZ,QAAQ,CAACM,SAAS;oBAC7DM,qBAAqBnB,qBAAqBoB,YAAY;gBACxD,CAAC;gBAED,IAAI,CAACD,oBAAoB;oBACvBnB,qBAAqBe,WAAW,GAAGjB;oBACnCqB,qBAAqBnB,qBAAqBqB,SAAS;gBACrD,CAAC;gBAED,IAAIvC,cAAcqC,qBAAqB;oBACrCA,mBAAmBD,KAAK;gBAC1B,CAAC;YACH,CAAC;QACH;QAEA,MAAMI,kBAAkB,CAACV,IAAkB;YACzC,IACE9B,cAAc8B,EAAEW,aAAa,KAC7B,CAACX,EAAEW,aAAa,CAAChB,QAAQ,CAACzB,cAAc8B,EAAEY,aAAa,IAAIZ,EAAEY,aAAa,GAAG,IAAI,GACjF;gBACAhC;YACF,CAAC;QACH;QAEA,MAAMiC,mBAAmB,CAACb,IAAkB;YAC1C,IACE9B,cAAc8B,EAAEW,aAAa,KAC7B,CAACX,EAAEW,aAAa,CAAChB,QAAQ,CAACzB,cAAc8B,EAAEY,aAAa,IAAIZ,EAAEY,aAAa,GAAG,IAAI,GACjF;gBACA/B;YACF,CAAC;QACH;QAEAK,GAAG4B,gBAAgB,CAAC,WAAWf;QAC/Bb,GAAG4B,gBAAgB,CAAC,WAAWJ;QAC/BxB,GAAG4B,gBAAgB,CAAC,YAAYD;QAEhC9B,oBAAoBI,OAAO,GAAG,IAAM;YAClCD,GAAG6B,mBAAmB,CAAC,WAAWhB;YAClCb,GAAG6B,mBAAmB,CAAC,WAAWL;YAClCxB,GAAG6B,mBAAmB,CAAC,YAAYF;QACrC;IACF,GACA;QAAC/B;QAAgBF;QAAgBC;KAAc;AAEnD,CAAC"}
1
+ {"version":3,"sources":["useToasterFocusManagement.ts"],"sourcesContent":["import { isHTMLElement } from '@fluentui/react-utilities';\nimport * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { ArrowDown, ArrowUp } from '@fluentui/keyboard-keys';\nimport { toastContainerClassNames } from '../ToastContainer';\n\nconst noop = () => undefined;\n\n/**\n * @internal\n */\nexport function useToasterFocusManagement_unstable(pauseAllToasts: () => void, playAllToasts: () => void) {\n const { targetDocument } = useFluent();\n const cleanupListenersRef = React.useRef<() => void>(noop);\n\n return React.useCallback(\n (el: HTMLDivElement) => {\n if (!el || !targetDocument) {\n cleanupListenersRef.current();\n cleanupListenersRef.current = noop;\n return;\n }\n\n const toastContainerWalker = targetDocument.createTreeWalker(el, NodeFilter.SHOW_ELEMENT, {\n acceptNode(node: Node) {\n if (isHTMLElement(node) && node.classList.contains(toastContainerClassNames.root)) {\n return NodeFilter.FILTER_ACCEPT;\n }\n\n return NodeFilter.FILTER_SKIP;\n },\n });\n\n /**\n * FIXME: https://github.com/microsoft/tabster/issues/299\n * Toasts should be arrow navigable and focus should be trapped in a stack of tasts\n * This is a temporary measure, Tabster does not have an API yet to enable mover arrow keys from within grouppers\n * Once tabster fully supports this use case, remove this hook\n */\n const keydownListener = (e: KeyboardEvent) => {\n const { target, key } = e;\n if (!isHTMLElement(target)) {\n return;\n }\n\n if (key === ArrowDown) {\n toastContainerWalker.currentNode = target;\n let nextToastContainer = toastContainerWalker.nextNode();\n if (!nextToastContainer) {\n toastContainerWalker.currentNode = el;\n nextToastContainer = toastContainerWalker.nextNode();\n }\n\n if (isHTMLElement(nextToastContainer)) {\n nextToastContainer.focus();\n }\n }\n\n if (key === ArrowUp) {\n toastContainerWalker.currentNode = target;\n let prevToastContainer = toastContainerWalker.previousNode();\n if (prevToastContainer && prevToastContainer.contains(target)) {\n prevToastContainer = toastContainerWalker.previousNode();\n }\n\n if (!prevToastContainer) {\n toastContainerWalker.currentNode = el;\n prevToastContainer = toastContainerWalker.lastChild();\n }\n\n if (isHTMLElement(prevToastContainer)) {\n prevToastContainer.focus();\n }\n }\n };\n\n const focusInListener = (e: FocusEvent) => {\n if (\n isHTMLElement(e.currentTarget) &&\n !e.currentTarget.contains(isHTMLElement(e.relatedTarget) ? e.relatedTarget : null)\n ) {\n pauseAllToasts();\n }\n };\n\n const focusOutListener = (e: FocusEvent) => {\n if (\n isHTMLElement(e.currentTarget) &&\n !e.currentTarget.contains(isHTMLElement(e.relatedTarget) ? e.relatedTarget : null)\n ) {\n playAllToasts();\n }\n };\n\n el.addEventListener('keydown', keydownListener);\n el.addEventListener('focusin', focusInListener);\n el.addEventListener('focusout', focusOutListener);\n\n cleanupListenersRef.current = () => {\n el.removeEventListener('keydown', keydownListener);\n el.removeEventListener('focusin', focusInListener);\n el.removeEventListener('focusout', focusOutListener);\n };\n },\n [targetDocument, pauseAllToasts, playAllToasts],\n );\n}\n"],"names":["isHTMLElement","React","useFluent_unstable","useFluent","ArrowDown","ArrowUp","toastContainerClassNames","noop","undefined","useToasterFocusManagement_unstable","pauseAllToasts","playAllToasts","targetDocument","cleanupListenersRef","useRef","useCallback","el","current","toastContainerWalker","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","node","classList","contains","root","FILTER_ACCEPT","FILTER_SKIP","keydownListener","e","target","key","currentNode","nextToastContainer","nextNode","focus","prevToastContainer","previousNode","lastChild","focusInListener","currentTarget","relatedTarget","focusOutListener","addEventListener","removeEventListener"],"mappings":"AAAA,SAASA,aAAa,QAAQ,4BAA4B;AAC1D,YAAYC,WAAW,QAAQ;AAC/B,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAClF,SAASC,SAAS,EAAEC,OAAO,QAAQ,0BAA0B;AAC7D,SAASC,wBAAwB,QAAQ,oBAAoB;AAE7D,MAAMC,OAAO,IAAMC;AAEnB;;CAEC,GACD,OAAO,SAASC,mCAAmCC,cAA0B,EAAEC,aAAyB;IACtG,MAAM,EAAEC,cAAc,EAAE,GAAGT;IAC3B,MAAMU,sBAAsBZ,MAAMa,MAAM,CAAaP;IAErD,OAAON,MAAMc,WAAW,CACtB,CAACC;QACC,IAAI,CAACA,MAAM,CAACJ,gBAAgB;YAC1BC,oBAAoBI,OAAO;YAC3BJ,oBAAoBI,OAAO,GAAGV;YAC9B;QACF;QAEA,MAAMW,uBAAuBN,eAAeO,gBAAgB,CAACH,IAAII,WAAWC,YAAY,EAAE;YACxFC,YAAWC,IAAU;gBACnB,IAAIvB,cAAcuB,SAASA,KAAKC,SAAS,CAACC,QAAQ,CAACnB,yBAAyBoB,IAAI,GAAG;oBACjF,OAAON,WAAWO,aAAa;gBACjC;gBAEA,OAAOP,WAAWQ,WAAW;YAC/B;QACF;QAEA;;;;;OAKC,GACD,MAAMC,kBAAkB,CAACC;YACvB,MAAM,EAAEC,MAAM,EAAEC,GAAG,EAAE,GAAGF;YACxB,IAAI,CAAC9B,cAAc+B,SAAS;gBAC1B;YACF;YAEA,IAAIC,QAAQ5B,WAAW;gBACrBc,qBAAqBe,WAAW,GAAGF;gBACnC,IAAIG,qBAAqBhB,qBAAqBiB,QAAQ;gBACtD,IAAI,CAACD,oBAAoB;oBACvBhB,qBAAqBe,WAAW,GAAGjB;oBACnCkB,qBAAqBhB,qBAAqBiB,QAAQ;gBACpD;gBAEA,IAAInC,cAAckC,qBAAqB;oBACrCA,mBAAmBE,KAAK;gBAC1B;YACF;YAEA,IAAIJ,QAAQ3B,SAAS;gBACnBa,qBAAqBe,WAAW,GAAGF;gBACnC,IAAIM,qBAAqBnB,qBAAqBoB,YAAY;gBAC1D,IAAID,sBAAsBA,mBAAmBZ,QAAQ,CAACM,SAAS;oBAC7DM,qBAAqBnB,qBAAqBoB,YAAY;gBACxD;gBAEA,IAAI,CAACD,oBAAoB;oBACvBnB,qBAAqBe,WAAW,GAAGjB;oBACnCqB,qBAAqBnB,qBAAqBqB,SAAS;gBACrD;gBAEA,IAAIvC,cAAcqC,qBAAqB;oBACrCA,mBAAmBD,KAAK;gBAC1B;YACF;QACF;QAEA,MAAMI,kBAAkB,CAACV;YACvB,IACE9B,cAAc8B,EAAEW,aAAa,KAC7B,CAACX,EAAEW,aAAa,CAAChB,QAAQ,CAACzB,cAAc8B,EAAEY,aAAa,IAAIZ,EAAEY,aAAa,GAAG,OAC7E;gBACAhC;YACF;QACF;QAEA,MAAMiC,mBAAmB,CAACb;YACxB,IACE9B,cAAc8B,EAAEW,aAAa,KAC7B,CAACX,EAAEW,aAAa,CAAChB,QAAQ,CAACzB,cAAc8B,EAAEY,aAAa,IAAIZ,EAAEY,aAAa,GAAG,OAC7E;gBACA/B;YACF;QACF;QAEAK,GAAG4B,gBAAgB,CAAC,WAAWf;QAC/Bb,GAAG4B,gBAAgB,CAAC,WAAWJ;QAC/BxB,GAAG4B,gBAAgB,CAAC,YAAYD;QAEhC9B,oBAAoBI,OAAO,GAAG;YAC5BD,GAAG6B,mBAAmB,CAAC,WAAWhB;YAClCb,GAAG6B,mBAAmB,CAAC,WAAWL;YAClCxB,GAAG6B,mBAAmB,CAAC,YAAYF;QACrC;IACF,GACA;QAAC/B;QAAgBF;QAAgBC;KAAc;AAEnD"}
@@ -1 +1 @@
1
- {"version":3,"sources":["toastContainerContext.tsx"],"sourcesContent":["import * as React from 'react';\nimport { ToastIntent } from '../state/types';\n\nexport type ToastContainerContextValue = {\n close: () => void;\n intent: ToastIntent | undefined;\n bodyId: string;\n titleId: string;\n};\n\nconst toastContainerContextDefaultValue: ToastContainerContextValue = {\n close: () => null,\n intent: undefined,\n bodyId: '',\n titleId: '',\n};\n\nconst ToastContainerContext = React.createContext<ToastContainerContextValue | undefined>(undefined);\n\nexport const ToastContainerContextProvider = ToastContainerContext.Provider;\nexport const useToastContainerContext = () =>\n React.useContext(ToastContainerContext) ?? toastContainerContextDefaultValue;\n"],"names":["React","toastContainerContextDefaultValue","close","intent","undefined","bodyId","titleId","ToastContainerContext","createContext","ToastContainerContextProvider","Provider","useToastContainerContext","useContext"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAU/B,MAAMC,oCAAgE;IACpEC,OAAO,IAAM,IAAI;IACjBC,QAAQC;IACRC,QAAQ;IACRC,SAAS;AACX;AAEA,MAAMC,sCAAwBP,MAAMQ,aAAa,CAAyCJ;AAE1F,OAAO,MAAMK,gCAAgCF,sBAAsBG,QAAQ,CAAC;IAE1EV;AADF,OAAO,MAAMW,2BAA2B,IACtCX,CAAAA,oBAAAA,MAAMY,UAAU,CAACL,oCAAjBP,+BAAAA,oBAA2CC,iCAAiC,CAAC"}
1
+ {"version":3,"sources":["toastContainerContext.tsx"],"sourcesContent":["import * as React from 'react';\nimport { ToastIntent } from '../state/types';\n\nexport type ToastContainerContextValue = {\n close: () => void;\n intent: ToastIntent | undefined;\n bodyId: string;\n titleId: string;\n};\n\nconst toastContainerContextDefaultValue: ToastContainerContextValue = {\n close: () => null,\n intent: undefined,\n bodyId: '',\n titleId: '',\n};\n\nconst ToastContainerContext = React.createContext<ToastContainerContextValue | undefined>(undefined);\n\nexport const ToastContainerContextProvider = ToastContainerContext.Provider;\nexport const useToastContainerContext = () =>\n React.useContext(ToastContainerContext) ?? toastContainerContextDefaultValue;\n"],"names":["React","toastContainerContextDefaultValue","close","intent","undefined","bodyId","titleId","ToastContainerContext","createContext","ToastContainerContextProvider","Provider","useToastContainerContext","useContext"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAU/B,MAAMC,oCAAgE;IACpEC,OAAO,IAAM;IACbC,QAAQC;IACRC,QAAQ;IACRC,SAAS;AACX;AAEA,MAAMC,sCAAwBP,MAAMQ,aAAa,CAAyCJ;AAE1F,OAAO,MAAMK,gCAAgCF,sBAAsBG,QAAQ,CAAC;IAE1EV;AADF,OAAO,MAAMW,2BAA2B,IACtCX,CAAAA,oBAAAA,MAAMY,UAAU,CAACL,oCAAjBP,+BAAAA,oBAA2CC,kCAAkC"}
@@ -6,7 +6,7 @@ const noop = ()=>undefined;
6
6
  * @param toasterId - If an id is provided all imperative methods control that specific toaster
7
7
  * @returns Imperative methods to control toasts
8
8
  */ export function useToastController(toasterId) {
9
- const { targetDocument } = useFluent();
9
+ const { targetDocument } = useFluent();
10
10
  return React.useMemo(()=>{
11
11
  if (!targetDocument) {
12
12
  return {
@@ -20,11 +20,12 @@ const noop = ()=>undefined;
20
20
  }
21
21
  return {
22
22
  dispatchToast: (content, options)=>{
23
+ var _options;
23
24
  dispatchToastVanilla(content, {
24
25
  ...options,
25
26
  toasterId,
26
27
  data: {
27
- root: options === null || options === void 0 ? void 0 : options.root
28
+ root: (_options = options) === null || _options === void 0 ? void 0 : _options.root
28
29
  }
29
30
  }, targetDocument);
30
31
  },
@@ -1 +1 @@
1
- {"version":3,"sources":["useToastController.ts"],"sourcesContent":["import * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport {\n dispatchToast as dispatchToastVanilla,\n dismissToast as dismissToastVanilla,\n dismissAllToasts as dismissAllToastsVanilla,\n updateToast as updateToastVanilla,\n playToast as playToastVanilla,\n pauseToast as pauseToastVanilla,\n} from './vanilla';\nimport { DispatchToastOptions, ToastId, ToasterId, UpdateToastOptions } from './types';\n\nconst noop = () => undefined;\n\n/**\n * @param toasterId - If an id is provided all imperative methods control that specific toaster\n * @returns Imperative methods to control toasts\n */\nexport function useToastController(toasterId?: ToasterId) {\n const { targetDocument } = useFluent();\n\n return React.useMemo(() => {\n if (!targetDocument) {\n return {\n dispatchToast: noop,\n dismissToast: noop,\n dismissAllToasts: noop,\n updateToast: noop,\n pauseToast: noop,\n playToast: noop,\n };\n }\n\n return {\n dispatchToast: (content: React.ReactNode, options?: DispatchToastOptions) => {\n dispatchToastVanilla(content, { ...options, toasterId, data: { root: options?.root } }, targetDocument);\n },\n dismissToast: (toastId: ToastId) => {\n dismissToastVanilla(toastId, toasterId, targetDocument);\n },\n dismissAllToasts: () => {\n dismissAllToastsVanilla(toasterId, targetDocument);\n },\n updateToast: (options: UpdateToastOptions) => {\n updateToastVanilla({ ...options, data: { root: options.root }, toasterId }, targetDocument);\n },\n pauseToast: (toastId: ToastId) => {\n pauseToastVanilla(toastId, toasterId, targetDocument);\n },\n playToast: (toastId: ToastId) => {\n playToastVanilla(toastId, toasterId, targetDocument);\n },\n };\n }, [targetDocument, toasterId]);\n}\n"],"names":["React","useFluent_unstable","useFluent","dispatchToast","dispatchToastVanilla","dismissToast","dismissToastVanilla","dismissAllToasts","dismissAllToastsVanilla","updateToast","updateToastVanilla","playToast","playToastVanilla","pauseToast","pauseToastVanilla","noop","undefined","useToastController","toasterId","targetDocument","useMemo","content","options","data","root","toastId"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAClF,SACEC,iBAAiBC,oBAAoB,EACrCC,gBAAgBC,mBAAmB,EACnCC,oBAAoBC,uBAAuB,EAC3CC,eAAeC,kBAAkB,EACjCC,aAAaC,gBAAgB,EAC7BC,cAAcC,iBAAiB,QAC1B,YAAY;AAGnB,MAAMC,OAAO,IAAMC;AAEnB;;;CAGC,GACD,OAAO,SAASC,mBAAmBC,SAAqB,EAAE;IACxD,MAAM,EAAEC,eAAc,EAAE,GAAGjB;IAE3B,OAAOF,MAAMoB,OAAO,CAAC,IAAM;QACzB,IAAI,CAACD,gBAAgB;YACnB,OAAO;gBACLhB,eAAeY;gBACfV,cAAcU;gBACdR,kBAAkBQ;gBAClBN,aAAaM;gBACbF,YAAYE;gBACZJ,WAAWI;YACb;QACF,CAAC;QAED,OAAO;YACLZ,eAAe,CAACkB,SAA0BC,UAAmC;gBAC3ElB,qBAAqBiB,SAAS;oBAAE,GAAGC,OAAO;oBAAEJ;oBAAWK,MAAM;wBAAEC,MAAMF,oBAAAA,qBAAAA,KAAAA,IAAAA,QAASE,IAAI;oBAAC;gBAAE,GAAGL;YAC1F;YACAd,cAAc,CAACoB,UAAqB;gBAClCnB,oBAAoBmB,SAASP,WAAWC;YAC1C;YACAZ,kBAAkB,IAAM;gBACtBC,wBAAwBU,WAAWC;YACrC;YACAV,aAAa,CAACa,UAAgC;gBAC5CZ,mBAAmB;oBAAE,GAAGY,OAAO;oBAAEC,MAAM;wBAAEC,MAAMF,QAAQE,IAAI;oBAAC;oBAAGN;gBAAU,GAAGC;YAC9E;YACAN,YAAY,CAACY,UAAqB;gBAChCX,kBAAkBW,SAASP,WAAWC;YACxC;YACAR,WAAW,CAACc,UAAqB;gBAC/Bb,iBAAiBa,SAASP,WAAWC;YACvC;QACF;IACF,GAAG;QAACA;QAAgBD;KAAU;AAChC,CAAC"}
1
+ {"version":3,"sources":["useToastController.ts"],"sourcesContent":["import * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport {\n dispatchToast as dispatchToastVanilla,\n dismissToast as dismissToastVanilla,\n dismissAllToasts as dismissAllToastsVanilla,\n updateToast as updateToastVanilla,\n playToast as playToastVanilla,\n pauseToast as pauseToastVanilla,\n} from './vanilla';\nimport { DispatchToastOptions, ToastId, ToasterId, UpdateToastOptions } from './types';\n\nconst noop = () => undefined;\n\n/**\n * @param toasterId - If an id is provided all imperative methods control that specific toaster\n * @returns Imperative methods to control toasts\n */\nexport function useToastController(toasterId?: ToasterId) {\n const { targetDocument } = useFluent();\n\n return React.useMemo(() => {\n if (!targetDocument) {\n return {\n dispatchToast: noop,\n dismissToast: noop,\n dismissAllToasts: noop,\n updateToast: noop,\n pauseToast: noop,\n playToast: noop,\n };\n }\n\n return {\n dispatchToast: (content: React.ReactNode, options?: DispatchToastOptions) => {\n dispatchToastVanilla(content, { ...options, toasterId, data: { root: options?.root } }, targetDocument);\n },\n dismissToast: (toastId: ToastId) => {\n dismissToastVanilla(toastId, toasterId, targetDocument);\n },\n dismissAllToasts: () => {\n dismissAllToastsVanilla(toasterId, targetDocument);\n },\n updateToast: (options: UpdateToastOptions) => {\n updateToastVanilla({ ...options, data: { root: options.root }, toasterId }, targetDocument);\n },\n pauseToast: (toastId: ToastId) => {\n pauseToastVanilla(toastId, toasterId, targetDocument);\n },\n playToast: (toastId: ToastId) => {\n playToastVanilla(toastId, toasterId, targetDocument);\n },\n };\n }, [targetDocument, toasterId]);\n}\n"],"names":["React","useFluent_unstable","useFluent","dispatchToast","dispatchToastVanilla","dismissToast","dismissToastVanilla","dismissAllToasts","dismissAllToastsVanilla","updateToast","updateToastVanilla","playToast","playToastVanilla","pauseToast","pauseToastVanilla","noop","undefined","useToastController","toasterId","targetDocument","useMemo","content","options","data","root","toastId"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAClF,SACEC,iBAAiBC,oBAAoB,EACrCC,gBAAgBC,mBAAmB,EACnCC,oBAAoBC,uBAAuB,EAC3CC,eAAeC,kBAAkB,EACjCC,aAAaC,gBAAgB,EAC7BC,cAAcC,iBAAiB,QAC1B,YAAY;AAGnB,MAAMC,OAAO,IAAMC;AAEnB;;;CAGC,GACD,OAAO,SAASC,mBAAmBC,SAAqB;IACtD,MAAM,EAAEC,cAAc,EAAE,GAAGjB;IAE3B,OAAOF,MAAMoB,OAAO,CAAC;QACnB,IAAI,CAACD,gBAAgB;YACnB,OAAO;gBACLhB,eAAeY;gBACfV,cAAcU;gBACdR,kBAAkBQ;gBAClBN,aAAaM;gBACbF,YAAYE;gBACZJ,WAAWI;YACb;QACF;QAEA,OAAO;YACLZ,eAAe,CAACkB,SAA0BC;oBAC6BA;gBAArElB,qBAAqBiB,SAAS;oBAAE,GAAGC,OAAO;oBAAEJ;oBAAWK,MAAM;wBAAEC,IAAI,GAAEF,WAAAA,qBAAAA,+BAAAA,SAASE,IAAI;oBAAC;gBAAE,GAAGL;YAC1F;YACAd,cAAc,CAACoB;gBACbnB,oBAAoBmB,SAASP,WAAWC;YAC1C;YACAZ,kBAAkB;gBAChBC,wBAAwBU,WAAWC;YACrC;YACAV,aAAa,CAACa;gBACZZ,mBAAmB;oBAAE,GAAGY,OAAO;oBAAEC,MAAM;wBAAEC,MAAMF,QAAQE,IAAI;oBAAC;oBAAGN;gBAAU,GAAGC;YAC9E;YACAN,YAAY,CAACY;gBACXX,kBAAkBW,SAASP,WAAWC;YACxC;YACAR,WAAW,CAACc;gBACVb,iBAAiBa,SAASP,WAAWC;YACvC;QACF;IACF,GAAG;QAACA;QAAgBD;KAAU;AAChC"}
@@ -5,39 +5,41 @@ import { createToaster } from './vanilla';
5
5
  import { EVENTS } from './constants';
6
6
  export function useToaster(options = {}) {
7
7
  const forceUpdate = useForceUpdate();
8
- const { toasterId: userToasterId , shortcuts } = options;
8
+ const { toasterId: userToasterId, shortcuts } = options;
9
9
  // Currently the toaster options can never be changed at runtime
10
10
  const [toaster] = React.useState(()=>createToaster(options));
11
- const { targetDocument } = useFluent();
11
+ const { targetDocument } = useFluent();
12
12
  const lastActiveElementRef = React.useRef(null);
13
13
  const isCorrectToaster = useEventCallback((toasterId)=>{
14
14
  return toasterId === userToasterId;
15
15
  });
16
16
  const isFocusShortcut = useEventCallback((e)=>{
17
- if (shortcuts === null || shortcuts === void 0 ? void 0 : shortcuts.focus) {
17
+ var _shortcuts;
18
+ if ((_shortcuts = shortcuts) === null || _shortcuts === void 0 ? void 0 : _shortcuts.focus) {
18
19
  return shortcuts.focus(e);
19
20
  }
20
21
  });
21
22
  const pauseAllToasts = React.useCallback(()=>{
22
23
  toaster.visibleToasts.forEach((toastId)=>{
23
- var _toast_imperativeRef_current;
24
+ var _toast_imperativeRef_current, _toast;
24
25
  const toast = toaster.toasts.get(toastId);
25
- (_toast_imperativeRef_current = toast === null || toast === void 0 ? void 0 : toast.imperativeRef.current) === null || _toast_imperativeRef_current === void 0 ? void 0 : _toast_imperativeRef_current.pause();
26
+ (_toast = toast) === null || _toast === void 0 ? void 0 : (_toast_imperativeRef_current = _toast.imperativeRef.current) === null || _toast_imperativeRef_current === void 0 ? void 0 : _toast_imperativeRef_current.pause();
26
27
  });
27
28
  }, [
28
29
  toaster
29
30
  ]);
30
31
  const playAllToasts = React.useCallback(()=>{
31
32
  toaster.visibleToasts.forEach((toastId)=>{
32
- var _toast_imperativeRef_current;
33
+ var _toast_imperativeRef_current, _toast;
33
34
  const toast = toaster.toasts.get(toastId);
34
- (_toast_imperativeRef_current = toast === null || toast === void 0 ? void 0 : toast.imperativeRef.current) === null || _toast_imperativeRef_current === void 0 ? void 0 : _toast_imperativeRef_current.play();
35
+ (_toast = toast) === null || _toast === void 0 ? void 0 : (_toast_imperativeRef_current = _toast.imperativeRef.current) === null || _toast_imperativeRef_current === void 0 ? void 0 : _toast_imperativeRef_current.play();
35
36
  });
36
37
  }, [
37
38
  toaster
38
39
  ]);
39
40
  const getMostRecentVisibleToast = React.useCallback(()=>{
40
41
  return Array.from(toaster.visibleToasts).reduce((cur, next)=>{
42
+ var _toast;
41
43
  const toast = toaster.toasts.get(next);
42
44
  if (!toast) {
43
45
  return cur;
@@ -45,7 +47,7 @@ export function useToaster(options = {}) {
45
47
  if (!cur) {
46
48
  return toast;
47
49
  }
48
- if (cur.order < (toast === null || toast === void 0 ? void 0 : toast.order)) {
50
+ if (cur.order < ((_toast = toast) === null || _toast === void 0 ? void 0 : _toast.order)) {
49
51
  return toast;
50
52
  }
51
53
  return cur;
@@ -54,8 +56,9 @@ export function useToaster(options = {}) {
54
56
  toaster
55
57
  ]);
56
58
  const tryRestoreFocus = React.useCallback(()=>{
59
+ var _mostRecentToast;
57
60
  const mostRecentToast = getMostRecentVisibleToast();
58
- if (mostRecentToast === null || mostRecentToast === void 0 ? void 0 : mostRecentToast.imperativeRef.current) {
61
+ if ((_mostRecentToast = mostRecentToast) === null || _mostRecentToast === void 0 ? void 0 : _mostRecentToast.imperativeRef.current) {
59
62
  mostRecentToast.imperativeRef.current.focus();
60
63
  } else {
61
64
  var _lastActiveElementRef_current;
@@ -67,8 +70,9 @@ export function useToaster(options = {}) {
67
70
  ]);
68
71
  const closeAllToasts = React.useCallback(()=>{
69
72
  toaster.visibleToasts.forEach((toastId)=>{
73
+ var _toast;
70
74
  const toast = toaster.toasts.get(toastId);
71
- toast === null || toast === void 0 ? void 0 : toast.close();
75
+ (_toast = toast) === null || _toast === void 0 ? void 0 : _toast.close();
72
76
  });
73
77
  tryRestoreFocus();
74
78
  }, [
@@ -159,7 +163,7 @@ export function useToaster(options = {}) {
159
163
  const toRender = new Map();
160
164
  const toasts = Array.from(toaster.toasts.values());
161
165
  toasts.forEach((toast)=>{
162
- const { position } = toast;
166
+ const { position } = toast;
163
167
  toRender.has(position) || toRender.set(position, []);
164
168
  if (position.startsWith('bottom')) {
165
169
  toRender.get(position).push(toast);