@krosoft/react 0.0.252 → 0.0.254

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 (55) hide show
  1. package/dist/{AppActions-C_0YI75w.js → AppActions-BMq9aQrB.js} +1 -1
  2. package/dist/{AppSubTitle-tqqV9nuT.js → AppSubTitle-DIQetGjl.js} +1 -1
  3. package/dist/{ErrorAlert-BDqDHUUc.js → ErrorAlert-DClCk3Ey.js} +1 -1
  4. package/dist/{GenericForm-CWXT5wiv.js → GenericForm-D1TP41Gp.js} +6 -6
  5. package/dist/{ImageInput-CN2ozjpc.js → ImageInput-DnoBhP4X.js} +2 -2
  6. package/dist/{MultiSelect-BF0zL0B0.js → MultiSelect-O9AljNco.js} +2 -2
  7. package/dist/{SearchInput-BQyRXzCv.js → SearchInput-BEqCjP6R.js} +3 -3
  8. package/dist/{behavior-D3JNfIVJ.js → behavior-DDtrNBAq.js} +1 -1
  9. package/dist/{cards-Bkwz7WQM.js → cards-3sbUuHR0.js} +1 -1
  10. package/dist/{charts-CXhVUqLH.js → charts-CwT9AFWj.js} +1 -1
  11. package/dist/components/core/cards/index.js +1 -1
  12. package/dist/components/core/charts/index.js +1 -1
  13. package/dist/components/core/dialogs/index.js +3 -3
  14. package/dist/components/core/filters/index.js +5 -5
  15. package/dist/components/core/forms/index.js +1 -1
  16. package/dist/components/core/index.js +19 -19
  17. package/dist/components/core/inputs/index.js +3 -3
  18. package/dist/components/core/language/index.js +1 -1
  19. package/dist/components/core/layouts/index.js +5 -5
  20. package/dist/components/core/navbar/index.js +1 -1
  21. package/dist/components/core/states/index.js +2 -2
  22. package/dist/components/core/table/JsonTableOutput.d.ts +8 -0
  23. package/dist/components/core/table/JsonTableOutput.d.ts.map +1 -0
  24. package/dist/components/core/table/TableBody.d.ts +1 -1
  25. package/dist/components/core/table/TableBody.d.ts.map +1 -1
  26. package/dist/components/core/table/TableHeader.d.ts.map +1 -1
  27. package/dist/components/core/table/index.d.ts +1 -0
  28. package/dist/components/core/table/index.d.ts.map +1 -1
  29. package/dist/components/core/table/index.js +2 -2
  30. package/dist/components/core/tabs/index.js +4 -4
  31. package/dist/components/core/theme/index.js +1 -1
  32. package/dist/components/index.js +19 -19
  33. package/dist/components/ui/index.js +2 -2
  34. package/dist/{dialogs-BGHSClsq.js → dialogs-CVA3y-o4.js} +5 -5
  35. package/dist/hooks/behavior/index.js +1 -1
  36. package/dist/hooks/index.js +4 -4
  37. package/dist/hooks/ui/index.js +3 -3
  38. package/dist/hooks/ui/useLanguage.d.ts.map +1 -1
  39. package/dist/i18n/index.js +1 -1
  40. package/dist/i18n/krosoftLocales.d.ts +4 -0
  41. package/dist/i18n/krosoftLocales.d.ts.map +1 -1
  42. package/dist/{i18n-Dw99bRmg.js → i18n-DW5zKBEK.js} +6 -2
  43. package/dist/{language-BQpuOau0.js → language-Cn7U026J.js} +2 -2
  44. package/dist/{navbar-G9FexEW-.js → navbar-DLxNVUU9.js} +3 -3
  45. package/dist/{sheet-CRrYTZrl.js → sheet-B8mCfCPe.js} +1 -1
  46. package/dist/{states-N8-LjFng.js → states-BusGNKku.js} +2 -2
  47. package/dist/table-C4tXdSu3.js +644 -0
  48. package/dist/{theme-BGakUJ9c.js → theme-Ck_D5xtg.js} +2 -2
  49. package/dist/{ui-CmUIUFnk.js → ui-Dg7lq9J8.js} +2 -2
  50. package/dist/{ui-CiX0E_bn.js → ui-hvA1osvS.js} +1 -1
  51. package/dist/useLanguage-B1dusDJk.js +23 -0
  52. package/dist/{useTheme-DVfcJ-Qd.js → useTheme-D1APOG9I.js} +1 -1
  53. package/package.json +1 -1
  54. package/dist/table-D7PJi2IO.js +0 -582
  55. package/dist/useLanguage-DN3CuBv5.js +0 -19
@@ -1,9 +1,9 @@
1
1
  import { t as e } from "./tailwind.helper-CJaRYBmL.js";
2
2
  import { i as t, n, r, s as i, t as a } from "./tooltip-B2dzyfs9.js";
3
- import { t as o } from "./i18n-Dw99bRmg.js";
4
- import { C as s, S as c, b as l, d as u, g as d, h as f, i as p, l as m, m as h, p as g, r as _, t as v, v as y, x as b, y as x } from "./sheet-CRrYTZrl.js";
3
+ import { t as o } from "./i18n-DW5zKBEK.js";
4
+ import { C as s, S as c, b as l, d as u, g as d, h as f, i as p, l as m, m as h, p as g, r as _, t as v, v as y, x as b, y as x } from "./sheet-B8mCfCPe.js";
5
5
  import { t as S } from "./skeleton-D6Ga4BLw.js";
6
- import { c as C } from "./behavior-D3JNfIVJ.js";
6
+ import { c as C } from "./behavior-DDtrNBAq.js";
7
7
  import "./hooks/index.js";
8
8
  import * as w from "react";
9
9
  import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
@@ -1,7 +1,7 @@
1
1
  import { t as e } from "./tailwind.helper-CJaRYBmL.js";
2
2
  import "./helpers/index.js";
3
3
  import { a as t } from "./tooltip-B2dzyfs9.js";
4
- import { t as n } from "./i18n-Dw99bRmg.js";
4
+ import { t as n } from "./i18n-DW5zKBEK.js";
5
5
  import * as r from "react";
6
6
  import { jsx as i, jsxs as a } from "react/jsx-runtime";
7
7
  import { SearchIcon as o, X as s } from "lucide-react";
@@ -1,5 +1,5 @@
1
- import { t as e } from "./i18n-Dw99bRmg.js";
2
- import "./ErrorAlert-BDqDHUUc.js";
1
+ import { t as e } from "./i18n-DW5zKBEK.js";
2
+ import "./ErrorAlert-DClCk3Ey.js";
3
3
  import { jsx as t, jsxs as n } from "react/jsx-runtime";
4
4
  import { Loader2Icon as r } from "lucide-react";
5
5
  //#region src/components/core/states/ErrorState.tsx
@@ -0,0 +1,644 @@
1
+ import { At as e, C as t, D as n, Ft as r, Gt as i, Mt as a, Nt as o, O as s, S as c, T as l, bn as u, jt as d, k as f, v as p } from "./ui-hvA1osvS.js";
2
+ import { s as m } from "./tooltip-B2dzyfs9.js";
3
+ import { t as h } from "./i18n-DW5zKBEK.js";
4
+ import { i as g, l as _, n as v, t as y, u as b } from "./select-ULiTPOr5.js";
5
+ import { n as x, t as S } from "./useFixedColumns-DnzqhbfT.js";
6
+ import { useState as C } from "react";
7
+ import { Fragment as w, jsx as T, jsxs as E } from "react/jsx-runtime";
8
+ import { tryParseJson as D } from "@krosoft/core/helpers";
9
+ import { AlertTriangleIcon as O, ArrowDownIcon as k, ArrowUpDownIcon as A, ArrowUpIcon as j, ChevronLeftIcon as M, ChevronRightIcon as N, GripVerticalIcon as P, Loader2Icon as F, MoreVerticalIcon as I, SettingsIcon as L } from "lucide-react";
10
+ import { useNavigate as R } from "react-router-dom";
11
+ //#region src/constants/datatable.ts
12
+ var z = [
13
+ 5,
14
+ 10,
15
+ 30,
16
+ 50,
17
+ 100
18
+ ], ee = z[1];
19
+ //#endregion
20
+ //#region src/components/core/table/TableActions.tsx
21
+ function B({ actions: e, row: t }) {
22
+ let n = e.filter((e) => e.visible === void 0 || e.visible(t));
23
+ if (n.length === 0) return null;
24
+ let a = n.filter((e) => e.overflow !== !0), s = n.filter((e) => e.overflow === !0);
25
+ return /* @__PURE__ */ E("div", {
26
+ className: "flex items-center justify-end gap-1",
27
+ children: [a.map((e, n) => {
28
+ let r = e.icon;
29
+ return /* @__PURE__ */ E(m, {
30
+ variant: e.variant ?? "ghost",
31
+ size: "sm",
32
+ disabled: e.disabled?.(t) ?? !1,
33
+ className: `h-7 px-2 text-muted-foreground hover:text-foreground ${e.className ?? ""}`,
34
+ onClick: (n) => {
35
+ n.stopPropagation(), e.onClick(t);
36
+ },
37
+ children: [r !== void 0 && /* @__PURE__ */ T(r, { className: "size-3.5" }), e.label]
38
+ }, n);
39
+ }), s.length > 0 && /* @__PURE__ */ E(d, { children: [/* @__PURE__ */ T(i, {
40
+ asChild: !0,
41
+ children: /* @__PURE__ */ T(m, {
42
+ variant: "ghost",
43
+ size: "icon",
44
+ className: "h-7 w-7 text-muted-foreground hover:text-foreground",
45
+ children: /* @__PURE__ */ T(I, { className: "size-3.5" })
46
+ })
47
+ }), /* @__PURE__ */ T(o, {
48
+ align: "end",
49
+ onClick: (e) => {
50
+ e.stopPropagation();
51
+ },
52
+ children: s.map((e, n) => {
53
+ let i = e.icon;
54
+ return /* @__PURE__ */ E(r, {
55
+ disabled: e.disabled?.(t) ?? !1,
56
+ onClick: () => {
57
+ e.onClick(t);
58
+ },
59
+ className: e.className,
60
+ children: [i !== void 0 && /* @__PURE__ */ T("span", {
61
+ className: "mr-2 size-4 flex items-center justify-center",
62
+ children: /* @__PURE__ */ T(i, { className: "size-4" })
63
+ }), e.label]
64
+ }, n);
65
+ })
66
+ })] })]
67
+ });
68
+ }
69
+ //#endregion
70
+ //#region src/components/core/table/columnAlignment.ts
71
+ var V = {
72
+ left: "text-left",
73
+ center: "text-center",
74
+ right: "text-right"
75
+ };
76
+ function H(e) {
77
+ if (e.align !== void 0) return e.align;
78
+ let t = (e.className ?? "").split(/\s+/);
79
+ return t.includes("text-right") ? "right" : t.includes("text-center") ? "center" : "left";
80
+ }
81
+ function U(e) {
82
+ return V[e];
83
+ }
84
+ //#endregion
85
+ //#region src/components/core/table/fixedColumns.ts
86
+ var W = "__selection__", G = "__actions__", K = {
87
+ left: "border-r border-gray-200 dark:border-gray-800",
88
+ right: "border-l border-gray-200 dark:border-gray-800"
89
+ };
90
+ function q(e, t) {
91
+ if (e === void 0) return {
92
+ className: "relative",
93
+ style: {}
94
+ };
95
+ let n = t === "header";
96
+ return {
97
+ className: [
98
+ "sticky bg-card dark:bg-gray-950",
99
+ n ? "z-20" : "z-10",
100
+ "before:absolute before:inset-0 before:-z-10 before:pointer-events-none",
101
+ n ? "before:bg-muted/50 dark:before:bg-gray-900/50" : "group-hover:before:bg-muted/50 dark:group-hover:before:bg-gray-900/50",
102
+ e.isEdge ? K[e.side] : ""
103
+ ].filter(Boolean).join(" "),
104
+ style: e.side === "left" ? { left: e.offset } : { right: e.offset }
105
+ };
106
+ }
107
+ //#endregion
108
+ //#region src/components/core/table/TableBody.tsx
109
+ function J({ isLoading: e, error: t, colSpanCount: n, noDataMessage: r, paginatedData: i, getRowId: a, onRowClick: o, onRowNavigate: s, hasBulkActions: c, selectedRows: l, toggleRowSelection: d, visibleColumnsArray: f, columnWidths: p, hasActions: m, actions: g, columns: _, bordered: v = !1, dense: y = !1, resizableColumns: b = !1, fixedColumns: x = {} }) {
110
+ let { t: S } = h(), C = R(), w = (e, t) => {
111
+ let n = _.find((e) => e.key === t);
112
+ if (n?.renderCell !== void 0) return n.renderCell(e);
113
+ let r = e[t];
114
+ return /* @__PURE__ */ T("span", {
115
+ className: "text-sm truncate",
116
+ children: r == null ? "-" : String(r)
117
+ });
118
+ };
119
+ if (e) return /* @__PURE__ */ T("tbody", {
120
+ className: "divide-y divide-gray-200 dark:divide-gray-800",
121
+ children: /* @__PURE__ */ T("tr", { children: /* @__PURE__ */ T("td", {
122
+ colSpan: n,
123
+ className: "py-8 text-center",
124
+ children: /* @__PURE__ */ E("div", {
125
+ className: "flex flex-col items-center justify-center gap-2 text-muted-foreground",
126
+ children: [/* @__PURE__ */ T(F, { className: "h-6 w-6 animate-spin text-primary" }), /* @__PURE__ */ T("span", {
127
+ className: "text-sm",
128
+ children: S("states.loading")
129
+ })]
130
+ })
131
+ }) })
132
+ });
133
+ if (t) return /* @__PURE__ */ T("tbody", {
134
+ className: "divide-y divide-gray-200 dark:divide-gray-800",
135
+ children: /* @__PURE__ */ T("tr", { children: /* @__PURE__ */ T("td", {
136
+ colSpan: n,
137
+ className: "py-8 text-center",
138
+ children: /* @__PURE__ */ E("div", {
139
+ className: "flex flex-col items-center justify-center gap-2 text-destructive",
140
+ children: [/* @__PURE__ */ T(O, { className: "h-6 w-6" }), /* @__PURE__ */ T("span", {
141
+ className: "text-sm",
142
+ children: t
143
+ })]
144
+ })
145
+ }) })
146
+ });
147
+ if (i.length === 0) return /* @__PURE__ */ T("tbody", {
148
+ className: "divide-y divide-gray-200 dark:divide-gray-800",
149
+ children: /* @__PURE__ */ T("tr", { children: /* @__PURE__ */ T("td", {
150
+ colSpan: n,
151
+ className: "py-8 text-center text-sm text-muted-foreground",
152
+ children: r ?? S("states.noResult")
153
+ }) })
154
+ });
155
+ let D = q(x[W], "body"), k = q(x[G], "body"), A = s !== void 0 || o !== void 0, j = (e, t) => {
156
+ if (s !== void 0) {
157
+ let n = s(e);
158
+ t.ctrlKey || t.metaKey ? window.open(n, "_blank") : C(n);
159
+ } else o?.(e, t);
160
+ };
161
+ return /* @__PURE__ */ T("tbody", {
162
+ className: "divide-y divide-gray-200 dark:divide-gray-800",
163
+ children: i.map((e) => {
164
+ let t = a(e);
165
+ return /* @__PURE__ */ E("tr", {
166
+ className: `group hover:bg-muted/50 dark:hover:bg-gray-900/50 transition-colors ${A ? "cursor-pointer" : ""}`,
167
+ onClick: (t) => {
168
+ j(e, t);
169
+ },
170
+ children: [
171
+ c ? /* @__PURE__ */ T("td", {
172
+ className: `p-1 text-center align-middle ${D.className}`,
173
+ style: {
174
+ width: "48px",
175
+ minWidth: "48px",
176
+ maxWidth: "48px",
177
+ ...D.style
178
+ },
179
+ onClick: (e) => {
180
+ e.stopPropagation();
181
+ },
182
+ children: /* @__PURE__ */ T("div", {
183
+ className: "flex items-center justify-center",
184
+ children: /* @__PURE__ */ T(u, {
185
+ checked: l.includes(t),
186
+ onCheckedChange: () => {
187
+ d(t);
188
+ }
189
+ })
190
+ })
191
+ }) : null,
192
+ f.map((t, n) => {
193
+ let r = n === f.length - 1, i = q(x[t.key], "body");
194
+ return /* @__PURE__ */ T("td", {
195
+ className: `${`${n === 0 && !c ? "pl-4" : "pl-2"} ${r && !m ? "pr-4" : "pr-2"}`} ${y ? "py-2" : "py-4"} ${U(H(t))} ${i.className} ${v && !r ? "border-r border-gray-100 dark:border-gray-800" : ""} ${t.className ?? ""}`,
196
+ style: {
197
+ ...b ? { width: p[t.key] } : { minWidth: p[t.key] },
198
+ ...i.style
199
+ },
200
+ children: /* @__PURE__ */ T("div", {
201
+ className: "w-full h-full",
202
+ children: w(e, t.key)
203
+ })
204
+ }, t.key);
205
+ }),
206
+ m ? /* @__PURE__ */ T("td", {
207
+ className: `p-1 text-right align-middle whitespace-nowrap ${k.className}`,
208
+ style: {
209
+ minWidth: "32px",
210
+ ...k.style
211
+ },
212
+ onClick: (e) => {
213
+ e.stopPropagation();
214
+ },
215
+ children: g !== void 0 && g.length > 0 ? /* @__PURE__ */ T("div", {
216
+ className: "flex items-center justify-end",
217
+ children: /* @__PURE__ */ T(B, {
218
+ actions: g,
219
+ row: e
220
+ })
221
+ }) : null
222
+ }) : null
223
+ ]
224
+ }, t);
225
+ })
226
+ });
227
+ }
228
+ //#endregion
229
+ //#region src/components/core/table/TableBulkActions.tsx
230
+ function Y({ selectedRows: e, setSelectedRows: t, bulkActions: n }) {
231
+ return /* @__PURE__ */ E("div", {
232
+ className: "bg-muted/60 dark:bg-gray-900/60 border border-border px-3 py-1.5 flex items-center justify-between rounded-surface",
233
+ children: [/* @__PURE__ */ E("div", {
234
+ className: "flex items-center gap-4",
235
+ children: [/* @__PURE__ */ E("span", {
236
+ className: "text-sm font-medium text-primary ml-1",
237
+ children: [e.length, " sélectionné(s)"]
238
+ }), /* @__PURE__ */ T("div", {
239
+ className: "flex items-center gap-2",
240
+ children: n.map((n, r) => {
241
+ let i = n.icon;
242
+ return /* @__PURE__ */ E(m, {
243
+ variant: "outline",
244
+ size: "sm",
245
+ onClick: () => {
246
+ n.onClick(e, () => {
247
+ t([]);
248
+ });
249
+ },
250
+ className: `h-7 bg-background shadow-sm text-xs px-2.5 ${n.variant === "destructive" ? "text-destructive border-destructive/30 hover:bg-destructive/10 hover:text-destructive" : "text-foreground"}`,
251
+ children: [i !== void 0 && /* @__PURE__ */ T("span", {
252
+ className: "mr-1.5 flex items-center justify-center",
253
+ children: /* @__PURE__ */ T(i, { className: "h-3.5 w-3.5" })
254
+ }), n.label]
255
+ }, r);
256
+ })
257
+ })]
258
+ }), /* @__PURE__ */ T(m, {
259
+ variant: "ghost",
260
+ size: "sm",
261
+ onClick: () => {
262
+ t([]);
263
+ },
264
+ className: "text-xs text-muted-foreground hover:text-foreground h-7 px-2",
265
+ children: "Désélectionner"
266
+ })]
267
+ });
268
+ }
269
+ //#endregion
270
+ //#region src/components/core/table/TableHeader.tsx
271
+ var X = {
272
+ left: "justify-start",
273
+ center: "justify-center",
274
+ right: "justify-end"
275
+ };
276
+ function Z({ hasBulkActions: e, selectedRows: t, totalItems: n, toggleSelectAll: r, visibleColumnsArray: i, draggableColumns: a, resizableColumns: o, columnWidths: s, sortColumn: c, sortDirection: l, handleSort: d, handleDragStart: f, handleDragOver: p, handleDrop: m, handleMouseDown: h, hasActions: g, settingsNode: _, bordered: v = !1, dense: y = !1, fixedColumns: b = {}, fixedSelection: x = !1, fixedActions: S = !1 }) {
277
+ let C = !1;
278
+ t.length === n && n > 0 ? C = !0 : t.length > 0 && (C = "indeterminate");
279
+ let w = (e) => e.sortable === !0 ? c === e.key ? T(l === "asc" ? j : k, { className: "size-3.5 text-foreground" }) : /* @__PURE__ */ T(A, { className: "size-3.5 text-muted-foreground/50 group-hover:text-muted-foreground transition-colors" }) : null, D = (t, n, r) => {
280
+ let a = r !== !1 && t.fixed === void 0, c = t.sortable === !0, l = q(b[t.key], "header"), u = H(t), x = w(t), S = n === 0 && !e, C = n === i.length - 1 && !(g || _ !== void 0), D = `${S ? "pl-4" : "pl-2"} ${C ? "pr-4" : "pr-2"}`;
281
+ return /* @__PURE__ */ E("th", {
282
+ "data-column-key": t.key,
283
+ "data-fixed-side": t.fixed,
284
+ className: [
285
+ `${D} ${y ? "py-2" : "py-4"} text-sm font-medium text-gray-900 dark:text-gray-100 group`,
286
+ U(u),
287
+ l.className,
288
+ v ? "border-r border-gray-200 dark:border-gray-800" : "",
289
+ c ? "cursor-pointer select-none" : "",
290
+ t.className ?? ""
291
+ ].filter(Boolean).join(" "),
292
+ style: {
293
+ ...o ? { width: s[t.key] } : { minWidth: s[t.key] },
294
+ ...l.style
295
+ },
296
+ draggable: a,
297
+ onClick: () => {
298
+ d(t.key);
299
+ },
300
+ onDragStart: (e) => {
301
+ a ? f(e, t.key) : e.preventDefault();
302
+ },
303
+ onDragOver: (e) => {
304
+ p(e, t.key);
305
+ },
306
+ onDrop: (e) => {
307
+ m(e, t.key);
308
+ },
309
+ children: [/* @__PURE__ */ E("div", {
310
+ className: `flex items-center gap-1 ${X[u]} ${o ? "pr-2" : ""}`,
311
+ children: [
312
+ a ? /* @__PURE__ */ T(P, { className: "size-4 text-gray-400 cursor-grab dark:text-gray-300 shrink-0" }) : null,
313
+ /* @__PURE__ */ T("span", {
314
+ className: "truncate",
315
+ children: t.label
316
+ }),
317
+ x === null ? null : /* @__PURE__ */ T("span", {
318
+ className: "ml-1 shrink-0",
319
+ children: x
320
+ })
321
+ ]
322
+ }), o ? /* @__PURE__ */ T("div", {
323
+ className: "absolute right-0 top-0 bottom-0 w-2 cursor-col-resize hover:bg-blue-500 opacity-0 group-hover:opacity-50 transition-opacity",
324
+ onMouseDown: (e) => {
325
+ h(e, t.key);
326
+ }
327
+ }) : null]
328
+ }, t.key);
329
+ }, O = q(b[W], "header"), M = q(b[G], "header");
330
+ return /* @__PURE__ */ T("thead", {
331
+ className: "bg-muted/50 dark:bg-gray-900/50 border-b border-gray-200 dark:border-gray-800",
332
+ children: /* @__PURE__ */ E("tr", { children: [
333
+ e ? /* @__PURE__ */ T("th", {
334
+ "data-column-key": W,
335
+ "data-fixed-side": x ? "left" : void 0,
336
+ className: `p-1 text-center align-middle ${O.className}`,
337
+ style: {
338
+ width: "48px",
339
+ minWidth: "48px",
340
+ maxWidth: "48px",
341
+ ...O.style
342
+ },
343
+ children: /* @__PURE__ */ T("div", {
344
+ className: "flex items-center justify-center",
345
+ children: /* @__PURE__ */ T(u, {
346
+ checked: C,
347
+ onCheckedChange: r
348
+ })
349
+ })
350
+ }) : null,
351
+ i.map((e, t) => D(e, t, a)),
352
+ g || _ !== void 0 ? /* @__PURE__ */ T("th", {
353
+ "data-column-key": G,
354
+ "data-fixed-side": S ? "right" : void 0,
355
+ className: `p-1 text-right align-middle ${M.className}`,
356
+ style: {
357
+ minWidth: "32px",
358
+ ...M.style
359
+ },
360
+ children: _
361
+ }) : null
362
+ ] })
363
+ });
364
+ }
365
+ //#endregion
366
+ //#region src/components/core/table/TablePagination.tsx
367
+ var Q = "…";
368
+ function $(e, t) {
369
+ return Array.from({ length: t - e + 1 }, (t, n) => e + n);
370
+ }
371
+ function te(e, t, n = 1) {
372
+ if (n * 2 + 5 >= t) return $(1, t);
373
+ let r = Math.max(e - n, 1), i = Math.min(e + n, t), a = r > 2, o = i < t - 1;
374
+ return !a && o ? [
375
+ ...$(1, n + 2),
376
+ Q,
377
+ t
378
+ ] : a && !o ? [
379
+ 1,
380
+ Q,
381
+ ...$(t - (n + 2) + 1, t)
382
+ ] : [
383
+ 1,
384
+ Q,
385
+ ...$(r, i),
386
+ Q,
387
+ t
388
+ ];
389
+ }
390
+ function ne({ totalItems: e, startIndex: t, endIndex: n, pageSize: r, setPageSize: i, currentPage: a, setCurrentPage: o, pageSizeOptions: s, totalPages: c }) {
391
+ let { t: l } = h(), u = te(a, c);
392
+ return /* @__PURE__ */ E("div", {
393
+ className: "px-4 py-2 border-t border-gray-200 dark:border-gray-800 flex flex-col sm:grid sm:grid-cols-3 items-center gap-2 bg-muted/50 dark:bg-gray-900/50",
394
+ children: [
395
+ /* @__PURE__ */ E("div", {
396
+ className: "text-sm text-muted-foreground justify-self-start",
397
+ children: [
398
+ e === 0 ? "0" : `${String(t + 1)} - ${String(n)}`,
399
+ " sur ",
400
+ e
401
+ ]
402
+ }),
403
+ /* @__PURE__ */ T("div", {
404
+ className: "flex items-center justify-center gap-1",
405
+ children: c > 1 && /* @__PURE__ */ E(w, { children: [
406
+ /* @__PURE__ */ T(m, {
407
+ variant: "ghost",
408
+ size: "icon",
409
+ className: "h-8 w-8 rounded-control",
410
+ onClick: () => {
411
+ o((e) => Math.max(1, e - 1));
412
+ },
413
+ disabled: a === 1,
414
+ "aria-label": l("table.previousPage"),
415
+ children: /* @__PURE__ */ T(M, { className: "size-4" })
416
+ }),
417
+ u.map((e, t) => e === Q ? /* @__PURE__ */ T("span", {
418
+ className: "flex h-8 w-8 items-center justify-center text-sm text-muted-foreground",
419
+ children: Q
420
+ }, `dots-${String(t)}`) : /* @__PURE__ */ T(m, {
421
+ variant: e === a ? "default" : "ghost",
422
+ size: "icon",
423
+ className: "h-8 w-8 rounded-control text-sm",
424
+ onClick: () => {
425
+ o(e);
426
+ },
427
+ "aria-current": e === a ? "page" : void 0,
428
+ children: e
429
+ }, e)),
430
+ /* @__PURE__ */ T(m, {
431
+ variant: "ghost",
432
+ size: "icon",
433
+ className: "h-8 w-8 rounded-control",
434
+ onClick: () => {
435
+ o((e) => Math.min(c, e + 1));
436
+ },
437
+ disabled: a === c,
438
+ "aria-label": l("table.nextPage"),
439
+ children: /* @__PURE__ */ T(N, { className: "size-4" })
440
+ })
441
+ ] })
442
+ }),
443
+ /* @__PURE__ */ T("div", {
444
+ className: "justify-self-end",
445
+ children: /* @__PURE__ */ E(y, {
446
+ value: String(r),
447
+ onValueChange: (e) => {
448
+ i(Number(e)), o(1);
449
+ },
450
+ children: [/* @__PURE__ */ T(_, {
451
+ className: "h-8 w-[110px] text-sm",
452
+ children: /* @__PURE__ */ T(b, {})
453
+ }), /* @__PURE__ */ T(v, { children: s.map((e) => /* @__PURE__ */ E(g, {
454
+ value: String(e),
455
+ children: [e, " / page"]
456
+ }, e)) })]
457
+ })
458
+ })
459
+ ]
460
+ });
461
+ }
462
+ //#endregion
463
+ //#region src/components/core/table/TableSettings.tsx
464
+ function re({ columns: e, visibleColumns: t, toggleColumnVisibility: n }) {
465
+ return /* @__PURE__ */ E(d, { children: [/* @__PURE__ */ T(i, {
466
+ asChild: !0,
467
+ children: /* @__PURE__ */ T(m, {
468
+ variant: "outline",
469
+ size: "sm",
470
+ className: "size-7 p-0 bg-white hover:bg-gray-100 dark:bg-gray-900 shadow-sm border-gray-200 dark:border-gray-800",
471
+ children: /* @__PURE__ */ T(L, { className: "size-3.5 text-gray-600 dark:text-gray-300" })
472
+ })
473
+ }), /* @__PURE__ */ T(o, {
474
+ align: "end",
475
+ className: "w-56",
476
+ children: e.map((e) => /* @__PURE__ */ T(a, {
477
+ checked: t.has(e.key),
478
+ onCheckedChange: () => {
479
+ n(e.key);
480
+ },
481
+ children: e.label
482
+ }, e.key))
483
+ })] });
484
+ }
485
+ //#endregion
486
+ //#region src/components/core/table/DataTable.tsx
487
+ function ie({ data: e, columns: t, getRowId: n, onRowClick: r, onRowNavigate: i, actions: a, bulkActions: o, draggableColumns: s = !1, resizableColumns: c = !1, columnVisibility: l = !1, isLoading: u = !1, error: d = null, bordered: f = !1, dense: p = !1, fixedActions: m = !1, noDataMessage: h, defaultPageSize: g = ee, pageSizeOptions: _ = z, totalRows: v, currentPage: y, pageSize: b, onPageChange: C, onPageSizeChange: w, sortColumn: D, sortDirection: O, onSortChange: k }) {
488
+ let { sortColumn: A, sortDirection: j, selectedRows: M, setSelectedRows: N, visibleColumns: P, columnWidths: F, safeCurrentPage: I, totalPages: L, startIndex: R, endIndex: B, tableRef: V, hasActions: H, hasBulkActions: U, visibleColumnsArray: W, colSpanCount: G, paginatedData: K, handleSort: q, handleMouseDown: X, handleDragStart: Q, handleDragOver: $, handleDrop: te, toggleColumnVisibility: ie, toggleRowSelection: ae, toggleSelectAll: oe, pageSize: se, setPageSize: ce, setCurrentPage: le } = x({
489
+ data: e,
490
+ columns: t,
491
+ getRowId: n,
492
+ defaultPageSize: g,
493
+ actions: a,
494
+ bulkActions: o,
495
+ columnVisibility: l,
496
+ totalRows: v,
497
+ currentPage: y,
498
+ pageSize: b,
499
+ onPageChange: C,
500
+ onPageSizeChange: w,
501
+ sortColumn: D,
502
+ sortDirection: O,
503
+ onSortChange: k
504
+ }), ue = U && W.some((e) => e.fixed === "left"), de = S(V);
505
+ return /* @__PURE__ */ E("div", {
506
+ className: "space-y-4 [--k-radius-control:var(--k-radius-control-dense,0.5rem)] [--k-radius-surface:var(--k-radius-surface-dense,0.75rem)]",
507
+ children: [M.length > 0 && o !== void 0 && o.length > 0 && /* @__PURE__ */ T(Y, {
508
+ selectedRows: M,
509
+ setSelectedRows: N,
510
+ bulkActions: o
511
+ }), /* @__PURE__ */ E("div", {
512
+ className: "w-full bg-card dark:bg-gray-950 rounded-surface border border-gray-200 dark:border-gray-800 overflow-hidden",
513
+ children: [/* @__PURE__ */ T("div", {
514
+ className: "overflow-x-auto",
515
+ children: /* @__PURE__ */ E("table", {
516
+ ref: V,
517
+ className: "w-full",
518
+ children: [/* @__PURE__ */ T(Z, {
519
+ hasBulkActions: U,
520
+ selectedRows: M,
521
+ totalItems: e.length,
522
+ toggleSelectAll: oe,
523
+ visibleColumnsArray: W,
524
+ draggableColumns: s,
525
+ resizableColumns: c,
526
+ columnWidths: F,
527
+ sortColumn: A,
528
+ sortDirection: j,
529
+ handleSort: q,
530
+ handleDragStart: Q,
531
+ handleDragOver: $,
532
+ handleDrop: te,
533
+ handleMouseDown: X,
534
+ hasActions: H,
535
+ bordered: f,
536
+ dense: p,
537
+ fixedColumns: de,
538
+ fixedSelection: ue,
539
+ fixedActions: m,
540
+ settingsNode: l ? /* @__PURE__ */ T(re, {
541
+ columns: t,
542
+ visibleColumns: P,
543
+ toggleColumnVisibility: ie
544
+ }) : void 0
545
+ }), /* @__PURE__ */ T(J, {
546
+ bordered: f,
547
+ dense: p,
548
+ isLoading: u,
549
+ error: d,
550
+ colSpanCount: G,
551
+ noDataMessage: h,
552
+ paginatedData: K,
553
+ getRowId: n,
554
+ onRowClick: r,
555
+ onRowNavigate: i,
556
+ hasBulkActions: U,
557
+ selectedRows: M,
558
+ toggleRowSelection: ae,
559
+ visibleColumnsArray: W,
560
+ columnWidths: F,
561
+ hasActions: H || l,
562
+ actions: a,
563
+ columns: t,
564
+ resizableColumns: c,
565
+ fixedColumns: de
566
+ })]
567
+ })
568
+ }), /* @__PURE__ */ T(ne, {
569
+ totalItems: v ?? e.length,
570
+ startIndex: R,
571
+ endIndex: B,
572
+ pageSize: se,
573
+ setPageSize: ce,
574
+ currentPage: I,
575
+ setCurrentPage: le,
576
+ pageSizeOptions: _,
577
+ totalPages: L
578
+ })]
579
+ })]
580
+ });
581
+ }
582
+ //#endregion
583
+ //#region src/components/core/table/JsonTableOutput.tsx
584
+ var ae = ({ header: r, output: i }) => {
585
+ let [a, o] = C(!0), u = D(i), d = u !== null, m = (e) => typeof e == "object" && e ? JSON.stringify(e, null, 2) : String(e ?? ""), h = () => /* @__PURE__ */ E("div", {
586
+ className: "flex items-center justify-between mb-2",
587
+ children: [/* @__PURE__ */ T("span", {
588
+ className: "font-medium text-sm",
589
+ children: r
590
+ }), /* @__PURE__ */ E("div", {
591
+ className: "flex items-center gap-2",
592
+ children: [/* @__PURE__ */ T(p, {
593
+ id: "table-mode",
594
+ checked: a,
595
+ onCheckedChange: o
596
+ }), /* @__PURE__ */ T(e, {
597
+ htmlFor: "table-mode",
598
+ className: "text-xs",
599
+ children: "Mode tableau"
600
+ })]
601
+ })]
602
+ }), g = ({ children: e }) => /* @__PURE__ */ T("div", {
603
+ className: "border rounded min-w-0 w-full",
604
+ children: /* @__PURE__ */ T(c, { children: e })
605
+ }), _ = () => /* @__PURE__ */ T("pre", {
606
+ className: "text-xs bg-muted p-4 rounded overflow-x-auto whitespace-pre-wrap",
607
+ children: d && !a ? JSON.stringify(u, null, 2) : i
608
+ });
609
+ return i ? /* @__PURE__ */ E("div", {
610
+ className: "min-w-0 w-full",
611
+ children: [h(), (() => {
612
+ if (!d || !a) return /* @__PURE__ */ T(_, {});
613
+ if (Array.isArray(u) && u.length > 0 && typeof u[0] == "object") {
614
+ let e = Object.keys(u[0]);
615
+ return /* @__PURE__ */ E(g, { children: [/* @__PURE__ */ T(s, { children: /* @__PURE__ */ T(f, { children: e.map((e) => /* @__PURE__ */ T(n, {
616
+ className: "font-medium",
617
+ children: e
618
+ }, e)) }) }), /* @__PURE__ */ T(t, { children: u.map((t, n) => /* @__PURE__ */ T(f, { children: e.map((e) => /* @__PURE__ */ T(l, {
619
+ className: "text-sm whitespace-pre-wrap",
620
+ children: m(t[e])
621
+ }, e)) }, n)) })] });
622
+ }
623
+ if (typeof u == "object" && u) {
624
+ let e = Object.entries(u);
625
+ return /* @__PURE__ */ E(g, { children: [/* @__PURE__ */ T(s, { children: /* @__PURE__ */ E(f, { children: [/* @__PURE__ */ T(n, {
626
+ className: "font-medium",
627
+ children: "Propriété"
628
+ }), /* @__PURE__ */ T(n, {
629
+ className: "font-medium",
630
+ children: "Valeur"
631
+ })] }) }), /* @__PURE__ */ T(t, { children: e.map(([e, t]) => /* @__PURE__ */ E(f, { children: [/* @__PURE__ */ T(l, {
632
+ className: "font-medium text-sm",
633
+ children: e
634
+ }), /* @__PURE__ */ T(l, {
635
+ className: "text-sm whitespace-pre-wrap",
636
+ children: m(t)
637
+ })] }, e)) })] });
638
+ }
639
+ return /* @__PURE__ */ T(_, {});
640
+ })()]
641
+ }) : null;
642
+ };
643
+ //#endregion
644
+ export { Z as a, G as c, U as d, H as f, ne as i, W as l, ie as n, Y as o, B as p, re as r, J as s, ae as t, q as u };
@@ -1,7 +1,7 @@
1
1
  import { i as e, n as t, r as n, s as r, t as i } from "./tooltip-B2dzyfs9.js";
2
- import { t as a } from "./i18n-Dw99bRmg.js";
2
+ import { t as a } from "./i18n-DW5zKBEK.js";
3
3
  import { i as o, l as s, n as c, t as l, u } from "./select-ULiTPOr5.js";
4
- import { t as d } from "./useTheme-DVfcJ-Qd.js";
4
+ import { t as d } from "./useTheme-D1APOG9I.js";
5
5
  import "react";
6
6
  import { jsx as f, jsxs as p } from "react/jsx-runtime";
7
7
  //#region src/components/core/theme/ThemeSelector.tsx