@cube-dev/ui-kit 0.121.0 → 0.121.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CHANGELOG.md +6 -0
- package/dist/_internal/hooks/use-chained-callback.js +1 -1
- package/dist/_internal/hooks/use-debounced-value.js +1 -1
- package/dist/_internal/hooks/use-deprecation-warning.js +1 -1
- package/dist/_internal/hooks/use-event.js +1 -1
- package/dist/_internal/hooks/use-is-first-render.js +1 -1
- package/dist/_internal/hooks/use-sync-ref.js +1 -1
- package/dist/_internal/hooks/use-timer/timer.js +1 -1
- package/dist/_internal/hooks/use-timer/use-timer.js +1 -1
- package/dist/_internal/hooks/use-warn.js +1 -1
- package/dist/components/Block.js +1 -1
- package/dist/components/CollectionItem.js +1 -1
- package/dist/components/GlobalStyles.js +1 -1
- package/dist/components/GridProvider.js +1 -1
- package/dist/components/HiddenInput.js +1 -1
- package/dist/components/Root.js +1 -1
- package/dist/components/actions/Action/Action.js +1 -1
- package/dist/components/actions/Banner/Banner.js +1 -1
- package/dist/components/actions/Button/Button.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 +1 -1
- package/dist/components/content/ItemCard/ItemCard.js +1 -1
- package/dist/components/content/Layout/GridLayout.js +1 -1
- package/dist/components/content/Layout/Layout.js +1 -1
- package/dist/components/content/Layout/LayoutBlock.js +1 -1
- package/dist/components/content/Layout/LayoutCenter.js +1 -1
- package/dist/components/content/Layout/LayoutContainer.js +1 -1
- package/dist/components/content/Layout/LayoutContent.js +1 -1
- package/dist/components/content/Layout/LayoutContext.js +1 -1
- package/dist/components/content/Layout/LayoutFlex.js +1 -1
- package/dist/components/content/Layout/LayoutFooter.js +1 -1
- package/dist/components/content/Layout/LayoutGrid.js +1 -1
- package/dist/components/content/Layout/LayoutHeader.js +1 -1
- package/dist/components/content/Layout/LayoutPane.js +1 -1
- package/dist/components/content/Layout/LayoutPanel.js +1 -1
- package/dist/components/content/Layout/LayoutPanelHeader.js +1 -1
- package/dist/components/content/Layout/LayoutToolbar.js +1 -1
- package/dist/components/content/Layout/hooks/useTinyScrollbar.js +1 -1
- package/dist/components/content/Layout/index.js +1 -1
- package/dist/components/content/Layout/utils.js +1 -1
- package/dist/components/content/Paragraph.js +1 -1
- package/dist/components/content/Placeholder/Placeholder.js +1 -1
- package/dist/components/content/PrismCode/PrismCode.js +1 -1
- package/dist/components/content/PrismCode/prismSetup.js +1 -1
- package/dist/components/content/PrismDiffCode/PrismDiffCode.js +1 -1
- package/dist/components/content/Result/Result.js +1 -1
- package/dist/components/content/Skeleton/Skeleton.js +1 -1
- package/dist/components/content/Tag/Tag.js +1 -1
- package/dist/components/content/Text.js +1 -1
- package/dist/components/content/TextItem/TextItem.js +1 -1
- package/dist/components/content/Title.js +1 -1
- package/dist/components/content/highlightText.js +1 -1
- package/dist/components/content/use-auto-tooltip.js +1 -1
- package/dist/components/fields/Checkbox/Checkbox.js +1 -1
- package/dist/components/fields/Checkbox/CheckboxGroup.js +1 -1
- package/dist/components/fields/Checkbox/context.js +1 -1
- package/dist/components/fields/ComboBox/ComboBox.js +1 -1
- package/dist/components/fields/DatePicker/DateInput.js +1 -1
- package/dist/components/fields/DatePicker/DateInputBase.js +1 -1
- package/dist/components/fields/DatePicker/DatePicker.js +1 -1
- package/dist/components/fields/DatePicker/DatePickerButton.js +1 -1
- package/dist/components/fields/DatePicker/DatePickerElement.js +1 -1
- package/dist/components/fields/DatePicker/DatePickerInput.js +1 -1
- package/dist/components/fields/DatePicker/DatePickerSegment.js +1 -1
- package/dist/components/fields/DatePicker/DateRangePicker.js +1 -1
- package/dist/components/fields/DatePicker/DateRangeSeparatedPicker.js +1 -1
- package/dist/components/fields/DatePicker/TimeInput.js +1 -1
- package/dist/components/fields/DatePicker/intl.js +1 -1
- package/dist/components/fields/DatePicker/parseDate.js +1 -1
- package/dist/components/fields/DatePicker/props.js +1 -1
- package/dist/components/fields/DatePicker/utils.js +1 -1
- package/dist/components/fields/FileInput/FileInput.js +1 -1
- package/dist/components/fields/FilterListBox/FilterListBox.js +1 -1
- package/dist/components/fields/FilterPicker/FilterPicker.js +1 -1
- package/dist/components/fields/Input/Input.js +1 -1
- package/dist/components/fields/ListBox/ListBox.js +1 -1
- package/dist/components/fields/NumberInput/NumberInput.js +1 -1
- package/dist/components/fields/NumberInput/StepButton.js +1 -1
- package/dist/components/fields/PasswordInput/PasswordInput.js +1 -1
- package/dist/components/fields/Picker/Picker.js +1 -1
- package/dist/components/fields/RadioGroup/Radio.js +1 -1
- package/dist/components/fields/RadioGroup/RadioGroup.js +1 -1
- package/dist/components/fields/RadioGroup/context.js +1 -1
- package/dist/components/fields/SearchInput/SearchInput.js +1 -1
- package/dist/components/fields/Select/Select.d.ts +8 -2
- package/dist/components/fields/Select/Select.js +1 -1
- package/dist/components/fields/Select/Select.js.map +1 -1
- package/dist/components/fields/Slider/Gradation.js +1 -1
- package/dist/components/fields/Slider/HueSlider.js +1 -1
- package/dist/components/fields/Slider/RangeSlider.js +1 -1
- package/dist/components/fields/Slider/Slider.js +1 -1
- package/dist/components/fields/Slider/SliderBase.js +1 -1
- package/dist/components/fields/Slider/SliderThumb.js +1 -1
- package/dist/components/fields/Slider/SliderTrack.js +1 -1
- package/dist/components/fields/Slider/elements.js +1 -1
- package/dist/components/fields/Slider/index.js +1 -1
- package/dist/components/fields/Switch/Switch.js +1 -1
- package/dist/components/fields/TextArea/TextArea.js +1 -1
- package/dist/components/fields/TextInput/TextInput.js +1 -1
- package/dist/components/fields/TextInput/TextInputBase.js +1 -1
- package/dist/components/fields/TextInputMapper/TextInputMapper.js +1 -1
- package/dist/components/form/FieldWrapper/FieldWrapper.js +1 -1
- package/dist/components/form/FieldWrapper/extract-field-wrapper-props.js +1 -1
- package/dist/components/form/Form/Field.js +1 -1
- package/dist/components/form/Form/Form.js +1 -1
- package/dist/components/form/Form/ResetButton/ResetButton.js +1 -1
- package/dist/components/form/Form/SubmitButton/SubmitButton.js +1 -1
- package/dist/components/form/Form/SubmitError.js +1 -1
- package/dist/components/form/Form/index.js +1 -1
- package/dist/components/form/Form/use-field/use-field-props.js +1 -1
- package/dist/components/form/Form/use-field/use-field.js +1 -1
- package/dist/components/form/Form/use-form.js +1 -1
- package/dist/components/form/Form/validation.js +1 -1
- package/dist/components/form/Label.js +1 -1
- package/dist/components/form/wrapper.js +1 -1
- package/dist/components/helpers/DisplayTransition/DisplayTransition.js +1 -1
- package/dist/components/helpers/IconSwitch/IconSwitch.js +1 -1
- package/dist/components/layout/Flex.js +1 -1
- package/dist/components/layout/Flow.js +1 -1
- package/dist/components/layout/Grid.js +1 -1
- package/dist/components/layout/Panel.js +1 -1
- package/dist/components/layout/Prefix.js +1 -1
- package/dist/components/layout/ResizablePanel.js +1 -1
- package/dist/components/layout/Space.js +1 -1
- package/dist/components/layout/Suffix.js +1 -1
- package/dist/components/navigation/Tabs/DraggableTabList.js +1 -1
- package/dist/components/navigation/Tabs/EditableTitle.js +1 -1
- package/dist/components/navigation/Tabs/TabButton.js +1 -1
- package/dist/components/navigation/Tabs/TabDropIndicator.js +1 -1
- package/dist/components/navigation/Tabs/TabPanel.js +1 -1
- package/dist/components/navigation/Tabs/TabPicker.js +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 +1 -1
- package/dist/components/status/Spin/Cube.js +1 -1
- package/dist/components/status/Spin/InternalSpinner.js +1 -1
- package/dist/components/status/Spin/Spin.js +1 -1
- package/dist/components/status/Spin/SpinsContainer.js +1 -1
- package/dist/data/item-themes.js +1 -1
- package/dist/data/themes.js +1 -1
- package/dist/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.js +1 -1
- package/dist/provider.js +1 -1
- package/dist/providers/TrackingProvider.js +1 -1
- package/dist/providers/navigationAdapter.default.js +1 -1
- package/dist/tokens/base.js +1 -1
- package/dist/tokens/colors.js +1 -1
- package/dist/tokens/index.js +1 -1
- package/dist/tokens/layout.js +1 -1
- package/dist/tokens/shadows.js +1 -1
- package/dist/tokens/sizes.js +1 -1
- package/dist/tokens/spacing.js +1 -1
- package/dist/utils/ResizeSensor.js +1 -1
- package/dist/utils/is-dev-env.js +1 -1
- package/dist/utils/modules.js +1 -1
- package/dist/utils/promise.js +1 -1
- package/dist/utils/raf.js +1 -1
- package/dist/utils/random.js +1 -1
- package/dist/utils/range.js +1 -1
- package/dist/utils/react/RenderCache.js +1 -1
- package/dist/utils/react/Slots.js +1 -1
- package/dist/utils/react/chain.js +1 -1
- package/dist/utils/react/forwardRefWithGenerics.js +1 -1
- package/dist/utils/react/index.js +1 -1
- package/dist/utils/react/interactions.js +1 -1
- package/dist/utils/react/isTextOnly.js +1 -1
- package/dist/utils/react/mapProps.js +1 -1
- package/dist/utils/react/mergeProps.js +1 -1
- package/dist/utils/react/nullableValue.js +1 -1
- package/dist/utils/react/resolveIcon.js +1 -1
- package/dist/utils/react/sharedStore.js +1 -1
- package/dist/utils/react/useCombinedRefs.js +1 -1
- package/dist/utils/react/useControlledFocusVisible.js +1 -1
- package/dist/utils/react/useEventBus.js +1 -1
- package/dist/utils/react/useId.js +1 -1
- package/dist/utils/react/useIsDarwin.js +1 -1
- package/dist/utils/react/useKeySymbols.js +1 -1
- package/dist/utils/react/useLayoutEffect.js +1 -1
- package/dist/utils/react/useLocalStorage.js +1 -1
- package/dist/utils/react/useMergeStyles.js +1 -1
- package/dist/utils/react/useQaProps.js +1 -1
- package/dist/utils/react/useViewportSize.js +1 -1
- package/dist/utils/react/wrapNodeIfPlain.js +1 -1
- package/dist/utils/tree.js +1 -1
- package/dist/utils/warnings.js +1 -1
- package/dist/version.js +2 -2
- package/docs/BaseProperties.md +78 -0
- package/docs/ComplexLayout.md +459 -0
- package/docs/CreateComponent.md +410 -0
- package/docs/FieldProperties.md +117 -0
- package/docs/Introduction.md +122 -0
- package/docs/RenderCache.md +177 -0
- package/docs/Result.md +42 -0
- package/docs/SimpleLayout.md +26 -0
- package/docs/Typography.md +38 -0
- package/docs/components/Block.md +33 -0
- package/docs/components/CollectionItem.md +293 -0
- package/docs/components/GridProvider.md +38 -0
- package/docs/components/Root.md +50 -0
- package/docs/components/actions/Action.md +47 -0
- package/docs/components/actions/Banner.md +195 -0
- package/docs/components/actions/Button.md +209 -0
- package/docs/components/actions/ButtonGroup.md +46 -0
- package/docs/components/actions/ButtonSplit.md +199 -0
- package/docs/components/actions/CommandMenu.md +422 -0
- package/docs/components/actions/ItemAction.md +60 -0
- package/docs/components/actions/ItemButton.md +316 -0
- package/docs/components/actions/Link.md +325 -0
- package/docs/components/actions/Menu.md +485 -0
- package/docs/components/actions/MenuTrigger.md +47 -0
- package/docs/components/actions/SubMenuTrigger.md +38 -0
- package/docs/components/actions/use-anchored-menu.md +209 -0
- package/docs/components/actions/use-context-menu.md +218 -0
- package/docs/components/content/ActiveZone.md +37 -0
- package/docs/components/content/Alert.md +40 -0
- package/docs/components/content/Avatar.md +37 -0
- package/docs/components/content/Badge.md +194 -0
- package/docs/components/content/Card.md +40 -0
- package/docs/components/content/Content.md +44 -0
- package/docs/components/content/CopyPasteBlock.md +36 -0
- package/docs/components/content/CopySnippet.md +43 -0
- package/docs/components/content/Disclosure.md +181 -0
- package/docs/components/content/Divider.md +39 -0
- package/docs/components/content/Footer.md +35 -0
- package/docs/components/content/Header.md +35 -0
- package/docs/components/content/HotKeys.md +352 -0
- package/docs/components/content/Item.md +499 -0
- package/docs/components/content/ItemBadge.md +31 -0
- package/docs/components/content/ItemCard.md +131 -0
- package/docs/components/content/Layout.md +843 -0
- package/docs/components/content/Paragraph.md +32 -0
- package/docs/components/content/Placeholder.md +37 -0
- package/docs/components/content/PrismCode.md +36 -0
- package/docs/components/content/PrismDiffCode.md +29 -0
- package/docs/components/content/Result.md +46 -0
- package/docs/components/content/Skeleton.md +35 -0
- package/docs/components/content/Tag.md +165 -0
- package/docs/components/content/Text.md +54 -0
- package/docs/components/content/TextItem.md +217 -0
- package/docs/components/content/Title.md +45 -0
- package/docs/components/fields/Checkbox.md +176 -0
- package/docs/components/fields/ComboBox.md +651 -0
- package/docs/components/fields/DatePicker.md +227 -0
- package/docs/components/fields/FileInput.md +194 -0
- package/docs/components/fields/FilterListBox.md +726 -0
- package/docs/components/fields/FilterPicker.md +776 -0
- package/docs/components/fields/HueSlider.md +175 -0
- package/docs/components/fields/ListBox.md +714 -0
- package/docs/components/fields/NumberInput.md +180 -0
- package/docs/components/fields/PasswordInput.md +214 -0
- package/docs/components/fields/Picker.md +906 -0
- package/docs/components/fields/RadioGroup.md +310 -0
- package/docs/components/fields/SearchInput.md +224 -0
- package/docs/components/fields/Select.md +576 -0
- package/docs/components/fields/Slider.md +53 -0
- package/docs/components/fields/Switch.md +169 -0
- package/docs/components/fields/TextArea.md +61 -0
- package/docs/components/fields/TextInput.md +205 -0
- package/docs/components/fields/TextInputMapper.md +34 -0
- package/docs/components/form/Field.md +333 -0
- package/docs/components/form/Form.md +644 -0
- package/docs/components/form/FormInstance.md +307 -0
- package/docs/components/helpers/DisplayTransition.md +268 -0
- package/docs/components/helpers/IconSwitch.md +160 -0
- package/docs/components/layout/Flex.md +51 -0
- package/docs/components/layout/Flow.md +32 -0
- package/docs/components/layout/Grid.md +46 -0
- package/docs/components/layout/Panel.md +65 -0
- package/docs/components/layout/Prefix.md +37 -0
- package/docs/components/layout/ResizablePanel.md +69 -0
- package/docs/components/layout/Space.md +44 -0
- package/docs/components/layout/Suffix.md +39 -0
- package/docs/components/navigation/Tabs.md +726 -0
- package/docs/components/organisms/FileTabs.md +39 -0
- package/docs/components/organisms/StatsCard.md +40 -0
- package/docs/components/other/CloudLogo.md +33 -0
- package/docs/components/overlays/AlertDialog.md +51 -0
- package/docs/components/overlays/Dialog.md +200 -0
- package/docs/components/overlays/DialogContainer.md +201 -0
- package/docs/components/overlays/DialogForm.md +295 -0
- package/docs/components/overlays/DialogTrigger.md +191 -0
- package/docs/components/overlays/Notifications.md +402 -0
- package/docs/components/overlays/Toast.md +289 -0
- package/docs/components/overlays/Tooltip.md +400 -0
- package/docs/components/overlays/TooltipProvider.md +42 -0
- package/docs/components/overlays/TooltipTrigger.md +42 -0
- package/docs/components/overlays/UseDialogContainer.md +597 -0
- package/docs/components/portal/Portal.md +29 -0
- package/docs/components/status/LoadingAnimation.md +27 -0
- package/docs/components/status/Spin.md +35 -0
- package/docs/tasty/configuration.md +211 -0
- package/docs/tasty/debug.md +505 -0
- package/docs/tasty/injector.md +528 -0
- package/docs/tasty/styles.md +567 -0
- package/docs/tasty/tasty-static.md +376 -0
- package/docs/tasty/usage.md +643 -0
- package/package.json +4 -8
|
@@ -0,0 +1,906 @@
|
|
|
1
|
+
# Picker
|
|
2
|
+
|
|
3
|
+
A versatile selection component that combines a trigger button with a dropdown list. It provides a space-efficient interface for selecting one or multiple items from a list, with support for sections, custom summaries, and various UI states.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
- Creating selection interfaces where users need to choose from predefined options
|
|
8
|
+
- Implementing compact selection interfaces where space is limited
|
|
9
|
+
- Building user preference panels with organized option groups
|
|
10
|
+
- When you need single or multiple selection from a list
|
|
11
|
+
- When you don't need search/filter functionality (use ComboBox or FilterPicker for searchable lists)
|
|
12
|
+
|
|
13
|
+
## Component
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
### Properties
|
|
18
|
+
|
|
19
|
+
- **`placeholder`** `string` — Placeholder text when no selection is made
|
|
20
|
+
- **`description`** `string` — Description text displayed below the label
|
|
21
|
+
- **`message`** `string` — Help or error message
|
|
22
|
+
- **`selectionMode`** `'single' | 'multiple'` (default: `single`) — Selection mode for the picker
|
|
23
|
+
- **`selectedKey`** `string` — The selected key in controlled single mode
|
|
24
|
+
- **`defaultSelectedKey`** `string` — The default selected key in uncontrolled single mode
|
|
25
|
+
- **`selectedKeys`** `string[] | 'all'` — The selected keys in controlled multiple mode
|
|
26
|
+
- **`defaultSelectedKeys`** `string[] | 'all'` — The default selected keys in uncontrolled multiple mode
|
|
27
|
+
- **`items`** `Iterable<T>` — Array of items for dynamic content with render function pattern
|
|
28
|
+
- **`size`** `'small' | 'medium' | 'large'` (default: `medium`) — Size of the picker component
|
|
29
|
+
- **`type`** `'outline' | 'clear' | 'primary' | 'secondary' | 'neutral'` (default: `outline`) — Trigger button styling type
|
|
30
|
+
- **`theme`** `'default' | 'danger'` (default: `default`) — Trigger button color theme
|
|
31
|
+
- **`icon`** `ReactNode` — Icon displayed in the trigger button
|
|
32
|
+
- **`rightIcon`** `ReactNode` — Icon displayed on the right side of the trigger button
|
|
33
|
+
- **`prefix`** `ReactNode` — Content before the trigger button text
|
|
34
|
+
- **`suffix`** `ReactNode` — Content after the trigger button text
|
|
35
|
+
- **`hotkeys`** `string` — Keyboard shortcut that triggers the picker when pressed
|
|
36
|
+
- **`shape`** `'rectangle' | 'round'` — Shape of the trigger button
|
|
37
|
+
- **`isCheckable`** `boolean` (default: `false`) — Whether to show checkboxes for multiple selection mode
|
|
38
|
+
- **`showSelectAll`** `boolean` (default: `false`) — Whether to show "Select All" option in multiple selection mode
|
|
39
|
+
- **`selectAllLabel`** `ReactNode` (default: `Select All`) — Label for the "Select All" option
|
|
40
|
+
- **`disallowEmptySelection`** `boolean` (default: `false`) — Whether to disallow empty selection
|
|
41
|
+
- **`disabledKeys`** `Key[]` — Array of keys for disabled items
|
|
42
|
+
- **`isClearable`** `boolean` (default: `false`) — Whether the picker shows a clear button when a selection is made
|
|
43
|
+
- **`onClear`** `() => void` — Callback called when the clear button is pressed
|
|
44
|
+
- **`sortSelectedToTop`** `boolean` — Sort selected items to the top when the popover opens (only works with `items` prop)
|
|
45
|
+
- **`renderSummary`** `((args: { selectedLabels, selectedKeys, selectionMode }) => ReactNode) | false` — Custom renderer for the summary shown inside the trigger
|
|
46
|
+
- **`header`** `ReactNode` — Custom header content in the popover
|
|
47
|
+
- **`footer`** `ReactNode` — Custom footer content in the popover
|
|
48
|
+
- **`listBoxStyles`** `Styles` — Custom styles for the ListBox within the popover
|
|
49
|
+
- **`popoverStyles`** `Styles` — Custom styles for the popover container
|
|
50
|
+
- **`triggerStyles`** `Styles` — Custom styles for the trigger button
|
|
51
|
+
- **`triggerTooltip`** `string | TooltipProps` — Tooltip for the trigger button (separate from field tooltip)
|
|
52
|
+
- **`triggerDescription`** `string` — Description for the trigger button (separate from field description)
|
|
53
|
+
- **`shouldFlip`** `boolean` — Whether to flip the popover placement when it overflows
|
|
54
|
+
- **`containerPadding`** `number` — Minimum padding between the popover and viewport edges
|
|
55
|
+
- **`onSelectionChange`** `(keys: Key | Key[] | 'all' | null) => void` — Callback when selection changes
|
|
56
|
+
|
|
57
|
+
### Base Properties
|
|
58
|
+
|
|
59
|
+
Supports [Base properties](../../BaseProperties.md)
|
|
60
|
+
|
|
61
|
+
### Field Properties
|
|
62
|
+
|
|
63
|
+
Supports all [Field properties](../../FieldProperties.md)
|
|
64
|
+
|
|
65
|
+
### Styling Properties
|
|
66
|
+
|
|
67
|
+
#### styles
|
|
68
|
+
|
|
69
|
+
Customizes the root wrapper element and the trigger button of the Picker component.
|
|
70
|
+
|
|
71
|
+
**Sub-elements:**
|
|
72
|
+
- None
|
|
73
|
+
|
|
74
|
+
#### triggerStyles
|
|
75
|
+
|
|
76
|
+
Customizes the DialogTrigger wrapper that contains the trigger button and manages the popover.
|
|
77
|
+
|
|
78
|
+
**Sub-elements:**
|
|
79
|
+
- None
|
|
80
|
+
|
|
81
|
+
#### listBoxStyles
|
|
82
|
+
|
|
83
|
+
Customizes the ListBox component styles within the popover. See [ListBox documentation](./ListBox.md) for available sub-elements.
|
|
84
|
+
|
|
85
|
+
**Sub-elements:**
|
|
86
|
+
- `Label` - Item label text
|
|
87
|
+
- `Description` - Item description text
|
|
88
|
+
- `Content` - Item content wrapper
|
|
89
|
+
- `Checkbox` - Checkbox element in multiple selection mode
|
|
90
|
+
- `CheckboxWrapper` - Wrapper around checkbox
|
|
91
|
+
|
|
92
|
+
#### popoverStyles
|
|
93
|
+
|
|
94
|
+
Customizes the popover Dialog that contains the ListBox. See [Dialog documentation](../overlays/Dialog.md) for available sub-elements.
|
|
95
|
+
|
|
96
|
+
**Sub-elements:**
|
|
97
|
+
- None for Dialog in popover mode
|
|
98
|
+
|
|
99
|
+
#### headerStyles
|
|
100
|
+
|
|
101
|
+
Customizes the header area when `header` prop is provided.
|
|
102
|
+
|
|
103
|
+
**Sub-elements:**
|
|
104
|
+
- None
|
|
105
|
+
|
|
106
|
+
#### footerStyles
|
|
107
|
+
|
|
108
|
+
Customizes the footer area when `footer` prop is provided.
|
|
109
|
+
|
|
110
|
+
**Sub-elements:**
|
|
111
|
+
- None
|
|
112
|
+
|
|
113
|
+
### Style Properties
|
|
114
|
+
|
|
115
|
+
These properties allow direct style application without using the `styles` prop: `display`, `font`, `preset`, `hide`, `opacity`, `whiteSpace`, `width`, `height`, `flexBasis`, `flexGrow`, `flexShrink`, `flex`, `gridArea`, `order`, `gridColumn`, `gridRow`, `placeSelf`, `alignSelf`, `justifySelf`, `zIndex`, `margin`, `inset`, `position`, `color`, `fill`, `fade`.
|
|
116
|
+
|
|
117
|
+
### Modifiers
|
|
118
|
+
|
|
119
|
+
The `mods` property accepts the following modifiers you can override:
|
|
120
|
+
|
|
121
|
+
- **`placeholder`** `boolean` — Applied when no selection is made
|
|
122
|
+
- **`selected`** `boolean` — Applied when items are selected
|
|
123
|
+
|
|
124
|
+
## Sub-components
|
|
125
|
+
|
|
126
|
+
### Picker.Item
|
|
127
|
+
|
|
128
|
+
Represents individual selectable items within the Picker dropdown. Each item is rendered using [Item](../content/Item.md) and inherits all its properties.
|
|
129
|
+
|
|
130
|
+
#### Key Properties
|
|
131
|
+
|
|
132
|
+
See [Item documentation](../content/Item.md) for the complete API. Common properties include:
|
|
133
|
+
|
|
134
|
+
- **`key`** `string \| number` — Unique identifier for the item (required)
|
|
135
|
+
- **`children`** `ReactNode` — The main content/label for the item
|
|
136
|
+
- **`textValue`** `string` — Accessible text for screen readers (required for complex content)
|
|
137
|
+
- **`icon`** `ReactNode` — Icon displayed before the content
|
|
138
|
+
- **`rightIcon`** `ReactNode` — Icon displayed after the content
|
|
139
|
+
- **`description`** `ReactNode` — Secondary text below the main content
|
|
140
|
+
- **`descriptionPlacement`** `'inline' \| 'block'` — How the description is positioned relative to content
|
|
141
|
+
- **`prefix`** `ReactNode` — Content before the main text
|
|
142
|
+
- **`suffix`** `ReactNode` — Content after the main text
|
|
143
|
+
- **`isDisabled`** `boolean` — Whether the item is disabled
|
|
144
|
+
- **`tooltip`** `string \| boolean \| TooltipProps` — Tooltip configuration
|
|
145
|
+
- **`styles`** `Styles` — Custom styling for the item
|
|
146
|
+
- **`qa`** `string` — QA identifier for testing
|
|
147
|
+
|
|
148
|
+
#### Examples with Rich Items
|
|
149
|
+
|
|
150
|
+
**With Icons and Descriptions:**
|
|
151
|
+
```jsx
|
|
152
|
+
<Picker label="Team Selection" selectionMode="single">
|
|
153
|
+
<Picker.Item
|
|
154
|
+
key="active"
|
|
155
|
+
icon={<IconUsers />}
|
|
156
|
+
description="All active team members"
|
|
157
|
+
>
|
|
158
|
+
Active Users
|
|
159
|
+
</Picker.Item>
|
|
160
|
+
<Picker.Item
|
|
161
|
+
key="admins"
|
|
162
|
+
icon={<IconShield />}
|
|
163
|
+
description="Admin users only"
|
|
164
|
+
>
|
|
165
|
+
Administrators
|
|
166
|
+
</Picker.Item>
|
|
167
|
+
</Picker>
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
**With Prefix and Suffix:**
|
|
171
|
+
```jsx
|
|
172
|
+
<Picker label="Select Plan" selectionMode="single">
|
|
173
|
+
<Picker.Item
|
|
174
|
+
key="free"
|
|
175
|
+
prefix={<Badge>Free</Badge>}
|
|
176
|
+
suffix="$0/mo"
|
|
177
|
+
>
|
|
178
|
+
Basic Plan
|
|
179
|
+
</Picker.Item>
|
|
180
|
+
<Picker.Item
|
|
181
|
+
key="pro"
|
|
182
|
+
prefix={<Badge type="primary">Pro</Badge>}
|
|
183
|
+
suffix="$29/mo"
|
|
184
|
+
>
|
|
185
|
+
Pro Plan
|
|
186
|
+
</Picker.Item>
|
|
187
|
+
</Picker>
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Picker.Section
|
|
191
|
+
|
|
192
|
+
Groups related items together under an optional section heading. Sections provide visual and semantic grouping for better organization.
|
|
193
|
+
|
|
194
|
+
#### Properties
|
|
195
|
+
|
|
196
|
+
- **`title`** `ReactNode` — Section heading text (optional)
|
|
197
|
+
- **`children`** `Picker.Item[]` — Collection of Picker.Item components (required)
|
|
198
|
+
|
|
199
|
+
#### Example
|
|
200
|
+
|
|
201
|
+
```jsx
|
|
202
|
+
<Picker label="Food Categories" selectionMode="single">
|
|
203
|
+
<Picker.Section title="Fruits">
|
|
204
|
+
<Picker.Item key="apple">Apple</Picker.Item>
|
|
205
|
+
<Picker.Item key="banana">Banana</Picker.Item>
|
|
206
|
+
</Picker.Section>
|
|
207
|
+
<Picker.Section title="Vegetables">
|
|
208
|
+
<Picker.Item key="carrot">Carrot</Picker.Item>
|
|
209
|
+
<Picker.Item key="broccoli">Broccoli</Picker.Item>
|
|
210
|
+
</Picker.Section>
|
|
211
|
+
</Picker>
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
**Note:** Sections disable virtualization. For large datasets (50+ items), use a flat structure with the `items` prop instead.
|
|
215
|
+
|
|
216
|
+
## Content Patterns
|
|
217
|
+
|
|
218
|
+
### Static Children Pattern
|
|
219
|
+
|
|
220
|
+
The most common pattern for Picker is to provide static children using `Picker.Item` and `Picker.Section` components:
|
|
221
|
+
|
|
222
|
+
```jsx
|
|
223
|
+
<Picker label="Select Options">
|
|
224
|
+
<Picker.Item key="apple">Apple</Picker.Item>
|
|
225
|
+
<Picker.Item key="banana">Banana</Picker.Item>
|
|
226
|
+
<Picker.Section title="Vegetables">
|
|
227
|
+
<Picker.Item key="carrot">Carrot</Picker.Item>
|
|
228
|
+
</Picker.Section>
|
|
229
|
+
</Picker>
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Dynamic Content Pattern
|
|
233
|
+
|
|
234
|
+
For large datasets or dynamic content, use the `items` prop with a render function. This pattern enables automatic virtualization for performance:
|
|
235
|
+
|
|
236
|
+
```jsx
|
|
237
|
+
<Picker
|
|
238
|
+
label="Large Dataset"
|
|
239
|
+
items={largeDataArray}
|
|
240
|
+
>
|
|
241
|
+
{(item) => (
|
|
242
|
+
<Picker.Item key={item.id} textValue={item.name}>
|
|
243
|
+
{item.name}
|
|
244
|
+
</Picker.Item>
|
|
245
|
+
)}
|
|
246
|
+
</Picker>
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
**Key Benefits:**
|
|
250
|
+
- **Virtualization**: Automatically enabled for large lists without sections
|
|
251
|
+
- **Performance**: Only renders visible items in the DOM
|
|
252
|
+
- **Dynamic Content**: Perfect for data fetched from APIs or changing datasets
|
|
253
|
+
- **Memory Efficient**: Handles thousands of items smoothly
|
|
254
|
+
|
|
255
|
+
**When to Use:**
|
|
256
|
+
- Lists with 50+ items
|
|
257
|
+
- Dynamic data from APIs
|
|
258
|
+
- Content that changes frequently
|
|
259
|
+
- When virtualization performance is needed
|
|
260
|
+
|
|
261
|
+
## Variants
|
|
262
|
+
|
|
263
|
+
### Selection Modes
|
|
264
|
+
|
|
265
|
+
- **`single`** — Select only one item at a time. Use case: Category selection, single choice questions
|
|
266
|
+
- **`multiple`** — Select multiple items with checkboxes. Use case: Tags, filters, permissions
|
|
267
|
+
|
|
268
|
+
### Trigger Button Types
|
|
269
|
+
|
|
270
|
+
The trigger button supports various visual styles via the `type` prop:
|
|
271
|
+
|
|
272
|
+
- **`outline`** (default) — Outlined button with border. Use case: Standard form inputs
|
|
273
|
+
- **`clear`** — Transparent background. Use case: Toolbar actions, compact interfaces
|
|
274
|
+
- **`primary`** — Primary brand color. Use case: Emphasized selections
|
|
275
|
+
- **`secondary`** — Secondary color variant. Use case: Alternative emphasis
|
|
276
|
+
- **`neutral`** — Neutral color scheme. Use case: Subtle selections
|
|
277
|
+
|
|
278
|
+
### Trigger Button Themes
|
|
279
|
+
|
|
280
|
+
Control the color scheme with the `theme` prop:
|
|
281
|
+
|
|
282
|
+
- **`default`** — Standard theme (default)
|
|
283
|
+
- **`danger`** — Red/destructive color (also applied automatically when `validationState="invalid"`)
|
|
284
|
+
|
|
285
|
+
### Sizes
|
|
286
|
+
|
|
287
|
+
- **`small`** — ~28px. Use case: Dense interfaces, compact layouts
|
|
288
|
+
- **`medium`** — ~32px (default). Use case: Standard forms
|
|
289
|
+
- **`large`** — ~40px. Use case: Emphasized selections, accessibility
|
|
290
|
+
|
|
291
|
+
## Examples
|
|
292
|
+
|
|
293
|
+
### Basic Single Selection
|
|
294
|
+
|
|
295
|
+
Standard single-selection picker with a placeholder and label.
|
|
296
|
+
|
|
297
|
+
```jsx
|
|
298
|
+
<Picker
|
|
299
|
+
label="Favorite Fruit"
|
|
300
|
+
placeholder="Select a fruit"
|
|
301
|
+
selectionMode="single"
|
|
302
|
+
>
|
|
303
|
+
<Picker.Item key="apple">Apple</Picker.Item>
|
|
304
|
+
<Picker.Item key="banana">Banana</Picker.Item>
|
|
305
|
+
<Picker.Item key="orange">Orange</Picker.Item>
|
|
306
|
+
</Picker>
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### Multiple Selection
|
|
310
|
+
|
|
311
|
+
Multiple selection mode with checkboxes for clarity.
|
|
312
|
+
|
|
313
|
+
```jsx
|
|
314
|
+
<Picker
|
|
315
|
+
label="Favorite Fruits"
|
|
316
|
+
placeholder="Select fruits"
|
|
317
|
+
selectionMode="multiple"
|
|
318
|
+
isCheckable
|
|
319
|
+
>
|
|
320
|
+
<Picker.Item key="apple">Apple</Picker.Item>
|
|
321
|
+
<Picker.Item key="banana">Banana</Picker.Item>
|
|
322
|
+
<Picker.Item key="orange">Orange</Picker.Item>
|
|
323
|
+
</Picker>
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### With Clear Button
|
|
327
|
+
|
|
328
|
+
Enable users to clear their selection with a clear button that appears when an item is selected.
|
|
329
|
+
|
|
330
|
+
```jsx
|
|
331
|
+
<Picker
|
|
332
|
+
label="Favorite Fruit"
|
|
333
|
+
placeholder="Select a fruit"
|
|
334
|
+
selectionMode="single"
|
|
335
|
+
isClearable
|
|
336
|
+
defaultSelectedKey="apple"
|
|
337
|
+
>
|
|
338
|
+
<Picker.Item key="apple">Apple</Picker.Item>
|
|
339
|
+
<Picker.Item key="banana">Banana</Picker.Item>
|
|
340
|
+
<Picker.Item key="orange">Orange</Picker.Item>
|
|
341
|
+
</Picker>
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
### Multiple Selection with Select All
|
|
345
|
+
|
|
346
|
+
Add a "Select All" option for quick selection of all available items in multiple selection mode.
|
|
347
|
+
|
|
348
|
+
```jsx
|
|
349
|
+
<Picker
|
|
350
|
+
label="Favorite Fruits"
|
|
351
|
+
placeholder="Select fruits"
|
|
352
|
+
selectionMode="multiple"
|
|
353
|
+
showSelectAll
|
|
354
|
+
selectAllLabel="All Fruits"
|
|
355
|
+
isCheckable
|
|
356
|
+
>
|
|
357
|
+
<Picker.Item key="apple">Apple</Picker.Item>
|
|
358
|
+
<Picker.Item key="banana">Banana</Picker.Item>
|
|
359
|
+
<Picker.Item key="orange">Orange</Picker.Item>
|
|
360
|
+
</Picker>
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
### Custom Summary
|
|
364
|
+
|
|
365
|
+
Customize how the selected items are displayed in the trigger button using a custom render function.
|
|
366
|
+
|
|
367
|
+
```jsx
|
|
368
|
+
<Picker
|
|
369
|
+
label="Favorite Fruits"
|
|
370
|
+
placeholder="Select fruits"
|
|
371
|
+
selectionMode="multiple"
|
|
372
|
+
isCheckable
|
|
373
|
+
renderSummary={({ selectedLabels, selectedKeys }) => {
|
|
374
|
+
if (!selectedLabels || selectedLabels.length === 0) return null;
|
|
375
|
+
if (selectedLabels.length === 1) return selectedLabels[0];
|
|
376
|
+
return `${selectedLabels.length} fruits selected`;
|
|
377
|
+
}}
|
|
378
|
+
>
|
|
379
|
+
<Picker.Item key="apple">Apple</Picker.Item>
|
|
380
|
+
<Picker.Item key="banana">Banana</Picker.Item>
|
|
381
|
+
<Picker.Item key="orange">Orange</Picker.Item>
|
|
382
|
+
</Picker>
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
### With Sections
|
|
386
|
+
|
|
387
|
+
Organize items into logical groups with section headers.
|
|
388
|
+
|
|
389
|
+
```jsx
|
|
390
|
+
<Picker
|
|
391
|
+
label="Favorite Food"
|
|
392
|
+
placeholder="Select a food"
|
|
393
|
+
selectionMode="single"
|
|
394
|
+
>
|
|
395
|
+
<Picker.Section title="Fruits">
|
|
396
|
+
<Picker.Item key="apple">Apple</Picker.Item>
|
|
397
|
+
<Picker.Item key="banana">Banana</Picker.Item>
|
|
398
|
+
<Picker.Item key="orange">Orange</Picker.Item>
|
|
399
|
+
</Picker.Section>
|
|
400
|
+
<Picker.Section title="Vegetables">
|
|
401
|
+
<Picker.Item key="carrot">Carrot</Picker.Item>
|
|
402
|
+
<Picker.Item key="broccoli">Broccoli</Picker.Item>
|
|
403
|
+
<Picker.Item key="spinach">Spinach</Picker.Item>
|
|
404
|
+
</Picker.Section>
|
|
405
|
+
</Picker>
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
### Different Sizes
|
|
409
|
+
|
|
410
|
+
Picker supports three sizes: small, medium (default), and large.
|
|
411
|
+
|
|
412
|
+
```jsx
|
|
413
|
+
<Picker
|
|
414
|
+
size="small"
|
|
415
|
+
label="Small Picker"
|
|
416
|
+
placeholder="Select a fruit"
|
|
417
|
+
>
|
|
418
|
+
<Picker.Item key="apple">Apple</Picker.Item>
|
|
419
|
+
<Picker.Item key="banana">Banana</Picker.Item>
|
|
420
|
+
</Picker>
|
|
421
|
+
|
|
422
|
+
<Picker
|
|
423
|
+
size="medium"
|
|
424
|
+
label="Medium Picker"
|
|
425
|
+
placeholder="Select a fruit"
|
|
426
|
+
>
|
|
427
|
+
<Picker.Item key="apple">Apple</Picker.Item>
|
|
428
|
+
<Picker.Item key="banana">Banana</Picker.Item>
|
|
429
|
+
</Picker>
|
|
430
|
+
|
|
431
|
+
<Picker
|
|
432
|
+
size="large"
|
|
433
|
+
label="Large Picker"
|
|
434
|
+
placeholder="Select a fruit"
|
|
435
|
+
>
|
|
436
|
+
<Picker.Item key="apple">Apple</Picker.Item>
|
|
437
|
+
<Picker.Item key="banana">Banana</Picker.Item>
|
|
438
|
+
</Picker>
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
### Disabled State
|
|
442
|
+
|
|
443
|
+
Disable the picker to prevent user interaction.
|
|
444
|
+
|
|
445
|
+
```jsx
|
|
446
|
+
<Picker
|
|
447
|
+
label="Favorite Fruit"
|
|
448
|
+
placeholder="Select a fruit"
|
|
449
|
+
selectionMode="single"
|
|
450
|
+
isDisabled
|
|
451
|
+
defaultSelectedKey="apple"
|
|
452
|
+
>
|
|
453
|
+
<Picker.Item key="apple">Apple</Picker.Item>
|
|
454
|
+
<Picker.Item key="banana">Banana</Picker.Item>
|
|
455
|
+
</Picker>
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
### With Validation
|
|
459
|
+
|
|
460
|
+
Display validation states and error messages.
|
|
461
|
+
|
|
462
|
+
```jsx
|
|
463
|
+
<Picker
|
|
464
|
+
label="Favorite Fruit"
|
|
465
|
+
placeholder="Select a fruit"
|
|
466
|
+
selectionMode="single"
|
|
467
|
+
isRequired
|
|
468
|
+
validationState="invalid"
|
|
469
|
+
message="Please select a fruit"
|
|
470
|
+
>
|
|
471
|
+
<Picker.Item key="apple">Apple</Picker.Item>
|
|
472
|
+
<Picker.Item key="banana">Banana</Picker.Item>
|
|
473
|
+
</Picker>
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
### With Description
|
|
477
|
+
|
|
478
|
+
Add helpful description text below the label.
|
|
479
|
+
|
|
480
|
+
```jsx
|
|
481
|
+
<Picker
|
|
482
|
+
label="Favorite Fruit"
|
|
483
|
+
description="Choose your favorite fruit from the list"
|
|
484
|
+
placeholder="Select a fruit"
|
|
485
|
+
selectionMode="single"
|
|
486
|
+
>
|
|
487
|
+
<Picker.Item key="apple">Apple</Picker.Item>
|
|
488
|
+
<Picker.Item key="banana">Banana</Picker.Item>
|
|
489
|
+
</Picker>
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
## Accessibility
|
|
493
|
+
|
|
494
|
+
The Picker component is built with React Aria hooks and provides comprehensive accessibility support out of the box.
|
|
495
|
+
|
|
496
|
+
### Keyboard Navigation
|
|
497
|
+
|
|
498
|
+
- **`Tab`** — Moves focus to/from the trigger button
|
|
499
|
+
- **`Space`** or **`Enter`** — Opens the dropdown popover when focused on trigger
|
|
500
|
+
- **`Arrow Up`** or **`Arrow Down`** — Opens the popover when closed; navigates through items when open
|
|
501
|
+
- **`Escape`** — Closes the popover and returns focus to trigger
|
|
502
|
+
- **`Space`** or **`Enter`** — Selects the focused item (single mode closes popover automatically)
|
|
503
|
+
|
|
504
|
+
**In the popover:**
|
|
505
|
+
- Arrow keys navigate through items
|
|
506
|
+
- Home/End keys jump to first/last item
|
|
507
|
+
- Type-ahead: typing characters focuses matching items
|
|
508
|
+
- In multiple selection mode: Space toggles selection without closing
|
|
509
|
+
|
|
510
|
+
### Screen Reader Support
|
|
511
|
+
|
|
512
|
+
- Trigger button announces as "button" with current selection state
|
|
513
|
+
- When empty: announces placeholder text
|
|
514
|
+
- When selected: announces selected item(s) or count
|
|
515
|
+
- Popover opening/closing is announced to screen readers
|
|
516
|
+
- Item selection changes are announced immediately
|
|
517
|
+
- Loading state announces "loading" to users
|
|
518
|
+
- Validation errors are associated and announced
|
|
519
|
+
- Section headers are properly announced when navigating
|
|
520
|
+
|
|
521
|
+
### ARIA Properties
|
|
522
|
+
|
|
523
|
+
The component automatically manages ARIA attributes:
|
|
524
|
+
|
|
525
|
+
- **`aria-label`** — Labels the trigger when no visible label exists
|
|
526
|
+
- **`aria-labelledby`** — Associates the label with the trigger
|
|
527
|
+
- **`aria-expanded`** — Indicates whether the popover is open (true/false)
|
|
528
|
+
- **`aria-haspopup`** — Indicates the button controls a listbox (listbox)
|
|
529
|
+
- **`aria-describedby`** — Associates help text and error messages
|
|
530
|
+
- **`aria-invalid`** — Indicates validation state (true when invalid)
|
|
531
|
+
- **`aria-required`** — Indicates required fields (true when required)
|
|
532
|
+
- **`aria-disabled`** — Indicates disabled state
|
|
533
|
+
|
|
534
|
+
### Best Practices for Accessibility
|
|
535
|
+
|
|
536
|
+
1. **Always provide a label**: Use the `label` prop or `aria-label` for screen reader users
|
|
537
|
+
```jsx
|
|
538
|
+
<Picker label="Select Category">...</Picker>
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
2. **Use meaningful placeholders**: Placeholders should describe the expected selection
|
|
542
|
+
```jsx
|
|
543
|
+
<Picker placeholder="Choose a category" label="Category">...</Picker>
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
3. **Provide help text**: Use `description` for additional context
|
|
547
|
+
```jsx
|
|
548
|
+
<Picker
|
|
549
|
+
label="Priority"
|
|
550
|
+
description="Select the task priority level"
|
|
551
|
+
>...</Picker>
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
4. **Handle validation properly**: Use `validationState` and `message` props
|
|
555
|
+
```jsx
|
|
556
|
+
<Picker
|
|
557
|
+
validationState="invalid"
|
|
558
|
+
message="Please select an option"
|
|
559
|
+
>...</Picker>
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
5. **Use `textValue` for complex items**: Ensures screen readers can announce item content
|
|
563
|
+
```jsx
|
|
564
|
+
<Picker.Item textValue="User Name - Role">
|
|
565
|
+
<ComplexUserComponent />
|
|
566
|
+
</Picker.Item>
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
## Best Practices
|
|
570
|
+
|
|
571
|
+
1. **Do**: Provide clear, descriptive labels and placeholders
|
|
572
|
+
```jsx
|
|
573
|
+
<Picker
|
|
574
|
+
label="Product Category"
|
|
575
|
+
placeholder="Choose a category..."
|
|
576
|
+
selectionMode="single"
|
|
577
|
+
>
|
|
578
|
+
<Picker.Item key="electronics">Electronics</Picker.Item>
|
|
579
|
+
<Picker.Item key="clothing">Clothing</Picker.Item>
|
|
580
|
+
</Picker>
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
2. **Don't**: Use overly long option texts that will be truncated
|
|
584
|
+
```jsx
|
|
585
|
+
// Avoid
|
|
586
|
+
<Picker.Item key="long">
|
|
587
|
+
This is an extremely long option text that will be truncated and hard to read
|
|
588
|
+
</Picker.Item>
|
|
589
|
+
|
|
590
|
+
// Instead, use description
|
|
591
|
+
<Picker.Item key="short" description="Additional details here">
|
|
592
|
+
Short Label
|
|
593
|
+
</Picker.Item>
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
3. **Do**: Use sections for logical grouping
|
|
597
|
+
```jsx
|
|
598
|
+
<Picker label="Select Food" selectionMode="single">
|
|
599
|
+
<Picker.Section title="Fruits">
|
|
600
|
+
<Picker.Item key="apple">Apple</Picker.Item>
|
|
601
|
+
</Picker.Section>
|
|
602
|
+
<Picker.Section title="Vegetables">
|
|
603
|
+
<Picker.Item key="carrot">Carrot</Picker.Item>
|
|
604
|
+
</Picker.Section>
|
|
605
|
+
</Picker>
|
|
606
|
+
```
|
|
607
|
+
|
|
608
|
+
4. **Do**: Use the `items` prop for large datasets to enable virtualization
|
|
609
|
+
```jsx
|
|
610
|
+
<Picker items={largeDataset} label="Select Item">
|
|
611
|
+
{(item) => <Picker.Item key={item.id}>{item.name}</Picker.Item>}
|
|
612
|
+
</Picker>
|
|
613
|
+
```
|
|
614
|
+
|
|
615
|
+
5. **Do**: Use `isClearable` for optional single selections
|
|
616
|
+
```jsx
|
|
617
|
+
<Picker
|
|
618
|
+
label="Optional Filter"
|
|
619
|
+
selectionMode="single"
|
|
620
|
+
isClearable
|
|
621
|
+
placeholder="Choose an option..."
|
|
622
|
+
>
|
|
623
|
+
<Picker.Item key="option1">Option 1</Picker.Item>
|
|
624
|
+
</Picker>
|
|
625
|
+
```
|
|
626
|
+
|
|
627
|
+
6. **Do**: Use `showSelectAll` for efficient multiple selection
|
|
628
|
+
```jsx
|
|
629
|
+
<Picker
|
|
630
|
+
label="Permissions"
|
|
631
|
+
selectionMode="multiple"
|
|
632
|
+
showSelectAll
|
|
633
|
+
selectAllLabel="All Permissions"
|
|
634
|
+
isCheckable
|
|
635
|
+
>
|
|
636
|
+
<Picker.Item key="read">Read</Picker.Item>
|
|
637
|
+
<Picker.Item key="write">Write</Picker.Item>
|
|
638
|
+
</Picker>
|
|
639
|
+
```
|
|
640
|
+
|
|
641
|
+
7. **Do**: Use `isCheckable` in multiple selection mode for clarity
|
|
642
|
+
```jsx
|
|
643
|
+
<Picker
|
|
644
|
+
label="Select Options"
|
|
645
|
+
selectionMode="multiple"
|
|
646
|
+
isCheckable
|
|
647
|
+
>
|
|
648
|
+
<Picker.Item key="option1">Option 1</Picker.Item>
|
|
649
|
+
</Picker>
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
8. **Accessibility**: Always provide meaningful `aria-label` when label is not visible
|
|
653
|
+
9. **Performance**: Use `textValue` prop for items with complex content
|
|
654
|
+
10. **UX**: Provide feedback for empty states and loading states
|
|
655
|
+
|
|
656
|
+
## Integration with Forms
|
|
657
|
+
|
|
658
|
+
This component supports all [Field properties](../../FieldProperties.md) when used within a Form context. The Picker automatically handles form validation, touched states, error messages, and integrates seamlessly with form submission.
|
|
659
|
+
|
|
660
|
+
### Basic Form Integration
|
|
661
|
+
|
|
662
|
+
```jsx
|
|
663
|
+
import { Form, Picker } from '@cube-dev/ui-kit';
|
|
664
|
+
|
|
665
|
+
function MyForm() {
|
|
666
|
+
const handleSubmit = (values) => {
|
|
667
|
+
console.log('Form values:', values);
|
|
668
|
+
};
|
|
669
|
+
|
|
670
|
+
return (
|
|
671
|
+
<Form onSubmit={handleSubmit}>
|
|
672
|
+
<Picker
|
|
673
|
+
name="category"
|
|
674
|
+
label="Product Category"
|
|
675
|
+
isRequired
|
|
676
|
+
selectionMode="single"
|
|
677
|
+
placeholder="Select a category"
|
|
678
|
+
rules={[{ required: true, message: 'Category is required' }]}
|
|
679
|
+
>
|
|
680
|
+
<Picker.Item key="electronics">Electronics</Picker.Item>
|
|
681
|
+
<Picker.Item key="clothing">Clothing</Picker.Item>
|
|
682
|
+
<Picker.Item key="books">Books</Picker.Item>
|
|
683
|
+
</Picker>
|
|
684
|
+
|
|
685
|
+
<Button type="submit">Submit</Button>
|
|
686
|
+
</Form>
|
|
687
|
+
);
|
|
688
|
+
}
|
|
689
|
+
```
|
|
690
|
+
|
|
691
|
+
### Multiple Selection in Forms
|
|
692
|
+
|
|
693
|
+
```jsx
|
|
694
|
+
<Form onSubmit={handleSubmit}>
|
|
695
|
+
<Picker
|
|
696
|
+
name="tags"
|
|
697
|
+
label="Tags"
|
|
698
|
+
selectionMode="multiple"
|
|
699
|
+
isCheckable
|
|
700
|
+
placeholder="Select tags"
|
|
701
|
+
defaultValue={['tag1', 'tag2']}
|
|
702
|
+
rules={[
|
|
703
|
+
{ required: true, message: 'At least one tag is required' },
|
|
704
|
+
{ type: 'array', min: 2, message: 'Select at least 2 tags' }
|
|
705
|
+
]}
|
|
706
|
+
>
|
|
707
|
+
<Picker.Item key="tag1">Tag 1</Picker.Item>
|
|
708
|
+
<Picker.Item key="tag2">Tag 2</Picker.Item>
|
|
709
|
+
<Picker.Item key="tag3">Tag 3</Picker.Item>
|
|
710
|
+
</Picker>
|
|
711
|
+
|
|
712
|
+
<Button type="submit">Submit</Button>
|
|
713
|
+
</Form>
|
|
714
|
+
```
|
|
715
|
+
|
|
716
|
+
### Key Form Properties
|
|
717
|
+
|
|
718
|
+
- **`name`** — Field name in form data (required for form integration)
|
|
719
|
+
- **`rules`** — Validation rules array
|
|
720
|
+
- **`defaultValue`** — Initial value (use with uncontrolled forms)
|
|
721
|
+
- **`value`** — Controlled value (use with controlled forms)
|
|
722
|
+
- **`isRequired`** — Marks field as required and adds visual indicator
|
|
723
|
+
- **`validationState`** — Manual validation state control
|
|
724
|
+
- **`message`** — Error or help message
|
|
725
|
+
|
|
726
|
+
## Advanced Features
|
|
727
|
+
|
|
728
|
+
### Custom Summary Rendering
|
|
729
|
+
|
|
730
|
+
Customize how the selection is displayed in the trigger button. The `renderSummary` function receives different parameters based on selection mode:
|
|
731
|
+
|
|
732
|
+
```jsx
|
|
733
|
+
const renderSummary = ({ selectedLabels, selectedKeys, selectionMode }) => {
|
|
734
|
+
if (selectionMode === 'single') {
|
|
735
|
+
return selectedLabels?.[0] ? `Selected: ${selectedLabels[0]}` : null;
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
if (!selectedKeys || selectedKeys.length === 0) return null;
|
|
739
|
+
if (selectedKeys === 'all') return 'All items selected';
|
|
740
|
+
if (selectedKeys.length === 1) return selectedLabels[0];
|
|
741
|
+
if (selectedKeys.length <= 3) return selectedLabels.join(', ');
|
|
742
|
+
return `${selectedKeys.length} items selected`;
|
|
743
|
+
};
|
|
744
|
+
|
|
745
|
+
<Picker
|
|
746
|
+
label="Custom Summary"
|
|
747
|
+
selectionMode="multiple"
|
|
748
|
+
renderSummary={renderSummary}
|
|
749
|
+
>
|
|
750
|
+
<Picker.Item key="apple">Apple</Picker.Item>
|
|
751
|
+
<Picker.Item key="banana">Banana</Picker.Item>
|
|
752
|
+
<Picker.Item key="orange">Orange</Picker.Item>
|
|
753
|
+
</Picker>
|
|
754
|
+
```
|
|
755
|
+
|
|
756
|
+
### Icon-Only Mode
|
|
757
|
+
|
|
758
|
+
For space-constrained interfaces, hide the summary text and show only an icon:
|
|
759
|
+
|
|
760
|
+
```jsx
|
|
761
|
+
<Picker
|
|
762
|
+
renderSummary={false}
|
|
763
|
+
icon={<FilterIcon />}
|
|
764
|
+
aria-label="Filter options"
|
|
765
|
+
type="clear"
|
|
766
|
+
selectionMode="multiple"
|
|
767
|
+
>
|
|
768
|
+
<Picker.Item key="option1">Option 1</Picker.Item>
|
|
769
|
+
<Picker.Item key="option2">Option 2</Picker.Item>
|
|
770
|
+
</Picker>
|
|
771
|
+
```
|
|
772
|
+
|
|
773
|
+
### Controlled Mode
|
|
774
|
+
|
|
775
|
+
Full control over selection state for integration with external state management:
|
|
776
|
+
|
|
777
|
+
**Single Selection:**
|
|
778
|
+
```jsx
|
|
779
|
+
const [selectedKey, setSelectedKey] = useState(null);
|
|
780
|
+
|
|
781
|
+
<Picker
|
|
782
|
+
label="Controlled Picker"
|
|
783
|
+
selectionMode="single"
|
|
784
|
+
selectedKey={selectedKey}
|
|
785
|
+
onSelectionChange={(key) => setSelectedKey(key)}
|
|
786
|
+
>
|
|
787
|
+
<Picker.Item key="apple">Apple</Picker.Item>
|
|
788
|
+
<Picker.Item key="banana">Banana</Picker.Item>
|
|
789
|
+
</Picker>
|
|
790
|
+
```
|
|
791
|
+
|
|
792
|
+
**Multiple Selection:**
|
|
793
|
+
```jsx
|
|
794
|
+
const [selectedKeys, setSelectedKeys] = useState([]);
|
|
795
|
+
|
|
796
|
+
<Picker
|
|
797
|
+
label="Controlled Multiple"
|
|
798
|
+
selectionMode="multiple"
|
|
799
|
+
isCheckable
|
|
800
|
+
selectedKeys={selectedKeys}
|
|
801
|
+
onSelectionChange={(keys) => {
|
|
802
|
+
if (keys === 'all') {
|
|
803
|
+
setSelectedKeys(['apple', 'banana', 'orange']);
|
|
804
|
+
} else {
|
|
805
|
+
setSelectedKeys(keys);
|
|
806
|
+
}
|
|
807
|
+
}}
|
|
808
|
+
>
|
|
809
|
+
<Picker.Item key="apple">Apple</Picker.Item>
|
|
810
|
+
<Picker.Item key="banana">Banana</Picker.Item>
|
|
811
|
+
<Picker.Item key="orange">Orange</Picker.Item>
|
|
812
|
+
</Picker>
|
|
813
|
+
```
|
|
814
|
+
|
|
815
|
+
### Dynamic Items with Sorting
|
|
816
|
+
|
|
817
|
+
Use the `items` prop with `sortSelectedToTop` to automatically sort selected items to the top when the picker opens:
|
|
818
|
+
|
|
819
|
+
```jsx
|
|
820
|
+
const fruits = [
|
|
821
|
+
{ key: 'apple', label: 'Apple' },
|
|
822
|
+
{ key: 'banana', label: 'Banana' },
|
|
823
|
+
{ key: 'orange', label: 'Orange' },
|
|
824
|
+
{ key: 'mango', label: 'Mango' },
|
|
825
|
+
];
|
|
826
|
+
|
|
827
|
+
<Picker
|
|
828
|
+
label="Sorted Picker"
|
|
829
|
+
items={fruits}
|
|
830
|
+
sortSelectedToTop
|
|
831
|
+
defaultSelectedKeys={['banana', 'mango']}
|
|
832
|
+
selectionMode="multiple"
|
|
833
|
+
isCheckable
|
|
834
|
+
>
|
|
835
|
+
{(item) => <Picker.Item key={item.key}>{item.label}</Picker.Item>}
|
|
836
|
+
</Picker>
|
|
837
|
+
```
|
|
838
|
+
|
|
839
|
+
## Performance
|
|
840
|
+
|
|
841
|
+
### Optimization Tips
|
|
842
|
+
|
|
843
|
+
1. **Use Dynamic Content Pattern for Large Lists**
|
|
844
|
+
- For lists with 50+ items, use the `items` prop with a render function
|
|
845
|
+
- This enables automatic virtualization for better performance
|
|
846
|
+
- Only visible items are rendered in the DOM
|
|
847
|
+
|
|
848
|
+
2. **Avoid Sections with Large Datasets**
|
|
849
|
+
- Virtualization is disabled when sections are present
|
|
850
|
+
- For large lists, prefer flat structure or use filtering instead
|
|
851
|
+
|
|
852
|
+
3. **Provide `textValue` for Complex Content**
|
|
853
|
+
- When items contain complex JSX, provide a `textValue` prop
|
|
854
|
+
- This helps with accessibility and potential search functionality
|
|
855
|
+
|
|
856
|
+
4. **Consider Controlled Mode for Expensive Operations**
|
|
857
|
+
- Use controlled mode to debounce expensive operations
|
|
858
|
+
- Handle state updates efficiently in your own state management
|
|
859
|
+
|
|
860
|
+
### Virtualization
|
|
861
|
+
|
|
862
|
+
Virtualization is automatically enabled when using the `items` prop without sections:
|
|
863
|
+
|
|
864
|
+
```jsx
|
|
865
|
+
// ✅ Virtualized - excellent performance with thousands of items
|
|
866
|
+
<Picker
|
|
867
|
+
items={thousandsOfItems}
|
|
868
|
+
label="Large Dataset"
|
|
869
|
+
>
|
|
870
|
+
{(item) => <Picker.Item key={item.id}>{item.name}</Picker.Item>}
|
|
871
|
+
</Picker>
|
|
872
|
+
|
|
873
|
+
// ❌ Not virtualized - sections disable virtualization
|
|
874
|
+
<Picker items={largeArray}>
|
|
875
|
+
<Picker.Section title="All Items">
|
|
876
|
+
{largeArray.map(item => (
|
|
877
|
+
<Picker.Item key={item.id}>{item.name}</Picker.Item>
|
|
878
|
+
))}
|
|
879
|
+
</Picker.Section>
|
|
880
|
+
</Picker>
|
|
881
|
+
```
|
|
882
|
+
|
|
883
|
+
### Content Optimization
|
|
884
|
+
|
|
885
|
+
Optimize complex item content with the `textValue` prop for better accessibility:
|
|
886
|
+
|
|
887
|
+
```jsx
|
|
888
|
+
<Picker label="Select User" items={users}>
|
|
889
|
+
{(user) => (
|
|
890
|
+
<Picker.Item
|
|
891
|
+
key={user.id}
|
|
892
|
+
textValue={`${user.name} - ${user.role}`}
|
|
893
|
+
>
|
|
894
|
+
<UserCard user={user} />
|
|
895
|
+
</Picker.Item>
|
|
896
|
+
)}
|
|
897
|
+
</Picker>
|
|
898
|
+
```
|
|
899
|
+
|
|
900
|
+
## Related Components
|
|
901
|
+
|
|
902
|
+
- [ComboBox](./ComboBox.md) - Use when you need search/filter functionality or custom value entry
|
|
903
|
+
- [ListBox](./ListBox.md) - Use for always-visible list selection without a trigger
|
|
904
|
+
- [Select](./Select.md) - Use for native select behavior
|
|
905
|
+
- [Button](../actions/Button.md) - The underlying trigger component
|
|
906
|
+
- [Dialog](../overlays/Dialog.md) - The popover container component
|