@cube-dev/ui-kit 0.0.0-canary-6334c8a → 0.0.0-canary-04162c5

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