visits-style 2.2.10 → 2.3.1
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/index.es.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
import e from "clsx";
|
|
2
2
|
import { twMerge as t } from "tailwind-merge";
|
|
3
|
-
import {
|
|
4
|
-
import { Fragment as
|
|
5
|
-
import { FloatingOverlay as
|
|
6
|
-
import { createPortal as
|
|
3
|
+
import { createContext as n, createElement as r, forwardRef as i, startTransition as a, useCallback as o, useContext as s, useEffect as c, useImperativeHandle as l, useLayoutEffect as u, useMemo as d, useRef as f, useState as p } from "react";
|
|
4
|
+
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
5
|
+
import { FloatingOverlay as _, autoUpdate as v, flip as y, offset as b, shift as x, useClick as S, useClientPoint as C, useDismiss as w, useFloating as T, useHover as E, useId as D, useInteractions as O, useTransitionStyles as k } from "@floating-ui/react";
|
|
6
|
+
import { createPortal as A } from "react-dom";
|
|
7
7
|
//#region src/utils/merge.ts
|
|
8
|
-
var
|
|
9
|
-
function
|
|
8
|
+
var j = e;
|
|
9
|
+
function M(e, n) {
|
|
10
10
|
return n ? t(e, n) : e;
|
|
11
11
|
}
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/elements/Base.tsx
|
|
14
|
-
function
|
|
15
|
-
let o =
|
|
14
|
+
function N({ as: e, classList: t = [], className: n, override: i, ...a }) {
|
|
15
|
+
let o = d(() => i ? n : M(j(t), n), [
|
|
16
16
|
t,
|
|
17
17
|
n,
|
|
18
|
-
|
|
18
|
+
i
|
|
19
19
|
]);
|
|
20
|
-
return
|
|
20
|
+
return r(e || "div", {
|
|
21
21
|
className: o,
|
|
22
|
-
...
|
|
22
|
+
...a
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
let
|
|
27
|
-
let o =
|
|
28
|
-
return
|
|
25
|
+
function P(e, t, n = {}) {
|
|
26
|
+
let i = ({ className: i, ...a }) => {
|
|
27
|
+
let o = d(() => M(t, i), [i]);
|
|
28
|
+
return r(e, {
|
|
29
29
|
className: o,
|
|
30
30
|
...n,
|
|
31
|
-
...
|
|
31
|
+
...a
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
|
-
return
|
|
34
|
+
return i.displayName = `Styled${typeof e == "string" ? e : "Component"}`, i;
|
|
35
35
|
}
|
|
36
36
|
//#endregion
|
|
37
37
|
//#region src/forms/Field/FormLabel.tsx
|
|
38
|
-
function
|
|
39
|
-
return /* @__PURE__ */
|
|
38
|
+
function F(e) {
|
|
39
|
+
return /* @__PURE__ */ h(N, {
|
|
40
40
|
as: "label",
|
|
41
41
|
classList: ["leading-none peer-disabled:opacity-70"],
|
|
42
42
|
...e
|
|
@@ -44,47 +44,40 @@ function L(e) {
|
|
|
44
44
|
}
|
|
45
45
|
//#endregion
|
|
46
46
|
//#region src/forms/Field/FormField.tsx
|
|
47
|
-
function
|
|
48
|
-
let l =
|
|
49
|
-
return /* @__PURE__ */
|
|
47
|
+
function I({ label: e, render: t, required: n, htmlFor: r, error: i, help: a, helpBefore: o, innerClass: s, ...c }) {
|
|
48
|
+
let l = d(() => j("font-medium", n ? "after:content-[\"*\"] after:text-danger after:text-sm after:pl-0.5" : ""), [n]);
|
|
49
|
+
return /* @__PURE__ */ g(N, {
|
|
50
50
|
classList: "flex flex-col space-y-2",
|
|
51
51
|
...c,
|
|
52
52
|
children: [
|
|
53
|
-
e ? /* @__PURE__ */
|
|
53
|
+
e ? /* @__PURE__ */ h(F, {
|
|
54
54
|
className: l,
|
|
55
55
|
htmlFor: r,
|
|
56
56
|
children: e
|
|
57
57
|
}) : null,
|
|
58
|
-
a && o ? /* @__PURE__ */
|
|
58
|
+
a && o ? /* @__PURE__ */ h("p", {
|
|
59
59
|
className: "text-xs text-muted pb-2",
|
|
60
60
|
children: a
|
|
61
61
|
}) : null,
|
|
62
|
-
/* @__PURE__ */
|
|
62
|
+
/* @__PURE__ */ h("div", {
|
|
63
63
|
className: s,
|
|
64
|
-
children:
|
|
64
|
+
children: t(!!i)
|
|
65
65
|
}),
|
|
66
|
-
a && !o && !i ? /* @__PURE__ */
|
|
66
|
+
a && !o && !i ? /* @__PURE__ */ h("p", {
|
|
67
67
|
className: "text-xs text-muted",
|
|
68
68
|
children: a
|
|
69
69
|
}) : null,
|
|
70
|
-
i ? /* @__PURE__ */
|
|
70
|
+
i ? /* @__PURE__ */ h("p", {
|
|
71
71
|
className: "text-xs text-danger",
|
|
72
72
|
children: i
|
|
73
73
|
}) : null
|
|
74
74
|
]
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
|
-
function z(e, t) {
|
|
78
|
-
let i = n.count(e);
|
|
79
|
-
if (!i) return null;
|
|
80
|
-
if (i === 1) return r(e, { error: t });
|
|
81
|
-
let a = n.toArray(e);
|
|
82
|
-
return a[0] = r(a[0], { error: t }), a;
|
|
83
|
-
}
|
|
84
77
|
//#endregion
|
|
85
78
|
//#region src/forms/Field/InputField.tsx
|
|
86
|
-
function
|
|
87
|
-
return /* @__PURE__ */
|
|
79
|
+
function L({ error: e, ...t }) {
|
|
80
|
+
return /* @__PURE__ */ h(N, {
|
|
88
81
|
as: "fieldset",
|
|
89
82
|
classList: [
|
|
90
83
|
"flex rounded-md border bg-background px-3 py-2 w-full [&_input]:placeholder:text-muted",
|
|
@@ -96,8 +89,8 @@ function ee({ error: e, ...t }) {
|
|
|
96
89
|
}
|
|
97
90
|
//#endregion
|
|
98
91
|
//#region src/forms/Input/index.tsx
|
|
99
|
-
function
|
|
100
|
-
return /* @__PURE__ */
|
|
92
|
+
function R({ type: e, error: t, ...n }) {
|
|
93
|
+
return /* @__PURE__ */ h(N, {
|
|
101
94
|
as: "input",
|
|
102
95
|
type: e,
|
|
103
96
|
classList: [
|
|
@@ -111,8 +104,8 @@ function B({ type: e, error: t, ...n }) {
|
|
|
111
104
|
}
|
|
112
105
|
//#endregion
|
|
113
106
|
//#region src/forms/Textarea/index.tsx
|
|
114
|
-
function
|
|
115
|
-
return /* @__PURE__ */
|
|
107
|
+
function z({ error: e, ...t }) {
|
|
108
|
+
return /* @__PURE__ */ h(N, {
|
|
116
109
|
as: "textarea",
|
|
117
110
|
classList: [
|
|
118
111
|
"flex rounded-md border bg-background px-3 py-2 w-full",
|
|
@@ -124,13 +117,13 @@ function V({ error: e, ...t }) {
|
|
|
124
117
|
}
|
|
125
118
|
//#endregion
|
|
126
119
|
//#region src/forms/Checkbox/index.tsx
|
|
127
|
-
function
|
|
128
|
-
return /* @__PURE__ */
|
|
120
|
+
function B() {
|
|
121
|
+
return /* @__PURE__ */ h("svg", {
|
|
129
122
|
xmlns: "http://www.w3.org/2000/svg",
|
|
130
123
|
width: "30",
|
|
131
124
|
height: "30",
|
|
132
125
|
viewBox: "0 0 30 30",
|
|
133
|
-
children: /* @__PURE__ */
|
|
126
|
+
children: /* @__PURE__ */ h("rect", {
|
|
134
127
|
width: "20",
|
|
135
128
|
height: "3",
|
|
136
129
|
y: "13.5",
|
|
@@ -141,11 +134,11 @@ function H() {
|
|
|
141
134
|
})
|
|
142
135
|
});
|
|
143
136
|
}
|
|
144
|
-
function
|
|
137
|
+
function V({ checked: e, indeterminate: t, id: n, name: r, onChange: i, value: a, checkIcon: o, error: s, ...c }) {
|
|
145
138
|
let l = () => {
|
|
146
139
|
c.disabled || i?.(!e);
|
|
147
140
|
};
|
|
148
|
-
return /* @__PURE__ */
|
|
141
|
+
return /* @__PURE__ */ g(N, {
|
|
149
142
|
as: "button",
|
|
150
143
|
type: "button",
|
|
151
144
|
role: "checkbox",
|
|
@@ -164,8 +157,8 @@ function U({ checked: e, indeterminate: t, id: n, name: r, onChange: i, value: a
|
|
|
164
157
|
...c,
|
|
165
158
|
children: [
|
|
166
159
|
e ? o : null,
|
|
167
|
-
t && !e ? /* @__PURE__ */
|
|
168
|
-
/* @__PURE__ */
|
|
160
|
+
t && !e ? /* @__PURE__ */ h(B, {}) : null,
|
|
161
|
+
/* @__PURE__ */ h("input", {
|
|
169
162
|
type: "checkbox",
|
|
170
163
|
"aria-hidden": "true",
|
|
171
164
|
name: r,
|
|
@@ -188,52 +181,52 @@ function U({ checked: e, indeterminate: t, id: n, name: r, onChange: i, value: a
|
|
|
188
181
|
}
|
|
189
182
|
//#endregion
|
|
190
183
|
//#region src/hooks/useIsomorphicLayoutEffect.ts
|
|
191
|
-
var
|
|
184
|
+
var H = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? u : c;
|
|
192
185
|
//#endregion
|
|
193
186
|
//#region src/components/Portal/index.tsx
|
|
194
|
-
function
|
|
195
|
-
let [r, i] =
|
|
196
|
-
return
|
|
187
|
+
function U({ children: e, container: t, disabled: n }) {
|
|
188
|
+
let [r, i] = p(null);
|
|
189
|
+
return H(() => {
|
|
197
190
|
if (!t) {
|
|
198
191
|
let e = document.getElementById("visits-style-portals");
|
|
199
192
|
return e || (e = document.createElement("div"), e.id = "visits-style-portals", document.body.appendChild(e)), i(e);
|
|
200
193
|
}
|
|
201
194
|
i(t);
|
|
202
|
-
}, [t]), n || !r ? null :
|
|
195
|
+
}, [t]), n || !r ? null : A(e, r);
|
|
203
196
|
}
|
|
204
197
|
//#endregion
|
|
205
198
|
//#region src/utils/stopPropagation.ts
|
|
206
|
-
function
|
|
199
|
+
function W(e) {
|
|
207
200
|
e && (e.stopPropagation(), e.preventDefault());
|
|
208
201
|
}
|
|
209
202
|
//#endregion
|
|
210
203
|
//#region src/components/Popover/index.tsx
|
|
211
|
-
var
|
|
204
|
+
var ee = {
|
|
212
205
|
open: 150,
|
|
213
206
|
close: 75
|
|
214
207
|
};
|
|
215
|
-
function
|
|
208
|
+
function G({ ref: e, position: t, render: n, children: r, disabled: i, offset: a = {
|
|
216
209
|
x: 0,
|
|
217
210
|
y: 6
|
|
218
|
-
}, onOpen:
|
|
219
|
-
let [
|
|
220
|
-
nodeId:
|
|
211
|
+
}, onOpen: s, onClose: u, onManualClose: d, timeout: C = ee, override: w, zIndex: E = 9996, role: A, ...j }) {
|
|
212
|
+
let [M, N] = p(!1), P = D(), F = f(s), I = f(u), { refs: L, floatingStyles: R, context: z } = T({
|
|
213
|
+
nodeId: P,
|
|
221
214
|
placement: t,
|
|
222
215
|
middleware: [
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
mainAxis:
|
|
227
|
-
crossAxis:
|
|
216
|
+
x(),
|
|
217
|
+
y({ fallbackAxisSideDirection: "end" }),
|
|
218
|
+
b({
|
|
219
|
+
mainAxis: a.y,
|
|
220
|
+
crossAxis: a.x
|
|
228
221
|
})
|
|
229
222
|
],
|
|
230
|
-
open:
|
|
223
|
+
open: M,
|
|
231
224
|
onOpenChange: (e) => {
|
|
232
|
-
e ?
|
|
225
|
+
e ? F.current?.(L.reference.current, L.floating.current) : I.current?.(L.reference.current, L.floating.current), N(e);
|
|
233
226
|
},
|
|
234
|
-
whileElementsMounted:
|
|
235
|
-
}), { isMounted:
|
|
236
|
-
duration:
|
|
227
|
+
whileElementsMounted: v
|
|
228
|
+
}), { isMounted: B, styles: V } = k(z, {
|
|
229
|
+
duration: C,
|
|
237
230
|
initial({ side: e }) {
|
|
238
231
|
let t = "";
|
|
239
232
|
return t = e === "top" ? "translateY(5%) scale(0.95)" : e === "bottom" ? "translateY(-5%) scale(0.95)" : e === "left" ? "translateX(5%) scale(0.95)" : "translateX(-5%) scale(0.95)", {
|
|
@@ -241,54 +234,53 @@ function q({ ref: e, position: t, label: i, children: a, disabled: o, offset: s
|
|
|
241
234
|
transform: t
|
|
242
235
|
};
|
|
243
236
|
}
|
|
244
|
-
}),
|
|
245
|
-
if (
|
|
246
|
-
|
|
247
|
-
}, [
|
|
248
|
-
|
|
249
|
-
if (
|
|
250
|
-
}, [
|
|
237
|
+
}), H = o((e) => {
|
|
238
|
+
if (W(e), d) return d();
|
|
239
|
+
N(!1), I.current?.(L.reference.current, L.floating.current);
|
|
240
|
+
}, [d]);
|
|
241
|
+
c(() => {
|
|
242
|
+
if (i && M) return N(!1);
|
|
243
|
+
}, [i, M]), l(e, () => ({
|
|
251
244
|
open: () => {
|
|
252
|
-
|
|
245
|
+
N(!0), F.current?.(L.reference.current, L.floating.current);
|
|
253
246
|
},
|
|
254
247
|
close: () => {
|
|
255
|
-
|
|
248
|
+
N(!1), I.current?.(L.reference.current, L.floating.current);
|
|
256
249
|
}
|
|
257
250
|
}), []);
|
|
258
|
-
let { getFloatingProps:
|
|
259
|
-
return
|
|
260
|
-
ref:
|
|
251
|
+
let { getFloatingProps: G, getReferenceProps: K } = O([S(z, { enabled: !i })]);
|
|
252
|
+
return F.current = s, I.current = u, /* @__PURE__ */ g(m, { children: [n(K({
|
|
253
|
+
ref: L.setReference,
|
|
261
254
|
tabIndex: 0,
|
|
262
|
-
|
|
263
|
-
"aria-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
children: /* @__PURE__ */ _(y, {
|
|
255
|
+
"aria-expanded": M,
|
|
256
|
+
"aria-disabled": i,
|
|
257
|
+
onClick: W
|
|
258
|
+
})), /* @__PURE__ */ h(U, {
|
|
259
|
+
disabled: i || !B,
|
|
260
|
+
children: /* @__PURE__ */ h(_, {
|
|
269
261
|
"data-testid": "vs-popover-shadow",
|
|
270
|
-
onClick:
|
|
271
|
-
style: { zIndex:
|
|
262
|
+
onClick: H,
|
|
263
|
+
style: { zIndex: E },
|
|
272
264
|
autoFocus: !0,
|
|
273
|
-
children: /* @__PURE__ */
|
|
274
|
-
role:
|
|
275
|
-
ref:
|
|
276
|
-
style:
|
|
277
|
-
children: /* @__PURE__ */
|
|
278
|
-
override:
|
|
279
|
-
styles:
|
|
280
|
-
...
|
|
281
|
-
...
|
|
282
|
-
onClick:
|
|
265
|
+
children: /* @__PURE__ */ h("div", {
|
|
266
|
+
role: A || "region",
|
|
267
|
+
ref: L.setFloating,
|
|
268
|
+
style: R,
|
|
269
|
+
children: /* @__PURE__ */ h(te, {
|
|
270
|
+
override: w,
|
|
271
|
+
styles: V,
|
|
272
|
+
...G({
|
|
273
|
+
...j,
|
|
274
|
+
onClick: W
|
|
283
275
|
}),
|
|
284
|
-
children:
|
|
276
|
+
children: r
|
|
285
277
|
})
|
|
286
278
|
})
|
|
287
279
|
})
|
|
288
280
|
})] });
|
|
289
281
|
}
|
|
290
|
-
function
|
|
291
|
-
return /* @__PURE__ */
|
|
282
|
+
function te({ override: e, styles: t, style: n = {}, ...r }) {
|
|
283
|
+
return /* @__PURE__ */ h(N, {
|
|
292
284
|
classList: ["z-20 w-auto h-auto outline-none transition-transform ease-in-out", e ? null : "border border-accent rounded-md shadow-lg p-1 bg-background"],
|
|
293
285
|
style: {
|
|
294
286
|
...t,
|
|
@@ -299,77 +291,75 @@ function ne({ override: e, styles: t, style: n = {}, ...r }) {
|
|
|
299
291
|
}
|
|
300
292
|
//#endregion
|
|
301
293
|
//#region src/forms/Select/index.tsx
|
|
302
|
-
function
|
|
303
|
-
let k =
|
|
304
|
-
|
|
305
|
-
}, [
|
|
294
|
+
function K({ ref: e, className: t, placeholder: n = "", options: r = [], error: i, disabled: a, value: s, maxHeight: c = 408, arrowIcon: u, closeIcon: m, checkIcon: _, onChange: v, onClear: y, renderItem: b, sectionLabelStyle: x, buttonAreaStyle: S, clearLabelText: C, optionStyle: w, popover: T = {}, buttonRef: E, labelStyle: D, ...O }) {
|
|
295
|
+
let k = f(null), [A, P] = p(0), F = d(() => Array.isArray(s), []), I = o((e, t) => {
|
|
296
|
+
v?.(e, t), F || k.current?.close();
|
|
297
|
+
}, [v, F]), L = o((e) => Array.isArray(s) ? s.indexOf(e) > -1 : s === e, [s]), R = d(() => {
|
|
306
298
|
let e = {}, t = r.filter((e) => typeof e != "string");
|
|
307
299
|
for (let n = 0, r = t.length; n < r; n += 1) {
|
|
308
300
|
let r = t[n];
|
|
309
301
|
e[`${r.value}`] = r.label;
|
|
310
302
|
}
|
|
311
303
|
return e;
|
|
312
|
-
}, [r]),
|
|
313
|
-
if (!
|
|
314
|
-
if (Array.isArray(
|
|
315
|
-
if (!
|
|
316
|
-
let e = [...
|
|
317
|
-
for (let n = 0, r = e.length; n < r; n += 1) t[n] =
|
|
304
|
+
}, [r]), z = d(() => {
|
|
305
|
+
if (!s) return n;
|
|
306
|
+
if (Array.isArray(s)) {
|
|
307
|
+
if (!s.length) return n;
|
|
308
|
+
let e = [...s].sort(), t = [];
|
|
309
|
+
for (let n = 0, r = e.length; n < r; n += 1) t[n] = R[`${e[n]}`] || "";
|
|
318
310
|
return t.filter(Boolean).join(",") || n;
|
|
319
311
|
}
|
|
320
|
-
return
|
|
312
|
+
return R[`${s}`] || n;
|
|
321
313
|
}, [
|
|
322
314
|
n,
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
]),
|
|
315
|
+
s,
|
|
316
|
+
R
|
|
317
|
+
]), B = d(() => s == null ? !0 : Array.isArray(s) ? !s.length : !1, [s]), V = o((e, t) => b ? typeof e == "string" ? b(e, {
|
|
326
318
|
index: t,
|
|
327
319
|
selected: !1,
|
|
328
320
|
onChange: () => {}
|
|
329
321
|
}) : b(e, {
|
|
330
322
|
index: t,
|
|
331
|
-
selected:
|
|
332
|
-
onChange: () =>
|
|
333
|
-
}) : typeof e == "string" ? /* @__PURE__ */
|
|
323
|
+
selected: L(e.value),
|
|
324
|
+
onChange: () => I(e.value, e)
|
|
325
|
+
}) : typeof e == "string" ? /* @__PURE__ */ h(N, {
|
|
334
326
|
as: "h5",
|
|
335
327
|
classList: ["font-normal py-1 px-2 text-muted"],
|
|
336
328
|
className: x,
|
|
337
329
|
children: e
|
|
338
|
-
}, `optionheader-${t}`) : /* @__PURE__ */
|
|
339
|
-
selected:
|
|
340
|
-
onChange:
|
|
341
|
-
checkIcon:
|
|
330
|
+
}, `optionheader-${t}`) : /* @__PURE__ */ h(ne, {
|
|
331
|
+
selected: L(e.value),
|
|
332
|
+
onChange: I,
|
|
333
|
+
checkIcon: _,
|
|
342
334
|
className: w,
|
|
343
335
|
data: e
|
|
344
336
|
}, e.label), [
|
|
345
337
|
b,
|
|
346
|
-
|
|
347
|
-
|
|
338
|
+
I,
|
|
339
|
+
L,
|
|
348
340
|
x,
|
|
349
341
|
w,
|
|
350
|
-
|
|
342
|
+
_
|
|
351
343
|
]);
|
|
352
|
-
return
|
|
353
|
-
|
|
354
|
-
as: "button",
|
|
344
|
+
return l(e, () => k.current, []), /* @__PURE__ */ h(G, {
|
|
345
|
+
render: (e) => /* @__PURE__ */ g("button", {
|
|
355
346
|
type: "button",
|
|
356
|
-
|
|
357
|
-
"flex items-center justify-between rounded-md border bg-background px-3 py-2 w-full overflow-hidden cursor-pointer",
|
|
358
|
-
"disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-ring",
|
|
359
|
-
i ? "border-danger hover:border-danger-fore" : "border-input not-disabled:hover:border-input-fore"
|
|
360
|
-
],
|
|
361
|
-
className: t,
|
|
347
|
+
className: M(j("flex items-center justify-between rounded-md border bg-background px-3 py-2 w-full overflow-hidden cursor-pointer", "disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-ring", i ? "border-danger hover:border-danger-fore" : "border-input not-disabled:hover:border-input-fore"), t),
|
|
362
348
|
disabled: a,
|
|
349
|
+
...e,
|
|
350
|
+
ref: (t) => {
|
|
351
|
+
e.ref?.(t), typeof E == "function" && E?.(t);
|
|
352
|
+
},
|
|
363
353
|
...O,
|
|
364
|
-
children: [/* @__PURE__ */
|
|
354
|
+
children: [/* @__PURE__ */ h(N, {
|
|
365
355
|
as: "span",
|
|
366
|
-
classList: ["overflow-hidden text-ellipsis whitespace-nowrap",
|
|
356
|
+
classList: ["overflow-hidden text-ellipsis whitespace-nowrap", B ? "text-muted" : "text-text"],
|
|
367
357
|
className: D,
|
|
368
|
-
children:
|
|
369
|
-
}), /* @__PURE__ */
|
|
358
|
+
children: z
|
|
359
|
+
}), /* @__PURE__ */ g(N, {
|
|
370
360
|
classList: "relative flex items-center space-x-2",
|
|
371
361
|
className: S,
|
|
372
|
-
children: [y && !
|
|
362
|
+
children: [y && !B ? /* @__PURE__ */ h("div", {
|
|
373
363
|
tabIndex: -1,
|
|
374
364
|
role: "button",
|
|
375
365
|
className: "size-6 p-1.5 rounded hover:bg-accent cursor-pointer",
|
|
@@ -380,29 +370,28 @@ function re({ ref: e, className: t, placeholder: n = "", options: r = [], error:
|
|
|
380
370
|
onClick: (e) => {
|
|
381
371
|
e.stopPropagation(), y();
|
|
382
372
|
},
|
|
383
|
-
children:
|
|
384
|
-
}) : null,
|
|
373
|
+
children: m
|
|
374
|
+
}) : null, u]
|
|
385
375
|
})]
|
|
386
376
|
}),
|
|
387
377
|
ref: k,
|
|
388
|
-
onOpen: (e) =>
|
|
389
|
-
className: T,
|
|
390
|
-
position: E,
|
|
378
|
+
onOpen: (e) => P(e?.getBoundingClientRect().width || 0),
|
|
391
379
|
disabled: a,
|
|
392
|
-
|
|
380
|
+
...T,
|
|
381
|
+
children: /* @__PURE__ */ h("div", {
|
|
393
382
|
className: "overflow-y-auto flex flex-col",
|
|
394
383
|
role: "listbox",
|
|
395
384
|
style: {
|
|
396
385
|
minWidth: A,
|
|
397
386
|
maxWidth: "calc(100vw - 3rem)",
|
|
398
|
-
maxHeight:
|
|
387
|
+
maxHeight: c
|
|
399
388
|
},
|
|
400
|
-
children: r.map(
|
|
389
|
+
children: r.map(V)
|
|
401
390
|
})
|
|
402
391
|
});
|
|
403
392
|
}
|
|
404
|
-
function
|
|
405
|
-
return /* @__PURE__ */
|
|
393
|
+
function ne({ className: e, data: t, selected: n, checkIcon: r, onChange: i }) {
|
|
394
|
+
return /* @__PURE__ */ g(N, {
|
|
406
395
|
as: "button",
|
|
407
396
|
type: "button",
|
|
408
397
|
role: "option",
|
|
@@ -410,16 +399,16 @@ function ie({ className: e, data: t, selected: n, checkIcon: r, onChange: i }) {
|
|
|
410
399
|
className: e,
|
|
411
400
|
"aria-selected": n,
|
|
412
401
|
onClick: () => i?.(t.value, t),
|
|
413
|
-
children: [r === null || n && r ? r : /* @__PURE__ */
|
|
402
|
+
children: [r === null || n && r ? r : /* @__PURE__ */ h("div", { className: "w-5 h-1 mr-1" }), t.label]
|
|
414
403
|
});
|
|
415
404
|
}
|
|
416
405
|
//#endregion
|
|
417
406
|
//#region src/forms/Radio/index.tsx
|
|
418
|
-
function
|
|
407
|
+
function re({ checked: e, className: t, id: n, name: r, onChange: i, value: a, error: o, ...s }) {
|
|
419
408
|
let c = () => {
|
|
420
409
|
s.disabled || i?.(!e);
|
|
421
410
|
};
|
|
422
|
-
return /* @__PURE__ */
|
|
411
|
+
return /* @__PURE__ */ g(N, {
|
|
423
412
|
as: "button",
|
|
424
413
|
type: "button",
|
|
425
414
|
role: "radio",
|
|
@@ -434,13 +423,13 @@ function ae({ checked: e, className: t, id: n, name: r, onChange: i, value: a, e
|
|
|
434
423
|
onClick: c,
|
|
435
424
|
"aria-checked": e,
|
|
436
425
|
...s,
|
|
437
|
-
children: [/* @__PURE__ */
|
|
426
|
+
children: [/* @__PURE__ */ h("i", {
|
|
438
427
|
className: "block w-2.5 h-2.5 rounded-full transition-transform",
|
|
439
428
|
style: {
|
|
440
429
|
transform: e ? "" : "scale(0.8)",
|
|
441
430
|
opacity: +!!e
|
|
442
431
|
}
|
|
443
|
-
}), /* @__PURE__ */
|
|
432
|
+
}), /* @__PURE__ */ h("input", {
|
|
444
433
|
type: "radio",
|
|
445
434
|
"aria-hidden": "true",
|
|
446
435
|
name: r,
|
|
@@ -462,11 +451,11 @@ function ae({ checked: e, className: t, id: n, name: r, onChange: i, value: a, e
|
|
|
462
451
|
}
|
|
463
452
|
//#endregion
|
|
464
453
|
//#region src/forms/Switch/index.tsx
|
|
465
|
-
function
|
|
454
|
+
function ie({ checked: e, onChange: t, value: n, id: r, name: i, error: a, ref: o, ...s }) {
|
|
466
455
|
let c = () => {
|
|
467
456
|
s.disabled || t?.(!e);
|
|
468
457
|
};
|
|
469
|
-
return /* @__PURE__ */
|
|
458
|
+
return /* @__PURE__ */ g(N, {
|
|
470
459
|
as: "button",
|
|
471
460
|
type: "button",
|
|
472
461
|
role: "switch",
|
|
@@ -481,10 +470,10 @@ function oe({ checked: e, onChange: t, value: n, id: r, name: i, error: a, ref:
|
|
|
481
470
|
"aria-checked": e,
|
|
482
471
|
"aria-invalid": a,
|
|
483
472
|
...s,
|
|
484
|
-
children: [/* @__PURE__ */
|
|
473
|
+
children: [/* @__PURE__ */ h("span", {
|
|
485
474
|
className: "pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform",
|
|
486
475
|
style: { transform: e ? "translateX(100%)" : "" }
|
|
487
|
-
}), /* @__PURE__ */
|
|
476
|
+
}), /* @__PURE__ */ h("input", {
|
|
488
477
|
ref: o,
|
|
489
478
|
type: "checkbox",
|
|
490
479
|
"aria-hidden": "true",
|
|
@@ -507,14 +496,14 @@ function oe({ checked: e, onChange: t, value: n, id: r, name: i, error: a, ref:
|
|
|
507
496
|
}
|
|
508
497
|
//#endregion
|
|
509
498
|
//#region src/components/Accordion/index.tsx
|
|
510
|
-
function
|
|
511
|
-
let a =
|
|
512
|
-
return
|
|
499
|
+
function ae({ header: e, show: t, children: n, timeout: r = 300, ...i }) {
|
|
500
|
+
let a = f(null), o = f(0), s = f(0), l = f(!0);
|
|
501
|
+
return c(() => {
|
|
513
502
|
s.current = r;
|
|
514
|
-
}, [r]),
|
|
503
|
+
}, [r]), H(() => {
|
|
515
504
|
if (!a.current) return;
|
|
516
|
-
if (a.current.style.overflow = "hidden", a.current.style.opacity = "1",
|
|
517
|
-
|
|
505
|
+
if (a.current.style.overflow = "hidden", a.current.style.opacity = "1", l.current) {
|
|
506
|
+
l.current = !1, a.current.style.height = t ? "auto" : "0px", t ? window.requestAnimationFrame(() => {
|
|
518
507
|
a.current && (o.current = a.current.offsetHeight);
|
|
519
508
|
}) : (window.requestAnimationFrame(() => {
|
|
520
509
|
a.current && (a.current.style.height = "auto", o.current = a.current.offsetHeight, a.current.style.height = "0px");
|
|
@@ -536,9 +525,9 @@ function se({ header: e, show: t, children: n, timeout: r = 300, ...i }) {
|
|
|
536
525
|
return s.current === 0 ? r() : n = window.setTimeout(r, s.current), () => {
|
|
537
526
|
e.forEach(window.cancelAnimationFrame), n && window.clearTimeout(n);
|
|
538
527
|
};
|
|
539
|
-
}, [t]), /* @__PURE__ */
|
|
528
|
+
}, [t]), /* @__PURE__ */ g("div", {
|
|
540
529
|
...i,
|
|
541
|
-
children: [e, /* @__PURE__ */
|
|
530
|
+
children: [e, /* @__PURE__ */ h("div", {
|
|
542
531
|
className: "transition-all ease-in-out overflow-hidden",
|
|
543
532
|
role: "region",
|
|
544
533
|
"aria-hidden": !t,
|
|
@@ -550,72 +539,70 @@ function se({ header: e, show: t, children: n, timeout: r = 300, ...i }) {
|
|
|
550
539
|
}
|
|
551
540
|
//#endregion
|
|
552
541
|
//#region src/components/Tooltip/index.tsx
|
|
553
|
-
var
|
|
542
|
+
var q = i(({ render: e, position: t = "bottom", label: n, className: r, timeout: i = 150, offset: a = {
|
|
554
543
|
x: 0,
|
|
555
544
|
y: 6
|
|
556
|
-
}, clientPoint:
|
|
557
|
-
let [
|
|
558
|
-
nodeId:
|
|
559
|
-
open:
|
|
545
|
+
}, clientPoint: o = !1, disabled: s }, u) => {
|
|
546
|
+
let [d, f] = p(!1), _ = D(), { refs: S, floatingStyles: w, context: A } = T({
|
|
547
|
+
nodeId: _,
|
|
548
|
+
open: d,
|
|
560
549
|
placement: t,
|
|
561
550
|
middleware: [
|
|
562
|
-
C(),
|
|
563
551
|
x(),
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
552
|
+
y(),
|
|
553
|
+
b({
|
|
554
|
+
mainAxis: a.y,
|
|
555
|
+
crossAxis: a.x
|
|
567
556
|
})
|
|
568
557
|
],
|
|
569
|
-
whileElementsMounted:
|
|
570
|
-
onOpenChange:
|
|
571
|
-
}), { getReferenceProps:
|
|
572
|
-
duration:
|
|
558
|
+
whileElementsMounted: s ? void 0 : v,
|
|
559
|
+
onOpenChange: f
|
|
560
|
+
}), { getReferenceProps: j, getFloatingProps: M } = O([E(A, { enabled: !s }), C(A, { enabled: o })]), { isMounted: N, styles: P } = k(A, {
|
|
561
|
+
duration: i,
|
|
573
562
|
initial: {
|
|
574
563
|
opacity: 0,
|
|
575
564
|
transform: "scale(0.8)"
|
|
576
565
|
}
|
|
577
566
|
});
|
|
578
|
-
|
|
579
|
-
floating:
|
|
580
|
-
reference:
|
|
581
|
-
open: () =>
|
|
582
|
-
close: () =>
|
|
583
|
-
})),
|
|
584
|
-
|
|
585
|
-
}, [
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
disabled: l || !F,
|
|
592
|
-
children: /* @__PURE__ */ _("div", {
|
|
567
|
+
return l(u, () => ({
|
|
568
|
+
floating: S.floating,
|
|
569
|
+
reference: S.reference,
|
|
570
|
+
open: () => f(!0),
|
|
571
|
+
close: () => f(!1)
|
|
572
|
+
})), c(() => {
|
|
573
|
+
s && f(!1);
|
|
574
|
+
}, [s]), /* @__PURE__ */ g(m, { children: [e({
|
|
575
|
+
ref: S.setReference,
|
|
576
|
+
...j()
|
|
577
|
+
}), /* @__PURE__ */ h(U, {
|
|
578
|
+
disabled: s || !N,
|
|
579
|
+
children: /* @__PURE__ */ h("div", {
|
|
593
580
|
role: "tooltip",
|
|
594
581
|
className: "z-9999",
|
|
595
|
-
ref:
|
|
596
|
-
...
|
|
597
|
-
children: /* @__PURE__ */
|
|
598
|
-
className:
|
|
599
|
-
style:
|
|
600
|
-
children:
|
|
582
|
+
ref: S.setFloating,
|
|
583
|
+
...M({ style: w }),
|
|
584
|
+
children: /* @__PURE__ */ h(J, {
|
|
585
|
+
className: r,
|
|
586
|
+
style: P,
|
|
587
|
+
children: n
|
|
601
588
|
})
|
|
602
589
|
})
|
|
603
590
|
})] });
|
|
604
591
|
});
|
|
605
|
-
|
|
606
|
-
var
|
|
607
|
-
let i =
|
|
608
|
-
return /* @__PURE__ */
|
|
592
|
+
q.displayName = "Tooltip";
|
|
593
|
+
var J = i(({ className: e, custom: t, ...n }, r) => {
|
|
594
|
+
let i = d(() => M(j("relative w-auto h-auto outline-none transition-transform ease-in-out whitespace-pre", t ? null : "border border-accent rounded shadow-md px-3 py-1 bg-background"), e), [e, t]);
|
|
595
|
+
return /* @__PURE__ */ h("div", {
|
|
609
596
|
ref: r,
|
|
610
597
|
className: i,
|
|
611
598
|
...n
|
|
612
599
|
});
|
|
613
600
|
});
|
|
614
|
-
|
|
601
|
+
J.displayName = "TooltipContent";
|
|
615
602
|
//#endregion
|
|
616
603
|
//#region src/elements/Button/index.tsx
|
|
617
|
-
function
|
|
618
|
-
return
|
|
604
|
+
function Y({ variant: e, size: t }) {
|
|
605
|
+
return j("inline-flex items-center justify-center whitespace-nowrap transition-colors rounded-md cursor-pointer", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", "disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-auto", {
|
|
619
606
|
"bg-primary text-inverted hover:bg-primary-fore": !e || e === "primary",
|
|
620
607
|
"bg-info text-inverted hover:bg-info-fore": e === "info",
|
|
621
608
|
"bg-warn text-inverted hover:bg-warn-fore": e === "warn",
|
|
@@ -628,8 +615,8 @@ function X({ variant: e, size: t }) {
|
|
|
628
615
|
"p-1.5": t === "icon"
|
|
629
616
|
});
|
|
630
617
|
}
|
|
631
|
-
function
|
|
632
|
-
let i =
|
|
618
|
+
function oe({ size: e, variant: t, className: n, ...r }) {
|
|
619
|
+
let i = d(() => M(Y({
|
|
633
620
|
size: e,
|
|
634
621
|
variant: t
|
|
635
622
|
}), n), [
|
|
@@ -637,7 +624,7 @@ function ce({ size: e, variant: t, className: n, ...r }) {
|
|
|
637
624
|
t,
|
|
638
625
|
n
|
|
639
626
|
]);
|
|
640
|
-
return /* @__PURE__ */
|
|
627
|
+
return /* @__PURE__ */ h("button", {
|
|
641
628
|
className: i,
|
|
642
629
|
type: "button",
|
|
643
630
|
...r
|
|
@@ -645,57 +632,57 @@ function ce({ size: e, variant: t, className: n, ...r }) {
|
|
|
645
632
|
}
|
|
646
633
|
//#endregion
|
|
647
634
|
//#region src/components/Dialog/index.tsx
|
|
648
|
-
var
|
|
635
|
+
var se = {
|
|
649
636
|
open: 150,
|
|
650
637
|
close: 75
|
|
651
638
|
};
|
|
652
|
-
function
|
|
653
|
-
let
|
|
639
|
+
function ce({ open: e, children: t, timeout: n = se, padding: r = "0.85rem", verticalAlign: i = "center", closeOnOverlay: a, closeOnEsc: s, onExited: l, className: u, onOpenChange: p, size: m, ...g }) {
|
|
640
|
+
let v = f(l), y = f(!1), b = D(), { refs: x, context: S } = T({
|
|
654
641
|
open: e,
|
|
655
|
-
onOpenChange:
|
|
642
|
+
onOpenChange: p,
|
|
656
643
|
nodeId: b
|
|
657
|
-
}), { getFloatingProps: C } =
|
|
658
|
-
enabled:
|
|
659
|
-
escapeKey:
|
|
644
|
+
}), { getFloatingProps: C } = O([w(S, {
|
|
645
|
+
enabled: s,
|
|
646
|
+
escapeKey: s,
|
|
660
647
|
outsidePress: !1
|
|
661
|
-
})]), { isMounted:
|
|
648
|
+
})]), { isMounted: E, styles: A } = k(S, {
|
|
662
649
|
duration: n,
|
|
663
650
|
initial: {
|
|
664
651
|
opacity: 0,
|
|
665
652
|
transform: "scale(0.8)"
|
|
666
653
|
}
|
|
667
654
|
});
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
}, [
|
|
671
|
-
let
|
|
672
|
-
a &&
|
|
673
|
-
}, [
|
|
674
|
-
|
|
675
|
-
let
|
|
655
|
+
c(() => {
|
|
656
|
+
y.current !== E && (y.current = E, !E && v.current?.());
|
|
657
|
+
}, [E]);
|
|
658
|
+
let M = o(() => {
|
|
659
|
+
a && p?.(!1);
|
|
660
|
+
}, [p, a]);
|
|
661
|
+
v.current = l;
|
|
662
|
+
let N = d(() => j("grid bg-backdrop z-40 justify-items-center transition ease-in-out", {
|
|
676
663
|
"place-items-start items-start": i === "start",
|
|
677
664
|
"place-items-end": i === "end",
|
|
678
665
|
"place-items-center": i === "center" || !i
|
|
679
666
|
}), [i]);
|
|
680
|
-
return /* @__PURE__ */
|
|
681
|
-
disabled: !
|
|
682
|
-
children: /* @__PURE__ */ _
|
|
683
|
-
className:
|
|
667
|
+
return /* @__PURE__ */ h(U, {
|
|
668
|
+
disabled: !E,
|
|
669
|
+
children: /* @__PURE__ */ h(_, {
|
|
670
|
+
className: N,
|
|
684
671
|
"data-testid": "vs-dialog-overlay",
|
|
685
|
-
onClick:
|
|
672
|
+
onClick: M,
|
|
686
673
|
style: {
|
|
687
674
|
padding: r,
|
|
688
|
-
opacity:
|
|
675
|
+
opacity: A.opacity
|
|
689
676
|
},
|
|
690
677
|
lockScroll: !0,
|
|
691
|
-
children: /* @__PURE__ */
|
|
678
|
+
children: /* @__PURE__ */ h(le, {
|
|
692
679
|
ref: x.setFloating,
|
|
693
|
-
className:
|
|
680
|
+
className: u,
|
|
694
681
|
role: "dialog",
|
|
695
|
-
size:
|
|
682
|
+
size: m,
|
|
696
683
|
...C({
|
|
697
|
-
...
|
|
698
|
-
style:
|
|
684
|
+
...g,
|
|
685
|
+
style: A,
|
|
699
686
|
onClick: (e) => e?.stopPropagation()
|
|
700
687
|
}),
|
|
701
688
|
children: t
|
|
@@ -703,8 +690,8 @@ function ue({ open: e, children: t, timeout: n = le, padding: r = "0.85rem", ver
|
|
|
703
690
|
})
|
|
704
691
|
});
|
|
705
692
|
}
|
|
706
|
-
function
|
|
707
|
-
return /* @__PURE__ */
|
|
693
|
+
function le({ size: e, ...t }) {
|
|
694
|
+
return /* @__PURE__ */ h(N, {
|
|
708
695
|
classList: [e ? "flex flex-col bg-background shadow-lg p-5 rounded" : null, {
|
|
709
696
|
"w-full max-w-dialog-sm": e === "small",
|
|
710
697
|
"w-full max-w-dialog-md": e === "medium",
|
|
@@ -715,16 +702,16 @@ function de({ size: e, ...t }) {
|
|
|
715
702
|
}
|
|
716
703
|
//#endregion
|
|
717
704
|
//#region src/elements/Skeleton/index.tsx
|
|
718
|
-
function
|
|
719
|
-
return /* @__PURE__ */
|
|
705
|
+
function ue(e) {
|
|
706
|
+
return /* @__PURE__ */ h(N, {
|
|
720
707
|
classList: "inline-block animate-pulse rounded-md bg-accent",
|
|
721
708
|
...e
|
|
722
709
|
});
|
|
723
710
|
}
|
|
724
711
|
//#endregion
|
|
725
712
|
//#region src/elements/Button/ButtonGroup.tsx
|
|
726
|
-
function
|
|
727
|
-
return /* @__PURE__ */
|
|
713
|
+
function de(e) {
|
|
714
|
+
return /* @__PURE__ */ h(N, {
|
|
728
715
|
role: "group",
|
|
729
716
|
classList: [
|
|
730
717
|
"flex items-center justify-center",
|
|
@@ -736,8 +723,8 @@ function pe(e) {
|
|
|
736
723
|
}
|
|
737
724
|
//#endregion
|
|
738
725
|
//#region src/elements/Spinner/index.tsx
|
|
739
|
-
function
|
|
740
|
-
return /* @__PURE__ */
|
|
726
|
+
function fe({ label: e = "Loading...", ...t }) {
|
|
727
|
+
return /* @__PURE__ */ g(N, {
|
|
741
728
|
as: "svg",
|
|
742
729
|
classList: "fill-accent animate-spin text-primary",
|
|
743
730
|
"aria-label": e,
|
|
@@ -748,10 +735,10 @@ function me({ label: e = "Loading...", ...t }) {
|
|
|
748
735
|
fill: "none",
|
|
749
736
|
xmlns: "http://www.w3.org/2000/svg",
|
|
750
737
|
...t,
|
|
751
|
-
children: [/* @__PURE__ */
|
|
738
|
+
children: [/* @__PURE__ */ h("path", {
|
|
752
739
|
d: "M100 50.6a50 50 0 1 1-100 0 50 50 0 0 1 100 0Zm-91 0a41 41 0 1 0 82 0 41 41 0 0 0-82 0Z",
|
|
753
740
|
fill: "currentFill"
|
|
754
|
-
}), /* @__PURE__ */
|
|
741
|
+
}), /* @__PURE__ */ h("path", {
|
|
755
742
|
d: "M94 39a4.2 4.2 0 0 0 3-5.4A50 50 0 0 0 41.7 1.3c-2.4.4-3.9 2.9-3.2 5.3a5 5 0 0 0 5.6 3.5A41 41 0 0 1 88 36 5 5 0 0 0 94 39Z",
|
|
756
743
|
fill: "currentColor"
|
|
757
744
|
})]
|
|
@@ -759,15 +746,15 @@ function me({ label: e = "Loading...", ...t }) {
|
|
|
759
746
|
}
|
|
760
747
|
//#endregion
|
|
761
748
|
//#region src/elements/Progress/index.tsx
|
|
762
|
-
function
|
|
763
|
-
let r =
|
|
764
|
-
return /* @__PURE__ */
|
|
749
|
+
function pe({ value: e, max: t, ...n }) {
|
|
750
|
+
let r = d(() => e ? Math.min(100, Math.round(e / t * 100)) : 0, [e, t]);
|
|
751
|
+
return /* @__PURE__ */ h(N, {
|
|
765
752
|
role: "progressbar",
|
|
766
753
|
classList: "relative overflow-hidden rounded-full bg-primary",
|
|
767
754
|
"aria-valuemax": t,
|
|
768
755
|
"aria-valuemin": 0,
|
|
769
756
|
...n,
|
|
770
|
-
children: /* @__PURE__ */
|
|
757
|
+
children: /* @__PURE__ */ h(N, {
|
|
771
758
|
className: "h-full w-full flex-1 bg-input transition-all origin-right",
|
|
772
759
|
style: { transform: `translateX(${r}%)` }
|
|
773
760
|
})
|
|
@@ -775,8 +762,8 @@ function he({ value: e, max: t, ...n }) {
|
|
|
775
762
|
}
|
|
776
763
|
//#endregion
|
|
777
764
|
//#region src/elements/Divider/index.tsx
|
|
778
|
-
function
|
|
779
|
-
return /* @__PURE__ */
|
|
765
|
+
function me({ orientation: e = "horizontal", ...t }) {
|
|
766
|
+
return /* @__PURE__ */ h(N, {
|
|
780
767
|
as: "hr",
|
|
781
768
|
role: "none",
|
|
782
769
|
classList: ["border-0 p-0 shrink-0 bg-input", e === "horizontal" ? "h-px w-full" : "w-px h-full"],
|
|
@@ -785,16 +772,16 @@ function ge({ orientation: e = "horizontal", ...t }) {
|
|
|
785
772
|
}
|
|
786
773
|
//#endregion
|
|
787
774
|
//#region src/components/Sheet/index.tsx
|
|
788
|
-
var
|
|
775
|
+
var he = {
|
|
789
776
|
open: 250,
|
|
790
777
|
close: 150
|
|
791
778
|
};
|
|
792
|
-
function
|
|
793
|
-
let
|
|
779
|
+
function ge({ open: e, timeout: t = he, onOpenChange: n, position: r = "right", overlay: i, onExited: a, onOpen: o, ...s }) {
|
|
780
|
+
let l = D(), u = f(!1), d = f(o), p = f(a), { refs: m, context: v } = T({
|
|
794
781
|
open: e,
|
|
795
782
|
onOpenChange: n,
|
|
796
|
-
nodeId:
|
|
797
|
-
}), { isMounted:
|
|
783
|
+
nodeId: l
|
|
784
|
+
}), { isMounted: y, styles: b } = k(v, {
|
|
798
785
|
duration: t,
|
|
799
786
|
initial() {
|
|
800
787
|
let e = "translateX(75%)";
|
|
@@ -804,22 +791,22 @@ function ve({ open: e, timeout: t = _e, onOpenChange: n, position: r = "right",
|
|
|
804
791
|
};
|
|
805
792
|
}
|
|
806
793
|
});
|
|
807
|
-
return
|
|
808
|
-
if (
|
|
809
|
-
if (
|
|
794
|
+
return c(() => {
|
|
795
|
+
if (u.current !== y) {
|
|
796
|
+
if (u.current = y, y) {
|
|
810
797
|
d.current?.();
|
|
811
798
|
return;
|
|
812
799
|
}
|
|
813
|
-
|
|
800
|
+
p.current?.();
|
|
814
801
|
}
|
|
815
|
-
}, [
|
|
816
|
-
disabled: !
|
|
817
|
-
children: [i ? /* @__PURE__ */ _
|
|
802
|
+
}, [y]), p.current = a, d.current = o, /* @__PURE__ */ g(U, {
|
|
803
|
+
disabled: !y,
|
|
804
|
+
children: [i ? /* @__PURE__ */ h(_, {
|
|
818
805
|
className: i === "transparent" ? "" : "bg-backdrop",
|
|
819
806
|
style: { opacity: b.opacity },
|
|
820
807
|
onClick: () => n?.(!1)
|
|
821
|
-
}) : null, /* @__PURE__ */
|
|
822
|
-
ref:
|
|
808
|
+
}) : null, /* @__PURE__ */ h(N, {
|
|
809
|
+
ref: m.setFloating,
|
|
823
810
|
role: "complementary",
|
|
824
811
|
classList: ["fixed transition-transform z-1", {
|
|
825
812
|
"top-0 right-0 h-full max-h-screen": r === "right",
|
|
@@ -828,23 +815,23 @@ function ve({ open: e, timeout: t = _e, onOpenChange: n, position: r = "right",
|
|
|
828
815
|
"bottom-0 left-0 right-0 w-full max-w-screen": r === "bottom"
|
|
829
816
|
}],
|
|
830
817
|
style: b,
|
|
831
|
-
children: /* @__PURE__ */
|
|
818
|
+
children: /* @__PURE__ */ h(_e, { ...s })
|
|
832
819
|
})]
|
|
833
820
|
});
|
|
834
821
|
}
|
|
835
|
-
function
|
|
836
|
-
return /* @__PURE__ */
|
|
822
|
+
function _e(e) {
|
|
823
|
+
return /* @__PURE__ */ h(N, {
|
|
837
824
|
classList: "relative bg-background min-w-full min-h-full border border-input shadow-lg",
|
|
838
825
|
...e
|
|
839
826
|
});
|
|
840
827
|
}
|
|
841
828
|
//#endregion
|
|
842
829
|
//#region src/components/Toast/ToastItem.tsx
|
|
843
|
-
function
|
|
844
|
-
let { icons: r } =
|
|
845
|
-
return /* @__PURE__ */
|
|
830
|
+
function X({ type: e, label: t, message: n }) {
|
|
831
|
+
let { icons: r } = ye();
|
|
832
|
+
return /* @__PURE__ */ g("div", {
|
|
846
833
|
className: "flex items-center px-4 py-3 w-80 text-sm bg-background border border-input rounded-lg shadow-md m-2",
|
|
847
|
-
children: [e ? /* @__PURE__ */
|
|
834
|
+
children: [e ? /* @__PURE__ */ g("figure", {
|
|
848
835
|
className: "mr-2",
|
|
849
836
|
children: [
|
|
850
837
|
e === "success" && r?.success ? r.success : null,
|
|
@@ -853,23 +840,23 @@ function Z({ type: e, label: t, message: n }) {
|
|
|
853
840
|
e === "warn" && r?.warn ? r.warn : null,
|
|
854
841
|
e === "loading" ? r?.loading : null
|
|
855
842
|
]
|
|
856
|
-
}) : null, /* @__PURE__ */
|
|
843
|
+
}) : null, /* @__PURE__ */ g("div", {
|
|
857
844
|
className: "space-y-2",
|
|
858
|
-
children: [/* @__PURE__ */
|
|
845
|
+
children: [/* @__PURE__ */ h("p", {
|
|
859
846
|
className: "font-medium leading-none",
|
|
860
847
|
children: t
|
|
861
|
-
}), n ? /* @__PURE__ */
|
|
848
|
+
}), n ? /* @__PURE__ */ h("p", { children: n }) : null]
|
|
862
849
|
})]
|
|
863
850
|
});
|
|
864
851
|
}
|
|
865
852
|
//#endregion
|
|
866
853
|
//#region src/components/Toast/observer.ts
|
|
867
|
-
function
|
|
868
|
-
var
|
|
869
|
-
notify =
|
|
854
|
+
function Z() {}
|
|
855
|
+
var Q = new class {
|
|
856
|
+
notify = Z;
|
|
870
857
|
lastId = 0;
|
|
871
858
|
subscribe = (e) => (this.notify = e, () => {
|
|
872
|
-
this.notify =
|
|
859
|
+
this.notify = Z;
|
|
873
860
|
});
|
|
874
861
|
add = (e, t = {}) => {
|
|
875
862
|
this.lastId += 1;
|
|
@@ -903,96 +890,96 @@ var $ = new class {
|
|
|
903
890
|
}();
|
|
904
891
|
//#endregion
|
|
905
892
|
//#region src/components/Toast/ToastFloat.tsx
|
|
906
|
-
function
|
|
907
|
-
let
|
|
893
|
+
function ve({ id: t, type: n, index: r, duration: i = 5e3, className: a, children: s, inverted: l, timeout: m = 250, max: g = 3 }) {
|
|
894
|
+
let _ = f(!1), [v, y] = p(!1), { context: b, refs: x } = T({
|
|
908
895
|
open: v,
|
|
909
896
|
onOpenChange: y,
|
|
910
897
|
nodeId: t
|
|
911
|
-
}), { isMounted: S, styles: C } =
|
|
912
|
-
duration:
|
|
898
|
+
}), { isMounted: S, styles: C } = k(b, {
|
|
899
|
+
duration: m,
|
|
913
900
|
initial: {
|
|
914
901
|
opacity: 0,
|
|
915
|
-
transform: `translateY(${
|
|
902
|
+
transform: `translateY(${l ? "" : "-"}50%)`
|
|
916
903
|
}
|
|
917
904
|
});
|
|
918
|
-
|
|
919
|
-
y(r <=
|
|
920
|
-
}, [r,
|
|
921
|
-
|
|
922
|
-
}, [S, t]),
|
|
905
|
+
u(() => {
|
|
906
|
+
y(r <= g);
|
|
907
|
+
}, [r, g]), c(() => {
|
|
908
|
+
_.current !== S && (S || Q.remove(t), _.current = S);
|
|
909
|
+
}, [S, t]), c(() => {
|
|
923
910
|
if (!i) return;
|
|
924
911
|
let e = window.setTimeout(() => y(!1), i);
|
|
925
912
|
return () => window.clearTimeout(e);
|
|
926
913
|
}, [i, t]);
|
|
927
|
-
let w =
|
|
914
|
+
let w = o(() => {
|
|
928
915
|
n !== "loading" && y(!1);
|
|
929
|
-
}, [n]),
|
|
930
|
-
return S ? /* @__PURE__ */
|
|
916
|
+
}, [n]), E = d(() => e("relative flex w-fit transition-transform ease-in-out cursor-pointer", a), [a]);
|
|
917
|
+
return S ? /* @__PURE__ */ h("li", {
|
|
931
918
|
role: "log",
|
|
932
919
|
tabIndex: -1,
|
|
933
920
|
ref: x.setFloating,
|
|
934
|
-
className:
|
|
921
|
+
className: E,
|
|
935
922
|
style: C,
|
|
936
923
|
onClick: w,
|
|
937
|
-
children:
|
|
924
|
+
children: s
|
|
938
925
|
}) : null;
|
|
939
926
|
}
|
|
940
927
|
//#endregion
|
|
941
928
|
//#region src/components/Toast/index.tsx
|
|
942
|
-
var
|
|
943
|
-
function
|
|
944
|
-
return
|
|
929
|
+
var $ = n({});
|
|
930
|
+
function ye() {
|
|
931
|
+
return s($);
|
|
945
932
|
}
|
|
946
|
-
function
|
|
947
|
-
let l =
|
|
933
|
+
function be({ className: t, offset: n = {}, position: i = "top-left", max: o, ListItem: s = X, icons: c }) {
|
|
934
|
+
let l = d(() => {
|
|
948
935
|
let e = {
|
|
949
936
|
position: "fixed",
|
|
950
937
|
...n
|
|
951
938
|
};
|
|
952
|
-
return Object.keys(n).length || (
|
|
953
|
-
}, [n,
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
if (e.type === "add")
|
|
939
|
+
return Object.keys(n).length || (i.indexOf("top") > -1 ? e.top = "16px" : i.indexOf("bottom") > -1 && (e.bottom = "16px"), i.indexOf("left") > -1 ? e.left = "16px" : i.indexOf("right") > -1 && (e.right = "16px")), i.indexOf("left") > -1 ? e.alignItems = "flex-start" : i.indexOf("right") > -1 ? e.alignItems = "flex-end" : (e.left = "50%", e.alignItems = "center", e.transform = "translateX(-50%)"), e;
|
|
940
|
+
}, [n, i]), u = d(() => e("flex flex-col z-40 overflow-hidden", t), [t]), m = d(() => i?.startsWith("bottom") || !1, [i]), g = f(/* @__PURE__ */ new Map()), [_, v] = p([]), y = p(0)[1];
|
|
941
|
+
H(() => Q.subscribe((e) => {
|
|
942
|
+
a(() => {
|
|
943
|
+
if (e.type === "add") g.current.set(e.id, e.config), v((t) => [...t, e.id]);
|
|
957
944
|
else if (e.type === "remove") {
|
|
958
|
-
if (!
|
|
945
|
+
if (!g.current.delete(e.id)) return;
|
|
959
946
|
v((t) => {
|
|
960
947
|
let n = new Set(t);
|
|
961
948
|
return n.has(e.id) ? (n.delete(e.id), Array.from(n)) : t;
|
|
962
949
|
});
|
|
963
950
|
} else if (e.type === "update") {
|
|
964
|
-
let t =
|
|
951
|
+
let t = g.current.get(e.id);
|
|
965
952
|
if (!t) return;
|
|
966
|
-
|
|
953
|
+
g.current.set(e.id, {
|
|
967
954
|
...t,
|
|
968
955
|
...e.config
|
|
969
956
|
}), y((e) => e + 1);
|
|
970
957
|
}
|
|
971
958
|
});
|
|
972
959
|
}), []);
|
|
973
|
-
let b =
|
|
974
|
-
return /* @__PURE__ */
|
|
960
|
+
let b = d(() => ({ icons: c }), [c]), x = _.length;
|
|
961
|
+
return /* @__PURE__ */ h(U, { children: /* @__PURE__ */ h("ol", {
|
|
975
962
|
className: u,
|
|
976
963
|
style: l,
|
|
977
964
|
"aria-live": "polite",
|
|
978
|
-
children: /* @__PURE__ */
|
|
965
|
+
children: /* @__PURE__ */ h($.Provider, {
|
|
979
966
|
value: b,
|
|
980
|
-
children:
|
|
981
|
-
let n =
|
|
967
|
+
children: _.map((e, t) => {
|
|
968
|
+
let n = g.current.get(e);
|
|
982
969
|
if (!n) return null;
|
|
983
|
-
let { className:
|
|
984
|
-
return /* @__PURE__ */
|
|
970
|
+
let { className: i, duration: a, ...c } = n;
|
|
971
|
+
return /* @__PURE__ */ h(ve, {
|
|
985
972
|
id: e,
|
|
986
973
|
index: x - t,
|
|
987
|
-
className:
|
|
988
|
-
duration:
|
|
989
|
-
inverted:
|
|
990
|
-
max:
|
|
991
|
-
children:
|
|
974
|
+
className: i,
|
|
975
|
+
duration: a,
|
|
976
|
+
inverted: m,
|
|
977
|
+
max: o,
|
|
978
|
+
children: r(s, c)
|
|
992
979
|
}, e);
|
|
993
980
|
})
|
|
994
981
|
})
|
|
995
982
|
}) });
|
|
996
983
|
}
|
|
997
984
|
//#endregion
|
|
998
|
-
export {
|
|
985
|
+
export { ae as Accordion, N as Base, oe as Button, de as ButtonGroup, V as Checkbox, ce as Dialog, me as Divider, I as FormField, F as FormLabel, R as Input, L as InputField, G as Popover, U as Portal, pe as Progress, re as Radio, K as Select, ge as Sheet, ue as Skeleton, fe as Spinner, ie as Switch, z as Textarea, be as Toast, X as ToastItem, q as Tooltip, j as cn, P as element, M as merge, Q as toast, Y as varientButton };
|