@konstructio/ui 0.1.2-alpha.21 → 0.1.2-alpha.23
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/{Modal-B8jrP02v.js → Modal-Dpk-1N9W.js} +2 -2
- package/dist/chevron-down-DgT-uSF9.js +5 -0
- package/dist/chevron-right-DYvXLeql.js +7 -0
- package/dist/components/Alert/Alert.js +2 -2
- package/dist/components/AlertDialog/AlertDialog.js +1 -1
- package/dist/components/AlertDialog/components/AlertDialogTrigger.js +1 -1
- package/dist/components/AlertDialog/components/index.js +1 -1
- package/dist/components/Badge/Badge.js +2 -8
- package/dist/components/Breadcrumb/Breadcrumb.js +1 -1
- package/dist/components/Breadcrumb/components/Item/Item.js +1 -1
- package/dist/components/Breadcrumb/hooks/useBreadcrumb.js +1 -1
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Checkbox/Checkbox.js +6 -7
- package/dist/components/Command/Command.js +2 -2
- package/dist/components/Command/components/Command.js +1 -1
- package/dist/components/Command/components/CommandEmpty.js +1 -1
- package/dist/components/Command/components/CommandGroup.js +1 -1
- package/dist/components/Command/components/CommandInput.js +2 -2
- package/dist/components/Command/components/CommandItem.js +1 -1
- package/dist/components/Command/components/CommandList.js +1 -1
- package/dist/components/Command/components/CommandSeparator.js +1 -1
- package/dist/components/Command/components/DialogContent.js +2 -2
- package/dist/components/Command/components/DialogOverlay.js +1 -1
- package/dist/components/Datepicker/DatePicker.js +1 -1
- package/dist/components/Dropdown/components/List/List.js +1 -1
- package/dist/components/Dropdown/components/Wrapper.js +1 -13
- package/dist/components/DropdownButton/DropdownButton.js +1 -1
- package/dist/components/Filter/components/BadgeDropdown/BadgeMultiSelect.js +1 -1
- package/dist/components/Filter/components/DateFilterDropdown/DateFilterDropdown.js +1 -1
- package/dist/components/Input/Input.js +1 -1
- package/dist/components/Loading/Loading.js +1 -7
- package/dist/components/Modal/Modal.js +1 -1
- package/dist/components/Modal/components/Body/Body.js +1 -1
- package/dist/components/Modal/components/Footer/Footer.js +1 -1
- package/dist/components/Modal/components/Header/Header.js +1 -1
- package/dist/components/Modal/components/Wrapper/Wrapper.js +3 -3
- package/dist/components/Modal/components/index.js +1 -1
- package/dist/components/NumberInput/NumberInput.js +2 -2
- package/dist/components/PieChart/PieChart.js +0 -18
- package/dist/components/RadioGroup/RadioGroup.js +1 -1
- package/dist/components/Range/Range.js +1 -1
- package/dist/components/Slider/Slider.js +1 -1
- package/dist/components/Switch/Switch.js +10 -11
- package/dist/components/Tabs/Tabs.js +1 -1
- package/dist/components/Tabs/components/Content.js +1 -1
- package/dist/components/Tabs/components/List.js +1 -1
- package/dist/components/Tabs/components/Trigger.js +1 -1
- package/dist/components/Tag/Tag.js +1 -1
- package/dist/components/TagSelect/components/Wrapper/Wrapper.js +2 -2
- package/dist/components/TimePicker/components/Wrapper/Wrapper.js +1 -1
- package/dist/components/Toast/Toast.js +233 -210
- package/dist/components/Tooltip/Tooltip.js +1 -1
- package/dist/components/VirtualizedTable/VirtualizedTable.js +70 -72
- package/dist/components/VirtualizedTable/components/Actions/Actions.js +2 -2
- package/dist/components/VirtualizedTable/components/Body/Body.js +45 -23
- package/dist/components/VirtualizedTable/components/DotPaginate/DotPaginate.js +1 -1
- package/dist/components/VirtualizedTable/components/Header/Header.js +40 -38
- package/dist/components/VirtualizedTable/components/Pagination/Pagination.js +25 -17
- package/dist/components/VirtualizedTable/components/Skeleton/Skeleton.js +67 -0
- package/dist/components/VirtualizedTable/components/TruncateText/TruncateText.js +263 -236
- package/dist/components/VirtualizedTable/components/WrapperBody/WrapperBody.js +27 -0
- package/dist/components/VirtualizedTable/components/index.js +8 -6
- package/dist/components/VirtualizedTable/contexts/table.context.js +1 -0
- package/dist/components/VirtualizedTable/contexts/table.provider.js +43 -42
- package/dist/components/index.js +1 -1
- package/dist/contexts/theme.provider.js +0 -1
- package/dist/{createLucideIcon-DGhJ8Z4k.js → createLucideIcon-D4r5Phnh.js} +0 -24
- package/dist/{ellipsis-vertical-DpnVYRxI.js → ellipsis-vertical-BVPtjl5f.js} +1 -7
- package/dist/{index-N2OStZoU.js → index--V_ZsiQe.js} +0 -21
- package/dist/{index-bwWKd82e.js → index-BbQkJE5L.js} +1 -1
- package/dist/index-BtQfgaSF.js +60 -0
- package/dist/index-CIAmiWcw.js +200 -0
- package/dist/index-CSFe9uC5.js +14 -0
- package/dist/{index-Dx2grAuN.js → index-CSWGJT-v.js} +0 -20
- package/dist/index-CigKKiZS.js +91 -0
- package/dist/index-DDByhzds.js +137 -0
- package/dist/{index-DQJhMz8c.js → index-DH2Fnov1.js} +11 -12
- package/dist/index-DLcqcWxM.js +29 -0
- package/dist/{index-CffpTFMi.js → index-Dbt2vBmS.js} +5 -6
- package/dist/{index-l3NwplN0.js → index-DpW9ExsS.js} +10 -11
- package/dist/index-DrWQH0QF.js +55 -0
- package/dist/{index-0XtjXVpJ.js → index-X4k_cU8k.js} +4 -4
- package/dist/index-kyuBfLcN.js +479 -0
- package/dist/{index-C1g_chDT.js → index-mPY_8Y5v.js} +2 -2
- package/dist/{index-BAEWsOG1.js → index-ohdbKsws.js} +1 -1
- package/dist/index.d.ts +9 -0
- package/dist/index.js +1 -1
- package/dist/package.json +18 -18
- package/dist/styles.css +1 -1
- package/dist/{useBreadcrumb-B8DnuqkR.js → useBreadcrumb-BAHbGQ_O.js} +0 -10
- package/dist/utils/index.js +534 -501
- package/dist/{x-4F_5p77m.js → x-DPU9OdYH.js} +1 -1
- package/package.json +18 -18
- package/dist/chevron-down-J5nS1Tu0.js +0 -11
- package/dist/chevron-right-DeMVrnIg.js +0 -19
- package/dist/components/Skeleton/Skeleton.js +0 -42
- package/dist/index-BVRIAMfe.js +0 -36
- package/dist/index-BfXxHr_2.js +0 -125
- package/dist/index-Bn4c-gww.js +0 -131
- package/dist/index-Cvx4lqTq.js +0 -47
- package/dist/index-DQH6odE9.js +0 -82
- package/dist/index-DdXGVVBv.js +0 -15
- package/dist/index-amYX3uxF.js +0 -436
- package/dist/index-sp5ZfG6g.js +0 -31
|
@@ -1,114 +1,137 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
1
|
+
import { jsx as a, jsxs as D, Fragment as ae } from "react/jsx-runtime";
|
|
2
|
+
import { S as B } from "../../index-BtQfgaSF.js";
|
|
3
3
|
import * as n from "react";
|
|
4
|
-
import { useRef as xe, useEffect as be, useMemo as
|
|
4
|
+
import { useRef as xe, useEffect as be, useMemo as re, isValidElement as ne, useCallback as ge } from "react";
|
|
5
5
|
import * as Se from "react-dom";
|
|
6
|
-
import { c as Ie, a as Ne, b as x,
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { P as Me } from "../../index-
|
|
11
|
-
import { P as
|
|
12
|
-
import { u as
|
|
13
|
-
import {
|
|
6
|
+
import { P as A, c as Ie, a as Ne, b as x, d as Ae, u as De } from "../../index-CIAmiWcw.js";
|
|
7
|
+
import { u as ie } from "../../index-DLcqcWxM.js";
|
|
8
|
+
import { c as _e } from "../../index-CigKKiZS.js";
|
|
9
|
+
import { B as Fe, R as Le } from "../../index-Dbt2vBmS.js";
|
|
10
|
+
import { P as Me } from "../../index-CSFe9uC5.js";
|
|
11
|
+
import { P as Oe } from "../../index-mPY_8Y5v.js";
|
|
12
|
+
import { u as X } from "../../index-0ioNhtNM.js";
|
|
13
|
+
import { R as ke } from "../../index-DrWQH0QF.js";
|
|
14
14
|
import { cn as j } from "../../utils/index.js";
|
|
15
15
|
import { closeToastVariants as Ve, toastVariants as Ke, viewportToastVariants as He } from "./Toast.variants.js";
|
|
16
|
-
import { X as We } from "../../x-
|
|
17
|
-
var
|
|
16
|
+
import { X as We } from "../../x-DPU9OdYH.js";
|
|
17
|
+
var Ue = Object.freeze({
|
|
18
|
+
// See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
|
|
19
|
+
position: "absolute",
|
|
20
|
+
border: 0,
|
|
21
|
+
width: 1,
|
|
22
|
+
height: 1,
|
|
23
|
+
padding: 0,
|
|
24
|
+
margin: -1,
|
|
25
|
+
overflow: "hidden",
|
|
26
|
+
clip: "rect(0, 0, 0, 0)",
|
|
27
|
+
whiteSpace: "nowrap",
|
|
28
|
+
wordWrap: "normal"
|
|
29
|
+
}), Xe = "VisuallyHidden", Q = n.forwardRef(
|
|
30
|
+
(e, o) => /* @__PURE__ */ a(
|
|
31
|
+
A.span,
|
|
32
|
+
{
|
|
33
|
+
...e,
|
|
34
|
+
ref: o,
|
|
35
|
+
style: { ...Ue, ...e.style }
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
);
|
|
39
|
+
Q.displayName = Xe;
|
|
40
|
+
var Z = "ToastProvider", [ee, Ye, $e] = _e("Toast"), [ce, St] = Ie("Toast", [$e]), [Be, Y] = ce(Z), ue = (e) => {
|
|
18
41
|
const {
|
|
19
|
-
__scopeToast:
|
|
20
|
-
label:
|
|
42
|
+
__scopeToast: o,
|
|
43
|
+
label: r = "Notification",
|
|
21
44
|
duration: t = 5e3,
|
|
22
45
|
swipeDirection: c = "right",
|
|
23
46
|
swipeThreshold: d = 50,
|
|
24
|
-
children:
|
|
25
|
-
} = e, [
|
|
26
|
-
return
|
|
27
|
-
`Invalid prop \`label\` supplied to \`${
|
|
28
|
-
), /* @__PURE__ */
|
|
29
|
-
|
|
47
|
+
children: p
|
|
48
|
+
} = e, [w, v] = n.useState(null), [i, E] = n.useState(0), T = n.useRef(!1), S = n.useRef(!1);
|
|
49
|
+
return r.trim() || console.error(
|
|
50
|
+
`Invalid prop \`label\` supplied to \`${Z}\`. Expected non-empty \`string\`.`
|
|
51
|
+
), /* @__PURE__ */ a(ee.Provider, { scope: o, children: /* @__PURE__ */ a(
|
|
52
|
+
Be,
|
|
30
53
|
{
|
|
31
|
-
scope:
|
|
32
|
-
label:
|
|
54
|
+
scope: o,
|
|
55
|
+
label: r,
|
|
33
56
|
duration: t,
|
|
34
57
|
swipeDirection: c,
|
|
35
58
|
swipeThreshold: d,
|
|
36
|
-
toastCount:
|
|
37
|
-
viewport:
|
|
59
|
+
toastCount: i,
|
|
60
|
+
viewport: w,
|
|
38
61
|
onViewportChange: v,
|
|
39
62
|
onToastAdd: n.useCallback(() => E((b) => b + 1), []),
|
|
40
63
|
onToastRemove: n.useCallback(() => E((b) => b - 1), []),
|
|
41
|
-
isFocusedToastEscapeKeyDownRef:
|
|
64
|
+
isFocusedToastEscapeKeyDownRef: T,
|
|
42
65
|
isClosePausedRef: S,
|
|
43
|
-
children:
|
|
66
|
+
children: p
|
|
44
67
|
}
|
|
45
68
|
) });
|
|
46
69
|
};
|
|
47
|
-
ue.displayName =
|
|
48
|
-
var le = "ToastViewport",
|
|
49
|
-
(e,
|
|
70
|
+
ue.displayName = Z;
|
|
71
|
+
var le = "ToastViewport", je = ["F8"], z = "toast.viewportPause", G = "toast.viewportResume", de = n.forwardRef(
|
|
72
|
+
(e, o) => {
|
|
50
73
|
const {
|
|
51
|
-
__scopeToast:
|
|
52
|
-
hotkey: t =
|
|
74
|
+
__scopeToast: r,
|
|
75
|
+
hotkey: t = je,
|
|
53
76
|
label: c = "Notifications ({hotkey})",
|
|
54
77
|
...d
|
|
55
|
-
} = e,
|
|
78
|
+
} = e, p = Y(le, r), w = Ye(r), v = n.useRef(null), i = n.useRef(null), E = n.useRef(null), T = n.useRef(null), S = ie(o, T, p.onViewportChange), b = t.join("+").replace(/Key/g, "").replace(/Digit/g, ""), R = p.toastCount > 0;
|
|
56
79
|
n.useEffect(() => {
|
|
57
80
|
const u = (h) => {
|
|
58
|
-
t.length !== 0 && t.every((m) => h[m] || h.code === m) &&
|
|
81
|
+
t.length !== 0 && t.every((m) => h[m] || h.code === m) && T.current?.focus();
|
|
59
82
|
};
|
|
60
83
|
return document.addEventListener("keydown", u), () => document.removeEventListener("keydown", u);
|
|
61
84
|
}, [t]), n.useEffect(() => {
|
|
62
|
-
const u = v.current, h =
|
|
85
|
+
const u = v.current, h = T.current;
|
|
63
86
|
if (R && u && h) {
|
|
64
|
-
const
|
|
65
|
-
if (!
|
|
87
|
+
const f = () => {
|
|
88
|
+
if (!p.isClosePausedRef.current) {
|
|
66
89
|
const y = new CustomEvent(z);
|
|
67
|
-
h.dispatchEvent(y),
|
|
90
|
+
h.dispatchEvent(y), p.isClosePausedRef.current = !0;
|
|
68
91
|
}
|
|
69
92
|
}, m = () => {
|
|
70
|
-
if (
|
|
93
|
+
if (p.isClosePausedRef.current) {
|
|
71
94
|
const y = new CustomEvent(G);
|
|
72
|
-
h.dispatchEvent(y),
|
|
95
|
+
h.dispatchEvent(y), p.isClosePausedRef.current = !1;
|
|
73
96
|
}
|
|
74
97
|
}, P = (y) => {
|
|
75
98
|
!u.contains(y.relatedTarget) && m();
|
|
76
99
|
}, C = () => {
|
|
77
100
|
u.contains(document.activeElement) || m();
|
|
78
101
|
};
|
|
79
|
-
return u.addEventListener("focusin",
|
|
80
|
-
u.removeEventListener("focusin",
|
|
102
|
+
return u.addEventListener("focusin", f), u.addEventListener("focusout", P), u.addEventListener("pointermove", f), u.addEventListener("pointerleave", C), window.addEventListener("blur", f), window.addEventListener("focus", m), () => {
|
|
103
|
+
u.removeEventListener("focusin", f), u.removeEventListener("focusout", P), u.removeEventListener("pointermove", f), u.removeEventListener("pointerleave", C), window.removeEventListener("blur", f), window.removeEventListener("focus", m);
|
|
81
104
|
};
|
|
82
105
|
}
|
|
83
|
-
}, [R,
|
|
106
|
+
}, [R, p.isClosePausedRef]);
|
|
84
107
|
const l = n.useCallback(
|
|
85
108
|
({ tabbingDirection: u }) => {
|
|
86
|
-
const
|
|
87
|
-
const P = m.ref.current, C = [P, ...
|
|
109
|
+
const f = w().map((m) => {
|
|
110
|
+
const P = m.ref.current, C = [P, ...at(P)];
|
|
88
111
|
return u === "forwards" ? C : C.reverse();
|
|
89
112
|
});
|
|
90
|
-
return (u === "forwards" ?
|
|
113
|
+
return (u === "forwards" ? f.reverse() : f).flat();
|
|
91
114
|
},
|
|
92
|
-
[
|
|
115
|
+
[w]
|
|
93
116
|
);
|
|
94
117
|
return n.useEffect(() => {
|
|
95
|
-
const u =
|
|
118
|
+
const u = T.current;
|
|
96
119
|
if (u) {
|
|
97
|
-
const h = (
|
|
98
|
-
const m =
|
|
99
|
-
if (
|
|
100
|
-
const C = document.activeElement, y =
|
|
101
|
-
if (
|
|
102
|
-
|
|
120
|
+
const h = (f) => {
|
|
121
|
+
const m = f.altKey || f.ctrlKey || f.metaKey;
|
|
122
|
+
if (f.key === "Tab" && !m) {
|
|
123
|
+
const C = document.activeElement, y = f.shiftKey;
|
|
124
|
+
if (f.target === u && y) {
|
|
125
|
+
i.current?.focus();
|
|
103
126
|
return;
|
|
104
127
|
}
|
|
105
|
-
const
|
|
106
|
-
q(
|
|
128
|
+
const F = l({ tabbingDirection: y ? "backwards" : "forwards" }), V = F.findIndex((N) => N === C);
|
|
129
|
+
q(F.slice(V + 1)) ? f.preventDefault() : y ? i.current?.focus() : E.current?.focus();
|
|
107
130
|
}
|
|
108
131
|
};
|
|
109
132
|
return u.addEventListener("keydown", h), () => u.removeEventListener("keydown", h);
|
|
110
133
|
}
|
|
111
|
-
}, [
|
|
134
|
+
}, [w, l]), /* @__PURE__ */ D(
|
|
112
135
|
Fe,
|
|
113
136
|
{
|
|
114
137
|
ref: v,
|
|
@@ -117,10 +140,10 @@ var le = "ToastViewport", Ye = ["F8"], z = "toast.viewportPause", G = "toast.vie
|
|
|
117
140
|
tabIndex: -1,
|
|
118
141
|
style: { pointerEvents: R ? void 0 : "none" },
|
|
119
142
|
children: [
|
|
120
|
-
R && /* @__PURE__ */
|
|
143
|
+
R && /* @__PURE__ */ a(
|
|
121
144
|
J,
|
|
122
145
|
{
|
|
123
|
-
ref:
|
|
146
|
+
ref: i,
|
|
124
147
|
onFocusFromOutsideViewport: () => {
|
|
125
148
|
const u = l({
|
|
126
149
|
tabbingDirection: "forwards"
|
|
@@ -129,8 +152,8 @@ var le = "ToastViewport", Ye = ["F8"], z = "toast.viewportPause", G = "toast.vie
|
|
|
129
152
|
}
|
|
130
153
|
}
|
|
131
154
|
),
|
|
132
|
-
/* @__PURE__ */
|
|
133
|
-
R && /* @__PURE__ */
|
|
155
|
+
/* @__PURE__ */ a(ee.Slot, { scope: r, children: /* @__PURE__ */ a(A.ol, { tabIndex: -1, ...d, ref: S }) }),
|
|
156
|
+
R && /* @__PURE__ */ a(
|
|
134
157
|
J,
|
|
135
158
|
{
|
|
136
159
|
ref: E,
|
|
@@ -148,82 +171,82 @@ var le = "ToastViewport", Ye = ["F8"], z = "toast.viewportPause", G = "toast.vie
|
|
|
148
171
|
}
|
|
149
172
|
);
|
|
150
173
|
de.displayName = le;
|
|
151
|
-
var
|
|
152
|
-
(e,
|
|
153
|
-
const { __scopeToast:
|
|
154
|
-
return /* @__PURE__ */
|
|
155
|
-
|
|
174
|
+
var pe = "ToastFocusProxy", J = n.forwardRef(
|
|
175
|
+
(e, o) => {
|
|
176
|
+
const { __scopeToast: r, onFocusFromOutsideViewport: t, ...c } = e, d = Y(pe, r);
|
|
177
|
+
return /* @__PURE__ */ a(
|
|
178
|
+
Q,
|
|
156
179
|
{
|
|
157
180
|
tabIndex: 0,
|
|
158
181
|
...c,
|
|
159
|
-
ref:
|
|
182
|
+
ref: o,
|
|
160
183
|
style: { position: "fixed" },
|
|
161
|
-
onFocus: (
|
|
162
|
-
const
|
|
163
|
-
!d.viewport?.contains(
|
|
184
|
+
onFocus: (p) => {
|
|
185
|
+
const w = p.relatedTarget;
|
|
186
|
+
!d.viewport?.contains(w) && t();
|
|
164
187
|
}
|
|
165
188
|
}
|
|
166
189
|
);
|
|
167
190
|
}
|
|
168
191
|
);
|
|
169
|
-
J.displayName =
|
|
170
|
-
var O = "Toast",
|
|
171
|
-
(e,
|
|
172
|
-
const { forceMount:
|
|
192
|
+
J.displayName = pe;
|
|
193
|
+
var O = "Toast", qe = "toast.swipeStart", ze = "toast.swipeMove", Ge = "toast.swipeCancel", Je = "toast.swipeEnd", fe = n.forwardRef(
|
|
194
|
+
(e, o) => {
|
|
195
|
+
const { forceMount: r, open: t, defaultOpen: c, onOpenChange: d, ...p } = e, [w, v] = Ne({
|
|
173
196
|
prop: t,
|
|
174
197
|
defaultProp: c ?? !0,
|
|
175
198
|
onChange: d,
|
|
176
199
|
caller: O
|
|
177
200
|
});
|
|
178
|
-
return /* @__PURE__ */
|
|
179
|
-
|
|
201
|
+
return /* @__PURE__ */ a(Oe, { present: r || w, children: /* @__PURE__ */ a(
|
|
202
|
+
et,
|
|
180
203
|
{
|
|
181
|
-
open:
|
|
182
|
-
...
|
|
183
|
-
ref:
|
|
204
|
+
open: w,
|
|
205
|
+
...p,
|
|
206
|
+
ref: o,
|
|
184
207
|
onClose: () => v(!1),
|
|
185
|
-
onPause:
|
|
186
|
-
onResume:
|
|
187
|
-
onSwipeStart: x(e.onSwipeStart, (
|
|
188
|
-
|
|
208
|
+
onPause: X(e.onPause),
|
|
209
|
+
onResume: X(e.onResume),
|
|
210
|
+
onSwipeStart: x(e.onSwipeStart, (i) => {
|
|
211
|
+
i.currentTarget.setAttribute("data-swipe", "start");
|
|
189
212
|
}),
|
|
190
|
-
onSwipeMove: x(e.onSwipeMove, (
|
|
191
|
-
const { x: E, y:
|
|
192
|
-
|
|
213
|
+
onSwipeMove: x(e.onSwipeMove, (i) => {
|
|
214
|
+
const { x: E, y: T } = i.detail.delta;
|
|
215
|
+
i.currentTarget.setAttribute("data-swipe", "move"), i.currentTarget.style.setProperty("--radix-toast-swipe-move-x", `${E}px`), i.currentTarget.style.setProperty("--radix-toast-swipe-move-y", `${T}px`);
|
|
193
216
|
}),
|
|
194
|
-
onSwipeCancel: x(e.onSwipeCancel, (
|
|
195
|
-
|
|
217
|
+
onSwipeCancel: x(e.onSwipeCancel, (i) => {
|
|
218
|
+
i.currentTarget.setAttribute("data-swipe", "cancel"), i.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"), i.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"), i.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"), i.currentTarget.style.removeProperty("--radix-toast-swipe-end-y");
|
|
196
219
|
}),
|
|
197
|
-
onSwipeEnd: x(e.onSwipeEnd, (
|
|
198
|
-
const { x: E, y:
|
|
199
|
-
|
|
220
|
+
onSwipeEnd: x(e.onSwipeEnd, (i) => {
|
|
221
|
+
const { x: E, y: T } = i.detail.delta;
|
|
222
|
+
i.currentTarget.setAttribute("data-swipe", "end"), i.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"), i.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"), i.currentTarget.style.setProperty("--radix-toast-swipe-end-x", `${E}px`), i.currentTarget.style.setProperty("--radix-toast-swipe-end-y", `${T}px`), v(!1);
|
|
200
223
|
})
|
|
201
224
|
}
|
|
202
225
|
) });
|
|
203
226
|
}
|
|
204
227
|
);
|
|
205
|
-
|
|
206
|
-
var [
|
|
228
|
+
fe.displayName = O;
|
|
229
|
+
var [Qe, Ze] = ce(O, {
|
|
207
230
|
onClose() {
|
|
208
231
|
}
|
|
209
|
-
}),
|
|
210
|
-
(e,
|
|
232
|
+
}), et = n.forwardRef(
|
|
233
|
+
(e, o) => {
|
|
211
234
|
const {
|
|
212
|
-
__scopeToast:
|
|
235
|
+
__scopeToast: r,
|
|
213
236
|
type: t = "foreground",
|
|
214
237
|
duration: c,
|
|
215
238
|
open: d,
|
|
216
|
-
onClose:
|
|
217
|
-
onEscapeKeyDown:
|
|
239
|
+
onClose: p,
|
|
240
|
+
onEscapeKeyDown: w,
|
|
218
241
|
onPause: v,
|
|
219
|
-
onResume:
|
|
242
|
+
onResume: i,
|
|
220
243
|
onSwipeStart: E,
|
|
221
|
-
onSwipeMove:
|
|
244
|
+
onSwipeMove: T,
|
|
222
245
|
onSwipeCancel: S,
|
|
223
246
|
onSwipeEnd: b,
|
|
224
247
|
...R
|
|
225
|
-
} = e, l =
|
|
226
|
-
u?.contains(document.activeElement) && l.viewport?.focus(),
|
|
248
|
+
} = e, l = Y(O, r), [u, h] = n.useState(null), f = ie(o, (s) => h(s)), m = n.useRef(null), P = n.useRef(null), C = c || l.duration, y = n.useRef(0), _ = n.useRef(C), k = n.useRef(0), { onToastAdd: F, onToastRemove: V } = l, N = X(() => {
|
|
249
|
+
u?.contains(document.activeElement) && l.viewport?.focus(), p();
|
|
227
250
|
}), K = n.useCallback(
|
|
228
251
|
(s) => {
|
|
229
252
|
!s || s === 1 / 0 || (window.clearTimeout(k.current), y.current = (/* @__PURE__ */ new Date()).getTime(), k.current = window.setTimeout(N, s));
|
|
@@ -234,69 +257,69 @@ var [Ge, Je] = ce(O, {
|
|
|
234
257
|
const s = l.viewport;
|
|
235
258
|
if (s) {
|
|
236
259
|
const g = () => {
|
|
237
|
-
K(
|
|
260
|
+
K(_.current), i?.();
|
|
238
261
|
}, I = () => {
|
|
239
262
|
const L = (/* @__PURE__ */ new Date()).getTime() - y.current;
|
|
240
|
-
|
|
263
|
+
_.current = _.current - L, window.clearTimeout(k.current), v?.();
|
|
241
264
|
};
|
|
242
265
|
return s.addEventListener(z, I), s.addEventListener(G, g), () => {
|
|
243
266
|
s.removeEventListener(z, I), s.removeEventListener(G, g);
|
|
244
267
|
};
|
|
245
268
|
}
|
|
246
|
-
}, [l.viewport, C, v,
|
|
269
|
+
}, [l.viewport, C, v, i, K]), n.useEffect(() => {
|
|
247
270
|
d && !l.isClosePausedRef.current && K(C);
|
|
248
|
-
}, [d, C, l.isClosePausedRef, K]), n.useEffect(() => (
|
|
249
|
-
const
|
|
250
|
-
return l.viewport ? /* @__PURE__ */
|
|
251
|
-
|
|
252
|
-
|
|
271
|
+
}, [d, C, l.isClosePausedRef, K]), n.useEffect(() => (F(), () => V()), [F, V]);
|
|
272
|
+
const te = n.useMemo(() => u ? Pe(u) : null, [u]);
|
|
273
|
+
return l.viewport ? /* @__PURE__ */ D(ae, { children: [
|
|
274
|
+
te && /* @__PURE__ */ a(
|
|
275
|
+
tt,
|
|
253
276
|
{
|
|
254
|
-
__scopeToast:
|
|
277
|
+
__scopeToast: r,
|
|
255
278
|
role: "status",
|
|
256
279
|
"aria-live": t === "foreground" ? "assertive" : "polite",
|
|
257
|
-
children:
|
|
280
|
+
children: te
|
|
258
281
|
}
|
|
259
282
|
),
|
|
260
|
-
/* @__PURE__ */
|
|
261
|
-
/* @__PURE__ */
|
|
262
|
-
|
|
283
|
+
/* @__PURE__ */ a(Qe, { scope: r, onClose: N, children: Se.createPortal(
|
|
284
|
+
/* @__PURE__ */ a(ee.ItemSlot, { scope: r, children: /* @__PURE__ */ a(
|
|
285
|
+
Le,
|
|
263
286
|
{
|
|
264
287
|
asChild: !0,
|
|
265
|
-
onEscapeKeyDown: x(
|
|
288
|
+
onEscapeKeyDown: x(w, () => {
|
|
266
289
|
l.isFocusedToastEscapeKeyDownRef.current || N(), l.isFocusedToastEscapeKeyDownRef.current = !1;
|
|
267
290
|
}),
|
|
268
|
-
children: /* @__PURE__ */
|
|
269
|
-
|
|
291
|
+
children: /* @__PURE__ */ a(
|
|
292
|
+
A.li,
|
|
270
293
|
{
|
|
271
294
|
tabIndex: 0,
|
|
272
295
|
"data-state": d ? "open" : "closed",
|
|
273
296
|
"data-swipe-direction": l.swipeDirection,
|
|
274
297
|
...R,
|
|
275
|
-
ref:
|
|
298
|
+
ref: f,
|
|
276
299
|
style: { userSelect: "none", touchAction: "none", ...e.style },
|
|
277
300
|
onKeyDown: x(e.onKeyDown, (s) => {
|
|
278
|
-
s.key === "Escape" && (
|
|
301
|
+
s.key === "Escape" && (w?.(s.nativeEvent), s.nativeEvent.defaultPrevented || (l.isFocusedToastEscapeKeyDownRef.current = !0, N()));
|
|
279
302
|
}),
|
|
280
303
|
onPointerDown: x(e.onPointerDown, (s) => {
|
|
281
304
|
s.button === 0 && (m.current = { x: s.clientX, y: s.clientY });
|
|
282
305
|
}),
|
|
283
306
|
onPointerMove: x(e.onPointerMove, (s) => {
|
|
284
307
|
if (!m.current) return;
|
|
285
|
-
const g = s.clientX - m.current.x, I = s.clientY - m.current.y, L = !!P.current, M = ["left", "right"].includes(l.swipeDirection), H = ["left", "up"].includes(l.swipeDirection) ? Math.min : Math.max, Ce = M ? H(0, g) : 0, Re = M ? 0 : H(0, I),
|
|
286
|
-
L ? (P.current = W,
|
|
308
|
+
const g = s.clientX - m.current.x, I = s.clientY - m.current.y, L = !!P.current, M = ["left", "right"].includes(l.swipeDirection), H = ["left", "up"].includes(l.swipeDirection) ? Math.min : Math.max, Ce = M ? H(0, g) : 0, Re = M ? 0 : H(0, I), $ = s.pointerType === "touch" ? 10 : 2, W = { x: Ce, y: Re }, oe = { originalEvent: s, delta: W };
|
|
309
|
+
L ? (P.current = W, U(ze, T, oe, {
|
|
287
310
|
discrete: !1
|
|
288
|
-
})) :
|
|
311
|
+
})) : se(W, l.swipeDirection, $) ? (P.current = W, U(qe, E, oe, {
|
|
289
312
|
discrete: !1
|
|
290
|
-
}), s.target.setPointerCapture(s.pointerId)) : (Math.abs(g) >
|
|
313
|
+
}), s.target.setPointerCapture(s.pointerId)) : (Math.abs(g) > $ || Math.abs(I) > $) && (m.current = null);
|
|
291
314
|
}),
|
|
292
315
|
onPointerUp: x(e.onPointerUp, (s) => {
|
|
293
316
|
const g = P.current, I = s.target;
|
|
294
317
|
if (I.hasPointerCapture(s.pointerId) && I.releasePointerCapture(s.pointerId), P.current = null, m.current = null, g) {
|
|
295
318
|
const L = s.currentTarget, M = { originalEvent: s, delta: g };
|
|
296
|
-
|
|
319
|
+
se(g, l.swipeDirection, l.swipeThreshold) ? U(Je, b, M, {
|
|
297
320
|
discrete: !0
|
|
298
|
-
}) :
|
|
299
|
-
|
|
321
|
+
}) : U(
|
|
322
|
+
Ge,
|
|
300
323
|
S,
|
|
301
324
|
M,
|
|
302
325
|
{
|
|
@@ -315,149 +338,149 @@ var [Ge, Je] = ce(O, {
|
|
|
315
338
|
) })
|
|
316
339
|
] }) : null;
|
|
317
340
|
}
|
|
318
|
-
),
|
|
319
|
-
const { __scopeToast:
|
|
320
|
-
return
|
|
321
|
-
const
|
|
322
|
-
return () => window.clearTimeout(
|
|
323
|
-
}, []),
|
|
341
|
+
), tt = (e) => {
|
|
342
|
+
const { __scopeToast: o, children: r, ...t } = e, c = Y(O, o), [d, p] = n.useState(!1), [w, v] = n.useState(!1);
|
|
343
|
+
return nt(() => p(!0)), n.useEffect(() => {
|
|
344
|
+
const i = window.setTimeout(() => v(!0), 1e3);
|
|
345
|
+
return () => window.clearTimeout(i);
|
|
346
|
+
}, []), w ? null : /* @__PURE__ */ a(Me, { asChild: !0, children: /* @__PURE__ */ a(Q, { ...t, children: d && /* @__PURE__ */ D(ae, { children: [
|
|
324
347
|
c.label,
|
|
325
348
|
" ",
|
|
326
|
-
|
|
349
|
+
r
|
|
327
350
|
] }) }) });
|
|
328
|
-
},
|
|
329
|
-
(e,
|
|
330
|
-
const { __scopeToast:
|
|
331
|
-
return /* @__PURE__ */
|
|
351
|
+
}, ot = "ToastTitle", me = n.forwardRef(
|
|
352
|
+
(e, o) => {
|
|
353
|
+
const { __scopeToast: r, ...t } = e;
|
|
354
|
+
return /* @__PURE__ */ a(A.div, { ...t, ref: o });
|
|
332
355
|
}
|
|
333
356
|
);
|
|
334
|
-
me.displayName =
|
|
335
|
-
var
|
|
336
|
-
(e,
|
|
337
|
-
const { __scopeToast:
|
|
338
|
-
return /* @__PURE__ */
|
|
357
|
+
me.displayName = ot;
|
|
358
|
+
var rt = "ToastDescription", we = n.forwardRef(
|
|
359
|
+
(e, o) => {
|
|
360
|
+
const { __scopeToast: r, ...t } = e;
|
|
361
|
+
return /* @__PURE__ */ a(A.div, { ...t, ref: o });
|
|
339
362
|
}
|
|
340
363
|
);
|
|
341
|
-
|
|
342
|
-
var
|
|
343
|
-
(e,
|
|
344
|
-
const { altText:
|
|
345
|
-
return
|
|
346
|
-
`Invalid prop \`altText\` supplied to \`${
|
|
364
|
+
we.displayName = rt;
|
|
365
|
+
var Te = "ToastAction", ve = n.forwardRef(
|
|
366
|
+
(e, o) => {
|
|
367
|
+
const { altText: r, ...t } = e;
|
|
368
|
+
return r.trim() ? /* @__PURE__ */ a(he, { altText: r, asChild: !0, children: /* @__PURE__ */ a(ye, { ...t, ref: o }) }) : (console.error(
|
|
369
|
+
`Invalid prop \`altText\` supplied to \`${Te}\`. Expected non-empty \`string\`.`
|
|
347
370
|
), null);
|
|
348
371
|
}
|
|
349
372
|
);
|
|
350
|
-
ve.displayName =
|
|
373
|
+
ve.displayName = Te;
|
|
351
374
|
var Ee = "ToastClose", ye = n.forwardRef(
|
|
352
|
-
(e,
|
|
353
|
-
const { __scopeToast:
|
|
354
|
-
return /* @__PURE__ */
|
|
355
|
-
|
|
375
|
+
(e, o) => {
|
|
376
|
+
const { __scopeToast: r, ...t } = e, c = Ze(Ee, r);
|
|
377
|
+
return /* @__PURE__ */ a(he, { asChild: !0, children: /* @__PURE__ */ a(
|
|
378
|
+
A.button,
|
|
356
379
|
{
|
|
357
380
|
type: "button",
|
|
358
381
|
...t,
|
|
359
|
-
ref:
|
|
382
|
+
ref: o,
|
|
360
383
|
onClick: x(e.onClick, c.onClose)
|
|
361
384
|
}
|
|
362
385
|
) });
|
|
363
386
|
}
|
|
364
387
|
);
|
|
365
388
|
ye.displayName = Ee;
|
|
366
|
-
var he = n.forwardRef((e,
|
|
367
|
-
const { __scopeToast:
|
|
368
|
-
return /* @__PURE__ */
|
|
369
|
-
|
|
389
|
+
var he = n.forwardRef((e, o) => {
|
|
390
|
+
const { __scopeToast: r, altText: t, ...c } = e;
|
|
391
|
+
return /* @__PURE__ */ a(
|
|
392
|
+
A.div,
|
|
370
393
|
{
|
|
371
394
|
"data-radix-toast-announce-exclude": "",
|
|
372
395
|
"data-radix-toast-announce-alt": t || void 0,
|
|
373
396
|
...c,
|
|
374
|
-
ref:
|
|
397
|
+
ref: o
|
|
375
398
|
}
|
|
376
399
|
);
|
|
377
400
|
});
|
|
378
401
|
function Pe(e) {
|
|
379
|
-
const
|
|
402
|
+
const o = [];
|
|
380
403
|
return Array.from(e.childNodes).forEach((t) => {
|
|
381
|
-
if (t.nodeType === t.TEXT_NODE && t.textContent &&
|
|
404
|
+
if (t.nodeType === t.TEXT_NODE && t.textContent && o.push(t.textContent), st(t)) {
|
|
382
405
|
const c = t.ariaHidden || t.hidden || t.style.display === "none", d = t.dataset.radixToastAnnounceExclude === "";
|
|
383
406
|
if (!c)
|
|
384
407
|
if (d) {
|
|
385
|
-
const
|
|
386
|
-
|
|
408
|
+
const p = t.dataset.radixToastAnnounceAlt;
|
|
409
|
+
p && o.push(p);
|
|
387
410
|
} else
|
|
388
|
-
|
|
411
|
+
o.push(...Pe(t));
|
|
389
412
|
}
|
|
390
|
-
}),
|
|
413
|
+
}), o;
|
|
391
414
|
}
|
|
392
|
-
function
|
|
393
|
-
const c =
|
|
394
|
-
|
|
415
|
+
function U(e, o, r, { discrete: t }) {
|
|
416
|
+
const c = r.originalEvent.currentTarget, d = new CustomEvent(e, { bubbles: !0, cancelable: !0, detail: r });
|
|
417
|
+
o && c.addEventListener(e, o, { once: !0 }), t ? Ae(c, d) : c.dispatchEvent(d);
|
|
395
418
|
}
|
|
396
|
-
var
|
|
419
|
+
var se = (e, o, r = 0) => {
|
|
397
420
|
const t = Math.abs(e.x), c = Math.abs(e.y), d = t > c;
|
|
398
|
-
return
|
|
421
|
+
return o === "left" || o === "right" ? d && t > r : !d && c > r;
|
|
399
422
|
};
|
|
400
|
-
function
|
|
423
|
+
function nt(e = () => {
|
|
401
424
|
}) {
|
|
402
|
-
const
|
|
403
|
-
|
|
404
|
-
let
|
|
405
|
-
return
|
|
406
|
-
window.cancelAnimationFrame(
|
|
425
|
+
const o = X(e);
|
|
426
|
+
De(() => {
|
|
427
|
+
let r = 0, t = 0;
|
|
428
|
+
return r = window.requestAnimationFrame(() => t = window.requestAnimationFrame(o)), () => {
|
|
429
|
+
window.cancelAnimationFrame(r), window.cancelAnimationFrame(t);
|
|
407
430
|
};
|
|
408
|
-
}, [
|
|
431
|
+
}, [o]);
|
|
409
432
|
}
|
|
410
|
-
function
|
|
433
|
+
function st(e) {
|
|
411
434
|
return e.nodeType === e.ELEMENT_NODE;
|
|
412
435
|
}
|
|
413
|
-
function
|
|
414
|
-
const
|
|
436
|
+
function at(e) {
|
|
437
|
+
const o = [], r = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
|
|
415
438
|
acceptNode: (t) => {
|
|
416
439
|
const c = t.tagName === "INPUT" && t.type === "hidden";
|
|
417
440
|
return t.disabled || t.hidden || c ? NodeFilter.FILTER_SKIP : t.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
418
441
|
}
|
|
419
442
|
});
|
|
420
|
-
for (;
|
|
421
|
-
return
|
|
443
|
+
for (; r.nextNode(); ) o.push(r.currentNode);
|
|
444
|
+
return o;
|
|
422
445
|
}
|
|
423
446
|
function q(e) {
|
|
424
|
-
const
|
|
425
|
-
return e.some((
|
|
447
|
+
const o = document.activeElement;
|
|
448
|
+
return e.some((r) => r === o ? !0 : (r.focus(), document.activeElement !== o));
|
|
426
449
|
}
|
|
427
|
-
var
|
|
428
|
-
const
|
|
450
|
+
var it = ue, ct = de, ut = fe, lt = me, dt = we, pt = ve;
|
|
451
|
+
const It = ({
|
|
429
452
|
title: e,
|
|
430
|
-
duration:
|
|
431
|
-
titleClassName:
|
|
453
|
+
duration: o = 5e3,
|
|
454
|
+
titleClassName: r,
|
|
432
455
|
descriptionClassName: t,
|
|
433
456
|
description: c,
|
|
434
457
|
children: d,
|
|
435
|
-
theme:
|
|
436
|
-
showCloseButton:
|
|
458
|
+
theme: p,
|
|
459
|
+
showCloseButton: w = !0,
|
|
437
460
|
closeButtonClassName: v,
|
|
438
|
-
className:
|
|
461
|
+
className: i,
|
|
439
462
|
open: E = !1,
|
|
440
|
-
setOpen:
|
|
463
|
+
setOpen: T
|
|
441
464
|
}) => {
|
|
442
465
|
const S = xe(0);
|
|
443
466
|
be(() => () => clearTimeout(S.current), []);
|
|
444
|
-
const b =
|
|
445
|
-
|
|
446
|
-
}, [
|
|
447
|
-
return /* @__PURE__ */
|
|
448
|
-
/* @__PURE__ */
|
|
449
|
-
/* @__PURE__ */
|
|
450
|
-
|
|
467
|
+
const b = re(() => ne(e) ? /* @__PURE__ */ a(B, { className: r, children: e }) : e, [e, r]), R = re(() => ne(c) ? /* @__PURE__ */ a(B, { className: t, children: c }) : c, [c, t]), l = ge(() => {
|
|
468
|
+
T(!1), S.current = window.setTimeout(() => T(!0), 100);
|
|
469
|
+
}, [T]);
|
|
470
|
+
return /* @__PURE__ */ D(it, { swipeDirection: "right", duration: o, children: [
|
|
471
|
+
/* @__PURE__ */ a(B, { onClick: l, children: d }),
|
|
472
|
+
/* @__PURE__ */ D(
|
|
473
|
+
ut,
|
|
451
474
|
{
|
|
452
|
-
className: j(Ke({ className:
|
|
453
|
-
"data-theme":
|
|
475
|
+
className: j(Ke({ className: i })),
|
|
476
|
+
"data-theme": p,
|
|
454
477
|
open: E,
|
|
455
|
-
onOpenChange:
|
|
478
|
+
onOpenChange: T,
|
|
456
479
|
children: [
|
|
457
|
-
/* @__PURE__ */
|
|
458
|
-
R && /* @__PURE__ */
|
|
459
|
-
|
|
460
|
-
/* @__PURE__ */
|
|
480
|
+
/* @__PURE__ */ a(lt, { asChild: !0, className: r, children: b }),
|
|
481
|
+
R && /* @__PURE__ */ a(dt, { asChild: !0, children: R }),
|
|
482
|
+
w && /* @__PURE__ */ a(pt, { asChild: !0, altText: "Close the toast", children: /* @__PURE__ */ D("button", { type: "button", className: "absolute right-1.5 top-1.5", children: [
|
|
483
|
+
/* @__PURE__ */ a(
|
|
461
484
|
We,
|
|
462
485
|
{
|
|
463
486
|
className: j(
|
|
@@ -467,14 +490,14 @@ const gt = ({
|
|
|
467
490
|
)
|
|
468
491
|
}
|
|
469
492
|
),
|
|
470
|
-
/* @__PURE__ */
|
|
493
|
+
/* @__PURE__ */ a(ke, { children: "Close toast" })
|
|
471
494
|
] }) })
|
|
472
495
|
]
|
|
473
496
|
}
|
|
474
497
|
),
|
|
475
|
-
/* @__PURE__ */
|
|
498
|
+
/* @__PURE__ */ a(ct, { className: j(He()) })
|
|
476
499
|
] });
|
|
477
500
|
};
|
|
478
501
|
export {
|
|
479
|
-
|
|
502
|
+
It as Toast
|
|
480
503
|
};
|