@krosoft/react 0.0.183 → 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.
- package/dist/{AppActions-DtdwQdm-.js → AppActions-DZ7wVdmt.js} +8 -7
- package/dist/{AppSubTitle-Co9HDBO4.js → AppSubTitle-CZN_tmfv.js} +1 -1
- package/dist/{AppVerticalTabs-B3_nbdLm.js → AppVerticalTabs-C1SsBNAH.js} +26 -25
- package/dist/{ConfirmationDialog-3rO4sYM8.js → ConfirmationDialog-M8sFAz4h.js} +7 -6
- package/dist/{DataTable-Ckbr166c.js → DataTable-KMYbhJ4C.js} +29 -28
- package/dist/{GenericForm-ClzOIaJc.js → GenericForm-DtY0moOD.js} +93 -92
- package/dist/{ImageInput-BPV_4oDI.js → ImageInput-3wZuCZGf.js} +2 -1
- package/dist/{KpiCardsLayout-D67cLG3R.js → KpiCardsLayout-DjRTqXFa.js} +16 -15
- package/dist/{MetricCard-BAa26w6e.js → MetricCard-B0xnFyim.js} +1 -1
- package/dist/{MultiSelect-ovXnKCuU.js → MultiSelect-BhRXVpky.js} +14 -13
- package/dist/PieChart-C9gn0Dws.js +282 -0
- package/dist/{SearchInput-B08-Mcsx.js → SearchInput-BXOlvTO9.js} +30 -29
- package/dist/{SkeletonCards-D0V2nuDg.js → SkeletonCards-av7XHlof.js} +12 -11
- package/dist/{TableFilter-Z0T30AzZ.js → TableFilter-BlrrSOtg.js} +21 -20
- package/dist/chart-DntJZGxB.js +181 -0
- package/dist/components/core/cards/index.js +2 -2
- package/dist/components/core/charts/BarChartHorizontal.d.ts +24 -0
- package/dist/components/core/charts/BarChartHorizontal.d.ts.map +1 -0
- package/dist/components/core/charts/BarChartVertical.d.ts +24 -0
- package/dist/components/core/charts/BarChartVertical.d.ts.map +1 -0
- package/dist/components/core/charts/ChartCard.d.ts +31 -0
- package/dist/components/core/charts/ChartCard.d.ts.map +1 -0
- package/dist/components/core/charts/CircularGauge.d.ts +39 -0
- package/dist/components/core/charts/CircularGauge.d.ts.map +1 -0
- package/dist/components/core/charts/LineChart.d.ts +23 -0
- package/dist/components/core/charts/LineChart.d.ts.map +1 -0
- package/dist/components/core/charts/PieChart.d.ts +26 -0
- package/dist/components/core/charts/PieChart.d.ts.map +1 -0
- package/dist/components/core/charts/chartColors.d.ts +13 -0
- package/dist/components/core/charts/chartColors.d.ts.map +1 -0
- package/dist/components/core/charts/chartTooltip.helper.d.ts +14 -0
- package/dist/components/core/charts/chartTooltip.helper.d.ts.map +1 -0
- package/dist/components/core/charts/index.d.ts +14 -0
- package/dist/components/core/charts/index.d.ts.map +1 -0
- package/dist/components/core/charts/index.js +11 -0
- package/dist/components/core/dialogs/index.js +2 -2
- package/dist/components/core/filters/index.js +1 -1
- package/dist/components/core/forms/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 +80 -71
- package/dist/components/core/inputs/index.js +3 -3
- package/dist/components/core/layouts/index.js +3 -3
- package/dist/components/core/table/index.js +1 -1
- package/dist/components/core/tabs/index.js +1 -1
- package/dist/components/index.js +307 -297
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +218 -217
- package/dist/tailwind/index.d.ts +7 -0
- package/dist/tailwind/index.d.ts.map +1 -1
- package/dist/tailwind/index.js +11 -2
- package/dist/{toaster-BaFcYXKg.js → toaster-Cm7utXqi.js} +13 -13
- package/dist/toggle-group-D6aFQQcf.js +1460 -0
- package/dist/types/ChartDatum.d.ts +19 -0
- package/dist/types/ChartDatum.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/toggle-group-D2Li0iBJ.js +0 -1636
|
@@ -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
|
+
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsxs as a, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import * as S from "react";
|
|
3
3
|
import { useState as z, useRef as q, useEffect as G, useMemo as K } from "react";
|
|
4
|
-
import { I as L,
|
|
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
5
|
import "./alert-B9F1N9Qk.js";
|
|
6
6
|
import "@radix-ui/react-aspect-ratio";
|
|
7
|
-
import { B as y, f as
|
|
7
|
+
import { B as y, f as H } from "./tooltip-DVeqVwqV.js";
|
|
8
|
+
import "./chart-DntJZGxB.js";
|
|
8
9
|
import "@radix-ui/react-collapsible";
|
|
9
|
-
import { I as
|
|
10
|
+
import { I as J } from "./sheet-B_uq6-K_.js";
|
|
10
11
|
import { CalendarIcon as _, XIcon as M, ChevronDownIcon as Y, CheckIcon as Z, PlusIcon as ee, SearchIcon as te } from "lucide-react";
|
|
11
12
|
import "react-resizable-panels";
|
|
12
13
|
import { c as g } from "./tailwind.helper-B6yFEsav.js";
|
|
@@ -15,7 +16,7 @@ import "next-themes";
|
|
|
15
16
|
import "sonner";
|
|
16
17
|
import { format as b } from "date-fns";
|
|
17
18
|
import { fr as C } from "date-fns/locale";
|
|
18
|
-
const
|
|
19
|
+
const be = ({ date: r, onDateChange: o, placeholder: h }) => {
|
|
19
20
|
const [c, n] = z(!1), s = q(null);
|
|
20
21
|
G(() => {
|
|
21
22
|
if (!c) return;
|
|
@@ -51,7 +52,7 @@ const Ne = ({ date: r, onDateChange: o, placeholder: h }) => {
|
|
|
51
52
|
),
|
|
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
|
|
53
54
|
] });
|
|
54
|
-
},
|
|
55
|
+
}, Ce = ({ value: r, onChange: o, placeholder: h = "Selectionner une periode", className: c }) => {
|
|
55
56
|
const [n, s] = S.useState(!1), [d, m] = S.useState(r);
|
|
56
57
|
S.useEffect(() => {
|
|
57
58
|
n && m(r);
|
|
@@ -62,11 +63,11 @@ const Ne = ({ date: r, onDateChange: o, placeholder: h }) => {
|
|
|
62
63
|
o(d), s(!1);
|
|
63
64
|
}, x = () => {
|
|
64
65
|
m(r), s(!1);
|
|
65
|
-
},
|
|
66
|
+
}, k = () => {
|
|
66
67
|
m(void 0);
|
|
67
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;
|
|
68
|
-
return /* @__PURE__ */ e("div", { className: g("grid gap-2", c), children: /* @__PURE__ */ a(
|
|
69
|
-
/* @__PURE__ */ e(
|
|
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: [
|
|
70
71
|
/* @__PURE__ */ e(_, { className: "mr-2 size-4" }),
|
|
71
72
|
p(r),
|
|
72
73
|
(r == null ? void 0 : r.from) && /* @__PURE__ */ e(
|
|
@@ -96,7 +97,7 @@ const Ne = ({ date: r, onDateChange: o, placeholder: h }) => {
|
|
|
96
97
|
}
|
|
97
98
|
),
|
|
98
99
|
/* @__PURE__ */ a("div", { className: "flex items-center justify-between border-t border-border px-3 py-2", children: [
|
|
99
|
-
/* @__PURE__ */ e(y, { variant: "ghost", size: "sm", onClick:
|
|
100
|
+
/* @__PURE__ */ e(y, { variant: "ghost", size: "sm", onClick: k, children: "Effacer" }),
|
|
100
101
|
/* @__PURE__ */ a("div", { className: "flex gap-2", children: [
|
|
101
102
|
/* @__PURE__ */ e(y, { variant: "ghost", size: "sm", onClick: x, children: "Annuler" }),
|
|
102
103
|
/* @__PURE__ */ e(y, { size: "sm", onClick: f, children: "Appliquer" })
|
|
@@ -104,7 +105,7 @@ const Ne = ({ date: r, onDateChange: o, placeholder: h }) => {
|
|
|
104
105
|
] })
|
|
105
106
|
] })
|
|
106
107
|
] }) });
|
|
107
|
-
},
|
|
108
|
+
}, xe = ({
|
|
108
109
|
options: r = [],
|
|
109
110
|
value: o,
|
|
110
111
|
onChange: h,
|
|
@@ -116,17 +117,17 @@ const Ne = ({ date: r, onDateChange: o, placeholder: h }) => {
|
|
|
116
117
|
createLabel: i = (p) => `Créer « ${p} »`,
|
|
117
118
|
disabled: f = !1,
|
|
118
119
|
modal: x = !0,
|
|
119
|
-
className:
|
|
120
|
+
className: k
|
|
120
121
|
}) => {
|
|
121
|
-
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()),
|
|
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) => {
|
|
122
123
|
l(t), t || P("");
|
|
123
124
|
}, O = (t) => {
|
|
124
|
-
h(t),
|
|
125
|
+
h(t), w(!1);
|
|
125
126
|
}, V = () => {
|
|
126
|
-
n == null || n(N),
|
|
127
|
+
n == null || n(N), w(!1);
|
|
127
128
|
};
|
|
128
|
-
return /* @__PURE__ */ a(
|
|
129
|
-
/* @__PURE__ */ e(
|
|
129
|
+
return /* @__PURE__ */ a(j, { open: p, onOpenChange: w, modal: x, children: [
|
|
130
|
+
/* @__PURE__ */ e(R, { asChild: !0, children: /* @__PURE__ */ a(
|
|
130
131
|
"button",
|
|
131
132
|
{
|
|
132
133
|
type: "button",
|
|
@@ -134,11 +135,11 @@ const Ne = ({ date: r, onDateChange: o, placeholder: h }) => {
|
|
|
134
135
|
"aria-expanded": p,
|
|
135
136
|
disabled: f,
|
|
136
137
|
className: g(
|
|
137
|
-
|
|
138
|
+
H,
|
|
138
139
|
"w-full",
|
|
139
140
|
"data-[state=open]:ring-2 data-[state=open]:ring-ring data-[state=open]:ring-offset-2",
|
|
140
141
|
!v && "text-muted-foreground",
|
|
141
|
-
|
|
142
|
+
k
|
|
142
143
|
),
|
|
143
144
|
children: [
|
|
144
145
|
/* @__PURE__ */ a("span", { className: "flex items-center truncate", children: [
|
|
@@ -172,14 +173,14 @@ const Ne = ({ date: r, onDateChange: o, placeholder: h }) => {
|
|
|
172
173
|
}
|
|
173
174
|
) }),
|
|
174
175
|
/* @__PURE__ */ e(T, { className: "w-[var(--radix-popover-trigger-width)] p-0", align: "start", children: /* @__PURE__ */ a(
|
|
175
|
-
|
|
176
|
+
Q,
|
|
176
177
|
{
|
|
177
178
|
filter: (t, $, B) => (B ?? []).join(" ").toLowerCase().includes($.trim().toLowerCase()) ? 1 : 0,
|
|
178
179
|
children: [
|
|
179
|
-
/* @__PURE__ */ e(
|
|
180
|
-
/* @__PURE__ */ a(
|
|
181
|
-
!D && /* @__PURE__ */ e(
|
|
182
|
-
/* @__PURE__ */ a(
|
|
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: [
|
|
183
184
|
r.map((t) => /* @__PURE__ */ a(
|
|
184
185
|
E,
|
|
185
186
|
{
|
|
@@ -211,7 +212,7 @@ const Ne = ({ date: r, onDateChange: o, placeholder: h }) => {
|
|
|
211
212
|
}
|
|
212
213
|
) })
|
|
213
214
|
] });
|
|
214
|
-
},
|
|
215
|
+
}, ke = ({
|
|
215
216
|
searchQuery: r,
|
|
216
217
|
search: o,
|
|
217
218
|
placeholder: h = "Rechercher...",
|
|
@@ -226,7 +227,7 @@ const Ne = ({ date: r, onDateChange: o, placeholder: h }) => {
|
|
|
226
227
|
return /* @__PURE__ */ a("div", { className: g("relative h-fit w-full md:w-64", d), children: [
|
|
227
228
|
/* @__PURE__ */ e(te, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground w-4 h-4" }),
|
|
228
229
|
/* @__PURE__ */ e(
|
|
229
|
-
|
|
230
|
+
J,
|
|
230
231
|
{
|
|
231
232
|
placeholder: h,
|
|
232
233
|
value: m,
|
|
@@ -243,8 +244,8 @@ const Ne = ({ date: r, onDateChange: o, placeholder: h }) => {
|
|
|
243
244
|
] });
|
|
244
245
|
};
|
|
245
246
|
export {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
247
|
+
be as D,
|
|
248
|
+
ke as S,
|
|
249
|
+
Ce as a,
|
|
250
|
+
xe as b
|
|
250
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
|
|
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:
|
|
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",
|
|
35
|
+
/* @__PURE__ */ e(r, { className: m("size-6 text-muted-foreground", N) })
|
|
35
36
|
] }),
|
|
36
|
-
/* @__PURE__ */ e(
|
|
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
|
-
},
|
|
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
|
-
)) }),
|
|
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(
|
|
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
|
-
] }),
|
|
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
|
-
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
w as S,
|
|
73
|
+
J as a,
|
|
74
|
+
M as b
|
|
74
75
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsxs as u, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
3
|
-
import { a as
|
|
4
|
-
import { B as
|
|
2
|
+
import { useState as k, useEffect as j, useMemo as A } from "react";
|
|
3
|
+
import { a as D, D as M, b as I, S as $ } from "./SearchInput-BXOlvTO9.js";
|
|
4
|
+
import { B as w, aP as z, bj as B, bl as R, bk as Q, O as C } from "./toggle-group-D6aFQQcf.js";
|
|
5
5
|
import "./alert-B9F1N9Qk.js";
|
|
6
6
|
import "@radix-ui/react-aspect-ratio";
|
|
7
|
-
import { B as
|
|
7
|
+
import { B as F, e as V } from "./tooltip-DVeqVwqV.js";
|
|
8
|
+
import "./chart-DntJZGxB.js";
|
|
8
9
|
import "@radix-ui/react-collapsible";
|
|
9
10
|
import { I as P, S as _, i as H, b as X, e as G, h as J, d as K } from "./sheet-B_uq6-K_.js";
|
|
10
11
|
import { XIcon as E, Filter as U, ChevronDown as W, Search as Y } from "lucide-react";
|
|
@@ -15,7 +16,7 @@ import { S as Z, h as q, i as ee, a as re, c as te } from "./select-BpjFWqAY.js"
|
|
|
15
16
|
import "next-themes";
|
|
16
17
|
import "sonner";
|
|
17
18
|
import { c as T } from "./tailwind.helper-B6yFEsav.js";
|
|
18
|
-
import { M as le } from "./MultiSelect-
|
|
19
|
+
import { M as le } from "./MultiSelect-BhRXVpky.js";
|
|
19
20
|
const L = (a, n, c = {}) => {
|
|
20
21
|
if (n instanceof Date)
|
|
21
22
|
return n.toLocaleDateString("fr-FR");
|
|
@@ -32,7 +33,7 @@ function ae({ filters: a, onRemoveFilter: n, onClearAll: c, filterLabels: i = {}
|
|
|
32
33
|
return m.map((x) => {
|
|
33
34
|
const p = L(h, x, d);
|
|
34
35
|
return /* @__PURE__ */ u(
|
|
35
|
-
|
|
36
|
+
w,
|
|
36
37
|
{
|
|
37
38
|
variant: "secondary",
|
|
38
39
|
className: "flex items-center gap-1 px-3 py-1 bg-blue-50 text-blue-700 border border-blue-200 hover:bg-blue-100",
|
|
@@ -56,7 +57,7 @@ function ae({ filters: a, onRemoveFilter: n, onClearAll: c, filterLabels: i = {}
|
|
|
56
57
|
);
|
|
57
58
|
});
|
|
58
59
|
const g = L(h, m, d);
|
|
59
|
-
return /* @__PURE__ */ u(
|
|
60
|
+
return /* @__PURE__ */ u(w, { 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: [
|
|
60
61
|
b,
|
|
61
62
|
": ",
|
|
62
63
|
g,
|
|
@@ -110,7 +111,7 @@ const se = ({
|
|
|
110
111
|
);
|
|
111
112
|
case "select":
|
|
112
113
|
return a.searchable === !0 ? /* @__PURE__ */ r(
|
|
113
|
-
|
|
114
|
+
I,
|
|
114
115
|
{
|
|
115
116
|
options: a.options ?? [],
|
|
116
117
|
value: n,
|
|
@@ -123,9 +124,9 @@ const se = ({
|
|
|
123
124
|
/* @__PURE__ */ r(re, { children: (d = a.options) == null ? void 0 : d.map((o) => /* @__PURE__ */ r(te, { value: o.value, children: o.label }, o.value)) })
|
|
124
125
|
] });
|
|
125
126
|
case "date":
|
|
126
|
-
return /* @__PURE__ */ r(
|
|
127
|
+
return /* @__PURE__ */ r(M, { date: n, onDateChange: c, placeholder: a.placeholder ?? "Sélectionner une date" });
|
|
127
128
|
case "date-range":
|
|
128
|
-
return /* @__PURE__ */ r(
|
|
129
|
+
return /* @__PURE__ */ r(D, { value: n, onChange: c, placeholder: a.placeholder });
|
|
129
130
|
case "multi-select":
|
|
130
131
|
return /* @__PURE__ */ r(
|
|
131
132
|
le,
|
|
@@ -153,8 +154,8 @@ function ce({
|
|
|
153
154
|
buttonText: i = "Plus de filtres",
|
|
154
155
|
sheetTitle: d = "Filtres avancés"
|
|
155
156
|
}) {
|
|
156
|
-
const [o, h] =
|
|
157
|
-
|
|
157
|
+
const [o, h] = k(!1), [m, b] = k(n);
|
|
158
|
+
j(() => {
|
|
158
159
|
b(n);
|
|
159
160
|
}, [n, o]);
|
|
160
161
|
const g = (l, e) => {
|
|
@@ -171,7 +172,7 @@ function ce({
|
|
|
171
172
|
return Object.entries(n).filter(([e, t]) => l.has(e) && ne(t)).length;
|
|
172
173
|
}, [a, n]);
|
|
173
174
|
return /* @__PURE__ */ u(_, { open: o, onOpenChange: h, children: [
|
|
174
|
-
/* @__PURE__ */ r(H, { asChild: !0, children: /* @__PURE__ */ u(
|
|
175
|
+
/* @__PURE__ */ r(H, { asChild: !0, children: /* @__PURE__ */ u(F, { variant: "outline", className: "gap-2", children: [
|
|
175
176
|
/* @__PURE__ */ r(U, { className: "size-4 shrink-0" }),
|
|
176
177
|
i,
|
|
177
178
|
v > 0 && /* @__PURE__ */ r("span", { className: "ml-1 flex h-5 min-w-5 items-center justify-center rounded-full bg-primary px-1.5 text-xs font-semibold text-primary-foreground", children: v })
|
|
@@ -198,8 +199,8 @@ function ce({
|
|
|
198
199
|
] }, t.key))
|
|
199
200
|
] }, e)) }) }),
|
|
200
201
|
/* @__PURE__ */ u(K, { className: "gap-2 p-6 border-t bg-white dark:bg-gray-950", children: [
|
|
201
|
-
/* @__PURE__ */ r(
|
|
202
|
-
/* @__PURE__ */ r(
|
|
202
|
+
/* @__PURE__ */ r(F, { variant: "outline", className: "flex-1", onClick: y, children: "Effacer les filtres" }),
|
|
203
|
+
/* @__PURE__ */ r(F, { className: "flex-1 bg-orange-500 hover:bg-orange-600 text-white", onClick: p, children: "Rechercher" })
|
|
203
204
|
] })
|
|
204
205
|
] })
|
|
205
206
|
] });
|
|
@@ -214,7 +215,7 @@ function oe({
|
|
|
214
215
|
searchable: h = !1,
|
|
215
216
|
searchPlaceholder: m = "Rechercher..."
|
|
216
217
|
}) {
|
|
217
|
-
const [b, g] =
|
|
218
|
+
const [b, g] = k(""), x = c.length > 0, p = A(() => b === "" ? n : n.filter((l) => l.label.toLowerCase().includes(b.toLowerCase())), [n, b]), y = A(() => p.length === 0 ? !1 : p.every((l) => c.includes(l.value)), [p, c]), v = () => {
|
|
218
219
|
if (y)
|
|
219
220
|
if (o !== void 0) {
|
|
220
221
|
const l = p.map((t) => t.value), e = c.filter((t) => !l.includes(t));
|
|
@@ -307,7 +308,7 @@ function oe({
|
|
|
307
308
|
}
|
|
308
309
|
);
|
|
309
310
|
}
|
|
310
|
-
function
|
|
311
|
+
function Pe({
|
|
311
312
|
searchQuery: a,
|
|
312
313
|
onSearchChange: n,
|
|
313
314
|
searchPlaceholder: c = "Rechercher...",
|
|
@@ -318,7 +319,7 @@ function Ce({
|
|
|
318
319
|
sheetTitle: m = "Filtres avancés"
|
|
319
320
|
}) {
|
|
320
321
|
const b = (e, t) => {
|
|
321
|
-
const s = i[e], f = Array.isArray(s) ? s : [], N = f.includes(t) ? f.filter((
|
|
322
|
+
const s = i[e], f = Array.isArray(s) ? s : [], N = f.includes(t) ? f.filter((O) => O !== t) : [...f, t], S = { ...i };
|
|
322
323
|
N.length === 0 ? delete S[e] : S[e] = N, d(S);
|
|
323
324
|
}, g = (e) => {
|
|
324
325
|
const t = { ...i };
|
|
@@ -362,7 +363,7 @@ function Ce({
|
|
|
362
363
|
/* @__PURE__ */ u("div", { className: "flex flex-wrap items-center gap-3 justify-between", children: [
|
|
363
364
|
/* @__PURE__ */ u("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
364
365
|
n !== void 0 ? /* @__PURE__ */ r(
|
|
365
|
-
|
|
366
|
+
$,
|
|
366
367
|
{
|
|
367
368
|
searchQuery: a,
|
|
368
369
|
onSearch: n,
|
|
@@ -411,6 +412,6 @@ export {
|
|
|
411
412
|
ae as A,
|
|
412
413
|
se as F,
|
|
413
414
|
oe as S,
|
|
414
|
-
|
|
415
|
+
Pe as T,
|
|
415
416
|
ce as a
|
|
416
417
|
};
|