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