@krosoft/react 0.0.293 → 0.0.295
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/README.md +3 -0
- package/dist/{AppActions-CpbkO_3O.js → AppActions-NdUYh2ii.js} +2 -2
- package/dist/{AppSubTitle-BOVTZlUB.js → AppSubTitle-CunCNtvJ.js} +1 -1
- package/dist/ErrorAlert-0L-Dwqu8.js +37 -0
- package/dist/GenericForm-CLgO9HuL.js +311 -0
- package/dist/{ImageInput-BPNEywyf.js → ImageInput-DYGqUTBi.js} +2 -2
- package/dist/MultiSelect-CXnF_D0R.js +146 -0
- package/dist/SearchInput-DDcL_q7h.js +318 -0
- package/dist/{cards-BBgGXmYa.js → cards-BB6V8VWw.js} +1 -1
- package/dist/components/core/cards/index.js +1 -1
- package/dist/components/core/dialogs/AppDialog.d.ts +40 -6
- package/dist/components/core/dialogs/AppDialog.d.ts.map +1 -1
- package/dist/components/core/dialogs/FormDialog.d.ts +8 -1
- package/dist/components/core/dialogs/FormDialog.d.ts.map +1 -1
- package/dist/components/core/dialogs/index.d.ts +1 -1
- package/dist/components/core/dialogs/index.d.ts.map +1 -1
- package/dist/components/core/dialogs/index.js +3 -3
- package/dist/components/core/filters/FilterField.d.ts.map +1 -1
- package/dist/components/core/filters/FilterPills.d.ts +1 -1
- package/dist/components/core/filters/TableFilter.d.ts.map +1 -1
- package/dist/components/core/filters/index.d.ts +0 -1
- package/dist/components/core/filters/index.d.ts.map +1 -1
- package/dist/components/core/filters/index.js +138 -255
- package/dist/components/core/forms/GenericForm.d.ts +4 -3
- package/dist/components/core/forms/GenericForm.d.ts.map +1 -1
- package/dist/components/core/forms/index.js +1 -1
- package/dist/components/core/index.js +22 -22
- package/dist/components/core/inputs/MultiSelect.d.ts +20 -8
- package/dist/components/core/inputs/MultiSelect.d.ts.map +1 -1
- package/dist/components/core/inputs/SingleSelect.d.ts +32 -0
- package/dist/components/core/inputs/SingleSelect.d.ts.map +1 -0
- package/dist/components/core/inputs/index.d.ts +3 -2
- package/dist/components/core/inputs/index.d.ts.map +1 -1
- package/dist/components/core/inputs/index.js +5 -5
- package/dist/components/core/language/index.js +1 -1
- package/dist/components/core/layouts/index.js +6 -6
- package/dist/components/core/navbar/index.js +1 -1
- package/dist/components/core/states/ErrorAlert.d.ts +5 -2
- package/dist/components/core/states/ErrorAlert.d.ts.map +1 -1
- package/dist/components/core/states/index.js +2 -2
- package/dist/components/core/table/index.js +3 -3
- package/dist/components/core/tabs/index.js +4 -4
- package/dist/components/core/theme/index.js +1 -1
- package/dist/components/index.js +24 -24
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/index.js +4 -4
- package/dist/dialogs-DVHdqXlO.js +217 -0
- package/dist/{inputs-CUNf48Vk.js → inputs-DG8o5DMW.js} +3 -3
- package/dist/{language-DOGOdjzx.js → language-BvPG7v7d.js} +2 -2
- package/dist/{navbar-CCHGdEzE.js → navbar-CU6zaS92.js} +2 -2
- package/dist/{select-DmLScQKX.js → select-CsXmG_sJ.js} +1 -1
- package/dist/{sheet-DQTOen4V.js → sheet-4VOGdoiW.js} +1 -1
- package/dist/{states-BQK9jqS4.js → states-C4MdmAbW.js} +1 -1
- package/dist/tailwind/index.d.ts +5 -0
- package/dist/tailwind/index.d.ts.map +1 -1
- package/dist/tailwind/index.js +5 -0
- package/dist/{theme-q2uzluEd.js → theme-uTxCKUip.js} +2 -2
- package/dist/{tooltip-BmZ9Bfou.js → tooltip-CWdde1-y.js} +1 -1
- package/dist/{ui-D8Pg34YW.js → ui-rJqnHWNK.js} +3 -3
- package/package.json +1 -1
- package/dist/ErrorAlert-L2s8Dd1_.js +0 -27
- package/dist/GenericForm-BdKwapAz.js +0 -309
- package/dist/MultiSelect-O4JP5fRO.js +0 -129
- package/dist/SearchInput-BSIjKB_9.js +0 -259
- package/dist/components/core/filters/SearchableFilterPill.d.ts +0 -17
- package/dist/components/core/filters/SearchableFilterPill.d.ts.map +0 -1
- package/dist/components/core/inputs/SearchableSelect.d.ts +0 -28
- package/dist/components/core/inputs/SearchableSelect.d.ts.map +0 -1
- package/dist/dialogs-BxyPBIc6.js +0 -207
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as e } from "./tailwind.helper-CJaRYBmL.js";
|
|
2
|
-
import "./ImageInput-
|
|
3
|
-
import "./MultiSelect-
|
|
4
|
-
import "./SearchInput-
|
|
2
|
+
import "./ImageInput-DYGqUTBi.js";
|
|
3
|
+
import "./MultiSelect-CXnF_D0R.js";
|
|
4
|
+
import "./SearchInput-DDcL_q7h.js";
|
|
5
5
|
import { jsx as t } from "react/jsx-runtime";
|
|
6
6
|
import { Heart as n, Star as r } from "lucide-react";
|
|
7
7
|
//#region src/components/core/inputs/RatingInput.tsx
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as e } from "./i18n-d2p0RJo9.js";
|
|
2
|
-
import { i as t, n, r, s as i, t as a } from "./tooltip-
|
|
3
|
-
import { i as o, l as s, n as c, t as l, u } from "./select-
|
|
2
|
+
import { i as t, n, r, s as i, t as a } from "./tooltip-CWdde1-y.js";
|
|
3
|
+
import { i as o, l as s, n as c, t as l, u } from "./select-CsXmG_sJ.js";
|
|
4
4
|
import { t as d } from "./useLanguage-BVUtoDnh.js";
|
|
5
5
|
import "react";
|
|
6
6
|
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as e } from "./tailwind.helper-CJaRYBmL.js";
|
|
2
2
|
import { t } from "./i18n-d2p0RJo9.js";
|
|
3
|
-
import { i as n, n as r, r as i, s as a, t as o } from "./tooltip-
|
|
4
|
-
import { C as s, S as c, b as l, d as u, g as d, h as f, i as p, l as m, m as h, p as g, r as _, t as v, v as y, x as b, y as x } from "./sheet-
|
|
3
|
+
import { i as n, n as r, r as i, s as a, t as o } from "./tooltip-CWdde1-y.js";
|
|
4
|
+
import { C as s, S as c, b as l, d as u, g as d, h as f, i as p, l as m, m as h, p as g, r as _, t as v, v as y, x as b, y as x } from "./sheet-4VOGdoiW.js";
|
|
5
5
|
import { t as S } from "./skeleton-D6Ga4BLw.js";
|
|
6
6
|
import { c as C } from "./behavior-CFsFoY50.js";
|
|
7
7
|
import "./hooks/index.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as e } from "./tailwind.helper-CJaRYBmL.js";
|
|
2
|
-
import { o as t } from "./tooltip-
|
|
2
|
+
import { o as t } from "./tooltip-CWdde1-y.js";
|
|
3
3
|
import * as n from "react";
|
|
4
4
|
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
5
|
import { CheckIcon as a, ChevronDownIcon as o, ChevronUpIcon as s, XIcon as c } from "lucide-react";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as e } from "./tailwind.helper-CJaRYBmL.js";
|
|
2
2
|
import "./helpers/index.js";
|
|
3
3
|
import { t } from "./i18n-d2p0RJo9.js";
|
|
4
|
-
import { a as n } from "./tooltip-
|
|
4
|
+
import { a as n } from "./tooltip-CWdde1-y.js";
|
|
5
5
|
import * as r from "react";
|
|
6
6
|
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
7
7
|
import { SearchIcon as o, X as s } from "lucide-react";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as e } from "./i18n-d2p0RJo9.js";
|
|
2
|
-
import "./ErrorAlert-
|
|
2
|
+
import "./ErrorAlert-0L-Dwqu8.js";
|
|
3
3
|
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
4
4
|
import { Loader2Icon as r } from "lucide-react";
|
|
5
5
|
//#region src/components/core/states/ErrorState.tsx
|
package/dist/tailwind/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tailwind/index.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,UAAiD,CAAC;AAE7E;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,QAAA,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tailwind/index.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,UAAiD,CAAC;AAE7E;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4LQ,CAAC;AAE5B,eAAe,aAAa,CAAC"}
|
package/dist/tailwind/index.js
CHANGED
|
@@ -91,6 +91,11 @@ var t = Object.create, n = Object.defineProperty, r = Object.getOwnPropertyDescr
|
|
|
91
91
|
DEFAULT: "hsl(var(--card))",
|
|
92
92
|
foreground: "hsl(var(--card-foreground))"
|
|
93
93
|
},
|
|
94
|
+
brand: {
|
|
95
|
+
from: "hsl(var(--k-brand-from))",
|
|
96
|
+
to: "hsl(var(--k-brand-to))",
|
|
97
|
+
foreground: "hsl(var(--k-brand-foreground))"
|
|
98
|
+
},
|
|
94
99
|
success: {
|
|
95
100
|
DEFAULT: "hsl(var(--k-success))",
|
|
96
101
|
foreground: "hsl(var(--k-success-foreground))"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as e } from "./i18n-d2p0RJo9.js";
|
|
2
|
-
import { i as t, n, r, s as i, t as a } from "./tooltip-
|
|
3
|
-
import { i as o, l as s, n as c, t as l, u } from "./select-
|
|
2
|
+
import { i as t, n, r, s as i, t as a } from "./tooltip-CWdde1-y.js";
|
|
3
|
+
import { i as o, l as s, n as c, t as l, u } from "./select-CsXmG_sJ.js";
|
|
4
4
|
import { t as d } from "./useTheme-CNx4iolb.js";
|
|
5
5
|
import "react";
|
|
6
6
|
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
@@ -14,7 +14,7 @@ var o = r("inline-flex items-center justify-center gap-2 whitespace-nowrap round
|
|
|
14
14
|
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
15
15
|
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
16
16
|
link: "text-primary underline-offset-4 hover:underline",
|
|
17
|
-
styled: "bg-gradient-to-r from-
|
|
17
|
+
styled: "bg-gradient-to-r from-brand-from to-brand-to hover:from-brand-from/90 hover:to-brand-to/90 text-brand-foreground shadow-lg shadow-brand-to/25 px-6 h-12"
|
|
18
18
|
},
|
|
19
19
|
size: {
|
|
20
20
|
default: "h-10 px-4 py-2",
|
|
@@ -2,9 +2,9 @@ import { t as e } from "./tailwind.helper-CJaRYBmL.js";
|
|
|
2
2
|
import "./helpers/index.js";
|
|
3
3
|
import "./chart-Dq3AIrue.js";
|
|
4
4
|
import "./alert-REQGK9bR.js";
|
|
5
|
-
import { c as t, s as n } from "./tooltip-
|
|
6
|
-
import "./sheet-
|
|
7
|
-
import "./select-
|
|
5
|
+
import { c as t, s as n } from "./tooltip-CWdde1-y.js";
|
|
6
|
+
import "./sheet-4VOGdoiW.js";
|
|
7
|
+
import "./select-CsXmG_sJ.js";
|
|
8
8
|
import "./skeleton-D6Ga4BLw.js";
|
|
9
9
|
import { t as r } from "./useScrollFade-D9kqJBDh.js";
|
|
10
10
|
import { n as i } from "./useToast-UeDRLovh.js";
|
package/package.json
CHANGED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./i18n-d2p0RJo9.js";
|
|
2
|
-
import { n as t, t as n } from "./alert-REQGK9bR.js";
|
|
3
|
-
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
4
|
-
import { AlertTriangle as a } from "lucide-react";
|
|
5
|
-
//#region src/components/core/states/ErrorAlert.tsx
|
|
6
|
-
var o = ({ error: o }) => {
|
|
7
|
-
let { t: s } = e();
|
|
8
|
-
return o ? /* @__PURE__ */ i(n, {
|
|
9
|
-
variant: "destructive",
|
|
10
|
-
children: [/* @__PURE__ */ r(a, { className: "size-4" }), /* @__PURE__ */ i(t, { children: [/* @__PURE__ */ i("div", {
|
|
11
|
-
className: "flex items-center space-x-2",
|
|
12
|
-
children: [
|
|
13
|
-
/* @__PURE__ */ r("span", {
|
|
14
|
-
className: "font-semibold",
|
|
15
|
-
children: s("states.errorPrefix")
|
|
16
|
-
}),
|
|
17
|
-
/* @__PURE__ */ r("span", { children: o.code }),
|
|
18
|
-
/* @__PURE__ */ r("span", { children: o.message })
|
|
19
|
-
]
|
|
20
|
-
}), o.errors && o.errors.length > 0 && /* @__PURE__ */ r("ul", {
|
|
21
|
-
className: "mt-2 list-disc list-inside",
|
|
22
|
-
children: o.errors.map((e, t) => /* @__PURE__ */ r("li", { children: e }, t))
|
|
23
|
-
})] })]
|
|
24
|
-
}) : null;
|
|
25
|
-
};
|
|
26
|
-
//#endregion
|
|
27
|
-
export { o as t };
|
|
@@ -1,309 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./tailwind.helper-CJaRYBmL.js";
|
|
2
|
-
import { c as t, d as n, s as r } from "./chart-Dq3AIrue.js";
|
|
3
|
-
import { t as i } from "./i18n-d2p0RJo9.js";
|
|
4
|
-
import { Ct as a, Dt as o, Et as s, Ot as c, St as l, Tt as u, bn as d, p as f } from "./ui-D8Pg34YW.js";
|
|
5
|
-
import { s as p } from "./tooltip-BmZ9Bfou.js";
|
|
6
|
-
import { g as m } from "./sheet-DQTOen4V.js";
|
|
7
|
-
import { i as h, l as g, n as _, t as v, u as y } from "./select-DmLScQKX.js";
|
|
8
|
-
import { n as b } from "./useToast-UeDRLovh.js";
|
|
9
|
-
import { t as x } from "./ImageInput-BPNEywyf.js";
|
|
10
|
-
import { t as S } from "./AppSubTitle-BOVTZlUB.js";
|
|
11
|
-
import { t as C } from "./MultiSelect-O4JP5fRO.js";
|
|
12
|
-
import { useState as w } from "react";
|
|
13
|
-
import { jsx as T, jsxs as E } from "react/jsx-runtime";
|
|
14
|
-
import { useForm as D } from "react-hook-form";
|
|
15
|
-
import { zodResolver as O } from "@hookform/resolvers/zod";
|
|
16
|
-
import { z as k } from "zod";
|
|
17
|
-
//#region src/components/core/forms/GenericForm.tsx
|
|
18
|
-
var A = ({ schema: A, isLoading: j, error: M, onSubmit: N, onCancel: P, initialData: F, disabled: I = !1, renderActions: L = !0, onRegisterSubmit: R, defaultCols: z = 4 }) => {
|
|
19
|
-
let { t: B } = i(), { toast: V } = b(), [H, U] = w(!1), [ee, W] = w({});
|
|
20
|
-
if (!A) return null;
|
|
21
|
-
let G = (e) => {
|
|
22
|
-
switch (e) {
|
|
23
|
-
case 1: return "md:col-span-1 col-span-4";
|
|
24
|
-
case 2: return "md:col-span-2 col-span-4";
|
|
25
|
-
case 3: return "md:col-span-3 col-span-4";
|
|
26
|
-
default: return "md:col-span-4 col-span-4";
|
|
27
|
-
}
|
|
28
|
-
}, K = (() => {
|
|
29
|
-
let e = {};
|
|
30
|
-
return A.sections.forEach((t) => {
|
|
31
|
-
t.fields.forEach((t) => {
|
|
32
|
-
if (t.rules) e[t.key] = t.rules(k);
|
|
33
|
-
else switch (t.type) {
|
|
34
|
-
case "checkbox":
|
|
35
|
-
e[t.key] = k.boolean().nullable().optional();
|
|
36
|
-
break;
|
|
37
|
-
case "html": break;
|
|
38
|
-
case "text":
|
|
39
|
-
case "textarea":
|
|
40
|
-
case "number":
|
|
41
|
-
case "date":
|
|
42
|
-
case "time":
|
|
43
|
-
case "select":
|
|
44
|
-
case "multiSelect":
|
|
45
|
-
case "color":
|
|
46
|
-
case "image": e[t.key] = k.string().nullable().optional();
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
}), k.object(e);
|
|
50
|
-
})(), q = D({
|
|
51
|
-
resolver: O(K),
|
|
52
|
-
defaultValues: F || Object.fromEntries(A.sections.flatMap((e) => e.fields.map((e) => [e.key, e.defaultValue ?? null])))
|
|
53
|
-
});
|
|
54
|
-
w(() => {
|
|
55
|
-
R && R(() => void q.handleSubmit(J)());
|
|
56
|
-
}), w(() => {
|
|
57
|
-
if (F) {
|
|
58
|
-
let e = {};
|
|
59
|
-
A.sections.forEach((t) => {
|
|
60
|
-
t.fields.forEach((t) => {
|
|
61
|
-
t.type === "image" && F[t.key] && (e[t.key] = F[t.key]);
|
|
62
|
-
});
|
|
63
|
-
}), W(e);
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
let J = async (e) => {
|
|
67
|
-
if (!H) {
|
|
68
|
-
if (Object.keys(q.formState.errors).length > 0) {
|
|
69
|
-
V({
|
|
70
|
-
title: B("form.validationTitle"),
|
|
71
|
-
description: B("form.validationMessage"),
|
|
72
|
-
variant: "destructive"
|
|
73
|
-
});
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
U(!0);
|
|
77
|
-
try {
|
|
78
|
-
await Promise.resolve(N(e));
|
|
79
|
-
} catch (e) {
|
|
80
|
-
console.error("Error during form submission:", e), V({
|
|
81
|
-
title: B("states.errorTitle"),
|
|
82
|
-
description: B("form.submitError"),
|
|
83
|
-
variant: "destructive"
|
|
84
|
-
});
|
|
85
|
-
} finally {
|
|
86
|
-
U(!1);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}, Y = (e, t) => {
|
|
90
|
-
t && W((n) => ({
|
|
91
|
-
...n,
|
|
92
|
-
[e]: t
|
|
93
|
-
}));
|
|
94
|
-
}, X = (e) => {
|
|
95
|
-
if (!e) return !1;
|
|
96
|
-
let t = (e) => {
|
|
97
|
-
if (!e || !e._def) return !1;
|
|
98
|
-
let n = e._def;
|
|
99
|
-
return n.typeName === "ZodNullable" ? !0 : n.innerType ? t(n.innerType) : n.type ? t(n.type) : !1;
|
|
100
|
-
};
|
|
101
|
-
try {
|
|
102
|
-
return t(e(k));
|
|
103
|
-
} catch {
|
|
104
|
-
return !1;
|
|
105
|
-
}
|
|
106
|
-
}, Z = (e) => {
|
|
107
|
-
if (!e) return !1;
|
|
108
|
-
let t = e(k);
|
|
109
|
-
return t.safeParse(void 0).success ? !1 : t._def.checks?.some((e) => e.kind === "min") ?? !1;
|
|
110
|
-
}, Q = (t, n) => {
|
|
111
|
-
let r = !!q.formState.errors[t.key], i = I;
|
|
112
|
-
switch (t.type) {
|
|
113
|
-
case "text":
|
|
114
|
-
case "color": return /* @__PURE__ */ T(m, {
|
|
115
|
-
type: t.type,
|
|
116
|
-
...n,
|
|
117
|
-
placeholder: t.placeholderKey ? B(t.placeholderKey) : "",
|
|
118
|
-
className: e(r && "border-destructive"),
|
|
119
|
-
disabled: i,
|
|
120
|
-
value: n.value ?? ""
|
|
121
|
-
});
|
|
122
|
-
case "image": {
|
|
123
|
-
let a = t, o = a.value === void 0 ? n.value : a.value;
|
|
124
|
-
return /* @__PURE__ */ T(x, {
|
|
125
|
-
value: o ?? "",
|
|
126
|
-
onChange: (e) => {
|
|
127
|
-
if (a.onChange && a.onChange(e), n.onChange(e), e) {
|
|
128
|
-
let n = new FileReader();
|
|
129
|
-
n.onloadend = () => {
|
|
130
|
-
Y(t.key, n.result);
|
|
131
|
-
}, n.readAsDataURL(e);
|
|
132
|
-
}
|
|
133
|
-
},
|
|
134
|
-
accept: a.accept,
|
|
135
|
-
maxSizeMB: a.maxSizeMB,
|
|
136
|
-
hint: a.hint,
|
|
137
|
-
disabled: i,
|
|
138
|
-
className: e(r && "border-destructive")
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
case "date": return /* @__PURE__ */ T(m, {
|
|
142
|
-
type: "date",
|
|
143
|
-
...n,
|
|
144
|
-
className: e(r && "border-destructive"),
|
|
145
|
-
disabled: i,
|
|
146
|
-
value: n.value ?? ""
|
|
147
|
-
});
|
|
148
|
-
case "time": return /* @__PURE__ */ T(m, {
|
|
149
|
-
type: "time",
|
|
150
|
-
...n,
|
|
151
|
-
className: e(r && "border-destructive"),
|
|
152
|
-
disabled: i,
|
|
153
|
-
value: n.value ?? ""
|
|
154
|
-
});
|
|
155
|
-
case "checkbox": return /* @__PURE__ */ E("div", {
|
|
156
|
-
className: "flex items-center space-x-2",
|
|
157
|
-
children: [/* @__PURE__ */ T(d, {
|
|
158
|
-
id: t.key,
|
|
159
|
-
checked: n.value === !0,
|
|
160
|
-
onCheckedChange: (e) => {
|
|
161
|
-
n.onChange(e);
|
|
162
|
-
},
|
|
163
|
-
disabled: i,
|
|
164
|
-
className: e(r && "border-destructive")
|
|
165
|
-
}), /* @__PURE__ */ T("label", {
|
|
166
|
-
htmlFor: t.key,
|
|
167
|
-
className: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
168
|
-
children: B(t.labelKey)
|
|
169
|
-
})]
|
|
170
|
-
}, t.key);
|
|
171
|
-
case "textarea": return /* @__PURE__ */ T(f, {
|
|
172
|
-
...n,
|
|
173
|
-
placeholder: t.placeholderKey ? B(t.placeholderKey) : "",
|
|
174
|
-
className: e(r && "border-destructive", "min-h-[100px]"),
|
|
175
|
-
disabled: i,
|
|
176
|
-
value: n.value ?? ""
|
|
177
|
-
});
|
|
178
|
-
case "number": {
|
|
179
|
-
let a = t;
|
|
180
|
-
return /* @__PURE__ */ T(m, {
|
|
181
|
-
type: "number",
|
|
182
|
-
...n,
|
|
183
|
-
step: a.step,
|
|
184
|
-
min: a.min,
|
|
185
|
-
placeholder: t.placeholderKey ? B(t.placeholderKey) : "",
|
|
186
|
-
className: e(r && "border-destructive"),
|
|
187
|
-
disabled: i,
|
|
188
|
-
value: n.value ?? "",
|
|
189
|
-
onChange: (e) => {
|
|
190
|
-
let t = e.target.value === "" ? "" : Number(e.target.value);
|
|
191
|
-
n.onChange(t);
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
case "select": {
|
|
196
|
-
let o = t, s = X(t.rules), c = n.value === null || n.value === void 0 ? "" : n.value, l = o.options, u = l.find((e) => e.value === c);
|
|
197
|
-
return /* @__PURE__ */ E(v, {
|
|
198
|
-
value: c,
|
|
199
|
-
onValueChange: n.onChange,
|
|
200
|
-
disabled: i,
|
|
201
|
-
children: [/* @__PURE__ */ T(a, { children: /* @__PURE__ */ T(g, {
|
|
202
|
-
className: e(r && "border-destructive"),
|
|
203
|
-
onClear: s && c ? (e) => {
|
|
204
|
-
e.preventDefault(), e.stopPropagation(), n.onChange(null);
|
|
205
|
-
} : void 0,
|
|
206
|
-
children: /* @__PURE__ */ T(y, {
|
|
207
|
-
placeholder: t.placeholderKey ? B(t.placeholderKey) : "",
|
|
208
|
-
children: u ? /* @__PURE__ */ E("div", {
|
|
209
|
-
className: "flex items-center gap-2",
|
|
210
|
-
children: [u.color && /* @__PURE__ */ T("div", {
|
|
211
|
-
className: "w-4 h-4 rounded-full",
|
|
212
|
-
style: { backgroundColor: u.color }
|
|
213
|
-
}), u.label]
|
|
214
|
-
}) : void 0
|
|
215
|
-
})
|
|
216
|
-
}) }), /* @__PURE__ */ T(_, { children: l.map((e, t) => /* @__PURE__ */ T(h, {
|
|
217
|
-
value: e.value,
|
|
218
|
-
children: /* @__PURE__ */ E("div", {
|
|
219
|
-
className: "flex items-center gap-2",
|
|
220
|
-
children: [e.color && /* @__PURE__ */ T("div", {
|
|
221
|
-
className: "w-4 h-4 rounded-full",
|
|
222
|
-
style: { backgroundColor: e.color }
|
|
223
|
-
}), e.label]
|
|
224
|
-
})
|
|
225
|
-
}, t)) })]
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
case "multiSelect": {
|
|
229
|
-
let e = t, r = n.value ?? [];
|
|
230
|
-
return /* @__PURE__ */ T(C, {
|
|
231
|
-
options: e.options,
|
|
232
|
-
selected: r,
|
|
233
|
-
onToggle: (e) => {
|
|
234
|
-
let t = r.includes(e) ? r.filter((t) => t !== e) : [...r, e];
|
|
235
|
-
n.onChange(t);
|
|
236
|
-
},
|
|
237
|
-
onClear: () => {
|
|
238
|
-
n.onChange([]);
|
|
239
|
-
},
|
|
240
|
-
onSelectAll: (e) => {
|
|
241
|
-
n.onChange(e);
|
|
242
|
-
},
|
|
243
|
-
placeholder: t.placeholderKey ? B(t.placeholderKey) : "",
|
|
244
|
-
disabled: i
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
case "html": return t.render(q.getValues(), t);
|
|
248
|
-
default: return null;
|
|
249
|
-
}
|
|
250
|
-
}, $ = (i, l) => {
|
|
251
|
-
let d = /* @__PURE__ */ T("div", {
|
|
252
|
-
className: e("grid grid-cols-4 gap-4"),
|
|
253
|
-
children: i.fields.map((t) => /* @__PURE__ */ T(u, {
|
|
254
|
-
control: q.control,
|
|
255
|
-
name: t.key,
|
|
256
|
-
render: ({ field: n }) => /* @__PURE__ */ E(s, {
|
|
257
|
-
className: e(G(t.layout?.cols ?? z)),
|
|
258
|
-
children: [
|
|
259
|
-
t.type !== "checkbox" && t.type !== "html" && /* @__PURE__ */ E(o, { children: [B(t.labelKey), Z(t.rules) && /* @__PURE__ */ T("span", {
|
|
260
|
-
className: "text-destructive ml-1",
|
|
261
|
-
children: "*"
|
|
262
|
-
})] }),
|
|
263
|
-
/* @__PURE__ */ T(a, { children: Q(t, n) }),
|
|
264
|
-
/* @__PURE__ */ T(c, {})
|
|
265
|
-
]
|
|
266
|
-
})
|
|
267
|
-
}, t.key))
|
|
268
|
-
});
|
|
269
|
-
return A.useCards === !1 ? /* @__PURE__ */ E("div", {
|
|
270
|
-
className: "space-y-4 mb-6",
|
|
271
|
-
children: [i.titleKey && /* @__PURE__ */ T(S, { titleKey: i.titleKey }), d]
|
|
272
|
-
}, l) : /* @__PURE__ */ E(r, {
|
|
273
|
-
className: "mb-6",
|
|
274
|
-
children: [i.titleKey && /* @__PURE__ */ T(n, { children: /* @__PURE__ */ T(S, { titleKey: i.titleKey }) }), /* @__PURE__ */ T(t, { children: d })]
|
|
275
|
-
}, l);
|
|
276
|
-
};
|
|
277
|
-
return /* @__PURE__ */ T(l, {
|
|
278
|
-
...q,
|
|
279
|
-
children: /* @__PURE__ */ E("form", {
|
|
280
|
-
onSubmit: (e) => {
|
|
281
|
-
q.handleSubmit(J)(e);
|
|
282
|
-
},
|
|
283
|
-
className: "space-y-4 px-0 w-full",
|
|
284
|
-
children: [/* @__PURE__ */ E("div", {
|
|
285
|
-
className: "space-y-4",
|
|
286
|
-
children: [A.sections.map((e, t) => $(e, t)), M && /* @__PURE__ */ T("div", {
|
|
287
|
-
className: "text-sm font-medium text-destructive",
|
|
288
|
-
children: M.message
|
|
289
|
-
})]
|
|
290
|
-
}), !I && L && /* @__PURE__ */ E("div", {
|
|
291
|
-
className: "flex justify-end gap-3 mt-6 border-t pt-4",
|
|
292
|
-
children: [P && /* @__PURE__ */ T(p, {
|
|
293
|
-
type: "button",
|
|
294
|
-
variant: "outline",
|
|
295
|
-
onClick: P,
|
|
296
|
-
disabled: H || j,
|
|
297
|
-
children: B("actions.cancel")
|
|
298
|
-
}), /* @__PURE__ */ T(p, {
|
|
299
|
-
variant: "default",
|
|
300
|
-
type: "submit",
|
|
301
|
-
disabled: H || (j ?? !1) || q.formState.isSubmitting,
|
|
302
|
-
children: B(H || j ? "actions.saving" : "actions.save")
|
|
303
|
-
})]
|
|
304
|
-
})]
|
|
305
|
-
})
|
|
306
|
-
});
|
|
307
|
-
};
|
|
308
|
-
//#endregion
|
|
309
|
-
export { A as t };
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./tailwind.helper-CJaRYBmL.js";
|
|
2
|
-
import { t } from "./i18n-d2p0RJo9.js";
|
|
3
|
-
import { bn as n } from "./ui-D8Pg34YW.js";
|
|
4
|
-
import { o as r } from "./tooltip-BmZ9Bfou.js";
|
|
5
|
-
import { useEffect as i, useMemo as a, useRef as o, useState as s } from "react";
|
|
6
|
-
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
7
|
-
import { ChevronDownIcon as u, SearchIcon as d, XIcon as f } from "lucide-react";
|
|
8
|
-
//#region src/components/core/inputs/MultiSelect.tsx
|
|
9
|
-
var p = ({ options: p, selected: m, onToggle: h, onClear: g, onSelectAll: _, placeholder: v, searchable: y = !1, searchPlaceholder: b, disabled: x = !1, maxCount: S }) => {
|
|
10
|
-
let { t: C } = t(), [w, T] = s(""), [E, D] = s(!1), O = o(null), k = o(null), A = a(() => w === "" ? p : p.filter((e) => e.label.toLowerCase().includes(w.toLowerCase())), [p, w]), j = a(() => A.length !== 0 && A.every((e) => m.includes(e.value)), [A, m]), M = a(() => m.map((e) => p.find((t) => t.value === e)?.label ?? e), [p, m]), N = S !== void 0 && S > 0 ? M.slice(0, S) : M, P = M.length - N.length;
|
|
11
|
-
return i(() => {
|
|
12
|
-
E && y && requestAnimationFrame(() => {
|
|
13
|
-
k.current?.focus();
|
|
14
|
-
});
|
|
15
|
-
}, [E, y]), i(() => {
|
|
16
|
-
if (!E) return;
|
|
17
|
-
let e = (e) => {
|
|
18
|
-
O.current !== null && !O.current.contains(e.target) && (D(!1), T(""));
|
|
19
|
-
};
|
|
20
|
-
return document.addEventListener("mousedown", e), () => {
|
|
21
|
-
document.removeEventListener("mousedown", e);
|
|
22
|
-
};
|
|
23
|
-
}, [E]), /* @__PURE__ */ l("div", {
|
|
24
|
-
ref: O,
|
|
25
|
-
className: "relative w-full",
|
|
26
|
-
children: [/* @__PURE__ */ l("button", {
|
|
27
|
-
type: "button",
|
|
28
|
-
disabled: x,
|
|
29
|
-
onClick: () => {
|
|
30
|
-
x || D((e) => (e && T(""), !e));
|
|
31
|
-
},
|
|
32
|
-
className: e(r, "w-full", E && "ring-2 ring-ring ring-offset-2", m.length === 0 && "text-muted-foreground"),
|
|
33
|
-
children: [/* @__PURE__ */ c("span", {
|
|
34
|
-
className: "truncate",
|
|
35
|
-
children: m.length === 0 ? v ?? C("select.placeholder") : N.join(", ")
|
|
36
|
-
}), /* @__PURE__ */ l("div", {
|
|
37
|
-
className: "flex shrink-0 items-center gap-1",
|
|
38
|
-
children: [
|
|
39
|
-
P > 0 && /* @__PURE__ */ l("span", {
|
|
40
|
-
className: "rounded-control bg-muted px-1.5 py-0.5 text-xs font-medium text-foreground",
|
|
41
|
-
children: ["+", P]
|
|
42
|
-
}),
|
|
43
|
-
m.length > 0 && !x && /* @__PURE__ */ c("span", {
|
|
44
|
-
role: "button",
|
|
45
|
-
tabIndex: -1,
|
|
46
|
-
onClick: (e) => {
|
|
47
|
-
e.stopPropagation();
|
|
48
|
-
},
|
|
49
|
-
onPointerDown: (e) => {
|
|
50
|
-
e.preventDefault(), e.stopPropagation(), g();
|
|
51
|
-
},
|
|
52
|
-
className: "text-muted-foreground hover:text-foreground",
|
|
53
|
-
children: /* @__PURE__ */ c(f, { className: "size-4" })
|
|
54
|
-
}),
|
|
55
|
-
/* @__PURE__ */ c(u, { className: e("size-4 opacity-50 shrink-0 transition-transform", E && "rotate-180") })
|
|
56
|
-
]
|
|
57
|
-
})]
|
|
58
|
-
}), E ? /* @__PURE__ */ l("div", {
|
|
59
|
-
className: "absolute left-0 right-0 top-[calc(100%+4px)] z-[100] rounded-surface border bg-popover text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 slide-in-from-top-2",
|
|
60
|
-
children: [
|
|
61
|
-
y ? /* @__PURE__ */ c("div", {
|
|
62
|
-
className: "border-b border-border p-2",
|
|
63
|
-
children: /* @__PURE__ */ l("div", {
|
|
64
|
-
className: "relative",
|
|
65
|
-
children: [/* @__PURE__ */ c(d, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }), /* @__PURE__ */ c("input", {
|
|
66
|
-
ref: k,
|
|
67
|
-
className: "w-full rounded-control bg-muted/50 py-1.5 pl-7 pr-2 text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring",
|
|
68
|
-
placeholder: b ?? C("search.placeholder"),
|
|
69
|
-
value: w,
|
|
70
|
-
onChange: (e) => {
|
|
71
|
-
T(e.target.value);
|
|
72
|
-
}
|
|
73
|
-
})]
|
|
74
|
-
})
|
|
75
|
-
}) : null,
|
|
76
|
-
/* @__PURE__ */ l("div", {
|
|
77
|
-
className: "flex flex-col gap-0.5 max-h-56 overflow-y-auto p-1.5 scrollbar-thin scrollbar-thumb-rounded scrollbar-thumb-muted-foreground/20 scrollbar-track-transparent [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-muted-foreground/20 [&::-webkit-scrollbar-track]:bg-transparent",
|
|
78
|
-
children: [A.length === 0 && /* @__PURE__ */ c("p", {
|
|
79
|
-
className: "px-2 py-3 text-center text-xs text-muted-foreground",
|
|
80
|
-
children: C("states.noResult")
|
|
81
|
-
}), A.map((e) => /* @__PURE__ */ l("label", {
|
|
82
|
-
className: "flex items-center gap-2.5 rounded-md px-2 py-2 text-sm hover:bg-muted cursor-pointer transition-colors",
|
|
83
|
-
children: [
|
|
84
|
-
/* @__PURE__ */ c(n, {
|
|
85
|
-
checked: m.includes(e.value),
|
|
86
|
-
onCheckedChange: () => {
|
|
87
|
-
h(e.value);
|
|
88
|
-
}
|
|
89
|
-
}),
|
|
90
|
-
e.color && /* @__PURE__ */ c("span", {
|
|
91
|
-
className: "size-2.5 shrink-0 rounded-full",
|
|
92
|
-
style: { backgroundColor: e.color }
|
|
93
|
-
}),
|
|
94
|
-
e.label
|
|
95
|
-
]
|
|
96
|
-
}, e.value))]
|
|
97
|
-
}),
|
|
98
|
-
A.length > 0 && /* @__PURE__ */ c("div", {
|
|
99
|
-
className: "border-t border-border p-1.5",
|
|
100
|
-
children: j ? /* @__PURE__ */ c("button", {
|
|
101
|
-
type: "button",
|
|
102
|
-
onClick: g,
|
|
103
|
-
className: "w-full rounded-md px-2 py-1.5 text-xs text-muted-foreground hover:text-foreground hover:bg-muted transition-colors text-center",
|
|
104
|
-
children: C("filters.deselectAll")
|
|
105
|
-
}) : /* @__PURE__ */ c("button", {
|
|
106
|
-
type: "button",
|
|
107
|
-
onClick: () => {
|
|
108
|
-
if (j) {
|
|
109
|
-
let e = A.map((e) => e.value), t = m.filter((t) => !e.includes(t));
|
|
110
|
-
_ === void 0 ? g() : _(t);
|
|
111
|
-
} else {
|
|
112
|
-
let e = [...m];
|
|
113
|
-
A.forEach((t) => {
|
|
114
|
-
e.includes(t.value) || e.push(t.value);
|
|
115
|
-
}), _ === void 0 ? A.forEach((e) => {
|
|
116
|
-
m.includes(e.value) || h(e.value);
|
|
117
|
-
}) : _(e);
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
className: "w-full rounded-md px-2 py-1.5 text-xs text-muted-foreground hover:text-foreground hover:bg-muted transition-colors text-center",
|
|
121
|
-
children: C("filters.selectAll")
|
|
122
|
-
})
|
|
123
|
-
})
|
|
124
|
-
]
|
|
125
|
-
}) : null]
|
|
126
|
-
});
|
|
127
|
-
};
|
|
128
|
-
//#endregion
|
|
129
|
-
export { p as t };
|