@wix/site-ui 1.185.0 → 1.187.0
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/dist/1763.js +836 -0
- package/dist/2205.js +26 -0
- package/dist/2445.js +470 -0
- package/dist/285.js +1 -1
- package/dist/3485.js +4 -3
- package/dist/4863.js +61 -0
- package/dist/{4388.js → 487.js} +5 -57
- package/dist/5992.js +5 -471
- package/dist/6046.js +2 -26
- package/dist/6089.js +6 -3
- package/dist/6270.js +5 -3
- package/dist/6535.js +2 -1
- package/dist/6588.js +2 -1
- package/dist/6882.js +8 -4
- package/dist/6917.js +55 -0
- package/dist/7871.js +1 -1
- package/dist/8052.js +2 -1
- package/dist/8106.js +3 -2
- package/dist/8171.js +1 -1
- package/dist/8750.js +3 -2
- package/dist/8960.js +1 -1
- package/dist/904.js +1 -1
- package/dist/9352.js +2 -2
- package/dist/{880.js → 9369.js} +2 -60
- package/dist/Accordion/index.js +1 -1
- package/dist/Avatar/index.js +2 -1
- package/dist/Checkbox/index.js +2 -1
- package/dist/Collapsible/index.js +1 -1
- package/dist/Combobox/index.js +3 -2
- package/dist/ContextMenu/index.js +2 -2
- package/dist/Drawer/index.js +10 -836
- package/dist/Field/index.js +2 -1
- package/dist/Menu/index.js +3 -2
- package/dist/NavigationMenu/index.js +6 -3
- package/dist/Popover/index.js +5 -3
- package/dist/PreviewCard/index.js +5 -3
- package/dist/Radio/index.js +2 -1
- package/dist/Select/index.js +6 -3
- package/dist/Tabs/index.js +2 -1
- package/dist/Toast/index.css +111 -0
- package/dist/Toast/index.d.ts +846 -0
- package/dist/Toast/index.js +1204 -0
- package/dist/Tooltip/index.js +5 -3
- package/dist/index.d.ts +501 -0
- package/dist/index.js +1 -0
- package/package.json +2 -2
- /package/dist/{5992.js.LICENSE.txt → 2445.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,1204 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Close } from "@wix/wix-ui-icons-common/on-stage";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import { useRefWithInit, useRenderElement, esm_formatErrorMessage } from "../8272.js";
|
|
5
|
+
import { Timeout, useTimeout } from "../42.js";
|
|
6
|
+
import { getTarget, contains, activeElement } from "../4549.js";
|
|
7
|
+
import { ownerDocument } from "../9829.js";
|
|
8
|
+
import { getWindow } from "../3829.js";
|
|
9
|
+
import { addEventListener } from "../4723.js";
|
|
10
|
+
import { matchesFocusVisible } from "../8758.js";
|
|
11
|
+
import { mergeCleanups } from "../4495.js";
|
|
12
|
+
import { FocusGuard_FocusGuard, LEGACY_SWIPE_IGNORE_SELECTOR, BASE_UI_SWIPE_IGNORE_SELECTOR } from "../487.js";
|
|
13
|
+
import { visuallyHidden } from "../8225.js";
|
|
14
|
+
import { transitionStatusMapping, useOpenChangeComplete } from "../9369.js";
|
|
15
|
+
import { useStableCallback } from "../7541.js";
|
|
16
|
+
import { useIsoLayoutEffect } from "../6499.js";
|
|
17
|
+
import { getDisplacement, getElementTransform } from "../1763.js";
|
|
18
|
+
import { inertValue } from "../167.js";
|
|
19
|
+
import { useId } from "../2205.js";
|
|
20
|
+
import { useButton } from "../9189.js";
|
|
21
|
+
import { ReactStore, createSelector } from "../2445.js";
|
|
22
|
+
import { useOnMount } from "../2861.js";
|
|
23
|
+
import { FloatingPortalLite_FloatingPortalLite } from "../8960.js";
|
|
24
|
+
import * as __rspack_external_react from "react";
|
|
25
|
+
import * as __rspack_external_react_dom_7136dc57 from "react-dom";
|
|
26
|
+
const ToastContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
|
|
27
|
+
if ("production" !== process.env.NODE_ENV) ToastContext.displayName = "ToastContext";
|
|
28
|
+
function useToastProviderContext() {
|
|
29
|
+
const context = __rspack_external_react.useContext(ToastContext);
|
|
30
|
+
if (!context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: useToastManager must be used within <Toast.Provider>.' : esm_formatErrorMessage(73));
|
|
31
|
+
return context;
|
|
32
|
+
}
|
|
33
|
+
let ToastViewportCssVars_ToastViewportCssVars = /*#__PURE__*/ function(ToastViewportCssVars) {
|
|
34
|
+
ToastViewportCssVars["frontmostHeight"] = "--toast-frontmost-height";
|
|
35
|
+
return ToastViewportCssVars;
|
|
36
|
+
}({});
|
|
37
|
+
const ToastViewport_ToastViewport = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
38
|
+
const { render, className, style, children, ...elementProps } = componentProps;
|
|
39
|
+
const store = useToastProviderContext();
|
|
40
|
+
const windowFocusTimeout = useTimeout();
|
|
41
|
+
const handlingFocusGuardRef = __rspack_external_react.useRef(false);
|
|
42
|
+
const markedReadyForMouseLeaveRef = __rspack_external_react.useRef(false);
|
|
43
|
+
const touchActiveRef = __rspack_external_react.useRef(false);
|
|
44
|
+
const isEmpty = store.useState('isEmpty');
|
|
45
|
+
const toasts = store.useState('toasts');
|
|
46
|
+
const focused = store.useState('focused');
|
|
47
|
+
const expanded = store.useState('expanded');
|
|
48
|
+
const prevFocusElement = store.useState('prevFocusElement');
|
|
49
|
+
const frontmostHeight = toasts[0]?.height ?? 0;
|
|
50
|
+
const hasTransitioningToasts = __rspack_external_react.useMemo(()=>toasts.some((toast)=>'ending' === toast.transitionStatus), [
|
|
51
|
+
toasts
|
|
52
|
+
]);
|
|
53
|
+
const highPriorityToasts = __rspack_external_react.useMemo(()=>toasts.filter((toast)=>'high' === toast.priority), [
|
|
54
|
+
toasts
|
|
55
|
+
]);
|
|
56
|
+
__rspack_external_react.useEffect(()=>{
|
|
57
|
+
const viewport = store.state.viewport;
|
|
58
|
+
if (!viewport) return;
|
|
59
|
+
function handleGlobalKeyDown(event) {
|
|
60
|
+
if (isEmpty) return;
|
|
61
|
+
if ('F6' === event.key && getTarget(event) !== viewport) {
|
|
62
|
+
event.preventDefault();
|
|
63
|
+
store.setPrevFocusElement(activeElement(ownerDocument(viewport)));
|
|
64
|
+
viewport?.focus({
|
|
65
|
+
preventScroll: true
|
|
66
|
+
});
|
|
67
|
+
store.pauseTimers();
|
|
68
|
+
store.setFocused(true);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const win = getWindow(viewport);
|
|
72
|
+
return addEventListener(win, 'keydown', handleGlobalKeyDown);
|
|
73
|
+
}, [
|
|
74
|
+
store,
|
|
75
|
+
isEmpty
|
|
76
|
+
]);
|
|
77
|
+
__rspack_external_react.useEffect(()=>{
|
|
78
|
+
const viewport = store.state.viewport;
|
|
79
|
+
if (!viewport || isEmpty) return;
|
|
80
|
+
const win = getWindow(viewport);
|
|
81
|
+
function handleWindowBlur(event) {
|
|
82
|
+
if (getTarget(event) !== win) return;
|
|
83
|
+
store.setIsWindowFocused(false);
|
|
84
|
+
store.pauseTimers();
|
|
85
|
+
}
|
|
86
|
+
function handleWindowFocus(event) {
|
|
87
|
+
if (event.relatedTarget) return;
|
|
88
|
+
const target = getTarget(event);
|
|
89
|
+
const activeEl = activeElement(ownerDocument(viewport));
|
|
90
|
+
if (target === win || !contains(viewport, target) || !matchesFocusVisible(activeEl)) store.resumeTimers();
|
|
91
|
+
windowFocusTimeout.start(0, ()=>store.setIsWindowFocused(true));
|
|
92
|
+
}
|
|
93
|
+
return mergeCleanups(addEventListener(win, 'blur', handleWindowBlur, true), addEventListener(win, 'focus', handleWindowFocus, true));
|
|
94
|
+
}, [
|
|
95
|
+
store,
|
|
96
|
+
windowFocusTimeout,
|
|
97
|
+
isEmpty
|
|
98
|
+
]);
|
|
99
|
+
__rspack_external_react.useEffect(()=>{
|
|
100
|
+
const viewport = store.state.viewport;
|
|
101
|
+
if (!viewport || isEmpty) return;
|
|
102
|
+
const doc = ownerDocument(viewport);
|
|
103
|
+
return addEventListener(doc, 'pointerdown', store.handleDocumentPointerDown, true);
|
|
104
|
+
}, [
|
|
105
|
+
isEmpty,
|
|
106
|
+
store
|
|
107
|
+
]);
|
|
108
|
+
function handleFocusGuard(event) {
|
|
109
|
+
const viewport = store.state.viewport;
|
|
110
|
+
if (!viewport) return;
|
|
111
|
+
handlingFocusGuardRef.current = true;
|
|
112
|
+
if (event.relatedTarget === viewport) toasts[0]?.ref?.current?.focus();
|
|
113
|
+
else store.restoreFocusToPrevElement();
|
|
114
|
+
}
|
|
115
|
+
function handleKeyDown(event) {
|
|
116
|
+
if ('Tab' === event.key && event.shiftKey && getTarget(event.nativeEvent) === store.state.viewport) {
|
|
117
|
+
event.preventDefault();
|
|
118
|
+
store.restoreFocusToPrevElement();
|
|
119
|
+
store.resumeTimers();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function flushMouseLeave() {
|
|
123
|
+
const hasEndingToasts = store.state.toasts.some((toast)=>'ending' === toast.transitionStatus);
|
|
124
|
+
if (!store.state.isWindowFocused || hasEndingToasts || touchActiveRef.current || !markedReadyForMouseLeaveRef.current) return;
|
|
125
|
+
store.resumeTimers();
|
|
126
|
+
store.setHovering(false);
|
|
127
|
+
markedReadyForMouseLeaveRef.current = false;
|
|
128
|
+
}
|
|
129
|
+
__rspack_external_react.useEffect(flushMouseLeave, [
|
|
130
|
+
hasTransitioningToasts,
|
|
131
|
+
store
|
|
132
|
+
]);
|
|
133
|
+
function handleMouseEnter() {
|
|
134
|
+
store.pauseTimers();
|
|
135
|
+
store.setHovering(true);
|
|
136
|
+
markedReadyForMouseLeaveRef.current = false;
|
|
137
|
+
}
|
|
138
|
+
function handleMouseLeave() {
|
|
139
|
+
if (hasTransitioningToasts || touchActiveRef.current) markedReadyForMouseLeaveRef.current = true;
|
|
140
|
+
else {
|
|
141
|
+
store.resumeTimers();
|
|
142
|
+
store.setHovering(false);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function handlePointerDown(event) {
|
|
146
|
+
if ('touch' === event.pointerType) touchActiveRef.current = true;
|
|
147
|
+
}
|
|
148
|
+
function handlePointerEnd(event) {
|
|
149
|
+
if ('touch' !== event.pointerType) return;
|
|
150
|
+
touchActiveRef.current = false;
|
|
151
|
+
flushMouseLeave();
|
|
152
|
+
}
|
|
153
|
+
function handleFocus() {
|
|
154
|
+
if (handlingFocusGuardRef.current) {
|
|
155
|
+
handlingFocusGuardRef.current = false;
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
if (focused) return;
|
|
159
|
+
if (matchesFocusVisible(activeElement(ownerDocument(store.state.viewport)))) {
|
|
160
|
+
store.setFocused(true);
|
|
161
|
+
store.pauseTimers();
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
function handleBlur(event) {
|
|
165
|
+
if (!focused || contains(store.state.viewport, event.relatedTarget)) return;
|
|
166
|
+
store.setFocused(false);
|
|
167
|
+
store.resumeTimers();
|
|
168
|
+
}
|
|
169
|
+
const defaultProps = {
|
|
170
|
+
tabIndex: -1,
|
|
171
|
+
role: 'region',
|
|
172
|
+
'aria-live': 'polite',
|
|
173
|
+
'aria-atomic': false,
|
|
174
|
+
'aria-relevant': 'additions text',
|
|
175
|
+
'aria-label': 'Notifications',
|
|
176
|
+
onMouseEnter: handleMouseEnter,
|
|
177
|
+
onMouseMove: handleMouseEnter,
|
|
178
|
+
onMouseLeave: handleMouseLeave,
|
|
179
|
+
onFocus: handleFocus,
|
|
180
|
+
onBlur: handleBlur,
|
|
181
|
+
onKeyDown: handleKeyDown,
|
|
182
|
+
onClick: handleFocus,
|
|
183
|
+
onPointerDown: handlePointerDown,
|
|
184
|
+
onPointerUp: handlePointerEnd,
|
|
185
|
+
onPointerCancel: handlePointerEnd
|
|
186
|
+
};
|
|
187
|
+
const state = {
|
|
188
|
+
expanded
|
|
189
|
+
};
|
|
190
|
+
const element = useRenderElement('div', componentProps, {
|
|
191
|
+
ref: [
|
|
192
|
+
forwardedRef,
|
|
193
|
+
store.setViewport
|
|
194
|
+
],
|
|
195
|
+
state,
|
|
196
|
+
props: [
|
|
197
|
+
defaultProps,
|
|
198
|
+
{
|
|
199
|
+
style: {
|
|
200
|
+
[ToastViewportCssVars_ToastViewportCssVars.frontmostHeight]: frontmostHeight ? `${frontmostHeight}px` : void 0
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
elementProps,
|
|
204
|
+
{
|
|
205
|
+
children: /*#__PURE__*/ jsxs(__rspack_external_react.Fragment, {
|
|
206
|
+
children: [
|
|
207
|
+
!isEmpty && prevFocusElement && /*#__PURE__*/ jsx(FocusGuard_FocusGuard, {
|
|
208
|
+
onFocus: handleFocusGuard
|
|
209
|
+
}),
|
|
210
|
+
children,
|
|
211
|
+
!isEmpty && prevFocusElement && /*#__PURE__*/ jsx(FocusGuard_FocusGuard, {
|
|
212
|
+
onFocus: handleFocusGuard
|
|
213
|
+
})
|
|
214
|
+
]
|
|
215
|
+
})
|
|
216
|
+
}
|
|
217
|
+
]
|
|
218
|
+
});
|
|
219
|
+
return /*#__PURE__*/ jsxs(__rspack_external_react.Fragment, {
|
|
220
|
+
children: [
|
|
221
|
+
!isEmpty && prevFocusElement && /*#__PURE__*/ jsx(FocusGuard_FocusGuard, {
|
|
222
|
+
onFocus: handleFocusGuard
|
|
223
|
+
}),
|
|
224
|
+
element,
|
|
225
|
+
!focused && highPriorityToasts.length > 0 && /*#__PURE__*/ jsx("div", {
|
|
226
|
+
style: visuallyHidden,
|
|
227
|
+
children: highPriorityToasts.map((toast)=>/*#__PURE__*/ jsxs("div", {
|
|
228
|
+
role: "alert",
|
|
229
|
+
"aria-atomic": true,
|
|
230
|
+
children: [
|
|
231
|
+
/*#__PURE__*/ jsx("div", {
|
|
232
|
+
children: toast.title
|
|
233
|
+
}),
|
|
234
|
+
/*#__PURE__*/ jsx("div", {
|
|
235
|
+
children: toast.description
|
|
236
|
+
})
|
|
237
|
+
]
|
|
238
|
+
}, toast.id))
|
|
239
|
+
})
|
|
240
|
+
]
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
if ("production" !== process.env.NODE_ENV) ToastViewport_ToastViewport.displayName = "ToastViewport";
|
|
244
|
+
const ToastRootContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
|
|
245
|
+
if ("production" !== process.env.NODE_ENV) ToastRootContext.displayName = "ToastRootContext";
|
|
246
|
+
function useToastRootContext() {
|
|
247
|
+
const context = __rspack_external_react.useContext(ToastRootContext);
|
|
248
|
+
if (!context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: ToastRootContext is missing. Toast parts must be used within <Toast.Root>.' : esm_formatErrorMessage(66));
|
|
249
|
+
return context;
|
|
250
|
+
}
|
|
251
|
+
let ToastRootCssVars_ToastRootCssVars = /*#__PURE__*/ function(ToastRootCssVars) {
|
|
252
|
+
ToastRootCssVars["index"] = "--toast-index";
|
|
253
|
+
ToastRootCssVars["offsetY"] = "--toast-offset-y";
|
|
254
|
+
ToastRootCssVars["height"] = "--toast-height";
|
|
255
|
+
ToastRootCssVars["swipeMovementX"] = "--toast-swipe-movement-x";
|
|
256
|
+
ToastRootCssVars["swipeMovementY"] = "--toast-swipe-movement-y";
|
|
257
|
+
return ToastRootCssVars;
|
|
258
|
+
}({});
|
|
259
|
+
const stateAttributesMapping = {
|
|
260
|
+
...transitionStatusMapping,
|
|
261
|
+
swipeDirection (value) {
|
|
262
|
+
return value ? {
|
|
263
|
+
'data-swipe-direction': value
|
|
264
|
+
} : null;
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
const SWIPE_THRESHOLD = 40;
|
|
268
|
+
const REVERSE_CANCEL_THRESHOLD = 10;
|
|
269
|
+
const OPPOSITE_DIRECTION_DAMPING_FACTOR = 0.5;
|
|
270
|
+
const MIN_DRAG_THRESHOLD = 1;
|
|
271
|
+
const TOAST_SWIPE_IGNORE_SELECTOR = `${BASE_UI_SWIPE_IGNORE_SELECTOR},${LEGACY_SWIPE_IGNORE_SELECTOR}`;
|
|
272
|
+
const ToastRoot_ToastRoot = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
273
|
+
const { toast, render, className, swipeDirection = [
|
|
274
|
+
'down',
|
|
275
|
+
'right'
|
|
276
|
+
], style, ...elementProps } = componentProps;
|
|
277
|
+
const isAnchored = toast.positionerProps?.anchor !== void 0;
|
|
278
|
+
let swipeDirections = [];
|
|
279
|
+
if (!isAnchored) swipeDirections = Array.isArray(swipeDirection) ? swipeDirection : [
|
|
280
|
+
swipeDirection
|
|
281
|
+
];
|
|
282
|
+
const swipeEnabled = swipeDirections.length > 0;
|
|
283
|
+
const store = useToastProviderContext();
|
|
284
|
+
const [currentSwipeDirection, setCurrentSwipeDirection] = __rspack_external_react.useState(void 0);
|
|
285
|
+
const [isSwiping, setIsSwiping] = __rspack_external_react.useState(false);
|
|
286
|
+
const [isRealSwipe, setIsRealSwipe] = __rspack_external_react.useState(false);
|
|
287
|
+
const [dragDismissed, setDragDismissed] = __rspack_external_react.useState(false);
|
|
288
|
+
const [dragOffset, setDragOffset] = __rspack_external_react.useState({
|
|
289
|
+
x: 0,
|
|
290
|
+
y: 0
|
|
291
|
+
});
|
|
292
|
+
const [initialTransform, setInitialTransform] = __rspack_external_react.useState({
|
|
293
|
+
x: 0,
|
|
294
|
+
y: 0,
|
|
295
|
+
scale: 1
|
|
296
|
+
});
|
|
297
|
+
const [titleId, setTitleId] = __rspack_external_react.useState();
|
|
298
|
+
const [descriptionId, setDescriptionId] = __rspack_external_react.useState();
|
|
299
|
+
const [lockedDirection, setLockedDirection] = __rspack_external_react.useState(null);
|
|
300
|
+
const rootRef = __rspack_external_react.useRef(null);
|
|
301
|
+
const dragStartPosRef = __rspack_external_react.useRef({
|
|
302
|
+
x: 0,
|
|
303
|
+
y: 0
|
|
304
|
+
});
|
|
305
|
+
const initialTransformRef = __rspack_external_react.useRef({
|
|
306
|
+
x: 0,
|
|
307
|
+
y: 0,
|
|
308
|
+
scale: 1
|
|
309
|
+
});
|
|
310
|
+
const intendedSwipeDirectionRef = __rspack_external_react.useRef(void 0);
|
|
311
|
+
const maxSwipeDisplacementRef = __rspack_external_react.useRef(0);
|
|
312
|
+
const cancelledSwipeRef = __rspack_external_react.useRef(false);
|
|
313
|
+
const swipeCancelBaselineRef = __rspack_external_react.useRef({
|
|
314
|
+
x: 0,
|
|
315
|
+
y: 0
|
|
316
|
+
});
|
|
317
|
+
const isFirstPointerMoveRef = __rspack_external_react.useRef(false);
|
|
318
|
+
const dragOffsetRef = __rspack_external_react.useRef({
|
|
319
|
+
x: 0,
|
|
320
|
+
y: 0
|
|
321
|
+
});
|
|
322
|
+
const activePointerIdRef = __rspack_external_react.useRef(null);
|
|
323
|
+
const dragAbortControllerRef = __rspack_external_react.useRef(null);
|
|
324
|
+
const domIndex = store.useState('toastIndex', toast.id);
|
|
325
|
+
const visibleIndex = store.useState('toastVisibleIndex', toast.id);
|
|
326
|
+
const offsetY = store.useState('toastOffsetY', toast.id);
|
|
327
|
+
const focused = store.useState('focused');
|
|
328
|
+
const expanded = store.useState('expanded');
|
|
329
|
+
useOpenChangeComplete({
|
|
330
|
+
open: 'ending' !== toast.transitionStatus,
|
|
331
|
+
ref: rootRef,
|
|
332
|
+
onComplete () {
|
|
333
|
+
if ('ending' === toast.transitionStatus) store.removeToast(toast.id);
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
const recalculateHeight = useStableCallback((flushSync = false)=>{
|
|
337
|
+
const element = rootRef.current;
|
|
338
|
+
if (!element) return;
|
|
339
|
+
const previousHeight = element.style.height;
|
|
340
|
+
element.style.height = 'auto';
|
|
341
|
+
const height = element.offsetHeight;
|
|
342
|
+
element.style.height = previousHeight;
|
|
343
|
+
function update() {
|
|
344
|
+
store.updateToastInternal(toast.id, {
|
|
345
|
+
ref: rootRef,
|
|
346
|
+
height,
|
|
347
|
+
...'starting' === toast.transitionStatus ? {
|
|
348
|
+
transitionStatus: void 0
|
|
349
|
+
} : {}
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
if (flushSync) __rspack_external_react_dom_7136dc57.flushSync(update);
|
|
353
|
+
else update();
|
|
354
|
+
});
|
|
355
|
+
useIsoLayoutEffect(recalculateHeight, [
|
|
356
|
+
recalculateHeight
|
|
357
|
+
]);
|
|
358
|
+
function setResolvedDragOffset(nextDragOffset) {
|
|
359
|
+
dragOffsetRef.current = nextDragOffset;
|
|
360
|
+
setDragOffset(nextDragOffset);
|
|
361
|
+
}
|
|
362
|
+
useIsoLayoutEffect(()=>()=>{
|
|
363
|
+
dragAbortControllerRef.current?.abort();
|
|
364
|
+
}, []);
|
|
365
|
+
function applyDirectionalDamping(deltaX, deltaY) {
|
|
366
|
+
let newDeltaX = deltaX;
|
|
367
|
+
let newDeltaY = deltaY;
|
|
368
|
+
if (swipeDirections.includes('left') || swipeDirections.includes('right')) {
|
|
369
|
+
if (!swipeDirections.includes('right') && deltaX > 0) newDeltaX = deltaX ** OPPOSITE_DIRECTION_DAMPING_FACTOR;
|
|
370
|
+
if (!swipeDirections.includes('left') && deltaX < 0) newDeltaX = -(Math.abs(deltaX) ** OPPOSITE_DIRECTION_DAMPING_FACTOR);
|
|
371
|
+
} else newDeltaX = deltaX > 0 ? deltaX ** OPPOSITE_DIRECTION_DAMPING_FACTOR : -(Math.abs(deltaX) ** OPPOSITE_DIRECTION_DAMPING_FACTOR);
|
|
372
|
+
if (swipeDirections.includes('up') || swipeDirections.includes('down')) {
|
|
373
|
+
if (!swipeDirections.includes('down') && deltaY > 0) newDeltaY = deltaY ** OPPOSITE_DIRECTION_DAMPING_FACTOR;
|
|
374
|
+
if (!swipeDirections.includes('up') && deltaY < 0) newDeltaY = -(Math.abs(deltaY) ** OPPOSITE_DIRECTION_DAMPING_FACTOR);
|
|
375
|
+
} else newDeltaY = deltaY > 0 ? deltaY ** OPPOSITE_DIRECTION_DAMPING_FACTOR : -(Math.abs(deltaY) ** OPPOSITE_DIRECTION_DAMPING_FACTOR);
|
|
376
|
+
return {
|
|
377
|
+
x: newDeltaX,
|
|
378
|
+
y: newDeltaY
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
const handleSwipeEnd = useStableCallback((event)=>{
|
|
382
|
+
if (event.pointerId !== activePointerIdRef.current) return;
|
|
383
|
+
activePointerIdRef.current = null;
|
|
384
|
+
dragAbortControllerRef.current?.abort();
|
|
385
|
+
dragAbortControllerRef.current = null;
|
|
386
|
+
setIsSwiping(false);
|
|
387
|
+
setIsRealSwipe(false);
|
|
388
|
+
setLockedDirection(null);
|
|
389
|
+
const resolvedInitialTransform = initialTransformRef.current;
|
|
390
|
+
if ('pointercancel' === event.type || cancelledSwipeRef.current) {
|
|
391
|
+
setResolvedDragOffset({
|
|
392
|
+
x: resolvedInitialTransform.x,
|
|
393
|
+
y: resolvedInitialTransform.y
|
|
394
|
+
});
|
|
395
|
+
setCurrentSwipeDirection(void 0);
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
let shouldClose = false;
|
|
399
|
+
const resolvedDragOffset = dragOffsetRef.current;
|
|
400
|
+
const deltaX = resolvedDragOffset.x - resolvedInitialTransform.x;
|
|
401
|
+
const deltaY = resolvedDragOffset.y - resolvedInitialTransform.y;
|
|
402
|
+
let dismissDirection;
|
|
403
|
+
for (const direction of swipeDirections){
|
|
404
|
+
switch(direction){
|
|
405
|
+
case 'right':
|
|
406
|
+
if (deltaX > SWIPE_THRESHOLD) {
|
|
407
|
+
shouldClose = true;
|
|
408
|
+
dismissDirection = 'right';
|
|
409
|
+
}
|
|
410
|
+
break;
|
|
411
|
+
case 'left':
|
|
412
|
+
if (deltaX < -SWIPE_THRESHOLD) {
|
|
413
|
+
shouldClose = true;
|
|
414
|
+
dismissDirection = 'left';
|
|
415
|
+
}
|
|
416
|
+
break;
|
|
417
|
+
case 'down':
|
|
418
|
+
if (deltaY > SWIPE_THRESHOLD) {
|
|
419
|
+
shouldClose = true;
|
|
420
|
+
dismissDirection = 'down';
|
|
421
|
+
}
|
|
422
|
+
break;
|
|
423
|
+
case 'up':
|
|
424
|
+
if (deltaY < -SWIPE_THRESHOLD) {
|
|
425
|
+
shouldClose = true;
|
|
426
|
+
dismissDirection = 'up';
|
|
427
|
+
}
|
|
428
|
+
break;
|
|
429
|
+
default:
|
|
430
|
+
break;
|
|
431
|
+
}
|
|
432
|
+
if (shouldClose) break;
|
|
433
|
+
}
|
|
434
|
+
if (shouldClose) {
|
|
435
|
+
setCurrentSwipeDirection(dismissDirection);
|
|
436
|
+
setDragDismissed(true);
|
|
437
|
+
store.closeToast(toast.id);
|
|
438
|
+
} else {
|
|
439
|
+
setResolvedDragOffset({
|
|
440
|
+
x: resolvedInitialTransform.x,
|
|
441
|
+
y: resolvedInitialTransform.y
|
|
442
|
+
});
|
|
443
|
+
setCurrentSwipeDirection(void 0);
|
|
444
|
+
}
|
|
445
|
+
});
|
|
446
|
+
function handlePointerDown(event) {
|
|
447
|
+
if (0 !== event.button) return;
|
|
448
|
+
if ('touch' === event.pointerType) store.pauseTimers();
|
|
449
|
+
const target = getTarget(event.nativeEvent);
|
|
450
|
+
const isInteractiveElement = target ? target.closest(`button,a,input,textarea,[role="button"],${TOAST_SWIPE_IGNORE_SELECTOR}`) : false;
|
|
451
|
+
if (isInteractiveElement) return;
|
|
452
|
+
cancelledSwipeRef.current = false;
|
|
453
|
+
intendedSwipeDirectionRef.current = void 0;
|
|
454
|
+
maxSwipeDisplacementRef.current = 0;
|
|
455
|
+
activePointerIdRef.current = event.pointerId;
|
|
456
|
+
dragStartPosRef.current = {
|
|
457
|
+
x: event.clientX,
|
|
458
|
+
y: event.clientY
|
|
459
|
+
};
|
|
460
|
+
swipeCancelBaselineRef.current = dragStartPosRef.current;
|
|
461
|
+
if (rootRef.current) {
|
|
462
|
+
const transform = getElementTransform(rootRef.current);
|
|
463
|
+
initialTransformRef.current = transform;
|
|
464
|
+
setInitialTransform(transform);
|
|
465
|
+
setResolvedDragOffset({
|
|
466
|
+
x: transform.x,
|
|
467
|
+
y: transform.y
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
store.setHovering(true);
|
|
471
|
+
setIsSwiping(true);
|
|
472
|
+
setIsRealSwipe(false);
|
|
473
|
+
setLockedDirection(null);
|
|
474
|
+
isFirstPointerMoveRef.current = true;
|
|
475
|
+
const element = rootRef.current;
|
|
476
|
+
if (element) {
|
|
477
|
+
dragAbortControllerRef.current?.abort();
|
|
478
|
+
const dragAbortController = new AbortController();
|
|
479
|
+
dragAbortControllerRef.current = dragAbortController;
|
|
480
|
+
const doc = ownerDocument(element);
|
|
481
|
+
doc.addEventListener('pointerup', handleSwipeEnd, {
|
|
482
|
+
signal: dragAbortController.signal
|
|
483
|
+
});
|
|
484
|
+
doc.addEventListener('pointercancel', handleSwipeEnd, {
|
|
485
|
+
signal: dragAbortController.signal
|
|
486
|
+
});
|
|
487
|
+
element.setPointerCapture?.(event.pointerId);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
function handlePointerMove(event) {
|
|
491
|
+
if (event.pointerId !== activePointerIdRef.current) return;
|
|
492
|
+
event.preventDefault();
|
|
493
|
+
if (isFirstPointerMoveRef.current) {
|
|
494
|
+
dragStartPosRef.current = {
|
|
495
|
+
x: event.clientX,
|
|
496
|
+
y: event.clientY
|
|
497
|
+
};
|
|
498
|
+
isFirstPointerMoveRef.current = false;
|
|
499
|
+
}
|
|
500
|
+
const { clientY, clientX, movementX, movementY } = event;
|
|
501
|
+
if (movementY < 0 && clientY > swipeCancelBaselineRef.current.y || movementY > 0 && clientY < swipeCancelBaselineRef.current.y) swipeCancelBaselineRef.current = {
|
|
502
|
+
x: swipeCancelBaselineRef.current.x,
|
|
503
|
+
y: clientY
|
|
504
|
+
};
|
|
505
|
+
if (movementX < 0 && clientX > swipeCancelBaselineRef.current.x || movementX > 0 && clientX < swipeCancelBaselineRef.current.x) swipeCancelBaselineRef.current = {
|
|
506
|
+
x: clientX,
|
|
507
|
+
y: swipeCancelBaselineRef.current.y
|
|
508
|
+
};
|
|
509
|
+
const deltaX = clientX - dragStartPosRef.current.x;
|
|
510
|
+
const deltaY = clientY - dragStartPosRef.current.y;
|
|
511
|
+
const cancelDeltaY = clientY - swipeCancelBaselineRef.current.y;
|
|
512
|
+
const cancelDeltaX = clientX - swipeCancelBaselineRef.current.x;
|
|
513
|
+
if (!isRealSwipe) {
|
|
514
|
+
const movementDistance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
|
|
515
|
+
if (movementDistance >= MIN_DRAG_THRESHOLD) {
|
|
516
|
+
setIsRealSwipe(true);
|
|
517
|
+
if (null === lockedDirection) {
|
|
518
|
+
const hasHorizontal = swipeDirections.includes('left') || swipeDirections.includes('right');
|
|
519
|
+
const hasVertical = swipeDirections.includes('up') || swipeDirections.includes('down');
|
|
520
|
+
if (hasHorizontal && hasVertical) {
|
|
521
|
+
const absX = Math.abs(deltaX);
|
|
522
|
+
const absY = Math.abs(deltaY);
|
|
523
|
+
setLockedDirection(absX > absY ? 'horizontal' : 'vertical');
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
let candidate;
|
|
529
|
+
if (intendedSwipeDirectionRef.current) {
|
|
530
|
+
const direction = intendedSwipeDirectionRef.current;
|
|
531
|
+
const currentDisplacement = getDisplacement(direction, cancelDeltaX, cancelDeltaY);
|
|
532
|
+
if (currentDisplacement > SWIPE_THRESHOLD) {
|
|
533
|
+
cancelledSwipeRef.current = false;
|
|
534
|
+
setCurrentSwipeDirection(direction);
|
|
535
|
+
} else if (!(swipeDirections.includes('left') && swipeDirections.includes('right')) && !(swipeDirections.includes('up') && swipeDirections.includes('down')) && maxSwipeDisplacementRef.current - currentDisplacement >= REVERSE_CANCEL_THRESHOLD) cancelledSwipeRef.current = true;
|
|
536
|
+
} else {
|
|
537
|
+
if ('vertical' === lockedDirection) {
|
|
538
|
+
if (deltaY > 0) candidate = 'down';
|
|
539
|
+
else if (deltaY < 0) candidate = 'up';
|
|
540
|
+
} else if ('horizontal' === lockedDirection) {
|
|
541
|
+
if (deltaX > 0) candidate = 'right';
|
|
542
|
+
else if (deltaX < 0) candidate = 'left';
|
|
543
|
+
} else candidate = Math.abs(deltaX) >= Math.abs(deltaY) ? deltaX > 0 ? 'right' : 'left' : deltaY > 0 ? 'down' : 'up';
|
|
544
|
+
if (candidate && swipeDirections.includes(candidate)) {
|
|
545
|
+
intendedSwipeDirectionRef.current = candidate;
|
|
546
|
+
maxSwipeDisplacementRef.current = getDisplacement(candidate, deltaX, deltaY);
|
|
547
|
+
setCurrentSwipeDirection(candidate);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
const dampedDelta = applyDirectionalDamping(deltaX, deltaY);
|
|
551
|
+
let newOffsetX = initialTransformRef.current.x;
|
|
552
|
+
let newOffsetY = initialTransformRef.current.y;
|
|
553
|
+
if ('horizontal' === lockedDirection) {
|
|
554
|
+
if (swipeDirections.includes('left') || swipeDirections.includes('right')) newOffsetX += dampedDelta.x;
|
|
555
|
+
} else if ('vertical' === lockedDirection) {
|
|
556
|
+
if (swipeDirections.includes('up') || swipeDirections.includes('down')) newOffsetY += dampedDelta.y;
|
|
557
|
+
} else {
|
|
558
|
+
if (swipeDirections.includes('left') || swipeDirections.includes('right')) newOffsetX += dampedDelta.x;
|
|
559
|
+
if (swipeDirections.includes('up') || swipeDirections.includes('down')) newOffsetY += dampedDelta.y;
|
|
560
|
+
}
|
|
561
|
+
setResolvedDragOffset({
|
|
562
|
+
x: newOffsetX,
|
|
563
|
+
y: newOffsetY
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
function handleKeyDown(event) {
|
|
567
|
+
if ('Escape' === event.key) {
|
|
568
|
+
if (!rootRef.current || !contains(rootRef.current, activeElement(ownerDocument(rootRef.current)))) return;
|
|
569
|
+
store.closeToast(toast.id);
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
__rspack_external_react.useEffect(()=>{
|
|
573
|
+
if (!swipeEnabled) return;
|
|
574
|
+
const element = rootRef.current;
|
|
575
|
+
if (!element) return;
|
|
576
|
+
function preventDefaultTouchStart(event) {
|
|
577
|
+
if (contains(element, getTarget(event))) event.preventDefault();
|
|
578
|
+
}
|
|
579
|
+
return addEventListener(element, 'touchmove', preventDefaultTouchStart, {
|
|
580
|
+
passive: false
|
|
581
|
+
});
|
|
582
|
+
}, [
|
|
583
|
+
swipeEnabled
|
|
584
|
+
]);
|
|
585
|
+
function getDragStyles() {
|
|
586
|
+
if (!isSwiping && dragOffset.x === initialTransform.x && dragOffset.y === initialTransform.y && !dragDismissed) return {
|
|
587
|
+
[ToastRootCssVars_ToastRootCssVars.swipeMovementX]: '0px',
|
|
588
|
+
[ToastRootCssVars_ToastRootCssVars.swipeMovementY]: '0px'
|
|
589
|
+
};
|
|
590
|
+
const deltaX = dragOffset.x - initialTransform.x;
|
|
591
|
+
const deltaY = dragOffset.y - initialTransform.y;
|
|
592
|
+
return {
|
|
593
|
+
transition: isSwiping ? 'none' : void 0,
|
|
594
|
+
transform: isSwiping ? `translateX(${dragOffset.x}px) translateY(${dragOffset.y}px) scale(${initialTransform.scale})` : void 0,
|
|
595
|
+
[ToastRootCssVars_ToastRootCssVars.swipeMovementX]: `${deltaX}px`,
|
|
596
|
+
[ToastRootCssVars_ToastRootCssVars.swipeMovementY]: `${deltaY}px`
|
|
597
|
+
};
|
|
598
|
+
}
|
|
599
|
+
const isHighPriority = 'high' === toast.priority;
|
|
600
|
+
const defaultProps = {
|
|
601
|
+
role: isHighPriority ? 'alertdialog' : 'dialog',
|
|
602
|
+
tabIndex: 0,
|
|
603
|
+
'aria-modal': false,
|
|
604
|
+
'aria-labelledby': titleId,
|
|
605
|
+
'aria-describedby': descriptionId,
|
|
606
|
+
'aria-hidden': isHighPriority && !focused ? true : void 0,
|
|
607
|
+
onPointerDown: swipeEnabled ? handlePointerDown : void 0,
|
|
608
|
+
onPointerMove: swipeEnabled ? handlePointerMove : void 0,
|
|
609
|
+
onPointerUp: swipeEnabled ? handleSwipeEnd : void 0,
|
|
610
|
+
onPointerCancel: swipeEnabled ? handleSwipeEnd : void 0,
|
|
611
|
+
onKeyDown: handleKeyDown,
|
|
612
|
+
inert: inertValue(toast.limited),
|
|
613
|
+
style: {
|
|
614
|
+
...getDragStyles(),
|
|
615
|
+
[ToastRootCssVars_ToastRootCssVars.index]: 'ending' === toast.transitionStatus ? domIndex : visibleIndex,
|
|
616
|
+
[ToastRootCssVars_ToastRootCssVars.offsetY]: `${offsetY}px`,
|
|
617
|
+
[ToastRootCssVars_ToastRootCssVars.height]: toast.height ? `${toast.height}px` : void 0
|
|
618
|
+
}
|
|
619
|
+
};
|
|
620
|
+
const toastRoot = __rspack_external_react.useMemo(()=>({
|
|
621
|
+
rootRef,
|
|
622
|
+
toast,
|
|
623
|
+
titleId,
|
|
624
|
+
setTitleId,
|
|
625
|
+
descriptionId,
|
|
626
|
+
setDescriptionId,
|
|
627
|
+
swiping: isSwiping,
|
|
628
|
+
swipeDirection: currentSwipeDirection,
|
|
629
|
+
recalculateHeight,
|
|
630
|
+
index: domIndex,
|
|
631
|
+
visibleIndex,
|
|
632
|
+
expanded
|
|
633
|
+
}), [
|
|
634
|
+
toast,
|
|
635
|
+
titleId,
|
|
636
|
+
descriptionId,
|
|
637
|
+
isSwiping,
|
|
638
|
+
currentSwipeDirection,
|
|
639
|
+
recalculateHeight,
|
|
640
|
+
domIndex,
|
|
641
|
+
visibleIndex,
|
|
642
|
+
expanded
|
|
643
|
+
]);
|
|
644
|
+
const state = {
|
|
645
|
+
transitionStatus: toast.transitionStatus,
|
|
646
|
+
expanded,
|
|
647
|
+
limited: toast.limited || false,
|
|
648
|
+
type: toast.type,
|
|
649
|
+
swiping: toastRoot.swiping,
|
|
650
|
+
swipeDirection: toastRoot.swipeDirection
|
|
651
|
+
};
|
|
652
|
+
const element = useRenderElement('div', componentProps, {
|
|
653
|
+
ref: [
|
|
654
|
+
forwardedRef,
|
|
655
|
+
toastRoot.rootRef
|
|
656
|
+
],
|
|
657
|
+
state,
|
|
658
|
+
stateAttributesMapping: stateAttributesMapping,
|
|
659
|
+
props: [
|
|
660
|
+
defaultProps,
|
|
661
|
+
elementProps
|
|
662
|
+
]
|
|
663
|
+
});
|
|
664
|
+
return /*#__PURE__*/ jsx(ToastRootContext.Provider, {
|
|
665
|
+
value: toastRoot,
|
|
666
|
+
children: element
|
|
667
|
+
});
|
|
668
|
+
});
|
|
669
|
+
if ("production" !== process.env.NODE_ENV) ToastRoot_ToastRoot.displayName = "ToastRoot";
|
|
670
|
+
const ToastTitle_ToastTitle = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
671
|
+
const { render, className, style, id: idProp, children: childrenProp, ...elementProps } = componentProps;
|
|
672
|
+
const { toast, setTitleId } = useToastRootContext();
|
|
673
|
+
const children = childrenProp ?? toast.title;
|
|
674
|
+
const shouldRender = Boolean(children);
|
|
675
|
+
const id = useId(idProp);
|
|
676
|
+
useIsoLayoutEffect(()=>{
|
|
677
|
+
if (!shouldRender) return;
|
|
678
|
+
setTitleId(id);
|
|
679
|
+
return ()=>{
|
|
680
|
+
setTitleId(void 0);
|
|
681
|
+
};
|
|
682
|
+
}, [
|
|
683
|
+
shouldRender,
|
|
684
|
+
id,
|
|
685
|
+
setTitleId
|
|
686
|
+
]);
|
|
687
|
+
const state = {
|
|
688
|
+
type: toast.type
|
|
689
|
+
};
|
|
690
|
+
const element = useRenderElement('h2', componentProps, {
|
|
691
|
+
ref: forwardedRef,
|
|
692
|
+
state,
|
|
693
|
+
props: {
|
|
694
|
+
...elementProps,
|
|
695
|
+
id,
|
|
696
|
+
children
|
|
697
|
+
}
|
|
698
|
+
});
|
|
699
|
+
if (!shouldRender) return null;
|
|
700
|
+
return element;
|
|
701
|
+
});
|
|
702
|
+
if ("production" !== process.env.NODE_ENV) ToastTitle_ToastTitle.displayName = "ToastTitle";
|
|
703
|
+
const ToastClose_ToastClose = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
704
|
+
const { render, className, style, disabled, nativeButton = true, ...elementProps } = componentProps;
|
|
705
|
+
const store = useToastProviderContext();
|
|
706
|
+
const { toast } = useToastRootContext();
|
|
707
|
+
const expanded = store.useState('expanded');
|
|
708
|
+
const [hasFocus, setHasFocus] = __rspack_external_react.useState(false);
|
|
709
|
+
const { getButtonProps, buttonRef } = useButton({
|
|
710
|
+
disabled,
|
|
711
|
+
native: nativeButton
|
|
712
|
+
});
|
|
713
|
+
const state = {
|
|
714
|
+
type: toast.type
|
|
715
|
+
};
|
|
716
|
+
const element = useRenderElement('button', componentProps, {
|
|
717
|
+
ref: [
|
|
718
|
+
forwardedRef,
|
|
719
|
+
buttonRef
|
|
720
|
+
],
|
|
721
|
+
state,
|
|
722
|
+
props: [
|
|
723
|
+
{
|
|
724
|
+
'aria-hidden': !expanded && !hasFocus,
|
|
725
|
+
onClick () {
|
|
726
|
+
store.closeToast(toast.id);
|
|
727
|
+
},
|
|
728
|
+
onFocus () {
|
|
729
|
+
setHasFocus(true);
|
|
730
|
+
},
|
|
731
|
+
onBlur () {
|
|
732
|
+
setHasFocus(false);
|
|
733
|
+
}
|
|
734
|
+
},
|
|
735
|
+
elementProps,
|
|
736
|
+
getButtonProps
|
|
737
|
+
]
|
|
738
|
+
});
|
|
739
|
+
return element;
|
|
740
|
+
});
|
|
741
|
+
if ("production" !== process.env.NODE_ENV) ToastClose_ToastClose.displayName = "ToastClose";
|
|
742
|
+
let counter = 0;
|
|
743
|
+
function generateId(prefix) {
|
|
744
|
+
counter += 1;
|
|
745
|
+
return `${prefix}-${Math.random().toString(36).slice(2, 6)}-${counter}`;
|
|
746
|
+
}
|
|
747
|
+
function resolvePromiseOptions(options, result) {
|
|
748
|
+
if ('string' == typeof options) return {
|
|
749
|
+
description: options
|
|
750
|
+
};
|
|
751
|
+
if ('function' == typeof options) {
|
|
752
|
+
const resolvedOptions = options(result);
|
|
753
|
+
return 'string' == typeof resolvedOptions ? {
|
|
754
|
+
description: resolvedOptions
|
|
755
|
+
} : resolvedOptions;
|
|
756
|
+
}
|
|
757
|
+
return options;
|
|
758
|
+
}
|
|
759
|
+
function createToastMetadata(toasts) {
|
|
760
|
+
const metadata = new Map();
|
|
761
|
+
let visibleIndex = 0;
|
|
762
|
+
let offsetY = 0;
|
|
763
|
+
toasts.forEach((toast, toastIndex)=>{
|
|
764
|
+
const isEnding = 'ending' === toast.transitionStatus;
|
|
765
|
+
metadata.set(toast.id, {
|
|
766
|
+
value: toast,
|
|
767
|
+
domIndex: toastIndex,
|
|
768
|
+
visibleIndex: isEnding ? -1 : visibleIndex,
|
|
769
|
+
offsetY
|
|
770
|
+
});
|
|
771
|
+
offsetY += toast.height || 0;
|
|
772
|
+
if (!isEnding) visibleIndex += 1;
|
|
773
|
+
});
|
|
774
|
+
return metadata;
|
|
775
|
+
}
|
|
776
|
+
const toastMetadataSelector = (state)=>state.toastMetadata;
|
|
777
|
+
const selectors = {
|
|
778
|
+
toasts: createSelector((state)=>state.toasts),
|
|
779
|
+
isEmpty: createSelector((state)=>0 === state.toasts.length),
|
|
780
|
+
toast: createSelector(toastMetadataSelector, (toastMetadata, id)=>toastMetadata.get(id)?.value),
|
|
781
|
+
toastIndex: createSelector(toastMetadataSelector, (toastMetadata, id)=>toastMetadata.get(id)?.domIndex ?? -1),
|
|
782
|
+
toastOffsetY: createSelector(toastMetadataSelector, (toastMetadata, id)=>toastMetadata.get(id)?.offsetY ?? 0),
|
|
783
|
+
toastVisibleIndex: createSelector(toastMetadataSelector, (toastMetadata, id)=>toastMetadata.get(id)?.visibleIndex ?? -1),
|
|
784
|
+
hovering: createSelector((state)=>state.hovering),
|
|
785
|
+
focused: createSelector((state)=>state.focused),
|
|
786
|
+
expanded: createSelector((state)=>state.hovering || state.focused),
|
|
787
|
+
expandedOrOutOfFocus: createSelector((state)=>state.hovering || state.focused || !state.isWindowFocused),
|
|
788
|
+
prevFocusElement: createSelector((state)=>state.prevFocusElement)
|
|
789
|
+
};
|
|
790
|
+
class ToastStore extends ReactStore {
|
|
791
|
+
timers = new Map();
|
|
792
|
+
areTimersPaused = false;
|
|
793
|
+
constructor(initialState){
|
|
794
|
+
super({
|
|
795
|
+
...initialState,
|
|
796
|
+
toastMetadata: createToastMetadata(initialState.toasts)
|
|
797
|
+
}, {}, selectors);
|
|
798
|
+
}
|
|
799
|
+
setFocused(focused) {
|
|
800
|
+
this.set('focused', focused);
|
|
801
|
+
}
|
|
802
|
+
setHovering(hovering) {
|
|
803
|
+
this.set('hovering', hovering);
|
|
804
|
+
}
|
|
805
|
+
setIsWindowFocused(isWindowFocused) {
|
|
806
|
+
this.set('isWindowFocused', isWindowFocused);
|
|
807
|
+
}
|
|
808
|
+
setPrevFocusElement(prevFocusElement) {
|
|
809
|
+
this.set('prevFocusElement', prevFocusElement);
|
|
810
|
+
}
|
|
811
|
+
setViewport = (viewport)=>{
|
|
812
|
+
this.set('viewport', viewport);
|
|
813
|
+
};
|
|
814
|
+
disposeEffect = ()=>()=>{
|
|
815
|
+
this.timers.forEach((timer)=>{
|
|
816
|
+
timer.timeout?.clear();
|
|
817
|
+
});
|
|
818
|
+
this.timers.clear();
|
|
819
|
+
};
|
|
820
|
+
removeToast(toastId, behavior = {}) {
|
|
821
|
+
const index = selectors.toastIndex(this.state, toastId);
|
|
822
|
+
if (-1 === index) return;
|
|
823
|
+
const toast = this.state.toasts[index];
|
|
824
|
+
if (!behavior.skipOnRemove) toast?.onRemove?.();
|
|
825
|
+
const newToasts = [
|
|
826
|
+
...this.state.toasts
|
|
827
|
+
];
|
|
828
|
+
newToasts.splice(index, 1);
|
|
829
|
+
this.setToasts(newToasts);
|
|
830
|
+
}
|
|
831
|
+
addToast = (toast)=>{
|
|
832
|
+
const { timeout, limit } = this.state;
|
|
833
|
+
const id = toast.id || generateId('toast');
|
|
834
|
+
if (toast.id) {
|
|
835
|
+
const existingToast = selectors.toast(this.state, toast.id);
|
|
836
|
+
if (existingToast) if ('ending' === existingToast.transitionStatus) this.removeToast(toast.id, {
|
|
837
|
+
skipOnRemove: true
|
|
838
|
+
});
|
|
839
|
+
else {
|
|
840
|
+
const { id: ignoredId, transitionStatus: ignoredTransitionStatus, ...updates } = toast;
|
|
841
|
+
this.updateToastInternal(toast.id, updates, {
|
|
842
|
+
resetTimer: true,
|
|
843
|
+
markUpdated: true
|
|
844
|
+
});
|
|
845
|
+
return toast.id;
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
const toastToAdd = {
|
|
849
|
+
...toast,
|
|
850
|
+
id,
|
|
851
|
+
updateKey: 0,
|
|
852
|
+
transitionStatus: 'starting'
|
|
853
|
+
};
|
|
854
|
+
const updatedToasts = [
|
|
855
|
+
toastToAdd,
|
|
856
|
+
...this.state.toasts
|
|
857
|
+
];
|
|
858
|
+
const activeToasts = updatedToasts.filter((t)=>'ending' !== t.transitionStatus);
|
|
859
|
+
if (activeToasts.length > limit) {
|
|
860
|
+
const excessCount = activeToasts.length - limit;
|
|
861
|
+
const oldestActiveToasts = activeToasts.slice(-excessCount);
|
|
862
|
+
const limitedIds = new Set(oldestActiveToasts.map((t)=>t.id));
|
|
863
|
+
this.setToasts(updatedToasts.map((t)=>{
|
|
864
|
+
const limited = limitedIds.has(t.id);
|
|
865
|
+
if (t.limited !== limited) return {
|
|
866
|
+
...t,
|
|
867
|
+
limited
|
|
868
|
+
};
|
|
869
|
+
return t;
|
|
870
|
+
}));
|
|
871
|
+
} else this.setToasts(updatedToasts.map((t)=>t.limited ? {
|
|
872
|
+
...t,
|
|
873
|
+
limited: false
|
|
874
|
+
} : t));
|
|
875
|
+
const duration = toastToAdd.timeout ?? timeout;
|
|
876
|
+
if ('loading' !== toastToAdd.type && duration > 0) this.scheduleTimer(id, duration, ()=>this.closeToast(id));
|
|
877
|
+
if (selectors.expandedOrOutOfFocus(this.state)) this.pauseTimers();
|
|
878
|
+
return id;
|
|
879
|
+
};
|
|
880
|
+
updateToast = (id, updates)=>{
|
|
881
|
+
this.updateToastInternal(id, updates, {
|
|
882
|
+
markUpdated: true
|
|
883
|
+
});
|
|
884
|
+
};
|
|
885
|
+
updateToastInternal = (id, updates, behavior = {})=>{
|
|
886
|
+
const { timeout, toasts } = this.state;
|
|
887
|
+
const prevToast = selectors.toast(this.state, id) ?? null;
|
|
888
|
+
if (!prevToast) return;
|
|
889
|
+
if ('ending' === prevToast.transitionStatus) return;
|
|
890
|
+
const nextToast = {
|
|
891
|
+
...prevToast,
|
|
892
|
+
...updates,
|
|
893
|
+
...behavior.markUpdated && {
|
|
894
|
+
updateKey: (prevToast.updateKey ?? 0) + 1
|
|
895
|
+
}
|
|
896
|
+
};
|
|
897
|
+
this.setToasts(toasts.map((toast)=>toast.id === id ? nextToast : toast));
|
|
898
|
+
const nextTimeout = nextToast.timeout ?? timeout;
|
|
899
|
+
const prevTimeout = prevToast?.timeout ?? timeout;
|
|
900
|
+
const timeoutUpdated = Object.hasOwn(updates, 'timeout');
|
|
901
|
+
const shouldHaveTimer = 'ending' !== nextToast.transitionStatus && 'loading' !== nextToast.type && nextTimeout > 0;
|
|
902
|
+
const hasTimer = this.timers.has(id);
|
|
903
|
+
const timeoutChanged = prevTimeout !== nextTimeout;
|
|
904
|
+
const wasLoading = prevToast?.type === 'loading';
|
|
905
|
+
if (!shouldHaveTimer && hasTimer) {
|
|
906
|
+
const timer = this.timers.get(id);
|
|
907
|
+
timer?.timeout?.clear();
|
|
908
|
+
this.timers.delete(id);
|
|
909
|
+
return;
|
|
910
|
+
}
|
|
911
|
+
if (shouldHaveTimer && (!hasTimer || timeoutChanged || timeoutUpdated || wasLoading || behavior.resetTimer)) {
|
|
912
|
+
const timer = this.timers.get(id);
|
|
913
|
+
if (timer) {
|
|
914
|
+
timer.timeout?.clear();
|
|
915
|
+
this.timers.delete(id);
|
|
916
|
+
}
|
|
917
|
+
this.scheduleTimer(id, nextTimeout, ()=>this.closeToast(id));
|
|
918
|
+
if (selectors.expandedOrOutOfFocus(this.state)) this.pauseTimers();
|
|
919
|
+
}
|
|
920
|
+
};
|
|
921
|
+
closeToast = (toastId)=>{
|
|
922
|
+
const closeAll = void 0 === toastId;
|
|
923
|
+
const { limit, toasts } = this.state;
|
|
924
|
+
let toastsToClose;
|
|
925
|
+
if (closeAll) {
|
|
926
|
+
toastsToClose = toasts;
|
|
927
|
+
this.timers.forEach((timer)=>{
|
|
928
|
+
timer.timeout?.clear();
|
|
929
|
+
});
|
|
930
|
+
this.timers.clear();
|
|
931
|
+
} else {
|
|
932
|
+
const toast = selectors.toast(this.state, toastId);
|
|
933
|
+
if (!toast) return;
|
|
934
|
+
toastsToClose = [
|
|
935
|
+
toast
|
|
936
|
+
];
|
|
937
|
+
const timer = this.timers.get(toastId);
|
|
938
|
+
if (timer?.timeout) {
|
|
939
|
+
timer.timeout.clear();
|
|
940
|
+
this.timers.delete(toastId);
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
let activeIndex = 0;
|
|
944
|
+
const newToasts = toasts.map((item)=>{
|
|
945
|
+
if (closeAll || item.id === toastId) return {
|
|
946
|
+
...item,
|
|
947
|
+
transitionStatus: 'ending',
|
|
948
|
+
height: 0
|
|
949
|
+
};
|
|
950
|
+
if ('ending' === item.transitionStatus) return item;
|
|
951
|
+
const isLimited = activeIndex >= limit;
|
|
952
|
+
activeIndex += 1;
|
|
953
|
+
return item.limited !== isLimited ? {
|
|
954
|
+
...item,
|
|
955
|
+
limited: isLimited
|
|
956
|
+
} : item;
|
|
957
|
+
});
|
|
958
|
+
const updates = {
|
|
959
|
+
toasts: newToasts,
|
|
960
|
+
toastMetadata: createToastMetadata(newToasts)
|
|
961
|
+
};
|
|
962
|
+
if (closeAll || 1 === toasts.length) {
|
|
963
|
+
updates.hovering = false;
|
|
964
|
+
updates.focused = false;
|
|
965
|
+
}
|
|
966
|
+
this.update(updates);
|
|
967
|
+
toastsToClose.forEach((toast)=>{
|
|
968
|
+
if ('ending' !== toast.transitionStatus) toast.onClose?.();
|
|
969
|
+
});
|
|
970
|
+
this.handleFocusManagement(toastId);
|
|
971
|
+
};
|
|
972
|
+
promiseToast = (promiseValue, options)=>{
|
|
973
|
+
const loadingOptions = resolvePromiseOptions(options.loading);
|
|
974
|
+
const id = this.addToast({
|
|
975
|
+
...loadingOptions,
|
|
976
|
+
type: 'loading'
|
|
977
|
+
});
|
|
978
|
+
const handledPromise = promiseValue.then((result)=>{
|
|
979
|
+
const successOptions = resolvePromiseOptions(options.success, result);
|
|
980
|
+
this.updateToast(id, {
|
|
981
|
+
...successOptions,
|
|
982
|
+
type: 'success',
|
|
983
|
+
timeout: successOptions.timeout
|
|
984
|
+
});
|
|
985
|
+
return result;
|
|
986
|
+
}).catch((error)=>{
|
|
987
|
+
const errorOptions = resolvePromiseOptions(options.error, error);
|
|
988
|
+
this.updateToast(id, {
|
|
989
|
+
...errorOptions,
|
|
990
|
+
type: 'error',
|
|
991
|
+
timeout: errorOptions.timeout
|
|
992
|
+
});
|
|
993
|
+
return Promise.reject(error);
|
|
994
|
+
});
|
|
995
|
+
if (({}).hasOwnProperty.call(options, 'setPromise')) options.setPromise(handledPromise);
|
|
996
|
+
return handledPromise;
|
|
997
|
+
};
|
|
998
|
+
pauseTimers() {
|
|
999
|
+
if (this.areTimersPaused) return;
|
|
1000
|
+
this.areTimersPaused = true;
|
|
1001
|
+
this.timers.forEach((timer)=>{
|
|
1002
|
+
if (timer.timeout) {
|
|
1003
|
+
timer.timeout.clear();
|
|
1004
|
+
const elapsed = Date.now() - timer.start;
|
|
1005
|
+
const remaining = timer.delay - elapsed;
|
|
1006
|
+
timer.remaining = remaining > 0 ? remaining : 0;
|
|
1007
|
+
}
|
|
1008
|
+
});
|
|
1009
|
+
}
|
|
1010
|
+
resumeTimers() {
|
|
1011
|
+
if (!this.areTimersPaused) return;
|
|
1012
|
+
this.areTimersPaused = false;
|
|
1013
|
+
this.timers.forEach((timer, id)=>{
|
|
1014
|
+
timer.remaining = timer.remaining > 0 ? timer.remaining : timer.delay;
|
|
1015
|
+
timer.timeout ??= Timeout.create();
|
|
1016
|
+
timer.timeout.start(timer.remaining, ()=>{
|
|
1017
|
+
this.timers.delete(id);
|
|
1018
|
+
timer.callback();
|
|
1019
|
+
});
|
|
1020
|
+
timer.start = Date.now();
|
|
1021
|
+
});
|
|
1022
|
+
}
|
|
1023
|
+
restoreFocusToPrevElement() {
|
|
1024
|
+
this.state.prevFocusElement?.focus({
|
|
1025
|
+
preventScroll: true
|
|
1026
|
+
});
|
|
1027
|
+
}
|
|
1028
|
+
handleDocumentPointerDown = (event)=>{
|
|
1029
|
+
if ('touch' !== event.pointerType) return;
|
|
1030
|
+
const target = getTarget(event);
|
|
1031
|
+
if (contains(this.state.viewport, target)) return;
|
|
1032
|
+
this.resumeTimers();
|
|
1033
|
+
this.update({
|
|
1034
|
+
hovering: false,
|
|
1035
|
+
focused: false
|
|
1036
|
+
});
|
|
1037
|
+
};
|
|
1038
|
+
scheduleTimer(id, delay, callback) {
|
|
1039
|
+
const start = Date.now();
|
|
1040
|
+
const shouldStartActive = !selectors.expandedOrOutOfFocus(this.state);
|
|
1041
|
+
const currentTimeout = shouldStartActive ? Timeout.create() : void 0;
|
|
1042
|
+
currentTimeout?.start(delay, ()=>{
|
|
1043
|
+
this.timers.delete(id);
|
|
1044
|
+
callback();
|
|
1045
|
+
});
|
|
1046
|
+
this.timers.set(id, {
|
|
1047
|
+
timeout: currentTimeout,
|
|
1048
|
+
start: shouldStartActive ? start : 0,
|
|
1049
|
+
delay,
|
|
1050
|
+
remaining: delay,
|
|
1051
|
+
callback
|
|
1052
|
+
});
|
|
1053
|
+
}
|
|
1054
|
+
setToasts(newToasts) {
|
|
1055
|
+
const updates = {
|
|
1056
|
+
toasts: newToasts,
|
|
1057
|
+
toastMetadata: createToastMetadata(newToasts)
|
|
1058
|
+
};
|
|
1059
|
+
if (0 === newToasts.length) {
|
|
1060
|
+
updates.hovering = false;
|
|
1061
|
+
updates.focused = false;
|
|
1062
|
+
}
|
|
1063
|
+
this.update(updates);
|
|
1064
|
+
}
|
|
1065
|
+
handleFocusManagement(toastId) {
|
|
1066
|
+
const activeEl = activeElement(ownerDocument(this.state.viewport));
|
|
1067
|
+
if (!this.state.viewport || !contains(this.state.viewport, activeEl) || !matchesFocusVisible(activeEl)) return;
|
|
1068
|
+
if (void 0 === toastId) return void this.restoreFocusToPrevElement();
|
|
1069
|
+
const toasts = selectors.toasts(this.state);
|
|
1070
|
+
const currentIndex = selectors.toastIndex(this.state, toastId);
|
|
1071
|
+
let nextToast = null;
|
|
1072
|
+
let index = currentIndex + 1;
|
|
1073
|
+
while(index < toasts.length){
|
|
1074
|
+
if ('ending' !== toasts[index].transitionStatus) {
|
|
1075
|
+
nextToast = toasts[index];
|
|
1076
|
+
break;
|
|
1077
|
+
}
|
|
1078
|
+
index += 1;
|
|
1079
|
+
}
|
|
1080
|
+
if (!nextToast) {
|
|
1081
|
+
index = currentIndex - 1;
|
|
1082
|
+
while(index >= 0){
|
|
1083
|
+
if ('ending' !== toasts[index].transitionStatus) {
|
|
1084
|
+
nextToast = toasts[index];
|
|
1085
|
+
break;
|
|
1086
|
+
}
|
|
1087
|
+
index -= 1;
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
if (nextToast) nextToast.ref?.current?.focus();
|
|
1091
|
+
else this.restoreFocusToPrevElement();
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
const ToastProvider_ToastProvider = function(props) {
|
|
1095
|
+
const { children, timeout = 5000, limit = 3, toastManager } = props;
|
|
1096
|
+
const store = useRefWithInit(()=>new ToastStore({
|
|
1097
|
+
timeout,
|
|
1098
|
+
limit,
|
|
1099
|
+
viewport: null,
|
|
1100
|
+
toasts: [],
|
|
1101
|
+
hovering: false,
|
|
1102
|
+
focused: false,
|
|
1103
|
+
isWindowFocused: true,
|
|
1104
|
+
prevFocusElement: null
|
|
1105
|
+
})).current;
|
|
1106
|
+
useOnMount(store.disposeEffect);
|
|
1107
|
+
__rspack_external_react.useEffect(function() {
|
|
1108
|
+
if (!toastManager) return;
|
|
1109
|
+
const unsubscribe = toastManager[' subscribe'](({ action, options })=>{
|
|
1110
|
+
const id = options.id;
|
|
1111
|
+
if ('promise' === action && options.promise) store.promiseToast(options.promise, options);
|
|
1112
|
+
else if ('update' === action && id) store.updateToast(id, options);
|
|
1113
|
+
else if ('close' === action) store.closeToast(id);
|
|
1114
|
+
else store.addToast(options);
|
|
1115
|
+
});
|
|
1116
|
+
return unsubscribe;
|
|
1117
|
+
}, [
|
|
1118
|
+
store,
|
|
1119
|
+
toastManager
|
|
1120
|
+
]);
|
|
1121
|
+
store.useSyncedValues({
|
|
1122
|
+
timeout,
|
|
1123
|
+
limit
|
|
1124
|
+
});
|
|
1125
|
+
return /*#__PURE__*/ jsx(ToastContext.Provider, {
|
|
1126
|
+
value: store,
|
|
1127
|
+
children: children
|
|
1128
|
+
});
|
|
1129
|
+
};
|
|
1130
|
+
if ("production" !== process.env.NODE_ENV) ToastProvider_ToastProvider.displayName = "ToastProvider";
|
|
1131
|
+
const ToastPortal = FloatingPortalLite_FloatingPortalLite;
|
|
1132
|
+
function useToastManager() {
|
|
1133
|
+
const store = __rspack_external_react.useContext(ToastContext);
|
|
1134
|
+
if (!store) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: useToastManager must be used within <Toast.Provider>.' : esm_formatErrorMessage(73));
|
|
1135
|
+
const toasts = store.useState('toasts');
|
|
1136
|
+
return __rspack_external_react.useMemo(()=>({
|
|
1137
|
+
toasts,
|
|
1138
|
+
add: store.addToast,
|
|
1139
|
+
close: store.closeToast,
|
|
1140
|
+
update: store.updateToast,
|
|
1141
|
+
promise: store.promiseToast
|
|
1142
|
+
}), [
|
|
1143
|
+
toasts,
|
|
1144
|
+
store
|
|
1145
|
+
]);
|
|
1146
|
+
}
|
|
1147
|
+
const Toast_module = {
|
|
1148
|
+
viewport: "viewport-Wd6ktK",
|
|
1149
|
+
root: "root-TfN4xI",
|
|
1150
|
+
status: "status-O_LUHn",
|
|
1151
|
+
success: "success-tUs5Op",
|
|
1152
|
+
error: "error-clgmW0",
|
|
1153
|
+
preview: "preview-HUjSkl",
|
|
1154
|
+
title: "title-ECAZRW",
|
|
1155
|
+
close: "close-GX8r1b"
|
|
1156
|
+
};
|
|
1157
|
+
function getSkinClassName(skin) {
|
|
1158
|
+
switch(skin){
|
|
1159
|
+
case 'success':
|
|
1160
|
+
return Toast_module.success;
|
|
1161
|
+
case 'error':
|
|
1162
|
+
return Toast_module.error;
|
|
1163
|
+
case 'preview':
|
|
1164
|
+
return Toast_module.preview;
|
|
1165
|
+
case 'status':
|
|
1166
|
+
default:
|
|
1167
|
+
return Toast_module.status;
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
const Viewport = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ToastViewport_ToastViewport, {
|
|
1171
|
+
ref: ref,
|
|
1172
|
+
className: clsx(Toast_module.viewport, 'theme-vars', className),
|
|
1173
|
+
...props
|
|
1174
|
+
}));
|
|
1175
|
+
const Root = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, skin, swipeDirection = [], toast, ...props }, ref)=>/*#__PURE__*/ jsx(ToastRoot_ToastRoot, {
|
|
1176
|
+
ref: ref,
|
|
1177
|
+
toast: toast,
|
|
1178
|
+
className: clsx(Toast_module.root, getSkinClassName(skin), className),
|
|
1179
|
+
swipeDirection: swipeDirection,
|
|
1180
|
+
...props
|
|
1181
|
+
}));
|
|
1182
|
+
const Title = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ToastTitle_ToastTitle, {
|
|
1183
|
+
ref: ref,
|
|
1184
|
+
className: clsx(Toast_module.title, className),
|
|
1185
|
+
...props
|
|
1186
|
+
}));
|
|
1187
|
+
const CloseButton = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ToastClose_ToastClose, {
|
|
1188
|
+
ref: ref,
|
|
1189
|
+
className: clsx(Toast_module.close, className),
|
|
1190
|
+
...props,
|
|
1191
|
+
children: /*#__PURE__*/ jsx(Close, {
|
|
1192
|
+
"aria-hidden": "true"
|
|
1193
|
+
})
|
|
1194
|
+
}));
|
|
1195
|
+
const Toast = {
|
|
1196
|
+
Provider: ToastProvider_ToastProvider,
|
|
1197
|
+
Portal: ToastPortal,
|
|
1198
|
+
Viewport: Viewport,
|
|
1199
|
+
Root: Root,
|
|
1200
|
+
Title: Title,
|
|
1201
|
+
Close: CloseButton,
|
|
1202
|
+
useToastManager: useToastManager
|
|
1203
|
+
};
|
|
1204
|
+
export { Toast };
|