@krosoft/react 0.0.82 → 0.0.84
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/{AppTitle-BOhhDNS5.js → AppTitle-CJZdhpRm.js} +2 -2
- package/dist/FormDialog-CwxZPmv4.js +472 -0
- package/dist/{MetricCard-bpuqueI5.js → MetricCard-5kWhYPKJ.js} +1 -1
- package/dist/{SearchInput-Dh-92XhU.js → SearchInput-Dpy2amwO.js} +28 -28
- package/dist/{TableFilter-BoNsBNbv.js → TableFilter-w9BHeObX.js} +2 -2
- package/dist/{TableSettings-D2qjh0E9.js → TableSettings-DNkdLgCN.js} +21 -21
- package/dist/components/core/cards/index.js +1 -1
- package/dist/components/core/dialogs/AppDialog.d.ts +28 -0
- package/dist/components/core/dialogs/AppDialog.d.ts.map +1 -0
- package/dist/components/core/dialogs/FormDialog.d.ts +32 -0
- package/dist/components/core/dialogs/FormDialog.d.ts.map +1 -0
- package/dist/components/core/dialogs/index.d.ts +7 -0
- package/dist/components/core/dialogs/index.d.ts.map +1 -0
- package/dist/components/core/dialogs/index.js +16 -0
- package/dist/components/core/filters/index.js +1 -1
- package/dist/components/core/index.d.ts +1 -0
- package/dist/components/core/index.d.ts.map +1 -1
- package/dist/components/core/index.js +46 -32
- package/dist/components/core/inputs/index.js +1 -1
- package/dist/components/core/layouts/index.js +1 -1
- package/dist/components/core/table/index.js +1 -1
- package/dist/components/index.js +96 -82
- package/dist/components/ui/dialog.d.ts +20 -0
- package/dist/components/ui/dialog.d.ts.map +1 -0
- package/dist/components/ui/index.js +1 -1
- package/dist/components/ui/progress.d.ts +8 -0
- package/dist/components/ui/progress.d.ts.map +1 -0
- package/dist/{dropdown-menu-D6j1GdTA.js → dropdown-menu-Q_WkonPk.js} +1 -1
- package/dist/{popover-DVVl_ccN.js → popover-BMvYmQOM.js} +598 -590
- package/dist/tailwind/index.d.ts +9 -0
- package/dist/tailwind/index.d.ts.map +1 -1
- package/dist/tailwind/index.js +6 -1
- package/package.json +5 -4
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsxs as n, jsx as l } from "react/jsx-runtime";
|
|
2
|
-
import "./popover-
|
|
2
|
+
import "./popover-BMvYmQOM.js";
|
|
3
3
|
import { B as u } from "./floating-ui.react-dom-BIcsGc3t.js";
|
|
4
4
|
import "./card-7XPLAra3.js";
|
|
5
5
|
import { c as d } from "./index-gWiv5-6R.js";
|
|
6
6
|
import "./select-CtU681LB.js";
|
|
7
|
-
import { D as c, a as b, E as h, b as f, c as x, d as p } from "./dropdown-menu-
|
|
7
|
+
import { D as c, a as b, E as h, b as f, c as x, d as p } from "./dropdown-menu-Q_WkonPk.js";
|
|
8
8
|
import { u as v } from "./useMobile-DN1_OMDB.js";
|
|
9
9
|
import { useTranslation as N } from "react-i18next";
|
|
10
10
|
function B({ actions: m, className: o }) {
|
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
import { jsx as a, jsxs as u, Fragment as me } from "react/jsx-runtime";
|
|
2
|
+
import { O as J, u as fe, v as W, w as q, X as V, x as U, D as K, R as pe, y as ge, A as ve, a as he, L as ye, I as xe } from "./popover-BMvYmQOM.js";
|
|
3
|
+
import { v as Ne, B as A } from "./floating-ui.react-dom-BIcsGc3t.js";
|
|
4
|
+
import "./card-7XPLAra3.js";
|
|
5
|
+
import "./select-CtU681LB.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 I, useEffect as we } from "react";
|
|
10
|
+
import "react-dom";
|
|
11
|
+
import { c as z } 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 = z("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 = z("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 = z("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(Ie(`${o}`, "Progress"));
|
|
141
|
+
const i = B(o) ? o : O;
|
|
142
|
+
d !== null && !G(d, i) && console.error(Ve(`${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 Ie(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 Ve(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, ze = 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
|
+
ze,
|
|
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(V, { 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] = I(l), [C, N] = I({}), [P, S] = I(!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: V
|
|
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(V, { 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
|
+
};
|
|
@@ -2,7 +2,7 @@ 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 "./popover-
|
|
5
|
+
import "./popover-BMvYmQOM.js";
|
|
6
6
|
import "./floating-ui.react-dom-BIcsGc3t.js";
|
|
7
7
|
import { C as x, d as N, e as g, a as f } from "./card-7XPLAra3.js";
|
|
8
8
|
import "./select-CtU681LB.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as d, jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import * as L from "react";
|
|
3
|
-
import { useState as P, useRef as j, useEffect as T, useMemo as
|
|
4
|
-
import {
|
|
3
|
+
import { useState as P, useRef as j, useEffect as T, useMemo as z } from "react";
|
|
4
|
+
import { E, F as C, G as k, H as q, J as S, C as R, P as X, e as _, X as J, d as V, c as O, I } from "./popover-BMvYmQOM.js";
|
|
5
5
|
import { B as b, C as A } from "./floating-ui.react-dom-BIcsGc3t.js";
|
|
6
6
|
import "./card-7XPLAra3.js";
|
|
7
7
|
import { c as y } from "./index-gWiv5-6R.js";
|
|
@@ -28,7 +28,7 @@ const Y = [
|
|
|
28
28
|
const $ = [
|
|
29
29
|
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
|
|
30
30
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
|
|
31
|
-
],
|
|
31
|
+
], D = F("search", $), B = {
|
|
32
32
|
lessThanXSeconds: {
|
|
33
33
|
one: "moins d’une seconde",
|
|
34
34
|
other: "moins de {{count}} secondes"
|
|
@@ -90,11 +90,11 @@ const $ = [
|
|
|
90
90
|
one: "presqu’un an",
|
|
91
91
|
other: "presque {{count}} ans"
|
|
92
92
|
}
|
|
93
|
-
},
|
|
93
|
+
}, G = (e, t, s) => {
|
|
94
94
|
let r;
|
|
95
95
|
const i = B[e];
|
|
96
96
|
return typeof i == "string" ? r = i : t === 1 ? r = i.one : r = i.other.replace("{{count}}", String(t)), s != null && s.addSuffix ? s.comparison && s.comparison > 0 ? "dans " + r : "il y a " + r : r;
|
|
97
|
-
},
|
|
97
|
+
}, K = {
|
|
98
98
|
full: "EEEE d MMMM y",
|
|
99
99
|
long: "d MMMM y",
|
|
100
100
|
medium: "d MMM y",
|
|
@@ -110,15 +110,15 @@ const $ = [
|
|
|
110
110
|
medium: "{{date}}, {{time}}",
|
|
111
111
|
short: "{{date}}, {{time}}"
|
|
112
112
|
}, ee = {
|
|
113
|
-
date:
|
|
114
|
-
formats:
|
|
113
|
+
date: E({
|
|
114
|
+
formats: K,
|
|
115
115
|
defaultWidth: "full"
|
|
116
116
|
}),
|
|
117
|
-
time:
|
|
117
|
+
time: E({
|
|
118
118
|
formats: U,
|
|
119
119
|
defaultWidth: "full"
|
|
120
120
|
}),
|
|
121
|
-
dateTime:
|
|
121
|
+
dateTime: E({
|
|
122
122
|
formats: Z,
|
|
123
123
|
defaultWidth: "full"
|
|
124
124
|
})
|
|
@@ -349,9 +349,9 @@ const $ = [
|
|
|
349
349
|
parsePatterns: Me,
|
|
350
350
|
defaultParseWidth: "any"
|
|
351
351
|
})
|
|
352
|
-
},
|
|
352
|
+
}, W = {
|
|
353
353
|
code: "fr",
|
|
354
|
-
formatDistance:
|
|
354
|
+
formatDistance: G,
|
|
355
355
|
formatLong: ee,
|
|
356
356
|
formatRelative: ne,
|
|
357
357
|
localize: ce,
|
|
@@ -360,7 +360,7 @@ const $ = [
|
|
|
360
360
|
weekStartsOn: 1,
|
|
361
361
|
firstWeekContainsDate: 4
|
|
362
362
|
}
|
|
363
|
-
},
|
|
363
|
+
}, Ee = ({ date: e, onDateChange: t, placeholder: s }) => {
|
|
364
364
|
const [r, i] = P(!1), l = j(null);
|
|
365
365
|
T(() => {
|
|
366
366
|
if (!r) return;
|
|
@@ -390,13 +390,13 @@ const $ = [
|
|
|
390
390
|
),
|
|
391
391
|
children: [
|
|
392
392
|
/* @__PURE__ */ n(H, { className: "mr-2 h-4 w-4 shrink-0" }),
|
|
393
|
-
e !== void 0 ?
|
|
393
|
+
e !== void 0 ? S(e, "dd/MM/yyyy", { locale: W }) : /* @__PURE__ */ n("span", { children: s })
|
|
394
394
|
]
|
|
395
395
|
}
|
|
396
396
|
),
|
|
397
397
|
r ? /* @__PURE__ */ n("div", { className: "absolute left-0 top-[calc(100%+4px)] z-[100] rounded-md border bg-popover text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 slide-in-from-top-2", children: /* @__PURE__ */ n(R, { mode: "single", selected: e, onSelect: c }) }) : null
|
|
398
398
|
] });
|
|
399
|
-
},
|
|
399
|
+
}, Je = ({ value: e, onChange: t, placeholder: s = "Selectionner une periode", className: r }) => {
|
|
400
400
|
const [i, l] = L.useState(!1), [m, c] = L.useState(e);
|
|
401
401
|
L.useEffect(() => {
|
|
402
402
|
i && c(e);
|
|
@@ -409,7 +409,7 @@ const $ = [
|
|
|
409
409
|
c(e), l(!1);
|
|
410
410
|
}, x = () => {
|
|
411
411
|
c(void 0);
|
|
412
|
-
}, w = (h) => h != null && h.from ? !h.to || h.from.getTime() === h.to.getTime() ?
|
|
412
|
+
}, w = (h) => h != null && h.from ? !h.to || h.from.getTime() === h.to.getTime() ? S(h.from, "dd MMM yyyy", { locale: W }) : `${S(h.from, "dd MMM yyyy", { locale: W })} - ${S(h.to, "dd MMM yyyy", { locale: W })}` : s;
|
|
413
413
|
return /* @__PURE__ */ n("div", { className: y("grid gap-2", r), children: /* @__PURE__ */ d(X, { open: i, onOpenChange: l, children: [
|
|
414
414
|
/* @__PURE__ */ n(_, { asChild: !0, children: /* @__PURE__ */ d(b, { id: "date", variant: "outline", className: y("w-[300px] justify-start text-left font-normal", !(e != null && e.from) && "text-muted-foreground"), children: [
|
|
415
415
|
/* @__PURE__ */ n(H, { className: "mr-2 size-4" }),
|
|
@@ -423,7 +423,7 @@ const $ = [
|
|
|
423
423
|
"aria-label": "Effacer la periode selectionnee",
|
|
424
424
|
className: "ml-auto h-5 w-5 opacity-50 hover:opacity-100",
|
|
425
425
|
onClick: u,
|
|
426
|
-
children: /* @__PURE__ */ n(
|
|
426
|
+
children: /* @__PURE__ */ n(J, { className: "size-4" })
|
|
427
427
|
}
|
|
428
428
|
)
|
|
429
429
|
] }) }),
|
|
@@ -449,7 +449,7 @@ const $ = [
|
|
|
449
449
|
] })
|
|
450
450
|
] })
|
|
451
451
|
] }) });
|
|
452
|
-
},
|
|
452
|
+
}, De = ({
|
|
453
453
|
options: e,
|
|
454
454
|
selected: t,
|
|
455
455
|
onToggle: s,
|
|
@@ -459,7 +459,7 @@ const $ = [
|
|
|
459
459
|
searchable: m = !1,
|
|
460
460
|
searchPlaceholder: c = "Rechercher..."
|
|
461
461
|
}) => {
|
|
462
|
-
const [u, f] = P(""), [p, x] = P(!1), w = j(null), h = j(null), g =
|
|
462
|
+
const [u, f] = P(""), [p, x] = P(!1), w = j(null), h = j(null), g = z(() => u === "" ? e : e.filter((a) => a.label.toLowerCase().includes(u.toLowerCase())), [e, u]), o = z(() => g.length === 0 ? !1 : g.every((a) => t.includes(a.value)), [g, t]);
|
|
463
463
|
T(() => {
|
|
464
464
|
p && m && requestAnimationFrame(() => {
|
|
465
465
|
var a;
|
|
@@ -515,7 +515,7 @@ const $ = [
|
|
|
515
515
|
a.stopPropagation(), r();
|
|
516
516
|
},
|
|
517
517
|
className: "rounded-full p-0.5 opacity-50 transition-opacity hover:opacity-100",
|
|
518
|
-
children: /* @__PURE__ */ n(
|
|
518
|
+
children: /* @__PURE__ */ n(J, { className: "h-3.5 w-3.5" })
|
|
519
519
|
}
|
|
520
520
|
),
|
|
521
521
|
/* @__PURE__ */ n(A, { className: y("h-4 w-4 opacity-50 transition-transform", p && "rotate-180") })
|
|
@@ -525,7 +525,7 @@ const $ = [
|
|
|
525
525
|
),
|
|
526
526
|
p ? /* @__PURE__ */ d("div", { className: "absolute left-0 right-0 top-[calc(100%+4px)] z-[100] rounded-md border bg-popover text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 slide-in-from-top-2", children: [
|
|
527
527
|
m ? /* @__PURE__ */ n("div", { className: "border-b border-border p-2", children: /* @__PURE__ */ d("div", { className: "relative", children: [
|
|
528
|
-
/* @__PURE__ */ n(
|
|
528
|
+
/* @__PURE__ */ n(D, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
|
|
529
529
|
/* @__PURE__ */ n(
|
|
530
530
|
"input",
|
|
531
531
|
{
|
|
@@ -576,7 +576,7 @@ const $ = [
|
|
|
576
576
|
placeholder: r = "Sélectionner...",
|
|
577
577
|
searchPlaceholder: i = "Rechercher..."
|
|
578
578
|
}) => {
|
|
579
|
-
const [l, m] = P(""), [c, u] = P(!1), f = j(null), p = j(null), x =
|
|
579
|
+
const [l, m] = P(""), [c, u] = P(!1), f = j(null), p = j(null), x = z(() => l === "" ? e : e.filter((o) => o.label.toLowerCase().includes(l.toLowerCase())), [e, l]), w = z(() => {
|
|
580
580
|
var o;
|
|
581
581
|
if (!(t === void 0 || t === ""))
|
|
582
582
|
return ((o = e.find((M) => M.value === t)) == null ? void 0 : o.label) ?? t;
|
|
@@ -620,7 +620,7 @@ const $ = [
|
|
|
620
620
|
),
|
|
621
621
|
c ? /* @__PURE__ */ d("div", { className: "absolute left-0 right-0 top-[calc(100%+4px)] z-[100] rounded-md border bg-popover text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 slide-in-from-top-2", children: [
|
|
622
622
|
/* @__PURE__ */ n("div", { className: "border-b border-border p-2", children: /* @__PURE__ */ d("div", { className: "relative", children: [
|
|
623
|
-
/* @__PURE__ */ n(
|
|
623
|
+
/* @__PURE__ */ n(D, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
|
|
624
624
|
/* @__PURE__ */ n(
|
|
625
625
|
"input",
|
|
626
626
|
{
|
|
@@ -670,7 +670,7 @@ const $ = [
|
|
|
670
670
|
r(""), l !== void 0 && l();
|
|
671
671
|
};
|
|
672
672
|
return /* @__PURE__ */ d("div", { className: y("relative h-fit w-full md:w-64", m), children: [
|
|
673
|
-
/* @__PURE__ */ n(
|
|
673
|
+
/* @__PURE__ */ n(D, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground w-4 h-4" }),
|
|
674
674
|
/* @__PURE__ */ n(
|
|
675
675
|
I,
|
|
676
676
|
{
|
|
@@ -685,14 +685,14 @@ const $ = [
|
|
|
685
685
|
}
|
|
686
686
|
}
|
|
687
687
|
),
|
|
688
|
-
c !== "" ? /* @__PURE__ */ n("button", { onClick: u, className: "absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-gray-700", type: "button", children: /* @__PURE__ */ n(
|
|
688
|
+
c !== "" ? /* @__PURE__ */ n("button", { onClick: u, className: "absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-gray-700", type: "button", children: /* @__PURE__ */ n(J, { className: "size-4" }) }) : null
|
|
689
689
|
] });
|
|
690
690
|
};
|
|
691
691
|
export {
|
|
692
|
-
|
|
693
|
-
|
|
692
|
+
Ee as D,
|
|
693
|
+
De as M,
|
|
694
694
|
Re as S,
|
|
695
|
-
|
|
695
|
+
Je as a,
|
|
696
696
|
Oe as b,
|
|
697
|
-
|
|
697
|
+
D as c
|
|
698
698
|
};
|