@vjdesigns/vjdesigns-ui 3.3.0 → 3.5.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/CHANGELOG.md +169 -0
- package/README.md +854 -864
- package/dist/components/data-display/Accordion/Accordion.mjs +97 -166
- package/dist/components/data-display/Chat/Chat.d.ts +13 -2
- package/dist/components/data-display/Collapsible/Collapsible.d.ts +70 -0
- package/dist/components/data-display/Collapsible/Collapsible.mjs +102 -0
- package/dist/components/data-display/Collapsible/Collapsible.module.css.mjs +8 -0
- package/dist/components/data-display/Collapsible/index.d.ts +1 -0
- package/dist/components/feedback/Progress/Progress.d.ts +32 -2
- package/dist/components/feedback/Progress/Progress.mjs +78 -74
- package/dist/components/feedback/Progress/Progress.module.css.mjs +1 -1
- package/dist/components/forms/CheckBox/CheckBox.mjs +171 -135
- package/dist/components/forms/CheckBox/CheckBox.module.css.mjs +5 -3
- package/dist/components/forms/Radio/Radio.mjs +12 -10
- package/dist/components/forms/ToggleGroup/ToggleGroup.mjs +133 -131
- package/dist/components/navigation/Toolbar/Toolbar.mjs +106 -0
- package/dist/components/navigation/Toolbar/Toolbar.module.css.mjs +11 -0
- package/dist/components/navigation/Toolbar/ToolbarContext.mjs +4 -0
- package/dist/components/navigation/Toolbar/index.d.ts +1 -0
- package/dist/components/primitives/CopyButton/CopyButton.d.ts +39 -0
- package/dist/components/primitives/CopyButton/CopyButton.mjs +49 -0
- package/dist/components/primitives/CopyButton/index.d.ts +1 -0
- package/dist/hooks/useCollapsePresence.mjs +83 -0
- package/dist/i18n/en.mjs +5 -0
- package/dist/index.mjs +104 -101
- package/dist/locales/ar.mjs +5 -0
- package/dist/locales/bn.mjs +5 -0
- package/dist/locales/cs.mjs +5 -0
- package/dist/locales/da.mjs +5 -0
- package/dist/locales/de.mjs +5 -0
- package/dist/locales/el.mjs +5 -0
- package/dist/locales/es.mjs +5 -0
- package/dist/locales/fa.mjs +5 -0
- package/dist/locales/fi.mjs +5 -0
- package/dist/locales/fr.mjs +5 -0
- package/dist/locales/he.mjs +5 -0
- package/dist/locales/hi.mjs +5 -0
- package/dist/locales/hu.mjs +5 -0
- package/dist/locales/id.mjs +5 -0
- package/dist/locales/it.mjs +5 -0
- package/dist/locales/ja.mjs +5 -0
- package/dist/locales/ko.mjs +5 -0
- package/dist/locales/nb.mjs +5 -0
- package/dist/locales/nl.mjs +5 -0
- package/dist/locales/pl.mjs +5 -0
- package/dist/locales/pt-BR.mjs +5 -0
- package/dist/locales/ro.mjs +5 -0
- package/dist/locales/ru.mjs +5 -0
- package/dist/locales/sv.mjs +5 -0
- package/dist/locales/th.mjs +5 -0
- package/dist/locales/tr.mjs +5 -0
- package/dist/locales/uk.mjs +5 -0
- package/dist/locales/ur.mjs +5 -0
- package/dist/locales/vi.mjs +5 -0
- package/dist/locales/zh-Hans.mjs +5 -0
- package/dist/locales/zh-Hant.mjs +5 -0
- package/dist/vjdesigns-ui.css +1 -1
- package/package.json +7 -5
- package/dist/ai/llms-full.txt +0 -8498
- package/dist/ai/llms.txt +0 -198
- package/dist/ai/mcp-server.mjs +0 -212
- package/dist/ai/registry.json +0 -21048
- package/dist/components/data-display/Accordion/Accordion.cjs.js +0 -1
- package/dist/components/data-display/Accordion/Accordion.module.css.cjs.js +0 -1
- package/dist/components/data-display/Avatar/Avatar.cjs.js +0 -1
- package/dist/components/data-display/Avatar/Avatar.module.css.cjs.js +0 -1
- package/dist/components/data-display/Badge/Badge.cjs.js +0 -1
- package/dist/components/data-display/Badge/Badge.module.css.cjs.js +0 -1
- package/dist/components/data-display/Card/Card.cjs.js +0 -1
- package/dist/components/data-display/Card/Card.module.css.cjs.js +0 -1
- package/dist/components/data-display/Carousel/Carousel.cjs.js +0 -1
- package/dist/components/data-display/Carousel/Carousel.module.css.cjs.js +0 -1
- package/dist/components/data-display/Chat/Chat.cjs.js +0 -1
- package/dist/components/data-display/Chat/Chat.module.css.cjs.js +0 -1
- package/dist/components/data-display/Chat/streams.cjs.js +0 -4
- package/dist/components/data-display/Chip/Chip.cjs.js +0 -1
- package/dist/components/data-display/Chip/Chip.module.css.cjs.js +0 -1
- package/dist/components/data-display/CodeBlock/CodeBlock.cjs.js +0 -6
- package/dist/components/data-display/CodeBlock/CodeBlock.module.css.cjs.js +0 -1
- package/dist/components/data-display/CodeBlock/tokenize.cjs.js +0 -13
- package/dist/components/data-display/CodeBlock/tokenize.d.ts +0 -26
- package/dist/components/data-display/Countdown/Countdown.cjs.js +0 -1
- package/dist/components/data-display/Countdown/Countdown.module.css.cjs.js +0 -1
- package/dist/components/data-display/DataGrid/DataGrid.cjs.js +0 -1
- package/dist/components/data-display/DataGrid/DataGrid.module.css.cjs.js +0 -1
- package/dist/components/data-display/DataGrid/dataGridUtils.cjs.js +0 -1
- package/dist/components/data-display/DataGrid/dataGridUtils.d.ts +0 -46
- package/dist/components/data-display/EmptyState/EmptyState.cjs.js +0 -1
- package/dist/components/data-display/EmptyState/EmptyState.module.css.cjs.js +0 -1
- package/dist/components/data-display/Image/Image.cjs.js +0 -1
- package/dist/components/data-display/Image/Image.module.css.cjs.js +0 -1
- package/dist/components/data-display/List/List.cjs.js +0 -1
- package/dist/components/data-display/List/List.module.css.cjs.js +0 -1
- package/dist/components/data-display/Stat/Stat.cjs.js +0 -1
- package/dist/components/data-display/Stat/Stat.module.css.cjs.js +0 -1
- package/dist/components/data-display/Table/Table.cjs.js +0 -1
- package/dist/components/data-display/Table/Table.module.css.cjs.js +0 -1
- package/dist/components/data-display/Table/useTable.cjs.js +0 -1
- package/dist/components/data-display/Table/useTable.d.ts +0 -118
- package/dist/components/data-display/Timeline/Timeline.cjs.js +0 -1
- package/dist/components/data-display/Timeline/Timeline.module.css.cjs.js +0 -1
- package/dist/components/data-display/TreeView/TreeView.cjs.js +0 -1
- package/dist/components/data-display/TreeView/TreeView.module.css.cjs.js +0 -1
- package/dist/components/data-display/TreeView/treeUtils.cjs.js +0 -1
- package/dist/components/data-display/TreeView/treeUtils.d.ts +0 -82
- package/dist/components/data-display/VirtualList/VirtualList.cjs.js +0 -1
- package/dist/components/data-display/VirtualList/VirtualList.module.css.cjs.js +0 -1
- package/dist/components/feedback/Alert/Alert.cjs.js +0 -1
- package/dist/components/feedback/Alert/Alert.module.css.cjs.js +0 -1
- package/dist/components/feedback/Banner/Banner.cjs.js +0 -1
- package/dist/components/feedback/Banner/Banner.module.css.cjs.js +0 -1
- package/dist/components/feedback/ErrorSummary/ErrorSummary.cjs.js +0 -1
- package/dist/components/feedback/ErrorSummary/ErrorSummary.module.css.cjs.js +0 -1
- package/dist/components/feedback/Progress/Progress.cjs.js +0 -1
- package/dist/components/feedback/Progress/Progress.module.css.cjs.js +0 -1
- package/dist/components/feedback/Skeleton/Skeleton.cjs.js +0 -1
- package/dist/components/feedback/Skeleton/Skeleton.module.css.cjs.js +0 -1
- package/dist/components/feedback/Spinner/Spinner.cjs.js +0 -1
- package/dist/components/feedback/Spinner/Spinner.module.css.cjs.js +0 -1
- package/dist/components/feedback/Toast/Toast.cjs.js +0 -1
- package/dist/components/feedback/Toast/Toast.module.css.cjs.js +0 -1
- package/dist/components/feedback/Toast/Toast.storyHelpers.d.ts +0 -21
- package/dist/components/feedback/Toast/ToastItem.cjs.js +0 -1
- package/dist/components/feedback/Toast/ToastItem.d.ts +0 -18
- package/dist/components/feedback/Toast/ToastProvider.cjs.js +0 -1
- package/dist/components/feedback/Toast/ToastViewport.cjs.js +0 -1
- package/dist/components/feedback/Toast/ToastViewport.d.ts +0 -25
- package/dist/components/feedback/Toast/toastStore.cjs.js +0 -1
- package/dist/components/feedback/Toast/toastTiming.cjs.js +0 -1
- package/dist/components/feedback/Toast/toastTypes.d.ts +0 -136
- package/dist/components/feedback/Toast/useToast.cjs.js +0 -1
- package/dist/components/feedback/Toast/useToastAnnouncer.cjs.js +0 -1
- package/dist/components/feedback/Toast/useToastAnnouncer.d.ts +0 -15
- package/dist/components/forms/CheckBox/CheckBox.cjs.js +0 -1
- package/dist/components/forms/CheckBox/CheckBox.d.ts +0 -79
- package/dist/components/forms/CheckBox/CheckBox.module.css.cjs.js +0 -1
- package/dist/components/forms/ColorPicker/ColorInput.cjs.js +0 -1
- package/dist/components/forms/ColorPicker/ColorInput.d.ts +0 -38
- package/dist/components/forms/ColorPicker/ColorPicker.cjs.js +0 -1
- package/dist/components/forms/ColorPicker/ColorPicker.d.ts +0 -129
- package/dist/components/forms/ColorPicker/ColorPicker.module.css.cjs.js +0 -1
- package/dist/components/forms/ColorPicker/colorUtils.cjs.js +0 -1
- package/dist/components/forms/ColorPicker/colorUtils.d.ts +0 -86
- package/dist/components/forms/Combobox/Combobox.cjs.js +0 -1
- package/dist/components/forms/Combobox/Combobox.d.ts +0 -172
- package/dist/components/forms/Combobox/Combobox.module.css.cjs.js +0 -1
- package/dist/components/forms/Combobox/ComboboxPopup.cjs.js +0 -1
- package/dist/components/forms/Combobox/ComboboxPopup.d.ts +0 -40
- package/dist/components/forms/Combobox/comboboxUtils.cjs.js +0 -1
- package/dist/components/forms/Combobox/comboboxUtils.d.ts +0 -73
- package/dist/components/forms/DatePicker/Calendar.cjs.js +0 -1
- package/dist/components/forms/DatePicker/Calendar.d.ts +0 -98
- package/dist/components/forms/DatePicker/Calendar.module.css.cjs.js +0 -1
- package/dist/components/forms/DatePicker/DatePicker.cjs.js +0 -1
- package/dist/components/forms/DatePicker/DatePicker.d.ts +0 -100
- package/dist/components/forms/DatePicker/DatePicker.module.css.cjs.js +0 -1
- package/dist/components/forms/DatePicker/DateRangePicker.cjs.js +0 -1
- package/dist/components/forms/DatePicker/DateRangePicker.d.ts +0 -124
- package/dist/components/forms/DatePicker/DateRangePicker.module.css.cjs.js +0 -1
- package/dist/components/forms/DatePicker/dateUtils.cjs.js +0 -1
- package/dist/components/forms/DatePicker/dateUtils.d.ts +0 -88
- package/dist/components/forms/DateTimePicker/DateTimePicker.cjs.js +0 -1
- package/dist/components/forms/DateTimePicker/DateTimePicker.d.ts +0 -101
- package/dist/components/forms/DateTimePicker/DateTimePicker.module.css.cjs.js +0 -1
- package/dist/components/forms/Field/Field.cjs.js +0 -1
- package/dist/components/forms/Field/Field.d.ts +0 -171
- package/dist/components/forms/Field/Field.module.css.cjs.js +0 -1
- package/dist/components/forms/Field/FieldContext.cjs.js +0 -1
- package/dist/components/forms/Field/FieldContext.d.ts +0 -74
- package/dist/components/forms/FileUpload/FileUpload.cjs.js +0 -1
- package/dist/components/forms/FileUpload/FileUpload.d.ts +0 -153
- package/dist/components/forms/FileUpload/FileUpload.module.css.cjs.js +0 -1
- package/dist/components/forms/Input/Input.cjs.js +0 -1
- package/dist/components/forms/Input/Input.d.ts +0 -98
- package/dist/components/forms/Input/Input.module.css.cjs.js +0 -1
- package/dist/components/forms/NumberInput/NumberInput.cjs.js +0 -1
- package/dist/components/forms/NumberInput/NumberInput.d.ts +0 -87
- package/dist/components/forms/NumberInput/NumberInput.module.css.cjs.js +0 -1
- package/dist/components/forms/PasswordInput/PasswordInput.cjs.js +0 -1
- package/dist/components/forms/PasswordInput/PasswordInput.d.ts +0 -117
- package/dist/components/forms/PasswordInput/PasswordInput.module.css.cjs.js +0 -1
- package/dist/components/forms/PinInput/PinInput.cjs.js +0 -1
- package/dist/components/forms/PinInput/PinInput.d.ts +0 -92
- package/dist/components/forms/PinInput/PinInput.module.css.cjs.js +0 -1
- package/dist/components/forms/Radio/Radio.cjs.js +0 -1
- package/dist/components/forms/Radio/Radio.d.ts +0 -119
- package/dist/components/forms/Radio/Radio.module.css.cjs.js +0 -1
- package/dist/components/forms/Rating/Rating.cjs.js +0 -1
- package/dist/components/forms/Rating/Rating.d.ts +0 -128
- package/dist/components/forms/Rating/Rating.module.css.cjs.js +0 -1
- package/dist/components/forms/SearchInput/SearchInput.cjs.js +0 -1
- package/dist/components/forms/SearchInput/SearchInput.d.ts +0 -124
- package/dist/components/forms/SearchInput/SearchInput.module.css.cjs.js +0 -1
- package/dist/components/forms/SegmentedControl/SegmentedControl.cjs.js +0 -1
- package/dist/components/forms/SegmentedControl/SegmentedControl.d.ts +0 -120
- package/dist/components/forms/SegmentedControl/SegmentedControl.module.css.cjs.js +0 -1
- package/dist/components/forms/Select/Select.cjs.js +0 -1
- package/dist/components/forms/Select/Select.d.ts +0 -86
- package/dist/components/forms/Select/Select.module.css.cjs.js +0 -1
- package/dist/components/forms/Slider/Slider.cjs.js +0 -1
- package/dist/components/forms/Slider/Slider.d.ts +0 -84
- package/dist/components/forms/Slider/Slider.module.css.cjs.js +0 -1
- package/dist/components/forms/Switch/Switch.cjs.js +0 -1
- package/dist/components/forms/Switch/Switch.d.ts +0 -62
- package/dist/components/forms/Switch/Switch.module.css.cjs.js +0 -1
- package/dist/components/forms/TagInput/TagInput.cjs.js +0 -1
- package/dist/components/forms/TagInput/TagInput.d.ts +0 -144
- package/dist/components/forms/TagInput/TagInput.module.css.cjs.js +0 -1
- package/dist/components/forms/Textarea/Textarea.cjs.js +0 -1
- package/dist/components/forms/Textarea/Textarea.d.ts +0 -62
- package/dist/components/forms/Textarea/Textarea.module.css.cjs.js +0 -1
- package/dist/components/forms/TimePicker/TimePicker.cjs.js +0 -1
- package/dist/components/forms/TimePicker/TimePicker.d.ts +0 -116
- package/dist/components/forms/TimePicker/TimePicker.module.css.cjs.js +0 -1
- package/dist/components/forms/TimePicker/timeUtils.cjs.js +0 -1
- package/dist/components/forms/TimePicker/timeUtils.d.ts +0 -26
- package/dist/components/forms/ToggleGroup/ToggleGroup.cjs.js +0 -1
- package/dist/components/forms/ToggleGroup/ToggleGroup.d.ts +0 -153
- package/dist/components/forms/ToggleGroup/ToggleGroup.module.css.cjs.js +0 -1
- package/dist/components/layout/Box/Box.cjs.js +0 -1
- package/dist/components/layout/Box/Box.module.css.cjs.js +0 -1
- package/dist/components/layout/Container/Container.cjs.js +0 -1
- package/dist/components/layout/Container/Container.module.css.cjs.js +0 -1
- package/dist/components/layout/Divider/Divider.cjs.js +0 -1
- package/dist/components/layout/Divider/Divider.module.css.cjs.js +0 -1
- package/dist/components/layout/Flex/Flex.cjs.js +0 -1
- package/dist/components/layout/Flex/Flex.module.css.cjs.js +0 -1
- package/dist/components/layout/Grid/Grid.cjs.js +0 -1
- package/dist/components/layout/Grid/Grid.module.css.cjs.js +0 -1
- package/dist/components/layout/ResizablePanels/ResizablePanels.cjs.js +0 -1
- package/dist/components/layout/ResizablePanels/ResizablePanels.module.css.cjs.js +0 -1
- package/dist/components/layout/ScrollArea/ScrollArea.cjs.js +0 -1
- package/dist/components/layout/ScrollArea/ScrollArea.module.css.cjs.js +0 -1
- package/dist/components/layout/Stack/Stack.cjs.js +0 -1
- package/dist/components/layout/Stack/Stack.module.css.cjs.js +0 -1
- package/dist/components/navigation/Breadcrumbs/Breadcrumbs.cjs.js +0 -1
- package/dist/components/navigation/Breadcrumbs/Breadcrumbs.module.css.cjs.js +0 -1
- package/dist/components/navigation/ContextMenu/ContextMenu.cjs.js +0 -1
- package/dist/components/navigation/ContextMenu/ContextMenu.module.css.cjs.js +0 -1
- package/dist/components/navigation/Link/Link.cjs.js +0 -1
- package/dist/components/navigation/Link/Link.module.css.cjs.js +0 -1
- package/dist/components/navigation/Menu/Menu.cjs.js +0 -1
- package/dist/components/navigation/Menu/Menu.module.css.cjs.js +0 -1
- package/dist/components/navigation/Menu/MenuContent.cjs.js +0 -1
- package/dist/components/navigation/Menu/MenuContent.d.ts +0 -46
- package/dist/components/navigation/Menu/MenuContext.cjs.js +0 -1
- package/dist/components/navigation/Menu/MenuContext.d.ts +0 -84
- package/dist/components/navigation/Menu/MenuItem.cjs.js +0 -1
- package/dist/components/navigation/Menu/MenuItem.d.ts +0 -133
- package/dist/components/navigation/Menu/MenuSub.cjs.js +0 -1
- package/dist/components/navigation/Menu/MenuSub.d.ts +0 -28
- package/dist/components/navigation/Menu/useMenuRoot.cjs.js +0 -1
- package/dist/components/navigation/Menu/useMenuRoot.d.ts +0 -14
- package/dist/components/navigation/Navbar/Navbar.cjs.js +0 -1
- package/dist/components/navigation/Navbar/Navbar.module.css.cjs.js +0 -1
- package/dist/components/navigation/Pagination/Pagination.cjs.js +0 -1
- package/dist/components/navigation/Pagination/Pagination.d.ts +0 -97
- package/dist/components/navigation/Pagination/Pagination.module.css.cjs.js +0 -1
- package/dist/components/navigation/Sidebar/Sidebar.cjs.js +0 -1
- package/dist/components/navigation/Sidebar/Sidebar.module.css.cjs.js +0 -1
- package/dist/components/navigation/Sidebar/Sidebar.storyHelpers.d.ts +0 -27
- package/dist/components/navigation/Sidebar/SidebarContext.cjs.js +0 -1
- package/dist/components/navigation/Sidebar/SidebarContext.d.ts +0 -45
- package/dist/components/navigation/Sidebar/SidebarParts.cjs.js +0 -1
- package/dist/components/navigation/Sidebar/SidebarParts.d.ts +0 -179
- package/dist/components/navigation/SkipLink/SkipLink.cjs.js +0 -1
- package/dist/components/navigation/SkipLink/SkipLink.d.ts +0 -41
- package/dist/components/navigation/SkipLink/SkipLink.module.css.cjs.js +0 -1
- package/dist/components/navigation/Stepper/Stepper.cjs.js +0 -1
- package/dist/components/navigation/Stepper/Stepper.module.css.cjs.js +0 -1
- package/dist/components/navigation/Tabs/Tabs.cjs.js +0 -1
- package/dist/components/navigation/Tabs/Tabs.d.ts +0 -132
- package/dist/components/navigation/Tabs/Tabs.module.css.cjs.js +0 -1
- package/dist/components/overlays/CommandPalette/CommandPalette.cjs.js +0 -1
- package/dist/components/overlays/CommandPalette/CommandPalette.module.css.cjs.js +0 -1
- package/dist/components/overlays/CommandPalette/CommandPaletteContext.cjs.js +0 -1
- package/dist/components/overlays/CommandPalette/CommandPaletteContext.d.ts +0 -96
- package/dist/components/overlays/CommandPalette/CommandPaletteParts.cjs.js +0 -1
- package/dist/components/overlays/CommandPalette/CommandPaletteParts.d.ts +0 -115
- package/dist/components/overlays/CommandPalette/commandPaletteUtils.cjs.js +0 -1
- package/dist/components/overlays/CommandPalette/commandPaletteUtils.d.ts +0 -50
- package/dist/components/overlays/Drawer/Drawer.cjs.js +0 -1
- package/dist/components/overlays/Drawer/Drawer.module.css.cjs.js +0 -1
- package/dist/components/overlays/Drawer/Drawer.storyHelpers.d.ts +0 -16
- package/dist/components/overlays/Drawer/DrawerContent.cjs.js +0 -1
- package/dist/components/overlays/Drawer/DrawerContent.d.ts +0 -27
- package/dist/components/overlays/Drawer/DrawerContext.cjs.js +0 -1
- package/dist/components/overlays/Drawer/DrawerContext.d.ts +0 -39
- package/dist/components/overlays/Drawer/DrawerParts.cjs.js +0 -1
- package/dist/components/overlays/Drawer/DrawerParts.d.ts +0 -65
- package/dist/components/overlays/Drawer/internal.cjs.js +0 -1
- package/dist/components/overlays/Drawer/internal.d.ts +0 -1
- package/dist/components/overlays/Drawer/useDragToClose.cjs.js +0 -1
- package/dist/components/overlays/Drawer/useDragToClose.d.ts +0 -28
- package/dist/components/overlays/HoverCard/HoverCard.cjs.js +0 -1
- package/dist/components/overlays/HoverCard/HoverCard.module.css.cjs.js +0 -1
- package/dist/components/overlays/Modal/ConfirmModal.cjs.js +0 -1
- package/dist/components/overlays/Modal/Modal.cjs.js +0 -1
- package/dist/components/overlays/Modal/Modal.module.css.cjs.js +0 -1
- package/dist/components/overlays/Modal/ModalContent.cjs.js +0 -1
- package/dist/components/overlays/Modal/ModalContent.d.ts +0 -12
- package/dist/components/overlays/Modal/ModalContext.cjs.js +0 -1
- package/dist/components/overlays/Modal/ModalContext.d.ts +0 -56
- package/dist/components/overlays/Modal/useScrollRegion.cjs.js +0 -1
- package/dist/components/overlays/Modal/useScrollRegion.d.ts +0 -7
- package/dist/components/overlays/Popover/Popover.cjs.js +0 -1
- package/dist/components/overlays/Popover/Popover.module.css.cjs.js +0 -1
- package/dist/components/overlays/Popover/PopoverContent.cjs.js +0 -1
- package/dist/components/overlays/Popover/PopoverContent.d.ts +0 -41
- package/dist/components/overlays/Popover/PopoverContext.cjs.js +0 -1
- package/dist/components/overlays/Popover/PopoverContext.d.ts +0 -38
- package/dist/components/overlays/Tooltip/Tooltip.cjs.js +0 -1
- package/dist/components/overlays/Tooltip/Tooltip.module.css.cjs.js +0 -1
- package/dist/components/primitives/Button/Button.cjs.js +0 -1
- package/dist/components/primitives/Button/Button.module.css.cjs.js +0 -1
- package/dist/components/primitives/Icon/Icon.cjs.js +0 -1
- package/dist/components/primitives/Icon/Icon.module.css.cjs.js +0 -1
- package/dist/components/primitives/Icon/IconSvg.cjs.js +0 -1
- package/dist/components/primitives/Icon/IconSvg.d.ts +0 -31
- package/dist/components/primitives/Icon/icons.cjs.js +0 -1
- package/dist/components/primitives/Kbd/Kbd.cjs.js +0 -1
- package/dist/components/primitives/Kbd/Kbd.module.css.cjs.js +0 -1
- package/dist/components/primitives/Typography/Typography.cjs.js +0 -1
- package/dist/components/primitives/Typography/Typography.module.css.cjs.js +0 -1
- package/dist/components/utilities/LocaleProvider/LocaleProvider.cjs.js +0 -1
- package/dist/components/utilities/LocaleProvider/LocaleProvider.module.css.cjs.js +0 -1
- package/dist/components/utilities/Portal/Portal.cjs.js +0 -1
- package/dist/components/utilities/Theme/Theme.cjs.js +0 -1
- package/dist/components/utilities/Theme/Theme.module.css.cjs.js +0 -1
- package/dist/components/utilities/VisuallyHidden/VisuallyHidden.cjs.js +0 -1
- package/dist/components/utilities/VisuallyHidden/VisuallyHidden.module.css.cjs.js +0 -1
- package/dist/hooks/elementSource.cjs.js +0 -1
- package/dist/hooks/elementSource.d.ts +0 -16
- package/dist/hooks/index.d.ts +0 -21
- package/dist/hooks/useClipboard.cjs.js +0 -1
- package/dist/hooks/useClipboard.d.ts +0 -24
- package/dist/hooks/useControllableState.cjs.js +0 -1
- package/dist/hooks/useControllableState.d.ts +0 -15
- package/dist/hooks/useDisclosure.cjs.js +0 -1
- package/dist/hooks/useDisclosure.d.ts +0 -35
- package/dist/hooks/useDismiss.cjs.js +0 -1
- package/dist/hooks/useDismiss.d.ts +0 -33
- package/dist/hooks/useElementObservers.cjs.js +0 -1
- package/dist/hooks/useElementObservers.d.ts +0 -70
- package/dist/hooks/useEnvironment.cjs.js +0 -1
- package/dist/hooks/useEnvironment.d.ts +0 -42
- package/dist/hooks/useFloatingPosition.cjs.js +0 -1
- package/dist/hooks/useFloatingPosition.d.ts +0 -55
- package/dist/hooks/useFocusTrap.cjs.js +0 -1
- package/dist/hooks/useFocusTrap.d.ts +0 -52
- package/dist/hooks/useFormReset.cjs.js +0 -1
- package/dist/hooks/useFormReset.d.ts +0 -17
- package/dist/hooks/useFormValidation.cjs.js +0 -1
- package/dist/hooks/useFormValidation.d.ts +0 -101
- package/dist/hooks/useHotkeys.cjs.js +0 -1
- package/dist/hooks/useHotkeys.d.ts +0 -50
- package/dist/hooks/useInertOutside.cjs.js +0 -1
- package/dist/hooks/useInertOutside.d.ts +0 -23
- package/dist/hooks/useMediaQuery.cjs.js +0 -1
- package/dist/hooks/useMediaQuery.d.ts +0 -11
- package/dist/hooks/useMergedRef.cjs.js +0 -1
- package/dist/hooks/useMergedRef.d.ts +0 -7
- package/dist/hooks/useOverlayLayer.cjs.js +0 -1
- package/dist/hooks/useOverlayLayer.d.ts +0 -92
- package/dist/hooks/useResponsiveValue.cjs.js +0 -1
- package/dist/hooks/useResponsiveValue.d.ts +0 -10
- package/dist/hooks/useScrollLock.cjs.js +0 -1
- package/dist/hooks/useScrollLock.d.ts +0 -4
- package/dist/hooks/useStorage.cjs.js +0 -1
- package/dist/hooks/useStorage.d.ts +0 -21
- package/dist/hooks/useTiming.cjs.js +0 -1
- package/dist/hooks/useTiming.d.ts +0 -78
- package/dist/hooks/useVirtualizer.cjs.js +0 -1
- package/dist/hooks/useVirtualizer.d.ts +0 -90
- package/dist/i18n/en.cjs.js +0 -1
- package/dist/i18n/en.d.ts +0 -3
- package/dist/i18n/index.d.ts +0 -4
- package/dist/i18n/locales/ar.d.ts +0 -3
- package/dist/i18n/locales/bn.d.ts +0 -3
- package/dist/i18n/locales/cs.d.ts +0 -3
- package/dist/i18n/locales/da.d.ts +0 -3
- package/dist/i18n/locales/de.d.ts +0 -3
- package/dist/i18n/locales/el.d.ts +0 -3
- package/dist/i18n/locales/es.d.ts +0 -3
- package/dist/i18n/locales/fa.d.ts +0 -3
- package/dist/i18n/locales/fi.d.ts +0 -3
- package/dist/i18n/locales/fr.d.ts +0 -3
- package/dist/i18n/locales/he.d.ts +0 -3
- package/dist/i18n/locales/hi.d.ts +0 -3
- package/dist/i18n/locales/hu.d.ts +0 -3
- package/dist/i18n/locales/id.d.ts +0 -3
- package/dist/i18n/locales/it.d.ts +0 -3
- package/dist/i18n/locales/ja.d.ts +0 -3
- package/dist/i18n/locales/ko.d.ts +0 -3
- package/dist/i18n/locales/nb.d.ts +0 -3
- package/dist/i18n/locales/nl.d.ts +0 -3
- package/dist/i18n/locales/pl.d.ts +0 -3
- package/dist/i18n/locales/pt-BR.d.ts +0 -3
- package/dist/i18n/locales/ro.d.ts +0 -3
- package/dist/i18n/locales/ru.d.ts +0 -3
- package/dist/i18n/locales/sv.d.ts +0 -3
- package/dist/i18n/locales/th.d.ts +0 -3
- package/dist/i18n/locales/tr.d.ts +0 -3
- package/dist/i18n/locales/uk.d.ts +0 -3
- package/dist/i18n/locales/ur.d.ts +0 -3
- package/dist/i18n/locales/vi.d.ts +0 -3
- package/dist/i18n/locales/zh-Hans.d.ts +0 -3
- package/dist/i18n/locales/zh-Hant.d.ts +0 -3
- package/dist/i18n/merge.cjs.js +0 -1
- package/dist/i18n/merge.d.ts +0 -6
- package/dist/i18n/plural.cjs.js +0 -1
- package/dist/i18n/plural.d.ts +0 -45
- package/dist/i18n/types.d.ts +0 -1160
- package/dist/index.cjs.js +0 -1
- package/dist/index.d.ts +0 -83
- package/dist/locales/ar.cjs.js +0 -1
- package/dist/locales/ar.d.ts +0 -6
- package/dist/locales/bn.cjs.js +0 -1
- package/dist/locales/bn.d.ts +0 -6
- package/dist/locales/cs.cjs.js +0 -1
- package/dist/locales/cs.d.ts +0 -6
- package/dist/locales/da.cjs.js +0 -1
- package/dist/locales/da.d.ts +0 -6
- package/dist/locales/de.cjs.js +0 -1
- package/dist/locales/de.d.ts +0 -6
- package/dist/locales/el.cjs.js +0 -1
- package/dist/locales/el.d.ts +0 -6
- package/dist/locales/es.cjs.js +0 -1
- package/dist/locales/es.d.ts +0 -6
- package/dist/locales/fa.cjs.js +0 -1
- package/dist/locales/fa.d.ts +0 -6
- package/dist/locales/fi.cjs.js +0 -1
- package/dist/locales/fi.d.ts +0 -6
- package/dist/locales/fr.cjs.js +0 -1
- package/dist/locales/fr.d.ts +0 -6
- package/dist/locales/he.cjs.js +0 -1
- package/dist/locales/he.d.ts +0 -6
- package/dist/locales/hi.cjs.js +0 -1
- package/dist/locales/hi.d.ts +0 -6
- package/dist/locales/hu.cjs.js +0 -1
- package/dist/locales/hu.d.ts +0 -6
- package/dist/locales/id.cjs.js +0 -1
- package/dist/locales/id.d.ts +0 -6
- package/dist/locales/it.cjs.js +0 -1
- package/dist/locales/it.d.ts +0 -6
- package/dist/locales/ja.cjs.js +0 -1
- package/dist/locales/ja.d.ts +0 -6
- package/dist/locales/ko.cjs.js +0 -1
- package/dist/locales/ko.d.ts +0 -6
- package/dist/locales/nb.cjs.js +0 -1
- package/dist/locales/nb.d.ts +0 -6
- package/dist/locales/nl.cjs.js +0 -1
- package/dist/locales/nl.d.ts +0 -6
- package/dist/locales/pl.cjs.js +0 -1
- package/dist/locales/pl.d.ts +0 -6
- package/dist/locales/pt-BR.cjs.js +0 -1
- package/dist/locales/pt-BR.d.ts +0 -6
- package/dist/locales/ro.cjs.js +0 -1
- package/dist/locales/ro.d.ts +0 -6
- package/dist/locales/ru.cjs.js +0 -1
- package/dist/locales/ru.d.ts +0 -6
- package/dist/locales/sv.cjs.js +0 -1
- package/dist/locales/sv.d.ts +0 -6
- package/dist/locales/th.cjs.js +0 -1
- package/dist/locales/th.d.ts +0 -6
- package/dist/locales/tr.cjs.js +0 -1
- package/dist/locales/tr.d.ts +0 -6
- package/dist/locales/uk.cjs.js +0 -1
- package/dist/locales/uk.d.ts +0 -6
- package/dist/locales/ur.cjs.js +0 -1
- package/dist/locales/ur.d.ts +0 -6
- package/dist/locales/vi.cjs.js +0 -1
- package/dist/locales/vi.d.ts +0 -6
- package/dist/locales/zh-Hans.cjs.js +0 -1
- package/dist/locales/zh-Hans.d.ts +0 -6
- package/dist/locales/zh-Hant.cjs.js +0 -1
- package/dist/locales/zh-Hant.d.ts +0 -6
- package/dist/types/common.cjs.js +0 -1
- package/dist/types/common.d.ts +0 -31
- package/dist/types/style.d.ts +0 -7
- package/dist/utils/announce.cjs.js +0 -1
- package/dist/utils/announce.d.ts +0 -1
- package/dist/utils/brandPalette.cjs.js +0 -3
- package/dist/utils/brandPalette.d.ts +0 -146
- package/dist/utils/clipboard.cjs.js +0 -1
- package/dist/utils/clipboard.d.ts +0 -6
- package/dist/utils/cx.cjs.js +0 -1
- package/dist/utils/cx.d.ts +0 -2
- package/dist/utils/fillSlot.cjs.js +0 -1
- package/dist/utils/fillSlot.d.ts +0 -9
- package/dist/utils/flattenChildren.cjs.js +0 -1
- package/dist/utils/flattenChildren.d.ts +0 -8
- package/dist/utils/hotkeys.cjs.js +0 -1
- package/dist/utils/hotkeys.d.ts +0 -27
- package/dist/utils/index.d.ts +0 -11
- package/dist/utils/intl.cjs.js +0 -1
- package/dist/utils/intl.d.ts +0 -10
- package/dist/utils/refs.cjs.js +0 -1
- package/dist/utils/refs.d.ts +0 -15
- package/dist/utils/responsive.cjs.js +0 -1
- package/dist/utils/responsive.d.ts +0 -43
- package/dist/utils/slot.cjs.js +0 -1
- package/dist/utils/slot.d.ts +0 -11
- package/dist/utils/validators.cjs.js +0 -1
- package/dist/utils/validators.d.ts +0 -72
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { MouseEvent, ReactNode } from 'react';
|
|
2
|
-
import { StatusTone } from '../../../types/common';
|
|
3
|
-
/**
|
|
4
|
-
* Semantic color and icon of a toast. The status tones match Alert;
|
|
5
|
-
* `neutral` is a plain message and `loading` shows a Spinner (and does not
|
|
6
|
-
* auto-dismiss until it is updated to another tone).
|
|
7
|
-
*/
|
|
8
|
-
export type ToastTone = StatusTone | "neutral" | "loading";
|
|
9
|
-
/** Where the toast viewport sits on screen. Below 640px wide it is always full width at the bottom. */
|
|
10
|
-
export type ToastPlacement = "top-start" | "top-center" | "top-end" | "bottom-start" | "bottom-center" | "bottom-end";
|
|
11
|
-
/**
|
|
12
|
-
* How a toast is announced. `polite` uses the viewport's `role="status"`
|
|
13
|
-
* region, `assertive` its `role="alert"` region, and `off` skips it.
|
|
14
|
-
*/
|
|
15
|
-
export type ToastPoliteness = "polite" | "assertive" | "off";
|
|
16
|
-
/** An action button inside a toast, such as "Undo". */
|
|
17
|
-
export interface ToastAction {
|
|
18
|
-
/** Visible button label. Keep it short ("Undo", "View", "Retry"). */
|
|
19
|
-
label: ReactNode;
|
|
20
|
-
/**
|
|
21
|
-
* Called when the button is pressed. The toast then closes, unless you call
|
|
22
|
-
* `event.preventDefault()`.
|
|
23
|
-
*/
|
|
24
|
-
onClick: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
25
|
-
/**
|
|
26
|
-
* Required. Describes another way to do the same thing, for people who
|
|
27
|
-
* can't reach the toast before it closes, e.g. "Restore it from Trash".
|
|
28
|
-
* Included in the screen reader announcement after the message.
|
|
29
|
-
*/
|
|
30
|
-
altText: string;
|
|
31
|
-
}
|
|
32
|
-
/** Options accepted by `toast()`, `update()`, and the tone shortcuts. */
|
|
33
|
-
export interface ToastOptions {
|
|
34
|
-
/**
|
|
35
|
-
* Stable id. Calling `toast()` again with an id that is already showing
|
|
36
|
-
* updates that toast instead of adding a duplicate.
|
|
37
|
-
*/
|
|
38
|
-
id?: string;
|
|
39
|
-
/** Bold display headline. */
|
|
40
|
-
title?: ReactNode;
|
|
41
|
-
/** Supporting text under the title. */
|
|
42
|
-
description?: ReactNode;
|
|
43
|
-
/** Semantic color and default icon. @default "neutral" */
|
|
44
|
-
tone?: ToastTone;
|
|
45
|
-
/** Replaces the tone's default icon. Decorative. Pass `null` for no icon. */
|
|
46
|
-
icon?: ReactNode;
|
|
47
|
-
/**
|
|
48
|
-
* Action button. A toast with an action stays until dismissed unless you
|
|
49
|
-
* pass a `duration`, which is then raised to at least 10 seconds.
|
|
50
|
-
*/
|
|
51
|
-
action?: ToastAction;
|
|
52
|
-
/**
|
|
53
|
-
* Milliseconds before the toast closes on its own. `Infinity` keeps it
|
|
54
|
-
* until it is dismissed. Short values are raised to a readable minimum
|
|
55
|
-
* (4 seconds plus time per word). Timers pause while the viewport is
|
|
56
|
-
* hovered or focused and while the window is in the background.
|
|
57
|
-
* @default the provider's `duration` (5000); `Infinity` for `loading` and toasts with an action
|
|
58
|
-
*/
|
|
59
|
-
duration?: number;
|
|
60
|
-
/** Shows the close button and lets Escape close the toast. @default true */
|
|
61
|
-
dismissible?: boolean;
|
|
62
|
-
/**
|
|
63
|
-
* Plain-text announcement for screen readers. Defaults to the tone label,
|
|
64
|
-
* title, and description when they are strings; set it when they are JSX.
|
|
65
|
-
*/
|
|
66
|
-
announcement?: string;
|
|
67
|
-
/** Live region politeness. @default "assertive" for `danger`, otherwise "polite" */
|
|
68
|
-
politeness?: ToastPoliteness;
|
|
69
|
-
/** Shows a thin decorative bar for the remaining time. @default the provider's `showProgress` */
|
|
70
|
-
showProgress?: boolean;
|
|
71
|
-
/** Called when the toast is dismissed by the user or by `dismiss()`. */
|
|
72
|
-
onDismiss?: (id: string) => void;
|
|
73
|
-
/** Called when the toast closes because its time ran out. */
|
|
74
|
-
onAutoClose?: (id: string) => void;
|
|
75
|
-
/**
|
|
76
|
-
* Custom content. Return a `Toast` (or your own markup) to replace the
|
|
77
|
-
* default rendering; the viewport still handles timing, focus, and
|
|
78
|
-
* announcements.
|
|
79
|
-
*/
|
|
80
|
-
render?: (context: ToastRenderContext) => ReactNode;
|
|
81
|
-
}
|
|
82
|
-
/** Passed to `ToastOptions.render`. */
|
|
83
|
-
export interface ToastRenderContext {
|
|
84
|
-
/** The toast's id. */
|
|
85
|
-
id: string;
|
|
86
|
-
/** The toast's current options. */
|
|
87
|
-
toast: ToastRecord;
|
|
88
|
-
/** Closes this toast. */
|
|
89
|
-
dismiss: () => void;
|
|
90
|
-
}
|
|
91
|
-
/** A toast in the store. */
|
|
92
|
-
export interface ToastRecord extends Omit<ToastOptions, "id"> {
|
|
93
|
-
/** Unique id. */
|
|
94
|
-
id: string;
|
|
95
|
-
/** Incremented on every update; restarts the timer and re-announces. */
|
|
96
|
-
version: number;
|
|
97
|
-
/** `closing` while the exit animation runs. */
|
|
98
|
-
status: "open" | "closing";
|
|
99
|
-
}
|
|
100
|
-
/** Content accepted by the `promise()` states. */
|
|
101
|
-
export type ToastPromiseState<T> = ReactNode | ToastOptions | ((value: T) => ReactNode | ToastOptions);
|
|
102
|
-
/** Messages for `promise()`. */
|
|
103
|
-
export interface ToastPromiseMessages<T> {
|
|
104
|
-
/** Shown while pending, with the `loading` tone. */
|
|
105
|
-
loading: ReactNode | ToastOptions;
|
|
106
|
-
/** Shown when the promise resolves, with the `success` tone. */
|
|
107
|
-
success: ToastPromiseState<T>;
|
|
108
|
-
/** Shown when the promise rejects, with the `danger` tone. */
|
|
109
|
-
error: ToastPromiseState<unknown>;
|
|
110
|
-
}
|
|
111
|
-
/** Shortcut that sets the tone: `toast.success("Saved")`. */
|
|
112
|
-
export type ToastShortcut = (title: ReactNode, options?: ToastOptions) => string;
|
|
113
|
-
/** The `toast` function and its helpers. */
|
|
114
|
-
export interface ToastApi {
|
|
115
|
-
/** Shows a toast and returns its id. */
|
|
116
|
-
(options: ToastOptions): string;
|
|
117
|
-
/** Shows a `success` toast. */
|
|
118
|
-
success: ToastShortcut;
|
|
119
|
-
/** Shows a `danger` toast, announced assertively. */
|
|
120
|
-
error: ToastShortcut;
|
|
121
|
-
/** Shows a `warning` toast. */
|
|
122
|
-
warning: ToastShortcut;
|
|
123
|
-
/** Shows an `info` toast. */
|
|
124
|
-
info: ToastShortcut;
|
|
125
|
-
/** Shows a `loading` toast that stays until updated or dismissed. */
|
|
126
|
-
loading: ToastShortcut;
|
|
127
|
-
/** Closes one toast, or every toast when no id is given. */
|
|
128
|
-
dismiss: (id?: string) => void;
|
|
129
|
-
/** Changes a toast in place (restarts its timer and re-announces it). */
|
|
130
|
-
update: (id: string, options: ToastOptions) => void;
|
|
131
|
-
/**
|
|
132
|
-
* Shows a loading toast, then updates it to success or error when the
|
|
133
|
-
* promise settles. Returns the toast id.
|
|
134
|
-
*/
|
|
135
|
-
promise: <T>(promise: Promise<T> | (() => Promise<T>), messages: ToastPromiseMessages<T>, options?: ToastOptions) => string;
|
|
136
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";const e=require("./toastStore.cjs.js");let t=require("react");var n=(0,t.createContext)(null);function r(){let r=(0,t.useContext)(n),i=r?.store??e.toastStore,a=r?.api??e.toast,o=(0,t.useSyncExternalStore)(i.subscribe,i.getSnapshot,i.getServerSnapshot);return{toast:a,dismiss:a.dismiss,update:a.update,promise:a.promise,toasts:o}}exports.ToastContext=n,exports.useToast=r;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";const e=require("./toastTiming.cjs.js");let t=require("react");var n=150;function r(r,i){let[a,o]=(0,t.useState)([]),[s,c]=(0,t.useState)([]),l=(0,t.useRef)(new Map),u=(0,t.useRef)(new Set);return(0,t.useEffect)(()=>{let t=(e,t)=>{let n=window.setTimeout(()=>{u.current.delete(n),e()},t);u.current.add(n)},a=new Set(r.map(e=>e.id));for(let e of l.current.keys())a.has(e)||l.current.delete(e);for(let a of r){if(a.status!==`open`||l.current.get(a.id)===a.version)continue;l.current.set(a.id,a.version);let r=a.tone??`neutral`,s=a.politeness??(r===`danger`?`assertive`:`polite`);if(s===`off`)continue;let u=e.announcementOf(a,i[r]??e.defaultToneLabels[r]);if(!u)continue;let d={key:`${a.id}-${a.version}`,text:u},f=s===`assertive`?c:o;t(()=>f(e=>[...e,d]),n),t(()=>f(e=>e.filter(e=>e.key!==d.key)),7150)}},[r,i]),(0,t.useEffect)(()=>{let e=u.current,t=l.current;return()=>{e.forEach(e=>window.clearTimeout(e)),e.clear(),t.clear()}},[]),{polite:a,assertive:s}}exports.useToastAnnouncer=r;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ToastRecord, ToastTone } from './toastTypes';
|
|
2
|
-
/** @internal A message currently in one of the live regions. */
|
|
3
|
-
export interface LiveMessage {
|
|
4
|
-
key: string;
|
|
5
|
-
text: string;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* @internal Turns visible toasts into live region messages. Each new toast
|
|
9
|
-
* (and each update of one) appends a fresh node to the persistent polite or
|
|
10
|
-
* assertive region, which screen readers announce as an addition.
|
|
11
|
-
*/
|
|
12
|
-
export declare function useToastAnnouncer(visible: readonly ToastRecord[], toneLabels: Partial<Record<ToastTone, string>>): {
|
|
13
|
-
polite: LiveMessage[];
|
|
14
|
-
assertive: LiveMessage[];
|
|
15
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";const e=require("../../../hooks/useControllableState.cjs.js"),t=require("../../../hooks/useFormReset.cjs.js"),n=require("../../../utils/cx.cjs.js"),r=require("../../primitives/Icon/icons.cjs.js"),i=require("../Field/FieldContext.cjs.js"),a=require("./CheckBox.module.css.cjs.js");let o=require("react"),s=require("react/jsx-runtime");var c={sm:a.default.sm,md:a.default.md,lg:a.default.lg},l={neutral:a.default.toneNeutral,primary:a.default.tonePrimary,accent:a.default.toneAccent,success:a.default.toneSuccess,warning:a.default.toneWarning,danger:a.default.toneDanger,info:a.default.toneInfo},u={end:a.default.labelEnd,start:a.default.labelStart},d={vertical:a.default.vertical,horizontal:a.default.horizontal},f=(0,o.createContext)(null);function p({checked:d,defaultChecked:p=!1,onCheckedChange:m,indeterminate:h=!1,label:g,description:_,size:v,tone:y,invalid:b,disabled:x,required:S,readOnly:C,labelPosition:w=`end`,value:T,name:E,id:D,className:O,style:k,ref:A,onChange:j,onClick:M,"aria-describedby":N,...P}){let F=(0,o.useContext)(f),I=(0,o.useId)(),L=(0,o.useId)(),R=i.useFieldControl({id:D??(F?I:void 0),invalid:b??F?.invalid,required:S,disabled:x??(F?.disabled||void 0),readOnly:C??(F?.readOnly||void 0),size:v??F?.size,"aria-describedby":[_?L:void 0,N].filter(Boolean).join(` `)||void 0}),z=R.id??I,B=R.size??`md`,V=y??F?.tone??`primary`,{disabled:H,readOnly:U,invalid:W}=R,G=F?[_?L:void 0,F.itemDescribedBy,N].filter(Boolean).join(` `)||void 0:R.ariaProps[`aria-describedby`],[K,q]=e.useControllableState({value:d,defaultValue:p,onChange:m});t.useFormReset(()=>X.current,()=>F?F.reset():q(p??!1),F?!0:d===void 0);let J=T??`on`,Y=F?F.value.includes(J):K,X=(0,o.useRef)(null);(0,o.useLayoutEffect)(()=>{X.current&&(X.current.indeterminate=h)});let Z=(0,o.useCallback)(e=>{if(X.current=e,typeof A==`function`)return A(e);A&&(A.current=e)},[A]),Q=e=>{M?.(e),U&&e.preventDefault()},$=e=>{if(j?.(e),U)return;let t=e.target.checked;F?(F.toggle(J,t),m?.(t)):q(t)};return(0,s.jsxs)(`div`,{className:n.cx(a.default.root,c[B],l[V],u[w],O),style:k,"data-disabled":H||void 0,"data-invalid":W||void 0,"data-readonly":U||void 0,children:[(0,s.jsxs)(`span`,{className:a.default.controlWrap,children:[(0,s.jsx)(`input`,{...P,ref:Z,type:`checkbox`,id:z,name:E??F?.name,value:J,checked:Y,disabled:H,required:F?void 0:R.required,"aria-describedby":G,"aria-invalid":R.ariaProps[`aria-invalid`],"aria-errormessage":F?void 0:R.ariaProps[`aria-errormessage`],"aria-readonly":U||void 0,className:a.default.input,onClick:Q,onChange:$}),(0,s.jsxs)(`span`,{className:a.default.control,"aria-hidden":`true`,children:[(0,s.jsx)(r.CheckIcon,{className:n.cx(a.default.mark,a.default.check),strokeWidth:3.5}),(0,s.jsx)(r.MinusIcon,{className:n.cx(a.default.mark,a.default.minus),strokeWidth:3.5})]})]}),(g||_)&&(0,s.jsxs)(`span`,{className:a.default.text,children:[g&&(0,s.jsx)(`label`,{htmlFor:z,className:a.default.label,children:g}),_&&(0,s.jsx)(`span`,{id:L,className:a.default.description,children:_})]})]})}function m({value:t,defaultValue:r=[],onValueChange:l,name:u,orientation:p=`vertical`,size:m,tone:h,disabled:g,readOnly:_,invalid:v,label:y,description:b,className:x,children:S,"aria-labelledby":C,"aria-describedby":w,...T}){let E=i.useFieldContext(),D=(0,o.useId)(),O=(0,o.useId)(),k=i.useFieldControl({invalid:v,disabled:g,readOnly:_,size:m,"aria-describedby":[b?O:void 0,w].filter(Boolean).join(` `)||void 0}),[A,j]=e.useControllableState({value:t,defaultValue:r,onChange:l}),M=(0,o.useCallback)((e,t)=>{j(n=>t?n.includes(e)?n:[...n,e]:n.filter(t=>t!==e))},[j]),N=E?.isGroup===!0&&!C&&!y,P=[C,y?D:void 0].filter(Boolean).join(` `)||void 0,F=[b?O:void 0,w].filter(Boolean).join(` `)||void 0,I={name:u,value:A,toggle:M,size:k.size,tone:h,disabled:k.disabled,readOnly:k.readOnly,invalid:k.invalid,reset:()=>{t===void 0&&j(r??[])},itemDescribedBy:N?F:void 0};return(0,s.jsxs)(`div`,{...T,role:N?void 0:`group`,"aria-labelledby":N?void 0:P,"aria-describedby":N?F:k.ariaProps[`aria-describedby`],className:n.cx(a.default.group,c[k.size??`md`],x),"data-disabled":k.disabled||void 0,"aria-disabled":k.disabled||void 0,children:[(y||b)&&(0,s.jsxs)(`div`,{className:a.default.groupHeader,children:[y&&(0,s.jsx)(`span`,{id:D,className:a.default.groupLabel,children:y}),b&&(0,s.jsx)(`span`,{id:O,className:a.default.description,children:b})]}),(0,s.jsx)(`div`,{className:n.cx(a.default.options,d[p]),children:(0,s.jsx)(f.Provider,{value:I,children:S})})]})}exports.CheckBox=p,exports.CheckBoxGroup=m;
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { ComponentPropsWithRef, ReactNode } from 'react';
|
|
2
|
-
import { Orientation, Size, Tone } from '../../../types/common';
|
|
3
|
-
/** Which side of the box the label sits on. `end` (default) puts the label after the box. */
|
|
4
|
-
export type CheckBoxLabelPosition = "start" | "end";
|
|
5
|
-
/** Props for `CheckBox`. Native `<input type="checkbox">` props are forwarded to the input. */
|
|
6
|
-
export interface CheckBoxProps extends Omit<ComponentPropsWithRef<"input">, "type" | "size" | "checked" | "defaultChecked" | "value"> {
|
|
7
|
-
/** Checked state (controlled). Ignored inside a `CheckBoxGroup`, which owns the state. */
|
|
8
|
-
checked?: boolean;
|
|
9
|
-
/** Initial checked state (uncontrolled). */
|
|
10
|
-
defaultChecked?: boolean;
|
|
11
|
-
/** Called with the next checked state when the user toggles the box. */
|
|
12
|
-
onCheckedChange?: (checked: boolean) => void;
|
|
13
|
-
/**
|
|
14
|
-
* Shows a "mixed" state (a dash) and exposes `aria-checked="mixed"` via the
|
|
15
|
-
* native `indeterminate` property. Use for a parent "select all" box whose
|
|
16
|
-
* children are partly checked. Stays on until you set it to `false`.
|
|
17
|
-
*/
|
|
18
|
-
indeterminate?: boolean;
|
|
19
|
-
/** Visible label. Clicking it toggles the box. Without it, pass `aria-label` or `aria-labelledby`. */
|
|
20
|
-
label?: ReactNode;
|
|
21
|
-
/** Supporting text below the label, linked with `aria-describedby`. */
|
|
22
|
-
description?: ReactNode;
|
|
23
|
-
/** Box and text size. Default `md` (20px box). Inherits from `Field` or `CheckBoxGroup`. */
|
|
24
|
-
size?: Size;
|
|
25
|
-
/** Fill color when checked. Default `primary`. Inherits from `CheckBoxGroup`. */
|
|
26
|
-
tone?: Tone;
|
|
27
|
-
/** Danger styling plus `aria-invalid`. Inherits from `Field`. */
|
|
28
|
-
invalid?: boolean;
|
|
29
|
-
/** Label placement. `end` (default) puts the label after the box, `start` before it. */
|
|
30
|
-
labelPosition?: CheckBoxLabelPosition;
|
|
31
|
-
/** Keeps the box focusable and announced but prevents toggling (`aria-readonly`). */
|
|
32
|
-
readOnly?: boolean;
|
|
33
|
-
/** Form value. Required inside a `CheckBoxGroup`, where it identifies the option. Default `"on"`. */
|
|
34
|
-
value?: string;
|
|
35
|
-
/** Class name for the root element (the input receives every other prop). */
|
|
36
|
-
className?: string;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* A checkbox with a label and an optional description. It is a real native
|
|
40
|
-
* `<input type="checkbox">` (visually hidden but focusable) layered under a
|
|
41
|
-
* custom box, so keyboard, form submission, and screen readers work natively.
|
|
42
|
-
* Works standalone, inside `Field`, and as an option in `CheckBoxGroup`.
|
|
43
|
-
*/
|
|
44
|
-
export declare function CheckBox({ checked: checkedProp, defaultChecked, onCheckedChange, indeterminate, label, description, size: sizeProp, tone: toneProp, invalid: invalidProp, disabled: disabledProp, required: requiredProp, readOnly: readOnlyProp, labelPosition, value, name, id: idProp, className, style, ref, onChange, onClick, "aria-describedby": ariaDescribedBy, ...rest }: CheckBoxProps): import("react").JSX.Element;
|
|
45
|
-
/** Props for `CheckBoxGroup`. */
|
|
46
|
-
export interface CheckBoxGroupProps extends Omit<ComponentPropsWithRef<"div">, "defaultValue" | "onChange"> {
|
|
47
|
-
/** Checked option values (controlled). */
|
|
48
|
-
value?: string[];
|
|
49
|
-
/** Initially checked option values (uncontrolled). */
|
|
50
|
-
defaultValue?: string[];
|
|
51
|
-
/** Called with the full list of checked values whenever an option is toggled. */
|
|
52
|
-
onValueChange?: (value: string[]) => void;
|
|
53
|
-
/** Form field name applied to every option. */
|
|
54
|
-
name?: string;
|
|
55
|
-
/** Stack options vertically (default) or in a wrapping row. */
|
|
56
|
-
orientation?: Orientation;
|
|
57
|
-
/** Size for every option. Inherits from `Field`. */
|
|
58
|
-
size?: Size;
|
|
59
|
-
/** Checked fill color for every option. */
|
|
60
|
-
tone?: Tone;
|
|
61
|
-
/** Disable every option. Inherits from `Field`. */
|
|
62
|
-
disabled?: boolean;
|
|
63
|
-
/** Make every option read-only. Inherits from `Field`. */
|
|
64
|
-
readOnly?: boolean;
|
|
65
|
-
/** Danger styling and `aria-invalid` on every option. Inherits from `Field`. */
|
|
66
|
-
invalid?: boolean;
|
|
67
|
-
/** Visible group label for standalone use. Inside a `Fieldset`, the legend labels the group instead. */
|
|
68
|
-
label?: ReactNode;
|
|
69
|
-
/** Supporting text below the group label, linked with `aria-describedby`. */
|
|
70
|
-
description?: ReactNode;
|
|
71
|
-
/** `CheckBox` options, each with a unique `value`. */
|
|
72
|
-
children?: ReactNode;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* A labelled set of checkboxes sharing one `string[]` value. Renders
|
|
76
|
-
* `role="group"` labelled by its own `label`, by a surrounding `Fieldset`'s
|
|
77
|
-
* legend, or by `aria-label`/`aria-labelledby`.
|
|
78
|
-
*/
|
|
79
|
-
export declare function CheckBoxGroup({ value: valueProp, defaultValue, onValueChange, name, orientation, size: sizeProp, tone, disabled: disabledProp, readOnly: readOnlyProp, invalid: invalidProp, label, description, className, children, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, ...rest }: CheckBoxGroupProps): import("react").JSX.Element;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=`_root_1f9i5_35`,t=`_sm_1f9i5_59`,n=`_md_1f9i5_73`,r=`_lg_1f9i5_87`,i=`_tonePrimary_1f9i5_105`,a=`_toneNeutral_1f9i5_117`,o=`_toneAccent_1f9i5_129`,s=`_toneSuccess_1f9i5_141`,c=`_toneWarning_1f9i5_153`,l=`_toneDanger_1f9i5_165`,u=`_toneInfo_1f9i5_177`,d=`_labelEnd_1f9i5_193`,f=`_labelStart_1f9i5_199`,p=`_controlWrap_1f9i5_211`,m=`_input_1f9i5_239`,h=`_control_1f9i5_211`,g=`_mark_1f9i5_299`,_=`_check_1f9i5_363`,v=`_minus_1f9i5_365`,y=`_label_1f9i5_193`,b=`_description_1f9i5_441`,x=`_text_1f9i5_451`,S=`_group_1f9i5_489`,C=`_groupHeader_1f9i5_505`,w=`_groupLabel_1f9i5_517`,T=`_options_1f9i5_539`,E=`_vertical_1f9i5_545`,D=`_horizontal_1f9i5_553`,O={root:e,sm:t,md:n,lg:r,tonePrimary:i,toneNeutral:a,toneAccent:o,toneSuccess:s,toneWarning:c,toneDanger:l,toneInfo:u,labelEnd:d,labelStart:f,controlWrap:p,input:m,control:h,mark:g,check:_,minus:v,label:y,description:b,text:x,group:S,groupHeader:C,groupLabel:w,options:T,vertical:E,horizontal:D};exports.check=_,exports.control=h,exports.controlWrap=p,exports.default=O,exports.description=b,exports.group=S,exports.groupHeader=C,exports.groupLabel=w,exports.horizontal=D,exports.input=m,exports.label=y,exports.labelEnd=d,exports.labelStart=f,exports.lg=r,exports.mark=g,exports.md=n,exports.minus=v,exports.options=T,exports.root=e,exports.sm=t,exports.text=x,exports.toneAccent=o,exports.toneDanger=l,exports.toneInfo=u,exports.toneNeutral=a,exports.tonePrimary=i,exports.toneSuccess=s,exports.toneWarning=c,exports.vertical=E;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";const e=require("../../../hooks/useControllableState.cjs.js"),t=require("../../../utils/cx.cjs.js"),n=require("../../overlays/Popover/Popover.cjs.js"),r=require("../../primitives/Icon/icons.cjs.js"),i=require("../../utilities/VisuallyHidden/VisuallyHidden.cjs.js"),a=require("../Field/FieldContext.cjs.js"),o=require("./ColorPicker.cjs.js"),s=require("./colorUtils.cjs.js"),c=require("./ColorPicker.module.css.cjs.js"),ee=require("../../utilities/LocaleProvider/LocaleProvider.cjs.js");let l=require("react"),u=require("react/jsx-runtime");var d={sm:c.default.triggerSm,md:c.default.triggerMd,lg:c.default.triggerLg};function f(f){let p=ee.useMessages(),{value:te,defaultValue:m,onValueChange:h,onValueCommit:ne,format:g=`hex`,alpha:_=!1,swatches:v,eyeDropper:y,size:b,disabled:x,readOnly:S,invalid:re,name:C,labels:w,open:ie,defaultOpen:T,onOpenChange:E,placement:D=`bottom-start`,fullWidth:O=!1,dialogLabel:k=p.colorPicker.dialog,id:A,className:j,style:M,"aria-label":N,"aria-labelledby":P,"aria-describedby":F,...I}=f,L=a.useFieldContext(),R=a.useFieldControl({id:A,invalid:re,disabled:x,readOnly:S,size:b,"aria-describedby":F}),{disabled:z,readOnly:B,invalid:V}=R,H=R.size??`md`,[U,W]=e.useControllableState({value:te,defaultValue:m??`#1d4ed8`,onChange:h}),G=s.parseColor(U),K=G?s.formatColor(_?G:{...G,a:1},g,{alpha:_}):U,q=w?.describeColor??(e=>s.describeColor(e,p.colorPicker.colors)),J=G?q(_?G:{...G,a:1}):``,Y=(0,l.useId)(),X=`${Y}-name`,Z=`${Y}-value`,Q=P??L?.labelId,$=N??(Q?void 0:w?.input??p.colorPicker.input),ae={"--cp-color":G?s.formatColor(_?G:{...G,a:1},`rgb`):`transparent`};return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)(n.Popover,{open:ie,defaultOpen:T,onOpenChange:E,placement:D,children:[(0,u.jsx)(n.Popover.Trigger,{asChild:!0,children:(0,u.jsxs)(`button`,{...I,type:`button`,id:R.id,disabled:z,className:t.cx(c.default.trigger,d[H],O&&c.default.triggerFullWidth,j),style:{...M,...ae},"data-invalid":V||void 0,"data-readonly":B||void 0,"aria-labelledby":[Q??($?X:void 0),Z].filter(Boolean).join(` `),...R.ariaProps,children:[!Q&&$&&(0,u.jsx)(i.VisuallyHidden,{id:X,children:$}),(0,u.jsx)(`span`,{className:t.cx(c.default.triggerSwatch,c.default.checkered),"aria-hidden":`true`}),(0,u.jsxs)(`span`,{id:Z,className:c.default.triggerValue,children:[K,J&&(0,u.jsxs)(i.VisuallyHidden,{children:[`, `,J]})]}),(0,u.jsx)(r.ChevronDownIcon,{size:`sm`,className:c.default.triggerChevron})]})}),(0,u.jsx)(n.Popover.Content,{"aria-label":k,maxWidth:`none`,children:(0,u.jsx)(a.FieldContext.Provider,{value:null,children:(0,u.jsx)(o.ColorPicker,{variant:`plain`,"aria-label":k,value:U,onValueChange:W,onValueCommit:ne,format:g,alpha:_,swatches:v,eyeDropper:y,size:H,disabled:z,readOnly:B,invalid:V,labels:w})})})]}),C&&(0,u.jsx)(`input`,{type:`hidden`,name:C,value:K,disabled:z})]})}exports.ColorInput=f;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
import { Placement, Size } from '../../../types/common';
|
|
3
|
-
import { ColorPickerBaseProps } from './ColorPicker';
|
|
4
|
-
/** Props for `ColorInput`. Other props are spread onto the trigger `<button>`. */
|
|
5
|
-
export interface ColorInputProps extends ColorPickerBaseProps, Omit<ComponentPropsWithRef<"button">, keyof ColorPickerBaseProps | "onChange" | "children" | "type" | "value" | "defaultValue"> {
|
|
6
|
-
/** Controlled open state of the picker popover. */
|
|
7
|
-
open?: boolean;
|
|
8
|
-
/** Initial open state when uncontrolled. @default false */
|
|
9
|
-
defaultOpen?: boolean;
|
|
10
|
-
/** Called with the next open state. */
|
|
11
|
-
onOpenChange?: (open: boolean) => void;
|
|
12
|
-
/** Where the popover opens. Flips when there isn't room. @default "bottom-start" */
|
|
13
|
-
placement?: Placement;
|
|
14
|
-
/** Size of the pill field and the picker. Picks up a surrounding Field's size. @default "md" */
|
|
15
|
-
size?: Size;
|
|
16
|
-
/** Stretch the field to fill its container. @default false */
|
|
17
|
-
fullWidth?: boolean;
|
|
18
|
-
/** Accessible name of the picker popover. @default "Choose a color" */
|
|
19
|
-
dialogLabel?: string;
|
|
20
|
-
/** Accessible name when there's no visible label. Inside a Field, the Field's label is used. The current color is always appended. */
|
|
21
|
-
"aria-label"?: string;
|
|
22
|
-
/** id of a visible label. Inside a Field, the Field's label is used. */
|
|
23
|
-
"aria-labelledby"?: string;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* A pill field showing a swatch and the color value; pressing it opens a
|
|
27
|
-
* `ColorPicker` in a `Popover` (a non-modal dialog on the shared overlay
|
|
28
|
-
* layer stack: Escape and outside presses close it, focus returns to the
|
|
29
|
-
* field). Takes the same value, format, alpha, swatch, and state props as
|
|
30
|
-
* `ColorPicker`.
|
|
31
|
-
*
|
|
32
|
-
* The trigger is a native `<button>` with `aria-haspopup="dialog"` and
|
|
33
|
-
* `aria-expanded`. Its name is the label plus the current value and a plain
|
|
34
|
-
* description ("Jersey color, #1d4ed8, dark blue"). Inside a `Field`, the
|
|
35
|
-
* label, hint, error, invalid, disabled, and read-only state are wired to
|
|
36
|
-
* it. A read-only field still opens, so the values can be inspected.
|
|
37
|
-
*/
|
|
38
|
-
export declare function ColorInput(props: ColorInputProps): import("react").JSX.Element;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";const e=require("../../../hooks/useControllableState.cjs.js"),t=require("../../../utils/cx.cjs.js"),n=require("../../primitives/Button/Button.cjs.js"),r=require("../../primitives/Icon/icons.cjs.js"),i=require("../../utilities/VisuallyHidden/VisuallyHidden.cjs.js"),a=require("../Field/FieldContext.cjs.js"),o=require("../Input/Input.cjs.js"),s=require("./colorUtils.cjs.js"),c=require("./ColorPicker.module.css.cjs.js"),l=require("../../utilities/LocaleProvider/LocaleProvider.cjs.js"),u=require("../../../i18n/en.cjs.js");let d=require("react"),f=require("react/jsx-runtime");function p(e){let{colors:t}=e.colorPicker;return{...e.colorPicker,describeColor:e=>s.describeColor(e,t),hueName:e=>s.getHueName(e,t)}}var m=p(u.en),h=`#1d4ed8`,g={h:224,s:87,v:85,a:1},_={sm:c.default.sizeSm,md:c.default.sizeMd,lg:c.default.sizeLg},v={panel:c.default.panel,plain:c.default.plain},y=(e,t,n)=>Math.min(n,Math.max(t,e)),b=`linear-gradient(to right, hsl(0 100% 50%), hsl(60 100% 50%), hsl(120 100% 50%), hsl(180 100% 50%), hsl(240 100% 50%), hsl(300 100% 50%), hsl(360 100% 50%))`,x=e=>s.formatColor(e,`rgb`);function S(e,t){let n=e.shiftKey?10:1,r=t!==`y`,i=t!==`x`;switch(e.key){case`ArrowRight`:return r?{dx:n,dy:0}:{dx:0,dy:n};case`ArrowLeft`:return r?{dx:-n,dy:0}:{dx:0,dy:-n};case`ArrowUp`:return i?{dx:0,dy:n}:{dx:n,dy:0};case`ArrowDown`:return i?{dx:0,dy:-n}:{dx:-n,dy:0};case`PageUp`:return i?{dx:0,dy:10}:{dx:10,dy:0};case`PageDown`:return i?{dx:0,dy:-10}:{dx:-10,dy:0};case`Home`:return{dx:0,dy:0,to:`min`};case`End`:return{dx:0,dy:0,to:`max`};default:return null}}function C(){if(typeof window<`u`)return window.EyeDropper}function ee({value:t,defaultValue:n,onValueChange:r,onValueCommit:i,format:a,alpha:o}){let[c,l]=e.useControllableState({value:t,defaultValue:n??h,onChange:r}),u=e=>o?e:{...e,a:1},f=e=>s.formatColor(e,a,{alpha:o}),[p,m]=(0,d.useState)(()=>u(s.parseColor(c)??g)),[_,v]=(0,d.useState)(c),b=(0,d.useRef)(p),x=p;if(c!==_){v(c);let e=s.parseColor(c,p.h);e&&f(u(e))!==f(p)&&(x=u(e),m(x))}return x=u(x),b.current=x,{hsva:x,hsvaRef:b,str:f(x),update:e=>{let t=u({h:y(e.h,0,360),s:y(e.s,0,100),v:y(e.v,0,100),a:y(e.a,0,1)});b.current=t,m(t);let n=f(t);v(n),l(n)},commit:()=>i?.(f(b.current)),fmt:f}}function w({label:e,value:n,max:r,valueText:i,trackStyle:a,checkered:o,interactive:s,disabled:l,readOnly:u,ariaProps:p,onChange:m,onCommit:h}){let g=(0,d.useRef)(null),_=(0,d.useRef)(null),[v,b]=(0,d.useState)(!1),x=(0,d.useRef)(!1),C=e=>{let t=g.current?.getBoundingClientRect();return!t||t.width<=0?n:y((e-t.left)/t.width,0,1)*r},ee=e=>{s&&e.button===0&&(e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),b(!0),_.current?.focus({preventScroll:!0}),m(C(e.clientX)))},w=e=>{v&&m(C(e.clientX))},T=e=>{v&&(e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),b(!1),h())},E=e=>{if(!s)return;let t=S(e,`x`);t&&(e.preventDefault(),x.current=!0,m(t.to===`min`?0:t.to===`max`?r:y(Math.round(n)+t.dx,0,r)))},D=()=>{x.current&&(x.current=!1,h())},O=Math.round(n);return(0,f.jsx)(`div`,{className:c.default.channel,"data-dragging":v||void 0,onPointerDown:ee,onPointerMove:w,onPointerUp:T,onPointerCancel:T,onLostPointerCapture:e=>{v&&T(e)},children:(0,f.jsxs)(`div`,{ref:g,className:c.default.rail,children:[(0,f.jsx)(`div`,{className:t.cx(c.default.track,o&&c.default.checkered),"aria-hidden":`true`,children:(0,f.jsx)(`div`,{className:c.default.trackFill,style:a})}),(0,f.jsx)(`span`,{ref:_,role:`slider`,tabIndex:l?-1:0,className:c.default.thumb,style:{left:`${y(n,0,r)/r*100}%`},"aria-label":e,"aria-valuemin":0,"aria-valuemax":r,"aria-valuenow":O,"aria-valuetext":i,"aria-orientation":`horizontal`,"aria-disabled":l||void 0,"aria-readonly":u||void 0,...p,"aria-required":void 0,onKeyDown:E,onKeyUp:D})]})})}function T({colors:e,current:t,label:n,disabled:i,readOnly:a,ariaProps:o,withAlpha:l,onSelect:u,describe:p}){let m=(0,d.useRef)([]),h=e.findIndex(e=>s.colorsEqual(e,t)),[g,_]=(0,d.useState)(null),v=g??(h>=0?h:0),y=t=>{let n=(t+e.length)%e.length;_(n),m.current[n]?.focus(),a||u(e[n])},b=t=>{if(i)return;let n=m.current.findIndex(e=>e===document.activeElement);if(n===-1)return;let r=null;t.key===`ArrowRight`||t.key===`ArrowDown`?r=n+1:t.key===`ArrowLeft`||t.key===`ArrowUp`?r=n-1:t.key===`Home`?r=0:t.key===`End`&&(r=e.length-1),r!==null&&(t.preventDefault(),y(r))},S=(0,d.useId)();return(0,f.jsxs)(`div`,{className:c.default.swatchSection,children:[(0,f.jsx)(`span`,{id:S,className:c.default.swatchCaption,children:n}),(0,f.jsx)(`div`,{role:`radiogroup`,"aria-labelledby":S,"aria-readonly":a||void 0,"aria-disabled":i||void 0,...o,className:c.default.swatches,onKeyDown:b,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||_(null)},children:e.map((e,t)=>{let n=t===h;return(0,f.jsxs)(`button`,{ref:e=>{m.current[t]=e},type:`button`,role:`radio`,"aria-checked":n,"aria-label":`${p(e)}, ${s.toHex(e,l)}`,tabIndex:t===v?0:-1,disabled:i,className:c.default.swatch,"data-checked":n||void 0,onFocus:()=>_(t),onClick:()=>{a||u(e)},children:[(0,f.jsx)(`span`,{className:c.default.swatchColor,style:{background:x(e)},"aria-hidden":`true`}),n&&(0,f.jsx)(`span`,{className:c.default.swatchCheck,"aria-hidden":`true`,children:(0,f.jsx)(r.CheckIcon,{size:`xs`,strokeWidth:3})})]},`${s.toHex(e)}-${t}`)})})]})}function E(e){let u=l.useMessages(),{value:m,defaultValue:h,onValueChange:g,onValueCommit:E,format:D=`hex`,alpha:O=!1,swatches:te,eyeDropper:ne=!0,size:re,disabled:ie,readOnly:ae,invalid:oe,name:se,labels:ce,variant:le=`panel`,swatchesOnly:ue=!1,"aria-label":de,"aria-labelledby":fe,"aria-describedby":pe,className:me,style:he,...ge}=e,k={...p(u),...ce},A=a.useFieldContext(),j=a.useFieldControl({invalid:oe,disabled:ie,readOnly:ae,size:re,"aria-describedby":pe},{nativeRequired:!1}),{disabled:M,readOnly:N,invalid:_e}=j,P=j.size??`md`,F=!M&&!N,I={...j.ariaProps,"aria-required":void 0},{hsva:L,hsvaRef:R,str:z,update:B,commit:V,fmt:ve}=ee({value:m,defaultValue:h,onValueChange:g,onValueCommit:E,format:D,alpha:O}),H=(0,d.useId)(),U=`${H}-input-label`,ye=`${H}-input-error`,be=A&&!A.isGroup?A.controlId:`${H}-input`,[xe,Se]=(0,d.useState)(!1);(0,d.useEffect)(()=>Se(!!C()),[]);let[Ce,we]=(0,d.useState)(``),Te=(0,d.useRef)(null),W=(0,d.useRef)(null),G=(0,d.useRef)(null),[Ee,De]=(0,d.useState)(`s`),[K,Oe]=(0,d.useState)(!1),q=(0,d.useRef)(!1),ke=(e,t)=>{let n=Te.current?.getBoundingClientRect();if(!n||n.width<=0||n.height<=0)return;let r=y((e-n.left)/n.width,0,1)*100,i=y((n.bottom-t)/n.height,0,1)*100;B({...R.current,s:r,v:i})},Ae=e=>{F&&e.button===0&&(e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),Oe(!0),(Ee===`s`?W:G).current?.focus({preventScroll:!0}),ke(e.clientX,e.clientY))},je=e=>{K&&ke(e.clientX,e.clientY)},Me=e=>{K&&(e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),Oe(!1),V())},Ne=e=>{if(!F)return;let t=S(e,`both`);if(!t)return;e.preventDefault(),q.current=!0;let n=R.current,r=e.currentTarget===G.current?`v`:`s`;if(t.to){let e=t.to===`min`?0:100;B(r===`s`?{...n,s:e}:{...n,v:e});return}let i=t.dx===0?`v`:`s`;B({...n,s:Math.round(n.s)+t.dx,v:Math.round(n.v)+t.dy}),i!==r&&(De(i),(i===`s`?W:G).current?.focus({preventScroll:!0}))},Pe=(e,t)=>{if(!F)return;let n=R.current;B(e===`s`?{...n,s:t}:{...n,v:t}),V()},Fe=()=>{q.current&&(q.current=!1,V())},[J,Y]=(0,d.useState)(null),[Ie,X]=(0,d.useState)(!1),Le=(0,d.useRef)(z);(0,d.useEffect)(()=>{Le.current!==z&&(Le.current=z,X(!1),Y(null))},[z]);let Z=()=>{if(J===null)return;let e=s.parseColor(J,R.current.h);if(Y(null),!e){X(!0);return}X(!1);let t=ve(R.current);B(e),ve(R.current)!==t&&V()},Re=(0,d.useRef)(Z);Re.current=Z,(0,d.useEffect)(()=>()=>Re.current(),[]);let Q=(te??[]).map(e=>s.parseColor(e)).filter(e=>e!==null).map(e=>O?e:{...e,a:1}),ze=e=>{B(e),V()},Be=async()=>{let e=C();if(e&&F)try{let t=await new e().open(),n=s.parseColor(t.sRGBHex,R.current.h);if(!n)return;ze({...n,a:R.current.a}),we(k.eyeDropperPicked(`${k.describeColor(n)}, ${s.toHex(n,!1)}`))}catch{}},Ve=k.describeColor(L),He={...L,a:1},Ue={h:L.h,s:100,v:100,a:1},$=fe??A?.labelId,We=!ue||Q.length===0,Ge={...he,"--cp-color":x(L)};return(0,f.jsxs)(`div`,{...ge,role:`group`,"aria-labelledby":$,"aria-label":$?void 0:de,className:t.cx(c.default.root,_[P],v[le],me),style:Ge,"data-disabled":M||void 0,"data-readonly":N||void 0,"data-invalid":_e||void 0,"data-dragging":K||void 0,children:[We&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`div`,{ref:Te,className:c.default.area,style:{background:`linear-gradient(to top, ${x({h:0,s:0,v:0,a:1})}, transparent), linear-gradient(to right, ${x({h:0,s:0,v:100,a:1})}, ${x(Ue)})`},onPointerDown:Ae,onPointerMove:je,onPointerUp:Me,onPointerCancel:Me,onLostPointerCapture:e=>{K&&Me(e)},children:(0,f.jsx)(`span`,{role:`group`,"aria-label":k.area,"aria-roledescription":k.areaRoleDescription,className:t.cx(c.default.thumb,c.default.areaThumb),style:{left:`${L.s}%`,top:`${100-L.v}%`,background:x(He)},children:[`s`,`v`].map(e=>(0,f.jsx)(`input`,{ref:e===`s`?W:G,type:`range`,className:c.default.axisInput,min:0,max:100,step:1,value:Math.round(e===`s`?L.s:L.v),tabIndex:e===Ee?0:-1,disabled:M,"aria-label":e===`s`?k.saturation:k.brightness,"aria-orientation":e===`s`?`horizontal`:`vertical`,"aria-valuetext":`${e===`s`?k.saturation:k.brightness} ${Math.round(e===`s`?L.s:L.v)}%, ${Ve}`,"aria-readonly":N||void 0,...I,onFocus:()=>De(e),onChange:t=>Pe(e,Number(t.target.value)),onKeyDown:Ne,onKeyUp:Fe},e))})}),(0,f.jsxs)(`div`,{className:c.default.sliderRow,children:[(0,f.jsx)(`span`,{className:t.cx(c.default.preview,c.default.checkered),"aria-hidden":`true`,children:(0,f.jsx)(`span`,{className:c.default.previewFill})}),(0,f.jsxs)(`div`,{className:c.default.sliders,children:[(0,f.jsx)(w,{label:k.hue,value:L.h,max:360,valueText:`${k.hue} ${Math.round(L.h)} ${k.degrees}, ${k.hueName(L.h)}`,trackStyle:{background:b},interactive:F,disabled:M,readOnly:N,ariaProps:I,onChange:e=>B({...R.current,h:e}),onCommit:V}),O&&(0,f.jsx)(w,{label:k.alpha,value:L.a*100,max:100,valueText:`${k.alpha} ${Math.round(L.a*100)}%`,trackStyle:{background:`linear-gradient(to right, transparent, ${x(He)})`},checkered:!0,interactive:F,disabled:M,readOnly:N,ariaProps:I,onChange:e=>B({...R.current,a:Math.round(e)/100}),onCommit:V})]})]}),(0,f.jsxs)(`div`,{className:c.default.inputRow,children:[ne&&xe&&(0,f.jsx)(n.IconButton,{"aria-label":k.eyeDropper,variant:`ghost`,tone:`neutral`,size:P,disabled:!F,onClick:Be,children:(0,f.jsx)(r.EyeDropperIcon,{size:`sm`})}),(0,f.jsxs)(`span`,{id:U,className:c.default.formatTag,children:[(0,f.jsxs)(i.VisuallyHidden,{children:[k.input,`, `]}),D.toUpperCase()]}),(0,f.jsx)(o.Input,{id:be,className:c.default.input,size:P,value:J??z,invalid:_e||Ie,disabled:M,readOnly:N,spellCheck:!1,autoComplete:`off`,autoCapitalize:`off`,"aria-labelledby":$?`${$} ${U}`:U,"aria-describedby":Ie?ye:void 0,startIcon:(0,f.jsx)(`span`,{className:t.cx(c.default.inputSwatch,c.default.checkered)}),onChange:e=>{Y(e.target.value),X(!1)},onBlur:Z,onKeyDown:e=>{e.key===`Enter`&&J!==null?(e.preventDefault(),Z()):e.key===`Escape`&&J!==null&&(e.stopPropagation(),Y(null),X(!1))}})]}),(0,f.jsx)(`div`,{className:c.default.message,"aria-live":`polite`,children:Ie&&(0,f.jsxs)(`p`,{id:ye,className:c.default.error,children:[(0,f.jsx)(r.ErrorIcon,{size:`sm`,className:c.default.errorIcon}),(0,f.jsx)(`span`,{children:k.invalidInput})]})})]}),Q.length>0&&(0,f.jsx)(T,{colors:Q,current:L,label:k.swatches,disabled:M,readOnly:N,ariaProps:ue?I:{},withAlpha:O,onSelect:ze,describe:k.describeColor}),(0,f.jsx)(i.VisuallyHidden,{"aria-live":`polite`,children:Ce}),se&&(0,f.jsx)(`input`,{type:`hidden`,name:se,value:z,disabled:M})]})}exports.ColorPicker=E,exports.colorPickerLabelsFrom=p,exports.colorsEqual=s.colorsEqual,exports.defaultColorPickerLabels=m,exports.describeColor=s.describeColor,exports.formatColor=s.formatColor,exports.getHueName=s.getHueName,exports.getLuminance=s.getLuminance,exports.hslToHsv=s.hslToHsv,exports.hsvToHsl=s.hsvToHsl,exports.hsvToRgb=s.hsvToRgb,exports.isValidColor=s.isValidColor,exports.parseColor=s.parseColor,exports.rgbToHsv=s.rgbToHsv,exports.toHex=s.toHex;
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
import { Size } from '../../../types/common';
|
|
3
|
-
import { ColorFormat, HSVA } from './colorUtils';
|
|
4
|
-
import { Messages } from '../../../i18n/types';
|
|
5
|
-
export * from './colorUtils';
|
|
6
|
-
/**
|
|
7
|
-
* Visual style of the picker.
|
|
8
|
-
* - `panel`: a bordered, padded surface (default). Use it inline on a page.
|
|
9
|
-
* - `plain`: no border, background, or padding. Use it inside your own
|
|
10
|
-
* surface (a popover, card, or drawer). `ColorInput` uses this.
|
|
11
|
-
*/
|
|
12
|
-
export type ColorPickerVariant = "panel" | "plain";
|
|
13
|
-
/**
|
|
14
|
-
* The picker's visible and accessible strings. Override any of them to
|
|
15
|
-
* translate, including the color names (`describeColor`, `hueName`).
|
|
16
|
-
*/
|
|
17
|
-
export interface ColorPickerLabels {
|
|
18
|
-
/** Name of the 2D saturation / brightness area (a group of two sliders). @default "Saturation and brightness" */
|
|
19
|
-
area: string;
|
|
20
|
-
/** Role description of the 2D area group. @default "2D slider" */
|
|
21
|
-
areaRoleDescription: string;
|
|
22
|
-
/** Name of the area's horizontal slider. @default "Saturation" */
|
|
23
|
-
saturation: string;
|
|
24
|
-
/** Name of the area's vertical slider. @default "Brightness" */
|
|
25
|
-
brightness: string;
|
|
26
|
-
/** Name of the hue slider. @default "Hue" */
|
|
27
|
-
hue: string;
|
|
28
|
-
/** Unit read after the hue number. @default "degrees" */
|
|
29
|
-
degrees: string;
|
|
30
|
-
/** Name of the alpha slider. @default "Opacity" */
|
|
31
|
-
alpha: string;
|
|
32
|
-
/** Name of the text field (combined with a Field label when there is one). @default "Color value" */
|
|
33
|
-
input: string;
|
|
34
|
-
/** Message shown when the typed value can't be parsed. */
|
|
35
|
-
invalidInput: string;
|
|
36
|
-
/** Name of the swatch radio group. @default "Preset colors" */
|
|
37
|
-
swatches: string;
|
|
38
|
-
/** Name of the eyedropper button. @default "Pick a color from the screen" */
|
|
39
|
-
eyeDropper: string;
|
|
40
|
-
/** Announcement after the eyedropper picks a color; receives the color description. */
|
|
41
|
-
eyeDropperPicked: (description: string) => string;
|
|
42
|
-
/**
|
|
43
|
-
* Plain-language name of a color ("dark blue", "red, 50% opacity"), read in
|
|
44
|
-
* slider value text, swatch names, announcements, and ColorInput's button.
|
|
45
|
-
* Receives HSVA: hue 0-360, saturation and brightness 0-100, alpha 0-1.
|
|
46
|
-
* @default English names
|
|
47
|
-
*/
|
|
48
|
-
describeColor: (color: HSVA) => string;
|
|
49
|
-
/** Name of a hue (0-360), read with the hue slider's value. @default English names ("blue") */
|
|
50
|
-
hueName: (hue: number) => string;
|
|
51
|
-
}
|
|
52
|
-
/** ColorPicker labels in a locale's messages (`LocaleProvider` supplies them). */
|
|
53
|
-
export declare function colorPickerLabelsFrom(messages: Messages): ColorPickerLabels;
|
|
54
|
-
/** English labels (the defaults without a `LocaleProvider`). */
|
|
55
|
-
export declare const defaultColorPickerLabels: ColorPickerLabels;
|
|
56
|
-
/** Value, format, and state props shared by `ColorPicker` and `ColorInput`. */
|
|
57
|
-
export interface ColorPickerBaseProps {
|
|
58
|
-
/** Controlled color string in any supported format (`#rgb`, `#rrggbb`, `#rrggbbaa`, `rgb()`, `rgba()`, `hsl()`, `hsla()`). */
|
|
59
|
-
value?: string;
|
|
60
|
-
/** Initial color when uncontrolled. @default "#1d4ed8" */
|
|
61
|
-
defaultValue?: string;
|
|
62
|
-
/** Called with the formatted color string on every change (drag, key press, swatch, typed value). */
|
|
63
|
-
onValueChange?: (color: string) => void;
|
|
64
|
-
/** Called once an interaction ends: pointer up, key up, swatch pick, eyedropper pick, or a committed typed value. Use it for expensive work. */
|
|
65
|
-
onValueCommit?: (color: string) => void;
|
|
66
|
-
/** Format of the emitted string. @default "hex" */
|
|
67
|
-
format?: ColorFormat;
|
|
68
|
-
/**
|
|
69
|
-
* Enables the opacity slider and alpha output. Alpha is written only when
|
|
70
|
-
* it is below 1 (`#rrggbbaa`, `rgba()`, `hsla()`). Without it, any alpha in
|
|
71
|
-
* the value is ignored. @default false
|
|
72
|
-
*/
|
|
73
|
-
alpha?: boolean;
|
|
74
|
-
/** Preset colors, shown as a radio group of swatches. Unparseable entries are skipped. */
|
|
75
|
-
swatches?: string[];
|
|
76
|
-
/** Show the eyedropper button when the browser supports the EyeDropper API (hidden otherwise). @default true */
|
|
77
|
-
eyeDropper?: boolean;
|
|
78
|
-
/** Control size. Picks up a surrounding Field's size. @default "md" */
|
|
79
|
-
size?: Size;
|
|
80
|
-
/** Disables every part. Picked up from a surrounding Field. */
|
|
81
|
-
disabled?: boolean;
|
|
82
|
-
/** Every part stays focusable and announces its value, but the color can't change. Picked up from a surrounding Field. */
|
|
83
|
-
readOnly?: boolean;
|
|
84
|
-
/** Invalid styling and `aria-invalid`. Picked up from a surrounding Field (pass `error` to the Field). */
|
|
85
|
-
invalid?: boolean;
|
|
86
|
-
/** Form field name. Renders an `<input type="hidden">` holding the formatted color. */
|
|
87
|
-
name?: string;
|
|
88
|
-
/** Override any built-in string. */
|
|
89
|
-
labels?: Partial<ColorPickerLabels>;
|
|
90
|
-
}
|
|
91
|
-
/** Props for `ColorPicker`. Other props are spread onto the root `div` (`role="group"`). */
|
|
92
|
-
export interface ColorPickerProps extends ColorPickerBaseProps, Omit<ComponentPropsWithRef<"div">, keyof ColorPickerBaseProps | "onChange" | "children"> {
|
|
93
|
-
/** Panel surface or plain. @default "panel" */
|
|
94
|
-
variant?: ColorPickerVariant;
|
|
95
|
-
/** Show only the swatch palette (plus the hidden form input), without the area, sliders, and text field. Requires `swatches`. @default false */
|
|
96
|
-
swatchesOnly?: boolean;
|
|
97
|
-
/** Accessible name of the group when there's no visible label. Inside a Field, the Field's label is used. */
|
|
98
|
-
"aria-label"?: string;
|
|
99
|
-
/** id of a visible label for the group. Inside a Field, the Field's label is used. */
|
|
100
|
-
"aria-labelledby"?: string;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* An inline color picker: a 2D saturation / brightness area, a hue slider,
|
|
104
|
-
* an optional opacity slider, a text field, optional preset swatches, and an
|
|
105
|
-
* eyedropper (when the browser supports it).
|
|
106
|
-
*
|
|
107
|
-
* **2D area pattern.** The area is a group ("Saturation and brightness",
|
|
108
|
-
* `aria-roledescription="2D slider"`) holding two visually hidden native
|
|
109
|
-
* range inputs, Saturation and Brightness, that share one tab stop and one
|
|
110
|
-
* visible thumb. Each reports its own value plus a plain color description
|
|
111
|
-
* ("Brightness 40%, dark blue"), so a screen reader's adjust gesture works
|
|
112
|
-
* on either axis. Left / Right change saturation and Up / Down brightness
|
|
113
|
-
* (Shift: 10 at a time), with focus following the axis; PageUp / PageDown
|
|
114
|
-
* change brightness by 10; Home / End go to the ends of the focused axis
|
|
115
|
-
* (on Brightness: pure black or white).
|
|
116
|
-
*
|
|
117
|
-
* **Hue and opacity** are `role="slider"` thumbs with Arrows (+/-1, Shift
|
|
118
|
-
* +/-10), PageUp / PageDown (+/-10), and Home / End. Clicking any track or
|
|
119
|
-
* the area jumps there; dragging uses pointer capture.
|
|
120
|
-
*
|
|
121
|
-
* **Text field** accepts any supported format and validates on blur or
|
|
122
|
-
* Enter. An invalid value shows an error (icon plus text, announced
|
|
123
|
-
* politely) and reverts to the last valid color. Escape discards the edit.
|
|
124
|
-
*
|
|
125
|
-
* Inside a `Field`, the Field's label names the group (and, with the
|
|
126
|
-
* format word, the text field); hint, error, invalid, disabled, read-only,
|
|
127
|
-
* and size are wired automatically.
|
|
128
|
-
*/
|
|
129
|
-
export declare function ColorPicker(props: ColorPickerProps): import("react").JSX.Element;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=`_sizeSm_1fh45_35`,t=`_sizeMd_1fh45_55`,n=`_sizeLg_1fh45_75`,r=`_root_1fh45_103`,i=`_panel_1fh45_127`,a=`_plain_1fh45_143`,o=`_checkered_1fh45_169`,s=`_swatch_1fh45_171`,c=`_area_1fh45_201`,l=`_thumb_1fh45_249`,u=`_areaThumb_1fh45_327`,d=`_axisInput_1fh45_355`,f=`_channel_1fh45_407`,p=`_sliderRow_1fh45_435`,m=`_preview_1fh45_449`,h=`_previewFill_1fh45_469`,g=`_sliders_1fh45_485`,_=`_rail_1fh45_523`,v=`_track_1fh45_533`,y=`_trackFill_1fh45_553`,b=`_inputRow_1fh45_583`,x=`_formatTag_1fh45_597`,S=`_input_1fh45_583`,C=`_inputSwatch_1fh45_647`,w=`_message_1fh45_687`,T=`_error_1fh45_703`,E=`_errorIcon_1fh45_727`,D=`_swatchSection_1fh45_745`,O=`_swatchCaption_1fh45_771`,k=`_swatches_1fh45_789`,A=`_swatchColor_1fh45_903`,j=`_swatchCheck_1fh45_917`,M=`_trigger_1fh45_1045`,N=`_triggerSm_1fh45_1105`,P=`_triggerMd_1fh45_1119`,F=`_triggerLg_1fh45_1133`,I=`_triggerFullWidth_1fh45_1147`,L=`_triggerSwatch_1fh45_1225`,R=`_triggerValue_1fh45_1271`,z=`_triggerChevron_1fh45_1287`,B={sizeSm:e,sizeMd:t,sizeLg:n,root:r,panel:i,plain:a,checkered:o,swatch:s,area:c,thumb:l,areaThumb:u,axisInput:d,channel:f,sliderRow:p,preview:m,previewFill:h,sliders:g,rail:_,track:v,trackFill:y,inputRow:b,formatTag:x,input:S,inputSwatch:C,message:w,error:T,errorIcon:E,swatchSection:D,swatchCaption:O,swatches:k,swatchColor:A,swatchCheck:j,trigger:M,triggerSm:N,triggerMd:P,triggerLg:F,triggerFullWidth:I,triggerSwatch:L,triggerValue:R,triggerChevron:z};exports.area=c,exports.areaThumb=u,exports.axisInput=d,exports.channel=f,exports.checkered=o,exports.default=B,exports.error=T,exports.errorIcon=E,exports.formatTag=x,exports.input=S,exports.inputRow=b,exports.inputSwatch=C,exports.message=w,exports.panel=i,exports.plain=a,exports.preview=m,exports.previewFill=h,exports.rail=_,exports.root=r,exports.sizeLg=n,exports.sizeMd=t,exports.sizeSm=e,exports.sliderRow=p,exports.sliders=g,exports.swatch=s,exports.swatchCaption=O,exports.swatchCheck=j,exports.swatchColor=A,exports.swatchSection=D,exports.swatches=k,exports.thumb=l,exports.track=v,exports.trackFill=y,exports.trigger=M,exports.triggerChevron=z,exports.triggerFullWidth=I,exports.triggerLg=F,exports.triggerMd=P,exports.triggerSm=N,exports.triggerSwatch=L,exports.triggerValue=R;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("../../../i18n/en.cjs.js");var t=(e,t,n)=>Math.min(n,Math.max(t,e)),n=(e,t=0)=>{let n=10**t;return Math.round(e*n)/n};function r({h:e,s:n,v:r,a:i}){let a=t(n,0,100)/100,o=t(r,0,100)/100,s=(e%360+360)%360/60,c=e=>{let t=(e+s)%6;return o-o*a*Math.max(0,Math.min(t,4-t,1))};return{r:c(5)*255,g:c(3)*255,b:c(1)*255,a:i}}function i({r:e,g:n,b:r,a:i},a=0){let o=t(e,0,255)/255,s=t(n,0,255)/255,c=t(r,0,255)/255,l=Math.max(o,s,c),u=l-Math.min(o,s,c),d=a;return u>0&&(d=l===o?(s-c)/u%6:l===s?(c-o)/u+2:(o-s)/u+4,d*=60,d<0&&(d+=360)),{h:d,s:l===0?0:u/l*100,v:l*100,a:i}}function a({h:e,s:t,v:n,a:r}){let i=t/100,a=n/100,o=a*(1-i/2);return{h:e,s:(o===0||o===1?0:(a-o)/Math.min(o,1-o))*100,l:o*100,a:r}}function o({h:e,s:t,l:n,a:r}){let i=t/100,a=n/100,o=a+i*Math.min(a,1-a);return{h:e,s:(o===0?0:2*(1-a/o))*100,v:o*100,a:r}}var s=/^#?([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,c=/^(rgba?|hsla?)\(\s*([^)]*)\)$/i;function l(e){let t=e.replace(/\//g,` / `).split(/[\s,]+/).filter(Boolean),n=t.indexOf(`/`);return n===-1?t:n!==3||t.length!==5?null:[t[0],t[1],t[2],t[4]]}var u=/^[+-]?(\d+\.?\d*|\.\d+)(e[+-]?\d+)?$/i;function d(e,t){if(e.endsWith(`%`)){let n=e.slice(0,-1);return u.test(n)?Number(n)/100*t:null}return u.test(e)?Number(e):null}function f(e){if(e===void 0)return 1;let n=d(e,1);return n===null?null:t(n,0,1)}function p(e){let t=/^(.*?)(deg|turn|rad|grad)?$/i.exec(e);if(!t||!u.test(t[1]))return null;let n=Number(t[1]),r=(t[2]??`deg`).toLowerCase();return r===`turn`?n*=360:r===`rad`?n=n*180/Math.PI:r===`grad`&&(n*=.9),(n%360+360)%360}function m(e,n=0){let r=e.trim();if(!r)return null;let a=s.exec(r);if(a){let e=a[1];e.length<=4&&(e=e.replace(/./g,e=>e+e));let t=t=>parseInt(e.slice(t,t+2),16),r=e.length===8?t(6)/255:1;return i({r:t(0),g:t(2),b:t(4),a:r},n)}let u=c.exec(r);if(!u)return null;let m=u[1].toLowerCase().startsWith(`rgb`)?`rgb`:`hsl`,h=l(u[2]);if(!h||h.length<3||h.length>4)return null;let g=f(h[3]);if(g===null)return null;if(m===`rgb`){let[e,r,a]=h.slice(0,3).map(e=>d(e,255));return e===null||r===null||a===null?null:i({r:t(e,0,255),g:t(r,0,255),b:t(a,0,255),a:g},n)}let _=p(h[0]),v=d(h[1].endsWith(`%`)?h[1]:`${h[1]}%`,100),y=d(h[2].endsWith(`%`)?h[2]:`${h[2]}%`,100);return _===null||v===null||y===null?null:o({h:_,s:t(v,0,100),l:t(y,0,100),a:g})}function h(e){return m(e)!==null}var g=e=>Math.round(t(e,0,255)).toString(16).padStart(2,`0`);function _(e,t=!0){let{r:n,g:i,b:a,a:o}=r(e),s=`#${g(n)}${g(i)}${g(a)}`;return t&&o<1?`${s}${g(o*255)}`:s}function v(e,i=`hex`,{alpha:o=!0}={}){let s=o&&e.a<1,c=n(t(e.a,0,1),2);if(i===`hex`)return _(e,o);if(i===`rgb`){let{r:t,g:n,b:i}=r(e),a=`${Math.round(t)}, ${Math.round(n)}, ${Math.round(i)}`;return s?`rgba(${a}, ${c})`:`rgb(${a})`}let{h:l,s:u,l:d}=a(e),f=`${Math.round(l)%360}, ${Math.round(u)}%, ${Math.round(d)}%`;return s?`hsla(${f}, ${c})`:`hsl(${f})`}function y(e,t){return _({...e,a:n(e.a,2)})===_({...t,a:n(t.a,2)})}var b=[[15,`red`],[40,`orange`],[55,`gold`],[65,`yellow`],[90,`yellowGreen`],[150,`green`],[175,`teal`],[200,`cyan`],[250,`blue`],[280,`purple`],[320,`magenta`],[345,`pink`],[361,`red`]],x=e=>{let t=(e%360+360)%360;return b.find(([e])=>t<e)?.[1]??`red`};function S(t,n=e.en.colorPicker.colors){return n.hues[x(t)]}function C(t,n=e.en.colorPicker.colors){let{s:r,l:i}=a(t),o;if(i<8)o=n.black;else if(i>96)o=n.white;else if(r<10||t.s<8)o=i<30?n.dark(n.gray):i>70?n.light(n.gray):n.gray;else{let e=x(t.h);if((e===`orange`||e===`red`||e===`yellow`)&&i<35&&r<75)o=e===`yellow`?n.olive:n.brown;else{let t=i<30?n.dark:i>72?n.light:void 0,a=r<35?n.muted:!t&&r>85?n.vivid:void 0;o=n.hues[e],a&&(o=a(o)),t&&(o=t(o))}}return t.a<1&&(o=n.withOpacity(o,Math.round(t.a*100))),o}function w(e){let{r:t,g:n,b:i,a}=r(e),o=e=>{let t=(e*a+255*(1-a))/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*o(t)+.7152*o(n)+.0722*o(i)}exports.colorsEqual=y,exports.describeColor=C,exports.formatColor=v,exports.getHueName=S,exports.getLuminance=w,exports.hslToHsv=o,exports.hsvToHsl=a,exports.hsvToRgb=r,exports.isValidColor=h,exports.parseColor=m,exports.rgbToHsv=i,exports.toHex=_;
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { ColorNames } from '../../../i18n/types';
|
|
2
|
-
/** Output format of the color string a picker emits. */
|
|
3
|
-
export type ColorFormat = "hex" | "rgb" | "hsl";
|
|
4
|
-
/** Hue 0-360, saturation 0-100, value (brightness) 0-100, alpha 0-1. */
|
|
5
|
-
export interface HSVA {
|
|
6
|
-
h: number;
|
|
7
|
-
s: number;
|
|
8
|
-
v: number;
|
|
9
|
-
a: number;
|
|
10
|
-
}
|
|
11
|
-
/** Red, green, blue 0-255 (may be fractional), alpha 0-1. */
|
|
12
|
-
export interface RGBA {
|
|
13
|
-
r: number;
|
|
14
|
-
g: number;
|
|
15
|
-
b: number;
|
|
16
|
-
a: number;
|
|
17
|
-
}
|
|
18
|
-
/** Hue 0-360, saturation 0-100, lightness 0-100, alpha 0-1. */
|
|
19
|
-
export interface HSLA {
|
|
20
|
-
h: number;
|
|
21
|
-
s: number;
|
|
22
|
-
l: number;
|
|
23
|
-
a: number;
|
|
24
|
-
}
|
|
25
|
-
/** Options for `formatColor`. */
|
|
26
|
-
export interface FormatColorOptions {
|
|
27
|
-
/**
|
|
28
|
-
* Include the alpha channel when it is below 1 (`#rrggbbaa`, `rgba()`,
|
|
29
|
-
* `hsla()`). When `false`, alpha is dropped and the color is opaque.
|
|
30
|
-
* @default true
|
|
31
|
-
*/
|
|
32
|
-
alpha?: boolean;
|
|
33
|
-
}
|
|
34
|
-
/** HSV(A) to RGB(A). Channels come back unrounded. */
|
|
35
|
-
export declare function hsvToRgb({ h, s, v, a }: HSVA): RGBA;
|
|
36
|
-
/**
|
|
37
|
-
* RGB(A) to HSV(A). Pass `fallbackHue` to keep a hue when the color is
|
|
38
|
-
* achromatic (gray, black, white), where RGB carries no hue.
|
|
39
|
-
*/
|
|
40
|
-
export declare function rgbToHsv({ r, g, b, a }: RGBA, fallbackHue?: number): HSVA;
|
|
41
|
-
/** HSV(A) to HSL(A). The hue is kept as-is. */
|
|
42
|
-
export declare function hsvToHsl({ h, s, v, a }: HSVA): HSLA;
|
|
43
|
-
/** HSL(A) to HSV(A). The hue is kept as-is. */
|
|
44
|
-
export declare function hslToHsv({ h, s, l, a }: HSLA): HSVA;
|
|
45
|
-
/**
|
|
46
|
-
* Parses a CSS color string into HSVA. Supports `#rgb`, `#rgba`, `#rrggbb`,
|
|
47
|
-
* `#rrggbbaa` (the `#` is optional), `rgb()` / `rgba()`, and `hsl()` /
|
|
48
|
-
* `hsla()` in both comma and space syntax (`rgb(0 0 0 / 50%)`). Returns
|
|
49
|
-
* `null` for anything else.
|
|
50
|
-
*
|
|
51
|
-
* Pass `fallbackHue` to keep a hue for achromatic RGB colors.
|
|
52
|
-
*/
|
|
53
|
-
export declare function parseColor(input: string, fallbackHue?: number): HSVA | null;
|
|
54
|
-
/** True when `parseColor` understands the string. */
|
|
55
|
-
export declare function isValidColor(input: string): boolean;
|
|
56
|
-
/** `#rrggbb`, or `#rrggbbaa` when `withAlpha` and alpha is below 1. Lowercase. */
|
|
57
|
-
export declare function toHex(color: HSVA, withAlpha?: boolean): string;
|
|
58
|
-
/**
|
|
59
|
-
* Formats HSVA as a CSS color string:
|
|
60
|
-
* - `hex`: `#1d4ed8`, or `#1d4ed880` with alpha
|
|
61
|
-
* - `rgb`: `rgb(29, 78, 216)`, or `rgba(29, 78, 216, 0.5)` with alpha
|
|
62
|
-
* - `hsl`: `hsl(224, 76%, 48%)`, or `hsla(224, 76%, 48%, 0.5)` with alpha
|
|
63
|
-
*
|
|
64
|
-
* The alpha form is used only when alpha is below 1 (and `options.alpha`
|
|
65
|
-
* isn't `false`).
|
|
66
|
-
*/
|
|
67
|
-
export declare function formatColor(color: HSVA, format?: ColorFormat, { alpha }?: FormatColorOptions): string;
|
|
68
|
-
/** Same color, compared as rounded 8-digit hex (`#rrggbbaa`). */
|
|
69
|
-
export declare function colorsEqual(a: HSVA, b: HSVA): boolean;
|
|
70
|
-
/**
|
|
71
|
-
* A plain name for a hue angle, e.g. `210` -> `"blue"`. Pass a locale's
|
|
72
|
-
* `colorPicker.colors` messages for another language (English by default).
|
|
73
|
-
*/
|
|
74
|
-
export declare function getHueName(hue: number, names?: ColorNames): string;
|
|
75
|
-
/**
|
|
76
|
-
* A short, human description of a color for screen readers: hue name plus a
|
|
77
|
-
* lightness / vividness approximation, e.g. `"dark blue"`, `"light gray"`,
|
|
78
|
-
* `"vivid orange"`, `"brown"`. Alpha below 1 adds `", 50% opacity"`.
|
|
79
|
-
* Pass a locale's `colorPicker.colors` messages for another language.
|
|
80
|
-
*/
|
|
81
|
-
export declare function describeColor(color: HSVA, names?: ColorNames): string;
|
|
82
|
-
/**
|
|
83
|
-
* Relative luminance (WCAG) of the color composited on white, 0-1. Useful
|
|
84
|
-
* for choosing a light or dark overlay on top of a swatch.
|
|
85
|
-
*/
|
|
86
|
-
export declare function getLuminance(color: HSVA): number;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";const e=require("../../../hooks/useControllableState.cjs.js"),t=require("../../../hooks/useOverlayLayer.cjs.js"),n=require("../../../utils/cx.cjs.js"),r=require("../../../utils/refs.cjs.js"),i=require("../../data-display/Chip/Chip.cjs.js"),ee=require("../../primitives/Icon/icons.cjs.js"),te=require("../../utilities/VisuallyHidden/VisuallyHidden.cjs.js"),ne=require("../Field/FieldContext.cjs.js"),re=require("./ComboboxPopup.cjs.js"),a=require("./comboboxUtils.cjs.js"),o=require("./Combobox.module.css.cjs.js"),ie=require("../../utilities/LocaleProvider/LocaleProvider.cjs.js");let s=require("react"),c=require("react/jsx-runtime"),ae=require("react-dom");var oe={sm:o.default.sm,md:o.default.md,lg:o.default.lg},se={sm:`sm`,md:`sm`,lg:`md`};function l(e){return typeof e==`string`||typeof e==`number`?String(e):``}var ce=500,le=le=>{let u=ie.useMessages().combobox,{options:d,renderOption:ue,multiple:f=!1,value:de,defaultValue:fe,onValueChange:pe,inputValue:me,defaultInputValue:he,onInputValueChange:ge,open:_e,defaultOpen:ve=!1,onOpenChange:ye,filter:be,loading:p=!1,loadingMessage:xe=u.loading,emptyMessage:m=u.empty,resultsMessage:Se=u.results,allowCustomValue:h=!1,onCreate:g,createLabel:Ce=u.create,clearable:we=!1,clearLabel:Te=u.clear,requiredMessage:Ee=u.required,clearOnEscape:De=!1,showSuggestionsLabel:Oe=u.showSuggestions,hideSuggestionsLabel:ke=u.hideSuggestions,selectedLabel:Ae=u.selected,autoHighlight:je=!1,loop:Me=!0,size:Ne,invalid:Pe,required:Fe,disabled:Ie,readOnly:Le,name:_,placement:Re=`bottom-start`,maxHeight:ze,fullWidth:Be=!0,container:Ve,inputClassName:He,className:Ue,style:We,id:Ge,ref:Ke,placeholder:qe,onChange:Je,onKeyDown:Ye,onBlur:Xe,"aria-describedby":Ze,"aria-label":v,"aria-labelledby":Qe,...$e}=le,y=ne.useFieldContext(),b=ne.useFieldControl({id:Ge,invalid:Pe,required:Fe,disabled:Ie,readOnly:Le,size:Ne,"aria-describedby":Ze},{nativeRequired:!1}),x=b.size??`md`,S=!b.disabled&&!b.readOnly,et=(0,s.useId)(),tt=b.id??`${et}-input`,C=`${et}-listbox`,w=(0,s.useRef)(null),T=(0,s.useRef)(null),nt=(0,s.useRef)(null),rt=(0,s.useCallback)(e=>{w.current=e,r.assignRef(Ke,e)},[Ke]),E=(0,s.useRef)(new Map);for(let e of d)E.current.set(e.value,e);let D=e=>d.find(t=>t.value===e)??E.current.get(e),[O,k]=e.useControllableState({value:de,defaultValue:fe??(f?[]:null),onChange:pe}),A=f?Array.isArray(O)?O:[]:typeof O==`string`?[O]:[],j=!f&&typeof O==`string`?O:null,M=j===null?``:D(j)?.label??j,[N,P]=e.useControllableState({value:me,defaultValue:he??(f?``:M),onChange:ge}),it=A.length>0||h&&!f&&N.trim()!==``;(0,s.useEffect)(()=>{w.current?.setCustomValidity(b.required&&!it?Ee:``)},[b.required,it,Ee]);let[F,I]=e.useControllableState({value:_e,defaultValue:ve,onChange:ye}),at=F&&S,[L,R]=(0,s.useState)(!1),[z,B]=(0,s.useState)(null),V=be===!1?null:be??a.defaultComboboxFilter,ot=(e,t)=>{let n=[];d.forEach((t,r)=>{(!V||V(t,e))&&n.push({kind:`option`,key:t.value,option:t,id:`${C}-option-${r}`})});let r=N.trim();if(g&&t&&r!==``){let e=a.normalizeText(r);d.some(t=>a.normalizeText(t.label)===e)||n.push({kind:`create`,key:a.CREATE_KEY,text:r,id:`${C}-create`})}return a.orderItems(n)},H=f||L,U=(0,s.useMemo)(()=>ot(H?N:``,H),[d,V,H,N,!!g,C]),W=z===null?-1:U.findIndex(e=>e.key===z);W>=0&&!a.isEnabled(U[W])&&(W=-1),W===-1&&je&&H&&N.trim()!==``&&(W=a.findEnabled(U,-1,1,!0));let st=m!=null&&m!==!1&&m!==``,G=at&&(U.length>0||p||st),ct=G&&W>=0?U[W].id:void 0,[lt,K]=(0,s.useState)(``),ut=U.filter(e=>e.kind===`option`).length,dt=U.find(e=>e.kind===`create`),q=G?p?l(xe):ut>0?Se(ut):dt?.kind===`create`?l(Ce(dt.text)):l(m):``;(0,s.useEffect)(()=>{if(!q)return;let e=window.setTimeout(()=>K(q),ce);return()=>window.clearTimeout(e)},[q]),(0,s.useEffect)(()=>{G||K(``)},[G]);let J=(0,s.useRef)(me!==void 0&&!f&&M!==``?null:M);(0,s.useEffect)(()=>{f||J.current===M||(J.current=M,h&&M===``||L||P(M))},[f,M,L,h,P]);let Y=e=>{(!e||S)&&(I(e),e||B(null))},ft=t.useOverlayLayer({active:G,elements:()=>[T,nt],onEscape:()=>Y(!1),onOutsidePress:()=>Y(!1)}),X=e=>{if(!S)return;let t=!f&&N===M,n=f||L&&!t;t&&R(!1);let r=ot(n?N:``,n),i=-1;e===`first`?i=a.findEnabled(r,-1,1,!0):e===`last`?i=a.findEnabled(r,-1,-1,!0):e===`selected`&&(i=r.findIndex(e=>e.kind===`option`&&!e.option.disabled&&A.includes(e.option.value)),i<0&&(i=a.findEnabled(r,-1,1,!0))),B(i>=0?r[i].key:null),I(!0)},pt=e=>{let t=a.findEnabled(U,W,e,Me);B(t>=0?U[t].key:null)},Z=(e,t)=>{if(f){let n=A.includes(e);k(n?A.filter(t=>t!==e):[...A,e]),P(``),R(!1),B(e),K(n?u.optionRemoved(t):u.optionSelected(t))}else k(e),J.current=t,P(t),R(!1),Y(!1)},mt=e=>{if(!a.isEnabled(e))return;if(e.kind===`option`){Z(e.option.value,e.option.label);return}let t=g?.(e.text);typeof t==`string`?(E.current.set(t,{value:t,label:e.text}),Z(t,e.text)):(R(!1),f?P(``):Y(!1))},ht=e=>{S&&(k(A.filter(t=>t!==e)),K(u.optionRemoved(D(e)?.label??e)))},Q=()=>{k(f?[]:null),J.current=``,P(``),R(!1),B(null)},gt=e=>{Je?.(e),P(e.target.value),R(!0),B(null),F||Y(!0)},_t=e=>{if(Ye?.(e),!(e.defaultPrevented||e.nativeEvent.isComposing||b.disabled))switch(e.key){case`ArrowDown`:if(!S)return;e.preventDefault(),e.altKey?G||X(`none`):G?pt(1):X(f?`first`:`selected`);return;case`ArrowUp`:if(!S)return;e.preventDefault(),e.altKey?Y(!1):G?pt(-1):X(`last`);return;case`Enter`:if(!G){f&&h&&N.trim()&&S&&(e.preventDefault(),e.repeat||vt()),!f&&S&&(0,ae.flushSync)(yt);return}if(e.preventDefault(),e.repeat)return;W>=0?mt(U[W]):f&&h&&N.trim()?vt():(!f&&h&&N!==M&&j!==null&&k(null),Y(!1));return;case`Escape`:if(G)return;if(F){e.preventDefault(),I(!1);return}if(!S)return;{let t=f?``:M;if(N!==t){e.preventDefault(),P(t),R(!1);return}De&&(j!==null||A.length>0)&&(e.preventDefault(),Q())}return;case`Home`:case`End`:case`ArrowLeft`:case`ArrowRight`:z!==null&&B(null);return;case`Backspace`:f&&S&&!e.repeat&&N===``&&A.length>0&&ht(A[A.length-1]);return;default:return}},vt=()=>{let e=N.trim(),t=d.find(t=>a.normalizeText(t.label)===a.normalizeText(e));A.includes(t?.value??e)?P(``):t?t.disabled||Z(t.value,t.label):(E.current.set(e,{value:e,label:e}),Z(e,e))},yt=()=>{f||N===M||(N.trim()===``?j===null?N!==``&&P(``):Q():h?j!==null&&k(null):P(M))},bt=e=>{Xe?.(e),Y(!1),R(!1),yt()},xt=(0,s.useRef)(()=>{});xt.current=()=>{if(de!==void 0)return;let e=fe??(f?[]:null);k(e);let t=typeof e==`string`?D(e)?.label??e:``;P(he??(f?``:t)),Y(!1),R(!1)},(0,s.useEffect)(()=>{let e=w.current?.form;if(!e)return;let t=()=>xt.current();return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)},[]);let St=e=>{let t=w.current;if(!t||b.disabled)return;let n=e.target;T.current?.contains(n)&&(n===t||n.closest(`button, a`)||(e.preventDefault(),t.focus()))},Ct=e=>{let t=e.target;T.current?.contains(t)&&!t.closest(`button, a`)&&(F||X(`none`))},wt=()=>{w.current?.focus(),G||F?Y(!1):X(`none`)},Tt=()=>{Q(),K(u.cleared),w.current?.focus()},Et=e=>e.preventDefault(),Dt=we&&S&&(A.length>0||N!==``),$=f&&A.length>0,Ot=Qe??(v?void 0:y&&!y.isGroup?y.labelId:void 0),kt=_===void 0?null:f?A.map(e=>(0,c.jsx)(`input`,{type:`hidden`,name:_,value:e,disabled:b.disabled},e)):(0,c.jsx)(`input`,{type:`hidden`,name:_,value:j??(h?N:``),disabled:b.disabled});return(0,c.jsxs)(`div`,{ref:T,className:n.cx(o.default.root,oe[x],Be&&o.default.fullWidth,f&&o.default.multiple,$&&o.default.hasChips,b.invalid&&o.default.invalid,b.disabled&&o.default.disabled,b.readOnly&&!b.disabled&&o.default.readOnly,Ue),style:We,"data-size":x,"data-state":G?`open`:`closed`,onMouseDown:St,onClick:Ct,children:[$&&(0,c.jsx)(i.ChipGroup,{"aria-label":Ae,size:se[x],tone:`primary`,variant:`soft`,disabled:b.disabled,focusFallback:w,className:o.default.chips,children:A.map(e=>{let t=D(e);return(0,c.jsx)(i.Chip,{startIcon:t?.icon,onRemove:S?()=>ht(e):void 0,children:t?.label??e},e)})}),(0,c.jsx)(`input`,{autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,...$e,ref:rt,id:tt,type:`text`,role:`combobox`,"aria-label":v,"aria-labelledby":Qe,"aria-expanded":G,"aria-controls":C,"aria-autocomplete":`list`,"aria-activedescendant":ct,...b.ariaProps,placeholder:$?void 0:qe,value:N,disabled:b.disabled,readOnly:b.readOnly,className:n.cx(o.default.input,He),onChange:gt,onKeyDown:_t,onBlur:bt}),(0,c.jsxs)(`span`,{className:o.default.actions,children:[Dt&&(0,c.jsx)(`button`,{type:`button`,className:o.default.iconButton,"aria-label":Te,onMouseDown:Et,onClick:Tt,children:(0,c.jsx)(ee.CloseIcon,{size:x===`lg`?`sm`:`xs`,strokeWidth:2.5})}),(0,c.jsx)(`button`,{type:`button`,tabIndex:-1,className:n.cx(o.default.iconButton,o.default.toggle),"aria-label":G?ke:Oe,disabled:!S,onMouseDown:Et,onClick:wt,children:(0,c.jsx)(ee.ChevronDownIcon,{size:x===`sm`?`sm`:`md`,className:o.default.chevron})})]}),kt,(0,c.jsx)(te.VisuallyHidden,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:lt}),G&&(0,c.jsx)(re.ComboboxPopup,{anchorRef:T,positionerRef:nt,layer:ft,listboxId:C,labelledBy:Ot,label:v,multiple:f,size:x,placement:Re,maxHeight:ze,items:U,highlightedIndex:W,isSelected:e=>A.includes(e),onHighlight:e=>B(U[e]?.key??null),onChoose:mt,renderOption:ue,createLabel:Ce,loading:p,loadingMessage:xe,emptyMessage:m,container:Ve})]})};exports.Combobox=le,exports.defaultComboboxFilter=a.defaultComboboxFilter;
|