@krosoft/react 0.0.123 → 0.0.125
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-po4LjUcM.js → AppActions-BbAnhStS.js} +22 -18
- package/dist/{AppSubTitle-CWrsJYFJ.js → AppSubTitle-lg3d5NWc.js} +1 -1
- package/dist/{AppTitle-CDxWr_0y.js → AppTitle-uboDuil4.js} +1 -1
- package/dist/{AppVerticalTabs-CdqoObXx.js → AppVerticalTabs-CBijkDF_.js} +33 -49
- package/dist/ConfirmationDialog-Co5yl0yA.js +184 -0
- package/dist/{DataTable-CrJoeR_0.js → DataTable-DSIgTHZS.js} +174 -218
- package/dist/ErrorAlert-DH1onuyt.js +17 -0
- package/dist/GenericForm-QoeireeW.js +339 -0
- package/dist/ImageInput-DLTYJMwr.js +65 -0
- package/dist/KpiCardsLayout-C3LmSeL1.js +22 -0
- package/dist/{LoadingState-PhGi7HXH.js → LoadingState-BN0YaPSs.js} +3 -3
- package/dist/{MetricCard-C-ewNR_i.js → MetricCard-CPw-fiNS.js} +6 -6
- package/dist/{MultiSelect-BoisW4Kn.js → MultiSelect-CX051kfk.js} +32 -27
- package/dist/SearchInput-D6LmcOjp.js +249 -0
- package/dist/SkeletonCards-BIEnyOuZ.js +62 -0
- package/dist/{TableFilter-CLjQU36k.js → TableFilter-Wh_Womy4.js} +114 -123
- package/dist/{ThemeSelector--w3R6Ff3.js → ThemeSelector-Qv8QBlYq.js} +2 -2
- package/dist/{Topbar-DFu_OdSs.js → Topbar-DVww-tU8.js} +49 -59
- package/dist/{alert-B34E_4uH.js → alert-B78CiTYe.js} +2 -2
- package/dist/components/core/cards/index.js +2 -2
- package/dist/components/core/dialogs/index.js +2 -2
- package/dist/components/core/filters/index.js +1 -1
- package/dist/components/core/forms/index.js +1 -1
- package/dist/components/core/index.js +19 -19
- package/dist/components/core/inputs/index.js +3 -3
- package/dist/components/core/layouts/index.js +4 -4
- package/dist/components/core/navbar/index.js +1 -1
- package/dist/components/core/states/index.js +2 -2
- package/dist/components/core/table/index.js +1 -1
- package/dist/components/core/tabs/index.js +1 -1
- package/dist/components/core/theme/index.js +1 -1
- package/dist/components/index.js +270 -270
- package/dist/components/ui/index.js +213 -213
- package/dist/helpers/index.js +1 -1
- package/dist/hooks/behavior/index.js +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/select-MWzbMBAS.js +106 -0
- package/dist/tailwind.helper-B6yFEsav.js +8 -0
- package/dist/toaster-DTC8Duvh.js +75 -0
- package/dist/toggle-group-CSdAiS44.js +1694 -0
- package/dist/tooltip-BWyFpIxo.js +56 -0
- package/dist/useConfirmDeleteDialog-CiBQmRxg.js +65 -0
- package/package.json +3 -3
- package/dist/ConfirmationDialog-CkMyyh_3.js +0 -221
- package/dist/ErrorAlert-C6BbHHRZ.js +0 -33
- package/dist/GenericForm-CmwqEXiQ.js +0 -11410
- package/dist/ImageInput-C8HcxE8t.js +0 -82
- package/dist/KpiCardsLayout-CETMpB7A.js +0 -15
- package/dist/SearchInput-DJ_F3emq.js +0 -586
- package/dist/SkeletonCards-C5lXTSrB.js +0 -57
- package/dist/badge-CfWlt79h.js +0 -26
- package/dist/createLucideIcon-MP_wDWjs.js +0 -116
- package/dist/ellipsis-vertical-kB5yFb-i.js +0 -15
- package/dist/grip-vertical-DGywJXzS.js +0 -18
- package/dist/index-Be16PP7H.js +0 -34
- package/dist/loader-circle-CKy7u7JW.js +0 -11
- package/dist/select-DlQvLtI3.js +0 -1763
- package/dist/tailwind.helper-gWiv5-6R.js +0 -2278
- package/dist/toaster-CKoOjjKr.js +0 -134
- package/dist/toggle-group-wIgXZYDq.js +0 -29086
- package/dist/tooltip-YhBPXbcJ.js +0 -2477
- package/dist/useConfirmDeleteDialog-BOb3XFpz.js +0 -75
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
import { jsxs as n, jsx as l } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import "./alert-
|
|
4
|
-
import
|
|
5
|
-
import { B as
|
|
6
|
-
import "
|
|
2
|
+
import { ay as u, aM as t, aA as c, aH as g, aC as d } from "./toggle-group-CSdAiS44.js";
|
|
3
|
+
import "./alert-B78CiTYe.js";
|
|
4
|
+
import "@radix-ui/react-aspect-ratio";
|
|
5
|
+
import { B as p } from "./tooltip-BWyFpIxo.js";
|
|
6
|
+
import "@radix-ui/react-collapsible";
|
|
7
|
+
import { MoreVerticalIcon as C } from "lucide-react";
|
|
8
|
+
import "react-resizable-panels";
|
|
9
|
+
import { c as i } from "./tailwind.helper-B6yFEsav.js";
|
|
10
|
+
import "./select-MWzbMBAS.js";
|
|
7
11
|
import "next-themes";
|
|
12
|
+
import "sonner";
|
|
8
13
|
import "react";
|
|
9
14
|
import { u as h } from "./useMobile-DN1_OMDB.js";
|
|
10
15
|
import { useTranslation as v } from "react-i18next";
|
|
11
|
-
|
|
12
|
-
function T({ actions: d, className: t }) {
|
|
16
|
+
function q({ actions: o, className: b }) {
|
|
13
17
|
const { t: m } = v(), N = h();
|
|
14
|
-
return !
|
|
15
|
-
/* @__PURE__ */ l(
|
|
16
|
-
/* @__PURE__ */ l(c, { align: "end", className: "min-w-48", children:
|
|
18
|
+
return !o || o.length === 0 ? null : N ? /* @__PURE__ */ n(u, { children: [
|
|
19
|
+
/* @__PURE__ */ l(t, { asChild: !0, children: /* @__PURE__ */ l(p, { variant: "outline", size: "icon", children: /* @__PURE__ */ l(C, { className: "size-4" }) }) }),
|
|
20
|
+
/* @__PURE__ */ l(c, { align: "end", className: "min-w-48", children: o.map((r, e) => r ? r.children && r.children.length > 0 ? /* @__PURE__ */ n("div", { children: [
|
|
17
21
|
e > 0 && /* @__PURE__ */ l(g, {}),
|
|
18
22
|
r.children.map((s, a) => s ? /* @__PURE__ */ n(
|
|
19
|
-
|
|
23
|
+
d,
|
|
20
24
|
{
|
|
21
25
|
onClick: () => void s.onClick(),
|
|
22
26
|
disabled: s.disabled,
|
|
@@ -28,17 +32,17 @@ function T({ actions: d, className: t }) {
|
|
|
28
32
|
},
|
|
29
33
|
a
|
|
30
34
|
) : null)
|
|
31
|
-
] }, e) : /* @__PURE__ */ n(
|
|
35
|
+
] }, e) : /* @__PURE__ */ n(d, { onClick: () => void r.onClick(), disabled: r.disabled, className: i("gap-2", r.className), children: [
|
|
32
36
|
r.icon && /* @__PURE__ */ l(r.icon, { className: "size-4" }),
|
|
33
37
|
r.labelKey && m(r.labelKey)
|
|
34
38
|
] }, e) : null) })
|
|
35
|
-
] }) : ((r) => /* @__PURE__ */ l("div", { className: i("flex gap-2",
|
|
36
|
-
/* @__PURE__ */ l(
|
|
39
|
+
] }) : ((r) => /* @__PURE__ */ l("div", { className: i("flex gap-2", b), children: r.map((e, s) => e ? e.children && e.children.length > 0 ? /* @__PURE__ */ n(u, { children: [
|
|
40
|
+
/* @__PURE__ */ l(t, { asChild: !0, children: /* @__PURE__ */ n(p, { variant: e.variant, disabled: e.disabled, className: i("gap-2", e.className), children: [
|
|
37
41
|
e.icon && /* @__PURE__ */ l(e.icon, { className: "size-4" }),
|
|
38
42
|
e.labelKey && m(e.labelKey)
|
|
39
43
|
] }) }),
|
|
40
44
|
/* @__PURE__ */ l(c, { align: "end", children: e.children.map((a, f) => a ? /* @__PURE__ */ n(
|
|
41
|
-
|
|
45
|
+
d,
|
|
42
46
|
{
|
|
43
47
|
onClick: () => void a.onClick(),
|
|
44
48
|
disabled: a.disabled,
|
|
@@ -51,7 +55,7 @@ function T({ actions: d, className: t }) {
|
|
|
51
55
|
f
|
|
52
56
|
) : null) })
|
|
53
57
|
] }, s) : /* @__PURE__ */ n(
|
|
54
|
-
|
|
58
|
+
p,
|
|
55
59
|
{
|
|
56
60
|
variant: e.variant,
|
|
57
61
|
onClick: () => void e.onClick(),
|
|
@@ -63,8 +67,8 @@ function T({ actions: d, className: t }) {
|
|
|
63
67
|
]
|
|
64
68
|
},
|
|
65
69
|
s
|
|
66
|
-
) : null) }))(
|
|
70
|
+
) : null) }))(o);
|
|
67
71
|
}
|
|
68
72
|
export {
|
|
69
|
-
|
|
73
|
+
q as A
|
|
70
74
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as i, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation as l } from "react-i18next";
|
|
3
|
-
import { A as m } from "./AppActions-
|
|
3
|
+
import { A as m } from "./AppActions-BbAnhStS.js";
|
|
4
4
|
function f({ titleKey: s, actions: t, className: o }) {
|
|
5
5
|
const { t: r } = l();
|
|
6
6
|
return /* @__PURE__ */ i("div", { className: "flex flex-col sm:flex-row sm:items-center justify-between gap-4", children: [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as m, jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { c as r } from "./tailwind.helper-
|
|
2
|
+
import { c as r } from "./tailwind.helper-B6yFEsav.js";
|
|
3
3
|
import { useTranslation as s } from "react-i18next";
|
|
4
4
|
function d({ titleKey: x, descriptionKey: t, isSubTitle: e }) {
|
|
5
5
|
const { t: l } = s();
|
|
@@ -1,68 +1,52 @@
|
|
|
1
1
|
import { jsxs as n, jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { A as C } from "./AppActions-
|
|
4
|
-
import { A
|
|
2
|
+
import { J as g, N as v, K as N, bY as y, b_ as T, b$ as b, bZ as w, bB as S } from "./toggle-group-CSdAiS44.js";
|
|
3
|
+
import { A as C } from "./AppActions-BbAnhStS.js";
|
|
4
|
+
import { A } from "./AppTitle-uboDuil4.js";
|
|
5
5
|
import { useTranslation as x } from "react-i18next";
|
|
6
6
|
import { useSearchParams as f } from "react-router-dom";
|
|
7
|
-
import { c as
|
|
8
|
-
import { S as
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
* @license lucide-react v1.17.0 - ISC
|
|
12
|
-
*
|
|
13
|
-
* This source code is licensed under the ISC license.
|
|
14
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
15
|
-
*/
|
|
16
|
-
const I = [
|
|
17
|
-
["rect", { x: "2", y: "6", width: "20", height: "8", rx: "1", key: "1estib" }],
|
|
18
|
-
["path", { d: "M17 14v7", key: "7m2elx" }],
|
|
19
|
-
["path", { d: "M7 14v7", key: "1cm7wv" }],
|
|
20
|
-
["path", { d: "M17 3v3", key: "1v4jwn" }],
|
|
21
|
-
["path", { d: "M7 3v3", key: "7o6guu" }],
|
|
22
|
-
["path", { d: "M10 14 2.3 6.3", key: "1023jk" }],
|
|
23
|
-
["path", { d: "m14 6 7.7 7.7", key: "1s8pl2" }],
|
|
24
|
-
["path", { d: "m8 6 8 8", key: "hl96qh" }]
|
|
25
|
-
], p = V("construction", I);
|
|
26
|
-
function K({ titleKey: s, descriptionKey: l, actions: t = [], className: c }) {
|
|
7
|
+
import { c as P } from "./tailwind.helper-B6yFEsav.js";
|
|
8
|
+
import { S as k, h as j, i as z, a as K, c as V } from "./select-MWzbMBAS.js";
|
|
9
|
+
import { ConstructionIcon as p } from "lucide-react";
|
|
10
|
+
function L({ titleKey: s, descriptionKey: l, actions: c = [], className: t }) {
|
|
27
11
|
return /* @__PURE__ */ n("div", { className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between", children: [
|
|
28
|
-
/* @__PURE__ */ a(
|
|
29
|
-
/* @__PURE__ */ a(C, { actions:
|
|
12
|
+
/* @__PURE__ */ a(A, { titleKey: s, descriptionKey: l, isSubTitle: !0 }),
|
|
13
|
+
/* @__PURE__ */ a(C, { actions: c, className: t })
|
|
30
14
|
] });
|
|
31
15
|
}
|
|
32
|
-
function Z({ titleKey: s, descriptionKey: l, actions:
|
|
33
|
-
return /* @__PURE__ */ n(
|
|
34
|
-
/* @__PURE__ */ a(
|
|
35
|
-
/* @__PURE__ */ a(
|
|
16
|
+
function Z({ titleKey: s, descriptionKey: l, actions: c = [], className: t, children: o, isSubTitle: i }) {
|
|
17
|
+
return /* @__PURE__ */ n(g, { children: [
|
|
18
|
+
/* @__PURE__ */ a(v, { children: /* @__PURE__ */ a(L, { titleKey: s, descriptionKey: l, actions: c, className: t }) }),
|
|
19
|
+
/* @__PURE__ */ a(N, { className: "space-y-4", children: o })
|
|
36
20
|
] });
|
|
37
21
|
}
|
|
38
|
-
function
|
|
22
|
+
function _({ tabs: s, itemId: l, item: c, fit: t }) {
|
|
39
23
|
var m;
|
|
40
|
-
const { t: o } = x(), [i, d] = f(),
|
|
41
|
-
return /* @__PURE__ */ n(
|
|
24
|
+
const { t: o } = x(), [i, d] = f(), u = i.get("tab") || ((m = s[0]) == null ? void 0 : m.value);
|
|
25
|
+
return /* @__PURE__ */ n(y, { value: u, onValueChange: (e) => {
|
|
42
26
|
const r = new URLSearchParams();
|
|
43
27
|
r.set("tab", e), d(r);
|
|
44
28
|
}, children: [
|
|
45
|
-
/* @__PURE__ */ a(
|
|
29
|
+
/* @__PURE__ */ a(T, { className: P("w-full justify-start", t && "sm:w-fit"), children: s.map((e) => /* @__PURE__ */ n(b, { value: e.value, className: "gap-2", disabled: e.disabled, children: [
|
|
46
30
|
e.icon ? /* @__PURE__ */ a("span", { className: "hidden sm:inline", children: /* @__PURE__ */ a(e.icon, { className: "size-4" }) }) : null,
|
|
47
31
|
/* @__PURE__ */ a("span", { className: "text-xs sm:text-sm", children: o(e.titleKey) ?? "" }),
|
|
48
32
|
e.count ? /* @__PURE__ */ n("span", { className: "text-gray-500 text-xs", children: [
|
|
49
33
|
"(",
|
|
50
|
-
e.count(
|
|
34
|
+
e.count(c),
|
|
51
35
|
")"
|
|
52
36
|
] }) : null
|
|
53
37
|
] }, e.value)) }),
|
|
54
|
-
s.map((e) => /* @__PURE__ */ a(
|
|
38
|
+
s.map((e) => /* @__PURE__ */ a(w, { value: e.value, className: "mt-4", children: e.component ? e.component(l) : null }, e.value))
|
|
55
39
|
] });
|
|
56
40
|
}
|
|
57
|
-
const
|
|
41
|
+
const q = ({ tabs: s, item: l }) => {
|
|
58
42
|
var m;
|
|
59
|
-
const { t } = x(), [
|
|
43
|
+
const { t: c } = x(), [t, o] = f(), i = t.get("tab") || ((m = s[0]) == null ? void 0 : m.value), d = (e) => {
|
|
60
44
|
const r = new URLSearchParams();
|
|
61
45
|
r.set("tab", e), o(r);
|
|
62
|
-
},
|
|
46
|
+
}, u = () => {
|
|
63
47
|
const e = s.find((r) => r.value === i);
|
|
64
|
-
return e ? e.component ? e.component() :
|
|
65
|
-
},
|
|
48
|
+
return e ? e.component ? e.component() : h() : null;
|
|
49
|
+
}, h = () => /* @__PURE__ */ a("div", { className: "p-4 lg:p-6", children: /* @__PURE__ */ a("div", { className: "flex items-center justify-center h-64 text-gray-500", children: /* @__PURE__ */ n("div", { className: "text-center", children: [
|
|
66
50
|
/* @__PURE__ */ a(p, { className: "h-12 w-12 mx-auto mb-4 text-amber-500" }),
|
|
67
51
|
/* @__PURE__ */ a("p", { className: "text-lg font-medium", children: "Section en cours de développement" }),
|
|
68
52
|
/* @__PURE__ */ a("p", { className: "text-sm text-gray-400", children: "Cette fonctionnalité sera bientôt disponible" })
|
|
@@ -75,7 +59,7 @@ const B = ({ tabs: s, item: l }) => {
|
|
|
75
59
|
onClick: () => !e.disabled && d(e.value),
|
|
76
60
|
children: [
|
|
77
61
|
e.icon && /* @__PURE__ */ a(e.icon, { className: "size-4" }),
|
|
78
|
-
/* @__PURE__ */ a("span", { className: "flex-1", children:
|
|
62
|
+
/* @__PURE__ */ a("span", { className: "flex-1", children: c(e.titleKey) }),
|
|
79
63
|
e.count && /* @__PURE__ */ n("span", { className: "text-xs text-gray-500", children: [
|
|
80
64
|
"(",
|
|
81
65
|
e.count(l),
|
|
@@ -86,11 +70,11 @@ const B = ({ tabs: s, item: l }) => {
|
|
|
86
70
|
},
|
|
87
71
|
r
|
|
88
72
|
)) }) }) }),
|
|
89
|
-
/* @__PURE__ */ a("div", { className: "md:hidden w-full border-b pb-4 mb-4", children: /* @__PURE__ */ n(
|
|
90
|
-
/* @__PURE__ */ a(j, { className: "w-full", children: /* @__PURE__ */ a(
|
|
91
|
-
/* @__PURE__ */ a(
|
|
73
|
+
/* @__PURE__ */ a("div", { className: "md:hidden w-full border-b pb-4 mb-4", children: /* @__PURE__ */ n(k, { value: i, onValueChange: d, children: [
|
|
74
|
+
/* @__PURE__ */ a(j, { className: "w-full", children: /* @__PURE__ */ a(z, { placeholder: "Sélectionner une section" }) }),
|
|
75
|
+
/* @__PURE__ */ a(K, { children: s.map((e, r) => /* @__PURE__ */ a(V, { value: e.value, disabled: e.disabled, children: /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
|
|
92
76
|
e.icon && /* @__PURE__ */ a(e.icon, { className: "size-4" }),
|
|
93
|
-
/* @__PURE__ */ a("span", { children:
|
|
77
|
+
/* @__PURE__ */ a("span", { children: c(e.titleKey) }),
|
|
94
78
|
e.count && /* @__PURE__ */ n("span", { className: "text-xs text-gray-500", children: [
|
|
95
79
|
"(",
|
|
96
80
|
e.count(l),
|
|
@@ -99,12 +83,12 @@ const B = ({ tabs: s, item: l }) => {
|
|
|
99
83
|
!e.component && /* @__PURE__ */ a(p, { className: "size-4 text-amber-500" })
|
|
100
84
|
] }) }, r)) })
|
|
101
85
|
] }) }),
|
|
102
|
-
/* @__PURE__ */ a("div", { className: "flex-1 md:px-4 min-w-0 overflow-auto", children:
|
|
86
|
+
/* @__PURE__ */ a("div", { className: "flex-1 md:px-4 min-w-0 overflow-auto", children: u() })
|
|
103
87
|
] });
|
|
104
88
|
};
|
|
105
89
|
export {
|
|
106
90
|
Z as A,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
91
|
+
L as a,
|
|
92
|
+
_ as b,
|
|
93
|
+
q as c
|
|
110
94
|
};
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { jsx as e, jsxs as r, Fragment as M } from "react/jsx-runtime";
|
|
2
|
+
import { D as q, b as B, P as R, e as W, h as X, c as $, m as J, p as Q, s as F, t as U, q as j, r as V, o as Y } from "./toggle-group-CSdAiS44.js";
|
|
3
|
+
import { A as Z, a as _ } from "./alert-B78CiTYe.js";
|
|
4
|
+
import "@radix-ui/react-aspect-ratio";
|
|
5
|
+
import { B as v } from "./tooltip-BWyFpIxo.js";
|
|
6
|
+
import "@radix-ui/react-collapsible";
|
|
7
|
+
import { AlertCircleIcon as L, X as S, Save as T, Pen as I } from "lucide-react";
|
|
8
|
+
import "react-resizable-panels";
|
|
9
|
+
import "clsx";
|
|
10
|
+
import "tailwind-merge";
|
|
11
|
+
import "./select-MWzbMBAS.js";
|
|
12
|
+
import "next-themes";
|
|
13
|
+
import "sonner";
|
|
14
|
+
import { useState as y, useEffect as ee } from "react";
|
|
15
|
+
import { useTranslation as O } from "react-i18next";
|
|
16
|
+
import { G as le } from "./GenericForm-QoeireeW.js";
|
|
17
|
+
import { E as ie } from "./ErrorAlert-DH1onuyt.js";
|
|
18
|
+
function re({ open: t, onOpenChange: c, config: l, isLoading: u, error: s, children: p }) {
|
|
19
|
+
const { t: i } = O(), { title: b, description: m, icon: f, maxWidth: g = "sm:max-w-xl", actions: n } = l;
|
|
20
|
+
return /* @__PURE__ */ e(q, { open: t, onOpenChange: c, children: /* @__PURE__ */ r(B, { className: `${g} max-h-[90vh] border-0 shadow-2xl p-0 flex flex-col overflow-hidden`, children: [
|
|
21
|
+
u === !0 ? /* @__PURE__ */ e("div", { className: "absolute top-0 left-0 right-0 z-10", children: /* @__PURE__ */ e(R, { indeterminate: !0, className: "h-1 rounded-none" }) }) : null,
|
|
22
|
+
/* @__PURE__ */ r(W, { className: "bg-gradient-to-r from-slate-900 to-purple-700 p-6 rounded-t-lg shrink-0", children: [
|
|
23
|
+
/* @__PURE__ */ r(X, { className: "text-2xl font-bold flex items-center gap-2 text-white", children: [
|
|
24
|
+
f !== void 0 ? /* @__PURE__ */ e("div", { className: "p-2 bg-white/20 rounded-lg", children: /* @__PURE__ */ e(f, { className: "size-4 text-white" }) }) : null,
|
|
25
|
+
i(b)
|
|
26
|
+
] }),
|
|
27
|
+
m !== void 0 && m !== "" ? /* @__PURE__ */ e($, { className: "text-indigo-100 text-base", children: i(m) }) : null
|
|
28
|
+
] }),
|
|
29
|
+
s != null ? /* @__PURE__ */ e("div", { className: "px-6 ", children: /* @__PURE__ */ r(Z, { variant: "destructive", className: "max-w-full", children: [
|
|
30
|
+
/* @__PURE__ */ e(L, { className: "size-4" }),
|
|
31
|
+
/* @__PURE__ */ e(_, { className: "break-words overflow-wrap-anywhere max-w-full", children: s.message })
|
|
32
|
+
] }) }) : null,
|
|
33
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto px-6 ", children: p }),
|
|
34
|
+
n !== void 0 && n.length > 0 ? /* @__PURE__ */ e("div", { className: "rounded-b-lg border-t border-gray-200 dark:border-gray-700 shrink-0 p-6 light:bg-gradient-to-r light:from-gray-50 light:to-gray-100 dark:bg-gray-950", children: /* @__PURE__ */ e("div", { className: "flex justify-end gap-3", children: n.map((a, k) => /* @__PURE__ */ r(v, { variant: a.variant ?? "default", onClick: a.onClick, disabled: a.disabled === !0 || u === !0, children: [
|
|
35
|
+
a.icon !== void 0 ? /* @__PURE__ */ e(a.icon, { className: "size-4" }) : null,
|
|
36
|
+
i(a.label)
|
|
37
|
+
] }, k)) }) }) : null
|
|
38
|
+
] }) });
|
|
39
|
+
}
|
|
40
|
+
function Ce({
|
|
41
|
+
open: t,
|
|
42
|
+
onOpenChange: c,
|
|
43
|
+
data: l,
|
|
44
|
+
title: u,
|
|
45
|
+
headerBadge: s,
|
|
46
|
+
schema: p,
|
|
47
|
+
onSave: i,
|
|
48
|
+
customFooter: b,
|
|
49
|
+
defaultEditing: m = !1,
|
|
50
|
+
footerActions: f = !0,
|
|
51
|
+
saveLabel: g = "Sauvegarder",
|
|
52
|
+
cancelLabel: n = "Annuler",
|
|
53
|
+
hideSaveIcon: a = !1,
|
|
54
|
+
maxWidth: k = "sm:max-w-4xl",
|
|
55
|
+
isLoading: h = !1
|
|
56
|
+
}) {
|
|
57
|
+
const [N, x] = y(m), [o, A] = y(!1), [C, P] = y(null);
|
|
58
|
+
if (ee(() => {
|
|
59
|
+
t && x(m);
|
|
60
|
+
}, [t, m]), l == null) return null;
|
|
61
|
+
const z = () => {
|
|
62
|
+
N ? i !== void 0 && C && C() : x(!0);
|
|
63
|
+
}, w = () => {
|
|
64
|
+
x(!1);
|
|
65
|
+
}, E = () => {
|
|
66
|
+
i !== void 0 && C && C();
|
|
67
|
+
}, G = async (d) => {
|
|
68
|
+
if (i) {
|
|
69
|
+
A(!0);
|
|
70
|
+
try {
|
|
71
|
+
await i(d), x(!1);
|
|
72
|
+
} catch (K) {
|
|
73
|
+
console.error(K);
|
|
74
|
+
} finally {
|
|
75
|
+
A(!1);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}, D = [];
|
|
79
|
+
i !== void 0 && (N ? (n !== "" && D.push({
|
|
80
|
+
label: n,
|
|
81
|
+
onClick: w,
|
|
82
|
+
variant: "outline",
|
|
83
|
+
disabled: o || h,
|
|
84
|
+
icon: S
|
|
85
|
+
}), D.push({
|
|
86
|
+
label: o ? "Enregistrement..." : g,
|
|
87
|
+
onClick: E,
|
|
88
|
+
variant: "default",
|
|
89
|
+
disabled: o || h,
|
|
90
|
+
icon: a ? void 0 : T
|
|
91
|
+
})) : D.push({
|
|
92
|
+
label: "Modifier",
|
|
93
|
+
onClick: z,
|
|
94
|
+
variant: "outline",
|
|
95
|
+
icon: I
|
|
96
|
+
}));
|
|
97
|
+
const H = {
|
|
98
|
+
title: u(l),
|
|
99
|
+
maxWidth: k,
|
|
100
|
+
actions: f ? D : []
|
|
101
|
+
};
|
|
102
|
+
return /* @__PURE__ */ e(
|
|
103
|
+
re,
|
|
104
|
+
{
|
|
105
|
+
open: t,
|
|
106
|
+
onOpenChange: (d) => {
|
|
107
|
+
c(d), d || w();
|
|
108
|
+
},
|
|
109
|
+
config: H,
|
|
110
|
+
isLoading: o || h,
|
|
111
|
+
children: /* @__PURE__ */ r("div", { className: "py-4", children: [
|
|
112
|
+
s !== void 0 ? /* @__PURE__ */ e("div", { className: "mb-4", children: s(l) }) : null,
|
|
113
|
+
/* @__PURE__ */ e(
|
|
114
|
+
le,
|
|
115
|
+
{
|
|
116
|
+
schema: p,
|
|
117
|
+
initialData: l,
|
|
118
|
+
disabled: !N,
|
|
119
|
+
onSubmit: (d) => {
|
|
120
|
+
G(d);
|
|
121
|
+
},
|
|
122
|
+
renderActions: !1,
|
|
123
|
+
onRegisterSubmit: (d) => {
|
|
124
|
+
P(() => d);
|
|
125
|
+
},
|
|
126
|
+
isLoading: o || h
|
|
127
|
+
}
|
|
128
|
+
),
|
|
129
|
+
b !== void 0 ? b(l) : null,
|
|
130
|
+
i !== void 0 && !f ? /* @__PURE__ */ e("div", { className: "flex justify-end gap-2 border-t pt-4 mt-6", children: N ? /* @__PURE__ */ r(M, { children: [
|
|
131
|
+
n !== "" ? /* @__PURE__ */ r(v, { onClick: w, variant: "outline", size: "sm", disabled: o || h, children: [
|
|
132
|
+
/* @__PURE__ */ e(S, { className: "size-4 mr-2" }),
|
|
133
|
+
n
|
|
134
|
+
] }) : null,
|
|
135
|
+
/* @__PURE__ */ r(v, { onClick: E, size: "sm", disabled: o || h, className: "text-white", children: [
|
|
136
|
+
a ? null : /* @__PURE__ */ e(T, { className: "size-4 mr-2" }),
|
|
137
|
+
o ? "Enregistrement..." : g
|
|
138
|
+
] })
|
|
139
|
+
] }) : /* @__PURE__ */ r(v, { onClick: z, variant: "outline", size: "sm", children: [
|
|
140
|
+
/* @__PURE__ */ e(I, { className: "size-4 mr-2" }),
|
|
141
|
+
"Modifier"
|
|
142
|
+
] }) }) : null
|
|
143
|
+
] })
|
|
144
|
+
}
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
function De({ isLoading: t, error: c, config: l, destructive: u = !1 }) {
|
|
148
|
+
const { t: s } = O();
|
|
149
|
+
if (!l) return null;
|
|
150
|
+
const p = (i) => {
|
|
151
|
+
!i && !t && l.onClose();
|
|
152
|
+
};
|
|
153
|
+
return /* @__PURE__ */ e(J, { open: l.isOpen, onOpenChange: p, children: /* @__PURE__ */ r(Q, { children: [
|
|
154
|
+
/* @__PURE__ */ r(F, { children: [
|
|
155
|
+
/* @__PURE__ */ r(U, { className: l.titleClassName, children: [
|
|
156
|
+
l.icon && /* @__PURE__ */ e(l.icon, { className: "size-4" }),
|
|
157
|
+
s(l.title)
|
|
158
|
+
] }),
|
|
159
|
+
l.headerClassName && /* @__PURE__ */ e(F, { className: l.headerClassName }),
|
|
160
|
+
/* @__PURE__ */ e(j, { children: s(l.description) }),
|
|
161
|
+
l.itemName && /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e("span", { className: "font-semibold block my-2", children: l.itemName }) })
|
|
162
|
+
] }),
|
|
163
|
+
/* @__PURE__ */ e(ie, { error: c instanceof Error ? null : c }),
|
|
164
|
+
/* @__PURE__ */ r(V, { children: [
|
|
165
|
+
/* @__PURE__ */ e(Y, { disabled: t, children: s("common.buttons.cancel") }),
|
|
166
|
+
/* @__PURE__ */ e(
|
|
167
|
+
v,
|
|
168
|
+
{
|
|
169
|
+
onClick: (i) => {
|
|
170
|
+
i.preventDefault(), l.onConfirm();
|
|
171
|
+
},
|
|
172
|
+
disabled: t,
|
|
173
|
+
className: u ? "bg-destructive text-destructive-foreground hover:bg-destructive/90" : "",
|
|
174
|
+
children: t ? s(l.loadingKey || "common.buttons.loading") : l.confirmKey
|
|
175
|
+
}
|
|
176
|
+
)
|
|
177
|
+
] })
|
|
178
|
+
] }) });
|
|
179
|
+
}
|
|
180
|
+
export {
|
|
181
|
+
re as A,
|
|
182
|
+
De as C,
|
|
183
|
+
Ce as F
|
|
184
|
+
};
|