@cube-dev/ui-kit 0.164.0 → 0.166.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (583) hide show
  1. package/dist/CHANGELOG.md +32 -0
  2. package/dist/_internal/hooks/use-chained-callback.js +1 -1
  3. package/dist/_internal/hooks/use-debounced-value.js +1 -1
  4. package/dist/_internal/hooks/use-deprecation-warning.js +1 -1
  5. package/dist/_internal/hooks/use-event.js +1 -1
  6. package/dist/_internal/hooks/use-is-first-render.js +1 -1
  7. package/dist/_internal/hooks/use-sync-ref.js +1 -1
  8. package/dist/_internal/hooks/use-timer/timer.js +1 -1
  9. package/dist/_internal/hooks/use-timer/use-timer.js +1 -1
  10. package/dist/_internal/hooks/use-warn.js +1 -1
  11. package/dist/components/Block.js +1 -1
  12. package/dist/components/CollectionItem.js +1 -1
  13. package/dist/components/GlobalStyles.js +1 -1
  14. package/dist/components/GridProvider.js +1 -1
  15. package/dist/components/HiddenInput.js +1 -1
  16. package/dist/components/Root.js +1 -1
  17. package/dist/components/actions/Action/Action.js +1 -1
  18. package/dist/components/actions/Banner/Banner.js +1 -1
  19. package/dist/components/actions/Button/Button.js +1 -1
  20. package/dist/components/actions/ButtonGroup/ButtonGroup.js +1 -1
  21. package/dist/components/actions/ButtonSplit/ButtonSplit.js +1 -1
  22. package/dist/components/actions/ButtonSplit/context.js +1 -1
  23. package/dist/components/actions/CommandMenu/CommandMenu.js +1 -1
  24. package/dist/components/actions/CommandMenu/styled.js +1 -1
  25. package/dist/components/actions/ItemAction/ItemAction.js +1 -1
  26. package/dist/components/actions/ItemActionContext.js +1 -1
  27. package/dist/components/actions/ItemButton/ItemButton.js +1 -1
  28. package/dist/components/actions/Link/Link.js +1 -1
  29. package/dist/components/actions/Menu/Menu.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/index.js +1 -1
  38. package/dist/components/actions/use-action.js +1 -1
  39. package/dist/components/actions/use-anchored-menu.js +1 -1
  40. package/dist/components/actions/use-context-menu.js +1 -1
  41. package/dist/components/content/ActiveZone/ActiveZone.js +1 -1
  42. package/dist/components/content/Alert/Alert.js +1 -1
  43. package/dist/components/content/Alert/use-alert.js +1 -1
  44. package/dist/components/content/Avatar/Avatar.js +1 -1
  45. package/dist/components/content/Badge/Badge.js +1 -1
  46. package/dist/components/content/Card/Card.js +1 -1
  47. package/dist/components/content/Content.js +1 -1
  48. package/dist/components/content/CopyPasteBlock/CopyPasteBlock.js +1 -1
  49. package/dist/components/content/CopySnippet/CopySnippet.js +1 -1
  50. package/dist/components/content/Disclosure/Disclosure.js +1 -1
  51. package/dist/components/content/Divider.js +1 -1
  52. package/dist/components/content/Footer.js +1 -1
  53. package/dist/components/content/Header.js +1 -1
  54. package/dist/components/content/HotKeys/HotKeys.js +1 -1
  55. package/dist/components/content/InfoBadge/InfoBadge.js +1 -1
  56. package/dist/components/content/InlineInput/InlineInput.js +1 -1
  57. package/dist/components/content/Item/Item.js +1 -1
  58. package/dist/components/content/ItemBadge/ItemBadge.js +1 -1
  59. package/dist/components/content/ItemCard/ItemCard.js +1 -1
  60. package/dist/components/content/Layout/GridLayout.js +1 -1
  61. package/dist/components/content/Layout/Layout.js +1 -1
  62. package/dist/components/content/Layout/LayoutBlock.js +1 -1
  63. package/dist/components/content/Layout/LayoutCenter.js +1 -1
  64. package/dist/components/content/Layout/LayoutContainer.js +1 -1
  65. package/dist/components/content/Layout/LayoutContent.js +1 -1
  66. package/dist/components/content/Layout/LayoutContext.js +1 -1
  67. package/dist/components/content/Layout/LayoutFlex.js +1 -1
  68. package/dist/components/content/Layout/LayoutFooter.js +1 -1
  69. package/dist/components/content/Layout/LayoutGrid.js +1 -1
  70. package/dist/components/content/Layout/LayoutHeader.js +1 -1
  71. package/dist/components/content/Layout/LayoutPane.js +1 -1
  72. package/dist/components/content/Layout/LayoutPanel.js +1 -1
  73. package/dist/components/content/Layout/LayoutPanelHeader.js +1 -1
  74. package/dist/components/content/Layout/LayoutToolbar.js +1 -1
  75. package/dist/components/content/Layout/hooks/useTinyScrollbar.js +1 -1
  76. package/dist/components/content/Layout/index.js +1 -1
  77. package/dist/components/content/Layout/utils.js +1 -1
  78. package/dist/components/content/Paragraph.js +1 -1
  79. package/dist/components/content/Placeholder/Placeholder.js +1 -1
  80. package/dist/components/content/PrismCode/PrismCode.js +1 -1
  81. package/dist/components/content/PrismCode/prismSetup.js +1 -1
  82. package/dist/components/content/PrismDiffCode/PrismDiffCode.js +1 -1
  83. package/dist/components/content/Result/Result.js +1 -1
  84. package/dist/components/content/Skeleton/Skeleton.js +1 -1
  85. package/dist/components/content/Tag/Tag.js +1 -1
  86. package/dist/components/content/Text.d.ts +28 -28
  87. package/dist/components/content/Text.js +1 -1
  88. package/dist/components/content/TextItem/TextItem.js +1 -1
  89. package/dist/components/content/Title.js +1 -1
  90. package/dist/components/content/Tree/Tree.js +1 -1
  91. package/dist/components/content/Tree/TreeNode.js +1 -1
  92. package/dist/components/content/Tree/styled.js +1 -1
  93. package/dist/components/content/Tree/tree-index.js +1 -1
  94. package/dist/components/content/Tree/use-checkbox-tree.js +1 -1
  95. package/dist/components/content/Tree/use-load-data.js +1 -1
  96. package/dist/components/content/highlightText.js +1 -1
  97. package/dist/components/content/use-auto-tooltip.js +1 -1
  98. package/dist/components/data/DataTable/DataTable.js +140 -21
  99. package/dist/components/data/DataTable/DataTable.js.map +1 -1
  100. package/dist/components/data/DataTable/index.d.ts +1 -1
  101. package/dist/components/data/DataTable/types.d.ts +19 -4
  102. package/dist/components/data/ItemTable/ItemTable.js +169 -25
  103. package/dist/components/data/ItemTable/ItemTable.js.map +1 -1
  104. package/dist/components/data/ItemTable/ItemTableBulkBar.js +1 -1
  105. package/dist/components/data/ItemTable/ItemTableDragPreview.js +1 -1
  106. package/dist/components/data/ItemTable/ItemTableFooter.js +1 -1
  107. package/dist/components/data/ItemTable/ItemTableToolbar.js +1 -1
  108. package/dist/components/data/ItemTable/types.d.ts +7 -2
  109. package/dist/components/data/TableBase/ColumnResizer.js +1 -1
  110. package/dist/components/data/TableBase/RowCollection.js +1 -1
  111. package/dist/components/data/TableBase/TableHeaderCell.js +1 -1
  112. package/dist/components/data/TableBase/TableRow.js +30 -5
  113. package/dist/components/data/TableBase/TableRow.js.map +1 -1
  114. package/dist/components/data/TableBase/TableView.d.ts +2 -1
  115. package/dist/components/data/TableBase/TableView.js +299 -75
  116. package/dist/components/data/TableBase/TableView.js.map +1 -1
  117. package/dist/components/data/TableBase/column-menu.js +1 -1
  118. package/dist/components/data/TableBase/column-tint.js +1 -1
  119. package/dist/components/data/TableBase/index.d.ts +1 -1
  120. package/dist/components/data/TableBase/row-menu.js +1 -1
  121. package/dist/components/data/TableBase/styled.js +75 -2
  122. package/dist/components/data/TableBase/styled.js.map +1 -1
  123. package/dist/components/data/TableBase/table-tree.js +129 -0
  124. package/dist/components/data/TableBase/table-tree.js.map +1 -0
  125. package/dist/components/data/TableBase/types.d.ts +46 -1
  126. package/dist/components/data/TableBase/types.js +1 -1
  127. package/dist/components/data/TableBase/types.js.map +1 -1
  128. package/dist/components/data/TableBase/use-cell-selection.js +0 -0
  129. package/dist/components/data/TableBase/use-column-order.js +1 -1
  130. package/dist/components/data/TableBase/use-container-width.js +1 -1
  131. package/dist/components/data/TableBase/use-row-move-animation.js +1 -1
  132. package/dist/components/data/TableBase/use-scrollability.js +1 -1
  133. package/dist/components/data/TableBase/use-table-columns.js +1 -1
  134. package/dist/components/data/TableBase/use-table-search.js +4 -4
  135. package/dist/components/data/TableBase/use-table-search.js.map +1 -1
  136. package/dist/components/data/TableBase/use-table-selection.js +124 -24
  137. package/dist/components/data/TableBase/use-table-selection.js.map +1 -1
  138. package/dist/components/data/TableBase/use-table-sort.js +1 -1
  139. package/dist/components/data/TableBase/use-table-sorts.js +1 -1
  140. package/dist/components/data/TableBase/use-table-storage.js +1 -1
  141. package/dist/components/data/TableBase/use-table-tree-state.js +107 -0
  142. package/dist/components/data/TableBase/use-table-tree-state.js.map +1 -0
  143. package/dist/components/data/index.d.ts +2 -2
  144. package/dist/components/fields/Checkbox/Checkbox.js +1 -1
  145. package/dist/components/fields/Checkbox/CheckboxGroup.js +1 -1
  146. package/dist/components/fields/Checkbox/context.js +1 -1
  147. package/dist/components/fields/ColorInput/ColorInput.js +1 -1
  148. package/dist/components/fields/ColorPicker/ColorPicker.js +1 -1
  149. package/dist/components/fields/ColorSwatch/ColorSwatch.js +1 -1
  150. package/dist/components/fields/ColorSwatchGroup/ColorSwatchGroup.js +1 -1
  151. package/dist/components/fields/ComboBox/ComboBox.js +1 -1
  152. package/dist/components/fields/CommandTextArea/CommandTextArea.js +8 -25
  153. package/dist/components/fields/CommandTextArea/CommandTextArea.js.map +1 -1
  154. package/dist/components/fields/CommandTextArea/caretPosition.js +1 -1
  155. package/dist/components/fields/CommandTextArea/useCaretAnchor.js +1 -1
  156. package/dist/components/fields/DatePicker/DateInput.js +1 -1
  157. package/dist/components/fields/DatePicker/DateInputBase.js +1 -1
  158. package/dist/components/fields/DatePicker/DatePicker.js +1 -1
  159. package/dist/components/fields/DatePicker/DatePickerButton.js +1 -1
  160. package/dist/components/fields/DatePicker/DatePickerElement.js +1 -1
  161. package/dist/components/fields/DatePicker/DatePickerInput.js +1 -1
  162. package/dist/components/fields/DatePicker/DatePickerSegment.js +1 -1
  163. package/dist/components/fields/DatePicker/DateRangePicker.js +1 -1
  164. package/dist/components/fields/DatePicker/DateRangeSeparatedPicker.js +1 -1
  165. package/dist/components/fields/DatePicker/MonthPicker.js +1 -1
  166. package/dist/components/fields/DatePicker/PeriodPicker.js +1 -1
  167. package/dist/components/fields/DatePicker/QuarterPicker.js +1 -1
  168. package/dist/components/fields/DatePicker/TimeInput.js +1 -1
  169. package/dist/components/fields/DatePicker/WeekPicker.js +1 -1
  170. package/dist/components/fields/DatePicker/YearPicker.js +1 -1
  171. package/dist/components/fields/DatePicker/parseDate.js +1 -1
  172. package/dist/components/fields/DatePicker/period.js +1 -1
  173. package/dist/components/fields/DatePicker/props.js +1 -1
  174. package/dist/components/fields/DatePicker/utils.js +1 -1
  175. package/dist/components/fields/FileInput/FileInput.js +1 -1
  176. package/dist/components/fields/FilterListBox/FilterListBox.js +1 -1
  177. package/dist/components/fields/FilterPicker/FilterPicker.js +1 -1
  178. package/dist/components/fields/Input/Input.js +1 -1
  179. package/dist/components/fields/ListBox/DraggableListBox.js +1 -1
  180. package/dist/components/fields/ListBox/ListBox.js +1 -1
  181. package/dist/components/fields/ListBoxPopover/ListBoxPopover.js +1 -1
  182. package/dist/components/fields/ListBoxPopover/listNavigation.js +1 -1
  183. package/dist/components/fields/ListBoxPopover/useCompositeFocus.js +1 -1
  184. package/dist/components/fields/NumberInput/NumberInput.js +1 -1
  185. package/dist/components/fields/NumberInput/StepButton.js +1 -1
  186. package/dist/components/fields/PasswordInput/PasswordInput.js +1 -1
  187. package/dist/components/fields/Picker/Picker.js +1 -1
  188. package/dist/components/fields/RadioGroup/Radio.js +1 -1
  189. package/dist/components/fields/RadioGroup/RadioGroup.js +1 -1
  190. package/dist/components/fields/RadioGroup/context.js +1 -1
  191. package/dist/components/fields/SearchComboBox/SearchComboBox.js +1 -1
  192. package/dist/components/fields/SearchInput/SearchInput.js +1 -1
  193. package/dist/components/fields/Select/Select.js +1 -1
  194. package/dist/components/fields/Slider/Gradation.js +1 -1
  195. package/dist/components/fields/Slider/HueSlider.js +1 -1
  196. package/dist/components/fields/Slider/RangeSlider.js +1 -1
  197. package/dist/components/fields/Slider/Slider.js +1 -1
  198. package/dist/components/fields/Slider/SliderBase.js +1 -1
  199. package/dist/components/fields/Slider/SliderThumb.js +1 -1
  200. package/dist/components/fields/Slider/SliderTrack.js +1 -1
  201. package/dist/components/fields/Slider/elements.js +1 -1
  202. package/dist/components/fields/Slider/index.js +1 -1
  203. package/dist/components/fields/Switch/Switch.js +1 -1
  204. package/dist/components/fields/TextArea/TextArea.js +10 -29
  205. package/dist/components/fields/TextArea/TextArea.js.map +1 -1
  206. package/dist/components/fields/TextInput/TextInput.js +1 -1
  207. package/dist/components/fields/TextInput/TextInputBase.js +1 -1
  208. package/dist/components/fields/TextInput/useAutoSizeTextArea.js +146 -0
  209. package/dist/components/fields/TextInput/useAutoSizeTextArea.js.map +1 -0
  210. package/dist/components/fields/TextInputMapper/TextInputMapper.js +1 -1
  211. package/dist/components/fields/color/ColorPanel.js +1 -1
  212. package/dist/components/fields/color/channels.js +1 -1
  213. package/dist/components/fields/color/color.js +1 -1
  214. package/dist/components/fields/color/context.js +1 -1
  215. package/dist/components/form/FieldWrapper/FieldWrapper.js +1 -1
  216. package/dist/components/form/Form/Field.js +1 -1
  217. package/dist/components/form/Form/Form.js +1 -1
  218. package/dist/components/form/Form/ResetButton/ResetButton.js +1 -1
  219. package/dist/components/form/Form/SubmitButton/SubmitButton.js +1 -1
  220. package/dist/components/form/Form/SubmitError.js +1 -1
  221. package/dist/components/form/Form/index.js +1 -1
  222. package/dist/components/form/Form/use-field/use-field-props.js +1 -1
  223. package/dist/components/form/Form/use-field/use-field.js +1 -1
  224. package/dist/components/form/Form/use-form.js +1 -1
  225. package/dist/components/form/Form/validation.js +1 -1
  226. package/dist/components/form/Label.js +1 -1
  227. package/dist/components/form/validation/ValidationIndicator.js +1 -1
  228. package/dist/components/form/validation/resolve-validation-props.js +1 -1
  229. package/dist/components/form/validation/use-validation-props.js +1 -1
  230. package/dist/components/form/wrapper.js +1 -1
  231. package/dist/components/helpers/DisplayTransition/DisplayTransition.js +1 -1
  232. package/dist/components/helpers/IconSwitch/IconSwitch.js +1 -1
  233. package/dist/components/layout/Board/Board.d.ts +30 -7
  234. package/dist/components/layout/Board/Board.js +16 -6
  235. package/dist/components/layout/Board/Board.js.map +1 -1
  236. package/dist/components/layout/Board/BoardProvider.js +1 -1
  237. package/dist/components/layout/Board/BoardResponsive.js +1 -1
  238. package/dist/components/layout/Board/Widget.d.ts +9 -0
  239. package/dist/components/layout/Board/Widget.js +3 -2
  240. package/dist/components/layout/Board/Widget.js.map +1 -1
  241. package/dist/components/layout/Board/WidgetHost.js +4 -3
  242. package/dist/components/layout/Board/WidgetHost.js.map +1 -1
  243. package/dist/components/layout/Board/board-context.js +1 -1
  244. package/dist/components/layout/Board/board-store.js +2 -2
  245. package/dist/components/layout/Board/board-store.js.map +1 -1
  246. package/dist/components/layout/Board/grid-core/calculate.js +1 -1
  247. package/dist/components/layout/Board/grid-core/collision-modes.js +7 -4
  248. package/dist/components/layout/Board/grid-core/collision-modes.js.map +1 -1
  249. package/dist/components/layout/Board/grid-core/collision.js +1 -1
  250. package/dist/components/layout/Board/grid-core/compactors.js +1 -1
  251. package/dist/components/layout/Board/grid-core/constraints.js +1 -1
  252. package/dist/components/layout/Board/grid-core/group-move.js +1 -1
  253. package/dist/components/layout/Board/grid-core/layout.js +1 -1
  254. package/dist/components/layout/Board/grid-core/placement.d.ts +58 -0
  255. package/dist/components/layout/Board/grid-core/placement.js +153 -0
  256. package/dist/components/layout/Board/grid-core/placement.js.map +1 -0
  257. package/dist/components/layout/Board/grid-core/sort.js +1 -1
  258. package/dist/components/layout/Board/grid-core/types.d.ts +6 -4
  259. package/dist/components/layout/Board/index.d.ts +1 -0
  260. package/dist/components/layout/Board/index.js +2 -1
  261. package/dist/components/layout/Board/index.js.map +1 -1
  262. package/dist/components/layout/Board/responsive-utils.js +1 -1
  263. package/dist/components/layout/Board/use-board-layout.js +1 -1
  264. package/dist/components/layout/Board/use-board-registry.js +91 -100
  265. package/dist/components/layout/Board/use-board-registry.js.map +1 -1
  266. package/dist/components/layout/Board/use-board-select-modifier-key.js +1 -1
  267. package/dist/components/layout/Board/use-board-selection.js +1 -1
  268. package/dist/components/layout/Flex.js +1 -1
  269. package/dist/components/layout/Flow.js +1 -1
  270. package/dist/components/layout/Grid.js +1 -1
  271. package/dist/components/layout/Panel.js +1 -1
  272. package/dist/components/layout/Prefix.js +1 -1
  273. package/dist/components/layout/ResizablePanel.js +1 -1
  274. package/dist/components/layout/Space.js +1 -1
  275. package/dist/components/layout/Suffix.js +1 -1
  276. package/dist/components/navigation/Pagination/Pagination.js +1 -1
  277. package/dist/components/navigation/Pagination/use-pagination.js +1 -1
  278. package/dist/components/navigation/Tabs/DraggableTabList.js +1 -1
  279. package/dist/components/navigation/Tabs/TabButton.js +1 -1
  280. package/dist/components/navigation/Tabs/TabDropIndicator.js +1 -1
  281. package/dist/components/navigation/Tabs/TabPanel.js +1 -1
  282. package/dist/components/navigation/Tabs/TabPicker.js +1 -1
  283. package/dist/components/navigation/Tabs/Tabs.js +1 -1
  284. package/dist/components/navigation/Tabs/TabsAction.js +1 -1
  285. package/dist/components/navigation/Tabs/TabsContext.js +1 -1
  286. package/dist/components/navigation/Tabs/popover-placement.js +1 -1
  287. package/dist/components/navigation/Tabs/styled.js +1 -1
  288. package/dist/components/navigation/Tabs/types.js +1 -1
  289. package/dist/components/navigation/Tabs/use-tab-editing.js +1 -1
  290. package/dist/components/navigation/Tabs/use-tab-indicator.js +1 -1
  291. package/dist/components/organisms/StatsCard/StatsCard.js +1 -1
  292. package/dist/components/other/Calendar/Calendar.js +1 -1
  293. package/dist/components/other/Calendar/CalendarCell.js +1 -1
  294. package/dist/components/other/Calendar/CalendarGrid.js +1 -1
  295. package/dist/components/other/Calendar/CalendarHeader.js +1 -1
  296. package/dist/components/other/Calendar/CalendarPanel.js +1 -1
  297. package/dist/components/other/Calendar/PeriodCalendar.js +1 -1
  298. package/dist/components/other/Calendar/PeriodGrid.js +1 -1
  299. package/dist/components/other/Calendar/RangeCalendar.js +1 -1
  300. package/dist/components/other/Calendar/styled.js +1 -1
  301. package/dist/components/other/CubeLogo/CubeLogo.js +1 -1
  302. package/dist/components/other/NoDataIcon/NoDataIcon.js +1 -1
  303. package/dist/components/overlays/AlertDialog/AlertDialog.js +1 -1
  304. package/dist/components/overlays/AlertDialog/AlertDialogApiProvider.js +1 -1
  305. package/dist/components/overlays/AlertDialog/AlertDialogZone.js +1 -1
  306. package/dist/components/overlays/Dialog/Dialog.js +1 -1
  307. package/dist/components/overlays/Dialog/DialogContainer.js +1 -1
  308. package/dist/components/overlays/Dialog/DialogForm.js +1 -1
  309. package/dist/components/overlays/Dialog/DialogTrigger.js +1 -1
  310. package/dist/components/overlays/Dialog/context.js +1 -1
  311. package/dist/components/overlays/Dialog/use-dialog-container.js +1 -1
  312. package/dist/components/overlays/Modal/Modal.js +1 -1
  313. package/dist/components/overlays/Modal/OpenTransitionContext.js +1 -1
  314. package/dist/components/overlays/Modal/Overlay.js +1 -1
  315. package/dist/components/overlays/Modal/Popover.js +1 -1
  316. package/dist/components/overlays/Modal/Tray.js +1 -1
  317. package/dist/components/overlays/Modal/Underlay.js +1 -1
  318. package/dist/components/overlays/Notifications/Notification.js +1 -1
  319. package/dist/components/overlays/Notifications/NotificationAction.js +1 -1
  320. package/dist/components/overlays/Notifications/NotificationCard.js +1 -1
  321. package/dist/components/overlays/Notifications/NotificationContext.js +1 -1
  322. package/dist/components/overlays/Notifications/NotificationItem.js +1 -1
  323. package/dist/components/overlays/Notifications/OverlayContainer.js +1 -1
  324. package/dist/components/overlays/Notifications/OverlayProvider.js +1 -1
  325. package/dist/components/overlays/Notifications/PersistentNotificationsList.js +1 -1
  326. package/dist/components/overlays/Notifications/dismissed-storage.js +1 -1
  327. package/dist/components/overlays/Notifications/format-relative-time.js +1 -1
  328. package/dist/components/overlays/Notifications/index.js +1 -1
  329. package/dist/components/overlays/Notifications/use-notification-state.js +1 -1
  330. package/dist/components/overlays/Notifications/use-notifications.js +1 -1
  331. package/dist/components/overlays/Notifications/use-overlay-timers.js +1 -1
  332. package/dist/components/overlays/Notifications/use-persistent-notifications.js +1 -1
  333. package/dist/components/overlays/Notifications/use-persistent-state.js +1 -1
  334. package/dist/components/overlays/Notifications/use-toast-state.js +1 -1
  335. package/dist/components/overlays/Toast/ToastItem.js +1 -1
  336. package/dist/components/overlays/Toast/index.js +1 -1
  337. package/dist/components/overlays/Toast/useProgressToast.js +1 -1
  338. package/dist/components/overlays/Toast/useToast.js +1 -1
  339. package/dist/components/overlays/Tooltip/Tooltip.js +2 -1
  340. package/dist/components/overlays/Tooltip/Tooltip.js.map +1 -1
  341. package/dist/components/overlays/Tooltip/TooltipProvider.js +1 -1
  342. package/dist/components/overlays/Tooltip/TooltipTrigger.js +1 -1
  343. package/dist/components/overlays/Tooltip/context.js +1 -1
  344. package/dist/components/portal/Portal.js +1 -1
  345. package/dist/components/portal/PortalProvider.js +1 -1
  346. package/dist/components/portal/usePortal.js +1 -1
  347. package/dist/components/shared/DraggableCollection.js +1 -1
  348. package/dist/components/shared/InvalidIcon.js +1 -1
  349. package/dist/components/shared/ValidIcon.js +1 -1
  350. package/dist/components/status/LoadingAnimation/LoadingAnimation.js +1 -1
  351. package/dist/components/status/Spin/Cube.js +1 -1
  352. package/dist/components/status/Spin/InternalSpinner.js +1 -1
  353. package/dist/components/status/Spin/Spin.js +1 -1
  354. package/dist/components/status/Spin/SpinsContainer.js +1 -1
  355. package/dist/data/item-themes.js +1 -1
  356. package/dist/data/themes.js +1 -1
  357. package/dist/eslint-plugin/defaults.generated.js +17 -1
  358. package/dist/eslint-plugin/defaults.generated.js.map +1 -1
  359. package/dist/eslint-plugin/index.js +1 -1
  360. package/dist/eslint-plugin/rules/no-redundant-default-prop.js +1 -1
  361. package/dist/i18n/I18nProvider.js +1 -1
  362. package/dist/i18n/createFormatter.js +1 -1
  363. package/dist/i18n/index.js +1 -1
  364. package/dist/i18n/instance.js +1 -1
  365. package/dist/i18n/locales/de-DE/uikit.js +2 -1
  366. package/dist/i18n/locales/en-US/uikit.js +2 -1
  367. package/dist/i18n/locales/en-US/uikit.json.d.ts +1 -0
  368. package/dist/i18n/locales/es-ES/uikit.js +2 -1
  369. package/dist/i18n/locales/es-MX/uikit.js +2 -1
  370. package/dist/i18n/locales/fr-FR/uikit.js +2 -1
  371. package/dist/i18n/locales/it-IT/uikit.js +2 -1
  372. package/dist/i18n/locales/ja-JP/uikit.js +2 -1
  373. package/dist/i18n/locales/nb-NO/uikit.js +2 -1
  374. package/dist/i18n/locales/pt-BR/uikit.js +2 -1
  375. package/dist/i18n/locales/pt-PT/uikit.js +2 -1
  376. package/dist/i18n/locales/sv-SE/uikit.js +2 -1
  377. package/dist/i18n/locales/vi-VN/uikit.js +2 -1
  378. package/dist/i18n/locales.js +1 -1
  379. package/dist/i18n/useFormatter.js +1 -1
  380. package/dist/i18n/useI18n.js +1 -1
  381. package/dist/icons/AdjustmentsHorizontalIcon.js +1 -1
  382. package/dist/icons/AdjustmentsIcon.js +1 -1
  383. package/dist/icons/AiIcon.js +1 -1
  384. package/dist/icons/AreaChartIcon.js +1 -1
  385. package/dist/icons/ArrowNarrowDownIcon.js +1 -1
  386. package/dist/icons/ArrowNarrowUpIcon.js +1 -1
  387. package/dist/icons/BackwardIcon.js +1 -1
  388. package/dist/icons/BarChartIcon.js +1 -1
  389. package/dist/icons/BellFilledIcon.js +1 -1
  390. package/dist/icons/BellIcon.js +1 -1
  391. package/dist/icons/BooleanIcon.js +1 -1
  392. package/dist/icons/CalendarEditIcon.js +1 -1
  393. package/dist/icons/CalendarIcon.js +1 -1
  394. package/dist/icons/CaretDownIcon.js +1 -1
  395. package/dist/icons/CaretUpIcon.js +1 -1
  396. package/dist/icons/ChartAreaStackedIcon.js +1 -1
  397. package/dist/icons/ChartAreaStackedPercentageIcon.js +1 -1
  398. package/dist/icons/ChartBarGroupedHorizontalIcon.js +1 -1
  399. package/dist/icons/ChartBarGroupedIcon.js +1 -1
  400. package/dist/icons/ChartBarHorizontalIcon.js +1 -1
  401. package/dist/icons/ChartBarLineIcon.js +1 -1
  402. package/dist/icons/ChartBarStackedHorizontalIcon.js +1 -1
  403. package/dist/icons/ChartBarStackedIcon.js +1 -1
  404. package/dist/icons/ChartBarStackedPercentageHorizontalIcon.js +1 -1
  405. package/dist/icons/ChartBarStackedPercentageIcon.js +1 -1
  406. package/dist/icons/ChartBoxPlot2Icon.js +1 -1
  407. package/dist/icons/ChartBoxPlotIcon.js +1 -1
  408. package/dist/icons/ChartBubbleIcon.js +1 -1
  409. package/dist/icons/ChartDonut2Icon.js +1 -1
  410. package/dist/icons/ChartFunnelIcon.js +1 -1
  411. package/dist/icons/ChartHeatmapIcon.js +1 -1
  412. package/dist/icons/ChartKPIIcon.js +1 -1
  413. package/dist/icons/ChartPie2Icon.js +1 -1
  414. package/dist/icons/ChartScatterIcon.js +1 -1
  415. package/dist/icons/CheckCircleFilledIcon.js +1 -1
  416. package/dist/icons/CheckCircleIcon.js +1 -1
  417. package/dist/icons/CheckIcon.js +1 -1
  418. package/dist/icons/CircleFilledIcon.js +1 -1
  419. package/dist/icons/ClearIcon.js +1 -1
  420. package/dist/icons/CloseCircleFilledIcon.js +1 -1
  421. package/dist/icons/CloseCircleIcon.js +1 -1
  422. package/dist/icons/CloseIcon.js +1 -1
  423. package/dist/icons/CodeIcon.js +1 -1
  424. package/dist/icons/ColumnTotalIcon.js +1 -1
  425. package/dist/icons/CopyIcon.js +1 -1
  426. package/dist/icons/CountIcon.js +1 -1
  427. package/dist/icons/CubeIcon.js +1 -1
  428. package/dist/icons/CubePauseIcon.js +1 -1
  429. package/dist/icons/CubePlayIcon.js +1 -1
  430. package/dist/icons/CurrencyDollarIcon.js +1 -1
  431. package/dist/icons/DangerIcon.js +1 -1
  432. package/dist/icons/DashboardIcon.js +1 -1
  433. package/dist/icons/DatabaseIcon.js +1 -1
  434. package/dist/icons/DecimalDecreaseIcon.js +1 -1
  435. package/dist/icons/DecimalIncreaseIcon.js +1 -1
  436. package/dist/icons/DirectionIcon.js +1 -1
  437. package/dist/icons/DonutIcon.js +1 -1
  438. package/dist/icons/DownIcon.js +1 -1
  439. package/dist/icons/EditIcon.js +1 -1
  440. package/dist/icons/ExclamationCircleFilledIcon.js +1 -1
  441. package/dist/icons/ExclamationCircleIcon.js +1 -1
  442. package/dist/icons/ExclamationIcon.js +1 -1
  443. package/dist/icons/EyeIcon.js +1 -1
  444. package/dist/icons/EyeInvisibleIcon.js +1 -1
  445. package/dist/icons/FilterIcon.js +1 -1
  446. package/dist/icons/FolderFilledIcon.js +1 -1
  447. package/dist/icons/FolderIcon.js +1 -1
  448. package/dist/icons/FolderOpenFilledIcon.js +1 -1
  449. package/dist/icons/FolderOpenIcon.js +1 -1
  450. package/dist/icons/ForwardIcon.js +1 -1
  451. package/dist/icons/GripVerticalIcon.js +1 -1
  452. package/dist/icons/HierarchyIcon.js +1 -1
  453. package/dist/icons/HierarchyOpenIcon.js +1 -1
  454. package/dist/icons/Icon.js +1 -1
  455. package/dist/icons/InfoCircleIcon.js +1 -1
  456. package/dist/icons/InfoIcon.js +1 -1
  457. package/dist/icons/KeyIcon.js +1 -1
  458. package/dist/icons/LeftIcon.js +1 -1
  459. package/dist/icons/LineChartIcon.js +1 -1
  460. package/dist/icons/LoadingIcon.js +1 -1
  461. package/dist/icons/LockFilledIcon.js +1 -1
  462. package/dist/icons/LockIcon.js +1 -1
  463. package/dist/icons/MoreIcon.js +1 -1
  464. package/dist/icons/NotAllowedIcon.js +1 -1
  465. package/dist/icons/Number123Icon.js +1 -1
  466. package/dist/icons/NumberIcon.js +1 -1
  467. package/dist/icons/PauseCircleFilledIcon.js +1 -1
  468. package/dist/icons/PauseCircleIcon.js +1 -1
  469. package/dist/icons/PauseIcon.js +1 -1
  470. package/dist/icons/PercentageIcon.js +1 -1
  471. package/dist/icons/PieChartIcon.js +1 -1
  472. package/dist/icons/PipetteIcon.js +1 -1
  473. package/dist/icons/PlayCircleIcon.js +1 -1
  474. package/dist/icons/PlayIcon.js +1 -1
  475. package/dist/icons/PlusIcon.js +1 -1
  476. package/dist/icons/ProgressBarIcon.js +1 -1
  477. package/dist/icons/ReloadIcon.js +1 -1
  478. package/dist/icons/ReportIcon.js +1 -1
  479. package/dist/icons/ReturnIcon.js +1 -1
  480. package/dist/icons/RightIcon.js +1 -1
  481. package/dist/icons/RowTotalsIcon.js +1 -1
  482. package/dist/icons/SchemeIcon.js +1 -1
  483. package/dist/icons/SearchIcon.js +1 -1
  484. package/dist/icons/SemanticQueryIcon.js +1 -1
  485. package/dist/icons/SettingsIcon.js +1 -1
  486. package/dist/icons/ShieldFilledIcon.js +1 -1
  487. package/dist/icons/ShieldIcon.js +1 -1
  488. package/dist/icons/SlashIcon.js +1 -1
  489. package/dist/icons/SparklesIcon.js +1 -1
  490. package/dist/icons/SqlIcon.js +1 -1
  491. package/dist/icons/StatsIcon.js +1 -1
  492. package/dist/icons/StopIcon.js +1 -1
  493. package/dist/icons/StringIcon.js +1 -1
  494. package/dist/icons/SubtotalsIcon.js +1 -1
  495. package/dist/icons/SwitchIcon.js +1 -1
  496. package/dist/icons/TableIcon.js +1 -1
  497. package/dist/icons/ThumbsDownIcon.js +1 -1
  498. package/dist/icons/ThumbsUpIcon.js +1 -1
  499. package/dist/icons/ThunderboltCrossedIcon.js +1 -1
  500. package/dist/icons/ThunderboltFilledIcon.js +1 -1
  501. package/dist/icons/ThunderboltIcon.js +1 -1
  502. package/dist/icons/TimeIcon.js +1 -1
  503. package/dist/icons/TrashIcon.js +1 -1
  504. package/dist/icons/UnlockIcon.js +1 -1
  505. package/dist/icons/UpIcon.js +1 -1
  506. package/dist/icons/UserGroupIcon.js +1 -1
  507. package/dist/icons/UserIcon.js +1 -1
  508. package/dist/icons/UserLockIcon.js +1 -1
  509. package/dist/icons/ViewIcon.js +1 -1
  510. package/dist/icons/WarningFilledIcon.js +1 -1
  511. package/dist/icons/WarningIcon.js +1 -1
  512. package/dist/icons/wrap-icon.js +1 -1
  513. package/dist/index.d.ts +4 -3
  514. package/dist/index.js +3 -2
  515. package/dist/index.js.map +1 -1
  516. package/dist/probe/canonicalize.js +1 -1
  517. package/dist/probe/css.js +1 -1
  518. package/dist/probe/index.js +1 -1
  519. package/dist/provider.js +1 -1
  520. package/dist/providers/TrackingProvider.js +1 -1
  521. package/dist/providers/navigationAdapter.default.js +1 -1
  522. package/dist/tokens/base.js +1 -1
  523. package/dist/tokens/color-seed.js +1 -1
  524. package/dist/tokens/color-theme.js +1 -1
  525. package/dist/tokens/colors.js +1 -1
  526. package/dist/tokens/index.js +1 -1
  527. package/dist/tokens/layout.js +1 -1
  528. package/dist/tokens/lazy-styles.js +1 -1
  529. package/dist/tokens/palette-config.js +1 -1
  530. package/dist/tokens/palette.js +1 -1
  531. package/dist/tokens/shadows.js +1 -1
  532. package/dist/tokens/sizes.js +1 -1
  533. package/dist/tokens/spacing.js +1 -1
  534. package/dist/tokens/typography.js +1 -1
  535. package/dist/utils/ResizeSensor.js +1 -1
  536. package/dist/utils/is-dev-env.js +1 -1
  537. package/dist/utils/modules.js +1 -1
  538. package/dist/utils/promise.js +1 -1
  539. package/dist/utils/raf.js +1 -1
  540. package/dist/utils/random.js +1 -1
  541. package/dist/utils/range.js +1 -1
  542. package/dist/utils/react/RenderCache.js +1 -1
  543. package/dist/utils/react/Slots.js +1 -1
  544. package/dist/utils/react/chain.js +1 -1
  545. package/dist/utils/react/disabledProps.js +1 -1
  546. package/dist/utils/react/forwardRefWithGenerics.js +1 -1
  547. package/dist/utils/react/index.js +1 -1
  548. package/dist/utils/react/interactions.js +1 -1
  549. package/dist/utils/react/isTextOnly.js +1 -1
  550. package/dist/utils/react/mapProps.js +1 -1
  551. package/dist/utils/react/mergeProps.js +1 -1
  552. package/dist/utils/react/nullableValue.js +1 -1
  553. package/dist/utils/react/resolveIcon.js +1 -1
  554. package/dist/utils/react/sharedStore.js +1 -1
  555. package/dist/utils/react/useBufferedValue.js +1 -1
  556. package/dist/utils/react/useCombinedRefs.js +1 -1
  557. package/dist/utils/react/useControlledFocusVisible.js +1 -1
  558. package/dist/utils/react/useEventBus.js +1 -1
  559. package/dist/utils/react/useId.js +1 -1
  560. package/dist/utils/react/useIsDarwin.js +1 -1
  561. package/dist/utils/react/useKeySymbols.js +1 -1
  562. package/dist/utils/react/useLayoutEffect.js +1 -1
  563. package/dist/utils/react/useLocalStorage.js +1 -1
  564. package/dist/utils/react/useMergeStyles.js +1 -1
  565. package/dist/utils/react/usePopoverSync.js +1 -1
  566. package/dist/utils/react/useQaProps.js +1 -1
  567. package/dist/utils/react/useViewportSize.js +1 -1
  568. package/dist/utils/react/wrapNodeIfPlain.js +1 -1
  569. package/dist/utils/selection.js +1 -1
  570. package/dist/utils/styles.js +1 -1
  571. package/dist/utils/tree.js +1 -1
  572. package/dist/utils/warnings.js +1 -1
  573. package/dist/version.js +3 -3
  574. package/docs/Introduction.md +85 -97
  575. package/docs/Usage.md +26 -0
  576. package/docs/components/data/DataTable.md +110 -11
  577. package/docs/components/data/ItemTable.md +63 -1
  578. package/docs/components/layout/Board.md +37 -6
  579. package/docs/components/overlays/Tooltip.md +12 -0
  580. package/docs/tasty/configuration.md +10 -6
  581. package/docs/tasty/dsl.md +99 -2
  582. package/docs/tasty/styles.md +3 -1
  583. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../../src/components/data/TableBase/types.ts"],"sourcesContent":["import type { Key } from '@react-types/shared';\nimport type { Styles } from '@tenphi/tasty';\nimport type { ReactNode } from 'react';\nimport type { CubeItemProps } from '../../content/Item';\n\nexport type CubeTableSortDirection = 'asc' | 'desc';\n/**\n * Named row heights: 28px, 32px and 40px.\n *\n * A subset of the kit's size scale, and the same three steps `size` would give —\n * but `rowSize` moves only the ROWS. `size` also drives the header, so reaching\n * for a denser body through it drags the header down too.\n */\nexport type CubeTableRowSize = 'small' | 'medium' | 'large';\nexport type CubeTableAlign = 'start' | 'center' | 'end';\nexport type CubeTableRowSection = 'body' | 'pinnedTop' | 'pinnedBottom';\n\n/**\n * `asc | desc` rather than React Aria's `ascending | descending`: we do not use\n * `useTableState`, so there is no `SortDescriptor` interop to preserve, and\n * every consumer and server query parameter already speaks `asc|desc`.\n * `aria-sort` is a one-line map in the header cell.\n */\n/**\n * A rectangular block of cells, stored as two opposite corners.\n *\n * Corners rather than a set of keys so the selection survives a re-sort or a\n * page change the way a keyed row selection does: \"the block between these two\n * cells\" is re-resolved against the current order every render.\n */\n/**\n * The key a cell range identifies a row by.\n *\n * Not the consumer's row key: a pinned total is commonly the SAME record at the\n * top and the bottom (`id: 'total'`), and one flat key space collapsed the two\n * into whichever `indexOf` found first — so a range aimed at the footer total\n * resolved against the header one. The section is part of the identity here,\n * and only here; `ctx.rowKey` stays the consumer's own.\n */\nexport function selectionRowKey(\n section: CubeTableRowSection,\n rowKey: Key,\n): Key {\n return section === 'body' ? rowKey : `${section}:${rowKey}`;\n}\n\nexport interface CubeTableCellRange {\n fromRowKey: Key;\n toRowKey: Key;\n fromColumnKey: string;\n toColumnKey: string;\n}\n\nexport interface CubeTableSort {\n /** `key` of the sorted column. */\n columnKey: string;\n direction: CubeTableSortDirection;\n}\n\n/* ── render contexts ─────────────────────────────────────────────────────── */\n\nexport interface CubeTableCellContext<T = any> {\n row: T;\n rowKey: Key;\n rowIndex: number;\n columnKey: string;\n columnIndex: number;\n section: CubeTableRowSection;\n /** Whether the ROW is selected, matching `isRowFocused` below. */\n isSelected: boolean;\n /**\n * Not yet wired — always absent.\n *\n * Optional rather than `boolean`, because there is nowhere honest to compute\n * them from where this context is built. Focus lives in the DOM, and drop\n * state comes out of `useDropIndicator`, a hook that can only run inside the\n * row component — so populating either means moving the `render` / `cellStyles`\n * call sites into `TableRow`. Declaring them required and passing `false`\n * would just be a documented lie.\n */\n isRowFocused?: boolean;\n isDropTarget?: boolean;\n}\n\nexport interface CubeTableRowContext<T = any> {\n row: T;\n rowKey: Key;\n rowIndex: number;\n section: CubeTableRowSection;\n isSelected: boolean;\n /** Not yet wired — always absent. See `CubeTableCellContext` for why. */\n isFocused?: boolean;\n isDropTarget?: boolean;\n}\n\nexport interface CubeTableHeaderContext {\n columnKey: string;\n columnIndex: number;\n sort: CubeTableSortDirection | null;\n isSortable: boolean;\n isResizing: boolean;\n width: number | null;\n}\n\n/* ── column ──────────────────────────────────────────────────────────────── */\n\n/**\n * Rich header content. Every slot except `menu` maps 1:1 onto the `Item`\n * rendered inside the header `<th>`, so a header gets icon / description /\n * tooltip / suffix / actions for free; `menu` is mounted into that `Item`'s\n * `actions` slot behind a `⋮` trigger.\n */\nexport interface CubeTableColumnHeader {\n icon?: CubeItemProps['icon'];\n rightIcon?: CubeItemProps['rightIcon'];\n prefix?: ReactNode;\n suffix?: ReactNode;\n description?: ReactNode;\n descriptionPlacement?: CubeItemProps['descriptionPlacement'];\n /** `true` = auto tooltip when the label is truncated. */\n tooltip?: CubeItemProps['tooltip'];\n actions?: ReactNode;\n /** Hide `actions` until hover/focus. @default true */\n autoHideActions?: boolean;\n /**\n * A column menu, opened from a `⋮` trigger in the header's actions slot and —\n * unless the table says otherwise — by right-click or Shift+F10.\n *\n * `Menu.Item` children. Opaque: the table mounts the node and reports the\n * pressed key back through `onColumnMenuAction`, so what a \"pin\" or a \"drill\n * down\" means stays in the consuming app. The exception is the reserved sort\n * keys (`sort-asc`, `sort-desc`, `clear-sort`), which the table labels,\n * disables when redundant, and applies itself before telling the consumer.\n *\n * An empty menu renders no trigger at all, rather than one that opens nothing.\n * Ignored when `header.render` takes the cell over.\n */\n menu?: ReactNode;\n /** Props for the `⋮` trigger. Merged over the table's `columnMenuTriggerProps`. */\n menuTriggerProps?: Record<string, any>;\n /** Props for the `Menu`. Merged over the table's `columnMenuProps`. */\n menuProps?: Record<string, any>;\n /** Called before the table-level `onColumnMenuAction`. */\n onMenuAction?: (action: string) => void;\n theme?: CubeItemProps['theme'];\n /**\n * Full takeover of the header cell's content. Overrides `title` and every\n * slot — including `actions` and `menu`, which are simply not rendered. A\n * takeover that wants a menu owns the trigger too.\n */\n render?: (ctx: CubeTableHeaderContext) => ReactNode;\n /** Overrides `column.align` for the header only. */\n align?: CubeTableAlign;\n styles?: Styles;\n}\n\n/* ── column colour ───────────────────────────────────────────────────────── */\n\n/**\n * A palette theme a column can borrow its tint from.\n *\n * Resolved through the same runtime generator as a custom colour, seeded from the\n * theme's own hue and saturation in `palette-config` — so it tracks a re-seeded\n * palette, and it gets the banding step the palette itself does not define.\n *\n * `special` is absent deliberately: it is a standalone `mode: 'fixed'` theme with\n * no tinted-surface ramp to borrow.\n */\nexport type CubeTableColumnTheme =\n | 'primary'\n | 'purple'\n | 'success'\n | 'danger'\n | 'warning'\n | 'note';\n\n/**\n * How a column is tinted.\n *\n * Every form but the last is *derived*: only a hue and a saturation are kept, and\n * the tone ramp plus an `AA`/`AAA` text floor are re-solved per colour scheme. So\n * a column stays readable in light, dark and high contrast without the caller\n * checking — which is the part hand-picked hex pairs get wrong.\n */\nexport type CubeTableColumnColor =\n /** A palette theme name. */\n | CubeTableColumnTheme\n /** Any colour Glaze parses — hex, `rgb()`, `hsl()`, `okhsl()`, `oklch()`. */\n | (string & {})\n /** The seed said directly. `saturation` is 0–100. */\n | { hue: number; saturation?: number }\n /**\n * Full manual control, as tasty colour strings (`'#note-surface'`, `'#purple.10'`).\n *\n * Nothing is derived and nothing is contrast-checked — this is the escape\n * hatch, and readability in every scheme becomes the caller's problem.\n * `fillBand` defaults to `fill`, which turns banding off for the column.\n */\n | { fill: string; fillBand?: string; text?: string };\n\n/**\n * Which parts of a column `color` reaches.\n *\n * @default ['header','body','totals']\n */\nexport type CubeTableColumnColorScope = 'header' | 'body' | 'totals';\n\nexport interface CubeTableColumn<T = any> {\n /**\n * Column id. Also the default data path — dot notation is supported\n * (`'owner.name'`). Anything beyond a path needs `getValue`.\n */\n key: string;\n /** Header label. Shorthand for `header` with no extra slots. */\n title?: ReactNode;\n header?: CubeTableColumnHeader;\n /**\n * Renders `<th scope=\"row\">` instead of `<td>`, names the row for screen\n * readers, and hosts the `rowLink` anchor. Defaults to the first\n * non-structural column when a row link is present.\n */\n isRowHeader?: boolean;\n\n /* sizing */\n /** Fixed width in px. Mutually exclusive with `flex`. */\n width?: number;\n /** Weight for the leftover space. @default 1 when `width` is unset */\n flex?: number;\n /** @default 150 */\n minWidth?: number;\n maxWidth?: number;\n /** Inherits the table's `isResizable`. */\n isResizable?: boolean;\n /**\n * Inherits the table's `isColumnReorderable`; `false` pins this column in\n * place while the others still move around it.\n */\n isReorderable?: boolean;\n /** Stick to the start/end edge during horizontal scroll. */\n pin?: 'start' | 'end';\n /** Hide without losing width or order state. */\n isHidden?: boolean;\n\n /* value pipeline */\n /** @default (row) => get(row, key) */\n getValue?: (row: T, rowIndex: number) => unknown;\n /** Raw value → display text. Feeds client sort, client search and TSV copy. */\n format?: (value: any, row: T, rowIndex: number) => string;\n /** Client-side comparator over raw `getValue` results. */\n compare?: (a: any, b: any, rowA: T, rowB: T) => number;\n\n /* rendering */\n /** A returned string is wrapped in a truncating `TextItem`. */\n render?: (\n value: any,\n row: T,\n rowIndex: number,\n ctx: CubeTableCellContext<T>,\n ) => ReactNode;\n cellStyles?: Styles | ((ctx: CubeTableCellContext<T>) => Styles | undefined);\n cellProps?: (ctx: CubeTableCellContext<T>) => Record<string, any> | undefined;\n\n /**\n * Tints the column — header, cells and pinned totals — with an adaptive fill\n * and a text colour solved to stay readable on it in every scheme.\n *\n * Row banding survives: the tint carries its own band one tone step away, so\n * the stripe still reads down the column instead of being painted over.\n */\n color?: CubeTableColumnColor;\n /** Narrows what `color` reaches. @default ['header','body','totals'] */\n colorScope?: readonly CubeTableColumnColorScope[];\n\n /* behaviour */\n align?: CubeTableAlign;\n /**\n * Opt IN, per column — a table is not sortable until at least one column says\n * so, and `sortMode` then defaults to `'client'`.\n *\n * (This read `@default true` for a long time, which was never what the code\n * did: `TableView` requires `isSortable === true` before a header becomes a\n * control at all.)\n *\n * @default false\n */\n isSortable?: boolean;\n /** Two-state cycling (asc ↔ desc), never back to unsorted. @default false */\n disallowSortRemoval?: boolean;\n /** Include in the built-in client search. @default true */\n isSearchable?: boolean;\n /** Include in TSV copy. @default true */\n isCopyable?: boolean;\n /** Wrap text and let the row grow to fit. */\n autoHeight?: boolean;\n\n /** Consumer-owned bag. Never reaches the DOM. */\n meta?: Record<string, unknown>;\n}\n\n/* ── resolved layout (internal, but exported for adapters) ───────────────── */\n\nexport interface CubeResolvedColumn<T = any>\n // `width`, `minWidth`, `maxWidth`, `flex` and `align` are all resolved here,\n // so they narrow from optional to definite and must be replaced, not extended.\n extends Omit<\n CubeTableColumn<T>,\n 'width' | 'minWidth' | 'maxWidth' | 'flex' | 'align'\n > {\n /** Position among the visible leaf columns, 0-based. */\n index: number;\n /** `aria-colindex`, 1-based and document-absolute. */\n ariaColIndex: number;\n /** Resolved pixel width, or `null` while the container is unmeasured. */\n width: number | null;\n minWidth: number;\n maxWidth: number | null;\n flex: number | null;\n align: CubeTableAlign;\n /** Cumulative sticky offset in px for a pinned column. */\n pinOffset: number | null;\n /** `true` for the last pinned-start / first pinned-end column. */\n isPinEdge: boolean;\n /** Structural columns (selection, drag handle, row menu) never enter sorting,\n * search, copy, or the value pipeline. */\n isStructural: boolean;\n}\n\nexport interface CubeTableColumnLayout<T = any> {\n columns: CubeResolvedColumn<T>[];\n pinnedStartWidth: number;\n pinnedEndWidth: number;\n /** Sum of resolved widths, or `null` while unmeasured. */\n totalWidth: number | null;\n /** `true` when the columns cannot fit and the table scrolls horizontally. */\n isOverflowing: boolean;\n}\n\n/**\n * How a refresh over an existing result is presented.\n *\n * - `overlay` — keep the previous rows visible, dimmed, behind a spinner. A\n * server page or a re-sort never blanks the table.\n * - `skeleton` — discard the previous rows and show placeholders.\n * - `none` — no visuals beyond `aria-busy`; the page owns the indicator.\n */\nexport type CubeTableLoadingIndicator = 'overlay' | 'skeleton' | 'none';\n\nexport type CubeTableSelectionMode = 'none' | 'single' | 'multiple';\n\n/**\n * What the header checkbox acts on.\n *\n * - `page` — the rows on the current page.\n * - `filtered` — every row passing the current search/filter, across pages.\n * - `all` — emits the `'all'` sentinel, meaning \"everything, including rows the\n * client has not loaded\". The consumer decides what that means for its query.\n */\nexport type CubeTableSelectAllMode = 'page' | 'filtered' | 'all';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAuCA,SAAgB,gBACd,SACA,QACK;AACL,QAAO,YAAY,SAAS,SAAS,GAAG,QAAQ,GAAG"}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../../src/components/data/TableBase/types.ts"],"sourcesContent":["import type { Key } from '@react-types/shared';\nimport type { Styles } from '@tenphi/tasty';\nimport type { ReactNode } from 'react';\nimport type { CubeItemProps } from '../../content/Item';\n\nexport type CubeTableSortDirection = 'asc' | 'desc';\n/**\n * Named row heights: 28px, 32px and 40px.\n *\n * A subset of the kit's size scale, and the same three steps `size` would give —\n * but `rowSize` moves only the ROWS. `size` also drives the header, so reaching\n * for a denser body through it drags the header down too.\n */\nexport type CubeTableRowSize = 'small' | 'medium' | 'large';\nexport type CubeTableAlign = 'start' | 'center' | 'end';\nexport type CubeTableRowSection = 'body' | 'pinnedTop' | 'pinnedBottom';\n\n/**\n * `asc | desc` rather than React Aria's `ascending | descending`: we do not use\n * `useTableState`, so there is no `SortDescriptor` interop to preserve, and\n * every consumer and server query parameter already speaks `asc|desc`.\n * `aria-sort` is a one-line map in the header cell.\n */\n/**\n * A rectangular block of cells, stored as two opposite corners.\n *\n * Corners rather than a set of keys so the selection survives a re-sort or a\n * page change the way a keyed row selection does: \"the block between these two\n * cells\" is re-resolved against the current order every render.\n */\n/**\n * The key a cell range identifies a row by.\n *\n * Not the consumer's row key: a pinned total is commonly the SAME record at the\n * top and the bottom (`id: 'total'`), and one flat key space collapsed the two\n * into whichever `indexOf` found first — so a range aimed at the footer total\n * resolved against the header one. The section is part of the identity here,\n * and only here; `ctx.rowKey` stays the consumer's own.\n */\nexport function selectionRowKey(\n section: CubeTableRowSection,\n rowKey: Key,\n): Key {\n return section === 'body' ? rowKey : `${section}:${rowKey}`;\n}\n\nexport interface CubeTableCellRange {\n fromRowKey: Key;\n toRowKey: Key;\n fromColumnKey: string;\n toColumnKey: string;\n}\n\nexport interface CubeTableTreeRowState {\n /** Zero-based depth in the hierarchy. */\n level: number;\n parentKey: Key | null;\n hasChildren: boolean;\n isExpanded: boolean;\n}\n\nexport interface CubeTableRowExpandInfo<T = any> {\n row: T;\n rowKey: Key;\n level: number;\n parentKey: Key | null;\n expanded: boolean;\n}\n\n/** Shared root sizing contract used by both table adapters. */\nexport interface CubeTableLayoutProps {\n /**\n * Shrink-wraps the frame to its rendered rows instead of filling the\n * available flex pane. This mode disables virtualization because there is no\n * bounded vertical viewport to virtualize against.\n *\n * @default false\n */\n isAutoHeight?: boolean;\n}\n\n/** Shared opt-in hierarchy contract used by both table adapters. */\nexport interface CubeTableTreeProps<T = any> {\n /**\n * Returns a row's already-loaded children. Supplying this enables tree mode\n * and makes `data` the top-level row collection.\n */\n getRowChildren?: (row: T) => readonly T[] | undefined;\n /** Column that owns the indentation and disclosure control. */\n treeColumnKey?: string;\n /** Controlled expanded row keys. */\n expandedKeys?: Key[];\n /** Initially expanded row keys. */\n defaultExpandedKeys?: Key[];\n /** Called after a user expands or collapses a row. */\n onExpand?: (keys: Key[], info: CubeTableRowExpandInfo<T>) => void;\n}\n\nexport interface CubeTableSort {\n /** `key` of the sorted column. */\n columnKey: string;\n direction: CubeTableSortDirection;\n}\n\n/* ── render contexts ─────────────────────────────────────────────────────── */\n\nexport interface CubeTableCellContext<T = any> {\n row: T;\n rowKey: Key;\n rowIndex: number;\n columnKey: string;\n columnIndex: number;\n section: CubeTableRowSection;\n /** Whether the ROW is selected, matching `isRowFocused` below. */\n isSelected: boolean;\n /**\n * Not yet wired — always absent.\n *\n * Optional rather than `boolean`, because there is nowhere honest to compute\n * them from where this context is built. Focus lives in the DOM, and drop\n * state comes out of `useDropIndicator`, a hook that can only run inside the\n * row component — so populating either means moving the `render` / `cellStyles`\n * call sites into `TableRow`. Declaring them required and passing `false`\n * would just be a documented lie.\n */\n isRowFocused?: boolean;\n isDropTarget?: boolean;\n /** Present only when `getRowChildren` enables tree mode. */\n tree?: CubeTableTreeRowState;\n}\n\nexport interface CubeTableRowContext<T = any> {\n row: T;\n rowKey: Key;\n rowIndex: number;\n section: CubeTableRowSection;\n isSelected: boolean;\n /** Not yet wired — always absent. See `CubeTableCellContext` for why. */\n isFocused?: boolean;\n isDropTarget?: boolean;\n /** Present only when `getRowChildren` enables tree mode. */\n tree?: CubeTableTreeRowState;\n}\n\nexport interface CubeTableHeaderContext {\n columnKey: string;\n columnIndex: number;\n sort: CubeTableSortDirection | null;\n isSortable: boolean;\n isResizing: boolean;\n width: number | null;\n}\n\n/** Presentational path entry used to build multi-row column headers. */\nexport interface CubeTableColumnGroupHeader {\n key: string;\n title?: ReactNode;\n}\n\n/* ── column ──────────────────────────────────────────────────────────────── */\n\n/**\n * Rich header content. Every slot except `menu` maps 1:1 onto the `Item`\n * rendered inside the header `<th>`, so a header gets icon / description /\n * tooltip / suffix / actions for free; `menu` is mounted into that `Item`'s\n * `actions` slot behind a `⋮` trigger.\n */\nexport interface CubeTableColumnHeader {\n icon?: CubeItemProps['icon'];\n rightIcon?: CubeItemProps['rightIcon'];\n prefix?: ReactNode;\n suffix?: ReactNode;\n description?: ReactNode;\n descriptionPlacement?: CubeItemProps['descriptionPlacement'];\n /** `true` = auto tooltip when the label is truncated. */\n tooltip?: CubeItemProps['tooltip'];\n actions?: ReactNode;\n /** Hide `actions` until hover/focus. @default true */\n autoHideActions?: boolean;\n /**\n * A column menu, opened from a `⋮` trigger in the header's actions slot and —\n * unless the table says otherwise — by right-click or Shift+F10.\n *\n * `Menu.Item` children. Opaque: the table mounts the node and reports the\n * pressed key back through `onColumnMenuAction`, so what a \"pin\" or a \"drill\n * down\" means stays in the consuming app. The exception is the reserved sort\n * keys (`sort-asc`, `sort-desc`, `clear-sort`), which the table labels,\n * disables when redundant, and applies itself before telling the consumer.\n *\n * An empty menu renders no trigger at all, rather than one that opens nothing.\n * Ignored when `header.render` takes the cell over.\n */\n menu?: ReactNode;\n /** Props for the `⋮` trigger. Merged over the table's `columnMenuTriggerProps`. */\n menuTriggerProps?: Record<string, any>;\n /** Props for the `Menu`. Merged over the table's `columnMenuProps`. */\n menuProps?: Record<string, any>;\n /** Called before the table-level `onColumnMenuAction`. */\n onMenuAction?: (action: string) => void;\n theme?: CubeItemProps['theme'];\n /**\n * Full takeover of the header cell's content. Overrides `title` and every\n * slot — including `actions` and `menu`, which are simply not rendered. A\n * takeover that wants a menu owns the trigger too.\n */\n render?: (ctx: CubeTableHeaderContext) => ReactNode;\n /** Overrides `column.align` for the header only. */\n align?: CubeTableAlign;\n styles?: Styles;\n}\n\n/* ── column colour ───────────────────────────────────────────────────────── */\n\n/**\n * A palette theme a column can borrow its tint from.\n *\n * Resolved through the same runtime generator as a custom colour, seeded from the\n * theme's own hue and saturation in `palette-config` — so it tracks a re-seeded\n * palette, and it gets the banding step the palette itself does not define.\n *\n * `special` is absent deliberately: it is a standalone `mode: 'fixed'` theme with\n * no tinted-surface ramp to borrow.\n */\nexport type CubeTableColumnTheme =\n | 'primary'\n | 'purple'\n | 'success'\n | 'danger'\n | 'warning'\n | 'note';\n\n/**\n * How a column is tinted.\n *\n * Every form but the last is *derived*: only a hue and a saturation are kept, and\n * the tone ramp plus an `AA`/`AAA` text floor are re-solved per colour scheme. So\n * a column stays readable in light, dark and high contrast without the caller\n * checking — which is the part hand-picked hex pairs get wrong.\n */\nexport type CubeTableColumnColor =\n /** A palette theme name. */\n | CubeTableColumnTheme\n /** Any colour Glaze parses — hex, `rgb()`, `hsl()`, `okhsl()`, `oklch()`. */\n | (string & {})\n /** The seed said directly. `saturation` is 0–100. */\n | { hue: number; saturation?: number }\n /**\n * Full manual control, as tasty colour strings (`'#note-surface'`, `'#purple.10'`).\n *\n * Nothing is derived and nothing is contrast-checked — this is the escape\n * hatch, and readability in every scheme becomes the caller's problem.\n * `fillBand` defaults to `fill`, which turns banding off for the column.\n */\n | { fill: string; fillBand?: string; text?: string };\n\n/**\n * Which parts of a column `color` reaches.\n *\n * @default ['header','body','totals']\n */\nexport type CubeTableColumnColorScope = 'header' | 'body' | 'totals';\n\nexport interface CubeTableColumn<T = any> {\n /**\n * Column id. Also the default data path — dot notation is supported\n * (`'owner.name'`). Anything beyond a path needs `getValue`.\n */\n key: string;\n /** Header label. Shorthand for `header` with no extra slots. */\n title?: ReactNode;\n header?: CubeTableColumnHeader;\n /**\n * Renders `<th scope=\"row\">` instead of `<td>`, names the row for screen\n * readers, and hosts the `rowLink` anchor. Defaults to the first\n * non-structural column when a row link is present.\n */\n isRowHeader?: boolean;\n\n /* sizing */\n /** Fixed width in px. Mutually exclusive with `flex`. */\n width?: number;\n /** Weight for the leftover space. @default 1 when `width` is unset */\n flex?: number;\n /** @default 150 */\n minWidth?: number;\n maxWidth?: number;\n /** Inherits the table's `isResizable`. */\n isResizable?: boolean;\n /**\n * Inherits the table's `isColumnReorderable`; `false` pins this column in\n * place while the others still move around it.\n */\n isReorderable?: boolean;\n /** Stick to the start/end edge during horizontal scroll. */\n pin?: 'start' | 'end';\n /** Hide without losing width or order state. */\n isHidden?: boolean;\n\n /* value pipeline */\n /** @default (row) => get(row, key) */\n getValue?: (row: T, rowIndex: number) => unknown;\n /** Raw value → display text. Feeds client sort, client search and TSV copy. */\n format?: (value: any, row: T, rowIndex: number) => string;\n /** Client-side comparator over raw `getValue` results. */\n compare?: (a: any, b: any, rowA: T, rowB: T) => number;\n\n /* rendering */\n /** A returned string is wrapped in a truncating `TextItem`. */\n render?: (\n value: any,\n row: T,\n rowIndex: number,\n ctx: CubeTableCellContext<T>,\n ) => ReactNode;\n cellStyles?: Styles | ((ctx: CubeTableCellContext<T>) => Styles | undefined);\n cellProps?: (ctx: CubeTableCellContext<T>) => Record<string, any> | undefined;\n\n /**\n * Tints the column — header, cells and pinned totals — with an adaptive fill\n * and a text colour solved to stay readable on it in every scheme.\n *\n * Row banding survives: the tint carries its own band one tone step away, so\n * the stripe still reads down the column instead of being painted over.\n */\n color?: CubeTableColumnColor;\n /** Narrows what `color` reaches. @default ['header','body','totals'] */\n colorScope?: readonly CubeTableColumnColorScope[];\n\n /* behaviour */\n align?: CubeTableAlign;\n /**\n * Opt IN, per column — a table is not sortable until at least one column says\n * so, and `sortMode` then defaults to `'client'`.\n *\n * (This read `@default true` for a long time, which was never what the code\n * did: `TableView` requires `isSortable === true` before a header becomes a\n * control at all.)\n *\n * @default false\n */\n isSortable?: boolean;\n /** Two-state cycling (asc ↔ desc), never back to unsorted. @default false */\n disallowSortRemoval?: boolean;\n /** Include in the built-in client search. @default true */\n isSearchable?: boolean;\n /** Include in TSV copy. @default true */\n isCopyable?: boolean;\n /** Wrap text and let the row grow to fit. */\n autoHeight?: boolean;\n\n /** Consumer-owned bag. Never reaches the DOM. */\n meta?: Record<string, unknown>;\n}\n\n/* ── resolved layout (internal, but exported for adapters) ───────────────── */\n\nexport interface CubeResolvedColumn<T = any>\n // `width`, `minWidth`, `maxWidth`, `flex` and `align` are all resolved here,\n // so they narrow from optional to definite and must be replaced, not extended.\n extends Omit<\n CubeTableColumn<T>,\n 'width' | 'minWidth' | 'maxWidth' | 'flex' | 'align'\n > {\n /** Position among the visible leaf columns, 0-based. */\n index: number;\n /** `aria-colindex`, 1-based and document-absolute. */\n ariaColIndex: number;\n /** Resolved pixel width, or `null` while the container is unmeasured. */\n width: number | null;\n minWidth: number;\n maxWidth: number | null;\n flex: number | null;\n align: CubeTableAlign;\n /** Cumulative sticky offset in px for a pinned column. */\n pinOffset: number | null;\n /** `true` for the last pinned-start / first pinned-end column. */\n isPinEdge: boolean;\n /** Structural columns (selection, drag handle, row menu) never enter sorting,\n * search, copy, or the value pipeline. */\n isStructural: boolean;\n}\n\nexport interface CubeTableColumnLayout<T = any> {\n columns: CubeResolvedColumn<T>[];\n pinnedStartWidth: number;\n pinnedEndWidth: number;\n /** Sum of resolved widths, or `null` while unmeasured. */\n totalWidth: number | null;\n /** `true` when the columns cannot fit and the table scrolls horizontally. */\n isOverflowing: boolean;\n}\n\n/**\n * How a refresh over an existing result is presented.\n *\n * - `overlay` — keep the previous rows visible, dimmed, behind a spinner. A\n * server page or a re-sort never blanks the table.\n * - `skeleton` — discard the previous rows and show placeholders.\n * - `none` — no visuals beyond `aria-busy`; the page owns the indicator.\n */\nexport type CubeTableLoadingIndicator = 'overlay' | 'skeleton' | 'none';\n\nexport type CubeTableSelectionMode = 'none' | 'single' | 'multiple';\n\n/**\n * What the header checkbox acts on.\n *\n * - `page` — the rows on the current page.\n * - `filtered` — every row passing the current search/filter, across pages.\n * - `all` — emits the `'all'` sentinel, meaning \"everything, including rows the\n * client has not loaded\". The consumer decides what that means for its query.\n */\nexport type CubeTableSelectAllMode = 'page' | 'filtered' | 'all';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAuCA,SAAgB,gBACd,SACA,QACK;AACL,QAAO,YAAY,SAAS,SAAS,GAAG,QAAQ,GAAG"}
@@ -1,4 +1,4 @@
1
- /** @license MIT | @cube-dev/ui-kit v0.164.0 | Cube Dev Team */
1
+ /** @license MIT | @cube-dev/ui-kit v0.166.0 | Cube Dev Team */
2
2
  import { useEvent } from "../../../_internal/hooks/use-event.js";
3
3
  import { useMemo, useState } from "react";
4
4
  import { useControlledState } from "@react-stately/utils";
@@ -1,4 +1,4 @@
1
- /** @license MIT | @cube-dev/ui-kit v0.164.0 | Cube Dev Team */
1
+ /** @license MIT | @cube-dev/ui-kit v0.166.0 | Cube Dev Team */
2
2
  import { useLayoutEffect, useState } from "react";
3
3
 
4
4
  //#region src/components/data/TableBase/use-container-width.ts
@@ -1,4 +1,4 @@
1
- /** @license MIT | @cube-dev/ui-kit v0.164.0 | Cube Dev Team */
1
+ /** @license MIT | @cube-dev/ui-kit v0.166.0 | Cube Dev Team */
2
2
  import { useLayoutEffect, useRef } from "react";
3
3
 
4
4
  //#region src/components/data/TableBase/use-row-move-animation.ts
@@ -1,4 +1,4 @@
1
- /** @license MIT | @cube-dev/ui-kit v0.164.0 | Cube Dev Team */
1
+ /** @license MIT | @cube-dev/ui-kit v0.166.0 | Cube Dev Team */
2
2
  import { useLayoutEffect, useState } from "react";
3
3
 
4
4
  //#region src/components/data/TableBase/use-scrollability.ts
@@ -1,4 +1,4 @@
1
- /** @license MIT | @cube-dev/ui-kit v0.164.0 | Cube Dev Team */
1
+ /** @license MIT | @cube-dev/ui-kit v0.166.0 | Cube Dev Team */
2
2
  import { useMemo } from "react";
3
3
 
4
4
  //#region src/components/data/TableBase/use-table-columns.ts
@@ -1,4 +1,4 @@
1
- /** @license MIT | @cube-dev/ui-kit v0.164.0 | Cube Dev Team */
1
+ /** @license MIT | @cube-dev/ui-kit v0.166.0 | Cube Dev Team */
2
2
  import { useEvent } from "../../../_internal/hooks/use-event.js";
3
3
  import { useDebouncedValue } from "../../../_internal/hooks/use-debounced-value.js";
4
4
  import { getColumnText } from "./use-table-columns.js";
@@ -17,7 +17,7 @@ import { useControlledState } from "@react-stately/utils";
17
17
  * value. `getColumnText` returns `null` for anything it cannot honestly turn
18
18
  * into text, and those columns are skipped rather than coerced.
19
19
  */
20
- function defaultMatcher(columns, row, rowIndex, query) {
20
+ function matchesTableSearch(columns, row, rowIndex, query) {
21
21
  return columns.some((column) => {
22
22
  if (column.isSearchable === false) return false;
23
23
  const text = getColumnText(column, row, rowIndex);
@@ -47,7 +47,7 @@ function useTableSearch({ columns, rows, mode = "client", value, defaultValue, o
47
47
  query,
48
48
  searchedRows: useMemo(() => {
49
49
  if (mode !== "client" || !query) return rows;
50
- return rows.filter((row, index) => filter ? filter(row, query) : defaultMatcher(columns, row, index, query));
50
+ return rows.filter((row, index) => filter ? filter(row, query) : matchesTableSearch(columns, row, index, query));
51
51
  }, [
52
52
  mode,
53
53
  query,
@@ -60,5 +60,5 @@ function useTableSearch({ columns, rows, mode = "client", value, defaultValue, o
60
60
  }
61
61
 
62
62
  //#endregion
63
- export { useTableSearch };
63
+ export { matchesTableSearch, useTableSearch };
64
64
  //# sourceMappingURL=use-table-search.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-table-search.js","names":[],"sources":["../../../../src/components/data/TableBase/use-table-search.ts"],"sourcesContent":["import { useControlledState } from '@react-stately/utils';\nimport { useEffect, useMemo, useRef, useState } from 'react';\n\nimport { useDebouncedValue, useEvent } from '../../../_internal/hooks';\n\nimport { getColumnText } from './use-table-columns';\n\nimport type { CubeTableColumn } from './types';\n\nexport type CubeTableSearchMode = 'client' | 'server';\n\nexport interface UseTableSearchOptions<T> {\n columns: CubeTableColumn<T>[];\n rows: readonly T[];\n /** @default 'client' */\n mode?: CubeTableSearchMode;\n value?: string;\n defaultValue?: string;\n onChange?: (value: string) => void;\n /** Debounces the filter AND the callback, in both modes. @default 500 */\n delay?: number;\n /** Replaces the default matcher in client mode. */\n filter?: (row: T, query: string) => boolean;\n}\n\nexport interface UseTableSearchResult<T> {\n /** The immediate term — what the input shows. */\n searchValue: string;\n setSearchValue: (value: string) => void;\n /** The debounced term — what the filter and the callback act on. */\n query: string;\n /** Filtered in client mode; the original array otherwise. */\n searchedRows: readonly T[];\n /** `true` when a non-empty term is narrowing the data. */\n isFiltered: boolean;\n}\n\n/**\n * Default matcher: a case-insensitive substring test against each searchable\n * column's **display text**.\n *\n * Deliberately not the raw value. Cloud's filter tested\n * `String(row[column.key])`, which meant a column rendering `owner.profile.name`\n * was unsearchable, and an object-valued column stringified to\n * `\"[object Object]\"` — so the query \"object\" matched every row with a nested\n * value. `getColumnText` returns `null` for anything it cannot honestly turn\n * into text, and those columns are skipped rather than coerced.\n */\nfunction defaultMatcher<T>(\n columns: CubeTableColumn<T>[],\n row: T,\n rowIndex: number,\n query: string,\n): boolean {\n return columns.some((column) => {\n if (column.isSearchable === false) return false;\n\n const text = getColumnText(column, row, rowIndex);\n\n return text != null && text.toLowerCase().includes(query);\n });\n}\n\nexport function useTableSearch<T>({\n columns,\n rows,\n mode = 'client',\n value,\n defaultValue,\n onChange,\n delay = 500,\n filter,\n}: UseTableSearchOptions<T>): UseTableSearchResult<T> {\n const [committed, setCommitted] = useControlledState<string>(\n value as string,\n defaultValue ?? '',\n onChange as (v: string) => void,\n );\n\n // What the input shows, updated on every keystroke. The committed value —\n // the one `onChange` reports and the filter runs on — trails it by `delay`.\n //\n // Two separate values rather than one, because `useControlledState` calls\n // `onChange` the moment it is set: routing keystrokes straight into it fired\n // a request per character in `searchMode=\"server\"`, which is the thing the\n // debounce exists to prevent. Debouncing the input itself instead would make\n // typing lag, so the split is the point.\n const [draft, setDraft] = useState(committed);\n const debounced = useDebouncedValue(draft, delay);\n\n // What we last pushed outward, so the sync below can tell a genuine external\n // change from the echo of our own debounce.\n const pushedRef = useRef(committed);\n\n // A controlled `searchValue` changing from OUTSIDE — a cleared filter, a\n // restored URL — wins over whatever is half-typed.\n //\n // The echo has to be filtered out or this reverts the input mid-word: with a\n // short delay the debounce commits letter 1 while letter 2 is already typed,\n // and syncing unconditionally puts letter 1 back. At `searchDelay={0}` that\n // happens on every keystroke and nothing longer than one character can ever\n // be typed.\n useEffect(() => {\n if (committed === pushedRef.current) return;\n\n pushedRef.current = committed;\n setDraft(committed);\n }, [committed]);\n\n useEffect(() => {\n if (debounced === pushedRef.current) return;\n\n pushedRef.current = debounced;\n setCommitted(debounced);\n // `committed` is deliberately not a dependency: reacting to it here would\n // fight the effect above and push a stale draft back out.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [debounced]);\n\n const searchValue = draft;\n const query = debounced.trim().toLowerCase();\n\n const setSearchValue = useEvent((next: string) => setDraft(next));\n\n const searchedRows = useMemo(() => {\n if (mode !== 'client' || !query) return rows;\n\n return rows.filter((row, index) =>\n filter ? filter(row, query) : defaultMatcher(columns, row, index, query),\n );\n }, [mode, query, rows, columns, filter]);\n\n return {\n searchValue,\n setSearchValue,\n query,\n searchedRows,\n isFiltered: query.length > 0,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAgDA,SAAS,eACP,SACA,KACA,UACA,OACS;AACT,QAAO,QAAQ,MAAM,WAAW;AAC9B,MAAI,OAAO,iBAAiB,MAAO,QAAO;EAE1C,MAAM,OAAO,cAAc,QAAQ,KAAK,SAAS;AAEjD,SAAO,QAAQ,QAAQ,KAAK,aAAa,CAAC,SAAS,MAAM;GACzD;;AAGJ,SAAgB,eAAkB,EAChC,SACA,MACA,OAAO,UACP,OACA,cACA,UACA,QAAQ,KACR,UACoD;CACpD,MAAM,CAAC,WAAW,gBAAgB,mBAChC,OACA,gBAAgB,IAChB,SACD;CAUD,MAAM,CAAC,OAAO,YAAY,SAAS,UAAU;CAC7C,MAAM,YAAY,kBAAkB,OAAO,MAAM;CAIjD,MAAM,YAAY,OAAO,UAAU;AAUnC,iBAAgB;AACd,MAAI,cAAc,UAAU,QAAS;AAErC,YAAU,UAAU;AACpB,WAAS,UAAU;IAClB,CAAC,UAAU,CAAC;AAEf,iBAAgB;AACd,MAAI,cAAc,UAAU,QAAS;AAErC,YAAU,UAAU;AACpB,eAAa,UAAU;IAItB,CAAC,UAAU,CAAC;CAEf,MAAM,cAAc;CACpB,MAAM,QAAQ,UAAU,MAAM,CAAC,aAAa;AAY5C,QAAO;EACL;EACA,gBAZqB,UAAU,SAAiB,SAAS,KAAK,CAAC;EAa/D;EACA,cAZmB,cAAc;AACjC,OAAI,SAAS,YAAY,CAAC,MAAO,QAAO;AAExC,UAAO,KAAK,QAAQ,KAAK,UACvB,SAAS,OAAO,KAAK,MAAM,GAAG,eAAe,SAAS,KAAK,OAAO,MAAM,CACzE;KACA;GAAC;GAAM;GAAO;GAAM;GAAS;GAAO,CAAC;EAOtC,YAAY,MAAM,SAAS;EAC5B"}
1
+ {"version":3,"file":"use-table-search.js","names":[],"sources":["../../../../src/components/data/TableBase/use-table-search.ts"],"sourcesContent":["import { useControlledState } from '@react-stately/utils';\nimport { useEffect, useMemo, useRef, useState } from 'react';\n\nimport { useDebouncedValue, useEvent } from '../../../_internal/hooks';\n\nimport { getColumnText } from './use-table-columns';\n\nimport type { CubeTableColumn } from './types';\n\nexport type CubeTableSearchMode = 'client' | 'server';\n\nexport interface UseTableSearchOptions<T> {\n columns: CubeTableColumn<T>[];\n rows: readonly T[];\n /** @default 'client' */\n mode?: CubeTableSearchMode;\n value?: string;\n defaultValue?: string;\n onChange?: (value: string) => void;\n /** Debounces the filter AND the callback, in both modes. @default 500 */\n delay?: number;\n /** Replaces the default matcher in client mode. */\n filter?: (row: T, query: string) => boolean;\n}\n\nexport interface UseTableSearchResult<T> {\n /** The immediate term — what the input shows. */\n searchValue: string;\n setSearchValue: (value: string) => void;\n /** The debounced term — what the filter and the callback act on. */\n query: string;\n /** Filtered in client mode; the original array otherwise. */\n searchedRows: readonly T[];\n /** `true` when a non-empty term is narrowing the data. */\n isFiltered: boolean;\n}\n\n/**\n * Default matcher: a case-insensitive substring test against each searchable\n * column's **display text**.\n *\n * Deliberately not the raw value. Cloud's filter tested\n * `String(row[column.key])`, which meant a column rendering `owner.profile.name`\n * was unsearchable, and an object-valued column stringified to\n * `\"[object Object]\"` — so the query \"object\" matched every row with a nested\n * value. `getColumnText` returns `null` for anything it cannot honestly turn\n * into text, and those columns are skipped rather than coerced.\n */\nexport function matchesTableSearch<T>(\n columns: CubeTableColumn<T>[],\n row: T,\n rowIndex: number,\n query: string,\n): boolean {\n return columns.some((column) => {\n if (column.isSearchable === false) return false;\n\n const text = getColumnText(column, row, rowIndex);\n\n return text != null && text.toLowerCase().includes(query);\n });\n}\n\nexport function useTableSearch<T>({\n columns,\n rows,\n mode = 'client',\n value,\n defaultValue,\n onChange,\n delay = 500,\n filter,\n}: UseTableSearchOptions<T>): UseTableSearchResult<T> {\n const [committed, setCommitted] = useControlledState<string>(\n value as string,\n defaultValue ?? '',\n onChange as (v: string) => void,\n );\n\n // What the input shows, updated on every keystroke. The committed value —\n // the one `onChange` reports and the filter runs on — trails it by `delay`.\n //\n // Two separate values rather than one, because `useControlledState` calls\n // `onChange` the moment it is set: routing keystrokes straight into it fired\n // a request per character in `searchMode=\"server\"`, which is the thing the\n // debounce exists to prevent. Debouncing the input itself instead would make\n // typing lag, so the split is the point.\n const [draft, setDraft] = useState(committed);\n const debounced = useDebouncedValue(draft, delay);\n\n // What we last pushed outward, so the sync below can tell a genuine external\n // change from the echo of our own debounce.\n const pushedRef = useRef(committed);\n\n // A controlled `searchValue` changing from OUTSIDE — a cleared filter, a\n // restored URL — wins over whatever is half-typed.\n //\n // The echo has to be filtered out or this reverts the input mid-word: with a\n // short delay the debounce commits letter 1 while letter 2 is already typed,\n // and syncing unconditionally puts letter 1 back. At `searchDelay={0}` that\n // happens on every keystroke and nothing longer than one character can ever\n // be typed.\n useEffect(() => {\n if (committed === pushedRef.current) return;\n\n pushedRef.current = committed;\n setDraft(committed);\n }, [committed]);\n\n useEffect(() => {\n if (debounced === pushedRef.current) return;\n\n pushedRef.current = debounced;\n setCommitted(debounced);\n // `committed` is deliberately not a dependency: reacting to it here would\n // fight the effect above and push a stale draft back out.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [debounced]);\n\n const searchValue = draft;\n const query = debounced.trim().toLowerCase();\n\n const setSearchValue = useEvent((next: string) => setDraft(next));\n\n const searchedRows = useMemo(() => {\n if (mode !== 'client' || !query) return rows;\n\n return rows.filter((row, index) =>\n filter\n ? filter(row, query)\n : matchesTableSearch(columns, row, index, query),\n );\n }, [mode, query, rows, columns, filter]);\n\n return {\n searchValue,\n setSearchValue,\n query,\n searchedRows,\n isFiltered: query.length > 0,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAgDA,SAAgB,mBACd,SACA,KACA,UACA,OACS;AACT,QAAO,QAAQ,MAAM,WAAW;AAC9B,MAAI,OAAO,iBAAiB,MAAO,QAAO;EAE1C,MAAM,OAAO,cAAc,QAAQ,KAAK,SAAS;AAEjD,SAAO,QAAQ,QAAQ,KAAK,aAAa,CAAC,SAAS,MAAM;GACzD;;AAGJ,SAAgB,eAAkB,EAChC,SACA,MACA,OAAO,UACP,OACA,cACA,UACA,QAAQ,KACR,UACoD;CACpD,MAAM,CAAC,WAAW,gBAAgB,mBAChC,OACA,gBAAgB,IAChB,SACD;CAUD,MAAM,CAAC,OAAO,YAAY,SAAS,UAAU;CAC7C,MAAM,YAAY,kBAAkB,OAAO,MAAM;CAIjD,MAAM,YAAY,OAAO,UAAU;AAUnC,iBAAgB;AACd,MAAI,cAAc,UAAU,QAAS;AAErC,YAAU,UAAU;AACpB,WAAS,UAAU;IAClB,CAAC,UAAU,CAAC;AAEf,iBAAgB;AACd,MAAI,cAAc,UAAU,QAAS;AAErC,YAAU,UAAU;AACpB,eAAa,UAAU;IAItB,CAAC,UAAU,CAAC;CAEf,MAAM,cAAc;CACpB,MAAM,QAAQ,UAAU,MAAM,CAAC,aAAa;AAc5C,QAAO;EACL;EACA,gBAdqB,UAAU,SAAiB,SAAS,KAAK,CAAC;EAe/D;EACA,cAdmB,cAAc;AACjC,OAAI,SAAS,YAAY,CAAC,MAAO,QAAO;AAExC,UAAO,KAAK,QAAQ,KAAK,UACvB,SACI,OAAO,KAAK,MAAM,GAClB,mBAAmB,SAAS,KAAK,OAAO,MAAM,CACnD;KACA;GAAC;GAAM;GAAO;GAAM;GAAS;GAAO,CAAC;EAOtC,YAAY,MAAM,SAAS;EAC5B"}
@@ -1,4 +1,4 @@
1
- /** @license MIT | @cube-dev/ui-kit v0.164.0 | Cube Dev Team */
1
+ /** @license MIT | @cube-dev/ui-kit v0.166.0 | Cube Dev Team */
2
2
  import { useEvent } from "../../../_internal/hooks/use-event.js";
3
3
  import { RowCollection } from "./RowCollection.js";
4
4
  import { useCallback, useMemo, useRef } from "react";
@@ -26,8 +26,58 @@ function toSelection(keys) {
26
26
  if (keys === void 0) return void 0;
27
27
  return keys === "all" ? "all" : new Set(keys);
28
28
  }
29
+ function deriveTreeSelection(source, rootKeys, childrenOf, isEligible) {
30
+ const checked = new Set(source);
31
+ const indeterminate = /* @__PURE__ */ new Set();
32
+ const visit = (key) => {
33
+ const children = childrenOf.get(key) ?? [];
34
+ const eligible = isEligible(key);
35
+ if (eligible && source.has(key)) checked.add(key);
36
+ if (!children.length) {
37
+ const selected = eligible && checked.has(key);
38
+ if (!eligible) checked.delete(key);
39
+ return {
40
+ all: !eligible || selected,
41
+ any: selected,
42
+ eligible
43
+ };
44
+ }
45
+ let all = true;
46
+ let any = false;
47
+ let hasEligible = false;
48
+ for (const child of children) {
49
+ const result = visit(child);
50
+ if (result.eligible) hasEligible = true;
51
+ if (!result.all) all = false;
52
+ if (result.any) any = true;
53
+ }
54
+ if (!eligible) {
55
+ checked.delete(key);
56
+ indeterminate.delete(key);
57
+ } else if (hasEligible && all) {
58
+ checked.add(key);
59
+ indeterminate.delete(key);
60
+ } else if (hasEligible && any) {
61
+ checked.delete(key);
62
+ indeterminate.add(key);
63
+ } else if (hasEligible) {
64
+ checked.delete(key);
65
+ indeterminate.delete(key);
66
+ } else if (!checked.has(key)) indeterminate.delete(key);
67
+ return {
68
+ all: !eligible || checked.has(key) && all,
69
+ any: any || checked.has(key),
70
+ eligible: eligible || hasEligible
71
+ };
72
+ };
73
+ rootKeys.forEach((key) => visit(key));
74
+ return {
75
+ checked,
76
+ indeterminate
77
+ };
78
+ }
29
79
  function useTableSelection(options) {
30
- const { rows, filteredRows, getRowKey, selectionMode, selectedKeys: selectedKeysProp, defaultSelectedKeys, onSelectionChange, selectAllMode, isRowSelectable, disabledKeys } = options;
80
+ const { rows, rowKeys, pageRows = rows, pageRowKeys, filteredRows, filteredRowKeys, getRowKey, selectionMode, selectedKeys: selectedKeysProp, defaultSelectedKeys, onSelectionChange, selectAllMode, isRowSelectable, disabledKeys, tree } = options;
31
81
  const isEnabled = selectionMode !== "none";
32
82
  /**
33
83
  * Two distinct notions of "not available", deliberately kept apart:
@@ -45,28 +95,32 @@ function useTableSelection(options) {
45
95
  const unselectableKeys = useMemo(() => {
46
96
  const keys = new Set(hardDisabledKeys);
47
97
  if (isRowSelectable) filteredRows.forEach((row, index) => {
48
- if (!isRowSelectable(row)) keys.add(getRowKey(row, index));
98
+ if (!isRowSelectable(row)) keys.add(filteredRowKeys?.[index] ?? getRowKey(row, index));
49
99
  });
50
100
  return keys;
51
101
  }, [
52
102
  hardDisabledKeys,
53
103
  isRowSelectable,
54
104
  filteredRows,
105
+ filteredRowKeys,
55
106
  getRowKey
56
107
  ]);
57
- const collection = useMemo(() => new RowCollection(rows, getRowKey, unselectableKeys), [
108
+ const visibleGetRowKey = useCallback((row, index) => rowKeys?.[index] ?? getRowKey(row, index), [rowKeys, getRowKey]);
109
+ const collection = useMemo(() => new RowCollection(rows, visibleGetRowKey, unselectableKeys), [
58
110
  rows,
59
- getRowKey,
111
+ visibleGetRowKey,
60
112
  unselectableKeys
61
113
  ]);
62
114
  const rowByKey = useMemo(() => {
63
115
  const map = /* @__PURE__ */ new Map();
64
- filteredRows.forEach((row, index) => map.set(getRowKey(row, index), row));
65
- rows.forEach((row, index) => map.set(getRowKey(row, index), row));
116
+ filteredRows.forEach((row, index) => map.set(filteredRowKeys?.[index] ?? getRowKey(row, index), row));
117
+ rows.forEach((row, index) => map.set(rowKeys?.[index] ?? getRowKey(row, index), row));
66
118
  return map;
67
119
  }, [
68
120
  rows,
121
+ rowKeys,
69
122
  filteredRows,
123
+ filteredRowKeys,
70
124
  getRowKey
71
125
  ]);
72
126
  const rowByKeyRef = useRef(rowByKey);
@@ -109,35 +163,59 @@ function useTableSelection(options) {
109
163
  const selectionManager = useMemo(() => new SelectionManager(collection, state), [collection, state]);
110
164
  const selectedKeys = state.selectedKeys;
111
165
  const isAll = selectedKeys === "all";
112
- const canSelect = useCallback((key) => isEnabled && !unselectableKeys.has(key), [isEnabled, unselectableKeys]);
113
- const isSelected = useCallback((key) => isAll ? canSelect(key) : selectedKeys.has(key), [
166
+ const isCascade = tree?.behavior === "cascade" && selectionMode === "multiple";
167
+ const derivedSelection = useMemo(() => {
168
+ if (isAll) return {
169
+ checked: new Set([...rowByKey.keys()].filter((key) => !unselectableKeys.has(key))),
170
+ indeterminate: /* @__PURE__ */ new Set()
171
+ };
172
+ if (!isCascade || !tree) return {
173
+ checked: new Set(selectedKeys),
174
+ indeterminate: /* @__PURE__ */ new Set()
175
+ };
176
+ return deriveTreeSelection(selectedKeys, tree.rootKeys, tree.childrenOf, (key) => !unselectableKeys.has(key));
177
+ }, [
114
178
  isAll,
179
+ isCascade,
115
180
  selectedKeys,
181
+ tree,
182
+ rowByKey,
183
+ unselectableKeys
184
+ ]);
185
+ const canSelect = useCallback((key) => isEnabled && !unselectableKeys.has(key), [isEnabled, unselectableKeys]);
186
+ const isSelected = useCallback((key) => isAll ? canSelect(key) : derivedSelection.checked.has(key), [
187
+ isAll,
188
+ derivedSelection,
116
189
  canSelect
117
190
  ]);
191
+ const isIndeterminate = useCallback((key) => derivedSelection.indeterminate.has(key), [derivedSelection]);
118
192
  /** Keys the header checkbox acts on, which is what `selectAllMode` decides. */
119
193
  const scopeKeys = useMemo(() => {
120
194
  if (!isEnabled || selectionMode === "single") return [];
121
- return (selectAllMode === "page" ? rows : filteredRows).map((row, index) => getRowKey(row, index)).filter((key) => !unselectableKeys.has(key));
195
+ const source = selectAllMode === "page" ? pageRows : filteredRows;
196
+ const sourceKeys = selectAllMode === "page" ? pageRowKeys : filteredRowKeys;
197
+ return source.map((row, index) => sourceKeys?.[index] ?? getRowKey(row, index)).filter((key) => !unselectableKeys.has(key));
122
198
  }, [
123
199
  isEnabled,
124
200
  selectionMode,
125
201
  selectAllMode,
126
- rows,
202
+ pageRows,
203
+ pageRowKeys,
127
204
  filteredRows,
205
+ filteredRowKeys,
128
206
  getRowKey,
129
207
  unselectableKeys
130
208
  ]);
131
209
  const selectAllState = useMemo(() => {
132
210
  if (isAll) return "all";
133
211
  if (!scopeKeys.length) return "none";
134
- const set = selectedKeys;
212
+ const set = derivedSelection.checked;
135
213
  let count = 0;
136
214
  for (const key of scopeKeys) if (set.has(key)) count++;
137
215
  return count === 0 ? "none" : count === scopeKeys.length ? "all" : "some";
138
216
  }, [
139
217
  isAll,
140
- selectedKeys,
218
+ derivedSelection,
141
219
  scopeKeys
142
220
  ]);
143
221
  const toggleSelectAll = useEvent(() => {
@@ -151,9 +229,9 @@ function useTableSelection(options) {
151
229
  state.setSelectedKeys("all");
152
230
  return;
153
231
  }
154
- const next = new Set(isAll ? [] : selectedKeys);
232
+ const next = new Set(isAll ? [] : derivedSelection.checked);
155
233
  scopeKeys.forEach((key) => next.add(key));
156
- state.setSelectedKeys(next);
234
+ state.setSelectedKeys(isCascade && tree ? deriveTreeSelection(next, tree.rootKeys, tree.childrenOf, (key) => !unselectableKeys.has(key)).checked : next);
157
235
  });
158
236
  const clearSelection = useEvent(() => {
159
237
  anchorRef.current = null;
@@ -186,27 +264,48 @@ function useTableSelection(options) {
186
264
  state.setSelectedKeys(isSelected(key) ? /* @__PURE__ */ new Set() : new Set([key]));
187
265
  return;
188
266
  }
267
+ const applyCascade = (set, target, value) => {
268
+ if (!canSelect(target)) return;
269
+ if (value) set.add(target);
270
+ else {
271
+ set.delete(target);
272
+ if (isCascade && tree) {
273
+ let parent = tree.parentOf.get(target);
274
+ while (parent != null) {
275
+ set.delete(parent);
276
+ parent = tree.parentOf.get(parent);
277
+ }
278
+ }
279
+ }
280
+ if (!isCascade || !tree) return;
281
+ (tree.childrenOf.get(target) ?? []).forEach((child) => applyCascade(set, child, value));
282
+ };
283
+ const normalizeCascade = (set) => isCascade && tree ? deriveTreeSelection(set, tree.rootKeys, tree.childrenOf, (candidate) => !unselectableKeys.has(candidate)).checked : set;
189
284
  const anchor = anchorRef.current;
190
285
  if (shiftRef.current && anchor != null && collection.indexOf(anchor) >= 0) {
191
- const next = new Set(isAll ? scopeKeys : selectedKeys);
192
- if (extentRef.current != null) keysBetween(anchor, extentRef.current).forEach((k) => next.delete(k));
286
+ const next = new Set(isAll ? scopeKeys : derivedSelection.checked);
287
+ if (extentRef.current != null) keysBetween(anchor, extentRef.current).forEach((k) => applyCascade(next, k, false));
193
288
  keysBetween(anchor, key).forEach((k) => {
194
- if (canSelect(k)) next.add(k);
289
+ applyCascade(next, k, true);
195
290
  });
196
291
  extentRef.current = key;
197
- state.setSelectedKeys(next);
292
+ state.setSelectedKeys(normalizeCascade(next));
198
293
  return;
199
294
  }
200
295
  anchorRef.current = key;
201
296
  extentRef.current = null;
202
- selectionManager.toggleSelection(key);
297
+ if (isCascade) {
298
+ const next = new Set(derivedSelection.checked);
299
+ applyCascade(next, key, !derivedSelection.checked.has(key));
300
+ state.setSelectedKeys(normalizeCascade(next));
301
+ } else selectionManager.toggleSelection(key);
203
302
  });
204
303
  const selectedRows = useMemo(() => {
205
304
  if (isAll) return [...rowByKey.values()];
206
- return [...selectedKeys].map((key) => rowByKey.get(key)).filter((row) => row !== void 0);
305
+ return [...derivedSelection.checked].map((key) => rowByKey.get(key)).filter((row) => row !== void 0);
207
306
  }, [
208
307
  isAll,
209
- selectedKeys,
308
+ derivedSelection,
210
309
  rowByKey
211
310
  ]);
212
311
  return {
@@ -215,6 +314,7 @@ function useTableSelection(options) {
215
314
  selectionManager,
216
315
  collection,
217
316
  isSelected,
317
+ isIndeterminate,
218
318
  canSelect,
219
319
  isRowDisabled: useCallback((key) => hardDisabledKeys.has(key), [hardDisabledKeys]),
220
320
  toggleRow,
@@ -223,8 +323,8 @@ function useTableSelection(options) {
223
323
  toggleSelectAll,
224
324
  clearSelection,
225
325
  selectedRows,
226
- selectedCount: isAll ? rowByKey.size : selectedKeys.size,
227
- selectedKeys: isAll ? "all" : [...selectedKeys]
326
+ selectedCount: isAll ? rowByKey.size : derivedSelection.checked.size,
327
+ selectedKeys: isAll ? "all" : [...derivedSelection.checked]
228
328
  };
229
329
  }
230
330
 
@@ -1 +1 @@
1
- {"version":3,"file":"use-table-selection.js","names":[],"sources":["../../../../src/components/data/TableBase/use-table-selection.ts"],"sourcesContent":["import { SelectionManager } from '@react-stately/selection';\nimport { useCallback, useMemo, useRef } from 'react';\nimport { useMultipleSelectionState } from 'react-stately';\n\nimport { useEvent } from '../../../_internal/hooks';\n\nimport { RowCollection } from './RowCollection';\n\nimport type { Key, Selection } from '@react-types/shared';\nimport type { CubeTableSelectAllMode, CubeTableSelectionMode } from './types';\n\n/**\n * Reserved key for the checkbox column. Prefixed so it cannot collide with a\n * real data key, and structural so the value pipeline, sorting and search all\n * skip it.\n */\nexport const SELECTION_COLUMN_KEY = '__cube-selection__';\n\n/** Reserved key for the row-number column. Structural, like the checkbox. */\nexport const ROW_NUMBER_COLUMN_KEY = '__cube-row-number__';\n\n/** Square-ish, so the checkbox sits centred without stealing content width. */\nexport const SELECTION_COLUMN_WIDTH: Record<string, number> = {\n xsmall: 32,\n small: 36,\n medium: 44,\n large: 48,\n xlarge: 52,\n};\n\nexport interface UseTableSelectionOptions<T> {\n /** Rows currently on screen — one page, or everything when unpaginated. */\n rows: readonly T[];\n /**\n * Every row passing the current search/filter, across pages. Only differs\n * from `rows` under client pagination, and only `selectAllMode=\"filtered\"`\n * reads it.\n */\n filteredRows: readonly T[];\n getRowKey: (row: T, index: number) => Key;\n selectionMode: CubeTableSelectionMode;\n selectedKeys?: Key[] | 'all';\n defaultSelectedKeys?: Key[] | 'all';\n onSelectionChange?: (keys: Key[] | 'all', rows: T[]) => void;\n selectAllMode: CubeTableSelectAllMode;\n isRowSelectable?: (row: T) => boolean;\n disabledKeys?: Key[];\n}\n\nexport type CubeTableSelectAllState = 'none' | 'some' | 'all';\n\nfunction toSelection(keys: Key[] | 'all' | undefined): Selection | undefined {\n if (keys === undefined) return undefined;\n\n return keys === 'all' ? 'all' : new Set(keys);\n}\n\nexport function useTableSelection<T>(options: UseTableSelectionOptions<T>) {\n const {\n rows,\n filteredRows,\n getRowKey,\n selectionMode,\n selectedKeys: selectedKeysProp,\n defaultSelectedKeys,\n onSelectionChange,\n selectAllMode,\n isRowSelectable,\n disabledKeys,\n } = options;\n\n const isEnabled = selectionMode !== 'none';\n\n /**\n * Two distinct notions of \"not available\", deliberately kept apart:\n *\n * - `disabledKeys` — the row is inert. Not focusable, not interactive. This\n * is React Aria's standard meaning.\n * - `isRowSelectable` — the row is fully interactive, only its checkbox is\n * inert. This is what Cloud's tables do today.\n *\n * A `SelectionManager` has one `disabledBehavior`, so it gets the union under\n * `'selection'` (neither kind can be selected) and the hard-disabled set is\n * tracked separately for focus and interaction.\n */\n const hardDisabledKeys = useMemo(\n () => new Set(disabledKeys ?? []),\n [disabledKeys],\n );\n\n const unselectableKeys = useMemo(() => {\n const keys = new Set(hardDisabledKeys);\n\n if (isRowSelectable) {\n // Scanned over the filtered set, not just the page: a select-all that\n // reaches beyond the page must respect it there too.\n filteredRows.forEach((row, index) => {\n if (!isRowSelectable(row)) keys.add(getRowKey(row, index));\n });\n }\n\n return keys;\n }, [hardDisabledKeys, isRowSelectable, filteredRows, getRowKey]);\n\n const collection = useMemo(\n () => new RowCollection(rows, getRowKey, unselectableKeys),\n [rows, getRowKey, unselectableKeys],\n );\n\n const rowByKey = useMemo(() => {\n const map = new Map<Key, T>();\n\n // The page first, then the wider filtered set, so a key present in both\n // resolves to the row the user can actually see.\n filteredRows.forEach((row, index) => map.set(getRowKey(row, index), row));\n rows.forEach((row, index) => map.set(getRowKey(row, index), row));\n\n return map;\n }, [rows, filteredRows, getRowKey]);\n\n const rowByKeyRef = useRef(rowByKey);\n\n rowByKeyRef.current = rowByKey;\n\n /**\n * Where a shift-range starts, and how far it currently reaches.\n *\n * React Aria's `SelectionManager.extendSelection` keeps this on the `Selection`\n * object itself (`selectedKeys.anchorKey`), which cannot survive our public\n * API: `selectedKeys` is `Key[]`, and `useMultipleSelectionState` rebuilds\n * whatever it is given with `new Selection(value)` — a constructor that only\n * copies the anchor when the input is already a `Selection`, a class no\n * package exports. A controlled table would silently reset the anchor to the\n * clicked row and turn every shift-click into a plain toggle.\n *\n * So the range is computed here instead, over `RowCollection`'s index. The\n * semantics match `extendSelection` exactly: the previous range is removed\n * before the new one is added, so shift-clicking back shrinks the range\n * rather than leaving the overshoot selected.\n */\n const anchorRef = useRef<Key | null>(null);\n const extentRef = useRef<Key | null>(null);\n\n const handleSelectionChange = useEvent((keys: Selection) => {\n if (!onSelectionChange) return;\n\n if (keys === 'all') {\n // The sentinel means \"everything, including rows the client has not\n // loaded\", so the row list can only ever be what is loaded.\n onSelectionChange('all', [...rowByKeyRef.current.values()]);\n\n return;\n }\n\n const list = [...keys];\n\n onSelectionChange(\n list,\n list\n .map((key) => rowByKeyRef.current.get(key))\n .filter((row): row is T => row !== undefined),\n );\n });\n\n const controlledSelection = useMemo(\n () => toSelection(selectedKeysProp),\n [selectedKeysProp],\n );\n const defaultSelection = useMemo(\n () => toSelection(defaultSelectedKeys),\n [defaultSelectedKeys],\n );\n\n const state = useMultipleSelectionState({\n selectionMode,\n selectedKeys: controlledSelection,\n defaultSelectedKeys: defaultSelection,\n disabledKeys: unselectableKeys,\n disabledBehavior: 'selection',\n onSelectionChange: handleSelectionChange,\n });\n\n const selectionManager = useMemo(\n () => new SelectionManager(collection, state),\n [collection, state],\n );\n\n const selectedKeys = state.selectedKeys;\n const isAll = selectedKeys === 'all';\n\n const canSelect = useCallback(\n (key: Key) => isEnabled && !unselectableKeys.has(key),\n [isEnabled, unselectableKeys],\n );\n\n const isSelected = useCallback(\n (key: Key) =>\n isAll ? canSelect(key) : (selectedKeys as Set<Key>).has(key),\n [isAll, selectedKeys, canSelect],\n );\n\n /** Keys the header checkbox acts on, which is what `selectAllMode` decides. */\n const scopeKeys = useMemo(() => {\n if (!isEnabled || selectionMode === 'single') return [];\n\n const source = selectAllMode === 'page' ? rows : filteredRows;\n\n return source\n .map((row, index) => getRowKey(row, index))\n .filter((key) => !unselectableKeys.has(key));\n }, [\n isEnabled,\n selectionMode,\n selectAllMode,\n rows,\n filteredRows,\n getRowKey,\n unselectableKeys,\n ]);\n\n const selectAllState: CubeTableSelectAllState = useMemo(() => {\n if (isAll) return 'all';\n if (!scopeKeys.length) return 'none';\n\n const set = selectedKeys as Set<Key>;\n let count = 0;\n\n for (const key of scopeKeys) if (set.has(key)) count++;\n\n return count === 0 ? 'none' : count === scopeKeys.length ? 'all' : 'some';\n }, [isAll, selectedKeys, scopeKeys]);\n\n const toggleSelectAll = useEvent(() => {\n anchorRef.current = null;\n extentRef.current = null;\n\n if (selectAllState === 'all') {\n // Clearing drops the whole selection, not just the scope: leaving keys\n // selected on other pages after the user clicked an unchecked-looking\n // box is the kind of thing nobody discovers until they delete something.\n state.setSelectedKeys(new Set());\n\n return;\n }\n\n if (selectAllMode === 'all') {\n state.setSelectedKeys('all');\n\n return;\n }\n\n const next = new Set(isAll ? [] : (selectedKeys as Set<Key>));\n\n scopeKeys.forEach((key) => next.add(key));\n state.setSelectedKeys(next);\n });\n\n const clearSelection = useEvent(() => {\n anchorRef.current = null;\n extentRef.current = null;\n state.setSelectedKeys(new Set());\n });\n\n /**\n * Shift held on the press that produced this change. `Checkbox` reports only\n * the next value, so the modifier is captured from the pointer/key event on\n * the cell and read back here.\n */\n const shiftRef = useRef(false);\n\n const captureShift = useCallback((event: { shiftKey: boolean }) => {\n shiftRef.current = event.shiftKey;\n }, []);\n\n /** Selectable keys between two rows, inclusive, in either direction. */\n const keysBetween = useCallback(\n (from: Key, to: Key) => {\n const fromIndex = collection.indexOf(from);\n const toIndex = collection.indexOf(to);\n\n if (fromIndex < 0 || toIndex < 0) return [];\n\n const [lo, hi] =\n fromIndex <= toIndex ? [fromIndex, toIndex] : [toIndex, fromIndex];\n const all = collection.getKeys();\n const range: Key[] = [];\n\n for (let i = lo; i <= hi; i++) range.push(all[i]);\n\n return range;\n },\n [collection],\n );\n\n const toggleRow = useEvent((key: Key) => {\n if (!canSelect(key)) return;\n\n if (selectionMode === 'single') {\n state.setSelectedKeys(isSelected(key) ? new Set() : new Set([key]));\n\n return;\n }\n\n const anchor = anchorRef.current;\n\n if (shiftRef.current && anchor != null && collection.indexOf(anchor) >= 0) {\n const next = new Set(isAll ? scopeKeys : (selectedKeys as Set<Key>));\n\n // Drop the range this shift-click supersedes before drawing the new one,\n // so clicking back toward the anchor shrinks the selection.\n if (extentRef.current != null) {\n keysBetween(anchor, extentRef.current).forEach((k) => next.delete(k));\n }\n\n keysBetween(anchor, key).forEach((k) => {\n if (canSelect(k)) next.add(k);\n });\n\n extentRef.current = key;\n state.setSelectedKeys(next);\n\n return;\n }\n\n anchorRef.current = key;\n extentRef.current = null;\n selectionManager.toggleSelection(key);\n });\n\n const selectedRows = useMemo(() => {\n if (isAll) return [...rowByKey.values()];\n\n return [...(selectedKeys as Set<Key>)]\n .map((key) => rowByKey.get(key))\n .filter((row): row is T => row !== undefined);\n }, [isAll, selectedKeys, rowByKey]);\n\n return {\n isEnabled,\n selectionMode,\n selectionManager,\n collection,\n isSelected,\n canSelect,\n isRowDisabled: useCallback(\n (key: Key) => hardDisabledKeys.has(key),\n [hardDisabledKeys],\n ),\n toggleRow,\n captureShift,\n selectAllState,\n toggleSelectAll,\n clearSelection,\n selectedRows,\n selectedCount: isAll ? rowByKey.size : (selectedKeys as Set<Key>).size,\n selectedKeys: (isAll ? 'all' : [...(selectedKeys as Set<Key>)]) as\n | Key[]\n | 'all',\n };\n}\n\nexport type CubeTableSelectionState<T> = ReturnType<\n typeof useTableSelection<T>\n>;\n"],"mappings":";;;;;;;;;;;;;AAgBA,MAAa,uBAAuB;;AAGpC,MAAa,wBAAwB;;AAGrC,MAAa,yBAAiD;CAC5D,QAAQ;CACR,OAAO;CACP,QAAQ;CACR,OAAO;CACP,QAAQ;CACT;AAuBD,SAAS,YAAY,MAAwD;AAC3E,KAAI,SAAS,OAAW,QAAO;AAE/B,QAAO,SAAS,QAAQ,QAAQ,IAAI,IAAI,KAAK;;AAG/C,SAAgB,kBAAqB,SAAsC;CACzE,MAAM,EACJ,MACA,cACA,WACA,eACA,cAAc,kBACd,qBACA,mBACA,eACA,iBACA,iBACE;CAEJ,MAAM,YAAY,kBAAkB;;;;;;;;;;;;;CAcpC,MAAM,mBAAmB,cACjB,IAAI,IAAI,gBAAgB,EAAE,CAAC,EACjC,CAAC,aAAa,CACf;CAED,MAAM,mBAAmB,cAAc;EACrC,MAAM,OAAO,IAAI,IAAI,iBAAiB;AAEtC,MAAI,gBAGF,cAAa,SAAS,KAAK,UAAU;AACnC,OAAI,CAAC,gBAAgB,IAAI,CAAE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QAAQ,CAAC;AAExC,SAAO,CAAC,GAAI,aAA0B,CACnC,KAAK,QAAQ,SAAS,IAAI,IAAI,CAAC,CAC/B,QAAQ,QAAkB,QAAQ,OAAU;IAC9C;EAAC;EAAO;EAAc;EAAS,CAAC;AAEnC,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA,eAAe,aACZ,QAAa,iBAAiB,IAAI,IAAI,EACvC,CAAC,iBAAiB,CACnB;EACD;EACA;EACA;EACA;EACA;EACA;EACA,eAAe,QAAQ,SAAS,OAAQ,aAA0B;EAClE,cAAe,QAAQ,QAAQ,CAAC,GAAI,aAA0B;EAG/D"}
1
+ {"version":3,"file":"use-table-selection.js","names":[],"sources":["../../../../src/components/data/TableBase/use-table-selection.ts"],"sourcesContent":["import { SelectionManager } from '@react-stately/selection';\nimport { useCallback, useMemo, useRef } from 'react';\nimport { useMultipleSelectionState } from 'react-stately';\n\nimport { useEvent } from '../../../_internal/hooks';\n\nimport { RowCollection } from './RowCollection';\n\nimport type { Key, Selection } from '@react-types/shared';\nimport type { CubeTableSelectAllMode, CubeTableSelectionMode } from './types';\n\n/**\n * Reserved key for the checkbox column. Prefixed so it cannot collide with a\n * real data key, and structural so the value pipeline, sorting and search all\n * skip it.\n */\nexport const SELECTION_COLUMN_KEY = '__cube-selection__';\n\n/** Reserved key for the row-number column. Structural, like the checkbox. */\nexport const ROW_NUMBER_COLUMN_KEY = '__cube-row-number__';\n\n/** Square-ish, so the checkbox sits centred without stealing content width. */\nexport const SELECTION_COLUMN_WIDTH: Record<string, number> = {\n xsmall: 32,\n small: 36,\n medium: 44,\n large: 48,\n xlarge: 52,\n};\n\nexport interface UseTableSelectionOptions<T> {\n /** Rows currently on screen — one page, or everything when unpaginated. */\n rows: readonly T[];\n /** Stable keys parallel to `rows`, used by tree mode. */\n rowKeys?: readonly Key[];\n /** Full current-page subtree; defaults to `rows`. */\n pageRows?: readonly T[];\n /** Stable keys parallel to `pageRows`. */\n pageRowKeys?: readonly Key[];\n /**\n * Every row passing the current search/filter, across pages. Only differs\n * from `rows` under client pagination, and only `selectAllMode=\"filtered\"`\n * reads it.\n */\n filteredRows: readonly T[];\n /** Stable keys parallel to `filteredRows`. */\n filteredRowKeys?: readonly Key[];\n getRowKey: (row: T, index: number) => Key;\n selectionMode: CubeTableSelectionMode;\n selectedKeys?: Key[] | 'all';\n defaultSelectedKeys?: Key[] | 'all';\n onSelectionChange?: (keys: Key[] | 'all', rows: T[]) => void;\n selectAllMode: CubeTableSelectAllMode;\n isRowSelectable?: (row: T) => boolean;\n disabledKeys?: Key[];\n tree?: {\n rootKeys: readonly Key[];\n childrenOf: ReadonlyMap<Key, readonly Key[]>;\n parentOf: ReadonlyMap<Key, Key | null>;\n behavior: 'cascade' | 'independent';\n };\n}\n\nexport type CubeTableSelectAllState = 'none' | 'some' | 'all';\n\nfunction toSelection(keys: Key[] | 'all' | undefined): Selection | undefined {\n if (keys === undefined) return undefined;\n\n return keys === 'all' ? 'all' : new Set(keys);\n}\n\nfunction deriveTreeSelection(\n source: ReadonlySet<Key>,\n rootKeys: readonly Key[],\n childrenOf: ReadonlyMap<Key, readonly Key[]>,\n isEligible: (key: Key) => boolean,\n) {\n const checked = new Set(source);\n const indeterminate = new Set<Key>();\n\n const visit = (\n key: Key,\n ): { all: boolean; any: boolean; eligible: boolean } => {\n const children = childrenOf.get(key) ?? [];\n const eligible = isEligible(key);\n const explicitlySelected = eligible && source.has(key);\n\n if (explicitlySelected) checked.add(key);\n\n if (!children.length) {\n const selected = eligible && checked.has(key);\n if (!eligible) checked.delete(key);\n return { all: !eligible || selected, any: selected, eligible };\n }\n\n let all = true;\n let any = false;\n let hasEligible = false;\n\n for (const child of children) {\n const result = visit(child);\n if (result.eligible) hasEligible = true;\n if (!result.all) all = false;\n if (result.any) any = true;\n }\n\n if (!eligible) {\n checked.delete(key);\n indeterminate.delete(key);\n } else if (hasEligible && all) {\n checked.add(key);\n indeterminate.delete(key);\n } else if (hasEligible && any) {\n checked.delete(key);\n indeterminate.add(key);\n } else if (hasEligible) {\n // Branch keys in the public set are a normalized reflection of their\n // descendants, not an enduring wildcard. This matters when a search\n // hid siblings: restoring the full tree must not make those siblings\n // selected merely because the filtered parent had been checked.\n checked.delete(key);\n indeterminate.delete(key);\n } else if (!checked.has(key)) {\n indeterminate.delete(key);\n }\n\n return {\n all: !eligible || (checked.has(key) && all),\n any: any || checked.has(key),\n eligible: eligible || hasEligible,\n };\n };\n\n rootKeys.forEach((key) => visit(key));\n return { checked, indeterminate };\n}\n\nexport function useTableSelection<T>(options: UseTableSelectionOptions<T>) {\n const {\n rows,\n rowKeys,\n pageRows = rows,\n pageRowKeys,\n filteredRows,\n filteredRowKeys,\n getRowKey,\n selectionMode,\n selectedKeys: selectedKeysProp,\n defaultSelectedKeys,\n onSelectionChange,\n selectAllMode,\n isRowSelectable,\n disabledKeys,\n tree,\n } = options;\n\n const isEnabled = selectionMode !== 'none';\n\n /**\n * Two distinct notions of \"not available\", deliberately kept apart:\n *\n * - `disabledKeys` — the row is inert. Not focusable, not interactive. This\n * is React Aria's standard meaning.\n * - `isRowSelectable` — the row is fully interactive, only its checkbox is\n * inert. This is what Cloud's tables do today.\n *\n * A `SelectionManager` has one `disabledBehavior`, so it gets the union under\n * `'selection'` (neither kind can be selected) and the hard-disabled set is\n * tracked separately for focus and interaction.\n */\n const hardDisabledKeys = useMemo(\n () => new Set(disabledKeys ?? []),\n [disabledKeys],\n );\n\n const unselectableKeys = useMemo(() => {\n const keys = new Set(hardDisabledKeys);\n\n if (isRowSelectable) {\n // Scanned over the filtered set, not just the page: a select-all that\n // reaches beyond the page must respect it there too.\n filteredRows.forEach((row, index) => {\n if (!isRowSelectable(row)) {\n keys.add(filteredRowKeys?.[index] ?? getRowKey(row, index));\n }\n });\n }\n\n return keys;\n }, [\n hardDisabledKeys,\n isRowSelectable,\n filteredRows,\n filteredRowKeys,\n getRowKey,\n ]);\n\n const visibleGetRowKey = useCallback(\n (row: T, index: number) => rowKeys?.[index] ?? getRowKey(row, index),\n [rowKeys, getRowKey],\n );\n\n const collection = useMemo(\n () => new RowCollection(rows, visibleGetRowKey, unselectableKeys),\n [rows, visibleGetRowKey, unselectableKeys],\n );\n\n const rowByKey = useMemo(() => {\n const map = new Map<Key, T>();\n\n // The page first, then the wider filtered set, so a key present in both\n // resolves to the row the user can actually see.\n filteredRows.forEach((row, index) =>\n map.set(filteredRowKeys?.[index] ?? getRowKey(row, index), row),\n );\n rows.forEach((row, index) =>\n map.set(rowKeys?.[index] ?? getRowKey(row, index), row),\n );\n\n return map;\n }, [rows, rowKeys, filteredRows, filteredRowKeys, getRowKey]);\n\n const rowByKeyRef = useRef(rowByKey);\n\n rowByKeyRef.current = rowByKey;\n\n /**\n * Where a shift-range starts, and how far it currently reaches.\n *\n * React Aria's `SelectionManager.extendSelection` keeps this on the `Selection`\n * object itself (`selectedKeys.anchorKey`), which cannot survive our public\n * API: `selectedKeys` is `Key[]`, and `useMultipleSelectionState` rebuilds\n * whatever it is given with `new Selection(value)` — a constructor that only\n * copies the anchor when the input is already a `Selection`, a class no\n * package exports. A controlled table would silently reset the anchor to the\n * clicked row and turn every shift-click into a plain toggle.\n *\n * So the range is computed here instead, over `RowCollection`'s index. The\n * semantics match `extendSelection` exactly: the previous range is removed\n * before the new one is added, so shift-clicking back shrinks the range\n * rather than leaving the overshoot selected.\n */\n const anchorRef = useRef<Key | null>(null);\n const extentRef = useRef<Key | null>(null);\n\n const handleSelectionChange = useEvent((keys: Selection) => {\n if (!onSelectionChange) return;\n\n if (keys === 'all') {\n // The sentinel means \"everything, including rows the client has not\n // loaded\", so the row list can only ever be what is loaded.\n onSelectionChange('all', [...rowByKeyRef.current.values()]);\n\n return;\n }\n\n const list = [...keys];\n\n onSelectionChange(\n list,\n list\n .map((key) => rowByKeyRef.current.get(key))\n .filter((row): row is T => row !== undefined),\n );\n });\n\n const controlledSelection = useMemo(\n () => toSelection(selectedKeysProp),\n [selectedKeysProp],\n );\n const defaultSelection = useMemo(\n () => toSelection(defaultSelectedKeys),\n [defaultSelectedKeys],\n );\n\n const state = useMultipleSelectionState({\n selectionMode,\n selectedKeys: controlledSelection,\n defaultSelectedKeys: defaultSelection,\n disabledKeys: unselectableKeys,\n disabledBehavior: 'selection',\n onSelectionChange: handleSelectionChange,\n });\n\n const selectionManager = useMemo(\n () => new SelectionManager(collection, state),\n [collection, state],\n );\n\n const selectedKeys = state.selectedKeys;\n const isAll = selectedKeys === 'all';\n const isCascade =\n tree?.behavior === 'cascade' && selectionMode === 'multiple';\n\n const derivedSelection = useMemo(() => {\n if (isAll) {\n return {\n checked: new Set(\n [...rowByKey.keys()].filter((key) => !unselectableKeys.has(key)),\n ),\n indeterminate: new Set<Key>(),\n };\n }\n\n if (!isCascade || !tree) {\n return {\n checked: new Set(selectedKeys as Set<Key>),\n indeterminate: new Set<Key>(),\n };\n }\n\n return deriveTreeSelection(\n selectedKeys as Set<Key>,\n tree.rootKeys,\n tree.childrenOf,\n (key) => !unselectableKeys.has(key),\n );\n }, [isAll, isCascade, selectedKeys, tree, rowByKey, unselectableKeys]);\n\n const canSelect = useCallback(\n (key: Key) => isEnabled && !unselectableKeys.has(key),\n [isEnabled, unselectableKeys],\n );\n\n const isSelected = useCallback(\n (key: Key) => (isAll ? canSelect(key) : derivedSelection.checked.has(key)),\n [isAll, derivedSelection, canSelect],\n );\n\n const isIndeterminate = useCallback(\n (key: Key) => derivedSelection.indeterminate.has(key),\n [derivedSelection],\n );\n\n /** Keys the header checkbox acts on, which is what `selectAllMode` decides. */\n const scopeKeys = useMemo(() => {\n if (!isEnabled || selectionMode === 'single') return [];\n\n const source = selectAllMode === 'page' ? pageRows : filteredRows;\n const sourceKeys = selectAllMode === 'page' ? pageRowKeys : filteredRowKeys;\n\n return source\n .map((row, index) => sourceKeys?.[index] ?? getRowKey(row, index))\n .filter((key) => !unselectableKeys.has(key));\n }, [\n isEnabled,\n selectionMode,\n selectAllMode,\n pageRows,\n pageRowKeys,\n filteredRows,\n filteredRowKeys,\n getRowKey,\n unselectableKeys,\n ]);\n\n const selectAllState: CubeTableSelectAllState = useMemo(() => {\n if (isAll) return 'all';\n if (!scopeKeys.length) return 'none';\n\n const set = derivedSelection.checked;\n let count = 0;\n\n for (const key of scopeKeys) if (set.has(key)) count++;\n\n return count === 0 ? 'none' : count === scopeKeys.length ? 'all' : 'some';\n }, [isAll, derivedSelection, scopeKeys]);\n\n const toggleSelectAll = useEvent(() => {\n anchorRef.current = null;\n extentRef.current = null;\n\n if (selectAllState === 'all') {\n // Clearing drops the whole selection, not just the scope: leaving keys\n // selected on other pages after the user clicked an unchecked-looking\n // box is the kind of thing nobody discovers until they delete something.\n state.setSelectedKeys(new Set());\n\n return;\n }\n\n if (selectAllMode === 'all') {\n state.setSelectedKeys('all');\n\n return;\n }\n\n const next = new Set(isAll ? [] : derivedSelection.checked);\n\n scopeKeys.forEach((key) => next.add(key));\n state.setSelectedKeys(\n isCascade && tree\n ? deriveTreeSelection(\n next,\n tree.rootKeys,\n tree.childrenOf,\n (key) => !unselectableKeys.has(key),\n ).checked\n : next,\n );\n });\n\n const clearSelection = useEvent(() => {\n anchorRef.current = null;\n extentRef.current = null;\n state.setSelectedKeys(new Set());\n });\n\n /**\n * Shift held on the press that produced this change. `Checkbox` reports only\n * the next value, so the modifier is captured from the pointer/key event on\n * the cell and read back here.\n */\n const shiftRef = useRef(false);\n\n const captureShift = useCallback((event: { shiftKey: boolean }) => {\n shiftRef.current = event.shiftKey;\n }, []);\n\n /** Selectable keys between two rows, inclusive, in either direction. */\n const keysBetween = useCallback(\n (from: Key, to: Key) => {\n const fromIndex = collection.indexOf(from);\n const toIndex = collection.indexOf(to);\n\n if (fromIndex < 0 || toIndex < 0) return [];\n\n const [lo, hi] =\n fromIndex <= toIndex ? [fromIndex, toIndex] : [toIndex, fromIndex];\n const all = collection.getKeys();\n const range: Key[] = [];\n\n for (let i = lo; i <= hi; i++) range.push(all[i]);\n\n return range;\n },\n [collection],\n );\n\n const toggleRow = useEvent((key: Key) => {\n if (!canSelect(key)) return;\n\n if (selectionMode === 'single') {\n state.setSelectedKeys(isSelected(key) ? new Set() : new Set([key]));\n\n return;\n }\n\n const applyCascade = (set: Set<Key>, target: Key, value: boolean) => {\n if (!canSelect(target)) return;\n if (value) set.add(target);\n else {\n set.delete(target);\n\n // A checked ancestor in the normalized public key set means its whole\n // branch is selected. Remove that derived marker before normalizing a\n // partial deselection, or it would immediately select the child again.\n if (isCascade && tree) {\n let parent = tree.parentOf.get(target);\n while (parent != null) {\n set.delete(parent);\n parent = tree.parentOf.get(parent);\n }\n }\n }\n if (!isCascade || !tree) return;\n (tree.childrenOf.get(target) ?? []).forEach((child) =>\n applyCascade(set, child, value),\n );\n };\n\n const normalizeCascade = (set: Set<Key>) =>\n isCascade && tree\n ? deriveTreeSelection(\n set,\n tree.rootKeys,\n tree.childrenOf,\n (candidate) => !unselectableKeys.has(candidate),\n ).checked\n : set;\n\n const anchor = anchorRef.current;\n\n if (shiftRef.current && anchor != null && collection.indexOf(anchor) >= 0) {\n const next = new Set(isAll ? scopeKeys : derivedSelection.checked);\n\n // Drop the range this shift-click supersedes before drawing the new one,\n // so clicking back toward the anchor shrinks the selection.\n if (extentRef.current != null) {\n keysBetween(anchor, extentRef.current).forEach((k) =>\n applyCascade(next, k, false),\n );\n }\n\n keysBetween(anchor, key).forEach((k) => {\n applyCascade(next, k, true);\n });\n\n extentRef.current = key;\n state.setSelectedKeys(normalizeCascade(next));\n\n return;\n }\n\n anchorRef.current = key;\n extentRef.current = null;\n if (isCascade) {\n const next = new Set(derivedSelection.checked);\n applyCascade(next, key, !derivedSelection.checked.has(key));\n state.setSelectedKeys(normalizeCascade(next));\n } else {\n selectionManager.toggleSelection(key);\n }\n });\n\n const selectedRows = useMemo(() => {\n if (isAll) return [...rowByKey.values()];\n\n return [...derivedSelection.checked]\n .map((key) => rowByKey.get(key))\n .filter((row): row is T => row !== undefined);\n }, [isAll, derivedSelection, rowByKey]);\n\n return {\n isEnabled,\n selectionMode,\n selectionManager,\n collection,\n isSelected,\n isIndeterminate,\n canSelect,\n isRowDisabled: useCallback(\n (key: Key) => hardDisabledKeys.has(key),\n [hardDisabledKeys],\n ),\n toggleRow,\n captureShift,\n selectAllState,\n toggleSelectAll,\n clearSelection,\n selectedRows,\n selectedCount: isAll ? rowByKey.size : derivedSelection.checked.size,\n selectedKeys: (isAll ? 'all' : [...derivedSelection.checked]) as\n | Key[]\n | 'all',\n };\n}\n\nexport type CubeTableSelectionState<T> = ReturnType<\n typeof useTableSelection<T>\n>;\n"],"mappings":";;;;;;;;;;;;;AAgBA,MAAa,uBAAuB;;AAGpC,MAAa,wBAAwB;;AAGrC,MAAa,yBAAiD;CAC5D,QAAQ;CACR,OAAO;CACP,QAAQ;CACR,OAAO;CACP,QAAQ;CACT;AAqCD,SAAS,YAAY,MAAwD;AAC3E,KAAI,SAAS,OAAW,QAAO;AAE/B,QAAO,SAAS,QAAQ,QAAQ,IAAI,IAAI,KAAK;;AAG/C,SAAS,oBACP,QACA,UACA,YACA,YACA;CACA,MAAM,UAAU,IAAI,IAAI,OAAO;CAC/B,MAAM,gCAAgB,IAAI,KAAU;CAEpC,MAAM,SACJ,QACsD;EACtD,MAAM,WAAW,WAAW,IAAI,IAAI,IAAI,EAAE;EAC1C,MAAM,WAAW,WAAW,IAAI;AAGhC,MAF2B,YAAY,OAAO,IAAI,IAAI,CAE9B,SAAQ,IAAI,IAAI;AAExC,MAAI,CAAC,SAAS,QAAQ;GACpB,MAAM,WAAW,YAAY,QAAQ,IAAI,IAAI;AAC7C,OAAI,CAAC,SAAU,SAAQ,OAAO,IAAI;AAClC,UAAO;IAAE,KAAK,CAAC,YAAY;IAAU,KAAK;IAAU;IAAU;;EAGhE,IAAI,MAAM;EACV,IAAI,MAAM;EACV,IAAI,cAAc;AAElB,OAAK,MAAM,SAAS,UAAU;GAC5B,MAAM,SAAS,MAAM,MAAM;AAC3B,OAAI,OAAO,SAAU,eAAc;AACnC,OAAI,CAAC,OAAO,IAAK,OAAM;AACvB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AI,CAAC;AAC3D,SAAM,gBAAgB,iBAAiB,KAAK,CAAC;QAE7C,kBAAiB,gBAAgB,IAAI;GAEvC;CAEF,MAAM,eAAe,cAAc;AACjC,MAAI,MAAO,QAAO,CAAC,GAAG,SAAS,QAAQ,CAAC;AAExC,SAAO,CAAC,GAAG,iBAAiB,QAAQ,CACjC,KAAK,QAAQ,SAAS,IAAI,IAAI,CAAC,CAC/B,QAAQ,QAAkB,QAAQ,OAAU;IAC9C;EAAC;EAAO;EAAkB;EAAS,CAAC;AAEvC,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA,eAAe,aACZ,QAAa,iBAAiB,IAAI,IAAI,EACvC,CAAC,iBAAiB,CACnB;EACD;EACA;EACA;EACA;EACA;EACA;EACA,eAAe,QAAQ,SAAS,OAAO,iBAAiB,QAAQ;EAChE,cAAe,QAAQ,QAAQ,CAAC,GAAG,iBAAiB,QAAQ;EAG7D"}
@@ -1,4 +1,4 @@
1
- /** @license MIT | @cube-dev/ui-kit v0.164.0 | Cube Dev Team */
1
+ /** @license MIT | @cube-dev/ui-kit v0.166.0 | Cube Dev Team */
2
2
  import { useEvent } from "../../../_internal/hooks/use-event.js";
3
3
  import { getColumnText, getColumnValue } from "./use-table-columns.js";
4
4
  import { useMemo } from "react";
@@ -1,4 +1,4 @@
1
- /** @license MIT | @cube-dev/ui-kit v0.164.0 | Cube Dev Team */
1
+ /** @license MIT | @cube-dev/ui-kit v0.166.0 | Cube Dev Team */
2
2
  import { useEvent } from "../../../_internal/hooks/use-event.js";
3
3
  import { compareByColumn } from "./use-table-sort.js";
4
4
  import { useMemo } from "react";
@@ -1,4 +1,4 @@
1
- /** @license MIT | @cube-dev/ui-kit v0.164.0 | Cube Dev Team */
1
+ /** @license MIT | @cube-dev/ui-kit v0.166.0 | Cube Dev Team */
2
2
  import { useCallback, useRef, useState } from "react";
3
3
 
4
4
  //#region src/components/data/TableBase/use-table-storage.ts