@fluentui/react-toast 9.6.3 → 9.6.4

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.
package/CHANGELOG.md CHANGED
@@ -1,12 +1,28 @@
1
1
  # Change Log - @fluentui/react-toast
2
2
 
3
- This log was last generated on Wed, 30 Jul 2025 16:53:00 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 07 Aug 2025 09:59:10 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.6.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-toast_v9.6.4)
8
+
9
+ Thu, 07 Aug 2025 09:59:10 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-toast_v9.6.3..@fluentui/react-toast_v9.6.4)
11
+
12
+ ### Patches
13
+
14
+ - fix: Toaster should merge user onKeyDown handler ([PR #34982](https://github.com/microsoft/fluentui/pull/34982) by lingfangao@hotmail.com)
15
+ - Bump @fluentui/react-aria to v9.16.3 ([PR #34980](https://github.com/microsoft/fluentui/pull/34980) by beachball)
16
+ - Bump @fluentui/react-jsx-runtime to v9.1.5 ([PR #34980](https://github.com/microsoft/fluentui/pull/34980) by beachball)
17
+ - Bump @fluentui/react-motion to v9.10.2 ([PR #34980](https://github.com/microsoft/fluentui/pull/34980) by beachball)
18
+ - Bump @fluentui/react-motion-components-preview to v0.8.2 ([PR #34980](https://github.com/microsoft/fluentui/pull/34980) by beachball)
19
+ - Bump @fluentui/react-portal to v9.8.0 ([PR #34980](https://github.com/microsoft/fluentui/pull/34980) by beachball)
20
+ - Bump @fluentui/react-tabster to v9.26.3 ([PR #34980](https://github.com/microsoft/fluentui/pull/34980) by beachball)
21
+ - Bump @fluentui/react-utilities to v9.23.2 ([PR #34980](https://github.com/microsoft/fluentui/pull/34980) by beachball)
22
+
7
23
  ## [9.6.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-toast_v9.6.3)
8
24
 
9
- Wed, 30 Jul 2025 16:53:00 GMT
25
+ Wed, 30 Jul 2025 16:55:39 GMT
10
26
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-toast_v9.6.2..@fluentui/react-toast_v9.6.3)
11
27
 
12
28
  ### Patches
@@ -18,7 +18,7 @@ import { useToastAnnounce } from './useToastAnnounce';
18
18
  const { toastsToRender, isToastVisible, pauseAllToasts, playAllToasts, tryRestoreFocus, closeAllToasts } = useToaster(rest);
19
19
  const announce = React.useCallback((message, options)=>announceRef.current(message, options), []);
20
20
  const { dir } = useFluent();
21
- const rootProps = slot.always(getIntrinsicElementProps('div', rest), {
21
+ const { onKeyDown: onKeyDownProp, ...rootProps } = slot.always(getIntrinsicElementProps('div', rest), {
22
22
  elementType: 'div'
23
23
  });
24
24
  const focusableGroupAttr = useFocusableGroup({
@@ -28,12 +28,11 @@ import { useToastAnnounce } from './useToastAnnounce';
28
28
  }
29
29
  });
30
30
  const onKeyDown = useEventCallback((e)=>{
31
- var _props_onKeyDown;
32
31
  if (e.key === Escape) {
33
32
  e.preventDefault();
34
33
  closeAllToasts();
35
34
  }
36
- (_props_onKeyDown = props.onKeyDown) === null || _props_onKeyDown === void 0 ? void 0 : _props_onKeyDown.call(props, e);
35
+ onKeyDownProp === null || onKeyDownProp === void 0 ? void 0 : onKeyDownProp(e);
37
36
  });
38
37
  const usePositionSlot = (toastPosition)=>{
39
38
  var _toastsToRender_get;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Toaster/useToaster.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n ExtractSlotProps,\n Slot,\n getIntrinsicElementProps,\n useEventCallback,\n useMergedRefs,\n slot,\n} from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useFocusableGroup } from '@fluentui/react-tabster';\nimport { Escape } from '@fluentui/keyboard-keys';\nimport type { ToasterProps, ToasterState } from './Toaster.types';\nimport { TOAST_POSITIONS, ToastPosition, useToaster } from '../../state';\nimport { Announce } from '../AriaLive';\nimport { ToastContainer } from '../ToastContainer';\nimport { useToasterFocusManagement_unstable } from './useToasterFocusManagement';\nimport { useToastAnnounce } from './useToastAnnounce';\n\n/**\n * Create the state required to render Toaster.\n *\n * @param props - props from this instance of Toaster\n */\nexport const useToaster_unstable = (props: ToasterProps): ToasterState => {\n 'use no memo';\n\n const { offset, announce: announceProp, mountNode, inline = false, ...rest } = props;\n const announceRef = React.useRef<Announce>(() => null);\n const { toastsToRender, isToastVisible, pauseAllToasts, playAllToasts, tryRestoreFocus, closeAllToasts } =\n useToaster<HTMLDivElement>(rest);\n const announce = React.useCallback<Announce>((message, options) => announceRef.current(message, options), []);\n const { dir } = useFluent();\n\n const rootProps = slot.always(getIntrinsicElementProps<ExtractSlotProps<Slot<'div'>>>('div', rest), {\n elementType: 'div',\n });\n const focusableGroupAttr = useFocusableGroup({\n tabBehavior: 'limited-trap-focus',\n ignoreDefaultKeydown: { Escape: true },\n });\n const onKeyDown = useEventCallback((e: React.KeyboardEvent<HTMLDivElement>) => {\n if (e.key === Escape) {\n e.preventDefault();\n closeAllToasts();\n }\n props.onKeyDown?.(e);\n });\n const usePositionSlot = (toastPosition: ToastPosition) => {\n const focusManagementRef = useToasterFocusManagement_unstable(pauseAllToasts, playAllToasts);\n const { announceToast, toasterRef } = useToastAnnounce(announceProp ?? announce);\n return slot.optional<ExtractSlotProps<Slot<'div'>>>(toastsToRender.has(toastPosition) ? rootProps : null, {\n defaultProps: {\n ref: useMergedRefs(focusManagementRef, toasterRef),\n children: toastsToRender.get(toastPosition)?.map(toast => (\n <ToastContainer\n {...toast}\n tryRestoreFocus={tryRestoreFocus}\n intent={toast.intent}\n announce={announceToast}\n key={toast.toastId}\n visible={isToastVisible(toast.toastId)}\n >\n {toast.content as React.ReactNode}\n </ToastContainer>\n )),\n onKeyDown,\n ...focusableGroupAttr,\n 'data-toaster-position': toastPosition,\n role: 'list',\n // Explicitly casting because our slot types can't handle data attributes\n } as ExtractSlotProps<Slot<'div'>>,\n elementType: 'div',\n });\n };\n\n return {\n dir,\n mountNode,\n components: {\n root: 'div',\n bottomStart: 'div',\n bottomEnd: 'div',\n topStart: 'div',\n topEnd: 'div',\n top: 'div',\n bottom: 'div',\n },\n root: slot.always(rootProps, { elementType: 'div' }),\n bottomStart: usePositionSlot(TOAST_POSITIONS.bottomStart),\n bottomEnd: usePositionSlot(TOAST_POSITIONS.bottomEnd),\n topStart: usePositionSlot(TOAST_POSITIONS.topStart),\n topEnd: usePositionSlot(TOAST_POSITIONS.topEnd),\n top: usePositionSlot(TOAST_POSITIONS.top),\n bottom: usePositionSlot(TOAST_POSITIONS.bottom),\n announceRef,\n offset,\n announce: announceProp ?? announce,\n renderAriaLive: !announceProp,\n inline,\n };\n};\n"],"names":["React","getIntrinsicElementProps","useEventCallback","useMergedRefs","slot","useFluent_unstable","useFluent","useFocusableGroup","Escape","TOAST_POSITIONS","useToaster","ToastContainer","useToasterFocusManagement_unstable","useToastAnnounce","useToaster_unstable","props","offset","announce","announceProp","mountNode","inline","rest","announceRef","useRef","toastsToRender","isToastVisible","pauseAllToasts","playAllToasts","tryRestoreFocus","closeAllToasts","useCallback","message","options","current","dir","rootProps","always","elementType","focusableGroupAttr","tabBehavior","ignoreDefaultKeydown","onKeyDown","e","key","preventDefault","usePositionSlot","toastPosition","focusManagementRef","announceToast","toasterRef","optional","has","defaultProps","ref","children","get","map","toast","intent","toastId","visible","content","role","components","root","bottomStart","bottomEnd","topStart","topEnd","top","bottom","renderAriaLive"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAGEC,wBAAwB,EACxBC,gBAAgB,EAChBC,aAAa,EACbC,IAAI,QACC,4BAA4B;AACnC,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAClF,SAASC,iBAAiB,QAAQ,0BAA0B;AAC5D,SAASC,MAAM,QAAQ,0BAA0B;AAEjD,SAASC,eAAe,EAAiBC,UAAU,QAAQ,cAAc;AAEzE,SAASC,cAAc,QAAQ,o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B,sBAAAA,eAAe+B,GAAG,CAACT,4BAAnBtB,0CAAAA,oBAAmCgC,GAAG,CAACC,CAAAA,sBAC/C,oBAAC9C;wBACE,GAAG8C,KAAK;wBACT7B,iBAAiBA;wBACjB8B,QAAQD,MAAMC,MAAM;wBACpBzC,UAAU+B;wBACVL,KAAKc,MAAME,OAAO;wBAClBC,SAASnC,eAAegC,MAAME,OAAO;uBAEpCF,MAAMI,OAAO;gBAGlBpB;gBACA,GAAGH,kBAAkB;gBACrB,yBAAyBQ;gBACzBgB,MAAM;YAER;YACAzB,aAAa;QACf;IACF;IAEA,OAAO;QACLH;QACAf;QACA4C,YAAY;YACVC,MAAM;YACNC,aAAa;YACbC,WAAW;YACXC,UAAU;YACVC,QAAQ;YACRC,KAAK;YACLC,QAAQ;QACV;QACAN,MAAM5D,KAAKgC,MAAM,CAACD,WAAW;YAAEE,aAAa;QAAM;QAClD4B,aAAapB,gBAAgBpC,gBAAgBwD,WAAW;QACxDC,WAAWrB,gBAAgBpC,gBAAgByD,SAAS;QACpDC,UAAUtB,gBAAgBpC,gBAAgB0D,QAAQ;QAClDC,QAAQvB,gBAAgBpC,gBAAgB2D,MAAM;QAC9CC,KAAKxB,gBAAgBpC,gBAAgB4D,GAAG;QACxCC,QAAQzB,gBAAgBpC,gBAAgB6D,MAAM;QAC9ChD;QACAN;QACAC,UAAUC,yBAAAA,0BAAAA,eAAgBD;QAC1BsD,gBAAgB,CAACrD;QACjBE;IACF;AACF,EAAE"}
1
+ {"version":3,"sources":["../src/components/Toaster/useToaster.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n ExtractSlotProps,\n Slot,\n getIntrinsicElementProps,\n useEventCallback,\n useMergedRefs,\n slot,\n} from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useFocusableGroup } from '@fluentui/react-tabster';\nimport { Escape } from '@fluentui/keyboard-keys';\nimport type { ToasterProps, ToasterState } from './Toaster.types';\nimport { TOAST_POSITIONS, ToastPosition, useToaster } from '../../state';\nimport { Announce } from '../AriaLive';\nimport { ToastContainer } from '../ToastContainer';\nimport { useToasterFocusManagement_unstable } from './useToasterFocusManagement';\nimport { useToastAnnounce } from './useToastAnnounce';\n\n/**\n * Create the state required to render Toaster.\n *\n * @param props - props from this instance of Toaster\n */\nexport const useToaster_unstable = (props: ToasterProps): ToasterState => {\n 'use no memo';\n\n const { offset, announce: announceProp, mountNode, inline = false, ...rest } = props;\n const announceRef = React.useRef<Announce>(() => null);\n const { toastsToRender, isToastVisible, pauseAllToasts, playAllToasts, tryRestoreFocus, closeAllToasts } =\n useToaster<HTMLDivElement>(rest);\n const announce = React.useCallback<Announce>((message, options) => announceRef.current(message, options), []);\n const { dir } = useFluent();\n\n const { onKeyDown: onKeyDownProp, ...rootProps } = slot.always(\n getIntrinsicElementProps<ExtractSlotProps<Slot<'div'>>>('div', rest),\n {\n elementType: 'div',\n },\n );\n const focusableGroupAttr = useFocusableGroup({\n tabBehavior: 'limited-trap-focus',\n ignoreDefaultKeydown: { Escape: true },\n });\n const onKeyDown = useEventCallback((e: React.KeyboardEvent<HTMLDivElement>) => {\n if (e.key === Escape) {\n e.preventDefault();\n closeAllToasts();\n }\n onKeyDownProp?.(e);\n });\n const usePositionSlot = (toastPosition: ToastPosition) => {\n const focusManagementRef = useToasterFocusManagement_unstable(pauseAllToasts, playAllToasts);\n const { announceToast, toasterRef } = useToastAnnounce(announceProp ?? announce);\n return slot.optional<ExtractSlotProps<Slot<'div'>>>(toastsToRender.has(toastPosition) ? rootProps : null, {\n defaultProps: {\n ref: useMergedRefs(focusManagementRef, toasterRef),\n children: toastsToRender.get(toastPosition)?.map(toast => (\n <ToastContainer\n {...toast}\n tryRestoreFocus={tryRestoreFocus}\n intent={toast.intent}\n announce={announceToast}\n key={toast.toastId}\n visible={isToastVisible(toast.toastId)}\n >\n {toast.content as React.ReactNode}\n </ToastContainer>\n )),\n onKeyDown,\n ...focusableGroupAttr,\n 'data-toaster-position': toastPosition,\n role: 'list',\n // Explicitly casting because our slot types can't handle data attributes\n } as ExtractSlotProps<Slot<'div'>>,\n elementType: 'div',\n });\n };\n\n return {\n dir,\n mountNode,\n components: {\n root: 'div',\n bottomStart: 'div',\n bottomEnd: 'div',\n topStart: 'div',\n topEnd: 'div',\n top: 'div',\n bottom: 'div',\n },\n root: slot.always(rootProps, { elementType: 'div' }),\n bottomStart: usePositionSlot(TOAST_POSITIONS.bottomStart),\n bottomEnd: usePositionSlot(TOAST_POSITIONS.bottomEnd),\n topStart: usePositionSlot(TOAST_POSITIONS.topStart),\n topEnd: usePositionSlot(TOAST_POSITIONS.topEnd),\n top: usePositionSlot(TOAST_POSITIONS.top),\n bottom: usePositionSlot(TOAST_POSITIONS.bottom),\n announceRef,\n offset,\n announce: announceProp ?? announce,\n renderAriaLive: !announceProp,\n inline,\n };\n};\n"],"names":["React","getIntrinsicElementProps","useEventCallback","useMergedRefs","slot","useFluent_unstable","useFluent","useFocusableGroup","Escape","TOAST_POSITIONS","useToaster","ToastContainer","useToasterFocusManagement_unstable","useToastAnnounce","useToaster_unstable","props","offset","announce","announceProp","mountNode","inline","rest","announceRef","useRef","toastsToRender","isToastVisible","pauseAllToasts","playAllToasts","tryRestoreFocus","closeAllToasts","useCallback","message","options","current","dir","onKeyDown","onKeyDownProp","rootProps","always","elementType","focusableGroupAttr","tabBehavior","ignoreDefaultKeydown","e","key","preventDefault","usePositionSlot","toastPosition","focusManagementRef","announceToast","toasterRef","optional","has","defaultProps","ref","children","get","map","toast","intent","toastId","visible","content","role","components","root","bottomStart","bottomEnd","topStart","topEnd","top","bottom","renderAriaLive"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAGEC,wBAAwB,EACxBC,gBAAgB,EAChBC,aAAa,EACbC,IAAI,QACC,4BAA4B;AACnC,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAClF,SAASC,iBAAiB,QAAQ,0BAA0B;AAC5D,SAASC,MAAM,QAAQ,0BAA0B;A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M;YACxGgB,cAAc;gBACZC,KAAKnD,cAAc6C,oBAAoBE;gBACvCK,QAAQ,GAAE/B,sBAAAA,eAAegC,GAAG,CAACT,4BAAnBvB,0CAAAA,oBAAmCiC,GAAG,CAACC,CAAAA,sBAC/C,oBAAC/C;wBACE,GAAG+C,KAAK;wBACT9B,iBAAiBA;wBACjB+B,QAAQD,MAAMC,MAAM;wBACpB1C,UAAUgC;wBACVL,KAAKc,MAAME,OAAO;wBAClBC,SAASpC,eAAeiC,MAAME,OAAO;uBAEpCF,MAAMI,OAAO;gBAGlB3B;gBACA,GAAGK,kBAAkB;gBACrB,yBAAyBO;gBACzBgB,MAAM;YAER;YACAxB,aAAa;QACf;IACF;IAEA,OAAO;QACLL;QACAf;QACA6C,YAAY;YACVC,MAAM;YACNC,aAAa;YACbC,WAAW;YACXC,UAAU;YACVC,QAAQ;YACRC,KAAK;YACLC,QAAQ;QACV;QACAN,MAAM7D,KAAKkC,MAAM,CAACD,WAAW;YAAEE,aAAa;QAAM;QAClD2B,aAAapB,gBAAgBrC,gBAAgByD,WAAW;QACxDC,WAAWrB,gBAAgBrC,gBAAgB0D,SAAS;QACpDC,UAAUtB,gBAAgBrC,gBAAgB2D,QAAQ;QAClDC,QAAQvB,gBAAgBrC,gBAAgB4D,MAAM;QAC9CC,KAAKxB,gBAAgBrC,gBAAgB6D,GAAG;QACxCC,QAAQzB,gBAAgBrC,gBAAgB8D,MAAM;QAC9CjD;QACAN;QACAC,UAAUC,yBAAAA,0BAAAA,eAAgBD;QAC1BuD,gBAAgB,CAACtD;QACjBE;IACF;AACF,EAAE"}
@@ -25,7 +25,7 @@ const useToaster_unstable = (props)=>{
25
25
  const { toastsToRender, isToastVisible, pauseAllToasts, playAllToasts, tryRestoreFocus, closeAllToasts } = (0, _state.useToaster)(rest);
26
26
  const announce = _react.useCallback((message, options)=>announceRef.current(message, options), []);
27
27
  const { dir } = (0, _reactsharedcontexts.useFluent_unstable)();
28
- const rootProps = _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)('div', rest), {
28
+ const { onKeyDown: onKeyDownProp, ...rootProps } = _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)('div', rest), {
29
29
  elementType: 'div'
30
30
  });
31
31
  const focusableGroupAttr = (0, _reacttabster.useFocusableGroup)({
@@ -35,12 +35,11 @@ const useToaster_unstable = (props)=>{
35
35
  }
36
36
  });
37
37
  const onKeyDown = (0, _reactutilities.useEventCallback)((e)=>{
38
- var _props_onKeyDown;
39
38
  if (e.key === _keyboardkeys.Escape) {
40
39
  e.preventDefault();
41
40
  closeAllToasts();
42
41
  }
43
- (_props_onKeyDown = props.onKeyDown) === null || _props_onKeyDown === void 0 ? void 0 : _props_onKeyDown.call(props, e);
42
+ onKeyDownProp === null || onKeyDownProp === void 0 ? void 0 : onKeyDownProp(e);
44
43
  });
45
44
  const usePositionSlot = (toastPosition)=>{
46
45
  var _toastsToRender_get;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Toaster/useToaster.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n ExtractSlotProps,\n Slot,\n getIntrinsicElementProps,\n useEventCallback,\n useMergedRefs,\n slot,\n} from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useFocusableGroup } from '@fluentui/react-tabster';\nimport { Escape } from '@fluentui/keyboard-keys';\nimport type { ToasterProps, ToasterState } from './Toaster.types';\nimport { TOAST_POSITIONS, ToastPosition, useToaster } from '../../state';\nimport { Announce } from '../AriaLive';\nimport { ToastContainer } from '../ToastContainer';\nimport { useToasterFocusManagement_unstable } from './useToasterFocusManagement';\nimport { useToastAnnounce } from './useToastAnnounce';\n\n/**\n * Create the state required to render Toaster.\n *\n * @param props - props from this instance of Toaster\n */\nexport const useToaster_unstable = (props: ToasterProps): ToasterState => {\n 'use no memo';\n\n const { offset, announce: announceProp, mountNode, inline = false, ...rest } = props;\n const announceRef = React.useRef<Announce>(() => null);\n const { toastsToRender, isToastVisible, pauseAllToasts, playAllToasts, tryRestoreFocus, closeAllToasts } =\n useToaster<HTMLDivElement>(rest);\n const announce = React.useCallback<Announce>((message, options) => announceRef.current(message, options), []);\n const { dir } = useFluent();\n\n const rootProps = slot.always(getIntrinsicElementProps<ExtractSlotProps<Slot<'div'>>>('div', rest), {\n elementType: 'div',\n });\n const focusableGroupAttr = useFocusableGroup({\n tabBehavior: 'limited-trap-focus',\n ignoreDefaultKeydown: { Escape: true },\n });\n const onKeyDown = useEventCallback((e: React.KeyboardEvent<HTMLDivElement>) => {\n if (e.key === Escape) {\n e.preventDefault();\n closeAllToasts();\n }\n props.onKeyDown?.(e);\n });\n const usePositionSlot = (toastPosition: ToastPosition) => {\n const focusManagementRef = useToasterFocusManagement_unstable(pauseAllToasts, playAllToasts);\n const { announceToast, toasterRef } = useToastAnnounce(announceProp ?? announce);\n return slot.optional<ExtractSlotProps<Slot<'div'>>>(toastsToRender.has(toastPosition) ? rootProps : null, {\n defaultProps: {\n ref: useMergedRefs(focusManagementRef, toasterRef),\n children: toastsToRender.get(toastPosition)?.map(toast => (\n <ToastContainer\n {...toast}\n tryRestoreFocus={tryRestoreFocus}\n intent={toast.intent}\n announce={announceToast}\n key={toast.toastId}\n visible={isToastVisible(toast.toastId)}\n >\n {toast.content as React.ReactNode}\n </ToastContainer>\n )),\n onKeyDown,\n ...focusableGroupAttr,\n 'data-toaster-position': toastPosition,\n role: 'list',\n // Explicitly casting because our slot types can't handle data attributes\n } as ExtractSlotProps<Slot<'div'>>,\n elementType: 'div',\n });\n };\n\n return {\n dir,\n mountNode,\n components: {\n root: 'div',\n bottomStart: 'div',\n bottomEnd: 'div',\n topStart: 'div',\n topEnd: 'div',\n top: 'div',\n bottom: 'div',\n },\n root: slot.always(rootProps, { elementType: 'div' }),\n bottomStart: usePositionSlot(TOAST_POSITIONS.bottomStart),\n bottomEnd: usePositionSlot(TOAST_POSITIONS.bottomEnd),\n topStart: usePositionSlot(TOAST_POSITIONS.topStart),\n topEnd: usePositionSlot(TOAST_POSITIONS.topEnd),\n top: usePositionSlot(TOAST_POSITIONS.top),\n bottom: usePositionSlot(TOAST_POSITIONS.bottom),\n announceRef,\n offset,\n announce: announceProp ?? announce,\n renderAriaLive: !announceProp,\n inline,\n };\n};\n"],"names":["React","getIntrinsicElementProps","useEventCallback","useMergedRefs","slot","useFluent_unstable","useFluent","useFocusableGroup","Escape","TOAST_POSITIONS","useToaster","ToastContainer","useToasterFocusManagement_unstable","useToastAnnounce","useToaster_unstable","props","offset","announce","announceProp","mountNode","inline","rest","announceRef","useRef","toastsToRender","isToastVisible","pauseAllToasts","playAllToasts","tryRestoreFocus","closeAllToasts","useCallback","message","options","current","dir","rootProps","always","elementType","focusableGroupAttr","tabBehavior","ignoreDefaultKeydown","onKeyDown","e","key","preventDefault","usePositionSlot","toastPosition","focusManagementRef","announceToast","toasterRef","optional","has","defaultProps","ref","children","get","map","toast","intent","toastId","visible","content","role","components","root","bottomStart","bottomEnd","topStart","topEnd","top","bottom","renderAriaLive"],"mappings":";;;;+BAwBac;;;;;;;iEAxBU,QAAQ;gCAQxB,4BAA4B;qCACa,kCAAkC;8BAChD,0BAA0B;8BACrC,0BAA0B;uBAEU,cAAc;gCAE1C,oBAAoB;2CACA,8BAA8B;kCAChD,qBAAqB;AAO/C,4BAA4B,CAACC;IAClC;IAEA,MAAM,EAAEC,MAAM,EAAEC,UAAUC,YAAY,EAAEC,SAAS,EAAEC,SAAS,KAAK,EAAE,GAAGC,MAAM,GAAGN;IAC/E,MAAMO,cAActB,OAAMuB,MAAM,CAAW,IAAM;IACjD,MAAM,EAAEC,cAAc,EAAEC,cAAc,EAAEC,cAAc,EAAEC,aAAa,EAAEC,eAAe,EAAEC,cAAc,EAAE,OACtGnB,iBAAAA,EAA2BW;IAC7B,MAAMJ,WAAWjB,OAAM8B,WAAW,CAAW,CAACC,SAASC,UAAYV,YAAYW,OAAO,CAACF,SAASC,UAAU,EAAE;IAC5G,MAAM,EAAEE,GAAG,EAAE,OA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,kBAAkB;gBACrB,yBAAyBQ;gBACzBgB,MAAM;YAER;YACAzB,aAAa;QACf;IACF;IAEA,OAAO;QACLH;QACAf;QACA4C,YAAY;YACVC,MAAM;YACNC,aAAa;YACbC,WAAW;YACXC,UAAU;YACVC,QAAQ;YACRC,KAAK;YACLC,QAAQ;QACV;QACAN,MAAM5D,oBAAAA,CAAKgC,MAAM,CAACD,WAAW;YAAEE,aAAa;QAAM;QAClD4B,aAAapB,gBAAgBpC,sBAAAA,CAAgBwD,WAAW;QACxDC,WAAWrB,gBAAgBpC,sBAAAA,CAAgByD,SAAS;QACpDC,UAAUtB,gBAAgBpC,sBAAAA,CAAgB0D,QAAQ;QAClDC,QAAQvB,gBAAgBpC,sBAAAA,CAAgB2D,MAAM;QAC9CC,KAAKxB,gBAAgBpC,sBAAAA,CAAgB4D,GAAG;QACxCC,QAAQzB,gBAAgBpC,sBAAAA,CAAgB6D,MAAM;QAC9ChD;QACAN;QACAC,UAAUC,iBAAAA,QAAAA,iBAAAA,KAAAA,IAAAA,eAAgBD;QAC1BsD,gBAAgB,CAACrD;QACjBE;IACF;AACF,EAAE"}
1
+ {"version":3,"sources":["../src/components/Toaster/useToaster.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n ExtractSlotProps,\n Slot,\n getIntrinsicElementProps,\n useEventCallback,\n useMergedRefs,\n slot,\n} from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useFocusableGroup } from '@fluentui/react-tabster';\nimport { Escape } from '@fluentui/keyboard-keys';\nimport type { ToasterProps, ToasterState } from './Toaster.types';\nimport { TOAST_POSITIONS, ToastPosition, useToaster } from '../../state';\nimport { Announce } from '../AriaLive';\nimport { ToastContainer } from '../ToastContainer';\nimport { useToasterFocusManagement_unstable } from './useToasterFocusManagement';\nimport { useToastAnnounce } from './useToastAnnounce';\n\n/**\n * Create the state required to render Toaster.\n *\n * @param props - props from this instance of Toaster\n */\nexport const useToaster_unstable = (props: ToasterProps): ToasterState => {\n 'use no memo';\n\n const { offset, announce: announceProp, mountNode, inline = false, ...rest } = props;\n const announceRef = React.useRef<Announce>(() => null);\n const { toastsToRender, isToastVisible, pauseAllToasts, playAllToasts, tryRestoreFocus, closeAllToasts } =\n useToaster<HTMLDivElement>(rest);\n const announce = React.useCallback<Announce>((message, options) => announceRef.current(message, options), []);\n const { dir } = useFluent();\n\n const { onKeyDown: onKeyDownProp, ...rootProps } = slot.always(\n getIntrinsicElementProps<ExtractSlotProps<Slot<'div'>>>('div', rest),\n {\n elementType: 'div',\n },\n );\n const focusableGroupAttr = useFocusableGroup({\n tabBehavior: 'limited-trap-focus',\n ignoreDefaultKeydown: { Escape: true },\n });\n const onKeyDown = useEventCallback((e: React.KeyboardEvent<HTMLDivElement>) => {\n if (e.key === Escape) {\n e.preventDefault();\n closeAllToasts();\n }\n onKeyDownProp?.(e);\n });\n const usePositionSlot = (toastPosition: ToastPosition) => {\n const focusManagementRef = useToasterFocusManagement_unstable(pauseAllToasts, playAllToasts);\n const { announceToast, toasterRef } = useToastAnnounce(announceProp ?? announce);\n return slot.optional<ExtractSlotProps<Slot<'div'>>>(toastsToRender.has(toastPosition) ? rootProps : null, {\n defaultProps: {\n ref: useMergedRefs(focusManagementRef, toasterRef),\n children: toastsToRender.get(toastPosition)?.map(toast => (\n <ToastContainer\n {...toast}\n tryRestoreFocus={tryRestoreFocus}\n intent={toast.intent}\n announce={announceToast}\n key={toast.toastId}\n visible={isToastVisible(toast.toastId)}\n >\n {toast.content as React.ReactNode}\n </ToastContainer>\n )),\n onKeyDown,\n ...focusableGroupAttr,\n 'data-toaster-position': toastPosition,\n role: 'list',\n // Explicitly casting because our slot types can't handle data attributes\n } as ExtractSlotProps<Slot<'div'>>,\n elementType: 'div',\n });\n };\n\n return {\n dir,\n mountNode,\n components: {\n root: 'div',\n bottomStart: 'div',\n bottomEnd: 'div',\n topStart: 'div',\n topEnd: 'div',\n top: 'div',\n bottom: 'div',\n },\n root: slot.always(rootProps, { elementType: 'div' }),\n bottomStart: usePositionSlot(TOAST_POSITIONS.bottomStart),\n bottomEnd: usePositionSlot(TOAST_POSITIONS.bottomEnd),\n topStart: usePositionSlot(TOAST_POSITIONS.topStart),\n topEnd: usePositionSlot(TOAST_POSITIONS.topEnd),\n top: usePositionSlot(TOAST_POSITIONS.top),\n bottom: usePositionSlot(TOAST_POSITIONS.bottom),\n announceRef,\n offset,\n announce: announceProp ?? announce,\n renderAriaLive: !announceProp,\n inline,\n };\n};\n"],"names":["React","getIntrinsicElementProps","useEventCallback","useMergedRefs","slot","useFluent_unstable","useFluent","useFocusableGroup","Escape","TOAST_POSITIONS","useToaster","ToastContainer","useToasterFocusManagement_unstable","useToastAnnounce","useToaster_unstable","props","offset","announce","announceProp","mountNode","inline","rest","announceRef","useRef","toastsToRender","isToastVisible","pauseAllToasts","playAllToasts","tryRestoreFocus","closeAllToasts","useCallback","message","options","current","dir","onKeyDown","onKeyDownProp","rootProps","always","elementType","focusableGroupAttr","tabBehavior","ignoreDefaultKeydown","e","key","preventDefault","usePositionSlot","toastPosition","focusManagementRef","announceToast","toasterRef","optional","has","defaultProps","ref","children","get","map","toast","intent","toastId","visible","content","role","components","root","bottomStart","bottomEnd","topStart","topEnd","top","bottom","renderAriaLive"],"mappings":";;;;+BAwBac;;;;;;;iEAxBU,QAAQ;gCAQxB,4BAA4B;qCACa,kCAAkC;8BAChD,0BAA0B;8BACrC,0BAA0B;uBAEU,cAAc;gCAE1C,oBAAoB;2CACA,8BAA8B;kCAChD,qBAAqB;AAO/C,4BAA4B,CAACC;IAClC;IAEA,MAAM,EAAEC,MAAM,EAAEC,UAAUC,YAAY,EAAEC,SAAS,EAAEC,SAAS,KAAK,EAAE,GAAGC,MAAM,GAAGN;IAC/E,MAAMO,cAActB,OAAMuB,MAAM,CAAW,IAAM;IACjD,MAAM,EAAEC,cAAc,EAAEC,cAAc,EAAEC,cAAc,EAAEC,aAAa,EAAEC,eAAe,EAAEC,cAAc,EAAE,OACt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AMC,MAAM;wBACpB1C,UAAUgC;wBACVL,KAAKc,MAAME,OAAO;wBAClBC,SAASpC,eAAeiC,MAAME,OAAO;uBAEpCF,MAAMI,OAAO;gBAGlB3B;gBACA,GAAGK,kBAAkB;gBACrB,yBAAyBO;gBACzBgB,MAAM;YAER;YACAxB,aAAa;QACf;IACF;IAEA,OAAO;QACLL;QACAf;QACA6C,YAAY;YACVC,MAAM;YACNC,aAAa;YACbC,WAAW;YACXC,UAAU;YACVC,QAAQ;YACRC,KAAK;YACLC,QAAQ;QACV;QACAN,MAAM7D,oBAAAA,CAAKkC,MAAM,CAACD,WAAW;YAAEE,aAAa;QAAM;QAClD2B,aAAapB,gBAAgBrC,sBAAAA,CAAgByD,WAAW;QACxDC,WAAWrB,gBAAgBrC,sBAAAA,CAAgB0D,SAAS;QACpDC,UAAUtB,gBAAgBrC,sBAAAA,CAAgB2D,QAAQ;QAClDC,QAAQvB,gBAAgBrC,sBAAAA,CAAgB4D,MAAM;QAC9CC,KAAKxB,gBAAgBrC,sBAAAA,CAAgB6D,GAAG;QACxCC,QAAQzB,gBAAgBrC,sBAAAA,CAAgB8D,MAAM;QAC9CjD;QACAN;QACAC,UAAUC,iBAAAA,QAAAA,iBAAAA,KAAAA,IAAAA,eAAgBD;QAC1BuD,gBAAgB,CAACtD;QACjBE;IACF;AACF,EAAE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-toast",
3
- "version": "9.6.3",
3
+ "version": "9.6.4",
4
4
  "description": "Toast component for Fluent UI",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -21,16 +21,16 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@fluentui/keyboard-keys": "^9.0.8",
24
- "@fluentui/react-aria": "^9.16.2",
24
+ "@fluentui/react-aria": "^9.16.3",
25
25
  "@fluentui/react-icons": "^2.0.245",
26
- "@fluentui/react-jsx-runtime": "^9.1.4",
27
- "@fluentui/react-motion": "^9.10.1",
28
- "@fluentui/react-motion-components-preview": "^0.8.1",
29
- "@fluentui/react-portal": "^9.7.2",
26
+ "@fluentui/react-jsx-runtime": "^9.1.5",
27
+ "@fluentui/react-motion": "^9.10.2",
28
+ "@fluentui/react-motion-components-preview": "^0.8.2",
29
+ "@fluentui/react-portal": "^9.8.0",
30
30
  "@fluentui/react-shared-contexts": "^9.24.1",
31
- "@fluentui/react-tabster": "^9.26.2",
31
+ "@fluentui/react-tabster": "^9.26.3",
32
32
  "@fluentui/react-theme": "^9.2.0",
33
- "@fluentui/react-utilities": "^9.23.1",
33
+ "@fluentui/react-utilities": "^9.23.2",
34
34
  "@griffel/react": "^1.5.22",
35
35
  "@swc/helpers": "^0.5.1"
36
36
  },