@mortenbrudvik/waveui 0.14.1 → 0.16.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 (265) hide show
  1. package/README.md +413 -53
  2. package/dist/components/data-display/InfoButton.cjs +1 -1
  3. package/dist/components/data-display/InfoButton.cjs.map +1 -1
  4. package/dist/components/data-display/InfoButton.mjs +90 -82
  5. package/dist/components/data-display/InfoButton.mjs.map +1 -1
  6. package/dist/components/data-display/InfoLabel.cjs +1 -1
  7. package/dist/components/data-display/InfoLabel.cjs.map +1 -1
  8. package/dist/components/data-display/InfoLabel.mjs +19 -18
  9. package/dist/components/data-display/InfoLabel.mjs.map +1 -1
  10. package/dist/components/data-display/List.cjs +1 -1
  11. package/dist/components/data-display/List.cjs.map +1 -1
  12. package/dist/components/data-display/List.mjs +405 -219
  13. package/dist/components/data-display/List.mjs.map +1 -1
  14. package/dist/components/data-display/List.registry.cjs +1 -1
  15. package/dist/components/data-display/List.registry.cjs.map +1 -1
  16. package/dist/components/data-display/List.registry.mjs +12 -6
  17. package/dist/components/data-display/List.registry.mjs.map +1 -1
  18. package/dist/components/feedback/MessageBarGroup.cjs +2 -0
  19. package/dist/components/feedback/MessageBarGroup.cjs.map +1 -0
  20. package/dist/components/feedback/MessageBarGroup.mjs +63 -0
  21. package/dist/components/feedback/MessageBarGroup.mjs.map +1 -0
  22. package/dist/components/feedback/ProgressBar.cjs +1 -1
  23. package/dist/components/feedback/ProgressBar.cjs.map +1 -1
  24. package/dist/components/feedback/ProgressBar.mjs +41 -39
  25. package/dist/components/feedback/ProgressBar.mjs.map +1 -1
  26. package/dist/components/feedback/Toaster.cjs +1 -1
  27. package/dist/components/feedback/Toaster.cjs.map +1 -1
  28. package/dist/components/feedback/Toaster.mjs +222 -216
  29. package/dist/components/feedback/Toaster.mjs.map +1 -1
  30. package/dist/components/input/Combobox.cjs +1 -1
  31. package/dist/components/input/Combobox.cjs.map +1 -1
  32. package/dist/components/input/Combobox.mjs +163 -148
  33. package/dist/components/input/Combobox.mjs.map +1 -1
  34. package/dist/components/input/Dropdown.cjs +1 -1
  35. package/dist/components/input/Dropdown.cjs.map +1 -1
  36. package/dist/components/input/Dropdown.mjs +132 -117
  37. package/dist/components/input/Dropdown.mjs.map +1 -1
  38. package/dist/components/input/Listbox.cjs +1 -1
  39. package/dist/components/input/Listbox.cjs.map +1 -1
  40. package/dist/components/input/Listbox.mjs +90 -78
  41. package/dist/components/input/Listbox.mjs.map +1 -1
  42. package/dist/components/input/Option.cjs +1 -1
  43. package/dist/components/input/Option.cjs.map +1 -1
  44. package/dist/components/input/Option.data.cjs +2 -0
  45. package/dist/components/input/Option.data.cjs.map +1 -0
  46. package/dist/components/input/Option.data.mjs +114 -0
  47. package/dist/components/input/Option.data.mjs.map +1 -0
  48. package/dist/components/input/Option.mjs +21 -17
  49. package/dist/components/input/Option.mjs.map +1 -1
  50. package/dist/components/layout/Accordion.cjs +1 -1
  51. package/dist/components/layout/Accordion.cjs.map +1 -1
  52. package/dist/components/layout/Accordion.mjs +124 -109
  53. package/dist/components/layout/Accordion.mjs.map +1 -1
  54. package/dist/components/layout/Carousel.cjs +1 -1
  55. package/dist/components/layout/Carousel.cjs.map +1 -1
  56. package/dist/components/layout/Carousel.mjs +207 -193
  57. package/dist/components/layout/Carousel.mjs.map +1 -1
  58. package/dist/components/layout/FlatTree.cjs +2 -0
  59. package/dist/components/layout/FlatTree.cjs.map +1 -0
  60. package/dist/components/layout/FlatTree.context.cjs +2 -0
  61. package/dist/components/layout/FlatTree.context.cjs.map +1 -0
  62. package/dist/components/layout/FlatTree.context.mjs +20 -0
  63. package/dist/components/layout/FlatTree.context.mjs.map +1 -0
  64. package/dist/components/layout/FlatTree.item.cjs +2 -0
  65. package/dist/components/layout/FlatTree.item.cjs.map +1 -0
  66. package/dist/components/layout/FlatTree.item.mjs +90 -0
  67. package/dist/components/layout/FlatTree.item.mjs.map +1 -0
  68. package/dist/components/layout/FlatTree.mjs +276 -0
  69. package/dist/components/layout/FlatTree.mjs.map +1 -0
  70. package/dist/components/layout/TabList.cjs +1 -1
  71. package/dist/components/layout/TabList.cjs.map +1 -1
  72. package/dist/components/layout/TabList.mjs +149 -108
  73. package/dist/components/layout/TabList.mjs.map +1 -1
  74. package/dist/components/layout/Tree.cjs.map +1 -1
  75. package/dist/components/layout/Tree.context.cjs +1 -1
  76. package/dist/components/layout/Tree.context.cjs.map +1 -1
  77. package/dist/components/layout/Tree.context.mjs +2 -1
  78. package/dist/components/layout/Tree.context.mjs.map +1 -1
  79. package/dist/components/layout/Tree.core.cjs +1 -1
  80. package/dist/components/layout/Tree.core.cjs.map +1 -1
  81. package/dist/components/layout/Tree.core.mjs +162 -148
  82. package/dist/components/layout/Tree.core.mjs.map +1 -1
  83. package/dist/components/layout/Tree.mjs.map +1 -1
  84. package/dist/components/layout/Tree.selection.cjs +1 -1
  85. package/dist/components/layout/Tree.selection.cjs.map +1 -1
  86. package/dist/components/layout/Tree.selection.mjs +11 -57
  87. package/dist/components/layout/Tree.selection.mjs.map +1 -1
  88. package/dist/components/layout/useFlatTree.cjs +2 -0
  89. package/dist/components/layout/useFlatTree.cjs.map +1 -0
  90. package/dist/components/layout/useFlatTree.mjs +83 -0
  91. package/dist/components/layout/useFlatTree.mjs.map +1 -0
  92. package/dist/components/navigation/Menu.popover.cjs +1 -1
  93. package/dist/components/navigation/Menu.popover.cjs.map +1 -1
  94. package/dist/components/navigation/Menu.popover.mjs +154 -168
  95. package/dist/components/navigation/Menu.popover.mjs.map +1 -1
  96. package/dist/components/navigation/Nav.cjs +1 -1
  97. package/dist/components/navigation/Nav.cjs.map +1 -1
  98. package/dist/components/navigation/Nav.mjs +156 -136
  99. package/dist/components/navigation/Nav.mjs.map +1 -1
  100. package/dist/components/navigation/NavDrawer.cjs +1 -1
  101. package/dist/components/navigation/NavDrawer.cjs.map +1 -1
  102. package/dist/components/navigation/NavDrawer.mjs +48 -45
  103. package/dist/components/navigation/NavDrawer.mjs.map +1 -1
  104. package/dist/components/overlays/Dialog.cjs +1 -1
  105. package/dist/components/overlays/Dialog.cjs.map +1 -1
  106. package/dist/components/overlays/Dialog.mjs +128 -122
  107. package/dist/components/overlays/Dialog.mjs.map +1 -1
  108. package/dist/components/overlays/Dialog.slots.cjs +1 -1
  109. package/dist/components/overlays/Dialog.slots.cjs.map +1 -1
  110. package/dist/components/overlays/Dialog.slots.mjs +12 -12
  111. package/dist/components/overlays/Dialog.slots.mjs.map +1 -1
  112. package/dist/components/overlays/Drawer.cjs.map +1 -1
  113. package/dist/components/overlays/Drawer.mjs.map +1 -1
  114. package/dist/components/overlays/Drawer.panel.cjs +1 -1
  115. package/dist/components/overlays/Drawer.panel.cjs.map +1 -1
  116. package/dist/components/overlays/Drawer.panel.mjs +97 -81
  117. package/dist/components/overlays/Drawer.panel.mjs.map +1 -1
  118. package/dist/components/overlays/Drawer.root.cjs +1 -1
  119. package/dist/components/overlays/Drawer.root.cjs.map +1 -1
  120. package/dist/components/overlays/Drawer.root.mjs +34 -31
  121. package/dist/components/overlays/Drawer.root.mjs.map +1 -1
  122. package/dist/components/overlays/Popover.cjs +1 -1
  123. package/dist/components/overlays/Popover.cjs.map +1 -1
  124. package/dist/components/overlays/Popover.mjs +231 -216
  125. package/dist/components/overlays/Popover.mjs.map +1 -1
  126. package/dist/components/overlays/TeachingPopover.cjs.map +1 -1
  127. package/dist/components/overlays/TeachingPopover.mjs.map +1 -1
  128. package/dist/components/overlays/TeachingPopover.parts.cjs +1 -1
  129. package/dist/components/overlays/TeachingPopover.parts.cjs.map +1 -1
  130. package/dist/components/overlays/TeachingPopover.parts.mjs +199 -177
  131. package/dist/components/overlays/TeachingPopover.parts.mjs.map +1 -1
  132. package/dist/components/overlays/TeachingPopover.root.cjs +1 -1
  133. package/dist/components/overlays/TeachingPopover.root.cjs.map +1 -1
  134. package/dist/components/overlays/TeachingPopover.root.mjs +93 -92
  135. package/dist/components/overlays/TeachingPopover.root.mjs.map +1 -1
  136. package/dist/components/overlays/Tooltip.cjs +1 -1
  137. package/dist/components/overlays/Tooltip.cjs.map +1 -1
  138. package/dist/components/overlays/Tooltip.mjs +66 -61
  139. package/dist/components/overlays/Tooltip.mjs.map +1 -1
  140. package/dist/components/provider/WaveProvider.cjs +1 -1
  141. package/dist/components/provider/WaveProvider.cjs.map +1 -1
  142. package/dist/components/provider/WaveProvider.mjs +26 -23
  143. package/dist/components/provider/WaveProvider.mjs.map +1 -1
  144. package/dist/components/table/DataGrid.cjs +1 -1
  145. package/dist/components/table/DataGrid.cjs.map +1 -1
  146. package/dist/components/table/DataGrid.context.cjs +2 -0
  147. package/dist/components/table/DataGrid.context.cjs.map +1 -0
  148. package/dist/components/table/DataGrid.context.mjs +74 -0
  149. package/dist/components/table/DataGrid.context.mjs.map +1 -0
  150. package/dist/components/table/DataGrid.header.cjs +2 -0
  151. package/dist/components/table/DataGrid.header.cjs.map +1 -0
  152. package/dist/components/table/DataGrid.header.mjs +168 -0
  153. package/dist/components/table/DataGrid.header.mjs.map +1 -0
  154. package/dist/components/table/DataGrid.mjs +488 -591
  155. package/dist/components/table/DataGrid.mjs.map +1 -1
  156. package/dist/components/table/DataGrid.sizing.cjs +2 -0
  157. package/dist/components/table/DataGrid.sizing.cjs.map +1 -0
  158. package/dist/components/table/DataGrid.sizing.mjs +187 -0
  159. package/dist/components/table/DataGrid.sizing.mjs.map +1 -0
  160. package/dist/components/table/DataGrid.store.cjs +2 -0
  161. package/dist/components/table/DataGrid.store.cjs.map +1 -0
  162. package/dist/components/table/DataGrid.store.mjs +108 -0
  163. package/dist/components/table/DataGrid.store.mjs.map +1 -0
  164. package/dist/components/table/DataGrid.window.cjs +2 -0
  165. package/dist/components/table/DataGrid.window.cjs.map +1 -0
  166. package/dist/components/table/DataGrid.window.mjs +165 -0
  167. package/dist/components/table/DataGrid.window.mjs.map +1 -0
  168. package/dist/components/table/Table.cjs +1 -1
  169. package/dist/components/table/Table.cjs.map +1 -1
  170. package/dist/components/table/Table.mjs +74 -72
  171. package/dist/components/table/Table.mjs.map +1 -1
  172. package/dist/components/table/Table.resize.cjs +2 -0
  173. package/dist/components/table/Table.resize.cjs.map +1 -0
  174. package/dist/components/table/Table.resize.mjs +98 -0
  175. package/dist/components/table/Table.resize.mjs.map +1 -0
  176. package/dist/components/table/useGridNavigation.cjs +1 -1
  177. package/dist/components/table/useGridNavigation.cjs.map +1 -1
  178. package/dist/components/table/useGridNavigation.mjs +343 -140
  179. package/dist/components/table/useGridNavigation.mjs.map +1 -1
  180. package/dist/components/table/useTableColumnSizing.cjs +2 -0
  181. package/dist/components/table/useTableColumnSizing.cjs.map +1 -0
  182. package/dist/components/table/useTableColumnSizing.mjs +76 -0
  183. package/dist/components/table/useTableColumnSizing.mjs.map +1 -0
  184. package/dist/components/table/useTableFeatures.cjs +2 -0
  185. package/dist/components/table/useTableFeatures.cjs.map +1 -0
  186. package/dist/components/table/useTableFeatures.mjs +110 -0
  187. package/dist/components/table/useTableFeatures.mjs.map +1 -0
  188. package/dist/components/table/useTableSelection.cjs +2 -0
  189. package/dist/components/table/useTableSelection.cjs.map +1 -0
  190. package/dist/components/table/useTableSelection.mjs +39 -0
  191. package/dist/components/table/useTableSelection.mjs.map +1 -0
  192. package/dist/components/table/useTableSort.cjs +2 -0
  193. package/dist/components/table/useTableSort.cjs.map +1 -0
  194. package/dist/components/table/useTableSort.mjs +58 -0
  195. package/dist/components/table/useTableSort.mjs.map +1 -0
  196. package/dist/hooks/useActiveDescendant.cjs +1 -1
  197. package/dist/hooks/useActiveDescendant.cjs.map +1 -1
  198. package/dist/hooks/useActiveDescendant.mjs +33 -25
  199. package/dist/hooks/useActiveDescendant.mjs.map +1 -1
  200. package/dist/hooks/useCollapsePresence.cjs +2 -0
  201. package/dist/hooks/useCollapsePresence.cjs.map +1 -0
  202. package/dist/hooks/useCollapsePresence.mjs +21 -0
  203. package/dist/hooks/useCollapsePresence.mjs.map +1 -0
  204. package/dist/hooks/useFocusBeforeClose.cjs +2 -0
  205. package/dist/hooks/useFocusBeforeClose.cjs.map +1 -0
  206. package/dist/hooks/useFocusBeforeClose.mjs +33 -0
  207. package/dist/hooks/useFocusBeforeClose.mjs.map +1 -0
  208. package/dist/hooks/useListbox.cjs +1 -1
  209. package/dist/hooks/useListbox.cjs.map +1 -1
  210. package/dist/hooks/useListbox.mjs +140 -130
  211. package/dist/hooks/useListbox.mjs.map +1 -1
  212. package/dist/hooks/useMotion.cjs +2 -0
  213. package/dist/hooks/useMotion.cjs.map +1 -0
  214. package/dist/hooks/useMotion.mjs +14 -0
  215. package/dist/hooks/useMotion.mjs.map +1 -0
  216. package/dist/hooks/usePresenceGroup.cjs +2 -0
  217. package/dist/hooks/usePresenceGroup.cjs.map +1 -0
  218. package/dist/hooks/usePresenceGroup.mjs +68 -0
  219. package/dist/hooks/usePresenceGroup.mjs.map +1 -0
  220. package/dist/hooks/useRovingTabIndex.cjs +1 -1
  221. package/dist/hooks/useRovingTabIndex.cjs.map +1 -1
  222. package/dist/hooks/useRovingTabIndex.mjs +1 -1
  223. package/dist/hooks/useRovingTabIndex.mjs.map +1 -1
  224. package/dist/hooks/useSelection.cjs +2 -0
  225. package/dist/hooks/useSelection.cjs.map +1 -0
  226. package/dist/hooks/useSelection.mjs +57 -0
  227. package/dist/hooks/useSelection.mjs.map +1 -0
  228. package/dist/hooks/useVirtualWindow.cjs +2 -0
  229. package/dist/hooks/useVirtualWindow.cjs.map +1 -0
  230. package/dist/hooks/useVirtualWindow.mjs +102 -0
  231. package/dist/hooks/useVirtualWindow.mjs.map +1 -0
  232. package/dist/index.cjs +1 -1
  233. package/dist/index.d.cts +2249 -179
  234. package/dist/index.d.ts +2249 -179
  235. package/dist/index.mjs +147 -135
  236. package/dist/lib/classNames.cjs +1 -1
  237. package/dist/lib/classNames.cjs.map +1 -1
  238. package/dist/lib/classNames.mjs +125 -95
  239. package/dist/lib/classNames.mjs.map +1 -1
  240. package/dist/lib/columnSizing.cjs +2 -0
  241. package/dist/lib/columnSizing.cjs.map +1 -0
  242. package/dist/lib/columnSizing.mjs +27 -0
  243. package/dist/lib/columnSizing.mjs.map +1 -0
  244. package/dist/lib/flatTree.cjs +2 -0
  245. package/dist/lib/flatTree.cjs.map +1 -0
  246. package/dist/lib/flatTree.mjs +118 -0
  247. package/dist/lib/flatTree.mjs.map +1 -0
  248. package/dist/lib/motion.cjs +2 -0
  249. package/dist/lib/motion.cjs.map +1 -0
  250. package/dist/lib/motion.mjs +43 -0
  251. package/dist/lib/motion.mjs.map +1 -0
  252. package/dist/lib/selection.cjs +2 -0
  253. package/dist/lib/selection.cjs.map +1 -0
  254. package/dist/lib/selection.mjs +28 -0
  255. package/dist/lib/selection.mjs.map +1 -0
  256. package/dist/lib/treeCascade.cjs +2 -0
  257. package/dist/lib/treeCascade.cjs.map +1 -0
  258. package/dist/lib/treeCascade.mjs +52 -0
  259. package/dist/lib/treeCascade.mjs.map +1 -0
  260. package/dist/lib/virtual.cjs +2 -0
  261. package/dist/lib/virtual.cjs.map +1 -0
  262. package/dist/lib/virtual.mjs +54 -0
  263. package/dist/lib/virtual.mjs.map +1 -0
  264. package/dist/styles.css +1 -1
  265. package/package.json +2 -1
@@ -12,37 +12,38 @@ import { useMergedRefs as S } from "../../hooks/useMergedRefs.mjs";
12
12
  import "../../lib/styles.mjs";
13
13
  import { useFormReset as C } from "../../hooks/useFormReset.mjs";
14
14
  import { AvatarSizeContext as w } from "../data-display/Avatar.context.mjs";
15
- import { SELECTION_CELL_CLASSES as T, TableSelectionControl as E, TableSortButton as D } from "./Table.shared.mjs";
16
- import * as O from "react";
17
- import { jsx as k, jsxs as A } from "react/jsx-runtime";
15
+ import { TableResizeHandle as T } from "./Table.resize.mjs";
16
+ import { SELECTION_CELL_CLASSES as E, TableSelectionControl as D, TableSortButton as O } from "./Table.shared.mjs";
17
+ import * as k from "react";
18
+ import { jsx as A, jsxs as j } from "react/jsx-runtime";
18
19
  //#region src/components/table/Table.tsx
19
- var j = () => () => {};
20
- function M(e) {
21
- let t = O.useCallback((t) => {
20
+ var M = () => () => {};
21
+ function N(e) {
22
+ let t = k.useCallback((t) => {
22
23
  if (!e || typeof ResizeObserver > "u") return () => {};
23
24
  let n = new ResizeObserver(t);
24
25
  n.observe(e);
25
26
  for (let t of Array.from(e.children)) n.observe(t);
26
27
  return () => n.disconnect();
27
- }, [e]), n = O.useCallback(() => e ? e.scrollWidth > e.clientWidth : !1, [e]);
28
- return O.useSyncExternalStore(e ? t : j, n, () => !1);
28
+ }, [e]), n = k.useCallback(() => e ? e.scrollWidth > e.clientWidth : !1, [e]);
29
+ return k.useSyncExternalStore(e ? t : M, n, () => !1);
29
30
  }
30
- function N(e) {
31
+ function P(e) {
31
32
  return n(e, "caption");
32
33
  }
33
- var P = ({ striped: n = !1, containerProps: r, children: i, className: o, ref: s, ...c }) => {
34
- let { className: l, ref: u, "aria-label": d, "aria-labelledby": f, ...p } = r ?? {}, [h, g] = O.useState(null), _ = S(u, g), v = M(h), y = x("wave-table-caption"), b = t(i), C = b.findIndex(({ node: e }) => N(e)), w = C >= 0 ? b[C].node : null, T = w ? w.props.id ?? y : void 0, E = w && w.props.id === void 0 ? b.map(({ key: e, node: t }, n) => /* @__PURE__ */ k(O.Fragment, { children: n === C ? O.cloneElement(w, { id: y }) : t }, e)) : i, D = d ? void 0 : f ?? T, A = !!(d || D), j = v && A, P = p.role;
35
- return O.useEffect(() => {
36
- v && !A && a("Table:unnamed-scroll-region", "Table: the table scrolls horizontally but its scroll region has no name. Add a <caption> or containerProps[\"aria-label\"].");
37
- }, [v, A]), /* @__PURE__ */ k("div", {
34
+ var F = ({ striped: n = !1, containerProps: r, children: i, className: o, ref: s, ...c }) => {
35
+ let { className: l, ref: u, "aria-label": d, "aria-labelledby": f, ...p } = r ?? {}, [h, g] = k.useState(null), _ = S(u, g), v = N(h), y = x("wave-table-caption"), b = t(i), C = b.findIndex(({ node: e }) => P(e)), w = C >= 0 ? b[C].node : null, T = w ? w.props.id ?? y : void 0, E = w && w.props.id === void 0 ? b.map(({ key: e, node: t }, n) => /* @__PURE__ */ A(k.Fragment, { children: n === C ? k.cloneElement(w, { id: y }) : t }, e)) : i, D = d ? void 0 : f ?? T, O = !!(d || D), j = v && O, M = p.role;
36
+ return k.useEffect(() => {
37
+ v && !O && a("Table:unnamed-scroll-region", "Table: the table scrolls horizontally but its scroll region has no name. Add a <caption> or containerProps[\"aria-label\"].");
38
+ }, [v, O]), /* @__PURE__ */ A("div", {
38
39
  ...p,
39
40
  ref: _,
40
- role: j ? "region" : P,
41
+ role: j ? "region" : M,
41
42
  tabIndex: v ? 0 : p.tabIndex,
42
- "aria-label": v || P !== void 0 ? d : void 0,
43
- "aria-labelledby": j ? D : P === void 0 ? void 0 : f,
43
+ "aria-label": v || M !== void 0 ? d : void 0,
44
+ "aria-labelledby": j ? D : M === void 0 ? void 0 : f,
44
45
  className: e(m.container, "overflow-x-auto rounded-md border border-border", v && "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring", l),
45
- children: /* @__PURE__ */ k("table", {
46
+ children: /* @__PURE__ */ A("table", {
46
47
  ref: s,
47
48
  "data-striped": n ? "" : void 0,
48
49
  className: e(m.root, "w-full border-separate border-spacing-0", n && "[:where(&>tbody>tr:nth-child(odd))]:bg-card", o),
@@ -51,19 +52,19 @@ var P = ({ striped: n = !1, containerProps: r, children: i, className: o, ref: s
51
52
  })
52
53
  });
53
54
  };
54
- P.displayName = "Table";
55
- var F = ({ children: t, className: n, ref: r, ...i }) => /* @__PURE__ */ k("thead", {
55
+ F.displayName = "Table";
56
+ var I = ({ children: t, className: n, ref: r, ...i }) => /* @__PURE__ */ A("thead", {
56
57
  ref: r,
57
58
  ...i,
58
59
  className: e(g.root, "bg-card", n),
59
60
  children: t
60
61
  });
61
- F.displayName = "TableHeader";
62
- var I = ({ sortable: t = !1, sortDirection: n, onSortClick: r, sortIcon: i, aside: a, children: o, className: l, ref: u, ...d }) => {
62
+ I.displayName = "TableHeader";
63
+ var L = ({ sortable: t = !1, sortDirection: n, onSortClick: r, sortIcon: i, aside: a, children: o, className: l, ref: u, ...d }) => {
63
64
  let f = c(a), p = f ? s(a, "span", e(h.aside, "inline-flex shrink-0 items-center", t && "pe-4")) : null, m = o;
64
- return t ? m = /* @__PURE__ */ A("div", {
65
+ return t ? m = /* @__PURE__ */ j("div", {
65
66
  className: "flex items-center",
66
- children: [/* @__PURE__ */ k(D, {
67
+ children: [/* @__PURE__ */ A(O, {
67
68
  component: "Table.HeaderCell",
68
69
  direction: n,
69
70
  sortIcon: i,
@@ -72,10 +73,10 @@ var I = ({ sortable: t = !1, sortDirection: n, onSortClick: r, sortIcon: i, asid
72
73
  onClick: r,
73
74
  children: o
74
75
  }), p]
75
- }) : f && (m = /* @__PURE__ */ A("div", {
76
+ }) : f && (m = /* @__PURE__ */ j("div", {
76
77
  className: "flex items-center gap-2",
77
78
  children: [o, p]
78
- })), /* @__PURE__ */ k("th", {
79
+ })), /* @__PURE__ */ A("th", {
79
80
  ref: u,
80
81
  scope: "col",
81
82
  "aria-sort": t ? n ?? "none" : void 0,
@@ -84,34 +85,34 @@ var I = ({ sortable: t = !1, sortDirection: n, onSortClick: r, sortIcon: i, asid
84
85
  children: m
85
86
  });
86
87
  };
87
- I.displayName = "TableHeaderCell";
88
- var L = (e) => (i("Table", "Table.Head", "Table.Header"), /* @__PURE__ */ k(F, { ...e }));
89
- L.displayName = "TableHead";
90
- var R = (e) => (i("Table", "Table.HeadCell", "Table.HeaderCell"), /* @__PURE__ */ k(I, { ...e }));
91
- R.displayName = "TableHeadCell";
92
- var z = ({ children: t, className: n, ref: r, ...i }) => /* @__PURE__ */ k("tbody", {
88
+ L.displayName = "TableHeaderCell";
89
+ var R = (e) => (i("Table", "Table.Head", "Table.Header"), /* @__PURE__ */ A(I, { ...e }));
90
+ R.displayName = "TableHead";
91
+ var z = (e) => (i("Table", "Table.HeadCell", "Table.HeaderCell"), /* @__PURE__ */ A(L, { ...e }));
92
+ z.displayName = "TableHeadCell";
93
+ var B = ({ children: t, className: n, ref: r, ...i }) => /* @__PURE__ */ A("tbody", {
93
94
  ref: r,
94
95
  ...i,
95
96
  className: e(u.root, n),
96
97
  children: t
97
98
  });
98
- z.displayName = "TableBody";
99
- var B = ({ children: t, className: n, ref: r, ...i }) => /* @__PURE__ */ k("tr", {
99
+ B.displayName = "TableBody";
100
+ var V = ({ children: t, className: n, ref: r, ...i }) => /* @__PURE__ */ A("tr", {
100
101
  ref: r,
101
102
  className: e(_.root, "group/table-row", "hover:bg-subtle-hover transition-colors motion-reduce:transition-none", n),
102
103
  ...i,
103
104
  children: t
104
105
  });
105
- B.displayName = "TableRow";
106
- var V = ({ children: t, className: n, ref: r, ...i }) => /* @__PURE__ */ k("td", {
106
+ V.displayName = "TableRow";
107
+ var H = ({ children: t, className: n, ref: r, ...i }) => /* @__PURE__ */ A("td", {
107
108
  ref: r,
108
109
  className: e(f.root, "relative px-4 py-3 text-body-1 border-b border-border", n),
109
110
  ...i,
110
111
  children: t
111
112
  });
112
- V.displayName = "TableCell";
113
- var H = ({ type: t = "checkbox", checked: n, defaultChecked: i = !1, onCheckedChange: o, onChange: s, name: c, value: u, form: d, disabled: f, required: p, subtle: m = !1, invisible: h = !1, id: g, "aria-label": _, "aria-labelledby": x, "aria-describedby": w, "aria-invalid": D, "aria-required": A, "aria-errormessage": j, "aria-details": M, autoFocus: N, tabIndex: P, onFocus: F, onBlur: I, onKeyDown: L, onKeyUp: R, controlRef: z, className: B, ref: V, ...H }) => {
114
- let U = O.useRef(void 0), [W, G, K] = b(n, i, (e) => {
113
+ H.displayName = "TableCell";
114
+ var U = ({ type: t = "checkbox", checked: n, defaultChecked: i = !1, onCheckedChange: o, onChange: s, name: c, value: u, form: d, disabled: f, required: p, subtle: m = !1, invisible: h = !1, id: g, "aria-label": _, "aria-labelledby": x, "aria-describedby": w, "aria-invalid": T, "aria-required": O, "aria-errormessage": j, "aria-details": M, autoFocus: N, tabIndex: P, onFocus: F, onBlur: I, onKeyDown: L, onKeyUp: R, controlRef: z, className: B, ref: V, ...H }) => {
115
+ let U = k.useRef(void 0), [W, G, K] = b(n, i, (e) => {
115
116
  e !== "mixed" && o?.(e, U.current);
116
117
  }), q = y((e, t) => {
117
118
  U.current = { event: t };
@@ -120,10 +121,10 @@ var H = ({ type: t = "checkbox", checked: n, defaultChecked: i = !1, onCheckedCh
120
121
  } finally {
121
122
  U.current = void 0;
122
123
  }
123
- }), J = O.useRef(null), Y = S(J, z);
124
+ }), J = k.useRef(null), Y = S(J, z);
124
125
  C(J, () => G(i), d);
125
126
  let X = t === "radio" && !K && !!c;
126
- return O.useEffect(() => {
127
+ return k.useEffect(() => {
127
128
  let e = J.current;
128
129
  if (!X || !e) return;
129
130
  let t = e.getRootNode(), n = (t) => {
@@ -131,19 +132,19 @@ var H = ({ type: t = "checkbox", checked: n, defaultChecked: i = !1, onCheckedCh
131
132
  n !== e && n instanceof HTMLInputElement && n.type === "radio" && n.name === e.name && n.form === e.form && n.checked && q(!1, t);
132
133
  };
133
134
  return t.addEventListener("click", n, !0), () => t.removeEventListener("click", n, !0);
134
- }, [X, q]), O.useEffect(() => {
135
+ }, [X, q]), k.useEffect(() => {
135
136
  let e = J.current;
136
137
  !r || !e || _ || x || (e.labels?.length ?? 0) > 0 || a("Table.SelectionCell:name", "Table.SelectionCell: the selection control has no accessible name. Pass `aria-label` (e.g. \"Select Alpha\") or `aria-labelledby` (e.g. the id of the row’s first cell).");
137
138
  }, [
138
139
  _,
139
140
  x,
140
141
  g
141
- ]), /* @__PURE__ */ k("td", {
142
+ ]), /* @__PURE__ */ A("td", {
142
143
  ref: V,
143
144
  "data-type": t,
144
145
  ...H,
145
- className: e(v.root, T, B),
146
- children: /* @__PURE__ */ k(E, {
146
+ className: e(v.root, E, B),
147
+ children: /* @__PURE__ */ A(D, {
147
148
  ref: Y,
148
149
  type: t,
149
150
  checked: W,
@@ -158,8 +159,8 @@ var H = ({ type: t = "checkbox", checked: n, defaultChecked: i = !1, onCheckedCh
158
159
  "aria-label": _,
159
160
  "aria-labelledby": x,
160
161
  "aria-describedby": w,
161
- "aria-invalid": D,
162
- "aria-required": A,
162
+ "aria-invalid": T,
163
+ "aria-required": O,
163
164
  "aria-errormessage": j,
164
165
  "aria-details": M,
165
166
  autoFocus: N,
@@ -173,51 +174,52 @@ var H = ({ type: t = "checkbox", checked: n, defaultChecked: i = !1, onCheckedCh
173
174
  })
174
175
  });
175
176
  };
176
- H.displayName = "TableSelectionCell";
177
- var U = { size: 32 }, W = {
177
+ U.displayName = "TableSelectionCell";
178
+ var W = { size: 32 }, G = {
178
179
  default: "flex shrink-0 items-center [&>svg]:size-5",
179
180
  primary: "flex shrink-0 items-center [&>svg]:size-6"
180
- }, G = ({ media: t, description: n, truncate: r = !1, appearance: i, children: a, className: l, ref: u, ...d }) => {
181
+ }, K = ({ media: t, description: n, truncate: r = !1, appearance: i, children: a, className: l, ref: u, ...d }) => {
181
182
  let f = c(t), m = c(a), h = c(n), g = i === "primary";
182
- return /* @__PURE__ */ A("div", {
183
+ return /* @__PURE__ */ j("div", {
183
184
  ref: u,
184
185
  "data-appearance": i,
185
186
  "data-truncate": r ? "" : void 0,
186
187
  ...d,
187
188
  className: e(p.root, "flex items-center gap-2", r && "overflow-x-hidden", l),
188
- children: [f && /* @__PURE__ */ k(w.Provider, {
189
- value: U,
190
- children: s(t, "span", e(p.media, W[g ? "primary" : "default"]))
191
- }), (m || h) && /* @__PURE__ */ A("div", {
189
+ children: [f && /* @__PURE__ */ A(w.Provider, {
190
+ value: W,
191
+ children: s(t, "span", e(p.media, G[g ? "primary" : "default"]))
192
+ }), (m || h) && /* @__PURE__ */ j("div", {
192
193
  className: e(p.content, "flex flex-col", r && "min-w-0 overflow-x-hidden"),
193
- children: [m && /* @__PURE__ */ k("span", {
194
+ children: [m && /* @__PURE__ */ A("span", {
194
195
  className: e(p.main, r && "truncate", g && "font-semibold"),
195
196
  children: o(a)
196
197
  }), h && s(n, "span", e(p.description, "text-caption-1 text-muted-foreground", r && "truncate"))]
197
198
  })]
198
199
  });
199
200
  };
200
- G.displayName = "TableCellLayout";
201
- var K = "absolute inset-y-0 end-0 flex items-center gap-1 px-1 bg-background group-hover/table-row:bg-subtle-hover [:where([data-striped]>tbody>tr:nth-child(odd)>*)>&]:bg-card [[data-selection-appearance=brand]>tbody>[data-selected]>*>&]:bg-selected [[data-selection-appearance=neutral]>tbody>[data-selected]>*>&]:bg-subtle-selected transition-[opacity,background-color] motion-reduce:transition-none", q = "opacity-0 group-hover/table-row:opacity-100 group-focus-within/table-row:opacity-100 focus-within:opacity-100 forced-colors:opacity-100 pointer-coarse:opacity-100", J = ({ visible: t = !1, className: n, ref: r, ...i }) => /* @__PURE__ */ k("div", {
201
+ K.displayName = "TableCellLayout";
202
+ var q = "absolute inset-y-0 end-0 flex items-center gap-1 px-1 bg-background group-hover/table-row:bg-subtle-hover [:where([data-striped]>tbody>tr:nth-child(odd)>*)>&]:bg-card [[data-selection-appearance=brand]>tbody>[data-selected]>*>&]:bg-selected [[data-selection-appearance=neutral]>tbody>[data-selected]>*>&]:bg-subtle-selected transition-[opacity,background-color] motion-reduce:transition-none", J = "opacity-0 group-hover/table-row:opacity-100 group-focus-within/table-row:opacity-100 focus-within:opacity-100 forced-colors:opacity-100 pointer-coarse:opacity-100", Y = ({ visible: t = !1, className: n, ref: r, ...i }) => /* @__PURE__ */ A("div", {
202
203
  ref: r,
203
204
  "data-visible": t ? "" : void 0,
204
205
  ...i,
205
- className: e(d.root, K, t ? void 0 : q, n)
206
+ className: e(d.root, q, t ? void 0 : J, n)
206
207
  });
207
- J.displayName = "TableCellActions";
208
- var Y = /* @__PURE__ */ Object.assign(P, {
209
- Header: F,
210
- HeaderCell: I,
211
- Head: L,
212
- HeadCell: R,
213
- Body: z,
214
- Row: B,
215
- Cell: V,
216
- SelectionCell: H,
217
- CellLayout: G,
218
- CellActions: J
208
+ Y.displayName = "TableCellActions";
209
+ var X = /* @__PURE__ */ Object.assign(F, {
210
+ Header: I,
211
+ HeaderCell: L,
212
+ Head: R,
213
+ HeadCell: z,
214
+ Body: B,
215
+ Row: V,
216
+ Cell: H,
217
+ SelectionCell: U,
218
+ CellLayout: K,
219
+ CellActions: Y,
220
+ ResizeHandle: T
219
221
  });
220
222
  //#endregion
221
- export { Y as Table, z as TableBody, V as TableCell, J as TableCellActions, G as TableCellLayout, L as TableHead, R as TableHeadCell, F as TableHeader, I as TableHeaderCell, B as TableRow, H as TableSelectionCell };
223
+ export { X as Table, B as TableBody, H as TableCell, Y as TableCellActions, K as TableCellLayout, R as TableHead, z as TableHeadCell, I as TableHeader, L as TableHeaderCell, T as TableResizeHandle, V as TableRow, U as TableSelectionCell };
222
224
 
223
225
  //# sourceMappingURL=Table.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Table.mjs","names":["useId","useId$1","React","noopSubscribe","useHorizontalOverflow","subscribe","wrapper","observer","onChange","child","getSnapshot","isCaption","isElementOfType","node","TableRoot","props","containerClassName","containerRef","containerLabel","containerLabelledBy","containerRest","containerProps","setWrapper","wrapperRef","useMergedRefs","scrollable","generatedCaptionId","flatChildren","flattenChildren","children","captionIndex","caption","captionId","content","index","key","regionLabelledBy","named","isRegion","consumerRole","warnOnce","cn","tableClassNames","striped","className","TableHeader","rest","tableHeaderClassNames","TableHeaderCell","hasAside","slotRendersContent","aside","asideNode","renderSlot","tableHeaderCellClassNames","sortable","TableSortButton","sortDirection","onSortClick","TableHead","warnDeprecated","TableHeadCell","TableBody","tableBodyClassNames","TableRow","tableRowClassNames","TableCell","tableCellClassNames","TableSelectionCell","checkedProp","ariaLabel","ariaLabelledBy","ariaDescribedBy","ariaInvalid","ariaRequired","ariaErrorMessage","ariaDetails","detailsRef","checked","setChecked","isControlled","useControllable","defaultChecked","next","onCheckedChange","changeChecked","useEventCallback","inputRef","mergedControlRef","controlRef","form","followsGroup","type","name","input","root","handleClick","target","event","isDev","id","tableSelectionCellClassNames","SELECTION_CELL_CLASSES","TableSelectionControl","composeEventHandlers","CELL_LAYOUT_AVATAR_BOX","CELL_LAYOUT_MEDIA_CLASSES","TableCellLayout","hasMedia","media","hasMain","hasDescription","description","primary","appearance","truncate","tableCellLayoutClassNames","AvatarSizeContext","materialiseSlotContent","CELL_ACTIONS_CLASSES","CELL_ACTIONS_REVEAL_CLASSES","TableCellActions","visible","tableCellActionsClassNames","Table"],"sources":["../../../src/components/table/Table.tsx"],"sourcesContent":["import * as React from 'react';\nimport { flattenChildren, isElementOfType } from '../../lib/children';\nimport { cn } from '../../lib/cn';\nimport {\n tableBodyClassNames,\n tableCellActionsClassNames,\n tableCellClassNames,\n tableCellLayoutClassNames,\n tableClassNames,\n tableHeaderCellClassNames,\n tableHeaderClassNames,\n tableRowClassNames,\n tableSelectionCellClassNames,\n} from '../../lib/classNames';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { isDev, warnDeprecated, warnOnce } from '../../lib/dev';\nimport { materialiseSlotContent, renderSlot, slotRendersContent } from '../../lib/slot';\nimport type { Slot } from '../../lib/slot';\nimport { focusRing } from '../../lib/styles';\nimport { useControllable } from '../../hooks/useControllable';\nimport { useEventCallback } from '../../hooks/useEventCallback';\nimport { useFormReset } from '../../hooks/useFormReset';\nimport { useId } from '../../hooks/useId';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { AvatarSizeContext } from '../data-display/Avatar.context';\nimport type { AvatarSizeContextValue } from '../data-display/Avatar.context';\nimport { SELECTION_CELL_CLASSES, TableSelectionControl, TableSortButton } from './Table.shared';\nimport type { SortDirection } from './Table.shared';\n\n/** Properties for the Table component. */\nexport interface TableProps extends React.HTMLAttributes<HTMLTableElement> {\n /**\n * Whether to apply alternating row background colors (odd body rows). The stripe has zero\n * specificity, so a row's own background class (`<Table.Row className=\"bg-selected\">`) and its\n * hover color win over it.\n * @default false\n */\n striped?: boolean;\n /**\n * Props for the wrapper `<div>` around the `<table>`: a horizontally scrollable container\n * (`overflow-x-auto`). Use it for its className, style, ref or `aria-label`. While the table\n * scrolls horizontally, the wrapper is a keyboard-focusable `role=\"region\"` named by\n * `containerProps['aria-label']`/`['aria-labelledby']`, else by the table's `<caption>`. While\n * it does not scroll, the wrapper has no role and its `aria-label`/`aria-labelledby` are left\n * off, unless you also pass a `role` in `containerProps` (then they are always applied).\n */\n containerProps?: Omit<React.ComponentPropsWithRef<'div'>, 'children'>;\n /** Table caption, header, body and row elements. */\n children: React.ReactNode;\n /** Ref to the `<table>` element. */\n ref?: React.Ref<HTMLTableElement>;\n}\n\n/** Properties for the TableHeader sub-component. */\nexport interface TableHeaderProps extends React.HTMLAttributes<HTMLTableSectionElement> {\n /** Table header row elements. */\n children: React.ReactNode;\n /** Ref to the `<thead>` element. */\n ref?: React.Ref<HTMLTableSectionElement>;\n}\n\n/** Properties for the TableHeaderCell sub-component. */\nexport interface TableHeaderCellProps extends React.ThHTMLAttributes<HTMLTableCellElement> {\n /**\n * Makes the column header a sort control: the content is wrapped in a `<button>` that fills the\n * cell, and the cell carries `aria-sort` (`\"none\"` while `sortDirection` is not set). The table\n * does not sort or track the direction; keep it in your state, set `sortDirection` and sort the\n * rows in `onSortClick`. The table keeps no grid semantics.\n * @default false\n */\n sortable?: boolean;\n /**\n * The direction the column is sorted in, shown as `aria-sort` and as the glyph of a sortable\n * header. Absent means the column is not sorted. Without `sortable` it has no effect.\n */\n sortDirection?: SortDirection;\n /**\n * Called with the click event when the sort button is activated (click, Enter or Space).\n * Fluent's `onSortClick`.\n */\n onSortClick?: React.MouseEventHandler<HTMLButtonElement>;\n /**\n * The glyph that shows the direction, only while `sortDirection` is set. It is decorative\n * (`aria-hidden`) and carries `data-direction`. `null` and `undefined` keep the default arrow\n * (up for ascending, down for descending); `false` or anything that renders nothing hides it. A\n * `<button>` or `Button` passed here is not nested: its children become the glyph.\n */\n sortIcon?: Slot<'span'>;\n /**\n * Content beside the header content, outside the sort button (a filter button, an info\n * button), so it is not part of the button's name. Nothing renders for content that renders\n * nothing.\n */\n aside?: Slot<'span'>;\n /** Header cell content. */\n children: React.ReactNode;\n /** Ref to the `<th>` element. */\n ref?: React.Ref<HTMLTableCellElement>;\n}\n\n/** @deprecated Use `TableHeaderProps` (`Table.Header`). */\nexport type TableHeadProps = TableHeaderProps;\n\n/** @deprecated Use `TableHeaderCellProps` (`Table.HeaderCell`). */\nexport type TableHeadCellProps = TableHeaderCellProps;\n\n/** Properties for the TableBody sub-component. */\nexport interface TableBodyProps extends React.HTMLAttributes<HTMLTableSectionElement> {\n /** Table row elements. */\n children: React.ReactNode;\n /** Ref to the `<tbody>` element. */\n ref?: React.Ref<HTMLTableSectionElement>;\n}\n\n/** Properties for the TableRow sub-component. */\nexport interface TableRowProps extends React.HTMLAttributes<HTMLTableRowElement> {\n /** Table cell elements. */\n children: React.ReactNode;\n /** Ref to the `<tr>` element. */\n ref?: React.Ref<HTMLTableRowElement>;\n}\n\n/** Properties for the TableCell sub-component. */\nexport interface TableCellProps extends React.TdHTMLAttributes<HTMLTableCellElement> {\n /** Cell content. */\n children: React.ReactNode;\n /** Ref to the `<td>` element. */\n ref?: React.Ref<HTMLTableCellElement>;\n}\n\n/** Second argument of `Table.SelectionCell`'s `onCheckedChange`: the event behind the change. */\nexport interface TableSelectionCellCheckedChangeDetails {\n /**\n * The DOM event behind the change: the click of the control (Space clicks it too), or, for an\n * uncontrolled radio, the click that checked another radio of its group.\n */\n event: Event;\n}\n\n/**\n * Properties for the TableSelectionCell sub-component. The focus, key and change handlers are the\n * control's (C-ROUTING), so they replace the cell's.\n */\nexport interface TableSelectionCellProps extends Omit<\n React.TdHTMLAttributes<HTMLTableCellElement>,\n 'children' | 'defaultChecked' | 'onChange' | 'onFocus' | 'onBlur' | 'onKeyDown' | 'onKeyUp'\n> {\n /**\n * The control: a checkbox (multiple selection, or a select-all in the header) or a radio (single\n * selection).\n * @default 'checkbox'\n */\n type?: 'checkbox' | 'radio';\n /**\n * Controlled checked state. `'mixed'` draws an indeterminate checkbox (a select-all whose rows\n * are partly selected); a click on it checks it. `'mixed'` is for checkboxes only: on a radio it\n * has no effect (the radio is drawn unchecked).\n */\n checked?: boolean | 'mixed';\n /**\n * Initial checked state for uncontrolled usage, also the state a form reset restores.\n * Uncontrolled radios that share a `name` uncheck each other, as a native radio group does.\n * @default false\n */\n defaultChecked?: boolean | 'mixed';\n /**\n * Called with the new checked state when the user checks or unchecks the control (not for no-op\n * updates), and when a form reset restores a `true` or `false` `defaultChecked`. The second\n * argument holds the event. The table keeps no selection: update your rows' state here.\n */\n onCheckedChange?: (checked: boolean, details?: TableSelectionCellCheckedChangeDetails) => void;\n /**\n * The native change event of the control, called before `onCheckedChange`;\n * `event.preventDefault()` in it cancels the change.\n */\n onChange?: React.ChangeEventHandler<HTMLInputElement>;\n /** Form field name of the control. With a name, the control submits `name=value` while checked. */\n name?: string;\n /**\n * Value the control submits while checked.\n * @default 'on'\n */\n value?: string;\n /** Id of the form the control belongs to, when the table is rendered outside that form. */\n form?: string;\n /** Natively disables the control: it cannot be checked or focused. */\n disabled?: boolean;\n /** The form must not be submitted while the control is unchecked (native validation). */\n required?: boolean;\n /**\n * Draws an unchecked control only while its row (a `Table.Row`) is hovered or holds focus; its\n * own keyboard focus, forced colors and a coarse pointer (touch) always draw it. It stays\n * focusable and named.\n * @default false\n */\n subtle?: boolean;\n /**\n * Hides the control and takes it out of the tab order, while the cell keeps its box (a row that\n * cannot be selected keeps the column aligned).\n * @default false\n */\n invisible?: boolean;\n /** Focus handler of the control. */\n onFocus?: React.FocusEventHandler<HTMLInputElement>;\n /** Blur handler of the control. */\n onBlur?: React.FocusEventHandler<HTMLInputElement>;\n /** Keydown handler of the control. */\n onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;\n /** Keyup handler of the control. */\n onKeyUp?: React.KeyboardEventHandler<HTMLInputElement>;\n /** Ref to the `<input>` element. */\n controlRef?: React.Ref<HTMLInputElement>;\n /** Ref to the `<td>` element. */\n ref?: React.Ref<HTMLTableCellElement>;\n}\n\n/** Properties for the TableCellLayout sub-component. */\nexport interface TableCellLayoutProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * A picture before the text: an icon (drawn at 20px, 24px with the primary appearance) or an\n * Avatar, which takes a 32px box when it sets no `size` of its own. It is content, not hidden\n * from assistive technology: make an Avatar beside the person's name decorative.\n */\n media?: Slot<'span'>;\n /** A second line under the main text, in the caption size and the muted color. */\n description?: Slot<'span'>;\n /**\n * Keeps the main text and the description on one line each, ending in an ellipsis where they do\n * not fit. It takes effect where the column's width is bounded (a width on the column, or a\n * table layout that does not widen columns to fit their content).\n * @default false\n */\n truncate?: boolean;\n /**\n * `'primary'` draws the main text semibold and the media icon larger: the cell that names the\n * row. Rendered as `data-appearance` while set.\n */\n appearance?: 'primary';\n /** The main text. */\n children?: React.ReactNode;\n /** Ref to the layout `<div>`. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/** Properties for the TableCellActions sub-component. */\nexport interface TableCellActionsProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Keeps the actions shown, also while the row is neither hovered nor focused: for example while\n * a menu opened from one of them is open.\n * @default false\n */\n visible?: boolean;\n /** The actions: buttons, a menu button. */\n children?: React.ReactNode;\n /** Ref to the `<div>` that holds the actions. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\nconst noopSubscribe = () => () => {};\n\n/**\n * Whether `wrapper` scrolls horizontally, as an external store: a `ResizeObserver` on the wrapper\n * and the table re-checks `scrollWidth > clientWidth`. Without `ResizeObserver` (server, old\n * browsers, jsdom) the value is read on each render.\n */\nfunction useHorizontalOverflow(wrapper: HTMLDivElement | null): boolean {\n const subscribe = React.useCallback(\n (onChange: () => void) => {\n if (!wrapper || typeof ResizeObserver === 'undefined') return () => {};\n const observer = new ResizeObserver(onChange);\n observer.observe(wrapper);\n for (const child of Array.from(wrapper.children)) observer.observe(child);\n return () => observer.disconnect();\n },\n [wrapper],\n );\n const getSnapshot = React.useCallback(\n () => (wrapper ? wrapper.scrollWidth > wrapper.clientWidth : false),\n [wrapper],\n );\n return React.useSyncExternalStore(wrapper ? subscribe : noopSubscribe, getSnapshot, () => false);\n}\n\nfunction isCaption(node: React.ReactNode): node is React.ReactElement<{ id?: string }> {\n return isElementOfType(node, 'caption');\n}\n\n// The component-level JSDoc sits on the exported `Table` below.\nconst TableRoot = ({\n striped = false,\n containerProps,\n children,\n className,\n ref,\n ...props\n}: TableProps) => {\n const {\n className: containerClassName,\n ref: containerRef,\n 'aria-label': containerLabel,\n 'aria-labelledby': containerLabelledBy,\n ...containerRest\n } = containerProps ?? {};\n\n const [wrapper, setWrapper] = React.useState<HTMLDivElement | null>(null);\n const wrapperRef = useMergedRefs<HTMLDivElement>(containerRef, setWrapper);\n const scrollable = useHorizontalOverflow(wrapper);\n\n // Name the scroll region after the caption (also one inside a Fragment): keep its id, or give it\n // one. The flattened children are then rendered under their flattened keys.\n const generatedCaptionId = useId('wave-table-caption');\n const flatChildren = flattenChildren(children);\n const captionIndex = flatChildren.findIndex(({ node }) => isCaption(node));\n const caption =\n captionIndex >= 0\n ? (flatChildren[captionIndex].node as React.ReactElement<{ id?: string }>)\n : null;\n const captionId = caption ? (caption.props.id ?? generatedCaptionId) : undefined;\n const content =\n caption && caption.props.id === undefined\n ? flatChildren.map(({ key, node }, index) => (\n <React.Fragment key={key}>\n {index === captionIndex\n ? React.cloneElement(caption, { id: generatedCaptionId })\n : node}\n </React.Fragment>\n ))\n : children;\n\n const regionLabelledBy = containerLabel ? undefined : (containerLabelledBy ?? captionId);\n const named = Boolean(containerLabel || regionLabelledBy);\n const isRegion = scrollable && named;\n /** A role the consumer gave the wrapper: their name goes with it even while nothing scrolls. */\n const consumerRole = containerRest.role;\n\n React.useEffect(() => {\n if (scrollable && !named) {\n warnOnce(\n 'Table:unnamed-scroll-region',\n 'Table: the table scrolls horizontally but its scroll region has no name. Add a <caption> or containerProps[\"aria-label\"].',\n );\n }\n }, [scrollable, named]);\n\n return (\n <div\n {...containerRest}\n ref={wrapperRef}\n role={isRegion ? 'region' : consumerRole}\n tabIndex={scrollable ? 0 : containerRest.tabIndex}\n aria-label={scrollable || consumerRole !== undefined ? containerLabel : undefined}\n aria-labelledby={\n isRegion ? regionLabelledBy : consumerRole !== undefined ? containerLabelledBy : undefined\n }\n className={cn(\n tableClassNames.container,\n 'overflow-x-auto rounded-md border border-border',\n scrollable && focusRing,\n containerClassName,\n )}\n >\n <table\n ref={ref}\n data-striped={striped ? '' : undefined}\n className={cn(\n tableClassNames.root,\n 'w-full border-separate border-spacing-0',\n // `:where()` keeps the stripe at specificity 0, so any row class wins (C-CLASS).\n striped && '[:where(&>tbody>tr:nth-child(odd))]:bg-card',\n className,\n )}\n {...props}\n >\n {content}\n </table>\n </div>\n );\n};\nTableRoot.displayName = 'Table';\n\n/** The table's `<thead>`. */\nconst TableHeader = ({ children, className, ref, ...rest }: TableHeaderProps) => (\n <thead ref={ref} {...rest} className={cn(tableHeaderClassNames.root, 'bg-card', className)}>\n {children}\n </thead>\n);\nTableHeader.displayName = 'TableHeader';\n\n/** A column header cell (`<th scope=\"col\">`). */\nconst TableHeaderCell = ({\n sortable = false,\n sortDirection,\n onSortClick,\n sortIcon,\n aside,\n children,\n className,\n ref,\n ...props\n}: TableHeaderCellProps) => {\n const hasAside = slotRendersContent(aside);\n const asideNode = hasAside\n ? renderSlot(\n aside,\n 'span',\n cn(\n tableHeaderCellClassNames.aside,\n 'inline-flex shrink-0 items-center',\n sortable && 'pe-4',\n ),\n )\n : null;\n\n let content: React.ReactNode = children;\n if (sortable) {\n content = (\n <div className=\"flex items-center\">\n <TableSortButton\n component=\"Table.HeaderCell\"\n direction={sortDirection}\n sortIcon={sortIcon}\n className={tableHeaderCellClassNames.button}\n iconClassName={tableHeaderCellClassNames.sortIcon}\n onClick={onSortClick}\n >\n {children}\n </TableSortButton>\n {asideNode}\n </div>\n );\n } else if (hasAside) {\n content = (\n <div className=\"flex items-center gap-2\">\n {children}\n {asideNode}\n </div>\n );\n }\n\n return (\n <th\n ref={ref}\n scope=\"col\"\n aria-sort={sortable ? (sortDirection ?? 'none') : undefined}\n className={cn(\n tableHeaderCellClassNames.root,\n 'px-4 py-3 text-start font-semibold text-caption-1 uppercase tracking-wider border-b border-border',\n sortable && 'p-0 hover:bg-subtle-hover',\n className,\n )}\n {...props}\n >\n {content}\n </th>\n );\n};\nTableHeaderCell.displayName = 'TableHeaderCell';\n\n/** @deprecated Use `Table.Header` (`TableHeader`). */\nconst TableHead = (props: TableHeadProps) => {\n warnDeprecated('Table', 'Table.Head', 'Table.Header');\n return <TableHeader {...props} />;\n};\nTableHead.displayName = 'TableHead';\n\n/** @deprecated Use `Table.HeaderCell` (`TableHeaderCell`). */\nconst TableHeadCell = (props: TableHeadCellProps) => {\n warnDeprecated('Table', 'Table.HeadCell', 'Table.HeaderCell');\n return <TableHeaderCell {...props} />;\n};\nTableHeadCell.displayName = 'TableHeadCell';\n\n/** The table's `<tbody>`. */\nconst TableBody = ({ children, className, ref, ...rest }: TableBodyProps) => (\n <tbody ref={ref} {...rest} className={cn(tableBodyClassNames.root, className)}>\n {children}\n </tbody>\n);\nTableBody.displayName = 'TableBody';\n\n/**\n * A table row. Striping comes from the table (`striped`), so rows need no context. The row is the\n * `group/table-row` group whose hover or focus draws the subtle selection controls and the cell\n * actions inside it (Tree's rows keep their own group).\n */\nconst TableRow = ({ children, className, ref, ...props }: TableRowProps) => (\n <tr\n ref={ref}\n className={cn(\n tableRowClassNames.root,\n 'group/table-row',\n 'hover:bg-subtle-hover transition-colors motion-reduce:transition-none',\n className,\n )}\n {...props}\n >\n {children}\n </tr>\n);\nTableRow.displayName = 'TableRow';\n\n/** A data cell (`<td>`), the positioning box of a `Table.CellActions` inside it. */\nconst TableCell = ({ children, className, ref, ...props }: TableCellProps) => (\n <td\n ref={ref}\n className={cn(\n tableCellClassNames.root,\n 'relative px-4 py-3 text-body-1 border-b border-border',\n className,\n )}\n {...props}\n >\n {children}\n </td>\n);\nTableCell.displayName = 'TableCell';\n\n/**\n * A selection cell: a `<td>` with a native checkbox or radio (`type`), drawn as the DataGrid's.\n * The table keeps no selection, so the cell is usually controlled (`checked`, `onCheckedChange`)\n * from your rows' state; `checked=\"mixed\"` draws a header select-all whose rows are partly\n * selected. `id`, `aria-label`, `aria-labelledby`, `aria-describedby`, the other ARIA state\n * props, `autoFocus`, `tabIndex`, the focus, key and change handlers and `name`, `value`, `form`,\n * `disabled` and `required` go to the control (`controlRef`); `className`, `style`, `data-*`, the\n * other handlers and `ref` stay on the cell, which carries `data-type`. Name the control with\n * `aria-label` or `aria-labelledby` (the row's first cell); a development warning reports a\n * control without a name.\n */\nconst TableSelectionCell = ({\n type = 'checkbox',\n checked: checkedProp,\n defaultChecked = false,\n onCheckedChange,\n onChange,\n name,\n value,\n form,\n disabled,\n required,\n subtle = false,\n invisible = false,\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n 'aria-required': ariaRequired,\n 'aria-errormessage': ariaErrorMessage,\n 'aria-details': ariaDetails,\n autoFocus,\n tabIndex,\n onFocus,\n onBlur,\n onKeyDown,\n onKeyUp,\n controlRef,\n className,\n ref,\n ...rest\n}: TableSelectionCellProps) => {\n // The details of the change being made, set around the setter.\n const detailsRef = React.useRef<TableSelectionCellCheckedChangeDetails | undefined>(undefined);\n const [checked, setChecked, isControlled] = useControllable<boolean | 'mixed'>(\n checkedProp,\n defaultChecked,\n (next) => {\n // Only a form reset to a mixed `defaultChecked` sets `'mixed'`; the callback reports booleans.\n if (next !== 'mixed') onCheckedChange?.(next, detailsRef.current);\n },\n );\n const changeChecked = useEventCallback((next: boolean, event: Event) => {\n detailsRef.current = { event };\n try {\n setChecked(next);\n } finally {\n detailsRef.current = undefined;\n }\n });\n\n const inputRef = React.useRef<HTMLInputElement>(null);\n const mergedControlRef = useMergedRefs<HTMLInputElement>(inputRef, controlRef);\n useFormReset(inputRef, () => setChecked(defaultChecked), form);\n\n // A native radio group unchecks its other radios without an event, so an uncontrolled radio\n // listens for the click that checks another radio of its group: in the capture phase, before\n // React restores its controlled inputs from that click.\n const followsGroup = type === 'radio' && !isControlled && Boolean(name);\n React.useEffect(() => {\n const input = inputRef.current;\n if (!followsGroup || !input) return;\n const root = input.getRootNode();\n const handleClick = (event: Event) => {\n const target = event.target;\n if (target === input || !(target instanceof HTMLInputElement) || target.type !== 'radio') {\n return;\n }\n if (target.name === input.name && target.form === input.form && target.checked) {\n changeChecked(false, event);\n }\n };\n root.addEventListener('click', handleClick, true);\n return () => root.removeEventListener('click', handleClick, true);\n }, [followsGroup, changeChecked]);\n\n // Development diagnostics (C-DEV): a control needs a name; a `<label for>` gives one too.\n React.useEffect(() => {\n const input = inputRef.current;\n if (!isDev || !input || ariaLabel || ariaLabelledBy || (input.labels?.length ?? 0) > 0) return;\n warnOnce(\n 'Table.SelectionCell:name',\n 'Table.SelectionCell: the selection control has no accessible name. Pass `aria-label` ' +\n '(e.g. \"Select Alpha\") or `aria-labelledby` (e.g. the id of the row’s first cell).',\n );\n }, [ariaLabel, ariaLabelledBy, id]);\n\n return (\n <td\n ref={ref}\n data-type={type}\n {...rest}\n className={cn(tableSelectionCellClassNames.root, SELECTION_CELL_CLASSES, className)}\n >\n <TableSelectionControl\n ref={mergedControlRef}\n type={type}\n checked={checked}\n subtle={subtle}\n invisible={invisible}\n id={id}\n name={name}\n value={value}\n form={form}\n disabled={disabled}\n required={required}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n aria-invalid={ariaInvalid}\n aria-required={ariaRequired}\n aria-errormessage={ariaErrorMessage}\n aria-details={ariaDetails}\n autoFocus={autoFocus}\n tabIndex={tabIndex}\n onFocus={onFocus}\n onBlur={onBlur}\n onKeyDown={onKeyDown}\n onKeyUp={onKeyUp}\n onChange={composeEventHandlers(onChange, (event) =>\n changeChecked(event.currentTarget.checked, event.nativeEvent),\n )}\n className={tableSelectionCellClassNames.control}\n />\n </td>\n );\n};\nTableSelectionCell.displayName = 'TableSelectionCell';\n\n/** The box an Avatar in a cell layout's `media` takes when it sets no `size`. */\nconst CELL_LAYOUT_AVATAR_BOX: AvatarSizeContextValue = { size: 32 };\n\n/** The media box: its icon at 20px, or 24px with the primary appearance. */\nconst CELL_LAYOUT_MEDIA_CLASSES = {\n default: 'flex shrink-0 items-center [&>svg]:size-5',\n primary: 'flex shrink-0 items-center [&>svg]:size-6',\n} as const;\n\n/**\n * Lays out a cell's content: `media` (an icon or an Avatar), then the main text (children) with\n * an optional `description` under it. `truncate` keeps both lines to one line each with an\n * ellipsis; `appearance=\"primary\"` draws the main text semibold, for the cell that names the row.\n */\nconst TableCellLayout = ({\n media,\n description,\n truncate = false,\n appearance,\n children,\n className,\n ref,\n ...rest\n}: TableCellLayoutProps) => {\n const hasMedia = slotRendersContent(media);\n const hasMain = slotRendersContent(children);\n const hasDescription = slotRendersContent(description);\n const primary = appearance === 'primary';\n return (\n <div\n ref={ref}\n data-appearance={appearance}\n data-truncate={truncate ? '' : undefined}\n {...rest}\n className={cn(\n tableCellLayoutClassNames.root,\n 'flex items-center gap-2',\n truncate && 'overflow-x-hidden',\n className,\n )}\n >\n {hasMedia && (\n // An Avatar without its own `size` takes the 32px box of a table row.\n <AvatarSizeContext.Provider value={CELL_LAYOUT_AVATAR_BOX}>\n {renderSlot(\n media,\n 'span',\n cn(\n tableCellLayoutClassNames.media,\n CELL_LAYOUT_MEDIA_CLASSES[primary ? 'primary' : 'default'],\n ),\n )}\n </AvatarSizeContext.Provider>\n )}\n {(hasMain || hasDescription) && (\n <div\n className={cn(\n tableCellLayoutClassNames.content,\n 'flex flex-col',\n truncate && 'min-w-0 overflow-x-hidden',\n )}\n >\n {hasMain && (\n <span\n className={cn(\n tableCellLayoutClassNames.main,\n truncate && 'truncate',\n primary && 'font-semibold',\n )}\n >\n {materialiseSlotContent(children)}\n </span>\n )}\n {hasDescription &&\n renderSlot(\n description,\n 'span',\n cn(\n tableCellLayoutClassNames.description,\n 'text-caption-1 text-muted-foreground',\n truncate && 'truncate',\n ),\n )}\n </div>\n )}\n </div>\n );\n};\nTableCellLayout.displayName = 'TableCellLayout';\n\n/**\n * Where cell actions sit, over the end of their cell from its top edge to its bottom edge (the\n * buttons centred between them), and what they draw over the content under them: an opaque\n * background that follows the row's, over the full height of the cell, so wrapped text or a\n * layout with a description never shows above or below the buttons. That is the page background\n * behind a row without a fill, the row's hover color, the stripe of a striped table's odd body\n * rows (as the table's own zero-specificity rule) and the fill of a DataGrid's selected row\n * (brand and neutral appearances).\n */\nconst CELL_ACTIONS_CLASSES =\n 'absolute inset-y-0 end-0 flex items-center gap-1 px-1 bg-background group-hover/table-row:bg-subtle-hover [:where([data-striped]>tbody>tr:nth-child(odd)>*)>&]:bg-card [[data-selection-appearance=brand]>tbody>[data-selected]>*>&]:bg-selected [[data-selection-appearance=neutral]>tbody>[data-selected]>*>&]:bg-subtle-selected transition-[opacity,background-color] motion-reduce:transition-none';\n\n/**\n * Transparent until the row is hovered or holds focus, or focus is in the actions themselves;\n * forced colors and a coarse pointer (touch) always draw them.\n */\nconst CELL_ACTIONS_REVEAL_CLASSES =\n 'opacity-0 group-hover/table-row:opacity-100 group-focus-within/table-row:opacity-100 focus-within:opacity-100 forced-colors:opacity-100 pointer-coarse:opacity-100';\n\n/**\n * Actions of a cell (buttons, a menu button), shown over the end of the cell while its row is\n * hovered or holds focus, and always in forced colors and on a coarse pointer (touch); `visible`\n * keeps them shown. They stay in the tab order while hidden, and Tab into them shows them. Place\n * them in a `Table.Cell` or `DataGrid.Cell`, whose row (`Table.Row`, `DataGrid.Row`) is the group\n * that shows them. Their opaque background follows the row's (hover, a striped table's stripe, a\n * DataGrid's selected row); a row with a background of its own needs the same class on its\n * actions. The element carries `data-visible` while `visible` is set.\n */\nconst TableCellActions = ({ visible = false, className, ref, ...rest }: TableCellActionsProps) => (\n <div\n ref={ref}\n data-visible={visible ? '' : undefined}\n {...rest}\n className={cn(\n tableCellActionsClassNames.root,\n CELL_ACTIONS_CLASSES,\n visible ? undefined : CELL_ACTIONS_REVEAL_CLASSES,\n className,\n )}\n />\n);\nTableCellActions.displayName = 'TableCellActions';\n\nexport {\n TableHeader,\n TableHeaderCell,\n TableHead,\n TableHeadCell,\n TableBody,\n TableRow,\n TableCell,\n TableSelectionCell,\n TableCellLayout,\n TableCellActions,\n};\n\n/**\n * A non-interactive data table with an optional striped body. The table sits in a horizontally\n * scrollable wrapper; while it scrolls, the wrapper is a focusable region (named by\n * `containerProps` or the `<caption>`) so keyboard users can scroll it.\n *\n * The table keeps no state: a sortable `Table.HeaderCell` reports its clicks, and a\n * `Table.SelectionCell` (a native checkbox or radio) its changes, for your state to sort and\n * select the rows. `Table.CellLayout` lays out a cell's media, text and description, and\n * `Table.CellActions` shows a cell's actions while its row is hovered or holds focus.\n *\n * Sub-components are available as `Table.Header`, `Table.HeaderCell`, `Table.Body`, `Table.Row`,\n * `Table.Cell`, `Table.SelectionCell`, `Table.CellLayout` and `Table.CellActions` in client\n * components, and as the flat exports `TableHeader`, `TableHeaderCell`, `TableBody`, `TableRow`,\n * `TableCell`, `TableSelectionCell`, `TableCellLayout` and `TableCellActions` (the form React\n * Server Components can import). `Table.Head`/`Table.HeadCell` (`TableHead`/`TableHeadCell`) are\n * deprecated aliases.\n */\nexport const Table = /* @__PURE__ */ Object.assign(TableRoot, {\n Header: TableHeader,\n HeaderCell: TableHeaderCell,\n /** @deprecated Use `Table.Header`. */\n Head: TableHead,\n /** @deprecated Use `Table.HeaderCell`. */\n HeadCell: TableHeadCell,\n Body: TableBody,\n Row: TableRow,\n Cell: TableCell,\n SelectionCell: TableSelectionCell,\n CellLayout: TableCellLayout,\n CellActions: TableCellActions,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkQA,IAAMG,gBAA4B,CAAC;AAOnC,SAASC,EAAsB,GAAyC;CACtE,IAAMC,IAAYH,EAAM,aACrB,MAAyB;EACxB,IAAI,CAACI,KAAW,OAAO,iBAAmB,KAAa,aAAa,CAAC;EACrE,IAAMC,IAAW,IAAI,eAAeC,CAAQ;EAC5C,EAAS,QAAQF,CAAO;EACx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AAK,EAAuBzF,CAAQ;GAC5B,CAAA,GAEPkF,KACC1D,EACE2D,GACA,QACAvE,EACE2E,EAA0B,aAC1B,wCACAD,KAAY,UACd,CACF,CACC;EAEJ,CAAA,CAAA;;AAET;AACA,EAAgB,cAAc;AAW9B,IAAMI,IACJ,2YAMIC,IACJ,sKAWIC,KAAoB,EAAE,aAAU,IAAO,cAAW,QAAK,GAAG3E,QAC9D,kBAAC,OAAD;CACO;CACL,gBAAc4E,IAAU,KAAK,KAAA;CAC7B,GAAI5E;CACJ,WAAWL,EACTkF,EAA2B,MAC3BJ,GACAG,IAAU,KAAA,IAAYF,GACtB5E,CACF;AACD,CAAA;AAEH,EAAiB,cAAc;AAgC/B,IAAagF,IAAwB,uBAAO,OAAO9G,GAAW;CAC5D,QAAQ+B;CACR,YAAYG;CAEZ,MAAMW;CAEN,UAAUE;CACV,MAAMC;CACN,KAAKE;CACL,MAAME;CACN,eAAeE;CACf,YAAYuC;CACZ,aAAac;AACf,CAAC"}
1
+ {"version":3,"file":"Table.mjs","names":["useId","useId$1","React","noopSubscribe","useHorizontalOverflow","subscribe","wrapper","observer","onChange","child","getSnapshot","isCaption","isElementOfType","node","TableRoot","props","containerClassName","containerRef","containerLabel","containerLabelledBy","containerRest","containerProps","setWrapper","wrapperRef","useMergedRefs","scrollable","generatedCaptionId","flatChildren","flattenChildren","children","captionIndex","caption","captionId","content","index","key","regionLabelledBy","named","isRegion","consumerRole","warnOnce","cn","tableClassNames","striped","className","TableHeader","rest","tableHeaderClassNames","TableHeaderCell","hasAside","slotRendersContent","aside","asideNode","renderSlot","tableHeaderCellClassNames","sortable","TableSortButton","sortDirection","onSortClick","TableHead","warnDeprecated","TableHeadCell","TableBody","tableBodyClassNames","TableRow","tableRowClassNames","TableCell","tableCellClassNames","TableSelectionCell","checkedProp","ariaLabel","ariaLabelledBy","ariaDescribedBy","ariaInvalid","ariaRequired","ariaErrorMessage","ariaDetails","detailsRef","checked","setChecked","isControlled","useControllable","defaultChecked","next","onCheckedChange","changeChecked","useEventCallback","inputRef","mergedControlRef","controlRef","form","followsGroup","type","name","input","root","handleClick","target","event","isDev","id","tableSelectionCellClassNames","SELECTION_CELL_CLASSES","TableSelectionControl","composeEventHandlers","CELL_LAYOUT_AVATAR_BOX","CELL_LAYOUT_MEDIA_CLASSES","TableCellLayout","hasMedia","media","hasMain","hasDescription","description","primary","appearance","truncate","tableCellLayoutClassNames","AvatarSizeContext","materialiseSlotContent","CELL_ACTIONS_CLASSES","CELL_ACTIONS_REVEAL_CLASSES","TableCellActions","visible","tableCellActionsClassNames","Table","TableResizeHandle"],"sources":["../../../src/components/table/Table.tsx"],"sourcesContent":["import * as React from 'react';\nimport { flattenChildren, isElementOfType } from '../../lib/children';\nimport { cn } from '../../lib/cn';\nimport {\n tableBodyClassNames,\n tableCellActionsClassNames,\n tableCellClassNames,\n tableCellLayoutClassNames,\n tableClassNames,\n tableHeaderCellClassNames,\n tableHeaderClassNames,\n tableRowClassNames,\n tableSelectionCellClassNames,\n} from '../../lib/classNames';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { isDev, warnDeprecated, warnOnce } from '../../lib/dev';\nimport { materialiseSlotContent, renderSlot, slotRendersContent } from '../../lib/slot';\nimport type { Slot } from '../../lib/slot';\nimport { focusRing } from '../../lib/styles';\nimport { useControllable } from '../../hooks/useControllable';\nimport { useEventCallback } from '../../hooks/useEventCallback';\nimport { useFormReset } from '../../hooks/useFormReset';\nimport { useId } from '../../hooks/useId';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { AvatarSizeContext } from '../data-display/Avatar.context';\nimport type { AvatarSizeContextValue } from '../data-display/Avatar.context';\nimport { TableResizeHandle } from './Table.resize';\nimport type { TableResizeHandleProps } from './Table.resize';\nimport { SELECTION_CELL_CLASSES, TableSelectionControl, TableSortButton } from './Table.shared';\nimport type { SortDirection } from './Table.shared';\n\n/** Properties for the Table component. */\nexport interface TableProps extends React.HTMLAttributes<HTMLTableElement> {\n /**\n * Whether to apply alternating row background colors (odd body rows). The stripe has zero\n * specificity, so a row's own background class (`<Table.Row className=\"bg-selected\">`) and its\n * hover color win over it.\n * @default false\n */\n striped?: boolean;\n /**\n * Props for the wrapper `<div>` around the `<table>`: a horizontally scrollable container\n * (`overflow-x-auto`). Use it for its className, style, ref or `aria-label`. While the table\n * scrolls horizontally, the wrapper is a keyboard-focusable `role=\"region\"` named by\n * `containerProps['aria-label']`/`['aria-labelledby']`, else by the table's `<caption>`. While\n * it does not scroll, the wrapper has no role and its `aria-label`/`aria-labelledby` are left\n * off, unless you also pass a `role` in `containerProps` (then they are always applied).\n */\n containerProps?: Omit<React.ComponentPropsWithRef<'div'>, 'children'>;\n /** Table caption, header, body and row elements. */\n children: React.ReactNode;\n /** Ref to the `<table>` element. */\n ref?: React.Ref<HTMLTableElement>;\n}\n\n/** Properties for the TableHeader sub-component. */\nexport interface TableHeaderProps extends React.HTMLAttributes<HTMLTableSectionElement> {\n /** Table header row elements. */\n children: React.ReactNode;\n /** Ref to the `<thead>` element. */\n ref?: React.Ref<HTMLTableSectionElement>;\n}\n\n/** Properties for the TableHeaderCell sub-component. */\nexport interface TableHeaderCellProps extends React.ThHTMLAttributes<HTMLTableCellElement> {\n /**\n * Makes the column header a sort control: the content is wrapped in a `<button>` that fills the\n * cell, and the cell carries `aria-sort` (`\"none\"` while `sortDirection` is not set). The table\n * does not sort or track the direction; keep it in your state, set `sortDirection` and sort the\n * rows in `onSortClick`. The table keeps no grid semantics.\n * @default false\n */\n sortable?: boolean;\n /**\n * The direction the column is sorted in, shown as `aria-sort` and as the glyph of a sortable\n * header. Absent means the column is not sorted. Without `sortable` it has no effect.\n */\n sortDirection?: SortDirection;\n /**\n * Called with the click event when the sort button is activated (click, Enter or Space).\n * Fluent's `onSortClick`.\n */\n onSortClick?: React.MouseEventHandler<HTMLButtonElement>;\n /**\n * The glyph that shows the direction, only while `sortDirection` is set. It is decorative\n * (`aria-hidden`) and carries `data-direction`. `null` and `undefined` keep the default arrow\n * (up for ascending, down for descending); `false` or anything that renders nothing hides it. A\n * `<button>` or `Button` passed here is not nested: its children become the glyph.\n */\n sortIcon?: Slot<'span'>;\n /**\n * Content beside the header content, outside the sort button (a filter button, an info\n * button), so it is not part of the button's name. Nothing renders for content that renders\n * nothing.\n */\n aside?: Slot<'span'>;\n /** Header cell content. */\n children: React.ReactNode;\n /** Ref to the `<th>` element. */\n ref?: React.Ref<HTMLTableCellElement>;\n}\n\n/** @deprecated Use `TableHeaderProps` (`Table.Header`). */\nexport type TableHeadProps = TableHeaderProps;\n\n/** @deprecated Use `TableHeaderCellProps` (`Table.HeaderCell`). */\nexport type TableHeadCellProps = TableHeaderCellProps;\n\n/** Properties for the TableBody sub-component. */\nexport interface TableBodyProps extends React.HTMLAttributes<HTMLTableSectionElement> {\n /** Table row elements. */\n children: React.ReactNode;\n /** Ref to the `<tbody>` element. */\n ref?: React.Ref<HTMLTableSectionElement>;\n}\n\n/** Properties for the TableRow sub-component. */\nexport interface TableRowProps extends React.HTMLAttributes<HTMLTableRowElement> {\n /** Table cell elements. */\n children: React.ReactNode;\n /** Ref to the `<tr>` element. */\n ref?: React.Ref<HTMLTableRowElement>;\n}\n\n/** Properties for the TableCell sub-component. */\nexport interface TableCellProps extends React.TdHTMLAttributes<HTMLTableCellElement> {\n /** Cell content. */\n children: React.ReactNode;\n /** Ref to the `<td>` element. */\n ref?: React.Ref<HTMLTableCellElement>;\n}\n\n/** Second argument of `Table.SelectionCell`'s `onCheckedChange`: the event behind the change. */\nexport interface TableSelectionCellCheckedChangeDetails {\n /**\n * The DOM event behind the change: the click of the control (Space clicks it too), or, for an\n * uncontrolled radio, the click that checked another radio of its group.\n */\n event: Event;\n}\n\n/**\n * Properties for the TableSelectionCell sub-component. The focus, key and change handlers are the\n * control's (C-ROUTING), so they replace the cell's.\n */\nexport interface TableSelectionCellProps extends Omit<\n React.TdHTMLAttributes<HTMLTableCellElement>,\n 'children' | 'defaultChecked' | 'onChange' | 'onFocus' | 'onBlur' | 'onKeyDown' | 'onKeyUp'\n> {\n /**\n * The control: a checkbox (multiple selection, or a select-all in the header) or a radio (single\n * selection).\n * @default 'checkbox'\n */\n type?: 'checkbox' | 'radio';\n /**\n * Controlled checked state. `'mixed'` draws an indeterminate checkbox (a select-all whose rows\n * are partly selected); a click on it checks it. `'mixed'` is for checkboxes only: on a radio it\n * has no effect (the radio is drawn unchecked).\n */\n checked?: boolean | 'mixed';\n /**\n * Initial checked state for uncontrolled usage, also the state a form reset restores.\n * Uncontrolled radios that share a `name` uncheck each other, as a native radio group does.\n * @default false\n */\n defaultChecked?: boolean | 'mixed';\n /**\n * Called with the new checked state when the user checks or unchecks the control (not for no-op\n * updates), and when a form reset restores a `true` or `false` `defaultChecked`. The second\n * argument holds the event. The table keeps no selection: update your rows' state here.\n */\n onCheckedChange?: (checked: boolean, details?: TableSelectionCellCheckedChangeDetails) => void;\n /**\n * The native change event of the control, called before `onCheckedChange`;\n * `event.preventDefault()` in it cancels the change.\n */\n onChange?: React.ChangeEventHandler<HTMLInputElement>;\n /** Form field name of the control. With a name, the control submits `name=value` while checked. */\n name?: string;\n /**\n * Value the control submits while checked.\n * @default 'on'\n */\n value?: string;\n /** Id of the form the control belongs to, when the table is rendered outside that form. */\n form?: string;\n /** Natively disables the control: it cannot be checked or focused. */\n disabled?: boolean;\n /** The form must not be submitted while the control is unchecked (native validation). */\n required?: boolean;\n /**\n * Draws an unchecked control only while its row (a `Table.Row`) is hovered or holds focus; its\n * own keyboard focus, forced colors and a coarse pointer (touch) always draw it. It stays\n * focusable and named.\n * @default false\n */\n subtle?: boolean;\n /**\n * Hides the control and takes it out of the tab order, while the cell keeps its box (a row that\n * cannot be selected keeps the column aligned).\n * @default false\n */\n invisible?: boolean;\n /** Focus handler of the control. */\n onFocus?: React.FocusEventHandler<HTMLInputElement>;\n /** Blur handler of the control. */\n onBlur?: React.FocusEventHandler<HTMLInputElement>;\n /** Keydown handler of the control. */\n onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;\n /** Keyup handler of the control. */\n onKeyUp?: React.KeyboardEventHandler<HTMLInputElement>;\n /** Ref to the `<input>` element. */\n controlRef?: React.Ref<HTMLInputElement>;\n /** Ref to the `<td>` element. */\n ref?: React.Ref<HTMLTableCellElement>;\n}\n\n/** Properties for the TableCellLayout sub-component. */\nexport interface TableCellLayoutProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * A picture before the text: an icon (drawn at 20px, 24px with the primary appearance) or an\n * Avatar, which takes a 32px box when it sets no `size` of its own. It is content, not hidden\n * from assistive technology: make an Avatar beside the person's name decorative.\n */\n media?: Slot<'span'>;\n /** A second line under the main text, in the caption size and the muted color. */\n description?: Slot<'span'>;\n /**\n * Keeps the main text and the description on one line each, ending in an ellipsis where they do\n * not fit. It takes effect where the column's width is bounded (a width on the column, or a\n * table layout that does not widen columns to fit their content).\n * @default false\n */\n truncate?: boolean;\n /**\n * `'primary'` draws the main text semibold and the media icon larger: the cell that names the\n * row. Rendered as `data-appearance` while set.\n */\n appearance?: 'primary';\n /** The main text. */\n children?: React.ReactNode;\n /** Ref to the layout `<div>`. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/** Properties for the TableCellActions sub-component. */\nexport interface TableCellActionsProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Keeps the actions shown, also while the row is neither hovered nor focused: for example while\n * a menu opened from one of them is open.\n * @default false\n */\n visible?: boolean;\n /** The actions: buttons, a menu button. */\n children?: React.ReactNode;\n /** Ref to the `<div>` that holds the actions. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\nconst noopSubscribe = () => () => {};\n\n/**\n * Whether `wrapper` scrolls horizontally, as an external store: a `ResizeObserver` on the wrapper\n * and the table re-checks `scrollWidth > clientWidth`. Without `ResizeObserver` (server, old\n * browsers, jsdom) the value is read on each render.\n */\nfunction useHorizontalOverflow(wrapper: HTMLDivElement | null): boolean {\n const subscribe = React.useCallback(\n (onChange: () => void) => {\n if (!wrapper || typeof ResizeObserver === 'undefined') return () => {};\n const observer = new ResizeObserver(onChange);\n observer.observe(wrapper);\n for (const child of Array.from(wrapper.children)) observer.observe(child);\n return () => observer.disconnect();\n },\n [wrapper],\n );\n const getSnapshot = React.useCallback(\n () => (wrapper ? wrapper.scrollWidth > wrapper.clientWidth : false),\n [wrapper],\n );\n return React.useSyncExternalStore(wrapper ? subscribe : noopSubscribe, getSnapshot, () => false);\n}\n\nfunction isCaption(node: React.ReactNode): node is React.ReactElement<{ id?: string }> {\n return isElementOfType(node, 'caption');\n}\n\n// The component-level JSDoc sits on the exported `Table` below.\nconst TableRoot = ({\n striped = false,\n containerProps,\n children,\n className,\n ref,\n ...props\n}: TableProps) => {\n const {\n className: containerClassName,\n ref: containerRef,\n 'aria-label': containerLabel,\n 'aria-labelledby': containerLabelledBy,\n ...containerRest\n } = containerProps ?? {};\n\n const [wrapper, setWrapper] = React.useState<HTMLDivElement | null>(null);\n const wrapperRef = useMergedRefs<HTMLDivElement>(containerRef, setWrapper);\n const scrollable = useHorizontalOverflow(wrapper);\n\n // Name the scroll region after the caption (also one inside a Fragment): keep its id, or give it\n // one. The flattened children are then rendered under their flattened keys.\n const generatedCaptionId = useId('wave-table-caption');\n const flatChildren = flattenChildren(children);\n const captionIndex = flatChildren.findIndex(({ node }) => isCaption(node));\n const caption =\n captionIndex >= 0\n ? (flatChildren[captionIndex].node as React.ReactElement<{ id?: string }>)\n : null;\n const captionId = caption ? (caption.props.id ?? generatedCaptionId) : undefined;\n const content =\n caption && caption.props.id === undefined\n ? flatChildren.map(({ key, node }, index) => (\n <React.Fragment key={key}>\n {index === captionIndex\n ? React.cloneElement(caption, { id: generatedCaptionId })\n : node}\n </React.Fragment>\n ))\n : children;\n\n const regionLabelledBy = containerLabel ? undefined : (containerLabelledBy ?? captionId);\n const named = Boolean(containerLabel || regionLabelledBy);\n const isRegion = scrollable && named;\n /** A role the consumer gave the wrapper: their name goes with it even while nothing scrolls. */\n const consumerRole = containerRest.role;\n\n React.useEffect(() => {\n if (scrollable && !named) {\n warnOnce(\n 'Table:unnamed-scroll-region',\n 'Table: the table scrolls horizontally but its scroll region has no name. Add a <caption> or containerProps[\"aria-label\"].',\n );\n }\n }, [scrollable, named]);\n\n return (\n <div\n {...containerRest}\n ref={wrapperRef}\n role={isRegion ? 'region' : consumerRole}\n tabIndex={scrollable ? 0 : containerRest.tabIndex}\n aria-label={scrollable || consumerRole !== undefined ? containerLabel : undefined}\n aria-labelledby={\n isRegion ? regionLabelledBy : consumerRole !== undefined ? containerLabelledBy : undefined\n }\n className={cn(\n tableClassNames.container,\n 'overflow-x-auto rounded-md border border-border',\n scrollable && focusRing,\n containerClassName,\n )}\n >\n <table\n ref={ref}\n data-striped={striped ? '' : undefined}\n className={cn(\n tableClassNames.root,\n 'w-full border-separate border-spacing-0',\n // `:where()` keeps the stripe at specificity 0, so any row class wins (C-CLASS).\n striped && '[:where(&>tbody>tr:nth-child(odd))]:bg-card',\n className,\n )}\n {...props}\n >\n {content}\n </table>\n </div>\n );\n};\nTableRoot.displayName = 'Table';\n\n/** The table's `<thead>`. */\nconst TableHeader = ({ children, className, ref, ...rest }: TableHeaderProps) => (\n <thead ref={ref} {...rest} className={cn(tableHeaderClassNames.root, 'bg-card', className)}>\n {children}\n </thead>\n);\nTableHeader.displayName = 'TableHeader';\n\n/** A column header cell (`<th scope=\"col\">`). */\nconst TableHeaderCell = ({\n sortable = false,\n sortDirection,\n onSortClick,\n sortIcon,\n aside,\n children,\n className,\n ref,\n ...props\n}: TableHeaderCellProps) => {\n const hasAside = slotRendersContent(aside);\n const asideNode = hasAside\n ? renderSlot(\n aside,\n 'span',\n cn(\n tableHeaderCellClassNames.aside,\n 'inline-flex shrink-0 items-center',\n sortable && 'pe-4',\n ),\n )\n : null;\n\n let content: React.ReactNode = children;\n if (sortable) {\n content = (\n <div className=\"flex items-center\">\n <TableSortButton\n component=\"Table.HeaderCell\"\n direction={sortDirection}\n sortIcon={sortIcon}\n className={tableHeaderCellClassNames.button}\n iconClassName={tableHeaderCellClassNames.sortIcon}\n onClick={onSortClick}\n >\n {children}\n </TableSortButton>\n {asideNode}\n </div>\n );\n } else if (hasAside) {\n content = (\n <div className=\"flex items-center gap-2\">\n {children}\n {asideNode}\n </div>\n );\n }\n\n return (\n <th\n ref={ref}\n scope=\"col\"\n aria-sort={sortable ? (sortDirection ?? 'none') : undefined}\n className={cn(\n tableHeaderCellClassNames.root,\n 'px-4 py-3 text-start font-semibold text-caption-1 uppercase tracking-wider border-b border-border',\n sortable && 'p-0 hover:bg-subtle-hover',\n className,\n )}\n {...props}\n >\n {content}\n </th>\n );\n};\nTableHeaderCell.displayName = 'TableHeaderCell';\n\n/** @deprecated Use `Table.Header` (`TableHeader`). */\nconst TableHead = (props: TableHeadProps) => {\n warnDeprecated('Table', 'Table.Head', 'Table.Header');\n return <TableHeader {...props} />;\n};\nTableHead.displayName = 'TableHead';\n\n/** @deprecated Use `Table.HeaderCell` (`TableHeaderCell`). */\nconst TableHeadCell = (props: TableHeadCellProps) => {\n warnDeprecated('Table', 'Table.HeadCell', 'Table.HeaderCell');\n return <TableHeaderCell {...props} />;\n};\nTableHeadCell.displayName = 'TableHeadCell';\n\n/** The table's `<tbody>`. */\nconst TableBody = ({ children, className, ref, ...rest }: TableBodyProps) => (\n <tbody ref={ref} {...rest} className={cn(tableBodyClassNames.root, className)}>\n {children}\n </tbody>\n);\nTableBody.displayName = 'TableBody';\n\n/**\n * A table row. Striping comes from the table (`striped`), so rows need no context. The row is the\n * `group/table-row` group whose hover or focus draws the subtle selection controls and the cell\n * actions inside it (Tree's rows keep their own group).\n */\nconst TableRow = ({ children, className, ref, ...props }: TableRowProps) => (\n <tr\n ref={ref}\n className={cn(\n tableRowClassNames.root,\n 'group/table-row',\n 'hover:bg-subtle-hover transition-colors motion-reduce:transition-none',\n className,\n )}\n {...props}\n >\n {children}\n </tr>\n);\nTableRow.displayName = 'TableRow';\n\n/** A data cell (`<td>`), the positioning box of a `Table.CellActions` inside it. */\nconst TableCell = ({ children, className, ref, ...props }: TableCellProps) => (\n <td\n ref={ref}\n className={cn(\n tableCellClassNames.root,\n 'relative px-4 py-3 text-body-1 border-b border-border',\n className,\n )}\n {...props}\n >\n {children}\n </td>\n);\nTableCell.displayName = 'TableCell';\n\n/**\n * A selection cell: a `<td>` with a native checkbox or radio (`type`), drawn as the DataGrid's.\n * The table keeps no selection, so the cell is usually controlled (`checked`, `onCheckedChange`)\n * from your rows' state; `checked=\"mixed\"` draws a header select-all whose rows are partly\n * selected. `id`, `aria-label`, `aria-labelledby`, `aria-describedby`, the other ARIA state\n * props, `autoFocus`, `tabIndex`, the focus, key and change handlers and `name`, `value`, `form`,\n * `disabled` and `required` go to the control (`controlRef`); `className`, `style`, `data-*`, the\n * other handlers and `ref` stay on the cell, which carries `data-type`. Name the control with\n * `aria-label` or `aria-labelledby` (the row's first cell); a development warning reports a\n * control without a name.\n */\nconst TableSelectionCell = ({\n type = 'checkbox',\n checked: checkedProp,\n defaultChecked = false,\n onCheckedChange,\n onChange,\n name,\n value,\n form,\n disabled,\n required,\n subtle = false,\n invisible = false,\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n 'aria-required': ariaRequired,\n 'aria-errormessage': ariaErrorMessage,\n 'aria-details': ariaDetails,\n autoFocus,\n tabIndex,\n onFocus,\n onBlur,\n onKeyDown,\n onKeyUp,\n controlRef,\n className,\n ref,\n ...rest\n}: TableSelectionCellProps) => {\n // The details of the change being made, set around the setter.\n const detailsRef = React.useRef<TableSelectionCellCheckedChangeDetails | undefined>(undefined);\n const [checked, setChecked, isControlled] = useControllable<boolean | 'mixed'>(\n checkedProp,\n defaultChecked,\n (next) => {\n // Only a form reset to a mixed `defaultChecked` sets `'mixed'`; the callback reports booleans.\n if (next !== 'mixed') onCheckedChange?.(next, detailsRef.current);\n },\n );\n const changeChecked = useEventCallback((next: boolean, event: Event) => {\n detailsRef.current = { event };\n try {\n setChecked(next);\n } finally {\n detailsRef.current = undefined;\n }\n });\n\n const inputRef = React.useRef<HTMLInputElement>(null);\n const mergedControlRef = useMergedRefs<HTMLInputElement>(inputRef, controlRef);\n useFormReset(inputRef, () => setChecked(defaultChecked), form);\n\n // A native radio group unchecks its other radios without an event, so an uncontrolled radio\n // listens for the click that checks another radio of its group: in the capture phase, before\n // React restores its controlled inputs from that click.\n const followsGroup = type === 'radio' && !isControlled && Boolean(name);\n React.useEffect(() => {\n const input = inputRef.current;\n if (!followsGroup || !input) return;\n const root = input.getRootNode();\n const handleClick = (event: Event) => {\n const target = event.target;\n if (target === input || !(target instanceof HTMLInputElement) || target.type !== 'radio') {\n return;\n }\n if (target.name === input.name && target.form === input.form && target.checked) {\n changeChecked(false, event);\n }\n };\n root.addEventListener('click', handleClick, true);\n return () => root.removeEventListener('click', handleClick, true);\n }, [followsGroup, changeChecked]);\n\n // Development diagnostics (C-DEV): a control needs a name; a `<label for>` gives one too.\n React.useEffect(() => {\n const input = inputRef.current;\n if (!isDev || !input || ariaLabel || ariaLabelledBy || (input.labels?.length ?? 0) > 0) return;\n warnOnce(\n 'Table.SelectionCell:name',\n 'Table.SelectionCell: the selection control has no accessible name. Pass `aria-label` ' +\n '(e.g. \"Select Alpha\") or `aria-labelledby` (e.g. the id of the row’s first cell).',\n );\n }, [ariaLabel, ariaLabelledBy, id]);\n\n return (\n <td\n ref={ref}\n data-type={type}\n {...rest}\n className={cn(tableSelectionCellClassNames.root, SELECTION_CELL_CLASSES, className)}\n >\n <TableSelectionControl\n ref={mergedControlRef}\n type={type}\n checked={checked}\n subtle={subtle}\n invisible={invisible}\n id={id}\n name={name}\n value={value}\n form={form}\n disabled={disabled}\n required={required}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n aria-invalid={ariaInvalid}\n aria-required={ariaRequired}\n aria-errormessage={ariaErrorMessage}\n aria-details={ariaDetails}\n autoFocus={autoFocus}\n tabIndex={tabIndex}\n onFocus={onFocus}\n onBlur={onBlur}\n onKeyDown={onKeyDown}\n onKeyUp={onKeyUp}\n onChange={composeEventHandlers(onChange, (event) =>\n changeChecked(event.currentTarget.checked, event.nativeEvent),\n )}\n className={tableSelectionCellClassNames.control}\n />\n </td>\n );\n};\nTableSelectionCell.displayName = 'TableSelectionCell';\n\n/** The box an Avatar in a cell layout's `media` takes when it sets no `size`. */\nconst CELL_LAYOUT_AVATAR_BOX: AvatarSizeContextValue = { size: 32 };\n\n/** The media box: its icon at 20px, or 24px with the primary appearance. */\nconst CELL_LAYOUT_MEDIA_CLASSES = {\n default: 'flex shrink-0 items-center [&>svg]:size-5',\n primary: 'flex shrink-0 items-center [&>svg]:size-6',\n} as const;\n\n/**\n * Lays out a cell's content: `media` (an icon or an Avatar), then the main text (children) with\n * an optional `description` under it. `truncate` keeps both lines to one line each with an\n * ellipsis; `appearance=\"primary\"` draws the main text semibold, for the cell that names the row.\n */\nconst TableCellLayout = ({\n media,\n description,\n truncate = false,\n appearance,\n children,\n className,\n ref,\n ...rest\n}: TableCellLayoutProps) => {\n const hasMedia = slotRendersContent(media);\n const hasMain = slotRendersContent(children);\n const hasDescription = slotRendersContent(description);\n const primary = appearance === 'primary';\n return (\n <div\n ref={ref}\n data-appearance={appearance}\n data-truncate={truncate ? '' : undefined}\n {...rest}\n className={cn(\n tableCellLayoutClassNames.root,\n 'flex items-center gap-2',\n truncate && 'overflow-x-hidden',\n className,\n )}\n >\n {hasMedia && (\n // An Avatar without its own `size` takes the 32px box of a table row.\n <AvatarSizeContext.Provider value={CELL_LAYOUT_AVATAR_BOX}>\n {renderSlot(\n media,\n 'span',\n cn(\n tableCellLayoutClassNames.media,\n CELL_LAYOUT_MEDIA_CLASSES[primary ? 'primary' : 'default'],\n ),\n )}\n </AvatarSizeContext.Provider>\n )}\n {(hasMain || hasDescription) && (\n <div\n className={cn(\n tableCellLayoutClassNames.content,\n 'flex flex-col',\n truncate && 'min-w-0 overflow-x-hidden',\n )}\n >\n {hasMain && (\n <span\n className={cn(\n tableCellLayoutClassNames.main,\n truncate && 'truncate',\n primary && 'font-semibold',\n )}\n >\n {materialiseSlotContent(children)}\n </span>\n )}\n {hasDescription &&\n renderSlot(\n description,\n 'span',\n cn(\n tableCellLayoutClassNames.description,\n 'text-caption-1 text-muted-foreground',\n truncate && 'truncate',\n ),\n )}\n </div>\n )}\n </div>\n );\n};\nTableCellLayout.displayName = 'TableCellLayout';\n\n/**\n * Where cell actions sit, over the end of their cell from its top edge to its bottom edge (the\n * buttons centred between them), and what they draw over the content under them: an opaque\n * background that follows the row's, over the full height of the cell, so wrapped text or a\n * layout with a description never shows above or below the buttons. That is the page background\n * behind a row without a fill, the row's hover color, the stripe of a striped table's odd body\n * rows (as the table's own zero-specificity rule) and the fill of a DataGrid's selected row\n * (brand and neutral appearances).\n */\nconst CELL_ACTIONS_CLASSES =\n 'absolute inset-y-0 end-0 flex items-center gap-1 px-1 bg-background group-hover/table-row:bg-subtle-hover [:where([data-striped]>tbody>tr:nth-child(odd)>*)>&]:bg-card [[data-selection-appearance=brand]>tbody>[data-selected]>*>&]:bg-selected [[data-selection-appearance=neutral]>tbody>[data-selected]>*>&]:bg-subtle-selected transition-[opacity,background-color] motion-reduce:transition-none';\n\n/**\n * Transparent until the row is hovered or holds focus, or focus is in the actions themselves;\n * forced colors and a coarse pointer (touch) always draw them.\n */\nconst CELL_ACTIONS_REVEAL_CLASSES =\n 'opacity-0 group-hover/table-row:opacity-100 group-focus-within/table-row:opacity-100 focus-within:opacity-100 forced-colors:opacity-100 pointer-coarse:opacity-100';\n\n/**\n * Actions of a cell (buttons, a menu button), shown over the end of the cell while its row is\n * hovered or holds focus, and always in forced colors and on a coarse pointer (touch); `visible`\n * keeps them shown. They stay in the tab order while hidden, and Tab into them shows them. Place\n * them in a `Table.Cell` or `DataGrid.Cell`, whose row (`Table.Row`, `DataGrid.Row`) is the group\n * that shows them. Their opaque background follows the row's (hover, a striped table's stripe, a\n * DataGrid's selected row); a row with a background of its own needs the same class on its\n * actions. The element carries `data-visible` while `visible` is set.\n */\nconst TableCellActions = ({ visible = false, className, ref, ...rest }: TableCellActionsProps) => (\n <div\n ref={ref}\n data-visible={visible ? '' : undefined}\n {...rest}\n className={cn(\n tableCellActionsClassNames.root,\n CELL_ACTIONS_CLASSES,\n visible ? undefined : CELL_ACTIONS_REVEAL_CLASSES,\n className,\n )}\n />\n);\nTableCellActions.displayName = 'TableCellActions';\n\nexport {\n TableHeader,\n TableHeaderCell,\n TableHead,\n TableHeadCell,\n TableBody,\n TableRow,\n TableCell,\n TableSelectionCell,\n TableCellLayout,\n TableCellActions,\n TableResizeHandle,\n};\nexport type { TableResizeHandleProps };\n\n/**\n * A non-interactive data table with an optional striped body. The table sits in a horizontally\n * scrollable wrapper; while it scrolls, the wrapper is a focusable region (named by\n * `containerProps` or the `<caption>`) so keyboard users can scroll it.\n *\n * The table keeps no state: a sortable `Table.HeaderCell` reports its clicks, and a\n * `Table.SelectionCell` (a native checkbox or radio) its changes, for your state to sort and\n * select the rows. `Table.CellLayout` lays out a cell's media, text and description, and\n * `Table.CellActions` shows a cell's actions while its row is hovered or holds focus.\n *\n * Sub-components are available as `Table.Header`, `Table.HeaderCell`, `Table.Body`, `Table.Row`,\n * `Table.Cell`, `Table.SelectionCell`, `Table.CellLayout`, `Table.CellActions` and\n * `Table.ResizeHandle` (the separator that resizes a column, for a header cell's `aside`) in client\n * components, and as the flat exports `TableHeader`, `TableHeaderCell`, `TableBody`, `TableRow`,\n * `TableCell`, `TableSelectionCell`, `TableCellLayout`, `TableCellActions` and\n * `TableResizeHandle` (the form React Server Components can import). `Table.Head`/`Table.HeadCell`\n * (`TableHead`/`TableHeadCell`) are deprecated aliases.\n */\nexport const Table = /* @__PURE__ */ Object.assign(TableRoot, {\n Header: TableHeader,\n HeaderCell: TableHeaderCell,\n /** @deprecated Use `Table.Header`. */\n Head: TableHead,\n /** @deprecated Use `Table.HeaderCell`. */\n HeadCell: TableHeadCell,\n Body: TableBody,\n Row: TableRow,\n Cell: TableCell,\n SelectionCell: TableSelectionCell,\n CellLayout: TableCellLayout,\n CellActions: TableCellActions,\n ResizeHandle: TableResizeHandle,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAoQA,IAAMG,gBAA4B,CAAC;AAOnC,SAASC,EAAsB,GAAyC;CACtE,IAAMC,IAAYH,EAAM,aACrB,MAAyB;EACxB,IAAI,CAACI,KAAW,OAAO,iBAAmB,KAAa,aAAa,CAAC;EACrE,IAAMC,IAAW,IAAI,eAAeC,CAAQ;EAC5C,EAAS,QAAQF,CAAO;EACxB,KAAK,IAAMG,KAAS,MAAM,KAAKH,EAAQ,QAAQ,GAAG,EAAS,QAAQG,CAAK;EACxE,aAAaF,EAAS,WAAW;CACnC,GACA,CAACD,CAAO,CACV,GACMI,IAAcR,EAAM,kBACjBI,IAAUA,EAAQ,cAAcA,EAAQ,cAAc,IAC7D,CAACA,CAAO,CACV;CACA,OAAOJ,EAAM,qBAAqBI,IAAUD,IAAYF,GAAeO,SAAmB,EAAK;AACjG;AAEA,SAASC,EAAU,GAAoE;CACrF,OAAOC,EAAgBC,GAAM,SAAS;AACxC;AAGA,IAAMC,KAAa,EACjB,aAAU,IACV,mBACA,aACA,cACA,QACA,GAAGC,QACa;CAChB,IAAM,EACJ,WAAWC,GACX,KAAKC,GACL,cAAcC,GACd,mBAAmBC,GACnB,GAAGC,MACDC,KAAkB,CAAC,GAEjB,CAACf,GAASgB,KAAcpB,EAAM,SAAgC,IAAI,GAClEqB,IAAaC,EAA8BP,GAAcK,CAAU,GACnEG,IAAarB,EAAsBE,CAAO,GAI1CoB,IAAqB1B,EAAM,oBAAoB,GAC/C2B,IAAeC,EAAgBC,CAAQ,GACvCC,IAAeH,EAAa,WAAW,EAAE,cAAWhB,EAAUE,CAAI,CAAC,GACnEkB,IACJD,KAAgB,IACXH,EAAaG,EAAa,CAAC,OAC5B,MACAE,IAAYD,IAAWA,EAAQ,MAAM,MAAML,IAAsB,KAAA,GACjEO,IAC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E,CACF;EAVF,UAAA,CAYGgE,KAEC,kBAACS,EAAkB,UAAnB;GAA4B,OAAOZ;GAChC,UAAApD,EACCwD,GACA,QACApE,EACE2E,EAA0B,OAC1BV,EAA0BO,IAAU,YAAY,UAClD,CACF;EAC0B,CAAA,IAE5BH,KAAWC,MACX,kBAAC,OAAD;GACE,WAAWtE,EACT2E,EAA0B,SAC1B,iBACAD,KAAY,2BACd;GALF,UAAA,CAOGL,KACC,kBAAC,QAAD;IACE,WAAWrE,EACT2E,EAA0B,MAC1BD,KAAY,YACZF,KAAW,eACb;IAEC,UAAAK,EAAuBzF,CAAQ;GAC5B,CAAA,GAEPkF,KACC1D,EACE2D,GACA,QACAvE,EACE2E,EAA0B,aAC1B,wCACAD,KAAY,UACd,CACF,CACC;EAEJ,CAAA,CAAA;;AAET;AACA,EAAgB,cAAc;AAW9B,IAAMI,IACJ,2YAMIC,IACJ,sKAWIC,KAAoB,EAAE,aAAU,IAAO,cAAW,QAAK,GAAG3E,QAC9D,kBAAC,OAAD;CACO;CACL,gBAAc4E,IAAU,KAAK,KAAA;CAC7B,GAAI5E;CACJ,WAAWL,EACTkF,EAA2B,MAC3BJ,GACAG,IAAU,KAAA,IAAYF,GACtB5E,CACF;AACD,CAAA;AAEH,EAAiB,cAAc;AAmC/B,IAAagF,IAAwB,uBAAO,OAAO9G,GAAW;CAC5D,QAAQ+B;CACR,YAAYG;CAEZ,MAAMW;CAEN,UAAUE;CACV,MAAMC;CACN,KAAKE;CACL,MAAME;CACN,eAAeE;CACf,YAAYuC;CACZ,aAAac;CACb,cAAcI;AAChB,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/composeEventHandlers.cjs"),r=require("../../lib/classNames.cjs"),i=require("../../hooks/useEventCallback.cjs"),a=require("../../lib/direction.cjs"),o=require("../../lib/styles.cjs");let s=require("react");s=e.__toESM(s,1);let c=require("react/jsx-runtime");var l=20,u=5,d=({width:e,minWidth:d=0,maxWidth:f,onResize:p,onReset:m,onLeave:h,label:g=`Resize column`,valueText:_,onPointerDown:v,onPointerMove:y,onPointerUp:b,onPointerCancel:x,onLostPointerCapture:S,onDoubleClick:C,onKeyDown:w,onKeyUp:T,onBlur:E,className:D,ref:O,...k})=>{let A=s.useRef(null),[j,M]=s.useState(!1),N=s.useRef(null),P=e=>Math.max(d,Math.min(f??1/0,e)),F=i.useEventCallback(()=>{let e=A.current;if(!e?.latestEvent)return;let t=P(Math.round(e.startWidth+(e.latestX-e.startX)*e.sign));t!==e.lastWidth&&(e.lastWidth=t,p(t,{event:e.latestEvent}))}),I=e=>{let t=A.current;t&&(t.frame!==null&&window.cancelAnimationFrame(t.frame),t.frame=null,e&&F(),A.current=null,M(!1))},L=i.useEventCallback(()=>I(!1));s.useLayoutEffect(()=>L,[L]);let R=i.useEventCallback(t=>{t.button===0&&t.isPrimary&&!A.current&&(t.currentTarget.setPointerCapture(t.pointerId),A.current={pointerId:t.pointerId,startX:t.clientX,startWidth:e,sign:a.getDirection(t.currentTarget)===`rtl`?-1:1,latestX:t.clientX,latestEvent:null,lastWidth:e,frame:null},M(!0))}),z=i.useEventCallback(e=>{let t=A.current;t&&e.pointerId===t.pointerId&&(t.latestX=e.clientX,t.latestEvent=e.nativeEvent,t.frame===null&&(t.frame=window.requestAnimationFrame(()=>{t.frame=null,F()})))}),B=i.useEventCallback(e=>{e.pointerId===A.current?.pointerId&&(e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),I(!0))}),V=i.useEventCallback(e=>{e.pointerId===A.current?.pointerId&&I(!1)}),H=i.useEventCallback(e=>{e.pointerId===A.current?.pointerId&&I(!1)}),U=n.composeEventHandlers(C,e=>{m?.({event:e.nativeEvent})}),W=i.useEventCallback(t=>{if(t.target!==t.currentTarget||t.ctrlKey||t.altKey||t.metaKey)return;let n=n=>{n!==e&&p(n,{event:t.nativeEvent})},r=a.getArrowIntent(t.key,{orientation:`horizontal`,dir:a.getDirection(t.currentTarget)});if(r){let i=t.shiftKey?u:l;n(P(Math.round(e+(r===`next`?i:-i))))}else if(t.key===`Home`)n(P(d));else if(t.key===`End`&&f!==void 0)n(P(f));else if(h&&t.key===`Escape`)h();else if(h&&(t.key===`Enter`||t.key===` `))t.repeat||(N.current=t.key);else return;t.preventDefault(),t.stopPropagation()}),G=i.useEventCallback(e=>{let t=N.current!==null&&e.key===N.current;t&&(N.current=null),t&&!e.defaultPrevented&&e.target===e.currentTarget&&(e.preventDefault(),e.stopPropagation(),h?.())}),K=i.useEventCallback(()=>{N.current=null});return(0,c.jsx)(`div`,{ref:O,tabIndex:0,"aria-label":g,"data-dragging":j?``:void 0,...k,role:`separator`,"aria-orientation":`vertical`,"aria-valuenow":e,"aria-valuemin":d,"aria-valuemax":f,"aria-valuetext":_?_(e):`${Math.round(e)} pixels`,"data-grid-auxiliary":``,className:t.cn(r.tableResizeHandleClassNames.root,`absolute inset-y-0 end-0 z-1 w-2 cursor-col-resize touch-none select-none border-e-2 border-transparent`,`hover:border-stroke-accessible focus-visible:border-primary data-[dragging]:border-primary`,`forced-colors:forced-color-adjust-none forced-colors:hover:border-[ButtonText] forced-colors:focus-visible:border-[Highlight] forced-colors:data-[dragging]:border-[Highlight]`,o.focusRing,D),onPointerDown:n.composeEventHandlers(v,R),onPointerMove:n.composeEventHandlers(y,z),onPointerUp:n.composeEventHandlers(b,B,{checkDefaultPrevented:!1}),onPointerCancel:n.composeEventHandlers(x,V,{checkDefaultPrevented:!1}),onLostPointerCapture:n.composeEventHandlers(S,H,{checkDefaultPrevented:!1}),onDoubleClick:U,onKeyDown:n.composeEventHandlers(w,W),onKeyUp:n.composeEventHandlers(T,G,{checkDefaultPrevented:!1}),onBlur:n.composeEventHandlers(E,K,{checkDefaultPrevented:!1})})};d.displayName=`TableResizeHandle`,exports.TableResizeHandle=d;
2
+ //# sourceMappingURL=Table.resize.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Table.resize.cjs","names":["React","useEventCallback","getDirection","composeEventHandlers","getArrowIntent","cn","tableResizeHandleClassNames","focusRing","require_runtime","require_cn","require_composeEventHandlers","require_classNames","require_useEventCallback","require_direction","require_styles","react","react_jsx_runtime","KEY_STEP","SHIFT_KEY_STEP","TableResizeHandle","rest","dragRef","dragging","setDragging","leaveKeyRef","clamp","minWidth","maxWidth","value","applyDrag","drag","next","onResize","endDrag","flush","cancelDragOnUnmount","startDrag","event","width","moveDrag","releaseDrag","cancelDrag","loseCapture","handleDoubleClick","onDoubleClick","onReset","handleKey","resizeTo","intent","step","onLeave","leaveOnRelease","pressed","forgetPressedKey","label","valueText","className","onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onLostPointerCapture","onKeyDown","onKeyUp","onBlur"],"sources":["../../../src/components/table/Table.resize.tsx"],"sourcesContent":["import * as React from 'react';\nimport { tableResizeHandleClassNames } from '../../lib/classNames';\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { getArrowIntent, getDirection } from '../../lib/direction';\nimport { focusRing } from '../../lib/styles';\nimport { useEventCallback } from '../../hooks/useEventCallback';\n\n/** How far an arrow key moves the edge, in pixels, and how far with Shift held. */\nconst KEY_STEP = 20;\nconst SHIFT_KEY_STEP = 5;\n\n/** Properties for the TableResizeHandle sub-component. */\nexport interface TableResizeHandleProps extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'onResize' | 'onReset'\n> {\n /** The column's current width in pixels. It is reported as `aria-valuenow`. */\n width: number;\n /**\n * The narrowest the column can be, in pixels. The handle never asks for less, and Home sets it.\n * It is reported as `aria-valuemin`.\n * @default 0\n */\n minWidth?: number;\n /**\n * The widest the column can be, in pixels. The handle never asks for more, and End sets it.\n * Without a maximum there is no `aria-valuemax` and End does nothing.\n */\n maxWidth?: number;\n /**\n * Called with the width the user asks for, in whole pixels, held between `minWidth` and\n * `maxWidth`: while a pointer drags (at most once per animation frame) and for every handled\n * key, then `details` with the event behind it. The handle always passes `details`; it is typed\n * optional through 0.x, as every `details` argument. The handle keeps no width of its own, so a\n * parent that ignores the call leaves the column where it is.\n */\n onResize: (width: number, details?: { event: Event }) => void;\n /** Called with the event when the handle is double-clicked: reset the column's width. */\n onReset?: (details: { event: Event }) => void;\n /**\n * Called when Escape is pressed on the handle, or Enter or Space is released on it after being\n * pressed there: move focus back to the header cell. Enter and Space are consumed from their\n * keydown on (their repeats included), so a held key never reaches the element that focus moves\n * to. Without it those keys are left to the handle's ancestors.\n */\n onLeave?: () => void;\n /**\n * The accessible name of the separator.\n * @default 'Resize column'\n */\n label?: string;\n /**\n * Builds `aria-valuetext` from the width.\n * @default (width) => `${width} pixels`\n */\n valueText?: (width: number) => string;\n /** Ref to the `<div>` element. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/** What a pointer drag keeps between its events. */\ninterface DragState {\n pointerId: number;\n startX: number;\n startWidth: number;\n /** `1`, or `-1` in a right-to-left table, where moving toward the end narrows the column. */\n sign: 1 | -1;\n latestX: number;\n latestEvent: Event | null;\n /** The last width handed to `onResize`, so a width is not reported twice in a row. */\n lastWidth: number;\n /** The animation frame that will apply the latest position, while one is waiting. */\n frame: number | null;\n}\n\n/**\n * The drag handle of a column's edge: a vertical `role=\"separator\"` with `aria-valuenow`, meant\n * for the `aside` slot of a `Table.HeaderCell` whose cell is positioned, since the handle is drawn\n * along the cell's end edge. A DataGrid with `resizableColumns` renders it in the header cell of\n * each of its columns itself (a `DataGrid.HeaderCell` has no `aside` slot). A pointer drag (mouse,\n * touch or pen) resizes through `onResize`, with the movement mirrored in right-to-left tables;\n * the arrow keys move the edge by 20 pixels (5 with Shift), Home sets the minimum width and End\n * the maximum one. A double click calls `onReset`. The handle is a Tab stop (`tabIndex` 0), so the\n * keys work in a static table; a grid that manages its own tab stops overrides `tabIndex`. The\n * handle carries `data-grid-auxiliary`, so a grid's cell navigation does not take it for the\n * cell's own widget.\n *\n * It keeps no width: spread the result of `useTableColumnSizing`'s `getResizeHandleProps(columnId)`\n * onto it, or pass `width`, `minWidth` and `onResize` from your own state.\n */\nconst TableResizeHandle = ({\n width,\n minWidth = 0,\n maxWidth,\n onResize,\n onReset,\n onLeave,\n label = 'Resize column',\n valueText,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n onPointerCancel,\n onLostPointerCapture,\n onDoubleClick,\n onKeyDown,\n onKeyUp,\n onBlur,\n className,\n ref,\n ...rest\n}: TableResizeHandleProps) => {\n const dragRef = React.useRef<DragState | null>(null);\n const [dragging, setDragging] = React.useState(false);\n /** The Enter or Space pressed on the handle whose release leaves it; `null` otherwise. */\n const leaveKeyRef = React.useRef<string | null>(null);\n\n const clamp = (value: number) => Math.max(minWidth, Math.min(maxWidth ?? Infinity, value));\n\n // Applies the latest pointer position of the drag. It reads the latest props, also when an\n // animation frame calls it after a render.\n const applyDrag = useEventCallback(() => {\n const drag = dragRef.current;\n if (!drag?.latestEvent) return;\n const next = clamp(Math.round(drag.startWidth + (drag.latestX - drag.startX) * drag.sign));\n if (next === drag.lastWidth) return;\n drag.lastWidth = next;\n onResize(next, { event: drag.latestEvent });\n });\n\n // Ends the drag; `flush` first applies a move that still waits for its frame.\n const endDrag = (flush: boolean) => {\n const drag = dragRef.current;\n if (!drag) return;\n if (drag.frame !== null) window.cancelAnimationFrame(drag.frame);\n drag.frame = null;\n if (flush) applyDrag();\n dragRef.current = null;\n setDragging(false);\n };\n\n // A frame that is still waiting when the handle unmounts must not call `onResize`: cancelled in\n // the commit that removes the handle, before a frame can run.\n const cancelDragOnUnmount = useEventCallback(() => endDrag(false));\n React.useLayoutEffect(() => cancelDragOnUnmount, [cancelDragOnUnmount]);\n\n const startDrag = useEventCallback((event: React.PointerEvent<HTMLDivElement>) => {\n if (event.button !== 0 || !event.isPrimary || dragRef.current) return;\n event.currentTarget.setPointerCapture(event.pointerId);\n dragRef.current = {\n pointerId: event.pointerId,\n startX: event.clientX,\n startWidth: width,\n sign: getDirection(event.currentTarget) === 'rtl' ? -1 : 1,\n latestX: event.clientX,\n latestEvent: null,\n lastWidth: width,\n frame: null,\n };\n setDragging(true);\n });\n\n const moveDrag = useEventCallback((event: React.PointerEvent<HTMLDivElement>) => {\n const drag = dragRef.current;\n if (!drag || event.pointerId !== drag.pointerId) return;\n drag.latestX = event.clientX;\n drag.latestEvent = event.nativeEvent;\n // One call per frame, with the last position.\n if (drag.frame === null) {\n drag.frame = window.requestAnimationFrame(() => {\n drag.frame = null;\n applyDrag();\n });\n }\n });\n\n const releaseDrag = useEventCallback((event: React.PointerEvent<HTMLDivElement>) => {\n if (event.pointerId !== dragRef.current?.pointerId) return;\n if (event.currentTarget.hasPointerCapture(event.pointerId)) {\n event.currentTarget.releasePointerCapture(event.pointerId);\n }\n endDrag(true);\n });\n\n const cancelDrag = useEventCallback((event: React.PointerEvent<HTMLDivElement>) => {\n if (event.pointerId === dragRef.current?.pointerId) endDrag(false);\n });\n\n const loseCapture = useEventCallback((event: React.PointerEvent<HTMLDivElement>) => {\n if (event.pointerId === dragRef.current?.pointerId) endDrag(false);\n });\n\n const handleDoubleClick = composeEventHandlers(\n onDoubleClick,\n (event: React.MouseEvent<HTMLDivElement>) => {\n onReset?.({ event: event.nativeEvent });\n },\n );\n\n const handleKey = useEventCallback((event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.target !== event.currentTarget || event.ctrlKey || event.altKey || event.metaKey) {\n return;\n }\n const resizeTo = (next: number) => {\n if (next !== width) onResize(next, { event: event.nativeEvent });\n };\n const intent = getArrowIntent(event.key, {\n orientation: 'horizontal',\n dir: getDirection(event.currentTarget),\n });\n if (intent) {\n const step = event.shiftKey ? SHIFT_KEY_STEP : KEY_STEP;\n resizeTo(clamp(Math.round(width + (intent === 'next' ? step : -step))));\n } else if (event.key === 'Home') {\n resizeTo(clamp(minWidth));\n } else if (event.key === 'End' && maxWidth !== undefined) {\n resizeTo(clamp(maxWidth));\n } else if (onLeave && event.key === 'Escape') {\n onLeave();\n } else if (onLeave && (event.key === 'Enter' || event.key === ' ')) {\n // Left on the release: focus moved now would hand the key's repeats (and Space's keyup,\n // which activates a button) to the element focus moves to. A repeat alone, of a key\n // pressed before focus came here, leaves nothing to release.\n if (!event.repeat) leaveKeyRef.current = event.key;\n } else {\n return;\n }\n // A handled key does not also move the grid.\n event.preventDefault();\n event.stopPropagation();\n });\n\n // Composed without the default-prevented check: the pressed key is forgotten at its release,\n // also when a consumer handled the release (then nothing else happens).\n const leaveOnRelease = useEventCallback((event: React.KeyboardEvent<HTMLDivElement>) => {\n const pressed = leaveKeyRef.current !== null && event.key === leaveKeyRef.current;\n if (pressed) leaveKeyRef.current = null;\n if (!pressed || event.defaultPrevented || event.target !== event.currentTarget) return;\n event.preventDefault();\n event.stopPropagation();\n onLeave?.();\n });\n\n // A pressed Enter or Space is forgotten when focus leaves the handle before its release.\n const forgetPressedKey = useEventCallback(() => {\n leaveKeyRef.current = null;\n });\n\n return (\n <div\n ref={ref}\n tabIndex={0}\n aria-label={label}\n data-dragging={dragging ? '' : undefined}\n {...rest}\n role=\"separator\"\n aria-orientation=\"vertical\"\n aria-valuenow={width}\n aria-valuemin={minWidth}\n aria-valuemax={maxWidth}\n aria-valuetext={valueText ? valueText(width) : `${Math.round(width)} pixels`}\n data-grid-auxiliary=\"\"\n className={cn(\n tableResizeHandleClassNames.root,\n 'absolute inset-y-0 end-0 z-1 w-2 cursor-col-resize touch-none select-none border-e-2 border-transparent',\n 'hover:border-stroke-accessible focus-visible:border-primary data-[dragging]:border-primary',\n // The line is a border, so forced colors paint it only where it shows.\n 'forced-colors:forced-color-adjust-none forced-colors:hover:border-[ButtonText] forced-colors:focus-visible:border-[Highlight] forced-colors:data-[dragging]:border-[Highlight]',\n focusRing,\n className,\n )}\n onPointerDown={composeEventHandlers(onPointerDown, startDrag)}\n onPointerMove={composeEventHandlers(onPointerMove, moveDrag)}\n onPointerUp={composeEventHandlers(onPointerUp, releaseDrag, { checkDefaultPrevented: false })}\n onPointerCancel={composeEventHandlers(onPointerCancel, cancelDrag, {\n checkDefaultPrevented: false,\n })}\n onLostPointerCapture={composeEventHandlers(onLostPointerCapture, loseCapture, {\n checkDefaultPrevented: false,\n })}\n onDoubleClick={handleDoubleClick}\n onKeyDown={composeEventHandlers(onKeyDown, handleKey)}\n onKeyUp={composeEventHandlers(onKeyUp, leaveOnRelease, { checkDefaultPrevented: false })}\n onBlur={composeEventHandlers(onBlur, forgetPressedKey, { checkDefaultPrevented: false })}\n />\n );\n};\nTableResizeHandle.displayName = 'TableResizeHandle';\n\nexport { TableResizeHandle };\n"],"mappings":"yXASA,IAAMiB,EAAW,GACXC,EAAiB,EAiFjBC,GAAqB,CACzB,QACA,WAAW,EACX,WACA,WACA,UACA,UACA,QAAQ,gBACR,YACA,gBACA,gBACA,cACA,kBACA,uBACA,gBACA,YACA,UACA,SACA,YACA,MACA,GAAGC,KACyB,CAC5B,IAAMC,EAAUrB,EAAM,OAAyB,IAAI,EAC7C,CAACsB,EAAUC,GAAevB,EAAM,SAAS,EAAK,EAE9CwB,EAAcxB,EAAM,OAAsB,IAAI,EAE9CyB,EAAS,GAAkB,KAAK,IAAIC,EAAU,KAAK,IAAIC,GAAY,IAAUC,CAAK,CAAC,EAInFC,EAAY5B,EAAAA,qBAAuB,CACvC,IAAM6B,EAAOT,EAAQ,QACrB,GAAI,CAACS,GAAM,YAAa,OACxB,IAAMC,EAAON,EAAM,KAAK,MAAMK,EAAK,YAAcA,EAAK,QAAUA,EAAK,QAAUA,EAAK,IAAI,CAAC,EACrFC,IAASD,EAAK,YAClB,EAAK,UAAYC,EACjBC,EAASD,EAAM,CAAE,MAAOD,EAAK,WAAY,CAAC,EAC5C,CAAC,EAGKG,EAAW,GAAmB,CAClC,IAAMH,EAAOT,EAAQ,QAChBS,IACDA,EAAK,QAAU,MAAM,OAAO,qBAAqBA,EAAK,KAAK,EAC/D,EAAK,MAAQ,KACTI,GAAOL,EAAU,EACrB,EAAQ,QAAU,KAClBN,EAAY,EAAK,EACnB,EAIMY,EAAsBlC,E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