@cube-dev/ui-kit 0.0.0-canary-d4796d7 → 0.0.0-canary-759f43d

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 (602) hide show
  1. package/dist/_internal/hooks/use-debounced-value.js +1 -1
  2. package/dist/_internal/hooks/use-deprecation-warning.js +1 -1
  3. package/dist/_internal/hooks/use-event.js +1 -1
  4. package/dist/_internal/hooks/use-is-first-render.js +1 -1
  5. package/dist/_internal/hooks/use-sync-ref.js +1 -1
  6. package/dist/_internal/hooks/use-timer/timer.js +1 -1
  7. package/dist/_internal/hooks/use-timer/use-timer.js +1 -1
  8. package/dist/_internal/hooks/use-warn.js +1 -1
  9. package/dist/components/Block.js +1 -1
  10. package/dist/components/CollectionItem.js +1 -1
  11. package/dist/components/GlobalStyles.js +1 -1
  12. package/dist/components/GridProvider.js +1 -1
  13. package/dist/components/HiddenInput.js +1 -1
  14. package/dist/components/Root.js +1 -1
  15. package/dist/components/actions/Action/Action.js +1 -1
  16. package/dist/components/actions/Banner/Banner.js +1 -1
  17. package/dist/components/actions/Button/Button.js +1 -1
  18. package/dist/components/actions/ButtonGroup/ButtonGroup.js +1 -1
  19. package/dist/components/actions/ButtonSplit/ButtonSplit.js +1 -1
  20. package/dist/components/actions/ButtonSplit/context.js +1 -1
  21. package/dist/components/actions/CommandMenu/CommandMenu.js +1 -1
  22. package/dist/components/actions/CommandMenu/styled.js +1 -1
  23. package/dist/components/actions/ItemAction/ItemAction.js +1 -1
  24. package/dist/components/actions/ItemActionContext.js +1 -1
  25. package/dist/components/actions/ItemActionsWrapper.js +1 -1
  26. package/dist/components/actions/ItemButton/ItemButton.js +1 -1
  27. package/dist/components/actions/Link/Link.js +1 -1
  28. package/dist/components/actions/Menu/Menu.js +1 -1
  29. package/dist/components/actions/Menu/MenuCollectionItem.js +1 -1
  30. package/dist/components/actions/Menu/MenuItem.js +1 -1
  31. package/dist/components/actions/Menu/MenuSection.js +1 -1
  32. package/dist/components/actions/Menu/MenuTrigger.js +1 -1
  33. package/dist/components/actions/Menu/SubMenuTrigger.js +1 -1
  34. package/dist/components/actions/Menu/SubmenuTriggerContext.js +1 -1
  35. package/dist/components/actions/Menu/context.js +1 -1
  36. package/dist/components/actions/Menu/styled.js +1 -1
  37. package/dist/components/actions/actions-run.js +1 -1
  38. package/dist/components/actions/index.js +1 -1
  39. package/dist/components/actions/use-action.js +1 -1
  40. package/dist/components/actions/use-anchored-menu.js +1 -1
  41. package/dist/components/actions/use-context-menu.js +1 -1
  42. package/dist/components/content/ActiveZone/ActiveZone.js +1 -1
  43. package/dist/components/content/Alert/Alert.js +1 -1
  44. package/dist/components/content/Alert/use-alert.js +1 -1
  45. package/dist/components/content/Avatar/Avatar.js +1 -1
  46. package/dist/components/content/Badge/Badge.js +1 -1
  47. package/dist/components/content/Card/Card.js +1 -1
  48. package/dist/components/content/Content.js +1 -1
  49. package/dist/components/content/CopyPasteBlock/CopyPasteBlock.js +1 -1
  50. package/dist/components/content/CopySnippet/CopySnippet.d.ts +30 -30
  51. package/dist/components/content/CopySnippet/CopySnippet.js +1 -1
  52. package/dist/components/content/Disclosure/Disclosure.js +1 -1
  53. package/dist/components/content/Divider.js +1 -1
  54. package/dist/components/content/Footer.js +1 -1
  55. package/dist/components/content/Header.js +1 -1
  56. package/dist/components/content/HotKeys/HotKeys.js +1 -1
  57. package/dist/components/content/InfoBadge/InfoBadge.js +1 -1
  58. package/dist/components/content/InlineInput/InlineInput.js +1 -1
  59. package/dist/components/content/Item/Item.js +1 -1
  60. package/dist/components/content/Item/ItemWithNativeLinks.js +1 -1
  61. package/dist/components/content/ItemBadge/ItemBadge.js +1 -1
  62. package/dist/components/content/ItemCard/ItemCard.js +1 -1
  63. package/dist/components/content/Layout/GridLayout.js +1 -1
  64. package/dist/components/content/Layout/Layout.js +1 -1
  65. package/dist/components/content/Layout/LayoutBlock.js +1 -1
  66. package/dist/components/content/Layout/LayoutCenter.js +1 -1
  67. package/dist/components/content/Layout/LayoutContainer.js +1 -1
  68. package/dist/components/content/Layout/LayoutContent.js +1 -1
  69. package/dist/components/content/Layout/LayoutContext.js +1 -1
  70. package/dist/components/content/Layout/LayoutFlex.js +1 -1
  71. package/dist/components/content/Layout/LayoutFooter.js +1 -1
  72. package/dist/components/content/Layout/LayoutGrid.js +1 -1
  73. package/dist/components/content/Layout/LayoutHeader.js +1 -1
  74. package/dist/components/content/Layout/LayoutPane.js +1 -1
  75. package/dist/components/content/Layout/LayoutPanel.js +1 -1
  76. package/dist/components/content/Layout/LayoutPanelHeader.js +1 -1
  77. package/dist/components/content/Layout/LayoutPanelTransition.js +1 -1
  78. package/dist/components/content/Layout/LayoutToolbar.js +1 -1
  79. package/dist/components/content/Layout/hooks/useTinyScrollbar.js +1 -1
  80. package/dist/components/content/Layout/index.js +1 -1
  81. package/dist/components/content/Layout/utils.js +1 -1
  82. package/dist/components/content/Paragraph.js +1 -1
  83. package/dist/components/content/Placeholder/Placeholder.js +1 -1
  84. package/dist/components/content/PrismCode/PrismCode.js +1 -1
  85. package/dist/components/content/PrismCode/prismSetup.js +1 -1
  86. package/dist/components/content/PrismDiffCode/PrismDiffCode.js +1 -1
  87. package/dist/components/content/Result/Result.js +1 -1
  88. package/dist/components/content/Skeleton/Skeleton.js +1 -1
  89. package/dist/components/content/Tag/Tag.js +1 -1
  90. package/dist/components/content/Text.d.ts +28 -28
  91. package/dist/components/content/Text.js +1 -1
  92. package/dist/components/content/TextItem/TextItem.js +1 -1
  93. package/dist/components/content/Title.js +1 -1
  94. package/dist/components/content/Tree/Tree.js +1 -1
  95. package/dist/components/content/Tree/TreeNode.js +1 -2
  96. package/dist/components/content/Tree/TreeNode.js.map +1 -1
  97. package/dist/components/content/Tree/styled.js +1 -1
  98. package/dist/components/content/Tree/tree-index.js +1 -1
  99. package/dist/components/content/Tree/use-checkbox-tree.js +1 -1
  100. package/dist/components/content/Tree/use-load-data.js +1 -1
  101. package/dist/components/content/highlightText.js +1 -1
  102. package/dist/components/content/use-auto-tooltip.js +1 -1
  103. package/dist/components/data/DataTable/DataTable.js +1 -1
  104. package/dist/components/data/ItemTable/ItemTable.js +1 -1
  105. package/dist/components/data/ItemTable/ItemTableBulkBar.js +1 -1
  106. package/dist/components/data/ItemTable/ItemTableDragPreview.js +1 -1
  107. package/dist/components/data/ItemTable/ItemTableFooter.js +1 -1
  108. package/dist/components/data/ItemTable/ItemTableToolbar.js +1 -2
  109. package/dist/components/data/ItemTable/ItemTableToolbar.js.map +1 -1
  110. package/dist/components/data/ItemTable/use-item-table-column-widths.js +1 -1
  111. package/dist/components/data/ItemTable/use-item-table-drag-drop.js +1 -1
  112. package/dist/components/data/ItemTable/use-item-table-pagination.js +1 -1
  113. package/dist/components/data/ItemTable/use-item-table-selection.js +1 -1
  114. package/dist/components/data/ItemTable/use-item-table-sort.js +1 -1
  115. package/dist/components/data/ItemTable/use-item-table-tree-model.js +1 -1
  116. package/dist/components/data/TableBase/ColumnResizer.js +1 -1
  117. package/dist/components/data/TableBase/RowCollection.js +1 -1
  118. package/dist/components/data/TableBase/TableHeaderCell.js +1 -1
  119. package/dist/components/data/TableBase/TableRow.js +1 -1
  120. package/dist/components/data/TableBase/TableView.js +1 -3
  121. package/dist/components/data/TableBase/TableView.js.map +1 -1
  122. package/dist/components/data/TableBase/TreeGridTable.js +1 -1
  123. package/dist/components/data/TableBase/column-header.js +1 -1
  124. package/dist/components/data/TableBase/column-menu.js +1 -1
  125. package/dist/components/data/TableBase/column-styles.js +1 -1
  126. package/dist/components/data/TableBase/column-tint.js +1 -1
  127. package/dist/components/data/TableBase/row-menu.js +1 -1
  128. package/dist/components/data/TableBase/styled.js +1 -1
  129. package/dist/components/data/TableBase/table-tree.js +1 -1
  130. package/dist/components/data/TableBase/types.js +1 -1
  131. package/dist/components/data/TableBase/use-cell-selection.js +0 -0
  132. package/dist/components/data/TableBase/use-column-menu.js +1 -1
  133. package/dist/components/data/TableBase/use-column-order.js +1 -1
  134. package/dist/components/data/TableBase/use-column-window.js +1 -1
  135. package/dist/components/data/TableBase/use-container-width.js +1 -1
  136. package/dist/components/data/TableBase/use-row-move-animation.js +1 -1
  137. package/dist/components/data/TableBase/use-scrollability.js +1 -1
  138. package/dist/components/data/TableBase/use-table-columns.js +1 -1
  139. package/dist/components/data/TableBase/use-table-search.js +1 -1
  140. package/dist/components/data/TableBase/use-table-selection.js +1 -1
  141. package/dist/components/data/TableBase/use-table-sort.js +1 -1
  142. package/dist/components/data/TableBase/use-table-sorts.js +1 -1
  143. package/dist/components/data/TableBase/use-table-storage.js +1 -1
  144. package/dist/components/data/TableBase/use-table-tooltip-refresh.js +1 -1
  145. package/dist/components/data/TableBase/use-table-tree-state.js +1 -1
  146. package/dist/components/fields/Checkbox/Checkbox.js +1 -1
  147. package/dist/components/fields/Checkbox/CheckboxGroup.js +1 -1
  148. package/dist/components/fields/Checkbox/CheckboxGroup.js.map +1 -1
  149. package/dist/components/fields/Checkbox/context.js +1 -1
  150. package/dist/components/fields/ColorInput/ColorInput.js +1 -1
  151. package/dist/components/fields/ColorPicker/ColorPicker.js +1 -3
  152. package/dist/components/fields/ColorPicker/ColorPicker.js.map +1 -1
  153. package/dist/components/fields/ColorSwatch/ColorSwatch.js +1 -1
  154. package/dist/components/fields/ColorSwatchGroup/ColorSwatchGroup.js +1 -2
  155. package/dist/components/fields/ColorSwatchGroup/ColorSwatchGroup.js.map +1 -1
  156. package/dist/components/fields/ComboBox/ComboBox.js +1 -1
  157. package/dist/components/fields/CommandTextArea/CommandTextArea.js +1 -1
  158. package/dist/components/fields/CommandTextArea/caretPosition.js +1 -1
  159. package/dist/components/fields/CommandTextArea/useCaretAnchor.js +1 -1
  160. package/dist/components/fields/DatePicker/DateInput.js +1 -1
  161. package/dist/components/fields/DatePicker/DateInputBase.js +1 -1
  162. package/dist/components/fields/DatePicker/DatePicker.js +1 -1
  163. package/dist/components/fields/DatePicker/DatePickerButton.js +1 -1
  164. package/dist/components/fields/DatePicker/DatePickerElement.js +1 -1
  165. package/dist/components/fields/DatePicker/DatePickerInput.js +1 -1
  166. package/dist/components/fields/DatePicker/DatePickerSegment.js +1 -1
  167. package/dist/components/fields/DatePicker/DateRangePicker.js +1 -1
  168. package/dist/components/fields/DatePicker/DateRangeSeparatedPicker.js +1 -1
  169. package/dist/components/fields/DatePicker/MonthPicker.js +1 -1
  170. package/dist/components/fields/DatePicker/PeriodPicker.js +1 -1
  171. package/dist/components/fields/DatePicker/QuarterPicker.js +1 -1
  172. package/dist/components/fields/DatePicker/TimeInput.js +1 -1
  173. package/dist/components/fields/DatePicker/WeekPicker.js +1 -1
  174. package/dist/components/fields/DatePicker/YearPicker.js +1 -1
  175. package/dist/components/fields/DatePicker/parseDate.js +1 -1
  176. package/dist/components/fields/DatePicker/period.js +1 -1
  177. package/dist/components/fields/DatePicker/props.js +1 -1
  178. package/dist/components/fields/DatePicker/utils.js +1 -1
  179. package/dist/components/fields/FileInput/FileInput.js +1 -1
  180. package/dist/components/fields/FilterListBox/FilterListBox.js +1 -2
  181. package/dist/components/fields/FilterListBox/FilterListBox.js.map +1 -1
  182. package/dist/components/fields/FilterPicker/FilterPicker.js +6 -15
  183. package/dist/components/fields/FilterPicker/FilterPicker.js.map +1 -1
  184. package/dist/components/fields/Input/Input.js +1 -1
  185. package/dist/components/fields/ListBox/DraggableListBox.js +1 -1
  186. package/dist/components/fields/ListBox/ListBox.js +5 -7
  187. package/dist/components/fields/ListBox/ListBox.js.map +1 -1
  188. package/dist/components/fields/ListBox/optionId.js +1 -1
  189. package/dist/components/fields/ListBoxPopover/ListBoxPopover.js +1 -2
  190. package/dist/components/fields/ListBoxPopover/ListBoxPopover.js.map +1 -1
  191. package/dist/components/fields/ListBoxPopover/listNavigation.js +1 -1
  192. package/dist/components/fields/ListBoxPopover/useCompositeFocus.js +1 -1
  193. package/dist/components/fields/NumberInput/NumberInput.js +1 -1
  194. package/dist/components/fields/NumberInput/StepButton.js +1 -1
  195. package/dist/components/fields/PasswordInput/PasswordInput.js +1 -1
  196. package/dist/components/fields/Picker/Picker.js +6 -15
  197. package/dist/components/fields/Picker/Picker.js.map +1 -1
  198. package/dist/components/fields/RadioGroup/Radio.d.ts +32 -32
  199. package/dist/components/fields/RadioGroup/Radio.js +1 -1
  200. package/dist/components/fields/RadioGroup/RadioGroup.js +1 -1
  201. package/dist/components/fields/RadioGroup/RadioGroup.js.map +1 -1
  202. package/dist/components/fields/RadioGroup/context.js +1 -1
  203. package/dist/components/fields/SearchComboBox/SearchComboBox.js +6 -1
  204. package/dist/components/fields/SearchComboBox/SearchComboBox.js.map +1 -1
  205. package/dist/components/fields/SearchInput/SearchInput.js +6 -1
  206. package/dist/components/fields/SearchInput/SearchInput.js.map +1 -1
  207. package/dist/components/fields/Select/Select.js +1 -1
  208. package/dist/components/fields/Slider/Gradation.js +1 -1
  209. package/dist/components/fields/Slider/HueSlider.js +1 -1
  210. package/dist/components/fields/Slider/RangeSlider.js +1 -1
  211. package/dist/components/fields/Slider/Slider.js +1 -1
  212. package/dist/components/fields/Slider/SliderBase.js +1 -1
  213. package/dist/components/fields/Slider/SliderThumb.js +1 -1
  214. package/dist/components/fields/Slider/SliderTrack.js +1 -1
  215. package/dist/components/fields/Slider/elements.js +1 -1
  216. package/dist/components/fields/Slider/index.js +1 -1
  217. package/dist/components/fields/Switch/Switch.js +1 -1
  218. package/dist/components/fields/TagInput/TagInput.js +1 -2
  219. package/dist/components/fields/TagInput/TagInput.js.map +1 -1
  220. package/dist/components/fields/TagInput/TagList.js +1 -1
  221. package/dist/components/fields/TagInput/useActiveOption.js +1 -1
  222. package/dist/components/fields/TagInput/useTagError.js +1 -1
  223. package/dist/components/fields/TextArea/TextArea.js +1 -1
  224. package/dist/components/fields/TextInput/TextInput.js +1 -1
  225. package/dist/components/fields/TextInput/TextInputBase.js +1 -1
  226. package/dist/components/fields/TextInput/useAutoSizeTextArea.js +1 -1
  227. package/dist/components/fields/TextInputMapper/TextInputMapper.js +16 -19
  228. package/dist/components/fields/TextInputMapper/TextInputMapper.js.map +1 -1
  229. package/dist/components/fields/TriggerActions.js +1 -1
  230. package/dist/components/fields/color/ColorPanel.js +1 -3
  231. package/dist/components/fields/color/ColorPanel.js.map +1 -1
  232. package/dist/components/fields/color/channels.js +1 -1
  233. package/dist/components/fields/color/color.js +1 -1
  234. package/dist/components/fields/color/context.js +1 -1
  235. package/dist/components/form/FieldWrapper/FieldWrapper.d.ts +8 -10
  236. package/dist/components/form/FieldWrapper/FieldWrapper.js +159 -214
  237. package/dist/components/form/FieldWrapper/FieldWrapper.js.map +1 -1
  238. package/dist/components/form/FieldWrapper/field-description.js +3 -3
  239. package/dist/components/form/FieldWrapper/field-description.js.map +1 -1
  240. package/dist/components/form/FieldWrapper/types.d.ts +3 -4
  241. package/dist/components/form/Form/Field.js +1 -1
  242. package/dist/components/form/Form/Form.js +1 -1
  243. package/dist/components/form/Form/ModernFormRoot.js +1 -1
  244. package/dist/components/form/Form/ResetButton/ResetButton.js +1 -1
  245. package/dist/components/form/Form/SubmitButton/SubmitButton.js +1 -1
  246. package/dist/components/form/Form/SubmitError.js +1 -1
  247. package/dist/components/form/Form/backend.js +1 -1
  248. package/dist/components/form/Form/index.js +1 -1
  249. package/dist/components/form/Form/modern/actions.js +1 -1
  250. package/dist/components/form/Form/modern/context.js +1 -1
  251. package/dist/components/form/Form/modern/controller.js +1 -1
  252. package/dist/components/form/Form/modern/field-binding.js +1 -1
  253. package/dist/components/form/Form/modern/field.js +1 -1
  254. package/dist/components/form/Form/modern/react.js +1 -1
  255. package/dist/components/form/Form/modern/store.js +1 -1
  256. package/dist/components/form/Form/modern/validation.js +1 -1
  257. package/dist/components/form/Form/modern/values.js +1 -1
  258. package/dist/components/form/Form/reset-unbound-controls.js +1 -1
  259. package/dist/components/form/Form/use-field/use-field-binding.js +1 -1
  260. package/dist/components/form/Form/use-field/use-field-props.js +33 -21
  261. package/dist/components/form/Form/use-field/use-field-props.js.map +1 -1
  262. package/dist/components/form/Form/use-field/use-field.js +1 -1
  263. package/dist/components/form/Form/use-form.js +1 -1
  264. package/dist/components/form/Form/validation.js +1 -1
  265. package/dist/components/form/Label.js +1 -1
  266. package/dist/components/form/field-chrome.js +34 -4
  267. package/dist/components/form/field-chrome.js.map +1 -1
  268. package/dist/components/form/legacy-tooltip.js +1 -1
  269. package/dist/components/form/validation/ValidationIndicator.js +1 -1
  270. package/dist/components/form/validation/resolve-validation-props.js +1 -1
  271. package/dist/components/form/validation/use-validation-props.js +1 -1
  272. package/dist/components/form/wrapper.d.ts +17 -6
  273. package/dist/components/form/wrapper.js +14 -6
  274. package/dist/components/form/wrapper.js.map +1 -1
  275. package/dist/components/helpers/DisplayTransition/DisplayTransition.js +1 -1
  276. package/dist/components/helpers/IconSwitch/IconSwitch.js +1 -1
  277. package/dist/components/layout/Flex.js +1 -1
  278. package/dist/components/layout/Flow.js +1 -1
  279. package/dist/components/layout/Grid.js +1 -1
  280. package/dist/components/layout/Panel.js +1 -1
  281. package/dist/components/layout/Prefix.js +1 -1
  282. package/dist/components/layout/ResizablePanel.js +1 -1
  283. package/dist/components/layout/Space.js +1 -1
  284. package/dist/components/layout/Suffix.js +1 -1
  285. package/dist/components/navigation/Pagination/Pagination.js +1 -3
  286. package/dist/components/navigation/Pagination/Pagination.js.map +1 -1
  287. package/dist/components/navigation/Pagination/use-pagination.js +1 -1
  288. package/dist/components/navigation/Tabs/BoardDragActiveProvider.js +1 -1
  289. package/dist/components/navigation/Tabs/DraggableTabList.js +1 -1
  290. package/dist/components/navigation/Tabs/TabButton.js +1 -1
  291. package/dist/components/navigation/Tabs/TabDropIndicator.js +1 -1
  292. package/dist/components/navigation/Tabs/TabPanel.js +1 -1
  293. package/dist/components/navigation/Tabs/TabPicker.js +1 -2
  294. package/dist/components/navigation/Tabs/TabPicker.js.map +1 -1
  295. package/dist/components/navigation/Tabs/Tabs.js +1 -1
  296. package/dist/components/navigation/Tabs/TabsAction.js +1 -1
  297. package/dist/components/navigation/Tabs/TabsContext.js +1 -1
  298. package/dist/components/navigation/Tabs/popover-placement.js +1 -1
  299. package/dist/components/navigation/Tabs/styled.js +1 -1
  300. package/dist/components/navigation/Tabs/types.js +1 -1
  301. package/dist/components/navigation/Tabs/use-tab-editing.js +1 -1
  302. package/dist/components/navigation/Tabs/use-tab-indicator.js +1 -1
  303. package/dist/components/organisms/StatsCard/StatsCard.js +1 -1
  304. package/dist/components/other/Calendar/Calendar.js +1 -1
  305. package/dist/components/other/Calendar/CalendarCell.js +1 -1
  306. package/dist/components/other/Calendar/CalendarGrid.js +1 -1
  307. package/dist/components/other/Calendar/CalendarHeader.js +1 -1
  308. package/dist/components/other/Calendar/CalendarPanel.js +1 -1
  309. package/dist/components/other/Calendar/PeriodCalendar.js +1 -1
  310. package/dist/components/other/Calendar/PeriodGrid.js +1 -1
  311. package/dist/components/other/Calendar/RangeCalendar.js +1 -1
  312. package/dist/components/other/Calendar/styled.js +1 -1
  313. package/dist/components/other/CubeLogo/CubeLogo.js +1 -1
  314. package/dist/components/other/NoDataIcon/NoDataIcon.js +1 -1
  315. package/dist/components/overlays/AlertDialog/AlertDialog.js +1 -1
  316. package/dist/components/overlays/AlertDialog/AlertDialogApiProvider.js +1 -1
  317. package/dist/components/overlays/AlertDialog/AlertDialogZone.js +1 -1
  318. package/dist/components/overlays/Dialog/Dialog.js +1 -1
  319. package/dist/components/overlays/Dialog/DialogContainer.js +1 -1
  320. package/dist/components/overlays/Dialog/DialogForm.js +1 -1
  321. package/dist/components/overlays/Dialog/DialogTrigger.js +1 -1
  322. package/dist/components/overlays/Dialog/ModernDialogForm.js +1 -1
  323. package/dist/components/overlays/Dialog/context.js +1 -1
  324. package/dist/components/overlays/Dialog/default-button-text.js +1 -1
  325. package/dist/components/overlays/Dialog/use-content-overflow.js +1 -1
  326. package/dist/components/overlays/Dialog/use-dialog-container.js +1 -1
  327. package/dist/components/overlays/Modal/Modal.js +1 -1
  328. package/dist/components/overlays/Modal/OpenTransitionContext.js +1 -1
  329. package/dist/components/overlays/Modal/Overlay.js +1 -1
  330. package/dist/components/overlays/Modal/Popover.js +1 -1
  331. package/dist/components/overlays/Modal/Tray.js +1 -1
  332. package/dist/components/overlays/Modal/Underlay.js +1 -1
  333. package/dist/components/overlays/Modal/modal-containment.js +1 -1
  334. package/dist/components/overlays/Notifications/Notification.js +1 -1
  335. package/dist/components/overlays/Notifications/NotificationAction.js +1 -1
  336. package/dist/components/overlays/Notifications/NotificationCard.js +1 -1
  337. package/dist/components/overlays/Notifications/NotificationContext.js +1 -1
  338. package/dist/components/overlays/Notifications/NotificationItem.js +1 -1
  339. package/dist/components/overlays/Notifications/OverlayContainer.js +1 -1
  340. package/dist/components/overlays/Notifications/OverlayProvider.js +1 -1
  341. package/dist/components/overlays/Notifications/PersistentNotificationsList.js +1 -1
  342. package/dist/components/overlays/Notifications/dismissed-storage.js +1 -1
  343. package/dist/components/overlays/Notifications/format-relative-time.js +1 -1
  344. package/dist/components/overlays/Notifications/index.js +1 -1
  345. package/dist/components/overlays/Notifications/use-notification-state.js +1 -1
  346. package/dist/components/overlays/Notifications/use-notifications.js +1 -1
  347. package/dist/components/overlays/Notifications/use-overlay-timers.js +1 -1
  348. package/dist/components/overlays/Notifications/use-persistent-notifications.js +1 -1
  349. package/dist/components/overlays/Notifications/use-persistent-state.js +1 -1
  350. package/dist/components/overlays/Notifications/use-toast-state.js +1 -1
  351. package/dist/components/overlays/Toast/ToastItem.js +1 -1
  352. package/dist/components/overlays/Toast/index.js +1 -1
  353. package/dist/components/overlays/Toast/useProgressToast.js +1 -1
  354. package/dist/components/overlays/Toast/useToast.js +1 -1
  355. package/dist/components/overlays/Tooltip/Tooltip.js +1 -1
  356. package/dist/components/overlays/Tooltip/TooltipProvider.js +1 -1
  357. package/dist/components/overlays/Tooltip/TooltipTrigger.js +1 -1
  358. package/dist/components/overlays/Tooltip/context.js +1 -1
  359. package/dist/components/overlays/Tooltip/split-trigger-props.js +1 -1
  360. package/dist/components/portal/Portal.js +1 -1
  361. package/dist/components/portal/PortalProvider.js +1 -1
  362. package/dist/components/portal/usePortal.js +1 -1
  363. package/dist/components/shared/DraggableCollection.js +1 -1
  364. package/dist/components/shared/InvalidIcon.js +1 -1
  365. package/dist/components/shared/ValidIcon.js +1 -1
  366. package/dist/components/status/LoadingAnimation/LoadingAnimation.js +1 -1
  367. package/dist/components/status/Spin/Cube.js +1 -1
  368. package/dist/components/status/Spin/InternalSpinner.js +1 -1
  369. package/dist/components/status/Spin/Spin.js +1 -1
  370. package/dist/components/status/Spin/SpinsContainer.js +1 -1
  371. package/dist/data/item-themes.js +1 -1
  372. package/dist/data/themes.js +1 -1
  373. package/dist/eslint-plugin/defaults.generated.js +1 -1
  374. package/dist/eslint-plugin/index.js +1 -1
  375. package/dist/eslint-plugin/rules/no-redundant-default-prop.js +1 -1
  376. package/dist/i18n/I18nProvider.js +1 -1
  377. package/dist/i18n/createFormatter.js +1 -1
  378. package/dist/i18n/index.js +1 -1
  379. package/dist/i18n/instance.js +1 -1
  380. package/dist/i18n/locales/de-DE/uikit.js +1 -1
  381. package/dist/i18n/locales/en-US/uikit.js +1 -1
  382. package/dist/i18n/locales/es-ES/uikit.js +1 -1
  383. package/dist/i18n/locales/es-MX/uikit.js +1 -1
  384. package/dist/i18n/locales/fr-FR/uikit.js +1 -1
  385. package/dist/i18n/locales/it-IT/uikit.js +1 -1
  386. package/dist/i18n/locales/ja-JP/uikit.js +1 -1
  387. package/dist/i18n/locales/nb-NO/uikit.js +1 -1
  388. package/dist/i18n/locales/pt-BR/uikit.js +1 -1
  389. package/dist/i18n/locales/pt-PT/uikit.js +1 -1
  390. package/dist/i18n/locales/sv-SE/uikit.js +1 -1
  391. package/dist/i18n/locales/vi-VN/uikit.js +1 -1
  392. package/dist/i18n/locales.js +1 -1
  393. package/dist/i18n/namespace.js +1 -1
  394. package/dist/i18n/useFormatter.js +1 -1
  395. package/dist/i18n/useI18n.js +1 -1
  396. package/dist/icons/AdjustmentsHorizontalIcon.js +1 -1
  397. package/dist/icons/AdjustmentsIcon.js +1 -1
  398. package/dist/icons/AiIcon.js +1 -1
  399. package/dist/icons/AreaChartIcon.js +1 -1
  400. package/dist/icons/ArrowNarrowDownIcon.js +1 -1
  401. package/dist/icons/ArrowNarrowUpIcon.js +1 -1
  402. package/dist/icons/BackwardIcon.js +1 -1
  403. package/dist/icons/BarChartIcon.js +1 -1
  404. package/dist/icons/BellFilledIcon.js +1 -1
  405. package/dist/icons/BellIcon.js +1 -1
  406. package/dist/icons/BooleanIcon.js +1 -1
  407. package/dist/icons/CalendarEditIcon.js +1 -1
  408. package/dist/icons/CalendarIcon.js +1 -1
  409. package/dist/icons/CaretDownIcon.js +1 -1
  410. package/dist/icons/CaretUpIcon.js +1 -1
  411. package/dist/icons/ChartAreaStackedIcon.js +1 -1
  412. package/dist/icons/ChartAreaStackedPercentageIcon.js +1 -1
  413. package/dist/icons/ChartBarGroupedHorizontalIcon.js +1 -1
  414. package/dist/icons/ChartBarGroupedIcon.js +1 -1
  415. package/dist/icons/ChartBarHorizontalIcon.js +1 -1
  416. package/dist/icons/ChartBarLineIcon.js +1 -1
  417. package/dist/icons/ChartBarStackedHorizontalIcon.js +1 -1
  418. package/dist/icons/ChartBarStackedIcon.js +1 -1
  419. package/dist/icons/ChartBarStackedPercentageHorizontalIcon.js +1 -1
  420. package/dist/icons/ChartBarStackedPercentageIcon.js +1 -1
  421. package/dist/icons/ChartBoxPlot2Icon.js +1 -1
  422. package/dist/icons/ChartBoxPlotIcon.js +1 -1
  423. package/dist/icons/ChartBubbleIcon.js +1 -1
  424. package/dist/icons/ChartDonut2Icon.js +1 -1
  425. package/dist/icons/ChartFunnelIcon.js +1 -1
  426. package/dist/icons/ChartHeatmapIcon.js +1 -1
  427. package/dist/icons/ChartKPIIcon.js +1 -1
  428. package/dist/icons/ChartPie2Icon.js +1 -1
  429. package/dist/icons/ChartScatterIcon.js +1 -1
  430. package/dist/icons/CheckCircleFilledIcon.js +1 -1
  431. package/dist/icons/CheckCircleIcon.js +1 -1
  432. package/dist/icons/CheckIcon.js +1 -1
  433. package/dist/icons/CircleFilledIcon.js +1 -1
  434. package/dist/icons/ClearIcon.js +1 -1
  435. package/dist/icons/CloseCircleFilledIcon.js +1 -1
  436. package/dist/icons/CloseCircleIcon.js +1 -1
  437. package/dist/icons/CloseIcon.js +1 -1
  438. package/dist/icons/CodeIcon.js +1 -1
  439. package/dist/icons/ColumnTotalIcon.js +1 -1
  440. package/dist/icons/CopyIcon.js +1 -1
  441. package/dist/icons/CountIcon.js +1 -1
  442. package/dist/icons/CubeIcon.js +1 -1
  443. package/dist/icons/CubePauseIcon.js +1 -1
  444. package/dist/icons/CubePlayIcon.js +1 -1
  445. package/dist/icons/CurrencyDollarIcon.js +1 -1
  446. package/dist/icons/DangerIcon.js +1 -1
  447. package/dist/icons/DashboardIcon.js +1 -1
  448. package/dist/icons/DatabaseIcon.js +1 -1
  449. package/dist/icons/DecimalDecreaseIcon.js +1 -1
  450. package/dist/icons/DecimalIncreaseIcon.js +1 -1
  451. package/dist/icons/DirectionIcon.js +1 -1
  452. package/dist/icons/DonutIcon.js +1 -1
  453. package/dist/icons/DownIcon.js +1 -1
  454. package/dist/icons/EditIcon.js +1 -1
  455. package/dist/icons/ExclamationCircleFilledIcon.js +1 -1
  456. package/dist/icons/ExclamationCircleIcon.js +1 -1
  457. package/dist/icons/ExclamationIcon.js +1 -1
  458. package/dist/icons/EyeIcon.js +1 -1
  459. package/dist/icons/EyeInvisibleIcon.js +1 -1
  460. package/dist/icons/FilterIcon.js +1 -1
  461. package/dist/icons/FolderFilledIcon.js +1 -1
  462. package/dist/icons/FolderIcon.js +1 -1
  463. package/dist/icons/FolderOpenFilledIcon.js +1 -1
  464. package/dist/icons/FolderOpenIcon.js +1 -1
  465. package/dist/icons/ForwardIcon.js +1 -1
  466. package/dist/icons/GripVerticalIcon.js +1 -1
  467. package/dist/icons/HierarchyIcon.js +1 -1
  468. package/dist/icons/HierarchyOpenIcon.js +1 -1
  469. package/dist/icons/Icon.js +1 -1
  470. package/dist/icons/InfoCircleIcon.js +1 -1
  471. package/dist/icons/InfoIcon.js +1 -1
  472. package/dist/icons/KeyIcon.js +1 -1
  473. package/dist/icons/LeftIcon.js +1 -1
  474. package/dist/icons/LineChartIcon.js +1 -1
  475. package/dist/icons/LoadingIcon.js +1 -1
  476. package/dist/icons/LockFilledIcon.js +1 -1
  477. package/dist/icons/LockIcon.js +1 -1
  478. package/dist/icons/MoreIcon.js +1 -1
  479. package/dist/icons/NotAllowedIcon.js +1 -1
  480. package/dist/icons/Number123Icon.js +1 -1
  481. package/dist/icons/NumberIcon.js +1 -1
  482. package/dist/icons/PauseCircleFilledIcon.js +1 -1
  483. package/dist/icons/PauseCircleIcon.js +1 -1
  484. package/dist/icons/PauseIcon.js +1 -1
  485. package/dist/icons/PercentageIcon.js +1 -1
  486. package/dist/icons/PieChartIcon.js +1 -1
  487. package/dist/icons/PipetteIcon.js +1 -1
  488. package/dist/icons/PlayCircleIcon.js +1 -1
  489. package/dist/icons/PlayIcon.js +1 -1
  490. package/dist/icons/PlusIcon.js +1 -1
  491. package/dist/icons/ProgressBarIcon.js +1 -1
  492. package/dist/icons/ReloadIcon.js +1 -1
  493. package/dist/icons/ReportIcon.js +1 -1
  494. package/dist/icons/ReturnIcon.js +1 -1
  495. package/dist/icons/RightIcon.js +1 -1
  496. package/dist/icons/RowTotalsIcon.js +1 -1
  497. package/dist/icons/SchemeIcon.js +1 -1
  498. package/dist/icons/SearchIcon.js +1 -1
  499. package/dist/icons/SemanticQueryIcon.js +1 -1
  500. package/dist/icons/SettingsIcon.js +1 -1
  501. package/dist/icons/ShieldFilledIcon.js +1 -1
  502. package/dist/icons/ShieldIcon.js +1 -1
  503. package/dist/icons/SlashIcon.js +1 -1
  504. package/dist/icons/SparklesIcon.js +1 -1
  505. package/dist/icons/SqlIcon.js +1 -1
  506. package/dist/icons/StatsIcon.js +1 -1
  507. package/dist/icons/StopIcon.js +1 -1
  508. package/dist/icons/StringIcon.js +1 -1
  509. package/dist/icons/SubtotalsIcon.js +1 -1
  510. package/dist/icons/SwitchIcon.js +1 -1
  511. package/dist/icons/TableIcon.js +1 -1
  512. package/dist/icons/ThumbsDownIcon.js +1 -1
  513. package/dist/icons/ThumbsUpIcon.js +1 -1
  514. package/dist/icons/ThunderboltCrossedIcon.js +1 -1
  515. package/dist/icons/ThunderboltFilledIcon.js +1 -1
  516. package/dist/icons/ThunderboltIcon.js +1 -1
  517. package/dist/icons/TimeIcon.js +1 -1
  518. package/dist/icons/TrashIcon.js +1 -1
  519. package/dist/icons/UnlockIcon.js +1 -1
  520. package/dist/icons/UpIcon.js +1 -1
  521. package/dist/icons/UserGroupIcon.js +1 -1
  522. package/dist/icons/UserIcon.js +1 -1
  523. package/dist/icons/UserLockIcon.js +1 -1
  524. package/dist/icons/ViewIcon.js +1 -1
  525. package/dist/icons/WarningFilledIcon.js +1 -1
  526. package/dist/icons/WarningIcon.js +1 -1
  527. package/dist/icons/wrap-icon.js +1 -1
  528. package/dist/index.js +1 -1
  529. package/dist/probe/canonicalize.js +1 -1
  530. package/dist/probe/css.js +1 -1
  531. package/dist/probe/index.js +1 -1
  532. package/dist/provider.js +1 -1
  533. package/dist/providers/TrackingProvider.js +1 -1
  534. package/dist/providers/navigation-url.js +1 -1
  535. package/dist/providers/navigationAdapter.default.js +1 -1
  536. package/dist/providers/use-navigation.js +1 -1
  537. package/dist/shared/form.d.ts +12 -11
  538. package/dist/tokens/all-tokens.js +1 -1
  539. package/dist/tokens/base.js +1 -1
  540. package/dist/tokens/color-seed.js +1 -1
  541. package/dist/tokens/color-theme.js +1 -1
  542. package/dist/tokens/colors.js +1 -1
  543. package/dist/tokens/layout.js +1 -1
  544. package/dist/tokens/lazy-styles.js +1 -1
  545. package/dist/tokens/legacy-color.js +1 -1
  546. package/dist/tokens/palette-config.js +1 -1
  547. package/dist/tokens/palette.js +1 -1
  548. package/dist/tokens/resolve.js +1 -1
  549. package/dist/tokens/shadows.js +1 -1
  550. package/dist/tokens/sizes.js +1 -1
  551. package/dist/tokens/spacing.js +1 -1
  552. package/dist/tokens/typography.js +1 -1
  553. package/dist/utils/ResizeSensor.js +1 -1
  554. package/dist/utils/colors.js +1 -1
  555. package/dist/utils/dotize.js +1 -1
  556. package/dist/utils/is-dev-env.js +1 -1
  557. package/dist/utils/modules.js +1 -1
  558. package/dist/utils/promise.js +1 -1
  559. package/dist/utils/raf.js +1 -1
  560. package/dist/utils/random.js +1 -1
  561. package/dist/utils/range.js +1 -1
  562. package/dist/utils/react/RenderCache.js +1 -1
  563. package/dist/utils/react/Slots.js +1 -1
  564. package/dist/utils/react/chain.js +1 -1
  565. package/dist/utils/react/disabledProps.js +1 -1
  566. package/dist/utils/react/forwardRefWithGenerics.js +1 -1
  567. package/dist/utils/react/index.js +1 -1
  568. package/dist/utils/react/interactions.js +1 -1
  569. package/dist/utils/react/isTextOnly.js +1 -1
  570. package/dist/utils/react/mapProps.js +1 -1
  571. package/dist/utils/react/mergeProps.js +1 -1
  572. package/dist/utils/react/nullableValue.js +1 -1
  573. package/dist/utils/react/overlayKeyPropagation.js +1 -1
  574. package/dist/utils/react/programmaticFocus.js +1 -1
  575. package/dist/utils/react/resolveIcon.js +1 -1
  576. package/dist/utils/react/sharedStore.js +1 -1
  577. package/dist/utils/react/useBufferedValue.js +1 -1
  578. package/dist/utils/react/useCombinedRefs.js +1 -1
  579. package/dist/utils/react/useControlledFocusVisible.js +1 -1
  580. package/dist/utils/react/useEventBus.js +1 -1
  581. package/dist/utils/react/useId.js +1 -1
  582. package/dist/utils/react/useIsDarwin.js +1 -1
  583. package/dist/utils/react/useKeySymbols.js +1 -1
  584. package/dist/utils/react/useLayoutEffect.js +1 -1
  585. package/dist/utils/react/useLocalStorage.js +1 -1
  586. package/dist/utils/react/useMergeStyles.js +1 -1
  587. package/dist/utils/react/useOverlayEscapeGuard.js +1 -1
  588. package/dist/utils/react/usePopoverSync.js +1 -1
  589. package/dist/utils/react/useQaProps.js +1 -1
  590. package/dist/utils/react/useScheme.js +1 -1
  591. package/dist/utils/react/useViewportSize.js +1 -1
  592. package/dist/utils/react/wrapNodeIfPlain.js +1 -1
  593. package/dist/utils/selection.js +1 -1
  594. package/dist/utils/styles.js +1 -1
  595. package/dist/utils/tree.js +1 -1
  596. package/dist/utils/warnings.js +1 -1
  597. package/dist/version.js +2 -2
  598. package/docs/CreateComponent.md +0 -2
  599. package/docs/FieldProperties.md +6 -21
  600. package/docs/Usage.md +0 -2
  601. package/docs/components/fields/TagInput.md +0 -7
  602. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"TableView.js","names":["useVirtualizer","clsx","Fragment","useCallback","useEffect","useLayoutEffect","useMemo","useRef","useState","useTreeItem","VisuallyHidden","useEvent","useI18n","DirectionIcon","MoreIcon","getColorTheme","useColorTheme","usePaletteVersion","SIZE_NAME_TO_KEY","SIZES","useSlotProps","Action","ItemAction","Menu","MenuTrigger","useContextMenu","Placeholder","PlaceholderGroupContext","Skeleton","TextItem","Checkbox","useToast","TooltipProvider","renderColumnHeaderContent","resolveColumnSort","columnCellClassName","buildColumnTints","tintSlot","ColumnResizer","isMenuEmpty","normalizeMenuAction","ROW_MENU_COLUMN_KEY","TableElement","TableHeaderItem","TableTreeToggle","TableTreeTogglePlaceholder","TableHeaderCell","TableRow","TableRowDropIndicator","TreeGridTable","selectionRowKey","toTsv","useColumnMenu","getDraggableColumnKeys","isColumnDraggable","canWindowColumns","useColumnWindow","useRowMoveAnimation","useScrollability","getColumnText","getColumnValue","ROW_NUMBER_COLUMN_KEY","SELECTION_COLUMN_KEY","useTableTooltipRefresh","Key","Node","Styles","CSSProperties","KeyboardEvent","ReactKeyboardEvent","MouseEvent","ReactMouseEvent","ReactNode","PointerEvent","ReactPointerEvent","RefObject","TreeState","NavigateArg","ColorThemeConfig","ColumnSortState","TableTreeNode","CubeResolvedColumn","CubeTableCellContext","CubeTableColumnGroupHeader","CubeTableColumnLayout","CubeTableLayoutProps","CubeTableLoadingIndicator","CubeTableRowContext","CubeTableRowSection","CubeTableRowSize","CubeTableSort","CubeTableSortDirection","useCellSelection","CubeTableSelectionState","CubeTableRowRenderProps","isDimmed","mods","Record","styles","height","qa","tooltip","TableViewProps","rows","T","rowKeys","getRowKey","row","index","layout","columnHeaderPaths","ReadonlyMap","onScrollerRef","element","HTMLDivElement","rootRef","size","shape","rowSize","rowHeight","headerHeight","isHeaderHidden","isStriped","hasColumnDividers","isRowMoveAnimated","isHeaderSticky","isVirtualized","virtualizeThreshold","overscan","isLoading","loadingIndicator","skeletonRowCount","selection","selectionTooltip","overlay","rowMenu","ctx","rowContextMenu","onRowMenuAction","action","key","rowMenuTriggerProps","rowLink","onRowAction","onLoadMore","hasMore","isLoadingMore","loadMoreMargin","pinnedTopRows","pinnedBottomRows","cellSelection","ReturnType","rowNumberOffset","rowIndexOffset","totalRowCount","tree","state","ariaProps","nodes","entries","columnKey","isReorderable","dragState","dropState","isColumnReorderable","columnDragState","columnDropState","headCollectionProps","headRowRef","HTMLTableRowElement","onColumnFocus","collectionProps","bodyRef","HTMLTableSectionElement","isResizable","onColumnResize","width","onColumnResizeEnd","emptyLabel","noResultsLabel","error","isFiltered","sortMode","sort","sorts","onColumnSort","onColumnSortChange","direction","columnContextMenu","onColumnMenuAction","columnMenuTriggerProps","columnMenuProps","getRowProps","headerPreset","contentPreset","toolbar","footer","ariaLabel","headerStyles","headerCellStyles","bodyStyles","rowStyles","cellStyles","toClipboardHtml","matrix","map","cell","escapeHtml","join","value","replace","ARIA_SORT","asc","desc","const","ColumnTintRegistrar","t0","config","MAX_LOAD_MORE_SKELETON_ROWS","MIN_LOAD_MORE_MARGIN","ESTIMATED_ROW_HEIGHT","xsmall","small","medium","large","xlarge","pinStyle","column","pinOffset","undefined","TableCellContent","$","_c","rowIndex","t1","text","t2","autoHeight","renderCellValue","rendered","isText","String","renderCellContent","render","isStructural","renderTreeCellContent","entry","isExpanded","expandButtonProps","content","level","children","length","TableView","props","isAutoHeight","columns","columnCount","headerGroupDepth","reduce","depth","Math","max","get","rowSizeKey","lastDraggableKey","at","t","toast","scrollerEl","setScrollerEl","scrollerRef","textSlotProps","segments","bodyColumns","refreshAppearance","resetRange","Object","keys","localBodyRef","handleBodyRef","current","handleScrollerRef","headerRowCount","pinnedTopCount","pinnedBottomCount","bodyRowCount","bodyRowIndex","bodyRowKey","treeRowState","parentKey","hasChildren","expandedKeys","has","pinnedRowIndex","edge","paletteVersion","tints","resolveTheme","mergedStyles","flexGrow","flexShrink","Table","preset","HeadRow","HeaderCell","HeaderGroupCell","Body","Row","Cell","toLowerCase","isCellSelected","rowKey","isEnabled","isSelected","cellSelectionProps","pinnedEdge","canSelectCell","onPointerDown","event","HTMLTableCellElement","button","shiftKey","preventDefault","extendTo","select","focus","preventScroll","isDraggingRef","setIsRangeDragging","onPointerEnter","sectionOf","lastColumnFlag","bottomCornerFlag","isLastRow","isVisualLastRow","cellBandFlag","renderStateRow","renderColumnSpacer","span","renderSkeletonCell","pin","isPinEdge","align","ariaColIndex","renderSkeletonRows","count","keyPrefix","Array","from","_","segment","renderSelectionHeaderCell","rowSpan","selectionMode","selectAllState","toggleSelectAll","renderSelectionCell","canSelect","checkbox","isIndeterminate","toggleRow","captureShift","renderRowMenuCell","items","resolveRowMenu","menuActionHandler","renderHeaderCell","renderColumnHeaderCell","header","sortState","activeSort","isSorted","isSortable","canResize","menuItems","columnMenu","resolveColumnMenu","hasMenu","renderColumnMenuTrigger","isDraggable","openMenuColumnKey","role","scope","tabIndex","style","columnHeaderHandlers","onFocus","onClick","onContextMenu","openColumnContextMenu","onKeyDown","openColumnMenuFromKeyboard","renderCell","treeItemAria","rangeKey","columnIndex","section","treeEntry","displayContent","columnClassName","extraCellProps","cellProps","CellTag","isRowHeader","link","className","renderPinnedRow","renderRowCells","getRowElementProps","extra","isRowDisabled","focusedRowIndex","title","target","HTMLElement","closest","isMenuEnabled","openContextMenuFor","fromEntries","filter","active","name","renderRow","isVirtual","rowProps","treeNode","virtualizer","measureElement","node","renderSpacerRow","position","withDropIndicators","rowNode","hasRows","isStale","showSkeleton","showBlank","shouldVirtualize","getItemKey","estimatedRowHeight","getScrollElement","estimateSize","getBoundingClientRect","measure","getTotalSize","querySelectorAll","forEach","isScrolling","focusedTreeKey","selectionManager","focusedKey","findIndex","scrollToIndex","scrollability","draggingKeys","lastBatchSizeRef","rowCountBeforeFetchRef","before","loadMoreSkeletonCount","min","setFocusedRowIndex","isRangeDragging","end","window","addEventListener","removeEventListener","moveRowFocus","delta","all","indexOf","next","sentinelRef","onLoadMoreEvent","sentinel","margin","clientHeight","observer","IntersectionObserver","some","isIntersecting","root","rootMargin","observe","disconnect","contextMenu","placement","hasMenuColumn","isFocused","isDropTarget","closeAfter","close","open","onAction","nativeEvent","rowFromEvent","EventTarget","Number","getAttribute","isInteger","virtualItems","getVirtualItems","paddingTop","start","paddingBottom","colGroup","pathsSharePrefix","left","right","renderHeaderGroupCell","group","first","last","every","renderHeaderRowCells","cells","path","push","segmentEnd","nextPath","slice","headerRows","isLeafRow","onKeyDownCapture","tableProps","tableStyle","totalWidth","renderBodyContent","v","bodyContent","tableContent","padding","border","x","y","stale","found","stopPropagation","range","clear","selectedCount","clearSelection","getSelectionMatrix","clipboardData","setData","success","description","cellCount","configs"],"sources":["../../../../src/components/data/TableBase/TableView.tsx"],"sourcesContent":["import { useVirtualizer } from '@tanstack/react-virtual';\nimport clsx from 'clsx';\nimport {\n Fragment,\n useCallback,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useTreeItem, VisuallyHidden } from 'react-aria';\n\nimport { useEvent } from '../../../_internal/hooks';\nimport { useI18n } from '../../../i18n';\nimport { DirectionIcon } from '../../../icons/DirectionIcon';\nimport { MoreIcon } from '../../../icons/MoreIcon';\nimport { getColorTheme, useColorTheme } from '../../../tokens/color-theme';\nimport { usePaletteVersion } from '../../../tokens/palette-config';\nimport { SIZE_NAME_TO_KEY, SIZES } from '../../../tokens/sizes';\nimport { useSlotProps } from '../../../utils/react/Slots';\nimport { Action } from '../../actions/Action/Action';\nimport { ItemAction } from '../../actions/ItemAction/ItemAction';\nimport { Menu, MenuTrigger } from '../../actions/Menu';\nimport { useContextMenu } from '../../actions/use-context-menu';\nimport {\n Placeholder,\n PlaceholderGroupContext,\n} from '../../content/Placeholder/Placeholder';\nimport { Skeleton } from '../../content/Skeleton/Skeleton';\nimport { TextItem } from '../../content/TextItem';\nimport { Checkbox } from '../../fields/Checkbox';\nimport { useToast } from '../../overlays/Toast';\nimport { TooltipProvider } from '../../overlays/Tooltip/TooltipProvider';\n\nimport { renderColumnHeaderContent, resolveColumnSort } from './column-header';\nimport { columnCellClassName } from './column-styles';\nimport { buildColumnTints, tintSlot } from './column-tint';\nimport { ColumnResizer } from './ColumnResizer';\nimport {\n isMenuEmpty,\n normalizeMenuAction,\n ROW_MENU_COLUMN_KEY,\n} from './row-menu';\nimport {\n TableElement,\n TableHeaderItem,\n TableTreeToggle,\n TableTreeTogglePlaceholder,\n} from './styled';\nimport { TableHeaderCell } from './TableHeaderCell';\nimport { TableRow, TableRowDropIndicator } from './TableRow';\nimport { TreeGridTable } from './TreeGridTable';\nimport { selectionRowKey } from './types';\nimport { toTsv } from './use-cell-selection';\nimport { useColumnMenu } from './use-column-menu';\nimport { getDraggableColumnKeys, isColumnDraggable } from './use-column-order';\nimport { canWindowColumns, useColumnWindow } from './use-column-window';\nimport { useRowMoveAnimation } from './use-row-move-animation';\nimport { useScrollability } from './use-scrollability';\nimport { getColumnText, getColumnValue } from './use-table-columns';\nimport {\n ROW_NUMBER_COLUMN_KEY,\n SELECTION_COLUMN_KEY,\n} from './use-table-selection';\nimport { useTableTooltipRefresh } from './use-table-tooltip-refresh';\n\nimport type { Key, Node } from '@react-types/shared';\nimport type { Styles } from '@tenphi/tasty';\nimport type {\n CSSProperties,\n KeyboardEvent as ReactKeyboardEvent,\n MouseEvent as ReactMouseEvent,\n ReactNode,\n PointerEvent as ReactPointerEvent,\n RefObject,\n} from 'react';\nimport type { TreeState } from 'react-stately';\nimport type { NavigateArg } from '../../../providers/navigation.types';\nimport type { ColorThemeConfig } from '../../../tokens/color-theme';\nimport type { ColumnSortState } from './column-header';\nimport type { TableTreeNode } from './table-tree';\nimport type {\n CubeResolvedColumn,\n CubeTableCellContext,\n CubeTableColumnGroupHeader,\n CubeTableColumnLayout,\n CubeTableLayoutProps,\n CubeTableLoadingIndicator,\n CubeTableRowContext,\n CubeTableRowSection,\n CubeTableRowSize,\n CubeTableSort,\n CubeTableSortDirection,\n} from './types';\nimport type { useCellSelection } from './use-cell-selection';\nimport type { CubeTableSelectionState } from './use-table-selection';\n\n/** Visual/behavioural overrides a table adapter may attach to a single row. */\nexport interface CubeTableRowRenderProps {\n isDimmed?: boolean;\n mods?: Record<string, boolean | undefined>;\n styles?: Styles;\n height?: number;\n qa?: string;\n tooltip?: string;\n}\n\nexport interface TableViewProps<T = any> extends CubeTableLayoutProps {\n qa?: string;\n rows: readonly T[];\n /** Stable keys for `rows`; required when a tree was flattened for display. */\n rowKeys?: readonly Key[];\n getRowKey: (row: T, index: number) => Key;\n layout: CubeTableColumnLayout<T>;\n /** Group path for each leaf column, from the outermost header inward. */\n columnHeaderPaths?: ReadonlyMap<\n string,\n readonly CubeTableColumnGroupHeader[]\n >;\n /**\n * Receives the scroll container once it exists. A callback rather than a ref\n * because the virtualized path does not create the element itself — Virtuoso\n * does, and hands it over after mount.\n */\n onScrollerRef: (element: HTMLDivElement | null) => void;\n /** Attached to the table's root frame. */\n rootRef?: RefObject<HTMLDivElement | null>;\n\n size?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';\n shape?: 'plain' | 'card';\n /**\n * Row height as a named step — 28px / 32px / 40px.\n *\n * Only the rows: the header keeps whatever `size` gives it. Unset, the height\n * falls through to `size` as before. `rowHeight` wins over both, being the\n * most specific answer.\n */\n rowSize?: CubeTableRowSize;\n rowHeight?: number;\n headerHeight?: number;\n isHeaderHidden?: boolean;\n isStriped?: boolean;\n /**\n * Vertical rules between columns.\n *\n * A list reads across a row and wants nothing in the way; a grid is read down\n * a column, and the rule is what tells you which column a figure is in when\n * the header has scrolled far to the left. So `ItemTable` leaves it off and\n * `DataTable` turns it on — the same split ag-grid's `columnBorder` gives the\n * Cloud grids today.\n */\n hasColumnDividers?: boolean;\n /**\n * Slide rows to their new positions when the order changes, instead of\n * teleporting them.\n *\n * On by default, and only ever on a pure reorder — see\n * `use-row-move-animation`. Suppressed under `prefers-reduced-motion`.\n */\n isRowMoveAnimated?: boolean;\n /** @default true */\n isHeaderSticky?: boolean;\n /** @default 'auto' — on above `virtualizeThreshold` rows, needs a bounded height. */\n isVirtualized?: boolean | 'auto';\n /** @default 50 */\n virtualizeThreshold?: number;\n /** Rows rendered beyond each edge of the viewport. @default 20 */\n overscan?: number;\n\n /* status */\n isLoading?: boolean;\n loadingIndicator?: CubeTableLoadingIndicator;\n skeletonRowCount?: number;\n selection?: CubeTableSelectionState<T>;\n selectionTooltip?: string | ((row: T) => string | undefined);\n /** Rendered in the root frame, over the body. For the floating bulk bar. */\n overlay?: ReactNode;\n /** Already normalised by the adapter into a per-row resolver. */\n rowMenu?: (row: T, ctx: CubeTableRowContext<T>) => ReactNode | null;\n rowContextMenu?: boolean | 'context-only';\n onRowMenuAction?: (action: string, row: T, key: Key) => void;\n rowMenuTriggerProps?: Record<string, any>;\n rowLink?: (row: T, index: number) => NavigateArg | undefined;\n onRowAction?: (row: T, key: Key) => void;\n /** Infinite scroll: fires once the end of the list comes into view. */\n onLoadMore?: () => void;\n hasMore?: boolean;\n isLoadingMore?: boolean;\n /**\n * How far before the end to start fetching, in px.\n *\n * Defaults to one viewport height, so the next batch is requested a whole\n * screen before the user could reach the bottom. A fixed 200px — about five\n * rows — meant a fast scroll arrived at the end before the request did, which\n * is the stall this is meant to avoid.\n */\n loadMoreMargin?: number;\n /**\n * Rows pinned above and below the scrolling ones — totals, subtotals.\n *\n * Rendered inside `<tbody>` rather than `<thead>`/`<tfoot>` so they keep the\n * body's own row and cell styling; the sub-element chains are anchored to\n * `Body`. Stickiness comes from the row itself.\n */\n pinnedTopRows?: readonly T[];\n pinnedBottomRows?: readonly T[];\n /**\n * Rectangular cell selection, from `use-cell-selection`.\n *\n * `DataTable` only. A list is acted on by row; a result grid is read by cell,\n * and the block of figures is the thing the user wants out of it.\n */\n cellSelection?: ReturnType<typeof useCellSelection<T>> | null;\n /** 1-based number of the first row, so paging keeps the count continuous. */\n rowNumberOffset?: number;\n /**\n * Rows of the full result that precede this page, and the size of that full\n * result.\n *\n * ARIA row indices are document-absolute by contract: `aria-rowindex` is a\n * row's position in the WHOLE grid and `aria-rowcount` the whole grid's size,\n * so a paged grid has to say \"row 21 of 240\" rather than restarting at 1 and\n * claiming a count of 25. Without them a screen reader hears colliding\n * indices against a larger count, which is worse than saying nothing.\n *\n * Defaults keep an unpaged table correct: no offset, and a count taken from\n * the rows actually given.\n */\n rowIndexOffset?: number;\n totalRowCount?: number;\n /** React Aria treegrid state and the model entries matching `rows`. */\n tree?: {\n state: TreeState<TableTreeNode<T>>;\n ariaProps: Record<string, any>;\n nodes: Node<TableTreeNode<T>>[];\n entries: TableTreeNode<T>[];\n columnKey: string;\n };\n isReorderable?: boolean;\n /** Provided by `DraggableCollection` when reordering is on. */\n dragState?: any;\n dropState?: any;\n /* column reordering — named apart from the ROW drag props above, so a table\n * can eventually run both at once. */\n isColumnReorderable?: boolean;\n columnDragState?: any;\n columnDropState?: any;\n /**\n * Drop handling for the header. Must land on the element that directly\n * contains the header cells — the `<tr>` — or drops are never received.\n */\n headCollectionProps?: Record<string, any>;\n headRowRef?: RefObject<HTMLTableRowElement | null>;\n /** Keeps React Aria's `focusedKey` current, which Alt+Arrow reorder reads. */\n onColumnFocus?: (columnKey: string | null) => void;\n /**\n * Drop handling from `useDroppableCollection`. Must land on the element that\n * directly contains the rows — the `<tbody>` — or drops are never received.\n */\n collectionProps?: Record<string, any>;\n bodyRef?: RefObject<HTMLTableSectionElement | null>;\n isResizable?: boolean;\n onColumnResize?: (columnKey: string, width: number) => void;\n onColumnResizeEnd?: (columnKey: string) => void;\n emptyLabel?: ReactNode;\n noResultsLabel?: ReactNode;\n error?: ReactNode;\n /** Selects `noResultsLabel` over `emptyLabel` when there is nothing to show. */\n isFiltered?: boolean;\n\n /* sorting */\n /** @default 'off' */\n sortMode?: 'client' | 'server' | 'off';\n sort?: CubeTableSort | null;\n /**\n * Multi-column sort. Takes precedence over `sort` when given, and the array\n * order is the precedence — `DataTable` uses it, `ItemTable` uses `sort`.\n */\n sorts?: CubeTableSort[];\n onColumnSort?: (columnKey: string) => void;\n /**\n * Set a column's direction outright, for the column menu's reserved sort keys.\n *\n * Separate from `onColumnSort`, which is a cycle: reaching `desc` by toggling\n * twice never terminates under `disallowSortRemoval` and disturbs the\n * precedence of every other sorted column.\n */\n onColumnSortChange?: (\n columnKey: string,\n direction: CubeTableSortDirection | null,\n ) => void;\n\n /* column menu */\n /**\n * Where a column's `header.menu` is exposed.\n *\n * - `true` — a `⋮` trigger, plus right-click and Shift+F10.\n * - `'context-only'` — right-click and Shift+F10, no trigger.\n * - `false` — suppressed entirely.\n *\n * Defaults to `true`, unlike `rowContextMenu`: for rows the flag also decides\n * whether there is a menu at all, whereas here `header.menu` is that gate and\n * this only picks the surfaces.\n *\n * @default true\n */\n columnContextMenu?: boolean | 'context-only';\n onColumnMenuAction?: (action: string, columnKey: string) => void;\n columnMenuTriggerProps?: Record<string, any>;\n columnMenuProps?: Record<string, any>;\n\n /* per-row hooks */\n getRowProps?: (\n ctx: CubeTableRowContext<T>,\n ) => CubeTableRowRenderProps | undefined;\n\n /**\n * Typography preset for the column header. A per-adapter default rather than\n * a table-wide constant: `ItemTable` uses the uppercase caption look (`c2`),\n * while an analytics grid wants its headers to read at body size.\n * `headerCellStyles` still wins over it.\n */\n headerPreset?: string;\n /**\n * Typography for the body. `ItemTable` reads as a list at `t3`; a result grid\n * packs more in and wants `t4`.\n */\n contentPreset?: string;\n\n /** Chrome rendered above the table, in the frame's first grid row. */\n toolbar?: ReactNode;\n /** Chrome rendered below the table, in the frame's last grid row. */\n footer?: ReactNode;\n\n ariaLabel?: string;\n styles?: Styles;\n headerStyles?: Styles;\n headerCellStyles?: Styles;\n bodyStyles?: Styles;\n rowStyles?: Styles;\n cellStyles?: Styles;\n mods?: Record<string, boolean | undefined>;\n}\n\n/**\n * The same block as an HTML table, so a spreadsheet keeps the cell boundaries.\n *\n * Pasting `text/plain` TSV works, but Excel and Sheets then re-guess the types\n * of every field; the HTML flavour is what makes a value that looks like a date\n * stay the text it was on screen.\n */\nfunction toClipboardHtml(matrix: string[][]) {\n const rows = matrix\n .map(\n (row) =>\n `<tr>${row.map((cell) => `<td>${escapeHtml(cell)}</td>`).join('')}</tr>`,\n )\n .join('');\n\n return `<table>${rows}</table>`;\n}\n\nfunction escapeHtml(value: string) {\n return value\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;');\n}\n\nconst ARIA_SORT = { asc: 'ascending', desc: 'descending' } as const;\n\n/**\n * Registers one column tint's tokens.\n *\n * A component per theme rather than a loop of `useColorTheme` calls: the number\n * of tinted columns is data-dependent, and hooks cannot be called in a loop. Each\n * of these has a fixed hook count, and mounting a different NUMBER of them is\n * fine. Keyed on the theme name, so remounting only happens when the set of\n * colours actually changes.\n *\n * Renders nothing — `useColorTheme` injects into a global slot keyed by the\n * theme's own hash, so two tables sharing a colour share one injection and\n * neither can evict the other's.\n */\nfunction ColumnTintRegistrar({ config }: { config: ColorThemeConfig }) {\n useColorTheme(config);\n\n return null;\n}\n\n/**\n * Content height per size step, mirroring `$row-height` in `styled.ts`. Only the\n * initial estimate — every rendered row is measured, so a wrong guess costs a\n * scrollbar adjustment, not a layout bug. The `+ 1` is the row separator.\n */\n/** Enough to read as \"more is coming\" without pretending to know how much. */\n/**\n * Ceiling on the load-more placeholder burst.\n *\n * These rows are not virtualized — they sit after the window, at the end of the\n * body — so the count is real DOM. 50 rows is already taller than any viewport,\n * which is all the burst has to be.\n */\nconst MAX_LOAD_MORE_SKELETON_ROWS = 50;\n\n/**\n * Floor on the prefetch distance, for a table too short to measure usefully —\n * an unbounded one reports a viewport of nearly zero before it has any rows.\n */\nconst MIN_LOAD_MORE_MARGIN = 200;\n\nconst ESTIMATED_ROW_HEIGHT = {\n xsmall: 28,\n small: 32,\n medium: 40,\n large: 48,\n xlarge: 56,\n} as const;\n\nfunction pinStyle(column: CubeResolvedColumn): CSSProperties | undefined {\n if (column.pinOffset == null) return undefined;\n\n return { ['--pin-offset' as any]: `${column.pinOffset}px` };\n}\n\n/** Default text keeps its tooltip tree while the virtual window moves. */\nfunction TableCellContent<T>({\n column,\n row,\n rowIndex,\n}: {\n column: CubeResolvedColumn<T>;\n row: T;\n rowIndex: number;\n}): ReactNode {\n const text = getColumnText(column, row, rowIndex);\n return column.autoHeight || text == null ? text : <TextItem>{text}</TextItem>;\n}\n\nfunction renderCellValue(rendered: ReactNode, autoHeight?: boolean): ReactNode {\n const isText =\n typeof rendered === 'string' ||\n typeof rendered === 'number' ||\n typeof rendered === 'bigint';\n\n // TextItem supplies truncation and its tooltip without Item's hotkey hooks.\n // Wrapping columns render the text directly instead.\n return isText && !autoHeight ? (\n <TextItem>{String(rendered)}</TextItem>\n ) : isText ? (\n String(rendered)\n ) : (\n rendered\n );\n}\n\nfunction renderCellContent<T>(\n column: CubeResolvedColumn<T>,\n row: T,\n rowIndex: number,\n ctx: CubeTableCellContext<T>,\n): ReactNode {\n if (!column.render) {\n return column.isStructural ? null : (\n <TableCellContent column={column} row={row} rowIndex={rowIndex} />\n );\n }\n\n return renderCellValue(\n column.render(\n column.isStructural ? undefined : getColumnValue(column, row, rowIndex),\n row,\n rowIndex,\n ctx,\n ),\n column.autoHeight,\n );\n}\n\n/**\n * A tree column's cell content: indented to the row's level, with the expand\n * toggle — or a placeholder holding its place on a leaf — before the value.\n */\nfunction renderTreeCellContent<T>(\n entry: TableTreeNode<T>,\n isExpanded: boolean,\n expandButtonProps:\n | ReturnType<typeof useTreeItem>['expandButtonProps']\n | undefined,\n content: ReactNode,\n) {\n return (\n <div\n data-element=\"TreeContent\"\n style={\n {\n '--tree-level': String(entry.level),\n } as CSSProperties\n }\n >\n {entry.children.length > 0 ? (\n <TableTreeToggle\n {...expandButtonProps}\n data-element=\"TreeToggle\"\n tabIndex={-1}\n >\n <DirectionIcon to={isExpanded ? 'bottom' : 'right'} />\n </TableTreeToggle>\n ) : (\n <TableTreeTogglePlaceholder\n data-element=\"TreeToggle\"\n aria-hidden=\"true\"\n />\n )}\n <div data-element=\"TreeValue\">{content}</div>\n </div>\n );\n}\n\n/**\n * The one place table DOM exists. Both `ItemTable` and `DataTable` resolve their\n * props into the shape above and hand it here, so the markup, the ARIA\n * bookkeeping and the tasty sub-element contract have a single implementation.\n */\nexport function TableView<T = any>(props: TableViewProps<T>) {\n const {\n qa,\n rows,\n rowKeys,\n getRowKey,\n layout,\n columnHeaderPaths,\n onScrollerRef,\n rootRef,\n size = 'medium',\n shape = 'plain',\n rowSize,\n rowHeight,\n headerHeight,\n isHeaderHidden = false,\n isStriped = false,\n hasColumnDividers,\n isRowMoveAnimated = true,\n isHeaderSticky = true,\n isAutoHeight = false,\n isVirtualized = 'auto',\n virtualizeThreshold = 50,\n overscan = 20,\n isLoading = false,\n loadingIndicator = 'overlay',\n skeletonRowCount = 6,\n selection,\n selectionTooltip,\n overlay,\n rowMenu,\n rowContextMenu = false,\n onRowMenuAction,\n rowMenuTriggerProps,\n rowLink,\n onRowAction,\n onLoadMore,\n hasMore = false,\n isLoadingMore = false,\n loadMoreMargin,\n pinnedTopRows,\n pinnedBottomRows,\n cellSelection,\n rowNumberOffset = 0,\n rowIndexOffset = 0,\n totalRowCount,\n tree,\n isReorderable = false,\n dragState,\n dropState,\n collectionProps,\n isColumnReorderable = false,\n columnDragState,\n columnDropState,\n headCollectionProps,\n headRowRef,\n onColumnFocus,\n bodyRef,\n isResizable = false,\n onColumnResize,\n onColumnResizeEnd,\n emptyLabel,\n noResultsLabel,\n error,\n isFiltered = false,\n sortMode = 'off',\n sort,\n sorts,\n onColumnSort,\n onColumnSortChange,\n columnContextMenu = true,\n onColumnMenuAction,\n columnMenuTriggerProps,\n columnMenuProps,\n getRowProps,\n headerPreset,\n contentPreset,\n toolbar,\n footer,\n ariaLabel,\n styles,\n headerStyles,\n headerCellStyles,\n bodyStyles,\n rowStyles,\n cellStyles,\n mods,\n } = props;\n\n const { columns } = layout;\n const columnCount = columns.length;\n const headerGroupDepth = columns.reduce(\n (depth, column) =>\n Math.max(depth, columnHeaderPaths?.get(column.key)?.length ?? 0),\n 0,\n );\n\n /**\n * `rowSize` resolved to the size scale, or `null` when it was not given.\n *\n * Both halves come from `SIZE_NAME_TO_KEY` rather than being written out\n * twice: the CSS keeps the token so it follows the scale, and the virtualizer\n * needs the number, and the two must not drift.\n */\n const rowSizeKey = rowSize ? SIZE_NAME_TO_KEY[rowSize] : null;\n // Only the trailing draggable column carries an `after` indicator; every other\n // gap is covered by the next column's `before` one.\n const lastDraggableKey = isColumnReorderable\n ? getDraggableColumnKeys(columns, true).at(-1) ?? null\n : null;\n\n // The element is held here as well as reported upwards: the virtualizer needs\n // it locally, and the adapter needs it to measure column widths.\n const { t } = useI18n();\n const toast = useToast();\n\n const [scrollerEl, setScrollerEl] = useState<HTMLDivElement | null>(null);\n const scrollerRef = useRef<HTMLDivElement | null>(null);\n const textSlotProps = useSlotProps({}, 'text');\n // DataTable's default t4 preset has the same single-line cell layout.\n // Consumer typography overrides need the complete intrinsic body layout.\n const {\n segments: bodyColumns,\n refreshAppearance,\n resetRange,\n } = useColumnWindow(\n layout,\n scrollerEl,\n isVirtualized !== false &&\n !isAutoHeight &&\n !bodyStyles &&\n !rowStyles &&\n !cellStyles &&\n Object.keys(textSlotProps).length === 0 &&\n (!contentPreset || contentPreset === 't4') &&\n canWindowColumns(columns, styles),\n tree?.columnKey,\n );\n // `bodyRef` is optional — only the drag-and-drop path supplies one — but the\n // move animation needs the `<tbody>` either way, so it keeps its own and both\n // are filled from one callback.\n const localBodyRef = useRef<HTMLTableSectionElement | null>(null);\n const handleBodyRef = useCallback(\n (element: HTMLTableSectionElement | null) => {\n localBodyRef.current = element;\n if (bodyRef) bodyRef.current = element;\n },\n [bodyRef],\n );\n const handleScrollerRef = useCallback(\n (element: HTMLDivElement | null) => {\n scrollerRef.current = element;\n setScrollerEl(element);\n onScrollerRef(element);\n },\n [onScrollerRef],\n );\n\n // Header rows count towards `aria-rowcount`, which must be document-absolute.\n const headerRowCount = isHeaderHidden ? 0 : headerGroupDepth + 1;\n\n /* ── the ARIA row index space ───────────────────────────────────────────\n * Four bands, in the order a screen reader walks them:\n *\n * 1 the header row\n * 2 … 1+top pinned top rows\n * … the body, offset by the pages before this one\n * after the whole body pinned bottom rows\n *\n * Derived once here rather than at each of the four render sites, which is\n * how the body came to be numbered as though the pinned rows above it did\n * not exist while `aria-rowcount` counted them.\n * ─────────────────────────────────────────────────────────────────────── */\n const pinnedTopCount = pinnedTopRows?.length ?? 0;\n const pinnedBottomCount = pinnedBottomRows?.length ?? 0;\n // The whole result, not this page. `rows.length` is the honest fallback when\n // the adapter does not know a total.\n const bodyRowCount = Math.max(\n totalRowCount ?? rows.length,\n rowIndexOffset + rows.length,\n );\n\n /** 1-based `aria-rowindex` for the i-th body row of the current page. */\n const bodyRowIndex = (rowIndex: number) =>\n headerRowCount + pinnedTopCount + rowIndexOffset + rowIndex + 1;\n const bodyRowKey = (row: T, rowIndex: number) =>\n rowKeys?.[rowIndex] ?? getRowKey(row, rowIndex);\n const treeRowState = (rowIndex: number) => {\n const entry = tree?.entries[rowIndex];\n\n return entry\n ? {\n level: entry.level,\n parentKey: entry.parentKey,\n hasChildren: entry.children.length > 0,\n isExpanded: tree.state.expandedKeys.has(entry.key),\n }\n : undefined;\n };\n /** 1-based `aria-rowindex` for the i-th pinned row at `edge`. */\n const pinnedRowIndex = (index: number, edge: 'top' | 'bottom') =>\n edge === 'top'\n ? headerRowCount + index + 1\n : headerRowCount + pinnedTopCount + bodyRowCount + index + 1;\n\n /**\n * Per-column tints.\n *\n * The colour maths is `getColorTheme`'s, cached globally by a hash of its\n * config; `buildColumnTints` only maps columns onto `data-tint` slots and the\n * state maps that read them. `getColorTheme` rather than `useColorTheme` here\n * because the number of tinted columns is data-dependent and a hook cannot be\n * called in a loop — registration happens in `ColumnTintRegistrar` below, one\n * component per distinct theme, which is a legal fixed hook count each.\n */\n const paletteVersion = usePaletteVersion();\n const tints = useMemo(\n () => buildColumnTints(columns, { resolveTheme: getColorTheme }),\n // eslint-disable-next-line react-hooks/exhaustive-deps -- re-derive on a re-seed\n [columns, paletteVersion],\n );\n\n const mergedStyles = useMemo(\n () => ({\n // A table normally fills its flex pane. `min-height: 0` lets the scroller\n // become smaller than its contents instead of forcing that pane taller.\n height: 'min 0',\n flexGrow: 1,\n flexShrink: 1,\n ...styles,\n // Auto-height is a layout mode rather than a styling suggestion: its\n // rows determine the frame even when a wrapper supplied fixed sizing.\n ...(isAutoHeight\n ? { height: 'min 0', flexGrow: 0, flexShrink: 0 }\n : null),\n ...(contentPreset ? { Table: { preset: contentPreset } } : null),\n ...(headerStyles ? { HeadRow: headerStyles } : null),\n ...(headerPreset || headerCellStyles || tints.headerCellStyles\n ? {\n HeaderCell: {\n ...(headerPreset ? { preset: headerPreset } : null),\n ...tints.headerCellStyles,\n // The consumer's own overrides land last, so a `headerCellStyles`\n // that sets `#cell-base` outright still wins over a tint.\n ...headerCellStyles,\n },\n }\n : null),\n ...(headerPreset || headerCellStyles\n ? {\n HeaderGroupCell: {\n ...(headerPreset ? { preset: headerPreset } : null),\n ...headerCellStyles,\n },\n }\n : null),\n ...(bodyStyles ? { Body: bodyStyles } : null),\n ...(rowStyles ? { Row: rowStyles } : null),\n ...(cellStyles || tints.cellStyles\n ? { Cell: { ...tints.cellStyles, ...cellStyles } }\n : null),\n // `rowHeight` first — an exact px answer beats a named step.\n ...(rowHeight != null\n ? { '$row-height': `${rowHeight}px` }\n : rowSizeKey\n ? { '$row-height': `$size-${rowSizeKey.toLowerCase()}` }\n : null),\n ...(headerHeight != null\n ? { '$header-height': `${headerHeight}px` }\n : null),\n }),\n [\n styles,\n isAutoHeight,\n headerStyles,\n headerCellStyles,\n headerPreset,\n contentPreset,\n bodyStyles,\n rowStyles,\n cellStyles,\n rowSizeKey,\n rowHeight,\n headerHeight,\n tints,\n ],\n );\n\n /**\n * Whether a cell is inside the current range.\n *\n * Pinned rows take part: they sit in the range's row order at the position\n * they occupy on screen, so a selection down a column of figures reaches its\n * total instead of leaving it to be copied separately. (ag-grid excludes\n * pinned rows outright; this is a deliberate departure.)\n */\n function isCellSelected(rowKey: Key, columnKey: string) {\n if (!cellSelection?.isEnabled) return false;\n\n return cellSelection.isSelected(rowKey, columnKey);\n }\n\n /**\n * Press and drag for the range.\n *\n * `pointerdown` rather than `click`: the range has to start before the drag\n * does, and a click only lands after the button comes back up — by which time\n * the gesture is over. `pointerenter` grows it while the button is held, which\n * is the same shape ag-grid's `onCellMouseOver` gives the Cloud grids.\n */\n function cellSelectionProps(\n rowKey: Key,\n columnKey: string,\n pinnedEdge?: 'top' | 'bottom',\n ) {\n // A vetoed cell gets no handlers at all, so it is inert rather than merely\n // unpainted: pressing it neither starts a range nor disturbs the standing\n // one, which is how ag-grid treats a press on its row-number column.\n if (!cellSelection?.canSelectCell(rowKey, columnKey)) return undefined;\n\n return {\n onPointerDown: (event: ReactPointerEvent<HTMLTableCellElement>) => {\n // Right-click keeps whatever is selected, so a context menu can act on\n // the range the user has already built.\n if (event.button !== 0) return;\n\n if (event.shiftKey) {\n // Otherwise the browser paints a text selection from the anchor to\n // here, on top of the cell range.\n event.preventDefault();\n cellSelection.extendTo(rowKey, columnKey);\n } else {\n cellSelection.select(rowKey, columnKey);\n }\n\n // The range's keyboard affordances — Escape to clear, ⌘/Ctrl+C to copy\n // — are handled on the scroller, and a `<td>` takes no focus of its\n // own, so a press would otherwise leave focus on `<body>` and neither\n // would ever fire.\n scrollerRef.current?.focus({ preventScroll: true });\n\n cellSelection.isDraggingRef.current = true;\n setIsRangeDragging(true);\n },\n onPointerEnter: () => {\n if (!cellSelection.isDraggingRef.current) return;\n\n // Reachable by press and by shift-click, but never by dragging THROUGH.\n // A pinned row sits over the scrolling ones, so a downward drag brushes\n // it long before reaching the end of the data — and being last in the\n // row order, that would snap the range to the whole rest of the grid.\n if (pinnedEdge) return;\n\n cellSelection.extendTo(rowKey, columnKey);\n },\n };\n }\n\n /**\n * Marks the trailing column.\n *\n * Two things hang off it. Its resize handle tucks fully inside rather than\n * straddling a boundary that is not there — left hanging it puts half its\n * width past the table, and the scroller gains a few pixels of horizontal\n * scroll onto blank space. And it draws no vertical rule: that rule would\n * land flush against the frame and read as a doubled edge.\n */\n /** The pinned edge a row was rendered at, as the documented section name. */\n function sectionOf(pinnedEdge?: 'top' | 'bottom'): CubeTableRowSection {\n if (pinnedEdge === 'top') return 'pinnedTop';\n if (pinnedEdge === 'bottom') return 'pinnedBottom';\n\n return 'body';\n }\n\n function lastColumnFlag(column: CubeResolvedColumn<T>) {\n return column.index === columns.length - 1 ? '' : undefined;\n }\n\n /**\n * Which frame corner, if any, this cell sits in.\n *\n * Only the two bottom ones, and only when the card's rounded edge is what the\n * row actually meets — a footer below it means the row ends against a straight\n * line instead. Without this a selected cell in that row has its ring sliced\n * off at 45° by the frame's radius, which reads as a rendering fault rather\n * than as a corner.\n *\n * Decided here rather than in CSS: the renderer already knows about the\n * footer, the shape and the pinned rows, and expressing\n * `card × no-footer × visually-last-row × outer-column` as a state map is how\n * a border map turns into a combinatorial one.\n */\n function bottomCornerFlag(\n column: CubeResolvedColumn<T>,\n rowIndex: number,\n isLastRow: boolean,\n pinnedEdge?: 'top' | 'bottom',\n ) {\n if (shape !== 'card' || footer != null) return undefined;\n\n const pinnedBottomCount = pinnedBottomRows?.length ?? 0;\n const isVisualLastRow =\n pinnedEdge === 'bottom'\n ? rowIndex === pinnedBottomCount - 1\n : pinnedEdge == null && isLastRow && pinnedBottomCount === 0;\n\n if (!isVisualLastRow) return undefined;\n if (column.index === 0) return 'start';\n if (column.index === columns.length - 1) return 'end';\n\n return undefined;\n }\n\n /**\n * The row band, mirrored from the `<tr>` onto its cells.\n *\n * `Row` already carries `data-odd` and publishes `#row-base` from it, which is\n * all an untinted cell needs. A TINTED cell has to pick its own band, and a\n * sub-element's state keys resolve against the table root rather than its DOM\n * parent — so the flag has to be on the cell itself. Same reason `data-pinned`\n * is mirrored.\n *\n * Pinned rows are exempt: they carry no `data-odd` on the `<tr>` either, and\n * banding a totals row would be wrong.\n */\n function cellBandFlag(rowIndex: number, pinnedEdge?: 'top' | 'bottom') {\n return pinnedEdge == null && isStriped && rowIndex % 2 === 1\n ? ''\n : undefined;\n }\n\n function renderStateRow(content: ReactNode) {\n return (\n <tr data-element=\"Row\" role=\"row\" aria-rowindex={headerRowCount + 1}>\n <td\n data-element=\"StateCell\"\n data-state=\"\"\n role=\"gridcell\"\n colSpan={Math.max(columnCount, 1)}\n aria-colindex={1}\n >\n <div data-element=\"StateContent\">{content}</div>\n </td>\n </tr>\n );\n }\n\n function renderColumnSpacer(\n key: string,\n span: number,\n pinnedEdge?: 'top' | 'bottom',\n isLastRow = false,\n ) {\n return (\n <td\n key={key}\n data-element=\"ColumnSpacer\"\n data-pinned={pinnedEdge}\n data-last-row={isLastRow ? '' : undefined}\n colSpan={span}\n aria-hidden=\"true\"\n role=\"presentation\"\n />\n );\n }\n\n function renderSkeletonCell(column: CubeResolvedColumn<T>) {\n return (\n <td\n key={`column-cell:${column.key}`}\n data-element=\"Cell\"\n data-pin={column.pin}\n data-pin-edge={column.isPinEdge ? '' : undefined}\n data-align={column.align}\n role=\"gridcell\"\n aria-colindex={column.ariaColIndex}\n style={pinStyle(column)}\n >\n {/* The row is `aria-busy`, which already says it is loading. */}\n <PlaceholderGroupContext.Provider value>\n <Placeholder />\n </PlaceholderGroupContext.Provider>\n </td>\n );\n }\n\n function renderSkeletonRows(\n count = skeletonRowCount,\n keyPrefix = 'skeleton',\n ) {\n return Array.from({ length: count }, (_, rowIndex) => (\n <tr\n key={`${keyPrefix}-${rowIndex}`}\n data-element=\"Row\"\n data-placeholder=\"\"\n role=\"row\"\n aria-rowindex={bodyRowIndex(rowIndex)}\n aria-busy=\"true\"\n >\n {bodyColumns.map((segment) =>\n segment.column\n ? renderSkeletonCell(segment.column)\n : renderColumnSpacer(segment.key, segment.span),\n )}\n </tr>\n ));\n }\n\n function renderSelectionHeaderCell(\n column: CubeResolvedColumn<T>,\n rowSpan = 1,\n ) {\n return (\n <th\n key={column.key}\n data-element=\"HeaderCell\"\n data-key={column.key}\n data-kind=\"selection\"\n data-pin={column.pin}\n data-pin-edge={column.isPinEdge ? '' : undefined}\n data-last-column={lastColumnFlag(column)}\n role=\"columnheader\"\n scope=\"col\"\n rowSpan={rowSpan > 1 ? rowSpan : undefined}\n tabIndex={-1}\n aria-colindex={column.ariaColIndex}\n style={pinStyle(column)}\n >\n {selection && selection.selectionMode === 'multiple' ? (\n <div data-element=\"SelectionBox\">\n <Checkbox\n isBare\n aria-label={\n selection.selectAllState === 'all'\n ? t('itemTable.deselectAll', 'Deselect all')\n : t('itemTable.selectAll', 'Select all')\n }\n isSelected={selection.selectAllState === 'all'}\n isIndeterminate={selection.selectAllState === 'some'}\n onChange={selection.toggleSelectAll}\n />\n </div>\n ) : null}\n </th>\n );\n }\n\n function renderSelectionCell(\n column: CubeResolvedColumn<T>,\n row: T,\n rowIndex: number,\n rowKey: Key,\n isLastRow: boolean,\n pinnedEdge?: 'top' | 'bottom',\n ) {\n const canSelect = selection!.canSelect(rowKey);\n const tooltip =\n typeof selectionTooltip === 'function'\n ? selectionTooltip(row)\n : selectionTooltip;\n\n const checkbox = (\n <Checkbox\n isBare\n aria-label={t('itemTable.selectRow', 'Select row')}\n isSelected={selection!.isSelected(rowKey)}\n isIndeterminate={selection!.isIndeterminate(rowKey)}\n isDisabled={!canSelect}\n onChange={() => selection!.toggleRow(rowKey)}\n />\n );\n\n return (\n <td\n key={`column-cell:${column.key}`}\n data-element=\"Cell\"\n data-key={column.key}\n data-kind=\"selection\"\n data-pin={column.pin}\n data-pin-edge={column.isPinEdge ? '' : undefined}\n data-last-row={isLastRow ? '' : undefined}\n data-pinned={pinnedEdge}\n data-odd={cellBandFlag(rowIndex, pinnedEdge)}\n data-last-column={lastColumnFlag(column)}\n data-corner={bottomCornerFlag(column, rowIndex, isLastRow, pinnedEdge)}\n role=\"gridcell\"\n aria-colindex={column.ariaColIndex}\n style={pinStyle(column)}\n // `Checkbox` reports only the next value, so the modifier that decides\n // toggle-vs-extend is read off the event that produced it.\n //\n // `click` rather than `pointerdown`: capture on the cell still runs\n // before the checkbox's own `change` handler, and unlike pointer events\n // it carries the modifier state in every environment — including\n // keyboard activation and jsdom.\n onClickCapture={selection!.captureShift}\n onKeyDownCapture={selection!.captureShift}\n >\n <div data-element=\"SelectionBox\">\n {!canSelect && tooltip ? (\n <TooltipProvider title={tooltip}>{checkbox}</TooltipProvider>\n ) : (\n checkbox\n )}\n </div>\n </td>\n );\n }\n\n function renderRowMenuCell(\n column: CubeResolvedColumn<T>,\n row: T,\n rowIndex: number,\n rowKey: Key,\n isLastRow: boolean,\n pinnedEdge?: 'top' | 'bottom',\n ) {\n const items = resolveRowMenu(row, rowIndex, rowKey);\n\n return (\n <td\n key={`column-cell:${column.key}`}\n data-element=\"Cell\"\n data-key={column.key}\n data-kind=\"actions\"\n data-pin={column.pin}\n data-pin-edge={column.isPinEdge ? '' : undefined}\n data-last-row={isLastRow ? '' : undefined}\n data-pinned={pinnedEdge}\n data-odd={cellBandFlag(rowIndex, pinnedEdge)}\n data-last-column={lastColumnFlag(column)}\n data-corner={bottomCornerFlag(column, rowIndex, isLastRow, pinnedEdge)}\n role=\"gridcell\"\n aria-colindex={column.ariaColIndex}\n style={pinStyle(column)}\n >\n {isMenuEmpty(items) ? null : (\n <div data-element=\"RowActions\">\n <MenuTrigger>\n <ItemAction\n // The grid is one tab stop; in-cell controls are reached with\n // arrow keys, matching `TreeNode`.\n tabIndex={-1}\n icon={<MoreIcon />}\n aria-label={t('itemTable.rowActions', 'Row actions')}\n {...rowMenuTriggerProps}\n />\n <Menu onAction={menuActionHandler(row, rowKey, false)}>\n {items}\n </Menu>\n </MenuTrigger>\n </div>\n )}\n </td>\n );\n }\n\n function renderHeaderCell(column: CubeResolvedColumn<T>, rowSpan = 1) {\n if (column.key === SELECTION_COLUMN_KEY) {\n return renderSelectionHeaderCell(column, rowSpan);\n }\n\n if (column.key === ROW_NUMBER_COLUMN_KEY) {\n // Deliberately unnamed: the numbers are a reading aid, not data, and a\n // column header would invite sorting by them.\n return (\n <th\n key={column.key}\n data-element=\"HeaderCell\"\n data-key={column.key}\n data-kind=\"row-number\"\n data-last-column={lastColumnFlag(column)}\n role=\"columnheader\"\n scope=\"col\"\n rowSpan={rowSpan > 1 ? rowSpan : undefined}\n tabIndex={-1}\n aria-colindex={column.ariaColIndex}\n style={pinStyle(column)}\n />\n );\n }\n\n if (column.key === ROW_MENU_COLUMN_KEY) {\n // An empty header keeps the column in the ARIA geometry without\n // announcing a name for a column that holds no data.\n return (\n <th\n key={column.key}\n data-element=\"HeaderCell\"\n data-key={column.key}\n data-kind=\"actions\"\n data-pin={column.pin}\n data-pin-edge={column.isPinEdge ? '' : undefined}\n data-last-column={lastColumnFlag(column)}\n role=\"columnheader\"\n scope=\"col\"\n rowSpan={rowSpan > 1 ? rowSpan : undefined}\n tabIndex={-1}\n aria-colindex={column.ariaColIndex}\n style={pinStyle(column)}\n />\n );\n }\n\n return renderColumnHeaderCell(column, rowSpan);\n }\n\n /** A data column's header cell: its sort, menu, resize handle and drag. */\n function renderColumnHeaderCell(\n column: CubeResolvedColumn<T>,\n rowSpan: number,\n ) {\n const header = column.header;\n const sortState = resolveColumnSort(column, sortMode, sorts, sort);\n const { activeSort, isSorted, isSortable } = sortState;\n\n // A structural column has no content to make room for, and resizing needs\n // somewhere to write the result.\n const canResize =\n !column.isStructural &&\n (column.isResizable ?? isResizable) &&\n onColumnResize != null &&\n onColumnResizeEnd != null;\n\n const menuItems = columnMenu.resolveColumnMenu(column);\n const hasMenu = menuItems != null;\n\n const content = renderColumnHeaderContent(\n column,\n sortState,\n columnMenu.renderColumnMenuTrigger(column, menuItems, sortState),\n );\n\n const isDraggable = isColumnDraggable(column, isColumnReorderable);\n\n return (\n <TableHeaderCell\n key={column.key}\n columnKey={column.key}\n // Enter belongs to the sort when there is one, so React Aria re-gates\n // its own Enter capture behind Alt.\n hasAction={isSortable}\n isLastDraggable={isDraggable && column.key === lastDraggableKey}\n dragState={isDraggable ? columnDragState : undefined}\n dropState={isDraggable ? columnDropState : undefined}\n cellProps={{\n 'data-element': 'HeaderCell',\n 'data-key': column.key,\n 'data-pin': column.pin,\n 'data-pin-edge': column.isPinEdge ? '' : undefined,\n 'data-align': header?.align ?? column.align,\n 'data-sortable': isSortable ? '' : undefined,\n 'data-resizable': canResize ? '' : undefined,\n 'data-last-column': lastColumnFlag(column),\n 'data-sorted': isSorted ? '' : undefined,\n 'data-menu-open':\n columnMenu.openMenuColumnKey === column.key ? '' : undefined,\n 'data-tint': tintSlot(tints, column.key, 'header'),\n role: 'columnheader',\n scope: 'col',\n rowSpan: rowSpan > 1 ? rowSpan : undefined,\n // A sortable header is a control, so it takes a tab stop — and so does\n // one carrying a menu (Shift+F10 needs somewhere to land) or one that\n // can be moved with Alt+Arrow. Row/cell keyboard navigation lands in a\n // follow-up and will move this to the grid's roving-tabindex model.\n tabIndex: isSortable || hasMenu || isDraggable ? 0 : -1,\n 'aria-colindex': column.ariaColIndex,\n 'aria-sort': activeSort ? ARIA_SORT[activeSort.direction] : undefined,\n 'aria-haspopup': hasMenu ? 'menu' : undefined,\n style: pinStyle(column),\n ...columnHeaderHandlers(column, sortState, hasMenu, isDraggable),\n }}\n >\n {content}\n {canResize ? (\n <ColumnResizer<T>\n column={column}\n label={t('itemTable.resizeColumn', 'Resize column')}\n onResize={onColumnResize!}\n onResizeEnd={onColumnResizeEnd!}\n />\n ) : null}\n </TableHeaderCell>\n );\n }\n\n /**\n * A data column's header as a control: a press or Enter/Space sorts it, a\n * right-click or Shift+F10 opens its menu, and focus feeds Alt+Arrow\n * reordering.\n */\n function columnHeaderHandlers(\n column: CubeResolvedColumn<T>,\n sortState: ColumnSortState,\n hasMenu: boolean,\n isDraggable: boolean,\n ) {\n const { isSortable } = sortState;\n\n return {\n // React Aria's Alt+Arrow reorder reads `focusedKey`, and nothing else\n // sets it — `useDroppableCollection` only ever reads it.\n onFocus: isColumnReorderable\n ? () => onColumnFocus?.(isDraggable ? column.key : null)\n : undefined,\n onClick: isSortable ? () => onColumnSort?.(column.key) : undefined,\n // Both `true` and `'context-only'` answer to a right-click, and\n // `false` already made `hasMenu` false in `resolveColumnMenu`.\n onContextMenu: hasMenu\n ? (event: ReactMouseEvent) =>\n columnMenu.openColumnContextMenu(column, sortState, event)\n : undefined,\n onKeyDown:\n isSortable || hasMenu\n ? (event: ReactKeyboardEvent) => {\n // Shift+F10 is the standard keyboard route to a context menu,\n // and the only route to this one — the trigger is not a tab\n // stop.\n if (event.key === 'F10' && event.shiftKey && hasMenu) {\n columnMenu.openColumnMenuFromKeyboard(column, sortState, event);\n\n return;\n }\n\n if (!isSortable) return;\n if (event.key !== 'Enter' && event.key !== ' ') return;\n // Space would scroll the grid otherwise.\n event.preventDefault();\n onColumnSort?.(column.key);\n }\n : undefined,\n };\n }\n\n function renderCell(\n column: CubeResolvedColumn<T>,\n row: T,\n rowIndex: number,\n rowKey: Key,\n isLastRow: boolean,\n // The row's pinned edge, mirrored onto its cells. Cells are what draw the\n // borders and the fill, and a sub-element cannot ask about its DOM parent's\n // mods — state keys inside `Cell` resolve against the table root.\n pinnedEdge?: 'top' | 'bottom',\n treeItemAria?: ReturnType<typeof useTreeItem>,\n ) {\n // Section-qualified, because the same record is routinely pinned at both\n // edges. `rowKey` below stays the consumer's own — this identity is the\n // range's alone.\n const rangeKey = selectionRowKey(sectionOf(pinnedEdge), rowKey);\n if (column.key === SELECTION_COLUMN_KEY) {\n return renderSelectionCell(\n column,\n row,\n rowIndex,\n rowKey,\n isLastRow,\n pinnedEdge,\n );\n }\n\n if (column.key === ROW_NUMBER_COLUMN_KEY) {\n return (\n <td\n key={`column-cell:${column.key}`}\n data-element=\"Cell\"\n data-key={column.key}\n data-kind=\"row-number\"\n data-last-row={isLastRow ? '' : undefined}\n data-pinned={pinnedEdge}\n data-odd={cellBandFlag(rowIndex, pinnedEdge)}\n data-last-column={lastColumnFlag(column)}\n data-corner={bottomCornerFlag(\n column,\n rowIndex,\n isLastRow,\n pinnedEdge,\n )}\n role=\"gridcell\"\n aria-colindex={column.ariaColIndex}\n style={pinStyle(column)}\n >\n {/*\n A pinned row is not numbered. It sits outside the sequence — a\n total is not row 1 — and numbering it would repeat a number the\n scrolling rows already own.\n */}\n {pinnedEdge ? null : rowNumberOffset + rowIndex + 1}\n </td>\n );\n }\n\n if (column.key === ROW_MENU_COLUMN_KEY) {\n return renderRowMenuCell(\n column,\n row,\n rowIndex,\n rowKey,\n isLastRow,\n pinnedEdge,\n );\n }\n\n const ctx: CubeTableCellContext<T> = {\n row,\n rowKey,\n rowIndex,\n columnKey: column.key,\n columnIndex: column.index,\n section: sectionOf(pinnedEdge),\n // The ROW's selection, matching the field's siblings (`isRowFocused`).\n // Cell-range membership is a different question and has its own answer in\n // `data-cell-selected`.\n isSelected: selection?.isSelected(rowKey) ?? false,\n tree: pinnedEdge == null ? treeRowState(rowIndex) : undefined,\n };\n\n const content = renderCellContent(column, row, rowIndex, ctx);\n\n const treeEntry = pinnedEdge == null ? tree?.entries[rowIndex] : undefined;\n const displayContent =\n treeEntry && column.key === tree?.columnKey\n ? renderTreeCellContent(\n treeEntry,\n tree.state.expandedKeys.has(treeEntry.key),\n treeItemAria?.expandButtonProps,\n content,\n )\n : content;\n\n // Resolved through tasty, not spread into `style`: the type is `Styles`, and\n // an inline style takes none of its tokens, units or state maps — a\n // `#surface-text-soft-2` there is an invalid value the browser drops.\n const columnClassName = columnCellClassName(\n typeof column.cellStyles === 'function'\n ? column.cellStyles(ctx)\n : column.cellStyles,\n );\n const extraCellProps = column.cellProps?.(ctx);\n\n const CellTag = column.isRowHeader ? 'th' : 'td';\n\n // The link lives in the row-header cell but stretches over the whole row:\n // a `<tr>` cannot be wrapped in an `<a>`, and this is the one cell whose\n // text is the row's accessible name. ⌘-click, middle-click and \"Open in\n // new tab\" then work natively, which an onClick handler can never give.\n const link = column.isRowHeader ? rowLink?.(row, rowIndex) : undefined;\n\n return (\n <CellTag\n key={`column-cell:${column.key}`}\n data-element=\"Cell\"\n data-key={column.key}\n data-pin={column.pin}\n data-pin-edge={column.isPinEdge ? '' : undefined}\n data-align={column.align}\n data-wrap={column.autoHeight ? '' : undefined}\n data-link={link !== undefined ? '' : undefined}\n data-last-row={isLastRow ? '' : undefined}\n data-pinned={pinnedEdge}\n data-odd={cellBandFlag(rowIndex, pinnedEdge)}\n data-tint={tintSlot(\n tints,\n column.key,\n pinnedEdge == null ? 'body' : 'totals',\n )}\n data-last-column={lastColumnFlag(column)}\n data-corner={bottomCornerFlag(column, rowIndex, isLastRow, pinnedEdge)}\n data-cell-selected={\n isCellSelected(rangeKey, column.key) ? '' : undefined\n }\n {...(column.isRowHeader\n ? { scope: 'row' as const }\n : { role: 'gridcell' as const })}\n {...cellSelectionProps(rangeKey, column.key, pinnedEdge)}\n aria-colindex={column.ariaColIndex}\n // The anchor the column class's rule is built on (`column-styles.ts`).\n data-column-styles={columnClassName ? '' : undefined}\n style={pinStyle(column)}\n {...extraCellProps}\n // Joined rather than replaced, so a `className` from `cellProps` does\n // not silently drop the column's styles.\n className={\n clsx(columnClassName, extraCellProps?.className) || undefined\n }\n >\n {displayContent}\n {link !== undefined ? (\n <Action\n data-element=\"RowLink\"\n to={link}\n // The row is the tab stop; the link is reached through it.\n tabIndex={-1}\n aria-label={getColumnText(column, row, rowIndex) ?? undefined}\n />\n ) : null}\n </CellTag>\n );\n }\n\n /**\n * A pinned row — a total or subtotal.\n *\n * Rendered inside `<tbody>` rather than `<thead>`/`<tfoot>` so it keeps the\n * body's own row and cell styling: the sub-element chains are anchored to\n * `Body`, and a row in the head would match none of them. `data-pinned`\n * carries the stickiness instead.\n */\n function renderPinnedRow(row: T, index: number, edge: 'top' | 'bottom') {\n // The consumer's own key, not a positional one: a cell range spans pinned\n // and scrolling rows alike, so both have to answer to the same identity.\n const rowKey = getRowKey(row, index);\n\n return (\n <tr\n key={`pinned-${edge}-${rowKey}`}\n data-element=\"Row\"\n data-pinned={edge}\n role=\"row\"\n aria-rowindex={pinnedRowIndex(index, edge)}\n >\n {bodyColumns.map((segment) =>\n segment.column\n ? renderCell(segment.column, row, index, rowKey, false, edge)\n : renderColumnSpacer(segment.key, segment.span, edge),\n )}\n </tr>\n );\n }\n\n /** The cells of one body row. Shared by both render paths. */\n function renderRowCells(\n row: T,\n rowIndex: number,\n treeItemAria?: ReturnType<typeof useTreeItem>,\n ) {\n const rowKey = bodyRowKey(row, rowIndex);\n\n return bodyColumns.map((segment) =>\n segment.column\n ? renderCell(\n segment.column,\n row,\n rowIndex,\n rowKey,\n rowIndex === rows.length - 1,\n undefined,\n treeItemAria,\n )\n : renderColumnSpacer(\n segment.key,\n segment.span,\n undefined,\n rowIndex === rows.length - 1,\n ),\n );\n }\n\n /**\n * The `<tr>` shell. Virtuoso owns the element in the virtualized path (it\n * needs its own `style` and measurement attributes), so this returns the\n * props rather than the element.\n */\n function getRowElementProps(row: T, rowIndex: number) {\n const rowKey = bodyRowKey(row, rowIndex);\n const isSelected = selection?.isSelected(rowKey) ?? false;\n const ctx: CubeTableRowContext<T> = {\n row,\n rowKey,\n rowIndex,\n section: 'body',\n isSelected,\n tree: treeRowState(rowIndex),\n };\n const extra = getRowProps?.(ctx);\n\n return {\n 'data-element': 'Row',\n 'data-key': String(rowKey),\n // Lets a pointer or keyboard event resolve back to its row without a\n // closure per row.\n 'data-row-index': rowIndex,\n 'data-qa': extra?.qa,\n 'data-odd': isStriped && rowIndex % 2 === 1 ? '' : undefined,\n 'data-dimmed': extra?.isDimmed ? '' : undefined,\n 'data-selected': isSelected ? '' : undefined,\n 'data-disabled': selection?.isRowDisabled(rowKey) ? '' : undefined,\n role: 'row',\n // Only the resting row takes a tab stop; the rest are reached with the\n // arrow keys. Off entirely when nothing on the row is operable.\n tabIndex:\n !tree && isReorderable\n ? rowIndex === focusedRowIndex\n ? 0\n : -1\n : undefined,\n // Only meaningful in a selectable grid; announcing \"not selected\" on\n // every row of a plain table is noise.\n 'aria-selected': selection?.isEnabled ? isSelected : undefined,\n 'aria-rowindex': bodyRowIndex(rowIndex),\n title: extra?.tooltip,\n height: extra?.height,\n 'data-clickable':\n onRowAction != null || rowLink?.(row, rowIndex) !== undefined\n ? ''\n : undefined,\n onClick:\n onRowAction != null\n ? (event: ReactMouseEvent) => {\n // A click that landed on a control inside the cell belongs to\n // that control — the row must not also act on it.\n if (\n (event.target as HTMLElement).closest(\n 'a, button, input, select, textarea, [role=\"button\"], [role=\"menuitem\"]',\n )\n ) {\n return;\n }\n\n onRowAction(row, rowKey);\n }\n : undefined,\n onContextMenu: isMenuEnabled\n ? (event: ReactMouseEvent) =>\n openContextMenuFor(row, rowIndex, rowKey, event)\n : undefined,\n ...Object.fromEntries(\n Object.entries(extra?.mods ?? {})\n .filter(([, active]) => active)\n .map(([name]) => [`data-${name}`, '']),\n ),\n } as Record<string, any>;\n }\n\n function renderRow(row: T, rowIndex: number, isVirtual = false) {\n const { height, ...rowProps } = getRowElementProps(row, rowIndex);\n const rowKey = bodyRowKey(row, rowIndex);\n const treeNode = tree?.nodes[rowIndex];\n const treeEntry = tree?.entries[rowIndex];\n\n return (\n <TableRow\n key={rowProps['data-key']}\n rowKey={rowKey}\n rowProps={rowProps}\n height={height}\n index={isVirtual ? rowIndex : undefined}\n measureRef={isVirtual ? virtualizer.measureElement : undefined}\n dragState={isReorderable ? dragState : undefined}\n dropState={isReorderable ? dropState : undefined}\n tree={\n treeNode && treeEntry\n ? {\n state: tree.state,\n node: treeNode,\n entry: treeEntry,\n isVirtualized: isVirtual,\n }\n : undefined\n }\n >\n {(treeItemAria) => renderRowCells(row, rowIndex, treeItemAria)}\n </TableRow>\n );\n }\n\n function renderSpacerRow(height: number, position: 'top' | 'bottom') {\n if (height <= 0) return null;\n\n return (\n <tr aria-hidden=\"true\" data-spacer={position}>\n <td colSpan={Math.max(columnCount, 1)} style={{ height }} />\n </tr>\n );\n }\n\n /**\n * A row, preceded by the line showing a drop above it — and followed by one\n * for the very last row, which has nothing after it to carry a \"before\".\n *\n * The indicators render nothing unless a drag is in flight, so a table that\n * is merely *capable* of dragging keeps its ordinary structure.\n */\n function withDropIndicators(row: T, index: number, isVirtual = false) {\n const rowKey = bodyRowKey(row, index);\n const rowNode = renderRow(row, index, isVirtual);\n\n if (!isReorderable || !dropState) return rowNode;\n\n return (\n <Fragment key={`row-${String(rowKey)}`}>\n <TableRowDropIndicator\n rowKey={rowKey}\n dropPosition=\"before\"\n dropState={dropState}\n columnCount={columnCount}\n />\n {rowNode}\n {index === rows.length - 1 ? (\n <TableRowDropIndicator\n rowKey={rowKey}\n dropPosition=\"after\"\n dropState={dropState}\n columnCount={columnCount}\n />\n ) : null}\n </Fragment>\n );\n }\n\n const hasRows = rows.length > 0;\n\n // How a refresh over an existing result is presented. `overlay` keeps the\n // previous rows on screen (dimmed, behind a spinner) so a server page or a\n // re-sort does not blank the table; `skeleton` discards them; `none` leaves\n // the visuals entirely to the consumer and only sets `aria-busy`.\n // `overlay` is the only behaviour that paints: the rows dim and a spinner\n // sits over them. `none` deliberately leaves them untouched.\n const isStale = isLoading && hasRows && loadingIndicator === 'overlay';\n const showSkeleton =\n isLoading &&\n loadingIndicator !== 'none' &&\n (!hasRows || loadingIndicator === 'skeleton');\n // Without rows and without an indicator there is nothing to say yet —\n // rendering the empty state would flash \"No items\" before the first response.\n const showBlank = isLoading && !hasRows && loadingIndicator === 'none';\n\n const shouldVirtualize =\n !isAutoHeight &&\n hasRows &&\n error == null &&\n (isVirtualized === true ||\n (isVirtualized === 'auto' && rows.length > virtualizeThreshold));\n\n // TanStack invalidates every cached position when this callback changes.\n // Keep its wiring stable during scroll renders, including without Compiler.\n const getItemKey = useCallback(\n (index: number) =>\n String(rowKeys?.[index] ?? getRowKey(rows[index], index)),\n [rows, rowKeys, getRowKey],\n );\n\n // `getScrollElement` is read from a ref, not the state value: the virtualizer\n // consults it from a layout effect, and a closure over state can still hold\n // the `null` from the first render.\n const estimatedRowHeight =\n (rowHeight ??\n (rowSizeKey\n ? SIZES[rowSizeKey]\n : ESTIMATED_ROW_HEIGHT[size ?? 'medium'])) + 1;\n const virtualizer = useVirtualizer({\n count: shouldVirtualize ? rows.length : 0,\n getScrollElement: () => scrollerRef.current,\n getItemKey,\n estimateSize: () => estimatedRowHeight,\n measureElement: (element) => element.getBoundingClientRect().height,\n // Rows beyond each viewport edge. Higher than a list's, because a fast\n // flick outruns React's re-render and the gap shows as blank rows — and a\n // table row is one element, not one per column, so the extra ones are\n // cheap.\n overscan,\n });\n\n // Key identity no longer resets estimates on every render. Size changes do.\n useLayoutEffect(() => {\n virtualizer.measure();\n // Rebuild positions before remeasurement compares old and new row sizes.\n virtualizer.getTotalSize();\n localBodyRef.current\n ?.querySelectorAll<HTMLTableRowElement>('tr[data-index]')\n .forEach((element) => virtualizer.measureElement(element));\n }, [estimatedRowHeight, virtualizer]);\n useTableTooltipRefresh(\n scrollerEl,\n virtualizer.isScrolling,\n refreshAppearance,\n resetRange,\n );\n\n const focusedTreeKey = tree?.state.selectionManager.focusedKey;\n useEffect(() => {\n if (!shouldVirtualize || focusedTreeKey == null || !tree) return;\n\n const index = tree.entries.findIndex(\n (entry) => entry.key === focusedTreeKey,\n );\n if (index >= 0) virtualizer.scrollToIndex(index, { align: 'auto' });\n }, [focusedTreeKey, shouldVirtualize, tree, virtualizer]);\n\n const scrollability = useScrollability(scrollerEl);\n\n /**\n * Roving tabindex over the rows, so a reorderable table can be operated from\n * the keyboard at all.\n *\n * React Aria's `dragProps` already describe \"press Enter to start dragging\"\n * and implement the whole keyboard drag — but a `<tr>` is not focusable, so\n * without this the description is announced for a row nobody can reach. One\n * tab stop for the grid, arrows to move within it, matching how every other\n * collection in the kit behaves.\n */\n // Not while a drag is in flight: React Aria is already moving the row under\n // the pointer, and a second transform fighting it reads as a stutter.\n useRowMoveAnimation({\n isEnabled: isRowMoveAnimated && !dragState?.draggingKeys?.size,\n bodyRef: localBodyRef,\n });\n\n /**\n * How many rows the next batch is likely to bring, measured across the last\n * fetch that actually happened.\n *\n * The placeholder burst is sized to this so the scroll height is right both\n * before and after the load: a short burst under a long batch makes the\n * content jump the moment the rows land, and leaves the user stopped at the\n * bottom of the list in the meantime with nothing left to scroll into.\n *\n * Measured across `isLoadingMore`, not from any growth in `rows`. Plenty of\n * things lengthen the list without being a fetch — clearing a client search\n * over an infinite list restores every filtered-out row at once — and reading\n * that as a batch of ninety sized the next burst at ninety.\n *\n * Measured at all, rather than taken from `pageSize`, because infinite-scroll\n * consumers often do not set it.\n */\n const lastBatchSizeRef = useRef(0);\n const rowCountBeforeFetchRef = useRef<number | null>(null);\n\n useEffect(() => {\n if (isLoadingMore) {\n rowCountBeforeFetchRef.current = rows.length;\n\n return;\n }\n\n const before = rowCountBeforeFetchRef.current;\n\n if (before != null && rows.length > before) {\n lastBatchSizeRef.current = rows.length - before;\n }\n\n rowCountBeforeFetchRef.current = null;\n // Deliberately keyed on the flag alone: the row count wanted is the one at\n // each edge of the fetch, not every value it passes through.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isLoadingMore]);\n\n const loadMoreSkeletonCount = Math.min(\n // Until a fetch has been measured, the rows already loaded are the best\n // guess at what the next batch brings — that IS the first page.\n Math.max(lastBatchSizeRef.current || rows.length || skeletonRowCount, 1),\n MAX_LOAD_MORE_SKELETON_ROWS,\n );\n\n const [focusedRowIndex, setFocusedRowIndex] = useState(0);\n // Only used to suppress text selection during the gesture; the range itself\n // lives in a ref so growing it does not re-render on every cell crossed.\n const [isRangeDragging, setIsRangeDragging] = useState(false);\n\n // The button can come up outside the grid — over the footer, over another\n // component, off the window entirely — so the end of the gesture is watched\n // globally rather than on the cell the drag started in.\n useEffect(() => {\n if (!isRangeDragging) return;\n\n const end = () => {\n if (cellSelection) cellSelection.isDraggingRef.current = false;\n setIsRangeDragging(false);\n };\n\n window.addEventListener('pointerup', end);\n window.addEventListener('pointercancel', end);\n\n return () => {\n window.removeEventListener('pointerup', end);\n window.removeEventListener('pointercancel', end);\n };\n }, [isRangeDragging, cellSelection]);\n\n const moveRowFocus = useEvent((from: HTMLElement, delta: number) => {\n const current = from.closest('tr[data-element=\"Row\"]');\n const all = Array.from(\n scrollerRef.current?.querySelectorAll<HTMLTableRowElement>(\n 'tbody tr[data-element=\"Row\"]:not([data-placeholder])',\n ) ?? [],\n );\n\n if (!all.length) return false;\n\n const index = current ? all.indexOf(current as HTMLTableRowElement) : -1;\n const next = Math.min(\n Math.max((index === -1 ? focusedRowIndex : index) + delta, 0),\n all.length - 1,\n );\n\n setFocusedRowIndex(next);\n all[next]?.focus();\n\n return true;\n });\n\n /* ── infinite scroll ────────────────────────────────────────────────────\n * An `IntersectionObserver` on a sentinel row rather than a scroll handler:\n * `rootMargin` expresses \"prefetch this far before the end\" directly, it\n * costs nothing per scroll tick, and it works on both render paths — under\n * virtualization the trailing spacer holds the remaining height, so the\n * sentinel after it still marks the true end of the list.\n * ──────────────────────────────────────────────────────────────────────── */\n const sentinelRef = useRef<HTMLDivElement>(null);\n const onLoadMoreEvent = useEvent(() => onLoadMore?.());\n\n useEffect(() => {\n const sentinel = sentinelRef.current;\n\n // Re-armed whenever `isLoadingMore` flips, so a request in flight cannot be\n // fired again by the sentinel still sitting in view.\n if (!onLoadMore || !hasMore || isLoadingMore || !scrollerEl || !sentinel) {\n return;\n }\n\n // One screen ahead by default: the request goes out while the user still\n // has a viewport of rows left to read, so the batch is usually there before\n // they arrive. Read at arm time rather than tracked — a resize mid-scroll\n // leaves the margin slightly stale, which costs nothing.\n const margin =\n loadMoreMargin ?? Math.max(scrollerEl.clientHeight, MIN_LOAD_MORE_MARGIN);\n\n const observer = new IntersectionObserver(\n (entries) => {\n if (entries.some((entry) => entry.isIntersecting)) onLoadMoreEvent();\n },\n { root: scrollerEl, rootMargin: `0px 0px ${margin}px 0px` },\n );\n\n observer.observe(sentinel);\n\n return () => observer.disconnect();\n }, [\n onLoadMore,\n hasMore,\n isLoadingMore,\n scrollerEl,\n loadMoreMargin,\n onLoadMoreEvent,\n rows.length,\n ]);\n\n /* ── row menu ───────────────────────────────────────────────────────────\n * One instance for the whole table rather than one per row: a table can hold\n * thousands of rows, and only ever one context menu is open.\n *\n * `targetRef` is deliberately left unattached, which keeps the hook's own\n * `contextmenu` listener unbound — it would open with fixed props, and the\n * items depend on which row was right-clicked. The handler below resolves the\n * row first and then opens with that row's items; with no target, the hook\n * positions from the event's viewport coordinates, which is what a\n * pointer-anchored menu wants anyway.\n * ──────────────────────────────────────────────────────────────────────── */\n const contextMenu = useContextMenu<HTMLDivElement, any>(Menu, {\n placement: 'bottom start',\n });\n\n const isMenuEnabled = rowMenu != null && rowContextMenu !== false;\n const hasMenuColumn = isMenuEnabled && rowContextMenu !== 'context-only';\n\n function resolveRowMenu(row: T, rowIndex: number, rowKey: Key) {\n if (!rowMenu) return null;\n\n return rowMenu(row, {\n row,\n rowKey,\n rowIndex,\n section: 'body',\n isSelected: selection?.isSelected(rowKey) ?? false,\n isFocused: false,\n isDropTarget: false,\n });\n }\n\n function menuActionHandler(row: T, rowKey: Key, closeAfter: boolean) {\n return (action: Key) => {\n onRowMenuAction?.(normalizeMenuAction(action), row, rowKey);\n\n // `useContextMenu` leaves its popover open after an action — the same\n // happens in `Tree`, so it is the hook's behaviour rather than this\n // table's. Closing here keeps the row menu correct meanwhile; drop this\n // once the hook closes on select itself.\n if (closeAfter) contextMenu.close();\n };\n }\n\n const openContextMenuFor = useEvent(\n (\n row: T,\n rowIndex: number,\n rowKey: Key,\n event: ReactMouseEvent | ReactKeyboardEvent,\n ) => {\n const items = resolveRowMenu(row, rowIndex, rowKey);\n\n // No items means no menu — falling through to the browser's own context\n // menu is more useful than opening an empty popover.\n if (isMenuEmpty(items)) return;\n\n event.preventDefault();\n contextMenu.open(\n { children: items, onAction: menuActionHandler(row, rowKey, true) },\n undefined,\n // Shift+F10 carries no coordinates; the hook then anchors on the\n // element that produced the event, which is the row.\n 'clientX' in event.nativeEvent\n ? (event.nativeEvent as MouseEvent)\n : undefined,\n );\n },\n );\n\n /* ── column menu ─────────────────────────────────────────────────────────\n * Shares the `contextMenu` instance above. A header right-click is the same\n * pointer-anchored popover with different children, and attaching the hook's\n * `targetRef` to a `<th>` would bind its listener with fixed props — the same\n * reason the row menu leaves it unattached.\n * ──────────────────────────────────────────────────────────────────────── */\n const columnMenu = useColumnMenu<T>({\n contextMenu,\n columnContextMenu,\n columnMenuProps,\n columnMenuTriggerProps,\n onColumnSortChange,\n onColumnMenuAction,\n });\n\n /** Resolves the row a pointer or keyboard event landed in. */\n function rowFromEvent(target: EventTarget | null) {\n const element = (target as HTMLElement | null)?.closest?.(\n 'tr[data-element=\"Row\"][data-key]',\n );\n\n if (!element) return null;\n\n const index = Number(element.getAttribute('data-row-index'));\n\n if (!Number.isInteger(index)) return null;\n\n const row = rows[index];\n\n return row === undefined\n ? null\n : { row, index, key: bodyRowKey(row, index) };\n }\n\n const virtualItems = shouldVirtualize ? virtualizer.getVirtualItems() : [];\n const paddingTop = virtualItems.length ? virtualItems[0].start : 0;\n const paddingBottom = virtualItems.length\n ? virtualizer.getTotalSize() - virtualItems[virtualItems.length - 1].end\n : 0;\n\n const colGroup = (\n <colgroup>\n {columns.map((column) => (\n <col\n key={column.key}\n style={column.width != null ? { width: column.width } : undefined}\n />\n ))}\n </colgroup>\n );\n\n function pathsSharePrefix(\n left: readonly CubeTableColumnGroupHeader[],\n right: readonly CubeTableColumnGroupHeader[],\n depth: number,\n ) {\n for (let index = 0; index <= depth; index++) {\n if (left[index]?.key !== right[index]?.key) return false;\n }\n\n return true;\n }\n\n function renderHeaderGroupCell(\n group: CubeTableColumnGroupHeader,\n segment: readonly CubeResolvedColumn<T>[],\n depth: number,\n ) {\n const first = segment[0];\n const last = segment[segment.length - 1];\n const pin = segment.every((column) => column.pin === first.pin)\n ? first.pin\n : undefined;\n const pinOffset =\n pin === 'start' ? first.pinOffset : pin === 'end' ? last.pinOffset : null;\n\n return (\n <th\n key={`${depth}:${first.key}:${group.key}`}\n data-element=\"HeaderGroupCell\"\n data-key={group.key}\n data-pin={pin}\n data-pin-edge={\n segment.some((column) => column.isPinEdge) ? '' : undefined\n }\n data-last-column={last.index === columnCount - 1 ? '' : undefined}\n data-align=\"center\"\n role=\"columnheader\"\n scope=\"colgroup\"\n tabIndex={-1}\n aria-colindex={first.ariaColIndex}\n colSpan={segment.length}\n style={\n pinOffset == null\n ? undefined\n : { ['--pin-offset' as any]: `${pinOffset}px` }\n }\n >\n <TableHeaderItem>{group.title}</TableHeaderItem>\n </th>\n );\n }\n\n function renderHeaderRowCells(depth: number) {\n const cells: ReactNode[] = [];\n\n for (let columnIndex = 0; columnIndex < columns.length; ) {\n const column = columns[columnIndex];\n const path = columnHeaderPaths?.get(column.key) ?? [];\n\n // This column's leaf header began on an earlier row and spans this one.\n if (path.length < depth) {\n columnIndex++;\n continue;\n }\n\n if (path.length === depth) {\n cells.push(renderHeaderCell(column, headerRowCount - depth));\n columnIndex++;\n continue;\n }\n\n let segmentEnd = columnIndex + 1;\n\n while (segmentEnd < columns.length) {\n const nextPath = columnHeaderPaths?.get(columns[segmentEnd].key) ?? [];\n\n if (\n nextPath.length <= depth ||\n columns[segmentEnd].pin !== column.pin ||\n !pathsSharePrefix(path, nextPath, depth)\n ) {\n break;\n }\n\n segmentEnd++;\n }\n\n cells.push(\n renderHeaderGroupCell(\n path[depth],\n columns.slice(columnIndex, segmentEnd),\n depth,\n ),\n );\n columnIndex = segmentEnd;\n }\n\n return cells;\n }\n\n const headerRows = isHeaderHidden\n ? null\n : Array.from({ length: headerRowCount }, (_, depth) => {\n const isLeafRow = depth === headerRowCount - 1;\n\n return (\n <tr\n key={depth}\n data-element=\"HeadRow\"\n role=\"row\"\n aria-rowindex={depth + 1}\n ref={isLeafRow ? headRowRef : undefined}\n {...(isLeafRow ? headCollectionProps : undefined)}\n onKeyDownCapture={\n isLeafRow\n ? (event) => {\n // `DraggableCollection`'s Alt+Arrow reorder sits on this\n // row and fires in capture, so it would beat the resize\n // handle's own Alt+Arrow bubble handler.\n if (\n (event.target as HTMLElement)?.closest?.(\n '[data-element=\"Resizer\"]',\n )\n ) {\n return;\n }\n\n (headCollectionProps as any)?.onKeyDownCapture?.(event);\n }\n : undefined\n }\n >\n {renderHeaderRowCells(depth)}\n </tr>\n );\n });\n\n const tableProps = {\n 'data-element': 'Table',\n role: tree ? 'treegrid' : 'grid',\n 'aria-label': ariaLabel,\n 'aria-busy': isLoading || undefined,\n 'aria-rowcount':\n headerRowCount + pinnedTopCount + bodyRowCount + pinnedBottomCount,\n 'aria-colcount': columnCount,\n 'aria-multiselectable':\n selection?.selectionMode === 'multiple' ? true : undefined,\n } as const;\n\n const tableStyle =\n layout.totalWidth != null ? { width: layout.totalWidth } : undefined;\n\n /**\n * What `<tbody>` holds between the pinned rows: the error, the loading\n * skeleton, nothing at all, the empty state, or the rows — in that order of\n * precedence.\n */\n function renderBodyContent(): ReactNode {\n if (error != null) return renderStateRow(error);\n if (showSkeleton) return renderSkeletonRows();\n if (showBlank) return null;\n if (!hasRows) {\n return renderStateRow(isFiltered ? noResultsLabel : emptyLabel);\n }\n\n if (shouldVirtualize) {\n return (\n <>\n {renderSpacerRow(paddingTop, 'top')}\n {virtualItems.map((v) =>\n withDropIndicators(rows[v.index], v.index, true),\n )}\n {renderSpacerRow(paddingBottom, 'bottom')}\n </>\n );\n }\n\n return rows.map((row, index) => withDropIndicators(row, index));\n }\n\n const bodyContent = renderBodyContent();\n\n const tableContent = (\n <>\n {colGroup}\n {isHeaderHidden ? null : <thead data-element=\"Head\">{headerRows}</thead>}\n <tbody data-element=\"Body\" {...collectionProps} ref={handleBodyRef}>\n {pinnedTopRows?.map((row, index) => renderPinnedRow(row, index, 'top'))}\n {bodyContent}\n {pinnedBottomRows?.map((row, index) =>\n renderPinnedRow(row, index, 'bottom'),\n )}\n {isLoadingMore\n ? renderSkeletonRows(loadMoreSkeletonCount, 'load-more')\n : null}\n {onLoadMore && hasRows ? (\n <tr data-sentinel=\"\" aria-hidden=\"true\">\n <td\n colSpan={Math.max(columnCount, 1)}\n style={{ height: 1, padding: 0, border: 0 }}\n >\n <div ref={sentinelRef} style={{ height: 1 }} />\n </td>\n </tr>\n ) : null}\n </tbody>\n </>\n );\n\n // Before the first measure there are no columns to lay out yet — show the\n // generic table skeleton rather than an empty frame.\n //\n // Returned HERE, below every hook, not at the point in the render where the\n // condition is known. Returning early skipped sixteen hooks — the virtualizer,\n // the scrollability observer, the move animation, the context menu, two\n // `useState`s — so the first render with columns called more hooks than the\n // last one without them, and React threw \"Rendered more hooks than during the\n // previous render\". A consumer that mounts with `columns={[]}` while loading\n // and fills them in from a response is the ordinary case, not an exotic one.\n if (columnCount === 0 && isLoading) {\n return (\n <TableElement\n ref={rootRef}\n qa={qa || 'Table'}\n styles={mergedStyles}\n mods={{ size, shape, ...mods }}\n >\n {toolbar}\n <div data-element=\"Scroller\" ref={handleScrollerRef}>\n <Skeleton layout=\"table\" />\n </div>\n </TableElement>\n );\n }\n\n return (\n <TableElement\n ref={rootRef}\n qa={qa || 'Table'}\n styles={mergedStyles}\n mods={{\n size,\n shape,\n 'sticky-header': isHeaderSticky,\n 'column-dividers': hasColumnDividers,\n 'range-dragging': isRangeDragging,\n // The footer's top border is the closing edge, so the last row must not\n // draw one as well.\n 'has-footer': footer != null,\n 'scroll-x': scrollability.x,\n 'scroll-y': scrollability.y,\n stale: isStale,\n ...mods,\n }}\n >\n {toolbar}\n <div\n data-element=\"Scroller\"\n ref={handleScrollerRef}\n // Focusable only programmatically: a cell press moves focus here so the\n // range's shortcuts land, but the grid stays a single tab stop.\n tabIndex={cellSelection?.isEnabled ? -1 : undefined}\n // Escape is the standard way out of a selection, and it must work from\n // wherever focus happens to be inside the table.\n onKeyDown={(event) => {\n // Shift+F10 is the standard way to reach a context menu from the\n // keyboard, and the only way when there is no `⋮` trigger.\n if (event.key === 'F10' && event.shiftKey && isMenuEnabled) {\n const found = rowFromEvent(event.target);\n\n if (found) {\n event.stopPropagation();\n openContextMenuFor(found.row, found.index, found.key, event);\n }\n\n return;\n }\n\n if (event.key === 'Enter' && onRowAction) {\n const found = rowFromEvent(event.target);\n\n // Enter on a control inside the cell belongs to that control.\n if (\n found &&\n !(event.target as HTMLElement).closest(\n 'a, button, input, select, textarea, [role=\"button\"]',\n )\n ) {\n onRowAction(found.row, found.key);\n }\n\n return;\n }\n\n if (\n !tree &&\n isReorderable &&\n (event.key === 'ArrowDown' || event.key === 'ArrowUp')\n ) {\n // Not while a drag is in flight — the arrows then belong to React\n // Aria, which uses them to choose the drop position.\n if (dragState?.draggingKeys?.size) return;\n\n if (\n moveRowFocus(\n event.target as HTMLElement,\n event.key === 'ArrowDown' ? 1 : -1,\n )\n ) {\n event.preventDefault();\n }\n\n return;\n }\n\n if (event.key === 'Escape') {\n if (cellSelection?.range) {\n event.stopPropagation();\n cellSelection.clear();\n\n return;\n }\n\n if (selection?.isEnabled && selection.selectedCount > 0) {\n event.stopPropagation();\n selection.clearSelection();\n }\n }\n }}\n // `onCopy` rather than a ⌘/Ctrl+C keydown: it is the event the browser\n // already fires for the shortcut AND for Edit ▸ Copy, and writing\n // through `clipboardData` needs no permission prompt. Both `text/plain`\n // and `text/html` go on, so Excel and Sheets paste a grid rather than\n // one run of text.\n onCopy={(event) => {\n if (!cellSelection?.range) return;\n\n const matrix = cellSelection.getSelectionMatrix(\n (column, row, rowIndex) =>\n column.isStructural\n ? ''\n : getColumnText(column, row, rowIndex) ?? '',\n );\n\n if (!matrix.length) return;\n\n // Both formats from the same matrix. Building the HTML by re-parsing\n // the TSV tore any cell whose value contained a tab or a newline —\n // exactly the values the TSV had to quote in the first place.\n event.preventDefault();\n event.clipboardData.setData('text/plain', toTsv(matrix));\n event.clipboardData.setData('text/html', toClipboardHtml(matrix));\n\n // A copy that writes to the clipboard leaves nothing on screen to say\n // it worked — the range looks the same before and after. The count is\n // what confirms the right block went, which matters most when the\n // selection runs past the bottom of the viewport.\n toast.success({\n title: t('itemTable.copiedToClipboard', 'Copied to clipboard'),\n description: t('itemTable.copiedCells', '{{count}} cells copied', {\n count: cellSelection.cellCount,\n }),\n });\n }}\n >\n {tree ? (\n <TreeGridTable tree={tree} tableProps={tableProps} style={tableStyle}>\n {tableContent}\n </TreeGridTable>\n ) : (\n <table {...tableProps} style={tableStyle}>\n {tableContent}\n </table>\n )}\n </div>\n {/*\n A refresh is shown by sweeping the table itself, not by parking a\n spinner over it — the rows stay readable, which is the whole point of\n keeping the previous result on screen. This is what announces it.\n\n Always mounted, with the TEXT appearing and disappearing: a live region\n announces changes to its CONTENT, so an empty node that merely carries\n an `aria-label` says nothing, and one that is inserted already-populated\n is unreliable across screen readers. The region has to be there first\n and then fill.\n */}\n <VisuallyHidden>\n <span role=\"status\">\n {isStale ? t('itemTable.refreshing', 'Refreshing') : ''}\n </span>\n </VisuallyHidden>\n {overlay}\n {contextMenu.rendered}\n {tints.configs.map((config, index) => (\n // Keyed positionally on purpose: `configs` is deduped and stable for a\n // given set of column colours, and the theme name is not on the config.\n // Remounting one of these is harmless anyway — the tokens it registers\n // live in a permanent global slot.\n <ColumnTintRegistrar key={index} config={config} />\n ))}\n {footer}\n </TableElement>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgWA,SAAS2M,gBAAgBC,QAAoB;AAQ3C,QAAO,UAPMA,OACVC,KACElG,QACC,OAAOA,IAAIkG,KAAKC,SAAS,OAAOC,WAAWD,KAAK,CAAA,OAAQ,CAACE,KAAK,GAAG,CAAA,OACpE,CACAA,KAAK,GAAG,CAEU;;AAGvB,SAASD,WAAWE,OAAe;AACjC,QAAOA,MACJC,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DmH,WAAMgO,cAAcC,QAAQ,aAAarV,gBAAgBC,OAAO,CAAC;AAMjEgE,WAAMqR,QAAQ;MACZpI,OAAOlJ,EAAE,+BAA+B,sBAAsB;MAC9DuR,aAAavR,EAAE,yBAAyB,0BAA0B,EAChE+E,OAAOpM,cAAc6Y,WACtB,CAAA;MACF,CAAC;;cAGHxY,OACC,oBAAC;KAAoBA;KAAkBiX;KAAY,OAAOC;eACvDK;MACa,GAEhB,oBAAC;KAAM,GAAIN;KAAY,OAAOC;eAC3BK;MAEJ;KACE;GAYL,oBAAC,4BACC,oBAAC;IAAK,MAAK;cACR/F,UAAUxK,EAAE,wBAAwB,aAAa,GAAG;KACjD,GACQ;GACfrI;GACA+V,YAAYtP;GACZ0D,MAAM2P,QAAQvV,KAAKY,QAAQ7G,UAK1B,oBAAC,uBAAwC6G,UAAf7G,MAC3B,CAAC;GACDwF;;GACY"}
1
+ {"version":3,"file":"TableView.js","names":["useVirtualizer","clsx","Fragment","useCallback","useEffect","useLayoutEffect","useMemo","useRef","useState","useTreeItem","VisuallyHidden","useEvent","useI18n","DirectionIcon","MoreIcon","getColorTheme","useColorTheme","usePaletteVersion","SIZE_NAME_TO_KEY","SIZES","useSlotProps","Action","ItemAction","Menu","MenuTrigger","useContextMenu","Placeholder","PlaceholderGroupContext","Skeleton","TextItem","Checkbox","useToast","TooltipProvider","renderColumnHeaderContent","resolveColumnSort","columnCellClassName","buildColumnTints","tintSlot","ColumnResizer","isMenuEmpty","normalizeMenuAction","ROW_MENU_COLUMN_KEY","TableElement","TableHeaderItem","TableTreeToggle","TableTreeTogglePlaceholder","TableHeaderCell","TableRow","TableRowDropIndicator","TreeGridTable","selectionRowKey","toTsv","useColumnMenu","getDraggableColumnKeys","isColumnDraggable","canWindowColumns","useColumnWindow","useRowMoveAnimation","useScrollability","getColumnText","getColumnValue","ROW_NUMBER_COLUMN_KEY","SELECTION_COLUMN_KEY","useTableTooltipRefresh","Key","Node","Styles","CSSProperties","KeyboardEvent","ReactKeyboardEvent","MouseEvent","ReactMouseEvent","ReactNode","PointerEvent","ReactPointerEvent","RefObject","TreeState","NavigateArg","ColorThemeConfig","ColumnSortState","TableTreeNode","CubeResolvedColumn","CubeTableCellContext","CubeTableColumnGroupHeader","CubeTableColumnLayout","CubeTableLayoutProps","CubeTableLoadingIndicator","CubeTableRowContext","CubeTableRowSection","CubeTableRowSize","CubeTableSort","CubeTableSortDirection","useCellSelection","CubeTableSelectionState","CubeTableRowRenderProps","isDimmed","mods","Record","styles","height","qa","tooltip","TableViewProps","rows","T","rowKeys","getRowKey","row","index","layout","columnHeaderPaths","ReadonlyMap","onScrollerRef","element","HTMLDivElement","rootRef","size","shape","rowSize","rowHeight","headerHeight","isHeaderHidden","isStriped","hasColumnDividers","isRowMoveAnimated","isHeaderSticky","isVirtualized","virtualizeThreshold","overscan","isLoading","loadingIndicator","skeletonRowCount","selection","selectionTooltip","overlay","rowMenu","ctx","rowContextMenu","onRowMenuAction","action","key","rowMenuTriggerProps","rowLink","onRowAction","onLoadMore","hasMore","isLoadingMore","loadMoreMargin","pinnedTopRows","pinnedBottomRows","cellSelection","ReturnType","rowNumberOffset","rowIndexOffset","totalRowCount","tree","state","ariaProps","nodes","entries","columnKey","isReorderable","dragState","dropState","isColumnReorderable","columnDragState","columnDropState","headCollectionProps","headRowRef","HTMLTableRowElement","onColumnFocus","collectionProps","bodyRef","HTMLTableSectionElement","isResizable","onColumnResize","width","onColumnResizeEnd","emptyLabel","noResultsLabel","error","isFiltered","sortMode","sort","sorts","onColumnSort","onColumnSortChange","direction","columnContextMenu","onColumnMenuAction","columnMenuTriggerProps","columnMenuProps","getRowProps","headerPreset","contentPreset","toolbar","footer","ariaLabel","headerStyles","headerCellStyles","bodyStyles","rowStyles","cellStyles","toClipboardHtml","matrix","map","cell","escapeHtml","join","value","replace","ARIA_SORT","asc","desc","const","ColumnTintRegistrar","t0","config","MAX_LOAD_MORE_SKELETON_ROWS","MIN_LOAD_MORE_MARGIN","ESTIMATED_ROW_HEIGHT","xsmall","small","medium","large","xlarge","pinStyle","column","pinOffset","undefined","TableCellContent","$","_c","rowIndex","t1","text","t2","autoHeight","renderCellValue","rendered","isText","String","renderCellContent","render","isStructural","renderTreeCellContent","entry","isExpanded","expandButtonProps","content","level","children","length","TableView","props","isAutoHeight","columns","columnCount","headerGroupDepth","reduce","depth","Math","max","get","rowSizeKey","lastDraggableKey","at","t","toast","scrollerEl","setScrollerEl","scrollerRef","textSlotProps","segments","bodyColumns","refreshAppearance","resetRange","Object","keys","localBodyRef","handleBodyRef","current","handleScrollerRef","headerRowCount","pinnedTopCount","pinnedBottomCount","bodyRowCount","bodyRowIndex","bodyRowKey","treeRowState","parentKey","hasChildren","expandedKeys","has","pinnedRowIndex","edge","paletteVersion","tints","resolveTheme","mergedStyles","flexGrow","flexShrink","Table","preset","HeadRow","HeaderCell","HeaderGroupCell","Body","Row","Cell","toLowerCase","isCellSelected","rowKey","isEnabled","isSelected","cellSelectionProps","pinnedEdge","canSelectCell","onPointerDown","event","HTMLTableCellElement","button","shiftKey","preventDefault","extendTo","select","focus","preventScroll","isDraggingRef","setIsRangeDragging","onPointerEnter","sectionOf","lastColumnFlag","bottomCornerFlag","isLastRow","isVisualLastRow","cellBandFlag","renderStateRow","renderColumnSpacer","span","renderSkeletonCell","pin","isPinEdge","align","ariaColIndex","renderSkeletonRows","count","keyPrefix","Array","from","_","segment","renderSelectionHeaderCell","rowSpan","selectionMode","selectAllState","toggleSelectAll","renderSelectionCell","canSelect","checkbox","isIndeterminate","toggleRow","captureShift","renderRowMenuCell","items","resolveRowMenu","menuActionHandler","renderHeaderCell","renderColumnHeaderCell","header","sortState","activeSort","isSorted","isSortable","canResize","menuItems","columnMenu","resolveColumnMenu","hasMenu","renderColumnMenuTrigger","isDraggable","openMenuColumnKey","role","scope","tabIndex","style","columnHeaderHandlers","onFocus","onClick","onContextMenu","openColumnContextMenu","onKeyDown","openColumnMenuFromKeyboard","renderCell","treeItemAria","rangeKey","columnIndex","section","treeEntry","displayContent","columnClassName","extraCellProps","cellProps","CellTag","isRowHeader","link","className","renderPinnedRow","renderRowCells","getRowElementProps","extra","isRowDisabled","focusedRowIndex","title","target","HTMLElement","closest","isMenuEnabled","openContextMenuFor","fromEntries","filter","active","name","renderRow","isVirtual","rowProps","treeNode","virtualizer","measureElement","node","renderSpacerRow","position","withDropIndicators","rowNode","hasRows","isStale","showSkeleton","showBlank","shouldVirtualize","getItemKey","estimatedRowHeight","getScrollElement","estimateSize","getBoundingClientRect","measure","getTotalSize","querySelectorAll","forEach","isScrolling","focusedTreeKey","selectionManager","focusedKey","findIndex","scrollToIndex","scrollability","draggingKeys","lastBatchSizeRef","rowCountBeforeFetchRef","before","loadMoreSkeletonCount","min","setFocusedRowIndex","isRangeDragging","end","window","addEventListener","removeEventListener","moveRowFocus","delta","all","indexOf","next","sentinelRef","onLoadMoreEvent","sentinel","margin","clientHeight","observer","IntersectionObserver","some","isIntersecting","root","rootMargin","observe","disconnect","contextMenu","placement","hasMenuColumn","isFocused","isDropTarget","closeAfter","close","open","onAction","nativeEvent","rowFromEvent","EventTarget","Number","getAttribute","isInteger","virtualItems","getVirtualItems","paddingTop","start","paddingBottom","colGroup","pathsSharePrefix","left","right","renderHeaderGroupCell","group","first","last","every","renderHeaderRowCells","cells","path","push","segmentEnd","nextPath","slice","headerRows","isLeafRow","onKeyDownCapture","tableProps","tableStyle","totalWidth","renderBodyContent","v","bodyContent","tableContent","padding","border","x","y","stale","found","stopPropagation","range","clear","selectedCount","clearSelection","getSelectionMatrix","clipboardData","setData","success","description","cellCount","configs"],"sources":["../../../../src/components/data/TableBase/TableView.tsx"],"sourcesContent":["import { useVirtualizer } from '@tanstack/react-virtual';\nimport clsx from 'clsx';\nimport {\n Fragment,\n useCallback,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useTreeItem, VisuallyHidden } from 'react-aria';\n\nimport { useEvent } from '../../../_internal/hooks';\nimport { useI18n } from '../../../i18n';\nimport { DirectionIcon } from '../../../icons/DirectionIcon';\nimport { MoreIcon } from '../../../icons/MoreIcon';\nimport { getColorTheme, useColorTheme } from '../../../tokens/color-theme';\nimport { usePaletteVersion } from '../../../tokens/palette-config';\nimport { SIZE_NAME_TO_KEY, SIZES } from '../../../tokens/sizes';\nimport { useSlotProps } from '../../../utils/react/Slots';\nimport { Action } from '../../actions/Action/Action';\nimport { ItemAction } from '../../actions/ItemAction/ItemAction';\nimport { Menu, MenuTrigger } from '../../actions/Menu';\nimport { useContextMenu } from '../../actions/use-context-menu';\nimport {\n Placeholder,\n PlaceholderGroupContext,\n} from '../../content/Placeholder/Placeholder';\nimport { Skeleton } from '../../content/Skeleton/Skeleton';\nimport { TextItem } from '../../content/TextItem';\nimport { Checkbox } from '../../fields/Checkbox';\nimport { useToast } from '../../overlays/Toast';\nimport { TooltipProvider } from '../../overlays/Tooltip/TooltipProvider';\n\nimport { renderColumnHeaderContent, resolveColumnSort } from './column-header';\nimport { columnCellClassName } from './column-styles';\nimport { buildColumnTints, tintSlot } from './column-tint';\nimport { ColumnResizer } from './ColumnResizer';\nimport {\n isMenuEmpty,\n normalizeMenuAction,\n ROW_MENU_COLUMN_KEY,\n} from './row-menu';\nimport {\n TableElement,\n TableHeaderItem,\n TableTreeToggle,\n TableTreeTogglePlaceholder,\n} from './styled';\nimport { TableHeaderCell } from './TableHeaderCell';\nimport { TableRow, TableRowDropIndicator } from './TableRow';\nimport { TreeGridTable } from './TreeGridTable';\nimport { selectionRowKey } from './types';\nimport { toTsv } from './use-cell-selection';\nimport { useColumnMenu } from './use-column-menu';\nimport { getDraggableColumnKeys, isColumnDraggable } from './use-column-order';\nimport { canWindowColumns, useColumnWindow } from './use-column-window';\nimport { useRowMoveAnimation } from './use-row-move-animation';\nimport { useScrollability } from './use-scrollability';\nimport { getColumnText, getColumnValue } from './use-table-columns';\nimport {\n ROW_NUMBER_COLUMN_KEY,\n SELECTION_COLUMN_KEY,\n} from './use-table-selection';\nimport { useTableTooltipRefresh } from './use-table-tooltip-refresh';\n\nimport type { Key, Node } from '@react-types/shared';\nimport type { Styles } from '@tenphi/tasty';\nimport type {\n CSSProperties,\n KeyboardEvent as ReactKeyboardEvent,\n MouseEvent as ReactMouseEvent,\n ReactNode,\n PointerEvent as ReactPointerEvent,\n RefObject,\n} from 'react';\nimport type { TreeState } from 'react-stately';\nimport type { NavigateArg } from '../../../providers/navigation.types';\nimport type { ColorThemeConfig } from '../../../tokens/color-theme';\nimport type { ColumnSortState } from './column-header';\nimport type { TableTreeNode } from './table-tree';\nimport type {\n CubeResolvedColumn,\n CubeTableCellContext,\n CubeTableColumnGroupHeader,\n CubeTableColumnLayout,\n CubeTableLayoutProps,\n CubeTableLoadingIndicator,\n CubeTableRowContext,\n CubeTableRowSection,\n CubeTableRowSize,\n CubeTableSort,\n CubeTableSortDirection,\n} from './types';\nimport type { useCellSelection } from './use-cell-selection';\nimport type { CubeTableSelectionState } from './use-table-selection';\n\n/** Visual/behavioural overrides a table adapter may attach to a single row. */\nexport interface CubeTableRowRenderProps {\n isDimmed?: boolean;\n mods?: Record<string, boolean | undefined>;\n styles?: Styles;\n height?: number;\n qa?: string;\n tooltip?: string;\n}\n\nexport interface TableViewProps<T = any> extends CubeTableLayoutProps {\n qa?: string;\n rows: readonly T[];\n /** Stable keys for `rows`; required when a tree was flattened for display. */\n rowKeys?: readonly Key[];\n getRowKey: (row: T, index: number) => Key;\n layout: CubeTableColumnLayout<T>;\n /** Group path for each leaf column, from the outermost header inward. */\n columnHeaderPaths?: ReadonlyMap<\n string,\n readonly CubeTableColumnGroupHeader[]\n >;\n /**\n * Receives the scroll container once it exists. A callback rather than a ref\n * because the virtualized path does not create the element itself — Virtuoso\n * does, and hands it over after mount.\n */\n onScrollerRef: (element: HTMLDivElement | null) => void;\n /** Attached to the table's root frame. */\n rootRef?: RefObject<HTMLDivElement | null>;\n\n size?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';\n shape?: 'plain' | 'card';\n /**\n * Row height as a named step — 28px / 32px / 40px.\n *\n * Only the rows: the header keeps whatever `size` gives it. Unset, the height\n * falls through to `size` as before. `rowHeight` wins over both, being the\n * most specific answer.\n */\n rowSize?: CubeTableRowSize;\n rowHeight?: number;\n headerHeight?: number;\n isHeaderHidden?: boolean;\n isStriped?: boolean;\n /**\n * Vertical rules between columns.\n *\n * A list reads across a row and wants nothing in the way; a grid is read down\n * a column, and the rule is what tells you which column a figure is in when\n * the header has scrolled far to the left. So `ItemTable` leaves it off and\n * `DataTable` turns it on — the same split ag-grid's `columnBorder` gives the\n * Cloud grids today.\n */\n hasColumnDividers?: boolean;\n /**\n * Slide rows to their new positions when the order changes, instead of\n * teleporting them.\n *\n * On by default, and only ever on a pure reorder — see\n * `use-row-move-animation`. Suppressed under `prefers-reduced-motion`.\n */\n isRowMoveAnimated?: boolean;\n /** @default true */\n isHeaderSticky?: boolean;\n /** @default 'auto' — on above `virtualizeThreshold` rows, needs a bounded height. */\n isVirtualized?: boolean | 'auto';\n /** @default 50 */\n virtualizeThreshold?: number;\n /** Rows rendered beyond each edge of the viewport. @default 20 */\n overscan?: number;\n\n /* status */\n isLoading?: boolean;\n loadingIndicator?: CubeTableLoadingIndicator;\n skeletonRowCount?: number;\n selection?: CubeTableSelectionState<T>;\n selectionTooltip?: string | ((row: T) => string | undefined);\n /** Rendered in the root frame, over the body. For the floating bulk bar. */\n overlay?: ReactNode;\n /** Already normalised by the adapter into a per-row resolver. */\n rowMenu?: (row: T, ctx: CubeTableRowContext<T>) => ReactNode | null;\n rowContextMenu?: boolean | 'context-only';\n onRowMenuAction?: (action: string, row: T, key: Key) => void;\n rowMenuTriggerProps?: Record<string, any>;\n rowLink?: (row: T, index: number) => NavigateArg | undefined;\n onRowAction?: (row: T, key: Key) => void;\n /** Infinite scroll: fires once the end of the list comes into view. */\n onLoadMore?: () => void;\n hasMore?: boolean;\n isLoadingMore?: boolean;\n /**\n * How far before the end to start fetching, in px.\n *\n * Defaults to one viewport height, so the next batch is requested a whole\n * screen before the user could reach the bottom. A fixed 200px — about five\n * rows — meant a fast scroll arrived at the end before the request did, which\n * is the stall this is meant to avoid.\n */\n loadMoreMargin?: number;\n /**\n * Rows pinned above and below the scrolling ones — totals, subtotals.\n *\n * Rendered inside `<tbody>` rather than `<thead>`/`<tfoot>` so they keep the\n * body's own row and cell styling; the sub-element chains are anchored to\n * `Body`. Stickiness comes from the row itself.\n */\n pinnedTopRows?: readonly T[];\n pinnedBottomRows?: readonly T[];\n /**\n * Rectangular cell selection, from `use-cell-selection`.\n *\n * `DataTable` only. A list is acted on by row; a result grid is read by cell,\n * and the block of figures is the thing the user wants out of it.\n */\n cellSelection?: ReturnType<typeof useCellSelection<T>> | null;\n /** 1-based number of the first row, so paging keeps the count continuous. */\n rowNumberOffset?: number;\n /**\n * Rows of the full result that precede this page, and the size of that full\n * result.\n *\n * ARIA row indices are document-absolute by contract: `aria-rowindex` is a\n * row's position in the WHOLE grid and `aria-rowcount` the whole grid's size,\n * so a paged grid has to say \"row 21 of 240\" rather than restarting at 1 and\n * claiming a count of 25. Without them a screen reader hears colliding\n * indices against a larger count, which is worse than saying nothing.\n *\n * Defaults keep an unpaged table correct: no offset, and a count taken from\n * the rows actually given.\n */\n rowIndexOffset?: number;\n totalRowCount?: number;\n /** React Aria treegrid state and the model entries matching `rows`. */\n tree?: {\n state: TreeState<TableTreeNode<T>>;\n ariaProps: Record<string, any>;\n nodes: Node<TableTreeNode<T>>[];\n entries: TableTreeNode<T>[];\n columnKey: string;\n };\n isReorderable?: boolean;\n /** Provided by `DraggableCollection` when reordering is on. */\n dragState?: any;\n dropState?: any;\n /* column reordering — named apart from the ROW drag props above, so a table\n * can eventually run both at once. */\n isColumnReorderable?: boolean;\n columnDragState?: any;\n columnDropState?: any;\n /**\n * Drop handling for the header. Must land on the element that directly\n * contains the header cells — the `<tr>` — or drops are never received.\n */\n headCollectionProps?: Record<string, any>;\n headRowRef?: RefObject<HTMLTableRowElement | null>;\n /** Keeps React Aria's `focusedKey` current, which Alt+Arrow reorder reads. */\n onColumnFocus?: (columnKey: string | null) => void;\n /**\n * Drop handling from `useDroppableCollection`. Must land on the element that\n * directly contains the rows — the `<tbody>` — or drops are never received.\n */\n collectionProps?: Record<string, any>;\n bodyRef?: RefObject<HTMLTableSectionElement | null>;\n isResizable?: boolean;\n onColumnResize?: (columnKey: string, width: number) => void;\n onColumnResizeEnd?: (columnKey: string) => void;\n emptyLabel?: ReactNode;\n noResultsLabel?: ReactNode;\n error?: ReactNode;\n /** Selects `noResultsLabel` over `emptyLabel` when there is nothing to show. */\n isFiltered?: boolean;\n\n /* sorting */\n /** @default 'off' */\n sortMode?: 'client' | 'server' | 'off';\n sort?: CubeTableSort | null;\n /**\n * Multi-column sort. Takes precedence over `sort` when given, and the array\n * order is the precedence — `DataTable` uses it, `ItemTable` uses `sort`.\n */\n sorts?: CubeTableSort[];\n onColumnSort?: (columnKey: string) => void;\n /**\n * Set a column's direction outright, for the column menu's reserved sort keys.\n *\n * Separate from `onColumnSort`, which is a cycle: reaching `desc` by toggling\n * twice never terminates under `disallowSortRemoval` and disturbs the\n * precedence of every other sorted column.\n */\n onColumnSortChange?: (\n columnKey: string,\n direction: CubeTableSortDirection | null,\n ) => void;\n\n /* column menu */\n /**\n * Where a column's `header.menu` is exposed.\n *\n * - `true` — a `⋮` trigger, plus right-click and Shift+F10.\n * - `'context-only'` — right-click and Shift+F10, no trigger.\n * - `false` — suppressed entirely.\n *\n * Defaults to `true`, unlike `rowContextMenu`: for rows the flag also decides\n * whether there is a menu at all, whereas here `header.menu` is that gate and\n * this only picks the surfaces.\n *\n * @default true\n */\n columnContextMenu?: boolean | 'context-only';\n onColumnMenuAction?: (action: string, columnKey: string) => void;\n columnMenuTriggerProps?: Record<string, any>;\n columnMenuProps?: Record<string, any>;\n\n /* per-row hooks */\n getRowProps?: (\n ctx: CubeTableRowContext<T>,\n ) => CubeTableRowRenderProps | undefined;\n\n /**\n * Typography preset for the column header. A per-adapter default rather than\n * a table-wide constant: `ItemTable` uses the uppercase caption look (`c2`),\n * while an analytics grid wants its headers to read at body size.\n * `headerCellStyles` still wins over it.\n */\n headerPreset?: string;\n /**\n * Typography for the body. `ItemTable` reads as a list at `t3`; a result grid\n * packs more in and wants `t4`.\n */\n contentPreset?: string;\n\n /** Chrome rendered above the table, in the frame's first grid row. */\n toolbar?: ReactNode;\n /** Chrome rendered below the table, in the frame's last grid row. */\n footer?: ReactNode;\n\n ariaLabel?: string;\n styles?: Styles;\n headerStyles?: Styles;\n headerCellStyles?: Styles;\n bodyStyles?: Styles;\n rowStyles?: Styles;\n cellStyles?: Styles;\n mods?: Record<string, boolean | undefined>;\n}\n\n/**\n * The same block as an HTML table, so a spreadsheet keeps the cell boundaries.\n *\n * Pasting `text/plain` TSV works, but Excel and Sheets then re-guess the types\n * of every field; the HTML flavour is what makes a value that looks like a date\n * stay the text it was on screen.\n */\nfunction toClipboardHtml(matrix: string[][]) {\n const rows = matrix\n .map(\n (row) =>\n `<tr>${row.map((cell) => `<td>${escapeHtml(cell)}</td>`).join('')}</tr>`,\n )\n .join('');\n\n return `<table>${rows}</table>`;\n}\n\nfunction escapeHtml(value: string) {\n return value\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;');\n}\n\nconst ARIA_SORT = { asc: 'ascending', desc: 'descending' } as const;\n\n/**\n * Registers one column tint's tokens.\n *\n * A component per theme rather than a loop of `useColorTheme` calls: the number\n * of tinted columns is data-dependent, and hooks cannot be called in a loop. Each\n * of these has a fixed hook count, and mounting a different NUMBER of them is\n * fine. Keyed on the theme name, so remounting only happens when the set of\n * colours actually changes.\n *\n * Renders nothing — `useColorTheme` injects into a global slot keyed by the\n * theme's own hash, so two tables sharing a colour share one injection and\n * neither can evict the other's.\n */\nfunction ColumnTintRegistrar({ config }: { config: ColorThemeConfig }) {\n useColorTheme(config);\n\n return null;\n}\n\n/**\n * Content height per size step, mirroring `$row-height` in `styled.ts`. Only the\n * initial estimate — every rendered row is measured, so a wrong guess costs a\n * scrollbar adjustment, not a layout bug. The `+ 1` is the row separator.\n */\n/** Enough to read as \"more is coming\" without pretending to know how much. */\n/**\n * Ceiling on the load-more placeholder burst.\n *\n * These rows are not virtualized — they sit after the window, at the end of the\n * body — so the count is real DOM. 50 rows is already taller than any viewport,\n * which is all the burst has to be.\n */\nconst MAX_LOAD_MORE_SKELETON_ROWS = 50;\n\n/**\n * Floor on the prefetch distance, for a table too short to measure usefully —\n * an unbounded one reports a viewport of nearly zero before it has any rows.\n */\nconst MIN_LOAD_MORE_MARGIN = 200;\n\nconst ESTIMATED_ROW_HEIGHT = {\n xsmall: 28,\n small: 32,\n medium: 40,\n large: 48,\n xlarge: 56,\n} as const;\n\nfunction pinStyle(column: CubeResolvedColumn): CSSProperties | undefined {\n if (column.pinOffset == null) return undefined;\n\n return { ['--pin-offset' as any]: `${column.pinOffset}px` };\n}\n\n/** Default text keeps its tooltip tree while the virtual window moves. */\nfunction TableCellContent<T>({\n column,\n row,\n rowIndex,\n}: {\n column: CubeResolvedColumn<T>;\n row: T;\n rowIndex: number;\n}): ReactNode {\n const text = getColumnText(column, row, rowIndex);\n return column.autoHeight || text == null ? text : <TextItem>{text}</TextItem>;\n}\n\nfunction renderCellValue(rendered: ReactNode, autoHeight?: boolean): ReactNode {\n const isText =\n typeof rendered === 'string' ||\n typeof rendered === 'number' ||\n typeof rendered === 'bigint';\n\n // TextItem supplies truncation and its tooltip without Item's hotkey hooks.\n // Wrapping columns render the text directly instead.\n return isText && !autoHeight ? (\n <TextItem>{String(rendered)}</TextItem>\n ) : isText ? (\n String(rendered)\n ) : (\n rendered\n );\n}\n\nfunction renderCellContent<T>(\n column: CubeResolvedColumn<T>,\n row: T,\n rowIndex: number,\n ctx: CubeTableCellContext<T>,\n): ReactNode {\n if (!column.render) {\n return column.isStructural ? null : (\n <TableCellContent column={column} row={row} rowIndex={rowIndex} />\n );\n }\n\n return renderCellValue(\n column.render(\n column.isStructural ? undefined : getColumnValue(column, row, rowIndex),\n row,\n rowIndex,\n ctx,\n ),\n column.autoHeight,\n );\n}\n\n/**\n * A tree column's cell content: indented to the row's level, with the expand\n * toggle — or a placeholder holding its place on a leaf — before the value.\n */\nfunction renderTreeCellContent<T>(\n entry: TableTreeNode<T>,\n isExpanded: boolean,\n expandButtonProps:\n | ReturnType<typeof useTreeItem>['expandButtonProps']\n | undefined,\n content: ReactNode,\n) {\n return (\n <div\n data-element=\"TreeContent\"\n style={\n {\n '--tree-level': String(entry.level),\n } as CSSProperties\n }\n >\n {entry.children.length > 0 ? (\n <TableTreeToggle\n {...expandButtonProps}\n data-element=\"TreeToggle\"\n tabIndex={-1}\n >\n <DirectionIcon to={isExpanded ? 'bottom' : 'right'} />\n </TableTreeToggle>\n ) : (\n <TableTreeTogglePlaceholder\n data-element=\"TreeToggle\"\n aria-hidden=\"true\"\n />\n )}\n <div data-element=\"TreeValue\">{content}</div>\n </div>\n );\n}\n\n/**\n * The one place table DOM exists. Both `ItemTable` and `DataTable` resolve their\n * props into the shape above and hand it here, so the markup, the ARIA\n * bookkeeping and the tasty sub-element contract have a single implementation.\n */\nexport function TableView<T = any>(props: TableViewProps<T>) {\n const {\n qa,\n rows,\n rowKeys,\n getRowKey,\n layout,\n columnHeaderPaths,\n onScrollerRef,\n rootRef,\n size = 'medium',\n shape = 'plain',\n rowSize,\n rowHeight,\n headerHeight,\n isHeaderHidden = false,\n isStriped = false,\n hasColumnDividers,\n isRowMoveAnimated = true,\n isHeaderSticky = true,\n isAutoHeight = false,\n isVirtualized = 'auto',\n virtualizeThreshold = 50,\n overscan = 20,\n isLoading = false,\n loadingIndicator = 'overlay',\n skeletonRowCount = 6,\n selection,\n selectionTooltip,\n overlay,\n rowMenu,\n rowContextMenu = false,\n onRowMenuAction,\n rowMenuTriggerProps,\n rowLink,\n onRowAction,\n onLoadMore,\n hasMore = false,\n isLoadingMore = false,\n loadMoreMargin,\n pinnedTopRows,\n pinnedBottomRows,\n cellSelection,\n rowNumberOffset = 0,\n rowIndexOffset = 0,\n totalRowCount,\n tree,\n isReorderable = false,\n dragState,\n dropState,\n collectionProps,\n isColumnReorderable = false,\n columnDragState,\n columnDropState,\n headCollectionProps,\n headRowRef,\n onColumnFocus,\n bodyRef,\n isResizable = false,\n onColumnResize,\n onColumnResizeEnd,\n emptyLabel,\n noResultsLabel,\n error,\n isFiltered = false,\n sortMode = 'off',\n sort,\n sorts,\n onColumnSort,\n onColumnSortChange,\n columnContextMenu = true,\n onColumnMenuAction,\n columnMenuTriggerProps,\n columnMenuProps,\n getRowProps,\n headerPreset,\n contentPreset,\n toolbar,\n footer,\n ariaLabel,\n styles,\n headerStyles,\n headerCellStyles,\n bodyStyles,\n rowStyles,\n cellStyles,\n mods,\n } = props;\n\n const { columns } = layout;\n const columnCount = columns.length;\n const headerGroupDepth = columns.reduce(\n (depth, column) =>\n Math.max(depth, columnHeaderPaths?.get(column.key)?.length ?? 0),\n 0,\n );\n\n /**\n * `rowSize` resolved to the size scale, or `null` when it was not given.\n *\n * Both halves come from `SIZE_NAME_TO_KEY` rather than being written out\n * twice: the CSS keeps the token so it follows the scale, and the virtualizer\n * needs the number, and the two must not drift.\n */\n const rowSizeKey = rowSize ? SIZE_NAME_TO_KEY[rowSize] : null;\n // Only the trailing draggable column carries an `after` indicator; every other\n // gap is covered by the next column's `before` one.\n const lastDraggableKey = isColumnReorderable\n ? getDraggableColumnKeys(columns, true).at(-1) ?? null\n : null;\n\n // The element is held here as well as reported upwards: the virtualizer needs\n // it locally, and the adapter needs it to measure column widths.\n const { t } = useI18n();\n const toast = useToast();\n\n const [scrollerEl, setScrollerEl] = useState<HTMLDivElement | null>(null);\n const scrollerRef = useRef<HTMLDivElement | null>(null);\n const textSlotProps = useSlotProps({}, 'text');\n // DataTable's default t4 preset has the same single-line cell layout.\n // Consumer typography overrides need the complete intrinsic body layout.\n const {\n segments: bodyColumns,\n refreshAppearance,\n resetRange,\n } = useColumnWindow(\n layout,\n scrollerEl,\n isVirtualized !== false &&\n !isAutoHeight &&\n !bodyStyles &&\n !rowStyles &&\n !cellStyles &&\n Object.keys(textSlotProps).length === 0 &&\n (!contentPreset || contentPreset === 't4') &&\n canWindowColumns(columns, styles),\n tree?.columnKey,\n );\n // `bodyRef` is optional — only the drag-and-drop path supplies one — but the\n // move animation needs the `<tbody>` either way, so it keeps its own and both\n // are filled from one callback.\n const localBodyRef = useRef<HTMLTableSectionElement | null>(null);\n const handleBodyRef = useCallback(\n (element: HTMLTableSectionElement | null) => {\n localBodyRef.current = element;\n if (bodyRef) bodyRef.current = element;\n },\n [bodyRef],\n );\n const handleScrollerRef = useCallback(\n (element: HTMLDivElement | null) => {\n scrollerRef.current = element;\n setScrollerEl(element);\n onScrollerRef(element);\n },\n [onScrollerRef],\n );\n\n // Header rows count towards `aria-rowcount`, which must be document-absolute.\n const headerRowCount = isHeaderHidden ? 0 : headerGroupDepth + 1;\n\n /* ── the ARIA row index space ───────────────────────────────────────────\n * Four bands, in the order a screen reader walks them:\n *\n * 1 the header row\n * 2 … 1+top pinned top rows\n * … the body, offset by the pages before this one\n * after the whole body pinned bottom rows\n *\n * Derived once here rather than at each of the four render sites, which is\n * how the body came to be numbered as though the pinned rows above it did\n * not exist while `aria-rowcount` counted them.\n * ─────────────────────────────────────────────────────────────────────── */\n const pinnedTopCount = pinnedTopRows?.length ?? 0;\n const pinnedBottomCount = pinnedBottomRows?.length ?? 0;\n // The whole result, not this page. `rows.length` is the honest fallback when\n // the adapter does not know a total.\n const bodyRowCount = Math.max(\n totalRowCount ?? rows.length,\n rowIndexOffset + rows.length,\n );\n\n /** 1-based `aria-rowindex` for the i-th body row of the current page. */\n const bodyRowIndex = (rowIndex: number) =>\n headerRowCount + pinnedTopCount + rowIndexOffset + rowIndex + 1;\n const bodyRowKey = (row: T, rowIndex: number) =>\n rowKeys?.[rowIndex] ?? getRowKey(row, rowIndex);\n const treeRowState = (rowIndex: number) => {\n const entry = tree?.entries[rowIndex];\n\n return entry\n ? {\n level: entry.level,\n parentKey: entry.parentKey,\n hasChildren: entry.children.length > 0,\n isExpanded: tree.state.expandedKeys.has(entry.key),\n }\n : undefined;\n };\n /** 1-based `aria-rowindex` for the i-th pinned row at `edge`. */\n const pinnedRowIndex = (index: number, edge: 'top' | 'bottom') =>\n edge === 'top'\n ? headerRowCount + index + 1\n : headerRowCount + pinnedTopCount + bodyRowCount + index + 1;\n\n /**\n * Per-column tints.\n *\n * The colour maths is `getColorTheme`'s, cached globally by a hash of its\n * config; `buildColumnTints` only maps columns onto `data-tint` slots and the\n * state maps that read them. `getColorTheme` rather than `useColorTheme` here\n * because the number of tinted columns is data-dependent and a hook cannot be\n * called in a loop — registration happens in `ColumnTintRegistrar` below, one\n * component per distinct theme, which is a legal fixed hook count each.\n */\n const paletteVersion = usePaletteVersion();\n const tints = useMemo(\n () => buildColumnTints(columns, { resolveTheme: getColorTheme }),\n // eslint-disable-next-line react-hooks/exhaustive-deps -- re-derive on a re-seed\n [columns, paletteVersion],\n );\n\n const mergedStyles = useMemo(\n () => ({\n // A table normally fills its flex pane. `min-height: 0` lets the scroller\n // become smaller than its contents instead of forcing that pane taller.\n height: 'min 0',\n flexGrow: 1,\n flexShrink: 1,\n ...styles,\n // Auto-height is a layout mode rather than a styling suggestion: its\n // rows determine the frame even when a wrapper supplied fixed sizing.\n ...(isAutoHeight\n ? { height: 'min 0', flexGrow: 0, flexShrink: 0 }\n : null),\n ...(contentPreset ? { Table: { preset: contentPreset } } : null),\n ...(headerStyles ? { HeadRow: headerStyles } : null),\n ...(headerPreset || headerCellStyles || tints.headerCellStyles\n ? {\n HeaderCell: {\n ...(headerPreset ? { preset: headerPreset } : null),\n ...tints.headerCellStyles,\n // The consumer's own overrides land last, so a `headerCellStyles`\n // that sets `#cell-base` outright still wins over a tint.\n ...headerCellStyles,\n },\n }\n : null),\n ...(headerPreset || headerCellStyles\n ? {\n HeaderGroupCell: {\n ...(headerPreset ? { preset: headerPreset } : null),\n ...headerCellStyles,\n },\n }\n : null),\n ...(bodyStyles ? { Body: bodyStyles } : null),\n ...(rowStyles ? { Row: rowStyles } : null),\n ...(cellStyles || tints.cellStyles\n ? { Cell: { ...tints.cellStyles, ...cellStyles } }\n : null),\n // `rowHeight` first — an exact px answer beats a named step.\n ...(rowHeight != null\n ? { '$row-height': `${rowHeight}px` }\n : rowSizeKey\n ? { '$row-height': `$size-${rowSizeKey.toLowerCase()}` }\n : null),\n ...(headerHeight != null\n ? { '$header-height': `${headerHeight}px` }\n : null),\n }),\n [\n styles,\n isAutoHeight,\n headerStyles,\n headerCellStyles,\n headerPreset,\n contentPreset,\n bodyStyles,\n rowStyles,\n cellStyles,\n rowSizeKey,\n rowHeight,\n headerHeight,\n tints,\n ],\n );\n\n /**\n * Whether a cell is inside the current range.\n *\n * Pinned rows take part: they sit in the range's row order at the position\n * they occupy on screen, so a selection down a column of figures reaches its\n * total instead of leaving it to be copied separately. (ag-grid excludes\n * pinned rows outright; this is a deliberate departure.)\n */\n function isCellSelected(rowKey: Key, columnKey: string) {\n if (!cellSelection?.isEnabled) return false;\n\n return cellSelection.isSelected(rowKey, columnKey);\n }\n\n /**\n * Press and drag for the range.\n *\n * `pointerdown` rather than `click`: the range has to start before the drag\n * does, and a click only lands after the button comes back up — by which time\n * the gesture is over. `pointerenter` grows it while the button is held, which\n * is the same shape ag-grid's `onCellMouseOver` gives the Cloud grids.\n */\n function cellSelectionProps(\n rowKey: Key,\n columnKey: string,\n pinnedEdge?: 'top' | 'bottom',\n ) {\n // A vetoed cell gets no handlers at all, so it is inert rather than merely\n // unpainted: pressing it neither starts a range nor disturbs the standing\n // one, which is how ag-grid treats a press on its row-number column.\n if (!cellSelection?.canSelectCell(rowKey, columnKey)) return undefined;\n\n return {\n onPointerDown: (event: ReactPointerEvent<HTMLTableCellElement>) => {\n // Right-click keeps whatever is selected, so a context menu can act on\n // the range the user has already built.\n if (event.button !== 0) return;\n\n if (event.shiftKey) {\n // Otherwise the browser paints a text selection from the anchor to\n // here, on top of the cell range.\n event.preventDefault();\n cellSelection.extendTo(rowKey, columnKey);\n } else {\n cellSelection.select(rowKey, columnKey);\n }\n\n // The range's keyboard affordances — Escape to clear, ⌘/Ctrl+C to copy\n // — are handled on the scroller, and a `<td>` takes no focus of its\n // own, so a press would otherwise leave focus on `<body>` and neither\n // would ever fire.\n scrollerRef.current?.focus({ preventScroll: true });\n\n cellSelection.isDraggingRef.current = true;\n setIsRangeDragging(true);\n },\n onPointerEnter: () => {\n if (!cellSelection.isDraggingRef.current) return;\n\n // Reachable by press and by shift-click, but never by dragging THROUGH.\n // A pinned row sits over the scrolling ones, so a downward drag brushes\n // it long before reaching the end of the data — and being last in the\n // row order, that would snap the range to the whole rest of the grid.\n if (pinnedEdge) return;\n\n cellSelection.extendTo(rowKey, columnKey);\n },\n };\n }\n\n /**\n * Marks the trailing column.\n *\n * Two things hang off it. Its resize handle tucks fully inside rather than\n * straddling a boundary that is not there — left hanging it puts half its\n * width past the table, and the scroller gains a few pixels of horizontal\n * scroll onto blank space. And it draws no vertical rule: that rule would\n * land flush against the frame and read as a doubled edge.\n */\n /** The pinned edge a row was rendered at, as the documented section name. */\n function sectionOf(pinnedEdge?: 'top' | 'bottom'): CubeTableRowSection {\n if (pinnedEdge === 'top') return 'pinnedTop';\n if (pinnedEdge === 'bottom') return 'pinnedBottom';\n\n return 'body';\n }\n\n function lastColumnFlag(column: CubeResolvedColumn<T>) {\n return column.index === columns.length - 1 ? '' : undefined;\n }\n\n /**\n * Which frame corner, if any, this cell sits in.\n *\n * Only the two bottom ones, and only when the card's rounded edge is what the\n * row actually meets — a footer below it means the row ends against a straight\n * line instead. Without this a selected cell in that row has its ring sliced\n * off at 45° by the frame's radius, which reads as a rendering fault rather\n * than as a corner.\n *\n * Decided here rather than in CSS: the renderer already knows about the\n * footer, the shape and the pinned rows, and expressing\n * `card × no-footer × visually-last-row × outer-column` as a state map is how\n * a border map turns into a combinatorial one.\n */\n function bottomCornerFlag(\n column: CubeResolvedColumn<T>,\n rowIndex: number,\n isLastRow: boolean,\n pinnedEdge?: 'top' | 'bottom',\n ) {\n if (shape !== 'card' || footer != null) return undefined;\n\n const pinnedBottomCount = pinnedBottomRows?.length ?? 0;\n const isVisualLastRow =\n pinnedEdge === 'bottom'\n ? rowIndex === pinnedBottomCount - 1\n : pinnedEdge == null && isLastRow && pinnedBottomCount === 0;\n\n if (!isVisualLastRow) return undefined;\n if (column.index === 0) return 'start';\n if (column.index === columns.length - 1) return 'end';\n\n return undefined;\n }\n\n /**\n * The row band, mirrored from the `<tr>` onto its cells.\n *\n * `Row` already carries `data-odd` and publishes `#row-base` from it, which is\n * all an untinted cell needs. A TINTED cell has to pick its own band, and a\n * sub-element's state keys resolve against the table root rather than its DOM\n * parent — so the flag has to be on the cell itself. Same reason `data-pinned`\n * is mirrored.\n *\n * Pinned rows are exempt: they carry no `data-odd` on the `<tr>` either, and\n * banding a totals row would be wrong.\n */\n function cellBandFlag(rowIndex: number, pinnedEdge?: 'top' | 'bottom') {\n return pinnedEdge == null && isStriped && rowIndex % 2 === 1\n ? ''\n : undefined;\n }\n\n function renderStateRow(content: ReactNode) {\n return (\n <tr data-element=\"Row\" role=\"row\" aria-rowindex={headerRowCount + 1}>\n <td\n data-element=\"StateCell\"\n data-state=\"\"\n role=\"gridcell\"\n colSpan={Math.max(columnCount, 1)}\n aria-colindex={1}\n >\n <div data-element=\"StateContent\">{content}</div>\n </td>\n </tr>\n );\n }\n\n function renderColumnSpacer(\n key: string,\n span: number,\n pinnedEdge?: 'top' | 'bottom',\n isLastRow = false,\n ) {\n return (\n <td\n key={key}\n data-element=\"ColumnSpacer\"\n data-pinned={pinnedEdge}\n data-last-row={isLastRow ? '' : undefined}\n colSpan={span}\n aria-hidden=\"true\"\n role=\"presentation\"\n />\n );\n }\n\n function renderSkeletonCell(column: CubeResolvedColumn<T>) {\n return (\n <td\n key={`column-cell:${column.key}`}\n data-element=\"Cell\"\n data-pin={column.pin}\n data-pin-edge={column.isPinEdge ? '' : undefined}\n data-align={column.align}\n role=\"gridcell\"\n aria-colindex={column.ariaColIndex}\n style={pinStyle(column)}\n >\n {/* The row is `aria-busy`, which already says it is loading. */}\n <PlaceholderGroupContext.Provider value>\n <Placeholder />\n </PlaceholderGroupContext.Provider>\n </td>\n );\n }\n\n function renderSkeletonRows(\n count = skeletonRowCount,\n keyPrefix = 'skeleton',\n ) {\n return Array.from({ length: count }, (_, rowIndex) => (\n <tr\n key={`${keyPrefix}-${rowIndex}`}\n data-element=\"Row\"\n data-placeholder=\"\"\n role=\"row\"\n aria-rowindex={bodyRowIndex(rowIndex)}\n aria-busy=\"true\"\n >\n {bodyColumns.map((segment) =>\n segment.column\n ? renderSkeletonCell(segment.column)\n : renderColumnSpacer(segment.key, segment.span),\n )}\n </tr>\n ));\n }\n\n function renderSelectionHeaderCell(\n column: CubeResolvedColumn<T>,\n rowSpan = 1,\n ) {\n return (\n <th\n key={column.key}\n data-element=\"HeaderCell\"\n data-key={column.key}\n data-kind=\"selection\"\n data-pin={column.pin}\n data-pin-edge={column.isPinEdge ? '' : undefined}\n data-last-column={lastColumnFlag(column)}\n role=\"columnheader\"\n scope=\"col\"\n rowSpan={rowSpan > 1 ? rowSpan : undefined}\n tabIndex={-1}\n aria-colindex={column.ariaColIndex}\n style={pinStyle(column)}\n >\n {selection && selection.selectionMode === 'multiple' ? (\n <div data-element=\"SelectionBox\">\n <Checkbox\n aria-label={\n selection.selectAllState === 'all'\n ? t('itemTable.deselectAll', 'Deselect all')\n : t('itemTable.selectAll', 'Select all')\n }\n isSelected={selection.selectAllState === 'all'}\n isIndeterminate={selection.selectAllState === 'some'}\n onChange={selection.toggleSelectAll}\n />\n </div>\n ) : null}\n </th>\n );\n }\n\n function renderSelectionCell(\n column: CubeResolvedColumn<T>,\n row: T,\n rowIndex: number,\n rowKey: Key,\n isLastRow: boolean,\n pinnedEdge?: 'top' | 'bottom',\n ) {\n const canSelect = selection!.canSelect(rowKey);\n const tooltip =\n typeof selectionTooltip === 'function'\n ? selectionTooltip(row)\n : selectionTooltip;\n\n const checkbox = (\n <Checkbox\n aria-label={t('itemTable.selectRow', 'Select row')}\n isSelected={selection!.isSelected(rowKey)}\n isIndeterminate={selection!.isIndeterminate(rowKey)}\n isDisabled={!canSelect}\n onChange={() => selection!.toggleRow(rowKey)}\n />\n );\n\n return (\n <td\n key={`column-cell:${column.key}`}\n data-element=\"Cell\"\n data-key={column.key}\n data-kind=\"selection\"\n data-pin={column.pin}\n data-pin-edge={column.isPinEdge ? '' : undefined}\n data-last-row={isLastRow ? '' : undefined}\n data-pinned={pinnedEdge}\n data-odd={cellBandFlag(rowIndex, pinnedEdge)}\n data-last-column={lastColumnFlag(column)}\n data-corner={bottomCornerFlag(column, rowIndex, isLastRow, pinnedEdge)}\n role=\"gridcell\"\n aria-colindex={column.ariaColIndex}\n style={pinStyle(column)}\n // `Checkbox` reports only the next value, so the modifier that decides\n // toggle-vs-extend is read off the event that produced it.\n //\n // `click` rather than `pointerdown`: capture on the cell still runs\n // before the checkbox's own `change` handler, and unlike pointer events\n // it carries the modifier state in every environment — including\n // keyboard activation and jsdom.\n onClickCapture={selection!.captureShift}\n onKeyDownCapture={selection!.captureShift}\n >\n <div data-element=\"SelectionBox\">\n {!canSelect && tooltip ? (\n <TooltipProvider title={tooltip}>{checkbox}</TooltipProvider>\n ) : (\n checkbox\n )}\n </div>\n </td>\n );\n }\n\n function renderRowMenuCell(\n column: CubeResolvedColumn<T>,\n row: T,\n rowIndex: number,\n rowKey: Key,\n isLastRow: boolean,\n pinnedEdge?: 'top' | 'bottom',\n ) {\n const items = resolveRowMenu(row, rowIndex, rowKey);\n\n return (\n <td\n key={`column-cell:${column.key}`}\n data-element=\"Cell\"\n data-key={column.key}\n data-kind=\"actions\"\n data-pin={column.pin}\n data-pin-edge={column.isPinEdge ? '' : undefined}\n data-last-row={isLastRow ? '' : undefined}\n data-pinned={pinnedEdge}\n data-odd={cellBandFlag(rowIndex, pinnedEdge)}\n data-last-column={lastColumnFlag(column)}\n data-corner={bottomCornerFlag(column, rowIndex, isLastRow, pinnedEdge)}\n role=\"gridcell\"\n aria-colindex={column.ariaColIndex}\n style={pinStyle(column)}\n >\n {isMenuEmpty(items) ? null : (\n <div data-element=\"RowActions\">\n <MenuTrigger>\n <ItemAction\n // The grid is one tab stop; in-cell controls are reached with\n // arrow keys, matching `TreeNode`.\n tabIndex={-1}\n icon={<MoreIcon />}\n aria-label={t('itemTable.rowActions', 'Row actions')}\n {...rowMenuTriggerProps}\n />\n <Menu onAction={menuActionHandler(row, rowKey, false)}>\n {items}\n </Menu>\n </MenuTrigger>\n </div>\n )}\n </td>\n );\n }\n\n function renderHeaderCell(column: CubeResolvedColumn<T>, rowSpan = 1) {\n if (column.key === SELECTION_COLUMN_KEY) {\n return renderSelectionHeaderCell(column, rowSpan);\n }\n\n if (column.key === ROW_NUMBER_COLUMN_KEY) {\n // Deliberately unnamed: the numbers are a reading aid, not data, and a\n // column header would invite sorting by them.\n return (\n <th\n key={column.key}\n data-element=\"HeaderCell\"\n data-key={column.key}\n data-kind=\"row-number\"\n data-last-column={lastColumnFlag(column)}\n role=\"columnheader\"\n scope=\"col\"\n rowSpan={rowSpan > 1 ? rowSpan : undefined}\n tabIndex={-1}\n aria-colindex={column.ariaColIndex}\n style={pinStyle(column)}\n />\n );\n }\n\n if (column.key === ROW_MENU_COLUMN_KEY) {\n // An empty header keeps the column in the ARIA geometry without\n // announcing a name for a column that holds no data.\n return (\n <th\n key={column.key}\n data-element=\"HeaderCell\"\n data-key={column.key}\n data-kind=\"actions\"\n data-pin={column.pin}\n data-pin-edge={column.isPinEdge ? '' : undefined}\n data-last-column={lastColumnFlag(column)}\n role=\"columnheader\"\n scope=\"col\"\n rowSpan={rowSpan > 1 ? rowSpan : undefined}\n tabIndex={-1}\n aria-colindex={column.ariaColIndex}\n style={pinStyle(column)}\n />\n );\n }\n\n return renderColumnHeaderCell(column, rowSpan);\n }\n\n /** A data column's header cell: its sort, menu, resize handle and drag. */\n function renderColumnHeaderCell(\n column: CubeResolvedColumn<T>,\n rowSpan: number,\n ) {\n const header = column.header;\n const sortState = resolveColumnSort(column, sortMode, sorts, sort);\n const { activeSort, isSorted, isSortable } = sortState;\n\n // A structural column has no content to make room for, and resizing needs\n // somewhere to write the result.\n const canResize =\n !column.isStructural &&\n (column.isResizable ?? isResizable) &&\n onColumnResize != null &&\n onColumnResizeEnd != null;\n\n const menuItems = columnMenu.resolveColumnMenu(column);\n const hasMenu = menuItems != null;\n\n const content = renderColumnHeaderContent(\n column,\n sortState,\n columnMenu.renderColumnMenuTrigger(column, menuItems, sortState),\n );\n\n const isDraggable = isColumnDraggable(column, isColumnReorderable);\n\n return (\n <TableHeaderCell\n key={column.key}\n columnKey={column.key}\n // Enter belongs to the sort when there is one, so React Aria re-gates\n // its own Enter capture behind Alt.\n hasAction={isSortable}\n isLastDraggable={isDraggable && column.key === lastDraggableKey}\n dragState={isDraggable ? columnDragState : undefined}\n dropState={isDraggable ? columnDropState : undefined}\n cellProps={{\n 'data-element': 'HeaderCell',\n 'data-key': column.key,\n 'data-pin': column.pin,\n 'data-pin-edge': column.isPinEdge ? '' : undefined,\n 'data-align': header?.align ?? column.align,\n 'data-sortable': isSortable ? '' : undefined,\n 'data-resizable': canResize ? '' : undefined,\n 'data-last-column': lastColumnFlag(column),\n 'data-sorted': isSorted ? '' : undefined,\n 'data-menu-open':\n columnMenu.openMenuColumnKey === column.key ? '' : undefined,\n 'data-tint': tintSlot(tints, column.key, 'header'),\n role: 'columnheader',\n scope: 'col',\n rowSpan: rowSpan > 1 ? rowSpan : undefined,\n // A sortable header is a control, so it takes a tab stop — and so does\n // one carrying a menu (Shift+F10 needs somewhere to land) or one that\n // can be moved with Alt+Arrow. Row/cell keyboard navigation lands in a\n // follow-up and will move this to the grid's roving-tabindex model.\n tabIndex: isSortable || hasMenu || isDraggable ? 0 : -1,\n 'aria-colindex': column.ariaColIndex,\n 'aria-sort': activeSort ? ARIA_SORT[activeSort.direction] : undefined,\n 'aria-haspopup': hasMenu ? 'menu' : undefined,\n style: pinStyle(column),\n ...columnHeaderHandlers(column, sortState, hasMenu, isDraggable),\n }}\n >\n {content}\n {canResize ? (\n <ColumnResizer<T>\n column={column}\n label={t('itemTable.resizeColumn', 'Resize column')}\n onResize={onColumnResize!}\n onResizeEnd={onColumnResizeEnd!}\n />\n ) : null}\n </TableHeaderCell>\n );\n }\n\n /**\n * A data column's header as a control: a press or Enter/Space sorts it, a\n * right-click or Shift+F10 opens its menu, and focus feeds Alt+Arrow\n * reordering.\n */\n function columnHeaderHandlers(\n column: CubeResolvedColumn<T>,\n sortState: ColumnSortState,\n hasMenu: boolean,\n isDraggable: boolean,\n ) {\n const { isSortable } = sortState;\n\n return {\n // React Aria's Alt+Arrow reorder reads `focusedKey`, and nothing else\n // sets it — `useDroppableCollection` only ever reads it.\n onFocus: isColumnReorderable\n ? () => onColumnFocus?.(isDraggable ? column.key : null)\n : undefined,\n onClick: isSortable ? () => onColumnSort?.(column.key) : undefined,\n // Both `true` and `'context-only'` answer to a right-click, and\n // `false` already made `hasMenu` false in `resolveColumnMenu`.\n onContextMenu: hasMenu\n ? (event: ReactMouseEvent) =>\n columnMenu.openColumnContextMenu(column, sortState, event)\n : undefined,\n onKeyDown:\n isSortable || hasMenu\n ? (event: ReactKeyboardEvent) => {\n // Shift+F10 is the standard keyboard route to a context menu,\n // and the only route to this one — the trigger is not a tab\n // stop.\n if (event.key === 'F10' && event.shiftKey && hasMenu) {\n columnMenu.openColumnMenuFromKeyboard(column, sortState, event);\n\n return;\n }\n\n if (!isSortable) return;\n if (event.key !== 'Enter' && event.key !== ' ') return;\n // Space would scroll the grid otherwise.\n event.preventDefault();\n onColumnSort?.(column.key);\n }\n : undefined,\n };\n }\n\n function renderCell(\n column: CubeResolvedColumn<T>,\n row: T,\n rowIndex: number,\n rowKey: Key,\n isLastRow: boolean,\n // The row's pinned edge, mirrored onto its cells. Cells are what draw the\n // borders and the fill, and a sub-element cannot ask about its DOM parent's\n // mods — state keys inside `Cell` resolve against the table root.\n pinnedEdge?: 'top' | 'bottom',\n treeItemAria?: ReturnType<typeof useTreeItem>,\n ) {\n // Section-qualified, because the same record is routinely pinned at both\n // edges. `rowKey` below stays the consumer's own — this identity is the\n // range's alone.\n const rangeKey = selectionRowKey(sectionOf(pinnedEdge), rowKey);\n if (column.key === SELECTION_COLUMN_KEY) {\n return renderSelectionCell(\n column,\n row,\n rowIndex,\n rowKey,\n isLastRow,\n pinnedEdge,\n );\n }\n\n if (column.key === ROW_NUMBER_COLUMN_KEY) {\n return (\n <td\n key={`column-cell:${column.key}`}\n data-element=\"Cell\"\n data-key={column.key}\n data-kind=\"row-number\"\n data-last-row={isLastRow ? '' : undefined}\n data-pinned={pinnedEdge}\n data-odd={cellBandFlag(rowIndex, pinnedEdge)}\n data-last-column={lastColumnFlag(column)}\n data-corner={bottomCornerFlag(\n column,\n rowIndex,\n isLastRow,\n pinnedEdge,\n )}\n role=\"gridcell\"\n aria-colindex={column.ariaColIndex}\n style={pinStyle(column)}\n >\n {/*\n A pinned row is not numbered. It sits outside the sequence — a\n total is not row 1 — and numbering it would repeat a number the\n scrolling rows already own.\n */}\n {pinnedEdge ? null : rowNumberOffset + rowIndex + 1}\n </td>\n );\n }\n\n if (column.key === ROW_MENU_COLUMN_KEY) {\n return renderRowMenuCell(\n column,\n row,\n rowIndex,\n rowKey,\n isLastRow,\n pinnedEdge,\n );\n }\n\n const ctx: CubeTableCellContext<T> = {\n row,\n rowKey,\n rowIndex,\n columnKey: column.key,\n columnIndex: column.index,\n section: sectionOf(pinnedEdge),\n // The ROW's selection, matching the field's siblings (`isRowFocused`).\n // Cell-range membership is a different question and has its own answer in\n // `data-cell-selected`.\n isSelected: selection?.isSelected(rowKey) ?? false,\n tree: pinnedEdge == null ? treeRowState(rowIndex) : undefined,\n };\n\n const content = renderCellContent(column, row, rowIndex, ctx);\n\n const treeEntry = pinnedEdge == null ? tree?.entries[rowIndex] : undefined;\n const displayContent =\n treeEntry && column.key === tree?.columnKey\n ? renderTreeCellContent(\n treeEntry,\n tree.state.expandedKeys.has(treeEntry.key),\n treeItemAria?.expandButtonProps,\n content,\n )\n : content;\n\n // Resolved through tasty, not spread into `style`: the type is `Styles`, and\n // an inline style takes none of its tokens, units or state maps — a\n // `#surface-text-soft-2` there is an invalid value the browser drops.\n const columnClassName = columnCellClassName(\n typeof column.cellStyles === 'function'\n ? column.cellStyles(ctx)\n : column.cellStyles,\n );\n const extraCellProps = column.cellProps?.(ctx);\n\n const CellTag = column.isRowHeader ? 'th' : 'td';\n\n // The link lives in the row-header cell but stretches over the whole row:\n // a `<tr>` cannot be wrapped in an `<a>`, and this is the one cell whose\n // text is the row's accessible name. ⌘-click, middle-click and \"Open in\n // new tab\" then work natively, which an onClick handler can never give.\n const link = column.isRowHeader ? rowLink?.(row, rowIndex) : undefined;\n\n return (\n <CellTag\n key={`column-cell:${column.key}`}\n data-element=\"Cell\"\n data-key={column.key}\n data-pin={column.pin}\n data-pin-edge={column.isPinEdge ? '' : undefined}\n data-align={column.align}\n data-wrap={column.autoHeight ? '' : undefined}\n data-link={link !== undefined ? '' : undefined}\n data-last-row={isLastRow ? '' : undefined}\n data-pinned={pinnedEdge}\n data-odd={cellBandFlag(rowIndex, pinnedEdge)}\n data-tint={tintSlot(\n tints,\n column.key,\n pinnedEdge == null ? 'body' : 'totals',\n )}\n data-last-column={lastColumnFlag(column)}\n data-corner={bottomCornerFlag(column, rowIndex, isLastRow, pinnedEdge)}\n data-cell-selected={\n isCellSelected(rangeKey, column.key) ? '' : undefined\n }\n {...(column.isRowHeader\n ? { scope: 'row' as const }\n : { role: 'gridcell' as const })}\n {...cellSelectionProps(rangeKey, column.key, pinnedEdge)}\n aria-colindex={column.ariaColIndex}\n // The anchor the column class's rule is built on (`column-styles.ts`).\n data-column-styles={columnClassName ? '' : undefined}\n style={pinStyle(column)}\n {...extraCellProps}\n // Joined rather than replaced, so a `className` from `cellProps` does\n // not silently drop the column's styles.\n className={\n clsx(columnClassName, extraCellProps?.className) || undefined\n }\n >\n {displayContent}\n {link !== undefined ? (\n <Action\n data-element=\"RowLink\"\n to={link}\n // The row is the tab stop; the link is reached through it.\n tabIndex={-1}\n aria-label={getColumnText(column, row, rowIndex) ?? undefined}\n />\n ) : null}\n </CellTag>\n );\n }\n\n /**\n * A pinned row — a total or subtotal.\n *\n * Rendered inside `<tbody>` rather than `<thead>`/`<tfoot>` so it keeps the\n * body's own row and cell styling: the sub-element chains are anchored to\n * `Body`, and a row in the head would match none of them. `data-pinned`\n * carries the stickiness instead.\n */\n function renderPinnedRow(row: T, index: number, edge: 'top' | 'bottom') {\n // The consumer's own key, not a positional one: a cell range spans pinned\n // and scrolling rows alike, so both have to answer to the same identity.\n const rowKey = getRowKey(row, index);\n\n return (\n <tr\n key={`pinned-${edge}-${rowKey}`}\n data-element=\"Row\"\n data-pinned={edge}\n role=\"row\"\n aria-rowindex={pinnedRowIndex(index, edge)}\n >\n {bodyColumns.map((segment) =>\n segment.column\n ? renderCell(segment.column, row, index, rowKey, false, edge)\n : renderColumnSpacer(segment.key, segment.span, edge),\n )}\n </tr>\n );\n }\n\n /** The cells of one body row. Shared by both render paths. */\n function renderRowCells(\n row: T,\n rowIndex: number,\n treeItemAria?: ReturnType<typeof useTreeItem>,\n ) {\n const rowKey = bodyRowKey(row, rowIndex);\n\n return bodyColumns.map((segment) =>\n segment.column\n ? renderCell(\n segment.column,\n row,\n rowIndex,\n rowKey,\n rowIndex === rows.length - 1,\n undefined,\n treeItemAria,\n )\n : renderColumnSpacer(\n segment.key,\n segment.span,\n undefined,\n rowIndex === rows.length - 1,\n ),\n );\n }\n\n /**\n * The `<tr>` shell. Virtuoso owns the element in the virtualized path (it\n * needs its own `style` and measurement attributes), so this returns the\n * props rather than the element.\n */\n function getRowElementProps(row: T, rowIndex: number) {\n const rowKey = bodyRowKey(row, rowIndex);\n const isSelected = selection?.isSelected(rowKey) ?? false;\n const ctx: CubeTableRowContext<T> = {\n row,\n rowKey,\n rowIndex,\n section: 'body',\n isSelected,\n tree: treeRowState(rowIndex),\n };\n const extra = getRowProps?.(ctx);\n\n return {\n 'data-element': 'Row',\n 'data-key': String(rowKey),\n // Lets a pointer or keyboard event resolve back to its row without a\n // closure per row.\n 'data-row-index': rowIndex,\n 'data-qa': extra?.qa,\n 'data-odd': isStriped && rowIndex % 2 === 1 ? '' : undefined,\n 'data-dimmed': extra?.isDimmed ? '' : undefined,\n 'data-selected': isSelected ? '' : undefined,\n 'data-disabled': selection?.isRowDisabled(rowKey) ? '' : undefined,\n role: 'row',\n // Only the resting row takes a tab stop; the rest are reached with the\n // arrow keys. Off entirely when nothing on the row is operable.\n tabIndex:\n !tree && isReorderable\n ? rowIndex === focusedRowIndex\n ? 0\n : -1\n : undefined,\n // Only meaningful in a selectable grid; announcing \"not selected\" on\n // every row of a plain table is noise.\n 'aria-selected': selection?.isEnabled ? isSelected : undefined,\n 'aria-rowindex': bodyRowIndex(rowIndex),\n title: extra?.tooltip,\n height: extra?.height,\n 'data-clickable':\n onRowAction != null || rowLink?.(row, rowIndex) !== undefined\n ? ''\n : undefined,\n onClick:\n onRowAction != null\n ? (event: ReactMouseEvent) => {\n // A click that landed on a control inside the cell belongs to\n // that control — the row must not also act on it.\n if (\n (event.target as HTMLElement).closest(\n 'a, button, input, select, textarea, [role=\"button\"], [role=\"menuitem\"]',\n )\n ) {\n return;\n }\n\n onRowAction(row, rowKey);\n }\n : undefined,\n onContextMenu: isMenuEnabled\n ? (event: ReactMouseEvent) =>\n openContextMenuFor(row, rowIndex, rowKey, event)\n : undefined,\n ...Object.fromEntries(\n Object.entries(extra?.mods ?? {})\n .filter(([, active]) => active)\n .map(([name]) => [`data-${name}`, '']),\n ),\n } as Record<string, any>;\n }\n\n function renderRow(row: T, rowIndex: number, isVirtual = false) {\n const { height, ...rowProps } = getRowElementProps(row, rowIndex);\n const rowKey = bodyRowKey(row, rowIndex);\n const treeNode = tree?.nodes[rowIndex];\n const treeEntry = tree?.entries[rowIndex];\n\n return (\n <TableRow\n key={rowProps['data-key']}\n rowKey={rowKey}\n rowProps={rowProps}\n height={height}\n index={isVirtual ? rowIndex : undefined}\n measureRef={isVirtual ? virtualizer.measureElement : undefined}\n dragState={isReorderable ? dragState : undefined}\n dropState={isReorderable ? dropState : undefined}\n tree={\n treeNode && treeEntry\n ? {\n state: tree.state,\n node: treeNode,\n entry: treeEntry,\n isVirtualized: isVirtual,\n }\n : undefined\n }\n >\n {(treeItemAria) => renderRowCells(row, rowIndex, treeItemAria)}\n </TableRow>\n );\n }\n\n function renderSpacerRow(height: number, position: 'top' | 'bottom') {\n if (height <= 0) return null;\n\n return (\n <tr aria-hidden=\"true\" data-spacer={position}>\n <td colSpan={Math.max(columnCount, 1)} style={{ height }} />\n </tr>\n );\n }\n\n /**\n * A row, preceded by the line showing a drop above it — and followed by one\n * for the very last row, which has nothing after it to carry a \"before\".\n *\n * The indicators render nothing unless a drag is in flight, so a table that\n * is merely *capable* of dragging keeps its ordinary structure.\n */\n function withDropIndicators(row: T, index: number, isVirtual = false) {\n const rowKey = bodyRowKey(row, index);\n const rowNode = renderRow(row, index, isVirtual);\n\n if (!isReorderable || !dropState) return rowNode;\n\n return (\n <Fragment key={`row-${String(rowKey)}`}>\n <TableRowDropIndicator\n rowKey={rowKey}\n dropPosition=\"before\"\n dropState={dropState}\n columnCount={columnCount}\n />\n {rowNode}\n {index === rows.length - 1 ? (\n <TableRowDropIndicator\n rowKey={rowKey}\n dropPosition=\"after\"\n dropState={dropState}\n columnCount={columnCount}\n />\n ) : null}\n </Fragment>\n );\n }\n\n const hasRows = rows.length > 0;\n\n // How a refresh over an existing result is presented. `overlay` keeps the\n // previous rows on screen (dimmed, behind a spinner) so a server page or a\n // re-sort does not blank the table; `skeleton` discards them; `none` leaves\n // the visuals entirely to the consumer and only sets `aria-busy`.\n // `overlay` is the only behaviour that paints: the rows dim and a spinner\n // sits over them. `none` deliberately leaves them untouched.\n const isStale = isLoading && hasRows && loadingIndicator === 'overlay';\n const showSkeleton =\n isLoading &&\n loadingIndicator !== 'none' &&\n (!hasRows || loadingIndicator === 'skeleton');\n // Without rows and without an indicator there is nothing to say yet —\n // rendering the empty state would flash \"No items\" before the first response.\n const showBlank = isLoading && !hasRows && loadingIndicator === 'none';\n\n const shouldVirtualize =\n !isAutoHeight &&\n hasRows &&\n error == null &&\n (isVirtualized === true ||\n (isVirtualized === 'auto' && rows.length > virtualizeThreshold));\n\n // TanStack invalidates every cached position when this callback changes.\n // Keep its wiring stable during scroll renders, including without Compiler.\n const getItemKey = useCallback(\n (index: number) =>\n String(rowKeys?.[index] ?? getRowKey(rows[index], index)),\n [rows, rowKeys, getRowKey],\n );\n\n // `getScrollElement` is read from a ref, not the state value: the virtualizer\n // consults it from a layout effect, and a closure over state can still hold\n // the `null` from the first render.\n const estimatedRowHeight =\n (rowHeight ??\n (rowSizeKey\n ? SIZES[rowSizeKey]\n : ESTIMATED_ROW_HEIGHT[size ?? 'medium'])) + 1;\n const virtualizer = useVirtualizer({\n count: shouldVirtualize ? rows.length : 0,\n getScrollElement: () => scrollerRef.current,\n getItemKey,\n estimateSize: () => estimatedRowHeight,\n measureElement: (element) => element.getBoundingClientRect().height,\n // Rows beyond each viewport edge. Higher than a list's, because a fast\n // flick outruns React's re-render and the gap shows as blank rows — and a\n // table row is one element, not one per column, so the extra ones are\n // cheap.\n overscan,\n });\n\n // Key identity no longer resets estimates on every render. Size changes do.\n useLayoutEffect(() => {\n virtualizer.measure();\n // Rebuild positions before remeasurement compares old and new row sizes.\n virtualizer.getTotalSize();\n localBodyRef.current\n ?.querySelectorAll<HTMLTableRowElement>('tr[data-index]')\n .forEach((element) => virtualizer.measureElement(element));\n }, [estimatedRowHeight, virtualizer]);\n useTableTooltipRefresh(\n scrollerEl,\n virtualizer.isScrolling,\n refreshAppearance,\n resetRange,\n );\n\n const focusedTreeKey = tree?.state.selectionManager.focusedKey;\n useEffect(() => {\n if (!shouldVirtualize || focusedTreeKey == null || !tree) return;\n\n const index = tree.entries.findIndex(\n (entry) => entry.key === focusedTreeKey,\n );\n if (index >= 0) virtualizer.scrollToIndex(index, { align: 'auto' });\n }, [focusedTreeKey, shouldVirtualize, tree, virtualizer]);\n\n const scrollability = useScrollability(scrollerEl);\n\n /**\n * Roving tabindex over the rows, so a reorderable table can be operated from\n * the keyboard at all.\n *\n * React Aria's `dragProps` already describe \"press Enter to start dragging\"\n * and implement the whole keyboard drag — but a `<tr>` is not focusable, so\n * without this the description is announced for a row nobody can reach. One\n * tab stop for the grid, arrows to move within it, matching how every other\n * collection in the kit behaves.\n */\n // Not while a drag is in flight: React Aria is already moving the row under\n // the pointer, and a second transform fighting it reads as a stutter.\n useRowMoveAnimation({\n isEnabled: isRowMoveAnimated && !dragState?.draggingKeys?.size,\n bodyRef: localBodyRef,\n });\n\n /**\n * How many rows the next batch is likely to bring, measured across the last\n * fetch that actually happened.\n *\n * The placeholder burst is sized to this so the scroll height is right both\n * before and after the load: a short burst under a long batch makes the\n * content jump the moment the rows land, and leaves the user stopped at the\n * bottom of the list in the meantime with nothing left to scroll into.\n *\n * Measured across `isLoadingMore`, not from any growth in `rows`. Plenty of\n * things lengthen the list without being a fetch — clearing a client search\n * over an infinite list restores every filtered-out row at once — and reading\n * that as a batch of ninety sized the next burst at ninety.\n *\n * Measured at all, rather than taken from `pageSize`, because infinite-scroll\n * consumers often do not set it.\n */\n const lastBatchSizeRef = useRef(0);\n const rowCountBeforeFetchRef = useRef<number | null>(null);\n\n useEffect(() => {\n if (isLoadingMore) {\n rowCountBeforeFetchRef.current = rows.length;\n\n return;\n }\n\n const before = rowCountBeforeFetchRef.current;\n\n if (before != null && rows.length > before) {\n lastBatchSizeRef.current = rows.length - before;\n }\n\n rowCountBeforeFetchRef.current = null;\n // Deliberately keyed on the flag alone: the row count wanted is the one at\n // each edge of the fetch, not every value it passes through.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isLoadingMore]);\n\n const loadMoreSkeletonCount = Math.min(\n // Until a fetch has been measured, the rows already loaded are the best\n // guess at what the next batch brings — that IS the first page.\n Math.max(lastBatchSizeRef.current || rows.length || skeletonRowCount, 1),\n MAX_LOAD_MORE_SKELETON_ROWS,\n );\n\n const [focusedRowIndex, setFocusedRowIndex] = useState(0);\n // Only used to suppress text selection during the gesture; the range itself\n // lives in a ref so growing it does not re-render on every cell crossed.\n const [isRangeDragging, setIsRangeDragging] = useState(false);\n\n // The button can come up outside the grid — over the footer, over another\n // component, off the window entirely — so the end of the gesture is watched\n // globally rather than on the cell the drag started in.\n useEffect(() => {\n if (!isRangeDragging) return;\n\n const end = () => {\n if (cellSelection) cellSelection.isDraggingRef.current = false;\n setIsRangeDragging(false);\n };\n\n window.addEventListener('pointerup', end);\n window.addEventListener('pointercancel', end);\n\n return () => {\n window.removeEventListener('pointerup', end);\n window.removeEventListener('pointercancel', end);\n };\n }, [isRangeDragging, cellSelection]);\n\n const moveRowFocus = useEvent((from: HTMLElement, delta: number) => {\n const current = from.closest('tr[data-element=\"Row\"]');\n const all = Array.from(\n scrollerRef.current?.querySelectorAll<HTMLTableRowElement>(\n 'tbody tr[data-element=\"Row\"]:not([data-placeholder])',\n ) ?? [],\n );\n\n if (!all.length) return false;\n\n const index = current ? all.indexOf(current as HTMLTableRowElement) : -1;\n const next = Math.min(\n Math.max((index === -1 ? focusedRowIndex : index) + delta, 0),\n all.length - 1,\n );\n\n setFocusedRowIndex(next);\n all[next]?.focus();\n\n return true;\n });\n\n /* ── infinite scroll ────────────────────────────────────────────────────\n * An `IntersectionObserver` on a sentinel row rather than a scroll handler:\n * `rootMargin` expresses \"prefetch this far before the end\" directly, it\n * costs nothing per scroll tick, and it works on both render paths — under\n * virtualization the trailing spacer holds the remaining height, so the\n * sentinel after it still marks the true end of the list.\n * ──────────────────────────────────────────────────────────────────────── */\n const sentinelRef = useRef<HTMLDivElement>(null);\n const onLoadMoreEvent = useEvent(() => onLoadMore?.());\n\n useEffect(() => {\n const sentinel = sentinelRef.current;\n\n // Re-armed whenever `isLoadingMore` flips, so a request in flight cannot be\n // fired again by the sentinel still sitting in view.\n if (!onLoadMore || !hasMore || isLoadingMore || !scrollerEl || !sentinel) {\n return;\n }\n\n // One screen ahead by default: the request goes out while the user still\n // has a viewport of rows left to read, so the batch is usually there before\n // they arrive. Read at arm time rather than tracked — a resize mid-scroll\n // leaves the margin slightly stale, which costs nothing.\n const margin =\n loadMoreMargin ?? Math.max(scrollerEl.clientHeight, MIN_LOAD_MORE_MARGIN);\n\n const observer = new IntersectionObserver(\n (entries) => {\n if (entries.some((entry) => entry.isIntersecting)) onLoadMoreEvent();\n },\n { root: scrollerEl, rootMargin: `0px 0px ${margin}px 0px` },\n );\n\n observer.observe(sentinel);\n\n return () => observer.disconnect();\n }, [\n onLoadMore,\n hasMore,\n isLoadingMore,\n scrollerEl,\n loadMoreMargin,\n onLoadMoreEvent,\n rows.length,\n ]);\n\n /* ── row menu ───────────────────────────────────────────────────────────\n * One instance for the whole table rather than one per row: a table can hold\n * thousands of rows, and only ever one context menu is open.\n *\n * `targetRef` is deliberately left unattached, which keeps the hook's own\n * `contextmenu` listener unbound — it would open with fixed props, and the\n * items depend on which row was right-clicked. The handler below resolves the\n * row first and then opens with that row's items; with no target, the hook\n * positions from the event's viewport coordinates, which is what a\n * pointer-anchored menu wants anyway.\n * ──────────────────────────────────────────────────────────────────────── */\n const contextMenu = useContextMenu<HTMLDivElement, any>(Menu, {\n placement: 'bottom start',\n });\n\n const isMenuEnabled = rowMenu != null && rowContextMenu !== false;\n const hasMenuColumn = isMenuEnabled && rowContextMenu !== 'context-only';\n\n function resolveRowMenu(row: T, rowIndex: number, rowKey: Key) {\n if (!rowMenu) return null;\n\n return rowMenu(row, {\n row,\n rowKey,\n rowIndex,\n section: 'body',\n isSelected: selection?.isSelected(rowKey) ?? false,\n isFocused: false,\n isDropTarget: false,\n });\n }\n\n function menuActionHandler(row: T, rowKey: Key, closeAfter: boolean) {\n return (action: Key) => {\n onRowMenuAction?.(normalizeMenuAction(action), row, rowKey);\n\n // `useContextMenu` leaves its popover open after an action — the same\n // happens in `Tree`, so it is the hook's behaviour rather than this\n // table's. Closing here keeps the row menu correct meanwhile; drop this\n // once the hook closes on select itself.\n if (closeAfter) contextMenu.close();\n };\n }\n\n const openContextMenuFor = useEvent(\n (\n row: T,\n rowIndex: number,\n rowKey: Key,\n event: ReactMouseEvent | ReactKeyboardEvent,\n ) => {\n const items = resolveRowMenu(row, rowIndex, rowKey);\n\n // No items means no menu — falling through to the browser's own context\n // menu is more useful than opening an empty popover.\n if (isMenuEmpty(items)) return;\n\n event.preventDefault();\n contextMenu.open(\n { children: items, onAction: menuActionHandler(row, rowKey, true) },\n undefined,\n // Shift+F10 carries no coordinates; the hook then anchors on the\n // element that produced the event, which is the row.\n 'clientX' in event.nativeEvent\n ? (event.nativeEvent as MouseEvent)\n : undefined,\n );\n },\n );\n\n /* ── column menu ─────────────────────────────────────────────────────────\n * Shares the `contextMenu` instance above. A header right-click is the same\n * pointer-anchored popover with different children, and attaching the hook's\n * `targetRef` to a `<th>` would bind its listener with fixed props — the same\n * reason the row menu leaves it unattached.\n * ──────────────────────────────────────────────────────────────────────── */\n const columnMenu = useColumnMenu<T>({\n contextMenu,\n columnContextMenu,\n columnMenuProps,\n columnMenuTriggerProps,\n onColumnSortChange,\n onColumnMenuAction,\n });\n\n /** Resolves the row a pointer or keyboard event landed in. */\n function rowFromEvent(target: EventTarget | null) {\n const element = (target as HTMLElement | null)?.closest?.(\n 'tr[data-element=\"Row\"][data-key]',\n );\n\n if (!element) return null;\n\n const index = Number(element.getAttribute('data-row-index'));\n\n if (!Number.isInteger(index)) return null;\n\n const row = rows[index];\n\n return row === undefined\n ? null\n : { row, index, key: bodyRowKey(row, index) };\n }\n\n const virtualItems = shouldVirtualize ? virtualizer.getVirtualItems() : [];\n const paddingTop = virtualItems.length ? virtualItems[0].start : 0;\n const paddingBottom = virtualItems.length\n ? virtualizer.getTotalSize() - virtualItems[virtualItems.length - 1].end\n : 0;\n\n const colGroup = (\n <colgroup>\n {columns.map((column) => (\n <col\n key={column.key}\n style={column.width != null ? { width: column.width } : undefined}\n />\n ))}\n </colgroup>\n );\n\n function pathsSharePrefix(\n left: readonly CubeTableColumnGroupHeader[],\n right: readonly CubeTableColumnGroupHeader[],\n depth: number,\n ) {\n for (let index = 0; index <= depth; index++) {\n if (left[index]?.key !== right[index]?.key) return false;\n }\n\n return true;\n }\n\n function renderHeaderGroupCell(\n group: CubeTableColumnGroupHeader,\n segment: readonly CubeResolvedColumn<T>[],\n depth: number,\n ) {\n const first = segment[0];\n const last = segment[segment.length - 1];\n const pin = segment.every((column) => column.pin === first.pin)\n ? first.pin\n : undefined;\n const pinOffset =\n pin === 'start' ? first.pinOffset : pin === 'end' ? last.pinOffset : null;\n\n return (\n <th\n key={`${depth}:${first.key}:${group.key}`}\n data-element=\"HeaderGroupCell\"\n data-key={group.key}\n data-pin={pin}\n data-pin-edge={\n segment.some((column) => column.isPinEdge) ? '' : undefined\n }\n data-last-column={last.index === columnCount - 1 ? '' : undefined}\n data-align=\"center\"\n role=\"columnheader\"\n scope=\"colgroup\"\n tabIndex={-1}\n aria-colindex={first.ariaColIndex}\n colSpan={segment.length}\n style={\n pinOffset == null\n ? undefined\n : { ['--pin-offset' as any]: `${pinOffset}px` }\n }\n >\n <TableHeaderItem>{group.title}</TableHeaderItem>\n </th>\n );\n }\n\n function renderHeaderRowCells(depth: number) {\n const cells: ReactNode[] = [];\n\n for (let columnIndex = 0; columnIndex < columns.length; ) {\n const column = columns[columnIndex];\n const path = columnHeaderPaths?.get(column.key) ?? [];\n\n // This column's leaf header began on an earlier row and spans this one.\n if (path.length < depth) {\n columnIndex++;\n continue;\n }\n\n if (path.length === depth) {\n cells.push(renderHeaderCell(column, headerRowCount - depth));\n columnIndex++;\n continue;\n }\n\n let segmentEnd = columnIndex + 1;\n\n while (segmentEnd < columns.length) {\n const nextPath = columnHeaderPaths?.get(columns[segmentEnd].key) ?? [];\n\n if (\n nextPath.length <= depth ||\n columns[segmentEnd].pin !== column.pin ||\n !pathsSharePrefix(path, nextPath, depth)\n ) {\n break;\n }\n\n segmentEnd++;\n }\n\n cells.push(\n renderHeaderGroupCell(\n path[depth],\n columns.slice(columnIndex, segmentEnd),\n depth,\n ),\n );\n columnIndex = segmentEnd;\n }\n\n return cells;\n }\n\n const headerRows = isHeaderHidden\n ? null\n : Array.from({ length: headerRowCount }, (_, depth) => {\n const isLeafRow = depth === headerRowCount - 1;\n\n return (\n <tr\n key={depth}\n data-element=\"HeadRow\"\n role=\"row\"\n aria-rowindex={depth + 1}\n ref={isLeafRow ? headRowRef : undefined}\n {...(isLeafRow ? headCollectionProps : undefined)}\n onKeyDownCapture={\n isLeafRow\n ? (event) => {\n // `DraggableCollection`'s Alt+Arrow reorder sits on this\n // row and fires in capture, so it would beat the resize\n // handle's own Alt+Arrow bubble handler.\n if (\n (event.target as HTMLElement)?.closest?.(\n '[data-element=\"Resizer\"]',\n )\n ) {\n return;\n }\n\n (headCollectionProps as any)?.onKeyDownCapture?.(event);\n }\n : undefined\n }\n >\n {renderHeaderRowCells(depth)}\n </tr>\n );\n });\n\n const tableProps = {\n 'data-element': 'Table',\n role: tree ? 'treegrid' : 'grid',\n 'aria-label': ariaLabel,\n 'aria-busy': isLoading || undefined,\n 'aria-rowcount':\n headerRowCount + pinnedTopCount + bodyRowCount + pinnedBottomCount,\n 'aria-colcount': columnCount,\n 'aria-multiselectable':\n selection?.selectionMode === 'multiple' ? true : undefined,\n } as const;\n\n const tableStyle =\n layout.totalWidth != null ? { width: layout.totalWidth } : undefined;\n\n /**\n * What `<tbody>` holds between the pinned rows: the error, the loading\n * skeleton, nothing at all, the empty state, or the rows — in that order of\n * precedence.\n */\n function renderBodyContent(): ReactNode {\n if (error != null) return renderStateRow(error);\n if (showSkeleton) return renderSkeletonRows();\n if (showBlank) return null;\n if (!hasRows) {\n return renderStateRow(isFiltered ? noResultsLabel : emptyLabel);\n }\n\n if (shouldVirtualize) {\n return (\n <>\n {renderSpacerRow(paddingTop, 'top')}\n {virtualItems.map((v) =>\n withDropIndicators(rows[v.index], v.index, true),\n )}\n {renderSpacerRow(paddingBottom, 'bottom')}\n </>\n );\n }\n\n return rows.map((row, index) => withDropIndicators(row, index));\n }\n\n const bodyContent = renderBodyContent();\n\n const tableContent = (\n <>\n {colGroup}\n {isHeaderHidden ? null : <thead data-element=\"Head\">{headerRows}</thead>}\n <tbody data-element=\"Body\" {...collectionProps} ref={handleBodyRef}>\n {pinnedTopRows?.map((row, index) => renderPinnedRow(row, index, 'top'))}\n {bodyContent}\n {pinnedBottomRows?.map((row, index) =>\n renderPinnedRow(row, index, 'bottom'),\n )}\n {isLoadingMore\n ? renderSkeletonRows(loadMoreSkeletonCount, 'load-more')\n : null}\n {onLoadMore && hasRows ? (\n <tr data-sentinel=\"\" aria-hidden=\"true\">\n <td\n colSpan={Math.max(columnCount, 1)}\n style={{ height: 1, padding: 0, border: 0 }}\n >\n <div ref={sentinelRef} style={{ height: 1 }} />\n </td>\n </tr>\n ) : null}\n </tbody>\n </>\n );\n\n // Before the first measure there are no columns to lay out yet — show the\n // generic table skeleton rather than an empty frame.\n //\n // Returned HERE, below every hook, not at the point in the render where the\n // condition is known. Returning early skipped sixteen hooks — the virtualizer,\n // the scrollability observer, the move animation, the context menu, two\n // `useState`s — so the first render with columns called more hooks than the\n // last one without them, and React threw \"Rendered more hooks than during the\n // previous render\". A consumer that mounts with `columns={[]}` while loading\n // and fills them in from a response is the ordinary case, not an exotic one.\n if (columnCount === 0 && isLoading) {\n return (\n <TableElement\n ref={rootRef}\n qa={qa || 'Table'}\n styles={mergedStyles}\n mods={{ size, shape, ...mods }}\n >\n {toolbar}\n <div data-element=\"Scroller\" ref={handleScrollerRef}>\n <Skeleton layout=\"table\" />\n </div>\n </TableElement>\n );\n }\n\n return (\n <TableElement\n ref={rootRef}\n qa={qa || 'Table'}\n styles={mergedStyles}\n mods={{\n size,\n shape,\n 'sticky-header': isHeaderSticky,\n 'column-dividers': hasColumnDividers,\n 'range-dragging': isRangeDragging,\n // The footer's top border is the closing edge, so the last row must not\n // draw one as well.\n 'has-footer': footer != null,\n 'scroll-x': scrollability.x,\n 'scroll-y': scrollability.y,\n stale: isStale,\n ...mods,\n }}\n >\n {toolbar}\n <div\n data-element=\"Scroller\"\n ref={handleScrollerRef}\n // Focusable only programmatically: a cell press moves focus here so the\n // range's shortcuts land, but the grid stays a single tab stop.\n tabIndex={cellSelection?.isEnabled ? -1 : undefined}\n // Escape is the standard way out of a selection, and it must work from\n // wherever focus happens to be inside the table.\n onKeyDown={(event) => {\n // Shift+F10 is the standard way to reach a context menu from the\n // keyboard, and the only way when there is no `⋮` trigger.\n if (event.key === 'F10' && event.shiftKey && isMenuEnabled) {\n const found = rowFromEvent(event.target);\n\n if (found) {\n event.stopPropagation();\n openContextMenuFor(found.row, found.index, found.key, event);\n }\n\n return;\n }\n\n if (event.key === 'Enter' && onRowAction) {\n const found = rowFromEvent(event.target);\n\n // Enter on a control inside the cell belongs to that control.\n if (\n found &&\n !(event.target as HTMLElement).closest(\n 'a, button, input, select, textarea, [role=\"button\"]',\n )\n ) {\n onRowAction(found.row, found.key);\n }\n\n return;\n }\n\n if (\n !tree &&\n isReorderable &&\n (event.key === 'ArrowDown' || event.key === 'ArrowUp')\n ) {\n // Not while a drag is in flight — the arrows then belong to React\n // Aria, which uses them to choose the drop position.\n if (dragState?.draggingKeys?.size) return;\n\n if (\n moveRowFocus(\n event.target as HTMLElement,\n event.key === 'ArrowDown' ? 1 : -1,\n )\n ) {\n event.preventDefault();\n }\n\n return;\n }\n\n if (event.key === 'Escape') {\n if (cellSelection?.range) {\n event.stopPropagation();\n cellSelection.clear();\n\n return;\n }\n\n if (selection?.isEnabled && selection.selectedCount > 0) {\n event.stopPropagation();\n selection.clearSelection();\n }\n }\n }}\n // `onCopy` rather than a ⌘/Ctrl+C keydown: it is the event the browser\n // already fires for the shortcut AND for Edit ▸ Copy, and writing\n // through `clipboardData` needs no permission prompt. Both `text/plain`\n // and `text/html` go on, so Excel and Sheets paste a grid rather than\n // one run of text.\n onCopy={(event) => {\n if (!cellSelection?.range) return;\n\n const matrix = cellSelection.getSelectionMatrix(\n (column, row, rowIndex) =>\n column.isStructural\n ? ''\n : getColumnText(column, row, rowIndex) ?? '',\n );\n\n if (!matrix.length) return;\n\n // Both formats from the same matrix. Building the HTML by re-parsing\n // the TSV tore any cell whose value contained a tab or a newline —\n // exactly the values the TSV had to quote in the first place.\n event.preventDefault();\n event.clipboardData.setData('text/plain', toTsv(matrix));\n event.clipboardData.setData('text/html', toClipboardHtml(matrix));\n\n // A copy that writes to the clipboard leaves nothing on screen to say\n // it worked — the range looks the same before and after. The count is\n // what confirms the right block went, which matters most when the\n // selection runs past the bottom of the viewport.\n toast.success({\n title: t('itemTable.copiedToClipboard', 'Copied to clipboard'),\n description: t('itemTable.copiedCells', '{{count}} cells copied', {\n count: cellSelection.cellCount,\n }),\n });\n }}\n >\n {tree ? (\n <TreeGridTable tree={tree} tableProps={tableProps} style={tableStyle}>\n {tableContent}\n </TreeGridTable>\n ) : (\n <table {...tableProps} style={tableStyle}>\n {tableContent}\n </table>\n )}\n </div>\n {/*\n A refresh is shown by sweeping the table itself, not by parking a\n spinner over it — the rows stay readable, which is the whole point of\n keeping the previous result on screen. This is what announces it.\n\n Always mounted, with the TEXT appearing and disappearing: a live region\n announces changes to its CONTENT, so an empty node that merely carries\n an `aria-label` says nothing, and one that is inserted already-populated\n is unreliable across screen readers. The region has to be there first\n and then fill.\n */}\n <VisuallyHidden>\n <span role=\"status\">\n {isStale ? t('itemTable.refreshing', 'Refreshing') : ''}\n </span>\n </VisuallyHidden>\n {overlay}\n {contextMenu.rendered}\n {tints.configs.map((config, index) => (\n // Keyed positionally on purpose: `configs` is deduped and stable for a\n // given set of column colours, and the theme name is not on the config.\n // Remounting one of these is harmless anyway — the tokens it registers\n // live in a permanent global slot.\n <ColumnTintRegistrar key={index} config={config} />\n ))}\n {footer}\n </TableElement>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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