@fluentui/react-toast 9.0.6 → 9.1.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 (95) hide show
  1. package/CHANGELOG.json +115 -1
  2. package/CHANGELOG.md +34 -2
  3. package/lib/components/AriaLive/renderAriaLive.js +3 -3
  4. package/lib/components/AriaLive/renderAriaLive.js.map +1 -1
  5. package/lib/components/AriaLive/useAriaLive.js +7 -7
  6. package/lib/components/AriaLive/useAriaLive.js.map +1 -1
  7. package/lib/components/Timer/useTimerStyles.styles.js +1 -1
  8. package/lib/components/Timer/useTimerStyles.styles.js.map +1 -1
  9. package/lib/components/Toast/renderToast.js +3 -3
  10. package/lib/components/Toast/renderToast.js.map +1 -1
  11. package/lib/components/Toast/useToast.js +4 -2
  12. package/lib/components/Toast/useToast.js.map +1 -1
  13. package/lib/components/Toast/useToastStyles.styles.js +1 -1
  14. package/lib/components/Toast/useToastStyles.styles.js.map +1 -1
  15. package/lib/components/ToastBody/renderToastBody.js +3 -3
  16. package/lib/components/ToastBody/renderToastBody.js.map +1 -1
  17. package/lib/components/ToastBody/useToastBody.js +7 -3
  18. package/lib/components/ToastBody/useToastBody.js.map +1 -1
  19. package/lib/components/ToastBody/useToastBodyStyles.styles.js +2 -2
  20. package/lib/components/ToastBody/useToastBodyStyles.styles.js.map +1 -1
  21. package/lib/components/ToastContainer/renderToastContainer.js +3 -3
  22. package/lib/components/ToastContainer/renderToastContainer.js.map +1 -1
  23. package/lib/components/ToastContainer/useToastContainer.js +34 -15
  24. package/lib/components/ToastContainer/useToastContainer.js.map +1 -1
  25. package/lib/components/ToastContainer/useToastContainerStyles.styles.js +4 -4
  26. package/lib/components/ToastContainer/useToastContainerStyles.styles.js.map +1 -1
  27. package/lib/components/ToastFooter/renderToastFooter.js +3 -3
  28. package/lib/components/ToastFooter/renderToastFooter.js.map +1 -1
  29. package/lib/components/ToastFooter/useToastFooter.js +4 -2
  30. package/lib/components/ToastFooter/useToastFooter.js.map +1 -1
  31. package/lib/components/ToastFooter/useToastFooterStyles.styles.js +1 -1
  32. package/lib/components/ToastFooter/useToastFooterStyles.styles.js.map +1 -1
  33. package/lib/components/ToastTitle/renderToastTitle.js +3 -3
  34. package/lib/components/ToastTitle/renderToastTitle.js.map +1 -1
  35. package/lib/components/ToastTitle/useToastTitle.js +11 -6
  36. package/lib/components/ToastTitle/useToastTitle.js.map +1 -1
  37. package/lib/components/ToastTitle/useToastTitleStyles.styles.js +3 -3
  38. package/lib/components/ToastTitle/useToastTitleStyles.styles.js.map +1 -1
  39. package/lib/components/Toaster/renderToaster.js +4 -4
  40. package/lib/components/Toaster/renderToaster.js.map +1 -1
  41. package/lib/components/Toaster/useToastAnnounce.js +47 -0
  42. package/lib/components/Toaster/useToastAnnounce.js.map +1 -0
  43. package/lib/components/Toaster/useToaster.js +40 -35
  44. package/lib/components/Toaster/useToaster.js.map +1 -1
  45. package/lib/components/Toaster/useToasterFocusManagement.js +85 -0
  46. package/lib/components/Toaster/useToasterFocusManagement.js.map +1 -0
  47. package/lib/state/useToaster.js +24 -6
  48. package/lib/state/useToaster.js.map +1 -1
  49. package/lib-commonjs/components/AriaLive/renderAriaLive.js +2 -2
  50. package/lib-commonjs/components/AriaLive/renderAriaLive.js.map +1 -1
  51. package/lib-commonjs/components/AriaLive/useAriaLive.js +6 -6
  52. package/lib-commonjs/components/AriaLive/useAriaLive.js.map +1 -1
  53. package/lib-commonjs/components/Timer/useTimerStyles.styles.js +3 -5
  54. package/lib-commonjs/components/Timer/useTimerStyles.styles.js.map +1 -1
  55. package/lib-commonjs/components/Toast/renderToast.js +2 -2
  56. package/lib-commonjs/components/Toast/renderToast.js.map +1 -1
  57. package/lib-commonjs/components/Toast/useToast.js +3 -1
  58. package/lib-commonjs/components/Toast/useToast.js.map +1 -1
  59. package/lib-commonjs/components/Toast/useToastStyles.styles.js +2 -2
  60. package/lib-commonjs/components/Toast/useToastStyles.styles.js.map +1 -1
  61. package/lib-commonjs/components/ToastBody/renderToastBody.js +2 -2
  62. package/lib-commonjs/components/ToastBody/renderToastBody.js.map +1 -1
  63. package/lib-commonjs/components/ToastBody/useToastBody.js +6 -2
  64. package/lib-commonjs/components/ToastBody/useToastBody.js.map +1 -1
  65. package/lib-commonjs/components/ToastBody/useToastBodyStyles.styles.js +2 -2
  66. package/lib-commonjs/components/ToastBody/useToastBodyStyles.styles.js.map +1 -1
  67. package/lib-commonjs/components/ToastContainer/renderToastContainer.js +2 -2
  68. package/lib-commonjs/components/ToastContainer/renderToastContainer.js.map +1 -1
  69. package/lib-commonjs/components/ToastContainer/useToastContainer.js +33 -14
  70. package/lib-commonjs/components/ToastContainer/useToastContainer.js.map +1 -1
  71. package/lib-commonjs/components/ToastContainer/useToastContainerStyles.styles.js +9 -13
  72. package/lib-commonjs/components/ToastContainer/useToastContainerStyles.styles.js.map +1 -1
  73. package/lib-commonjs/components/ToastFooter/renderToastFooter.js +2 -2
  74. package/lib-commonjs/components/ToastFooter/renderToastFooter.js.map +1 -1
  75. package/lib-commonjs/components/ToastFooter/useToastFooter.js +3 -1
  76. package/lib-commonjs/components/ToastFooter/useToastFooter.js.map +1 -1
  77. package/lib-commonjs/components/ToastFooter/useToastFooterStyles.styles.js +1 -1
  78. package/lib-commonjs/components/ToastFooter/useToastFooterStyles.styles.js.map +1 -1
  79. package/lib-commonjs/components/ToastTitle/renderToastTitle.js +2 -2
  80. package/lib-commonjs/components/ToastTitle/renderToastTitle.js.map +1 -1
  81. package/lib-commonjs/components/ToastTitle/useToastTitle.js +10 -5
  82. package/lib-commonjs/components/ToastTitle/useToastTitle.js.map +1 -1
  83. package/lib-commonjs/components/ToastTitle/useToastTitleStyles.styles.js +5 -5
  84. package/lib-commonjs/components/ToastTitle/useToastTitleStyles.styles.js.map +1 -1
  85. package/lib-commonjs/components/Toaster/renderToaster.js +3 -3
  86. package/lib-commonjs/components/Toaster/renderToaster.js.map +1 -1
  87. package/lib-commonjs/components/Toaster/useToastAnnounce.js +50 -0
  88. package/lib-commonjs/components/Toaster/useToastAnnounce.js.map +1 -0
  89. package/lib-commonjs/components/Toaster/useToaster.js +39 -34
  90. package/lib-commonjs/components/Toaster/useToaster.js.map +1 -1
  91. package/lib-commonjs/components/Toaster/useToasterFocusManagement.js +92 -0
  92. package/lib-commonjs/components/Toaster/useToasterFocusManagement.js.map +1 -0
  93. package/lib-commonjs/state/useToaster.js +24 -6
  94. package/lib-commonjs/state/useToaster.js.map +1 -1
  95. package/package.json +10 -9
@@ -10,51 +10,56 @@ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildc
10
10
  const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
11
  const _reactUtilities = require("@fluentui/react-utilities");
12
12
  const _reactSharedContexts = require("@fluentui/react-shared-contexts");
13
+ const _reactTabster = require("@fluentui/react-tabster");
14
+ const _keyboardKeys = require("@fluentui/keyboard-keys");
13
15
  const _state = require("../../state");
14
16
  const _toastContainer = require("../ToastContainer");
17
+ const _useToasterFocusManagement = require("./useToasterFocusManagement");
18
+ const _useToastAnnounce = require("./useToastAnnounce");
15
19
  const useToaster_unstable = (props)=>{
16
20
  const { offset , announce: announceProp , ...rest } = props;
17
21
  const announceRef = _react.useRef(()=>null);
18
- const { toastsToRender , isToastVisible , pauseAllToasts , playAllToasts , tryRestoreFocus } = (0, _state.useToaster)(rest);
22
+ const { toastsToRender , isToastVisible , pauseAllToasts , playAllToasts , tryRestoreFocus , closeAllToasts } = (0, _state.useToaster)(rest);
19
23
  const announce = _react.useCallback((message, options)=>announceRef.current(message, options), []);
20
24
  const { dir } = (0, _reactSharedContexts.useFluent_unstable)();
21
- const rootProps = (0, _reactUtilities.getNativeElementProps)('div', rest);
22
- // Adds native HTML focusin/focusout listeners
23
- // https://github.com/facebook/react/issues/25194
24
- const focusListenerRef = _react.useCallback((el)=>{
25
- if (el) {
26
- el.addEventListener('focusin', (e)=>{
27
- if ((0, _reactUtilities.isHTMLElement)(e.currentTarget) && !e.currentTarget.contains((0, _reactUtilities.isHTMLElement)(e.relatedTarget) ? e.relatedTarget : null)) {
28
- pauseAllToasts();
29
- }
30
- });
31
- el.addEventListener('focusout', (e)=>{
32
- if ((0, _reactUtilities.isHTMLElement)(e.currentTarget) && !e.currentTarget.contains((0, _reactUtilities.isHTMLElement)(e.relatedTarget) ? e.relatedTarget : null)) {
33
- playAllToasts();
34
- tryRestoreFocus();
35
- }
36
- });
25
+ const rootProps = _reactUtilities.slot.always((0, _reactUtilities.getNativeElementProps)('div', rest), {
26
+ elementType: 'div'
27
+ });
28
+ const focusableGroupAttr = (0, _reactTabster.useFocusableGroup)({
29
+ tabBehavior: 'limited-trap-focus',
30
+ ignoreDefaultKeydown: {
31
+ Escape: true
37
32
  }
38
- }, [
39
- playAllToasts,
40
- pauseAllToasts,
41
- tryRestoreFocus
42
- ]);
43
- const createPositionSlot = (toastPosition)=>{
33
+ });
34
+ const onKeyDown = (0, _reactUtilities.useEventCallback)((e)=>{
35
+ var _props_onKeyDown;
36
+ if (e.key === _keyboardKeys.Escape) {
37
+ e.preventDefault();
38
+ closeAllToasts();
39
+ }
40
+ (_props_onKeyDown = props.onKeyDown) === null || _props_onKeyDown === void 0 ? void 0 : _props_onKeyDown.call(props, e);
41
+ });
42
+ const usePositionSlot = (toastPosition)=>{
44
43
  var _toastsToRender_get;
45
- return (0, _reactUtilities.resolveShorthand)(toastsToRender.has(toastPosition) ? rootProps : null, {
44
+ 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, {
46
47
  defaultProps: {
47
- ref: focusListenerRef,
48
+ ref: (0, _reactUtilities.useMergedRefs)(focusManagementRef, toasterRef),
48
49
  children: (_toastsToRender_get = toastsToRender.get(toastPosition)) === null || _toastsToRender_get === void 0 ? void 0 : _toastsToRender_get.map((toast)=>/*#__PURE__*/ _react.createElement(_toastContainer.ToastContainer, {
49
50
  ...toast,
50
51
  tryRestoreFocus: tryRestoreFocus,
51
52
  intent: toast.intent,
52
- announce: announce,
53
+ announce: announceToast,
53
54
  key: toast.toastId,
54
55
  visible: isToastVisible(toast.toastId)
55
56
  }, toast.content)),
56
- 'data-toaster-position': toastPosition
57
- }
57
+ onKeyDown,
58
+ ...focusableGroupAttr,
59
+ 'data-toaster-position': toastPosition,
60
+ role: 'list'
61
+ },
62
+ elementType: 'div'
58
63
  });
59
64
  };
60
65
  return {
@@ -66,13 +71,13 @@ const useToaster_unstable = (props)=>{
66
71
  topStart: 'div',
67
72
  topEnd: 'div'
68
73
  },
69
- root: (0, _reactUtilities.resolveShorthand)(rootProps, {
70
- required: true
74
+ root: _reactUtilities.slot.always(rootProps, {
75
+ elementType: 'div'
71
76
  }),
72
- bottomStart: createPositionSlot(_state.TOAST_POSITIONS.bottomStart),
73
- bottomEnd: createPositionSlot(_state.TOAST_POSITIONS.bottomEnd),
74
- topStart: createPositionSlot(_state.TOAST_POSITIONS.topStart),
75
- topEnd: createPositionSlot(_state.TOAST_POSITIONS.topEnd),
77
+ bottomStart: usePositionSlot(_state.TOAST_POSITIONS.bottomStart),
78
+ bottomEnd: usePositionSlot(_state.TOAST_POSITIONS.bottomEnd),
79
+ topStart: usePositionSlot(_state.TOAST_POSITIONS.topStart),
80
+ topEnd: usePositionSlot(_state.TOAST_POSITIONS.topEnd),
76
81
  announceRef,
77
82
  offset,
78
83
  announce: announceProp !== null && announceProp !== void 0 ? announceProp : announce,
@@ -1 +1 @@
1
- {"version":3,"sources":["useToaster.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, isHTMLElement, resolveShorthand } from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { TOAST_POSITIONS, useToaster } from '../../state';\nimport { ToastContainer } from '../ToastContainer';\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 , ...rest } = props;\n const announceRef = React.useRef(()=>null);\n const { toastsToRender , isToastVisible , pauseAllToasts , playAllToasts , tryRestoreFocus } = useToaster(rest);\n const announce = React.useCallback((message, options)=>announceRef.current(message, options), []);\n const { dir } = useFluent();\n const rootProps = getNativeElementProps('div', rest);\n // Adds native HTML focusin/focusout listeners\n // https://github.com/facebook/react/issues/25194\n const focusListenerRef = React.useCallback((el)=>{\n if (el) {\n el.addEventListener('focusin', (e)=>{\n if (isHTMLElement(e.currentTarget) && !e.currentTarget.contains(isHTMLElement(e.relatedTarget) ? e.relatedTarget : null)) {\n pauseAllToasts();\n }\n });\n el.addEventListener('focusout', (e)=>{\n if (isHTMLElement(e.currentTarget) && !e.currentTarget.contains(isHTMLElement(e.relatedTarget) ? e.relatedTarget : null)) {\n playAllToasts();\n tryRestoreFocus();\n }\n });\n }\n }, [\n playAllToasts,\n pauseAllToasts,\n tryRestoreFocus\n ]);\n const createPositionSlot = (toastPosition)=>{\n var _toastsToRender_get;\n return resolveShorthand(toastsToRender.has(toastPosition) ? rootProps : null, {\n defaultProps: {\n ref: focusListenerRef,\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: announce,\n key: toast.toastId,\n visible: isToastVisible(toast.toastId)\n }, toast.content)),\n 'data-toaster-position': toastPosition\n }\n });\n };\n return {\n dir,\n components: {\n root: 'div',\n bottomStart: 'div',\n bottomEnd: 'div',\n topStart: 'div',\n topEnd: 'div'\n },\n root: resolveShorthand(rootProps, {\n required: true\n }),\n bottomStart: createPositionSlot(TOAST_POSITIONS.bottomStart),\n bottomEnd: createPositionSlot(TOAST_POSITIONS.bottomEnd),\n topStart: createPositionSlot(TOAST_POSITIONS.topStart),\n topEnd: createPositionSlot(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","rest","announceRef","React","useRef","toastsToRender","isToastVisible","pauseAllToasts","playAllToasts","tryRestoreFocus","useToaster","useCallback","message","options","current","dir","useFluent","rootProps","getNativeElementProps","focusListenerRef","el","addEventListener","e","isHTMLElement","currentTarget","contains","relatedTarget","createPositionSlot","toastPosition","_toastsToRender_get","resolveShorthand","has","defaultProps","ref","children","get","map","toast","createElement","ToastContainer","intent","key","toastId","visible","content","components","root","bottomStart","bottomEnd","topStart","topEnd","required","TOAST_POSITIONS","renderAriaLive"],"mappings":";;;;+BASiBA;;aAAAA;;;6DATM;gCACgD;qCACvB;uBACJ;gCACb;AAKpB,MAAMA,sBAAsB,CAACC,QAAQ;IAC5C,MAAM,EAAEC,OAAM,EAAGC,UAAUC,aAAY,EAAG,GAAGC,MAAM,GAAGJ;IACtD,MAAMK,cAAcC,OAAMC,MAAM,CAAC,IAAI,IAAI;IACzC,MAAM,EAAEC,eAAc,EAAGC,eAAc,EAAGC,eAAc,EAAGC,cAAa,EAAGC,gBAAe,EAAG,GAAGC,IAAAA,iBAAU,EAACT;IAC3G,MAAMF,WAAWI,OAAMQ,WAAW,CAAC,CAACC,SAASC,UAAUX,YAAYY,OAAO,CAACF,SAASC,UAAU,EAAE;IAChG,MAAM,EAAEE,IAAG,EAAG,GAAGC,IAAAA,uCAAS;IAC1B,MAAMC,YAAYC,IAAAA,qCAAqB,EAAC,OAAOjB;IAC/C,8CAA8C;IAC9C,iDAAiD;IACjD,MAAMkB,mBAAmBhB,OAAMQ,WAAW,CAAC,CAACS,KAAK;QAC7C,IAAIA,IAAI;YACJA,GAAGC,gBAAgB,CAAC,WAAW,CAACC,IAAI;gBAChC,IAAIC,IAAAA,6BAAa,EAACD,EAAEE,aAA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,WAAW;QAC3DC,WAAWrB,mBAAmByB,sBAAe,CAACJ,SAAS;QACvDC,UAAUtB,mBAAmByB,sBAAe,CAACH,QAAQ;QACrDC,QAAQvB,mBAAmByB,sBAAe,CAACF,MAAM;QACjDhD;QACAJ;QACAC,UAAUC,iBAAiB,IAAI,IAAIA,iBAAiB,KAAK,IAAIA,eAAeD,QAAQ;QACpFsD,gBAAgB,CAACrD;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 , ...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 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","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,EAAG,GAAGC,MAAM,GAAGJ;IACtD,MAAMK,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,MAAMF,WAAWI,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,mBAAmBlC,MAAM+B,SAAS,AAAD,MAAO,IAAI,IAAIG,qBAAqB,KAAK,IAAI,KAAK,IAAIA,iBAAiBG,IAAI,CAACrC,OAAOiC,EAAE;IAC3H;IACA,MAAMK,kBAAkB,CAACC,gBAAgB;QACrC,IAAIC;QACJ,MAAMC,qBAAqBC,IAAAA,6DAAkC,EAAChC,gBAAgBC;QAC9E,MAAM,EAAEgC,c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+1,92 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "useToasterFocusManagement_unstable", {
6
+ enumerable: true,
7
+ get: ()=>useToasterFocusManagement_unstable
8
+ });
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");
15
+ const noop = ()=>undefined;
16
+ function useToasterFocusManagement_unstable(pauseAllToasts, playAllToasts) {
17
+ const { targetDocument } = (0, _reactSharedContexts.useFluent_unstable)();
18
+ const cleanupListenersRef = _react.useRef(noop);
19
+ return _react.useCallback((el)=>{
20
+ if (!el || !targetDocument) {
21
+ cleanupListenersRef.current();
22
+ cleanupListenersRef.current = noop;
23
+ return;
24
+ }
25
+ const toastContainerWalker = targetDocument.createTreeWalker(el, NodeFilter.SHOW_ELEMENT, {
26
+ acceptNode (node) {
27
+ if ((0, _reactUtilities.isHTMLElement)(node) && node.classList.contains(_toastContainer.toastContainerClassNames.root)) {
28
+ return NodeFilter.FILTER_ACCEPT;
29
+ }
30
+ return NodeFilter.FILTER_SKIP;
31
+ }
32
+ });
33
+ /**
34
+ * FIXME: https://github.com/microsoft/tabster/issues/299
35
+ * Toasts should be arrow navigable and focus should be trapped in a stack of tasts
36
+ * This is a temporary measure, Tabster does not have an API yet to enable mover arrow keys from within grouppers
37
+ * Once tabster fully supports this use case, remove this hook
38
+ */ const keydownListener = (e)=>{
39
+ const { target , key } = e;
40
+ if (!(0, _reactUtilities.isHTMLElement)(target)) {
41
+ return;
42
+ }
43
+ if (key === _keyboardKeys.ArrowDown) {
44
+ toastContainerWalker.currentNode = target;
45
+ let nextToastContainer = toastContainerWalker.nextNode();
46
+ if (!nextToastContainer) {
47
+ toastContainerWalker.currentNode = el;
48
+ nextToastContainer = toastContainerWalker.nextNode();
49
+ }
50
+ if ((0, _reactUtilities.isHTMLElement)(nextToastContainer)) {
51
+ nextToastContainer.focus();
52
+ }
53
+ }
54
+ if (key === _keyboardKeys.ArrowUp) {
55
+ toastContainerWalker.currentNode = target;
56
+ let prevToastContainer = toastContainerWalker.previousNode();
57
+ if (prevToastContainer && prevToastContainer.contains(target)) {
58
+ prevToastContainer = toastContainerWalker.previousNode();
59
+ }
60
+ if (!prevToastContainer) {
61
+ toastContainerWalker.currentNode = el;
62
+ prevToastContainer = toastContainerWalker.lastChild();
63
+ }
64
+ if ((0, _reactUtilities.isHTMLElement)(prevToastContainer)) {
65
+ prevToastContainer.focus();
66
+ }
67
+ }
68
+ };
69
+ const focusInListener = (e)=>{
70
+ if ((0, _reactUtilities.isHTMLElement)(e.currentTarget) && !e.currentTarget.contains((0, _reactUtilities.isHTMLElement)(e.relatedTarget) ? e.relatedTarget : null)) {
71
+ pauseAllToasts();
72
+ }
73
+ };
74
+ const focusOutListener = (e)=>{
75
+ if ((0, _reactUtilities.isHTMLElement)(e.currentTarget) && !e.currentTarget.contains((0, _reactUtilities.isHTMLElement)(e.relatedTarget) ? e.relatedTarget : null)) {
76
+ playAllToasts();
77
+ }
78
+ };
79
+ el.addEventListener('keydown', keydownListener);
80
+ el.addEventListener('focusin', focusInListener);
81
+ el.addEventListener('focusout', focusOutListener);
82
+ cleanupListenersRef.current = ()=>{
83
+ el.removeEventListener('keydown', keydownListener);
84
+ el.removeEventListener('focusin', focusInListener);
85
+ el.removeEventListener('focusout', focusOutListener);
86
+ };
87
+ }, [
88
+ targetDocument,
89
+ pauseAllToasts,
90
+ playAllToasts
91
+ ]);
92
+ }
@@ -0,0 +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,KAAK;QAC3B,IAAI,CAACA,MAAM,CAACN,gBAAgB;YACxBE,oBAAoBK,OAAO;YAC3BL,oBAAoBK,OAAO,GAAGX;YAC9B;QACJ,CAAC;QACD,MAAMY,uBAAuBR,eAAeS,gBAAgB,CAACH,IAAII,WAAWC,YAAY,EAAE;YACtFC,YAAYC,IAAI,EAAE;gBACd,IAAIC,IAAAA,6BAAa,EAACD,SAASA,KAAKE,SAAS,CAACC,QAAQ,CAACC,wC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L;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"}
@@ -27,11 +27,6 @@ function useToaster(options = {}) {
27
27
  return shortcuts.focus(e);
28
28
  }
29
29
  });
30
- const tryRestoreFocus = _react.useCallback(()=>{
31
- var _lastActiveElementRef_current;
32
- (_lastActiveElementRef_current = lastActiveElementRef.current) === null || _lastActiveElementRef_current === void 0 ? void 0 : _lastActiveElementRef_current.focus();
33
- lastActiveElementRef.current = null;
34
- }, []);
35
30
  const pauseAllToasts = _react.useCallback(()=>{
36
31
  toaster.visibleToasts.forEach((toastId)=>{
37
32
  var _toast_imperativeRef_current;
@@ -67,6 +62,28 @@ function useToaster(options = {}) {
67
62
  }, [
68
63
  toaster
69
64
  ]);
65
+ const tryRestoreFocus = _react.useCallback(()=>{
66
+ const mostRecentToast = getMostRecentVisibleToast();
67
+ if (mostRecentToast === null || mostRecentToast === void 0 ? void 0 : mostRecentToast.imperativeRef.current) {
68
+ mostRecentToast.imperativeRef.current.focus();
69
+ } else {
70
+ var _lastActiveElementRef_current;
71
+ (_lastActiveElementRef_current = lastActiveElementRef.current) === null || _lastActiveElementRef_current === void 0 ? void 0 : _lastActiveElementRef_current.focus();
72
+ lastActiveElementRef.current = null;
73
+ }
74
+ }, [
75
+ getMostRecentVisibleToast
76
+ ]);
77
+ const closeAllToasts = _react.useCallback(()=>{
78
+ toaster.visibleToasts.forEach((toastId)=>{
79
+ const toast = toaster.toasts.get(toastId);
80
+ toast === null || toast === void 0 ? void 0 : toast.close();
81
+ });
82
+ tryRestoreFocus();
83
+ }, [
84
+ toaster,
85
+ tryRestoreFocus
86
+ ]);
70
87
  _react.useEffect(()=>{
71
88
  if (!targetDocument) {
72
89
  return;
@@ -166,6 +183,7 @@ function useToaster(options = {}) {
166
183
  toastsToRender,
167
184
  pauseAllToasts,
168
185
  playAllToasts,
169
- tryRestoreFocus
186
+ tryRestoreFocus,
187
+ closeAllToasts
170
188
  };
171
189
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["useToaster.js"],"sourcesContent":["import * as React from 'react';\nimport { isHTMLElement, useEventCallback, useForceUpdate } from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { createToaster } from './vanilla';\nimport { EVENTS } from './constants';\nexport function useToaster(options = {}) {\n const forceUpdate = useForceUpdate();\n const { toasterId: userToasterId , shortcuts } = options;\n // Currently the toaster options can never be changed at runtime\n const [toaster] = React.useState(()=>createToaster(options));\n const { targetDocument } = useFluent();\n const lastActiveElementRef = React.useRef(null);\n const isCorrectToaster = useEventCallback((toasterId)=>{\n return toasterId === userToasterId;\n });\n const isFocusShortcut = useEventCallback((e)=>{\n if (shortcuts === null || shortcuts === void 0 ? void 0 : shortcuts.focus) {\n return shortcuts.focus(e);\n }\n });\n const tryRestoreFocus = React.useCallback(()=>{\n var _lastActiveElementRef_current;\n (_lastActiveElementRef_current = lastActiveElementRef.current) === null || _lastActiveElementRef_current === void 0 ? void 0 : _lastActiveElementRef_current.focus();\n lastActiveElementRef.current = null;\n }, []);\n const pauseAllToasts = React.useCallback(()=>{\n toaster.visibleToasts.forEach((toastId)=>{\n var _toast_imperativeRef_current;\n const toast = toaster.toasts.get(toastId);\n (_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();\n });\n }, [\n toaster\n ]);\n const playAllToasts = React.useCallback(()=>{\n toaster.visibleToasts.forEach((toastId)=>{\n var _toast_imperativeRef_current;\n const toast = toaster.toasts.get(toastId);\n (_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();\n });\n }, [\n toaster\n ]);\n const getMostRecentVisibleToast = React.useCallback(()=>{\n return Array.from(toaster.visibleToasts).reduce((cur, next)=>{\n const toast = toaster.toasts.get(next);\n if (!toast) {\n return cur;\n }\n if (!cur) {\n return toast;\n }\n if (cur.order < (toast === null || toast === void 0 ? void 0 : toast.order)) {\n return toast;\n }\n return cur;\n }, undefined);\n }, [\n toaster\n ]);\n React.useEffect(()=>{\n if (!targetDocument) {\n return;\n }\n const addToastListener = (eventType, callback)=>{\n const listener = (e)=>{\n if (!isCorrectToaster(e.detail.toasterId)) {\n return;\n }\n callback(e);\n forceUpdate();\n };\n targetDocument.addEventListener(eventType, listener);\n return ()=>targetDocument.removeEventListener(eventType, listener);\n };\n const buildToast = (e)=>{\n toaster.buildToast(e.detail, forceUpdate);\n };\n const dismissToast = (e)=>{\n toaster.dismissToast(e.detail.toastId);\n };\n const updateToast = (e)=>{\n toaster.updateToast(e.detail);\n };\n const dismissAllToasts = (e)=>{\n toaster.dismissAllToasts();\n };\n const pauseToast = (e)=>{\n const toast = toaster.toasts.get(e.detail.toastId);\n if (toast) {\n var _toast_imperativeRef_current;\n (_toast_imperativeRef_current = toast.imperativeRef.current) === null || _toast_imperativeRef_current === void 0 ? void 0 : _toast_imperativeRef_current.pause();\n }\n };\n const playToast = (e)=>{\n const toast = toaster.toasts.get(e.detail.toastId);\n if (toast) {\n var _toast_imperativeRef_current;\n (_toast_imperativeRef_current = toast.imperativeRef.current) === null || _toast_imperativeRef_current === void 0 ? void 0 : _toast_imperativeRef_current.play();\n }\n };\n const cleanupBuildListener = addToastListener(EVENTS.show, buildToast);\n const cleanupUpdateListener = addToastListener(EVENTS.update, updateToast);\n const cleanupDismissListener = addToastListener(EVENTS.dismiss, dismissToast);\n const cleanupDismissAllListener = addToastListener(EVENTS.dismissAll, dismissAllToasts);\n const cleanupPauseListener = addToastListener(EVENTS.pause, pauseToast);\n const cleanupPlayListener = addToastListener(EVENTS.play, playToast);\n const focusShortcutListener = (e)=>{\n if (isFocusShortcut(e)) {\n pauseAllToasts();\n const mostRecentToast = getMostRecentVisibleToast();\n if (mostRecentToast) {\n var _mostRecentToast_imperativeRef_current;\n lastActiveElementRef.current = isHTMLElement(targetDocument.activeElement) ? targetDocument.activeElement : null;\n (_mostRecentToast_imperativeRef_current = mostRecentToast.imperativeRef.current) === null || _mostRecentToast_imperativeRef_current === void 0 ? void 0 : _mostRecentToast_imperativeRef_current.focus();\n }\n }\n };\n targetDocument.addEventListener('keydown', focusShortcutListener);\n return ()=>{\n cleanupBuildListener();\n cleanupDismissAllListener();\n cleanupUpdateListener();\n cleanupDismissListener();\n cleanupPauseListener();\n cleanupPlayListener();\n targetDocument.removeEventListener('keydown', focusShortcutListener);\n };\n }, [\n toaster,\n forceUpdate,\n targetDocument,\n isCorrectToaster,\n pauseAllToasts,\n getMostRecentVisibleToast,\n isFocusShortcut\n ]);\n const toastsToRender = (()=>{\n if (!toaster) {\n return new Map();\n }\n const toRender = new Map();\n const toasts = Array.from(toaster.toasts.values());\n toasts.forEach((toast)=>{\n const { position } = toast;\n toRender.has(position) || toRender.set(position, []);\n if (position.startsWith('bottom')) {\n toRender.get(position).push(toast);\n } else {\n toRender.get(position).unshift(toast);\n }\n });\n return toRender;\n })();\n return {\n isToastVisible: toaster.isToastVisible,\n toastsToRender,\n pauseAllToasts,\n playAllToasts,\n tryRestoreFocus\n };\n}\n"],"names":["useToaster","options","forceUpdate","useForceUpdate","toasterId","userToasterId","shortcuts","toaster","React","useState","createToaster","targetDocument","useFluent","lastActiveElementRef","useRef","isCorrectToaster","useEventCallback","isFocusShortcut","e","focus","tryRestoreFocus","useCallback","_lastActiveElementRef_current","current","pauseAllToasts","visibleToasts","forEach","toastId","_toast_imperativeRef_current","toast","toasts","get","imperativeRef","pause","playAllToasts","play","getMostRecentVisibleToast","Array","from","reduce","cur","next","order","undefined","useEffect","addToastListener","eventType","callback","listener","detail","addEventListener","removeEventListener","buildToast","dismissToast","updateToast","dismissAllToasts","pauseToast","playToast","cleanupBuildListener","EVENTS","show","cleanupUpdateListener","update","cleanupDismissListener","dismiss","cleanupDismissAllListener","dismissAll","cleanupPauseListener","cleanupPlayListener","focusShortcutListener","mostRecentToast","_mostRecentToast_imperativeRef_current","isHTMLElement","activeElement","toastsToRender","Map","toRender","values","position","has","set","startsWith","push","unshift","isToastVisible"],"mappings":";;;;+BAKgBA;;aAAAA;;;6DALO;gCACyC;qCAChB;yBAClB;2BACP;AAChB,SAASA,WAAWC,UAAU,CAAC,CAAC,EAAE;IACrC,MAAMC,cAAcC,IAAAA,8BAAc;IAClC,MAAM,EAAEC,WAAWC,cAAa,EAAGC,UAAS,EAAG,GAAGL;IAClD,gEAAgE;IAChE,MAAM,CAACM,QAAQ,GAAGC,OAAMC,QAAQ,CAAC,IAAIC,IAAAA,sBAAa,EAACT;IACnD,MAAM,EAAEU,eAAc,EAAG,GAAGC,IAAAA,uCAAS;IACrC,MAAMC,uBAAuBL,OAAMM,MAAM,CAAC,IAAI;IAC9C,MAAMC,mBAAmBC,IAAAA,gCAAgB,EAAC,CAACZ,YAAY;QACnD,OAAOA,cAAcC;IACzB;IACA,MAAMY,kBAAkBD,IAAAA,gCAAgB,EAAC,CAACE,IAAI;QAC1C,IAAIZ,cAAc,IAAI,IAAIA,cAAc,KAAK,IAAI,KAAK,IAAIA,UAAUa,KAAK,EAAE;YACvE,OAAOb,UAAUa,KAAK,CAACD;QAC3B,CAAC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L;QACAS;QACAI;QACAS;QACAY;QACAnB;KACH;IACD,MAAMyD,iBAAiB,AAAC,CAAA,IAAI;QACxB,IAAI,CAACnE,SAAS;YACV,OAAO,IAAIoE;QACf,CAAC;QACD,MAAMC,WAAW,IAAID;QACrB,MAAM7C,SAASO,MAAMC,IAAI,CAAC/B,QAAQuB,MAAM,CAAC+C,MAAM;QAC/C/C,OAAOJ,OAAO,CAAC,CAACG,QAAQ;YACpB,MAAM,EAAEiD,SAAQ,EAAG,GAAGjD;YACtB+C,SAASG,GAAG,CAACD,aAAaF,SAASI,GAAG,CAACF,UAAU,EAAE;YACnD,IAAIA,SAASG,UAAU,CAAC,WAAW;gBAC/BL,SAAS7C,GAAG,CAAC+C,UAAUI,IAAI,CAACrD;YAChC,OAAO;gBACH+C,SAAS7C,GAAG,CAAC+C,UAAUK,OAAO,CAACtD;YACnC,CAAC;QACL;QACA,OAAO+C;IACX,CAAA;IACA,OAAO;QACHQ,gBAAgB7E,QAAQ6E,cAAc;QACtCV;QACAlD;QACAU;QACAd;IACJ;AACJ"}
1
+ {"version":3,"sources":["useToaster.js"],"sourcesContent":["import * as React from 'react';\nimport { isHTMLElement, useEventCallback, useForceUpdate } from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { createToaster } from './vanilla';\nimport { EVENTS } from './constants';\nexport function useToaster(options = {}) {\n const forceUpdate = useForceUpdate();\n const { toasterId: userToasterId , shortcuts } = options;\n // Currently the toaster options can never be changed at runtime\n const [toaster] = React.useState(()=>createToaster(options));\n const { targetDocument } = useFluent();\n const lastActiveElementRef = React.useRef(null);\n const isCorrectToaster = useEventCallback((toasterId)=>{\n return toasterId === userToasterId;\n });\n const isFocusShortcut = useEventCallback((e)=>{\n if (shortcuts === null || shortcuts === void 0 ? void 0 : shortcuts.focus) {\n return shortcuts.focus(e);\n }\n });\n const pauseAllToasts = React.useCallback(()=>{\n toaster.visibleToasts.forEach((toastId)=>{\n var _toast_imperativeRef_current;\n const toast = toaster.toasts.get(toastId);\n (_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();\n });\n }, [\n toaster\n ]);\n const playAllToasts = React.useCallback(()=>{\n toaster.visibleToasts.forEach((toastId)=>{\n var _toast_imperativeRef_current;\n const toast = toaster.toasts.get(toastId);\n (_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();\n });\n }, [\n toaster\n ]);\n const getMostRecentVisibleToast = React.useCallback(()=>{\n return Array.from(toaster.visibleToasts).reduce((cur, next)=>{\n const toast = toaster.toasts.get(next);\n if (!toast) {\n return cur;\n }\n if (!cur) {\n return toast;\n }\n if (cur.order < (toast === null || toast === void 0 ? void 0 : toast.order)) {\n return toast;\n }\n return cur;\n }, undefined);\n }, [\n toaster\n ]);\n const tryRestoreFocus = React.useCallback(()=>{\n const mostRecentToast = getMostRecentVisibleToast();\n if (mostRecentToast === null || mostRecentToast === void 0 ? void 0 : mostRecentToast.imperativeRef.current) {\n mostRecentToast.imperativeRef.current.focus();\n } else {\n var _lastActiveElementRef_current;\n (_lastActiveElementRef_current = lastActiveElementRef.current) === null || _lastActiveElementRef_current === void 0 ? void 0 : _lastActiveElementRef_current.focus();\n lastActiveElementRef.current = null;\n }\n }, [\n getMostRecentVisibleToast\n ]);\n const closeAllToasts = React.useCallback(()=>{\n toaster.visibleToasts.forEach((toastId)=>{\n const toast = toaster.toasts.get(toastId);\n toast === null || toast === void 0 ? void 0 : toast.close();\n });\n tryRestoreFocus();\n }, [\n toaster,\n tryRestoreFocus\n ]);\n React.useEffect(()=>{\n if (!targetDocument) {\n return;\n }\n const addToastListener = (eventType, callback)=>{\n const listener = (e)=>{\n if (!isCorrectToaster(e.detail.toasterId)) {\n return;\n }\n callback(e);\n forceUpdate();\n };\n targetDocument.addEventListener(eventType, listener);\n return ()=>targetDocument.removeEventListener(eventType, listener);\n };\n const buildToast = (e)=>{\n toaster.buildToast(e.detail, forceUpdate);\n };\n const dismissToast = (e)=>{\n toaster.dismissToast(e.detail.toastId);\n };\n const updateToast = (e)=>{\n toaster.updateToast(e.detail);\n };\n const dismissAllToasts = (e)=>{\n toaster.dismissAllToasts();\n };\n const pauseToast = (e)=>{\n const toast = toaster.toasts.get(e.detail.toastId);\n if (toast) {\n var _toast_imperativeRef_current;\n (_toast_imperativeRef_current = toast.imperativeRef.current) === null || _toast_imperativeRef_current === void 0 ? void 0 : _toast_imperativeRef_current.pause();\n }\n };\n const playToast = (e)=>{\n const toast = toaster.toasts.get(e.detail.toastId);\n if (toast) {\n var _toast_imperativeRef_current;\n (_toast_imperativeRef_current = toast.imperativeRef.current) === null || _toast_imperativeRef_current === void 0 ? void 0 : _toast_imperativeRef_current.play();\n }\n };\n const cleanupBuildListener = addToastListener(EVENTS.show, buildToast);\n const cleanupUpdateListener = addToastListener(EVENTS.update, updateToast);\n const cleanupDismissListener = addToastListener(EVENTS.dismiss, dismissToast);\n const cleanupDismissAllListener = addToastListener(EVENTS.dismissAll, dismissAllToasts);\n const cleanupPauseListener = addToastListener(EVENTS.pause, pauseToast);\n const cleanupPlayListener = addToastListener(EVENTS.play, playToast);\n const focusShortcutListener = (e)=>{\n if (isFocusShortcut(e)) {\n pauseAllToasts();\n const mostRecentToast = getMostRecentVisibleToast();\n if (mostRecentToast) {\n var _mostRecentToast_imperativeRef_current;\n lastActiveElementRef.current = isHTMLElement(targetDocument.activeElement) ? targetDocument.activeElement : null;\n (_mostRecentToast_imperativeRef_current = mostRecentToast.imperativeRef.current) === null || _mostRecentToast_imperativeRef_current === void 0 ? void 0 : _mostRecentToast_imperativeRef_current.focus();\n }\n }\n };\n targetDocument.addEventListener('keydown', focusShortcutListener);\n return ()=>{\n cleanupBuildListener();\n cleanupDismissAllListener();\n cleanupUpdateListener();\n cleanupDismissListener();\n cleanupPauseListener();\n cleanupPlayListener();\n targetDocument.removeEventListener('keydown', focusShortcutListener);\n };\n }, [\n toaster,\n forceUpdate,\n targetDocument,\n isCorrectToaster,\n pauseAllToasts,\n getMostRecentVisibleToast,\n isFocusShortcut\n ]);\n const toastsToRender = (()=>{\n if (!toaster) {\n return new Map();\n }\n const toRender = new Map();\n const toasts = Array.from(toaster.toasts.values());\n toasts.forEach((toast)=>{\n const { position } = toast;\n toRender.has(position) || toRender.set(position, []);\n if (position.startsWith('bottom')) {\n toRender.get(position).push(toast);\n } else {\n toRender.get(position).unshift(toast);\n }\n });\n return toRender;\n })();\n return {\n isToastVisible: toaster.isToastVisible,\n toastsToRender,\n pauseAllToasts,\n playAllToasts,\n tryRestoreFocus,\n closeAllToasts\n };\n}\n"],"names":["useToaster","options","forceUpdate","useForceUpdate","toasterId","userToasterId","shortcuts","toaster","React","useState","createToaster","targetDocument","useFluent","lastActiveElementRef","useRef","isCorrectToaster","useEventCallback","isFocusShortcut","e","focus","pauseAllToasts","useCallback","visibleToasts","forEach","toastId","_toast_imperativeRef_current","toast","toasts","get","imperativeRef","current","pause","playAllToasts","play","getMostRecentVisibleToast","Array","from","reduce","cur","next","order","undefined","tryRestoreFocus","mostRecentToast","_lastActiveElementRef_current","closeAllToasts","close","useEffect","addToastListener","eventType","callback","listener","detail","addEventListener","removeEventListener","buildToast","dismissToast","updateToast","dismissAllToasts","pauseToast","playToast","cleanupBuildListener","EVENTS","show","cleanupUpdateListener","update","cleanupDismissListener","dismiss","cleanupDismissAllListener","dismissAll","cleanupPauseListener","cleanupPlayListener","focusShortcutListener","_mostRecentToast_imperativeRef_current","isHTMLElement","activeElement","toastsToRender","Map","toRender","values","position","has","set","startsWith","push","unshift","isToastVisible"],"mappings":";;;;+BAKgBA;;aAAAA;;;6DALO;gCACyC;qCAChB;yBAClB;2BACP;AAChB,SAASA,WAAWC,UAAU,CAAC,CAAC,EAAE;IACrC,MAAMC,cAAcC,IAAAA,8BAAc;IAClC,MAAM,EAAEC,W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,OAAO,CAAC,CAACG,QAAQ;YACpB,MAAM,EAAEsD,SAAQ,EAAG,GAAGtD;YACtBoD,SAASG,GAAG,CAACD,aAAaF,SAASI,GAAG,CAACF,UAAU,EAAE;YACnD,IAAIA,SAASG,UAAU,CAAC,WAAW;gBAC/BL,SAASlD,GAAG,CAACoD,UAAUI,IAAI,CAAC1D;YAChC,OAAO;gBACHoD,SAASlD,GAAG,CAACoD,UAAUK,OAAO,CAAC3D;YACnC,CAAC;QACL;QACA,OAAOoD;IACX,CAAA;IACA,OAAO;QACHQ,gBAAgB/E,QAAQ+E,cAAc;QACtCV;QACAxD;QACAY;QACAU;QACAG;IACJ;AACJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-toast",
3
- "version": "9.0.6",
3
+ "version": "9.1.1",
4
4
  "description": "Toast component for Fluent UI",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -36,15 +36,16 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "react-transition-group": "^4.4.1",
39
- "@fluentui/react-aria": "^9.3.27",
39
+ "@fluentui/keyboard-keys": "^9.0.3",
40
+ "@fluentui/react-aria": "^9.3.29",
40
41
  "@fluentui/react-icons": "^2.0.207",
41
- "@fluentui/react-jsx-runtime": "9.0.0-alpha.12",
42
- "@fluentui/react-portal": "^9.3.4",
43
- "@fluentui/react-shared-contexts": "^9.7.0",
44
- "@fluentui/react-tabster": "^9.11.1",
45
- "@fluentui/react-theme": "^9.1.9",
46
- "@fluentui/react-utilities": "^9.10.1",
47
- "@griffel/react": "^1.5.7",
42
+ "@fluentui/react-jsx-runtime": "9.0.0-alpha.14",
43
+ "@fluentui/react-portal": "^9.3.6",
44
+ "@fluentui/react-shared-contexts": "^9.7.2",
45
+ "@fluentui/react-tabster": "^9.12.1",
46
+ "@fluentui/react-theme": "^9.1.11",
47
+ "@fluentui/react-utilities": "^9.11.0",
48
+ "@griffel/react": "^1.5.14",
48
49
  "@swc/helpers": "^0.4.14"
49
50
  },
50
51
  "peerDependencies": {