@etic-insa/ui 0.1.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 (300) hide show
  1. package/README.md +897 -12
  2. package/dist/components/etic/action.d.ts +42 -0
  3. package/dist/components/etic/action.js +43 -0
  4. package/dist/components/etic/action.js.map +1 -0
  5. package/dist/components/etic/app-shell.d.ts +23 -11
  6. package/dist/components/etic/app-shell.js +133 -88
  7. package/dist/components/etic/app-shell.js.map +1 -1
  8. package/dist/components/etic/auth-image.d.ts +71 -0
  9. package/dist/components/etic/auth-image.js +67 -0
  10. package/dist/components/etic/auth-image.js.map +1 -0
  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/checkbox-list.d.ts +30 -0
  18. package/dist/components/etic/checkbox-list.js +56 -0
  19. package/dist/components/etic/checkbox-list.js.map +1 -0
  20. package/dist/components/etic/confirm-dialog.d.ts +93 -0
  21. package/dist/components/etic/confirm-dialog.js +109 -0
  22. package/dist/components/etic/confirm-dialog.js.map +1 -0
  23. package/dist/components/etic/copy-button.d.ts +25 -0
  24. package/dist/components/etic/copy-button.js +46 -0
  25. package/dist/components/etic/copy-button.js.map +1 -0
  26. package/dist/components/etic/data-table-bulk-actions.d.ts +53 -0
  27. package/dist/components/etic/data-table-bulk-actions.js +104 -0
  28. package/dist/components/etic/data-table-bulk-actions.js.map +1 -0
  29. package/dist/components/etic/data-table-focus.d.ts +17 -0
  30. package/dist/components/etic/data-table-focus.js +29 -0
  31. package/dist/components/etic/data-table-focus.js.map +1 -0
  32. package/dist/components/etic/data-table-format.d.ts +5 -0
  33. package/dist/components/etic/data-table-format.js +9 -0
  34. package/dist/components/etic/data-table-format.js.map +1 -0
  35. package/dist/components/etic/data-table-pagination.d.ts +36 -0
  36. package/dist/components/etic/data-table-pagination.js +134 -0
  37. package/dist/components/etic/data-table-pagination.js.map +1 -0
  38. package/dist/components/etic/data-table-toolbar.d.ts +90 -0
  39. package/dist/components/etic/data-table-toolbar.js +131 -0
  40. package/dist/components/etic/data-table-toolbar.js.map +1 -0
  41. package/dist/components/etic/data-table-view-options.d.ts +56 -0
  42. package/dist/components/etic/data-table-view-options.js +198 -0
  43. package/dist/components/etic/data-table-view-options.js.map +1 -0
  44. package/dist/components/etic/data-table.d.ts +421 -0
  45. package/dist/components/etic/data-table.js +582 -0
  46. package/dist/components/etic/data-table.js.map +1 -0
  47. package/dist/components/etic/date-picker.d.ts +36 -0
  48. package/dist/components/etic/date-picker.js +175 -0
  49. package/dist/components/etic/date-picker.js.map +1 -0
  50. package/dist/components/etic/delete-button.d.ts +65 -0
  51. package/dist/components/etic/delete-button.js +37 -0
  52. package/dist/components/etic/delete-button.js.map +1 -0
  53. package/dist/components/etic/detail-list.d.ts +26 -0
  54. package/dist/components/etic/detail-list.js +46 -0
  55. package/dist/components/etic/detail-list.js.map +1 -0
  56. package/dist/components/etic/disclosure.d.ts +52 -0
  57. package/dist/components/etic/disclosure.js +70 -0
  58. package/dist/components/etic/disclosure.js.map +1 -0
  59. package/dist/components/etic/draft-resume-dialog.d.ts +42 -0
  60. package/dist/components/etic/draft-resume-dialog.js +60 -0
  61. package/dist/components/etic/draft-resume-dialog.js.map +1 -0
  62. package/dist/components/etic/empty-state.d.ts +20 -0
  63. package/dist/components/etic/empty-state.js +20 -0
  64. package/dist/components/etic/empty-state.js.map +1 -0
  65. package/dist/components/etic/error-banner.d.ts +50 -0
  66. package/dist/components/etic/error-banner.js +85 -0
  67. package/dist/components/etic/error-banner.js.map +1 -0
  68. package/dist/components/etic/error-boundary.d.ts +53 -0
  69. package/dist/components/etic/error-boundary.js +83 -0
  70. package/dist/components/etic/error-boundary.js.map +1 -0
  71. package/dist/components/etic/explained-badge.d.ts +26 -0
  72. package/dist/components/etic/explained-badge.js +17 -0
  73. package/dist/components/etic/explained-badge.js.map +1 -0
  74. package/dist/components/etic/file-upload.d.ts +52 -0
  75. package/dist/components/etic/file-upload.js +137 -0
  76. package/dist/components/etic/file-upload.js.map +1 -0
  77. package/dist/components/etic/form-dialog.d.ts +68 -0
  78. package/dist/components/etic/form-dialog.js +154 -0
  79. package/dist/components/etic/form-dialog.js.map +1 -0
  80. package/dist/components/etic/form-field-context.d.ts +66 -0
  81. package/dist/components/etic/form-field-context.js +28 -0
  82. package/dist/components/etic/form-field-context.js.map +1 -0
  83. package/dist/components/etic/form-field.d.ts +53 -0
  84. package/dist/components/etic/form-field.js +105 -0
  85. package/dist/components/etic/form-field.js.map +1 -0
  86. package/dist/components/etic/icon-toggle.d.ts +51 -0
  87. package/dist/components/etic/icon-toggle.js +40 -0
  88. package/dist/components/etic/icon-toggle.js.map +1 -0
  89. package/dist/components/etic/lien.d.ts +34 -0
  90. package/dist/components/etic/lien.js +17 -0
  91. package/dist/components/etic/lien.js.map +1 -0
  92. package/dist/components/etic/loading.d.ts +37 -0
  93. package/dist/components/etic/loading.js +74 -0
  94. package/dist/components/etic/loading.js.map +1 -0
  95. package/dist/components/etic/page-container.d.ts +27 -0
  96. package/dist/components/etic/page-container.js +24 -0
  97. package/dist/components/etic/page-container.js.map +1 -0
  98. package/dist/components/etic/page-header.d.ts +64 -0
  99. package/dist/components/etic/page-header.js +109 -0
  100. package/dist/components/etic/page-header.js.map +1 -0
  101. package/dist/components/etic/phone-input.d.ts +47 -0
  102. package/dist/components/etic/phone-input.js +139 -0
  103. package/dist/components/etic/phone-input.js.map +1 -0
  104. package/dist/components/etic/query-boundary.d.ts +73 -0
  105. package/dist/components/etic/query-boundary.js +37 -0
  106. package/dist/components/etic/query-boundary.js.map +1 -0
  107. package/dist/components/etic/removable-badge.d.ts +30 -0
  108. package/dist/components/etic/removable-badge.js +31 -0
  109. package/dist/components/etic/removable-badge.js.map +1 -0
  110. package/dist/components/etic/save-bar.d.ts +31 -0
  111. package/dist/components/etic/save-bar.js +45 -0
  112. package/dist/components/etic/save-bar.js.map +1 -0
  113. package/dist/components/etic/search-select.d.ts +41 -0
  114. package/dist/components/etic/search-select.js +126 -0
  115. package/dist/components/etic/search-select.js.map +1 -0
  116. package/dist/components/etic/section-card.d.ts +12 -0
  117. package/dist/components/etic/section-card.js +23 -0
  118. package/dist/components/etic/section-card.js.map +1 -0
  119. package/dist/components/etic/segmented-control.d.ts +33 -0
  120. package/dist/components/etic/segmented-control.js +45 -0
  121. package/dist/components/etic/segmented-control.js.map +1 -0
  122. package/dist/components/etic/stat-grid.d.ts +15 -0
  123. package/dist/components/etic/stat-grid.js +17 -0
  124. package/dist/components/etic/stat-grid.js.map +1 -0
  125. package/dist/components/etic/stat-tile.d.ts +18 -0
  126. package/dist/components/etic/stat-tile.js +33 -0
  127. package/dist/components/etic/stat-tile.js.map +1 -0
  128. package/dist/components/etic/status-badge.d.ts +14 -0
  129. package/dist/components/etic/status-badge.js +20 -0
  130. package/dist/components/etic/status-badge.js.map +1 -0
  131. package/dist/components/etic/tailles-dialogue.d.ts +8 -0
  132. package/dist/components/etic/tailles-dialogue.js +10 -0
  133. package/dist/components/etic/tailles-dialogue.js.map +1 -0
  134. package/dist/components/etic/theme-menu.d.ts +6 -5
  135. package/dist/components/etic/theme-menu.js +46 -36
  136. package/dist/components/etic/theme-menu.js.map +1 -1
  137. package/dist/components/etic/toggletip.d.ts +36 -0
  138. package/dist/components/etic/toggletip.js +59 -0
  139. package/dist/components/etic/toggletip.js.map +1 -0
  140. package/dist/components/etic/tooltip-button.d.ts +39 -0
  141. package/dist/components/etic/tooltip-button.js +39 -0
  142. package/dist/components/etic/tooltip-button.js.map +1 -0
  143. package/dist/components/etic/unsaved-changes.d.ts +41 -0
  144. package/dist/components/etic/unsaved-changes.js +17 -0
  145. package/dist/components/etic/unsaved-changes.js.map +1 -0
  146. package/dist/components/etic/use-draft-autosave.d.ts +70 -0
  147. package/dist/components/etic/use-draft-autosave.js +98 -0
  148. package/dist/components/etic/use-draft-autosave.js.map +1 -0
  149. package/dist/components/etic/use-unsaved-changes-warning.d.ts +10 -0
  150. package/dist/components/etic/use-unsaved-changes-warning.js +20 -0
  151. package/dist/components/etic/use-unsaved-changes-warning.js.map +1 -0
  152. package/dist/components/ui/alert-dialog.js +33 -33
  153. package/dist/components/ui/alert-dialog.js.map +1 -1
  154. package/dist/components/ui/alert.d.ts +10 -0
  155. package/dist/components/ui/alert.js +47 -0
  156. package/dist/components/ui/alert.js.map +1 -0
  157. package/dist/components/ui/avatar.d.ts +5 -1
  158. package/dist/components/ui/avatar.js +20 -11
  159. package/dist/components/ui/avatar.js.map +1 -1
  160. package/dist/components/ui/badge.d.ts +8 -0
  161. package/dist/components/ui/badge.js +45 -0
  162. package/dist/components/ui/badge.js.map +1 -0
  163. package/dist/components/ui/breadcrumb.d.ts +10 -0
  164. package/dist/components/ui/breadcrumb.js +73 -0
  165. package/dist/components/ui/breadcrumb.js.map +1 -0
  166. package/dist/components/ui/button-group.d.ts +10 -0
  167. package/dist/components/ui/button-group.js +42 -0
  168. package/dist/components/ui/button-group.js.map +1 -0
  169. package/dist/components/ui/button.d.ts +16 -3
  170. package/dist/components/ui/button.js +28 -16
  171. package/dist/components/ui/button.js.map +1 -1
  172. package/dist/components/ui/calendar.d.ts +10 -0
  173. package/dist/components/ui/calendar.js +96 -0
  174. package/dist/components/ui/calendar.js.map +1 -0
  175. package/dist/components/ui/card.d.ts +11 -0
  176. package/dist/components/ui/card.js +57 -0
  177. package/dist/components/ui/card.js.map +1 -0
  178. package/dist/components/ui/checkbox.d.ts +3 -0
  179. package/dist/components/ui/checkbox.js +20 -0
  180. package/dist/components/ui/checkbox.js.map +1 -0
  181. package/dist/components/ui/collapsible.d.ts +5 -0
  182. package/dist/components/ui/collapsible.js +25 -0
  183. package/dist/components/ui/collapsible.js.map +1 -0
  184. package/dist/components/ui/combobox.d.ts +24 -0
  185. package/dist/components/ui/combobox.js +178 -0
  186. package/dist/components/ui/combobox.js.map +1 -0
  187. package/dist/components/ui/dialog.d.ts +26 -0
  188. package/dist/components/ui/dialog.js +99 -0
  189. package/dist/components/ui/dialog.js.map +1 -0
  190. package/dist/components/ui/dropdown-menu.js +36 -36
  191. package/dist/components/ui/empty.d.ts +11 -0
  192. package/dist/components/ui/empty.js +60 -0
  193. package/dist/components/ui/empty.js.map +1 -0
  194. package/dist/components/ui/field.d.ts +24 -0
  195. package/dist/components/ui/field.js +108 -0
  196. package/dist/components/ui/field.js.map +1 -0
  197. package/dist/components/ui/input-group.d.ts +18 -0
  198. package/dist/components/ui/input-group.js +79 -0
  199. package/dist/components/ui/input-group.js.map +1 -0
  200. package/dist/components/ui/item.d.ts +22 -0
  201. package/dist/components/ui/item.js +122 -0
  202. package/dist/components/ui/item.js.map +1 -0
  203. package/dist/components/ui/kbd.d.ts +3 -0
  204. package/dist/components/ui/kbd.js +20 -0
  205. package/dist/components/ui/kbd.js.map +1 -0
  206. package/dist/components/ui/label.d.ts +3 -0
  207. package/dist/components/ui/label.js +14 -0
  208. package/dist/components/ui/label.js.map +1 -0
  209. package/dist/components/ui/native-select.d.ts +8 -0
  210. package/dist/components/ui/native-select.js +39 -0
  211. package/dist/components/ui/native-select.js.map +1 -0
  212. package/dist/components/ui/pagination.d.ts +17 -0
  213. package/dist/components/ui/pagination.js +81 -0
  214. package/dist/components/ui/pagination.js.map +1 -0
  215. package/dist/components/ui/popover.d.ts +9 -0
  216. package/dist/components/ui/popover.js +56 -0
  217. package/dist/components/ui/popover.js.map +1 -0
  218. package/dist/components/ui/progress.d.ts +21 -0
  219. package/dist/components/ui/progress.js +53 -0
  220. package/dist/components/ui/progress.js.map +1 -0
  221. package/dist/components/ui/radio-group.d.ts +5 -0
  222. package/dist/components/ui/radio-group.js +27 -0
  223. package/dist/components/ui/radio-group.js.map +1 -0
  224. package/dist/components/ui/scroll-area.d.ts +4 -0
  225. package/dist/components/ui/scroll-area.js +36 -0
  226. package/dist/components/ui/scroll-area.js.map +1 -0
  227. package/dist/components/ui/select.d.ts +23 -0
  228. package/dist/components/ui/select.js +119 -0
  229. package/dist/components/ui/select.js.map +1 -0
  230. package/dist/components/ui/sidebar.d.ts +6 -1
  231. package/dist/components/ui/sidebar.js +92 -92
  232. package/dist/components/ui/sidebar.js.map +1 -1
  233. package/dist/components/ui/slider.d.ts +3 -0
  234. package/dist/components/ui/slider.js +36 -0
  235. package/dist/components/ui/slider.js.map +1 -0
  236. package/dist/components/ui/spinner.d.ts +8 -0
  237. package/dist/components/ui/spinner.js +24 -0
  238. package/dist/components/ui/spinner.js.map +1 -0
  239. package/dist/components/ui/switch.d.ts +5 -0
  240. package/dist/components/ui/switch.js +20 -0
  241. package/dist/components/ui/switch.js.map +1 -0
  242. package/dist/components/ui/table.d.ts +10 -0
  243. package/dist/components/ui/table.js +67 -0
  244. package/dist/components/ui/table.js.map +1 -0
  245. package/dist/components/ui/tabs.d.ts +10 -0
  246. package/dist/components/ui/tabs.js +46 -0
  247. package/dist/components/ui/tabs.js.map +1 -0
  248. package/dist/components/ui/textarea.d.ts +3 -0
  249. package/dist/components/ui/textarea.js +14 -0
  250. package/dist/components/ui/textarea.js.map +1 -0
  251. package/dist/components/ui/toggle-group.d.ts +11 -0
  252. package/dist/components/ui/toggle-group.js +54 -0
  253. package/dist/components/ui/toggle-group.js.map +1 -0
  254. package/dist/components/ui/toggle.d.ts +8 -0
  255. package/dist/components/ui/toggle.js +36 -0
  256. package/dist/components/ui/toggle.js.map +1 -0
  257. package/dist/components/ui/tooltip.d.ts +7 -2
  258. package/dist/components/ui/tooltip.js +27 -19
  259. package/dist/components/ui/tooltip.js.map +1 -1
  260. package/dist/hooks/use-column-prefs.d.ts +84 -0
  261. package/dist/hooks/use-column-prefs.js +71 -0
  262. package/dist/hooks/use-column-prefs.js.map +1 -0
  263. package/dist/hooks/use-debounced-value.d.ts +13 -0
  264. package/dist/hooks/use-debounced-value.js +12 -0
  265. package/dist/hooks/use-debounced-value.js.map +1 -0
  266. package/dist/hooks/use-document-title.d.ts +5 -0
  267. package/dist/hooks/use-document-title.js +13 -0
  268. package/dist/hooks/use-document-title.js.map +1 -0
  269. package/dist/hooks/use-persisted-state.d.ts +43 -0
  270. package/dist/hooks/use-persisted-state.js +40 -0
  271. package/dist/hooks/use-persisted-state.js.map +1 -0
  272. package/dist/index.d.ts +91 -1
  273. package/dist/index.js +99 -13
  274. package/dist/lib/autofill.d.ts +18 -0
  275. package/dist/lib/autofill.js +10 -0
  276. package/dist/lib/autofill.js.map +1 -0
  277. package/dist/lib/dates.d.ts +20 -0
  278. package/dist/lib/dates.js +16 -0
  279. package/dist/lib/dates.js.map +1 -0
  280. package/dist/lib/focus-rendu.d.ts +24 -0
  281. package/dist/lib/focus-rendu.js +14 -0
  282. package/dist/lib/focus-rendu.js.map +1 -0
  283. package/dist/lib/format.d.ts +54 -0
  284. package/dist/lib/format.js +80 -0
  285. package/dist/lib/format.js.map +1 -0
  286. package/dist/lib/normalize.d.ts +28 -0
  287. package/dist/lib/normalize.js +21 -0
  288. package/dist/lib/normalize.js.map +1 -0
  289. package/dist/lib/ordre-colonnes.d.ts +15 -0
  290. package/dist/lib/ordre-colonnes.js +14 -0
  291. package/dist/lib/ordre-colonnes.js.map +1 -0
  292. package/dist/lib/ton.d.ts +23 -0
  293. package/dist/lib/ton.js +51 -0
  294. package/dist/lib/ton.js.map +1 -0
  295. package/dist/styles.css +140 -58
  296. package/dist/theme.d.ts +34 -0
  297. package/dist/theme.js +45 -0
  298. package/dist/theme.js.map +1 -0
  299. package/package.json +21 -8
  300. package/src/theme-boot.js +22 -0
@@ -0,0 +1,131 @@
1
+ import { Button as e } from "../ui/button.js";
2
+ import { nombreFr as t, participe as n, uniteAccordee as r } from "../../lib/format.js";
3
+ import { InputGroup as i, InputGroupAddon as a, InputGroupButton as o, InputGroupInput as s } from "../ui/input-group.js";
4
+ import { Tooltip as c, TooltipContent as l, TooltipTrigger as u } from "../ui/tooltip.js";
5
+ import { Popover as d, PopoverContent as f, PopoverTrigger as p } from "../ui/popover.js";
6
+ import { Select as m, SelectContent as h, SelectItem as g, SelectTrigger as _, SelectValue as v } from "../ui/select.js";
7
+ import { useIsMobile as y } from "../../hooks/use-mobile.js";
8
+ import { UNITE_PAR_DEFAUT as b } from "./data-table-format.js";
9
+ import { paginationDuTableau as x } from "./data-table.js";
10
+ import { NO_AUTOFILL as S } from "../../lib/autofill.js";
11
+ import { cn as C } from "cn";
12
+ import { useMemo as w, useRef as T } from "react";
13
+ import { jsx as E, jsxs as D } from "react/jsx-runtime";
14
+ import { ListFilterIcon as O, SearchIcon as k, XIcon as A } from "lucide-react";
15
+ // src/components/etic/data-table-toolbar.tsx
16
+ function j(e) {
17
+ let { unite: i = b, feminin: a = !1, className: o } = e, { total: s, decalage: c = 0, nombre: l } = e.table ? x(e.table) : e, u = c + 1, d = c + l;
18
+ return /* @__PURE__ */ D("p", {
19
+ "data-slot": "data-table-count",
20
+ role: "status",
21
+ "aria-atomic": "true",
22
+ className: C("text-sm whitespace-nowrap text-muted-foreground", o),
23
+ children: [
24
+ /* @__PURE__ */ E("strong", {
25
+ className: "font-medium text-foreground tabular-nums",
26
+ children: t(s)
27
+ }),
28
+ " ",
29
+ r(s, i),
30
+ l > 0 ? /* @__PURE__ */ D("span", {
31
+ className: "tabular-nums",
32
+ children: [
33
+ " ",
34
+ "·",
35
+ " ",
36
+ d > u ? `${t(u)}–${t(d)}` : t(u),
37
+ " ",
38
+ n("affiché", l, a)
39
+ ]
40
+ }) : null
41
+ ]
42
+ });
43
+ }
44
+ function M({ libelle: e, valeur: t, onValeurChange: n, options: r, libelleTous: i, className: a }) {
45
+ let o = w(() => [{
46
+ value: null,
47
+ label: i
48
+ }, ...r.map((e) => ({
49
+ value: e.valeur,
50
+ label: e.libelle
51
+ }))], [i, r]);
52
+ return /* @__PURE__ */ D(m, {
53
+ items: o,
54
+ value: t,
55
+ onValueChange: n,
56
+ children: [/* @__PURE__ */ E(_, {
57
+ "aria-label": e,
58
+ className: a,
59
+ children: /* @__PURE__ */ E(v, {})
60
+ }), /* @__PURE__ */ E(h, { children: o.map((e) => /* @__PURE__ */ E(g, {
61
+ value: e.value,
62
+ children: e.label
63
+ }, e.value ?? "")) })]
64
+ });
65
+ }
66
+ function N({ recherche: t, filtres: n, filtresActifs: r, onReinitialiser: m, compteur: h, children: g, className: _ }) {
67
+ let v = y() && n != null && r !== void 0, b = T(null), x = T(null), w = () => {
68
+ b.current?.querySelector("input[type=\"search\"], [data-slot=\"popover-trigger\"], [data-slot=\"select-trigger\"]")?.focus(), m?.();
69
+ };
70
+ return /* @__PURE__ */ D("div", {
71
+ ref: b,
72
+ "data-slot": "data-table-toolbar",
73
+ className: C("flex flex-wrap items-center gap-2", _),
74
+ children: [
75
+ t ? /* @__PURE__ */ D(i, {
76
+ className: "w-full sm:w-64",
77
+ children: [
78
+ /* @__PURE__ */ E(a, { children: /* @__PURE__ */ E(k, {}) }),
79
+ /* @__PURE__ */ E(s, {
80
+ ...S,
81
+ ...t.attributs,
82
+ ref: x,
83
+ type: "search",
84
+ "aria-label": t.libelle ?? "Rechercher",
85
+ placeholder: t.placeholder ?? "Rechercher…",
86
+ value: t.valeur,
87
+ onChange: (e) => t.onValeurChange(e.target.value),
88
+ className: C("[&::-webkit-search-cancel-button]:appearance-none", t.attributs?.className)
89
+ }),
90
+ t.valeur ? /* @__PURE__ */ E(a, {
91
+ align: "inline-end",
92
+ children: /* @__PURE__ */ D(c, { children: [/* @__PURE__ */ E(u, {
93
+ render: /* @__PURE__ */ E(o, {
94
+ size: "icon-xs",
95
+ "aria-label": "Effacer la recherche",
96
+ onClick: () => {
97
+ x.current?.focus(), t.onValeurChange("");
98
+ }
99
+ }),
100
+ children: /* @__PURE__ */ E(A, {})
101
+ }), /* @__PURE__ */ E(l, { children: "Effacer la recherche" })] })
102
+ }) : null
103
+ ]
104
+ }) : null,
105
+ v ? /* @__PURE__ */ D(d, { children: [/* @__PURE__ */ D(p, {
106
+ render: /* @__PURE__ */ E(e, { variant: "outline" }),
107
+ children: [
108
+ /* @__PURE__ */ E(O, { "data-icon": "inline-start" }),
109
+ "Filtres",
110
+ r ? ` (${r})` : ""
111
+ ]
112
+ }), /* @__PURE__ */ E(f, {
113
+ align: "start",
114
+ className: "w-64 *:data-[slot=select-trigger]:w-full",
115
+ children: n
116
+ })] }) : n,
117
+ r && m ? /* @__PURE__ */ D(e, {
118
+ variant: "ghost",
119
+ onClick: w,
120
+ children: ["Réinitialiser", /* @__PURE__ */ E(A, { "data-icon": "inline-end" })]
121
+ }) : null,
122
+ h || g ? /* @__PURE__ */ D("div", {
123
+ className: "ml-auto flex flex-wrap items-center gap-x-4 gap-y-2",
124
+ children: [h ? /* @__PURE__ */ E(j, { ...h }) : null, g]
125
+ }) : null
126
+ ]
127
+ });
128
+ }
129
+ export { j as DataTableCount, M as DataTableSelectFilter, N as DataTableToolbar };
130
+
131
+ //# sourceMappingURL=data-table-toolbar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-table-toolbar.js","names":["DataTableCount","UNITE_PAR_DEFAUT","props","paginationDuTableau","debut","decalage","fin","nombre","cn","className","nombreFr","total","uniteAccordee","unite","participe","feminin","DataTableSelectFilter","items","useMemo","libelleTous","options","option","Select","valeur","onValeurChange","SelectTrigger","libelle","SelectValue","SelectContent","SelectItem","item","DataTableToolbar","replier","useIsMobile","filtres","filtresActifs","racineRef","useRef","rechercheRef","reinitialiser","onReinitialiser","recherche","InputGroup","InputGroupAddon","SearchIcon","InputGroupInput","NO_AUTOFILL","event","Tooltip","TooltipTrigger","InputGroupButton","XIcon","TooltipContent","Popover","PopoverTrigger","Button","ListFilterIcon","PopoverContent","compteur","children"],"sources":["../../../src/components/etic/data-table-toolbar.tsx"],"sourcesContent":["import { useMemo, useRef, type ComponentProps, type ReactNode } from \"react\"\nimport type { RowData } from \"@tanstack/react-table\"\nimport { cn } from \"cn\"\nimport { ListFilterIcon, SearchIcon, XIcon } from \"lucide-react\"\n\nimport { Button } from \"@etic-ui/components/ui/button\"\nimport {\n InputGroup,\n InputGroupAddon,\n InputGroupButton,\n InputGroupInput,\n} from \"@etic-ui/components/ui/input-group\"\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"@etic-ui/components/ui/tooltip\"\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@etic-ui/components/ui/popover\"\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"@etic-ui/components/ui/select\"\nimport { useIsMobile } from \"@etic-ui/hooks/use-mobile\"\nimport {\n UNITE_PAR_DEFAUT,\n nombreFr,\n participe,\n uniteAccordee,\n type DataTableUnite,\n} from \"@etic-ui/components/etic/data-table-format\"\nimport {\n paginationDuTableau,\n type DataTableInstance,\n} from \"@etic-ui/components/etic/data-table\"\nimport { NO_AUTOFILL } from \"@etic-ui/lib/autofill\"\n\ninterface DataTableCountCommun {\n /** Nom des éléments. « élément », « éléments » par défaut. */\n unite?: DataTableUnite\n /** Accorde « affichées » au féminin. */\n feminin?: boolean\n className?: string\n}\n\n/** Compteur aux nombres donnés par l'application (pagination côté serveur). */\nexport interface DataTableCountNombresProps extends DataTableCountCommun {\n table?: never\n /** Nombre total d'éléments, toutes pages comprises. */\n total: number\n /** Rang (à partir de 0) du premier élément affiché. 0 par défaut. */\n decalage?: number\n /** Nombre d'éléments affichés. */\n nombre: number\n}\n\n/** Compteur lu dans le tableau (pagination côté client de `useDataTable`) :\n * lignes filtrées, page courante. */\nexport interface DataTableCountTableProps<\n TData extends RowData = RowData,\n> extends DataTableCountCommun {\n table: DataTableInstance<TData>\n}\n\nexport type DataTableCountProps<TData extends RowData = RowData> =\n DataTableCountNombresProps | DataTableCountTableProps<TData>\n\n/**\n * Compteur d'une liste : « 128 éléments · 26–50 affichés ». C'est une zone\n * de statut : après une recherche, un filtre ou un changement de page, le\n * nouveau compte est annoncé sans déplacer le focus. Avec `table`, il lit\n * les nombres de la pagination côté client.\n */\nexport function DataTableCount<TData extends RowData>(\n props: DataTableCountProps<TData>\n) {\n const { unite = UNITE_PAR_DEFAUT, feminin = false, className } = props\n const {\n total,\n decalage = 0,\n nombre,\n } = props.table ? paginationDuTableau(props.table) : props\n const debut = decalage + 1\n const fin = decalage + nombre\n return (\n <p\n data-slot=\"data-table-count\"\n role=\"status\"\n aria-atomic=\"true\"\n className={cn(\n \"text-sm whitespace-nowrap text-muted-foreground\",\n className\n )}\n >\n <strong className=\"font-medium text-foreground tabular-nums\">\n {nombreFr(total)}\n </strong>{\" \"}\n {uniteAccordee(total, unite)}\n {nombre > 0 ? (\n <span className=\"tabular-nums\">\n {\" \"}\n ·{\" \"}\n {fin > debut\n ? `${nombreFr(debut)}–${nombreFr(fin)}`\n : nombreFr(debut)}{\" \"}\n {participe(\"affiché\", nombre, feminin)}\n </span>\n ) : null}\n </p>\n )\n}\n\nexport interface DataTableSelectFilterOption {\n valeur: string\n libelle: string\n}\n\nexport interface DataTableSelectFilterProps {\n /** Nom du filtre pour les lecteurs d'écran : « Filtrer par statut ». */\n libelle: string\n /** Valeur choisie ; `null` = pas de filtre. */\n valeur: string | null\n onValeurChange: (valeur: string | null) => void\n options: DataTableSelectFilterOption[]\n /** Entrée sans filtre : « Tous les statuts ». */\n libelleTous: string\n className?: string\n}\n\n/** Filtre d'une liste : un Select de shadcn dont la première entrée retire\n * le filtre. */\nexport function DataTableSelectFilter({\n libelle,\n valeur,\n onValeurChange,\n options,\n libelleTous,\n className,\n}: DataTableSelectFilterProps) {\n const items = useMemo(\n () => [\n { value: null, label: libelleTous },\n ...options.map((option) => ({\n value: option.valeur,\n label: option.libelle,\n })),\n ],\n [libelleTous, options]\n )\n return (\n <Select items={items} value={valeur} onValueChange={onValeurChange}>\n <SelectTrigger aria-label={libelle} className={className}>\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {items.map((item) => (\n <SelectItem key={item.value ?? \"\"} value={item.value}>\n {item.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n )\n}\n\n/** Attributs du champ de recherche que l'application peut ajouter. */\nexport type DataTableRechercheAttributs = Omit<\n ComponentProps<\"input\">,\n \"value\" | \"defaultValue\" | \"onChange\" | \"type\" | \"ref\"\n>\n\nexport interface DataTableToolbarProps<TData extends RowData = RowData> {\n /** Champ de recherche, contrôlé (l'application temporise sa requête). */\n recherche?: {\n valeur: string\n onValeurChange: (valeur: string) => void\n placeholder?: string\n /** Nom du champ. « Rechercher » par défaut. */\n libelle?: string\n /** Attributs ajoutés au champ (`name`, `data-*`…). Le champ porte déjà\n * `autoComplete=\"off\"` et les attributs qui écartent les gestionnaires\n * de mots de passe ; ils peuvent être remplacés ici. */\n attributs?: DataTableRechercheAttributs\n }\n /** Filtres : `DataTableSelectFilter`… */\n filtres?: ReactNode\n /**\n * Nombre de filtres actifs. Fourni, il replie les filtres derrière un\n * bouton « Filtres (n) » sur mobile, où ils s'empileraient sinon au-dessus\n * des résultats, et affiche « Réinitialiser » s'il y en a.\n */\n filtresActifs?: number\n /** Retire tous les filtres (bouton « Réinitialiser »). */\n onReinitialiser?: () => void\n /** Compteur « N éléments · a–b affichés » : ses nombres, ou `{ table }`\n * pour une pagination côté client. */\n compteur?: DataTableCountProps<TData>\n /** À droite : `DataTableViewOptions`, bouton d'ajout… */\n children?: ReactNode\n className?: string\n}\n\n/**\n * Barre d'outils au-dessus d'un tableau, sur le modèle de celle de shadcn :\n * recherche et filtres à gauche, compteur et commandes (colonnes…) à droite.\n */\nexport function DataTableToolbar<TData extends RowData = RowData>({\n recherche,\n filtres,\n filtresActifs,\n onReinitialiser,\n compteur,\n children,\n className,\n}: DataTableToolbarProps<TData>) {\n const mobile = useIsMobile()\n const replier = mobile && filtres != null && filtresActifs !== undefined\n const racineRef = useRef<HTMLDivElement>(null)\n const rechercheRef = useRef<HTMLInputElement>(null)\n\n // « Réinitialiser » disparaît avec les filtres : le focus passe d'abord au\n // champ de recherche, sinon au premier filtre (ou au bouton « Filtres »),\n // au lieu de tomber sur <body>.\n const reinitialiser = () => {\n racineRef.current\n ?.querySelector<HTMLElement>(\n 'input[type=\"search\"], [data-slot=\"popover-trigger\"], [data-slot=\"select-trigger\"]'\n )\n ?.focus()\n onReinitialiser?.()\n }\n\n return (\n <div\n ref={racineRef}\n data-slot=\"data-table-toolbar\"\n className={cn(\"flex flex-wrap items-center gap-2\", className)}\n >\n {recherche ? (\n <InputGroup className=\"w-full sm:w-64\">\n <InputGroupAddon>\n <SearchIcon />\n </InputGroupAddon>\n <InputGroupInput\n // Une recherche n'est jamais un identifiant : sans ces attributs,\n // les gestionnaires de mots de passe y proposent une adresse.\n {...NO_AUTOFILL}\n {...recherche.attributs}\n ref={rechercheRef}\n type=\"search\"\n aria-label={recherche.libelle ?? \"Rechercher\"}\n placeholder={recherche.placeholder ?? \"Rechercher…\"}\n value={recherche.valeur}\n onChange={(event) => recherche.onValeurChange(event.target.value)}\n // La croix native de Chrome (bleue, 14 px, absente de Firefox)\n // cède la place au bouton ci-dessous.\n className={cn(\n \"[&::-webkit-search-cancel-button]:appearance-none\",\n recherche.attributs?.className\n )}\n />\n {recherche.valeur ? (\n <InputGroupAddon align=\"inline-end\">\n <Tooltip>\n <TooltipTrigger\n render={\n <InputGroupButton\n size=\"icon-xs\"\n aria-label=\"Effacer la recherche\"\n onClick={() => {\n // Le bouton disparaît : le focus revient au champ.\n rechercheRef.current?.focus()\n recherche.onValeurChange(\"\")\n }}\n />\n }\n >\n <XIcon />\n </TooltipTrigger>\n <TooltipContent>Effacer la recherche</TooltipContent>\n </Tooltip>\n </InputGroupAddon>\n ) : null}\n </InputGroup>\n ) : null}\n {replier ? (\n <Popover>\n <PopoverTrigger render={<Button variant=\"outline\" />}>\n <ListFilterIcon data-icon=\"inline-start\" />\n Filtres{filtresActifs ? ` (${filtresActifs})` : \"\"}\n </PopoverTrigger>\n <PopoverContent\n align=\"start\"\n className=\"w-64 *:data-[slot=select-trigger]:w-full\"\n >\n {filtres}\n </PopoverContent>\n </Popover>\n ) : (\n filtres\n )}\n {filtresActifs && onReinitialiser ? (\n <Button variant=\"ghost\" onClick={reinitialiser}>\n Réinitialiser\n <XIcon data-icon=\"inline-end\" />\n </Button>\n ) : null}\n {compteur || children ? (\n <div className=\"ml-auto flex flex-wrap items-center gap-x-4 gap-y-2\">\n {compteur ? <DataTableCount {...compteur} /> : null}\n {children}\n </div>\n ) : null}\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;AA+EA,SAAgBA,EACd,GACA;CACA,IAAM,EAAE,WAAQC,GAAkB,aAAU,IAAO,iBAAcC,GAC3D,EACJ,UACA,cAAW,GACX,cACEA,EAAM,QAAQC,EAAoBD,EAAM,KAAK,IAAIA,GAC/CE,IAAQC,IAAW,GACnBC,IAAMD,IAAWE;CACvB,OACE,kBAAC,KAAD;EACE,aAAU;EACV,MAAK;EACL,eAAY;EACZ,WAAWC,EACT,mDACAC,CACF;EAPF,UAAA;GASE,kBAAC,UAAD;IAAQ,WAAU;IACf,UAAAC,EAASC,CAAK;GACT,CAAA;GAAE;GACTC,EAAcD,GAAOE,CAAK;GAC1BN,IAAS,IACR,kBAAC,QAAD;IAAM,WAAU;IAAhB,UAAA;KACG;KAAI;KACH;KACDD,IAAMF,IACH,GAAGM,EAASN,CAAK,EAAE,GAAGM,EAASJ,CAAG,MAClCI,EAASN,CAAK;KAAG;KACpBU,EAAU,WAAWP,GAAQQ,CAAO;IACjC;GACJ,CAAA,IAAA;EACH;;AAEP;AAqBA,SAAgBC,EAAsB,EACpC,YACA,WACA,mBACA,YACA,gBACA,gBAC6B;CAC7B,IAAMC,IAAQC,QACN,CACJ;EAAE,OAAO;EAAM,OAAOC;CAAY,GAClC,GAAGC,EAAQ,KAAK,OAAY;EAC1B,OAAOC,EAAO;EACd,OAAOA,EAAO;CAChB,EAAE,CACJ,GACA,CAACF,GAAaC,CAAO,CACvB;CACA,OACE,kBAACE,GAAD;EAAe;EAAO,OAAOC;EAAQ,eAAeC;EAApD,UAAA,CACE,kBAACC,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,CAAA;MACM,CAAA,GAChB,kBAACC,GAAD,EAAA,UAAgB,uBAAoC,CAAA,CAC7C,EAAA,CAAA;KACM,CAAA,IACf;IACM;GACV,CAAA,IAAA;GACHpB,IACC,kBAACqB,GAAD,EAAA,UAAA,CACE,kBAACC,GAAD;IAAgB,QAAQ,kBAACC,GAAD,EAAQ,SAAQ,UAAW,CAAA;IAAnD,UAAA;KACE,kBAACC,GAAD,EAAgB,aAAU,eAAgB,CAAA;KAAC;KACnCrB,IAAgB,KAAKA,EAAc,KAAK;IAClC;GAChB,CAAA,GAAA,kBAACsB,GAAD;IACE,OAAM;IACN,WAAU;IAET,UAAAvB;GACa,CAAA,CACT,EAAA,CAAA,IAETA;GAEDC,KAAiBK,IAChB,kBAACe,GAAD;IAAQ,SAAQ;IAAQ,SAAShB;IAAjC,UAAA,CAAgD,iBAE9C,kBAACY,GAAD,EAAO,aAAU,aAAc,CAAA,CACzB;GACN,CAAA,IAAA;GACHO,KAAYC,IACX,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACGD,IAAW,kBAAC1D,GAAD,EAAgB,GAAI0D,EAAW,CAAA,IAAI,MAC9CC,CACE;GACH,CAAA,IAAA;EACD;;AAET"}
@@ -0,0 +1,56 @@
1
+ import { ColumnOrderState, ColumnVisibilityState, OnChangeFn, RowData } from '@tanstack/react-table';
2
+ import { DataTableInstance } from './data-table';
3
+ /** Une colonne du sélecteur sans `useDataTable` (tableau rendu à la main). */
4
+ export interface DataTableViewOptionsColonne {
5
+ id: string;
6
+ /** Nom affiché dans le panneau. */
7
+ libelle: string;
8
+ /** `false` : toujours affichée, absente du panneau, à sa place (comme
9
+ * `enableHiding: false`). Vrai par défaut. */
10
+ masquable?: boolean;
11
+ }
12
+ interface DataTableViewOptionsCommun {
13
+ /** Texte du bouton. « Colonnes » par défaut. */
14
+ libelle?: string;
15
+ className?: string;
16
+ }
17
+ /** Sélecteur branché sur l'instance d'un `DataTable`. */
18
+ export interface DataTableViewOptionsTableProps<TData extends RowData> extends DataTableViewOptionsCommun {
19
+ table: DataTableInstance<TData>;
20
+ }
21
+ /**
22
+ * Sélecteur d'un tableau rendu à la main (primitives `Table`), sans
23
+ * instance `useDataTable` : les colonnes, leur visibilité et leur ordre
24
+ * viennent de l'application. Les noms sont ceux des options de
25
+ * `useDataTable` : `{...prefs.optionsTableau}` de `useColumnPrefs` s'y
26
+ * étale tel quel.
27
+ */
28
+ export interface DataTableViewOptionsColonnesProps extends DataTableViewOptionsCommun {
29
+ table?: never;
30
+ colonnes: readonly DataTableViewOptionsColonne[];
31
+ /** `{ [id]: false }` pour une colonne masquée ; absente = affichée. */
32
+ visibiliteColonnes: ColumnVisibilityState;
33
+ onVisibiliteColonnesChange: OnChangeFn<ColumnVisibilityState>;
34
+ /** Identifiants dans l'ordre d'affichage (les inconnus sont ignorés) ;
35
+ * l'ordre de `colonnes` sinon. */
36
+ ordreColonnes?: ColumnOrderState;
37
+ /** Ordre complet après un déplacement. Sans lui, les colonnes ne se
38
+ * réordonnent pas (pas de poignée). */
39
+ onOrdreColonnesChange?: OnChangeFn<ColumnOrderState>;
40
+ /** Colonnes que le panneau peut masquer et déplacer ; les autres restent
41
+ * fixes, à leur place. Toutes par défaut. Donné par `useColumnPrefs`. */
42
+ colonnesReglables?: readonly string[];
43
+ }
44
+ export type DataTableViewOptionsProps<TData extends RowData = RowData> = DataTableViewOptionsTableProps<TData> | DataTableViewOptionsColonnesProps;
45
+ /**
46
+ * Sélecteur de colonnes : le bouton « Colonnes » de shadcn, dont le panneau
47
+ * coche les colonnes affichées et les réordonne par glisser-déposer (dnd-kit),
48
+ * à la souris, au toucher ou au clavier (poignée : Espace, flèches, Espace).
49
+ * Les colonnes qui ne se masquent pas (`enableHiding: false`) n'y figurent
50
+ * pas et gardent leur place. Le panneau reste ouvert pendant les réglages.
51
+ *
52
+ * Avec `table`, il règle un `DataTable` ; avec `colonnes`, `visibilite` et
53
+ * `ordre`, un tableau rendu à la main, sans instance `useDataTable`.
54
+ */
55
+ export declare function DataTableViewOptions<TData extends RowData>(props: DataTableViewOptionsProps<TData>): import("react").JSX.Element;
56
+ export {};
@@ -0,0 +1,198 @@
1
+ import { Button as e, buttonVariants as t } from "../ui/button.js";
2
+ import { Checkbox as n } from "../ui/checkbox.js";
3
+ import { Popover as r, PopoverContent as i, PopoverDescription as a, PopoverHeader as o, PopoverTitle as s, PopoverTrigger as c } from "../ui/popover.js";
4
+ import { CASE_VERROUILLEE as l, libelleColonne as u, metaDe as d } from "./data-table.js";
5
+ import { ordonner as f, replacer as p } from "../../lib/ordre-colonnes.js";
6
+ import { cn as m } from "cn";
7
+ import { useId as h, useRef as g, useState as _ } from "react";
8
+ import { jsx as v, jsxs as y } from "react/jsx-runtime";
9
+ import { Columns3Icon as b, GripVerticalIcon as x } from "lucide-react";
10
+ import { DndContext as S, KeyboardSensor as C, PointerSensor as w, closestCenter as T, useSensor as E, useSensors as D } from "@dnd-kit/core";
11
+ import { SortableContext as O, arrayMove as k, sortableKeyboardCoordinates as A, useSortable as j, verticalListSortingStrategy as M } from "@dnd-kit/sortable";
12
+ import { CSS as N } from "@dnd-kit/utilities";
13
+ // src/components/etic/data-table-view-options.tsx
14
+ var P = /* @__PURE__ */ new Set([
15
+ "select",
16
+ "expand",
17
+ "actions"
18
+ ]), F = ({ transform: e }) => ({
19
+ ...e,
20
+ x: 0
21
+ }), I = { draggable: "Pour déplacer une colonne, appuyez sur Espace ou Entrée, déplacez-la avec les flèches haut et bas, puis appuyez de nouveau sur Espace ou Entrée pour la déposer, ou sur Échap pour annuler." };
22
+ function L(e) {
23
+ if (!e) return () => !0;
24
+ let t = new Set(e);
25
+ return (e) => t.has(e);
26
+ }
27
+ function R(e) {
28
+ let t = L(d(e).colonnesReglables);
29
+ return {
30
+ toutes: e.getAllLeafColumns().map((e) => ({
31
+ id: e.id,
32
+ libelle: u(e),
33
+ masquable: e.getCanHide() && t(e.id),
34
+ visible: e.getIsVisible(),
35
+ donnees: !P.has(e.id) && (!!e.accessorFn || e.getCanHide())
36
+ })),
37
+ changerVisibilite: (t, n) => e.getColumn(t)?.toggleVisibility(n),
38
+ changerOrdre: (t) => e.setColumnOrder(t)
39
+ };
40
+ }
41
+ function z({ colonnes: e, visibiliteColonnes: t, onVisibiliteColonnesChange: n, ordreColonnes: r, onOrdreColonnesChange: i, colonnesReglables: a }) {
42
+ let o = new Map(e.map((e) => [e.id, e])), s = f(r, e.map((e) => e.id)), c = L(a);
43
+ return {
44
+ toutes: s.map((e) => {
45
+ let n = o.get(e), r = (n.masquable ?? !0) && c(e);
46
+ return {
47
+ id: e,
48
+ libelle: n.libelle,
49
+ masquable: r,
50
+ visible: !r || t[e] !== !1,
51
+ donnees: !P.has(e)
52
+ };
53
+ }),
54
+ changerVisibilite: (e, r) => n({
55
+ ...t,
56
+ [e]: r
57
+ }),
58
+ changerOrdre: i
59
+ };
60
+ }
61
+ function B(t) {
62
+ let { libelle: n = "Colonnes", className: l } = t, u = t.table ? R(t.table) : z(t), [d, f] = _(!1), x = g(!1), j = g(null), N = D(E(w, { activationConstraint: { distance: 4 } }), E(C, { coordinateGetter: A })), { toutes: P, changerVisibilite: L, changerOrdre: B } = u, U = P.filter((e) => e.masquable), W = U.map((e) => e.id), G = P.filter((e) => e.visible && e.donnees), K = G.length === 1 && G[0].masquable ? G[0].id : void 0, q = h(), J = (e) => U.find((t) => t.id === e)?.libelle ?? String(e), Y = (e) => `${W.indexOf(String(e)) + 1} sur ${W.length}`, X = {
63
+ onDragStart: ({ active: e }) => `Colonne ${J(e.id)} saisie, position ${Y(e.id)}.`,
64
+ onDragOver: ({ active: e, over: t }) => t ? `Colonne ${J(e.id)} déplacée en position ${Y(t.id)}.` : void 0,
65
+ onDragEnd: ({ active: e, over: t }) => t ? `Colonne ${J(e.id)} déposée en position ${Y(t.id)}.` : `Colonne ${J(e.id)} déposée.`,
66
+ onDragCancel: ({ active: e }) => `Déplacement annulé : la colonne ${J(e.id)} reprend sa place.`
67
+ };
68
+ function Z() {
69
+ setTimeout(() => {
70
+ x.current = !1;
71
+ });
72
+ }
73
+ function Q({ active: e, over: t }) {
74
+ if (Z(), !B || !t || e.id === t.id) return;
75
+ let n = k(W, W.indexOf(String(e.id)), W.indexOf(String(t.id))), r = new Set(W);
76
+ B(p(P.map((e) => e.id), (e) => r.has(e), n));
77
+ }
78
+ let $ = U.map((e) => /* @__PURE__ */ v(H, {
79
+ id: e.id,
80
+ libelle: e.libelle,
81
+ visible: e.visible,
82
+ deplacable: B !== void 0,
83
+ onVisibleChange: (t) => L(e.id, t),
84
+ verrou: e.id === K ? q : void 0
85
+ }, e.id));
86
+ return /* @__PURE__ */ y(r, {
87
+ open: d,
88
+ onOpenChange: (e, t) => {
89
+ !e && x.current ? t.allowPropagation() : f(e);
90
+ },
91
+ children: [/* @__PURE__ */ y(c, {
92
+ render: /* @__PURE__ */ v(e, {
93
+ variant: "outline",
94
+ className: m("h-8", l)
95
+ }),
96
+ children: [/* @__PURE__ */ v(b, { "data-icon": "inline-start" }), n]
97
+ }), /* @__PURE__ */ y(i, {
98
+ align: "end",
99
+ className: "w-64 gap-1 p-1",
100
+ initialFocus: () => j.current?.querySelector("[role=\"checkbox\"]") ?? !0,
101
+ children: [
102
+ /* @__PURE__ */ y(o, {
103
+ className: "px-2 pt-1.5 pb-1",
104
+ children: [/* @__PURE__ */ v(s, {
105
+ className: "text-sm font-medium",
106
+ children: "Colonnes affichées"
107
+ }), /* @__PURE__ */ v(a, {
108
+ className: "text-xs",
109
+ children: B ? "Cochez pour afficher, glissez pour réordonner." : "Cochez pour afficher."
110
+ })]
111
+ }),
112
+ B ? /* @__PURE__ */ v(S, {
113
+ sensors: N,
114
+ collisionDetection: T,
115
+ modifiers: [F],
116
+ accessibility: {
117
+ announcements: X,
118
+ screenReaderInstructions: I
119
+ },
120
+ onDragStart: () => {
121
+ x.current = !0;
122
+ },
123
+ onDragEnd: Q,
124
+ onDragCancel: Z,
125
+ children: /* @__PURE__ */ v(O, {
126
+ items: W,
127
+ strategy: M,
128
+ children: /* @__PURE__ */ v("ul", {
129
+ ref: j,
130
+ className: V,
131
+ children: $
132
+ })
133
+ })
134
+ }) : /* @__PURE__ */ v("ul", {
135
+ ref: j,
136
+ className: V,
137
+ children: $
138
+ }),
139
+ K ? /* @__PURE__ */ v("p", {
140
+ id: q,
141
+ className: "px-2 pb-1 text-xs text-muted-foreground",
142
+ children: "Au moins une colonne reste affichée."
143
+ }) : null
144
+ ]
145
+ })]
146
+ });
147
+ }
148
+ var V = "flex max-h-80 flex-col overflow-y-auto";
149
+ function H({ deplacable: e, ...t }) {
150
+ return e ? /* @__PURE__ */ v(W, { ...t }) : /* @__PURE__ */ v("li", {
151
+ className: m(U, "pl-2"),
152
+ children: /* @__PURE__ */ v(G, { ...t })
153
+ });
154
+ }
155
+ var U = "flex items-center gap-1 rounded-md bg-popover pr-2 hover:bg-muted data-dragging:relative data-dragging:z-10 data-dragging:shadow-md";
156
+ function W(e) {
157
+ let { attributes: n, listeners: r, setNodeRef: i, setActivatorNodeRef: a, transform: o, transition: s, isDragging: c } = j({
158
+ id: e.id,
159
+ attributes: { roleDescription: "colonne déplaçable" }
160
+ });
161
+ return /* @__PURE__ */ y("li", {
162
+ ref: i,
163
+ style: {
164
+ transform: N.Translate.toString(o),
165
+ transition: s
166
+ },
167
+ "data-dragging": c || void 0,
168
+ className: U,
169
+ children: [/* @__PURE__ */ v("button", {
170
+ type: "button",
171
+ ref: a,
172
+ className: m(t({
173
+ variant: "ghost",
174
+ size: "icon-xs"
175
+ }), "cursor-grab touch-none text-muted-foreground active:cursor-grabbing"),
176
+ "aria-label": `Déplacer la colonne ${e.libelle}`,
177
+ ...n,
178
+ ...r,
179
+ children: /* @__PURE__ */ v(x, {})
180
+ }), /* @__PURE__ */ v(G, { ...e })]
181
+ });
182
+ }
183
+ function G({ libelle: e, visible: t, onVisibleChange: r, verrou: i }) {
184
+ return /* @__PURE__ */ y("label", {
185
+ className: "flex flex-1 cursor-pointer items-center gap-2 py-1.5 text-sm has-aria-disabled:cursor-not-allowed",
186
+ children: [/* @__PURE__ */ v(n, {
187
+ checked: t,
188
+ onCheckedChange: r,
189
+ readOnly: i !== void 0,
190
+ "aria-disabled": i !== void 0 || void 0,
191
+ "aria-describedby": i,
192
+ className: l
193
+ }), e]
194
+ });
195
+ }
196
+ export { B as DataTableViewOptions };
197
+
198
+ //# sourceMappingURL=data-table-view-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-table-view-options.js","names":["COLONNES_DE_STRUCTURE","verticalSeulement","transform","INSTRUCTIONS","estReglable","colonnesReglables","reglables","id","modeleDuTableau","reglable","metaDe","table","colonne","libelleColonne","visible","ordre","modeleDesColonnes","parId","colonnes","ids","ordonner","ordreColonnes","masquable","visibiliteColonnes","onVisibiliteColonnesChange","onOrdreColonnesChange","DataTableViewOptions","props","modele","ouvert","setOuvert","useState","glisseRef","useRef","listeRef","capteurs","useSensors","useSensor","PointerSensor","KeyboardSensor","sortableKeyboardCoordinates","toutes","donneesVisibles","derniere","idVerrou","useId","nom","c","position","annonces","active","over","finirGlisser","deposer","changerOrdre","nouvelOrdre","arrayMove","deplacables","replacer","elements","ElementColonne","changerVisibilite","Popover","suivant","details","PopoverTrigger","Button","cn","className","Columns3Icon","libelle","PopoverContent","PopoverHeader","PopoverTitle","PopoverDescription","DndContext","closestCenter","SortableContext","verticalListSortingStrategy","LISTE","deplacable","ElementDeplacable","ELEMENT","CaseColonne","useSortable","setNodeRef","CSS","isDragging","setActivatorNodeRef","buttonVariants","attributes","listeners","GripVerticalIcon","Checkbox","onVisibleChange","verrou","CASE_VERROUILLEE"],"sources":["../../../src/components/etic/data-table-view-options.tsx"],"sourcesContent":["import { useId, useRef, useState } from \"react\"\nimport {\n DndContext,\n KeyboardSensor,\n PointerSensor,\n closestCenter,\n useSensor,\n useSensors,\n type Announcements,\n type DragEndEvent,\n type Modifier,\n type UniqueIdentifier,\n} from \"@dnd-kit/core\"\nimport {\n SortableContext,\n arrayMove,\n sortableKeyboardCoordinates,\n useSortable,\n verticalListSortingStrategy,\n} from \"@dnd-kit/sortable\"\nimport { CSS } from \"@dnd-kit/utilities\"\nimport type {\n ColumnOrderState,\n ColumnVisibilityState,\n OnChangeFn,\n RowData,\n} from \"@tanstack/react-table\"\nimport { cn } from \"cn\"\nimport { Columns3Icon, GripVerticalIcon } from \"lucide-react\"\n\nimport { Button, buttonVariants } from \"@etic-ui/components/ui/button\"\nimport { Checkbox } from \"@etic-ui/components/ui/checkbox\"\nimport {\n Popover,\n PopoverContent,\n PopoverDescription,\n PopoverHeader,\n PopoverTitle,\n PopoverTrigger,\n} from \"@etic-ui/components/ui/popover\"\nimport {\n CASE_VERROUILLEE,\n libelleColonne,\n metaDe,\n type DataTableInstance,\n} from \"@etic-ui/components/etic/data-table\"\nimport { ordonner, replacer } from \"@etic-ui/lib/ordre-colonnes\"\n\n/** Colonnes qui ne portent pas de données : cases de sélection\n * (`dataTableSelectionColumn`), dépliage (`dataTableExpandColumn`) et menu\n * des actions de ligne (`id: \"actions\"`, comme dans shadcn). */\nconst COLONNES_DE_STRUCTURE = new Set([\"select\", \"expand\", \"actions\"])\n\nconst verticalSeulement: Modifier = ({ transform }) => ({ ...transform, x: 0 })\n\nconst INSTRUCTIONS = {\n draggable:\n \"Pour déplacer une colonne, appuyez sur Espace ou Entrée, déplacez-la avec les flèches haut et bas, puis appuyez de nouveau sur Espace ou Entrée pour la déposer, ou sur Échap pour annuler.\",\n}\n\n/** Une colonne du sélecteur sans `useDataTable` (tableau rendu à la main). */\nexport interface DataTableViewOptionsColonne {\n id: string\n /** Nom affiché dans le panneau. */\n libelle: string\n /** `false` : toujours affichée, absente du panneau, à sa place (comme\n * `enableHiding: false`). Vrai par défaut. */\n masquable?: boolean\n}\n\ninterface DataTableViewOptionsCommun {\n /** Texte du bouton. « Colonnes » par défaut. */\n libelle?: string\n className?: string\n}\n\n/** Sélecteur branché sur l'instance d'un `DataTable`. */\nexport interface DataTableViewOptionsTableProps<\n TData extends RowData,\n> extends DataTableViewOptionsCommun {\n table: DataTableInstance<TData>\n}\n\n/**\n * Sélecteur d'un tableau rendu à la main (primitives `Table`), sans\n * instance `useDataTable` : les colonnes, leur visibilité et leur ordre\n * viennent de l'application. Les noms sont ceux des options de\n * `useDataTable` : `{...prefs.optionsTableau}` de `useColumnPrefs` s'y\n * étale tel quel.\n */\nexport interface DataTableViewOptionsColonnesProps extends DataTableViewOptionsCommun {\n table?: never\n colonnes: readonly DataTableViewOptionsColonne[]\n /** `{ [id]: false }` pour une colonne masquée ; absente = affichée. */\n visibiliteColonnes: ColumnVisibilityState\n onVisibiliteColonnesChange: OnChangeFn<ColumnVisibilityState>\n /** Identifiants dans l'ordre d'affichage (les inconnus sont ignorés) ;\n * l'ordre de `colonnes` sinon. */\n ordreColonnes?: ColumnOrderState\n /** Ordre complet après un déplacement. Sans lui, les colonnes ne se\n * réordonnent pas (pas de poignée). */\n onOrdreColonnesChange?: OnChangeFn<ColumnOrderState>\n /** Colonnes que le panneau peut masquer et déplacer ; les autres restent\n * fixes, à leur place. Toutes par défaut. Donné par `useColumnPrefs`. */\n colonnesReglables?: readonly string[]\n}\n\nexport type DataTableViewOptionsProps<TData extends RowData = RowData> =\n DataTableViewOptionsTableProps<TData> | DataTableViewOptionsColonnesProps\n\n/** Ce que le panneau sait d'une colonne, quelle que soit sa source. */\ninterface ColonneVue {\n id: string\n libelle: string\n masquable: boolean\n visible: boolean\n /** Porte des données (ni case, ni chevron, ni actions) : compte pour « la\n * dernière colonne affichée ». */\n donnees: boolean\n}\n\ninterface ModeleVue {\n /** Toutes les colonnes, dans l'ordre d'affichage. */\n toutes: ColonneVue[]\n changerVisibilite: (id: string, visible: boolean) => void\n /** Ordre complet de toutes les colonnes ; absent : pas de déplacement. */\n changerOrdre?: (ordre: string[]) => void\n}\n\n/** Une colonne que le panneau peut masquer et déplacer : toutes sans liste\n * `colonnesReglables`, sinon celles qu'elle cite. */\nfunction estReglable(\n colonnesReglables: readonly string[] | undefined\n): (id: string) => boolean {\n if (!colonnesReglables) return () => true\n const reglables = new Set(colonnesReglables)\n return (id) => reglables.has(id)\n}\n\nfunction modeleDuTableau<TData extends RowData>(\n table: DataTableInstance<TData>\n): ModeleVue {\n const reglable = estReglable(metaDe(table).colonnesReglables)\n return {\n toutes: table.getAllLeafColumns().map((colonne) => ({\n id: colonne.id,\n libelle: libelleColonne(colonne),\n masquable: colonne.getCanHide() && reglable(colonne.id),\n visible: colonne.getIsVisible(),\n // Colonne de données : à accesseur, ou de rendu (`display`) masquable ;\n // jamais la sélection, le dépliage ni les actions de ligne.\n donnees:\n !COLONNES_DE_STRUCTURE.has(colonne.id) &&\n (!!colonne.accessorFn || colonne.getCanHide()),\n })),\n changerVisibilite: (id, visible) =>\n table.getColumn(id)?.toggleVisibility(visible),\n changerOrdre: (ordre) => table.setColumnOrder(ordre),\n }\n}\n\nfunction modeleDesColonnes({\n colonnes,\n visibiliteColonnes,\n onVisibiliteColonnesChange,\n ordreColonnes,\n onOrdreColonnesChange,\n colonnesReglables,\n}: DataTableViewOptionsColonnesProps): ModeleVue {\n const parId = new Map(colonnes.map((colonne) => [colonne.id, colonne]))\n const ids = ordonner(\n ordreColonnes,\n colonnes.map((colonne) => colonne.id)\n )\n const reglable = estReglable(colonnesReglables)\n return {\n toutes: ids.map((id) => {\n const colonne = parId.get(id)!\n const masquable = (colonne.masquable ?? true) && reglable(id)\n return {\n id,\n libelle: colonne.libelle,\n masquable,\n visible: !masquable || visibiliteColonnes[id] !== false,\n donnees: !COLONNES_DE_STRUCTURE.has(id),\n }\n }),\n changerVisibilite: (id, visible) =>\n onVisibiliteColonnesChange({ ...visibiliteColonnes, [id]: visible }),\n changerOrdre: onOrdreColonnesChange,\n }\n}\n\n/**\n * Sélecteur de colonnes : le bouton « Colonnes » de shadcn, dont le panneau\n * coche les colonnes affichées et les réordonne par glisser-déposer (dnd-kit),\n * à la souris, au toucher ou au clavier (poignée : Espace, flèches, Espace).\n * Les colonnes qui ne se masquent pas (`enableHiding: false`) n'y figurent\n * pas et gardent leur place. Le panneau reste ouvert pendant les réglages.\n *\n * Avec `table`, il règle un `DataTable` ; avec `colonnes`, `visibilite` et\n * `ordre`, un tableau rendu à la main, sans instance `useDataTable`.\n */\nexport function DataTableViewOptions<TData extends RowData>(\n props: DataTableViewOptionsProps<TData>\n) {\n const { libelle = \"Colonnes\", className } = props\n const modele = props.table\n ? modeleDuTableau(props.table)\n : modeleDesColonnes(props)\n const [ouvert, setOuvert] = useState(false)\n // Échap annule un glisser au clavier : il ne doit pas aussi fermer le panneau.\n const glisseRef = useRef(false)\n const listeRef = useRef<HTMLUListElement>(null)\n const capteurs = useSensors(\n useSensor(PointerSensor, { activationConstraint: { distance: 4 } }),\n useSensor(KeyboardSensor, {\n coordinateGetter: sortableKeyboardCoordinates,\n })\n )\n\n const { toutes, changerVisibilite, changerOrdre } = modele\n const colonnes = toutes.filter((colonne) => colonne.masquable)\n const ids = colonnes.map((colonne) => colonne.id)\n // La dernière colonne de données affichée ne se masque pas : il ne\n // resterait que les cases et les menus, un tableau vide en apparence.\n const donneesVisibles = toutes.filter(\n (colonne) => colonne.visible && colonne.donnees\n )\n const derniere =\n donneesVisibles.length === 1 && donneesVisibles[0].masquable\n ? donneesVisibles[0].id\n : undefined\n const idVerrou = useId()\n const nom = (id: UniqueIdentifier) =>\n colonnes.find((c) => c.id === id)?.libelle ?? String(id)\n const position = (id: UniqueIdentifier) =>\n `${ids.indexOf(String(id)) + 1} sur ${ids.length}`\n\n const annonces: Announcements = {\n onDragStart: ({ active }) =>\n `Colonne ${nom(active.id)} saisie, position ${position(active.id)}.`,\n onDragOver: ({ active, over }) =>\n over\n ? `Colonne ${nom(active.id)} déplacée en position ${position(over.id)}.`\n : undefined,\n onDragEnd: ({ active, over }) =>\n over\n ? `Colonne ${nom(active.id)} déposée en position ${position(over.id)}.`\n : `Colonne ${nom(active.id)} déposée.`,\n onDragCancel: ({ active }) =>\n `Déplacement annulé : la colonne ${nom(active.id)} reprend sa place.`,\n }\n\n function finirGlisser() {\n // Laisse passer l'Échap en cours avant de rendre la main au panneau.\n setTimeout(() => {\n glisseRef.current = false\n })\n }\n\n function deposer({ active, over }: DragEndEvent) {\n finirGlisser()\n if (!changerOrdre || !over || active.id === over.id) return\n const nouvelOrdre = arrayMove(\n ids,\n ids.indexOf(String(active.id)),\n ids.indexOf(String(over.id))\n )\n // Les colonnes fixes (sélection, actions…) gardent leur place.\n const deplacables = new Set(ids)\n changerOrdre(\n replacer(\n toutes.map((colonne) => colonne.id),\n (id) => deplacables.has(id),\n nouvelOrdre\n )\n )\n }\n\n const elements = colonnes.map((colonne) => (\n <ElementColonne\n key={colonne.id}\n id={colonne.id}\n libelle={colonne.libelle}\n visible={colonne.visible}\n deplacable={changerOrdre !== undefined}\n onVisibleChange={(visible) => changerVisibilite(colonne.id, visible)}\n verrou={colonne.id === derniere ? idVerrou : undefined}\n />\n ))\n\n return (\n <Popover\n open={ouvert}\n onOpenChange={(suivant, details) => {\n if (!suivant && glisseRef.current) {\n // Échap revient à dnd-kit (qui l'écoute sur window) pour annuler\n // le glisser ; le panneau reste ouvert.\n details.allowPropagation()\n return\n }\n setOuvert(suivant)\n }}\n >\n <PopoverTrigger\n render={<Button variant=\"outline\" className={cn(\"h-8\", className)} />}\n >\n <Columns3Icon data-icon=\"inline-start\" />\n {libelle}\n </PopoverTrigger>\n <PopoverContent\n align=\"end\"\n className=\"w-64 gap-1 p-1\"\n // La première case plutôt que la première poignée : cocher est le\n // geste courant, et une poignée n'est utile qu'au glisser.\n initialFocus={() =>\n listeRef.current?.querySelector<HTMLElement>('[role=\"checkbox\"]') ??\n true\n }\n >\n <PopoverHeader className=\"px-2 pt-1.5 pb-1\">\n <PopoverTitle className=\"text-sm font-medium\">\n Colonnes affichées\n </PopoverTitle>\n <PopoverDescription className=\"text-xs\">\n {changerOrdre\n ? \"Cochez pour afficher, glissez pour réordonner.\"\n : \"Cochez pour afficher.\"}\n </PopoverDescription>\n </PopoverHeader>\n {changerOrdre ? (\n <DndContext\n sensors={capteurs}\n collisionDetection={closestCenter}\n modifiers={[verticalSeulement]}\n accessibility={{\n announcements: annonces,\n screenReaderInstructions: INSTRUCTIONS,\n }}\n onDragStart={() => {\n glisseRef.current = true\n }}\n onDragEnd={deposer}\n onDragCancel={finirGlisser}\n >\n <SortableContext items={ids} strategy={verticalListSortingStrategy}>\n <ul ref={listeRef} className={LISTE}>\n {elements}\n </ul>\n </SortableContext>\n </DndContext>\n ) : (\n <ul ref={listeRef} className={LISTE}>\n {elements}\n </ul>\n )}\n {derniere ? (\n <p id={idVerrou} className=\"px-2 pb-1 text-xs text-muted-foreground\">\n Au moins une colonne reste affichée.\n </p>\n ) : null}\n </PopoverContent>\n </Popover>\n )\n}\n\nconst LISTE = \"flex max-h-80 flex-col overflow-y-auto\"\n\nfunction ElementColonne({\n deplacable,\n ...props\n}: ElementColonneProps & { deplacable: boolean }) {\n return deplacable ? (\n <ElementDeplacable {...props} />\n ) : (\n // Sans poignée, la case prend sa place à gauche.\n <li className={cn(ELEMENT, \"pl-2\")}>\n <CaseColonne {...props} />\n </li>\n )\n}\n\ninterface ElementColonneProps {\n id: string\n libelle: string\n visible: boolean\n onVisibleChange: (visible: boolean) => void\n /** Id du texte qui dit pourquoi la case ne se décoche pas. */\n verrou?: string\n}\n\nconst ELEMENT =\n \"flex items-center gap-1 rounded-md bg-popover pr-2 hover:bg-muted data-dragging:relative data-dragging:z-10 data-dragging:shadow-md\"\n\nfunction ElementDeplacable(props: ElementColonneProps) {\n const {\n attributes,\n listeners,\n setNodeRef,\n setActivatorNodeRef,\n transform,\n transition,\n isDragging,\n } = useSortable({\n id: props.id,\n attributes: { roleDescription: \"colonne déplaçable\" },\n })\n\n return (\n <li\n ref={setNodeRef}\n style={{ transform: CSS.Translate.toString(transform), transition }}\n data-dragging={isDragging || undefined}\n className={ELEMENT}\n >\n {/* Sans infobulle : ouverte au focus, elle prenait pour elle le premier\n Échap, qui ne fermait plus le panneau. L'en-tête du panneau dit\n déjà « glissez pour réordonner ». */}\n <button\n type=\"button\"\n ref={setActivatorNodeRef}\n className={cn(\n buttonVariants({ variant: \"ghost\", size: \"icon-xs\" }),\n \"cursor-grab touch-none text-muted-foreground active:cursor-grabbing\"\n )}\n aria-label={`Déplacer la colonne ${props.libelle}`}\n {...attributes}\n {...listeners}\n >\n <GripVerticalIcon />\n </button>\n <CaseColonne {...props} />\n </li>\n )\n}\n\nfunction CaseColonne({\n libelle,\n visible,\n onVisibleChange,\n verrou,\n}: ElementColonneProps) {\n return (\n <label className=\"flex flex-1 cursor-pointer items-center gap-2 py-1.5 text-sm has-aria-disabled:cursor-not-allowed\">\n <Checkbox\n checked={visible}\n onCheckedChange={onVisibleChange}\n readOnly={verrou !== undefined}\n aria-disabled={verrou !== undefined || undefined}\n aria-describedby={verrou}\n className={CASE_VERROUILLEE}\n />\n {libelle}\n </label>\n )\n}\n"],"mappings":";;;;;;;;;;;;;AAmDA,IAAMA,oBAAwB,IAAI,IAAI;CAAC;CAAU;CAAU;AAAS,CAAC,GAE/DC,KAA+B,EAAE,oBAAiB;CAAE,GAAGC;CAAW,GAAG;AAAE,IAEvEC,IAAe,EACnB,WACE,8LACJ;AAyEA,SAASC,EACP,GACyB;CACzB,IAAI,CAACC,GAAmB,aAAa;CACrC,IAAMC,IAAY,IAAI,IAAID,CAAiB;CAC3C,QAAQ,MAAOC,EAAU,IAAIC,CAAE;AACjC;AAEA,SAASC,EACP,GACW;CACX,IAAMC,IAAWL,EAAYM,EAAOC,CAAK,CAAC,CAAC,iBAAiB;CAC5D,OAAO;EACL,QAAQA,EAAM,kBAAkB,CAAC,CAAC,KAAK,OAAa;GAClD,IAAIC,EAAQ;GACZ,SAASC,EAAeD,CAAO;GAC/B,WAAWA,EAAQ,WAAW,KAAKH,EAASG,EAAQ,EAAE;GACtD,SAASA,EAAQ,aAAa;GAG9B,SACE,CAACZ,EAAsB,IAAIY,EAAQ,EAAE,MACpC,CAAC,CAACA,EAAQ,cAAcA,EAAQ,WAAW;EAChD,E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