haze-ui 1.26.0 → 1.28.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/README.md +420 -36
- package/dist/components/Anchor/Anchor.js +78 -0
- package/dist/components/Anchor/index.js +3 -0
- package/dist/components/AppShell/AppShell.js +44 -0
- package/dist/components/AppShell/index.js +3 -0
- package/dist/components/AspectRatio/AspectRatio.js +0 -1
- package/dist/components/AspectRatio/index.js +0 -1
- package/dist/components/Badge/Badge.js +5 -17
- package/dist/components/Badge/badge-styles.js +15 -0
- package/dist/components/Badge/index.js +3 -3
- package/dist/components/BottomSheet/BottomSheet.js +133 -22
- package/dist/components/Button/index.js +4 -3
- package/dist/components/Calendar/Calendar.js +525 -78
- package/dist/components/Calendar/date.js +35 -2
- package/dist/components/Card/Card.js +0 -1
- package/dist/components/Card/index.js +0 -1
- package/dist/components/Carousel/Carousel.js +64 -41
- package/dist/components/Cascader/Cascader.js +222 -140
- package/dist/components/Chart/Chart.js +34 -0
- package/dist/components/Chart/chart-elements.js +164 -0
- package/dist/components/Chart/index.js +3 -0
- package/dist/components/ChatContainer/ChatContainer.js +36 -16
- package/dist/components/ChatInput/ChatInput.js +49 -29
- package/dist/components/ChatMessage/ChatMessage.js +76 -29
- package/dist/components/Checkbox/Checkbox.js +6 -5
- package/dist/components/Checkbox/CheckboxCore.js +6 -5
- package/dist/components/CodeBlock/CodeBlock.js +39 -10
- package/dist/components/CodeBlock/index.js +0 -1
- package/dist/components/Collapsible/Collapsible.js +23 -10
- package/dist/components/ColorPicker/ColorPicker.js +5 -4
- package/dist/components/ColorPicker/ColorPickerCore.js +5 -4
- package/dist/components/Combobox/Combobox.js +202 -75
- package/dist/components/Combobox/ComboboxGroup.js +23 -0
- package/dist/components/Combobox/ComboboxOption.js +7 -6
- package/dist/components/Combobox/index.js +4 -3
- package/dist/components/Command/Command.js +102 -59
- package/dist/components/Command/CommandDialog.js +48 -0
- package/dist/components/Command/command-filter.js +16 -0
- package/dist/components/Command/index.js +3 -2
- package/dist/components/ConfirmDialog/ConfirmDialog.js +3 -3
- package/dist/components/Container/Container.js +0 -1
- package/dist/components/Container/index.js +0 -1
- package/dist/components/ContextMenu/ContextMenuContent.js +4 -4
- package/dist/components/DataTable/CellEditor.js +38 -0
- package/dist/components/DataTable/DataTable.js +394 -143
- package/dist/components/DataTable/csv.js +29 -0
- package/dist/components/DataTable/features.js +25 -0
- package/dist/components/DataTable/index.js +3 -1
- package/dist/components/DataTable/summary.js +17 -0
- package/dist/components/DateRangePicker/DateRangePicker.js +31 -13
- package/dist/components/DateRangePicker/DateRangePickerCore.js +59 -27
- package/dist/components/DateRangePicker/presets.js +43 -0
- package/dist/components/Datepicker/Datepicker.js +17 -12
- package/dist/components/Datepicker/DatepickerCore.js +73 -39
- package/dist/components/Datepicker/datetime.js +23 -0
- package/dist/components/Descriptions/Descriptions.js +46 -0
- package/dist/components/Descriptions/index.js +3 -0
- package/dist/components/Dialog/Dialog.js +56 -32
- package/dist/components/DiffViewer/DiffViewer.js +31 -30
- package/dist/components/Divider/Divider.js +0 -1
- package/dist/components/Divider/index.js +0 -1
- package/dist/components/Drawer/Drawer.js +49 -29
- package/dist/components/DropdownMenu/DropdownMenu.js +38 -26
- package/dist/components/DropdownMenu/DropdownMenuSub.js +23 -0
- package/dist/components/DropdownMenu/DropdownMenuSubContent.js +24 -0
- package/dist/components/DropdownMenu/DropdownMenuSubTrigger.js +30 -0
- package/dist/components/DropdownMenu/index.js +4 -1
- package/dist/components/FilePreview/FilePreview.js +135 -0
- package/dist/components/FilePreview/file-preview-format.js +23 -0
- package/dist/components/FilePreview/index.js +3 -0
- package/dist/components/Flex/Flex.js +0 -1
- package/dist/components/Flex/index.js +0 -1
- package/dist/components/FloatButton/FloatButton.js +42 -0
- package/dist/components/FloatButton/FloatButtonGroup.js +58 -0
- package/dist/components/FloatButton/float-button-context.js +9 -0
- package/dist/components/FloatButton/float-button-glyphs.js +26 -0
- package/dist/components/FloatButton/float-button-styles.js +14 -0
- package/dist/components/FloatButton/index.js +4 -0
- package/dist/components/Fullscreen/Fullscreen.js +29 -0
- package/dist/components/Fullscreen/index.js +3 -0
- package/dist/components/Grid/Grid.js +0 -1
- package/dist/components/Grid/GridItem.js +0 -1
- package/dist/components/Grid/index.js +0 -1
- package/dist/components/Icon/Icon.js +0 -1
- package/dist/components/Icon/index.js +0 -1
- package/dist/components/Image/Image.js +37 -19
- package/dist/components/Image/ImagePreview.js +233 -0
- package/dist/components/InlineCompletion/InlineCompletion.js +81 -0
- package/dist/components/InlineCompletion/index.js +3 -0
- package/dist/components/Input/Input.js +6 -5
- package/dist/components/Input/InputCore.js +3 -2
- package/dist/components/JsonView/JsonView.js +209 -0
- package/dist/components/JsonView/index.js +3 -0
- package/dist/components/JsonView/json-view-utils.js +24 -0
- package/dist/components/Kbd/Kbd.js +0 -1
- package/dist/components/Kbd/index.js +0 -1
- package/dist/components/LocaleProvider/LocaleProvider.js +16 -13
- package/dist/components/LocaleProvider/index.js +5 -3
- package/dist/components/LocaleProvider/ja-jp.js +222 -0
- package/dist/components/LocaleProvider/locale.js +99 -5
- package/dist/components/LocaleProvider/strings.js +15 -0
- package/dist/components/LocaleProvider/useStrings.js +13 -11
- package/dist/components/LocaleProvider/zh-cn.js +99 -5
- package/dist/components/Masonry/Masonry.js +29 -0
- package/dist/components/Masonry/index.js +3 -0
- package/dist/components/Masonry/masonry-distribute.js +15 -0
- package/dist/components/Mentions/Mentions.js +6 -5
- package/dist/components/Mentions/MentionsCore.js +69 -68
- package/dist/components/Menu/Menu.js +5 -5
- package/dist/components/Menu/MenuSub.js +23 -0
- package/dist/components/Menu/MenuSubContent.js +24 -0
- package/dist/components/Menu/MenuSubTrigger.js +30 -0
- package/dist/components/Menu/index.js +4 -1
- package/dist/components/NumberInput/NumberInput.js +6 -5
- package/dist/components/NumberInput/NumberInputCore.js +9 -8
- package/dist/components/OTPInput/OTPInput.js +5 -4
- package/dist/components/OTPInput/OTPInputCore.js +34 -33
- package/dist/components/PasswordInput/PasswordInput.js +5 -4
- package/dist/components/PasswordInput/PasswordInputCore.js +8 -7
- package/dist/components/Popover/Popover.js +43 -31
- package/dist/components/PromptInput/PromptInput.js +213 -0
- package/dist/components/PromptInput/index.js +3 -0
- package/dist/components/Radio/Radio.js +7 -6
- package/dist/components/Radio/RadioGroup.js +5 -4
- package/dist/components/Radio/RadioGroupCore.js +23 -14
- package/dist/components/Rating/Rating.js +5 -4
- package/dist/components/Rating/RatingCore.js +62 -28
- package/dist/components/Resizable/index.js +1 -1
- package/dist/components/Segmented/Segmented.js +5 -4
- package/dist/components/Segmented/SegmentedCore.js +22 -18
- package/dist/components/Select/OptionGroup.js +12 -0
- package/dist/components/Select/Select.js +20 -9
- package/dist/components/Select/SelectCore.js +74 -13
- package/dist/components/Select/SelectFloating.js +256 -0
- package/dist/components/Select/index.js +5 -4
- package/dist/components/Select/select-options.js +57 -0
- package/dist/components/Sidebar/Sidebar.js +9 -9
- package/dist/components/Signature/Signature.js +165 -0
- package/dist/components/Signature/index.js +3 -0
- package/dist/components/Signature/signature-points.js +28 -0
- package/dist/components/Skeleton/Skeleton.js +0 -1
- package/dist/components/Skeleton/index.js +0 -1
- package/dist/components/Slider/Slider.js +16 -8
- package/dist/components/Slider/SliderCore.js +75 -12
- package/dist/components/Sources/Sources.js +109 -0
- package/dist/components/Sources/index.js +3 -0
- package/dist/components/Stat/Stat.js +0 -1
- package/dist/components/Stat/index.js +0 -1
- package/dist/components/Switch/Switch.js +6 -5
- package/dist/components/Switch/SwitchCore.js +3 -2
- package/dist/components/Tabs/Tab.js +7 -4
- package/dist/components/Tabs/TabList.js +38 -7
- package/dist/components/Tabs/TabPanel.js +4 -3
- package/dist/components/Tabs/Tabs.js +11 -6
- package/dist/components/TagGroup/SortableTagGroup.js +26 -0
- package/dist/components/TagGroup/TagGroup.js +4 -6
- package/dist/components/TagGroup/TagGroupItem.js +17 -11
- package/dist/components/TagGroup/index.js +2 -1
- package/dist/components/TagGroup/tag-group-styles.js +7 -0
- package/dist/components/TagInput/SortableTagInput.js +24 -0
- package/dist/components/TagInput/SortableTagInputCore.js +52 -0
- package/dist/components/TagInput/TagInput.js +5 -4
- package/dist/components/TagInput/TagInputCore.js +71 -57
- package/dist/components/TagInput/index.js +3 -1
- package/dist/components/TagInput/tag-input-styles.js +7 -0
- package/dist/components/Textarea/Textarea.js +6 -5
- package/dist/components/Textarea/TextareaCore.js +3 -2
- package/dist/components/TimePicker/TimePicker.js +6 -5
- package/dist/components/TimePicker/TimePickerCore.js +3 -2
- package/dist/components/Toast/Toast.js +44 -42
- package/dist/components/Toast/ToastContainer.js +67 -47
- package/dist/components/Toast/ToastContext.js +23 -4
- package/dist/components/Toast/toast2.js +63 -28
- package/dist/components/Toast/useToast.js +9 -7
- package/dist/components/Toggle/Toggle.js +20 -0
- package/dist/components/Toggle/ToggleCore.js +31 -0
- package/dist/components/Toggle/index.js +4 -0
- package/dist/components/Toolbar/Toolbar.js +33 -32
- package/dist/components/Toolbar/ToolbarToggle.js +31 -0
- package/dist/components/Toolbar/index.js +2 -1
- package/dist/components/Tooltip/Tooltip.js +1 -1
- package/dist/components/Tour/Tour.js +57 -53
- package/dist/components/Tree/Tree.js +265 -80
- package/dist/components/Tree/TreeItem.js +91 -55
- package/dist/components/Tree/utils.js +82 -10
- package/dist/components/Typography/Typography.js +0 -1
- package/dist/components/Typography/index.js +0 -1
- package/dist/components/Upload/Upload.js +24 -8
- package/dist/components/Upload/UploadCore.js +230 -37
- package/dist/components/Upload/UploadList.js +300 -0
- package/dist/components/Upload/xhr-upload.js +22 -0
- package/dist/components/VirtualList/VirtualList.js +84 -56
- package/dist/components/Watermark/Watermark.js +55 -0
- package/dist/components/Watermark/index.js +3 -0
- package/dist/css/anchor.css +2 -0
- package/dist/css/app-shell.css +2 -0
- package/dist/css/badge.css +1 -1
- package/dist/css/bottom-sheet.css +1 -1
- package/dist/css/button.css +1 -1
- package/dist/css/calendar.css +1 -1
- package/dist/css/cascader.css +1 -1
- package/dist/css/chart.css +2 -0
- package/dist/css/chat-container.css +1 -1
- package/dist/css/chat-message.css +1 -1
- package/dist/css/combobox.css +3 -2
- package/dist/css/command.css +2 -1
- package/dist/css/context-menu.css +1 -1
- package/dist/css/data-table.css +2 -1
- package/dist/css/date-range-picker.css +1 -1
- package/dist/css/datepicker.css +2 -2
- package/dist/css/descriptions.css +2 -0
- package/dist/css/dialog.css +1 -1
- package/dist/css/drawer.css +1 -1
- package/dist/css/dropdown-menu.css +4 -1
- package/dist/css/file-preview.css +2 -0
- package/dist/css/float-button.css +2 -0
- package/dist/css/image.css +2 -1
- package/dist/css/inline-completion.css +2 -0
- package/dist/css/json-view.css +2 -0
- package/dist/css/masonry.css +2 -0
- package/dist/css/menu.css +4 -1
- package/dist/css/popover.css +1 -1
- package/dist/css/prompt-input.css +2 -0
- package/dist/css/rating.css +1 -1
- package/dist/css/select.css +3 -1
- package/dist/css/signature.css +2 -0
- package/dist/css/slider.css +1 -1
- package/dist/css/sources.css +2 -0
- package/dist/css/tag-group.css +3 -1
- package/dist/css/tag-input.css +2 -1
- package/dist/css/toggle.css +2 -0
- package/dist/css/toolbar.css +1 -0
- package/dist/css/tooltip.css +1 -1
- package/dist/css/tree.css +2 -2
- package/dist/css/upload.css +2 -1
- package/dist/css/watermark.css +2 -0
- package/dist/css-manifest.json +75 -1
- package/dist/form/FormItem.js +55 -50
- package/dist/form/FormList.js +79 -0
- package/dist/form/index.js +5 -1
- package/dist/form/standard-schema.js +16 -0
- package/dist/haze-ui.css +61 -30
- package/dist/headless/index.js +19 -0
- package/dist/hooks/useClickOutside.js +24 -0
- package/dist/hooks/useDarkMode.js +27 -0
- package/dist/hooks/useFullscreen.js +42 -0
- package/dist/hooks/useHotkeys.js +77 -0
- package/dist/hooks/useInView.js +27 -0
- package/dist/hooks/useLocalStorage.js +8 -0
- package/dist/hooks/useMediaQuery.js +2 -1
- package/dist/hooks/usePrevious.js +11 -0
- package/dist/hooks/useSessionStorage.js +8 -0
- package/dist/hooks/useStorageState.js +80 -0
- package/dist/index.js +220 -171
- package/dist/registry.json +2435 -91
- package/dist/tokens/colors.js +0 -1
- package/dist/tokens/index.js +0 -1
- package/dist/tokens/motion.js +0 -1
- package/dist/tokens/oklch.js +0 -1
- package/dist/tokens/palette.js +0 -1
- package/dist/tokens/registry.js +17 -28
- package/dist/tokens/spacing.js +0 -1
- package/dist/tokens/typography.js +0 -1
- package/dist/types/components/Anchor/Anchor.d.ts +25 -0
- package/dist/types/components/Anchor/index.d.ts +2 -0
- package/dist/types/components/AppShell/AppShell.d.ts +17 -0
- package/dist/types/components/AppShell/index.d.ts +2 -0
- package/dist/types/components/Badge/badge-styles.d.ts +21 -0
- package/dist/types/components/Badge/index.d.ts +1 -0
- package/dist/types/components/BottomSheet/BottomSheet.d.ts +52 -3
- package/dist/types/components/BottomSheet/index.d.ts +1 -1
- package/dist/types/components/Button/Button.d.ts +7 -0
- package/dist/types/components/Button/ButtonLink.d.ts +3 -0
- package/dist/types/components/Button/index.d.ts +1 -0
- package/dist/types/components/Button/styles.d.ts +17 -0
- package/dist/types/components/Calendar/Calendar.d.ts +71 -7
- package/dist/types/components/Calendar/date.d.ts +52 -0
- package/dist/types/components/Calendar/index.d.ts +1 -1
- package/dist/types/components/Cascader/Cascader.d.ts +48 -3
- package/dist/types/components/Chart/Chart.d.ts +43 -0
- package/dist/types/components/Chart/chart-elements.d.ts +104 -0
- package/dist/types/components/Chart/index.d.ts +2 -0
- package/dist/types/components/ChatContainer/ChatContainer.d.ts +18 -3
- package/dist/types/components/ChatInput/ChatInput.d.ts +11 -1
- package/dist/types/components/ChatMessage/ChatMessage.d.ts +13 -1
- package/dist/types/components/Checkbox/Checkbox.d.ts +6 -2
- package/dist/types/components/Checkbox/CheckboxCore.d.ts +4 -2
- package/dist/types/components/CodeBlock/CodeBlock.d.ts +19 -2
- package/dist/types/components/CodeBlock/index.d.ts +1 -1
- package/dist/types/components/Collapsible/Collapsible.d.ts +24 -2
- package/dist/types/components/Collapsible/index.d.ts +1 -1
- package/dist/types/components/ColorPicker/ColorPicker.d.ts +7 -1
- package/dist/types/components/ColorPicker/ColorPickerCore.d.ts +7 -1
- package/dist/types/components/Combobox/Combobox.d.ts +111 -7
- package/dist/types/components/Combobox/ComboboxGroup.d.ts +22 -0
- package/dist/types/components/Combobox/ComboboxOption.d.ts +7 -2
- package/dist/types/components/Combobox/index.d.ts +3 -1
- package/dist/types/components/Command/Command.d.ts +70 -6
- package/dist/types/components/Command/CommandDialog.d.ts +36 -0
- package/dist/types/components/Command/command-filter.d.ts +34 -0
- package/dist/types/components/Command/index.d.ts +4 -2
- package/dist/types/components/DataTable/CellEditor.d.ts +24 -0
- package/dist/types/components/DataTable/DataTable.d.ts +184 -32
- package/dist/types/components/DataTable/csv.d.ts +36 -0
- package/dist/types/components/DataTable/features.d.ts +124 -0
- package/dist/types/components/DataTable/index.d.ts +4 -1
- package/dist/types/components/DataTable/summary.d.ts +19 -0
- package/dist/types/components/DateRangePicker/DateRangePicker.d.ts +28 -2
- package/dist/types/components/DateRangePicker/DateRangePickerCore.d.ts +26 -2
- package/dist/types/components/DateRangePicker/index.d.ts +2 -2
- package/dist/types/components/DateRangePicker/presets.d.ts +23 -0
- package/dist/types/components/Datepicker/Datepicker.d.ts +21 -1
- package/dist/types/components/Datepicker/DatepickerCore.d.ts +29 -2
- package/dist/types/components/Datepicker/datetime.d.ts +27 -0
- package/dist/types/components/Datepicker/index.d.ts +1 -1
- package/dist/types/components/Descriptions/Descriptions.d.ts +30 -0
- package/dist/types/components/Descriptions/index.d.ts +2 -0
- package/dist/types/components/Dialog/Dialog.d.ts +68 -3
- package/dist/types/components/Dialog/index.d.ts +1 -1
- package/dist/types/components/Drawer/Drawer.d.ts +33 -3
- package/dist/types/components/Drawer/index.d.ts +1 -1
- package/dist/types/components/DropdownMenu/DropdownMenu.d.ts +23 -3
- package/dist/types/components/DropdownMenu/DropdownMenuSub.d.ts +18 -0
- package/dist/types/components/DropdownMenu/DropdownMenuSubContent.d.ts +13 -0
- package/dist/types/components/DropdownMenu/DropdownMenuSubTrigger.d.ts +14 -0
- package/dist/types/components/DropdownMenu/index.d.ts +7 -1
- package/dist/types/components/FilePreview/FilePreview.d.ts +35 -0
- package/dist/types/components/FilePreview/file-preview-format.d.ts +20 -0
- package/dist/types/components/FilePreview/index.d.ts +2 -0
- package/dist/types/components/FloatButton/FloatButton.d.ts +43 -0
- package/dist/types/components/FloatButton/FloatButtonGroup.d.ts +33 -0
- package/dist/types/components/FloatButton/float-button-context.d.ts +11 -0
- package/dist/types/components/FloatButton/float-button-glyphs.d.ts +3 -0
- package/dist/types/components/FloatButton/float-button-styles.d.ts +58 -0
- package/dist/types/components/FloatButton/index.d.ts +4 -0
- package/dist/types/components/Fullscreen/Fullscreen.d.ts +34 -0
- package/dist/types/components/Fullscreen/index.d.ts +3 -0
- package/dist/types/components/Image/Image.d.ts +20 -5
- package/dist/types/components/Image/ImagePreview.d.ts +13 -0
- package/dist/types/components/Image/index.d.ts +1 -1
- package/dist/types/components/InlineCompletion/InlineCompletion.d.ts +29 -0
- package/dist/types/components/InlineCompletion/index.d.ts +2 -0
- package/dist/types/components/Input/Input.d.ts +5 -2
- package/dist/types/components/Input/InputCore.d.ts +4 -2
- package/dist/types/components/JsonView/JsonView.d.ts +26 -0
- package/dist/types/components/JsonView/index.d.ts +2 -0
- package/dist/types/components/JsonView/json-view-utils.d.ts +22 -0
- package/dist/types/components/LocaleProvider/LocaleContext.d.ts +9 -0
- package/dist/types/components/LocaleProvider/LocaleProvider.d.ts +12 -1
- package/dist/types/components/LocaleProvider/index.d.ts +3 -0
- package/dist/types/components/LocaleProvider/ja-jp.d.ts +13 -0
- package/dist/types/components/LocaleProvider/locale.d.ts +100 -0
- package/dist/types/components/LocaleProvider/strings.d.ts +28 -0
- package/dist/types/components/Masonry/Masonry.d.ts +34 -0
- package/dist/types/components/Masonry/index.d.ts +2 -0
- package/dist/types/components/Masonry/masonry-distribute.d.ts +16 -0
- package/dist/types/components/Mentions/Mentions.d.ts +5 -2
- package/dist/types/components/Mentions/MentionsCore.d.ts +4 -2
- package/dist/types/components/Menu/MenuSub.d.ts +18 -0
- package/dist/types/components/Menu/MenuSubContent.d.ts +12 -0
- package/dist/types/components/Menu/MenuSubTrigger.d.ts +14 -0
- package/dist/types/components/Menu/index.d.ts +6 -0
- package/dist/types/components/NumberInput/NumberInput.d.ts +5 -2
- package/dist/types/components/NumberInput/NumberInputCore.d.ts +4 -2
- package/dist/types/components/OTPInput/OTPInput.d.ts +5 -1
- package/dist/types/components/OTPInput/OTPInputCore.d.ts +4 -1
- package/dist/types/components/PasswordInput/PasswordInput.d.ts +5 -1
- package/dist/types/components/PasswordInput/PasswordInputCore.d.ts +4 -1
- package/dist/types/components/Popover/Popover.d.ts +41 -3
- package/dist/types/components/Popover/index.d.ts +1 -1
- package/dist/types/components/PromptInput/PromptInput.d.ts +46 -0
- package/dist/types/components/PromptInput/index.d.ts +2 -0
- package/dist/types/components/Radio/Radio.d.ts +5 -2
- package/dist/types/components/Radio/RadioGroup.d.ts +8 -2
- package/dist/types/components/Radio/RadioGroupCore.d.ts +7 -2
- package/dist/types/components/Rating/Rating.d.ts +8 -1
- package/dist/types/components/Rating/RatingCore.d.ts +7 -1
- package/dist/types/components/Resizable/index.d.ts +2 -0
- package/dist/types/components/Segmented/Segmented.d.ts +8 -1
- package/dist/types/components/Segmented/SegmentedCore.d.ts +7 -2
- package/dist/types/components/Select/OptionGroup.d.ts +16 -0
- package/dist/types/components/Select/Select.d.ts +78 -4
- package/dist/types/components/Select/SelectCore.d.ts +79 -6
- package/dist/types/components/Select/SelectFloating.d.ts +94 -0
- package/dist/types/components/Select/index.d.ts +2 -0
- package/dist/types/components/Select/select-options.d.ts +53 -0
- package/dist/types/components/Signature/Signature.d.ts +51 -0
- package/dist/types/components/Signature/index.d.ts +2 -0
- package/dist/types/components/Signature/signature-points.d.ts +31 -0
- package/dist/types/components/Slider/Slider.d.ts +29 -4
- package/dist/types/components/Slider/SliderCore.d.ts +35 -6
- package/dist/types/components/Sources/Sources.d.ts +37 -0
- package/dist/types/components/Sources/index.d.ts +2 -0
- package/dist/types/components/Switch/Switch.d.ts +5 -2
- package/dist/types/components/Switch/SwitchCore.d.ts +4 -2
- package/dist/types/components/Tabs/TabList.d.ts +7 -0
- package/dist/types/components/Tabs/Tabs.d.ts +8 -1
- package/dist/types/components/Tabs/TabsContext.d.ts +20 -0
- package/dist/types/components/Tabs/index.d.ts +1 -0
- package/dist/types/components/TagGroup/SortableTagGroup.d.ts +20 -0
- package/dist/types/components/TagGroup/TagGroup.d.ts +3 -0
- package/dist/types/components/TagGroup/index.d.ts +2 -0
- package/dist/types/components/TagGroup/tag-group-styles.d.ts +7 -0
- package/dist/types/components/TagInput/SortableTagInput.d.ts +34 -0
- package/dist/types/components/TagInput/SortableTagInputCore.d.ts +18 -0
- package/dist/types/components/TagInput/TagInput.d.ts +5 -1
- package/dist/types/components/TagInput/TagInputCore.d.ts +6 -2
- package/dist/types/components/TagInput/index.d.ts +4 -0
- package/dist/types/components/TagInput/tag-input-styles.d.ts +12 -0
- package/dist/types/components/Textarea/Textarea.d.ts +5 -2
- package/dist/types/components/Textarea/TextareaCore.d.ts +4 -2
- package/dist/types/components/TimePicker/TimePicker.d.ts +5 -2
- package/dist/types/components/TimePicker/TimePickerCore.d.ts +4 -2
- package/dist/types/components/Toast/Toast.d.ts +31 -2
- package/dist/types/components/Toast/ToastContainer.d.ts +11 -1
- package/dist/types/components/Toast/ToastContext.d.ts +44 -3
- package/dist/types/components/Toast/index.d.ts +1 -1
- package/dist/types/components/Toast/toast.d.ts +35 -4
- package/dist/types/components/Toast/useToast.d.ts +16 -4
- package/dist/types/components/Toggle/Toggle.d.ts +19 -0
- package/dist/types/components/Toggle/ToggleCore.d.ts +23 -0
- package/dist/types/components/Toggle/index.d.ts +4 -0
- package/dist/types/components/Toolbar/ToolbarToggle.d.ts +19 -0
- package/dist/types/components/Toolbar/index.d.ts +2 -0
- package/dist/types/components/Tour/Tour.d.ts +3 -3
- package/dist/types/components/Tree/Tree.d.ts +3 -3
- package/dist/types/components/Tree/TreeItem.d.ts +16 -1
- package/dist/types/components/Tree/types.d.ts +51 -0
- package/dist/types/components/Tree/utils.d.ts +73 -0
- package/dist/types/components/Upload/Upload.d.ts +47 -3
- package/dist/types/components/Upload/UploadCore.d.ts +95 -4
- package/dist/types/components/Upload/UploadList.d.ts +18 -0
- package/dist/types/components/Upload/index.d.ts +1 -0
- package/dist/types/components/Upload/types.d.ts +60 -0
- package/dist/types/components/Upload/xhr-upload.d.ts +20 -0
- package/dist/types/components/VirtualList/VirtualList.d.ts +16 -1
- package/dist/types/components/Watermark/Watermark.d.ts +32 -0
- package/dist/types/components/Watermark/index.d.ts +2 -0
- package/dist/types/form/FormItem.d.ts +33 -8
- package/dist/types/form/FormList.d.ts +113 -0
- package/dist/types/form/index.d.ts +26 -0
- package/dist/types/form/standard-schema.d.ts +30 -0
- package/dist/types/headless/index.d.ts +399 -0
- package/dist/types/hooks/index.d.ts +13 -0
- package/dist/types/hooks/useClickOutside.d.ts +46 -0
- package/dist/types/hooks/useDarkMode.d.ts +40 -0
- package/dist/types/hooks/useFullscreen.d.ts +33 -0
- package/dist/types/hooks/useHotkeys.d.ts +53 -0
- package/dist/types/hooks/useInView.d.ts +32 -0
- package/dist/types/hooks/useLocalStorage.d.ts +33 -0
- package/dist/types/hooks/useMediaQuery.d.ts +3 -0
- package/dist/types/hooks/usePrevious.d.ts +18 -0
- package/dist/types/hooks/useSessionStorage.d.ts +26 -0
- package/dist/types/hooks/useStorageState.d.ts +12 -0
- package/dist/types/index.d.ts +79 -37
- package/dist/types/utils/collision.d.ts +39 -1
- package/dist/types/utils/direction.d.ts +22 -0
- package/dist/types/utils/floating.d.ts +32 -4
- package/dist/types/utils/focus-scope.d.ts +2 -1
- package/dist/types/utils/focus.d.ts +2 -1
- package/dist/types/utils/menuKeyboard.d.ts +19 -4
- package/dist/types/utils/refs.d.ts +16 -0
- package/dist/types/utils/sortable-handle.d.ts +25 -0
- package/dist/types/utils/sortable-shared.d.ts +30 -0
- package/dist/types/utils/sortable.d.ts +36 -0
- package/dist/types/utils/submenu.d.ts +63 -0
- package/dist/types/utils/view-transition.d.ts +28 -0
- package/dist/utils/classnames.js +0 -1
- package/dist/utils/collision.js +37 -26
- package/dist/utils/direction.js +34 -0
- package/dist/utils/floating.js +163 -143
- package/dist/utils/menuKeyboard.js +59 -46
- package/dist/utils/refs.js +9 -0
- package/dist/utils/sortable-handle.js +12 -0
- package/dist/utils/sortable-shared.js +16 -0
- package/dist/utils/sortable.js +47 -0
- package/dist/utils/submenu.js +106 -0
- package/dist/utils/view-transition.js +26 -0
- package/package.json +169 -16
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComponentPropsWithoutRef } from 'react';
|
|
1
|
+
import type { ComponentPropsWithoutRef, Ref } from 'react';
|
|
2
2
|
type NumberInputCoreProps = {
|
|
3
3
|
value: number;
|
|
4
4
|
onChange: (value: number) => void;
|
|
@@ -10,6 +10,8 @@ type NumberInputCoreProps = {
|
|
|
10
10
|
step?: number;
|
|
11
11
|
size?: 'sm' | 'md' | 'lg';
|
|
12
12
|
className?: string;
|
|
13
|
+
/** Forwarded to the inner number `<input>` (not the wrapper div). */
|
|
14
|
+
ref?: Ref<HTMLInputElement>;
|
|
13
15
|
} & Omit<ComponentPropsWithoutRef<'input'>, 'type' | 'value' | 'onChange' | 'size'>;
|
|
14
|
-
export default function NumberInputCore({ value, onChange, onNativeChange, min, max, step, size, className, ...rest }: NumberInputCoreProps): import("react").JSX.Element;
|
|
16
|
+
export default function NumberInputCore({ value, onChange, onNativeChange, min, max, step, size, className, ref, ...rest }: NumberInputCoreProps): import("react").JSX.Element;
|
|
15
17
|
export type { NumberInputCoreProps };
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import type { Ref } from 'react';
|
|
1
2
|
import type { ControlOrValue } from 'react-use-control';
|
|
2
3
|
type OTPInputProps = {
|
|
3
4
|
length?: number;
|
|
4
5
|
value?: ControlOrValue<string>;
|
|
5
6
|
onChange?: (value: string) => void;
|
|
6
7
|
className?: string;
|
|
8
|
+
/** Forwarded to the first cell's `<input>` — the element form bridges
|
|
9
|
+
* and `ref.current.focus()` reach. */
|
|
10
|
+
ref?: Ref<HTMLInputElement>;
|
|
7
11
|
};
|
|
8
|
-
export default function OTPInput({ length, value: valueControl, onChange, className, }: OTPInputProps): import("react").JSX.Element;
|
|
12
|
+
export default function OTPInput({ length, value: valueControl, onChange, className, ref, }: OTPInputProps): import("react").JSX.Element;
|
|
9
13
|
export type { OTPInputProps };
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import type { Ref } from 'react';
|
|
1
2
|
type OTPInputCoreProps = {
|
|
2
3
|
length?: number;
|
|
3
4
|
value: string;
|
|
4
5
|
onChange: (value: string) => void;
|
|
5
6
|
className?: string;
|
|
7
|
+
/** Forwarded to the first cell's `<input>`. */
|
|
8
|
+
ref?: Ref<HTMLInputElement>;
|
|
6
9
|
};
|
|
7
|
-
export default function OTPInputCore({ length, value, onChange, className, }: OTPInputCoreProps): import("react").JSX.Element;
|
|
10
|
+
export default function OTPInputCore({ length, value, onChange, className, ref, }: OTPInputCoreProps): import("react").JSX.Element;
|
|
8
11
|
export type { OTPInputCoreProps };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Ref } from 'react';
|
|
1
2
|
import type { ControlOrValue } from 'react-use-control';
|
|
2
3
|
type PasswordInputProps = {
|
|
3
4
|
value?: ControlOrValue<string>;
|
|
@@ -5,6 +6,9 @@ type PasswordInputProps = {
|
|
|
5
6
|
placeholder?: string;
|
|
6
7
|
disabled?: boolean;
|
|
7
8
|
className?: string;
|
|
9
|
+
/** Forwarded to the inner password `<input>` (not the wrapper div) —
|
|
10
|
+
* the element form bridges and `ref.current.focus()` reach. */
|
|
11
|
+
ref?: Ref<HTMLInputElement>;
|
|
8
12
|
};
|
|
9
|
-
export default function PasswordInput({ value: valueControl, onChange, placeholder, disabled, className, }: PasswordInputProps): import("react").JSX.Element;
|
|
13
|
+
export default function PasswordInput({ value: valueControl, onChange, placeholder, disabled, className, ref, }: PasswordInputProps): import("react").JSX.Element;
|
|
10
14
|
export type { PasswordInputProps };
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import type { Ref } from 'react';
|
|
1
2
|
type PasswordInputCoreProps = {
|
|
2
3
|
value: string;
|
|
3
4
|
onChange: (value: string) => void;
|
|
4
5
|
placeholder?: string;
|
|
5
6
|
disabled?: boolean;
|
|
6
7
|
className?: string;
|
|
8
|
+
/** Forwarded to the inner password `<input>` (not the wrapper div). */
|
|
9
|
+
ref?: Ref<HTMLInputElement>;
|
|
7
10
|
};
|
|
8
|
-
export default function PasswordInputCore({ value, onChange, placeholder, disabled, className, }: PasswordInputCoreProps): import("react").JSX.Element;
|
|
11
|
+
export default function PasswordInputCore({ value, onChange, placeholder, disabled, className, ref, }: PasswordInputCoreProps): import("react").JSX.Element;
|
|
9
12
|
export type { PasswordInputCoreProps };
|
|
@@ -1,6 +1,36 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
1
|
+
import type { ReactNode, Ref } from 'react';
|
|
2
2
|
import type { ControlOrValue } from 'react-use-control';
|
|
3
3
|
import type { CollisionPadding } from '../../utils/collision';
|
|
4
|
+
/**
|
|
5
|
+
* Imperative handle exposed through the React 19 `ref` prop (same API
|
|
6
|
+
* choice as VirtualList). `open`/`close` are state writes going through
|
|
7
|
+
* the same `useFloating` path as the trigger's own clicks — the popover
|
|
8
|
+
* visibility, animated exit and the toggle-echo reconciliation in the
|
|
9
|
+
* floating engine stay in charge; the handle never calls
|
|
10
|
+
* `showPopover`/`hidePopover` directly.
|
|
11
|
+
*/
|
|
12
|
+
type PopoverHandle = {
|
|
13
|
+
/** Show the popover, as if the trigger toggled it open. */
|
|
14
|
+
open: () => void;
|
|
15
|
+
/** Close the popover through the animated exit path. */
|
|
16
|
+
close: () => void;
|
|
17
|
+
/** Focus the trigger element. */
|
|
18
|
+
focusTrigger: () => void;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Semantic slot classes (AntD v6 `classNames` shape): consumer classes
|
|
22
|
+
* appended at the end of each part's class list (able to override
|
|
23
|
+
* component defaults). Popover has exactly two structural parts:
|
|
24
|
+
*
|
|
25
|
+
* - `trigger` — the clickable wrapper around `children`
|
|
26
|
+
* - `content` — the floating panel
|
|
27
|
+
*/
|
|
28
|
+
type PopoverClassNames = {
|
|
29
|
+
/** The trigger wrapper (the `role="button"` span around `children`). */
|
|
30
|
+
trigger?: string;
|
|
31
|
+
/** The floating panel. */
|
|
32
|
+
content?: string;
|
|
33
|
+
};
|
|
4
34
|
type PopoverProps = {
|
|
5
35
|
content: ReactNode;
|
|
6
36
|
open?: ControlOrValue<boolean>;
|
|
@@ -9,8 +39,16 @@ type PopoverProps = {
|
|
|
9
39
|
* to all four edges, an object per edge.
|
|
10
40
|
*/
|
|
11
41
|
collisionPadding?: CollisionPadding;
|
|
42
|
+
/**
|
|
43
|
+
* Semantic slot classes (AntD v6 `classNames` shape) — see
|
|
44
|
+
* {@link PopoverClassNames}. `classNames.content` lands after the
|
|
45
|
+
* panel's `className` prop; `classNames.trigger` has no default class
|
|
46
|
+
* to fight with. Omitting it changes nothing.
|
|
47
|
+
*/
|
|
48
|
+
classNames?: PopoverClassNames;
|
|
12
49
|
className?: string;
|
|
13
50
|
children: ReactNode;
|
|
51
|
+
ref?: Ref<PopoverHandle>;
|
|
14
52
|
};
|
|
15
|
-
export default function Popover({ content, open: openControl, collisionPadding, className, children, }: PopoverProps): import("react").JSX.Element;
|
|
16
|
-
export type { PopoverProps };
|
|
53
|
+
export default function Popover({ content, open: openControl, collisionPadding, classNames, className, children, ref, }: PopoverProps): import("react").JSX.Element;
|
|
54
|
+
export type { PopoverProps, PopoverHandle, PopoverClassNames };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as Popover } from './Popover';
|
|
2
|
-
export type { PopoverProps } from './Popover';
|
|
2
|
+
export type { PopoverProps, PopoverHandle, PopoverClassNames } from './Popover';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import type { ControlOrValue } from 'react-use-control';
|
|
3
|
+
type PromptInputProps = {
|
|
4
|
+
/** Free-form draft text. */
|
|
5
|
+
value?: ControlOrValue<string>;
|
|
6
|
+
/** Value callback fired on every text edit (same value the control gets). */
|
|
7
|
+
onChange?: (value: string) => void;
|
|
8
|
+
/**
|
|
9
|
+
* Inline removable tags rendered before the text (context attachments
|
|
10
|
+
* for the prompt). They are never consumed by submit — removal is the
|
|
11
|
+
* only mutation the component performs.
|
|
12
|
+
*/
|
|
13
|
+
tags?: ControlOrValue<string[]>;
|
|
14
|
+
/** Value callback fired when a tag is removed. */
|
|
15
|
+
onTagsChange?: (tags: string[]) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Trigger characters that open the suggestion listbox while typing.
|
|
18
|
+
* Defaults to `['@']`. Inert without `getSuggestions`.
|
|
19
|
+
*/
|
|
20
|
+
triggers?: string[];
|
|
21
|
+
/**
|
|
22
|
+
* Suggestions for the token at the caret: called with the trigger
|
|
23
|
+
* character and the text typed after it. Async responses are applied
|
|
24
|
+
* in request order — a stale response is discarded once a newer
|
|
25
|
+
* request has been issued.
|
|
26
|
+
*/
|
|
27
|
+
getSuggestions?: (trigger: string, query: string) => string[] | Promise<string[]>;
|
|
28
|
+
/**
|
|
29
|
+
* Fired when the submit key is pressed with non-empty text; the draft
|
|
30
|
+
* clears afterwards (tags stay). Enter still commits a highlighted
|
|
31
|
+
* suggestion first while the listbox is open.
|
|
32
|
+
*/
|
|
33
|
+
onSubmit?: () => void;
|
|
34
|
+
/**
|
|
35
|
+
* `'enter'` (default): Enter submits, Shift+Enter inserts a newline.
|
|
36
|
+
* `'mod-enter'`: only Ctrl/Cmd+Enter submits, plain Enter newlines.
|
|
37
|
+
*/
|
|
38
|
+
submitKey?: 'enter' | 'mod-enter';
|
|
39
|
+
placeholder?: string;
|
|
40
|
+
disabled?: boolean;
|
|
41
|
+
/** Auto-grow cap in text rows; beyond it the textarea scrolls. */
|
|
42
|
+
maxRows?: number;
|
|
43
|
+
className?: string;
|
|
44
|
+
} & Omit<ComponentPropsWithoutRef<'textarea'>, 'value' | 'onChange' | 'placeholder' | 'className' | 'style' | 'rows'>;
|
|
45
|
+
export default function PromptInput({ value: valueControl, onChange, tags: tagsControl, onTagsChange, triggers, getSuggestions, onSubmit, submitKey, placeholder, disabled, maxRows, className, 'aria-label': ariaLabel, ...rest }: PromptInputProps): import("react").JSX.Element;
|
|
46
|
+
export type { PromptInputProps };
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import type { ComponentPropsWithoutRef } from 'react';
|
|
1
|
+
import type { ComponentPropsWithoutRef, Ref } from 'react';
|
|
2
2
|
type RadioProps = {
|
|
3
3
|
value: string;
|
|
4
|
+
/** Forwarded to the radio `<input>` (not the label wrapper) — form
|
|
5
|
+
* bridges and `ref.current.focus()` reach. */
|
|
6
|
+
ref?: Ref<HTMLInputElement>;
|
|
4
7
|
} & Omit<ComponentPropsWithoutRef<'input'>, 'type' | 'value' | 'name' | 'checked' | 'onChange'>;
|
|
5
|
-
export default function Radio({ value, className, children, ...rest }: RadioProps & {
|
|
8
|
+
export default function Radio({ value, className, children, ref, ...rest }: RadioProps & {
|
|
6
9
|
children?: React.ReactNode;
|
|
7
10
|
}): import("react").JSX.Element;
|
|
8
11
|
export type { RadioProps };
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
1
|
+
import type { ReactNode, Ref } from 'react';
|
|
2
2
|
import type { ControlOrValue } from 'react-use-control';
|
|
3
3
|
type RadioGroupProps = {
|
|
4
4
|
value?: ControlOrValue<string>;
|
|
5
5
|
name?: string;
|
|
6
6
|
className?: string;
|
|
7
7
|
children: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Forwarded to the group's focus target — the checked radio `<input>`
|
|
10
|
+
* (falling back to the first), matching where a browser Tab lands —
|
|
11
|
+
* so form bridges and `ref.current.focus()` reach the group.
|
|
12
|
+
*/
|
|
13
|
+
ref?: Ref<HTMLInputElement>;
|
|
8
14
|
};
|
|
9
|
-
export default function RadioGroup({ value: valueControl, name, className, children, }: RadioGroupProps): import("react").JSX.Element;
|
|
15
|
+
export default function RadioGroup({ value: valueControl, name, className, children, ref, }: RadioGroupProps): import("react").JSX.Element;
|
|
10
16
|
export type { RadioGroupProps };
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
1
|
+
import type { ReactNode, Ref } from 'react';
|
|
2
2
|
type RadioGroupCoreProps = {
|
|
3
3
|
value: string;
|
|
4
4
|
onChange: (value: string) => void;
|
|
5
5
|
name?: string;
|
|
6
6
|
className?: string;
|
|
7
7
|
children: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Forwarded to the group's focus target — the checked radio `<input>`
|
|
10
|
+
* (falling back to the first), matching where a browser Tab lands.
|
|
11
|
+
*/
|
|
12
|
+
ref?: Ref<HTMLInputElement>;
|
|
8
13
|
};
|
|
9
|
-
export default function RadioGroupCore({ value, onChange, name, className, children, }: RadioGroupCoreProps): import("react").JSX.Element;
|
|
14
|
+
export default function RadioGroupCore({ value, onChange, name, className, children, ref, }: RadioGroupCoreProps): import("react").JSX.Element;
|
|
10
15
|
export type { RadioGroupCoreProps };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Ref } from 'react';
|
|
1
2
|
import type { ControlOrValue } from 'react-use-control';
|
|
2
3
|
type RatingProps = {
|
|
3
4
|
value?: ControlOrValue<number>;
|
|
@@ -5,6 +6,12 @@ type RatingProps = {
|
|
|
5
6
|
allowHalf?: boolean;
|
|
6
7
|
onChange?: (value: number) => void;
|
|
7
8
|
className?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Forwarded to the group's focus target — the star that is the roving
|
|
11
|
+
* tab stop (the current rating, or the first star) — so form bridges
|
|
12
|
+
* and `ref.current.focus()` reach the group.
|
|
13
|
+
*/
|
|
14
|
+
ref?: Ref<HTMLSpanElement>;
|
|
8
15
|
};
|
|
9
|
-
export default function Rating({ value: valueControl, count, allowHalf, onChange, className, }: RatingProps): import("react").JSX.Element;
|
|
16
|
+
export default function Rating({ value: valueControl, count, allowHalf, onChange, className, ref, }: RatingProps): import("react").JSX.Element;
|
|
10
17
|
export type { RatingProps };
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
import type { Ref } from 'react';
|
|
1
2
|
type RatingCoreProps = {
|
|
2
3
|
value: number;
|
|
3
4
|
onChange: (value: number) => void;
|
|
4
5
|
count?: number;
|
|
5
6
|
allowHalf?: boolean;
|
|
6
7
|
className?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Forwarded to the group's focus target — the star that is the roving
|
|
10
|
+
* tab stop (the current rating, or the first star).
|
|
11
|
+
*/
|
|
12
|
+
ref?: Ref<HTMLSpanElement>;
|
|
7
13
|
};
|
|
8
|
-
export default function RatingCore({ value, onChange, count, allowHalf, className, }: RatingCoreProps): import("react").JSX.Element;
|
|
14
|
+
export default function RatingCore({ value, onChange, count, allowHalf, className, ref, }: RatingCoreProps): import("react").JSX.Element;
|
|
9
15
|
export type { RatingCoreProps };
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export { ResizableGroup, ResizablePanel, ResizableHandle } from './Resizable';
|
|
2
2
|
export type { ResizableGroupProps, ResizablePanelProps, ResizableHandleProps } from './Resizable';
|
|
3
|
+
export { ResizableGroup as SplitterGroup, ResizablePanel as SplitterPanel, ResizableHandle as SplitterHandle, } from './Resizable';
|
|
4
|
+
export type { ResizableGroupProps as SplitterGroupProps, ResizablePanelProps as SplitterPanelProps, ResizableHandleProps as SplitterHandleProps, } from './Resizable';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Ref } from 'react';
|
|
1
2
|
import type { ControlOrValue } from 'react-use-control';
|
|
2
3
|
import type { SegmentedOption } from './SegmentedCore';
|
|
3
4
|
type SegmentedProps = {
|
|
@@ -6,6 +7,12 @@ type SegmentedProps = {
|
|
|
6
7
|
onChange?: (value: string) => void;
|
|
7
8
|
size?: 'sm' | 'md' | 'lg';
|
|
8
9
|
className?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Forwarded to the group's focus target — the selected option's
|
|
12
|
+
* `<button>` (falling back to the first) — so form bridges and
|
|
13
|
+
* `ref.current.focus()` reach the group.
|
|
14
|
+
*/
|
|
15
|
+
ref?: Ref<HTMLButtonElement>;
|
|
9
16
|
};
|
|
10
|
-
export default function Segmented({ options, value: valueControl, onChange, size, className, }: SegmentedProps): import("react").JSX.Element;
|
|
17
|
+
export default function Segmented({ options, value: valueControl, onChange, size, className, ref, }: SegmentedProps): import("react").JSX.Element;
|
|
11
18
|
export type { SegmentedProps, SegmentedOption };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
1
|
+
import type { ReactNode, Ref } from 'react';
|
|
2
2
|
type SegmentedOption = string | {
|
|
3
3
|
value: string;
|
|
4
4
|
label: ReactNode;
|
|
@@ -10,6 +10,11 @@ type SegmentedCoreProps = {
|
|
|
10
10
|
onChange: (value: string) => void;
|
|
11
11
|
size?: 'sm' | 'md' | 'lg';
|
|
12
12
|
className?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Forwarded to the group's focus target — the selected option's
|
|
15
|
+
* `<button>` (falling back to the first).
|
|
16
|
+
*/
|
|
17
|
+
ref?: Ref<HTMLButtonElement>;
|
|
13
18
|
};
|
|
14
|
-
export default function SegmentedCore({ options, value, onChange, size, className, }: SegmentedCoreProps): import("react").JSX.Element;
|
|
19
|
+
export default function SegmentedCore({ options, value, onChange, size, className, ref, }: SegmentedCoreProps): import("react").JSX.Element;
|
|
15
20
|
export type { SegmentedCoreProps, SegmentedOption };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
|
+
type OptionGroupProps = {
|
|
3
|
+
/** Group heading. Renders as the native `<optgroup label>` in the
|
|
4
|
+
* single-select path and as a `role="group"` heading in the
|
|
5
|
+
* multiple/searchable listbox path. */
|
|
6
|
+
label: string;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
} & Omit<ComponentPropsWithoutRef<'optgroup'>, 'label'>;
|
|
9
|
+
/**
|
|
10
|
+
* Labels a cluster of options inside a Select. In single mode it is a
|
|
11
|
+
* plain native `<optgroup>`; the multiple/searchable floating listbox
|
|
12
|
+
* extracts the same structure and renders it as `role="group"` with a
|
|
13
|
+
* heading, keyboard navigation running continuously across groups.
|
|
14
|
+
*/
|
|
15
|
+
export default function OptionGroup({ label, children, ...rest }: OptionGroupProps): import("react").JSX.Element;
|
|
16
|
+
export type { OptionGroupProps };
|
|
@@ -1,9 +1,83 @@
|
|
|
1
|
-
import type { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
1
|
+
import type { ComponentPropsWithoutRef, ReactNode, Ref } from 'react';
|
|
2
2
|
import type { ControlOrValue } from 'react-use-control';
|
|
3
|
+
import type { SelectVirtualizedConfig } from './SelectFloating';
|
|
3
4
|
type SelectProps = {
|
|
4
|
-
|
|
5
|
+
/** `string` in single mode, `string[]` when `multiple` is set. */
|
|
6
|
+
value?: ControlOrValue<string | string[]>;
|
|
7
|
+
/**
|
|
8
|
+
* Multiple selection mode (see SelectCoreProps.multiple). The
|
|
9
|
+
* uncontrolled empty value is `[]` in this mode, `''` otherwise.
|
|
10
|
+
*/
|
|
11
|
+
multiple?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Searchable single select (see SelectCoreProps.searchable): swaps
|
|
14
|
+
* the native `<select>` for the floating listbox with a panel-top
|
|
15
|
+
* search input — typing filters, ↑/↓ highlight, Enter picks, Escape
|
|
16
|
+
* closes. In multiple mode the same search input appears in the
|
|
17
|
+
* listbox panel instead.
|
|
18
|
+
*/
|
|
19
|
+
searchable?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Clear affordance (see SelectCoreProps.clearable): a pointer-only ×
|
|
22
|
+
* revealed on hover/focus-within empties the value (`[]` / `''`)
|
|
23
|
+
* without toggling the panel; Backspace is the keyboard parity path.
|
|
24
|
+
*/
|
|
25
|
+
clearable?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Async option state (see SelectCoreProps.loading): the floating
|
|
28
|
+
* panel's options area shows a Spinner with `aria-busy="true"` and
|
|
29
|
+
* suspends search filtering until it clears.
|
|
30
|
+
*/
|
|
31
|
+
loading?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Remote search (see SelectCoreProps.onSearch): with `onSearch` set,
|
|
34
|
+
* the floating panel stops filtering locally — options are entirely
|
|
35
|
+
* what the consumer passes as children — and every query transition
|
|
36
|
+
* of the panel's search input fires this callback (empty queries
|
|
37
|
+
* included, so the consumer can restore the full list; the reset on
|
|
38
|
+
* panel close reports `''` too). Pair with `loading` for the pending
|
|
39
|
+
* state; debouncing is the consumer's concern. Requires `searchable`
|
|
40
|
+
* (the only paths with a search input); the plain native single
|
|
41
|
+
* select has no query source and ignores it.
|
|
42
|
+
*/
|
|
43
|
+
onSearch?: (query: string) => void;
|
|
44
|
+
/**
|
|
45
|
+
* Multiple mode only (see SelectCoreProps.maxTagCount): cap the
|
|
46
|
+
* rendered Chips; the overflow collapses into a `+N` badge whose
|
|
47
|
+
* `title` lists the hidden labels.
|
|
48
|
+
*/
|
|
49
|
+
maxTagCount?: number;
|
|
50
|
+
/**
|
|
51
|
+
* Render the floating option list through VirtualList so long option
|
|
52
|
+
* lists mount only the visible window (plus overscan). Default
|
|
53
|
+
* (omitted/`false`) keeps the plain DOM path; single mode without
|
|
54
|
+
* `searchable` ignores it — the native `<select>` handles long lists
|
|
55
|
+
* natively.
|
|
56
|
+
*/
|
|
57
|
+
virtualized?: boolean | SelectVirtualizedConfig;
|
|
58
|
+
/**
|
|
59
|
+
* Value callback for both modes: `string` in single mode, `string[]`
|
|
60
|
+
* when `multiple` is set — fired after the value updates. The native
|
|
61
|
+
* select `change` event stays available through `onChange` in single
|
|
62
|
+
* mode (the historical contract); the floating paths have no native
|
|
63
|
+
* event.
|
|
64
|
+
*/
|
|
65
|
+
onValuesChange?: (value: string | string[]) => void;
|
|
66
|
+
/**
|
|
67
|
+
* Placeholder text for the floating triggers (falls back to the
|
|
68
|
+
* `select.placeholder` locale string). A native `<select>` has no
|
|
69
|
+
* placeholder attribute, so plain single mode consumes and drops it.
|
|
70
|
+
*/
|
|
71
|
+
placeholder?: string;
|
|
5
72
|
size?: 'sm' | 'md' | 'lg';
|
|
73
|
+
/**
|
|
74
|
+
* Forwarded to the focusable element — the native `<select>` in plain
|
|
75
|
+
* and clearable single mode, the trigger `<button>` when `multiple`
|
|
76
|
+
* or `searchable` render the floating engine. Form bridges and
|
|
77
|
+
* `ref.current.focus()` reach whichever mode renders.
|
|
78
|
+
*/
|
|
79
|
+
ref?: Ref<HTMLSelectElement | HTMLButtonElement>;
|
|
6
80
|
children: ReactNode;
|
|
7
|
-
} & Omit<ComponentPropsWithoutRef<'select'>, 'value' | 'size'>;
|
|
8
|
-
export default function Select({ value: valueControl, size, className, children, onChange, ...rest }: SelectProps): import("react").JSX.Element;
|
|
81
|
+
} & Omit<ComponentPropsWithoutRef<'select'>, 'value' | 'size' | 'multiple'>;
|
|
82
|
+
export default function Select({ value: valueControl, multiple, searchable, clearable, loading, onSearch, maxTagCount, virtualized, size, className, children, onChange, onValuesChange, placeholder, ref, ...rest }: SelectProps): import("react").JSX.Element;
|
|
9
83
|
export type { SelectProps };
|
|
@@ -1,13 +1,86 @@
|
|
|
1
|
-
import type { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
1
|
+
import type { ComponentPropsWithoutRef, ReactNode, Ref } from 'react';
|
|
2
|
+
import type { SelectVirtualizedConfig } from './SelectFloating';
|
|
2
3
|
type SelectCoreProps = {
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
/** `string` in single mode, `string[]` when `multiple` is set. */
|
|
5
|
+
value: string | string[];
|
|
6
|
+
/** Notifies the next value: `string` in single mode, `string[]` when
|
|
7
|
+
* `multiple` is set. */
|
|
8
|
+
onChange: (value: string | string[]) => void;
|
|
5
9
|
/** Native change event passthrough — invoked with the DOM event after
|
|
6
|
-
* `onChange`, so a spread can never override the controlled callback.
|
|
10
|
+
* `onChange`, so a spread can never override the controlled callback.
|
|
11
|
+
* Single mode only; the floating paths have no native select element. */
|
|
7
12
|
onNativeChange?: ComponentPropsWithoutRef<'select'>['onChange'];
|
|
13
|
+
/**
|
|
14
|
+
* Placeholder for the floating triggers (falls back to the
|
|
15
|
+
* `select.placeholder` locale string). A native `<select>` has no
|
|
16
|
+
* placeholder attribute, so the plain single mode consumes and drops
|
|
17
|
+
* it — single mode with `searchable` renders it like the multiple
|
|
18
|
+
* trigger does.
|
|
19
|
+
*/
|
|
20
|
+
placeholder?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Multiple selection mode: the native `<select>` is replaced by a
|
|
23
|
+
* button trigger rendering the selected values as removable Chips,
|
|
24
|
+
* opening a floating multi-select listbox. Default (`false`) keeps
|
|
25
|
+
* the native single-select path untouched.
|
|
26
|
+
*/
|
|
27
|
+
multiple?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Swap the single-mode native `<select>` for the floating listbox
|
|
30
|
+
* engine (the one `multiple` uses) with a search input at the top of
|
|
31
|
+
* the panel: typing filters the options, ↑/↓ move the highlight,
|
|
32
|
+
* Enter picks and closes, Escape closes. `multiple` ignores it — the
|
|
33
|
+
* multiple listbox gains the same search input instead. Default
|
|
34
|
+
* (`false`) keeps the native `<select>` untouched.
|
|
35
|
+
*/
|
|
36
|
+
searchable?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Show a pointer-only × clear affordance at the trigger's inline end
|
|
39
|
+
* while a value is selected (revealed on hover/focus-within; keyboard
|
|
40
|
+
* parity through Backspace on the trigger). Clicking it empties the
|
|
41
|
+
* value (`[]` / `''`) without toggling the panel. Works in every
|
|
42
|
+
* mode — on the plain single-select path the × overlays the select's
|
|
43
|
+
* caret slot instead of the floating trigger.
|
|
44
|
+
*/
|
|
45
|
+
clearable?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Async option state for the floating paths: the options area shows a
|
|
48
|
+
* Spinner with `aria-busy="true"` on the panel, and search filtering
|
|
49
|
+
* is suspended until loading finishes. The plain single-mode native
|
|
50
|
+
* `<select>` ignores it (a native select cannot render async state).
|
|
51
|
+
*/
|
|
52
|
+
loading?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Remote search for the floating paths (see SelectFloatingProps.onSearch):
|
|
55
|
+
* while set, local query filtering is suspended — options are entirely
|
|
56
|
+
* whatever arrives through `children` — and every query transition of
|
|
57
|
+
* the panel's search input is reported here, empty queries included
|
|
58
|
+
* (the consumer restores the full list). The plain single-mode native
|
|
59
|
+
* `<select>` path has no query source and ignores it.
|
|
60
|
+
*/
|
|
61
|
+
onSearch?: (query: string) => void;
|
|
62
|
+
/**
|
|
63
|
+
* Multiple mode only: render at most this many value Chips in the
|
|
64
|
+
* trigger; the rest collapse into a `+N` badge whose `title` tooltip
|
|
65
|
+
* lists the overflow labels. Selection semantics are unchanged.
|
|
66
|
+
*/
|
|
67
|
+
maxTagCount?: number;
|
|
8
68
|
size?: 'sm' | 'md' | 'lg';
|
|
69
|
+
/**
|
|
70
|
+
* Render the floating option list through VirtualList so long option
|
|
71
|
+
* lists mount only the visible window (plus overscan). Default
|
|
72
|
+
* (omitted/`false`) keeps the plain DOM path; the plain single-mode
|
|
73
|
+
* native `<select>` ignores it — it handles long lists natively.
|
|
74
|
+
*/
|
|
75
|
+
virtualized?: boolean | SelectVirtualizedConfig;
|
|
9
76
|
children: ReactNode;
|
|
10
77
|
className?: string;
|
|
11
|
-
|
|
12
|
-
|
|
78
|
+
/**
|
|
79
|
+
* Forwarded to the focusable element — the native `<select>` in plain
|
|
80
|
+
* and clearable single mode, the trigger `<button>` when `multiple`
|
|
81
|
+
* or `searchable` render the floating engine.
|
|
82
|
+
*/
|
|
83
|
+
ref?: Ref<HTMLSelectElement | HTMLButtonElement>;
|
|
84
|
+
} & Omit<ComponentPropsWithoutRef<'select'>, 'value' | 'onChange' | 'size' | 'multiple'>;
|
|
85
|
+
export default function SelectCore({ value, onChange, onNativeChange, multiple, searchable, clearable, loading, onSearch, maxTagCount, size, virtualized, className, placeholder, children, ref, ...rest }: SelectCoreProps): import("react").JSX.Element;
|
|
13
86
|
export type { SelectCoreProps };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, Ref } from 'react';
|
|
2
|
+
import type { SelectEntryData } from './select-options';
|
|
3
|
+
/** Metrics override for the `virtualized` option list of the floating
|
|
4
|
+
* Select paths (multiple, or single with `searchable`). */
|
|
5
|
+
type SelectVirtualizedConfig = {
|
|
6
|
+
/**
|
|
7
|
+
* Row height in px of one option row. Defaults to 29 — the measured
|
|
8
|
+
* natural box of an option row: space-1 padding top+bottom (4+4) plus
|
|
9
|
+
* the taller of the text-sm line box (21px at leading-normal) and the
|
|
10
|
+
* 1.125rem visual checkbox (18px). Virtualization math needs it as a
|
|
11
|
+
* JS number; rows are stretched to fill it (`virtualRow`), so the two
|
|
12
|
+
* cannot drift apart.
|
|
13
|
+
*/
|
|
14
|
+
itemHeight?: number;
|
|
15
|
+
/** Extra rows kept mounted above/below the visible window. Defaults
|
|
16
|
+
* to VirtualList's 5. */
|
|
17
|
+
overscan?: number;
|
|
18
|
+
};
|
|
19
|
+
type SelectFloatingProps = {
|
|
20
|
+
/**
|
|
21
|
+
* Current selection — `string[]` in multiple mode, `string` in single
|
|
22
|
+
* mode. A stray value of the other shape is normalized (empty
|
|
23
|
+
* selection / empty value) rather than crashing.
|
|
24
|
+
*/
|
|
25
|
+
value: string | string[];
|
|
26
|
+
/**
|
|
27
|
+
* Notifies the next value: `string[]` in multiple mode, `string` in
|
|
28
|
+
* single mode — the single-mode option pick also closes the panel.
|
|
29
|
+
*/
|
|
30
|
+
onChange: (value: string | string[]) => void;
|
|
31
|
+
/** Extracted <Option>/<option>/<OptionGroup> children of the owning
|
|
32
|
+
* Select, grouping structure preserved. */
|
|
33
|
+
entries: SelectEntryData[];
|
|
34
|
+
/** Multiple selection mode: chips in the trigger, toggling options,
|
|
35
|
+
* panel stays open across picks. Single mode closes on pick. */
|
|
36
|
+
multiple: boolean;
|
|
37
|
+
/** Falls back to the `select.placeholder` locale string. */
|
|
38
|
+
placeholder?: string;
|
|
39
|
+
size?: 'sm' | 'md' | 'lg';
|
|
40
|
+
/**
|
|
41
|
+
* Render a search input at the top of the panel that filters the
|
|
42
|
+
* options (case-insensitive substring over the label text). Typing
|
|
43
|
+
* filters and auto-highlights the first match; ↑/↓ move the
|
|
44
|
+
* highlight, Enter picks it, Escape closes. The input is focused
|
|
45
|
+
* when the panel opens.
|
|
46
|
+
*/
|
|
47
|
+
searchable?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Show a pointer-only × clear affordance at the trigger's inline end
|
|
50
|
+
* while a value is selected (revealed on hover/focus-within).
|
|
51
|
+
* Clicking it empties the value (`[]` / `''`) without toggling the
|
|
52
|
+
* panel and keeps focus on the trigger. Keyboard parity: Backspace on
|
|
53
|
+
* the single-mode trigger clears the value; multiple mode keeps
|
|
54
|
+
* Backspace removing the last chip.
|
|
55
|
+
*/
|
|
56
|
+
clearable?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Async option state: the options area shows a Spinner with
|
|
59
|
+
* `aria-busy="true"` on the panel instead of the list, and search
|
|
60
|
+
* filtering is skipped (an empty result while loading would be a
|
|
61
|
+
* lie). Keyboard navigation is inert until loading finishes.
|
|
62
|
+
*/
|
|
63
|
+
loading?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Remote search: while set, local query filtering is suspended — the
|
|
66
|
+
* panel renders exactly the options received through `entries`, and
|
|
67
|
+
* every query transition of the panel's search input is reported
|
|
68
|
+
* here instead: each keystroke, clearing the field, and the reset
|
|
69
|
+
* back to `''` when the panel closes (so the consumer can restore
|
|
70
|
+
* the full list before the next open). The consumer owns the
|
|
71
|
+
* options end to end; pair with `loading` for the pending state.
|
|
72
|
+
* Debouncing is the consumer's concern.
|
|
73
|
+
*/
|
|
74
|
+
onSearch?: (query: string) => void;
|
|
75
|
+
/**
|
|
76
|
+
* Multiple mode only: render at most this many chips; the rest
|
|
77
|
+
* collapse into a `+N` badge whose `title` tooltip lists the
|
|
78
|
+
* overflow labels. Selection semantics are unchanged — the badge is
|
|
79
|
+
* presentational.
|
|
80
|
+
*/
|
|
81
|
+
maxTagCount?: number;
|
|
82
|
+
/**
|
|
83
|
+
* Render the options list through VirtualList so thousand-option
|
|
84
|
+
* listboxes mount only the visible window (plus overscan) instead of
|
|
85
|
+
* the full DOM list. `false`/omitted (default) keeps the plain DOM
|
|
86
|
+
* path byte-for-byte; an object additionally customizes row metrics.
|
|
87
|
+
*/
|
|
88
|
+
virtualized?: boolean | SelectVirtualizedConfig;
|
|
89
|
+
className?: string;
|
|
90
|
+
/** Forwarded to the trigger `<button>` element. */
|
|
91
|
+
ref?: Ref<HTMLButtonElement>;
|
|
92
|
+
} & Omit<ComponentPropsWithoutRef<'button'>, 'value' | 'onChange' | 'size' | 'type' | 'children'>;
|
|
93
|
+
export default function SelectFloating({ value, onChange, entries, multiple, placeholder, searchable, clearable, loading, onSearch, maxTagCount, size, virtualized, className, ref, ...rest }: SelectFloatingProps): import("react").JSX.Element;
|
|
94
|
+
export type { SelectFloatingProps, SelectVirtualizedConfig };
|
|
@@ -4,3 +4,5 @@ export { default as SelectCore } from './SelectCore';
|
|
|
4
4
|
export type { SelectCoreProps } from './SelectCore';
|
|
5
5
|
export { default as Option } from './Option';
|
|
6
6
|
export type { OptionProps } from './Option';
|
|
7
|
+
export { default as OptionGroup } from './OptionGroup';
|
|
8
|
+
export type { OptionGroupProps } from './OptionGroup';
|