@opencxh/ui-kit 3.70.0 → 3.82.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1193 -1189
- package/dist/index.js.map +1 -1
- package/dist/src/action/SplitButton.d.ts +1 -1
- package/dist/src/content/PageHeader.d.ts +1 -1
- package/dist/src/content/Table.d.ts +1 -1
- package/dist/src/content/View.d.ts +1 -1
- package/dist/src/error-boundary/index.d.ts +1 -1
- package/dist/src/federated-resource/index.d.ts +1 -1
- package/dist/src/feedback/Badge.d.ts +1 -1
- package/dist/src/feedback/ContentLoading.d.ts +1 -1
- package/dist/src/feedback/Spinner.d.ts +1 -1
- package/dist/src/forms/Form.d.ts +1 -1
- package/dist/src/input/SearchableTextField.d.ts +7 -0
- package/dist/src/meeting/MeetingGrid.d.ts +1 -1
- package/dist/src/meeting/ParticipantTile.d.ts +1 -1
- package/dist/src/meeting/VideoSurface.d.ts +1 -1
- package/dist/src/navigation/Sidebar.d.ts +2 -0
- package/dist/src/overlays/Modal.d.ts +1 -1
- package/dist/src/primitives/Card.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { clsx as Ie } from "clsx";
|
|
2
2
|
import { jsxs as d, jsx as e, Fragment as Ee } from "react/jsx-runtime";
|
|
3
3
|
import { VideoOff as je, User as Be, MicOff as Pe, Mic as _e, ChevronDown as Oe, FileText as pe, HardDrive as ke, X as Ve, ArrowLeft as we, Search as $e, FolderPlus as Fe, Upload as We, Folder as Ce, Pencil as Re, ChevronDownIcon as He, ChevronRight as qe } from "lucide-react";
|
|
4
|
-
import se, { useRef as
|
|
4
|
+
import se, { useRef as Z, useEffect as K, forwardRef as ce, useState as O, useCallback as ae, useMemo as de, createContext as Ue, Component as Ge } from "react";
|
|
5
5
|
function x(...t) {
|
|
6
6
|
return Ie(t);
|
|
7
7
|
}
|
|
@@ -15,10 +15,10 @@ function Yt({ tiles: t, pinned: a, className: r }) {
|
|
|
15
15
|
if (a)
|
|
16
16
|
return /* @__PURE__ */ d("div", { className: x("flex flex-col md:flex-row gap-2 h-full", r), children: [
|
|
17
17
|
/* @__PURE__ */ e("div", { className: "flex-1 min-h-[240px]", children: a }),
|
|
18
|
-
t.length > 0 && /* @__PURE__ */ e("div", { className: "flex md:flex-col gap-2 md:w-48 overflow-auto", children: t.map((s,
|
|
18
|
+
t.length > 0 && /* @__PURE__ */ e("div", { className: "flex md:flex-col gap-2 md:w-48 overflow-auto", children: t.map((s, i) => /* @__PURE__ */ e("div", { className: "min-w-[160px] md:min-w-0", children: s }, i)) })
|
|
19
19
|
] });
|
|
20
20
|
const n = t.length <= 1 ? "grid-cols-1" : t.length <= 4 ? "grid-cols-2" : t.length <= 9 ? "grid-cols-3" : "grid-cols-4";
|
|
21
|
-
return /* @__PURE__ */ e("div", { className: x("grid gap-2 h-full", n, r), children: t.map((s,
|
|
21
|
+
return /* @__PURE__ */ e("div", { className: x("grid gap-2 h-full", n, r), children: t.map((s, i) => /* @__PURE__ */ e("div", { children: s }, i)) });
|
|
22
22
|
}
|
|
23
23
|
function Zt({
|
|
24
24
|
name: t,
|
|
@@ -26,8 +26,8 @@ function Zt({
|
|
|
26
26
|
muted: r,
|
|
27
27
|
speaking: n,
|
|
28
28
|
hasVideo: s,
|
|
29
|
-
videoSlot:
|
|
30
|
-
className:
|
|
29
|
+
videoSlot: i,
|
|
30
|
+
className: m
|
|
31
31
|
}) {
|
|
32
32
|
return /* @__PURE__ */ d(
|
|
33
33
|
"div",
|
|
@@ -35,10 +35,10 @@ function Zt({
|
|
|
35
35
|
className: x(
|
|
36
36
|
"relative rounded-lg overflow-hidden bg-gray-800 aspect-video flex items-center justify-center",
|
|
37
37
|
n && "ring-2 ring-emerald-400",
|
|
38
|
-
|
|
38
|
+
m
|
|
39
39
|
),
|
|
40
40
|
children: [
|
|
41
|
-
s &&
|
|
41
|
+
s && i ? /* @__PURE__ */ e("div", { className: "absolute inset-0", children: i }) : /* @__PURE__ */ e("div", { className: "flex flex-col items-center gap-2 text-gray-300", children: a ? /* @__PURE__ */ e("img", { src: a, alt: t, className: "w-16 h-16 rounded-full object-cover" }) : /* @__PURE__ */ e("div", { className: "w-16 h-16 rounded-full bg-gray-700 flex items-center justify-center", children: s ? /* @__PURE__ */ e(je, { className: "w-8 h-8" }) : /* @__PURE__ */ e(Be, { className: "w-8 h-8" }) }) }),
|
|
42
42
|
/* @__PURE__ */ d("div", { className: "absolute bottom-2 left-2 flex items-center gap-1.5 px-2 py-1 rounded bg-black/50 text-white text-xs", children: [
|
|
43
43
|
r ? /* @__PURE__ */ e(Pe, { className: "w-3 h-3" }) : /* @__PURE__ */ e(_e, { className: "w-3 h-3" }),
|
|
44
44
|
/* @__PURE__ */ e("span", { className: "truncate max-w-[140px]", children: t })
|
|
@@ -48,12 +48,12 @@ function Zt({
|
|
|
48
48
|
);
|
|
49
49
|
}
|
|
50
50
|
function Xt({ attach: t, active: a = !0, mirrored: r = !1, className: n }) {
|
|
51
|
-
const s =
|
|
51
|
+
const s = Z(null);
|
|
52
52
|
return K(() => {
|
|
53
53
|
if (!a || !s.current) return;
|
|
54
|
-
const
|
|
54
|
+
const i = t(s.current);
|
|
55
55
|
return () => {
|
|
56
|
-
typeof
|
|
56
|
+
typeof i == "function" && i(), s.current && (s.current.innerHTML = "");
|
|
57
57
|
};
|
|
58
58
|
}, [t, a]), /* @__PURE__ */ e(
|
|
59
59
|
"div",
|
|
@@ -94,14 +94,14 @@ const Ke = {
|
|
|
94
94
|
fullWidth: r = !1,
|
|
95
95
|
loading: n = !1,
|
|
96
96
|
leftIcon: s,
|
|
97
|
-
rightIcon:
|
|
98
|
-
iconOnly:
|
|
99
|
-
className:
|
|
97
|
+
rightIcon: i,
|
|
98
|
+
iconOnly: m = !1,
|
|
99
|
+
className: g,
|
|
100
100
|
children: p,
|
|
101
|
-
disabled:
|
|
102
|
-
...
|
|
101
|
+
disabled: b,
|
|
102
|
+
...f
|
|
103
103
|
}, l) => {
|
|
104
|
-
const u =
|
|
104
|
+
const u = b || n;
|
|
105
105
|
return /* @__PURE__ */ d(
|
|
106
106
|
"button",
|
|
107
107
|
{
|
|
@@ -114,22 +114,22 @@ const Ke = {
|
|
|
114
114
|
// Variant styles
|
|
115
115
|
Ke[t],
|
|
116
116
|
// Size styles
|
|
117
|
-
|
|
117
|
+
m ? Ye[a] : Je[a],
|
|
118
118
|
// Full width
|
|
119
119
|
r && "w-full",
|
|
120
120
|
// Loading state
|
|
121
121
|
n && "cursor-wait",
|
|
122
|
-
|
|
122
|
+
g
|
|
123
123
|
),
|
|
124
124
|
disabled: u,
|
|
125
|
-
...
|
|
125
|
+
...f,
|
|
126
126
|
children: [
|
|
127
127
|
n && /* @__PURE__ */ d(
|
|
128
128
|
"svg",
|
|
129
129
|
{
|
|
130
130
|
className: x(
|
|
131
131
|
"animate-spin",
|
|
132
|
-
|
|
132
|
+
m ? "h-4 w-4" : "h-4 w-4 mr-2"
|
|
133
133
|
),
|
|
134
134
|
fill: "none",
|
|
135
135
|
viewBox: "0 0 24 24",
|
|
@@ -156,10 +156,10 @@ const Ke = {
|
|
|
156
156
|
]
|
|
157
157
|
}
|
|
158
158
|
),
|
|
159
|
-
!n && s && /* @__PURE__ */ e("span", { className: x("flex-shrink-0", !
|
|
160
|
-
!
|
|
161
|
-
!n &&
|
|
162
|
-
|
|
159
|
+
!n && s && /* @__PURE__ */ e("span", { className: x("flex-shrink-0", !m && "mr-2"), children: s }),
|
|
160
|
+
!m && p,
|
|
161
|
+
!n && i && /* @__PURE__ */ e("span", { className: x("flex-shrink-0", !m && "ml-2"), children: i }),
|
|
162
|
+
m && !n && !s && !i && p
|
|
163
163
|
]
|
|
164
164
|
}
|
|
165
165
|
);
|
|
@@ -173,7 +173,7 @@ const Qt = ({
|
|
|
173
173
|
attached: n = !0,
|
|
174
174
|
className: s
|
|
175
175
|
}) => {
|
|
176
|
-
const
|
|
176
|
+
const i = x(
|
|
177
177
|
"inline-flex",
|
|
178
178
|
{
|
|
179
179
|
// Orientation
|
|
@@ -195,21 +195,21 @@ const Qt = ({
|
|
|
195
195
|
},
|
|
196
196
|
s
|
|
197
197
|
);
|
|
198
|
-
return /* @__PURE__ */ e("div", { className:
|
|
198
|
+
return /* @__PURE__ */ e("div", { className: i, role: "group", children: t });
|
|
199
199
|
}, er = ({
|
|
200
200
|
variant: t = "default",
|
|
201
201
|
size: a = "md",
|
|
202
202
|
color: r = "primary",
|
|
203
203
|
disabled: n = !1,
|
|
204
204
|
external: s = !1,
|
|
205
|
-
className:
|
|
206
|
-
children:
|
|
207
|
-
href:
|
|
205
|
+
className: i,
|
|
206
|
+
children: m,
|
|
207
|
+
href: g,
|
|
208
208
|
target: p,
|
|
209
|
-
rel:
|
|
210
|
-
...
|
|
209
|
+
rel: b,
|
|
210
|
+
...f
|
|
211
211
|
}) => {
|
|
212
|
-
const l = s ||
|
|
212
|
+
const l = s || g && (g.startsWith("http") || g.startsWith("mailto:")), u = x(
|
|
213
213
|
// Base styles
|
|
214
214
|
"inline-flex items-center gap-1 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2",
|
|
215
215
|
// Size variants
|
|
@@ -262,15 +262,15 @@ const Qt = ({
|
|
|
262
262
|
{
|
|
263
263
|
"opacity-50 cursor-not-allowed pointer-events-none": n
|
|
264
264
|
},
|
|
265
|
-
|
|
265
|
+
i
|
|
266
266
|
), h = {
|
|
267
|
-
...
|
|
268
|
-
href: n ? void 0 :
|
|
267
|
+
...f,
|
|
268
|
+
href: n ? void 0 : g,
|
|
269
269
|
target: l ? "_blank" : p,
|
|
270
|
-
rel: l ? "noopener noreferrer" :
|
|
270
|
+
rel: l ? "noopener noreferrer" : b
|
|
271
271
|
};
|
|
272
272
|
return /* @__PURE__ */ d("a", { className: u, ...h, children: [
|
|
273
|
-
|
|
273
|
+
m,
|
|
274
274
|
l && /* @__PURE__ */ e(
|
|
275
275
|
"svg",
|
|
276
276
|
{
|
|
@@ -305,24 +305,24 @@ function ze({
|
|
|
305
305
|
variant: r = "primary",
|
|
306
306
|
size: n = "md",
|
|
307
307
|
icon: s,
|
|
308
|
-
options:
|
|
309
|
-
disabled:
|
|
308
|
+
options: i,
|
|
309
|
+
disabled: m = !1
|
|
310
310
|
}) {
|
|
311
|
-
const [
|
|
311
|
+
const [g, p] = O(!1), b = Z(null), f = ae(() => {
|
|
312
312
|
p((l) => !l);
|
|
313
313
|
}, []);
|
|
314
314
|
return K(() => {
|
|
315
315
|
const l = (u) => {
|
|
316
|
-
|
|
316
|
+
b.current && !b.current.contains(u.target) && p(!1);
|
|
317
317
|
};
|
|
318
318
|
return document.addEventListener("mousedown", l), () => document.removeEventListener("mousedown", l);
|
|
319
|
-
}, []), /* @__PURE__ */ d("div", { ref:
|
|
319
|
+
}, []), /* @__PURE__ */ d("div", { ref: b, className: "relative inline-flex items-center gap-px", children: [
|
|
320
320
|
/* @__PURE__ */ d(
|
|
321
321
|
"button",
|
|
322
322
|
{
|
|
323
323
|
type: "button",
|
|
324
324
|
onClick: a,
|
|
325
|
-
disabled:
|
|
325
|
+
disabled: m,
|
|
326
326
|
className: x(
|
|
327
327
|
"inline-flex items-center justify-center font-medium transition-colors duration-200",
|
|
328
328
|
"focus:outline-none focus:ring-1 focus:ring-offset-1",
|
|
@@ -341,8 +341,8 @@ function ze({
|
|
|
341
341
|
"button",
|
|
342
342
|
{
|
|
343
343
|
type: "button",
|
|
344
|
-
onClick:
|
|
345
|
-
disabled:
|
|
344
|
+
onClick: f,
|
|
345
|
+
disabled: m,
|
|
346
346
|
className: x(
|
|
347
347
|
"inline-flex items-center justify-center font-medium transition-colors duration-200",
|
|
348
348
|
"focus:outline-none focus:ring-1 focus:ring-offset-1",
|
|
@@ -354,7 +354,7 @@ function ze({
|
|
|
354
354
|
children: /* @__PURE__ */ e(Oe, { className: "h-4 w-4" })
|
|
355
355
|
}
|
|
356
356
|
),
|
|
357
|
-
|
|
357
|
+
g && i.length > 0 && /* @__PURE__ */ e("div", { className: "absolute right-0 top-full mt-1 z-50 min-w-[160px] rounded-lg border border-gray-200 bg-white shadow-lg py-1", children: i.map((l) => /* @__PURE__ */ e(
|
|
358
358
|
"button",
|
|
359
359
|
{
|
|
360
360
|
type: "button",
|
|
@@ -388,21 +388,21 @@ const Xe = {
|
|
|
388
388
|
error: r,
|
|
389
389
|
size: n = "md",
|
|
390
390
|
indeterminate: s = !1,
|
|
391
|
-
containerClassName:
|
|
392
|
-
labelClassName:
|
|
393
|
-
className:
|
|
391
|
+
containerClassName: i,
|
|
392
|
+
labelClassName: m,
|
|
393
|
+
className: g,
|
|
394
394
|
id: p,
|
|
395
|
-
...
|
|
396
|
-
},
|
|
395
|
+
...b
|
|
396
|
+
}, f) => {
|
|
397
397
|
const l = p || `checkbox-${Math.random().toString(36).substr(2, 9)}`, u = !!r;
|
|
398
398
|
return se.useEffect(() => {
|
|
399
|
-
|
|
400
|
-
}, [s,
|
|
399
|
+
f && typeof f == "object" && f.current && (f.current.indeterminate = s);
|
|
400
|
+
}, [s, f]), /* @__PURE__ */ d("div", { className: x("flex flex-col", i), children: [
|
|
401
401
|
/* @__PURE__ */ d("div", { className: "flex items-start", children: [
|
|
402
402
|
/* @__PURE__ */ e("div", { className: "flex items-center h-5", children: /* @__PURE__ */ e(
|
|
403
403
|
"input",
|
|
404
404
|
{
|
|
405
|
-
ref:
|
|
405
|
+
ref: f,
|
|
406
406
|
id: l,
|
|
407
407
|
type: "checkbox",
|
|
408
408
|
className: x(
|
|
@@ -417,9 +417,9 @@ const Xe = {
|
|
|
417
417
|
// check glyph is white, so the fill must stay dark in both modes
|
|
418
418
|
// (accent-fill would invert to near-white in dark → invisible check).
|
|
419
419
|
u ? "border-error [&:not(:checked)]:bg-[var(--base-input)] text-error focus:border-error focus:ring-error" : "border-neutral [&:not(:checked)]:bg-[var(--base-input)] text-[#1a1a1a] focus:border-primary focus:ring-primary",
|
|
420
|
-
|
|
420
|
+
g
|
|
421
421
|
),
|
|
422
|
-
...
|
|
422
|
+
...b
|
|
423
423
|
}
|
|
424
424
|
) }),
|
|
425
425
|
t && /* @__PURE__ */ d("div", { className: "ml-3 flex-1", children: [
|
|
@@ -431,7 +431,7 @@ const Xe = {
|
|
|
431
431
|
"font-medium cursor-pointer",
|
|
432
432
|
u ? "text-error" : "text-default",
|
|
433
433
|
Qe[n],
|
|
434
|
-
|
|
434
|
+
m
|
|
435
435
|
),
|
|
436
436
|
children: t
|
|
437
437
|
}
|
|
@@ -450,46 +450,46 @@ const et = () => /* @__PURE__ */ e("svg", { className: "h-4 w-4", fill: "none",
|
|
|
450
450
|
placeholder: r = "Select date",
|
|
451
451
|
disabled: n = !1,
|
|
452
452
|
required: s = !1,
|
|
453
|
-
size:
|
|
454
|
-
className:
|
|
455
|
-
minDate:
|
|
453
|
+
size: i = "md",
|
|
454
|
+
className: m,
|
|
455
|
+
minDate: g,
|
|
456
456
|
maxDate: p,
|
|
457
|
-
format:
|
|
458
|
-
},
|
|
459
|
-
const [l, u] =
|
|
457
|
+
format: b = "MM/dd/yyyy"
|
|
458
|
+
}, f) => {
|
|
459
|
+
const [l, u] = O(!1), [h, k] = O(() => t || /* @__PURE__ */ new Date()), C = Z(null);
|
|
460
460
|
K(() => {
|
|
461
|
-
const
|
|
462
|
-
|
|
461
|
+
const T = (V) => {
|
|
462
|
+
C.current && !C.current.contains(V.target) && u(!1);
|
|
463
463
|
};
|
|
464
|
-
return l && document.addEventListener("mousedown",
|
|
465
|
-
document.removeEventListener("mousedown",
|
|
464
|
+
return l && document.addEventListener("mousedown", T), () => {
|
|
465
|
+
document.removeEventListener("mousedown", T);
|
|
466
466
|
};
|
|
467
467
|
}, [l]);
|
|
468
|
-
const
|
|
469
|
-
if (!
|
|
470
|
-
const
|
|
471
|
-
switch (
|
|
468
|
+
const v = (T) => {
|
|
469
|
+
if (!T) return "";
|
|
470
|
+
const V = T.getDate().toString().padStart(2, "0"), W = (T.getMonth() + 1).toString().padStart(2, "0"), c = T.getFullYear();
|
|
471
|
+
switch (b) {
|
|
472
472
|
case "dd/MM/yyyy":
|
|
473
|
-
return `${
|
|
473
|
+
return `${V}/${W}/${c}`;
|
|
474
474
|
case "yyyy-MM-dd":
|
|
475
|
-
return `${
|
|
475
|
+
return `${c}-${W}-${V}`;
|
|
476
476
|
case "MM/dd/yyyy":
|
|
477
477
|
default:
|
|
478
|
-
return `${
|
|
478
|
+
return `${W}/${V}/${c}`;
|
|
479
479
|
}
|
|
480
|
-
},
|
|
481
|
-
const
|
|
482
|
-
|
|
483
|
-
const y = [],
|
|
484
|
-
for (let
|
|
485
|
-
y.push(new Date(
|
|
480
|
+
}, j = () => {
|
|
481
|
+
const T = h.getFullYear(), V = h.getMonth(), W = new Date(T, V, 1), c = new Date(W);
|
|
482
|
+
c.setDate(c.getDate() - W.getDay());
|
|
483
|
+
const y = [], L = new Date(c);
|
|
484
|
+
for (let S = 0; S < 42; S++)
|
|
485
|
+
y.push(new Date(L)), L.setDate(L.getDate() + 1);
|
|
486
486
|
return y;
|
|
487
|
-
},
|
|
488
|
-
|
|
487
|
+
}, N = (T) => {
|
|
488
|
+
T.getMonth() === h.getMonth() && (g && T < g || p && T > p || (a?.(T), u(!1)));
|
|
489
489
|
}, q = () => {
|
|
490
|
-
|
|
491
|
-
},
|
|
492
|
-
|
|
490
|
+
k(new Date(h.getFullYear(), h.getMonth() - 1, 1));
|
|
491
|
+
}, P = () => {
|
|
492
|
+
k(new Date(h.getFullYear(), h.getMonth() + 1, 1));
|
|
493
493
|
}, U = () => {
|
|
494
494
|
a?.(null), u(!1);
|
|
495
495
|
}, F = x(
|
|
@@ -499,13 +499,13 @@ const et = () => /* @__PURE__ */ e("svg", { className: "h-4 w-4", fill: "none",
|
|
|
499
499
|
"focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary",
|
|
500
500
|
"disabled:opacity-50 disabled:cursor-not-allowed disabled:bg-module-subtle",
|
|
501
501
|
{
|
|
502
|
-
"px-3 py-2 text-sm":
|
|
503
|
-
"px-3 py-2 text-base":
|
|
504
|
-
"px-4 py-3 text-lg":
|
|
505
|
-
"px-4 py-3 text-base":
|
|
502
|
+
"px-3 py-2 text-sm": i === "sm",
|
|
503
|
+
"px-3 py-2 text-base": i === "md",
|
|
504
|
+
"px-4 py-3 text-lg": i === "lg",
|
|
505
|
+
"px-4 py-3 text-base": i === "full"
|
|
506
506
|
},
|
|
507
|
-
|
|
508
|
-
),
|
|
507
|
+
m
|
|
508
|
+
), A = j(), H = [
|
|
509
509
|
"January",
|
|
510
510
|
"February",
|
|
511
511
|
"March",
|
|
@@ -519,14 +519,14 @@ const et = () => /* @__PURE__ */ e("svg", { className: "h-4 w-4", fill: "none",
|
|
|
519
519
|
"November",
|
|
520
520
|
"December"
|
|
521
521
|
];
|
|
522
|
-
return /* @__PURE__ */ d("div", { ref:
|
|
522
|
+
return /* @__PURE__ */ d("div", { ref: C, className: "relative", children: [
|
|
523
523
|
/* @__PURE__ */ d("div", { className: "relative", children: [
|
|
524
524
|
/* @__PURE__ */ e(
|
|
525
525
|
"input",
|
|
526
526
|
{
|
|
527
|
-
ref:
|
|
527
|
+
ref: f,
|
|
528
528
|
type: "text",
|
|
529
|
-
value:
|
|
529
|
+
value: v(t ?? null),
|
|
530
530
|
placeholder: r,
|
|
531
531
|
disabled: n,
|
|
532
532
|
required: s,
|
|
@@ -557,39 +557,39 @@ const et = () => /* @__PURE__ */ e("svg", { className: "h-4 w-4", fill: "none",
|
|
|
557
557
|
}
|
|
558
558
|
),
|
|
559
559
|
/* @__PURE__ */ d("h3", { className: "text-sm font-medium text-default", children: [
|
|
560
|
-
|
|
560
|
+
H[h.getMonth()],
|
|
561
561
|
" ",
|
|
562
562
|
h.getFullYear()
|
|
563
563
|
] }),
|
|
564
564
|
/* @__PURE__ */ e(
|
|
565
565
|
"button",
|
|
566
566
|
{
|
|
567
|
-
onClick:
|
|
567
|
+
onClick: P,
|
|
568
568
|
className: "p-1 hover:bg-neutral-container rounded",
|
|
569
569
|
children: /* @__PURE__ */ e(rt, {})
|
|
570
570
|
}
|
|
571
571
|
)
|
|
572
572
|
] }),
|
|
573
|
-
/* @__PURE__ */ e("div", { className: "grid grid-cols-7 gap-1 mb-2", children: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"].map((
|
|
574
|
-
/* @__PURE__ */ e("div", { className: "grid grid-cols-7 gap-1", children:
|
|
575
|
-
const
|
|
573
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-7 gap-1 mb-2", children: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"].map((T) => /* @__PURE__ */ e("div", { className: "text-xs font-medium text-muted text-center py-1", children: T }, T)) }),
|
|
574
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-7 gap-1", children: A.map((T, V) => {
|
|
575
|
+
const W = T.getMonth() === h.getMonth(), c = t && T.toDateString() === t.toDateString(), y = T.toDateString() === (/* @__PURE__ */ new Date()).toDateString(), L = !W || g && T < g || p && T > p;
|
|
576
576
|
return /* @__PURE__ */ e(
|
|
577
577
|
"button",
|
|
578
578
|
{
|
|
579
|
-
onClick: () =>
|
|
580
|
-
disabled:
|
|
579
|
+
onClick: () => !L && N(T),
|
|
580
|
+
disabled: L,
|
|
581
581
|
className: x(
|
|
582
582
|
"w-8 h-8 text-sm rounded transition-colors duration-200",
|
|
583
583
|
{
|
|
584
|
-
"text-default hover:bg-neutral-container":
|
|
585
|
-
"bg-primary text-white":
|
|
586
|
-
"bg-neutral-container text-default": y && !
|
|
587
|
-
"text-muted cursor-not-allowed":
|
|
584
|
+
"text-default hover:bg-neutral-container": W && !c && !L,
|
|
585
|
+
"bg-primary text-white": c,
|
|
586
|
+
"bg-neutral-container text-default": y && !c,
|
|
587
|
+
"text-muted cursor-not-allowed": L
|
|
588
588
|
}
|
|
589
589
|
),
|
|
590
|
-
children:
|
|
590
|
+
children: T.getDate()
|
|
591
591
|
},
|
|
592
|
-
|
|
592
|
+
V
|
|
593
593
|
);
|
|
594
594
|
}) }),
|
|
595
595
|
/* @__PURE__ */ d("div", { className: "flex justify-between items-center mt-4 pt-3 border-t border-neutral", children: [
|
|
@@ -665,96 +665,97 @@ const et = () => /* @__PURE__ */ e("svg", { className: "h-4 w-4", fill: "none",
|
|
|
665
665
|
error: r,
|
|
666
666
|
size: n = "md",
|
|
667
667
|
fullWidth: s = !1,
|
|
668
|
-
startIcon:
|
|
669
|
-
loading:
|
|
670
|
-
containerClassName:
|
|
668
|
+
startIcon: i = /* @__PURE__ */ e(nt, {}),
|
|
669
|
+
loading: m = !1,
|
|
670
|
+
containerClassName: g,
|
|
671
671
|
labelClassName: p,
|
|
672
|
-
className:
|
|
673
|
-
id:
|
|
672
|
+
className: b,
|
|
673
|
+
id: f,
|
|
674
674
|
options: l,
|
|
675
675
|
onRemoteSearch: u,
|
|
676
676
|
onSelect: h,
|
|
677
|
-
debounceTime:
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
677
|
+
debounceTime: k = 500,
|
|
678
|
+
showAllOnOpen: C = !1,
|
|
679
|
+
value: v,
|
|
680
|
+
onChange: j,
|
|
681
|
+
...N
|
|
682
|
+
}, q) => {
|
|
683
|
+
const P = f || `searchfield-${Math.random().toString(36).substr(2, 9)}`, U = !!r, F = Z(null), A = Z(null), [H, T] = O(v || ""), [V, W] = O(!1), [c, y] = O(!1), [L, S] = O(!1);
|
|
683
684
|
K(() => {
|
|
684
|
-
|
|
685
|
-
}, [
|
|
686
|
-
const
|
|
687
|
-
if (!
|
|
688
|
-
const
|
|
685
|
+
v !== void 0 && T(v);
|
|
686
|
+
}, [v]);
|
|
687
|
+
const M = de(() => {
|
|
688
|
+
if (C && !L || !H) return l;
|
|
689
|
+
const z = String(H).toLowerCase();
|
|
689
690
|
return l.filter(
|
|
690
|
-
(
|
|
691
|
+
(D) => String(D.label).toLowerCase().includes(z)
|
|
691
692
|
);
|
|
692
|
-
}, [
|
|
693
|
+
}, [H, l, C, L]);
|
|
693
694
|
K(() => {
|
|
694
|
-
if (!u || !
|
|
695
|
-
|
|
695
|
+
if (!u || !H) {
|
|
696
|
+
y(!1);
|
|
696
697
|
return;
|
|
697
698
|
}
|
|
698
|
-
const
|
|
699
|
-
|
|
699
|
+
const z = setTimeout(async () => {
|
|
700
|
+
y(!0);
|
|
700
701
|
try {
|
|
701
|
-
await u(String(
|
|
702
|
-
} catch (
|
|
703
|
-
console.error("Remote search failed:",
|
|
702
|
+
await u(String(H));
|
|
703
|
+
} catch (D) {
|
|
704
|
+
console.error("Remote search failed:", D);
|
|
704
705
|
} finally {
|
|
705
|
-
|
|
706
|
+
y(!1);
|
|
706
707
|
}
|
|
707
|
-
},
|
|
708
|
+
}, k);
|
|
708
709
|
return () => {
|
|
709
|
-
clearTimeout(
|
|
710
|
+
clearTimeout(z), y(!1);
|
|
710
711
|
};
|
|
711
|
-
}, [
|
|
712
|
-
const
|
|
713
|
-
|
|
712
|
+
}, [H, k, u]), K(() => {
|
|
713
|
+
const z = (D) => {
|
|
714
|
+
F.current && !F.current.contains(D.target) && W(!1);
|
|
714
715
|
};
|
|
715
|
-
return document.addEventListener("mousedown",
|
|
716
|
+
return document.addEventListener("mousedown", z), () => document.removeEventListener("mousedown", z);
|
|
716
717
|
}, []);
|
|
717
|
-
const
|
|
718
|
-
const
|
|
719
|
-
|
|
720
|
-
},
|
|
721
|
-
|
|
722
|
-
},
|
|
723
|
-
(l.length > 0 || u) &&
|
|
724
|
-
},
|
|
718
|
+
const E = (z) => {
|
|
719
|
+
const D = z.target.value;
|
|
720
|
+
T(D), W(!0), S(!0), j && j(z);
|
|
721
|
+
}, Q = (z) => {
|
|
722
|
+
T(z.label), W(!1), S(!1), h && h(z.value);
|
|
723
|
+
}, re = () => {
|
|
724
|
+
(l.length > 0 || u) && (W(!0), S(!1));
|
|
725
|
+
}, X = m || c, $ = V && (M.length > 0 || X), I = de(() => q || A, [q]);
|
|
725
726
|
return /* @__PURE__ */ d(
|
|
726
727
|
"div",
|
|
727
728
|
{
|
|
728
729
|
className: ie(
|
|
729
730
|
"flex flex-col",
|
|
730
731
|
s ? "w-full" : "",
|
|
731
|
-
|
|
732
|
+
g || "",
|
|
732
733
|
"relative"
|
|
733
734
|
),
|
|
734
|
-
ref:
|
|
735
|
+
ref: F,
|
|
735
736
|
children: [
|
|
736
737
|
t && /* @__PURE__ */ e(
|
|
737
738
|
"label",
|
|
738
739
|
{
|
|
739
|
-
htmlFor:
|
|
740
|
+
htmlFor: P,
|
|
740
741
|
className: ie(
|
|
741
742
|
"block text-sm font-medium mb-1",
|
|
742
|
-
|
|
743
|
+
U ? "text-error" : "text-default",
|
|
743
744
|
p || ""
|
|
744
745
|
),
|
|
745
746
|
children: t
|
|
746
747
|
}
|
|
747
748
|
),
|
|
748
749
|
/* @__PURE__ */ d("div", { className: "relative", children: [
|
|
749
|
-
|
|
750
|
+
i && /* @__PURE__ */ e("div", { className: "absolute left-0 pl-3 flex items-center pointer-events-none h-full", children: /* @__PURE__ */ e("span", { className: ie("text-muted", xe[n]), children: i }) }),
|
|
750
751
|
/* @__PURE__ */ e(
|
|
751
752
|
"input",
|
|
752
753
|
{
|
|
753
|
-
ref:
|
|
754
|
-
id:
|
|
755
|
-
value:
|
|
756
|
-
onChange:
|
|
757
|
-
onFocus:
|
|
754
|
+
ref: I,
|
|
755
|
+
id: P,
|
|
756
|
+
value: H,
|
|
757
|
+
onChange: E,
|
|
758
|
+
onFocus: re,
|
|
758
759
|
className: ie(
|
|
759
760
|
// Base styles
|
|
760
761
|
"block w-full rounded-lg border transition-colors duration-200 bg-input",
|
|
@@ -763,17 +764,17 @@ const et = () => /* @__PURE__ */ e("svg", { className: "h-4 w-4", fill: "none",
|
|
|
763
764
|
// Size styles
|
|
764
765
|
lt[n],
|
|
765
766
|
// Icon padding
|
|
766
|
-
|
|
767
|
+
i ? "pl-10" : "",
|
|
767
768
|
"pr-10",
|
|
768
769
|
// Altijd padding rechts voor de dropdown/loading icon
|
|
769
770
|
// State styles
|
|
770
|
-
|
|
771
|
-
|
|
771
|
+
U ? "border-red-500 text-error focus:border-red-500 focus:ring-red-500" : "border-neutral text-default",
|
|
772
|
+
b || ""
|
|
772
773
|
),
|
|
773
|
-
...
|
|
774
|
+
...N
|
|
774
775
|
}
|
|
775
776
|
),
|
|
776
|
-
/* @__PURE__ */ e("div", { className: "absolute inset-y-0 right-0 pr-3 flex items-center", children:
|
|
777
|
+
/* @__PURE__ */ e("div", { className: "absolute inset-y-0 right-0 pr-3 flex items-center", children: X || m ? (
|
|
777
778
|
// Loading Spinner
|
|
778
779
|
/* @__PURE__ */ d(
|
|
779
780
|
"svg",
|
|
@@ -813,29 +814,31 @@ const et = () => /* @__PURE__ */ e("svg", { className: "h-4 w-4", fill: "none",
|
|
|
813
814
|
className: ie(
|
|
814
815
|
"text-muted cursor-pointer transition-transform",
|
|
815
816
|
xe[n],
|
|
816
|
-
|
|
817
|
+
V ? "rotate-180" : "rotate-0"
|
|
817
818
|
),
|
|
818
|
-
onClick: () =>
|
|
819
|
+
onClick: () => {
|
|
820
|
+
W((z) => (z || S(!1), !z));
|
|
821
|
+
}
|
|
819
822
|
}
|
|
820
823
|
)
|
|
821
824
|
) })
|
|
822
825
|
] }),
|
|
823
|
-
|
|
826
|
+
$ && /* @__PURE__ */ e(
|
|
824
827
|
"ul",
|
|
825
828
|
{
|
|
826
829
|
className: "absolute z-10 mt-1 w-full bg-module border border-neutral rounded-lg shadow-lg max-h-60 overflow-auto top-full",
|
|
827
830
|
role: "listbox",
|
|
828
|
-
children:
|
|
831
|
+
children: M.length > 0 ? M.map((z) => /* @__PURE__ */ e(
|
|
829
832
|
"li",
|
|
830
833
|
{
|
|
831
834
|
className: "px-4 py-2 cursor-pointer text-default hover:bg-accent-container hover:text-accent transition-colors",
|
|
832
|
-
onClick: () =>
|
|
835
|
+
onClick: () => Q(z),
|
|
833
836
|
role: "option",
|
|
834
|
-
"aria-selected":
|
|
835
|
-
children:
|
|
837
|
+
"aria-selected": H === z.label,
|
|
838
|
+
children: z.label
|
|
836
839
|
},
|
|
837
|
-
|
|
838
|
-
)) : /* @__PURE__ */ e("li", { className: "px-4 py-2 text-muted", children:
|
|
840
|
+
z.value
|
|
841
|
+
)) : /* @__PURE__ */ e("li", { className: "px-4 py-2 text-muted", children: X || m ? "Zoeken op afstand..." : "Geen resultaten gevonden." })
|
|
839
842
|
}
|
|
840
843
|
),
|
|
841
844
|
(r || a) && /* @__PURE__ */ e(
|
|
@@ -843,14 +846,14 @@ const et = () => /* @__PURE__ */ e("svg", { className: "h-4 w-4", fill: "none",
|
|
|
843
846
|
{
|
|
844
847
|
className: ie(
|
|
845
848
|
"mt-1 text-xs",
|
|
846
|
-
|
|
849
|
+
U ? "text-error" : "text-muted"
|
|
847
850
|
),
|
|
848
851
|
children: r || a
|
|
849
852
|
}
|
|
850
853
|
),
|
|
851
854
|
u && /* @__PURE__ */ d("p", { className: "mt-2 text-xs text-success dark:text-success", children: [
|
|
852
855
|
"Huidige zoekterm (niet-gedebounced): ",
|
|
853
|
-
String(
|
|
856
|
+
String(H)
|
|
854
857
|
] })
|
|
855
858
|
]
|
|
856
859
|
}
|
|
@@ -870,83 +873,83 @@ const ot = {
|
|
|
870
873
|
error: r,
|
|
871
874
|
size: n = "md",
|
|
872
875
|
fullWidth: s = !1,
|
|
873
|
-
options:
|
|
874
|
-
placeholder:
|
|
875
|
-
containerClassName:
|
|
876
|
+
options: i,
|
|
877
|
+
placeholder: m,
|
|
878
|
+
containerClassName: g,
|
|
876
879
|
labelClassName: p,
|
|
877
|
-
className:
|
|
878
|
-
id:
|
|
880
|
+
className: b,
|
|
881
|
+
id: f,
|
|
879
882
|
searchable: l,
|
|
880
883
|
multiple: u,
|
|
881
884
|
value: h,
|
|
882
|
-
onChange:
|
|
883
|
-
allowCreate:
|
|
884
|
-
onCreateOption:
|
|
885
|
-
...
|
|
886
|
-
},
|
|
887
|
-
const q =
|
|
888
|
-
se.useImperativeHandle(
|
|
889
|
-
const
|
|
890
|
-
|
|
885
|
+
onChange: k,
|
|
886
|
+
allowCreate: C,
|
|
887
|
+
onCreateOption: v,
|
|
888
|
+
...j
|
|
889
|
+
}, N) => {
|
|
890
|
+
const q = f || `select-${Math.random().toString(36).substr(2, 9)}`, P = !!r, [U, F] = se.useState(!1), [A, H] = se.useState(""), T = se.useRef(null), [V, W] = se.useState(i);
|
|
891
|
+
se.useImperativeHandle(N, () => T.current), se.useEffect(() => {
|
|
892
|
+
const $ = (I) => {
|
|
893
|
+
T.current && !T.current.contains(I.target) && F(!1);
|
|
891
894
|
};
|
|
892
|
-
return document.addEventListener("mousedown",
|
|
895
|
+
return document.addEventListener("mousedown", $), () => document.removeEventListener("mousedown", $);
|
|
893
896
|
}, []);
|
|
894
|
-
const
|
|
895
|
-
(
|
|
896
|
-
(
|
|
897
|
+
const c = se.useCallback(
|
|
898
|
+
($, I) => $.some(
|
|
899
|
+
(z) => me(z.value) === me(I) || me(z.label) === me(I)
|
|
897
900
|
),
|
|
898
901
|
[]
|
|
899
902
|
), y = se.useCallback(
|
|
900
|
-
(
|
|
901
|
-
const
|
|
903
|
+
($, I) => {
|
|
904
|
+
const z = [...$], D = (ee) => {
|
|
902
905
|
const ne = (ee ?? "").trim();
|
|
903
|
-
ne && (
|
|
906
|
+
ne && (c(z, ne) || z.push({ value: ne, label: ne }));
|
|
904
907
|
};
|
|
905
|
-
return Array.isArray(
|
|
908
|
+
return Array.isArray(I) ? I.forEach(D) : D(I), z;
|
|
906
909
|
},
|
|
907
|
-
[
|
|
910
|
+
[c]
|
|
908
911
|
);
|
|
909
912
|
se.useEffect(() => {
|
|
910
|
-
|
|
911
|
-
const
|
|
912
|
-
return
|
|
913
|
-
!
|
|
914
|
-
}), y(
|
|
913
|
+
W(($) => {
|
|
914
|
+
const I = [...i];
|
|
915
|
+
return $.forEach((z) => {
|
|
916
|
+
!c(I, z.value) && !c(I, z.label) && I.push(z);
|
|
917
|
+
}), y(I, h);
|
|
915
918
|
});
|
|
916
|
-
}, [
|
|
917
|
-
const
|
|
919
|
+
}, [i, h, y, c]);
|
|
920
|
+
const L = ($) => {
|
|
918
921
|
if (u) {
|
|
919
|
-
const
|
|
920
|
-
|
|
922
|
+
const I = Array.isArray(h) ? h : [], z = I.includes($) ? I.filter((D) => D !== $) : [...I, $];
|
|
923
|
+
k?.(z);
|
|
921
924
|
} else
|
|
922
|
-
|
|
923
|
-
},
|
|
924
|
-
(
|
|
925
|
-
) : [],
|
|
926
|
-
(
|
|
927
|
-
) :
|
|
928
|
-
const
|
|
929
|
-
if (!
|
|
930
|
-
const
|
|
931
|
-
value:
|
|
932
|
-
label:
|
|
925
|
+
k?.($), F(!1), H("");
|
|
926
|
+
}, S = u ? null : V.find(($) => $.value === h), M = u ? V.filter(
|
|
927
|
+
($) => Array.isArray(h) && h.includes($.value)
|
|
928
|
+
) : [], E = l && A ? V.filter(
|
|
929
|
+
($) => $.label.toLowerCase().includes(A.toLowerCase())
|
|
930
|
+
) : V, Q = !!C && !!l && !!A.trim() && !c(V, A), re = ($) => {
|
|
931
|
+
const I = $.trim();
|
|
932
|
+
if (!I) return;
|
|
933
|
+
const z = v?.(I) ?? {
|
|
934
|
+
value: I,
|
|
935
|
+
label: I
|
|
933
936
|
};
|
|
934
|
-
if (
|
|
935
|
-
|
|
937
|
+
if (c(V, z.value) || c(V, z.label)) {
|
|
938
|
+
L(z.value), H(""), u || F(!1);
|
|
936
939
|
return;
|
|
937
940
|
}
|
|
938
|
-
|
|
939
|
-
},
|
|
941
|
+
W((D) => [...D, z]), L(z.value), H(""), u || F(!1);
|
|
942
|
+
}, X = () => u ? M.length > 0 ? M.map(($) => $.label).join(", ") : m || "Select options" : S?.label || m || "Select an option";
|
|
940
943
|
return /* @__PURE__ */ d(
|
|
941
944
|
"div",
|
|
942
945
|
{
|
|
943
|
-
ref:
|
|
946
|
+
ref: T,
|
|
944
947
|
className: x(
|
|
945
948
|
"relative flex flex-col",
|
|
946
949
|
s && "w-full",
|
|
947
|
-
|
|
950
|
+
g
|
|
948
951
|
),
|
|
949
|
-
...
|
|
952
|
+
...j,
|
|
950
953
|
children: [
|
|
951
954
|
t && /* @__PURE__ */ e(
|
|
952
955
|
"label",
|
|
@@ -955,7 +958,7 @@ const ot = {
|
|
|
955
958
|
onClick: () => F(!U),
|
|
956
959
|
className: x(
|
|
957
960
|
"block text-sm font-medium mb-1",
|
|
958
|
-
|
|
961
|
+
P ? "text-error" : "text-default",
|
|
959
962
|
p
|
|
960
963
|
),
|
|
961
964
|
children: t
|
|
@@ -974,10 +977,10 @@ const ot = {
|
|
|
974
977
|
"disabled:opacity-50 disabled:cursor-not-allowed",
|
|
975
978
|
"bg-module",
|
|
976
979
|
ot[n],
|
|
977
|
-
|
|
978
|
-
|
|
980
|
+
P ? "border-error text-error focus:border-error focus:ring-error" : "border-neutral text-default",
|
|
981
|
+
b
|
|
979
982
|
),
|
|
980
|
-
children: /* @__PURE__ */ e("span", { className: "block truncate", children:
|
|
983
|
+
children: /* @__PURE__ */ e("span", { className: "block truncate", children: X() })
|
|
981
984
|
}
|
|
982
985
|
),
|
|
983
986
|
U && /* @__PURE__ */ d("div", { className: "absolute z-10 mt-1 w-full rounded-md bg-module shadow-lg border border-neutral", children: [
|
|
@@ -986,10 +989,10 @@ const ot = {
|
|
|
986
989
|
{
|
|
987
990
|
type: "text",
|
|
988
991
|
placeholder: "Search...",
|
|
989
|
-
value:
|
|
990
|
-
onChange: (
|
|
991
|
-
onKeyDown: (
|
|
992
|
-
|
|
992
|
+
value: A,
|
|
993
|
+
onChange: ($) => H($.target.value),
|
|
994
|
+
onKeyDown: ($) => {
|
|
995
|
+
$.key === "Enter" && Q && ($.preventDefault(), re(A));
|
|
993
996
|
},
|
|
994
997
|
className: x(
|
|
995
998
|
"w-full px-3 py-2 text-sm rounded-md border",
|
|
@@ -1004,51 +1007,51 @@ const ot = {
|
|
|
1004
1007
|
"px-4 py-2 text-sm cursor-pointer",
|
|
1005
1008
|
"text-primary hover:bg-neutral-container"
|
|
1006
1009
|
),
|
|
1007
|
-
onClick: () => re(
|
|
1010
|
+
onClick: () => re(A),
|
|
1008
1011
|
children: [
|
|
1009
1012
|
"+: “",
|
|
1010
|
-
|
|
1013
|
+
A.trim(),
|
|
1011
1014
|
"”"
|
|
1012
1015
|
]
|
|
1013
1016
|
}
|
|
1014
1017
|
),
|
|
1015
1018
|
/* @__PURE__ */ d("ul", { className: "max-h-60 overflow-auto py-1", children: [
|
|
1016
|
-
|
|
1019
|
+
m && !u && /* @__PURE__ */ e(
|
|
1017
1020
|
"li",
|
|
1018
1021
|
{
|
|
1019
1022
|
className: "px-4 py-2 text-sm text-muted cursor-pointer hover:bg-neutral-container",
|
|
1020
1023
|
onClick: () => {
|
|
1021
|
-
|
|
1024
|
+
k?.(""), F(!1);
|
|
1022
1025
|
},
|
|
1023
|
-
children:
|
|
1026
|
+
children: m
|
|
1024
1027
|
}
|
|
1025
1028
|
),
|
|
1026
|
-
|
|
1027
|
-
const
|
|
1029
|
+
E.map(($) => {
|
|
1030
|
+
const I = u ? Array.isArray(h) && h.includes($.value) : h === $.value;
|
|
1028
1031
|
return /* @__PURE__ */ e(
|
|
1029
1032
|
"li",
|
|
1030
1033
|
{
|
|
1031
|
-
onClick: () =>
|
|
1034
|
+
onClick: () => !$.disabled && L($.value),
|
|
1032
1035
|
className: x(
|
|
1033
1036
|
"px-4 py-2 text-sm cursor-pointer",
|
|
1034
1037
|
"text-default",
|
|
1035
|
-
|
|
1036
|
-
|
|
1038
|
+
$.disabled ? "opacity-50 cursor-not-allowed" : "hover:bg-neutral-container",
|
|
1039
|
+
I && "font-semibold"
|
|
1037
1040
|
),
|
|
1038
1041
|
children: /* @__PURE__ */ d("div", { className: "flex items-center", children: [
|
|
1039
1042
|
u && /* @__PURE__ */ e(
|
|
1040
1043
|
"input",
|
|
1041
1044
|
{
|
|
1042
1045
|
type: "checkbox",
|
|
1043
|
-
checked:
|
|
1046
|
+
checked: I,
|
|
1044
1047
|
readOnly: !0,
|
|
1045
1048
|
className: "mr-3 h-4 w-4 rounded border-neutral [&:not(:checked)]:bg-[var(--base-input)] text-[#1a1a1a] focus:ring-primary"
|
|
1046
1049
|
}
|
|
1047
1050
|
),
|
|
1048
|
-
/* @__PURE__ */ e("span", { children:
|
|
1051
|
+
/* @__PURE__ */ e("span", { children: $.label })
|
|
1049
1052
|
] })
|
|
1050
1053
|
},
|
|
1051
|
-
|
|
1054
|
+
$.value
|
|
1052
1055
|
);
|
|
1053
1056
|
})
|
|
1054
1057
|
] })
|
|
@@ -1059,7 +1062,7 @@ const ot = {
|
|
|
1059
1062
|
{
|
|
1060
1063
|
className: x(
|
|
1061
1064
|
"mt-1 text-xs",
|
|
1062
|
-
|
|
1065
|
+
P ? "text-error" : "text-muted"
|
|
1063
1066
|
),
|
|
1064
1067
|
children: r || a
|
|
1065
1068
|
}
|
|
@@ -1082,24 +1085,24 @@ const ct = {
|
|
|
1082
1085
|
error: r,
|
|
1083
1086
|
size: n = "md",
|
|
1084
1087
|
fullWidth: s = !1,
|
|
1085
|
-
loading:
|
|
1086
|
-
containerClassName:
|
|
1087
|
-
labelClassName:
|
|
1088
|
+
loading: i = !1,
|
|
1089
|
+
containerClassName: m,
|
|
1090
|
+
labelClassName: g,
|
|
1088
1091
|
className: p,
|
|
1089
|
-
id:
|
|
1090
|
-
rows:
|
|
1092
|
+
id: b,
|
|
1093
|
+
rows: f = 4,
|
|
1091
1094
|
...l
|
|
1092
1095
|
}, u) => {
|
|
1093
|
-
const h =
|
|
1094
|
-
return /* @__PURE__ */ d("div", { className: x("flex flex-col", s && "w-full",
|
|
1096
|
+
const h = b || `textarea-${Math.random().toString(36).substr(2, 9)}`, k = !!r;
|
|
1097
|
+
return /* @__PURE__ */ d("div", { className: x("flex flex-col", s && "w-full", m), children: [
|
|
1095
1098
|
t && /* @__PURE__ */ e(
|
|
1096
1099
|
"label",
|
|
1097
1100
|
{
|
|
1098
1101
|
htmlFor: h,
|
|
1099
1102
|
className: x(
|
|
1100
1103
|
"block text-sm font-medium mb-1",
|
|
1101
|
-
|
|
1102
|
-
|
|
1104
|
+
k ? "text-error" : "text-default",
|
|
1105
|
+
g
|
|
1103
1106
|
),
|
|
1104
1107
|
children: t
|
|
1105
1108
|
}
|
|
@@ -1110,7 +1113,7 @@ const ct = {
|
|
|
1110
1113
|
{
|
|
1111
1114
|
ref: u,
|
|
1112
1115
|
id: h,
|
|
1113
|
-
rows:
|
|
1116
|
+
rows: f,
|
|
1114
1117
|
className: x(
|
|
1115
1118
|
// Base styles
|
|
1116
1119
|
"block w-full rounded-lg border transition-colors duration-200 resize-vertical bg-input",
|
|
@@ -1119,13 +1122,13 @@ const ct = {
|
|
|
1119
1122
|
// Size styles
|
|
1120
1123
|
ct[n],
|
|
1121
1124
|
// State styles
|
|
1122
|
-
|
|
1125
|
+
k ? "border-error text-error focus:border-error focus:ring-error" : "border-neutral text-default",
|
|
1123
1126
|
p
|
|
1124
1127
|
),
|
|
1125
1128
|
...l
|
|
1126
1129
|
}
|
|
1127
1130
|
),
|
|
1128
|
-
|
|
1131
|
+
i && /* @__PURE__ */ e("div", { className: "absolute top-3 right-3", children: /* @__PURE__ */ d(
|
|
1129
1132
|
"svg",
|
|
1130
1133
|
{
|
|
1131
1134
|
className: "animate-spin h-4 w-4 text-muted",
|
|
@@ -1160,7 +1163,7 @@ const ct = {
|
|
|
1160
1163
|
{
|
|
1161
1164
|
className: x(
|
|
1162
1165
|
"mt-1 text-xs",
|
|
1163
|
-
|
|
1166
|
+
k ? "text-error" : "text-muted"
|
|
1164
1167
|
),
|
|
1165
1168
|
children: r || a
|
|
1166
1169
|
}
|
|
@@ -1186,37 +1189,37 @@ const it = {
|
|
|
1186
1189
|
error: r,
|
|
1187
1190
|
size: n = "md",
|
|
1188
1191
|
fullWidth: s = !1,
|
|
1189
|
-
startIcon:
|
|
1190
|
-
endIcon:
|
|
1191
|
-
loading:
|
|
1192
|
+
startIcon: i,
|
|
1193
|
+
endIcon: m,
|
|
1194
|
+
loading: g = !1,
|
|
1192
1195
|
containerClassName: p,
|
|
1193
|
-
labelClassName:
|
|
1194
|
-
className:
|
|
1196
|
+
labelClassName: b,
|
|
1197
|
+
className: f,
|
|
1195
1198
|
id: l,
|
|
1196
1199
|
...u
|
|
1197
1200
|
}, h) => {
|
|
1198
|
-
const
|
|
1201
|
+
const k = l || `textfield-${Math.random().toString(36).substr(2, 9)}`, C = !!r;
|
|
1199
1202
|
return /* @__PURE__ */ d("div", { className: x("flex flex-col", s && "w-full", p), children: [
|
|
1200
1203
|
t && /* @__PURE__ */ e(
|
|
1201
1204
|
"label",
|
|
1202
1205
|
{
|
|
1203
|
-
htmlFor:
|
|
1206
|
+
htmlFor: k,
|
|
1204
1207
|
className: x(
|
|
1205
1208
|
"block text-sm font-medium mb-1",
|
|
1206
|
-
|
|
1207
|
-
|
|
1209
|
+
C ? "text-error" : "text-default",
|
|
1210
|
+
b
|
|
1208
1211
|
),
|
|
1209
1212
|
children: t
|
|
1210
1213
|
}
|
|
1211
1214
|
),
|
|
1212
1215
|
/* @__PURE__ */ d("div", { className: "relative", children: [
|
|
1213
|
-
|
|
1214
|
-
/* @__PURE__ */ e("div", { className: "absolute left-0 pl-3 flex items-center pointer-events-none h-full", children: /* @__PURE__ */ e("span", { className: x("text-muted", be[n]), children:
|
|
1216
|
+
i && // Todo fix inset not showing correctly on different sizes
|
|
1217
|
+
/* @__PURE__ */ e("div", { className: "absolute left-0 pl-3 flex items-center pointer-events-none h-full", children: /* @__PURE__ */ e("span", { className: x("text-muted", be[n]), children: i }) }),
|
|
1215
1218
|
/* @__PURE__ */ e(
|
|
1216
1219
|
"input",
|
|
1217
1220
|
{
|
|
1218
1221
|
ref: h,
|
|
1219
|
-
id:
|
|
1222
|
+
id: k,
|
|
1220
1223
|
className: x(
|
|
1221
1224
|
// Base styles
|
|
1222
1225
|
"block w-full rounded-lg border transition-colors duration-200 bg-input",
|
|
@@ -1225,16 +1228,16 @@ const it = {
|
|
|
1225
1228
|
// Size styles
|
|
1226
1229
|
it[n],
|
|
1227
1230
|
// Icon padding
|
|
1228
|
-
|
|
1229
|
-
|
|
1231
|
+
i && "pl-10",
|
|
1232
|
+
m && "pr-10",
|
|
1230
1233
|
// State styles
|
|
1231
|
-
|
|
1232
|
-
|
|
1234
|
+
C ? "border-error text-error focus:border-error focus:ring-error" : "border-neutral text-default focus:border-primary focus:ring-primary",
|
|
1235
|
+
f
|
|
1233
1236
|
),
|
|
1234
1237
|
...u
|
|
1235
1238
|
}
|
|
1236
1239
|
),
|
|
1237
|
-
(
|
|
1240
|
+
(m || g) && /* @__PURE__ */ e("div", { className: "absolute inset-y-0 right-0 pr-3 flex items-center", children: g ? /* @__PURE__ */ d(
|
|
1238
1241
|
"svg",
|
|
1239
1242
|
{
|
|
1240
1243
|
className: x("animate-spin text-muted", be[n]),
|
|
@@ -1262,14 +1265,14 @@ const it = {
|
|
|
1262
1265
|
)
|
|
1263
1266
|
]
|
|
1264
1267
|
}
|
|
1265
|
-
) :
|
|
1268
|
+
) : m && /* @__PURE__ */ e("span", { className: x("text-muted", be[n]), children: m }) })
|
|
1266
1269
|
] }),
|
|
1267
1270
|
(r || a) && /* @__PURE__ */ e(
|
|
1268
1271
|
"p",
|
|
1269
1272
|
{
|
|
1270
1273
|
className: x(
|
|
1271
1274
|
"mt-1 text-xs",
|
|
1272
|
-
|
|
1275
|
+
C ? "text-error" : "text-muted"
|
|
1273
1276
|
),
|
|
1274
1277
|
children: r || a
|
|
1275
1278
|
}
|
|
@@ -1284,11 +1287,11 @@ const oe = ({
|
|
|
1284
1287
|
color: r = "current",
|
|
1285
1288
|
clickable: n = !1,
|
|
1286
1289
|
onClick: s,
|
|
1287
|
-
className:
|
|
1288
|
-
"aria-label":
|
|
1289
|
-
...
|
|
1290
|
+
className: i,
|
|
1291
|
+
"aria-label": m,
|
|
1292
|
+
...g
|
|
1290
1293
|
}) => {
|
|
1291
|
-
const p = typeof a == "number" ? a : dt(a),
|
|
1294
|
+
const p = typeof a == "number" ? a : dt(a), b = x(
|
|
1292
1295
|
"inline-block",
|
|
1293
1296
|
// Color variants
|
|
1294
1297
|
{
|
|
@@ -1307,20 +1310,20 @@ const oe = ({
|
|
|
1307
1310
|
"cursor-pointer hover:opacity-80 transition-opacity duration-200": n,
|
|
1308
1311
|
"focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary/20 rounded": n
|
|
1309
1312
|
},
|
|
1310
|
-
|
|
1311
|
-
),
|
|
1313
|
+
i
|
|
1314
|
+
), f = {
|
|
1312
1315
|
size: p,
|
|
1313
|
-
className:
|
|
1316
|
+
className: b,
|
|
1314
1317
|
onClick: n ? s : void 0,
|
|
1315
|
-
"aria-label":
|
|
1318
|
+
"aria-label": m,
|
|
1316
1319
|
role: n ? "button" : void 0,
|
|
1317
1320
|
tabIndex: n ? 0 : void 0,
|
|
1318
1321
|
onKeyDown: n ? (l) => {
|
|
1319
1322
|
(l.key === "Enter" || l.key === " ") && (l.preventDefault(), s?.());
|
|
1320
1323
|
} : void 0,
|
|
1321
|
-
...
|
|
1324
|
+
...g
|
|
1322
1325
|
};
|
|
1323
|
-
return /* @__PURE__ */ e(t, { ...
|
|
1326
|
+
return /* @__PURE__ */ e(t, { ...f });
|
|
1324
1327
|
};
|
|
1325
1328
|
function dt(t) {
|
|
1326
1329
|
return {
|
|
@@ -1346,26 +1349,26 @@ function ut({
|
|
|
1346
1349
|
] })
|
|
1347
1350
|
] }),
|
|
1348
1351
|
a && /* @__PURE__ */ d("div", { className: "rounded-lg overflow-hidden", children: [
|
|
1349
|
-
/* @__PURE__ */ e("div", { className: `grid grid-cols-${r} gap-2 bg-neutral-container p-3`, children: Array.from({ length: r }).map((s,
|
|
1352
|
+
/* @__PURE__ */ e("div", { className: `grid grid-cols-${r} gap-2 bg-neutral-container p-3`, children: Array.from({ length: r }).map((s, i) => /* @__PURE__ */ e(
|
|
1350
1353
|
"div",
|
|
1351
1354
|
{
|
|
1352
1355
|
className: "h-4 bg-neutral-border-emphasis rounded w-2/3"
|
|
1353
1356
|
},
|
|
1354
|
-
`header-${
|
|
1357
|
+
`header-${i}`
|
|
1355
1358
|
)) }),
|
|
1356
|
-
Array.from({ length: n }).map((s,
|
|
1359
|
+
Array.from({ length: n }).map((s, i) => /* @__PURE__ */ e(
|
|
1357
1360
|
"div",
|
|
1358
1361
|
{
|
|
1359
1362
|
className: `grid grid-cols-${r} gap-2 p-3 border-t border-neutral`,
|
|
1360
|
-
children: Array.from({ length: r }).map((
|
|
1363
|
+
children: Array.from({ length: r }).map((m, g) => /* @__PURE__ */ e(
|
|
1361
1364
|
"div",
|
|
1362
1365
|
{
|
|
1363
1366
|
className: "h-4 bg-neutral-container-emphasis rounded w-full"
|
|
1364
1367
|
},
|
|
1365
|
-
`cell-${
|
|
1368
|
+
`cell-${i}-${g}`
|
|
1366
1369
|
))
|
|
1367
1370
|
},
|
|
1368
|
-
`row-${
|
|
1371
|
+
`row-${i}`
|
|
1369
1372
|
))
|
|
1370
1373
|
] })
|
|
1371
1374
|
] }) });
|
|
@@ -1376,95 +1379,95 @@ const mt = ({
|
|
|
1376
1379
|
value: r,
|
|
1377
1380
|
onSelect: n,
|
|
1378
1381
|
placement: s = "bottom-start",
|
|
1379
|
-
disabled:
|
|
1380
|
-
className:
|
|
1381
|
-
showCheck:
|
|
1382
|
+
disabled: i = !1,
|
|
1383
|
+
className: m,
|
|
1384
|
+
showCheck: g = !0,
|
|
1382
1385
|
header: p
|
|
1383
1386
|
}) => {
|
|
1384
|
-
const [
|
|
1387
|
+
const [b, f] = O(!1), [l, u] = O(null), [h, k] = O({ top: 0, left: 0 }), [C, v] = O({}), j = Z(null), N = Z(null), q = Z(null), P = Z(null);
|
|
1385
1388
|
K(() => {
|
|
1386
|
-
const
|
|
1387
|
-
|
|
1389
|
+
const c = (y) => {
|
|
1390
|
+
j.current && (!j.current.contains(y.target) || q.current && !q.current.contains(y.target)) && (f(!1), u(null), P.current && (clearTimeout(P.current), P.current = null));
|
|
1388
1391
|
};
|
|
1389
|
-
return
|
|
1390
|
-
document.removeEventListener("mousedown",
|
|
1392
|
+
return b && document.addEventListener("mousedown", c), () => {
|
|
1393
|
+
document.removeEventListener("mousedown", c);
|
|
1391
1394
|
};
|
|
1392
|
-
}, [
|
|
1393
|
-
const
|
|
1394
|
-
y.key === "Escape" && (
|
|
1395
|
+
}, [b]), K(() => {
|
|
1396
|
+
const c = (y) => {
|
|
1397
|
+
y.key === "Escape" && (f(!1), u(null), P.current && (clearTimeout(P.current), P.current = null));
|
|
1395
1398
|
};
|
|
1396
|
-
return
|
|
1397
|
-
document.removeEventListener("keydown",
|
|
1399
|
+
return b && document.addEventListener("keydown", c), () => {
|
|
1400
|
+
document.removeEventListener("keydown", c);
|
|
1398
1401
|
};
|
|
1399
|
-
}, [
|
|
1400
|
-
if (l &&
|
|
1401
|
-
const
|
|
1402
|
+
}, [b]), K(() => {
|
|
1403
|
+
if (l && j.current) {
|
|
1404
|
+
const c = j.current.querySelector(
|
|
1402
1405
|
`[data-option-value="${l}"]`
|
|
1403
1406
|
);
|
|
1404
|
-
if (
|
|
1405
|
-
const y =
|
|
1406
|
-
|
|
1407
|
+
if (c) {
|
|
1408
|
+
const y = c.getBoundingClientRect();
|
|
1409
|
+
k({
|
|
1407
1410
|
top: y.top,
|
|
1408
1411
|
left: y.right + 8
|
|
1409
1412
|
});
|
|
1410
1413
|
}
|
|
1411
1414
|
}
|
|
1412
1415
|
}, [l]), K(() => () => {
|
|
1413
|
-
|
|
1416
|
+
P.current && clearTimeout(P.current);
|
|
1414
1417
|
}, []);
|
|
1415
|
-
const U = (
|
|
1416
|
-
if (
|
|
1417
|
-
if (!
|
|
1418
|
-
const y =
|
|
1418
|
+
const U = (c) => {
|
|
1419
|
+
if (c.stopPropagation(), !i) {
|
|
1420
|
+
if (!b) {
|
|
1421
|
+
const y = N.current?.getBoundingClientRect();
|
|
1419
1422
|
if (y) {
|
|
1420
|
-
const
|
|
1421
|
-
s.startsWith("bottom") ?
|
|
1423
|
+
const S = {};
|
|
1424
|
+
s.startsWith("bottom") ? S.top = y.bottom + 6 : S.bottom = window.innerHeight - y.top + 6, s.endsWith("start") ? S.left = y.left : S.right = window.innerWidth - y.right, v(S);
|
|
1422
1425
|
}
|
|
1423
1426
|
}
|
|
1424
|
-
|
|
1427
|
+
f(!b), u(null), P.current && (clearTimeout(P.current), P.current = null);
|
|
1425
1428
|
}
|
|
1426
|
-
}, F = (
|
|
1427
|
-
|
|
1428
|
-
},
|
|
1429
|
-
|
|
1430
|
-
},
|
|
1431
|
-
|
|
1429
|
+
}, F = (c, y, L) => {
|
|
1430
|
+
c.stopPropagation(), !y.disabled && !y.divider && (!y.children || y.children.length === 0) && (n?.(y.value, L), f(!1), u(null));
|
|
1431
|
+
}, A = (c) => {
|
|
1432
|
+
P.current && (clearTimeout(P.current), P.current = null), c.children && c.children.length > 0 ? u(c.value) : u(null);
|
|
1433
|
+
}, H = (c) => {
|
|
1434
|
+
c.children && c.children.length > 0 ? P.current = setTimeout(() => {
|
|
1432
1435
|
u(null);
|
|
1433
1436
|
}, 150) : u(null);
|
|
1434
|
-
},
|
|
1435
|
-
|
|
1436
|
-
},
|
|
1437
|
+
}, T = (c, y, L) => {
|
|
1438
|
+
c.stopPropagation(), !y.disabled && !y.divider && (n?.(y.value, L), f(!1), u(null));
|
|
1439
|
+
}, V = x(
|
|
1437
1440
|
"fixed z-[60] min-w-[200px] bg-module rounded-md shadow-lg border border-neutral",
|
|
1438
1441
|
"max-h-60 overflow-auto"
|
|
1439
|
-
),
|
|
1442
|
+
), W = x(
|
|
1440
1443
|
"fixed z-[60] min-w-[200px] bg-module rounded-md shadow-lg border border-neutral",
|
|
1441
1444
|
"max-h-60 overflow-auto"
|
|
1442
1445
|
);
|
|
1443
1446
|
return /* @__PURE__ */ d(
|
|
1444
1447
|
"div",
|
|
1445
1448
|
{
|
|
1446
|
-
ref:
|
|
1449
|
+
ref: j,
|
|
1447
1450
|
className: x(
|
|
1448
1451
|
"relative flex flex-row items-center justify-center rounded-lg hover:bg-neutral-container",
|
|
1449
|
-
|
|
1452
|
+
m
|
|
1450
1453
|
),
|
|
1451
1454
|
children: [
|
|
1452
1455
|
/* @__PURE__ */ e(
|
|
1453
1456
|
"button",
|
|
1454
1457
|
{
|
|
1455
|
-
ref:
|
|
1458
|
+
ref: N,
|
|
1456
1459
|
onClick: U,
|
|
1457
|
-
disabled:
|
|
1460
|
+
disabled: i,
|
|
1458
1461
|
className: x("inline-flex items-center justify-center", {
|
|
1459
|
-
"opacity-50 cursor-not-allowed":
|
|
1462
|
+
"opacity-50 cursor-not-allowed": i
|
|
1460
1463
|
}),
|
|
1461
1464
|
children: t
|
|
1462
1465
|
}
|
|
1463
1466
|
),
|
|
1464
|
-
|
|
1467
|
+
b && /* @__PURE__ */ e("div", { className: V, style: C, children: /* @__PURE__ */ d("div", { className: "p-2", children: [
|
|
1465
1468
|
p && (typeof p == "string" ? /* @__PURE__ */ e("div", { className: "text-xs font-medium text-muted uppercase tracking-wider px-3 py-2", children: p }) : p),
|
|
1466
|
-
a.map((
|
|
1467
|
-
if (
|
|
1469
|
+
a.map((c, y) => {
|
|
1470
|
+
if (c.divider)
|
|
1468
1471
|
return /* @__PURE__ */ e(
|
|
1469
1472
|
"div",
|
|
1470
1473
|
{
|
|
@@ -1472,108 +1475,108 @@ const mt = ({
|
|
|
1472
1475
|
},
|
|
1473
1476
|
`divider-${y}`
|
|
1474
1477
|
);
|
|
1475
|
-
const
|
|
1478
|
+
const L = c.children && c.children.length > 0, S = l === c.value;
|
|
1476
1479
|
return /* @__PURE__ */ d("div", { className: "relative group", children: [
|
|
1477
1480
|
/* @__PURE__ */ d(
|
|
1478
1481
|
"button",
|
|
1479
1482
|
{
|
|
1480
|
-
"data-option-value":
|
|
1481
|
-
onClick: (
|
|
1482
|
-
onMouseEnter: () =>
|
|
1483
|
-
onMouseLeave: () =>
|
|
1484
|
-
disabled:
|
|
1483
|
+
"data-option-value": c.value,
|
|
1484
|
+
onClick: (M) => F(M, c),
|
|
1485
|
+
onMouseEnter: () => A(c),
|
|
1486
|
+
onMouseLeave: () => H(c),
|
|
1487
|
+
disabled: c.disabled,
|
|
1485
1488
|
className: x(
|
|
1486
1489
|
"w-full flex items-center justify-between px-3 py-2 text-sm text-default hover:bg-neutral-container rounded-md transition-colors",
|
|
1487
1490
|
{
|
|
1488
|
-
"opacity-50 cursor-not-allowed":
|
|
1489
|
-
"bg-neutral-container":
|
|
1491
|
+
"opacity-50 cursor-not-allowed": c.disabled,
|
|
1492
|
+
"bg-neutral-container": S && L
|
|
1490
1493
|
}
|
|
1491
1494
|
),
|
|
1492
1495
|
children: [
|
|
1493
1496
|
/* @__PURE__ */ d("div", { className: "flex items-center space-x-2 min-w-0", children: [
|
|
1494
|
-
|
|
1497
|
+
c.icon && /* @__PURE__ */ e("span", { className: "flex-shrink-0", children: c.icon }),
|
|
1495
1498
|
/* @__PURE__ */ d("div", { className: "flex flex-col items-start min-w-0", children: [
|
|
1496
|
-
/* @__PURE__ */ e("span", { className: "font-base truncate", children:
|
|
1497
|
-
|
|
1499
|
+
/* @__PURE__ */ e("span", { className: "font-base truncate", children: c.label }),
|
|
1500
|
+
c.description && /* @__PURE__ */ e("span", { className: "text-xs text-muted", children: c.description })
|
|
1498
1501
|
] })
|
|
1499
1502
|
] }),
|
|
1500
1503
|
/* @__PURE__ */ d("div", { className: "flex items-center space-x-2", children: [
|
|
1501
|
-
|
|
1502
|
-
|
|
1504
|
+
g && r === c.value && /* @__PURE__ */ e("span", { className: "h-4 w-4 text-success flex-shrink-0 text-sm font-bold", children: "✓" }),
|
|
1505
|
+
L && /* @__PURE__ */ e("span", { className: "text-muted text-xs", children: "▶" })
|
|
1503
1506
|
] })
|
|
1504
1507
|
]
|
|
1505
1508
|
}
|
|
1506
1509
|
),
|
|
1507
|
-
|
|
1510
|
+
L && S && /* @__PURE__ */ e(
|
|
1508
1511
|
"div",
|
|
1509
1512
|
{
|
|
1510
1513
|
ref: q,
|
|
1511
|
-
className:
|
|
1514
|
+
className: W,
|
|
1512
1515
|
style: {
|
|
1513
1516
|
top: `${h.top}px`,
|
|
1514
1517
|
left: `${h.left}px`
|
|
1515
1518
|
},
|
|
1516
1519
|
onMouseEnter: () => {
|
|
1517
|
-
|
|
1520
|
+
P.current && (clearTimeout(P.current), P.current = null), u(c.value);
|
|
1518
1521
|
},
|
|
1519
1522
|
onMouseLeave: () => {
|
|
1520
|
-
|
|
1523
|
+
P.current = setTimeout(() => {
|
|
1521
1524
|
u(null);
|
|
1522
1525
|
}, 150);
|
|
1523
1526
|
},
|
|
1524
|
-
children: /* @__PURE__ */ e("div", { className: "p-2", children:
|
|
1525
|
-
if (
|
|
1527
|
+
children: /* @__PURE__ */ e("div", { className: "p-2", children: c.children.map((M, E) => {
|
|
1528
|
+
if (M.divider)
|
|
1526
1529
|
return /* @__PURE__ */ e(
|
|
1527
1530
|
"div",
|
|
1528
1531
|
{
|
|
1529
1532
|
className: "border-t border-neutral my-2"
|
|
1530
1533
|
},
|
|
1531
|
-
`divider-${
|
|
1534
|
+
`divider-${E}`
|
|
1532
1535
|
);
|
|
1533
|
-
const Q = typeof r == "object" && r[
|
|
1534
|
-
|
|
1535
|
-
) || r ===
|
|
1536
|
+
const Q = typeof r == "object" && r[c.value] && r[c.value].includes(
|
|
1537
|
+
M.value
|
|
1538
|
+
) || r === M.value;
|
|
1536
1539
|
return /* @__PURE__ */ d(
|
|
1537
1540
|
"button",
|
|
1538
1541
|
{
|
|
1539
|
-
onClick: (re) =>
|
|
1542
|
+
onClick: (re) => T(
|
|
1540
1543
|
re,
|
|
1541
|
-
|
|
1542
|
-
|
|
1544
|
+
M,
|
|
1545
|
+
c.value
|
|
1543
1546
|
),
|
|
1544
|
-
disabled:
|
|
1547
|
+
disabled: M.disabled,
|
|
1545
1548
|
className: x(
|
|
1546
1549
|
"w-full flex items-center justify-between px-3 py-2 text-sm text-default hover:bg-neutral-container rounded-md transition-colors",
|
|
1547
1550
|
{
|
|
1548
|
-
"opacity-50 cursor-not-allowed":
|
|
1551
|
+
"opacity-50 cursor-not-allowed": M.disabled
|
|
1549
1552
|
}
|
|
1550
1553
|
),
|
|
1551
1554
|
children: [
|
|
1552
1555
|
/* @__PURE__ */ d("div", { className: "flex items-center space-x-2 min-w-0", children: [
|
|
1553
|
-
|
|
1556
|
+
M.icon && /* @__PURE__ */ e("span", { className: "flex-shrink-0", children: M.icon }),
|
|
1554
1557
|
/* @__PURE__ */ d("div", { className: "flex flex-col items-start min-w-0", children: [
|
|
1555
|
-
/* @__PURE__ */ e("span", { className: "font-base truncate", children:
|
|
1556
|
-
|
|
1558
|
+
/* @__PURE__ */ e("span", { className: "font-base truncate", children: M.label }),
|
|
1559
|
+
M.description && /* @__PURE__ */ e("span", { className: "text-xs text-muted", children: M.description })
|
|
1557
1560
|
] })
|
|
1558
1561
|
] }),
|
|
1559
|
-
|
|
1562
|
+
g && Q && /* @__PURE__ */ e("span", { className: "h-4 w-4 text-success flex-shrink-0 text-sm font-bold", children: "✓" })
|
|
1560
1563
|
]
|
|
1561
1564
|
},
|
|
1562
|
-
|
|
1565
|
+
M.value
|
|
1563
1566
|
);
|
|
1564
1567
|
}) })
|
|
1565
1568
|
}
|
|
1566
1569
|
)
|
|
1567
|
-
] },
|
|
1570
|
+
] }, c.value);
|
|
1568
1571
|
}),
|
|
1569
1572
|
(() => {
|
|
1570
|
-
const
|
|
1571
|
-
if (
|
|
1572
|
-
const
|
|
1573
|
-
return y + 1 +
|
|
1573
|
+
const c = a.reduce((y, L) => {
|
|
1574
|
+
if (L.divider) return y;
|
|
1575
|
+
const S = L.children ? L.children.filter((M) => !M.divider).length : 0;
|
|
1576
|
+
return y + 1 + S;
|
|
1574
1577
|
}, 0);
|
|
1575
|
-
return
|
|
1576
|
-
|
|
1578
|
+
return c > 1 && /* @__PURE__ */ e("div", { className: "border-t border-neutral mt-2 pt-2", children: /* @__PURE__ */ d("div", { className: "text-xs text-muted px-3 py-1", children: [
|
|
1579
|
+
c,
|
|
1577
1580
|
" options available"
|
|
1578
1581
|
] }) });
|
|
1579
1582
|
})()
|
|
@@ -1706,7 +1709,7 @@ const mt = ({
|
|
|
1706
1709
|
}
|
|
1707
1710
|
)
|
|
1708
1711
|
}
|
|
1709
|
-
),
|
|
1712
|
+
), Te = () => /* @__PURE__ */ e(
|
|
1710
1713
|
"svg",
|
|
1711
1714
|
{
|
|
1712
1715
|
className: "h-4 w-4",
|
|
@@ -1742,7 +1745,7 @@ const mt = ({
|
|
|
1742
1745
|
/* @__PURE__ */ e("span", { className: "text-default", children: t.multiSelect && Array.isArray(t.value) ? t.value?.map(
|
|
1743
1746
|
(n) => t.options?.find((s) => s.value === n)?.label
|
|
1744
1747
|
).join(", ") : t.options?.find((n) => n.value === t.value)?.label }),
|
|
1745
|
-
/* @__PURE__ */ e("span", { className: "text-muted text-sm group-open:rotate-180 transition-transform", children: /* @__PURE__ */ e(
|
|
1748
|
+
/* @__PURE__ */ e("span", { className: "text-muted text-sm group-open:rotate-180 transition-transform", children: /* @__PURE__ */ e(Te, {}) })
|
|
1746
1749
|
] }),
|
|
1747
1750
|
/* @__PURE__ */ d("div", { className: "absolute z-10 left-0 mt-1 bg-module border border-neutral rounded-lg shadow-lvl-0 p-2 w-48", children: [
|
|
1748
1751
|
t.options?.map((n) => /* @__PURE__ */ e(
|
|
@@ -1776,98 +1779,98 @@ const mt = ({
|
|
|
1776
1779
|
loading: r = !1,
|
|
1777
1780
|
searchable: n = !1,
|
|
1778
1781
|
searchPlaceholder: s = "Search...",
|
|
1779
|
-
filters:
|
|
1780
|
-
paginated:
|
|
1781
|
-
pageSizeOptions:
|
|
1782
|
+
filters: i = [],
|
|
1783
|
+
paginated: m = !1,
|
|
1784
|
+
pageSizeOptions: g = [10, 25, 50, 100],
|
|
1782
1785
|
defaultPageSize: p = 10,
|
|
1783
|
-
actions:
|
|
1784
|
-
onRowClick:
|
|
1786
|
+
actions: b = [],
|
|
1787
|
+
onRowClick: f,
|
|
1785
1788
|
selectable: l = !1,
|
|
1786
1789
|
selectedRows: u = [],
|
|
1787
1790
|
onSelectionChange: h,
|
|
1788
|
-
getRowKey:
|
|
1789
|
-
emptyContent:
|
|
1790
|
-
hoverable:
|
|
1791
|
-
bordered:
|
|
1792
|
-
striped:
|
|
1791
|
+
getRowKey: k = (U, F) => F,
|
|
1792
|
+
emptyContent: C,
|
|
1793
|
+
hoverable: v = !0,
|
|
1794
|
+
bordered: j = !1,
|
|
1795
|
+
striped: N = !1,
|
|
1793
1796
|
className: q,
|
|
1794
|
-
rowClassName:
|
|
1797
|
+
rowClassName: P
|
|
1795
1798
|
}) => {
|
|
1796
|
-
const [U, F] =
|
|
1799
|
+
const [U, F] = O(""), [A, H] = O({
|
|
1797
1800
|
column: null,
|
|
1798
1801
|
direction: null
|
|
1799
|
-
}), [
|
|
1802
|
+
}), [T, V] = O({
|
|
1800
1803
|
page: 0,
|
|
1801
1804
|
pageSize: p
|
|
1802
|
-
}),
|
|
1805
|
+
}), W = Z(null), c = de(() => {
|
|
1803
1806
|
let o = t;
|
|
1804
1807
|
if (n && U.trim()) {
|
|
1805
|
-
const
|
|
1808
|
+
const w = a.filter(
|
|
1806
1809
|
(R) => R.searchable !== !1
|
|
1807
1810
|
), _ = U.toLowerCase();
|
|
1808
|
-
o = o.filter((R) =>
|
|
1809
|
-
const
|
|
1810
|
-
return String(
|
|
1811
|
+
o = o.filter((R) => w.some((B) => {
|
|
1812
|
+
const J = typeof B.accessor == "function" ? B.accessor(R) : R[B.accessor];
|
|
1813
|
+
return String(J || "").toLowerCase().includes(_);
|
|
1811
1814
|
}));
|
|
1812
1815
|
}
|
|
1813
|
-
return
|
|
1814
|
-
|
|
1815
|
-
const R = a.find((
|
|
1816
|
+
return i.forEach((w) => {
|
|
1817
|
+
w.value && w.value !== "all" && (o = o.filter((_) => {
|
|
1818
|
+
const R = a.find((J) => J.id === w.id);
|
|
1816
1819
|
if (!R) return !0;
|
|
1817
|
-
const
|
|
1818
|
-
return String(
|
|
1820
|
+
const B = typeof R.accessor == "function" ? R.accessor(_) : _[R.accessor];
|
|
1821
|
+
return String(B || "") === w.value;
|
|
1819
1822
|
}));
|
|
1820
1823
|
}), o;
|
|
1821
|
-
}, [t, U, a, n,
|
|
1822
|
-
if (!
|
|
1823
|
-
const o = a.find((
|
|
1824
|
-
return o ? [...
|
|
1825
|
-
const R = typeof o.accessor == "function" ? o.accessor(
|
|
1826
|
-
let
|
|
1827
|
-
return R <
|
|
1828
|
-
}) :
|
|
1829
|
-
}, [
|
|
1830
|
-
if (!
|
|
1831
|
-
const o =
|
|
1832
|
-
return y.slice(o,
|
|
1833
|
-
}, [y,
|
|
1824
|
+
}, [t, U, a, n, i]), y = de(() => {
|
|
1825
|
+
if (!A.column || !A.direction) return c;
|
|
1826
|
+
const o = a.find((w) => w.id === A.column);
|
|
1827
|
+
return o ? [...c].sort((w, _) => {
|
|
1828
|
+
const R = typeof o.accessor == "function" ? o.accessor(w) : w[o.accessor], B = typeof o.accessor == "function" ? o.accessor(_) : _[o.accessor];
|
|
1829
|
+
let J = 0;
|
|
1830
|
+
return R < B ? J = -1 : R > B && (J = 1), A.direction === "desc" ? -J : J;
|
|
1831
|
+
}) : c;
|
|
1832
|
+
}, [c, A, a]), L = de(() => {
|
|
1833
|
+
if (!m) return y;
|
|
1834
|
+
const o = T.page * T.pageSize, w = o + T.pageSize;
|
|
1835
|
+
return y.slice(o, w);
|
|
1836
|
+
}, [y, T, m]), S = ae(
|
|
1834
1837
|
(o) => {
|
|
1835
|
-
a.find((_) => _.id === o)?.sortable &&
|
|
1838
|
+
a.find((_) => _.id === o)?.sortable && H((_) => _.column !== o ? { column: o, direction: "asc" } : _.direction === "asc" ? { column: o, direction: "desc" } : { column: null, direction: null });
|
|
1836
1839
|
},
|
|
1837
1840
|
[a]
|
|
1838
|
-
),
|
|
1839
|
-
|
|
1840
|
-
}, []),
|
|
1841
|
-
|
|
1841
|
+
), M = ae((o) => {
|
|
1842
|
+
V((w) => ({ ...w, page: o }));
|
|
1843
|
+
}, []), E = ae((o) => {
|
|
1844
|
+
V({ page: 0, pageSize: o });
|
|
1842
1845
|
}, []), Q = ae(
|
|
1843
|
-
(o,
|
|
1846
|
+
(o, w) => {
|
|
1844
1847
|
if (!h) return;
|
|
1845
|
-
const _ =
|
|
1846
|
-
u.map((R,
|
|
1847
|
-
(R,
|
|
1848
|
+
const _ = k(o, 0);
|
|
1849
|
+
u.map((R, B) => k(R, B)), h(w ? [...u, o] : u.filter(
|
|
1850
|
+
(R, B) => k(u[B], B) !== _
|
|
1848
1851
|
));
|
|
1849
1852
|
},
|
|
1850
|
-
[u, h,
|
|
1853
|
+
[u, h, k]
|
|
1851
1854
|
), re = ae(
|
|
1852
1855
|
(o) => {
|
|
1853
|
-
h && h(o ? [
|
|
1856
|
+
h && h(o ? [...L] : []);
|
|
1854
1857
|
},
|
|
1855
|
-
[
|
|
1858
|
+
[L, h]
|
|
1856
1859
|
);
|
|
1857
1860
|
K(() => {
|
|
1858
|
-
|
|
1859
|
-
}, [U,
|
|
1860
|
-
|
|
1861
|
-
}, [
|
|
1862
|
-
const
|
|
1863
|
-
const
|
|
1861
|
+
V((o) => ({ ...o, page: 0 }));
|
|
1862
|
+
}, [U, A]), K(() => {
|
|
1863
|
+
V((o) => ({ ...o, page: 0 }));
|
|
1864
|
+
}, [i.map((o) => o.value).join(",")]);
|
|
1865
|
+
const X = y.length, $ = Math.ceil(X / T.pageSize), I = T.page * T.pageSize + 1, z = Math.min(I + T.pageSize - 1, X), D = L.length > 0 && L.every((o) => {
|
|
1866
|
+
const w = k(o, 0);
|
|
1864
1867
|
return u.some(
|
|
1865
|
-
(_, R) =>
|
|
1868
|
+
(_, R) => k(_, R) === w
|
|
1866
1869
|
);
|
|
1867
|
-
}), ee =
|
|
1868
|
-
const
|
|
1870
|
+
}), ee = L.some((o) => {
|
|
1871
|
+
const w = k(o, 0);
|
|
1869
1872
|
return u.some(
|
|
1870
|
-
(_, R) =>
|
|
1873
|
+
(_, R) => k(_, R) === w
|
|
1871
1874
|
);
|
|
1872
1875
|
}), ne = x(
|
|
1873
1876
|
"w-full text-sm leading-5 text-[var(--text-default)] border-collapse",
|
|
@@ -1875,12 +1878,12 @@ const mt = ({
|
|
|
1875
1878
|
), G = x("bg-[var(--base-module)]"), le = x(
|
|
1876
1879
|
"text-[var(--text-default)] p-3 border-b border-[var(--neutral-border)]"
|
|
1877
1880
|
), fe = x("h-12", {
|
|
1878
|
-
"hover:bg-[var(--neutral-container)] dark:hover:bg-[var(--neutral-container-emphasis)]":
|
|
1879
|
-
"cursor-pointer":
|
|
1881
|
+
"hover:bg-[var(--neutral-container)] dark:hover:bg-[var(--neutral-container-emphasis)]": v,
|
|
1882
|
+
"cursor-pointer": f
|
|
1880
1883
|
});
|
|
1881
1884
|
return /* @__PURE__ */ d("div", { className: "space-y-4", children: [
|
|
1882
|
-
(n ||
|
|
1883
|
-
|
|
1885
|
+
(n || i.length > 0) && /* @__PURE__ */ e("div", { className: "pt-4 pb-2", children: /* @__PURE__ */ d("div", { className: "flex flex-wrap gap-4 items-start", children: [
|
|
1886
|
+
i.map((o) => /* @__PURE__ */ e(vt, { ...o }, o.id)),
|
|
1884
1887
|
/* @__PURE__ */ e("div", { className: "w-full sm:w-auto sm:ml-auto min-w-[200px]", children: /* @__PURE__ */ e(
|
|
1885
1888
|
ue,
|
|
1886
1889
|
{
|
|
@@ -1901,15 +1904,15 @@ const mt = ({
|
|
|
1901
1904
|
tableColumns: a.length
|
|
1902
1905
|
}
|
|
1903
1906
|
) }),
|
|
1904
|
-
/* @__PURE__ */ d("table", { ref:
|
|
1907
|
+
/* @__PURE__ */ d("table", { ref: W, className: x(ne, "min-w-full"), children: [
|
|
1905
1908
|
/* @__PURE__ */ e("thead", { className: G, children: /* @__PURE__ */ d("tr", { children: [
|
|
1906
1909
|
l && /* @__PURE__ */ e("th", { className: x(le, "w-12"), children: /* @__PURE__ */ e(
|
|
1907
1910
|
"input",
|
|
1908
1911
|
{
|
|
1909
1912
|
type: "checkbox",
|
|
1910
|
-
checked:
|
|
1913
|
+
checked: D,
|
|
1911
1914
|
ref: (o) => {
|
|
1912
|
-
o && (o.indeterminate = ee && !
|
|
1915
|
+
o && (o.indeterminate = ee && !D);
|
|
1913
1916
|
},
|
|
1914
1917
|
onChange: (o) => re(o.target.checked),
|
|
1915
1918
|
className: "rounded border-neutral [&:not(:checked)]:bg-[var(--base-input)] text-[#1a1a1a]"
|
|
@@ -1932,7 +1935,7 @@ const mt = ({
|
|
|
1932
1935
|
}
|
|
1933
1936
|
),
|
|
1934
1937
|
style: { width: o.width },
|
|
1935
|
-
onClick: () => o.sortable &&
|
|
1938
|
+
onClick: () => o.sortable && S(o.id),
|
|
1936
1939
|
children: /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
1937
1940
|
o.headerCell ? o.headerCell() : o.header,
|
|
1938
1941
|
o.sortable && /* @__PURE__ */ d(
|
|
@@ -1940,19 +1943,19 @@ const mt = ({
|
|
|
1940
1943
|
{
|
|
1941
1944
|
className: x(
|
|
1942
1945
|
"flex flex-col opacity-0 group-hover:opacity-100 transition-opacity",
|
|
1943
|
-
|
|
1946
|
+
A.column === o.id && "opacity-100"
|
|
1944
1947
|
),
|
|
1945
1948
|
children: [
|
|
1946
1949
|
/* @__PURE__ */ e(
|
|
1947
1950
|
ht,
|
|
1948
1951
|
{
|
|
1949
|
-
active:
|
|
1952
|
+
active: A.column === o.id && A.direction === "asc"
|
|
1950
1953
|
}
|
|
1951
1954
|
),
|
|
1952
1955
|
/* @__PURE__ */ e(
|
|
1953
1956
|
pt,
|
|
1954
1957
|
{
|
|
1955
|
-
active:
|
|
1958
|
+
active: A.column === o.id && A.direction === "desc"
|
|
1956
1959
|
}
|
|
1957
1960
|
)
|
|
1958
1961
|
]
|
|
@@ -1962,21 +1965,21 @@ const mt = ({
|
|
|
1962
1965
|
},
|
|
1963
1966
|
o.id
|
|
1964
1967
|
)),
|
|
1965
|
-
|
|
1968
|
+
b.length > 0 && /* @__PURE__ */ e("th", { className: x(le, "w-20"), children: /* @__PURE__ */ e("span", { className: "sr-only", children: "Actions" }) })
|
|
1966
1969
|
] }) }),
|
|
1967
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
1970
|
+
/* @__PURE__ */ e("tbody", { children: L.length === 0 || r ? !r && /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e(
|
|
1968
1971
|
"td",
|
|
1969
1972
|
{
|
|
1970
|
-
colSpan: a.length + (l ? 1 : 0) + (
|
|
1973
|
+
colSpan: a.length + (l ? 1 : 0) + (b.length > 0 ? 1 : 0),
|
|
1971
1974
|
className: x(
|
|
1972
1975
|
le,
|
|
1973
1976
|
"text-center py-8 text-muted"
|
|
1974
1977
|
),
|
|
1975
|
-
children:
|
|
1978
|
+
children: C || "No data available"
|
|
1976
1979
|
}
|
|
1977
|
-
) }) :
|
|
1978
|
-
const _ =
|
|
1979
|
-
(
|
|
1980
|
+
) }) : L.map((o, w) => {
|
|
1981
|
+
const _ = k(o, w), R = u.some(
|
|
1982
|
+
(B, J) => k(B, J) === _
|
|
1980
1983
|
);
|
|
1981
1984
|
return /* @__PURE__ */ d(
|
|
1982
1985
|
"tr",
|
|
@@ -1984,10 +1987,10 @@ const mt = ({
|
|
|
1984
1987
|
className: x(
|
|
1985
1988
|
fe,
|
|
1986
1989
|
{ "bg-accent-container": R },
|
|
1987
|
-
|
|
1990
|
+
P?.(o, w)
|
|
1988
1991
|
),
|
|
1989
|
-
onClick: (
|
|
1990
|
-
|
|
1992
|
+
onClick: (B) => {
|
|
1993
|
+
B.stopPropagation(), f?.(o, w);
|
|
1991
1994
|
},
|
|
1992
1995
|
children: [
|
|
1993
1996
|
l && /* @__PURE__ */ e("td", { className: le, children: /* @__PURE__ */ e(
|
|
@@ -1995,47 +1998,47 @@ const mt = ({
|
|
|
1995
1998
|
{
|
|
1996
1999
|
type: "checkbox",
|
|
1997
2000
|
checked: R,
|
|
1998
|
-
onChange: (
|
|
1999
|
-
|
|
2001
|
+
onChange: (B) => {
|
|
2002
|
+
B.stopPropagation(), Q(o, B.target.checked);
|
|
2000
2003
|
},
|
|
2001
2004
|
className: "rounded border-neutral [&:not(:checked)]:bg-[var(--base-input)] text-[#1a1a1a]"
|
|
2002
2005
|
}
|
|
2003
2006
|
) }),
|
|
2004
|
-
a.map((
|
|
2005
|
-
const
|
|
2007
|
+
a.map((B) => {
|
|
2008
|
+
const J = typeof B.accessor == "function" ? B.accessor(o) : o[B.accessor];
|
|
2006
2009
|
return /* @__PURE__ */ e(
|
|
2007
2010
|
"td",
|
|
2008
2011
|
{
|
|
2009
2012
|
className: x(le, {
|
|
2010
|
-
"text-left":
|
|
2011
|
-
"text-center":
|
|
2012
|
-
"text-right":
|
|
2013
|
-
"sticky left-0 bg-module":
|
|
2014
|
-
"sticky right-0 bg-module":
|
|
2013
|
+
"text-left": B.align === "left" || !B.align,
|
|
2014
|
+
"text-center": B.align === "center",
|
|
2015
|
+
"text-right": B.align === "right",
|
|
2016
|
+
"sticky left-0 bg-module": B.sticky === "left",
|
|
2017
|
+
"sticky right-0 bg-module": B.sticky === "right"
|
|
2015
2018
|
}),
|
|
2016
|
-
children:
|
|
2019
|
+
children: B.cell ? B.cell(J, o, w) : String(J || "")
|
|
2017
2020
|
},
|
|
2018
|
-
|
|
2021
|
+
B.id
|
|
2019
2022
|
);
|
|
2020
2023
|
}),
|
|
2021
|
-
|
|
2024
|
+
b.length > 0 && /* @__PURE__ */ e("td", { className: le, children: /* @__PURE__ */ e(
|
|
2022
2025
|
mt,
|
|
2023
2026
|
{
|
|
2024
2027
|
trigger: /* @__PURE__ */ d("div", { className: "inline-flex items-center gap-1 px-2 py-1 text-sm text-muted hover:text-default", children: [
|
|
2025
2028
|
/* @__PURE__ */ e("span", { children: "Options" }),
|
|
2026
|
-
/* @__PURE__ */ e(
|
|
2029
|
+
/* @__PURE__ */ e(Te, {})
|
|
2027
2030
|
] }),
|
|
2028
|
-
options:
|
|
2029
|
-
value:
|
|
2030
|
-
label:
|
|
2031
|
-
icon:
|
|
2032
|
-
disabled:
|
|
2031
|
+
options: b.map((B) => ({
|
|
2032
|
+
value: B.id,
|
|
2033
|
+
label: B.label,
|
|
2034
|
+
icon: B.icon,
|
|
2035
|
+
disabled: B.disabled?.(o)
|
|
2033
2036
|
})),
|
|
2034
|
-
onSelect: (
|
|
2035
|
-
const
|
|
2036
|
-
(he) => he.id ===
|
|
2037
|
+
onSelect: (B) => {
|
|
2038
|
+
const J = b.find(
|
|
2039
|
+
(he) => he.id === B
|
|
2037
2040
|
);
|
|
2038
|
-
|
|
2041
|
+
J && J.onClick(o, w);
|
|
2039
2042
|
},
|
|
2040
2043
|
placement: "bottom-end"
|
|
2041
2044
|
}
|
|
@@ -2047,15 +2050,15 @@ const mt = ({
|
|
|
2047
2050
|
}) })
|
|
2048
2051
|
] })
|
|
2049
2052
|
] }),
|
|
2050
|
-
|
|
2053
|
+
m && X > 0 && /* @__PURE__ */ d("div", { className: "flex items-center justify-between px-6", children: [
|
|
2051
2054
|
/* @__PURE__ */ d("div", { className: "flex items-center gap-4", children: [
|
|
2052
2055
|
/* @__PURE__ */ d("span", { className: "text-sm text-muted", children: [
|
|
2053
2056
|
"Showing ",
|
|
2054
|
-
|
|
2057
|
+
I,
|
|
2055
2058
|
" to ",
|
|
2056
|
-
|
|
2059
|
+
z,
|
|
2057
2060
|
" of ",
|
|
2058
|
-
|
|
2061
|
+
X,
|
|
2059
2062
|
" results"
|
|
2060
2063
|
] }),
|
|
2061
2064
|
/* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
@@ -2063,10 +2066,10 @@ const mt = ({
|
|
|
2063
2066
|
/* @__PURE__ */ e(
|
|
2064
2067
|
"select",
|
|
2065
2068
|
{
|
|
2066
|
-
value:
|
|
2067
|
-
onChange: (o) =>
|
|
2069
|
+
value: T.pageSize,
|
|
2070
|
+
onChange: (o) => E(Number(o.target.value)),
|
|
2068
2071
|
className: "border border-[var(--neutral-border)] text-[var(--text-default)] rounded-md px-2 py-1 text-sm bg-[var(--base-input)] w-16",
|
|
2069
|
-
children:
|
|
2072
|
+
children: g.map((o) => /* @__PURE__ */ e("option", { value: o, children: o }, o))
|
|
2070
2073
|
}
|
|
2071
2074
|
)
|
|
2072
2075
|
] })
|
|
@@ -2077,8 +2080,8 @@ const mt = ({
|
|
|
2077
2080
|
{
|
|
2078
2081
|
size: "sm",
|
|
2079
2082
|
variant: "ghost",
|
|
2080
|
-
onClick: () =>
|
|
2081
|
-
disabled:
|
|
2083
|
+
onClick: () => M(0),
|
|
2084
|
+
disabled: T.page === 0,
|
|
2082
2085
|
iconOnly: !0,
|
|
2083
2086
|
children: /* @__PURE__ */ e(gt, {})
|
|
2084
2087
|
}
|
|
@@ -2088,25 +2091,25 @@ const mt = ({
|
|
|
2088
2091
|
{
|
|
2089
2092
|
size: "sm",
|
|
2090
2093
|
variant: "ghost",
|
|
2091
|
-
onClick: () =>
|
|
2092
|
-
disabled:
|
|
2094
|
+
onClick: () => M(T.page - 1),
|
|
2095
|
+
disabled: T.page === 0,
|
|
2093
2096
|
iconOnly: !0,
|
|
2094
2097
|
children: /* @__PURE__ */ e(xt, {})
|
|
2095
2098
|
}
|
|
2096
2099
|
),
|
|
2097
2100
|
/* @__PURE__ */ d("span", { className: "px-3 py-1 text-sm text-muted", children: [
|
|
2098
2101
|
"Page ",
|
|
2099
|
-
|
|
2102
|
+
T.page + 1,
|
|
2100
2103
|
" of ",
|
|
2101
|
-
|
|
2104
|
+
$
|
|
2102
2105
|
] }),
|
|
2103
2106
|
/* @__PURE__ */ e(
|
|
2104
2107
|
te,
|
|
2105
2108
|
{
|
|
2106
2109
|
size: "sm",
|
|
2107
2110
|
variant: "ghost",
|
|
2108
|
-
onClick: () =>
|
|
2109
|
-
disabled:
|
|
2111
|
+
onClick: () => M(T.page + 1),
|
|
2112
|
+
disabled: T.page >= $ - 1,
|
|
2110
2113
|
iconOnly: !0,
|
|
2111
2114
|
children: /* @__PURE__ */ e(bt, {})
|
|
2112
2115
|
}
|
|
@@ -2116,8 +2119,8 @@ const mt = ({
|
|
|
2116
2119
|
{
|
|
2117
2120
|
size: "sm",
|
|
2118
2121
|
variant: "ghost",
|
|
2119
|
-
onClick: () =>
|
|
2120
|
-
disabled:
|
|
2122
|
+
onClick: () => M($ - 1),
|
|
2123
|
+
disabled: T.page >= $ - 1,
|
|
2121
2124
|
iconOnly: !0,
|
|
2122
2125
|
children: /* @__PURE__ */ e(yt, {})
|
|
2123
2126
|
}
|
|
@@ -2131,19 +2134,19 @@ const mt = ({
|
|
|
2131
2134
|
onTabChange: r,
|
|
2132
2135
|
className: n
|
|
2133
2136
|
}) => {
|
|
2134
|
-
const [s,
|
|
2135
|
-
r ? r(p) :
|
|
2137
|
+
const [s, i] = O(t[0]?.id || ""), m = a || s, g = (p) => {
|
|
2138
|
+
r ? r(p) : i(p);
|
|
2136
2139
|
};
|
|
2137
2140
|
return /* @__PURE__ */ e("div", { className: x("border-b border-neutral-200 dark:border-neutral-700", n), children: /* @__PURE__ */ e("nav", { className: "-mb-px flex space-x-8", children: t.map((p) => /* @__PURE__ */ e(
|
|
2138
2141
|
"button",
|
|
2139
2142
|
{
|
|
2140
|
-
onClick: () => !p.disabled &&
|
|
2143
|
+
onClick: () => !p.disabled && g(p.id),
|
|
2141
2144
|
disabled: p.disabled,
|
|
2142
2145
|
className: x(
|
|
2143
2146
|
"border-b-2 py-2 px-1 text-sm font-medium transition-colors duration-200",
|
|
2144
2147
|
{
|
|
2145
|
-
"border-primary text-primary":
|
|
2146
|
-
"border-transparent text-neutral-500 hover:text-neutral-700 dark:text-neutral-400 dark:hover:text-neutral-300":
|
|
2148
|
+
"border-primary text-primary": m === p.id,
|
|
2149
|
+
"border-transparent text-neutral-500 hover:text-neutral-700 dark:text-neutral-400 dark:hover:text-neutral-300": m !== p.id && !p.disabled,
|
|
2147
2150
|
"border-transparent text-neutral-300 cursor-not-allowed dark:text-neutral-600": p.disabled
|
|
2148
2151
|
}
|
|
2149
2152
|
),
|
|
@@ -2151,7 +2154,7 @@ const mt = ({
|
|
|
2151
2154
|
p.label,
|
|
2152
2155
|
p.badge && /* @__PURE__ */ e("span", { className: x(
|
|
2153
2156
|
"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",
|
|
2154
|
-
|
|
2157
|
+
m === p.id ? "bg-primary/10 text-primary" : "bg-neutral-100 text-neutral-600 dark:bg-neutral-800 dark:text-neutral-400"
|
|
2155
2158
|
), children: p.badge })
|
|
2156
2159
|
] })
|
|
2157
2160
|
},
|
|
@@ -2163,17 +2166,17 @@ const mt = ({
|
|
|
2163
2166
|
activeTab: r,
|
|
2164
2167
|
onTabChange: n,
|
|
2165
2168
|
variant: s = "default",
|
|
2166
|
-
size:
|
|
2167
|
-
className:
|
|
2169
|
+
size: i = "md",
|
|
2170
|
+
className: m
|
|
2168
2171
|
}) => {
|
|
2169
|
-
const [
|
|
2172
|
+
const [g, p] = O(
|
|
2170
2173
|
a || r || t[0]?.id || ""
|
|
2171
|
-
),
|
|
2172
|
-
n ? n(
|
|
2174
|
+
), b = r || g, f = (C) => {
|
|
2175
|
+
n ? n(C) : p(C);
|
|
2173
2176
|
}, l = {
|
|
2174
|
-
activeTab:
|
|
2175
|
-
setActiveTab:
|
|
2176
|
-
}, u = t.find((
|
|
2177
|
+
activeTab: b,
|
|
2178
|
+
setActiveTab: f
|
|
2179
|
+
}, u = t.find((C) => C.id === b), h = x(
|
|
2177
2180
|
"flex",
|
|
2178
2181
|
{
|
|
2179
2182
|
"border-b border-neutral-200 dark:border-neutral-700 px-2": s === "default" || s === "underline",
|
|
@@ -2181,12 +2184,12 @@ const mt = ({
|
|
|
2181
2184
|
"space-x-1": s === "pills",
|
|
2182
2185
|
"space-x-8": s === "default" || s === "underline"
|
|
2183
2186
|
},
|
|
2184
|
-
|
|
2185
|
-
),
|
|
2186
|
-
const
|
|
2187
|
-
"text-xs px-2 py-1":
|
|
2188
|
-
"text-sm px-3 py-2":
|
|
2189
|
-
"text-base px-4 py-3":
|
|
2187
|
+
m
|
|
2188
|
+
), k = (C, v) => {
|
|
2189
|
+
const j = "transition-colors duration-200 font-medium", N = {
|
|
2190
|
+
"text-xs px-2 py-1": i === "sm",
|
|
2191
|
+
"text-sm px-3 py-2": i === "md",
|
|
2192
|
+
"text-base px-4 py-3": i === "lg"
|
|
2190
2193
|
}, q = {
|
|
2191
2194
|
// Default variant
|
|
2192
2195
|
"border-b-2 -mb-px": s === "default",
|
|
@@ -2194,43 +2197,43 @@ const mt = ({
|
|
|
2194
2197
|
"rounded-md": s === "pills",
|
|
2195
2198
|
// Underline variant
|
|
2196
2199
|
"border-b-2 pb-2": s === "underline"
|
|
2197
|
-
},
|
|
2198
|
-
"opacity-50 cursor-not-allowed":
|
|
2199
|
-
"cursor-pointer": !
|
|
2200
|
-
}, U =
|
|
2200
|
+
}, P = {
|
|
2201
|
+
"opacity-50 cursor-not-allowed": C.disabled,
|
|
2202
|
+
"cursor-pointer": !C.disabled
|
|
2203
|
+
}, U = v ? {
|
|
2201
2204
|
"border-primary text-primary": s === "default" || s === "underline",
|
|
2202
2205
|
"bg-white dark:bg-neutral-700 text-neutral-900 dark:text-neutral-100 shadow-sm": s === "pills"
|
|
2203
|
-
} : {}, F = !
|
|
2206
|
+
} : {}, F = !v && !C.disabled ? {
|
|
2204
2207
|
"border-transparent text-neutral-600 hover:text-neutral-900 dark:text-neutral-400 dark:hover:text-neutral-100": s === "default",
|
|
2205
2208
|
"text-neutral-600 hover:text-neutral-900 dark:text-neutral-400 dark:hover:text-neutral-100": s === "pills",
|
|
2206
2209
|
"border-transparent text-neutral-600 hover:text-neutral-900 hover:border-neutral-300 dark:text-neutral-400 dark:hover:text-neutral-100": s === "underline"
|
|
2207
2210
|
} : {};
|
|
2208
|
-
return x(
|
|
2211
|
+
return x(j, N, q, P, U, F);
|
|
2209
2212
|
};
|
|
2210
2213
|
return /* @__PURE__ */ e(Nt.Provider, { value: l, children: /* @__PURE__ */ d("div", { children: [
|
|
2211
|
-
/* @__PURE__ */ e("div", { className: h, role: "tablist", children: t.map((
|
|
2214
|
+
/* @__PURE__ */ e("div", { className: h, role: "tablist", children: t.map((C) => /* @__PURE__ */ e(
|
|
2212
2215
|
"button",
|
|
2213
2216
|
{
|
|
2214
2217
|
type: "button",
|
|
2215
2218
|
role: "tab",
|
|
2216
|
-
"aria-selected":
|
|
2217
|
-
"aria-controls": `tabpanel-${
|
|
2218
|
-
disabled:
|
|
2219
|
-
onClick: () => !
|
|
2220
|
-
className: C
|
|
2219
|
+
"aria-selected": b === C.id,
|
|
2220
|
+
"aria-controls": `tabpanel-${C.id}`,
|
|
2221
|
+
disabled: C.disabled,
|
|
2222
|
+
onClick: () => !C.disabled && f(C.id),
|
|
2223
|
+
className: k(C, b === C.id),
|
|
2221
2224
|
children: /* @__PURE__ */ d("span", { className: "flex items-center gap-2", children: [
|
|
2222
|
-
|
|
2223
|
-
|
|
2225
|
+
C.label,
|
|
2226
|
+
C.badge && /* @__PURE__ */ e("span", { className: "inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-neutral-200 text-neutral-700 dark:bg-neutral-700 dark:text-neutral-300", children: C.badge })
|
|
2224
2227
|
] })
|
|
2225
2228
|
},
|
|
2226
|
-
|
|
2229
|
+
C.id
|
|
2227
2230
|
)) }),
|
|
2228
2231
|
u?.content && /* @__PURE__ */ e(
|
|
2229
2232
|
"div",
|
|
2230
2233
|
{
|
|
2231
2234
|
role: "tabpanel",
|
|
2232
|
-
id: `tabpanel-${
|
|
2233
|
-
"aria-labelledby": `tab-${
|
|
2235
|
+
id: `tabpanel-${b}`,
|
|
2236
|
+
"aria-labelledby": `tab-${b}`,
|
|
2234
2237
|
className: "mt-4",
|
|
2235
2238
|
children: u.content
|
|
2236
2239
|
}
|
|
@@ -2249,25 +2252,25 @@ function Ct({
|
|
|
2249
2252
|
title: r,
|
|
2250
2253
|
size: n = "md",
|
|
2251
2254
|
closeOnBackdropClick: s = !0,
|
|
2252
|
-
closeOnEscape:
|
|
2253
|
-
className:
|
|
2254
|
-
backdropClassName:
|
|
2255
|
+
closeOnEscape: i = !0,
|
|
2256
|
+
className: m,
|
|
2257
|
+
backdropClassName: g,
|
|
2255
2258
|
children: p,
|
|
2256
|
-
footer:
|
|
2257
|
-
showCloseButton:
|
|
2259
|
+
footer: b,
|
|
2260
|
+
showCloseButton: f = !0
|
|
2258
2261
|
}) {
|
|
2259
|
-
const l =
|
|
2262
|
+
const l = Z(null), u = Z(null);
|
|
2260
2263
|
K(() => {
|
|
2261
|
-
if (!t || !
|
|
2262
|
-
const
|
|
2263
|
-
|
|
2264
|
+
if (!t || !i) return;
|
|
2265
|
+
const k = (C) => {
|
|
2266
|
+
C.key === "Escape" && a();
|
|
2264
2267
|
};
|
|
2265
|
-
return document.addEventListener("keydown",
|
|
2266
|
-
}, [t,
|
|
2268
|
+
return document.addEventListener("keydown", k), () => document.removeEventListener("keydown", k);
|
|
2269
|
+
}, [t, i, a]), K(() => (t ? (u.current = document.activeElement, l.current && l.current.focus(), document.body.style.overflow = "hidden") : (u.current && u.current.focus(), document.body.style.overflow = ""), () => {
|
|
2267
2270
|
document.body.style.overflow = "";
|
|
2268
2271
|
}), [t]);
|
|
2269
|
-
const h = (
|
|
2270
|
-
s &&
|
|
2272
|
+
const h = (k) => {
|
|
2273
|
+
s && k.target === k.currentTarget && a();
|
|
2271
2274
|
};
|
|
2272
2275
|
return t ? /* @__PURE__ */ e(
|
|
2273
2276
|
"div",
|
|
@@ -2276,7 +2279,7 @@ function Ct({
|
|
|
2276
2279
|
"fixed inset-0 z-50 flex items-center justify-center p-4",
|
|
2277
2280
|
"bg-black/20",
|
|
2278
2281
|
// 'animate-fade-in',
|
|
2279
|
-
|
|
2282
|
+
g
|
|
2280
2283
|
),
|
|
2281
2284
|
onClick: h,
|
|
2282
2285
|
children: /* @__PURE__ */ d(
|
|
@@ -2288,14 +2291,14 @@ function Ct({
|
|
|
2288
2291
|
// 'animate-scale-in',
|
|
2289
2292
|
"focus:outline-none",
|
|
2290
2293
|
kt[n],
|
|
2291
|
-
|
|
2294
|
+
m
|
|
2292
2295
|
),
|
|
2293
2296
|
role: "dialog",
|
|
2294
2297
|
"aria-modal": "true",
|
|
2295
2298
|
"aria-labelledby": r ? "modal-title" : void 0,
|
|
2296
2299
|
tabIndex: -1,
|
|
2297
2300
|
children: [
|
|
2298
|
-
(r ||
|
|
2301
|
+
(r || f) && /* @__PURE__ */ d("div", { className: "flex items-center justify-between p-6 pb-0", children: [
|
|
2299
2302
|
r && /* @__PURE__ */ e(
|
|
2300
2303
|
"span",
|
|
2301
2304
|
{
|
|
@@ -2304,7 +2307,7 @@ function Ct({
|
|
|
2304
2307
|
children: r
|
|
2305
2308
|
}
|
|
2306
2309
|
),
|
|
2307
|
-
|
|
2310
|
+
f && /* @__PURE__ */ e(
|
|
2308
2311
|
"button",
|
|
2309
2312
|
{
|
|
2310
2313
|
onClick: a,
|
|
@@ -2315,29 +2318,29 @@ function Ct({
|
|
|
2315
2318
|
)
|
|
2316
2319
|
] }),
|
|
2317
2320
|
/* @__PURE__ */ e("div", { className: "p-6", children: p }),
|
|
2318
|
-
|
|
2321
|
+
b && /* @__PURE__ */ e("div", { className: "px-6 py-4", children: b })
|
|
2319
2322
|
]
|
|
2320
2323
|
}
|
|
2321
2324
|
)
|
|
2322
2325
|
}
|
|
2323
2326
|
) : null;
|
|
2324
2327
|
}
|
|
2325
|
-
const
|
|
2328
|
+
const Y = ({
|
|
2326
2329
|
variant: t = "body",
|
|
2327
2330
|
size: a = "md",
|
|
2328
2331
|
weight: r = "normal",
|
|
2329
2332
|
color: n = "current",
|
|
2330
2333
|
align: s = "left",
|
|
2331
|
-
truncate:
|
|
2332
|
-
italic:
|
|
2333
|
-
underline:
|
|
2334
|
+
truncate: i = !1,
|
|
2335
|
+
italic: m = !1,
|
|
2336
|
+
underline: g = !1,
|
|
2334
2337
|
lineHeight: p = "normal",
|
|
2335
|
-
as:
|
|
2336
|
-
className:
|
|
2338
|
+
as: b,
|
|
2339
|
+
className: f,
|
|
2337
2340
|
children: l,
|
|
2338
2341
|
...u
|
|
2339
2342
|
}) => {
|
|
2340
|
-
const h =
|
|
2343
|
+
const h = b || St(t), k = x(
|
|
2341
2344
|
// Base styles
|
|
2342
2345
|
"font-primary",
|
|
2343
2346
|
// Variant styles
|
|
@@ -2394,13 +2397,13 @@ const Z = ({
|
|
|
2394
2397
|
},
|
|
2395
2398
|
// Text decorations
|
|
2396
2399
|
{
|
|
2397
|
-
italic:
|
|
2398
|
-
underline:
|
|
2399
|
-
truncate:
|
|
2400
|
+
italic: m,
|
|
2401
|
+
underline: g,
|
|
2402
|
+
truncate: i
|
|
2400
2403
|
},
|
|
2401
|
-
|
|
2404
|
+
f
|
|
2402
2405
|
);
|
|
2403
|
-
return /* @__PURE__ */ e(h, { className:
|
|
2406
|
+
return /* @__PURE__ */ e(h, { className: k, ...u, children: l });
|
|
2404
2407
|
};
|
|
2405
2408
|
function St(t) {
|
|
2406
2409
|
return {
|
|
@@ -2416,167 +2419,167 @@ const Lt = ({
|
|
|
2416
2419
|
label: r,
|
|
2417
2420
|
placeholder: n = "Select or upload a file",
|
|
2418
2421
|
error: s,
|
|
2419
|
-
disabled:
|
|
2420
|
-
accept:
|
|
2421
|
-
onListFiles:
|
|
2422
|
+
disabled: i,
|
|
2423
|
+
accept: m,
|
|
2424
|
+
onListFiles: g,
|
|
2422
2425
|
onListMounts: p,
|
|
2423
|
-
onUploadFile:
|
|
2424
|
-
onDownloadFile:
|
|
2426
|
+
onUploadFile: b,
|
|
2427
|
+
onDownloadFile: f,
|
|
2425
2428
|
onRegisterFile: l
|
|
2426
2429
|
}) => {
|
|
2427
|
-
const [u, h] =
|
|
2430
|
+
const [u, h] = O(!1), [k, C] = O([]), [v, j] = O(null), [N, q] = O("/"), [P, U] = O([]), [F, A] = O(!1), [H, T] = O(""), [V, W] = O(
|
|
2428
2431
|
typeof t == "object" ? t : null
|
|
2429
|
-
), [
|
|
2432
|
+
), [c, y] = O(!1), [L, S] = O(""), M = Z(null);
|
|
2430
2433
|
K(() => {
|
|
2431
|
-
u &&
|
|
2434
|
+
u && E();
|
|
2432
2435
|
}, [u]), K(() => {
|
|
2433
|
-
u &&
|
|
2434
|
-
}, [u,
|
|
2435
|
-
const
|
|
2436
|
-
|
|
2436
|
+
u && v && Q();
|
|
2437
|
+
}, [u, v, N, H]);
|
|
2438
|
+
const E = async () => {
|
|
2439
|
+
A(!0);
|
|
2437
2440
|
try {
|
|
2438
2441
|
const o = await p?.();
|
|
2439
|
-
o?.data &&
|
|
2442
|
+
o?.data && C(o.data);
|
|
2440
2443
|
} catch (o) {
|
|
2441
2444
|
console.error("Failed to load mounts", o);
|
|
2442
2445
|
} finally {
|
|
2443
|
-
|
|
2446
|
+
A(!1);
|
|
2444
2447
|
}
|
|
2445
2448
|
}, Q = async () => {
|
|
2446
|
-
if (
|
|
2447
|
-
|
|
2449
|
+
if (v) {
|
|
2450
|
+
A(!0);
|
|
2448
2451
|
try {
|
|
2449
|
-
const o = await
|
|
2452
|
+
const o = await g?.({ mountId: v.id, name: H, path: N });
|
|
2450
2453
|
o?.data && U(o.data);
|
|
2451
2454
|
} catch (o) {
|
|
2452
2455
|
console.error("Failed to load files", o);
|
|
2453
2456
|
} finally {
|
|
2454
|
-
|
|
2457
|
+
A(!1);
|
|
2455
2458
|
}
|
|
2456
2459
|
}
|
|
2457
2460
|
}, re = async (o) => {
|
|
2458
|
-
const
|
|
2459
|
-
if (
|
|
2460
|
-
|
|
2461
|
+
const w = o.target.files?.[0];
|
|
2462
|
+
if (w) {
|
|
2463
|
+
A(!0);
|
|
2461
2464
|
try {
|
|
2462
|
-
const _ = await
|
|
2465
|
+
const _ = await w.arrayBuffer(), R = new Uint8Array(_), B = {
|
|
2463
2466
|
id: `local-${Date.now()}`,
|
|
2464
|
-
name:
|
|
2467
|
+
name: w.name,
|
|
2465
2468
|
type: "file",
|
|
2466
2469
|
path: "/",
|
|
2467
|
-
mimeType:
|
|
2468
|
-
size:
|
|
2470
|
+
mimeType: w.type || "application/octet-stream",
|
|
2471
|
+
size: w.size,
|
|
2469
2472
|
mountId: "local",
|
|
2470
|
-
providerKey:
|
|
2473
|
+
providerKey: w.name,
|
|
2471
2474
|
ownerId: "me"
|
|
2472
2475
|
};
|
|
2473
|
-
|
|
2476
|
+
W(B), a(B, R), h(!1);
|
|
2474
2477
|
} catch (_) {
|
|
2475
2478
|
console.error("Local file selection failed", _);
|
|
2476
2479
|
} finally {
|
|
2477
|
-
|
|
2480
|
+
A(!1);
|
|
2478
2481
|
}
|
|
2479
2482
|
}
|
|
2480
|
-
},
|
|
2481
|
-
const
|
|
2482
|
-
if (!(!
|
|
2483
|
-
|
|
2483
|
+
}, X = async (o) => {
|
|
2484
|
+
const w = o.target.files?.[0];
|
|
2485
|
+
if (!(!w || !v)) {
|
|
2486
|
+
A(!0);
|
|
2484
2487
|
try {
|
|
2485
|
-
const _ = await
|
|
2488
|
+
const _ = await w.arrayBuffer(), R = await b?.({
|
|
2486
2489
|
file: new Uint8Array(_),
|
|
2487
|
-
filename:
|
|
2488
|
-
mimeType:
|
|
2489
|
-
mountId:
|
|
2490
|
-
path:
|
|
2490
|
+
filename: w.name,
|
|
2491
|
+
mimeType: w.type || "application/octet-stream",
|
|
2492
|
+
mountId: v.id,
|
|
2493
|
+
path: N
|
|
2491
2494
|
});
|
|
2492
2495
|
if (R?.data) {
|
|
2493
|
-
const
|
|
2494
|
-
|
|
2496
|
+
const B = R.data;
|
|
2497
|
+
W(B), a(B, new Uint8Array(_)), h(!1);
|
|
2495
2498
|
}
|
|
2496
2499
|
} catch (_) {
|
|
2497
2500
|
console.error("Upload failed", _);
|
|
2498
2501
|
} finally {
|
|
2499
|
-
|
|
2502
|
+
A(!1);
|
|
2500
2503
|
}
|
|
2501
2504
|
}
|
|
2502
|
-
},
|
|
2503
|
-
if (!(
|
|
2504
|
-
|
|
2505
|
+
}, $ = async () => {
|
|
2506
|
+
if (!(!L || !v)) {
|
|
2507
|
+
A(!0);
|
|
2505
2508
|
try {
|
|
2506
|
-
const o = `${
|
|
2509
|
+
const o = `${N}${L}/`;
|
|
2507
2510
|
l && (await l({
|
|
2508
|
-
name:
|
|
2511
|
+
name: L,
|
|
2509
2512
|
type: "folder",
|
|
2510
|
-
path:
|
|
2513
|
+
path: N,
|
|
2511
2514
|
mimeType: "application/x-directory",
|
|
2512
2515
|
size: 0,
|
|
2513
|
-
mountId:
|
|
2516
|
+
mountId: v.id,
|
|
2514
2517
|
providerKey: o,
|
|
2515
2518
|
ownerId: "me"
|
|
2516
|
-
}), await Q()), y(!1),
|
|
2519
|
+
}), await Q()), y(!1), S("");
|
|
2517
2520
|
} catch (o) {
|
|
2518
2521
|
console.error("Failed to create folder", o);
|
|
2519
2522
|
} finally {
|
|
2520
|
-
|
|
2523
|
+
A(!1);
|
|
2521
2524
|
}
|
|
2522
2525
|
}
|
|
2523
|
-
},
|
|
2524
|
-
|
|
2526
|
+
}, I = async (o) => {
|
|
2527
|
+
A(!0);
|
|
2525
2528
|
try {
|
|
2526
|
-
const
|
|
2527
|
-
|
|
2528
|
-
} catch (
|
|
2529
|
-
console.error("Failed to download file",
|
|
2529
|
+
const w = await f?.(o.id);
|
|
2530
|
+
W(o), a(o, w), h(!1);
|
|
2531
|
+
} catch (w) {
|
|
2532
|
+
console.error("Failed to download file", w);
|
|
2530
2533
|
} finally {
|
|
2531
|
-
|
|
2534
|
+
A(!1);
|
|
2532
2535
|
}
|
|
2533
|
-
},
|
|
2534
|
-
o.stopPropagation(),
|
|
2535
|
-
},
|
|
2536
|
-
const o = /* @__PURE__ */ new Set(),
|
|
2537
|
-
return
|
|
2536
|
+
}, z = (o) => {
|
|
2537
|
+
o.stopPropagation(), W(null), a(null);
|
|
2538
|
+
}, D = de(() => {
|
|
2539
|
+
const o = /* @__PURE__ */ new Set(), w = [];
|
|
2540
|
+
return P.forEach((_) => {
|
|
2538
2541
|
if (_.type === "folder") {
|
|
2539
|
-
_.path ===
|
|
2542
|
+
_.path === N && o.add(_.name);
|
|
2540
2543
|
return;
|
|
2541
2544
|
}
|
|
2542
|
-
const R = _.providerKey || _.name,
|
|
2543
|
-
|
|
2545
|
+
const R = _.providerKey || _.name, J = (N ? R.substring(N.length) : R).split("/").filter((he) => he !== "");
|
|
2546
|
+
J.length > 1 ? o.add(J[0]) : J.length === 1 && w.push(_);
|
|
2544
2547
|
}), {
|
|
2545
2548
|
folders: Array.from(o).sort(),
|
|
2546
|
-
files:
|
|
2549
|
+
files: w.sort((_, R) => _.name.localeCompare(R.name))
|
|
2547
2550
|
};
|
|
2548
|
-
}, [
|
|
2549
|
-
q((
|
|
2551
|
+
}, [P, N]), ee = (o) => {
|
|
2552
|
+
q((w) => `${w}${o}/`);
|
|
2550
2553
|
}, ne = () => {
|
|
2551
|
-
const o =
|
|
2554
|
+
const o = N.split("/").filter((w) => w !== "");
|
|
2552
2555
|
o.pop(), o.length === 0 ? q("/") : q(`${o.join("/")}/`);
|
|
2553
2556
|
}, G = de(() => {
|
|
2554
|
-
const o =
|
|
2555
|
-
id: `folder-${
|
|
2556
|
-
name:
|
|
2557
|
+
const o = D.folders.map((w) => ({
|
|
2558
|
+
id: `folder-${w}`,
|
|
2559
|
+
name: w,
|
|
2557
2560
|
type: "folder"
|
|
2558
2561
|
}));
|
|
2559
|
-
return
|
|
2562
|
+
return D.files.forEach((w) => {
|
|
2560
2563
|
o.push({
|
|
2561
|
-
...
|
|
2564
|
+
...w,
|
|
2562
2565
|
type: "file"
|
|
2563
2566
|
});
|
|
2564
2567
|
}), o;
|
|
2565
|
-
}, [
|
|
2568
|
+
}, [D]), le = [
|
|
2566
2569
|
{
|
|
2567
2570
|
id: "name",
|
|
2568
2571
|
header: "Name",
|
|
2569
2572
|
accessor: "name",
|
|
2570
|
-
cell: (o,
|
|
2573
|
+
cell: (o, w) => /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
2571
2574
|
/* @__PURE__ */ e(
|
|
2572
2575
|
oe,
|
|
2573
2576
|
{
|
|
2574
|
-
icon:
|
|
2577
|
+
icon: w.type === "folder" ? Ce : pe,
|
|
2575
2578
|
size: "sm",
|
|
2576
|
-
color:
|
|
2579
|
+
color: w.type === "folder" ? "warning" : "secondary"
|
|
2577
2580
|
}
|
|
2578
2581
|
),
|
|
2579
|
-
/* @__PURE__ */ e("span", { className: x(
|
|
2582
|
+
/* @__PURE__ */ e("span", { className: x(w.type === "folder" && "font-medium"), children: o })
|
|
2580
2583
|
] })
|
|
2581
2584
|
},
|
|
2582
2585
|
{
|
|
@@ -2594,16 +2597,16 @@ const Lt = ({
|
|
|
2594
2597
|
header: "",
|
|
2595
2598
|
accessor: "id",
|
|
2596
2599
|
align: "right",
|
|
2597
|
-
cell: (o,
|
|
2600
|
+
cell: (o, w) => /* @__PURE__ */ e(
|
|
2598
2601
|
te,
|
|
2599
2602
|
{
|
|
2600
2603
|
size: "sm",
|
|
2601
2604
|
variant: "outline",
|
|
2602
2605
|
onClick: (_) => {
|
|
2603
|
-
_.stopPropagation(),
|
|
2606
|
+
_.stopPropagation(), w.type === "folder" ? ee(w.name) : I(w);
|
|
2604
2607
|
},
|
|
2605
|
-
loading: F &&
|
|
2606
|
-
children:
|
|
2608
|
+
loading: F && w.type === "file" && V?.id === w.id,
|
|
2609
|
+
children: w.type === "folder" ? "Open" : "Select"
|
|
2607
2610
|
}
|
|
2608
2611
|
)
|
|
2609
2612
|
}
|
|
@@ -2622,28 +2625,28 @@ const Lt = ({
|
|
|
2622
2625
|
header: "",
|
|
2623
2626
|
accessor: "id",
|
|
2624
2627
|
align: "right",
|
|
2625
|
-
cell: (o,
|
|
2628
|
+
cell: (o, w) => /* @__PURE__ */ e(te, { size: "sm", variant: "outline", onClick: () => j(w), children: "Open" })
|
|
2626
2629
|
}
|
|
2627
2630
|
];
|
|
2628
2631
|
return /* @__PURE__ */ d("div", { className: "space-y-1", children: [
|
|
2629
|
-
r && /* @__PURE__ */ e(
|
|
2632
|
+
r && /* @__PURE__ */ e(Y, { variant: "label", size: "sm", weight: "medium", children: r }),
|
|
2630
2633
|
/* @__PURE__ */ d(
|
|
2631
2634
|
"div",
|
|
2632
2635
|
{
|
|
2633
|
-
onClick: () => !
|
|
2636
|
+
onClick: () => !i && h(!0),
|
|
2634
2637
|
className: x(
|
|
2635
2638
|
"flex items-center gap-3 px-3 py-2 border rounded-lg cursor-pointer transition-colors",
|
|
2636
2639
|
"hover:border-primary-400 bg-module",
|
|
2637
2640
|
s ? "border-error" : "border-neutral",
|
|
2638
|
-
|
|
2641
|
+
i && "opacity-50 cursor-not-allowed bg-module-subtle"
|
|
2639
2642
|
),
|
|
2640
2643
|
children: [
|
|
2641
|
-
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: /* @__PURE__ */ e(oe, { icon:
|
|
2642
|
-
/* @__PURE__ */ e("div", { className: "flex-grow truncate", children:
|
|
2643
|
-
|
|
2644
|
+
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: /* @__PURE__ */ e(oe, { icon: V ? pe : ke, color: V ? "primary" : "secondary" }) }),
|
|
2645
|
+
/* @__PURE__ */ e("div", { className: "flex-grow truncate", children: V ? /* @__PURE__ */ e("span", { className: "text-sm text-default font-medium", children: V.name }) : /* @__PURE__ */ e("span", { className: "text-sm text-muted", children: n }) }),
|
|
2646
|
+
V && !i && /* @__PURE__ */ e(
|
|
2644
2647
|
"button",
|
|
2645
2648
|
{
|
|
2646
|
-
onClick:
|
|
2649
|
+
onClick: z,
|
|
2647
2650
|
className: "p-1 hover:bg-neutral-container rounded",
|
|
2648
2651
|
children: /* @__PURE__ */ e(oe, { icon: Ve, size: "xs" })
|
|
2649
2652
|
}
|
|
@@ -2651,15 +2654,15 @@ const Lt = ({
|
|
|
2651
2654
|
]
|
|
2652
2655
|
}
|
|
2653
2656
|
),
|
|
2654
|
-
s && /* @__PURE__ */ e(
|
|
2657
|
+
s && /* @__PURE__ */ e(Y, { variant: "body", size: "xs", className: "text-error", children: s }),
|
|
2655
2658
|
/* @__PURE__ */ e(
|
|
2656
2659
|
Ct,
|
|
2657
2660
|
{
|
|
2658
2661
|
open: u,
|
|
2659
2662
|
onClose: () => {
|
|
2660
|
-
h(!1),
|
|
2663
|
+
h(!1), j(null), q("/"), y(!1);
|
|
2661
2664
|
},
|
|
2662
|
-
title:
|
|
2665
|
+
title: v ? `Explorer: ${v.name}` : "Select Storage Mount",
|
|
2663
2666
|
size: "lg",
|
|
2664
2667
|
children: /* @__PURE__ */ e(
|
|
2665
2668
|
wt,
|
|
@@ -2669,7 +2672,7 @@ const Lt = ({
|
|
|
2669
2672
|
{
|
|
2670
2673
|
id: "remote",
|
|
2671
2674
|
label: "Platform Storage",
|
|
2672
|
-
content: /* @__PURE__ */ e("div", { className: "space-y-4", children:
|
|
2675
|
+
content: /* @__PURE__ */ e("div", { className: "space-y-4", children: v ? /* @__PURE__ */ d(Ee, { children: [
|
|
2673
2676
|
/* @__PURE__ */ d("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
2674
2677
|
/* @__PURE__ */ e(
|
|
2675
2678
|
te,
|
|
@@ -2677,19 +2680,19 @@ const Lt = ({
|
|
|
2677
2680
|
variant: "ghost",
|
|
2678
2681
|
size: "sm",
|
|
2679
2682
|
onClick: () => {
|
|
2680
|
-
|
|
2683
|
+
N && N !== "/" ? ne() : j(null);
|
|
2681
2684
|
},
|
|
2682
2685
|
leftIcon: /* @__PURE__ */ e(oe, { icon: we, size: "xs" }),
|
|
2683
|
-
children:
|
|
2686
|
+
children: N ? "Back" : "Back to Mounts"
|
|
2684
2687
|
}
|
|
2685
2688
|
),
|
|
2686
|
-
/* @__PURE__ */ e("div", { className: "flex items-center gap-1 text-xs text-muted overflow-hidden bg-neutral-container px-2 py-1 rounded", children: /* @__PURE__ */ e("span", { className: "truncate", children:
|
|
2689
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-1 text-xs text-muted overflow-hidden bg-neutral-container px-2 py-1 rounded", children: /* @__PURE__ */ e("span", { className: "truncate", children: N }) }),
|
|
2687
2690
|
/* @__PURE__ */ e("div", { className: "flex-grow min-w-[150px]", children: /* @__PURE__ */ e(
|
|
2688
2691
|
ue,
|
|
2689
2692
|
{
|
|
2690
2693
|
placeholder: "Search...",
|
|
2691
|
-
value:
|
|
2692
|
-
onChange: (o) =>
|
|
2694
|
+
value: H,
|
|
2695
|
+
onChange: (o) => T(o.target.value),
|
|
2693
2696
|
startIcon: /* @__PURE__ */ e($e, { size: 14 }),
|
|
2694
2697
|
fullWidth: !0,
|
|
2695
2698
|
size: "sm"
|
|
@@ -2711,7 +2714,7 @@ const Lt = ({
|
|
|
2711
2714
|
{
|
|
2712
2715
|
variant: "primary",
|
|
2713
2716
|
size: "sm",
|
|
2714
|
-
onClick: () =>
|
|
2717
|
+
onClick: () => M.current?.click(),
|
|
2715
2718
|
leftIcon: /* @__PURE__ */ e(oe, { icon: We, size: "xs" }),
|
|
2716
2719
|
loading: F,
|
|
2717
2720
|
children: "Upload"
|
|
@@ -2722,26 +2725,26 @@ const Lt = ({
|
|
|
2722
2725
|
{
|
|
2723
2726
|
type: "file",
|
|
2724
2727
|
className: "hidden",
|
|
2725
|
-
ref:
|
|
2726
|
-
onChange:
|
|
2727
|
-
accept:
|
|
2728
|
+
ref: M,
|
|
2729
|
+
onChange: X,
|
|
2730
|
+
accept: m
|
|
2728
2731
|
}
|
|
2729
2732
|
)
|
|
2730
2733
|
] })
|
|
2731
2734
|
] }),
|
|
2732
|
-
|
|
2735
|
+
c && /* @__PURE__ */ d("div", { className: "flex items-center gap-2 p-3 bg-module-subtle rounded-lg border border-neutral", children: [
|
|
2733
2736
|
/* @__PURE__ */ e(oe, { icon: Ce, size: "sm", color: "warning" }),
|
|
2734
2737
|
/* @__PURE__ */ e(
|
|
2735
2738
|
ue,
|
|
2736
2739
|
{
|
|
2737
2740
|
size: "sm",
|
|
2738
2741
|
placeholder: "Folder name",
|
|
2739
|
-
value:
|
|
2740
|
-
onChange: (o) =>
|
|
2742
|
+
value: L,
|
|
2743
|
+
onChange: (o) => S(o.target.value),
|
|
2741
2744
|
autoFocus: !0
|
|
2742
2745
|
}
|
|
2743
2746
|
),
|
|
2744
|
-
/* @__PURE__ */ e(te, { size: "sm", onClick:
|
|
2747
|
+
/* @__PURE__ */ e(te, { size: "sm", onClick: $, loading: F, children: "Create" }),
|
|
2745
2748
|
/* @__PURE__ */ e(te, { size: "sm", variant: "ghost", onClick: () => y(!1), children: "Cancel" })
|
|
2746
2749
|
] }),
|
|
2747
2750
|
/* @__PURE__ */ e("div", { className: "max-h-[400px] overflow-auto rounded-lg border border-neutral", children: /* @__PURE__ */ e(
|
|
@@ -2751,17 +2754,17 @@ const Lt = ({
|
|
|
2751
2754
|
columns: le,
|
|
2752
2755
|
loading: F,
|
|
2753
2756
|
emptyContent: "This folder is empty",
|
|
2754
|
-
onRowClick: (o) => o.type === "folder" ? ee(o.name) :
|
|
2757
|
+
onRowClick: (o) => o.type === "folder" ? ee(o.name) : I(o)
|
|
2755
2758
|
}
|
|
2756
2759
|
) })
|
|
2757
2760
|
] }) : /* @__PURE__ */ e("div", { className: "max-h-[400px] overflow-auto rounded-lg border border-neutral", children: /* @__PURE__ */ e(
|
|
2758
2761
|
Le,
|
|
2759
2762
|
{
|
|
2760
|
-
data:
|
|
2763
|
+
data: k,
|
|
2761
2764
|
columns: fe,
|
|
2762
2765
|
loading: F,
|
|
2763
2766
|
emptyContent: "No storage mounts configured",
|
|
2764
|
-
onRowClick: (o) =>
|
|
2767
|
+
onRowClick: (o) => j(o)
|
|
2765
2768
|
}
|
|
2766
2769
|
) }) })
|
|
2767
2770
|
},
|
|
@@ -2770,8 +2773,8 @@ const Lt = ({
|
|
|
2770
2773
|
label: "Local File",
|
|
2771
2774
|
content: /* @__PURE__ */ e("div", { className: "space-y-6", children: /* @__PURE__ */ d("div", { className: "flex flex-col items-center justify-center py-12 border-2 border-dashed border-neutral rounded-xl bg-module-subtle/50", children: [
|
|
2772
2775
|
/* @__PURE__ */ e("div", { className: "p-4 bg-primary/10 rounded-full mb-4", children: /* @__PURE__ */ e(oe, { icon: pe, size: "xl", color: "primary" }) }),
|
|
2773
|
-
/* @__PURE__ */ e(
|
|
2774
|
-
/* @__PURE__ */ d(
|
|
2776
|
+
/* @__PURE__ */ e(Y, { variant: "label", size: "lg", weight: "semibold", children: "Select a file from your computer" }),
|
|
2777
|
+
/* @__PURE__ */ d(Y, { variant: "body", size: "sm", className: "text-muted mt-1 mb-6 text-center max-w-xs", children: [
|
|
2775
2778
|
"This file will be used directly in the form and will ",
|
|
2776
2779
|
/* @__PURE__ */ e("strong", { children: "not" }),
|
|
2777
2780
|
" be uploaded to platform storage."
|
|
@@ -2793,7 +2796,7 @@ const Lt = ({
|
|
|
2793
2796
|
type: "file",
|
|
2794
2797
|
className: "hidden",
|
|
2795
2798
|
onChange: re,
|
|
2796
|
-
accept:
|
|
2799
|
+
accept: m,
|
|
2797
2800
|
disabled: F
|
|
2798
2801
|
}
|
|
2799
2802
|
)
|
|
@@ -2815,20 +2818,20 @@ function Me(t, a) {
|
|
|
2815
2818
|
}
|
|
2816
2819
|
function Mt(t, a, r) {
|
|
2817
2820
|
const n = a.split("."), s = Array.isArray(t) ? [...t] : { ...t };
|
|
2818
|
-
let
|
|
2819
|
-
for (let
|
|
2820
|
-
const
|
|
2821
|
-
|
|
2821
|
+
let i = s;
|
|
2822
|
+
for (let m = 0; m < n.length - 1; m++) {
|
|
2823
|
+
const g = n[m], p = i[g];
|
|
2824
|
+
i[g] = p && typeof p == "object" ? Array.isArray(p) ? [...p] : { ...p } : {}, i = i[g];
|
|
2822
2825
|
}
|
|
2823
|
-
return
|
|
2826
|
+
return i[n[n.length - 1]] = r, s;
|
|
2824
2827
|
}
|
|
2825
2828
|
function Et(t, a) {
|
|
2826
2829
|
const r = a.split("."), n = Array.isArray(t) ? [...t] : { ...t };
|
|
2827
2830
|
let s = n;
|
|
2828
|
-
for (let
|
|
2829
|
-
const
|
|
2830
|
-
if (!s[
|
|
2831
|
-
s[
|
|
2831
|
+
for (let i = 0; i < r.length - 1; i++) {
|
|
2832
|
+
const m = r[i];
|
|
2833
|
+
if (!s[m] || typeof s[m] != "object") return n;
|
|
2834
|
+
s[m] = Array.isArray(s[m]) ? [...s[m]] : { ...s[m] }, s = s[m];
|
|
2832
2835
|
}
|
|
2833
2836
|
return delete s[r[r.length - 1]], n;
|
|
2834
2837
|
}
|
|
@@ -2838,104 +2841,104 @@ const rr = ({
|
|
|
2838
2841
|
onSubmit: r,
|
|
2839
2842
|
onCancel: n,
|
|
2840
2843
|
onChange: s,
|
|
2841
|
-
transform:
|
|
2842
|
-
validate:
|
|
2843
|
-
submitButton:
|
|
2844
|
+
transform: i,
|
|
2845
|
+
validate: m,
|
|
2846
|
+
submitButton: g = { label: "Submit", variant: "primary" },
|
|
2844
2847
|
cancelButton: p = { label: "Cancel", variant: "outline" },
|
|
2845
|
-
showButtons:
|
|
2846
|
-
layout:
|
|
2848
|
+
showButtons: b = !0,
|
|
2849
|
+
layout: f = "vertical",
|
|
2847
2850
|
size: l = "md",
|
|
2848
2851
|
loading: u = !1,
|
|
2849
2852
|
className: h,
|
|
2850
|
-
ref:
|
|
2851
|
-
sdk:
|
|
2853
|
+
ref: k,
|
|
2854
|
+
sdk: C
|
|
2852
2855
|
}) => {
|
|
2853
|
-
const [
|
|
2856
|
+
const [v, j] = O(a || {}), [N, q] = O({}), [P, U] = O({});
|
|
2854
2857
|
K(() => {
|
|
2855
|
-
a &&
|
|
2858
|
+
a && j({ ...a });
|
|
2856
2859
|
}, [a]);
|
|
2857
2860
|
const F = ae(
|
|
2858
|
-
(
|
|
2859
|
-
const
|
|
2860
|
-
if (!
|
|
2861
|
-
if (
|
|
2862
|
-
return `${
|
|
2863
|
-
if (
|
|
2864
|
-
if (
|
|
2865
|
-
return `${
|
|
2861
|
+
(c, y, L) => {
|
|
2862
|
+
const S = t.flatMap((M) => M.items).find((M) => M.name === c);
|
|
2863
|
+
if (!S) return null;
|
|
2864
|
+
if (S.required && (y == null || y === ""))
|
|
2865
|
+
return `${S.label} is required`;
|
|
2866
|
+
if (S.type === "array") {
|
|
2867
|
+
if (S.required && (!y || y.length === 0))
|
|
2868
|
+
return `${S.label} cannot be empty.`;
|
|
2866
2869
|
if (y && !Array.isArray(y))
|
|
2867
|
-
return `${
|
|
2868
|
-
if (Array.isArray(y) &&
|
|
2869
|
-
const
|
|
2870
|
-
let
|
|
2870
|
+
return `${S.label} must be an array.`;
|
|
2871
|
+
if (Array.isArray(y) && S.arrayFields) {
|
|
2872
|
+
const M = [];
|
|
2873
|
+
let E = !1;
|
|
2871
2874
|
if (y.forEach((Q, re) => {
|
|
2872
|
-
const
|
|
2873
|
-
for (const
|
|
2874
|
-
const
|
|
2875
|
-
if (
|
|
2876
|
-
|
|
2877
|
-
else if (
|
|
2878
|
-
const
|
|
2879
|
-
|
|
2875
|
+
const X = {};
|
|
2876
|
+
for (const $ of S.arrayFields) {
|
|
2877
|
+
const I = Q?.[$.name];
|
|
2878
|
+
if ($.required && (I == null || I === ""))
|
|
2879
|
+
X[$.name] = `${$.label} is required`, E = !0;
|
|
2880
|
+
else if ($.validator) {
|
|
2881
|
+
const z = $.validator(I, Q);
|
|
2882
|
+
z && (X[$.name] = z, E = !0);
|
|
2880
2883
|
}
|
|
2881
2884
|
}
|
|
2882
|
-
|
|
2883
|
-
}),
|
|
2884
|
-
return JSON.stringify(
|
|
2885
|
+
M[re] = X;
|
|
2886
|
+
}), E)
|
|
2887
|
+
return JSON.stringify(M);
|
|
2885
2888
|
}
|
|
2886
2889
|
}
|
|
2887
|
-
return
|
|
2890
|
+
return S.validator ? S.validator(y, L) : null;
|
|
2888
2891
|
},
|
|
2889
2892
|
[t]
|
|
2890
|
-
),
|
|
2891
|
-
(
|
|
2892
|
-
let
|
|
2893
|
-
|
|
2894
|
-
|
|
2893
|
+
), A = ae(
|
|
2894
|
+
(c, y) => {
|
|
2895
|
+
let L = Mt(
|
|
2896
|
+
v,
|
|
2897
|
+
c,
|
|
2895
2898
|
y
|
|
2896
2899
|
);
|
|
2897
|
-
t.flatMap((
|
|
2898
|
-
const
|
|
2899
|
-
q((
|
|
2900
|
-
...
|
|
2901
|
-
[
|
|
2902
|
-
})), s?.(
|
|
2900
|
+
t.flatMap((E) => E.items).find((E) => E.name === c)?.removeIfEmpty && (y == null || y === "") && (L = Et(L, c)), j(L), U((E) => ({ ...E, [c]: !0 }));
|
|
2901
|
+
const M = F(c, y, L);
|
|
2902
|
+
q((E) => ({
|
|
2903
|
+
...E,
|
|
2904
|
+
[c]: M || ""
|
|
2905
|
+
})), s?.(L, c);
|
|
2903
2906
|
},
|
|
2904
|
-
[
|
|
2905
|
-
),
|
|
2906
|
-
async (
|
|
2907
|
-
if (console.log("handleSubmit"),
|
|
2908
|
-
const y = {},
|
|
2909
|
-
for (const
|
|
2910
|
-
if (
|
|
2907
|
+
[v, t, F, s]
|
|
2908
|
+
), H = ae(
|
|
2909
|
+
async (c) => {
|
|
2910
|
+
if (console.log("handleSubmit"), c.preventDefault(), u) return;
|
|
2911
|
+
const y = {}, L = t.flatMap((M) => M.items);
|
|
2912
|
+
for (const M of L) {
|
|
2913
|
+
if (M.hidden || M.conditional && !M.conditional(v))
|
|
2911
2914
|
continue;
|
|
2912
|
-
const
|
|
2913
|
-
|
|
2914
|
-
Me(
|
|
2915
|
-
|
|
2915
|
+
const E = F(
|
|
2916
|
+
M.name,
|
|
2917
|
+
Me(v, M.name),
|
|
2918
|
+
v
|
|
2916
2919
|
);
|
|
2917
|
-
|
|
2920
|
+
E && (y[M.name] = E);
|
|
2918
2921
|
}
|
|
2919
|
-
if (
|
|
2920
|
-
const
|
|
2921
|
-
|
|
2922
|
+
if (m) {
|
|
2923
|
+
const M = m(v);
|
|
2924
|
+
M && Object.assign(y, M);
|
|
2922
2925
|
}
|
|
2923
|
-
if (q(y), console.log("newErrors", y), Object.keys(y).some((
|
|
2926
|
+
if (q(y), console.log("newErrors", y), Object.keys(y).some((M) => y[M]))
|
|
2924
2927
|
return;
|
|
2925
|
-
const
|
|
2926
|
-
await r?.(
|
|
2928
|
+
const S = i ? i(v) : v;
|
|
2929
|
+
await r?.(v, S);
|
|
2927
2930
|
},
|
|
2928
|
-
[
|
|
2929
|
-
),
|
|
2930
|
-
(
|
|
2931
|
-
const y = Me(
|
|
2931
|
+
[v, t, F, m, i, r, u]
|
|
2932
|
+
), T = ae(
|
|
2933
|
+
(c) => {
|
|
2934
|
+
const y = Me(v, c.name), L = P[c.name] ? N[c.name] : void 0, S = c.disabled || u, M = {
|
|
2932
2935
|
value: y || "",
|
|
2933
|
-
disabled:
|
|
2934
|
-
required:
|
|
2935
|
-
placeholder:
|
|
2936
|
-
...
|
|
2936
|
+
disabled: S,
|
|
2937
|
+
required: c.required,
|
|
2938
|
+
placeholder: c.placeholder,
|
|
2939
|
+
...c.fieldProps
|
|
2937
2940
|
};
|
|
2938
|
-
switch (
|
|
2941
|
+
switch (c.type) {
|
|
2939
2942
|
case "text":
|
|
2940
2943
|
case "email":
|
|
2941
2944
|
case "password":
|
|
@@ -2945,11 +2948,11 @@ const rr = ({
|
|
|
2945
2948
|
return /* @__PURE__ */ e(
|
|
2946
2949
|
ue,
|
|
2947
2950
|
{
|
|
2948
|
-
...
|
|
2949
|
-
onChange: (
|
|
2950
|
-
type:
|
|
2951
|
-
autoComplete:
|
|
2952
|
-
error:
|
|
2951
|
+
...M,
|
|
2952
|
+
onChange: (E) => A(c.name, E.target.value),
|
|
2953
|
+
type: c.textType || c.type,
|
|
2954
|
+
autoComplete: c.autocomplete,
|
|
2955
|
+
error: L,
|
|
2953
2956
|
size: l
|
|
2954
2957
|
}
|
|
2955
2958
|
);
|
|
@@ -2957,10 +2960,10 @@ const rr = ({
|
|
|
2957
2960
|
return /* @__PURE__ */ e(
|
|
2958
2961
|
Ne,
|
|
2959
2962
|
{
|
|
2960
|
-
...
|
|
2961
|
-
onChange: (
|
|
2963
|
+
...M,
|
|
2964
|
+
onChange: (E) => A(c.name, E.target.value),
|
|
2962
2965
|
rows: 4,
|
|
2963
|
-
error:
|
|
2966
|
+
error: L,
|
|
2964
2967
|
size: l
|
|
2965
2968
|
}
|
|
2966
2969
|
);
|
|
@@ -2968,16 +2971,16 @@ const rr = ({
|
|
|
2968
2971
|
return /* @__PURE__ */ e(
|
|
2969
2972
|
ve,
|
|
2970
2973
|
{
|
|
2971
|
-
...
|
|
2972
|
-
onChange: (
|
|
2973
|
-
options: (
|
|
2974
|
-
...
|
|
2975
|
-
value: String(
|
|
2974
|
+
...M,
|
|
2975
|
+
onChange: (E) => A(c.name, E),
|
|
2976
|
+
options: (c.options || []).map((E) => ({
|
|
2977
|
+
...E,
|
|
2978
|
+
value: String(E.value)
|
|
2976
2979
|
})),
|
|
2977
|
-
searchable:
|
|
2978
|
-
multiple:
|
|
2979
|
-
allowCreate:
|
|
2980
|
-
error:
|
|
2980
|
+
searchable: c.searchable,
|
|
2981
|
+
multiple: c.multiple,
|
|
2982
|
+
allowCreate: c.allowCreate,
|
|
2983
|
+
error: L,
|
|
2981
2984
|
size: l
|
|
2982
2985
|
}
|
|
2983
2986
|
);
|
|
@@ -2985,35 +2988,35 @@ const rr = ({
|
|
|
2985
2988
|
return /* @__PURE__ */ e(
|
|
2986
2989
|
ge,
|
|
2987
2990
|
{
|
|
2988
|
-
...
|
|
2991
|
+
...M,
|
|
2989
2992
|
checked: !!y,
|
|
2990
|
-
onChange: (
|
|
2993
|
+
onChange: (E) => A(c.name, E.target.checked),
|
|
2991
2994
|
size: l
|
|
2992
2995
|
}
|
|
2993
2996
|
);
|
|
2994
2997
|
case "radio":
|
|
2995
|
-
return /* @__PURE__ */ e("div", { className: "space-y-1", children:
|
|
2998
|
+
return /* @__PURE__ */ e("div", { className: "space-y-1", children: c.options?.map((E) => /* @__PURE__ */ d("label", { className: "flex items-center gap-2", children: [
|
|
2996
2999
|
/* @__PURE__ */ e(
|
|
2997
3000
|
"input",
|
|
2998
3001
|
{
|
|
2999
3002
|
type: "radio",
|
|
3000
|
-
name:
|
|
3001
|
-
value:
|
|
3002
|
-
checked: y ===
|
|
3003
|
-
onChange: () =>
|
|
3004
|
-
disabled:
|
|
3003
|
+
name: c.name,
|
|
3004
|
+
value: E.value,
|
|
3005
|
+
checked: y === E.value,
|
|
3006
|
+
onChange: () => A(c.name, E.value),
|
|
3007
|
+
disabled: S || E.disabled,
|
|
3005
3008
|
className: "rounded-full border-neutral-100 dark:border-neutral-600"
|
|
3006
3009
|
}
|
|
3007
3010
|
),
|
|
3008
|
-
/* @__PURE__ */ e(
|
|
3009
|
-
] },
|
|
3011
|
+
/* @__PURE__ */ e(Y, { variant: "label", size: "sm", children: E.label })
|
|
3012
|
+
] }, E.value)) });
|
|
3010
3013
|
case "date":
|
|
3011
3014
|
return /* @__PURE__ */ e(
|
|
3012
3015
|
ye,
|
|
3013
3016
|
{
|
|
3014
|
-
...
|
|
3017
|
+
...M,
|
|
3015
3018
|
value: y ? new Date(y) : null,
|
|
3016
|
-
onChange: (
|
|
3019
|
+
onChange: (E) => A(c.name, E),
|
|
3017
3020
|
size: l
|
|
3018
3021
|
}
|
|
3019
3022
|
);
|
|
@@ -3021,66 +3024,66 @@ const rr = ({
|
|
|
3021
3024
|
return /* @__PURE__ */ e(
|
|
3022
3025
|
Lt,
|
|
3023
3026
|
{
|
|
3024
|
-
...
|
|
3027
|
+
...M,
|
|
3025
3028
|
value: y,
|
|
3026
|
-
onChange: (
|
|
3027
|
-
error:
|
|
3028
|
-
onListFiles: (
|
|
3029
|
+
onChange: (E) => A(c.name, E),
|
|
3030
|
+
error: L,
|
|
3031
|
+
onListFiles: (E) => C?.http.invoke({
|
|
3029
3032
|
method: "POST",
|
|
3030
3033
|
action: "storage.file.list",
|
|
3031
|
-
body:
|
|
3034
|
+
body: E
|
|
3032
3035
|
}),
|
|
3033
|
-
onListMounts: () =>
|
|
3036
|
+
onListMounts: () => C?.http.invoke({
|
|
3034
3037
|
method: "GET",
|
|
3035
3038
|
action: "storage.mount"
|
|
3036
3039
|
}),
|
|
3037
|
-
onUploadFile: (
|
|
3040
|
+
onUploadFile: (E) => C?.http.invoke({
|
|
3038
3041
|
method: "POST",
|
|
3039
3042
|
action: "storage.file.upload",
|
|
3040
|
-
body:
|
|
3043
|
+
body: E
|
|
3041
3044
|
}),
|
|
3042
|
-
onDownloadFile: (
|
|
3045
|
+
onDownloadFile: (E) => C?.http.invoke({
|
|
3043
3046
|
method: "GET",
|
|
3044
|
-
action: `storage.file.${
|
|
3047
|
+
action: `storage.file.${E}.download`
|
|
3045
3048
|
}),
|
|
3046
|
-
onRegisterFile: (
|
|
3049
|
+
onRegisterFile: (E) => C?.http.invoke({
|
|
3047
3050
|
method: "POST",
|
|
3048
3051
|
action: "storage.file.folder",
|
|
3049
|
-
body:
|
|
3052
|
+
body: E
|
|
3050
3053
|
})
|
|
3051
3054
|
}
|
|
3052
3055
|
);
|
|
3053
3056
|
case "custom":
|
|
3054
|
-
return
|
|
3057
|
+
return c.customComponent?.({
|
|
3055
3058
|
value: y,
|
|
3056
|
-
onChange: (
|
|
3057
|
-
error:
|
|
3058
|
-
disabled:
|
|
3059
|
+
onChange: (E) => A(c.name, E),
|
|
3060
|
+
error: L,
|
|
3061
|
+
disabled: S
|
|
3059
3062
|
});
|
|
3060
3063
|
case "array": {
|
|
3061
|
-
const
|
|
3064
|
+
const E = y || [];
|
|
3062
3065
|
let Q = [];
|
|
3063
|
-
if (typeof
|
|
3066
|
+
if (typeof L == "string" && L.startsWith("["))
|
|
3064
3067
|
try {
|
|
3065
|
-
Q = JSON.parse(
|
|
3068
|
+
Q = JSON.parse(L);
|
|
3066
3069
|
} catch {
|
|
3067
3070
|
}
|
|
3068
3071
|
const re = () => {
|
|
3069
|
-
|
|
3070
|
-
},
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3072
|
+
A(c.name, [...E, {}]);
|
|
3073
|
+
}, X = (I) => {
|
|
3074
|
+
A(
|
|
3075
|
+
c.name,
|
|
3076
|
+
E.filter((z, D) => D !== I)
|
|
3074
3077
|
);
|
|
3075
|
-
},
|
|
3076
|
-
const ee = [...
|
|
3077
|
-
ee[
|
|
3078
|
-
...ee[
|
|
3079
|
-
[
|
|
3080
|
-
},
|
|
3078
|
+
}, $ = (I, z, D) => {
|
|
3079
|
+
const ee = [...E];
|
|
3080
|
+
ee[I] = {
|
|
3081
|
+
...ee[I],
|
|
3082
|
+
[z]: D
|
|
3083
|
+
}, A(c.name, ee);
|
|
3081
3084
|
};
|
|
3082
3085
|
return /* @__PURE__ */ d("div", { className: "space-y-2", children: [
|
|
3083
|
-
|
|
3086
|
+
E.map((I, z) => /* @__PURE__ */ d(
|
|
3084
3087
|
"div",
|
|
3085
3088
|
{
|
|
3086
3089
|
className: "p-4 border rounded-md dark:border-neutral-700 space-y-2 relative",
|
|
@@ -3091,39 +3094,39 @@ const rr = ({
|
|
|
3091
3094
|
type: "button",
|
|
3092
3095
|
variant: "ghost",
|
|
3093
3096
|
size: "sm",
|
|
3094
|
-
onClick: () =>
|
|
3095
|
-
disabled:
|
|
3097
|
+
onClick: () => X(z),
|
|
3098
|
+
disabled: S,
|
|
3096
3099
|
children: "Remove"
|
|
3097
3100
|
}
|
|
3098
3101
|
) }),
|
|
3099
|
-
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children:
|
|
3100
|
-
const ee = Q?.[
|
|
3102
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: c.arrayFields?.map((D) => {
|
|
3103
|
+
const ee = Q?.[z]?.[D.name];
|
|
3101
3104
|
return /* @__PURE__ */ d(
|
|
3102
3105
|
"div",
|
|
3103
3106
|
{
|
|
3104
3107
|
className: "space-y-1",
|
|
3105
3108
|
children: [
|
|
3106
3109
|
/* @__PURE__ */ e("label", { className: "block", children: /* @__PURE__ */ d(
|
|
3107
|
-
|
|
3110
|
+
Y,
|
|
3108
3111
|
{
|
|
3109
3112
|
variant: "label",
|
|
3110
3113
|
size: "sm",
|
|
3111
3114
|
className: "font-semibold text-neutral-700 dark:text-neutral-300",
|
|
3112
3115
|
children: [
|
|
3113
|
-
|
|
3114
|
-
|
|
3116
|
+
D.label,
|
|
3117
|
+
D.required && /* @__PURE__ */ e("span", { className: "text-red-500 ml-1", children: "*" })
|
|
3115
3118
|
]
|
|
3116
3119
|
}
|
|
3117
3120
|
) }),
|
|
3118
3121
|
(() => {
|
|
3119
3122
|
const ne = {
|
|
3120
|
-
value:
|
|
3121
|
-
disabled:
|
|
3122
|
-
required:
|
|
3123
|
-
placeholder:
|
|
3124
|
-
...
|
|
3123
|
+
value: I?.[D.name] || "",
|
|
3124
|
+
disabled: S,
|
|
3125
|
+
required: D.required,
|
|
3126
|
+
placeholder: D.placeholder,
|
|
3127
|
+
...D.fieldProps
|
|
3125
3128
|
};
|
|
3126
|
-
switch (
|
|
3129
|
+
switch (D.type) {
|
|
3127
3130
|
case "text":
|
|
3128
3131
|
case "email":
|
|
3129
3132
|
case "password":
|
|
@@ -3134,13 +3137,13 @@ const rr = ({
|
|
|
3134
3137
|
ue,
|
|
3135
3138
|
{
|
|
3136
3139
|
...ne,
|
|
3137
|
-
onChange: (G) =>
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
+
onChange: (G) => $(
|
|
3141
|
+
z,
|
|
3142
|
+
D.name,
|
|
3140
3143
|
G.target.value
|
|
3141
3144
|
),
|
|
3142
|
-
type:
|
|
3143
|
-
autoComplete:
|
|
3145
|
+
type: D.textType || D.type,
|
|
3146
|
+
autoComplete: D.autocomplete,
|
|
3144
3147
|
error: ee,
|
|
3145
3148
|
size: l
|
|
3146
3149
|
}
|
|
@@ -3150,9 +3153,9 @@ const rr = ({
|
|
|
3150
3153
|
Ne,
|
|
3151
3154
|
{
|
|
3152
3155
|
...ne,
|
|
3153
|
-
onChange: (G) =>
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
+
onChange: (G) => $(
|
|
3157
|
+
z,
|
|
3158
|
+
D.name,
|
|
3156
3159
|
G.target.value
|
|
3157
3160
|
),
|
|
3158
3161
|
rows: 4,
|
|
@@ -3165,20 +3168,20 @@ const rr = ({
|
|
|
3165
3168
|
ve,
|
|
3166
3169
|
{
|
|
3167
3170
|
...ne,
|
|
3168
|
-
onChange: (G) =>
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
+
onChange: (G) => $(
|
|
3172
|
+
z,
|
|
3173
|
+
D.name,
|
|
3171
3174
|
G
|
|
3172
3175
|
),
|
|
3173
|
-
options: (
|
|
3176
|
+
options: (D.options || []).map(
|
|
3174
3177
|
(G) => ({
|
|
3175
3178
|
...G,
|
|
3176
3179
|
value: String(G.value)
|
|
3177
3180
|
})
|
|
3178
3181
|
),
|
|
3179
|
-
searchable:
|
|
3180
|
-
multiple:
|
|
3181
|
-
allowCreate:
|
|
3182
|
+
searchable: D.searchable,
|
|
3183
|
+
multiple: D.multiple,
|
|
3184
|
+
allowCreate: D.allowCreate,
|
|
3182
3185
|
error: ee,
|
|
3183
3186
|
size: l
|
|
3184
3187
|
}
|
|
@@ -3188,17 +3191,17 @@ const rr = ({
|
|
|
3188
3191
|
ge,
|
|
3189
3192
|
{
|
|
3190
3193
|
...ne,
|
|
3191
|
-
checked: !!
|
|
3192
|
-
onChange: (G) =>
|
|
3193
|
-
|
|
3194
|
-
|
|
3194
|
+
checked: !!I?.[D.name],
|
|
3195
|
+
onChange: (G) => $(
|
|
3196
|
+
z,
|
|
3197
|
+
D.name,
|
|
3195
3198
|
G.target.checked
|
|
3196
3199
|
),
|
|
3197
3200
|
size: l
|
|
3198
3201
|
}
|
|
3199
3202
|
);
|
|
3200
3203
|
case "radio":
|
|
3201
|
-
return /* @__PURE__ */ e("div", { className: "space-y-1", children:
|
|
3204
|
+
return /* @__PURE__ */ e("div", { className: "space-y-1", children: D.options?.map((G) => /* @__PURE__ */ d(
|
|
3202
3205
|
"label",
|
|
3203
3206
|
{
|
|
3204
3207
|
className: "flex items-center gap-2",
|
|
@@ -3207,33 +3210,33 @@ const rr = ({
|
|
|
3207
3210
|
"input",
|
|
3208
3211
|
{
|
|
3209
3212
|
type: "radio",
|
|
3210
|
-
name: `${
|
|
3213
|
+
name: `${c.name}.${z}.${D.name}`,
|
|
3211
3214
|
value: G.value,
|
|
3212
|
-
checked:
|
|
3213
|
-
onChange: () =>
|
|
3214
|
-
|
|
3215
|
-
|
|
3215
|
+
checked: I?.[D.name] === G.value,
|
|
3216
|
+
onChange: () => $(
|
|
3217
|
+
z,
|
|
3218
|
+
D.name,
|
|
3216
3219
|
G.value
|
|
3217
3220
|
),
|
|
3218
|
-
disabled:
|
|
3221
|
+
disabled: S || G.disabled,
|
|
3219
3222
|
className: "rounded-full border-neutral-100 dark:border-neutral-600"
|
|
3220
3223
|
}
|
|
3221
3224
|
),
|
|
3222
|
-
/* @__PURE__ */ e(
|
|
3225
|
+
/* @__PURE__ */ e(Y, { variant: "label", size: "sm", children: G.label })
|
|
3223
3226
|
]
|
|
3224
3227
|
},
|
|
3225
3228
|
G.value
|
|
3226
3229
|
)) });
|
|
3227
3230
|
case "date": {
|
|
3228
|
-
const G =
|
|
3231
|
+
const G = I?.[D.name];
|
|
3229
3232
|
return /* @__PURE__ */ e(
|
|
3230
3233
|
ye,
|
|
3231
3234
|
{
|
|
3232
3235
|
...ne,
|
|
3233
3236
|
value: G ? new Date(G) : null,
|
|
3234
|
-
onChange: (le) =>
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
+
onChange: (le) => $(
|
|
3238
|
+
z,
|
|
3239
|
+
D.name,
|
|
3237
3240
|
le
|
|
3238
3241
|
),
|
|
3239
3242
|
size: l
|
|
@@ -3241,27 +3244,27 @@ const rr = ({
|
|
|
3241
3244
|
);
|
|
3242
3245
|
}
|
|
3243
3246
|
case "custom":
|
|
3244
|
-
return
|
|
3245
|
-
value:
|
|
3246
|
-
onChange: (G) =>
|
|
3247
|
-
|
|
3248
|
-
|
|
3247
|
+
return D.customComponent?.({
|
|
3248
|
+
value: I?.[D.name],
|
|
3249
|
+
onChange: (G) => $(
|
|
3250
|
+
z,
|
|
3251
|
+
D.name,
|
|
3249
3252
|
G
|
|
3250
3253
|
),
|
|
3251
3254
|
error: ee,
|
|
3252
|
-
disabled:
|
|
3255
|
+
disabled: S
|
|
3253
3256
|
});
|
|
3254
3257
|
// Add other field types here as needed
|
|
3255
3258
|
default:
|
|
3256
3259
|
return /* @__PURE__ */ d("p", { children: [
|
|
3257
3260
|
"Unsupported field type in array:",
|
|
3258
3261
|
" ",
|
|
3259
|
-
|
|
3262
|
+
D.type
|
|
3260
3263
|
] });
|
|
3261
3264
|
}
|
|
3262
3265
|
})(),
|
|
3263
3266
|
ee && /* @__PURE__ */ e(
|
|
3264
|
-
|
|
3267
|
+
Y,
|
|
3265
3268
|
{
|
|
3266
3269
|
variant: "body",
|
|
3267
3270
|
size: "sm",
|
|
@@ -3271,12 +3274,12 @@ const rr = ({
|
|
|
3271
3274
|
)
|
|
3272
3275
|
]
|
|
3273
3276
|
},
|
|
3274
|
-
|
|
3277
|
+
D.name
|
|
3275
3278
|
);
|
|
3276
3279
|
}) })
|
|
3277
3280
|
]
|
|
3278
3281
|
},
|
|
3279
|
-
|
|
3282
|
+
z
|
|
3280
3283
|
)),
|
|
3281
3284
|
/* @__PURE__ */ d(
|
|
3282
3285
|
te,
|
|
@@ -3285,10 +3288,10 @@ const rr = ({
|
|
|
3285
3288
|
variant: "outline",
|
|
3286
3289
|
size: "sm",
|
|
3287
3290
|
onClick: re,
|
|
3288
|
-
disabled:
|
|
3291
|
+
disabled: S,
|
|
3289
3292
|
children: [
|
|
3290
3293
|
"Add ",
|
|
3291
|
-
|
|
3294
|
+
c.label
|
|
3292
3295
|
]
|
|
3293
3296
|
}
|
|
3294
3297
|
)
|
|
@@ -3298,26 +3301,26 @@ const rr = ({
|
|
|
3298
3301
|
return null;
|
|
3299
3302
|
}
|
|
3300
3303
|
},
|
|
3301
|
-
[
|
|
3302
|
-
),
|
|
3303
|
-
(
|
|
3304
|
-
if (
|
|
3304
|
+
[v, P, N, u, l, A]
|
|
3305
|
+
), V = ae(
|
|
3306
|
+
(c) => {
|
|
3307
|
+
if (c.conditional && !c.conditional(v))
|
|
3305
3308
|
return null;
|
|
3306
|
-
const y =
|
|
3309
|
+
const y = c.items.filter((S) => !(S.hidden || S.conditional && !S.conditional(v)));
|
|
3307
3310
|
if (y.length === 0) return null;
|
|
3308
|
-
const
|
|
3311
|
+
const L = x(
|
|
3309
3312
|
"space-y-2",
|
|
3310
3313
|
{
|
|
3311
|
-
"grid gap-2":
|
|
3312
|
-
"flex flex-wrap gap-2":
|
|
3314
|
+
"grid gap-2": c.layout === "grid",
|
|
3315
|
+
"flex flex-wrap gap-2": c.layout === "flex"
|
|
3313
3316
|
},
|
|
3314
|
-
|
|
3315
|
-
"grid-cols-1": !
|
|
3316
|
-
"grid-cols-2":
|
|
3317
|
-
"grid-cols-3":
|
|
3318
|
-
"grid-cols-4":
|
|
3317
|
+
c.layout === "grid" && {
|
|
3318
|
+
"grid-cols-1": !c.columns || c.columns === 1,
|
|
3319
|
+
"grid-cols-2": c.columns === 2,
|
|
3320
|
+
"grid-cols-3": c.columns === 3,
|
|
3321
|
+
"grid-cols-4": c.columns === 4
|
|
3319
3322
|
},
|
|
3320
|
-
|
|
3323
|
+
c.className
|
|
3321
3324
|
);
|
|
3322
3325
|
return /* @__PURE__ */ d(
|
|
3323
3326
|
"div",
|
|
@@ -3326,58 +3329,58 @@ const rr = ({
|
|
|
3326
3329
|
children: [
|
|
3327
3330
|
/* @__PURE__ */ d("div", { className: "md:col-span-1", children: [
|
|
3328
3331
|
/* @__PURE__ */ e(
|
|
3329
|
-
|
|
3332
|
+
Y,
|
|
3330
3333
|
{
|
|
3331
3334
|
variant: "label",
|
|
3332
3335
|
size: "lg",
|
|
3333
3336
|
weight: "semibold",
|
|
3334
3337
|
className: "text-neutral-900 dark:text-neutral-100",
|
|
3335
|
-
children:
|
|
3338
|
+
children: c.title
|
|
3336
3339
|
}
|
|
3337
3340
|
),
|
|
3338
|
-
|
|
3339
|
-
|
|
3341
|
+
c.description && /* @__PURE__ */ e(
|
|
3342
|
+
Y,
|
|
3340
3343
|
{
|
|
3341
3344
|
variant: "body",
|
|
3342
3345
|
size: "sm",
|
|
3343
3346
|
className: "text-neutral-600 dark:text-neutral-400 mt-1",
|
|
3344
|
-
children:
|
|
3347
|
+
children: c.description
|
|
3345
3348
|
}
|
|
3346
3349
|
)
|
|
3347
3350
|
] }),
|
|
3348
|
-
/* @__PURE__ */ e("div", { className: "md:col-span-2", children: /* @__PURE__ */ e("div", { className:
|
|
3351
|
+
/* @__PURE__ */ e("div", { className: "md:col-span-2", children: /* @__PURE__ */ e("div", { className: L, children: y.map((S) => (P[S.name] && N[S.name], /* @__PURE__ */ d(
|
|
3349
3352
|
"div",
|
|
3350
3353
|
{
|
|
3351
3354
|
className: x(
|
|
3352
3355
|
"space-y-1",
|
|
3353
|
-
|
|
3354
|
-
|
|
3356
|
+
S.width && typeof S.width == "string" && `w-[${S.width}]`,
|
|
3357
|
+
S.width && typeof S.width == "number" && `col-span-${S.width}`
|
|
3355
3358
|
),
|
|
3356
3359
|
children: [
|
|
3357
|
-
|
|
3358
|
-
|
|
3360
|
+
S.type !== "custom" && /* @__PURE__ */ e("label", { className: "block", children: /* @__PURE__ */ d(
|
|
3361
|
+
Y,
|
|
3359
3362
|
{
|
|
3360
3363
|
variant: "label",
|
|
3361
3364
|
size: "sm",
|
|
3362
3365
|
className: "font-medium text-neutral-700 dark:text-neutral-300",
|
|
3363
3366
|
children: [
|
|
3364
|
-
|
|
3365
|
-
|
|
3367
|
+
S.label,
|
|
3368
|
+
S.required && /* @__PURE__ */ e("span", { className: "text-red-500 ml-1", children: "*" })
|
|
3366
3369
|
]
|
|
3367
3370
|
}
|
|
3368
3371
|
) }),
|
|
3369
|
-
|
|
3372
|
+
T(S)
|
|
3370
3373
|
]
|
|
3371
3374
|
},
|
|
3372
|
-
|
|
3375
|
+
S.name
|
|
3373
3376
|
))) }) })
|
|
3374
3377
|
]
|
|
3375
3378
|
},
|
|
3376
|
-
|
|
3379
|
+
c.id
|
|
3377
3380
|
);
|
|
3378
3381
|
},
|
|
3379
|
-
[
|
|
3380
|
-
),
|
|
3382
|
+
[v, P, N, T]
|
|
3383
|
+
), W = x(
|
|
3381
3384
|
"space-y-6",
|
|
3382
3385
|
{
|
|
3383
3386
|
"max-w-md": l === "sm",
|
|
@@ -3387,9 +3390,9 @@ const rr = ({
|
|
|
3387
3390
|
},
|
|
3388
3391
|
h
|
|
3389
3392
|
);
|
|
3390
|
-
return /* @__PURE__ */ d("form", { ref:
|
|
3391
|
-
/* @__PURE__ */ e("div", { className: "space-y-8", children: t.map(
|
|
3392
|
-
|
|
3393
|
+
return /* @__PURE__ */ d("form", { ref: k, onSubmit: H, className: W, children: [
|
|
3394
|
+
/* @__PURE__ */ e("div", { className: "space-y-8", children: t.map(V) }),
|
|
3395
|
+
b && /* @__PURE__ */ d("div", { className: x("flex gap-3 justify-end pt-8"), children: [
|
|
3393
3396
|
n && /* @__PURE__ */ e(
|
|
3394
3397
|
te,
|
|
3395
3398
|
{
|
|
@@ -3406,12 +3409,12 @@ const rr = ({
|
|
|
3406
3409
|
te,
|
|
3407
3410
|
{
|
|
3408
3411
|
type: "submit",
|
|
3409
|
-
variant:
|
|
3410
|
-
size:
|
|
3411
|
-
disabled:
|
|
3412
|
+
variant: g.variant,
|
|
3413
|
+
size: g.size || l,
|
|
3414
|
+
disabled: g.disabled || u,
|
|
3412
3415
|
loading: u,
|
|
3413
|
-
className:
|
|
3414
|
-
children:
|
|
3416
|
+
className: g.className,
|
|
3417
|
+
children: g.label
|
|
3415
3418
|
}
|
|
3416
3419
|
)
|
|
3417
3420
|
] })
|
|
@@ -3428,7 +3431,7 @@ const rr = ({
|
|
|
3428
3431
|
sm: "px-2 py-0.5 text-xs",
|
|
3429
3432
|
md: "px-2.5 py-1 text-sm",
|
|
3430
3433
|
lg: "px-3 py-1.5 text-base"
|
|
3431
|
-
},
|
|
3434
|
+
}, Tt = {
|
|
3432
3435
|
default: "bg-neutral-fill",
|
|
3433
3436
|
primary: "bg-accent-fill",
|
|
3434
3437
|
secondary: "bg-neutral-fill",
|
|
@@ -3443,9 +3446,9 @@ function nr({
|
|
|
3443
3446
|
dot: r = !1,
|
|
3444
3447
|
icon: n,
|
|
3445
3448
|
dismissible: s = !1,
|
|
3446
|
-
onDismiss:
|
|
3447
|
-
className:
|
|
3448
|
-
children:
|
|
3449
|
+
onDismiss: i,
|
|
3450
|
+
className: m,
|
|
3451
|
+
children: g,
|
|
3449
3452
|
...p
|
|
3450
3453
|
}) {
|
|
3451
3454
|
return /* @__PURE__ */ d(
|
|
@@ -3458,7 +3461,7 @@ function nr({
|
|
|
3458
3461
|
$t[t],
|
|
3459
3462
|
// Size styles
|
|
3460
3463
|
zt[a],
|
|
3461
|
-
|
|
3464
|
+
m
|
|
3462
3465
|
),
|
|
3463
3466
|
...p,
|
|
3464
3467
|
children: [
|
|
@@ -3467,16 +3470,16 @@ function nr({
|
|
|
3467
3470
|
{
|
|
3468
3471
|
className: x(
|
|
3469
3472
|
"w-2 h-2 rounded-full mr-1.5",
|
|
3470
|
-
|
|
3473
|
+
Tt[t]
|
|
3471
3474
|
)
|
|
3472
3475
|
}
|
|
3473
3476
|
),
|
|
3474
|
-
n && /* @__PURE__ */ e("span", { className: x("flex-shrink-0",
|
|
3475
|
-
|
|
3476
|
-
s &&
|
|
3477
|
+
n && /* @__PURE__ */ e("span", { className: x("flex-shrink-0", g && "mr-1"), children: n }),
|
|
3478
|
+
g,
|
|
3479
|
+
s && i && /* @__PURE__ */ e(
|
|
3477
3480
|
"button",
|
|
3478
3481
|
{
|
|
3479
|
-
onClick:
|
|
3482
|
+
onClick: i,
|
|
3480
3483
|
className: "ml-1.5 flex-shrink-0 hover:opacity-70 transition-opacity",
|
|
3481
3484
|
"aria-label": "Remove badge",
|
|
3482
3485
|
children: /* @__PURE__ */ e("svg", { className: "h-3 w-3", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ e(
|
|
@@ -3493,7 +3496,7 @@ function nr({
|
|
|
3493
3496
|
}
|
|
3494
3497
|
);
|
|
3495
3498
|
}
|
|
3496
|
-
const
|
|
3499
|
+
const Dt = {
|
|
3497
3500
|
xs: "h-3 w-3",
|
|
3498
3501
|
sm: "h-4 w-4",
|
|
3499
3502
|
md: "h-6 w-6",
|
|
@@ -3517,7 +3520,7 @@ function ar({
|
|
|
3517
3520
|
label: r = "Loading...",
|
|
3518
3521
|
showLabel: n = !1,
|
|
3519
3522
|
className: s,
|
|
3520
|
-
...
|
|
3523
|
+
...i
|
|
3521
3524
|
}) {
|
|
3522
3525
|
return /* @__PURE__ */ d(
|
|
3523
3526
|
"div",
|
|
@@ -3527,14 +3530,14 @@ function ar({
|
|
|
3527
3530
|
n ? "flex-col space-y-2" : "",
|
|
3528
3531
|
s
|
|
3529
3532
|
),
|
|
3530
|
-
...
|
|
3533
|
+
...i,
|
|
3531
3534
|
children: [
|
|
3532
3535
|
/* @__PURE__ */ d(
|
|
3533
3536
|
"svg",
|
|
3534
3537
|
{
|
|
3535
3538
|
className: x(
|
|
3536
3539
|
"animate-spin",
|
|
3537
|
-
|
|
3540
|
+
Dt[t],
|
|
3538
3541
|
At[a]
|
|
3539
3542
|
),
|
|
3540
3543
|
fill: "none",
|
|
@@ -3585,24 +3588,24 @@ const lr = ({
|
|
|
3585
3588
|
size: r = "md",
|
|
3586
3589
|
aspectRatio: n = "auto",
|
|
3587
3590
|
radius: s = "md",
|
|
3588
|
-
showLoading:
|
|
3589
|
-
showError:
|
|
3590
|
-
fallback:
|
|
3591
|
+
showLoading: i = !0,
|
|
3592
|
+
showError: m = !0,
|
|
3593
|
+
fallback: g,
|
|
3591
3594
|
loadingContent: p,
|
|
3592
|
-
errorContent:
|
|
3593
|
-
className:
|
|
3595
|
+
errorContent: b,
|
|
3596
|
+
className: f,
|
|
3594
3597
|
onLoad: l,
|
|
3595
3598
|
onError: u,
|
|
3596
3599
|
...h
|
|
3597
3600
|
}) => {
|
|
3598
|
-
const [
|
|
3599
|
-
|
|
3600
|
-
}, U = (
|
|
3601
|
-
if (
|
|
3602
|
-
q(
|
|
3601
|
+
const [k, C] = O(!0), [v, j] = O(!1), [N, q] = O(t), P = (W) => {
|
|
3602
|
+
C(!1), j(!1), l?.(W);
|
|
3603
|
+
}, U = (W) => {
|
|
3604
|
+
if (C(!1), j(!0), g && N !== g) {
|
|
3605
|
+
q(g), j(!1), C(!0);
|
|
3603
3606
|
return;
|
|
3604
3607
|
}
|
|
3605
|
-
u?.(
|
|
3608
|
+
u?.(W);
|
|
3606
3609
|
}, F = x(
|
|
3607
3610
|
"relative overflow-hidden bg-neutral-100 dark:bg-neutral-800",
|
|
3608
3611
|
// Size variants
|
|
@@ -3630,17 +3633,17 @@ const lr = ({
|
|
|
3630
3633
|
"rounded-xl": s === "xl",
|
|
3631
3634
|
"rounded-full": s === "full"
|
|
3632
3635
|
},
|
|
3633
|
-
|
|
3634
|
-
),
|
|
3636
|
+
f
|
|
3637
|
+
), A = x(
|
|
3635
3638
|
"w-full h-full object-cover transition-opacity duration-200",
|
|
3636
3639
|
{
|
|
3637
|
-
"opacity-0":
|
|
3638
|
-
"opacity-100": !
|
|
3640
|
+
"opacity-0": k || v,
|
|
3641
|
+
"opacity-100": !k && !v
|
|
3639
3642
|
}
|
|
3640
|
-
),
|
|
3643
|
+
), H = x(
|
|
3641
3644
|
"absolute inset-0 flex items-center justify-center",
|
|
3642
3645
|
"text-neutral-400 dark:text-neutral-500"
|
|
3643
|
-
),
|
|
3646
|
+
), T = /* @__PURE__ */ e("div", { className: "animate-pulse", children: /* @__PURE__ */ e("div", { className: "w-6 h-6 bg-neutral-300 dark:bg-neutral-600 rounded" }) }), V = /* @__PURE__ */ d("div", { className: "text-center", children: [
|
|
3644
3647
|
/* @__PURE__ */ e(
|
|
3645
3648
|
"svg",
|
|
3646
3649
|
{
|
|
@@ -3666,15 +3669,15 @@ const lr = ({
|
|
|
3666
3669
|
"img",
|
|
3667
3670
|
{
|
|
3668
3671
|
...h,
|
|
3669
|
-
src:
|
|
3672
|
+
src: N,
|
|
3670
3673
|
alt: a,
|
|
3671
|
-
className:
|
|
3672
|
-
onLoad:
|
|
3674
|
+
className: A,
|
|
3675
|
+
onLoad: P,
|
|
3673
3676
|
onError: U
|
|
3674
3677
|
}
|
|
3675
3678
|
),
|
|
3676
|
-
|
|
3677
|
-
|
|
3679
|
+
k && i && /* @__PURE__ */ e("div", { className: H, children: p || T }),
|
|
3680
|
+
v && m && /* @__PURE__ */ e("div", { className: H, children: b || V })
|
|
3678
3681
|
] });
|
|
3679
3682
|
}, sr = ({
|
|
3680
3683
|
title: t,
|
|
@@ -3682,24 +3685,24 @@ const lr = ({
|
|
|
3682
3685
|
actions: r = [],
|
|
3683
3686
|
children: n,
|
|
3684
3687
|
className: s,
|
|
3685
|
-
backLabel:
|
|
3686
|
-
backClassName:
|
|
3687
|
-
onBack:
|
|
3688
|
+
backLabel: i = "Back",
|
|
3689
|
+
backClassName: m,
|
|
3690
|
+
onBack: g,
|
|
3688
3691
|
editable: p = !1,
|
|
3689
|
-
onTitleChange:
|
|
3692
|
+
onTitleChange: b
|
|
3690
3693
|
}) => {
|
|
3691
|
-
const [
|
|
3694
|
+
const [f, l] = O(!1), [u, h] = O(t), k = Z(null);
|
|
3692
3695
|
K(() => {
|
|
3693
3696
|
h(t);
|
|
3694
3697
|
}, [t]), K(() => {
|
|
3695
|
-
|
|
3696
|
-
}, [
|
|
3697
|
-
const
|
|
3698
|
+
f && k.current && (k.current.focus(), k.current.select());
|
|
3699
|
+
}, [f]);
|
|
3700
|
+
const C = () => {
|
|
3698
3701
|
p && l(!0);
|
|
3699
|
-
},
|
|
3700
|
-
l(!1), u.trim() !== "" && u !== t &&
|
|
3701
|
-
},
|
|
3702
|
-
|
|
3702
|
+
}, v = () => {
|
|
3703
|
+
l(!1), u.trim() !== "" && u !== t && b ? b(u.trim()) : h(t);
|
|
3704
|
+
}, j = (N) => {
|
|
3705
|
+
N.key === "Enter" ? k.current?.blur() : N.key === "Escape" && (h(t), l(!1));
|
|
3703
3706
|
};
|
|
3704
3707
|
return /* @__PURE__ */ d(
|
|
3705
3708
|
"div",
|
|
@@ -3711,34 +3714,34 @@ const lr = ({
|
|
|
3711
3714
|
children: [
|
|
3712
3715
|
/* @__PURE__ */ d("div", { className: "flex flex-row sm:items-start sm:justify-between items-center gap-4", children: [
|
|
3713
3716
|
/* @__PURE__ */ e("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ d("div", { className: "flex items-center gap-2 text-default", children: [
|
|
3714
|
-
|
|
3717
|
+
g && /* @__PURE__ */ e(
|
|
3715
3718
|
"button",
|
|
3716
3719
|
{
|
|
3717
3720
|
type: "button",
|
|
3718
|
-
onClick:
|
|
3721
|
+
onClick: g,
|
|
3719
3722
|
className: x(
|
|
3720
3723
|
"flex items-center text-sm cursor-pointer transition",
|
|
3721
|
-
|
|
3724
|
+
m
|
|
3722
3725
|
),
|
|
3723
3726
|
children: /* @__PURE__ */ e(we, { size: 16, color: "currentColor" })
|
|
3724
3727
|
}
|
|
3725
3728
|
),
|
|
3726
|
-
|
|
3729
|
+
f ? /* @__PURE__ */ e(
|
|
3727
3730
|
"input",
|
|
3728
3731
|
{
|
|
3729
|
-
ref:
|
|
3732
|
+
ref: k,
|
|
3730
3733
|
type: "text",
|
|
3731
3734
|
value: u,
|
|
3732
|
-
onChange: (
|
|
3733
|
-
onBlur:
|
|
3734
|
-
onKeyDown:
|
|
3735
|
+
onChange: (N) => h(N.target.value),
|
|
3736
|
+
onBlur: v,
|
|
3737
|
+
onKeyDown: j,
|
|
3735
3738
|
className: "text-1xl font-semibold bg-transparent border-b-1 border-neutral rounded-lg outline-none focus:border-none px-1 -mx-1 min-w-0 flex-1"
|
|
3736
3739
|
}
|
|
3737
3740
|
) : /* @__PURE__ */ d("div", { className: "group flex items-center gap-1.5 min-w-0", children: [
|
|
3738
3741
|
/* @__PURE__ */ e(
|
|
3739
3742
|
"h2",
|
|
3740
3743
|
{
|
|
3741
|
-
onClick:
|
|
3744
|
+
onClick: C,
|
|
3742
3745
|
className: x(
|
|
3743
3746
|
"text-2xl font-semibold truncate",
|
|
3744
3747
|
p && "cursor-pointer"
|
|
@@ -3751,44 +3754,44 @@ const lr = ({
|
|
|
3751
3754
|
Re,
|
|
3752
3755
|
{
|
|
3753
3756
|
size: 15,
|
|
3754
|
-
onClick:
|
|
3757
|
+
onClick: C,
|
|
3755
3758
|
className: "shrink-0 cursor-pointer text-muted opacity-0 group-hover:opacity-100 transition-opacity"
|
|
3756
3759
|
}
|
|
3757
3760
|
)
|
|
3758
3761
|
] })
|
|
3759
3762
|
] }) }),
|
|
3760
3763
|
r.length > 0 && /* @__PURE__ */ e("div", { className: "flex flex-wrap sm:flex-nowrap gap-2 sm:gap-3", children: r.map(
|
|
3761
|
-
(
|
|
3764
|
+
(N) => N.splitOptions && N.splitOptions.length > 0 ? /* @__PURE__ */ e(
|
|
3762
3765
|
ze,
|
|
3763
3766
|
{
|
|
3764
|
-
label:
|
|
3765
|
-
onClick:
|
|
3766
|
-
icon:
|
|
3767
|
-
variant:
|
|
3768
|
-
options:
|
|
3769
|
-
disabled:
|
|
3767
|
+
label: N.label,
|
|
3768
|
+
onClick: N.onClick,
|
|
3769
|
+
icon: N.icon,
|
|
3770
|
+
variant: N.variant === "primary" ? "primary" : "secondary",
|
|
3771
|
+
options: N.splitOptions,
|
|
3772
|
+
disabled: N.disabled
|
|
3770
3773
|
},
|
|
3771
|
-
|
|
3774
|
+
N.id
|
|
3772
3775
|
) : /* @__PURE__ */ d(
|
|
3773
3776
|
"button",
|
|
3774
3777
|
{
|
|
3775
3778
|
type: "button",
|
|
3776
3779
|
onClick: (q) => {
|
|
3777
|
-
q.stopPropagation(), q.target.blur(),
|
|
3780
|
+
q.stopPropagation(), q.target.blur(), N.onClick();
|
|
3778
3781
|
},
|
|
3779
|
-
disabled:
|
|
3782
|
+
disabled: N.disabled,
|
|
3780
3783
|
className: x("btn", {
|
|
3781
|
-
o__primary:
|
|
3782
|
-
o__secondary:
|
|
3783
|
-
o__ghost:
|
|
3784
|
-
o__destructive:
|
|
3784
|
+
o__primary: N.variant === "primary",
|
|
3785
|
+
o__secondary: N.variant === "secondary" || N.variant === "outline",
|
|
3786
|
+
o__ghost: N.variant === "ghost",
|
|
3787
|
+
o__destructive: N.variant === "destructive"
|
|
3785
3788
|
}),
|
|
3786
3789
|
children: [
|
|
3787
|
-
|
|
3788
|
-
|
|
3790
|
+
N.icon && /* @__PURE__ */ e("span", { className: "mr-2", children: N.icon }),
|
|
3791
|
+
N.label
|
|
3789
3792
|
]
|
|
3790
3793
|
},
|
|
3791
|
-
|
|
3794
|
+
N.id
|
|
3792
3795
|
)
|
|
3793
3796
|
) })
|
|
3794
3797
|
] }),
|
|
@@ -3817,37 +3820,37 @@ const lr = ({
|
|
|
3817
3820
|
),
|
|
3818
3821
|
s && /* @__PURE__ */ e("div", { className: "flex-1 min-w-0", children: s }),
|
|
3819
3822
|
t.length > 0 && /* @__PURE__ */ e("div", { className: x("flex flex-wrap gap-2", !s && "ml-auto"), children: t.map(
|
|
3820
|
-
(
|
|
3823
|
+
(i) => i.splitOptions && i.splitOptions.length > 0 ? /* @__PURE__ */ e(
|
|
3821
3824
|
ze,
|
|
3822
3825
|
{
|
|
3823
|
-
label:
|
|
3824
|
-
onClick:
|
|
3825
|
-
icon:
|
|
3826
|
-
variant:
|
|
3827
|
-
options:
|
|
3828
|
-
disabled:
|
|
3826
|
+
label: i.label,
|
|
3827
|
+
onClick: i.onClick,
|
|
3828
|
+
icon: i.icon,
|
|
3829
|
+
variant: i.variant === "primary" ? "primary" : "secondary",
|
|
3830
|
+
options: i.splitOptions,
|
|
3831
|
+
disabled: i.disabled
|
|
3829
3832
|
},
|
|
3830
|
-
|
|
3833
|
+
i.id
|
|
3831
3834
|
) : /* @__PURE__ */ d(
|
|
3832
3835
|
"button",
|
|
3833
3836
|
{
|
|
3834
3837
|
type: "button",
|
|
3835
|
-
onClick: (
|
|
3836
|
-
|
|
3838
|
+
onClick: (m) => {
|
|
3839
|
+
m.stopPropagation(), m.target.blur(), i.onClick();
|
|
3837
3840
|
},
|
|
3838
|
-
disabled:
|
|
3841
|
+
disabled: i.disabled,
|
|
3839
3842
|
className: x("btn", {
|
|
3840
|
-
o__primary:
|
|
3841
|
-
o__secondary:
|
|
3842
|
-
o__ghost:
|
|
3843
|
-
o__destructive:
|
|
3843
|
+
o__primary: i.variant === "primary",
|
|
3844
|
+
o__secondary: i.variant === "secondary" || i.variant === "outline",
|
|
3845
|
+
o__ghost: i.variant === "ghost",
|
|
3846
|
+
o__destructive: i.variant === "destructive"
|
|
3844
3847
|
}),
|
|
3845
3848
|
children: [
|
|
3846
|
-
|
|
3847
|
-
|
|
3849
|
+
i.icon && /* @__PURE__ */ e("span", { className: "mr-2", children: i.icon }),
|
|
3850
|
+
i.label
|
|
3848
3851
|
]
|
|
3849
3852
|
},
|
|
3850
|
-
|
|
3853
|
+
i.id
|
|
3851
3854
|
)
|
|
3852
3855
|
) })
|
|
3853
3856
|
] });
|
|
@@ -3863,118 +3866,118 @@ const cr = ({
|
|
|
3863
3866
|
size: r = "md",
|
|
3864
3867
|
className: n
|
|
3865
3868
|
}) => {
|
|
3866
|
-
const s = (
|
|
3867
|
-
if (!
|
|
3869
|
+
const s = (f) => {
|
|
3870
|
+
if (!f) return "-";
|
|
3868
3871
|
try {
|
|
3869
|
-
return new Date(
|
|
3872
|
+
return new Date(f).toLocaleDateString("nl-NL", {
|
|
3870
3873
|
year: "numeric",
|
|
3871
3874
|
month: "long",
|
|
3872
3875
|
day: "numeric"
|
|
3873
3876
|
});
|
|
3874
3877
|
} catch {
|
|
3875
|
-
return String(
|
|
3878
|
+
return String(f);
|
|
3876
3879
|
}
|
|
3877
|
-
},
|
|
3878
|
-
if (!l) return String(
|
|
3879
|
-
const u = l.find((h) => h.value ===
|
|
3880
|
-
return u ? u.label : String(
|
|
3881
|
-
},
|
|
3882
|
-
(
|
|
3883
|
-
const l = jt(a,
|
|
3884
|
-
if (
|
|
3880
|
+
}, i = (f) => f ? "Ja" : "Nee", m = (f, l) => {
|
|
3881
|
+
if (!l) return String(f || "-");
|
|
3882
|
+
const u = l.find((h) => h.value === f);
|
|
3883
|
+
return u ? u.label : String(f || "-");
|
|
3884
|
+
}, g = ae(
|
|
3885
|
+
(f) => {
|
|
3886
|
+
const l = jt(a, f.name);
|
|
3887
|
+
if (f.type === "array") {
|
|
3885
3888
|
const h = l;
|
|
3886
3889
|
return !h || h.length === 0 ? /* @__PURE__ */ e(
|
|
3887
|
-
|
|
3890
|
+
Y,
|
|
3888
3891
|
{
|
|
3889
3892
|
variant: "body",
|
|
3890
3893
|
size: "sm",
|
|
3891
3894
|
className: "text-neutral-500 dark:text-neutral-400",
|
|
3892
3895
|
children: "Geen items"
|
|
3893
3896
|
}
|
|
3894
|
-
) : /* @__PURE__ */ e("div", { className: "space-y-3", children: h.map((
|
|
3897
|
+
) : /* @__PURE__ */ e("div", { className: "space-y-3", children: h.map((k, C) => /* @__PURE__ */ d(
|
|
3895
3898
|
"div",
|
|
3896
3899
|
{
|
|
3897
3900
|
className: "p-4 border border-neutral-200 dark:border-neutral-700 rounded-lg space-y-3",
|
|
3898
3901
|
children: [
|
|
3899
3902
|
/* @__PURE__ */ e("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ d(
|
|
3900
|
-
|
|
3903
|
+
Y,
|
|
3901
3904
|
{
|
|
3902
3905
|
variant: "label",
|
|
3903
3906
|
size: "sm",
|
|
3904
3907
|
weight: "medium",
|
|
3905
3908
|
className: "text-neutral-700 dark:text-neutral-300",
|
|
3906
3909
|
children: [
|
|
3907
|
-
|
|
3910
|
+
f.label,
|
|
3908
3911
|
" ",
|
|
3909
|
-
|
|
3912
|
+
C + 1
|
|
3910
3913
|
]
|
|
3911
3914
|
}
|
|
3912
3915
|
) }),
|
|
3913
|
-
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children:
|
|
3914
|
-
const
|
|
3915
|
-
let
|
|
3916
|
-
switch (
|
|
3916
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: f.arrayFields?.map((v) => {
|
|
3917
|
+
const j = k?.[v.name];
|
|
3918
|
+
let N = "-";
|
|
3919
|
+
switch (v.type) {
|
|
3917
3920
|
case "text":
|
|
3918
3921
|
case "email":
|
|
3919
3922
|
case "number":
|
|
3920
3923
|
case "tel":
|
|
3921
3924
|
case "url":
|
|
3922
3925
|
case "textarea":
|
|
3923
|
-
|
|
3926
|
+
N = j || "-";
|
|
3924
3927
|
break;
|
|
3925
3928
|
case "select":
|
|
3926
3929
|
case "radio":
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
+
N = m(
|
|
3931
|
+
j,
|
|
3932
|
+
v.options
|
|
3930
3933
|
);
|
|
3931
3934
|
break;
|
|
3932
3935
|
case "checkbox":
|
|
3933
|
-
|
|
3936
|
+
N = i(j);
|
|
3934
3937
|
break;
|
|
3935
3938
|
case "date":
|
|
3936
|
-
|
|
3939
|
+
N = s(j);
|
|
3937
3940
|
break;
|
|
3938
3941
|
case "custom":
|
|
3939
|
-
|
|
3940
|
-
value:
|
|
3942
|
+
N = v.customComponent?.({
|
|
3943
|
+
value: j
|
|
3941
3944
|
});
|
|
3942
3945
|
break;
|
|
3943
3946
|
default:
|
|
3944
|
-
|
|
3947
|
+
N = String(j || "-");
|
|
3945
3948
|
}
|
|
3946
|
-
return
|
|
3949
|
+
return v.format && (N = v.format(j, k)), /* @__PURE__ */ d("div", { className: "space-y-1", children: [
|
|
3947
3950
|
/* @__PURE__ */ e(
|
|
3948
|
-
|
|
3951
|
+
Y,
|
|
3949
3952
|
{
|
|
3950
3953
|
variant: "label",
|
|
3951
3954
|
size: "xs",
|
|
3952
3955
|
className: "text-neutral-600 dark:text-neutral-400",
|
|
3953
|
-
children:
|
|
3956
|
+
children: v.label
|
|
3954
3957
|
}
|
|
3955
3958
|
),
|
|
3956
3959
|
/* @__PURE__ */ e(
|
|
3957
|
-
|
|
3960
|
+
Y,
|
|
3958
3961
|
{
|
|
3959
3962
|
variant: "body",
|
|
3960
3963
|
size: "sm",
|
|
3961
3964
|
className: "text-neutral-900 dark:text-neutral-100",
|
|
3962
|
-
children:
|
|
3965
|
+
children: N
|
|
3963
3966
|
}
|
|
3964
3967
|
)
|
|
3965
|
-
] },
|
|
3968
|
+
] }, v.name);
|
|
3966
3969
|
}) })
|
|
3967
3970
|
]
|
|
3968
3971
|
},
|
|
3969
|
-
|
|
3972
|
+
C
|
|
3970
3973
|
)) });
|
|
3971
3974
|
}
|
|
3972
|
-
if (
|
|
3973
|
-
return
|
|
3974
|
-
if (
|
|
3975
|
-
const h =
|
|
3975
|
+
if (f.type === "custom" && f.customComponent)
|
|
3976
|
+
return f.customComponent({ value: l });
|
|
3977
|
+
if (f.format) {
|
|
3978
|
+
const h = f.format(l, a);
|
|
3976
3979
|
return /* @__PURE__ */ e(
|
|
3977
|
-
|
|
3980
|
+
Y,
|
|
3978
3981
|
{
|
|
3979
3982
|
variant: "body",
|
|
3980
3983
|
size: "sm",
|
|
@@ -3984,7 +3987,7 @@ const cr = ({
|
|
|
3984
3987
|
);
|
|
3985
3988
|
}
|
|
3986
3989
|
let u = "-";
|
|
3987
|
-
switch (
|
|
3990
|
+
switch (f.type) {
|
|
3988
3991
|
case "text":
|
|
3989
3992
|
case "email":
|
|
3990
3993
|
case "password":
|
|
@@ -3998,10 +4001,10 @@ const cr = ({
|
|
|
3998
4001
|
break;
|
|
3999
4002
|
case "select":
|
|
4000
4003
|
case "radio":
|
|
4001
|
-
u =
|
|
4004
|
+
u = m(l, f.options);
|
|
4002
4005
|
break;
|
|
4003
4006
|
case "checkbox":
|
|
4004
|
-
u =
|
|
4007
|
+
u = i(l);
|
|
4005
4008
|
break;
|
|
4006
4009
|
case "date":
|
|
4007
4010
|
u = s(l);
|
|
@@ -4010,7 +4013,7 @@ const cr = ({
|
|
|
4010
4013
|
u = l ? String(l) : "-";
|
|
4011
4014
|
}
|
|
4012
4015
|
return /* @__PURE__ */ e(
|
|
4013
|
-
|
|
4016
|
+
Y,
|
|
4014
4017
|
{
|
|
4015
4018
|
variant: "body",
|
|
4016
4019
|
size: "sm",
|
|
@@ -4021,24 +4024,24 @@ const cr = ({
|
|
|
4021
4024
|
},
|
|
4022
4025
|
[a]
|
|
4023
4026
|
), p = ae(
|
|
4024
|
-
(
|
|
4025
|
-
if (
|
|
4027
|
+
(f) => {
|
|
4028
|
+
if (f.conditional && !f.conditional(a))
|
|
4026
4029
|
return null;
|
|
4027
|
-
const l =
|
|
4030
|
+
const l = f.items.filter((h) => !(h.hidden || h.conditional && !h.conditional(a)));
|
|
4028
4031
|
if (l.length === 0) return null;
|
|
4029
4032
|
const u = x(
|
|
4030
4033
|
"space-y-4",
|
|
4031
4034
|
{
|
|
4032
|
-
"grid gap-4":
|
|
4033
|
-
"flex flex-wrap gap-4":
|
|
4035
|
+
"grid gap-4": f.layout === "grid",
|
|
4036
|
+
"flex flex-wrap gap-4": f.layout === "flex"
|
|
4034
4037
|
},
|
|
4035
|
-
|
|
4036
|
-
"grid-cols-1": !
|
|
4037
|
-
"grid-cols-2":
|
|
4038
|
-
"grid-cols-3":
|
|
4039
|
-
"grid-cols-4":
|
|
4038
|
+
f.layout === "grid" && {
|
|
4039
|
+
"grid-cols-1": !f.columns || f.columns === 1,
|
|
4040
|
+
"grid-cols-2": f.columns === 2,
|
|
4041
|
+
"grid-cols-3": f.columns === 3,
|
|
4042
|
+
"grid-cols-4": f.columns === 4
|
|
4040
4043
|
},
|
|
4041
|
-
|
|
4044
|
+
f.className
|
|
4042
4045
|
);
|
|
4043
4046
|
return /* @__PURE__ */ d(
|
|
4044
4047
|
"div",
|
|
@@ -4047,22 +4050,22 @@ const cr = ({
|
|
|
4047
4050
|
children: [
|
|
4048
4051
|
/* @__PURE__ */ d("div", { className: "md:col-span-1", children: [
|
|
4049
4052
|
/* @__PURE__ */ e(
|
|
4050
|
-
|
|
4053
|
+
Y,
|
|
4051
4054
|
{
|
|
4052
4055
|
variant: "label",
|
|
4053
4056
|
size: "lg",
|
|
4054
4057
|
weight: "semibold",
|
|
4055
4058
|
className: "text-neutral-900 dark:text-neutral-100",
|
|
4056
|
-
children:
|
|
4059
|
+
children: f.title
|
|
4057
4060
|
}
|
|
4058
4061
|
),
|
|
4059
|
-
|
|
4060
|
-
|
|
4062
|
+
f.description && /* @__PURE__ */ e(
|
|
4063
|
+
Y,
|
|
4061
4064
|
{
|
|
4062
4065
|
variant: "body",
|
|
4063
4066
|
size: "sm",
|
|
4064
4067
|
className: "text-neutral-600 dark:text-neutral-400 mt-1",
|
|
4065
|
-
children:
|
|
4068
|
+
children: f.description
|
|
4066
4069
|
}
|
|
4067
4070
|
)
|
|
4068
4071
|
] }),
|
|
@@ -4076,7 +4079,7 @@ const cr = ({
|
|
|
4076
4079
|
),
|
|
4077
4080
|
children: [
|
|
4078
4081
|
h.type !== "custom" && /* @__PURE__ */ e(
|
|
4079
|
-
|
|
4082
|
+
Y,
|
|
4080
4083
|
{
|
|
4081
4084
|
variant: "label",
|
|
4082
4085
|
size: "sm",
|
|
@@ -4084,18 +4087,18 @@ const cr = ({
|
|
|
4084
4087
|
children: h.label
|
|
4085
4088
|
}
|
|
4086
4089
|
),
|
|
4087
|
-
|
|
4090
|
+
g(h)
|
|
4088
4091
|
]
|
|
4089
4092
|
},
|
|
4090
4093
|
h.name
|
|
4091
4094
|
)) }) })
|
|
4092
4095
|
]
|
|
4093
4096
|
},
|
|
4094
|
-
|
|
4097
|
+
f.id
|
|
4095
4098
|
);
|
|
4096
4099
|
},
|
|
4097
|
-
[a,
|
|
4098
|
-
),
|
|
4100
|
+
[a, g]
|
|
4101
|
+
), b = x(
|
|
4099
4102
|
"space-y-6",
|
|
4100
4103
|
{
|
|
4101
4104
|
"max-w-md": r === "sm",
|
|
@@ -4105,10 +4108,10 @@ const cr = ({
|
|
|
4105
4108
|
},
|
|
4106
4109
|
n
|
|
4107
4110
|
);
|
|
4108
|
-
return /* @__PURE__ */ e("div", { className:
|
|
4109
|
-
},
|
|
4110
|
-
const [
|
|
4111
|
-
|
|
4111
|
+
return /* @__PURE__ */ e("div", { className: b, children: /* @__PURE__ */ e("div", { className: "space-y-8", children: t.map(p) }) });
|
|
4112
|
+
}, De = ({ item: t, isSelectedHandler: a, onClick: r, depth: n = 0 }) => {
|
|
4113
|
+
const [s, i] = O(t.defaultCollapsed ?? !1), m = t.children && t.children.length > 0, g = m && n === 0, p = () => {
|
|
4114
|
+
m && i(!s);
|
|
4112
4115
|
}, b = a ? a(t.path) : !1;
|
|
4113
4116
|
return /* @__PURE__ */ d("li", { children: [
|
|
4114
4117
|
/* @__PURE__ */ d(
|
|
@@ -4117,30 +4120,31 @@ const cr = ({
|
|
|
4117
4120
|
className: x(
|
|
4118
4121
|
"flex flex-row w-full py-1 rounded-lg items-center h-8 transition-colors cursor-pointer px-3 pr-1 no-underline text-sm",
|
|
4119
4122
|
{
|
|
4120
|
-
"active-nav-item": b && !
|
|
4121
|
-
"shadow-lvl-0": b && !
|
|
4122
|
-
"font-semibold": b ||
|
|
4123
|
+
"active-nav-item": b && !m,
|
|
4124
|
+
"shadow-lvl-0": b && !m,
|
|
4125
|
+
"font-semibold": b || g
|
|
4123
4126
|
}
|
|
4124
4127
|
),
|
|
4125
4128
|
onClick: () => {
|
|
4126
|
-
|
|
4129
|
+
m ? p() : t.path && r?.(t.path);
|
|
4127
4130
|
},
|
|
4128
4131
|
children: [
|
|
4129
|
-
t.icon && /* @__PURE__ */ e("span", { className: "mr-2", children: t.icon }),
|
|
4130
|
-
/* @__PURE__ */ e("span", { className: "flex-1", children: t.label }),
|
|
4132
|
+
t.icon && /* @__PURE__ */ e("span", { className: "mr-2 shrink-0", children: t.icon }),
|
|
4133
|
+
/* @__PURE__ */ e("span", { className: "flex-1 min-w-0 truncate", children: t.label }),
|
|
4131
4134
|
t.count !== void 0 && t.count > 0 && /* @__PURE__ */ e("span", { className: "ml-2 mr-1.5", children: t.count }),
|
|
4132
|
-
|
|
4135
|
+
m && /* @__PURE__ */ e("span", { className: `${s ? "collapsed" : ""}`, children: /* @__PURE__ */ e(He, { className: "w-4 h-4 text-muted" }) })
|
|
4133
4136
|
]
|
|
4134
4137
|
}
|
|
4135
4138
|
),
|
|
4136
|
-
|
|
4137
|
-
|
|
4139
|
+
m && !s && /* @__PURE__ */ e("ul", { className: "sidebar-menu-nested-items mb-1", children: t.children?.map((f, l) => /* @__PURE__ */ e(
|
|
4140
|
+
De,
|
|
4138
4141
|
{
|
|
4139
|
-
item:
|
|
4142
|
+
item: f,
|
|
4140
4143
|
isSelectedHandler: a,
|
|
4141
|
-
onClick: r
|
|
4144
|
+
onClick: r,
|
|
4145
|
+
depth: n + 1
|
|
4142
4146
|
},
|
|
4143
|
-
|
|
4147
|
+
l
|
|
4144
4148
|
)) })
|
|
4145
4149
|
] });
|
|
4146
4150
|
}, ir = ({
|
|
@@ -4149,22 +4153,22 @@ const cr = ({
|
|
|
4149
4153
|
items: r,
|
|
4150
4154
|
isSelectedHandler: n,
|
|
4151
4155
|
onClick: s,
|
|
4152
|
-
preMenuItemsComponent:
|
|
4156
|
+
preMenuItemsComponent: i
|
|
4153
4157
|
}) => /* @__PURE__ */ d("div", { className: "flex flex-col h-screen mb-6", children: [
|
|
4154
4158
|
/* @__PURE__ */ d("div", { className: "sidebar-menu-header", children: [
|
|
4155
4159
|
/* @__PURE__ */ e("span", { className: "text-xl font-semibold text-default mb-2", children: t }),
|
|
4156
|
-
/* @__PURE__ */ e("div", { className: "sidebar-menu-actions", children: a?.map((
|
|
4160
|
+
/* @__PURE__ */ e("div", { className: "sidebar-menu-actions", children: a?.map((m, g) => /* @__PURE__ */ e("span", { className: "sidebar-menu-action-icon", children: m }, g)) })
|
|
4157
4161
|
] }),
|
|
4158
|
-
|
|
4162
|
+
i && /* @__PURE__ */ e("div", { className: "sidebar-menu-pre-items mb-4", children: i }),
|
|
4159
4163
|
/* @__PURE__ */ e("ul", { children: r.map(
|
|
4160
|
-
(
|
|
4161
|
-
|
|
4164
|
+
(m, g) => !m.path && !m.label && !m.children ? /* @__PURE__ */ e("span", { className: "flex w-full h-4" }, g) : /* @__PURE__ */ e(
|
|
4165
|
+
De,
|
|
4162
4166
|
{
|
|
4163
|
-
item:
|
|
4167
|
+
item: m,
|
|
4164
4168
|
isSelectedHandler: n,
|
|
4165
4169
|
onClick: s
|
|
4166
4170
|
},
|
|
4167
|
-
|
|
4171
|
+
g
|
|
4168
4172
|
)
|
|
4169
4173
|
) })
|
|
4170
4174
|
] }), dr = ({
|
|
@@ -4173,23 +4177,23 @@ const cr = ({
|
|
|
4173
4177
|
weight: r = "bold",
|
|
4174
4178
|
color: n = "current",
|
|
4175
4179
|
align: s = "left",
|
|
4176
|
-
truncate:
|
|
4177
|
-
className:
|
|
4178
|
-
children:
|
|
4180
|
+
truncate: i = !1,
|
|
4181
|
+
className: m,
|
|
4182
|
+
children: g,
|
|
4179
4183
|
...p
|
|
4180
4184
|
}) => {
|
|
4181
|
-
const
|
|
4185
|
+
const b = a || Bt(t), f = x(
|
|
4182
4186
|
"font-primary",
|
|
4183
4187
|
// Size variants
|
|
4184
4188
|
{
|
|
4185
|
-
"text-xs":
|
|
4186
|
-
"text-sm":
|
|
4187
|
-
"text-base":
|
|
4188
|
-
"text-lg":
|
|
4189
|
-
"text-xl":
|
|
4190
|
-
"text-2xl":
|
|
4191
|
-
"text-3xl":
|
|
4192
|
-
"text-4xl":
|
|
4189
|
+
"text-xs": b === "xs",
|
|
4190
|
+
"text-sm": b === "sm",
|
|
4191
|
+
"text-base": b === "md",
|
|
4192
|
+
"text-lg": b === "lg",
|
|
4193
|
+
"text-xl": b === "xl",
|
|
4194
|
+
"text-2xl": b === "2xl",
|
|
4195
|
+
"text-3xl": b === "3xl",
|
|
4196
|
+
"text-4xl": b === "4xl"
|
|
4193
4197
|
},
|
|
4194
4198
|
// Weight variants
|
|
4195
4199
|
{
|
|
@@ -4219,11 +4223,11 @@ const cr = ({
|
|
|
4219
4223
|
},
|
|
4220
4224
|
// Truncation
|
|
4221
4225
|
{
|
|
4222
|
-
truncate:
|
|
4226
|
+
truncate: i
|
|
4223
4227
|
},
|
|
4224
|
-
|
|
4228
|
+
m
|
|
4225
4229
|
), l = `h${t}`;
|
|
4226
|
-
return /* @__PURE__ */ e(l, { className:
|
|
4230
|
+
return /* @__PURE__ */ e(l, { className: f, ...p, children: g });
|
|
4227
4231
|
};
|
|
4228
4232
|
function Bt(t) {
|
|
4229
4233
|
return {
|
|
@@ -4241,10 +4245,10 @@ const ur = ({
|
|
|
4241
4245
|
variant: r = "default",
|
|
4242
4246
|
size: n = "md",
|
|
4243
4247
|
interactive: s = !1,
|
|
4244
|
-
className:
|
|
4245
|
-
itemClassName:
|
|
4248
|
+
className: i,
|
|
4249
|
+
itemClassName: m
|
|
4246
4250
|
}) => {
|
|
4247
|
-
const
|
|
4251
|
+
const g = x(
|
|
4248
4252
|
// Base styles
|
|
4249
4253
|
"space-y-1",
|
|
4250
4254
|
// Variant styles
|
|
@@ -4264,7 +4268,7 @@ const ur = ({
|
|
|
4264
4268
|
"text-base": n === "md",
|
|
4265
4269
|
"text-lg": n === "lg"
|
|
4266
4270
|
},
|
|
4267
|
-
|
|
4271
|
+
i
|
|
4268
4272
|
), p = (l, u) => x(
|
|
4269
4273
|
// Base item styles
|
|
4270
4274
|
"transition-colors duration-200",
|
|
@@ -4283,40 +4287,40 @@ const ur = ({
|
|
|
4283
4287
|
l.disabled && {
|
|
4284
4288
|
"opacity-50 cursor-not-allowed": !0
|
|
4285
4289
|
},
|
|
4286
|
-
|
|
4287
|
-
),
|
|
4290
|
+
m
|
|
4291
|
+
), b = (l) => {
|
|
4288
4292
|
s && !l.disabled && l.onClick && l.onClick();
|
|
4289
|
-
},
|
|
4293
|
+
}, f = (l, u) => {
|
|
4290
4294
|
s && !u.disabled && (l.key === "Enter" || l.key === " ") && (l.preventDefault(), u.onClick?.());
|
|
4291
4295
|
};
|
|
4292
|
-
return a === "ordered" ? /* @__PURE__ */ e("ol", { className:
|
|
4296
|
+
return a === "ordered" ? /* @__PURE__ */ e("ol", { className: g, children: t.map((l, u) => /* @__PURE__ */ e(
|
|
4293
4297
|
"li",
|
|
4294
4298
|
{
|
|
4295
4299
|
className: p(l),
|
|
4296
|
-
onClick: () =>
|
|
4297
|
-
onKeyDown: (h) =>
|
|
4300
|
+
onClick: () => b(l),
|
|
4301
|
+
onKeyDown: (h) => f(h, l),
|
|
4298
4302
|
tabIndex: s && !l.disabled ? 0 : void 0,
|
|
4299
4303
|
role: s ? "button" : void 0,
|
|
4300
4304
|
children: l.content
|
|
4301
4305
|
},
|
|
4302
4306
|
l.id || u
|
|
4303
|
-
)) }) : a === "description" ? /* @__PURE__ */ e("dl", { className:
|
|
4307
|
+
)) }) : a === "description" ? /* @__PURE__ */ e("dl", { className: g, children: t.map((l, u) => /* @__PURE__ */ e(
|
|
4304
4308
|
"div",
|
|
4305
4309
|
{
|
|
4306
4310
|
className: p(l),
|
|
4307
|
-
onClick: () =>
|
|
4308
|
-
onKeyDown: (h) =>
|
|
4311
|
+
onClick: () => b(l),
|
|
4312
|
+
onKeyDown: (h) => f(h, l),
|
|
4309
4313
|
tabIndex: s && !l.disabled ? 0 : void 0,
|
|
4310
4314
|
role: s ? "button" : void 0,
|
|
4311
4315
|
children: l.content
|
|
4312
4316
|
},
|
|
4313
4317
|
l.id || u
|
|
4314
|
-
)) }) : /* @__PURE__ */ e("ul", { className:
|
|
4318
|
+
)) }) : /* @__PURE__ */ e("ul", { className: g, children: t.map((l, u) => /* @__PURE__ */ e(
|
|
4315
4319
|
"li",
|
|
4316
4320
|
{
|
|
4317
4321
|
className: p(l),
|
|
4318
|
-
onClick: () =>
|
|
4319
|
-
onKeyDown: (h) =>
|
|
4322
|
+
onClick: () => b(l),
|
|
4323
|
+
onKeyDown: (h) => f(h, l),
|
|
4320
4324
|
tabIndex: s && !l.disabled ? 0 : void 0,
|
|
4321
4325
|
role: s ? "button" : void 0,
|
|
4322
4326
|
children: l.content
|
|
@@ -4329,42 +4333,42 @@ const ur = ({
|
|
|
4329
4333
|
onClose: r,
|
|
4330
4334
|
labels: n,
|
|
4331
4335
|
initialCommandPath: s,
|
|
4332
|
-
initialActiveIndex:
|
|
4336
|
+
initialActiveIndex: i
|
|
4333
4337
|
}) => {
|
|
4334
|
-
const [
|
|
4335
|
-
(
|
|
4338
|
+
const [m, g] = O(""), [p, b] = O(s || []), [f, l] = O(i || 0), u = Z(null), h = Z(null), C = (p.length ? t.find((v) => v.id === p[0])?.subCommands || [] : t).filter(
|
|
4339
|
+
(v) => v.label.toLowerCase().includes(m.toLowerCase())
|
|
4336
4340
|
);
|
|
4337
4341
|
return K(() => {
|
|
4338
|
-
a || (
|
|
4342
|
+
a || (g(""), b(s || []), l(i || 0));
|
|
4339
4343
|
}, [a]), K(() => {
|
|
4340
|
-
const
|
|
4344
|
+
const v = (j) => {
|
|
4341
4345
|
if (a) {
|
|
4342
|
-
if (
|
|
4346
|
+
if (j.key === "Escape")
|
|
4343
4347
|
r();
|
|
4344
|
-
else if (
|
|
4348
|
+
else if (j.key === "ArrowUp")
|
|
4345
4349
|
l(
|
|
4346
|
-
(
|
|
4350
|
+
(N) => N > 0 ? N - 1 : C.length - 1
|
|
4347
4351
|
);
|
|
4348
|
-
else if (
|
|
4352
|
+
else if (j.key === "ArrowDown")
|
|
4349
4353
|
l(
|
|
4350
|
-
(
|
|
4354
|
+
(N) => N < C.length - 1 ? N + 1 : 0
|
|
4351
4355
|
);
|
|
4352
|
-
else if (
|
|
4353
|
-
const
|
|
4354
|
-
|
|
4356
|
+
else if (j.key === "Enter") {
|
|
4357
|
+
const N = C[f];
|
|
4358
|
+
N && (N.subCommands ? (b([...p, N.id]), l(0)) : N.action && (N.action(), r()));
|
|
4355
4359
|
}
|
|
4356
4360
|
}
|
|
4357
4361
|
};
|
|
4358
|
-
return document.addEventListener("keydown",
|
|
4359
|
-
}, [a, r,
|
|
4360
|
-
const
|
|
4361
|
-
u.current && !u.current.contains(
|
|
4362
|
+
return document.addEventListener("keydown", v), () => document.removeEventListener("keydown", v);
|
|
4363
|
+
}, [a, r, C, f, p]), K(() => {
|
|
4364
|
+
const v = (j) => {
|
|
4365
|
+
u.current && !u.current.contains(j.target) && r();
|
|
4362
4366
|
};
|
|
4363
|
-
return a && document.addEventListener("mousedown",
|
|
4367
|
+
return a && document.addEventListener("mousedown", v), () => document.removeEventListener("mousedown", v);
|
|
4364
4368
|
}, [a, r]), K(() => {
|
|
4365
4369
|
if (!a) return;
|
|
4366
|
-
h.current?.querySelector(`[data-index="${
|
|
4367
|
-
}, [
|
|
4370
|
+
h.current?.querySelector(`[data-index="${f}"]`)?.scrollIntoView({ block: "nearest" });
|
|
4371
|
+
}, [f, a]), a ? /* @__PURE__ */ e("div", { className: "fixed inset-0 z-50 flex items-center justify-center shadow-lvl-0", children: /* @__PURE__ */ d(
|
|
4368
4372
|
"div",
|
|
4369
4373
|
{
|
|
4370
4374
|
className: "flex flex-col w-full max-w-lg max-h-[80vh] p-2 mx-auto rounded-xl border border-neutral shadow-lg bg-module",
|
|
@@ -4378,8 +4382,8 @@ const ur = ({
|
|
|
4378
4382
|
type: "text",
|
|
4379
4383
|
autoFocus: !0,
|
|
4380
4384
|
placeholder: n?.searchPlaceholder || "Search commands...",
|
|
4381
|
-
value:
|
|
4382
|
-
onChange: (
|
|
4385
|
+
value: m,
|
|
4386
|
+
onChange: (v) => g(v.target.value),
|
|
4383
4387
|
className: "w-full py-2 text-default border-0 focus:outline-none focus:ring-0 focus:border-0 focus:shadow-none bg-transparent"
|
|
4384
4388
|
}
|
|
4385
4389
|
)
|
|
@@ -4390,23 +4394,23 @@ const ur = ({
|
|
|
4390
4394
|
ref: h,
|
|
4391
4395
|
className: "mt-2 pt-2 text-sm border-t border-neutral max-h-[50vh] overflow-y-auto",
|
|
4392
4396
|
children: [
|
|
4393
|
-
|
|
4394
|
-
|
|
4397
|
+
C.length === 0 && /* @__PURE__ */ e("div", { className: "text-muted text-center text-sm", children: n?.noCommandsFound || "No commands found" }),
|
|
4398
|
+
C.map((v, j) => /* @__PURE__ */ d(
|
|
4395
4399
|
"div",
|
|
4396
4400
|
{
|
|
4397
|
-
"data-index":
|
|
4398
|
-
className: `flex items-center p-2 cursor-pointer rounded-md text-default ${
|
|
4401
|
+
"data-index": j,
|
|
4402
|
+
className: `flex items-center p-2 cursor-pointer rounded-md text-default ${j === f ? "bg-neutral-container" : ""}`,
|
|
4399
4403
|
onClick: () => {
|
|
4400
|
-
|
|
4404
|
+
v.subCommands ? (b([...p, v.id]), l(0)) : v.action && (v.action(), r());
|
|
4401
4405
|
},
|
|
4402
|
-
onMouseEnter: () => l(
|
|
4406
|
+
onMouseEnter: () => l(j),
|
|
4403
4407
|
children: [
|
|
4404
|
-
|
|
4405
|
-
/* @__PURE__ */ e("span", { className: "flex-grow", children:
|
|
4406
|
-
|
|
4408
|
+
v.icon && /* @__PURE__ */ e("span", { className: "mr-3", children: v.icon }),
|
|
4409
|
+
/* @__PURE__ */ e("span", { className: "flex-grow", children: v.label }),
|
|
4410
|
+
v.subCommands && /* @__PURE__ */ e("span", { className: "text-muted", children: /* @__PURE__ */ e(qe, { className: "w-4 h-4" }) })
|
|
4407
4411
|
]
|
|
4408
4412
|
},
|
|
4409
|
-
|
|
4413
|
+
v.id
|
|
4410
4414
|
))
|
|
4411
4415
|
]
|
|
4412
4416
|
}
|
|
@@ -4496,26 +4500,26 @@ const ur = ({
|
|
|
4496
4500
|
background: r,
|
|
4497
4501
|
radius: n,
|
|
4498
4502
|
shadow: s,
|
|
4499
|
-
border:
|
|
4500
|
-
borderColor:
|
|
4501
|
-
className:
|
|
4503
|
+
border: i,
|
|
4504
|
+
borderColor: m,
|
|
4505
|
+
className: g,
|
|
4502
4506
|
children: p,
|
|
4503
|
-
...
|
|
4504
|
-
},
|
|
4507
|
+
...b
|
|
4508
|
+
}, f) => /* @__PURE__ */ e(
|
|
4505
4509
|
"div",
|
|
4506
4510
|
{
|
|
4507
|
-
ref:
|
|
4511
|
+
ref: f,
|
|
4508
4512
|
className: x(
|
|
4509
4513
|
t && Pt[t],
|
|
4510
4514
|
a && _t[a],
|
|
4511
4515
|
r && Ot[r],
|
|
4512
4516
|
n && Vt[n],
|
|
4513
4517
|
s && Ft[s],
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4518
|
+
i && Wt[i],
|
|
4519
|
+
m && Rt[m],
|
|
4520
|
+
g
|
|
4517
4521
|
),
|
|
4518
|
-
...
|
|
4522
|
+
...b,
|
|
4519
4523
|
children: p
|
|
4520
4524
|
}
|
|
4521
4525
|
)
|
|
@@ -4531,20 +4535,20 @@ function hr({
|
|
|
4531
4535
|
framework: r = "react",
|
|
4532
4536
|
fallback: n,
|
|
4533
4537
|
componentProps: s,
|
|
4534
|
-
className:
|
|
4538
|
+
className: i
|
|
4535
4539
|
}) {
|
|
4536
|
-
const
|
|
4537
|
-
return
|
|
4540
|
+
const m = Z(null), [g, p] = O(!0), [b, f] = O(null), l = Z(null);
|
|
4541
|
+
return Z(null), K(() => {
|
|
4538
4542
|
let u = !0;
|
|
4539
4543
|
return (async () => {
|
|
4540
4544
|
p(!0);
|
|
4541
4545
|
try {
|
|
4542
|
-
const
|
|
4546
|
+
const k = await a();
|
|
4543
4547
|
if (!u) return;
|
|
4544
|
-
const
|
|
4545
|
-
|
|
4546
|
-
} catch (
|
|
4547
|
-
console.error(`[FederatedResource] Load failed: ${t}`,
|
|
4548
|
+
const C = k.component || k.default || k;
|
|
4549
|
+
f(r === "react" ? () => C : () => k);
|
|
4550
|
+
} catch (k) {
|
|
4551
|
+
console.error(`[FederatedResource] Load failed: ${t}`, k);
|
|
4548
4552
|
} finally {
|
|
4549
4553
|
u && p(!1);
|
|
4550
4554
|
}
|
|
@@ -4552,25 +4556,25 @@ function hr({
|
|
|
4552
4556
|
u = !1;
|
|
4553
4557
|
};
|
|
4554
4558
|
}, [t, a]), K(() => {
|
|
4555
|
-
if (
|
|
4556
|
-
const u =
|
|
4559
|
+
if (g || !b || r === "react") return;
|
|
4560
|
+
const u = m.current;
|
|
4557
4561
|
if (u) {
|
|
4558
4562
|
if (r === "svelte") {
|
|
4559
|
-
const h =
|
|
4560
|
-
return l.current =
|
|
4563
|
+
const h = b.default || b, k = new h({ target: u, props: s || {} });
|
|
4564
|
+
return l.current = k, () => k.$destroy();
|
|
4561
4565
|
}
|
|
4562
|
-
if (
|
|
4563
|
-
const h =
|
|
4566
|
+
if (b.mount) {
|
|
4567
|
+
const h = b.mount({ container: u, props: s || {} });
|
|
4564
4568
|
return () => {
|
|
4565
|
-
typeof h == "function" ? h() :
|
|
4569
|
+
typeof h == "function" ? h() : b.unmount?.(u);
|
|
4566
4570
|
};
|
|
4567
4571
|
}
|
|
4568
4572
|
}
|
|
4569
|
-
}, [
|
|
4573
|
+
}, [b, r, g]), K(() => {
|
|
4570
4574
|
r === "svelte" && l.current && l.current.$set?.(s);
|
|
4571
|
-
}, [s, r]), /* @__PURE__ */ d("div", { ref:
|
|
4572
|
-
|
|
4573
|
-
r === "react" &&
|
|
4575
|
+
}, [s, r]), /* @__PURE__ */ d("div", { ref: m, className: i, style: { display: "contents" }, children: [
|
|
4576
|
+
g && n,
|
|
4577
|
+
r === "react" && b && /* @__PURE__ */ e(b, { ...s })
|
|
4574
4578
|
] });
|
|
4575
4579
|
}
|
|
4576
4580
|
class pr extends Ge {
|
|
@@ -4634,7 +4638,7 @@ export {
|
|
|
4634
4638
|
tr as TabBar,
|
|
4635
4639
|
Le as Table,
|
|
4636
4640
|
wt as Tabs,
|
|
4637
|
-
|
|
4641
|
+
Y as Text,
|
|
4638
4642
|
Ne as TextArea,
|
|
4639
4643
|
ue as TextField,
|
|
4640
4644
|
Xt as VideoSurface,
|