@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
@@ -4,49 +4,51 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "useToaster_unstable", {
6
6
  enumerable: true,
7
- get: ()=>useToaster_unstable
7
+ get: function() {
8
+ return useToaster_unstable;
9
+ }
8
10
  });
9
- const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
- const _reactUtilities = require("@fluentui/react-utilities");
12
- const _reactSharedContexts = require("@fluentui/react-shared-contexts");
13
- const _reactTabster = require("@fluentui/react-tabster");
14
- const _keyboardKeys = require("@fluentui/keyboard-keys");
11
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
+ const _reactutilities = require("@fluentui/react-utilities");
14
+ const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
15
+ const _reacttabster = require("@fluentui/react-tabster");
16
+ const _keyboardkeys = require("@fluentui/keyboard-keys");
15
17
  const _state = require("../../state");
16
- const _toastContainer = require("../ToastContainer");
18
+ const _ToastContainer = require("../ToastContainer");
17
19
  const _useToasterFocusManagement = require("./useToasterFocusManagement");
18
20
  const _useToastAnnounce = require("./useToastAnnounce");
19
21
  const useToaster_unstable = (props)=>{
20
- const { offset , announce: announceProp , mountNode , ...rest } = props;
22
+ const { offset, announce: announceProp, mountNode, ...rest } = props;
21
23
  const announceRef = _react.useRef(()=>null);
22
- const { toastsToRender , isToastVisible , pauseAllToasts , playAllToasts , tryRestoreFocus , closeAllToasts } = (0, _state.useToaster)(rest);
24
+ const { toastsToRender, isToastVisible, pauseAllToasts, playAllToasts, tryRestoreFocus, closeAllToasts } = (0, _state.useToaster)(rest);
23
25
  const announce = _react.useCallback((message, options)=>announceRef.current(message, options), []);
24
- const { dir } = (0, _reactSharedContexts.useFluent_unstable)();
25
- const rootProps = _reactUtilities.slot.always((0, _reactUtilities.getNativeElementProps)('div', rest), {
26
+ const { dir } = (0, _reactsharedcontexts.useFluent_unstable)();
27
+ const rootProps = _reactutilities.slot.always((0, _reactutilities.getNativeElementProps)('div', rest), {
26
28
  elementType: 'div'
27
29
  });
28
- const focusableGroupAttr = (0, _reactTabster.useFocusableGroup)({
30
+ const focusableGroupAttr = (0, _reacttabster.useFocusableGroup)({
29
31
  tabBehavior: 'limited-trap-focus',
30
32
  ignoreDefaultKeydown: {
31
33
  Escape: true
32
34
  }
33
35
  });
34
- const onKeyDown = (0, _reactUtilities.useEventCallback)((e)=>{
35
- var _props_onKeyDown;
36
- if (e.key === _keyboardKeys.Escape) {
36
+ const onKeyDown = (0, _reactutilities.useEventCallback)((e)=>{
37
+ var _props_onKeyDown, _props;
38
+ if (e.key === _keyboardkeys.Escape) {
37
39
  e.preventDefault();
38
40
  closeAllToasts();
39
41
  }
40
- (_props_onKeyDown = props.onKeyDown) === null || _props_onKeyDown === void 0 ? void 0 : _props_onKeyDown.call(props, e);
42
+ (_props_onKeyDown = (_props = props).onKeyDown) === null || _props_onKeyDown === void 0 ? void 0 : _props_onKeyDown.call(_props, e);
41
43
  });
42
44
  const usePositionSlot = (toastPosition)=>{
43
45
  var _toastsToRender_get;
44
46
  const focusManagementRef = (0, _useToasterFocusManagement.useToasterFocusManagement_unstable)(pauseAllToasts, playAllToasts);
45
- const { announceToast , toasterRef } = (0, _useToastAnnounce.useToastAnnounce)(announceProp !== null && announceProp !== void 0 ? announceProp : announce);
46
- return _reactUtilities.slot.optional(toastsToRender.has(toastPosition) ? rootProps : null, {
47
+ const { announceToast, toasterRef } = (0, _useToastAnnounce.useToastAnnounce)(announceProp !== null && announceProp !== void 0 ? announceProp : announce);
48
+ return _reactutilities.slot.optional(toastsToRender.has(toastPosition) ? rootProps : null, {
47
49
  defaultProps: {
48
- ref: (0, _reactUtilities.useMergedRefs)(focusManagementRef, toasterRef),
49
- children: (_toastsToRender_get = toastsToRender.get(toastPosition)) === null || _toastsToRender_get === void 0 ? void 0 : _toastsToRender_get.map((toast)=>/*#__PURE__*/ _react.createElement(_toastContainer.ToastContainer, {
50
+ ref: (0, _reactutilities.useMergedRefs)(focusManagementRef, toasterRef),
51
+ children: (_toastsToRender_get = toastsToRender.get(toastPosition)) === null || _toastsToRender_get === void 0 ? void 0 : _toastsToRender_get.map((toast)=>/*#__PURE__*/ _react.createElement(_ToastContainer.ToastContainer, {
50
52
  ...toast,
51
53
  tryRestoreFocus: tryRestoreFocus,
52
54
  intent: toast.intent,
@@ -72,7 +74,7 @@ const useToaster_unstable = (props)=>{
72
74
  topStart: 'div',
73
75
  topEnd: 'div'
74
76
  },
75
- root: _reactUtilities.slot.always(rootProps, {
77
+ root: _reactutilities.slot.always(rootProps, {
76
78
  elementType: 'div'
77
79
  }),
78
80
  bottomStart: usePositionSlot(_state.TOAST_POSITIONS.bottomStart),
@@ -1 +1 @@
1
- {"version":3,"sources":["useToaster.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useEventCallback, useMergedRefs, slot } 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 { TOAST_POSITIONS, useToaster } from '../../state';\nimport { ToastContainer } from '../ToastContainer';\nimport { useToasterFocusManagement_unstable } from './useToasterFocusManagement';\nimport { useToastAnnounce } from './useToastAnnounce';\n/**\n * Create the state required to render Toaster.\n *\n * @param props - props from this instance of Toaster\n */ export const useToaster_unstable = (props)=>{\n const { offset , announce: announceProp , mountNode , ...rest } = props;\n const announceRef = React.useRef(()=>null);\n const { toastsToRender , isToastVisible , pauseAllToasts , playAllToasts , tryRestoreFocus , closeAllToasts } = useToaster(rest);\n const announce = React.useCallback((message, options)=>announceRef.current(message, options), []);\n const { dir } = useFluent();\n const rootProps = slot.always(getNativeElementProps('div', rest), {\n elementType: 'div'\n });\n const focusableGroupAttr = useFocusableGroup({\n tabBehavior: 'limited-trap-focus',\n ignoreDefaultKeydown: {\n Escape: true\n }\n });\n const onKeyDown = useEventCallback((e)=>{\n var _props_onKeyDown;\n if (e.key === Escape) {\n e.preventDefault();\n closeAllToasts();\n }\n (_props_onKeyDown = props.onKeyDown) === null || _props_onKeyDown === void 0 ? void 0 : _props_onKeyDown.call(props, e);\n });\n const usePositionSlot = (toastPosition)=>{\n var _toastsToRender_get;\n const focusManagementRef = useToasterFocusManagement_unstable(pauseAllToasts, playAllToasts);\n const { announceToast , toasterRef } = useToastAnnounce(announceProp !== null && announceProp !== void 0 ? announceProp : announce);\n return slot.optional(toastsToRender.has(toastPosition) ? rootProps : null, {\n defaultProps: {\n ref: useMergedRefs(focusManagementRef, toasterRef),\n children: (_toastsToRender_get = toastsToRender.get(toastPosition)) === null || _toastsToRender_get === void 0 ? void 0 : _toastsToRender_get.map((toast)=>/*#__PURE__*/ React.createElement(ToastContainer, {\n ...toast,\n tryRestoreFocus: tryRestoreFocus,\n intent: toast.intent,\n announce: announceToast,\n key: toast.toastId,\n visible: isToastVisible(toast.toastId)\n }, toast.content)),\n onKeyDown,\n ...focusableGroupAttr,\n 'data-toaster-position': toastPosition,\n role: 'list'\n },\n elementType: 'div'\n });\n };\n return {\n dir,\n mountNode,\n components: {\n root: 'div',\n bottomStart: 'div',\n bottomEnd: 'div',\n topStart: 'div',\n topEnd: 'div'\n },\n root: slot.always(rootProps, {\n elementType: 'div'\n }),\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 !== null && announceProp !== void 0 ? announceProp : announce,\n renderAriaLive: !announceProp\n };\n};\n"],"names":["useToaster_unstable","props","offset","announce","announceProp","mountNode","rest","announceRef","React","useRef","toastsToRender","isToastVisible","pauseAllToasts","playAllToasts","tryRestoreFocus","closeAllToasts","useToaster","useCallback","message","options","current","dir","useFluent","rootProps","slot","always","getNativeElementProps","elementType","focusableGroupAttr","useFocusableGroup","tabBehavior","ignoreDefaultKeydown","Escape","onKeyDown","useEventCallback","e","_props_onKeyDown","key","preventDefault","call","usePositionSlot","toastPosition","_toastsToRender_get","focusManagementRef","useToasterFocusManagement_unstable","announceToast","toasterRef","useToastAnnounce","optional","has","defaultProps","ref","useMergedRefs","children","get","map","toast","createElement","ToastContainer","intent","toastId","visible","content","role","components","root","bottomStart","bottomEnd","topStart","topEnd","TOAST_POSITIONS","renderAriaLive"],"mappings":";;;;+BAaiBA;;aAAAA;;;6DAbM;gCACsD;qCAC7B;8BACd;8BACX;uBACqB;gCACb;2CACoB;kCAClB;AAKtB,MAAMA,sBAAsB,CAACC,QAAQ;IAC5C,MAAM,EAAEC,OAAM,EAAGC,UAAUC,aAAY,EAAGC,UAAS,EAAG,GAAGC,MAAM,GAAGL;IAClE,MAAMM,cAAcC,OAAMC,MAAM,CAAC,IAAI,IAAI;IACzC,MAAM,EAAEC,eAAc,EAAGC,eAAc,EAAGC,eAAc,EAAGC,cAAa,EAAGC,gBAAe,EAAGC,eAAc,EAAG,GAAGC,IAAAA,iBAAU,EAACV;IAC5H,MAAMH,WAAWK,OAAMS,WAAW,CAAC,CAACC,SAASC,UAAUZ,YAAYa,OAAO,CAACF,SAASC,UAAU,EAAE;IAChG,MAAM,EAAEE,IAAG,EAAG,GAAGC,IAAAA,uCAAS;IAC1B,MAAMC,YAAYC,oBAAI,CAACC,MAAM,CAACC,IAAAA,qCAAqB,EAAC,OAAOpB,OAAO;QAC9DqB,aAAa;IACjB;IACA,MAAMC,qBAAqBC,IAAAA,+BAAiB,EAAC;QACzCC,aAAa;QACbC,sBAAsB;YAClBC,QAAQ,IAAI;QAChB;IACJ;IACA,MAAMC,YAAYC,IAAAA,gCAAgB,EAAC,CAACC,IAAI;QACpC,IAAIC;QACJ,IAAID,EAAEE,GAAG,KAAKL,oBAAM,EAAE;YAClBG,EAAEG,cAAc;YAChBvB;QACJ,CAAC;QACAqB,CAAAA,mBAAmBnC,MAAMgC,SAAS,AAAD,MAAO,IAAI,IAAIG,qBAAqB,KAAK,IAAI,KAAK,IAAIA,iBAAiBG,IAAI,CAACtC,OAAOkC,EAAE;IAC3H;IACA,MAAMK,kBAAkB,CAACC,gBAAgB;QACrC,IAAIC;QACJ,MAAMC,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,IAAIA,eAAeD,QAAQ;QACpFoE,gBAAgB,CAACnE;IACrB;AACJ"}
1
+ {"version":3,"sources":["useToaster.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useEventCallback, useMergedRefs, slot } 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 { TOAST_POSITIONS, useToaster } from '../../state';\nimport { ToastContainer } from '../ToastContainer';\nimport { useToasterFocusManagement_unstable } from './useToasterFocusManagement';\nimport { useToastAnnounce } from './useToastAnnounce';\n/**\n * Create the state required to render Toaster.\n *\n * @param props - props from this instance of Toaster\n */ export const useToaster_unstable = (props)=>{\n const { offset, announce: announceProp, mountNode, ...rest } = props;\n const announceRef = React.useRef(()=>null);\n const { toastsToRender, isToastVisible, pauseAllToasts, playAllToasts, tryRestoreFocus, closeAllToasts } = useToaster(rest);\n const announce = React.useCallback((message, options)=>announceRef.current(message, options), []);\n const { dir } = useFluent();\n const rootProps = slot.always(getNativeElementProps('div', rest), {\n elementType: 'div'\n });\n const focusableGroupAttr = useFocusableGroup({\n tabBehavior: 'limited-trap-focus',\n ignoreDefaultKeydown: {\n Escape: true\n }\n });\n const onKeyDown = useEventCallback((e)=>{\n var _props_onKeyDown, _props;\n if (e.key === Escape) {\n e.preventDefault();\n closeAllToasts();\n }\n (_props_onKeyDown = (_props = props).onKeyDown) === null || _props_onKeyDown === void 0 ? void 0 : _props_onKeyDown.call(_props, e);\n });\n const usePositionSlot = (toastPosition)=>{\n var _toastsToRender_get;\n const focusManagementRef = useToasterFocusManagement_unstable(pauseAllToasts, playAllToasts);\n const { announceToast, toasterRef } = useToastAnnounce(announceProp !== null && announceProp !== void 0 ? announceProp : announce);\n return slot.optional(toastsToRender.has(toastPosition) ? rootProps : null, {\n defaultProps: {\n ref: useMergedRefs(focusManagementRef, toasterRef),\n children: (_toastsToRender_get = toastsToRender.get(toastPosition)) === null || _toastsToRender_get === void 0 ? void 0 : _toastsToRender_get.map((toast)=>/*#__PURE__*/ React.createElement(ToastContainer, {\n ...toast,\n tryRestoreFocus: tryRestoreFocus,\n intent: toast.intent,\n announce: announceToast,\n key: toast.toastId,\n visible: isToastVisible(toast.toastId)\n }, toast.content)),\n onKeyDown,\n ...focusableGroupAttr,\n 'data-toaster-position': toastPosition,\n role: 'list'\n },\n elementType: 'div'\n });\n };\n return {\n dir,\n mountNode,\n components: {\n root: 'div',\n bottomStart: 'div',\n bottomEnd: 'div',\n topStart: 'div',\n topEnd: 'div'\n },\n root: slot.always(rootProps, {\n elementType: 'div'\n }),\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 !== null && announceProp !== void 0 ? announceProp : announce,\n renderAriaLive: !announceProp\n };\n};\n"],"names":["useToaster_unstable","props","offset","announce","announceProp","mountNode","rest","announceRef","React","useRef","toastsToRender","isToastVisible","pauseAllToasts","playAllToasts","tryRestoreFocus","closeAllToasts","useToaster","useCallback","message","options","current","dir","useFluent","rootProps","slot","always","getNativeElementProps","elementType","focusableGroupAttr","useFocusableGroup","tabBehavior","ignoreDefaultKeydown","Escape","onKeyDown","useEventCallback","e","_props_onKeyDown","_props","key","preventDefault","call","usePositionSlot","toastPosition","_toastsToRender_get","focusManagementRef","useToasterFocusManagement_unstable","announceToast","toasterRef","useToastAnnounce","optional","has","defaultProps","ref","useMergedRefs","children","get","map","toast","createElement","ToastContainer","intent","toastId","visible","content","role","components","root","bottomStart","bottomEnd","topStart","topEnd","TOAST_POSITIONS","renderAriaLive"],"mappings":";;;;+BAaiBA;;;eAAAA;;;;iEAbM;gCACsD;qCAC7B;8BACd;8BACX;uBACqB;gCACb;2CACoB;kCAClB;AAKtB,MAA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;YACvE4B,cAAc;gBACVC,KAAKC,IAAAA,6BAAa,EAACT,oBAAoBG;gBACvCO,UAAU,AAACX,CAAAA,sBAAsBjC,eAAe6C,GAAG,CAACb,cAAa,MAAO,QAAQC,wBAAwB,KAAK,IAAI,KAAK,IAAIA,oBAAoBa,GAAG,CAAC,CAACC,QAAQ,WAAW,GAAGjD,OAAMkD,aAAa,CAACC,8BAAc,EAAE;wBACrM,GAAGF,KAAK;wBACR3C,iBAAiBA;wBACjB8C,QAAQH,MAAMG,MAAM;wBACpBzD,UAAU2C;wBACVR,KAAKmB,MAAMI,OAAO;wBAClBC,SAASnD,eAAe8C,MAAMI,OAAO;oBACzC,GAAGJ,MAAMM,OAAO;gBACpB9B;gBACA,GAAGL,kBAAkB;gBACrB,yBAAyBc;gBACzBsB,MAAM;YACV;YACArC,aAAa;QACjB;IACJ;IACA,OAAO;QACHN;QACAhB;QACA4D,YAAY;YACRC,MAAM;YACNC,aAAa;YACbC,WAAW;YACXC,UAAU;YACVC,QAAQ;QACZ;QACAJ,MAAM1C,oBAAI,CAACC,MAAM,CAACF,WAAW;YACzBI,aAAa;QACjB;QACAwC,aAAa1B,gBAAgB8B,sBAAe,CAACJ,WAAW;QACxDC,WAAW3B,gBAAgB8B,sBAAe,CAACH,SAAS;QACpDC,UAAU5B,gBAAgB8B,sBAAe,CAACF,QAAQ;QAClDC,QAAQ7B,gBAAgB8B,sBAAe,CAACD,MAAM;QAC9C/D;QACAL;QACAC,UAAUC,iBAAiB,QAAQA,iBAAiB,KAAK,IAAIA,eAAeD;QAC5EqE,gBAAgB,CAACpE;IACrB;AACJ"}
@@ -4,17 +4,19 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "useToasterFocusManagement_unstable", {
6
6
  enumerable: true,
7
- get: ()=>useToasterFocusManagement_unstable
7
+ get: function() {
8
+ return useToasterFocusManagement_unstable;
9
+ }
8
10
  });
9
- const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
- const _reactUtilities = require("@fluentui/react-utilities");
11
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
12
- const _reactSharedContexts = require("@fluentui/react-shared-contexts");
13
- const _keyboardKeys = require("@fluentui/keyboard-keys");
14
- const _toastContainer = require("../ToastContainer");
11
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
+ const _reactutilities = require("@fluentui/react-utilities");
13
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
14
+ const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
15
+ const _keyboardkeys = require("@fluentui/keyboard-keys");
16
+ const _ToastContainer = require("../ToastContainer");
15
17
  const noop = ()=>undefined;
16
18
  function useToasterFocusManagement_unstable(pauseAllToasts, playAllToasts) {
17
- const { targetDocument } = (0, _reactSharedContexts.useFluent_unstable)();
19
+ const { targetDocument } = (0, _reactsharedcontexts.useFluent_unstable)();
18
20
  const cleanupListenersRef = _react.useRef(noop);
19
21
  return _react.useCallback((el)=>{
20
22
  if (!el || !targetDocument) {
@@ -24,7 +26,7 @@ function useToasterFocusManagement_unstable(pauseAllToasts, playAllToasts) {
24
26
  }
25
27
  const toastContainerWalker = targetDocument.createTreeWalker(el, NodeFilter.SHOW_ELEMENT, {
26
28
  acceptNode (node) {
27
- if ((0, _reactUtilities.isHTMLElement)(node) && node.classList.contains(_toastContainer.toastContainerClassNames.root)) {
29
+ if ((0, _reactutilities.isHTMLElement)(node) && node.classList.contains(_ToastContainer.toastContainerClassNames.root)) {
28
30
  return NodeFilter.FILTER_ACCEPT;
29
31
  }
30
32
  return NodeFilter.FILTER_SKIP;
@@ -36,22 +38,22 @@ function useToasterFocusManagement_unstable(pauseAllToasts, playAllToasts) {
36
38
  * This is a temporary measure, Tabster does not have an API yet to enable mover arrow keys from within grouppers
37
39
  * Once tabster fully supports this use case, remove this hook
38
40
  */ const keydownListener = (e)=>{
39
- const { target , key } = e;
40
- if (!(0, _reactUtilities.isHTMLElement)(target)) {
41
+ const { target, key } = e;
42
+ if (!(0, _reactutilities.isHTMLElement)(target)) {
41
43
  return;
42
44
  }
43
- if (key === _keyboardKeys.ArrowDown) {
45
+ if (key === _keyboardkeys.ArrowDown) {
44
46
  toastContainerWalker.currentNode = target;
45
47
  let nextToastContainer = toastContainerWalker.nextNode();
46
48
  if (!nextToastContainer) {
47
49
  toastContainerWalker.currentNode = el;
48
50
  nextToastContainer = toastContainerWalker.nextNode();
49
51
  }
50
- if ((0, _reactUtilities.isHTMLElement)(nextToastContainer)) {
52
+ if ((0, _reactutilities.isHTMLElement)(nextToastContainer)) {
51
53
  nextToastContainer.focus();
52
54
  }
53
55
  }
54
- if (key === _keyboardKeys.ArrowUp) {
56
+ if (key === _keyboardkeys.ArrowUp) {
55
57
  toastContainerWalker.currentNode = target;
56
58
  let prevToastContainer = toastContainerWalker.previousNode();
57
59
  if (prevToastContainer && prevToastContainer.contains(target)) {
@@ -61,18 +63,18 @@ function useToasterFocusManagement_unstable(pauseAllToasts, playAllToasts) {
61
63
  toastContainerWalker.currentNode = el;
62
64
  prevToastContainer = toastContainerWalker.lastChild();
63
65
  }
64
- if ((0, _reactUtilities.isHTMLElement)(prevToastContainer)) {
66
+ if ((0, _reactutilities.isHTMLElement)(prevToastContainer)) {
65
67
  prevToastContainer.focus();
66
68
  }
67
69
  }
68
70
  };
69
71
  const focusInListener = (e)=>{
70
- if ((0, _reactUtilities.isHTMLElement)(e.currentTarget) && !e.currentTarget.contains((0, _reactUtilities.isHTMLElement)(e.relatedTarget) ? e.relatedTarget : null)) {
72
+ if ((0, _reactutilities.isHTMLElement)(e.currentTarget) && !e.currentTarget.contains((0, _reactutilities.isHTMLElement)(e.relatedTarget) ? e.relatedTarget : null)) {
71
73
  pauseAllToasts();
72
74
  }
73
75
  };
74
76
  const focusOutListener = (e)=>{
75
- if ((0, _reactUtilities.isHTMLElement)(e.currentTarget) && !e.currentTarget.contains((0, _reactUtilities.isHTMLElement)(e.relatedTarget) ? e.relatedTarget : null)) {
77
+ if ((0, _reactutilities.isHTMLElement)(e.currentTarget) && !e.currentTarget.contains((0, _reactutilities.isHTMLElement)(e.relatedTarget) ? e.relatedTarget : null)) {
76
78
  playAllToasts();
77
79
  }
78
80
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["useToasterFocusManagement.js"],"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';\nconst noop = ()=>undefined;\n/**\n * @internal\n */ export function useToasterFocusManagement_unstable(pauseAllToasts, playAllToasts) {\n const { targetDocument } = useFluent();\n const cleanupListenersRef = React.useRef(noop);\n return React.useCallback((el)=>{\n if (!el || !targetDocument) {\n cleanupListenersRef.current();\n cleanupListenersRef.current = noop;\n return;\n }\n const toastContainerWalker = targetDocument.createTreeWalker(el, NodeFilter.SHOW_ELEMENT, {\n acceptNode (node) {\n if (isHTMLElement(node) && node.classList.contains(toastContainerClassNames.root)) {\n return NodeFilter.FILTER_ACCEPT;\n }\n return NodeFilter.FILTER_SKIP;\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 */ const keydownListener = (e)=>{\n const { target , key } = e;\n if (!isHTMLElement(target)) {\n return;\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 if (isHTMLElement(nextToastContainer)) {\n nextToastContainer.focus();\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 if (!prevToastContainer) {\n toastContainerWalker.currentNode = el;\n prevToastContainer = toastContainerWalker.lastChild();\n }\n if (isHTMLElement(prevToastContainer)) {\n prevToastContainer.focus();\n }\n }\n };\n const focusInListener = (e)=>{\n if (isHTMLElement(e.currentTarget) && !e.currentTarget.contains(isHTMLElement(e.relatedTarget) ? e.relatedTarget : null)) {\n pauseAllToasts();\n }\n };\n const focusOutListener = (e)=>{\n if (isHTMLElement(e.currentTarget) && !e.currentTarget.contains(isHTMLElement(e.relatedTarget) ? e.relatedTarget : null)) {\n playAllToasts();\n }\n };\n el.addEventListener('keydown', keydownListener);\n el.addEventListener('focusin', focusInListener);\n el.addEventListener('focusout', focusOutListener);\n cleanupListenersRef.current = ()=>{\n el.removeEventListener('keydown', keydownListener);\n el.removeEventListener('focusin', focusInListener);\n el.removeEventListener('focusout', focusOutListener);\n };\n }, [\n targetDocument,\n pauseAllToasts,\n playAllToasts\n ]);\n}\n"],"names":["useToasterFocusManagement_unstable","noop","undefined","pauseAllToasts","playAllToasts","targetDocument","useFluent","cleanupListenersRef","React","useRef","useCallback","el","current","toastContainerWalker","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","node","isHTMLElement","classList","contains","toastContainerClassNames","root","FILTER_ACCEPT","FILTER_SKIP","keydownListener","e","target","key","ArrowDown","currentNode","nextToastContainer","nextNode","focus","ArrowUp","prevToastContainer","previousNode","lastChild","focusInListener","currentTarget","relatedTarget","focusOutListener","addEventListener","removeEventListener"],"mappings":";;;;+BAQoBA;;aAAAA;;;gCARU;6DACP;qCACyB;8BACb;gCACM;AACzC,MAAMC,OAAO,IAAIC;AAGN,SAASF,mCAAmCG,cAAc,EAAEC,aAAa,EAAE;IAClF,MAAM,EAAEC,eAAc,EAAG,GAAGC,IAAAA,uCAAS;IACrC,MAAMC,sBAAsBC,OAAMC,MAAM,CAACR;IACzC,OAAOO,OAAME,WAAW,CAAC,CAACC,KA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qBAAqB;oBACnCA,mBAAmBF,KAAK;gBAC5B,CAAC;YACL,CAAC;QACL;QACA,MAAMK,kBAAkB,CAACZ,IAAI;YACzB,IAAIR,IAAAA,6BAAa,EAACQ,EAAEa,aAAa,KAAK,CAACb,EAAEa,aAAa,CAACnB,QAAQ,CAACF,IAAAA,6BAAa,EAACQ,EAAEc,aAAa,IAAId,EAAEc,aAAa,GAAG,IAAI,GAAG;gBACtHtC;YACJ,CAAC;QACL;QACA,MAAMuC,mBAAmB,CAACf,IAAI;YAC1B,IAAIR,IAAAA,6BAAa,EAACQ,EAAEa,aAAa,KAAK,CAACb,EAAEa,aAAa,CAACnB,QAAQ,CAACF,IAAAA,6BAAa,EAACQ,EAAEc,aAAa,IAAId,EAAEc,aAAa,GAAG,IAAI,GAAG;gBACtHrC;YACJ,CAAC;QACL;QACAO,GAAGgC,gBAAgB,CAAC,WAAWjB;QAC/Bf,GAAGgC,gBAAgB,CAAC,WAAWJ;QAC/B5B,GAAGgC,gBAAgB,CAAC,YAAYD;QAChCnC,oBAAoBK,OAAO,GAAG,IAAI;YAC9BD,GAAGiC,mBAAmB,CAAC,WAAWlB;YAClCf,GAAGiC,mBAAmB,CAAC,WAAWL;YAClC5B,GAAGiC,mBAAmB,CAAC,YAAYF;QACvC;IACJ,GAAG;QACCrC;QACAF;QACAC;KACH;AACL"}
1
+ {"version":3,"sources":["useToasterFocusManagement.js"],"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';\nconst noop = ()=>undefined;\n/**\n * @internal\n */ export function useToasterFocusManagement_unstable(pauseAllToasts, playAllToasts) {\n const { targetDocument } = useFluent();\n const cleanupListenersRef = React.useRef(noop);\n return React.useCallback((el)=>{\n if (!el || !targetDocument) {\n cleanupListenersRef.current();\n cleanupListenersRef.current = noop;\n return;\n }\n const toastContainerWalker = targetDocument.createTreeWalker(el, NodeFilter.SHOW_ELEMENT, {\n acceptNode (node) {\n if (isHTMLElement(node) && node.classList.contains(toastContainerClassNames.root)) {\n return NodeFilter.FILTER_ACCEPT;\n }\n return NodeFilter.FILTER_SKIP;\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 */ const keydownListener = (e)=>{\n const { target, key } = e;\n if (!isHTMLElement(target)) {\n return;\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 if (isHTMLElement(nextToastContainer)) {\n nextToastContainer.focus();\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 if (!prevToastContainer) {\n toastContainerWalker.currentNode = el;\n prevToastContainer = toastContainerWalker.lastChild();\n }\n if (isHTMLElement(prevToastContainer)) {\n prevToastContainer.focus();\n }\n }\n };\n const focusInListener = (e)=>{\n if (isHTMLElement(e.currentTarget) && !e.currentTarget.contains(isHTMLElement(e.relatedTarget) ? e.relatedTarget : null)) {\n pauseAllToasts();\n }\n };\n const focusOutListener = (e)=>{\n if (isHTMLElement(e.currentTarget) && !e.currentTarget.contains(isHTMLElement(e.relatedTarget) ? e.relatedTarget : null)) {\n playAllToasts();\n }\n };\n el.addEventListener('keydown', keydownListener);\n el.addEventListener('focusin', focusInListener);\n el.addEventListener('focusout', focusOutListener);\n cleanupListenersRef.current = ()=>{\n el.removeEventListener('keydown', keydownListener);\n el.removeEventListener('focusin', focusInListener);\n el.removeEventListener('focusout', focusOutListener);\n };\n }, [\n targetDocument,\n pauseAllToasts,\n playAllToasts\n ]);\n}\n"],"names":["useToasterFocusManagement_unstable","noop","undefined","pauseAllToasts","playAllToasts","targetDocument","useFluent","cleanupListenersRef","React","useRef","useCallback","el","current","toastContainerWalker","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","node","isHTMLElement","classList","contains","toastContainerClassNames","root","FILTER_ACCEPT","FILTER_SKIP","keydownListener","e","target","key","ArrowDown","currentNode","nextToastContainer","nextNode","focus","ArrowUp","prevToastContainer","previousNode","lastChild","focusInListener","currentTarget","relatedTarget","focusOutListener","addEventListener","removeEventListener"],"mappings":";;;;+BAQoBA;;;eAAAA;;;;gCARU;iEACP;qCACyB;8BACb;gCACM;AACzC,MAAMC,OAAO,IAAIC;AAGN,SAASF,mCAAmCG,cAAc,EAAEC,aAAa;IAChF,MAAM,EAAEC,cAAc,EAAE,GAAGC,IAAAA,uCAAS;IACpC,MAAMC,sBAAsBC,OAAMC,MAAM,CAACR;IACzC,OAAOO,OAAME,WAAW,CAAC,CAACC;QACtB,IAAI,CAACA,MAAM,CAACN,gBAAgB;YACxBE,oBAAoBK,OAAO;YAC3BL,oBAAoBK,OAAO,GAAGX;YAC9B;QACJ;QACA,MAAMY,uBAAuBR,eAAeS,gBAAgB,CAACH,IAAII,WAAWC,YAAY,EAAE;YACtFC,YAAYC,IAAI;gBACZ,IAAIC,IAAAA,6BAAa,EAACD,SAASA,KAAKE,SAAS,CAACC,QAAQ,CAACC,wCAAwB,CAACC,IAAI,GAAG;oBAC/E,OAAOR,WAAWS,aAAa;gBACnC;gBACA,OAAOT,WAAWU,WAAW;YACjC;QACJ;QACA;;;;;OAKD,GAAG,MAAMC,kBAAkB,CAACC;YACvB,MAAM,EAAEC,MAAM,EAAEC,GAAG,EAAE,GAAGF;YACxB,IAAI,CAACR,IAAAA,6BAAa,EAACS,SAAS;gBACxB;YACJ;YACA,IAAIC,QAAQC,uBAAS,EAAE;gBACnBjB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GAAGiC,mBAAmB,CAAC,WAAWlB;YAClCf,GAAGiC,mBAAmB,CAAC,WAAWL;YAClC5B,GAAGiC,mBAAmB,CAAC,YAAYF;QACvC;IACJ,GAAG;QACCrC;QACAF;QACAC;KACH;AACL"}
@@ -9,8 +9,12 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- toasterClassNames: ()=>toasterClassNames,
13
- useToasterStyles_unstable: ()=>useToasterStyles_unstable
12
+ toasterClassNames: function() {
13
+ return toasterClassNames;
14
+ },
15
+ useToasterStyles_unstable: function() {
16
+ return useToasterStyles_unstable;
17
+ }
14
18
  });
15
19
  const _react = require("@griffel/react");
16
20
  const _index = require("../../state/index");
@@ -19,7 +23,7 @@ const toasterClassNames = {
19
23
  };
20
24
  /**
21
25
  * Styles for the root slot
22
- */ const useRootBaseClassName = /*#__PURE__*/ (0, _react["__resetStyles"])("r3hfdjz", null, [
26
+ */ const useRootBaseClassName = /*#__PURE__*/ (0, _react.__resetStyles)("r3hfdjz", null, [
23
27
  ".r3hfdjz{position:fixed;width:292px;pointer-events:none;}"
24
28
  ]);
25
29
  const useToasterStyles_unstable = (state)=>{
@@ -1 +1 @@
1
- {"version":3,"sources":["useToasterStyles.styles.js"],"sourcesContent":["import { __resetStyles, mergeClasses } from '@griffel/react';\nimport { TOAST_POSITIONS, getPositionStyles } from '../../state/index';\nexport const toasterClassNames = {\n root: 'fui-Toaster'\n};\n/**\n * Styles for the root slot\n */\nconst useRootBaseClassName = /*#__PURE__*/__resetStyles(\"r3hfdjz\", null, [\".r3hfdjz{position:fixed;width:292px;pointer-events:none;}\"]);\n/**\n * Apply styling to the Toaster slots based on the state\n */\nexport const useToasterStyles_unstable = state => {\n const rootBaseClassName = useRootBaseClassName();\n const className = mergeClasses(toasterClassNames.root, rootBaseClassName, state.root.className);\n if (state.bottomStart) {\n var _state_bottomStart;\n state.bottomStart.className = className;\n var _style;\n (_style = (_state_bottomStart = state.bottomStart).style) !== null && _style !== void 0 ? _style : _state_bottomStart.style = {};\n Object.assign(state.bottomStart.style, getPositionStyles(TOAST_POSITIONS.bottomStart, state.dir, state.offset));\n }\n if (state.bottomEnd) {\n var _state_bottomEnd;\n state.bottomEnd.className = className;\n var _style1;\n (_style1 = (_state_bottomEnd = state.bottomEnd).style) !== null && _style1 !== void 0 ? _style1 : _state_bottomEnd.style = {};\n Object.assign(state.bottomEnd.style, getPositionStyles(TOAST_POSITIONS.bottomEnd, state.dir, state.offset));\n }\n if (state.topStart) {\n var _state_topStart;\n state.topStart.className = className;\n var _style2;\n (_style2 = (_state_topStart = state.topStart).style) !== null && _style2 !== void 0 ? _style2 : _state_topStart.style = {};\n Object.assign(state.topStart.style, getPositionStyles(TOAST_POSITIONS.topStart, state.dir, state.offset));\n }\n if (state.topEnd) {\n var _state_topEnd;\n state.topEnd.className = className;\n var _style3;\n (_style3 = (_state_topEnd = state.topEnd).style) !== null && _style3 !== void 0 ? _style3 : _state_topEnd.style = {};\n Object.assign(state.topEnd.style, getPositionStyles(TOAST_POSITIONS.topEnd, state.dir, state.offset));\n }\n return state;\n};\n//# sourceMappingURL=useToasterStyles.styles.js.map"],"names":["toasterClassNames","useToasterStyles_unstable","root","useRootBaseClassName","__resetStyles","state","rootBaseClassName","className","mergeClasses","bottomStart","_state_bottomStart","_style","style","Object","assign","getPositionStyles","TOAST_POSITIONS","dir","offset","bottomEnd","_state_bottomEnd","_style1","topStart","_state_topStart","_style2","topEnd","_state_topEnd","_style3"],"mappings":";;;;;;;;;;;IAEaA,iBAAiB,MAAjBA;IAUAC,yBAAyB,MAAzBA;;uBAZ+B;uBACO;AAC5C,MAAMD,oBAAoB;IAC/BE,MAAM;AACR;AACA;;CAEC,GACD,MAAMC,uBAAuB,WAAW,GAAEC,IAAAA,uBAAa,EAAC,WAAW,IAAI,EAAE;IAAC;CAA4D;AAI/H,MAAMH,4BAA4BI,CAAAA,QAAS;IAChD,MAAMC,oBAAoBH;IAC1B,MAAMI,YAAYC,IAAAA,mBAAY,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AAiB,EAACC,sBAAe,CAACM,QAAQ,EAAEjB,MAAMY,GAAG,EAAEZ,MAAMa,MAAM;IACzG,CAAC;IACD,IAAIb,MAAMoB,MAAM,EAAE;QAChB,IAAIC;QACJrB,MAAMoB,MAAM,CAAClB,SAAS,GAAGA;QACzB,IAAIoB;QACHA,CAAAA,UAAU,AAACD,CAAAA,gBAAgBrB,MAAMoB,MAAM,AAAD,EAAGb,KAAK,AAAD,MAAO,IAAI,IAAIe,YAAY,KAAK,IAAIA,UAAUD,cAAcd,KAAK,GAAG,CAAC,CAAC;QACpHC,OAAOC,MAAM,CAACT,MAAMoB,MAAM,CAACb,KAAK,EAAEG,IAAAA,wBAAiB,EAACC,sBAAe,CAACS,MAAM,EAAEpB,MAAMY,GAAG,EAAEZ,MAAMa,MAAM;IACrG,CAAC;IACD,OAAOb;AACT,GACA,mDAAmD"}
1
+ {"version":3,"sources":["useToasterStyles.styles.js"],"sourcesContent":["import { __resetStyles, mergeClasses } from '@griffel/react';\nimport { TOAST_POSITIONS, getPositionStyles } from '../../state/index';\nexport const toasterClassNames = {\n root: 'fui-Toaster'\n};\n/**\n * Styles for the root slot\n */\nconst useRootBaseClassName = /*#__PURE__*/__resetStyles(\"r3hfdjz\", null, [\".r3hfdjz{position:fixed;width:292px;pointer-events:none;}\"]);\n/**\n * Apply styling to the Toaster slots based on the state\n */\nexport const useToasterStyles_unstable = state => {\n const rootBaseClassName = useRootBaseClassName();\n const className = mergeClasses(toasterClassNames.root, rootBaseClassName, state.root.className);\n if (state.bottomStart) {\n var _state_bottomStart;\n state.bottomStart.className = className;\n var _style;\n (_style = (_state_bottomStart = state.bottomStart).style) !== null && _style !== void 0 ? _style : _state_bottomStart.style = {};\n Object.assign(state.bottomStart.style, getPositionStyles(TOAST_POSITIONS.bottomStart, state.dir, state.offset));\n }\n if (state.bottomEnd) {\n var _state_bottomEnd;\n state.bottomEnd.className = className;\n var _style1;\n (_style1 = (_state_bottomEnd = state.bottomEnd).style) !== null && _style1 !== void 0 ? _style1 : _state_bottomEnd.style = {};\n Object.assign(state.bottomEnd.style, getPositionStyles(TOAST_POSITIONS.bottomEnd, state.dir, state.offset));\n }\n if (state.topStart) {\n var _state_topStart;\n state.topStart.className = className;\n var _style2;\n (_style2 = (_state_topStart = state.topStart).style) !== null && _style2 !== void 0 ? _style2 : _state_topStart.style = {};\n Object.assign(state.topStart.style, getPositionStyles(TOAST_POSITIONS.topStart, state.dir, state.offset));\n }\n if (state.topEnd) {\n var _state_topEnd;\n state.topEnd.className = className;\n var _style3;\n (_style3 = (_state_topEnd = state.topEnd).style) !== null && _style3 !== void 0 ? _style3 : _state_topEnd.style = {};\n Object.assign(state.topEnd.style, getPositionStyles(TOAST_POSITIONS.topEnd, state.dir, state.offset));\n }\n return state;\n};\n//# sourceMappingURL=useToasterStyles.styles.js.map"],"names":["toasterClassNames","useToasterStyles_unstable","root","useRootBaseClassName","__resetStyles","state","rootBaseClassName","className","mergeClasses","bottomStart","_state_bottomStart","_style","style","Object","assign","getPositionStyles","TOAST_POSITIONS","dir","offset","bottomEnd","_state_bottomEnd","_style1","topStart","_state_topStart","_style2","topEnd","_state_topEnd","_style3"],"mappings":";;;;;;;;;;;IAEaA,iBAAiB;eAAjBA;;IAUAC,yBAAyB;eAAzBA;;;uBAZ+B;uBACO;AAC5C,MAAMD,oBAAoB;IAC/BE,MAAM;AACR;AACA;;CAEC,GACD,MAAMC,uBAAuB,WAAW,GAAEC,IAAAA,oBAAa,EAAC,WAAW,MAAM;IAAC;CAA4D;AAI/H,MAAMH,4BAA4BI,CAAAA;IACvC,MAAMC,oBAAoBH;IAC1B,MAAMI,YAAYC,IAAAA,mBAAY,EAACR,kBAAkBE,IAAI,EAAEI,mBAAmBD,MAAMH,IAAI,CAACK,SAAS;IAC9F,IAAIF,MAAMI,WAAW,EAAE;QACrB,IAAIC;QACJL,MAAMI,WAAW,CAACF,SAAS,GAAGA;QAC9B,IAAII;QACHA,CAAAA,SAAS,AAACD,CAAAA,qBAAqBL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AGb,KAAK,AAAD,MAAO,QAAQe,YAAY,KAAK,IAAIA,UAAUD,cAAcd,KAAK,GAAG,CAAC;QACnHC,OAAOC,MAAM,CAACT,MAAMoB,MAAM,CAACb,KAAK,EAAEG,IAAAA,wBAAiB,EAACC,sBAAe,CAACS,MAAM,EAAEpB,MAAMY,GAAG,EAAEZ,MAAMa,MAAM;IACrG;IACA,OAAOb;AACT,GACA,mDAAmD"}
@@ -9,11 +9,15 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- ToastContainerContextProvider: ()=>ToastContainerContextProvider,
13
- useToastContainerContext: ()=>useToastContainerContext
12
+ ToastContainerContextProvider: function() {
13
+ return ToastContainerContextProvider;
14
+ },
15
+ useToastContainerContext: function() {
16
+ return useToastContainerContext;
17
+ }
14
18
  });
15
- const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
16
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
19
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
20
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
17
21
  const toastContainerContextDefaultValue = {
18
22
  close: ()=>null,
19
23
  intent: undefined,
@@ -1 +1 @@
1
- {"version":3,"sources":["toastContainerContext.js"],"sourcesContent":["import * as React from 'react';\nconst toastContainerContextDefaultValue = {\n close: ()=>null,\n intent: undefined,\n bodyId: '',\n titleId: ''\n};\nconst ToastContainerContext = /*#__PURE__*/ React.createContext(undefined);\nexport const ToastContainerContextProvider = ToastContainerContext.Provider;\nvar _React_useContext;\nexport const useToastContainerContext = ()=>(_React_useContext = React.useContext(ToastContainerContext)) !== null && _React_useContext !== void 0 ? _React_useContext : toastContainerContextDefaultValue;\n"],"names":["ToastContainerContextProvider","useToastContainerContext","toastContainerContextDefaultValue","close","intent","undefined","bodyId","titleId","ToastContainerContext","React","createContext","Provider","_React_useContext","useContext"],"mappings":";;;;;;;;;;;IAQaA,6BAA6B,MAA7BA;IAEAC,wBAAwB,MAAxBA;;;6DAVU;AACvB,MAAMC,oCAAoC;IACtCC,OAAO,IAAI,IAAI;IACfC,QAAQC;IACRC,QAAQ;IACRC,SAAS;AACb;AACA,MAAMC,wBAAwB,WAAW,GAAGC,OAAMC,aAAa,CAACL;AACzD,MAAML,gCAAgCQ,sBAAsBG,QAAQ;AAC3E,IAAIC;AACG,MAAMX,2BAA2B,IAAI,AAACW,CAAAA,oBAAoBH,OAAMI,UAAU,CAACL,sBAAqB,MAAO,IAAI,IAAII,sBAAsB,KAAK,IAAIA,oBAAoBV,iCAAiC"}
1
+ {"version":3,"sources":["toastContainerContext.js"],"sourcesContent":["import * as React from 'react';\nconst toastContainerContextDefaultValue = {\n close: ()=>null,\n intent: undefined,\n bodyId: '',\n titleId: ''\n};\nconst ToastContainerContext = /*#__PURE__*/ React.createContext(undefined);\nexport const ToastContainerContextProvider = ToastContainerContext.Provider;\nvar _React_useContext;\nexport const useToastContainerContext = ()=>(_React_useContext = React.useContext(ToastContainerContext)) !== null && _React_useContext !== void 0 ? _React_useContext : toastContainerContextDefaultValue;\n"],"names":["ToastContainerContextProvider","useToastContainerContext","toastContainerContextDefaultValue","close","intent","undefined","bodyId","titleId","ToastContainerContext","React","createContext","Provider","_React_useContext","useContext"],"mappings":";;;;;;;;;;;IAQaA,6BAA6B;eAA7BA;;IAEAC,wBAAwB;eAAxBA;;;;iEAVU;AACvB,MAAMC,oCAAoC;IACtCC,OAAO,IAAI;IACXC,QAAQC;IACRC,QAAQ;IACRC,SAAS;AACb;AACA,MAAMC,wBAAwB,WAAW,GAAGC,OAAMC,aAAa,CAACL;AACzD,MAAML,gCAAgCQ,sBAAsBG,QAAQ;AAC3E,IAAIC;AACG,MAAMX,2BAA2B,IAAI,AAACW,CAAAA,oBAAoBH,OAAMI,UAAU,CAACL,sBAAqB,MAAO,QAAQI,sBAAsB,KAAK,IAAIA,oBAAoBV"}
@@ -9,40 +9,98 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- useToastController: ()=>_state.useToastController,
13
- ToastTrigger: ()=>_toastTrigger.ToastTrigger,
14
- useToastTrigger_unstable: ()=>_toastTrigger.useToastTrigger_unstable,
15
- renderToastTrigger_unstable: ()=>_toastTrigger.renderToastTrigger_unstable,
16
- Toaster: ()=>_toaster.Toaster,
17
- useToaster_unstable: ()=>_toaster.useToaster_unstable,
18
- useToasterStyles_unstable: ()=>_toaster.useToasterStyles_unstable,
19
- renderToaster_unstable: ()=>_toaster.renderToaster_unstable,
20
- toasterClassNames: ()=>_toaster.toasterClassNames,
21
- Toast: ()=>_toast.Toast,
22
- useToastStyles_unstable: ()=>_toast.useToastStyles_unstable,
23
- useToast_unstable: ()=>_toast.useToast_unstable,
24
- renderToast_unstable: ()=>_toast.renderToast_unstable,
25
- toastClassNames: ()=>_toast.toastClassNames,
26
- ToastTitle: ()=>_toastTitle.ToastTitle,
27
- useToastTitleStyles_unstable: ()=>_toastTitle.useToastTitleStyles_unstable,
28
- useToastTitle_unstable: ()=>_toastTitle.useToastTitle_unstable,
29
- renderToastTitle_unstable: ()=>_toastTitle.renderToastTitle_unstable,
30
- toastTitleClassNames: ()=>_toastTitle.toastTitleClassNames,
31
- ToastBody: ()=>_toastBody.ToastBody,
32
- useToastBodyStyles_unstable: ()=>_toastBody.useToastBodyStyles_unstable,
33
- useToastBody_unstable: ()=>_toastBody.useToastBody_unstable,
34
- renderToastBody_unstable: ()=>_toastBody.renderToastBody_unstable,
35
- toastBodyClassNames: ()=>_toastBody.toastBodyClassNames,
36
- ToastFooter: ()=>_toastFooter.ToastFooter,
37
- useToastFooterStyles_unstable: ()=>_toastFooter.useToastFooterStyles_unstable,
38
- useToastFooter_unstable: ()=>_toastFooter.useToastFooter_unstable,
39
- renderToastFooter_unstable: ()=>_toastFooter.renderToastFooter_unstable,
40
- toastFooterClassNames: ()=>_toastFooter.toastFooterClassNames
12
+ useToastController: function() {
13
+ return _state.useToastController;
14
+ },
15
+ ToastTrigger: function() {
16
+ return _ToastTrigger.ToastTrigger;
17
+ },
18
+ useToastTrigger_unstable: function() {
19
+ return _ToastTrigger.useToastTrigger_unstable;
20
+ },
21
+ renderToastTrigger_unstable: function() {
22
+ return _ToastTrigger.renderToastTrigger_unstable;
23
+ },
24
+ Toaster: function() {
25
+ return _Toaster.Toaster;
26
+ },
27
+ useToaster_unstable: function() {
28
+ return _Toaster.useToaster_unstable;
29
+ },
30
+ useToasterStyles_unstable: function() {
31
+ return _Toaster.useToasterStyles_unstable;
32
+ },
33
+ renderToaster_unstable: function() {
34
+ return _Toaster.renderToaster_unstable;
35
+ },
36
+ toasterClassNames: function() {
37
+ return _Toaster.toasterClassNames;
38
+ },
39
+ Toast: function() {
40
+ return _Toast.Toast;
41
+ },
42
+ useToastStyles_unstable: function() {
43
+ return _Toast.useToastStyles_unstable;
44
+ },
45
+ useToast_unstable: function() {
46
+ return _Toast.useToast_unstable;
47
+ },
48
+ renderToast_unstable: function() {
49
+ return _Toast.renderToast_unstable;
50
+ },
51
+ toastClassNames: function() {
52
+ return _Toast.toastClassNames;
53
+ },
54
+ ToastTitle: function() {
55
+ return _ToastTitle.ToastTitle;
56
+ },
57
+ useToastTitleStyles_unstable: function() {
58
+ return _ToastTitle.useToastTitleStyles_unstable;
59
+ },
60
+ useToastTitle_unstable: function() {
61
+ return _ToastTitle.useToastTitle_unstable;
62
+ },
63
+ renderToastTitle_unstable: function() {
64
+ return _ToastTitle.renderToastTitle_unstable;
65
+ },
66
+ toastTitleClassNames: function() {
67
+ return _ToastTitle.toastTitleClassNames;
68
+ },
69
+ ToastBody: function() {
70
+ return _ToastBody.ToastBody;
71
+ },
72
+ useToastBodyStyles_unstable: function() {
73
+ return _ToastBody.useToastBodyStyles_unstable;
74
+ },
75
+ useToastBody_unstable: function() {
76
+ return _ToastBody.useToastBody_unstable;
77
+ },
78
+ renderToastBody_unstable: function() {
79
+ return _ToastBody.renderToastBody_unstable;
80
+ },
81
+ toastBodyClassNames: function() {
82
+ return _ToastBody.toastBodyClassNames;
83
+ },
84
+ ToastFooter: function() {
85
+ return _ToastFooter.ToastFooter;
86
+ },
87
+ useToastFooterStyles_unstable: function() {
88
+ return _ToastFooter.useToastFooterStyles_unstable;
89
+ },
90
+ useToastFooter_unstable: function() {
91
+ return _ToastFooter.useToastFooter_unstable;
92
+ },
93
+ renderToastFooter_unstable: function() {
94
+ return _ToastFooter.renderToastFooter_unstable;
95
+ },
96
+ toastFooterClassNames: function() {
97
+ return _ToastFooter.toastFooterClassNames;
98
+ }
41
99
  });
42
100
  const _state = require("./state");
43
- const _toastTrigger = require("./ToastTrigger");
44
- const _toaster = require("./Toaster");
45
- const _toast = require("./Toast");
46
- const _toastTitle = require("./ToastTitle");
47
- const _toastBody = require("./ToastBody");
48
- const _toastFooter = require("./ToastFooter");
101
+ const _ToastTrigger = require("./ToastTrigger");
102
+ const _Toaster = require("./Toaster");
103
+ const _Toast = require("./Toast");
104
+ const _ToastTitle = require("./ToastTitle");
105
+ const _ToastBody = require("./ToastBody");
106
+ const _ToastFooter = require("./ToastFooter");
@@ -1 +1 @@
1
- {"version":3,"sources":["index.js"],"sourcesContent":["export { useToastController } from './state';\nexport { ToastTrigger, useToastTrigger_unstable, renderToastTrigger_unstable } from './ToastTrigger';\nexport { Toaster, useToaster_unstable, useToasterStyles_unstable, renderToaster_unstable, toasterClassNames } from './Toaster';\nexport { Toast, useToastStyles_unstable, useToast_unstable, renderToast_unstable, toastClassNames } from './Toast';\nexport { ToastTitle, useToastTitleStyles_unstable, useToastTitle_unstable, renderToastTitle_unstable, toastTitleClassNames } from './ToastTitle';\nexport { ToastBody, useToastBodyStyles_unstable, useToastBody_unstable, renderToastBody_unstable, toastBodyClassNames } from './ToastBody';\nexport { ToastFooter, useToastFooterStyles_unstable, useToastFooter_unstable, renderToastFooter_unstable, toastFooterClassNames } from './ToastFooter';\n"],"names":["useToastController","ToastTrigger","useToastTrigger_unstable","renderToastTrigger_unstable","Toaster","useToaster_unstable","useToasterStyles_unstable","renderToaster_unstable","toasterClassNames","Toast","useToastStyles_unstable","useToast_unstable","renderToast_unstable","toastClassNames","ToastTitle","useToastTitleStyles_unstable","useToastTitle_unstable","renderToastTitle_unstable","toastTitleClassNames","ToastBody","useToastBodyStyles_unstable","useToastBody_unstable","renderToastBody_unstable","toastBodyClassNames","ToastFooter","useToastFooterStyles_unstable","useToastFooter_unstable","renderToastFooter_unstable","toastFooterClassNames"],"mappings":";;;;;;;;;;;IAASA,kBAAkB,MAAlBA,yBAAkB;IAClBC,YAAY,MAAZA,0BAAY;IAAEC,wBAAwB,MAAxBA,sCAAwB;IAAEC,2BAA2B,MAA3BA,yCAA2B;IACnEC,OAAO,MAAPA,gBAAO;IAAEC,mBAAmB,MAAnBA,4BAAmB;IAAEC,yBAAyB,MAAzBA,kCAAyB;IAAEC,sBAAsB,MAAtBA,+BAAsB;IAAEC,iBAAiB,MAAjBA,0BAAiB;IAClGC,KAAK,MAALA,YAAK;IAAEC,uBAAuB,MAAvBA,8BAAuB;IAAEC,iBAAiB,MAAjBA,wBAAiB;IAAEC,oBAAoB,MAApBA,2BAAoB;IAAEC,eAAe,MAAfA,sBAAe;IACxFC,UAAU,MAAVA,sBAAU;IAAEC,4BAA4B,MAA5BA,wCAA4B;IAAEC,sBAAsB,MAAtBA,kCAAsB;IAAEC,yBAAyB,MAAzBA,qCAAyB;IAAEC,oBAAoB,MAApBA,gCAAoB;IACjHC,SAAS,MAATA,oBAAS;IAAEC,2BAA2B,MAA3BA,sCAA2B;IAAEC,qBAAqB,MAArBA,gCAAqB;IAAEC,wBAAwB,MAAxBA,mCAAwB;IAAEC,mBAAmB,MAAnBA,8BAAmB;IAC5GC,WAAW,MAAXA,wBAAW;IAAEC,6BAA6B,MAA7BA,0CAA6B;IAAEC,uBAAuB,MAAvBA,oCAAuB;IAAEC,0BAA0B,MAA1BA,uCAA0B;IAAEC,qBAAqB,MAArBA,kCAAqB;;uBAN5F;8BACiD;yBAC+B;uBACV;4BACyB;2BACL;6BACU"}
1
+ {"version":3,"sources":["index.js"],"sourcesContent":["export { useToastController } from './state';\nexport { ToastTrigger, useToastTrigger_unstable, renderToastTrigger_unstable } from './ToastTrigger';\nexport { Toaster, useToaster_unstable, useToasterStyles_unstable, renderToaster_unstable, toasterClassNames } from './Toaster';\nexport { Toast, useToastStyles_unstable, useToast_unstable, renderToast_unstable, toastClassNames } from './Toast';\nexport { ToastTitle, useToastTitleStyles_unstable, useToastTitle_unstable, renderToastTitle_unstable, toastTitleClassNames } from './ToastTitle';\nexport { ToastBody, useToastBodyStyles_unstable, useToastBody_unstable, renderToastBody_unstable, toastBodyClassNames } from './ToastBody';\nexport { ToastFooter, useToastFooterStyles_unstable, useToastFooter_unstable, renderToastFooter_unstable, toastFooterClassNames } from './ToastFooter';\n"],"names":["useToastController","ToastTrigger","useToastTrigger_unstable","renderToastTrigger_unstable","Toaster","useToaster_unstable","useToasterStyles_unstable","renderToaster_unstable","toasterClassNames","Toast","useToastStyles_unstable","useToast_unstable","renderToast_unstable","toastClassNames","ToastTitle","useToastTitleStyles_unstable","useToastTitle_unstable","renderToastTitle_unstable","toastTitleClassNames","ToastBody","useToastBodyStyles_unstable","useToastBody_unstable","renderToastBody_unstable","toastBodyClassNames","ToastFooter","useToastFooterStyles_unstable","useToastFooter_unstable","renderToastFooter_unstable","toastFooterClassNames"],"mappings":";;;;;;;;;;;IAASA,kBAAkB;eAAlBA,yBAAkB;;IAClBC,YAAY;eAAZA,0BAAY;;IAAEC,wBAAwB;eAAxBA,sCAAwB;;IAAEC,2BAA2B;eAA3BA,yCAA2B;;IACnEC,OAAO;eAAPA,gBAAO;;IAAEC,mBAAmB;eAAnBA,4BAAmB;;IAAEC,yBAAyB;eAAzBA,kCAAyB;;IAAEC,sBAAsB;eAAtBA,+BAAsB;;IAAEC,iBAAiB;eAAjBA,0BAAiB;;IAClGC,KAAK;eAALA,YAAK;;IAAEC,uBAAuB;eAAvBA,8BAAuB;;IAAEC,iBAAiB;eAAjBA,wBAAiB;;IAAEC,oBAAoB;eAApBA,2BAAoB;;IAAEC,eAAe;eAAfA,sBAAe;;IACxFC,UAAU;eAAVA,sBAAU;;IAAEC,4BAA4B;eAA5BA,wCAA4B;;IAAEC,sBAAsB;eAAtBA,kCAAsB;;IAAEC,yBAAyB;eAAzBA,qCAAyB;;IAAEC,oBAAoB;eAApBA,gCAAoB;;IACjHC,SAAS;eAATA,oBAAS;;IAAEC,2BAA2B;eAA3BA,sCAA2B;;IAAEC,qBAAqB;eAArBA,gCAAqB;;IAAEC,wBAAwB;eAAxBA,mCAAwB;;IAAEC,mBAAmB;eAAnBA,8BAAmB;;IAC5GC,WAAW;eAAXA,wBAAW;;IAAEC,6BAA6B;eAA7BA,0CAA6B;;IAAEC,uBAAuB;eAAvBA,oCAAuB;;IAAEC,0BAA0B;eAA1BA,uCAA0B;;IAAEC,qBAAqB;eAArBA,kCAAqB;;;uBAN5F;8BACiD;yBAC+B;uBACV;4BACyB;2BACL;6BACU"}
@@ -9,8 +9,12 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- EVENTS: ()=>EVENTS,
13
- TOAST_POSITIONS: ()=>TOAST_POSITIONS
12
+ EVENTS: function() {
13
+ return EVENTS;
14
+ },
15
+ TOAST_POSITIONS: function() {
16
+ return TOAST_POSITIONS;
17
+ }
14
18
  });
15
19
  const EVENTS = {
16
20
  show: 'fui-toast-show',
@@ -1 +1 @@
1
- {"version":3,"sources":["constants.js"],"sourcesContent":["export const EVENTS = {\n show: 'fui-toast-show',\n dismiss: 'fui-toast-dismiss',\n dismissAll: 'fui-toast-dismiss-all',\n update: 'fui-toast-update',\n pause: 'fui-toast-pause',\n play: 'fui-toast-play'\n};\nexport const TOAST_POSITIONS = {\n bottomEnd: 'bottom-end',\n bottomStart: 'bottom-start',\n topEnd: 'top-end',\n topStart: 'top-start'\n};\n"],"names":["EVENTS","TOAST_POSITIONS","show","dismiss","dismissAll","update","pause","play","bottomEnd","bottomStart","topEnd","topStart"],"mappings":";;;;;;;;;;;IAAaA,MAAM,MAANA;IAQAC,eAAe,MAAfA;;AARN,MAAMD,SAAS;IAClBE,MAAM;IACNC,SAAS;IACTC,YAAY;IACZC,QAAQ;IACRC,OAAO;IACPC,MAAM;AACV;AACO,MAAMN,kBAAkB;IAC3BO,WAAW;IACXC,aAAa;IACbC,QAAQ;IACRC,UAAU;AACd"}
1
+ {"version":3,"sources":["constants.js"],"sourcesContent":["export const EVENTS = {\n show: 'fui-toast-show',\n dismiss: 'fui-toast-dismiss',\n dismissAll: 'fui-toast-dismiss-all',\n update: 'fui-toast-update',\n pause: 'fui-toast-pause',\n play: 'fui-toast-play'\n};\nexport const TOAST_POSITIONS = {\n bottomEnd: 'bottom-end',\n bottomStart: 'bottom-start',\n topEnd: 'top-end',\n topStart: 'top-start'\n};\n"],"names":["EVENTS","TOAST_POSITIONS","show","dismiss","dismissAll","update","pause","play","bottomEnd","bottomStart","topEnd","topStart"],"mappings":";;;;;;;;;;;IAAaA,MAAM;eAANA;;IAQAC,eAAe;eAAfA;;;AARN,MAAMD,SAAS;IAClBE,MAAM;IACNC,SAAS;IACTC,YAAY;IACZC,QAAQ;IACRC,OAAO;IACPC,MAAM;AACV;AACO,MAAMN,kBAAkB;IAC3BO,WAAW;IACXC,aAAa;IACbC,QAAQ;IACRC,UAAU;AACd"}
@@ -9,12 +9,16 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- getPositionStyles: ()=>_vanilla.getPositionStyles,
13
- TOAST_POSITIONS: ()=>_constants.TOAST_POSITIONS
12
+ getPositionStyles: function() {
13
+ return _vanilla.getPositionStyles;
14
+ },
15
+ TOAST_POSITIONS: function() {
16
+ return _constants.TOAST_POSITIONS;
17
+ }
14
18
  });
15
- const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
16
- _exportStar(require("./types"), exports);
17
- _exportStar(require("./useToaster"), exports);
18
- _exportStar(require("./useToastController"), exports);
19
+ const _export_star = require("@swc/helpers/_/_export_star");
20
+ _export_star._(require("./types"), exports);
21
+ _export_star._(require("./useToaster"), exports);
22
+ _export_star._(require("./useToastController"), exports);
19
23
  const _vanilla = require("./vanilla");
20
24
  const _constants = require("./constants");
@@ -1 +1 @@
1
- {"version":3,"sources":["index.js"],"sourcesContent":["export * from './types';\nexport * from './useToaster';\nexport * from './useToastController';\nexport { getPositionStyles } from './vanilla';\nexport { TOAST_POSITIONS } from './constants';\n"],"names":["getPositionStyles","TOAST_POSITIONS"],"mappings":";;;;;;;;;;;IAGSA,iBAAiB,MAAjBA,0BAAiB;IACjBC,eAAe,MAAfA,0BAAe;;;oBAJV;oBACA;oBACA;yBACoB;2BACF"}
1
+ {"version":3,"sources":["index.js"],"sourcesContent":["export * from './types';\nexport * from './useToaster';\nexport * from './useToastController';\nexport { getPositionStyles } from './vanilla';\nexport { TOAST_POSITIONS } from './constants';\n"],"names":["getPositionStyles","TOAST_POSITIONS"],"mappings":";;;;;;;;;;;IAGSA,iBAAiB;eAAjBA,0BAAiB;;IACjBC,eAAe;eAAfA,0BAAe;;;;uBAJV;uBACA;uBACA;yBACoB;2BACF"}
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
6
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
5
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
6
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
@@ -1 +1 @@
1
- {"version":3,"sources":["types.js"],"sourcesContent":["import * as React from 'react';\n"],"names":[],"mappings":";;;;;6DAAuB"}
1
+ {"version":3,"sources":["types.js"],"sourcesContent":["import * as React from 'react';\n"],"names":[],"mappings":";;;;;iEAAuB"}
@@ -4,15 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "useToastController", {
6
6
  enumerable: true,
7
- get: ()=>useToastController
7
+ get: function() {
8
+ return useToastController;
9
+ }
8
10
  });
9
- const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
- const _reactSharedContexts = require("@fluentui/react-shared-contexts");
11
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
+ const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
12
14
  const _vanilla = require("./vanilla");
13
15
  const noop = ()=>undefined;
14
16
  function useToastController(toasterId) {
15
- const { targetDocument } = (0, _reactSharedContexts.useFluent_unstable)();
17
+ const { targetDocument } = (0, _reactsharedcontexts.useFluent_unstable)();
16
18
  return _react.useMemo(()=>{
17
19
  if (!targetDocument) {
18
20
  return {
@@ -26,11 +28,12 @@ function useToastController(toasterId) {
26
28
  }
27
29
  return {
28
30
  dispatchToast: (content, options)=>{
31
+ var _options;
29
32
  (0, _vanilla.dispatchToast)(content, {
30
33
  ...options,
31
34
  toasterId,
32
35
  data: {
33
- root: options === null || options === void 0 ? void 0 : options.root
36
+ root: (_options = options) === null || _options === void 0 ? void 0 : _options.root
34
37
  }
35
38
  }, targetDocument);
36
39
  },
@@ -1 +1 @@
1
- {"version":3,"sources":["useToastController.js"],"sourcesContent":["import * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { dispatchToast as dispatchToastVanilla, dismissToast as dismissToastVanilla, dismissAllToasts as dismissAllToastsVanilla, updateToast as updateToastVanilla, playToast as playToastVanilla, pauseToast as pauseToastVanilla } from './vanilla';\nconst noop = ()=>undefined;\n/**\n * @param toasterId - If an id is provided all imperative methods control that specific toaster\n * @returns Imperative methods to control toasts\n */ export function useToastController(toasterId) {\n const { targetDocument } = useFluent();\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 return {\n dispatchToast: (content, options)=>{\n dispatchToastVanilla(content, {\n ...options,\n toasterId,\n data: {\n root: options === null || options === void 0 ? void 0 : options.root\n }\n }, targetDocument);\n },\n dismissToast: (toastId)=>{\n dismissToastVanilla(toastId, toasterId, targetDocument);\n },\n dismissAllToasts: ()=>{\n dismissAllToastsVanilla(toasterId, targetDocument);\n },\n updateToast: (options)=>{\n updateToastVanilla({\n ...options,\n data: {\n root: options.root\n },\n toasterId\n }, targetDocument);\n },\n pauseToast: (toastId)=>{\n pauseToastVanilla(toastId, toasterId, targetDocument);\n },\n playToast: (toastId)=>{\n playToastVanilla(toastId, toasterId, targetDocument);\n }\n };\n }, [\n targetDocument,\n toasterId\n ]);\n}\n"],"names":["useToastController","noop","undefined","toasterId","targetDocument","useFluent","React","useMemo","dispatchToast","dismissToast","dismissAllToasts","updateToast","pauseToast","playToast","content","options","dispatchToastVanilla","data","root","toastId","dismissToastVanilla","dismissAllToastsVanilla","updateToastVanilla","pauseToastVanilla","playToastVanilla"],"mappings":";;;;+BAOoBA;;aAAAA;;;6DAPG;qCACyB;yBAC2L;AAC3O,MAAMC,OAAO,IAAIC;AAIN,SAASF,mBAAmBG,SAAS,EAAE;IAC9C,MAAM,EAAEC,eAAc,EAAG,GAAGC,IAAAA,uCAAS;IACrC,OAAOC,OAAMC,OAAO,CAAC,IAAI;QACrB,IAAI,CAACH,gBAAgB;YACjB,OAAO;gBACHI,eAAeP;gBACfQ,cAAcR;gBACdS,kBAAkBT;gBAClBU,aAAaV;gBACbW,YAAYX;gBACZY,WAAWZ;YACf;QACJ,CAAC;QACD,OAAO;YACHO,eAAe,CAACM,SAASC,UAAU;gBAC/BC,IAAAA,sBAAoB,EAACF,SAAS;oBAC1B,GAAGC,OAAO;oBACVZ;oBACAc,MAAM;wBACFC,MAAMH,YAAY,IAAI,IAAIA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQG,IAAI;oBACxE;gBACJ,GAAGd;YACP;YACAK,cAAc,CAACU,UAAU;gBACrBC,IAAAA,qBAAmB,EAACD,SAAShB,WAAWC;YAC5C;YACAM,kBAAkB,IAAI;gBAClBW,IAAAA,yBAAuB,EAAClB,WAAWC;YACvC;YACAO,aAAa,CAACI,UAAU;gBACpBO,IAAAA,oBAAkB,EAAC;oBACf,GAAGP,OAAO;oBACVE,MAAM;wBACFC,MAAMH,QAAQG,IAAI;oBACtB;oBACAf;gBACJ,GAAGC;YACP;YACAQ,YAAY,CAACO,UAAU;gBACnBI,IAAAA,mBAAiB,EAACJ,SAAShB,WAAWC;YAC1C;YACAS,WAAW,CAACM,UAAU;gBAClBK,IAAAA,kBAAgB,EAACL,SAAShB,WAAWC;YACzC;QACJ;IACJ,GAAG;QACCA;QACAD;KACH;AACL"}
1
+ {"version":3,"sources":["useToastController.js"],"sourcesContent":["import * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { dispatchToast as dispatchToastVanilla, dismissToast as dismissToastVanilla, dismissAllToasts as dismissAllToastsVanilla, updateToast as updateToastVanilla, playToast as playToastVanilla, pauseToast as pauseToastVanilla } from './vanilla';\nconst noop = ()=>undefined;\n/**\n * @param toasterId - If an id is provided all imperative methods control that specific toaster\n * @returns Imperative methods to control toasts\n */ export function useToastController(toasterId) {\n const { targetDocument } = useFluent();\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 return {\n dispatchToast: (content, options)=>{\n var _options;\n dispatchToastVanilla(content, {\n ...options,\n toasterId,\n data: {\n root: (_options = options) === null || _options === void 0 ? void 0 : _options.root\n }\n }, targetDocument);\n },\n dismissToast: (toastId)=>{\n dismissToastVanilla(toastId, toasterId, targetDocument);\n },\n dismissAllToasts: ()=>{\n dismissAllToastsVanilla(toasterId, targetDocument);\n },\n updateToast: (options)=>{\n updateToastVanilla({\n ...options,\n data: {\n root: options.root\n },\n toasterId\n }, targetDocument);\n },\n pauseToast: (toastId)=>{\n pauseToastVanilla(toastId, toasterId, targetDocument);\n },\n playToast: (toastId)=>{\n playToastVanilla(toastId, toasterId, targetDocument);\n }\n };\n }, [\n targetDocument,\n toasterId\n ]);\n}\n"],"names":["useToastController","noop","undefined","toasterId","targetDocument","useFluent","React","useMemo","dispatchToast","dismissToast","dismissAllToasts","updateToast","pauseToast","playToast","content","options","_options","dispatchToastVanilla","data","root","toastId","dismissToastVanilla","dismissAllToastsVanilla","updateToastVanilla","pauseToastVanilla","playToastVanilla"],"mappings":";;;;+BAOoBA;;;eAAAA;;;;iEAPG;qCACyB;yBAC2L;AAC3O,MAAMC,OAAO,IAAIC;AAIN,SAASF,mBAAmBG,SAAS;IAC5C,MAAM,EAAEC,cAAc,EAAE,GAAGC,IAAAA,uCAAS;IACpC,OAAOC,OAAMC,OAAO,CAAC;QACjB,IAAI,CAACH,gBAAgB;YACjB,OAAO;gBACHI,eAAeP;gBACfQ,cAAcR;gBACdS,kBAAkBT;gBAClBU,aAAaV;gBACbW,YAAYX;gBACZY,WAAWZ;YACf;QACJ;QACA,OAAO;YACHO,eAAe,CAACM,SAASC;gBACrB,IAAIC;gBACJC,IAAAA,sBAAoB,EAACH,SAAS;oBAC1B,GAAGC,OAAO;oBACVZ;oBACAe,MAAM;wBACFC,MAAM,AAACH,CAAAA,WAAWD,OAAM,MAAO,QAAQC,aAAa,KAAK,IAAI,KAAK,IAAIA,SAASG,IAAI;oBACvF;gBACJ,GAAGf;YACP;YACAK,cAAc,CAACW;gBACXC,IAAAA,qBAAmB,EAACD,SAASjB,WAAWC;YAC5C;YACAM,kBAAkB;gBACdY,IAAAA,yBAAuB,EAACnB,WAAWC;YACvC;YACAO,aAAa,CAACI;gBACVQ,IAAAA,oBAAkB,EAAC;oBACf,GAAGR,OAAO;oBACVG,MAAM;wBACFC,MAAMJ,QAAQI,IAAI;oBACtB;oBACAhB;gBACJ,GAAGC;YACP;YACAQ,YAAY,CAACQ;gBACTI,IAAAA,mBAAiB,EAACJ,SAASjB,WAAWC;YAC1C;YACAS,WAAW,CAACO;gBACRK,IAAAA,kBAAgB,EAACL,SAASjB,WAAWC;YACzC;QACJ;IACJ,GAAG;QACCA;QACAD;KACH;AACL"}