@krosoft/react 0.0.260 → 0.0.262
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/AppActions-D8KKXpq-.js +60 -0
- package/dist/{AppSubTitle-C8zoMJo_.js → AppSubTitle-CVhjWRBp.js} +7 -7
- package/dist/{AppTitle-BR4JFZfp.js → AppTitle-DBGJRsjU.js} +6 -6
- package/dist/{ErrorAlert-DClCk3Ey.js → ErrorAlert-6ECy_Dox.js} +5 -5
- package/dist/{GenericForm-JqObtUCQ.js → GenericForm-C86_Jk7X.js} +104 -105
- package/dist/{ImageInput-BLIo5LYH.js → ImageInput-DvHgBYsy.js} +5 -5
- package/dist/{MultiSelect-B0Ke0cfS.js → MultiSelect-TGu_k3KM.js} +7 -7
- package/dist/{SearchInput-CXZd2rSc.js → SearchInput-Csflv8Az.js} +31 -31
- package/dist/{behavior-DDtrNBAq.js → behavior-C4WdfbR1.js} +1 -1
- package/dist/{cards-Ct4wFYa8.js → cards-nqZOcSkh.js} +42 -42
- package/dist/{charts-CwT9AFWj.js → charts-BfeSrTmX.js} +1 -1
- package/dist/components/core/cards/index.js +1 -1
- package/dist/components/core/charts/index.js +1 -1
- package/dist/components/core/dialogs/index.js +3 -3
- package/dist/components/core/filters/ActiveFilters.d.ts +2 -2
- package/dist/components/core/filters/ActiveFilters.d.ts.map +1 -1
- package/dist/components/core/filters/SearchableFilterPill.d.ts +2 -2
- package/dist/components/core/filters/SearchableFilterPill.d.ts.map +1 -1
- package/dist/components/core/filters/TableFilter.d.ts.map +1 -1
- package/dist/components/core/filters/index.js +127 -127
- 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 +21 -21
- package/dist/components/core/inputs/index.js +4 -4
- package/dist/components/core/language/index.js +1 -1
- package/dist/components/core/layouts/index.js +26 -26
- package/dist/components/core/navbar/NotificationsBell.d.ts +8 -2
- package/dist/components/core/navbar/NotificationsBell.d.ts.map +1 -1
- package/dist/components/core/navbar/index.js +1 -1
- package/dist/components/core/states/index.js +2 -2
- package/dist/components/core/table/DataTable.d.ts +4 -26
- package/dist/components/core/table/DataTable.d.ts.map +1 -1
- package/dist/components/core/table/TableActions.d.ts +2 -2
- package/dist/components/core/table/TableActions.d.ts.map +1 -1
- package/dist/components/core/table/TableBody.d.ts +7 -8
- package/dist/components/core/table/TableBody.d.ts.map +1 -1
- package/dist/components/core/table/TableBulkActions.d.ts +2 -2
- package/dist/components/core/table/TableBulkActions.d.ts.map +1 -1
- package/dist/components/core/table/TableHeader.d.ts +2 -2
- package/dist/components/core/table/TableHeader.d.ts.map +1 -1
- package/dist/components/core/table/TablePagination.d.ts.map +1 -1
- package/dist/components/core/table/TableSettings.d.ts +2 -2
- package/dist/components/core/table/TableSettings.d.ts.map +1 -1
- package/dist/components/core/table/index.d.ts +0 -2
- package/dist/components/core/table/index.d.ts.map +1 -1
- package/dist/components/core/table/index.js +2 -2
- package/dist/components/core/tabs/AppVerticalTabs.d.ts.map +1 -1
- package/dist/components/core/tabs/index.js +39 -40
- package/dist/components/core/theme/index.js +1 -1
- package/dist/components/index.js +21 -21
- package/dist/components/ui/command.d.ts +13 -13
- package/dist/components/ui/index.js +2 -2
- package/dist/constants/datatable.d.ts +1 -1
- package/dist/dialogs-BiPcEbRx.js +207 -0
- package/dist/helpers/index.d.ts +1 -0
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +37 -1
- package/dist/helpers/table.helper.d.ts +31 -0
- package/dist/helpers/table.helper.d.ts.map +1 -0
- package/dist/hooks/behavior/index.js +1 -1
- package/dist/hooks/index.js +6 -6
- package/dist/hooks/ui/index.js +5 -5
- package/dist/hooks/ui/useDataTable.d.ts +1 -1
- package/dist/hooks/ui/useDataTable.d.ts.map +1 -1
- package/dist/i18n/index.js +1 -1
- package/dist/i18n/krosoftLocales.d.ts +22 -0
- package/dist/i18n/krosoftLocales.d.ts.map +1 -1
- package/dist/i18n/useKrosoftTranslation.d.ts +9 -6
- package/dist/i18n/useKrosoftTranslation.d.ts.map +1 -1
- package/dist/{i18n-DW5zKBEK.js → i18n-CevI9Cgk.js} +35 -13
- package/dist/{inputs-CNDApo_M.js → inputs-BUXmTc40.js} +3 -3
- package/dist/{language-CK_kDejF.js → language-DeQC57bX.js} +9 -9
- package/dist/{navbar-UsCqs4DK.js → navbar-Cl4welok.js} +75 -62
- package/dist/pwa/index.js +4 -4
- package/dist/{sheet-_rrCMue7.js → sheet-RYwa4-Nl.js} +7 -7
- package/dist/{states-BusGNKku.js → states-C6lWnADN.js} +2 -2
- package/dist/table-BWEBIVqj.js +607 -0
- package/dist/{theme-QayeX440.js → theme-Dwc4zNXG.js} +9 -9
- package/dist/types/AppAction.d.ts +1 -1
- package/dist/types/AppAction.d.ts.map +1 -1
- package/dist/types/{BulkAction.d.ts → DataTableBulkAction.d.ts} +3 -3
- package/dist/types/DataTableBulkAction.d.ts.map +1 -0
- package/dist/types/{ColumnDef.d.ts → DataTableColumn.d.ts} +3 -3
- package/dist/types/DataTableColumn.d.ts.map +1 -0
- package/dist/types/DataTableConfig.d.ts +43 -0
- package/dist/types/DataTableConfig.d.ts.map +1 -0
- package/dist/types/DataTableMessages.d.ts +12 -0
- package/dist/types/DataTableMessages.d.ts.map +1 -0
- package/dist/types/{RowAction.d.ts → DataTableRowAction.d.ts} +3 -3
- package/dist/types/DataTableRowAction.d.ts.map +1 -0
- package/dist/types/DataTableServerState.d.ts +20 -0
- package/dist/types/DataTableServerState.d.ts.map +1 -0
- package/dist/types/FilterFieldConfig.d.ts +2 -2
- package/dist/types/FilterFieldConfig.d.ts.map +1 -1
- package/dist/types/FilterSection.d.ts +1 -1
- package/dist/types/FilterSection.d.ts.map +1 -1
- package/dist/types/UseDataTableProps.d.ts +10 -16
- package/dist/types/UseDataTableProps.d.ts.map +1 -1
- package/dist/types/UseDataTableResult.d.ts +3 -3
- package/dist/types/UseDataTableResult.d.ts.map +1 -1
- package/dist/types/index.d.ts +6 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/{ui-hnbBp9RZ.js → ui-D7YSs2kF.js} +1 -1
- package/dist/{ui-Dg7lq9J8.js → ui-IEH46J4v.js} +4 -4
- package/dist/{useDocumentTitle-D7MywIeB.js → useDocumentTitle-C5TsEDqh.js} +4 -4
- package/dist/{useFixedColumns-DnzqhbfT.js → useFixedColumns-BVZs3wbh.js} +27 -27
- package/dist/{useLanguage-B1dusDJk.js → useLanguage-DdVIzhME.js} +1 -1
- package/dist/{useTheme-D1APOG9I.js → useTheme-ZzPZl0MM.js} +1 -1
- package/package.json +1 -1
- package/dist/AppActions-CcU3ClFS.js +0 -60
- package/dist/components/core/table/columnAlignment.d.ts +0 -13
- package/dist/components/core/table/columnAlignment.d.ts.map +0 -1
- package/dist/components/core/table/fixedColumns.d.ts +0 -19
- package/dist/components/core/table/fixedColumns.d.ts.map +0 -1
- package/dist/dialogs-BDtZIxQa.js +0 -208
- package/dist/table-BSjo9t9_.js +0 -644
- package/dist/types/BulkAction.d.ts.map +0 -1
- package/dist/types/ColumnDef.d.ts.map +0 -1
- package/dist/types/RowAction.d.ts.map +0 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { t as e } from "./tailwind.helper-CJaRYBmL.js";
|
|
2
|
+
import { t } from "./i18n-CevI9Cgk.js";
|
|
3
|
+
import { Bt as n, Ft as r, Gt as i, Nt as a, jt as o } from "./ui-D7YSs2kF.js";
|
|
4
|
+
import { s } from "./tooltip-BmZ9Bfou.js";
|
|
5
|
+
import { t as c } from "./useMobile-pTQ8lWvt.js";
|
|
6
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
7
|
+
import { MoreVerticalIcon as d } from "lucide-react";
|
|
8
|
+
//#region src/components/core/layouts/AppActions.tsx
|
|
9
|
+
function f({ actions: f, className: p }) {
|
|
10
|
+
let { t: m } = t(), h = c();
|
|
11
|
+
return !f || f.length === 0 ? null : h ? /* @__PURE__ */ u(o, { children: [/* @__PURE__ */ l(i, {
|
|
12
|
+
asChild: !0,
|
|
13
|
+
children: /* @__PURE__ */ l(s, {
|
|
14
|
+
variant: "outline",
|
|
15
|
+
size: "icon",
|
|
16
|
+
children: /* @__PURE__ */ l(d, { className: "size-4" })
|
|
17
|
+
})
|
|
18
|
+
}), /* @__PURE__ */ l(a, {
|
|
19
|
+
align: "end",
|
|
20
|
+
className: "min-w-48",
|
|
21
|
+
children: f.map((t, i) => t ? t.children && t.children.length > 0 ? /* @__PURE__ */ u("div", { children: [i > 0 && /* @__PURE__ */ l(n, {}), t.children.map((t, n) => t ? /* @__PURE__ */ u(r, {
|
|
22
|
+
onClick: () => void t.onClick?.(),
|
|
23
|
+
disabled: t.disabled,
|
|
24
|
+
className: e("gap-2", t.className),
|
|
25
|
+
children: [t.icon && /* @__PURE__ */ l(t.icon, { className: "size-4" }), t.labelKey && m(t.labelKey)]
|
|
26
|
+
}, n) : null)] }, i) : /* @__PURE__ */ u(r, {
|
|
27
|
+
onClick: () => void t.onClick?.(),
|
|
28
|
+
disabled: t.disabled,
|
|
29
|
+
className: e("gap-2", t.className),
|
|
30
|
+
children: [t.icon && /* @__PURE__ */ l(t.icon, { className: "size-4" }), t.labelKey && m(t.labelKey)]
|
|
31
|
+
}, i) : null)
|
|
32
|
+
})] }) : ((t) => /* @__PURE__ */ l("div", {
|
|
33
|
+
className: e("flex gap-2", p),
|
|
34
|
+
children: t.map((t, n) => t ? t.children && t.children.length > 0 ? /* @__PURE__ */ u(o, { children: [/* @__PURE__ */ l(i, {
|
|
35
|
+
asChild: !0,
|
|
36
|
+
children: /* @__PURE__ */ u(s, {
|
|
37
|
+
variant: t.variant,
|
|
38
|
+
disabled: t.disabled,
|
|
39
|
+
className: e("gap-2", t.className),
|
|
40
|
+
children: [t.icon && /* @__PURE__ */ l(t.icon, { className: "size-4" }), t.labelKey && m(t.labelKey)]
|
|
41
|
+
})
|
|
42
|
+
}), /* @__PURE__ */ l(a, {
|
|
43
|
+
align: "end",
|
|
44
|
+
children: t.children.map((t, n) => t ? /* @__PURE__ */ u(r, {
|
|
45
|
+
onClick: () => void t.onClick?.(),
|
|
46
|
+
disabled: t.disabled,
|
|
47
|
+
className: e("gap-2", t.className),
|
|
48
|
+
children: [t.icon && /* @__PURE__ */ l(t.icon, { className: "size-4" }), t.labelKey && m(t.labelKey)]
|
|
49
|
+
}, n) : null)
|
|
50
|
+
})] }, n) : /* @__PURE__ */ u(s, {
|
|
51
|
+
variant: t.variant,
|
|
52
|
+
onClick: () => void t.onClick?.(),
|
|
53
|
+
disabled: t.disabled,
|
|
54
|
+
className: e("gap-2", t.className),
|
|
55
|
+
children: [t.icon && /* @__PURE__ */ l(t.icon, { className: "size-4" }), t.labelKey && m(t.labelKey)]
|
|
56
|
+
}, n) : null)
|
|
57
|
+
}))(f);
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
export { f as t };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { t as e } from "./
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { t as e } from "./i18n-CevI9Cgk.js";
|
|
2
|
+
import { t } from "./AppActions-D8KKXpq-.js";
|
|
3
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
4
|
//#region src/components/core/layouts/AppSubTitle.tsx
|
|
5
5
|
function i({ titleKey: i, actions: a, className: o }) {
|
|
6
|
-
let { t: s } =
|
|
7
|
-
return /* @__PURE__ */
|
|
6
|
+
let { t: s } = e();
|
|
7
|
+
return /* @__PURE__ */ r("div", {
|
|
8
8
|
className: "flex flex-col sm:flex-row sm:items-center justify-between gap-4",
|
|
9
|
-
children: [/* @__PURE__ */
|
|
9
|
+
children: [/* @__PURE__ */ n("h2", {
|
|
10
10
|
className: "text-lg font-semibold",
|
|
11
11
|
children: s(i)
|
|
12
|
-
}), /* @__PURE__ */ t
|
|
12
|
+
}), /* @__PURE__ */ n(t, {
|
|
13
13
|
actions: a,
|
|
14
14
|
className: o
|
|
15
15
|
})]
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { t as e } from "./tailwind.helper-CJaRYBmL.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { t } from "./i18n-CevI9Cgk.js";
|
|
3
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
4
|
//#region src/components/core/layouts/AppTitle.tsx
|
|
5
5
|
function i({ titleKey: i, descriptionKey: a, isSubTitle: o }) {
|
|
6
|
-
let { t: s } =
|
|
7
|
-
return /* @__PURE__ */
|
|
6
|
+
let { t: s } = t();
|
|
7
|
+
return /* @__PURE__ */ r("div", {
|
|
8
8
|
className: "flex min-w-0 flex-col gap-1",
|
|
9
|
-
children: [/* @__PURE__ */
|
|
9
|
+
children: [/* @__PURE__ */ n("h1", {
|
|
10
10
|
className: o ? "text-xl md:text-2xl font-semibold" : "text-xl md:text-3xl font-bold",
|
|
11
11
|
children: s(i) ?? ""
|
|
12
|
-
}), a ? /* @__PURE__ */
|
|
12
|
+
}), a ? /* @__PURE__ */ n("p", {
|
|
13
13
|
className: e("hidden md:block text-muted-foreground", o && "text-sm"),
|
|
14
14
|
children: s(a)
|
|
15
15
|
}) : null]
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as n } from "./
|
|
1
|
+
import { t as e } from "./i18n-CevI9Cgk.js";
|
|
2
|
+
import { n as t, t as n } from "./alert-REQGK9bR.js";
|
|
3
3
|
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
4
4
|
import { AlertTriangle as a } from "lucide-react";
|
|
5
5
|
//#region src/components/core/states/ErrorAlert.tsx
|
|
6
6
|
var o = ({ error: o }) => {
|
|
7
|
-
let { t: s } =
|
|
8
|
-
return o ? /* @__PURE__ */ i(
|
|
7
|
+
let { t: s } = e();
|
|
8
|
+
return o ? /* @__PURE__ */ i(n, {
|
|
9
9
|
variant: "destructive",
|
|
10
|
-
children: [/* @__PURE__ */ r(a, { className: "size-4" }), /* @__PURE__ */ i(
|
|
10
|
+
children: [/* @__PURE__ */ r(a, { className: "size-4" }), /* @__PURE__ */ i(t, { children: [/* @__PURE__ */ i("div", {
|
|
11
11
|
className: "flex items-center space-x-2",
|
|
12
12
|
children: [
|
|
13
13
|
/* @__PURE__ */ r("span", {
|
|
@@ -1,39 +1,38 @@
|
|
|
1
1
|
import { t as e } from "./tailwind.helper-CJaRYBmL.js";
|
|
2
2
|
import { c as t, d as n, s as r } from "./chart-Dq3AIrue.js";
|
|
3
|
-
import {
|
|
4
|
-
import { s as f } from "./
|
|
5
|
-
import {
|
|
6
|
-
import { g as m } from "./sheet-
|
|
3
|
+
import { t as i } from "./i18n-CevI9Cgk.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-D7YSs2kF.js";
|
|
5
|
+
import { s as p } from "./tooltip-BmZ9Bfou.js";
|
|
6
|
+
import { g as m } from "./sheet-RYwa4-Nl.js";
|
|
7
7
|
import { i as h, l as g, n as _, t as v, u as y } from "./select-DmLScQKX.js";
|
|
8
8
|
import { n as b } from "./useToast-UeDRLovh.js";
|
|
9
|
-
import { t as x } from "./ImageInput-
|
|
10
|
-
import { t as S } from "./AppSubTitle-
|
|
11
|
-
import { t as C } from "./MultiSelect-
|
|
9
|
+
import { t as x } from "./ImageInput-DvHgBYsy.js";
|
|
10
|
+
import { t as S } from "./AppSubTitle-CVhjWRBp.js";
|
|
11
|
+
import { t as C } from "./MultiSelect-TGu_k3KM.js";
|
|
12
12
|
import { useState as w } from "react";
|
|
13
13
|
import { jsx as T, jsxs as E } from "react/jsx-runtime";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import { z as A } from "zod";
|
|
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";
|
|
18
17
|
//#region src/components/core/forms/GenericForm.tsx
|
|
19
|
-
var
|
|
20
|
-
let { t:
|
|
21
|
-
if (!
|
|
22
|
-
let
|
|
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) => {
|
|
23
22
|
switch (e) {
|
|
24
23
|
case 1: return "md:col-span-1 col-span-4";
|
|
25
24
|
case 2: return "md:col-span-2 col-span-4";
|
|
26
25
|
case 3: return "md:col-span-3 col-span-4";
|
|
27
26
|
default: return "md:col-span-4 col-span-4";
|
|
28
27
|
}
|
|
29
|
-
},
|
|
28
|
+
}, K = (() => {
|
|
30
29
|
let e = {};
|
|
31
|
-
return
|
|
30
|
+
return A.sections.forEach((t) => {
|
|
32
31
|
t.fields.forEach((t) => {
|
|
33
|
-
if (t.rules) e[t.key] = t.rules(
|
|
32
|
+
if (t.rules) e[t.key] = t.rules(k);
|
|
34
33
|
else switch (t.type) {
|
|
35
34
|
case "checkbox":
|
|
36
|
-
e[t.key] =
|
|
35
|
+
e[t.key] = k.boolean().nullable().optional();
|
|
37
36
|
break;
|
|
38
37
|
case "html": break;
|
|
39
38
|
case "text":
|
|
@@ -44,55 +43,55 @@ var j = ({ schema: j, isLoading: M, error: N, onSubmit: P, onCancel: F, initialD
|
|
|
44
43
|
case "select":
|
|
45
44
|
case "multiSelect":
|
|
46
45
|
case "color":
|
|
47
|
-
case "image": e[t.key] =
|
|
46
|
+
case "image": e[t.key] = k.string().nullable().optional();
|
|
48
47
|
}
|
|
49
48
|
});
|
|
50
|
-
}),
|
|
51
|
-
})(),
|
|
52
|
-
resolver:
|
|
53
|
-
defaultValues:
|
|
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])))
|
|
54
53
|
});
|
|
55
54
|
w(() => {
|
|
56
|
-
|
|
55
|
+
R && R(() => void q.handleSubmit(J)());
|
|
57
56
|
}), w(() => {
|
|
58
|
-
if (
|
|
57
|
+
if (F) {
|
|
59
58
|
let e = {};
|
|
60
|
-
|
|
59
|
+
A.sections.forEach((t) => {
|
|
61
60
|
t.fields.forEach((t) => {
|
|
62
|
-
t.type === "image" &&
|
|
61
|
+
t.type === "image" && F[t.key] && (e[t.key] = F[t.key]);
|
|
63
62
|
});
|
|
64
|
-
}),
|
|
63
|
+
}), W(e);
|
|
65
64
|
}
|
|
66
65
|
});
|
|
67
|
-
let
|
|
68
|
-
if (!
|
|
69
|
-
if (Object.keys(
|
|
70
|
-
|
|
71
|
-
title:
|
|
72
|
-
description:
|
|
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"),
|
|
73
72
|
variant: "destructive"
|
|
74
73
|
});
|
|
75
74
|
return;
|
|
76
75
|
}
|
|
77
|
-
|
|
76
|
+
U(!0);
|
|
78
77
|
try {
|
|
79
|
-
await Promise.resolve(
|
|
78
|
+
await Promise.resolve(N(e));
|
|
80
79
|
} catch (e) {
|
|
81
|
-
console.error("Error during form submission:", e),
|
|
82
|
-
title:
|
|
83
|
-
description:
|
|
80
|
+
console.error("Error during form submission:", e), V({
|
|
81
|
+
title: B("states.errorTitle"),
|
|
82
|
+
description: B("form.submitError"),
|
|
84
83
|
variant: "destructive"
|
|
85
84
|
});
|
|
86
85
|
} finally {
|
|
87
|
-
|
|
86
|
+
U(!1);
|
|
88
87
|
}
|
|
89
88
|
}
|
|
90
|
-
},
|
|
91
|
-
t &&
|
|
89
|
+
}, Y = (e, t) => {
|
|
90
|
+
t && W((n) => ({
|
|
92
91
|
...n,
|
|
93
92
|
[e]: t
|
|
94
93
|
}));
|
|
95
|
-
},
|
|
94
|
+
}, X = (e) => {
|
|
96
95
|
if (!e) return !1;
|
|
97
96
|
let t = (e) => {
|
|
98
97
|
if (!e || !e._def) return !1;
|
|
@@ -100,42 +99,42 @@ var j = ({ schema: j, isLoading: M, error: N, onSubmit: P, onCancel: F, initialD
|
|
|
100
99
|
return n.typeName === "ZodNullable" ? !0 : n.innerType ? t(n.innerType) : n.type ? t(n.type) : !1;
|
|
101
100
|
};
|
|
102
101
|
try {
|
|
103
|
-
return t(e(
|
|
102
|
+
return t(e(k));
|
|
104
103
|
} catch {
|
|
105
104
|
return !1;
|
|
106
105
|
}
|
|
107
|
-
},
|
|
106
|
+
}, Z = (e) => {
|
|
108
107
|
if (!e) return !1;
|
|
109
|
-
let t = e(
|
|
108
|
+
let t = e(k);
|
|
110
109
|
return t.safeParse(void 0).success ? !1 : t._def.checks?.some((e) => e.kind === "min") ?? !1;
|
|
111
|
-
},
|
|
112
|
-
let r = !!
|
|
110
|
+
}, Q = (t, n) => {
|
|
111
|
+
let r = !!q.formState.errors[t.key], i = I;
|
|
113
112
|
switch (t.type) {
|
|
114
113
|
case "text":
|
|
115
114
|
case "color": return /* @__PURE__ */ T(m, {
|
|
116
115
|
type: t.type,
|
|
117
116
|
...n,
|
|
118
|
-
placeholder: t.placeholderKey ?
|
|
117
|
+
placeholder: t.placeholderKey ? B(t.placeholderKey) : "",
|
|
119
118
|
className: e(r && "border-destructive"),
|
|
120
|
-
disabled:
|
|
119
|
+
disabled: i,
|
|
121
120
|
value: n.value ?? ""
|
|
122
121
|
});
|
|
123
122
|
case "image": {
|
|
124
|
-
let
|
|
123
|
+
let a = t, o = a.value === void 0 ? n.value : a.value;
|
|
125
124
|
return /* @__PURE__ */ T(x, {
|
|
126
125
|
value: o ?? "",
|
|
127
126
|
onChange: (e) => {
|
|
128
|
-
if (
|
|
127
|
+
if (a.onChange && a.onChange(e), n.onChange(e), e) {
|
|
129
128
|
let n = new FileReader();
|
|
130
129
|
n.onloadend = () => {
|
|
131
|
-
|
|
130
|
+
Y(t.key, n.result);
|
|
132
131
|
}, n.readAsDataURL(e);
|
|
133
132
|
}
|
|
134
133
|
},
|
|
135
|
-
accept:
|
|
136
|
-
maxSizeMB:
|
|
137
|
-
hint:
|
|
138
|
-
disabled:
|
|
134
|
+
accept: a.accept,
|
|
135
|
+
maxSizeMB: a.maxSizeMB,
|
|
136
|
+
hint: a.hint,
|
|
137
|
+
disabled: i,
|
|
139
138
|
className: e(r && "border-destructive")
|
|
140
139
|
});
|
|
141
140
|
}
|
|
@@ -143,49 +142,49 @@ var j = ({ schema: j, isLoading: M, error: N, onSubmit: P, onCancel: F, initialD
|
|
|
143
142
|
type: "date",
|
|
144
143
|
...n,
|
|
145
144
|
className: e(r && "border-destructive"),
|
|
146
|
-
disabled:
|
|
145
|
+
disabled: i,
|
|
147
146
|
value: n.value ?? ""
|
|
148
147
|
});
|
|
149
148
|
case "time": return /* @__PURE__ */ T(m, {
|
|
150
149
|
type: "time",
|
|
151
150
|
...n,
|
|
152
151
|
className: e(r && "border-destructive"),
|
|
153
|
-
disabled:
|
|
152
|
+
disabled: i,
|
|
154
153
|
value: n.value ?? ""
|
|
155
154
|
});
|
|
156
155
|
case "checkbox": return /* @__PURE__ */ E("div", {
|
|
157
156
|
className: "flex items-center space-x-2",
|
|
158
|
-
children: [/* @__PURE__ */ T(
|
|
157
|
+
children: [/* @__PURE__ */ T(d, {
|
|
159
158
|
id: t.key,
|
|
160
159
|
checked: n.value === !0,
|
|
161
160
|
onCheckedChange: (e) => {
|
|
162
161
|
n.onChange(e);
|
|
163
162
|
},
|
|
164
|
-
disabled:
|
|
163
|
+
disabled: i,
|
|
165
164
|
className: e(r && "border-destructive")
|
|
166
165
|
}), /* @__PURE__ */ T("label", {
|
|
167
166
|
htmlFor: t.key,
|
|
168
167
|
className: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
169
|
-
children:
|
|
168
|
+
children: B(t.labelKey)
|
|
170
169
|
})]
|
|
171
170
|
}, t.key);
|
|
172
|
-
case "textarea": return /* @__PURE__ */ T(
|
|
171
|
+
case "textarea": return /* @__PURE__ */ T(f, {
|
|
173
172
|
...n,
|
|
174
|
-
placeholder: t.placeholderKey ?
|
|
173
|
+
placeholder: t.placeholderKey ? B(t.placeholderKey) : "",
|
|
175
174
|
className: e(r && "border-destructive", "min-h-[100px]"),
|
|
176
|
-
disabled:
|
|
175
|
+
disabled: i,
|
|
177
176
|
value: n.value ?? ""
|
|
178
177
|
});
|
|
179
178
|
case "number": {
|
|
180
|
-
let
|
|
179
|
+
let a = t;
|
|
181
180
|
return /* @__PURE__ */ T(m, {
|
|
182
181
|
type: "number",
|
|
183
182
|
...n,
|
|
184
|
-
step:
|
|
185
|
-
min:
|
|
186
|
-
placeholder: t.placeholderKey ?
|
|
183
|
+
step: a.step,
|
|
184
|
+
min: a.min,
|
|
185
|
+
placeholder: t.placeholderKey ? B(t.placeholderKey) : "",
|
|
187
186
|
className: e(r && "border-destructive"),
|
|
188
|
-
disabled:
|
|
187
|
+
disabled: i,
|
|
189
188
|
value: n.value ?? "",
|
|
190
189
|
onChange: (e) => {
|
|
191
190
|
let t = e.target.value === "" ? "" : Number(e.target.value);
|
|
@@ -194,18 +193,18 @@ var j = ({ schema: j, isLoading: M, error: N, onSubmit: P, onCancel: F, initialD
|
|
|
194
193
|
});
|
|
195
194
|
}
|
|
196
195
|
case "select": {
|
|
197
|
-
let o = t, s =
|
|
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);
|
|
198
197
|
return /* @__PURE__ */ E(v, {
|
|
199
198
|
value: c,
|
|
200
199
|
onValueChange: n.onChange,
|
|
201
|
-
disabled:
|
|
202
|
-
children: [/* @__PURE__ */ T(
|
|
200
|
+
disabled: i,
|
|
201
|
+
children: [/* @__PURE__ */ T(a, { children: /* @__PURE__ */ T(g, {
|
|
203
202
|
className: e(r && "border-destructive"),
|
|
204
203
|
onClear: s && c ? (e) => {
|
|
205
204
|
e.preventDefault(), e.stopPropagation(), n.onChange(null);
|
|
206
205
|
} : void 0,
|
|
207
206
|
children: /* @__PURE__ */ T(y, {
|
|
208
|
-
placeholder: t.placeholderKey ?
|
|
207
|
+
placeholder: t.placeholderKey ? B(t.placeholderKey) : "",
|
|
209
208
|
children: u ? /* @__PURE__ */ E("div", {
|
|
210
209
|
className: "flex items-center gap-2",
|
|
211
210
|
children: [u.color && /* @__PURE__ */ T("div", {
|
|
@@ -241,70 +240,70 @@ var j = ({ schema: j, isLoading: M, error: N, onSubmit: P, onCancel: F, initialD
|
|
|
241
240
|
onSelectAll: (e) => {
|
|
242
241
|
n.onChange(e);
|
|
243
242
|
},
|
|
244
|
-
placeholder: t.placeholderKey ?
|
|
245
|
-
disabled:
|
|
243
|
+
placeholder: t.placeholderKey ? B(t.placeholderKey) : "",
|
|
244
|
+
disabled: i
|
|
246
245
|
});
|
|
247
246
|
}
|
|
248
|
-
case "html": return t.render(
|
|
247
|
+
case "html": return t.render(q.getValues(), t);
|
|
249
248
|
default: return null;
|
|
250
249
|
}
|
|
251
|
-
},
|
|
250
|
+
}, $ = (i, l) => {
|
|
252
251
|
let d = /* @__PURE__ */ T("div", {
|
|
253
252
|
className: e("grid grid-cols-4 gap-4"),
|
|
254
|
-
children:
|
|
255
|
-
control:
|
|
253
|
+
children: i.fields.map((t) => /* @__PURE__ */ T(u, {
|
|
254
|
+
control: q.control,
|
|
256
255
|
name: t.key,
|
|
257
|
-
render: ({ field: n }) => /* @__PURE__ */ E(
|
|
258
|
-
className: e(
|
|
256
|
+
render: ({ field: n }) => /* @__PURE__ */ E(s, {
|
|
257
|
+
className: e(G(t.layout?.cols ?? z)),
|
|
259
258
|
children: [
|
|
260
|
-
t.type !== "checkbox" && t.type !== "html" && /* @__PURE__ */ E(
|
|
259
|
+
t.type !== "checkbox" && t.type !== "html" && /* @__PURE__ */ E(o, { children: [B(t.labelKey), Z(t.rules) && /* @__PURE__ */ T("span", {
|
|
261
260
|
className: "text-destructive ml-1",
|
|
262
261
|
children: "*"
|
|
263
262
|
})] }),
|
|
264
|
-
/* @__PURE__ */ T(
|
|
265
|
-
/* @__PURE__ */ T(
|
|
263
|
+
/* @__PURE__ */ T(a, { children: Q(t, n) }),
|
|
264
|
+
/* @__PURE__ */ T(c, {})
|
|
266
265
|
]
|
|
267
266
|
})
|
|
268
267
|
}, t.key))
|
|
269
268
|
});
|
|
270
|
-
return
|
|
269
|
+
return A.useCards === !1 ? /* @__PURE__ */ E("div", {
|
|
271
270
|
className: "space-y-4 mb-6",
|
|
272
|
-
children: [
|
|
273
|
-
},
|
|
271
|
+
children: [i.titleKey && /* @__PURE__ */ T(S, { titleKey: i.titleKey }), d]
|
|
272
|
+
}, l) : /* @__PURE__ */ E(r, {
|
|
274
273
|
className: "mb-6",
|
|
275
|
-
children: [
|
|
276
|
-
},
|
|
274
|
+
children: [i.titleKey && /* @__PURE__ */ T(n, { children: /* @__PURE__ */ T(S, { titleKey: i.titleKey }) }), /* @__PURE__ */ T(t, { children: d })]
|
|
275
|
+
}, l);
|
|
277
276
|
};
|
|
278
|
-
return /* @__PURE__ */ T(
|
|
279
|
-
...
|
|
277
|
+
return /* @__PURE__ */ T(l, {
|
|
278
|
+
...q,
|
|
280
279
|
children: /* @__PURE__ */ E("form", {
|
|
281
280
|
onSubmit: (e) => {
|
|
282
|
-
|
|
281
|
+
q.handleSubmit(J)(e);
|
|
283
282
|
},
|
|
284
283
|
className: "space-y-4 px-0 w-full",
|
|
285
284
|
children: [/* @__PURE__ */ E("div", {
|
|
286
285
|
className: "space-y-4",
|
|
287
|
-
children: [
|
|
286
|
+
children: [A.sections.map((e, t) => $(e, t)), M && /* @__PURE__ */ T("div", {
|
|
288
287
|
className: "text-sm font-medium text-destructive",
|
|
289
|
-
children:
|
|
288
|
+
children: M.message
|
|
290
289
|
})]
|
|
291
|
-
}), !
|
|
290
|
+
}), !I && L && /* @__PURE__ */ E("div", {
|
|
292
291
|
className: "flex justify-end gap-3 mt-6 border-t pt-4",
|
|
293
|
-
children: [
|
|
292
|
+
children: [P && /* @__PURE__ */ T(p, {
|
|
294
293
|
type: "button",
|
|
295
294
|
variant: "outline",
|
|
296
|
-
onClick:
|
|
297
|
-
disabled:
|
|
298
|
-
children:
|
|
299
|
-
}), /* @__PURE__ */ T(
|
|
295
|
+
onClick: P,
|
|
296
|
+
disabled: H || j,
|
|
297
|
+
children: B("actions.cancel")
|
|
298
|
+
}), /* @__PURE__ */ T(p, {
|
|
300
299
|
variant: "default",
|
|
301
300
|
type: "submit",
|
|
302
|
-
disabled:
|
|
303
|
-
children: H
|
|
301
|
+
disabled: H || (j ?? !1) || q.formState.isSubmitting,
|
|
302
|
+
children: B(H || j ? "actions.saving" : "actions.save")
|
|
304
303
|
})]
|
|
305
304
|
})]
|
|
306
305
|
})
|
|
307
306
|
});
|
|
308
307
|
};
|
|
309
308
|
//#endregion
|
|
310
|
-
export {
|
|
309
|
+
export { A as t };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { t as e } from "./tailwind.helper-CJaRYBmL.js";
|
|
2
|
-
import "./
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
2
|
+
import { t } from "./i18n-CevI9Cgk.js";
|
|
3
|
+
import "./ui-D7YSs2kF.js";
|
|
4
|
+
import { s as n } from "./tooltip-BmZ9Bfou.js";
|
|
5
5
|
import { t as r } from "./useNotifications-CyhTruIG.js";
|
|
6
6
|
import { forwardRef as i, useRef as a } from "react";
|
|
7
7
|
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
8
8
|
import { ImageIcon as c, UploadIcon as l, XIcon as u } from "lucide-react";
|
|
9
9
|
//#region src/components/core/inputs/ImageInput.tsx
|
|
10
10
|
var d = i(({ value: i, onChange: d, accept: f = "image/jpeg,image/png,image/webp", maxSizeMB: p = 2, disabled: m = !1, className: h = "", hint: g = "JPG, PNG, WEBP" }, _) => {
|
|
11
|
-
let { t: v } =
|
|
11
|
+
let { t: v } = t(), { showError: y } = r(), b = a(null);
|
|
12
12
|
return /* @__PURE__ */ o("div", {
|
|
13
13
|
ref: _,
|
|
14
14
|
className: h,
|
|
@@ -18,7 +18,7 @@ var d = i(({ value: i, onChange: d, accept: f = "image/jpeg,image/png,image/webp
|
|
|
18
18
|
src: i,
|
|
19
19
|
alt: "Preview",
|
|
20
20
|
className: "w-full h-full object-cover"
|
|
21
|
-
}), !m && /* @__PURE__ */ o(
|
|
21
|
+
}), !m && /* @__PURE__ */ o(n, {
|
|
22
22
|
type: "button",
|
|
23
23
|
variant: "destructive",
|
|
24
24
|
size: "sm",
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { t as e } from "./tailwind.helper-CJaRYBmL.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { t } from "./i18n-CevI9Cgk.js";
|
|
3
|
+
import { bn as n } from "./ui-D7YSs2kF.js";
|
|
4
|
+
import { o as r } from "./tooltip-BmZ9Bfou.js";
|
|
5
5
|
import { useEffect as i, useMemo as a, useRef as o, useState as s } from "react";
|
|
6
6
|
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
7
7
|
import { ChevronDownIcon as u, SearchIcon as d, XIcon as f } from "lucide-react";
|
|
8
8
|
//#region src/components/core/inputs/MultiSelect.tsx
|
|
9
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 } =
|
|
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
11
|
return i(() => {
|
|
12
12
|
E && y && requestAnimationFrame(() => {
|
|
13
13
|
k.current?.focus();
|
|
@@ -29,7 +29,7 @@ var p = ({ options: p, selected: m, onToggle: h, onClear: g, onSelectAll: _, pla
|
|
|
29
29
|
onClick: () => {
|
|
30
30
|
x || D((e) => (e && T(""), !e));
|
|
31
31
|
},
|
|
32
|
-
className: e(
|
|
32
|
+
className: e(r, "w-full", E && "ring-2 ring-ring ring-offset-2", m.length === 0 && "text-muted-foreground"),
|
|
33
33
|
children: [/* @__PURE__ */ c("span", {
|
|
34
34
|
className: "truncate",
|
|
35
35
|
children: m.length === 0 ? v ?? C("select.placeholder") : N.join(", ")
|
|
@@ -78,7 +78,7 @@ var p = ({ options: p, selected: m, onToggle: h, onClear: g, onSelectAll: _, pla
|
|
|
78
78
|
children: [
|
|
79
79
|
A.length > 0 && /* @__PURE__ */ l("label", {
|
|
80
80
|
className: "flex items-center gap-2.5 rounded-md px-2 py-2 text-sm hover:bg-muted cursor-pointer transition-colors",
|
|
81
|
-
children: [/* @__PURE__ */ c(
|
|
81
|
+
children: [/* @__PURE__ */ c(n, {
|
|
82
82
|
checked: j,
|
|
83
83
|
onCheckedChange: () => {
|
|
84
84
|
if (j) {
|
|
@@ -102,7 +102,7 @@ var p = ({ options: p, selected: m, onToggle: h, onClear: g, onSelectAll: _, pla
|
|
|
102
102
|
A.map((e) => /* @__PURE__ */ l("label", {
|
|
103
103
|
className: "flex items-center gap-2.5 rounded-md px-2 py-2 text-sm hover:bg-muted cursor-pointer transition-colors",
|
|
104
104
|
children: [
|
|
105
|
-
/* @__PURE__ */ c(
|
|
105
|
+
/* @__PURE__ */ c(n, {
|
|
106
106
|
checked: m.includes(e.value),
|
|
107
107
|
onCheckedChange: () => {
|
|
108
108
|
h(e.value);
|