@fluentui/react-toast 9.0.6 → 9.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +115 -1
- package/CHANGELOG.md +34 -2
- package/lib/components/AriaLive/renderAriaLive.js +3 -3
- package/lib/components/AriaLive/renderAriaLive.js.map +1 -1
- package/lib/components/AriaLive/useAriaLive.js +7 -7
- package/lib/components/AriaLive/useAriaLive.js.map +1 -1
- package/lib/components/Timer/useTimerStyles.styles.js +1 -1
- package/lib/components/Timer/useTimerStyles.styles.js.map +1 -1
- package/lib/components/Toast/renderToast.js +3 -3
- package/lib/components/Toast/renderToast.js.map +1 -1
- package/lib/components/Toast/useToast.js +4 -2
- package/lib/components/Toast/useToast.js.map +1 -1
- package/lib/components/Toast/useToastStyles.styles.js +1 -1
- package/lib/components/Toast/useToastStyles.styles.js.map +1 -1
- package/lib/components/ToastBody/renderToastBody.js +3 -3
- package/lib/components/ToastBody/renderToastBody.js.map +1 -1
- package/lib/components/ToastBody/useToastBody.js +7 -3
- package/lib/components/ToastBody/useToastBody.js.map +1 -1
- package/lib/components/ToastBody/useToastBodyStyles.styles.js +2 -2
- package/lib/components/ToastBody/useToastBodyStyles.styles.js.map +1 -1
- package/lib/components/ToastContainer/renderToastContainer.js +3 -3
- package/lib/components/ToastContainer/renderToastContainer.js.map +1 -1
- package/lib/components/ToastContainer/useToastContainer.js +34 -15
- package/lib/components/ToastContainer/useToastContainer.js.map +1 -1
- package/lib/components/ToastContainer/useToastContainerStyles.styles.js +4 -4
- package/lib/components/ToastContainer/useToastContainerStyles.styles.js.map +1 -1
- package/lib/components/ToastFooter/renderToastFooter.js +3 -3
- package/lib/components/ToastFooter/renderToastFooter.js.map +1 -1
- package/lib/components/ToastFooter/useToastFooter.js +4 -2
- package/lib/components/ToastFooter/useToastFooter.js.map +1 -1
- package/lib/components/ToastFooter/useToastFooterStyles.styles.js +1 -1
- package/lib/components/ToastFooter/useToastFooterStyles.styles.js.map +1 -1
- package/lib/components/ToastTitle/renderToastTitle.js +3 -3
- package/lib/components/ToastTitle/renderToastTitle.js.map +1 -1
- package/lib/components/ToastTitle/useToastTitle.js +11 -6
- package/lib/components/ToastTitle/useToastTitle.js.map +1 -1
- package/lib/components/ToastTitle/useToastTitleStyles.styles.js +3 -3
- package/lib/components/ToastTitle/useToastTitleStyles.styles.js.map +1 -1
- package/lib/components/Toaster/renderToaster.js +4 -4
- package/lib/components/Toaster/renderToaster.js.map +1 -1
- package/lib/components/Toaster/useToastAnnounce.js +47 -0
- package/lib/components/Toaster/useToastAnnounce.js.map +1 -0
- package/lib/components/Toaster/useToaster.js +40 -35
- package/lib/components/Toaster/useToaster.js.map +1 -1
- package/lib/components/Toaster/useToasterFocusManagement.js +85 -0
- package/lib/components/Toaster/useToasterFocusManagement.js.map +1 -0
- package/lib/state/useToaster.js +24 -6
- package/lib/state/useToaster.js.map +1 -1
- package/lib-commonjs/components/AriaLive/renderAriaLive.js +2 -2
- package/lib-commonjs/components/AriaLive/renderAriaLive.js.map +1 -1
- package/lib-commonjs/components/AriaLive/useAriaLive.js +6 -6
- package/lib-commonjs/components/AriaLive/useAriaLive.js.map +1 -1
- package/lib-commonjs/components/Timer/useTimerStyles.styles.js +3 -5
- package/lib-commonjs/components/Timer/useTimerStyles.styles.js.map +1 -1
- package/lib-commonjs/components/Toast/renderToast.js +2 -2
- package/lib-commonjs/components/Toast/renderToast.js.map +1 -1
- package/lib-commonjs/components/Toast/useToast.js +3 -1
- package/lib-commonjs/components/Toast/useToast.js.map +1 -1
- package/lib-commonjs/components/Toast/useToastStyles.styles.js +2 -2
- package/lib-commonjs/components/Toast/useToastStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ToastBody/renderToastBody.js +2 -2
- package/lib-commonjs/components/ToastBody/renderToastBody.js.map +1 -1
- package/lib-commonjs/components/ToastBody/useToastBody.js +6 -2
- package/lib-commonjs/components/ToastBody/useToastBody.js.map +1 -1
- package/lib-commonjs/components/ToastBody/useToastBodyStyles.styles.js +2 -2
- package/lib-commonjs/components/ToastBody/useToastBodyStyles.styles.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 +33 -14
- package/lib-commonjs/components/ToastContainer/useToastContainer.js.map +1 -1
- package/lib-commonjs/components/ToastContainer/useToastContainerStyles.styles.js +9 -13
- package/lib-commonjs/components/ToastContainer/useToastContainerStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ToastFooter/renderToastFooter.js +2 -2
- package/lib-commonjs/components/ToastFooter/renderToastFooter.js.map +1 -1
- package/lib-commonjs/components/ToastFooter/useToastFooter.js +3 -1
- package/lib-commonjs/components/ToastFooter/useToastFooter.js.map +1 -1
- package/lib-commonjs/components/ToastFooter/useToastFooterStyles.styles.js +1 -1
- package/lib-commonjs/components/ToastFooter/useToastFooterStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ToastTitle/renderToastTitle.js +2 -2
- package/lib-commonjs/components/ToastTitle/renderToastTitle.js.map +1 -1
- package/lib-commonjs/components/ToastTitle/useToastTitle.js +10 -5
- package/lib-commonjs/components/ToastTitle/useToastTitle.js.map +1 -1
- package/lib-commonjs/components/ToastTitle/useToastTitleStyles.styles.js +5 -5
- package/lib-commonjs/components/ToastTitle/useToastTitleStyles.styles.js.map +1 -1
- package/lib-commonjs/components/Toaster/renderToaster.js +3 -3
- package/lib-commonjs/components/Toaster/renderToaster.js.map +1 -1
- package/lib-commonjs/components/Toaster/useToastAnnounce.js +50 -0
- package/lib-commonjs/components/Toaster/useToastAnnounce.js.map +1 -0
- package/lib-commonjs/components/Toaster/useToaster.js +39 -34
- package/lib-commonjs/components/Toaster/useToaster.js.map +1 -1
- package/lib-commonjs/components/Toaster/useToasterFocusManagement.js +92 -0
- package/lib-commonjs/components/Toaster/useToasterFocusManagement.js.map +1 -0
- package/lib-commonjs/state/useToaster.js +24 -6
- package/lib-commonjs/state/useToaster.js.map +1 -1
- package/package.json +10 -9
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { isHTMLElement } from '@fluentui/react-utilities';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
|
|
4
|
+
import { ArrowDown, ArrowUp } from '@fluentui/keyboard-keys';
|
|
5
|
+
import { toastContainerClassNames } from '../ToastContainer';
|
|
6
|
+
const noop = ()=>undefined;
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/ export function useToasterFocusManagement_unstable(pauseAllToasts, playAllToasts) {
|
|
10
|
+
const { targetDocument } = useFluent();
|
|
11
|
+
const cleanupListenersRef = React.useRef(noop);
|
|
12
|
+
return React.useCallback((el)=>{
|
|
13
|
+
if (!el || !targetDocument) {
|
|
14
|
+
cleanupListenersRef.current();
|
|
15
|
+
cleanupListenersRef.current = noop;
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const toastContainerWalker = targetDocument.createTreeWalker(el, NodeFilter.SHOW_ELEMENT, {
|
|
19
|
+
acceptNode (node) {
|
|
20
|
+
if (isHTMLElement(node) && node.classList.contains(toastContainerClassNames.root)) {
|
|
21
|
+
return NodeFilter.FILTER_ACCEPT;
|
|
22
|
+
}
|
|
23
|
+
return NodeFilter.FILTER_SKIP;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* FIXME: https://github.com/microsoft/tabster/issues/299
|
|
28
|
+
* Toasts should be arrow navigable and focus should be trapped in a stack of tasts
|
|
29
|
+
* This is a temporary measure, Tabster does not have an API yet to enable mover arrow keys from within grouppers
|
|
30
|
+
* Once tabster fully supports this use case, remove this hook
|
|
31
|
+
*/ const keydownListener = (e)=>{
|
|
32
|
+
const { target , key } = e;
|
|
33
|
+
if (!isHTMLElement(target)) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (key === ArrowDown) {
|
|
37
|
+
toastContainerWalker.currentNode = target;
|
|
38
|
+
let nextToastContainer = toastContainerWalker.nextNode();
|
|
39
|
+
if (!nextToastContainer) {
|
|
40
|
+
toastContainerWalker.currentNode = el;
|
|
41
|
+
nextToastContainer = toastContainerWalker.nextNode();
|
|
42
|
+
}
|
|
43
|
+
if (isHTMLElement(nextToastContainer)) {
|
|
44
|
+
nextToastContainer.focus();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (key === ArrowUp) {
|
|
48
|
+
toastContainerWalker.currentNode = target;
|
|
49
|
+
let prevToastContainer = toastContainerWalker.previousNode();
|
|
50
|
+
if (prevToastContainer && prevToastContainer.contains(target)) {
|
|
51
|
+
prevToastContainer = toastContainerWalker.previousNode();
|
|
52
|
+
}
|
|
53
|
+
if (!prevToastContainer) {
|
|
54
|
+
toastContainerWalker.currentNode = el;
|
|
55
|
+
prevToastContainer = toastContainerWalker.lastChild();
|
|
56
|
+
}
|
|
57
|
+
if (isHTMLElement(prevToastContainer)) {
|
|
58
|
+
prevToastContainer.focus();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
const focusInListener = (e)=>{
|
|
63
|
+
if (isHTMLElement(e.currentTarget) && !e.currentTarget.contains(isHTMLElement(e.relatedTarget) ? e.relatedTarget : null)) {
|
|
64
|
+
pauseAllToasts();
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const focusOutListener = (e)=>{
|
|
68
|
+
if (isHTMLElement(e.currentTarget) && !e.currentTarget.contains(isHTMLElement(e.relatedTarget) ? e.relatedTarget : null)) {
|
|
69
|
+
playAllToasts();
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
el.addEventListener('keydown', keydownListener);
|
|
73
|
+
el.addEventListener('focusin', focusInListener);
|
|
74
|
+
el.addEventListener('focusout', focusOutListener);
|
|
75
|
+
cleanupListenersRef.current = ()=>{
|
|
76
|
+
el.removeEventListener('keydown', keydownListener);
|
|
77
|
+
el.removeEventListener('focusin', focusInListener);
|
|
78
|
+
el.removeEventListener('focusout', focusOutListener);
|
|
79
|
+
};
|
|
80
|
+
}, [
|
|
81
|
+
targetDocument,
|
|
82
|
+
pauseAllToasts,
|
|
83
|
+
playAllToasts
|
|
84
|
+
]);
|
|
85
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useToasterFocusManagement.ts"],"sourcesContent":["import { isHTMLElement } from '@fluentui/react-utilities';\nimport * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { ArrowDown, ArrowUp } from '@fluentui/keyboard-keys';\nimport { toastContainerClassNames } from '../ToastContainer';\n\nconst noop = () => undefined;\n\n/**\n * @internal\n */\nexport function useToasterFocusManagement_unstable(pauseAllToasts: () => void, playAllToasts: () => void) {\n const { targetDocument } = useFluent();\n const cleanupListenersRef = React.useRef<() => void>(noop);\n\n return React.useCallback(\n (el: HTMLDivElement) => {\n if (!el || !targetDocument) {\n cleanupListenersRef.current();\n cleanupListenersRef.current = noop;\n return;\n }\n\n const toastContainerWalker = targetDocument.createTreeWalker(el, NodeFilter.SHOW_ELEMENT, {\n acceptNode(node: Node) {\n if (isHTMLElement(node) && node.classList.contains(toastContainerClassNames.root)) {\n return NodeFilter.FILTER_ACCEPT;\n }\n\n return NodeFilter.FILTER_SKIP;\n },\n });\n\n /**\n * FIXME: https://github.com/microsoft/tabster/issues/299\n * Toasts should be arrow navigable and focus should be trapped in a stack of tasts\n * This is a temporary measure, Tabster does not have an API yet to enable mover arrow keys from within grouppers\n * Once tabster fully supports this use case, remove this hook\n */\n const keydownListener = (e: KeyboardEvent) => {\n const { target, key } = e;\n if (!isHTMLElement(target)) {\n return;\n }\n\n if (key === ArrowDown) {\n toastContainerWalker.currentNode = target;\n let nextToastContainer = toastContainerWalker.nextNode();\n if (!nextToastContainer) {\n toastContainerWalker.currentNode = el;\n nextToastContainer = toastContainerWalker.nextNode();\n }\n\n if (isHTMLElement(nextToastContainer)) {\n nextToastContainer.focus();\n }\n }\n\n if (key === ArrowUp) {\n toastContainerWalker.currentNode = target;\n let prevToastContainer = toastContainerWalker.previousNode();\n if (prevToastContainer && prevToastContainer.contains(target)) {\n prevToastContainer = toastContainerWalker.previousNode();\n }\n\n if (!prevToastContainer) {\n toastContainerWalker.currentNode = el;\n prevToastContainer = toastContainerWalker.lastChild();\n }\n\n if (isHTMLElement(prevToastContainer)) {\n prevToastContainer.focus();\n }\n }\n };\n\n const focusInListener = (e: FocusEvent) => {\n if (\n isHTMLElement(e.currentTarget) &&\n !e.currentTarget.contains(isHTMLElement(e.relatedTarget) ? e.relatedTarget : null)\n ) {\n pauseAllToasts();\n }\n };\n\n const focusOutListener = (e: FocusEvent) => {\n if (\n isHTMLElement(e.currentTarget) &&\n !e.currentTarget.contains(isHTMLElement(e.relatedTarget) ? e.relatedTarget : null)\n ) {\n playAllToasts();\n }\n };\n\n el.addEventListener('keydown', keydownListener);\n el.addEventListener('focusin', focusInListener);\n el.addEventListener('focusout', focusOutListener);\n\n cleanupListenersRef.current = () => {\n el.removeEventListener('keydown', keydownListener);\n el.removeEventListener('focusin', focusInListener);\n el.removeEventListener('focusout', focusOutListener);\n };\n },\n [targetDocument, pauseAllToasts, playAllToasts],\n );\n}\n"],"names":["isHTMLElement","React","useFluent_unstable","useFluent","ArrowDown","ArrowUp","toastContainerClassNames","noop","undefined","useToasterFocusManagement_unstable","pauseAllToasts","playAllToasts","targetDocument","cleanupListenersRef","useRef","useCallback","el","current","toastContainerWalker","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","node","classList","contains","root","FILTER_ACCEPT","FILTER_SKIP","keydownListener","e","target","key","currentNode","nextToastContainer","nextNode","focus","prevToastContainer","previousNode","lastChild","focusInListener","currentTarget","relatedTarget","focusOutListener","addEventListener","removeEventListener"],"mappings":"AAAA,SAASA,aAAa,QAAQ,4BAA4B;AAC1D,YAAYC,WAAW,QAAQ;AAC/B,SAASC,sBAAsBC,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qBAAqBnB,qBAAqBoB,YAAY;gBAC1D,IAAID,sBAAsBA,mBAAmBZ,QAAQ,CAACM,SAAS;oBAC7DM,qBAAqBnB,qBAAqBoB,YAAY;gBACxD,CAAC;gBAED,IAAI,CAACD,oBAAoB;oBACvBnB,qBAAqBe,WAAW,GAAGjB;oBACnCqB,qBAAqBnB,qBAAqBqB,SAAS;gBACrD,CAAC;gBAED,IAAIvC,cAAcqC,qBAAqB;oBACrCA,mBAAmBD,KAAK;gBAC1B,CAAC;YACH,CAAC;QACH;QAEA,MAAMI,kBAAkB,CAACV,IAAkB;YACzC,IACE9B,cAAc8B,EAAEW,aAAa,KAC7B,CAACX,EAAEW,aAAa,CAAChB,QAAQ,CAACzB,cAAc8B,EAAEY,aAAa,IAAIZ,EAAEY,aAAa,GAAG,IAAI,GACjF;gBACAhC;YACF,CAAC;QACH;QAEA,MAAMiC,mBAAmB,CAACb,IAAkB;YAC1C,IACE9B,cAAc8B,EAAEW,aAAa,KAC7B,CAACX,EAAEW,aAAa,CAAChB,QAAQ,CAACzB,cAAc8B,EAAEY,aAAa,IAAIZ,EAAEY,aAAa,GAAG,IAAI,GACjF;gBACA/B;YACF,CAAC;QACH;QAEAK,GAAG4B,gBAAgB,CAAC,WAAWf;QAC/Bb,GAAG4B,gBAAgB,CAAC,WAAWJ;QAC/BxB,GAAG4B,gBAAgB,CAAC,YAAYD;QAEhC9B,oBAAoBI,OAAO,GAAG,IAAM;YAClCD,GAAG6B,mBAAmB,CAAC,WAAWhB;YAClCb,GAAG6B,mBAAmB,CAAC,WAAWL;YAClCxB,GAAG6B,mBAAmB,CAAC,YAAYF;QACrC;IACF,GACA;QAAC/B;QAAgBF;QAAgBC;KAAc;AAEnD,CAAC"}
|
package/lib/state/useToaster.js
CHANGED
|
@@ -18,11 +18,6 @@ export function useToaster(options = {}) {
|
|
|
18
18
|
return shortcuts.focus(e);
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
|
-
const tryRestoreFocus = React.useCallback(()=>{
|
|
22
|
-
var _lastActiveElementRef_current;
|
|
23
|
-
(_lastActiveElementRef_current = lastActiveElementRef.current) === null || _lastActiveElementRef_current === void 0 ? void 0 : _lastActiveElementRef_current.focus();
|
|
24
|
-
lastActiveElementRef.current = null;
|
|
25
|
-
}, []);
|
|
26
21
|
const pauseAllToasts = React.useCallback(()=>{
|
|
27
22
|
toaster.visibleToasts.forEach((toastId)=>{
|
|
28
23
|
var _toast_imperativeRef_current;
|
|
@@ -58,6 +53,28 @@ export function useToaster(options = {}) {
|
|
|
58
53
|
}, [
|
|
59
54
|
toaster
|
|
60
55
|
]);
|
|
56
|
+
const tryRestoreFocus = React.useCallback(()=>{
|
|
57
|
+
const mostRecentToast = getMostRecentVisibleToast();
|
|
58
|
+
if (mostRecentToast === null || mostRecentToast === void 0 ? void 0 : mostRecentToast.imperativeRef.current) {
|
|
59
|
+
mostRecentToast.imperativeRef.current.focus();
|
|
60
|
+
} else {
|
|
61
|
+
var _lastActiveElementRef_current;
|
|
62
|
+
(_lastActiveElementRef_current = lastActiveElementRef.current) === null || _lastActiveElementRef_current === void 0 ? void 0 : _lastActiveElementRef_current.focus();
|
|
63
|
+
lastActiveElementRef.current = null;
|
|
64
|
+
}
|
|
65
|
+
}, [
|
|
66
|
+
getMostRecentVisibleToast
|
|
67
|
+
]);
|
|
68
|
+
const closeAllToasts = React.useCallback(()=>{
|
|
69
|
+
toaster.visibleToasts.forEach((toastId)=>{
|
|
70
|
+
const toast = toaster.toasts.get(toastId);
|
|
71
|
+
toast === null || toast === void 0 ? void 0 : toast.close();
|
|
72
|
+
});
|
|
73
|
+
tryRestoreFocus();
|
|
74
|
+
}, [
|
|
75
|
+
toaster,
|
|
76
|
+
tryRestoreFocus
|
|
77
|
+
]);
|
|
61
78
|
React.useEffect(()=>{
|
|
62
79
|
if (!targetDocument) {
|
|
63
80
|
return;
|
|
@@ -157,6 +174,7 @@ export function useToaster(options = {}) {
|
|
|
157
174
|
toastsToRender,
|
|
158
175
|
pauseAllToasts,
|
|
159
176
|
playAllToasts,
|
|
160
|
-
tryRestoreFocus
|
|
177
|
+
tryRestoreFocus,
|
|
178
|
+
closeAllToasts
|
|
161
179
|
};
|
|
162
180
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useToaster.ts"],"sourcesContent":["import * as React from 'react';\nimport { isHTMLElement, useEventCallback, useForceUpdate } from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { createToaster } from './vanilla';\nimport type {\n CommonToastDetail,\n ShowToastEventDetail,\n Toast,\n ToastListenerMap,\n ToastPosition,\n ToasterId,\n ToasterOptions,\n} from './types';\nimport { EVENTS } from './constants';\n\nexport function useToaster<TElement extends HTMLElement = HTMLDivElement>(options: Partial<ToasterOptions> = {}) {\n const forceUpdate = useForceUpdate();\n const { toasterId: userToasterId, shortcuts } = options;\n // Currently the toaster options can never be changed at runtime\n const [toaster] = React.useState(() => createToaster(options));\n const { targetDocument } = useFluent();\n\n const lastActiveElementRef = React.useRef<HTMLElement | null>(null);\n\n const isCorrectToaster = useEventCallback((toasterId: ToasterId | undefined) => {\n return toasterId === userToasterId;\n });\n\n const isFocusShortcut = useEventCallback((e: KeyboardEvent) => {\n if (shortcuts?.focus) {\n return shortcuts.focus(e);\n }\n });\n\n const tryRestoreFocus = React.useCallback(() => {\n lastActiveElementRef.current?.focus();\n lastActiveElementRef.current = null;\n }, []);\n\n const pauseAllToasts = React.useCallback(() => {\n toaster.visibleToasts.forEach(toastId => {\n const toast = toaster.toasts.get(toastId);\n toast?.imperativeRef.current?.pause();\n });\n }, [toaster]);\n\n const playAllToasts = React.useCallback(() => {\n toaster.visibleToasts.forEach(toastId => {\n const toast = toaster.toasts.get(toastId);\n toast?.imperativeRef.current?.play();\n });\n }, [toaster]);\n\n const getMostRecentVisibleToast = React.useCallback(() => {\n return Array.from(toaster.visibleToasts).reduce((cur, next) => {\n const toast = toaster.toasts.get(next);\n if (!toast) {\n return cur;\n }\n\n if (!cur) {\n return toast;\n }\n\n if (cur.order < toast?.order) {\n return toast;\n }\n\n return cur;\n }, undefined as Toast | undefined);\n }, [toaster]);\n\n React.useEffect(() => {\n if (!targetDocument) {\n return;\n }\n\n const addToastListener = <TType extends keyof ToastListenerMap>(\n eventType: TType,\n callback: ToastListenerMap[TType],\n ) => {\n const listener: ToastListenerMap[TType] = (e: CustomEvent<CommonToastDetail>) => {\n if (!isCorrectToaster(e.detail.toasterId)) {\n return;\n }\n\n callback(e as CustomEvent<ShowToastEventDetail>);\n forceUpdate();\n };\n\n targetDocument.addEventListener(eventType, listener as () => void);\n return () => targetDocument.removeEventListener(eventType, listener as () => void);\n };\n\n const buildToast: ToastListenerMap[typeof EVENTS.show] = e => {\n toaster.buildToast(e.detail, forceUpdate);\n };\n\n const dismissToast: ToastListenerMap[typeof EVENTS.dismiss] = e => {\n toaster.dismissToast(e.detail.toastId);\n };\n\n const updateToast: ToastListenerMap[typeof EVENTS.update] = e => {\n toaster.updateToast(e.detail);\n };\n\n const dismissAllToasts: ToastListenerMap[typeof EVENTS.dismissAll] = e => {\n toaster.dismissAllToasts();\n };\n\n const pauseToast: ToastListenerMap[typeof EVENTS.pause] = e => {\n const toast = toaster.toasts.get(e.detail.toastId);\n if (toast) {\n toast.imperativeRef.current?.pause();\n }\n };\n\n const playToast: ToastListenerMap[typeof EVENTS.play] = e => {\n const toast = toaster.toasts.get(e.detail.toastId);\n if (toast) {\n toast.imperativeRef.current?.play();\n }\n };\n\n const cleanupBuildListener = addToastListener(EVENTS.show, buildToast);\n const cleanupUpdateListener = addToastListener(EVENTS.update, updateToast);\n const cleanupDismissListener = addToastListener(EVENTS.dismiss, dismissToast);\n const cleanupDismissAllListener = addToastListener(EVENTS.dismissAll, dismissAllToasts);\n const cleanupPauseListener = addToastListener(EVENTS.pause, pauseToast);\n const cleanupPlayListener = addToastListener(EVENTS.play, playToast);\n\n const focusShortcutListener = (e: KeyboardEvent) => {\n if (isFocusShortcut(e)) {\n pauseAllToasts();\n const mostRecentToast = getMostRecentVisibleToast();\n\n if (mostRecentToast) {\n lastActiveElementRef.current = isHTMLElement(targetDocument.activeElement)\n ? targetDocument.activeElement\n : null;\n mostRecentToast.imperativeRef.current?.focus();\n }\n }\n };\n\n targetDocument.addEventListener('keydown', focusShortcutListener);\n\n return () => {\n cleanupBuildListener();\n cleanupDismissAllListener();\n cleanupUpdateListener();\n cleanupDismissListener();\n cleanupPauseListener();\n cleanupPlayListener();\n\n targetDocument.removeEventListener('keydown', focusShortcutListener);\n };\n }, [\n toaster,\n forceUpdate,\n targetDocument,\n isCorrectToaster,\n pauseAllToasts,\n getMostRecentVisibleToast,\n isFocusShortcut,\n ]);\n\n const toastsToRender = (() => {\n if (!toaster) {\n return new Map<ToastPosition, Toast[]>();\n }\n\n const toRender = new Map<ToastPosition, Toast[]>();\n const toasts = Array.from(toaster.toasts.values());\n\n toasts.forEach(toast => {\n const { position } = toast;\n toRender.has(position) || toRender.set(position, []);\n if (position.startsWith('bottom')) {\n toRender.get(position)!.push(toast);\n } else {\n toRender.get(position)!.unshift(toast);\n }\n });\n\n return toRender;\n })();\n\n return {\n isToastVisible: toaster.isToastVisible,\n toastsToRender,\n pauseAllToasts,\n playAllToasts,\n tryRestoreFocus,\n };\n}\n"],"names":["React","isHTMLElement","useEventCallback","useForceUpdate","useFluent_unstable","useFluent","createToaster","EVENTS","useToaster","options","forceUpdate","toasterId","userToasterId","shortcuts","toaster","useState","targetDocument","lastActiveElementRef","useRef","isCorrectToaster","isFocusShortcut","e","focus","tryRestoreFocus","useCallback","current","pauseAllToasts","visibleToasts","forEach","toastId","toast","toasts","get","imperativeRef","pause","playAllToasts","play","getMostRecentVisibleToast","Array","from","reduce","cur","next","order","undefined","useEffect","addToastListener","eventType","callback","listener","detail","addEventListener","removeEventListener","buildToast","dismissToast","updateToast","dismissAllToasts","pauseToast","playToast","cleanupBuildListener","show","cleanupUpdateListener","update","cleanupDismissListener","dismiss","cleanupDismissAllListener","dismissAll","cleanupPauseListener","cleanupPlayListener","focusShortcutListener","mostRecentToast","activeElement","toastsToRender","Map","toRender","values","position","has","set","startsWith","push","unshift","isToastVisible"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,aAAa,EAAEC,gBAAgB,EAAEC,cAAc,QAAQ,4BAA4B;AAC5F,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAClF,SAASC,aAAa,QAAQ,YAAY;AAU1C,SAASC,MAAM,QAAQ,cAAc;AAErC,OAAO,SAASC,WAA0DC,UAAmC,CAAC,CAAC,EAAE;IAC/G,MAAMC,cAAcP;IACpB,MAAM,EAAEQ,WAAWC,cAAa,EAAEC,UAAS,EAAE,GAAGJ;IAChD,gEAAgE;IAChE,MAAM,CAACK,QAAQ,GAAGd,MAAMe,QAAQ,CAAC,IAAMT,cAAcG;IACrD,MAAM,EAAEO,eAAc,EAAE,GAAGX;IAE3B,MAAMY,uBAAuBjB,MAAMkB,MAAM,CAAqB,IAAI;IAElE,MAAMC,mBAAmBjB,iBAAiB,CAACS,YAAqC;QAC9E,OAAOA,cAAcC;IACvB;IAEA,MAAMQ,kBAAkBlB,iBAAiB,CAACmB,IAAqB;QAC7D,IAAIR,sBAAAA,uBAAAA,KAAAA,IAAAA,UAAWS,KAAK,EAAE;YACpB,OAAOT,UAAUS,KAAK,CAACD;QACzB,CAAC;IACH;IAEA,MAAME,kBAAkBvB,MAAMwB,WAAW,CAAC,IAAM;YAC9CP;QAAAA,CAAAA,gCAAAA,qBAAqBQ,OAAO,cAA5BR,2CAAAA,KAAAA,IAAAA,8BAA8BK;QAC9BL,qBAAqBQ,OAAO,GAAG,IAAI;IACrC,GAAG,EAAE;IAEL,MAAMC,iBAAiB1B,MAAMwB,WAAW,CAAC,IAAM;QAC7CV,QAAQa,aAAa,CAACC,OAAO,CAACC,CAAAA,UAAW;gBAEvCC;YADA,MAAMA,QAAQhB,QAAQiB,MAAM,CAACC,GAAG,CAACH;YACjCC,CAAAA,+BAAA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ourcesContent":["import * as React from 'react';\nimport { isHTMLElement, useEventCallback, useForceUpdate } from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { createToaster } from './vanilla';\nimport type {\n CommonToastDetail,\n ShowToastEventDetail,\n Toast,\n ToastListenerMap,\n ToastPosition,\n ToasterId,\n ToasterOptions,\n} from './types';\nimport { EVENTS } from './constants';\n\nexport function useToaster<TElement extends HTMLElement = HTMLDivElement>(options: Partial<ToasterOptions> = {}) {\n const forceUpdate = useForceUpdate();\n const { toasterId: userToasterId, shortcuts } = options;\n // Currently the toaster options can never be changed at runtime\n const [toaster] = React.useState(() => createToaster(options));\n const { targetDocument } = useFluent();\n\n const lastActiveElementRef = React.useRef<HTMLElement | null>(null);\n\n const isCorrectToaster = useEventCallback((toasterId: ToasterId | undefined) => {\n return toasterId === userToasterId;\n });\n\n const isFocusShortcut = useEventCallback((e: KeyboardEvent) => {\n if (shortcuts?.focus) {\n return shortcuts.focus(e);\n }\n });\n\n const pauseAllToasts = React.useCallback(() => {\n toaster.visibleToasts.forEach(toastId => {\n const toast = toaster.toasts.get(toastId);\n toast?.imperativeRef.current?.pause();\n });\n }, [toaster]);\n\n const playAllToasts = React.useCallback(() => {\n toaster.visibleToasts.forEach(toastId => {\n const toast = toaster.toasts.get(toastId);\n toast?.imperativeRef.current?.play();\n });\n }, [toaster]);\n\n const getMostRecentVisibleToast = React.useCallback(() => {\n return Array.from(toaster.visibleToasts).reduce((cur, next) => {\n const toast = toaster.toasts.get(next);\n if (!toast) {\n return cur;\n }\n\n if (!cur) {\n return toast;\n }\n\n if (cur.order < toast?.order) {\n return toast;\n }\n\n return cur;\n }, undefined as Toast | undefined);\n }, [toaster]);\n\n const tryRestoreFocus = React.useCallback(() => {\n const mostRecentToast = getMostRecentVisibleToast();\n if (mostRecentToast?.imperativeRef.current) {\n mostRecentToast.imperativeRef.current.focus();\n } else {\n lastActiveElementRef.current?.focus();\n lastActiveElementRef.current = null;\n }\n }, [getMostRecentVisibleToast]);\n\n const closeAllToasts = React.useCallback(() => {\n toaster.visibleToasts.forEach(toastId => {\n const toast = toaster.toasts.get(toastId);\n toast?.close();\n });\n\n tryRestoreFocus();\n }, [toaster, tryRestoreFocus]);\n\n React.useEffect(() => {\n if (!targetDocument) {\n return;\n }\n\n const addToastListener = <TType extends keyof ToastListenerMap>(\n eventType: TType,\n callback: ToastListenerMap[TType],\n ) => {\n const listener: ToastListenerMap[TType] = (e: CustomEvent<CommonToastDetail>) => {\n if (!isCorrectToaster(e.detail.toasterId)) {\n return;\n }\n\n callback(e as CustomEvent<ShowToastEventDetail>);\n forceUpdate();\n };\n\n targetDocument.addEventListener(eventType, listener as () => void);\n return () => targetDocument.removeEventListener(eventType, listener as () => void);\n };\n\n const buildToast: ToastListenerMap[typeof EVENTS.show] = e => {\n toaster.buildToast(e.detail, forceUpdate);\n };\n\n const dismissToast: ToastListenerMap[typeof EVENTS.dismiss] = e => {\n toaster.dismissToast(e.detail.toastId);\n };\n\n const updateToast: ToastListenerMap[typeof EVENTS.update] = e => {\n toaster.updateToast(e.detail);\n };\n\n const dismissAllToasts: ToastListenerMap[typeof EVENTS.dismissAll] = e => {\n toaster.dismissAllToasts();\n };\n\n const pauseToast: ToastListenerMap[typeof EVENTS.pause] = e => {\n const toast = toaster.toasts.get(e.detail.toastId);\n if (toast) {\n toast.imperativeRef.current?.pause();\n }\n };\n\n const playToast: ToastListenerMap[typeof EVENTS.play] = e => {\n const toast = toaster.toasts.get(e.detail.toastId);\n if (toast) {\n toast.imperativeRef.current?.play();\n }\n };\n\n const cleanupBuildListener = addToastListener(EVENTS.show, buildToast);\n const cleanupUpdateListener = addToastListener(EVENTS.update, updateToast);\n const cleanupDismissListener = addToastListener(EVENTS.dismiss, dismissToast);\n const cleanupDismissAllListener = addToastListener(EVENTS.dismissAll, dismissAllToasts);\n const cleanupPauseListener = addToastListener(EVENTS.pause, pauseToast);\n const cleanupPlayListener = addToastListener(EVENTS.play, playToast);\n\n const focusShortcutListener = (e: KeyboardEvent) => {\n if (isFocusShortcut(e)) {\n pauseAllToasts();\n const mostRecentToast = getMostRecentVisibleToast();\n\n if (mostRecentToast) {\n lastActiveElementRef.current = isHTMLElement(targetDocument.activeElement)\n ? targetDocument.activeElement\n : null;\n mostRecentToast.imperativeRef.current?.focus();\n }\n }\n };\n\n targetDocument.addEventListener('keydown', focusShortcutListener);\n\n return () => {\n cleanupBuildListener();\n cleanupDismissAllListener();\n cleanupUpdateListener();\n cleanupDismissListener();\n cleanupPauseListener();\n cleanupPlayListener();\n\n targetDocument.removeEventListener('keydown', focusShortcutListener);\n };\n }, [\n toaster,\n forceUpdate,\n targetDocument,\n isCorrectToaster,\n pauseAllToasts,\n getMostRecentVisibleToast,\n isFocusShortcut,\n ]);\n\n const toastsToRender = (() => {\n if (!toaster) {\n return new Map<ToastPosition, Toast[]>();\n }\n\n const toRender = new Map<ToastPosition, Toast[]>();\n const toasts = Array.from(toaster.toasts.values());\n\n toasts.forEach(toast => {\n const { position } = toast;\n toRender.has(position) || toRender.set(position, []);\n if (position.startsWith('bottom')) {\n toRender.get(position)!.push(toast);\n } else {\n toRender.get(position)!.unshift(toast);\n }\n });\n\n return toRender;\n })();\n\n return {\n isToastVisible: toaster.isToastVisible,\n toastsToRender,\n pauseAllToasts,\n playAllToasts,\n tryRestoreFocus,\n closeAllToasts,\n };\n}\n"],"names":["React","isHTMLElement","useEventCallback","useForceUpdate","useFluent_unstable","useFluent","createToaster","EVENTS","useToaster","options","forceUpdate","toasterId","userToasterId","shortcuts","toaster","useState","targetDocument","lastActiveElementRef","useRef","isCorrectToaster","isFocusShortcut","e","focus","pauseAllToasts","useCallback","visibleToasts","forEach","toastId","toast","toasts","get","imperativeRef","current","pause","playAllToasts","play","getMostRecentVisibleToast","Array","from","reduce","cur","next","order","undefined","tryRestoreFocus","mostRecentToast","closeAllToasts","close","useEffect","addToastListener","eventType","callback","listener","detail","addEventListener","removeEventListener","buildToast","dismissToast","updateToast","dismissAllToasts","pauseToast","playToast","cleanupBuildListener","show","cleanupUpdateListener","update","cleanupDismissListener","dismiss","cleanupDismissAllListener","dismissAll","cleanupPauseListener","cleanupPlayListener","focusShortcutListener","activeElement","toastsToRender","Map","toRender","values","position","has","set","startsWith","push","unshift","isToastVisible"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,aAAa,EAAEC,gBAAgB,EAAEC,cAAc,QAAQ,4BAA4B;AAC5F,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAClF,SAASC,aAAa,QAAQ,YAAY;AAU1C,SAASC,MAAM,QAAQ,cAAc;AAErC,OAAO,SAASC,WAA0DC,UAAmC,CAAC,CAAC,EAAE;IAC/G,MAAMC,cAAcP;IACpB,MAAM,EAAEQ,WAAWC,cAAa,EAAEC,UAAS,EAAE,GAAGJ;IAChD,gEAAgE;IAChE,MAAM,CAACK,QAAQ,GAAGd,MAAMe,QAAQ,CAAC,IAAMT,cAAcG;IACrD,MAAM,EAAEO,eAAc,EAAE,GAAGX;IAE3B,MAAMY,uBAAuBjB,MAAMkB,MAAM,CAAqB,IAAI;IAElE,MAAMC,mBAAmBjB,iBAAiB,CAACS,YAAqC;QAC9E,OAAOA,cAAcC;IACvB;IAEA,MAAMQ,kBAAkBlB,iBAAiB,CAACmB,IAAqB;QAC7D,IAAIR,sBAAAA,uBAAAA,KAAAA,IAAAA,UAAWS,KAAK,EAAE;YACpB,OAAOT,UAAUS,KAAK,CAACD;QACzB,CAAC;IACH;IAEA,MAAME,iBAAiBvB,MAAMwB,WAAW,CAAC,IAAM;QAC7CV,QAAQW,aAAa,CAACC,OAAO,CAACC,CAAAA,UAAW;gBAEvCC;YADA,MAAMA,QAAQd,QAAQe,MAAM,CAACC,GAAG,CAACH;YACjCC,CAAAA,+BAAAA,kBAAAA,mBAAAA,KAAAA,IAAAA,MAAOG,aAAa,CAACC,OAAO,cAA5BJ,0CAAAA,KAAAA,IAAAA,6BAA8BK;QAChC;IACF,GAAG;QA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AMC,IAAI,CAACxB,QAAQe,MAAM,CAACgD,MAAM;QAE/ChD,OAAOH,OAAO,CAACE,CAAAA,QAAS;YACtB,MAAM,EAAEkD,SAAQ,EAAE,GAAGlD;YACrBgD,SAASG,GAAG,CAACD,aAAaF,SAASI,GAAG,CAACF,UAAU,EAAE;YACnD,IAAIA,SAASG,UAAU,CAAC,WAAW;gBACjCL,SAAS9C,GAAG,CAACgD,UAAWI,IAAI,CAACtD;YAC/B,OAAO;gBACLgD,SAAS9C,GAAG,CAACgD,UAAWK,OAAO,CAACvD;YAClC,CAAC;QACH;QAEA,OAAOgD;IACT,CAAA;IAEA,OAAO;QACLQ,gBAAgBtE,QAAQsE,cAAc;QACtCV;QACAnD;QACAW;QACAU;QACAE;IACF;AACF,CAAC"}
|
|
@@ -9,6 +9,6 @@ Object.defineProperty(exports, "renderAriaLive_unstable", {
|
|
|
9
9
|
const _reactJsxRuntime = require("@fluentui/react-jsx-runtime");
|
|
10
10
|
const _reactUtilities = require("@fluentui/react-utilities");
|
|
11
11
|
const renderAriaLive_unstable = (state)=>{
|
|
12
|
-
|
|
13
|
-
return /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(_reactJsxRuntime.Fragment, null, /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(
|
|
12
|
+
(0, _reactUtilities.assertSlots)(state);
|
|
13
|
+
return /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(_reactJsxRuntime.Fragment, null, /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.assertive, null), /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.polite, null));
|
|
14
14
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderAriaLive.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsxFrag Fragment */ /** @jsx createElement */ import { createElement, Fragment } from '@fluentui/react-jsx-runtime';\nimport {
|
|
1
|
+
{"version":3,"sources":["renderAriaLive.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsxFrag Fragment */ /** @jsx createElement */ import { createElement, Fragment } from '@fluentui/react-jsx-runtime';\nimport { assertSlots } from '@fluentui/react-utilities';\n/**\n * Render the final JSX of AriaLive\n */ export const renderAriaLive_unstable = (state)=>{\n assertSlots(state);\n return /*#__PURE__*/ createElement(Fragment, null, /*#__PURE__*/ createElement(state.assertive, null), /*#__PURE__*/ createElement(state.polite, null));\n};\n"],"names":["renderAriaLive_unstable","state","assertSlots","createElement","Fragment","assertive","polite"],"mappings":"AAAA,wBAAwB,GAAG,sBAAsB,GAAG,uBAAuB;;;;+BAI1DA;;aAAAA;;iCAJqG;gCAC1F;AAGjB,MAAMA,0BAA0B,CAACC,QAAQ;IAChDC,IAAAA,2BAAW,EAACD;IACZ,OAAO,WAAW,GAAGE,IAAAA,8BAAa,EAACC,yBAAQ,EAAE,IAAI,EAAE,WAAW,GAAGD,IAAAA,8BAAa,EAACF,MAAMI,SAAS,EAAE,IAAI,GAAG,WAAW,GAAGF,IAAAA,8BAAa,EAACF,MAAMK,MAAM,EAAE,IAAI;AACzJ"}
|
|
@@ -57,19 +57,19 @@ const useAriaLive_unstable = (props)=>{
|
|
|
57
57
|
assertive: 'div',
|
|
58
58
|
polite: 'div'
|
|
59
59
|
},
|
|
60
|
-
assertive:
|
|
61
|
-
required: true,
|
|
60
|
+
assertive: _reactUtilities.slot.always(props.assertive, {
|
|
62
61
|
defaultProps: {
|
|
63
62
|
'aria-live': 'assertive',
|
|
64
63
|
children: assertiveMessage
|
|
65
|
-
}
|
|
64
|
+
},
|
|
65
|
+
elementType: 'div'
|
|
66
66
|
}),
|
|
67
|
-
polite:
|
|
68
|
-
required: true,
|
|
67
|
+
polite: _reactUtilities.slot.always(props.polite, {
|
|
69
68
|
defaultProps: {
|
|
70
69
|
'aria-live': 'polite',
|
|
71
70
|
children: politeMessage
|
|
72
|
-
}
|
|
71
|
+
},
|
|
72
|
+
elementType: 'div'
|
|
73
73
|
})
|
|
74
74
|
};
|
|
75
75
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useAriaLive.js"],"sourcesContent":["import * as React from 'react';\nimport {
|
|
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 const timeout = setTimeout(()=>{\n if (messageQueue.peek()) {\n setCurrentMessage(messageQueue.dequeue());\n } else {\n setCurrentMessage(undefined);\n }\n }, MESSAGE_DURATION);\n return ()=>clearTimeout(timeout);\n }, [\n currentMessage,\n messageQueue\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","useEffect","timeout","setTimeout","peek","dequeue","clearTimeout","useImperativeHandle","announceRef","politeMessage","assertiveMessage","components","assertive","polite","slot","always","defaultProps","children","elementType"],"mappings":";;;;+BAUiBA;;aAAAA;;;6DAVM;gCACqC;AAC5D,gHAAgH,GAAG,MAAMC,mBAAmB;AAQjI,MAAMD,uBAAuB,CAACE,QAAQ;IAC7C,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,IAAI;YAC9D,IAAID,EAAEE,UAAU,KAAKD,EAAEC,UAAU,EAAE;gBAC/B,OAAOF,EAAEG,SAAS,GAAGF,EAAEE,SAAS;YACpC,CAAC;YACD,OAAOH,EAAEE,UAAU,KAAK,cAAc,CAAC,IAAI,CAAC;QAChD;IACJ,MAAME,WAAWC,IAAAA,gCAAgB,EAAC,CAACC,SAASC,UAAU;QAClD,MAAM,EAAEL,WAAU,EAAG,GAAGK;QACxB,IAAID,YAAaf,CAAAA,mBAAmB,IAAI,IAAIA,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAee,OAAO,AAAD,GAAI;YACtG;QACJ,CAAC;QACD,MAAME,cAAc;YAChBF;YACAJ;YACAC,WAAWP,MAAMa,OAAO;QAC5B;QACA,IAAI,CAAClB,gBAAgB;YACjBC,kBAAkBgB;QACtB,OAAO;YACHV,aAAaY,OAAO,CAACF;QACzB,CAAC;IACL;IACAf,OAAMkB,SAAS,CAAC,IAAI;QAChB,MAAMC,UAAUC,WAAW,IAAI;YAC3B,IAAIf,aAAagB,IAAI,IAAI;gBACrBtB,kBAAkBM,aAAaiB,OAAO;YAC1C,OAAO;gBACHvB,kBAAkBG;YACtB,CAAC;QACL,GAAGN;QACH,OAAO,IAAI2B,aAAaJ;IAC5B,GAAG;QACCrB;QACAO;KACH;IACDL,OAAMwB,mBAAmB,CAAC3B,MAAM4B,WAAW,EAAE,IAAId;IACjD,MAAMe,gBAAgB,AAAC5B,CAAAA,mBAAmB,IAAI,IAAIA,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAeW,UAAU,AAAD,MAAO,WAAWX,eAAee,OAAO,GAAGX,SAAS;IACnK,MAAMyB,mBAAmB,AAAC7B,CAAAA,mBAAmB,IAAI,IAAIA,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAeW,UAAU,AAAD,MAAO,cAAcX,eAAee,OAAO,GAAGX,SAAS;IACzK,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"}
|
|
@@ -7,10 +7,8 @@ Object.defineProperty(exports, "useBaseAnimationStyles", {
|
|
|
7
7
|
get: ()=>useBaseAnimationStyles
|
|
8
8
|
});
|
|
9
9
|
const _react = require("@griffel/react");
|
|
10
|
-
const useBaseAnimationStyles = /*#__PURE__*/ (0, _react["__resetStyles"])("
|
|
11
|
-
".
|
|
12
|
-
"@-webkit-keyframes rsacmq1{from{opacity:0;}to{opacity:0;}}",
|
|
13
|
-
"@-webkit-keyframes rsacmq1{from{opacity:0;}to{opacity:0;}}",
|
|
10
|
+
const useBaseAnimationStyles = /*#__PURE__*/ (0, _react["__resetStyles"])("r16zaflb", "r75casi", [
|
|
11
|
+
".r16zaflb{animation-name:rsacmq1;}",
|
|
14
12
|
"@keyframes rsacmq1{from{opacity:0;}to{opacity:0;}}",
|
|
15
|
-
".r75casi{
|
|
13
|
+
".r75casi{animation-name:rsacmq1;}"
|
|
16
14
|
]); //# sourceMappingURL=useTimerStyles.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useTimerStyles.styles.js"],"sourcesContent":["import { __resetStyles } from '@griffel/react';\nexport const useBaseAnimationStyles = /*#__PURE__*/__resetStyles(\"
|
|
1
|
+
{"version":3,"sources":["useTimerStyles.styles.js"],"sourcesContent":["import { __resetStyles } from '@griffel/react';\nexport const useBaseAnimationStyles = /*#__PURE__*/__resetStyles(\"r16zaflb\", \"r75casi\", [\".r16zaflb{animation-name:rsacmq1;}\", \"@keyframes rsacmq1{from{opacity:0;}to{opacity:0;}}\", \".r75casi{animation-name:rsacmq1;}\"]);\n//# sourceMappingURL=useTimerStyles.styles.js.map"],"names":["useBaseAnimationStyles","__resetStyles"],"mappings":";;;;+BACaA;;aAAAA;;uBADiB;AACvB,MAAMA,yBAAyB,WAAW,GAAEC,IAAAA,uBAAa,EAAC,YAAY,WAAW;IAAC;IAAsC;IAAsD;CAAoC,GACzN,iDAAiD"}
|
|
@@ -10,8 +10,8 @@ const _reactJsxRuntime = require("@fluentui/react-jsx-runtime");
|
|
|
10
10
|
const _reactUtilities = require("@fluentui/react-utilities");
|
|
11
11
|
const _reactSharedContexts = require("@fluentui/react-shared-contexts");
|
|
12
12
|
const renderToast_unstable = (state, contextValues)=>{
|
|
13
|
-
|
|
13
|
+
(0, _reactUtilities.assertSlots)(state);
|
|
14
14
|
return /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(_reactSharedContexts.BackgroundAppearanceProvider, {
|
|
15
15
|
value: contextValues.backgroundAppearance
|
|
16
|
-
}, /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(
|
|
16
|
+
}, /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.root, null));
|
|
17
17
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderToast.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';\nimport {
|
|
1
|
+
{"version":3,"sources":["renderToast.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';\nimport { assertSlots } from '@fluentui/react-utilities';\nimport { BackgroundAppearanceProvider } from '@fluentui/react-shared-contexts';\n/**\n * Render the final JSX of Toast\n */ export const renderToast_unstable = (state, contextValues)=>{\n assertSlots(state);\n return /*#__PURE__*/ createElement(BackgroundAppearanceProvider, {\n value: contextValues.backgroundAppearance\n }, /*#__PURE__*/ createElement(state.root, null));\n};\n"],"names":["renderToast_unstable","state","contextValues","assertSlots","createElement","BackgroundAppearanceProvider","value","backgroundAppearance","root"],"mappings":"AAAA,wBAAwB,GAAG,uBAAuB;;;;+BAKjCA;;aAAAA;;iCALkE;gCACvD;qCACiB;AAGlC,MAAMA,uBAAuB,CAACC,OAAOC,gBAAgB;IAC5DC,IAAAA,2BAAW,EAACF;IACZ,OAAO,WAAW,GAAGG,IAAAA,8BAAa,EAACC,iDAA4B,EAAE;QAC7DC,OAAOJ,cAAcK,oBAAoB;IAC7C,GAAG,WAAW,GAAGH,IAAAA,8BAAa,EAACH,MAAMO,IAAI,EAAE,IAAI;AACnD"}
|
|
@@ -14,9 +14,11 @@ const useToast_unstable = (props, ref)=>{
|
|
|
14
14
|
components: {
|
|
15
15
|
root: 'div'
|
|
16
16
|
},
|
|
17
|
-
root: (0, _reactUtilities.getNativeElementProps)('div', {
|
|
17
|
+
root: _reactUtilities.slot.always((0, _reactUtilities.getNativeElementProps)('div', {
|
|
18
18
|
ref,
|
|
19
19
|
...props
|
|
20
|
+
}), {
|
|
21
|
+
elementType: 'div'
|
|
20
22
|
}),
|
|
21
23
|
backgroundAppearance: props.appearance
|
|
22
24
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useToast.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps } from '@fluentui/react-utilities';\n/**\n * Create the state required to render Toast.\n *\n * The returned state can be modified with hooks such as useToastStyles_unstable,\n * before being passed to renderToast_unstable.\n *\n * @param props - props from this instance of Toast\n * @param ref - reference to root HTMLElement of Toast\n */ export const useToast_unstable = (props, ref)=>{\n return {\n components: {\n root: 'div'\n },\n root: getNativeElementProps('div', {\n ref,\n ...props\n }),\n backgroundAppearance: props.appearance\n };\n};\n"],"names":["useToast_unstable","props","ref","components","root","getNativeElementProps","backgroundAppearance","appearance"],"mappings":";;;;+BAUiBA;;aAAAA;;;6DAVM;
|
|
1
|
+
{"version":3,"sources":["useToast.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, slot } from '@fluentui/react-utilities';\n/**\n * Create the state required to render Toast.\n *\n * The returned state can be modified with hooks such as useToastStyles_unstable,\n * before being passed to renderToast_unstable.\n *\n * @param props - props from this instance of Toast\n * @param ref - reference to root HTMLElement of Toast\n */ export const useToast_unstable = (props, ref)=>{\n return {\n components: {\n root: 'div'\n },\n root: slot.always(getNativeElementProps('div', {\n ref,\n ...props\n }), {\n elementType: 'div'\n }),\n backgroundAppearance: props.appearance\n };\n};\n"],"names":["useToast_unstable","props","ref","components","root","slot","always","getNativeElementProps","elementType","backgroundAppearance","appearance"],"mappings":";;;;+BAUiBA;;aAAAA;;;6DAVM;gCACqB;AASjC,MAAMA,oBAAoB,CAACC,OAAOC,MAAM;IAC/C,OAAO;QACHC,YAAY;YACRC,MAAM;QACV;QACAA,MAAMC,oBAAI,CAACC,MAAM,CAACC,IAAAA,qCAAqB,EAAC,OAAO;YAC3CL;YACA,GAAGD,KAAK;QACZ,IAAI;YACAO,aAAa;QACjB;QACAC,sBAAsBR,MAAMS,UAAU;IAC1C;AACJ"}
|
|
@@ -17,8 +17,8 @@ const toastClassNames = {
|
|
|
17
17
|
root: 'fui-Toast'
|
|
18
18
|
};
|
|
19
19
|
const useRootBaseClassName = /*#__PURE__*/ (0, _react["__resetStyles"])("rzyoxeq", "r1lipnsg", [
|
|
20
|
-
".rzyoxeq{display
|
|
21
|
-
".r1lipnsg{display
|
|
20
|
+
".rzyoxeq{display:grid;grid-template-columns:auto 1fr auto;padding-top:12px;padding-right:12px;padding-bottom:12px;padding-left:12px;border-bottom-right-radius:var(--borderRadiusMedium);border-bottom-left-radius:var(--borderRadiusMedium);border-top-right-radius:var(--borderRadiusMedium);border-top-left-radius:var(--borderRadiusMedium);border-top-width:1px;border-right-width:1px;border-bottom-width:1px;border-left-width:1px;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-color:var(--colorTransparentStroke);border-right-color:var(--colorTransparentStroke);border-bottom-color:var(--colorTransparentStroke);border-left-color:var(--colorTransparentStroke);box-shadow:var(--shadow8);font-size:var(--fontSizeBase300);line-height:20px;font-weight:var(--fontWeightSemibold);color:var(--colorNeutralForeground1);background-color:var(--colorNeutralBackground1);}",
|
|
21
|
+
".r1lipnsg{display:grid;grid-template-columns:auto 1fr auto;padding-top:12px;padding-left:12px;padding-bottom:12px;padding-right:12px;border-bottom-left-radius:var(--borderRadiusMedium);border-bottom-right-radius:var(--borderRadiusMedium);border-top-left-radius:var(--borderRadiusMedium);border-top-right-radius:var(--borderRadiusMedium);border-top-width:1px;border-left-width:1px;border-bottom-width:1px;border-right-width:1px;border-top-style:solid;border-left-style:solid;border-bottom-style:solid;border-right-style:solid;border-top-color:var(--colorTransparentStroke);border-left-color:var(--colorTransparentStroke);border-bottom-color:var(--colorTransparentStroke);border-right-color:var(--colorTransparentStroke);box-shadow:var(--shadow8);font-size:var(--fontSizeBase300);line-height:20px;font-weight:var(--fontWeightSemibold);color:var(--colorNeutralForeground1);background-color:var(--colorNeutralBackground1);}"
|
|
22
22
|
]);
|
|
23
23
|
const useStyles = /*#__PURE__*/ (0, _react["__styles"])({
|
|
24
24
|
inverted: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useToastStyles.styles.js"],"sourcesContent":["import { __resetStyles, __styles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nexport const toastClassNames = {\n root: 'fui-Toast'\n};\nconst useRootBaseClassName = /*#__PURE__*/__resetStyles(\"rzyoxeq\", \"r1lipnsg\", [\".rzyoxeq{display
|
|
1
|
+
{"version":3,"sources":["useToastStyles.styles.js"],"sourcesContent":["import { __resetStyles, __styles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nexport const toastClassNames = {\n root: 'fui-Toast'\n};\nconst useRootBaseClassName = /*#__PURE__*/__resetStyles(\"rzyoxeq\", \"r1lipnsg\", [\".rzyoxeq{display:grid;grid-template-columns:auto 1fr auto;padding-top:12px;padding-right:12px;padding-bottom:12px;padding-left:12px;border-bottom-right-radius:var(--borderRadiusMedium);border-bottom-left-radius:var(--borderRadiusMedium);border-top-right-radius:var(--borderRadiusMedium);border-top-left-radius:var(--borderRadiusMedium);border-top-width:1px;border-right-width:1px;border-bottom-width:1px;border-left-width:1px;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-color:var(--colorTransparentStroke);border-right-color:var(--colorTransparentStroke);border-bottom-color:var(--colorTransparentStroke);border-left-color:var(--colorTransparentStroke);box-shadow:var(--shadow8);font-size:var(--fontSizeBase300);line-height:20px;font-weight:var(--fontWeightSemibold);color:var(--colorNeutralForeground1);background-color:var(--colorNeutralBackground1);}\", \".r1lipnsg{display:grid;grid-template-columns:auto 1fr auto;padding-top:12px;padding-left:12px;padding-bottom:12px;padding-right:12px;border-bottom-left-radius:var(--borderRadiusMedium);border-bottom-right-radius:var(--borderRadiusMedium);border-top-left-radius:var(--borderRadiusMedium);border-top-right-radius:var(--borderRadiusMedium);border-top-width:1px;border-left-width:1px;border-bottom-width:1px;border-right-width:1px;border-top-style:solid;border-left-style:solid;border-bottom-style:solid;border-right-style:solid;border-top-color:var(--colorTransparentStroke);border-left-color:var(--colorTransparentStroke);border-bottom-color:var(--colorTransparentStroke);border-right-color:var(--colorTransparentStroke);box-shadow:var(--shadow8);font-size:var(--fontSizeBase300);line-height:20px;font-weight:var(--fontWeightSemibold);color:var(--colorNeutralForeground1);background-color:var(--colorNeutralBackground1);}\"]);\nconst useStyles = /*#__PURE__*/__styles({\n inverted: {\n sj55zd: \"f1w7i9ko\",\n De3pzq: \"f5pduvr\"\n }\n}, {\n d: [\".f1w7i9ko{color:var(--colorNeutralForegroundInverted2);}\", \".f5pduvr{background-color:var(--colorNeutralBackgroundInverted);}\"]\n});\n/**\n * Apply styling to the Toast slots based on the state\n */\nexport const useToastStyles_unstable = state => {\n const rootBaseClassName = useRootBaseClassName();\n const styles = useStyles();\n state.root.className = mergeClasses(toastClassNames.root, rootBaseClassName, state.backgroundAppearance === 'inverted' && styles.inverted, state.root.className);\n return state;\n};\n//# sourceMappingURL=useToastStyles.styles.js.map"],"names":["toastClassNames","useToastStyles_unstable","root","useRootBaseClassName","__resetStyles","useStyles","__styles","inverted","sj55zd","De3pzq","d","state","rootBaseClassName","styles","className","mergeClasses","backgroundAppearance"],"mappings":";;;;;;;;;;;IAEaA,eAAe,MAAfA;IAeAC,uBAAuB,MAAvBA;;uBAjBqD;AAE3D,MAAMD,kBAAkB;IAC7BE,MAAM;AACR;AACA,MAAMC,uBAAuB,WAAW,GAAEC,IAAAA,uBAAa,EAAC,WAAW,YAAY;IAAC;IAA05B;CAA05B;AACp4D,MAAMC,YAAY,WAAW,GAAEC,IAAAA,kBAAQ,EAAC;IACtCC,UAAU;QACRC,QAAQ;QACRC,QAAQ;IACV;AACF,GAAG;IACDC,GAAG;QAAC;QAA4D;KAAoE;AACtI;AAIO,MAAMT,0BAA0BU,CAAAA,QAAS;IAC9C,MAAMC,oBAAoBT;IAC1B,MAAMU,SAASR;IACfM,MAAMT,IAAI,CAACY,SAAS,GAAGC,IAAAA,mBAAY,EAACf,gBAAgBE,IAAI,EAAEU,mBAAmBD,MAAMK,oBAAoB,KAAK,cAAcH,OAAON,QAAQ,EAAEI,MAAMT,IAAI,CAACY,SAAS;IAC/J,OAAOH;AACT,GACA,iDAAiD"}
|
|
@@ -9,6 +9,6 @@ Object.defineProperty(exports, "renderToastBody_unstable", {
|
|
|
9
9
|
const _reactJsxRuntime = require("@fluentui/react-jsx-runtime");
|
|
10
10
|
const _reactUtilities = require("@fluentui/react-utilities");
|
|
11
11
|
const renderToastBody_unstable = (state)=>{
|
|
12
|
-
|
|
13
|
-
return /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(_reactJsxRuntime.Fragment, null, /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(
|
|
12
|
+
(0, _reactUtilities.assertSlots)(state);
|
|
13
|
+
return /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(_reactJsxRuntime.Fragment, null, /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.root, null), state.subtitle ? /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.subtitle, null) : null);
|
|
14
14
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderToastBody.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsxFrag Fragment */ /** @jsx createElement */ import { createElement, Fragment } from '@fluentui/react-jsx-runtime';\nimport {
|
|
1
|
+
{"version":3,"sources":["renderToastBody.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsxFrag Fragment */ /** @jsx createElement */ import { createElement, Fragment } from '@fluentui/react-jsx-runtime';\nimport { assertSlots } from '@fluentui/react-utilities';\n/**\n * Render the final JSX of ToastBody\n */ export const renderToastBody_unstable = (state)=>{\n assertSlots(state);\n return /*#__PURE__*/ createElement(Fragment, null, /*#__PURE__*/ createElement(state.root, null), state.subtitle ? /*#__PURE__*/ createElement(state.subtitle, null) : null);\n};\n"],"names":["renderToastBody_unstable","state","assertSlots","createElement","Fragment","root","subtitle"],"mappings":"AAAA,wBAAwB,GAAG,sBAAsB,GAAG,uBAAuB;;;;+BAI1DA;;aAAAA;;iCAJqG;gCAC1F;AAGjB,MAAMA,2BAA2B,CAACC,QAAQ;IACjDC,IAAAA,2BAAW,EAACD;IACZ,OAAO,WAAW,GAAGE,IAAAA,8BAAa,EAACC,yBAAQ,EAAE,IAAI,EAAE,WAAW,GAAGD,IAAAA,8BAAa,EAACF,MAAMI,IAAI,EAAE,IAAI,GAAGJ,MAAMK,QAAQ,GAAG,WAAW,GAAGH,IAAAA,8BAAa,EAACF,MAAMK,QAAQ,EAAE,IAAI,IAAI,IAAI;AAC/K"}
|
|
@@ -19,11 +19,15 @@ const useToastBody_unstable = (props, ref)=>{
|
|
|
19
19
|
root: 'div',
|
|
20
20
|
subtitle: 'div'
|
|
21
21
|
},
|
|
22
|
-
subtitle:
|
|
23
|
-
|
|
22
|
+
subtitle: _reactUtilities.slot.optional(props.subtitle, {
|
|
23
|
+
elementType: 'div'
|
|
24
|
+
}),
|
|
25
|
+
root: _reactUtilities.slot.always((0, _reactUtilities.getNativeElementProps)('div', {
|
|
24
26
|
ref,
|
|
25
27
|
id: bodyId,
|
|
26
28
|
...props
|
|
29
|
+
}), {
|
|
30
|
+
elementType: 'div'
|
|
27
31
|
}),
|
|
28
32
|
backgroundAppearance
|
|
29
33
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useToastBody.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps,
|
|
1
|
+
{"version":3,"sources":["useToastBody.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, slot } from '@fluentui/react-utilities';\nimport { useToastContainerContext } from '../../contexts/toastContainerContext';\nimport { useBackgroundAppearance } from '@fluentui/react-shared-contexts';\n/**\n * Create the state required to render ToastBody.\n *\n * The returned state can be modified with hooks such as useToastBodyStyles_unstable,\n * before being passed to renderToastBody_unstable.\n *\n * @param props - props from this instance of ToastBody\n * @param ref - reference to root HTMLElement of ToastBody\n */ export const useToastBody_unstable = (props, ref)=>{\n const backgroundAppearance = useBackgroundAppearance();\n const { bodyId } = useToastContainerContext();\n return {\n components: {\n root: 'div',\n subtitle: 'div'\n },\n subtitle: slot.optional(props.subtitle, {\n elementType: 'div'\n }),\n root: slot.always(getNativeElementProps('div', {\n ref,\n id: bodyId,\n ...props\n }), {\n elementType: 'div'\n }),\n backgroundAppearance\n };\n};\n"],"names":["useToastBody_unstable","props","ref","backgroundAppearance","useBackgroundAppearance","bodyId","useToastContainerContext","components","root","subtitle","slot","optional","elementType","always","getNativeElementProps","id"],"mappings":";;;;+BAYiBA;;aAAAA;;;6DAZM;gCACqB;uCACH;qCACD;AAS7B,MAAMA,wBAAwB,CAACC,OAAOC,MAAM;IACnD,MAAMC,uBAAuBC,IAAAA,4CAAuB;IACpD,MAAM,EAAEC,OAAM,EAAG,GAAGC,IAAAA,+CAAwB;IAC5C,OAAO;QACHC,YAAY;YACRC,MAAM;YACNC,UAAU;QACd;QACAA,UAAUC,oBAAI,CAACC,QAAQ,CAACV,MAAMQ,QAAQ,EAAE;YACpCG,aAAa;QACjB;QACAJ,MAAME,oBAAI,CAACG,MAAM,CAACC,IAAAA,qCAAqB,EAAC,OAAO;YAC3CZ;YACAa,IAAIV;YACJ,GAAGJ,KAAK;QACZ,IAAI;YACAW,aAAa;QACjB;QACAT;IACJ;AACJ"}
|
|
@@ -18,10 +18,10 @@ const toastBodyClassNames = {
|
|
|
18
18
|
subtitle: 'fui-ToastBody__subtitle'
|
|
19
19
|
};
|
|
20
20
|
const useRootBaseClassName = /*#__PURE__*/ (0, _react["__resetStyles"])("rnxxsue", null, [
|
|
21
|
-
".rnxxsue{
|
|
21
|
+
".rnxxsue{grid-column-start:2;grid-column-end:3;padding-top:6px;font-size:var(--fontSizeBase300);line-height:var(--fontSizeBase300);font-weight:var(--fontWeightRegular);color:var(--colorNeutralForeground1);}"
|
|
22
22
|
]);
|
|
23
23
|
const useSubtitleBaseClassName = /*#__PURE__*/ (0, _react["__resetStyles"])("rzjw1xk", null, [
|
|
24
|
-
".rzjw1xk{padding-top:4px
|
|
24
|
+
".rzjw1xk{padding-top:4px;grid-column-start:2;grid-column-end:3;font-size:var(--fontSizeBase200);line-height:var(--fontSizeBase200);font-weight:var(--fontWeightRegular);color:var(--colorNeutralForeground2);}"
|
|
25
25
|
]);
|
|
26
26
|
const useInvertedStyles = /*#__PURE__*/ (0, _react["__styles"])({
|
|
27
27
|
root: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useToastBodyStyles.styles.js"],"sourcesContent":["import { __resetStyles, __styles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nexport const toastBodyClassNames = {\n root: 'fui-ToastBody',\n subtitle: 'fui-ToastBody__subtitle'\n};\nconst useRootBaseClassName = /*#__PURE__*/__resetStyles(\"rnxxsue\", null, [\".rnxxsue{
|
|
1
|
+
{"version":3,"sources":["useToastBodyStyles.styles.js"],"sourcesContent":["import { __resetStyles, __styles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nexport const toastBodyClassNames = {\n root: 'fui-ToastBody',\n subtitle: 'fui-ToastBody__subtitle'\n};\nconst useRootBaseClassName = /*#__PURE__*/__resetStyles(\"rnxxsue\", null, [\".rnxxsue{grid-column-start:2;grid-column-end:3;padding-top:6px;font-size:var(--fontSizeBase300);line-height:var(--fontSizeBase300);font-weight:var(--fontWeightRegular);color:var(--colorNeutralForeground1);}\"]);\nconst useSubtitleBaseClassName = /*#__PURE__*/__resetStyles(\"rzjw1xk\", null, [\".rzjw1xk{padding-top:4px;grid-column-start:2;grid-column-end:3;font-size:var(--fontSizeBase200);line-height:var(--fontSizeBase200);font-weight:var(--fontWeightRegular);color:var(--colorNeutralForeground2);}\"]);\nconst useInvertedStyles = /*#__PURE__*/__styles({\n root: {\n sj55zd: \"f1w7i9ko\"\n },\n subtitle: {\n sj55zd: \"f1w7i9ko\"\n }\n}, {\n d: [\".f1w7i9ko{color:var(--colorNeutralForegroundInverted2);}\"]\n});\n/**\n * Apply styling to the ToastBody slots based on the state\n */\nexport const useToastBodyStyles_unstable = state => {\n const rootBaseClassName = useRootBaseClassName();\n const subtitleBaseClassName = useSubtitleBaseClassName();\n const invertedStyles = useInvertedStyles();\n state.root.className = mergeClasses(toastBodyClassNames.root, rootBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.root, state.root.className);\n if (state.subtitle) {\n state.subtitle.className = mergeClasses(toastBodyClassNames.subtitle, subtitleBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.subtitle, state.subtitle.className);\n }\n return state;\n};\n//# sourceMappingURL=useToastBodyStyles.styles.js.map"],"names":["toastBodyClassNames","useToastBodyStyles_unstable","root","subtitle","useRootBaseClassName","__resetStyles","useSubtitleBaseClassName","useInvertedStyles","__styles","sj55zd","d","state","rootBaseClassName","subtitleBaseClassName","invertedStyles","className","mergeClasses","backgroundAppearance"],"mappings":";;;;;;;;;;;IAEaA,mBAAmB,MAAnBA;IAmBAC,2BAA2B,MAA3BA;;uBArByC;AAE/C,MAAMD,sBAAsB;IACjCE,MAAM;IACNC,UAAU;AACZ;AACA,MAAMC,uBAAuB,WAAW,GAAEC,IAAAA,uBAAa,EAAC,WAAW,IAAI,EAAE;IAAC;CAAiN;AAC3R,MAAMC,2BAA2B,WAAW,GAAED,IAAAA,uBAAa,EAAC,WAAW,IAAI,EAAE;IAAC;CAAiN;AAC/R,MAAME,oBAAoB,WAAW,GAAEC,IAAAA,kBAAQ,EAAC;IAC9CN,MAAM;QACJO,QAAQ;IACV;IACAN,UAAU;QACRM,QAAQ;IACV;AACF,GAAG;IACDC,GAAG;QAAC;KAA2D;AACjE;AAIO,MAAMT,8BAA8BU,CAAAA,QAAS;IAClD,MAAMC,oBAAoBR;IAC1B,MAAMS,wBAAwBP;IAC9B,MAAMQ,iBAAiBP;IACvBI,MAAMT,IAAI,CAACa,SAAS,GAAGC,IAAAA,mBAAY,EAAChB,oBAAoBE,IAAI,EAAEU,mBAAmBD,MAAMM,oBAAoB,KAAK,cAAcH,eAAeZ,IAAI,EAAES,MAAMT,IAAI,CAACa,SAAS;IACvK,IAAIJ,MAAMR,QAAQ,EAAE;QAClBQ,MAAMR,QAAQ,CAACY,SAAS,GAAGC,IAAAA,mBAAY,EAAChB,oBAAoBG,QAAQ,EAAEU,uBAAuBF,MAAMM,oBAAoB,KAAK,cAAcH,eAAeX,QAAQ,EAAEQ,MAAMR,QAAQ,CAACY,SAAS;IAC7L,CAAC;IACD,OAAOJ;AACT,GACA,qDAAqD"}
|
|
@@ -12,7 +12,7 @@ const _reactTransitionGroup = require("react-transition-group");
|
|
|
12
12
|
const _toastContainerContext = require("../../contexts/toastContainerContext");
|
|
13
13
|
const renderToastContainer_unstable = (state, contextValues)=>{
|
|
14
14
|
const { onTransitionEntering , visible , transitionTimeout , remove , nodeRef } = state;
|
|
15
|
-
|
|
15
|
+
(0, _reactUtilities.assertSlots)(state);
|
|
16
16
|
return /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(_reactTransitionGroup.Transition, {
|
|
17
17
|
in: visible,
|
|
18
18
|
appear: true,
|
|
@@ -23,5 +23,5 @@ const renderToastContainer_unstable = (state, contextValues)=>{
|
|
|
23
23
|
nodeRef: nodeRef
|
|
24
24
|
}, /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(_toastContainerContext.ToastContainerContextProvider, {
|
|
25
25
|
value: contextValues.toast
|
|
26
|
-
}, /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(
|
|
26
|
+
}, /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.root, null), /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.timer, null)));
|
|
27
27
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderToastContainer.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';\nimport {
|
|
1
|
+
{"version":3,"sources":["renderToastContainer.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-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__*/ createElement(Transition, {\n in: visible,\n appear: true,\n unmountOnExit: true,\n timeout: transitionTimeout,\n onExited: remove,\n onEntering: onTransitionEntering,\n nodeRef: nodeRef\n }, /*#__PURE__*/ createElement(ToastContainerContextProvider, {\n value: contextValues.toast\n }, /*#__PURE__*/ createElement(state.root, null), /*#__PURE__*/ createElement(state.timer, null)));\n};\n"],"names":["renderToastContainer_unstable","state","contextValues","onTransitionEntering","visible","transitionTimeout","remove","nodeRef","assertSlots","createElement","Transition","in","appear","unmountOnExit","timeout","onExited","onEntering","ToastContainerContextProvider","value","toast","root","timer"],"mappings":"AAAA,wBAAwB,GAAG,uBAAuB;;;;+BAMjCA;;aAAAA;;iCANkE;gCACvD;sCACD;uCACmB;AAGnC,MAAMA,gCAAgC,CAACC,OAAOC,gBAAgB;IACrE,MAAM,EAAEC,qBAAoB,EAAGC,QAAO,EAAGC,kBAAiB,EAAGC,OAAM,EAAGC,QAAO,EAAG,GAAGN;IACnFO,IAAAA,2BAAW,EAACP;IACZ,OAAO,WAAW,GAAGQ,IAAAA,8BAAa,EAACC,gCAAU,EAAE;QAC3CC,IAAIP;QACJQ,QAAQ,IAAI;QACZC,eAAe,IAAI;QACnBC,SAAST;QACTU,UAAUT;QACVU,YAAYb;QACZI,SAASA;IACb,GAAG,WAAW,GAAGE,IAAAA,8BAAa,EAACQ,oDAA6B,EAAE;QAC1DC,OAAOhB,cAAciB,KAAK;IAC9B,GAAG,WAAW,GAAGV,IAAAA,8BAAa,EAACR,MAAMmB,IAAI,EAAE,IAAI,GAAG,WAAW,GAAGX,IAAAA,8BAAa,EAACR,MAAMoB,KAAK,EAAE,IAAI;AACnG"}
|