@krosoft/react 0.0.253 → 0.0.255

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 (32) hide show
  1. package/dist/{AppActions-BMq9aQrB.js → AppActions-DyKuUO4k.js} +1 -1
  2. package/dist/{AppSubTitle-DIQetGjl.js → AppSubTitle-CSQOqzlF.js} +1 -1
  3. package/dist/{GenericForm-D1TP41Gp.js → GenericForm-C0Hxh84y.js} +4 -4
  4. package/dist/{ImageInput-DnoBhP4X.js → ImageInput-D8bv_faw.js} +1 -1
  5. package/dist/{MultiSelect-O9AljNco.js → MultiSelect-6vCPLMY8.js} +1 -1
  6. package/dist/{SearchInput-BEqCjP6R.js → SearchInput-DlLexldF.js} +1 -1
  7. package/dist/{cards-3sbUuHR0.js → cards-CV5w_mHL.js} +1 -1
  8. package/dist/components/core/cards/index.js +1 -1
  9. package/dist/components/core/dialogs/index.js +2 -2
  10. package/dist/components/core/filters/index.js +3 -3
  11. package/dist/components/core/forms/index.js +1 -1
  12. package/dist/components/core/index.js +13 -13
  13. package/dist/components/core/inputs/index.js +3 -3
  14. package/dist/components/core/layouts/index.js +4 -4
  15. package/dist/components/core/table/JsonTableOutput.d.ts +8 -0
  16. package/dist/components/core/table/JsonTableOutput.d.ts.map +1 -0
  17. package/dist/components/core/table/TableBody.d.ts +1 -1
  18. package/dist/components/core/table/TableBody.d.ts.map +1 -1
  19. package/dist/components/core/table/TableHeader.d.ts.map +1 -1
  20. package/dist/components/core/table/index.d.ts +1 -0
  21. package/dist/components/core/table/index.d.ts.map +1 -1
  22. package/dist/components/core/table/index.js +2 -2
  23. package/dist/components/core/tabs/index.js +2 -2
  24. package/dist/components/index.js +13 -13
  25. package/dist/components/ui/index.js +1 -1
  26. package/dist/components/ui/tabs.d.ts +14 -3
  27. package/dist/components/ui/tabs.d.ts.map +1 -1
  28. package/dist/{dialogs-CVA3y-o4.js → dialogs-CnBaE0-1.js} +2 -2
  29. package/dist/table-C56FL-qc.js +644 -0
  30. package/dist/{ui-hvA1osvS.js → ui-CvuDSRPw.js} +56 -38
  31. package/package.json +1 -1
  32. package/dist/table-BGKIqR2y.js +0 -582
@@ -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-CvuDSRPw.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 ee, SettingsIcon as te } from "lucide-react";
10
+ import { useNavigate as ne } from "react-router-dom";
11
+ //#region src/constants/datatable.ts
12
+ var I = [
13
+ 5,
14
+ 10,
15
+ 30,
16
+ 50,
17
+ 100
18
+ ], re = I[1];
19
+ //#endregion
20
+ //#region src/components/core/table/TableActions.tsx
21
+ function L({ 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(ee, { 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 R = {
72
+ left: "text-left",
73
+ center: "text-center",
74
+ right: "text-right"
75
+ };
76
+ function z(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 B(e) {
82
+ return R[e];
83
+ }
84
+ //#endregion
85
+ //#region src/components/core/table/fixedColumns.ts
86
+ var V = "__selection__", H = "__actions__", U = {
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 W(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 ? U[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 G({ 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 = ne(), 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 = W(x[V], "body"), k = W(x[H], "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 = W(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"} ${B(z(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(L, {
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 K({ 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 q = {
272
+ left: "justify-start",
273
+ center: "justify-center",
274
+ right: "justify-end"
275
+ };
276
+ function J({ 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 = W(b[t.key], "header"), u = z(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
+ B(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 ${q[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 = W(b[V], "header"), M = W(b[H], "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": V,
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": H,
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 Y = "…";
368
+ function X(e, t) {
369
+ return Array.from({ length: t - e + 1 }, (t, n) => e + n);
370
+ }
371
+ function ie(e, t, n = 1) {
372
+ if (n * 2 + 5 >= t) return X(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
+ ...X(1, n + 2),
376
+ Y,
377
+ t
378
+ ] : a && !o ? [
379
+ 1,
380
+ Y,
381
+ ...X(t - (n + 2) + 1, t)
382
+ ] : [
383
+ 1,
384
+ Y,
385
+ ...X(r, i),
386
+ Y,
387
+ t
388
+ ];
389
+ }
390
+ function Z({ totalItems: e, startIndex: t, endIndex: n, pageSize: r, setPageSize: i, currentPage: a, setCurrentPage: o, pageSizeOptions: s, totalPages: c }) {
391
+ let { t: l } = h(), u = ie(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 === Y ? /* @__PURE__ */ T("span", {
418
+ className: "flex h-8 w-8 items-center justify-center text-sm text-muted-foreground",
419
+ children: Y
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 ae({ 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(te, { 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 oe({ 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 = re, pageSizeOptions: _ = I, 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: ee, totalPages: te, startIndex: ne, endIndex: L, tableRef: R, hasActions: z, hasBulkActions: B, visibleColumnsArray: V, colSpanCount: H, paginatedData: U, handleSort: W, handleMouseDown: q, handleDragStart: Y, handleDragOver: X, handleDrop: ie, toggleColumnVisibility: oe, toggleRowSelection: Q, toggleSelectAll: $, 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 = B && V.some((e) => e.fixed === "left"), de = S(R);
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(K, {
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: R,
517
+ className: "w-full",
518
+ children: [/* @__PURE__ */ T(J, {
519
+ hasBulkActions: B,
520
+ selectedRows: M,
521
+ totalItems: e.length,
522
+ toggleSelectAll: $,
523
+ visibleColumnsArray: V,
524
+ draggableColumns: s,
525
+ resizableColumns: c,
526
+ columnWidths: F,
527
+ sortColumn: A,
528
+ sortDirection: j,
529
+ handleSort: W,
530
+ handleDragStart: Y,
531
+ handleDragOver: X,
532
+ handleDrop: ie,
533
+ handleMouseDown: q,
534
+ hasActions: z,
535
+ bordered: f,
536
+ dense: p,
537
+ fixedColumns: de,
538
+ fixedSelection: ue,
539
+ fixedActions: m,
540
+ settingsNode: l ? /* @__PURE__ */ T(ae, {
541
+ columns: t,
542
+ visibleColumns: P,
543
+ toggleColumnVisibility: oe
544
+ }) : void 0
545
+ }), /* @__PURE__ */ T(G, {
546
+ bordered: f,
547
+ dense: p,
548
+ isLoading: u,
549
+ error: d,
550
+ colSpanCount: H,
551
+ noDataMessage: h,
552
+ paginatedData: U,
553
+ getRowId: n,
554
+ onRowClick: r,
555
+ onRowNavigate: i,
556
+ hasBulkActions: B,
557
+ selectedRows: M,
558
+ toggleRowSelection: Q,
559
+ visibleColumnsArray: V,
560
+ columnWidths: F,
561
+ hasActions: z || l,
562
+ actions: a,
563
+ columns: t,
564
+ resizableColumns: c,
565
+ fixedColumns: de
566
+ })]
567
+ })
568
+ }), /* @__PURE__ */ T(Z, {
569
+ totalItems: v ?? e.length,
570
+ startIndex: ne,
571
+ endIndex: L,
572
+ pageSize: se,
573
+ setPageSize: ce,
574
+ currentPage: ee,
575
+ setCurrentPage: le,
576
+ pageSizeOptions: _,
577
+ totalPages: te
578
+ })]
579
+ })]
580
+ });
581
+ }
582
+ //#endregion
583
+ //#region src/components/core/table/JsonTableOutput.tsx
584
+ var Q = (e) => typeof e == "object" && !!e, $ = (e) => e == null ? "" : typeof e == "string" ? e : typeof e == "number" || typeof e == "boolean" ? String(e) : JSON.stringify(e, null, 2), se = ({ header: r, output: i }) => {
585
+ let [a, o] = C(!0), u = D(i), d = u !== null, m = () => /* @__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
+ }), h = ({ children: e }) => /* @__PURE__ */ T("div", {
603
+ className: "border rounded min-w-0 w-full",
604
+ children: /* @__PURE__ */ T(c, { children: e })
605
+ }), g = () => /* @__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: [m(), (() => {
612
+ if (!d || !a) return /* @__PURE__ */ T(g, {});
613
+ if (Array.isArray(u) && u.length > 0 && Q(u[0])) {
614
+ let e = u, r = Object.keys(e[0]);
615
+ return /* @__PURE__ */ E(h, { children: [/* @__PURE__ */ T(s, { children: /* @__PURE__ */ T(f, { children: r.map((e) => /* @__PURE__ */ T(n, {
616
+ className: "font-medium",
617
+ children: e
618
+ }, e)) }) }), /* @__PURE__ */ T(t, { children: e.map((e, t) => /* @__PURE__ */ T(f, { children: r.map((t) => /* @__PURE__ */ T(l, {
619
+ className: "text-sm whitespace-pre-wrap",
620
+ children: $(e[t])
621
+ }, t)) }, t)) })] });
622
+ }
623
+ if (Q(u)) {
624
+ let e = Object.entries(u);
625
+ return /* @__PURE__ */ E(h, { 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: $(t)
637
+ })] }, e)) })] });
638
+ }
639
+ return /* @__PURE__ */ T(g, {});
640
+ })()]
641
+ }) : null;
642
+ };
643
+ //#endregion
644
+ export { J as a, H as c, B as d, z as f, Z as i, V as l, oe as n, K as o, L as p, ae as r, G as s, se as t, W as u };