@krosoft/react 0.0.95 → 0.0.96
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-BpBamEcm.js → AppSubTitle-Bc8utqt7.js} +1 -1
- package/dist/{AppTitle-eMxmvBxB.js → AppTitle-QlMMlpbQ.js} +8 -8
- package/dist/{AppVerticalTabs-CVukFn4d.js → AppVerticalTabs--Kb9OFa4.js} +29 -30
- package/dist/{ConfirmationDialog-D7W5xkwQ.js → ConfirmationDialog-Bv-O4ui4.js} +43 -43
- package/dist/{DataTable-C5t09hPv.js → DataTable-DWGao3TY.js} +28 -28
- package/dist/{ErrorAlert-BITMD2I5.js → ErrorAlert-DpOsMww8.js} +1 -1
- package/dist/LoadingState-M_TV_5Ui.js +13 -0
- package/dist/MetricCard-BjTGW3b2.js +103 -0
- package/dist/{SearchInput-Cez8b7gL.js → SearchInput-CvBCMaFl.js} +54 -54
- package/dist/{TableFilter-ChclLTH1.js → TableFilter-TsVYIJlw.js} +44 -44
- package/dist/alert-sHZy6NHC.js +30 -0
- package/dist/components/core/cards/CardSkeleton.d.ts.map +1 -0
- package/dist/components/core/cards/CardsSkeleton.d.ts.map +1 -0
- package/dist/components/core/cards/DashboardCard.d.ts +10 -0
- package/dist/components/core/cards/DashboardCard.d.ts.map +1 -0
- package/dist/components/core/cards/index.d.ts +4 -1
- package/dist/components/core/cards/index.d.ts.map +1 -1
- package/dist/components/core/cards/index.js +7 -4
- package/dist/components/core/dialogs/index.js +2 -2
- package/dist/components/core/filters/index.js +1 -1
- package/dist/components/core/index.js +63 -62
- package/dist/components/core/inputs/index.js +1 -1
- package/dist/components/core/layouts/index.js +2 -2
- package/dist/components/core/states/index.d.ts +0 -2
- package/dist/components/core/states/index.d.ts.map +1 -1
- package/dist/components/core/states/index.js +5 -7
- package/dist/components/core/table/index.js +1 -1
- package/dist/components/core/tabs/index.js +1 -1
- package/dist/components/index.js +284 -283
- package/dist/components/ui/button.d.ts +2 -2
- package/dist/components/ui/command.d.ts +12 -12
- package/dist/components/ui/index.js +187 -187
- package/dist/{toaster-DeSyPrhi.js → toaster-B09ou5gw.js} +24 -24
- package/dist/{toggle-group-CrQymn4l.js → toggle-group-iLf3T7oV.js} +5850 -5832
- package/package.json +1 -1
- package/dist/LoadingState-COf3KhOP.js +0 -29
- package/dist/MetricCard-BkOvTc3_.js +0 -85
- package/dist/card-Bn3Y7DHQ.js +0 -48
- package/dist/components/core/states/CardSkeleton.d.ts.map +0 -1
- package/dist/components/core/states/CardsSkeleton.d.ts.map +0 -1
- /package/dist/components/core/{states → cards}/CardSkeleton.d.ts +0 -0
- /package/dist/components/core/{states → cards}/CardsSkeleton.d.ts +0 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { jsxs as s, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { I as l, M as p, J as m, N as x } from "./toggle-group-iLf3T7oV.js";
|
|
3
|
+
import { c } from "./index-gWiv5-6R.js";
|
|
4
|
+
import { useTranslation as f } from "react-i18next";
|
|
5
|
+
import { formatNumber as b } from "@krosoft/core/helpers";
|
|
6
|
+
import "./alert-sHZy6NHC.js";
|
|
7
|
+
import "./tooltip-CAu4DEhc.js";
|
|
8
|
+
import "./select-zzSnHs9S.js";
|
|
9
|
+
import "next-themes";
|
|
10
|
+
import "react";
|
|
11
|
+
const v = () => /* @__PURE__ */ s(l, { className: "animate-pulse", children: [
|
|
12
|
+
/* @__PURE__ */ e(p, { children: /* @__PURE__ */ e("div", { className: "h-6 bg-muted rounded w-1/4" }) }),
|
|
13
|
+
/* @__PURE__ */ e(m, { children: /* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
14
|
+
/* @__PURE__ */ e("div", { className: "h-4 bg-muted rounded" }),
|
|
15
|
+
/* @__PURE__ */ e("div", { className: "h-4 bg-muted rounded w-3/4" })
|
|
16
|
+
] }) })
|
|
17
|
+
] }), H = ({ count: t = 1 }) => /* @__PURE__ */ e("div", { className: "grid gap-6", style: { gridTemplateColumns: `repeat(${t}, minmax(0, 1fr))` }, children: Array.from({ length: t }).map((r, a) => /* @__PURE__ */ e(v, {}, a)) }), J = ({ titleKey: t, icon: r, className: a, children: i }) => {
|
|
18
|
+
const { t: n } = f();
|
|
19
|
+
return /* @__PURE__ */ s(l, { className: c("bg-gray-50 dark:bg-gray-950", a), children: [
|
|
20
|
+
/* @__PURE__ */ e(p, { children: /* @__PURE__ */ s(x, { className: "flex items-center gap-2", children: [
|
|
21
|
+
r && /* @__PURE__ */ e(r, { className: "mr-2 size-4" }),
|
|
22
|
+
/* @__PURE__ */ e("span", { children: n(t) })
|
|
23
|
+
] }) }),
|
|
24
|
+
/* @__PURE__ */ e(m, { children: i })
|
|
25
|
+
] });
|
|
26
|
+
}, C = ({
|
|
27
|
+
titleKey: t,
|
|
28
|
+
value: r,
|
|
29
|
+
valueClassName: a,
|
|
30
|
+
icon: i,
|
|
31
|
+
iconClassName: n,
|
|
32
|
+
description: g,
|
|
33
|
+
descriptionClassName: d,
|
|
34
|
+
onClick: o
|
|
35
|
+
}) => {
|
|
36
|
+
const { t: u } = f();
|
|
37
|
+
return /* @__PURE__ */ s(l, { className: c(o !== void 0 ? "hover:border-primary cursor-pointer" : ""), onClick: o, children: [
|
|
38
|
+
/* @__PURE__ */ s(p, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
39
|
+
/* @__PURE__ */ e(x, { className: "text-sm font-medium", children: u(t) }),
|
|
40
|
+
/* @__PURE__ */ e(i, { className: c("size-6 text-muted-foreground", n) })
|
|
41
|
+
] }),
|
|
42
|
+
/* @__PURE__ */ s(m, { children: [
|
|
43
|
+
/* @__PURE__ */ e("div", { className: c("text-2xl font-bold", a), children: b(r) }),
|
|
44
|
+
/* @__PURE__ */ e("p", { className: c("text-xs text-muted-foreground", d), children: g })
|
|
45
|
+
] })
|
|
46
|
+
] });
|
|
47
|
+
}, _ = ({ stats: t }) => /* @__PURE__ */ e("div", { className: "grid gap-6 md:grid-cols-2 lg:grid-cols-4", children: t.map((r) => /* @__PURE__ */ e(
|
|
48
|
+
C,
|
|
49
|
+
{
|
|
50
|
+
titleKey: r.titleKey,
|
|
51
|
+
value: r.value,
|
|
52
|
+
valueClassName: r.valueClassName,
|
|
53
|
+
icon: r.icon,
|
|
54
|
+
iconClassName: r.iconClassName,
|
|
55
|
+
description: r.description,
|
|
56
|
+
descriptionClassName: r.descriptionClassName,
|
|
57
|
+
onClick: r.onClick
|
|
58
|
+
},
|
|
59
|
+
r.titleKey
|
|
60
|
+
)) }), w = {
|
|
61
|
+
blue: "bg-gradient-to-br from-blue-500 to-cyan-500 text-white",
|
|
62
|
+
green: "bg-gradient-to-br from-green-500 to-emerald-500 text-white",
|
|
63
|
+
orange: "bg-gradient-to-br from-orange-500 to-yellow-500 text-white",
|
|
64
|
+
red: "bg-gradient-to-br from-red-500 to-pink-500 text-white",
|
|
65
|
+
purple: "bg-gradient-to-br from-purple-500 to-indigo-500 text-white",
|
|
66
|
+
accent: "bg-accent/10 text-accent",
|
|
67
|
+
success: "bg-success/10 text-success",
|
|
68
|
+
info: "bg-info/10 text-info",
|
|
69
|
+
warning: "bg-warning/10 text-warning",
|
|
70
|
+
destructive: "bg-destructive/10 text-destructive"
|
|
71
|
+
}, y = {
|
|
72
|
+
sm: "size-4",
|
|
73
|
+
md: "size-5",
|
|
74
|
+
lg: "size-6"
|
|
75
|
+
}, z = (t) => t === "up" ? "↑" : t === "down" ? "↓" : "", K = (t) => t === "up" ? "text-green-600" : t === "down" ? "text-red-600" : "text-muted-foreground", q = ({ title: t, value: r, unit: a, subtitle: i, icon: n, iconSize: g = "md", trend: d, trendValue: o, color: u = "blue", children: h }) => {
|
|
76
|
+
const N = n;
|
|
77
|
+
return /* @__PURE__ */ e(l, { className: "relative overflow-hidden bg-card border shadow-lg hover:shadow-xl transition-all duration-300", children: /* @__PURE__ */ s(m, { className: "pt-6", children: [
|
|
78
|
+
/* @__PURE__ */ s("div", { className: "flex items-start justify-between", children: [
|
|
79
|
+
/* @__PURE__ */ s("div", { children: [
|
|
80
|
+
/* @__PURE__ */ e(x, { className: "text-sm font-medium text-muted-foreground", children: t }),
|
|
81
|
+
/* @__PURE__ */ s("div", { className: "flex items-baseline space-x-2 mt-1", children: [
|
|
82
|
+
/* @__PURE__ */ e("div", { className: "text-2xl font-bold text-card-foreground", children: typeof r == "number" ? r.toFixed(1) : r }),
|
|
83
|
+
a && /* @__PURE__ */ e("div", { className: "text-sm text-muted-foreground font-medium", children: a })
|
|
84
|
+
] }),
|
|
85
|
+
i && /* @__PURE__ */ e("div", { className: "mt-1 text-xs text-muted-foreground", children: i }),
|
|
86
|
+
d && o && /* @__PURE__ */ s("div", { className: `flex items-center space-x-1 mt-2 text-xs ${K(d)}`, children: [
|
|
87
|
+
/* @__PURE__ */ e("span", { children: z(d) }),
|
|
88
|
+
/* @__PURE__ */ e("span", { children: o })
|
|
89
|
+
] })
|
|
90
|
+
] }),
|
|
91
|
+
/* @__PURE__ */ e("div", { className: `p-2 rounded-lg ${w[u]} shadow-lg`, children: /* @__PURE__ */ e(N, { className: y[g] }) })
|
|
92
|
+
] }),
|
|
93
|
+
h && /* @__PURE__ */ e("div", { className: "mt-4", children: h })
|
|
94
|
+
] }) });
|
|
95
|
+
};
|
|
96
|
+
export {
|
|
97
|
+
v as C,
|
|
98
|
+
J as D,
|
|
99
|
+
C as K,
|
|
100
|
+
q as M,
|
|
101
|
+
H as a,
|
|
102
|
+
_ as b
|
|
103
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as d, jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import * as L from "react";
|
|
3
3
|
import { useState as P, useRef as j, useEffect as T, useMemo as z } from "react";
|
|
4
|
-
import {
|
|
5
|
-
import "./
|
|
4
|
+
import { cm as D, cn as C, co as k, cp as q, cq as W, H as R, bv as F, bx as X, bw as V, ce as E, _ as O, aW as _ } from "./toggle-group-iLf3T7oV.js";
|
|
5
|
+
import "./alert-sHZy6NHC.js";
|
|
6
6
|
import { c as b } from "./index-gWiv5-6R.js";
|
|
7
7
|
import { B as y, C as A } from "./tooltip-CAu4DEhc.js";
|
|
8
8
|
import { X as J, C as I } from "./select-zzSnHs9S.js";
|
|
@@ -83,19 +83,19 @@ const Y = [
|
|
|
83
83
|
}
|
|
84
84
|
}, B = (e, t, s) => {
|
|
85
85
|
let r;
|
|
86
|
-
const
|
|
87
|
-
return typeof
|
|
86
|
+
const i = $[e];
|
|
87
|
+
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;
|
|
88
88
|
}, K = {
|
|
89
89
|
full: "EEEE d MMMM y",
|
|
90
90
|
long: "d MMMM y",
|
|
91
91
|
medium: "d MMM y",
|
|
92
92
|
short: "dd/MM/y"
|
|
93
|
-
},
|
|
93
|
+
}, G = {
|
|
94
94
|
full: "HH:mm:ss zzzz",
|
|
95
95
|
long: "HH:mm:ss z",
|
|
96
96
|
medium: "HH:mm:ss",
|
|
97
97
|
short: "HH:mm"
|
|
98
|
-
},
|
|
98
|
+
}, U = {
|
|
99
99
|
full: "{{date}} 'à' {{time}}",
|
|
100
100
|
long: "{{date}} 'à' {{time}}",
|
|
101
101
|
medium: "{{date}}, {{time}}",
|
|
@@ -106,11 +106,11 @@ const Y = [
|
|
|
106
106
|
defaultWidth: "full"
|
|
107
107
|
}),
|
|
108
108
|
time: D({
|
|
109
|
-
formats:
|
|
109
|
+
formats: G,
|
|
110
110
|
defaultWidth: "full"
|
|
111
111
|
}),
|
|
112
112
|
dateTime: D({
|
|
113
|
-
formats:
|
|
113
|
+
formats: U,
|
|
114
114
|
defaultWidth: "full"
|
|
115
115
|
})
|
|
116
116
|
}, ee = {
|
|
@@ -158,7 +158,7 @@ const Y = [
|
|
|
158
158
|
"novembre",
|
|
159
159
|
"décembre"
|
|
160
160
|
]
|
|
161
|
-
},
|
|
161
|
+
}, oe = {
|
|
162
162
|
narrow: ["D", "L", "M", "M", "J", "V", "S"],
|
|
163
163
|
short: ["di", "lu", "ma", "me", "je", "ve", "sa"],
|
|
164
164
|
abbreviated: ["dim.", "lun.", "mar.", "mer.", "jeu.", "ven.", "sam."],
|
|
@@ -171,7 +171,7 @@ const Y = [
|
|
|
171
171
|
"vendredi",
|
|
172
172
|
"samedi"
|
|
173
173
|
]
|
|
174
|
-
},
|
|
174
|
+
}, ie = {
|
|
175
175
|
narrow: {
|
|
176
176
|
am: "AM",
|
|
177
177
|
pm: "PM",
|
|
@@ -205,9 +205,9 @@ const Y = [
|
|
|
205
205
|
}, se = (e, t) => {
|
|
206
206
|
const s = Number(e), r = t == null ? void 0 : t.unit;
|
|
207
207
|
if (s === 0) return "0";
|
|
208
|
-
const
|
|
208
|
+
const i = ["year", "week", "hour", "minute", "second"];
|
|
209
209
|
let l;
|
|
210
|
-
return s === 1 ? l = r &&
|
|
210
|
+
return s === 1 ? l = r && i.includes(r) ? "ère" : "er" : l = "ème", s + l;
|
|
211
211
|
}, le = ["MMM", "MMMM"], de = {
|
|
212
212
|
preprocessor: (e, t) => e.getDate() === 1 || !t.some(
|
|
213
213
|
(r) => r.isToken && le.includes(r.value)
|
|
@@ -229,11 +229,11 @@ const Y = [
|
|
|
229
229
|
defaultWidth: "wide"
|
|
230
230
|
}),
|
|
231
231
|
day: C({
|
|
232
|
-
values:
|
|
232
|
+
values: oe,
|
|
233
233
|
defaultWidth: "wide"
|
|
234
234
|
}),
|
|
235
235
|
dayPeriod: C({
|
|
236
|
-
values:
|
|
236
|
+
values: ie,
|
|
237
237
|
defaultWidth: "wide"
|
|
238
238
|
})
|
|
239
239
|
}, ce = /^(\d+)(ième|ère|ème|er|e)?/i, ue = /\d+/i, me = {
|
|
@@ -340,7 +340,7 @@ const Y = [
|
|
|
340
340
|
parsePatterns: xe,
|
|
341
341
|
defaultParseWidth: "any"
|
|
342
342
|
})
|
|
343
|
-
},
|
|
343
|
+
}, S = {
|
|
344
344
|
code: "fr",
|
|
345
345
|
formatDistance: B,
|
|
346
346
|
formatLong: Z,
|
|
@@ -352,20 +352,20 @@ const Y = [
|
|
|
352
352
|
firstWeekContainsDate: 4
|
|
353
353
|
}
|
|
354
354
|
}, De = ({ date: e, onDateChange: t, placeholder: s }) => {
|
|
355
|
-
const [r,
|
|
355
|
+
const [r, i] = P(!1), l = j(null);
|
|
356
356
|
T(() => {
|
|
357
357
|
if (!r) return;
|
|
358
358
|
const u = (f) => {
|
|
359
|
-
l.current !== null && !l.current.contains(f.target) &&
|
|
359
|
+
l.current !== null && !l.current.contains(f.target) && i(!1);
|
|
360
360
|
};
|
|
361
361
|
return document.addEventListener("mousedown", u), () => {
|
|
362
362
|
document.removeEventListener("mousedown", u);
|
|
363
363
|
};
|
|
364
364
|
}, [r]);
|
|
365
365
|
const m = () => {
|
|
366
|
-
|
|
366
|
+
i((u) => !u);
|
|
367
367
|
}, c = (u) => {
|
|
368
|
-
t(u),
|
|
368
|
+
t(u), i(!1);
|
|
369
369
|
};
|
|
370
370
|
return /* @__PURE__ */ d("div", { ref: l, className: "relative w-full", children: [
|
|
371
371
|
/* @__PURE__ */ d(
|
|
@@ -381,17 +381,17 @@ const Y = [
|
|
|
381
381
|
),
|
|
382
382
|
children: [
|
|
383
383
|
/* @__PURE__ */ n(H, { className: "mr-2 h-4 w-4 shrink-0" }),
|
|
384
|
-
e !== void 0 ?
|
|
384
|
+
e !== void 0 ? W(e, "dd/MM/yyyy", { locale: S }) : /* @__PURE__ */ n("span", { children: s })
|
|
385
385
|
]
|
|
386
386
|
}
|
|
387
387
|
),
|
|
388
388
|
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
|
|
389
389
|
] });
|
|
390
390
|
}, Ee = ({ value: e, onChange: t, placeholder: s = "Selectionner une periode", className: r }) => {
|
|
391
|
-
const [
|
|
391
|
+
const [i, l] = L.useState(!1), [m, c] = L.useState(e);
|
|
392
392
|
L.useEffect(() => {
|
|
393
|
-
|
|
394
|
-
}, [
|
|
393
|
+
i && c(e);
|
|
394
|
+
}, [i, e]);
|
|
395
395
|
const u = (h) => {
|
|
396
396
|
h.stopPropagation(), t(void 0), l(!1);
|
|
397
397
|
}, f = () => {
|
|
@@ -400,8 +400,8 @@ const Y = [
|
|
|
400
400
|
c(e), l(!1);
|
|
401
401
|
}, w = () => {
|
|
402
402
|
c(void 0);
|
|
403
|
-
}, x = (h) => h != null && h.from ? !h.to || h.from.getTime() === h.to.getTime() ?
|
|
404
|
-
return /* @__PURE__ */ n("div", { className: b("grid gap-2", r), children: /* @__PURE__ */ d(F, { open:
|
|
403
|
+
}, x = (h) => h != null && h.from ? !h.to || h.from.getTime() === h.to.getTime() ? W(h.from, "dd MMM yyyy", { locale: S }) : `${W(h.from, "dd MMM yyyy", { locale: S })} - ${W(h.to, "dd MMM yyyy", { locale: S })}` : s;
|
|
404
|
+
return /* @__PURE__ */ n("div", { className: b("grid gap-2", r), children: /* @__PURE__ */ d(F, { open: i, onOpenChange: l, children: [
|
|
405
405
|
/* @__PURE__ */ n(X, { asChild: !0, children: /* @__PURE__ */ d(y, { id: "date", variant: "outline", className: b("w-[300px] justify-start text-left font-normal", !(e != null && e.from) && "text-muted-foreground"), children: [
|
|
406
406
|
/* @__PURE__ */ n(H, { className: "mr-2 size-4" }),
|
|
407
407
|
x(e),
|
|
@@ -445,12 +445,12 @@ const Y = [
|
|
|
445
445
|
selected: t,
|
|
446
446
|
onToggle: s,
|
|
447
447
|
onClear: r,
|
|
448
|
-
onSelectAll:
|
|
448
|
+
onSelectAll: i,
|
|
449
449
|
placeholder: l = "Sélectionner...",
|
|
450
450
|
searchable: m = !1,
|
|
451
451
|
searchPlaceholder: c = "Rechercher..."
|
|
452
452
|
}) => {
|
|
453
|
-
const [u, f] = P(""), [p, w] = P(!1), x = j(null), h = j(null), g = z(() => u === "" ? e : e.filter((a) => a.label.toLowerCase().includes(u.toLowerCase())), [e, u]),
|
|
453
|
+
const [u, f] = P(""), [p, w] = P(!1), x = 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]);
|
|
454
454
|
T(() => {
|
|
455
455
|
p && m && requestAnimationFrame(() => {
|
|
456
456
|
var a;
|
|
@@ -466,14 +466,14 @@ const Y = [
|
|
|
466
466
|
};
|
|
467
467
|
}, [p]);
|
|
468
468
|
const M = () => {
|
|
469
|
-
if (
|
|
469
|
+
if (o) {
|
|
470
470
|
const a = g.map((N) => N.value), v = t.filter((N) => !a.includes(N));
|
|
471
|
-
|
|
471
|
+
i !== void 0 ? i(v) : r();
|
|
472
472
|
} else {
|
|
473
473
|
const a = [...t];
|
|
474
474
|
g.forEach((v) => {
|
|
475
475
|
a.includes(v.value) || a.push(v.value);
|
|
476
|
-
}),
|
|
476
|
+
}), i !== void 0 ? i(a) : g.forEach((v) => {
|
|
477
477
|
t.includes(v.value) || s(v.value);
|
|
478
478
|
});
|
|
479
479
|
}
|
|
@@ -532,7 +532,7 @@ const Y = [
|
|
|
532
532
|
] }) }) : null,
|
|
533
533
|
/* @__PURE__ */ d("div", { className: "flex flex-col gap-0.5 max-h-56 overflow-y-auto p-1.5", children: [
|
|
534
534
|
g.length > 0 && /* @__PURE__ */ d("label", { className: "flex items-center gap-2.5 rounded-md px-2 py-2 text-sm hover:bg-muted cursor-pointer transition-colors", children: [
|
|
535
|
-
/* @__PURE__ */ n(O, { checked:
|
|
535
|
+
/* @__PURE__ */ n(O, { checked: o, onCheckedChange: M }),
|
|
536
536
|
"Tout sélectionner"
|
|
537
537
|
] }),
|
|
538
538
|
g.length === 0 && /* @__PURE__ */ n("p", { className: "px-2 py-3 text-center text-xs text-muted-foreground", children: "Aucun résultat" }),
|
|
@@ -565,29 +565,29 @@ const Y = [
|
|
|
565
565
|
value: t,
|
|
566
566
|
onChange: s,
|
|
567
567
|
placeholder: r = "Sélectionner...",
|
|
568
|
-
searchPlaceholder:
|
|
568
|
+
searchPlaceholder: i = "Rechercher..."
|
|
569
569
|
}) => {
|
|
570
|
-
const [l, m] = P(""), [c, u] = P(!1), f = j(null), p = j(null), w = z(() => l === "" ? e : e.filter((
|
|
571
|
-
var
|
|
570
|
+
const [l, m] = P(""), [c, u] = P(!1), f = j(null), p = j(null), w = z(() => l === "" ? e : e.filter((o) => o.label.toLowerCase().includes(l.toLowerCase())), [e, l]), x = z(() => {
|
|
571
|
+
var o;
|
|
572
572
|
if (!(t === void 0 || t === ""))
|
|
573
|
-
return ((
|
|
573
|
+
return ((o = e.find((M) => M.value === t)) == null ? void 0 : o.label) ?? t;
|
|
574
574
|
}, [e, t]);
|
|
575
575
|
T(() => {
|
|
576
576
|
c && requestAnimationFrame(() => {
|
|
577
|
-
var
|
|
578
|
-
(
|
|
577
|
+
var o;
|
|
578
|
+
(o = p.current) == null || o.focus();
|
|
579
579
|
});
|
|
580
580
|
}, [c]), T(() => {
|
|
581
581
|
if (!c) return;
|
|
582
|
-
const
|
|
582
|
+
const o = (M) => {
|
|
583
583
|
f.current !== null && !f.current.contains(M.target) && (u(!1), m(""));
|
|
584
584
|
};
|
|
585
|
-
return document.addEventListener("mousedown",
|
|
586
|
-
document.removeEventListener("mousedown",
|
|
585
|
+
return document.addEventListener("mousedown", o), () => {
|
|
586
|
+
document.removeEventListener("mousedown", o);
|
|
587
587
|
};
|
|
588
588
|
}, [c]);
|
|
589
|
-
const h = (
|
|
590
|
-
s(
|
|
589
|
+
const h = (o) => {
|
|
590
|
+
s(o), u(!1), m("");
|
|
591
591
|
};
|
|
592
592
|
return /* @__PURE__ */ d("div", { ref: f, className: "relative w-full", children: [
|
|
593
593
|
/* @__PURE__ */ d(
|
|
@@ -596,7 +596,7 @@ const Y = [
|
|
|
596
596
|
variant: "outline",
|
|
597
597
|
type: "button",
|
|
598
598
|
onClick: () => {
|
|
599
|
-
u((
|
|
599
|
+
u((o) => (o && m(""), !o));
|
|
600
600
|
},
|
|
601
601
|
className: b(
|
|
602
602
|
"w-full justify-between text-left font-normal focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
@@ -617,33 +617,33 @@ const Y = [
|
|
|
617
617
|
{
|
|
618
618
|
ref: p,
|
|
619
619
|
className: "w-full rounded-md bg-muted/50 py-1.5 pl-7 pr-2 text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring",
|
|
620
|
-
placeholder:
|
|
620
|
+
placeholder: i,
|
|
621
621
|
value: l,
|
|
622
|
-
onChange: (
|
|
623
|
-
m(
|
|
622
|
+
onChange: (o) => {
|
|
623
|
+
m(o.target.value);
|
|
624
624
|
}
|
|
625
625
|
}
|
|
626
626
|
)
|
|
627
627
|
] }) }),
|
|
628
628
|
/* @__PURE__ */ d("div", { className: "flex flex-col gap-0.5 max-h-56 overflow-y-auto p-1.5", children: [
|
|
629
629
|
w.length === 0 && /* @__PURE__ */ n("p", { className: "px-2 py-3 text-center text-xs text-muted-foreground", children: "Aucun résultat" }),
|
|
630
|
-
w.map((
|
|
630
|
+
w.map((o) => /* @__PURE__ */ d(
|
|
631
631
|
"button",
|
|
632
632
|
{
|
|
633
633
|
type: "button",
|
|
634
634
|
onClick: () => {
|
|
635
|
-
h(
|
|
635
|
+
h(o.value);
|
|
636
636
|
},
|
|
637
637
|
className: b(
|
|
638
638
|
"flex items-center gap-2.5 rounded-md px-2 py-2 text-sm hover:bg-muted cursor-pointer transition-colors text-left w-full",
|
|
639
|
-
t ===
|
|
639
|
+
t === o.value && "bg-muted font-medium"
|
|
640
640
|
),
|
|
641
641
|
children: [
|
|
642
|
-
/* @__PURE__ */ n(I, { className: b("size-3.5 shrink-0", t ===
|
|
643
|
-
|
|
642
|
+
/* @__PURE__ */ n(I, { className: b("size-3.5 shrink-0", t === o.value ? "opacity-100" : "opacity-0") }),
|
|
643
|
+
o.label
|
|
644
644
|
]
|
|
645
645
|
},
|
|
646
|
-
|
|
646
|
+
o.value
|
|
647
647
|
))
|
|
648
648
|
] })
|
|
649
649
|
] }) : null
|
|
@@ -653,7 +653,7 @@ const Y = [
|
|
|
653
653
|
search: t,
|
|
654
654
|
placeholder: s = "Rechercher...",
|
|
655
655
|
onSearch: r,
|
|
656
|
-
onSubmit:
|
|
656
|
+
onSubmit: i,
|
|
657
657
|
onClear: l,
|
|
658
658
|
className: m
|
|
659
659
|
}) => {
|
|
@@ -672,7 +672,7 @@ const Y = [
|
|
|
672
672
|
},
|
|
673
673
|
className: "pl-8",
|
|
674
674
|
onKeyDown: (f) => {
|
|
675
|
-
f.key === "Enter" &&
|
|
675
|
+
f.key === "Enter" && i !== void 0 && (f.preventDefault(), i());
|
|
676
676
|
}
|
|
677
677
|
}
|
|
678
678
|
),
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as m, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { useState as k, useEffect as M, useMemo as A } from "react";
|
|
3
|
-
import { M as
|
|
4
|
-
import {
|
|
5
|
-
import "./
|
|
6
|
-
import { B as w, C as
|
|
3
|
+
import { M as $, a as O, D as _, b as I, S as j } from "./SearchInput-CvBCMaFl.js";
|
|
4
|
+
import { aW as C, bD as z, bM as R, bF as B, bI as Q, bL as V, a$ as H, bH as W, bv as X, bx as G, bw as J, ce as K, _ as P } from "./toggle-group-iLf3T7oV.js";
|
|
5
|
+
import "./alert-sHZy6NHC.js";
|
|
6
|
+
import { B as w, C as U } from "./tooltip-CAu4DEhc.js";
|
|
7
7
|
import { X as E, S as Y, h as Z, i as q, a as ee, c as re } from "./select-zzSnHs9S.js";
|
|
8
8
|
import "next-themes";
|
|
9
9
|
import { B as L } from "./badge-C09fRxvd.js";
|
|
@@ -30,15 +30,15 @@ const ae = [
|
|
|
30
30
|
return i !== void 0 ? i : s.includes("ok") || l === "true" || l === "false" ? l === "true" ? "Oui" : "Non" : o;
|
|
31
31
|
};
|
|
32
32
|
function ce({ filters: s, onRemoveFilter: l, onClearAll: a, filterLabels: o = {}, optionLabels: i = {} }) {
|
|
33
|
-
const d = Object.entries(s).filter(([n,
|
|
34
|
-
return d.length === 0 ? null : /* @__PURE__ */
|
|
33
|
+
const d = Object.entries(s).filter(([n, p]) => !(p == null || p === "" || Array.isArray(p) && p.length === 0));
|
|
34
|
+
return d.length === 0 ? null : /* @__PURE__ */ m("div", { className: "flex flex-wrap items-center gap-2 mb-4", children: [
|
|
35
35
|
/* @__PURE__ */ r("span", { className: "text-sm text-gray-600 font-medium", children: "Filtres actifs :" }),
|
|
36
|
-
d.flatMap(([n,
|
|
36
|
+
d.flatMap(([n, p]) => {
|
|
37
37
|
const f = o[n] ?? n;
|
|
38
|
-
if (Array.isArray(
|
|
39
|
-
return
|
|
38
|
+
if (Array.isArray(p))
|
|
39
|
+
return p.map((v) => {
|
|
40
40
|
const b = T(n, v, i);
|
|
41
|
-
return /* @__PURE__ */
|
|
41
|
+
return /* @__PURE__ */ m(
|
|
42
42
|
L,
|
|
43
43
|
{
|
|
44
44
|
variant: "secondary",
|
|
@@ -62,8 +62,8 @@ function ce({ filters: s, onRemoveFilter: l, onClearAll: a, filterLabels: o = {}
|
|
|
62
62
|
`${n}_${String(v)}`
|
|
63
63
|
);
|
|
64
64
|
});
|
|
65
|
-
const x = T(n,
|
|
66
|
-
return /* @__PURE__ */
|
|
65
|
+
const x = T(n, p, i);
|
|
66
|
+
return /* @__PURE__ */ m(L, { variant: "secondary", className: "flex items-center gap-1 px-3 py-1 bg-blue-50 text-blue-700 border border-blue-200 hover:bg-blue-100", children: [
|
|
67
67
|
f,
|
|
68
68
|
": ",
|
|
69
69
|
x,
|
|
@@ -112,7 +112,7 @@ const ne = ({ field: s, value: l, onChange: a, onToggleMultiSelect: o }) => {
|
|
|
112
112
|
);
|
|
113
113
|
case "select":
|
|
114
114
|
return s.searchable === !0 ? /* @__PURE__ */ r(
|
|
115
|
-
|
|
115
|
+
I,
|
|
116
116
|
{
|
|
117
117
|
options: s.options ?? [],
|
|
118
118
|
value: l,
|
|
@@ -120,17 +120,17 @@ const ne = ({ field: s, value: l, onChange: a, onToggleMultiSelect: o }) => {
|
|
|
120
120
|
placeholder: s.placeholder,
|
|
121
121
|
searchPlaceholder: s.searchPlaceholder
|
|
122
122
|
}
|
|
123
|
-
) : /* @__PURE__ */
|
|
123
|
+
) : /* @__PURE__ */ m(Y, { value: l ?? "", onValueChange: a, children: [
|
|
124
124
|
/* @__PURE__ */ r(Z, { className: te((l === void 0 || l === "") && "text-muted-foreground"), children: /* @__PURE__ */ r(q, { placeholder: s.placeholder }) }),
|
|
125
125
|
/* @__PURE__ */ r(ee, { children: (i = s.options) == null ? void 0 : i.map((d) => /* @__PURE__ */ r(re, { value: d.value, children: d.label }, d.value)) })
|
|
126
126
|
] });
|
|
127
127
|
case "date":
|
|
128
|
-
return /* @__PURE__ */ r(
|
|
128
|
+
return /* @__PURE__ */ r(_, { date: l, onDateChange: a, placeholder: s.placeholder ?? "Sélectionner une date" });
|
|
129
129
|
case "date-range":
|
|
130
|
-
return /* @__PURE__ */ r(
|
|
130
|
+
return /* @__PURE__ */ r(O, { value: l, onChange: a, placeholder: s.placeholder });
|
|
131
131
|
case "multi-select":
|
|
132
132
|
return /* @__PURE__ */ r(
|
|
133
|
-
|
|
133
|
+
$,
|
|
134
134
|
{
|
|
135
135
|
options: s.options ?? [],
|
|
136
136
|
selected: l ?? [],
|
|
@@ -155,36 +155,36 @@ function oe({
|
|
|
155
155
|
buttonText: o = "Plus de filtres",
|
|
156
156
|
sheetTitle: i = "Filtres avancés"
|
|
157
157
|
}) {
|
|
158
|
-
const [d, n] = k(!1), [
|
|
158
|
+
const [d, n] = k(!1), [p, f] = k(l);
|
|
159
159
|
M(() => {
|
|
160
160
|
f(l);
|
|
161
161
|
}, [l, d]);
|
|
162
162
|
const x = (g, t) => {
|
|
163
163
|
f((h) => ({ ...h, [g]: t }));
|
|
164
164
|
}, v = (g, t) => {
|
|
165
|
-
const h =
|
|
165
|
+
const h = p[g], e = Array.isArray(h) ? h : [], u = e.includes(t) ? e.filter((c) => c !== t) : [...e, t];
|
|
166
166
|
x(g, u);
|
|
167
167
|
}, b = () => {
|
|
168
|
-
a(
|
|
168
|
+
a(p), n(!1);
|
|
169
169
|
}, N = () => {
|
|
170
170
|
f({}), a({}), n(!1);
|
|
171
171
|
};
|
|
172
|
-
return /* @__PURE__ */
|
|
173
|
-
/* @__PURE__ */ r(
|
|
172
|
+
return /* @__PURE__ */ m(z, { open: d, onOpenChange: n, children: [
|
|
173
|
+
/* @__PURE__ */ r(R, { asChild: !0, children: /* @__PURE__ */ m(w, { variant: "outline", className: "gap-2", children: [
|
|
174
174
|
/* @__PURE__ */ r(se, { className: "size-4 shrink-0" }),
|
|
175
175
|
o
|
|
176
176
|
] }) }),
|
|
177
|
-
/* @__PURE__ */
|
|
178
|
-
/* @__PURE__ */ r(
|
|
179
|
-
/* @__PURE__ */ r("div", { className: "flex-1 overflow-y-auto p-6 pt-6", children: /* @__PURE__ */ r("div", { className: "space-y-6", children: s.map((g, t) => /* @__PURE__ */
|
|
177
|
+
/* @__PURE__ */ m(B, { side: "right", className: "w-[400px] sm:w-[500px] flex flex-col p-0", children: [
|
|
178
|
+
/* @__PURE__ */ r(Q, { className: "p-6 pb-0", children: /* @__PURE__ */ r(V, { children: i }) }),
|
|
179
|
+
/* @__PURE__ */ r("div", { className: "flex-1 overflow-y-auto p-6 pt-6", children: /* @__PURE__ */ r("div", { className: "space-y-6", children: s.map((g, t) => /* @__PURE__ */ m("div", { className: "space-y-4", children: [
|
|
180
180
|
/* @__PURE__ */ r("h3", { className: "font-semibold text-sm text-gray-900 dark:text-gray-100 border-b pb-2", children: g.title }),
|
|
181
|
-
g.filters.map((h) => /* @__PURE__ */
|
|
181
|
+
g.filters.map((h) => /* @__PURE__ */ m("div", { className: "space-y-2", children: [
|
|
182
182
|
/* @__PURE__ */ r(H, { htmlFor: h.key, children: h.label }),
|
|
183
183
|
/* @__PURE__ */ r(
|
|
184
184
|
ne,
|
|
185
185
|
{
|
|
186
186
|
field: h,
|
|
187
|
-
value:
|
|
187
|
+
value: p[h.key],
|
|
188
188
|
onChange: (e) => {
|
|
189
189
|
x(h.key, e);
|
|
190
190
|
},
|
|
@@ -195,7 +195,7 @@ function oe({
|
|
|
195
195
|
)
|
|
196
196
|
] }, h.key))
|
|
197
197
|
] }, t)) }) }),
|
|
198
|
-
/* @__PURE__ */
|
|
198
|
+
/* @__PURE__ */ m(W, { className: "gap-2 p-6 border-t bg-white dark:bg-gray-950", children: [
|
|
199
199
|
/* @__PURE__ */ r(w, { variant: "outline", className: "flex-1", onClick: N, children: "Effacer les filtres" }),
|
|
200
200
|
/* @__PURE__ */ r(w, { className: "flex-1 bg-orange-500 hover:bg-orange-600 text-white", onClick: b, children: "Rechercher" })
|
|
201
201
|
] })
|
|
@@ -210,7 +210,7 @@ function ie({
|
|
|
210
210
|
onClear: i,
|
|
211
211
|
onSelectAll: d,
|
|
212
212
|
searchable: n = !1,
|
|
213
|
-
searchPlaceholder:
|
|
213
|
+
searchPlaceholder: p = "Rechercher..."
|
|
214
214
|
}) {
|
|
215
215
|
const [f, x] = k(""), v = a.length > 0, b = A(() => f === "" ? l : l.filter((t) => t.label.toLowerCase().includes(f.toLowerCase())), [l, f]), N = A(() => b.length === 0 ? !1 : b.every((t) => a.includes(t.value)), [b, a]), g = () => {
|
|
216
216
|
if (N)
|
|
@@ -230,32 +230,32 @@ function ie({
|
|
|
230
230
|
a.includes(t.value) || o(t.value);
|
|
231
231
|
});
|
|
232
232
|
};
|
|
233
|
-
return /* @__PURE__ */
|
|
234
|
-
|
|
233
|
+
return /* @__PURE__ */ m(
|
|
234
|
+
X,
|
|
235
235
|
{
|
|
236
236
|
onOpenChange: () => {
|
|
237
237
|
x("");
|
|
238
238
|
},
|
|
239
239
|
children: [
|
|
240
|
-
/* @__PURE__ */ r(
|
|
240
|
+
/* @__PURE__ */ r(G, { asChild: !0, children: /* @__PURE__ */ m(
|
|
241
241
|
"button",
|
|
242
242
|
{
|
|
243
243
|
className: `inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-sm transition-colors whitespace-nowrap ${v ? "border-primary bg-primary/10 text-primary font-medium" : "border-border bg-card text-card-foreground hover:bg-muted"}`,
|
|
244
244
|
children: [
|
|
245
245
|
s,
|
|
246
246
|
a.length > 0 && /* @__PURE__ */ r("span", { className: "flex h-4 min-w-[16px] items-center justify-center rounded-full bg-primary px-1 text-[10px] font-bold text-primary-foreground", children: a.length }),
|
|
247
|
-
/* @__PURE__ */ r(
|
|
247
|
+
/* @__PURE__ */ r(U, { className: "size-3.5 opacity-60" })
|
|
248
248
|
]
|
|
249
249
|
}
|
|
250
250
|
) }),
|
|
251
|
-
/* @__PURE__ */
|
|
252
|
-
n ? /* @__PURE__ */ r("div", { className: "border-b border-border p-2", children: /* @__PURE__ */
|
|
251
|
+
/* @__PURE__ */ m(J, { className: "w-56 p-0", align: "start", children: [
|
|
252
|
+
n ? /* @__PURE__ */ r("div", { className: "border-b border-border p-2", children: /* @__PURE__ */ m("div", { className: "relative", children: [
|
|
253
253
|
/* @__PURE__ */ r(K, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
|
|
254
254
|
/* @__PURE__ */ r(
|
|
255
255
|
"input",
|
|
256
256
|
{
|
|
257
257
|
className: "w-full rounded-md bg-muted/50 py-1.5 pl-7 pr-2 text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring",
|
|
258
|
-
placeholder:
|
|
258
|
+
placeholder: p,
|
|
259
259
|
value: f,
|
|
260
260
|
onChange: (t) => {
|
|
261
261
|
x(t.target.value);
|
|
@@ -264,13 +264,13 @@ function ie({
|
|
|
264
264
|
}
|
|
265
265
|
)
|
|
266
266
|
] }) }) : null,
|
|
267
|
-
/* @__PURE__ */
|
|
268
|
-
b.length > 0 && /* @__PURE__ */
|
|
267
|
+
/* @__PURE__ */ m("div", { className: "flex flex-col gap-0.5 max-h-56 overflow-y-auto p-1.5", children: [
|
|
268
|
+
b.length > 0 && /* @__PURE__ */ m("label", { className: "flex items-center gap-2.5 rounded-md px-2 py-2 text-sm hover:bg-muted cursor-pointer transition-colors", children: [
|
|
269
269
|
/* @__PURE__ */ r(P, { checked: N, onCheckedChange: g }),
|
|
270
270
|
"Tout sélectionner"
|
|
271
271
|
] }),
|
|
272
272
|
b.length === 0 && /* @__PURE__ */ r("p", { className: "px-2 py-3 text-center text-xs text-muted-foreground", children: "Aucun résultat" }),
|
|
273
|
-
b.map((t) => /* @__PURE__ */
|
|
273
|
+
b.map((t) => /* @__PURE__ */ m("label", { className: "flex items-center gap-2.5 rounded-md px-2 py-2 text-sm hover:bg-muted cursor-pointer transition-colors", children: [
|
|
274
274
|
/* @__PURE__ */ r(
|
|
275
275
|
P,
|
|
276
276
|
{
|
|
@@ -308,7 +308,7 @@ function Ne({
|
|
|
308
308
|
onFiltersChange: i,
|
|
309
309
|
filterLabels: d = {},
|
|
310
310
|
sections: n,
|
|
311
|
-
advancedButtonText:
|
|
311
|
+
advancedButtonText: p = "Filtres",
|
|
312
312
|
sheetTitle: f = "Filtres avancés"
|
|
313
313
|
}) {
|
|
314
314
|
const x = (e, u) => {
|
|
@@ -352,8 +352,8 @@ function Ne({
|
|
|
352
352
|
});
|
|
353
353
|
}), e;
|
|
354
354
|
}, [n]);
|
|
355
|
-
return /* @__PURE__ */
|
|
356
|
-
/* @__PURE__ */ r("div", { className: "flex flex-wrap items-center gap-3 justify-between", children: /* @__PURE__ */
|
|
355
|
+
return /* @__PURE__ */ m("div", { className: "space-y-4 w-full", children: [
|
|
356
|
+
/* @__PURE__ */ r("div", { className: "flex flex-wrap items-center gap-3 justify-between", children: /* @__PURE__ */ m("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
357
357
|
l !== void 0 ? /* @__PURE__ */ r(
|
|
358
358
|
j,
|
|
359
359
|
{
|
|
@@ -385,7 +385,7 @@ function Ne({
|
|
|
385
385
|
},
|
|
386
386
|
e.key
|
|
387
387
|
)),
|
|
388
|
-
n.length > 0 && /* @__PURE__ */ r(oe, { sections: n, filters: o, onFiltersChange: i, buttonText:
|
|
388
|
+
n.length > 0 && /* @__PURE__ */ r(oe, { sections: n, filters: o, onFiltersChange: i, buttonText: p, sheetTitle: f })
|
|
389
389
|
] }) }),
|
|
390
390
|
/* @__PURE__ */ r(
|
|
391
391
|
ce,
|