@opencxh/ui-kit 3.70.0 → 3.81.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 +760 -757
- 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/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
|
}
|
|
@@ -48,7 +48,7 @@ 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
54
|
const c = t(s.current);
|
|
@@ -308,7 +308,7 @@ function ze({
|
|
|
308
308
|
options: c,
|
|
309
309
|
disabled: f = !1
|
|
310
310
|
}) {
|
|
311
|
-
const [b, p] =
|
|
311
|
+
const [b, p] = O(!1), g = Z(null), m = ae(() => {
|
|
312
312
|
p((l) => !l);
|
|
313
313
|
}, []);
|
|
314
314
|
return K(() => {
|
|
@@ -456,40 +456,40 @@ const et = () => /* @__PURE__ */ e("svg", { className: "h-4 w-4", fill: "none",
|
|
|
456
456
|
maxDate: p,
|
|
457
457
|
format: g = "MM/dd/yyyy"
|
|
458
458
|
}, m) => {
|
|
459
|
-
const [l, u] =
|
|
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
|
|
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"), i = T.getFullYear();
|
|
471
471
|
switch (g) {
|
|
472
472
|
case "dd/MM/yyyy":
|
|
473
|
-
return `${
|
|
473
|
+
return `${V}/${W}/${i}`;
|
|
474
474
|
case "yyyy-MM-dd":
|
|
475
|
-
return `${i}-${
|
|
475
|
+
return `${i}-${W}-${V}`;
|
|
476
476
|
case "MM/dd/yyyy":
|
|
477
477
|
default:
|
|
478
|
-
return `${
|
|
478
|
+
return `${W}/${V}/${i}`;
|
|
479
479
|
}
|
|
480
|
-
},
|
|
481
|
-
const
|
|
482
|
-
i.setDate(i.getDate() -
|
|
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), i = new Date(W);
|
|
482
|
+
i.setDate(i.getDate() - W.getDay());
|
|
483
|
+
const y = [], L = new Date(i);
|
|
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() && (b && T < b || 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(
|
|
@@ -505,7 +505,7 @@ const et = () => /* @__PURE__ */ e("svg", { className: "h-4 w-4", fill: "none",
|
|
|
505
505
|
"px-4 py-3 text-base": c === "full"
|
|
506
506
|
},
|
|
507
507
|
f
|
|
508
|
-
),
|
|
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
527
|
ref: m,
|
|
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(), i = t && T.toDateString() === t.toDateString(), y = T.toDateString() === (/* @__PURE__ */ new Date()).toDateString(), L = !W || b && T < b || 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":
|
|
584
|
+
"text-default hover:bg-neutral-container": W && !i && !L,
|
|
585
585
|
"bg-primary text-white": i,
|
|
586
586
|
"bg-neutral-container text-default": y && !i,
|
|
587
|
-
"text-muted cursor-not-allowed":
|
|
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: [
|
|
@@ -674,54 +674,55 @@ const et = () => /* @__PURE__ */ e("svg", { className: "h-4 w-4", fill: "none",
|
|
|
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 = m || `searchfield-${Math.random().toString(36).substr(2, 9)}`, U = !!r, F = Z(null), A = Z(null), [H, T] = O(v || ""), [V, W] = O(!1), [i, 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 = f || i, $ = V && (M.length > 0 || X), I = de(() => q || A, [q]);
|
|
725
726
|
return /* @__PURE__ */ d(
|
|
726
727
|
"div",
|
|
727
728
|
{
|
|
@@ -731,15 +732,15 @@ const et = () => /* @__PURE__ */ e("svg", { className: "h-4 w-4", fill: "none",
|
|
|
731
732
|
b || "",
|
|
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
|
|
@@ -750,11 +751,11 @@ const et = () => /* @__PURE__ */ e("svg", { className: "h-4 w-4", fill: "none",
|
|
|
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",
|
|
@@ -767,13 +768,13 @@ const et = () => /* @__PURE__ */ e("svg", { className: "h-4 w-4", fill: "none",
|
|
|
767
768
|
"pr-10",
|
|
768
769
|
// Altijd padding rechts voor de dropdown/loading icon
|
|
769
770
|
// State styles
|
|
770
|
-
|
|
771
|
+
U ? "border-red-500 text-error focus:border-red-500 focus:ring-red-500" : "border-neutral text-default",
|
|
771
772
|
g || ""
|
|
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 || f ? (
|
|
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 || f ? "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
|
}
|
|
@@ -879,74 +882,74 @@ const ot = {
|
|
|
879
882
|
searchable: l,
|
|
880
883
|
multiple: u,
|
|
881
884
|
value: h,
|
|
882
|
-
onChange:
|
|
883
|
-
allowCreate:
|
|
884
|
-
onCreateOption:
|
|
885
|
-
...
|
|
886
|
-
},
|
|
887
|
-
const q = m || `select-${Math.random().toString(36).substr(2, 9)}`,
|
|
888
|
-
se.useImperativeHandle(
|
|
889
|
-
const
|
|
890
|
-
|
|
885
|
+
onChange: k,
|
|
886
|
+
allowCreate: C,
|
|
887
|
+
onCreateOption: v,
|
|
888
|
+
...j
|
|
889
|
+
}, N) => {
|
|
890
|
+
const q = m || `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(c);
|
|
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
897
|
const i = se.useCallback(
|
|
895
|
-
(
|
|
896
|
-
(
|
|
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 && (i(
|
|
906
|
+
ne && (i(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
|
[i]
|
|
908
911
|
);
|
|
909
912
|
se.useEffect(() => {
|
|
910
|
-
|
|
911
|
-
const
|
|
912
|
-
return
|
|
913
|
-
!i(
|
|
914
|
-
}), y(
|
|
913
|
+
W(($) => {
|
|
914
|
+
const I = [...c];
|
|
915
|
+
return $.forEach((z) => {
|
|
916
|
+
!i(I, z.value) && !i(I, z.label) && I.push(z);
|
|
917
|
+
}), y(I, h);
|
|
915
918
|
});
|
|
916
919
|
}, [c, h, y, i]);
|
|
917
|
-
const
|
|
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() && !i(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 (i(
|
|
935
|
-
|
|
937
|
+
if (i(V, z.value) || i(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(", ") : f || "Select options" : S?.label || f || "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
|
b
|
|
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
|
-
|
|
980
|
+
P ? "border-error text-error focus:border-error focus:ring-error" : "border-neutral text-default",
|
|
978
981
|
g
|
|
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,10 +1007,10 @@ 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
|
}
|
|
@@ -1018,37 +1021,37 @@ const ot = {
|
|
|
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
1026
|
children: f
|
|
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
|
}
|
|
@@ -1090,7 +1093,7 @@ const ct = {
|
|
|
1090
1093
|
rows: m = 4,
|
|
1091
1094
|
...l
|
|
1092
1095
|
}, u) => {
|
|
1093
|
-
const h = g || `textarea-${Math.random().toString(36).substr(2, 9)}`,
|
|
1096
|
+
const h = g || `textarea-${Math.random().toString(36).substr(2, 9)}`, k = !!r;
|
|
1094
1097
|
return /* @__PURE__ */ d("div", { className: x("flex flex-col", s && "w-full", f), children: [
|
|
1095
1098
|
t && /* @__PURE__ */ e(
|
|
1096
1099
|
"label",
|
|
@@ -1098,7 +1101,7 @@ const ct = {
|
|
|
1098
1101
|
htmlFor: h,
|
|
1099
1102
|
className: x(
|
|
1100
1103
|
"block text-sm font-medium mb-1",
|
|
1101
|
-
|
|
1104
|
+
k ? "text-error" : "text-default",
|
|
1102
1105
|
b
|
|
1103
1106
|
),
|
|
1104
1107
|
children: t
|
|
@@ -1119,7 +1122,7 @@ 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
|
|
@@ -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
|
}
|
|
@@ -1195,15 +1198,15 @@ const it = {
|
|
|
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
|
-
|
|
1209
|
+
C ? "text-error" : "text-default",
|
|
1207
1210
|
g
|
|
1208
1211
|
),
|
|
1209
1212
|
children: t
|
|
@@ -1216,7 +1219,7 @@ const it = {
|
|
|
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",
|
|
@@ -1228,7 +1231,7 @@ const it = {
|
|
|
1228
1231
|
c && "pl-10",
|
|
1229
1232
|
f && "pr-10",
|
|
1230
1233
|
// State styles
|
|
1231
|
-
|
|
1234
|
+
C ? "border-error text-error focus:border-error focus:ring-error" : "border-neutral text-default focus:border-primary focus:ring-primary",
|
|
1232
1235
|
m
|
|
1233
1236
|
),
|
|
1234
1237
|
...u
|
|
@@ -1269,7 +1272,7 @@ const it = {
|
|
|
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
|
}
|
|
@@ -1381,69 +1384,69 @@ const mt = ({
|
|
|
1381
1384
|
showCheck: b = !0,
|
|
1382
1385
|
header: p
|
|
1383
1386
|
}) => {
|
|
1384
|
-
const [g, m] =
|
|
1387
|
+
const [g, m] = 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
1389
|
const i = (y) => {
|
|
1387
|
-
|
|
1390
|
+
j.current && (!j.current.contains(y.target) || q.current && !q.current.contains(y.target)) && (m(!1), u(null), P.current && (clearTimeout(P.current), P.current = null));
|
|
1388
1391
|
};
|
|
1389
1392
|
return g && document.addEventListener("mousedown", i), () => {
|
|
1390
1393
|
document.removeEventListener("mousedown", i);
|
|
1391
1394
|
};
|
|
1392
1395
|
}, [g]), K(() => {
|
|
1393
1396
|
const i = (y) => {
|
|
1394
|
-
y.key === "Escape" && (m(!1), u(null),
|
|
1397
|
+
y.key === "Escape" && (m(!1), u(null), P.current && (clearTimeout(P.current), P.current = null));
|
|
1395
1398
|
};
|
|
1396
1399
|
return g && document.addEventListener("keydown", i), () => {
|
|
1397
1400
|
document.removeEventListener("keydown", i);
|
|
1398
1401
|
};
|
|
1399
1402
|
}, [g]), K(() => {
|
|
1400
|
-
if (l &&
|
|
1401
|
-
const i =
|
|
1403
|
+
if (l && j.current) {
|
|
1404
|
+
const i = j.current.querySelector(
|
|
1402
1405
|
`[data-option-value="${l}"]`
|
|
1403
1406
|
);
|
|
1404
1407
|
if (i) {
|
|
1405
1408
|
const y = i.getBoundingClientRect();
|
|
1406
|
-
|
|
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
1418
|
const U = (i) => {
|
|
1416
1419
|
if (i.stopPropagation(), !c) {
|
|
1417
1420
|
if (!g) {
|
|
1418
|
-
const y =
|
|
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
|
-
m(!g), u(null),
|
|
1427
|
+
m(!g), u(null), P.current && (clearTimeout(P.current), P.current = null);
|
|
1425
1428
|
}
|
|
1426
|
-
}, F = (i, y,
|
|
1427
|
-
i.stopPropagation(), !y.disabled && !y.divider && (!y.children || y.children.length === 0) && (n?.(y.value,
|
|
1428
|
-
},
|
|
1429
|
-
|
|
1430
|
-
},
|
|
1431
|
-
i.children && i.children.length > 0 ?
|
|
1429
|
+
}, F = (i, y, L) => {
|
|
1430
|
+
i.stopPropagation(), !y.disabled && !y.divider && (!y.children || y.children.length === 0) && (n?.(y.value, L), m(!1), u(null));
|
|
1431
|
+
}, A = (i) => {
|
|
1432
|
+
P.current && (clearTimeout(P.current), P.current = null), i.children && i.children.length > 0 ? u(i.value) : u(null);
|
|
1433
|
+
}, H = (i) => {
|
|
1434
|
+
i.children && i.children.length > 0 ? P.current = setTimeout(() => {
|
|
1432
1435
|
u(null);
|
|
1433
1436
|
}, 150) : u(null);
|
|
1434
|
-
},
|
|
1435
|
-
i.stopPropagation(), !y.disabled && !y.divider && (n?.(y.value,
|
|
1436
|
-
},
|
|
1437
|
+
}, T = (i, y, L) => {
|
|
1438
|
+
i.stopPropagation(), !y.disabled && !y.divider && (n?.(y.value, L), m(!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
|
f
|
|
@@ -1452,7 +1455,7 @@ const mt = ({
|
|
|
1452
1455
|
/* @__PURE__ */ e(
|
|
1453
1456
|
"button",
|
|
1454
1457
|
{
|
|
1455
|
-
ref:
|
|
1458
|
+
ref: N,
|
|
1456
1459
|
onClick: U,
|
|
1457
1460
|
disabled: c,
|
|
1458
1461
|
className: x("inline-flex items-center justify-center", {
|
|
@@ -1461,7 +1464,7 @@ const mt = ({
|
|
|
1461
1464
|
children: t
|
|
1462
1465
|
}
|
|
1463
1466
|
),
|
|
1464
|
-
g && /* @__PURE__ */ e("div", { className:
|
|
1467
|
+
g && /* @__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
1469
|
a.map((i, y) => {
|
|
1467
1470
|
if (i.divider)
|
|
@@ -1472,21 +1475,21 @@ const mt = ({
|
|
|
1472
1475
|
},
|
|
1473
1476
|
`divider-${y}`
|
|
1474
1477
|
);
|
|
1475
|
-
const
|
|
1478
|
+
const L = i.children && i.children.length > 0, S = l === i.value;
|
|
1476
1479
|
return /* @__PURE__ */ d("div", { className: "relative group", children: [
|
|
1477
1480
|
/* @__PURE__ */ d(
|
|
1478
1481
|
"button",
|
|
1479
1482
|
{
|
|
1480
1483
|
"data-option-value": i.value,
|
|
1481
|
-
onClick: (
|
|
1482
|
-
onMouseEnter: () =>
|
|
1483
|
-
onMouseLeave: () =>
|
|
1484
|
+
onClick: (M) => F(M, i),
|
|
1485
|
+
onMouseEnter: () => A(i),
|
|
1486
|
+
onMouseLeave: () => H(i),
|
|
1484
1487
|
disabled: i.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
1491
|
"opacity-50 cursor-not-allowed": i.disabled,
|
|
1489
|
-
"bg-neutral-container":
|
|
1492
|
+
"bg-neutral-container": S && L
|
|
1490
1493
|
}
|
|
1491
1494
|
),
|
|
1492
1495
|
children: [
|
|
@@ -1499,67 +1502,67 @@ const mt = ({
|
|
|
1499
1502
|
] }),
|
|
1500
1503
|
/* @__PURE__ */ d("div", { className: "flex items-center space-x-2", children: [
|
|
1501
1504
|
b && r === i.value && /* @__PURE__ */ e("span", { className: "h-4 w-4 text-success flex-shrink-0 text-sm font-bold", children: "✓" }),
|
|
1502
|
-
|
|
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(i.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: i.children.map((
|
|
1525
|
-
if (
|
|
1527
|
+
children: /* @__PURE__ */ e("div", { className: "p-2", children: i.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
1536
|
const Q = typeof r == "object" && r[i.value] && r[i.value].includes(
|
|
1534
|
-
|
|
1535
|
-
) || r ===
|
|
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
|
-
|
|
1544
|
+
M,
|
|
1542
1545
|
i.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
|
b && 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
|
}
|
|
@@ -1567,10 +1570,10 @@ const mt = ({
|
|
|
1567
1570
|
] }, i.value);
|
|
1568
1571
|
}),
|
|
1569
1572
|
(() => {
|
|
1570
|
-
const i = a.reduce((y,
|
|
1571
|
-
if (
|
|
1572
|
-
const
|
|
1573
|
-
return y + 1 +
|
|
1573
|
+
const i = 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
1578
|
return i > 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: [
|
|
1576
1579
|
i,
|
|
@@ -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(
|
|
@@ -1785,89 +1788,89 @@ const mt = ({
|
|
|
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), i = 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 c.forEach((
|
|
1814
|
-
|
|
1815
|
-
const R = a.find((
|
|
1816
|
+
return c.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
1824
|
}, [t, U, a, n, c]), y = de(() => {
|
|
1822
|
-
if (!
|
|
1823
|
-
const o = a.find((
|
|
1824
|
-
return o ? [...i].sort((
|
|
1825
|
-
const R = typeof o.accessor == "function" ? o.accessor(
|
|
1826
|
-
let
|
|
1827
|
-
return R <
|
|
1825
|
+
if (!A.column || !A.direction) return i;
|
|
1826
|
+
const o = a.find((w) => w.id === A.column);
|
|
1827
|
+
return o ? [...i].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;
|
|
1828
1831
|
}) : i;
|
|
1829
|
-
}, [i,
|
|
1832
|
+
}, [i, A, a]), L = de(() => {
|
|
1830
1833
|
if (!f) return y;
|
|
1831
|
-
const o =
|
|
1832
|
-
return y.slice(o,
|
|
1833
|
-
}, [y,
|
|
1834
|
+
const o = T.page * T.pageSize, w = o + T.pageSize;
|
|
1835
|
+
return y.slice(o, w);
|
|
1836
|
+
}, [y, T, f]), 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
|
+
V((o) => ({ ...o, page: 0 }));
|
|
1862
|
+
}, [U, A]), K(() => {
|
|
1863
|
+
V((o) => ({ ...o, page: 0 }));
|
|
1861
1864
|
}, [c.map((o) => o.value).join(",")]);
|
|
1862
|
-
const
|
|
1863
|
-
const
|
|
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,7 +1878,7 @@ 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)]":
|
|
1881
|
+
"hover:bg-[var(--neutral-container)] dark:hover:bg-[var(--neutral-container-emphasis)]": v,
|
|
1879
1882
|
"cursor-pointer": m
|
|
1880
1883
|
});
|
|
1881
1884
|
return /* @__PURE__ */ d("div", { className: "space-y-4", children: [
|
|
@@ -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
|
]
|
|
@@ -1964,7 +1967,7 @@ const mt = ({
|
|
|
1964
1967
|
)),
|
|
1965
1968
|
g.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
1973
|
colSpan: a.length + (l ? 1 : 0) + (g.length > 0 ? 1 : 0),
|
|
@@ -1972,11 +1975,11 @@ const mt = ({
|
|
|
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(), m?.(o, w);
|
|
1991
1994
|
},
|
|
1992
1995
|
children: [
|
|
1993
1996
|
l && /* @__PURE__ */ e("td", { className: le, children: /* @__PURE__ */ e(
|
|
@@ -1995,27 +1998,27 @@ 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
|
g.length > 0 && /* @__PURE__ */ e("td", { className: le, children: /* @__PURE__ */ e(
|
|
@@ -2023,19 +2026,19 @@ const 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: g.map((
|
|
2029
|
-
value:
|
|
2030
|
-
label:
|
|
2031
|
-
icon:
|
|
2032
|
-
disabled:
|
|
2031
|
+
options: g.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 = g.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
|
-
f &&
|
|
2053
|
+
f && 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,8 +2066,8 @@ 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
2072
|
children: b.map((o) => /* @__PURE__ */ e("option", { value: o, children: o }, o))
|
|
2070
2073
|
}
|
|
@@ -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,7 +2134,7 @@ const mt = ({
|
|
|
2131
2134
|
onTabChange: r,
|
|
2132
2135
|
className: n
|
|
2133
2136
|
}) => {
|
|
2134
|
-
const [s, c] =
|
|
2137
|
+
const [s, c] = O(t[0]?.id || ""), f = a || s, b = (p) => {
|
|
2135
2138
|
r ? r(p) : c(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(
|
|
@@ -2166,14 +2169,14 @@ const mt = ({
|
|
|
2166
2169
|
size: c = "md",
|
|
2167
2170
|
className: f
|
|
2168
2171
|
}) => {
|
|
2169
|
-
const [b, p] =
|
|
2172
|
+
const [b, p] = O(
|
|
2170
2173
|
a || r || t[0]?.id || ""
|
|
2171
|
-
), g = r || b, m = (
|
|
2172
|
-
n ? n(
|
|
2174
|
+
), g = r || b, m = (C) => {
|
|
2175
|
+
n ? n(C) : p(C);
|
|
2173
2176
|
}, l = {
|
|
2174
2177
|
activeTab: g,
|
|
2175
2178
|
setActiveTab: m
|
|
2176
|
-
}, u = t.find((
|
|
2179
|
+
}, u = t.find((C) => C.id === g), h = x(
|
|
2177
2180
|
"flex",
|
|
2178
2181
|
{
|
|
2179
2182
|
"border-b border-neutral-200 dark:border-neutral-700 px-2": s === "default" || s === "underline",
|
|
@@ -2182,8 +2185,8 @@ const mt = ({
|
|
|
2182
2185
|
"space-x-8": s === "default" || s === "underline"
|
|
2183
2186
|
},
|
|
2184
2187
|
f
|
|
2185
|
-
),
|
|
2186
|
-
const
|
|
2188
|
+
), k = (C, v) => {
|
|
2189
|
+
const j = "transition-colors duration-200 font-medium", N = {
|
|
2187
2190
|
"text-xs px-2 py-1": c === "sm",
|
|
2188
2191
|
"text-sm px-3 py-2": c === "md",
|
|
2189
2192
|
"text-base px-4 py-3": c === "lg"
|
|
@@ -2194,36 +2197,36 @@ 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": g ===
|
|
2217
|
-
"aria-controls": `tabpanel-${
|
|
2218
|
-
disabled:
|
|
2219
|
-
onClick: () => !
|
|
2220
|
-
className: C
|
|
2219
|
+
"aria-selected": g === C.id,
|
|
2220
|
+
"aria-controls": `tabpanel-${C.id}`,
|
|
2221
|
+
disabled: C.disabled,
|
|
2222
|
+
onClick: () => !C.disabled && m(C.id),
|
|
2223
|
+
className: k(C, g === 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",
|
|
@@ -2256,18 +2259,18 @@ function Ct({
|
|
|
2256
2259
|
footer: g,
|
|
2257
2260
|
showCloseButton: m = !0
|
|
2258
2261
|
}) {
|
|
2259
|
-
const l =
|
|
2262
|
+
const l = Z(null), u = Z(null);
|
|
2260
2263
|
K(() => {
|
|
2261
2264
|
if (!t || !c) return;
|
|
2262
|
-
const
|
|
2263
|
-
|
|
2265
|
+
const k = (C) => {
|
|
2266
|
+
C.key === "Escape" && a();
|
|
2264
2267
|
};
|
|
2265
|
-
return document.addEventListener("keydown",
|
|
2268
|
+
return document.addEventListener("keydown", k), () => document.removeEventListener("keydown", k);
|
|
2266
2269
|
}, [t, c, 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",
|
|
@@ -2322,7 +2325,7 @@ function Ct({
|
|
|
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",
|
|
@@ -2337,7 +2340,7 @@ const Z = ({
|
|
|
2337
2340
|
children: l,
|
|
2338
2341
|
...u
|
|
2339
2342
|
}) => {
|
|
2340
|
-
const h = g || St(t),
|
|
2343
|
+
const h = g || St(t), k = x(
|
|
2341
2344
|
// Base styles
|
|
2342
2345
|
"font-primary",
|
|
2343
2346
|
// Variant styles
|
|
@@ -2400,7 +2403,7 @@ const Z = ({
|
|
|
2400
2403
|
},
|
|
2401
2404
|
m
|
|
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 {
|
|
@@ -2424,159 +2427,159 @@ const Lt = ({
|
|
|
2424
2427
|
onDownloadFile: m,
|
|
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
|
-
), [i, y] =
|
|
2432
|
+
), [i, 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 b?.({ mountId:
|
|
2452
|
+
const o = await b?.({ 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 g?.({
|
|
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 m?.(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,11 +2625,11 @@ 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
|
{
|
|
@@ -2638,12 +2641,12 @@ const Lt = ({
|
|
|
2638
2641
|
c && "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 && !c && /* @__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,8 +2725,8 @@ const Lt = ({
|
|
|
2722
2725
|
{
|
|
2723
2726
|
type: "file",
|
|
2724
2727
|
className: "hidden",
|
|
2725
|
-
ref:
|
|
2726
|
-
onChange:
|
|
2728
|
+
ref: M,
|
|
2729
|
+
onChange: X,
|
|
2727
2730
|
accept: f
|
|
2728
2731
|
}
|
|
2729
2732
|
)
|
|
@@ -2736,12 +2739,12 @@ const Lt = ({
|
|
|
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."
|
|
@@ -2847,90 +2850,90 @@ const rr = ({
|
|
|
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
|
-
(i, y,
|
|
2859
|
-
const
|
|
2860
|
-
if (!
|
|
2861
|
-
if (
|
|
2862
|
-
return `${
|
|
2863
|
-
if (
|
|
2864
|
-
if (
|
|
2865
|
-
return `${
|
|
2861
|
+
(i, y, L) => {
|
|
2862
|
+
const S = t.flatMap((M) => M.items).find((M) => M.name === i);
|
|
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
|
-
),
|
|
2893
|
+
), A = ae(
|
|
2891
2894
|
(i, y) => {
|
|
2892
|
-
let
|
|
2893
|
-
|
|
2895
|
+
let L = Mt(
|
|
2896
|
+
v,
|
|
2894
2897
|
i,
|
|
2895
2898
|
y
|
|
2896
2899
|
);
|
|
2897
|
-
t.flatMap((
|
|
2898
|
-
const
|
|
2899
|
-
q((
|
|
2900
|
-
...
|
|
2901
|
-
[i]:
|
|
2902
|
-
})), s?.(
|
|
2900
|
+
t.flatMap((E) => E.items).find((E) => E.name === i)?.removeIfEmpty && (y == null || y === "") && (L = Et(L, i)), j(L), U((E) => ({ ...E, [i]: !0 }));
|
|
2901
|
+
const M = F(i, y, L);
|
|
2902
|
+
q((E) => ({
|
|
2903
|
+
...E,
|
|
2904
|
+
[i]: M || ""
|
|
2905
|
+
})), s?.(L, i);
|
|
2903
2906
|
},
|
|
2904
|
-
[
|
|
2905
|
-
),
|
|
2907
|
+
[v, t, F, s]
|
|
2908
|
+
), H = ae(
|
|
2906
2909
|
async (i) => {
|
|
2907
2910
|
if (console.log("handleSubmit"), i.preventDefault(), u) return;
|
|
2908
|
-
const y = {},
|
|
2909
|
-
for (const
|
|
2910
|
-
if (
|
|
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
2922
|
if (f) {
|
|
2920
|
-
const
|
|
2921
|
-
|
|
2923
|
+
const M = f(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 = c ? c(v) : v;
|
|
2929
|
+
await r?.(v, S);
|
|
2927
2930
|
},
|
|
2928
|
-
[
|
|
2929
|
-
),
|
|
2931
|
+
[v, t, F, f, c, r, u]
|
|
2932
|
+
), T = ae(
|
|
2930
2933
|
(i) => {
|
|
2931
|
-
const y = Me(
|
|
2934
|
+
const y = Me(v, i.name), L = P[i.name] ? N[i.name] : void 0, S = i.disabled || u, M = {
|
|
2932
2935
|
value: y || "",
|
|
2933
|
-
disabled:
|
|
2936
|
+
disabled: S,
|
|
2934
2937
|
required: i.required,
|
|
2935
2938
|
placeholder: i.placeholder,
|
|
2936
2939
|
...i.fieldProps
|
|
@@ -2945,11 +2948,11 @@ const rr = ({
|
|
|
2945
2948
|
return /* @__PURE__ */ e(
|
|
2946
2949
|
ue,
|
|
2947
2950
|
{
|
|
2948
|
-
...
|
|
2949
|
-
onChange: (
|
|
2951
|
+
...M,
|
|
2952
|
+
onChange: (E) => A(i.name, E.target.value),
|
|
2950
2953
|
type: i.textType || i.type,
|
|
2951
2954
|
autoComplete: i.autocomplete,
|
|
2952
|
-
error:
|
|
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(i.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: (i.options || []).map((
|
|
2974
|
-
...
|
|
2975
|
-
value: String(
|
|
2974
|
+
...M,
|
|
2975
|
+
onChange: (E) => A(i.name, E),
|
|
2976
|
+
options: (i.options || []).map((E) => ({
|
|
2977
|
+
...E,
|
|
2978
|
+
value: String(E.value)
|
|
2976
2979
|
})),
|
|
2977
2980
|
searchable: i.searchable,
|
|
2978
2981
|
multiple: i.multiple,
|
|
2979
2982
|
allowCreate: i.allowCreate,
|
|
2980
|
-
error:
|
|
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(i.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: i.options?.map((
|
|
2998
|
+
return /* @__PURE__ */ e("div", { className: "space-y-1", children: i.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
3003
|
name: i.name,
|
|
3001
|
-
value:
|
|
3002
|
-
checked: y ===
|
|
3003
|
-
onChange: () =>
|
|
3004
|
-
disabled:
|
|
3004
|
+
value: E.value,
|
|
3005
|
+
checked: y === E.value,
|
|
3006
|
+
onChange: () => A(i.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(i.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(i.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
3057
|
return i.customComponent?.({
|
|
3055
3058
|
value: y,
|
|
3056
|
-
onChange: (
|
|
3057
|
-
error:
|
|
3058
|
-
disabled:
|
|
3059
|
+
onChange: (E) => A(i.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
|
+
A(i.name, [...E, {}]);
|
|
3073
|
+
}, X = (I) => {
|
|
3074
|
+
A(
|
|
3072
3075
|
i.name,
|
|
3073
|
-
|
|
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(i.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: i.arrayFields?.map((
|
|
3100
|
-
const ee = Q?.[
|
|
3102
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: i.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: `${i.name}.${
|
|
3213
|
+
name: `${i.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,7 +3288,7 @@ 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
|
i.label
|
|
@@ -3298,14 +3301,14 @@ const rr = ({
|
|
|
3298
3301
|
return null;
|
|
3299
3302
|
}
|
|
3300
3303
|
},
|
|
3301
|
-
[
|
|
3302
|
-
),
|
|
3304
|
+
[v, P, N, u, l, A]
|
|
3305
|
+
), V = ae(
|
|
3303
3306
|
(i) => {
|
|
3304
|
-
if (i.conditional && !i.conditional(
|
|
3307
|
+
if (i.conditional && !i.conditional(v))
|
|
3305
3308
|
return null;
|
|
3306
|
-
const y = i.items.filter((
|
|
3309
|
+
const y = i.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
3314
|
"grid gap-2": i.layout === "grid",
|
|
@@ -3326,7 +3329,7 @@ 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",
|
|
@@ -3336,7 +3339,7 @@ const rr = ({
|
|
|
3336
3339
|
}
|
|
3337
3340
|
),
|
|
3338
3341
|
i.description && /* @__PURE__ */ e(
|
|
3339
|
-
|
|
3342
|
+
Y,
|
|
3340
3343
|
{
|
|
3341
3344
|
variant: "body",
|
|
3342
3345
|
size: "sm",
|
|
@@ -3345,39 +3348,39 @@ const rr = ({
|
|
|
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
|
i.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,8 +3390,8 @@ 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(
|
|
3393
|
+
return /* @__PURE__ */ d("form", { ref: k, onSubmit: H, className: W, children: [
|
|
3394
|
+
/* @__PURE__ */ e("div", { className: "space-y-8", children: t.map(V) }),
|
|
3392
3395
|
g && /* @__PURE__ */ d("div", { className: x("flex gap-3 justify-end pt-8"), children: [
|
|
3393
3396
|
n && /* @__PURE__ */ e(
|
|
3394
3397
|
te,
|
|
@@ -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",
|
|
@@ -3467,7 +3470,7 @@ 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
|
),
|
|
@@ -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",
|
|
@@ -3534,7 +3537,7 @@ function ar({
|
|
|
3534
3537
|
{
|
|
3535
3538
|
className: x(
|
|
3536
3539
|
"animate-spin",
|
|
3537
|
-
|
|
3540
|
+
Dt[t],
|
|
3538
3541
|
At[a]
|
|
3539
3542
|
),
|
|
3540
3543
|
fill: "none",
|
|
@@ -3595,14 +3598,14 @@ const lr = ({
|
|
|
3595
3598
|
onError: u,
|
|
3596
3599
|
...h
|
|
3597
3600
|
}) => {
|
|
3598
|
-
const [
|
|
3599
|
-
|
|
3600
|
-
}, U = (
|
|
3601
|
-
if (
|
|
3602
|
-
q(b),
|
|
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), b && N !== b) {
|
|
3605
|
+
q(b), 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
|
|
@@ -3631,16 +3634,16 @@ const lr = ({
|
|
|
3631
3634
|
"rounded-full": s === "full"
|
|
3632
3635
|
},
|
|
3633
3636
|
m
|
|
3634
|
-
),
|
|
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 && c && /* @__PURE__ */ e("div", { className: H, children: p || T }),
|
|
3680
|
+
v && f && /* @__PURE__ */ e("div", { className: H, children: g || V })
|
|
3678
3681
|
] });
|
|
3679
3682
|
}, sr = ({
|
|
3680
3683
|
title: t,
|
|
@@ -3688,18 +3691,18 @@ const lr = ({
|
|
|
3688
3691
|
editable: p = !1,
|
|
3689
3692
|
onTitleChange: g
|
|
3690
3693
|
}) => {
|
|
3691
|
-
const [m, l] =
|
|
3694
|
+
const [m, l] = O(!1), [u, h] = O(t), k = Z(null);
|
|
3692
3695
|
K(() => {
|
|
3693
3696
|
h(t);
|
|
3694
3697
|
}, [t]), K(() => {
|
|
3695
|
-
m &&
|
|
3698
|
+
m && k.current && (k.current.focus(), k.current.select());
|
|
3696
3699
|
}, [m]);
|
|
3697
|
-
const
|
|
3700
|
+
const C = () => {
|
|
3698
3701
|
p && l(!0);
|
|
3699
|
-
},
|
|
3702
|
+
}, v = () => {
|
|
3700
3703
|
l(!1), u.trim() !== "" && u !== t && g ? g(u.trim()) : h(t);
|
|
3701
|
-
},
|
|
3702
|
-
|
|
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",
|
|
@@ -3726,19 +3729,19 @@ const lr = ({
|
|
|
3726
3729
|
m ? /* @__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
|
] }),
|
|
@@ -3884,20 +3887,20 @@ const cr = ({
|
|
|
3884
3887
|
if (m.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",
|
|
@@ -3906,67 +3909,67 @@ const cr = ({
|
|
|
3906
3909
|
children: [
|
|
3907
3910
|
m.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: m.arrayFields?.map((
|
|
3914
|
-
const
|
|
3915
|
-
let
|
|
3916
|
-
switch (
|
|
3916
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: m.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 = f(
|
|
3931
|
+
j,
|
|
3932
|
+
v.options
|
|
3930
3933
|
);
|
|
3931
3934
|
break;
|
|
3932
3935
|
case "checkbox":
|
|
3933
|
-
|
|
3936
|
+
N = c(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
3975
|
if (m.type === "custom" && m.customComponent)
|
|
@@ -3974,7 +3977,7 @@ const cr = ({
|
|
|
3974
3977
|
if (m.format) {
|
|
3975
3978
|
const h = m.format(l, a);
|
|
3976
3979
|
return /* @__PURE__ */ e(
|
|
3977
|
-
|
|
3980
|
+
Y,
|
|
3978
3981
|
{
|
|
3979
3982
|
variant: "body",
|
|
3980
3983
|
size: "sm",
|
|
@@ -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",
|
|
@@ -4047,7 +4050,7 @@ 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",
|
|
@@ -4057,7 +4060,7 @@ const cr = ({
|
|
|
4057
4060
|
}
|
|
4058
4061
|
),
|
|
4059
4062
|
m.description && /* @__PURE__ */ e(
|
|
4060
|
-
|
|
4063
|
+
Y,
|
|
4061
4064
|
{
|
|
4062
4065
|
variant: "body",
|
|
4063
4066
|
size: "sm",
|
|
@@ -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",
|
|
@@ -4106,8 +4109,8 @@ const cr = ({
|
|
|
4106
4109
|
n
|
|
4107
4110
|
);
|
|
4108
4111
|
return /* @__PURE__ */ e("div", { className: g, children: /* @__PURE__ */ e("div", { className: "space-y-8", children: t.map(p) }) });
|
|
4109
|
-
},
|
|
4110
|
-
const [n, s] =
|
|
4112
|
+
}, De = ({ item: t, isSelectedHandler: a, onClick: r }) => {
|
|
4113
|
+
const [n, s] = O(!1), c = t.children && t.children.length > 0, f = () => {
|
|
4111
4114
|
c && s(!n);
|
|
4112
4115
|
}, b = a ? a(t.path) : !1;
|
|
4113
4116
|
return /* @__PURE__ */ d("li", { children: [
|
|
@@ -4134,7 +4137,7 @@ const cr = ({
|
|
|
4134
4137
|
}
|
|
4135
4138
|
),
|
|
4136
4139
|
c && !n && /* @__PURE__ */ e("ul", { className: "sidebar-menu-nested-items mb-1", children: t.children?.map((p, g) => /* @__PURE__ */ e(
|
|
4137
|
-
|
|
4140
|
+
De,
|
|
4138
4141
|
{
|
|
4139
4142
|
item: p,
|
|
4140
4143
|
isSelectedHandler: a,
|
|
@@ -4158,7 +4161,7 @@ const cr = ({
|
|
|
4158
4161
|
c && /* @__PURE__ */ e("div", { className: "sidebar-menu-pre-items mb-4", children: c }),
|
|
4159
4162
|
/* @__PURE__ */ e("ul", { children: r.map(
|
|
4160
4163
|
(f, b) => !f.path && !f.label && !f.children ? /* @__PURE__ */ e("span", { className: "flex w-full h-4" }, b) : /* @__PURE__ */ e(
|
|
4161
|
-
|
|
4164
|
+
De,
|
|
4162
4165
|
{
|
|
4163
4166
|
item: f,
|
|
4164
4167
|
isSelectedHandler: n,
|
|
@@ -4331,36 +4334,36 @@ const ur = ({
|
|
|
4331
4334
|
initialCommandPath: s,
|
|
4332
4335
|
initialActiveIndex: c
|
|
4333
4336
|
}) => {
|
|
4334
|
-
const [f, b] =
|
|
4335
|
-
(
|
|
4337
|
+
const [f, b] = O(""), [p, g] = O(s || []), [m, l] = O(c || 0), u = Z(null), h = Z(null), C = (p.length ? t.find((v) => v.id === p[0])?.subCommands || [] : t).filter(
|
|
4338
|
+
(v) => v.label.toLowerCase().includes(f.toLowerCase())
|
|
4336
4339
|
);
|
|
4337
4340
|
return K(() => {
|
|
4338
4341
|
a || (b(""), g(s || []), l(c || 0));
|
|
4339
4342
|
}, [a]), K(() => {
|
|
4340
|
-
const
|
|
4343
|
+
const v = (j) => {
|
|
4341
4344
|
if (a) {
|
|
4342
|
-
if (
|
|
4345
|
+
if (j.key === "Escape")
|
|
4343
4346
|
r();
|
|
4344
|
-
else if (
|
|
4347
|
+
else if (j.key === "ArrowUp")
|
|
4345
4348
|
l(
|
|
4346
|
-
(
|
|
4349
|
+
(N) => N > 0 ? N - 1 : C.length - 1
|
|
4347
4350
|
);
|
|
4348
|
-
else if (
|
|
4351
|
+
else if (j.key === "ArrowDown")
|
|
4349
4352
|
l(
|
|
4350
|
-
(
|
|
4353
|
+
(N) => N < C.length - 1 ? N + 1 : 0
|
|
4351
4354
|
);
|
|
4352
|
-
else if (
|
|
4353
|
-
const
|
|
4354
|
-
|
|
4355
|
+
else if (j.key === "Enter") {
|
|
4356
|
+
const N = C[m];
|
|
4357
|
+
N && (N.subCommands ? (g([...p, N.id]), l(0)) : N.action && (N.action(), r()));
|
|
4355
4358
|
}
|
|
4356
4359
|
}
|
|
4357
4360
|
};
|
|
4358
|
-
return document.addEventListener("keydown",
|
|
4359
|
-
}, [a, r,
|
|
4360
|
-
const
|
|
4361
|
-
u.current && !u.current.contains(
|
|
4361
|
+
return document.addEventListener("keydown", v), () => document.removeEventListener("keydown", v);
|
|
4362
|
+
}, [a, r, C, m, p]), K(() => {
|
|
4363
|
+
const v = (j) => {
|
|
4364
|
+
u.current && !u.current.contains(j.target) && r();
|
|
4362
4365
|
};
|
|
4363
|
-
return a && document.addEventListener("mousedown",
|
|
4366
|
+
return a && document.addEventListener("mousedown", v), () => document.removeEventListener("mousedown", v);
|
|
4364
4367
|
}, [a, r]), K(() => {
|
|
4365
4368
|
if (!a) return;
|
|
4366
4369
|
h.current?.querySelector(`[data-index="${m}"]`)?.scrollIntoView({ block: "nearest" });
|
|
@@ -4379,7 +4382,7 @@ const ur = ({
|
|
|
4379
4382
|
autoFocus: !0,
|
|
4380
4383
|
placeholder: n?.searchPlaceholder || "Search commands...",
|
|
4381
4384
|
value: f,
|
|
4382
|
-
onChange: (
|
|
4385
|
+
onChange: (v) => b(v.target.value),
|
|
4383
4386
|
className: "w-full py-2 text-default border-0 focus:outline-none focus:ring-0 focus:border-0 focus:shadow-none bg-transparent"
|
|
4384
4387
|
}
|
|
4385
4388
|
)
|
|
@@ -4390,23 +4393,23 @@ const ur = ({
|
|
|
4390
4393
|
ref: h,
|
|
4391
4394
|
className: "mt-2 pt-2 text-sm border-t border-neutral max-h-[50vh] overflow-y-auto",
|
|
4392
4395
|
children: [
|
|
4393
|
-
|
|
4394
|
-
|
|
4396
|
+
C.length === 0 && /* @__PURE__ */ e("div", { className: "text-muted text-center text-sm", children: n?.noCommandsFound || "No commands found" }),
|
|
4397
|
+
C.map((v, j) => /* @__PURE__ */ d(
|
|
4395
4398
|
"div",
|
|
4396
4399
|
{
|
|
4397
|
-
"data-index":
|
|
4398
|
-
className: `flex items-center p-2 cursor-pointer rounded-md text-default ${
|
|
4400
|
+
"data-index": j,
|
|
4401
|
+
className: `flex items-center p-2 cursor-pointer rounded-md text-default ${j === m ? "bg-neutral-container" : ""}`,
|
|
4399
4402
|
onClick: () => {
|
|
4400
|
-
|
|
4403
|
+
v.subCommands ? (g([...p, v.id]), l(0)) : v.action && (v.action(), r());
|
|
4401
4404
|
},
|
|
4402
|
-
onMouseEnter: () => l(
|
|
4405
|
+
onMouseEnter: () => l(j),
|
|
4403
4406
|
children: [
|
|
4404
|
-
|
|
4405
|
-
/* @__PURE__ */ e("span", { className: "flex-grow", children:
|
|
4406
|
-
|
|
4407
|
+
v.icon && /* @__PURE__ */ e("span", { className: "mr-3", children: v.icon }),
|
|
4408
|
+
/* @__PURE__ */ e("span", { className: "flex-grow", children: v.label }),
|
|
4409
|
+
v.subCommands && /* @__PURE__ */ e("span", { className: "text-muted", children: /* @__PURE__ */ e(qe, { className: "w-4 h-4" }) })
|
|
4407
4410
|
]
|
|
4408
4411
|
},
|
|
4409
|
-
|
|
4412
|
+
v.id
|
|
4410
4413
|
))
|
|
4411
4414
|
]
|
|
4412
4415
|
}
|
|
@@ -4533,18 +4536,18 @@ function hr({
|
|
|
4533
4536
|
componentProps: s,
|
|
4534
4537
|
className: c
|
|
4535
4538
|
}) {
|
|
4536
|
-
const f =
|
|
4537
|
-
return
|
|
4539
|
+
const f = Z(null), [b, p] = O(!0), [g, m] = O(null), l = Z(null);
|
|
4540
|
+
return Z(null), K(() => {
|
|
4538
4541
|
let u = !0;
|
|
4539
4542
|
return (async () => {
|
|
4540
4543
|
p(!0);
|
|
4541
4544
|
try {
|
|
4542
|
-
const
|
|
4545
|
+
const k = await a();
|
|
4543
4546
|
if (!u) return;
|
|
4544
|
-
const
|
|
4545
|
-
m(r === "react" ? () =>
|
|
4546
|
-
} catch (
|
|
4547
|
-
console.error(`[FederatedResource] Load failed: ${t}`,
|
|
4547
|
+
const C = k.component || k.default || k;
|
|
4548
|
+
m(r === "react" ? () => C : () => k);
|
|
4549
|
+
} catch (k) {
|
|
4550
|
+
console.error(`[FederatedResource] Load failed: ${t}`, k);
|
|
4548
4551
|
} finally {
|
|
4549
4552
|
u && p(!1);
|
|
4550
4553
|
}
|
|
@@ -4556,8 +4559,8 @@ function hr({
|
|
|
4556
4559
|
const u = f.current;
|
|
4557
4560
|
if (u) {
|
|
4558
4561
|
if (r === "svelte") {
|
|
4559
|
-
const h = g.default || g,
|
|
4560
|
-
return l.current =
|
|
4562
|
+
const h = g.default || g, k = new h({ target: u, props: s || {} });
|
|
4563
|
+
return l.current = k, () => k.$destroy();
|
|
4561
4564
|
}
|
|
4562
4565
|
if (g.mount) {
|
|
4563
4566
|
const h = g.mount({ container: u, props: s || {} });
|
|
@@ -4634,7 +4637,7 @@ export {
|
|
|
4634
4637
|
tr as TabBar,
|
|
4635
4638
|
Le as Table,
|
|
4636
4639
|
wt as Tabs,
|
|
4637
|
-
|
|
4640
|
+
Y as Text,
|
|
4638
4641
|
Ne as TextArea,
|
|
4639
4642
|
ue as TextField,
|
|
4640
4643
|
Xt as VideoSurface,
|