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