@cube-dev/ui-kit 0.0.0-canary-e76eb3e → 0.0.0-canary-01fea9d
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.
- package/dist/_internal/hooks/use-chained-callback.js +1 -1
- package/dist/_internal/hooks/use-debounced-value.js +1 -1
- package/dist/_internal/hooks/use-deprecation-warning.js +1 -1
- package/dist/_internal/hooks/use-event.js +1 -1
- package/dist/_internal/hooks/use-is-first-render.js +1 -1
- package/dist/_internal/hooks/use-sync-ref.js +1 -1
- package/dist/_internal/hooks/use-timer/timer.js +1 -1
- package/dist/_internal/hooks/use-timer/use-timer.js +1 -1
- package/dist/_internal/hooks/use-warn.js +1 -1
- package/dist/components/Block.js +1 -1
- package/dist/components/CollectionItem.js +1 -1
- package/dist/components/GlobalStyles.js +1 -1
- package/dist/components/GridProvider.js +1 -1
- package/dist/components/HiddenInput.js +1 -1
- package/dist/components/Root.js +1 -1
- package/dist/components/actions/Action/Action.js +1 -1
- package/dist/components/actions/Banner/Banner.js +1 -1
- package/dist/components/actions/Button/Button.js +1 -1
- package/dist/components/actions/ButtonGroup/ButtonGroup.js +1 -1
- package/dist/components/actions/ButtonSplit/ButtonSplit.js +1 -1
- package/dist/components/actions/ButtonSplit/context.js +1 -1
- package/dist/components/actions/CommandMenu/CommandMenu.js +1 -1
- package/dist/components/actions/CommandMenu/styled.js +1 -1
- package/dist/components/actions/ItemAction/ItemAction.js +1 -1
- package/dist/components/actions/ItemActionContext.js +1 -1
- package/dist/components/actions/ItemButton/ItemButton.js +1 -1
- package/dist/components/actions/Link/Link.js +1 -1
- package/dist/components/actions/Menu/Menu.js +1 -1
- package/dist/components/actions/Menu/MenuItem.js +1 -1
- package/dist/components/actions/Menu/MenuSection.js +1 -1
- package/dist/components/actions/Menu/MenuTrigger.js +1 -1
- package/dist/components/actions/Menu/SubMenuTrigger.js +1 -1
- package/dist/components/actions/Menu/SubmenuTriggerContext.js +1 -1
- package/dist/components/actions/Menu/context.js +1 -1
- package/dist/components/actions/Menu/styled.js +1 -1
- package/dist/components/actions/index.js +1 -1
- package/dist/components/actions/use-action.js +1 -1
- package/dist/components/actions/use-anchored-menu.js +1 -1
- package/dist/components/actions/use-context-menu.js +44 -42
- package/dist/components/actions/use-context-menu.js.map +1 -1
- package/dist/components/content/ActiveZone/ActiveZone.js +1 -1
- package/dist/components/content/Alert/Alert.js +1 -1
- package/dist/components/content/Alert/use-alert.js +1 -1
- package/dist/components/content/Avatar/Avatar.js +1 -1
- package/dist/components/content/Badge/Badge.js +1 -1
- package/dist/components/content/Card/Card.js +1 -1
- package/dist/components/content/Content.js +1 -1
- package/dist/components/content/CopyPasteBlock/CopyPasteBlock.js +1 -1
- package/dist/components/content/CopySnippet/CopySnippet.js +1 -1
- package/dist/components/content/Disclosure/Disclosure.js +1 -1
- package/dist/components/content/Divider.js +1 -1
- package/dist/components/content/Footer.js +1 -1
- package/dist/components/content/Header.js +1 -1
- package/dist/components/content/HotKeys/HotKeys.js +1 -1
- package/dist/components/content/InfoBadge/InfoBadge.js +1 -1
- package/dist/components/content/InlineInput/InlineInput.js +1 -1
- package/dist/components/content/Item/Item.js +1 -1
- package/dist/components/content/ItemBadge/ItemBadge.js +1 -1
- package/dist/components/content/ItemCard/ItemCard.js +1 -1
- package/dist/components/content/Layout/GridLayout.js +1 -1
- package/dist/components/content/Layout/Layout.js +1 -1
- package/dist/components/content/Layout/LayoutBlock.js +1 -1
- package/dist/components/content/Layout/LayoutCenter.js +1 -1
- package/dist/components/content/Layout/LayoutContainer.js +1 -1
- package/dist/components/content/Layout/LayoutContent.js +1 -1
- package/dist/components/content/Layout/LayoutContext.js +1 -1
- package/dist/components/content/Layout/LayoutFlex.js +1 -1
- package/dist/components/content/Layout/LayoutFooter.js +1 -1
- package/dist/components/content/Layout/LayoutGrid.js +1 -1
- package/dist/components/content/Layout/LayoutHeader.js +1 -1
- package/dist/components/content/Layout/LayoutPane.js +1 -1
- package/dist/components/content/Layout/LayoutPanel.js +1 -1
- package/dist/components/content/Layout/LayoutPanelHeader.js +1 -1
- package/dist/components/content/Layout/LayoutToolbar.js +1 -1
- package/dist/components/content/Layout/hooks/useTinyScrollbar.js +1 -1
- package/dist/components/content/Layout/index.js +1 -1
- package/dist/components/content/Layout/utils.js +1 -1
- package/dist/components/content/Paragraph.js +1 -1
- package/dist/components/content/Placeholder/Placeholder.js +1 -1
- package/dist/components/content/PrismCode/PrismCode.js +1 -1
- package/dist/components/content/PrismCode/prismSetup.js +1 -1
- package/dist/components/content/PrismDiffCode/PrismDiffCode.js +1 -1
- package/dist/components/content/Result/Result.js +1 -1
- package/dist/components/content/Skeleton/Skeleton.js +1 -1
- package/dist/components/content/Tag/Tag.js +2 -2
- package/dist/components/content/Tag/Tag.js.map +1 -1
- package/dist/components/content/Text.d.ts +14 -14
- package/dist/components/content/Text.js +1 -1
- package/dist/components/content/TextItem/TextItem.js +1 -1
- package/dist/components/content/Title.js +1 -1
- package/dist/components/content/Tree/Tree.js +1 -1
- package/dist/components/content/Tree/TreeNode.js +1 -1
- package/dist/components/content/Tree/styled.js +1 -1
- package/dist/components/content/Tree/tree-index.js +1 -1
- package/dist/components/content/Tree/use-checkbox-tree.js +1 -1
- package/dist/components/content/Tree/use-load-data.js +1 -1
- package/dist/components/content/highlightText.js +1 -1
- package/dist/components/content/use-auto-tooltip.js +1 -1
- package/dist/components/fields/Checkbox/Checkbox.js +1 -1
- package/dist/components/fields/Checkbox/CheckboxGroup.js +1 -1
- package/dist/components/fields/Checkbox/context.js +1 -1
- package/dist/components/fields/ColorInput/ColorInput.d.ts +67 -0
- package/dist/components/fields/ColorInput/ColorInput.js +228 -0
- package/dist/components/fields/ColorInput/ColorInput.js.map +1 -0
- package/dist/components/fields/ColorInput/index.d.ts +2 -0
- package/dist/components/fields/ColorPicker/ColorPicker.d.ts +34 -37
- package/dist/components/fields/ColorPicker/ColorPicker.js +112 -184
- package/dist/components/fields/ColorPicker/ColorPicker.js.map +1 -1
- package/dist/components/fields/ColorPicker/index.d.ts +1 -3
- package/dist/components/fields/ColorSwatchGroup/ColorSwatchGroup.d.ts +50 -0
- package/dist/components/fields/ColorSwatchGroup/ColorSwatchGroup.js +251 -0
- package/dist/components/fields/ColorSwatchGroup/ColorSwatchGroup.js.map +1 -0
- package/dist/components/fields/ColorSwatchGroup/index.d.ts +2 -0
- package/dist/components/fields/ComboBox/ComboBox.js +1 -1
- package/dist/components/fields/CommandTextArea/CommandTextArea.js +1 -1
- package/dist/components/fields/CommandTextArea/caretPosition.js +1 -1
- package/dist/components/fields/CommandTextArea/useCaretAnchor.js +1 -1
- package/dist/components/fields/DatePicker/DateInput.js +1 -1
- package/dist/components/fields/DatePicker/DateInputBase.js +1 -1
- package/dist/components/fields/DatePicker/DatePicker.js +1 -1
- package/dist/components/fields/DatePicker/DatePickerButton.js +1 -1
- package/dist/components/fields/DatePicker/DatePickerElement.js +1 -1
- package/dist/components/fields/DatePicker/DatePickerInput.js +1 -1
- package/dist/components/fields/DatePicker/DatePickerSegment.js +1 -1
- package/dist/components/fields/DatePicker/DateRangePicker.js +1 -1
- package/dist/components/fields/DatePicker/DateRangeSeparatedPicker.js +1 -1
- package/dist/components/fields/DatePicker/MonthPicker.js +1 -1
- package/dist/components/fields/DatePicker/PeriodPicker.js +1 -1
- package/dist/components/fields/DatePicker/QuarterPicker.js +1 -1
- package/dist/components/fields/DatePicker/TimeInput.js +1 -1
- package/dist/components/fields/DatePicker/WeekPicker.js +1 -1
- package/dist/components/fields/DatePicker/YearPicker.js +1 -1
- package/dist/components/fields/DatePicker/parseDate.js +1 -1
- package/dist/components/fields/DatePicker/period.js +1 -1
- package/dist/components/fields/DatePicker/props.js +1 -1
- package/dist/components/fields/DatePicker/utils.js +1 -1
- package/dist/components/fields/FileInput/FileInput.js +1 -1
- package/dist/components/fields/FilterListBox/FilterListBox.js +1 -1
- package/dist/components/fields/FilterPicker/FilterPicker.js +1 -1
- package/dist/components/fields/Input/Input.js +2 -2
- package/dist/components/fields/ListBox/DraggableListBox.js +1 -1
- package/dist/components/fields/ListBox/ListBox.js +1 -1
- package/dist/components/fields/ListBoxPopover/ListBoxPopover.js +1 -1
- package/dist/components/fields/ListBoxPopover/listNavigation.js +1 -1
- package/dist/components/fields/ListBoxPopover/useCompositeFocus.js +1 -1
- package/dist/components/fields/NumberInput/NumberInput.js +1 -1
- package/dist/components/fields/NumberInput/StepButton.js +1 -1
- package/dist/components/fields/PasswordInput/PasswordInput.js +1 -1
- package/dist/components/fields/Picker/Picker.js +1 -1
- package/dist/components/fields/RadioGroup/Radio.d.ts +2 -2
- package/dist/components/fields/RadioGroup/Radio.js +4 -4
- package/dist/components/fields/RadioGroup/Radio.js.map +1 -1
- package/dist/components/fields/RadioGroup/RadioGroup.js +1 -1
- package/dist/components/fields/RadioGroup/context.js +1 -1
- package/dist/components/fields/SearchComboBox/SearchComboBox.js +1 -1
- package/dist/components/fields/SearchInput/SearchInput.js +1 -1
- package/dist/components/fields/Select/Select.js +1 -1
- package/dist/components/fields/Slider/Gradation.js +1 -1
- package/dist/components/fields/Slider/HueSlider.js +1 -1
- package/dist/components/fields/Slider/RangeSlider.js +1 -1
- package/dist/components/fields/Slider/Slider.js +1 -1
- package/dist/components/fields/Slider/SliderBase.js +1 -1
- package/dist/components/fields/Slider/SliderThumb.js +1 -1
- package/dist/components/fields/Slider/SliderTrack.js +1 -1
- package/dist/components/fields/Slider/elements.js +1 -1
- package/dist/components/fields/Slider/index.js +1 -1
- package/dist/components/fields/Switch/Switch.js +1 -1
- package/dist/components/fields/TextArea/TextArea.js +1 -1
- package/dist/components/fields/TextInput/TextInput.js +1 -1
- package/dist/components/fields/TextInput/TextInputBase.js +1 -1
- package/dist/components/fields/TextInputMapper/TextInputMapper.js +1 -1
- package/dist/components/fields/{ColorPicker/ColorPickerPanel.js → color/ColorPanel.js} +13 -11
- package/dist/components/fields/color/ColorPanel.js.map +1 -0
- package/dist/components/fields/color/ColorSwatch.d.ts +22 -0
- package/dist/components/fields/color/ColorSwatch.js +58 -0
- package/dist/components/fields/color/ColorSwatch.js.map +1 -0
- package/dist/components/fields/{ColorPicker → color}/channels.d.ts +1 -1
- package/dist/components/fields/{ColorPicker → color}/channels.js +2 -2
- package/dist/components/fields/color/channels.js.map +1 -0
- package/dist/components/fields/color/color.d.ts +21 -0
- package/dist/components/fields/{ColorPicker → color}/color.js +2 -2
- package/dist/components/fields/color/color.js.map +1 -0
- package/dist/components/fields/color/context.js +20 -0
- package/dist/components/fields/color/context.js.map +1 -0
- package/dist/components/fields/color/index.d.ts +4 -0
- package/dist/components/fields/index.d.ts +9 -3
- package/dist/components/form/FieldWrapper/FieldWrapper.js +1 -1
- package/dist/components/form/Form/Field.js +1 -1
- package/dist/components/form/Form/Form.js +1 -1
- package/dist/components/form/Form/ResetButton/ResetButton.js +1 -1
- package/dist/components/form/Form/SubmitButton/SubmitButton.js +1 -1
- package/dist/components/form/Form/SubmitError.js +1 -1
- package/dist/components/form/Form/index.js +1 -1
- package/dist/components/form/Form/use-field/use-field-props.js +1 -1
- package/dist/components/form/Form/use-field/use-field.js +1 -1
- package/dist/components/form/Form/use-form.js +1 -1
- package/dist/components/form/Form/validation.js +1 -1
- package/dist/components/form/Label.js +1 -1
- package/dist/components/form/validation/ValidationIndicator.js +1 -1
- package/dist/components/form/validation/resolve-validation-props.js +1 -1
- package/dist/components/form/validation/use-validation-props.js +1 -1
- package/dist/components/form/wrapper.js +1 -1
- package/dist/components/helpers/DisplayTransition/DisplayTransition.js +1 -1
- package/dist/components/helpers/IconSwitch/IconSwitch.js +1 -1
- package/dist/components/layout/Board/Board.js +1 -1
- package/dist/components/layout/Board/BoardProvider.js +1 -1
- package/dist/components/layout/Board/BoardResponsive.js +1 -1
- package/dist/components/layout/Board/Widget.js +1 -1
- package/dist/components/layout/Board/WidgetHost.js +1 -1
- package/dist/components/layout/Board/board-context.js +1 -1
- package/dist/components/layout/Board/board-store.js +1 -1
- package/dist/components/layout/Board/grid-core/calculate.js +1 -1
- package/dist/components/layout/Board/grid-core/collision.js +1 -1
- package/dist/components/layout/Board/grid-core/compactors.js +1 -1
- package/dist/components/layout/Board/grid-core/constraints.js +1 -1
- package/dist/components/layout/Board/grid-core/group-move.js +1 -1
- package/dist/components/layout/Board/grid-core/layout.js +1 -1
- package/dist/components/layout/Board/grid-core/sort.js +1 -1
- package/dist/components/layout/Board/index.js +1 -1
- package/dist/components/layout/Board/responsive-utils.js +1 -1
- package/dist/components/layout/Board/use-board-layout.js +1 -1
- package/dist/components/layout/Board/use-board-registry.js +1 -1
- package/dist/components/layout/Board/use-board-select-modifier-key.js +1 -1
- package/dist/components/layout/Board/use-board-selection.js +1 -1
- package/dist/components/layout/Flex.js +1 -1
- package/dist/components/layout/Flow.js +1 -1
- package/dist/components/layout/Grid.js +1 -1
- package/dist/components/layout/Panel.js +1 -1
- package/dist/components/layout/Prefix.js +1 -1
- package/dist/components/layout/ResizablePanel.js +1 -1
- package/dist/components/layout/Space.js +1 -1
- package/dist/components/layout/Suffix.js +1 -1
- package/dist/components/navigation/Tabs/DraggableTabList.js +1 -1
- package/dist/components/navigation/Tabs/TabButton.js +1 -1
- package/dist/components/navigation/Tabs/TabDropIndicator.js +1 -1
- package/dist/components/navigation/Tabs/TabPanel.js +1 -1
- package/dist/components/navigation/Tabs/TabPicker.js +1 -1
- package/dist/components/navigation/Tabs/Tabs.js +1 -1
- package/dist/components/navigation/Tabs/TabsAction.js +1 -1
- package/dist/components/navigation/Tabs/TabsContext.js +1 -1
- package/dist/components/navigation/Tabs/popover-placement.js +1 -1
- package/dist/components/navigation/Tabs/styled.js +1 -1
- package/dist/components/navigation/Tabs/types.js +1 -1
- package/dist/components/navigation/Tabs/use-tab-editing.js +1 -1
- package/dist/components/navigation/Tabs/use-tab-indicator.js +1 -1
- package/dist/components/navigation/index.d.ts +1 -5
- package/dist/components/organisms/StatsCard/StatsCard.js +1 -1
- package/dist/components/other/Calendar/Calendar.js +1 -1
- package/dist/components/other/Calendar/CalendarCell.js +1 -1
- package/dist/components/other/Calendar/CalendarGrid.js +1 -1
- package/dist/components/other/Calendar/PeriodCalendar.js +1 -1
- package/dist/components/other/Calendar/RangeCalendar.js +1 -1
- package/dist/components/other/CubeLogo/CubeLogo.js +1 -1
- package/dist/components/overlays/AlertDialog/AlertDialog.js +1 -1
- package/dist/components/overlays/AlertDialog/AlertDialogApiProvider.js +1 -1
- package/dist/components/overlays/AlertDialog/AlertDialogZone.js +1 -1
- package/dist/components/overlays/Dialog/Dialog.js +1 -1
- package/dist/components/overlays/Dialog/DialogContainer.js +1 -1
- package/dist/components/overlays/Dialog/DialogForm.js +1 -1
- package/dist/components/overlays/Dialog/DialogTrigger.js +1 -1
- package/dist/components/overlays/Dialog/context.js +1 -1
- package/dist/components/overlays/Dialog/use-dialog-container.js +1 -1
- package/dist/components/overlays/Modal/Modal.js +1 -1
- package/dist/components/overlays/Modal/OpenTransitionContext.js +1 -1
- package/dist/components/overlays/Modal/Overlay.js +1 -1
- package/dist/components/overlays/Modal/Popover.js +1 -1
- package/dist/components/overlays/Modal/Tray.js +1 -1
- package/dist/components/overlays/Modal/Underlay.js +1 -1
- package/dist/components/overlays/Notifications/Notification.js +1 -1
- package/dist/components/overlays/Notifications/NotificationAction.js +1 -1
- package/dist/components/overlays/Notifications/NotificationCard.js +1 -1
- package/dist/components/overlays/Notifications/NotificationContext.js +1 -1
- package/dist/components/overlays/Notifications/NotificationItem.js +1 -1
- package/dist/components/overlays/Notifications/OverlayContainer.js +1 -1
- package/dist/components/overlays/Notifications/OverlayProvider.js +1 -1
- package/dist/components/overlays/Notifications/PersistentNotificationsList.js +1 -1
- package/dist/components/overlays/Notifications/dismissed-storage.js +1 -1
- package/dist/components/overlays/Notifications/format-relative-time.js +1 -1
- package/dist/components/overlays/Notifications/index.js +1 -1
- package/dist/components/overlays/Notifications/use-notification-state.js +1 -1
- package/dist/components/overlays/Notifications/use-notifications.js +1 -1
- package/dist/components/overlays/Notifications/use-overlay-timers.js +1 -1
- package/dist/components/overlays/Notifications/use-persistent-notifications.js +1 -1
- package/dist/components/overlays/Notifications/use-persistent-state.js +1 -1
- package/dist/components/overlays/Notifications/use-toast-state.js +1 -1
- package/dist/components/overlays/Toast/ToastItem.js +1 -1
- package/dist/components/overlays/Toast/index.js +1 -1
- package/dist/components/overlays/Toast/useProgressToast.js +1 -1
- package/dist/components/overlays/Toast/useToast.js +1 -1
- package/dist/components/overlays/Tooltip/Tooltip.js +1 -1
- package/dist/components/overlays/Tooltip/TooltipProvider.js +1 -1
- package/dist/components/overlays/Tooltip/TooltipTrigger.js +1 -1
- package/dist/components/overlays/Tooltip/context.js +1 -1
- package/dist/components/portal/Portal.js +1 -1
- package/dist/components/portal/PortalProvider.js +1 -1
- package/dist/components/portal/usePortal.js +1 -1
- package/dist/components/shared/DraggableCollection.js +8 -24
- package/dist/components/shared/DraggableCollection.js.map +1 -1
- package/dist/components/shared/InvalidIcon.js +1 -1
- package/dist/components/shared/ValidIcon.js +1 -1
- package/dist/components/status/LoadingAnimation/LoadingAnimation.js +1 -1
- package/dist/components/status/Spin/Cube.js +1 -1
- package/dist/components/status/Spin/InternalSpinner.js +1 -1
- package/dist/components/status/Spin/Spin.js +1 -1
- package/dist/components/status/Spin/SpinsContainer.js +1 -1
- package/dist/data/item-themes.js +1 -1
- package/dist/data/themes.js +1 -1
- package/dist/eslint-plugin/defaults.generated.js +1 -199
- package/dist/eslint-plugin/defaults.generated.js.map +1 -1
- package/dist/eslint-plugin/index.js +1 -1
- package/dist/eslint-plugin/rules/no-redundant-default-prop.js +1 -1
- package/dist/i18n/I18nProvider.js +1 -1
- package/dist/i18n/createFormatter.js +1 -1
- package/dist/i18n/index.js +1 -1
- package/dist/i18n/instance.js +1 -1
- package/dist/i18n/locales/de-DE/uikit.js +1 -35
- package/dist/i18n/locales/en-US/uikit.js +1 -35
- package/dist/i18n/locales/en-US/uikit.json.d.ts +1 -40
- package/dist/i18n/locales/es-ES/uikit.js +1 -35
- package/dist/i18n/locales/es-MX/uikit.js +1 -35
- package/dist/i18n/locales/fr-FR/uikit.js +1 -35
- package/dist/i18n/locales/it-IT/uikit.js +1 -35
- package/dist/i18n/locales/ja-JP/uikit.js +1 -35
- package/dist/i18n/locales/nb-NO/uikit.js +1 -35
- package/dist/i18n/locales/pt-BR/uikit.js +1 -35
- package/dist/i18n/locales/pt-PT/uikit.js +1 -35
- package/dist/i18n/locales/sv-SE/uikit.js +1 -35
- package/dist/i18n/locales/vi-VN/uikit.js +1 -35
- package/dist/i18n/locales.js +1 -1
- package/dist/i18n/useFormatter.js +1 -1
- package/dist/i18n/useI18n.js +1 -1
- package/dist/icons/AdjustmentsHorizontalIcon.js +1 -1
- package/dist/icons/AdjustmentsIcon.js +1 -1
- package/dist/icons/AiIcon.js +1 -1
- package/dist/icons/AreaChartIcon.js +1 -1
- package/dist/icons/BackwardIcon.js +1 -1
- package/dist/icons/BarChartIcon.js +1 -1
- package/dist/icons/BellFilledIcon.js +1 -1
- package/dist/icons/BellIcon.js +1 -1
- package/dist/icons/BooleanIcon.js +1 -1
- package/dist/icons/CalendarEditIcon.js +1 -1
- package/dist/icons/CalendarIcon.js +1 -1
- package/dist/icons/CaretDownIcon.js +1 -1
- package/dist/icons/CaretUpIcon.js +1 -1
- package/dist/icons/ChartAreaStackedIcon.js +1 -1
- package/dist/icons/ChartAreaStackedPercentageIcon.js +1 -1
- package/dist/icons/ChartBarGroupedHorizontalIcon.js +1 -1
- package/dist/icons/ChartBarGroupedIcon.js +1 -1
- package/dist/icons/ChartBarHorizontalIcon.js +1 -1
- package/dist/icons/ChartBarLineIcon.js +1 -1
- package/dist/icons/ChartBarStackedHorizontalIcon.js +1 -1
- package/dist/icons/ChartBarStackedIcon.js +1 -1
- package/dist/icons/ChartBarStackedPercentageHorizontalIcon.js +1 -1
- package/dist/icons/ChartBarStackedPercentageIcon.js +1 -1
- package/dist/icons/ChartBoxPlot2Icon.js +1 -1
- package/dist/icons/ChartBoxPlotIcon.js +1 -1
- package/dist/icons/ChartBubbleIcon.js +1 -1
- package/dist/icons/ChartDonut2Icon.js +1 -1
- package/dist/icons/ChartFunnelIcon.js +1 -1
- package/dist/icons/ChartHeatmapIcon.js +1 -1
- package/dist/icons/ChartKPIIcon.js +1 -1
- package/dist/icons/ChartPie2Icon.js +1 -1
- package/dist/icons/ChartScatterIcon.js +1 -1
- package/dist/icons/CheckCircleFilledIcon.js +1 -1
- package/dist/icons/CheckCircleIcon.js +1 -1
- package/dist/icons/CheckIcon.js +1 -1
- package/dist/icons/CircleFilledIcon.js +1 -1
- package/dist/icons/ClearIcon.js +1 -1
- package/dist/icons/CloseCircleFilledIcon.js +1 -1
- package/dist/icons/CloseCircleIcon.js +1 -1
- package/dist/icons/CloseIcon.js +1 -1
- package/dist/icons/CodeIcon.js +1 -1
- package/dist/icons/ColumnTotalIcon.js +1 -1
- package/dist/icons/CopyIcon.js +1 -1
- package/dist/icons/CountIcon.js +1 -1
- package/dist/icons/CubeIcon.js +1 -1
- package/dist/icons/CubePauseIcon.js +1 -1
- package/dist/icons/CubePlayIcon.js +1 -1
- package/dist/icons/CurrencyDollarIcon.js +1 -1
- package/dist/icons/DangerIcon.js +1 -1
- package/dist/icons/DashboardIcon.js +1 -1
- package/dist/icons/DatabaseIcon.js +1 -1
- package/dist/icons/DecimalDecreaseIcon.js +1 -1
- package/dist/icons/DecimalIncreaseIcon.js +1 -1
- package/dist/icons/DirectionIcon.js +1 -1
- package/dist/icons/DonutIcon.js +1 -1
- package/dist/icons/DownIcon.js +1 -1
- package/dist/icons/EditIcon.js +1 -1
- package/dist/icons/ExclamationCircleFilledIcon.js +1 -1
- package/dist/icons/ExclamationCircleIcon.js +1 -1
- package/dist/icons/ExclamationIcon.js +1 -1
- package/dist/icons/EyeIcon.js +1 -1
- package/dist/icons/EyeInvisibleIcon.js +1 -1
- package/dist/icons/FilterIcon.js +1 -1
- package/dist/icons/FolderFilledIcon.js +1 -1
- package/dist/icons/FolderIcon.js +1 -1
- package/dist/icons/FolderOpenFilledIcon.js +1 -1
- package/dist/icons/FolderOpenIcon.js +1 -1
- package/dist/icons/ForwardIcon.js +1 -1
- package/dist/icons/GripVerticalIcon.js +1 -1
- package/dist/icons/HierarchyIcon.js +1 -1
- package/dist/icons/HierarchyOpenIcon.js +1 -1
- package/dist/icons/Icon.js +1 -1
- package/dist/icons/InfoCircleIcon.js +1 -1
- package/dist/icons/InfoIcon.js +1 -1
- package/dist/icons/KeyIcon.js +1 -1
- package/dist/icons/LeftIcon.js +1 -1
- package/dist/icons/LineChartIcon.js +1 -1
- package/dist/icons/LoadingIcon.js +1 -1
- package/dist/icons/LockFilledIcon.js +1 -1
- package/dist/icons/LockIcon.js +1 -1
- package/dist/icons/MoreIcon.js +1 -1
- package/dist/icons/NotAllowedIcon.js +1 -1
- package/dist/icons/Number123Icon.js +1 -1
- package/dist/icons/NumberIcon.js +1 -1
- package/dist/icons/PauseCircleFilledIcon.js +1 -1
- package/dist/icons/PauseCircleIcon.js +1 -1
- package/dist/icons/PauseIcon.js +1 -1
- package/dist/icons/PercentageIcon.js +1 -1
- package/dist/icons/PieChartIcon.js +1 -1
- package/dist/icons/PipetteIcon.js +1 -1
- package/dist/icons/PlayCircleIcon.js +1 -1
- package/dist/icons/PlayIcon.js +1 -1
- package/dist/icons/PlusIcon.js +1 -1
- package/dist/icons/ProgressBarIcon.js +1 -1
- package/dist/icons/ReloadIcon.js +1 -1
- package/dist/icons/ReportIcon.js +1 -1
- package/dist/icons/ReturnIcon.js +1 -1
- package/dist/icons/RightIcon.js +1 -1
- package/dist/icons/RowTotalsIcon.js +1 -1
- package/dist/icons/SchemeIcon.js +1 -1
- package/dist/icons/SearchIcon.js +1 -1
- package/dist/icons/SemanticQueryIcon.js +1 -1
- package/dist/icons/SettingsIcon.js +1 -1
- package/dist/icons/ShieldFilledIcon.js +1 -1
- package/dist/icons/ShieldIcon.js +1 -1
- package/dist/icons/SlashIcon.js +1 -1
- package/dist/icons/SparklesIcon.js +1 -1
- package/dist/icons/SqlIcon.js +1 -1
- package/dist/icons/StatsIcon.js +1 -1
- package/dist/icons/StopIcon.js +1 -1
- package/dist/icons/StringIcon.js +1 -1
- package/dist/icons/SubtotalsIcon.js +1 -1
- package/dist/icons/SwitchIcon.js +1 -1
- package/dist/icons/TableIcon.js +1 -1
- package/dist/icons/ThumbsDownIcon.js +1 -1
- package/dist/icons/ThumbsUpIcon.js +1 -1
- package/dist/icons/ThunderboltCrossedIcon.js +1 -1
- package/dist/icons/ThunderboltFilledIcon.js +1 -1
- package/dist/icons/ThunderboltIcon.js +1 -1
- package/dist/icons/TimeIcon.js +1 -1
- package/dist/icons/TrashIcon.js +1 -1
- package/dist/icons/UnlockIcon.js +1 -1
- package/dist/icons/UpIcon.js +1 -1
- package/dist/icons/UserGroupIcon.js +1 -1
- package/dist/icons/UserIcon.js +1 -1
- package/dist/icons/UserLockIcon.js +1 -1
- package/dist/icons/ViewIcon.js +1 -1
- package/dist/icons/WarningFilledIcon.js +1 -1
- package/dist/icons/WarningIcon.js +1 -1
- package/dist/icons/wrap-icon.js +1 -1
- package/dist/index.d.ts +15 -22
- package/dist/index.js +9 -10
- package/dist/index.js.map +1 -1
- package/dist/provider.js +1 -1
- package/dist/providers/TrackingProvider.js +1 -1
- package/dist/providers/navigationAdapter.default.js +1 -1
- package/dist/tokens/base.js +1 -1
- package/dist/tokens/colors.js +1 -1
- package/dist/tokens/index.js +1 -1
- package/dist/tokens/layout.js +1 -1
- package/dist/tokens/lazy-styles.js +1 -1
- package/dist/tokens/palette-config.js +1 -1
- package/dist/tokens/palette.js +1 -1
- package/dist/tokens/shadows.js +1 -1
- package/dist/tokens/sizes.js +1 -1
- package/dist/tokens/spacing.js +1 -1
- package/dist/tokens/typography.d.ts +1 -1
- package/dist/tokens/typography.js +2 -11
- package/dist/tokens/typography.js.map +1 -1
- package/dist/utils/ResizeSensor.js +1 -1
- package/dist/utils/is-dev-env.js +1 -1
- package/dist/utils/modules.js +1 -1
- package/dist/utils/promise.js +1 -1
- package/dist/utils/raf.js +1 -1
- package/dist/utils/random.js +1 -1
- package/dist/utils/range.js +1 -1
- package/dist/utils/react/RenderCache.js +1 -1
- package/dist/utils/react/Slots.js +1 -1
- package/dist/utils/react/chain.js +1 -1
- package/dist/utils/react/forwardRefWithGenerics.js +1 -1
- package/dist/utils/react/index.js +1 -1
- package/dist/utils/react/interactions.js +1 -1
- package/dist/utils/react/isTextOnly.js +1 -1
- package/dist/utils/react/mapProps.js +1 -1
- package/dist/utils/react/mergeProps.js +1 -1
- package/dist/utils/react/nullableValue.js +1 -1
- package/dist/utils/react/resolveIcon.js +1 -1
- package/dist/utils/react/sharedStore.js +1 -1
- package/dist/utils/react/useCombinedRefs.js +1 -1
- package/dist/utils/react/useControlledFocusVisible.js +1 -1
- package/dist/utils/react/useEventBus.js +1 -1
- package/dist/utils/react/useId.js +1 -1
- package/dist/utils/react/useIsDarwin.js +1 -1
- package/dist/utils/react/useKeySymbols.js +1 -1
- package/dist/utils/react/useLayoutEffect.js +1 -1
- package/dist/utils/react/useLocalStorage.js +1 -1
- package/dist/utils/react/useMergeStyles.js +1 -1
- package/dist/utils/react/usePopoverSync.js +1 -1
- package/dist/utils/react/useQaProps.js +1 -1
- package/dist/utils/react/useViewportSize.js +1 -1
- package/dist/utils/react/wrapNodeIfPlain.js +1 -1
- package/dist/utils/selection.js +1 -1
- package/dist/utils/styles.js +1 -1
- package/dist/utils/tree.js +1 -1
- package/dist/utils/warnings.js +1 -1
- package/dist/version.js +2 -2
- package/docs/components/fields/ColorInput.md +272 -0
- package/docs/components/fields/ColorPicker.md +80 -146
- package/docs/components/fields/ColorSwatchGroup.md +206 -0
- package/package.json +3 -8
- package/dist/components/data/DataTable/DataTable.d.ts +0 -13
- package/dist/components/data/DataTable/DataTable.js +0 -242
- package/dist/components/data/DataTable/DataTable.js.map +0 -1
- package/dist/components/data/DataTable/index.d.ts +0 -3
- package/dist/components/data/DataTable/types.d.ts +0 -140
- package/dist/components/data/ItemTable/ItemTable.d.ts +0 -19
- package/dist/components/data/ItemTable/ItemTable.js +0 -347
- package/dist/components/data/ItemTable/ItemTable.js.map +0 -1
- package/dist/components/data/ItemTable/ItemTableBulkBar.d.ts +0 -23
- package/dist/components/data/ItemTable/ItemTableBulkBar.js +0 -131
- package/dist/components/data/ItemTable/ItemTableBulkBar.js.map +0 -1
- package/dist/components/data/ItemTable/ItemTableDragPreview.js +0 -46
- package/dist/components/data/ItemTable/ItemTableDragPreview.js.map +0 -1
- package/dist/components/data/ItemTable/ItemTableFooter.js +0 -79
- package/dist/components/data/ItemTable/ItemTableFooter.js.map +0 -1
- package/dist/components/data/ItemTable/ItemTableToolbar.d.ts +0 -34
- package/dist/components/data/ItemTable/ItemTableToolbar.js +0 -91
- package/dist/components/data/ItemTable/ItemTableToolbar.js.map +0 -1
- package/dist/components/data/ItemTable/index.d.ts +0 -4
- package/dist/components/data/ItemTable/types.d.ts +0 -322
- package/dist/components/data/TableBase/ColumnResizer.js +0 -70
- package/dist/components/data/TableBase/ColumnResizer.js.map +0 -1
- package/dist/components/data/TableBase/RowCollection.js +0 -99
- package/dist/components/data/TableBase/RowCollection.js.map +0 -1
- package/dist/components/data/TableBase/TableRow.js +0 -89
- package/dist/components/data/TableBase/TableRow.js.map +0 -1
- package/dist/components/data/TableBase/TableView.d.ts +0 -22
- package/dist/components/data/TableBase/TableView.js +0 -857
- package/dist/components/data/TableBase/TableView.js.map +0 -1
- package/dist/components/data/TableBase/index.d.ts +0 -5
- package/dist/components/data/TableBase/row-menu.js +0 -40
- package/dist/components/data/TableBase/row-menu.js.map +0 -1
- package/dist/components/data/TableBase/styled.d.ts +0 -5
- package/dist/components/data/TableBase/styled.js +0 -504
- package/dist/components/data/TableBase/styled.js.map +0 -1
- package/dist/components/data/TableBase/types.d.ts +0 -161
- package/dist/components/data/TableBase/use-cell-selection.d.ts +0 -3
- package/dist/components/data/TableBase/use-cell-selection.js +0 -0
- package/dist/components/data/TableBase/use-cell-selection.js.map +0 -1
- package/dist/components/data/TableBase/use-container-width.js +0 -35
- package/dist/components/data/TableBase/use-container-width.js.map +0 -1
- package/dist/components/data/TableBase/use-scrollability.js +0 -49
- package/dist/components/data/TableBase/use-scrollability.js.map +0 -1
- package/dist/components/data/TableBase/use-table-columns.d.ts +0 -2
- package/dist/components/data/TableBase/use-table-columns.js +0 -166
- package/dist/components/data/TableBase/use-table-columns.js.map +0 -1
- package/dist/components/data/TableBase/use-table-search.js +0 -50
- package/dist/components/data/TableBase/use-table-search.js.map +0 -1
- package/dist/components/data/TableBase/use-table-selection.d.ts +0 -4
- package/dist/components/data/TableBase/use-table-selection.js +0 -233
- package/dist/components/data/TableBase/use-table-selection.js.map +0 -1
- package/dist/components/data/TableBase/use-table-sort.js +0 -91
- package/dist/components/data/TableBase/use-table-sort.js.map +0 -1
- package/dist/components/data/TableBase/use-table-sorts.js +0 -97
- package/dist/components/data/TableBase/use-table-sorts.js.map +0 -1
- package/dist/components/data/TableBase/use-table-storage.d.ts +0 -8
- package/dist/components/data/TableBase/use-table-storage.js +0 -58
- package/dist/components/data/TableBase/use-table-storage.js.map +0 -1
- package/dist/components/data/index.d.ts +0 -10
- package/dist/components/fields/ColorPicker/ColorPickerPanel.js.map +0 -1
- package/dist/components/fields/ColorPicker/channels.js.map +0 -1
- package/dist/components/fields/ColorPicker/color.d.ts +0 -15
- package/dist/components/fields/ColorPicker/color.js.map +0 -1
- package/dist/components/navigation/Pagination/Pagination.d.ts +0 -9
- package/dist/components/navigation/Pagination/Pagination.js +0 -258
- package/dist/components/navigation/Pagination/Pagination.js.map +0 -1
- package/dist/components/navigation/Pagination/index.d.ts +0 -4
- package/dist/components/navigation/Pagination/types.d.ts +0 -81
- package/dist/components/navigation/Pagination/use-pagination.d.ts +0 -52
- package/dist/components/navigation/Pagination/use-pagination.js +0 -83
- package/dist/components/navigation/Pagination/use-pagination.js.map +0 -1
- package/docs/components/data/DataTable.md +0 -286
- package/docs/components/data/ItemTable.md +0 -970
- package/docs/components/navigation/Pagination.md +0 -245
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
# ColorSwatchGroup
|
|
2
|
+
|
|
3
|
+
A grid of color swatches, one of which can be selected. It is the palette half
|
|
4
|
+
of choosing a color, where [ColorPicker](./ColorPicker.md) is the
|
|
5
|
+
freeform half — and the two compose: pass `swatches` to a `ColorPicker` and the
|
|
6
|
+
palette appears under the editor.
|
|
7
|
+
|
|
8
|
+
Under the hood it is a radio group, so one tab stop and arrow keys move between
|
|
9
|
+
swatches. The API is shaped after `Picker` rather than `RadioGroup`: colors go in
|
|
10
|
+
as data, not as children.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
- A brand or theme palette where freeform color would be wrong
|
|
15
|
+
- Chart series, tag and label colors — a small approved set
|
|
16
|
+
- Inside a `ColorPicker` popover, as a shortcut past the sliders
|
|
17
|
+
|
|
18
|
+
## Component
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
### Properties
|
|
23
|
+
|
|
24
|
+
- **`colors`** `Array<string | { color: string; label?: string }>` — The colors to offer
|
|
25
|
+
- **`value`** `string | null` — The selected color (controlled)
|
|
26
|
+
- **`defaultValue`** `string | null` — The selected color (uncontrolled)
|
|
27
|
+
- **`onChange`** `(value: string | null) => void` — Fired with the chosen color, written in `format`
|
|
28
|
+
- **`format`** `'hex' | 'rgb' | 'hsl' | 'okhsl' | 'okhst' | 'oklch'` (default: `hex`) — Notation the value is written in
|
|
29
|
+
- **`columns`** `number` — Pin the swatches to a fixed grid. By default they wrap to fill the available width
|
|
30
|
+
- **`allowCustom`** `boolean` (default: `false`) — Append a `ColorPicker` for colors outside the set
|
|
31
|
+
- **`size`** `'small' | 'medium' | 'large'` (default: `medium`) — Size of each swatch
|
|
32
|
+
|
|
33
|
+
### Base Properties
|
|
34
|
+
|
|
35
|
+
Supports [Base properties](../../BaseProperties.md)
|
|
36
|
+
|
|
37
|
+
### Field Properties
|
|
38
|
+
|
|
39
|
+
Supports all [Field properties](../../FieldProperties.md)
|
|
40
|
+
|
|
41
|
+
### Styling Properties
|
|
42
|
+
|
|
43
|
+
#### styles
|
|
44
|
+
|
|
45
|
+
Customizes the grid.
|
|
46
|
+
|
|
47
|
+
#### swatchStyles
|
|
48
|
+
|
|
49
|
+
Customizes an individual swatch.
|
|
50
|
+
|
|
51
|
+
### Style Properties
|
|
52
|
+
|
|
53
|
+
These properties allow direct style application without using the `styles` prop:
|
|
54
|
+
|
|
55
|
+
- **Position:** `gridArea`, `order`, `gridColumn`, `gridRow`, `placeSelf`, `alignSelf`, `justifySelf`, `zIndex`, `margin`, `inset`, `position`, `scrollMargin`
|
|
56
|
+
- **Dimension:** `width`, `height`, `flexBasis`, `flexGrow`, `flexShrink`, `flex`
|
|
57
|
+
- **Block:** `border`, `radius`, `shadow`, `outline`, `padding`, `paddingInline`, `paddingBlock`, `overflow`, `scrollbar`, `textAlign`
|
|
58
|
+
|
|
59
|
+
### Style Props on the group
|
|
60
|
+
|
|
61
|
+
`ColorSwatchGroup` and `ColorPicker` both take the outer and block style props,
|
|
62
|
+
so `radius`, `border`, `padding` and `shadow` work directly on them.
|
|
63
|
+
|
|
64
|
+
### Modifiers
|
|
65
|
+
|
|
66
|
+
The `mods` property accepts the following modifiers you can override:
|
|
67
|
+
|
|
68
|
+
| Modifier | Type | Description |
|
|
69
|
+
| ---------- | --------- | ---------------------------------- |
|
|
70
|
+
| `selected` | `boolean` | The swatch is the selected color |
|
|
71
|
+
| `empty` | `boolean` | The swatch has no color to show |
|
|
72
|
+
| `disabled` | `boolean` | The group is disabled |
|
|
73
|
+
|
|
74
|
+
## ColorSwatch
|
|
75
|
+
|
|
76
|
+
The square itself is exported, for the times you need to show a color without a
|
|
77
|
+
control around it — a legend, a table cell, a summary line. It takes direct
|
|
78
|
+
style props, so its shape and size are yours:
|
|
79
|
+
|
|
80
|
+
```jsx
|
|
81
|
+
<ColorSwatch color="#7a4dbf" radius="round" width="4x" height="4x" />
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
It is decorative on its own: pair it with the value as text, or with something
|
|
85
|
+
that names it.
|
|
86
|
+
|
|
87
|
+
## Swatches must be unique
|
|
88
|
+
|
|
89
|
+
Equivalent colors are collapsed into one swatch, because two entries for the
|
|
90
|
+
same color make selection ambiguous — there would be no way to say which one is
|
|
91
|
+
selected. Matching is done on the canonical hex, so `#ff0000`, `rgb(255 0 0)`
|
|
92
|
+
and `hsl(0 100% 50%)` are one swatch, not three.
|
|
93
|
+
|
|
94
|
+
The same matching decides which swatch a value selects, so `value` need not be
|
|
95
|
+
written in the same notation as the swatch it refers to.
|
|
96
|
+
|
|
97
|
+
## Examples
|
|
98
|
+
|
|
99
|
+
### Basic usage
|
|
100
|
+
|
|
101
|
+
```jsx
|
|
102
|
+
<ColorSwatchGroup
|
|
103
|
+
label="Brand color"
|
|
104
|
+
colors={['#7a4dbf', '#26fcb2', '#ff0000']}
|
|
105
|
+
value={color}
|
|
106
|
+
onChange={setColor}
|
|
107
|
+
/>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Wrapping onto rows
|
|
111
|
+
|
|
112
|
+
By default the swatches wrap to fill whatever width they are given: a single row
|
|
113
|
+
where there is room, more rows where there is not. `columns` pins them to a
|
|
114
|
+
fixed grid instead, sized to the swatches rather than stretched across the
|
|
115
|
+
container.
|
|
116
|
+
|
|
117
|
+
```jsx
|
|
118
|
+
<ColorSwatchGroup colors={palette} columns={4} />
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Naming the swatches
|
|
122
|
+
|
|
123
|
+
A swatch announces its color by default, which is rarely the most useful thing
|
|
124
|
+
to hear. Give the colors names when they have them.
|
|
125
|
+
|
|
126
|
+
```jsx
|
|
127
|
+
<ColorSwatchGroup
|
|
128
|
+
colors={[
|
|
129
|
+
{ color: '#7a4dbf', label: 'Primary' },
|
|
130
|
+
{ color: '#26fcb2', label: 'Success' },
|
|
131
|
+
]}
|
|
132
|
+
/>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Allowing a color outside the set
|
|
136
|
+
|
|
137
|
+
```jsx
|
|
138
|
+
<ColorSwatchGroup colors={palette} allowCustom />
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
The trailing picker shows the current color whenever that color is not one of
|
|
142
|
+
the swatches, so a custom choice stays visible.
|
|
143
|
+
|
|
144
|
+
### Inside a ColorPicker
|
|
145
|
+
|
|
146
|
+
```jsx
|
|
147
|
+
<ColorPicker label="Brand color" swatches={palette} swatchColumns={4} />
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
`allowCustom` is ignored there, and deliberately so: the escape hatch is itself
|
|
151
|
+
a `ColorPicker`, so offering it inside one would nest popovers without end. The
|
|
152
|
+
group reads a context the popover provides, which means the recursion cannot be
|
|
153
|
+
written even by hand.
|
|
154
|
+
|
|
155
|
+
## Accessibility
|
|
156
|
+
|
|
157
|
+
### Keyboard Navigation
|
|
158
|
+
|
|
159
|
+
- `Tab` — moves focus into the group, landing on the selected swatch
|
|
160
|
+
- `Left` / `Right`, `Up` / `Down` — move between swatches, selecting as they go
|
|
161
|
+
- `Space` — selects the focused swatch
|
|
162
|
+
|
|
163
|
+
### Screen Reader Support
|
|
164
|
+
|
|
165
|
+
- The group announces as a radiogroup, named by its label or `aria-label`
|
|
166
|
+
- Each swatch announces as a radio named by its `label`, or by its color
|
|
167
|
+
- Give the group a name: "radiogroup" alone says nothing about what is chosen
|
|
168
|
+
|
|
169
|
+
### ARIA Properties
|
|
170
|
+
|
|
171
|
+
- `aria-label` — names the group when there is no visible label
|
|
172
|
+
|
|
173
|
+
## Best Practices
|
|
174
|
+
|
|
175
|
+
1. **Do**: name the colors when they mean something
|
|
176
|
+
|
|
177
|
+
```jsx
|
|
178
|
+
<ColorSwatchGroup colors={[{ color: '#ff0000', label: 'Danger' }]} />
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
2. **Don't**: pass the same color twice expecting two swatches — one is dropped
|
|
182
|
+
|
|
183
|
+
```jsx
|
|
184
|
+
<ColorSwatchGroup colors={['#ff0000', 'rgb(255 0 0)']} />
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
3. **Do**: reach for `allowCustom` only where a color outside the palette is
|
|
188
|
+
genuinely acceptable. A fixed set is the point of this component.
|
|
189
|
+
|
|
190
|
+
## Integration with Forms
|
|
191
|
+
|
|
192
|
+
This component supports all
|
|
193
|
+
[Field properties](../../FieldProperties.md) when used
|
|
194
|
+
within a Form. The field value is the color string.
|
|
195
|
+
|
|
196
|
+
## Suggested Improvements
|
|
197
|
+
|
|
198
|
+
- Sections with headings, for palettes with more than one group
|
|
199
|
+
- An optional "no color" swatch that clears the value
|
|
200
|
+
- Multi-selection, for palettes that build a series
|
|
201
|
+
|
|
202
|
+
## Related Components
|
|
203
|
+
|
|
204
|
+
- [ColorPicker](./ColorPicker.md) — freeform color behind a swatch button
|
|
205
|
+
- [ColorInput](./ColorInput.md) — freeform color as editable text
|
|
206
|
+
- [RadioGroup](./RadioGroup.md) — the selection primitive this is built on
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cube-dev/ui-kit",
|
|
3
|
-
"version": "0.0.0-canary-
|
|
3
|
+
"version": "0.0.0-canary-01fea9d",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "UIKit for Cube Projects",
|
|
6
6
|
"repository": {
|
|
@@ -37,7 +37,6 @@
|
|
|
37
37
|
"build": "tsdown",
|
|
38
38
|
"watch": "tsdown --watch",
|
|
39
39
|
"test": "vitest run",
|
|
40
|
-
"test:browser": "vitest run --config vitest.browser.config.ts",
|
|
41
40
|
"test-cover": "vitest run --coverage",
|
|
42
41
|
"test-watch": "vitest",
|
|
43
42
|
"prettier": "prettier --check \"src/**/*.{js,jsx,ts,tsx}\"",
|
|
@@ -80,7 +79,6 @@
|
|
|
80
79
|
"@react-aria/ssr": "^3.9.10",
|
|
81
80
|
"@react-aria/utils": "^3.32.0",
|
|
82
81
|
"@react-spectrum/utils": "^3.12.10",
|
|
83
|
-
"@react-stately/selection": "^3.20.7",
|
|
84
82
|
"@react-stately/utils": "^3.11.0",
|
|
85
83
|
"@react-types/shared": "^3.32.1",
|
|
86
84
|
"@tabler/icons-react": "^3.31.0",
|
|
@@ -137,9 +135,7 @@
|
|
|
137
135
|
"@types/react-test-renderer": "^18.0.7",
|
|
138
136
|
"@uiw/react-codemirror": "^4.25.4",
|
|
139
137
|
"@vitejs/plugin-react": "^6.0.0",
|
|
140
|
-
"@vitest/
|
|
141
|
-
"@vitest/browser-playwright": "^4.1.10",
|
|
142
|
-
"@vitest/coverage-v8": "^4.1.10",
|
|
138
|
+
"@vitest/coverage-v8": "^4.1.0",
|
|
143
139
|
"best-effort-json-parser": "^1.2.1",
|
|
144
140
|
"bytes": "^3.1.2",
|
|
145
141
|
"chromatic": "^13.1.4",
|
|
@@ -152,7 +148,6 @@
|
|
|
152
148
|
"markdown-table": "^3.0.3",
|
|
153
149
|
"npm-run-all": "^4.1.5",
|
|
154
150
|
"oxlint": "^1.72.0",
|
|
155
|
-
"playwright": "^1.62.1",
|
|
156
151
|
"prettier": "^3.2.5",
|
|
157
152
|
"react": "^19.1.1",
|
|
158
153
|
"react-dom": "^19.1.1",
|
|
@@ -167,7 +162,7 @@
|
|
|
167
162
|
"tsdown": "^0.20.3",
|
|
168
163
|
"typescript": "^5.6.3",
|
|
169
164
|
"vite": "^8.0.0",
|
|
170
|
-
"vitest": "^4.1.
|
|
165
|
+
"vitest": "^4.1.0"
|
|
171
166
|
},
|
|
172
167
|
"browserslist": [
|
|
173
168
|
"last 2 Chrome versions",
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { CubeDataTableProps } from "./types.js";
|
|
3
|
-
import { ForwardedRef, ReactElement } from "react";
|
|
4
|
-
|
|
5
|
-
//#region src/components/data/DataTable/DataTable.d.ts
|
|
6
|
-
declare const _DataTable: (<T = any>(props: CubeDataTableProps<T> & {
|
|
7
|
-
ref?: ForwardedRef<HTMLDivElement>;
|
|
8
|
-
}) => ReactElement) & {
|
|
9
|
-
displayName?: string;
|
|
10
|
-
};
|
|
11
|
-
//#endregion
|
|
12
|
-
export { _DataTable };
|
|
13
|
-
//# sourceMappingURL=DataTable.d.ts.map
|
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-e76eb3e | Cube Dev Team */
|
|
2
|
-
import { extractStyles } from "../../../utils/styles.js";
|
|
3
|
-
import { useCombinedRefs } from "../../../utils/react/useCombinedRefs.js";
|
|
4
|
-
import { useEvent } from "../../../_internal/hooks/use-event.js";
|
|
5
|
-
import { useI18n } from "../../../i18n/useI18n.js";
|
|
6
|
-
import { clampPage, getPageInfo } from "../../navigation/Pagination/use-pagination.js";
|
|
7
|
-
import { ItemTableFooter } from "../ItemTable/ItemTableFooter.js";
|
|
8
|
-
import { useTableColumns } from "../TableBase/use-table-columns.js";
|
|
9
|
-
import { ROW_NUMBER_COLUMN_KEY } from "../TableBase/use-table-selection.js";
|
|
10
|
-
import { TableView } from "../TableBase/TableView.js";
|
|
11
|
-
import { useCellSelection } from "../TableBase/use-cell-selection.js";
|
|
12
|
-
import { useContainerWidth } from "../TableBase/use-container-width.js";
|
|
13
|
-
import { useTableSorts } from "../TableBase/use-table-sorts.js";
|
|
14
|
-
import { useTableStorage } from "../TableBase/use-table-storage.js";
|
|
15
|
-
import { CONTAINER_STYLES } from "@tenphi/tasty";
|
|
16
|
-
import { forwardRef, useMemo, useRef, useState } from "react";
|
|
17
|
-
import { jsx } from "react/jsx-runtime";
|
|
18
|
-
import { useControlledState } from "@react-stately/utils";
|
|
19
|
-
|
|
20
|
-
//#region src/components/data/DataTable/DataTable.tsx
|
|
21
|
-
/** Wide enough for five digits at the dense default. */
|
|
22
|
-
const ROW_NUMBER_WIDTH = 56;
|
|
23
|
-
const EMPTY_WIDTHS = {};
|
|
24
|
-
function defaultGetRowKey(rowKey) {
|
|
25
|
-
return (row, index) => {
|
|
26
|
-
const value = row?.[rowKey];
|
|
27
|
-
return value == null ? index : value;
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* A grid for query results.
|
|
32
|
-
*
|
|
33
|
-
* The same engine as `ItemTable` — one `TableView`, one column layout, one
|
|
34
|
-
* value pipeline — with the defaults an analytical grid wants rather than a
|
|
35
|
-
* list's: denser type, banded rows, resizable columns, multi-column sort, and
|
|
36
|
-
* rows pinned for totals.
|
|
37
|
-
*
|
|
38
|
-
* It knows nothing about Cube. Measures, dimensions, pivots and drill-downs
|
|
39
|
-
* reach it as ordinary columns, `render` output and `column.header.menu`
|
|
40
|
-
* content, which is what keeps the ~34 kB of Cloud's column-header menu in
|
|
41
|
-
* Cloud.
|
|
42
|
-
*/
|
|
43
|
-
function DataTable(props, ref) {
|
|
44
|
-
const { data, columns, rowKey = "id", getRowKey, pinnedTopRows, pinnedBottomRows, isLoading = false, loadingIndicator = "overlay", skeletonRowCount, error, emptyLabel, noResultsLabel, isFiltered, shape = "plain", size = "small", rowHeight, headerHeight, isStriped = true, isHeaderHidden, isHeaderSticky, showRowNumbers = false, sortMode, sorts: sortsProp, defaultSorts, onSortsChange, paginationMode = "client", page: pageProp, defaultPage, onPageChange, pageSize: pageSizeProp, defaultPageSize = 100, onPageSizeChange, pageSizeOptions, total: totalProp, totalPages, hasNextPage, summary = true, autoHidePagination = true, footerStart, footerCenter, footerEnd, cellSelectionMode = "range", isCellSelectable, selectedCellRange, defaultSelectedCellRange, onCellRangeChange, isResizable = true, columnWidths: columnWidthsProp, defaultColumnWidths, onColumnResize, isVirtualized, virtualizeThreshold, overscan, getRowProps, storageKey, styles, headerStyles, headerCellStyles, bodyStyles, rowStyles, cellStyles, footerStyles, ariaLabel, qa, mods, ...rest } = props;
|
|
45
|
-
const rootRef = useCombinedRefs(ref, useRef(null));
|
|
46
|
-
const [scrollerEl, setScrollerEl] = useState(null);
|
|
47
|
-
const containerWidth = useContainerWidth(scrollerEl);
|
|
48
|
-
const storage = useTableStorage(storageKey);
|
|
49
|
-
/**
|
|
50
|
-
* `dataType` is presentational, so it is folded into the column here rather
|
|
51
|
-
* than reaching the renderer: `number` right-aligns and takes tabular figures
|
|
52
|
-
* so digits line up down the column.
|
|
53
|
-
*/
|
|
54
|
-
const resolvedColumns = useMemo(() => columns.map((column) => {
|
|
55
|
-
const isNumeric = column.dataType === "number";
|
|
56
|
-
return {
|
|
57
|
-
...column,
|
|
58
|
-
align: column.align ?? (isNumeric ? "end" : "start"),
|
|
59
|
-
cellStyles: isNumeric ? {
|
|
60
|
-
fontVariantNumeric: "tabular-nums",
|
|
61
|
-
...typeof column.cellStyles === "object" ? column.cellStyles : null
|
|
62
|
-
} : column.cellStyles
|
|
63
|
-
};
|
|
64
|
-
}), [columns]);
|
|
65
|
-
const { sorts, sortedRows, toggleSort, mode: resolvedSortMode } = useTableSorts({
|
|
66
|
-
columns: resolvedColumns,
|
|
67
|
-
rows: data,
|
|
68
|
-
mode: sortMode,
|
|
69
|
-
sorts: sortsProp,
|
|
70
|
-
defaultSorts,
|
|
71
|
-
onSortsChange
|
|
72
|
-
});
|
|
73
|
-
const [pageSize, setPageSizeState] = useControlledState(pageSizeProp, pageSizeProp === void 0 && storage.has("pageSize") ? storage.initial.pageSize ?? defaultPageSize : defaultPageSize, onPageSizeChange);
|
|
74
|
-
const [page, setPageState] = useControlledState(pageProp, defaultPage ?? 1, onPageChange);
|
|
75
|
-
const isPaginated = paginationMode !== "off";
|
|
76
|
-
const isServerPaginated = paginationMode === "server";
|
|
77
|
-
const total = isServerPaginated ? totalProp ?? 0 : sortedRows.length;
|
|
78
|
-
const pageInfo = getPageInfo({
|
|
79
|
-
page,
|
|
80
|
-
pageSize,
|
|
81
|
-
total,
|
|
82
|
-
totalPages: isServerPaginated ? totalPages : void 0
|
|
83
|
-
});
|
|
84
|
-
const setPage = useEvent((next) => setPageState(clampPage(next, pageInfo.totalPages)));
|
|
85
|
-
const setPageSize = useEvent((next) => {
|
|
86
|
-
setPageSizeState(next);
|
|
87
|
-
setPageState(1);
|
|
88
|
-
if (pageSizeProp === void 0) storage.write({ pageSize: next });
|
|
89
|
-
});
|
|
90
|
-
const visibleRows = paginationMode === "client" ? sortedRows.slice((pageInfo.page - 1) * pageSize, pageInfo.page * pageSize) : sortedRows;
|
|
91
|
-
const [ownColumnWidths, setOwnColumnWidths] = useState(() => (columnWidthsProp === void 0 && storage.has("columnWidths") ? storage.initial.columnWidths ?? defaultColumnWidths : defaultColumnWidths) ?? EMPTY_WIDTHS);
|
|
92
|
-
const [draftColumnWidths, setDraftColumnWidths] = useState(null);
|
|
93
|
-
const draftRef = useRef(null);
|
|
94
|
-
const baseColumnWidths = columnWidthsProp ?? ownColumnWidths;
|
|
95
|
-
const columnWidths = draftColumnWidths ?? baseColumnWidths;
|
|
96
|
-
const handleColumnResize = useEvent((key, width) => {
|
|
97
|
-
draftRef.current = {
|
|
98
|
-
...draftRef.current ?? baseColumnWidths,
|
|
99
|
-
[key]: Math.round(width)
|
|
100
|
-
};
|
|
101
|
-
setDraftColumnWidths(draftRef.current);
|
|
102
|
-
});
|
|
103
|
-
const handleColumnResizeEnd = useEvent((key) => {
|
|
104
|
-
const next = draftRef.current ?? baseColumnWidths;
|
|
105
|
-
if (columnWidthsProp === void 0) {
|
|
106
|
-
setOwnColumnWidths(next);
|
|
107
|
-
storage.write({ columnWidths: next });
|
|
108
|
-
}
|
|
109
|
-
onColumnResize?.(key, next[key], next);
|
|
110
|
-
draftRef.current = null;
|
|
111
|
-
setDraftColumnWidths(null);
|
|
112
|
-
});
|
|
113
|
-
const layout = useTableColumns({
|
|
114
|
-
columns: resolvedColumns,
|
|
115
|
-
containerWidth,
|
|
116
|
-
columnWidths,
|
|
117
|
-
leadingColumns: useMemo(() => showRowNumbers ? [{
|
|
118
|
-
key: ROW_NUMBER_COLUMN_KEY,
|
|
119
|
-
width: ROW_NUMBER_WIDTH
|
|
120
|
-
}] : void 0, [showRowNumbers])
|
|
121
|
-
});
|
|
122
|
-
const { t } = useI18n();
|
|
123
|
-
const resolvedGetRowKey = useMemo(() => getRowKey ?? defaultGetRowKey(rowKey), [getRowKey, rowKey]);
|
|
124
|
-
const selectionRows = useMemo(() => [
|
|
125
|
-
...pinnedTopRows ?? [],
|
|
126
|
-
...visibleRows,
|
|
127
|
-
...pinnedBottomRows ?? []
|
|
128
|
-
], [
|
|
129
|
-
pinnedTopRows,
|
|
130
|
-
visibleRows,
|
|
131
|
-
pinnedBottomRows
|
|
132
|
-
]);
|
|
133
|
-
const selectionRowKeys = useMemo(() => [
|
|
134
|
-
...(pinnedTopRows ?? []).map(resolvedGetRowKey),
|
|
135
|
-
...visibleRows.map(resolvedGetRowKey),
|
|
136
|
-
...(pinnedBottomRows ?? []).map(resolvedGetRowKey)
|
|
137
|
-
], [
|
|
138
|
-
pinnedTopRows,
|
|
139
|
-
visibleRows,
|
|
140
|
-
pinnedBottomRows,
|
|
141
|
-
resolvedGetRowKey
|
|
142
|
-
]);
|
|
143
|
-
const resolveCellSelectable = useEvent((row, rowKey, columnKey) => {
|
|
144
|
-
if (!isCellSelectable) return true;
|
|
145
|
-
const index = selectionRowKeys.indexOf(rowKey);
|
|
146
|
-
const topCount = pinnedTopRows?.length ?? 0;
|
|
147
|
-
return isCellSelectable({
|
|
148
|
-
row,
|
|
149
|
-
rowKey,
|
|
150
|
-
columnKey,
|
|
151
|
-
section: index < topCount ? "pinnedTop" : index < topCount + visibleRows.length ? "body" : "pinnedBottom"
|
|
152
|
-
});
|
|
153
|
-
});
|
|
154
|
-
const cellSelection = useCellSelection({
|
|
155
|
-
mode: cellSelectionMode,
|
|
156
|
-
columns: layout.columns,
|
|
157
|
-
rows: selectionRows,
|
|
158
|
-
rowKeys: selectionRowKeys,
|
|
159
|
-
isCellSelectable: isCellSelectable ? resolveCellSelectable : void 0,
|
|
160
|
-
range: selectedCellRange,
|
|
161
|
-
defaultRange: defaultSelectedCellRange,
|
|
162
|
-
onRangeChange: onCellRangeChange
|
|
163
|
-
});
|
|
164
|
-
const rootStyles = {
|
|
165
|
-
...extractStyles(props, CONTAINER_STYLES),
|
|
166
|
-
...styles
|
|
167
|
-
};
|
|
168
|
-
const smallestPageSize = pageSizeOptions?.length ? Math.min(...pageSizeOptions) : pageSize;
|
|
169
|
-
const showPagination = isPaginated && !(autoHidePagination && !hasNextPage && pageInfo.totalPages <= 1 && total <= smallestPageSize);
|
|
170
|
-
const hasFooter = showPagination || footerStart != null || footerCenter != null || footerEnd != null;
|
|
171
|
-
return /* @__PURE__ */ jsx(TableView, {
|
|
172
|
-
...rest,
|
|
173
|
-
rootRef,
|
|
174
|
-
qa: qa || "DataTable",
|
|
175
|
-
rows: visibleRows,
|
|
176
|
-
pinnedTopRows,
|
|
177
|
-
pinnedBottomRows,
|
|
178
|
-
rowNumberOffset: paginationMode === "client" ? (pageInfo.page - 1) * pageSize : 0,
|
|
179
|
-
layout,
|
|
180
|
-
hasColumnDividers: true,
|
|
181
|
-
cellSelection,
|
|
182
|
-
getRowKey: resolvedGetRowKey,
|
|
183
|
-
onScrollerRef: setScrollerEl,
|
|
184
|
-
isLoading,
|
|
185
|
-
loadingIndicator,
|
|
186
|
-
skeletonRowCount,
|
|
187
|
-
error,
|
|
188
|
-
emptyLabel: emptyLabel ?? t("itemTable.noItems", "No items"),
|
|
189
|
-
noResultsLabel: noResultsLabel ?? t("itemTable.noResults", "No results found"),
|
|
190
|
-
isFiltered,
|
|
191
|
-
shape,
|
|
192
|
-
size,
|
|
193
|
-
rowHeight,
|
|
194
|
-
headerHeight,
|
|
195
|
-
isStriped,
|
|
196
|
-
isHeaderHidden,
|
|
197
|
-
isHeaderSticky,
|
|
198
|
-
contentPreset: "t4",
|
|
199
|
-
headerPreset: "t4m",
|
|
200
|
-
sortMode: resolvedSortMode,
|
|
201
|
-
sorts,
|
|
202
|
-
onColumnSort: toggleSort,
|
|
203
|
-
isVirtualized,
|
|
204
|
-
virtualizeThreshold,
|
|
205
|
-
overscan,
|
|
206
|
-
isResizable,
|
|
207
|
-
onColumnResize: handleColumnResize,
|
|
208
|
-
onColumnResizeEnd: handleColumnResizeEnd,
|
|
209
|
-
getRowProps,
|
|
210
|
-
ariaLabel,
|
|
211
|
-
styles: rootStyles,
|
|
212
|
-
headerStyles,
|
|
213
|
-
headerCellStyles,
|
|
214
|
-
bodyStyles,
|
|
215
|
-
rowStyles,
|
|
216
|
-
cellStyles,
|
|
217
|
-
mods,
|
|
218
|
-
footer: hasFooter ? /* @__PURE__ */ jsx(ItemTableFooter, {
|
|
219
|
-
start: footerStart,
|
|
220
|
-
center: footerCenter,
|
|
221
|
-
end: footerEnd,
|
|
222
|
-
styles: footerStyles,
|
|
223
|
-
pagination: showPagination ? {
|
|
224
|
-
page: pageInfo.page,
|
|
225
|
-
pageSize,
|
|
226
|
-
total,
|
|
227
|
-
totalPages: pageInfo.totalPages,
|
|
228
|
-
pageSizeOptions,
|
|
229
|
-
summary,
|
|
230
|
-
hasNextPage,
|
|
231
|
-
onPageChange: setPage,
|
|
232
|
-
onPageSizeChange: setPageSize
|
|
233
|
-
} : void 0
|
|
234
|
-
}) : null
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
const _DataTable = forwardRef(DataTable);
|
|
238
|
-
_DataTable.displayName = "DataTable";
|
|
239
|
-
|
|
240
|
-
//#endregion
|
|
241
|
-
export { _DataTable };
|
|
242
|
-
//# sourceMappingURL=DataTable.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DataTable.js","names":[],"sources":["../../../../src/components/data/DataTable/DataTable.tsx"],"sourcesContent":["import { useControlledState } from '@react-stately/utils';\nimport { CONTAINER_STYLES } from '@tenphi/tasty';\nimport { forwardRef, useMemo, useRef, useState } from 'react';\n\nimport { useEvent } from '../../../_internal/hooks';\nimport { useI18n } from '../../../i18n';\nimport { useCombinedRefs } from '../../../utils/react';\nimport { extractStyles } from '../../../utils/styles';\nimport { clampPage, getPageInfo } from '../../navigation/Pagination';\nimport { ItemTableFooter } from '../ItemTable/ItemTableFooter';\nimport { TableView } from '../TableBase/TableView';\nimport { useCellSelection } from '../TableBase/use-cell-selection';\nimport { useContainerWidth } from '../TableBase/use-container-width';\nimport { useTableColumns } from '../TableBase/use-table-columns';\nimport { ROW_NUMBER_COLUMN_KEY } from '../TableBase/use-table-selection';\nimport { useTableSorts } from '../TableBase/use-table-sorts';\nimport { useTableStorage } from '../TableBase/use-table-storage';\n\nimport type { Key } from '@react-types/shared';\nimport type { ForwardedRef, ReactElement } from 'react';\nimport type { CubeTableRowSection } from '../TableBase/types';\nimport type { CubeDataTableColumn, CubeDataTableProps } from './types';\n\n/** Wide enough for five digits at the dense default. */\nconst ROW_NUMBER_WIDTH = 56;\n\nconst EMPTY_WIDTHS: Record<string, number> = {};\n\nfunction defaultGetRowKey<T>(rowKey: string) {\n return (row: T, index: number): Key => {\n const value = (row as any)?.[rowKey];\n\n return value == null ? index : (value as Key);\n };\n}\n\n/**\n * A grid for query results.\n *\n * The same engine as `ItemTable` — one `TableView`, one column layout, one\n * value pipeline — with the defaults an analytical grid wants rather than a\n * list's: denser type, banded rows, resizable columns, multi-column sort, and\n * rows pinned for totals.\n *\n * It knows nothing about Cube. Measures, dimensions, pivots and drill-downs\n * reach it as ordinary columns, `render` output and `column.header.menu`\n * content, which is what keeps the ~34 kB of Cloud's column-header menu in\n * Cloud.\n */\nfunction DataTable<T = any>(\n props: CubeDataTableProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const {\n data,\n columns,\n rowKey = 'id',\n getRowKey,\n pinnedTopRows,\n pinnedBottomRows,\n isLoading = false,\n loadingIndicator = 'overlay',\n skeletonRowCount,\n error,\n emptyLabel,\n noResultsLabel,\n isFiltered,\n shape = 'plain',\n // Denser than `ItemTable`'s `medium`: a result grid is read as a block, and\n // more rows on screen is the point of it.\n size = 'small',\n rowHeight,\n headerHeight,\n isStriped = true,\n isHeaderHidden,\n isHeaderSticky,\n showRowNumbers = false,\n sortMode,\n sorts: sortsProp,\n defaultSorts,\n onSortsChange,\n paginationMode = 'client',\n page: pageProp,\n defaultPage,\n onPageChange,\n pageSize: pageSizeProp,\n defaultPageSize = 100,\n onPageSizeChange,\n pageSizeOptions,\n total: totalProp,\n totalPages,\n hasNextPage,\n summary = true,\n autoHidePagination = true,\n footerStart,\n footerCenter,\n footerEnd,\n cellSelectionMode = 'range',\n isCellSelectable,\n selectedCellRange,\n defaultSelectedCellRange,\n onCellRangeChange,\n isResizable = true,\n columnWidths: columnWidthsProp,\n defaultColumnWidths,\n onColumnResize,\n isVirtualized,\n virtualizeThreshold,\n overscan,\n getRowProps,\n storageKey,\n styles,\n headerStyles,\n headerCellStyles,\n bodyStyles,\n rowStyles,\n cellStyles,\n footerStyles,\n ariaLabel,\n qa,\n mods,\n ...rest\n } = props;\n\n const localRef = useRef<HTMLDivElement>(null);\n const rootRef = useCombinedRefs(ref, localRef);\n const [scrollerEl, setScrollerEl] = useState<HTMLElement | null>(null);\n const containerWidth = useContainerWidth(scrollerEl);\n\n const storage = useTableStorage(storageKey);\n\n /**\n * `dataType` is presentational, so it is folded into the column here rather\n * than reaching the renderer: `number` right-aligns and takes tabular figures\n * so digits line up down the column.\n */\n const resolvedColumns = useMemo(\n () =>\n columns.map((column) => {\n const isNumeric = column.dataType === 'number';\n\n return {\n ...column,\n align: column.align ?? (isNumeric ? 'end' : 'start'),\n cellStyles: isNumeric\n ? {\n fontVariantNumeric: 'tabular-nums',\n ...(typeof column.cellStyles === 'object'\n ? column.cellStyles\n : null),\n }\n : column.cellStyles,\n } as CubeDataTableColumn<T>;\n }),\n [columns],\n );\n\n const {\n sorts,\n sortedRows,\n toggleSort,\n mode: resolvedSortMode,\n } = useTableSorts<T>({\n columns: resolvedColumns,\n rows: data,\n mode: sortMode,\n sorts: sortsProp,\n defaultSorts,\n onSortsChange,\n });\n\n const [pageSize, setPageSizeState] = useControlledState<number>(\n pageSizeProp as number,\n (pageSizeProp === undefined && storage.has('pageSize')\n ? storage.initial.pageSize ?? defaultPageSize\n : defaultPageSize) as number,\n onPageSizeChange as (value: number) => void,\n );\n const [page, setPageState] = useControlledState<number>(\n pageProp as number,\n defaultPage ?? 1,\n onPageChange as (value: number) => void,\n );\n\n const isPaginated = paginationMode !== 'off';\n const isServerPaginated = paginationMode === 'server';\n const total = isServerPaginated ? totalProp ?? 0 : sortedRows.length;\n\n const pageInfo = getPageInfo({\n page,\n pageSize,\n total,\n totalPages: isServerPaginated ? totalPages : undefined,\n });\n\n const setPage = useEvent((next: number) =>\n setPageState(clampPage(next, pageInfo.totalPages)),\n );\n const setPageSize = useEvent((next: number) => {\n setPageSizeState(next);\n setPageState(1);\n\n if (pageSizeProp === undefined) storage.write({ pageSize: next });\n });\n\n const visibleRows =\n paginationMode === 'client'\n ? sortedRows.slice(\n (pageInfo.page - 1) * pageSize,\n pageInfo.page * pageSize,\n )\n : sortedRows;\n\n const [ownColumnWidths, setOwnColumnWidths] = useState<\n Record<string, number>\n >(\n () =>\n (columnWidthsProp === undefined && storage.has('columnWidths')\n ? storage.initial.columnWidths ?? defaultColumnWidths\n : defaultColumnWidths) ?? EMPTY_WIDTHS,\n );\n const [draftColumnWidths, setDraftColumnWidths] = useState<Record<\n string,\n number\n > | null>(null);\n const draftRef = useRef<Record<string, number> | null>(null);\n\n const baseColumnWidths = columnWidthsProp ?? ownColumnWidths;\n const columnWidths = draftColumnWidths ?? baseColumnWidths;\n\n const handleColumnResize = useEvent((key: string, width: number) => {\n draftRef.current = {\n ...(draftRef.current ?? baseColumnWidths),\n [key]: Math.round(width),\n };\n setDraftColumnWidths(draftRef.current);\n });\n\n const handleColumnResizeEnd = useEvent((key: string) => {\n const next = draftRef.current ?? baseColumnWidths;\n\n if (columnWidthsProp === undefined) {\n setOwnColumnWidths(next);\n storage.write({ columnWidths: next });\n }\n\n onColumnResize?.(key, next[key], next);\n draftRef.current = null;\n setDraftColumnWidths(null);\n });\n\n const leadingColumns = useMemo(\n () =>\n showRowNumbers\n ? [{ key: ROW_NUMBER_COLUMN_KEY, width: ROW_NUMBER_WIDTH }]\n : undefined,\n [showRowNumbers],\n );\n\n const layout = useTableColumns<T>({\n columns: resolvedColumns,\n containerWidth,\n columnWidths,\n leadingColumns,\n });\n\n const { t } = useI18n();\n\n const resolvedGetRowKey = useMemo(\n () => getRowKey ?? defaultGetRowKey<T>(rowKey),\n [getRowKey, rowKey],\n );\n\n // Every row a range can reach, in the order they appear on screen. Pinned rows\n // are in it: a total is a figure like any other, and having to copy it\n // separately from the column it sums is the wrong trade.\n //\n // The keys are built here rather than inside the hook so they cannot disagree\n // with the ones the renderer stamps — a pinned row is keyed by its own index\n // within its group, exactly as `renderPinnedRow` keys it.\n const selectionRows = useMemo(\n () => [\n ...(pinnedTopRows ?? []),\n ...visibleRows,\n ...(pinnedBottomRows ?? []),\n ],\n [pinnedTopRows, visibleRows, pinnedBottomRows],\n );\n const selectionRowKeys = useMemo(\n () => [\n ...(pinnedTopRows ?? []).map(resolvedGetRowKey),\n ...visibleRows.map(resolvedGetRowKey),\n ...(pinnedBottomRows ?? []).map(resolvedGetRowKey),\n ],\n [pinnedTopRows, visibleRows, pinnedBottomRows, resolvedGetRowKey],\n );\n\n // The hook works in one flat row order; the section a row belongs to is a\n // property of where it sits in that order, so it is resolved here rather than\n // asking the consumer to track it.\n const resolveCellSelectable = useEvent(\n (row: T, rowKey: Key, columnKey: string) => {\n if (!isCellSelectable) return true;\n\n const index = selectionRowKeys.indexOf(rowKey);\n const topCount = pinnedTopRows?.length ?? 0;\n const section: CubeTableRowSection =\n index < topCount\n ? 'pinnedTop'\n : index < topCount + visibleRows.length\n ? 'body'\n : 'pinnedBottom';\n\n return isCellSelectable({ row, rowKey, columnKey, section });\n },\n );\n\n const cellSelection = useCellSelection<T>({\n mode: cellSelectionMode,\n columns: layout.columns,\n rows: selectionRows,\n rowKeys: selectionRowKeys,\n isCellSelectable: isCellSelectable ? resolveCellSelectable : undefined,\n range: selectedCellRange,\n defaultRange: defaultSelectedCellRange,\n onRangeChange: onCellRangeChange,\n });\n\n // Same as `ItemTable`: style props (`height`, `maxHeight`, `margin`, …) land\n // on the root frame. `height` is the one that matters — there is no\n // page-scroll mode, so bounding the grid is what turns the body into a\n // scroller, pins the header, and lets virtualization engage at all.\n const rootStyles = { ...extractStyles(props, CONTAINER_STYLES), ...styles };\n\n const smallestPageSize = pageSizeOptions?.length\n ? Math.min(...pageSizeOptions)\n : pageSize;\n\n const showPagination =\n isPaginated &&\n !(\n autoHidePagination &&\n !hasNextPage &&\n pageInfo.totalPages <= 1 &&\n total <= smallestPageSize\n );\n\n const hasFooter =\n showPagination ||\n footerStart != null ||\n footerCenter != null ||\n footerEnd != null;\n\n return (\n <TableView<T>\n {...rest}\n rootRef={rootRef}\n qa={qa || 'DataTable'}\n rows={visibleRows}\n pinnedTopRows={pinnedTopRows}\n pinnedBottomRows={pinnedBottomRows}\n // Continuous across pages: row 101 is row 101, not row 1 of page two.\n rowNumberOffset={\n paginationMode === 'client' ? (pageInfo.page - 1) * pageSize : 0\n }\n layout={layout}\n // Always on, unlike `ItemTable`. A result grid is read down a column, and\n // once the values are wide and right-aligned the rule is what keeps a\n // figure attached to its column — which is why Cloud's ag-grid theme sets\n // `columnBorder` for `DataTable` and not for the list grids.\n hasColumnDividers\n cellSelection={cellSelection}\n getRowKey={resolvedGetRowKey}\n onScrollerRef={setScrollerEl}\n isLoading={isLoading}\n loadingIndicator={loadingIndicator}\n skeletonRowCount={skeletonRowCount}\n error={error}\n // Same localized fallbacks as `ItemTable`: a grid that has finished\n // loading and shows an unexplained blank rectangle reads as broken.\n emptyLabel={emptyLabel ?? t('itemTable.noItems', 'No items')}\n noResultsLabel={\n noResultsLabel ?? t('itemTable.noResults', 'No results found')\n }\n isFiltered={isFiltered}\n shape={shape}\n size={size}\n rowHeight={rowHeight}\n headerHeight={headerHeight}\n isStriped={isStriped}\n isHeaderHidden={isHeaderHidden}\n isHeaderSticky={isHeaderSticky}\n // The header shows the column name at body size — a result grid has no\n // room for the uppercase caption a list header uses.\n // `t4` throughout: a result grid is read as a block, and one step down\n // from the list preset fits noticeably more on screen without losing\n // legibility. The header takes the medium weight of the same step.\n contentPreset=\"t4\"\n headerPreset=\"t4m\"\n sortMode={resolvedSortMode}\n sorts={sorts}\n onColumnSort={toggleSort}\n isVirtualized={isVirtualized}\n virtualizeThreshold={virtualizeThreshold}\n overscan={overscan}\n isResizable={isResizable}\n onColumnResize={handleColumnResize}\n onColumnResizeEnd={handleColumnResizeEnd}\n getRowProps={getRowProps}\n ariaLabel={ariaLabel}\n styles={rootStyles}\n headerStyles={headerStyles}\n headerCellStyles={headerCellStyles}\n bodyStyles={bodyStyles}\n rowStyles={rowStyles}\n cellStyles={cellStyles}\n mods={mods}\n footer={\n hasFooter ? (\n <ItemTableFooter\n start={footerStart}\n center={footerCenter}\n end={footerEnd}\n styles={footerStyles}\n pagination={\n showPagination\n ? {\n page: pageInfo.page,\n pageSize,\n total,\n totalPages: pageInfo.totalPages,\n pageSizeOptions,\n summary,\n hasNextPage,\n onPageChange: setPage,\n onPageSizeChange: setPageSize,\n }\n : undefined\n }\n />\n ) : null\n }\n />\n );\n}\n\nconst _DataTable = forwardRef(DataTable) as unknown as (<T = any>(\n props: CubeDataTableProps<T> & { ref?: ForwardedRef<HTMLDivElement> },\n) => ReactElement) & { displayName?: string };\n\n_DataTable.displayName = 'DataTable';\n\nexport { _DataTable as DataTable };\n"],"mappings":"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"}
|