@fluentui/react-toast 9.2.0 → 9.2.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 +70 -1
- package/CHANGELOG.md +20 -2
- package/lib/components/AriaLive/AriaLive.js.map +1 -1
- package/lib/components/AriaLive/renderAriaLive.js +7 -2
- package/lib/components/AriaLive/renderAriaLive.js.map +1 -1
- package/lib/components/AriaLive/useAriaLive.js +6 -4
- package/lib/components/AriaLive/useAriaLive.js.map +1 -1
- package/lib/components/Timer/Timer.js +1 -1
- package/lib/components/Timer/Timer.js.map +1 -1
- package/lib/components/Toast/Toast.js.map +1 -1
- package/lib/components/Toast/renderToast.js +5 -4
- package/lib/components/Toast/renderToast.js.map +1 -1
- package/lib/components/Toast/useToast.js.map +1 -1
- package/lib/components/Toast/useToastContextValues.js +1 -1
- package/lib/components/Toast/useToastContextValues.js.map +1 -1
- package/lib/components/ToastBody/ToastBody.js.map +1 -1
- package/lib/components/ToastBody/renderToastBody.js +7 -2
- package/lib/components/ToastBody/renderToastBody.js.map +1 -1
- package/lib/components/ToastBody/useToastBody.js +1 -1
- package/lib/components/ToastBody/useToastBody.js.map +1 -1
- package/lib/components/ToastContainer/ToastContainer.js.map +1 -1
- package/lib/components/ToastContainer/renderToastContainer.js +12 -7
- package/lib/components/ToastContainer/renderToastContainer.js.map +1 -1
- package/lib/components/ToastContainer/useToastContainer.js +15 -15
- package/lib/components/ToastContainer/useToastContainer.js.map +1 -1
- package/lib/components/ToastContainer/useToastContainerContextValues.js +1 -1
- package/lib/components/ToastContainer/useToastContainerContextValues.js.map +1 -1
- package/lib/components/ToastFooter/ToastFooter.js.map +1 -1
- package/lib/components/ToastFooter/renderToastFooter.js +2 -2
- package/lib/components/ToastFooter/renderToastFooter.js.map +1 -1
- package/lib/components/ToastFooter/useToastFooter.js.map +1 -1
- package/lib/components/ToastTitle/ToastTitle.js.map +1 -1
- package/lib/components/ToastTitle/renderToastTitle.js +8 -2
- package/lib/components/ToastTitle/renderToastTitle.js.map +1 -1
- package/lib/components/ToastTitle/useToastTitle.js +1 -1
- package/lib/components/ToastTitle/useToastTitle.js.map +1 -1
- package/lib/components/ToastTitle/useToastTitleStyles.styles.js.map +1 -1
- package/lib/components/ToastTrigger/ToastTrigger.js.map +1 -1
- package/lib/components/ToastTrigger/useToastTrigger.js +8 -7
- package/lib/components/ToastTrigger/useToastTrigger.js.map +1 -1
- package/lib/components/Toaster/Toaster.js.map +1 -1
- package/lib/components/Toaster/renderToaster.js +18 -7
- package/lib/components/Toaster/renderToaster.js.map +1 -1
- package/lib/components/Toaster/useToastAnnounce.js.map +1 -1
- package/lib/components/Toaster/useToaster.js +6 -6
- package/lib/components/Toaster/useToaster.js.map +1 -1
- package/lib/components/Toaster/useToasterFocusManagement.js +2 -2
- package/lib/components/Toaster/useToasterFocusManagement.js.map +1 -1
- package/lib/contexts/toastContainerContext.js.map +1 -1
- package/lib/state/useToastController.js +3 -2
- package/lib/state/useToastController.js.map +1 -1
- package/lib/state/useToaster.js +15 -11
- package/lib/state/useToaster.js.map +1 -1
- package/lib/state/vanilla/createToaster.js +7 -7
- package/lib/state/vanilla/createToaster.js.map +1 -1
- package/lib/state/vanilla/dismissAllToasts.js.map +1 -1
- package/lib/state/vanilla/dismissToast.js.map +1 -1
- package/lib/state/vanilla/dispatchToast.js.map +1 -1
- package/lib/state/vanilla/getPositionStyles.js +1 -1
- package/lib/state/vanilla/getPositionStyles.js.map +1 -1
- package/lib/state/vanilla/pauseToast.js.map +1 -1
- package/lib/state/vanilla/playToast.js.map +1 -1
- package/lib/state/vanilla/updateToast.js.map +1 -1
- package/lib-commonjs/AriaLive.js +2 -2
- package/lib-commonjs/AriaLive.js.map +1 -1
- package/lib-commonjs/Toast.js +2 -2
- package/lib-commonjs/Toast.js.map +1 -1
- package/lib-commonjs/ToastBody.js +2 -2
- package/lib-commonjs/ToastBody.js.map +1 -1
- package/lib-commonjs/ToastContainer.js +2 -2
- package/lib-commonjs/ToastContainer.js.map +1 -1
- package/lib-commonjs/ToastFooter.js +2 -2
- package/lib-commonjs/ToastFooter.js.map +1 -1
- package/lib-commonjs/ToastTitle.js +2 -2
- package/lib-commonjs/ToastTitle.js.map +1 -1
- package/lib-commonjs/ToastTrigger.js +2 -2
- package/lib-commonjs/ToastTrigger.js.map +1 -1
- package/lib-commonjs/Toaster.js +2 -2
- package/lib-commonjs/Toaster.js.map +1 -1
- package/lib-commonjs/components/AriaLive/AriaLive.js +7 -5
- package/lib-commonjs/components/AriaLive/AriaLive.js.map +1 -1
- package/lib-commonjs/components/AriaLive/AriaLive.types.js +2 -2
- package/lib-commonjs/components/AriaLive/AriaLive.types.js.map +1 -1
- package/lib-commonjs/components/AriaLive/index.js +6 -6
- package/lib-commonjs/components/AriaLive/index.js.map +1 -1
- package/lib-commonjs/components/AriaLive/renderAriaLive.js +13 -6
- package/lib-commonjs/components/AriaLive/renderAriaLive.js.map +1 -1
- package/lib-commonjs/components/AriaLive/useAriaLive.js +16 -12
- package/lib-commonjs/components/AriaLive/useAriaLive.js.map +1 -1
- package/lib-commonjs/components/AriaLive/useAriaLiveStyles.styles.js +7 -3
- package/lib-commonjs/components/AriaLive/useAriaLiveStyles.styles.js.map +1 -1
- package/lib-commonjs/components/Timer/Timer.js +8 -6
- package/lib-commonjs/components/Timer/Timer.js.map +1 -1
- package/lib-commonjs/components/Timer/index.js +2 -2
- package/lib-commonjs/components/Timer/index.js.map +1 -1
- package/lib-commonjs/components/Timer/useTimerStyles.styles.js +4 -2
- package/lib-commonjs/components/Timer/useTimerStyles.styles.js.map +1 -1
- package/lib-commonjs/components/Toast/Toast.js +7 -5
- package/lib-commonjs/components/Toast/Toast.js.map +1 -1
- package/lib-commonjs/components/Toast/index.js +6 -6
- package/lib-commonjs/components/Toast/index.js.map +1 -1
- package/lib-commonjs/components/Toast/renderToast.js +12 -9
- package/lib-commonjs/components/Toast/renderToast.js.map +1 -1
- package/lib-commonjs/components/Toast/useToast.js +7 -5
- package/lib-commonjs/components/Toast/useToast.js.map +1 -1
- package/lib-commonjs/components/Toast/useToastContextValues.js +4 -2
- package/lib-commonjs/components/Toast/useToastContextValues.js.map +1 -1
- package/lib-commonjs/components/Toast/useToastStyles.styles.js +8 -4
- package/lib-commonjs/components/Toast/useToastStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ToastBody/ToastBody.js +7 -5
- package/lib-commonjs/components/ToastBody/ToastBody.js.map +1 -1
- package/lib-commonjs/components/ToastBody/index.js +6 -6
- package/lib-commonjs/components/ToastBody/index.js.map +1 -1
- package/lib-commonjs/components/ToastBody/renderToastBody.js +13 -6
- package/lib-commonjs/components/ToastBody/renderToastBody.js.map +1 -1
- package/lib-commonjs/components/ToastBody/useToastBody.js +11 -9
- package/lib-commonjs/components/ToastBody/useToastBody.js.map +1 -1
- package/lib-commonjs/components/ToastBody/useToastBodyStyles.styles.js +9 -5
- package/lib-commonjs/components/ToastBody/useToastBodyStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ToastContainer/ToastContainer.js +7 -5
- package/lib-commonjs/components/ToastContainer/ToastContainer.js.map +1 -1
- package/lib-commonjs/components/ToastContainer/ToastContainer.types.js +2 -2
- package/lib-commonjs/components/ToastContainer/ToastContainer.types.js.map +1 -1
- package/lib-commonjs/components/ToastContainer/index.js +7 -7
- package/lib-commonjs/components/ToastContainer/index.js.map +1 -1
- package/lib-commonjs/components/ToastContainer/renderToastContainer.js +19 -12
- package/lib-commonjs/components/ToastContainer/renderToastContainer.js.map +1 -1
- package/lib-commonjs/components/ToastContainer/useToastContainer.js +42 -40
- package/lib-commonjs/components/ToastContainer/useToastContainer.js.map +1 -1
- package/lib-commonjs/components/ToastContainer/useToastContainerContextValues.js +6 -4
- package/lib-commonjs/components/ToastContainer/useToastContainerContextValues.js.map +1 -1
- package/lib-commonjs/components/ToastContainer/useToastContainerStyles.styles.js +8 -4
- package/lib-commonjs/components/ToastContainer/useToastContainerStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ToastFooter/ToastFooter.js +7 -5
- package/lib-commonjs/components/ToastFooter/ToastFooter.js.map +1 -1
- package/lib-commonjs/components/ToastFooter/index.js +6 -6
- package/lib-commonjs/components/ToastFooter/index.js.map +1 -1
- package/lib-commonjs/components/ToastFooter/renderToastFooter.js +8 -6
- package/lib-commonjs/components/ToastFooter/renderToastFooter.js.map +1 -1
- package/lib-commonjs/components/ToastFooter/useToastFooter.js +7 -5
- package/lib-commonjs/components/ToastFooter/useToastFooter.js.map +1 -1
- package/lib-commonjs/components/ToastFooter/useToastFooterStyles.styles.js +7 -3
- package/lib-commonjs/components/ToastFooter/useToastFooterStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ToastTitle/ToastTitle.js +7 -5
- package/lib-commonjs/components/ToastTitle/ToastTitle.js.map +1 -1
- package/lib-commonjs/components/ToastTitle/index.js +6 -6
- package/lib-commonjs/components/ToastTitle/index.js.map +1 -1
- package/lib-commonjs/components/ToastTitle/renderToastTitle.js +14 -6
- package/lib-commonjs/components/ToastTitle/renderToastTitle.js.map +1 -1
- package/lib-commonjs/components/ToastTitle/useToastTitle.js +17 -15
- package/lib-commonjs/components/ToastTitle/useToastTitle.js.map +1 -1
- package/lib-commonjs/components/ToastTitle/useToastTitleStyles.styles.js +13 -9
- package/lib-commonjs/components/ToastTitle/useToastTitleStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ToastTrigger/ToastTrigger.js +5 -3
- package/lib-commonjs/components/ToastTrigger/ToastTrigger.js.map +1 -1
- package/lib-commonjs/components/ToastTrigger/ToastTrigger.types.js +2 -2
- package/lib-commonjs/components/ToastTrigger/ToastTrigger.types.js.map +1 -1
- package/lib-commonjs/components/ToastTrigger/index.js +5 -5
- package/lib-commonjs/components/ToastTrigger/index.js.map +1 -1
- package/lib-commonjs/components/ToastTrigger/renderToastTrigger.js +3 -1
- package/lib-commonjs/components/ToastTrigger/renderToastTrigger.js.map +1 -1
- package/lib-commonjs/components/ToastTrigger/useToastTrigger.js +18 -15
- package/lib-commonjs/components/ToastTrigger/useToastTrigger.js.map +1 -1
- package/lib-commonjs/components/Toaster/Toaster.js +7 -5
- package/lib-commonjs/components/Toaster/Toaster.js.map +1 -1
- package/lib-commonjs/components/Toaster/index.js +6 -6
- package/lib-commonjs/components/Toaster/index.js.map +1 -1
- package/lib-commonjs/components/Toaster/renderToaster.js +26 -13
- package/lib-commonjs/components/Toaster/renderToaster.js.map +1 -1
- package/lib-commonjs/components/Toaster/useToastAnnounce.js +8 -6
- package/lib-commonjs/components/Toaster/useToastAnnounce.js.map +1 -1
- package/lib-commonjs/components/Toaster/useToaster.js +24 -22
- package/lib-commonjs/components/Toaster/useToaster.js.map +1 -1
- package/lib-commonjs/components/Toaster/useToasterFocusManagement.js +19 -17
- package/lib-commonjs/components/Toaster/useToasterFocusManagement.js.map +1 -1
- package/lib-commonjs/components/Toaster/useToasterStyles.styles.js +7 -3
- package/lib-commonjs/components/Toaster/useToasterStyles.styles.js.map +1 -1
- package/lib-commonjs/contexts/toastContainerContext.js +8 -4
- package/lib-commonjs/contexts/toastContainerContext.js.map +1 -1
- package/lib-commonjs/index.js +93 -35
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/state/constants.js +6 -2
- package/lib-commonjs/state/constants.js.map +1 -1
- package/lib-commonjs/state/index.js +10 -6
- package/lib-commonjs/state/index.js.map +1 -1
- package/lib-commonjs/state/types.js +2 -2
- package/lib-commonjs/state/types.js.map +1 -1
- package/lib-commonjs/state/useToastController.js +9 -6
- package/lib-commonjs/state/useToastController.js.map +1 -1
- package/lib-commonjs/state/useToaster.js +26 -20
- package/lib-commonjs/state/useToaster.js.map +1 -1
- package/lib-commonjs/state/vanilla/createToaster.js +14 -12
- package/lib-commonjs/state/vanilla/createToaster.js.map +1 -1
- package/lib-commonjs/state/vanilla/dismissAllToasts.js +3 -1
- package/lib-commonjs/state/vanilla/dismissAllToasts.js.map +1 -1
- package/lib-commonjs/state/vanilla/dismissToast.js +3 -1
- package/lib-commonjs/state/vanilla/dismissToast.js.map +1 -1
- package/lib-commonjs/state/vanilla/dispatchToast.js +3 -1
- package/lib-commonjs/state/vanilla/dispatchToast.js.map +1 -1
- package/lib-commonjs/state/vanilla/getPositionStyles.js +4 -2
- package/lib-commonjs/state/vanilla/getPositionStyles.js.map +1 -1
- package/lib-commonjs/state/vanilla/index.js +9 -9
- package/lib-commonjs/state/vanilla/index.js.map +1 -1
- package/lib-commonjs/state/vanilla/pauseToast.js +3 -1
- package/lib-commonjs/state/vanilla/pauseToast.js.map +1 -1
- package/lib-commonjs/state/vanilla/playToast.js +3 -1
- package/lib-commonjs/state/vanilla/playToast.js.map +1 -1
- package/lib-commonjs/state/vanilla/updateToast.js +3 -1
- package/lib-commonjs/state/vanilla/updateToast.js.map +1 -1
- package/package.json +14 -14
|
@@ -4,49 +4,51 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "useToaster_unstable", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return useToaster_unstable;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
|
-
const
|
|
10
|
-
const _react = /*#__PURE__*/
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
|
+
const _reactutilities = require("@fluentui/react-utilities");
|
|
14
|
+
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
|
|
15
|
+
const _reacttabster = require("@fluentui/react-tabster");
|
|
16
|
+
const _keyboardkeys = require("@fluentui/keyboard-keys");
|
|
15
17
|
const _state = require("../../state");
|
|
16
|
-
const
|
|
18
|
+
const _ToastContainer = require("../ToastContainer");
|
|
17
19
|
const _useToasterFocusManagement = require("./useToasterFocusManagement");
|
|
18
20
|
const _useToastAnnounce = require("./useToastAnnounce");
|
|
19
21
|
const useToaster_unstable = (props)=>{
|
|
20
|
-
const { offset
|
|
22
|
+
const { offset, announce: announceProp, mountNode, ...rest } = props;
|
|
21
23
|
const announceRef = _react.useRef(()=>null);
|
|
22
|
-
const { toastsToRender
|
|
24
|
+
const { toastsToRender, isToastVisible, pauseAllToasts, playAllToasts, tryRestoreFocus, closeAllToasts } = (0, _state.useToaster)(rest);
|
|
23
25
|
const announce = _react.useCallback((message, options)=>announceRef.current(message, options), []);
|
|
24
|
-
const { dir
|
|
25
|
-
const rootProps =
|
|
26
|
+
const { dir } = (0, _reactsharedcontexts.useFluent_unstable)();
|
|
27
|
+
const rootProps = _reactutilities.slot.always((0, _reactutilities.getNativeElementProps)('div', rest), {
|
|
26
28
|
elementType: 'div'
|
|
27
29
|
});
|
|
28
|
-
const focusableGroupAttr = (0,
|
|
30
|
+
const focusableGroupAttr = (0, _reacttabster.useFocusableGroup)({
|
|
29
31
|
tabBehavior: 'limited-trap-focus',
|
|
30
32
|
ignoreDefaultKeydown: {
|
|
31
33
|
Escape: true
|
|
32
34
|
}
|
|
33
35
|
});
|
|
34
|
-
const onKeyDown = (0,
|
|
35
|
-
var _props_onKeyDown;
|
|
36
|
-
if (e.key ===
|
|
36
|
+
const onKeyDown = (0, _reactutilities.useEventCallback)((e)=>{
|
|
37
|
+
var _props_onKeyDown, _props;
|
|
38
|
+
if (e.key === _keyboardkeys.Escape) {
|
|
37
39
|
e.preventDefault();
|
|
38
40
|
closeAllToasts();
|
|
39
41
|
}
|
|
40
|
-
(_props_onKeyDown = props.onKeyDown) === null || _props_onKeyDown === void 0 ? void 0 : _props_onKeyDown.call(
|
|
42
|
+
(_props_onKeyDown = (_props = props).onKeyDown) === null || _props_onKeyDown === void 0 ? void 0 : _props_onKeyDown.call(_props, e);
|
|
41
43
|
});
|
|
42
44
|
const usePositionSlot = (toastPosition)=>{
|
|
43
45
|
var _toastsToRender_get;
|
|
44
46
|
const focusManagementRef = (0, _useToasterFocusManagement.useToasterFocusManagement_unstable)(pauseAllToasts, playAllToasts);
|
|
45
|
-
const { announceToast
|
|
46
|
-
return
|
|
47
|
+
const { announceToast, toasterRef } = (0, _useToastAnnounce.useToastAnnounce)(announceProp !== null && announceProp !== void 0 ? announceProp : announce);
|
|
48
|
+
return _reactutilities.slot.optional(toastsToRender.has(toastPosition) ? rootProps : null, {
|
|
47
49
|
defaultProps: {
|
|
48
|
-
ref: (0,
|
|
49
|
-
children: (_toastsToRender_get = toastsToRender.get(toastPosition)) === null || _toastsToRender_get === void 0 ? void 0 : _toastsToRender_get.map((toast)=>/*#__PURE__*/ _react.createElement(
|
|
50
|
+
ref: (0, _reactutilities.useMergedRefs)(focusManagementRef, toasterRef),
|
|
51
|
+
children: (_toastsToRender_get = toastsToRender.get(toastPosition)) === null || _toastsToRender_get === void 0 ? void 0 : _toastsToRender_get.map((toast)=>/*#__PURE__*/ _react.createElement(_ToastContainer.ToastContainer, {
|
|
50
52
|
...toast,
|
|
51
53
|
tryRestoreFocus: tryRestoreFocus,
|
|
52
54
|
intent: toast.intent,
|
|
@@ -72,7 +74,7 @@ const useToaster_unstable = (props)=>{
|
|
|
72
74
|
topStart: 'div',
|
|
73
75
|
topEnd: 'div'
|
|
74
76
|
},
|
|
75
|
-
root:
|
|
77
|
+
root: _reactutilities.slot.always(rootProps, {
|
|
76
78
|
elementType: 'div'
|
|
77
79
|
}),
|
|
78
80
|
bottomStart: usePositionSlot(_state.TOAST_POSITIONS.bottomStart),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useToaster.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useEventCallback, useMergedRefs, slot } from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useFocusableGroup } from '@fluentui/react-tabster';\nimport { Escape } from '@fluentui/keyboard-keys';\nimport { TOAST_POSITIONS, useToaster } from '../../state';\nimport { ToastContainer } from '../ToastContainer';\nimport { useToasterFocusManagement_unstable } from './useToasterFocusManagement';\nimport { useToastAnnounce } from './useToastAnnounce';\n/**\n * Create the state required to render Toaster.\n *\n * @param props - props from this instance of Toaster\n */ export const useToaster_unstable = (props)=>{\n const { offset
|
|
1
|
+
{"version":3,"sources":["useToaster.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useEventCallback, useMergedRefs, slot } from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useFocusableGroup } from '@fluentui/react-tabster';\nimport { Escape } from '@fluentui/keyboard-keys';\nimport { TOAST_POSITIONS, useToaster } from '../../state';\nimport { ToastContainer } from '../ToastContainer';\nimport { useToasterFocusManagement_unstable } from './useToasterFocusManagement';\nimport { useToastAnnounce } from './useToastAnnounce';\n/**\n * Create the state required to render Toaster.\n *\n * @param props - props from this instance of Toaster\n */ export const useToaster_unstable = (props)=>{\n const { offset, announce: announceProp, mountNode, ...rest } = props;\n const announceRef = React.useRef(()=>null);\n const { toastsToRender, isToastVisible, pauseAllToasts, playAllToasts, tryRestoreFocus, closeAllToasts } = useToaster(rest);\n const announce = React.useCallback((message, options)=>announceRef.current(message, options), []);\n const { dir } = useFluent();\n const rootProps = slot.always(getNativeElementProps('div', rest), {\n elementType: 'div'\n });\n const focusableGroupAttr = useFocusableGroup({\n tabBehavior: 'limited-trap-focus',\n ignoreDefaultKeydown: {\n Escape: true\n }\n });\n const onKeyDown = useEventCallback((e)=>{\n var _props_onKeyDown, _props;\n if (e.key === Escape) {\n e.preventDefault();\n closeAllToasts();\n }\n (_props_onKeyDown = (_props = props).onKeyDown) === null || _props_onKeyDown === void 0 ? void 0 : _props_onKeyDown.call(_props, e);\n });\n const usePositionSlot = (toastPosition)=>{\n var _toastsToRender_get;\n const focusManagementRef = useToasterFocusManagement_unstable(pauseAllToasts, playAllToasts);\n const { announceToast, toasterRef } = useToastAnnounce(announceProp !== null && announceProp !== void 0 ? announceProp : announce);\n return slot.optional(toastsToRender.has(toastPosition) ? rootProps : null, {\n defaultProps: {\n ref: useMergedRefs(focusManagementRef, toasterRef),\n children: (_toastsToRender_get = toastsToRender.get(toastPosition)) === null || _toastsToRender_get === void 0 ? void 0 : _toastsToRender_get.map((toast)=>/*#__PURE__*/ React.createElement(ToastContainer, {\n ...toast,\n tryRestoreFocus: tryRestoreFocus,\n intent: toast.intent,\n announce: announceToast,\n key: toast.toastId,\n visible: isToastVisible(toast.toastId)\n }, toast.content)),\n onKeyDown,\n ...focusableGroupAttr,\n 'data-toaster-position': toastPosition,\n role: 'list'\n },\n elementType: 'div'\n });\n };\n return {\n dir,\n mountNode,\n components: {\n root: 'div',\n bottomStart: 'div',\n bottomEnd: 'div',\n topStart: 'div',\n topEnd: 'div'\n },\n root: slot.always(rootProps, {\n elementType: 'div'\n }),\n bottomStart: usePositionSlot(TOAST_POSITIONS.bottomStart),\n bottomEnd: usePositionSlot(TOAST_POSITIONS.bottomEnd),\n topStart: usePositionSlot(TOAST_POSITIONS.topStart),\n topEnd: usePositionSlot(TOAST_POSITIONS.topEnd),\n announceRef,\n offset,\n announce: announceProp !== null && announceProp !== void 0 ? announceProp : announce,\n renderAriaLive: !announceProp\n };\n};\n"],"names":["useToaster_unstable","props","offset","announce","announceProp","mountNode","rest","announceRef","React","useRef","toastsToRender","isToastVisible","pauseAllToasts","playAllToasts","tryRestoreFocus","closeAllToasts","useToaster","useCallback","message","options","current","dir","useFluent","rootProps","slot","always","getNativeElementProps","elementType","focusableGroupAttr","useFocusableGroup","tabBehavior","ignoreDefaultKeydown","Escape","onKeyDown","useEventCallback","e","_props_onKeyDown","_props","key","preventDefault","call","usePositionSlot","toastPosition","_toastsToRender_get","focusManagementRef","useToasterFocusManagement_unstable","announceToast","toasterRef","useToastAnnounce","optional","has","defaultProps","ref","useMergedRefs","children","get","map","toast","createElement","ToastContainer","intent","toastId","visible","content","role","components","root","bottomStart","bottomEnd","topStart","topEnd","TOAST_POSITIONS","renderAriaLive"],"mappings":";;;;+BAaiBA;;;eAAAA;;;;iEAbM;gCACsD;qCAC7B;8BACd;8BACX;uBACqB;gCACb;2CACoB;kCAClB;AAKtB,MAAMA,sBAAsB,CAACC;IACpC,MAAM,EAAEC,MAAM,EAAEC,UAAUC,YAAY,EAAEC,SAAS,EAAE,GAAGC,MAAM,GAAGL;IAC/D,MAAMM,cAAcC,OAAMC,MAAM,CAAC,IAAI;IACrC,MAAM,EAAEC,cAAc,EAAEC,cAAc,EAAEC,cAAc,EAAEC,aAAa,EAAEC,eAAe,EAAEC,cAAc,EAAE,GAAGC,IAAAA,iBAAU,EAACV;IACtH,MAAMH,WAAWK,OAAMS,WAAW,CAAC,CAACC,SAASC,UAAUZ,YAAYa,OAAO,CAACF,SAASC,UAAU,EAAE;IAChG,MAAM,EAAEE,GAAG,EAAE,GAAGC,IAAAA,uCAAS;IACzB,MAAMC,YAAYC,oBAAI,CAACC,MAAM,CAACC,IAAAA,qCAAqB,EAAC,OAAOpB,OAAO;QAC9DqB,aAAa;IACjB;IACA,MAAMC,qBAAqBC,IAAAA,+BAAiB,EAAC;QACzCC,aAAa;QACbC,sBAAsB;YAClBC,QAAQ;QACZ;IACJ;IACA,MAAMC,YAAYC,IAAAA,gCAAgB,EAAC,CAACC;QAChC,IAAIC,kBAAkBC;QACtB,IAAIF,EAAEG,GAAG,KAAKN,oBAAM,EAAE;YAClBG,EAAEI,cAAc;YAChBxB;QACJ;QACCqB,CAAAA,mBAAmB,AAACC,CAAAA,SAASpC,KAAI,EAAGgC,SAAS,AAAD,MAAO,QAAQG,qBAAqB,KAAK,IAAI,KAAK,IAAIA,iBAAiBI,IAAI,CAACH,QAAQF;IACrI;IACA,MAAMM,kBAAkB,CAACC;QACrB,IAAIC;QACJ,MAAMC,qBAAqBC,IAAAA,6DAAkC,EAACjC,gBAAgBC;QAC9E,MAAM,EAAEiC,aAAa,EAAEC,UAAU,EAAE,GAAGC,IAAAA,kCAAgB,EAAC5C,iBAAiB,QAAQA,iBAAiB,KAAK,IAAIA,eAAeD;QACzH,OAAOqB,oBAAI,CAACyB,QAAQ,CAACvC,eAAewC,GAAG,CAACR,iBAAiBnB,YAAY,MAAM;YACvE4B,cAAc;gBACVC,KAAKC,IAAAA,6BAAa,EAACT,oBAAoBG;gBACvCO,UAAU,AAACX,CAAAA,sBAAsBjC,eAAe6C,GAAG,CAACb,cAAa,MAAO,QAAQC,wBAAwB,KAAK,IAAI,KAAK,IAAIA,oBAAoBa,GAAG,CAAC,CAACC,QAAQ,WAAW,GAAGjD,OAAMkD,aAAa,CAACC,8BAAc,EAAE;wBACrM,GAAGF,KAAK;wBACR3C,iBAAiBA;wBACjB8C,QAAQH,MAAMG,MAAM;wBACpBzD,UAAU2C;wBACVR,KAAKmB,MAAMI,OAAO;wBAClBC,SAASnD,eAAe8C,MAAMI,OAAO;oBACzC,GAAGJ,MAAMM,OAAO;gBACpB9B;gBACA,GAAGL,kBAAkB;gBACrB,yBAAyBc;gBACzBsB,MAAM;YACV;YACArC,aAAa;QACjB;IACJ;IACA,OAAO;QACHN;QACAhB;QACA4D,YAAY;YACRC,MAAM;YACNC,aAAa;YACbC,WAAW;YACXC,UAAU;YACVC,QAAQ;QACZ;QACAJ,MAAM1C,oBAAI,CAACC,MAAM,CAACF,WAAW;YACzBI,aAAa;QACjB;QACAwC,aAAa1B,gBAAgB8B,sBAAe,CAACJ,WAAW;QACxDC,WAAW3B,gBAAgB8B,sBAAe,CAACH,SAAS;QACpDC,UAAU5B,gBAAgB8B,sBAAe,CAACF,QAAQ;QAClDC,QAAQ7B,gBAAgB8B,sBAAe,CAACD,MAAM;QAC9C/D;QACAL;QACAC,UAAUC,iBAAiB,QAAQA,iBAAiB,KAAK,IAAIA,eAAeD;QAC5EqE,gBAAgB,CAACpE;IACrB;AACJ"}
|
|
@@ -4,17 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "useToasterFocusManagement_unstable", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return useToasterFocusManagement_unstable;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const _react = /*#__PURE__*/
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
|
+
const _reactutilities = require("@fluentui/react-utilities");
|
|
13
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
14
|
+
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
|
|
15
|
+
const _keyboardkeys = require("@fluentui/keyboard-keys");
|
|
16
|
+
const _ToastContainer = require("../ToastContainer");
|
|
15
17
|
const noop = ()=>undefined;
|
|
16
18
|
function useToasterFocusManagement_unstable(pauseAllToasts, playAllToasts) {
|
|
17
|
-
const { targetDocument
|
|
19
|
+
const { targetDocument } = (0, _reactsharedcontexts.useFluent_unstable)();
|
|
18
20
|
const cleanupListenersRef = _react.useRef(noop);
|
|
19
21
|
return _react.useCallback((el)=>{
|
|
20
22
|
if (!el || !targetDocument) {
|
|
@@ -24,7 +26,7 @@ function useToasterFocusManagement_unstable(pauseAllToasts, playAllToasts) {
|
|
|
24
26
|
}
|
|
25
27
|
const toastContainerWalker = targetDocument.createTreeWalker(el, NodeFilter.SHOW_ELEMENT, {
|
|
26
28
|
acceptNode (node) {
|
|
27
|
-
if ((0,
|
|
29
|
+
if ((0, _reactutilities.isHTMLElement)(node) && node.classList.contains(_ToastContainer.toastContainerClassNames.root)) {
|
|
28
30
|
return NodeFilter.FILTER_ACCEPT;
|
|
29
31
|
}
|
|
30
32
|
return NodeFilter.FILTER_SKIP;
|
|
@@ -36,22 +38,22 @@ function useToasterFocusManagement_unstable(pauseAllToasts, playAllToasts) {
|
|
|
36
38
|
* This is a temporary measure, Tabster does not have an API yet to enable mover arrow keys from within grouppers
|
|
37
39
|
* Once tabster fully supports this use case, remove this hook
|
|
38
40
|
*/ const keydownListener = (e)=>{
|
|
39
|
-
const { target
|
|
40
|
-
if (!(0,
|
|
41
|
+
const { target, key } = e;
|
|
42
|
+
if (!(0, _reactutilities.isHTMLElement)(target)) {
|
|
41
43
|
return;
|
|
42
44
|
}
|
|
43
|
-
if (key ===
|
|
45
|
+
if (key === _keyboardkeys.ArrowDown) {
|
|
44
46
|
toastContainerWalker.currentNode = target;
|
|
45
47
|
let nextToastContainer = toastContainerWalker.nextNode();
|
|
46
48
|
if (!nextToastContainer) {
|
|
47
49
|
toastContainerWalker.currentNode = el;
|
|
48
50
|
nextToastContainer = toastContainerWalker.nextNode();
|
|
49
51
|
}
|
|
50
|
-
if ((0,
|
|
52
|
+
if ((0, _reactutilities.isHTMLElement)(nextToastContainer)) {
|
|
51
53
|
nextToastContainer.focus();
|
|
52
54
|
}
|
|
53
55
|
}
|
|
54
|
-
if (key ===
|
|
56
|
+
if (key === _keyboardkeys.ArrowUp) {
|
|
55
57
|
toastContainerWalker.currentNode = target;
|
|
56
58
|
let prevToastContainer = toastContainerWalker.previousNode();
|
|
57
59
|
if (prevToastContainer && prevToastContainer.contains(target)) {
|
|
@@ -61,18 +63,18 @@ function useToasterFocusManagement_unstable(pauseAllToasts, playAllToasts) {
|
|
|
61
63
|
toastContainerWalker.currentNode = el;
|
|
62
64
|
prevToastContainer = toastContainerWalker.lastChild();
|
|
63
65
|
}
|
|
64
|
-
if ((0,
|
|
66
|
+
if ((0, _reactutilities.isHTMLElement)(prevToastContainer)) {
|
|
65
67
|
prevToastContainer.focus();
|
|
66
68
|
}
|
|
67
69
|
}
|
|
68
70
|
};
|
|
69
71
|
const focusInListener = (e)=>{
|
|
70
|
-
if ((0,
|
|
72
|
+
if ((0, _reactutilities.isHTMLElement)(e.currentTarget) && !e.currentTarget.contains((0, _reactutilities.isHTMLElement)(e.relatedTarget) ? e.relatedTarget : null)) {
|
|
71
73
|
pauseAllToasts();
|
|
72
74
|
}
|
|
73
75
|
};
|
|
74
76
|
const focusOutListener = (e)=>{
|
|
75
|
-
if ((0,
|
|
77
|
+
if ((0, _reactutilities.isHTMLElement)(e.currentTarget) && !e.currentTarget.contains((0, _reactutilities.isHTMLElement)(e.relatedTarget) ? e.relatedTarget : null)) {
|
|
76
78
|
playAllToasts();
|
|
77
79
|
}
|
|
78
80
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useToasterFocusManagement.js"],"sourcesContent":["import { isHTMLElement } from '@fluentui/react-utilities';\nimport * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { ArrowDown, ArrowUp } from '@fluentui/keyboard-keys';\nimport { toastContainerClassNames } from '../ToastContainer';\nconst noop = ()=>undefined;\n/**\n * @internal\n */ export function useToasterFocusManagement_unstable(pauseAllToasts, playAllToasts) {\n const { targetDocument
|
|
1
|
+
{"version":3,"sources":["useToasterFocusManagement.js"],"sourcesContent":["import { isHTMLElement } from '@fluentui/react-utilities';\nimport * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { ArrowDown, ArrowUp } from '@fluentui/keyboard-keys';\nimport { toastContainerClassNames } from '../ToastContainer';\nconst noop = ()=>undefined;\n/**\n * @internal\n */ export function useToasterFocusManagement_unstable(pauseAllToasts, playAllToasts) {\n const { targetDocument } = useFluent();\n const cleanupListenersRef = React.useRef(noop);\n return React.useCallback((el)=>{\n if (!el || !targetDocument) {\n cleanupListenersRef.current();\n cleanupListenersRef.current = noop;\n return;\n }\n const toastContainerWalker = targetDocument.createTreeWalker(el, NodeFilter.SHOW_ELEMENT, {\n acceptNode (node) {\n if (isHTMLElement(node) && node.classList.contains(toastContainerClassNames.root)) {\n return NodeFilter.FILTER_ACCEPT;\n }\n return NodeFilter.FILTER_SKIP;\n }\n });\n /**\n * FIXME: https://github.com/microsoft/tabster/issues/299\n * Toasts should be arrow navigable and focus should be trapped in a stack of tasts\n * This is a temporary measure, Tabster does not have an API yet to enable mover arrow keys from within grouppers\n * Once tabster fully supports this use case, remove this hook\n */ const keydownListener = (e)=>{\n const { target, key } = e;\n if (!isHTMLElement(target)) {\n return;\n }\n if (key === ArrowDown) {\n toastContainerWalker.currentNode = target;\n let nextToastContainer = toastContainerWalker.nextNode();\n if (!nextToastContainer) {\n toastContainerWalker.currentNode = el;\n nextToastContainer = toastContainerWalker.nextNode();\n }\n if (isHTMLElement(nextToastContainer)) {\n nextToastContainer.focus();\n }\n }\n if (key === ArrowUp) {\n toastContainerWalker.currentNode = target;\n let prevToastContainer = toastContainerWalker.previousNode();\n if (prevToastContainer && prevToastContainer.contains(target)) {\n prevToastContainer = toastContainerWalker.previousNode();\n }\n if (!prevToastContainer) {\n toastContainerWalker.currentNode = el;\n prevToastContainer = toastContainerWalker.lastChild();\n }\n if (isHTMLElement(prevToastContainer)) {\n prevToastContainer.focus();\n }\n }\n };\n const focusInListener = (e)=>{\n if (isHTMLElement(e.currentTarget) && !e.currentTarget.contains(isHTMLElement(e.relatedTarget) ? e.relatedTarget : null)) {\n pauseAllToasts();\n }\n };\n const focusOutListener = (e)=>{\n if (isHTMLElement(e.currentTarget) && !e.currentTarget.contains(isHTMLElement(e.relatedTarget) ? e.relatedTarget : null)) {\n playAllToasts();\n }\n };\n el.addEventListener('keydown', keydownListener);\n el.addEventListener('focusin', focusInListener);\n el.addEventListener('focusout', focusOutListener);\n cleanupListenersRef.current = ()=>{\n el.removeEventListener('keydown', keydownListener);\n el.removeEventListener('focusin', focusInListener);\n el.removeEventListener('focusout', focusOutListener);\n };\n }, [\n targetDocument,\n pauseAllToasts,\n playAllToasts\n ]);\n}\n"],"names":["useToasterFocusManagement_unstable","noop","undefined","pauseAllToasts","playAllToasts","targetDocument","useFluent","cleanupListenersRef","React","useRef","useCallback","el","current","toastContainerWalker","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","node","isHTMLElement","classList","contains","toastContainerClassNames","root","FILTER_ACCEPT","FILTER_SKIP","keydownListener","e","target","key","ArrowDown","currentNode","nextToastContainer","nextNode","focus","ArrowUp","prevToastContainer","previousNode","lastChild","focusInListener","currentTarget","relatedTarget","focusOutListener","addEventListener","removeEventListener"],"mappings":";;;;+BAQoBA;;;eAAAA;;;;gCARU;iEACP;qCACyB;8BACb;gCACM;AACzC,MAAMC,OAAO,IAAIC;AAGN,SAASF,mCAAmCG,cAAc,EAAEC,aAAa;IAChF,MAAM,EAAEC,cAAc,EAAE,GAAGC,IAAAA,uCAAS;IACpC,MAAMC,sBAAsBC,OAAMC,MAAM,CAACR;IACzC,OAAOO,OAAME,WAAW,CAAC,CAACC;QACtB,IAAI,CAACA,MAAM,CAACN,gBAAgB;YACxBE,oBAAoBK,OAAO;YAC3BL,oBAAoBK,OAAO,GAAGX;YAC9B;QACJ;QACA,MAAMY,uBAAuBR,eAAeS,gBAAgB,CAACH,IAAII,WAAWC,YAAY,EAAE;YACtFC,YAAYC,IAAI;gBACZ,IAAIC,IAAAA,6BAAa,EAACD,SAASA,KAAKE,SAAS,CAACC,QAAQ,CAACC,wCAAwB,CAACC,IAAI,GAAG;oBAC/E,OAAOR,WAAWS,aAAa;gBACnC;gBACA,OAAOT,WAAWU,WAAW;YACjC;QACJ;QACA;;;;;OAKD,GAAG,MAAMC,kBAAkB,CAACC;YACvB,MAAM,EAAEC,MAAM,EAAEC,GAAG,EAAE,GAAGF;YACxB,IAAI,CAACR,IAAAA,6BAAa,EAACS,SAAS;gBACxB;YACJ;YACA,IAAIC,QAAQC,uBAAS,EAAE;gBACnBjB,qBAAqBkB,WAAW,GAAGH;gBACnC,IAAII,qBAAqBnB,qBAAqBoB,QAAQ;gBACtD,IAAI,CAACD,oBAAoB;oBACrBnB,qBAAqBkB,WAAW,GAAGpB;oBACnCqB,qBAAqBnB,qBAAqBoB,QAAQ;gBACtD;gBACA,IAAId,IAAAA,6BAAa,EAACa,qBAAqB;oBACnCA,mBAAmBE,KAAK;gBAC5B;YACJ;YACA,IAAIL,QAAQM,qBAAO,EAAE;gBACjBtB,qBAAqBkB,WAAW,GAAGH;gBACnC,IAAIQ,qBAAqBvB,qBAAqBwB,YAAY;gBAC1D,IAAID,sBAAsBA,mBAAmBf,QAAQ,CAACO,SAAS;oBAC3DQ,qBAAqBvB,qBAAqBwB,YAAY;gBAC1D;gBACA,IAAI,CAACD,oBAAoB;oBACrBvB,qBAAqBkB,WAAW,GAAGpB;oBACnCyB,qBAAqBvB,qBAAqByB,SAAS;gBACvD;gBACA,IAAInB,IAAAA,6BAAa,EAACiB,qBAAqB;oBACnCA,mBAAmBF,KAAK;gBAC5B;YACJ;QACJ;QACA,MAAMK,kBAAkB,CAACZ;YACrB,IAAIR,IAAAA,6BAAa,EAACQ,EAAEa,aAAa,KAAK,CAACb,EAAEa,aAAa,CAACnB,QAAQ,CAACF,IAAAA,6BAAa,EAACQ,EAAEc,aAAa,IAAId,EAAEc,aAAa,GAAG,OAAO;gBACtHtC;YACJ;QACJ;QACA,MAAMuC,mBAAmB,CAACf;YACtB,IAAIR,IAAAA,6BAAa,EAACQ,EAAEa,aAAa,KAAK,CAACb,EAAEa,aAAa,CAACnB,QAAQ,CAACF,IAAAA,6BAAa,EAACQ,EAAEc,aAAa,IAAId,EAAEc,aAAa,GAAG,OAAO;gBACtHrC;YACJ;QACJ;QACAO,GAAGgC,gBAAgB,CAAC,WAAWjB;QAC/Bf,GAAGgC,gBAAgB,CAAC,WAAWJ;QAC/B5B,GAAGgC,gBAAgB,CAAC,YAAYD;QAChCnC,oBAAoBK,OAAO,GAAG;YAC1BD,GAAGiC,mBAAmB,CAAC,WAAWlB;YAClCf,GAAGiC,mBAAmB,CAAC,WAAWL;YAClC5B,GAAGiC,mBAAmB,CAAC,YAAYF;QACvC;IACJ,GAAG;QACCrC;QACAF;QACAC;KACH;AACL"}
|
|
@@ -9,8 +9,12 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
toasterClassNames: ()
|
|
13
|
-
|
|
12
|
+
toasterClassNames: function() {
|
|
13
|
+
return toasterClassNames;
|
|
14
|
+
},
|
|
15
|
+
useToasterStyles_unstable: function() {
|
|
16
|
+
return useToasterStyles_unstable;
|
|
17
|
+
}
|
|
14
18
|
});
|
|
15
19
|
const _react = require("@griffel/react");
|
|
16
20
|
const _index = require("../../state/index");
|
|
@@ -19,7 +23,7 @@ const toasterClassNames = {
|
|
|
19
23
|
};
|
|
20
24
|
/**
|
|
21
25
|
* Styles for the root slot
|
|
22
|
-
*/ const useRootBaseClassName = /*#__PURE__*/ (0, _react
|
|
26
|
+
*/ const useRootBaseClassName = /*#__PURE__*/ (0, _react.__resetStyles)("r3hfdjz", null, [
|
|
23
27
|
".r3hfdjz{position:fixed;width:292px;pointer-events:none;}"
|
|
24
28
|
]);
|
|
25
29
|
const useToasterStyles_unstable = (state)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useToasterStyles.styles.js"],"sourcesContent":["import { __resetStyles, mergeClasses } from '@griffel/react';\nimport { TOAST_POSITIONS, getPositionStyles } from '../../state/index';\nexport const toasterClassNames = {\n root: 'fui-Toaster'\n};\n/**\n * Styles for the root slot\n */\nconst useRootBaseClassName = /*#__PURE__*/__resetStyles(\"r3hfdjz\", null, [\".r3hfdjz{position:fixed;width:292px;pointer-events:none;}\"]);\n/**\n * Apply styling to the Toaster slots based on the state\n */\nexport const useToasterStyles_unstable = state => {\n const rootBaseClassName = useRootBaseClassName();\n const className = mergeClasses(toasterClassNames.root, rootBaseClassName, state.root.className);\n if (state.bottomStart) {\n var _state_bottomStart;\n state.bottomStart.className = className;\n var _style;\n (_style = (_state_bottomStart = state.bottomStart).style) !== null && _style !== void 0 ? _style : _state_bottomStart.style = {};\n Object.assign(state.bottomStart.style, getPositionStyles(TOAST_POSITIONS.bottomStart, state.dir, state.offset));\n }\n if (state.bottomEnd) {\n var _state_bottomEnd;\n state.bottomEnd.className = className;\n var _style1;\n (_style1 = (_state_bottomEnd = state.bottomEnd).style) !== null && _style1 !== void 0 ? _style1 : _state_bottomEnd.style = {};\n Object.assign(state.bottomEnd.style, getPositionStyles(TOAST_POSITIONS.bottomEnd, state.dir, state.offset));\n }\n if (state.topStart) {\n var _state_topStart;\n state.topStart.className = className;\n var _style2;\n (_style2 = (_state_topStart = state.topStart).style) !== null && _style2 !== void 0 ? _style2 : _state_topStart.style = {};\n Object.assign(state.topStart.style, getPositionStyles(TOAST_POSITIONS.topStart, state.dir, state.offset));\n }\n if (state.topEnd) {\n var _state_topEnd;\n state.topEnd.className = className;\n var _style3;\n (_style3 = (_state_topEnd = state.topEnd).style) !== null && _style3 !== void 0 ? _style3 : _state_topEnd.style = {};\n Object.assign(state.topEnd.style, getPositionStyles(TOAST_POSITIONS.topEnd, state.dir, state.offset));\n }\n return state;\n};\n//# sourceMappingURL=useToasterStyles.styles.js.map"],"names":["toasterClassNames","useToasterStyles_unstable","root","useRootBaseClassName","__resetStyles","state","rootBaseClassName","className","mergeClasses","bottomStart","_state_bottomStart","_style","style","Object","assign","getPositionStyles","TOAST_POSITIONS","dir","offset","bottomEnd","_state_bottomEnd","_style1","topStart","_state_topStart","_style2","topEnd","_state_topEnd","_style3"],"mappings":";;;;;;;;;;;IAEaA,iBAAiB
|
|
1
|
+
{"version":3,"sources":["useToasterStyles.styles.js"],"sourcesContent":["import { __resetStyles, mergeClasses } from '@griffel/react';\nimport { TOAST_POSITIONS, getPositionStyles } from '../../state/index';\nexport const toasterClassNames = {\n root: 'fui-Toaster'\n};\n/**\n * Styles for the root slot\n */\nconst useRootBaseClassName = /*#__PURE__*/__resetStyles(\"r3hfdjz\", null, [\".r3hfdjz{position:fixed;width:292px;pointer-events:none;}\"]);\n/**\n * Apply styling to the Toaster slots based on the state\n */\nexport const useToasterStyles_unstable = state => {\n const rootBaseClassName = useRootBaseClassName();\n const className = mergeClasses(toasterClassNames.root, rootBaseClassName, state.root.className);\n if (state.bottomStart) {\n var _state_bottomStart;\n state.bottomStart.className = className;\n var _style;\n (_style = (_state_bottomStart = state.bottomStart).style) !== null && _style !== void 0 ? _style : _state_bottomStart.style = {};\n Object.assign(state.bottomStart.style, getPositionStyles(TOAST_POSITIONS.bottomStart, state.dir, state.offset));\n }\n if (state.bottomEnd) {\n var _state_bottomEnd;\n state.bottomEnd.className = className;\n var _style1;\n (_style1 = (_state_bottomEnd = state.bottomEnd).style) !== null && _style1 !== void 0 ? _style1 : _state_bottomEnd.style = {};\n Object.assign(state.bottomEnd.style, getPositionStyles(TOAST_POSITIONS.bottomEnd, state.dir, state.offset));\n }\n if (state.topStart) {\n var _state_topStart;\n state.topStart.className = className;\n var _style2;\n (_style2 = (_state_topStart = state.topStart).style) !== null && _style2 !== void 0 ? _style2 : _state_topStart.style = {};\n Object.assign(state.topStart.style, getPositionStyles(TOAST_POSITIONS.topStart, state.dir, state.offset));\n }\n if (state.topEnd) {\n var _state_topEnd;\n state.topEnd.className = className;\n var _style3;\n (_style3 = (_state_topEnd = state.topEnd).style) !== null && _style3 !== void 0 ? _style3 : _state_topEnd.style = {};\n Object.assign(state.topEnd.style, getPositionStyles(TOAST_POSITIONS.topEnd, state.dir, state.offset));\n }\n return state;\n};\n//# sourceMappingURL=useToasterStyles.styles.js.map"],"names":["toasterClassNames","useToasterStyles_unstable","root","useRootBaseClassName","__resetStyles","state","rootBaseClassName","className","mergeClasses","bottomStart","_state_bottomStart","_style","style","Object","assign","getPositionStyles","TOAST_POSITIONS","dir","offset","bottomEnd","_state_bottomEnd","_style1","topStart","_state_topStart","_style2","topEnd","_state_topEnd","_style3"],"mappings":";;;;;;;;;;;IAEaA,iBAAiB;eAAjBA;;IAUAC,yBAAyB;eAAzBA;;;uBAZ+B;uBACO;AAC5C,MAAMD,oBAAoB;IAC/BE,MAAM;AACR;AACA;;CAEC,GACD,MAAMC,uBAAuB,WAAW,GAAEC,IAAAA,oBAAa,EAAC,WAAW,MAAM;IAAC;CAA4D;AAI/H,MAAMH,4BAA4BI,CAAAA;IACvC,MAAMC,oBAAoBH;IAC1B,MAAMI,YAAYC,IAAAA,mBAAY,EAACR,kBAAkBE,IAAI,EAAEI,mBAAmBD,MAAMH,IAAI,CAACK,SAAS;IAC9F,IAAIF,MAAMI,WAAW,EAAE;QACrB,IAAIC;QACJL,MAAMI,WAAW,CAACF,SAAS,GAAGA;QAC9B,IAAII;QACHA,CAAAA,SAAS,AAACD,CAAAA,qBAAqBL,MAAMI,WAAW,AAAD,EAAGG,KAAK,AAAD,MAAO,QAAQD,WAAW,KAAK,IAAIA,SAASD,mBAAmBE,KAAK,GAAG,CAAC;QAC/HC,OAAOC,MAAM,CAACT,MAAMI,WAAW,CAACG,KAAK,EAAEG,IAAAA,wBAAiB,EAACC,sBAAe,CAACP,WAAW,EAAEJ,MAAMY,GAAG,EAAEZ,MAAMa,MAAM;IAC/G;IACA,IAAIb,MAAMc,SAAS,EAAE;QACnB,IAAIC;QACJf,MAAMc,SAAS,CAACZ,SAAS,GAAGA;QAC5B,IAAIc;QACHA,CAAAA,UAAU,AAACD,CAAAA,mBAAmBf,MAAMc,SAAS,AAAD,EAAGP,KAAK,AAAD,MAAO,QAAQS,YAAY,KAAK,IAAIA,UAAUD,iBAAiBR,KAAK,GAAG,CAAC;QAC5HC,OAAOC,MAAM,CAACT,MAAMc,SAAS,CAACP,KAAK,EAAEG,IAAAA,wBAAiB,EAACC,sBAAe,CAACG,SAAS,EAAEd,MAAMY,GAAG,EAAEZ,MAAMa,MAAM;IAC3G;IACA,IAAIb,MAAMiB,QAAQ,EAAE;QAClB,IAAIC;QACJlB,MAAMiB,QAAQ,CAACf,SAAS,GAAGA;QAC3B,IAAIiB;QACHA,CAAAA,UAAU,AAACD,CAAAA,kBAAkBlB,MAAMiB,QAAQ,AAAD,EAAGV,KAAK,AAAD,MAAO,QAAQY,YAAY,KAAK,IAAIA,UAAUD,gBAAgBX,KAAK,GAAG,CAAC;QACzHC,OAAOC,MAAM,CAACT,MAAMiB,QAAQ,CAACV,KAAK,EAAEG,IAAAA,wBAAiB,EAACC,sBAAe,CAACM,QAAQ,EAAEjB,MAAMY,GAAG,EAAEZ,MAAMa,MAAM;IACzG;IACA,IAAIb,MAAMoB,MAAM,EAAE;QAChB,IAAIC;QACJrB,MAAMoB,MAAM,CAAClB,SAAS,GAAGA;QACzB,IAAIoB;QACHA,CAAAA,UAAU,AAACD,CAAAA,gBAAgBrB,MAAMoB,MAAM,AAAD,EAAGb,KAAK,AAAD,MAAO,QAAQe,YAAY,KAAK,IAAIA,UAAUD,cAAcd,KAAK,GAAG,CAAC;QACnHC,OAAOC,MAAM,CAACT,MAAMoB,MAAM,CAACb,KAAK,EAAEG,IAAAA,wBAAiB,EAACC,sBAAe,CAACS,MAAM,EAAEpB,MAAMY,GAAG,EAAEZ,MAAMa,MAAM;IACrG;IACA,OAAOb;AACT,GACA,mDAAmD"}
|
|
@@ -9,11 +9,15 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
ToastContainerContextProvider: ()
|
|
13
|
-
|
|
12
|
+
ToastContainerContextProvider: function() {
|
|
13
|
+
return ToastContainerContextProvider;
|
|
14
|
+
},
|
|
15
|
+
useToastContainerContext: function() {
|
|
16
|
+
return useToastContainerContext;
|
|
17
|
+
}
|
|
14
18
|
});
|
|
15
|
-
const
|
|
16
|
-
const _react = /*#__PURE__*/
|
|
19
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
20
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
17
21
|
const toastContainerContextDefaultValue = {
|
|
18
22
|
close: ()=>null,
|
|
19
23
|
intent: undefined,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["toastContainerContext.js"],"sourcesContent":["import * as React from 'react';\nconst toastContainerContextDefaultValue = {\n close: ()=>null,\n intent: undefined,\n bodyId: '',\n titleId: ''\n};\nconst ToastContainerContext = /*#__PURE__*/ React.createContext(undefined);\nexport const ToastContainerContextProvider = ToastContainerContext.Provider;\nvar _React_useContext;\nexport const useToastContainerContext = ()=>(_React_useContext = React.useContext(ToastContainerContext)) !== null && _React_useContext !== void 0 ? _React_useContext : toastContainerContextDefaultValue;\n"],"names":["ToastContainerContextProvider","useToastContainerContext","toastContainerContextDefaultValue","close","intent","undefined","bodyId","titleId","ToastContainerContext","React","createContext","Provider","_React_useContext","useContext"],"mappings":";;;;;;;;;;;IAQaA,6BAA6B
|
|
1
|
+
{"version":3,"sources":["toastContainerContext.js"],"sourcesContent":["import * as React from 'react';\nconst toastContainerContextDefaultValue = {\n close: ()=>null,\n intent: undefined,\n bodyId: '',\n titleId: ''\n};\nconst ToastContainerContext = /*#__PURE__*/ React.createContext(undefined);\nexport const ToastContainerContextProvider = ToastContainerContext.Provider;\nvar _React_useContext;\nexport const useToastContainerContext = ()=>(_React_useContext = React.useContext(ToastContainerContext)) !== null && _React_useContext !== void 0 ? _React_useContext : toastContainerContextDefaultValue;\n"],"names":["ToastContainerContextProvider","useToastContainerContext","toastContainerContextDefaultValue","close","intent","undefined","bodyId","titleId","ToastContainerContext","React","createContext","Provider","_React_useContext","useContext"],"mappings":";;;;;;;;;;;IAQaA,6BAA6B;eAA7BA;;IAEAC,wBAAwB;eAAxBA;;;;iEAVU;AACvB,MAAMC,oCAAoC;IACtCC,OAAO,IAAI;IACXC,QAAQC;IACRC,QAAQ;IACRC,SAAS;AACb;AACA,MAAMC,wBAAwB,WAAW,GAAGC,OAAMC,aAAa,CAACL;AACzD,MAAML,gCAAgCQ,sBAAsBG,QAAQ;AAC3E,IAAIC;AACG,MAAMX,2BAA2B,IAAI,AAACW,CAAAA,oBAAoBH,OAAMI,UAAU,CAACL,sBAAqB,MAAO,QAAQI,sBAAsB,KAAK,IAAIA,oBAAoBV"}
|
package/lib-commonjs/index.js
CHANGED
|
@@ -9,40 +9,98 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
useToastController: ()
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
12
|
+
useToastController: function() {
|
|
13
|
+
return _state.useToastController;
|
|
14
|
+
},
|
|
15
|
+
ToastTrigger: function() {
|
|
16
|
+
return _ToastTrigger.ToastTrigger;
|
|
17
|
+
},
|
|
18
|
+
useToastTrigger_unstable: function() {
|
|
19
|
+
return _ToastTrigger.useToastTrigger_unstable;
|
|
20
|
+
},
|
|
21
|
+
renderToastTrigger_unstable: function() {
|
|
22
|
+
return _ToastTrigger.renderToastTrigger_unstable;
|
|
23
|
+
},
|
|
24
|
+
Toaster: function() {
|
|
25
|
+
return _Toaster.Toaster;
|
|
26
|
+
},
|
|
27
|
+
useToaster_unstable: function() {
|
|
28
|
+
return _Toaster.useToaster_unstable;
|
|
29
|
+
},
|
|
30
|
+
useToasterStyles_unstable: function() {
|
|
31
|
+
return _Toaster.useToasterStyles_unstable;
|
|
32
|
+
},
|
|
33
|
+
renderToaster_unstable: function() {
|
|
34
|
+
return _Toaster.renderToaster_unstable;
|
|
35
|
+
},
|
|
36
|
+
toasterClassNames: function() {
|
|
37
|
+
return _Toaster.toasterClassNames;
|
|
38
|
+
},
|
|
39
|
+
Toast: function() {
|
|
40
|
+
return _Toast.Toast;
|
|
41
|
+
},
|
|
42
|
+
useToastStyles_unstable: function() {
|
|
43
|
+
return _Toast.useToastStyles_unstable;
|
|
44
|
+
},
|
|
45
|
+
useToast_unstable: function() {
|
|
46
|
+
return _Toast.useToast_unstable;
|
|
47
|
+
},
|
|
48
|
+
renderToast_unstable: function() {
|
|
49
|
+
return _Toast.renderToast_unstable;
|
|
50
|
+
},
|
|
51
|
+
toastClassNames: function() {
|
|
52
|
+
return _Toast.toastClassNames;
|
|
53
|
+
},
|
|
54
|
+
ToastTitle: function() {
|
|
55
|
+
return _ToastTitle.ToastTitle;
|
|
56
|
+
},
|
|
57
|
+
useToastTitleStyles_unstable: function() {
|
|
58
|
+
return _ToastTitle.useToastTitleStyles_unstable;
|
|
59
|
+
},
|
|
60
|
+
useToastTitle_unstable: function() {
|
|
61
|
+
return _ToastTitle.useToastTitle_unstable;
|
|
62
|
+
},
|
|
63
|
+
renderToastTitle_unstable: function() {
|
|
64
|
+
return _ToastTitle.renderToastTitle_unstable;
|
|
65
|
+
},
|
|
66
|
+
toastTitleClassNames: function() {
|
|
67
|
+
return _ToastTitle.toastTitleClassNames;
|
|
68
|
+
},
|
|
69
|
+
ToastBody: function() {
|
|
70
|
+
return _ToastBody.ToastBody;
|
|
71
|
+
},
|
|
72
|
+
useToastBodyStyles_unstable: function() {
|
|
73
|
+
return _ToastBody.useToastBodyStyles_unstable;
|
|
74
|
+
},
|
|
75
|
+
useToastBody_unstable: function() {
|
|
76
|
+
return _ToastBody.useToastBody_unstable;
|
|
77
|
+
},
|
|
78
|
+
renderToastBody_unstable: function() {
|
|
79
|
+
return _ToastBody.renderToastBody_unstable;
|
|
80
|
+
},
|
|
81
|
+
toastBodyClassNames: function() {
|
|
82
|
+
return _ToastBody.toastBodyClassNames;
|
|
83
|
+
},
|
|
84
|
+
ToastFooter: function() {
|
|
85
|
+
return _ToastFooter.ToastFooter;
|
|
86
|
+
},
|
|
87
|
+
useToastFooterStyles_unstable: function() {
|
|
88
|
+
return _ToastFooter.useToastFooterStyles_unstable;
|
|
89
|
+
},
|
|
90
|
+
useToastFooter_unstable: function() {
|
|
91
|
+
return _ToastFooter.useToastFooter_unstable;
|
|
92
|
+
},
|
|
93
|
+
renderToastFooter_unstable: function() {
|
|
94
|
+
return _ToastFooter.renderToastFooter_unstable;
|
|
95
|
+
},
|
|
96
|
+
toastFooterClassNames: function() {
|
|
97
|
+
return _ToastFooter.toastFooterClassNames;
|
|
98
|
+
}
|
|
41
99
|
});
|
|
42
100
|
const _state = require("./state");
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
const
|
|
101
|
+
const _ToastTrigger = require("./ToastTrigger");
|
|
102
|
+
const _Toaster = require("./Toaster");
|
|
103
|
+
const _Toast = require("./Toast");
|
|
104
|
+
const _ToastTitle = require("./ToastTitle");
|
|
105
|
+
const _ToastBody = require("./ToastBody");
|
|
106
|
+
const _ToastFooter = require("./ToastFooter");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.js"],"sourcesContent":["export { useToastController } from './state';\nexport { ToastTrigger, useToastTrigger_unstable, renderToastTrigger_unstable } from './ToastTrigger';\nexport { Toaster, useToaster_unstable, useToasterStyles_unstable, renderToaster_unstable, toasterClassNames } from './Toaster';\nexport { Toast, useToastStyles_unstable, useToast_unstable, renderToast_unstable, toastClassNames } from './Toast';\nexport { ToastTitle, useToastTitleStyles_unstable, useToastTitle_unstable, renderToastTitle_unstable, toastTitleClassNames } from './ToastTitle';\nexport { ToastBody, useToastBodyStyles_unstable, useToastBody_unstable, renderToastBody_unstable, toastBodyClassNames } from './ToastBody';\nexport { ToastFooter, useToastFooterStyles_unstable, useToastFooter_unstable, renderToastFooter_unstable, toastFooterClassNames } from './ToastFooter';\n"],"names":["useToastController","ToastTrigger","useToastTrigger_unstable","renderToastTrigger_unstable","Toaster","useToaster_unstable","useToasterStyles_unstable","renderToaster_unstable","toasterClassNames","Toast","useToastStyles_unstable","useToast_unstable","renderToast_unstable","toastClassNames","ToastTitle","useToastTitleStyles_unstable","useToastTitle_unstable","renderToastTitle_unstable","toastTitleClassNames","ToastBody","useToastBodyStyles_unstable","useToastBody_unstable","renderToastBody_unstable","toastBodyClassNames","ToastFooter","useToastFooterStyles_unstable","useToastFooter_unstable","renderToastFooter_unstable","toastFooterClassNames"],"mappings":";;;;;;;;;;;IAASA,kBAAkB,
|
|
1
|
+
{"version":3,"sources":["index.js"],"sourcesContent":["export { useToastController } from './state';\nexport { ToastTrigger, useToastTrigger_unstable, renderToastTrigger_unstable } from './ToastTrigger';\nexport { Toaster, useToaster_unstable, useToasterStyles_unstable, renderToaster_unstable, toasterClassNames } from './Toaster';\nexport { Toast, useToastStyles_unstable, useToast_unstable, renderToast_unstable, toastClassNames } from './Toast';\nexport { ToastTitle, useToastTitleStyles_unstable, useToastTitle_unstable, renderToastTitle_unstable, toastTitleClassNames } from './ToastTitle';\nexport { ToastBody, useToastBodyStyles_unstable, useToastBody_unstable, renderToastBody_unstable, toastBodyClassNames } from './ToastBody';\nexport { ToastFooter, useToastFooterStyles_unstable, useToastFooter_unstable, renderToastFooter_unstable, toastFooterClassNames } from './ToastFooter';\n"],"names":["useToastController","ToastTrigger","useToastTrigger_unstable","renderToastTrigger_unstable","Toaster","useToaster_unstable","useToasterStyles_unstable","renderToaster_unstable","toasterClassNames","Toast","useToastStyles_unstable","useToast_unstable","renderToast_unstable","toastClassNames","ToastTitle","useToastTitleStyles_unstable","useToastTitle_unstable","renderToastTitle_unstable","toastTitleClassNames","ToastBody","useToastBodyStyles_unstable","useToastBody_unstable","renderToastBody_unstable","toastBodyClassNames","ToastFooter","useToastFooterStyles_unstable","useToastFooter_unstable","renderToastFooter_unstable","toastFooterClassNames"],"mappings":";;;;;;;;;;;IAASA,kBAAkB;eAAlBA,yBAAkB;;IAClBC,YAAY;eAAZA,0BAAY;;IAAEC,wBAAwB;eAAxBA,sCAAwB;;IAAEC,2BAA2B;eAA3BA,yCAA2B;;IACnEC,OAAO;eAAPA,gBAAO;;IAAEC,mBAAmB;eAAnBA,4BAAmB;;IAAEC,yBAAyB;eAAzBA,kCAAyB;;IAAEC,sBAAsB;eAAtBA,+BAAsB;;IAAEC,iBAAiB;eAAjBA,0BAAiB;;IAClGC,KAAK;eAALA,YAAK;;IAAEC,uBAAuB;eAAvBA,8BAAuB;;IAAEC,iBAAiB;eAAjBA,wBAAiB;;IAAEC,oBAAoB;eAApBA,2BAAoB;;IAAEC,eAAe;eAAfA,sBAAe;;IACxFC,UAAU;eAAVA,sBAAU;;IAAEC,4BAA4B;eAA5BA,wCAA4B;;IAAEC,sBAAsB;eAAtBA,kCAAsB;;IAAEC,yBAAyB;eAAzBA,qCAAyB;;IAAEC,oBAAoB;eAApBA,gCAAoB;;IACjHC,SAAS;eAATA,oBAAS;;IAAEC,2BAA2B;eAA3BA,sCAA2B;;IAAEC,qBAAqB;eAArBA,gCAAqB;;IAAEC,wBAAwB;eAAxBA,mCAAwB;;IAAEC,mBAAmB;eAAnBA,8BAAmB;;IAC5GC,WAAW;eAAXA,wBAAW;;IAAEC,6BAA6B;eAA7BA,0CAA6B;;IAAEC,uBAAuB;eAAvBA,oCAAuB;;IAAEC,0BAA0B;eAA1BA,uCAA0B;;IAAEC,qBAAqB;eAArBA,kCAAqB;;;uBAN5F;8BACiD;yBAC+B;uBACV;4BACyB;2BACL;6BACU"}
|
|
@@ -9,8 +9,12 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
EVENTS: ()
|
|
13
|
-
|
|
12
|
+
EVENTS: function() {
|
|
13
|
+
return EVENTS;
|
|
14
|
+
},
|
|
15
|
+
TOAST_POSITIONS: function() {
|
|
16
|
+
return TOAST_POSITIONS;
|
|
17
|
+
}
|
|
14
18
|
});
|
|
15
19
|
const EVENTS = {
|
|
16
20
|
show: 'fui-toast-show',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["constants.js"],"sourcesContent":["export const EVENTS = {\n show: 'fui-toast-show',\n dismiss: 'fui-toast-dismiss',\n dismissAll: 'fui-toast-dismiss-all',\n update: 'fui-toast-update',\n pause: 'fui-toast-pause',\n play: 'fui-toast-play'\n};\nexport const TOAST_POSITIONS = {\n bottomEnd: 'bottom-end',\n bottomStart: 'bottom-start',\n topEnd: 'top-end',\n topStart: 'top-start'\n};\n"],"names":["EVENTS","TOAST_POSITIONS","show","dismiss","dismissAll","update","pause","play","bottomEnd","bottomStart","topEnd","topStart"],"mappings":";;;;;;;;;;;IAAaA,MAAM
|
|
1
|
+
{"version":3,"sources":["constants.js"],"sourcesContent":["export const EVENTS = {\n show: 'fui-toast-show',\n dismiss: 'fui-toast-dismiss',\n dismissAll: 'fui-toast-dismiss-all',\n update: 'fui-toast-update',\n pause: 'fui-toast-pause',\n play: 'fui-toast-play'\n};\nexport const TOAST_POSITIONS = {\n bottomEnd: 'bottom-end',\n bottomStart: 'bottom-start',\n topEnd: 'top-end',\n topStart: 'top-start'\n};\n"],"names":["EVENTS","TOAST_POSITIONS","show","dismiss","dismissAll","update","pause","play","bottomEnd","bottomStart","topEnd","topStart"],"mappings":";;;;;;;;;;;IAAaA,MAAM;eAANA;;IAQAC,eAAe;eAAfA;;;AARN,MAAMD,SAAS;IAClBE,MAAM;IACNC,SAAS;IACTC,YAAY;IACZC,QAAQ;IACRC,OAAO;IACPC,MAAM;AACV;AACO,MAAMN,kBAAkB;IAC3BO,WAAW;IACXC,aAAa;IACbC,QAAQ;IACRC,UAAU;AACd"}
|
|
@@ -9,12 +9,16 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
getPositionStyles: ()
|
|
13
|
-
|
|
12
|
+
getPositionStyles: function() {
|
|
13
|
+
return _vanilla.getPositionStyles;
|
|
14
|
+
},
|
|
15
|
+
TOAST_POSITIONS: function() {
|
|
16
|
+
return _constants.TOAST_POSITIONS;
|
|
17
|
+
}
|
|
14
18
|
});
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
const _export_star = require("@swc/helpers/_/_export_star");
|
|
20
|
+
_export_star._(require("./types"), exports);
|
|
21
|
+
_export_star._(require("./useToaster"), exports);
|
|
22
|
+
_export_star._(require("./useToastController"), exports);
|
|
19
23
|
const _vanilla = require("./vanilla");
|
|
20
24
|
const _constants = require("./constants");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.js"],"sourcesContent":["export * from './types';\nexport * from './useToaster';\nexport * from './useToastController';\nexport { getPositionStyles } from './vanilla';\nexport { TOAST_POSITIONS } from './constants';\n"],"names":["getPositionStyles","TOAST_POSITIONS"],"mappings":";;;;;;;;;;;IAGSA,iBAAiB,
|
|
1
|
+
{"version":3,"sources":["index.js"],"sourcesContent":["export * from './types';\nexport * from './useToaster';\nexport * from './useToastController';\nexport { getPositionStyles } from './vanilla';\nexport { TOAST_POSITIONS } from './constants';\n"],"names":["getPositionStyles","TOAST_POSITIONS"],"mappings":";;;;;;;;;;;IAGSA,iBAAiB;eAAjBA,0BAAiB;;IACjBC,eAAe;eAAfA,0BAAe;;;;uBAJV;uBACA;uBACA;yBACoB;2BACF"}
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
const
|
|
6
|
-
const _react = /*#__PURE__*/
|
|
5
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
6
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["types.js"],"sourcesContent":["import * as React from 'react';\n"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"sources":["types.js"],"sourcesContent":["import * as React from 'react';\n"],"names":[],"mappings":";;;;;iEAAuB"}
|
|
@@ -4,15 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "useToastController", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return useToastController;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
|
-
const
|
|
10
|
-
const _react = /*#__PURE__*/
|
|
11
|
-
const
|
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
|
+
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
|
|
12
14
|
const _vanilla = require("./vanilla");
|
|
13
15
|
const noop = ()=>undefined;
|
|
14
16
|
function useToastController(toasterId) {
|
|
15
|
-
const { targetDocument
|
|
17
|
+
const { targetDocument } = (0, _reactsharedcontexts.useFluent_unstable)();
|
|
16
18
|
return _react.useMemo(()=>{
|
|
17
19
|
if (!targetDocument) {
|
|
18
20
|
return {
|
|
@@ -26,11 +28,12 @@ function useToastController(toasterId) {
|
|
|
26
28
|
}
|
|
27
29
|
return {
|
|
28
30
|
dispatchToast: (content, options)=>{
|
|
31
|
+
var _options;
|
|
29
32
|
(0, _vanilla.dispatchToast)(content, {
|
|
30
33
|
...options,
|
|
31
34
|
toasterId,
|
|
32
35
|
data: {
|
|
33
|
-
root: options === null ||
|
|
36
|
+
root: (_options = options) === null || _options === void 0 ? void 0 : _options.root
|
|
34
37
|
}
|
|
35
38
|
}, targetDocument);
|
|
36
39
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useToastController.js"],"sourcesContent":["import * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { dispatchToast as dispatchToastVanilla, dismissToast as dismissToastVanilla, dismissAllToasts as dismissAllToastsVanilla, updateToast as updateToastVanilla, playToast as playToastVanilla, pauseToast as pauseToastVanilla } from './vanilla';\nconst noop = ()=>undefined;\n/**\n * @param toasterId - If an id is provided all imperative methods control that specific toaster\n * @returns Imperative methods to control toasts\n */ export function useToastController(toasterId) {\n const { targetDocument
|
|
1
|
+
{"version":3,"sources":["useToastController.js"],"sourcesContent":["import * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { dispatchToast as dispatchToastVanilla, dismissToast as dismissToastVanilla, dismissAllToasts as dismissAllToastsVanilla, updateToast as updateToastVanilla, playToast as playToastVanilla, pauseToast as pauseToastVanilla } from './vanilla';\nconst noop = ()=>undefined;\n/**\n * @param toasterId - If an id is provided all imperative methods control that specific toaster\n * @returns Imperative methods to control toasts\n */ export function useToastController(toasterId) {\n const { targetDocument } = useFluent();\n return React.useMemo(()=>{\n if (!targetDocument) {\n return {\n dispatchToast: noop,\n dismissToast: noop,\n dismissAllToasts: noop,\n updateToast: noop,\n pauseToast: noop,\n playToast: noop\n };\n }\n return {\n dispatchToast: (content, options)=>{\n var _options;\n dispatchToastVanilla(content, {\n ...options,\n toasterId,\n data: {\n root: (_options = options) === null || _options === void 0 ? void 0 : _options.root\n }\n }, targetDocument);\n },\n dismissToast: (toastId)=>{\n dismissToastVanilla(toastId, toasterId, targetDocument);\n },\n dismissAllToasts: ()=>{\n dismissAllToastsVanilla(toasterId, targetDocument);\n },\n updateToast: (options)=>{\n updateToastVanilla({\n ...options,\n data: {\n root: options.root\n },\n toasterId\n }, targetDocument);\n },\n pauseToast: (toastId)=>{\n pauseToastVanilla(toastId, toasterId, targetDocument);\n },\n playToast: (toastId)=>{\n playToastVanilla(toastId, toasterId, targetDocument);\n }\n };\n }, [\n targetDocument,\n toasterId\n ]);\n}\n"],"names":["useToastController","noop","undefined","toasterId","targetDocument","useFluent","React","useMemo","dispatchToast","dismissToast","dismissAllToasts","updateToast","pauseToast","playToast","content","options","_options","dispatchToastVanilla","data","root","toastId","dismissToastVanilla","dismissAllToastsVanilla","updateToastVanilla","pauseToastVanilla","playToastVanilla"],"mappings":";;;;+BAOoBA;;;eAAAA;;;;iEAPG;qCACyB;yBAC2L;AAC3O,MAAMC,OAAO,IAAIC;AAIN,SAASF,mBAAmBG,SAAS;IAC5C,MAAM,EAAEC,cAAc,EAAE,GAAGC,IAAAA,uCAAS;IACpC,OAAOC,OAAMC,OAAO,CAAC;QACjB,IAAI,CAACH,gBAAgB;YACjB,OAAO;gBACHI,eAAeP;gBACfQ,cAAcR;gBACdS,kBAAkBT;gBAClBU,aAAaV;gBACbW,YAAYX;gBACZY,WAAWZ;YACf;QACJ;QACA,OAAO;YACHO,eAAe,CAACM,SAASC;gBACrB,IAAIC;gBACJC,IAAAA,sBAAoB,EAACH,SAAS;oBAC1B,GAAGC,OAAO;oBACVZ;oBACAe,MAAM;wBACFC,MAAM,AAACH,CAAAA,WAAWD,OAAM,MAAO,QAAQC,aAAa,KAAK,IAAI,KAAK,IAAIA,SAASG,IAAI;oBACvF;gBACJ,GAAGf;YACP;YACAK,cAAc,CAACW;gBACXC,IAAAA,qBAAmB,EAACD,SAASjB,WAAWC;YAC5C;YACAM,kBAAkB;gBACdY,IAAAA,yBAAuB,EAACnB,WAAWC;YACvC;YACAO,aAAa,CAACI;gBACVQ,IAAAA,oBAAkB,EAAC;oBACf,GAAGR,OAAO;oBACVG,MAAM;wBACFC,MAAMJ,QAAQI,IAAI;oBACtB;oBACAhB;gBACJ,GAAGC;YACP;YACAQ,YAAY,CAACQ;gBACTI,IAAAA,mBAAiB,EAACJ,SAASjB,WAAWC;YAC1C;YACAS,WAAW,CAACO;gBACRK,IAAAA,kBAAgB,EAACL,SAASjB,WAAWC;YACzC;QACJ;IACJ,GAAG;QACCA;QACAD;KACH;AACL"}
|