@mortenbrudvik/waveui 0.10.0 → 0.12.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/README.md +454 -74
- package/dist/components/button/Link.cjs +1 -1
- package/dist/components/button/Link.cjs.map +1 -1
- package/dist/components/button/Link.mjs +4 -4
- package/dist/components/button/Toolbar.cjs +1 -1
- package/dist/components/button/Toolbar.cjs.map +1 -1
- package/dist/components/button/Toolbar.mjs +25 -30
- package/dist/components/button/Toolbar.mjs.map +1 -1
- package/dist/components/button/Toolbar.navigation.cjs +2 -0
- package/dist/components/button/Toolbar.navigation.cjs.map +1 -0
- package/dist/components/button/Toolbar.navigation.mjs +17 -0
- package/dist/components/button/Toolbar.navigation.mjs.map +1 -0
- package/dist/components/data-display/Avatar.cjs +1 -1
- package/dist/components/data-display/Avatar.cjs.map +1 -1
- package/dist/components/data-display/Avatar.context.cjs +2 -0
- package/dist/components/data-display/Avatar.context.cjs.map +1 -0
- package/dist/components/data-display/Avatar.context.mjs +9 -0
- package/dist/components/data-display/Avatar.context.mjs.map +1 -0
- package/dist/components/data-display/Avatar.mjs +66 -61
- package/dist/components/data-display/Avatar.mjs.map +1 -1
- package/dist/components/data-display/AvatarGroup.cjs +1 -1
- package/dist/components/data-display/AvatarGroup.cjs.map +1 -1
- package/dist/components/data-display/AvatarGroup.mjs +10 -10
- package/dist/components/data-display/InfoButton.cjs +1 -1
- package/dist/components/data-display/InfoButton.cjs.map +1 -1
- package/dist/components/data-display/InfoButton.mjs +12 -12
- package/dist/components/data-display/InteractionTag.cjs +2 -0
- package/dist/components/data-display/InteractionTag.cjs.map +1 -0
- package/dist/components/data-display/InteractionTag.mjs +234 -0
- package/dist/components/data-display/InteractionTag.mjs.map +1 -0
- package/dist/components/data-display/Tag.cjs +1 -1
- package/dist/components/data-display/Tag.cjs.map +1 -1
- package/dist/components/data-display/Tag.mjs +222 -90
- package/dist/components/data-display/Tag.mjs.map +1 -1
- package/dist/components/data-display/TagGroup.cjs +2 -0
- package/dist/components/data-display/TagGroup.cjs.map +1 -0
- package/dist/components/data-display/TagGroup.context.cjs +2 -0
- package/dist/components/data-display/TagGroup.context.cjs.map +1 -0
- package/dist/components/data-display/TagGroup.context.mjs +113 -0
- package/dist/components/data-display/TagGroup.context.mjs.map +1 -0
- package/dist/components/data-display/TagGroup.mjs +149 -0
- package/dist/components/data-display/TagGroup.mjs.map +1 -0
- package/dist/components/data-display/tagStyles.cjs +2 -0
- package/dist/components/data-display/tagStyles.cjs.map +1 -0
- package/dist/components/data-display/tagStyles.mjs +108 -0
- package/dist/components/data-display/tagStyles.mjs.map +1 -0
- package/dist/components/feedback/Toaster.cjs +1 -1
- package/dist/components/feedback/Toaster.cjs.map +1 -1
- package/dist/components/feedback/Toaster.mjs +287 -255
- package/dist/components/feedback/Toaster.mjs.map +1 -1
- package/dist/components/input/Combobox.cjs +1 -1
- package/dist/components/input/Combobox.cjs.map +1 -1
- package/dist/components/input/Combobox.expand.cjs +1 -1
- package/dist/components/input/Combobox.expand.cjs.map +1 -1
- package/dist/components/input/Combobox.expand.mjs +7 -7
- package/dist/components/input/Combobox.expand.mjs.map +1 -1
- package/dist/components/input/Combobox.mjs +176 -175
- package/dist/components/input/Combobox.mjs.map +1 -1
- package/dist/components/input/DatePicker.cjs +1 -1
- package/dist/components/input/DatePicker.cjs.map +1 -1
- package/dist/components/input/DatePicker.mjs +188 -187
- package/dist/components/input/DatePicker.mjs.map +1 -1
- package/dist/components/input/Dropdown.cjs +1 -1
- package/dist/components/input/Dropdown.cjs.map +1 -1
- package/dist/components/input/Dropdown.mjs +41 -40
- package/dist/components/input/Dropdown.mjs.map +1 -1
- package/dist/components/input/Option.cjs +1 -1
- package/dist/components/input/Option.cjs.map +1 -1
- package/dist/components/input/Option.mjs +101 -94
- package/dist/components/input/Option.mjs.map +1 -1
- package/dist/components/input/SwatchPicker.cjs.map +1 -1
- package/dist/components/input/SwatchPicker.context.cjs.map +1 -1
- package/dist/components/input/SwatchPicker.context.mjs.map +1 -1
- package/dist/components/input/SwatchPicker.mjs.map +1 -1
- package/dist/components/input/TagPicker.cjs +1 -1
- package/dist/components/input/TagPicker.cjs.map +1 -1
- package/dist/components/input/TagPicker.context.cjs +2 -0
- package/dist/components/input/TagPicker.context.cjs.map +1 -0
- package/dist/components/input/TagPicker.context.mjs +20 -0
- package/dist/components/input/TagPicker.context.mjs.map +1 -0
- package/dist/components/input/TagPicker.create.cjs +2 -0
- package/dist/components/input/TagPicker.create.cjs.map +1 -0
- package/dist/components/input/TagPicker.create.mjs +24 -0
- package/dist/components/input/TagPicker.create.mjs.map +1 -0
- package/dist/components/input/TagPicker.mjs +13 -279
- package/dist/components/input/TagPicker.mjs.map +1 -1
- package/dist/components/input/TagPicker.option.cjs +2 -0
- package/dist/components/input/TagPicker.option.cjs.map +1 -0
- package/dist/components/input/TagPicker.option.mjs +45 -0
- package/dist/components/input/TagPicker.option.mjs.map +1 -0
- package/dist/components/input/TagPicker.overflow.cjs +2 -0
- package/dist/components/input/TagPicker.overflow.cjs.map +1 -0
- package/dist/components/input/TagPicker.overflow.mjs +153 -0
- package/dist/components/input/TagPicker.overflow.mjs.map +1 -0
- package/dist/components/input/TagPicker.parts.cjs +2 -0
- package/dist/components/input/TagPicker.parts.cjs.map +1 -0
- package/dist/components/input/TagPicker.parts.mjs +425 -0
- package/dist/components/input/TagPicker.parts.mjs.map +1 -0
- package/dist/components/input/TagPicker.root.cjs +2 -0
- package/dist/components/input/TagPicker.root.cjs.map +1 -0
- package/dist/components/input/TagPicker.root.mjs +417 -0
- package/dist/components/input/TagPicker.root.mjs.map +1 -0
- package/dist/components/input/TimePicker.cjs +1 -1
- package/dist/components/input/TimePicker.cjs.map +1 -1
- package/dist/components/input/TimePicker.mjs +156 -154
- package/dist/components/input/TimePicker.mjs.map +1 -1
- package/dist/components/layout/Accordion.cjs.map +1 -1
- package/dist/components/layout/Accordion.mjs.map +1 -1
- package/dist/components/navigation/Hamburger.cjs +2 -0
- package/dist/components/navigation/Hamburger.cjs.map +1 -0
- package/dist/components/navigation/Hamburger.mjs +54 -0
- package/dist/components/navigation/Hamburger.mjs.map +1 -0
- package/dist/components/navigation/Menu.popover.cjs +1 -1
- package/dist/components/navigation/Menu.popover.cjs.map +1 -1
- package/dist/components/navigation/Menu.popover.mjs +137 -127
- package/dist/components/navigation/Menu.popover.mjs.map +1 -1
- package/dist/components/navigation/Menu.root.cjs +1 -1
- package/dist/components/navigation/Menu.root.cjs.map +1 -1
- package/dist/components/navigation/Menu.root.mjs +4 -4
- package/dist/components/navigation/Nav.cjs +1 -1
- package/dist/components/navigation/Nav.cjs.map +1 -1
- package/dist/components/navigation/Nav.context.cjs +2 -0
- package/dist/components/navigation/Nav.context.cjs.map +1 -0
- package/dist/components/navigation/Nav.context.mjs +137 -0
- package/dist/components/navigation/Nav.context.mjs.map +1 -0
- package/dist/components/navigation/Nav.mjs +151 -258
- package/dist/components/navigation/Nav.mjs.map +1 -1
- package/dist/components/navigation/Nav.parts.cjs +2 -0
- package/dist/components/navigation/Nav.parts.cjs.map +1 -0
- package/dist/components/navigation/Nav.parts.mjs +77 -0
- package/dist/components/navigation/Nav.parts.mjs.map +1 -0
- package/dist/components/navigation/Nav.root.cjs +2 -0
- package/dist/components/navigation/Nav.root.cjs.map +1 -0
- package/dist/components/navigation/Nav.root.mjs +78 -0
- package/dist/components/navigation/Nav.root.mjs.map +1 -0
- package/dist/components/navigation/NavDrawer.cjs +2 -0
- package/dist/components/navigation/NavDrawer.cjs.map +1 -0
- package/dist/components/navigation/NavDrawer.context.cjs +2 -0
- package/dist/components/navigation/NavDrawer.context.cjs.map +1 -0
- package/dist/components/navigation/NavDrawer.context.mjs +11 -0
- package/dist/components/navigation/NavDrawer.context.mjs.map +1 -0
- package/dist/components/navigation/NavDrawer.mjs +179 -0
- package/dist/components/navigation/NavDrawer.mjs.map +1 -0
- package/dist/components/overlays/Dialog.cjs +1 -1
- package/dist/components/overlays/Dialog.cjs.map +1 -1
- package/dist/components/overlays/Dialog.mjs +188 -123
- package/dist/components/overlays/Dialog.mjs.map +1 -1
- package/dist/components/overlays/Dialog.shared.cjs +1 -1
- package/dist/components/overlays/Dialog.shared.cjs.map +1 -1
- package/dist/components/overlays/Dialog.shared.mjs +157 -81
- package/dist/components/overlays/Dialog.shared.mjs.map +1 -1
- package/dist/components/overlays/Dialog.slots.cjs +2 -0
- package/dist/components/overlays/Dialog.slots.cjs.map +1 -0
- package/dist/components/overlays/Dialog.slots.mjs +129 -0
- package/dist/components/overlays/Dialog.slots.mjs.map +1 -0
- package/dist/components/overlays/Drawer.cjs +1 -1
- package/dist/components/overlays/Drawer.cjs.map +1 -1
- package/dist/components/overlays/Drawer.context.cjs +2 -0
- package/dist/components/overlays/Drawer.context.cjs.map +1 -0
- package/dist/components/overlays/Drawer.context.mjs +29 -0
- package/dist/components/overlays/Drawer.context.mjs.map +1 -0
- package/dist/components/overlays/Drawer.mjs +12 -187
- package/dist/components/overlays/Drawer.mjs.map +1 -1
- package/dist/components/overlays/Drawer.panel.cjs +2 -0
- package/dist/components/overlays/Drawer.panel.cjs.map +1 -0
- package/dist/components/overlays/Drawer.panel.mjs +159 -0
- package/dist/components/overlays/Drawer.panel.mjs.map +1 -0
- package/dist/components/overlays/Drawer.parts.cjs +2 -0
- package/dist/components/overlays/Drawer.parts.cjs.map +1 -0
- package/dist/components/overlays/Drawer.parts.mjs +152 -0
- package/dist/components/overlays/Drawer.parts.mjs.map +1 -0
- package/dist/components/overlays/Drawer.root.cjs +2 -0
- package/dist/components/overlays/Drawer.root.cjs.map +1 -0
- package/dist/components/overlays/Drawer.root.mjs +207 -0
- package/dist/components/overlays/Drawer.root.mjs.map +1 -0
- package/dist/components/overlays/Drawer.scroll.cjs +2 -0
- package/dist/components/overlays/Drawer.scroll.cjs.map +1 -0
- package/dist/components/overlays/Drawer.scroll.mjs +42 -0
- package/dist/components/overlays/Drawer.scroll.mjs.map +1 -0
- package/dist/components/overlays/Popover.cjs +1 -1
- package/dist/components/overlays/Popover.cjs.map +1 -1
- package/dist/components/overlays/Popover.mjs +173 -162
- package/dist/components/overlays/Popover.mjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.cjs +1 -1
- package/dist/components/overlays/TeachingPopover.cjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.mjs +96 -91
- package/dist/components/overlays/TeachingPopover.mjs.map +1 -1
- package/dist/components/overlays/Tooltip.cjs +1 -1
- package/dist/components/overlays/Tooltip.cjs.map +1 -1
- package/dist/components/overlays/Tooltip.mjs +47 -47
- package/dist/components/overlays/Tooltip.mjs.map +1 -1
- package/dist/components/portal/Portal.cjs +1 -1
- package/dist/components/portal/Portal.cjs.map +1 -1
- package/dist/components/portal/Portal.mjs +5 -5
- package/dist/components/table/DataGrid.cjs +1 -1
- package/dist/components/table/DataGrid.cjs.map +1 -1
- package/dist/components/table/DataGrid.mjs +1 -1
- package/dist/hooks/useDismiss.cjs.map +1 -1
- package/dist/hooks/useDismiss.mjs.map +1 -1
- package/dist/hooks/useFocusTrap.cjs +1 -1
- package/dist/hooks/useFocusTrap.cjs.map +1 -1
- package/dist/hooks/useFocusTrap.mjs +115 -98
- package/dist/hooks/useFocusTrap.mjs.map +1 -1
- package/dist/hooks/useFocusVisible.cjs +2 -0
- package/dist/hooks/useFocusVisible.cjs.map +1 -0
- package/dist/hooks/useFocusVisible.mjs +49 -0
- package/dist/hooks/useFocusVisible.mjs.map +1 -0
- package/dist/hooks/useFocusableGroup.cjs +2 -0
- package/dist/hooks/useFocusableGroup.cjs.map +1 -0
- package/dist/hooks/useFocusableGroup.mjs +70 -0
- package/dist/hooks/useFocusableGroup.mjs.map +1 -0
- package/dist/hooks/useModalLayer.cjs +1 -1
- package/dist/hooks/useModalLayer.cjs.map +1 -1
- package/dist/hooks/useModalLayer.mjs +34 -21
- package/dist/hooks/useModalLayer.mjs.map +1 -1
- package/dist/hooks/useModalOpen.cjs +2 -0
- package/dist/hooks/useModalOpen.cjs.map +1 -0
- package/dist/hooks/useModalOpen.mjs +14 -0
- package/dist/hooks/useModalOpen.mjs.map +1 -0
- package/dist/hooks/usePopupPosition.cjs +1 -1
- package/dist/hooks/usePopupPosition.cjs.map +1 -1
- package/dist/hooks/usePopupPosition.mjs +82 -53
- package/dist/hooks/usePopupPosition.mjs.map +1 -1
- package/dist/hooks/useResolvedTarget.cjs +2 -0
- package/dist/hooks/useResolvedTarget.cjs.map +1 -0
- package/dist/hooks/useResolvedTarget.mjs +37 -0
- package/dist/hooks/useResolvedTarget.mjs.map +1 -0
- package/dist/hooks/useRestoreFocus.cjs +1 -1
- package/dist/hooks/useRestoreFocus.cjs.map +1 -1
- package/dist/hooks/useRestoreFocus.mjs +91 -78
- package/dist/hooks/useRestoreFocus.mjs.map +1 -1
- package/dist/hooks/useRovingGrid.cjs +1 -1
- package/dist/hooks/useRovingGrid.cjs.map +1 -1
- package/dist/hooks/useRovingGrid.mjs +8 -57
- package/dist/hooks/useRovingGrid.mjs.map +1 -1
- package/dist/hooks/useRovingTabIndex.cjs +1 -1
- package/dist/hooks/useRovingTabIndex.cjs.map +1 -1
- package/dist/hooks/useRovingTabIndex.mjs +180 -121
- package/dist/hooks/useRovingTabIndex.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +3070 -269
- package/dist/index.d.ts +3070 -269
- package/dist/index.mjs +127 -107
- package/dist/lib/classNames.cjs +1 -1
- package/dist/lib/classNames.cjs.map +1 -1
- package/dist/lib/classNames.mjs +137 -77
- package/dist/lib/classNames.mjs.map +1 -1
- package/dist/lib/icons.cjs +1 -1
- package/dist/lib/icons.cjs.map +1 -1
- package/dist/lib/icons.mjs +13 -6
- package/dist/lib/icons.mjs.map +1 -1
- package/dist/lib/layers.cjs +1 -1
- package/dist/lib/layers.cjs.map +1 -1
- package/dist/lib/layers.mjs +120 -111
- package/dist/lib/layers.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/styles/tokens.css +25 -0
|
@@ -8,22 +8,22 @@ import { useEventCallback as s } from "../../hooks/useEventCallback.mjs";
|
|
|
8
8
|
import { useId as c } from "../../hooks/useId.mjs";
|
|
9
9
|
import { getDirection as l } from "../../lib/direction.mjs";
|
|
10
10
|
import { getFirstTabbable as u, getTabbableElements as d, isConnectedAndFocusable as f } from "../../lib/focus.mjs";
|
|
11
|
-
import { useMergedRefs as
|
|
12
|
-
import { joinIds as
|
|
13
|
-
import { usePresence as
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { isEditableTarget as
|
|
19
|
-
import { usePreserveFocus as
|
|
20
|
-
import { StatusText as
|
|
21
|
-
import { ToastContext as
|
|
22
|
-
import { ToastRoot as
|
|
23
|
-
import * as
|
|
24
|
-
import { jsx as
|
|
11
|
+
import { useMergedRefs as p } from "../../hooks/useMergedRefs.mjs";
|
|
12
|
+
import { joinIds as m } from "../../lib/aria.mjs";
|
|
13
|
+
import { usePresence as ee } from "../../hooks/usePresence.mjs";
|
|
14
|
+
import { useDirection as h } from "../../hooks/useDirection.mjs";
|
|
15
|
+
import { getOpenLayers as g, isInsideLayerTree as _, subscribeLayers as v } from "../../lib/layers.mjs";
|
|
16
|
+
import { focusRing as te } from "../../lib/styles.mjs";
|
|
17
|
+
import { Portal as y } from "../portal/Portal.mjs";
|
|
18
|
+
import { isEditableTarget as ne, isOwnEvent as re } from "../../lib/events.mjs";
|
|
19
|
+
import { usePreserveFocus as ie } from "../../hooks/usePreserveFocus.mjs";
|
|
20
|
+
import { StatusText as ae, getStatusLabel as b } from "./MessageBar.status.mjs";
|
|
21
|
+
import { ToastContext as oe, ToasterContext as x } from "./Toast.context.mjs";
|
|
22
|
+
import { ToastRoot as se } from "./Toast.root.mjs";
|
|
23
|
+
import * as S from "react";
|
|
24
|
+
import { jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
25
25
|
//#region src/components/feedback/Toaster.tsx
|
|
26
|
-
function
|
|
26
|
+
function ce(e, t) {
|
|
27
27
|
let n = 0, r = !1;
|
|
28
28
|
for (let t of e) t.shown ? t.dismissed || (n += 1) : r = !0;
|
|
29
29
|
return !r || n >= t ? e : e.map((e) => e.shown || n >= t ? e : (n += 1, {
|
|
@@ -31,7 +31,7 @@ function le(e, t) {
|
|
|
31
31
|
shown: !0
|
|
32
32
|
}));
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function T(e, t) {
|
|
35
35
|
let n = e.findIndex((e) => e.id === t);
|
|
36
36
|
if (n === -1) return e;
|
|
37
37
|
let r = e[n];
|
|
@@ -43,40 +43,40 @@ function w(e, t) {
|
|
|
43
43
|
dismissed: !0
|
|
44
44
|
}, i;
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function E(e) {
|
|
47
47
|
return e.every((e) => e.shown && e.dismissed) ? e : e.filter((e) => e.shown).map((e) => e.dismissed ? e : {
|
|
48
48
|
...e,
|
|
49
49
|
dismissed: !0
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function D(e) {
|
|
53
53
|
let t;
|
|
54
54
|
for (let n of e) n.shown && !n.dismissed && (!t || n.seq > t.seq) && (t = n);
|
|
55
55
|
return t;
|
|
56
56
|
}
|
|
57
|
-
function
|
|
58
|
-
return e.contains(t) ? !0 :
|
|
57
|
+
function O(e, t) {
|
|
58
|
+
return e.contains(t) ? !0 : g().some((n) => {
|
|
59
59
|
let r = n.getAnchor();
|
|
60
|
-
return r !== null && e.contains(r) &&
|
|
60
|
+
return r !== null && e.contains(r) && _(n.id, t);
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function le(e, t) {
|
|
64
64
|
let n = t?.getDismissButton() ?? null;
|
|
65
65
|
return d(e).some((e) => e !== n);
|
|
66
66
|
}
|
|
67
|
-
function
|
|
67
|
+
function k(e) {
|
|
68
68
|
return e === void 0 ? Infinity : e >= 1 ? Math.floor(e) : 1;
|
|
69
69
|
}
|
|
70
|
-
var
|
|
70
|
+
var A = {
|
|
71
71
|
dispatchToast: (e, t) => (o(e) ? e.toastId : t?.toastId) ?? "",
|
|
72
72
|
dismissToast: () => {},
|
|
73
73
|
dismissAllToasts: () => {}
|
|
74
|
-
},
|
|
75
|
-
function
|
|
76
|
-
return
|
|
74
|
+
}, j = "useToastController must be used within <Toaster>. Wrap your app (or the part of it that shows toasts) in <Toaster>: it provides the controller to its children.";
|
|
75
|
+
function M() {
|
|
76
|
+
return S.useContext(x) || (t("useToastController", "<Toaster>", j), A);
|
|
77
77
|
}
|
|
78
|
-
var
|
|
79
|
-
function
|
|
78
|
+
var ue = 5e3;
|
|
79
|
+
function N(e) {
|
|
80
80
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map(), i = !1, a = !1, o = (o) => {
|
|
81
81
|
let s = t.get(o);
|
|
82
82
|
if (!s) return;
|
|
@@ -119,67 +119,84 @@ function M(e) {
|
|
|
119
119
|
}
|
|
120
120
|
};
|
|
121
121
|
}
|
|
122
|
-
var
|
|
123
|
-
"top-start": "top-4 start-4 ms-(--wave-toaster-offset)",
|
|
124
|
-
"top-end": "top-4 end-4 me-(--wave-toaster-offset)",
|
|
125
|
-
"bottom-start": "bottom-4 start-4 ms-(--wave-toaster-offset)",
|
|
126
|
-
"bottom-end": "bottom-4 end-4 me-(--wave-toaster-offset)",
|
|
127
|
-
"top-right": "top-4 right-4 mr-(--wave-toaster-offset)",
|
|
128
|
-
"top-left": "top-4 left-4 ml-(--wave-toaster-offset)",
|
|
129
|
-
"bottom-right": "bottom-4 right-4 mr-(--wave-toaster-offset)",
|
|
130
|
-
"bottom-left": "bottom-4 left-4 ml-(--wave-toaster-offset)"
|
|
131
|
-
},
|
|
132
|
-
function
|
|
122
|
+
var P = {
|
|
123
|
+
"top-start": "top-4 start-4 ms-(--wave-toaster-offset) mt-(--wave-toaster-offset-block)",
|
|
124
|
+
"top-end": "top-4 end-4 me-(--wave-toaster-offset) mt-(--wave-toaster-offset-block)",
|
|
125
|
+
"bottom-start": "bottom-4 start-4 ms-(--wave-toaster-offset) mb-(--wave-toaster-offset-block)",
|
|
126
|
+
"bottom-end": "bottom-4 end-4 me-(--wave-toaster-offset) mb-(--wave-toaster-offset-block)",
|
|
127
|
+
"top-right": "top-4 right-4 mr-(--wave-toaster-offset) mt-(--wave-toaster-offset-block)",
|
|
128
|
+
"top-left": "top-4 left-4 ml-(--wave-toaster-offset) mt-(--wave-toaster-offset-block)",
|
|
129
|
+
"bottom-right": "bottom-4 right-4 mr-(--wave-toaster-offset) mb-(--wave-toaster-offset-block)",
|
|
130
|
+
"bottom-left": "bottom-4 left-4 ml-(--wave-toaster-offset) mb-(--wave-toaster-offset-block)"
|
|
131
|
+
}, F = 16;
|
|
132
|
+
function I(e, t) {
|
|
133
133
|
let n = e.slice(e.indexOf("-") + 1);
|
|
134
134
|
if (n === "right" || n === "left") return n === "right";
|
|
135
135
|
let r = l(t) === "rtl";
|
|
136
136
|
return n === "end" ? !r : r;
|
|
137
137
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
138
|
+
var L = {
|
|
139
|
+
inline: 0,
|
|
140
|
+
block: 0
|
|
141
|
+
};
|
|
142
|
+
function R() {
|
|
143
|
+
return g().filter((e) => e.kind === "modal" || e.kind === "dialog");
|
|
144
|
+
}
|
|
145
|
+
function de() {
|
|
146
|
+
let e = /* @__PURE__ */ new Set();
|
|
147
|
+
for (let t of R()) for (let n of t.getElements()) n?.isConnected && e.add(n);
|
|
148
|
+
return e;
|
|
149
|
+
}
|
|
150
|
+
function z(e, t) {
|
|
151
|
+
let n = R();
|
|
152
|
+
if (n.length === 0) return L;
|
|
141
153
|
let r = e.ownerDocument, i = r.defaultView;
|
|
142
|
-
if (!i) return
|
|
143
|
-
let a = r.documentElement.clientWidth || i.innerWidth, o = r.documentElement.clientHeight || i.innerHeight, s =
|
|
154
|
+
if (!i) return L;
|
|
155
|
+
let a = r.documentElement.clientWidth || i.innerWidth, o = r.documentElement.clientHeight || i.innerHeight, s = I(t, e), c = t.startsWith("top"), l = (t) => a - t >= e.offsetWidth + 32, u = (t) => o - t >= e.offsetHeight + 32, d = 0, f = 0;
|
|
144
156
|
for (let e of n) for (let t of e.getElements()) {
|
|
145
157
|
if (!t?.isConnected) continue;
|
|
146
158
|
let e = t.getBoundingClientRect();
|
|
147
159
|
if (e.width <= 0 || e.height <= 0) continue;
|
|
148
|
-
let n = s ? e.right >= a -
|
|
149
|
-
n
|
|
160
|
+
let n = s ? e.right >= a - F : e.left <= F, r = c ? e.top <= F : e.bottom >= o - F;
|
|
161
|
+
if (!n || !r) continue;
|
|
162
|
+
let i = s ? a - e.left : e.right, p = c ? e.bottom : o - e.top;
|
|
163
|
+
l(i) ? d = Math.max(d, i) : u(p) && (f = Math.max(f, p));
|
|
150
164
|
}
|
|
151
|
-
return
|
|
165
|
+
return {
|
|
166
|
+
inline: d > 0 && l(d) ? Math.ceil(d) : 0,
|
|
167
|
+
block: f > 0 && u(f) ? Math.ceil(f) : 0
|
|
168
|
+
};
|
|
152
169
|
}
|
|
153
|
-
var
|
|
154
|
-
function
|
|
155
|
-
let [t, n] =
|
|
156
|
-
return
|
|
157
|
-
let e = setTimeout(() => n(!1),
|
|
170
|
+
var B = 2e3;
|
|
171
|
+
function V({ text: e }) {
|
|
172
|
+
let [t, n] = S.useState(!0);
|
|
173
|
+
return S.useEffect(() => {
|
|
174
|
+
let e = setTimeout(() => n(!1), B);
|
|
158
175
|
return () => clearTimeout(e);
|
|
159
|
-
}, []), t ? /* @__PURE__ */
|
|
176
|
+
}, []), t ? /* @__PURE__ */ C("div", { children: e }) : null;
|
|
160
177
|
}
|
|
161
|
-
|
|
162
|
-
function
|
|
178
|
+
V.displayName = "LiveMessage";
|
|
179
|
+
function H(e) {
|
|
163
180
|
return e.kind === "title";
|
|
164
181
|
}
|
|
165
|
-
function
|
|
182
|
+
function U(e) {
|
|
166
183
|
return e.kind === "body";
|
|
167
184
|
}
|
|
168
|
-
function
|
|
185
|
+
function W(e) {
|
|
169
186
|
return e.kind === "footer";
|
|
170
187
|
}
|
|
171
|
-
var
|
|
188
|
+
var fe = /* @__PURE__ */ new Set(/* @__PURE__ */ "a.abbr.b.bdi.bdo.cite.code.data.dfn.em.i.kbd.label.mark.q.s.samp.small.span.strong.sub.sup.time.u.var.wbr".split(".")), G = /* @__PURE__ */ new Set([
|
|
172
189
|
"noscript",
|
|
173
190
|
"script",
|
|
174
191
|
"style",
|
|
175
192
|
"template"
|
|
176
|
-
]),
|
|
193
|
+
]), pe = /* @__PURE__ */ new Set([
|
|
177
194
|
"button",
|
|
178
195
|
"img",
|
|
179
196
|
"input",
|
|
180
197
|
"select",
|
|
181
198
|
"textarea"
|
|
182
|
-
]),
|
|
199
|
+
]), K = /* @__PURE__ */ new Set([
|
|
183
200
|
"button",
|
|
184
201
|
"checkbox",
|
|
185
202
|
"combobox",
|
|
@@ -193,14 +210,14 @@ var V = /* @__PURE__ */ new Set(/* @__PURE__ */ "a.abbr.b.bdi.bdo.cite.code.data
|
|
|
193
210
|
"tab",
|
|
194
211
|
"textbox"
|
|
195
212
|
]);
|
|
196
|
-
function
|
|
213
|
+
function me(e) {
|
|
197
214
|
let t = e.getAttribute("role")?.trim().split(/\s+/)[0];
|
|
198
|
-
return t ?
|
|
215
|
+
return t ? K.has(t) || t.startsWith("menuitem") : e.localName === "a" ? e.hasAttribute("href") : pe.has(e.localName);
|
|
199
216
|
}
|
|
200
|
-
function
|
|
201
|
-
return e.getAttribute("aria-hidden") === "true" || e.hasAttribute("hidden") ||
|
|
217
|
+
function q(e) {
|
|
218
|
+
return e.getAttribute("aria-hidden") === "true" || e.hasAttribute("hidden") || G.has(e.localName);
|
|
202
219
|
}
|
|
203
|
-
function
|
|
220
|
+
function J(e, t) {
|
|
204
221
|
if (!e) return "";
|
|
205
222
|
let n = [], r = (e, i) => {
|
|
206
223
|
if (e.nodeType === Node.TEXT_NODE) {
|
|
@@ -209,9 +226,9 @@ function K(e, t) {
|
|
|
209
226
|
}
|
|
210
227
|
if (e.nodeType !== Node.ELEMENT_NODE) return;
|
|
211
228
|
let a = e;
|
|
212
|
-
if (!i && t?.(a) ||
|
|
229
|
+
if (!i && t?.(a) || q(a)) return;
|
|
213
230
|
let o = a.getAttribute("aria-label");
|
|
214
|
-
if (o &&
|
|
231
|
+
if (o && me(a)) {
|
|
215
232
|
n.push(` ${o} `);
|
|
216
233
|
return;
|
|
217
234
|
}
|
|
@@ -219,64 +236,64 @@ function K(e, t) {
|
|
|
219
236
|
n.push(` ${a.getAttribute("alt") ?? ""} `);
|
|
220
237
|
return;
|
|
221
238
|
}
|
|
222
|
-
let s = !
|
|
239
|
+
let s = !fe.has(a.localName);
|
|
223
240
|
s && n.push(" ");
|
|
224
241
|
for (let e of Array.from(a.childNodes)) r(e, !1);
|
|
225
242
|
s && n.push(" ");
|
|
226
243
|
};
|
|
227
244
|
return r(e, !0), n.join("").replace(/\s+/g, " ").trim();
|
|
228
245
|
}
|
|
229
|
-
function
|
|
230
|
-
return !e ||
|
|
246
|
+
function Y(e) {
|
|
247
|
+
return !e || q(e) ? [] : Array.from(e.childNodes, (e) => e.nodeType === Node.TEXT_NODE ? (e.textContent ?? "").replace(/\s+/g, " ").trim() : e.nodeType === Node.ELEMENT_NODE ? J(e) : "").filter(Boolean);
|
|
231
248
|
}
|
|
232
|
-
function
|
|
233
|
-
let i = t.find(
|
|
249
|
+
function X(e, t, n, r) {
|
|
250
|
+
let i = t.find(H), a = t.find(U);
|
|
234
251
|
if (!i && !a) {
|
|
235
252
|
let t = n?.getDismissButton() ?? null;
|
|
236
|
-
return
|
|
253
|
+
return J(e, (e) => e === t || e.id !== "" && (e.id === r || e.id === n?.statusTextId));
|
|
237
254
|
}
|
|
238
|
-
let o = i?.getLabel() ?? null, s = i?.getRow() ?? null, c = s ? Array.from(s.children).filter((e) => e !== o).flatMap((e) =>
|
|
255
|
+
let o = i?.getLabel() ?? null, s = i?.getRow() ?? null, c = s ? Array.from(s.children).filter((e) => e !== o).flatMap((e) => Y(e)) : [];
|
|
239
256
|
return [
|
|
240
|
-
|
|
241
|
-
|
|
257
|
+
J(o),
|
|
258
|
+
J(a?.getElement() ?? null),
|
|
242
259
|
...c,
|
|
243
|
-
...t.filter(
|
|
260
|
+
...t.filter(W).flatMap((e) => Y(e.getElement()))
|
|
244
261
|
].filter(Boolean).join(" ");
|
|
245
262
|
}
|
|
246
|
-
function
|
|
247
|
-
let { id: f, dismissed: h } = t, { isMounted: g, ref: _, presenceProps:
|
|
263
|
+
function he({ entry: t, timers: r, onDismiss: a, onExited: o, getFocusFallback: l, announce: u, registerContainer: d }) {
|
|
264
|
+
let { id: f, dismissed: h } = t, { isMounted: g, ref: _, presenceProps: v } = ee(!h, {
|
|
248
265
|
appear: !0,
|
|
249
266
|
onExited: () => o(f)
|
|
250
|
-
}),
|
|
251
|
-
|
|
252
|
-
}, [f, d]),
|
|
253
|
-
|
|
254
|
-
let
|
|
255
|
-
|
|
256
|
-
}), []), [
|
|
257
|
-
|
|
258
|
-
}), []),
|
|
259
|
-
|
|
260
|
-
}),
|
|
261
|
-
titleId:
|
|
262
|
-
dismiss:
|
|
263
|
-
registerPart:
|
|
264
|
-
registerToast:
|
|
267
|
+
}), y = S.useRef(null), x = S.useRef(null), ce = S.useCallback((e) => {
|
|
268
|
+
y.current = e, e && (x.current = e), d(f, e);
|
|
269
|
+
}, [f, d]), T = p(ce, _);
|
|
270
|
+
ie(y, () => l(x.current), { enabled: !h });
|
|
271
|
+
let E = c("wave-toast-title"), D = c("wave-toast-status"), [O, k] = S.useState([]), A = S.useRef([]), j = S.useCallback((e) => (A.current = [...A.current, e], k(A.current), () => {
|
|
272
|
+
A.current = A.current.filter((t) => t !== e), k(A.current);
|
|
273
|
+
}), []), [M, N] = S.useState(null), P = S.useRef(null), F = S.useCallback((e) => (P.current = e, N(e), () => {
|
|
274
|
+
P.current === e && (P.current = null, N(null));
|
|
275
|
+
}), []), I = s(() => {
|
|
276
|
+
P.current?.onDismiss?.(), a(f);
|
|
277
|
+
}), L = S.useMemo(() => ({
|
|
278
|
+
titleId: E,
|
|
279
|
+
dismiss: I,
|
|
280
|
+
registerPart: j,
|
|
281
|
+
registerToast: F
|
|
265
282
|
}), [
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
]),
|
|
271
|
-
|
|
272
|
-
let e =
|
|
283
|
+
E,
|
|
284
|
+
I,
|
|
285
|
+
j,
|
|
286
|
+
F
|
|
287
|
+
]), R = O.find(H), de = O.find(U), z = t.form === "content" && M === null ? b(t.options.status ?? "info", t.options.statusLabel) : "", B = M ? M.statusTextId : z ? D : void 0;
|
|
288
|
+
S.useLayoutEffect(() => {
|
|
289
|
+
let e = y.current;
|
|
273
290
|
if (t.dismissed || !e) return;
|
|
274
|
-
let n = t.options.timeout ?? (
|
|
291
|
+
let n = t.options.timeout ?? (le(e, P.current) ? 0 : ue);
|
|
275
292
|
r.start(t.id, t.seq, n);
|
|
276
|
-
}, [t, r]),
|
|
277
|
-
let e =
|
|
293
|
+
}, [t, r]), S.useLayoutEffect(() => {
|
|
294
|
+
let e = y.current;
|
|
278
295
|
if (t.dismissed || !e) return;
|
|
279
|
-
let n =
|
|
296
|
+
let n = P.current, r = n?.status ?? t.options.status ?? "info", i = n ? n.statusLabel : b(r, t.options.statusLabel), a = t.form === "content" && t.options.announcement !== void 0 ? t.options.announcement : X(e, A.current, n, D);
|
|
280
297
|
u(t.id, {
|
|
281
298
|
seq: t.seq,
|
|
282
299
|
text: [i, a].filter(Boolean).join(" "),
|
|
@@ -285,37 +302,37 @@ function me({ entry: t, timers: r, onDismiss: a, onExited: o, getFocusFallback:
|
|
|
285
302
|
}, [
|
|
286
303
|
t,
|
|
287
304
|
u,
|
|
288
|
-
|
|
289
|
-
|
|
305
|
+
D,
|
|
306
|
+
M
|
|
290
307
|
]);
|
|
291
|
-
let
|
|
292
|
-
|
|
293
|
-
let e =
|
|
294
|
-
|
|
308
|
+
let V = t.form === "content" ? t.options.status : void 0;
|
|
309
|
+
S.useEffect(() => {
|
|
310
|
+
let e = P.current?.status;
|
|
311
|
+
V !== void 0 && e !== void 0 && V !== e && n("Toaster:status-conflict", `Toaster: the dispatched Toast has status "${e}" but the dispatch options pass "${V}"; the Toast's status is used. Remove \`status\` from the options.`);
|
|
295
312
|
}, [
|
|
296
313
|
t,
|
|
297
|
-
|
|
298
|
-
|
|
314
|
+
V,
|
|
315
|
+
M
|
|
299
316
|
]);
|
|
300
|
-
let
|
|
301
|
-
(e.key === "Delete" || e.key === "Backspace") && (e.defaultPrevented || !
|
|
317
|
+
let W = (e) => {
|
|
318
|
+
(e.key === "Delete" || e.key === "Backspace") && (e.defaultPrevented || !re(e) || ne(e.target) || (e.preventDefault(), a(f)));
|
|
302
319
|
};
|
|
303
|
-
return g ? /* @__PURE__ */
|
|
304
|
-
ref:
|
|
320
|
+
return g ? /* @__PURE__ */ w("div", {
|
|
321
|
+
ref: T,
|
|
305
322
|
role: "group",
|
|
306
323
|
tabIndex: -1,
|
|
307
324
|
"data-wave-toast": "",
|
|
308
|
-
"aria-labelledby":
|
|
309
|
-
"aria-describedby":
|
|
310
|
-
className: e(i.toast, "rounded",
|
|
311
|
-
...
|
|
312
|
-
onKeyDown:
|
|
313
|
-
children: [
|
|
314
|
-
label:
|
|
315
|
-
id:
|
|
316
|
-
}) : null, /* @__PURE__ */
|
|
317
|
-
value:
|
|
318
|
-
children: t.form === "options" ? /* @__PURE__ */
|
|
325
|
+
"aria-labelledby": m(B, R?.id),
|
|
326
|
+
"aria-describedby": de?.id,
|
|
327
|
+
className: e(i.toast, "rounded", te),
|
|
328
|
+
...v,
|
|
329
|
+
onKeyDown: W,
|
|
330
|
+
children: [z ? /* @__PURE__ */ C(ae, {
|
|
331
|
+
label: z,
|
|
332
|
+
id: D
|
|
333
|
+
}) : null, /* @__PURE__ */ C(oe.Provider, {
|
|
334
|
+
value: L,
|
|
335
|
+
children: t.form === "options" ? /* @__PURE__ */ C(se, {
|
|
319
336
|
status: t.options.status,
|
|
320
337
|
statusLabel: t.options.statusLabel,
|
|
321
338
|
title: t.options.title,
|
|
@@ -325,55 +342,69 @@ function me({ entry: t, timers: r, onDismiss: a, onExited: o, getFocusFallback:
|
|
|
325
342
|
})]
|
|
326
343
|
}) : null;
|
|
327
344
|
}
|
|
328
|
-
|
|
329
|
-
var
|
|
330
|
-
let [
|
|
331
|
-
|
|
345
|
+
he.displayName = "ToastContainer";
|
|
346
|
+
var Z = ({ position: t = "bottom-end", limit: l, shortcuts: d, toaster: m, className: ee, style: _, children: te, onFocus: ne, onBlur: ie, onKeyDown: ae, onPointerEnter: b, onPointerLeave: oe, onPointerOver: se, ref: le, ...A }) => {
|
|
347
|
+
let [j, M] = S.useState([]), [ue, F] = S.useState(() => /* @__PURE__ */ new Map()), I = S.useCallback((e, t) => {
|
|
348
|
+
F((n) => {
|
|
332
349
|
let r = n.get(e);
|
|
333
350
|
if (r && r.seq === t.seq && r.text === t.text && r.assertive === t.assertive) return n;
|
|
334
351
|
let i = new Map(n);
|
|
335
352
|
return i.set(e, t), i;
|
|
336
353
|
});
|
|
337
|
-
}, []),
|
|
338
|
-
|
|
339
|
-
let
|
|
340
|
-
|
|
354
|
+
}, []), R = ce(j, k(l));
|
|
355
|
+
R !== j && M(R);
|
|
356
|
+
let B = R.filter((e) => e.shown);
|
|
357
|
+
S.useEffect(() => {
|
|
341
358
|
l !== void 0 && !(l >= 1) && n("Toaster:limit", `Toaster: \`limit\` must be 1 or more (got ${String(l)}); it counts as 1.`);
|
|
342
359
|
}, [l]);
|
|
343
|
-
let
|
|
344
|
-
|
|
345
|
-
let e = () => {
|
|
346
|
-
let
|
|
347
|
-
|
|
360
|
+
let H = c("toast"), U = S.useRef(0), W = S.useRef(null), fe = p(le, W), G = S.useRef(null), pe = h(), [K, me] = S.useState(L);
|
|
361
|
+
S.useLayoutEffect(() => {
|
|
362
|
+
let e = null, n = null, r = null, i = /* @__PURE__ */ new Set(), a = () => {
|
|
363
|
+
let t = de();
|
|
364
|
+
for (let n of i) t.has(n) || e?.unobserve(n);
|
|
365
|
+
for (let n of t) i.has(n) || e?.observe(n);
|
|
366
|
+
let r = t.size !== i.size || [...t].some((e) => !i.has(e));
|
|
367
|
+
if (i = t, r && n) {
|
|
368
|
+
n.disconnect();
|
|
369
|
+
for (let e of t) n.observe(e, {
|
|
370
|
+
attributes: !0,
|
|
371
|
+
attributeFilter: ["class", "style"]
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
}, o = () => {
|
|
375
|
+
let n = W.current;
|
|
376
|
+
e && n !== r && (r && e.unobserve(r), n && e.observe(n), r = n), a();
|
|
377
|
+
let i = n ? z(n, t) : L;
|
|
378
|
+
me((e) => e.inline === i.inline && e.block === i.block ? e : i);
|
|
348
379
|
};
|
|
349
|
-
e();
|
|
350
|
-
let
|
|
351
|
-
return window.addEventListener("resize",
|
|
352
|
-
n(), window.removeEventListener("resize",
|
|
380
|
+
typeof ResizeObserver < "u" && (e = new ResizeObserver(() => o())), typeof MutationObserver < "u" && (n = new MutationObserver(o)), o();
|
|
381
|
+
let s = v(o);
|
|
382
|
+
return window.addEventListener("resize", o), document.addEventListener("transitionend", o, !0), document.addEventListener("animationend", o, !0), () => {
|
|
383
|
+
s(), e?.disconnect(), n?.disconnect(), window.removeEventListener("resize", o), document.removeEventListener("transitionend", o, !0), document.removeEventListener("animationend", o, !0);
|
|
353
384
|
};
|
|
354
385
|
}, [t, pe]);
|
|
355
|
-
let [
|
|
356
|
-
|
|
357
|
-
let e = document, t = !1, n = () =>
|
|
386
|
+
let [q] = S.useState(() => N((e) => M((t) => T(t, e))));
|
|
387
|
+
S.useEffect(() => {
|
|
388
|
+
let e = document, t = !1, n = () => q.setInBackground(t || e.visibilityState === "hidden"), r = (e) => {
|
|
358
389
|
e.target instanceof Node || (t = !0, n());
|
|
359
390
|
}, i = (e) => {
|
|
360
391
|
e.target instanceof Node || (t = !1, n());
|
|
361
392
|
};
|
|
362
|
-
return n(),
|
|
363
|
-
window.removeEventListener("blur", r), window.removeEventListener("focus", i), e.removeEventListener("visibilitychange", n),
|
|
393
|
+
return n(), q.setSuspended(!1), window.addEventListener("blur", r), window.addEventListener("focus", i), e.addEventListener("visibilitychange", n), () => {
|
|
394
|
+
window.removeEventListener("blur", r), window.removeEventListener("focus", i), e.removeEventListener("visibilitychange", n), q.setSuspended(!0);
|
|
364
395
|
};
|
|
365
|
-
}, [
|
|
366
|
-
let
|
|
367
|
-
|
|
368
|
-
let n =
|
|
396
|
+
}, [q]);
|
|
397
|
+
let J = S.useCallback((e, t) => {
|
|
398
|
+
U.current += 1;
|
|
399
|
+
let n = U.current, r = o(e) ? {
|
|
369
400
|
form: "options",
|
|
370
401
|
options: e
|
|
371
402
|
} : {
|
|
372
403
|
form: "content",
|
|
373
404
|
content: e,
|
|
374
405
|
options: t ?? {}
|
|
375
|
-
}, i = r.options.toastId ?? `${
|
|
376
|
-
return
|
|
406
|
+
}, i = r.options.toastId ?? `${H}-${n}`;
|
|
407
|
+
return M((e) => {
|
|
377
408
|
let t = e.findIndex((e) => e.id === i), a = t !== -1 && e[t].shown, o = {
|
|
378
409
|
...r,
|
|
379
410
|
id: i,
|
|
@@ -385,180 +416,181 @@ var Y = ({ position: t = "bottom-end", limit: l, shortcuts: d, toaster: p, class
|
|
|
385
416
|
let s = e.slice();
|
|
386
417
|
return s[t] = o, s;
|
|
387
418
|
}), i;
|
|
388
|
-
}, [
|
|
389
|
-
|
|
390
|
-
}, [
|
|
391
|
-
|
|
392
|
-
}, [
|
|
393
|
-
|
|
419
|
+
}, [H]), Y = S.useCallback((e) => {
|
|
420
|
+
q.remove(e), M((t) => T(t, e));
|
|
421
|
+
}, [q]), X = S.useCallback(() => {
|
|
422
|
+
q.clear(), M((e) => E(e));
|
|
423
|
+
}, [q]), Z = S.useCallback((e) => {
|
|
424
|
+
M((t) => t.some((t) => t.id === e && t.dismissed) ? t.filter((t) => !(t.id === e && t.dismissed)) : t), F((t) => {
|
|
394
425
|
if (!t.has(e)) return t;
|
|
395
426
|
let n = new Map(t);
|
|
396
427
|
return n.delete(e), n;
|
|
397
428
|
});
|
|
398
|
-
}, []),
|
|
399
|
-
dispatchToast:
|
|
400
|
-
dismissToast:
|
|
401
|
-
dismissAllToasts:
|
|
429
|
+
}, []), Q = S.useMemo(() => ({
|
|
430
|
+
dispatchToast: J,
|
|
431
|
+
dismissToast: Y,
|
|
432
|
+
dismissAllToasts: X
|
|
402
433
|
}), [
|
|
403
|
-
q,
|
|
404
434
|
J,
|
|
405
|
-
Y
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
435
|
+
Y,
|
|
436
|
+
X
|
|
437
|
+
]), [ge] = S.useState(() => ({}));
|
|
438
|
+
S.useLayoutEffect(() => {
|
|
439
|
+
if (!m) return;
|
|
440
|
+
let e = a(m, ge, Q);
|
|
410
441
|
if (e.status === "bound") return e.unbind;
|
|
411
442
|
e.status === "taken" ? n("Toaster:handle-bound", "Toaster: this handle is already bound to another Toaster; a handle binds one Toaster. Create one handle per Toaster.") : n("Toaster:handle-unknown", "Toaster: `toaster` is not a handle from createToaster(), so nothing is bound. Pass the value createToaster() returns.");
|
|
412
443
|
}, [
|
|
413
|
-
|
|
444
|
+
m,
|
|
414
445
|
ge,
|
|
415
|
-
|
|
446
|
+
Q
|
|
416
447
|
]);
|
|
417
|
-
let _e =
|
|
418
|
-
let t =
|
|
448
|
+
let _e = S.useCallback((e) => {
|
|
449
|
+
let t = W.current, n = t ? Array.from(t.children).filter((e) => e instanceof HTMLElement && e.hasAttribute("data-wave-toast")) : [], r = !!e && e.ownerDocument.activeElement === e, i = e ? n.indexOf(e) : -1, a = (t) => t !== e && t.isConnected && t.getAttribute("data-presence") !== "exiting", o = n.slice(i + 1).find(a), s = i > 0 ? n.slice(0, i).reverse().find(a) : void 0;
|
|
419
450
|
for (let e of [o, s]) {
|
|
420
451
|
if (!e) continue;
|
|
421
452
|
let t = r ? e : u(e);
|
|
422
453
|
if (t) return t;
|
|
423
454
|
}
|
|
424
|
-
let c =
|
|
425
|
-
return
|
|
426
|
-
}, []),
|
|
427
|
-
let e =
|
|
455
|
+
let c = G.current;
|
|
456
|
+
return G.current = null, c?.isConnected ? c : null;
|
|
457
|
+
}, []), $ = s(() => {
|
|
458
|
+
let e = W.current;
|
|
428
459
|
if (!e) return;
|
|
429
460
|
let t = e.ownerDocument;
|
|
430
461
|
if (t.activeElement && t.activeElement !== t.body) return;
|
|
431
|
-
let n =
|
|
432
|
-
|
|
433
|
-
let r =
|
|
434
|
-
|
|
462
|
+
let n = q.isPaused("focus");
|
|
463
|
+
q.setPaused("focus", !1);
|
|
464
|
+
let r = G.current;
|
|
465
|
+
G.current = null, n && r && f(r) && r.focus({ preventScroll: !0 });
|
|
435
466
|
});
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
}, [
|
|
439
|
-
let
|
|
440
|
-
|
|
467
|
+
S.useLayoutEffect(() => {
|
|
468
|
+
$();
|
|
469
|
+
}, [R, $]), S.useLayoutEffect(() => v(() => queueMicrotask($)), [$]);
|
|
470
|
+
let ve = S.useRef(null);
|
|
471
|
+
S.useEffect(() => {
|
|
441
472
|
let e = (e) => {
|
|
442
|
-
let t =
|
|
443
|
-
if (
|
|
444
|
-
let n =
|
|
445
|
-
n && e.target instanceof Node &&
|
|
473
|
+
let t = ve.current === e;
|
|
474
|
+
if (ve.current = null, t || !q.isPaused("hover")) return;
|
|
475
|
+
let n = W.current;
|
|
476
|
+
n && e.target instanceof Node && O(n, e.target) || q.setPaused("hover", !1);
|
|
446
477
|
};
|
|
447
478
|
return document.addEventListener("pointerover", e), () => document.removeEventListener("pointerover", e);
|
|
448
|
-
}, [
|
|
449
|
-
let
|
|
450
|
-
|
|
451
|
-
|
|
479
|
+
}, [q]);
|
|
480
|
+
let ye = S.useRef(R);
|
|
481
|
+
S.useLayoutEffect(() => {
|
|
482
|
+
ye.current = R;
|
|
452
483
|
});
|
|
453
|
-
let
|
|
454
|
-
t ?
|
|
455
|
-
}, []),
|
|
484
|
+
let be = S.useRef(/* @__PURE__ */ new Map()), xe = S.useCallback((e, t) => {
|
|
485
|
+
t ? be.current.set(e, t) : be.current.delete(e);
|
|
486
|
+
}, []), Se = typeof d?.focus == "function", Ce = s((e) => {
|
|
456
487
|
if (e.defaultPrevented || e.isComposing || !d?.focus?.(e)) return;
|
|
457
|
-
let t =
|
|
488
|
+
let t = D(ye.current), n = t ? be.current.get(t.id) : void 0;
|
|
458
489
|
if (!n?.isConnected) return;
|
|
459
490
|
e.preventDefault();
|
|
460
|
-
let r =
|
|
461
|
-
i instanceof HTMLElement && i !== n.ownerDocument.body && !(r &&
|
|
491
|
+
let r = W.current, i = n.ownerDocument.activeElement;
|
|
492
|
+
i instanceof HTMLElement && i !== n.ownerDocument.body && !(r && O(r, i)) && (G.current = i), n.focus({ preventScroll: !1 });
|
|
462
493
|
});
|
|
463
|
-
|
|
464
|
-
if (!
|
|
465
|
-
let e = (e) =>
|
|
494
|
+
S.useEffect(() => {
|
|
495
|
+
if (!Se) return;
|
|
496
|
+
let e = (e) => Ce(e);
|
|
466
497
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
467
|
-
}, [
|
|
468
|
-
let
|
|
498
|
+
}, [Se, Ce]);
|
|
499
|
+
let we = (e) => {
|
|
469
500
|
let t = e.relatedTarget;
|
|
470
|
-
t instanceof HTMLElement && f(t) && (
|
|
471
|
-
},
|
|
501
|
+
t instanceof HTMLElement && f(t) && (O(e.currentTarget, t) || (G.current = t));
|
|
502
|
+
}, Te = (e) => {
|
|
472
503
|
let t = e.currentTarget, n = e.relatedTarget;
|
|
473
|
-
if (!(n instanceof Node &&
|
|
504
|
+
if (!(n instanceof Node && O(t, n)) && !e.target.closest("[data-wave-toast][data-presence=\"exiting\"]")) {
|
|
474
505
|
if (n === null) {
|
|
475
506
|
let n = e.target;
|
|
476
507
|
if (!n.isConnected) return;
|
|
477
508
|
let r = n.ownerDocument.activeElement;
|
|
478
|
-
if (r &&
|
|
509
|
+
if (r && O(t, r)) return;
|
|
479
510
|
}
|
|
480
|
-
|
|
511
|
+
G.current = null;
|
|
481
512
|
}
|
|
482
|
-
},
|
|
483
|
-
if (e.key !== "Escape" && e.key !== "Esc" || e.defaultPrevented || e.nativeEvent.isComposing || !
|
|
513
|
+
}, Ee = (e) => {
|
|
514
|
+
if (e.key !== "Escape" && e.key !== "Esc" || e.defaultPrevented || e.nativeEvent.isComposing || !re(e)) return;
|
|
484
515
|
let t = e.currentTarget;
|
|
485
|
-
if (
|
|
516
|
+
if (g().some((e) => e.escape && t.contains(e.getAnchor()))) return;
|
|
486
517
|
e.preventDefault();
|
|
487
|
-
let n =
|
|
488
|
-
|
|
489
|
-
},
|
|
490
|
-
for (let e of
|
|
518
|
+
let n = G.current;
|
|
519
|
+
G.current = null, n?.isConnected && n.focus({ preventScroll: !0 }), X();
|
|
520
|
+
}, De = [], Oe = [];
|
|
521
|
+
for (let e of B) {
|
|
491
522
|
if (e.dismissed) continue;
|
|
492
|
-
let t =
|
|
523
|
+
let t = ue.get(e.id);
|
|
493
524
|
if (!t || t.seq !== e.seq || !t.text) continue;
|
|
494
|
-
let n = /* @__PURE__ */
|
|
495
|
-
(t.assertive ?
|
|
525
|
+
let n = /* @__PURE__ */ C(V, { text: t.text }, t.seq);
|
|
526
|
+
(t.assertive ? Oe : De).push(n);
|
|
496
527
|
}
|
|
497
|
-
let
|
|
498
|
-
...
|
|
499
|
-
"--wave-toaster-offset": `${
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
528
|
+
let ke = K.inline > 0 || K.block > 0 ? {
|
|
529
|
+
..._,
|
|
530
|
+
...K.inline > 0 && { "--wave-toaster-offset": `${K.inline}px` },
|
|
531
|
+
...K.block > 0 && { "--wave-toaster-offset-block": `${K.block}px` }
|
|
532
|
+
} : _;
|
|
533
|
+
return /* @__PURE__ */ w(x.Provider, {
|
|
534
|
+
value: Q,
|
|
535
|
+
children: [te, /* @__PURE__ */ C(y, {
|
|
504
536
|
layer: "toast",
|
|
505
|
-
children: /* @__PURE__ */
|
|
506
|
-
ref:
|
|
537
|
+
children: /* @__PURE__ */ w("div", {
|
|
538
|
+
ref: fe,
|
|
507
539
|
role: "region",
|
|
508
540
|
"aria-label": "Notifications",
|
|
509
541
|
"data-wave-focus-trap-allow": "",
|
|
510
542
|
"data-position": t,
|
|
511
|
-
...
|
|
512
|
-
style:
|
|
543
|
+
...A,
|
|
544
|
+
style: ke,
|
|
513
545
|
onFocus: (e) => {
|
|
514
|
-
|
|
546
|
+
ne?.(e), we(e), q.setPaused("focus", !0);
|
|
515
547
|
},
|
|
516
548
|
onBlur: (e) => {
|
|
517
|
-
|
|
549
|
+
ie?.(e), Te(e);
|
|
518
550
|
let t = e.relatedTarget;
|
|
519
|
-
t instanceof Node &&
|
|
551
|
+
t instanceof Node && O(e.currentTarget, t) || q.setPaused("focus", !1);
|
|
520
552
|
},
|
|
521
553
|
onPointerEnter: (e) => {
|
|
522
|
-
|
|
554
|
+
b?.(e), q.setPaused("hover", !0);
|
|
523
555
|
},
|
|
524
556
|
onPointerLeave: (e) => {
|
|
525
|
-
|
|
557
|
+
oe?.(e), q.setPaused("hover", !1);
|
|
526
558
|
},
|
|
527
559
|
onPointerOver: (e) => {
|
|
528
|
-
|
|
560
|
+
se?.(e), ve.current = e.nativeEvent;
|
|
529
561
|
},
|
|
530
|
-
onKeyDown: (e) => r(
|
|
531
|
-
className: e(i.root, "fixed flex w-80 max-w-[calc(100vw-2rem)] flex-col gap-2",
|
|
562
|
+
onKeyDown: (e) => r(ae, Ee)(e),
|
|
563
|
+
className: e(i.root, "fixed flex w-80 max-w-[calc(100vw-2rem)] flex-col gap-2", P[t], ee),
|
|
532
564
|
children: [
|
|
533
|
-
/* @__PURE__ */
|
|
565
|
+
/* @__PURE__ */ C("div", {
|
|
534
566
|
role: "status",
|
|
535
567
|
"aria-live": "polite",
|
|
536
568
|
"aria-atomic": "false",
|
|
537
569
|
className: "sr-only",
|
|
538
|
-
children:
|
|
570
|
+
children: De
|
|
539
571
|
}),
|
|
540
|
-
/* @__PURE__ */
|
|
572
|
+
/* @__PURE__ */ C("div", {
|
|
541
573
|
"aria-live": "assertive",
|
|
542
574
|
"aria-atomic": "false",
|
|
543
575
|
className: "sr-only",
|
|
544
|
-
children:
|
|
576
|
+
children: Oe
|
|
545
577
|
}),
|
|
546
|
-
|
|
578
|
+
B.map((e) => /* @__PURE__ */ C(he, {
|
|
547
579
|
entry: e,
|
|
548
|
-
timers:
|
|
549
|
-
onDismiss:
|
|
550
|
-
onExited:
|
|
580
|
+
timers: q,
|
|
581
|
+
onDismiss: Y,
|
|
582
|
+
onExited: Z,
|
|
551
583
|
getFocusFallback: _e,
|
|
552
|
-
announce:
|
|
553
|
-
registerContainer:
|
|
584
|
+
announce: I,
|
|
585
|
+
registerContainer: xe
|
|
554
586
|
}, e.id))
|
|
555
587
|
]
|
|
556
588
|
})
|
|
557
589
|
})]
|
|
558
590
|
});
|
|
559
591
|
};
|
|
560
|
-
|
|
592
|
+
Z.displayName = "Toaster";
|
|
561
593
|
//#endregion
|
|
562
|
-
export {
|
|
594
|
+
export { Z as Toaster, M as useToastController };
|
|
563
595
|
|
|
564
596
|
//# sourceMappingURL=Toaster.mjs.map
|