@krosoft/react 0.0.237 → 0.0.239

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 (109) hide show
  1. package/dist/AppActions-C_0YI75w.js +60 -0
  2. package/dist/AppSubTitle-tqqV9nuT.js +19 -0
  3. package/dist/AppTitle-BR4JFZfp.js +19 -0
  4. package/dist/ErrorAlert-BDqDHUUc.js +27 -0
  5. package/dist/GenericForm-CWXT5wiv.js +310 -0
  6. package/dist/ImageInput-CN2ozjpc.js +80 -0
  7. package/dist/MultiSelect-BF0zL0B0.js +134 -0
  8. package/dist/SearchInput-BJPT0SbB.js +255 -0
  9. package/dist/alert-REQGK9bR.js +32 -0
  10. package/dist/behavior-BR_V9Rpe.js +76 -0
  11. package/dist/cards-Cta6x49J.js +126 -0
  12. package/dist/chart-Dq3AIrue.js +166 -0
  13. package/dist/charts-CXhVUqLH.js +328 -0
  14. package/dist/components/core/cards/index.js +2 -10
  15. package/dist/components/core/charts/index.js +2 -11
  16. package/dist/components/core/dialogs/index.js +4 -19
  17. package/dist/components/core/filters/index.js +426 -7
  18. package/dist/components/core/forms/index.js +2 -4
  19. package/dist/components/core/index.js +24 -97
  20. package/dist/components/core/inputs/index.js +4 -11
  21. package/dist/components/core/language/index.js +2 -4
  22. package/dist/components/core/layouts/index.js +50 -11
  23. package/dist/components/core/navbar/index.js +2 -9
  24. package/dist/components/core/states/index.js +3 -8
  25. package/dist/components/core/table/index.js +2 -15
  26. package/dist/components/core/tabs/index.js +188 -6
  27. package/dist/components/core/theme/index.js +2 -4
  28. package/dist/components/index.js +28 -322
  29. package/dist/components/ui/index.js +8 -240
  30. package/dist/contexts/index.js +2 -5
  31. package/dist/dialogs-BGHSClsq.js +208 -0
  32. package/dist/helpers/index.js +39 -46
  33. package/dist/hooks/behavior/index.js +2 -10
  34. package/dist/hooks/index.js +11 -30
  35. package/dist/hooks/ui/index.js +10 -22
  36. package/dist/i18n/index.js +2 -10
  37. package/dist/i18n-Dw99bRmg.js +190 -0
  38. package/dist/language-DxHhlpgN.js +58 -0
  39. package/dist/navbar-Bc5OQWRI.js +385 -0
  40. package/dist/providers/index.js +42 -49
  41. package/dist/pwa/index.js +32 -34
  42. package/dist/select-ULiTPOr5.js +81 -0
  43. package/dist/sheet-CRrYTZrl.js +226 -0
  44. package/dist/sidebar.context-BahtU6hE.js +5 -0
  45. package/dist/skeleton-D6Ga4BLw.js +11 -0
  46. package/dist/states-N8-LjFng.js +26 -0
  47. package/dist/table-muUyiaK6.js +571 -0
  48. package/dist/tailwind/index.js +126 -156
  49. package/dist/tailwind.helper-CJaRYBmL.js +8 -0
  50. package/dist/theme-B_n0F6R4.js +57 -0
  51. package/dist/tokens/index.js +37 -46
  52. package/dist/tooltip-B2dzyfs9.js +50 -0
  53. package/dist/types/forms/index.js +0 -1
  54. package/dist/types/index.js +1 -1
  55. package/dist/ui-CiX0E_bn.js +1165 -0
  56. package/dist/ui-DSVBO3iM.js +46 -0
  57. package/dist/useDocumentTitle-D7MywIeB.js +19 -0
  58. package/dist/useFixedColumns-DfAX30tT.js +147 -0
  59. package/dist/useLanguage-DN3CuBv5.js +19 -0
  60. package/dist/useMobile-pTQ8lWvt.js +16 -0
  61. package/dist/useNotifications-CyhTruIG.js +20 -0
  62. package/dist/useScrollFade-D9kqJBDh.js +27 -0
  63. package/dist/useTheme-DVfcJ-Qd.js +25 -0
  64. package/dist/useToast-UeDRLovh.js +103 -0
  65. package/package.json +3 -3
  66. package/dist/AppActions-BFwztl-1.js +0 -76
  67. package/dist/AppSubTitle-BTN0YAc7.js +0 -13
  68. package/dist/AppTitle-D15YXeMx.js +0 -13
  69. package/dist/AppVerticalTabs-B7XXtAVj.js +0 -103
  70. package/dist/ConfirmationDialog-Dj4WdnHg.js +0 -188
  71. package/dist/DataTable-CjrR27Di.js +0 -638
  72. package/dist/ErrorAlert-B99Xb_Hg.js +0 -23
  73. package/dist/ErrorState-CkeS_IBT.js +0 -14
  74. package/dist/GenericForm-CydibLHU.js +0 -343
  75. package/dist/ImageInput-DoOOvvth.js +0 -70
  76. package/dist/KpiCardsLayout-Bq4xQ3i8.js +0 -43
  77. package/dist/LanguageSelector-C7E51rCQ.js +0 -47
  78. package/dist/LoadingState-BN0YaPSs.js +0 -9
  79. package/dist/MetricCard-B0xnFyim.js +0 -53
  80. package/dist/MultiSelect-DbH7LrsD.js +0 -149
  81. package/dist/PieChart-uozNJtEx.js +0 -295
  82. package/dist/SearchInput-DIZ5Yt6L.js +0 -246
  83. package/dist/SkeletonCards-B9C4cNMr.js +0 -75
  84. package/dist/TableFilter-CmEVF5Bo.js +0 -422
  85. package/dist/ThemeSelector-CLi4_epH.js +0 -52
  86. package/dist/Topbar-Clby5_uj.js +0 -431
  87. package/dist/alert-B9F1N9Qk.js +0 -30
  88. package/dist/chart-DntJZGxB.js +0 -181
  89. package/dist/select-BpjFWqAY.js +0 -96
  90. package/dist/sheet-XYI-ezvY.js +0 -292
  91. package/dist/sidebar.context-D5nywlmP.js +0 -6
  92. package/dist/skeleton-BX4RcsiK.js +0 -8
  93. package/dist/tailwind.helper-B6yFEsav.js +0 -8
  94. package/dist/toaster-CyzB1m5z.js +0 -75
  95. package/dist/toggle-group-iZqnrTj7.js +0 -1276
  96. package/dist/tooltip-DVeqVwqV.js +0 -61
  97. package/dist/useDateFnsLocale-D6VExZ8U.js +0 -11
  98. package/dist/useDocumentTitle-WNwdPz-I.js +0 -14
  99. package/dist/useFixedColumns-CKZyu4PD.js +0 -161
  100. package/dist/useKrosoftTranslation-BTp46G94.js +0 -47
  101. package/dist/useLanguage-C9jI2nwn.js +0 -19
  102. package/dist/useMobile-DN1_OMDB.js +0 -16
  103. package/dist/useNotifications-zbUhCvF_.js +0 -12
  104. package/dist/usePage-BQm6tdJD.js +0 -84
  105. package/dist/useScrollFade-BA4KqJYp.js +0 -23
  106. package/dist/useServerTable-UvTY6L1N.js +0 -38
  107. package/dist/useSidebar-BJuALHqQ.js +0 -11
  108. package/dist/useTheme-DS6ZjdzM.js +0 -27
  109. package/dist/useToast-BFTk4lWz.js +0 -100
@@ -0,0 +1,571 @@
1
+ import { Ft as e, Gt as t, Mt as n, Nt as r, bn as i, jt as a } from "./ui-CiX0E_bn.js";
2
+ import { s as o } from "./tooltip-B2dzyfs9.js";
3
+ import { t as s } from "./i18n-Dw99bRmg.js";
4
+ import { i as c, l, n as u, t as d, u as f } from "./select-ULiTPOr5.js";
5
+ import { n as p, t as m } from "./useFixedColumns-DfAX30tT.js";
6
+ import "react";
7
+ import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
8
+ import { AlertTriangleIcon as v, ArrowDownIcon as y, ArrowUpDownIcon as b, ArrowUpIcon as x, ChevronLeftIcon as S, ChevronRightIcon as C, GripVerticalIcon as w, Loader2Icon as T, MoreVerticalIcon as E, SettingsIcon as D } from "lucide-react";
9
+ //#region src/constants/datatable.ts
10
+ var O = [
11
+ 5,
12
+ 10,
13
+ 30,
14
+ 50,
15
+ 100
16
+ ], k = O[1];
17
+ //#endregion
18
+ //#region src/components/core/table/TableActions.tsx
19
+ function A({ actions: n, row: i }) {
20
+ let s = n.filter((e) => e.visible === void 0 || e.visible(i));
21
+ if (s.length === 0) return null;
22
+ let c = s.filter((e) => e.overflow !== !0), l = s.filter((e) => e.overflow === !0);
23
+ return /* @__PURE__ */ _("div", {
24
+ className: "flex items-center justify-center gap-1",
25
+ children: [c.map((e, t) => {
26
+ let n = e.icon;
27
+ return /* @__PURE__ */ _(o, {
28
+ variant: e.variant ?? "ghost",
29
+ size: "sm",
30
+ disabled: e.disabled?.(i) ?? !1,
31
+ className: `h-7 px-2 text-muted-foreground hover:text-foreground ${e.className ?? ""}`,
32
+ onClick: (t) => {
33
+ t.stopPropagation(), e.onClick(i);
34
+ },
35
+ children: [n !== void 0 && /* @__PURE__ */ g(n, { className: "size-3.5" }), e.label]
36
+ }, t);
37
+ }), l.length > 0 && /* @__PURE__ */ _(a, { children: [/* @__PURE__ */ g(t, {
38
+ asChild: !0,
39
+ children: /* @__PURE__ */ g(o, {
40
+ variant: "ghost",
41
+ size: "icon",
42
+ className: "h-7 w-7 text-muted-foreground hover:text-foreground",
43
+ children: /* @__PURE__ */ g(E, { className: "size-3.5" })
44
+ })
45
+ }), /* @__PURE__ */ g(r, {
46
+ align: "end",
47
+ onClick: (e) => {
48
+ e.stopPropagation();
49
+ },
50
+ children: l.map((t, n) => {
51
+ let r = t.icon;
52
+ return /* @__PURE__ */ _(e, {
53
+ disabled: t.disabled?.(i) ?? !1,
54
+ onClick: () => {
55
+ t.onClick(i);
56
+ },
57
+ className: t.className,
58
+ children: [r !== void 0 && /* @__PURE__ */ g("span", {
59
+ className: "mr-2 size-4 flex items-center justify-center",
60
+ children: /* @__PURE__ */ g(r, { className: "size-4" })
61
+ }), t.label]
62
+ }, n);
63
+ })
64
+ })] })]
65
+ });
66
+ }
67
+ //#endregion
68
+ //#region src/components/core/table/columnAlignment.ts
69
+ var j = {
70
+ left: "text-left",
71
+ center: "text-center",
72
+ right: "text-right"
73
+ };
74
+ function M(e) {
75
+ if (e.align !== void 0) return e.align;
76
+ let t = (e.className ?? "").split(/\s+/);
77
+ return t.includes("text-right") ? "right" : t.includes("text-center") ? "center" : "left";
78
+ }
79
+ function N(e) {
80
+ return j[e];
81
+ }
82
+ //#endregion
83
+ //#region src/components/core/table/fixedColumns.ts
84
+ var P = "__selection__", F = "__actions__", I = {
85
+ left: "border-r border-gray-200 dark:border-gray-800",
86
+ right: "border-l border-gray-200 dark:border-gray-800"
87
+ };
88
+ function L(e, t) {
89
+ if (e === void 0) return {
90
+ className: "relative",
91
+ style: {}
92
+ };
93
+ let n = t === "header";
94
+ return {
95
+ className: [
96
+ "sticky bg-card dark:bg-gray-950",
97
+ n ? "z-20" : "z-10",
98
+ "before:absolute before:inset-0 before:-z-10 before:pointer-events-none",
99
+ 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",
100
+ e.isEdge ? I[e.side] : ""
101
+ ].filter(Boolean).join(" "),
102
+ style: e.side === "left" ? { left: e.offset } : { right: e.offset }
103
+ };
104
+ }
105
+ //#endregion
106
+ //#region src/components/core/table/TableBody.tsx
107
+ function R({ isLoading: e, error: t, colSpanCount: n, noDataMessage: r, paginatedData: a, getRowId: o, onRowClick: c, hasBulkActions: l, selectedRows: u, toggleRowSelection: d, visibleColumnsArray: f, columnWidths: p, hasActions: m, actions: h, columns: y, bordered: b = !1, resizableColumns: x = !1, fixedColumns: S = {} }) {
108
+ let { t: C } = s(), w = (e, t) => {
109
+ let n = y.find((e) => e.key === t);
110
+ if (n?.renderCell !== void 0) return n.renderCell(e);
111
+ let r = e[t];
112
+ return /* @__PURE__ */ g("span", {
113
+ className: "text-sm truncate",
114
+ children: r == null ? "-" : String(r)
115
+ });
116
+ };
117
+ if (e) return /* @__PURE__ */ g("tbody", {
118
+ className: "divide-y divide-gray-200 dark:divide-gray-800",
119
+ children: /* @__PURE__ */ g("tr", { children: /* @__PURE__ */ g("td", {
120
+ colSpan: n,
121
+ className: "py-8 text-center",
122
+ children: /* @__PURE__ */ _("div", {
123
+ className: "flex flex-col items-center justify-center gap-2 text-muted-foreground",
124
+ children: [/* @__PURE__ */ g(T, { className: "h-6 w-6 animate-spin text-primary" }), /* @__PURE__ */ g("span", {
125
+ className: "text-sm",
126
+ children: C("states.loading")
127
+ })]
128
+ })
129
+ }) })
130
+ });
131
+ if (t) return /* @__PURE__ */ g("tbody", {
132
+ className: "divide-y divide-gray-200 dark:divide-gray-800",
133
+ children: /* @__PURE__ */ g("tr", { children: /* @__PURE__ */ g("td", {
134
+ colSpan: n,
135
+ className: "py-8 text-center",
136
+ children: /* @__PURE__ */ _("div", {
137
+ className: "flex flex-col items-center justify-center gap-2 text-destructive",
138
+ children: [/* @__PURE__ */ g(v, { className: "h-6 w-6" }), /* @__PURE__ */ g("span", {
139
+ className: "text-sm",
140
+ children: t
141
+ })]
142
+ })
143
+ }) })
144
+ });
145
+ if (a.length === 0) return /* @__PURE__ */ g("tbody", {
146
+ className: "divide-y divide-gray-200 dark:divide-gray-800",
147
+ children: /* @__PURE__ */ g("tr", { children: /* @__PURE__ */ g("td", {
148
+ colSpan: n,
149
+ className: "py-8 text-center text-sm text-muted-foreground",
150
+ children: r ?? C("states.noResult")
151
+ }) })
152
+ });
153
+ let E = L(S[P], "body"), D = L(S[F], "body");
154
+ return /* @__PURE__ */ g("tbody", {
155
+ className: "divide-y divide-gray-200 dark:divide-gray-800",
156
+ children: a.map((e) => {
157
+ let t = o(e);
158
+ return /* @__PURE__ */ _("tr", {
159
+ className: `group hover:bg-muted/50 dark:hover:bg-gray-900/50 transition-colors ${c === void 0 ? "" : "cursor-pointer"}`,
160
+ onClick: (t) => c?.(e, t),
161
+ children: [
162
+ l ? /* @__PURE__ */ g("td", {
163
+ className: `p-1 text-center align-middle ${E.className}`,
164
+ style: {
165
+ width: "32px",
166
+ minWidth: "32px",
167
+ maxWidth: "32px",
168
+ ...E.style
169
+ },
170
+ onClick: (e) => {
171
+ e.stopPropagation();
172
+ },
173
+ children: /* @__PURE__ */ g("div", {
174
+ className: "flex items-center justify-center",
175
+ children: /* @__PURE__ */ g(i, {
176
+ checked: u.includes(t),
177
+ onCheckedChange: () => {
178
+ d(t);
179
+ }
180
+ })
181
+ })
182
+ }) : null,
183
+ f.map((t, n) => {
184
+ let r = n === f.length - 1, i = L(S[t.key], "body");
185
+ return /* @__PURE__ */ g("td", {
186
+ className: `px-2 py-2 ${N(M(t))} ${i.className} ${b && !r ? "border-r border-gray-100 dark:border-gray-800" : ""} ${t.className ?? ""}`,
187
+ style: {
188
+ ...x ? { width: p[t.key] } : { minWidth: p[t.key] },
189
+ ...i.style
190
+ },
191
+ children: /* @__PURE__ */ g("div", {
192
+ className: "w-full h-full",
193
+ children: w(e, t.key)
194
+ })
195
+ }, t.key);
196
+ }),
197
+ m ? /* @__PURE__ */ g("td", {
198
+ className: `p-1 text-center align-middle whitespace-nowrap ${D.className}`,
199
+ style: {
200
+ minWidth: "32px",
201
+ ...D.style
202
+ },
203
+ onClick: (e) => {
204
+ e.stopPropagation();
205
+ },
206
+ children: h !== void 0 && h.length > 0 ? /* @__PURE__ */ g("div", {
207
+ className: "flex items-center justify-center",
208
+ children: /* @__PURE__ */ g(A, {
209
+ actions: h,
210
+ row: e
211
+ })
212
+ }) : null
213
+ }) : null
214
+ ]
215
+ }, t);
216
+ })
217
+ });
218
+ }
219
+ //#endregion
220
+ //#region src/components/core/table/TableBulkActions.tsx
221
+ function z({ selectedRows: e, setSelectedRows: t, bulkActions: n }) {
222
+ return /* @__PURE__ */ _("div", {
223
+ className: "bg-muted/60 dark:bg-gray-900/60 border border-border px-3 py-1.5 flex items-center justify-between rounded-surface",
224
+ children: [/* @__PURE__ */ _("div", {
225
+ className: "flex items-center gap-4",
226
+ children: [/* @__PURE__ */ _("span", {
227
+ className: "text-sm font-medium text-primary ml-1",
228
+ children: [e.length, " sélectionné(s)"]
229
+ }), /* @__PURE__ */ g("div", {
230
+ className: "flex items-center gap-2",
231
+ children: n.map((n, r) => {
232
+ let i = n.icon;
233
+ return /* @__PURE__ */ _(o, {
234
+ variant: "outline",
235
+ size: "sm",
236
+ onClick: () => {
237
+ n.onClick(e, () => {
238
+ t([]);
239
+ });
240
+ },
241
+ 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"}`,
242
+ children: [i !== void 0 && /* @__PURE__ */ g("span", {
243
+ className: "mr-1.5 flex items-center justify-center",
244
+ children: /* @__PURE__ */ g(i, { className: "h-3.5 w-3.5" })
245
+ }), n.label]
246
+ }, r);
247
+ })
248
+ })]
249
+ }), /* @__PURE__ */ g(o, {
250
+ variant: "ghost",
251
+ size: "sm",
252
+ onClick: () => {
253
+ t([]);
254
+ },
255
+ className: "text-xs text-muted-foreground hover:text-foreground h-7 px-2",
256
+ children: "Désélectionner"
257
+ })]
258
+ });
259
+ }
260
+ //#endregion
261
+ //#region src/components/core/table/TableHeader.tsx
262
+ var B = {
263
+ left: "justify-start",
264
+ center: "justify-center",
265
+ right: "justify-end"
266
+ };
267
+ function V({ hasBulkActions: e, selectedRows: t, totalItems: n, toggleSelectAll: r, visibleColumnsArray: a, draggableColumns: o, resizableColumns: s, columnWidths: c, sortColumn: l, sortDirection: u, handleSort: d, handleDragStart: f, handleDragOver: p, handleDrop: m, handleMouseDown: h, hasActions: v, settingsNode: S, bordered: C = !1, fixedColumns: T = {}, fixedSelection: E = !1, fixedActions: D = !1 }) {
268
+ let O = !1;
269
+ t.length === n && n > 0 ? O = !0 : t.length > 0 && (O = "indeterminate");
270
+ let k = (e) => e.sortable === !0 ? l === e.key ? g(u === "asc" ? x : y, { className: "size-3.5 text-foreground" }) : /* @__PURE__ */ g(b, { className: "size-3.5 text-muted-foreground/50 group-hover:text-muted-foreground transition-colors" }) : null, A = (e, t) => {
271
+ let n = t !== !1 && e.fixed === void 0, r = e.sortable === !0, i = L(T[e.key], "header"), a = M(e), o = k(e);
272
+ return /* @__PURE__ */ _("th", {
273
+ "data-column-key": e.key,
274
+ "data-fixed-side": e.fixed,
275
+ className: [
276
+ "px-2 py-2 text-sm font-medium text-gray-900 dark:text-gray-100 group",
277
+ N(a),
278
+ i.className,
279
+ C ? "border-r border-gray-200 dark:border-gray-800" : "",
280
+ r ? "cursor-pointer select-none" : "",
281
+ e.className ?? ""
282
+ ].filter(Boolean).join(" "),
283
+ style: {
284
+ ...s ? { width: c[e.key] } : { minWidth: c[e.key] },
285
+ ...i.style
286
+ },
287
+ draggable: n,
288
+ onClick: () => {
289
+ d(e.key);
290
+ },
291
+ onDragStart: (t) => {
292
+ n ? f(t, e.key) : t.preventDefault();
293
+ },
294
+ onDragOver: (t) => {
295
+ p(t, e.key);
296
+ },
297
+ onDrop: (t) => {
298
+ m(t, e.key);
299
+ },
300
+ children: [/* @__PURE__ */ _("div", {
301
+ className: `flex items-center gap-1 ${B[a]} ${s ? "pr-2" : ""}`,
302
+ children: [
303
+ n ? /* @__PURE__ */ g(w, { className: "size-4 text-gray-400 cursor-grab dark:text-gray-300 shrink-0" }) : null,
304
+ /* @__PURE__ */ g("span", {
305
+ className: "truncate",
306
+ children: e.label
307
+ }),
308
+ o === null ? null : /* @__PURE__ */ g("span", {
309
+ className: "ml-1 shrink-0",
310
+ children: o
311
+ })
312
+ ]
313
+ }), s ? /* @__PURE__ */ g("div", {
314
+ 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",
315
+ onMouseDown: (t) => {
316
+ h(t, e.key);
317
+ }
318
+ }) : null]
319
+ }, e.key);
320
+ }, j = L(T[P], "header"), I = L(T[F], "header");
321
+ return /* @__PURE__ */ g("thead", {
322
+ className: "bg-muted/50 dark:bg-gray-900/50 border-b border-gray-200 dark:border-gray-800",
323
+ children: /* @__PURE__ */ _("tr", { children: [
324
+ e ? /* @__PURE__ */ g("th", {
325
+ "data-column-key": P,
326
+ "data-fixed-side": E ? "left" : void 0,
327
+ className: `p-1 flex-shrink-0 text-center align-middle ${j.className}`,
328
+ style: {
329
+ width: "32px",
330
+ minWidth: "32px",
331
+ maxWidth: "32px",
332
+ ...j.style
333
+ },
334
+ children: /* @__PURE__ */ g("div", {
335
+ className: "flex items-center justify-center",
336
+ children: /* @__PURE__ */ g(i, {
337
+ checked: O,
338
+ onCheckedChange: r
339
+ })
340
+ })
341
+ }) : null,
342
+ a.map((e) => A(e, o)),
343
+ v || S !== void 0 ? /* @__PURE__ */ g("th", {
344
+ "data-column-key": F,
345
+ "data-fixed-side": D ? "right" : void 0,
346
+ className: `p-1 text-center align-middle ${I.className}`,
347
+ style: {
348
+ minWidth: "32px",
349
+ ...I.style
350
+ },
351
+ children: S
352
+ }) : null
353
+ ] })
354
+ });
355
+ }
356
+ //#endregion
357
+ //#region src/components/core/table/TablePagination.tsx
358
+ var H = "…";
359
+ function U(e, t) {
360
+ return Array.from({ length: t - e + 1 }, (t, n) => e + n);
361
+ }
362
+ function W(e, t, n = 1) {
363
+ if (n * 2 + 5 >= t) return U(1, t);
364
+ let r = Math.max(e - n, 1), i = Math.min(e + n, t), a = r > 2, o = i < t - 1;
365
+ return !a && o ? [
366
+ ...U(1, n + 2),
367
+ H,
368
+ t
369
+ ] : a && !o ? [
370
+ 1,
371
+ H,
372
+ ...U(t - (n + 2) + 1, t)
373
+ ] : [
374
+ 1,
375
+ H,
376
+ ...U(r, i),
377
+ H,
378
+ t
379
+ ];
380
+ }
381
+ function G({ totalItems: e, startIndex: t, endIndex: n, pageSize: r, setPageSize: i, currentPage: a, setCurrentPage: p, pageSizeOptions: m, totalPages: v }) {
382
+ let { t: y } = s(), b = W(a, v);
383
+ return /* @__PURE__ */ _("div", {
384
+ 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",
385
+ children: [
386
+ /* @__PURE__ */ _("div", {
387
+ className: "text-sm text-muted-foreground justify-self-start",
388
+ children: [
389
+ e === 0 ? "0" : `${String(t + 1)} - ${String(n)}`,
390
+ " sur ",
391
+ e
392
+ ]
393
+ }),
394
+ /* @__PURE__ */ g("div", {
395
+ className: "flex items-center justify-center gap-1",
396
+ children: v > 1 && /* @__PURE__ */ _(h, { children: [
397
+ /* @__PURE__ */ g(o, {
398
+ variant: "ghost",
399
+ size: "icon",
400
+ className: "h-8 w-8 rounded-control",
401
+ onClick: () => {
402
+ p((e) => Math.max(1, e - 1));
403
+ },
404
+ disabled: a === 1,
405
+ "aria-label": y("table.previousPage"),
406
+ children: /* @__PURE__ */ g(S, { className: "size-4" })
407
+ }),
408
+ b.map((e, t) => e === H ? /* @__PURE__ */ g("span", {
409
+ className: "flex h-8 w-8 items-center justify-center text-sm text-muted-foreground",
410
+ children: H
411
+ }, `dots-${String(t)}`) : /* @__PURE__ */ g(o, {
412
+ variant: e === a ? "default" : "ghost",
413
+ size: "icon",
414
+ className: "h-8 w-8 rounded-control text-sm",
415
+ onClick: () => {
416
+ p(e);
417
+ },
418
+ "aria-current": e === a ? "page" : void 0,
419
+ children: e
420
+ }, e)),
421
+ /* @__PURE__ */ g(o, {
422
+ variant: "ghost",
423
+ size: "icon",
424
+ className: "h-8 w-8 rounded-control",
425
+ onClick: () => {
426
+ p((e) => Math.min(v, e + 1));
427
+ },
428
+ disabled: a === v,
429
+ "aria-label": y("table.nextPage"),
430
+ children: /* @__PURE__ */ g(C, { className: "size-4" })
431
+ })
432
+ ] })
433
+ }),
434
+ /* @__PURE__ */ g("div", {
435
+ className: "justify-self-end",
436
+ children: /* @__PURE__ */ _(d, {
437
+ value: String(r),
438
+ onValueChange: (e) => {
439
+ i(Number(e)), p(1);
440
+ },
441
+ children: [/* @__PURE__ */ g(l, {
442
+ className: "h-8 w-[110px] text-sm",
443
+ children: /* @__PURE__ */ g(f, {})
444
+ }), /* @__PURE__ */ g(u, { children: m.map((e) => /* @__PURE__ */ _(c, {
445
+ value: String(e),
446
+ children: [e, " / page"]
447
+ }, e)) })]
448
+ })
449
+ })
450
+ ]
451
+ });
452
+ }
453
+ //#endregion
454
+ //#region src/components/core/table/TableSettings.tsx
455
+ function K({ columns: e, visibleColumns: i, toggleColumnVisibility: s }) {
456
+ return /* @__PURE__ */ _(a, { children: [/* @__PURE__ */ g(t, {
457
+ asChild: !0,
458
+ children: /* @__PURE__ */ g(o, {
459
+ variant: "outline",
460
+ size: "sm",
461
+ className: "size-7 p-0 bg-white hover:bg-gray-100 dark:bg-gray-900 shadow-sm border-gray-200 dark:border-gray-800",
462
+ children: /* @__PURE__ */ g(D, { className: "size-3.5 text-gray-600 dark:text-gray-300" })
463
+ })
464
+ }), /* @__PURE__ */ g(r, {
465
+ align: "end",
466
+ className: "w-56",
467
+ children: e.map((e) => /* @__PURE__ */ g(n, {
468
+ checked: i.has(e.key),
469
+ onCheckedChange: () => {
470
+ s(e.key);
471
+ },
472
+ children: e.label
473
+ }, e.key))
474
+ })] });
475
+ }
476
+ //#endregion
477
+ //#region src/components/core/table/DataTable.tsx
478
+ function q({ data: e, columns: t, getRowId: n, onRowClick: r, actions: i, bulkActions: a, draggableColumns: o = !1, resizableColumns: s = !1, columnVisibility: c = !1, isLoading: l = !1, error: u = null, bordered: d = !1, fixedActions: f = !1, noDataMessage: h, defaultPageSize: v = k, pageSizeOptions: y = O, totalRows: b, currentPage: x, pageSize: S, onPageChange: C, onPageSizeChange: w, sortColumn: T, sortDirection: E, onSortChange: D }) {
479
+ let { sortColumn: A, sortDirection: j, selectedRows: M, setSelectedRows: N, visibleColumns: P, columnWidths: F, safeCurrentPage: I, totalPages: L, startIndex: B, endIndex: H, tableRef: U, hasActions: W, hasBulkActions: q, visibleColumnsArray: J, colSpanCount: Y, paginatedData: X, handleSort: Z, handleMouseDown: Q, handleDragStart: ee, handleDragOver: te, handleDrop: ne, toggleColumnVisibility: re, toggleRowSelection: ie, toggleSelectAll: ae, pageSize: oe, setPageSize: se, setCurrentPage: ce } = p({
480
+ data: e,
481
+ columns: t,
482
+ getRowId: n,
483
+ defaultPageSize: v,
484
+ actions: i,
485
+ bulkActions: a,
486
+ columnVisibility: c,
487
+ totalRows: b,
488
+ currentPage: x,
489
+ pageSize: S,
490
+ onPageChange: C,
491
+ onPageSizeChange: w,
492
+ sortColumn: T,
493
+ sortDirection: E,
494
+ onSortChange: D
495
+ }), le = q && J.some((e) => e.fixed === "left"), $ = m(U);
496
+ return /* @__PURE__ */ _("div", {
497
+ className: "space-y-4 [--k-radius-control:var(--k-radius-control-dense,0.5rem)] [--k-radius-surface:var(--k-radius-surface-dense,0.75rem)]",
498
+ children: [M.length > 0 && a !== void 0 && a.length > 0 && /* @__PURE__ */ g(z, {
499
+ selectedRows: M,
500
+ setSelectedRows: N,
501
+ bulkActions: a
502
+ }), /* @__PURE__ */ _("div", {
503
+ className: "w-full bg-card dark:bg-gray-950 rounded-surface border border-gray-200 dark:border-gray-800 overflow-hidden",
504
+ children: [/* @__PURE__ */ g("div", {
505
+ className: "overflow-x-auto",
506
+ children: /* @__PURE__ */ _("table", {
507
+ ref: U,
508
+ className: "w-full",
509
+ children: [/* @__PURE__ */ g(V, {
510
+ hasBulkActions: q,
511
+ selectedRows: M,
512
+ totalItems: e.length,
513
+ toggleSelectAll: ae,
514
+ visibleColumnsArray: J,
515
+ draggableColumns: o,
516
+ resizableColumns: s,
517
+ columnWidths: F,
518
+ sortColumn: A,
519
+ sortDirection: j,
520
+ handleSort: Z,
521
+ handleDragStart: ee,
522
+ handleDragOver: te,
523
+ handleDrop: ne,
524
+ handleMouseDown: Q,
525
+ hasActions: W,
526
+ bordered: d,
527
+ fixedColumns: $,
528
+ fixedSelection: le,
529
+ fixedActions: f,
530
+ settingsNode: c ? /* @__PURE__ */ g(K, {
531
+ columns: t,
532
+ visibleColumns: P,
533
+ toggleColumnVisibility: re
534
+ }) : void 0
535
+ }), /* @__PURE__ */ g(R, {
536
+ bordered: d,
537
+ isLoading: l,
538
+ error: u,
539
+ colSpanCount: Y,
540
+ noDataMessage: h,
541
+ paginatedData: X,
542
+ getRowId: n,
543
+ onRowClick: r,
544
+ hasBulkActions: q,
545
+ selectedRows: M,
546
+ toggleRowSelection: ie,
547
+ visibleColumnsArray: J,
548
+ columnWidths: F,
549
+ hasActions: W || c,
550
+ actions: i,
551
+ columns: t,
552
+ resizableColumns: s,
553
+ fixedColumns: $
554
+ })]
555
+ })
556
+ }), /* @__PURE__ */ g(G, {
557
+ totalItems: b ?? e.length,
558
+ startIndex: B,
559
+ endIndex: H,
560
+ pageSize: oe,
561
+ setPageSize: se,
562
+ currentPage: I,
563
+ setCurrentPage: ce,
564
+ pageSizeOptions: y,
565
+ totalPages: L
566
+ })]
567
+ })]
568
+ });
569
+ }
570
+ //#endregion
571
+ export { z as a, P as c, M as d, A as f, V as i, L as l, K as n, R as o, G as r, F as s, q as t, N as u };