@krosoft/react 0.0.238 → 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 +2 -2
  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
@@ -1,638 +0,0 @@
1
- import { jsxs as d, jsx as e, Fragment as pe } from "react/jsx-runtime";
2
- import { u as ye, a as xe } from "./useFixedColumns-CKZyu4PD.js";
3
- import "date-fns/locale";
4
- import "react-i18next";
5
- import { u as K } from "./useKrosoftTranslation-BTp46G94.js";
6
- import { a3 as J, ah as P, a5 as q, a7 as be, E as Q, a4 as ve } from "./toggle-group-iZqnrTj7.js";
7
- import "./alert-B9F1N9Qk.js";
8
- import "@radix-ui/react-aspect-ratio";
9
- import { B as k } from "./tooltip-DVeqVwqV.js";
10
- import "./chart-DntJZGxB.js";
11
- import "@radix-ui/react-collapsible";
12
- import "./sheet-XYI-ezvY.js";
13
- import { MoreVerticalIcon as Ne, Loader2Icon as ke, AlertTriangleIcon as Se, GripVerticalIcon as Ce, ArrowUpIcon as we, ArrowDownIcon as ze, ArrowUpDownIcon as De, ChevronLeftIcon as Ie, ChevronRightIcon as je, SettingsIcon as Ae } from "lucide-react";
14
- import "react-resizable-panels";
15
- import "clsx";
16
- import "tailwind-merge";
17
- import { S as Te, h as $e, i as Me, a as _e, c as Ee } from "./select-BpjFWqAY.js";
18
- import "next-themes";
19
- import "sonner";
20
- import "react";
21
- const X = [5, 10, 30, 50, 100], Le = X[1];
22
- function Be({ actions: a, row: t }) {
23
- const i = a.filter((r) => r.visible === void 0 || r.visible(t));
24
- if (i.length === 0)
25
- return null;
26
- const o = i.filter((r) => r.overflow !== !0), m = i.filter((r) => r.overflow === !0);
27
- return /* @__PURE__ */ d("div", { className: "flex items-center justify-center gap-1", children: [
28
- o.map((r, c) => {
29
- var h;
30
- const g = r.icon;
31
- return /* @__PURE__ */ d(
32
- k,
33
- {
34
- variant: r.variant ?? "ghost",
35
- size: "sm",
36
- disabled: ((h = r.disabled) == null ? void 0 : h.call(r, t)) ?? !1,
37
- className: `h-7 px-2 text-muted-foreground hover:text-foreground ${r.className ?? ""}`,
38
- onClick: (u) => {
39
- u.stopPropagation(), r.onClick(t);
40
- },
41
- children: [
42
- g !== void 0 && /* @__PURE__ */ e(g, { className: "size-3.5" }),
43
- r.label
44
- ]
45
- },
46
- c
47
- );
48
- }),
49
- m.length > 0 && /* @__PURE__ */ d(J, { children: [
50
- /* @__PURE__ */ e(P, { asChild: !0, children: /* @__PURE__ */ e(k, { variant: "ghost", size: "icon", className: "h-7 w-7 text-muted-foreground hover:text-foreground", children: /* @__PURE__ */ e(Ne, { className: "size-3.5" }) }) }),
51
- /* @__PURE__ */ e(
52
- q,
53
- {
54
- align: "end",
55
- onClick: (r) => {
56
- r.stopPropagation();
57
- },
58
- children: m.map((r, c) => {
59
- var h;
60
- const g = r.icon;
61
- return /* @__PURE__ */ d(
62
- be,
63
- {
64
- disabled: ((h = r.disabled) == null ? void 0 : h.call(r, t)) ?? !1,
65
- onClick: () => {
66
- r.onClick(t);
67
- },
68
- className: r.className,
69
- children: [
70
- g !== void 0 && /* @__PURE__ */ e("span", { className: "mr-2 size-4 flex items-center justify-center", children: /* @__PURE__ */ e(g, { className: "size-4" }) }),
71
- r.label
72
- ]
73
- },
74
- c
75
- );
76
- })
77
- }
78
- )
79
- ] })
80
- ] });
81
- }
82
- const Fe = {
83
- left: "text-left",
84
- center: "text-center",
85
- right: "text-right"
86
- };
87
- function Z(a) {
88
- if (a.align !== void 0) return a.align;
89
- const t = (a.className ?? "").split(/\s+/);
90
- return t.includes("text-right") ? "right" : t.includes("text-center") ? "center" : "left";
91
- }
92
- function ee(a) {
93
- return Fe[a];
94
- }
95
- const H = "__selection__", V = "__actions__", Oe = {
96
- left: "border-r border-gray-200 dark:border-gray-800",
97
- right: "border-l border-gray-200 dark:border-gray-800"
98
- };
99
- function A(a, t) {
100
- if (a === void 0) return { className: "relative", style: {} };
101
- const i = t === "header";
102
- return {
103
- className: [
104
- "sticky bg-card dark:bg-gray-950",
105
- // L'en-tête doit passer au-dessus des cellules figées du corps quand elles se croisent.
106
- i ? "z-20" : "z-10",
107
- "before:absolute before:inset-0 before:-z-10 before:pointer-events-none",
108
- i ? "before:bg-muted/50 dark:before:bg-gray-900/50" : "group-hover:before:bg-muted/50 dark:group-hover:before:bg-gray-900/50",
109
- // Séparation posée du seul côté qui donne sur la zone qui défile.
110
- a.isEdge ? Oe[a.side] : ""
111
- ].filter(Boolean).join(" "),
112
- style: a.side === "left" ? { left: a.offset } : { right: a.offset }
113
- };
114
- }
115
- function We({
116
- isLoading: a,
117
- error: t,
118
- colSpanCount: i,
119
- noDataMessage: o,
120
- paginatedData: m,
121
- getRowId: r,
122
- onRowClick: c,
123
- hasBulkActions: g,
124
- selectedRows: h,
125
- toggleRowSelection: u,
126
- visibleColumnsArray: b,
127
- columnWidths: n,
128
- hasActions: S,
129
- actions: C,
130
- columns: T,
131
- bordered: $ = !1,
132
- resizableColumns: w = !1,
133
- fixedColumns: z = {}
134
- }) {
135
- const { t: v } = K(), M = (f, p) => {
136
- const l = T.find((s) => s.key === p);
137
- if ((l == null ? void 0 : l.renderCell) !== void 0)
138
- return l.renderCell(f);
139
- const y = f[p];
140
- return /* @__PURE__ */ e("span", { className: "text-sm truncate", children: y != null ? String(y) : "-" });
141
- };
142
- if (a)
143
- return /* @__PURE__ */ e("tbody", { className: "divide-y divide-gray-200 dark:divide-gray-800", children: /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: i, className: "py-8 text-center", children: /* @__PURE__ */ d("div", { className: "flex flex-col items-center justify-center gap-2 text-muted-foreground", children: [
144
- /* @__PURE__ */ e(ke, { className: "h-6 w-6 animate-spin text-primary" }),
145
- /* @__PURE__ */ e("span", { className: "text-sm", children: v("states.loading") })
146
- ] }) }) }) });
147
- if (t)
148
- return /* @__PURE__ */ e("tbody", { className: "divide-y divide-gray-200 dark:divide-gray-800", children: /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: i, className: "py-8 text-center", children: /* @__PURE__ */ d("div", { className: "flex flex-col items-center justify-center gap-2 text-destructive", children: [
149
- /* @__PURE__ */ e(Se, { className: "h-6 w-6" }),
150
- /* @__PURE__ */ e("span", { className: "text-sm", children: t })
151
- ] }) }) }) });
152
- if (m.length === 0)
153
- return /* @__PURE__ */ e("tbody", { className: "divide-y divide-gray-200 dark:divide-gray-800", children: /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: i, className: "py-8 text-center text-sm text-muted-foreground", children: o ?? v("states.noResult") }) }) });
154
- const D = A(z[H], "body"), N = A(z[V], "body");
155
- return /* @__PURE__ */ e("tbody", { className: "divide-y divide-gray-200 dark:divide-gray-800", children: m.map((f) => {
156
- const p = r(f);
157
- return /* @__PURE__ */ d(
158
- "tr",
159
- {
160
- className: `group hover:bg-muted/50 dark:hover:bg-gray-900/50 transition-colors ${c !== void 0 ? "cursor-pointer" : ""}`,
161
- onClick: (l) => c == null ? void 0 : c(f, l),
162
- children: [
163
- g ? /* @__PURE__ */ e(
164
- "td",
165
- {
166
- className: `p-1 text-center align-middle ${D.className}`,
167
- style: { width: "32px", minWidth: "32px", maxWidth: "32px", ...D.style },
168
- onClick: (l) => {
169
- l.stopPropagation();
170
- },
171
- children: /* @__PURE__ */ e("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ e(
172
- Q,
173
- {
174
- checked: h.includes(p),
175
- onCheckedChange: () => {
176
- u(p);
177
- }
178
- }
179
- ) })
180
- }
181
- ) : null,
182
- b.map((l, y) => {
183
- const s = y === b.length - 1, I = A(z[l.key], "body");
184
- return /* @__PURE__ */ e(
185
- "td",
186
- {
187
- className: `px-2 py-2 ${ee(Z(l))} ${I.className} ${$ && !s ? "border-r border-gray-100 dark:border-gray-800" : ""} ${l.className ?? ""}`,
188
- style: {
189
- ...w ? { width: n[l.key] } : { minWidth: n[l.key] },
190
- ...I.style
191
- },
192
- children: /* @__PURE__ */ e("div", { className: "w-full h-full", children: M(f, l.key) })
193
- },
194
- l.key
195
- );
196
- }),
197
- S ? /* @__PURE__ */ e(
198
- "td",
199
- {
200
- className: `p-1 text-center align-middle whitespace-nowrap ${N.className}`,
201
- style: { minWidth: "32px", ...N.style },
202
- onClick: (l) => {
203
- l.stopPropagation();
204
- },
205
- children: C !== void 0 && C.length > 0 ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ e(Be, { actions: C, row: f }) }) : null
206
- }
207
- ) : null
208
- ]
209
- },
210
- p
211
- );
212
- }) });
213
- }
214
- function Ue({ selectedRows: a, setSelectedRows: t, bulkActions: i }) {
215
- return /* @__PURE__ */ d("div", { className: "bg-muted/60 dark:bg-gray-900/60 border border-border px-3 py-1.5 flex items-center justify-between rounded-surface", children: [
216
- /* @__PURE__ */ d("div", { className: "flex items-center gap-4", children: [
217
- /* @__PURE__ */ d("span", { className: "text-sm font-medium text-primary ml-1", children: [
218
- a.length,
219
- " sélectionné(s)"
220
- ] }),
221
- /* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: i.map((o, m) => {
222
- const r = o.icon;
223
- return /* @__PURE__ */ d(
224
- k,
225
- {
226
- variant: "outline",
227
- size: "sm",
228
- onClick: () => {
229
- o.onClick(a, () => {
230
- t([]);
231
- });
232
- },
233
- className: `h-7 bg-background shadow-sm text-xs px-2.5 ${o.variant === "destructive" ? "text-destructive border-destructive/30 hover:bg-destructive/10 hover:text-destructive" : "text-foreground"}`,
234
- children: [
235
- 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" }) }),
236
- o.label
237
- ]
238
- },
239
- m
240
- );
241
- }) })
242
- ] }),
243
- /* @__PURE__ */ e(
244
- k,
245
- {
246
- variant: "ghost",
247
- size: "sm",
248
- onClick: () => {
249
- t([]);
250
- },
251
- className: "text-xs text-muted-foreground hover:text-foreground h-7 px-2",
252
- children: "Désélectionner"
253
- }
254
- )
255
- ] });
256
- }
257
- const He = {
258
- left: "justify-start",
259
- center: "justify-center",
260
- right: "justify-end"
261
- };
262
- function Ve({
263
- hasBulkActions: a,
264
- selectedRows: t,
265
- totalItems: i,
266
- toggleSelectAll: o,
267
- visibleColumnsArray: m,
268
- draggableColumns: r,
269
- resizableColumns: c,
270
- columnWidths: g,
271
- sortColumn: h,
272
- sortDirection: u,
273
- handleSort: b,
274
- handleDragStart: n,
275
- handleDragOver: S,
276
- handleDrop: C,
277
- handleMouseDown: T,
278
- hasActions: $,
279
- settingsNode: w,
280
- bordered: z = !1,
281
- fixedColumns: v = {},
282
- fixedSelection: M = !1,
283
- fixedActions: D = !1
284
- }) {
285
- let N = !1;
286
- t.length === i && i > 0 ? N = !0 : t.length > 0 && (N = "indeterminate");
287
- const f = (s) => s.sortable !== !0 ? null : h === s.key ? u === "asc" ? /* @__PURE__ */ e(we, { className: "size-3.5 text-foreground" }) : /* @__PURE__ */ e(ze, { className: "size-3.5 text-foreground" }) : /* @__PURE__ */ e(De, { className: "size-3.5 text-muted-foreground/50 group-hover:text-muted-foreground transition-colors" }), p = (s, I) => {
288
- const _ = I !== !1 && s.fixed === void 0, E = s.sortable === !0, L = A(v[s.key], "header"), B = Z(s), F = f(s);
289
- return /* @__PURE__ */ d(
290
- "th",
291
- {
292
- "data-column-key": s.key,
293
- "data-fixed-side": s.fixed,
294
- className: [
295
- "px-2 py-2 text-sm font-medium text-gray-900 dark:text-gray-100 group",
296
- ee(B),
297
- L.className,
298
- z ? "border-r border-gray-200 dark:border-gray-800" : "",
299
- E ? "cursor-pointer select-none" : "",
300
- s.className ?? ""
301
- ].filter(Boolean).join(" "),
302
- style: {
303
- ...c ? { width: g[s.key] } : { minWidth: g[s.key] },
304
- ...L.style
305
- },
306
- draggable: _,
307
- onClick: () => {
308
- b(s.key);
309
- },
310
- onDragStart: (x) => {
311
- _ ? n(x, s.key) : x.preventDefault();
312
- },
313
- onDragOver: (x) => {
314
- S(x, s.key);
315
- },
316
- onDrop: (x) => {
317
- C(x, s.key);
318
- },
319
- children: [
320
- /* @__PURE__ */ d("div", { className: `flex items-center gap-1 ${He[B]} ${c ? "pr-2" : ""}`, children: [
321
- _ ? /* @__PURE__ */ e(Ce, { className: "size-4 text-gray-400 cursor-grab dark:text-gray-300 shrink-0" }) : null,
322
- /* @__PURE__ */ e("span", { className: "truncate", children: s.label }),
323
- F !== null ? /* @__PURE__ */ e("span", { className: "ml-1 shrink-0", children: F }) : null
324
- ] }),
325
- c ? /* @__PURE__ */ e(
326
- "div",
327
- {
328
- 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",
329
- onMouseDown: (x) => {
330
- T(x, s.key);
331
- }
332
- }
333
- ) : null
334
- ]
335
- },
336
- s.key
337
- );
338
- }, l = A(v[H], "header"), y = A(v[V], "header");
339
- return /* @__PURE__ */ e("thead", { className: "bg-muted/50 dark:bg-gray-900/50 border-b border-gray-200 dark:border-gray-800", children: /* @__PURE__ */ d("tr", { children: [
340
- a ? /* @__PURE__ */ e(
341
- "th",
342
- {
343
- "data-column-key": H,
344
- "data-fixed-side": M ? "left" : void 0,
345
- className: `p-1 flex-shrink-0 text-center align-middle ${l.className}`,
346
- style: { width: "32px", minWidth: "32px", maxWidth: "32px", ...l.style },
347
- children: /* @__PURE__ */ e("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ e(Q, { checked: N, onCheckedChange: o }) })
348
- }
349
- ) : null,
350
- m.map((s) => p(s, r)),
351
- $ || w !== void 0 ? /* @__PURE__ */ e(
352
- "th",
353
- {
354
- "data-column-key": V,
355
- "data-fixed-side": D ? "right" : void 0,
356
- className: `p-1 text-center align-middle ${y.className}`,
357
- style: { minWidth: "32px", ...y.style },
358
- children: w
359
- }
360
- ) : null
361
- ] }) });
362
- }
363
- const j = "…";
364
- function O(a, t) {
365
- return Array.from({ length: t - a + 1 }, (i, o) => a + o);
366
- }
367
- function Re(a, t, i = 1) {
368
- if (i * 2 + 5 >= t)
369
- return O(1, t);
370
- const m = Math.max(a - i, 1), r = Math.min(a + i, t), c = m > 2, g = r < t - 1;
371
- if (!c && g)
372
- return [...O(1, i + 2), j, t];
373
- if (c && !g) {
374
- const h = O(t - (i + 2) + 1, t);
375
- return [1, j, ...h];
376
- }
377
- return [1, j, ...O(m, r), j, t];
378
- }
379
- function Ye({
380
- totalItems: a,
381
- startIndex: t,
382
- endIndex: i,
383
- pageSize: o,
384
- setPageSize: m,
385
- currentPage: r,
386
- setCurrentPage: c,
387
- pageSizeOptions: g,
388
- totalPages: h
389
- }) {
390
- const { t: u } = K(), b = Re(r, h);
391
- return /* @__PURE__ */ d("div", { 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", children: [
392
- /* @__PURE__ */ d("div", { className: "text-sm text-muted-foreground justify-self-start", children: [
393
- a === 0 ? "0" : `${String(t + 1)} - ${String(i)}`,
394
- " sur ",
395
- a
396
- ] }),
397
- /* @__PURE__ */ e("div", { className: "flex items-center justify-center gap-1", children: h > 1 && /* @__PURE__ */ d(pe, { children: [
398
- /* @__PURE__ */ e(
399
- k,
400
- {
401
- variant: "ghost",
402
- size: "icon",
403
- className: "h-8 w-8 rounded-control",
404
- onClick: () => {
405
- c((n) => Math.max(1, n - 1));
406
- },
407
- disabled: r === 1,
408
- "aria-label": u("table.previousPage"),
409
- children: /* @__PURE__ */ e(Ie, { className: "size-4" })
410
- }
411
- ),
412
- b.map(
413
- (n, S) => n === j ? /* @__PURE__ */ e("span", { className: "flex h-8 w-8 items-center justify-center text-sm text-muted-foreground", children: j }, `dots-${String(S)}`) : /* @__PURE__ */ e(
414
- k,
415
- {
416
- variant: n === r ? "default" : "ghost",
417
- size: "icon",
418
- className: "h-8 w-8 rounded-control text-sm",
419
- onClick: () => {
420
- c(n);
421
- },
422
- "aria-current": n === r ? "page" : void 0,
423
- children: n
424
- },
425
- n
426
- )
427
- ),
428
- /* @__PURE__ */ e(
429
- k,
430
- {
431
- variant: "ghost",
432
- size: "icon",
433
- className: "h-8 w-8 rounded-control",
434
- onClick: () => {
435
- c((n) => Math.min(h, n + 1));
436
- },
437
- disabled: r === h,
438
- "aria-label": u("table.nextPage"),
439
- children: /* @__PURE__ */ e(je, { className: "size-4" })
440
- }
441
- )
442
- ] }) }),
443
- /* @__PURE__ */ e("div", { className: "justify-self-end", children: /* @__PURE__ */ d(
444
- Te,
445
- {
446
- value: String(o),
447
- onValueChange: (n) => {
448
- m(Number(n)), c(1);
449
- },
450
- children: [
451
- /* @__PURE__ */ e($e, { className: "h-8 w-[110px] text-sm", children: /* @__PURE__ */ e(Me, {}) }),
452
- /* @__PURE__ */ e(_e, { children: g.map((n) => /* @__PURE__ */ d(Ee, { value: String(n), children: [
453
- n,
454
- " / page"
455
- ] }, n)) })
456
- ]
457
- }
458
- ) })
459
- ] });
460
- }
461
- function Ge({ columns: a, visibleColumns: t, toggleColumnVisibility: i }) {
462
- return /* @__PURE__ */ d(J, { children: [
463
- /* @__PURE__ */ e(P, { asChild: !0, children: /* @__PURE__ */ e(k, { 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(Ae, { className: "size-3.5 text-gray-600 dark:text-gray-300" }) }) }),
464
- /* @__PURE__ */ e(q, { align: "end", className: "w-56", children: a.map((o) => /* @__PURE__ */ e(
465
- ve,
466
- {
467
- checked: t.has(o.key),
468
- onCheckedChange: () => {
469
- i(o.key);
470
- },
471
- children: o.label
472
- },
473
- o.key
474
- )) })
475
- ] });
476
- }
477
- function mr({
478
- data: a,
479
- columns: t,
480
- getRowId: i,
481
- onRowClick: o,
482
- actions: m,
483
- bulkActions: r,
484
- draggableColumns: c = !1,
485
- resizableColumns: g = !1,
486
- columnVisibility: h = !1,
487
- isLoading: u = !1,
488
- error: b = null,
489
- bordered: n = !1,
490
- fixedActions: S = !1,
491
- noDataMessage: C,
492
- defaultPageSize: T = Le,
493
- pageSizeOptions: $ = X,
494
- totalRows: w,
495
- currentPage: z,
496
- pageSize: v,
497
- onPageChange: M,
498
- onPageSizeChange: D,
499
- sortColumn: N,
500
- sortDirection: f,
501
- onSortChange: p
502
- }) {
503
- const {
504
- sortColumn: l,
505
- sortDirection: y,
506
- selectedRows: s,
507
- setSelectedRows: I,
508
- visibleColumns: _,
509
- columnWidths: E,
510
- safeCurrentPage: L,
511
- totalPages: B,
512
- startIndex: F,
513
- endIndex: x,
514
- tableRef: R,
515
- hasActions: Y,
516
- hasBulkActions: W,
517
- visibleColumnsArray: U,
518
- colSpanCount: re,
519
- paginatedData: te,
520
- handleSort: ae,
521
- handleMouseDown: se,
522
- handleDragStart: ie,
523
- handleDragOver: ne,
524
- handleDrop: le,
525
- toggleColumnVisibility: de,
526
- toggleRowSelection: oe,
527
- toggleSelectAll: ce,
528
- pageSize: he,
529
- setPageSize: ge,
530
- setCurrentPage: me
531
- } = ye({
532
- data: a,
533
- columns: t,
534
- getRowId: i,
535
- defaultPageSize: T,
536
- actions: m,
537
- bulkActions: r,
538
- columnVisibility: h,
539
- totalRows: w,
540
- currentPage: z,
541
- pageSize: v,
542
- onPageChange: M,
543
- onPageSizeChange: D,
544
- sortColumn: N,
545
- sortDirection: f,
546
- onSortChange: p
547
- }), fe = W && U.some((ue) => ue.fixed === "left"), G = xe(R);
548
- return (
549
- // Le tableau suit le preset de l'application — square reste square — mais
550
- // bascule sur les valeurs plafonnées : ni ses contrôles ni son cadre ne
551
- // prennent la forme capsule. Le scope couvre le cadre, les actions
552
- // groupées et la pagination. Les fallbacks correspondent au preset "soft".
553
- /* @__PURE__ */ d("div", { className: "space-y-4 [--k-radius-control:var(--k-radius-control-dense,0.5rem)] [--k-radius-surface:var(--k-radius-surface-dense,0.75rem)]", children: [
554
- s.length > 0 && r !== void 0 && r.length > 0 && /* @__PURE__ */ e(Ue, { selectedRows: s, setSelectedRows: I, bulkActions: r }),
555
- /* @__PURE__ */ d("div", { className: "w-full bg-card dark:bg-gray-950 rounded-surface border border-gray-200 dark:border-gray-800 overflow-hidden", children: [
556
- /* @__PURE__ */ e("div", { className: "overflow-x-auto", children: /* @__PURE__ */ d("table", { ref: R, className: "w-full", children: [
557
- /* @__PURE__ */ e(
558
- Ve,
559
- {
560
- hasBulkActions: W,
561
- selectedRows: s,
562
- totalItems: a.length,
563
- toggleSelectAll: ce,
564
- visibleColumnsArray: U,
565
- draggableColumns: c,
566
- resizableColumns: g,
567
- columnWidths: E,
568
- sortColumn: l,
569
- sortDirection: y,
570
- handleSort: ae,
571
- handleDragStart: ie,
572
- handleDragOver: ne,
573
- handleDrop: le,
574
- handleMouseDown: se,
575
- hasActions: Y,
576
- bordered: n,
577
- fixedColumns: G,
578
- fixedSelection: fe,
579
- fixedActions: S,
580
- settingsNode: h ? /* @__PURE__ */ e(Ge, { columns: t, visibleColumns: _, toggleColumnVisibility: de }) : void 0
581
- }
582
- ),
583
- /* @__PURE__ */ e(
584
- We,
585
- {
586
- bordered: n,
587
- isLoading: u,
588
- error: b,
589
- colSpanCount: re,
590
- noDataMessage: C,
591
- paginatedData: te,
592
- getRowId: i,
593
- onRowClick: o,
594
- hasBulkActions: W,
595
- selectedRows: s,
596
- toggleRowSelection: oe,
597
- visibleColumnsArray: U,
598
- columnWidths: E,
599
- hasActions: Y || h,
600
- actions: m,
601
- columns: t,
602
- resizableColumns: g,
603
- fixedColumns: G
604
- }
605
- )
606
- ] }) }),
607
- /* @__PURE__ */ e(
608
- Ye,
609
- {
610
- totalItems: w ?? a.length,
611
- startIndex: F,
612
- endIndex: x,
613
- pageSize: he,
614
- setPageSize: ge,
615
- currentPage: L,
616
- setCurrentPage: me,
617
- pageSizeOptions: $,
618
- totalPages: B
619
- }
620
- )
621
- ] })
622
- ] })
623
- );
624
- }
625
- export {
626
- V as A,
627
- mr as D,
628
- H as S,
629
- Be as T,
630
- We as a,
631
- Ue as b,
632
- Ve as c,
633
- Ye as d,
634
- Ge as e,
635
- Z as f,
636
- ee as g,
637
- A as h
638
- };
@@ -1,23 +0,0 @@
1
- import { jsxs as r, jsx as e } from "react/jsx-runtime";
2
- import "date-fns/locale";
3
- import "react-i18next";
4
- import { u as a } from "./useKrosoftTranslation-BTp46G94.js";
5
- import { A as n, a as c } from "./alert-B9F1N9Qk.js";
6
- import { AlertTriangle as o } from "lucide-react";
7
- const x = ({ error: s }) => {
8
- const { t: i } = a();
9
- return s ? /* @__PURE__ */ r(n, { variant: "destructive", children: [
10
- /* @__PURE__ */ e(o, { className: "size-4" }),
11
- /* @__PURE__ */ r(c, { children: [
12
- /* @__PURE__ */ r("div", { className: "flex items-center space-x-2", children: [
13
- /* @__PURE__ */ e("span", { className: "font-semibold", children: i("states.errorPrefix") }),
14
- /* @__PURE__ */ e("span", { children: s.code }),
15
- /* @__PURE__ */ e("span", { children: s.message })
16
- ] }),
17
- s.errors && s.errors.length > 0 && /* @__PURE__ */ e("ul", { className: "mt-2 list-disc list-inside", children: s.errors.map((t, l) => /* @__PURE__ */ e("li", { children: t }, l)) })
18
- ] })
19
- ] }) : null;
20
- };
21
- export {
22
- x as E
23
- };
@@ -1,14 +0,0 @@
1
- import { jsxs as o, jsx as t } from "react/jsx-runtime";
2
- import "date-fns/locale";
3
- import "react-i18next";
4
- import { u as s } from "./useKrosoftTranslation-BTp46G94.js";
5
- const n = ({ message: r }) => {
6
- const { t: e } = s();
7
- return /* @__PURE__ */ o("div", { className: "p-6 border border-destructive bg-destructive/10 text-destructive rounded-surface animate-fade-in", children: [
8
- /* @__PURE__ */ t("p", { className: "font-semibold mb-2", children: e("states.error") }),
9
- r !== void 0 && r !== "" ? /* @__PURE__ */ t("p", { className: "text-sm opacity-80", children: r }) : null
10
- ] });
11
- };
12
- export {
13
- n as E
14
- };