@krosoft/react 0.0.184 → 0.0.186

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.
@@ -0,0 +1,292 @@
1
+ import { jsxs as m, jsx as e } from "react/jsx-runtime";
2
+ import { f as N, j as x, k as y, 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 C } from "./tailwind.helper-B6yFEsav.js";
4
+ import * as v 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 L = (r, t) => r ? (n, s) => /* @__PURE__ */ m("div", { className: "flex flex-1 justify-between gap-4", children: [
9
+ /* @__PURE__ */ e("span", { className: "text-muted-foreground", children: t ?? String(s) }),
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: a = "hsl(var(--primary))",
15
+ categoryWidth: n = 140,
16
+ maxLabelLength: s = 22,
17
+ valueFormatter: o,
18
+ onSelect: d,
19
+ className: h
20
+ }) => {
21
+ const u = v.useMemo(() => ({ value: { label: t, color: a } }), [t, a]), f = v.useMemo(() => L(o, t), [o, t]), i = v.useMemo(
22
+ () => r.some((l) => l.color !== void 0) ? r.map((l) => ({ ...l, fill: l.color ?? a })) : r,
23
+ [r, a]
24
+ );
25
+ return /* @__PURE__ */ e(N, { config: u, className: C("aspect-auto size-full", h), children: /* @__PURE__ */ m(T, { data: i, layout: "vertical", margin: { top: 5, right: 20, left: 0, bottom: 5 }, children: [
26
+ /* @__PURE__ */ e(M, { strokeDasharray: "3 3", horizontal: !1 }),
27
+ /* @__PURE__ */ e(
28
+ w,
29
+ {
30
+ type: "number",
31
+ dataKey: "value",
32
+ allowDecimals: !1,
33
+ tickLine: !1,
34
+ axisLine: !1,
35
+ tickMargin: 8,
36
+ tickFormatter: o ? (l) => o(Number(l)) : void 0
37
+ }
38
+ ),
39
+ /* @__PURE__ */ e(
40
+ D,
41
+ {
42
+ type: "category",
43
+ dataKey: "name",
44
+ width: n,
45
+ tickLine: !1,
46
+ axisLine: !1,
47
+ tickFormatter: (l) => z(String(l), s)
48
+ }
49
+ ),
50
+ /* @__PURE__ */ e(x, { content: /* @__PURE__ */ e(y, { formatter: f }) }),
51
+ /* @__PURE__ */ e(
52
+ j,
53
+ {
54
+ dataKey: "value",
55
+ fill: "var(--color-value)",
56
+ radius: [0, 4, 4, 0],
57
+ className: d ? "cursor-pointer" : void 0,
58
+ onClick: d ? (l, c) => {
59
+ d(r[c], c);
60
+ } : void 0
61
+ }
62
+ )
63
+ ] }) });
64
+ }, ee = ({
65
+ data: r,
66
+ label: t = "Valeur",
67
+ color: a = "hsl(var(--primary))",
68
+ labelAngle: n,
69
+ valueFormatter: s,
70
+ allowDecimals: o = !1,
71
+ onSelect: d,
72
+ className: h
73
+ }) => {
74
+ const u = v.useMemo(() => ({ value: { label: t, color: a } }), [t, a]), f = v.useMemo(() => L(s, t), [s, t]), i = n !== void 0 && n !== 0, l = v.useMemo(
75
+ () => r.some((c) => c.color !== void 0) ? r.map((c) => ({ ...c, fill: c.color ?? a })) : r,
76
+ [r, a]
77
+ );
78
+ return /* @__PURE__ */ e(N, { config: u, className: C("aspect-auto size-full", h), children: /* @__PURE__ */ m(T, { data: l, margin: { top: 10, right: 10, left: 0, bottom: i ? 20 : 10 }, children: [
79
+ /* @__PURE__ */ e(M, { strokeDasharray: "3 3", vertical: !1 }),
80
+ /* @__PURE__ */ e(
81
+ w,
82
+ {
83
+ dataKey: "name",
84
+ angle: n,
85
+ textAnchor: i ? "end" : "middle",
86
+ height: i ? 50 : void 0,
87
+ tickLine: !1,
88
+ axisLine: !1,
89
+ tickMargin: 8
90
+ }
91
+ ),
92
+ /* @__PURE__ */ e(
93
+ D,
94
+ {
95
+ allowDecimals: o,
96
+ tickLine: !1,
97
+ axisLine: !1,
98
+ width: s ? 48 : 32,
99
+ tickFormatter: s ? (c) => s(Number(c)) : void 0
100
+ }
101
+ ),
102
+ /* @__PURE__ */ e(x, { content: /* @__PURE__ */ e(y, { formatter: f }) }),
103
+ /* @__PURE__ */ e(
104
+ j,
105
+ {
106
+ dataKey: "value",
107
+ fill: "var(--color-value)",
108
+ radius: [4, 4, 0, 0],
109
+ className: d ? "cursor-pointer" : void 0,
110
+ onClick: d ? (c, g) => {
111
+ d(r[g], g);
112
+ } : void 0
113
+ }
114
+ )
115
+ ] }) });
116
+ }, K = [
117
+ "hsl(var(--k-chart-1))",
118
+ "hsl(var(--k-chart-2))",
119
+ "hsl(var(--k-chart-3))",
120
+ "hsl(var(--k-chart-4))",
121
+ "hsl(var(--k-chart-5))"
122
+ ], b = (r) => K[r % K.length], re = ({
123
+ title: r,
124
+ description: t,
125
+ icon: a,
126
+ actions: n,
127
+ footer: s,
128
+ isLoading: o = !1,
129
+ isEmpty: d = !1,
130
+ emptyLabel: h = "Aucune donnée disponible",
131
+ height: u = 300,
132
+ className: f,
133
+ contentClassName: i,
134
+ children: l
135
+ }) => {
136
+ const c = a, g = () => o ? /* @__PURE__ */ e(I, { className: "size-full rounded-surface" }) : d ? /* @__PURE__ */ e("div", { className: "flex size-full items-center justify-center", children: /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: h }) }) : l;
137
+ return /* @__PURE__ */ m(A, { className: f, children: [
138
+ /* @__PURE__ */ e(R, { children: /* @__PURE__ */ m("div", { className: "flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between", children: [
139
+ /* @__PURE__ */ m("div", { className: "min-w-0", children: [
140
+ /* @__PURE__ */ m(V, { className: "flex items-center gap-2", children: [
141
+ c && /* @__PURE__ */ e(c, { className: "size-5 shrink-0" }),
142
+ /* @__PURE__ */ e("span", { className: "truncate", children: r })
143
+ ] }),
144
+ t !== void 0 && t !== "" ? /* @__PURE__ */ e(P, { children: t }) : null
145
+ ] }),
146
+ n != null ? /* @__PURE__ */ e("div", { className: "shrink-0", children: n }) : null
147
+ ] }) }),
148
+ /* @__PURE__ */ m(S, { children: [
149
+ /* @__PURE__ */ e("div", { className: C("w-full", i), style: u === null ? void 0 : { height: u }, children: g() }),
150
+ !o && !d && s !== void 0 && s !== null ? /* @__PURE__ */ e("div", { className: "mt-4", children: s }) : null
151
+ ] })
152
+ ] });
153
+ }, 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))", te = ({
154
+ value: r,
155
+ max: t = 100,
156
+ size: a = 120,
157
+ strokeWidth: n = 8,
158
+ label: s,
159
+ unit: o = "%",
160
+ color: d,
161
+ thresholds: h = U,
162
+ valueFormatter: u = (i) => i.toFixed(1),
163
+ className: f
164
+ }) => {
165
+ const i = (a - n) / 2, l = i * 2 * Math.PI, c = t > 0 ? Math.min(100, Math.max(0, r / t * 100)) : 0, g = d ?? W(c, h);
166
+ return /* @__PURE__ */ m("div", { className: C("flex flex-col items-center gap-2", f), children: [
167
+ /* @__PURE__ */ m("div", { className: "relative", style: { width: a, height: a }, children: [
168
+ /* @__PURE__ */ m("svg", { width: a, height: a, className: "-rotate-90", children: [
169
+ /* @__PURE__ */ e("circle", { cx: a / 2, cy: a / 2, r: i, className: "stroke-muted", strokeWidth: n, fill: "transparent" }),
170
+ /* @__PURE__ */ e(
171
+ "circle",
172
+ {
173
+ cx: a / 2,
174
+ cy: a / 2,
175
+ r: i,
176
+ stroke: g,
177
+ strokeWidth: n,
178
+ fill: "transparent",
179
+ strokeDasharray: l,
180
+ strokeDashoffset: l - c / 100 * l,
181
+ strokeLinecap: "round",
182
+ className: "transition-all duration-500 ease-out"
183
+ }
184
+ )
185
+ ] }),
186
+ /* @__PURE__ */ m("div", { className: "absolute inset-0 flex flex-col items-center justify-center", children: [
187
+ /* @__PURE__ */ e("span", { className: "text-2xl font-bold text-card-foreground", children: u(r) }),
188
+ o !== "" && /* @__PURE__ */ e("span", { className: "text-sm text-muted-foreground", children: o })
189
+ ] })
190
+ ] }),
191
+ s !== void 0 && s !== "" ? /* @__PURE__ */ e("span", { className: "text-sm font-medium text-muted-foreground", children: s }) : null
192
+ ] });
193
+ }, ae = ({
194
+ data: r,
195
+ label: t = "Valeur",
196
+ color: a = "hsl(var(--primary))",
197
+ yAxisDomain: n,
198
+ valueFormatter: s,
199
+ labelFormatter: o,
200
+ showDots: d = !0,
201
+ className: h
202
+ }) => {
203
+ const u = v.useMemo(() => ({ value: { label: t, color: a } }), [t, a]), f = v.useMemo(() => L(s, t), [s, t]);
204
+ return /* @__PURE__ */ e(N, { config: u, className: C("aspect-auto size-full", h), children: /* @__PURE__ */ m(O, { data: r, margin: { top: 10, right: 20, left: 0, bottom: 10 }, children: [
205
+ /* @__PURE__ */ e(M, { strokeDasharray: "3 3", vertical: !1 }),
206
+ /* @__PURE__ */ e(
207
+ w,
208
+ {
209
+ dataKey: "name",
210
+ tickLine: !1,
211
+ axisLine: !1,
212
+ tickMargin: 8,
213
+ interval: "preserveStartEnd",
214
+ tickFormatter: o ? (i) => o(String(i)) : void 0
215
+ }
216
+ ),
217
+ /* @__PURE__ */ e(
218
+ D,
219
+ {
220
+ domain: n,
221
+ tickLine: !1,
222
+ axisLine: !1,
223
+ width: s ? 48 : 32,
224
+ tickFormatter: s ? (i) => s(Number(i)) : void 0
225
+ }
226
+ ),
227
+ /* @__PURE__ */ e(
228
+ x,
229
+ {
230
+ content: /* @__PURE__ */ e(y, { formatter: f, labelFormatter: o ? (i) => o(String(i)) : void 0 })
231
+ }
232
+ ),
233
+ /* @__PURE__ */ e(
234
+ _,
235
+ {
236
+ type: "monotone",
237
+ dataKey: "value",
238
+ stroke: "var(--color-value)",
239
+ strokeWidth: 2,
240
+ dot: d ? { fill: "var(--color-value)", strokeWidth: 0, r: 3 } : !1,
241
+ activeDot: { r: 5, strokeWidth: 2, className: "stroke-background" }
242
+ }
243
+ )
244
+ ] }) });
245
+ }, se = ({
246
+ data: r,
247
+ innerRadius: t,
248
+ outerRadius: a,
249
+ showLegend: n = !0,
250
+ showLabels: s = !1,
251
+ valueFormatter: o,
252
+ onSelect: d,
253
+ className: h
254
+ }) => {
255
+ const u = G(), f = v.useMemo(() => r.map((p, k) => ({ ...p, fill: p.color ?? b(k) })), [r]), i = v.useMemo(
256
+ () => Object.fromEntries(r.map((p, k) => [p.name, { label: p.name, color: p.color ?? b(k) }])),
257
+ [r]
258
+ ), l = v.useMemo(() => L(o), [o]), c = t ?? (u ? 45 : 60), g = a ?? (u ? 80 : 100);
259
+ return /* @__PURE__ */ e(N, { config: i, className: C("aspect-auto size-full", h), children: /* @__PURE__ */ m($, { children: [
260
+ /* @__PURE__ */ e(x, { content: /* @__PURE__ */ e(y, { nameKey: "name", hideLabel: !0, formatter: l }) }),
261
+ /* @__PURE__ */ e(
262
+ E,
263
+ {
264
+ data: f,
265
+ dataKey: "value",
266
+ nameKey: "name",
267
+ cx: "50%",
268
+ cy: n ? "45%" : "50%",
269
+ innerRadius: c,
270
+ outerRadius: g,
271
+ paddingAngle: c > 0 ? 2 : 0,
272
+ label: s ? ({ name: p, value: k }) => `${String(p)} (${String(k)})` : void 0,
273
+ isAnimationActive: !1,
274
+ className: C("stroke-background", d && "cursor-pointer"),
275
+ onClick: d ? (p, k) => {
276
+ d(r[k], k);
277
+ } : void 0
278
+ }
279
+ ),
280
+ n && /* @__PURE__ */ e(B, { content: /* @__PURE__ */ e(H, { nameKey: "name", className: "flex-wrap text-muted-foreground" }) })
281
+ ] }) });
282
+ };
283
+ export {
284
+ F as B,
285
+ K as C,
286
+ ae as L,
287
+ se as P,
288
+ ee as a,
289
+ re as b,
290
+ te as c,
291
+ b as g
292
+ };
@@ -4,7 +4,7 @@ export interface BarChartHorizontalProps {
4
4
  data: ChartDatum[];
5
5
  /** Libellé de la série dans le tooltip. */
6
6
  label?: string;
7
- /** Couleur des barres. Par défaut la couleur primaire du thème. */
7
+ /** Couleur des barres, sauf celles dont la donnée porte son propre `color`. Par défaut la couleur primaire du thème. */
8
8
  color?: string;
9
9
  /** Largeur réservée aux libellés de catégories, en pixels. */
10
10
  categoryWidth?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"BarChartHorizontal.d.ts","sourceRoot":"","sources":["../../../../src/components/core/charts/BarChartHorizontal.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8DAA8D;IAC9D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,+EAA+E;IAC/E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,qFAAqF;IACrF,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC3C,kCAAkC;IAClC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAID;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAI,6FAShC,uBAAuB,KAAG,KAAK,CAAC,GAAG,CAAC,OA0CtC,CAAC"}
1
+ {"version":3,"file":"BarChartHorizontal.d.ts","sourceRoot":"","sources":["../../../../src/components/core/charts/BarChartHorizontal.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wHAAwH;IACxH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8DAA8D;IAC9D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,+EAA+E;IAC/E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,qFAAqF;IACrF,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC3C,kCAAkC;IAClC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAID;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAI,6FAShC,uBAAuB,KAAG,KAAK,CAAC,GAAG,CAAC,OAiDtC,CAAC"}
@@ -4,7 +4,7 @@ export interface BarChartVerticalProps {
4
4
  data: ChartDatum[];
5
5
  /** Libellé de la série dans le tooltip. */
6
6
  label?: string;
7
- /** Couleur des barres. Par défaut la couleur primaire du thème. */
7
+ /** Couleur des barres, sauf celles dont la donnée porte son propre `color`. Par défaut la couleur primaire du thème. */
8
8
  color?: string;
9
9
  /** Inclinaison des libellés de l'axe des abscisses, en degrés (ex. `-45` quand ils se chevauchent). */
10
10
  labelAngle?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"BarChartVertical.d.ts","sourceRoot":"","sources":["../../../../src/components/core/charts/BarChartVertical.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uGAAuG;IACvG,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qFAAqF;IACrF,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC3C,kEAAkE;IAClE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAAI,yFAS9B,qBAAqB,KAAG,KAAK,CAAC,GAAG,CAAC,OA0CpC,CAAC"}
1
+ {"version":3,"file":"BarChartVertical.d.ts","sourceRoot":"","sources":["../../../../src/components/core/charts/BarChartVertical.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wHAAwH;IACxH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uGAAuG;IACvG,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qFAAqF;IACrF,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC3C,kEAAkE;IAClE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAAI,yFAS9B,qBAAqB,KAAG,KAAK,CAAC,GAAG,CAAC,OAiDpC,CAAC"}
@@ -1,19 +1,25 @@
1
1
  import * as React from "react";
2
2
  export interface ChartCardProps {
3
3
  title: string;
4
- description?: string;
4
+ /** Sous-titre. Accepte du contenu riche : mention de troncature, période couverte… */
5
+ description?: React.ReactNode;
5
6
  icon?: React.ElementType;
6
7
  /** Contenu aligné à droite de l'en-tête : filtre de période, bascule détaillé/agrégé… */
7
8
  actions?: React.ReactNode;
9
+ /** Contenu sous la zone de rendu : détail chiffré, légende étendue… Masqué pendant le chargement et sur données vides. */
10
+ footer?: React.ReactNode;
8
11
  isLoading?: boolean;
9
12
  isEmpty?: boolean;
10
13
  emptyLabel?: string;
11
14
  /**
12
- * Hauteur de la zone de rendu, en pixels. Appliquée en style inline et non en
13
- * classe Tailwind : une classe arbitraire construite dynamiquement ne serait
14
- * jamais générée dans le CSS du projet consommateur.
15
+ * Hauteur de la zone de rendu, en pixels (ou toute valeur CSS). Appliquée en
16
+ * style inline et non en classe Tailwind : une classe arbitraire construite
17
+ * dynamiquement ne serait jamais générée dans le CSS du projet consommateur.
18
+ *
19
+ * `null` retire le style inline pour laisser `contentClassName` piloter la
20
+ * hauteur — le seul moyen de la faire varier selon le point de rupture.
15
21
  */
16
- height?: number;
22
+ height?: number | string | null;
17
23
  className?: string;
18
24
  contentClassName?: string;
19
25
  children: React.ReactNode;
@@ -27,5 +33,5 @@ export interface ChartCardProps {
27
33
  * `aspect-auto h-full w-full` — la carte ne monte pas de `ResponsiveContainer`,
28
34
  * c'est `ChartContainer` qui s'en charge.
29
35
  */
30
- export declare const ChartCard: ({ title, description, icon, actions, isLoading, isEmpty, emptyLabel, height, className, contentClassName, children, }: ChartCardProps) => React.JSX.Element;
36
+ export declare const ChartCard: ({ title, description, icon, actions, footer, isLoading, isEmpty, emptyLabel, height, className, contentClassName, children, }: ChartCardProps) => React.JSX.Element;
31
37
  //# sourceMappingURL=ChartCard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChartCard.d.ts","sourceRoot":"","sources":["../../../../src/components/core/charts/ChartCard.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC;IACzB,yFAAyF;IACzF,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,SAAS,GAAI,uHAYvB,cAAc,KAAG,KAAK,CAAC,GAAG,CAAC,OAwC7B,CAAC"}
1
+ {"version":3,"file":"ChartCard.d.ts","sourceRoot":"","sources":["../../../../src/components/core/charts/ChartCard.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,sFAAsF;IACtF,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,IAAI,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC;IACzB,yFAAyF;IACzF,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,0HAA0H;IAC1H,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,SAAS,GAAI,+HAavB,cAAc,KAAG,KAAK,CAAC,GAAG,CAAC,OAyC7B,CAAC"}
@@ -1,4 +1,4 @@
1
- import { B as C, a as t, C as s, b as e, c as h, L as o, P as i, g as l } from "../../../PieChart-C9gn0Dws.js";
1
+ import { B as C, a as t, C as s, b as e, c as h, L as o, P as i, g as l } from "../../../PieChart-D6y5EQnh.js";
2
2
  export {
3
3
  C as BarChartHorizontal,
4
4
  t as BarChartVertical,
@@ -1,6 +1,6 @@
1
1
  import { D as e, M as o } from "../../MetricCard-B0xnFyim.js";
2
2
  import { K as t, a as i, S as l, b as p } from "../../SkeletonCards-av7XHlof.js";
3
- import { B as m, a as g, C as d, b as C, c, L as f, P as n, g as A } from "../../PieChart-C9gn0Dws.js";
3
+ import { B as m, a as g, C as d, b as C, c, L as f, P as n, g as A } from "../../PieChart-D6y5EQnh.js";
4
4
  import { A as D, C as x, F as S } from "../../ConfirmationDialog-M8sFAz4h.js";
5
5
  import { D as F, a as P, b as u, c as H, d as L, e as k, f as B, g as I, h as K, i as v, P as E } from "../../toggle-group-D6aFQQcf.js";
6
6
  import { A as y, a as G, F as O, S as R, T as V } from "../../TableFilter-BlrrSOtg.js";
@@ -1,6 +1,6 @@
1
1
  import { D as r, M as o } from "../MetricCard-B0xnFyim.js";
2
2
  import { K as t, a as n, S as i, b as l } from "../SkeletonCards-av7XHlof.js";
3
- import { B as p, a as u, C, b as g, c as d, L as m, P as T, g as S } from "../PieChart-C9gn0Dws.js";
3
+ import { B as p, a as u, C, b as g, c as d, L as m, P as T, g as S } from "../PieChart-D6y5EQnh.js";
4
4
  import { A as D, C as M, F as x } from "../ConfirmationDialog-M8sFAz4h.js";
5
5
  import { A as h, j as P, k as f, l as I, m as w, n as v, o as F, p as L, q as B, r as G, s as H, t as R, u as k, v as N, w as y, x as O, B as E, y as V, z as K, C as z, E as j, F as q, G as J, H as Q, I as U, J as _, K as W, L as X, M as Y, N as Z, O as $, Q as aa, R as ea, S as ra, T as oa, U as sa, V as ta, W as na, X as ia, Y as la, Z as ba, _ as pa, $ as ua, a0 as Ca, a1 as ga, a2 as da, a3 as ma, a4 as Ta, a5 as Sa, a6 as ca, a7 as Da, a8 as Ma, a9 as xa, aa as Aa, ab as ha, D as Pa, a as fa, b as Ia, c as wa, d as va, e as Fa, f as La, g as Ba, h as Ga, i as Ha, ac as Ra, ad as ka, ae as Na, af as ya, ag as Oa, ah as Ea, ai as Va, aj as Ka, ak as za, al as ja, am as qa, an as Ja, ao as Qa, ap as Ua, aq as _a, ar as Wa, as as Xa, at as Ya, au as Za, av as $a, aw as ae, ax as ee, ay as re, az as oe, aA as se, aB as te, aC as ne, aD as ie, aE as le, aF as be, aG as pe, aH as ue, aI as Ce, aJ as ge, aK as de, aL as me, aM as Te, aN as Se, aO as ce, aP as De, aQ as Me, aR as xe, aS as Ae, aT as he, aU as Pe, aV as fe, aW as Ie, aX as we, aY as ve, aZ as Fe, a_ as Le, a$ as Be, b0 as Ge, b1 as He, b2 as Re, b3 as ke, b4 as Ne, b5 as ye, b6 as Oe, b7 as Ee, b8 as Ve, b9 as Ke, ba as ze, bb as je, bc as qe, bd as Je, be as Qe, bf as Ue, bg as _e, bh as We, bi as Xe, bj as Ye, bk as Ze, bl as $e, P as ar, bm as er, bn as rr, bo as or, bp as sr, bq as tr, br as nr, bs as ir, bt as lr, bu as br, bv as pr, bw as ur, bx as Cr, by as gr, bz as dr, bA as mr, bB as Tr, bC as Sr, bD as cr, bE as Dr, bF as Mr, bG as xr, bH as Ar, bI as hr, bJ as Pr, bK as fr, bL as Ir, bM as wr, bN as vr, bO as Fr, bP as Lr, bQ as Br, bR as Gr, bS as Hr, bT as Rr } from "../toggle-group-D6aFQQcf.js";
6
6
  import { A as Nr, a as yr, F as Or, S as Er, T as Vr } from "../TableFilter-BlrrSOtg.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krosoft/react",
3
- "version": "0.0.184",
3
+ "version": "0.0.186",
4
4
  "description": "Krosoft shared React package",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -105,7 +105,7 @@
105
105
  "@types/react-dom": "^19.2.3",
106
106
  "autoprefixer": "^10.5.4",
107
107
  "eslint-plugin-storybook": "10.5.7",
108
- "jsdom": "^29.1.1",
108
+ "jsdom": "^30.0.1",
109
109
  "next-themes": "^0.4.6",
110
110
  "prettier": "^3.9.6",
111
111
  "react": "^19.2.7",
@@ -1,282 +0,0 @@
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
- };