@cube-dev/ui-kit 0.125.0 → 0.126.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CHANGELOG.md +19 -0
- package/dist/_internal/hooks/use-chained-callback.js +1 -1
- package/dist/_internal/hooks/use-debounced-value.js +1 -1
- package/dist/_internal/hooks/use-deprecation-warning.js +1 -1
- package/dist/_internal/hooks/use-event.js +1 -1
- package/dist/_internal/hooks/use-is-first-render.js +1 -1
- package/dist/_internal/hooks/use-sync-ref.js +1 -1
- package/dist/_internal/hooks/use-timer/timer.js +1 -1
- package/dist/_internal/hooks/use-timer/use-timer.js +1 -1
- package/dist/_internal/hooks/use-warn.js +1 -1
- package/dist/components/Block.js +1 -1
- package/dist/components/CollectionItem.js +1 -1
- package/dist/components/GlobalStyles.js +6 -6
- package/dist/components/GlobalStyles.js.map +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/Item/Item.js +1 -1
- package/dist/components/content/ItemBadge/ItemBadge.js +4 -5
- package/dist/components/content/ItemBadge/ItemBadge.js.map +1 -1
- package/dist/components/content/ItemCard/ItemCard.js +1 -1
- package/dist/components/content/Layout/GridLayout.js +1 -1
- package/dist/components/content/Layout/Layout.js +1 -1
- package/dist/components/content/Layout/LayoutBlock.js +1 -1
- package/dist/components/content/Layout/LayoutCenter.js +1 -1
- package/dist/components/content/Layout/LayoutContainer.js +1 -1
- package/dist/components/content/Layout/LayoutContent.js +1 -1
- package/dist/components/content/Layout/LayoutContext.js +1 -1
- package/dist/components/content/Layout/LayoutFlex.js +1 -1
- package/dist/components/content/Layout/LayoutFooter.js +1 -1
- package/dist/components/content/Layout/LayoutGrid.js +1 -1
- package/dist/components/content/Layout/LayoutHeader.js +2 -2
- package/dist/components/content/Layout/LayoutHeader.js.map +1 -1
- package/dist/components/content/Layout/LayoutPane.js +1 -1
- package/dist/components/content/Layout/LayoutPanel.js +3 -1
- package/dist/components/content/Layout/LayoutPanel.js.map +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 +2 -2
- package/dist/components/content/Text.js.map +1 -1
- package/dist/components/content/TextItem/TextItem.js +1 -1
- package/dist/components/content/Title.js +1 -1
- package/dist/components/content/highlightText.js +1 -1
- package/dist/components/content/use-auto-tooltip.js +1 -1
- package/dist/components/fields/Checkbox/Checkbox.js +1 -1
- package/dist/components/fields/Checkbox/CheckboxGroup.js +1 -1
- package/dist/components/fields/Checkbox/context.js +1 -1
- package/dist/components/fields/ComboBox/ComboBox.js +1 -1
- package/dist/components/fields/DatePicker/DateInput.js +1 -1
- package/dist/components/fields/DatePicker/DateInputBase.js +1 -1
- package/dist/components/fields/DatePicker/DatePicker.js +1 -1
- package/dist/components/fields/DatePicker/DatePickerButton.js +1 -1
- package/dist/components/fields/DatePicker/DatePickerElement.js +1 -1
- package/dist/components/fields/DatePicker/DatePickerInput.js +1 -1
- package/dist/components/fields/DatePicker/DatePickerSegment.js +2 -2
- package/dist/components/fields/DatePicker/DatePickerSegment.js.map +1 -1
- package/dist/components/fields/DatePicker/DateRangePicker.js +1 -1
- package/dist/components/fields/DatePicker/DateRangeSeparatedPicker.js +1 -1
- package/dist/components/fields/DatePicker/TimeInput.js +1 -1
- package/dist/components/fields/DatePicker/intl.js +1 -1
- package/dist/components/fields/DatePicker/parseDate.js +1 -1
- package/dist/components/fields/DatePicker/props.js +1 -1
- package/dist/components/fields/DatePicker/utils.js +1 -1
- package/dist/components/fields/FileInput/FileInput.js +1 -1
- package/dist/components/fields/FilterListBox/FilterListBox.js +1 -1
- package/dist/components/fields/FilterPicker/FilterPicker.js +190 -194
- package/dist/components/fields/FilterPicker/FilterPicker.js.map +1 -1
- package/dist/components/fields/Input/Input.js +1 -1
- package/dist/components/fields/ListBox/ListBox.d.ts +7 -7
- package/dist/components/fields/ListBox/ListBox.js +1 -1
- package/dist/components/fields/NumberInput/NumberInput.js +1 -1
- package/dist/components/fields/NumberInput/StepButton.js +2 -2
- package/dist/components/fields/NumberInput/StepButton.js.map +1 -1
- package/dist/components/fields/PasswordInput/PasswordInput.js +1 -1
- package/dist/components/fields/Picker/Picker.js +178 -157
- package/dist/components/fields/Picker/Picker.js.map +1 -1
- package/dist/components/fields/RadioGroup/Radio.js +3 -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/SearchInput/SearchInput.js +1 -1
- package/dist/components/fields/Select/Select.d.ts +5 -5
- package/dist/components/fields/Select/Select.js +1 -1
- package/dist/components/fields/Slider/Gradation.js +1 -1
- package/dist/components/fields/Slider/HueSlider.js +1 -1
- package/dist/components/fields/Slider/RangeSlider.js +1 -1
- package/dist/components/fields/Slider/Slider.js +1 -1
- package/dist/components/fields/Slider/SliderBase.js +1 -1
- package/dist/components/fields/Slider/SliderThumb.js +1 -1
- package/dist/components/fields/Slider/SliderTrack.js +1 -1
- package/dist/components/fields/Slider/elements.js +1 -1
- package/dist/components/fields/Slider/index.js +1 -1
- package/dist/components/fields/Switch/Switch.js +1 -1
- package/dist/components/fields/TextArea/TextArea.js +1 -1
- package/dist/components/fields/TextInput/TextInput.js +1 -1
- package/dist/components/fields/TextInput/TextInputBase.js +1 -1
- package/dist/components/fields/TextInputMapper/TextInputMapper.js +1 -1
- package/dist/components/form/FieldWrapper/FieldWrapper.js +1 -1
- package/dist/components/form/FieldWrapper/extract-field-wrapper-props.js +1 -1
- package/dist/components/form/Form/Field.js +1 -1
- package/dist/components/form/Form/Form.js +1 -1
- package/dist/components/form/Form/ResetButton/ResetButton.js +1 -1
- package/dist/components/form/Form/SubmitButton/SubmitButton.js +1 -1
- package/dist/components/form/Form/SubmitError.js +1 -1
- package/dist/components/form/Form/index.js +1 -1
- package/dist/components/form/Form/use-field/use-field-props.js +1 -1
- package/dist/components/form/Form/use-field/use-field.js +1 -1
- package/dist/components/form/Form/use-form.js +1 -1
- package/dist/components/form/Form/validation.js +1 -1
- package/dist/components/form/Label.js +1 -1
- package/dist/components/form/wrapper.js +1 -1
- package/dist/components/helpers/DisplayTransition/DisplayTransition.js +1 -1
- package/dist/components/helpers/IconSwitch/IconSwitch.js +1 -1
- package/dist/components/layout/Flex.js +1 -1
- package/dist/components/layout/Flow.js +1 -1
- package/dist/components/layout/Grid.js +1 -1
- package/dist/components/layout/Panel.js +1 -1
- package/dist/components/layout/Prefix.js +1 -1
- package/dist/components/layout/ResizablePanel.js +2 -1
- package/dist/components/layout/ResizablePanel.js.map +1 -1
- package/dist/components/layout/Space.js +1 -1
- package/dist/components/layout/Suffix.js +1 -1
- package/dist/components/navigation/Tabs/DraggableTabList.js +1 -1
- package/dist/components/navigation/Tabs/EditableTitle.js +1 -1
- package/dist/components/navigation/Tabs/TabButton.js +1 -1
- package/dist/components/navigation/Tabs/TabDropIndicator.js +1 -1
- package/dist/components/navigation/Tabs/TabPanel.js +1 -1
- package/dist/components/navigation/Tabs/TabPicker.js +1 -1
- package/dist/components/navigation/Tabs/Tabs.js +1 -1
- package/dist/components/navigation/Tabs/TabsAction.js +1 -1
- package/dist/components/navigation/Tabs/TabsContext.js +1 -1
- package/dist/components/navigation/Tabs/styled.js +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/OpenTransition.js +1 -1
- package/dist/components/overlays/Modal/Overlay.js +1 -1
- package/dist/components/overlays/Modal/Popover.js +1 -1
- package/dist/components/overlays/Modal/Tray.js +1 -1
- package/dist/components/overlays/Modal/Underlay.js +1 -1
- package/dist/components/overlays/Notifications/Notification.js +1 -1
- package/dist/components/overlays/Notifications/NotificationAction.js +1 -1
- package/dist/components/overlays/Notifications/NotificationCard.js +1 -1
- package/dist/components/overlays/Notifications/NotificationContext.js +1 -1
- package/dist/components/overlays/Notifications/NotificationItem.js +1 -1
- package/dist/components/overlays/Notifications/OverlayContainer.js +1 -1
- package/dist/components/overlays/Notifications/OverlayProvider.js +1 -1
- package/dist/components/overlays/Notifications/PersistentNotificationsList.js +1 -1
- package/dist/components/overlays/Notifications/dismissed-storage.js +1 -1
- package/dist/components/overlays/Notifications/format-relative-time.js +1 -1
- package/dist/components/overlays/Notifications/index.js +1 -1
- package/dist/components/overlays/Notifications/use-notification-state.js +1 -1
- package/dist/components/overlays/Notifications/use-notifications.js +1 -1
- package/dist/components/overlays/Notifications/use-overlay-timers.js +1 -1
- package/dist/components/overlays/Notifications/use-persistent-notifications.js +1 -1
- package/dist/components/overlays/Notifications/use-persistent-state.js +1 -1
- package/dist/components/overlays/Notifications/use-toast-state.js +1 -1
- package/dist/components/overlays/Toast/ToastItem.js +1 -1
- package/dist/components/overlays/Toast/index.js +1 -1
- package/dist/components/overlays/Toast/useProgressToast.js +1 -1
- package/dist/components/overlays/Toast/useToast.js +1 -1
- package/dist/components/overlays/Tooltip/Tooltip.js +1 -1
- package/dist/components/overlays/Tooltip/TooltipProvider.js +1 -1
- package/dist/components/overlays/Tooltip/TooltipTrigger.js +1 -1
- package/dist/components/overlays/Tooltip/context.js +1 -1
- package/dist/components/portal/Portal.js +1 -1
- package/dist/components/portal/PortalProvider.js +1 -1
- package/dist/components/portal/usePortal.js +1 -1
- package/dist/components/shared/InvalidIcon.js +1 -1
- package/dist/components/shared/ValidIcon.js +1 -1
- package/dist/components/status/LoadingAnimation/LoadingAnimation.js +18 -5
- package/dist/components/status/LoadingAnimation/LoadingAnimation.js.map +1 -1
- package/dist/components/status/Spin/Cube.js +2 -1
- package/dist/components/status/Spin/Cube.js.map +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/icons/AdjustmentsHorizontalIcon.js +1 -1
- package/dist/icons/AdjustmentsIcon.js +1 -1
- package/dist/icons/AiIcon.js +1 -1
- package/dist/icons/AreaChartIcon.js +1 -1
- package/dist/icons/BackwardIcon.js +1 -1
- package/dist/icons/BarChartIcon.js +1 -1
- package/dist/icons/BellFilledIcon.js +1 -1
- package/dist/icons/BellIcon.js +1 -1
- package/dist/icons/BooleanIcon.js +1 -1
- package/dist/icons/CalendarEditIcon.js +1 -1
- package/dist/icons/CalendarIcon.js +1 -1
- package/dist/icons/CaretDownIcon.js +1 -1
- package/dist/icons/CaretUpIcon.js +1 -1
- package/dist/icons/ChartAreaStackedIcon.js +1 -1
- package/dist/icons/ChartAreaStackedPercentageIcon.js +1 -1
- package/dist/icons/ChartBarGroupedHorizontalIcon.js +1 -1
- package/dist/icons/ChartBarGroupedIcon.js +1 -1
- package/dist/icons/ChartBarHorizontalIcon.js +1 -1
- package/dist/icons/ChartBarLineIcon.js +1 -1
- package/dist/icons/ChartBarStackedHorizontalIcon.js +1 -1
- package/dist/icons/ChartBarStackedIcon.js +1 -1
- package/dist/icons/ChartBarStackedPercentageHorizontalIcon.js +1 -1
- package/dist/icons/ChartBarStackedPercentageIcon.js +1 -1
- package/dist/icons/ChartBoxPlot2Icon.js +1 -1
- package/dist/icons/ChartBoxPlotIcon.js +1 -1
- package/dist/icons/ChartBubbleIcon.js +1 -1
- package/dist/icons/ChartDonut2Icon.js +1 -1
- package/dist/icons/ChartFunnelIcon.js +1 -1
- package/dist/icons/ChartHeatmapIcon.js +1 -1
- package/dist/icons/ChartKPIIcon.js +1 -1
- package/dist/icons/ChartPie2Icon.js +1 -1
- package/dist/icons/ChartScatterIcon.js +1 -1
- package/dist/icons/CheckCircleFilledIcon.js +1 -1
- package/dist/icons/CheckCircleIcon.js +1 -1
- package/dist/icons/CheckIcon.js +1 -1
- package/dist/icons/CircleFilledIcon.js +1 -1
- package/dist/icons/ClearIcon.js +1 -1
- package/dist/icons/CloseCircleFilledIcon.js +1 -1
- package/dist/icons/CloseCircleIcon.js +1 -1
- package/dist/icons/CloseIcon.js +1 -1
- package/dist/icons/CodeIcon.js +1 -1
- package/dist/icons/ColumnTotalIcon.js +1 -1
- package/dist/icons/CopyIcon.js +1 -1
- package/dist/icons/CountIcon.js +1 -1
- package/dist/icons/CubeIcon.js +1 -1
- package/dist/icons/CubePauseIcon.js +1 -1
- package/dist/icons/CubePlayIcon.js +1 -1
- package/dist/icons/CurrencyDollarIcon.js +1 -1
- package/dist/icons/DangerIcon.js +1 -1
- package/dist/icons/DashboardIcon.js +1 -1
- package/dist/icons/DatabaseIcon.js +1 -1
- package/dist/icons/DecimalDecreaseIcon.js +1 -1
- package/dist/icons/DecimalIncreaseIcon.js +1 -1
- package/dist/icons/DirectionIcon.js +1 -1
- package/dist/icons/DonutIcon.js +1 -1
- package/dist/icons/DownIcon.js +1 -1
- package/dist/icons/EditIcon.js +1 -1
- package/dist/icons/ExclamationCircleFilledIcon.js +1 -1
- package/dist/icons/ExclamationCircleIcon.js +1 -1
- package/dist/icons/ExclamationIcon.js +1 -1
- package/dist/icons/EyeIcon.js +1 -1
- package/dist/icons/EyeInvisibleIcon.js +1 -1
- package/dist/icons/FilterIcon.js +1 -1
- package/dist/icons/FolderFilledIcon.js +1 -1
- package/dist/icons/FolderIcon.js +1 -1
- package/dist/icons/FolderOpenFilledIcon.js +1 -1
- package/dist/icons/FolderOpenIcon.js +1 -1
- package/dist/icons/ForwardIcon.js +1 -1
- package/dist/icons/HierarchyIcon.js +1 -1
- package/dist/icons/HierarchyOpenIcon.js +1 -1
- package/dist/icons/Icon.js +1 -1
- package/dist/icons/InfoCircleIcon.js +1 -1
- package/dist/icons/InfoIcon.js +1 -1
- package/dist/icons/KeyIcon.js +1 -1
- package/dist/icons/LeftIcon.js +1 -1
- package/dist/icons/LineChartIcon.js +1 -1
- package/dist/icons/LoadingIcon.js +1 -1
- package/dist/icons/LockFilledIcon.js +1 -1
- package/dist/icons/LockIcon.js +1 -1
- package/dist/icons/MoreIcon.js +1 -1
- package/dist/icons/NotAllowedIcon.js +1 -1
- package/dist/icons/Number123Icon.js +1 -1
- package/dist/icons/NumberIcon.js +1 -1
- package/dist/icons/PauseCircleFilledIcon.js +1 -1
- package/dist/icons/PauseCircleIcon.js +1 -1
- package/dist/icons/PauseIcon.js +1 -1
- package/dist/icons/PercentageIcon.js +1 -1
- package/dist/icons/PieChartIcon.js +1 -1
- package/dist/icons/PlayCircleIcon.js +1 -1
- package/dist/icons/PlayIcon.js +1 -1
- package/dist/icons/PlusIcon.js +1 -1
- package/dist/icons/ProgressBarIcon.js +1 -1
- package/dist/icons/ReloadIcon.js +1 -1
- package/dist/icons/ReportIcon.js +1 -1
- package/dist/icons/ReturnIcon.js +1 -1
- package/dist/icons/RightIcon.js +1 -1
- package/dist/icons/RowTotalsIcon.js +1 -1
- package/dist/icons/SchemeIcon.js +1 -1
- package/dist/icons/SearchIcon.js +1 -1
- package/dist/icons/SemanticQueryIcon.js +1 -1
- package/dist/icons/SettingsIcon.js +1 -1
- package/dist/icons/ShieldFilledIcon.js +1 -1
- package/dist/icons/ShieldIcon.js +1 -1
- package/dist/icons/SlashIcon.js +1 -1
- package/dist/icons/SparklesIcon.js +1 -1
- package/dist/icons/SqlIcon.js +1 -1
- package/dist/icons/StatsIcon.js +1 -1
- package/dist/icons/StopIcon.js +1 -1
- package/dist/icons/StringIcon.js +1 -1
- package/dist/icons/SubtotalsIcon.js +1 -1
- package/dist/icons/SwitchIcon.js +1 -1
- package/dist/icons/TableIcon.js +1 -1
- package/dist/icons/ThumbsDownIcon.js +1 -1
- package/dist/icons/ThumbsUpIcon.js +1 -1
- package/dist/icons/ThunderboltCrossedIcon.js +1 -1
- package/dist/icons/ThunderboltFilledIcon.js +1 -1
- package/dist/icons/ThunderboltIcon.js +1 -1
- package/dist/icons/TimeIcon.js +1 -1
- package/dist/icons/TrashIcon.js +1 -1
- package/dist/icons/UnlockIcon.js +1 -1
- package/dist/icons/UpIcon.js +1 -1
- package/dist/icons/UserGroupIcon.js +1 -1
- package/dist/icons/UserIcon.js +1 -1
- package/dist/icons/UserLockIcon.js +1 -1
- package/dist/icons/ViewIcon.js +1 -1
- package/dist/icons/WarningFilledIcon.js +1 -1
- package/dist/icons/WarningIcon.js +1 -1
- package/dist/icons/wrap-icon.js +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/provider.js +1 -1
- package/dist/providers/TrackingProvider.js +1 -1
- package/dist/providers/navigationAdapter.default.js +1 -1
- package/dist/tokens/base.js +1 -1
- package/dist/tokens/colors.js +1 -1
- package/dist/tokens/index.js +1 -1
- package/dist/tokens/layout.js +1 -1
- package/dist/tokens/shadows.js +1 -1
- package/dist/tokens/sizes.js +1 -1
- package/dist/tokens/spacing.js +1 -1
- package/dist/tokens/typography.d.ts +0 -1
- package/dist/tokens/typography.js +1 -18
- package/dist/tokens/typography.js.map +1 -1
- package/dist/utils/ResizeSensor.js +1 -1
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/is-dev-env.js +1 -1
- package/dist/utils/modules.js +1 -1
- package/dist/utils/promise.js +1 -1
- package/dist/utils/raf.js +1 -1
- package/dist/utils/random.js +1 -1
- package/dist/utils/range.js +1 -1
- package/dist/utils/react/RenderCache.js +1 -1
- package/dist/utils/react/Slots.js +1 -1
- package/dist/utils/react/chain.js +1 -1
- package/dist/utils/react/forwardRefWithGenerics.js +1 -1
- package/dist/utils/react/index.js +1 -1
- package/dist/utils/react/interactions.js +1 -1
- package/dist/utils/react/isTextOnly.js +1 -1
- package/dist/utils/react/mapProps.js +1 -1
- package/dist/utils/react/mergeProps.js +1 -1
- package/dist/utils/react/nullableValue.js +1 -1
- package/dist/utils/react/resolveIcon.js +1 -1
- package/dist/utils/react/sharedStore.js +1 -1
- package/dist/utils/react/useCombinedRefs.js +1 -1
- package/dist/utils/react/useControlledFocusVisible.js +1 -1
- package/dist/utils/react/useEventBus.js +1 -1
- package/dist/utils/react/useId.js +1 -1
- package/dist/utils/react/useIsDarwin.js +1 -1
- package/dist/utils/react/useKeySymbols.js +1 -1
- package/dist/utils/react/useLayoutEffect.js +1 -1
- package/dist/utils/react/useLocalStorage.js +1 -1
- package/dist/utils/react/useMergeStyles.js +1 -1
- package/dist/utils/react/useQaProps.js +1 -1
- package/dist/utils/react/useViewportSize.js +1 -1
- package/dist/utils/react/wrapNodeIfPlain.js +1 -1
- package/dist/utils/selection.d.ts +12 -0
- package/dist/utils/selection.js +19 -0
- package/dist/utils/selection.js.map +1 -0
- 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/CreateComponent.md +1 -1
- package/docs/Usage.md +1 -1
- package/docs/tasty/configuration.md +61 -0
- package/docs/tasty/design-system.md +17 -0
- package/docs/tasty/dsl.md +91 -2
- package/docs/tasty/runtime.md +88 -0
- package/docs/tasty/ssr.md +2 -0
- package/docs/tasty/styles.md +9 -6
- package/docs/tasty/tasty-static.md +2 -0
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.126.0 | Cube Dev Team */
|
|
2
2
|
import { mergeProps as mergeProps$1 } from "../../../utils/react/mergeProps.js";
|
|
3
3
|
import { DatePickerSegment } from "./DatePickerSegment.js";
|
|
4
4
|
import { formatSegments } from "./utils.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.126.0 | Cube Dev Team */
|
|
2
2
|
import { tasty } from "@tenphi/tasty";
|
|
3
3
|
import { useRef } from "react";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -29,7 +29,7 @@ const EditableSegmentElement = tasty({
|
|
|
29
29
|
":focus": "#primary"
|
|
30
30
|
},
|
|
31
31
|
radius: ".25x",
|
|
32
|
-
Placeholder: { opacity: "
|
|
32
|
+
Placeholder: { opacity: "var(--disabled-opacity)" }
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
35
|
function DatePickerSegment({ segment, state, ...otherProps }) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePickerSegment.js","names":[],"sources":["../../../../src/components/fields/DatePicker/DatePickerSegment.tsx"],"sourcesContent":["import { tasty } from '@tenphi/tasty';\nimport { useRef } from 'react';\nimport { DateValue, useDateSegment } from 'react-aria';\nimport { DateFieldState, DateSegment } from 'react-stately';\n\nimport { DateFieldBase } from './types';\n\ninterface DatePickerSegmentProps extends DateFieldBase<DateValue> {\n segment: DateSegment;\n state: DateFieldState;\n}\n\ninterface LiteralSegmentProps {\n segment: DateSegment;\n}\n\nconst LiteralSegmentElement = tasty({\n qa: 'LiteralSegment',\n as: 'span',\n 'aria-hidden': 'true',\n styles: {},\n});\n\nconst EditableSegmentElement = tasty({\n qa: 'EditableSegment',\n styles: {\n padding: '0 1bw',\n fontVariantNumeric: 'tabular-nums lining-nums',\n textAlign: 'right',\n font: 'monospace',\n border: 0,\n outline: 0,\n color: {\n '': 'inherit',\n ':focus': '#white',\n },\n fill: {\n '': '#clear',\n ':focus': '#primary',\n },\n radius: '.25x',\n\n Placeholder: {\n opacity: '
|
|
1
|
+
{"version":3,"file":"DatePickerSegment.js","names":[],"sources":["../../../../src/components/fields/DatePicker/DatePickerSegment.tsx"],"sourcesContent":["import { tasty } from '@tenphi/tasty';\nimport { useRef } from 'react';\nimport { DateValue, useDateSegment } from 'react-aria';\nimport { DateFieldState, DateSegment } from 'react-stately';\n\nimport { DateFieldBase } from './types';\n\ninterface DatePickerSegmentProps extends DateFieldBase<DateValue> {\n segment: DateSegment;\n state: DateFieldState;\n}\n\ninterface LiteralSegmentProps {\n segment: DateSegment;\n}\n\nconst LiteralSegmentElement = tasty({\n qa: 'LiteralSegment',\n as: 'span',\n 'aria-hidden': 'true',\n styles: {},\n});\n\nconst EditableSegmentElement = tasty({\n qa: 'EditableSegment',\n styles: {\n padding: '0 1bw',\n fontVariantNumeric: 'tabular-nums lining-nums',\n textAlign: 'right',\n font: 'monospace',\n border: 0,\n outline: 0,\n color: {\n '': 'inherit',\n ':focus': '#white',\n },\n fill: {\n '': '#clear',\n ':focus': '#primary',\n },\n radius: '.25x',\n\n Placeholder: {\n opacity: 'var(--disabled-opacity)',\n },\n },\n});\n\nexport function DatePickerSegment({\n segment,\n state,\n ...otherProps\n}: DatePickerSegmentProps) {\n switch (segment.type) {\n // A separator, e.g. punctuation\n case 'literal':\n return <LiteralSegment segment={segment} />;\n\n // Editable segment\n default:\n return (\n <EditableSegment segment={segment} state={state} {...otherProps} />\n );\n }\n}\n\nfunction LiteralSegment({ segment }: LiteralSegmentProps) {\n return (\n <LiteralSegmentElement\n data-type={segment.type === 'literal' ? undefined : segment.type}\n >\n {segment.text}\n </LiteralSegmentElement>\n );\n}\n\nfunction EditableSegment({ segment, state }: DatePickerSegmentProps) {\n let ref = useRef(null);\n let { segmentProps } = useDateSegment(segment, state, ref);\n return (\n <EditableSegmentElement\n {...segmentProps}\n ref={ref}\n mods={{\n placeholder: segment.isPlaceholder,\n 'read-only': !segment.isEditable,\n }}\n style={{\n ...segmentProps.style,\n minWidth:\n segment.maxValue != null\n ? `calc(${String(segment.maxValue).length + 'ch'})`\n : undefined,\n }}\n data-testid={segment.type}\n >\n {segment.isPlaceholder ? (\n <span data-element=\"Placeholder\" aria-hidden=\"true\">\n {segment.placeholder}\n </span>\n ) : (\n segment.text\n )}\n </EditableSegmentElement>\n );\n}\n"],"mappings":";;;;;;;AAgBA,MAAM,wBAAwB,MAAM;CAClC,IAAI;CACJ,IAAI;CACJ,eAAe;CACf,QAAQ,EAAE;CACX,CAAC;AAEF,MAAM,yBAAyB,MAAM;CACnC,IAAI;CACJ,QAAQ;EACN,SAAS;EACT,oBAAoB;EACpB,WAAW;EACX,MAAM;EACN,QAAQ;EACR,SAAS;EACT,OAAO;GACL,IAAI;GACJ,UAAU;GACX;EACD,MAAM;GACJ,IAAI;GACJ,UAAU;GACX;EACD,QAAQ;EAER,aAAa,EACX,SAAS,2BACV;EACF;CACF,CAAC;AAEF,SAAgB,kBAAkB,EAChC,SACA,OACA,GAAG,cACsB;AACzB,SAAQ,QAAQ,MAAhB;EAEE,KAAK,UACH,QAAO,oBAAC,kBAAwB,UAAW;EAG7C,QACE,QACE,oBAAC;GAAyB;GAAgB;GAAO,GAAI;IAAc;;;AAK3E,SAAS,eAAe,EAAE,WAAgC;AACxD,QACE,oBAAC;EACC,aAAW,QAAQ,SAAS,YAAY,SAAY,QAAQ;YAE3D,QAAQ;GACa;;AAI5B,SAAS,gBAAgB,EAAE,SAAS,SAAiC;CACnE,IAAI,MAAM,OAAO,KAAK;CACtB,IAAI,EAAE,iBAAiB,eAAe,SAAS,OAAO,IAAI;AAC1D,QACE,oBAAC;EACC,GAAI;EACC;EACL,MAAM;GACJ,aAAa,QAAQ;GACrB,aAAa,CAAC,QAAQ;GACvB;EACD,OAAO;GACL,GAAG,aAAa;GAChB,UACE,QAAQ,YAAY,OAChB,QAAQ,OAAO,QAAQ,SAAS,CAAC,SAAS,KAAK,KAC/C;GACP;EACD,eAAa,QAAQ;YAEpB,QAAQ,gBACP,oBAAC;GAAK,gBAAa;GAAc,eAAY;aAC1C,QAAQ;IACJ,GAEP,QAAQ;GAEa"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.126.0 | 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 { useProviderProps } from "../../../provider.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.126.0 | 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 { useProviderProps } from "../../../provider.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.126.0 | 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 { useProviderProps } from "../../../provider.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.126.0 | Cube Dev Team */
|
|
2
2
|
import { useImperativeHandle, useRef } from "react";
|
|
3
3
|
import { createDOMRef } from "@react-spectrum/utils";
|
|
4
4
|
import { createFocusManager } from "@react-aria/focus";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.126.0 | Cube Dev Team */
|
|
2
2
|
import { extractStyles } from "../../../utils/styles.js";
|
|
3
3
|
import { useCombinedRefs } from "../../../utils/react/useCombinedRefs.js";
|
|
4
4
|
import { useProviderProps } from "../../../provider.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.126.0 | 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 { useCombinedRefs } from "../../../utils/react/useCombinedRefs.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.126.0 | Cube Dev Team */
|
|
2
2
|
import { extractStyles } from "../../../utils/styles.js";
|
|
3
3
|
import { useEventBus } from "../../../utils/react/useEventBus.js";
|
|
4
4
|
import { useEvent } from "../../../_internal/hooks/use-event.js";
|
|
@@ -17,9 +17,10 @@ import { wrapWithField } from "../../form/wrapper.js";
|
|
|
17
17
|
import { Dialog } from "../../overlays/Dialog/Dialog.js";
|
|
18
18
|
import { DialogTrigger } from "../../overlays/Dialog/DialogTrigger.js";
|
|
19
19
|
import { ListBox } from "../ListBox/ListBox.js";
|
|
20
|
+
import { processSelectionArray } from "../../../utils/selection.js";
|
|
20
21
|
import { FilterListBox } from "../FilterListBox/FilterListBox.js";
|
|
21
22
|
import { BASE_STYLES, COLOR_STYLES, OUTER_STYLES, filterBaseProps, tasty } from "@tenphi/tasty";
|
|
22
|
-
import { forwardRef,
|
|
23
|
+
import { forwardRef, useEffect, useMemo, useRef, useState } from "react";
|
|
23
24
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
24
25
|
import { FocusScope, useKeyboard } from "react-aria";
|
|
25
26
|
import { Section, useListState } from "react-stately";
|
|
@@ -64,11 +65,16 @@ const FilterPicker = forwardRef(function FilterPicker(props, ref) {
|
|
|
64
65
|
key: ["filterpicker-checkable-single-mode"],
|
|
65
66
|
args: ["CubeUIKit: isCheckable=false is not recommended in single selection mode as it may confuse users about selection behavior."]
|
|
66
67
|
});
|
|
68
|
+
useWarn(sortSelectedToTopExplicit && sortSelectedToTop && !items, {
|
|
69
|
+
key: ["filterpicker-sort-selected-to-top-children"],
|
|
70
|
+
args: ["FilterPicker: sortSelectedToTop only works with the items prop. Sorting will be skipped when using JSX children."]
|
|
71
|
+
});
|
|
67
72
|
const [internalSelectedKey, setInternalSelectedKey] = useState(defaultSelectedKey ?? null);
|
|
68
73
|
const [internalSelectedKeys, setInternalSelectedKeys] = useState(defaultSelectedKeys ?? []);
|
|
69
74
|
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
|
|
70
75
|
const cachedItemsOrder = useRef(null);
|
|
71
76
|
const triggerRef = useRef(null);
|
|
77
|
+
const triggerWidthRef = useRef(void 0);
|
|
72
78
|
useEffect(() => {
|
|
73
79
|
cachedItemsOrder.current = null;
|
|
74
80
|
}, [items]);
|
|
@@ -81,66 +87,53 @@ const FilterPicker = forwardRef(function FilterPicker(props, ref) {
|
|
|
81
87
|
items,
|
|
82
88
|
selectionMode: "none"
|
|
83
89
|
});
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
90
|
+
const { labelMap, keyMap } = useMemo(() => {
|
|
91
|
+
const lm = /* @__PURE__ */ new Map();
|
|
92
|
+
const km = /* @__PURE__ */ new Map();
|
|
93
|
+
const traverse = (nodes) => {
|
|
94
|
+
for (const node of nodes) if (node.type === "item") {
|
|
95
|
+
const strKey = String(node.key);
|
|
96
|
+
lm.set(strKey, node.textValue || strKey);
|
|
97
|
+
km.set(strKey, node.key);
|
|
98
|
+
} else if (node.childNodes) traverse(node.childNodes);
|
|
99
|
+
};
|
|
100
|
+
traverse(localCollectionState.collection);
|
|
101
|
+
return {
|
|
102
|
+
labelMap: lm,
|
|
103
|
+
keyMap: km
|
|
104
|
+
};
|
|
88
105
|
}, [localCollectionState.collection]);
|
|
89
106
|
const mappedSelectedKey = useMemo(() => {
|
|
90
|
-
if (selectionMode !== "single") return null;
|
|
91
|
-
|
|
107
|
+
if (selectionMode !== "single" || effectiveSelectedKey == null) return null;
|
|
108
|
+
const strKey = String(effectiveSelectedKey);
|
|
109
|
+
return keyMap.get(strKey) ?? effectiveSelectedKey;
|
|
92
110
|
}, [
|
|
93
111
|
selectionMode,
|
|
94
112
|
effectiveSelectedKey,
|
|
95
|
-
|
|
113
|
+
keyMap
|
|
96
114
|
]);
|
|
97
115
|
const mappedSelectedKeys = useMemo(() => {
|
|
98
116
|
if (selectionMode !== "multiple") return void 0;
|
|
99
117
|
if (effectiveSelectedKeys === "all") return "all";
|
|
100
|
-
if (Array.isArray(effectiveSelectedKeys)) return effectiveSelectedKeys.map((k) =>
|
|
118
|
+
if (Array.isArray(effectiveSelectedKeys)) return effectiveSelectedKeys.map((k) => {
|
|
119
|
+
const strKey = String(k);
|
|
120
|
+
return keyMap.get(strKey) ?? k;
|
|
121
|
+
});
|
|
101
122
|
return effectiveSelectedKeys;
|
|
102
123
|
}, [
|
|
103
124
|
selectionMode,
|
|
104
125
|
effectiveSelectedKeys,
|
|
105
|
-
|
|
126
|
+
keyMap
|
|
127
|
+
]);
|
|
128
|
+
const selectedLabels = useMemo(() => {
|
|
129
|
+
if (selectionMode === "multiple" && effectiveSelectedKeys === "all") return Array.from(labelMap.values());
|
|
130
|
+
return (selectionMode === "multiple" && effectiveSelectedKeys !== "all" ? (effectiveSelectedKeys || []).map(String) : effectiveSelectedKey != null ? [String(effectiveSelectedKey)] : []).map((k) => labelMap.get(k) ?? k);
|
|
131
|
+
}, [
|
|
132
|
+
selectionMode,
|
|
133
|
+
effectiveSelectedKey,
|
|
134
|
+
effectiveSelectedKeys,
|
|
135
|
+
labelMap
|
|
106
136
|
]);
|
|
107
|
-
const processSelectionArray = (iterable) => {
|
|
108
|
-
const resultSet = /* @__PURE__ */ new Set();
|
|
109
|
-
for (const key of iterable) {
|
|
110
|
-
const nKey = String(key);
|
|
111
|
-
if (resultSet.has(nKey)) resultSet.delete(nKey);
|
|
112
|
-
else resultSet.add(nKey);
|
|
113
|
-
}
|
|
114
|
-
return Array.from(resultSet);
|
|
115
|
-
};
|
|
116
|
-
const getSelectedLabels = () => {
|
|
117
|
-
const collection = localCollectionState.collection;
|
|
118
|
-
const collectAllLabels = () => {
|
|
119
|
-
const allLabels = [];
|
|
120
|
-
const traverse = (nodes) => {
|
|
121
|
-
for (const node of nodes) if (node.type === "item") allLabels.push(node.textValue || String(node.key));
|
|
122
|
-
else if (node.childNodes) traverse(node.childNodes);
|
|
123
|
-
};
|
|
124
|
-
traverse(collection);
|
|
125
|
-
return allLabels;
|
|
126
|
-
};
|
|
127
|
-
if (selectionMode === "multiple" && effectiveSelectedKeys === "all") return collectAllLabels();
|
|
128
|
-
const selectedSet = new Set(selectionMode === "multiple" && effectiveSelectedKeys !== "all" ? (effectiveSelectedKeys || []).map((k) => String(k)) : effectiveSelectedKey != null ? [String(effectiveSelectedKey)] : []);
|
|
129
|
-
const labels = [];
|
|
130
|
-
const processedKeys = /* @__PURE__ */ new Set();
|
|
131
|
-
selectedSet.forEach((key) => {
|
|
132
|
-
const item = collection.getItem(key);
|
|
133
|
-
if (item) {
|
|
134
|
-
labels.push(item.textValue || String(item.key));
|
|
135
|
-
processedKeys.add(String(item.key));
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
(selectionMode === "multiple" && effectiveSelectedKeys !== "all" ? (effectiveSelectedKeys || []).map(String) : effectiveSelectedKey != null ? [String(effectiveSelectedKey)] : []).forEach((key) => {
|
|
139
|
-
if (!processedKeys.has(String(key))) labels.push(key);
|
|
140
|
-
});
|
|
141
|
-
return labels;
|
|
142
|
-
};
|
|
143
|
-
const selectedLabels = getSelectedLabels();
|
|
144
137
|
const hasSelection = selectedLabels.length > 0;
|
|
145
138
|
const latestSelectionRef = useRef({
|
|
146
139
|
single: effectiveSelectedKey != null ? String(effectiveSelectedKey) : null,
|
|
@@ -157,20 +150,73 @@ const FilterPicker = forwardRef(function FilterPicker(props, ref) {
|
|
|
157
150
|
multiple: []
|
|
158
151
|
});
|
|
159
152
|
useEffect(() => {
|
|
160
|
-
selectionsWhenClosed.current = {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
return children;
|
|
153
|
+
if (!isPopoverOpen) selectionsWhenClosed.current = {
|
|
154
|
+
single: effectiveSelectedKey != null ? String(effectiveSelectedKey) : null,
|
|
155
|
+
multiple: effectiveSelectedKeys === "all" ? "all" : (effectiveSelectedKeys ?? []).map(String)
|
|
156
|
+
};
|
|
165
157
|
}, [
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
158
|
+
effectiveSelectedKey,
|
|
159
|
+
effectiveSelectedKeys,
|
|
160
|
+
isPopoverOpen
|
|
161
|
+
]);
|
|
162
|
+
const handleOpenChange = useEvent((isOpen) => {
|
|
163
|
+
if (isOpen === isPopoverOpen) return;
|
|
164
|
+
if (isOpen) triggerWidthRef.current = triggerRef?.current?.UNSAFE_getDOMNode()?.offsetWidth;
|
|
165
|
+
setIsPopoverOpen(isOpen);
|
|
166
|
+
if (!isOpen) {
|
|
167
|
+
selectionsWhenClosed.current = { ...latestSelectionRef.current };
|
|
168
|
+
cachedItemsOrder.current = null;
|
|
169
|
+
}
|
|
170
|
+
onOpenChange?.(isOpen);
|
|
171
|
+
});
|
|
172
|
+
useEffect(() => {
|
|
173
|
+
return on("popover:open", (data) => {
|
|
174
|
+
if (data.menuId !== filterPickerId && isPopoverOpen) handleOpenChange(false);
|
|
175
|
+
});
|
|
176
|
+
}, [
|
|
177
|
+
on,
|
|
178
|
+
filterPickerId,
|
|
179
|
+
isPopoverOpen,
|
|
180
|
+
handleOpenChange
|
|
181
|
+
]);
|
|
182
|
+
useEffect(() => {
|
|
183
|
+
if (isPopoverOpen) emit("popover:open", { menuId: filterPickerId });
|
|
184
|
+
}, [
|
|
185
|
+
isPopoverOpen,
|
|
186
|
+
emit,
|
|
187
|
+
filterPickerId
|
|
170
188
|
]);
|
|
171
|
-
const
|
|
189
|
+
const [shouldUpdatePosition, setShouldUpdatePosition] = useState(true);
|
|
190
|
+
useEffect(() => {
|
|
191
|
+
if (isPopoverOpen) {
|
|
192
|
+
setShouldUpdatePosition(true);
|
|
193
|
+
const timerId = window.setTimeout(() => setShouldUpdatePosition(false), 160);
|
|
194
|
+
return () => window.clearTimeout(timerId);
|
|
195
|
+
} else setShouldUpdatePosition(true);
|
|
196
|
+
}, [isPopoverOpen]);
|
|
197
|
+
const { keyboardProps } = useKeyboard({ onKeyDown: (e) => {
|
|
198
|
+
if ((e.key === "ArrowUp" || e.key === "ArrowDown") && !isPopoverOpen) {
|
|
199
|
+
e.preventDefault();
|
|
200
|
+
handleOpenChange(true);
|
|
201
|
+
}
|
|
202
|
+
} });
|
|
203
|
+
const clearValue = useEvent(() => {
|
|
204
|
+
if (selectionMode === "multiple") {
|
|
205
|
+
if (!isControlledMultiple) setInternalSelectedKeys([]);
|
|
206
|
+
onSelectionChange?.([]);
|
|
207
|
+
} else {
|
|
208
|
+
if (!isControlledSingle) setInternalSelectedKey(null);
|
|
209
|
+
onSelectionChange?.(null);
|
|
210
|
+
}
|
|
211
|
+
handleOpenChange(false);
|
|
212
|
+
triggerRef?.current?.focus?.();
|
|
213
|
+
props.onClear?.();
|
|
214
|
+
return false;
|
|
215
|
+
});
|
|
216
|
+
const finalItems = useMemo(() => {
|
|
172
217
|
if (!items) return items;
|
|
173
218
|
if (!sortSelectedToTop) return items;
|
|
219
|
+
if (!isPopoverOpen) return items;
|
|
174
220
|
if (cachedItemsOrder.current) return cachedItemsOrder.current;
|
|
175
221
|
const selectedSet = /* @__PURE__ */ new Set();
|
|
176
222
|
const addSelected = (key) => {
|
|
@@ -207,18 +253,15 @@ const FilterPicker = forwardRef(function FilterPicker(props, ref) {
|
|
|
207
253
|
return [...selectedArr, ...unselectedArr];
|
|
208
254
|
};
|
|
209
255
|
const sorted = sortArray(Array.isArray(items) ? items : Array.from(items));
|
|
210
|
-
|
|
256
|
+
cachedItemsOrder.current = sorted;
|
|
211
257
|
return sorted;
|
|
212
258
|
}, [
|
|
213
259
|
items,
|
|
214
260
|
sortSelectedToTop,
|
|
215
261
|
selectionMode,
|
|
216
|
-
isPopoverOpen
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
])();
|
|
220
|
-
const finalChildren = getSortedChildren();
|
|
221
|
-
const renderTriggerContent = () => {
|
|
262
|
+
isPopoverOpen
|
|
263
|
+
]);
|
|
264
|
+
const triggerContent = useMemo(() => {
|
|
222
265
|
if (typeof renderSummary === "function") {
|
|
223
266
|
if (selectionMode === "single") return renderSummary({
|
|
224
267
|
selectedLabel: selectedLabels[0],
|
|
@@ -233,128 +276,100 @@ const FilterPicker = forwardRef(function FilterPicker(props, ref) {
|
|
|
233
276
|
selectionMode: "multiple"
|
|
234
277
|
});
|
|
235
278
|
} else if (renderSummary === false) return null;
|
|
236
|
-
let content = "";
|
|
237
279
|
if (!hasSelection) return /* @__PURE__ */ jsx(_Text.Placeholder, { children: placeholder });
|
|
238
|
-
else if (selectionMode === "single")
|
|
239
|
-
else if (effectiveSelectedKeys === "all")
|
|
240
|
-
else
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
onOpenChange?.(state.isOpen);
|
|
271
|
-
}
|
|
272
|
-
}, [
|
|
273
|
-
state.isOpen,
|
|
274
|
-
isPopoverOpen,
|
|
275
|
-
onOpenChange
|
|
276
|
-
]);
|
|
277
|
-
const { keyboardProps } = useKeyboard({ onKeyDown: (e) => {
|
|
278
|
-
if ((e.key === "ArrowUp" || e.key === "ArrowDown") && !state.isOpen) {
|
|
279
|
-
e.preventDefault();
|
|
280
|
-
state.open();
|
|
281
|
-
}
|
|
282
|
-
} });
|
|
283
|
-
useEffect(() => {
|
|
284
|
-
if (state.isOpen) {
|
|
285
|
-
setShouldUpdatePosition(true);
|
|
286
|
-
const id = window.setTimeout(() => setShouldUpdatePosition(false), 160);
|
|
287
|
-
return () => window.clearTimeout(id);
|
|
288
|
-
} else setShouldUpdatePosition(true);
|
|
289
|
-
}, [state.isOpen]);
|
|
290
|
-
let showClearButton = isClearable && hasSelection && !isDisabled && !props.isReadOnly;
|
|
291
|
-
let clearValue = useEvent(() => {
|
|
292
|
-
if (selectionMode === "multiple") {
|
|
293
|
-
if (!isControlledMultiple) setInternalSelectedKeys([]);
|
|
294
|
-
onSelectionChange?.([]);
|
|
295
|
-
} else {
|
|
296
|
-
if (!isControlledSingle) setInternalSelectedKey(null);
|
|
297
|
-
onSelectionChange?.(null);
|
|
298
|
-
}
|
|
299
|
-
if (state.isOpen) state.close();
|
|
300
|
-
triggerRef?.current?.focus?.();
|
|
301
|
-
props.onClear?.();
|
|
302
|
-
return false;
|
|
303
|
-
});
|
|
304
|
-
return /* @__PURE__ */ jsx(_ItemButton, {
|
|
305
|
-
ref: triggerRef,
|
|
306
|
-
"data-popover-trigger": true,
|
|
307
|
-
qa: qa || "FilterPicker",
|
|
308
|
-
id,
|
|
309
|
-
type,
|
|
310
|
-
theme: validationState === "invalid" ? "danger" : theme,
|
|
280
|
+
else if (selectionMode === "single") return selectedLabels[0] || null;
|
|
281
|
+
else if (effectiveSelectedKeys === "all") return selectAllLabel;
|
|
282
|
+
else return selectedLabels.join(", ") || null;
|
|
283
|
+
}, [
|
|
284
|
+
renderSummary,
|
|
285
|
+
selectionMode,
|
|
286
|
+
selectedLabels,
|
|
287
|
+
effectiveSelectedKey,
|
|
288
|
+
effectiveSelectedKeys,
|
|
289
|
+
hasSelection,
|
|
290
|
+
placeholder,
|
|
291
|
+
selectAllLabel
|
|
292
|
+
]);
|
|
293
|
+
const showClearButton = isClearable && hasSelection && !isDisabled && !props.isReadOnly;
|
|
294
|
+
const triggerElement = /* @__PURE__ */ jsx(_ItemButton, {
|
|
295
|
+
ref: triggerRef,
|
|
296
|
+
"data-popover-trigger": true,
|
|
297
|
+
qa: qa || "FilterPicker",
|
|
298
|
+
id,
|
|
299
|
+
type,
|
|
300
|
+
theme: validationState === "invalid" ? "danger" : theme,
|
|
301
|
+
size,
|
|
302
|
+
shape,
|
|
303
|
+
isDisabled: isDisabled || isLoading,
|
|
304
|
+
"data-input-type": "filterpicker",
|
|
305
|
+
mods: {
|
|
306
|
+
placeholder: !hasSelection,
|
|
307
|
+
...externalMods
|
|
308
|
+
},
|
|
309
|
+
icon,
|
|
310
|
+
rightIcon: isLoading ? /* @__PURE__ */ jsx(LoadingIcon, {}) : rightIcon !== void 0 ? rightIcon : showClearButton ? /* @__PURE__ */ jsx(ItemAction, {
|
|
311
|
+
icon: /* @__PURE__ */ jsx(CloseIcon, {}),
|
|
311
312
|
size,
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
313
|
+
theme: validationState === "invalid" ? "danger" : void 0,
|
|
314
|
+
qa: "FilterPickerClearButton",
|
|
315
|
+
mods: { pressed: false },
|
|
316
|
+
onPress: clearValue
|
|
317
|
+
}) : /* @__PURE__ */ jsx(DirectionIcon, { to: isPopoverOpen ? "top" : "bottom" }),
|
|
318
|
+
prefix,
|
|
319
|
+
suffix,
|
|
320
|
+
hotkeys,
|
|
321
|
+
tooltip: triggerTooltip,
|
|
322
|
+
description: triggerDescription,
|
|
323
|
+
descriptionPlacement,
|
|
324
|
+
styles: triggerStyles,
|
|
325
|
+
...keyboardProps,
|
|
326
|
+
"aria-label": `${props["aria-label"] ?? props.label ?? ""}`,
|
|
327
|
+
children: triggerContent
|
|
328
|
+
});
|
|
329
|
+
const handleSelectionChange = useEvent((selection) => {
|
|
330
|
+
if (selectionMode === "single") {
|
|
331
|
+
if (!isControlledSingle) setInternalSelectedKey(selection);
|
|
332
|
+
} else if (!isControlledMultiple) {
|
|
333
|
+
let normalized = selection;
|
|
334
|
+
if (selection === "all") normalized = "all";
|
|
335
|
+
else if (Array.isArray(selection)) normalized = processSelectionArray(selection);
|
|
336
|
+
else if (selection && typeof selection === "object" && selection instanceof Set) normalized = processSelectionArray(selection);
|
|
337
|
+
setInternalSelectedKeys(normalized);
|
|
338
|
+
}
|
|
339
|
+
if (selectionMode === "single") latestSelectionRef.current.single = selection != null ? String(selection) : null;
|
|
340
|
+
else if (selection === "all") latestSelectionRef.current.multiple = "all";
|
|
341
|
+
else if (Array.isArray(selection)) latestSelectionRef.current.multiple = Array.from(new Set(processSelectionArray(selection)));
|
|
342
|
+
else if (selection && typeof selection === "object" && selection instanceof Set) latestSelectionRef.current.multiple = Array.from(new Set(processSelectionArray(selection)));
|
|
343
|
+
else latestSelectionRef.current.multiple = selection === "all" ? "all" : Array.isArray(selection) ? selection.map(String) : [];
|
|
344
|
+
onSelectionChange?.(selection);
|
|
345
|
+
if (selectionMode === "single") handleOpenChange(false);
|
|
346
|
+
});
|
|
347
|
+
const handleEscape = useEvent(() => {
|
|
348
|
+
handleOpenChange(false);
|
|
349
|
+
});
|
|
350
|
+
const handleOptionClick = useEvent((key) => {
|
|
351
|
+
if (selectionMode === "multiple" && isCheckable || key === "__ALL__") handleOpenChange(false);
|
|
352
|
+
});
|
|
340
353
|
return wrapWithField(/* @__PURE__ */ jsx(FilterPickerWrapper, {
|
|
341
354
|
qa: "FilterPickerWrapper",
|
|
342
355
|
styles,
|
|
343
356
|
...filterBaseProps(otherProps, { eventProps: true }),
|
|
344
357
|
children: /* @__PURE__ */ jsxs(DialogTrigger, {
|
|
358
|
+
isDismissable: true,
|
|
345
359
|
type: "popover",
|
|
346
360
|
placement: "bottom start",
|
|
361
|
+
isOpen: isPopoverOpen,
|
|
347
362
|
containerPadding,
|
|
348
363
|
shouldUpdatePosition,
|
|
349
364
|
shouldFlip: shouldFlip && shouldUpdatePosition,
|
|
350
|
-
isDismissable: true,
|
|
351
365
|
shouldCloseOnInteractOutside: (el) => {
|
|
352
366
|
const menuTriggerEl = el.closest("[data-popover-trigger]");
|
|
353
367
|
if (!menuTriggerEl) return true;
|
|
354
|
-
if (menuTriggerEl === triggerRef?.current) return true;
|
|
368
|
+
if (menuTriggerEl === triggerRef?.current?.UNSAFE_getDOMNode()) return true;
|
|
355
369
|
return false;
|
|
356
370
|
},
|
|
357
|
-
|
|
371
|
+
onOpenChange: handleOpenChange,
|
|
372
|
+
children: [triggerElement, () => /* @__PURE__ */ jsx(Dialog, {
|
|
358
373
|
qa: "FilterPickerOverlay",
|
|
359
374
|
display: "grid",
|
|
360
375
|
styles: {
|
|
@@ -363,7 +378,7 @@ const FilterPicker = forwardRef(function FilterPicker(props, ref) {
|
|
|
363
378
|
"$overlay-min-width": "30x",
|
|
364
379
|
...popoverStyles
|
|
365
380
|
},
|
|
366
|
-
style:
|
|
381
|
+
style: triggerWidthRef.current ? { "--overlay-min-width": `${triggerWidthRef.current}px` } : void 0,
|
|
367
382
|
children: /* @__PURE__ */ jsx(FocusScope, {
|
|
368
383
|
restoreFocus: true,
|
|
369
384
|
children: /* @__PURE__ */ jsx(FilterListBox, {
|
|
@@ -407,29 +422,10 @@ const FilterPicker = forwardRef(function FilterPicker(props, ref) {
|
|
|
407
422
|
customValueProps,
|
|
408
423
|
newCustomValueProps,
|
|
409
424
|
onSearchChange,
|
|
410
|
-
onEscape:
|
|
411
|
-
onOptionClick:
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
onSelectionChange: (selection) => {
|
|
415
|
-
if (selectionMode === "single") {
|
|
416
|
-
if (!isControlledSingle) setInternalSelectedKey(selection);
|
|
417
|
-
} else if (!isControlledMultiple) {
|
|
418
|
-
let normalized = selection;
|
|
419
|
-
if (selection === "all") normalized = "all";
|
|
420
|
-
else if (Array.isArray(selection)) normalized = processSelectionArray(selection);
|
|
421
|
-
else if (selection && typeof selection === "object" && selection instanceof Set) normalized = processSelectionArray(selection);
|
|
422
|
-
setInternalSelectedKeys(normalized);
|
|
423
|
-
}
|
|
424
|
-
if (selectionMode === "single") latestSelectionRef.current.single = selection != null ? String(selection) : null;
|
|
425
|
-
else if (selection === "all") latestSelectionRef.current.multiple = "all";
|
|
426
|
-
else if (Array.isArray(selection)) latestSelectionRef.current.multiple = Array.from(new Set(processSelectionArray(selection)));
|
|
427
|
-
else if (selection && typeof selection === "object" && selection instanceof Set) latestSelectionRef.current.multiple = Array.from(new Set(processSelectionArray(selection)));
|
|
428
|
-
else latestSelectionRef.current.multiple = selection === "all" ? "all" : Array.isArray(selection) ? selection.map(String) : [];
|
|
429
|
-
onSelectionChange?.(selection);
|
|
430
|
-
if (selectionMode === "single") close();
|
|
431
|
-
},
|
|
432
|
-
children: children ? finalChildren : void 0
|
|
425
|
+
onEscape: handleEscape,
|
|
426
|
+
onOptionClick: handleOptionClick,
|
|
427
|
+
onSelectionChange: handleSelectionChange,
|
|
428
|
+
children: children ? children : void 0
|
|
433
429
|
})
|
|
434
430
|
})
|
|
435
431
|
})]
|