@krosoft/react 0.0.182 → 0.0.184

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.
Files changed (75) hide show
  1. package/dist/{AppActions-DEkRxBia.js → AppActions-DZ7wVdmt.js} +8 -7
  2. package/dist/{AppSubTitle-ChCtQ7Sv.js → AppSubTitle-CZN_tmfv.js} +1 -1
  3. package/dist/AppVerticalTabs-C1SsBNAH.js +100 -0
  4. package/dist/{ConfirmationDialog-BPXA2g3g.js → ConfirmationDialog-M8sFAz4h.js} +7 -6
  5. package/dist/{DataTable-ny08K506.js → DataTable-KMYbhJ4C.js} +29 -28
  6. package/dist/{GenericForm-B39toMkE.js → GenericForm-DtY0moOD.js} +93 -92
  7. package/dist/{ImageInput-BoYUZx9H.js → ImageInput-3wZuCZGf.js} +2 -1
  8. package/dist/{KpiCardsLayout-mQ7AcbqA.js → KpiCardsLayout-DjRTqXFa.js} +16 -15
  9. package/dist/{MetricCard-CvQFjIOb.js → MetricCard-B0xnFyim.js} +1 -1
  10. package/dist/{MultiSelect-CqcbwKYV.js → MultiSelect-BhRXVpky.js} +14 -13
  11. package/dist/PieChart-C9gn0Dws.js +282 -0
  12. package/dist/SearchInput-BXOlvTO9.js +251 -0
  13. package/dist/{SkeletonCards-BvJYF_LK.js → SkeletonCards-av7XHlof.js} +12 -11
  14. package/dist/{TableFilter-CWDy_RHA.js → TableFilter-BlrrSOtg.js} +21 -20
  15. package/dist/chart-DntJZGxB.js +181 -0
  16. package/dist/components/core/cards/index.js +2 -2
  17. package/dist/components/core/charts/BarChartHorizontal.d.ts +24 -0
  18. package/dist/components/core/charts/BarChartHorizontal.d.ts.map +1 -0
  19. package/dist/components/core/charts/BarChartVertical.d.ts +24 -0
  20. package/dist/components/core/charts/BarChartVertical.d.ts.map +1 -0
  21. package/dist/components/core/charts/ChartCard.d.ts +31 -0
  22. package/dist/components/core/charts/ChartCard.d.ts.map +1 -0
  23. package/dist/components/core/charts/CircularGauge.d.ts +39 -0
  24. package/dist/components/core/charts/CircularGauge.d.ts.map +1 -0
  25. package/dist/components/core/charts/LineChart.d.ts +23 -0
  26. package/dist/components/core/charts/LineChart.d.ts.map +1 -0
  27. package/dist/components/core/charts/PieChart.d.ts +26 -0
  28. package/dist/components/core/charts/PieChart.d.ts.map +1 -0
  29. package/dist/components/core/charts/chartColors.d.ts +13 -0
  30. package/dist/components/core/charts/chartColors.d.ts.map +1 -0
  31. package/dist/components/core/charts/chartTooltip.helper.d.ts +14 -0
  32. package/dist/components/core/charts/chartTooltip.helper.d.ts.map +1 -0
  33. package/dist/components/core/charts/index.d.ts +14 -0
  34. package/dist/components/core/charts/index.d.ts.map +1 -0
  35. package/dist/components/core/charts/index.js +11 -0
  36. package/dist/components/core/dialogs/index.js +2 -2
  37. package/dist/components/core/filters/index.js +1 -1
  38. package/dist/components/core/forms/index.js +1 -1
  39. package/dist/components/core/index.d.ts +1 -0
  40. package/dist/components/core/index.d.ts.map +1 -1
  41. package/dist/components/core/index.js +80 -71
  42. package/dist/components/core/inputs/SearchableSelect.d.ts +16 -2
  43. package/dist/components/core/inputs/SearchableSelect.d.ts.map +1 -1
  44. package/dist/components/core/inputs/index.d.ts +1 -0
  45. package/dist/components/core/inputs/index.d.ts.map +1 -1
  46. package/dist/components/core/inputs/index.js +3 -3
  47. package/dist/components/core/layouts/index.js +3 -3
  48. package/dist/components/core/table/index.js +1 -1
  49. package/dist/components/core/tabs/AppTabs.d.ts.map +1 -1
  50. package/dist/components/core/tabs/index.js +1 -1
  51. package/dist/components/index.js +307 -297
  52. package/dist/components/ui/index.d.ts +1 -0
  53. package/dist/components/ui/index.d.ts.map +1 -1
  54. package/dist/components/ui/index.js +218 -217
  55. package/dist/components/ui/tabs.d.ts.map +1 -1
  56. package/dist/hooks/index.js +9 -7
  57. package/dist/hooks/ui/index.d.ts +1 -0
  58. package/dist/hooks/ui/index.d.ts.map +1 -1
  59. package/dist/hooks/ui/index.js +11 -9
  60. package/dist/hooks/ui/useScrollFade.d.ts +11 -0
  61. package/dist/hooks/ui/useScrollFade.d.ts.map +1 -0
  62. package/dist/tailwind/index.d.ts +7 -0
  63. package/dist/tailwind/index.d.ts.map +1 -1
  64. package/dist/tailwind/index.js +11 -2
  65. package/dist/{toaster-B6XKMRwI.js → toaster-Cm7utXqi.js} +13 -13
  66. package/dist/toggle-group-D6aFQQcf.js +1460 -0
  67. package/dist/types/ChartDatum.d.ts +19 -0
  68. package/dist/types/ChartDatum.d.ts.map +1 -0
  69. package/dist/types/index.d.ts +1 -0
  70. package/dist/types/index.d.ts.map +1 -1
  71. package/dist/useScrollFade-BA4KqJYp.js +23 -0
  72. package/package.json +1 -1
  73. package/dist/AppVerticalTabs-D8fURUUN.js +0 -94
  74. package/dist/SearchInput-ClZbbRWg.js +0 -254
  75. package/dist/toggle-group-D6c-gM1D.js +0 -1618
@@ -0,0 +1,282 @@
1
+ import { jsxs as d, jsx as e } from "react/jsx-runtime";
2
+ import { f as C, j as x, k as N, C as A, d as R, e as V, b as P, a as S, g as B, h as H } from "./chart-DntJZGxB.js";
3
+ import { c as k } from "./tailwind.helper-B6yFEsav.js";
4
+ import * as g from "react";
5
+ import { BarChart as T, CartesianGrid as M, XAxis as w, YAxis as D, Bar as j, LineChart as O, Line as _, PieChart as $, Pie as E } from "recharts";
6
+ import { S as I } from "./skeleton-BX4RcsiK.js";
7
+ import { u as G } from "./useMobile-DN1_OMDB.js";
8
+ const y = (r, t) => r ? (n, i) => /* @__PURE__ */ d("div", { className: "flex flex-1 justify-between gap-4", children: [
9
+ /* @__PURE__ */ e("span", { className: "text-muted-foreground", children: t ?? String(i) }),
10
+ /* @__PURE__ */ e("span", { className: "font-mono font-medium tabular-nums text-foreground", children: r(Number(n)) })
11
+ ] }) : void 0, z = (r, t) => t > 0 && r.length > t ? `${r.slice(0, t)}…` : r, F = ({
12
+ data: r,
13
+ label: t = "Valeur",
14
+ color: s = "hsl(var(--primary))",
15
+ categoryWidth: n = 140,
16
+ maxLabelLength: i = 22,
17
+ valueFormatter: o,
18
+ onSelect: c,
19
+ className: u
20
+ }) => {
21
+ const m = g.useMemo(() => ({ value: { label: t, color: s } }), [t, s]), h = g.useMemo(() => y(o, t), [o, t]);
22
+ return /* @__PURE__ */ e(C, { config: m, className: k("aspect-auto size-full", u), children: /* @__PURE__ */ d(T, { data: r, layout: "vertical", margin: { top: 5, right: 20, left: 0, bottom: 5 }, children: [
23
+ /* @__PURE__ */ e(M, { strokeDasharray: "3 3", horizontal: !1 }),
24
+ /* @__PURE__ */ e(
25
+ w,
26
+ {
27
+ type: "number",
28
+ dataKey: "value",
29
+ allowDecimals: !1,
30
+ tickLine: !1,
31
+ axisLine: !1,
32
+ tickMargin: 8,
33
+ tickFormatter: o ? (a) => o(Number(a)) : void 0
34
+ }
35
+ ),
36
+ /* @__PURE__ */ e(
37
+ D,
38
+ {
39
+ type: "category",
40
+ dataKey: "name",
41
+ width: n,
42
+ tickLine: !1,
43
+ axisLine: !1,
44
+ tickFormatter: (a) => z(String(a), i)
45
+ }
46
+ ),
47
+ /* @__PURE__ */ e(x, { content: /* @__PURE__ */ e(N, { formatter: h }) }),
48
+ /* @__PURE__ */ e(
49
+ j,
50
+ {
51
+ dataKey: "value",
52
+ fill: "var(--color-value)",
53
+ radius: [0, 4, 4, 0],
54
+ className: c ? "cursor-pointer" : void 0,
55
+ onClick: c ? (a, l) => {
56
+ c(r[l], l);
57
+ } : void 0
58
+ }
59
+ )
60
+ ] }) });
61
+ }, ee = ({
62
+ data: r,
63
+ label: t = "Valeur",
64
+ color: s = "hsl(var(--primary))",
65
+ labelAngle: n,
66
+ valueFormatter: i,
67
+ allowDecimals: o = !1,
68
+ onSelect: c,
69
+ className: u
70
+ }) => {
71
+ const m = g.useMemo(() => ({ value: { label: t, color: s } }), [t, s]), h = g.useMemo(() => y(i, t), [i, t]), a = n !== void 0 && n !== 0;
72
+ return /* @__PURE__ */ e(C, { config: m, className: k("aspect-auto size-full", u), children: /* @__PURE__ */ d(T, { data: r, margin: { top: 10, right: 10, left: 0, bottom: a ? 20 : 10 }, children: [
73
+ /* @__PURE__ */ e(M, { strokeDasharray: "3 3", vertical: !1 }),
74
+ /* @__PURE__ */ e(
75
+ w,
76
+ {
77
+ dataKey: "name",
78
+ angle: n,
79
+ textAnchor: a ? "end" : "middle",
80
+ height: a ? 50 : void 0,
81
+ tickLine: !1,
82
+ axisLine: !1,
83
+ tickMargin: 8
84
+ }
85
+ ),
86
+ /* @__PURE__ */ e(
87
+ D,
88
+ {
89
+ allowDecimals: o,
90
+ tickLine: !1,
91
+ axisLine: !1,
92
+ width: i ? 48 : 32,
93
+ tickFormatter: i ? (l) => i(Number(l)) : void 0
94
+ }
95
+ ),
96
+ /* @__PURE__ */ e(x, { content: /* @__PURE__ */ e(N, { formatter: h }) }),
97
+ /* @__PURE__ */ e(
98
+ j,
99
+ {
100
+ dataKey: "value",
101
+ fill: "var(--color-value)",
102
+ radius: [4, 4, 0, 0],
103
+ className: c ? "cursor-pointer" : void 0,
104
+ onClick: c ? (l, f) => {
105
+ c(r[f], f);
106
+ } : void 0
107
+ }
108
+ )
109
+ ] }) });
110
+ }, K = [
111
+ "hsl(var(--k-chart-1))",
112
+ "hsl(var(--k-chart-2))",
113
+ "hsl(var(--k-chart-3))",
114
+ "hsl(var(--k-chart-4))",
115
+ "hsl(var(--k-chart-5))"
116
+ ], b = (r) => K[r % K.length], te = ({
117
+ title: r,
118
+ description: t,
119
+ icon: s,
120
+ actions: n,
121
+ isLoading: i = !1,
122
+ isEmpty: o = !1,
123
+ emptyLabel: c = "Aucune donnée disponible",
124
+ height: u = 300,
125
+ className: m,
126
+ contentClassName: h,
127
+ children: a
128
+ }) => {
129
+ const l = s, f = () => i ? /* @__PURE__ */ e(I, { className: "size-full rounded-surface" }) : o ? /* @__PURE__ */ e("div", { className: "flex size-full items-center justify-center", children: /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: c }) }) : a;
130
+ return /* @__PURE__ */ d(A, { className: m, children: [
131
+ /* @__PURE__ */ e(R, { children: /* @__PURE__ */ d("div", { className: "flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between", children: [
132
+ /* @__PURE__ */ d("div", { className: "min-w-0", children: [
133
+ /* @__PURE__ */ d(V, { className: "flex items-center gap-2", children: [
134
+ l && /* @__PURE__ */ e(l, { className: "size-5 shrink-0" }),
135
+ /* @__PURE__ */ e("span", { className: "truncate", children: r })
136
+ ] }),
137
+ t !== void 0 && t !== "" ? /* @__PURE__ */ e(P, { children: t }) : null
138
+ ] }),
139
+ n != null ? /* @__PURE__ */ e("div", { className: "shrink-0", children: n }) : null
140
+ ] }) }),
141
+ /* @__PURE__ */ e(S, { children: /* @__PURE__ */ e("div", { className: k("w-full", h), style: { height: u }, children: f() }) })
142
+ ] });
143
+ }, U = { warning: 50, danger: 80 }, W = (r, t) => r >= t.danger ? "hsl(var(--destructive))" : r >= t.warning ? "hsl(var(--k-warning))" : "hsl(var(--k-success))", re = ({
144
+ value: r,
145
+ max: t = 100,
146
+ size: s = 120,
147
+ strokeWidth: n = 8,
148
+ label: i,
149
+ unit: o = "%",
150
+ color: c,
151
+ thresholds: u = U,
152
+ valueFormatter: m = (a) => a.toFixed(1),
153
+ className: h
154
+ }) => {
155
+ const a = (s - n) / 2, l = a * 2 * Math.PI, f = t > 0 ? Math.min(100, Math.max(0, r / t * 100)) : 0, L = c ?? W(f, u);
156
+ return /* @__PURE__ */ d("div", { className: k("flex flex-col items-center gap-2", h), children: [
157
+ /* @__PURE__ */ d("div", { className: "relative", style: { width: s, height: s }, children: [
158
+ /* @__PURE__ */ d("svg", { width: s, height: s, className: "-rotate-90", children: [
159
+ /* @__PURE__ */ e("circle", { cx: s / 2, cy: s / 2, r: a, className: "stroke-muted", strokeWidth: n, fill: "transparent" }),
160
+ /* @__PURE__ */ e(
161
+ "circle",
162
+ {
163
+ cx: s / 2,
164
+ cy: s / 2,
165
+ r: a,
166
+ stroke: L,
167
+ strokeWidth: n,
168
+ fill: "transparent",
169
+ strokeDasharray: l,
170
+ strokeDashoffset: l - f / 100 * l,
171
+ strokeLinecap: "round",
172
+ className: "transition-all duration-500 ease-out"
173
+ }
174
+ )
175
+ ] }),
176
+ /* @__PURE__ */ d("div", { className: "absolute inset-0 flex flex-col items-center justify-center", children: [
177
+ /* @__PURE__ */ e("span", { className: "text-2xl font-bold text-card-foreground", children: m(r) }),
178
+ o !== "" && /* @__PURE__ */ e("span", { className: "text-sm text-muted-foreground", children: o })
179
+ ] })
180
+ ] }),
181
+ i !== void 0 && i !== "" ? /* @__PURE__ */ e("span", { className: "text-sm font-medium text-muted-foreground", children: i }) : null
182
+ ] });
183
+ }, ae = ({
184
+ data: r,
185
+ label: t = "Valeur",
186
+ color: s = "hsl(var(--primary))",
187
+ yAxisDomain: n,
188
+ valueFormatter: i,
189
+ labelFormatter: o,
190
+ showDots: c = !0,
191
+ className: u
192
+ }) => {
193
+ const m = g.useMemo(() => ({ value: { label: t, color: s } }), [t, s]), h = g.useMemo(() => y(i, t), [i, t]);
194
+ return /* @__PURE__ */ e(C, { config: m, className: k("aspect-auto size-full", u), children: /* @__PURE__ */ d(O, { data: r, margin: { top: 10, right: 20, left: 0, bottom: 10 }, children: [
195
+ /* @__PURE__ */ e(M, { strokeDasharray: "3 3", vertical: !1 }),
196
+ /* @__PURE__ */ e(
197
+ w,
198
+ {
199
+ dataKey: "name",
200
+ tickLine: !1,
201
+ axisLine: !1,
202
+ tickMargin: 8,
203
+ interval: "preserveStartEnd",
204
+ tickFormatter: o ? (a) => o(String(a)) : void 0
205
+ }
206
+ ),
207
+ /* @__PURE__ */ e(
208
+ D,
209
+ {
210
+ domain: n,
211
+ tickLine: !1,
212
+ axisLine: !1,
213
+ width: i ? 48 : 32,
214
+ tickFormatter: i ? (a) => i(Number(a)) : void 0
215
+ }
216
+ ),
217
+ /* @__PURE__ */ e(
218
+ x,
219
+ {
220
+ content: /* @__PURE__ */ e(N, { formatter: h, labelFormatter: o ? (a) => o(String(a)) : void 0 })
221
+ }
222
+ ),
223
+ /* @__PURE__ */ e(
224
+ _,
225
+ {
226
+ type: "monotone",
227
+ dataKey: "value",
228
+ stroke: "var(--color-value)",
229
+ strokeWidth: 2,
230
+ dot: c ? { fill: "var(--color-value)", strokeWidth: 0, r: 3 } : !1,
231
+ activeDot: { r: 5, strokeWidth: 2, className: "stroke-background" }
232
+ }
233
+ )
234
+ ] }) });
235
+ }, se = ({
236
+ data: r,
237
+ innerRadius: t,
238
+ outerRadius: s,
239
+ showLegend: n = !0,
240
+ showLabels: i = !1,
241
+ valueFormatter: o,
242
+ onSelect: c,
243
+ className: u
244
+ }) => {
245
+ const m = G(), h = g.useMemo(() => r.map((p, v) => ({ ...p, fill: p.color ?? b(v) })), [r]), a = g.useMemo(
246
+ () => Object.fromEntries(r.map((p, v) => [p.name, { label: p.name, color: p.color ?? b(v) }])),
247
+ [r]
248
+ ), l = g.useMemo(() => y(o), [o]), f = t ?? (m ? 45 : 60), L = s ?? (m ? 80 : 100);
249
+ return /* @__PURE__ */ e(C, { config: a, className: k("aspect-auto size-full", u), children: /* @__PURE__ */ d($, { children: [
250
+ /* @__PURE__ */ e(x, { content: /* @__PURE__ */ e(N, { nameKey: "name", hideLabel: !0, formatter: l }) }),
251
+ /* @__PURE__ */ e(
252
+ E,
253
+ {
254
+ data: h,
255
+ dataKey: "value",
256
+ nameKey: "name",
257
+ cx: "50%",
258
+ cy: n ? "45%" : "50%",
259
+ innerRadius: f,
260
+ outerRadius: L,
261
+ paddingAngle: f > 0 ? 2 : 0,
262
+ label: i ? ({ name: p, value: v }) => `${String(p)} (${String(v)})` : void 0,
263
+ isAnimationActive: !1,
264
+ className: k("stroke-background", c && "cursor-pointer"),
265
+ onClick: c ? (p, v) => {
266
+ c(r[v], v);
267
+ } : void 0
268
+ }
269
+ ),
270
+ n && /* @__PURE__ */ e(B, { content: /* @__PURE__ */ e(H, { nameKey: "name", className: "flex-wrap text-muted-foreground" }) })
271
+ ] }) });
272
+ };
273
+ export {
274
+ F as B,
275
+ K as C,
276
+ ae as L,
277
+ se as P,
278
+ ee as a,
279
+ te as b,
280
+ re as c,
281
+ b as g
282
+ };
@@ -0,0 +1,251 @@
1
+ import { jsxs as a, jsx as e } from "react/jsx-runtime";
2
+ import * as S from "react";
3
+ import { useState as z, useRef as q, useEffect as G, useMemo as K } from "react";
4
+ import { I as L, bj as j, bl as R, bk as T, Q, U, W, S as X, T as F, V as E } from "./toggle-group-D6aFQQcf.js";
5
+ import "./alert-B9F1N9Qk.js";
6
+ import "@radix-ui/react-aspect-ratio";
7
+ import { B as y, f as H } from "./tooltip-DVeqVwqV.js";
8
+ import "./chart-DntJZGxB.js";
9
+ import "@radix-ui/react-collapsible";
10
+ import { I as J } from "./sheet-B_uq6-K_.js";
11
+ import { CalendarIcon as _, XIcon as M, ChevronDownIcon as Y, CheckIcon as Z, PlusIcon as ee, SearchIcon as te } from "lucide-react";
12
+ import "react-resizable-panels";
13
+ import { c as g } from "./tailwind.helper-B6yFEsav.js";
14
+ import "./select-BpjFWqAY.js";
15
+ import "next-themes";
16
+ import "sonner";
17
+ import { format as b } from "date-fns";
18
+ import { fr as C } from "date-fns/locale";
19
+ const be = ({ date: r, onDateChange: o, placeholder: h }) => {
20
+ const [c, n] = z(!1), s = q(null);
21
+ G(() => {
22
+ if (!c) return;
23
+ const i = (f) => {
24
+ s.current !== null && !s.current.contains(f.target) && n(!1);
25
+ };
26
+ return document.addEventListener("mousedown", i), () => {
27
+ document.removeEventListener("mousedown", i);
28
+ };
29
+ }, [c]);
30
+ const d = () => {
31
+ n((i) => !i);
32
+ }, m = (i) => {
33
+ o(i), n(!1);
34
+ };
35
+ return /* @__PURE__ */ a("div", { ref: s, className: "relative w-full", children: [
36
+ /* @__PURE__ */ a(
37
+ y,
38
+ {
39
+ variant: "outline",
40
+ type: "button",
41
+ onClick: d,
42
+ className: g(
43
+ "w-full justify-start text-left font-normal focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
44
+ c && "ring-2 ring-ring ring-offset-2",
45
+ r === void 0 && "text-muted-foreground"
46
+ ),
47
+ children: [
48
+ /* @__PURE__ */ e(_, { className: "mr-2 size-4 shrink-0" }),
49
+ r !== void 0 ? b(r, "dd/MM/yyyy", { locale: C }) : /* @__PURE__ */ e("span", { children: h })
50
+ ]
51
+ }
52
+ ),
53
+ c ? /* @__PURE__ */ e("div", { className: "absolute left-0 top-[calc(100%+4px)] z-[100] rounded-surface border bg-popover text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 slide-in-from-top-2", children: /* @__PURE__ */ e(L, { mode: "single", selected: r, onSelect: m }) }) : null
54
+ ] });
55
+ }, Ce = ({ value: r, onChange: o, placeholder: h = "Selectionner une periode", className: c }) => {
56
+ const [n, s] = S.useState(!1), [d, m] = S.useState(r);
57
+ S.useEffect(() => {
58
+ n && m(r);
59
+ }, [n, r]);
60
+ const i = (l) => {
61
+ l.stopPropagation(), o(void 0), s(!1);
62
+ }, f = () => {
63
+ o(d), s(!1);
64
+ }, x = () => {
65
+ m(r), s(!1);
66
+ }, k = () => {
67
+ m(void 0);
68
+ }, p = (l) => l != null && l.from ? !l.to || l.from.getTime() === l.to.getTime() ? b(l.from, "dd MMM yyyy", { locale: C }) : `${b(l.from, "dd MMM yyyy", { locale: C })} - ${b(l.to, "dd MMM yyyy", { locale: C })}` : h;
69
+ return /* @__PURE__ */ e("div", { className: g("grid gap-2", c), children: /* @__PURE__ */ a(j, { open: n, onOpenChange: s, children: [
70
+ /* @__PURE__ */ e(R, { asChild: !0, children: /* @__PURE__ */ a(y, { id: "date", variant: "outline", className: g("w-[300px] justify-start text-left font-normal", !(r != null && r.from) && "text-muted-foreground"), children: [
71
+ /* @__PURE__ */ e(_, { className: "mr-2 size-4" }),
72
+ p(r),
73
+ (r == null ? void 0 : r.from) && /* @__PURE__ */ e(
74
+ y,
75
+ {
76
+ type: "button",
77
+ variant: "ghost",
78
+ size: "icon",
79
+ "aria-label": "Effacer la periode selectionnee",
80
+ className: "ml-auto h-5 w-5 opacity-50 hover:opacity-100",
81
+ onClick: i,
82
+ children: /* @__PURE__ */ e(M, { className: "size-4" })
83
+ }
84
+ )
85
+ ] }) }),
86
+ /* @__PURE__ */ a(T, { className: "w-auto p-0", align: "start", side: "bottom", sideOffset: 4, children: [
87
+ /* @__PURE__ */ e(
88
+ L,
89
+ {
90
+ mode: "range",
91
+ defaultMonth: d == null ? void 0 : d.from,
92
+ selected: d,
93
+ onSelect: m,
94
+ numberOfMonths: 2,
95
+ weekStartsOn: 1,
96
+ className: "pointer-events-auto p-3"
97
+ }
98
+ ),
99
+ /* @__PURE__ */ a("div", { className: "flex items-center justify-between border-t border-border px-3 py-2", children: [
100
+ /* @__PURE__ */ e(y, { variant: "ghost", size: "sm", onClick: k, children: "Effacer" }),
101
+ /* @__PURE__ */ a("div", { className: "flex gap-2", children: [
102
+ /* @__PURE__ */ e(y, { variant: "ghost", size: "sm", onClick: x, children: "Annuler" }),
103
+ /* @__PURE__ */ e(y, { size: "sm", onClick: f, children: "Appliquer" })
104
+ ] })
105
+ ] })
106
+ ] })
107
+ ] }) });
108
+ }, xe = ({
109
+ options: r = [],
110
+ value: o,
111
+ onChange: h,
112
+ onClear: c,
113
+ onCreate: n,
114
+ placeholder: s = "Sélectionner...",
115
+ searchPlaceholder: d = "Rechercher...",
116
+ emptyLabel: m = "Aucun résultat",
117
+ createLabel: i = (p) => `Créer « ${p} »`,
118
+ disabled: f = !1,
119
+ modal: x = !0,
120
+ className: k
121
+ }) => {
122
+ const [p, l] = z(!1), [I, P] = z(""), v = o !== void 0 && o !== "", u = K(() => v ? r.find((t) => t.value === o) : void 0, [v, r, o]), A = v ? (u == null ? void 0 : u.label) ?? o : void 0, N = I.trim(), D = n !== void 0 && N !== "" && !r.some((t) => t.label.toLowerCase() === N.toLowerCase()), w = (t) => {
123
+ l(t), t || P("");
124
+ }, O = (t) => {
125
+ h(t), w(!1);
126
+ }, V = () => {
127
+ n == null || n(N), w(!1);
128
+ };
129
+ return /* @__PURE__ */ a(j, { open: p, onOpenChange: w, modal: x, children: [
130
+ /* @__PURE__ */ e(R, { asChild: !0, children: /* @__PURE__ */ a(
131
+ "button",
132
+ {
133
+ type: "button",
134
+ role: "combobox",
135
+ "aria-expanded": p,
136
+ disabled: f,
137
+ className: g(
138
+ H,
139
+ "w-full",
140
+ "data-[state=open]:ring-2 data-[state=open]:ring-ring data-[state=open]:ring-offset-2",
141
+ !v && "text-muted-foreground",
142
+ k
143
+ ),
144
+ children: [
145
+ /* @__PURE__ */ a("span", { className: "flex items-center truncate", children: [
146
+ (u == null ? void 0 : u.color) && /* @__PURE__ */ e("span", { className: "mr-2 size-2.5 shrink-0 rounded-full", style: { backgroundColor: u.color } }),
147
+ /* @__PURE__ */ e("span", { className: "truncate", children: A ?? s }),
148
+ (u == null ? void 0 : u.description) !== void 0 && /* @__PURE__ */ a("span", { className: "ml-1 truncate text-muted-foreground", children: [
149
+ "(",
150
+ u.description,
151
+ ")"
152
+ ] })
153
+ ] }),
154
+ /* @__PURE__ */ a("div", { className: "flex items-center gap-1", children: [
155
+ c && v && !f && /* @__PURE__ */ e(
156
+ "span",
157
+ {
158
+ role: "button",
159
+ tabIndex: -1,
160
+ onClick: (t) => {
161
+ t.stopPropagation();
162
+ },
163
+ onPointerDown: (t) => {
164
+ t.preventDefault(), t.stopPropagation(), c();
165
+ },
166
+ className: "text-muted-foreground hover:text-foreground",
167
+ children: /* @__PURE__ */ e(M, { className: "size-4" })
168
+ }
169
+ ),
170
+ /* @__PURE__ */ e(Y, { className: g("size-4 shrink-0 opacity-50 transition-transform", p && "rotate-180") })
171
+ ] })
172
+ ]
173
+ }
174
+ ) }),
175
+ /* @__PURE__ */ e(T, { className: "w-[var(--radix-popover-trigger-width)] p-0", align: "start", children: /* @__PURE__ */ a(
176
+ Q,
177
+ {
178
+ filter: (t, $, B) => (B ?? []).join(" ").toLowerCase().includes($.trim().toLowerCase()) ? 1 : 0,
179
+ children: [
180
+ /* @__PURE__ */ e(U, { placeholder: d, value: I, onValueChange: P }),
181
+ /* @__PURE__ */ a(W, { children: [
182
+ !D && /* @__PURE__ */ e(X, { children: m }),
183
+ /* @__PURE__ */ a(F, { children: [
184
+ r.map((t) => /* @__PURE__ */ a(
185
+ E,
186
+ {
187
+ value: t.value,
188
+ keywords: [t.label, t.description ?? ""],
189
+ onSelect: () => {
190
+ O(t.value);
191
+ },
192
+ children: [
193
+ /* @__PURE__ */ e(Z, { className: g("mr-2 size-4 shrink-0", o === t.value ? "opacity-100" : "opacity-0") }),
194
+ t.color !== void 0 && /* @__PURE__ */ e("span", { className: "mr-2 size-2.5 shrink-0 rounded-full", style: { backgroundColor: t.color } }),
195
+ /* @__PURE__ */ e("span", { className: "truncate", children: t.label }),
196
+ t.description !== void 0 && /* @__PURE__ */ a("span", { className: "ml-1 truncate text-muted-foreground", children: [
197
+ "(",
198
+ t.description,
199
+ ")"
200
+ ] })
201
+ ]
202
+ },
203
+ t.value
204
+ )),
205
+ D && /* @__PURE__ */ a(E, { forceMount: !0, value: "__create__", onSelect: V, children: [
206
+ /* @__PURE__ */ e(ee, { className: "mr-2 size-4 shrink-0" }),
207
+ /* @__PURE__ */ e("span", { className: "truncate", children: i(N) })
208
+ ] })
209
+ ] })
210
+ ] })
211
+ ]
212
+ }
213
+ ) })
214
+ ] });
215
+ }, ke = ({
216
+ searchQuery: r,
217
+ search: o,
218
+ placeholder: h = "Rechercher...",
219
+ onSearch: c,
220
+ onSubmit: n,
221
+ onClear: s,
222
+ className: d
223
+ }) => {
224
+ const m = r ?? o ?? "", i = () => {
225
+ c(""), s !== void 0 && s();
226
+ };
227
+ return /* @__PURE__ */ a("div", { className: g("relative h-fit w-full md:w-64", d), children: [
228
+ /* @__PURE__ */ e(te, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground w-4 h-4" }),
229
+ /* @__PURE__ */ e(
230
+ J,
231
+ {
232
+ placeholder: h,
233
+ value: m,
234
+ onChange: (f) => {
235
+ c(f.target.value);
236
+ },
237
+ className: "pl-8",
238
+ onKeyDown: (f) => {
239
+ f.key === "Enter" && n !== void 0 && (f.preventDefault(), n());
240
+ }
241
+ }
242
+ ),
243
+ m !== "" ? /* @__PURE__ */ e("button", { onClick: i, className: "absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-gray-700", type: "button", children: /* @__PURE__ */ e(M, { className: "size-4" }) }) : null
244
+ ] });
245
+ };
246
+ export {
247
+ be as D,
248
+ ke as S,
249
+ Ce as a,
250
+ xe as b
251
+ };
@@ -2,10 +2,11 @@ import { jsxs as s, jsx as e, Fragment as o } from "react/jsx-runtime";
2
2
  import { formatNumber as g } from "@krosoft/core/helpers";
3
3
  import { useTranslation as b } from "react-i18next";
4
4
  import { c as m } from "./tailwind.helper-B6yFEsav.js";
5
- import { J as c, N as p, O as v, K as N } from "./toggle-group-D6c-gM1D.js";
5
+ import "./toggle-group-D6aFQQcf.js";
6
6
  import "./alert-B9F1N9Qk.js";
7
7
  import "@radix-ui/react-aspect-ratio";
8
8
  import "./tooltip-DVeqVwqV.js";
9
+ import { C as c, d as p, e as v, a as h } from "./chart-DntJZGxB.js";
9
10
  import "@radix-ui/react-collapsible";
10
11
  import "./sheet-B_uq6-K_.js";
11
12
  import "lucide-react";
@@ -20,7 +21,7 @@ const y = ({
20
21
  value: i,
21
22
  valueClassName: t,
22
23
  icon: r,
23
- iconClassName: h,
24
+ iconClassName: N,
24
25
  description: u,
25
26
  descriptionClassName: f,
26
27
  onClick: d,
@@ -31,9 +32,9 @@ const y = ({
31
32
  return /* @__PURE__ */ s(c, { className: m(d !== void 0 ? "hover:border-primary cursor-pointer" : ""), onClick: d, children: [
32
33
  /* @__PURE__ */ s(p, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
33
34
  /* @__PURE__ */ e(v, { className: "text-sm font-medium", children: C(a) }),
34
- /* @__PURE__ */ e(r, { className: m("size-6 text-muted-foreground", h) })
35
+ /* @__PURE__ */ e(r, { className: m("size-6 text-muted-foreground", N) })
35
36
  ] }),
36
- /* @__PURE__ */ e(N, { children: x ? /* @__PURE__ */ s(o, { children: [
37
+ /* @__PURE__ */ e(h, { children: x ? /* @__PURE__ */ s(o, { children: [
37
38
  /* @__PURE__ */ e(n, { className: "h-8 w-24 mb-1" }),
38
39
  /* @__PURE__ */ e(n, { className: "h-3 w-32" })
39
40
  ] }) : l ? /* @__PURE__ */ s(o, { children: [
@@ -44,7 +45,7 @@ const y = ({
44
45
  /* @__PURE__ */ e("p", { className: m("text-xs text-muted-foreground", f), children: u })
45
46
  ] }) })
46
47
  ] });
47
- }, E = ({ stats: a, isLoading: i, error: t }) => /* @__PURE__ */ e("div", { className: "grid gap-6 md:grid-cols-2 lg:grid-cols-4", children: a.map((r) => /* @__PURE__ */ e(
48
+ }, J = ({ stats: a, isLoading: i, error: t }) => /* @__PURE__ */ e("div", { className: "grid gap-6 md:grid-cols-2 lg:grid-cols-4", children: a.map((r) => /* @__PURE__ */ e(
48
49
  y,
49
50
  {
50
51
  titleKey: r.titleKey,
@@ -59,16 +60,16 @@ const y = ({
59
60
  error: t
60
61
  },
61
62
  r.titleKey
62
- )) }), K = () => /* @__PURE__ */ s(c, { className: "animate-pulse", children: [
63
+ )) }), w = () => /* @__PURE__ */ s(c, { className: "animate-pulse", children: [
63
64
  /* @__PURE__ */ e(p, { children: /* @__PURE__ */ e("div", { className: "h-6 bg-muted rounded w-1/4" }) }),
64
- /* @__PURE__ */ e(N, { children: /* @__PURE__ */ s("div", { className: "space-y-2", children: [
65
+ /* @__PURE__ */ e(h, { children: /* @__PURE__ */ s("div", { className: "space-y-2", children: [
65
66
  /* @__PURE__ */ e("div", { className: "h-4 bg-muted rounded" }),
66
67
  /* @__PURE__ */ e("div", { className: "h-4 bg-muted rounded w-3/4" })
67
68
  ] }) })
68
- ] }), G = ({ count: a = 1 }) => /* @__PURE__ */ e("div", { className: "grid gap-6", style: { gridTemplateColumns: `repeat(${a}, minmax(0, 1fr))` }, children: Array.from({ length: a }).map((i, t) => /* @__PURE__ */ e(K, {}, t)) });
69
+ ] }), M = ({ count: a = 1 }) => /* @__PURE__ */ e("div", { className: "grid gap-6", style: { gridTemplateColumns: `repeat(${a}, minmax(0, 1fr))` }, children: Array.from({ length: a }).map((i, t) => /* @__PURE__ */ e(w, {}, t)) });
69
70
  export {
70
71
  y as K,
71
- K as S,
72
- E as a,
73
- G as b
72
+ w as S,
73
+ J as a,
74
+ M as b
74
75
  };