@cube-dev/ui-kit 0.13.4 → 0.13.6
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +21 -0
- package/cjs/_internal/hooks/index.js +1 -1
- package/cjs/_internal/hooks/use-chained-callback.js +1 -1
- package/cjs/_internal/hooks/use-deprecation-warning.js +1 -1
- package/cjs/_internal/hooks/use-event.js +1 -1
- package/cjs/_internal/hooks/use-sync-ref.js +1 -1
- package/cjs/_internal/hooks/use-timer/index.js +1 -1
- package/cjs/_internal/hooks/use-timer/timer.js +1 -1
- package/cjs/_internal/hooks/use-timer/use-timer.js +1 -1
- package/cjs/_internal/index.js +1 -1
- package/cjs/components/Base.js +1 -1
- package/cjs/components/Block.js +1 -1
- package/cjs/components/GlobalStyles.js +1 -1
- package/cjs/components/GridProvider.js +1 -1
- package/cjs/components/HiddenInput.js +1 -1
- package/cjs/components/OpenTrasition.js +1 -1
- package/cjs/components/Root.js +1 -1
- package/cjs/components/actions/Action.js +1 -1
- package/cjs/components/actions/Button/Button.js +1 -1
- package/cjs/components/actions/Button/Submit.js +1 -1
- package/cjs/components/actions/Button/index.js +1 -1
- package/cjs/components/actions/ButtonGroup/ButtonGroup.js +1 -1
- package/cjs/components/actions/index.js +1 -1
- package/cjs/components/content/ActiveZone/ActiveZone.js +1 -1
- package/cjs/components/content/Alert/Alert.js +1 -1
- package/cjs/components/content/Alert/index.js +1 -1
- package/cjs/components/content/Alert/types.js +1 -1
- package/cjs/components/content/Alert/use-alert.js +1 -1
- package/cjs/components/content/Avatar/Avatar.js +1 -1
- package/cjs/components/content/Badge/Badge.js +1 -1
- package/cjs/components/content/Card/Card.js +1 -1
- package/cjs/components/content/Content.js +1 -1
- package/cjs/components/content/CopySnippet/CopySnippet.js +1 -1
- package/cjs/components/content/CopySnippet/index.js +1 -1
- package/cjs/components/content/Divider.js +1 -1
- package/cjs/components/content/Footer.js +1 -1
- package/cjs/components/content/Header.js +1 -1
- package/cjs/components/content/Paragraph.js +1 -1
- package/cjs/components/content/Placeholder/Placeholder.js +1 -1
- package/cjs/components/content/PrismCode/PrismCode.js +1 -1
- package/cjs/components/content/Result/Result.js +1 -1
- package/cjs/components/content/Skeleton/Skeleton.js +1 -1
- package/cjs/components/content/Tag/Tag.js +1 -1
- package/cjs/components/content/Text.js +1 -1
- package/cjs/components/content/Title.js +1 -1
- package/cjs/components/forms/Checkbox/Checkbox.js +1 -1
- package/cjs/components/forms/Checkbox/CheckboxGroup.js +1 -1
- package/cjs/components/forms/Checkbox/context.js +1 -1
- package/cjs/components/forms/FieldWrapper.js +1 -1
- package/cjs/components/forms/FileInput/FileInput.js +1 -1
- package/cjs/components/forms/Form/Field.js +1 -1
- package/cjs/components/forms/Form/Form.js +7 -1
- package/cjs/components/forms/Form/SubmitError.js +27 -0
- package/cjs/components/forms/Form/index.js +5 -3
- package/cjs/components/forms/Form/types.js +1 -1
- package/cjs/components/forms/Form/useForm.js +2 -1
- package/cjs/components/forms/Form/validation.js +1 -1
- package/cjs/components/forms/Input/Input.js +1 -1
- package/cjs/components/forms/Input/index.js +1 -1
- package/cjs/components/forms/Label.js +1 -1
- package/cjs/components/forms/NumberInput/NumberInput.js +3 -3
- package/cjs/components/forms/NumberInput/StepButton.js +1 -1
- package/cjs/components/forms/PasswordInput/PasswordInput.js +1 -1
- package/cjs/components/forms/RadioGroup/Radio.js +1 -1
- package/cjs/components/forms/RadioGroup/RadioGroup.js +1 -1
- package/cjs/components/forms/RadioGroup/context.js +1 -1
- package/cjs/components/forms/RangeSlider/Gradation.js +28 -0
- package/cjs/components/forms/RangeSlider/Header.js +16 -0
- package/cjs/components/forms/RangeSlider/RangeInput.js +38 -0
- package/cjs/components/forms/RangeSlider/RangeSlider.js +98 -0
- package/cjs/components/forms/RangeSlider/Slide.js +28 -0
- package/cjs/components/forms/RangeSlider/Thumb.js +36 -0
- package/cjs/components/forms/RangeSlider/helpers.js +62 -0
- package/cjs/components/forms/RangeSlider/styled.js +113 -0
- package/cjs/components/forms/SearchInput/SearchInput.js +1 -1
- package/cjs/components/forms/Switch/Switch.js +1 -1
- package/cjs/components/forms/TextArea/TextArea.js +1 -1
- package/cjs/components/forms/TextInput/TextInput.js +1 -1
- package/cjs/components/forms/TextInput/TextInputBase.js +3 -3
- package/cjs/components/forms/index.js +1 -1
- package/cjs/components/layout/Flex.js +1 -1
- package/cjs/components/layout/Flow.js +1 -1
- package/cjs/components/layout/Grid.js +1 -1
- package/cjs/components/layout/Prefix.js +1 -1
- package/cjs/components/layout/Space.js +1 -1
- package/cjs/components/layout/Suffix.js +1 -1
- package/cjs/components/navigation/LegacyTabs/LegacyTabs.js +1 -1
- package/cjs/components/navigation/Link/Link.js +1 -1
- package/cjs/components/organisms/FileTabs/FileTabs.js +1 -1
- package/cjs/components/organisms/Modal/Modal.js +1 -1
- package/cjs/components/organisms/StatsCard/StatsCard.js +1 -1
- package/cjs/components/other/Base64Upload/Base64Upload.js +1 -1
- package/cjs/components/other/CloudLogo/CloudLogo.js +1 -1
- package/cjs/components/overlays/AlertDialog/AlertDialog.js +1 -1
- package/cjs/components/overlays/AlertDialog/AlertDialogApiProvider.js +10 -2
- package/cjs/components/overlays/AlertDialog/AlertDialogZone.js +2 -2
- package/cjs/components/overlays/AlertDialog/index.js +1 -1
- package/cjs/components/overlays/AlertDialog/types.js +1 -1
- package/cjs/components/overlays/Dialog/Dialog.js +1 -1
- package/cjs/components/overlays/Dialog/DialogContainer.js +1 -1
- package/cjs/components/overlays/Dialog/DialogForm.js +1 -1
- package/cjs/components/overlays/Dialog/DialogTrigger.js +1 -1
- package/cjs/components/overlays/Dialog/context.js +1 -1
- package/cjs/components/overlays/Dialog/index.js +1 -1
- package/cjs/components/overlays/Modal/Modal.js +1 -1
- package/cjs/components/overlays/Modal/OpenTransition.js +1 -1
- package/cjs/components/overlays/Modal/Overlay.js +1 -1
- package/cjs/components/overlays/Modal/Popover.js +1 -1
- package/cjs/components/overlays/Modal/Tray.js +1 -1
- package/cjs/components/overlays/Modal/Underlay.js +1 -1
- package/cjs/components/overlays/Modal/index.js +1 -1
- package/cjs/components/overlays/NewNotifications/Bar/FloatingNotification.js +1 -1
- package/cjs/components/overlays/NewNotifications/Bar/NotificationsBar.js +1 -1
- package/cjs/components/overlays/NewNotifications/Bar/TransitionComponent.js +1 -1
- package/cjs/components/overlays/NewNotifications/Bar/index.js +1 -1
- package/cjs/components/overlays/NewNotifications/Dialog/NotificationsDialogTrigger.js +1 -1
- package/cjs/components/overlays/NewNotifications/Dialog/index.js +1 -1
- package/cjs/components/overlays/NewNotifications/Notification.js +3 -1
- package/cjs/components/overlays/NewNotifications/NotificationView/NotificationAction.js +1 -1
- package/cjs/components/overlays/NewNotifications/NotificationView/NotificationCloseButton.js +1 -1
- package/cjs/components/overlays/NewNotifications/NotificationView/NotificationDescription.js +1 -1
- package/cjs/components/overlays/NewNotifications/NotificationView/NotificationFooter.js +1 -1
- package/cjs/components/overlays/NewNotifications/NotificationView/NotificationHeader.js +1 -1
- package/cjs/components/overlays/NewNotifications/NotificationView/NotificationIcon.js +1 -1
- package/cjs/components/overlays/NewNotifications/NotificationView/NotificationProvider.js +1 -1
- package/cjs/components/overlays/NewNotifications/NotificationView/NotificationView.js +1 -1
- package/cjs/components/overlays/NewNotifications/NotificationView/index.js +1 -1
- package/cjs/components/overlays/NewNotifications/NotificationView/types.js +1 -1
- package/cjs/components/overlays/NewNotifications/NotificationsContext/NotificationsProvider.js +1 -1
- package/cjs/components/overlays/NewNotifications/NotificationsContext/index.js +1 -1
- package/cjs/components/overlays/NewNotifications/NotificationsContext/use-notifications.js +4 -1
- package/cjs/components/overlays/NewNotifications/NotificationsList/NotificationsList.js +1 -1
- package/cjs/components/overlays/NewNotifications/NotificationsList/NotificationsListItem.js +1 -1
- package/cjs/components/overlays/NewNotifications/NotificationsList/index.js +1 -1
- package/cjs/components/overlays/NewNotifications/NotificationsList/types.js +1 -1
- package/cjs/components/overlays/NewNotifications/hooks/index.js +1 -1
- package/cjs/components/overlays/NewNotifications/hooks/types.js +1 -1
- package/cjs/components/overlays/NewNotifications/hooks/use-notification-list-item.js +1 -1
- package/cjs/components/overlays/NewNotifications/hooks/use-notifications-api.js +1 -1
- package/cjs/components/overlays/NewNotifications/hooks/use-notifications-list.js +1 -1
- package/cjs/components/overlays/NewNotifications/hooks/use-notifications-observer.js +1 -1
- package/cjs/components/overlays/NewNotifications/index.js +1 -1
- package/cjs/components/overlays/NewNotifications/types.js +1 -1
- package/cjs/components/overlays/Notification/Notification.js +1 -1
- package/cjs/components/overlays/OverlayWrapper.js +1 -1
- package/cjs/components/overlays/Toasts/Toast.js +1 -1
- package/cjs/components/overlays/Toasts/index.js +1 -1
- package/cjs/components/overlays/Toasts/types.js +1 -1
- package/cjs/components/overlays/Toasts/use-toasts-api.js +1 -1
- package/cjs/components/overlays/Tooltip/Tooltip.js +1 -1
- package/cjs/components/overlays/Tooltip/TooltipProvider.js +1 -1
- package/cjs/components/overlays/Tooltip/TooltipTrigger.js +1 -1
- package/cjs/components/overlays/Tooltip/context.js +1 -1
- package/cjs/components/pickers/ComboBox/ComboBox.js +1 -1
- package/cjs/components/pickers/Menu/Menu.js +1 -1
- package/cjs/components/pickers/Menu/MenuButton.js +1 -1
- package/cjs/components/pickers/Menu/MenuItem.js +1 -1
- package/cjs/components/pickers/Menu/MenuSection.js +1 -1
- package/cjs/components/pickers/Menu/MenuTrigger.js +1 -1
- package/cjs/components/pickers/Menu/context.js +1 -1
- package/cjs/components/pickers/Menu/styled.js +1 -1
- package/cjs/components/pickers/Select/Select.js +1 -1
- package/cjs/components/portal/Portal.js +1 -1
- package/cjs/components/portal/PortalProvider.js +1 -1
- package/cjs/components/portal/index.js +1 -1
- package/cjs/components/portal/storybook/templates/CustomRoot.js +1 -1
- package/cjs/components/portal/storybook/templates/PortalOrder.js +1 -1
- package/cjs/components/portal/storybook/templates/basic.js +1 -1
- package/cjs/components/portal/storybook/templates/index.js +1 -1
- package/cjs/components/portal/types.js +1 -1
- package/cjs/components/portal/usePortal.js +1 -1
- package/cjs/components/status/LoadingAnimation/LoadingAnimation.js +1 -1
- package/cjs/components/status/LoadingAnimation/index.js +1 -1
- package/cjs/components/status/Spin/Cube.js +1 -1
- package/cjs/components/status/Spin/InternalSpinner.js +1 -1
- package/cjs/components/status/Spin/Spin.js +1 -1
- package/cjs/components/status/Spin/SpinsContainer.js +1 -1
- package/cjs/components/status/Spin/index.js +1 -1
- package/cjs/components/status/Spin/types.js +1 -1
- package/cjs/components/status/index.js +1 -1
- package/cjs/data/themes.js +1 -1
- package/cjs/icons/Attention.js +1 -1
- package/cjs/icons/Cross.js +1 -1
- package/cjs/icons/Danger.js +1 -1
- package/cjs/icons/Success.js +1 -1
- package/cjs/icons/index.js +1 -1
- package/cjs/index.js +5 -3
- package/cjs/provider.js +1 -1
- package/cjs/providers/StyleProvider.js +1 -1
- package/cjs/services/notification.js +1 -1
- package/cjs/shared/form.js +1 -1
- package/cjs/shared/index.js +1 -1
- package/cjs/stories/FormFieldArgs.js +20 -2
- package/cjs/stories/components/ConfirmDeletionDialogForm.js +1 -1
- package/cjs/stories/components/DialogFormApp.js +1 -1
- package/cjs/stories/components/StyledButton.js +1 -1
- package/cjs/stories/lists/baseProps.js +1 -1
- package/cjs/styled/index.js +1 -1
- package/cjs/styled/styled.js +1 -1
- package/cjs/tasty/index.js +1 -1
- package/cjs/tasty/providers/BreakpointsProvider.js +1 -1
- package/cjs/tasty/styles/align.js +1 -1
- package/cjs/tasty/styles/border.js +1 -1
- package/cjs/tasty/styles/boxShadow.combinator.js +1 -1
- package/cjs/tasty/styles/color.js +1 -1
- package/cjs/tasty/styles/createStyle.js +1 -1
- package/cjs/tasty/styles/dimension.js +1 -1
- package/cjs/tasty/styles/display.js +1 -1
- package/cjs/tasty/styles/fill.js +1 -1
- package/cjs/tasty/styles/flow.js +1 -1
- package/cjs/tasty/styles/font.js +1 -1
- package/cjs/tasty/styles/fontStyle.js +1 -1
- package/cjs/tasty/styles/gap.js +1 -1
- package/cjs/tasty/styles/groupRadius.js +1 -1
- package/cjs/tasty/styles/height.js +1 -1
- package/cjs/tasty/styles/index.js +1 -1
- package/cjs/tasty/styles/justify.js +1 -1
- package/cjs/tasty/styles/list.js +1 -1
- package/cjs/tasty/styles/margin.js +1 -1
- package/cjs/tasty/styles/marginBlock.js +1 -1
- package/cjs/tasty/styles/marginInline.js +1 -1
- package/cjs/tasty/styles/outline.js +1 -1
- package/cjs/tasty/styles/padding.js +1 -1
- package/cjs/tasty/styles/paddingBlock.js +1 -1
- package/cjs/tasty/styles/paddingInline.js +1 -1
- package/cjs/tasty/styles/predefined.js +1 -1
- package/cjs/tasty/styles/preset.js +1 -1
- package/cjs/tasty/styles/radius.js +1 -1
- package/cjs/tasty/styles/reset.js +1 -1
- package/cjs/tasty/styles/shadow.js +8 -5
- package/cjs/tasty/styles/styledScrollbar.js +1 -1
- package/cjs/tasty/styles/transition.js +1 -1
- package/cjs/tasty/styles/types.js +1 -1
- package/cjs/tasty/styles/width.js +1 -1
- package/cjs/tasty/tasty.js +1 -1
- package/cjs/tasty/types.js +1 -1
- package/cjs/tasty/utils/colors.js +1 -1
- package/cjs/tasty/utils/dotize.js +1 -1
- package/cjs/tasty/utils/filterBaseProps.js +1 -1
- package/cjs/tasty/utils/get-display-name.js +1 -1
- package/cjs/tasty/utils/index.js +1 -1
- package/cjs/tasty/utils/mergeStyles.js +1 -1
- package/cjs/tasty/utils/modAttrs.js +1 -1
- package/cjs/tasty/utils/renderStyles.js +1 -1
- package/cjs/tasty/utils/responsive.js +1 -1
- package/cjs/tasty/utils/string.js +1 -1
- package/cjs/tasty/utils/styles.js +1 -1
- package/cjs/tasty/utils/warnings.js +1 -1
- package/cjs/test/index.js +1 -1
- package/cjs/test/render.js +1 -1
- package/cjs/test/setup.js +1 -1
- package/cjs/test/utils/index.js +1 -1
- package/cjs/test/utils/wait.js +1 -1
- package/cjs/tokens.js +1 -1
- package/cjs/type-checks.js +1 -1
- package/cjs/utils/ResizeSensor.js +1 -1
- package/cjs/utils/modules.js +1 -1
- package/cjs/utils/promise.js +1 -1
- package/cjs/utils/random.js +1 -1
- package/cjs/utils/range.js +1 -1
- package/cjs/utils/react/Slots.js +1 -1
- package/cjs/utils/react/chain.js +1 -1
- package/cjs/utils/react/index.js +1 -1
- package/cjs/utils/react/interactions.js +1 -1
- package/cjs/utils/react/isTextOnly.js +1 -1
- package/cjs/utils/react/mapProps.js +1 -1
- package/cjs/utils/react/mergeProps.js +1 -1
- package/cjs/utils/react/nullableValue.js +1 -1
- package/cjs/utils/react/useCombinedRefs.js +1 -1
- package/cjs/utils/react/useId.js +1 -1
- package/cjs/utils/react/useLayoutEffect.js +1 -1
- package/cjs/utils/react/useViewportSize.js +1 -1
- package/cjs/utils/react/wrapNodeIfPlain.js +1 -1
- package/cjs/utils/transitions.js +1 -1
- package/cjs/utils/tree.js +1 -1
- package/cjs/utils/warnings.js +1 -1
- package/es/_internal/hooks/index.js +1 -1
- package/es/_internal/hooks/use-chained-callback.js +1 -1
- package/es/_internal/hooks/use-deprecation-warning.js +1 -1
- package/es/_internal/hooks/use-event.js +1 -1
- package/es/_internal/hooks/use-sync-ref.js +1 -1
- package/es/_internal/hooks/use-timer/index.js +1 -1
- package/es/_internal/hooks/use-timer/timer.js +1 -1
- package/es/_internal/hooks/use-timer/use-timer.js +1 -1
- package/es/_internal/index.js +1 -1
- package/es/components/Base.js +1 -1
- package/es/components/Block.js +1 -1
- package/es/components/GlobalStyles.js +1 -1
- package/es/components/GridProvider.js +1 -1
- package/es/components/HiddenInput.js +1 -1
- package/es/components/OpenTrasition.js +1 -1
- package/es/components/Root.js +1 -1
- package/es/components/actions/Action.js +1 -1
- package/es/components/actions/Button/Button.js +1 -1
- package/es/components/actions/Button/Submit.js +1 -1
- package/es/components/actions/Button/index.js +1 -1
- package/es/components/actions/ButtonGroup/ButtonGroup.js +1 -1
- package/es/components/actions/index.js +1 -1
- package/es/components/content/ActiveZone/ActiveZone.js +1 -1
- package/es/components/content/Alert/Alert.js +1 -1
- package/es/components/content/Alert/index.js +1 -1
- package/es/components/content/Alert/types.js +1 -1
- package/es/components/content/Alert/use-alert.js +1 -1
- package/es/components/content/Avatar/Avatar.js +1 -1
- package/es/components/content/Badge/Badge.js +1 -1
- package/es/components/content/Card/Card.js +1 -1
- package/es/components/content/Content.js +1 -1
- package/es/components/content/CopySnippet/CopySnippet.js +1 -1
- package/es/components/content/CopySnippet/index.js +1 -1
- package/es/components/content/Divider.js +1 -1
- package/es/components/content/Footer.js +1 -1
- package/es/components/content/Header.js +1 -1
- package/es/components/content/Paragraph.js +1 -1
- package/es/components/content/Placeholder/Placeholder.js +1 -1
- package/es/components/content/PrismCode/PrismCode.js +1 -1
- package/es/components/content/Result/Result.js +1 -1
- package/es/components/content/Skeleton/Skeleton.js +1 -1
- package/es/components/content/Tag/Tag.js +1 -1
- package/es/components/content/Text.js +1 -1
- package/es/components/content/Title.js +1 -1
- package/es/components/forms/Checkbox/Checkbox.js +1 -1
- package/es/components/forms/Checkbox/CheckboxGroup.js +1 -1
- package/es/components/forms/Checkbox/context.js +1 -1
- package/es/components/forms/FieldWrapper.js +1 -1
- package/es/components/forms/FileInput/FileInput.js +1 -1
- package/es/components/forms/Form/Field.js +1 -1
- package/es/components/forms/Form/Form.js +8 -2
- package/es/components/forms/Form/SubmitError.js +23 -0
- package/es/components/forms/Form/index.js +4 -3
- package/es/components/forms/Form/types.js +1 -1
- package/es/components/forms/Form/useForm.js +2 -1
- package/es/components/forms/Form/validation.js +1 -1
- package/es/components/forms/Input/Input.js +1 -1
- package/es/components/forms/Input/index.js +1 -1
- package/es/components/forms/Label.js +1 -1
- package/es/components/forms/NumberInput/NumberInput.js +3 -3
- package/es/components/forms/NumberInput/StepButton.js +1 -1
- package/es/components/forms/PasswordInput/PasswordInput.js +1 -1
- package/es/components/forms/RadioGroup/Radio.js +1 -1
- package/es/components/forms/RadioGroup/RadioGroup.js +1 -1
- package/es/components/forms/RadioGroup/context.js +1 -1
- package/es/components/forms/RangeSlider/Gradation.js +24 -0
- package/es/components/forms/RangeSlider/Header.js +12 -0
- package/es/components/forms/RangeSlider/RangeInput.js +34 -0
- package/es/components/forms/RangeSlider/RangeSlider.js +95 -0
- package/es/components/forms/RangeSlider/Slide.js +24 -0
- package/es/components/forms/RangeSlider/Thumb.js +32 -0
- package/es/components/forms/RangeSlider/helpers.js +54 -0
- package/es/components/forms/RangeSlider/styled.js +110 -0
- package/es/components/forms/SearchInput/SearchInput.js +1 -1
- package/es/components/forms/Switch/Switch.js +1 -1
- package/es/components/forms/TextArea/TextArea.js +1 -1
- package/es/components/forms/TextInput/TextInput.js +1 -1
- package/es/components/forms/TextInput/TextInputBase.js +3 -3
- package/es/components/forms/index.js +1 -1
- package/es/components/layout/Flex.js +1 -1
- package/es/components/layout/Flow.js +1 -1
- package/es/components/layout/Grid.js +1 -1
- package/es/components/layout/Prefix.js +1 -1
- package/es/components/layout/Space.js +1 -1
- package/es/components/layout/Suffix.js +1 -1
- package/es/components/navigation/LegacyTabs/LegacyTabs.js +1 -1
- package/es/components/navigation/Link/Link.js +1 -1
- package/es/components/organisms/FileTabs/FileTabs.js +1 -1
- package/es/components/organisms/Modal/Modal.js +1 -1
- package/es/components/organisms/StatsCard/StatsCard.js +1 -1
- package/es/components/other/Base64Upload/Base64Upload.js +1 -1
- package/es/components/other/CloudLogo/CloudLogo.js +1 -1
- package/es/components/overlays/AlertDialog/AlertDialog.js +1 -1
- package/es/components/overlays/AlertDialog/AlertDialogApiProvider.js +10 -2
- package/es/components/overlays/AlertDialog/AlertDialogZone.js +2 -2
- package/es/components/overlays/AlertDialog/index.js +1 -1
- package/es/components/overlays/AlertDialog/types.js +1 -1
- package/es/components/overlays/Dialog/Dialog.js +1 -1
- package/es/components/overlays/Dialog/DialogContainer.js +1 -1
- package/es/components/overlays/Dialog/DialogForm.js +1 -1
- package/es/components/overlays/Dialog/DialogTrigger.js +1 -1
- package/es/components/overlays/Dialog/context.js +1 -1
- package/es/components/overlays/Dialog/index.js +1 -1
- package/es/components/overlays/Modal/Modal.js +1 -1
- package/es/components/overlays/Modal/OpenTransition.js +1 -1
- package/es/components/overlays/Modal/Overlay.js +1 -1
- package/es/components/overlays/Modal/Popover.js +1 -1
- package/es/components/overlays/Modal/Tray.js +1 -1
- package/es/components/overlays/Modal/Underlay.js +1 -1
- package/es/components/overlays/Modal/index.js +1 -1
- package/es/components/overlays/NewNotifications/Bar/FloatingNotification.js +1 -1
- package/es/components/overlays/NewNotifications/Bar/NotificationsBar.js +1 -1
- package/es/components/overlays/NewNotifications/Bar/TransitionComponent.js +1 -1
- package/es/components/overlays/NewNotifications/Bar/index.js +1 -1
- package/es/components/overlays/NewNotifications/Dialog/NotificationsDialogTrigger.js +1 -1
- package/es/components/overlays/NewNotifications/Dialog/index.js +1 -1
- package/es/components/overlays/NewNotifications/Notification.js +3 -1
- package/es/components/overlays/NewNotifications/NotificationView/NotificationAction.js +1 -1
- package/es/components/overlays/NewNotifications/NotificationView/NotificationCloseButton.js +1 -1
- package/es/components/overlays/NewNotifications/NotificationView/NotificationDescription.js +1 -1
- package/es/components/overlays/NewNotifications/NotificationView/NotificationFooter.js +1 -1
- package/es/components/overlays/NewNotifications/NotificationView/NotificationHeader.js +1 -1
- package/es/components/overlays/NewNotifications/NotificationView/NotificationIcon.js +1 -1
- package/es/components/overlays/NewNotifications/NotificationView/NotificationProvider.js +1 -1
- package/es/components/overlays/NewNotifications/NotificationView/NotificationView.js +1 -1
- package/es/components/overlays/NewNotifications/NotificationView/index.js +1 -1
- package/es/components/overlays/NewNotifications/NotificationView/types.js +1 -1
- package/es/components/overlays/NewNotifications/NotificationsContext/NotificationsProvider.js +1 -1
- package/es/components/overlays/NewNotifications/NotificationsContext/index.js +1 -1
- package/es/components/overlays/NewNotifications/NotificationsContext/use-notifications.js +4 -1
- package/es/components/overlays/NewNotifications/NotificationsList/NotificationsList.js +1 -1
- package/es/components/overlays/NewNotifications/NotificationsList/NotificationsListItem.js +1 -1
- package/es/components/overlays/NewNotifications/NotificationsList/index.js +1 -1
- package/es/components/overlays/NewNotifications/NotificationsList/types.js +1 -1
- package/es/components/overlays/NewNotifications/hooks/index.js +1 -1
- package/es/components/overlays/NewNotifications/hooks/types.js +1 -1
- package/es/components/overlays/NewNotifications/hooks/use-notification-list-item.js +1 -1
- package/es/components/overlays/NewNotifications/hooks/use-notifications-api.js +1 -1
- package/es/components/overlays/NewNotifications/hooks/use-notifications-list.js +1 -1
- package/es/components/overlays/NewNotifications/hooks/use-notifications-observer.js +1 -1
- package/es/components/overlays/NewNotifications/index.js +1 -1
- package/es/components/overlays/NewNotifications/types.js +1 -1
- package/es/components/overlays/Notification/Notification.js +1 -1
- package/es/components/overlays/OverlayWrapper.js +1 -1
- package/es/components/overlays/Toasts/Toast.js +1 -1
- package/es/components/overlays/Toasts/index.js +1 -1
- package/es/components/overlays/Toasts/types.js +1 -1
- package/es/components/overlays/Toasts/use-toasts-api.js +1 -1
- package/es/components/overlays/Tooltip/Tooltip.js +1 -1
- package/es/components/overlays/Tooltip/TooltipProvider.js +1 -1
- package/es/components/overlays/Tooltip/TooltipTrigger.js +1 -1
- package/es/components/overlays/Tooltip/context.js +1 -1
- package/es/components/pickers/ComboBox/ComboBox.js +1 -1
- package/es/components/pickers/Menu/Menu.js +1 -1
- package/es/components/pickers/Menu/MenuButton.js +1 -1
- package/es/components/pickers/Menu/MenuItem.js +1 -1
- package/es/components/pickers/Menu/MenuSection.js +1 -1
- package/es/components/pickers/Menu/MenuTrigger.js +1 -1
- package/es/components/pickers/Menu/context.js +1 -1
- package/es/components/pickers/Menu/styled.js +1 -1
- package/es/components/pickers/Select/Select.js +1 -1
- package/es/components/portal/Portal.js +1 -1
- package/es/components/portal/PortalProvider.js +1 -1
- package/es/components/portal/index.js +1 -1
- package/es/components/portal/storybook/templates/CustomRoot.js +1 -1
- package/es/components/portal/storybook/templates/PortalOrder.js +1 -1
- package/es/components/portal/storybook/templates/basic.js +1 -1
- package/es/components/portal/storybook/templates/index.js +1 -1
- package/es/components/portal/types.js +1 -1
- package/es/components/portal/usePortal.js +1 -1
- package/es/components/status/LoadingAnimation/LoadingAnimation.js +1 -1
- package/es/components/status/LoadingAnimation/index.js +1 -1
- package/es/components/status/Spin/Cube.js +1 -1
- package/es/components/status/Spin/InternalSpinner.js +1 -1
- package/es/components/status/Spin/Spin.js +1 -1
- package/es/components/status/Spin/SpinsContainer.js +1 -1
- package/es/components/status/Spin/index.js +1 -1
- package/es/components/status/Spin/types.js +1 -1
- package/es/components/status/index.js +1 -1
- package/es/data/themes.js +1 -1
- package/es/icons/Attention.js +1 -1
- package/es/icons/Cross.js +1 -1
- package/es/icons/Danger.js +1 -1
- package/es/icons/Success.js +1 -1
- package/es/icons/index.js +1 -1
- package/es/index.js +2 -1
- package/es/provider.js +1 -1
- package/es/providers/StyleProvider.js +1 -1
- package/es/services/notification.js +1 -1
- package/es/shared/form.js +1 -1
- package/es/shared/index.js +1 -1
- package/es/stories/FormFieldArgs.js +19 -1
- package/es/stories/components/ConfirmDeletionDialogForm.js +1 -1
- package/es/stories/components/DialogFormApp.js +1 -1
- package/es/stories/components/StyledButton.js +1 -1
- package/es/stories/lists/baseProps.js +1 -1
- package/es/styled/index.js +1 -1
- package/es/styled/styled.js +1 -1
- package/es/tasty/index.js +1 -1
- package/es/tasty/providers/BreakpointsProvider.js +1 -1
- package/es/tasty/styles/align.js +1 -1
- package/es/tasty/styles/border.js +1 -1
- package/es/tasty/styles/boxShadow.combinator.js +1 -1
- package/es/tasty/styles/color.js +1 -1
- package/es/tasty/styles/createStyle.js +1 -1
- package/es/tasty/styles/dimension.js +1 -1
- package/es/tasty/styles/display.js +1 -1
- package/es/tasty/styles/fill.js +1 -1
- package/es/tasty/styles/flow.js +1 -1
- package/es/tasty/styles/font.js +1 -1
- package/es/tasty/styles/fontStyle.js +1 -1
- package/es/tasty/styles/gap.js +1 -1
- package/es/tasty/styles/groupRadius.js +1 -1
- package/es/tasty/styles/height.js +1 -1
- package/es/tasty/styles/index.js +1 -1
- package/es/tasty/styles/justify.js +1 -1
- package/es/tasty/styles/list.js +1 -1
- package/es/tasty/styles/margin.js +1 -1
- package/es/tasty/styles/marginBlock.js +1 -1
- package/es/tasty/styles/marginInline.js +1 -1
- package/es/tasty/styles/outline.js +1 -1
- package/es/tasty/styles/padding.js +1 -1
- package/es/tasty/styles/paddingBlock.js +1 -1
- package/es/tasty/styles/paddingInline.js +1 -1
- package/es/tasty/styles/predefined.js +1 -1
- package/es/tasty/styles/preset.js +1 -1
- package/es/tasty/styles/radius.js +1 -1
- package/es/tasty/styles/reset.js +1 -1
- package/es/tasty/styles/shadow.js +8 -5
- package/es/tasty/styles/styledScrollbar.js +1 -1
- package/es/tasty/styles/transition.js +1 -1
- package/es/tasty/styles/types.js +1 -1
- package/es/tasty/styles/width.js +1 -1
- package/es/tasty/tasty.js +1 -1
- package/es/tasty/types.js +1 -1
- package/es/tasty/utils/colors.js +1 -1
- package/es/tasty/utils/dotize.js +1 -1
- package/es/tasty/utils/filterBaseProps.js +1 -1
- package/es/tasty/utils/get-display-name.js +1 -1
- package/es/tasty/utils/index.js +1 -1
- package/es/tasty/utils/mergeStyles.js +1 -1
- package/es/tasty/utils/modAttrs.js +1 -1
- package/es/tasty/utils/renderStyles.js +1 -1
- package/es/tasty/utils/responsive.js +1 -1
- package/es/tasty/utils/string.js +1 -1
- package/es/tasty/utils/styles.js +1 -1
- package/es/tasty/utils/warnings.js +1 -1
- package/es/test/index.js +1 -1
- package/es/test/render.js +1 -1
- package/es/test/setup.js +1 -1
- package/es/test/utils/index.js +1 -1
- package/es/test/utils/wait.js +1 -1
- package/es/tokens.js +1 -1
- package/es/type-checks.js +1 -1
- package/es/utils/ResizeSensor.js +1 -1
- package/es/utils/modules.js +1 -1
- package/es/utils/promise.js +1 -1
- package/es/utils/random.js +1 -1
- package/es/utils/range.js +1 -1
- package/es/utils/react/Slots.js +1 -1
- package/es/utils/react/chain.js +1 -1
- package/es/utils/react/index.js +1 -1
- package/es/utils/react/interactions.js +1 -1
- package/es/utils/react/isTextOnly.js +1 -1
- package/es/utils/react/mapProps.js +1 -1
- package/es/utils/react/mergeProps.js +1 -1
- package/es/utils/react/nullableValue.js +1 -1
- package/es/utils/react/useCombinedRefs.js +1 -1
- package/es/utils/react/useId.js +1 -1
- package/es/utils/react/useLayoutEffect.js +1 -1
- package/es/utils/react/useViewportSize.js +1 -1
- package/es/utils/react/wrapNodeIfPlain.js +1 -1
- package/es/utils/transitions.js +1 -1
- package/es/utils/tree.js +1 -1
- package/es/utils/warnings.js +1 -1
- package/package.json +4 -1
- package/types/components/forms/Form/SubmitError.d.ts +6 -0
- package/types/components/forms/Form/index.d.ts +6 -1
- package/types/components/forms/Form/useForm.d.ts +1 -0
- package/types/components/forms/RangeSlider/Gradation.d.ts +8 -0
- package/types/components/forms/RangeSlider/Header.d.ts +1 -0
- package/types/components/forms/RangeSlider/RangeInput.d.ts +10 -0
- package/types/components/forms/RangeSlider/RangeSlider.d.ts +17 -0
- package/types/components/forms/RangeSlider/Slide.d.ts +9 -0
- package/types/components/forms/RangeSlider/Thumb.d.ts +9 -0
- package/types/components/forms/RangeSlider/helpers.d.ts +6 -0
- package/types/components/forms/RangeSlider/styled.d.ts +8 -0
- package/types/index.d.ts +2 -0
- package/types/stories/FormFieldArgs.d.ts +22 -0
- package/types/tasty/styles/shadow.d.ts +1 -1
@@ -1,13 +1,13 @@
|
|
1
1
|
/**
|
2
2
|
* @license MIT
|
3
3
|
* author: Cube Dev Team
|
4
|
-
* @cube-dev/ui-kit v0.13.
|
4
|
+
* @cube-dev/ui-kit v0.13.6
|
5
5
|
* Released under the MIT license.
|
6
6
|
*/
|
7
7
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
9
9
|
import { useDOMRef } from '@react-spectrum/utils';
|
10
|
-
import { createContext, forwardRef, useContext, useEffect, useRef, } from 'react';
|
10
|
+
import { createContext, forwardRef, useContext, useEffect, useRef, useState, } from 'react';
|
11
11
|
import { Provider, useProviderProps } from '../../../provider';
|
12
12
|
import { CONTAINER_STYLES, extractStyles, filterBaseProps, tasty, } from '../../../tasty';
|
13
13
|
import { useCombinedRefs } from '../../../utils/react';
|
@@ -39,6 +39,7 @@ function Form(props, ref) {
|
|
39
39
|
props = useProviderProps(props);
|
40
40
|
let { qa, name, children, labelPosition = 'top', isRequired, necessityIndicator, isDisabled, isReadOnly, validationState, labelStyles, validateTrigger, defaultValues, onValuesChange, requiredMark = true, form, labelWidth, onSubmit, onSubmitFailed, ...otherProps } = props;
|
41
41
|
const firstRunRef = useRef(true);
|
42
|
+
const [submitError, setSubmitError] = useState(null);
|
42
43
|
ref = useCombinedRefs(ref);
|
43
44
|
let onSubmitCallback;
|
44
45
|
if ((onSubmit || onSubmitFailed) && !otherProps.action) {
|
@@ -56,6 +57,8 @@ function Form(props, ref) {
|
|
56
57
|
}
|
57
58
|
if (!form || form.isSubmitting)
|
58
59
|
return;
|
60
|
+
setSubmitError(null);
|
61
|
+
form.submitError = null;
|
59
62
|
form.setSubmitting(true);
|
60
63
|
try {
|
61
64
|
await form.validateFields();
|
@@ -68,6 +71,8 @@ function Form(props, ref) {
|
|
68
71
|
throw e;
|
69
72
|
}
|
70
73
|
// errors are shown
|
74
|
+
setSubmitError(e);
|
75
|
+
form.submitError = e;
|
71
76
|
// transfer errors to the callback
|
72
77
|
onSubmitFailed?.(e);
|
73
78
|
}
|
@@ -94,6 +99,7 @@ function Form(props, ref) {
|
|
94
99
|
validateTrigger,
|
95
100
|
requiredMark,
|
96
101
|
form,
|
102
|
+
submitError,
|
97
103
|
idPrefix: name,
|
98
104
|
};
|
99
105
|
if (firstRunRef.current && form) {
|
@@ -0,0 +1,23 @@
|
|
1
|
+
/**
|
2
|
+
* @license MIT
|
3
|
+
* author: Cube Dev Team
|
4
|
+
* @cube-dev/ui-kit v0.13.6
|
5
|
+
* Released under the MIT license.
|
6
|
+
*/
|
7
|
+
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
9
|
+
import { useContext } from 'react';
|
10
|
+
import { Alert } from '../../content/Alert';
|
11
|
+
import { FormContext } from './Form';
|
12
|
+
/**
|
13
|
+
* An alert that shows a form error message received from the onSubmit callback.
|
14
|
+
*/
|
15
|
+
export function SubmitError(props) {
|
16
|
+
const { submitError } = useContext(FormContext);
|
17
|
+
if (!submitError) {
|
18
|
+
return null;
|
19
|
+
}
|
20
|
+
return (_jsx(Alert, { theme: "danger", ...props, children: submitError }, void 0));
|
21
|
+
}
|
22
|
+
|
23
|
+
|
@@ -1,14 +1,15 @@
|
|
1
1
|
/**
|
2
2
|
* @license MIT
|
3
3
|
* author: Cube Dev Team
|
4
|
-
* @cube-dev/ui-kit v0.13.
|
4
|
+
* @cube-dev/ui-kit v0.13.6
|
5
5
|
* Released under the MIT license.
|
6
6
|
*/
|
7
7
|
|
8
8
|
import { Field } from './Field';
|
9
|
+
import { SubmitError } from './SubmitError';
|
9
10
|
import { useForm } from './useForm';
|
10
11
|
import { useFormProps, FormContext, Form as _Form } from './Form';
|
11
|
-
const Form = Object.assign(_Form, { Item: Field, useForm });
|
12
|
-
export { useFormProps, Form, Field, useForm, FormContext };
|
12
|
+
const Form = Object.assign(_Form, { Item: Field, useForm, SubmitError });
|
13
|
+
export { useFormProps, Form, Field, useForm, FormContext, SubmitError };
|
13
14
|
|
14
15
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @license MIT
|
3
3
|
* author: Cube Dev Team
|
4
|
-
* @cube-dev/ui-kit v0.13.
|
4
|
+
* @cube-dev/ui-kit v0.13.6
|
5
5
|
* Released under the MIT license.
|
6
6
|
*/
|
7
7
|
|
@@ -29,6 +29,7 @@ export class CubeFormInstance {
|
|
29
29
|
this.fields = {};
|
30
30
|
this.ref = {};
|
31
31
|
this.isSubmitting = false;
|
32
|
+
this.submitError = null;
|
32
33
|
this.onValuesChange = () => { };
|
33
34
|
this.onSubmit = () => { };
|
34
35
|
this.setFieldsValue = (newData, touched, skipRender, createFields = false, inputOnly = false) => {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @license MIT
|
3
3
|
* author: Cube Dev Team
|
4
|
-
* @cube-dev/ui-kit v0.13.
|
4
|
+
* @cube-dev/ui-kit v0.13.6
|
5
5
|
* Released under the MIT license.
|
6
6
|
*/
|
7
7
|
|
@@ -29,13 +29,13 @@ function NumberInput(props, ref) {
|
|
29
29
|
props = castNullableNumberValue(props);
|
30
30
|
props = useProviderProps(props);
|
31
31
|
props = useFormProps(props);
|
32
|
-
let { hideStepper, value, defaultValue, onChange, ...otherProps } = props;
|
32
|
+
let { hideStepper, suffix, value, defaultValue, onChange, ...otherProps } = props;
|
33
33
|
let showStepper = !hideStepper;
|
34
34
|
let { locale } = useLocale();
|
35
35
|
let state = useNumberFieldState({ ...props, locale });
|
36
36
|
let inputRef = useRef(null);
|
37
37
|
let { groupProps, labelProps, inputProps, incrementButtonProps, decrementButtonProps, } = useNumberField(props, state, inputRef);
|
38
|
-
return (_jsx(TextInputBase, { ...otherProps, ref: ref, labelProps: labelProps, inputProps: inputProps, inputRef: inputRef, wrapperProps: groupProps, suffixPosition: "after", suffix: showStepper ? (_jsxs(StepperContainer, { children: [_jsx(StepButton, { isDisabled: props.isDisabled, direction: "up", ...incrementButtonProps, size: otherProps.size }, void 0), _jsx(StepButton, { isDisabled: props.isDisabled, direction: "down", ...decrementButtonProps, size: otherProps.size }, void 0)] }, void 0)) :
|
38
|
+
return (_jsx(TextInputBase, { ...otherProps, ref: ref, labelProps: labelProps, inputProps: inputProps, inputRef: inputRef, wrapperProps: groupProps, suffixPosition: "after", suffix: showStepper ? (_jsxs(StepperContainer, { children: [_jsx(StepButton, { isDisabled: props.isDisabled, direction: "up", ...incrementButtonProps, size: otherProps.size }, void 0), _jsx(StepButton, { isDisabled: props.isDisabled, direction: "down", ...decrementButtonProps, size: otherProps.size }, void 0)] }, void 0)) : (suffix) }, void 0));
|
39
39
|
}
|
40
40
|
/**
|
41
41
|
* NumberFields allow users to enter a number, and increment or decrement the value using stepper buttons.
|
@@ -0,0 +1,24 @@
|
|
1
|
+
/**
|
2
|
+
* @license MIT
|
3
|
+
* author: Cube Dev Team
|
4
|
+
* @cube-dev/ui-kit v0.13.6
|
5
|
+
* Released under the MIT license.
|
6
|
+
*/
|
7
|
+
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
9
|
+
import { StyledGradation, StyledGrade } from './styled';
|
10
|
+
export function Gradation(props) {
|
11
|
+
const { state, ranges, values = [] } = props;
|
12
|
+
if (!values.length) {
|
13
|
+
return null;
|
14
|
+
}
|
15
|
+
const getIsActive = (value, idx) => {
|
16
|
+
const [minIdx, maxIdx] = ranges.map((range) => state.getThumbValue(range));
|
17
|
+
return idx >= minIdx && idx <= maxIdx;
|
18
|
+
};
|
19
|
+
return (_jsx(StyledGradation, { children: values.map((value, idx) => (_jsx(StyledGrade, { mods: {
|
20
|
+
active: getIsActive(value, idx),
|
21
|
+
}, children: value }, value))) }, void 0));
|
22
|
+
}
|
23
|
+
|
24
|
+
|
@@ -0,0 +1,34 @@
|
|
1
|
+
/**
|
2
|
+
* @license MIT
|
3
|
+
* author: Cube Dev Team
|
4
|
+
* @cube-dev/ui-kit v0.13.6
|
5
|
+
* Released under the MIT license.
|
6
|
+
*/
|
7
|
+
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
9
|
+
import { useCallback } from 'react';
|
10
|
+
import { Flow, NumberInput } from '../../../';
|
11
|
+
function calculateWidth(max, hasSuffix) {
|
12
|
+
if (typeof max === 'undefined') {
|
13
|
+
return undefined;
|
14
|
+
}
|
15
|
+
const value = String(max).length;
|
16
|
+
// for 2 digit values 1.6 is better with suffix
|
17
|
+
const suffixWidth = value > 2 ? 1.6 : 1.75;
|
18
|
+
const charWidth = hasSuffix ? suffixWidth : 2;
|
19
|
+
return `${value * charWidth}x`;
|
20
|
+
}
|
21
|
+
export function RangeInput(props) {
|
22
|
+
const { state, index, suffix, min, max, ...otherProps } = props;
|
23
|
+
const value = state.values[index];
|
24
|
+
const width = calculateWidth(max, !!suffix);
|
25
|
+
const onChange = useCallback((value) => {
|
26
|
+
state.setThumbValue(index, value);
|
27
|
+
}, [index, state]);
|
28
|
+
const maxLength = typeof max !== 'undefined' ? String(max).length : undefined;
|
29
|
+
return (_jsx(NumberInput, { ...otherProps, hideStepper: true, size: "small", inputStyles: {
|
30
|
+
width,
|
31
|
+
}, suffix: suffix && _jsx(Flow, { padding: "1.5x right", children: suffix }, void 0), value: value, minValue: state.getThumbMinValue(index), maxValue: state.getThumbMaxValue(index), maxLength: maxLength, onChange: onChange }, void 0));
|
32
|
+
}
|
33
|
+
|
34
|
+
|
@@ -0,0 +1,95 @@
|
|
1
|
+
/**
|
2
|
+
* @license MIT
|
3
|
+
* author: Cube Dev Team
|
4
|
+
* @cube-dev/ui-kit v0.13.6
|
5
|
+
* Released under the MIT license.
|
6
|
+
*/
|
7
|
+
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
9
|
+
import { forwardRef, useRef } from 'react';
|
10
|
+
import { useSlider } from '@react-aria/slider';
|
11
|
+
import { useSliderState } from '@react-stately/slider';
|
12
|
+
import { FieldWrapper } from '../../forms/FieldWrapper';
|
13
|
+
import { extractStyles, OUTER_STYLES, } from '../../../tasty';
|
14
|
+
import { Slide } from './Slide';
|
15
|
+
import { Gradation } from './Gradation';
|
16
|
+
import { Thumb } from './Thumb';
|
17
|
+
import { RangeInput } from './RangeInput';
|
18
|
+
import { StyledControls, StyledSlider, StyledContent } from './styled';
|
19
|
+
import { getMinMaxValue, getRanges, getValidValue, } from './helpers';
|
20
|
+
function RangeSlider(props, ref) {
|
21
|
+
let { labelPosition, label, extra, styles, isRequired, validationState, message, description, requiredMark, labelSuffix, labelStyles, necessityIndicator, defaultValue, value, gradation, step = 1, isDisabled, orientation = 'horizontal', showInput, inputStyles, inputSuffix, minValue, maxValue, onChange, onChangeEnd, ...otherProps } = props;
|
22
|
+
const [min, max] = getMinMaxValue(minValue, maxValue, value || defaultValue);
|
23
|
+
const ranges = getRanges(defaultValue || value || [0, 1]);
|
24
|
+
const isSingle = ranges.length <= 1;
|
25
|
+
const trackRef = useRef(null);
|
26
|
+
const inputRef = useRef(null);
|
27
|
+
const numberFormatter = new Intl.NumberFormat();
|
28
|
+
const baseProps = {
|
29
|
+
step,
|
30
|
+
orientation,
|
31
|
+
isDisabled,
|
32
|
+
minValue: min,
|
33
|
+
maxValue: max,
|
34
|
+
value: getValidValue(value, min, max),
|
35
|
+
defaultValue: getValidValue(defaultValue, min, max),
|
36
|
+
onChange(range) {
|
37
|
+
if (onChange) {
|
38
|
+
onChange(Array.isArray(range) ? range : [range]);
|
39
|
+
}
|
40
|
+
},
|
41
|
+
onChangeEnd(range) {
|
42
|
+
if (onChangeEnd) {
|
43
|
+
onChangeEnd(Array.isArray(range) ? range : [range]);
|
44
|
+
}
|
45
|
+
},
|
46
|
+
};
|
47
|
+
const state = useSliderState({
|
48
|
+
...props,
|
49
|
+
...baseProps,
|
50
|
+
numberFormatter,
|
51
|
+
});
|
52
|
+
const { groupProps, trackProps, labelProps } = useSlider({
|
53
|
+
...props,
|
54
|
+
...baseProps,
|
55
|
+
}, state, trackRef);
|
56
|
+
const inputProps = {
|
57
|
+
step,
|
58
|
+
state,
|
59
|
+
isDisabled,
|
60
|
+
suffix: inputSuffix,
|
61
|
+
styles: inputStyles,
|
62
|
+
min: baseProps.minValue,
|
63
|
+
max: baseProps.maxValue,
|
64
|
+
};
|
65
|
+
const sliderField = (_jsxs(StyledSlider, { ...groupProps, mods: {
|
66
|
+
sideLabel: labelPosition === 'side',
|
67
|
+
inputs: showInput,
|
68
|
+
}, children: [!isSingle && showInput && _jsx(RangeInput, { index: 0, ...inputProps }, void 0), _jsx(StyledContent, { children: _jsxs(StyledControls, { ...trackProps, ref: trackRef, children: [_jsx(Slide, { state: state, ranges: ranges, isSingle: isSingle, isDisabled: isDisabled }, void 0), _jsx(Gradation, { state: state, ranges: ranges, values: gradation }, void 0), ranges.map((thumb) => (_jsx(Thumb, { index: thumb, state: state, inputRef: inputRef, trackRef: trackRef, isDisabled: isDisabled, defaultValue: baseProps.defaultValue && baseProps.defaultValue[thumb] }, thumb)))] }, void 0) }, void 0), showInput && _jsx(RangeInput, { index: 1, ...inputProps }, void 0)] }, void 0));
|
69
|
+
styles = extractStyles(otherProps, OUTER_STYLES, styles);
|
70
|
+
return (_jsx(FieldWrapper, { ...{
|
71
|
+
labelPosition,
|
72
|
+
label,
|
73
|
+
extra,
|
74
|
+
styles,
|
75
|
+
isRequired,
|
76
|
+
labelStyles,
|
77
|
+
necessityIndicator,
|
78
|
+
labelProps,
|
79
|
+
isDisabled,
|
80
|
+
validationState,
|
81
|
+
message,
|
82
|
+
description,
|
83
|
+
requiredMark,
|
84
|
+
labelSuffix,
|
85
|
+
Component: sliderField,
|
86
|
+
ref: ref,
|
87
|
+
} }, void 0));
|
88
|
+
}
|
89
|
+
const _RangeSlider = forwardRef(RangeSlider);
|
90
|
+
const __RangeSlider = Object.assign(_RangeSlider, {
|
91
|
+
cubeInputType: 'CheckboxGroup',
|
92
|
+
});
|
93
|
+
export { __RangeSlider as RangeSlider };
|
94
|
+
|
95
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
/**
|
2
|
+
* @license MIT
|
3
|
+
* author: Cube Dev Team
|
4
|
+
* @cube-dev/ui-kit v0.13.6
|
5
|
+
* Released under the MIT license.
|
6
|
+
*/
|
7
|
+
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
9
|
+
import { useMemo } from 'react';
|
10
|
+
import { StyledSlide, StyledSlideTrack } from './styled';
|
11
|
+
export function Slide(props) {
|
12
|
+
const { ranges, state, isDisabled, isSingle } = props;
|
13
|
+
const style = {};
|
14
|
+
const mods = useMemo(() => ({
|
15
|
+
single: isSingle,
|
16
|
+
disabled: isDisabled,
|
17
|
+
}), [isDisabled, isSingle]);
|
18
|
+
ranges.forEach((rangeIndex) => {
|
19
|
+
style[`--thumb-${rangeIndex}-value`] = state.getThumbPercent(rangeIndex);
|
20
|
+
});
|
21
|
+
return (_jsx(StyledSlide, { mods: mods, children: _jsx(StyledSlideTrack, { style: style, mods: mods }, void 0) }, void 0));
|
22
|
+
}
|
23
|
+
|
24
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
/**
|
2
|
+
* @license MIT
|
3
|
+
* author: Cube Dev Team
|
4
|
+
* @cube-dev/ui-kit v0.13.6
|
5
|
+
* Released under the MIT license.
|
6
|
+
*/
|
7
|
+
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
9
|
+
import { useRef } from 'react';
|
10
|
+
import { useSliderThumb } from '@react-aria/slider';
|
11
|
+
import { useHover } from '@react-aria/interactions';
|
12
|
+
import { VisuallyHidden } from '@react-aria/visually-hidden';
|
13
|
+
import { FocusRing } from '@react-aria/focus';
|
14
|
+
import { mergeProps } from '../../../utils/react';
|
15
|
+
import { StyledThumb } from './styled';
|
16
|
+
export function Thumb(props) {
|
17
|
+
const { state, isDisabled } = props;
|
18
|
+
const ref = useRef(null);
|
19
|
+
const { thumbProps, inputProps, isDragging, isFocused } = useSliderThumb({
|
20
|
+
...props,
|
21
|
+
inputRef: ref,
|
22
|
+
}, state);
|
23
|
+
const { hoverProps, isHovered } = useHover({ isDisabled });
|
24
|
+
return (_jsx(FocusRing, { within: true, children: _jsx(StyledThumb, { mods: {
|
25
|
+
hovered: isHovered,
|
26
|
+
dragged: isDragging,
|
27
|
+
focused: !isDragging && isFocused,
|
28
|
+
disabled: isDisabled,
|
29
|
+
}, ...mergeProps(thumbProps, hoverProps), role: "presentation", children: _jsx(VisuallyHidden, { children: _jsx("input", { ref: ref, ...inputProps }, void 0) }, void 0) }, void 0) }, void 0));
|
30
|
+
}
|
31
|
+
|
32
|
+
|
@@ -0,0 +1,54 @@
|
|
1
|
+
/**
|
2
|
+
* @license MIT
|
3
|
+
* author: Cube Dev Team
|
4
|
+
* @cube-dev/ui-kit v0.13.6
|
5
|
+
* Released under the MIT license.
|
6
|
+
*/
|
7
|
+
|
8
|
+
export function getRanges(value) {
|
9
|
+
if (Array.isArray(value)) {
|
10
|
+
return value.length >= 2 ? [0, 1] : [0];
|
11
|
+
}
|
12
|
+
return [0];
|
13
|
+
}
|
14
|
+
export function isNumber(val) {
|
15
|
+
return typeof val === 'number';
|
16
|
+
}
|
17
|
+
export function isValueValid(value) {
|
18
|
+
return (Array.isArray(value) &&
|
19
|
+
value.length === 2 &&
|
20
|
+
isNumber(value[0]) &&
|
21
|
+
isNumber(value[1]));
|
22
|
+
}
|
23
|
+
export function getValidValue(value, min, max) {
|
24
|
+
if (isValueValid(value)) {
|
25
|
+
// try to fix jumbled values
|
26
|
+
let minVal = Math.min(...value);
|
27
|
+
let maxVal = Math.max(...value);
|
28
|
+
// try to fix wrong min value
|
29
|
+
if (isNumber(min) && minVal < min) {
|
30
|
+
minVal = min;
|
31
|
+
}
|
32
|
+
// try to fix wrong max value
|
33
|
+
if (isNumber(max) && maxVal >= max) {
|
34
|
+
maxVal = max;
|
35
|
+
}
|
36
|
+
return [minVal, maxVal];
|
37
|
+
}
|
38
|
+
return value;
|
39
|
+
}
|
40
|
+
export function getMinMaxValue(min, max, value) {
|
41
|
+
if (isNumber(min) && isNumber(max)) {
|
42
|
+
if (isValueValid(value)) {
|
43
|
+
const minValue = Math.min(...value);
|
44
|
+
const maxValue = Math.max(...value);
|
45
|
+
// try to set min and max from value if they overflows
|
46
|
+
return [Math.min(min, max, minValue), Math.max(min, max, maxValue)];
|
47
|
+
}
|
48
|
+
// also try to fix jumbled min and max
|
49
|
+
return [Math.min(min, max), Math.max(min, max)];
|
50
|
+
}
|
51
|
+
return [min, max];
|
52
|
+
}
|
53
|
+
|
54
|
+
|
@@ -0,0 +1,110 @@
|
|
1
|
+
/**
|
2
|
+
* @license MIT
|
3
|
+
* author: Cube Dev Team
|
4
|
+
* @cube-dev/ui-kit v0.13.6
|
5
|
+
* Released under the MIT license.
|
6
|
+
*/
|
7
|
+
|
8
|
+
import { tasty } from '../../../tasty';
|
9
|
+
export const StyledThumb = tasty({
|
10
|
+
styles: {
|
11
|
+
top: '2x',
|
12
|
+
width: '2x',
|
13
|
+
height: '2x',
|
14
|
+
fill: {
|
15
|
+
'': '#purple',
|
16
|
+
hovered: '#purple-text',
|
17
|
+
dragged: '#purple',
|
18
|
+
disabled: '#dark-04',
|
19
|
+
},
|
20
|
+
cursor: 'pointer',
|
21
|
+
shadow: {
|
22
|
+
'': '0px 2px 4px #dark.2',
|
23
|
+
dragged: 'inset 0 0 0 2px #purple-text, 0px 2px 4px #dark.2',
|
24
|
+
},
|
25
|
+
radius: '50%',
|
26
|
+
border: {
|
27
|
+
'': null,
|
28
|
+
focused: '3px solid #purple-04',
|
29
|
+
},
|
30
|
+
transition: 'theme',
|
31
|
+
},
|
32
|
+
});
|
33
|
+
export const StyledSlide = tasty({
|
34
|
+
styles: {
|
35
|
+
top: '1.875x',
|
36
|
+
position: 'absolute',
|
37
|
+
fill: {
|
38
|
+
'': '#dark-05',
|
39
|
+
// disabled: '#dark-04',
|
40
|
+
},
|
41
|
+
height: '2px',
|
42
|
+
width: '100%',
|
43
|
+
radius: true,
|
44
|
+
},
|
45
|
+
});
|
46
|
+
export const StyledSlideTrack = tasty({
|
47
|
+
styles: {
|
48
|
+
position: 'absolute',
|
49
|
+
'@start-range': {
|
50
|
+
'': '@thumb-0-value',
|
51
|
+
single: '0',
|
52
|
+
},
|
53
|
+
'@end-range': {
|
54
|
+
'': '(1 - @thumb-1-value)',
|
55
|
+
single: '(1 - @thumb-0-value)',
|
56
|
+
},
|
57
|
+
left: '(@start-range * 100%)',
|
58
|
+
right: '(@end-range * 100%)',
|
59
|
+
height: '2px',
|
60
|
+
fill: {
|
61
|
+
'': '#purple',
|
62
|
+
disabled: '#dark-04',
|
63
|
+
},
|
64
|
+
radius: true,
|
65
|
+
},
|
66
|
+
});
|
67
|
+
export const StyledGradation = tasty({
|
68
|
+
styles: {},
|
69
|
+
});
|
70
|
+
export const StyledGrade = tasty({
|
71
|
+
styles: {},
|
72
|
+
});
|
73
|
+
export const StyledControls = tasty({
|
74
|
+
styles: {
|
75
|
+
position: 'relative',
|
76
|
+
width: '100% - 2x',
|
77
|
+
height: '4x',
|
78
|
+
},
|
79
|
+
});
|
80
|
+
export const StyledSlider = tasty({
|
81
|
+
as: 'section',
|
82
|
+
styles: {
|
83
|
+
position: 'relative',
|
84
|
+
display: 'flex',
|
85
|
+
gap: {
|
86
|
+
'': '0',
|
87
|
+
inputs: '1x',
|
88
|
+
},
|
89
|
+
flexDirection: {
|
90
|
+
'': 'column',
|
91
|
+
inputs: 'row',
|
92
|
+
},
|
93
|
+
alignItems: 'center',
|
94
|
+
width: '100%',
|
95
|
+
padding: {
|
96
|
+
'': '0',
|
97
|
+
sideLabel: '0.75x top',
|
98
|
+
},
|
99
|
+
},
|
100
|
+
});
|
101
|
+
export const StyledContent = tasty({
|
102
|
+
styles: {
|
103
|
+
display: 'flex',
|
104
|
+
alignItems: 'center',
|
105
|
+
flexDirection: 'column',
|
106
|
+
width: '100%',
|
107
|
+
},
|
108
|
+
});
|
109
|
+
|
110
|
+
|