@etic-insa/ui 0.3.0 → 0.4.0

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 (46) hide show
  1. package/README.md +110 -73
  2. package/dist/components/etic/app-shell.d.ts +4 -1
  3. package/dist/components/etic/app-shell.js +150 -113
  4. package/dist/components/etic/app-shell.js.map +1 -1
  5. package/dist/components/etic/data-table-bulk-actions.d.ts +15 -2
  6. package/dist/components/etic/data-table-bulk-actions.js +100 -53
  7. package/dist/components/etic/data-table-bulk-actions.js.map +1 -1
  8. package/dist/components/etic/data-table-focus.d.ts +1 -1
  9. package/dist/components/etic/data-table-focus.js.map +1 -1
  10. package/dist/components/etic/data-table.d.ts +12 -4
  11. package/dist/components/etic/data-table.js +199 -223
  12. package/dist/components/etic/data-table.js.map +1 -1
  13. package/dist/components/etic/delete-button.d.ts +2 -2
  14. package/dist/components/etic/delete-button.js.map +1 -1
  15. package/dist/components/etic/detail-list.d.ts +3 -1
  16. package/dist/components/etic/detail-list.js +1 -1
  17. package/dist/components/etic/detail-list.js.map +1 -1
  18. package/dist/components/etic/disclosure.js +1 -0
  19. package/dist/components/etic/disclosure.js.map +1 -1
  20. package/dist/components/etic/icon-toggle.js +1 -1
  21. package/dist/components/etic/icon-toggle.js.map +1 -1
  22. package/dist/components/etic/page-header.d.ts +12 -4
  23. package/dist/components/etic/page-header.js +27 -16
  24. package/dist/components/etic/page-header.js.map +1 -1
  25. package/dist/components/etic/removable-badge.js +26 -18
  26. package/dist/components/etic/removable-badge.js.map +1 -1
  27. package/dist/components/etic/save-bar.d.ts +4 -3
  28. package/dist/components/etic/save-bar.js +2 -2
  29. package/dist/components/etic/save-bar.js.map +1 -1
  30. package/dist/components/etic/stat-tile.d.ts +9 -2
  31. package/dist/components/etic/stat-tile.js +32 -18
  32. package/dist/components/etic/stat-tile.js.map +1 -1
  33. package/dist/components/etic/theme-menu.d.ts +28 -0
  34. package/dist/components/etic/theme-menu.js +62 -35
  35. package/dist/components/etic/theme-menu.js.map +1 -1
  36. package/dist/components/etic/toggletip.js +3 -3
  37. package/dist/components/etic/toggletip.js.map +1 -1
  38. package/dist/components/etic/tooltip-button.d.ts +7 -3
  39. package/dist/components/etic/tooltip-button.js +2 -2
  40. package/dist/components/etic/tooltip-button.js.map +1 -1
  41. package/dist/components/ui/button.js +2 -2
  42. package/dist/components/ui/button.js.map +1 -1
  43. package/dist/components/ui/select.js +3 -3
  44. package/dist/components/ui/select.js.map +1 -1
  45. package/dist/styles.css +107 -69
  46. package/package.json +1 -1
@@ -7,73 +7,73 @@ import { Table as c, TableBody as l, TableCell as u, TableHead as d, TableHeader
7
7
  import { Tooltip as m, TooltipContent as h, TooltipTrigger as g } from "../ui/tooltip.js";
8
8
  import { UNITE_PAR_DEFAUT as ee } from "./data-table-format.js";
9
9
  import { useLien as _ } from "./lien.js";
10
- import { focaliserTableau as v, rendreFocusApresLigne as y } from "./data-table-focus.js";
11
- import { QueryErrorBanner as te } from "./query-boundary.js";
10
+ import { rendreFocusApresLigne as v } from "./data-table-focus.js";
11
+ import { QueryErrorBanner as y } from "./query-boundary.js";
12
12
  import { comparerFr as b, normaliser as x, normaliserRecherche as S } from "../../lib/normalize.js";
13
13
  import { cn as C } from "cn";
14
- import { memo as w, useCallback as T, useEffect as ne, useEffectEvent as E, useId as D, useLayoutEffect as O, useRef as k, useState as A } from "react";
15
- import { Fragment as j, jsx as M, jsxs as N } from "react/jsx-runtime";
16
- import { ArrowDownIcon as re, ArrowUpIcon as ie, ChevronRightIcon as P, ChevronsUpDownIcon as F, MoreHorizontalIcon as I } from "lucide-react";
17
- import { columnFilteringFeature as ae, columnOrderingFeature as L, columnVisibilityFeature as oe, constructFilterFn as R, constructSortFn as se, createColumnHelper as z, createFilteredRowModel as B, createPaginatedRowModel as V, createSortedRowModel as ce, filterFn_arrIncludes as le, filterFn_arrIncludesAll as ue, filterFn_arrIncludesSome as H, filterFn_equals as U, filterFn_equalsString as W, filterFn_inDateRange as G, filterFn_inNumberRange as K, filterFn_includesString as de, filterFn_weakEquals as q, functionalUpdate as fe, globalFilteringFeature as J, metaHelper as Y, rowExpandingFeature as pe, rowPaginationFeature as me, rowSelectionFeature as he, rowSortingFeature as ge, sortFn_alphanumeric as _e, sortFn_basic as ve, sortFn_datetime as ye, sortFn_text as be, tableFeatures as xe, useTable as Se } from "@tanstack/react-table";
14
+ import { memo as w, useCallback as te, useEffect as ne, useEffectEvent as T, useId as E, useLayoutEffect as D, useRef as O, useState as k } from "react";
15
+ import { Fragment as A, jsx as j, jsxs as M } from "react/jsx-runtime";
16
+ import { ArrowDownIcon as N, ArrowUpIcon as re, ChevronRightIcon as ie, ChevronsUpDownIcon as P, MoreHorizontalIcon as F } from "lucide-react";
17
+ import { columnFilteringFeature as I, columnOrderingFeature as ae, columnVisibilityFeature as L, constructFilterFn as oe, constructSortFn as R, createColumnHelper as se, createFilteredRowModel as z, createPaginatedRowModel as B, createSortedRowModel as V, filterFn_arrIncludes as ce, filterFn_arrIncludesAll as le, filterFn_arrIncludesSome as ue, filterFn_equals as H, filterFn_equalsString as U, filterFn_inDateRange as W, filterFn_inNumberRange as G, filterFn_includesString as K, filterFn_weakEquals as de, functionalUpdate as q, globalFilteringFeature as J, metaHelper as Y, rowExpandingFeature as fe, rowPaginationFeature as pe, rowSelectionFeature as me, rowSortingFeature as he, sortFn_alphanumeric as ge, sortFn_basic as _e, sortFn_datetime as ve, sortFn_text as ye, tableFeatures as be, useTable as xe } from "@tanstack/react-table";
18
18
  // src/components/etic/data-table.tsx
19
- var Ce = /* @__PURE__ */ new WeakMap();
20
- function we(e) {
21
- let { data: t, columns: n } = e.table.options, r = Ce.get(t);
22
- r || Ce.set(t, r = /* @__PURE__ */ new WeakMap());
19
+ var Se = /* @__PURE__ */ new WeakMap();
20
+ function Ce(e) {
21
+ let { data: t, columns: n } = e.table.options, r = Se.get(t);
22
+ r || Se.set(t, r = /* @__PURE__ */ new WeakMap());
23
23
  let i = r.get(n);
24
24
  return i || r.set(n, i = /* @__PURE__ */ new Map()), i;
25
25
  }
26
- function Te(e, t) {
27
- let n = we(e), r = `${e.id}\u0000${t}`;
26
+ function we(e, t) {
27
+ let n = Ce(e), r = `${e.id}\u0000${t}`;
28
28
  if (n.has(r)) return n.get(r);
29
29
  let i = e.getValue(t), a = i == null ? void 0 : x(String(i));
30
30
  return n.set(r, a), a;
31
31
  }
32
- var Ee = R({
33
- filter: (e, t, n, r) => t === "" || (Te(n, r)?.includes(t) ?? !1),
32
+ var Te = oe({
33
+ filter: (e, t, n, r) => t === "" || (we(n, r)?.includes(t) ?? !1),
34
34
  autoRemove: (e) => S(String(e ?? "")) === "",
35
35
  resolveFilterValue: (e) => S(String(e ?? ""))
36
- }), De = se({
36
+ }), Ee = R({
37
37
  resolveDataValue: (e) => e == null ? "" : String(e),
38
38
  sort: b
39
- }), Oe = xe({
40
- columnFilteringFeature: ae,
41
- columnOrderingFeature: L,
42
- columnVisibilityFeature: oe,
39
+ }), De = be({
40
+ columnFilteringFeature: I,
41
+ columnOrderingFeature: ae,
42
+ columnVisibilityFeature: L,
43
43
  globalFilteringFeature: J,
44
- rowExpandingFeature: pe,
45
- rowPaginationFeature: me,
46
- rowSelectionFeature: he,
47
- rowSortingFeature: ge,
48
- filteredRowModel: B(),
49
- paginatedRowModel: V(),
50
- sortedRowModel: ce(),
44
+ rowExpandingFeature: fe,
45
+ rowPaginationFeature: pe,
46
+ rowSelectionFeature: me,
47
+ rowSortingFeature: he,
48
+ filteredRowModel: z(),
49
+ paginatedRowModel: B(),
50
+ sortedRowModel: V(),
51
51
  filterFns: {
52
- arrIncludes: le,
53
- arrIncludesAll: ue,
54
- arrIncludesSome: H,
55
- equals: U,
56
- equalsString: W,
57
- inDateRange: G,
58
- inNumberRange: K,
59
- includesString: de,
60
- texteFr: Ee,
61
- weakEquals: q
52
+ arrIncludes: ce,
53
+ arrIncludesAll: le,
54
+ arrIncludesSome: ue,
55
+ equals: H,
56
+ equalsString: U,
57
+ inDateRange: W,
58
+ inNumberRange: G,
59
+ includesString: K,
60
+ texteFr: Te,
61
+ weakEquals: de
62
62
  },
63
63
  sortFns: {
64
- alphanumeric: _e,
65
- basic: ve,
66
- datetime: ye,
67
- text: be,
68
- texteFr: De
64
+ alphanumeric: ge,
65
+ basic: _e,
66
+ datetime: ve,
67
+ text: ye,
68
+ texteFr: Ee
69
69
  },
70
70
  columnMeta: Y(),
71
71
  tableMeta: Y()
72
72
  });
73
73
  function X() {
74
- return z();
74
+ return se();
75
75
  }
76
- function ke(e) {
76
+ function Oe(e) {
77
77
  let { meta: t, header: n } = e.columnDef;
78
78
  return t?.libelle ? t.libelle : typeof n == "string" ? n : e.id;
79
79
  }
@@ -82,7 +82,7 @@ function Z(e) {
82
82
  if (!t) throw Error("DataTable : instance sans `meta`. Créez-la avec `useDataTable`.");
83
83
  return t;
84
84
  }
85
- function Ae(e) {
85
+ function ke(e) {
86
86
  let { pageIndex: t, pageSize: n } = e.state.pagination;
87
87
  return {
88
88
  manuelle: !!e.options.manualPagination,
@@ -92,36 +92,36 @@ function Ae(e) {
92
92
  nombre: e.getRowModel().rows.length
93
93
  };
94
94
  }
95
- function je(n, r, i) {
95
+ function Ae(n, r, i) {
96
96
  return `Les ${e(n)} ${r.pluriel} sont ${t("sélectionné", 2, i)}.`;
97
97
  }
98
98
  function Q(e, t, n) {
99
- let [r, i] = A(n), a = e === void 0 ? r : e;
99
+ let [r, i] = k(n), a = e === void 0 ? r : e;
100
100
  return [a, (n) => {
101
101
  Object.is(n, a) || (e === void 0 && i(n), t?.(n));
102
102
  }];
103
103
  }
104
- var Me = 25;
104
+ var je = 25;
105
105
  function $(e, t) {
106
106
  let n = Object.entries(e).filter(([e]) => t(e));
107
107
  return n.length === Object.keys(e).length ? e : Object.fromEntries(n);
108
108
  }
109
- function Ne({ donnees: e, colonnes: t, idLigne: n, tri: r, onTriChange: i, triManuel: a, paginationClient: o = !1, pagination: s, onPaginationChange: c, filtresColonnes: l, onFiltresColonnesChange: u, filtreGlobal: d, onFiltreGlobalChange: f, visibiliteColonnes: p, onVisibiliteColonnesChange: m, ordreColonnes: h, onOrdreColonnesChange: g, colonnesReglables: ee, selection: _, onSelectionChange: v, ligneSelectionnable: y, conserverSelection: te = !1, total: b, toutSelectionne: x, onToutSelectionneChange: S, lignesDepliees: C, onLignesDeplieesChange: w, ligneDepliable: T, uneSeuleLigneDepliee: A = !1, etatInitial: j }) {
110
- let [M, N] = Q(x, S, !1), re = k(null), ie = D(), P = {}, F = {};
109
+ function Me({ donnees: e, colonnes: t, idLigne: n, tri: r, onTriChange: i, triManuel: a, paginationClient: o = !1, pagination: s, onPaginationChange: c, filtresColonnes: l, onFiltresColonnesChange: u, filtreGlobal: d, onFiltreGlobalChange: f, visibiliteColonnes: p, onVisibiliteColonnesChange: m, ordreColonnes: h, onOrdreColonnesChange: g, colonnesReglables: ee, selection: _, onSelectionChange: v, ligneSelectionnable: y, conserverSelection: b = !1, total: x, toutSelectionne: S, onToutSelectionneChange: C, lignesDepliees: w, onLignesDeplieesChange: te, ligneDepliable: k, uneSeuleLigneDepliee: A = !1, etatInitial: j }) {
110
+ let [M, N] = Q(S, C, !1), re = O(null), ie = E(), P = {}, F = {};
111
111
  r !== void 0 && (P.sorting = r), i && (F.onSortingChange = i), p !== void 0 && (P.columnVisibility = p), m && (F.onColumnVisibilityChange = m), h !== void 0 && (P.columnOrder = h), g && (F.onColumnOrderChange = g), s !== void 0 && (P.pagination = s), c && (F.onPaginationChange = c), l !== void 0 && (P.columnFilters = l), u && (F.onColumnFiltersChange = u), d !== void 0 && (P.globalFilter = d), f && (F.onGlobalFilterChange = f);
112
112
  let [I, ae] = Q(_, v, {});
113
- P.rowSelection = I, F.onRowSelectionChange = (e) => ae(fe(e, I));
114
- let [L, oe] = Q(C, w, j?.lignesDepliees ?? {});
113
+ P.rowSelection = I, F.onRowSelectionChange = (e) => ae(q(e, I));
114
+ let [L, oe] = Q(w, te, j?.lignesDepliees ?? {});
115
115
  P.expanded = L, F.onExpandedChange = (e) => {
116
- let t = fe(e, L), n = t === !0 ? Object.fromEntries(R.getCoreRowModel().rows.filter((e) => e.getCanExpand()).map((e) => [e.id, !0])) : t;
116
+ let t = q(e, L), n = t === !0 ? Object.fromEntries(R.getCoreRowModel().rows.filter((e) => e.getCanExpand()).map((e) => [e.id, !0])) : t;
117
117
  if (A) {
118
118
  let e = Object.keys(n).filter((e) => n[e] && !L[e]).at(-1);
119
119
  e && (n = { [e]: !0 });
120
120
  }
121
121
  oe(n);
122
122
  };
123
- let R = Se({
124
- features: Oe,
123
+ let R = xe({
124
+ features: De,
125
125
  data: e,
126
126
  columns: t,
127
127
  getRowId: n,
@@ -131,7 +131,7 @@ function Ne({ donnees: e, colonnes: t, idLigne: n, tri: r, onTriChange: i, triMa
131
131
  globalFilterFn: "texteFr",
132
132
  enableMultiSort: !1,
133
133
  enableRowSelection: y ? (e) => y(e.original) : !0,
134
- getRowCanExpand: T ? (e) => T(e.original) : () => !0,
134
+ getRowCanExpand: k ? (e) => k(e.original) : () => !0,
135
135
  autoResetExpanded: !1,
136
136
  initialState: {
137
137
  sorting: j?.tri ?? [],
@@ -139,7 +139,7 @@ function Ne({ donnees: e, colonnes: t, idLigne: n, tri: r, onTriChange: i, triMa
139
139
  columnOrder: j?.ordreColonnes ?? [],
140
140
  pagination: {
141
141
  pageIndex: 0,
142
- pageSize: Me,
142
+ pageSize: je,
143
143
  ...j?.pagination
144
144
  },
145
145
  columnFilters: j?.filtresColonnes ?? [],
@@ -148,10 +148,13 @@ function Ne({ donnees: e, colonnes: t, idLigne: n, tri: r, onTriChange: i, triMa
148
148
  state: P,
149
149
  ...F,
150
150
  meta: {
151
- total: b,
151
+ total: x,
152
152
  get toutSelectionne() {
153
153
  return M && B;
154
154
  },
155
+ get totalAProposer() {
156
+ if (x !== void 0 && !M && B) return x > R.getSelectedRowIds().length ? x : void 0;
157
+ },
155
158
  changerToutSelectionne: (e) => {
156
159
  e && R.toggleAllPageRowsSelected(!0), N(e);
157
160
  },
@@ -166,7 +169,7 @@ function Ne({ donnees: e, colonnes: t, idLigne: n, tri: r, onTriChange: i, triMa
166
169
  idDetail: (e) => `${ie}detail-${encodeURIComponent(e)}`,
167
170
  colonnesReglables: ee
168
171
  }
169
- }), se = R.getCoreRowModel().rows, z = R.getRowModel().rows, B = R.getIsAllPageRowsSelected(), V = k(null), ce = E(() => N(!1));
172
+ }), se = R.getCoreRowModel().rows, z = R.getRowModel().rows, B = R.getIsAllPageRowsSelected(), V = O(null), ce = T(() => N(!1));
170
173
  ne(() => {
171
174
  let e = z.map((e) => e.id).sort().join("\0"), t = V.current !== null && V.current !== e;
172
175
  V.current = e, M && (t || !B) && ce();
@@ -175,26 +178,26 @@ function Ne({ donnees: e, colonnes: t, idLigne: n, tri: r, onTriChange: i, triMa
175
178
  B,
176
179
  M
177
180
  ]);
178
- let le = E(() => {
179
- if (te || Object.keys(I).length === 0) return;
181
+ let le = T(() => {
182
+ if (b || Object.keys(I).length === 0) return;
180
183
  let e = new Set(z.map((e) => e.id));
181
184
  R.setRowSelection((t) => $(t, (t) => e.has(t)));
182
185
  });
183
- O(() => {
186
+ D(() => {
184
187
  le();
185
188
  }, [z]);
186
- let ue = E(() => {
189
+ let ue = T(() => {
187
190
  if (Object.keys(L).length === 0) return;
188
191
  let { rowsById: e } = R.getCoreRowModel();
189
192
  R.setExpanded((t) => t === !0 ? t : $(t, (t) => t in e));
190
193
  });
191
- O(() => {
194
+ D(() => {
192
195
  ue();
193
196
  }, [se]);
194
- let { columnFilters: H, globalFilter: U, sorting: W, pagination: G } = R.state, K = k(null), de = E(() => {
197
+ let { columnFilters: H, globalFilter: U, sorting: W, pagination: G } = R.state, K = O(null), de = T(() => {
195
198
  o && R.state.pagination.pageIndex !== 0 && R.setPageIndex(0);
196
199
  });
197
- O(() => {
200
+ D(() => {
198
201
  let e = JSON.stringify([
199
202
  H,
200
203
  U,
@@ -206,17 +209,17 @@ function Ne({ donnees: e, colonnes: t, idLigne: n, tri: r, onTriChange: i, triMa
206
209
  U,
207
210
  W
208
211
  ]);
209
- let q = R.getPageCount(), J = R.getRowCount(), Y = E(() => R.setPageIndex(Math.max(0, q - 1)));
210
- return O(() => {
211
- o && J > 0 && G.pageIndex > 0 && G.pageIndex >= q && Y();
212
+ let J = R.getPageCount(), Y = R.getRowCount(), fe = T(() => R.setPageIndex(Math.max(0, J - 1)));
213
+ return D(() => {
214
+ o && Y > 0 && G.pageIndex > 0 && G.pageIndex >= J && fe();
212
215
  }, [
213
216
  o,
214
- J,
217
+ Y,
215
218
  G.pageIndex,
216
- q
219
+ J
217
220
  ]), R;
218
221
  }
219
- var Pe = [
222
+ var Ne = [
220
223
  "a[href]",
221
224
  "button",
222
225
  "input",
@@ -245,95 +248,87 @@ var Pe = [
245
248
  "menuitemradio"
246
249
  ].map((e) => `[role=${e}]`)
247
250
  ].join(", ");
248
- function Fe(e) {
251
+ function Pe(e) {
249
252
  let t = e.currentTarget, n = e.target;
250
253
  if (!t.contains(n)) return !1;
251
- let r = n.closest(Pe);
254
+ let r = n.closest(Ne);
252
255
  return r && r !== t && t.contains(r) ? !1 : !window.getSelection()?.toString();
253
256
  }
254
- function Ie({ table: e, libelle: t, requete: n, enChargement: r = n?.isFetching ?? !1, lignesChargement: i = 10, vide: a = "Aucun résultat.", onActiverLigne: o, rendreDetail: m, unite: h = ee, feminin: g = !1, className: _ }) {
255
- let v = n?.isError ?? !1 ? null : a, y = e.getRowModel().rows, b = e.getVisibleLeafColumns(), x = b.map((e) => e.id).join(" "), { racine: S } = Z(e), w = k(null);
256
- O(() => {
257
- w.current = o ? (e) => o(e.original) : m ? (e) => e.toggleExpanded() : null;
257
+ function Fe({ table: e, libelle: t, requete: n, enChargement: r = n?.isFetching ?? !1, lignesChargement: i = 10, vide: a = "Aucun résultat.", onActiverLigne: o, rendreDetail: m, unite: h = ee, feminin: g = !1, className: _ }) {
258
+ let v = n?.isError ?? !1 ? null : a, b = e.getRowModel().rows, x = e.getVisibleLeafColumns(), S = x.map((e) => e.id).join(" "), { racine: w } = Z(e), T = O(null);
259
+ D(() => {
260
+ T.current = o ? (e) => o(e.original) : m ? (e) => e.toggleExpanded() : null;
258
261
  });
259
- let E = T((e) => w.current?.(e), []);
262
+ let E = te((e) => T.current?.(e), []);
260
263
  ne(() => {
261
- let e = S.current, t = e?.querySelector("[data-slot=\"table-container\"]");
264
+ let e = w.current, t = e?.querySelector("[data-slot=\"table-container\"]");
262
265
  if (!e || !t || typeof ResizeObserver > "u") return;
263
266
  let n = new ResizeObserver(() => e.style.setProperty("--data-table-largeur", `${t.clientWidth}px`));
264
267
  return n.observe(t), () => n.disconnect();
265
- }, [S]), Le(S, y.length > 0, x);
266
- let D = Re(e, r && y.length === 0, {
268
+ }, [w]), Ie(w, b.length > 0, S);
269
+ let k = Le(e, r && b.length === 0, {
267
270
  unite: h,
268
271
  feminin: g
269
272
  });
270
- return /* @__PURE__ */ N(j, { children: [n ? /* @__PURE__ */ M(te, { requete: n }) : null, /* @__PURE__ */ N("div", {
271
- ref: S,
273
+ return /* @__PURE__ */ M(A, { children: [n ? /* @__PURE__ */ j(y, { requete: n }) : null, /* @__PURE__ */ M("div", {
274
+ ref: w,
272
275
  "data-slot": "data-table",
273
- className: C("min-w-0 overflow-hidden rounded-md border bg-card", _),
274
- children: [
275
- /* @__PURE__ */ M("p", {
276
- className: "sr-only",
277
- "aria-live": "polite",
278
- "aria-atomic": "true",
279
- children: D
280
- }),
281
- /* @__PURE__ */ M(We, {
282
- table: e,
283
- unite: h,
284
- feminin: g
285
- }),
286
- /* @__PURE__ */ N(c, {
287
- "aria-label": t,
288
- "aria-busy": r || void 0,
289
- children: [/* @__PURE__ */ M(f, { children: e.getHeaderGroups().map((t) => /* @__PURE__ */ M(p, { children: t.headers.map((t) => /* @__PURE__ */ M(d, {
290
- colSpan: t.colSpan,
291
- "aria-sort": Ge(t.column),
292
- className: t.column.columnDef.meta?.className,
293
- children: t.isPlaceholder ? null : /* @__PURE__ */ M(e.FlexRender, { header: t })
294
- }, t.id)) }, t.id)) }), /* @__PURE__ */ M(l, {
295
- className: C(r && y.length > 0 && "opacity-60 transition-opacity"),
296
- children: y.length ? y.map((t) => /* @__PURE__ */ M(Ue, {
297
- row: t,
298
- selectionnee: t.getIsSelected(),
299
- selectionnable: t.getCanSelect(),
300
- depliee: t.getIsExpanded(),
301
- depliable: t.getCanExpand(),
302
- cleColonnes: x,
303
- colonnes: e.options.columns,
304
- cliquable: o !== void 0 || m !== void 0 && t.getCanExpand(),
305
- activer: E,
306
- rendreDetail: m
307
- }, t.id)) : r ? Array.from({ length: i }, (e, t) => /* @__PURE__ */ M(p, {
308
- "data-slot": "data-table-skeleton",
309
- "aria-hidden": !0,
310
- children: b.map((e) => /* @__PURE__ */ M(u, { children: /* @__PURE__ */ M(s, { className: "h-4 w-full max-w-32" }) }, e.id))
311
- }, t)) : /* @__PURE__ */ M(p, {
312
- className: "hover:bg-transparent",
313
- children: /* @__PURE__ */ M(u, {
314
- colSpan: b.length || 1,
315
- className: "h-24 p-0 text-center whitespace-normal text-muted-foreground",
316
- children: /* @__PURE__ */ M("div", {
317
- className: "sticky left-0 w-[var(--data-table-largeur,100%)] p-2",
318
- children: v
319
- })
276
+ className: C("min-w-0 overflow-hidden rounded-md border bg-tableau", _),
277
+ children: [/* @__PURE__ */ j("p", {
278
+ className: "sr-only",
279
+ "aria-live": "polite",
280
+ "aria-atomic": "true",
281
+ children: k
282
+ }), /* @__PURE__ */ M(c, {
283
+ "aria-label": t,
284
+ "aria-busy": r || void 0,
285
+ children: [/* @__PURE__ */ j(f, { children: e.getHeaderGroups().map((t) => /* @__PURE__ */ j(p, { children: t.headers.map((t) => /* @__PURE__ */ j(d, {
286
+ colSpan: t.colSpan,
287
+ "aria-sort": Ue(t.column),
288
+ className: t.column.columnDef.meta?.className,
289
+ children: t.isPlaceholder ? null : /* @__PURE__ */ j(e.FlexRender, { header: t })
290
+ }, t.id)) }, t.id)) }), /* @__PURE__ */ j(l, {
291
+ className: C(r && b.length > 0 && "opacity-60 transition-opacity"),
292
+ children: b.length ? b.map((t) => /* @__PURE__ */ j(He, {
293
+ row: t,
294
+ selectionnee: t.getIsSelected(),
295
+ selectionnable: t.getCanSelect(),
296
+ depliee: t.getIsExpanded(),
297
+ depliable: t.getCanExpand(),
298
+ cleColonnes: S,
299
+ colonnes: e.options.columns,
300
+ cliquable: o !== void 0 || m !== void 0 && t.getCanExpand(),
301
+ activer: E,
302
+ rendreDetail: m
303
+ }, t.id)) : r ? Array.from({ length: i }, (e, t) => /* @__PURE__ */ j(p, {
304
+ "data-slot": "data-table-skeleton",
305
+ "aria-hidden": !0,
306
+ children: x.map((e) => /* @__PURE__ */ j(u, { children: /* @__PURE__ */ j(s, { className: "h-4 w-full max-w-32" }) }, e.id))
307
+ }, t)) : /* @__PURE__ */ j(p, {
308
+ className: "hover:bg-transparent",
309
+ children: /* @__PURE__ */ j(u, {
310
+ colSpan: x.length || 1,
311
+ className: "h-24 p-0 text-center whitespace-normal text-muted-foreground",
312
+ children: /* @__PURE__ */ j("div", {
313
+ className: "sticky left-0 w-[var(--data-table-largeur,100%)] p-2",
314
+ children: v
320
315
  })
321
316
  })
322
- })]
323
- })
324
- ]
317
+ })
318
+ })]
319
+ })]
325
320
  })] });
326
321
  }
327
- function Le(e, t, n) {
328
- let r = k(/* @__PURE__ */ new WeakMap()), i = k(t), a = k(!1), o = () => e.current?.querySelectorAll("[data-slot=\"table-header\"] [data-slot=\"table-head\"]") ?? [];
329
- O(() => {
322
+ function Ie(e, t, n) {
323
+ let r = O(/* @__PURE__ */ new WeakMap()), i = O(t), a = O(!1), o = () => e.current?.querySelectorAll("[data-slot=\"table-header\"] [data-slot=\"table-head\"]") ?? [];
324
+ D(() => {
330
325
  if (typeof ResizeObserver > "u") return;
331
326
  let e = new ResizeObserver((e) => {
332
327
  if (i.current) for (let { target: t, borderBoxSize: n, contentRect: i } of e) r.current.set(t, n?.[0]?.inlineSize ?? i.width);
333
328
  });
334
329
  for (let t of o()) e.observe(t);
335
330
  return () => e.disconnect();
336
- }, [e, n]), O(() => {
331
+ }, [e, n]), D(() => {
337
332
  if (i.current = t, a.current) {
338
333
  for (let e of o()) e.style.removeProperty("width");
339
334
  a.current = !1;
@@ -344,142 +339,122 @@ function Le(e, t, n) {
344
339
  }
345
340
  }, [t, n]);
346
341
  }
347
- function Re(e, t, { unite: n, feminin: r }) {
348
- let [i] = e.state.sorting ?? [], a = i ? e.getColumn(i.id) : void 0, o = a ? `Trié par ${ke(a)}, ordre ${i.desc ? "décroissant" : "croissant"}.` : "", [s, c] = A(o), [l, u] = A("");
342
+ function Le(e, t, { unite: n, feminin: r }) {
343
+ let [i] = e.state.sorting ?? [], a = i ? e.getColumn(i.id) : void 0, o = a ? `Trié par ${Oe(a)}, ordre ${i.desc ? "décroissant" : "croissant"}.` : "", [s, c] = k(o), [l, u] = k("");
349
344
  o !== s && (c(o), u(o));
350
345
  let d = Z(e);
351
- return t ? "Chargement…" : d.toutSelectionne && d.total !== void 0 ? je(d.total, n, r) : l;
346
+ return t ? "Chargement…" : d.toutSelectionne && d.total !== void 0 ? Ae(d.total, n, r) : l;
352
347
  }
353
- function ze(e, t) {
354
- O(() => () => {
348
+ function Re(e, t) {
349
+ D(() => () => {
355
350
  let n = e.current;
356
- n && t.current.actif && y(n, t.current.rang);
351
+ n && t.current.actif && v(n, t.current.rang);
357
352
  }, [e, t]);
358
353
  }
359
- function Be(e, t, n = !0) {
354
+ function ze(e, t, n = !0) {
360
355
  if (t.actif = !0, !n) return;
361
356
  let r = e.target.closest("td, th");
362
357
  r instanceof HTMLTableCellElement && e.currentTarget.contains(r) && (t.rang = r.cellIndex);
363
358
  }
364
- function Ve(e) {
359
+ function Be(e) {
365
360
  e.actif = !1;
366
361
  }
367
- function He({ row: e, selectionnee: t, depliee: n, cliquable: r, activer: i, rendreDetail: a }) {
368
- let o = e.table, s = k(null), c = k({
362
+ function Ve({ row: e, selectionnee: t, depliee: n, cliquable: r, activer: i, rendreDetail: a }) {
363
+ let o = e.table, s = O(null), c = O({
369
364
  actif: !1,
370
365
  rang: -1
371
366
  });
372
- ze(s, c);
367
+ Re(s, c);
373
368
  let l = e.getVisibleCells();
374
- return /* @__PURE__ */ N(j, { children: [/* @__PURE__ */ M(p, {
369
+ return /* @__PURE__ */ M(A, { children: [/* @__PURE__ */ j(p, {
375
370
  ref: s,
376
- onFocus: (e) => Be(e, c.current),
377
- onBlur: () => Ve(c.current),
371
+ onFocus: (e) => ze(e, c.current),
372
+ onBlur: () => Be(c.current),
378
373
  "data-state": t ? "selected" : void 0,
379
- className: C(r && "cursor-pointer"),
374
+ className: C("group/ligne", r && "cursor-pointer", n && a && "border-b-0 bg-muted/50"),
380
375
  onClick: r ? (t) => {
381
- Fe(t) && i(e);
376
+ Pe(t) && i(e);
382
377
  } : void 0,
383
- children: l.map((e) => /* @__PURE__ */ M(u, {
378
+ children: l.map((e) => /* @__PURE__ */ j(u, {
384
379
  className: e.column.columnDef.meta?.className,
385
- children: /* @__PURE__ */ M(o.FlexRender, { cell: e })
380
+ children: /* @__PURE__ */ j(o.FlexRender, { cell: e })
386
381
  }, e.id))
387
- }), n && a ? /* @__PURE__ */ M(p, {
382
+ }), n && a ? /* @__PURE__ */ j(p, {
388
383
  "data-slot": "data-table-detail",
389
- className: "bg-muted/30 hover:bg-muted/30",
390
- onFocus: (e) => Be(e, c.current, !1),
391
- onBlur: () => Ve(c.current),
392
- children: /* @__PURE__ */ M(u, {
384
+ className: t ? "bg-muted hover:bg-muted" : "bg-muted/50 hover:bg-muted/50",
385
+ onFocus: (e) => ze(e, c.current, !1),
386
+ onBlur: () => Be(c.current),
387
+ children: /* @__PURE__ */ j(u, {
393
388
  id: Z(o).idDetail(e.id),
394
389
  colSpan: l.length,
395
390
  className: "p-0 whitespace-normal",
396
- children: /* @__PURE__ */ M("div", {
391
+ children: /* @__PURE__ */ j("div", {
397
392
  className: "sticky left-0 w-[var(--data-table-largeur,100%)] p-3",
398
393
  children: a(e.original)
399
394
  })
400
395
  })
401
396
  }) : null] });
402
397
  }
403
- var Ue = w(He, (e, t) => e.row === t.row && e.selectionnee === t.selectionnee && e.selectionnable === t.selectionnable && e.depliee === t.depliee && e.depliable === t.depliable && e.cleColonnes === t.cleColonnes && e.colonnes === t.colonnes && e.cliquable === t.cliquable && e.activer === t.activer && (!t.depliee || e.rendreDetail === t.rendreDetail));
404
- function We({ table: r, unite: i, feminin: a }) {
405
- let o = Z(r), s = r.getRowModel().rows, { total: c } = o, l = s.filter((e) => e.getIsSelected()).length;
406
- return c === void 0 || s.length === 0 || !r.getIsAllPageRowsSelected() || c <= l ? null : /* @__PURE__ */ M("div", {
407
- "data-slot": "data-table-select-all",
408
- className: "flex flex-wrap items-center justify-center gap-x-2 border-b bg-muted/50 px-3 py-1.5 text-center text-sm",
409
- children: o.toutSelectionne ? /* @__PURE__ */ N(j, { children: [/* @__PURE__ */ M("span", { children: je(c, i, a) }), /* @__PURE__ */ M(n, {
410
- variant: "link",
411
- className: "h-auto px-0",
412
- onClick: () => {
413
- v(o.racine.current), o.toutDeselectionner();
414
- },
415
- children: "Tout désélectionner"
416
- })] }) : /* @__PURE__ */ N(j, { children: [/* @__PURE__ */ M("span", { children: l > 1 ? `Les ${e(l)} ${i.pluriel} de la page sont ${t("sélectionné", 2, a)}.` : `1 ${i.singulier} de la page est ${t("sélectionné", 1, a)}.` }), /* @__PURE__ */ M(n, {
417
- variant: "link",
418
- className: "h-auto px-0",
419
- onClick: () => o.changerToutSelectionne(!0),
420
- children: `Sélectionner les ${e(c)} ${i.pluriel}`
421
- })] })
422
- });
423
- }
424
- function Ge(e) {
398
+ var He = w(Ve, (e, t) => e.row === t.row && e.selectionnee === t.selectionnee && e.selectionnable === t.selectionnable && e.depliee === t.depliee && e.depliable === t.depliable && e.cleColonnes === t.cleColonnes && e.colonnes === t.colonnes && e.cliquable === t.cliquable && e.activer === t.activer && (!t.depliee || e.rendreDetail === t.rendreDetail));
399
+ function Ue(e) {
425
400
  let t = e.getIsSorted();
426
401
  if (t === "asc") return "ascending";
427
402
  if (t === "desc") return "descending";
428
403
  }
429
- function Ke({ column: e, libelle: t, className: r }) {
430
- if (!e.getCanSort()) return /* @__PURE__ */ M("div", {
404
+ function We({ column: e, libelle: t, className: r }) {
405
+ if (!e.getCanSort()) return /* @__PURE__ */ j("div", {
431
406
  className: r,
432
407
  children: t
433
408
  });
434
- let i = e.getIsSorted(), a = i === "desc" ? re : i === "asc" ? ie : F;
435
- return /* @__PURE__ */ M("div", {
409
+ let i = e.getIsSorted(), a = i === "desc" ? N : i === "asc" ? re : P;
410
+ return /* @__PURE__ */ j("div", {
436
411
  className: C("flex items-center gap-2", r),
437
- children: /* @__PURE__ */ N(n, {
412
+ children: /* @__PURE__ */ M(n, {
438
413
  variant: "ghost",
439
414
  size: "sm",
440
415
  className: "-ml-2.5 h-8 text-sm",
441
416
  onClick: () => e.toggleSorting(i === "asc"),
442
- children: [/* @__PURE__ */ M("span", { children: t }), /* @__PURE__ */ M(a, {
417
+ children: [/* @__PURE__ */ j("span", { children: t }), /* @__PURE__ */ j(a, {
443
418
  "data-icon": "inline-end",
444
419
  className: C(!i && "text-muted-foreground")
445
420
  })]
446
421
  })
447
422
  });
448
423
  }
449
- function qe({ libelleLigne: e, libelleTout: t = "Sélectionner la page", verrouLigne: n } = {}) {
424
+ function Ge({ libelleLigne: e, libelleTout: t = "Sélectionner la page", verrouLigne: n } = {}) {
450
425
  return X().display({
451
426
  id: "select",
452
427
  header: ({ table: e }) => {
453
428
  let n = e.getRowModel().rows.filter((e) => e.getCanSelect()), i = e.getIsAllPageRowsSelected();
454
- return /* @__PURE__ */ M(r, {
429
+ return /* @__PURE__ */ j(r, {
455
430
  checked: i,
456
431
  indeterminate: e.getIsSomePageRowsSelected() && !i,
457
432
  disabled: n.length === 0,
458
433
  onCheckedChange: (t) => e.toggleAllPageRowsSelected(t),
459
434
  "aria-label": t,
460
- className: Je
435
+ className: Ke
461
436
  });
462
437
  },
463
- cell: ({ row: t }) => /* @__PURE__ */ M(Ze, {
438
+ cell: ({ row: t }) => /* @__PURE__ */ j(Ye, {
464
439
  row: t,
465
440
  libelle: e?.(t.original) ?? "Sélectionner la ligne",
466
441
  verrou: t.getCanSelect() ? void 0 : n?.(t.original)
467
442
  }),
468
443
  enableSorting: !1,
469
444
  enableHiding: !1,
470
- meta: { className: Ye }
445
+ meta: { className: qe }
471
446
  });
472
447
  }
473
- var Je = "after:-inset-3", Ye = "w-10 px-3 [&:has([role=checkbox])]:pr-3", Xe = "aria-disabled:cursor-not-allowed aria-disabled:opacity-100 aria-disabled:not-data-checked:bg-muted aria-disabled:data-checked:border-muted-foreground aria-disabled:data-checked:bg-muted-foreground aria-disabled:data-checked:text-background";
474
- function Ze({ row: e, libelle: t, verrou: n }) {
475
- let i = D(), a = e.getToggleSelectedHandler(), o = e.getCanSelect(), s = /* @__PURE__ */ M(r, {
448
+ var Ke = "after:-inset-3", qe = "w-10 px-3 [&:has([role=checkbox])]:pr-3", Je = "aria-disabled:cursor-not-allowed aria-disabled:opacity-100 aria-disabled:not-data-checked:bg-muted aria-disabled:data-checked:border-muted-foreground aria-disabled:data-checked:bg-muted-foreground aria-disabled:data-checked:text-background";
449
+ function Ye({ row: e, libelle: t, verrou: n }) {
450
+ let i = E(), a = e.getToggleSelectedHandler(), o = e.getCanSelect(), s = /* @__PURE__ */ j(r, {
476
451
  checked: e.getIsSelected(),
477
452
  disabled: !o && !n,
478
453
  readOnly: !o,
479
454
  "aria-disabled": !o || void 0,
480
455
  "aria-describedby": n ? i : void 0,
481
456
  "aria-label": t,
482
- className: C(Je, Xe),
457
+ className: C(Ke, Je),
483
458
  onCheckedChange: (e, t) => a({
484
459
  target: { checked: e },
485
460
  shiftKey: t.event.shiftKey
@@ -488,20 +463,20 @@ function Ze({ row: e, libelle: t, verrou: n }) {
488
463
  e.shiftKey && e.preventDefault();
489
464
  }
490
465
  });
491
- return n ? /* @__PURE__ */ N(j, { children: [/* @__PURE__ */ N(m, { children: [/* @__PURE__ */ M(g, { render: s }), /* @__PURE__ */ M(h, { children: n })] }), /* @__PURE__ */ M("span", {
466
+ return n ? /* @__PURE__ */ M(A, { children: [/* @__PURE__ */ M(m, { children: [/* @__PURE__ */ j(g, { render: s }), /* @__PURE__ */ j(h, { children: n })] }), /* @__PURE__ */ j("span", {
492
467
  id: i,
493
468
  hidden: !0,
494
469
  children: n
495
470
  })] }) : s;
496
471
  }
497
- function Qe({ libelleLigne: e, libelle: t = "Détail" } = {}) {
472
+ function Xe({ libelleLigne: e, libelle: t = "Détail" } = {}) {
498
473
  return X().display({
499
474
  id: "expand",
500
- header: () => /* @__PURE__ */ M("span", {
475
+ header: () => /* @__PURE__ */ j("span", {
501
476
  className: "sr-only",
502
477
  children: t
503
478
  }),
504
- cell: ({ row: t, table: n }) => t.getCanExpand() ? /* @__PURE__ */ M($e, {
479
+ cell: ({ row: t, table: n }) => t.getCanExpand() ? /* @__PURE__ */ j(Ze, {
505
480
  deplie: t.getIsExpanded(),
506
481
  onBasculer: () => t.toggleExpanded(),
507
482
  libelle: e?.(t.original) ?? "Détail de la ligne",
@@ -512,9 +487,9 @@ function Qe({ libelleLigne: e, libelle: t = "Détail" } = {}) {
512
487
  meta: { className: "w-8" }
513
488
  });
514
489
  }
515
- function $e({ deplie: e, onBasculer: t, libelle: r, idDetail: i }) {
516
- return /* @__PURE__ */ N(m, { children: [/* @__PURE__ */ M(g, {
517
- render: /* @__PURE__ */ M(n, {
490
+ function Ze({ deplie: e, onBasculer: t, libelle: r, idDetail: i }) {
491
+ return /* @__PURE__ */ M(m, { children: [/* @__PURE__ */ j(g, {
492
+ render: /* @__PURE__ */ j(n, {
518
493
  variant: "ghost",
519
494
  size: "icon-xs",
520
495
  "aria-label": r,
@@ -522,32 +497,33 @@ function $e({ deplie: e, onBasculer: t, libelle: r, idDetail: i }) {
522
497
  "aria-controls": e ? i : void 0,
523
498
  onClick: t
524
499
  }),
525
- children: /* @__PURE__ */ M(P, { className: C("transition-transform motion-reduce:transition-none", e && "rotate-90") })
526
- }), /* @__PURE__ */ M(h, { children: r })] });
500
+ children: /* @__PURE__ */ j(ie, { className: C("transition-transform motion-reduce:transition-none", e && "rotate-90") })
501
+ }), /* @__PURE__ */ j(h, { children: r })] });
527
502
  }
528
- function et({ children: e, libelle: t }) {
529
- return /* @__PURE__ */ N(i, { children: [/* @__PURE__ */ N(m, { children: [/* @__PURE__ */ M(g, {
530
- render: /* @__PURE__ */ M(o, { render: /* @__PURE__ */ M(n, {
503
+ function Qe({ children: e, libelle: t }) {
504
+ return /* @__PURE__ */ M(i, { children: [/* @__PURE__ */ M(m, { children: [/* @__PURE__ */ j(g, {
505
+ render: /* @__PURE__ */ j(o, { render: /* @__PURE__ */ j(n, {
531
506
  variant: "ghost",
532
507
  size: "icon-xs",
533
508
  "aria-label": t
534
509
  }) }),
535
- children: /* @__PURE__ */ M(I, {})
536
- }), /* @__PURE__ */ M(h, { children: t })] }), /* @__PURE__ */ M(a, {
510
+ children: /* @__PURE__ */ j(F, {})
511
+ }), /* @__PURE__ */ j(h, { children: t })] }), /* @__PURE__ */ j(a, {
537
512
  align: "end",
538
513
  className: "w-44",
539
514
  children: e
540
515
  })] });
541
516
  }
542
- function tt({ actions: e, libelle: t = "Actions", id: n = "actions", enableHiding: r = !1, className: i }) {
517
+ var $e = "opacity-0 transition-opacity group-hover/ligne:opacity-100 group-focus-within/ligne:opacity-100 has-aria-expanded:opacity-100 pointer-coarse:opacity-100";
518
+ function et({ actions: e, libelle: t = "Actions", id: n = "actions", enableHiding: r = !1, className: i, toujoursVisibles: a = !1 }) {
543
519
  return X().display({
544
520
  id: n,
545
- header: () => /* @__PURE__ */ M("span", {
521
+ header: () => /* @__PURE__ */ j("span", {
546
522
  className: "sr-only",
547
523
  children: t
548
524
  }),
549
- cell: ({ row: t }) => /* @__PURE__ */ M("div", {
550
- className: "flex items-center justify-end gap-1",
525
+ cell: ({ row: t }) => /* @__PURE__ */ j("div", {
526
+ className: C("flex items-center justify-end gap-1", !a && $e),
551
527
  children: e(t.original)
552
528
  }),
553
529
  enableSorting: !1,
@@ -558,25 +534,25 @@ function tt({ actions: e, libelle: t = "Actions", id: n = "actions", enableHidin
558
534
  }
559
535
  });
560
536
  }
561
- var nt = "rounded-sm text-left font-medium underline-offset-4 outline-none hover:underline focus-visible:ring-3 focus-visible:ring-ring/50";
562
- function rt(e) {
537
+ var tt = "rounded-sm text-left font-medium outline-none focus-visible:ring-3 focus-visible:ring-ring/50";
538
+ function nt(e) {
563
539
  let { lien: t, ...n } = e, r = _(t);
564
540
  if (n.href !== void 0) {
565
541
  let { className: e, ...t } = n;
566
- return /* @__PURE__ */ M(r, {
542
+ return /* @__PURE__ */ j(r, {
567
543
  "data-slot": "data-table-cell-link",
568
- className: C(nt, e),
544
+ className: C(tt, e),
569
545
  ...t
570
546
  });
571
547
  }
572
548
  let { className: i, type: a = "button", ...o } = n;
573
- return /* @__PURE__ */ M("button", {
549
+ return /* @__PURE__ */ j("button", {
574
550
  "data-slot": "data-table-cell-link",
575
551
  type: a,
576
- className: C(nt, "cursor-pointer", i),
552
+ className: C(tt, "cursor-pointer", i),
577
553
  ...o
578
554
  });
579
555
  }
580
- export { Xe as CASE_VERROUILLEE, Ie as DataTable, rt as DataTableCellLink, Ke as DataTableColumnHeader, et as DataTableRowActions, X as createDataTableColumnHelper, tt as dataTableActionsColumn, Qe as dataTableExpandColumn, Oe as dataTableFeatures, qe as dataTableSelectionColumn, ke as libelleColonne, Z as metaDe, Ae as paginationDuTableau, Ne as useDataTable };
556
+ export { Je as CASE_VERROUILLEE, Fe as DataTable, nt as DataTableCellLink, We as DataTableColumnHeader, Qe as DataTableRowActions, X as createDataTableColumnHelper, et as dataTableActionsColumn, Xe as dataTableExpandColumn, De as dataTableFeatures, Ge as dataTableSelectionColumn, Oe as libelleColonne, Z as metaDe, ke as paginationDuTableau, Me as useDataTable };
581
557
 
582
558
  //# sourceMappingURL=data-table.js.map