@krosoft/react 0.0.217 → 0.0.219
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.
- package/README.md +31 -0
- package/dist/{AppActions-BCXERyyB.js → AppActions-BFmagl91.js} +1 -1
- package/dist/{AppSubTitle-H8ElNObI.js → AppSubTitle-BMQMoehZ.js} +1 -1
- package/dist/AppVerticalTabs-0DrrDO3S.js +101 -0
- package/dist/{ConfirmationDialog-BmxaMEYz.js → ConfirmationDialog-CFsh-Eui.js} +62 -61
- package/dist/DataTable-Cpbp6yse.js +551 -0
- package/dist/ErrorAlert-D_203tKa.js +21 -0
- package/dist/ErrorState-DfJ009uc.js +12 -0
- package/dist/GenericForm-q9dvYl_h.js +342 -0
- package/dist/ImageInput-BYXz8wM1.js +68 -0
- package/dist/{KpiCardsLayout-XZTxB8FV.js → KpiCardsLayout-B-lMaUMA.js} +4 -4
- package/dist/{MultiSelect-Cj8vgAXJ.js → MultiSelect-Dkz1dgXo.js} +52 -51
- package/dist/{PieChart-D6y5EQnh.js → PieChart-bDy_V9Xt.js} +82 -81
- package/dist/SearchInput-CJ2YZpmB.js +244 -0
- package/dist/{SkeletonCards-CYo_lvKx.js → SkeletonCards-Bg2ygjwy.js} +1 -1
- package/dist/{TableFilter-DbnGaGKL.js → TableFilter-u6F06nMx.js} +133 -130
- package/dist/ThemeSelector-BRpEgvX8.js +49 -0
- package/dist/Topbar-bIyAunNd.js +318 -0
- package/dist/components/core/cards/index.js +1 -1
- package/dist/components/core/charts/ChartCard.d.ts.map +1 -1
- package/dist/components/core/charts/index.js +1 -1
- package/dist/components/core/dialogs/FormDialog.d.ts.map +1 -1
- package/dist/components/core/dialogs/index.js +2 -2
- package/dist/components/core/filters/ActiveFilters.d.ts.map +1 -1
- package/dist/components/core/filters/AdvancedFilters.d.ts.map +1 -1
- package/dist/components/core/filters/FilterField.d.ts.map +1 -1
- package/dist/components/core/filters/SearchableFilterPill.d.ts.map +1 -1
- package/dist/components/core/filters/TableFilter.d.ts.map +1 -1
- package/dist/components/core/filters/index.js +1 -1
- package/dist/components/core/forms/GenericForm.d.ts.map +1 -1
- package/dist/components/core/forms/index.js +1 -1
- package/dist/components/core/index.js +18 -18
- package/dist/components/core/inputs/DateRangePicker.d.ts.map +1 -1
- package/dist/components/core/inputs/ImageInput.d.ts.map +1 -1
- package/dist/components/core/inputs/MultiSelect.d.ts.map +1 -1
- package/dist/components/core/inputs/SearchInput.d.ts +1 -1
- package/dist/components/core/inputs/SearchInput.d.ts.map +1 -1
- package/dist/components/core/inputs/SearchableSelect.d.ts.map +1 -1
- package/dist/components/core/inputs/index.js +3 -3
- package/dist/components/core/layouts/index.js +3 -3
- package/dist/components/core/navbar/GlobalSearch.d.ts.map +1 -1
- package/dist/components/core/navbar/Sidebar.d.ts.map +1 -1
- package/dist/components/core/navbar/index.js +1 -1
- package/dist/components/core/states/ErrorAlert.d.ts.map +1 -1
- package/dist/components/core/states/ErrorState.d.ts.map +1 -1
- package/dist/components/core/states/index.js +2 -2
- package/dist/components/core/table/DataTable.d.ts.map +1 -1
- package/dist/components/core/table/TableBody.d.ts +1 -1
- package/dist/components/core/table/TableBody.d.ts.map +1 -1
- package/dist/components/core/table/TablePagination.d.ts.map +1 -1
- package/dist/components/core/table/index.js +1 -1
- package/dist/components/core/tabs/AppVerticalTabs.d.ts.map +1 -1
- package/dist/components/core/tabs/index.js +1 -1
- package/dist/components/core/theme/ThemeSelector.d.ts.map +1 -1
- package/dist/components/core/theme/index.js +1 -1
- package/dist/components/index.js +18 -18
- package/dist/components/ui/command.d.ts.map +1 -1
- package/dist/components/ui/index.js +1 -1
- package/dist/hooks/behavior/index.js +1 -1
- package/dist/hooks/behavior/useConfirmDeleteDialog.d.ts +1 -1
- package/dist/hooks/behavior/useConfirmDeleteDialog.d.ts.map +1 -1
- package/dist/hooks/index.js +2 -2
- package/dist/hooks/ui/index.js +1 -1
- package/dist/hooks/ui/useTheme.d.ts.map +1 -1
- package/dist/i18n/index.d.ts +3 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +7 -0
- package/dist/i18n/krosoftLocales.d.ts +175 -0
- package/dist/i18n/krosoftLocales.d.ts.map +1 -0
- package/dist/i18n/useKrosoftTranslation.d.ts +15 -0
- package/dist/i18n/useKrosoftTranslation.d.ts.map +1 -0
- package/dist/providers/index.js +1 -1
- package/dist/{sheet-BQmtrGf2.js → sheet-CDqLa-FP.js} +105 -108
- package/dist/useKrosoftTranslation-DdcylBY2.js +43 -0
- package/dist/usePage-Bhb81ffo.js +82 -0
- package/dist/useTheme-Cmw14Zxi.js +25 -0
- package/package.json +1 -1
- package/dist/AppVerticalTabs-aJmAVu6F.js +0 -100
- package/dist/DataTable-0-lae9KY.js +0 -550
- package/dist/ErrorAlert-SrIcU1mM.js +0 -17
- package/dist/ErrorState-CmaxuJyW.js +0 -8
- package/dist/GenericForm-DJR7PD-i.js +0 -341
- package/dist/ImageInput-DYe2XPNZ.js +0 -67
- package/dist/SearchInput-oeq0NBIc.js +0 -251
- package/dist/ThemeSelector-BFC37dSl.js +0 -48
- package/dist/Topbar-DUq-UeR0.js +0 -306
- package/dist/usePage-BFE9lxI1.js +0 -84
- package/dist/useTheme-CSr_h5xJ.js +0 -24
|
@@ -0,0 +1,551 @@
|
|
|
1
|
+
import { jsxs as n, jsx as e, Fragment as le } from "react/jsx-runtime";
|
|
2
|
+
import { u as de } from "./useDataTable-CxcA5S-s.js";
|
|
3
|
+
import { u as B } from "./useKrosoftTranslation-DdcylBY2.js";
|
|
4
|
+
import { a3 as L, ah as V, a5 as O, a7 as ce, E as H, a4 as oe } from "./toggle-group-DLLrEwv2.js";
|
|
5
|
+
import "./alert-B9F1N9Qk.js";
|
|
6
|
+
import "@radix-ui/react-aspect-ratio";
|
|
7
|
+
import { B as b } from "./tooltip-DVeqVwqV.js";
|
|
8
|
+
import "./chart-DntJZGxB.js";
|
|
9
|
+
import "@radix-ui/react-collapsible";
|
|
10
|
+
import "./sheet-CDqLa-FP.js";
|
|
11
|
+
import { MoreVerticalIcon as he, Loader2Icon as me, AlertTriangleIcon as ge, GripVerticalIcon as ue, ArrowUpIcon as fe, ArrowDownIcon as pe, ArrowUpDownIcon as xe, ChevronLeftIcon as ve, ChevronRightIcon as ye, SettingsIcon as be } from "lucide-react";
|
|
12
|
+
import "react-resizable-panels";
|
|
13
|
+
import "clsx";
|
|
14
|
+
import "tailwind-merge";
|
|
15
|
+
import { S as Ne, h as ke, i as Se, a as we, c as ze } from "./select-BpjFWqAY.js";
|
|
16
|
+
import "next-themes";
|
|
17
|
+
import "sonner";
|
|
18
|
+
import "react";
|
|
19
|
+
const R = [5, 10, 30, 50, 100], Ce = R[1];
|
|
20
|
+
function De({ actions: l, row: a }) {
|
|
21
|
+
const s = l.filter((r) => r.visible === void 0 || r.visible(a));
|
|
22
|
+
if (s.length === 0)
|
|
23
|
+
return null;
|
|
24
|
+
const d = s.filter((r) => r.overflow !== !0), m = s.filter((r) => r.overflow === !0);
|
|
25
|
+
return /* @__PURE__ */ n("div", { className: "flex items-center justify-center gap-1", children: [
|
|
26
|
+
d.map((r, c) => {
|
|
27
|
+
var o;
|
|
28
|
+
const h = r.icon;
|
|
29
|
+
return /* @__PURE__ */ n(
|
|
30
|
+
b,
|
|
31
|
+
{
|
|
32
|
+
variant: r.variant ?? "ghost",
|
|
33
|
+
size: "sm",
|
|
34
|
+
disabled: ((o = r.disabled) == null ? void 0 : o.call(r, a)) ?? !1,
|
|
35
|
+
className: `h-7 px-2 text-muted-foreground hover:text-foreground ${r.className ?? ""}`,
|
|
36
|
+
onClick: (f) => {
|
|
37
|
+
f.stopPropagation(), r.onClick(a);
|
|
38
|
+
},
|
|
39
|
+
children: [
|
|
40
|
+
h !== void 0 && /* @__PURE__ */ e(h, { className: "size-3.5" }),
|
|
41
|
+
r.label
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
c
|
|
45
|
+
);
|
|
46
|
+
}),
|
|
47
|
+
m.length > 0 && /* @__PURE__ */ n(L, { children: [
|
|
48
|
+
/* @__PURE__ */ e(V, { asChild: !0, children: /* @__PURE__ */ e(b, { variant: "ghost", size: "icon", className: "h-7 w-7 text-muted-foreground hover:text-foreground", children: /* @__PURE__ */ e(he, { className: "size-3.5" }) }) }),
|
|
49
|
+
/* @__PURE__ */ e(
|
|
50
|
+
O,
|
|
51
|
+
{
|
|
52
|
+
align: "end",
|
|
53
|
+
onClick: (r) => {
|
|
54
|
+
r.stopPropagation();
|
|
55
|
+
},
|
|
56
|
+
children: m.map((r, c) => {
|
|
57
|
+
var o;
|
|
58
|
+
const h = r.icon;
|
|
59
|
+
return /* @__PURE__ */ n(
|
|
60
|
+
ce,
|
|
61
|
+
{
|
|
62
|
+
disabled: ((o = r.disabled) == null ? void 0 : o.call(r, a)) ?? !1,
|
|
63
|
+
onClick: () => {
|
|
64
|
+
r.onClick(a);
|
|
65
|
+
},
|
|
66
|
+
className: r.className,
|
|
67
|
+
children: [
|
|
68
|
+
h !== void 0 && /* @__PURE__ */ e("span", { className: "mr-2 size-4 flex items-center justify-center", children: /* @__PURE__ */ e(h, { className: "size-4" }) }),
|
|
69
|
+
r.label
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
c
|
|
73
|
+
);
|
|
74
|
+
})
|
|
75
|
+
}
|
|
76
|
+
)
|
|
77
|
+
] })
|
|
78
|
+
] });
|
|
79
|
+
}
|
|
80
|
+
function Ie({
|
|
81
|
+
isLoading: l,
|
|
82
|
+
error: a,
|
|
83
|
+
colSpanCount: s,
|
|
84
|
+
noDataMessage: d,
|
|
85
|
+
paginatedData: m,
|
|
86
|
+
getRowId: r,
|
|
87
|
+
onRowClick: c,
|
|
88
|
+
hasBulkActions: h,
|
|
89
|
+
selectedRows: o,
|
|
90
|
+
toggleRowSelection: f,
|
|
91
|
+
visibleColumnsArray: y,
|
|
92
|
+
columnWidths: i,
|
|
93
|
+
hasActions: N,
|
|
94
|
+
actions: k,
|
|
95
|
+
columns: I,
|
|
96
|
+
bordered: w = !1,
|
|
97
|
+
resizableColumns: z = !1
|
|
98
|
+
}) {
|
|
99
|
+
const { t: C } = B(), S = (u, p) => {
|
|
100
|
+
const t = I.find((v) => v.key === p);
|
|
101
|
+
if ((t == null ? void 0 : t.renderCell) !== void 0)
|
|
102
|
+
return t.renderCell(u);
|
|
103
|
+
const x = u[p];
|
|
104
|
+
return /* @__PURE__ */ e("span", { className: "text-sm truncate", children: x != null ? String(x) : "-" });
|
|
105
|
+
};
|
|
106
|
+
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__ */ n("div", { className: "flex flex-col items-center justify-center gap-2 text-muted-foreground", children: [
|
|
107
|
+
/* @__PURE__ */ e(me, { className: "h-6 w-6 animate-spin text-primary" }),
|
|
108
|
+
/* @__PURE__ */ e("span", { className: "text-sm", children: C("states.loading") })
|
|
109
|
+
] }) }) }) }) : a ? /* @__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__ */ n("div", { className: "flex flex-col items-center justify-center gap-2 text-destructive", children: [
|
|
110
|
+
/* @__PURE__ */ e(ge, { className: "h-6 w-6" }),
|
|
111
|
+
/* @__PURE__ */ e("span", { className: "text-sm", children: a })
|
|
112
|
+
] }) }) }) }) : m.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: d ?? C("states.noResult") }) }) }) : /* @__PURE__ */ e("tbody", { className: "divide-y divide-gray-200 dark:divide-gray-800", children: m.map((u) => {
|
|
113
|
+
const p = r(u);
|
|
114
|
+
return /* @__PURE__ */ n(
|
|
115
|
+
"tr",
|
|
116
|
+
{
|
|
117
|
+
className: `group hover:bg-muted/50 dark:hover:bg-gray-900/50 transition-colors ${c !== void 0 ? "cursor-pointer" : ""}`,
|
|
118
|
+
onClick: (t) => c == null ? void 0 : c(u, t),
|
|
119
|
+
children: [
|
|
120
|
+
h ? /* @__PURE__ */ e(
|
|
121
|
+
"td",
|
|
122
|
+
{
|
|
123
|
+
className: "p-1 text-center align-middle",
|
|
124
|
+
style: { width: "32px", minWidth: "32px", maxWidth: "32px" },
|
|
125
|
+
onClick: (t) => {
|
|
126
|
+
t.stopPropagation();
|
|
127
|
+
},
|
|
128
|
+
children: /* @__PURE__ */ e("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ e(
|
|
129
|
+
H,
|
|
130
|
+
{
|
|
131
|
+
checked: o.includes(p),
|
|
132
|
+
onCheckedChange: () => {
|
|
133
|
+
f(p);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
) })
|
|
137
|
+
}
|
|
138
|
+
) : null,
|
|
139
|
+
y.map((t, x) => {
|
|
140
|
+
const v = x === y.length - 1;
|
|
141
|
+
return /* @__PURE__ */ e(
|
|
142
|
+
"td",
|
|
143
|
+
{
|
|
144
|
+
className: `px-2 py-2 relative ${w && !v ? "border-r border-gray-100 dark:border-gray-800" : ""} ${t.className ?? ""}`,
|
|
145
|
+
style: z ? { width: i[t.key] } : { minWidth: i[t.key] },
|
|
146
|
+
children: /* @__PURE__ */ e("div", { className: "w-full h-full", children: S(u, t.key) })
|
|
147
|
+
},
|
|
148
|
+
t.key
|
|
149
|
+
);
|
|
150
|
+
}),
|
|
151
|
+
N ? /* @__PURE__ */ e(
|
|
152
|
+
"td",
|
|
153
|
+
{
|
|
154
|
+
className: "p-1 text-center align-middle whitespace-nowrap",
|
|
155
|
+
style: { minWidth: "32px" },
|
|
156
|
+
onClick: (t) => {
|
|
157
|
+
t.stopPropagation();
|
|
158
|
+
},
|
|
159
|
+
children: k !== void 0 && k.length > 0 ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ e(De, { actions: k, row: u }) }) : null
|
|
160
|
+
}
|
|
161
|
+
) : null
|
|
162
|
+
]
|
|
163
|
+
},
|
|
164
|
+
p
|
|
165
|
+
);
|
|
166
|
+
}) });
|
|
167
|
+
}
|
|
168
|
+
function je({ selectedRows: l, setSelectedRows: a, bulkActions: s }) {
|
|
169
|
+
return /* @__PURE__ */ n("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: [
|
|
170
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-4", children: [
|
|
171
|
+
/* @__PURE__ */ n("span", { className: "text-sm font-medium text-primary ml-1", children: [
|
|
172
|
+
l.length,
|
|
173
|
+
" sélectionné(s)"
|
|
174
|
+
] }),
|
|
175
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: s.map((d, m) => {
|
|
176
|
+
const r = d.icon;
|
|
177
|
+
return /* @__PURE__ */ n(
|
|
178
|
+
b,
|
|
179
|
+
{
|
|
180
|
+
variant: "outline",
|
|
181
|
+
size: "sm",
|
|
182
|
+
onClick: () => {
|
|
183
|
+
d.onClick(l, () => {
|
|
184
|
+
a([]);
|
|
185
|
+
});
|
|
186
|
+
},
|
|
187
|
+
className: `h-7 bg-background shadow-sm text-xs px-2.5 ${d.variant === "destructive" ? "text-destructive border-destructive/30 hover:bg-destructive/10 hover:text-destructive" : "text-foreground"}`,
|
|
188
|
+
children: [
|
|
189
|
+
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" }) }),
|
|
190
|
+
d.label
|
|
191
|
+
]
|
|
192
|
+
},
|
|
193
|
+
m
|
|
194
|
+
);
|
|
195
|
+
}) })
|
|
196
|
+
] }),
|
|
197
|
+
/* @__PURE__ */ e(
|
|
198
|
+
b,
|
|
199
|
+
{
|
|
200
|
+
variant: "ghost",
|
|
201
|
+
size: "sm",
|
|
202
|
+
onClick: () => {
|
|
203
|
+
a([]);
|
|
204
|
+
},
|
|
205
|
+
className: "text-xs text-muted-foreground hover:text-foreground h-7 px-2",
|
|
206
|
+
children: "Désélectionner"
|
|
207
|
+
}
|
|
208
|
+
)
|
|
209
|
+
] });
|
|
210
|
+
}
|
|
211
|
+
function Te({
|
|
212
|
+
hasBulkActions: l,
|
|
213
|
+
selectedRows: a,
|
|
214
|
+
totalItems: s,
|
|
215
|
+
toggleSelectAll: d,
|
|
216
|
+
visibleColumnsArray: m,
|
|
217
|
+
draggableColumns: r,
|
|
218
|
+
resizableColumns: c,
|
|
219
|
+
columnWidths: h,
|
|
220
|
+
sortColumn: o,
|
|
221
|
+
sortDirection: f,
|
|
222
|
+
handleSort: y,
|
|
223
|
+
handleDragStart: i,
|
|
224
|
+
handleDragOver: N,
|
|
225
|
+
handleDrop: k,
|
|
226
|
+
handleMouseDown: I,
|
|
227
|
+
hasActions: w,
|
|
228
|
+
settingsNode: z,
|
|
229
|
+
bordered: C = !1
|
|
230
|
+
}) {
|
|
231
|
+
let S = !1;
|
|
232
|
+
a.length === s && s > 0 ? S = !0 : a.length > 0 && (S = "indeterminate");
|
|
233
|
+
const u = (t) => t.sortable !== !0 ? null : o === t.key ? f === "asc" ? /* @__PURE__ */ e(fe, { className: "size-3.5 text-foreground" }) : /* @__PURE__ */ e(pe, { className: "size-3.5 text-foreground" }) : /* @__PURE__ */ e(xe, { className: "size-3.5 text-muted-foreground/50 group-hover:text-muted-foreground transition-colors" }), p = (t, x) => {
|
|
234
|
+
const v = x !== !1, T = t.sortable === !0;
|
|
235
|
+
return /* @__PURE__ */ n(
|
|
236
|
+
"th",
|
|
237
|
+
{
|
|
238
|
+
className: [
|
|
239
|
+
"px-2 py-2 text-left text-sm font-medium text-gray-900 dark:text-gray-100 relative group",
|
|
240
|
+
C ? "border-r border-gray-200 dark:border-gray-800" : "",
|
|
241
|
+
T ? "cursor-pointer select-none" : "",
|
|
242
|
+
t.className ?? ""
|
|
243
|
+
].filter(Boolean).join(" "),
|
|
244
|
+
style: c ? { width: h[t.key] } : { minWidth: h[t.key] },
|
|
245
|
+
draggable: v,
|
|
246
|
+
onClick: () => {
|
|
247
|
+
y(t.key);
|
|
248
|
+
},
|
|
249
|
+
onDragStart: (g) => {
|
|
250
|
+
v ? i(g, t.key) : g.preventDefault();
|
|
251
|
+
},
|
|
252
|
+
onDragOver: (g) => {
|
|
253
|
+
N(g, t.key);
|
|
254
|
+
},
|
|
255
|
+
onDrop: (g) => {
|
|
256
|
+
k(g, t.key);
|
|
257
|
+
},
|
|
258
|
+
children: [
|
|
259
|
+
/* @__PURE__ */ n("div", { className: "flex items-center justify-between pr-2", children: [
|
|
260
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-1", children: [
|
|
261
|
+
v ? /* @__PURE__ */ e(ue, { className: "size-4 text-gray-400 cursor-grab dark:text-gray-300 shrink-0" }) : null,
|
|
262
|
+
/* @__PURE__ */ e("span", { className: "truncate", children: t.label })
|
|
263
|
+
] }),
|
|
264
|
+
/* @__PURE__ */ e("div", { className: "ml-1 shrink-0", children: u(t) })
|
|
265
|
+
] }),
|
|
266
|
+
c ? /* @__PURE__ */ e(
|
|
267
|
+
"div",
|
|
268
|
+
{
|
|
269
|
+
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",
|
|
270
|
+
onMouseDown: (g) => {
|
|
271
|
+
I(g, t.key);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
) : null
|
|
275
|
+
]
|
|
276
|
+
},
|
|
277
|
+
t.key
|
|
278
|
+
);
|
|
279
|
+
};
|
|
280
|
+
return /* @__PURE__ */ e("thead", { className: "bg-muted/50 dark:bg-gray-900/50 border-b border-gray-200 dark:border-gray-800", children: /* @__PURE__ */ n("tr", { children: [
|
|
281
|
+
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(H, { checked: S, onCheckedChange: d }) }) }) : null,
|
|
282
|
+
m.map((t) => p(t, r)),
|
|
283
|
+
w || z !== void 0 ? /* @__PURE__ */ e("th", { className: "p-1 text-center align-middle", style: { minWidth: "32px" }, children: z }) : null
|
|
284
|
+
] }) });
|
|
285
|
+
}
|
|
286
|
+
const D = "…";
|
|
287
|
+
function j(l, a) {
|
|
288
|
+
return Array.from({ length: a - l + 1 }, (s, d) => l + d);
|
|
289
|
+
}
|
|
290
|
+
function Me(l, a, s = 1) {
|
|
291
|
+
if (s * 2 + 5 >= a)
|
|
292
|
+
return j(1, a);
|
|
293
|
+
const m = Math.max(l - s, 1), r = Math.min(l + s, a), c = m > 2, h = r < a - 1;
|
|
294
|
+
if (!c && h)
|
|
295
|
+
return [...j(1, s + 2), D, a];
|
|
296
|
+
if (c && !h) {
|
|
297
|
+
const o = j(a - (s + 2) + 1, a);
|
|
298
|
+
return [1, D, ...o];
|
|
299
|
+
}
|
|
300
|
+
return [1, D, ...j(m, r), D, a];
|
|
301
|
+
}
|
|
302
|
+
function Ae({
|
|
303
|
+
totalItems: l,
|
|
304
|
+
startIndex: a,
|
|
305
|
+
endIndex: s,
|
|
306
|
+
pageSize: d,
|
|
307
|
+
setPageSize: m,
|
|
308
|
+
currentPage: r,
|
|
309
|
+
setCurrentPage: c,
|
|
310
|
+
pageSizeOptions: h,
|
|
311
|
+
totalPages: o
|
|
312
|
+
}) {
|
|
313
|
+
const { t: f } = B(), y = Me(r, o);
|
|
314
|
+
return /* @__PURE__ */ n("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: [
|
|
315
|
+
/* @__PURE__ */ n("div", { className: "text-sm text-muted-foreground justify-self-start", children: [
|
|
316
|
+
l === 0 ? "0" : `${String(a + 1)} - ${String(s)}`,
|
|
317
|
+
" sur ",
|
|
318
|
+
l
|
|
319
|
+
] }),
|
|
320
|
+
/* @__PURE__ */ e("div", { className: "flex items-center justify-center gap-1", children: o > 1 && /* @__PURE__ */ n(le, { children: [
|
|
321
|
+
/* @__PURE__ */ e(
|
|
322
|
+
b,
|
|
323
|
+
{
|
|
324
|
+
variant: "ghost",
|
|
325
|
+
size: "icon",
|
|
326
|
+
className: "h-8 w-8 rounded-control",
|
|
327
|
+
onClick: () => {
|
|
328
|
+
c((i) => Math.max(1, i - 1));
|
|
329
|
+
},
|
|
330
|
+
disabled: r === 1,
|
|
331
|
+
"aria-label": f("table.previousPage"),
|
|
332
|
+
children: /* @__PURE__ */ e(ve, { className: "size-4" })
|
|
333
|
+
}
|
|
334
|
+
),
|
|
335
|
+
y.map(
|
|
336
|
+
(i, N) => i === D ? /* @__PURE__ */ e("span", { className: "flex h-8 w-8 items-center justify-center text-sm text-muted-foreground", children: D }, `dots-${String(N)}`) : /* @__PURE__ */ e(
|
|
337
|
+
b,
|
|
338
|
+
{
|
|
339
|
+
variant: i === r ? "default" : "ghost",
|
|
340
|
+
size: "icon",
|
|
341
|
+
className: "h-8 w-8 rounded-control text-sm",
|
|
342
|
+
onClick: () => {
|
|
343
|
+
c(i);
|
|
344
|
+
},
|
|
345
|
+
"aria-current": i === r ? "page" : void 0,
|
|
346
|
+
children: i
|
|
347
|
+
},
|
|
348
|
+
i
|
|
349
|
+
)
|
|
350
|
+
),
|
|
351
|
+
/* @__PURE__ */ e(
|
|
352
|
+
b,
|
|
353
|
+
{
|
|
354
|
+
variant: "ghost",
|
|
355
|
+
size: "icon",
|
|
356
|
+
className: "h-8 w-8 rounded-control",
|
|
357
|
+
onClick: () => {
|
|
358
|
+
c((i) => Math.min(o, i + 1));
|
|
359
|
+
},
|
|
360
|
+
disabled: r === o,
|
|
361
|
+
"aria-label": f("table.nextPage"),
|
|
362
|
+
children: /* @__PURE__ */ e(ye, { className: "size-4" })
|
|
363
|
+
}
|
|
364
|
+
)
|
|
365
|
+
] }) }),
|
|
366
|
+
/* @__PURE__ */ e("div", { className: "justify-self-end", children: /* @__PURE__ */ n(
|
|
367
|
+
Ne,
|
|
368
|
+
{
|
|
369
|
+
value: String(d),
|
|
370
|
+
onValueChange: (i) => {
|
|
371
|
+
m(Number(i)), c(1);
|
|
372
|
+
},
|
|
373
|
+
children: [
|
|
374
|
+
/* @__PURE__ */ e(ke, { className: "h-8 w-[110px] text-sm", children: /* @__PURE__ */ e(Se, {}) }),
|
|
375
|
+
/* @__PURE__ */ e(we, { children: h.map((i) => /* @__PURE__ */ n(ze, { value: String(i), children: [
|
|
376
|
+
i,
|
|
377
|
+
" / page"
|
|
378
|
+
] }, i)) })
|
|
379
|
+
]
|
|
380
|
+
}
|
|
381
|
+
) })
|
|
382
|
+
] });
|
|
383
|
+
}
|
|
384
|
+
function $e({ columns: l, visibleColumns: a, toggleColumnVisibility: s }) {
|
|
385
|
+
return /* @__PURE__ */ n(L, { children: [
|
|
386
|
+
/* @__PURE__ */ e(V, { asChild: !0, children: /* @__PURE__ */ e(b, { 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(be, { className: "size-3.5 text-gray-600 dark:text-gray-300" }) }) }),
|
|
387
|
+
/* @__PURE__ */ e(O, { align: "end", className: "w-56", children: l.map((d) => /* @__PURE__ */ e(
|
|
388
|
+
oe,
|
|
389
|
+
{
|
|
390
|
+
checked: a.has(d.key),
|
|
391
|
+
onCheckedChange: () => {
|
|
392
|
+
s(d.key);
|
|
393
|
+
},
|
|
394
|
+
children: d.label
|
|
395
|
+
},
|
|
396
|
+
d.key
|
|
397
|
+
)) })
|
|
398
|
+
] });
|
|
399
|
+
}
|
|
400
|
+
function Ye({
|
|
401
|
+
data: l,
|
|
402
|
+
columns: a,
|
|
403
|
+
getRowId: s,
|
|
404
|
+
onRowClick: d,
|
|
405
|
+
actions: m,
|
|
406
|
+
bulkActions: r,
|
|
407
|
+
draggableColumns: c = !1,
|
|
408
|
+
resizableColumns: h = !1,
|
|
409
|
+
columnVisibility: o = !1,
|
|
410
|
+
isLoading: f = !1,
|
|
411
|
+
error: y = null,
|
|
412
|
+
bordered: i = !1,
|
|
413
|
+
noDataMessage: N,
|
|
414
|
+
defaultPageSize: k = Ce,
|
|
415
|
+
pageSizeOptions: I = R,
|
|
416
|
+
totalRows: w,
|
|
417
|
+
currentPage: z,
|
|
418
|
+
pageSize: C,
|
|
419
|
+
onPageChange: S,
|
|
420
|
+
onPageSizeChange: u,
|
|
421
|
+
sortColumn: p,
|
|
422
|
+
sortDirection: t,
|
|
423
|
+
onSortChange: x
|
|
424
|
+
}) {
|
|
425
|
+
const {
|
|
426
|
+
sortColumn: v,
|
|
427
|
+
sortDirection: T,
|
|
428
|
+
selectedRows: g,
|
|
429
|
+
setSelectedRows: U,
|
|
430
|
+
visibleColumns: E,
|
|
431
|
+
columnWidths: M,
|
|
432
|
+
safeCurrentPage: F,
|
|
433
|
+
totalPages: G,
|
|
434
|
+
startIndex: _,
|
|
435
|
+
endIndex: q,
|
|
436
|
+
tableRef: J,
|
|
437
|
+
hasActions: A,
|
|
438
|
+
hasBulkActions: $,
|
|
439
|
+
visibleColumnsArray: W,
|
|
440
|
+
colSpanCount: K,
|
|
441
|
+
paginatedData: P,
|
|
442
|
+
handleSort: Q,
|
|
443
|
+
handleMouseDown: X,
|
|
444
|
+
handleDragStart: Y,
|
|
445
|
+
handleDragOver: Z,
|
|
446
|
+
handleDrop: ee,
|
|
447
|
+
toggleColumnVisibility: re,
|
|
448
|
+
toggleRowSelection: te,
|
|
449
|
+
toggleSelectAll: ae,
|
|
450
|
+
pageSize: se,
|
|
451
|
+
setPageSize: ie,
|
|
452
|
+
setCurrentPage: ne
|
|
453
|
+
} = de({
|
|
454
|
+
data: l,
|
|
455
|
+
columns: a,
|
|
456
|
+
getRowId: s,
|
|
457
|
+
defaultPageSize: k,
|
|
458
|
+
actions: m,
|
|
459
|
+
bulkActions: r,
|
|
460
|
+
columnVisibility: o,
|
|
461
|
+
totalRows: w,
|
|
462
|
+
currentPage: z,
|
|
463
|
+
pageSize: C,
|
|
464
|
+
onPageChange: S,
|
|
465
|
+
onPageSizeChange: u,
|
|
466
|
+
sortColumn: p,
|
|
467
|
+
sortDirection: t,
|
|
468
|
+
onSortChange: x
|
|
469
|
+
});
|
|
470
|
+
return (
|
|
471
|
+
// Le tableau suit le preset de l'application — square reste square — mais
|
|
472
|
+
// bascule sur les valeurs plafonnées : ni ses contrôles ni son cadre ne
|
|
473
|
+
// prennent la forme capsule. Le scope couvre le cadre, les actions
|
|
474
|
+
// groupées et la pagination. Les fallbacks correspondent au preset "soft".
|
|
475
|
+
/* @__PURE__ */ n("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: [
|
|
476
|
+
g.length > 0 && r !== void 0 && r.length > 0 && /* @__PURE__ */ e(je, { selectedRows: g, setSelectedRows: U, bulkActions: r }),
|
|
477
|
+
/* @__PURE__ */ n("div", { className: "w-full bg-card dark:bg-gray-950 rounded-surface border border-gray-200 dark:border-gray-800 overflow-hidden", children: [
|
|
478
|
+
/* @__PURE__ */ e("div", { className: "overflow-x-auto", children: /* @__PURE__ */ n("table", { ref: J, className: "w-full", children: [
|
|
479
|
+
/* @__PURE__ */ e(
|
|
480
|
+
Te,
|
|
481
|
+
{
|
|
482
|
+
hasBulkActions: $,
|
|
483
|
+
selectedRows: g,
|
|
484
|
+
totalItems: l.length,
|
|
485
|
+
toggleSelectAll: ae,
|
|
486
|
+
visibleColumnsArray: W,
|
|
487
|
+
draggableColumns: c,
|
|
488
|
+
resizableColumns: h,
|
|
489
|
+
columnWidths: M,
|
|
490
|
+
sortColumn: v,
|
|
491
|
+
sortDirection: T,
|
|
492
|
+
handleSort: Q,
|
|
493
|
+
handleDragStart: Y,
|
|
494
|
+
handleDragOver: Z,
|
|
495
|
+
handleDrop: ee,
|
|
496
|
+
handleMouseDown: X,
|
|
497
|
+
hasActions: A,
|
|
498
|
+
bordered: i,
|
|
499
|
+
settingsNode: o ? /* @__PURE__ */ e($e, { columns: a, visibleColumns: E, toggleColumnVisibility: re }) : void 0
|
|
500
|
+
}
|
|
501
|
+
),
|
|
502
|
+
/* @__PURE__ */ e(
|
|
503
|
+
Ie,
|
|
504
|
+
{
|
|
505
|
+
bordered: i,
|
|
506
|
+
isLoading: f,
|
|
507
|
+
error: y,
|
|
508
|
+
colSpanCount: K,
|
|
509
|
+
noDataMessage: N,
|
|
510
|
+
paginatedData: P,
|
|
511
|
+
getRowId: s,
|
|
512
|
+
onRowClick: d,
|
|
513
|
+
hasBulkActions: $,
|
|
514
|
+
selectedRows: g,
|
|
515
|
+
toggleRowSelection: te,
|
|
516
|
+
visibleColumnsArray: W,
|
|
517
|
+
columnWidths: M,
|
|
518
|
+
hasActions: A || o,
|
|
519
|
+
actions: m,
|
|
520
|
+
columns: a,
|
|
521
|
+
resizableColumns: h
|
|
522
|
+
}
|
|
523
|
+
)
|
|
524
|
+
] }) }),
|
|
525
|
+
/* @__PURE__ */ e(
|
|
526
|
+
Ae,
|
|
527
|
+
{
|
|
528
|
+
totalItems: w ?? l.length,
|
|
529
|
+
startIndex: _,
|
|
530
|
+
endIndex: q,
|
|
531
|
+
pageSize: se,
|
|
532
|
+
setPageSize: ie,
|
|
533
|
+
currentPage: F,
|
|
534
|
+
setCurrentPage: ne,
|
|
535
|
+
pageSizeOptions: I,
|
|
536
|
+
totalPages: G
|
|
537
|
+
}
|
|
538
|
+
)
|
|
539
|
+
] })
|
|
540
|
+
] })
|
|
541
|
+
);
|
|
542
|
+
}
|
|
543
|
+
export {
|
|
544
|
+
Ye as D,
|
|
545
|
+
De as T,
|
|
546
|
+
Ie as a,
|
|
547
|
+
je as b,
|
|
548
|
+
Te as c,
|
|
549
|
+
Ae as d,
|
|
550
|
+
$e as e
|
|
551
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsxs as r, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { u as a } from "./useKrosoftTranslation-DdcylBY2.js";
|
|
3
|
+
import { A as n, a as c } from "./alert-B9F1N9Qk.js";
|
|
4
|
+
import { AlertTriangle as o } from "lucide-react";
|
|
5
|
+
const h = ({ error: s }) => {
|
|
6
|
+
const { t: i } = a();
|
|
7
|
+
return s ? /* @__PURE__ */ r(n, { variant: "destructive", children: [
|
|
8
|
+
/* @__PURE__ */ e(o, { className: "size-4" }),
|
|
9
|
+
/* @__PURE__ */ r(c, { children: [
|
|
10
|
+
/* @__PURE__ */ r("div", { className: "flex items-center space-x-2", children: [
|
|
11
|
+
/* @__PURE__ */ e("span", { className: "font-semibold", children: i("states.errorPrefix") }),
|
|
12
|
+
/* @__PURE__ */ e("span", { children: s.code }),
|
|
13
|
+
/* @__PURE__ */ e("span", { children: s.message })
|
|
14
|
+
] }),
|
|
15
|
+
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)) })
|
|
16
|
+
] })
|
|
17
|
+
] }) : null;
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
h as E
|
|
21
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsxs as s, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { u as o } from "./useKrosoftTranslation-DdcylBY2.js";
|
|
3
|
+
const d = ({ message: r }) => {
|
|
4
|
+
const { t: e } = o();
|
|
5
|
+
return /* @__PURE__ */ s("div", { className: "p-6 border border-destructive bg-destructive/10 text-destructive rounded-surface animate-fade-in", children: [
|
|
6
|
+
/* @__PURE__ */ t("p", { className: "font-semibold mb-2", children: e("states.error") }),
|
|
7
|
+
r !== void 0 && r !== "" ? /* @__PURE__ */ t("p", { className: "text-sm opacity-80", children: r }) : null
|
|
8
|
+
] });
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
d as E
|
|
12
|
+
};
|