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