@cube-dev/ui-kit 0.156.0 → 0.157.1

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 (637) hide show
  1. package/dist/CHANGELOG.md +237 -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 +42 -44
  41. package/dist/components/actions/use-context-menu.js.map +1 -1
  42. package/dist/components/content/ActiveZone/ActiveZone.js +1 -1
  43. package/dist/components/content/Alert/Alert.js +1 -1
  44. package/dist/components/content/Alert/use-alert.js +1 -1
  45. package/dist/components/content/Avatar/Avatar.js +1 -1
  46. package/dist/components/content/Badge/Badge.js +1 -1
  47. package/dist/components/content/Card/Card.js +1 -1
  48. package/dist/components/content/Content.js +1 -1
  49. package/dist/components/content/CopyPasteBlock/CopyPasteBlock.js +1 -1
  50. package/dist/components/content/CopySnippet/CopySnippet.js +1 -1
  51. package/dist/components/content/Disclosure/Disclosure.js +1 -1
  52. package/dist/components/content/Divider.js +1 -1
  53. package/dist/components/content/Footer.js +1 -1
  54. package/dist/components/content/Header.js +1 -1
  55. package/dist/components/content/HotKeys/HotKeys.js +1 -1
  56. package/dist/components/content/InfoBadge/InfoBadge.js +1 -1
  57. package/dist/components/content/InlineInput/InlineInput.js +1 -1
  58. package/dist/components/content/Item/Item.js +1 -1
  59. package/dist/components/content/ItemBadge/ItemBadge.js +1 -1
  60. package/dist/components/content/ItemCard/ItemCard.js +1 -1
  61. package/dist/components/content/Layout/GridLayout.js +1 -1
  62. package/dist/components/content/Layout/Layout.js +1 -1
  63. package/dist/components/content/Layout/LayoutBlock.js +1 -1
  64. package/dist/components/content/Layout/LayoutCenter.js +1 -1
  65. package/dist/components/content/Layout/LayoutContainer.js +1 -1
  66. package/dist/components/content/Layout/LayoutContent.js +1 -1
  67. package/dist/components/content/Layout/LayoutContext.js +1 -1
  68. package/dist/components/content/Layout/LayoutFlex.js +1 -1
  69. package/dist/components/content/Layout/LayoutFooter.js +1 -1
  70. package/dist/components/content/Layout/LayoutGrid.js +1 -1
  71. package/dist/components/content/Layout/LayoutHeader.js +1 -1
  72. package/dist/components/content/Layout/LayoutPane.js +1 -1
  73. package/dist/components/content/Layout/LayoutPanel.js +1 -1
  74. package/dist/components/content/Layout/LayoutPanelHeader.js +1 -1
  75. package/dist/components/content/Layout/LayoutToolbar.js +1 -1
  76. package/dist/components/content/Layout/hooks/useTinyScrollbar.js +1 -1
  77. package/dist/components/content/Layout/index.js +1 -1
  78. package/dist/components/content/Layout/utils.js +1 -1
  79. package/dist/components/content/Paragraph.js +1 -1
  80. package/dist/components/content/Placeholder/Placeholder.js +1 -1
  81. package/dist/components/content/PrismCode/PrismCode.js +1 -1
  82. package/dist/components/content/PrismCode/prismSetup.js +1 -1
  83. package/dist/components/content/PrismDiffCode/PrismDiffCode.js +1 -1
  84. package/dist/components/content/Result/Result.js +1 -1
  85. package/dist/components/content/Skeleton/Skeleton.js +1 -1
  86. package/dist/components/content/Tag/Tag.js +2 -2
  87. package/dist/components/content/Tag/Tag.js.map +1 -1
  88. package/dist/components/content/Text.js +1 -1
  89. package/dist/components/content/TextItem/TextItem.js +1 -1
  90. package/dist/components/content/Title.js +1 -1
  91. package/dist/components/content/Tree/Tree.js +1 -1
  92. package/dist/components/content/Tree/TreeNode.js +1 -1
  93. package/dist/components/content/Tree/styled.js +1 -1
  94. package/dist/components/content/Tree/tree-index.js +1 -1
  95. package/dist/components/content/Tree/use-checkbox-tree.js +1 -1
  96. package/dist/components/content/Tree/use-load-data.js +1 -1
  97. package/dist/components/content/highlightText.js +1 -1
  98. package/dist/components/content/use-auto-tooltip.js +1 -1
  99. package/dist/components/data/DataTable/DataTable.d.ts +13 -0
  100. package/dist/components/data/DataTable/DataTable.js +246 -0
  101. package/dist/components/data/DataTable/DataTable.js.map +1 -0
  102. package/dist/components/data/DataTable/index.d.ts +3 -0
  103. package/dist/components/data/DataTable/types.d.ts +145 -0
  104. package/dist/components/data/ItemTable/ItemTable.d.ts +19 -0
  105. package/dist/components/data/ItemTable/ItemTable.js +350 -0
  106. package/dist/components/data/ItemTable/ItemTable.js.map +1 -0
  107. package/dist/components/data/ItemTable/ItemTableBulkBar.d.ts +23 -0
  108. package/dist/components/data/ItemTable/ItemTableBulkBar.js +131 -0
  109. package/dist/components/data/ItemTable/ItemTableBulkBar.js.map +1 -0
  110. package/dist/components/data/ItemTable/ItemTableDragPreview.js +46 -0
  111. package/dist/components/data/ItemTable/ItemTableDragPreview.js.map +1 -0
  112. package/dist/components/data/ItemTable/ItemTableFooter.js +79 -0
  113. package/dist/components/data/ItemTable/ItemTableFooter.js.map +1 -0
  114. package/dist/components/data/ItemTable/ItemTableToolbar.d.ts +34 -0
  115. package/dist/components/data/ItemTable/ItemTableToolbar.js +91 -0
  116. package/dist/components/data/ItemTable/ItemTableToolbar.js.map +1 -0
  117. package/dist/components/data/ItemTable/index.d.ts +4 -0
  118. package/dist/components/data/ItemTable/types.d.ts +327 -0
  119. package/dist/components/data/TableBase/ColumnResizer.js +70 -0
  120. package/dist/components/data/TableBase/ColumnResizer.js.map +1 -0
  121. package/dist/components/data/TableBase/RowCollection.js +99 -0
  122. package/dist/components/data/TableBase/RowCollection.js.map +1 -0
  123. package/dist/components/data/TableBase/TableRow.js +89 -0
  124. package/dist/components/data/TableBase/TableRow.js.map +1 -0
  125. package/dist/components/data/TableBase/TableView.d.ts +22 -0
  126. package/dist/components/data/TableBase/TableView.js +921 -0
  127. package/dist/components/data/TableBase/TableView.js.map +1 -0
  128. package/dist/components/data/TableBase/index.d.ts +5 -0
  129. package/dist/components/data/TableBase/row-menu.js +40 -0
  130. package/dist/components/data/TableBase/row-menu.js.map +1 -0
  131. package/dist/components/data/TableBase/styled.d.ts +5 -0
  132. package/dist/components/data/TableBase/styled.js +532 -0
  133. package/dist/components/data/TableBase/styled.js.map +1 -0
  134. package/dist/components/data/TableBase/types.d.ts +160 -0
  135. package/dist/components/data/TableBase/types.js +31 -0
  136. package/dist/components/data/TableBase/types.js.map +1 -0
  137. package/dist/components/data/TableBase/use-cell-selection.d.ts +3 -0
  138. package/dist/components/data/TableBase/use-cell-selection.js +0 -0
  139. package/dist/components/data/TableBase/use-cell-selection.js.map +1 -0
  140. package/dist/components/data/TableBase/use-container-width.js +35 -0
  141. package/dist/components/data/TableBase/use-container-width.js.map +1 -0
  142. package/dist/components/data/TableBase/use-row-move-animation.js +90 -0
  143. package/dist/components/data/TableBase/use-row-move-animation.js.map +1 -0
  144. package/dist/components/data/TableBase/use-scrollability.js +49 -0
  145. package/dist/components/data/TableBase/use-scrollability.js.map +1 -0
  146. package/dist/components/data/TableBase/use-table-columns.d.ts +2 -0
  147. package/dist/components/data/TableBase/use-table-columns.js +166 -0
  148. package/dist/components/data/TableBase/use-table-columns.js.map +1 -0
  149. package/dist/components/data/TableBase/use-table-search.js +64 -0
  150. package/dist/components/data/TableBase/use-table-search.js.map +1 -0
  151. package/dist/components/data/TableBase/use-table-selection.d.ts +4 -0
  152. package/dist/components/data/TableBase/use-table-selection.js +233 -0
  153. package/dist/components/data/TableBase/use-table-selection.js.map +1 -0
  154. package/dist/components/data/TableBase/use-table-sort.js +91 -0
  155. package/dist/components/data/TableBase/use-table-sort.js.map +1 -0
  156. package/dist/components/data/TableBase/use-table-sorts.js +97 -0
  157. package/dist/components/data/TableBase/use-table-sorts.js.map +1 -0
  158. package/dist/components/data/TableBase/use-table-storage.d.ts +8 -0
  159. package/dist/components/data/TableBase/use-table-storage.js +58 -0
  160. package/dist/components/data/TableBase/use-table-storage.js.map +1 -0
  161. package/dist/components/data/index.d.ts +10 -0
  162. package/dist/components/fields/Checkbox/Checkbox.js +1 -1
  163. package/dist/components/fields/Checkbox/CheckboxGroup.js +1 -1
  164. package/dist/components/fields/Checkbox/context.js +1 -1
  165. package/dist/components/fields/ColorInput/ColorInput.d.ts +67 -0
  166. package/dist/components/fields/ColorInput/ColorInput.js +230 -0
  167. package/dist/components/fields/ColorInput/ColorInput.js.map +1 -0
  168. package/dist/components/fields/ColorInput/index.d.ts +2 -0
  169. package/dist/components/fields/ColorPicker/ColorPicker.d.ts +34 -37
  170. package/dist/components/fields/ColorPicker/ColorPicker.js +131 -182
  171. package/dist/components/fields/ColorPicker/ColorPicker.js.map +1 -1
  172. package/dist/components/fields/ColorPicker/index.d.ts +1 -3
  173. package/dist/components/fields/ColorSwatchGroup/ColorSwatchGroup.d.ts +50 -0
  174. package/dist/components/fields/ColorSwatchGroup/ColorSwatchGroup.js +269 -0
  175. package/dist/components/fields/ColorSwatchGroup/ColorSwatchGroup.js.map +1 -0
  176. package/dist/components/fields/ColorSwatchGroup/index.d.ts +2 -0
  177. package/dist/components/fields/ComboBox/ComboBox.js +1 -1
  178. package/dist/components/fields/CommandTextArea/CommandTextArea.js +1 -1
  179. package/dist/components/fields/CommandTextArea/caretPosition.js +1 -1
  180. package/dist/components/fields/CommandTextArea/useCaretAnchor.js +1 -1
  181. package/dist/components/fields/DatePicker/DateInput.js +1 -1
  182. package/dist/components/fields/DatePicker/DateInputBase.js +1 -1
  183. package/dist/components/fields/DatePicker/DatePicker.js +1 -1
  184. package/dist/components/fields/DatePicker/DatePickerButton.js +1 -1
  185. package/dist/components/fields/DatePicker/DatePickerElement.js +1 -1
  186. package/dist/components/fields/DatePicker/DatePickerInput.js +1 -1
  187. package/dist/components/fields/DatePicker/DatePickerSegment.js +1 -1
  188. package/dist/components/fields/DatePicker/DateRangePicker.js +1 -1
  189. package/dist/components/fields/DatePicker/DateRangeSeparatedPicker.js +1 -1
  190. package/dist/components/fields/DatePicker/MonthPicker.js +1 -1
  191. package/dist/components/fields/DatePicker/PeriodPicker.js +1 -1
  192. package/dist/components/fields/DatePicker/QuarterPicker.js +1 -1
  193. package/dist/components/fields/DatePicker/TimeInput.js +1 -1
  194. package/dist/components/fields/DatePicker/WeekPicker.js +1 -1
  195. package/dist/components/fields/DatePicker/YearPicker.js +1 -1
  196. package/dist/components/fields/DatePicker/parseDate.js +1 -1
  197. package/dist/components/fields/DatePicker/period.js +1 -1
  198. package/dist/components/fields/DatePicker/props.js +1 -1
  199. package/dist/components/fields/DatePicker/utils.js +1 -1
  200. package/dist/components/fields/FileInput/FileInput.js +1 -1
  201. package/dist/components/fields/FilterListBox/FilterListBox.js +2 -1
  202. package/dist/components/fields/FilterListBox/FilterListBox.js.map +1 -1
  203. package/dist/components/fields/FilterPicker/FilterPicker.js +6 -1
  204. package/dist/components/fields/FilterPicker/FilterPicker.js.map +1 -1
  205. package/dist/components/fields/Input/Input.js +2 -2
  206. package/dist/components/fields/ListBox/DraggableListBox.js +1 -1
  207. package/dist/components/fields/ListBox/ListBox.d.ts +7 -0
  208. package/dist/components/fields/ListBox/ListBox.js +4 -3
  209. package/dist/components/fields/ListBox/ListBox.js.map +1 -1
  210. package/dist/components/fields/ListBoxPopover/ListBoxPopover.js +1 -1
  211. package/dist/components/fields/ListBoxPopover/listNavigation.js +1 -1
  212. package/dist/components/fields/ListBoxPopover/useCompositeFocus.js +1 -1
  213. package/dist/components/fields/NumberInput/NumberInput.js +1 -1
  214. package/dist/components/fields/NumberInput/StepButton.js +1 -1
  215. package/dist/components/fields/PasswordInput/PasswordInput.d.ts +2 -2
  216. package/dist/components/fields/PasswordInput/PasswordInput.js +12 -2
  217. package/dist/components/fields/PasswordInput/PasswordInput.js.map +1 -1
  218. package/dist/components/fields/Picker/Picker.js +6 -1
  219. package/dist/components/fields/Picker/Picker.js.map +1 -1
  220. package/dist/components/fields/RadioGroup/Radio.d.ts +2 -2
  221. package/dist/components/fields/RadioGroup/Radio.js +4 -4
  222. package/dist/components/fields/RadioGroup/Radio.js.map +1 -1
  223. package/dist/components/fields/RadioGroup/RadioGroup.js +1 -1
  224. package/dist/components/fields/RadioGroup/context.js +1 -1
  225. package/dist/components/fields/SearchComboBox/SearchComboBox.js +1 -1
  226. package/dist/components/fields/SearchInput/SearchInput.d.ts +2 -2
  227. package/dist/components/fields/SearchInput/SearchInput.js +17 -4
  228. package/dist/components/fields/SearchInput/SearchInput.js.map +1 -1
  229. package/dist/components/fields/Select/Select.js +1 -1
  230. package/dist/components/fields/Slider/Gradation.js +1 -1
  231. package/dist/components/fields/Slider/HueSlider.js +1 -1
  232. package/dist/components/fields/Slider/RangeSlider.js +1 -1
  233. package/dist/components/fields/Slider/Slider.js +1 -1
  234. package/dist/components/fields/Slider/SliderBase.js +1 -1
  235. package/dist/components/fields/Slider/SliderThumb.js +1 -1
  236. package/dist/components/fields/Slider/SliderTrack.js +1 -1
  237. package/dist/components/fields/Slider/elements.js +1 -1
  238. package/dist/components/fields/Slider/index.js +1 -1
  239. package/dist/components/fields/Switch/Switch.js +1 -1
  240. package/dist/components/fields/TextArea/TextArea.d.ts +2 -2
  241. package/dist/components/fields/TextArea/TextArea.js +12 -5
  242. package/dist/components/fields/TextArea/TextArea.js.map +1 -1
  243. package/dist/components/fields/TextInput/TextInput.d.ts +2 -2
  244. package/dist/components/fields/TextInput/TextInput.js +15 -3
  245. package/dist/components/fields/TextInput/TextInput.js.map +1 -1
  246. package/dist/components/fields/TextInput/TextInputBase.d.ts +17 -1
  247. package/dist/components/fields/TextInput/TextInputBase.js +1 -1
  248. package/dist/components/fields/TextInput/TextInputBase.js.map +1 -1
  249. package/dist/components/fields/TextInput/index.d.ts +1 -1
  250. package/dist/components/fields/TextInputMapper/TextInputMapper.js +1 -1
  251. package/dist/components/fields/{ColorPicker/ColorPickerPanel.js → color/ColorPanel.js} +14 -11
  252. package/dist/components/fields/color/ColorPanel.js.map +1 -0
  253. package/dist/components/fields/color/ColorSwatch.d.ts +22 -0
  254. package/dist/components/fields/color/ColorSwatch.js +58 -0
  255. package/dist/components/fields/color/ColorSwatch.js.map +1 -0
  256. package/dist/components/fields/{ColorPicker → color}/channels.d.ts +1 -1
  257. package/dist/components/fields/{ColorPicker → color}/channels.js +2 -2
  258. package/dist/components/fields/color/channels.js.map +1 -0
  259. package/dist/components/fields/color/color.d.ts +21 -0
  260. package/dist/components/fields/{ColorPicker → color}/color.js +2 -2
  261. package/dist/components/fields/color/color.js.map +1 -0
  262. package/dist/components/fields/color/context.js +20 -0
  263. package/dist/components/fields/color/context.js.map +1 -0
  264. package/dist/components/fields/color/index.d.ts +4 -0
  265. package/dist/components/fields/index.d.ts +10 -4
  266. package/dist/components/form/FieldWrapper/FieldWrapper.js +1 -1
  267. package/dist/components/form/Form/Field.js +1 -1
  268. package/dist/components/form/Form/Form.js +1 -1
  269. package/dist/components/form/Form/ResetButton/ResetButton.js +1 -1
  270. package/dist/components/form/Form/SubmitButton/SubmitButton.js +1 -1
  271. package/dist/components/form/Form/SubmitError.js +1 -1
  272. package/dist/components/form/Form/index.js +1 -1
  273. package/dist/components/form/Form/use-field/use-field-props.js +1 -1
  274. package/dist/components/form/Form/use-field/use-field.js +1 -1
  275. package/dist/components/form/Form/use-form.js +1 -1
  276. package/dist/components/form/Form/validation.js +1 -1
  277. package/dist/components/form/Label.js +1 -1
  278. package/dist/components/form/validation/ValidationIndicator.js +1 -1
  279. package/dist/components/form/validation/resolve-validation-props.js +1 -1
  280. package/dist/components/form/validation/use-validation-props.js +1 -1
  281. package/dist/components/form/wrapper.js +1 -1
  282. package/dist/components/helpers/DisplayTransition/DisplayTransition.js +1 -1
  283. package/dist/components/helpers/IconSwitch/IconSwitch.d.ts +26 -0
  284. package/dist/components/helpers/IconSwitch/IconSwitch.js +1 -1
  285. package/dist/components/layout/Board/Board.d.ts +8 -0
  286. package/dist/components/layout/Board/Board.js +6 -5
  287. package/dist/components/layout/Board/Board.js.map +1 -1
  288. package/dist/components/layout/Board/BoardProvider.js +1 -1
  289. package/dist/components/layout/Board/BoardResponsive.js +1 -1
  290. package/dist/components/layout/Board/Widget.js +1 -1
  291. package/dist/components/layout/Board/WidgetHost.js +1 -1
  292. package/dist/components/layout/Board/board-context.js +1 -1
  293. package/dist/components/layout/Board/board-store.js +1 -1
  294. package/dist/components/layout/Board/grid-core/calculate.js +1 -1
  295. package/dist/components/layout/Board/grid-core/collision.js +1 -1
  296. package/dist/components/layout/Board/grid-core/compactors.js +2 -2
  297. package/dist/components/layout/Board/grid-core/constraints.js +1 -1
  298. package/dist/components/layout/Board/grid-core/group-move.js +84 -4
  299. package/dist/components/layout/Board/grid-core/group-move.js.map +1 -1
  300. package/dist/components/layout/Board/grid-core/layout.js +1 -1
  301. package/dist/components/layout/Board/grid-core/sort.js +1 -1
  302. package/dist/components/layout/Board/index.js +1 -1
  303. package/dist/components/layout/Board/responsive-utils.js +1 -1
  304. package/dist/components/layout/Board/use-board-layout.js +1 -1
  305. package/dist/components/layout/Board/use-board-registry.js +1 -1
  306. package/dist/components/layout/Board/use-board-select-modifier-key.js +1 -1
  307. package/dist/components/layout/Board/use-board-selection.js +1 -1
  308. package/dist/components/layout/Flex.js +1 -1
  309. package/dist/components/layout/Flow.js +1 -1
  310. package/dist/components/layout/Grid.js +1 -1
  311. package/dist/components/layout/Panel.js +1 -1
  312. package/dist/components/layout/Prefix.js +1 -1
  313. package/dist/components/layout/ResizablePanel.js +1 -1
  314. package/dist/components/layout/Space.js +1 -1
  315. package/dist/components/layout/Suffix.js +1 -1
  316. package/dist/components/navigation/Pagination/Pagination.d.ts +9 -0
  317. package/dist/components/navigation/Pagination/Pagination.js +258 -0
  318. package/dist/components/navigation/Pagination/Pagination.js.map +1 -0
  319. package/dist/components/navigation/Pagination/index.d.ts +4 -0
  320. package/dist/components/navigation/Pagination/types.d.ts +81 -0
  321. package/dist/components/navigation/Pagination/use-pagination.d.ts +52 -0
  322. package/dist/components/navigation/Pagination/use-pagination.js +83 -0
  323. package/dist/components/navigation/Pagination/use-pagination.js.map +1 -0
  324. package/dist/components/navigation/Tabs/DraggableTabList.js +1 -1
  325. package/dist/components/navigation/Tabs/TabButton.js +1 -1
  326. package/dist/components/navigation/Tabs/TabDropIndicator.js +1 -1
  327. package/dist/components/navigation/Tabs/TabPanel.js +1 -1
  328. package/dist/components/navigation/Tabs/TabPicker.js +1 -1
  329. package/dist/components/navigation/Tabs/Tabs.js +1 -1
  330. package/dist/components/navigation/Tabs/TabsAction.js +1 -1
  331. package/dist/components/navigation/Tabs/TabsContext.js +1 -1
  332. package/dist/components/navigation/Tabs/popover-placement.js +1 -1
  333. package/dist/components/navigation/Tabs/styled.js +1 -1
  334. package/dist/components/navigation/Tabs/types.js +1 -1
  335. package/dist/components/navigation/Tabs/use-tab-editing.js +1 -1
  336. package/dist/components/navigation/Tabs/use-tab-indicator.js +1 -1
  337. package/dist/components/navigation/index.d.ts +5 -1
  338. package/dist/components/organisms/StatsCard/StatsCard.js +1 -1
  339. package/dist/components/other/Calendar/Calendar.js +1 -1
  340. package/dist/components/other/Calendar/CalendarCell.js +1 -1
  341. package/dist/components/other/Calendar/CalendarGrid.js +1 -1
  342. package/dist/components/other/Calendar/PeriodCalendar.js +1 -1
  343. package/dist/components/other/Calendar/RangeCalendar.js +1 -1
  344. package/dist/components/other/CubeLogo/CubeLogo.js +1 -1
  345. package/dist/components/overlays/AlertDialog/AlertDialog.js +1 -1
  346. package/dist/components/overlays/AlertDialog/AlertDialogApiProvider.js +1 -1
  347. package/dist/components/overlays/AlertDialog/AlertDialogZone.js +1 -1
  348. package/dist/components/overlays/Dialog/Dialog.js +1 -1
  349. package/dist/components/overlays/Dialog/DialogContainer.js +1 -1
  350. package/dist/components/overlays/Dialog/DialogForm.js +1 -1
  351. package/dist/components/overlays/Dialog/DialogTrigger.js +1 -1
  352. package/dist/components/overlays/Dialog/context.js +1 -1
  353. package/dist/components/overlays/Dialog/use-dialog-container.js +1 -1
  354. package/dist/components/overlays/Modal/Modal.js +1 -1
  355. package/dist/components/overlays/Modal/OpenTransitionContext.js +1 -1
  356. package/dist/components/overlays/Modal/Overlay.js +1 -1
  357. package/dist/components/overlays/Modal/Popover.js +1 -1
  358. package/dist/components/overlays/Modal/Tray.js +1 -1
  359. package/dist/components/overlays/Modal/Underlay.js +1 -1
  360. package/dist/components/overlays/Notifications/Notification.js +1 -1
  361. package/dist/components/overlays/Notifications/NotificationAction.js +1 -1
  362. package/dist/components/overlays/Notifications/NotificationCard.js +1 -1
  363. package/dist/components/overlays/Notifications/NotificationContext.js +1 -1
  364. package/dist/components/overlays/Notifications/NotificationItem.js +1 -1
  365. package/dist/components/overlays/Notifications/OverlayContainer.js +1 -1
  366. package/dist/components/overlays/Notifications/OverlayProvider.js +1 -1
  367. package/dist/components/overlays/Notifications/PersistentNotificationsList.js +1 -1
  368. package/dist/components/overlays/Notifications/dismissed-storage.js +1 -1
  369. package/dist/components/overlays/Notifications/format-relative-time.js +1 -1
  370. package/dist/components/overlays/Notifications/index.js +1 -1
  371. package/dist/components/overlays/Notifications/use-notification-state.js +1 -1
  372. package/dist/components/overlays/Notifications/use-notifications.js +1 -1
  373. package/dist/components/overlays/Notifications/use-overlay-timers.js +1 -1
  374. package/dist/components/overlays/Notifications/use-persistent-notifications.js +1 -1
  375. package/dist/components/overlays/Notifications/use-persistent-state.js +1 -1
  376. package/dist/components/overlays/Notifications/use-toast-state.js +1 -1
  377. package/dist/components/overlays/Toast/ToastItem.js +1 -1
  378. package/dist/components/overlays/Toast/index.js +1 -1
  379. package/dist/components/overlays/Toast/useProgressToast.js +1 -1
  380. package/dist/components/overlays/Toast/useToast.js +1 -1
  381. package/dist/components/overlays/Tooltip/Tooltip.js +1 -1
  382. package/dist/components/overlays/Tooltip/TooltipProvider.js +1 -1
  383. package/dist/components/overlays/Tooltip/TooltipTrigger.js +1 -1
  384. package/dist/components/overlays/Tooltip/context.js +1 -1
  385. package/dist/components/portal/Portal.js +1 -1
  386. package/dist/components/portal/PortalProvider.js +1 -1
  387. package/dist/components/portal/usePortal.js +1 -1
  388. package/dist/components/shared/DraggableCollection.js +24 -8
  389. package/dist/components/shared/DraggableCollection.js.map +1 -1
  390. package/dist/components/shared/InvalidIcon.js +1 -1
  391. package/dist/components/shared/ValidIcon.js +1 -1
  392. package/dist/components/status/LoadingAnimation/LoadingAnimation.js +1 -1
  393. package/dist/components/status/Spin/Cube.js +1 -1
  394. package/dist/components/status/Spin/InternalSpinner.js +1 -1
  395. package/dist/components/status/Spin/Spin.js +1 -1
  396. package/dist/components/status/Spin/SpinsContainer.js +1 -1
  397. package/dist/data/item-themes.js +1 -1
  398. package/dist/data/themes.js +1 -1
  399. package/dist/eslint-plugin/defaults.generated.js +223 -5
  400. package/dist/eslint-plugin/defaults.generated.js.map +1 -1
  401. package/dist/eslint-plugin/index.js +1 -1
  402. package/dist/eslint-plugin/rules/no-redundant-default-prop.js +1 -1
  403. package/dist/i18n/I18nProvider.js +1 -1
  404. package/dist/i18n/createFormatter.js +1 -1
  405. package/dist/i18n/index.js +1 -1
  406. package/dist/i18n/instance.js +1 -1
  407. package/dist/i18n/locales/de-DE/uikit.js +36 -1
  408. package/dist/i18n/locales/en-US/uikit.js +36 -1
  409. package/dist/i18n/locales/en-US/uikit.json.d.ts +41 -1
  410. package/dist/i18n/locales/es-ES/uikit.js +36 -1
  411. package/dist/i18n/locales/es-MX/uikit.js +36 -1
  412. package/dist/i18n/locales/fr-FR/uikit.js +36 -1
  413. package/dist/i18n/locales/it-IT/uikit.js +36 -1
  414. package/dist/i18n/locales/ja-JP/uikit.js +36 -1
  415. package/dist/i18n/locales/nb-NO/uikit.js +36 -1
  416. package/dist/i18n/locales/pt-BR/uikit.js +36 -1
  417. package/dist/i18n/locales/pt-PT/uikit.js +36 -1
  418. package/dist/i18n/locales/sv-SE/uikit.js +36 -1
  419. package/dist/i18n/locales/vi-VN/uikit.js +36 -1
  420. package/dist/i18n/locales.js +1 -1
  421. package/dist/i18n/useFormatter.js +1 -1
  422. package/dist/i18n/useI18n.js +1 -1
  423. package/dist/icons/AdjustmentsHorizontalIcon.js +1 -1
  424. package/dist/icons/AdjustmentsIcon.js +1 -1
  425. package/dist/icons/AiIcon.js +1 -1
  426. package/dist/icons/AreaChartIcon.js +1 -1
  427. package/dist/icons/BackwardIcon.js +1 -1
  428. package/dist/icons/BarChartIcon.js +1 -1
  429. package/dist/icons/BellFilledIcon.js +1 -1
  430. package/dist/icons/BellIcon.js +1 -1
  431. package/dist/icons/BooleanIcon.js +1 -1
  432. package/dist/icons/CalendarEditIcon.js +1 -1
  433. package/dist/icons/CalendarIcon.js +1 -1
  434. package/dist/icons/CaretDownIcon.js +1 -1
  435. package/dist/icons/CaretUpIcon.js +1 -1
  436. package/dist/icons/ChartAreaStackedIcon.js +1 -1
  437. package/dist/icons/ChartAreaStackedPercentageIcon.js +1 -1
  438. package/dist/icons/ChartBarGroupedHorizontalIcon.js +1 -1
  439. package/dist/icons/ChartBarGroupedIcon.js +1 -1
  440. package/dist/icons/ChartBarHorizontalIcon.js +1 -1
  441. package/dist/icons/ChartBarLineIcon.js +1 -1
  442. package/dist/icons/ChartBarStackedHorizontalIcon.js +1 -1
  443. package/dist/icons/ChartBarStackedIcon.js +1 -1
  444. package/dist/icons/ChartBarStackedPercentageHorizontalIcon.js +1 -1
  445. package/dist/icons/ChartBarStackedPercentageIcon.js +1 -1
  446. package/dist/icons/ChartBoxPlot2Icon.js +1 -1
  447. package/dist/icons/ChartBoxPlotIcon.js +1 -1
  448. package/dist/icons/ChartBubbleIcon.js +1 -1
  449. package/dist/icons/ChartDonut2Icon.js +1 -1
  450. package/dist/icons/ChartFunnelIcon.js +1 -1
  451. package/dist/icons/ChartHeatmapIcon.js +1 -1
  452. package/dist/icons/ChartKPIIcon.js +1 -1
  453. package/dist/icons/ChartPie2Icon.js +1 -1
  454. package/dist/icons/ChartScatterIcon.js +1 -1
  455. package/dist/icons/CheckCircleFilledIcon.js +1 -1
  456. package/dist/icons/CheckCircleIcon.js +1 -1
  457. package/dist/icons/CheckIcon.js +1 -1
  458. package/dist/icons/CircleFilledIcon.js +1 -1
  459. package/dist/icons/ClearIcon.js +1 -1
  460. package/dist/icons/CloseCircleFilledIcon.js +1 -1
  461. package/dist/icons/CloseCircleIcon.js +1 -1
  462. package/dist/icons/CloseIcon.js +1 -1
  463. package/dist/icons/CodeIcon.js +1 -1
  464. package/dist/icons/ColumnTotalIcon.js +1 -1
  465. package/dist/icons/CopyIcon.js +1 -1
  466. package/dist/icons/CountIcon.js +1 -1
  467. package/dist/icons/CubeIcon.js +1 -1
  468. package/dist/icons/CubePauseIcon.js +1 -1
  469. package/dist/icons/CubePlayIcon.js +1 -1
  470. package/dist/icons/CurrencyDollarIcon.js +1 -1
  471. package/dist/icons/DangerIcon.js +1 -1
  472. package/dist/icons/DashboardIcon.js +1 -1
  473. package/dist/icons/DatabaseIcon.js +1 -1
  474. package/dist/icons/DecimalDecreaseIcon.js +1 -1
  475. package/dist/icons/DecimalIncreaseIcon.js +1 -1
  476. package/dist/icons/DirectionIcon.js +1 -1
  477. package/dist/icons/DonutIcon.js +1 -1
  478. package/dist/icons/DownIcon.js +1 -1
  479. package/dist/icons/EditIcon.js +1 -1
  480. package/dist/icons/ExclamationCircleFilledIcon.js +1 -1
  481. package/dist/icons/ExclamationCircleIcon.js +1 -1
  482. package/dist/icons/ExclamationIcon.js +1 -1
  483. package/dist/icons/EyeIcon.js +1 -1
  484. package/dist/icons/EyeInvisibleIcon.js +1 -1
  485. package/dist/icons/FilterIcon.js +1 -1
  486. package/dist/icons/FolderFilledIcon.js +1 -1
  487. package/dist/icons/FolderIcon.js +1 -1
  488. package/dist/icons/FolderOpenFilledIcon.js +1 -1
  489. package/dist/icons/FolderOpenIcon.js +1 -1
  490. package/dist/icons/ForwardIcon.js +1 -1
  491. package/dist/icons/GripVerticalIcon.js +1 -1
  492. package/dist/icons/HierarchyIcon.js +1 -1
  493. package/dist/icons/HierarchyOpenIcon.js +1 -1
  494. package/dist/icons/Icon.js +1 -1
  495. package/dist/icons/InfoCircleIcon.js +1 -1
  496. package/dist/icons/InfoIcon.js +1 -1
  497. package/dist/icons/KeyIcon.js +1 -1
  498. package/dist/icons/LeftIcon.js +1 -1
  499. package/dist/icons/LineChartIcon.js +1 -1
  500. package/dist/icons/LoadingIcon.js +1 -1
  501. package/dist/icons/LockFilledIcon.js +1 -1
  502. package/dist/icons/LockIcon.js +1 -1
  503. package/dist/icons/MoreIcon.js +1 -1
  504. package/dist/icons/NotAllowedIcon.js +1 -1
  505. package/dist/icons/Number123Icon.js +1 -1
  506. package/dist/icons/NumberIcon.js +1 -1
  507. package/dist/icons/PauseCircleFilledIcon.js +1 -1
  508. package/dist/icons/PauseCircleIcon.js +1 -1
  509. package/dist/icons/PauseIcon.js +1 -1
  510. package/dist/icons/PercentageIcon.js +1 -1
  511. package/dist/icons/PieChartIcon.js +1 -1
  512. package/dist/icons/PipetteIcon.js +1 -1
  513. package/dist/icons/PlayCircleIcon.js +1 -1
  514. package/dist/icons/PlayIcon.js +1 -1
  515. package/dist/icons/PlusIcon.js +1 -1
  516. package/dist/icons/ProgressBarIcon.js +1 -1
  517. package/dist/icons/ReloadIcon.js +1 -1
  518. package/dist/icons/ReportIcon.js +1 -1
  519. package/dist/icons/ReturnIcon.js +1 -1
  520. package/dist/icons/RightIcon.js +1 -1
  521. package/dist/icons/RowTotalsIcon.js +1 -1
  522. package/dist/icons/SchemeIcon.js +1 -1
  523. package/dist/icons/SearchIcon.js +1 -1
  524. package/dist/icons/SemanticQueryIcon.js +1 -1
  525. package/dist/icons/SettingsIcon.js +1 -1
  526. package/dist/icons/ShieldFilledIcon.js +1 -1
  527. package/dist/icons/ShieldIcon.js +1 -1
  528. package/dist/icons/SlashIcon.js +1 -1
  529. package/dist/icons/SparklesIcon.js +1 -1
  530. package/dist/icons/SqlIcon.js +1 -1
  531. package/dist/icons/StatsIcon.js +1 -1
  532. package/dist/icons/StopIcon.js +1 -1
  533. package/dist/icons/StringIcon.js +1 -1
  534. package/dist/icons/SubtotalsIcon.js +1 -1
  535. package/dist/icons/SwitchIcon.js +1 -1
  536. package/dist/icons/TableIcon.js +1 -1
  537. package/dist/icons/ThumbsDownIcon.js +1 -1
  538. package/dist/icons/ThumbsUpIcon.js +1 -1
  539. package/dist/icons/ThunderboltCrossedIcon.js +1 -1
  540. package/dist/icons/ThunderboltFilledIcon.js +1 -1
  541. package/dist/icons/ThunderboltIcon.js +1 -1
  542. package/dist/icons/TimeIcon.js +1 -1
  543. package/dist/icons/TrashIcon.js +1 -1
  544. package/dist/icons/UnlockIcon.js +1 -1
  545. package/dist/icons/UpIcon.js +1 -1
  546. package/dist/icons/UserGroupIcon.js +1 -1
  547. package/dist/icons/UserIcon.js +1 -1
  548. package/dist/icons/UserLockIcon.js +1 -1
  549. package/dist/icons/ViewIcon.js +1 -1
  550. package/dist/icons/WarningFilledIcon.js +1 -1
  551. package/dist/icons/WarningIcon.js +1 -1
  552. package/dist/icons/wrap-icon.js +1 -1
  553. package/dist/index.d.ts +28 -14
  554. package/dist/index.js +15 -7
  555. package/dist/index.js.map +1 -1
  556. package/dist/provider.js +1 -1
  557. package/dist/providers/TrackingProvider.js +1 -1
  558. package/dist/providers/navigationAdapter.default.js +1 -1
  559. package/dist/tokens/base.js +1 -1
  560. package/dist/tokens/colors.js +1 -1
  561. package/dist/tokens/index.js +1 -1
  562. package/dist/tokens/layout.js +1 -1
  563. package/dist/tokens/lazy-styles.js +1 -1
  564. package/dist/tokens/palette-config.js +1 -1
  565. package/dist/tokens/palette.js +1 -1
  566. package/dist/tokens/shadows.js +1 -1
  567. package/dist/tokens/sizes.js +1 -1
  568. package/dist/tokens/spacing.js +1 -1
  569. package/dist/tokens/typography.d.ts +1 -1
  570. package/dist/tokens/typography.js +11 -2
  571. package/dist/tokens/typography.js.map +1 -1
  572. package/dist/utils/ResizeSensor.js +1 -1
  573. package/dist/utils/index.d.ts +1 -0
  574. package/dist/utils/is-dev-env.js +1 -1
  575. package/dist/utils/modules.js +1 -1
  576. package/dist/utils/promise.js +1 -1
  577. package/dist/utils/raf.js +1 -1
  578. package/dist/utils/random.js +1 -1
  579. package/dist/utils/range.js +1 -1
  580. package/dist/utils/react/RenderCache.js +1 -1
  581. package/dist/utils/react/Slots.js +1 -1
  582. package/dist/utils/react/chain.js +1 -1
  583. package/dist/utils/react/forwardRefWithGenerics.js +1 -1
  584. package/dist/utils/react/index.d.ts +1 -0
  585. package/dist/utils/react/index.js +2 -1
  586. package/dist/utils/react/interactions.js +1 -1
  587. package/dist/utils/react/isTextOnly.js +1 -1
  588. package/dist/utils/react/mapProps.js +1 -1
  589. package/dist/utils/react/mergeProps.js +1 -1
  590. package/dist/utils/react/nullableValue.js +1 -1
  591. package/dist/utils/react/resolveIcon.js +1 -1
  592. package/dist/utils/react/sharedStore.js +1 -1
  593. package/dist/utils/react/useBufferedValue.d.ts +56 -0
  594. package/dist/utils/react/useBufferedValue.js +86 -0
  595. package/dist/utils/react/useBufferedValue.js.map +1 -0
  596. package/dist/utils/react/useCombinedRefs.js +1 -1
  597. package/dist/utils/react/useControlledFocusVisible.js +1 -1
  598. package/dist/utils/react/useEventBus.js +1 -1
  599. package/dist/utils/react/useId.js +1 -1
  600. package/dist/utils/react/useIsDarwin.js +1 -1
  601. package/dist/utils/react/useKeySymbols.js +1 -1
  602. package/dist/utils/react/useLayoutEffect.js +1 -1
  603. package/dist/utils/react/useLocalStorage.js +1 -1
  604. package/dist/utils/react/useMergeStyles.js +1 -1
  605. package/dist/utils/react/usePopoverSync.js +1 -1
  606. package/dist/utils/react/useQaProps.js +1 -1
  607. package/dist/utils/react/useViewportSize.js +1 -1
  608. package/dist/utils/react/wrapNodeIfPlain.js +1 -1
  609. package/dist/utils/selection.js +1 -1
  610. package/dist/utils/styles.js +1 -1
  611. package/dist/utils/tree.js +1 -1
  612. package/dist/utils/warnings.js +1 -1
  613. package/dist/version.js +2 -2
  614. package/docs/components/actions/ButtonGroup.md +1 -1
  615. package/docs/components/data/DataTable.md +298 -0
  616. package/docs/components/data/ItemTable.md +984 -0
  617. package/docs/components/fields/ColorInput.md +284 -0
  618. package/docs/components/fields/ColorPicker.md +85 -144
  619. package/docs/components/fields/ColorSwatchGroup.md +206 -0
  620. package/docs/components/fields/FilterPicker.md +1 -1
  621. package/docs/components/fields/ListBox.md +4 -0
  622. package/docs/components/fields/PasswordInput.md +1 -0
  623. package/docs/components/fields/Picker.md +1 -1
  624. package/docs/components/fields/SearchInput.md +1 -0
  625. package/docs/components/fields/TextArea.md +1 -0
  626. package/docs/components/fields/TextInput.md +1 -0
  627. package/docs/components/layout/Board.md +2 -1
  628. package/docs/components/navigation/Pagination.md +245 -0
  629. package/package.json +8 -3
  630. package/dist/components/fields/ColorPicker/ColorPickerPanel.js.map +0 -1
  631. package/dist/components/fields/ColorPicker/channels.js.map +0 -1
  632. package/dist/components/fields/ColorPicker/color.d.ts +0 -15
  633. package/dist/components/fields/ColorPicker/color.js.map +0 -1
  634. package/dist/components/organisms/FileTabs/FileTabs.d.ts +0 -54
  635. package/dist/components/organisms/FileTabs/FileTabs.js +0 -282
  636. package/dist/components/organisms/FileTabs/FileTabs.js.map +0 -1
  637. package/docs/components/organisms/FileTabs.md +0 -51
@@ -0,0 +1,160 @@
1
+
2
+ import "../../content/Item/index.js";
3
+ import { CubeItemProps } from "../../content/Item/Item.js";
4
+ import { Styles } from "@tenphi/tasty";
5
+ import { ReactNode } from "react";
6
+ import { Key as Key$1 } from "@react-types/shared";
7
+
8
+ //#region src/components/data/TableBase/types.d.ts
9
+ type CubeTableSortDirection = 'asc' | 'desc';
10
+ type CubeTableAlign = 'start' | 'center' | 'end';
11
+ type CubeTableRowSection = 'body' | 'pinnedTop' | 'pinnedBottom';
12
+ interface CubeTableCellRange {
13
+ fromRowKey: Key$1;
14
+ toRowKey: Key$1;
15
+ fromColumnKey: string;
16
+ toColumnKey: string;
17
+ }
18
+ interface CubeTableSort {
19
+ /** `key` of the sorted column. */
20
+ columnKey: string;
21
+ direction: CubeTableSortDirection;
22
+ }
23
+ interface CubeTableCellContext<T = any> {
24
+ row: T;
25
+ rowKey: Key$1;
26
+ rowIndex: number;
27
+ columnKey: string;
28
+ columnIndex: number;
29
+ section: CubeTableRowSection;
30
+ /** Whether the ROW is selected, matching `isRowFocused` below. */
31
+ isSelected: boolean;
32
+ /**
33
+ * Not yet wired — always absent.
34
+ *
35
+ * Optional rather than `boolean`, because there is nowhere honest to compute
36
+ * them from where this context is built. Focus lives in the DOM, and drop
37
+ * state comes out of `useDropIndicator`, a hook that can only run inside the
38
+ * row component — so populating either means moving the `render` / `cellStyles`
39
+ * call sites into `TableRow`. Declaring them required and passing `false`
40
+ * would just be a documented lie.
41
+ */
42
+ isRowFocused?: boolean;
43
+ isDropTarget?: boolean;
44
+ }
45
+ interface CubeTableRowContext<T = any> {
46
+ row: T;
47
+ rowKey: Key$1;
48
+ rowIndex: number;
49
+ section: CubeTableRowSection;
50
+ isSelected: boolean;
51
+ /** Not yet wired — always absent. See `CubeTableCellContext` for why. */
52
+ isFocused?: boolean;
53
+ isDropTarget?: boolean;
54
+ }
55
+ interface CubeTableHeaderContext {
56
+ columnKey: string;
57
+ columnIndex: number;
58
+ sort: CubeTableSortDirection | null;
59
+ isSortable: boolean;
60
+ isResizing: boolean;
61
+ width: number | null;
62
+ }
63
+ /**
64
+ * Rich header content. Every slot maps 1:1 onto the `Item` rendered inside the
65
+ * header `<th>`, so a header gets icon / description / tooltip / suffix /
66
+ * actions for free.
67
+ */
68
+ interface CubeTableColumnHeader {
69
+ icon?: CubeItemProps['icon'];
70
+ rightIcon?: CubeItemProps['rightIcon'];
71
+ prefix?: ReactNode;
72
+ suffix?: ReactNode;
73
+ description?: ReactNode;
74
+ descriptionPlacement?: CubeItemProps['descriptionPlacement'];
75
+ /** `true` = auto tooltip when the label is truncated. */
76
+ tooltip?: CubeItemProps['tooltip'];
77
+ actions?: ReactNode;
78
+ /** Hide `actions` until hover/focus. @default true */
79
+ autoHideActions?: boolean;
80
+ theme?: CubeItemProps['theme'];
81
+ /** Full takeover of the header cell's content. Overrides `title` and every slot. */
82
+ render?: (ctx: CubeTableHeaderContext) => ReactNode;
83
+ /** Overrides `column.align` for the header only. */
84
+ align?: CubeTableAlign;
85
+ styles?: Styles;
86
+ }
87
+ interface CubeTableColumn<T = any> {
88
+ /**
89
+ * Column id. Also the default data path — dot notation is supported
90
+ * (`'owner.name'`). Anything beyond a path needs `getValue`.
91
+ */
92
+ key: string;
93
+ /** Header label. Shorthand for `header` with no extra slots. */
94
+ title?: ReactNode;
95
+ header?: CubeTableColumnHeader;
96
+ /**
97
+ * Renders `<th scope="row">` instead of `<td>`, names the row for screen
98
+ * readers, and hosts the `rowLink` anchor. Defaults to the first
99
+ * non-structural column when a row link is present.
100
+ */
101
+ isRowHeader?: boolean;
102
+ /** Fixed width in px. Mutually exclusive with `flex`. */
103
+ width?: number;
104
+ /** Weight for the leftover space. @default 1 when `width` is unset */
105
+ flex?: number;
106
+ /** @default 150 */
107
+ minWidth?: number;
108
+ maxWidth?: number;
109
+ /** Inherits the table's `isResizable`. */
110
+ isResizable?: boolean;
111
+ /** Stick to the start/end edge during horizontal scroll. */
112
+ pin?: 'start' | 'end';
113
+ /** Hide without losing width or order state. */
114
+ isHidden?: boolean;
115
+ /** @default (row) => get(row, key) */
116
+ getValue?: (row: T, rowIndex: number) => unknown;
117
+ /** Raw value → display text. Feeds client sort, client search and TSV copy. */
118
+ format?: (value: any, row: T, rowIndex: number) => string;
119
+ /** Client-side comparator over raw `getValue` results. */
120
+ compare?: (a: any, b: any, rowA: T, rowB: T) => number;
121
+ /** A returned string is wrapped in a truncating `TextItem`. */
122
+ render?: (value: any, row: T, rowIndex: number, ctx: CubeTableCellContext<T>) => ReactNode;
123
+ cellStyles?: Styles | ((ctx: CubeTableCellContext<T>) => Styles | undefined);
124
+ cellProps?: (ctx: CubeTableCellContext<T>) => Record<string, any> | undefined;
125
+ align?: CubeTableAlign;
126
+ /** @default true unless the table's `sortMode` is `'off'` */
127
+ isSortable?: boolean;
128
+ /** Two-state cycling (asc ↔ desc), never back to unsorted. @default false */
129
+ disallowSortRemoval?: boolean;
130
+ /** Include in the built-in client search. @default true */
131
+ isSearchable?: boolean;
132
+ /** Include in TSV copy. @default true */
133
+ isCopyable?: boolean;
134
+ /** Wrap text and let the row grow to fit. */
135
+ autoHeight?: boolean;
136
+ /** Consumer-owned bag. Never reaches the DOM. */
137
+ meta?: Record<string, unknown>;
138
+ }
139
+ /**
140
+ * How a refresh over an existing result is presented.
141
+ *
142
+ * - `overlay` — keep the previous rows visible, dimmed, behind a spinner. A
143
+ * server page or a re-sort never blanks the table.
144
+ * - `skeleton` — discard the previous rows and show placeholders.
145
+ * - `none` — no visuals beyond `aria-busy`; the page owns the indicator.
146
+ */
147
+ type CubeTableLoadingIndicator = 'overlay' | 'skeleton' | 'none';
148
+ type CubeTableSelectionMode = 'none' | 'single' | 'multiple';
149
+ /**
150
+ * What the header checkbox acts on.
151
+ *
152
+ * - `page` — the rows on the current page.
153
+ * - `filtered` — every row passing the current search/filter, across pages.
154
+ * - `all` — emits the `'all'` sentinel, meaning "everything, including rows the
155
+ * client has not loaded". The consumer decides what that means for its query.
156
+ */
157
+ type CubeTableSelectAllMode = 'page' | 'filtered' | 'all';
158
+ //#endregion
159
+ export { CubeTableAlign, CubeTableCellContext, CubeTableCellRange, CubeTableColumn, CubeTableColumnHeader, CubeTableHeaderContext, CubeTableLoadingIndicator, CubeTableRowContext, CubeTableRowSection, CubeTableSelectAllMode, CubeTableSelectionMode, CubeTableSort, CubeTableSortDirection };
160
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,31 @@
1
+ /** @license MIT | @cube-dev/ui-kit v0.157.1 | Cube Dev Team */
2
+ //#region src/components/data/TableBase/types.ts
3
+ /**
4
+ * `asc | desc` rather than React Aria's `ascending | descending`: we do not use
5
+ * `useTableState`, so there is no `SortDescriptor` interop to preserve, and
6
+ * every consumer and server query parameter already speaks `asc|desc`.
7
+ * `aria-sort` is a one-line map in the header cell.
8
+ */
9
+ /**
10
+ * A rectangular block of cells, stored as two opposite corners.
11
+ *
12
+ * Corners rather than a set of keys so the selection survives a re-sort or a
13
+ * page change the way a keyed row selection does: "the block between these two
14
+ * cells" is re-resolved against the current order every render.
15
+ */
16
+ /**
17
+ * The key a cell range identifies a row by.
18
+ *
19
+ * Not the consumer's row key: a pinned total is commonly the SAME record at the
20
+ * top and the bottom (`id: 'total'`), and one flat key space collapsed the two
21
+ * into whichever `indexOf` found first — so a range aimed at the footer total
22
+ * resolved against the header one. The section is part of the identity here,
23
+ * and only here; `ctx.rowKey` stays the consumer's own.
24
+ */
25
+ function selectionRowKey(section, rowKey) {
26
+ return section === "body" ? rowKey : `${section}:${rowKey}`;
27
+ }
28
+
29
+ //#endregion
30
+ export { selectionRowKey };
31
+ //# sourceMappingURL=types.js.map
@@ -0,0 +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';\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 maps 1:1 onto the `Item` rendered inside the\n * header `<th>`, so a header gets icon / description / tooltip / suffix /\n * actions for free.\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 theme?: CubeItemProps['theme'];\n /** Full takeover of the header cell's content. Overrides `title` and every slot. */\n render?: (ctx: CubeTableHeaderContext) => ReactNode;\n /** Overrides `column.align` for the header only. */\n align?: CubeTableAlign;\n styles?: Styles;\n}\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 /** 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 /* behaviour */\n align?: CubeTableAlign;\n /** @default true unless the table's `sortMode` is `'off'` */\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":";;;;;;;;;;;;;;;;;;;;;;;;AA+BA,SAAgB,gBACd,SACA,QACK;AACL,QAAO,YAAY,SAAS,SAAS,GAAG,QAAQ,GAAG"}
@@ -0,0 +1,3 @@
1
+
2
+ import "./types.js";
3
+ import { Key as Key$1 } from "@react-types/shared";
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-cell-selection.js","names":[],"sources":["../../../../src/components/data/TableBase/use-cell-selection.ts"],"sourcesContent":["import { useControlledState } from '@react-stately/utils';\nimport { useCallback, useMemo, useRef } from 'react';\n\nimport { useEvent } from '../../../_internal/hooks';\n\nimport type { Key } from '@react-types/shared';\nimport type { CubeResolvedColumn, CubeTableCellRange } from './types';\n\nexport type CubeTableCellSelectionMode = 'none' | 'cell' | 'range';\n\nexport interface UseCellSelectionOptions<T> {\n /** @default 'range' */\n mode?: CubeTableCellSelectionMode;\n columns: CubeResolvedColumn<T>[];\n /**\n * Every row a range can reach, in the order they appear on screen — pinned\n * rows included. ag-grid excludes them (`!rowNode.rowPinned`), and we do not:\n * a total is a figure like any other, and selecting a column of revenue only\n * to have to copy its sum separately is the wrong trade.\n *\n * A pinned row is still not reachable by dragging THROUGH it — see\n * `TableView`'s pointer handlers for why.\n */\n rows: readonly T[];\n /**\n * Parallel to `rows`. Supplied rather than derived, so it cannot disagree with\n * the keys the renderer stamps on the cells — when the two drifted, every\n * range silently resolved to nothing.\n */\n rowKeys: readonly Key[];\n /**\n * Vetoes individual cells. A pinned total's label cell is the motivating\n * case: \"Total\" is a caption for the row, not a figure, and there is nothing\n * useful to do with it selected.\n *\n * A vetoed cell cannot anchor or receive a range, never highlights, and copies\n * as an empty field so a block spanning it keeps its shape.\n */\n isCellSelectable?: (row: T, rowKey: Key, columnKey: string) => boolean;\n range?: CubeTableCellRange | null;\n defaultRange?: CubeTableCellRange | null;\n onRangeChange?: (range: CubeTableCellRange | null) => void;\n}\n\nconst cellKey = (rowKey: Key, columnKey: string) => `${rowKey}\u0000${columnKey}`;\n\n/**\n * Rectangular cell selection.\n *\n * A result grid is read by cell, not by row: the thing a user wants out of it is\n * a figure, or a block of figures to paste somewhere else. So a click selects a\n * cell, shift-click and drag grow a rectangle, and ⌘/Ctrl+C writes the rectangle\n * out as TSV.\n *\n * The range is stored as two corners rather than a set of keys, so it survives\n * sorting and paging the way a keyed row selection does — and normalizing it\n * against the CURRENT row and column order is what makes \"the block between\n * these two cells\" keep meaning that after a re-sort.\n *\n * Structural columns (the row number, the checkbox, the row-menu button) can\n * never enter a range: they are chrome, and copying them would put the grid's\n * own furniture into the user's spreadsheet.\n */\nexport function useCellSelection<T>({\n mode = 'range',\n columns,\n rows,\n rowKeys,\n isCellSelectable,\n range: rangeProp,\n defaultRange,\n onRangeChange,\n}: UseCellSelectionOptions<T>) {\n const [range, setRange] = useControlledState<CubeTableCellRange | null>(\n rangeProp as CubeTableCellRange | null,\n defaultRange ?? null,\n onRangeChange as (value: CubeTableCellRange | null) => void,\n );\n\n // The press that started a drag. A ref rather than state: it is written and\n // read inside one pointer gesture, and re-rendering on every `pointerenter`\n // would drop frames across a wide grid.\n const anchorRef = useRef<CubeTableCellRange | null>(null);\n const isDraggingRef = useRef(false);\n\n const selectableColumns = useMemo(\n () => columns.filter((column) => !column.isStructural),\n [columns],\n );\n\n const isEnabled = mode !== 'none';\n\n /**\n * The range's corners resolved against the current order, as index bounds.\n * `null` when either corner has scrolled out of the data — a range whose\n * anchor no longer exists is not a range.\n */\n const bounds = useMemo(() => {\n if (!isEnabled || !range) return null;\n\n const rowFrom = rowKeys.indexOf(range.fromRowKey);\n const rowTo = rowKeys.indexOf(range.toRowKey);\n const colFrom = selectableColumns.findIndex(\n (column) => column.key === range.fromColumnKey,\n );\n const colTo = selectableColumns.findIndex(\n (column) => column.key === range.toColumnKey,\n );\n\n if (rowFrom === -1 || rowTo === -1 || colFrom === -1 || colTo === -1) {\n return null;\n }\n\n return {\n rowStart: Math.min(rowFrom, rowTo),\n rowEnd: Math.max(rowFrom, rowTo),\n colStart: Math.min(colFrom, colTo),\n colEnd: Math.max(colFrom, colTo),\n };\n }, [isEnabled, range, rowKeys, selectableColumns]);\n\n /**\n * Every selected cell, precomputed. A range spanning a full page is tens of\n * thousands of cells and every one of them asks whether it is selected on\n * every render, so this has to be a lookup rather than four comparisons.\n */\n const selectedKeys = useMemo(() => {\n const keys = new Set<string>();\n\n if (!bounds) return keys;\n\n for (let r = bounds.rowStart; r <= bounds.rowEnd; r++) {\n for (let c = bounds.colStart; c <= bounds.colEnd; c++) {\n const columnKey = selectableColumns[c].key;\n\n if (isCellSelectable?.(rows[r], rowKeys[r], columnKey) === false) {\n continue;\n }\n\n keys.add(cellKey(rowKeys[r], columnKey));\n }\n }\n\n return keys;\n }, [bounds, rows, rowKeys, selectableColumns, isCellSelectable]);\n\n // `useCallback`, not `useEvent`: the renderer asks this DURING render, once\n // per cell. `useEvent` keeps its closure current through a layout effect, so a\n // render-time reader sees the PREVIOUS render's answer — the highlight then\n // trails the selection by one commit and a cleared range stays painted.\n const isSelected = useCallback(\n (rowKey: Key, columnKey: string) =>\n selectedKeys.has(cellKey(rowKey, columnKey)),\n [selectedKeys],\n );\n\n const isSelectableColumn = useEvent((columnKey: string) =>\n selectableColumns.some((column) => column.key === columnKey),\n );\n\n /**\n * Whether a cell can take part at all — asked by the renderer before it wires\n * up any pointer handler, so a vetoed cell is inert rather than merely\n * unpainted.\n */\n const canSelectCell = useEvent((rowKey: Key, columnKey: string) => {\n if (!isEnabled || !isSelectableColumn(columnKey)) return false;\n if (!isCellSelectable) return true;\n\n const index = rowKeys.indexOf(rowKey);\n\n return index === -1 || isCellSelectable(rows[index], rowKey, columnKey);\n });\n\n const select = useEvent((rowKey: Key, columnKey: string) => {\n if (!canSelectCell(rowKey, columnKey)) return;\n\n const next: CubeTableCellRange = {\n fromRowKey: rowKey,\n toRowKey: rowKey,\n fromColumnKey: columnKey,\n toColumnKey: columnKey,\n };\n\n anchorRef.current = next;\n setRange(next);\n });\n\n /** Grow the range from the standing anchor. Shift-click and drag both land here. */\n const extendTo = useEvent((rowKey: Key, columnKey: string) => {\n if (mode !== 'range' || !canSelectCell(rowKey, columnKey)) return;\n\n // Shift-clicking with nothing selected yet behaves as a plain click, which\n // is what every grid and every file manager does.\n const anchor = anchorRef.current ?? range;\n\n if (!anchor) {\n select(rowKey, columnKey);\n\n return;\n }\n\n setRange({\n fromRowKey: anchor.fromRowKey,\n toRowKey: rowKey,\n fromColumnKey: anchor.fromColumnKey,\n toColumnKey: columnKey,\n });\n });\n\n const clear = useEvent(() => {\n anchorRef.current = null;\n if (range) setRange(null);\n });\n\n /**\n * The selection as a grid of display strings, unescaped.\n *\n * A matrix rather than a formatted blob, because the clipboard needs the same\n * block in two formats and re-parsing one to build the other does not\n * survive contact with the data: a value carrying a tab is RFC-4180 quoted\n * for the TSV, and splitting that back apart on tabs tore the cell in half.\n * Both formats are built from this instead.\n *\n * Values come from the same display-text pipeline client sort and search use,\n * so what lands on the clipboard is what was on screen: a formatted currency\n * stays formatted, and a value with no text representation copies as empty\n * rather than as `[object Object]`.\n */\n const getSelectionMatrix = useEvent(\n (\n getText: (\n column: CubeResolvedColumn<T>,\n row: T,\n rowIndex: number,\n ) => string,\n getHeader?: (column: CubeResolvedColumn<T>) => string,\n ) => {\n if (!bounds) return [];\n\n const cols = selectableColumns.slice(bounds.colStart, bounds.colEnd + 1);\n const matrix: string[][] = [];\n\n if (getHeader) matrix.push(cols.map((column) => getHeader(column)));\n\n for (let r = bounds.rowStart; r <= bounds.rowEnd; r++) {\n matrix.push(\n cols.map((column) =>\n selectedKeys.has(cellKey(rowKeys[r], column.key))\n ? getText(column, rows[r], r)\n : '',\n ),\n );\n }\n\n return matrix;\n },\n );\n\n return {\n mode,\n isEnabled,\n range: bounds ? range : null,\n /** Cells in the range, for `aria-selected` and the highlight. */\n isSelected,\n /** `true` once the range covers more than one cell. */\n hasRange: selectedKeys.size > 1,\n cellCount: selectedKeys.size,\n canSelectCell,\n select,\n extendTo,\n clear,\n getSelectionMatrix,\n anchorRef,\n isDraggingRef,\n };\n}\n\n/**\n * The matrix as tab-separated values — the format Excel and Sheets both paste\n * as a grid rather than as one run of text.\n *\n * RFC-4180 quoting: a value carrying a tab or a newline would otherwise break\n * the grid apart on paste, one cell becoming two or one row becoming two.\n */\nexport function toTsv(matrix: string[][]) {\n return matrix.map((row) => row.map(quote).join('\\t')).join('\\n');\n}\n\nfunction quote(value: string) {\n if (!/[\\t\\n\\r\"]/.test(value)) return value;\n\n return `\"${value.replace(/\"/g, '\"\"')}\"`;\n}\n"],"mappings":";;;;;;AA4CA,MAAM,WAAW,QAAa,cAAsB,GAAG,OAAO,GAAG;;;;;;;;;;;;;;;;;;AAmBjE,SAAgB,iBAAoB,EAClC,OAAO,SACP,SACA,MACA,SACA,kBACA,OAAO,WACP,cACA,iBAC6B;CAC7B,MAAM,CAAC,OAAO,YAAY,mBACxB,WACA,gBAAgB,MAChB,cACD;CAKD,MAAM,YAAY,OAAkC,KAAK;CACzD,MAAM,gBAAgB,OAAO,MAAM;CAEnC,MAAM,oBAAoB,cAClB,QAAQ,QAAQ,WAAW,CAAC,OAAO,aAAa,EACtD,CAAC,QAAQ,CACV;CAED,MAAM,YAAY,SAAS;;;;;;CAO3B,MAAM,SAAS,cAAc;AAC3B,MAAI,CAAC,aAAa,CAAC,MAAO,QAAO;EAEjC,MAAM,UAAU,QAAQ,QAAQ,MAAM,WAAW;EACjD,MAAM,QAAQ,QAAQ,QAAQ,MAAM,SAAS;EAC7C,MAAM,UAAU,kBAAkB,WAC/B,WAAW,OAAO,QAAQ,MAAM,cAClC;EACD,MAAM,QAAQ,kBAAkB,WAC7B,WAAW,OAAO,QAAQ,MAAM,YAClC;AAED,MAAI,YAAY,MAAM,UAAU,MAAM,YAAY,MAAM,UAAU,GAChE,QAAO;AAGT,SAAO;GACL,UAAU,KAAK,IAAI,SAAS,MAAM;GAClC,QAAQ,KAAK,IAAI,SAAS,MAAM;GAChC,UAAU,KAAK,IAAI,SAAS,MAAM;GAClC,QAAQ,KAAK,IAAI,SAAS,MAAM;GACjC;IACA;EAAC;EAAW;EAAO;EAAS;EAAkB,CAAC;;;;;;CAOlD,MAAM,eAAe,cAAc;EACjC,MAAM,uBAAO,IAAI,KAAa;AAE9B,MAAI,CAAC,OAAQ,QAAO;AAEpB,OAAK,IAAI,IAAI,OAAO,UAAU,KAAK,OAAO,QAAQ,IAChD,MAAK,IAAI,IAAI,OAAO,UAAU,KAAK,OAAO,QAAQ,KAAK;GACrD,MAAM,YAAY,kBAAkB,GAAG;AAEvC,OAAI,mBAAmB,KAAK,IAAI,QAAQ,IAAI,UAAU,KAAK,MACzD;AAGF,QAAK,IAAI,QAAQ,QAAQ,IAAI,UAAU,CAAC;;AAI5C,SAAO;IACN;EAAC;EAAQ;EAAM;EAAS;EAAmB;EAAiB,CAAC;CAMhE,MAAM,aAAa,aAChB,QAAa,cACZ,aAAa,IAAI,QAAQ,QAAQ,UAAU,CAAC,EAC9C,CAAC,aAAa,CACf;CAED,MAAM,qBAAqB,UAAU,cACnC,kBAAkB,MAAM,WAAW,OAAO,QAAQ,UAAU,CAC7D;;;;;;CAOD,MAAM,gBAAgB,UAAU,QAAa,cAAsB;AACjE,MAAI,CAAC,aAAa,CAAC,mBAAmB,UAAU,CAAE,QAAO;AACzD,MAAI,CAAC,iBAAkB,QAAO;EAE9B,MAAM,QAAQ,QAAQ,QAAQ,OAAO;AAErC,SAAO,UAAU,MAAM,iBAAiB,KAAK,QAAQ,QAAQ,UAAU;GACvE;CAEF,MAAM,SAAS,UAAU,QAAa,cAAsB;AAC1D,MAAI,CAAC,cAAc,QAAQ,UAAU,CAAE;EAEvC,MAAM,OAA2B;GAC/B,YAAY;GACZ,UAAU;GACV,eAAe;GACf,aAAa;GACd;AAED,YAAU,UAAU;AACpB,WAAS,KAAK;GACd;;CAGF,MAAM,WAAW,UAAU,QAAa,cAAsB;AAC5D,MAAI,SAAS,WAAW,CAAC,cAAc,QAAQ,UAAU,CAAE;EAI3D,MAAM,SAAS,UAAU,WAAW;AAEpC,MAAI,CAAC,QAAQ;AACX,UAAO,QAAQ,UAAU;AAEzB;;AAGF,WAAS;GACP,YAAY,OAAO;GACnB,UAAU;GACV,eAAe,OAAO;GACtB,aAAa;GACd,CAAC;GACF;CAEF,MAAM,QAAQ,eAAe;AAC3B,YAAU,UAAU;AACpB,MAAI,MAAO,UAAS,KAAK;GACzB;;;;;;;;;;;;;;;CAgBF,MAAM,qBAAqB,UAEvB,SAKA,cACG;AACH,MAAI,CAAC,OAAQ,QAAO,EAAE;EAEtB,MAAM,OAAO,kBAAkB,MAAM,OAAO,UAAU,OAAO,SAAS,EAAE;EACxE,MAAM,SAAqB,EAAE;AAE7B,MAAI,UAAW,QAAO,KAAK,KAAK,KAAK,WAAW,UAAU,OAAO,CAAC,CAAC;AAEnE,OAAK,IAAI,IAAI,OAAO,UAAU,KAAK,OAAO,QAAQ,IAChD,QAAO,KACL,KAAK,KAAK,WACR,aAAa,IAAI,QAAQ,QAAQ,IAAI,OAAO,IAAI,CAAC,GAC7C,QAAQ,QAAQ,KAAK,IAAI,EAAE,GAC3B,GACL,CACF;AAGH,SAAO;GAEV;AAED,QAAO;EACL;EACA;EACA,OAAO,SAAS,QAAQ;EAExB;EAEA,UAAU,aAAa,OAAO;EAC9B,WAAW,aAAa;EACxB;EACA;EACA;EACA;EACA;EACA;EACA;EACD;;;;;;;;;AAUH,SAAgB,MAAM,QAAoB;AACxC,QAAO,OAAO,KAAK,QAAQ,IAAI,IAAI,MAAM,CAAC,KAAK,IAAK,CAAC,CAAC,KAAK,KAAK;;AAGlE,SAAS,MAAM,OAAe;AAC5B,KAAI,CAAC,YAAY,KAAK,MAAM,CAAE,QAAO;AAErC,QAAO,IAAI,MAAM,QAAQ,MAAM,OAAK,CAAC"}
@@ -0,0 +1,35 @@
1
+ /** @license MIT | @cube-dev/ui-kit v0.157.1 | Cube Dev Team */
2
+ import { useLayoutEffect, useState } from "react";
3
+
4
+ //#region src/components/data/TableBase/use-container-width.ts
5
+ /**
6
+ * Content-box width of the scroller, measured before paint and kept current
7
+ * with a `ResizeObserver`.
8
+ *
9
+ * Takes the **element**, not a ref: in the virtualized path the scroller is
10
+ * created by Virtuoso and handed over through a callback after mount, so a hook
11
+ * that peeked at `ref.current` once would see `null` and never measure
12
+ * anything — leaving every column unsized.
13
+ *
14
+ * `useLayoutEffect` rather than `useEffect` on purpose: column widths are
15
+ * derived from this value, so measuring after paint would show one frame of
16
+ * min-width columns before they snap to their real size.
17
+ */
18
+ function useContainerWidth(element) {
19
+ const [width, setWidth] = useState(null);
20
+ useLayoutEffect(() => {
21
+ if (!element || !(element instanceof Element)) return;
22
+ const measure = () => {
23
+ setWidth((current) => current === element.clientWidth ? current : element.clientWidth);
24
+ };
25
+ measure();
26
+ const observer = new ResizeObserver(measure);
27
+ observer.observe(element);
28
+ return () => observer.disconnect();
29
+ }, [element]);
30
+ return width;
31
+ }
32
+
33
+ //#endregion
34
+ export { useContainerWidth };
35
+ //# sourceMappingURL=use-container-width.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-container-width.js","names":[],"sources":["../../../../src/components/data/TableBase/use-container-width.ts"],"sourcesContent":["import { useLayoutEffect, useState } from 'react';\n\n/**\n * Content-box width of the scroller, measured before paint and kept current\n * with a `ResizeObserver`.\n *\n * Takes the **element**, not a ref: in the virtualized path the scroller is\n * created by Virtuoso and handed over through a callback after mount, so a hook\n * that peeked at `ref.current` once would see `null` and never measure\n * anything — leaving every column unsized.\n *\n * `useLayoutEffect` rather than `useEffect` on purpose: column widths are\n * derived from this value, so measuring after paint would show one frame of\n * min-width columns before they snap to their real size.\n */\nexport function useContainerWidth(element: HTMLElement | null): number | null {\n const [width, setWidth] = useState<number | null>(null);\n\n useLayoutEffect(() => {\n // Virtuoso's `scrollerRef` reports `HTMLElement | Window | null`, and\n // `ResizeObserver.observe` throws on anything that is not an Element.\n if (!element || !(element instanceof Element)) return;\n\n const measure = () => {\n // `clientWidth` excludes the vertical scrollbar, which is what we want:\n // the columns must fit the content box, not the border box, or a\n // scrollbar appearing would push the last column out and bring a\n // horizontal scrollbar with it.\n setWidth((current) =>\n current === element.clientWidth ? current : element.clientWidth,\n );\n };\n\n measure();\n\n const observer = new ResizeObserver(measure);\n\n observer.observe(element);\n\n return () => observer.disconnect();\n }, [element]);\n\n return width;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAeA,SAAgB,kBAAkB,SAA4C;CAC5E,MAAM,CAAC,OAAO,YAAY,SAAwB,KAAK;AAEvD,uBAAsB;AAGpB,MAAI,CAAC,WAAW,EAAE,mBAAmB,SAAU;EAE/C,MAAM,gBAAgB;AAKpB,aAAU,YACR,YAAY,QAAQ,cAAc,UAAU,QAAQ,YACrD;;AAGH,WAAS;EAET,MAAM,WAAW,IAAI,eAAe,QAAQ;AAE5C,WAAS,QAAQ,QAAQ;AAEzB,eAAa,SAAS,YAAY;IACjC,CAAC,QAAQ,CAAC;AAEb,QAAO"}
@@ -0,0 +1,90 @@
1
+ /** @license MIT | @cube-dev/ui-kit v0.157.1 | Cube Dev Team */
2
+ import { useLayoutEffect, useRef } from "react";
3
+
4
+ //#region src/components/data/TableBase/use-row-move-animation.ts
5
+ /** Matches ag-grid's row animation closely enough to feel familiar. */
6
+ const ROW_MOVE_DURATION = 120;
7
+ /** Matches `DisplayTransition`'s check, which is the kit's existing precedent. */
8
+ function prefersReducedMotion() {
9
+ return typeof window !== "undefined" && Boolean(window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches);
10
+ }
11
+ /**
12
+ * Slides rows to their new positions when the order changes.
13
+ *
14
+ * FLIP: the previous commit's positions are the First, this commit's are the
15
+ * Last, and each row is Inverted with a `translateY` back to where it was and
16
+ * then Played to zero. The DOM is already correct the whole time — only the
17
+ * paint is behind — so a test or a screen reader sees the new order
18
+ * immediately, and nothing has to be delayed or double-rendered.
19
+ *
20
+ * Sorting a table otherwise teleports every row at once, and the eye has no way
21
+ * to follow a particular one to where it went. The whole value is in tracking
22
+ * one row, which is why this animates positions rather than cross-fading.
23
+ *
24
+ * **Only a reorder**, and only rows that were already on screen. If the rows
25
+ * common to both commits are in the same relative order, nothing animates,
26
+ * however much their positions moved — that is a relayout, not a reorder, and
27
+ * it covers the initial mount (widths resolving, the virtualizer measuring, a
28
+ * scrollbar appearing), a container resize, and a filter that only removes
29
+ * rows.
30
+ *
31
+ * Scrolling is not movement either, and that falls out of measuring `offsetTop`
32
+ * rather than viewport coordinates: it is relative to the scroller's content,
33
+ * so it does not change as the content scrolls past.
34
+ */
35
+ function useRowMoveAnimation({ isEnabled, bodyRef, duration = ROW_MOVE_DURATION }) {
36
+ const previousRef = useRef(null);
37
+ const previousOrderRef = useRef([]);
38
+ useLayoutEffect(() => {
39
+ const body = bodyRef.current;
40
+ if (!body) return;
41
+ const rows = Array.from(body.querySelectorAll("tr[data-element=\"Row\"][data-key]:not([data-pinned])"));
42
+ const next = /* @__PURE__ */ new Map();
43
+ for (const row of rows) next.set(row.dataset.key, row.offsetTop);
44
+ const previous = previousRef.current;
45
+ const previousOrder = previousOrderRef.current;
46
+ const nextOrder = rows.map((row) => row.dataset.key);
47
+ previousRef.current = next;
48
+ previousOrderRef.current = nextOrder;
49
+ if (!isEnabled || prefersReducedMotion() || !previous) return;
50
+ const stillHere = new Set(nextOrder);
51
+ const before = previousOrder.filter((key) => stillHere.has(key));
52
+ const after = nextOrder.filter((key) => previous.has(key));
53
+ if (!(before.length !== after.length || before.some((key, index) => key !== after[index]))) return;
54
+ const moved = [];
55
+ for (const row of rows) {
56
+ const from = previous.get(row.dataset.key);
57
+ if (from === void 0) continue;
58
+ const delta = from - next.get(row.dataset.key);
59
+ if (delta !== 0) moved.push({
60
+ row,
61
+ delta
62
+ });
63
+ }
64
+ if (!moved.length) return;
65
+ for (const { row, delta } of moved) {
66
+ row.style.transition = "none";
67
+ row.style.transform = `translateY(${delta}px)`;
68
+ }
69
+ body.offsetHeight;
70
+ for (const { row } of moved) {
71
+ row.style.transition = `transform ${duration}ms ease-out`;
72
+ row.style.transform = "";
73
+ }
74
+ const clear = () => {
75
+ for (const { row } of moved) {
76
+ row.style.transition = "";
77
+ row.style.transform = "";
78
+ }
79
+ };
80
+ const timer = setTimeout(clear, duration);
81
+ return () => {
82
+ clearTimeout(timer);
83
+ clear();
84
+ };
85
+ });
86
+ }
87
+
88
+ //#endregion
89
+ export { useRowMoveAnimation };
90
+ //# sourceMappingURL=use-row-move-animation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-row-move-animation.js","names":[],"sources":["../../../../src/components/data/TableBase/use-row-move-animation.ts"],"sourcesContent":["import { useLayoutEffect, useRef } from 'react';\n\nimport type { RefObject } from 'react';\n\n/** Matches ag-grid's row animation closely enough to feel familiar. */\nexport const ROW_MOVE_DURATION = 120;\n\nexport interface UseRowMoveAnimationOptions {\n isEnabled: boolean;\n /** The `<tbody>` the rows live in. */\n bodyRef: RefObject<HTMLTableSectionElement | null>;\n /** @default 120 */\n duration?: number;\n}\n\n/** Matches `DisplayTransition`'s check, which is the kit's existing precedent. */\nfunction prefersReducedMotion() {\n return (\n typeof window !== 'undefined' &&\n Boolean(window.matchMedia?.('(prefers-reduced-motion: reduce)')?.matches)\n );\n}\n\n/**\n * Slides rows to their new positions when the order changes.\n *\n * FLIP: the previous commit's positions are the First, this commit's are the\n * Last, and each row is Inverted with a `translateY` back to where it was and\n * then Played to zero. The DOM is already correct the whole time — only the\n * paint is behind — so a test or a screen reader sees the new order\n * immediately, and nothing has to be delayed or double-rendered.\n *\n * Sorting a table otherwise teleports every row at once, and the eye has no way\n * to follow a particular one to where it went. The whole value is in tracking\n * one row, which is why this animates positions rather than cross-fading.\n *\n * **Only a reorder**, and only rows that were already on screen. If the rows\n * common to both commits are in the same relative order, nothing animates,\n * however much their positions moved — that is a relayout, not a reorder, and\n * it covers the initial mount (widths resolving, the virtualizer measuring, a\n * scrollbar appearing), a container resize, and a filter that only removes\n * rows.\n *\n * Scrolling is not movement either, and that falls out of measuring `offsetTop`\n * rather than viewport coordinates: it is relative to the scroller's content,\n * so it does not change as the content scrolls past.\n */\nexport function useRowMoveAnimation({\n isEnabled,\n bodyRef,\n duration = ROW_MOVE_DURATION,\n}: UseRowMoveAnimationOptions) {\n const previousRef = useRef<Map<string, number> | null>(null);\n const previousOrderRef = useRef<string[]>([]);\n\n // No dependency array: the previous positions have to be captured after every\n // commit, because any of them may turn out to be the one a reorder starts\n // from.\n useLayoutEffect(() => {\n const body = bodyRef.current;\n\n if (!body) return;\n\n const rows = Array.from(\n body.querySelectorAll<HTMLTableRowElement>(\n // Pinned rows are excluded by the selector rather than filtered later:\n // they do not take part in the order, so they never move.\n 'tr[data-element=\"Row\"][data-key]:not([data-pinned])',\n ),\n );\n\n // `offsetTop`, not `getBoundingClientRect()`: it is relative to the\n // scroller, so scrolling does not read as movement. Otherwise every scroll\n // tick would look like a reorder of the whole page.\n const next = new Map<string, number>();\n\n for (const row of rows) next.set(row.dataset.key!, row.offsetTop);\n\n const previous = previousRef.current;\n const previousOrder = previousOrderRef.current;\n const nextOrder = rows.map((row) => row.dataset.key!);\n\n previousRef.current = next;\n previousOrderRef.current = nextOrder;\n\n // Checked per commit rather than once: the setting can change mid-session,\n // and the position bookkeeping above must keep running either way so the\n // animation is correct the moment it is turned back on.\n if (!isEnabled || prefersReducedMotion() || !previous) return;\n\n // Animate a REORDER, never a relayout.\n //\n // Positions shift for all sorts of reasons that are not a row moving: the\n // column widths resolving after the first measure, the virtualizer taking\n // its measurements, a scrollbar appearing, a font landing, the container\n // being resized. Every one of those happens on the second commit of a\n // normal mount — so keying off \"an offset changed\" animated the table into\n // existence on load, which is exactly what a load should not do.\n //\n // Comparing the order of the rows common to both commits answers the real\n // question. A relayout leaves it identical; a sort does not.\n const stillHere = new Set(nextOrder);\n const before = previousOrder.filter((key) => stillHere.has(key));\n const after = nextOrder.filter((key) => previous.has(key));\n const isReorder =\n before.length !== after.length ||\n before.some((key, index) => key !== after[index]);\n\n if (!isReorder) return;\n\n const moved: { row: HTMLTableRowElement; delta: number }[] = [];\n\n for (const row of rows) {\n const from = previous.get(row.dataset.key!);\n\n // A row that was not here before has nowhere to come from. Skipped rather\n // than bailing on the whole batch: a virtualized window swaps some of its\n // rows on every re-sort, and refusing to animate unless ALL of them are\n // familiar means a virtualized grid — most result grids — never animates\n // at all.\n if (from === undefined) continue;\n\n const delta = from - next.get(row.dataset.key!)!;\n\n if (delta !== 0) moved.push({ row, delta });\n }\n\n if (!moved.length) return;\n\n // Invert: put every moved row back where it was, with transitions off so\n // this jump is not itself animated.\n for (const { row, delta } of moved) {\n row.style.transition = 'none';\n row.style.transform = `translateY(${delta}px)`;\n }\n\n // Flush the inverted state into layout, so the browser has something to\n // animate FROM. A forced reflow rather than `requestAnimationFrame`,\n // deliberately: rAF does not fire in a hidden tab, and a sort that lands\n // while the tab is in the background would leave every row frozen at its\n // old position until the next reorder. One reflow, once per animation.\n void body.offsetHeight;\n\n // Play.\n for (const { row } of moved) {\n row.style.transition = `transform ${duration}ms ease-out`;\n row.style.transform = '';\n }\n\n // Clear on arrival. A `transition` left inline would go on to animate\n // transforms this hook never set — a dragged row, for one.\n //\n // A timer rather than `transitionend`, for the same reason the invert does\n // not use `requestAnimationFrame`: in a hidden tab the transition never\n // runs, so the event never fires and every animated row keeps its inline\n // `transition` for the rest of the session. The duration is known exactly,\n // so there is nothing to wait to be told.\n const clear = () => {\n for (const { row } of moved) {\n row.style.transition = '';\n row.style.transform = '';\n }\n };\n const timer = setTimeout(clear, duration);\n\n return () => {\n // A reorder landing mid-animation starts over from wherever the rows are,\n // so nothing may be left behind.\n clearTimeout(timer);\n clear();\n };\n });\n}\n"],"mappings":";;;;;AAKA,MAAa,oBAAoB;;AAWjC,SAAS,uBAAuB;AAC9B,QACE,OAAO,WAAW,eAClB,QAAQ,OAAO,aAAa,mCAAmC,EAAE,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;AA4B7E,SAAgB,oBAAoB,EAClC,WACA,SACA,WAAW,qBACkB;CAC7B,MAAM,cAAc,OAAmC,KAAK;CAC5D,MAAM,mBAAmB,OAAiB,EAAE,CAAC;AAK7C,uBAAsB;EACpB,MAAM,OAAO,QAAQ;AAErB,MAAI,CAAC,KAAM;EAEX,MAAM,OAAO,MAAM,KACjB,KAAK,iBAGH,wDACD,CACF;EAKD,MAAM,uBAAO,IAAI,KAAqB;AAEtC,OAAK,MAAM,OAAO,KAAM,MAAK,IAAI,IAAI,QAAQ,KAAM,IAAI,UAAU;EAEjE,MAAM,WAAW,YAAY;EAC7B,MAAM,gBAAgB,iBAAiB;EACvC,MAAM,YAAY,KAAK,KAAK,QAAQ,IAAI,QAAQ,IAAK;AAErD,cAAY,UAAU;AACtB,mBAAiB,UAAU;AAK3B,MAAI,CAAC,aAAa,sBAAsB,IAAI,CAAC,SAAU;EAavD,MAAM,YAAY,IAAI,IAAI,UAAU;EACpC,MAAM,SAAS,cAAc,QAAQ,QAAQ,UAAU,IAAI,IAAI,CAAC;EAChE,MAAM,QAAQ,UAAU,QAAQ,QAAQ,SAAS,IAAI,IAAI,CAAC;AAK1D,MAAI,EAHF,OAAO,WAAW,MAAM,UACxB,OAAO,MAAM,KAAK,UAAU,QAAQ,MAAM,OAAO,EAEnC;EAEhB,MAAM,QAAuD,EAAE;AAE/D,OAAK,MAAM,OAAO,MAAM;GACtB,MAAM,OAAO,SAAS,IAAI,IAAI,QAAQ,IAAK;AAO3C,OAAI,SAAS,OAAW;GAExB,MAAM,QAAQ,OAAO,KAAK,IAAI,IAAI,QAAQ,IAAK;AAE/C,OAAI,UAAU,EAAG,OAAM,KAAK;IAAE;IAAK;IAAO,CAAC;;AAG7C,MAAI,CAAC,MAAM,OAAQ;AAInB,OAAK,MAAM,EAAE,KAAK,WAAW,OAAO;AAClC,OAAI,MAAM,aAAa;AACvB,OAAI,MAAM,YAAY,cAAc,MAAM;;AAQ5C,EAAK,KAAK;AAGV,OAAK,MAAM,EAAE,SAAS,OAAO;AAC3B,OAAI,MAAM,aAAa,aAAa,SAAS;AAC7C,OAAI,MAAM,YAAY;;EAWxB,MAAM,cAAc;AAClB,QAAK,MAAM,EAAE,SAAS,OAAO;AAC3B,QAAI,MAAM,aAAa;AACvB,QAAI,MAAM,YAAY;;;EAG1B,MAAM,QAAQ,WAAW,OAAO,SAAS;AAEzC,eAAa;AAGX,gBAAa,MAAM;AACnB,UAAO;;GAET"}
@@ -0,0 +1,49 @@
1
+ /** @license MIT | @cube-dev/ui-kit v0.157.1 | Cube Dev Team */
2
+ import { useLayoutEffect, useState } from "react";
3
+
4
+ //#region src/components/data/TableBase/use-scrollability.ts
5
+ const NONE = {
6
+ x: false,
7
+ y: false
8
+ };
9
+ /**
10
+ * Whether the scroller can actually scroll, per axis.
11
+ *
12
+ * This exists for `overscroll-behavior`. `contain` is what stops a horizontal
13
+ * swipe at the scroll edge from triggering browser back-navigation, but Chrome
14
+ * applies it to any element with `overflow: auto` — including one whose content
15
+ * fits. The wheel event is then swallowed by a scroller with nothing to scroll,
16
+ * and the page behind it will not move. So the containment has to be scoped to
17
+ * the axis that is genuinely scrollable, which means measuring.
18
+ *
19
+ * Both the scroller and its content are observed: the scroller's own box does
20
+ * not change when rows are added, so observing it alone would miss a table that
21
+ * grew past its container.
22
+ */
23
+ function useScrollability(element) {
24
+ const [state, setState] = useState(NONE);
25
+ useLayoutEffect(() => {
26
+ if (!element || !(element instanceof Element)) {
27
+ setState(NONE);
28
+ return;
29
+ }
30
+ const measure = () => {
31
+ const next = {
32
+ x: element.scrollWidth - element.clientWidth > 1,
33
+ y: element.scrollHeight - element.clientHeight > 1
34
+ };
35
+ setState((current) => current.x === next.x && current.y === next.y ? current : next);
36
+ };
37
+ measure();
38
+ const observer = new ResizeObserver(measure);
39
+ observer.observe(element);
40
+ const content = element.firstElementChild;
41
+ if (content) observer.observe(content);
42
+ return () => observer.disconnect();
43
+ }, [element]);
44
+ return state;
45
+ }
46
+
47
+ //#endregion
48
+ export { useScrollability };
49
+ //# sourceMappingURL=use-scrollability.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-scrollability.js","names":[],"sources":["../../../../src/components/data/TableBase/use-scrollability.ts"],"sourcesContent":["import { useLayoutEffect, useState } from 'react';\n\nexport interface CubeScrollability {\n x: boolean;\n y: boolean;\n}\n\nconst NONE: CubeScrollability = { x: false, y: false };\n\n/**\n * Whether the scroller can actually scroll, per axis.\n *\n * This exists for `overscroll-behavior`. `contain` is what stops a horizontal\n * swipe at the scroll edge from triggering browser back-navigation, but Chrome\n * applies it to any element with `overflow: auto` — including one whose content\n * fits. The wheel event is then swallowed by a scroller with nothing to scroll,\n * and the page behind it will not move. So the containment has to be scoped to\n * the axis that is genuinely scrollable, which means measuring.\n *\n * Both the scroller and its content are observed: the scroller's own box does\n * not change when rows are added, so observing it alone would miss a table that\n * grew past its container.\n */\nexport function useScrollability(\n element: HTMLElement | null,\n): CubeScrollability {\n const [state, setState] = useState<CubeScrollability>(NONE);\n\n useLayoutEffect(() => {\n // Matches `useContainerWidth`: a scroller handed over by a callback ref can\n // be null, and `observe` throws on anything that is not an Element.\n if (!element || !(element instanceof Element)) {\n setState(NONE);\n\n return;\n }\n\n const measure = () => {\n // A 1px tolerance: sub-pixel layout regularly leaves `scrollHeight` a\n // fraction above `clientHeight` on a table that visibly does not scroll,\n // and trapping the wheel over that fraction is the exact bug this avoids.\n const next = {\n x: element.scrollWidth - element.clientWidth > 1,\n y: element.scrollHeight - element.clientHeight > 1,\n };\n\n setState((current) =>\n current.x === next.x && current.y === next.y ? current : next,\n );\n };\n\n measure();\n\n const observer = new ResizeObserver(measure);\n\n observer.observe(element);\n\n const content = element.firstElementChild;\n\n if (content) observer.observe(content);\n\n return () => observer.disconnect();\n }, [element]);\n\n return state;\n}\n"],"mappings":";;;;AAOA,MAAM,OAA0B;CAAE,GAAG;CAAO,GAAG;CAAO;;;;;;;;;;;;;;;AAgBtD,SAAgB,iBACd,SACmB;CACnB,MAAM,CAAC,OAAO,YAAY,SAA4B,KAAK;AAE3D,uBAAsB;AAGpB,MAAI,CAAC,WAAW,EAAE,mBAAmB,UAAU;AAC7C,YAAS,KAAK;AAEd;;EAGF,MAAM,gBAAgB;GAIpB,MAAM,OAAO;IACX,GAAG,QAAQ,cAAc,QAAQ,cAAc;IAC/C,GAAG,QAAQ,eAAe,QAAQ,eAAe;IAClD;AAED,aAAU,YACR,QAAQ,MAAM,KAAK,KAAK,QAAQ,MAAM,KAAK,IAAI,UAAU,KAC1D;;AAGH,WAAS;EAET,MAAM,WAAW,IAAI,eAAe,QAAQ;AAE5C,WAAS,QAAQ,QAAQ;EAEzB,MAAM,UAAU,QAAQ;AAExB,MAAI,QAAS,UAAS,QAAQ,QAAQ;AAEtC,eAAa,SAAS,YAAY;IACjC,CAAC,QAAQ,CAAC;AAEb,QAAO"}
@@ -0,0 +1,2 @@
1
+
2
+ import "./types.js";
@@ -0,0 +1,166 @@
1
+ /** @license MIT | @cube-dev/ui-kit v0.157.1 | Cube Dev Team */
2
+ import { useMemo } from "react";
3
+
4
+ //#region src/components/data/TableBase/use-table-columns.ts
5
+ /** @default when a column declares neither `width` nor `minWidth`. */
6
+ const DEFAULT_MIN_WIDTH = 150;
7
+ /**
8
+ * Reads `key` as a data path. A plain key is a single property lookup; dots
9
+ * walk nested objects (`'owner.name'`). Anything richer belongs in `getValue`.
10
+ */
11
+ function readPath(row, path) {
12
+ if (row == null) return void 0;
13
+ if (!path.includes(".")) return row[path];
14
+ let current = row;
15
+ for (const part of path.split(".")) {
16
+ if (current == null) return void 0;
17
+ current = current[part];
18
+ }
19
+ return current;
20
+ }
21
+ function getColumnValue(column, row, rowIndex) {
22
+ return column.getValue ? column.getValue(row, rowIndex) : readPath(row, column.key);
23
+ }
24
+ /**
25
+ * Display text for a cell — what client sort, client search and TSV copy all
26
+ * operate on. Deliberately NOT the rendered output: `render` may return
27
+ * arbitrary React, and stringifying that is how cloud's filter ended up
28
+ * matching `"[object Object]"` against the query `"object"`.
29
+ *
30
+ * Returns `null` when the column cannot produce text, so callers can skip it
31
+ * rather than coerce a non-primitive.
32
+ */
33
+ function getColumnText(column, row, rowIndex) {
34
+ const value = getColumnValue(column, row, rowIndex);
35
+ if (column.format) return column.format(value, row, rowIndex);
36
+ if (value == null) return "";
37
+ const type = typeof value;
38
+ if (type === "string") return value;
39
+ if (type === "number" || type === "boolean" || type === "bigint") return String(value);
40
+ if (value instanceof Date) return value.toISOString();
41
+ return null;
42
+ }
43
+ function clamp(value, min, max) {
44
+ return Math.min(Math.max(value, min), max ?? Number.POSITIVE_INFINITY);
45
+ }
46
+ /**
47
+ * Normalizes the public column list into resolved leaves: visual order, ARIA
48
+ * indices, pixel widths, and sticky offsets for pinned columns.
49
+ *
50
+ * Width resolution mirrors ag-grid's `fitGridWidth`: fixed columns take their
51
+ * width, the remainder is split across flex columns by weight, and each result
52
+ * is clamped to `[minWidth, maxWidth]`. Clamping perturbs the sum, so the
53
+ * residual is redistributed across the still-unclamped columns until it
54
+ * settles. When even the minimums do not fit, every column takes its minimum
55
+ * and the table scrolls horizontally.
56
+ */
57
+ function useTableColumns({ columns, containerWidth, columnWidths, leadingColumns, trailingColumns }) {
58
+ return useMemo(() => {
59
+ const visible = [
60
+ ...leadingColumns ?? [],
61
+ ...columns,
62
+ ...trailingColumns ?? []
63
+ ].filter((column) => !column.isHidden);
64
+ const ordered = [
65
+ ...visible.filter((c) => c.pin === "start"),
66
+ ...visible.filter((c) => !c.pin),
67
+ ...visible.filter((c) => c.pin === "end")
68
+ ];
69
+ const structuralKeys = new Set([...leadingColumns ?? [], ...trailingColumns ?? []].map((c) => c.key));
70
+ const specs = ordered.map((column) => {
71
+ const isStructural = structuralKeys.has(column.key);
72
+ const explicit = columnWidths?.[column.key] ?? column.width;
73
+ const minWidth = column.minWidth ?? (explicit != null ? explicit : isStructural ? 0 : DEFAULT_MIN_WIDTH);
74
+ return {
75
+ column,
76
+ isStructural,
77
+ fixed: explicit ?? null,
78
+ minWidth,
79
+ maxWidth: column.maxWidth ?? null,
80
+ flex: explicit != null ? null : column.flex ?? 1
81
+ };
82
+ });
83
+ const resolved = /* @__PURE__ */ new Map();
84
+ let isOverflowing = false;
85
+ if (containerWidth != null && containerWidth > 0) {
86
+ const fixedTotal = specs.reduce((sum, s) => sum + (s.fixed ?? 0), 0);
87
+ const flexSpecs = specs.filter((s) => s.fixed == null);
88
+ if (specs.reduce((sum, s) => sum + (s.fixed ?? s.minWidth), 0) > containerWidth) {
89
+ isOverflowing = true;
90
+ for (const spec of specs) resolved.set(spec.column.key, spec.fixed ?? spec.minWidth);
91
+ } else {
92
+ let remaining = containerWidth - fixedTotal;
93
+ let pool = flexSpecs;
94
+ while (pool.length > 0) {
95
+ const totalFlex = pool.reduce((sum, s) => sum + (s.flex ?? 1), 0);
96
+ const nextPool = [];
97
+ let consumed = 0;
98
+ for (const spec of pool) {
99
+ const ideal = remaining * (spec.flex ?? 1) / (totalFlex || 1);
100
+ const clamped = clamp(ideal, spec.minWidth, spec.maxWidth);
101
+ if (clamped !== ideal) {
102
+ resolved.set(spec.column.key, clamped);
103
+ consumed += clamped;
104
+ } else nextPool.push(spec);
105
+ }
106
+ if (nextPool.length === pool.length) {
107
+ const totalLeft = nextPool.reduce((sum, s) => sum + (s.flex ?? 1), 0);
108
+ for (const spec of nextPool) resolved.set(spec.column.key, remaining * (spec.flex ?? 1) / (totalLeft || 1));
109
+ break;
110
+ }
111
+ remaining -= consumed;
112
+ pool = nextPool;
113
+ }
114
+ for (const spec of specs) if (spec.fixed != null) resolved.set(spec.column.key, spec.fixed);
115
+ }
116
+ }
117
+ let pinnedStartWidth = 0;
118
+ let pinnedEndWidth = 0;
119
+ const out = specs.map((spec, index) => ({
120
+ ...spec.column,
121
+ index,
122
+ ariaColIndex: index + 1,
123
+ width: resolved.get(spec.column.key) ?? null,
124
+ minWidth: spec.minWidth,
125
+ maxWidth: spec.maxWidth,
126
+ flex: spec.flex,
127
+ align: spec.column.align ?? "start",
128
+ pinOffset: null,
129
+ isPinEdge: false,
130
+ isStructural: spec.isStructural
131
+ }));
132
+ for (const column of out) {
133
+ if (column.pin !== "start") continue;
134
+ column.pinOffset = pinnedStartWidth;
135
+ pinnedStartWidth += column.width ?? column.minWidth;
136
+ }
137
+ for (let i = out.length - 1; i >= 0; i--) {
138
+ const column = out[i];
139
+ if (column.pin !== "end") continue;
140
+ column.pinOffset = pinnedEndWidth;
141
+ pinnedEndWidth += column.width ?? column.minWidth;
142
+ }
143
+ const lastPinnedStart = out.filter((c) => c.pin === "start").at(-1);
144
+ const firstPinnedEnd = out.find((c) => c.pin === "end");
145
+ if (lastPinnedStart) lastPinnedStart.isPinEdge = true;
146
+ if (firstPinnedEnd) firstPinnedEnd.isPinEdge = true;
147
+ const totalWidth = out.every((c) => c.width != null) ? out.reduce((sum, c) => sum + (c.width ?? 0), 0) : null;
148
+ return {
149
+ columns: out,
150
+ pinnedStartWidth,
151
+ pinnedEndWidth,
152
+ totalWidth,
153
+ isOverflowing
154
+ };
155
+ }, [
156
+ columns,
157
+ containerWidth,
158
+ columnWidths,
159
+ leadingColumns,
160
+ trailingColumns
161
+ ]);
162
+ }
163
+
164
+ //#endregion
165
+ export { getColumnText, getColumnValue, useTableColumns };
166
+ //# sourceMappingURL=use-table-columns.js.map