@krosoft/react 0.0.87 → 0.0.89
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/{AppSubTitle-DaFa30Qp.js → AppSubTitle-RKbtrPJr.js} +1 -1
- package/dist/{AppTitle-COtcNGNr.js → AppTitle-DCQpP2qE.js} +27 -27
- package/dist/AppVerticalTabs-pK3i9ZTD.js +110 -0
- package/dist/FormDialog-CXLQG83d.js +250 -0
- package/dist/{MetricCard-L5ETuqBs.js → MetricCard-DB1ME6tD.js} +3 -3
- package/dist/{SearchInput-BxnaShYy.js → SearchInput-D_SLIZ2y.js} +37 -37
- package/dist/{TableFilter-RzydxKBF.js → TableFilter-DXTOY-oa.js} +22 -22
- package/dist/{TableSettings-Bwysm3KH.js → TableSettings-CBtuAPgM.js} +27 -27
- package/dist/{ThemeSelector-mZBbr2qt.js → ThemeSelector-CU8JmN2b.js} +14 -15
- package/dist/{Topbar-DzFClMWt.js → Topbar-BzZxu1Zi.js} +28 -29
- package/dist/{badge-DCS7KMnM.js → badge-DyRSpnOb.js} +3 -3
- package/dist/components/core/cards/index.js +1 -1
- package/dist/components/core/dialogs/index.js +12 -11
- package/dist/components/core/filters/index.js +1 -1
- package/dist/components/core/index.js +55 -54
- package/dist/components/core/inputs/index.js +1 -1
- package/dist/components/core/layouts/index.js +2 -2
- package/dist/components/core/navbar/index.js +1 -1
- 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 +136 -108
- package/dist/components/ui/index.d.ts +8 -0
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +89 -50
- package/dist/ellipsis-vertical-CqrunffH.js +15 -0
- package/dist/{select-C6w0ck7-.js → select-B5wF6jxC.js} +6 -6
- package/dist/skeleton-CJ1F2tD3.js +8 -0
- package/dist/tabs-BYqvMsA6.js +6628 -0
- package/dist/tooltip-BzTGwm2E.js +2505 -0
- package/package.json +2 -2
- package/dist/AppVerticalTabs-aeKDheVe.js +0 -829
- package/dist/FormDialog-B3u7bHU_.js +0 -472
- package/dist/dropdown-menu-BDcm9kW8.js +0 -1086
- package/dist/index-DUnCfjrC.js +0 -2176
- package/dist/popover-PsZp711z.js +0 -4533
- package/dist/tooltip-CtjaR1qq.js +0 -337
|
@@ -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 "./AppTitle-
|
|
3
|
+
import { A as m } from "./AppTitle-DCQpP2qE.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,20 +1,20 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import "./
|
|
3
|
-
import { B as
|
|
1
|
+
import { jsxs as a, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { m as c, B as b, o as f, v as h, q as u } from "./tabs-BYqvMsA6.js";
|
|
3
|
+
import { B as p } from "./tooltip-BzTGwm2E.js";
|
|
4
4
|
import "./card-7XPLAra3.js";
|
|
5
5
|
import { c as d } from "./index-gWiv5-6R.js";
|
|
6
|
-
import "./select-
|
|
7
|
-
import { D as c, a as b, E as h, b as f, c as x, d as p } from "./dropdown-menu-BDcm9kW8.js";
|
|
6
|
+
import "./select-B5wF6jxC.js";
|
|
8
7
|
import { u as v } from "./useMobile-DN1_OMDB.js";
|
|
9
8
|
import { useTranslation as N } from "react-i18next";
|
|
10
|
-
|
|
9
|
+
import { E as x } from "./ellipsis-vertical-CqrunffH.js";
|
|
10
|
+
function j({ actions: m, className: o }) {
|
|
11
11
|
const { t: i } = N(), t = v();
|
|
12
|
-
return !m || m.length === 0 ? null : t ? /* @__PURE__ */
|
|
13
|
-
/* @__PURE__ */ l(b, { asChild: !0, children: /* @__PURE__ */ l(
|
|
14
|
-
/* @__PURE__ */ l(f, { align: "end", className: "min-w-48", children: m.map((r, e) => r ? r.children && r.children.length > 0 ? /* @__PURE__ */
|
|
15
|
-
e > 0 && /* @__PURE__ */ l(
|
|
16
|
-
r.children.map((s,
|
|
17
|
-
|
|
12
|
+
return !m || m.length === 0 ? null : t ? /* @__PURE__ */ a(c, { children: [
|
|
13
|
+
/* @__PURE__ */ l(b, { asChild: !0, children: /* @__PURE__ */ l(p, { variant: "outline", size: "icon", children: /* @__PURE__ */ l(x, { className: "size-4" }) }) }),
|
|
14
|
+
/* @__PURE__ */ l(f, { align: "end", className: "min-w-48", children: m.map((r, e) => r ? r.children && r.children.length > 0 ? /* @__PURE__ */ a("div", { children: [
|
|
15
|
+
e > 0 && /* @__PURE__ */ l(h, {}),
|
|
16
|
+
r.children.map((s, n) => s ? /* @__PURE__ */ a(
|
|
17
|
+
u,
|
|
18
18
|
{
|
|
19
19
|
onClick: () => void s.onClick(),
|
|
20
20
|
disabled: s.disabled,
|
|
@@ -24,32 +24,32 @@ function B({ actions: m, className: o }) {
|
|
|
24
24
|
s.labelKey && i(s.labelKey)
|
|
25
25
|
]
|
|
26
26
|
},
|
|
27
|
-
|
|
27
|
+
n
|
|
28
28
|
) : null)
|
|
29
|
-
] }, e) : /* @__PURE__ */
|
|
29
|
+
] }, e) : /* @__PURE__ */ a(u, { onClick: () => void r.onClick(), disabled: r.disabled, className: d("gap-2", r.className), children: [
|
|
30
30
|
r.icon && /* @__PURE__ */ l(r.icon, { className: "size-4" }),
|
|
31
31
|
r.labelKey && i(r.labelKey)
|
|
32
32
|
] }, e) : null) })
|
|
33
|
-
] }) : ((r) => /* @__PURE__ */ l("div", { className: d("flex gap-2", o), children: r.map((e, s) => e ? e.children && e.children.length > 0 ? /* @__PURE__ */
|
|
34
|
-
/* @__PURE__ */ l(b, { asChild: !0, children: /* @__PURE__ */
|
|
33
|
+
] }) : ((r) => /* @__PURE__ */ l("div", { className: d("flex gap-2", o), children: r.map((e, s) => e ? e.children && e.children.length > 0 ? /* @__PURE__ */ a(c, { children: [
|
|
34
|
+
/* @__PURE__ */ l(b, { asChild: !0, children: /* @__PURE__ */ a(p, { variant: e.variant, disabled: e.disabled, className: d("gap-2", e.className), children: [
|
|
35
35
|
e.icon && /* @__PURE__ */ l(e.icon, { className: "size-4" }),
|
|
36
36
|
e.labelKey && i(e.labelKey)
|
|
37
37
|
] }) }),
|
|
38
|
-
/* @__PURE__ */ l(f, { align: "end", children: e.children.map((
|
|
39
|
-
|
|
38
|
+
/* @__PURE__ */ l(f, { align: "end", children: e.children.map((n, g) => n ? /* @__PURE__ */ a(
|
|
39
|
+
u,
|
|
40
40
|
{
|
|
41
|
-
onClick: () => void
|
|
42
|
-
disabled:
|
|
43
|
-
className: d("gap-2",
|
|
41
|
+
onClick: () => void n.onClick(),
|
|
42
|
+
disabled: n.disabled,
|
|
43
|
+
className: d("gap-2", n.className),
|
|
44
44
|
children: [
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
n.icon && /* @__PURE__ */ l(n.icon, { className: "size-4" }),
|
|
46
|
+
n.labelKey && i(n.labelKey)
|
|
47
47
|
]
|
|
48
48
|
},
|
|
49
49
|
g
|
|
50
50
|
) : null) })
|
|
51
|
-
] }, s) : /* @__PURE__ */
|
|
52
|
-
|
|
51
|
+
] }, s) : /* @__PURE__ */ a(
|
|
52
|
+
p,
|
|
53
53
|
{
|
|
54
54
|
variant: e.variant,
|
|
55
55
|
onClick: () => void e.onClick(),
|
|
@@ -65,12 +65,12 @@ function B({ actions: m, className: o }) {
|
|
|
65
65
|
}
|
|
66
66
|
function E({ titleKey: m, descriptionKey: o, isSubTitle: i }) {
|
|
67
67
|
const { t } = N();
|
|
68
|
-
return /* @__PURE__ */
|
|
68
|
+
return /* @__PURE__ */ a("div", { className: "flex flex-col gap-1", children: [
|
|
69
69
|
/* @__PURE__ */ l("h1", { className: i ? "text-xl md:text-2xl font-semibold" : "text-xl md:text-3xl font-bold", children: t(m) ?? "" }),
|
|
70
70
|
o ? /* @__PURE__ */ l("p", { className: d("text-muted-foreground", i && "text-sm"), children: t(o) }) : null
|
|
71
71
|
] });
|
|
72
72
|
}
|
|
73
73
|
export {
|
|
74
|
-
|
|
74
|
+
j as A,
|
|
75
75
|
E as a
|
|
76
76
|
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { jsxs as n, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { C as v, d as g, a as y } from "./card-7XPLAra3.js";
|
|
3
|
+
import { a as N, A as w } from "./AppTitle-DCQpP2qE.js";
|
|
4
|
+
import { X as S, Z as T, _ as C, Y as k, S as b } from "./tabs-BYqvMsA6.js";
|
|
5
|
+
import { useTranslation as x } from "react-i18next";
|
|
6
|
+
import { useSearchParams as f } from "react-router-dom";
|
|
7
|
+
import { c as A } from "./index-gWiv5-6R.js";
|
|
8
|
+
import { S as P, h as j, i as z, a as M, c as L } from "./select-B5wF6jxC.js";
|
|
9
|
+
import { c as V } from "./createLucideIcon-CRdjzt2A.js";
|
|
10
|
+
/**
|
|
11
|
+
* @license lucide-react v1.16.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 K = [
|
|
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", K);
|
|
26
|
+
function _({ titleKey: s, descriptionKey: l, actions: t = [], className: c }) {
|
|
27
|
+
return /* @__PURE__ */ n("div", { className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between", children: [
|
|
28
|
+
/* @__PURE__ */ a(N, { titleKey: s, descriptionKey: l, isSubTitle: !0 }),
|
|
29
|
+
/* @__PURE__ */ a(w, { actions: t, className: c })
|
|
30
|
+
] });
|
|
31
|
+
}
|
|
32
|
+
function $({ titleKey: s, descriptionKey: l, actions: t = [], className: c, children: o, isSubTitle: i }) {
|
|
33
|
+
return /* @__PURE__ */ n(v, { children: [
|
|
34
|
+
/* @__PURE__ */ a(g, { children: /* @__PURE__ */ a(_, { titleKey: s, descriptionKey: l, actions: t, className: c }) }),
|
|
35
|
+
/* @__PURE__ */ a(y, { className: "space-y-4", children: o })
|
|
36
|
+
] });
|
|
37
|
+
}
|
|
38
|
+
function B({ tabs: s, itemId: l, item: t, fit: c }) {
|
|
39
|
+
var m;
|
|
40
|
+
const { t: o } = x(), [i, d] = f(), h = i.get("tab") || ((m = s[0]) == null ? void 0 : m.value);
|
|
41
|
+
return /* @__PURE__ */ n(S, { value: h, onValueChange: (e) => {
|
|
42
|
+
const r = new URLSearchParams();
|
|
43
|
+
r.set("tab", e), d(r);
|
|
44
|
+
}, children: [
|
|
45
|
+
/* @__PURE__ */ a(T, { className: A("w-full justify-start", c && "sm:w-fit"), children: s.map((e) => /* @__PURE__ */ n(C, { value: e.value, className: "gap-2", disabled: e.disabled, children: [
|
|
46
|
+
e.icon ? /* @__PURE__ */ a("span", { className: "hidden sm:inline", children: /* @__PURE__ */ a(e.icon, { className: "size-4" }) }) : null,
|
|
47
|
+
/* @__PURE__ */ a("span", { className: "text-xs sm:text-sm", children: o(e.titleKey) ?? "" }),
|
|
48
|
+
e.count ? /* @__PURE__ */ n("span", { className: "text-gray-500 text-xs", children: [
|
|
49
|
+
"(",
|
|
50
|
+
e.count(t),
|
|
51
|
+
")"
|
|
52
|
+
] }) : null
|
|
53
|
+
] }, e.value)) }),
|
|
54
|
+
s.map((e) => /* @__PURE__ */ a(k, { value: e.value, className: "mt-4", children: e.component ? e.component(l) : null }, e.value))
|
|
55
|
+
] });
|
|
56
|
+
}
|
|
57
|
+
const E = ({ tabs: s, item: l }) => {
|
|
58
|
+
var m;
|
|
59
|
+
const { t } = x(), [c, o] = f(), i = c.get("tab") || ((m = s[0]) == null ? void 0 : m.value), d = (e) => {
|
|
60
|
+
const r = new URLSearchParams();
|
|
61
|
+
r.set("tab", e), o(r);
|
|
62
|
+
}, h = () => {
|
|
63
|
+
const e = s.find((r) => r.value === i);
|
|
64
|
+
return e ? e.component ? e.component() : u() : null;
|
|
65
|
+
}, u = () => /* @__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
|
+
/* @__PURE__ */ a(p, { className: "h-12 w-12 mx-auto mb-4 text-amber-500" }),
|
|
67
|
+
/* @__PURE__ */ a("p", { className: "text-lg font-medium", children: "Section en cours de développement" }),
|
|
68
|
+
/* @__PURE__ */ a("p", { className: "text-sm text-gray-400", children: "Cette fonctionnalité sera bientôt disponible" })
|
|
69
|
+
] }) }) });
|
|
70
|
+
return /* @__PURE__ */ n("div", { className: "flex flex-col md:flex-row h-full min-w-0 ", children: [
|
|
71
|
+
/* @__PURE__ */ a("div", { className: "w-64 lg:w-80 flex-shrink-0 hidden md:block border-r border-gray-200 dark:border-gray-700 pr-4", children: /* @__PURE__ */ a(b, { className: "h-full", children: /* @__PURE__ */ a("div", { className: "space-y-1", children: s.map((e, r) => /* @__PURE__ */ n(
|
|
72
|
+
"div",
|
|
73
|
+
{
|
|
74
|
+
className: `px-2 py-2 rounded-2xl text-sm transition-colors flex items-center gap-2 ${e.disabled ? "text-gray-400 cursor-not-allowed opacity-50" : i === e.value ? "crm-color-styled font-medium cursor-pointer" : "text-gray-600 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700 cursor-pointer"}`,
|
|
75
|
+
onClick: () => !e.disabled && d(e.value),
|
|
76
|
+
children: [
|
|
77
|
+
e.icon && /* @__PURE__ */ a(e.icon, { className: "size-4" }),
|
|
78
|
+
/* @__PURE__ */ a("span", { className: "flex-1", children: t(e.titleKey) }),
|
|
79
|
+
e.count && /* @__PURE__ */ n("span", { className: "text-xs text-gray-500", children: [
|
|
80
|
+
"(",
|
|
81
|
+
e.count(l),
|
|
82
|
+
")"
|
|
83
|
+
] }),
|
|
84
|
+
!e.component && /* @__PURE__ */ a(p, { className: "size-4 text-amber-500" })
|
|
85
|
+
]
|
|
86
|
+
},
|
|
87
|
+
r
|
|
88
|
+
)) }) }) }),
|
|
89
|
+
/* @__PURE__ */ a("div", { className: "md:hidden w-full border-b pb-4 mb-4", children: /* @__PURE__ */ n(P, { value: i, onValueChange: d, children: [
|
|
90
|
+
/* @__PURE__ */ a(j, { className: "w-full", children: /* @__PURE__ */ a(z, { placeholder: "Sélectionner une section" }) }),
|
|
91
|
+
/* @__PURE__ */ a(M, { children: s.map((e, r) => /* @__PURE__ */ a(L, { value: e.value, disabled: e.disabled, children: /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
|
|
92
|
+
e.icon && /* @__PURE__ */ a(e.icon, { className: "size-4" }),
|
|
93
|
+
/* @__PURE__ */ a("span", { children: t(e.titleKey) }),
|
|
94
|
+
e.count && /* @__PURE__ */ n("span", { className: "text-xs text-gray-500", children: [
|
|
95
|
+
"(",
|
|
96
|
+
e.count(l),
|
|
97
|
+
")"
|
|
98
|
+
] }),
|
|
99
|
+
!e.component && /* @__PURE__ */ a(p, { className: "size-4 text-amber-500" })
|
|
100
|
+
] }) }, r)) })
|
|
101
|
+
] }) }),
|
|
102
|
+
/* @__PURE__ */ a("div", { className: "flex-1 md:px-4 min-w-0 overflow-auto", children: h() })
|
|
103
|
+
] });
|
|
104
|
+
};
|
|
105
|
+
export {
|
|
106
|
+
$ as A,
|
|
107
|
+
_ as a,
|
|
108
|
+
B as b,
|
|
109
|
+
E as c
|
|
110
|
+
};
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { jsx as i, jsxs as a, Fragment as W } from "react/jsx-runtime";
|
|
2
|
+
import { D as q, b as B, P as X, e as G, h as K, c as L, A as Q, j as R, a6 as $, L as U, I as Y } from "./tabs-BYqvMsA6.js";
|
|
3
|
+
import { B as A } from "./tooltip-BzTGwm2E.js";
|
|
4
|
+
import "./card-7XPLAra3.js";
|
|
5
|
+
import "./select-B5wF6jxC.js";
|
|
6
|
+
import { useTranslation as Z } from "react-i18next";
|
|
7
|
+
import { c as _ } from "./createLucideIcon-CRdjzt2A.js";
|
|
8
|
+
import { useState as M, useEffect as ee } from "react";
|
|
9
|
+
/**
|
|
10
|
+
* @license lucide-react v1.16.0 - ISC
|
|
11
|
+
*
|
|
12
|
+
* This source code is licensed under the ISC license.
|
|
13
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
14
|
+
*/
|
|
15
|
+
const ie = [
|
|
16
|
+
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
17
|
+
["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
|
|
18
|
+
["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
|
|
19
|
+
], le = _("circle-alert", ie);
|
|
20
|
+
/**
|
|
21
|
+
* @license lucide-react v1.16.0 - ISC
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the ISC license.
|
|
24
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/
|
|
26
|
+
const re = [
|
|
27
|
+
[
|
|
28
|
+
"path",
|
|
29
|
+
{
|
|
30
|
+
d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
|
|
31
|
+
key: "1a8usu"
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
], H = _("pen", re);
|
|
35
|
+
/**
|
|
36
|
+
* @license lucide-react v1.16.0 - ISC
|
|
37
|
+
*
|
|
38
|
+
* This source code is licensed under the ISC license.
|
|
39
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
40
|
+
*/
|
|
41
|
+
const ae = [
|
|
42
|
+
[
|
|
43
|
+
"path",
|
|
44
|
+
{
|
|
45
|
+
d: "M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",
|
|
46
|
+
key: "1c8476"
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
["path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7", key: "1ydtos" }],
|
|
50
|
+
["path", { d: "M7 3v4a1 1 0 0 0 1 1h7", key: "t51u73" }]
|
|
51
|
+
], P = _("save", ae);
|
|
52
|
+
function ne({ open: g, onOpenChange: j, config: n, isLoading: b, error: m, children: z }) {
|
|
53
|
+
const { t: s } = Z(), { title: x, description: d, icon: h, maxWidth: N = "sm:max-w-xl", actions: o } = n;
|
|
54
|
+
return /* @__PURE__ */ i(q, { open: g, onOpenChange: j, children: /* @__PURE__ */ a(B, { className: `${N} max-h-[90vh] border-0 shadow-2xl p-0 flex flex-col overflow-hidden`, children: [
|
|
55
|
+
b === !0 ? /* @__PURE__ */ i("div", { className: "absolute top-0 left-0 right-0 z-10", children: /* @__PURE__ */ i(X, { indeterminate: !0, className: "h-1 rounded-none" }) }) : null,
|
|
56
|
+
/* @__PURE__ */ a(G, { className: "bg-gradient-to-r from-slate-900 to-purple-700 p-6 rounded-t-lg shrink-0", children: [
|
|
57
|
+
/* @__PURE__ */ a(K, { className: "text-2xl font-bold flex items-center gap-2 text-white", children: [
|
|
58
|
+
h !== void 0 ? /* @__PURE__ */ i("div", { className: "p-2 bg-white/20 rounded-lg", children: /* @__PURE__ */ i(h, { className: "size-4 text-white" }) }) : null,
|
|
59
|
+
s(x)
|
|
60
|
+
] }),
|
|
61
|
+
d !== void 0 && d !== "" ? /* @__PURE__ */ i(L, { className: "text-indigo-100 text-base", children: s(d) }) : null
|
|
62
|
+
] }),
|
|
63
|
+
m != null ? /* @__PURE__ */ i("div", { className: "px-6 ", children: /* @__PURE__ */ a(Q, { variant: "destructive", className: "max-w-full", children: [
|
|
64
|
+
/* @__PURE__ */ i(le, { className: "size-4" }),
|
|
65
|
+
/* @__PURE__ */ i(R, { className: "break-words overflow-wrap-anywhere max-w-full", children: m.message })
|
|
66
|
+
] }) }) : null,
|
|
67
|
+
/* @__PURE__ */ i("div", { className: "flex-1 overflow-y-auto px-6 ", children: z }),
|
|
68
|
+
o !== void 0 && o.length > 0 ? /* @__PURE__ */ i("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__ */ i("div", { className: "flex justify-end gap-3", children: o.map((t, E) => /* @__PURE__ */ a(A, { variant: t.variant ?? "default", onClick: t.onClick, disabled: t.disabled === !0 || b === !0, children: [
|
|
69
|
+
t.icon !== void 0 ? /* @__PURE__ */ i(t.icon, { className: "size-4" }) : null,
|
|
70
|
+
s(t.label)
|
|
71
|
+
] }, E)) }) }) : null
|
|
72
|
+
] }) });
|
|
73
|
+
}
|
|
74
|
+
function he({
|
|
75
|
+
open: g,
|
|
76
|
+
onOpenChange: j,
|
|
77
|
+
data: n,
|
|
78
|
+
title: b,
|
|
79
|
+
headerBadge: m,
|
|
80
|
+
sections: z,
|
|
81
|
+
onSave: s,
|
|
82
|
+
customFooter: x,
|
|
83
|
+
defaultEditing: d = !1,
|
|
84
|
+
footerActions: h = !0,
|
|
85
|
+
saveLabel: N = "Sauvegarder",
|
|
86
|
+
cancelLabel: o = "Annuler",
|
|
87
|
+
hideSaveIcon: t = !1,
|
|
88
|
+
maxWidth: E = "sm:max-w-4xl"
|
|
89
|
+
}) {
|
|
90
|
+
const [k, f] = M(d), [p, v] = M({}), [c, w] = M(!1);
|
|
91
|
+
if (ee(() => {
|
|
92
|
+
g && f(d);
|
|
93
|
+
}, [g, d]), n == null) return null;
|
|
94
|
+
const F = async () => {
|
|
95
|
+
if (k) {
|
|
96
|
+
if (s !== void 0) {
|
|
97
|
+
w(!0);
|
|
98
|
+
try {
|
|
99
|
+
await s(p), f(!1), v({});
|
|
100
|
+
} catch (e) {
|
|
101
|
+
console.error(e);
|
|
102
|
+
} finally {
|
|
103
|
+
w(!1);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
} else
|
|
107
|
+
f(!0), v({});
|
|
108
|
+
}, V = () => {
|
|
109
|
+
f(!1), v({});
|
|
110
|
+
}, I = async () => {
|
|
111
|
+
if (s !== void 0) {
|
|
112
|
+
w(!0);
|
|
113
|
+
try {
|
|
114
|
+
await s(p), f(!1), v({});
|
|
115
|
+
} catch (e) {
|
|
116
|
+
console.error(e);
|
|
117
|
+
} finally {
|
|
118
|
+
w(!1);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}, S = (e, l) => {
|
|
122
|
+
v((u) => ({ ...u, [e]: l }));
|
|
123
|
+
}, T = (e) => {
|
|
124
|
+
if (k && s !== void 0) {
|
|
125
|
+
if (e.renderEdit !== void 0)
|
|
126
|
+
return e.renderEdit(n, p, (r) => {
|
|
127
|
+
S(e.key, r);
|
|
128
|
+
});
|
|
129
|
+
let y = "";
|
|
130
|
+
if (p[e.key] !== void 0)
|
|
131
|
+
y = p[e.key];
|
|
132
|
+
else if (e.getEditValue !== void 0)
|
|
133
|
+
y = e.getEditValue(n);
|
|
134
|
+
else {
|
|
135
|
+
const r = n[e.key];
|
|
136
|
+
y = r != null && String(r) !== "" ? String(r) : "";
|
|
137
|
+
}
|
|
138
|
+
return /* @__PURE__ */ i(
|
|
139
|
+
Y,
|
|
140
|
+
{
|
|
141
|
+
value: y,
|
|
142
|
+
onChange: (r) => {
|
|
143
|
+
S(e.key, r.target.value);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
if (e.renderView !== void 0)
|
|
149
|
+
return e.renderView(n);
|
|
150
|
+
const l = n[e.key];
|
|
151
|
+
let u = "Non renseigné";
|
|
152
|
+
return Array.isArray(l) ? l.length > 0 && (u = l.map((r) => {
|
|
153
|
+
if (typeof r == "object" && r !== null) {
|
|
154
|
+
const D = r;
|
|
155
|
+
return typeof D.name == "string" ? D.name : typeof D.label == "string" ? D.label : JSON.stringify(r);
|
|
156
|
+
}
|
|
157
|
+
return String(r);
|
|
158
|
+
}).join(", ")) : typeof l == "object" && l !== null ? u = JSON.stringify(l) : (typeof l == "string" || typeof l == "number" || typeof l == "boolean") && (u = String(l)), /* @__PURE__ */ i("div", { className: "p-2 bg-gray-50 dark:bg-gray-900 rounded border border-transparent min-h-[36px] flex items-center", children: u });
|
|
159
|
+
}, J = (e) => /* @__PURE__ */ a("div", { className: `col-span-1 ${e.fullWidth === !0 ? "md:col-span-2" : ""}`, children: [
|
|
160
|
+
/* @__PURE__ */ i(U, { className: "mb-1 block text-sm font-medium", children: e.label }),
|
|
161
|
+
T(e)
|
|
162
|
+
] }, e.key), C = [];
|
|
163
|
+
s !== void 0 && (k ? (o !== "" && C.push({
|
|
164
|
+
label: o,
|
|
165
|
+
onClick: V,
|
|
166
|
+
variant: "outline",
|
|
167
|
+
disabled: c,
|
|
168
|
+
icon: $
|
|
169
|
+
}), C.push({
|
|
170
|
+
label: c ? "Enregistrement..." : N,
|
|
171
|
+
onClick: () => {
|
|
172
|
+
I();
|
|
173
|
+
},
|
|
174
|
+
variant: "default",
|
|
175
|
+
disabled: c,
|
|
176
|
+
icon: t ? void 0 : P
|
|
177
|
+
})) : C.push({
|
|
178
|
+
label: "Modifier",
|
|
179
|
+
onClick: () => {
|
|
180
|
+
F();
|
|
181
|
+
},
|
|
182
|
+
variant: "outline",
|
|
183
|
+
icon: H
|
|
184
|
+
}));
|
|
185
|
+
const O = {
|
|
186
|
+
title: b(n),
|
|
187
|
+
maxWidth: E,
|
|
188
|
+
actions: h ? C : []
|
|
189
|
+
};
|
|
190
|
+
return /* @__PURE__ */ i(
|
|
191
|
+
ne,
|
|
192
|
+
{
|
|
193
|
+
open: g,
|
|
194
|
+
onOpenChange: (e) => {
|
|
195
|
+
j(e), e || V();
|
|
196
|
+
},
|
|
197
|
+
config: O,
|
|
198
|
+
isLoading: c,
|
|
199
|
+
children: /* @__PURE__ */ a("div", { className: "py-4", children: [
|
|
200
|
+
m !== void 0 ? /* @__PURE__ */ i("div", { className: "mb-4", children: m(n) }) : null,
|
|
201
|
+
/* @__PURE__ */ i("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6 items-start", children: z.map((e, l) => /* @__PURE__ */ a("div", { className: "space-y-4", children: [
|
|
202
|
+
/* @__PURE__ */ a("div", { className: "flex items-center gap-2 mb-4", children: [
|
|
203
|
+
e.icon,
|
|
204
|
+
/* @__PURE__ */ i("h3", { className: "text-lg font-semibold", children: e.title })
|
|
205
|
+
] }),
|
|
206
|
+
/* @__PURE__ */ i("div", { className: "grid grid-cols-1 gap-4", children: e.fields.map(J) })
|
|
207
|
+
] }, l)) }),
|
|
208
|
+
x !== void 0 ? x(n) : null,
|
|
209
|
+
s !== void 0 && !h ? /* @__PURE__ */ i("div", { className: "flex justify-end gap-2 border-t pt-4 mt-6", children: k ? /* @__PURE__ */ a(W, { children: [
|
|
210
|
+
o !== "" ? /* @__PURE__ */ a(A, { onClick: V, variant: "outline", size: "sm", disabled: c, children: [
|
|
211
|
+
/* @__PURE__ */ i($, { className: "h-4 w-4 mr-2" }),
|
|
212
|
+
o
|
|
213
|
+
] }) : null,
|
|
214
|
+
/* @__PURE__ */ a(
|
|
215
|
+
A,
|
|
216
|
+
{
|
|
217
|
+
onClick: () => {
|
|
218
|
+
I();
|
|
219
|
+
},
|
|
220
|
+
size: "sm",
|
|
221
|
+
disabled: c,
|
|
222
|
+
className: "text-white",
|
|
223
|
+
children: [
|
|
224
|
+
t ? null : /* @__PURE__ */ i(P, { className: "h-4 w-4 mr-2" }),
|
|
225
|
+
c ? "Enregistrement..." : N
|
|
226
|
+
]
|
|
227
|
+
}
|
|
228
|
+
)
|
|
229
|
+
] }) : /* @__PURE__ */ a(
|
|
230
|
+
A,
|
|
231
|
+
{
|
|
232
|
+
onClick: () => {
|
|
233
|
+
F();
|
|
234
|
+
},
|
|
235
|
+
variant: "outline",
|
|
236
|
+
size: "sm",
|
|
237
|
+
children: [
|
|
238
|
+
/* @__PURE__ */ i(H, { className: "h-4 w-4 mr-2" }),
|
|
239
|
+
"Modifier"
|
|
240
|
+
]
|
|
241
|
+
}
|
|
242
|
+
) }) : null
|
|
243
|
+
] })
|
|
244
|
+
}
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
export {
|
|
248
|
+
ne as A,
|
|
249
|
+
he as F
|
|
250
|
+
};
|
|
@@ -2,10 +2,10 @@ import { jsxs as s, jsx as e } from "react/jsx-runtime";
|
|
|
2
2
|
import { formatNumber as h } from "@krosoft/core/helpers";
|
|
3
3
|
import { useTranslation as b } from "react-i18next";
|
|
4
4
|
import { c as d } from "./index-gWiv5-6R.js";
|
|
5
|
-
import "./
|
|
6
|
-
import "./
|
|
5
|
+
import "./tabs-BYqvMsA6.js";
|
|
6
|
+
import "./tooltip-BzTGwm2E.js";
|
|
7
7
|
import { C as x, d as N, e as g, a as f } from "./card-7XPLAra3.js";
|
|
8
|
-
import "./select-
|
|
8
|
+
import "./select-B5wF6jxC.js";
|
|
9
9
|
const v = ({
|
|
10
10
|
titleKey: r,
|
|
11
11
|
value: t,
|