@krosoft/react 0.0.294 → 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.
Files changed (58) hide show
  1. package/README.md +3 -0
  2. package/dist/{AppActions-CpbkO_3O.js → AppActions-NdUYh2ii.js} +2 -2
  3. package/dist/{AppSubTitle-BOVTZlUB.js → AppSubTitle-CunCNtvJ.js} +1 -1
  4. package/dist/ErrorAlert-0L-Dwqu8.js +37 -0
  5. package/dist/GenericForm-CLgO9HuL.js +311 -0
  6. package/dist/{ImageInput-BPNEywyf.js → ImageInput-DYGqUTBi.js} +2 -2
  7. package/dist/{MultiSelect-CZ4hye2w.js → MultiSelect-CXnF_D0R.js} +29 -30
  8. package/dist/{SearchInput-nr0CrMLK.js → SearchInput-DDcL_q7h.js} +7 -5
  9. package/dist/{cards-BBgGXmYa.js → cards-BB6V8VWw.js} +1 -1
  10. package/dist/components/core/cards/index.js +1 -1
  11. package/dist/components/core/dialogs/AppDialog.d.ts +40 -6
  12. package/dist/components/core/dialogs/AppDialog.d.ts.map +1 -1
  13. package/dist/components/core/dialogs/FormDialog.d.ts +8 -1
  14. package/dist/components/core/dialogs/FormDialog.d.ts.map +1 -1
  15. package/dist/components/core/dialogs/index.d.ts +1 -1
  16. package/dist/components/core/dialogs/index.d.ts.map +1 -1
  17. package/dist/components/core/dialogs/index.js +3 -3
  18. package/dist/components/core/filters/index.js +5 -5
  19. package/dist/components/core/forms/GenericForm.d.ts +4 -3
  20. package/dist/components/core/forms/GenericForm.d.ts.map +1 -1
  21. package/dist/components/core/forms/index.js +1 -1
  22. package/dist/components/core/index.js +17 -17
  23. package/dist/components/core/inputs/MultiSelect.d.ts +5 -1
  24. package/dist/components/core/inputs/MultiSelect.d.ts.map +1 -1
  25. package/dist/components/core/inputs/SingleSelect.d.ts +2 -0
  26. package/dist/components/core/inputs/SingleSelect.d.ts.map +1 -1
  27. package/dist/components/core/inputs/index.d.ts +1 -0
  28. package/dist/components/core/inputs/index.d.ts.map +1 -1
  29. package/dist/components/core/inputs/index.js +4 -4
  30. package/dist/components/core/language/index.js +1 -1
  31. package/dist/components/core/layouts/index.js +6 -6
  32. package/dist/components/core/navbar/index.js +1 -1
  33. package/dist/components/core/states/ErrorAlert.d.ts +5 -2
  34. package/dist/components/core/states/ErrorAlert.d.ts.map +1 -1
  35. package/dist/components/core/states/index.js +2 -2
  36. package/dist/components/core/table/index.js +3 -3
  37. package/dist/components/core/tabs/index.js +4 -4
  38. package/dist/components/core/theme/index.js +1 -1
  39. package/dist/components/index.js +19 -19
  40. package/dist/components/ui/button.d.ts.map +1 -1
  41. package/dist/components/ui/index.js +4 -4
  42. package/dist/dialogs-DVHdqXlO.js +217 -0
  43. package/dist/{inputs-BMCt-VqZ.js → inputs-DG8o5DMW.js} +3 -3
  44. package/dist/{language-DOGOdjzx.js → language-BvPG7v7d.js} +2 -2
  45. package/dist/{navbar-CCHGdEzE.js → navbar-CU6zaS92.js} +2 -2
  46. package/dist/{select-DmLScQKX.js → select-CsXmG_sJ.js} +1 -1
  47. package/dist/{sheet-DQTOen4V.js → sheet-4VOGdoiW.js} +1 -1
  48. package/dist/{states-BQK9jqS4.js → states-C4MdmAbW.js} +1 -1
  49. package/dist/tailwind/index.d.ts +5 -0
  50. package/dist/tailwind/index.d.ts.map +1 -1
  51. package/dist/tailwind/index.js +5 -0
  52. package/dist/{theme-q2uzluEd.js → theme-uTxCKUip.js} +2 -2
  53. package/dist/{tooltip-BmZ9Bfou.js → tooltip-CWdde1-y.js} +1 -1
  54. package/dist/{ui-D8Pg34YW.js → ui-rJqnHWNK.js} +3 -3
  55. package/package.json +1 -1
  56. package/dist/ErrorAlert-L2s8Dd1_.js +0 -27
  57. package/dist/GenericForm-D7ni-5-4.js +0 -309
  58. package/dist/dialogs-BjqvZvax.js +0 -207
@@ -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-CZ4hye2w.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,207 +0,0 @@
1
- import { t as e } from "./i18n-d2p0RJo9.js";
2
- import { Bn as t, Gn as n, Hn as r, I as i, Kn as a, Un as o, Wn as s, qn as c } from "./ui-D8Pg34YW.js";
3
- import { n as l, t as u } from "./alert-REQGK9bR.js";
4
- import { s as d } from "./tooltip-BmZ9Bfou.js";
5
- import { E as f, O as p, P as m, j as h, k as g } from "./sheet-DQTOen4V.js";
6
- import { t as _ } from "./GenericForm-D7ni-5-4.js";
7
- import { t as v } from "./ErrorAlert-L2s8Dd1_.js";
8
- import { useEffect as y, useState as b } from "react";
9
- import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
10
- import { AlertCircleIcon as w, Pen as T, Save as E, X as D } from "lucide-react";
11
- //#region src/components/core/dialogs/AppDialog.tsx
12
- function O({ open: t, onOpenChange: n, config: r, isLoading: a, error: o, children: s }) {
13
- let { t: c } = e(), { title: _, description: v, icon: y, maxWidth: b = "sm:max-w-xl", actions: x } = r;
14
- return /* @__PURE__ */ S(f, {
15
- open: t,
16
- onOpenChange: n,
17
- children: /* @__PURE__ */ C(p, {
18
- className: `${b} max-h-[100dvh] sm:max-h-[90vh] border-0 shadow-2xl p-0 flex flex-col overflow-hidden`,
19
- children: [
20
- a === !0 ? /* @__PURE__ */ S("div", {
21
- className: "absolute top-0 left-0 right-0 z-10",
22
- children: /* @__PURE__ */ S(i, {
23
- indeterminate: !0,
24
- className: "h-1 rounded-none"
25
- })
26
- }) : null,
27
- /* @__PURE__ */ C(h, {
28
- className: "bg-gradient-to-r from-slate-900 to-purple-700 p-4 sm:p-6 sm:rounded-t-surface shrink-0",
29
- children: [/* @__PURE__ */ C(m, {
30
- className: "text-xl sm:text-2xl font-bold flex items-center gap-2 text-white",
31
- children: [y === void 0 ? null : /* @__PURE__ */ S("div", {
32
- className: "p-2 bg-white/20 rounded-control",
33
- children: /* @__PURE__ */ S(y, { className: "size-4 text-white" })
34
- }), c(_)]
35
- }), v !== void 0 && v !== "" ? /* @__PURE__ */ S(g, {
36
- className: "text-indigo-100 text-base",
37
- children: c(v)
38
- }) : null]
39
- }),
40
- o == null ? null : /* @__PURE__ */ S("div", {
41
- className: "px-6 ",
42
- children: /* @__PURE__ */ C(u, {
43
- variant: "destructive",
44
- className: "max-w-full",
45
- children: [/* @__PURE__ */ S(w, { className: "size-4" }), /* @__PURE__ */ S(l, {
46
- className: "break-words overflow-wrap-anywhere max-w-full",
47
- children: o.message
48
- })]
49
- })
50
- }),
51
- /* @__PURE__ */ S("div", {
52
- className: "flex-1 overflow-y-auto px-4 sm:px-6 py-4",
53
- children: s
54
- }),
55
- x !== void 0 && x.length > 0 ? /* @__PURE__ */ S("div", {
56
- className: "sm:rounded-b-surface border-t border-gray-200 dark:border-gray-700 shrink-0 p-4 sm:p-6 light:bg-gradient-to-r light:from-gray-50 light:to-gray-100 dark:bg-gray-950",
57
- children: /* @__PURE__ */ S("div", {
58
- className: "flex justify-end gap-3",
59
- children: x.map((e, t) => /* @__PURE__ */ C(d, {
60
- variant: e.variant ?? "default",
61
- onClick: e.onClick,
62
- disabled: e.disabled === !0 || a === !0,
63
- children: [e.icon === void 0 ? null : /* @__PURE__ */ S(e.icon, { className: "size-4" }), c(e.label)]
64
- }, t))
65
- })
66
- }) : null
67
- ]
68
- })
69
- });
70
- }
71
- //#endregion
72
- //#region src/components/core/dialogs/FormDialog.tsx
73
- function k({ open: t, onOpenChange: n, data: r, title: i, headerBadge: a, schema: o, onSave: s, customFooter: c, defaultEditing: l = !1, footerActions: u = !0, saveLabel: f = "Sauvegarder", cancelLabel: p, hideSaveIcon: m = !1, maxWidth: h = "sm:max-w-4xl", isLoading: g = !1 }) {
74
- let { t: v } = e(), [w, k] = b(l), [A, j] = b(!1), [M, N] = b(null);
75
- if (y(() => {
76
- t && k(l);
77
- }, [t, l]), r == null) return null;
78
- let P = () => {
79
- w ? s !== void 0 && M && M() : k(!0);
80
- }, F = () => {
81
- k(!1);
82
- }, I = () => {
83
- s !== void 0 && M && M();
84
- }, L = async (e) => {
85
- if (s) {
86
- j(!0);
87
- try {
88
- await s(e), k(!1);
89
- } catch (e) {
90
- console.error(e);
91
- } finally {
92
- j(!1);
93
- }
94
- }
95
- }, R = [];
96
- s !== void 0 && (w ? (p !== "" && R.push({
97
- label: p ?? v("actions.cancel"),
98
- onClick: F,
99
- variant: "outline",
100
- disabled: A || g,
101
- icon: D
102
- }), R.push({
103
- label: A ? "Enregistrement..." : f,
104
- onClick: I,
105
- variant: "default",
106
- disabled: A || g,
107
- icon: m ? void 0 : E
108
- })) : R.push({
109
- label: v("actions.edit"),
110
- onClick: P,
111
- variant: "outline",
112
- icon: T
113
- }));
114
- let z = {
115
- title: i(r),
116
- maxWidth: h,
117
- actions: u ? R : []
118
- };
119
- return /* @__PURE__ */ S(O, {
120
- open: t,
121
- onOpenChange: (e) => {
122
- n(e), e || F();
123
- },
124
- config: z,
125
- isLoading: A || g,
126
- children: /* @__PURE__ */ C("div", { children: [
127
- a === void 0 ? null : /* @__PURE__ */ S("div", {
128
- className: "mb-4",
129
- children: a(r)
130
- }),
131
- /* @__PURE__ */ S(_, {
132
- schema: o,
133
- initialData: r,
134
- disabled: !w,
135
- onSubmit: (e) => {
136
- L(e);
137
- },
138
- renderActions: !1,
139
- onRegisterSubmit: (e) => {
140
- N(() => e);
141
- },
142
- isLoading: A || g
143
- }),
144
- c === void 0 ? null : c(r),
145
- s !== void 0 && !u ? /* @__PURE__ */ S("div", {
146
- className: "flex justify-end gap-2 border-t pt-4 mt-6",
147
- children: w ? /* @__PURE__ */ C(x, { children: [p === "" ? null : /* @__PURE__ */ C(d, {
148
- onClick: F,
149
- variant: "outline",
150
- size: "sm",
151
- disabled: A || g,
152
- children: [/* @__PURE__ */ S(D, { className: "size-4 mr-2" }), p ?? v("actions.cancel")]
153
- }), /* @__PURE__ */ C(d, {
154
- onClick: I,
155
- size: "sm",
156
- disabled: A || g,
157
- className: "text-white",
158
- children: [m ? null : /* @__PURE__ */ S(E, { className: "size-4 mr-2" }), A ? "Enregistrement..." : f]
159
- })] }) : /* @__PURE__ */ C(d, {
160
- onClick: P,
161
- variant: "outline",
162
- size: "sm",
163
- children: [/* @__PURE__ */ S(T, { className: "size-4 mr-2" }), "Modifier"]
164
- })
165
- }) : null
166
- ] })
167
- });
168
- }
169
- //#endregion
170
- //#region src/components/core/dialogs/ConfirmationDialog.tsx
171
- function A({ isLoading: i, error: l, config: u, destructive: f = !1 }) {
172
- let { t: p } = e();
173
- return u ? /* @__PURE__ */ S(t, {
174
- open: u.isOpen,
175
- onOpenChange: (e) => {
176
- !e && !i && u.onClose();
177
- },
178
- children: /* @__PURE__ */ C(o, { children: [
179
- /* @__PURE__ */ C(a, { children: [
180
- /* @__PURE__ */ C(c, {
181
- className: u.titleClassName,
182
- children: [u.icon && /* @__PURE__ */ S(u.icon, { className: "size-4" }), p(u.title)]
183
- }),
184
- u.headerClassName && /* @__PURE__ */ S(a, { className: u.headerClassName }),
185
- /* @__PURE__ */ S(s, { children: p(u.description) }),
186
- u.itemName && /* @__PURE__ */ S(s, { children: /* @__PURE__ */ S("span", {
187
- className: "font-semibold block my-2",
188
- children: u.itemName
189
- }) })
190
- ] }),
191
- /* @__PURE__ */ S(v, { error: l instanceof Error ? null : l }),
192
- /* @__PURE__ */ C(n, { children: [/* @__PURE__ */ S(r, {
193
- disabled: i,
194
- children: p("common.buttons.cancel")
195
- }), /* @__PURE__ */ S(d, {
196
- onClick: (e) => {
197
- e.preventDefault(), u.onConfirm();
198
- },
199
- disabled: i,
200
- className: f ? "bg-destructive text-destructive-foreground hover:bg-destructive/90" : "",
201
- children: i ? p(u.loadingKey || "common.buttons.loading") : u.confirmKey
202
- })] })
203
- ] })
204
- }) : null;
205
- }
206
- //#endregion
207
- export { k as n, O as r, A as t };