@krosoft/react 0.0.88 → 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 +1 -1
- 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,472 +0,0 @@
|
|
|
1
|
-
import { jsx as a, jsxs as u, Fragment as me } from "react/jsx-runtime";
|
|
2
|
-
import { O as J, v as fe, w as W, x as q, X as I, y as U, D as K, R as pe, z as ge, A as ve, a as he, L as ye, I as xe } from "./popover-PsZp711z.js";
|
|
3
|
-
import { p as Ne, B as A } from "./index-DUnCfjrC.js";
|
|
4
|
-
import "./card-7XPLAra3.js";
|
|
5
|
-
import "./select-C6w0ck7-.js";
|
|
6
|
-
import { useTranslation as be } from "react-i18next";
|
|
7
|
-
import { c as b } from "./index-gWiv5-6R.js";
|
|
8
|
-
import * as v from "react";
|
|
9
|
-
import { useState as z, useEffect as we } from "react";
|
|
10
|
-
import "react-dom";
|
|
11
|
-
import { c as V } from "./createLucideIcon-CRdjzt2A.js";
|
|
12
|
-
/**
|
|
13
|
-
* @license lucide-react v1.16.0 - ISC
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the ISC license.
|
|
16
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/
|
|
18
|
-
const ke = [
|
|
19
|
-
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
20
|
-
["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
|
|
21
|
-
["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
|
|
22
|
-
], Ce = V("circle-alert", ke);
|
|
23
|
-
/**
|
|
24
|
-
* @license lucide-react v1.16.0 - ISC
|
|
25
|
-
*
|
|
26
|
-
* This source code is licensed under the ISC license.
|
|
27
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
28
|
-
*/
|
|
29
|
-
const Pe = [
|
|
30
|
-
[
|
|
31
|
-
"path",
|
|
32
|
-
{
|
|
33
|
-
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",
|
|
34
|
-
key: "1a8usu"
|
|
35
|
-
}
|
|
36
|
-
]
|
|
37
|
-
], L = V("pen", Pe);
|
|
38
|
-
/**
|
|
39
|
-
* @license lucide-react v1.16.0 - ISC
|
|
40
|
-
*
|
|
41
|
-
* This source code is licensed under the ISC license.
|
|
42
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
43
|
-
*/
|
|
44
|
-
const De = [
|
|
45
|
-
[
|
|
46
|
-
"path",
|
|
47
|
-
{
|
|
48
|
-
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",
|
|
49
|
-
key: "1c8476"
|
|
50
|
-
}
|
|
51
|
-
],
|
|
52
|
-
["path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7", key: "1ydtos" }],
|
|
53
|
-
["path", { d: "M7 3v4a1 1 0 0 0 1 1h7", key: "t51u73" }]
|
|
54
|
-
], X = V("save", De);
|
|
55
|
-
function $e(e, t = []) {
|
|
56
|
-
let r = [];
|
|
57
|
-
function d(m, n) {
|
|
58
|
-
const i = v.createContext(n);
|
|
59
|
-
i.displayName = m + "Context";
|
|
60
|
-
const l = r.length;
|
|
61
|
-
r = [...r, n];
|
|
62
|
-
const h = (f) => {
|
|
63
|
-
var N;
|
|
64
|
-
const { scope: c, children: k, ...y } = f, x = ((N = c == null ? void 0 : c[e]) == null ? void 0 : N[l]) || i, C = v.useMemo(() => y, Object.values(y));
|
|
65
|
-
return /* @__PURE__ */ a(x.Provider, { value: C, children: k });
|
|
66
|
-
};
|
|
67
|
-
h.displayName = m + "Provider";
|
|
68
|
-
function w(f, c) {
|
|
69
|
-
var x;
|
|
70
|
-
const k = ((x = c == null ? void 0 : c[e]) == null ? void 0 : x[l]) || i, y = v.useContext(k);
|
|
71
|
-
if (y) return y;
|
|
72
|
-
if (n !== void 0) return n;
|
|
73
|
-
throw new Error(`\`${f}\` must be used within \`${m}\``);
|
|
74
|
-
}
|
|
75
|
-
return [h, w];
|
|
76
|
-
}
|
|
77
|
-
const o = () => {
|
|
78
|
-
const m = r.map((n) => v.createContext(n));
|
|
79
|
-
return function(i) {
|
|
80
|
-
const l = (i == null ? void 0 : i[e]) || m;
|
|
81
|
-
return v.useMemo(
|
|
82
|
-
() => ({ [`__scope${e}`]: { ...i, [e]: l } }),
|
|
83
|
-
[i, l]
|
|
84
|
-
);
|
|
85
|
-
};
|
|
86
|
-
};
|
|
87
|
-
return o.scopeName = e, [d, Se(o, ...t)];
|
|
88
|
-
}
|
|
89
|
-
function Se(...e) {
|
|
90
|
-
const t = e[0];
|
|
91
|
-
if (e.length === 1) return t;
|
|
92
|
-
const r = () => {
|
|
93
|
-
const d = e.map((o) => ({
|
|
94
|
-
useScope: o(),
|
|
95
|
-
scopeName: o.scopeName
|
|
96
|
-
}));
|
|
97
|
-
return function(m) {
|
|
98
|
-
const n = d.reduce((i, { useScope: l, scopeName: h }) => {
|
|
99
|
-
const f = l(m)[`__scope${h}`];
|
|
100
|
-
return { ...i, ...f };
|
|
101
|
-
}, {});
|
|
102
|
-
return v.useMemo(() => ({ [`__scope${t.scopeName}`]: n }), [n]);
|
|
103
|
-
};
|
|
104
|
-
};
|
|
105
|
-
return r.scopeName = t.scopeName, r;
|
|
106
|
-
}
|
|
107
|
-
var _e = [
|
|
108
|
-
"a",
|
|
109
|
-
"button",
|
|
110
|
-
"div",
|
|
111
|
-
"form",
|
|
112
|
-
"h2",
|
|
113
|
-
"h3",
|
|
114
|
-
"img",
|
|
115
|
-
"input",
|
|
116
|
-
"label",
|
|
117
|
-
"li",
|
|
118
|
-
"nav",
|
|
119
|
-
"ol",
|
|
120
|
-
"p",
|
|
121
|
-
"select",
|
|
122
|
-
"span",
|
|
123
|
-
"svg",
|
|
124
|
-
"ul"
|
|
125
|
-
], Q = _e.reduce((e, t) => {
|
|
126
|
-
const r = Ne(`Primitive.${t}`), d = v.forwardRef((o, m) => {
|
|
127
|
-
const { asChild: n, ...i } = o, l = n ? r : t;
|
|
128
|
-
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ a(l, { ...i, ref: m });
|
|
129
|
-
});
|
|
130
|
-
return d.displayName = `Primitive.${t}`, { ...e, [t]: d };
|
|
131
|
-
}, {}), j = "Progress", O = 100, [Ee] = $e(j), [Ae, Me] = Ee(j), Y = v.forwardRef(
|
|
132
|
-
(e, t) => {
|
|
133
|
-
const {
|
|
134
|
-
__scopeProgress: r,
|
|
135
|
-
value: d = null,
|
|
136
|
-
max: o,
|
|
137
|
-
getValueLabel: m = Re,
|
|
138
|
-
...n
|
|
139
|
-
} = e;
|
|
140
|
-
(o || o === 0) && !B(o) && console.error(ze(`${o}`, "Progress"));
|
|
141
|
-
const i = B(o) ? o : O;
|
|
142
|
-
d !== null && !G(d, i) && console.error(Ie(`${d}`, "Progress"));
|
|
143
|
-
const l = G(d, i) ? d : null, h = M(l) ? m(l, i) : void 0;
|
|
144
|
-
return /* @__PURE__ */ a(Ae, { scope: r, value: l, max: i, children: /* @__PURE__ */ a(
|
|
145
|
-
Q.div,
|
|
146
|
-
{
|
|
147
|
-
"aria-valuemax": i,
|
|
148
|
-
"aria-valuemin": 0,
|
|
149
|
-
"aria-valuenow": M(l) ? l : void 0,
|
|
150
|
-
"aria-valuetext": h,
|
|
151
|
-
role: "progressbar",
|
|
152
|
-
"data-state": te(l, i),
|
|
153
|
-
"data-value": l ?? void 0,
|
|
154
|
-
"data-max": i,
|
|
155
|
-
...n,
|
|
156
|
-
ref: t
|
|
157
|
-
}
|
|
158
|
-
) });
|
|
159
|
-
}
|
|
160
|
-
);
|
|
161
|
-
Y.displayName = j;
|
|
162
|
-
var Z = "ProgressIndicator", ee = v.forwardRef(
|
|
163
|
-
(e, t) => {
|
|
164
|
-
const { __scopeProgress: r, ...d } = e, o = Me(Z, r);
|
|
165
|
-
return /* @__PURE__ */ a(
|
|
166
|
-
Q.div,
|
|
167
|
-
{
|
|
168
|
-
"data-state": te(o.value, o.max),
|
|
169
|
-
"data-value": o.value ?? void 0,
|
|
170
|
-
"data-max": o.max,
|
|
171
|
-
...d,
|
|
172
|
-
ref: t
|
|
173
|
-
}
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
);
|
|
177
|
-
ee.displayName = Z;
|
|
178
|
-
function Re(e, t) {
|
|
179
|
-
return `${Math.round(e / t * 100)}%`;
|
|
180
|
-
}
|
|
181
|
-
function te(e, t) {
|
|
182
|
-
return e == null ? "indeterminate" : e === t ? "complete" : "loading";
|
|
183
|
-
}
|
|
184
|
-
function M(e) {
|
|
185
|
-
return typeof e == "number";
|
|
186
|
-
}
|
|
187
|
-
function B(e) {
|
|
188
|
-
return M(e) && !isNaN(e) && e > 0;
|
|
189
|
-
}
|
|
190
|
-
function G(e, t) {
|
|
191
|
-
return M(e) && !isNaN(e) && e <= t && e >= 0;
|
|
192
|
-
}
|
|
193
|
-
function ze(e, t) {
|
|
194
|
-
return `Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${O}\`.`;
|
|
195
|
-
}
|
|
196
|
-
function Ie(e, t) {
|
|
197
|
-
return `Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
|
|
198
|
-
- a positive number
|
|
199
|
-
- less than the value passed to \`max\` (or ${O} if no \`max\` prop is set)
|
|
200
|
-
- \`null\` or \`undefined\` if the progress is indeterminate.
|
|
201
|
-
|
|
202
|
-
Defaulting to \`null\`.`;
|
|
203
|
-
}
|
|
204
|
-
var ae = Y, Ve = ee;
|
|
205
|
-
const re = v.forwardRef(
|
|
206
|
-
({ className: e, value: t, indeterminate: r = !1, ...d }, o) => /* @__PURE__ */ a(ae, { ref: o, className: b("relative h-4 w-full overflow-hidden rounded-full bg-secondary", e), ...d, children: /* @__PURE__ */ a(
|
|
207
|
-
Ve,
|
|
208
|
-
{
|
|
209
|
-
className: b("h-full w-full flex-1 bg-primary transition-all", r && "animate-progress origin-left"),
|
|
210
|
-
style: r ? void 0 : { transform: `translateX(-${(100 - (t ?? 0)).toString()}%)` }
|
|
211
|
-
}
|
|
212
|
-
) })
|
|
213
|
-
);
|
|
214
|
-
re.displayName = ae.displayName;
|
|
215
|
-
const je = pe, Qe = ge, Oe = fe, Ye = q, se = v.forwardRef(
|
|
216
|
-
({ className: e, ...t }, r) => /* @__PURE__ */ a(
|
|
217
|
-
J,
|
|
218
|
-
{
|
|
219
|
-
ref: r,
|
|
220
|
-
className: b(
|
|
221
|
-
"fixed inset-0 z-[70] bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
222
|
-
e
|
|
223
|
-
),
|
|
224
|
-
...t
|
|
225
|
-
}
|
|
226
|
-
)
|
|
227
|
-
);
|
|
228
|
-
se.displayName = J.displayName;
|
|
229
|
-
const oe = v.forwardRef(
|
|
230
|
-
({ className: e, children: t, ...r }, d) => /* @__PURE__ */ u(Oe, { children: [
|
|
231
|
-
/* @__PURE__ */ a(se, {}),
|
|
232
|
-
/* @__PURE__ */ u(
|
|
233
|
-
W,
|
|
234
|
-
{
|
|
235
|
-
ref: d,
|
|
236
|
-
className: b(
|
|
237
|
-
"fixed left-[50%] top-[50%] z-[70] grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
|
238
|
-
e
|
|
239
|
-
),
|
|
240
|
-
...r,
|
|
241
|
-
children: [
|
|
242
|
-
t,
|
|
243
|
-
/* @__PURE__ */ u(q, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-accent data-[state=open]:text-muted-foreground hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none", children: [
|
|
244
|
-
/* @__PURE__ */ a(I, { className: "h-4 w-4" }),
|
|
245
|
-
/* @__PURE__ */ a("span", { className: "sr-only", children: "Close" })
|
|
246
|
-
] })
|
|
247
|
-
]
|
|
248
|
-
}
|
|
249
|
-
)
|
|
250
|
-
] })
|
|
251
|
-
);
|
|
252
|
-
oe.displayName = W.displayName;
|
|
253
|
-
const ne = ({ className: e, ...t }) => /* @__PURE__ */ a("div", { className: b("flex flex-col space-y-1.5 text-center sm:text-left", e), ...t });
|
|
254
|
-
ne.displayName = "DialogHeader";
|
|
255
|
-
const Te = ({ className: e, ...t }) => /* @__PURE__ */ a("div", { className: b("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", e), ...t });
|
|
256
|
-
Te.displayName = "DialogFooter";
|
|
257
|
-
const ie = v.forwardRef(
|
|
258
|
-
({ className: e, ...t }, r) => /* @__PURE__ */ a(U, { ref: r, className: b("text-lg font-semibold leading-none tracking-tight", e), ...t })
|
|
259
|
-
);
|
|
260
|
-
ie.displayName = U.displayName;
|
|
261
|
-
const le = v.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ a(K, { ref: r, className: b("text-sm text-muted-foreground", e), ...t }));
|
|
262
|
-
le.displayName = K.displayName;
|
|
263
|
-
function Fe({ open: e, onOpenChange: t, config: r, isLoading: d, error: o, children: m }) {
|
|
264
|
-
const { t: n } = be(), { title: i, description: l, icon: h, maxWidth: w = "sm:max-w-xl", actions: f } = r;
|
|
265
|
-
return /* @__PURE__ */ a(je, { open: e, onOpenChange: t, children: /* @__PURE__ */ u(oe, { className: `${w} max-h-[90vh] border-0 shadow-2xl p-0 flex flex-col overflow-hidden`, children: [
|
|
266
|
-
d === !0 ? /* @__PURE__ */ a("div", { className: "absolute top-0 left-0 right-0 z-10", children: /* @__PURE__ */ a(re, { indeterminate: !0, className: "h-1 rounded-none" }) }) : null,
|
|
267
|
-
/* @__PURE__ */ u(ne, { className: "bg-gradient-to-r from-slate-900 to-purple-700 p-6 rounded-t-lg shrink-0", children: [
|
|
268
|
-
/* @__PURE__ */ u(ie, { className: "text-2xl font-bold flex items-center gap-2 text-white", children: [
|
|
269
|
-
h !== void 0 ? /* @__PURE__ */ a("div", { className: "p-2 bg-white/20 rounded-lg", children: /* @__PURE__ */ a(h, { className: "size-4 text-white" }) }) : null,
|
|
270
|
-
n(i)
|
|
271
|
-
] }),
|
|
272
|
-
l !== void 0 && l !== "" ? /* @__PURE__ */ a(le, { className: "text-indigo-100 text-base", children: n(l) }) : null
|
|
273
|
-
] }),
|
|
274
|
-
o != null ? /* @__PURE__ */ a("div", { className: "px-6 ", children: /* @__PURE__ */ u(ve, { variant: "destructive", className: "max-w-full", children: [
|
|
275
|
-
/* @__PURE__ */ a(Ce, { className: "size-4" }),
|
|
276
|
-
/* @__PURE__ */ a(he, { className: "break-words overflow-wrap-anywhere max-w-full", children: o.message })
|
|
277
|
-
] }) }) : null,
|
|
278
|
-
/* @__PURE__ */ a("div", { className: "flex-1 overflow-y-auto px-6 ", children: m }),
|
|
279
|
-
f !== void 0 && f.length > 0 ? /* @__PURE__ */ a("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__ */ a("div", { className: "flex justify-end gap-3", children: f.map((c, k) => /* @__PURE__ */ u(A, { variant: c.variant ?? "default", onClick: c.onClick, disabled: c.disabled === !0 || d === !0, children: [
|
|
280
|
-
c.icon !== void 0 ? /* @__PURE__ */ a(c.icon, { className: "size-4" }) : null,
|
|
281
|
-
n(c.label)
|
|
282
|
-
] }, k)) }) }) : null
|
|
283
|
-
] }) });
|
|
284
|
-
}
|
|
285
|
-
function Ze({
|
|
286
|
-
open: e,
|
|
287
|
-
onOpenChange: t,
|
|
288
|
-
data: r,
|
|
289
|
-
title: d,
|
|
290
|
-
headerBadge: o,
|
|
291
|
-
sections: m,
|
|
292
|
-
onSave: n,
|
|
293
|
-
customFooter: i,
|
|
294
|
-
defaultEditing: l = !1,
|
|
295
|
-
footerActions: h = !0,
|
|
296
|
-
saveLabel: w = "Sauvegarder",
|
|
297
|
-
cancelLabel: f = "Annuler",
|
|
298
|
-
hideSaveIcon: c = !1,
|
|
299
|
-
maxWidth: k = "sm:max-w-4xl"
|
|
300
|
-
}) {
|
|
301
|
-
const [y, x] = z(l), [C, N] = z({}), [P, S] = z(!1);
|
|
302
|
-
if (we(() => {
|
|
303
|
-
e && x(l);
|
|
304
|
-
}, [e, l]), r == null) return null;
|
|
305
|
-
const T = async () => {
|
|
306
|
-
if (y) {
|
|
307
|
-
if (n !== void 0) {
|
|
308
|
-
S(!0);
|
|
309
|
-
try {
|
|
310
|
-
await n(C), x(!1), N({});
|
|
311
|
-
} catch (s) {
|
|
312
|
-
console.error(s);
|
|
313
|
-
} finally {
|
|
314
|
-
S(!1);
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
} else
|
|
318
|
-
x(!0), N({});
|
|
319
|
-
}, R = () => {
|
|
320
|
-
x(!1), N({});
|
|
321
|
-
}, F = async () => {
|
|
322
|
-
if (n !== void 0) {
|
|
323
|
-
S(!0);
|
|
324
|
-
try {
|
|
325
|
-
await n(C), x(!1), N({});
|
|
326
|
-
} catch (s) {
|
|
327
|
-
console.error(s);
|
|
328
|
-
} finally {
|
|
329
|
-
S(!1);
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
}, H = (s, p) => {
|
|
333
|
-
N((D) => ({ ...D, [s]: p }));
|
|
334
|
-
}, de = (s) => {
|
|
335
|
-
if (y && n !== void 0) {
|
|
336
|
-
if (s.renderEdit !== void 0)
|
|
337
|
-
return s.renderEdit(r, C, (g) => {
|
|
338
|
-
H(s.key, g);
|
|
339
|
-
});
|
|
340
|
-
let $ = "";
|
|
341
|
-
if (C[s.key] !== void 0)
|
|
342
|
-
$ = C[s.key];
|
|
343
|
-
else if (s.getEditValue !== void 0)
|
|
344
|
-
$ = s.getEditValue(r);
|
|
345
|
-
else {
|
|
346
|
-
const g = r[s.key];
|
|
347
|
-
$ = g != null && String(g) !== "" ? String(g) : "";
|
|
348
|
-
}
|
|
349
|
-
return /* @__PURE__ */ a(
|
|
350
|
-
xe,
|
|
351
|
-
{
|
|
352
|
-
value: $,
|
|
353
|
-
onChange: (g) => {
|
|
354
|
-
H(s.key, g.target.value);
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
);
|
|
358
|
-
}
|
|
359
|
-
if (s.renderView !== void 0)
|
|
360
|
-
return s.renderView(r);
|
|
361
|
-
const p = r[s.key];
|
|
362
|
-
let D = "Non renseigné";
|
|
363
|
-
return Array.isArray(p) ? p.length > 0 && (D = p.map((g) => {
|
|
364
|
-
if (typeof g == "object" && g !== null) {
|
|
365
|
-
const E = g;
|
|
366
|
-
return typeof E.name == "string" ? E.name : typeof E.label == "string" ? E.label : JSON.stringify(g);
|
|
367
|
-
}
|
|
368
|
-
return String(g);
|
|
369
|
-
}).join(", ")) : typeof p == "object" && p !== null ? D = JSON.stringify(p) : (typeof p == "string" || typeof p == "number" || typeof p == "boolean") && (D = String(p)), /* @__PURE__ */ a("div", { className: "p-2 bg-gray-50 dark:bg-gray-900 rounded border border-transparent min-h-[36px] flex items-center", children: D });
|
|
370
|
-
}, ce = (s) => /* @__PURE__ */ u("div", { className: `col-span-1 ${s.fullWidth === !0 ? "md:col-span-2" : ""}`, children: [
|
|
371
|
-
/* @__PURE__ */ a(ye, { className: "mb-1 block text-sm font-medium", children: s.label }),
|
|
372
|
-
de(s)
|
|
373
|
-
] }, s.key), _ = [];
|
|
374
|
-
n !== void 0 && (y ? (f !== "" && _.push({
|
|
375
|
-
label: f,
|
|
376
|
-
onClick: R,
|
|
377
|
-
variant: "outline",
|
|
378
|
-
disabled: P,
|
|
379
|
-
icon: I
|
|
380
|
-
}), _.push({
|
|
381
|
-
label: P ? "Enregistrement..." : w,
|
|
382
|
-
onClick: () => {
|
|
383
|
-
F();
|
|
384
|
-
},
|
|
385
|
-
variant: "default",
|
|
386
|
-
disabled: P,
|
|
387
|
-
icon: c ? void 0 : X
|
|
388
|
-
})) : _.push({
|
|
389
|
-
label: "Modifier",
|
|
390
|
-
onClick: () => {
|
|
391
|
-
T();
|
|
392
|
-
},
|
|
393
|
-
variant: "outline",
|
|
394
|
-
icon: L
|
|
395
|
-
}));
|
|
396
|
-
const ue = {
|
|
397
|
-
title: d(r),
|
|
398
|
-
maxWidth: k,
|
|
399
|
-
actions: h ? _ : []
|
|
400
|
-
};
|
|
401
|
-
return /* @__PURE__ */ a(
|
|
402
|
-
Fe,
|
|
403
|
-
{
|
|
404
|
-
open: e,
|
|
405
|
-
onOpenChange: (s) => {
|
|
406
|
-
t(s), s || R();
|
|
407
|
-
},
|
|
408
|
-
config: ue,
|
|
409
|
-
isLoading: P,
|
|
410
|
-
children: /* @__PURE__ */ u("div", { className: "py-4", children: [
|
|
411
|
-
o !== void 0 ? /* @__PURE__ */ a("div", { className: "mb-4", children: o(r) }) : null,
|
|
412
|
-
/* @__PURE__ */ a("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6 items-start", children: m.map((s, p) => /* @__PURE__ */ u("div", { className: "space-y-4", children: [
|
|
413
|
-
/* @__PURE__ */ u("div", { className: "flex items-center gap-2 mb-4", children: [
|
|
414
|
-
s.icon,
|
|
415
|
-
/* @__PURE__ */ a("h3", { className: "text-lg font-semibold", children: s.title })
|
|
416
|
-
] }),
|
|
417
|
-
/* @__PURE__ */ a("div", { className: "grid grid-cols-1 gap-4", children: s.fields.map(ce) })
|
|
418
|
-
] }, p)) }),
|
|
419
|
-
i !== void 0 ? i(r) : null,
|
|
420
|
-
n !== void 0 && !h ? /* @__PURE__ */ a("div", { className: "flex justify-end gap-2 border-t pt-4 mt-6", children: y ? /* @__PURE__ */ u(me, { children: [
|
|
421
|
-
f !== "" ? /* @__PURE__ */ u(A, { onClick: R, variant: "outline", size: "sm", disabled: P, children: [
|
|
422
|
-
/* @__PURE__ */ a(I, { className: "h-4 w-4 mr-2" }),
|
|
423
|
-
f
|
|
424
|
-
] }) : null,
|
|
425
|
-
/* @__PURE__ */ u(
|
|
426
|
-
A,
|
|
427
|
-
{
|
|
428
|
-
onClick: () => {
|
|
429
|
-
F();
|
|
430
|
-
},
|
|
431
|
-
size: "sm",
|
|
432
|
-
disabled: P,
|
|
433
|
-
className: "text-white",
|
|
434
|
-
children: [
|
|
435
|
-
c ? null : /* @__PURE__ */ a(X, { className: "h-4 w-4 mr-2" }),
|
|
436
|
-
P ? "Enregistrement..." : w
|
|
437
|
-
]
|
|
438
|
-
}
|
|
439
|
-
)
|
|
440
|
-
] }) : /* @__PURE__ */ u(
|
|
441
|
-
A,
|
|
442
|
-
{
|
|
443
|
-
onClick: () => {
|
|
444
|
-
T();
|
|
445
|
-
},
|
|
446
|
-
variant: "outline",
|
|
447
|
-
size: "sm",
|
|
448
|
-
children: [
|
|
449
|
-
/* @__PURE__ */ a(L, { className: "h-4 w-4 mr-2" }),
|
|
450
|
-
"Modifier"
|
|
451
|
-
]
|
|
452
|
-
}
|
|
453
|
-
) }) : null
|
|
454
|
-
] })
|
|
455
|
-
}
|
|
456
|
-
);
|
|
457
|
-
}
|
|
458
|
-
export {
|
|
459
|
-
Fe as A,
|
|
460
|
-
je as D,
|
|
461
|
-
Ze as F,
|
|
462
|
-
re as P,
|
|
463
|
-
Ye as a,
|
|
464
|
-
oe as b,
|
|
465
|
-
le as c,
|
|
466
|
-
Te as d,
|
|
467
|
-
ne as e,
|
|
468
|
-
se as f,
|
|
469
|
-
Oe as g,
|
|
470
|
-
ie as h,
|
|
471
|
-
Qe as i
|
|
472
|
-
};
|