@krosoft/react 0.0.162 → 0.0.163

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,506 @@
1
+ import { jsxs as t, jsx as e } from "react/jsx-runtime";
2
+ import { u as ae } from "./useDataTable-CxcA5S-s.js";
3
+ import { ay as P, aM as $, aA as W, aC as se, $ as B, az as ie } from "./toggle-group-BASGy2mQ.js";
4
+ import "./alert-B78CiTYe.js";
5
+ import "@radix-ui/react-aspect-ratio";
6
+ import { B as y } from "./tooltip-BWyFpIxo.js";
7
+ import "@radix-ui/react-collapsible";
8
+ import "./sheet-Gop1cIaU.js";
9
+ import { MoreVerticalIcon as ne, Loader2Icon as le, GripVerticalIcon as de, ArrowUpIcon as oe, ArrowDownIcon as ce, ArrowUpDownIcon as me, ChevronLeftIcon as he, ChevronRightIcon as ge, SettingsIcon as ue } from "lucide-react";
10
+ import "react-resizable-panels";
11
+ import "clsx";
12
+ import "tailwind-merge";
13
+ import "./select-MWzbMBAS.js";
14
+ import "next-themes";
15
+ import "sonner";
16
+ import "react";
17
+ const L = [5, 10, 30, 50, 100], pe = L[1];
18
+ function fe({ actions: d, row: a }) {
19
+ const o = d.filter((r) => r.visible === void 0 || r.visible(a));
20
+ if (o.length === 0)
21
+ return null;
22
+ const s = o.filter((r) => r.overflow !== !0), m = o.filter((r) => r.overflow === !0);
23
+ return /* @__PURE__ */ t("div", { className: "flex items-center justify-center gap-1", children: [
24
+ s.map((r, h) => {
25
+ var c;
26
+ const g = r.icon;
27
+ return /* @__PURE__ */ t(
28
+ y,
29
+ {
30
+ variant: r.variant ?? "ghost",
31
+ size: "sm",
32
+ disabled: ((c = r.disabled) == null ? void 0 : c.call(r, a)) ?? !1,
33
+ className: `h-7 px-2 text-muted-foreground hover:text-foreground ${r.className ?? ""}`,
34
+ onClick: (n) => {
35
+ n.stopPropagation(), r.onClick(a);
36
+ },
37
+ children: [
38
+ g !== void 0 && /* @__PURE__ */ e(g, { className: "size-3.5" }),
39
+ r.label
40
+ ]
41
+ },
42
+ h
43
+ );
44
+ }),
45
+ m.length > 0 && /* @__PURE__ */ t(P, { children: [
46
+ /* @__PURE__ */ e($, { asChild: !0, children: /* @__PURE__ */ e(y, { variant: "ghost", size: "icon", className: "h-7 w-7 text-muted-foreground hover:text-foreground", children: /* @__PURE__ */ e(ne, { className: "size-3.5" }) }) }),
47
+ /* @__PURE__ */ e(
48
+ W,
49
+ {
50
+ align: "end",
51
+ onClick: (r) => {
52
+ r.stopPropagation();
53
+ },
54
+ children: m.map((r, h) => {
55
+ var c;
56
+ const g = r.icon;
57
+ return /* @__PURE__ */ t(
58
+ se,
59
+ {
60
+ disabled: ((c = r.disabled) == null ? void 0 : c.call(r, a)) ?? !1,
61
+ onClick: () => {
62
+ r.onClick(a);
63
+ },
64
+ className: r.className,
65
+ children: [
66
+ g !== void 0 && /* @__PURE__ */ e("span", { className: "mr-2 size-4 flex items-center justify-center", children: /* @__PURE__ */ e(g, { className: "size-4" }) }),
67
+ r.label
68
+ ]
69
+ },
70
+ h
71
+ );
72
+ })
73
+ }
74
+ )
75
+ ] })
76
+ ] });
77
+ }
78
+ function xe({
79
+ isLoading: d,
80
+ colSpanCount: a,
81
+ noDataMessage: o,
82
+ paginatedData: s,
83
+ getRowId: m,
84
+ onRowClick: r,
85
+ hasBulkActions: h,
86
+ selectedRows: g,
87
+ toggleRowSelection: c,
88
+ visibleColumnsArray: n,
89
+ columnWidths: N,
90
+ hasActions: z,
91
+ actions: v,
92
+ columns: w,
93
+ bordered: k = !1
94
+ }) {
95
+ const D = (u, p) => {
96
+ const i = w.find((b) => b.key === p);
97
+ if ((i == null ? void 0 : i.renderCell) !== void 0)
98
+ return i.renderCell(u);
99
+ const x = u[p];
100
+ return /* @__PURE__ */ e("span", { className: "text-sm truncate", children: x != null ? String(x) : "-" });
101
+ };
102
+ return d ? /* @__PURE__ */ e("tbody", { className: "divide-y divide-gray-200 dark:divide-gray-800", children: /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: a, className: "py-8 text-center", children: /* @__PURE__ */ t("div", { className: "flex flex-col items-center justify-center gap-2 text-muted-foreground", children: [
103
+ /* @__PURE__ */ e(le, { className: "h-6 w-6 animate-spin text-primary" }),
104
+ /* @__PURE__ */ e("span", { className: "text-sm", children: "Chargement..." })
105
+ ] }) }) }) }) : s.length === 0 ? /* @__PURE__ */ e("tbody", { className: "divide-y divide-gray-200 dark:divide-gray-800", children: /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: a, className: "py-8 text-center text-sm text-muted-foreground", children: o }) }) }) : /* @__PURE__ */ e("tbody", { className: "divide-y divide-gray-200 dark:divide-gray-800", children: s.map((u) => {
106
+ const p = m(u);
107
+ return /* @__PURE__ */ t(
108
+ "tr",
109
+ {
110
+ className: `group hover:bg-muted/50 dark:hover:bg-gray-900/50 transition-colors ${r !== void 0 ? "cursor-pointer" : ""}`,
111
+ onClick: () => r == null ? void 0 : r(u),
112
+ children: [
113
+ h ? /* @__PURE__ */ e(
114
+ "td",
115
+ {
116
+ className: "p-1 text-center align-middle",
117
+ style: { width: "32px", minWidth: "32px", maxWidth: "32px" },
118
+ onClick: (i) => {
119
+ i.stopPropagation();
120
+ },
121
+ children: /* @__PURE__ */ e("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ e(
122
+ B,
123
+ {
124
+ checked: g.includes(p),
125
+ onCheckedChange: () => {
126
+ c(p);
127
+ }
128
+ }
129
+ ) })
130
+ }
131
+ ) : null,
132
+ n.map((i, x) => {
133
+ const b = x === n.length - 1;
134
+ return /* @__PURE__ */ e(
135
+ "td",
136
+ {
137
+ className: `px-2 py-2 relative ${k && !b ? "border-r border-gray-100 dark:border-gray-800" : ""} ${i.className ?? ""}`,
138
+ style: { width: N[i.key] },
139
+ children: /* @__PURE__ */ e("div", { className: "w-full h-full", children: D(u, i.key) })
140
+ },
141
+ i.key
142
+ );
143
+ }),
144
+ z ? /* @__PURE__ */ e(
145
+ "td",
146
+ {
147
+ className: "p-1 text-center align-middle whitespace-nowrap",
148
+ style: { minWidth: "32px" },
149
+ onClick: (i) => {
150
+ i.stopPropagation();
151
+ },
152
+ children: v !== void 0 && v.length > 0 ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ e(fe, { actions: v, row: u }) }) : null
153
+ }
154
+ ) : null
155
+ ]
156
+ },
157
+ p
158
+ );
159
+ }) });
160
+ }
161
+ function ve({ selectedRows: d, setSelectedRows: a, bulkActions: o }) {
162
+ return /* @__PURE__ */ t("div", { className: "bg-muted/60 dark:bg-gray-900/60 border border-border px-3 py-1.5 flex items-center justify-between rounded-lg", children: [
163
+ /* @__PURE__ */ t("div", { className: "flex items-center gap-4", children: [
164
+ /* @__PURE__ */ t("span", { className: "text-sm font-medium text-primary ml-1", children: [
165
+ d.length,
166
+ " sélectionné(s)"
167
+ ] }),
168
+ /* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: o.map((s, m) => {
169
+ const r = s.icon;
170
+ return /* @__PURE__ */ t(
171
+ y,
172
+ {
173
+ variant: "outline",
174
+ size: "sm",
175
+ onClick: () => {
176
+ s.onClick(d, () => {
177
+ a([]);
178
+ });
179
+ },
180
+ className: `h-7 bg-background shadow-sm text-xs px-2.5 ${s.variant === "destructive" ? "text-destructive border-destructive/30 hover:bg-destructive/10 hover:text-destructive" : "text-foreground"}`,
181
+ children: [
182
+ r !== void 0 && /* @__PURE__ */ e("span", { className: "mr-1.5 flex items-center justify-center", children: /* @__PURE__ */ e(r, { className: "h-3.5 w-3.5" }) }),
183
+ s.label
184
+ ]
185
+ },
186
+ m
187
+ );
188
+ }) })
189
+ ] }),
190
+ /* @__PURE__ */ e(
191
+ y,
192
+ {
193
+ variant: "ghost",
194
+ size: "sm",
195
+ onClick: () => {
196
+ a([]);
197
+ },
198
+ className: "text-xs text-muted-foreground hover:text-foreground h-7 px-2",
199
+ children: "Désélectionner"
200
+ }
201
+ )
202
+ ] });
203
+ }
204
+ function be({
205
+ hasBulkActions: d,
206
+ selectedRows: a,
207
+ totalItems: o,
208
+ toggleSelectAll: s,
209
+ visibleColumnsArray: m,
210
+ draggableColumns: r,
211
+ resizableColumns: h,
212
+ columnWidths: g,
213
+ sortColumn: c,
214
+ sortDirection: n,
215
+ handleSort: N,
216
+ handleDragStart: z,
217
+ handleDragOver: v,
218
+ handleDrop: w,
219
+ handleMouseDown: k,
220
+ hasActions: D,
221
+ settingsNode: u,
222
+ bordered: p = !1
223
+ }) {
224
+ let i = !1;
225
+ a.length === o && o > 0 ? i = !0 : a.length > 0 && (i = "indeterminate");
226
+ const x = (l) => l.sortable !== !0 ? null : c === l.key ? n === "asc" ? /* @__PURE__ */ e(oe, { className: "size-3.5 text-foreground" }) : /* @__PURE__ */ e(ce, { className: "size-3.5 text-foreground" }) : /* @__PURE__ */ e(me, { className: "size-3.5 text-muted-foreground/50 group-hover:text-muted-foreground transition-colors" }), b = (l, I) => {
227
+ const S = I !== !1, C = l.sortable === !0;
228
+ return /* @__PURE__ */ t(
229
+ "th",
230
+ {
231
+ className: [
232
+ "px-2 py-2 text-left text-sm font-medium text-gray-900 dark:text-gray-100 relative group",
233
+ p ? "border-r border-gray-200 dark:border-gray-800" : "",
234
+ C ? "cursor-pointer select-none" : "",
235
+ l.className ?? ""
236
+ ].filter(Boolean).join(" "),
237
+ style: { width: g[l.key] },
238
+ draggable: S,
239
+ onClick: () => {
240
+ N(l.key);
241
+ },
242
+ onDragStart: (f) => {
243
+ S ? z(f, l.key) : f.preventDefault();
244
+ },
245
+ onDragOver: (f) => {
246
+ v(f, l.key);
247
+ },
248
+ onDrop: (f) => {
249
+ w(f, l.key);
250
+ },
251
+ children: [
252
+ /* @__PURE__ */ t("div", { className: "flex items-center justify-between pr-2", children: [
253
+ /* @__PURE__ */ t("div", { className: "flex items-center gap-1", children: [
254
+ S ? /* @__PURE__ */ e(de, { className: "size-4 text-gray-400 cursor-grab dark:text-gray-300 shrink-0" }) : null,
255
+ /* @__PURE__ */ e("span", { className: "truncate", children: l.label })
256
+ ] }),
257
+ /* @__PURE__ */ e("div", { className: "ml-1 shrink-0", children: x(l) })
258
+ ] }),
259
+ h ? /* @__PURE__ */ e(
260
+ "div",
261
+ {
262
+ 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",
263
+ onMouseDown: (f) => {
264
+ k(f, l.key);
265
+ }
266
+ }
267
+ ) : null
268
+ ]
269
+ },
270
+ l.key
271
+ );
272
+ };
273
+ return /* @__PURE__ */ e("thead", { className: "bg-muted/50 dark:bg-gray-900/50 border-b border-gray-200 dark:border-gray-800", children: /* @__PURE__ */ t("tr", { children: [
274
+ d ? /* @__PURE__ */ e("th", { className: "p-1 flex-shrink-0 text-center align-middle", style: { width: "32px", minWidth: "32px", maxWidth: "32px" }, children: /* @__PURE__ */ e("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ e(B, { checked: i, onCheckedChange: s }) }) }) : null,
275
+ m.map((l) => b(l, r)),
276
+ D || u !== void 0 ? /* @__PURE__ */ e("th", { className: "p-1 text-center align-middle", style: { minWidth: "32px" }, children: u }) : null
277
+ ] }) });
278
+ }
279
+ function ye({
280
+ totalItems: d,
281
+ startIndex: a,
282
+ endIndex: o,
283
+ pageSize: s,
284
+ setPageSize: m,
285
+ currentPage: r,
286
+ setCurrentPage: h,
287
+ pageSizeOptions: g,
288
+ totalPages: c
289
+ }) {
290
+ return /* @__PURE__ */ t("div", { className: "px-4 py-2 border-t border-gray-200 dark:border-gray-800 flex items-center justify-between bg-muted/50 dark:bg-gray-900/50 flex-wrap gap-2", children: [
291
+ /* @__PURE__ */ t("div", { className: "text-sm text-muted-foreground", children: [
292
+ d === 0 ? "0" : `${String(a + 1)} - ${String(o)}`,
293
+ " sur ",
294
+ d
295
+ ] }),
296
+ /* @__PURE__ */ t("div", { className: "flex items-center gap-4", children: [
297
+ /* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: [
298
+ /* @__PURE__ */ e("span", { className: "text-sm text-muted-foreground", children: "Lignes par page :" }),
299
+ /* @__PURE__ */ e(
300
+ "select",
301
+ {
302
+ value: s,
303
+ onChange: (n) => {
304
+ m(Number(n.target.value)), h(1);
305
+ },
306
+ className: "border border-input bg-background rounded px-2 py-1 text-sm text-foreground",
307
+ children: g.map((n) => /* @__PURE__ */ e("option", { value: n, children: n }, n))
308
+ }
309
+ )
310
+ ] }),
311
+ /* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: [
312
+ /* @__PURE__ */ e(
313
+ y,
314
+ {
315
+ variant: "outline",
316
+ size: "sm",
317
+ className: "h-8 w-8 p-0",
318
+ onClick: () => {
319
+ h((n) => Math.max(1, n - 1));
320
+ },
321
+ disabled: r === 1,
322
+ children: /* @__PURE__ */ e(he, { className: "size-4" })
323
+ }
324
+ ),
325
+ /* @__PURE__ */ t("span", { className: "text-sm text-muted-foreground", children: [
326
+ "Page ",
327
+ r,
328
+ " sur ",
329
+ c
330
+ ] }),
331
+ /* @__PURE__ */ e(
332
+ y,
333
+ {
334
+ variant: "outline",
335
+ size: "sm",
336
+ className: "h-8 w-8 p-0",
337
+ onClick: () => {
338
+ h((n) => Math.min(c, n + 1));
339
+ },
340
+ disabled: r === c,
341
+ children: /* @__PURE__ */ e(ge, { className: "size-4" })
342
+ }
343
+ )
344
+ ] })
345
+ ] })
346
+ ] });
347
+ }
348
+ function Ne({ columns: d, visibleColumns: a, toggleColumnVisibility: o }) {
349
+ return /* @__PURE__ */ t(P, { children: [
350
+ /* @__PURE__ */ e($, { asChild: !0, children: /* @__PURE__ */ e(y, { variant: "outline", size: "sm", className: "size-7 p-0 bg-white hover:bg-gray-100 dark:bg-gray-900 shadow-sm border-gray-200 dark:border-gray-800", children: /* @__PURE__ */ e(ue, { className: "size-3.5 text-gray-600 dark:text-gray-300" }) }) }),
351
+ /* @__PURE__ */ e(W, { align: "end", className: "w-56", children: d.map((s) => /* @__PURE__ */ e(
352
+ ie,
353
+ {
354
+ checked: a.has(s.key),
355
+ onCheckedChange: () => {
356
+ o(s.key);
357
+ },
358
+ children: s.label
359
+ },
360
+ s.key
361
+ )) })
362
+ ] });
363
+ }
364
+ function He({
365
+ data: d,
366
+ columns: a,
367
+ getRowId: o,
368
+ onRowClick: s,
369
+ actions: m,
370
+ bulkActions: r,
371
+ draggableColumns: h = !1,
372
+ resizableColumns: g = !1,
373
+ columnVisibility: c = !1,
374
+ isLoading: n = !1,
375
+ bordered: N = !1,
376
+ noDataMessage: z = "Aucun résultat",
377
+ defaultPageSize: v = pe,
378
+ pageSizeOptions: w = L,
379
+ totalRows: k,
380
+ currentPage: D,
381
+ pageSize: u,
382
+ onPageChange: p,
383
+ onPageSizeChange: i,
384
+ sortColumn: x,
385
+ sortDirection: b,
386
+ onSortChange: l
387
+ }) {
388
+ const {
389
+ sortColumn: I,
390
+ sortDirection: S,
391
+ selectedRows: C,
392
+ setSelectedRows: f,
393
+ visibleColumns: H,
394
+ columnWidths: j,
395
+ safeCurrentPage: O,
396
+ totalPages: U,
397
+ startIndex: V,
398
+ endIndex: G,
399
+ tableRef: q,
400
+ hasActions: A,
401
+ hasBulkActions: M,
402
+ visibleColumnsArray: T,
403
+ colSpanCount: E,
404
+ paginatedData: F,
405
+ handleSort: J,
406
+ handleMouseDown: Q,
407
+ handleDragStart: X,
408
+ handleDragOver: Y,
409
+ handleDrop: Z,
410
+ toggleColumnVisibility: _,
411
+ toggleRowSelection: K,
412
+ toggleSelectAll: R,
413
+ pageSize: ee,
414
+ setPageSize: re,
415
+ setCurrentPage: te
416
+ } = ae({
417
+ data: d,
418
+ columns: a,
419
+ getRowId: o,
420
+ defaultPageSize: v,
421
+ actions: m,
422
+ bulkActions: r,
423
+ columnVisibility: c,
424
+ totalRows: k,
425
+ currentPage: D,
426
+ pageSize: u,
427
+ onPageChange: p,
428
+ onPageSizeChange: i,
429
+ sortColumn: x,
430
+ sortDirection: b,
431
+ onSortChange: l
432
+ });
433
+ return /* @__PURE__ */ t("div", { className: "space-y-4", children: [
434
+ C.length > 0 && r !== void 0 && r.length > 0 && /* @__PURE__ */ e(ve, { selectedRows: C, setSelectedRows: f, bulkActions: r }),
435
+ /* @__PURE__ */ t("div", { className: "w-full bg-card dark:bg-gray-950 rounded-md border border-gray-200 dark:border-gray-800 overflow-hidden", children: [
436
+ /* @__PURE__ */ e("div", { className: "overflow-x-auto", children: /* @__PURE__ */ t("table", { ref: q, className: "w-full", children: [
437
+ /* @__PURE__ */ e(
438
+ be,
439
+ {
440
+ hasBulkActions: M,
441
+ selectedRows: C,
442
+ totalItems: d.length,
443
+ toggleSelectAll: R,
444
+ visibleColumnsArray: T,
445
+ draggableColumns: h,
446
+ resizableColumns: g,
447
+ columnWidths: j,
448
+ sortColumn: I,
449
+ sortDirection: S,
450
+ handleSort: J,
451
+ handleDragStart: X,
452
+ handleDragOver: Y,
453
+ handleDrop: Z,
454
+ handleMouseDown: Q,
455
+ hasActions: A,
456
+ bordered: N,
457
+ settingsNode: c ? /* @__PURE__ */ e(Ne, { columns: a, visibleColumns: H, toggleColumnVisibility: _ }) : void 0
458
+ }
459
+ ),
460
+ /* @__PURE__ */ e(
461
+ xe,
462
+ {
463
+ bordered: N,
464
+ isLoading: n,
465
+ colSpanCount: E,
466
+ noDataMessage: z,
467
+ paginatedData: F,
468
+ getRowId: o,
469
+ onRowClick: s,
470
+ hasBulkActions: M,
471
+ selectedRows: C,
472
+ toggleRowSelection: K,
473
+ visibleColumnsArray: T,
474
+ columnWidths: j,
475
+ hasActions: A || c,
476
+ actions: m,
477
+ columns: a
478
+ }
479
+ )
480
+ ] }) }),
481
+ /* @__PURE__ */ e(
482
+ ye,
483
+ {
484
+ totalItems: k ?? d.length,
485
+ startIndex: V,
486
+ endIndex: G,
487
+ pageSize: ee,
488
+ setPageSize: re,
489
+ currentPage: O,
490
+ setCurrentPage: te,
491
+ pageSizeOptions: w,
492
+ totalPages: U
493
+ }
494
+ )
495
+ ] })
496
+ ] });
497
+ }
498
+ export {
499
+ He as D,
500
+ fe as T,
501
+ xe as a,
502
+ ve as b,
503
+ be as c,
504
+ ye as d,
505
+ Ne as e
506
+ };
@@ -15,7 +15,7 @@ import { S as _, a as $, b as aa, T as ea } from "../../Topbar-DMyjbOTI.js";
15
15
  import { E as oa } from "../../ErrorAlert-DH1onuyt.js";
16
16
  import { E as ta } from "../../ErrorState-vU8d4CwD.js";
17
17
  import { L as la } from "../../LoadingState-BN0YaPSs.js";
18
- import { D as ba, T as ma, a as da, b as ga, c as fa, d as Aa, e as Da } from "../../DataTable-DJM7KWWK.js";
18
+ import { D as ba, T as ma, a as da, b as ga, c as fa, d as Aa, e as Da } from "../../DataTable-CSupYrnN.js";
19
19
  import { A as na, a as ca, b as xa, c as Sa } from "../../AppVerticalTabs-NZ02HPGP.js";
20
20
  import { T as Fa } from "../../ThemeSelector-CQ3fSDJ2.js";
21
21
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"DataTable.d.ts","sourceRoot":"","sources":["../../../../src/components/core/table/DataTable.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAOvE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEvE,MAAM,WAAW,cAAc,CAAC,CAAC;IAC/B,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;IACxB,QAAQ,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,MAAM,CAAC;IAC7B,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC;IAC9B,OAAO,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;IACzB,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAC3B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAG3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAG9C,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,aAAa,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAC/B,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,SAAS,EAAE,KAAK,GAAG,MAAM,KAAK,IAAI,CAAC;CAC3E;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,EAC3B,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,UAAU,EACV,OAAO,EACP,WAAW,EACX,gBAAwB,EACxB,gBAAwB,EACxB,gBAAwB,EACxB,SAAiB,EACjB,QAAgB,EAChB,aAAgC,EAChC,eAAmC,EACnC,eAA2C,EAC3C,SAAS,EACT,WAAW,EACX,QAAQ,EAAE,kBAAkB,EAC5B,YAAY,EACZ,gBAAgB,EAChB,UAAU,EAAE,oBAAoB,EAChC,aAAa,EAAE,uBAAuB,EACtC,YAAY,GACb,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAkHvC"}
1
+ {"version":3,"file":"DataTable.d.ts","sourceRoot":"","sources":["../../../../src/components/core/table/DataTable.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAMvE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEvE,MAAM,WAAW,cAAc,CAAC,CAAC;IAC/B,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;IACxB,QAAQ,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,MAAM,CAAC;IAC7B,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC;IAC9B,OAAO,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;IACzB,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAC3B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAG3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAG9C,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,aAAa,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAC/B,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,SAAS,EAAE,KAAK,GAAG,MAAM,KAAK,IAAI,CAAC;CAC3E;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,EAC3B,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,UAAU,EACV,OAAO,EACP,WAAW,EACX,gBAAwB,EACxB,gBAAwB,EACxB,gBAAwB,EACxB,SAAiB,EACjB,QAAgB,EAChB,aAAgC,EAChC,eAAmC,EACnC,eAA2C,EAC3C,SAAS,EACT,WAAW,EACX,QAAQ,EAAE,kBAAkB,EAC5B,YAAY,EACZ,gBAAgB,EAChB,UAAU,EAAE,oBAAoB,EAChC,aAAa,EAAE,uBAAuB,EACtC,YAAY,GACb,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAkHvC"}
@@ -4,5 +4,5 @@ export interface TableActionsProps<T> {
4
4
  actions: RowAction<T>[];
5
5
  row: T;
6
6
  }
7
- export declare function TableActions<T>({ actions, row }: TableActionsProps<T>): React.JSX.Element;
7
+ export declare function TableActions<T>({ actions, row }: TableActionsProps<T>): React.JSX.Element | null;
8
8
  //# sourceMappingURL=TableActions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TableActions.d.ts","sourceRoot":"","sources":["../../../../src/components/core/table/TableActions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;IACxB,GAAG,EAAE,CAAC,CAAC;CACR;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAoCzF"}
1
+ {"version":3,"file":"TableActions.d.ts","sourceRoot":"","sources":["../../../../src/components/core/table/TableActions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;IACxB,GAAG,EAAE,CAAC,CAAC;CACR;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,GAAG,IAAI,CAqEhG"}
@@ -1 +1 @@
1
- {"version":3,"file":"TableHeader.d.ts","sourceRoot":"","sources":["../../../../src/components/core/table/TableHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,WAAW,gBAAgB,CAAC,CAAC;IACjC,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,mBAAmB,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;IACpC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,aAAa,EAAE,KAAK,GAAG,MAAM,CAAC;IAC9B,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,eAAe,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACjE,cAAc,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAChE,UAAU,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,SAAS,EAAE,eAAe,EAAE,MAAM,KAAK,IAAI,CAAC;IAClE,eAAe,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAClE,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,EAC7B,cAAc,EACd,YAAY,EACZ,UAAU,EACV,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,aAAa,EACb,UAAU,EACV,eAAe,EACf,cAAc,EACd,UAAU,EACV,eAAe,EACf,UAAU,EACV,YAAY,EACZ,QAAgB,GACjB,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAuFzC"}
1
+ {"version":3,"file":"TableHeader.d.ts","sourceRoot":"","sources":["../../../../src/components/core/table/TableHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,WAAW,gBAAgB,CAAC,CAAC;IACjC,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,mBAAmB,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;IACpC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,aAAa,EAAE,KAAK,GAAG,MAAM,CAAC;IAC9B,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,eAAe,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACjE,cAAc,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAChE,UAAU,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,SAAS,EAAE,eAAe,EAAE,MAAM,KAAK,IAAI,CAAC;IAClE,eAAe,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAClE,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,EAC7B,cAAc,EACd,YAAY,EACZ,UAAU,EACV,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,aAAa,EACb,UAAU,EACV,eAAe,EACf,cAAc,EACd,UAAU,EACV,eAAe,EACf,UAAU,EACV,YAAY,EACZ,QAAgB,GACjB,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAwFzC"}
@@ -1,4 +1,4 @@
1
- import { D as s, T as b, a as l, b as T, c as t, d as o, e as i } from "../../../DataTable-DJM7KWWK.js";
1
+ import { D as s, T as b, a as l, b as T, c as t, d as o, e as i } from "../../../DataTable-CSupYrnN.js";
2
2
  export {
3
3
  s as DataTable,
4
4
  b as TableActions,
@@ -15,7 +15,7 @@ import { S as gr, a as dr, b as mr, T as Cr } from "../Topbar-DMyjbOTI.js";
15
15
  import { E as Tr } from "../ErrorAlert-DH1onuyt.js";
16
16
  import { E as Dr } from "../ErrorState-vU8d4CwD.js";
17
17
  import { L as xr } from "../LoadingState-BN0YaPSs.js";
18
- import { D as Ir, T as Pr, a as hr, b as fr, c as wr, d as vr, e as Fr } from "../DataTable-DJM7KWWK.js";
18
+ import { D as Ir, T as Pr, a as hr, b as fr, c as wr, d as vr, e as Fr } from "../DataTable-CSupYrnN.js";
19
19
  import { A as Br, a as Gr, b as Hr, c as Rr } from "../AppVerticalTabs-NZ02HPGP.js";
20
20
  import { T as Nr } from "../ThemeSelector-CQ3fSDJ2.js";
21
21
  import { A as Er, a as Or, b as Vr } from "../alert-B78CiTYe.js";
@@ -5,6 +5,7 @@ export interface ColumnDef<T> {
5
5
  defaultVisible?: boolean;
6
6
  minWidth?: number;
7
7
  sortable?: boolean;
8
+ className?: string;
8
9
  renderCell?: (row: T) => React.ReactNode;
9
10
  getSortValue?: (row: T) => string | number | boolean | null | undefined;
10
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ColumnDef.d.ts","sourceRoot":"","sources":["../../src/types/ColumnDef.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,SAAS,CAAC,CAAC;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;IAEzC,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;CACzE"}
1
+ {"version":3,"file":"ColumnDef.d.ts","sourceRoot":"","sources":["../../src/types/ColumnDef.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,SAAS,CAAC,CAAC;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;IAEzC,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;CACzE"}
@@ -4,5 +4,9 @@ export interface RowAction<T> {
4
4
  icon?: React.ElementType;
5
5
  onClick: (row: T) => void;
6
6
  className?: string;
7
+ variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link";
8
+ visible?: (row: T) => boolean;
9
+ disabled?: (row: T) => boolean;
10
+ overflow?: boolean;
7
11
  }
8
12
  //# sourceMappingURL=RowAction.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RowAction.d.ts","sourceRoot":"","sources":["../../src/types/RowAction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,SAAS,CAAC,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC;IACzB,OAAO,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
1
+ {"version":3,"file":"RowAction.d.ts","sourceRoot":"","sources":["../../src/types/RowAction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,SAAS,CAAC,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC;IACzB,OAAO,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,SAAS,GAAG,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC;IAEjF,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC;IAE9B,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC;IAE/B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krosoft/react",
3
- "version": "0.0.162",
3
+ "version": "0.0.163",
4
4
  "description": "Krosoft shared React package",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -1,476 +0,0 @@
1
- import { jsxs as r, jsx as e } from "react/jsx-runtime";
2
- import { u as ae } from "./useDataTable-CxcA5S-s.js";
3
- import { ay as A, aM as P, aA as B, aC as se, $, az as ne } from "./toggle-group-BASGy2mQ.js";
4
- import "./alert-B78CiTYe.js";
5
- import "@radix-ui/react-aspect-ratio";
6
- import { B as C } from "./tooltip-BWyFpIxo.js";
7
- import "@radix-ui/react-collapsible";
8
- import "./sheet-Gop1cIaU.js";
9
- import { MoreVerticalIcon as ie, Loader2Icon as le, GripVerticalIcon as de, ArrowUpIcon as oe, ArrowDownIcon as ce, ArrowUpDownIcon as me, ChevronLeftIcon as he, ChevronRightIcon as ge, SettingsIcon as ue } from "lucide-react";
10
- import "react-resizable-panels";
11
- import "clsx";
12
- import "tailwind-merge";
13
- import "./select-MWzbMBAS.js";
14
- import "next-themes";
15
- import "sonner";
16
- import "react";
17
- const L = [5, 10, 30, 50, 100], pe = L[1];
18
- function xe({ actions: l, row: s }) {
19
- return /* @__PURE__ */ r(A, { children: [
20
- /* @__PURE__ */ e(P, { asChild: !0, children: /* @__PURE__ */ e(C, { variant: "ghost", size: "icon", className: "h-7 w-7 text-muted-foreground hover:text-foreground", children: /* @__PURE__ */ e(ie, { className: "size-3.5" }) }) }),
21
- /* @__PURE__ */ e(
22
- B,
23
- {
24
- align: "end",
25
- onClick: (t) => {
26
- t.stopPropagation();
27
- },
28
- children: l.map((t, a) => {
29
- const c = t.icon;
30
- return /* @__PURE__ */ r(
31
- se,
32
- {
33
- onClick: () => {
34
- t.onClick(s);
35
- },
36
- className: t.className,
37
- children: [
38
- c !== void 0 && /* @__PURE__ */ e("span", { className: "mr-2 size-4 flex items-center justify-center", children: /* @__PURE__ */ e(c, { className: "size-4" }) }),
39
- t.label
40
- ]
41
- },
42
- a
43
- );
44
- })
45
- }
46
- )
47
- ] });
48
- }
49
- function fe({
50
- isLoading: l,
51
- colSpanCount: s,
52
- noDataMessage: t,
53
- paginatedData: a,
54
- getRowId: c,
55
- onRowClick: n,
56
- hasBulkActions: p,
57
- selectedRows: f,
58
- toggleRowSelection: h,
59
- visibleColumnsArray: o,
60
- columnWidths: v,
61
- hasActions: w,
62
- actions: y,
63
- columns: z,
64
- bordered: N = !1
65
- }) {
66
- const D = (m, g) => {
67
- const i = z.find((b) => b.key === g);
68
- if ((i == null ? void 0 : i.renderCell) !== void 0)
69
- return i.renderCell(m);
70
- const x = m[g];
71
- return /* @__PURE__ */ e("span", { className: "text-sm truncate", children: x != null ? String(x) : "-" });
72
- };
73
- return l ? /* @__PURE__ */ e("tbody", { className: "divide-y divide-gray-200 dark:divide-gray-800", children: /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: s, className: "py-8 text-center", children: /* @__PURE__ */ r("div", { className: "flex flex-col items-center justify-center gap-2 text-muted-foreground", children: [
74
- /* @__PURE__ */ e(le, { className: "h-6 w-6 animate-spin text-primary" }),
75
- /* @__PURE__ */ e("span", { className: "text-sm", children: "Chargement..." })
76
- ] }) }) }) }) : a.length === 0 ? /* @__PURE__ */ e("tbody", { className: "divide-y divide-gray-200 dark:divide-gray-800", children: /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: s, className: "py-8 text-center text-sm text-muted-foreground", children: t }) }) }) : /* @__PURE__ */ e("tbody", { className: "divide-y divide-gray-200 dark:divide-gray-800", children: a.map((m) => {
77
- const g = c(m);
78
- return /* @__PURE__ */ r(
79
- "tr",
80
- {
81
- className: `group hover:bg-muted/50 dark:hover:bg-gray-900/50 transition-colors ${n !== void 0 ? "cursor-pointer" : ""}`,
82
- onClick: () => n == null ? void 0 : n(m),
83
- children: [
84
- p ? /* @__PURE__ */ e(
85
- "td",
86
- {
87
- className: "p-1 text-center align-middle",
88
- style: { width: "32px", minWidth: "32px", maxWidth: "32px" },
89
- onClick: (i) => {
90
- i.stopPropagation();
91
- },
92
- children: /* @__PURE__ */ e("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ e(
93
- $,
94
- {
95
- checked: f.includes(g),
96
- onCheckedChange: () => {
97
- h(g);
98
- }
99
- }
100
- ) })
101
- }
102
- ) : null,
103
- o.map((i, x) => {
104
- const b = x === o.length - 1;
105
- return /* @__PURE__ */ e(
106
- "td",
107
- {
108
- className: `px-2 py-2 relative ${N && !b ? "border-r border-gray-100 dark:border-gray-800" : ""}`,
109
- style: { width: v[i.key] },
110
- children: /* @__PURE__ */ e("div", { className: "w-full h-full", children: D(m, i.key) })
111
- },
112
- i.key
113
- );
114
- }),
115
- w ? /* @__PURE__ */ e(
116
- "td",
117
- {
118
- className: "p-1 text-center align-middle",
119
- style: { width: "32px", minWidth: "32px", maxWidth: "32px" },
120
- onClick: (i) => {
121
- i.stopPropagation();
122
- },
123
- children: y !== void 0 && y.length > 0 ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ e(xe, { actions: y, row: m }) }) : null
124
- }
125
- ) : null
126
- ]
127
- },
128
- g
129
- );
130
- }) });
131
- }
132
- function ye({ selectedRows: l, setSelectedRows: s, bulkActions: t }) {
133
- return /* @__PURE__ */ r("div", { className: "bg-muted/60 dark:bg-gray-900/60 border border-border px-3 py-1.5 flex items-center justify-between rounded-lg", children: [
134
- /* @__PURE__ */ r("div", { className: "flex items-center gap-4", children: [
135
- /* @__PURE__ */ r("span", { className: "text-sm font-medium text-primary ml-1", children: [
136
- l.length,
137
- " sélectionné(s)"
138
- ] }),
139
- /* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: t.map((a, c) => {
140
- const n = a.icon;
141
- return /* @__PURE__ */ r(
142
- C,
143
- {
144
- variant: "outline",
145
- size: "sm",
146
- onClick: () => {
147
- a.onClick(l, () => {
148
- s([]);
149
- });
150
- },
151
- className: `h-7 bg-background shadow-sm text-xs px-2.5 ${a.variant === "destructive" ? "text-destructive border-destructive/30 hover:bg-destructive/10 hover:text-destructive" : "text-foreground"}`,
152
- children: [
153
- n !== void 0 && /* @__PURE__ */ e("span", { className: "mr-1.5 flex items-center justify-center", children: /* @__PURE__ */ e(n, { className: "h-3.5 w-3.5" }) }),
154
- a.label
155
- ]
156
- },
157
- c
158
- );
159
- }) })
160
- ] }),
161
- /* @__PURE__ */ e(
162
- C,
163
- {
164
- variant: "ghost",
165
- size: "sm",
166
- onClick: () => {
167
- s([]);
168
- },
169
- className: "text-xs text-muted-foreground hover:text-foreground h-7 px-2",
170
- children: "Désélectionner"
171
- }
172
- )
173
- ] });
174
- }
175
- function be({
176
- hasBulkActions: l,
177
- selectedRows: s,
178
- totalItems: t,
179
- toggleSelectAll: a,
180
- visibleColumnsArray: c,
181
- draggableColumns: n,
182
- resizableColumns: p,
183
- columnWidths: f,
184
- sortColumn: h,
185
- sortDirection: o,
186
- handleSort: v,
187
- handleDragStart: w,
188
- handleDragOver: y,
189
- handleDrop: z,
190
- handleMouseDown: N,
191
- hasActions: D,
192
- settingsNode: m,
193
- bordered: g = !1
194
- }) {
195
- let i = !1;
196
- s.length === t && t > 0 ? i = !0 : s.length > 0 && (i = "indeterminate");
197
- const x = (d) => d.sortable !== !0 ? null : h === d.key ? o === "asc" ? /* @__PURE__ */ e(oe, { className: "size-3.5 text-foreground" }) : /* @__PURE__ */ e(ce, { className: "size-3.5 text-foreground" }) : /* @__PURE__ */ e(me, { className: "size-3.5 text-muted-foreground/50 group-hover:text-muted-foreground transition-colors" }), b = (d, I) => {
198
- const S = I !== !1, k = d.sortable === !0;
199
- return /* @__PURE__ */ r(
200
- "th",
201
- {
202
- className: [
203
- "px-2 py-2 text-left text-sm font-medium text-gray-900 dark:text-gray-100 relative group",
204
- g ? "border-r border-gray-200 dark:border-gray-800" : "",
205
- k ? "cursor-pointer select-none" : ""
206
- ].filter(Boolean).join(" "),
207
- style: { width: f[d.key] },
208
- draggable: S,
209
- onClick: () => {
210
- v(d.key);
211
- },
212
- onDragStart: (u) => {
213
- S ? w(u, d.key) : u.preventDefault();
214
- },
215
- onDragOver: (u) => {
216
- y(u, d.key);
217
- },
218
- onDrop: (u) => {
219
- z(u, d.key);
220
- },
221
- children: [
222
- /* @__PURE__ */ r("div", { className: "flex items-center justify-between pr-2", children: [
223
- /* @__PURE__ */ r("div", { className: "flex items-center gap-1", children: [
224
- S ? /* @__PURE__ */ e(de, { className: "size-4 text-gray-400 cursor-grab dark:text-gray-300 shrink-0" }) : null,
225
- /* @__PURE__ */ e("span", { className: "truncate", children: d.label })
226
- ] }),
227
- /* @__PURE__ */ e("div", { className: "ml-1 shrink-0", children: x(d) })
228
- ] }),
229
- p ? /* @__PURE__ */ e(
230
- "div",
231
- {
232
- 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",
233
- onMouseDown: (u) => {
234
- N(u, d.key);
235
- }
236
- }
237
- ) : null
238
- ]
239
- },
240
- d.key
241
- );
242
- };
243
- return /* @__PURE__ */ e("thead", { className: "bg-muted/50 dark:bg-gray-900/50 border-b border-gray-200 dark:border-gray-800", children: /* @__PURE__ */ r("tr", { children: [
244
- l ? /* @__PURE__ */ e("th", { className: "p-1 flex-shrink-0 text-center align-middle", style: { width: "32px", minWidth: "32px", maxWidth: "32px" }, children: /* @__PURE__ */ e("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ e($, { checked: i, onCheckedChange: a }) }) }) : null,
245
- c.map((d) => b(d, n)),
246
- D || m !== void 0 ? /* @__PURE__ */ e("th", { className: "p-1 text-center align-middle", style: { width: "32px", minWidth: "32px", maxWidth: "32px" }, children: m }) : null
247
- ] }) });
248
- }
249
- function ve({
250
- totalItems: l,
251
- startIndex: s,
252
- endIndex: t,
253
- pageSize: a,
254
- setPageSize: c,
255
- currentPage: n,
256
- setCurrentPage: p,
257
- pageSizeOptions: f,
258
- totalPages: h
259
- }) {
260
- return /* @__PURE__ */ r("div", { className: "px-4 py-2 border-t border-gray-200 dark:border-gray-800 flex items-center justify-between bg-muted/50 dark:bg-gray-900/50 flex-wrap gap-2", children: [
261
- /* @__PURE__ */ r("div", { className: "text-sm text-muted-foreground", children: [
262
- l === 0 ? "0" : `${String(s + 1)} - ${String(t)}`,
263
- " sur ",
264
- l
265
- ] }),
266
- /* @__PURE__ */ r("div", { className: "flex items-center gap-4", children: [
267
- /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
268
- /* @__PURE__ */ e("span", { className: "text-sm text-muted-foreground", children: "Lignes par page :" }),
269
- /* @__PURE__ */ e(
270
- "select",
271
- {
272
- value: a,
273
- onChange: (o) => {
274
- c(Number(o.target.value)), p(1);
275
- },
276
- className: "border border-input bg-background rounded px-2 py-1 text-sm text-foreground",
277
- children: f.map((o) => /* @__PURE__ */ e("option", { value: o, children: o }, o))
278
- }
279
- )
280
- ] }),
281
- /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
282
- /* @__PURE__ */ e(
283
- C,
284
- {
285
- variant: "outline",
286
- size: "sm",
287
- className: "h-8 w-8 p-0",
288
- onClick: () => {
289
- p((o) => Math.max(1, o - 1));
290
- },
291
- disabled: n === 1,
292
- children: /* @__PURE__ */ e(he, { className: "size-4" })
293
- }
294
- ),
295
- /* @__PURE__ */ r("span", { className: "text-sm text-muted-foreground", children: [
296
- "Page ",
297
- n,
298
- " sur ",
299
- h
300
- ] }),
301
- /* @__PURE__ */ e(
302
- C,
303
- {
304
- variant: "outline",
305
- size: "sm",
306
- className: "h-8 w-8 p-0",
307
- onClick: () => {
308
- p((o) => Math.min(h, o + 1));
309
- },
310
- disabled: n === h,
311
- children: /* @__PURE__ */ e(ge, { className: "size-4" })
312
- }
313
- )
314
- ] })
315
- ] })
316
- ] });
317
- }
318
- function Ne({ columns: l, visibleColumns: s, toggleColumnVisibility: t }) {
319
- return /* @__PURE__ */ r(A, { children: [
320
- /* @__PURE__ */ e(P, { asChild: !0, children: /* @__PURE__ */ e(C, { variant: "outline", size: "sm", className: "size-7 p-0 bg-white hover:bg-gray-100 dark:bg-gray-900 shadow-sm border-gray-200 dark:border-gray-800", children: /* @__PURE__ */ e(ue, { className: "size-3.5 text-gray-600 dark:text-gray-300" }) }) }),
321
- /* @__PURE__ */ e(B, { align: "end", className: "w-56", children: l.map((a) => /* @__PURE__ */ e(
322
- ne,
323
- {
324
- checked: s.has(a.key),
325
- onCheckedChange: () => {
326
- t(a.key);
327
- },
328
- children: a.label
329
- },
330
- a.key
331
- )) })
332
- ] });
333
- }
334
- function He({
335
- data: l,
336
- columns: s,
337
- getRowId: t,
338
- onRowClick: a,
339
- actions: c,
340
- bulkActions: n,
341
- draggableColumns: p = !1,
342
- resizableColumns: f = !1,
343
- columnVisibility: h = !1,
344
- isLoading: o = !1,
345
- bordered: v = !1,
346
- noDataMessage: w = "Aucun résultat",
347
- defaultPageSize: y = pe,
348
- pageSizeOptions: z = L,
349
- totalRows: N,
350
- currentPage: D,
351
- pageSize: m,
352
- onPageChange: g,
353
- onPageSizeChange: i,
354
- sortColumn: x,
355
- sortDirection: b,
356
- onSortChange: d
357
- }) {
358
- const {
359
- sortColumn: I,
360
- sortDirection: S,
361
- selectedRows: k,
362
- setSelectedRows: u,
363
- visibleColumns: H,
364
- columnWidths: j,
365
- safeCurrentPage: O,
366
- totalPages: U,
367
- startIndex: V,
368
- endIndex: G,
369
- tableRef: q,
370
- hasActions: M,
371
- hasBulkActions: T,
372
- visibleColumnsArray: W,
373
- colSpanCount: E,
374
- paginatedData: F,
375
- handleSort: J,
376
- handleMouseDown: Q,
377
- handleDragStart: X,
378
- handleDragOver: Y,
379
- handleDrop: Z,
380
- toggleColumnVisibility: _,
381
- toggleRowSelection: K,
382
- toggleSelectAll: R,
383
- pageSize: ee,
384
- setPageSize: re,
385
- setCurrentPage: te
386
- } = ae({
387
- data: l,
388
- columns: s,
389
- getRowId: t,
390
- defaultPageSize: y,
391
- actions: c,
392
- bulkActions: n,
393
- columnVisibility: h,
394
- totalRows: N,
395
- currentPage: D,
396
- pageSize: m,
397
- onPageChange: g,
398
- onPageSizeChange: i,
399
- sortColumn: x,
400
- sortDirection: b,
401
- onSortChange: d
402
- });
403
- return /* @__PURE__ */ r("div", { className: "space-y-4", children: [
404
- k.length > 0 && n !== void 0 && n.length > 0 && /* @__PURE__ */ e(ye, { selectedRows: k, setSelectedRows: u, bulkActions: n }),
405
- /* @__PURE__ */ r("div", { className: "w-full bg-card dark:bg-gray-950 rounded-md border border-gray-200 dark:border-gray-800 overflow-hidden", children: [
406
- /* @__PURE__ */ e("div", { className: "overflow-x-auto", children: /* @__PURE__ */ r("table", { ref: q, className: "w-full", children: [
407
- /* @__PURE__ */ e(
408
- be,
409
- {
410
- hasBulkActions: T,
411
- selectedRows: k,
412
- totalItems: l.length,
413
- toggleSelectAll: R,
414
- visibleColumnsArray: W,
415
- draggableColumns: p,
416
- resizableColumns: f,
417
- columnWidths: j,
418
- sortColumn: I,
419
- sortDirection: S,
420
- handleSort: J,
421
- handleDragStart: X,
422
- handleDragOver: Y,
423
- handleDrop: Z,
424
- handleMouseDown: Q,
425
- hasActions: M,
426
- bordered: v,
427
- settingsNode: h ? /* @__PURE__ */ e(Ne, { columns: s, visibleColumns: H, toggleColumnVisibility: _ }) : void 0
428
- }
429
- ),
430
- /* @__PURE__ */ e(
431
- fe,
432
- {
433
- bordered: v,
434
- isLoading: o,
435
- colSpanCount: E,
436
- noDataMessage: w,
437
- paginatedData: F,
438
- getRowId: t,
439
- onRowClick: a,
440
- hasBulkActions: T,
441
- selectedRows: k,
442
- toggleRowSelection: K,
443
- visibleColumnsArray: W,
444
- columnWidths: j,
445
- hasActions: M || h,
446
- actions: c,
447
- columns: s
448
- }
449
- )
450
- ] }) }),
451
- /* @__PURE__ */ e(
452
- ve,
453
- {
454
- totalItems: N ?? l.length,
455
- startIndex: V,
456
- endIndex: G,
457
- pageSize: ee,
458
- setPageSize: re,
459
- currentPage: O,
460
- setCurrentPage: te,
461
- pageSizeOptions: z,
462
- totalPages: U
463
- }
464
- )
465
- ] })
466
- ] });
467
- }
468
- export {
469
- He as D,
470
- xe as T,
471
- fe as a,
472
- ye as b,
473
- be as c,
474
- ve as d,
475
- Ne as e
476
- };