@fluentui/react-toast 9.3.38 → 9.3.40
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 +30 -2
- package/lib/components/AriaLive/useAriaLive.js +7 -4
- package/lib/components/AriaLive/useAriaLive.js.map +1 -1
- package/lib/components/ToastContainer/renderToastContainer.js +2 -2
- package/lib/components/ToastContainer/renderToastContainer.js.map +1 -1
- package/lib/components/ToastContainer/useToastContainer.js +0 -1
- package/lib/components/ToastContainer/useToastContainer.js.map +1 -1
- package/lib-commonjs/components/AriaLive/useAriaLive.js +6 -3
- package/lib-commonjs/components/AriaLive/useAriaLive.js.map +1 -1
- package/lib-commonjs/components/ToastContainer/renderToastContainer.js +2 -2
- package/lib-commonjs/components/ToastContainer/renderToastContainer.js.map +1 -1
- package/lib-commonjs/components/ToastContainer/useToastContainer.js +0 -1
- package/lib-commonjs/components/ToastContainer/useToastContainer.js.map +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,40 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-toast
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Mon, 06 May 2024 12:48:54 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.3.40](https://github.com/microsoft/fluentui/tree/@fluentui/react-toast_v9.3.40)
|
|
8
|
+
|
|
9
|
+
Mon, 06 May 2024 12:48:54 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-toast_v9.3.39..@fluentui/react-toast_v9.3.40)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- Bump @fluentui/react-aria to v9.11.1 ([PR #31271](https://github.com/microsoft/fluentui/pull/31271) by beachball)
|
|
15
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.37 ([PR #31271](https://github.com/microsoft/fluentui/pull/31271) by beachball)
|
|
16
|
+
- Bump @fluentui/react-portal to v9.4.23 ([PR #31271](https://github.com/microsoft/fluentui/pull/31271) by beachball)
|
|
17
|
+
- Bump @fluentui/react-shared-contexts to v9.18.0 ([PR #31271](https://github.com/microsoft/fluentui/pull/31271) by beachball)
|
|
18
|
+
- Bump @fluentui/react-tabster to v9.21.1 ([PR #31271](https://github.com/microsoft/fluentui/pull/31271) by beachball)
|
|
19
|
+
- Bump @fluentui/react-utilities to v9.18.8 ([PR #31271](https://github.com/microsoft/fluentui/pull/31271) by beachball)
|
|
20
|
+
|
|
21
|
+
## [9.3.39](https://github.com/microsoft/fluentui/tree/@fluentui/react-toast_v9.3.39)
|
|
22
|
+
|
|
23
|
+
Thu, 02 May 2024 11:36:42 GMT
|
|
24
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-toast_v9.3.38..@fluentui/react-toast_v9.3.39)
|
|
25
|
+
|
|
26
|
+
### Patches
|
|
27
|
+
|
|
28
|
+
- refactor: use timeout and animation frame utilities ([PR #31168](https://github.com/microsoft/fluentui/pull/31168) by lingfangao@hotmail.com)
|
|
29
|
+
- fix: use "key" properly in ToastContainer ([PR #31104](https://github.com/microsoft/fluentui/pull/31104) by olfedias@microsoft.com)
|
|
30
|
+
- chore: upgrade @fluentui/react-icons to 2.0.237. ([PR #31139](https://github.com/microsoft/fluentui/pull/31139) by ololubek@microsoft.com)
|
|
31
|
+
- Bump @fluentui/react-aria to v9.11.0 ([PR #31231](https://github.com/microsoft/fluentui/pull/31231) by beachball)
|
|
32
|
+
- Bump @fluentui/react-portal to v9.4.22 ([PR #31231](https://github.com/microsoft/fluentui/pull/31231) by beachball)
|
|
33
|
+
- Bump @fluentui/react-tabster to v9.21.0 ([PR #31231](https://github.com/microsoft/fluentui/pull/31231) by beachball)
|
|
34
|
+
|
|
7
35
|
## [9.3.38](https://github.com/microsoft/fluentui/tree/@fluentui/react-toast_v9.3.38)
|
|
8
36
|
|
|
9
|
-
Tue, 23 Apr 2024 08:
|
|
37
|
+
Tue, 23 Apr 2024 08:17:49 GMT
|
|
10
38
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-toast_v9.3.37..@fluentui/react-toast_v9.3.38)
|
|
11
39
|
|
|
12
40
|
### Patches
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { createPriorityQueue, useEventCallback, slot } from '@fluentui/react-utilities';
|
|
2
|
+
import { createPriorityQueue, useEventCallback, slot, useTimeout } from '@fluentui/react-utilities';
|
|
3
3
|
/** The duration the message needs to be in present in DOM for screen readers to register a change and announce */ const MESSAGE_DURATION = 500;
|
|
4
4
|
/**
|
|
5
5
|
* Create the state required to render AriaLive.
|
|
@@ -34,18 +34,21 @@ import { createPriorityQueue, useEventCallback, slot } from '@fluentui/react-uti
|
|
|
34
34
|
messageQueue.enqueue(liveMessage);
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
|
+
const [setMessageTimeout, clearMessageTimeout] = useTimeout();
|
|
37
38
|
React.useEffect(()=>{
|
|
38
|
-
|
|
39
|
+
setMessageTimeout(()=>{
|
|
39
40
|
if (messageQueue.peek()) {
|
|
40
41
|
setCurrentMessage(messageQueue.dequeue());
|
|
41
42
|
} else {
|
|
42
43
|
setCurrentMessage(undefined);
|
|
43
44
|
}
|
|
44
45
|
}, MESSAGE_DURATION);
|
|
45
|
-
return ()=>
|
|
46
|
+
return ()=>clearMessageTimeout();
|
|
46
47
|
}, [
|
|
47
48
|
currentMessage,
|
|
48
|
-
messageQueue
|
|
49
|
+
messageQueue,
|
|
50
|
+
setMessageTimeout,
|
|
51
|
+
clearMessageTimeout
|
|
49
52
|
]);
|
|
50
53
|
React.useImperativeHandle(props.announceRef, ()=>announce);
|
|
51
54
|
const politeMessage = (currentMessage === null || currentMessage === void 0 ? void 0 : currentMessage.politeness) === 'polite' ? currentMessage.message : undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useAriaLive.ts"],"sourcesContent":["import * as React from 'react';\nimport { createPriorityQueue, useEventCallback, slot } from '@fluentui/react-utilities';\nimport type { AnnounceOptions, AriaLiveProps, AriaLiveState, LiveMessage } from './AriaLive.types';\n\n/** The duration the message needs to be in present in DOM for screen readers to register a change and announce */\nconst MESSAGE_DURATION = 500;\n\n/**\n * Create the state required to render AriaLive.\n *\n * The returned state can be modified with hooks such as useAriaLiveStyles_unstable,\n * before being passed to renderAriaLive_unstable.\n *\n * @param props - props from this instance of AriaLive\n */\nexport const useAriaLive_unstable = (props: AriaLiveProps): AriaLiveState => {\n const [currentMessage, setCurrentMessage] = React.useState<LiveMessage | undefined>(undefined);\n // Can't rely on Date.now() if user invokes announce more than once in a code block\n const order = React.useRef(0);\n const [messageQueue] = React.useState(() =>\n createPriorityQueue<LiveMessage>((a, b) => {\n if (a.politeness === b.politeness) {\n return a.createdAt - b.createdAt;\n }\n\n return a.politeness === 'assertive' ? -1 : 1;\n }),\n );\n\n const announce = useEventCallback((message: string, options: AnnounceOptions) => {\n const { politeness } = options;\n if (message === currentMessage?.message) {\n return;\n }\n\n const liveMessage: LiveMessage = {\n message,\n politeness,\n createdAt: order.current++,\n };\n\n if (!currentMessage) {\n setCurrentMessage(liveMessage);\n } else {\n messageQueue.enqueue(liveMessage);\n }\n });\n\n React.useEffect(() => {\n
|
|
1
|
+
{"version":3,"sources":["useAriaLive.ts"],"sourcesContent":["import * as React from 'react';\nimport { createPriorityQueue, useEventCallback, slot, useTimeout } from '@fluentui/react-utilities';\nimport type { AnnounceOptions, AriaLiveProps, AriaLiveState, LiveMessage } from './AriaLive.types';\n\n/** The duration the message needs to be in present in DOM for screen readers to register a change and announce */\nconst MESSAGE_DURATION = 500;\n\n/**\n * Create the state required to render AriaLive.\n *\n * The returned state can be modified with hooks such as useAriaLiveStyles_unstable,\n * before being passed to renderAriaLive_unstable.\n *\n * @param props - props from this instance of AriaLive\n */\nexport const useAriaLive_unstable = (props: AriaLiveProps): AriaLiveState => {\n const [currentMessage, setCurrentMessage] = React.useState<LiveMessage | undefined>(undefined);\n // Can't rely on Date.now() if user invokes announce more than once in a code block\n const order = React.useRef(0);\n const [messageQueue] = React.useState(() =>\n createPriorityQueue<LiveMessage>((a, b) => {\n if (a.politeness === b.politeness) {\n return a.createdAt - b.createdAt;\n }\n\n return a.politeness === 'assertive' ? -1 : 1;\n }),\n );\n\n const announce = useEventCallback((message: string, options: AnnounceOptions) => {\n const { politeness } = options;\n if (message === currentMessage?.message) {\n return;\n }\n\n const liveMessage: LiveMessage = {\n message,\n politeness,\n createdAt: order.current++,\n };\n\n if (!currentMessage) {\n setCurrentMessage(liveMessage);\n } else {\n messageQueue.enqueue(liveMessage);\n }\n });\n\n const [setMessageTimeout, clearMessageTimeout] = useTimeout();\n\n React.useEffect(() => {\n setMessageTimeout(() => {\n if (messageQueue.peek()) {\n setCurrentMessage(messageQueue.dequeue());\n } else {\n setCurrentMessage(undefined);\n }\n }, MESSAGE_DURATION);\n\n return () => clearMessageTimeout();\n }, [currentMessage, messageQueue, setMessageTimeout, clearMessageTimeout]);\n\n React.useImperativeHandle(props.announceRef, () => announce);\n\n const politeMessage = currentMessage?.politeness === 'polite' ? currentMessage.message : undefined;\n const assertiveMessage = currentMessage?.politeness === 'assertive' ? currentMessage.message : undefined;\n\n return {\n components: {\n assertive: 'div',\n polite: 'div',\n },\n\n assertive: slot.always(props.assertive, {\n defaultProps: { 'aria-live': 'assertive', children: assertiveMessage },\n elementType: 'div',\n }),\n polite: slot.always(props.polite, {\n defaultProps: { 'aria-live': 'polite', children: politeMessage },\n elementType: 'div',\n }),\n };\n};\n"],"names":["React","createPriorityQueue","useEventCallback","slot","useTimeout","MESSAGE_DURATION","useAriaLive_unstable","props","currentMessage","setCurrentMessage","useState","undefined","order","useRef","messageQueue","a","b","politeness","createdAt","announce","message","options","liveMessage","current","enqueue","setMessageTimeout","clearMessageTimeout","useEffect","peek","dequeue","useImperativeHandle","announceRef","politeMessage","assertiveMessage","components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,IAAMZ;IAEnD,MAAMa,gBAAgBxB,CAAAA,2BAAAA,qCAAAA,eAAgBS,UAAU,MAAK,WAAWT,eAAeY,OAAO,GAAGT;IACzF,MAAMsB,mBAAmBzB,CAAAA,2BAAAA,qCAAAA,eAAgBS,UAAU,MAAK,cAAcT,eAAeY,OAAO,GAAGT;IAE/F,OAAO;QACLuB,YAAY;YACVC,WAAW;YACXC,QAAQ;QACV;QAEAD,WAAWhC,KAAKkC,MAAM,CAAC9B,MAAM4B,SAAS,EAAE;YACtCG,cAAc;gBAAE,aAAa;gBAAaC,UAAUN;YAAiB;YACrEO,aAAa;QACf;QACAJ,QAAQjC,KAAKkC,MAAM,CAAC9B,MAAM6B,MAAM,EAAE;YAChCE,cAAc;gBAAE,aAAa;gBAAUC,UAAUP;YAAc;YAC/DQ,aAAa;QACf;IACF;AACF,EAAE"}
|
|
@@ -5,7 +5,7 @@ import { ToastContainerContextProvider } from '../../contexts/toastContainerCont
|
|
|
5
5
|
/**
|
|
6
6
|
* Render the final JSX of ToastContainer
|
|
7
7
|
*/ export const renderToastContainer_unstable = (state, contextValues)=>{
|
|
8
|
-
const { onTransitionEntering, visible, transitionTimeout, remove, nodeRef } = state;
|
|
8
|
+
const { onTransitionEntering, visible, transitionTimeout, remove, nodeRef, updateId } = state;
|
|
9
9
|
assertSlots(state);
|
|
10
10
|
return /*#__PURE__*/ _jsx(Transition, {
|
|
11
11
|
in: visible,
|
|
@@ -19,7 +19,7 @@ import { ToastContainerContextProvider } from '../../contexts/toastContainerCont
|
|
|
19
19
|
value: contextValues.toast,
|
|
20
20
|
children: [
|
|
21
21
|
/*#__PURE__*/ _jsx(state.root, {}),
|
|
22
|
-
/*#__PURE__*/ _jsx(state.timer, {})
|
|
22
|
+
/*#__PURE__*/ _jsx(state.timer, {}, updateId)
|
|
23
23
|
]
|
|
24
24
|
})
|
|
25
25
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderToastContainer.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport { Transition } from 'react-transition-group';\nimport type { ToastContainerState, ToastContainerSlots, ToastContainerContextValues } from './ToastContainer.types';\nimport { ToastContainerContextProvider } from '../../contexts/toastContainerContext';\n\n/**\n * Render the final JSX of ToastContainer\n */\nexport const renderToastContainer_unstable = (\n state: ToastContainerState,\n contextValues: ToastContainerContextValues,\n) => {\n const { onTransitionEntering, visible, transitionTimeout, remove, nodeRef } = state;\n assertSlots<ToastContainerSlots>(state);\n\n return (\n <Transition\n in={visible}\n appear\n unmountOnExit\n timeout={transitionTimeout}\n onExited={remove}\n onEntering={onTransitionEntering}\n nodeRef={nodeRef}\n >\n <ToastContainerContextProvider value={contextValues.toast}>\n <state.root />\n <state.timer />\n </ToastContainerContextProvider>\n </Transition>\n );\n};\n"],"names":["assertSlots","Transition","ToastContainerContextProvider","renderToastContainer_unstable","state","contextValues","onTransitionEntering","visible","transitionTimeout","remove","nodeRef","in","appear","unmountOnExit","timeout","onExited","onEntering","value","toast","root","timer"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AACjD,SAASA,WAAW,QAAQ,4BAA4B;AACxD,SAASC,UAAU,QAAQ,yBAAyB;AAEpD,SAASC,6BAA6B,QAAQ,uCAAuC;AAErF;;CAEC,GACD,OAAO,MAAMC,gCAAgC,CAC3CC,OACAC;IAEA,MAAM,EAAEC,oBAAoB,EAAEC,OAAO,EAAEC,iBAAiB,EAAEC,MAAM,EAAEC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"sources":["renderToastContainer.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport { Transition } from 'react-transition-group';\nimport type { ToastContainerState, ToastContainerSlots, ToastContainerContextValues } from './ToastContainer.types';\nimport { ToastContainerContextProvider } from '../../contexts/toastContainerContext';\n\n/**\n * Render the final JSX of ToastContainer\n */\nexport const renderToastContainer_unstable = (\n state: ToastContainerState,\n contextValues: ToastContainerContextValues,\n) => {\n const { onTransitionEntering, visible, transitionTimeout, remove, nodeRef, updateId } = state;\n assertSlots<ToastContainerSlots>(state);\n\n return (\n <Transition\n in={visible}\n appear\n unmountOnExit\n timeout={transitionTimeout}\n onExited={remove}\n onEntering={onTransitionEntering}\n nodeRef={nodeRef}\n >\n <ToastContainerContextProvider value={contextValues.toast}>\n <state.root />\n <state.timer key={updateId} />\n </ToastContainerContextProvider>\n </Transition>\n );\n};\n"],"names":["assertSlots","Transition","ToastContainerContextProvider","renderToastContainer_unstable","state","contextValues","onTransitionEntering","visible","transitionTimeout","remove","nodeRef","updateId","in","appear","unmountOnExit","timeout","onExited","onEntering","value","toast","root","timer"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AACjD,SAASA,WAAW,QAAQ,4BAA4B;AACxD,SAASC,UAAU,QAAQ,yBAAyB;AAEpD,SAASC,6BAA6B,QAAQ,uCAAuC;AAErF;;CAEC,GACD,OAAO,MAAMC,gCAAgC,CAC3CC,OACAC;IAEA,MAAM,EAAEC,oBAAoB,EAAEC,OAAO,EAAEC,iBAAiB,EAAEC,MAAM,EAAEC,OAAO,EAAEC,QAAQ,EAAE,GAAGP;IACxFJ,YAAiCI;IAEjC,qBACE,KAACH;QACCW,IAAIL;QACJM,MAAM;QACNC,aAAa;QACbC,SAASP;QACTQ,UAAUP;QACVQ,YAAYX;QACZI,SAASA;kBAET,cAAA,MAACR;YAA8BgB,OAAOb,cAAcc,KAAK;;8BACvD,KAACf,MAAMgB,IAAI;8BACX,KAAChB,MAAMiB,KAAK,MAAMV;;;;AAI1B,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useToastContainer.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n getIntrinsicElementProps,\n useMergedRefs,\n ExtractSlotProps,\n Slot,\n useEventCallback,\n useId,\n slot,\n} from '@fluentui/react-utilities';\nimport { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport { Delete, Tab } from '@fluentui/keyboard-keys';\nimport { useFocusableGroup, useFocusFinders } from '@fluentui/react-tabster';\nimport { ToastStatus } from '../../state';\nimport type { ToastContainerProps, ToastContainerState } from './ToastContainer.types';\nimport { Timer, TimerProps } from '../Timer/Timer';\n\nconst intentPolitenessMap = {\n success: 'assertive',\n warning: 'assertive',\n error: 'assertive',\n info: 'polite',\n} as const;\n\n/**\n * Create the state required to render ToastContainer.\n *\n * The returned state can be modified with hooks such as useToastContainerStyles_unstable,\n * before being passed to renderToastContainer_unstable.\n *\n * @param props - props from this instance of ToastContainer\n * @param ref - reference to root HTMLElement of ToastContainer\n */\nexport const useToastContainer_unstable = (\n props: ToastContainerProps,\n ref: React.Ref<HTMLElement>,\n): ToastContainerState => {\n const {\n visible,\n children,\n close: closeProp,\n remove,\n updateId,\n announce,\n data,\n timeout: timerTimeout,\n politeness: desiredPoliteness,\n intent = 'info',\n pauseOnHover,\n pauseOnWindowBlur,\n imperativeRef,\n tryRestoreFocus,\n ...rest\n } = props;\n const titleId = useId('toast-title');\n const bodyId = useId('toast-body');\n const toastRef = React.useRef<HTMLDivElement | null>(null);\n const { targetDocument } = useFluent_unstable();\n const [running, setRunning] = React.useState(false);\n const imperativePauseRef = React.useRef(false);\n const focusedToastBeforeClose = React.useRef(false);\n const focusableGroupAttribute = useFocusableGroup({\n tabBehavior: 'limited-trap-focus',\n // Users should only use Tab to focus into the toast\n // Escape is already reserved to dismiss all toasts\n ignoreDefaultKeydown: { Tab: true, Escape: true, Enter: true },\n });\n\n const close = useEventCallback(() => {\n const activeElement = targetDocument?.activeElement;\n if (activeElement && toastRef.current?.contains(activeElement)) {\n focusedToastBeforeClose.current = true;\n }\n\n closeProp();\n });\n const onStatusChange = useEventCallback((status: ToastStatus) => props.onStatusChange?.(null, { status, ...props }));\n const pause = useEventCallback(() => setRunning(false));\n const play = useEventCallback(() => {\n if (imperativePauseRef.current) {\n return;\n }\n const containsActive = !!toastRef.current?.contains(targetDocument?.activeElement ?? null);\n if (timerTimeout < 0) {\n setRunning(true);\n return;\n }\n\n if (!containsActive) {\n setRunning(true);\n }\n });\n\n React.useImperativeHandle(imperativeRef, () => ({\n focus: () => {\n if (!toastRef.current) {\n return;\n }\n\n toastRef.current.focus();\n },\n\n play: () => {\n imperativePauseRef.current = false;\n play();\n },\n pause: () => {\n imperativePauseRef.current = true;\n pause();\n },\n }));\n\n React.useEffect(() => {\n return () => onStatusChange('unmounted');\n }, [onStatusChange]);\n\n React.useEffect(() => {\n if (!targetDocument) {\n return;\n }\n\n if (pauseOnWindowBlur) {\n targetDocument.defaultView?.addEventListener('focus', play);\n targetDocument.defaultView?.addEventListener('blur', pause);\n return () => {\n targetDocument.defaultView?.removeEventListener('focus', play);\n targetDocument.defaultView?.removeEventListener('blur', pause);\n };\n }\n }, [targetDocument, pause, play, pauseOnWindowBlur]);\n\n // It's impossible to animate to height: auto in CSS, the actual pixel value must be known\n // Get the height of the toast before animation styles have been applied and set a CSS\n // variable with its height. The CSS variable will be used by the styles\n const onTransitionEntering = () => {\n if (!toastRef.current) {\n return;\n }\n\n const element = toastRef.current;\n element.style.setProperty('--fui-toast-height', `${element.scrollHeight}px`);\n };\n\n // Users never actually use ToastContainer as a JSX but imperatively through useToastContainerController\n const userRootSlot = (data as { root?: ExtractSlotProps<Slot<'div'>> }).root;\n\n // Using a ref callback here because addEventListener supports `once`\n const toastAnimationRef = React.useCallback(\n (el: HTMLDivElement | null) => {\n if (el && toastRef.current) {\n toastRef.current.addEventListener(\n 'animationend',\n () => {\n // start toast once it's fully animated in\n play();\n onStatusChange('visible');\n },\n { once: true },\n );\n }\n },\n [play, onStatusChange],\n );\n\n const onMouseEnter = useEventCallback((e: React.MouseEvent<HTMLDivElement>) => {\n pause();\n userRootSlot?.onMouseEnter?.(e);\n });\n\n const onMouseLeave = useEventCallback((e: React.MouseEvent<HTMLDivElement>) => {\n play();\n userRootSlot?.onMouseEnter?.(e);\n });\n\n const { findFirstFocusable, findLastFocusable } = useFocusFinders();\n const onKeyDown = useEventCallback((e: React.KeyboardEvent<HTMLDivElement>) => {\n if (e.key === Delete) {\n e.preventDefault();\n close();\n }\n\n if (e.key === Tab && e.currentTarget === e.target) {\n e.preventDefault();\n if (e.shiftKey) {\n findLastFocusable(e.currentTarget)?.focus();\n } else {\n findFirstFocusable(e.currentTarget)?.focus();\n }\n }\n\n userRootSlot?.onKeyDown?.(e);\n });\n\n React.useEffect(() => {\n if (!visible) {\n return;\n }\n\n const politeness = desiredPoliteness ?? intentPolitenessMap[intent];\n announce(toastRef.current?.textContent ?? '', { politeness });\n }, [announce, desiredPoliteness, toastRef, visible, updateId, intent]);\n\n React.useEffect(() => {\n return () => {\n if (focusedToastBeforeClose.current) {\n focusedToastBeforeClose.current = false;\n tryRestoreFocus();\n }\n };\n }, [tryRestoreFocus]);\n\n return {\n components: {\n timer: Timer,\n root: 'div',\n },\n timer: slot.always<TimerProps>(\n { key: updateId, onTimeout: close, running, timeout: timerTimeout ?? -1 },\n { elementType: Timer },\n ),\n root: slot.always(\n getIntrinsicElementProps('div', {\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: useMergedRefs(ref, toastRef, toastAnimationRef) as React.Ref<HTMLDivElement>,\n children,\n tabIndex: 0,\n role: 'listitem',\n 'aria-labelledby': titleId,\n 'aria-describedby': bodyId,\n ...rest,\n ...userRootSlot,\n ...focusableGroupAttribute,\n onMouseEnter,\n onMouseLeave,\n onKeyDown,\n }),\n { elementType: 'div' },\n ),\n timerTimeout,\n transitionTimeout: 500,\n running,\n visible,\n remove,\n close,\n onTransitionEntering,\n updateId,\n nodeRef: toastRef,\n intent,\n titleId,\n bodyId,\n };\n};\n"],"names":["React","getIntrinsicElementProps","useMergedRefs","useEventCallback","useId","slot","useFluent_unstable","Delete","Tab","useFocusableGroup","useFocusFinders","Timer","intentPolitenessMap","success","warning","error","info","useToastContainer_unstable","props","ref","visible","children","close","closeProp","remove","updateId","announce","data","timeout","timerTimeout","politeness","desiredPoliteness","intent","pauseOnHover","pauseOnWindowBlur","imperativeRef","tryRestoreFocus","rest","titleId","bodyId","toastRef","useRef","targetDocument","running","setRunning","useState","imperativePauseRef","focusedToastBeforeClose","focusableGroupAttribute","tabBehavior","ignoreDefaultKeydown","Escape","Enter","activeElement","current","contains","onStatusChange","status","pause","play","containsActive","useImperativeHandle","focus","useEffect","defaultView","addEventListener","removeEventListener","onTransitionEntering","element","style","setProperty","scrollHeight","userRootSlot","root","toastAnimationRef","useCallback","el","once","onMouseEnter","e","onMouseLeave","findFirstFocusable","findLastFocusable","onKeyDown","key","preventDefault","currentTarget","target","shiftKey","textContent","components","timer","always","onTimeout","elementType","tabIndex","role","transitionTimeout","nodeRef"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SACEC,wBAAwB,EACxBC,aAAa,EAGbC,gBAAgB,EAChBC,KAAK,EACLC,IAAI,QACC,4BAA4B;AACnC,SAASC,kBAAkB,QAAQ,kCAAkC;AACrE,SAASC,MAAM,EAAEC,GAAG,QAAQ,0BAA0B;AACtD,SAASC,iBAAiB,EAAEC,eAAe,QAAQ,0BAA0B;AAG7E,SAASC,KAAK,QAAoB,iBAAiB;AAEnD,MAAMC,sBAAsB;IAC1BC,SAAS;IACTC,SAAS;IACTC,OAAO;IACPC,MAAM;AACR;AAEA;;;;;;;;CAQC,GACD,OAAO,MAAMC,6BAA6B,CACxCC,OACAC;IAEA,MAAM,EACJC,OAAO,EACPC,QAAQ,EACRC,OAAOC,SAAS,EAChBC,MAAM,EACNC,QAAQ,EACRC,QAAQ,EACRC,IAAI,EACJC,SAASC,YAAY,EACrBC,YAAYC,iBAAiB,EAC7BC,SAAS,MAAM,EACfC,YAAY,EACZC,iBAAiB,EACjBC,aAAa,EACbC,eAAe,EACf,GAAGC,MACJ,GAAGnB;IACJ,MAAMoB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;QAATd,SAASc,CAAAA,iCAAAA,oBAAAA,SAASc,OAAO,cAAhBd,wCAAAA,kBAAkBiD,WAAW,cAA7BjD,2CAAAA,gCAAiC,IAAI;YAAEV;QAAW;IAC7D,GAAG;QAACJ;QAAUK;QAAmBS;QAAUpB;QAASK;QAAUO;KAAO;IAErEhC,MAAM+D,SAAS,CAAC;QACd,OAAO;YACL,IAAIhB,wBAAwBO,OAAO,EAAE;gBACnCP,wBAAwBO,OAAO,GAAG;gBAClClB;YACF;QACF;IACF,GAAG;QAACA;KAAgB;IAEpB,OAAO;QACLsD,YAAY;YACVC,OAAOhF;YACP8D,MAAM;QACR;QACAkB,OAAOtF,KAAKuF,MAAM,CAChB;YAAER,KAAK3D;YAAUoE,WAAWvE;YAAOqB;YAASf,SAASC,yBAAAA,0BAAAA,eAAgB,CAAC;QAAE,GACxE;YAAEiE,aAAanF;QAAM;QAEvB8D,MAAMpE,KAAKuF,MAAM,CACf3F,yBAAyB,OAAO;YAC9B,SAAS;YACT,4EAA4E;YAC5E,4FAA4F;YAC5FkB,KAAKjB,cAAciB,KAAKqB,UAAUkC;YAClCrD;YACA0E,UAAU;YACVC,MAAM;YACN,mBAAmB1D;YACnB,oBAAoBC;YACpB,GAAGF,IAAI;YACP,GAAGmC,YAAY;YACf,GAAGxB,uBAAuB;YAC1B8B;YACAE;YACAG;QACF,IACA;YAAEW,aAAa;QAAM;QAEvBjE;QACAoE,mBAAmB;QACnBtD;QACAvB;QACAI;QACAF;QACA6C;QACA1C;QACAyE,SAAS1D;QACTR;QACAM;QACAC;IACF;AACF,EAAE"}
|
|
1
|
+
{"version":3,"sources":["useToastContainer.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n getIntrinsicElementProps,\n useMergedRefs,\n ExtractSlotProps,\n Slot,\n useEventCallback,\n useId,\n slot,\n} from '@fluentui/react-utilities';\nimport { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport { Delete, Tab } from '@fluentui/keyboard-keys';\nimport { useFocusableGroup, useFocusFinders } from '@fluentui/react-tabster';\nimport { ToastStatus } from '../../state';\nimport type { ToastContainerProps, ToastContainerState } from './ToastContainer.types';\nimport { Timer, TimerProps } from '../Timer/Timer';\n\nconst intentPolitenessMap = {\n success: 'assertive',\n warning: 'assertive',\n error: 'assertive',\n info: 'polite',\n} as const;\n\n/**\n * Create the state required to render ToastContainer.\n *\n * The returned state can be modified with hooks such as useToastContainerStyles_unstable,\n * before being passed to renderToastContainer_unstable.\n *\n * @param props - props from this instance of ToastContainer\n * @param ref - reference to root HTMLElement of ToastContainer\n */\nexport const useToastContainer_unstable = (\n props: ToastContainerProps,\n ref: React.Ref<HTMLElement>,\n): ToastContainerState => {\n const {\n visible,\n children,\n close: closeProp,\n remove,\n updateId,\n announce,\n data,\n timeout: timerTimeout,\n politeness: desiredPoliteness,\n intent = 'info',\n pauseOnHover,\n pauseOnWindowBlur,\n imperativeRef,\n tryRestoreFocus,\n ...rest\n } = props;\n const titleId = useId('toast-title');\n const bodyId = useId('toast-body');\n const toastRef = React.useRef<HTMLDivElement | null>(null);\n const { targetDocument } = useFluent_unstable();\n const [running, setRunning] = React.useState(false);\n const imperativePauseRef = React.useRef(false);\n const focusedToastBeforeClose = React.useRef(false);\n const focusableGroupAttribute = useFocusableGroup({\n tabBehavior: 'limited-trap-focus',\n // Users should only use Tab to focus into the toast\n // Escape is already reserved to dismiss all toasts\n ignoreDefaultKeydown: { Tab: true, Escape: true, Enter: true },\n });\n\n const close = useEventCallback(() => {\n const activeElement = targetDocument?.activeElement;\n if (activeElement && toastRef.current?.contains(activeElement)) {\n focusedToastBeforeClose.current = true;\n }\n\n closeProp();\n });\n const onStatusChange = useEventCallback((status: ToastStatus) => props.onStatusChange?.(null, { status, ...props }));\n const pause = useEventCallback(() => setRunning(false));\n const play = useEventCallback(() => {\n if (imperativePauseRef.current) {\n return;\n }\n const containsActive = !!toastRef.current?.contains(targetDocument?.activeElement ?? null);\n if (timerTimeout < 0) {\n setRunning(true);\n return;\n }\n\n if (!containsActive) {\n setRunning(true);\n }\n });\n\n React.useImperativeHandle(imperativeRef, () => ({\n focus: () => {\n if (!toastRef.current) {\n return;\n }\n\n toastRef.current.focus();\n },\n\n play: () => {\n imperativePauseRef.current = false;\n play();\n },\n pause: () => {\n imperativePauseRef.current = true;\n pause();\n },\n }));\n\n React.useEffect(() => {\n return () => onStatusChange('unmounted');\n }, [onStatusChange]);\n\n React.useEffect(() => {\n if (!targetDocument) {\n return;\n }\n\n if (pauseOnWindowBlur) {\n targetDocument.defaultView?.addEventListener('focus', play);\n targetDocument.defaultView?.addEventListener('blur', pause);\n return () => {\n targetDocument.defaultView?.removeEventListener('focus', play);\n targetDocument.defaultView?.removeEventListener('blur', pause);\n };\n }\n }, [targetDocument, pause, play, pauseOnWindowBlur]);\n\n // It's impossible to animate to height: auto in CSS, the actual pixel value must be known\n // Get the height of the toast before animation styles have been applied and set a CSS\n // variable with its height. The CSS variable will be used by the styles\n const onTransitionEntering = () => {\n if (!toastRef.current) {\n return;\n }\n\n const element = toastRef.current;\n element.style.setProperty('--fui-toast-height', `${element.scrollHeight}px`);\n };\n\n // Users never actually use ToastContainer as a JSX but imperatively through useToastContainerController\n const userRootSlot = (data as { root?: ExtractSlotProps<Slot<'div'>> }).root;\n\n // Using a ref callback here because addEventListener supports `once`\n const toastAnimationRef = React.useCallback(\n (el: HTMLDivElement | null) => {\n if (el && toastRef.current) {\n toastRef.current.addEventListener(\n 'animationend',\n () => {\n // start toast once it's fully animated in\n play();\n onStatusChange('visible');\n },\n { once: true },\n );\n }\n },\n [play, onStatusChange],\n );\n\n const onMouseEnter = useEventCallback((e: React.MouseEvent<HTMLDivElement>) => {\n pause();\n userRootSlot?.onMouseEnter?.(e);\n });\n\n const onMouseLeave = useEventCallback((e: React.MouseEvent<HTMLDivElement>) => {\n play();\n userRootSlot?.onMouseEnter?.(e);\n });\n\n const { findFirstFocusable, findLastFocusable } = useFocusFinders();\n const onKeyDown = useEventCallback((e: React.KeyboardEvent<HTMLDivElement>) => {\n if (e.key === Delete) {\n e.preventDefault();\n close();\n }\n\n if (e.key === Tab && e.currentTarget === e.target) {\n e.preventDefault();\n if (e.shiftKey) {\n findLastFocusable(e.currentTarget)?.focus();\n } else {\n findFirstFocusable(e.currentTarget)?.focus();\n }\n }\n\n userRootSlot?.onKeyDown?.(e);\n });\n\n React.useEffect(() => {\n if (!visible) {\n return;\n }\n\n const politeness = desiredPoliteness ?? intentPolitenessMap[intent];\n announce(toastRef.current?.textContent ?? '', { politeness });\n }, [announce, desiredPoliteness, toastRef, visible, updateId, intent]);\n\n React.useEffect(() => {\n return () => {\n if (focusedToastBeforeClose.current) {\n focusedToastBeforeClose.current = false;\n tryRestoreFocus();\n }\n };\n }, [tryRestoreFocus]);\n\n return {\n components: {\n timer: Timer,\n root: 'div',\n },\n timer: slot.always<TimerProps>({ onTimeout: close, running, timeout: timerTimeout ?? -1 }, { elementType: Timer }),\n root: slot.always(\n getIntrinsicElementProps('div', {\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: useMergedRefs(ref, toastRef, toastAnimationRef) as React.Ref<HTMLDivElement>,\n children,\n tabIndex: 0,\n role: 'listitem',\n 'aria-labelledby': titleId,\n 'aria-describedby': bodyId,\n ...rest,\n ...userRootSlot,\n ...focusableGroupAttribute,\n onMouseEnter,\n onMouseLeave,\n onKeyDown,\n }),\n { elementType: 'div' },\n ),\n timerTimeout,\n transitionTimeout: 500,\n running,\n visible,\n remove,\n close,\n onTransitionEntering,\n updateId,\n nodeRef: toastRef,\n intent,\n titleId,\n bodyId,\n };\n};\n"],"names":["React","getIntrinsicElementProps","useMergedRefs","useEventCallback","useId","slot","useFluent_unstable","Delete","Tab","useFocusableGroup","useFocusFinders","Timer","intentPolitenessMap","success","warning","error","info","useToastContainer_unstable","props","ref","visible","children","close","closeProp","remove","updateId","announce","data","timeout","timerTimeout","politeness","desiredPoliteness","intent","pauseOnHover","pauseOnWindowBlur","imperativeRef","tryRestoreFocus","rest","titleId","bodyId","toastRef","useRef","targetDocument","running","setRunning","useState","imperativePauseRef","focusedToastBeforeClose","focusableGroupAttribute","tabBehavior","ignoreDefaultKeydown","Escape","Enter","activeElement","current","contains","onStatusChange","status","pause","play","containsActive","useImperativeHandle","focus","useEffect","defaultView","addEventListener","removeEventListener","onTransitionEntering","element","style","setProperty","scrollHeight","userRootSlot","root","toastAnimationRef","useCallback","el","once","onMouseEnter","e","onMouseLeave","findFirstFocusable","findLastFocusable","onKeyDown","key","preventDefault","currentTarget","target","shiftKey","textContent","components","timer","always","onTimeout","elementType","tabIndex","role","transitionTimeout","nodeRef"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SACEC,wBAAwB,EACxBC,aAAa,EAGbC,gBAAgB,EAChBC,KAAK,EACLC,IAAI,QACC,4BAA4B;AACnC,SAASC,kBAAkB,QAAQ,kCAAkC;AACrE,SAASC,MAAM,EAAEC,GAAG,QAAQ,0BAA0B;AACtD,SAASC,iBAAiB,EAAEC,eAAe,QAAQ,0BAA0B;AAG7E,SAASC,KAAK,QAAoB,iBAAiB;AAEnD,MAAMC,sBAAsB;IAC1BC,SAAS;IACTC,SAAS;IACTC,OAAO;IACPC,MAAM;AACR;AAEA;;;;;;;;CAQC,GACD,OAAO,MAAMC,6BAA6B,CACxCC,OACAC;IAEA,MAAM,EACJC,OAAO,EACPC,QAAQ,EACRC,OAAOC,SAAS,EAChBC,MAAM,EACNC,QAAQ,EACRC,QAAQ,EACRC,IAAI,EACJC,SAASC,YAAY,EACrBC,YAAYC,iBAAiB,EAC7BC,SAAS,MAAM,EACfC,YAAY,EACZC,iBAAiB,EACjBC,aAAa,EACbC,eAAe,EACf,GAAGC,MACJ,GAAGnB;IACJ,MAAMoB,UAAUlC,MAAM;IACtB,MAAMmC,SAASnC,MAAM;IACrB,MAAMoC,WAAWxC,MAAMyC,MAAM,CAAwB;IACrD,MAAM,EAAEC,cAAc,EAAE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AAEV;QAAW;IAC7D,GAAG;QAACJ;QAAUK;QAAmBS;QAAUpB;QAASK;QAAUO;KAAO;IAErEhC,MAAM+D,SAAS,CAAC;QACd,OAAO;YACL,IAAIhB,wBAAwBO,OAAO,EAAE;gBACnCP,wBAAwBO,OAAO,GAAG;gBAClClB;YACF;QACF;IACF,GAAG;QAACA;KAAgB;IAEpB,OAAO;QACLsD,YAAY;YACVC,OAAOhF;YACP8D,MAAM;QACR;QACAkB,OAAOtF,KAAKuF,MAAM,CAAa;YAAEC,WAAWvE;YAAOqB;YAASf,SAASC,yBAAAA,0BAAAA,eAAgB,CAAC;QAAE,GAAG;YAAEiE,aAAanF;QAAM;QAChH8D,MAAMpE,KAAKuF,MAAM,CACf3F,yBAAyB,OAAO;YAC9B,SAAS;YACT,4EAA4E;YAC5E,4FAA4F;YAC5FkB,KAAKjB,cAAciB,KAAKqB,UAAUkC;YAClCrD;YACA0E,UAAU;YACVC,MAAM;YACN,mBAAmB1D;YACnB,oBAAoBC;YACpB,GAAGF,IAAI;YACP,GAAGmC,YAAY;YACf,GAAGxB,uBAAuB;YAC1B8B;YACAE;YACAG;QACF,IACA;YAAEW,aAAa;QAAM;QAEvBjE;QACAoE,mBAAmB;QACnBtD;QACAvB;QACAI;QACAF;QACA6C;QACA1C;QACAyE,SAAS1D;QACTR;QACAM;QACAC;IACF;AACF,EAAE"}
|
|
@@ -38,18 +38,21 @@ const useAriaLive_unstable = (props)=>{
|
|
|
38
38
|
messageQueue.enqueue(liveMessage);
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
|
+
const [setMessageTimeout, clearMessageTimeout] = (0, _reactutilities.useTimeout)();
|
|
41
42
|
_react.useEffect(()=>{
|
|
42
|
-
|
|
43
|
+
setMessageTimeout(()=>{
|
|
43
44
|
if (messageQueue.peek()) {
|
|
44
45
|
setCurrentMessage(messageQueue.dequeue());
|
|
45
46
|
} else {
|
|
46
47
|
setCurrentMessage(undefined);
|
|
47
48
|
}
|
|
48
49
|
}, MESSAGE_DURATION);
|
|
49
|
-
return ()=>
|
|
50
|
+
return ()=>clearMessageTimeout();
|
|
50
51
|
}, [
|
|
51
52
|
currentMessage,
|
|
52
|
-
messageQueue
|
|
53
|
+
messageQueue,
|
|
54
|
+
setMessageTimeout,
|
|
55
|
+
clearMessageTimeout
|
|
53
56
|
]);
|
|
54
57
|
_react.useImperativeHandle(props.announceRef, ()=>announce);
|
|
55
58
|
const politeMessage = (currentMessage === null || currentMessage === void 0 ? void 0 : currentMessage.politeness) === 'polite' ? currentMessage.message : undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useAriaLive.js"],"sourcesContent":["import * as React from 'react';\nimport { createPriorityQueue, useEventCallback, slot } from '@fluentui/react-utilities';\n/** The duration the message needs to be in present in DOM for screen readers to register a change and announce */ const MESSAGE_DURATION = 500;\n/**\n * Create the state required to render AriaLive.\n *\n * The returned state can be modified with hooks such as useAriaLiveStyles_unstable,\n * before being passed to renderAriaLive_unstable.\n *\n * @param props - props from this instance of AriaLive\n */ export const useAriaLive_unstable = (props)=>{\n const [currentMessage, setCurrentMessage] = React.useState(undefined);\n // Can't rely on Date.now() if user invokes announce more than once in a code block\n const order = React.useRef(0);\n const [messageQueue] = React.useState(()=>createPriorityQueue((a, b)=>{\n if (a.politeness === b.politeness) {\n return a.createdAt - b.createdAt;\n }\n return a.politeness === 'assertive' ? -1 : 1;\n }));\n const announce = useEventCallback((message, options)=>{\n const { politeness } = options;\n if (message === (currentMessage === null || currentMessage === void 0 ? void 0 : currentMessage.message)) {\n return;\n }\n const liveMessage = {\n message,\n politeness,\n createdAt: order.current++\n };\n if (!currentMessage) {\n setCurrentMessage(liveMessage);\n } else {\n messageQueue.enqueue(liveMessage);\n }\n });\n React.useEffect(()=>{\n
|
|
1
|
+
{"version":3,"sources":["useAriaLive.js"],"sourcesContent":["import * as React from 'react';\nimport { createPriorityQueue, useEventCallback, slot, useTimeout } from '@fluentui/react-utilities';\n/** The duration the message needs to be in present in DOM for screen readers to register a change and announce */ const MESSAGE_DURATION = 500;\n/**\n * Create the state required to render AriaLive.\n *\n * The returned state can be modified with hooks such as useAriaLiveStyles_unstable,\n * before being passed to renderAriaLive_unstable.\n *\n * @param props - props from this instance of AriaLive\n */ export const useAriaLive_unstable = (props)=>{\n const [currentMessage, setCurrentMessage] = React.useState(undefined);\n // Can't rely on Date.now() if user invokes announce more than once in a code block\n const order = React.useRef(0);\n const [messageQueue] = React.useState(()=>createPriorityQueue((a, b)=>{\n if (a.politeness === b.politeness) {\n return a.createdAt - b.createdAt;\n }\n return a.politeness === 'assertive' ? -1 : 1;\n }));\n const announce = useEventCallback((message, options)=>{\n const { politeness } = options;\n if (message === (currentMessage === null || currentMessage === void 0 ? void 0 : currentMessage.message)) {\n return;\n }\n const liveMessage = {\n message,\n politeness,\n createdAt: order.current++\n };\n if (!currentMessage) {\n setCurrentMessage(liveMessage);\n } else {\n messageQueue.enqueue(liveMessage);\n }\n });\n const [setMessageTimeout, clearMessageTimeout] = useTimeout();\n React.useEffect(()=>{\n setMessageTimeout(()=>{\n if (messageQueue.peek()) {\n setCurrentMessage(messageQueue.dequeue());\n } else {\n setCurrentMessage(undefined);\n }\n }, MESSAGE_DURATION);\n return ()=>clearMessageTimeout();\n }, [\n currentMessage,\n messageQueue,\n setMessageTimeout,\n clearMessageTimeout\n ]);\n React.useImperativeHandle(props.announceRef, ()=>announce);\n const politeMessage = (currentMessage === null || currentMessage === void 0 ? void 0 : currentMessage.politeness) === 'polite' ? currentMessage.message : undefined;\n const assertiveMessage = (currentMessage === null || currentMessage === void 0 ? void 0 : currentMessage.politeness) === 'assertive' ? currentMessage.message : undefined;\n return {\n components: {\n assertive: 'div',\n polite: 'div'\n },\n assertive: slot.always(props.assertive, {\n defaultProps: {\n 'aria-live': 'assertive',\n children: assertiveMessage\n },\n elementType: 'div'\n }),\n polite: slot.always(props.polite, {\n defaultProps: {\n 'aria-live': 'polite',\n children: politeMessage\n },\n elementType: 'div'\n })\n };\n};\n"],"names":["useAriaLive_unstable","MESSAGE_DURATION","props","currentMessage","setCurrentMessage","React","useState","undefined","order","useRef","messageQueue","createPriorityQueue","a","b","politeness","createdAt","announce","useEventCallback","message","options","liveMessage","current","enqueue","setMessageTimeout","clearMessageTimeout","useTimeout","useEffect","peek","dequeue","useImperativeHandle","announceRef","politeMessage","assertiveMessage","components","assertive","polite","slot","always","defaultProps","children","elementType"],"mappings":";;;;+BAUiBA;;;eAAAA;;;;iEAVM;gCACiD;AACxE,gHAAgH,GAAG,MAAMC,mBAAmB;AAQjI,MAAMD,uBAAuB,CAACE;IACrC,MAAM,CAACC,gBAAgBC,kBAAkB,GAAGC,OAAMC,QAAQ,CAACC;IAC3D,mFAAmF;IACnF,MAAMC,QAAQH,OAAMI,MAAM,CAAC;IAC3B,MAAM,CAACC,aAAa,GAAGL,OAAMC,QAAQ,CAAC,IAAIK,IAAAA,mCAAmB,EAAC,CAACC,GAAGC;YAC1D,IAAID,EAAEE,UAAU,KAAKD,EAAEC,UAAU,EAAE;gBAC/B,OAAOF,EAAEG,SAAS,GAAGF,EAAEE,SAAS;YACpC;YACA,OAAOH,EAAEE,UAAU,KAAK,cAAc,CAAC,IAAI;QAC/C;IACJ,MAAME,WAAWC,IAAAA,gCAAgB,EAAC,CAACC,SAASC;QACxC,MAAM,EAAEL,UAAU,EAAE,GAAGK;QACvB,IAAID,YAAaf,CAAAA,mBAAmB,QAAQA,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAee,OAAO,AAAD,GAAI;YACtG;QACJ;QACA,MAAME,cAAc;YAChBF;YACAJ;YACAC,WAAWP,MAAMa,OAAO;QAC5B;QACA,IAAI,CAAClB,gBAAgB;YACjBC,kBAAkBgB;QACtB,OAAO;YACHV,aAAaY,OAAO,CAACF;QACzB;IACJ;IACA,MAAM,CAACG,mBAAmBC,oBAAoB,GAAGC,IAAAA,0BAAU;IAC3DpB,OAAMqB,SAAS,CAAC;QACZH,kBAAkB;YACd,IAAIb,aAAaiB,IAAI,IAAI;gBACrBvB,kBAAkBM,aAAakB,OAAO;YAC1C,OAAO;gBACHxB,kBAAkBG;YACtB;QACJ,GAAGN;QACH,OAAO,IAAIuB;IACf,GAAG;QACCrB;QACAO;QACAa;QACAC;KACH;IACDnB,OAAMwB,mBAAmB,CAAC3B,MAAM4B,WAAW,EAAE,IAAId;IACjD,MAAMe,gBAAgB,AAAC5B,CAAAA,mBAAmB,QAAQA,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAeW,UAAU,AAAD,MAAO,WAAWX,eAAee,OAAO,GAAGX;IAC1J,MAAMyB,mBAAmB,AAAC7B,CAAAA,mBAAmB,QAAQA,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAeW,UAAU,AAAD,MAAO,cAAcX,eAAee,OAAO,GAAGX;IAChK,OAAO;QACH0B,YAAY;YACRC,WAAW;YACXC,QAAQ;QACZ;QACAD,WAAWE,oBAAI,CAACC,MAAM,CAACnC,MAAMgC,SAAS,EAAE;YACpCI,cAAc;gBACV,aAAa;gBACbC,UAAUP;YACd;YACAQ,aAAa;QACjB;QACAL,QAAQC,oBAAI,CAACC,MAAM,CAACnC,MAAMiC,MAAM,EAAE;YAC9BG,cAAc;gBACV,aAAa;gBACbC,UAAUR;YACd;YACAS,aAAa;QACjB;IACJ;AACJ"}
|
|
@@ -13,7 +13,7 @@ const _reactutilities = require("@fluentui/react-utilities");
|
|
|
13
13
|
const _reacttransitiongroup = require("react-transition-group");
|
|
14
14
|
const _toastContainerContext = require("../../contexts/toastContainerContext");
|
|
15
15
|
const renderToastContainer_unstable = (state, contextValues)=>{
|
|
16
|
-
const { onTransitionEntering, visible, transitionTimeout, remove, nodeRef } = state;
|
|
16
|
+
const { onTransitionEntering, visible, transitionTimeout, remove, nodeRef, updateId } = state;
|
|
17
17
|
(0, _reactutilities.assertSlots)(state);
|
|
18
18
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacttransitiongroup.Transition, {
|
|
19
19
|
in: visible,
|
|
@@ -27,7 +27,7 @@ const renderToastContainer_unstable = (state, contextValues)=>{
|
|
|
27
27
|
value: contextValues.toast,
|
|
28
28
|
children: [
|
|
29
29
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(state.root, {}),
|
|
30
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(state.timer, {})
|
|
30
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(state.timer, {}, updateId)
|
|
31
31
|
]
|
|
32
32
|
})
|
|
33
33
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderToastContainer.js"],"sourcesContent":[" import { jsx as _jsx, jsxs as _jsxs } from \"@fluentui/react-jsx-runtime/jsx-runtime\";\nimport { assertSlots } from '@fluentui/react-utilities';\nimport { Transition } from 'react-transition-group';\nimport { ToastContainerContextProvider } from '../../contexts/toastContainerContext';\n/**\n * Render the final JSX of ToastContainer\n */ export const renderToastContainer_unstable = (state, contextValues)=>{\n const { onTransitionEntering, visible, transitionTimeout, remove, nodeRef } = state;\n assertSlots(state);\n return /*#__PURE__*/ _jsx(Transition, {\n in: visible,\n appear: true,\n unmountOnExit: true,\n timeout: transitionTimeout,\n onExited: remove,\n onEntering: onTransitionEntering,\n nodeRef: nodeRef,\n children: /*#__PURE__*/ _jsxs(ToastContainerContextProvider, {\n value: contextValues.toast,\n children: [\n /*#__PURE__*/ _jsx(state.root, {}),\n /*#__PURE__*/ _jsx(state.timer, {})\n ]\n })\n });\n};\n"],"names":["renderToastContainer_unstable","state","contextValues","onTransitionEntering","visible","transitionTimeout","remove","nodeRef","assertSlots","_jsx","Transition","in","appear","unmountOnExit","timeout","onExited","onEntering","children","_jsxs","ToastContainerContextProvider","value","toast","root","timer"],"mappings":";;;;+BAMiBA;;;eAAAA;;;4BAN4B;gCACjB;sCACD;uCACmB;AAGnC,MAAMA,gCAAgC,CAACC,OAAOC;IACrD,MAAM,EAAEC,oBAAoB,EAAEC,OAAO,EAAEC,iBAAiB,EAAEC,MAAM,EAAEC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"sources":["renderToastContainer.js"],"sourcesContent":[" import { jsx as _jsx, jsxs as _jsxs } from \"@fluentui/react-jsx-runtime/jsx-runtime\";\nimport { assertSlots } from '@fluentui/react-utilities';\nimport { Transition } from 'react-transition-group';\nimport { ToastContainerContextProvider } from '../../contexts/toastContainerContext';\n/**\n * Render the final JSX of ToastContainer\n */ export const renderToastContainer_unstable = (state, contextValues)=>{\n const { onTransitionEntering, visible, transitionTimeout, remove, nodeRef, updateId } = state;\n assertSlots(state);\n return /*#__PURE__*/ _jsx(Transition, {\n in: visible,\n appear: true,\n unmountOnExit: true,\n timeout: transitionTimeout,\n onExited: remove,\n onEntering: onTransitionEntering,\n nodeRef: nodeRef,\n children: /*#__PURE__*/ _jsxs(ToastContainerContextProvider, {\n value: contextValues.toast,\n children: [\n /*#__PURE__*/ _jsx(state.root, {}),\n /*#__PURE__*/ _jsx(state.timer, {}, updateId)\n ]\n })\n });\n};\n"],"names":["renderToastContainer_unstable","state","contextValues","onTransitionEntering","visible","transitionTimeout","remove","nodeRef","updateId","assertSlots","_jsx","Transition","in","appear","unmountOnExit","timeout","onExited","onEntering","children","_jsxs","ToastContainerContextProvider","value","toast","root","timer"],"mappings":";;;;+BAMiBA;;;eAAAA;;;4BAN4B;gCACjB;sCACD;uCACmB;AAGnC,MAAMA,gCAAgC,CAACC,OAAOC;IACrD,MAAM,EAAEC,oBAAoB,EAAEC,OAAO,EAAEC,iBAAiB,EAAEC,MAAM,EAAEC,OAAO,EAAEC,QAAQ,EAAE,GAAGP;IACxFQ,IAAAA,2BAAW,EAACR;IACZ,OAAO,WAAW,GAAGS,IAAAA,eAAI,EAACC,gCAAU,EAAE;QAClCC,IAAIR;QACJS,QAAQ;QACRC,eAAe;QACfC,SAASV;QACTW,UAAUV;QACVW,YAAYd;QACZI,SAASA;QACTW,UAAU,WAAW,GAAGC,IAAAA,gBAAK,EAACC,oDAA6B,EAAE;YACzDC,OAAOnB,cAAcoB,KAAK;YAC1BJ,UAAU;gBACN,WAAW,GAAGR,IAAAA,eAAI,EAACT,MAAMsB,IAAI,EAAE,CAAC;gBAChC,WAAW,GAAGb,IAAAA,eAAI,EAACT,MAAMuB,KAAK,EAAE,CAAC,GAAGhB;aACvC;QACL;IACJ;AACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useToastContainer.js"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, useMergedRefs, useEventCallback, useId, slot } from '@fluentui/react-utilities';\nimport { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport { Delete, Tab } from '@fluentui/keyboard-keys';\nimport { useFocusableGroup, useFocusFinders } from '@fluentui/react-tabster';\nimport { Timer } from '../Timer/Timer';\nconst intentPolitenessMap = {\n success: 'assertive',\n warning: 'assertive',\n error: 'assertive',\n info: 'polite'\n};\n/**\n * Create the state required to render ToastContainer.\n *\n * The returned state can be modified with hooks such as useToastContainerStyles_unstable,\n * before being passed to renderToastContainer_unstable.\n *\n * @param props - props from this instance of ToastContainer\n * @param ref - reference to root HTMLElement of ToastContainer\n */ export const useToastContainer_unstable = (props, ref)=>{\n const { visible, children, close: closeProp, remove, updateId, announce, data, timeout: timerTimeout, politeness: desiredPoliteness, intent = 'info', pauseOnHover, pauseOnWindowBlur, imperativeRef, tryRestoreFocus, ...rest } = props;\n const titleId = useId('toast-title');\n const bodyId = useId('toast-body');\n const toastRef = React.useRef(null);\n const { targetDocument } = useFluent_unstable();\n const [running, setRunning] = React.useState(false);\n const imperativePauseRef = React.useRef(false);\n const focusedToastBeforeClose = React.useRef(false);\n const focusableGroupAttribute = useFocusableGroup({\n tabBehavior: 'limited-trap-focus',\n // Users should only use Tab to focus into the toast\n // Escape is already reserved to dismiss all toasts\n ignoreDefaultKeydown: {\n Tab: true,\n Escape: true,\n Enter: true\n }\n });\n const close = useEventCallback(()=>{\n var _toastRef_current;\n const activeElement = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement;\n if (activeElement && ((_toastRef_current = toastRef.current) === null || _toastRef_current === void 0 ? void 0 : _toastRef_current.contains(activeElement))) {\n focusedToastBeforeClose.current = true;\n }\n closeProp();\n });\n const onStatusChange = useEventCallback((status)=>{\n var _props_onStatusChange;\n return (_props_onStatusChange = props.onStatusChange) === null || _props_onStatusChange === void 0 ? void 0 : _props_onStatusChange.call(props, null, {\n status,\n ...props\n });\n });\n const pause = useEventCallback(()=>setRunning(false));\n const play = useEventCallback(()=>{\n var _toastRef_current;\n if (imperativePauseRef.current) {\n return;\n }\n var _targetDocument_activeElement;\n const containsActive = !!((_toastRef_current = toastRef.current) === null || _toastRef_current === void 0 ? void 0 : _toastRef_current.contains((_targetDocument_activeElement = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement) !== null && _targetDocument_activeElement !== void 0 ? _targetDocument_activeElement : null));\n if (timerTimeout < 0) {\n setRunning(true);\n return;\n }\n if (!containsActive) {\n setRunning(true);\n }\n });\n React.useImperativeHandle(imperativeRef, ()=>({\n focus: ()=>{\n if (!toastRef.current) {\n return;\n }\n toastRef.current.focus();\n },\n play: ()=>{\n imperativePauseRef.current = false;\n play();\n },\n pause: ()=>{\n imperativePauseRef.current = true;\n pause();\n }\n }));\n React.useEffect(()=>{\n return ()=>onStatusChange('unmounted');\n }, [\n onStatusChange\n ]);\n React.useEffect(()=>{\n if (!targetDocument) {\n return;\n }\n if (pauseOnWindowBlur) {\n var _targetDocument_defaultView, _targetDocument_defaultView1;\n (_targetDocument_defaultView = targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.addEventListener('focus', play);\n (_targetDocument_defaultView1 = targetDocument.defaultView) === null || _targetDocument_defaultView1 === void 0 ? void 0 : _targetDocument_defaultView1.addEventListener('blur', pause);\n return ()=>{\n var _targetDocument_defaultView, _targetDocument_defaultView1;\n (_targetDocument_defaultView = targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.removeEventListener('focus', play);\n (_targetDocument_defaultView1 = targetDocument.defaultView) === null || _targetDocument_defaultView1 === void 0 ? void 0 : _targetDocument_defaultView1.removeEventListener('blur', pause);\n };\n }\n }, [\n targetDocument,\n pause,\n play,\n pauseOnWindowBlur\n ]);\n // It's impossible to animate to height: auto in CSS, the actual pixel value must be known\n // Get the height of the toast before animation styles have been applied and set a CSS\n // variable with its height. The CSS variable will be used by the styles\n const onTransitionEntering = ()=>{\n if (!toastRef.current) {\n return;\n }\n const element = toastRef.current;\n element.style.setProperty('--fui-toast-height', `${element.scrollHeight}px`);\n };\n // Users never actually use ToastContainer as a JSX but imperatively through useToastContainerController\n const userRootSlot = data.root;\n // Using a ref callback here because addEventListener supports `once`\n const toastAnimationRef = React.useCallback((el)=>{\n if (el && toastRef.current) {\n toastRef.current.addEventListener('animationend', ()=>{\n // start toast once it's fully animated in\n play();\n onStatusChange('visible');\n }, {\n once: true\n });\n }\n }, [\n play,\n onStatusChange\n ]);\n const onMouseEnter = useEventCallback((e)=>{\n var _userRootSlot_onMouseEnter;\n pause();\n userRootSlot === null || userRootSlot === void 0 ? void 0 : (_userRootSlot_onMouseEnter = userRootSlot.onMouseEnter) === null || _userRootSlot_onMouseEnter === void 0 ? void 0 : _userRootSlot_onMouseEnter.call(userRootSlot, e);\n });\n const onMouseLeave = useEventCallback((e)=>{\n var _userRootSlot_onMouseEnter;\n play();\n userRootSlot === null || userRootSlot === void 0 ? void 0 : (_userRootSlot_onMouseEnter = userRootSlot.onMouseEnter) === null || _userRootSlot_onMouseEnter === void 0 ? void 0 : _userRootSlot_onMouseEnter.call(userRootSlot, e);\n });\n const { findFirstFocusable, findLastFocusable } = useFocusFinders();\n const onKeyDown = useEventCallback((e)=>{\n var _userRootSlot_onKeyDown;\n if (e.key === Delete) {\n e.preventDefault();\n close();\n }\n if (e.key === Tab && e.currentTarget === e.target) {\n e.preventDefault();\n if (e.shiftKey) {\n var _findLastFocusable;\n (_findLastFocusable = findLastFocusable(e.currentTarget)) === null || _findLastFocusable === void 0 ? void 0 : _findLastFocusable.focus();\n } else {\n var _findFirstFocusable;\n (_findFirstFocusable = findFirstFocusable(e.currentTarget)) === null || _findFirstFocusable === void 0 ? void 0 : _findFirstFocusable.focus();\n }\n }\n userRootSlot === null || userRootSlot === void 0 ? void 0 : (_userRootSlot_onKeyDown = userRootSlot.onKeyDown) === null || _userRootSlot_onKeyDown === void 0 ? void 0 : _userRootSlot_onKeyDown.call(userRootSlot, e);\n });\n React.useEffect(()=>{\n var _toastRef_current;\n if (!visible) {\n return;\n }\n const politeness = desiredPoliteness !== null && desiredPoliteness !== void 0 ? desiredPoliteness : intentPolitenessMap[intent];\n var _toastRef_current_textContent;\n announce((_toastRef_current_textContent = (_toastRef_current = toastRef.current) === null || _toastRef_current === void 0 ? void 0 : _toastRef_current.textContent) !== null && _toastRef_current_textContent !== void 0 ? _toastRef_current_textContent : '', {\n politeness\n });\n }, [\n announce,\n desiredPoliteness,\n toastRef,\n visible,\n updateId,\n intent\n ]);\n React.useEffect(()=>{\n return ()=>{\n if (focusedToastBeforeClose.current) {\n focusedToastBeforeClose.current = false;\n tryRestoreFocus();\n }\n };\n }, [\n tryRestoreFocus\n ]);\n return {\n components: {\n timer: Timer,\n root: 'div'\n },\n timer: slot.always({\n key: updateId,\n onTimeout: close,\n running,\n timeout: timerTimeout !== null && timerTimeout !== void 0 ? timerTimeout : -1\n }, {\n elementType: Timer\n }),\n root: slot.always(getIntrinsicElementProps('div', {\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: useMergedRefs(ref, toastRef, toastAnimationRef),\n children,\n tabIndex: 0,\n role: 'listitem',\n 'aria-labelledby': titleId,\n 'aria-describedby': bodyId,\n ...rest,\n ...userRootSlot,\n ...focusableGroupAttribute,\n onMouseEnter,\n onMouseLeave,\n onKeyDown\n }), {\n elementType: 'div'\n }),\n timerTimeout,\n transitionTimeout: 500,\n running,\n visible,\n remove,\n close,\n onTransitionEntering,\n updateId,\n nodeRef: toastRef,\n intent,\n titleId,\n bodyId\n };\n};\n"],"names":["useToastContainer_unstable","intentPolitenessMap","success","warning","error","info","props","ref","visible","children","close","closeProp","remove","updateId","announce","data","timeout","timerTimeout","politeness","desiredPoliteness","intent","pauseOnHover","pauseOnWindowBlur","imperativeRef","tryRestoreFocus","rest","titleId","useId","bodyId","toastRef","React","useRef","targetDocument","useFluent_unstable","running","setRunning","useState","imperativePauseRef","focusedToastBeforeClose","focusableGroupAttribute","useFocusableGroup","tabBehavior","ignoreDefaultKeydown","Tab","Escape","Enter","useEventCallback","_toastRef_current","activeElement","current","contains","onStatusChange","status","_props_onStatusChange","call","pause","play","_targetDocument_activeElement","containsActive","useImperativeHandle","focus","useEffect","_targetDocument_defaultView","_targetDocument_defaultView1","defaultView","addEventListener","removeEventListener","onTransitionEntering","element","style","setProperty","scrollHeight","userRootSlot","root","toastAnimationRef","useCallback","el","once","onMouseEnter","e","_userRootSlot_onMouseEnter","onMouseLeave","findFirstFocusable","findLastFocusable","useFocusFinders","onKeyDown","_userRootSlot_onKeyDown","key","Delete","preventDefault","currentTarget","target","shiftKey","_findLastFocusable","_findFirstFocusable","_toastRef_current_textContent","textContent","components","timer","Timer","slot","always","onTimeout","elementType","getIntrinsicElementProps","useMergedRefs","tabIndex","role","transitionTimeout","nodeRef"],"mappings":";;;;+BAoBiBA;;;eAAAA;;;;iEApBM;gCACgE;qCACpD;8BACP;8BACuB;uBAC7B;AACtB,MAAMC,sBAAsB;IACxBC,SAAS;IACTC,SAAS;IACTC,OAAO;IACPC,MAAM;AACV;AASW,MAAML,6BAA6B,CAACM,OAAOC;IAClD,MAAM,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,OAAOC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,IAAI,EAAEC,SAASC,YAAY,EAAEC,YAAYC,iBAAiB,EAAEC,SAAS,MAAM,EAAEC,Y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AO,AAAD,MAAO,QAAQF,sBAAsB,KAAK,IAAI,KAAK,IAAIA,kBAAkBiD,WAAW,AAAD,MAAO,QAAQD,kCAAkC,KAAK,IAAIA,gCAAgC,IAAI;YAC3P7E;QACJ;IACJ,GAAG;QACCJ;QACAK;QACAU;QACArB;QACAK;QACAO;KACH;IACDU,OAAM+B,SAAS,CAAC;QACZ,OAAO;YACH,IAAIvB,wBAAwBW,OAAO,EAAE;gBACjCX,wBAAwBW,OAAO,GAAG;gBAClCzB;YACJ;QACJ;IACJ,GAAG;QACCA;KACH;IACD,OAAO;QACHyE,YAAY;YACRC,OAAOC,YAAK;YACZ1B,MAAM;QACV;QACAyB,OAAOE,oBAAI,CAACC,MAAM,CAAC;YACfd,KAAK1E;YACLyF,WAAW5F;YACXwB;YACAlB,SAASC,iBAAiB,QAAQA,iBAAiB,KAAK,IAAIA,eAAe,CAAC;QAChF,GAAG;YACCsF,aAAaJ,YAAK;QACtB;QACA1B,MAAM2B,oBAAI,CAACC,MAAM,CAACG,IAAAA,wCAAwB,EAAC,OAAO;YAC9C,SAAS;YACT,4EAA4E;YAC5E,4FAA4F;YAC5FjG,KAAKkG,IAAAA,6BAAa,EAAClG,KAAKsB,UAAU6C;YAClCjE;YACAiG,UAAU;YACVC,MAAM;YACN,mBAAmBjF;YACnB,oBAAoBE;YACpB,GAAGH,IAAI;YACP,GAAG+C,YAAY;YACf,GAAGjC,uBAAuB;YAC1BuC;YACAG;YACAI;QACJ,IAAI;YACAkB,aAAa;QACjB;QACAtF;QACA2F,mBAAmB;QACnB1E;QACA1B;QACAI;QACAF;QACAyD;QACAtD;QACAgG,SAAShF;QACTT;QACAM;QACAE;IACJ;AACJ"}
|
|
1
|
+
{"version":3,"sources":["useToastContainer.js"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, useMergedRefs, useEventCallback, useId, slot } from '@fluentui/react-utilities';\nimport { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport { Delete, Tab } from '@fluentui/keyboard-keys';\nimport { useFocusableGroup, useFocusFinders } from '@fluentui/react-tabster';\nimport { Timer } from '../Timer/Timer';\nconst intentPolitenessMap = {\n success: 'assertive',\n warning: 'assertive',\n error: 'assertive',\n info: 'polite'\n};\n/**\n * Create the state required to render ToastContainer.\n *\n * The returned state can be modified with hooks such as useToastContainerStyles_unstable,\n * before being passed to renderToastContainer_unstable.\n *\n * @param props - props from this instance of ToastContainer\n * @param ref - reference to root HTMLElement of ToastContainer\n */ export const useToastContainer_unstable = (props, ref)=>{\n const { visible, children, close: closeProp, remove, updateId, announce, data, timeout: timerTimeout, politeness: desiredPoliteness, intent = 'info', pauseOnHover, pauseOnWindowBlur, imperativeRef, tryRestoreFocus, ...rest } = props;\n const titleId = useId('toast-title');\n const bodyId = useId('toast-body');\n const toastRef = React.useRef(null);\n const { targetDocument } = useFluent_unstable();\n const [running, setRunning] = React.useState(false);\n const imperativePauseRef = React.useRef(false);\n const focusedToastBeforeClose = React.useRef(false);\n const focusableGroupAttribute = useFocusableGroup({\n tabBehavior: 'limited-trap-focus',\n // Users should only use Tab to focus into the toast\n // Escape is already reserved to dismiss all toasts\n ignoreDefaultKeydown: {\n Tab: true,\n Escape: true,\n Enter: true\n }\n });\n const close = useEventCallback(()=>{\n var _toastRef_current;\n const activeElement = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement;\n if (activeElement && ((_toastRef_current = toastRef.current) === null || _toastRef_current === void 0 ? void 0 : _toastRef_current.contains(activeElement))) {\n focusedToastBeforeClose.current = true;\n }\n closeProp();\n });\n const onStatusChange = useEventCallback((status)=>{\n var _props_onStatusChange;\n return (_props_onStatusChange = props.onStatusChange) === null || _props_onStatusChange === void 0 ? void 0 : _props_onStatusChange.call(props, null, {\n status,\n ...props\n });\n });\n const pause = useEventCallback(()=>setRunning(false));\n const play = useEventCallback(()=>{\n var _toastRef_current;\n if (imperativePauseRef.current) {\n return;\n }\n var _targetDocument_activeElement;\n const containsActive = !!((_toastRef_current = toastRef.current) === null || _toastRef_current === void 0 ? void 0 : _toastRef_current.contains((_targetDocument_activeElement = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement) !== null && _targetDocument_activeElement !== void 0 ? _targetDocument_activeElement : null));\n if (timerTimeout < 0) {\n setRunning(true);\n return;\n }\n if (!containsActive) {\n setRunning(true);\n }\n });\n React.useImperativeHandle(imperativeRef, ()=>({\n focus: ()=>{\n if (!toastRef.current) {\n return;\n }\n toastRef.current.focus();\n },\n play: ()=>{\n imperativePauseRef.current = false;\n play();\n },\n pause: ()=>{\n imperativePauseRef.current = true;\n pause();\n }\n }));\n React.useEffect(()=>{\n return ()=>onStatusChange('unmounted');\n }, [\n onStatusChange\n ]);\n React.useEffect(()=>{\n if (!targetDocument) {\n return;\n }\n if (pauseOnWindowBlur) {\n var _targetDocument_defaultView, _targetDocument_defaultView1;\n (_targetDocument_defaultView = targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.addEventListener('focus', play);\n (_targetDocument_defaultView1 = targetDocument.defaultView) === null || _targetDocument_defaultView1 === void 0 ? void 0 : _targetDocument_defaultView1.addEventListener('blur', pause);\n return ()=>{\n var _targetDocument_defaultView, _targetDocument_defaultView1;\n (_targetDocument_defaultView = targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.removeEventListener('focus', play);\n (_targetDocument_defaultView1 = targetDocument.defaultView) === null || _targetDocument_defaultView1 === void 0 ? void 0 : _targetDocument_defaultView1.removeEventListener('blur', pause);\n };\n }\n }, [\n targetDocument,\n pause,\n play,\n pauseOnWindowBlur\n ]);\n // It's impossible to animate to height: auto in CSS, the actual pixel value must be known\n // Get the height of the toast before animation styles have been applied and set a CSS\n // variable with its height. The CSS variable will be used by the styles\n const onTransitionEntering = ()=>{\n if (!toastRef.current) {\n return;\n }\n const element = toastRef.current;\n element.style.setProperty('--fui-toast-height', `${element.scrollHeight}px`);\n };\n // Users never actually use ToastContainer as a JSX but imperatively through useToastContainerController\n const userRootSlot = data.root;\n // Using a ref callback here because addEventListener supports `once`\n const toastAnimationRef = React.useCallback((el)=>{\n if (el && toastRef.current) {\n toastRef.current.addEventListener('animationend', ()=>{\n // start toast once it's fully animated in\n play();\n onStatusChange('visible');\n }, {\n once: true\n });\n }\n }, [\n play,\n onStatusChange\n ]);\n const onMouseEnter = useEventCallback((e)=>{\n var _userRootSlot_onMouseEnter;\n pause();\n userRootSlot === null || userRootSlot === void 0 ? void 0 : (_userRootSlot_onMouseEnter = userRootSlot.onMouseEnter) === null || _userRootSlot_onMouseEnter === void 0 ? void 0 : _userRootSlot_onMouseEnter.call(userRootSlot, e);\n });\n const onMouseLeave = useEventCallback((e)=>{\n var _userRootSlot_onMouseEnter;\n play();\n userRootSlot === null || userRootSlot === void 0 ? void 0 : (_userRootSlot_onMouseEnter = userRootSlot.onMouseEnter) === null || _userRootSlot_onMouseEnter === void 0 ? void 0 : _userRootSlot_onMouseEnter.call(userRootSlot, e);\n });\n const { findFirstFocusable, findLastFocusable } = useFocusFinders();\n const onKeyDown = useEventCallback((e)=>{\n var _userRootSlot_onKeyDown;\n if (e.key === Delete) {\n e.preventDefault();\n close();\n }\n if (e.key === Tab && e.currentTarget === e.target) {\n e.preventDefault();\n if (e.shiftKey) {\n var _findLastFocusable;\n (_findLastFocusable = findLastFocusable(e.currentTarget)) === null || _findLastFocusable === void 0 ? void 0 : _findLastFocusable.focus();\n } else {\n var _findFirstFocusable;\n (_findFirstFocusable = findFirstFocusable(e.currentTarget)) === null || _findFirstFocusable === void 0 ? void 0 : _findFirstFocusable.focus();\n }\n }\n userRootSlot === null || userRootSlot === void 0 ? void 0 : (_userRootSlot_onKeyDown = userRootSlot.onKeyDown) === null || _userRootSlot_onKeyDown === void 0 ? void 0 : _userRootSlot_onKeyDown.call(userRootSlot, e);\n });\n React.useEffect(()=>{\n var _toastRef_current;\n if (!visible) {\n return;\n }\n const politeness = desiredPoliteness !== null && desiredPoliteness !== void 0 ? desiredPoliteness : intentPolitenessMap[intent];\n var _toastRef_current_textContent;\n announce((_toastRef_current_textContent = (_toastRef_current = toastRef.current) === null || _toastRef_current === void 0 ? void 0 : _toastRef_current.textContent) !== null && _toastRef_current_textContent !== void 0 ? _toastRef_current_textContent : '', {\n politeness\n });\n }, [\n announce,\n desiredPoliteness,\n toastRef,\n visible,\n updateId,\n intent\n ]);\n React.useEffect(()=>{\n return ()=>{\n if (focusedToastBeforeClose.current) {\n focusedToastBeforeClose.current = false;\n tryRestoreFocus();\n }\n };\n }, [\n tryRestoreFocus\n ]);\n return {\n components: {\n timer: Timer,\n root: 'div'\n },\n timer: slot.always({\n onTimeout: close,\n running,\n timeout: timerTimeout !== null && timerTimeout !== void 0 ? timerTimeout : -1\n }, {\n elementType: Timer\n }),\n root: slot.always(getIntrinsicElementProps('div', {\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: useMergedRefs(ref, toastRef, toastAnimationRef),\n children,\n tabIndex: 0,\n role: 'listitem',\n 'aria-labelledby': titleId,\n 'aria-describedby': bodyId,\n ...rest,\n ...userRootSlot,\n ...focusableGroupAttribute,\n onMouseEnter,\n onMouseLeave,\n onKeyDown\n }), {\n elementType: 'div'\n }),\n timerTimeout,\n transitionTimeout: 500,\n running,\n visible,\n remove,\n close,\n onTransitionEntering,\n updateId,\n nodeRef: toastRef,\n intent,\n titleId,\n bodyId\n };\n};\n"],"names":["useToastContainer_unstable","intentPolitenessMap","success","warning","error","info","props","ref","visible","children","close","closeProp","remove","updateId","announce","data","timeout","timerTimeout","politeness","desiredPoliteness","intent","pauseOnHover","pauseOnWindowBlur","imperativeRef","tryRestoreFocus","rest","titleId","useId","bodyId","toastRef","React","useRef","targetDocument","useFluent_unstable","running","setRunning","useState","imperativePauseRef","focusedToastBeforeClose","focusableGroupAttribute","useFocusableGroup","tabBehavior","ignoreDefaultKeydown","Tab","Escape","Enter","useEventCallback","_toastRef_current","activeElement","current","contains","onStatusChange","status","_props_onStatusChange","call","pause","play","_targetDocument_activeElement","containsActive","useImperativeHandle","focus","useEffect","_targetDocument_defaultView","_targetDocument_defaultView1","defaultView","addEventListener","removeEventListener","onTransitionEntering","element","style","setProperty","scrollHeight","userRootSlot","root","toastAnimationRef","useCallback","el","once","onMouseEnter","e","_userRootSlot_onMouseEnter","onMouseLeave","findFirstFocusable","findLastFocusable","useFocusFinders","onKeyDown","_userRootSlot_onKeyDown","key","Delete","preventDefault","currentTarget","target","shiftKey","_findLastFocusable","_findFirstFocusable","_toastRef_current_textContent","textContent","components","timer","Timer","slot","always","onTimeout","elementType","getIntrinsicElementProps","useMergedRefs","tabIndex","role","transitionTimeout","nodeRef"],"mappings":";;;;+BAoBiBA;;;eAAAA;;;;iEApBM;gCACgE;qCACpD;8BACP;8BACuB;uBAC7B;AACtB,MAAMC,sBAAsB;IACxBC,SAAS;IACTC,SAAS;IACTC,OAAO;IACPC,MAAM;AACV;AASW,MAAML,6BAA6B,CAACM,OAAOC;IAClD,MAAM,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,OAAOC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,IAAI,EAAEC,SAASC,YAAY,EAAEC,YAAYC,iBAAiB,EAAEC,SAAS,MAAM,EAAEC,YAAY,EAAEC,iBAAiB,EAAEC,aAAa,EAAEC,eAAe,EAAE,GAAGC,MAAM,GAAGnB;IACnO,MAAMoB,UAAUC,IAAAA,qBAAK,EAAC;IACtB,MAAMC,SAASD,IAAAA,qBAAK,EAAC;IACrB,MAAME,WAAWC,OAAMC,MAAM,CAAC;IAC9B,MAAM,EAAEC,cAAc,EAAE,GAAGC,IAAAA,uCAAkB;IAC7C,MAAM,CAACC,SAASC,WAAW,GAAGL,OAAMM,QAAQ,CAAC;IAC7C,MAAMC,qBAAqBP,OAAMC,MAAM,CAAC;IACxC,MAAMO,0BAA0BR,OAAMC,MAAM,CAAC;IAC7C,MA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QACV;QACAyB,OAAOE,oBAAI,CAACC,MAAM,CAAC;YACfC,WAAW5F;YACXwB;YACAlB,SAASC,iBAAiB,QAAQA,iBAAiB,KAAK,IAAIA,eAAe,CAAC;QAChF,GAAG;YACCsF,aAAaJ,YAAK;QACtB;QACA1B,MAAM2B,oBAAI,CAACC,MAAM,CAACG,IAAAA,wCAAwB,EAAC,OAAO;YAC9C,SAAS;YACT,4EAA4E;YAC5E,4FAA4F;YAC5FjG,KAAKkG,IAAAA,6BAAa,EAAClG,KAAKsB,UAAU6C;YAClCjE;YACAiG,UAAU;YACVC,MAAM;YACN,mBAAmBjF;YACnB,oBAAoBE;YACpB,GAAGH,IAAI;YACP,GAAG+C,YAAY;YACf,GAAGjC,uBAAuB;YAC1BuC;YACAG;YACAI;QACJ,IAAI;YACAkB,aAAa;QACjB;QACAtF;QACA2F,mBAAmB;QACnB1E;QACA1B;QACAI;QACAF;QACAyD;QACAtD;QACAgG,SAAShF;QACTT;QACAM;QACAE;IACJ;AACJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-toast",
|
|
3
|
-
"version": "9.3.
|
|
3
|
+
"version": "9.3.40",
|
|
4
4
|
"description": "Toast component for Fluent UI",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -37,14 +37,14 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"react-transition-group": "^4.4.1",
|
|
39
39
|
"@fluentui/keyboard-keys": "^9.0.7",
|
|
40
|
-
"@fluentui/react-aria": "^9.
|
|
41
|
-
"@fluentui/react-icons": "^2.0.
|
|
42
|
-
"@fluentui/react-jsx-runtime": "^9.0.
|
|
43
|
-
"@fluentui/react-portal": "^9.4.
|
|
44
|
-
"@fluentui/react-shared-contexts": "^9.
|
|
45
|
-
"@fluentui/react-tabster": "^9.
|
|
40
|
+
"@fluentui/react-aria": "^9.11.1",
|
|
41
|
+
"@fluentui/react-icons": "^2.0.237",
|
|
42
|
+
"@fluentui/react-jsx-runtime": "^9.0.37",
|
|
43
|
+
"@fluentui/react-portal": "^9.4.23",
|
|
44
|
+
"@fluentui/react-shared-contexts": "^9.18.0",
|
|
45
|
+
"@fluentui/react-tabster": "^9.21.1",
|
|
46
46
|
"@fluentui/react-theme": "^9.1.19",
|
|
47
|
-
"@fluentui/react-utilities": "^9.18.
|
|
47
|
+
"@fluentui/react-utilities": "^9.18.8",
|
|
48
48
|
"@griffel/react": "^1.5.14",
|
|
49
49
|
"@swc/helpers": "^0.5.1"
|
|
50
50
|
},
|