@cube-dev/ui-kit 0.0.0-canary-2419763 → 0.0.0-canary-0bb3638

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 (604) hide show
  1. package/dist/_internal/hooks/use-chained-callback.js +1 -1
  2. package/dist/_internal/hooks/use-debounced-value.js +1 -1
  3. package/dist/_internal/hooks/use-deprecation-warning.js +1 -1
  4. package/dist/_internal/hooks/use-event.js +1 -1
  5. package/dist/_internal/hooks/use-is-first-render.js +1 -1
  6. package/dist/_internal/hooks/use-sync-ref.js +1 -1
  7. package/dist/_internal/hooks/use-timer/timer.js +1 -1
  8. package/dist/_internal/hooks/use-timer/use-timer.js +1 -1
  9. package/dist/_internal/hooks/use-warn.js +1 -1
  10. package/dist/components/Block.js +1 -1
  11. package/dist/components/CollectionItem.js +1 -1
  12. package/dist/components/GlobalStyles.js +1 -1
  13. package/dist/components/GridProvider.js +1 -1
  14. package/dist/components/HiddenInput.js +1 -1
  15. package/dist/components/Root.js +1 -1
  16. package/dist/components/actions/Action/Action.js +1 -1
  17. package/dist/components/actions/Banner/Banner.js +1 -1
  18. package/dist/components/actions/Button/Button.d.ts +0 -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 +44 -42
  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.d.ts +14 -14
  89. package/dist/components/content/Text.js +1 -1
  90. package/dist/components/content/TextItem/TextItem.js +1 -1
  91. package/dist/components/content/Title.js +1 -1
  92. package/dist/components/content/Tree/Tree.js +1 -1
  93. package/dist/components/content/Tree/TreeNode.js +1 -1
  94. package/dist/components/content/Tree/styled.js +1 -1
  95. package/dist/components/content/Tree/tree-index.js +1 -1
  96. package/dist/components/content/Tree/use-checkbox-tree.js +1 -1
  97. package/dist/components/content/Tree/use-load-data.js +1 -1
  98. package/dist/components/content/highlightText.js +1 -1
  99. package/dist/components/content/use-auto-tooltip.js +1 -1
  100. package/dist/components/fields/Checkbox/Checkbox.js +1 -1
  101. package/dist/components/fields/Checkbox/CheckboxGroup.js +1 -1
  102. package/dist/components/fields/Checkbox/context.js +1 -1
  103. package/dist/components/fields/ColorInput/ColorInput.d.ts +67 -0
  104. package/dist/components/fields/ColorInput/ColorInput.js +230 -0
  105. package/dist/components/fields/ColorInput/ColorInput.js.map +1 -0
  106. package/dist/components/fields/ColorInput/index.d.ts +2 -0
  107. package/dist/components/fields/ColorPicker/ColorPicker.d.ts +34 -37
  108. package/dist/components/fields/ColorPicker/ColorPicker.js +125 -182
  109. package/dist/components/fields/ColorPicker/ColorPicker.js.map +1 -1
  110. package/dist/components/fields/ColorPicker/index.d.ts +1 -3
  111. package/dist/components/fields/ColorSwatchGroup/ColorSwatchGroup.d.ts +50 -0
  112. package/dist/components/fields/ColorSwatchGroup/ColorSwatchGroup.js +260 -0
  113. package/dist/components/fields/ColorSwatchGroup/ColorSwatchGroup.js.map +1 -0
  114. package/dist/components/fields/ColorSwatchGroup/index.d.ts +2 -0
  115. package/dist/components/fields/ComboBox/ComboBox.js +1 -1
  116. package/dist/components/fields/CommandTextArea/CommandTextArea.js +1 -1
  117. package/dist/components/fields/CommandTextArea/caretPosition.js +1 -1
  118. package/dist/components/fields/CommandTextArea/useCaretAnchor.js +1 -1
  119. package/dist/components/fields/DatePicker/DateInput.js +1 -1
  120. package/dist/components/fields/DatePicker/DateInputBase.js +1 -1
  121. package/dist/components/fields/DatePicker/DatePicker.js +1 -1
  122. package/dist/components/fields/DatePicker/DatePickerButton.js +1 -1
  123. package/dist/components/fields/DatePicker/DatePickerElement.js +1 -1
  124. package/dist/components/fields/DatePicker/DatePickerInput.js +1 -1
  125. package/dist/components/fields/DatePicker/DatePickerSegment.js +1 -1
  126. package/dist/components/fields/DatePicker/DateRangePicker.js +1 -1
  127. package/dist/components/fields/DatePicker/DateRangeSeparatedPicker.js +1 -1
  128. package/dist/components/fields/DatePicker/MonthPicker.js +1 -1
  129. package/dist/components/fields/DatePicker/PeriodPicker.js +1 -1
  130. package/dist/components/fields/DatePicker/QuarterPicker.js +1 -1
  131. package/dist/components/fields/DatePicker/TimeInput.js +1 -1
  132. package/dist/components/fields/DatePicker/WeekPicker.js +1 -1
  133. package/dist/components/fields/DatePicker/YearPicker.js +1 -1
  134. package/dist/components/fields/DatePicker/parseDate.js +1 -1
  135. package/dist/components/fields/DatePicker/period.js +1 -1
  136. package/dist/components/fields/DatePicker/props.js +1 -1
  137. package/dist/components/fields/DatePicker/utils.js +1 -1
  138. package/dist/components/fields/FileInput/FileInput.js +1 -1
  139. package/dist/components/fields/FilterListBox/FilterListBox.js +1 -1
  140. package/dist/components/fields/FilterPicker/FilterPicker.js +1 -1
  141. package/dist/components/fields/Input/Input.js +2 -2
  142. package/dist/components/fields/ListBox/DraggableListBox.js +1 -1
  143. package/dist/components/fields/ListBox/ListBox.js +1 -1
  144. package/dist/components/fields/ListBoxPopover/ListBoxPopover.js +1 -1
  145. package/dist/components/fields/ListBoxPopover/index.d.ts +0 -1
  146. package/dist/components/fields/ListBoxPopover/listNavigation.js +1 -1
  147. package/dist/components/fields/ListBoxPopover/useCompositeFocus.js +1 -1
  148. package/dist/components/fields/NumberInput/NumberInput.js +1 -1
  149. package/dist/components/fields/NumberInput/StepButton.js +1 -1
  150. package/dist/components/fields/PasswordInput/PasswordInput.js +1 -1
  151. package/dist/components/fields/Picker/Picker.js +1 -1
  152. package/dist/components/fields/RadioGroup/Radio.d.ts +2 -2
  153. package/dist/components/fields/RadioGroup/Radio.js +4 -4
  154. package/dist/components/fields/RadioGroup/Radio.js.map +1 -1
  155. package/dist/components/fields/RadioGroup/RadioGroup.js +1 -1
  156. package/dist/components/fields/RadioGroup/context.js +1 -1
  157. package/dist/components/fields/SearchComboBox/SearchComboBox.js +1 -1
  158. package/dist/components/fields/SearchInput/SearchInput.js +1 -1
  159. package/dist/components/fields/Select/Select.js +1 -1
  160. package/dist/components/fields/Slider/Gradation.js +1 -1
  161. package/dist/components/fields/Slider/HueSlider.js +1 -1
  162. package/dist/components/fields/Slider/RangeSlider.js +1 -1
  163. package/dist/components/fields/Slider/Slider.js +1 -1
  164. package/dist/components/fields/Slider/SliderBase.js +1 -1
  165. package/dist/components/fields/Slider/SliderThumb.js +1 -1
  166. package/dist/components/fields/Slider/SliderTrack.js +1 -1
  167. package/dist/components/fields/Slider/elements.js +1 -1
  168. package/dist/components/fields/Slider/index.js +1 -1
  169. package/dist/components/fields/Switch/Switch.js +1 -1
  170. package/dist/components/fields/TextArea/TextArea.js +1 -1
  171. package/dist/components/fields/TextInput/TextInput.js +1 -1
  172. package/dist/components/fields/TextInput/TextInputBase.js +1 -1
  173. package/dist/components/fields/TextInputMapper/TextInputMapper.js +1 -1
  174. package/dist/components/fields/{ColorPicker/ColorPickerPanel.js → color/ColorPanel.js} +14 -11
  175. package/dist/components/fields/color/ColorPanel.js.map +1 -0
  176. package/dist/components/fields/color/ColorSwatch.d.ts +22 -0
  177. package/dist/components/fields/color/ColorSwatch.js +58 -0
  178. package/dist/components/fields/color/ColorSwatch.js.map +1 -0
  179. package/dist/components/fields/{ColorPicker → color}/channels.d.ts +1 -1
  180. package/dist/components/fields/{ColorPicker → color}/channels.js +2 -2
  181. package/dist/components/fields/color/channels.js.map +1 -0
  182. package/dist/components/fields/color/color.d.ts +21 -0
  183. package/dist/components/fields/{ColorPicker → color}/color.js +2 -2
  184. package/dist/components/fields/color/color.js.map +1 -0
  185. package/dist/components/fields/color/context.js +20 -0
  186. package/dist/components/fields/color/context.js.map +1 -0
  187. package/dist/components/fields/color/index.d.ts +4 -0
  188. package/dist/components/fields/index.d.ts +9 -3
  189. package/dist/components/form/FieldWrapper/FieldWrapper.js +1 -1
  190. package/dist/components/form/Form/Field.js +1 -1
  191. package/dist/components/form/Form/Form.js +1 -1
  192. package/dist/components/form/Form/ResetButton/ResetButton.js +1 -1
  193. package/dist/components/form/Form/SubmitButton/SubmitButton.js +1 -1
  194. package/dist/components/form/Form/SubmitError.js +1 -1
  195. package/dist/components/form/Form/index.js +1 -1
  196. package/dist/components/form/Form/use-field/use-field-props.js +1 -1
  197. package/dist/components/form/Form/use-field/use-field.js +1 -1
  198. package/dist/components/form/Form/use-form.js +1 -1
  199. package/dist/components/form/Form/validation.js +1 -1
  200. package/dist/components/form/Label.js +1 -1
  201. package/dist/components/form/validation/ValidationIndicator.js +1 -1
  202. package/dist/components/form/validation/resolve-validation-props.js +1 -1
  203. package/dist/components/form/validation/use-validation-props.js +1 -1
  204. package/dist/components/form/wrapper.js +1 -1
  205. package/dist/components/helpers/DisplayTransition/DisplayTransition.js +1 -1
  206. package/dist/components/helpers/IconSwitch/IconSwitch.js +1 -1
  207. package/dist/components/layout/Board/Board.js +1 -1
  208. package/dist/components/layout/Board/BoardProvider.js +1 -1
  209. package/dist/components/layout/Board/BoardResponsive.js +1 -1
  210. package/dist/components/layout/Board/Widget.js +1 -1
  211. package/dist/components/layout/Board/WidgetHost.js +1 -1
  212. package/dist/components/layout/Board/board-context.js +1 -1
  213. package/dist/components/layout/Board/board-store.js +1 -1
  214. package/dist/components/layout/Board/grid-core/calculate.js +1 -1
  215. package/dist/components/layout/Board/grid-core/collision.js +1 -1
  216. package/dist/components/layout/Board/grid-core/compactors.js +1 -1
  217. package/dist/components/layout/Board/grid-core/constraints.js +1 -1
  218. package/dist/components/layout/Board/grid-core/group-move.js +1 -1
  219. package/dist/components/layout/Board/grid-core/layout.js +1 -1
  220. package/dist/components/layout/Board/grid-core/sort.js +1 -1
  221. package/dist/components/layout/Board/index.js +1 -1
  222. package/dist/components/layout/Board/responsive-utils.js +1 -1
  223. package/dist/components/layout/Board/use-board-layout.js +1 -1
  224. package/dist/components/layout/Board/use-board-registry.js +1 -1
  225. package/dist/components/layout/Board/use-board-select-modifier-key.js +1 -1
  226. package/dist/components/layout/Board/use-board-selection.js +1 -1
  227. package/dist/components/layout/Flex.js +1 -1
  228. package/dist/components/layout/Flow.js +1 -1
  229. package/dist/components/layout/Grid.js +1 -1
  230. package/dist/components/layout/Panel.js +1 -1
  231. package/dist/components/layout/Prefix.js +1 -1
  232. package/dist/components/layout/ResizablePanel.js +1 -1
  233. package/dist/components/layout/Space.js +1 -1
  234. package/dist/components/layout/Suffix.js +1 -1
  235. package/dist/components/navigation/Tabs/DraggableTabList.js +1 -1
  236. package/dist/components/navigation/Tabs/TabButton.js +1 -1
  237. package/dist/components/navigation/Tabs/TabDropIndicator.js +1 -1
  238. package/dist/components/navigation/Tabs/TabPanel.js +1 -1
  239. package/dist/components/navigation/Tabs/TabPicker.js +1 -1
  240. package/dist/components/navigation/Tabs/Tabs.js +1 -1
  241. package/dist/components/navigation/Tabs/TabsAction.js +1 -1
  242. package/dist/components/navigation/Tabs/TabsContext.js +1 -1
  243. package/dist/components/navigation/Tabs/popover-placement.js +1 -1
  244. package/dist/components/navigation/Tabs/styled.js +1 -1
  245. package/dist/components/navigation/Tabs/types.js +1 -1
  246. package/dist/components/navigation/Tabs/use-tab-editing.js +1 -1
  247. package/dist/components/navigation/Tabs/use-tab-indicator.js +1 -1
  248. package/dist/components/navigation/index.d.ts +1 -5
  249. package/dist/components/organisms/StatsCard/StatsCard.js +1 -1
  250. package/dist/components/other/Calendar/Calendar.js +1 -1
  251. package/dist/components/other/Calendar/CalendarCell.js +1 -1
  252. package/dist/components/other/Calendar/CalendarGrid.js +1 -1
  253. package/dist/components/other/Calendar/PeriodCalendar.js +1 -1
  254. package/dist/components/other/Calendar/RangeCalendar.js +1 -1
  255. package/dist/components/other/CubeLogo/CubeLogo.js +1 -1
  256. package/dist/components/overlays/AlertDialog/AlertDialog.js +1 -1
  257. package/dist/components/overlays/AlertDialog/AlertDialogApiProvider.js +1 -1
  258. package/dist/components/overlays/AlertDialog/AlertDialogZone.js +1 -1
  259. package/dist/components/overlays/Dialog/Dialog.js +1 -1
  260. package/dist/components/overlays/Dialog/DialogContainer.js +1 -1
  261. package/dist/components/overlays/Dialog/DialogForm.js +1 -1
  262. package/dist/components/overlays/Dialog/DialogTrigger.js +1 -1
  263. package/dist/components/overlays/Dialog/context.js +1 -1
  264. package/dist/components/overlays/Dialog/use-dialog-container.js +1 -1
  265. package/dist/components/overlays/Modal/Modal.d.ts +1 -2
  266. package/dist/components/overlays/Modal/Modal.js +1 -1
  267. package/dist/components/overlays/Modal/OpenTransitionContext.js +1 -1
  268. package/dist/components/overlays/Modal/Overlay.d.ts +0 -1
  269. package/dist/components/overlays/Modal/Overlay.js +1 -1
  270. package/dist/components/overlays/Modal/Popover.js +1 -1
  271. package/dist/components/overlays/Modal/Tray.js +1 -1
  272. package/dist/components/overlays/Modal/Underlay.js +1 -1
  273. package/dist/components/overlays/Modal/types.d.ts +0 -1
  274. package/dist/components/overlays/Notifications/Notification.js +1 -1
  275. package/dist/components/overlays/Notifications/NotificationAction.js +1 -1
  276. package/dist/components/overlays/Notifications/NotificationCard.js +1 -1
  277. package/dist/components/overlays/Notifications/NotificationContext.d.ts +0 -2
  278. package/dist/components/overlays/Notifications/NotificationContext.js +1 -1
  279. package/dist/components/overlays/Notifications/NotificationItem.js +1 -1
  280. package/dist/components/overlays/Notifications/OverlayContainer.js +1 -1
  281. package/dist/components/overlays/Notifications/OverlayProvider.js +1 -1
  282. package/dist/components/overlays/Notifications/PersistentNotificationsList.js +1 -1
  283. package/dist/components/overlays/Notifications/dismissed-storage.js +1 -1
  284. package/dist/components/overlays/Notifications/format-relative-time.js +1 -1
  285. package/dist/components/overlays/Notifications/index.js +1 -1
  286. package/dist/components/overlays/Notifications/use-notification-state.js +1 -1
  287. package/dist/components/overlays/Notifications/use-notifications.js +1 -1
  288. package/dist/components/overlays/Notifications/use-overlay-timers.js +1 -1
  289. package/dist/components/overlays/Notifications/use-persistent-notifications.js +1 -1
  290. package/dist/components/overlays/Notifications/use-persistent-state.js +1 -1
  291. package/dist/components/overlays/Notifications/use-toast-state.js +1 -1
  292. package/dist/components/overlays/Toast/ToastItem.js +1 -1
  293. package/dist/components/overlays/Toast/index.js +1 -1
  294. package/dist/components/overlays/Toast/useProgressToast.js +1 -1
  295. package/dist/components/overlays/Toast/useToast.js +1 -1
  296. package/dist/components/overlays/Tooltip/Tooltip.js +1 -1
  297. package/dist/components/overlays/Tooltip/TooltipProvider.js +1 -1
  298. package/dist/components/overlays/Tooltip/TooltipTrigger.js +1 -1
  299. package/dist/components/overlays/Tooltip/context.js +1 -1
  300. package/dist/components/portal/Portal.js +1 -1
  301. package/dist/components/portal/PortalProvider.js +1 -1
  302. package/dist/components/portal/index.d.ts +0 -1
  303. package/dist/components/portal/usePortal.js +1 -1
  304. package/dist/components/shared/DraggableCollection.js +8 -24
  305. package/dist/components/shared/DraggableCollection.js.map +1 -1
  306. package/dist/components/shared/InvalidIcon.js +1 -1
  307. package/dist/components/shared/ValidIcon.js +1 -1
  308. package/dist/components/status/LoadingAnimation/LoadingAnimation.js +1 -1
  309. package/dist/components/status/Spin/Cube.js +1 -1
  310. package/dist/components/status/Spin/InternalSpinner.js +1 -1
  311. package/dist/components/status/Spin/Spin.js +1 -1
  312. package/dist/components/status/Spin/SpinsContainer.js +1 -1
  313. package/dist/data/item-themes.js +1 -1
  314. package/dist/data/themes.js +1 -1
  315. package/dist/eslint-plugin/defaults.generated.js +1 -199
  316. package/dist/eslint-plugin/defaults.generated.js.map +1 -1
  317. package/dist/eslint-plugin/index.js +1 -1
  318. package/dist/eslint-plugin/rules/no-redundant-default-prop.js +1 -1
  319. package/dist/i18n/I18nProvider.js +1 -1
  320. package/dist/i18n/createFormatter.js +1 -1
  321. package/dist/i18n/index.js +1 -1
  322. package/dist/i18n/instance.js +1 -1
  323. package/dist/i18n/locales/de-DE/uikit.js +1 -35
  324. package/dist/i18n/locales/en-US/uikit.js +1 -35
  325. package/dist/i18n/locales/en-US/uikit.json.d.ts +1 -40
  326. package/dist/i18n/locales/es-ES/uikit.js +1 -35
  327. package/dist/i18n/locales/es-MX/uikit.js +1 -35
  328. package/dist/i18n/locales/fr-FR/uikit.js +1 -35
  329. package/dist/i18n/locales/it-IT/uikit.js +1 -35
  330. package/dist/i18n/locales/ja-JP/uikit.js +1 -35
  331. package/dist/i18n/locales/nb-NO/uikit.js +1 -35
  332. package/dist/i18n/locales/pt-BR/uikit.js +1 -35
  333. package/dist/i18n/locales/pt-PT/uikit.js +1 -35
  334. package/dist/i18n/locales/sv-SE/uikit.js +1 -35
  335. package/dist/i18n/locales/vi-VN/uikit.js +1 -35
  336. package/dist/i18n/locales.js +1 -1
  337. package/dist/i18n/useFormatter.js +1 -1
  338. package/dist/i18n/useI18n.js +1 -1
  339. package/dist/icons/AdjustmentsHorizontalIcon.js +1 -1
  340. package/dist/icons/AdjustmentsIcon.js +1 -1
  341. package/dist/icons/AiIcon.js +1 -1
  342. package/dist/icons/AreaChartIcon.js +1 -1
  343. package/dist/icons/BackwardIcon.js +1 -1
  344. package/dist/icons/BarChartIcon.js +1 -1
  345. package/dist/icons/BellFilledIcon.js +1 -1
  346. package/dist/icons/BellIcon.js +1 -1
  347. package/dist/icons/BooleanIcon.js +1 -1
  348. package/dist/icons/CalendarEditIcon.js +1 -1
  349. package/dist/icons/CalendarIcon.js +1 -1
  350. package/dist/icons/CaretDownIcon.js +1 -1
  351. package/dist/icons/CaretUpIcon.js +1 -1
  352. package/dist/icons/ChartAreaStackedIcon.js +1 -1
  353. package/dist/icons/ChartAreaStackedPercentageIcon.js +1 -1
  354. package/dist/icons/ChartBarGroupedHorizontalIcon.js +1 -1
  355. package/dist/icons/ChartBarGroupedIcon.js +1 -1
  356. package/dist/icons/ChartBarHorizontalIcon.js +1 -1
  357. package/dist/icons/ChartBarLineIcon.js +1 -1
  358. package/dist/icons/ChartBarStackedHorizontalIcon.js +1 -1
  359. package/dist/icons/ChartBarStackedIcon.js +1 -1
  360. package/dist/icons/ChartBarStackedPercentageHorizontalIcon.js +1 -1
  361. package/dist/icons/ChartBarStackedPercentageIcon.js +1 -1
  362. package/dist/icons/ChartBoxPlot2Icon.js +1 -1
  363. package/dist/icons/ChartBoxPlotIcon.js +1 -1
  364. package/dist/icons/ChartBubbleIcon.js +1 -1
  365. package/dist/icons/ChartDonut2Icon.js +1 -1
  366. package/dist/icons/ChartFunnelIcon.js +1 -1
  367. package/dist/icons/ChartHeatmapIcon.js +1 -1
  368. package/dist/icons/ChartKPIIcon.js +1 -1
  369. package/dist/icons/ChartPie2Icon.js +1 -1
  370. package/dist/icons/ChartScatterIcon.js +1 -1
  371. package/dist/icons/CheckCircleFilledIcon.js +1 -1
  372. package/dist/icons/CheckCircleIcon.js +1 -1
  373. package/dist/icons/CheckIcon.js +1 -1
  374. package/dist/icons/CircleFilledIcon.js +1 -1
  375. package/dist/icons/ClearIcon.js +1 -1
  376. package/dist/icons/CloseCircleFilledIcon.js +1 -1
  377. package/dist/icons/CloseCircleIcon.js +1 -1
  378. package/dist/icons/CloseIcon.js +1 -1
  379. package/dist/icons/CodeIcon.js +1 -1
  380. package/dist/icons/ColumnTotalIcon.js +1 -1
  381. package/dist/icons/CopyIcon.js +1 -1
  382. package/dist/icons/CountIcon.js +1 -1
  383. package/dist/icons/CubeIcon.js +1 -1
  384. package/dist/icons/CubePauseIcon.js +1 -1
  385. package/dist/icons/CubePlayIcon.js +1 -1
  386. package/dist/icons/CurrencyDollarIcon.js +1 -1
  387. package/dist/icons/DangerIcon.js +1 -1
  388. package/dist/icons/DashboardIcon.js +1 -1
  389. package/dist/icons/DatabaseIcon.js +1 -1
  390. package/dist/icons/DecimalDecreaseIcon.js +1 -1
  391. package/dist/icons/DecimalIncreaseIcon.js +1 -1
  392. package/dist/icons/DirectionIcon.js +1 -1
  393. package/dist/icons/DonutIcon.js +1 -1
  394. package/dist/icons/DownIcon.js +1 -1
  395. package/dist/icons/EditIcon.js +1 -1
  396. package/dist/icons/ExclamationCircleFilledIcon.js +1 -1
  397. package/dist/icons/ExclamationCircleIcon.js +1 -1
  398. package/dist/icons/ExclamationIcon.js +1 -1
  399. package/dist/icons/EyeIcon.js +1 -1
  400. package/dist/icons/EyeInvisibleIcon.js +1 -1
  401. package/dist/icons/FilterIcon.js +1 -1
  402. package/dist/icons/FolderFilledIcon.js +1 -1
  403. package/dist/icons/FolderIcon.js +1 -1
  404. package/dist/icons/FolderOpenFilledIcon.js +1 -1
  405. package/dist/icons/FolderOpenIcon.js +1 -1
  406. package/dist/icons/ForwardIcon.js +1 -1
  407. package/dist/icons/GripVerticalIcon.js +1 -1
  408. package/dist/icons/HierarchyIcon.js +1 -1
  409. package/dist/icons/HierarchyOpenIcon.js +1 -1
  410. package/dist/icons/Icon.js +1 -1
  411. package/dist/icons/InfoCircleIcon.js +1 -1
  412. package/dist/icons/InfoIcon.js +1 -1
  413. package/dist/icons/KeyIcon.js +1 -1
  414. package/dist/icons/LeftIcon.js +1 -1
  415. package/dist/icons/LineChartIcon.js +1 -1
  416. package/dist/icons/LoadingIcon.js +1 -1
  417. package/dist/icons/LockFilledIcon.js +1 -1
  418. package/dist/icons/LockIcon.js +1 -1
  419. package/dist/icons/MoreIcon.js +1 -1
  420. package/dist/icons/NotAllowedIcon.js +1 -1
  421. package/dist/icons/Number123Icon.js +1 -1
  422. package/dist/icons/NumberIcon.js +1 -1
  423. package/dist/icons/PauseCircleFilledIcon.js +1 -1
  424. package/dist/icons/PauseCircleIcon.js +1 -1
  425. package/dist/icons/PauseIcon.js +1 -1
  426. package/dist/icons/PercentageIcon.js +1 -1
  427. package/dist/icons/PieChartIcon.js +1 -1
  428. package/dist/icons/PipetteIcon.js +1 -1
  429. package/dist/icons/PlayCircleIcon.js +1 -1
  430. package/dist/icons/PlayIcon.js +1 -1
  431. package/dist/icons/PlusIcon.js +1 -1
  432. package/dist/icons/ProgressBarIcon.js +1 -1
  433. package/dist/icons/ReloadIcon.js +1 -1
  434. package/dist/icons/ReportIcon.js +1 -1
  435. package/dist/icons/ReturnIcon.js +1 -1
  436. package/dist/icons/RightIcon.js +1 -1
  437. package/dist/icons/RowTotalsIcon.js +1 -1
  438. package/dist/icons/SchemeIcon.js +1 -1
  439. package/dist/icons/SearchIcon.js +1 -1
  440. package/dist/icons/SemanticQueryIcon.js +1 -1
  441. package/dist/icons/SettingsIcon.js +1 -1
  442. package/dist/icons/ShieldFilledIcon.js +1 -1
  443. package/dist/icons/ShieldIcon.js +1 -1
  444. package/dist/icons/SlashIcon.js +1 -1
  445. package/dist/icons/SparklesIcon.js +1 -1
  446. package/dist/icons/SqlIcon.js +1 -1
  447. package/dist/icons/StatsIcon.js +1 -1
  448. package/dist/icons/StopIcon.js +1 -1
  449. package/dist/icons/StringIcon.js +1 -1
  450. package/dist/icons/SubtotalsIcon.js +1 -1
  451. package/dist/icons/SwitchIcon.js +1 -1
  452. package/dist/icons/TableIcon.js +1 -1
  453. package/dist/icons/ThumbsDownIcon.js +1 -1
  454. package/dist/icons/ThumbsUpIcon.js +1 -1
  455. package/dist/icons/ThunderboltCrossedIcon.js +1 -1
  456. package/dist/icons/ThunderboltFilledIcon.js +1 -1
  457. package/dist/icons/ThunderboltIcon.js +1 -1
  458. package/dist/icons/TimeIcon.js +1 -1
  459. package/dist/icons/TrashIcon.js +1 -1
  460. package/dist/icons/UnlockIcon.js +1 -1
  461. package/dist/icons/UpIcon.js +1 -1
  462. package/dist/icons/UserGroupIcon.js +1 -1
  463. package/dist/icons/UserIcon.js +1 -1
  464. package/dist/icons/UserLockIcon.js +1 -1
  465. package/dist/icons/ViewIcon.js +1 -1
  466. package/dist/icons/WarningFilledIcon.js +1 -1
  467. package/dist/icons/WarningIcon.js +1 -1
  468. package/dist/icons/wrap-icon.js +1 -1
  469. package/dist/index.d.ts +15 -22
  470. package/dist/index.js +9 -10
  471. package/dist/index.js.map +1 -1
  472. package/dist/provider.js +1 -1
  473. package/dist/providers/TrackingProvider.js +1 -1
  474. package/dist/providers/navigationAdapter.default.js +1 -1
  475. package/dist/tokens/base.js +1 -1
  476. package/dist/tokens/colors.js +1 -1
  477. package/dist/tokens/index.js +1 -1
  478. package/dist/tokens/layout.js +1 -1
  479. package/dist/tokens/lazy-styles.js +1 -1
  480. package/dist/tokens/palette-config.js +1 -1
  481. package/dist/tokens/palette.js +1 -1
  482. package/dist/tokens/shadows.js +1 -1
  483. package/dist/tokens/sizes.js +1 -1
  484. package/dist/tokens/spacing.js +1 -1
  485. package/dist/tokens/typography.d.ts +1 -1
  486. package/dist/tokens/typography.js +2 -11
  487. package/dist/tokens/typography.js.map +1 -1
  488. package/dist/utils/ResizeSensor.js +1 -1
  489. package/dist/utils/is-dev-env.js +1 -1
  490. package/dist/utils/modules.js +1 -1
  491. package/dist/utils/promise.js +1 -1
  492. package/dist/utils/raf.js +1 -1
  493. package/dist/utils/random.js +1 -1
  494. package/dist/utils/range.js +1 -1
  495. package/dist/utils/react/RenderCache.js +1 -1
  496. package/dist/utils/react/Slots.js +1 -1
  497. package/dist/utils/react/chain.js +1 -1
  498. package/dist/utils/react/forwardRefWithGenerics.js +1 -1
  499. package/dist/utils/react/index.js +1 -1
  500. package/dist/utils/react/interactions.js +1 -1
  501. package/dist/utils/react/isTextOnly.js +1 -1
  502. package/dist/utils/react/mapProps.js +1 -1
  503. package/dist/utils/react/mergeProps.js +1 -1
  504. package/dist/utils/react/nullableValue.js +1 -1
  505. package/dist/utils/react/resolveIcon.js +1 -1
  506. package/dist/utils/react/sharedStore.js +1 -1
  507. package/dist/utils/react/useCombinedRefs.js +1 -1
  508. package/dist/utils/react/useControlledFocusVisible.js +1 -1
  509. package/dist/utils/react/useEventBus.js +1 -1
  510. package/dist/utils/react/useId.js +1 -1
  511. package/dist/utils/react/useIsDarwin.js +1 -1
  512. package/dist/utils/react/useKeySymbols.js +1 -1
  513. package/dist/utils/react/useLayoutEffect.js +1 -1
  514. package/dist/utils/react/useLocalStorage.js +1 -1
  515. package/dist/utils/react/useMergeStyles.js +1 -1
  516. package/dist/utils/react/usePopoverSync.js +1 -1
  517. package/dist/utils/react/useQaProps.js +1 -1
  518. package/dist/utils/react/useViewportSize.js +1 -1
  519. package/dist/utils/react/wrapNodeIfPlain.js +1 -1
  520. package/dist/utils/selection.js +1 -1
  521. package/dist/utils/styles.js +1 -1
  522. package/dist/utils/tree.js +1 -1
  523. package/dist/utils/warnings.js +1 -1
  524. package/dist/version.js +2 -2
  525. package/docs/components/fields/ColorInput.md +276 -0
  526. package/docs/components/fields/ColorPicker.md +85 -144
  527. package/docs/components/fields/ColorSwatchGroup.md +206 -0
  528. package/package.json +3 -8
  529. package/dist/components/data/DataTable/DataTable.d.ts +0 -13
  530. package/dist/components/data/DataTable/DataTable.js +0 -244
  531. package/dist/components/data/DataTable/DataTable.js.map +0 -1
  532. package/dist/components/data/DataTable/index.d.ts +0 -3
  533. package/dist/components/data/DataTable/types.d.ts +0 -140
  534. package/dist/components/data/ItemTable/ItemTable.d.ts +0 -19
  535. package/dist/components/data/ItemTable/ItemTable.js +0 -349
  536. package/dist/components/data/ItemTable/ItemTable.js.map +0 -1
  537. package/dist/components/data/ItemTable/ItemTableBulkBar.d.ts +0 -23
  538. package/dist/components/data/ItemTable/ItemTableBulkBar.js +0 -131
  539. package/dist/components/data/ItemTable/ItemTableBulkBar.js.map +0 -1
  540. package/dist/components/data/ItemTable/ItemTableDragPreview.js +0 -46
  541. package/dist/components/data/ItemTable/ItemTableDragPreview.js.map +0 -1
  542. package/dist/components/data/ItemTable/ItemTableFooter.js +0 -79
  543. package/dist/components/data/ItemTable/ItemTableFooter.js.map +0 -1
  544. package/dist/components/data/ItemTable/ItemTableToolbar.d.ts +0 -34
  545. package/dist/components/data/ItemTable/ItemTableToolbar.js +0 -91
  546. package/dist/components/data/ItemTable/ItemTableToolbar.js.map +0 -1
  547. package/dist/components/data/ItemTable/index.d.ts +0 -4
  548. package/dist/components/data/ItemTable/types.d.ts +0 -322
  549. package/dist/components/data/TableBase/ColumnResizer.js +0 -70
  550. package/dist/components/data/TableBase/ColumnResizer.js.map +0 -1
  551. package/dist/components/data/TableBase/RowCollection.js +0 -99
  552. package/dist/components/data/TableBase/RowCollection.js.map +0 -1
  553. package/dist/components/data/TableBase/TableRow.js +0 -89
  554. package/dist/components/data/TableBase/TableRow.js.map +0 -1
  555. package/dist/components/data/TableBase/TableView.d.ts +0 -22
  556. package/dist/components/data/TableBase/TableView.js +0 -867
  557. package/dist/components/data/TableBase/TableView.js.map +0 -1
  558. package/dist/components/data/TableBase/index.d.ts +0 -5
  559. package/dist/components/data/TableBase/row-menu.js +0 -40
  560. package/dist/components/data/TableBase/row-menu.js.map +0 -1
  561. package/dist/components/data/TableBase/styled.d.ts +0 -6
  562. package/dist/components/data/TableBase/styled.js +0 -504
  563. package/dist/components/data/TableBase/styled.js.map +0 -1
  564. package/dist/components/data/TableBase/types.d.ts +0 -173
  565. package/dist/components/data/TableBase/use-cell-selection.d.ts +0 -4
  566. package/dist/components/data/TableBase/use-cell-selection.js +0 -0
  567. package/dist/components/data/TableBase/use-cell-selection.js.map +0 -1
  568. package/dist/components/data/TableBase/use-container-width.js +0 -35
  569. package/dist/components/data/TableBase/use-container-width.js.map +0 -1
  570. package/dist/components/data/TableBase/use-scrollability.js +0 -49
  571. package/dist/components/data/TableBase/use-scrollability.js.map +0 -1
  572. package/dist/components/data/TableBase/use-table-columns.d.ts +0 -2
  573. package/dist/components/data/TableBase/use-table-columns.js +0 -166
  574. package/dist/components/data/TableBase/use-table-columns.js.map +0 -1
  575. package/dist/components/data/TableBase/use-table-search.js +0 -64
  576. package/dist/components/data/TableBase/use-table-search.js.map +0 -1
  577. package/dist/components/data/TableBase/use-table-selection.d.ts +0 -4
  578. package/dist/components/data/TableBase/use-table-selection.js +0 -233
  579. package/dist/components/data/TableBase/use-table-selection.js.map +0 -1
  580. package/dist/components/data/TableBase/use-table-sort.js +0 -91
  581. package/dist/components/data/TableBase/use-table-sort.js.map +0 -1
  582. package/dist/components/data/TableBase/use-table-sorts.js +0 -97
  583. package/dist/components/data/TableBase/use-table-sorts.js.map +0 -1
  584. package/dist/components/data/TableBase/use-table-storage.d.ts +0 -8
  585. package/dist/components/data/TableBase/use-table-storage.js +0 -58
  586. package/dist/components/data/TableBase/use-table-storage.js.map +0 -1
  587. package/dist/components/data/index.d.ts +0 -10
  588. package/dist/components/fields/ColorPicker/ColorPickerPanel.js.map +0 -1
  589. package/dist/components/fields/ColorPicker/channels.js.map +0 -1
  590. package/dist/components/fields/ColorPicker/color.d.ts +0 -15
  591. package/dist/components/fields/ColorPicker/color.js.map +0 -1
  592. package/dist/components/fields/ListBoxPopover/useCompositeFocus.d.ts +0 -2
  593. package/dist/components/navigation/Pagination/Pagination.d.ts +0 -9
  594. package/dist/components/navigation/Pagination/Pagination.js +0 -258
  595. package/dist/components/navigation/Pagination/Pagination.js.map +0 -1
  596. package/dist/components/navigation/Pagination/index.d.ts +0 -4
  597. package/dist/components/navigation/Pagination/types.d.ts +0 -81
  598. package/dist/components/navigation/Pagination/use-pagination.d.ts +0 -52
  599. package/dist/components/navigation/Pagination/use-pagination.js +0 -83
  600. package/dist/components/navigation/Pagination/use-pagination.js.map +0 -1
  601. package/dist/components/portal/PortalProvider.d.ts +0 -2
  602. package/docs/components/data/DataTable.md +0 -286
  603. package/docs/components/data/ItemTable.md +0 -970
  604. package/docs/components/navigation/Pagination.md +0 -245
@@ -1,867 +0,0 @@
1
- /** @license MIT | @cube-dev/ui-kit v0.0.0-canary-2419763 | Cube Dev Team */
2
- import { useEvent } from "../../../_internal/hooks/use-event.js";
3
- import { TooltipProvider } from "../../overlays/Tooltip/TooltipProvider.js";
4
- import { TextItem } from "../../content/TextItem/TextItem.js";
5
- import { ItemAction } from "../../actions/ItemAction/ItemAction.js";
6
- import { useI18n } from "../../../i18n/useI18n.js";
7
- import { UpIcon } from "../../../icons/UpIcon.js";
8
- import { MoreIcon } from "../../../icons/MoreIcon.js";
9
- import { _MenuTrigger } from "../../actions/Menu/MenuTrigger.js";
10
- import { __Menu } from "../../actions/Menu/Menu.js";
11
- import { Action } from "../../actions/Action/Action.js";
12
- import { useContextMenu } from "../../actions/use-context-menu.js";
13
- import { useToast } from "../../overlays/Toast/useToast.js";
14
- import { __Checkbox } from "../../fields/Checkbox/Checkbox.js";
15
- import { LoadingAnimation } from "../../status/LoadingAnimation/LoadingAnimation.js";
16
- import { Placeholder } from "../../content/Placeholder/Placeholder.js";
17
- import { Skeleton } from "../../content/Skeleton/Skeleton.js";
18
- import { ColumnResizer } from "./ColumnResizer.js";
19
- import { ROW_MENU_COLUMN_KEY, isMenuEmpty, normalizeMenuAction } from "./row-menu.js";
20
- import { TableElement, TableHeaderItem } from "./styled.js";
21
- import { TableRow, TableRowDropIndicator } from "./TableRow.js";
22
- import { useScrollability } from "./use-scrollability.js";
23
- import { getColumnText, getColumnValue } from "./use-table-columns.js";
24
- import { ROW_NUMBER_COLUMN_KEY, SELECTION_COLUMN_KEY } from "./use-table-selection.js";
25
- import { Fragment, useCallback, useEffect, useMemo, useRef, useState } from "react";
26
- import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
27
- import { useVirtualizer } from "@tanstack/react-virtual";
28
-
29
- //#region src/components/data/TableBase/TableView.tsx
30
- /**
31
- * The same block as an HTML table, so a spreadsheet keeps the cell boundaries.
32
- *
33
- * Pasting `text/plain` TSV works, but Excel and Sheets then re-guess the types
34
- * of every field; the HTML flavour is what makes a value that looks like a date
35
- * stay the text it was on screen.
36
- */
37
- function toClipboardHtml(tsv) {
38
- return `<table>${tsv.split("\n").map((line) => `<tr>${line.split(" ").map((cell) => `<td>${escapeHtml(cell)}</td>`).join("")}</tr>`).join("")}</table>`;
39
- }
40
- function escapeHtml(value) {
41
- return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
42
- }
43
- const ARIA_SORT = {
44
- asc: "ascending",
45
- desc: "descending"
46
- };
47
- /**
48
- * Content height per size step, mirroring `$row-height` in `styled.ts`. Only the
49
- * initial estimate — every rendered row is measured, so a wrong guess costs a
50
- * scrollbar adjustment, not a layout bug. The `+ 1` is the row separator.
51
- */
52
- /** Enough to read as "more is coming" without pretending to know how much. */
53
- const LOAD_MORE_SKELETON_ROWS = 3;
54
- const ESTIMATED_ROW_HEIGHT = {
55
- xsmall: 28,
56
- small: 32,
57
- medium: 40,
58
- large: 48,
59
- xlarge: 56
60
- };
61
- function pinStyle(column) {
62
- if (column.pinOffset == null) return void 0;
63
- return { ["--pin-offset"]: `${column.pinOffset}px` };
64
- }
65
- /**
66
- * The one place table DOM exists. Both `ItemTable` and `DataTable` resolve their
67
- * props into the shape above and hand it here, so the markup, the ARIA
68
- * bookkeeping and the tasty sub-element contract have a single implementation.
69
- */
70
- function TableView(props) {
71
- const { qa, rows, getRowKey, layout, onScrollerRef, rootRef, size = "medium", shape = "plain", rowHeight, headerHeight, isHeaderHidden = false, isStriped = false, hasColumnDividers, isHeaderSticky = true, isVirtualized = "auto", virtualizeThreshold = 50, overscan = 20, isLoading = false, loadingIndicator = "overlay", skeletonRowCount = 6, selection, selectionTooltip, overlay, rowMenu, rowContextMenu = false, onRowMenuAction, rowMenuTriggerProps, rowLink, onRowAction, onLoadMore, hasMore = false, isLoadingMore = false, loadMoreMargin = 200, pinnedTopRows, pinnedBottomRows, cellSelection, rowNumberOffset = 0, rowIndexOffset = 0, totalRowCount, isReorderable = false, dragState, dropState, collectionProps, bodyRef, isResizable = false, onColumnResize, onColumnResizeEnd, emptyLabel, noResultsLabel, error, isFiltered = false, sortMode = "off", sort, sorts, onColumnSort, getRowProps, headerPreset, contentPreset, toolbar, footer, ariaLabel, styles, headerStyles, headerCellStyles, bodyStyles, rowStyles, cellStyles, mods } = props;
72
- const { columns } = layout;
73
- const columnCount = columns.length;
74
- const { t } = useI18n();
75
- const toast = useToast();
76
- const [scrollerEl, setScrollerEl] = useState(null);
77
- const scrollerRef = useRef(null);
78
- const handleScrollerRef = useCallback((element) => {
79
- scrollerRef.current = element;
80
- setScrollerEl(element);
81
- onScrollerRef(element);
82
- }, [onScrollerRef]);
83
- const headerRowCount = isHeaderHidden ? 0 : 1;
84
- const pinnedTopCount = pinnedTopRows?.length ?? 0;
85
- const pinnedBottomCount = pinnedBottomRows?.length ?? 0;
86
- const bodyRowCount = Math.max(totalRowCount ?? rows.length, rowIndexOffset + rows.length);
87
- /** 1-based `aria-rowindex` for the i-th body row of the current page. */
88
- const bodyRowIndex = (rowIndex) => headerRowCount + pinnedTopCount + rowIndexOffset + rowIndex + 1;
89
- /** 1-based `aria-rowindex` for the i-th pinned row at `edge`. */
90
- const pinnedRowIndex = (index, edge) => edge === "top" ? headerRowCount + index + 1 : headerRowCount + pinnedTopCount + bodyRowCount + index + 1;
91
- const mergedStyles = useMemo(() => ({
92
- ...styles,
93
- ...contentPreset ? { Table: { preset: contentPreset } } : null,
94
- ...headerStyles ? { HeadRow: headerStyles } : null,
95
- ...headerPreset || headerCellStyles ? { HeaderCell: {
96
- ...headerPreset ? { preset: headerPreset } : null,
97
- ...headerCellStyles
98
- } } : null,
99
- ...bodyStyles ? { Body: bodyStyles } : null,
100
- ...rowStyles ? { Row: rowStyles } : null,
101
- ...cellStyles ? { Cell: cellStyles } : null,
102
- ...rowHeight != null ? { "$row-height": `${rowHeight}px` } : null,
103
- ...headerHeight != null ? { "$header-height": `${headerHeight}px` } : null
104
- }), [
105
- styles,
106
- headerStyles,
107
- headerCellStyles,
108
- headerPreset,
109
- contentPreset,
110
- bodyStyles,
111
- rowStyles,
112
- cellStyles,
113
- rowHeight,
114
- headerHeight
115
- ]);
116
- if (columnCount === 0 && isLoading) return /* @__PURE__ */ jsxs(TableElement, {
117
- ref: rootRef,
118
- qa: qa || "Table",
119
- styles: mergedStyles,
120
- mods: {
121
- size,
122
- shape,
123
- ...mods
124
- },
125
- children: [toolbar, /* @__PURE__ */ jsx("div", {
126
- "data-element": "Scroller",
127
- ref: handleScrollerRef,
128
- children: /* @__PURE__ */ jsx(Skeleton, { layout: "table" })
129
- })]
130
- });
131
- /**
132
- * Whether a cell is inside the current range.
133
- *
134
- * Pinned rows take part: they sit in the range's row order at the position
135
- * they occupy on screen, so a selection down a column of figures reaches its
136
- * total instead of leaving it to be copied separately. (ag-grid excludes
137
- * pinned rows outright; this is a deliberate departure.)
138
- */
139
- function isCellSelected(rowKey, columnKey) {
140
- if (!cellSelection?.isEnabled) return false;
141
- return cellSelection.isSelected(rowKey, columnKey);
142
- }
143
- /**
144
- * Press and drag for the range.
145
- *
146
- * `pointerdown` rather than `click`: the range has to start before the drag
147
- * does, and a click only lands after the button comes back up — by which time
148
- * the gesture is over. `pointerenter` grows it while the button is held, which
149
- * is the same shape ag-grid's `onCellMouseOver` gives the Cloud grids.
150
- */
151
- function cellSelectionProps(rowKey, columnKey, pinnedEdge) {
152
- if (!cellSelection?.canSelectCell(rowKey, columnKey)) return void 0;
153
- return {
154
- onPointerDown: (event) => {
155
- if (event.button !== 0) return;
156
- if (event.shiftKey) {
157
- event.preventDefault();
158
- cellSelection.extendTo(rowKey, columnKey);
159
- } else cellSelection.select(rowKey, columnKey);
160
- scrollerRef.current?.focus({ preventScroll: true });
161
- cellSelection.isDraggingRef.current = true;
162
- setIsRangeDragging(true);
163
- },
164
- onPointerEnter: () => {
165
- if (!cellSelection.isDraggingRef.current) return;
166
- if (pinnedEdge) return;
167
- cellSelection.extendTo(rowKey, columnKey);
168
- }
169
- };
170
- }
171
- /**
172
- * Marks the trailing column.
173
- *
174
- * Two things hang off it. Its resize handle tucks fully inside rather than
175
- * straddling a boundary that is not there — left hanging it puts half its
176
- * width past the table, and the scroller gains a few pixels of horizontal
177
- * scroll onto blank space. And it draws no vertical rule: that rule would
178
- * land flush against the frame and read as a doubled edge.
179
- */
180
- /** The pinned edge a row was rendered at, as the documented section name. */
181
- function sectionOf(pinnedEdge) {
182
- if (pinnedEdge === "top") return "pinnedTop";
183
- if (pinnedEdge === "bottom") return "pinnedBottom";
184
- return "body";
185
- }
186
- function lastColumnFlag(column) {
187
- return column.index === columns.length - 1 ? "" : void 0;
188
- }
189
- /**
190
- * Which frame corner, if any, this cell sits in.
191
- *
192
- * Only the two bottom ones, and only when the card's rounded edge is what the
193
- * row actually meets — a footer below it means the row ends against a straight
194
- * line instead. Without this a selected cell in that row has its ring sliced
195
- * off at 45° by the frame's radius, which reads as a rendering fault rather
196
- * than as a corner.
197
- *
198
- * Decided here rather than in CSS: the renderer already knows about the
199
- * footer, the shape and the pinned rows, and expressing
200
- * `card × no-footer × visually-last-row × outer-column` as a state map is how
201
- * a border map turns into a combinatorial one.
202
- */
203
- function bottomCornerFlag(column, rowIndex, isLastRow, pinnedEdge) {
204
- if (shape !== "card" || footer != null) return void 0;
205
- const pinnedBottomCount = pinnedBottomRows?.length ?? 0;
206
- if (!(pinnedEdge === "bottom" ? rowIndex === pinnedBottomCount - 1 : pinnedEdge == null && isLastRow && pinnedBottomCount === 0)) return void 0;
207
- if (column.index === 0) return "start";
208
- if (column.index === columns.length - 1) return "end";
209
- }
210
- function renderStateRow(content) {
211
- return /* @__PURE__ */ jsx("tr", {
212
- "data-element": "Row",
213
- role: "row",
214
- "aria-rowindex": headerRowCount + 1,
215
- children: /* @__PURE__ */ jsx("td", {
216
- "data-element": "StateCell",
217
- "data-state": "",
218
- role: "gridcell",
219
- colSpan: Math.max(columnCount, 1),
220
- "aria-colindex": 1,
221
- children: /* @__PURE__ */ jsx("div", {
222
- "data-element": "StateContent",
223
- children: content
224
- })
225
- })
226
- });
227
- }
228
- function renderSkeletonRows(count = skeletonRowCount, keyPrefix = "skeleton") {
229
- return Array.from({ length: count }, (_, rowIndex) => /* @__PURE__ */ jsx("tr", {
230
- "data-element": "Row",
231
- "data-placeholder": "",
232
- role: "row",
233
- "aria-rowindex": bodyRowIndex(rowIndex),
234
- "aria-busy": "true",
235
- children: columns.map((column) => /* @__PURE__ */ jsx("td", {
236
- "data-element": "Cell",
237
- "data-pin": column.pin,
238
- "data-pin-edge": column.isPinEdge ? "" : void 0,
239
- "data-align": column.align,
240
- role: "gridcell",
241
- "aria-colindex": column.ariaColIndex,
242
- style: pinStyle(column),
243
- children: /* @__PURE__ */ jsx(Placeholder, { size: "2x" })
244
- }, column.key))
245
- }, `${keyPrefix}-${rowIndex}`));
246
- }
247
- function renderSelectionHeaderCell(column) {
248
- return /* @__PURE__ */ jsx("th", {
249
- "data-element": "HeaderCell",
250
- "data-key": column.key,
251
- "data-kind": "selection",
252
- "data-pin": column.pin,
253
- "data-pin-edge": column.isPinEdge ? "" : void 0,
254
- "data-last-column": lastColumnFlag(column),
255
- role: "columnheader",
256
- scope: "col",
257
- tabIndex: -1,
258
- "aria-colindex": column.ariaColIndex,
259
- style: pinStyle(column),
260
- children: selection && selection.selectionMode === "multiple" ? /* @__PURE__ */ jsx("div", {
261
- "data-element": "SelectionBox",
262
- children: /* @__PURE__ */ jsx(__Checkbox, {
263
- "aria-label": selection.selectAllState === "all" ? t("itemTable.deselectAll", "Deselect all") : t("itemTable.selectAll", "Select all"),
264
- isSelected: selection.selectAllState === "all",
265
- isIndeterminate: selection.selectAllState === "some",
266
- onChange: selection.toggleSelectAll
267
- })
268
- }) : null
269
- }, column.key);
270
- }
271
- function renderSelectionCell(column, row, rowIndex, rowKey, isLastRow, pinnedEdge) {
272
- const canSelect = selection.canSelect(rowKey);
273
- const tooltip = typeof selectionTooltip === "function" ? selectionTooltip(row) : selectionTooltip;
274
- const checkbox = /* @__PURE__ */ jsx(__Checkbox, {
275
- "aria-label": t("itemTable.selectRow", "Select row"),
276
- isSelected: selection.isSelected(rowKey),
277
- isDisabled: !canSelect,
278
- onChange: () => selection.toggleRow(rowKey)
279
- });
280
- return /* @__PURE__ */ jsx("td", {
281
- "data-element": "Cell",
282
- "data-key": column.key,
283
- "data-kind": "selection",
284
- "data-pin": column.pin,
285
- "data-pin-edge": column.isPinEdge ? "" : void 0,
286
- "data-last-row": isLastRow ? "" : void 0,
287
- "data-pinned": pinnedEdge,
288
- "data-last-column": lastColumnFlag(column),
289
- "data-corner": bottomCornerFlag(column, rowIndex, isLastRow, pinnedEdge),
290
- role: "gridcell",
291
- "aria-colindex": column.ariaColIndex,
292
- style: pinStyle(column),
293
- onClickCapture: selection.captureShift,
294
- onKeyDownCapture: selection.captureShift,
295
- children: /* @__PURE__ */ jsx("div", {
296
- "data-element": "SelectionBox",
297
- children: !canSelect && tooltip ? /* @__PURE__ */ jsx(TooltipProvider, {
298
- title: tooltip,
299
- children: checkbox
300
- }) : checkbox
301
- })
302
- }, column.key);
303
- }
304
- function renderRowMenuCell(column, row, rowIndex, rowKey, isLastRow, pinnedEdge) {
305
- const items = resolveRowMenu(row, rowIndex, rowKey);
306
- return /* @__PURE__ */ jsx("td", {
307
- "data-element": "Cell",
308
- "data-key": column.key,
309
- "data-kind": "actions",
310
- "data-pin": column.pin,
311
- "data-pin-edge": column.isPinEdge ? "" : void 0,
312
- "data-last-row": isLastRow ? "" : void 0,
313
- "data-pinned": pinnedEdge,
314
- "data-last-column": lastColumnFlag(column),
315
- "data-corner": bottomCornerFlag(column, rowIndex, isLastRow, pinnedEdge),
316
- role: "gridcell",
317
- "aria-colindex": column.ariaColIndex,
318
- style: pinStyle(column),
319
- children: isMenuEmpty(items) ? null : /* @__PURE__ */ jsx("div", {
320
- "data-element": "RowActions",
321
- children: /* @__PURE__ */ jsxs(_MenuTrigger, { children: [/* @__PURE__ */ jsx(ItemAction, {
322
- tabIndex: -1,
323
- icon: /* @__PURE__ */ jsx(MoreIcon, {}),
324
- "aria-label": t("itemTable.rowActions", "Row actions"),
325
- ...rowMenuTriggerProps
326
- }), /* @__PURE__ */ jsx(__Menu, {
327
- onAction: menuActionHandler(row, rowKey, false),
328
- children: items
329
- })] })
330
- })
331
- }, column.key);
332
- }
333
- function renderHeaderCell(column) {
334
- if (column.key === SELECTION_COLUMN_KEY) return renderSelectionHeaderCell(column);
335
- if (column.key === ROW_NUMBER_COLUMN_KEY) return /* @__PURE__ */ jsx("th", {
336
- "data-element": "HeaderCell",
337
- "data-key": column.key,
338
- "data-kind": "row-number",
339
- "data-last-column": lastColumnFlag(column),
340
- role: "columnheader",
341
- scope: "col",
342
- tabIndex: -1,
343
- "aria-colindex": column.ariaColIndex,
344
- style: pinStyle(column)
345
- }, column.key);
346
- if (column.key === ROW_MENU_COLUMN_KEY) return /* @__PURE__ */ jsx("th", {
347
- "data-element": "HeaderCell",
348
- "data-key": column.key,
349
- "data-kind": "actions",
350
- "data-pin": column.pin,
351
- "data-pin-edge": column.isPinEdge ? "" : void 0,
352
- "data-last-column": lastColumnFlag(column),
353
- role: "columnheader",
354
- scope: "col",
355
- tabIndex: -1,
356
- "aria-colindex": column.ariaColIndex,
357
- style: pinStyle(column)
358
- }, column.key);
359
- const header = column.header;
360
- const activeSorts = sorts ?? (sort ? [sort] : []);
361
- const sortIndex = activeSorts.findIndex((entry) => entry.columnKey === column.key);
362
- const activeSort = sortIndex === -1 ? null : activeSorts[sortIndex];
363
- const isSorted = activeSort != null;
364
- const sortRank = activeSorts.length > 1 ? sortIndex + 1 : null;
365
- const isSortable = sortMode !== "off" && !column.isStructural && column.isSortable === true;
366
- const canResize = !column.isStructural && (column.isResizable ?? isResizable) && onColumnResize != null && onColumnResizeEnd != null;
367
- const ctx = {
368
- columnKey: column.key,
369
- columnIndex: column.index,
370
- sort: activeSort?.direction ?? null,
371
- isSortable,
372
- isResizing: false,
373
- width: column.width
374
- };
375
- const sortIndicator = isSortable ? /* @__PURE__ */ jsx("div", {
376
- "data-element": "SortIndicator",
377
- "data-rank": sortRank ?? void 0,
378
- "data-sorted": isSorted ? "" : void 0,
379
- "data-dir": activeSort?.direction,
380
- "aria-hidden": "true",
381
- children: /* @__PURE__ */ jsx(UpIcon, {})
382
- }) : null;
383
- const hasCustomRightIcon = header?.rightIcon != null;
384
- const rightIcon = hasCustomRightIcon ? header.rightIcon : sortIndicator;
385
- const suffixContent = hasCustomRightIcon ? sortIndicator : null;
386
- const suffix = header?.suffix != null || suffixContent ? /* @__PURE__ */ jsxs(Fragment$1, { children: [header?.suffix, suffixContent] }) : void 0;
387
- const content = header?.render ? header.render(ctx) : column.title == null && !header ? null : /* @__PURE__ */ jsx(TableHeaderItem, {
388
- icon: header?.icon,
389
- rightIcon,
390
- prefix: header?.prefix,
391
- suffix,
392
- description: header?.description,
393
- descriptionPlacement: header?.descriptionPlacement,
394
- tooltip: header?.tooltip ?? true,
395
- theme: header?.theme,
396
- actions: header?.actions,
397
- autoHideActions: header?.autoHideActions ?? true,
398
- styles: header?.styles,
399
- children: column.title
400
- });
401
- return /* @__PURE__ */ jsxs("th", {
402
- "data-element": "HeaderCell",
403
- "data-key": column.key,
404
- "data-pin": column.pin,
405
- "data-pin-edge": column.isPinEdge ? "" : void 0,
406
- "data-align": header?.align ?? column.align,
407
- "data-sortable": isSortable ? "" : void 0,
408
- "data-resizable": canResize ? "" : void 0,
409
- "data-last-column": lastColumnFlag(column),
410
- "data-sorted": isSorted ? "" : void 0,
411
- role: "columnheader",
412
- scope: "col",
413
- tabIndex: isSortable ? 0 : -1,
414
- "aria-colindex": column.ariaColIndex,
415
- "aria-sort": activeSort ? ARIA_SORT[activeSort.direction] : void 0,
416
- style: pinStyle(column),
417
- onClick: isSortable ? () => onColumnSort?.(column.key) : void 0,
418
- onKeyDown: isSortable ? (event) => {
419
- if (event.key !== "Enter" && event.key !== " ") return;
420
- event.preventDefault();
421
- onColumnSort?.(column.key);
422
- } : void 0,
423
- children: [content, canResize ? /* @__PURE__ */ jsx(ColumnResizer, {
424
- column,
425
- label: t("itemTable.resizeColumn", "Resize column"),
426
- onResize: onColumnResize,
427
- onResizeEnd: onColumnResizeEnd
428
- }) : null]
429
- }, column.key);
430
- }
431
- function renderCell(column, row, rowIndex, rowKey, isLastRow, pinnedEdge) {
432
- if (column.key === SELECTION_COLUMN_KEY) return renderSelectionCell(column, row, rowIndex, rowKey, isLastRow, pinnedEdge);
433
- if (column.key === ROW_NUMBER_COLUMN_KEY) return /* @__PURE__ */ jsx("td", {
434
- "data-element": "Cell",
435
- "data-key": column.key,
436
- "data-kind": "row-number",
437
- "data-last-row": isLastRow ? "" : void 0,
438
- "data-pinned": pinnedEdge,
439
- "data-last-column": lastColumnFlag(column),
440
- "data-corner": bottomCornerFlag(column, rowIndex, isLastRow, pinnedEdge),
441
- role: "gridcell",
442
- "aria-colindex": column.ariaColIndex,
443
- style: pinStyle(column),
444
- children: pinnedEdge ? null : rowNumberOffset + rowIndex + 1
445
- }, column.key);
446
- if (column.key === ROW_MENU_COLUMN_KEY) return renderRowMenuCell(column, row, rowIndex, rowKey, isLastRow, pinnedEdge);
447
- const ctx = {
448
- row,
449
- rowKey,
450
- rowIndex,
451
- columnKey: column.key,
452
- columnIndex: column.index,
453
- section: sectionOf(pinnedEdge),
454
- isSelected: selection?.isSelected(rowKey) ?? false
455
- };
456
- const value = column.isStructural ? void 0 : getColumnValue(column, row, rowIndex);
457
- const rendered = column.render ? column.render(value, row, rowIndex, ctx) : column.isStructural ? null : getColumnText(column, row, rowIndex);
458
- const isText = typeof rendered === "string" || typeof rendered === "number" || typeof rendered === "bigint";
459
- const content = isText && !column.autoHeight ? /* @__PURE__ */ jsx(TextItem, { children: String(rendered) }) : isText ? String(rendered) : rendered;
460
- const resolvedCellStyles = typeof column.cellStyles === "function" ? column.cellStyles(ctx) : column.cellStyles;
461
- const CellTag = column.isRowHeader ? "th" : "td";
462
- const link = column.isRowHeader ? rowLink?.(row, rowIndex) : void 0;
463
- return /* @__PURE__ */ jsxs(CellTag, {
464
- "data-element": "Cell",
465
- "data-key": column.key,
466
- "data-pin": column.pin,
467
- "data-pin-edge": column.isPinEdge ? "" : void 0,
468
- "data-align": column.align,
469
- "data-wrap": column.autoHeight ? "" : void 0,
470
- "data-link": link !== void 0 ? "" : void 0,
471
- "data-last-row": isLastRow ? "" : void 0,
472
- "data-pinned": pinnedEdge,
473
- "data-last-column": lastColumnFlag(column),
474
- "data-corner": bottomCornerFlag(column, rowIndex, isLastRow, pinnedEdge),
475
- "data-cell-selected": isCellSelected(rowKey, column.key) ? "" : void 0,
476
- ...column.isRowHeader ? { scope: "row" } : { role: "gridcell" },
477
- ...cellSelectionProps(rowKey, column.key, pinnedEdge),
478
- "aria-colindex": column.ariaColIndex,
479
- style: {
480
- ...pinStyle(column),
481
- ...resolvedCellStyles
482
- },
483
- ...column.cellProps?.(ctx),
484
- children: [content, link !== void 0 ? /* @__PURE__ */ jsx(Action, {
485
- "data-element": "RowLink",
486
- to: link,
487
- tabIndex: -1,
488
- "aria-label": getColumnText(column, row, rowIndex) ?? void 0
489
- }) : null]
490
- }, column.key);
491
- }
492
- /**
493
- * A pinned row — a total or subtotal.
494
- *
495
- * Rendered inside `<tbody>` rather than `<thead>`/`<tfoot>` so it keeps the
496
- * body's own row and cell styling: the sub-element chains are anchored to
497
- * `Body`, and a row in the head would match none of them. `data-pinned`
498
- * carries the stickiness instead.
499
- */
500
- function renderPinnedRow(row, index, edge) {
501
- const rowKey = getRowKey(row, index);
502
- return /* @__PURE__ */ jsx("tr", {
503
- "data-element": "Row",
504
- "data-pinned": edge,
505
- role: "row",
506
- "aria-rowindex": pinnedRowIndex(index, edge),
507
- children: columns.map((column) => renderCell(column, row, index, rowKey, false, edge))
508
- }, `pinned-${edge}-${rowKey}`);
509
- }
510
- /** The cells of one body row. Shared by both render paths. */
511
- function renderRowCells(row, rowIndex) {
512
- const rowKey = getRowKey(row, rowIndex);
513
- return columns.map((column) => renderCell(column, row, rowIndex, rowKey, rowIndex === rows.length - 1));
514
- }
515
- /**
516
- * The `<tr>` shell. Virtuoso owns the element in the virtualized path (it
517
- * needs its own `style` and measurement attributes), so this returns the
518
- * props rather than the element.
519
- */
520
- function getRowElementProps(row, rowIndex) {
521
- const rowKey = getRowKey(row, rowIndex);
522
- const isSelected = selection?.isSelected(rowKey) ?? false;
523
- const extra = getRowProps?.({
524
- row,
525
- rowKey,
526
- rowIndex,
527
- section: "body",
528
- isSelected
529
- });
530
- return {
531
- "data-element": "Row",
532
- "data-key": String(rowKey),
533
- "data-row-index": rowIndex,
534
- "data-qa": extra?.qa,
535
- "data-odd": isStriped && rowIndex % 2 === 1 ? "" : void 0,
536
- "data-dimmed": extra?.isDimmed ? "" : void 0,
537
- "data-selected": isSelected ? "" : void 0,
538
- "data-disabled": selection?.isRowDisabled(rowKey) ? "" : void 0,
539
- role: "row",
540
- tabIndex: isReorderable ? rowIndex === focusedRowIndex ? 0 : -1 : void 0,
541
- "aria-selected": selection?.isEnabled ? isSelected : void 0,
542
- "aria-rowindex": bodyRowIndex(rowIndex),
543
- title: extra?.tooltip,
544
- height: extra?.height,
545
- "data-clickable": onRowAction != null || rowLink?.(row, rowIndex) !== void 0 ? "" : void 0,
546
- onClick: onRowAction != null ? (event) => {
547
- if (event.target.closest("a, button, input, select, textarea, [role=\"button\"], [role=\"menuitem\"]")) return;
548
- onRowAction(row, rowKey);
549
- } : void 0,
550
- onContextMenu: isMenuEnabled ? (event) => openContextMenuFor(row, rowIndex, rowKey, event) : void 0,
551
- ...Object.fromEntries(Object.entries(extra?.mods ?? {}).filter(([, active]) => active).map(([name]) => [`data-${name}`, ""]))
552
- };
553
- }
554
- function renderRow(row, rowIndex, isVirtual = false) {
555
- const { height, ...rowProps } = getRowElementProps(row, rowIndex);
556
- return /* @__PURE__ */ jsx(TableRow, {
557
- rowKey: getRowKey(row, rowIndex),
558
- rowProps,
559
- height,
560
- index: isVirtual ? rowIndex : void 0,
561
- measureRef: isVirtual ? virtualizer.measureElement : void 0,
562
- dragState: isReorderable ? dragState : void 0,
563
- dropState: isReorderable ? dropState : void 0,
564
- children: renderRowCells(row, rowIndex)
565
- }, rowProps["data-key"]);
566
- }
567
- function renderSpacerRow(height, position) {
568
- if (height <= 0) return null;
569
- return /* @__PURE__ */ jsx("tr", {
570
- "aria-hidden": "true",
571
- "data-spacer": position,
572
- children: /* @__PURE__ */ jsx("td", {
573
- colSpan: Math.max(columnCount, 1),
574
- style: { height }
575
- })
576
- });
577
- }
578
- /**
579
- * A row, preceded by the line showing a drop above it — and followed by one
580
- * for the very last row, which has nothing after it to carry a "before".
581
- *
582
- * The indicators render nothing unless a drag is in flight, so a table that
583
- * is merely *capable* of dragging keeps its ordinary structure.
584
- */
585
- function withDropIndicators(row, index, isVirtual = false) {
586
- const rowKey = getRowKey(row, index);
587
- const rowNode = renderRow(row, index, isVirtual);
588
- if (!isReorderable || !dropState) return rowNode;
589
- return /* @__PURE__ */ jsxs(Fragment, { children: [
590
- /* @__PURE__ */ jsx(TableRowDropIndicator, {
591
- rowKey,
592
- dropPosition: "before",
593
- dropState,
594
- columnCount
595
- }),
596
- rowNode,
597
- index === rows.length - 1 ? /* @__PURE__ */ jsx(TableRowDropIndicator, {
598
- rowKey,
599
- dropPosition: "after",
600
- dropState,
601
- columnCount
602
- }) : null
603
- ] }, `row-${String(rowKey)}`);
604
- }
605
- const hasRows = rows.length > 0;
606
- const isStale = isLoading && hasRows && loadingIndicator === "overlay";
607
- const showSkeleton = isLoading && loadingIndicator !== "none" && (!hasRows || loadingIndicator === "skeleton");
608
- const showBlank = isLoading && !hasRows && loadingIndicator === "none";
609
- const shouldVirtualize = hasRows && error == null && (isVirtualized === true || isVirtualized === "auto" && rows.length > virtualizeThreshold);
610
- const rowsRef = useRef(rows);
611
- rowsRef.current = rows;
612
- const virtualizer = useVirtualizer({
613
- count: shouldVirtualize ? rows.length : 0,
614
- getScrollElement: () => scrollerRef.current,
615
- getItemKey: (index) => String(getRowKey(rowsRef.current[index], index)),
616
- estimateSize: () => (rowHeight ?? ESTIMATED_ROW_HEIGHT[size ?? "medium"]) + 1,
617
- measureElement: (element) => element.getBoundingClientRect().height,
618
- overscan
619
- });
620
- const scrollability = useScrollability(scrollerEl);
621
- /**
622
- * Roving tabindex over the rows, so a reorderable table can be operated from
623
- * the keyboard at all.
624
- *
625
- * React Aria's `dragProps` already describe "press Enter to start dragging"
626
- * and implement the whole keyboard drag — but a `<tr>` is not focusable, so
627
- * without this the description is announced for a row nobody can reach. One
628
- * tab stop for the grid, arrows to move within it, matching how every other
629
- * collection in the kit behaves.
630
- */
631
- const [focusedRowIndex, setFocusedRowIndex] = useState(0);
632
- const [isRangeDragging, setIsRangeDragging] = useState(false);
633
- useEffect(() => {
634
- if (!isRangeDragging) return;
635
- const end = () => {
636
- if (cellSelection) cellSelection.isDraggingRef.current = false;
637
- setIsRangeDragging(false);
638
- };
639
- window.addEventListener("pointerup", end);
640
- window.addEventListener("pointercancel", end);
641
- return () => {
642
- window.removeEventListener("pointerup", end);
643
- window.removeEventListener("pointercancel", end);
644
- };
645
- }, [isRangeDragging, cellSelection]);
646
- const moveRowFocus = useEvent((from, delta) => {
647
- const current = from.closest("tr[data-element=\"Row\"]");
648
- const all = Array.from(scrollerRef.current?.querySelectorAll("tbody tr[data-element=\"Row\"]:not([data-placeholder])") ?? []);
649
- if (!all.length) return false;
650
- const index = current ? all.indexOf(current) : -1;
651
- const next = Math.min(Math.max((index === -1 ? focusedRowIndex : index) + delta, 0), all.length - 1);
652
- setFocusedRowIndex(next);
653
- all[next]?.focus();
654
- return true;
655
- });
656
- const sentinelRef = useRef(null);
657
- const onLoadMoreEvent = useEvent(() => onLoadMore?.());
658
- useEffect(() => {
659
- const sentinel = sentinelRef.current;
660
- if (!onLoadMore || !hasMore || isLoadingMore || !scrollerEl || !sentinel) return;
661
- const observer = new IntersectionObserver((entries) => {
662
- if (entries.some((entry) => entry.isIntersecting)) onLoadMoreEvent();
663
- }, {
664
- root: scrollerEl,
665
- rootMargin: `0px 0px ${loadMoreMargin}px 0px`
666
- });
667
- observer.observe(sentinel);
668
- return () => observer.disconnect();
669
- }, [
670
- onLoadMore,
671
- hasMore,
672
- isLoadingMore,
673
- scrollerEl,
674
- loadMoreMargin,
675
- onLoadMoreEvent,
676
- rows.length
677
- ]);
678
- const contextMenu = useContextMenu(__Menu, { placement: "bottom start" });
679
- const isMenuEnabled = rowMenu != null && rowContextMenu !== false;
680
- function resolveRowMenu(row, rowIndex, rowKey) {
681
- if (!rowMenu) return null;
682
- return rowMenu(row, {
683
- row,
684
- rowKey,
685
- rowIndex,
686
- section: "body",
687
- isSelected: selection?.isSelected(rowKey) ?? false,
688
- isFocused: false,
689
- isDropTarget: false
690
- });
691
- }
692
- function menuActionHandler(row, rowKey, closeAfter) {
693
- return (action) => {
694
- onRowMenuAction?.(normalizeMenuAction(action), row, rowKey);
695
- if (closeAfter) contextMenu.close();
696
- };
697
- }
698
- const openContextMenuFor = useEvent((row, rowIndex, rowKey, event) => {
699
- const items = resolveRowMenu(row, rowIndex, rowKey);
700
- if (isMenuEmpty(items)) return;
701
- event.preventDefault();
702
- contextMenu.open({
703
- children: items,
704
- onAction: menuActionHandler(row, rowKey, true)
705
- }, void 0, "clientX" in event.nativeEvent ? event.nativeEvent : void 0);
706
- });
707
- /** Resolves the row a pointer or keyboard event landed in. */
708
- function rowFromEvent(target) {
709
- const element = target?.closest?.("tr[data-element=\"Row\"][data-key]");
710
- if (!element) return null;
711
- const index = Number(element.getAttribute("data-row-index"));
712
- if (!Number.isInteger(index)) return null;
713
- const row = rows[index];
714
- return row === void 0 ? null : {
715
- row,
716
- index
717
- };
718
- }
719
- const virtualItems = shouldVirtualize ? virtualizer.getVirtualItems() : [];
720
- const paddingTop = virtualItems.length ? virtualItems[0].start : 0;
721
- const paddingBottom = virtualItems.length ? virtualizer.getTotalSize() - virtualItems[virtualItems.length - 1].end : 0;
722
- const colGroup = /* @__PURE__ */ jsx("colgroup", { children: columns.map((column) => /* @__PURE__ */ jsx("col", { style: column.width != null ? { width: column.width } : void 0 }, column.key)) });
723
- const headerRow = isHeaderHidden ? null : /* @__PURE__ */ jsx("tr", {
724
- "data-element": "HeadRow",
725
- role: "row",
726
- "aria-rowindex": 1,
727
- children: columns.map(renderHeaderCell)
728
- });
729
- const tableProps = {
730
- "data-element": "Table",
731
- role: "grid",
732
- "aria-label": ariaLabel,
733
- "aria-busy": isLoading || void 0,
734
- "aria-rowcount": headerRowCount + pinnedTopCount + bodyRowCount + pinnedBottomCount,
735
- "aria-colcount": columnCount,
736
- "aria-multiselectable": selection?.selectionMode === "multiple" ? true : void 0
737
- };
738
- let bodyContent;
739
- if (error != null) bodyContent = renderStateRow(error);
740
- else if (showSkeleton) bodyContent = renderSkeletonRows();
741
- else if (showBlank) bodyContent = null;
742
- else if (!hasRows) bodyContent = renderStateRow(isFiltered ? noResultsLabel : emptyLabel);
743
- else if (shouldVirtualize) bodyContent = /* @__PURE__ */ jsxs(Fragment$1, { children: [
744
- renderSpacerRow(paddingTop, "top"),
745
- virtualItems.map((v) => withDropIndicators(rows[v.index], v.index, true)),
746
- renderSpacerRow(paddingBottom, "bottom")
747
- ] });
748
- else bodyContent = rows.map((row, index) => withDropIndicators(row, index));
749
- return /* @__PURE__ */ jsxs(TableElement, {
750
- ref: rootRef,
751
- qa: qa || "Table",
752
- styles: mergedStyles,
753
- mods: {
754
- size,
755
- shape,
756
- "sticky-header": isHeaderSticky,
757
- "column-dividers": hasColumnDividers,
758
- "range-dragging": isRangeDragging,
759
- "has-footer": footer != null,
760
- "scroll-x": scrollability.x,
761
- "scroll-y": scrollability.y,
762
- stale: isStale,
763
- ...mods
764
- },
765
- children: [
766
- toolbar,
767
- /* @__PURE__ */ jsx("div", {
768
- "data-element": "Scroller",
769
- ref: handleScrollerRef,
770
- tabIndex: cellSelection?.isEnabled ? -1 : void 0,
771
- onKeyDown: (event) => {
772
- if (event.key === "F10" && event.shiftKey && isMenuEnabled) {
773
- const found = rowFromEvent(event.target);
774
- if (found) {
775
- event.stopPropagation();
776
- openContextMenuFor(found.row, found.index, getRowKey(found.row, found.index), event);
777
- }
778
- return;
779
- }
780
- if (event.key === "Enter" && onRowAction) {
781
- const found = rowFromEvent(event.target);
782
- if (found && !event.target.closest("a, button, input, select, textarea, [role=\"button\"]")) onRowAction(found.row, getRowKey(found.row, found.index));
783
- return;
784
- }
785
- if (isReorderable && (event.key === "ArrowDown" || event.key === "ArrowUp")) {
786
- if (dragState?.draggingKeys?.size) return;
787
- if (moveRowFocus(event.target, event.key === "ArrowDown" ? 1 : -1)) event.preventDefault();
788
- return;
789
- }
790
- if (event.key === "Escape") {
791
- if (cellSelection?.range) {
792
- event.stopPropagation();
793
- cellSelection.clear();
794
- return;
795
- }
796
- if (selection?.isEnabled && selection.selectedCount > 0) {
797
- event.stopPropagation();
798
- selection.clearSelection();
799
- }
800
- }
801
- },
802
- onCopy: (event) => {
803
- if (!cellSelection?.range) return;
804
- const text = cellSelection.getSelectionText((column, row, rowIndex) => column.isStructural ? "" : getColumnText(column, row, rowIndex) ?? "");
805
- if (!text) return;
806
- event.preventDefault();
807
- event.clipboardData.setData("text/plain", text);
808
- event.clipboardData.setData("text/html", toClipboardHtml(text));
809
- toast.success({
810
- title: t("itemTable.copiedToClipboard", "Copied to clipboard"),
811
- description: t("itemTable.copiedCells", "{{count}} cells copied", { count: cellSelection.cellCount })
812
- });
813
- },
814
- children: /* @__PURE__ */ jsxs("table", {
815
- ...tableProps,
816
- style: layout.totalWidth != null ? { width: layout.totalWidth } : void 0,
817
- children: [
818
- colGroup,
819
- isHeaderHidden ? null : /* @__PURE__ */ jsx("thead", {
820
- "data-element": "Head",
821
- children: headerRow
822
- }),
823
- /* @__PURE__ */ jsxs("tbody", {
824
- "data-element": "Body",
825
- ...collectionProps,
826
- ref: bodyRef,
827
- children: [
828
- pinnedTopRows?.map((row, index) => renderPinnedRow(row, index, "top")),
829
- bodyContent,
830
- pinnedBottomRows?.map((row, index) => renderPinnedRow(row, index, "bottom")),
831
- isLoadingMore ? renderSkeletonRows(Math.min(skeletonRowCount, LOAD_MORE_SKELETON_ROWS), "load-more") : null,
832
- onLoadMore && hasRows ? /* @__PURE__ */ jsx("tr", {
833
- "data-sentinel": "",
834
- "aria-hidden": "true",
835
- children: /* @__PURE__ */ jsx("td", {
836
- colSpan: Math.max(columnCount, 1),
837
- style: {
838
- height: 1,
839
- padding: 0,
840
- border: 0
841
- },
842
- children: /* @__PURE__ */ jsx("div", {
843
- ref: sentinelRef,
844
- style: { height: 1 }
845
- })
846
- })
847
- }) : null
848
- ]
849
- })
850
- ]
851
- })
852
- }),
853
- isStale ? /* @__PURE__ */ jsx("div", {
854
- "data-element": "Overlay",
855
- role: "status",
856
- children: /* @__PURE__ */ jsx(LoadingAnimation, { size: "small" })
857
- }) : null,
858
- overlay,
859
- contextMenu.rendered,
860
- footer
861
- ]
862
- });
863
- }
864
-
865
- //#endregion
866
- export { TableView };
867
- //# sourceMappingURL=TableView.js.map