@cube-dev/ui-kit 0.120.1 → 0.121.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CHANGELOG.md +20 -0
- 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.d.ts +1 -0
- package/dist/components/actions/Button/Button.js +34 -14
- package/dist/components/actions/Button/Button.js.map +1 -1
- package/dist/components/actions/ButtonGroup/ButtonGroup.js +1 -1
- package/dist/components/actions/ButtonSplit/ButtonSplit.d.ts +47 -0
- package/dist/components/actions/ButtonSplit/ButtonSplit.js +105 -0
- package/dist/components/actions/ButtonSplit/ButtonSplit.js.map +1 -0
- package/dist/components/actions/ButtonSplit/context.d.ts +18 -0
- package/dist/components/actions/ButtonSplit/context.js +12 -0
- package/dist/components/actions/ButtonSplit/context.js.map +1 -0
- package/dist/components/actions/ButtonSplit/index.d.ts +3 -0
- 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.d.ts +2 -2
- 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.d.ts +8 -3
- package/dist/components/actions/index.js +10 -5
- package/dist/components/actions/index.js.map +1 -1
- package/dist/components/actions/use-action.d.ts +1 -0
- package/dist/components/actions/use-action.js +21 -18
- package/dist/components/actions/use-action.js.map +1 -1
- package/dist/components/actions/use-anchored-menu.js +1 -1
- package/dist/components/actions/use-context-menu.js +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 +2 -1
- package/dist/components/content/Badge/Badge.js.map +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 +5 -2
- package/dist/components/content/Disclosure/Disclosure.js.map +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/Item/Item.js +1 -1
- package/dist/components/content/ItemBadge/ItemBadge.js +3 -2
- package/dist/components/content/ItemBadge/ItemBadge.js.map +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 -1
- package/dist/components/content/Tag/Tag.js.map +1 -1
- 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/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/ComboBox/ComboBox.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/TimeInput.js +1 -1
- package/dist/components/fields/DatePicker/intl.js +1 -1
- package/dist/components/fields/DatePicker/parseDate.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 +2 -2
- package/dist/components/fields/Input/Input.js +1 -1
- package/dist/components/fields/ListBox/ListBox.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 +2 -2
- package/dist/components/fields/RadioGroup/Radio.js +3 -1
- 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/SearchInput/SearchInput.js +1 -1
- package/dist/components/fields/Select/Select.d.ts +8 -2
- package/dist/components/fields/Select/Select.js +1 -1
- package/dist/components/fields/Select/Select.js.map +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/form/FieldWrapper/FieldWrapper.js +1 -1
- package/dist/components/form/FieldWrapper/extract-field-wrapper-props.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/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/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/EditableTitle.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 +2 -1
- package/dist/components/navigation/Tabs/TabPicker.js.map +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/styled.js +3 -1
- package/dist/components/navigation/Tabs/styled.js.map +1 -1
- package/dist/components/navigation/Tabs/types.d.ts +2 -2
- package/dist/components/navigation/Tabs/types.js +1 -1
- package/dist/components/navigation/Tabs/types.js.map +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/organisms/FileTabs/FileTabs.js +1 -1
- 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/RangeCalendar.js +1 -1
- package/dist/components/other/CloudLogo/CloudLogo.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 +2 -2
- 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/OpenTransition.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/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 +6 -6
- package/dist/data/item-themes.js.map +1 -1
- package/dist/data/themes.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/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/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 +6 -4
- package/dist/index.js +7 -5
- 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/shadows.js +1 -1
- package/dist/tokens/sizes.js +1 -1
- package/dist/tokens/spacing.js +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/useQaProps.js +1 -1
- package/dist/utils/react/useViewportSize.js +1 -1
- package/dist/utils/react/wrapNodeIfPlain.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/BaseProperties.md +78 -0
- package/docs/ComplexLayout.md +459 -0
- package/docs/CreateComponent.md +410 -0
- package/docs/FieldProperties.md +117 -0
- package/docs/Introduction.md +122 -0
- package/docs/RenderCache.md +177 -0
- package/docs/Result.md +42 -0
- package/docs/SimpleLayout.md +26 -0
- package/docs/Typography.md +38 -0
- package/docs/components/Block.md +33 -0
- package/docs/components/CollectionItem.md +293 -0
- package/docs/components/GridProvider.md +38 -0
- package/docs/components/Root.md +50 -0
- package/docs/components/actions/Action.md +47 -0
- package/docs/components/actions/Banner.md +195 -0
- package/docs/components/actions/Button.md +209 -0
- package/docs/components/actions/ButtonGroup.md +46 -0
- package/docs/components/actions/ButtonSplit.md +199 -0
- package/docs/components/actions/CommandMenu.md +422 -0
- package/docs/components/actions/ItemAction.md +60 -0
- package/docs/components/actions/ItemButton.md +316 -0
- package/docs/components/actions/Link.md +325 -0
- package/docs/components/actions/Menu.md +485 -0
- package/docs/components/actions/MenuTrigger.md +47 -0
- package/docs/components/actions/SubMenuTrigger.md +38 -0
- package/docs/components/actions/use-anchored-menu.md +209 -0
- package/docs/components/actions/use-context-menu.md +218 -0
- package/docs/components/content/ActiveZone.md +37 -0
- package/docs/components/content/Alert.md +40 -0
- package/docs/components/content/Avatar.md +37 -0
- package/docs/components/content/Badge.md +194 -0
- package/docs/components/content/Card.md +40 -0
- package/docs/components/content/Content.md +44 -0
- package/docs/components/content/CopyPasteBlock.md +36 -0
- package/docs/components/content/CopySnippet.md +43 -0
- package/docs/components/content/Disclosure.md +181 -0
- package/docs/components/content/Divider.md +39 -0
- package/docs/components/content/Footer.md +35 -0
- package/docs/components/content/Header.md +35 -0
- package/docs/components/content/HotKeys.md +352 -0
- package/docs/components/content/Item.md +499 -0
- package/docs/components/content/ItemBadge.md +31 -0
- package/docs/components/content/ItemCard.md +131 -0
- package/docs/components/content/Layout.md +843 -0
- package/docs/components/content/Paragraph.md +32 -0
- package/docs/components/content/Placeholder.md +37 -0
- package/docs/components/content/PrismCode.md +36 -0
- package/docs/components/content/PrismDiffCode.md +29 -0
- package/docs/components/content/Result.md +46 -0
- package/docs/components/content/Skeleton.md +35 -0
- package/docs/components/content/Tag.md +165 -0
- package/docs/components/content/Text.md +54 -0
- package/docs/components/content/TextItem.md +217 -0
- package/docs/components/content/Title.md +45 -0
- package/docs/components/fields/Checkbox.md +176 -0
- package/docs/components/fields/ComboBox.md +651 -0
- package/docs/components/fields/DatePicker.md +227 -0
- package/docs/components/fields/FileInput.md +194 -0
- package/docs/components/fields/FilterListBox.md +726 -0
- package/docs/components/fields/FilterPicker.md +776 -0
- package/docs/components/fields/HueSlider.md +175 -0
- package/docs/components/fields/ListBox.md +714 -0
- package/docs/components/fields/NumberInput.md +180 -0
- package/docs/components/fields/PasswordInput.md +214 -0
- package/docs/components/fields/Picker.md +906 -0
- package/docs/components/fields/RadioGroup.md +310 -0
- package/docs/components/fields/SearchInput.md +224 -0
- package/docs/components/fields/Select.md +576 -0
- package/docs/components/fields/Slider.md +53 -0
- package/docs/components/fields/Switch.md +169 -0
- package/docs/components/fields/TextArea.md +61 -0
- package/docs/components/fields/TextInput.md +205 -0
- package/docs/components/fields/TextInputMapper.md +34 -0
- package/docs/components/form/Field.md +333 -0
- package/docs/components/form/Form.md +644 -0
- package/docs/components/form/FormInstance.md +307 -0
- package/docs/components/helpers/DisplayTransition.md +268 -0
- package/docs/components/helpers/IconSwitch.md +160 -0
- package/docs/components/layout/Flex.md +51 -0
- package/docs/components/layout/Flow.md +32 -0
- package/docs/components/layout/Grid.md +46 -0
- package/docs/components/layout/Panel.md +65 -0
- package/docs/components/layout/Prefix.md +37 -0
- package/docs/components/layout/ResizablePanel.md +69 -0
- package/docs/components/layout/Space.md +44 -0
- package/docs/components/layout/Suffix.md +39 -0
- package/docs/components/navigation/Tabs.md +726 -0
- package/docs/components/organisms/FileTabs.md +39 -0
- package/docs/components/organisms/StatsCard.md +40 -0
- package/docs/components/other/CloudLogo.md +33 -0
- package/docs/components/overlays/AlertDialog.md +51 -0
- package/docs/components/overlays/Dialog.md +200 -0
- package/docs/components/overlays/DialogContainer.md +201 -0
- package/docs/components/overlays/DialogForm.md +295 -0
- package/docs/components/overlays/DialogTrigger.md +191 -0
- package/docs/components/overlays/Notifications.md +402 -0
- package/docs/components/overlays/Toast.md +289 -0
- package/docs/components/overlays/Tooltip.md +400 -0
- package/docs/components/overlays/TooltipProvider.md +42 -0
- package/docs/components/overlays/TooltipTrigger.md +42 -0
- package/docs/components/overlays/UseDialogContainer.md +597 -0
- package/docs/components/portal/Portal.md +29 -0
- package/docs/components/status/LoadingAnimation.md +27 -0
- package/docs/components/status/Spin.md +35 -0
- package/docs/tasty/configuration.md +211 -0
- package/docs/tasty/debug.md +505 -0
- package/docs/tasty/injector.md +528 -0
- package/docs/tasty/styles.md +567 -0
- package/docs/tasty/tasty-static.md +376 -0
- package/docs/tasty/usage.md +643 -0
- package/package.json +5 -9
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
# ItemButton
|
|
2
|
+
|
|
3
|
+
An interactive button component built on top of `Item` that provides all the layout and styling capabilities of Item with full button functionality. ItemButton supports actions, links, form submissions, and all the advanced features like hotkeys, tooltips, and selection states.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
- For buttons that need structured content with icons, descriptions, or prefixes/suffixes
|
|
8
|
+
- When you need button functionality with the flexible layout capabilities of Item
|
|
9
|
+
- For interactive items in lists, menus, or toolbars that need consistent styling
|
|
10
|
+
- When building buttons that support features like keyboard shortcuts or overflow tooltips
|
|
11
|
+
- As an alternative to traditional buttons when you need more layout control
|
|
12
|
+
|
|
13
|
+
## Component
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
### Properties
|
|
18
|
+
|
|
19
|
+
- **`type`** `'primary' | 'secondary' | 'outline' | 'neutral' | 'clear'` — Visual type/variant of the button
|
|
20
|
+
- **`theme`** `'default' | 'danger' | 'success' | 'special'` — Color theme of the button
|
|
21
|
+
- **`size`** `'xsmall' | 'small' | 'medium' | 'large' | 'xlarge'` (default: `medium`) — Size of the button (does not support `'inline'`)
|
|
22
|
+
- **`hotkeys`** `string` — Keyboard shortcut that triggers the button (e.g., `"cmd+s"`, `"ctrl+alt+d"`)
|
|
23
|
+
- **`tooltip`** `boolean | string | object` — Tooltip configuration: string for simple text, `true` for auto overflow tooltips, or object for advanced config with optional `auto` property
|
|
24
|
+
- **`isDisabled`** `boolean` — Whether the button is disabled
|
|
25
|
+
- **`isSelected`** `boolean` — Whether the button shows as selected with checkbox
|
|
26
|
+
- **`to`** `string` — URL for link behavior (makes button act as link)
|
|
27
|
+
- **`htmlType`** `'button' | 'submit' | 'reset'` — HTML button type attribute
|
|
28
|
+
- **`description`** `string` — Secondary text shown below the main content
|
|
29
|
+
- **`isLoading`** `boolean` — Whether the button shows loading state with disabled interaction
|
|
30
|
+
- **`loadingSlot`** `'auto' | 'icon' | 'rightIcon' | 'prefix' | 'suffix'` — Which slot to replace with loading icon (`auto` intelligently selects)
|
|
31
|
+
- **`autoHideActions`** `boolean` — When true, actions are hidden by default and fade in on hover
|
|
32
|
+
- **`onPress`** `(e: PressEvent) => void` — Callback fired when button is pressed
|
|
33
|
+
|
|
34
|
+
### Base Properties
|
|
35
|
+
|
|
36
|
+
Supports [Base properties](../../BaseProperties.md)
|
|
37
|
+
|
|
38
|
+
### Item Properties
|
|
39
|
+
|
|
40
|
+
ItemButton inherits all properties from [Item](../content/Item.md), including:
|
|
41
|
+
- Layout properties: `icon`, `rightIcon`, `prefix`, `suffix`, `description`, `descriptionPlacement`
|
|
42
|
+
- Interactive properties: `hotkeys`, `tooltip`, `isSelected`
|
|
43
|
+
- Styling properties: `size`, `type`, `theme`, `styles`
|
|
44
|
+
|
|
45
|
+
### Content Properties
|
|
46
|
+
|
|
47
|
+
#### actions
|
|
48
|
+
- **Type**: `ReactNode`
|
|
49
|
+
- **Description**: Inline action buttons displayed on the right side of the button. Use `ItemButton.Action` for consistent styling. Actions automatically inherit the parent button's `type` prop and the component reserves space to prevent content overlap.
|
|
50
|
+
|
|
51
|
+
### Action Properties
|
|
52
|
+
|
|
53
|
+
#### onPress
|
|
54
|
+
- **Type**: `(e: PressEvent) => void`
|
|
55
|
+
- **Description**: Callback fired when the button is pressed via mouse, keyboard, or touch
|
|
56
|
+
|
|
57
|
+
#### to
|
|
58
|
+
- **Type**: `string`
|
|
59
|
+
- **Description**: URL for link behavior - when provided, the button acts as a link
|
|
60
|
+
|
|
61
|
+
#### htmlType
|
|
62
|
+
- **Type**: `'button' | 'submit' | 'reset'`
|
|
63
|
+
- **Description**: HTML button type attribute for form integration
|
|
64
|
+
- **Default**: `'button'`
|
|
65
|
+
|
|
66
|
+
#### isDisabled
|
|
67
|
+
- **Type**: `boolean`
|
|
68
|
+
- **Description**: Whether the button is disabled and non-interactive
|
|
69
|
+
|
|
70
|
+
### Style Properties
|
|
71
|
+
|
|
72
|
+
These properties allow direct style application without using the `styles` prop: `width`, `height`, `padding`, `margin`, `color`, `fill`, `opacity`, `display`, `position`, `zIndex`, `gap`, `flow`, `placeItems`, `placeContent`, `alignItems`, `justifyContent`, `border`, `radius`, `shadow`, `overflow`.
|
|
73
|
+
|
|
74
|
+
### Modifiers
|
|
75
|
+
|
|
76
|
+
Inherits all modifiers from [Item](../content/Item.md) plus:
|
|
77
|
+
|
|
78
|
+
- **`disabled`** `boolean` — Applied when the button is disabled
|
|
79
|
+
- **`pressed`** `boolean` — Applied during button press interaction
|
|
80
|
+
|
|
81
|
+
## Variants
|
|
82
|
+
|
|
83
|
+
### Types
|
|
84
|
+
|
|
85
|
+
- `primary` - Primary button with prominent styling for main actions
|
|
86
|
+
- `secondary` - Secondary button with moderate emphasis
|
|
87
|
+
- `outline` - Button with border outline and transparent background
|
|
88
|
+
- `neutral` - Neutral styled button for subtle actions
|
|
89
|
+
- `clear` - Transparent button with minimal visual weight
|
|
90
|
+
- `link` - Link-styled button that looks like a text link
|
|
91
|
+
|
|
92
|
+
### Themes
|
|
93
|
+
|
|
94
|
+
- `default` - Standard appearance with default colors
|
|
95
|
+
- `danger` - Red theme for destructive actions (delete, remove, etc.)
|
|
96
|
+
- `success` - Green theme for positive actions (save, confirm, etc.)
|
|
97
|
+
- `special` - Special theme with unique styling for standout actions
|
|
98
|
+
|
|
99
|
+
### Sizes
|
|
100
|
+
|
|
101
|
+
- `xsmall` - Extra small size for compact interfaces
|
|
102
|
+
- `small` - Small size for dense layouts
|
|
103
|
+
- `medium` - Default size for most use cases
|
|
104
|
+
- `large` - Large size for prominent actions
|
|
105
|
+
- `xlarge` - Extra large size for hero actions
|
|
106
|
+
|
|
107
|
+
## Examples
|
|
108
|
+
|
|
109
|
+
### Basic Button
|
|
110
|
+
|
|
111
|
+
```jsx
|
|
112
|
+
<ItemButton onPress={() => console.log('Clicked')}>
|
|
113
|
+
Click me
|
|
114
|
+
</ItemButton>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Button with Icons
|
|
118
|
+
|
|
119
|
+
```jsx
|
|
120
|
+
<ItemButton
|
|
121
|
+
icon={<IconFile />}
|
|
122
|
+
rightIcon={<IconExternalLink />}
|
|
123
|
+
onPress={handleOpen}
|
|
124
|
+
>
|
|
125
|
+
Open File
|
|
126
|
+
</ItemButton>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Link Button
|
|
130
|
+
|
|
131
|
+
```jsx
|
|
132
|
+
<ItemButton to="/docs">
|
|
133
|
+
Go to Documentation
|
|
134
|
+
</ItemButton>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Button with Hotkey
|
|
138
|
+
|
|
139
|
+
```jsx
|
|
140
|
+
<ItemButton
|
|
141
|
+
hotkeys="cmd+s"
|
|
142
|
+
onPress={handleSave}
|
|
143
|
+
type="primary"
|
|
144
|
+
>
|
|
145
|
+
Save Document
|
|
146
|
+
</ItemButton>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Form Submit Button
|
|
150
|
+
|
|
151
|
+
```jsx
|
|
152
|
+
<ItemButton
|
|
153
|
+
htmlType="submit"
|
|
154
|
+
type="primary"
|
|
155
|
+
icon={<IconCheck />}
|
|
156
|
+
>
|
|
157
|
+
Submit Form
|
|
158
|
+
</ItemButton>
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Button with Selection State
|
|
162
|
+
|
|
163
|
+
```jsx
|
|
164
|
+
<ItemButton
|
|
165
|
+
isSelected={isSelected}
|
|
166
|
+
onPress={() => setIsSelected(!isSelected)}
|
|
167
|
+
>
|
|
168
|
+
Toggle Selection
|
|
169
|
+
</ItemButton>
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Button with Actions
|
|
173
|
+
|
|
174
|
+
ItemButton supports inline actions that appear on the right side. Use the `ItemButton.Action` compound component for consistent styling:
|
|
175
|
+
|
|
176
|
+
```jsx
|
|
177
|
+
<ItemButton
|
|
178
|
+
icon={<IconFile />}
|
|
179
|
+
actions={
|
|
180
|
+
<>
|
|
181
|
+
<ItemButton.Action icon={<IconEdit />} aria-label="Edit" onPress={handleEdit} />
|
|
182
|
+
<ItemButton.Action icon={<IconTrash />} aria-label="Delete" onPress={handleDelete} />
|
|
183
|
+
</>
|
|
184
|
+
}
|
|
185
|
+
onPress={handleOpen}
|
|
186
|
+
>
|
|
187
|
+
Document with Actions
|
|
188
|
+
</ItemButton>
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Actions automatically inherit the parent button's `type` prop and adjust their styling accordingly. The component reserves space for actions to prevent content overlap.
|
|
192
|
+
|
|
193
|
+
## Accessibility
|
|
194
|
+
|
|
195
|
+
### Keyboard Navigation
|
|
196
|
+
|
|
197
|
+
- `Tab` - Moves focus to the button
|
|
198
|
+
- `Space/Enter` - Activates the button
|
|
199
|
+
- Custom hotkeys - Trigger button action when hotkeys are specified
|
|
200
|
+
- `Escape` - Removes focus when pressed (standard browser behavior)
|
|
201
|
+
|
|
202
|
+
### Screen Reader Support
|
|
203
|
+
|
|
204
|
+
- Button announces as "button" to screen readers
|
|
205
|
+
- Link buttons announce as "link" when `to` prop is provided
|
|
206
|
+
- Button state is announced (pressed, disabled, selected)
|
|
207
|
+
- Hotkey information is included in accessible description
|
|
208
|
+
|
|
209
|
+
### ARIA Properties
|
|
210
|
+
|
|
211
|
+
- `aria-label` - Provides accessible label when text content isn't descriptive enough
|
|
212
|
+
- `aria-disabled` - Indicates disabled state
|
|
213
|
+
- `aria-pressed` - Indicates toggle state for toggle buttons
|
|
214
|
+
- `role` - Automatically set to "button" or "link" based on props
|
|
215
|
+
|
|
216
|
+
## Best Practices
|
|
217
|
+
|
|
218
|
+
1. **Do**: Use clear, action-oriented text
|
|
219
|
+
```jsx
|
|
220
|
+
<ItemButton onPress={handleSave} type="primary">
|
|
221
|
+
Save Changes
|
|
222
|
+
</ItemButton>
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
2. **Do**: Add hotkeys for frequently used actions
|
|
226
|
+
```jsx
|
|
227
|
+
<ItemButton hotkeys="cmd+s" onPress={handleSave}>
|
|
228
|
+
Save Document
|
|
229
|
+
</ItemButton>
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
3. **Do**: Use appropriate button types for forms
|
|
233
|
+
```jsx
|
|
234
|
+
<ItemButton htmlType="submit" type="primary">
|
|
235
|
+
Submit Form
|
|
236
|
+
</ItemButton>
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
4. **Do**: Use `ItemButton.Action` for inline actions
|
|
240
|
+
```jsx
|
|
241
|
+
<ItemButton
|
|
242
|
+
icon={<IconFile />}
|
|
243
|
+
actions={
|
|
244
|
+
<>
|
|
245
|
+
<ItemButton.Action icon={<IconEdit />} aria-label="Edit" />
|
|
246
|
+
<ItemButton.Action icon={<IconTrash />} aria-label="Delete" />
|
|
247
|
+
</>
|
|
248
|
+
}
|
|
249
|
+
onPress={handleOpen}
|
|
250
|
+
>
|
|
251
|
+
Open Document
|
|
252
|
+
</ItemButton>
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
5. **Don't**: Use vague or unclear button text
|
|
256
|
+
```jsx
|
|
257
|
+
{/* Avoid this - unclear what "OK" does */}
|
|
258
|
+
<ItemButton onPress={handleAction}>OK</ItemButton>
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
6. **Don't**: Add too many actions (limit to 2-3 for clarity)
|
|
262
|
+
```jsx
|
|
263
|
+
{/* Avoid this - too many action buttons */}
|
|
264
|
+
<ItemButton
|
|
265
|
+
actions={
|
|
266
|
+
<>
|
|
267
|
+
<ItemButton.Action icon={<IconEdit />} aria-label="Edit" />
|
|
268
|
+
<ItemButton.Action icon={<IconCopy />} aria-label="Copy" />
|
|
269
|
+
<ItemButton.Action icon={<IconShare />} aria-label="Share" />
|
|
270
|
+
<ItemButton.Action icon={<IconTrash />} aria-label="Delete" />
|
|
271
|
+
</>
|
|
272
|
+
}
|
|
273
|
+
>
|
|
274
|
+
Button with too many actions
|
|
275
|
+
</ItemButton>
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
7. **Don't**: Overcrowd buttons with too many visual elements
|
|
279
|
+
```jsx
|
|
280
|
+
{/* Avoid this - too many competing elements */}
|
|
281
|
+
<ItemButton
|
|
282
|
+
icon={<IconA />}
|
|
283
|
+
rightIcon={<IconB />}
|
|
284
|
+
prefix="Pre"
|
|
285
|
+
suffix="Suf"
|
|
286
|
+
description="Long description"
|
|
287
|
+
>
|
|
288
|
+
Overcrowded Button
|
|
289
|
+
</ItemButton>
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
8. **Accessibility**: Always ensure buttons have clear, descriptive labels, proper keyboard support, and provide `aria-label` for action buttons
|
|
293
|
+
|
|
294
|
+
## Integration with Forms
|
|
295
|
+
|
|
296
|
+
ItemButton integrates seamlessly with forms when using the `htmlType` prop:
|
|
297
|
+
|
|
298
|
+
```jsx
|
|
299
|
+
<form onSubmit={handleSubmit}>
|
|
300
|
+
<TextInput name="email" label="Email" />
|
|
301
|
+
<ItemButton htmlType="submit" type="primary">
|
|
302
|
+
Sign In
|
|
303
|
+
</ItemButton>
|
|
304
|
+
<ItemButton htmlType="reset" type="outline">
|
|
305
|
+
Clear Form
|
|
306
|
+
</ItemButton>
|
|
307
|
+
</form>
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
## Related Components
|
|
311
|
+
|
|
312
|
+
- [Item](../content/Item.md) - The foundational component that ItemButton extends
|
|
313
|
+
- [ItemButton.Action](./ItemAction.md) - Action button component for inline actions (also available as `Item.Action`, `Menu.Item.Action`, etc.)
|
|
314
|
+
- [Button](./Button.md) - Traditional button component for simpler use cases
|
|
315
|
+
- [Link](./Link.md) - Text link component for navigation
|
|
316
|
+
- [Menu.Item](./Menu.md) - Menu item component that also uses Item
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
# Link
|
|
2
|
+
|
|
3
|
+
Semantic navigation component styled as a textual link. It reuses `Button` under the hood with `type="link"`, but this page focuses on navigation via the `to` prop.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
- Navigate inside your SPA using the configured router
|
|
8
|
+
- Open destinations in a new tab
|
|
9
|
+
- Jump to on‑page anchors via `#id`
|
|
10
|
+
- Perform history navigation (back/forward/reload) using numbers
|
|
11
|
+
- Bypass SPA routing and force a full page load
|
|
12
|
+
|
|
13
|
+
## Component
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Properties
|
|
18
|
+
|
|
19
|
+
- **`label`** (default: `Button`)
|
|
20
|
+
|
|
21
|
+
### Base Properties
|
|
22
|
+
|
|
23
|
+
Supports [Base properties](../../BaseProperties.md)
|
|
24
|
+
|
|
25
|
+
### Styling Properties
|
|
26
|
+
|
|
27
|
+
#### styles
|
|
28
|
+
|
|
29
|
+
Customizes the root element of the component.
|
|
30
|
+
|
|
31
|
+
Sub-elements:
|
|
32
|
+
- `ButtonIcon` – wrapper around `icon` and `rightIcon` when used.
|
|
33
|
+
|
|
34
|
+
### Style Properties
|
|
35
|
+
|
|
36
|
+
These properties allow direct styling without using the `styles` prop: `width`, `height`.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Link Syntax (`to` prop)
|
|
41
|
+
|
|
42
|
+
`to` defines where and how navigation happens. It accepts a string, an object path, or a number for history navigation.
|
|
43
|
+
|
|
44
|
+
### 1) String URL/Path (SPA push)
|
|
45
|
+
|
|
46
|
+
```jsx
|
|
47
|
+
// Navigate to internal route via the navigation adapter
|
|
48
|
+
<Link to="/pricing">Pricing</Link>
|
|
49
|
+
|
|
50
|
+
// External absolute URLs always use native navigation
|
|
51
|
+
<Link to="https://cube.dev">Cube</Link>
|
|
52
|
+
|
|
53
|
+
// Relative paths work properly with router context
|
|
54
|
+
<Link to="../parent-page">Parent</Link>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 2) Open in a new tab (`!` prefix)
|
|
58
|
+
|
|
59
|
+
```jsx
|
|
60
|
+
// Open internal route in a new tab
|
|
61
|
+
<Link to="!/changelog">Changelog</Link>
|
|
62
|
+
|
|
63
|
+
// Open external URL in a new tab
|
|
64
|
+
<Link to="!https://cube.dev">Docs</Link>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Notes:
|
|
68
|
+
- Adds `target="_blank"` and `rel="noopener noreferrer"` automatically.
|
|
69
|
+
- Cmd/Ctrl/Shift + click also opens in a new tab, like a native link.
|
|
70
|
+
|
|
71
|
+
### 3) Native navigation / full reload (`@` prefix)
|
|
72
|
+
|
|
73
|
+
```jsx
|
|
74
|
+
// Bypass SPA router and perform a full page load
|
|
75
|
+
<Link to="@/signin">Sign in</Link>
|
|
76
|
+
|
|
77
|
+
// External native navigation works as well
|
|
78
|
+
<Link to="@https://cube.dev">Homepage</Link>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 4) On‑page anchors (hash links)
|
|
82
|
+
|
|
83
|
+
```jsx
|
|
84
|
+
// Smoothly scrolls to the element with id="features"
|
|
85
|
+
<Link to="#features">Jump to Features</Link>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### 5) Object path (modern routers)
|
|
89
|
+
|
|
90
|
+
```jsx
|
|
91
|
+
// Uses navigate(to) with object path support
|
|
92
|
+
<Link
|
|
93
|
+
to={{ pathname: '/search', search: 'q=cube', hash: 'top' }}
|
|
94
|
+
>
|
|
95
|
+
Advanced search
|
|
96
|
+
</Link>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Accepted object shape:
|
|
100
|
+
```ts
|
|
101
|
+
{ pathname?: string; search?: string; hash?: string }
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Notes:
|
|
105
|
+
- `search` and `hash` are auto-prefixed with `?` and `#` if needed
|
|
106
|
+
- `pathname` can be relative (e.g., `../parent`) or absolute (e.g., `/root`)
|
|
107
|
+
- Works with `!` and `@` prefixes when passed as strings
|
|
108
|
+
|
|
109
|
+
### 6) History navigation (numbers)
|
|
110
|
+
|
|
111
|
+
```jsx
|
|
112
|
+
// Go back one entry
|
|
113
|
+
<Link to={-1}>Back</Link>
|
|
114
|
+
|
|
115
|
+
// Go forward one entry
|
|
116
|
+
<Link to={1}>Forward</Link>
|
|
117
|
+
|
|
118
|
+
// Reload current entry (like location.reload but via history)
|
|
119
|
+
<Link to={0}>Reload</Link>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Behavior:
|
|
123
|
+
- Uses `navigate(delta)` from the navigation adapter with overload signature
|
|
124
|
+
- The default adapter calls `window.history.go(delta)`
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Router Integration
|
|
129
|
+
|
|
130
|
+
`Link` uses a hook-based navigation adapter that you provide via the `Root` component. The adapter enables proper relative path resolution for new-tab navigation and modern router integration.
|
|
131
|
+
|
|
132
|
+
### Interface
|
|
133
|
+
|
|
134
|
+
```ts
|
|
135
|
+
type NavigateLike = {
|
|
136
|
+
(to: To, options?: NavigateOptions): void;
|
|
137
|
+
(delta: number): void;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
interface NavigationAdapter {
|
|
141
|
+
useHref: (to: To, opts?: { relative?: 'route' | 'path' }) => string;
|
|
142
|
+
useNavigate: () => NavigateLike;
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### React Router v6+ (Recommended)
|
|
147
|
+
|
|
148
|
+
React Router v6+ hooks are directly compatible with our `NavigationAdapter` interface:
|
|
149
|
+
|
|
150
|
+
```jsx
|
|
151
|
+
import { Root } from '@cube-dev/ui-kit';
|
|
152
|
+
import { useHref, useNavigate } from 'react-router-dom';
|
|
153
|
+
|
|
154
|
+
const navigation = { useHref, useNavigate };
|
|
155
|
+
// React Router's useNavigate supports both overloads: navigate(to, options) and navigate(delta)
|
|
156
|
+
|
|
157
|
+
export function App() {
|
|
158
|
+
return (
|
|
159
|
+
<Root navigation={navigation}>
|
|
160
|
+
{/* Your app content */}
|
|
161
|
+
</Root>
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Custom adapter example
|
|
167
|
+
|
|
168
|
+
For other routers, create a custom adapter:
|
|
169
|
+
|
|
170
|
+
```jsx
|
|
171
|
+
import { Root } from '@cube-dev/ui-kit';
|
|
172
|
+
|
|
173
|
+
function MyRouterAdapter() {
|
|
174
|
+
return {
|
|
175
|
+
useHref: (to) => {
|
|
176
|
+
// Return resolved href for the given route
|
|
177
|
+
return typeof to === 'string' ? to : `${to.pathname || ''}${to.search || ''}${to.hash || ''}`;
|
|
178
|
+
},
|
|
179
|
+
useNavigate: () => {
|
|
180
|
+
// Return function with overload signatures
|
|
181
|
+
const navigate = (to, options) => {
|
|
182
|
+
if (typeof to === 'number') {
|
|
183
|
+
window.history.go(to);
|
|
184
|
+
} else {
|
|
185
|
+
myRouter.navigate(to, options);
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
return navigate;
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export function App() {
|
|
194
|
+
const navigation = MyRouterAdapter();
|
|
195
|
+
return <Root navigation={navigation}>{/* Your app */}</Root>;
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### No router (default behavior)
|
|
200
|
+
|
|
201
|
+
When no `navigation` prop is provided, `Link` falls back to native browser navigation:
|
|
202
|
+
|
|
203
|
+
```jsx
|
|
204
|
+
import { Root } from '@cube-dev/ui-kit';
|
|
205
|
+
|
|
206
|
+
export function App() {
|
|
207
|
+
return (
|
|
208
|
+
<Root>
|
|
209
|
+
{/* Links will use window.location for navigation */}
|
|
210
|
+
</Root>
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Default adapter behavior:
|
|
216
|
+
- String/object navigation uses `window.location.assign(href)`
|
|
217
|
+
- History navigation uses `window.history.go(delta)`
|
|
218
|
+
- `!` prefix opens resolved URLs in a new tab
|
|
219
|
+
- `@` prefix forces native navigation to resolved URLs
|
|
220
|
+
- Relative paths are resolved against the current page
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## Navigation Options
|
|
225
|
+
|
|
226
|
+
Control navigation behavior via the `navigationOptions` prop:
|
|
227
|
+
|
|
228
|
+
```jsx
|
|
229
|
+
<Link
|
|
230
|
+
to="/search"
|
|
231
|
+
navigationOptions={{
|
|
232
|
+
replace: true,
|
|
233
|
+
state: { from: 'homepage' },
|
|
234
|
+
relative: 'path',
|
|
235
|
+
preventScrollReset: true
|
|
236
|
+
}}
|
|
237
|
+
>
|
|
238
|
+
Search (replace history)
|
|
239
|
+
</Link>
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Available options
|
|
243
|
+
|
|
244
|
+
- `replace`: Replace current history entry instead of pushing a new one
|
|
245
|
+
- `state`: Navigation state data (router-specific)
|
|
246
|
+
- `relative`: How relative paths are resolved (`'route'` | `'path'`)
|
|
247
|
+
- `preventScrollReset`: Prevent scroll reset on navigation
|
|
248
|
+
|
|
249
|
+
These options are passed to the router's `navigate` function and have no effect on native navigation (`@` prefix, external URLs, or when no adapter is provided).
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## Variants
|
|
254
|
+
|
|
255
|
+
`Link` inherits `theme` and `size` from `Button`. The visual `type` is fixed to `link`.
|
|
256
|
+
|
|
257
|
+
### Themes
|
|
258
|
+
|
|
259
|
+
- `default`, `danger`, `success`, `special`
|
|
260
|
+
|
|
261
|
+
### Sizes
|
|
262
|
+
|
|
263
|
+
- `xsmall`, `small`, `medium`, `large`, `xlarge`
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## Examples
|
|
268
|
+
|
|
269
|
+
### Basic SPA push
|
|
270
|
+
|
|
271
|
+
```jsx
|
|
272
|
+
<Link to="/about">About</Link>
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Anchor and new tab
|
|
276
|
+
|
|
277
|
+
```jsx
|
|
278
|
+
<Link to="#faq">FAQ</Link>
|
|
279
|
+
<Link to="!https://cube.dev">Open Docs in new tab</Link>
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### Bypass SPA
|
|
283
|
+
|
|
284
|
+
```jsx
|
|
285
|
+
<Link to="@/logout">Log out</Link>
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### History
|
|
289
|
+
|
|
290
|
+
```jsx
|
|
291
|
+
<Link to={-1}>Back</Link>
|
|
292
|
+
<Link to={0}>Reload</Link>
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## Accessibility
|
|
298
|
+
|
|
299
|
+
- Renders as an `<a>` element when `to` is a string/object; as a `<button>` when `to` is a number or omitted.
|
|
300
|
+
- Keyboard interaction and focus management are handled by React Aria.
|
|
301
|
+
- Provide `label`/`aria-label` when there is no visible text.
|
|
302
|
+
|
|
303
|
+
### ARIA Properties
|
|
304
|
+
|
|
305
|
+
- `aria-label`, `aria-labelledby` – Accessible name.
|
|
306
|
+
- Additional ARIA attributes supported by React Aria's `useButton`.
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
## Best Practices
|
|
311
|
+
|
|
312
|
+
1. Prefer SPA push (`to="/path"`) for in‑app navigation; use `@` only when a full reload is required.
|
|
313
|
+
2. Use `!` for new tabs instead of adding `target` props yourself; security attributes are added automatically.
|
|
314
|
+
3. Use object `to` when your router supports structured navigation.
|
|
315
|
+
4. For back/forward actions in UI, use numeric `to` for predictable history behavior.
|
|
316
|
+
|
|
317
|
+
## Suggested Improvements
|
|
318
|
+
|
|
319
|
+
- Add a dedicated `href` prop alias for clarity in link‑only scenarios.
|
|
320
|
+
- Expose a `replace` option for SPA navigation.
|
|
321
|
+
|
|
322
|
+
## Related Components
|
|
323
|
+
|
|
324
|
+
- [Button](./Button.md) – Action component with multiple visual styles, including `type="link"`.
|
|
325
|
+
|