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
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared mechanism for nested submenus, consumed by the Menu and
|
|
3
|
+
* DropdownMenu families (`MenuSub*` / `DropdownMenuSub*`). Headless: the
|
|
4
|
+
* hook owns open state (useControl), the floating pair, hover intent,
|
|
5
|
+
* level-scoped keyboard behavior and roving tabindex; the family
|
|
6
|
+
* components are visual skins over the returned behavior record plus the
|
|
7
|
+
* context that carries it from the Sub container to its trigger/content.
|
|
8
|
+
*
|
|
9
|
+
* Keyboard contract (WAI-ARIA menu button / menu pattern, per level):
|
|
10
|
+
* - ArrowDown/Up/Home/End/typeahead stay within the current level
|
|
11
|
+
* (getEnabledMenuItems scopes a `role=menu` container to its nearest
|
|
12
|
+
* menu ancestor);
|
|
13
|
+
* - the inline-end arrow (ArrowRight in LTR, ArrowLeft under
|
|
14
|
+
* `dir="rtl"`) on a sub trigger opens that submenu and focuses its
|
|
15
|
+
* first item;
|
|
16
|
+
* - the inline-start arrow inside a submenu closes it and returns
|
|
17
|
+
* focus to its trigger;
|
|
18
|
+
* - Escape closes only the innermost open level (events are stopped at
|
|
19
|
+
* the level that handled them);
|
|
20
|
+
* - Tab closes the whole stack (propagation is deliberately NOT
|
|
21
|
+
* stopped for Tab so every ancestor level also closes).
|
|
22
|
+
*/
|
|
23
|
+
import type { KeyboardEvent as ReactKeyboardEvent, RefObject } from 'react';
|
|
24
|
+
import type { ControlOrValue } from 'react-use-control';
|
|
25
|
+
import { type FloatingBehavior } from './floating';
|
|
26
|
+
/** Pointer rest time before a submenu opens on hover (intent, not rest). */
|
|
27
|
+
export declare const SUBMENU_OPEN_DELAY_MS = 120;
|
|
28
|
+
/** Grace before a hover-opened submenu closes after the pointer left it. */
|
|
29
|
+
export declare const SUBMENU_CLOSE_GRACE_MS = 160;
|
|
30
|
+
type UseSubmenuOptions = {
|
|
31
|
+
/** Whether the submenu is open — controlled control or uncontrolled initial value. */
|
|
32
|
+
open?: ControlOrValue<boolean>;
|
|
33
|
+
/** Fires on every open transition, whatever drove it. */
|
|
34
|
+
onOpenChange?: (open: boolean) => void;
|
|
35
|
+
};
|
|
36
|
+
/** Mechanism surface shared between a Sub container and its skin parts. */
|
|
37
|
+
export type SubmenuBehavior = {
|
|
38
|
+
open: boolean;
|
|
39
|
+
triggerRef: RefObject<HTMLButtonElement | null>;
|
|
40
|
+
contentRef: RefObject<HTMLDivElement | null>;
|
|
41
|
+
/** id of the sub panel; wired to the trigger's `aria-owns` while open. */
|
|
42
|
+
contentId: string;
|
|
43
|
+
/** Floating-panel behavior of the (trigger, panel) pair. */
|
|
44
|
+
floating: FloatingBehavior;
|
|
45
|
+
/** Hover-intent open; spread on the sub trigger's `onPointerEnter`. */
|
|
46
|
+
onTriggerPointerEnter: () => void;
|
|
47
|
+
/**
|
|
48
|
+
* Inline-end arrow opens (focusing the first item), Escape and the
|
|
49
|
+
* inline-start arrow close an open submenu from its trigger; spread on
|
|
50
|
+
* the trigger's `onKeyDown`.
|
|
51
|
+
*/
|
|
52
|
+
handleTriggerKeyDown: (event: ReactKeyboardEvent) => void;
|
|
53
|
+
/**
|
|
54
|
+
* Level-scoped keyboard for the sub panel: the shared menu keyboard
|
|
55
|
+
* plus level containment — every handled key stops propagating so the
|
|
56
|
+
* parent level stays inert, except Tab which closes the whole stack.
|
|
57
|
+
*/
|
|
58
|
+
contentKeyDown: (event: ReactKeyboardEvent) => void;
|
|
59
|
+
};
|
|
60
|
+
export declare function useSubmenu({ open: openControl, onOpenChange, }: UseSubmenuOptions): SubmenuBehavior;
|
|
61
|
+
export declare const SubmenuProvider: import("react").Provider<SubmenuBehavior | undefined>;
|
|
62
|
+
export declare function useSubmenuContext(): SubmenuBehavior;
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* 模态浮层 open 状态翻转的 View Transitions 包装器(内部原语,不进
|
|
4
|
+
* barrel)。Dialog/Drawer/BottomSheet 的 opt-in `viewTransition` prop
|
|
5
|
+
* 共用这一出口。
|
|
6
|
+
*
|
|
7
|
+
* React 官方模式:`document.startViewTransition(() => flushSync(() =>
|
|
8
|
+
* setOpen(next)))`——浏览器先捕获旧快照,update callback 里的 flushSync
|
|
9
|
+
* 同步提交翻转后的 DOM,`::view-transition-*` 伪元素树驱动整页过渡。
|
|
10
|
+
* 包装的只是「状态翻转外层」:命令式 handle、受控同步、Esc/背景点击
|
|
11
|
+
* 等所有路径内部仍走同一个 setOpen,不会双发或失同步。
|
|
12
|
+
*
|
|
13
|
+
* 三重守卫下直接透传(与不开 prop 时行为完全一致):
|
|
14
|
+
* - `enabled` 为 false(组件默认值);
|
|
15
|
+
* - `prefers-reduced-motion: reduce`(usePrefersReducedMotion 是 hook,
|
|
16
|
+
* 在本 hook 顶层订阅,回调闭包只读值——不能在回调里现调);
|
|
17
|
+
* - 引擎不支持 `document.startViewTransition`(jsdom / 旧引擎)。
|
|
18
|
+
*
|
|
19
|
+
* update callback 同步 throw 或过渡被跳过时 `ready`/`finished` 会
|
|
20
|
+
* reject——挂 no-op catch 吞掉,防止 unhandled rejection(状态已由
|
|
21
|
+
* flushSync 落地,没有可恢复的动作)。
|
|
22
|
+
*
|
|
23
|
+
* @param enabled 组件的 `viewTransition` prop(默认 false)。
|
|
24
|
+
* @param setOpen useControl 返回的状态写入器。
|
|
25
|
+
* @returns 签名相同的写入器;开启时每次翻转运行在 VT 的 update
|
|
26
|
+
* callback 内。
|
|
27
|
+
*/
|
|
28
|
+
export declare function useViewTransitionFlip(enabled: boolean, setOpen: Dispatch<SetStateAction<boolean>>): Dispatch<SetStateAction<boolean>>;
|
package/dist/utils/classnames.js
CHANGED
package/dist/utils/collision.js
CHANGED
|
@@ -37,38 +37,49 @@ var n = {
|
|
|
37
37
|
side: "top",
|
|
38
38
|
align: "center"
|
|
39
39
|
}
|
|
40
|
+
}, r = {
|
|
41
|
+
bottom: "bottom-end",
|
|
42
|
+
"bottom-span": "bottom-end",
|
|
43
|
+
"bottom-center": "bottom-center",
|
|
44
|
+
"bottom-end": "bottom",
|
|
45
|
+
top: "top",
|
|
46
|
+
left: "right",
|
|
47
|
+
right: "left"
|
|
40
48
|
};
|
|
41
|
-
function
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
top:
|
|
52
|
-
left:
|
|
53
|
-
}),
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
49
|
+
function i(e, t = "ltr") {
|
|
50
|
+
return t === "rtl" ? r[e] : e;
|
|
51
|
+
}
|
|
52
|
+
function a({ trigger: e, panel: r, viewport: a, placement: o, gap: s, strategy: c, dir: l }) {
|
|
53
|
+
let u = i(o, l), { flip: d, shift: f, padding: p } = c, m = {
|
|
54
|
+
top: p.top,
|
|
55
|
+
bottom: a.height - p.bottom,
|
|
56
|
+
left: p.left,
|
|
57
|
+
right: a.width - p.right
|
|
58
|
+
}, h = e.left + e.width / 2 - r.width / 2, g = e.top + e.height / 2 - r.height / 2, _ = (t, n) => ({
|
|
59
|
+
top: t === "bottom" ? e.bottom + s.below : e.top - r.height - s.above,
|
|
60
|
+
left: n === "start" ? e.left : n === "end" ? e.right - r.width : h
|
|
61
|
+
}), v = (t) => ({
|
|
62
|
+
top: g,
|
|
63
|
+
left: t === "right" ? e.right + s.after : e.left - r.width - s.before
|
|
64
|
+
}), y = u === "left" || u === "right", { top: b, left: x } = y ? v(u) : _(n[u].side, n[u].align), S = y ? u : n[u].side;
|
|
65
|
+
if (y) {
|
|
66
|
+
let t = u === "right" ? x + r.width > m.right : x < m.left, n = u === "right" ? e.left - r.width - s.before >= m.left : e.right + r.width + s.after <= m.right;
|
|
67
|
+
if (d && t && n) {
|
|
68
|
+
let e = u === "right" ? "left" : "right";
|
|
69
|
+
({top: b, left: x} = v(e)), S = e;
|
|
59
70
|
}
|
|
60
71
|
} else {
|
|
61
|
-
let { side: t, align: i } = n[
|
|
62
|
-
if (
|
|
72
|
+
let { side: t, align: i } = n[u], a = t === "bottom" ? b + r.height > m.bottom : b < m.top, o = t === "bottom" ? e.top - r.height - s.above >= m.top : e.bottom + r.height + s.below <= m.bottom;
|
|
73
|
+
if (d && a && o) {
|
|
63
74
|
let e = t === "bottom" ? "top" : "bottom";
|
|
64
|
-
({top:
|
|
75
|
+
({top: b, left: x} = _(e, i)), S = e;
|
|
65
76
|
}
|
|
66
77
|
}
|
|
67
|
-
return
|
|
68
|
-
top:
|
|
69
|
-
left:
|
|
70
|
-
placement:
|
|
78
|
+
return f && (y ? b = t(b, m.top, m.bottom - r.height) : x = t(x, m.left, m.right - r.width)), y ? x = t(x, m.left, m.right - r.width) : b = t(b, m.top, m.bottom - r.height), {
|
|
79
|
+
top: b,
|
|
80
|
+
left: x,
|
|
81
|
+
placement: S
|
|
71
82
|
};
|
|
72
83
|
}
|
|
73
84
|
//#endregion
|
|
74
|
-
export {
|
|
85
|
+
export { a as computeFloatingPosition, i as mirrorPlacement, e as resolvePadding };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { LocaleContext as e } from "../components/LocaleProvider/LocaleContext.js";
|
|
3
|
+
import { useContext as t } from "react";
|
|
4
|
+
//#region src/lib/utils/direction.ts
|
|
5
|
+
var n = /* @__PURE__ */ new Set([
|
|
6
|
+
"ar",
|
|
7
|
+
"ckb",
|
|
8
|
+
"dv",
|
|
9
|
+
"fa",
|
|
10
|
+
"he",
|
|
11
|
+
"iw",
|
|
12
|
+
"ku",
|
|
13
|
+
"ps",
|
|
14
|
+
"sd",
|
|
15
|
+
"ug",
|
|
16
|
+
"ur",
|
|
17
|
+
"yi"
|
|
18
|
+
]);
|
|
19
|
+
function r(e) {
|
|
20
|
+
if (!e) return;
|
|
21
|
+
let t = e.split(/[-_]/)[0].toLowerCase();
|
|
22
|
+
return n.has(t) ? "rtl" : "ltr";
|
|
23
|
+
}
|
|
24
|
+
function i(e) {
|
|
25
|
+
let t = e?.closest("[dir]");
|
|
26
|
+
if (!t) return "ltr";
|
|
27
|
+
let n = t.getAttribute("dir")?.toLowerCase();
|
|
28
|
+
return n === "rtl" || n === "ltr" ? n : typeof getComputedStyle == "function" && getComputedStyle(t).direction === "rtl" ? "rtl" : "ltr";
|
|
29
|
+
}
|
|
30
|
+
function a() {
|
|
31
|
+
return t(e)?.direction ?? (typeof document > "u" ? "ltr" : i(document.documentElement));
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { i as getDirection, r as localeDirection, a as useDirection };
|
package/dist/utils/floating.js
CHANGED
|
@@ -1,86 +1,99 @@
|
|
|
1
1
|
|
|
2
2
|
"use client";
|
|
3
3
|
import { classnames as e } from "./classnames.js";
|
|
4
|
-
import {
|
|
5
|
-
import { computeFloatingPosition as n,
|
|
4
|
+
import { getDirection as t } from "./direction.js";
|
|
5
|
+
import { computeFloatingPosition as n, mirrorPlacement as r, resolvePadding as i } from "./collision.js";
|
|
6
|
+
import { whenExitSettles as a } from "./presence.js";
|
|
6
7
|
/* empty css */
|
|
7
|
-
import { jsx as
|
|
8
|
-
import { useCallback as
|
|
8
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
9
|
+
import { useCallback as s, useEffect as c, useId as l, useRef as u, useState as d } from "react";
|
|
9
10
|
//#region src/lib/utils/floating.tsx
|
|
10
|
-
var
|
|
11
|
-
function
|
|
11
|
+
var f = 500;
|
|
12
|
+
function p() {
|
|
12
13
|
return typeof HTMLElement < "u" && "popover" in HTMLElement.prototype;
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
-
return
|
|
15
|
+
function m() {
|
|
16
|
+
return p() && typeof CSS < "u" && typeof CSS.supports == "function" && CSS.supports("anchor-name: --haze-floating-probe");
|
|
16
17
|
}
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
18
|
+
var h = "haze-floating__floatingNative", g = "haze-floating__floatingAnchored", _ = "haze-floating__floatingFixed", v = "haze-floating__floatingHidden", y = "haze-floating__floatingAnimated", b = "haze-floating__anchoredBottom", x = "haze-floating__anchoredBottomSpan", S = "haze-floating__anchoredBottomCenter", C = "haze-floating__anchoredBottomEnd", w = "haze-floating__anchoredTop", T = "haze-floating__anchoredLeft", E = "haze-floating__anchoredRight", D = "haze-floating__anchoredLogicalBottom", O = "haze-floating__anchoredLogicalBottomCenter", k = "haze-floating__anchoredLogicalBottomEnd", A = "haze-floating__anchoredLogicalTop", j = "haze-floating__anchoredLogicalLeft", M = "haze-floating__anchoredLogicalRight", N;
|
|
19
|
+
function P() {
|
|
20
|
+
return N === void 0 && (N = m() && typeof CSS < "u" && typeof CSS.supports == "function" && CSS.supports("position-area: span-inline-end block-end") && CSS.supports("position-area: inline-start center")), N;
|
|
21
|
+
}
|
|
22
|
+
var F = "haze-floating__fallbackBottom", I = F, L = "haze-floating__fallbackBottomCenter", R = "haze-floating__fallbackBottomEnd", z = "haze-floating__fallbackTop", B = "haze-floating__fallbackLeft", V = "haze-floating__fallbackRight", H = "haze-floating__gapBelow", U = "haze-floating__gapAbove", W = "haze-floating__gapBefore", G = "haze-floating__gapAfter", K = {
|
|
23
|
+
bottom: b,
|
|
24
|
+
"bottom-span": x,
|
|
25
|
+
"bottom-center": S,
|
|
26
|
+
"bottom-end": C,
|
|
27
|
+
top: w,
|
|
28
|
+
left: T,
|
|
29
|
+
right: E
|
|
30
|
+
}, q = {
|
|
31
|
+
bottom: D,
|
|
32
|
+
"bottom-span": D,
|
|
33
|
+
"bottom-center": O,
|
|
34
|
+
"bottom-end": k,
|
|
35
|
+
top: A,
|
|
36
|
+
left: j,
|
|
37
|
+
right: M
|
|
38
|
+
}, J = {
|
|
39
|
+
bottom: F,
|
|
40
|
+
"bottom-span": I,
|
|
41
|
+
"bottom-center": L,
|
|
42
|
+
"bottom-end": R,
|
|
43
|
+
top: z,
|
|
44
|
+
left: B,
|
|
45
|
+
right: V
|
|
46
|
+
}, ee = {
|
|
47
|
+
bottom: H,
|
|
48
|
+
"bottom-span": H,
|
|
49
|
+
"bottom-center": H,
|
|
50
|
+
"bottom-end": H,
|
|
51
|
+
top: U,
|
|
52
|
+
left: W,
|
|
53
|
+
right: G
|
|
41
54
|
};
|
|
42
|
-
function
|
|
43
|
-
let
|
|
44
|
-
e !==
|
|
45
|
-
let
|
|
46
|
-
|
|
47
|
-
let
|
|
48
|
-
if (!
|
|
49
|
-
|
|
50
|
-
let
|
|
51
|
-
|
|
52
|
-
},
|
|
53
|
-
if (
|
|
54
|
-
if (
|
|
55
|
+
function te({ open: e, setOpen: n, triggerRef: r, panelRef: i, animated: o, collision: v }) {
|
|
56
|
+
let y = `--haze-floating-${l().replace(/[^a-zA-Z0-9]/g, "")}`, b = p(), x = m(), [S, C] = d(!e), [w, T] = d(e);
|
|
57
|
+
e !== w && (T(e), e && C(!1));
|
|
58
|
+
let E = u(!1), [D, O] = d(!1), k = u(null), A = u(-Infinity), j = u(-Infinity), M = u(null);
|
|
59
|
+
c(() => {
|
|
60
|
+
let t = i.current;
|
|
61
|
+
if (!t || !b) return;
|
|
62
|
+
t !== k.current && (k.current = t, E.current = !1, O(!1));
|
|
63
|
+
let r = !0, s = () => {
|
|
64
|
+
M.current = { el: t }, t.hidePopover();
|
|
65
|
+
}, c = () => {
|
|
66
|
+
if (E.current && t === i.current) {
|
|
67
|
+
if (o) {
|
|
55
68
|
let e = () => {
|
|
56
|
-
|
|
57
|
-
}, n = t
|
|
69
|
+
r && E.current && t === i.current && s();
|
|
70
|
+
}, n = a(t);
|
|
58
71
|
n ? n.then(e) : e();
|
|
59
|
-
} else
|
|
72
|
+
} else s();
|
|
60
73
|
}
|
|
61
|
-
},
|
|
62
|
-
let i =
|
|
63
|
-
if (
|
|
64
|
-
|
|
65
|
-
let
|
|
66
|
-
if (
|
|
67
|
-
e &&
|
|
74
|
+
}, l = (r) => {
|
|
75
|
+
let i = r.newState;
|
|
76
|
+
if (E.current = i === "open", O(E.current), i === "closed") {
|
|
77
|
+
o && C(!0);
|
|
78
|
+
let r = M.current?.el === t;
|
|
79
|
+
if (M.current = null, r) {
|
|
80
|
+
e && t.showPopover();
|
|
68
81
|
return;
|
|
69
82
|
}
|
|
70
|
-
e && (performance.now() -
|
|
71
|
-
} else e ||
|
|
83
|
+
e && (performance.now() - A.current < f && (j.current = performance.now()), A.current = -Infinity, n(!1));
|
|
84
|
+
} else e || c();
|
|
72
85
|
};
|
|
73
|
-
return
|
|
74
|
-
|
|
86
|
+
return t.addEventListener("toggle", l), e ? E.current || t.showPopover() : c(), () => {
|
|
87
|
+
r = !1, t.removeEventListener("toggle", l);
|
|
75
88
|
};
|
|
76
89
|
}, [
|
|
77
|
-
|
|
90
|
+
b,
|
|
78
91
|
e,
|
|
79
92
|
n,
|
|
80
93
|
i,
|
|
81
|
-
|
|
82
|
-
]),
|
|
83
|
-
if (
|
|
94
|
+
o
|
|
95
|
+
]), c(() => {
|
|
96
|
+
if (b || !e) return;
|
|
84
97
|
let t = (e) => e instanceof Node && !!(r.current?.contains(e) || i.current?.contains(e)), a = (e) => {
|
|
85
98
|
t(e.target) || n(!1);
|
|
86
99
|
}, o = (e) => {
|
|
@@ -90,137 +103,144 @@ function z({ open: e, setOpen: n, triggerRef: r, panelRef: i, animated: g, colli
|
|
|
90
103
|
document.removeEventListener("pointerdown", a), document.removeEventListener("keydown", o);
|
|
91
104
|
};
|
|
92
105
|
}, [
|
|
93
|
-
|
|
106
|
+
b,
|
|
94
107
|
e,
|
|
95
108
|
n,
|
|
96
109
|
r,
|
|
97
110
|
i
|
|
98
|
-
]),
|
|
99
|
-
if (
|
|
100
|
-
let
|
|
101
|
-
|
|
111
|
+
]), c(() => {
|
|
112
|
+
if (b || !o || e || S) return;
|
|
113
|
+
let t = !0, n = i.current, r = n ? a(n) : null, s = () => {
|
|
114
|
+
t && C(!0);
|
|
102
115
|
};
|
|
103
|
-
return
|
|
104
|
-
|
|
116
|
+
return r ? r.then(s) : s(), () => {
|
|
117
|
+
t = !1;
|
|
105
118
|
};
|
|
106
119
|
}, [
|
|
107
|
-
|
|
108
|
-
|
|
120
|
+
b,
|
|
121
|
+
o,
|
|
109
122
|
e,
|
|
110
|
-
|
|
123
|
+
S,
|
|
111
124
|
i
|
|
112
125
|
]);
|
|
113
|
-
let
|
|
114
|
-
e && (
|
|
115
|
-
}, [e]),
|
|
116
|
-
if (performance.now() -
|
|
117
|
-
|
|
126
|
+
let N = s(() => {
|
|
127
|
+
e && (A.current = performance.now());
|
|
128
|
+
}, [e]), P = s(() => {
|
|
129
|
+
if (performance.now() - j.current < f) {
|
|
130
|
+
j.current = -Infinity;
|
|
118
131
|
return;
|
|
119
132
|
}
|
|
120
133
|
n((e) => !e);
|
|
121
|
-
}, [n]);
|
|
122
|
-
return {
|
|
134
|
+
}, [n]), [F, I] = d("ltr");
|
|
135
|
+
return c(() => {
|
|
136
|
+
let e = t(r.current);
|
|
137
|
+
I((t) => t === e ? t : e);
|
|
138
|
+
}, [r, e]), {
|
|
123
139
|
open: e,
|
|
124
|
-
native:
|
|
125
|
-
anchored:
|
|
126
|
-
shown:
|
|
127
|
-
dataState:
|
|
128
|
-
exited:
|
|
129
|
-
collision:
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
140
|
+
native: b,
|
|
141
|
+
anchored: x,
|
|
142
|
+
shown: b ? D : e,
|
|
143
|
+
dataState: o ? e ? "open" : "closed" : void 0,
|
|
144
|
+
exited: o ? S : !e,
|
|
145
|
+
collision: v,
|
|
146
|
+
direction: F,
|
|
147
|
+
anchorName: y,
|
|
148
|
+
triggerStyle: x ? { anchorName: y } : void 0,
|
|
149
|
+
onTriggerPointerDown: N,
|
|
150
|
+
onTriggerClick: P,
|
|
134
151
|
panelAttrs: {
|
|
135
|
-
popover:
|
|
136
|
-
style:
|
|
152
|
+
popover: b ? "auto" : void 0,
|
|
153
|
+
style: x ? { "--haze-floating-anchor": y } : void 0
|
|
137
154
|
},
|
|
138
155
|
panelClasses: [
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
!
|
|
143
|
-
!!
|
|
156
|
+
b && h,
|
|
157
|
+
b && x && g,
|
|
158
|
+
b && !x && _,
|
|
159
|
+
!b && !e && (!o || S) && "haze-floating__floatingHidden",
|
|
160
|
+
!!o && "haze-floating__floatingAnimated"
|
|
144
161
|
],
|
|
145
162
|
triggerRef: r,
|
|
146
163
|
panelRef: i
|
|
147
164
|
};
|
|
148
165
|
}
|
|
149
|
-
function
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
166
|
+
function Y(e, t, n = "ltr") {
|
|
167
|
+
if (t === "point") return [];
|
|
168
|
+
let i = r(t, n);
|
|
169
|
+
return [
|
|
170
|
+
e.native && e.anchored && (P() ? q[t] : K[i]),
|
|
171
|
+
e.native && !e.anchored && ee[i],
|
|
172
|
+
!e.native && J[i]
|
|
154
173
|
];
|
|
155
174
|
}
|
|
156
|
-
function
|
|
175
|
+
function X(e, t) {
|
|
157
176
|
return parseFloat(getComputedStyle(e)[t]) || 0;
|
|
158
177
|
}
|
|
159
|
-
function
|
|
178
|
+
function Z(e, t, n, r, i) {
|
|
160
179
|
let a = r, o = Math.max(a, n - i - t);
|
|
161
180
|
return Math.min(Math.max(e, a), o) - e;
|
|
162
181
|
}
|
|
163
|
-
function
|
|
164
|
-
if (
|
|
165
|
-
let
|
|
182
|
+
function Q(e, r, a, o) {
|
|
183
|
+
if (a === "point") return;
|
|
184
|
+
let s = r.getBoundingClientRect(), c = e.getBoundingClientRect(), l = {
|
|
166
185
|
width: window.innerWidth,
|
|
167
186
|
height: window.innerHeight
|
|
168
|
-
},
|
|
169
|
-
below:
|
|
170
|
-
above:
|
|
171
|
-
before:
|
|
172
|
-
after:
|
|
173
|
-
}, { top:
|
|
174
|
-
trigger:
|
|
175
|
-
panel:
|
|
176
|
-
viewport:
|
|
177
|
-
placement:
|
|
178
|
-
gap:
|
|
187
|
+
}, u = {
|
|
188
|
+
below: X(e, "marginTop"),
|
|
189
|
+
above: X(e, "marginBottom"),
|
|
190
|
+
before: X(e, "marginRight"),
|
|
191
|
+
after: X(e, "marginLeft")
|
|
192
|
+
}, { top: d, left: f } = n({
|
|
193
|
+
trigger: s,
|
|
194
|
+
panel: c,
|
|
195
|
+
viewport: l,
|
|
196
|
+
placement: a,
|
|
197
|
+
gap: u,
|
|
198
|
+
dir: t(r),
|
|
179
199
|
strategy: {
|
|
180
|
-
flip:
|
|
181
|
-
shift:
|
|
182
|
-
padding:
|
|
200
|
+
flip: o?.flip ?? !0,
|
|
201
|
+
shift: o?.shift ?? !0,
|
|
202
|
+
padding: i(o?.collisionPadding)
|
|
183
203
|
}
|
|
184
204
|
});
|
|
185
|
-
e.style.top = `${
|
|
205
|
+
e.style.top = `${d}px`, e.style.left = `${f}px`;
|
|
186
206
|
}
|
|
187
|
-
function
|
|
188
|
-
let { native:
|
|
189
|
-
|
|
190
|
-
if (!
|
|
207
|
+
function $({ behavior: e, placement: t, collision: n }) {
|
|
208
|
+
let { native: r, anchored: a, shown: o, triggerRef: s, panelRef: l } = e;
|
|
209
|
+
c(() => {
|
|
210
|
+
if (!r || t === "point" || !o) return;
|
|
191
211
|
let e = l.current;
|
|
192
212
|
if (!e) return;
|
|
193
213
|
if (a) {
|
|
194
|
-
let
|
|
195
|
-
if (!
|
|
214
|
+
let r = n?.shift !== !1, a = i(n?.collisionPadding), o = t === "left" || t === "right", s = () => {
|
|
215
|
+
if (!r) {
|
|
196
216
|
e.style.translate = "";
|
|
197
217
|
return;
|
|
198
218
|
}
|
|
199
|
-
let t = e.getBoundingClientRect(), n = o ? 0 :
|
|
200
|
-
e.style.translate = n === 0 &&
|
|
219
|
+
let t = e.getBoundingClientRect(), n = o ? 0 : Z(t.left, t.width, window.innerWidth, a.left, a.right), i = o ? Z(t.top, t.height, window.innerHeight, a.top, a.bottom) : 0;
|
|
220
|
+
e.style.translate = n === 0 && i === 0 ? "" : `${n}px ${i}px`;
|
|
201
221
|
};
|
|
202
222
|
return s(), window.addEventListener("scroll", s, !0), window.addEventListener("resize", s), () => {
|
|
203
223
|
window.removeEventListener("scroll", s, !0), window.removeEventListener("resize", s), e.style.translate = "";
|
|
204
224
|
};
|
|
205
225
|
}
|
|
206
|
-
let
|
|
207
|
-
if (!
|
|
208
|
-
let u = () =>
|
|
226
|
+
let c = s.current;
|
|
227
|
+
if (!c) return;
|
|
228
|
+
let u = () => Q(e, c, t, n);
|
|
209
229
|
return u(), window.addEventListener("scroll", u, !0), window.addEventListener("resize", u), () => {
|
|
210
230
|
window.removeEventListener("scroll", u, !0), window.removeEventListener("resize", u);
|
|
211
231
|
};
|
|
212
232
|
}, [
|
|
213
|
-
|
|
233
|
+
r,
|
|
214
234
|
a,
|
|
215
|
-
|
|
235
|
+
o,
|
|
216
236
|
t,
|
|
217
237
|
n,
|
|
218
|
-
|
|
238
|
+
s,
|
|
219
239
|
l
|
|
220
240
|
]);
|
|
221
241
|
}
|
|
222
|
-
function
|
|
223
|
-
|
|
242
|
+
function ne({ behavior: t, placement: n, collision: r, visualClass: i, className: a, style: s, children: c, ...l }) {
|
|
243
|
+
$({
|
|
224
244
|
behavior: t,
|
|
225
245
|
placement: n ?? "point",
|
|
226
246
|
collision: r ?? t.collision
|
|
@@ -229,19 +249,19 @@ function G({ behavior: t, placement: n, collision: r, visualClass: a, className:
|
|
|
229
249
|
...t.panelAttrs.style,
|
|
230
250
|
...s
|
|
231
251
|
} : void 0;
|
|
232
|
-
return /* @__PURE__ */
|
|
252
|
+
return /* @__PURE__ */ o("div", {
|
|
233
253
|
...t.dataState !== void 0 && { "data-state": t.dataState },
|
|
234
254
|
...l,
|
|
235
255
|
...t.panelAttrs,
|
|
236
256
|
style: u,
|
|
237
257
|
className: e([
|
|
238
|
-
|
|
258
|
+
i,
|
|
239
259
|
...t.panelClasses,
|
|
240
|
-
...n ?
|
|
241
|
-
|
|
260
|
+
...n ? Y(t, n, t.direction) : [],
|
|
261
|
+
a
|
|
242
262
|
]),
|
|
243
263
|
children: c
|
|
244
264
|
});
|
|
245
265
|
}
|
|
246
266
|
//#endregion
|
|
247
|
-
export {
|
|
267
|
+
export { ne as FloatingPanel, y as floatingAnimated, v as floatingHidden, Y as floatingPlacementClasses, Q as placeFloatingPanel, m as supportsAnchorPositioning, P as supportsLogicalPositionArea, p as supportsNativePopover, te as useFloating, $ as useFloatingPosition };
|