@etic-insa/ui 0.2.0 → 0.3.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 +438 -37
  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 +16 -7
  6. package/dist/components/etic/app-shell.js +92 -85
  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 +28 -4
  24. package/dist/components/etic/data-table-bulk-actions.js +48 -41
  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 +173 -15
  42. package/dist/components/etic/data-table.js +381 -202
  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 +16 -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 +70 -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 +10 -4
  84. package/dist/components/etic/page-header.js +48 -43
  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 +31 -0
  94. package/dist/components/etic/removable-badge.js.map +1 -0
  95. package/dist/components/etic/save-bar.d.ts +31 -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 +1 -1
  107. package/dist/components/etic/stat-tile.js +12 -18
  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 +1 -2
  116. package/dist/components/etic/theme-menu.js +45 -41
  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 +13 -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 +27 -15
  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 +110 -63
  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,222 @@
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 { focaliserTableau as v, rendreFocusApresLigne as y } from "./data-table-focus.js";
11
+ import { QueryErrorBanner as te } 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 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";
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 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());
23
+ let i = r.get(n);
24
+ return i || r.set(n, i = /* @__PURE__ */ new Map()), i;
25
+ }
26
+ function Te(e, t) {
27
+ let n = we(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 Ee = R({
33
+ filter: (e, t, n, r) => t === "" || (Te(n, r)?.includes(t) ?? !1),
34
+ autoRemove: (e) => S(String(e ?? "")) === "",
35
+ resolveFilterValue: (e) => S(String(e ?? ""))
36
+ }), De = se({
37
+ resolveDataValue: (e) => e == null ? "" : String(e),
38
+ sort: b
39
+ }), Oe = xe({
40
+ columnFilteringFeature: ae,
41
+ columnOrderingFeature: L,
42
+ columnVisibilityFeature: oe,
43
+ globalFilteringFeature: J,
44
+ rowExpandingFeature: pe,
45
+ rowPaginationFeature: me,
46
+ rowSelectionFeature: he,
47
+ rowSortingFeature: ge,
48
+ filteredRowModel: B(),
49
+ paginatedRowModel: V(),
50
+ sortedRowModel: ce(),
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
62
+ },
21
63
  sortFns: {
22
- alphanumeric: W,
23
- basic: G,
24
- datetime: K,
25
- text: q
64
+ alphanumeric: _e,
65
+ basic: ve,
66
+ datetime: ye,
67
+ text: be,
68
+ texteFr: De
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 z();
32
75
  }
33
- function Z(e) {
76
+ function ke(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 Ae(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 je(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] = A(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 Me = 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 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 = {};
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(fe(e, I));
114
+ let [L, oe] = Q(C, w, j?.lignesDepliees ?? {});
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;
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 = Se({
124
+ features: Oe,
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: T ? (e) => T(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: Me,
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: b,
85
152
  get toutSelectionne() {
86
- return k && G();
153
+ return M && B;
87
154
  },
88
155
  changerToutSelectionne: (e) => {
89
- e && H.toggleAllPageRowsSelected(!0), A(e);
156
+ e && R.toggleAllPageRowsSelected(!0), N(e);
90
157
  },
91
158
  toutDeselectionner: () => {
92
- H.resetRowSelection(!0), k && A(!1);
159
+ R.resetRowSelection(!0), N(!1);
160
+ },
161
+ deselectionner: (e) => {
162
+ let t = new Set(e);
163
+ R.setRowSelection((e) => $(e, (e) => !t.has(e))), N(!1);
93
164
  },
94
- racine: j,
95
- idDetail: (e) => `${M}detail-${encodeURIComponent(e)}`
165
+ racine: re,
166
+ idDetail: (e) => `${ie}detail-${encodeURIComponent(e)}`,
167
+ colonnesReglables: ee
96
168
  }
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();
169
+ }), se = R.getCoreRowModel().rows, z = R.getRowModel().rows, B = R.getIsAllPageRowsSelected(), V = k(null), ce = E(() => N(!1));
170
+ ne(() => {
171
+ let e = z.map((e) => e.id).sort().join("\0"), t = V.current !== null && V.current !== e;
172
+ V.current = e, M && (t || !B) && ce();
106
173
  }, [
107
- W,
108
- K,
109
- k
174
+ z,
175
+ B,
176
+ M
110
177
  ]);
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));
178
+ let le = E(() => {
179
+ if (te || Object.keys(I).length === 0) return;
180
+ let e = new Set(z.map((e) => e.id));
181
+ R.setRowSelection((t) => $(t, (t) => e.has(t)));
182
+ });
183
+ O(() => {
184
+ le();
185
+ }, [z]);
186
+ let ue = E(() => {
187
+ if (Object.keys(L).length === 0) return;
188
+ let { rowsById: e } = R.getCoreRowModel();
189
+ R.setExpanded((t) => t === !0 ? t : $(t, (t) => t in e));
190
+ });
191
+ O(() => {
192
+ ue();
193
+ }, [se]);
194
+ let { columnFilters: H, globalFilter: U, sorting: W, pagination: G } = R.state, K = k(null), de = E(() => {
195
+ o && R.state.pagination.pageIndex !== 0 && R.setPageIndex(0);
114
196
  });
115
- return x(() => {
116
- X();
117
- }, [U]), H;
197
+ O(() => {
198
+ let e = JSON.stringify([
199
+ H,
200
+ U,
201
+ W
202
+ ]), t = K.current;
203
+ K.current = e, t !== null && t !== e && de();
204
+ }, [
205
+ H,
206
+ U,
207
+ W
208
+ ]);
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
+ }, [
213
+ o,
214
+ J,
215
+ G.pageIndex,
216
+ q
217
+ ]), R;
118
218
  }
119
- var ne = [
219
+ var Pe = [
120
220
  "a[href]",
121
221
  "button",
122
222
  "input",
@@ -145,200 +245,241 @@ var ne = [
145
245
  "menuitemradio"
146
246
  ].map((e) => `[role=${e}]`)
147
247
  ].join(", ");
148
- function re(e) {
248
+ function Fe(e) {
149
249
  let t = e.currentTarget, n = e.target;
150
250
  if (!t.contains(n)) return !1;
151
- let r = n.closest(ne);
251
+ let r = n.closest(Pe);
152
252
  return r && r !== t && t.contains(r) ? !1 : !window.getSelection()?.toString();
153
253
  }
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;
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;
158
258
  });
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,
259
+ let E = T((e) => w.current?.(e), []);
260
+ ne(() => {
261
+ let e = S.current, t = e?.querySelector("[data-slot=\"table-container\"]");
262
+ if (!e || !t || typeof ResizeObserver > "u") return;
263
+ let n = new ResizeObserver(() => e.style.setProperty("--data-table-largeur", `${t.clientWidth}px`));
264
+ return n.observe(t), () => n.disconnect();
265
+ }, [S]), Le(S, y.length > 0, x);
266
+ let D = Re(e, r && y.length === 0, {
267
+ unite: h,
168
268
  feminin: g
169
269
  });
170
- return /* @__PURE__ */ k("div", {
171
- ref: A,
270
+ return /* @__PURE__ */ N(j, { children: [n ? /* @__PURE__ */ M(te, { requete: n }) : null, /* @__PURE__ */ N("div", {
271
+ ref: S,
172
272
  "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,
273
+ className: C("min-w-0 overflow-hidden rounded-md border bg-card", _),
175
274
  children: [
176
- /* @__PURE__ */ O("p", {
275
+ /* @__PURE__ */ M("p", {
177
276
  className: "sr-only",
178
277
  "aria-live": "polite",
179
278
  "aria-atomic": "true",
180
- children: F
279
+ children: D
181
280
  }),
182
- /* @__PURE__ */ O(ce, {
281
+ /* @__PURE__ */ M(We, {
183
282
  table: e,
184
- unite: m,
283
+ unite: h,
185
284
  feminin: g
186
285
  }),
187
- /* @__PURE__ */ k(o, {
286
+ /* @__PURE__ */ N(c, {
188
287
  "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, {
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, {
191
290
  colSpan: t.colSpan,
192
- "aria-sort": le(t.column),
291
+ "aria-sort": Ge(t.column),
193
292
  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, {
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, {
198
297
  row: t,
199
298
  selectionnee: t.getIsSelected(),
200
299
  selectionnable: t.getCanSelect(),
201
300
  depliee: t.getIsExpanded(),
202
301
  depliable: t.getCanExpand(),
203
- cleColonnes: C,
302
+ cleColonnes: x,
204
303
  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, {
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, {
211
308
  "data-slot": "data-table-skeleton",
212
309
  "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, {
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, {
215
312
  className: "hover:bg-transparent",
216
- children: /* @__PURE__ */ O(c, {
217
- colSpan: S.length || 1,
313
+ children: /* @__PURE__ */ M(u, {
314
+ colSpan: b.length || 1,
218
315
  className: "h-24 p-0 text-center whitespace-normal text-muted-foreground",
219
- children: /* @__PURE__ */ O("div", {
316
+ children: /* @__PURE__ */ M("div", {
220
317
  className: "sticky left-0 w-[var(--data-table-largeur,100%)] p-2",
221
- children: i
318
+ children: v
222
319
  })
223
320
  })
224
321
  })
225
322
  })]
226
323
  })
227
324
  ]
228
- });
325
+ })] });
326
+ }
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(() => {
330
+ if (typeof ResizeObserver > "u") return;
331
+ let e = new ResizeObserver((e) => {
332
+ if (i.current) for (let { target: t, borderBoxSize: n, contentRect: i } of e) r.current.set(t, n?.[0]?.inlineSize ?? i.width);
333
+ });
334
+ for (let t of o()) e.observe(t);
335
+ return () => e.disconnect();
336
+ }, [e, n]), O(() => {
337
+ if (i.current = t, a.current) {
338
+ for (let e of o()) e.style.removeProperty("width");
339
+ a.current = !1;
340
+ }
341
+ if (!t) for (let e of o()) {
342
+ let t = r.current.get(e);
343
+ t && (e.style.width = `${t}px`, a.current = !0);
344
+ }
345
+ }, [t, n]);
229
346
  }
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("");
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("");
232
349
  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;
350
+ let d = Z(e);
351
+ return t ? "Chargement…" : d.toutSelectionne && d.total !== void 0 ? je(d.total, n, r) : l;
235
352
  }
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, {
353
+ function ze(e, t) {
354
+ O(() => () => {
355
+ let n = e.current;
356
+ n && t.current.actif && y(n, t.current.rang);
357
+ }, [e, t]);
358
+ }
359
+ function Be(e, t, n = !0) {
360
+ if (t.actif = !0, !n) return;
361
+ let r = e.target.closest("td, th");
362
+ r instanceof HTMLTableCellElement && e.currentTarget.contains(r) && (t.rang = r.cellIndex);
363
+ }
364
+ function Ve(e) {
365
+ e.actif = !1;
366
+ }
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({
369
+ actif: !1,
370
+ rang: -1
371
+ });
372
+ ze(s, c);
373
+ let l = e.getVisibleCells();
374
+ return /* @__PURE__ */ N(j, { children: [/* @__PURE__ */ M(p, {
375
+ ref: s,
376
+ onFocus: (e) => Be(e, c.current),
377
+ onBlur: () => Ve(c.current),
239
378
  "data-state": t ? "selected" : void 0,
240
- className: v(r && "cursor-pointer"),
379
+ className: C(r && "cursor-pointer"),
241
380
  onClick: r ? (t) => {
242
- re(t) && i(e);
381
+ Fe(t) && i(e);
243
382
  } : void 0,
244
- children: e.getVisibleCells().map((e) => /* @__PURE__ */ O(c, {
383
+ children: l.map((e) => /* @__PURE__ */ M(u, {
245
384
  className: e.column.columnDef.meta?.className,
246
- children: /* @__PURE__ */ O(l.FlexRender, { cell: e })
385
+ children: /* @__PURE__ */ M(o.FlexRender, { cell: e })
247
386
  }, e.id))
248
- }), n && a ? /* @__PURE__ */ O(d, {
387
+ }), n && a ? /* @__PURE__ */ M(p, {
249
388
  "data-slot": "data-table-detail",
250
389
  className: "bg-muted/30 hover:bg-muted/30",
251
- children: /* @__PURE__ */ O(c, {
252
- id: s,
253
- colSpan: o,
390
+ onFocus: (e) => Be(e, c.current, !1),
391
+ onBlur: () => Ve(c.current),
392
+ children: /* @__PURE__ */ M(u, {
393
+ id: Z(o).idDetail(e.id),
394
+ colSpan: l.length,
254
395
  className: "p-0 whitespace-normal",
255
- children: /* @__PURE__ */ O("div", {
396
+ children: /* @__PURE__ */ M("div", {
256
397
  className: "sticky left-0 w-[var(--data-table-largeur,100%)] p-3",
257
398
  children: a(e.original)
258
399
  })
259
400
  })
260
401
  }) : null] });
261
402
  }
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", {
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", {
266
407
  "data-slot": "data-table-select-all",
267
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",
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, {
409
+ children: o.toutSelectionne ? /* @__PURE__ */ N(j, { children: [/* @__PURE__ */ M("span", { children: je(c, i, a) }), /* @__PURE__ */ M(n, {
269
410
  variant: "link",
270
411
  className: "h-auto px-0",
271
412
  onClick: () => {
272
- Q(i.racine.current), i.toutDeselectionner();
413
+ v(o.racine.current), o.toutDeselectionner();
273
414
  },
274
415
  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, {
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, {
276
417
  variant: "link",
277
418
  className: "h-auto px-0",
278
- onClick: () => i.changerToutSelectionne(!0),
279
- children: `Sélectionner les ${g(o)} ${n.pluriel}`
419
+ onClick: () => o.changerToutSelectionne(!0),
420
+ children: `Sélectionner les ${e(c)} ${i.pluriel}`
280
421
  })] })
281
422
  });
282
423
  }
283
- function le(e) {
424
+ function Ge(e) {
284
425
  let t = e.getIsSorted();
285
426
  if (t === "asc") return "ascending";
286
427
  if (t === "desc") return "descending";
287
428
  }
288
- function ue({ column: t, libelle: n, className: r }) {
289
- if (!t.getCanSort()) return /* @__PURE__ */ O("div", {
429
+ function Ke({ column: e, libelle: t, className: r }) {
430
+ if (!e.getCanSort()) return /* @__PURE__ */ M("div", {
290
431
  className: r,
291
- children: n
432
+ children: t
292
433
  });
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, {
434
+ let i = e.getIsSorted(), a = i === "desc" ? re : i === "asc" ? ie : F;
435
+ return /* @__PURE__ */ M("div", {
436
+ className: C("flex items-center gap-2", r),
437
+ children: /* @__PURE__ */ N(n, {
297
438
  variant: "ghost",
298
439
  size: "sm",
299
440
  className: "-ml-2.5 h-8 text-sm",
300
- onClick: () => t.toggleSorting(i === "asc"),
301
- children: [/* @__PURE__ */ O("span", { children: n }), /* @__PURE__ */ O(a, {
441
+ onClick: () => e.toggleSorting(i === "asc"),
442
+ children: [/* @__PURE__ */ M("span", { children: t }), /* @__PURE__ */ M(a, {
302
443
  "data-icon": "inline-end",
303
- className: v(!i && "text-muted-foreground")
444
+ className: C(!i && "text-muted-foreground")
304
445
  })]
305
446
  })
306
447
  });
307
448
  }
308
- function de({ libelleLigne: e, libelleTout: n = "Sélectionner la page", verrouLigne: r } = {}) {
449
+ function qe({ libelleLigne: e, libelleTout: t = "Sélectionner la page", verrouLigne: n } = {}) {
309
450
  return X().display({
310
451
  id: "select",
311
452
  header: ({ table: e }) => {
312
- let r = e.getRowModel().rows.filter((e) => e.getCanSelect()), i = e.getIsAllPageRowsSelected();
313
- return /* @__PURE__ */ O(t, {
453
+ let n = e.getRowModel().rows.filter((e) => e.getCanSelect()), i = e.getIsAllPageRowsSelected();
454
+ return /* @__PURE__ */ M(r, {
314
455
  checked: i,
315
456
  indeterminate: e.getIsSomePageRowsSelected() && !i,
316
- disabled: r.length === 0,
457
+ disabled: n.length === 0,
317
458
  onCheckedChange: (t) => e.toggleAllPageRowsSelected(t),
318
- "aria-label": n,
319
- className: fe
459
+ "aria-label": t,
460
+ className: Je
320
461
  });
321
462
  },
322
- cell: ({ row: t }) => /* @__PURE__ */ O(pe, {
463
+ cell: ({ row: t }) => /* @__PURE__ */ M(Ze, {
323
464
  row: t,
324
465
  libelle: e?.(t.original) ?? "Sélectionner la ligne",
325
- verrou: t.getCanSelect() ? void 0 : r?.(t.original)
466
+ verrou: t.getCanSelect() ? void 0 : n?.(t.original)
326
467
  }),
327
468
  enableSorting: !1,
328
469
  enableHiding: !1,
329
- meta: { className: "w-8" }
470
+ meta: { className: Ye }
330
471
  });
331
472
  }
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, {
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, {
335
476
  checked: e.getIsSelected(),
336
- disabled: !o && !r,
477
+ disabled: !o && !n,
337
478
  readOnly: !o,
338
479
  "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"),
480
+ "aria-describedby": n ? i : void 0,
481
+ "aria-label": t,
482
+ className: C(Je, Xe),
342
483
  onCheckedChange: (e, t) => a({
343
484
  target: { checked: e },
344
485
  shiftKey: t.event.shiftKey
@@ -347,57 +488,95 @@ function pe({ row: e, libelle: n, verrou: r }) {
347
488
  e.shiftKey && e.preventDefault();
348
489
  }
349
490
  });
350
- return r ? /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ k(f, { children: [/* @__PURE__ */ O(m, { render: s }), /* @__PURE__ */ O(p, { children: r })] }), /* @__PURE__ */ O("span", {
491
+ return n ? /* @__PURE__ */ N(j, { children: [/* @__PURE__ */ N(m, { children: [/* @__PURE__ */ M(g, { render: s }), /* @__PURE__ */ M(h, { children: n })] }), /* @__PURE__ */ M("span", {
351
492
  id: i,
352
493
  hidden: !0,
353
- children: r
494
+ children: n
354
495
  })] }) : s;
355
496
  }
356
- function me({ libelleLigne: e, libelle: t = "Détail" } = {}) {
497
+ function Qe({ libelleLigne: e, libelle: t = "Détail" } = {}) {
357
498
  return X().display({
358
499
  id: "expand",
359
- header: () => /* @__PURE__ */ O("span", {
500
+ header: () => /* @__PURE__ */ M("span", {
360
501
  className: "sr-only",
361
502
  children: t
362
503
  }),
363
- cell: ({ row: t, table: n }) => t.getCanExpand() ? /* @__PURE__ */ O(he, {
504
+ cell: ({ row: t, table: n }) => t.getCanExpand() ? /* @__PURE__ */ M($e, {
364
505
  deplie: t.getIsExpanded(),
365
506
  onBasculer: () => t.toggleExpanded(),
366
507
  libelle: e?.(t.original) ?? "Détail de la ligne",
367
- idDetail: n.options.meta?.idDetail(t.id)
508
+ idDetail: t.getIsExpanded() ? Z(n).idDetail(t.id) : void 0
368
509
  }) : null,
369
510
  enableSorting: !1,
370
511
  enableHiding: !1,
371
512
  meta: { className: "w-8" }
372
513
  });
373
514
  }
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, {
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, {
377
518
  variant: "ghost",
378
519
  size: "icon-xs",
379
520
  "aria-label": r,
380
- "aria-expanded": t,
381
- "aria-controls": t ? i : void 0,
382
- onClick: n
521
+ "aria-expanded": e,
522
+ "aria-controls": e ? i : void 0,
523
+ onClick: t
383
524
  }),
384
- children: /* @__PURE__ */ O(M, { className: v("transition-transform motion-reduce:transition-none", t && "rotate-90") })
385
- }), /* @__PURE__ */ O(p, { children: r })] });
525
+ children: /* @__PURE__ */ M(P, { className: C("transition-transform motion-reduce:transition-none", e && "rotate-90") })
526
+ }), /* @__PURE__ */ M(h, { children: r })] });
386
527
  }
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, {
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, {
390
531
  variant: "ghost",
391
532
  size: "icon-xs",
392
- "aria-label": a
533
+ "aria-label": t
393
534
  }) }),
394
- children: /* @__PURE__ */ O(P, {})
395
- }), /* @__PURE__ */ O(p, { children: a })] }), /* @__PURE__ */ O(r, {
535
+ children: /* @__PURE__ */ M(I, {})
536
+ }), /* @__PURE__ */ M(h, { children: t })] }), /* @__PURE__ */ M(a, {
396
537
  align: "end",
397
538
  className: "w-44",
398
- children: t
539
+ children: e
399
540
  })] });
400
541
  }
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 };
542
+ function tt({ actions: e, libelle: t = "Actions", id: n = "actions", enableHiding: r = !1, className: i }) {
543
+ return X().display({
544
+ id: n,
545
+ header: () => /* @__PURE__ */ M("span", {
546
+ className: "sr-only",
547
+ children: t
548
+ }),
549
+ cell: ({ row: t }) => /* @__PURE__ */ M("div", {
550
+ className: "flex items-center justify-end gap-1",
551
+ children: e(t.original)
552
+ }),
553
+ enableSorting: !1,
554
+ enableHiding: r,
555
+ meta: {
556
+ libelle: t,
557
+ className: C("w-px", i)
558
+ }
559
+ });
560
+ }
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) {
563
+ let { lien: t, ...n } = e, r = _(t);
564
+ if (n.href !== void 0) {
565
+ let { className: e, ...t } = n;
566
+ return /* @__PURE__ */ M(r, {
567
+ "data-slot": "data-table-cell-link",
568
+ className: C(nt, e),
569
+ ...t
570
+ });
571
+ }
572
+ let { className: i, type: a = "button", ...o } = n;
573
+ return /* @__PURE__ */ M("button", {
574
+ "data-slot": "data-table-cell-link",
575
+ type: a,
576
+ className: C(nt, "cursor-pointer", i),
577
+ ...o
578
+ });
579
+ }
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 };
402
581
 
403
582
  //# sourceMappingURL=data-table.js.map