@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
|
@@ -10,8 +10,9 @@ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildc
|
|
|
10
10
|
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
|
11
11
|
const _reactUtilities = require("@fluentui/react-utilities");
|
|
12
12
|
const _reactSharedContexts = require("@fluentui/react-shared-contexts");
|
|
13
|
-
const
|
|
13
|
+
const _keyboardKeys = require("@fluentui/keyboard-keys");
|
|
14
14
|
const _reactTabster = require("@fluentui/react-tabster");
|
|
15
|
+
const _timer = require("../Timer/Timer");
|
|
15
16
|
const intentPolitenessMap = {
|
|
16
17
|
success: 'assertive',
|
|
17
18
|
warning: 'assertive',
|
|
@@ -27,6 +28,16 @@ const useToastContainer_unstable = (props, ref)=>{
|
|
|
27
28
|
const [running, setRunning] = _react.useState(false);
|
|
28
29
|
const imperativePauseRef = _react.useRef(false);
|
|
29
30
|
const focusedToastBeforeClose = _react.useRef(false);
|
|
31
|
+
const focusableGroupAttribute = (0, _reactTabster.useFocusableGroup)({
|
|
32
|
+
tabBehavior: 'limited-trap-focus',
|
|
33
|
+
// Users should only use Tab to focus into the toast
|
|
34
|
+
// Escape is already reserved to dismiss all toasts
|
|
35
|
+
ignoreDefaultKeydown: {
|
|
36
|
+
Tab: true,
|
|
37
|
+
Escape: true,
|
|
38
|
+
Enter: true
|
|
39
|
+
}
|
|
40
|
+
});
|
|
30
41
|
const close = (0, _reactUtilities.useEventCallback)(()=>{
|
|
31
42
|
var _toastRef_current;
|
|
32
43
|
const activeElement = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement;
|
|
@@ -58,18 +69,12 @@ const useToastContainer_unstable = (props, ref)=>{
|
|
|
58
69
|
setRunning(true);
|
|
59
70
|
}
|
|
60
71
|
});
|
|
61
|
-
const { findFirstFocusable } = (0, _reactTabster.useFocusFinders)();
|
|
62
72
|
_react.useImperativeHandle(imperativeRef, ()=>({
|
|
63
73
|
focus: ()=>{
|
|
64
74
|
if (!toastRef.current) {
|
|
65
75
|
return;
|
|
66
76
|
}
|
|
67
|
-
|
|
68
|
-
if (firstFocusable) {
|
|
69
|
-
firstFocusable.focus();
|
|
70
|
-
} else {
|
|
71
|
-
toastRef.current.focus();
|
|
72
|
-
}
|
|
77
|
+
toastRef.current.focus();
|
|
73
78
|
},
|
|
74
79
|
play: ()=>{
|
|
75
80
|
imperativePauseRef.current = false;
|
|
@@ -142,12 +147,23 @@ const useToastContainer_unstable = (props, ref)=>{
|
|
|
142
147
|
play();
|
|
143
148
|
userRootSlot === null || userRootSlot === void 0 ? void 0 : (_userRootSlot_onMouseEnter = userRootSlot.onMouseEnter) === null || _userRootSlot_onMouseEnter === void 0 ? void 0 : _userRootSlot_onMouseEnter.call(userRootSlot, e);
|
|
144
149
|
});
|
|
150
|
+
const { findFirstFocusable , findLastFocusable } = (0, _reactTabster.useFocusFinders)();
|
|
145
151
|
const onKeyDown = (0, _reactUtilities.useEventCallback)((e)=>{
|
|
146
152
|
var _userRootSlot_onKeyDown;
|
|
147
|
-
if (e.key ===
|
|
153
|
+
if (e.key === _keyboardKeys.Delete) {
|
|
148
154
|
e.preventDefault();
|
|
149
155
|
close();
|
|
150
156
|
}
|
|
157
|
+
if (e.key === _keyboardKeys.Tab && e.currentTarget === e.target) {
|
|
158
|
+
e.preventDefault();
|
|
159
|
+
if (e.shiftKey) {
|
|
160
|
+
var _findLastFocusable;
|
|
161
|
+
(_findLastFocusable = findLastFocusable(e.currentTarget)) === null || _findLastFocusable === void 0 ? void 0 : _findLastFocusable.focus();
|
|
162
|
+
} else {
|
|
163
|
+
var _findFirstFocusable;
|
|
164
|
+
(_findFirstFocusable = findFirstFocusable(e.currentTarget)) === null || _findFirstFocusable === void 0 ? void 0 : _findFirstFocusable.focus();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
151
167
|
userRootSlot === null || userRootSlot === void 0 ? void 0 : (_userRootSlot_onKeyDown = userRootSlot.onKeyDown) === null || _userRootSlot_onKeyDown === void 0 ? void 0 : _userRootSlot_onKeyDown.call(userRootSlot, e);
|
|
152
168
|
});
|
|
153
169
|
_react.useEffect(()=>{
|
|
@@ -183,26 +199,29 @@ const useToastContainer_unstable = (props, ref)=>{
|
|
|
183
199
|
timer: _timer.Timer,
|
|
184
200
|
root: 'div'
|
|
185
201
|
},
|
|
186
|
-
timer:
|
|
202
|
+
timer: _reactUtilities.slot.always({
|
|
187
203
|
key: updateId,
|
|
188
204
|
onTimeout: close,
|
|
189
205
|
running,
|
|
190
206
|
timeout: timerTimeout !== null && timerTimeout !== void 0 ? timerTimeout : -1
|
|
191
207
|
}, {
|
|
192
|
-
|
|
208
|
+
elementType: _timer.Timer
|
|
193
209
|
}),
|
|
194
|
-
root: (0, _reactUtilities.getNativeElementProps)('div', {
|
|
210
|
+
root: _reactUtilities.slot.always((0, _reactUtilities.getNativeElementProps)('div', {
|
|
195
211
|
ref: (0, _reactUtilities.useMergedRefs)(ref, toastRef, toastAnimationRef),
|
|
196
212
|
children,
|
|
197
|
-
tabIndex:
|
|
198
|
-
role: '
|
|
213
|
+
tabIndex: 0,
|
|
214
|
+
role: 'listitem',
|
|
199
215
|
'aria-labelledby': titleId,
|
|
200
216
|
'aria-describedby': bodyId,
|
|
201
217
|
...rest,
|
|
202
218
|
...userRootSlot,
|
|
219
|
+
...focusableGroupAttribute,
|
|
203
220
|
onMouseEnter,
|
|
204
221
|
onMouseLeave,
|
|
205
222
|
onKeyDown
|
|
223
|
+
}), {
|
|
224
|
+
elementType: 'div'
|
|
206
225
|
}),
|
|
207
226
|
timerTimeout,
|
|
208
227
|
transitionTimeout: 500,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useToastContainer.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useMergedRefs, useEventCallback, resolveShorthand, useId } from '@fluentui/react-utilities';\nimport { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport { Timer } from '../Timer/Timer';\nimport { useFocusFinders } from '@fluentui/react-tabster';\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 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 const { findFirstFocusable } = useFocusFinders();\n React.useImperativeHandle(imperativeRef, ()=>({\n focus: ()=>{\n if (!toastRef.current) {\n return;\n }\n const firstFocusable = findFirstFocusable(toastRef.current);\n if (firstFocusable) {\n firstFocusable.focus();\n } else {\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 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 onKeyDown = useEventCallback((e)=>{\n var _userRootSlot_onKeyDown;\n if (e.key === 'Escape') {\n e.preventDefault();\n close();\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: resolveShorthand({\n key: updateId,\n onTimeout: close,\n running,\n timeout: timerTimeout !== null && timerTimeout !== void 0 ? timerTimeout : -1\n }, {\n required: true\n }),\n root: getNativeElementProps('div', {\n ref: useMergedRefs(ref, toastRef, toastAnimationRef),\n children,\n tabIndex: -1,\n role: 'group',\n 'aria-labelledby': titleId,\n 'aria-describedby': bodyId,\n ...rest,\n ...userRootSlot,\n onMouseEnter,\n onMouseLeave,\n onKeyDown\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","useEventCallback","_toastRef_current","activeElement","current","contains","onStatusChange","status","_props_onStatusChange","call","pause","play","_targetDocument_activeElement","containsActive","findFirstFocusable","useFocusFinders","useImperativeHandle","focus","firstFocusable","useEffect","_targetDocument_defaultView","_targetDocument_defaultView1","defaultView","addEventListener","removeEventListener","onTransitionEntering","element","style","setProperty","scrollHeight","userRootSlot","root","toastAnimationRef","useCallback","el","once","onMouseEnter","e","_userRootSlot_onMouseEnter","onMouseLeave","onKeyDown","_userRootSlot_onKeyDown","key","preventDefault","_toastRef_current_textContent","textContent","components","timer","Timer","resolveShorthand","onTimeout","required","getNativeElementProps","useMergedRefs","tabIndex","role","transitionTimeout","nodeRef"],"mappings":";;;;+BAmBiBA;;aAAAA;;;6DAnBM;gCACyE;qCAC7D;uBACb;8BACU;AAChC,MAAMC,sBAAsB;IACxBC,SAAS;IACTC,SAAS;IACTC,OAAO;IACPC,MAAM;AACV;AASW,MAAML,6BAA6B,CA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AACmB,OAAO;QAC/H,IAAI8D;QACJpE,SAAS,AAACoE,CAAAA,gCAAgC,AAAC1C,CAAAA,oBAAoBX,SAASa,OAAO,AAAD,MAAO,IAAI,IAAIF,sBAAsB,KAAK,IAAI,KAAK,IAAIA,kBAAkB2C,WAAW,AAAD,MAAO,IAAI,IAAID,kCAAkC,KAAK,IAAIA,gCAAgC,EAAE,EAAE;YAC3PhE;QACJ;IACJ,GAAG;QACCJ;QACAK;QACAU;QACArB;QACAK;QACAO;KACH;IACDU,OAAM2B,SAAS,CAAC,IAAI;QAChB,OAAO,IAAI;YACP,IAAInB,wBAAwBI,OAAO,EAAE;gBACjCJ,wBAAwBI,OAAO,GAAG,KAAK;gBACvClB;YACJ,CAAC;QACL;IACJ,GAAG;QACCA;KACH;IACD,OAAO;QACH4D,YAAY;YACRC,OAAOC,YAAK;YACZjB,MAAM;QACV;QACAgB,OAAOE,IAAAA,gCAAgB,EAAC;YACpBP,KAAKnE;YACL2E,WAAW9E;YACXwB;YACAlB,SAASC,iBAAiB,IAAI,IAAIA,iBAAiB,KAAK,IAAIA,eAAe,CAAC,CAAC;QACjF,GAAG;YACCwE,UAAU,IAAI;QAClB;QACApB,MAAMqB,IAAAA,qCAAqB,EAAC,OAAO;YAC/BnF,KAAKoF,IAAAA,6BAAa,EAACpF,KAAKsB,UAAUyC;YAClC7D;YACAmF,UAAU,CAAC;YACXC,MAAM;YACN,mBAAmBnE;YACnB,oBAAoBE;YACpB,GAAGH,IAAI;YACP,GAAG2C,YAAY;YACfM;YACAG;YACAC;QACJ;QACA7D;QACA6E,mBAAmB;QACnB5D;QACA1B;QACAI;QACAF;QACAqD;QACAlD;QACAkF,SAASlE;QACTT;QACAM;QACAE;IACJ;AACJ"}
|
|
1
|
+
{"version":3,"sources":["useToastContainer.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, 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(getNativeElementProps('div', {\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","getNativeElementProps","useMergedRefs","tabIndex","role","transitionTimeout","nodeRef"],"mappings":";;;;+BAoBiBA;;aAAAA;;;6DApBM;gCAC6D;qCACjD;8BACP;8BACuB;uBAC7B;AACtB,MAAMC,sBAAsB;IACxBC,SAAS;IACTC,SAAS;IACTC,OAAO;IACPC,MAAM;AACV;AASW,MAAML,6BAA6B,CAACM,OAAOC,MAAM;IACxD,MAAM,EAAEC,QAAO,EAAGC,SAAQ,EAAGC,OAAOC,UAAS,EAAGC,OAAM,EAAGC,SAAQ,EAAGC,SAAQ,EAAGC,KAAI,EAAGC,SAASC,aAAY,EAAGC,YAAYC,kBAAiB,EAAGC,QAAQ,OAAM,EAAGC,aAAY,EAAGC,kBAAiB,EAAGC,cAAa,EAAGC,gBAAe,EAAG,GAAGC,MAAM,GAAGnB;IAChP,MAAMoB,UAAUC,IAAAA,qBAAK,EAAC;IACtB,MAAMC,SAASD,IAAAA,qBAAK,EAAC;IACrB,MAAME,WAAWC,OAAMC,MAAM,CAAC,IAAI;IAClC,MAAM,EAAEC,eAAc,EAAG,GAAGC,IAAAA,uCAAkB;IAC9C,MAAM,CAACC,SAASC,WAAW,GAAGL,OAAMM,QAAQ,CAAC,KAAK;IAClD,MAAMC,qBAAqBP,OAAMC,MAAM,CAAC,KAAK;IAC7C,MAAMO,0BAA0BR,OAAMC,MAAM,CAAC,KAAK;IAClD,MAAMQ,0BAA0BC,IAAAA,+BAAiB,EAA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AO,IAAI,IAAIF,sBAAsB,KAAK,IAAI,KAAK,IAAIA,kBAAkBiD,WAAW,AAAD,MAAO,IAAI,IAAID,kCAAkC,KAAK,IAAIA,gCAAgC,EAAE,EAAE;YAC3P7E;QACJ;IACJ,GAAG;QACCJ;QACAK;QACAU;QACArB;QACAK;QACAO;KACH;IACDU,OAAM+B,SAAS,CAAC,IAAI;QAChB,OAAO,IAAI;YACP,IAAIvB,wBAAwBW,OAAO,EAAE;gBACjCX,wBAAwBW,OAAO,GAAG,KAAK;gBACvCzB;YACJ,CAAC;QACL;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,IAAI,IAAIA,iBAAiB,KAAK,IAAIA,eAAe,CAAC,CAAC;QACjF,GAAG;YACCsF,aAAaJ,YAAK;QACtB;QACA1B,MAAM2B,oBAAI,CAACC,MAAM,CAACG,IAAAA,qCAAqB,EAAC,OAAO;YAC3CjG,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"}
|
|
@@ -9,11 +9,11 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
|
|
12
|
+
toastContainerClassNames: ()=>toastContainerClassNames,
|
|
13
13
|
useToastContainerStyles_unstable: ()=>useToastContainerStyles_unstable
|
|
14
14
|
});
|
|
15
15
|
const _react = require("@griffel/react");
|
|
16
|
-
const
|
|
16
|
+
const toastContainerClassNames = {
|
|
17
17
|
root: 'fui-ToastContainer',
|
|
18
18
|
timer: 'fui-ToastContainer__timer'
|
|
19
19
|
};
|
|
@@ -38,27 +38,23 @@ const useRootBaseClassName = /*#__PURE__*/ (0, _react["__resetStyles"])("r1qaza6
|
|
|
38
38
|
}
|
|
39
39
|
}, {
|
|
40
40
|
d: [
|
|
41
|
-
".fayl5bc{
|
|
42
|
-
".f17oyct0{
|
|
43
|
-
".fvv8lvk{
|
|
44
|
-
".f1tk3cza{
|
|
45
|
-
".f1nx6yy9{
|
|
46
|
-
".f9wuypy{
|
|
41
|
+
".fayl5bc{animation-duration:200ms,400ms;}",
|
|
42
|
+
".f17oyct0{animation-delay:0ms,200ms;}",
|
|
43
|
+
".fvv8lvk{animation-name:f1rp83na,f5j8bii;}",
|
|
44
|
+
".f1tk3cza{animation-duration:400ms,200ms;}",
|
|
45
|
+
".f1nx6yy9{animation-delay:0ms,400ms;}",
|
|
46
|
+
".f9wuypy{animation-name:fk0lfw7,f1n32sdh;}"
|
|
47
47
|
],
|
|
48
48
|
k: [
|
|
49
|
-
"@-webkit-keyframes f1rp83na{from{max-height:0;opacity:0;margin-top:0;}to{margin-top:16px;opacity:0;max-height:var(--fui-toast-height);}}",
|
|
50
49
|
"@keyframes f1rp83na{from{max-height:0;opacity:0;margin-top:0;}to{margin-top:16px;opacity:0;max-height:var(--fui-toast-height);}}",
|
|
51
|
-
"@-webkit-keyframes f5j8bii{from{opacity:0;}to{opacity:1;}}",
|
|
52
50
|
"@keyframes f5j8bii{from{opacity:0;}to{opacity:1;}}",
|
|
53
|
-
"@-webkit-keyframes fk0lfw7{from{opacity:1;}to{opacity:0;}}",
|
|
54
51
|
"@keyframes fk0lfw7{from{opacity:1;}to{opacity:0;}}",
|
|
55
|
-
"@-webkit-keyframes f1n32sdh{from{opacity:0;}to{opacity:0;margin-top:0;max-height:0;}}",
|
|
56
52
|
"@keyframes f1n32sdh{from{opacity:0;}to{opacity:0;margin-top:0;max-height:0;}}"
|
|
57
53
|
]
|
|
58
54
|
});
|
|
59
55
|
const useToastContainerStyles_unstable = (state)=>{
|
|
60
56
|
const rootBaseClassName = useRootBaseClassName();
|
|
61
57
|
const styles = useStyles();
|
|
62
|
-
state.root.className = (0, _react.mergeClasses)(
|
|
58
|
+
state.root.className = (0, _react.mergeClasses)(toastContainerClassNames.root, rootBaseClassName, state.visible ? styles.enter : styles.exit, state.root.className);
|
|
63
59
|
return state;
|
|
64
60
|
}; //# sourceMappingURL=useToastContainerStyles.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useToastContainerStyles.styles.js"],"sourcesContent":["import { __resetStyles, __styles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';\nexport const
|
|
1
|
+
{"version":3,"sources":["useToastContainerStyles.styles.js"],"sourcesContent":["import { __resetStyles, __styles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';\nexport const toastContainerClassNames = {\n root: 'fui-ToastContainer',\n timer: 'fui-ToastContainer__timer'\n};\nconst useRootBaseClassName = /*#__PURE__*/__resetStyles(\"r1qaza64\", \"r1e6dlul\", [\".r1qaza64{box-sizing:border-box;margin-top:16px;min-height:44px;pointer-events:all;border-bottom-right-radius:var(--borderRadiusMedium);border-bottom-left-radius:var(--borderRadiusMedium);border-top-right-radius:var(--borderRadiusMedium);border-top-left-radius:var(--borderRadiusMedium);--fui-toast-height:44px;}\", \".r1qaza64[data-fui-focus-visible]{outline-width:var(--strokeWidthThick);outline-style:solid;outline-color:var(--colorStrokeFocus2);}\", \".r1e6dlul{box-sizing:border-box;margin-top:16px;min-height:44px;pointer-events:all;border-bottom-left-radius:var(--borderRadiusMedium);border-bottom-right-radius:var(--borderRadiusMedium);border-top-left-radius:var(--borderRadiusMedium);border-top-right-radius:var(--borderRadiusMedium);--fui-toast-height:44px;}\", \".r1e6dlul[data-fui-focus-visible]{outline-width:var(--strokeWidthThick);outline-style:solid;outline-color:var(--colorStrokeFocus2);}\"]);\n/**\n * Styles for the root slot\n */\nconst useStyles = /*#__PURE__*/__styles({\n enter: {\n vin17d: \"fayl5bc\",\n m1gqa9: \"f17oyct0\",\n Bv12yb3: \"fvv8lvk\"\n },\n exit: {\n vin17d: \"f1tk3cza\",\n m1gqa9: \"f1nx6yy9\",\n Bv12yb3: \"f9wuypy\"\n }\n}, {\n d: [\".fayl5bc{animation-duration:200ms,400ms;}\", \".f17oyct0{animation-delay:0ms,200ms;}\", \".fvv8lvk{animation-name:f1rp83na,f5j8bii;}\", \".f1tk3cza{animation-duration:400ms,200ms;}\", \".f1nx6yy9{animation-delay:0ms,400ms;}\", \".f9wuypy{animation-name:fk0lfw7,f1n32sdh;}\"],\n k: [\"@keyframes f1rp83na{from{max-height:0;opacity:0;margin-top:0;}to{margin-top:16px;opacity:0;max-height:var(--fui-toast-height);}}\", \"@keyframes f5j8bii{from{opacity:0;}to{opacity:1;}}\", \"@keyframes fk0lfw7{from{opacity:1;}to{opacity:0;}}\", \"@keyframes f1n32sdh{from{opacity:0;}to{opacity:0;margin-top:0;max-height:0;}}\"]\n});\n/**\n * Apply styling to the ToastContainer slots based on the state\n */\nexport const useToastContainerStyles_unstable = state => {\n const rootBaseClassName = useRootBaseClassName();\n const styles = useStyles();\n state.root.className = mergeClasses(toastContainerClassNames.root, rootBaseClassName, state.visible ? styles.enter : styles.exit, state.root.className);\n return state;\n};\n//# sourceMappingURL=useToastContainerStyles.styles.js.map"],"names":["toastContainerClassNames","useToastContainerStyles_unstable","root","timer","useRootBaseClassName","__resetStyles","useStyles","__styles","enter","vin17d","m1gqa9","Bv12yb3","exit","d","k","state","rootBaseClassName","styles","className","mergeClasses","visible"],"mappings":";;;;;;;;;;;IAGaA,wBAAwB,MAAxBA;IA0BAC,gCAAgC,MAAhCA;;uBA7BqD;AAG3D,MAAMD,2BAA2B;IACtCE,MAAM;IACNC,OAAO;AACT;AACA,MAAMC,uBAAuB,WAAW,GAAEC,IAAAA,uBAAa,EAAC,YAAY,YAAY;IAAC;IAA4T;IAAwI;IAA4T;CAAuI;AACx9B;;CAEC,GACD,MAAMC,YAAY,WAAW,GAAEC,IAAAA,kBAAQ,EAAC;IACtCC,OAAO;QACLC,QAAQ;QACRC,QAAQ;QACRC,SAAS;IACX;IACAC,MAAM;QACJH,QAAQ;QACRC,QAAQ;QACRC,SAAS;IACX;AACF,GAAG;IACDE,GAAG;QAAC;QAA6C;QAAyC;QAA8C;QAA8C;QAAyC;KAA6C;IAC5QC,GAAG;QAAC;QAAoI;QAAsD;QAAsD;KAAgF;AACtU;AAIO,MAAMb,mCAAmCc,CAAAA,QAAS;IACvD,MAAMC,oBAAoBZ;IAC1B,MAAMa,SAASX;IACfS,MAAMb,IAAI,CAACgB,SAAS,GAAGC,IAAAA,mBAAY,EAACnB,yBAAyBE,IAAI,EAAEc,mBAAmBD,MAAMK,OAAO,GAAGH,OAAOT,KAAK,GAAGS,OAAOL,IAAI,EAAEG,MAAMb,IAAI,CAACgB,SAAS;IACtJ,OAAOH;AACT,GACA,0DAA0D"}
|
|
@@ -9,6 +9,6 @@ Object.defineProperty(exports, "renderToastFooter_unstable", {
|
|
|
9
9
|
const _reactJsxRuntime = require("@fluentui/react-jsx-runtime");
|
|
10
10
|
const _reactUtilities = require("@fluentui/react-utilities");
|
|
11
11
|
const renderToastFooter_unstable = (state)=>{
|
|
12
|
-
|
|
13
|
-
return /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(
|
|
12
|
+
(0, _reactUtilities.assertSlots)(state);
|
|
13
|
+
return /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.root, null);
|
|
14
14
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderToastFooter.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';\nimport {
|
|
1
|
+
{"version":3,"sources":["renderToastFooter.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';\nimport { assertSlots } from '@fluentui/react-utilities';\n/**\n * Render the final JSX of ToastFooter\n */ export const renderToastFooter_unstable = (state)=>{\n assertSlots(state);\n return /*#__PURE__*/ createElement(state.root, null);\n};\n"],"names":["renderToastFooter_unstable","state","assertSlots","createElement","root"],"mappings":"AAAA,wBAAwB,GAAG,uBAAuB;;;;+BAIjCA;;aAAAA;;iCAJkE;gCACvD;AAGjB,MAAMA,6BAA6B,CAACC,QAAQ;IACnDC,IAAAA,2BAAW,EAACD;IACZ,OAAO,WAAW,GAAGE,IAAAA,8BAAa,EAACF,MAAMG,IAAI,EAAE,IAAI;AACvD"}
|
|
@@ -14,9 +14,11 @@ const useToastFooter_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
|
};
|
|
22
24
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useToastFooter.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps } from '@fluentui/react-utilities';\n/**\n * Create the state required to render ToastFooter.\n *\n * The returned state can be modified with hooks such as useToastFooterStyles_unstable,\n * before being passed to renderToastFooter_unstable.\n *\n * @param props - props from this instance of ToastFooter\n * @param ref - reference to root HTMLElement of ToastFooter\n */ export const useToastFooter_unstable = (props, ref)=>{\n return {\n components: {\n root: 'div'\n },\n root: getNativeElementProps('div', {\n ref,\n ...props\n })\n };\n};\n"],"names":["useToastFooter_unstable","props","ref","components","root","getNativeElementProps"],"mappings":";;;;+BAUiBA;;aAAAA;;;6DAVM;
|
|
1
|
+
{"version":3,"sources":["useToastFooter.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, slot } from '@fluentui/react-utilities';\n/**\n * Create the state required to render ToastFooter.\n *\n * The returned state can be modified with hooks such as useToastFooterStyles_unstable,\n * before being passed to renderToastFooter_unstable.\n *\n * @param props - props from this instance of ToastFooter\n * @param ref - reference to root HTMLElement of ToastFooter\n */ export const useToastFooter_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 };\n};\n"],"names":["useToastFooter_unstable","props","ref","components","root","slot","always","getNativeElementProps","elementType"],"mappings":";;;;+BAUiBA;;aAAAA;;;6DAVM;gCACqB;AASjC,MAAMA,0BAA0B,CAACC,OAAOC,MAAM;IACrD,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;IACJ;AACJ"}
|
|
@@ -19,7 +19,7 @@ const toastFooterClassNames = {
|
|
|
19
19
|
/**
|
|
20
20
|
* Styles for the root slot
|
|
21
21
|
*/ const useRootBaseClassName = /*#__PURE__*/ (0, _react["__resetStyles"])("r1u6izx1", null, [
|
|
22
|
-
".r1u6izx1{padding-top:16px
|
|
22
|
+
".r1u6izx1{padding-top:16px;grid-column-start:2;grid-column-end:3;display:flex;align-items:center;column-gap:14px;row-gap:14px;}"
|
|
23
23
|
]);
|
|
24
24
|
const useToastFooterStyles_unstable = (state)=>{
|
|
25
25
|
const rootBaseClassName = useRootBaseClassName();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useToastFooterStyles.styles.js"],"sourcesContent":["import { __resetStyles, mergeClasses, shorthands } from '@griffel/react';\nexport const toastFooterClassNames = {\n root: 'fui-ToastFooter'\n};\n/**\n * Styles for the root slot\n */\nconst useRootBaseClassName = /*#__PURE__*/__resetStyles(\"r1u6izx1\", null, [\".r1u6izx1{padding-top:16px
|
|
1
|
+
{"version":3,"sources":["useToastFooterStyles.styles.js"],"sourcesContent":["import { __resetStyles, mergeClasses, shorthands } from '@griffel/react';\nexport const toastFooterClassNames = {\n root: 'fui-ToastFooter'\n};\n/**\n * Styles for the root slot\n */\nconst useRootBaseClassName = /*#__PURE__*/__resetStyles(\"r1u6izx1\", null, [\".r1u6izx1{padding-top:16px;grid-column-start:2;grid-column-end:3;display:flex;align-items:center;column-gap:14px;row-gap:14px;}\"]);\n/**\n * Apply styling to the ToastFooter slots based on the state\n */\nexport const useToastFooterStyles_unstable = state => {\n const rootBaseClassName = useRootBaseClassName();\n state.root.className = mergeClasses(toastFooterClassNames.root, rootBaseClassName, state.root.className);\n return state;\n};\n//# sourceMappingURL=useToastFooterStyles.styles.js.map"],"names":["toastFooterClassNames","useToastFooterStyles_unstable","root","useRootBaseClassName","__resetStyles","state","rootBaseClassName","className","mergeClasses"],"mappings":";;;;;;;;;;;IACaA,qBAAqB,MAArBA;IAUAC,6BAA6B,MAA7BA;;uBAX2C;AACjD,MAAMD,wBAAwB;IACnCE,MAAM;AACR;AACA;;CAEC,GACD,MAAMC,uBAAuB,WAAW,GAAEC,IAAAA,uBAAa,EAAC,YAAY,IAAI,EAAE;IAAC;CAAkI;AAItM,MAAMH,gCAAgCI,CAAAA,QAAS;IACpD,MAAMC,oBAAoBH;IAC1BE,MAAMH,IAAI,CAACK,SAAS,GAAGC,IAAAA,mBAAY,EAACR,sBAAsBE,IAAI,EAAEI,mBAAmBD,MAAMH,IAAI,CAACK,SAAS;IACvG,OAAOF;AACT,GACA,uDAAuD"}
|
|
@@ -9,6 +9,6 @@ Object.defineProperty(exports, "renderToastTitle_unstable", {
|
|
|
9
9
|
const _reactJsxRuntime = require("@fluentui/react-jsx-runtime");
|
|
10
10
|
const _reactUtilities = require("@fluentui/react-utilities");
|
|
11
11
|
const renderToastTitle_unstable = (state)=>{
|
|
12
|
-
|
|
13
|
-
return /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(_reactJsxRuntime.Fragment, null,
|
|
12
|
+
(0, _reactUtilities.assertSlots)(state);
|
|
13
|
+
return /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(_reactJsxRuntime.Fragment, null, state.media ? /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.media, null) : null, /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.root, null), state.action ? /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.action, null) : null);
|
|
14
14
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderToastTitle.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsxFrag Fragment */ /** @jsx createElement */ import { createElement, Fragment } from '@fluentui/react-jsx-runtime';\nimport {
|
|
1
|
+
{"version":3,"sources":["renderToastTitle.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 ToastTitle\n */ export const renderToastTitle_unstable = (state)=>{\n assertSlots(state);\n return /*#__PURE__*/ createElement(Fragment, null, state.media ? /*#__PURE__*/ createElement(state.media, null) : null, /*#__PURE__*/ createElement(state.root, null), state.action ? /*#__PURE__*/ createElement(state.action, null) : null);\n};\n"],"names":["renderToastTitle_unstable","state","assertSlots","createElement","Fragment","media","root","action"],"mappings":"AAAA,wBAAwB,GAAG,sBAAsB,GAAG,uBAAuB;;;;+BAI1DA;;aAAAA;;iCAJqG;gCAC1F;AAGjB,MAAMA,4BAA4B,CAACC,QAAQ;IAClDC,IAAAA,2BAAW,EAACD;IACZ,OAAO,WAAW,GAAGE,IAAAA,8BAAa,EAACC,yBAAQ,EAAE,IAAI,EAAEH,MAAMI,KAAK,GAAG,WAAW,GAAGF,IAAAA,8BAAa,EAACF,MAAMI,KAAK,EAAE,IAAI,IAAI,IAAI,EAAE,WAAW,GAAGF,IAAAA,8BAAa,EAACF,MAAMK,IAAI,EAAE,IAAI,GAAGL,MAAMM,MAAM,GAAG,WAAW,GAAGJ,IAAAA,8BAAa,EAACF,MAAMM,MAAM,EAAE,IAAI,IAAI,IAAI;AAChP"}
|
|
@@ -31,23 +31,28 @@ const useToastTitle_unstable = (props, ref)=>{
|
|
|
31
31
|
break;
|
|
32
32
|
}
|
|
33
33
|
return {
|
|
34
|
-
action:
|
|
34
|
+
action: _reactUtilities.slot.optional(props.action, {
|
|
35
|
+
elementType: 'div'
|
|
36
|
+
}),
|
|
35
37
|
components: {
|
|
36
38
|
root: 'div',
|
|
37
39
|
media: 'div',
|
|
38
40
|
action: 'div'
|
|
39
41
|
},
|
|
40
|
-
media:
|
|
41
|
-
|
|
42
|
+
media: _reactUtilities.slot.optional(props.media, {
|
|
43
|
+
renderByDefault: !!intent,
|
|
42
44
|
defaultProps: {
|
|
43
45
|
children: defaultIcon
|
|
44
|
-
}
|
|
46
|
+
},
|
|
47
|
+
elementType: 'div'
|
|
45
48
|
}),
|
|
46
|
-
root: (0, _reactUtilities.getNativeElementProps)('div', {
|
|
49
|
+
root: _reactUtilities.slot.always((0, _reactUtilities.getNativeElementProps)('div', {
|
|
47
50
|
ref,
|
|
48
51
|
children: props.children,
|
|
49
52
|
id: titleId,
|
|
50
53
|
...props
|
|
54
|
+
}), {
|
|
55
|
+
elementType: 'div'
|
|
51
56
|
}),
|
|
52
57
|
intent,
|
|
53
58
|
backgroundAppearance
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useToastTitle.js"],"sourcesContent":["import * as React from 'react';\nimport { CheckmarkCircleFilled, DismissCircleFilled, InfoFilled, WarningFilled } from '@fluentui/react-icons';\nimport { getNativeElementProps,
|
|
1
|
+
{"version":3,"sources":["useToastTitle.js"],"sourcesContent":["import * as React from 'react';\nimport { CheckmarkCircleFilled, DismissCircleFilled, InfoFilled, WarningFilled } from '@fluentui/react-icons';\nimport { getNativeElementProps, slot } from '@fluentui/react-utilities';\nimport { useBackgroundAppearance } from '@fluentui/react-shared-contexts';\nimport { useToastContainerContext } from '../../contexts/toastContainerContext';\n/**\n * Create the state required to render ToastTitle.\n *\n * The returned state can be modified with hooks such as useToastTitleStyles_unstable,\n * before being passed to renderToastTitle_unstable.\n *\n * @param props - props from this instance of ToastTitle\n * @param ref - reference to root HTMLElement of ToastTitle\n */ export const useToastTitle_unstable = (props, ref)=>{\n const { intent , titleId } = useToastContainerContext();\n const backgroundAppearance = useBackgroundAppearance();\n /** Determine the role and media to render based on the intent */ let defaultIcon;\n switch(intent){\n case 'success':\n defaultIcon = /*#__PURE__*/ React.createElement(CheckmarkCircleFilled, null);\n break;\n case 'error':\n defaultIcon = /*#__PURE__*/ React.createElement(DismissCircleFilled, null);\n break;\n case 'warning':\n defaultIcon = /*#__PURE__*/ React.createElement(WarningFilled, null);\n break;\n case 'info':\n defaultIcon = /*#__PURE__*/ React.createElement(InfoFilled, null);\n break;\n }\n return {\n action: slot.optional(props.action, {\n elementType: 'div'\n }),\n components: {\n root: 'div',\n media: 'div',\n action: 'div'\n },\n media: slot.optional(props.media, {\n renderByDefault: !!intent,\n defaultProps: {\n children: defaultIcon\n },\n elementType: 'div'\n }),\n root: slot.always(getNativeElementProps('div', {\n ref,\n children: props.children,\n id: titleId,\n ...props\n }), {\n elementType: 'div'\n }),\n intent,\n backgroundAppearance\n };\n};\n"],"names":["useToastTitle_unstable","props","ref","intent","titleId","useToastContainerContext","backgroundAppearance","useBackgroundAppearance","defaultIcon","React","createElement","CheckmarkCircleFilled","DismissCircleFilled","WarningFilled","InfoFilled","action","slot","optional","elementType","components","root","media","renderByDefault","defaultProps","children","always","getNativeElementProps","id"],"mappings":";;;;+BAaiBA;;aAAAA;;;6DAbM;4BAC+D;gCAC1C;qCACJ;uCACC;AAS9B,MAAMA,yBAAyB,CAACC,OAAOC,MAAM;IACpD,MAAM,EAAEC,OAAM,EAAGC,QAAO,EAAG,GAAGC,IAAAA,+CAAwB;IACtD,MAAMC,uBAAuBC,IAAAA,4CAAuB;IACpD,+DAA+D,GAAG,IAAIC;IACtE,OAAOL;QACH,KAAK;YACDK,cAAc,WAAW,GAAGC,OAAMC,aAAa,CAACC,iCAAqB,EAAE,IAAI;YAC3E,KAAM;QACV,KAAK;YACDH,cAAc,WAAW,GAAGC,OAAMC,aAAa,CAACE,+BAAmB,EAAE,IAAI;YACzE,KAAM;QACV,KAAK;YACDJ,cAAc,WAAW,GAAGC,OAAMC,aAAa,CAACG,yBAAa,EAAE,IAAI;YACnE,KAAM;QACV,KAAK;YACDL,cAAc,WAAW,GAAGC,OAAMC,aAAa,CAACI,sBAAU,EAAE,IAAI;YAChE,KAAM;IACd;IACA,OAAO;QACHC,QAAQC,oBAAI,CAACC,QAAQ,CAAChB,MAAMc,MAAM,EAAE;YAChCG,aAAa;QACjB;QACAC,YAAY;YACRC,MAAM;YACNC,OAAO;YACPN,QAAQ;QACZ;QACAM,OAAOL,oBAAI,CAACC,QAAQ,CAAChB,MAAMoB,KAAK,EAAE;YAC9BC,iBAAiB,CAAC,CAACnB;YACnBoB,cAAc;gBACVC,UAAUhB;YACd;YACAU,aAAa;QACjB;QACAE,MAAMJ,oBAAI,CAACS,MAAM,CAACC,IAAAA,qCAAqB,EAAC,OAAO;YAC3CxB;YACAsB,UAAUvB,MAAMuB,QAAQ;YACxBG,IAAIvB;YACJ,GAAGH,KAAK;QACZ,IAAI;YACAiB,aAAa;QACjB;QACAf;QACAG;IACJ;AACJ"}
|
|
@@ -19,15 +19,15 @@ const toastTitleClassNames = {
|
|
|
19
19
|
action: 'fui-ToastTitle__action'
|
|
20
20
|
};
|
|
21
21
|
const useRootBaseClassName = /*#__PURE__*/ (0, _react["__resetStyles"])("r1mlor6q", null, [
|
|
22
|
-
".r1mlor6q{display
|
|
22
|
+
".r1mlor6q{display:flex;align-items:center;grid-column-end:3;color:var(--colorNeutralForeground1);}"
|
|
23
23
|
]);
|
|
24
24
|
const useMediaBaseClassName = /*#__PURE__*/ (0, _react["__resetStyles"])("rnm72z1", "rzj6g76", [
|
|
25
|
-
".rnm72z1{display
|
|
26
|
-
".rzj6g76{display
|
|
25
|
+
".rnm72z1{display:flex;align-items:center;grid-column-end:2;padding-right:8px;font-size:16px;color:var(--colorNeutralForeground1);}",
|
|
26
|
+
".rzj6g76{display:flex;align-items:center;grid-column-end:2;padding-left:8px;font-size:16px;color:var(--colorNeutralForeground1);}"
|
|
27
27
|
]);
|
|
28
28
|
const useActionBaseClassName = /*#__PURE__*/ (0, _react["__resetStyles"])("r5vrc68", "rzqb88z", [
|
|
29
|
-
".r5vrc68{display
|
|
30
|
-
".rzqb88z{display
|
|
29
|
+
".r5vrc68{display:flex;align-items:center;padding-left:12px;grid-column-end:-1;color:var(--colorBrandForeground1);}",
|
|
30
|
+
".rzqb88z{display:flex;align-items:center;padding-right:12px;grid-column-end:-1;color:var(--colorBrandForeground1);}"
|
|
31
31
|
]);
|
|
32
32
|
const useInvertedStyles = /*#__PURE__*/ (0, _react["__styles"])({
|
|
33
33
|
root: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useToastTitleStyles.styles.js"],"sourcesContent":["import { __styles, __resetStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nexport const toastTitleClassNames = {\n root: 'fui-ToastTitle',\n media: 'fui-ToastTitle__media',\n action: 'fui-ToastTitle__action'\n};\nconst useRootBaseClassName = /*#__PURE__*/__resetStyles(\"r1mlor6q\", null, [\".r1mlor6q{display
|
|
1
|
+
{"version":3,"sources":["useToastTitleStyles.styles.js"],"sourcesContent":["import { __styles, __resetStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nexport const toastTitleClassNames = {\n root: 'fui-ToastTitle',\n media: 'fui-ToastTitle__media',\n action: 'fui-ToastTitle__action'\n};\nconst useRootBaseClassName = /*#__PURE__*/__resetStyles(\"r1mlor6q\", null, [\".r1mlor6q{display:flex;align-items:center;grid-column-end:3;color:var(--colorNeutralForeground1);}\"]);\nconst useMediaBaseClassName = /*#__PURE__*/__resetStyles(\"rnm72z1\", \"rzj6g76\", [\".rnm72z1{display:flex;align-items:center;grid-column-end:2;padding-right:8px;font-size:16px;color:var(--colorNeutralForeground1);}\", \".rzj6g76{display:flex;align-items:center;grid-column-end:2;padding-left:8px;font-size:16px;color:var(--colorNeutralForeground1);}\"]);\nconst useActionBaseClassName = /*#__PURE__*/__resetStyles(\"r5vrc68\", \"rzqb88z\", [\".r5vrc68{display:flex;align-items:center;padding-left:12px;grid-column-end:-1;color:var(--colorBrandForeground1);}\", \".rzqb88z{display:flex;align-items:center;padding-right:12px;grid-column-end:-1;color:var(--colorBrandForeground1);}\"]);\nconst useInvertedStyles = /*#__PURE__*/__styles({\n root: {\n sj55zd: \"f1w7i9ko\"\n },\n action: {\n sj55zd: \"f1qz2gb0\"\n },\n media: {\n sj55zd: \"fqpbvvt\"\n }\n}, {\n d: [\".f1w7i9ko{color:var(--colorNeutralForegroundInverted2);}\", \".f1qz2gb0{color:var(--colorBrandForegroundInverted);}\", \".fqpbvvt{color:var(--colorNeutralForegroundInverted);}\"]\n});\nconst useIntentIconStyles = /*#__PURE__*/__styles({\n success: {\n sj55zd: \"f1m7fhi8\"\n },\n error: {\n sj55zd: \"fg9gses\"\n },\n warning: {\n sj55zd: \"f1k5f75o\"\n },\n info: {\n sj55zd: \"fkfq4zb\"\n }\n}, {\n d: [\".f1m7fhi8{color:var(--colorPaletteGreenForeground3);}\", \".fg9gses{color:var(--colorPaletteCranberryForeground2);}\", \".f1k5f75o{color:var(--colorPaletteDarkOrangeForeground1);}\", \".fkfq4zb{color:var(--colorNeutralForeground2);}\"]\n});\nconst useIntentIconStylesInverted = /*#__PURE__*/__styles({\n success: {\n sj55zd: \"f1pvjcpr\"\n },\n error: {\n sj55zd: \"fcrp5ll\"\n },\n warning: {\n sj55zd: \"f1r8f1cl\"\n },\n info: {\n sj55zd: \"f1w7i9ko\"\n }\n}, {\n d: [\".f1pvjcpr{color:var(--colorPaletteGreenForegroundInverted);}\", \".fcrp5ll{color:var(--colorPaletteRedForegroundInverted);}\", \".f1r8f1cl{color:var(--colorPaletteYellowForegroundInverted);}\", \".f1w7i9ko{color:var(--colorNeutralForegroundInverted2);}\"]\n});\n/**\n * Apply styling to the ToastTitle slots based on the state\n */\nexport const useToastTitleStyles_unstable = state => {\n const rootBaseClassName = useRootBaseClassName();\n const actionBaseClassName = useActionBaseClassName();\n const mediaBaseClassName = useMediaBaseClassName();\n const intentIconStyles = useIntentIconStyles();\n const intentIconStylesInverted = useIntentIconStylesInverted();\n const {\n intent\n } = state;\n const invertedStyles = useInvertedStyles();\n state.root.className = mergeClasses(toastTitleClassNames.root, rootBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.root, state.root.className);\n if (state.media) {\n state.media.className = mergeClasses(toastTitleClassNames.media, mediaBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.media, state.media.className, intent && intentIconStyles[intent], intent && state.backgroundAppearance === 'inverted' && intentIconStylesInverted[intent]);\n }\n if (state.action) {\n state.action.className = mergeClasses(toastTitleClassNames.action, actionBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.action, state.action.className);\n }\n return state;\n};\n//# sourceMappingURL=useToastTitleStyles.styles.js.map"],"names":["toastTitleClassNames","useToastTitleStyles_unstable","root","media","action","useRootBaseClassName","__resetStyles","useMediaBaseClassName","useActionBaseClassName","useInvertedStyles","__styles","sj55zd","d","useIntentIconStyles","success","error","warning","info","useIntentIconStylesInverted","state","rootBaseClassName","actionBaseClassName","mediaBaseClassName","intentIconStyles","intentIconStylesInverted","intent","invertedStyles","className","mergeClasses","backgroundAppearance"],"mappings":";;;;;;;;;;;IAEaA,oBAAoB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M,EACJO,OAAM,EACP,GAAGN;IACJ,MAAMO,iBAAiBjB;IACvBU,MAAMjB,IAAI,CAACyB,SAAS,GAAGC,IAAAA,mBAAY,EAAC5B,qBAAqBE,IAAI,EAAEkB,mBAAmBD,MAAMU,oBAAoB,KAAK,cAAcH,eAAexB,IAAI,EAAEiB,MAAMjB,IAAI,CAACyB,SAAS;IACxK,IAAIR,MAAMhB,KAAK,EAAE;QACfgB,MAAMhB,KAAK,CAACwB,SAAS,GAAGC,IAAAA,mBAAY,EAAC5B,qBAAqBG,KAAK,EAAEmB,oBAAoBH,MAAMU,oBAAoB,KAAK,cAAcH,eAAevB,KAAK,EAAEgB,MAAMhB,KAAK,CAACwB,SAAS,EAAEF,UAAUF,gBAAgB,CAACE,OAAO,EAAEA,UAAUN,MAAMU,oBAAoB,KAAK,cAAcL,wBAAwB,CAACC,OAAO;IAC5S,CAAC;IACD,IAAIN,MAAMf,MAAM,EAAE;QAChBe,MAAMf,MAAM,CAACuB,SAAS,GAAGC,IAAAA,mBAAY,EAAC5B,qBAAqBI,MAAM,EAAEiB,qBAAqBF,MAAMU,oBAAoB,KAAK,cAAcH,eAAetB,MAAM,EAAEe,MAAMf,MAAM,CAACuB,SAAS;IACpL,CAAC;IACD,OAAOR;AACT,GACA,sDAAsD"}
|
|
@@ -12,9 +12,9 @@ const _reactPortal = require("@fluentui/react-portal");
|
|
|
12
12
|
const _ariaLive = require("../AriaLive");
|
|
13
13
|
const renderToaster_unstable = (state)=>{
|
|
14
14
|
const { announceRef , renderAriaLive } = state;
|
|
15
|
-
|
|
16
|
-
const hasToasts = !!
|
|
15
|
+
(0, _reactUtilities.assertSlots)(state);
|
|
16
|
+
const hasToasts = !!state.bottomStart || !!state.bottomEnd || !!state.topStart || !!state.topEnd;
|
|
17
17
|
return /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(_reactJsxRuntime.Fragment, null, renderAriaLive ? /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(_ariaLive.AriaLive, {
|
|
18
18
|
announceRef: announceRef
|
|
19
|
-
}) : null, hasToasts ? /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(_reactPortal.Portal, null,
|
|
19
|
+
}) : null, hasToasts ? /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(_reactPortal.Portal, null, state.bottomStart ? /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.bottomStart, null) : null, state.bottomEnd ? /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.bottomEnd, null) : null, state.topStart ? /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.topStart, null) : null, state.topEnd ? /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.topEnd, null) : null) : null);
|
|
20
20
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderToaster.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsxFrag Fragment */ /** @jsx createElement */ import { createElement, Fragment } from '@fluentui/react-jsx-runtime';\nimport {
|
|
1
|
+
{"version":3,"sources":["renderToaster.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsxFrag Fragment */ /** @jsx createElement */ import { createElement, Fragment } from '@fluentui/react-jsx-runtime';\nimport { assertSlots } from '@fluentui/react-utilities';\nimport { Portal } from '@fluentui/react-portal';\nimport { AriaLive } from '../AriaLive';\n/**\n * Render the final JSX of Toaster\n */ export const renderToaster_unstable = (state)=>{\n const { announceRef , renderAriaLive } = state;\n assertSlots(state);\n const hasToasts = !!state.bottomStart || !!state.bottomEnd || !!state.topStart || !!state.topEnd;\n return /*#__PURE__*/ createElement(Fragment, null, renderAriaLive ? /*#__PURE__*/ createElement(AriaLive, {\n announceRef: announceRef\n }) : null, hasToasts ? /*#__PURE__*/ createElement(Portal, null, state.bottomStart ? /*#__PURE__*/ createElement(state.bottomStart, null) : null, state.bottomEnd ? /*#__PURE__*/ createElement(state.bottomEnd, null) : null, state.topStart ? /*#__PURE__*/ createElement(state.topStart, null) : null, state.topEnd ? /*#__PURE__*/ createElement(state.topEnd, null) : null) : null);\n};\n"],"names":["renderToaster_unstable","state","announceRef","renderAriaLive","assertSlots","hasToasts","bottomStart","bottomEnd","topStart","topEnd","createElement","Fragment","AriaLive","Portal"],"mappings":"AAAA,wBAAwB,GAAG,sBAAsB,GAAG,uBAAuB;;;;+BAM1DA;;aAAAA;;iCANqG;gCAC1F;6BACL;0BACE;AAGd,MAAMA,yBAAyB,CAACC,QAAQ;IAC/C,MAAM,EAAEC,YAAW,EAAGC,eAAc,EAAG,GAAGF;IAC1CG,IAAAA,2BAAW,EAACH;IACZ,MAAMI,YAAY,CAAC,CAACJ,MAAMK,WAAW,IAAI,CAAC,CAACL,MAAMM,SAAS,IAAI,CAAC,CAACN,MAAMO,QAAQ,IAAI,CAAC,CAACP,MAAMQ,MAAM;IAChG,OAAO,WAAW,GAAGC,IAAAA,8BAAa,EAACC,yBAAQ,EAAE,IAAI,EAAER,iBAAiB,WAAW,GAAGO,IAAAA,8BAAa,EAACE,kBAAQ,EAAE;QACtGV,aAAaA;IACjB,KAAK,IAAI,EAAEG,YAAY,WAAW,GAAGK,IAAAA,8BAAa,EAACG,mBAAM,EAAE,IAAI,EAAEZ,MAAMK,WAAW,GAAG,WAAW,GAAGI,IAAAA,8BAAa,EAACT,MAAMK,WAAW,EAAE,IAAI,IAAI,IAAI,EAAEL,MAAMM,SAAS,GAAG,WAAW,GAAGG,IAAAA,8BAAa,EAACT,MAAMM,SAAS,EAAE,IAAI,IAAI,IAAI,EAAEN,MAAMO,QAAQ,GAAG,WAAW,GAAGE,IAAAA,8BAAa,EAACT,MAAMO,QAAQ,EAAE,IAAI,IAAI,IAAI,EAAEP,MAAMQ,MAAM,GAAG,WAAW,GAAGC,IAAAA,8BAAa,EAACT,MAAMQ,MAAM,EAAE,IAAI,IAAI,IAAI,IAAI,IAAI;AAC3X"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "useToastAnnounce", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>useToastAnnounce
|
|
8
|
+
});
|
|
9
|
+
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
|
10
|
+
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
|
11
|
+
const _reactUtilities = require("@fluentui/react-utilities");
|
|
12
|
+
function useToastAnnounce(announce) {
|
|
13
|
+
const activeRef = _react.useRef(true);
|
|
14
|
+
const cleanupRef = _react.useRef(()=>undefined);
|
|
15
|
+
const announceToast = _react.useCallback((message, options)=>{
|
|
16
|
+
if (activeRef.current) {
|
|
17
|
+
announce(message, options);
|
|
18
|
+
}
|
|
19
|
+
}, [
|
|
20
|
+
announce
|
|
21
|
+
]);
|
|
22
|
+
const toasterRef = _react.useCallback((el)=>{
|
|
23
|
+
if (!el) {
|
|
24
|
+
cleanupRef.current();
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const onFocusIn = (e)=>{
|
|
28
|
+
if ((0, _reactUtilities.isHTMLElement)(e.currentTarget) && e.currentTarget.contains((0, _reactUtilities.isHTMLElement)(e.relatedTarget) ? e.relatedTarget : null)) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
activeRef.current = false;
|
|
32
|
+
};
|
|
33
|
+
const onFocusOut = (e)=>{
|
|
34
|
+
if ((0, _reactUtilities.isHTMLElement)(e.currentTarget) && e.currentTarget.contains((0, _reactUtilities.isHTMLElement)(e.relatedTarget) ? e.relatedTarget : null)) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
activeRef.current = true;
|
|
38
|
+
};
|
|
39
|
+
el.addEventListener('focusin', onFocusIn);
|
|
40
|
+
el.addEventListener('focusout', onFocusOut);
|
|
41
|
+
cleanupRef.current = ()=>{
|
|
42
|
+
el.removeEventListener('focusin', onFocusIn);
|
|
43
|
+
el.removeEventListener('focusout', onFocusOut);
|
|
44
|
+
};
|
|
45
|
+
}, []);
|
|
46
|
+
return {
|
|
47
|
+
announceToast,
|
|
48
|
+
toasterRef
|
|
49
|
+
};
|
|
50
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useToastAnnounce.js"],"sourcesContent":["import * as React from 'react';\nimport { isHTMLElement } from '@fluentui/react-utilities';\n/**\n * Wraps an aria live announcement function.\n * Aria live announcements can be detrimental once the user is already navigating\n * multiple toasts. Once the user is focused inside the toaster, the announecments should be disabled.\n * @param announce\n * @returns A function to announce a toast and a ref to attach to the toaster element\n */ export function useToastAnnounce(announce) {\n const activeRef = React.useRef(true);\n const cleanupRef = React.useRef(()=>undefined);\n const announceToast = React.useCallback((message, options)=>{\n if (activeRef.current) {\n announce(message, options);\n }\n }, [\n announce\n ]);\n const toasterRef = React.useCallback((el)=>{\n if (!el) {\n cleanupRef.current();\n return;\n }\n const onFocusIn = (e)=>{\n if (isHTMLElement(e.currentTarget) && e.currentTarget.contains(isHTMLElement(e.relatedTarget) ? e.relatedTarget : null)) {\n return;\n }\n activeRef.current = false;\n };\n const onFocusOut = (e)=>{\n if (isHTMLElement(e.currentTarget) && e.currentTarget.contains(isHTMLElement(e.relatedTarget) ? e.relatedTarget : null)) {\n return;\n }\n activeRef.current = true;\n };\n el.addEventListener('focusin', onFocusIn);\n el.addEventListener('focusout', onFocusOut);\n cleanupRef.current = ()=>{\n el.removeEventListener('focusin', onFocusIn);\n el.removeEventListener('focusout', onFocusOut);\n };\n }, []);\n return {\n announceToast,\n toasterRef\n };\n}\n"],"names":["useToastAnnounce","announce","activeRef","React","useRef","cleanupRef","undefined","announceToast","useCallback","message","options","current","toasterRef","el","onFocusIn","e","isHTMLElement","currentTarget","contains","relatedTarget","onFocusOut","addEventListener","removeEventListener"],"mappings":";;;;+BAQoBA;;aAAAA;;;6DARG;gCACO;AAOnB,SAASA,iBAAiBC,QAAQ,EAAE;IAC3C,MAAMC,YAAYC,OAAMC,MAAM,CAAC,IAAI;IACnC,MAAMC,aAAaF,OAAMC,MAAM,CAAC,IAAIE;IACpC,MAAMC,gBAAgBJ,OAAMK,WAAW,CAAC,CAACC,SAASC,UAAU;QACxD,IAAIR,UAAUS,OAAO,EAAE;YACnBV,SAASQ,SAASC;QACtB,CAAC;IACL,GAAG;QACCT;KACH;IACD,MAAMW,aAAaT,OAAMK,WAAW,CAAC,CAACK,KAAK;QACvC,IAAI,CAACA,IAAI;YACLR,WAAWM,OAAO;YAClB;QACJ,CAAC;QACD,MAAMG,YAAY,CAACC,IAAI;YACnB,IAAIC,IAAAA,6BAAa,EAACD,EAAEE,aAAa,KAAKF,EAAEE,aAAa,CAACC,QAAQ,CAACF,IAAAA,6BAAa,EAACD,EAAEI,aAAa,IAAIJ,EAAEI,aAAa,GAAG,IAAI,GAAG;gBACrH;YACJ,CAAC;YACDjB,UAAUS,OAAO,GAAG,KAAK;QAC7B;QACA,MAAMS,aAAa,CAACL,IAAI;YACpB,IAAIC,IAAAA,6BAAa,EAACD,EAAEE,aAAa,KAAKF,EAAEE,aAAa,CAACC,QAAQ,CAACF,IAAAA,6BAAa,EAACD,EAAEI,aAAa,IAAIJ,EAAEI,aAAa,GAAG,IAAI,GAAG;gBACrH;YACJ,CAAC;YACDjB,UAAUS,OAAO,GAAG,IAAI;QAC5B;QACAE,GAAGQ,gBAAgB,CAAC,WAAWP;QAC/BD,GAAGQ,gBAAgB,CAAC,YAAYD;QAChCf,WAAWM,OAAO,GAAG,IAAI;YACrBE,GAAGS,mBAAmB,CAAC,WAAWR;YAClCD,GAAGS,mBAAmB,CAAC,YAAYF;QACvC;IACJ,GAAG,EAAE;IACL,OAAO;QACHb;QACAK;IACJ;AACJ"}
|