@cube-dev/ui-kit 0.0.0-canary-e4907a7 → 0.0.0-canary-ec4e0f5
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 +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/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 +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/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 +5 -2
- package/dist/components/fields/Checkbox/Checkbox.js.map +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/CommandTextArea/CommandTextArea.js +1 -1
- package/dist/components/fields/CommandTextArea/CommandTextArea.js.map +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/TimeInput.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 +26 -3
- package/dist/components/fields/FileInput/FileInput.js.map +1 -1
- package/dist/components/fields/FilterListBox/FilterListBox.js +1 -1
- package/dist/components/fields/FilterPicker/FilterPicker.js +8 -2
- package/dist/components/fields/FilterPicker/FilterPicker.js.map +1 -1
- package/dist/components/fields/Input/Input.js +1 -1
- 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/NumberInput.js.map +1 -1
- package/dist/components/fields/NumberInput/StepButton.js +1 -1
- package/dist/components/fields/PasswordInput/PasswordInput.js +1 -1
- package/dist/components/fields/PasswordInput/PasswordInput.js.map +1 -1
- package/dist/components/fields/Picker/Picker.js +8 -2
- package/dist/components/fields/Picker/Picker.js.map +1 -1
- package/dist/components/fields/RadioGroup/Radio.js +4 -2
- 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 +10 -4
- package/dist/components/fields/Slider/RangeSlider.js.map +1 -1
- package/dist/components/fields/Slider/Slider.js +6 -2
- package/dist/components/fields/Slider/Slider.js.map +1 -1
- package/dist/components/fields/Slider/SliderBase.js +17 -5
- package/dist/components/fields/Slider/SliderBase.js.map +1 -1
- package/dist/components/fields/Slider/SliderThumb.js +11 -4
- package/dist/components/fields/Slider/SliderThumb.js.map +1 -1
- package/dist/components/fields/Slider/SliderTrack.js +15 -4
- package/dist/components/fields/Slider/SliderTrack.js.map +1 -1
- package/dist/components/fields/Slider/elements.js +5 -1
- package/dist/components/fields/Slider/elements.js.map +1 -1
- package/dist/components/fields/Slider/index.js +1 -1
- package/dist/components/fields/Switch/Switch.js +5 -2
- package/dist/components/fields/Switch/Switch.js.map +1 -1
- package/dist/components/fields/TextArea/TextArea.js +1 -1
- package/dist/components/fields/TextArea/TextArea.js.map +1 -1
- package/dist/components/fields/TextInput/TextInput.js +1 -1
- package/dist/components/fields/TextInput/TextInput.js.map +1 -1
- package/dist/components/fields/TextInput/TextInputBase.js +1 -1
- package/dist/components/fields/TextInputMapper/TextInputMapper.d.ts +2 -0
- package/dist/components/fields/TextInputMapper/TextInputMapper.js +13 -3
- package/dist/components/fields/TextInputMapper/TextInputMapper.js.map +1 -1
- 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/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/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/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 +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 +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/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 -1
- package/dist/i18n/locales/en-US/uikit.js +1 -1
- package/dist/i18n/locales/es-ES/uikit.js +1 -1
- package/dist/i18n/locales/es-MX/uikit.js +1 -1
- package/dist/i18n/locales/fr-FR/uikit.js +1 -1
- package/dist/i18n/locales/it-IT/uikit.js +1 -1
- package/dist/i18n/locales/ja-JP/uikit.js +1 -1
- package/dist/i18n/locales/nb-NO/uikit.js +1 -1
- package/dist/i18n/locales/pt-BR/uikit.js +1 -1
- package/dist/i18n/locales/pt-PT/uikit.js +1 -1
- package/dist/i18n/locales/sv-SE/uikit.js +1 -1
- package/dist/i18n/locales/vi-VN/uikit.js +1 -1
- 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/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.js +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/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.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/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/FileInput.md +2 -0
- package/docs/components/fields/Slider.md +4 -0
- package/docs/components/fields/TextInputMapper.md +5 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-ec4e0f5 | Cube Dev Team */
|
|
2
2
|
import { extractStyles } from "../../../utils/styles.js";
|
|
3
3
|
import { mergeProps as mergeProps$1 } from "../../../utils/react/mergeProps.js";
|
|
4
4
|
import { useFocus as useFocus$1 } from "../../../utils/react/interactions.js";
|
|
@@ -92,6 +92,7 @@ const RadioNormalElement = tasty({ styles: {
|
|
|
92
92
|
"": "#clear",
|
|
93
93
|
checked: "#primary",
|
|
94
94
|
"invalid & checked": "#danger-text",
|
|
95
|
+
"valid & checked": "#success-text",
|
|
95
96
|
"disabled | !checked": "#clear",
|
|
96
97
|
"disabled & checked": "#dark.12"
|
|
97
98
|
},
|
|
@@ -99,6 +100,7 @@ const RadioNormalElement = tasty({ styles: {
|
|
|
99
100
|
"": "#dark-04",
|
|
100
101
|
checked: "#primary-text",
|
|
101
102
|
invalid: "#danger-text.50",
|
|
103
|
+
valid: "#success-text.50",
|
|
102
104
|
disabled: "#dark.12"
|
|
103
105
|
},
|
|
104
106
|
width: "2x",
|
|
@@ -192,7 +194,7 @@ function Radio(props, ref) {
|
|
|
192
194
|
theme: getValidationTheme("default", {
|
|
193
195
|
isInvalid,
|
|
194
196
|
isValid
|
|
195
|
-
}),
|
|
197
|
+
}, { includeValid: true }),
|
|
196
198
|
size: effectiveSize,
|
|
197
199
|
icon,
|
|
198
200
|
rightIcon,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.js","names":["Item","useFocus","mergeProps","RadioGroup"],"sources":["../../../../src/components/fields/RadioGroup/Radio.tsx"],"sourcesContent":["import { useFocusableRef } from '@react-spectrum/utils';\nimport {\n BaseProps,\n filterBaseProps,\n OUTER_STYLES,\n OuterStyleProps,\n tasty,\n} from '@tenphi/tasty';\nimport { forwardRef, useMemo, useRef } from 'react';\nimport { useHover, useRadio } from 'react-aria';\n\nimport { FieldBaseProps } from '../../../shared';\nimport { mergeProps } from '../../../utils/react';\nimport { useFocus } from '../../../utils/react/interactions';\nimport { extractStyles } from '../../../utils/styles';\nimport { CubeItemProps, Item } from '../../content/Item/Item';\nimport {\n getValidationMods,\n getValidationTheme,\n INLINE_LABEL_STYLES,\n useFieldProps,\n} from '../../form';\nimport { HiddenInput } from '../../HiddenInput';\nimport { RADIO_SIZE_MAP } from '../../navigation/Tabs/types';\n\nimport { useRadioProvider } from './context';\nimport { RadioGroup } from './RadioGroup';\n\nimport type { AriaRadioProps } from 'react-aria';\n\nexport { AriaRadioProps };\nexport { useRadio };\n\nconst RadioButtonElement = tasty(Item, {\n qa: 'RadioButton',\n as: 'label',\n styles: {\n preset: 't3m',\n lineHeight: '1em',\n flexGrow: 1,\n gridTemplate:\n '\"icon prefix label suffix rightIcon actions\" auto / max-content max-content max-content max-content max-content max-content',\n placeContent: 'center',\n shadow: {\n '': false,\n 'tabs & selected': '$item-shadow',\n 'tabs & selected & disabled': false,\n },\n fill: {\n 'selected & tabs': '#surface',\n 'selected & tabs & disabled': '#surface.6',\n },\n color: {\n 'selected & tabs': '#dark',\n 'selected & tabs & disabled': '#dark.3',\n },\n\n // Mirror the ButtonSplit grouping: the corner radius is shared so the\n // first/last items keep only their outer-side radius and middle items go\n // square; a -1bw left margin overlaps adjacent borders into a single\n // continuous edge. The selected button is bumped above its siblings so its\n // brand-tinted border is visible from all four sides — without the bump\n // the right edge of an adjacent sibling would paint over the selected\n // button's left edge (and vice-versa). Hover / focus-visible bump higher\n // still so they always read on top of the selected highlight.\n radius: {\n '': true,\n '!tabs & !:last-child': '1r left',\n '!tabs & !:first-child': '1r right',\n '!tabs & !:first-child & !:last-child': 0,\n },\n margin: {\n '': 0,\n '!tabs & !:first-child': '-1bw left',\n },\n zIndex: {\n '!tabs & selected': 1,\n },\n\n Label: {\n placeSelf: {\n '': 'center start',\n '!has-prefix & !has-suffix & !has-icon & !has-right-icon': 'center',\n },\n },\n },\n});\n\nconst RadioWrapperElement = tasty({\n as: 'label',\n qa: 'RadioWrapper',\n styles: {\n position: 'relative',\n display: 'grid',\n placeItems: 'center start',\n placeContent: 'center start',\n gap: '1x',\n flow: 'column',\n preset: 'default',\n width: 'min-content',\n radius: true,\n margin: {\n '': '1x right',\n button: '0',\n },\n zIndex: {\n '': 'initial',\n checked: 1,\n },\n flexGrow: 1,\n },\n});\n\nconst RadioNormalElement = tasty({\n styles: {\n display: 'grid',\n placeItems: 'center',\n radius: 'round',\n fill: {\n '': '#surface',\n disabled: '#disabled-surface',\n },\n color: {\n '': '#clear',\n checked: '#primary',\n 'invalid & checked': '#danger-text',\n 'disabled | !checked': '#clear',\n 'disabled & checked': '#dark.12',\n },\n border: {\n '': '#dark-04',\n checked: '#primary-text',\n invalid: '#danger-text.50',\n disabled: '#dark.12',\n },\n width: '2x',\n height: '2x',\n outline: {\n '': '#primary-text.0 / 1bw',\n focused: '1bw #primary-text / 1bw',\n },\n transition: 'theme',\n whiteSpace: 'nowrap',\n\n RadioCircle: {\n display: 'block',\n radius: 'round',\n width: '1x',\n height: '1x',\n fill: 'currentColor',\n },\n },\n});\n\nconst RadioCircleElement = <div data-element=\"RadioCircle\" />;\n\nconst RadioLabelElement = tasty({\n qa: 'RadioLabel',\n styles: INLINE_LABEL_STYLES,\n});\n\nexport interface CubeRadioProps\n extends BaseProps,\n AriaRadioProps,\n Omit<FieldBaseProps, 'tooltip'>,\n OuterStyleProps {\n 'aria-label'?: string;\n /* The visual type of the radio button */\n type?: 'button' | 'radio';\n buttonType?: CubeItemProps['type'];\n value?: string;\n /* Size of the button (for button type only) */\n size?: Omit<CubeItemProps['size'], 'inline'>;\n /* Icon to display (for button type only) */\n icon?: CubeItemProps['icon'];\n /* Icon to display on the right (for button type only) */\n rightIcon?: CubeItemProps['rightIcon'];\n /* Prefix element (for button type only) */\n prefix?: CubeItemProps['prefix'];\n /* Suffix element (for button type only) */\n suffix?: CubeItemProps['suffix'];\n /* Description text (for button type only) */\n description?: CubeItemProps['description'];\n /* Tooltip configuration (for button type only) */\n tooltip?: CubeItemProps['tooltip'];\n /* Keyboard shortcut (for button type only) */\n hotkeys?: CubeItemProps['hotkeys'];\n}\n\nfunction Radio(props: CubeRadioProps, ref) {\n props = useFieldProps(props, { defaultValidationTrigger: 'onChange' });\n\n let {\n qa,\n isDisabled,\n isInvalid,\n isValid,\n children,\n label,\n autoFocus,\n labelStyles,\n labelProps,\n type,\n buttonType,\n size,\n icon,\n rightIcon,\n prefix,\n suffix,\n description,\n tooltip,\n hotkeys,\n 'aria-label': ariaLabel,\n form,\n ...otherProps\n } = props;\n\n label = label || children;\n\n let styles = extractStyles(otherProps, OUTER_STYLES);\n\n labelStyles = {\n ...INLINE_LABEL_STYLES,\n ...labelStyles,\n };\n\n let radioGroupProps = useRadioProvider();\n\n let state = radioGroupProps && radioGroupProps.state;\n let name = radioGroupProps && radioGroupProps.name;\n let contextSize = radioGroupProps?.size;\n let contextButtonType = radioGroupProps?.buttonType;\n let contextType = radioGroupProps?.type;\n let contextIsDisabled = radioGroupProps?.isDisabled;\n\n if (!state) {\n throw new Error('CubeUI: The Radio button is used outside the RadioGroup.');\n }\n\n // Determine effective type from props or context\n let effectiveType = type ?? contextType ?? 'radio';\n let isButton = effectiveType === 'button' || effectiveType === 'tabs';\n\n // Determine effective size with priority: prop > context > default\n let effectiveSize: CubeItemProps['size'] = (size ??\n contextSize ??\n 'medium') as CubeItemProps['size'];\n\n // Apply size mapping for tabs mode button radios.\n // API sizes mapped to Item button sizes: large -> medium (40px), medium -> xsmall (32px).\n if (effectiveType === 'tabs' && isButton) {\n effectiveSize =\n RADIO_SIZE_MAP[effectiveSize === 'large' ? 'large' : 'medium'];\n }\n\n // Determine effective button type\n // In tabs mode, always use 'clear' and ignore buttonType prop.\n let effectiveButtonType: string;\n // When buttonType is 'primary', non-selected radios use 'outline' with a\n // visual-only `selected` mod (mods.selected=true) to render the brand-tinted\n // outline+selected look — this is the only place mods.selected intentionally\n // decouples from the aria/isSelected state.\n let forceSelectedMod = false;\n if (effectiveType === 'tabs') {\n effectiveButtonType = 'clear';\n } else {\n const baseButtonType = buttonType ?? contextButtonType ?? 'outline';\n if (baseButtonType === 'primary') {\n if (state.selectedValue === props.value) {\n effectiveButtonType = 'primary';\n } else {\n effectiveButtonType = 'outline';\n forceSelectedMod = true;\n }\n } else {\n effectiveButtonType = baseButtonType;\n }\n }\n\n // Use context isDisabled if prop isDisabled is not explicitly set\n let effectiveIsDisabled = isDisabled ?? contextIsDisabled ?? false;\n\n let { isFocused, focusProps } = useFocus(\n { isDisabled: effectiveIsDisabled },\n true,\n );\n let { hoverProps, isHovered } = useHover({ isDisabled: effectiveIsDisabled });\n\n let inputRef = useRef(null);\n let domRef = useFocusableRef(ref, inputRef);\n\n let {\n inputProps,\n isDisabled: isRadioDisabled,\n isSelected: isRadioSelected,\n } = useRadio(\n {\n name,\n ...props,\n isDisabled: effectiveIsDisabled,\n },\n state,\n inputRef,\n );\n\n const mods = useMemo(\n () => ({\n checked: isRadioSelected,\n ...getValidationMods({ isInvalid, isValid }),\n disabled: isRadioDisabled,\n hovered: isHovered,\n button: isButton,\n focused: isFocused,\n tabs: effectiveType === 'tabs',\n }),\n [\n isRadioSelected,\n isInvalid,\n isValid,\n isRadioDisabled,\n isHovered,\n isButton,\n isFocused,\n effectiveType,\n ],\n );\n\n // Render button type using Item\n if (isButton) {\n return (\n <RadioButtonElement\n ref={domRef}\n type={effectiveButtonType}\n theme={getValidationTheme('default', { isInvalid, isValid })}\n size={effectiveSize}\n icon={icon}\n rightIcon={rightIcon}\n prefix={prefix}\n suffix={suffix}\n description={description}\n tooltip={tooltip}\n hotkeys={hotkeys}\n isSelected={isRadioSelected}\n isDisabled={isRadioDisabled}\n mods={{ ...mods, ...(forceSelectedMod ? { selected: true } : {}) }}\n styles={styles}\n {...mergeProps(hoverProps, focusProps)}\n >\n <HiddenInput\n qa={qa || 'Radio'}\n data-input-type=\"radio\"\n aria-label={ariaLabel}\n {...inputProps}\n ref={inputRef}\n form={null}\n mods={{ button: isButton, disabled: isRadioDisabled }}\n />\n {label}\n </RadioButtonElement>\n );\n }\n\n // Render classic radio type\n return (\n <RadioWrapperElement\n styles={styles}\n {...hoverProps}\n ref={domRef}\n mods={mods}\n data-type={type}\n >\n <HiddenInput\n qa={qa || 'Radio'}\n data-input-type=\"radio\"\n aria-label={ariaLabel}\n {...mergeProps(inputProps, focusProps)}\n ref={inputRef}\n mods={{ button: isButton }}\n />\n <RadioNormalElement data-element=\"Input\" mods={mods} data-type={type}>\n {RadioCircleElement}\n </RadioNormalElement>\n {label && (\n <RadioLabelElement\n mods={mods}\n styles={labelStyles}\n {...(labelProps ? filterBaseProps(labelProps) : undefined)}\n >\n {label}\n </RadioLabelElement>\n )}\n </RadioWrapperElement>\n );\n}\n\n/**\n * Radio buttons allow users to select a single option from a list of mutually exclusive options.\n * All possible options are exposed up front for users to compare.\n */\nconst _Radio = forwardRef(Radio);\n\nconst Tabs = tasty(RadioGroup, {\n type: 'tabs',\n});\n\nconst ButtonGroup = tasty(RadioGroup, {\n type: 'button',\n});\n\nconst __Radio = Object.assign(\n _Radio as typeof _Radio & {\n Group: typeof RadioGroup;\n Tabs: typeof Tabs;\n ButtonGroup: typeof ButtonGroup;\n Button: typeof _Radio;\n },\n {\n Group: RadioGroup,\n Tabs,\n ButtonGroup,\n Button: _Radio,\n },\n);\n\n__Radio.displayName = 'Radio';\n\nexport { __Radio as Radio };\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAiCA,MAAM,qBAAqB,MAAMA,OAAM;CACrC,IAAI;CACJ,IAAI;CACJ,QAAQ;EACN,QAAQ;EACR,YAAY;EACZ,UAAU;EACV,cACE;EACF,cAAc;EACd,QAAQ;GACN,IAAI;GACJ,mBAAmB;GACnB,8BAA8B;GAC/B;EACD,MAAM;GACJ,mBAAmB;GACnB,8BAA8B;GAC/B;EACD,OAAO;GACL,mBAAmB;GACnB,8BAA8B;GAC/B;EAUD,QAAQ;GACN,IAAI;GACJ,wBAAwB;GACxB,yBAAyB;GACzB,wCAAwC;GACzC;EACD,QAAQ;GACN,IAAI;GACJ,yBAAyB;GAC1B;EACD,QAAQ,EACN,oBAAoB,GACrB;EAED,OAAO,EACL,WAAW;GACT,IAAI;GACJ,2DAA2D;GAC5D,EACF;EACF;CACF,CAAC;AAEF,MAAM,sBAAsB,MAAM;CAChC,IAAI;CACJ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;EACZ,YAAY;EACZ,MAAM;GAAE,GAAG;GAAM,GAAI,mBAAmB,EAAE,UAAU,MAAM,GAAG,EAAE;GAAG;EAC1D;EACR,GAAIC,aAAW,YAAY,WAAW;aAEtC,oBAAC;GACC,IAAI,MAAM;GACV,mBAAgB;GAChB,cAAY;GACZ,GAAI;GACJ,KAAK;GACL,MAAM;GACN,MAAM;IAAE,QAAQ;IAAU,UAAU;IAAiB;IACrD,EACD;GACkB;AAKzB,QACE,qBAAC;EACS;EACR,GAAI;EACJ,KAAK;EACC;EACN,aAAW;;GAEX,oBAAC;IACC,IAAI,MAAM;IACV,mBAAgB;IAChB,cAAY;IACZ,GAAIA,aAAW,YAAY,WAAW;IACtC,KAAK;IACL,MAAM,EAAE,QAAQ,UAAU;KAC1B;GACF,oBAAC;IAAmB,gBAAa;IAAc;IAAM,aAAW;cAC7D;KACkB;GACpB,SACC,oBAAC;IACO;IACN,QAAQ;IACR,GAAK,aAAa,gBAAgB,WAAW,GAAG;cAE/C;KACiB;;GAEF;;;;;;AAQ1B,MAAM,SAAS,WAAW,MAAM;AAEhC,MAAM,OAAO,MAAMC,aAAY,EAC7B,MAAM,QACP,CAAC;AAEF,MAAM,cAAc,MAAMA,aAAY,EACpC,MAAM,UACP,CAAC;AAEF,MAAM,UAAU,OAAO,OACrB,QAMA;CACE,OAAOA;CACP;CACA;CACA,QAAQ;CACT,CACF;AAED,QAAQ,cAAc"}
|
|
1
|
+
{"version":3,"file":"Radio.js","names":["Item","useFocus","mergeProps","RadioGroup"],"sources":["../../../../src/components/fields/RadioGroup/Radio.tsx"],"sourcesContent":["import { useFocusableRef } from '@react-spectrum/utils';\nimport {\n BaseProps,\n filterBaseProps,\n OUTER_STYLES,\n OuterStyleProps,\n tasty,\n} from '@tenphi/tasty';\nimport { forwardRef, useMemo, useRef } from 'react';\nimport { useHover, useRadio } from 'react-aria';\n\nimport { FieldBaseProps } from '../../../shared';\nimport { mergeProps } from '../../../utils/react';\nimport { useFocus } from '../../../utils/react/interactions';\nimport { extractStyles } from '../../../utils/styles';\nimport { CubeItemProps, Item } from '../../content/Item/Item';\nimport {\n getValidationMods,\n getValidationTheme,\n INLINE_LABEL_STYLES,\n useFieldProps,\n} from '../../form';\nimport { HiddenInput } from '../../HiddenInput';\nimport { RADIO_SIZE_MAP } from '../../navigation/Tabs/types';\n\nimport { useRadioProvider } from './context';\nimport { RadioGroup } from './RadioGroup';\n\nimport type { AriaRadioProps } from 'react-aria';\n\nexport { AriaRadioProps };\nexport { useRadio };\n\nconst RadioButtonElement = tasty(Item, {\n qa: 'RadioButton',\n as: 'label',\n styles: {\n preset: 't3m',\n lineHeight: '1em',\n flexGrow: 1,\n gridTemplate:\n '\"icon prefix label suffix rightIcon actions\" auto / max-content max-content max-content max-content max-content max-content',\n placeContent: 'center',\n shadow: {\n '': false,\n 'tabs & selected': '$item-shadow',\n 'tabs & selected & disabled': false,\n },\n fill: {\n 'selected & tabs': '#surface',\n 'selected & tabs & disabled': '#surface.6',\n },\n color: {\n 'selected & tabs': '#dark',\n 'selected & tabs & disabled': '#dark.3',\n },\n\n // Mirror the ButtonSplit grouping: the corner radius is shared so the\n // first/last items keep only their outer-side radius and middle items go\n // square; a -1bw left margin overlaps adjacent borders into a single\n // continuous edge. The selected button is bumped above its siblings so its\n // brand-tinted border is visible from all four sides — without the bump\n // the right edge of an adjacent sibling would paint over the selected\n // button's left edge (and vice-versa). Hover / focus-visible bump higher\n // still so they always read on top of the selected highlight.\n radius: {\n '': true,\n '!tabs & !:last-child': '1r left',\n '!tabs & !:first-child': '1r right',\n '!tabs & !:first-child & !:last-child': 0,\n },\n margin: {\n '': 0,\n '!tabs & !:first-child': '-1bw left',\n },\n zIndex: {\n '!tabs & selected': 1,\n },\n\n Label: {\n placeSelf: {\n '': 'center start',\n '!has-prefix & !has-suffix & !has-icon & !has-right-icon': 'center',\n },\n },\n },\n});\n\nconst RadioWrapperElement = tasty({\n as: 'label',\n qa: 'RadioWrapper',\n styles: {\n position: 'relative',\n display: 'grid',\n placeItems: 'center start',\n placeContent: 'center start',\n gap: '1x',\n flow: 'column',\n preset: 'default',\n width: 'min-content',\n radius: true,\n margin: {\n '': '1x right',\n button: '0',\n },\n zIndex: {\n '': 'initial',\n checked: 1,\n },\n flexGrow: 1,\n },\n});\n\nconst RadioNormalElement = tasty({\n styles: {\n display: 'grid',\n placeItems: 'center',\n radius: 'round',\n fill: {\n '': '#surface',\n disabled: '#disabled-surface',\n },\n color: {\n '': '#clear',\n checked: '#primary',\n 'invalid & checked': '#danger-text',\n 'valid & checked': '#success-text',\n 'disabled | !checked': '#clear',\n 'disabled & checked': '#dark.12',\n },\n border: {\n '': '#dark-04',\n checked: '#primary-text',\n invalid: '#danger-text.50',\n valid: '#success-text.50',\n disabled: '#dark.12',\n },\n width: '2x',\n height: '2x',\n outline: {\n '': '#primary-text.0 / 1bw',\n focused: '1bw #primary-text / 1bw',\n },\n transition: 'theme',\n whiteSpace: 'nowrap',\n\n RadioCircle: {\n display: 'block',\n radius: 'round',\n width: '1x',\n height: '1x',\n fill: 'currentColor',\n },\n },\n});\n\nconst RadioCircleElement = <div data-element=\"RadioCircle\" />;\n\nconst RadioLabelElement = tasty({\n qa: 'RadioLabel',\n styles: INLINE_LABEL_STYLES,\n});\n\nexport interface CubeRadioProps\n extends BaseProps,\n AriaRadioProps,\n Omit<FieldBaseProps, 'tooltip'>,\n OuterStyleProps {\n 'aria-label'?: string;\n /* The visual type of the radio button */\n type?: 'button' | 'radio';\n buttonType?: CubeItemProps['type'];\n value?: string;\n /* Size of the button (for button type only) */\n size?: Omit<CubeItemProps['size'], 'inline'>;\n /* Icon to display (for button type only) */\n icon?: CubeItemProps['icon'];\n /* Icon to display on the right (for button type only) */\n rightIcon?: CubeItemProps['rightIcon'];\n /* Prefix element (for button type only) */\n prefix?: CubeItemProps['prefix'];\n /* Suffix element (for button type only) */\n suffix?: CubeItemProps['suffix'];\n /* Description text (for button type only) */\n description?: CubeItemProps['description'];\n /* Tooltip configuration (for button type only) */\n tooltip?: CubeItemProps['tooltip'];\n /* Keyboard shortcut (for button type only) */\n hotkeys?: CubeItemProps['hotkeys'];\n}\n\nfunction Radio(props: CubeRadioProps, ref) {\n props = useFieldProps(props, { defaultValidationTrigger: 'onChange' });\n\n let {\n qa,\n isDisabled,\n isInvalid,\n isValid,\n children,\n label,\n autoFocus,\n labelStyles,\n labelProps,\n type,\n buttonType,\n size,\n icon,\n rightIcon,\n prefix,\n suffix,\n description,\n tooltip,\n hotkeys,\n 'aria-label': ariaLabel,\n form,\n ...otherProps\n } = props;\n\n label = label || children;\n\n let styles = extractStyles(otherProps, OUTER_STYLES);\n\n labelStyles = {\n ...INLINE_LABEL_STYLES,\n ...labelStyles,\n };\n\n let radioGroupProps = useRadioProvider();\n\n let state = radioGroupProps && radioGroupProps.state;\n let name = radioGroupProps && radioGroupProps.name;\n let contextSize = radioGroupProps?.size;\n let contextButtonType = radioGroupProps?.buttonType;\n let contextType = radioGroupProps?.type;\n let contextIsDisabled = radioGroupProps?.isDisabled;\n\n if (!state) {\n throw new Error('CubeUI: The Radio button is used outside the RadioGroup.');\n }\n\n // Determine effective type from props or context\n let effectiveType = type ?? contextType ?? 'radio';\n let isButton = effectiveType === 'button' || effectiveType === 'tabs';\n\n // Determine effective size with priority: prop > context > default\n let effectiveSize: CubeItemProps['size'] = (size ??\n contextSize ??\n 'medium') as CubeItemProps['size'];\n\n // Apply size mapping for tabs mode button radios.\n // API sizes mapped to Item button sizes: large -> medium (40px), medium -> xsmall (32px).\n if (effectiveType === 'tabs' && isButton) {\n effectiveSize =\n RADIO_SIZE_MAP[effectiveSize === 'large' ? 'large' : 'medium'];\n }\n\n // Determine effective button type\n // In tabs mode, always use 'clear' and ignore buttonType prop.\n let effectiveButtonType: string;\n // When buttonType is 'primary', non-selected radios use 'outline' with a\n // visual-only `selected` mod (mods.selected=true) to render the brand-tinted\n // outline+selected look — this is the only place mods.selected intentionally\n // decouples from the aria/isSelected state.\n let forceSelectedMod = false;\n if (effectiveType === 'tabs') {\n effectiveButtonType = 'clear';\n } else {\n const baseButtonType = buttonType ?? contextButtonType ?? 'outline';\n if (baseButtonType === 'primary') {\n if (state.selectedValue === props.value) {\n effectiveButtonType = 'primary';\n } else {\n effectiveButtonType = 'outline';\n forceSelectedMod = true;\n }\n } else {\n effectiveButtonType = baseButtonType;\n }\n }\n\n // Use context isDisabled if prop isDisabled is not explicitly set\n let effectiveIsDisabled = isDisabled ?? contextIsDisabled ?? false;\n\n let { isFocused, focusProps } = useFocus(\n { isDisabled: effectiveIsDisabled },\n true,\n );\n let { hoverProps, isHovered } = useHover({ isDisabled: effectiveIsDisabled });\n\n let inputRef = useRef(null);\n let domRef = useFocusableRef(ref, inputRef);\n\n let {\n inputProps,\n isDisabled: isRadioDisabled,\n isSelected: isRadioSelected,\n } = useRadio(\n {\n name,\n ...props,\n isDisabled: effectiveIsDisabled,\n },\n state,\n inputRef,\n );\n\n const mods = useMemo(\n () => ({\n checked: isRadioSelected,\n ...getValidationMods({ isInvalid, isValid }),\n disabled: isRadioDisabled,\n hovered: isHovered,\n button: isButton,\n focused: isFocused,\n tabs: effectiveType === 'tabs',\n }),\n [\n isRadioSelected,\n isInvalid,\n isValid,\n isRadioDisabled,\n isHovered,\n isButton,\n isFocused,\n effectiveType,\n ],\n );\n\n // Render button type using Item\n if (isButton) {\n return (\n <RadioButtonElement\n ref={domRef}\n type={effectiveButtonType}\n theme={getValidationTheme(\n 'default',\n { isInvalid, isValid },\n { includeValid: true },\n )}\n size={effectiveSize}\n icon={icon}\n rightIcon={rightIcon}\n prefix={prefix}\n suffix={suffix}\n description={description}\n tooltip={tooltip}\n hotkeys={hotkeys}\n isSelected={isRadioSelected}\n isDisabled={isRadioDisabled}\n mods={{ ...mods, ...(forceSelectedMod ? { selected: true } : {}) }}\n styles={styles}\n {...mergeProps(hoverProps, focusProps)}\n >\n <HiddenInput\n qa={qa || 'Radio'}\n data-input-type=\"radio\"\n aria-label={ariaLabel}\n {...inputProps}\n ref={inputRef}\n form={null}\n mods={{ button: isButton, disabled: isRadioDisabled }}\n />\n {label}\n </RadioButtonElement>\n );\n }\n\n // Render classic radio type\n return (\n <RadioWrapperElement\n styles={styles}\n {...hoverProps}\n ref={domRef}\n mods={mods}\n data-type={type}\n >\n <HiddenInput\n qa={qa || 'Radio'}\n data-input-type=\"radio\"\n aria-label={ariaLabel}\n {...mergeProps(inputProps, focusProps)}\n ref={inputRef}\n mods={{ button: isButton }}\n />\n <RadioNormalElement data-element=\"Input\" mods={mods} data-type={type}>\n {RadioCircleElement}\n </RadioNormalElement>\n {label && (\n <RadioLabelElement\n mods={mods}\n styles={labelStyles}\n {...(labelProps ? filterBaseProps(labelProps) : undefined)}\n >\n {label}\n </RadioLabelElement>\n )}\n </RadioWrapperElement>\n );\n}\n\n/**\n * Radio buttons allow users to select a single option from a list of mutually exclusive options.\n * All possible options are exposed up front for users to compare.\n */\nconst _Radio = forwardRef(Radio);\n\nconst Tabs = tasty(RadioGroup, {\n type: 'tabs',\n});\n\nconst ButtonGroup = tasty(RadioGroup, {\n type: 'button',\n});\n\nconst __Radio = Object.assign(\n _Radio as typeof _Radio & {\n Group: typeof RadioGroup;\n Tabs: typeof Tabs;\n ButtonGroup: typeof ButtonGroup;\n Button: typeof _Radio;\n },\n {\n Group: RadioGroup,\n Tabs,\n ButtonGroup,\n Button: _Radio,\n },\n);\n\n__Radio.displayName = 'Radio';\n\nexport { __Radio as Radio };\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAiCA,MAAM,qBAAqB,MAAMA,OAAM;CACrC,IAAI;CACJ,IAAI;CACJ,QAAQ;EACN,QAAQ;EACR,YAAY;EACZ,UAAU;EACV,cACE;EACF,cAAc;EACd,QAAQ;GACN,IAAI;GACJ,mBAAmB;GACnB,8BAA8B;GAC/B;EACD,MAAM;GACJ,mBAAmB;GACnB,8BAA8B;GAC/B;EACD,OAAO;GACL,mBAAmB;GACnB,8BAA8B;GAC/B;EAUD,QAAQ;GACN,IAAI;GACJ,wBAAw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
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-ec4e0f5 | Cube Dev Team */
|
|
2
2
|
import { extractStyles } from "../../../utils/styles.js";
|
|
3
3
|
import { mergeProps as mergeProps$1 } from "../../../utils/react/mergeProps.js";
|
|
4
4
|
import { FormContext } from "../../form/Form/Form.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-ec4e0f5 | Cube Dev Team */
|
|
2
2
|
import { extractStyles } from "../../../utils/styles.js";
|
|
3
3
|
import { useCombinedRefs } from "../../../utils/react/useCombinedRefs.js";
|
|
4
4
|
import { usePopoverSync } from "../../../utils/react/usePopoverSync.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-ec4e0f5 | Cube Dev Team */
|
|
2
2
|
import { mergeProps as mergeProps$1 } from "../../../utils/react/mergeProps.js";
|
|
3
3
|
import { useProviderProps } from "../../../provider.js";
|
|
4
4
|
import { ItemAction } from "../../actions/ItemAction/ItemAction.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-ec4e0f5 | Cube Dev Team */
|
|
2
2
|
import { extractStyles } from "../../../utils/styles.js";
|
|
3
3
|
import { forwardRefWithGenerics } from "../../../utils/react/forwardRefWithGenerics.js";
|
|
4
4
|
import { mergeProps as mergeProps$1 } from "../../../utils/react/mergeProps.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-ec4e0f5 | Cube Dev Team */
|
|
2
2
|
import { SliderGradationElement, SliderGradeElement } from "./elements.js";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-ec4e0f5 | Cube Dev Team */
|
|
2
2
|
import { __Slider } from "./Slider.js";
|
|
3
3
|
import { forwardRef, useCallback, useMemo, useState } from "react";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-ec4e0f5 | Cube Dev Team */
|
|
2
2
|
import { Gradation } from "./Gradation.js";
|
|
3
3
|
import { _SliderBase } from "./SliderBase.js";
|
|
4
4
|
import { SliderThumb } from "./SliderThumb.js";
|
|
@@ -18,7 +18,7 @@ function RangeSlider(props, ref) {
|
|
|
18
18
|
return /* @__PURE__ */ jsx(_SliderBase, {
|
|
19
19
|
ref,
|
|
20
20
|
...otherProps,
|
|
21
|
-
children: ({ trackRef, inputRef, state }) => {
|
|
21
|
+
children: ({ trackRef, inputRef, state, isInvalid, isValid }) => {
|
|
22
22
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
23
23
|
/* @__PURE__ */ jsx(Gradation, {
|
|
24
24
|
state,
|
|
@@ -28,6 +28,8 @@ function RangeSlider(props, ref) {
|
|
|
28
28
|
/* @__PURE__ */ jsx(SliderTrack, {
|
|
29
29
|
state,
|
|
30
30
|
isDisabled,
|
|
31
|
+
isInvalid,
|
|
32
|
+
isValid,
|
|
31
33
|
orientation: props.orientation
|
|
32
34
|
}),
|
|
33
35
|
/* @__PURE__ */ jsx(SliderThumb, {
|
|
@@ -36,7 +38,9 @@ function RangeSlider(props, ref) {
|
|
|
36
38
|
state,
|
|
37
39
|
inputRef: minThumbInputRef,
|
|
38
40
|
trackRef,
|
|
39
|
-
isDisabled
|
|
41
|
+
isDisabled,
|
|
42
|
+
isInvalid,
|
|
43
|
+
isValid
|
|
40
44
|
}),
|
|
41
45
|
/* @__PURE__ */ jsx(SliderThumb, {
|
|
42
46
|
index: 1,
|
|
@@ -44,7 +48,9 @@ function RangeSlider(props, ref) {
|
|
|
44
48
|
state,
|
|
45
49
|
inputRef: maxThumbInputRef,
|
|
46
50
|
trackRef,
|
|
47
|
-
isDisabled
|
|
51
|
+
isDisabled,
|
|
52
|
+
isInvalid,
|
|
53
|
+
isValid
|
|
48
54
|
})
|
|
49
55
|
] });
|
|
50
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RangeSlider.js","names":["SliderBase"],"sources":["../../../../src/components/fields/Slider/RangeSlider.tsx"],"sourcesContent":["import { forwardRef, useRef } from 'react';\n\nimport { Gradation } from './Gradation';\nimport { SliderBase, SliderBaseChildArguments } from './SliderBase';\nimport { SliderThumb } from './SliderThumb';\nimport { SliderTrack } from './SliderTrack';\n\nimport type { FocusableRef } from '@react-types/shared';\nimport type { RangeValue } from '../../../shared';\nimport type { CubeSliderBaseProps } from './types';\n\nexport interface CubeRangeSliderProps\n extends CubeSliderBaseProps<RangeValue<number>> {\n gradation?: string[];\n}\n\nconst INTL_MESSAGES = {\n minimum: 'Minimum',\n maximum: 'Maximum',\n};\n\nfunction RangeSlider(\n props: CubeRangeSliderProps,\n ref: FocusableRef<HTMLDivElement>,\n) {\n let { isDisabled, styles, gradation, ...otherProps } = props;\n\n // Create separate refs for each thumb to enable proper focus management\n const minThumbInputRef = useRef<HTMLInputElement>(null);\n const maxThumbInputRef = useRef<HTMLInputElement>(null);\n\n return (\n <SliderBase ref={ref} {...(otherProps as CubeSliderBaseProps<number[]>)}>\n {({
|
|
1
|
+
{"version":3,"file":"RangeSlider.js","names":["SliderBase"],"sources":["../../../../src/components/fields/Slider/RangeSlider.tsx"],"sourcesContent":["import { forwardRef, useRef } from 'react';\n\nimport { Gradation } from './Gradation';\nimport { SliderBase, SliderBaseChildArguments } from './SliderBase';\nimport { SliderThumb } from './SliderThumb';\nimport { SliderTrack } from './SliderTrack';\n\nimport type { FocusableRef } from '@react-types/shared';\nimport type { RangeValue } from '../../../shared';\nimport type { CubeSliderBaseProps } from './types';\n\nexport interface CubeRangeSliderProps\n extends CubeSliderBaseProps<RangeValue<number>> {\n gradation?: string[];\n}\n\nconst INTL_MESSAGES = {\n minimum: 'Minimum',\n maximum: 'Maximum',\n};\n\nfunction RangeSlider(\n props: CubeRangeSliderProps,\n ref: FocusableRef<HTMLDivElement>,\n) {\n let { isDisabled, styles, gradation, ...otherProps } = props;\n\n // Create separate refs for each thumb to enable proper focus management\n const minThumbInputRef = useRef<HTMLInputElement>(null);\n const maxThumbInputRef = useRef<HTMLInputElement>(null);\n\n return (\n <SliderBase ref={ref} {...(otherProps as CubeSliderBaseProps<number[]>)}>\n {({\n trackRef,\n inputRef,\n state,\n isInvalid,\n isValid,\n }: SliderBaseChildArguments) => {\n return (\n <>\n <Gradation state={state} ranges={[0, 1]} values={gradation} />\n <SliderTrack\n state={state}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n isValid={isValid}\n orientation={props.orientation}\n />\n <SliderThumb\n index={0}\n aria-label={INTL_MESSAGES['minimum']}\n state={state}\n inputRef={minThumbInputRef}\n trackRef={trackRef}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n isValid={isValid}\n />\n <SliderThumb\n index={1}\n aria-label={INTL_MESSAGES['maximum']}\n state={state}\n inputRef={maxThumbInputRef}\n trackRef={trackRef}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n isValid={isValid}\n />\n </>\n );\n }}\n </SliderBase>\n );\n}\n\nconst _RangeSlider = forwardRef(RangeSlider);\n\nconst __RangeSlider = Object.assign(_RangeSlider as typeof _RangeSlider, {\n cubeInputType: 'Number',\n displayName: 'RangeSlider',\n});\n\nexport { __RangeSlider as RangeSlider };\n"],"mappings":";;;;;;;;;AAgBA,MAAM,gBAAgB;CACpB,SAAS;CACT,SAAS;CACV;AAED,SAAS,YACP,OACA,KACA;CACA,IAAI,EAAE,YAAY,QAAQ,WAAW,GAAG,eAAe;CAGvD,MAAM,mBAAmB,OAAyB,KAAK;CACvD,MAAM,mBAAmB,OAAyB,KAAK;AAEvD,QACE,oBAACA;EAAgB;EAAK,GAAK;aACvB,EACA,UACA,UACA,OACA,WACA,cAC8B;AAC9B,UACE;IACE,oBAAC;KAAiB;KAAO,QAAQ,CAAC,GAAG,EAAE;KAAE,QAAQ;MAAa;IAC9D,oBAAC;KACQ;KACK;KACD;KACF;KACT,aAAa,MAAM;MACnB;IACF,oBAAC;KACC,OAAO;KACP,cAAY,cAAc;KACnB;KACP,UAAU;KACA;KACE;KACD;KACF;MACT;IACF,oBAAC;KACC,OAAO;KACP,cAAY,cAAc;KACnB;KACP,UAAU;KACA;KACE;KACD;KACF;MACT;OACD;;GAGI;;AAIjB,MAAM,eAAe,WAAW,YAAY;AAE5C,MAAM,gBAAgB,OAAO,OAAO,cAAqC;CACvE,eAAe;CACf,aAAa;CACd,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-ec4e0f5 | Cube Dev Team */
|
|
2
2
|
import { extractStyles } from "../../../utils/styles.js";
|
|
3
3
|
import { mergeProps } from "../../../utils/react/mergeProps.js";
|
|
4
4
|
import { Gradation } from "./Gradation.js";
|
|
@@ -30,7 +30,7 @@ function Slider(props, ref) {
|
|
|
30
30
|
ref,
|
|
31
31
|
orientation,
|
|
32
32
|
styles: extractedStyles,
|
|
33
|
-
children: ({ trackRef, inputRef, state }) => {
|
|
33
|
+
children: ({ trackRef, inputRef, state, isInvalid, isValid }) => {
|
|
34
34
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
35
35
|
/* @__PURE__ */ jsx(Gradation, {
|
|
36
36
|
state,
|
|
@@ -40,6 +40,8 @@ function Slider(props, ref) {
|
|
|
40
40
|
/* @__PURE__ */ jsx(SliderTrack, {
|
|
41
41
|
state,
|
|
42
42
|
isDisabled,
|
|
43
|
+
isInvalid,
|
|
44
|
+
isValid,
|
|
43
45
|
orientation,
|
|
44
46
|
styles: trackStyles
|
|
45
47
|
}),
|
|
@@ -49,6 +51,8 @@ function Slider(props, ref) {
|
|
|
49
51
|
inputRef,
|
|
50
52
|
trackRef,
|
|
51
53
|
isDisabled,
|
|
54
|
+
isInvalid,
|
|
55
|
+
isValid,
|
|
52
56
|
styles: thumbStyles,
|
|
53
57
|
tokens: thumbTokens
|
|
54
58
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Slider.js","names":["SliderBase"],"sources":["../../../../src/components/fields/Slider/Slider.tsx"],"sourcesContent":["import { OUTER_STYLES, Styles, Tokens } from '@tenphi/tasty';\nimport { forwardRef } from 'react';\n\nimport { mergeProps } from '../../../utils/react/index';\nimport { extractStyles } from '../../../utils/styles';\n\nimport { Gradation } from './Gradation';\nimport {\n SliderBase,\n SliderBaseChildArguments,\n SliderBaseProps,\n} from './SliderBase';\nimport { SliderThumb } from './SliderThumb';\nimport { SliderTrack } from './SliderTrack';\n\nimport type { FocusableRef } from '@react-types/shared';\nimport type { CubeSliderBaseProps } from './types';\n\nexport interface CubeSliderProps extends CubeSliderBaseProps<number> {\n gradation?: string[];\n /** Custom styles for the track element */\n trackStyles?: Styles;\n /** Custom styles for the thumb element */\n thumbStyles?: Styles;\n /** Custom tokens for the thumb element (e.g., #slider-thumb for fill color) */\n thumbTokens?: Tokens;\n}\n\nfunction Slider(props: CubeSliderProps, ref: FocusableRef<HTMLDivElement>) {\n const {\n onChange,\n onChangeEnd,\n value,\n defaultValue,\n getValueLabel,\n isDisabled,\n styles,\n gradation,\n orientation,\n trackStyles,\n thumbStyles,\n thumbTokens,\n ...otherProps\n } = props;\n\n let baseProps: Omit<SliderBaseProps, 'children'> = {\n ...otherProps,\n // Normalize `value: number[]` to `value: number`\n value: value != null ? [value] : undefined,\n defaultValue: defaultValue != null ? [defaultValue] : undefined,\n onChange: (v: number[]): void => {\n onChange?.(v[0]);\n },\n onChangeEnd: (v: number[]): void => {\n onChangeEnd?.(v[0]);\n },\n getValueLabel: getValueLabel ? ([v]) => getValueLabel(v) : undefined,\n };\n\n const extractedStyles = extractStyles(otherProps, OUTER_STYLES, styles);\n\n return (\n <SliderBase\n {...mergeProps(otherProps, baseProps)}\n ref={ref}\n orientation={orientation}\n styles={extractedStyles}\n >\n {({
|
|
1
|
+
{"version":3,"file":"Slider.js","names":["SliderBase"],"sources":["../../../../src/components/fields/Slider/Slider.tsx"],"sourcesContent":["import { OUTER_STYLES, Styles, Tokens } from '@tenphi/tasty';\nimport { forwardRef } from 'react';\n\nimport { mergeProps } from '../../../utils/react/index';\nimport { extractStyles } from '../../../utils/styles';\n\nimport { Gradation } from './Gradation';\nimport {\n SliderBase,\n SliderBaseChildArguments,\n SliderBaseProps,\n} from './SliderBase';\nimport { SliderThumb } from './SliderThumb';\nimport { SliderTrack } from './SliderTrack';\n\nimport type { FocusableRef } from '@react-types/shared';\nimport type { CubeSliderBaseProps } from './types';\n\nexport interface CubeSliderProps extends CubeSliderBaseProps<number> {\n gradation?: string[];\n /** Custom styles for the track element */\n trackStyles?: Styles;\n /** Custom styles for the thumb element */\n thumbStyles?: Styles;\n /** Custom tokens for the thumb element (e.g., #slider-thumb for fill color) */\n thumbTokens?: Tokens;\n}\n\nfunction Slider(props: CubeSliderProps, ref: FocusableRef<HTMLDivElement>) {\n const {\n onChange,\n onChangeEnd,\n value,\n defaultValue,\n getValueLabel,\n isDisabled,\n styles,\n gradation,\n orientation,\n trackStyles,\n thumbStyles,\n thumbTokens,\n ...otherProps\n } = props;\n\n let baseProps: Omit<SliderBaseProps, 'children'> = {\n ...otherProps,\n // Normalize `value: number[]` to `value: number`\n value: value != null ? [value] : undefined,\n defaultValue: defaultValue != null ? [defaultValue] : undefined,\n onChange: (v: number[]): void => {\n onChange?.(v[0]);\n },\n onChangeEnd: (v: number[]): void => {\n onChangeEnd?.(v[0]);\n },\n getValueLabel: getValueLabel ? ([v]) => getValueLabel(v) : undefined,\n };\n\n const extractedStyles = extractStyles(otherProps, OUTER_STYLES, styles);\n\n return (\n <SliderBase\n {...mergeProps(otherProps, baseProps)}\n ref={ref}\n orientation={orientation}\n styles={extractedStyles}\n >\n {({\n trackRef,\n inputRef,\n state,\n isInvalid,\n isValid,\n }: SliderBaseChildArguments) => {\n return (\n <>\n <Gradation state={state} ranges={[0, 1]} values={gradation} />\n <SliderTrack\n state={state}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n isValid={isValid}\n orientation={orientation}\n styles={trackStyles}\n />\n <SliderThumb\n index={0}\n state={state}\n inputRef={inputRef}\n trackRef={trackRef}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n isValid={isValid}\n styles={thumbStyles}\n tokens={thumbTokens}\n />\n </>\n );\n }}\n </SliderBase>\n );\n}\n\nconst _Slider = forwardRef(Slider);\n\nconst __Slider = Object.assign(_Slider as typeof _Slider, {\n cubeInputType: 'Number',\n displayName: 'Slider',\n});\n\nexport { __Slider as Slider };\n"],"mappings":";;;;;;;;;;;;AA4BA,SAAS,OAAO,OAAwB,KAAmC;CACzE,MAAM,EACJ,UACA,aACA,OACA,cACA,eACA,YACA,QACA,WACA,aACA,aACA,aACA,aACA,GAAG,eACD;CAEJ,IAAI,YAA+C;EACjD,GAAG;EAEH,OAAO,SAAS,OAAO,CAAC,MAAM,GAAG;EACjC,cAAc,gBAAgB,OAAO,CAAC,aAAa,GAAG;EACtD,WAAW,MAAsB;AAC/B,cAAW,EAAE,GAAG;;EAElB,cAAc,MAAsB;AAClC,iBAAc,EAAE,GAAG;;EAErB,eAAe,iBAAiB,CAAC,OAAO,cAAc,EAAE,GAAG;EAC5D;CAED,MAAM,kBAAkB,cAAc,YAAY,cAAc,OAAO;AAEvE,QACE,oBAACA;EACC,GAAI,WAAW,YAAY,UAAU;EAChC;EACQ;EACb,QAAQ;aAEN,EACA,UACA,UACA,OACA,WACA,cAC8B;AAC9B,UACE;IACE,oBAAC;KAAiB;KAAO,QAAQ,CAAC,GAAG,EAAE;KAAE,QAAQ;MAAa;IAC9D,oBAAC;KACQ;KACK;KACD;KACF;KACI;KACb,QAAQ;MACR;IACF,oBAAC;KACC,OAAO;KACA;KACG;KACA;KACE;KACD;KACF;KACT,QAAQ;KACR,QAAQ;MACR;OACD;;GAGI;;AAIjB,MAAM,UAAU,WAAW,OAAO;AAElC,MAAM,WAAW,OAAO,OAAO,SAA2B;CACxD,eAAe;CACf,aAAa;CACd,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-ec4e0f5 | Cube Dev Team */
|
|
2
2
|
import { extractStyles } from "../../../utils/styles.js";
|
|
3
3
|
import { forwardRefWithGenerics } from "../../../utils/react/forwardRefWithGenerics.js";
|
|
4
4
|
import { mergeProps as mergeProps$1 } from "../../../utils/react/mergeProps.js";
|
|
5
5
|
import { _Text } from "../../content/Text.js";
|
|
6
|
+
import { getValidationMods } from "../../form/validation/resolve-validation-props.js";
|
|
6
7
|
import { useFieldProps } from "../../form/Form/use-field/use-field-props.js";
|
|
7
8
|
import { wrapWithField } from "../../form/wrapper.js";
|
|
8
9
|
import { SliderControlsElement, SliderElement } from "./elements.js";
|
|
@@ -26,7 +27,7 @@ function SliderBase(allProps, ref) {
|
|
|
26
27
|
onChange
|
|
27
28
|
})
|
|
28
29
|
});
|
|
29
|
-
let { labelPosition, label, extra, styles, isRequired, message, description, requiredMark, labelSuffix, labelStyles, necessityIndicator, gradation, isDisabled, inputStyles, minValue = 0, maxValue = 100, inputWidth, formatOptions, getValueLabel, onChange, onChangeEnd, children, showValueLabel = true, orientation: formOrientation, form, labelProps: userLabelProps, ...otherProps } = props;
|
|
30
|
+
let { labelPosition, label, extra, styles, isRequired, message, description, requiredMark, labelSuffix, labelStyles, necessityIndicator, gradation, isDisabled, isInvalid, isValid, inputStyles, minValue = 0, maxValue = 100, inputWidth, formatOptions, getValueLabel, onChange, onChangeEnd, children, showValueLabel = true, orientation: formOrientation, form, labelProps: userLabelProps, ...otherProps } = props;
|
|
30
31
|
let orientation = allProps.orientation || "horizontal";
|
|
31
32
|
if (Math.abs(Math.sign(minValue) - Math.sign(maxValue)) === 2) if (formatOptions != null) {
|
|
32
33
|
if (!("signDisplay" in formatOptions)) formatOptions = {
|
|
@@ -82,8 +83,17 @@ function SliderBase(allProps, ref) {
|
|
|
82
83
|
});
|
|
83
84
|
const mods = useMemo(() => ({
|
|
84
85
|
"side-label": labelPosition === "side",
|
|
85
|
-
horizontal: orientation === "horizontal"
|
|
86
|
-
|
|
86
|
+
horizontal: orientation === "horizontal",
|
|
87
|
+
...getValidationMods({
|
|
88
|
+
isInvalid,
|
|
89
|
+
isValid
|
|
90
|
+
})
|
|
91
|
+
}), [
|
|
92
|
+
labelPosition,
|
|
93
|
+
orientation,
|
|
94
|
+
isInvalid,
|
|
95
|
+
isValid
|
|
96
|
+
]);
|
|
87
97
|
styles = extractStyles(otherProps, OUTER_STYLES, styles);
|
|
88
98
|
return wrapWithField(/* @__PURE__ */ jsx(SliderElement, {
|
|
89
99
|
ref: domRef,
|
|
@@ -99,7 +109,9 @@ function SliderBase(allProps, ref) {
|
|
|
99
109
|
children: children({
|
|
100
110
|
trackRef,
|
|
101
111
|
inputRef,
|
|
102
|
-
state
|
|
112
|
+
state,
|
|
113
|
+
isInvalid,
|
|
114
|
+
isValid
|
|
103
115
|
})
|
|
104
116
|
})
|
|
105
117
|
}), ref, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SliderBase.js","names":["Text","mergeProps"],"sources":["../../../../src/components/fields/Slider/SliderBase.tsx"],"sourcesContent":["import { useFocusableRef } from '@react-spectrum/utils';\nimport { DOMRef, FocusableRef } from '@react-types/shared';\nimport { OUTER_STYLES, tasty } from '@tenphi/tasty';\nimport {\n ForwardedRef,\n forwardRef,\n ReactNode,\n RefObject,\n useMemo,\n useRef,\n} from 'react';\nimport { useNumberFormatter, useSlider } from 'react-aria';\nimport { useSliderState } from 'react-stately';\n\nimport { forwardRefWithGenerics, mergeProps } from '../../../utils/react';\nimport { extractStyles } from '../../../utils/styles';\nimport { Text } from '../../content/Text';\nimport { useFieldProps, wrapWithField } from '../../form';\n\nimport { SliderControlsElement, SliderElement } from './elements';\n\nimport type { SliderState } from 'react-stately';\nimport type { CubeSliderBaseProps } from './types';\n\nexport interface SliderBaseChildArguments {\n inputRef: RefObject<HTMLInputElement | null>;\n trackRef: RefObject<HTMLElement | null>;\n state: SliderState;\n}\n\nexport interface SliderBaseProps<T = number[]> extends CubeSliderBaseProps<T> {\n children: (opts: SliderBaseChildArguments) => ReactNode;\n}\n\nconst LabelValueElement = tasty(Text, {\n styles: {\n display: 'block',\n textAlign: 'right',\n },\n});\n\nfunction SliderBase(allProps: SliderBaseProps, ref: DOMRef<HTMLDivElement>) {\n let props = useFieldProps(allProps, {\n defaultValidationTrigger: 'onChange',\n valuePropsMapper: ({ value, onChange }) => ({\n value: value != null ? value : undefined,\n onChange: onChange,\n }),\n });\n\n let {\n labelPosition,\n label,\n extra,\n styles,\n isRequired,\n message,\n description,\n requiredMark,\n labelSuffix,\n labelStyles,\n necessityIndicator,\n gradation,\n isDisabled,\n inputStyles,\n minValue = 0,\n maxValue = 100,\n inputWidth,\n formatOptions,\n getValueLabel,\n onChange,\n onChangeEnd,\n children,\n showValueLabel = true,\n orientation: formOrientation,\n form,\n labelProps: userLabelProps,\n ...otherProps\n } = props;\n\n let orientation = allProps.orientation || 'horizontal';\n\n // `Math.abs(Math.sign(a) - Math.sign(b)) === 2` is true if the values have a different sign.\n let alwaysDisplaySign =\n Math.abs(Math.sign(minValue) - Math.sign(maxValue)) === 2;\n if (alwaysDisplaySign) {\n if (formatOptions != null) {\n if (!('signDisplay' in formatOptions)) {\n formatOptions = {\n ...formatOptions,\n signDisplay: 'exceptZero',\n };\n }\n } else {\n formatOptions = { signDisplay: 'exceptZero' };\n }\n }\n\n const formatter = useNumberFormatter(formatOptions);\n\n const state = useSliderState({\n ...props,\n orientation,\n numberFormatter: formatter,\n minValue,\n maxValue,\n });\n\n const trackRef = useRef<HTMLElement>(null);\n\n let { groupProps, trackProps, labelProps, outputProps } = useSlider(\n props,\n state,\n trackRef,\n );\n\n const inputRef = useRef<HTMLInputElement>(null);\n\n let domRef = useFocusableRef(ref as any, inputRef);\n\n let displayValue = '';\n let maxLabelLength = 0;\n\n if (typeof getValueLabel === 'function') {\n displayValue = getValueLabel(state.values);\n switch (state.values.length) {\n case 1:\n maxLabelLength = Math.max(\n getValueLabel([minValue]).length,\n getValueLabel([maxValue]).length,\n );\n break;\n case 2:\n // Try all possible combinations of min and max values.\n maxLabelLength = Math.max(\n getValueLabel([minValue, minValue]).length,\n getValueLabel([minValue, maxValue]).length,\n getValueLabel([maxValue, minValue]).length,\n getValueLabel([maxValue, maxValue]).length,\n );\n break;\n default:\n throw new Error('Only sliders with 1 or 2 handles are supported!');\n }\n } else {\n maxLabelLength = Math.max(\n [...formatter.format(minValue)].length,\n [...formatter.format(maxValue)].length,\n );\n switch (state.values.length) {\n case 1:\n displayValue = state.getThumbValueLabel(0);\n break;\n case 2:\n // This should really use the NumberFormat#formatRange proposal...\n // https://github.com/tc39/ecma402/issues/393\n // https://github.com/tc39/proposal-intl-numberformat-v3#formatrange-ecma-402-393\n displayValue = `${state.getThumbValueLabel(\n 0,\n )} – ${state.getThumbValueLabel(1)}`;\n maxLabelLength =\n 3 +\n 2 *\n Math.max(\n maxLabelLength,\n [...formatter.format(minValue)].length,\n [...formatter.format(maxValue)].length,\n );\n break;\n default:\n throw new Error('Only sliders with 1 or 2 handles are supported!');\n }\n }\n\n extra =\n extra != null || !showValueLabel ? (\n extra\n ) : (\n <LabelValueElement\n {...outputProps}\n style={\n maxLabelLength\n ? {\n width: `${maxLabelLength + 1}ch`,\n minWidth: `${maxLabelLength + 1}ch`,\n }\n : undefined\n }\n >\n {displayValue}\n </LabelValueElement>\n );\n\n const mods = useMemo(\n () => ({\n 'side-label': labelPosition === 'side',\n horizontal: orientation === 'horizontal',\n }),\n [labelPosition, orientation],\n );\n\n styles = extractStyles(otherProps, OUTER_STYLES, styles);\n\n const sliderField = (\n <SliderElement\n ref={domRef}\n id={props.id}\n {...groupProps}\n mods={mods}\n styles={styles}\n data-input-type=\"slider\"\n >\n <SliderControlsElement {...trackProps} ref={trackRef} mods={mods}>\n {children({\n trackRef,\n inputRef,\n state,\n })}\n </SliderControlsElement>\n </SliderElement>\n );\n\n return wrapWithField(sliderField, ref, {\n ...props,\n extra,\n labelProps: mergeProps(labelProps, userLabelProps),\n });\n}\n\nconst _SliderBase = forwardRefWithGenerics(SliderBase);\n\n(_SliderBase as any).displayName = 'SliderBase';\n\nexport { _SliderBase as SliderBase };\nexport { useSlider };\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"SliderBase.js","names":["Text","mergeProps"],"sources":["../../../../src/components/fields/Slider/SliderBase.tsx"],"sourcesContent":["import { useFocusableRef } from '@react-spectrum/utils';\nimport { DOMRef, FocusableRef } from '@react-types/shared';\nimport { OUTER_STYLES, tasty } from '@tenphi/tasty';\nimport {\n ForwardedRef,\n forwardRef,\n ReactNode,\n RefObject,\n useMemo,\n useRef,\n} from 'react';\nimport { useNumberFormatter, useSlider } from 'react-aria';\nimport { useSliderState } from 'react-stately';\n\nimport { forwardRefWithGenerics, mergeProps } from '../../../utils/react';\nimport { extractStyles } from '../../../utils/styles';\nimport { Text } from '../../content/Text';\nimport { getValidationMods, useFieldProps, wrapWithField } from '../../form';\n\nimport { SliderControlsElement, SliderElement } from './elements';\n\nimport type { SliderState } from 'react-stately';\nimport type { CubeSliderBaseProps } from './types';\n\nexport interface SliderBaseChildArguments {\n inputRef: RefObject<HTMLInputElement | null>;\n trackRef: RefObject<HTMLElement | null>;\n state: SliderState;\n /** Resolved validation state. It is only known here, after `useFieldProps` merged the form state in. */\n isInvalid?: boolean;\n isValid?: boolean;\n}\n\nexport interface SliderBaseProps<T = number[]> extends CubeSliderBaseProps<T> {\n children: (opts: SliderBaseChildArguments) => ReactNode;\n}\n\nconst LabelValueElement = tasty(Text, {\n styles: {\n display: 'block',\n textAlign: 'right',\n },\n});\n\nfunction SliderBase(allProps: SliderBaseProps, ref: DOMRef<HTMLDivElement>) {\n let props = useFieldProps(allProps, {\n defaultValidationTrigger: 'onChange',\n valuePropsMapper: ({ value, onChange }) => ({\n value: value != null ? value : undefined,\n onChange: onChange,\n }),\n });\n\n let {\n labelPosition,\n label,\n extra,\n styles,\n isRequired,\n message,\n description,\n requiredMark,\n labelSuffix,\n labelStyles,\n necessityIndicator,\n gradation,\n isDisabled,\n isInvalid,\n isValid,\n inputStyles,\n minValue = 0,\n maxValue = 100,\n inputWidth,\n formatOptions,\n getValueLabel,\n onChange,\n onChangeEnd,\n children,\n showValueLabel = true,\n orientation: formOrientation,\n form,\n labelProps: userLabelProps,\n ...otherProps\n } = props;\n\n let orientation = allProps.orientation || 'horizontal';\n\n // `Math.abs(Math.sign(a) - Math.sign(b)) === 2` is true if the values have a different sign.\n let alwaysDisplaySign =\n Math.abs(Math.sign(minValue) - Math.sign(maxValue)) === 2;\n if (alwaysDisplaySign) {\n if (formatOptions != null) {\n if (!('signDisplay' in formatOptions)) {\n formatOptions = {\n ...formatOptions,\n signDisplay: 'exceptZero',\n };\n }\n } else {\n formatOptions = { signDisplay: 'exceptZero' };\n }\n }\n\n const formatter = useNumberFormatter(formatOptions);\n\n const state = useSliderState({\n ...props,\n orientation,\n numberFormatter: formatter,\n minValue,\n maxValue,\n });\n\n const trackRef = useRef<HTMLElement>(null);\n\n let { groupProps, trackProps, labelProps, outputProps } = useSlider(\n props,\n state,\n trackRef,\n );\n\n const inputRef = useRef<HTMLInputElement>(null);\n\n let domRef = useFocusableRef(ref as any, inputRef);\n\n let displayValue = '';\n let maxLabelLength = 0;\n\n if (typeof getValueLabel === 'function') {\n displayValue = getValueLabel(state.values);\n switch (state.values.length) {\n case 1:\n maxLabelLength = Math.max(\n getValueLabel([minValue]).length,\n getValueLabel([maxValue]).length,\n );\n break;\n case 2:\n // Try all possible combinations of min and max values.\n maxLabelLength = Math.max(\n getValueLabel([minValue, minValue]).length,\n getValueLabel([minValue, maxValue]).length,\n getValueLabel([maxValue, minValue]).length,\n getValueLabel([maxValue, maxValue]).length,\n );\n break;\n default:\n throw new Error('Only sliders with 1 or 2 handles are supported!');\n }\n } else {\n maxLabelLength = Math.max(\n [...formatter.format(minValue)].length,\n [...formatter.format(maxValue)].length,\n );\n switch (state.values.length) {\n case 1:\n displayValue = state.getThumbValueLabel(0);\n break;\n case 2:\n // This should really use the NumberFormat#formatRange proposal...\n // https://github.com/tc39/ecma402/issues/393\n // https://github.com/tc39/proposal-intl-numberformat-v3#formatrange-ecma-402-393\n displayValue = `${state.getThumbValueLabel(\n 0,\n )} – ${state.getThumbValueLabel(1)}`;\n maxLabelLength =\n 3 +\n 2 *\n Math.max(\n maxLabelLength,\n [...formatter.format(minValue)].length,\n [...formatter.format(maxValue)].length,\n );\n break;\n default:\n throw new Error('Only sliders with 1 or 2 handles are supported!');\n }\n }\n\n extra =\n extra != null || !showValueLabel ? (\n extra\n ) : (\n <LabelValueElement\n {...outputProps}\n style={\n maxLabelLength\n ? {\n width: `${maxLabelLength + 1}ch`,\n minWidth: `${maxLabelLength + 1}ch`,\n }\n : undefined\n }\n >\n {displayValue}\n </LabelValueElement>\n );\n\n const mods = useMemo(\n () => ({\n 'side-label': labelPosition === 'side',\n horizontal: orientation === 'horizontal',\n ...getValidationMods({ isInvalid, isValid }),\n }),\n [labelPosition, orientation, isInvalid, isValid],\n );\n\n styles = extractStyles(otherProps, OUTER_STYLES, styles);\n\n const sliderField = (\n <SliderElement\n ref={domRef}\n id={props.id}\n {...groupProps}\n mods={mods}\n styles={styles}\n data-input-type=\"slider\"\n >\n <SliderControlsElement {...trackProps} ref={trackRef} mods={mods}>\n {children({\n trackRef,\n inputRef,\n state,\n isInvalid,\n isValid,\n })}\n </SliderControlsElement>\n </SliderElement>\n );\n\n return wrapWithField(sliderField, ref, {\n ...props,\n extra,\n labelProps: mergeProps(labelProps, userLabelProps),\n });\n}\n\nconst _SliderBase = forwardRefWithGenerics(SliderBase);\n\n(_SliderBase as any).displayName = 'SliderBase';\n\nexport { _SliderBase as SliderBase };\nexport { useSlider };\n"],"mappings":";;;;;;;;;;;;;;;;;AAqCA,MAAM,oBAAoB,MAAMA,OAAM,EACpC,QAAQ;CACN,SAAS;CACT,WAAW;CACZ,EACF,CAAC;AAEF,SAAS,WAAW,UAA2B,KAA6B;CAC1E,IAAI,QAAQ,cAAc,UAAU;EAClC,0BAA0B;EAC1B,mBAAmB,EAAE,OAAO,gBAAgB;GAC1C,OAAO,SAAS,OAAO,QAAQ;GACrB;GACX;EACF,CAAC;CAEF,IAAI,EACF,eACA,OACA,OACA,QACA,YACA,SACA,aACA,cACA,aACA,aACA,oBACA,WACA,YACA,WACA,SACA,aACA,WAAW,GACX,WAAW,KACX,YACA,eACA,eACA,UACA,aACA,UACA,iBAAiB,MACjB,aAAa,iBACb,MACA,YAAY,gBACZ,GAAG,eACD;CAEJ,IAAI,cAAc,SAAS,eAAe;AAK1C,KADE,KAAK,IAAI,KAAK,KAAK,SAAS,GAAG,KAAK,KAAK,SAAS,CAAC,KAAK,EAExD,KAAI,iBAAiB,MACnB;MAAI,EAAE,iBAAiB,eACrB,iBAAgB;GACd,GAAG;GACH,aAAa;GACd;OAGH,iBAAgB,EAAE,aAAa,cAAc;CAIjD,MAAM,YAAY,mBAAmB,cAAc;CAEnD,MAAM,QAAQ,eAAe;EAC3B,GAAG;EACH;EACA,iBAAiB;EACjB;EACA;EACD,CAAC;CAEF,MAAM,WAAW,OAAoB,KAAK;CAE1C,IAAI,EAAE,YAAY,YAAY,Y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ACiB;CAGxB,MAAM,OAAO,eACJ;EACL,cAAc,kBAAkB;EAChC,YAAY,gBAAgB;EAC5B,GAAG,kBAAkB;GAAE;GAAW;GAAS,CAAC;EAC7C,GACD;EAAC;EAAe;EAAa;EAAW;EAAQ,CACjD;AAED,UAAS,cAAc,YAAY,cAAc,OAAO;AAuBxD,QAAO,cApBL,oBAAC;EACC,KAAK;EACL,IAAI,MAAM;EACV,GAAI;EACE;EACE;EACR,mBAAgB;YAEhB,oBAAC;GAAsB,GAAI;GAAY,KAAK;GAAgB;aACzD,SAAS;IACR;IACA;IACA;IACA;IACA;IACD,CAAC;IACoB;GACV,EAGgB,KAAK;EACrC,GAAG;EACH;EACA,YAAYC,aAAW,YAAY,eAAe;EACnD,CAAC;;AAGJ,MAAM,cAAc,uBAAuB,WAAW;AAEtD,AAAC,YAAoB,cAAc"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-ec4e0f5 | Cube Dev Team */
|
|
2
2
|
import { mergeProps as mergeProps$1 } from "../../../utils/react/mergeProps.js";
|
|
3
|
+
import { getValidationMods } from "../../form/validation/resolve-validation-props.js";
|
|
3
4
|
import { SliderThumbElement } from "./elements.js";
|
|
4
5
|
import { useMemo, useRef } from "react";
|
|
5
6
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -7,7 +8,7 @@ import { VisuallyHidden, useHover, useSliderThumb } from "react-aria";
|
|
|
7
8
|
|
|
8
9
|
//#region src/components/fields/Slider/SliderThumb.tsx
|
|
9
10
|
function SliderThumb(props) {
|
|
10
|
-
let { state, index, inputRef, isDisabled, styles, tokens } = props;
|
|
11
|
+
let { state, index, inputRef, isDisabled, isInvalid, isValid, styles, tokens } = props;
|
|
11
12
|
const backupRef = useRef(null);
|
|
12
13
|
inputRef = inputRef || backupRef;
|
|
13
14
|
const { thumbProps, inputProps, isDragging, isFocused } = useSliderThumb({
|
|
@@ -25,7 +26,11 @@ function SliderThumb(props) {
|
|
|
25
26
|
focused: !isDragging && isFocused,
|
|
26
27
|
disabled: isDisabled,
|
|
27
28
|
collapsed: isCollapsed,
|
|
28
|
-
stuck: isStuck
|
|
29
|
+
stuck: isStuck,
|
|
30
|
+
...getValidationMods({
|
|
31
|
+
isInvalid,
|
|
32
|
+
isValid
|
|
33
|
+
})
|
|
29
34
|
};
|
|
30
35
|
}, [
|
|
31
36
|
isHovered,
|
|
@@ -33,7 +38,9 @@ function SliderThumb(props) {
|
|
|
33
38
|
isStuck,
|
|
34
39
|
isDragging,
|
|
35
40
|
isFocused,
|
|
36
|
-
isDisabled
|
|
41
|
+
isDisabled,
|
|
42
|
+
isInvalid,
|
|
43
|
+
isValid
|
|
37
44
|
]),
|
|
38
45
|
styles,
|
|
39
46
|
tokens,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SliderThumb.js","names":["mergeProps"],"sources":["../../../../src/components/fields/Slider/SliderThumb.tsx"],"sourcesContent":["import { Styles, Tokens } from '@tenphi/tasty';\nimport { RefObject, useMemo, useRef } from 'react';\nimport {\n AriaSliderThumbOptions,\n useHover,\n useSliderThumb,\n VisuallyHidden,\n} from 'react-aria';\n\nimport { mergeProps } from '../../../utils/react';\n\nimport { SliderThumbElement } from './elements';\n\nimport type { SliderState } from 'react-stately';\n\nexport interface SliderThumbProps extends AriaSliderThumbOptions {\n state: SliderState;\n isDisabled?: boolean;\n trackRef: RefObject<HTMLElement | null>;\n inputRef: RefObject<HTMLInputElement | null>;\n index: number;\n styles?: Styles;\n tokens?: Tokens;\n}\n\nexport function SliderThumb(props: SliderThumbProps) {\n let {
|
|
1
|
+
{"version":3,"file":"SliderThumb.js","names":["mergeProps"],"sources":["../../../../src/components/fields/Slider/SliderThumb.tsx"],"sourcesContent":["import { Styles, Tokens } from '@tenphi/tasty';\nimport { RefObject, useMemo, useRef } from 'react';\nimport {\n AriaSliderThumbOptions,\n useHover,\n useSliderThumb,\n VisuallyHidden,\n} from 'react-aria';\n\nimport { mergeProps } from '../../../utils/react';\nimport { getValidationMods } from '../../form';\n\nimport { SliderThumbElement } from './elements';\n\nimport type { SliderState } from 'react-stately';\n\nexport interface SliderThumbProps extends AriaSliderThumbOptions {\n state: SliderState;\n isDisabled?: boolean;\n isInvalid?: boolean;\n isValid?: boolean;\n trackRef: RefObject<HTMLElement | null>;\n inputRef: RefObject<HTMLInputElement | null>;\n index: number;\n styles?: Styles;\n tokens?: Tokens;\n}\n\nexport function SliderThumb(props: SliderThumbProps) {\n let {\n state,\n index,\n inputRef,\n isDisabled,\n isInvalid,\n isValid,\n styles,\n tokens,\n } = props;\n\n const backupRef = useRef<HTMLInputElement>(null);\n\n inputRef = inputRef || backupRef;\n\n const { thumbProps, inputProps, isDragging, isFocused } = useSliderThumb(\n {\n ...props,\n inputRef,\n },\n state,\n );\n\n const { hoverProps, isHovered } = useHover({ isDisabled });\n\n const isCollapsed = state.values[0] === state.values[1];\n const isStuck =\n state.values[index] === state.getThumbMaxValue(index) &&\n state.values[index] === state.getThumbMinValue(index);\n\n const mods = useMemo(() => {\n return {\n hovered: isHovered,\n dragged: isDragging,\n focused: !isDragging && isFocused,\n disabled: isDisabled,\n collapsed: isCollapsed,\n stuck: isStuck,\n ...getValidationMods({ isInvalid, isValid }),\n };\n }, [\n isHovered,\n isCollapsed,\n isStuck,\n isDragging,\n isFocused,\n isDisabled,\n isInvalid,\n isValid,\n ]);\n\n return (\n <SliderThumbElement\n mods={mods}\n styles={styles}\n tokens={tokens}\n {...mergeProps(thumbProps, hoverProps)}\n role=\"presentation\"\n >\n <VisuallyHidden>\n <input ref={inputRef} {...inputProps} />\n </VisuallyHidden>\n </SliderThumbElement>\n );\n}\n"],"mappings":";;;;;;;;;AA4BA,SAAgB,YAAY,OAAyB;CACnD,IAAI,EACF,OACA,OACA,UACA,YACA,WACA,SACA,QACA,WACE;CAEJ,MAAM,YAAY,OAAyB,KAAK;AAEhD,YAAW,YAAY;CAEvB,MAAM,EAAE,YAAY,YAAY,YAAY,cAAc,eACxD;EACE,GAAG;EACH;EACD,EACD,MACD;CAED,MAAM,EAAE,YAAY,cAAc,SAAS,EAAE,YAAY,CAAC;CAE1D,MAAM,cAAc,MAAM,OAAO,OAAO,MAAM,OAAO;CACrD,MAAM,UACJ,MAAM,OAAO,WAAW,MAAM,iBAAiB,MAAM,IACrD,MAAM,OAAO,WAAW,MAAM,iBAAiB,MAAM;AAuBvD,QACE,oBAAC;EACC,MAvBS,cAAc;AACzB,UAAO;IACL,SAAS;IACT,SAAS;IACT,SAAS,CAAC,cAAc;IACxB,UAAU;IACV,WAAW;IACX,OAAO;IACP,GAAG,kBAAkB;KAAE;KAAW;KAAS,CAAC;IAC7C;KACA;GACD;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD,CAAC;EAKU;EACA;EACR,GAAIA,aAAW,YAAY,WAAW;EACtC,MAAK;YAEL,oBAAC,4BACC,oBAAC;GAAM,KAAK;GAAU,GAAI;IAAc,GACzB;GACE"}
|
|
@@ -1,19 +1,30 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-ec4e0f5 | Cube Dev Team */
|
|
2
|
+
import { getValidationMods } from "../../form/validation/resolve-validation-props.js";
|
|
2
3
|
import { SliderTrackContainerElement } from "./elements.js";
|
|
3
4
|
import { useMemo } from "react";
|
|
4
5
|
import { jsx } from "react/jsx-runtime";
|
|
5
6
|
|
|
6
7
|
//#region src/components/fields/Slider/SliderTrack.tsx
|
|
7
8
|
function SliderTrack(props) {
|
|
8
|
-
const { isDisabled, state, orientation = "horizontal", styles } = props;
|
|
9
|
+
const { isDisabled, isInvalid, isValid, state, orientation = "horizontal", styles } = props;
|
|
9
10
|
const selectedTrack = [state.getThumbPercent(0), state.getThumbPercent(1)];
|
|
10
11
|
const showRangeTrack = !Number.isNaN(selectedTrack[1]);
|
|
11
12
|
return /* @__PURE__ */ jsx(SliderTrackContainerElement, {
|
|
12
13
|
mods: useMemo(() => ({
|
|
13
14
|
disabled: isDisabled,
|
|
14
15
|
horizontal: orientation === "horizontal",
|
|
15
|
-
range: showRangeTrack
|
|
16
|
-
|
|
16
|
+
range: showRangeTrack,
|
|
17
|
+
...getValidationMods({
|
|
18
|
+
isInvalid,
|
|
19
|
+
isValid
|
|
20
|
+
})
|
|
21
|
+
}), [
|
|
22
|
+
isDisabled,
|
|
23
|
+
showRangeTrack,
|
|
24
|
+
orientation,
|
|
25
|
+
isInvalid,
|
|
26
|
+
isValid
|
|
27
|
+
]),
|
|
17
28
|
styles,
|
|
18
29
|
style: showRangeTrack ? {
|
|
19
30
|
"--slider-range-start": `${selectedTrack[0] * 100}%`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SliderTrack.js","names":[],"sources":["../../../../src/components/fields/Slider/SliderTrack.tsx"],"sourcesContent":["import { Styles } from '@tenphi/tasty';\nimport { useMemo } from 'react';\n\nimport { SliderTrackContainerElement } from './elements';\n\nimport type { SliderState } from 'react-stately';\n\nexport type SliderTrackProps = {\n state: SliderState;\n orientation?: 'horizontal' | 'vertical';\n isDisabled?: boolean;\n styles?: Styles;\n};\n\nexport function SliderTrack(props: SliderTrackProps) {\n const {
|
|
1
|
+
{"version":3,"file":"SliderTrack.js","names":[],"sources":["../../../../src/components/fields/Slider/SliderTrack.tsx"],"sourcesContent":["import { Styles } from '@tenphi/tasty';\nimport { useMemo } from 'react';\n\nimport { getValidationMods } from '../../form';\n\nimport { SliderTrackContainerElement } from './elements';\n\nimport type { SliderState } from 'react-stately';\n\nexport type SliderTrackProps = {\n state: SliderState;\n orientation?: 'horizontal' | 'vertical';\n isDisabled?: boolean;\n isInvalid?: boolean;\n isValid?: boolean;\n styles?: Styles;\n};\n\nexport function SliderTrack(props: SliderTrackProps) {\n const {\n isDisabled,\n isInvalid,\n isValid,\n state,\n orientation = 'horizontal',\n styles,\n } = props;\n const selectedTrack = [state.getThumbPercent(0), state.getThumbPercent(1)];\n\n const showRangeTrack = !Number.isNaN(selectedTrack[1]);\n\n const mods = useMemo(\n () => ({\n disabled: isDisabled,\n horizontal: orientation === 'horizontal',\n range: showRangeTrack,\n ...getValidationMods({ isInvalid, isValid }),\n }),\n [isDisabled, showRangeTrack, orientation, isInvalid, isValid],\n );\n\n return (\n <SliderTrackContainerElement\n mods={mods}\n styles={styles}\n style={\n showRangeTrack\n ? {\n '--slider-range-start': `${selectedTrack[0] * 100}%`,\n '--slider-range-end': `${selectedTrack[1] * 100}%`,\n }\n : {\n '--slider-value': `${selectedTrack[0] * 100}%`,\n }\n }\n />\n );\n}\n"],"mappings":";;;;;;;AAkBA,SAAgB,YAAY,OAAyB;CACnD,MAAM,EACJ,YACA,WACA,SACA,OACA,cAAc,cACd,WACE;CACJ,MAAM,gBAAgB,CAAC,MAAM,gBAAgB,EAAE,EAAE,MAAM,gBAAgB,EAAE,CAAC;CAE1E,MAAM,iBAAiB,CAAC,OAAO,MAAM,cAAc,GAAG;AAYtD,QACE,oBAAC;EACC,MAZS,eACJ;GACL,UAAU;GACV,YAAY,gBAAgB;GAC5B,OAAO;GACP,GAAG,kBAAkB;IAAE;IAAW;IAAS,CAAC;GAC7C,GACD;GAAC;GAAY;GAAgB;GAAa;GAAW;GAAQ,CAC9D;EAKW;EACR,OACE,iBACI;GACE,wBAAwB,GAAG,cAAc,KAAK,IAAI;GAClD,sBAAsB,GAAG,cAAc,KAAK,IAAI;GACjD,GACD,EACE,kBAAkB,GAAG,cAAc,KAAK,IAAI,IAC7C;GAEP"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-ec4e0f5 | Cube Dev Team */
|
|
2
2
|
import { tasty } from "@tenphi/tasty";
|
|
3
3
|
|
|
4
4
|
//#region src/components/fields/Slider/elements.ts
|
|
@@ -13,6 +13,8 @@ const SliderThumbElement = tasty({
|
|
|
13
13
|
"": "(#slider-thumb, #primary)",
|
|
14
14
|
hovered: "(#slider-thumb-hovered, #primary-text)",
|
|
15
15
|
dragged: "(#slider-thumb, #primary)",
|
|
16
|
+
valid: "#success",
|
|
17
|
+
invalid: "#danger",
|
|
16
18
|
disabled: "#disabled-surface-text"
|
|
17
19
|
},
|
|
18
20
|
cursor: "$pointer",
|
|
@@ -64,6 +66,8 @@ const SliderTrackContainerElement = tasty({
|
|
|
64
66
|
},
|
|
65
67
|
fill: {
|
|
66
68
|
"": "#primary",
|
|
69
|
+
valid: "#success",
|
|
70
|
+
invalid: "#danger",
|
|
67
71
|
disabled: "#disabled-surface-text"
|
|
68
72
|
},
|
|
69
73
|
width: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elements.js","names":[],"sources":["../../../../src/components/fields/Slider/elements.ts"],"sourcesContent":["import { tasty } from '@tenphi/tasty';\n\nexport const SliderThumbElement = tasty({\n qa: 'SliderThumb',\n styles: {\n top: '$slider-thumb-offset-top',\n left: '$slider-thumb-offset-left',\n width: '2x',\n height: '2x',\n fill: {\n '': '(#slider-thumb, #primary)',\n hovered: '(#slider-thumb-hovered, #primary-text)',\n dragged: '(#slider-thumb, #primary)',\n disabled: '#disabled-surface-text',\n },\n cursor: '$pointer',\n outline: {\n '': '1bw #primary-text.0',\n focused: '1bw #primary-text',\n },\n outlineOffset: 1,\n radius: '50%',\n transition: 'theme',\n zIndex: {\n '': 0,\n 'collapsed & !stuck': 1,\n },\n },\n});\n\nexport const SliderTrackContainerElement = tasty({\n qa: 'SliderTrackContainer',\n styles: {\n top: {\n '': '0',\n horizontal: '0.875x',\n },\n left: {\n '': '0.875x',\n horizontal: '0',\n },\n position: 'absolute',\n fill: '#dark-05',\n height: {\n '': 'initial 10x 100%',\n horizontal: '2px',\n },\n width: {\n '': '2px',\n horizontal: '100%',\n },\n radius: true,\n\n Fill: {\n $: '&::before',\n content: '\"\"',\n display: 'block',\n position: 'absolute',\n inset: {\n '': 'auto 0 0 0',\n horizontal: '0 auto 0 0',\n range: 'auto 0 $slider-range-start 0',\n 'range & horizontal': '0 auto 0 $slider-range-start',\n },\n fill: {\n '': '#primary',\n disabled: '#disabled-surface-text',\n },\n width: {\n '': 'auto',\n horizontal: '$slider-value',\n range: 'auto',\n 'range & horizontal': '($slider-range-end - $slider-range-start)',\n },\n height: {\n '': '$slider-value',\n horizontal: 'auto',\n range: '($slider-range-end - $slider-range-start)',\n 'range & horizontal': 'auto',\n },\n },\n },\n});\n\nexport const SliderGradationElement = tasty({\n qa: 'SliderGradation',\n styles: {\n position: 'absolute',\n top: '2x',\n left: 0,\n right: 0,\n\n display: 'flex',\n placeContent: 'space-between',\n },\n});\n\nexport const SliderGradeElement = tasty({\n qa: 'SliderGrade',\n styles: {\n display: 'grid',\n width: 'max 0',\n placeContent: 'center',\n preset: 'c2',\n color: '#dark-03',\n },\n});\n\nexport const SliderControlsElement = tasty({\n qa: 'SliderControls',\n styles: {\n position: 'relative',\n height: {\n '': 'initial 8x 100%',\n horizontal: '2x',\n },\n width: {\n '': '2x',\n horizontal: '(100% - 2x)',\n },\n\n '$slider-thumb-offset-top': {\n '': '0',\n horizontal: '1x',\n },\n '$slider-thumb-offset-left': {\n '': '1x',\n horizontal: '0',\n },\n },\n});\n\nexport const SliderElement = tasty({\n qa: 'RangeSlider',\n as: 'section',\n styles: {\n display: 'inline-flex',\n verticalAlign: {\n '': 'middle',\n 'side-label & !horizontal': 'top',\n },\n position: 'relative',\n height: {\n '': 'initial 10x 100%',\n horizontal: '2x',\n },\n width: {\n '': '2x',\n horizontal: '100%',\n },\n\n alignItems: 'center',\n flow: {\n '': 'column',\n inputs: 'row',\n },\n },\n});\n"],"mappings":";;;;AAEA,MAAa,qBAAqB,MAAM;CACtC,IAAI;CACJ,QAAQ;EACN,KAAK;EACL,MAAM;EACN,OAAO;EACP,QAAQ;EACR,MAAM;GACJ,IAAI;GACJ,SAAS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,MAAa,gBAAgB,MAAM;CACjC,IAAI;CACJ,IAAI;CACJ,QAAQ;EACN,SAAS;EACT,eAAe;GACb,IAAI;GACJ,4BAA4B;GAC7B;EACD,UAAU;EACV,QAAQ;GACN,IAAI;GACJ,YAAY;GACb;EACD,OAAO;GACL,IAAI;GACJ,YAAY;GACb;EAED,YAAY;EACZ,MAAM;GACJ,IAAI;GACJ,QAAQ;GACT;EACF;CACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"elements.js","names":[],"sources":["../../../../src/components/fields/Slider/elements.ts"],"sourcesContent":["import { tasty } from '@tenphi/tasty';\n\nexport const SliderThumbElement = tasty({\n qa: 'SliderThumb',\n styles: {\n top: '$slider-thumb-offset-top',\n left: '$slider-thumb-offset-left',\n width: '2x',\n height: '2x',\n fill: {\n '': '(#slider-thumb, #primary)',\n hovered: '(#slider-thumb-hovered, #primary-text)',\n dragged: '(#slider-thumb, #primary)',\n valid: '#success',\n invalid: '#danger',\n disabled: '#disabled-surface-text',\n },\n cursor: '$pointer',\n outline: {\n '': '1bw #primary-text.0',\n focused: '1bw #primary-text',\n },\n outlineOffset: 1,\n radius: '50%',\n transition: 'theme',\n zIndex: {\n '': 0,\n 'collapsed & !stuck': 1,\n },\n },\n});\n\nexport const SliderTrackContainerElement = tasty({\n qa: 'SliderTrackContainer',\n styles: {\n top: {\n '': '0',\n horizontal: '0.875x',\n },\n left: {\n '': '0.875x',\n horizontal: '0',\n },\n position: 'absolute',\n fill: '#dark-05',\n height: {\n '': 'initial 10x 100%',\n horizontal: '2px',\n },\n width: {\n '': '2px',\n horizontal: '100%',\n },\n radius: true,\n\n Fill: {\n $: '&::before',\n content: '\"\"',\n display: 'block',\n position: 'absolute',\n inset: {\n '': 'auto 0 0 0',\n horizontal: '0 auto 0 0',\n range: 'auto 0 $slider-range-start 0',\n 'range & horizontal': '0 auto 0 $slider-range-start',\n },\n fill: {\n '': '#primary',\n valid: '#success',\n invalid: '#danger',\n disabled: '#disabled-surface-text',\n },\n width: {\n '': 'auto',\n horizontal: '$slider-value',\n range: 'auto',\n 'range & horizontal': '($slider-range-end - $slider-range-start)',\n },\n height: {\n '': '$slider-value',\n horizontal: 'auto',\n range: '($slider-range-end - $slider-range-start)',\n 'range & horizontal': 'auto',\n },\n },\n },\n});\n\nexport const SliderGradationElement = tasty({\n qa: 'SliderGradation',\n styles: {\n position: 'absolute',\n top: '2x',\n left: 0,\n right: 0,\n\n display: 'flex',\n placeContent: 'space-between',\n },\n});\n\nexport const SliderGradeElement = tasty({\n qa: 'SliderGrade',\n styles: {\n display: 'grid',\n width: 'max 0',\n placeContent: 'center',\n preset: 'c2',\n color: '#dark-03',\n },\n});\n\nexport const SliderControlsElement = tasty({\n qa: 'SliderControls',\n styles: {\n position: 'relative',\n height: {\n '': 'initial 8x 100%',\n horizontal: '2x',\n },\n width: {\n '': '2x',\n horizontal: '(100% - 2x)',\n },\n\n '$slider-thumb-offset-top': {\n '': '0',\n horizontal: '1x',\n },\n '$slider-thumb-offset-left': {\n '': '1x',\n horizontal: '0',\n },\n },\n});\n\nexport const SliderElement = tasty({\n qa: 'RangeSlider',\n as: 'section',\n styles: {\n display: 'inline-flex',\n verticalAlign: {\n '': 'middle',\n 'side-label & !horizontal': 'top',\n },\n position: 'relative',\n height: {\n '': 'initial 10x 100%',\n horizontal: '2x',\n },\n width: {\n '': '2x',\n horizontal: '100%',\n },\n\n alignItems: 'center',\n flow: {\n '': 'column',\n inputs: 'row',\n },\n },\n});\n"],"mappings":";;;;AAEA,MAAa,qBAAqB,MAAM;CACtC,IAAI;CACJ,QAAQ;EACN,KAAK;EACL,MAAM;EACN,OAAO;EACP,QAAQ;EACR,MAAM;GACJ,IAAI;GACJ,SAAS;GACT,SAAS;GACT,OAAO;GACP,SAAS;GACT,UAAU;GACX;EACD,QAAQ;EACR,SAAS;GACP,IAAI;GACJ,SAAS;GACV;EACD,eAAe;EACf,QAAQ;EACR,YAAY;EACZ,QAAQ;GACN,IAAI;GACJ,sBAAsB;GACvB;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;GACN,IAAI;GACJ,YAAY;GACb;EACD,OAAO;GACL,IAAI;GACJ,YAAY;GACb;EAED,YAAY;EACZ,MAAM;GACJ,IAAI;GACJ,QAAQ;GACT;EACF;CACF,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-ec4e0f5 | Cube Dev Team */
|
|
2
2
|
import { __RangeSlider } from "./RangeSlider.js";
|
|
3
3
|
import { __Slider } from "./Slider.js";
|
|
4
4
|
import { __HueSlider } from "./HueSlider.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-ec4e0f5 | Cube Dev Team */
|
|
2
2
|
import { extractStyles } from "../../../utils/styles.js";
|
|
3
3
|
import { useId as useId$2 } from "../../../utils/react/useId.js";
|
|
4
4
|
import { mergeProps as mergeProps$1 } from "../../../utils/react/mergeProps.js";
|
|
@@ -43,6 +43,8 @@ const SwitchElement = tasty({
|
|
|
43
43
|
fill: {
|
|
44
44
|
"": "#surface",
|
|
45
45
|
checked: "#primary",
|
|
46
|
+
"invalid & checked": "#danger",
|
|
47
|
+
"valid & checked": "#success",
|
|
46
48
|
disabled: "#border.5",
|
|
47
49
|
"disabled & checked": "#border"
|
|
48
50
|
},
|
|
@@ -54,7 +56,8 @@ const SwitchElement = tasty({
|
|
|
54
56
|
"": "#dark-05",
|
|
55
57
|
checked: "#primary-text",
|
|
56
58
|
disabled: "#dark-05.5",
|
|
57
|
-
invalid: "#danger"
|
|
59
|
+
invalid: "#danger",
|
|
60
|
+
valid: "#success"
|
|
58
61
|
},
|
|
59
62
|
width: {
|
|
60
63
|
"": "5x 5x",
|