@krosoft/react 0.0.162 → 0.0.164

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 (39) hide show
  1. package/dist/{AppActions-DCaejx-3.js → AppActions-DCYt9I0e.js} +1 -1
  2. package/dist/{AppSubTitle-BNd5_q0i.js → AppSubTitle-DhioA5bv.js} +1 -1
  3. package/dist/{AppVerticalTabs-NZ02HPGP.js → AppVerticalTabs-DujFNh9f.js} +2 -2
  4. package/dist/{ConfirmationDialog-Dy_6PcOr.js → ConfirmationDialog-CCZPbD4x.js} +2 -2
  5. package/dist/DataTable-CQ2LlJS7.js +506 -0
  6. package/dist/{GenericForm-Bb4E2Wxd.js → GenericForm-EohJXOt8.js} +4 -4
  7. package/dist/{ImageInput-CJ419eqw.js → ImageInput-Bbxr8vpu.js} +1 -1
  8. package/dist/{KpiCardsLayout-CK1TEUc1.js → KpiCardsLayout-DBqGhp0I.js} +3 -3
  9. package/dist/{MetricCard-D-qPl6zh.js → MetricCard-rL1mIA58.js} +1 -1
  10. package/dist/{MultiSelect-BPffv2am.js → MultiSelect-B72dsN-1.js} +1 -1
  11. package/dist/{SearchInput-bwnVKhhE.js → SearchInput-rRYNQ8fq.js} +1 -1
  12. package/dist/{SkeletonCards-qHukR79N.js → SkeletonCards-BgsWWMun.js} +1 -1
  13. package/dist/{TableFilter-BjAYRNV9.js → TableFilter-BfWYeTv_.js} +3 -3
  14. package/dist/components/core/cards/index.js +2 -2
  15. package/dist/components/core/dialogs/index.js +2 -2
  16. package/dist/components/core/filters/index.js +1 -1
  17. package/dist/components/core/forms/index.js +1 -1
  18. package/dist/components/core/index.js +14 -14
  19. package/dist/components/core/inputs/index.js +3 -3
  20. package/dist/components/core/layouts/index.js +3 -3
  21. package/dist/components/core/table/DataTable.d.ts +1 -1
  22. package/dist/components/core/table/DataTable.d.ts.map +1 -1
  23. package/dist/components/core/table/TableActions.d.ts +1 -1
  24. package/dist/components/core/table/TableActions.d.ts.map +1 -1
  25. package/dist/components/core/table/TableBody.d.ts +1 -1
  26. package/dist/components/core/table/TableBody.d.ts.map +1 -1
  27. package/dist/components/core/table/TableHeader.d.ts.map +1 -1
  28. package/dist/components/core/table/index.js +1 -1
  29. package/dist/components/core/tabs/index.js +1 -1
  30. package/dist/components/index.js +15 -15
  31. package/dist/components/ui/index.js +2 -2
  32. package/dist/{toaster-Du2OlHAd.js → toaster-DTcdwmkK.js} +1 -1
  33. package/dist/{toggle-group-BASGy2mQ.js → toggle-group-DY9wl0HW.js} +2 -2
  34. package/dist/types/ColumnDef.d.ts +1 -0
  35. package/dist/types/ColumnDef.d.ts.map +1 -1
  36. package/dist/types/RowAction.d.ts +4 -0
  37. package/dist/types/RowAction.d.ts.map +1 -1
  38. package/package.json +1 -1
  39. package/dist/DataTable-DJM7KWWK.js +0 -476
@@ -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
- };