@krosoft/react 0.0.18 → 0.0.19
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/LoadingState-C91zWRVu.js +20 -0
- package/dist/components/core/index.js +1 -1
- package/dist/components/core/states/index.js +1 -1
- package/dist/components/index.js +14 -7
- package/dist/components/ui/index.d.ts +2 -0
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +12 -5
- package/dist/createLucideIcon-BxMj32TH.js +116 -0
- package/dist/hooks/index.d.ts +3 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +125 -1
- package/dist/toast-DZWzsFB2.js +1064 -0
- package/package.json +4 -4
- package/dist/LoadingState-CEoOCk2t.js +0 -132
- package/dist/badge-DUEyCWfa.js +0 -79
|
@@ -0,0 +1,1064 @@
|
|
|
1
|
+
import { jsx as p, jsxs as re, Fragment as ye } from "react/jsx-runtime";
|
|
2
|
+
import * as s from "react";
|
|
3
|
+
import F from "react";
|
|
4
|
+
import { c as ze, a as O } from "./index-DxGGCUCL.js";
|
|
5
|
+
import * as we from "react-dom";
|
|
6
|
+
import qe from "react-dom";
|
|
7
|
+
import { c as Ze } from "./createLucideIcon-BxMj32TH.js";
|
|
8
|
+
/**
|
|
9
|
+
* @license lucide-react v1.7.0 - ISC
|
|
10
|
+
*
|
|
11
|
+
* This source code is licensed under the ISC license.
|
|
12
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
13
|
+
*/
|
|
14
|
+
const Ge = [
|
|
15
|
+
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
16
|
+
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
17
|
+
], Je = Ze("x", Ge), le = (e) => typeof e == "boolean" ? `${e}` : e === 0 ? "0" : e, de = ze, oe = (e, t) => (n) => {
|
|
18
|
+
var r;
|
|
19
|
+
if ((t == null ? void 0 : t.variants) == null) return de(e, n == null ? void 0 : n.class, n == null ? void 0 : n.className);
|
|
20
|
+
const { variants: o, defaultVariants: a } = t, u = Object.keys(o).map((i) => {
|
|
21
|
+
const l = n == null ? void 0 : n[i], m = a == null ? void 0 : a[i];
|
|
22
|
+
if (l === null) return null;
|
|
23
|
+
const y = le(l) || le(m);
|
|
24
|
+
return o[i][y];
|
|
25
|
+
}), c = n && Object.entries(n).reduce((i, l) => {
|
|
26
|
+
let [m, y] = l;
|
|
27
|
+
return y === void 0 || (i[m] = y), i;
|
|
28
|
+
}, {}), f = t == null || (r = t.compoundVariants) === null || r === void 0 ? void 0 : r.reduce((i, l) => {
|
|
29
|
+
let { class: m, className: y, ...g } = l;
|
|
30
|
+
return Object.entries(g).every((x) => {
|
|
31
|
+
let [v, d] = x;
|
|
32
|
+
return Array.isArray(d) ? d.includes({
|
|
33
|
+
...a,
|
|
34
|
+
...c
|
|
35
|
+
}[v]) : {
|
|
36
|
+
...a,
|
|
37
|
+
...c
|
|
38
|
+
}[v] === d;
|
|
39
|
+
}) ? [
|
|
40
|
+
...i,
|
|
41
|
+
m,
|
|
42
|
+
y
|
|
43
|
+
] : i;
|
|
44
|
+
}, []);
|
|
45
|
+
return de(e, u, f, n == null ? void 0 : n.class, n == null ? void 0 : n.className);
|
|
46
|
+
}, Qe = oe(
|
|
47
|
+
"relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",
|
|
48
|
+
{
|
|
49
|
+
variants: {
|
|
50
|
+
variant: {
|
|
51
|
+
default: "bg-background text-foreground",
|
|
52
|
+
destructive: "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
defaultVariants: {
|
|
56
|
+
variant: "default"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
), et = s.forwardRef(
|
|
60
|
+
({ className: e, variant: t, ...n }, r) => /* @__PURE__ */ p("div", { ref: r, role: "alert", className: O(Qe({ variant: t }), e), ...n })
|
|
61
|
+
);
|
|
62
|
+
et.displayName = "Alert";
|
|
63
|
+
const tt = s.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ p("h5", { ref: n, className: O("mb-1 font-medium leading-none tracking-tight", e), ...t }));
|
|
64
|
+
tt.displayName = "AlertTitle";
|
|
65
|
+
const nt = s.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ p("div", { ref: n, className: O("text-sm [&_p]:leading-relaxed", e), ...t }));
|
|
66
|
+
nt.displayName = "AlertDescription";
|
|
67
|
+
const rt = oe(
|
|
68
|
+
"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
69
|
+
{
|
|
70
|
+
variants: {
|
|
71
|
+
variant: {
|
|
72
|
+
default: "border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
|
|
73
|
+
secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
74
|
+
destructive: "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
|
|
75
|
+
outline: "text-foreground"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
defaultVariants: {
|
|
79
|
+
variant: "default"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
function cn({ className: e, variant: t, ...n }) {
|
|
84
|
+
return /* @__PURE__ */ p("div", { className: O(rt({ variant: t }), e), ...n });
|
|
85
|
+
}
|
|
86
|
+
function N(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
|
|
87
|
+
return function(o) {
|
|
88
|
+
if (e == null || e(o), n === !1 || !o.defaultPrevented)
|
|
89
|
+
return t == null ? void 0 : t(o);
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function fe(e, t) {
|
|
93
|
+
if (typeof e == "function")
|
|
94
|
+
return e(t);
|
|
95
|
+
e != null && (e.current = t);
|
|
96
|
+
}
|
|
97
|
+
function Ee(...e) {
|
|
98
|
+
return (t) => {
|
|
99
|
+
let n = !1;
|
|
100
|
+
const r = e.map((o) => {
|
|
101
|
+
const a = fe(o, t);
|
|
102
|
+
return !n && typeof a == "function" && (n = !0), a;
|
|
103
|
+
});
|
|
104
|
+
if (n)
|
|
105
|
+
return () => {
|
|
106
|
+
for (let o = 0; o < r.length; o++) {
|
|
107
|
+
const a = r[o];
|
|
108
|
+
typeof a == "function" ? a() : fe(e[o], null);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function k(...e) {
|
|
114
|
+
return s.useCallback(Ee(...e), e);
|
|
115
|
+
}
|
|
116
|
+
function Te(e, t = []) {
|
|
117
|
+
let n = [];
|
|
118
|
+
function r(a, u) {
|
|
119
|
+
const c = s.createContext(u), f = n.length;
|
|
120
|
+
n = [...n, u];
|
|
121
|
+
const i = (m) => {
|
|
122
|
+
var C;
|
|
123
|
+
const { scope: y, children: g, ...x } = m, v = ((C = y == null ? void 0 : y[e]) == null ? void 0 : C[f]) || c, d = s.useMemo(() => x, Object.values(x));
|
|
124
|
+
return /* @__PURE__ */ p(v.Provider, { value: d, children: g });
|
|
125
|
+
};
|
|
126
|
+
i.displayName = a + "Provider";
|
|
127
|
+
function l(m, y) {
|
|
128
|
+
var v;
|
|
129
|
+
const g = ((v = y == null ? void 0 : y[e]) == null ? void 0 : v[f]) || c, x = s.useContext(g);
|
|
130
|
+
if (x) return x;
|
|
131
|
+
if (u !== void 0) return u;
|
|
132
|
+
throw new Error(`\`${m}\` must be used within \`${a}\``);
|
|
133
|
+
}
|
|
134
|
+
return [i, l];
|
|
135
|
+
}
|
|
136
|
+
const o = () => {
|
|
137
|
+
const a = n.map((u) => s.createContext(u));
|
|
138
|
+
return function(c) {
|
|
139
|
+
const f = (c == null ? void 0 : c[e]) || a;
|
|
140
|
+
return s.useMemo(
|
|
141
|
+
() => ({ [`__scope${e}`]: { ...c, [e]: f } }),
|
|
142
|
+
[c, f]
|
|
143
|
+
);
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
return o.scopeName = e, [r, ot(o, ...t)];
|
|
147
|
+
}
|
|
148
|
+
function ot(...e) {
|
|
149
|
+
const t = e[0];
|
|
150
|
+
if (e.length === 1) return t;
|
|
151
|
+
const n = () => {
|
|
152
|
+
const r = e.map((o) => ({
|
|
153
|
+
useScope: o(),
|
|
154
|
+
scopeName: o.scopeName
|
|
155
|
+
}));
|
|
156
|
+
return function(a) {
|
|
157
|
+
const u = r.reduce((c, { useScope: f, scopeName: i }) => {
|
|
158
|
+
const m = f(a)[`__scope${i}`];
|
|
159
|
+
return { ...c, ...m };
|
|
160
|
+
}, {});
|
|
161
|
+
return s.useMemo(() => ({ [`__scope${t.scopeName}`]: u }), [u]);
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
return n.scopeName = t.scopeName, n;
|
|
165
|
+
}
|
|
166
|
+
// @__NO_SIDE_EFFECTS__
|
|
167
|
+
function J(e) {
|
|
168
|
+
const t = /* @__PURE__ */ st(e), n = s.forwardRef((r, o) => {
|
|
169
|
+
const { children: a, ...u } = r, c = s.Children.toArray(a), f = c.find(at);
|
|
170
|
+
if (f) {
|
|
171
|
+
const i = f.props.children, l = c.map((m) => m === f ? s.Children.count(i) > 1 ? s.Children.only(null) : s.isValidElement(i) ? i.props.children : null : m);
|
|
172
|
+
return /* @__PURE__ */ p(t, { ...u, ref: o, children: s.isValidElement(i) ? s.cloneElement(i, void 0, l) : null });
|
|
173
|
+
}
|
|
174
|
+
return /* @__PURE__ */ p(t, { ...u, ref: o, children: a });
|
|
175
|
+
});
|
|
176
|
+
return n.displayName = `${e}.Slot`, n;
|
|
177
|
+
}
|
|
178
|
+
// @__NO_SIDE_EFFECTS__
|
|
179
|
+
function st(e) {
|
|
180
|
+
const t = s.forwardRef((n, r) => {
|
|
181
|
+
const { children: o, ...a } = n;
|
|
182
|
+
if (s.isValidElement(o)) {
|
|
183
|
+
const u = ut(o), c = ct(a, o.props);
|
|
184
|
+
return o.type !== s.Fragment && (c.ref = r ? Ee(r, u) : u), s.cloneElement(o, c);
|
|
185
|
+
}
|
|
186
|
+
return s.Children.count(o) > 1 ? s.Children.only(null) : null;
|
|
187
|
+
});
|
|
188
|
+
return t.displayName = `${e}.SlotClone`, t;
|
|
189
|
+
}
|
|
190
|
+
var it = Symbol("radix.slottable");
|
|
191
|
+
function at(e) {
|
|
192
|
+
return s.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === it;
|
|
193
|
+
}
|
|
194
|
+
function ct(e, t) {
|
|
195
|
+
const n = { ...t };
|
|
196
|
+
for (const r in t) {
|
|
197
|
+
const o = e[r], a = t[r];
|
|
198
|
+
/^on[A-Z]/.test(r) ? o && a ? n[r] = (...c) => {
|
|
199
|
+
const f = a(...c);
|
|
200
|
+
return o(...c), f;
|
|
201
|
+
} : o && (n[r] = o) : r === "style" ? n[r] = { ...o, ...a } : r === "className" && (n[r] = [o, a].filter(Boolean).join(" "));
|
|
202
|
+
}
|
|
203
|
+
return { ...e, ...n };
|
|
204
|
+
}
|
|
205
|
+
function ut(e) {
|
|
206
|
+
var r, o;
|
|
207
|
+
let t = (r = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : r.get, n = t && "isReactWarning" in t && t.isReactWarning;
|
|
208
|
+
return n ? e.ref : (t = (o = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : o.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
|
|
209
|
+
}
|
|
210
|
+
function lt(e) {
|
|
211
|
+
const t = e + "CollectionProvider", [n, r] = Te(t), [o, a] = n(
|
|
212
|
+
t,
|
|
213
|
+
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
214
|
+
), u = (v) => {
|
|
215
|
+
const { scope: d, children: C } = v, E = F.useRef(null), T = F.useRef(/* @__PURE__ */ new Map()).current;
|
|
216
|
+
return /* @__PURE__ */ p(o, { scope: d, itemMap: T, collectionRef: E, children: C });
|
|
217
|
+
};
|
|
218
|
+
u.displayName = t;
|
|
219
|
+
const c = e + "CollectionSlot", f = /* @__PURE__ */ J(c), i = F.forwardRef(
|
|
220
|
+
(v, d) => {
|
|
221
|
+
const { scope: C, children: E } = v, T = a(c, C), b = k(d, T.collectionRef);
|
|
222
|
+
return /* @__PURE__ */ p(f, { ref: b, children: E });
|
|
223
|
+
}
|
|
224
|
+
);
|
|
225
|
+
i.displayName = c;
|
|
226
|
+
const l = e + "CollectionItemSlot", m = "data-radix-collection-item", y = /* @__PURE__ */ J(l), g = F.forwardRef(
|
|
227
|
+
(v, d) => {
|
|
228
|
+
const { scope: C, children: E, ...T } = v, b = F.useRef(null), R = k(d, b), P = a(l, C);
|
|
229
|
+
return F.useEffect(() => (P.itemMap.set(b, { ref: b, ...T }), () => void P.itemMap.delete(b))), /* @__PURE__ */ p(y, { [m]: "", ref: R, children: E });
|
|
230
|
+
}
|
|
231
|
+
);
|
|
232
|
+
g.displayName = l;
|
|
233
|
+
function x(v) {
|
|
234
|
+
const d = a(e + "CollectionConsumer", v);
|
|
235
|
+
return F.useCallback(() => {
|
|
236
|
+
const E = d.collectionRef.current;
|
|
237
|
+
if (!E) return [];
|
|
238
|
+
const T = Array.from(E.querySelectorAll(`[${m}]`));
|
|
239
|
+
return Array.from(d.itemMap.values()).sort(
|
|
240
|
+
(P, h) => T.indexOf(P.ref.current) - T.indexOf(h.ref.current)
|
|
241
|
+
);
|
|
242
|
+
}, [d.collectionRef, d.itemMap]);
|
|
243
|
+
}
|
|
244
|
+
return [
|
|
245
|
+
{ Provider: u, Slot: i, ItemSlot: g },
|
|
246
|
+
x,
|
|
247
|
+
r
|
|
248
|
+
];
|
|
249
|
+
}
|
|
250
|
+
var dt = [
|
|
251
|
+
"a",
|
|
252
|
+
"button",
|
|
253
|
+
"div",
|
|
254
|
+
"form",
|
|
255
|
+
"h2",
|
|
256
|
+
"h3",
|
|
257
|
+
"img",
|
|
258
|
+
"input",
|
|
259
|
+
"label",
|
|
260
|
+
"li",
|
|
261
|
+
"nav",
|
|
262
|
+
"ol",
|
|
263
|
+
"p",
|
|
264
|
+
"select",
|
|
265
|
+
"span",
|
|
266
|
+
"svg",
|
|
267
|
+
"ul"
|
|
268
|
+
], I = dt.reduce((e, t) => {
|
|
269
|
+
const n = /* @__PURE__ */ J(`Primitive.${t}`), r = s.forwardRef((o, a) => {
|
|
270
|
+
const { asChild: u, ...c } = o, f = u ? n : t;
|
|
271
|
+
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ p(f, { ...c, ref: a });
|
|
272
|
+
});
|
|
273
|
+
return r.displayName = `Primitive.${t}`, { ...e, [t]: r };
|
|
274
|
+
}, {});
|
|
275
|
+
function he(e, t) {
|
|
276
|
+
e && we.flushSync(() => e.dispatchEvent(t));
|
|
277
|
+
}
|
|
278
|
+
function V(e) {
|
|
279
|
+
const t = s.useRef(e);
|
|
280
|
+
return s.useEffect(() => {
|
|
281
|
+
t.current = e;
|
|
282
|
+
}), s.useMemo(() => (...n) => {
|
|
283
|
+
var r;
|
|
284
|
+
return (r = t.current) == null ? void 0 : r.call(t, ...n);
|
|
285
|
+
}, []);
|
|
286
|
+
}
|
|
287
|
+
function ft(e, t = globalThis == null ? void 0 : globalThis.document) {
|
|
288
|
+
const n = V(e);
|
|
289
|
+
s.useEffect(() => {
|
|
290
|
+
const r = (o) => {
|
|
291
|
+
o.key === "Escape" && n(o);
|
|
292
|
+
};
|
|
293
|
+
return t.addEventListener("keydown", r, { capture: !0 }), () => t.removeEventListener("keydown", r, { capture: !0 });
|
|
294
|
+
}, [n, t]);
|
|
295
|
+
}
|
|
296
|
+
var pt = "DismissableLayer", Q = "dismissableLayer.update", mt = "dismissableLayer.pointerDownOutside", vt = "dismissableLayer.focusOutside", pe, ge = s.createContext({
|
|
297
|
+
layers: /* @__PURE__ */ new Set(),
|
|
298
|
+
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
299
|
+
branches: /* @__PURE__ */ new Set()
|
|
300
|
+
}), be = s.forwardRef(
|
|
301
|
+
(e, t) => {
|
|
302
|
+
const {
|
|
303
|
+
disableOutsidePointerEvents: n = !1,
|
|
304
|
+
onEscapeKeyDown: r,
|
|
305
|
+
onPointerDownOutside: o,
|
|
306
|
+
onFocusOutside: a,
|
|
307
|
+
onInteractOutside: u,
|
|
308
|
+
onDismiss: c,
|
|
309
|
+
...f
|
|
310
|
+
} = e, i = s.useContext(ge), [l, m] = s.useState(null), y = (l == null ? void 0 : l.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, g] = s.useState({}), x = k(t, (h) => m(h)), v = Array.from(i.layers), [d] = [...i.layersWithOutsidePointerEventsDisabled].slice(-1), C = v.indexOf(d), E = l ? v.indexOf(l) : -1, T = i.layersWithOutsidePointerEventsDisabled.size > 0, b = E >= C, R = wt((h) => {
|
|
311
|
+
const A = h.target, D = [...i.branches].some((L) => L.contains(A));
|
|
312
|
+
!b || D || (o == null || o(h), u == null || u(h), h.defaultPrevented || c == null || c());
|
|
313
|
+
}, y), P = Et((h) => {
|
|
314
|
+
const A = h.target;
|
|
315
|
+
[...i.branches].some((L) => L.contains(A)) || (a == null || a(h), u == null || u(h), h.defaultPrevented || c == null || c());
|
|
316
|
+
}, y);
|
|
317
|
+
return ft((h) => {
|
|
318
|
+
E === i.layers.size - 1 && (r == null || r(h), !h.defaultPrevented && c && (h.preventDefault(), c()));
|
|
319
|
+
}, y), s.useEffect(() => {
|
|
320
|
+
if (l)
|
|
321
|
+
return n && (i.layersWithOutsidePointerEventsDisabled.size === 0 && (pe = y.body.style.pointerEvents, y.body.style.pointerEvents = "none"), i.layersWithOutsidePointerEventsDisabled.add(l)), i.layers.add(l), me(), () => {
|
|
322
|
+
n && i.layersWithOutsidePointerEventsDisabled.size === 1 && (y.body.style.pointerEvents = pe);
|
|
323
|
+
};
|
|
324
|
+
}, [l, y, n, i]), s.useEffect(() => () => {
|
|
325
|
+
l && (i.layers.delete(l), i.layersWithOutsidePointerEventsDisabled.delete(l), me());
|
|
326
|
+
}, [l, i]), s.useEffect(() => {
|
|
327
|
+
const h = () => g({});
|
|
328
|
+
return document.addEventListener(Q, h), () => document.removeEventListener(Q, h);
|
|
329
|
+
}, []), /* @__PURE__ */ p(
|
|
330
|
+
I.div,
|
|
331
|
+
{
|
|
332
|
+
...f,
|
|
333
|
+
ref: x,
|
|
334
|
+
style: {
|
|
335
|
+
pointerEvents: T ? b ? "auto" : "none" : void 0,
|
|
336
|
+
...e.style
|
|
337
|
+
},
|
|
338
|
+
onFocusCapture: N(e.onFocusCapture, P.onFocusCapture),
|
|
339
|
+
onBlurCapture: N(e.onBlurCapture, P.onBlurCapture),
|
|
340
|
+
onPointerDownCapture: N(
|
|
341
|
+
e.onPointerDownCapture,
|
|
342
|
+
R.onPointerDownCapture
|
|
343
|
+
)
|
|
344
|
+
}
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
);
|
|
348
|
+
be.displayName = pt;
|
|
349
|
+
var yt = "DismissableLayerBranch", Ce = s.forwardRef((e, t) => {
|
|
350
|
+
const n = s.useContext(ge), r = s.useRef(null), o = k(t, r);
|
|
351
|
+
return s.useEffect(() => {
|
|
352
|
+
const a = r.current;
|
|
353
|
+
if (a)
|
|
354
|
+
return n.branches.add(a), () => {
|
|
355
|
+
n.branches.delete(a);
|
|
356
|
+
};
|
|
357
|
+
}, [n.branches]), /* @__PURE__ */ p(I.div, { ...e, ref: o });
|
|
358
|
+
});
|
|
359
|
+
Ce.displayName = yt;
|
|
360
|
+
function wt(e, t = globalThis == null ? void 0 : globalThis.document) {
|
|
361
|
+
const n = V(e), r = s.useRef(!1), o = s.useRef(() => {
|
|
362
|
+
});
|
|
363
|
+
return s.useEffect(() => {
|
|
364
|
+
const a = (c) => {
|
|
365
|
+
if (c.target && !r.current) {
|
|
366
|
+
let f = function() {
|
|
367
|
+
xe(
|
|
368
|
+
mt,
|
|
369
|
+
n,
|
|
370
|
+
i,
|
|
371
|
+
{ discrete: !0 }
|
|
372
|
+
);
|
|
373
|
+
};
|
|
374
|
+
const i = { originalEvent: c };
|
|
375
|
+
c.pointerType === "touch" ? (t.removeEventListener("click", o.current), o.current = f, t.addEventListener("click", o.current, { once: !0 })) : f();
|
|
376
|
+
} else
|
|
377
|
+
t.removeEventListener("click", o.current);
|
|
378
|
+
r.current = !1;
|
|
379
|
+
}, u = window.setTimeout(() => {
|
|
380
|
+
t.addEventListener("pointerdown", a);
|
|
381
|
+
}, 0);
|
|
382
|
+
return () => {
|
|
383
|
+
window.clearTimeout(u), t.removeEventListener("pointerdown", a), t.removeEventListener("click", o.current);
|
|
384
|
+
};
|
|
385
|
+
}, [t, n]), {
|
|
386
|
+
// ensures we check React component tree (not just DOM tree)
|
|
387
|
+
onPointerDownCapture: () => r.current = !0
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
function Et(e, t = globalThis == null ? void 0 : globalThis.document) {
|
|
391
|
+
const n = V(e), r = s.useRef(!1);
|
|
392
|
+
return s.useEffect(() => {
|
|
393
|
+
const o = (a) => {
|
|
394
|
+
a.target && !r.current && xe(vt, n, { originalEvent: a }, {
|
|
395
|
+
discrete: !1
|
|
396
|
+
});
|
|
397
|
+
};
|
|
398
|
+
return t.addEventListener("focusin", o), () => t.removeEventListener("focusin", o);
|
|
399
|
+
}, [t, n]), {
|
|
400
|
+
onFocusCapture: () => r.current = !0,
|
|
401
|
+
onBlurCapture: () => r.current = !1
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
function me() {
|
|
405
|
+
const e = new CustomEvent(Q);
|
|
406
|
+
document.dispatchEvent(e);
|
|
407
|
+
}
|
|
408
|
+
function xe(e, t, n, { discrete: r }) {
|
|
409
|
+
const o = n.originalEvent.target, a = new CustomEvent(e, { bubbles: !1, cancelable: !0, detail: n });
|
|
410
|
+
t && o.addEventListener(e, t, { once: !0 }), r ? he(o, a) : o.dispatchEvent(a);
|
|
411
|
+
}
|
|
412
|
+
var Tt = be, ht = Ce, B = globalThis != null && globalThis.document ? s.useLayoutEffect : () => {
|
|
413
|
+
}, gt = "Portal", Pe = s.forwardRef((e, t) => {
|
|
414
|
+
var c;
|
|
415
|
+
const { container: n, ...r } = e, [o, a] = s.useState(!1);
|
|
416
|
+
B(() => a(!0), []);
|
|
417
|
+
const u = n || o && ((c = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : c.body);
|
|
418
|
+
return u ? qe.createPortal(/* @__PURE__ */ p(I.div, { ...r, ref: t }), u) : null;
|
|
419
|
+
});
|
|
420
|
+
Pe.displayName = gt;
|
|
421
|
+
function bt(e, t) {
|
|
422
|
+
return s.useReducer((n, r) => t[n][r] ?? n, e);
|
|
423
|
+
}
|
|
424
|
+
var Re = (e) => {
|
|
425
|
+
const { present: t, children: n } = e, r = Ct(t), o = typeof n == "function" ? n({ present: r.isPresent }) : s.Children.only(n), a = k(r.ref, xt(o));
|
|
426
|
+
return typeof n == "function" || r.isPresent ? s.cloneElement(o, { ref: a }) : null;
|
|
427
|
+
};
|
|
428
|
+
Re.displayName = "Presence";
|
|
429
|
+
function Ct(e) {
|
|
430
|
+
const [t, n] = s.useState(), r = s.useRef(null), o = s.useRef(e), a = s.useRef("none"), u = e ? "mounted" : "unmounted", [c, f] = bt(u, {
|
|
431
|
+
mounted: {
|
|
432
|
+
UNMOUNT: "unmounted",
|
|
433
|
+
ANIMATION_OUT: "unmountSuspended"
|
|
434
|
+
},
|
|
435
|
+
unmountSuspended: {
|
|
436
|
+
MOUNT: "mounted",
|
|
437
|
+
ANIMATION_END: "unmounted"
|
|
438
|
+
},
|
|
439
|
+
unmounted: {
|
|
440
|
+
MOUNT: "mounted"
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
return s.useEffect(() => {
|
|
444
|
+
const i = Y(r.current);
|
|
445
|
+
a.current = c === "mounted" ? i : "none";
|
|
446
|
+
}, [c]), B(() => {
|
|
447
|
+
const i = r.current, l = o.current;
|
|
448
|
+
if (l !== e) {
|
|
449
|
+
const y = a.current, g = Y(i);
|
|
450
|
+
e ? f("MOUNT") : g === "none" || (i == null ? void 0 : i.display) === "none" ? f("UNMOUNT") : f(l && y !== g ? "ANIMATION_OUT" : "UNMOUNT"), o.current = e;
|
|
451
|
+
}
|
|
452
|
+
}, [e, f]), B(() => {
|
|
453
|
+
if (t) {
|
|
454
|
+
let i;
|
|
455
|
+
const l = t.ownerDocument.defaultView ?? window, m = (g) => {
|
|
456
|
+
const v = Y(r.current).includes(CSS.escape(g.animationName));
|
|
457
|
+
if (g.target === t && v && (f("ANIMATION_END"), !o.current)) {
|
|
458
|
+
const d = t.style.animationFillMode;
|
|
459
|
+
t.style.animationFillMode = "forwards", i = l.setTimeout(() => {
|
|
460
|
+
t.style.animationFillMode === "forwards" && (t.style.animationFillMode = d);
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
}, y = (g) => {
|
|
464
|
+
g.target === t && (a.current = Y(r.current));
|
|
465
|
+
};
|
|
466
|
+
return t.addEventListener("animationstart", y), t.addEventListener("animationcancel", m), t.addEventListener("animationend", m), () => {
|
|
467
|
+
l.clearTimeout(i), t.removeEventListener("animationstart", y), t.removeEventListener("animationcancel", m), t.removeEventListener("animationend", m);
|
|
468
|
+
};
|
|
469
|
+
} else
|
|
470
|
+
f("ANIMATION_END");
|
|
471
|
+
}, [t, f]), {
|
|
472
|
+
isPresent: ["mounted", "unmountSuspended"].includes(c),
|
|
473
|
+
ref: s.useCallback((i) => {
|
|
474
|
+
r.current = i ? getComputedStyle(i) : null, n(i);
|
|
475
|
+
}, [])
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
function Y(e) {
|
|
479
|
+
return (e == null ? void 0 : e.animationName) || "none";
|
|
480
|
+
}
|
|
481
|
+
function xt(e) {
|
|
482
|
+
var r, o;
|
|
483
|
+
let t = (r = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : r.get, n = t && "isReactWarning" in t && t.isReactWarning;
|
|
484
|
+
return n ? e.ref : (t = (o = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : o.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
|
|
485
|
+
}
|
|
486
|
+
var Pt = s[" useInsertionEffect ".trim().toString()] || B;
|
|
487
|
+
function Rt({
|
|
488
|
+
prop: e,
|
|
489
|
+
defaultProp: t,
|
|
490
|
+
onChange: n = () => {
|
|
491
|
+
},
|
|
492
|
+
caller: r
|
|
493
|
+
}) {
|
|
494
|
+
const [o, a, u] = Nt({
|
|
495
|
+
defaultProp: t,
|
|
496
|
+
onChange: n
|
|
497
|
+
}), c = e !== void 0, f = c ? e : o;
|
|
498
|
+
{
|
|
499
|
+
const l = s.useRef(e !== void 0);
|
|
500
|
+
s.useEffect(() => {
|
|
501
|
+
const m = l.current;
|
|
502
|
+
m !== c && console.warn(
|
|
503
|
+
`${r} is changing from ${m ? "controlled" : "uncontrolled"} to ${c ? "controlled" : "uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
|
|
504
|
+
), l.current = c;
|
|
505
|
+
}, [c, r]);
|
|
506
|
+
}
|
|
507
|
+
const i = s.useCallback(
|
|
508
|
+
(l) => {
|
|
509
|
+
var m;
|
|
510
|
+
if (c) {
|
|
511
|
+
const y = St(l) ? l(e) : l;
|
|
512
|
+
y !== e && ((m = u.current) == null || m.call(u, y));
|
|
513
|
+
} else
|
|
514
|
+
a(l);
|
|
515
|
+
},
|
|
516
|
+
[c, e, a, u]
|
|
517
|
+
);
|
|
518
|
+
return [f, i];
|
|
519
|
+
}
|
|
520
|
+
function Nt({
|
|
521
|
+
defaultProp: e,
|
|
522
|
+
onChange: t
|
|
523
|
+
}) {
|
|
524
|
+
const [n, r] = s.useState(e), o = s.useRef(n), a = s.useRef(t);
|
|
525
|
+
return Pt(() => {
|
|
526
|
+
a.current = t;
|
|
527
|
+
}, [t]), s.useEffect(() => {
|
|
528
|
+
var u;
|
|
529
|
+
o.current !== n && ((u = a.current) == null || u.call(a, n), o.current = n);
|
|
530
|
+
}, [n, o]), [n, r, a];
|
|
531
|
+
}
|
|
532
|
+
function St(e) {
|
|
533
|
+
return typeof e == "function";
|
|
534
|
+
}
|
|
535
|
+
var At = Object.freeze({
|
|
536
|
+
// See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
|
|
537
|
+
position: "absolute",
|
|
538
|
+
border: 0,
|
|
539
|
+
width: 1,
|
|
540
|
+
height: 1,
|
|
541
|
+
padding: 0,
|
|
542
|
+
margin: -1,
|
|
543
|
+
overflow: "hidden",
|
|
544
|
+
clip: "rect(0, 0, 0, 0)",
|
|
545
|
+
whiteSpace: "nowrap",
|
|
546
|
+
wordWrap: "normal"
|
|
547
|
+
}), Ot = "VisuallyHidden", se = s.forwardRef(
|
|
548
|
+
(e, t) => /* @__PURE__ */ p(
|
|
549
|
+
I.span,
|
|
550
|
+
{
|
|
551
|
+
...e,
|
|
552
|
+
ref: t,
|
|
553
|
+
style: { ...At, ...e.style }
|
|
554
|
+
}
|
|
555
|
+
)
|
|
556
|
+
);
|
|
557
|
+
se.displayName = Ot;
|
|
558
|
+
var ie = "ToastProvider", [ae, It, Dt] = lt("Toast"), [Ne] = Te("Toast", [Dt]), [_t, q] = Ne(ie), Se = (e) => {
|
|
559
|
+
const {
|
|
560
|
+
__scopeToast: t,
|
|
561
|
+
label: n = "Notification",
|
|
562
|
+
duration: r = 5e3,
|
|
563
|
+
swipeDirection: o = "right",
|
|
564
|
+
swipeThreshold: a = 50,
|
|
565
|
+
children: u
|
|
566
|
+
} = e, [c, f] = s.useState(null), [i, l] = s.useState(0), m = s.useRef(!1), y = s.useRef(!1);
|
|
567
|
+
return n.trim() || console.error(
|
|
568
|
+
`Invalid prop \`label\` supplied to \`${ie}\`. Expected non-empty \`string\`.`
|
|
569
|
+
), /* @__PURE__ */ p(ae.Provider, { scope: t, children: /* @__PURE__ */ p(
|
|
570
|
+
_t,
|
|
571
|
+
{
|
|
572
|
+
scope: t,
|
|
573
|
+
label: n,
|
|
574
|
+
duration: r,
|
|
575
|
+
swipeDirection: o,
|
|
576
|
+
swipeThreshold: a,
|
|
577
|
+
toastCount: i,
|
|
578
|
+
viewport: c,
|
|
579
|
+
onViewportChange: f,
|
|
580
|
+
onToastAdd: s.useCallback(() => l((g) => g + 1), []),
|
|
581
|
+
onToastRemove: s.useCallback(() => l((g) => g - 1), []),
|
|
582
|
+
isFocusedToastEscapeKeyDownRef: m,
|
|
583
|
+
isClosePausedRef: y,
|
|
584
|
+
children: u
|
|
585
|
+
}
|
|
586
|
+
) });
|
|
587
|
+
};
|
|
588
|
+
Se.displayName = ie;
|
|
589
|
+
var Ae = "ToastViewport", Lt = ["F8"], ee = "toast.viewportPause", te = "toast.viewportResume", Oe = s.forwardRef(
|
|
590
|
+
(e, t) => {
|
|
591
|
+
const {
|
|
592
|
+
__scopeToast: n,
|
|
593
|
+
hotkey: r = Lt,
|
|
594
|
+
label: o = "Notifications ({hotkey})",
|
|
595
|
+
...a
|
|
596
|
+
} = e, u = q(Ae, n), c = It(n), f = s.useRef(null), i = s.useRef(null), l = s.useRef(null), m = s.useRef(null), y = k(t, m, u.onViewportChange), g = r.join("+").replace(/Key/g, "").replace(/Digit/g, ""), x = u.toastCount > 0;
|
|
597
|
+
s.useEffect(() => {
|
|
598
|
+
const d = (C) => {
|
|
599
|
+
var T;
|
|
600
|
+
r.length !== 0 && r.every((b) => C[b] || C.code === b) && ((T = m.current) == null || T.focus());
|
|
601
|
+
};
|
|
602
|
+
return document.addEventListener("keydown", d), () => document.removeEventListener("keydown", d);
|
|
603
|
+
}, [r]), s.useEffect(() => {
|
|
604
|
+
const d = f.current, C = m.current;
|
|
605
|
+
if (x && d && C) {
|
|
606
|
+
const E = () => {
|
|
607
|
+
if (!u.isClosePausedRef.current) {
|
|
608
|
+
const P = new CustomEvent(ee);
|
|
609
|
+
C.dispatchEvent(P), u.isClosePausedRef.current = !0;
|
|
610
|
+
}
|
|
611
|
+
}, T = () => {
|
|
612
|
+
if (u.isClosePausedRef.current) {
|
|
613
|
+
const P = new CustomEvent(te);
|
|
614
|
+
C.dispatchEvent(P), u.isClosePausedRef.current = !1;
|
|
615
|
+
}
|
|
616
|
+
}, b = (P) => {
|
|
617
|
+
!d.contains(P.relatedTarget) && T();
|
|
618
|
+
}, R = () => {
|
|
619
|
+
d.contains(document.activeElement) || T();
|
|
620
|
+
};
|
|
621
|
+
return d.addEventListener("focusin", E), d.addEventListener("focusout", b), d.addEventListener("pointermove", E), d.addEventListener("pointerleave", R), window.addEventListener("blur", E), window.addEventListener("focus", T), () => {
|
|
622
|
+
d.removeEventListener("focusin", E), d.removeEventListener("focusout", b), d.removeEventListener("pointermove", E), d.removeEventListener("pointerleave", R), window.removeEventListener("blur", E), window.removeEventListener("focus", T);
|
|
623
|
+
};
|
|
624
|
+
}
|
|
625
|
+
}, [x, u.isClosePausedRef]);
|
|
626
|
+
const v = s.useCallback(
|
|
627
|
+
({ tabbingDirection: d }) => {
|
|
628
|
+
const E = c().map((T) => {
|
|
629
|
+
const b = T.ref.current, R = [b, ...Yt(b)];
|
|
630
|
+
return d === "forwards" ? R : R.reverse();
|
|
631
|
+
});
|
|
632
|
+
return (d === "forwards" ? E.reverse() : E).flat();
|
|
633
|
+
},
|
|
634
|
+
[c]
|
|
635
|
+
);
|
|
636
|
+
return s.useEffect(() => {
|
|
637
|
+
const d = m.current;
|
|
638
|
+
if (d) {
|
|
639
|
+
const C = (E) => {
|
|
640
|
+
var R, P, h;
|
|
641
|
+
const T = E.altKey || E.ctrlKey || E.metaKey;
|
|
642
|
+
if (E.key === "Tab" && !T) {
|
|
643
|
+
const A = document.activeElement, D = E.shiftKey;
|
|
644
|
+
if (E.target === d && D) {
|
|
645
|
+
(R = i.current) == null || R.focus();
|
|
646
|
+
return;
|
|
647
|
+
}
|
|
648
|
+
const M = v({ tabbingDirection: D ? "backwards" : "forwards" }), j = M.findIndex((w) => w === A);
|
|
649
|
+
G(M.slice(j + 1)) ? E.preventDefault() : D ? (P = i.current) == null || P.focus() : (h = l.current) == null || h.focus();
|
|
650
|
+
}
|
|
651
|
+
};
|
|
652
|
+
return d.addEventListener("keydown", C), () => d.removeEventListener("keydown", C);
|
|
653
|
+
}
|
|
654
|
+
}, [c, v]), /* @__PURE__ */ re(
|
|
655
|
+
ht,
|
|
656
|
+
{
|
|
657
|
+
ref: f,
|
|
658
|
+
role: "region",
|
|
659
|
+
"aria-label": o.replace("{hotkey}", g),
|
|
660
|
+
tabIndex: -1,
|
|
661
|
+
style: { pointerEvents: x ? void 0 : "none" },
|
|
662
|
+
children: [
|
|
663
|
+
x && /* @__PURE__ */ p(
|
|
664
|
+
ne,
|
|
665
|
+
{
|
|
666
|
+
ref: i,
|
|
667
|
+
onFocusFromOutsideViewport: () => {
|
|
668
|
+
const d = v({
|
|
669
|
+
tabbingDirection: "forwards"
|
|
670
|
+
});
|
|
671
|
+
G(d);
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
),
|
|
675
|
+
/* @__PURE__ */ p(ae.Slot, { scope: n, children: /* @__PURE__ */ p(I.ol, { tabIndex: -1, ...a, ref: y }) }),
|
|
676
|
+
x && /* @__PURE__ */ p(
|
|
677
|
+
ne,
|
|
678
|
+
{
|
|
679
|
+
ref: l,
|
|
680
|
+
onFocusFromOutsideViewport: () => {
|
|
681
|
+
const d = v({
|
|
682
|
+
tabbingDirection: "backwards"
|
|
683
|
+
});
|
|
684
|
+
G(d);
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
)
|
|
688
|
+
]
|
|
689
|
+
}
|
|
690
|
+
);
|
|
691
|
+
}
|
|
692
|
+
);
|
|
693
|
+
Oe.displayName = Ae;
|
|
694
|
+
var Ie = "ToastFocusProxy", ne = s.forwardRef(
|
|
695
|
+
(e, t) => {
|
|
696
|
+
const { __scopeToast: n, onFocusFromOutsideViewport: r, ...o } = e, a = q(Ie, n);
|
|
697
|
+
return /* @__PURE__ */ p(
|
|
698
|
+
se,
|
|
699
|
+
{
|
|
700
|
+
tabIndex: 0,
|
|
701
|
+
...o,
|
|
702
|
+
ref: t,
|
|
703
|
+
style: { position: "fixed" },
|
|
704
|
+
onFocus: (u) => {
|
|
705
|
+
var i;
|
|
706
|
+
const c = u.relatedTarget;
|
|
707
|
+
!((i = a.viewport) != null && i.contains(c)) && r();
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
);
|
|
711
|
+
}
|
|
712
|
+
);
|
|
713
|
+
ne.displayName = Ie;
|
|
714
|
+
var K = "Toast", Mt = "toast.swipeStart", Ft = "toast.swipeMove", kt = "toast.swipeCancel", Vt = "toast.swipeEnd", De = s.forwardRef(
|
|
715
|
+
(e, t) => {
|
|
716
|
+
const { forceMount: n, open: r, defaultOpen: o, onOpenChange: a, ...u } = e, [c, f] = Rt({
|
|
717
|
+
prop: r,
|
|
718
|
+
defaultProp: o ?? !0,
|
|
719
|
+
onChange: a,
|
|
720
|
+
caller: K
|
|
721
|
+
});
|
|
722
|
+
return /* @__PURE__ */ p(Re, { present: n || c, children: /* @__PURE__ */ p(
|
|
723
|
+
Ut,
|
|
724
|
+
{
|
|
725
|
+
open: c,
|
|
726
|
+
...u,
|
|
727
|
+
ref: t,
|
|
728
|
+
onClose: () => f(!1),
|
|
729
|
+
onPause: V(e.onPause),
|
|
730
|
+
onResume: V(e.onResume),
|
|
731
|
+
onSwipeStart: N(e.onSwipeStart, (i) => {
|
|
732
|
+
i.currentTarget.setAttribute("data-swipe", "start");
|
|
733
|
+
}),
|
|
734
|
+
onSwipeMove: N(e.onSwipeMove, (i) => {
|
|
735
|
+
const { x: l, y: m } = i.detail.delta;
|
|
736
|
+
i.currentTarget.setAttribute("data-swipe", "move"), i.currentTarget.style.setProperty("--radix-toast-swipe-move-x", `${l}px`), i.currentTarget.style.setProperty("--radix-toast-swipe-move-y", `${m}px`);
|
|
737
|
+
}),
|
|
738
|
+
onSwipeCancel: N(e.onSwipeCancel, (i) => {
|
|
739
|
+
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");
|
|
740
|
+
}),
|
|
741
|
+
onSwipeEnd: N(e.onSwipeEnd, (i) => {
|
|
742
|
+
const { x: l, y: m } = i.detail.delta;
|
|
743
|
+
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", `${l}px`), i.currentTarget.style.setProperty("--radix-toast-swipe-end-y", `${m}px`), f(!1);
|
|
744
|
+
})
|
|
745
|
+
}
|
|
746
|
+
) });
|
|
747
|
+
}
|
|
748
|
+
);
|
|
749
|
+
De.displayName = K;
|
|
750
|
+
var [Wt, $t] = Ne(K, {
|
|
751
|
+
onClose() {
|
|
752
|
+
}
|
|
753
|
+
}), Ut = s.forwardRef(
|
|
754
|
+
(e, t) => {
|
|
755
|
+
const {
|
|
756
|
+
__scopeToast: n,
|
|
757
|
+
type: r = "foreground",
|
|
758
|
+
duration: o,
|
|
759
|
+
open: a,
|
|
760
|
+
onClose: u,
|
|
761
|
+
onEscapeKeyDown: c,
|
|
762
|
+
onPause: f,
|
|
763
|
+
onResume: i,
|
|
764
|
+
onSwipeStart: l,
|
|
765
|
+
onSwipeMove: m,
|
|
766
|
+
onSwipeCancel: y,
|
|
767
|
+
onSwipeEnd: g,
|
|
768
|
+
...x
|
|
769
|
+
} = e, v = q(K, n), [d, C] = s.useState(null), E = k(t, (w) => C(w)), T = s.useRef(null), b = s.useRef(null), R = o || v.duration, P = s.useRef(0), h = s.useRef(R), A = s.useRef(0), { onToastAdd: D, onToastRemove: L } = v, W = V(() => {
|
|
770
|
+
var S;
|
|
771
|
+
(d == null ? void 0 : d.contains(document.activeElement)) && ((S = v.viewport) == null || S.focus()), u();
|
|
772
|
+
}), M = s.useCallback(
|
|
773
|
+
(w) => {
|
|
774
|
+
!w || w === 1 / 0 || (window.clearTimeout(A.current), P.current = (/* @__PURE__ */ new Date()).getTime(), A.current = window.setTimeout(W, w));
|
|
775
|
+
},
|
|
776
|
+
[W]
|
|
777
|
+
);
|
|
778
|
+
s.useEffect(() => {
|
|
779
|
+
const w = v.viewport;
|
|
780
|
+
if (w) {
|
|
781
|
+
const S = () => {
|
|
782
|
+
M(h.current), i == null || i();
|
|
783
|
+
}, _ = () => {
|
|
784
|
+
const $ = (/* @__PURE__ */ new Date()).getTime() - P.current;
|
|
785
|
+
h.current = h.current - $, window.clearTimeout(A.current), f == null || f();
|
|
786
|
+
};
|
|
787
|
+
return w.addEventListener(ee, _), w.addEventListener(te, S), () => {
|
|
788
|
+
w.removeEventListener(ee, _), w.removeEventListener(te, S);
|
|
789
|
+
};
|
|
790
|
+
}
|
|
791
|
+
}, [v.viewport, R, f, i, M]), s.useEffect(() => {
|
|
792
|
+
a && !v.isClosePausedRef.current && M(R);
|
|
793
|
+
}, [a, R, v.isClosePausedRef, M]), s.useEffect(() => (D(), () => L()), [D, L]);
|
|
794
|
+
const j = s.useMemo(() => d ? We(d) : null, [d]);
|
|
795
|
+
return v.viewport ? /* @__PURE__ */ re(ye, { children: [
|
|
796
|
+
j && /* @__PURE__ */ p(
|
|
797
|
+
Bt,
|
|
798
|
+
{
|
|
799
|
+
__scopeToast: n,
|
|
800
|
+
role: "status",
|
|
801
|
+
"aria-live": r === "foreground" ? "assertive" : "polite",
|
|
802
|
+
children: j
|
|
803
|
+
}
|
|
804
|
+
),
|
|
805
|
+
/* @__PURE__ */ p(Wt, { scope: n, onClose: W, children: we.createPortal(
|
|
806
|
+
/* @__PURE__ */ p(ae.ItemSlot, { scope: n, children: /* @__PURE__ */ p(
|
|
807
|
+
Tt,
|
|
808
|
+
{
|
|
809
|
+
asChild: !0,
|
|
810
|
+
onEscapeKeyDown: N(c, () => {
|
|
811
|
+
v.isFocusedToastEscapeKeyDownRef.current || W(), v.isFocusedToastEscapeKeyDownRef.current = !1;
|
|
812
|
+
}),
|
|
813
|
+
children: /* @__PURE__ */ p(
|
|
814
|
+
I.li,
|
|
815
|
+
{
|
|
816
|
+
tabIndex: 0,
|
|
817
|
+
"data-state": a ? "open" : "closed",
|
|
818
|
+
"data-swipe-direction": v.swipeDirection,
|
|
819
|
+
...x,
|
|
820
|
+
ref: E,
|
|
821
|
+
style: { userSelect: "none", touchAction: "none", ...e.style },
|
|
822
|
+
onKeyDown: N(e.onKeyDown, (w) => {
|
|
823
|
+
w.key === "Escape" && (c == null || c(w.nativeEvent), w.nativeEvent.defaultPrevented || (v.isFocusedToastEscapeKeyDownRef.current = !0, W()));
|
|
824
|
+
}),
|
|
825
|
+
onPointerDown: N(e.onPointerDown, (w) => {
|
|
826
|
+
w.button === 0 && (T.current = { x: w.clientX, y: w.clientY });
|
|
827
|
+
}),
|
|
828
|
+
onPointerMove: N(e.onPointerMove, (w) => {
|
|
829
|
+
if (!T.current) return;
|
|
830
|
+
const S = w.clientX - T.current.x, _ = w.clientY - T.current.y, $ = !!b.current, U = ["left", "right"].includes(v.swipeDirection), H = ["left", "up"].includes(v.swipeDirection) ? Math.min : Math.max, Xe = U ? H(0, S) : 0, Ye = U ? 0 : H(0, _), Z = w.pointerType === "touch" ? 10 : 2, X = { x: Xe, y: Ye }, ue = { originalEvent: w, delta: X };
|
|
831
|
+
$ ? (b.current = X, z(Ft, m, ue, {
|
|
832
|
+
discrete: !1
|
|
833
|
+
})) : ve(X, v.swipeDirection, Z) ? (b.current = X, z(Mt, l, ue, {
|
|
834
|
+
discrete: !1
|
|
835
|
+
}), w.target.setPointerCapture(w.pointerId)) : (Math.abs(S) > Z || Math.abs(_) > Z) && (T.current = null);
|
|
836
|
+
}),
|
|
837
|
+
onPointerUp: N(e.onPointerUp, (w) => {
|
|
838
|
+
const S = b.current, _ = w.target;
|
|
839
|
+
if (_.hasPointerCapture(w.pointerId) && _.releasePointerCapture(w.pointerId), b.current = null, T.current = null, S) {
|
|
840
|
+
const $ = w.currentTarget, U = { originalEvent: w, delta: S };
|
|
841
|
+
ve(S, v.swipeDirection, v.swipeThreshold) ? z(Vt, g, U, {
|
|
842
|
+
discrete: !0
|
|
843
|
+
}) : z(
|
|
844
|
+
kt,
|
|
845
|
+
y,
|
|
846
|
+
U,
|
|
847
|
+
{
|
|
848
|
+
discrete: !0
|
|
849
|
+
}
|
|
850
|
+
), $.addEventListener("click", (H) => H.preventDefault(), {
|
|
851
|
+
once: !0
|
|
852
|
+
});
|
|
853
|
+
}
|
|
854
|
+
})
|
|
855
|
+
}
|
|
856
|
+
)
|
|
857
|
+
}
|
|
858
|
+
) }),
|
|
859
|
+
v.viewport
|
|
860
|
+
) })
|
|
861
|
+
] }) : null;
|
|
862
|
+
}
|
|
863
|
+
), Bt = (e) => {
|
|
864
|
+
const { __scopeToast: t, children: n, ...r } = e, o = q(K, t), [a, u] = s.useState(!1), [c, f] = s.useState(!1);
|
|
865
|
+
return Ht(() => u(!0)), s.useEffect(() => {
|
|
866
|
+
const i = window.setTimeout(() => f(!0), 1e3);
|
|
867
|
+
return () => window.clearTimeout(i);
|
|
868
|
+
}, []), c ? null : /* @__PURE__ */ p(Pe, { asChild: !0, children: /* @__PURE__ */ p(se, { ...r, children: a && /* @__PURE__ */ re(ye, { children: [
|
|
869
|
+
o.label,
|
|
870
|
+
" ",
|
|
871
|
+
n
|
|
872
|
+
] }) }) });
|
|
873
|
+
}, Kt = "ToastTitle", _e = s.forwardRef(
|
|
874
|
+
(e, t) => {
|
|
875
|
+
const { __scopeToast: n, ...r } = e;
|
|
876
|
+
return /* @__PURE__ */ p(I.div, { ...r, ref: t });
|
|
877
|
+
}
|
|
878
|
+
);
|
|
879
|
+
_e.displayName = Kt;
|
|
880
|
+
var jt = "ToastDescription", Le = s.forwardRef(
|
|
881
|
+
(e, t) => {
|
|
882
|
+
const { __scopeToast: n, ...r } = e;
|
|
883
|
+
return /* @__PURE__ */ p(I.div, { ...r, ref: t });
|
|
884
|
+
}
|
|
885
|
+
);
|
|
886
|
+
Le.displayName = jt;
|
|
887
|
+
var Me = "ToastAction", Fe = s.forwardRef(
|
|
888
|
+
(e, t) => {
|
|
889
|
+
const { altText: n, ...r } = e;
|
|
890
|
+
return n.trim() ? /* @__PURE__ */ p(Ve, { altText: n, asChild: !0, children: /* @__PURE__ */ p(ce, { ...r, ref: t }) }) : (console.error(
|
|
891
|
+
`Invalid prop \`altText\` supplied to \`${Me}\`. Expected non-empty \`string\`.`
|
|
892
|
+
), null);
|
|
893
|
+
}
|
|
894
|
+
);
|
|
895
|
+
Fe.displayName = Me;
|
|
896
|
+
var ke = "ToastClose", ce = s.forwardRef(
|
|
897
|
+
(e, t) => {
|
|
898
|
+
const { __scopeToast: n, ...r } = e, o = $t(ke, n);
|
|
899
|
+
return /* @__PURE__ */ p(Ve, { asChild: !0, children: /* @__PURE__ */ p(
|
|
900
|
+
I.button,
|
|
901
|
+
{
|
|
902
|
+
type: "button",
|
|
903
|
+
...r,
|
|
904
|
+
ref: t,
|
|
905
|
+
onClick: N(e.onClick, o.onClose)
|
|
906
|
+
}
|
|
907
|
+
) });
|
|
908
|
+
}
|
|
909
|
+
);
|
|
910
|
+
ce.displayName = ke;
|
|
911
|
+
var Ve = s.forwardRef((e, t) => {
|
|
912
|
+
const { __scopeToast: n, altText: r, ...o } = e;
|
|
913
|
+
return /* @__PURE__ */ p(
|
|
914
|
+
I.div,
|
|
915
|
+
{
|
|
916
|
+
"data-radix-toast-announce-exclude": "",
|
|
917
|
+
"data-radix-toast-announce-alt": r || void 0,
|
|
918
|
+
...o,
|
|
919
|
+
ref: t
|
|
920
|
+
}
|
|
921
|
+
);
|
|
922
|
+
});
|
|
923
|
+
function We(e) {
|
|
924
|
+
const t = [];
|
|
925
|
+
return Array.from(e.childNodes).forEach((r) => {
|
|
926
|
+
if (r.nodeType === r.TEXT_NODE && r.textContent && t.push(r.textContent), Xt(r)) {
|
|
927
|
+
const o = r.ariaHidden || r.hidden || r.style.display === "none", a = r.dataset.radixToastAnnounceExclude === "";
|
|
928
|
+
if (!o)
|
|
929
|
+
if (a) {
|
|
930
|
+
const u = r.dataset.radixToastAnnounceAlt;
|
|
931
|
+
u && t.push(u);
|
|
932
|
+
} else
|
|
933
|
+
t.push(...We(r));
|
|
934
|
+
}
|
|
935
|
+
}), t;
|
|
936
|
+
}
|
|
937
|
+
function z(e, t, n, { discrete: r }) {
|
|
938
|
+
const o = n.originalEvent.currentTarget, a = new CustomEvent(e, { bubbles: !0, cancelable: !0, detail: n });
|
|
939
|
+
t && o.addEventListener(e, t, { once: !0 }), r ? he(o, a) : o.dispatchEvent(a);
|
|
940
|
+
}
|
|
941
|
+
var ve = (e, t, n = 0) => {
|
|
942
|
+
const r = Math.abs(e.x), o = Math.abs(e.y), a = r > o;
|
|
943
|
+
return t === "left" || t === "right" ? a && r > n : !a && o > n;
|
|
944
|
+
};
|
|
945
|
+
function Ht(e = () => {
|
|
946
|
+
}) {
|
|
947
|
+
const t = V(e);
|
|
948
|
+
B(() => {
|
|
949
|
+
let n = 0, r = 0;
|
|
950
|
+
return n = window.requestAnimationFrame(() => r = window.requestAnimationFrame(t)), () => {
|
|
951
|
+
window.cancelAnimationFrame(n), window.cancelAnimationFrame(r);
|
|
952
|
+
};
|
|
953
|
+
}, [t]);
|
|
954
|
+
}
|
|
955
|
+
function Xt(e) {
|
|
956
|
+
return e.nodeType === e.ELEMENT_NODE;
|
|
957
|
+
}
|
|
958
|
+
function Yt(e) {
|
|
959
|
+
const t = [], n = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
|
|
960
|
+
acceptNode: (r) => {
|
|
961
|
+
const o = r.tagName === "INPUT" && r.type === "hidden";
|
|
962
|
+
return r.disabled || r.hidden || o ? NodeFilter.FILTER_SKIP : r.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
963
|
+
}
|
|
964
|
+
});
|
|
965
|
+
for (; n.nextNode(); ) t.push(n.currentNode);
|
|
966
|
+
return t;
|
|
967
|
+
}
|
|
968
|
+
function G(e) {
|
|
969
|
+
const t = document.activeElement;
|
|
970
|
+
return e.some((n) => n === t ? !0 : (n.focus(), document.activeElement !== t));
|
|
971
|
+
}
|
|
972
|
+
var zt = Se, $e = Oe, Ue = De, Be = _e, Ke = Le, je = Fe, He = ce;
|
|
973
|
+
const un = zt, qt = s.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ p(
|
|
974
|
+
$e,
|
|
975
|
+
{
|
|
976
|
+
ref: n,
|
|
977
|
+
className: O(
|
|
978
|
+
"fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",
|
|
979
|
+
e
|
|
980
|
+
),
|
|
981
|
+
...t
|
|
982
|
+
}
|
|
983
|
+
));
|
|
984
|
+
qt.displayName = $e.displayName;
|
|
985
|
+
const Zt = oe(
|
|
986
|
+
"group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",
|
|
987
|
+
{
|
|
988
|
+
variants: {
|
|
989
|
+
variant: {
|
|
990
|
+
default: "border bg-background text-foreground",
|
|
991
|
+
destructive: "destructive group border-destructive bg-destructive text-destructive-foreground"
|
|
992
|
+
}
|
|
993
|
+
},
|
|
994
|
+
defaultVariants: {
|
|
995
|
+
variant: "default"
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
), Gt = s.forwardRef(({ className: e, variant: t, ...n }, r) => /* @__PURE__ */ p(
|
|
999
|
+
Ue,
|
|
1000
|
+
{
|
|
1001
|
+
ref: r,
|
|
1002
|
+
className: O(Zt({ variant: t }), e),
|
|
1003
|
+
...n
|
|
1004
|
+
}
|
|
1005
|
+
));
|
|
1006
|
+
Gt.displayName = Ue.displayName;
|
|
1007
|
+
const Jt = s.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ p(
|
|
1008
|
+
je,
|
|
1009
|
+
{
|
|
1010
|
+
ref: n,
|
|
1011
|
+
className: O(
|
|
1012
|
+
"inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors group-[.destructive]:border-muted/40 hover:bg-secondary group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 group-[.destructive]:focus:ring-destructive disabled:pointer-events-none disabled:opacity-50",
|
|
1013
|
+
e
|
|
1014
|
+
),
|
|
1015
|
+
...t
|
|
1016
|
+
}
|
|
1017
|
+
));
|
|
1018
|
+
Jt.displayName = je.displayName;
|
|
1019
|
+
const Qt = s.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ p(
|
|
1020
|
+
He,
|
|
1021
|
+
{
|
|
1022
|
+
ref: n,
|
|
1023
|
+
className: O(
|
|
1024
|
+
"absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 hover:text-foreground group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:outline-none focus:ring-2 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",
|
|
1025
|
+
e
|
|
1026
|
+
),
|
|
1027
|
+
"toast-close": "",
|
|
1028
|
+
...t,
|
|
1029
|
+
children: /* @__PURE__ */ p(Je, { className: "size-4" })
|
|
1030
|
+
}
|
|
1031
|
+
));
|
|
1032
|
+
Qt.displayName = He.displayName;
|
|
1033
|
+
const en = s.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ p(
|
|
1034
|
+
Be,
|
|
1035
|
+
{
|
|
1036
|
+
ref: n,
|
|
1037
|
+
className: O("text-sm font-semibold", e),
|
|
1038
|
+
...t
|
|
1039
|
+
}
|
|
1040
|
+
));
|
|
1041
|
+
en.displayName = Be.displayName;
|
|
1042
|
+
const tn = s.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ p(
|
|
1043
|
+
Ke,
|
|
1044
|
+
{
|
|
1045
|
+
ref: n,
|
|
1046
|
+
className: O("text-sm opacity-90", e),
|
|
1047
|
+
...t
|
|
1048
|
+
}
|
|
1049
|
+
));
|
|
1050
|
+
tn.displayName = Ke.displayName;
|
|
1051
|
+
export {
|
|
1052
|
+
et as A,
|
|
1053
|
+
cn as B,
|
|
1054
|
+
Gt as T,
|
|
1055
|
+
nt as a,
|
|
1056
|
+
tt as b,
|
|
1057
|
+
Jt as c,
|
|
1058
|
+
Qt as d,
|
|
1059
|
+
tn as e,
|
|
1060
|
+
un as f,
|
|
1061
|
+
en as g,
|
|
1062
|
+
qt as h,
|
|
1063
|
+
rt as i
|
|
1064
|
+
};
|