haze-ui 1.29.0 → 1.30.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 +58 -0
- package/cli/theme.mjs +446 -0
- package/dist/components/Accordion/Accordion.js +1 -0
- package/dist/components/Accordion/AccordionItem.js +3 -0
- package/dist/components/Affix/Affix.js +1 -0
- package/dist/components/Alert/Alert.js +3 -0
- package/dist/components/Anchor/Anchor.js +21 -15
- package/dist/components/AppShell/AppShell.js +5 -0
- package/dist/components/ApprovalCard/ApprovalCard.js +8 -0
- package/dist/components/AspectRatio/AspectRatio.js +2 -0
- package/dist/components/AsyncSection/AsyncSection.js +8 -0
- package/dist/components/Avatar/Avatar.js +11 -6
- package/dist/components/AvatarGroup/AvatarGroup.js +9 -6
- package/dist/components/BackToTop/BackToTop.js +5 -4
- package/dist/components/Badge/Badge.js +1 -0
- package/dist/components/Banner/Banner.js +3 -0
- package/dist/components/BottomSheet/BottomSheet.js +21 -16
- package/dist/components/Breadcrumb/Breadcrumb.js +11 -7
- package/dist/components/Breadcrumb/BreadcrumbItem.js +2 -0
- package/dist/components/Button/Button.js +13 -11
- package/dist/components/Button/ButtonLink.js +15 -13
- package/dist/components/Calendar/Calendar.js +523 -368
- package/dist/components/Calendar/date.js +35 -10
- package/dist/components/Card/Card.js +1 -0
- package/dist/components/Carousel/Carousel.js +157 -60
- package/dist/components/Carousel/CarouselSlide.js +3 -1
- package/dist/components/Cascader/Cascader.js +48 -35
- package/dist/components/Chart/Chart.js +5 -4
- package/dist/components/Chart/chart-elements.js +14 -10
- package/dist/components/ChatContainer/ChatContainer.js +9 -7
- package/dist/components/ChatInput/ChatInput.js +12 -9
- package/dist/components/ChatMessage/ChatMessage.js +83 -44
- package/dist/components/Checkbox/CheckboxCore.js +2 -0
- package/dist/components/Chip/Chip.js +3 -0
- package/dist/components/CodeBlock/CodeBlock.js +18 -9
- package/dist/components/Collapsible/Collapsible.js +24 -21
- package/dist/components/ColorPicker/ColorPicker.js +85 -14
- package/dist/components/ColorPicker/ColorPickerCore.js +6 -0
- package/dist/components/ColorPicker/ColorPickerPanel.js +277 -0
- package/dist/components/ColorPicker/color-math.js +168 -0
- package/dist/components/ColorPicker/color-picker-styles.js +7 -0
- package/dist/components/ColorPicker/index.js +3 -3
- package/dist/components/Combobox/Combobox.js +31 -24
- package/dist/components/Combobox/ComboboxGroup.js +7 -5
- package/dist/components/Combobox/ComboboxOption.js +1 -0
- package/dist/components/Command/Command.js +44 -37
- package/dist/components/Command/CommandDialog.js +8 -8
- package/dist/components/ConfigProvider/ConfigContext.js +30 -0
- package/dist/components/ConfigProvider/ConfigProvider.js +14 -0
- package/dist/components/ConfigProvider/index.js +4 -0
- package/dist/components/ConfigProvider/useConfigDefaults.js +10 -0
- package/dist/components/ConfirmDialog/ConfirmDialog.js +18 -11
- package/dist/components/Container/Container.js +1 -0
- package/dist/components/ContextMenu/ContextMenu.js +7 -6
- package/dist/components/ContextMenu/ContextMenuContent.js +4 -4
- package/dist/components/ContextMenu/ContextMenuItem.js +1 -0
- package/dist/components/ContextMenu/ContextMenuSeparator.js +1 -0
- package/dist/components/ContextMenu/ContextMenuTrigger.js +1 -0
- package/dist/components/ConversationList/ConversationItem.js +4 -0
- package/dist/components/ConversationList/ConversationList.js +1 -0
- package/dist/components/CountUp/CountUp.js +6 -5
- package/dist/components/DataTable/CellEditor.js +4 -4
- package/dist/components/DataTable/DataTable.js +236 -168
- package/dist/components/DateRangePicker/DateRangePickerCore.js +9 -0
- package/dist/components/Datepicker/Datepicker.js +14 -11
- package/dist/components/Datepicker/DatepickerCore.js +75 -60
- package/dist/components/Datepicker/datetime.js +14 -3
- package/dist/components/Descriptions/Descriptions.js +6 -0
- package/dist/components/Dialog/Dialog.js +13 -11
- package/dist/components/DiffViewer/DiffViewer.js +22 -13
- package/dist/components/Disclosure/Disclosure.js +10 -7
- package/dist/components/Divider/Divider.js +2 -0
- package/dist/components/Drawer/Drawer.js +10 -9
- package/dist/components/DropdownMenu/DropdownMenu.js +58 -35
- package/dist/components/DropdownMenu/DropdownMenuCheckboxItem.js +63 -0
- package/dist/components/DropdownMenu/DropdownMenuContent.js +5 -5
- package/dist/components/DropdownMenu/DropdownMenuGroup.js +26 -0
- package/dist/components/DropdownMenu/DropdownMenuItem.js +29 -10
- package/dist/components/DropdownMenu/DropdownMenuRadioGroup.js +30 -0
- package/dist/components/DropdownMenu/DropdownMenuRadioItem.js +59 -0
- package/dist/components/DropdownMenu/DropdownMenuSeparator.js +1 -0
- package/dist/components/DropdownMenu/DropdownMenuSub.js +1 -0
- package/dist/components/DropdownMenu/DropdownMenuSubTrigger.js +1 -0
- package/dist/components/DropdownMenu/DropdownMenuTrigger.js +1 -0
- package/dist/components/DropdownMenu/dropdown-menu-item-styles.js +7 -0
- package/dist/components/DropdownMenu/index.js +12 -8
- package/dist/components/Ellipsis/Ellipsis.js +11 -8
- package/dist/components/Empty/Empty.js +4 -0
- package/dist/components/FileInput/FileInput.js +7 -5
- package/dist/components/FilePreview/FilePreview.js +19 -1
- package/dist/components/Flex/Flex.js +1 -0
- package/dist/components/FloatButton/FloatButton.js +4 -0
- package/dist/components/FloatButton/FloatButtonGroup.js +18 -13
- package/dist/components/Fullscreen/Fullscreen.js +6 -3
- package/dist/components/Grid/Grid.js +12 -7
- package/dist/components/Grid/GridItem.js +17 -7
- package/dist/components/Grid/grid-item-styles.js +58 -0
- package/dist/components/HoverCard/HoverCard.js +46 -43
- package/dist/components/Icon/Icon.js +1 -0
- package/dist/components/Image/Image.js +10 -7
- package/dist/components/Image/ImagePreview.js +42 -34
- package/dist/components/InlineCompletion/InlineCompletion.js +15 -11
- package/dist/components/InlineEdit/InlineEdit.js +8 -6
- package/dist/components/Input/InputCore.js +1 -0
- package/dist/components/JsonView/JsonView.js +104 -79
- package/dist/components/Kbd/Kbd.js +1 -0
- package/dist/components/List/List.js +1 -0
- package/dist/components/List/ListItem.js +1 -0
- package/dist/components/LocaleProvider/LocaleProvider.js +4 -4
- package/dist/components/LocaleProvider/ar-sa.js +24 -2
- package/dist/components/LocaleProvider/de-de.js +24 -2
- package/dist/components/LocaleProvider/es-es.js +24 -2
- package/dist/components/LocaleProvider/fr-fr.js +24 -2
- package/dist/components/LocaleProvider/it-it.js +24 -2
- package/dist/components/LocaleProvider/ja-jp.js +24 -2
- package/dist/components/LocaleProvider/ko-kr.js +24 -2
- package/dist/components/LocaleProvider/locale.js +24 -2
- package/dist/components/LocaleProvider/pt-br.js +24 -2
- package/dist/components/LocaleProvider/ru-ru.js +24 -2
- package/dist/components/LocaleProvider/zh-cn.js +24 -2
- package/dist/components/LogViewer/LogViewer.js +25 -14
- package/dist/components/MarkdownRenderer/MarkdownRenderer.js +6 -5
- package/dist/components/MarkdownRenderer/markdown-blocks.js +1 -1
- package/dist/components/Masonry/Masonry.js +13 -10
- package/dist/components/Mentions/MentionsCore.js +15 -11
- package/dist/components/Menu/Menu.js +58 -36
- package/dist/components/Menu/MenuCheckboxItem.js +63 -0
- package/dist/components/Menu/MenuDivider.js +1 -0
- package/dist/components/Menu/MenuGroup.js +26 -0
- package/dist/components/Menu/MenuItem.js +28 -9
- package/dist/components/Menu/MenuRadioGroup.js +30 -0
- package/dist/components/Menu/MenuRadioItem.js +59 -0
- package/dist/components/Menu/MenuSub.js +1 -0
- package/dist/components/Menu/MenuSubTrigger.js +1 -0
- package/dist/components/Menu/index.js +11 -7
- package/dist/components/Menu/menu-item-styles.js +7 -0
- package/dist/components/ModelPicker/ModelPicker.js +3 -0
- package/dist/components/NavigationBar/NavLink.js +7 -6
- package/dist/components/NavigationBar/NavigationBar.js +4 -0
- package/dist/components/NumberInput/NumberInputCore.js +4 -0
- package/dist/components/OTPInput/OTPInputCore.js +9 -7
- package/dist/components/Pagination/Pagination.js +125 -33
- package/dist/components/PasswordInput/PasswordInputCore.js +9 -6
- package/dist/components/Popover/Popover.js +9 -7
- package/dist/components/Progress/Progress.js +5 -0
- package/dist/components/PromptInput/PromptInput.js +49 -41
- package/dist/components/QRCode/QRCode.js +9 -7
- package/dist/components/Radio/Radio.js +2 -0
- package/dist/components/Radio/RadioGroupCore.js +7 -6
- package/dist/components/Rating/RatingCore.js +18 -15
- package/dist/components/Resizable/Resizable.js +25 -22
- package/dist/components/Result/Result.js +5 -0
- package/dist/components/ScrollArea/ScrollArea.js +1 -0
- package/dist/components/Segmented/SegmentedCore.js +9 -7
- package/dist/components/Select/Option.js +1 -0
- package/dist/components/Select/OptionGroup.js +1 -0
- package/dist/components/Select/SelectCore.js +11 -8
- package/dist/components/Select/SelectFloating.js +54 -36
- package/dist/components/Sidebar/Sidebar.js +52 -42
- package/dist/components/Signature/Signature.js +101 -91
- package/dist/components/Skeleton/Skeleton.js +1 -0
- package/dist/components/Slider/SliderCore.js +149 -43
- package/dist/components/Sources/Sources.js +31 -21
- package/dist/components/Spinner/Spinner.js +1 -0
- package/dist/components/Stat/Stat.js +7 -0
- package/dist/components/StepTimeline/StepTimeline.js +6 -0
- package/dist/components/Stepper/Step.js +8 -1
- package/dist/components/Stepper/Stepper.js +7 -6
- package/dist/components/StreamingText/StreamingText.js +62 -29
- package/dist/components/SwipeAction/SwipeAction.js +11 -9
- package/dist/components/Switch/SwitchCore.js +9 -5
- package/dist/components/Table/Table.js +2 -0
- package/dist/components/Table/TableBody.js +1 -0
- package/dist/components/Table/TableCell.js +1 -0
- package/dist/components/Table/TableHead.js +1 -0
- package/dist/components/Table/TableRow.js +1 -0
- package/dist/components/Tabs/Tab.js +1 -0
- package/dist/components/Tabs/TabList.js +5 -4
- package/dist/components/Tabs/TabPanel.js +1 -0
- package/dist/components/Tabs/Tabs.js +1 -0
- package/dist/components/Tag/Tag.js +2 -0
- package/dist/components/TagGroup/SortableTagGroup.js +7 -6
- package/dist/components/TagGroup/TagGroup.js +1 -0
- package/dist/components/TagGroup/TagGroupItem.js +3 -0
- package/dist/components/TagInput/SortableTagInputCore.js +13 -10
- package/dist/components/TagInput/TagInputCore.js +17 -12
- package/dist/components/Textarea/TextareaCore.js +1 -0
- package/dist/components/ThinkingIndicator/ThinkingIndicator.js +18 -4
- package/dist/components/TimePicker/TimePicker.js +30 -14
- package/dist/components/TimePicker/TimePickerCore.js +1 -0
- package/dist/components/TimePicker/TimePickerPanel.js +260 -0
- package/dist/components/TimePicker/time-picker-styles.js +7 -0
- package/dist/components/TimePicker/time.js +51 -0
- package/dist/components/Timeline/Timeline.js +14 -1
- package/dist/components/Toast/Toast.js +94 -48
- package/dist/components/Toast/ToastContainer.js +60 -56
- package/dist/components/Toast/ToastContext.js +3 -1
- package/dist/components/Toast/toast2.js +20 -14
- package/dist/components/Toast/useToast.js +36 -11
- package/dist/components/Toggle/ToggleCore.js +1 -0
- package/dist/components/TokenCounter/TokenCounter.js +8 -1
- package/dist/components/ToolCallCard/ToolCallCard.js +18 -2
- package/dist/components/Toolbar/Toolbar.js +9 -8
- package/dist/components/Toolbar/ToolbarButton.js +1 -0
- package/dist/components/Toolbar/ToolbarSeparator.js +1 -0
- package/dist/components/Toolbar/ToolbarToggle.js +1 -0
- package/dist/components/Tooltip/Tooltip.js +46 -42
- package/dist/components/Tour/Tour.js +76 -65
- package/dist/components/Transfer/TransferCore.js +31 -17
- package/dist/components/Tree/SortableTree.js +151 -0
- package/dist/components/Tree/Tree.js +163 -154
- package/dist/components/Tree/TreeItem.js +52 -39
- package/dist/components/Tree/index.js +2 -1
- package/dist/components/Tree/sortable-tree-styles.js +7 -0
- package/dist/components/Tree/sortable-tree-utils.js +36 -0
- package/dist/components/TreeSelect/TreeSelect.js +44 -34
- package/dist/components/Typography/Typography.js +3 -0
- package/dist/components/Upload/Upload.js +12 -11
- package/dist/components/Upload/UploadCore.js +92 -65
- package/dist/components/Upload/UploadList.js +177 -105
- package/dist/components/VirtualList/VirtualList.js +229 -124
- package/dist/components/Watermark/Watermark.js +8 -6
- package/dist/css/accordion.css +1 -1
- package/dist/css/alert.css +1 -1
- package/dist/css/async-section.css +1 -1
- package/dist/css/banner.css +1 -1
- package/dist/css/bottom-sheet.css +1 -1
- package/dist/css/button.css +2 -2
- package/dist/css/calendar.css +1 -1
- package/dist/css/carousel.css +1 -1
- package/dist/css/chat-message.css +1 -1
- package/dist/css/checkbox.css +1 -1
- package/dist/css/color-picker.css +2 -0
- package/dist/css/combobox.css +2 -2
- package/dist/css/context-menu.css +1 -1
- package/dist/css/dialog.css +1 -1
- package/dist/css/drawer.css +1 -1
- package/dist/css/dropdown-menu.css +7 -2
- package/dist/css/form.css +1 -1
- package/dist/css/grid.css +2 -1
- package/dist/css/hover-card.css +1 -1
- package/dist/css/input.css +1 -1
- package/dist/css/menu.css +9 -4
- package/dist/css/pagination.css +1 -1
- package/dist/css/popover.css +1 -1
- package/dist/css/progress.css +1 -1
- package/dist/css/radio.css +1 -1
- package/dist/css/rating.css +1 -1
- package/dist/css/segmented.css +1 -1
- package/dist/css/skeleton.css +1 -1
- package/dist/css/slider.css +1 -1
- package/dist/css/spinner.css +1 -1
- package/dist/css/stepper.css +1 -1
- package/dist/css/streaming-text.css +1 -1
- package/dist/css/switch.css +1 -1
- package/dist/css/tabs.css +1 -1
- package/dist/css/textarea.css +1 -1
- package/dist/css/thinking-indicator.css +1 -1
- package/dist/css/time-picker.css +1 -0
- package/dist/css/toast.css +1 -1
- package/dist/css/toggle.css +1 -1
- package/dist/css/tokens.css +1 -1
- package/dist/css/tooltip.css +1 -1
- package/dist/css/tree.css +2 -1
- package/dist/css/upload.css +1 -1
- package/dist/css/virtual-list.css +1 -1
- package/dist/css-manifest.json +22 -0
- package/dist/dates/adapter.js +13 -0
- package/dist/dates/gregory.js +44 -0
- package/dist/dates/islamic.js +87 -0
- package/dist/dates/registry.js +13 -0
- package/dist/dates/timezone.js +29 -0
- package/dist/design-tokens/cyan-dark.json +355 -0
- package/dist/design-tokens/cyan-light.json +355 -0
- package/dist/design-tokens/orange-dark.json +355 -0
- package/dist/design-tokens/orange-light.json +355 -0
- package/dist/design-tokens/rose-dark.json +355 -0
- package/dist/design-tokens/rose-light.json +355 -0
- package/dist/design-tokens/teal-dark.json +355 -0
- package/dist/design-tokens/teal-light.json +355 -0
- package/dist/design-tokens/violet-dark.json +355 -0
- package/dist/design-tokens/violet-light.json +355 -0
- package/dist/form/FormItem.js +71 -63
- package/dist/form/FormList.js +6 -6
- package/dist/form/form-item-styles.js +7 -0
- package/dist/haze-ui.css +63 -48
- package/dist/index.js +249 -232
- package/dist/mcp-docs.json +1011 -82
- package/dist/registry.json +17 -17
- package/dist/tokens/index.js +7 -7
- package/dist/tokens/motion.js +9 -2
- package/dist/tokens/palette.js +244 -84
- package/dist/tokens/registry.js +18 -22
- package/dist/types/components/Button/Button.d.ts +1 -1
- package/dist/types/components/Calendar/Calendar.d.ts +39 -14
- package/dist/types/components/Calendar/date.d.ts +51 -0
- package/dist/types/components/Calendar/index.d.ts +1 -1
- package/dist/types/components/Carousel/Carousel.d.ts +5 -1
- package/dist/types/components/Carousel/CarouselSlide.d.ts +3 -3
- package/dist/types/components/Chart/Chart.d.ts +13 -6
- package/dist/types/components/Chart/chart-elements.d.ts +27 -6
- package/dist/types/components/ChatMessage/ChatMessage.d.ts +10 -1
- package/dist/types/components/ColorPicker/ColorPicker.d.ts +44 -5
- package/dist/types/components/ColorPicker/ColorPickerPanel.d.ts +28 -0
- package/dist/types/components/ColorPicker/color-math.d.ts +63 -0
- package/dist/types/components/ColorPicker/color-picker-styles.d.ts +50 -0
- package/dist/types/components/ConfigProvider/ConfigContext.d.ts +67 -0
- package/dist/types/components/ConfigProvider/ConfigProvider.d.ts +25 -0
- package/dist/types/components/ConfigProvider/index.d.ts +4 -0
- package/dist/types/components/ConfigProvider/useConfigDefaults.d.ts +28 -0
- package/dist/types/components/Datepicker/Datepicker.d.ts +23 -10
- package/dist/types/components/Datepicker/DatepickerCore.d.ts +40 -10
- package/dist/types/components/Datepicker/datetime.d.ts +33 -11
- package/dist/types/components/DropdownMenu/DropdownMenu.d.ts +12 -2
- package/dist/types/components/DropdownMenu/DropdownMenuCheckboxItem.d.ts +26 -0
- package/dist/types/components/DropdownMenu/DropdownMenuGroup.d.ts +16 -0
- package/dist/types/components/DropdownMenu/DropdownMenuItem.d.ts +7 -1
- package/dist/types/components/DropdownMenu/DropdownMenuRadioGroup.d.ts +21 -0
- package/dist/types/components/DropdownMenu/DropdownMenuRadioItem.d.ts +22 -0
- package/dist/types/components/DropdownMenu/dropdown-menu-item-styles.d.ts +29 -0
- package/dist/types/components/DropdownMenu/index.d.ts +9 -1
- package/dist/types/components/Fullscreen/Fullscreen.d.ts +1 -0
- package/dist/types/components/Grid/Grid.d.ts +8 -1
- package/dist/types/components/Grid/GridItem.d.ts +24 -1
- package/dist/types/components/Grid/grid-item-styles.d.ts +57 -0
- package/dist/types/components/HoverCard/HoverCard.d.ts +1 -1
- package/dist/types/components/LocaleProvider/locale.d.ts +24 -0
- package/dist/types/components/Menu/Menu.d.ts +11 -2
- package/dist/types/components/Menu/MenuCheckboxItem.d.ts +25 -0
- package/dist/types/components/Menu/MenuGroup.d.ts +16 -0
- package/dist/types/components/Menu/MenuItem.d.ts +7 -1
- package/dist/types/components/Menu/MenuRadioGroup.d.ts +20 -0
- package/dist/types/components/Menu/MenuRadioItem.d.ts +22 -0
- package/dist/types/components/Menu/index.d.ts +9 -1
- package/dist/types/components/Menu/menu-item-styles.d.ts +28 -0
- package/dist/types/components/NavigationBar/NavLink.d.ts +1 -1
- package/dist/types/components/Pagination/Pagination.d.ts +17 -3
- package/dist/types/components/Sidebar/Sidebar.d.ts +1 -1
- package/dist/types/components/Slider/Slider.d.ts +24 -2
- package/dist/types/components/Slider/SliderCore.d.ts +41 -3
- package/dist/types/components/StreamingText/StreamingText.d.ts +8 -1
- package/dist/types/components/TimePicker/TimePicker.d.ts +36 -4
- package/dist/types/components/TimePicker/TimePickerPanel.d.ts +26 -0
- package/dist/types/components/TimePicker/index.d.ts +1 -0
- package/dist/types/components/TimePicker/time-picker-styles.d.ts +30 -0
- package/dist/types/components/TimePicker/time.d.ts +49 -0
- package/dist/types/components/Toast/Toast.d.ts +19 -6
- package/dist/types/components/Toast/ToastContainer.d.ts +1 -1
- package/dist/types/components/Toast/ToastContext.d.ts +22 -2
- package/dist/types/components/Toast/index.d.ts +1 -1
- package/dist/types/components/Toast/toast.d.ts +20 -14
- package/dist/types/components/Toast/useToast.d.ts +14 -4
- package/dist/types/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/types/components/Tree/SortableTree.d.ts +38 -0
- package/dist/types/components/Tree/Tree.d.ts +1 -1
- package/dist/types/components/Tree/index.d.ts +2 -0
- package/dist/types/components/Tree/sortable-tree-styles.d.ts +36 -0
- package/dist/types/components/Tree/sortable-tree-utils.d.ts +40 -0
- package/dist/types/components/Upload/Upload.d.ts +17 -10
- package/dist/types/components/Upload/UploadCore.d.ts +26 -12
- package/dist/types/components/Upload/UploadList.d.ts +10 -7
- package/dist/types/components/Upload/index.d.ts +1 -1
- package/dist/types/components/Upload/types.d.ts +33 -7
- package/dist/types/components/VirtualList/VirtualList.d.ts +79 -26
- package/dist/types/components/VirtualList/index.d.ts +1 -1
- package/dist/types/dates/adapter.d.ts +74 -0
- package/dist/types/dates/gregory.d.ts +10 -0
- package/dist/types/dates/index.d.ts +6 -0
- package/dist/types/dates/islamic.d.ts +17 -0
- package/dist/types/dates/registry.d.ts +13 -0
- package/dist/types/dates/timezone.d.ts +36 -0
- package/dist/types/form/FormItem.d.ts +31 -1
- package/dist/types/form/form-item-styles.d.ts +24 -0
- package/dist/types/index.d.ts +19 -11
- package/dist/types/tokens/index.d.ts +4 -2
- package/dist/types/tokens/motion.d.ts +16 -0
- package/dist/types/tokens/palette.d.ts +59 -2
- package/dist/types/utils/menuItems.d.ts +126 -0
- package/dist/types/utils/menuRadio.d.ts +21 -0
- package/dist/utils/floating.js +45 -44
- package/dist/utils/menuItems.js +55 -0
- package/dist/utils/menuKeyboard.js +31 -31
- package/dist/utils/menuRadio.js +28 -0
- package/dist/utils/sortable-shared.js +3 -3
- package/dist/utils/sortable.js +12 -11
- package/package.json +18 -9
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared FormItem skin — the layout classes the component wears, split
|
|
3
|
+
* per layout mode. Living in their own module keeps the component file
|
|
4
|
+
* free of style internals (react-refresh boundary) and lets tests (and
|
|
5
|
+
* consumers composing custom field chrome) reference the exact classes;
|
|
6
|
+
* split-css groups the emitted CSS into `haze-ui/css/form.css` with them.
|
|
7
|
+
*/
|
|
8
|
+
/** vertical (default): label stacked above the control. */
|
|
9
|
+
export declare const item: import("@linaria/core").LinariaClassName;
|
|
10
|
+
/** horizontal: label column left, control column right; the control
|
|
11
|
+
* column carries the error span so rows keep a shared left rail. */
|
|
12
|
+
export declare const itemHorizontal: import("@linaria/core").LinariaClassName;
|
|
13
|
+
/** inline: label + control + error flow on one row; the trailing
|
|
14
|
+
* margin-inline-end separates sibling inline items automatically. */
|
|
15
|
+
export declare const itemInline: import("@linaria/core").LinariaClassName;
|
|
16
|
+
/** horizontal only: the control + error column beside the label. */
|
|
17
|
+
export declare const controlColumn: import("@linaria/core").LinariaClassName;
|
|
18
|
+
export declare const labelText: import("@linaria/core").LinariaClassName;
|
|
19
|
+
/** horizontal only: the label as a fixed column — the width itself is a
|
|
20
|
+
* runtime value (labelWidth) and rides an inline style instead. The
|
|
21
|
+
* block-start padding optically aligns the label's first line with the
|
|
22
|
+
* control's text (InputCore md's vertical padding). */
|
|
23
|
+
export declare const labelColumn: import("@linaria/core").LinariaClassName;
|
|
24
|
+
export declare const errorText: import("@linaria/core").LinariaClassName;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
export { lightTheme, darkTheme } from './tokens/colors';
|
|
2
2
|
export { violetTheme, tealTheme, cyanTheme, orangeTheme, roseTheme } from './tokens/brands';
|
|
3
3
|
export type { BrandTheme } from './tokens/brands';
|
|
4
|
+
export { createBrandTheme, BRAND_FAMILIES, BRAND_SEEDS, buildBrandTheme } from './tokens/palette';
|
|
5
|
+
export type { CreateBrandThemeOptions, BrandThemeCss, BrandSeedOverrides, ScaleSeed } from './tokens/palette';
|
|
4
6
|
export { spacing } from './tokens/spacing';
|
|
5
7
|
export { compact } from './tokens/density';
|
|
6
8
|
export { typography } from './tokens/typography';
|
|
9
|
+
export { motion, motionPresets } from './tokens/motion';
|
|
10
|
+
export type { MotionPreset } from './tokens/motion';
|
|
7
11
|
export { TOKEN_REGISTRY, COMPONENT_TOKENS } from './tokens/registry';
|
|
8
12
|
export type { TokenDef } from './tokens/registry';
|
|
13
|
+
export { gregoryAdapter, islamicUmalquraAdapter, getAdapter, formatInTimeZone, getZonedParts } from './dates';
|
|
14
|
+
export type { HazeDateAdapter, CivilDateParts, HazeCalendarIdentifier, MonthNameStyle, ZonedParts, } from './dates';
|
|
9
15
|
export { Button, ButtonLink, buttonVariants, buttonSizes } from './components/Button';
|
|
10
16
|
export type { ButtonProps, ButtonLinkProps } from './components/Button';
|
|
11
17
|
export { Input, InputCore } from './components/Input';
|
|
@@ -56,14 +62,14 @@ export { Breadcrumb, BreadcrumbItem } from './components/Breadcrumb';
|
|
|
56
62
|
export type { BreadcrumbProps, BreadcrumbItemProps, } from './components/Breadcrumb';
|
|
57
63
|
export { Disclosure } from './components/Disclosure';
|
|
58
64
|
export type { DisclosureProps } from './components/Disclosure';
|
|
59
|
-
export { Menu, MenuItem, MenuDivider, MenuSub, MenuSubTrigger, MenuSubContent } from './components/Menu';
|
|
60
|
-
export type { MenuProps, MenuItemProps, MenuSubProps, MenuSubTriggerProps, MenuSubContentProps } from './components/Menu';
|
|
65
|
+
export { Menu, MenuItem, MenuCheckboxItem, MenuRadioGroup, MenuRadioItem, MenuGroup, MenuDivider, MenuSub, MenuSubTrigger, MenuSubContent } from './components/Menu';
|
|
66
|
+
export type { MenuProps, MenuDataItem, MenuItemProps, MenuCheckboxItemProps, MenuRadioGroupProps, MenuRadioItemProps, MenuGroupProps, MenuSubProps, MenuSubTriggerProps, MenuSubContentProps } from './components/Menu';
|
|
61
67
|
export { NumberInput, NumberInputCore } from './components/NumberInput';
|
|
62
68
|
export type { NumberInputProps, NumberInputCoreProps } from './components/NumberInput';
|
|
63
69
|
export { FileInput } from './components/FileInput';
|
|
64
70
|
export type { FileInputProps } from './components/FileInput';
|
|
65
71
|
export { Toast, ToastContainer, useToast, toast } from './components/Toast';
|
|
66
|
-
export type { ToastProps, ToastContainerProps, ToastOptions, ToastVariant, ToastClassNames } from './components/Toast';
|
|
72
|
+
export type { ToastProps, ToastContainerProps, ToastOptions, ToastVariant, ToastAction, ToastClassNames } from './components/Toast';
|
|
67
73
|
export { List, ListItem } from './components/List';
|
|
68
74
|
export type { ListProps, ListItemProps } from './components/List';
|
|
69
75
|
export { Combobox, ComboboxOption, ComboboxGroup } from './components/Combobox';
|
|
@@ -74,8 +80,8 @@ export { Carousel, CarouselSlide } from './components/Carousel';
|
|
|
74
80
|
export type { CarouselProps, CarouselSlideProps } from './components/Carousel';
|
|
75
81
|
export { Datepicker, DatepickerCore } from './components/Datepicker';
|
|
76
82
|
export type { DatepickerProps, DatepickerCoreProps, DatepickerPreset } from './components/Datepicker';
|
|
77
|
-
export { Tree } from './components/Tree';
|
|
78
|
-
export type { TreeProps, TreeNodeData } from './components/Tree';
|
|
83
|
+
export { Tree, SortableTree } from './components/Tree';
|
|
84
|
+
export type { TreeProps, TreeNodeData, SortableTreeProps, SortableTreeMoveInfo } from './components/Tree';
|
|
79
85
|
export { TreeSelect } from './components/TreeSelect';
|
|
80
86
|
export type { TreeSelectProps } from './components/TreeSelect';
|
|
81
87
|
export { Divider } from './components/Divider';
|
|
@@ -107,7 +113,7 @@ export type { CollapsibleProps, CollapsibleTriggerProps, CollapsibleContentProps
|
|
|
107
113
|
export { Transfer, TransferCore } from './components/Transfer';
|
|
108
114
|
export type { TransferProps, TransferItem, TransferCoreProps } from './components/Transfer';
|
|
109
115
|
export { Upload, UploadCore } from './components/Upload';
|
|
110
|
-
export type { UploadProps, UploadCoreProps, UploadHandle, UploadStatus, UploadFileStatus, UploadRequest, UploadRequestOptions, UploadListItemActions, UploadListItemRender } from './components/Upload';
|
|
116
|
+
export type { UploadProps, UploadCoreProps, UploadHandle, UploadStatus, UploadFile, UploadValueItem, UploadFileStatus, UploadRequest, UploadRequestOptions, UploadListItemActions, UploadListItemRender } from './components/Upload';
|
|
111
117
|
export { ColorPicker, ColorPickerCore } from './components/ColorPicker';
|
|
112
118
|
export type { ColorPickerProps, ColorPickerCoreProps } from './components/ColorPicker';
|
|
113
119
|
export { Rating, RatingCore } from './components/Rating';
|
|
@@ -129,7 +135,7 @@ export type { ChipProps } from './components/Chip';
|
|
|
129
135
|
export { ScrollArea } from './components/ScrollArea';
|
|
130
136
|
export type { ScrollAreaProps } from './components/ScrollArea';
|
|
131
137
|
export { TimePicker, TimePickerCore } from './components/TimePicker';
|
|
132
|
-
export type { TimePickerProps, TimePickerCoreProps } from './components/TimePicker';
|
|
138
|
+
export type { TimePickerProps, TimePickerCoreProps, TimeParts, TimePickerFormat } from './components/TimePicker';
|
|
133
139
|
export { DateRangePicker, DateRangePickerCore } from './components/DateRangePicker';
|
|
134
140
|
export type { DateRangePickerProps, DateRangePickerCoreProps, DateRangePickerPreset, DateRangePickerPresets } from './components/DateRangePicker';
|
|
135
141
|
export { OTPInput, OTPInputCore } from './components/OTPInput';
|
|
@@ -144,8 +150,8 @@ export { PromptInput } from './components/PromptInput';
|
|
|
144
150
|
export type { PromptInputProps } from './components/PromptInput';
|
|
145
151
|
export { InlineEdit } from './components/InlineEdit';
|
|
146
152
|
export type { InlineEditProps } from './components/InlineEdit';
|
|
147
|
-
export { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent } from './components/DropdownMenu';
|
|
148
|
-
export type { DropdownMenuProps, DropdownMenuTriggerProps, DropdownMenuContentProps, DropdownMenuItemProps, DropdownMenuSeparatorProps, DropdownMenuSubProps, DropdownMenuSubTriggerProps, DropdownMenuSubContentProps, DropdownMenuHandle } from './components/DropdownMenu';
|
|
153
|
+
export { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuGroup, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent } from './components/DropdownMenu';
|
|
154
|
+
export type { DropdownMenuProps, DropdownMenuDataItem, DropdownMenuTriggerProps, DropdownMenuContentProps, DropdownMenuItemProps, DropdownMenuCheckboxItemProps, DropdownMenuRadioGroupProps, DropdownMenuRadioItemProps, DropdownMenuGroupProps, DropdownMenuSeparatorProps, DropdownMenuSubProps, DropdownMenuSubTriggerProps, DropdownMenuSubContentProps, DropdownMenuHandle } from './components/DropdownMenu';
|
|
149
155
|
export { ContextMenu, ContextMenuTrigger, ContextMenuContent, ContextMenuItem, ContextMenuSeparator } from './components/ContextMenu';
|
|
150
156
|
export type { ContextMenuProps, ContextMenuTriggerProps, ContextMenuContentProps, ContextMenuItemProps, ContextMenuSeparatorProps } from './components/ContextMenu';
|
|
151
157
|
export { NavigationBar, NavLink } from './components/NavigationBar';
|
|
@@ -165,7 +171,7 @@ export type { CodeBlockProps, Highlighter } from './components/CodeBlock';
|
|
|
165
171
|
export { AspectRatio } from './components/AspectRatio';
|
|
166
172
|
export type { AspectRatioProps } from './components/AspectRatio';
|
|
167
173
|
export { VirtualList } from './components/VirtualList';
|
|
168
|
-
export type { VirtualListProps, VirtualListHandle, VirtualListGroup, VirtualListAlign } from './components/VirtualList';
|
|
174
|
+
export type { VirtualListProps, VirtualListHandle, VirtualListGroup, VirtualListAlign, VirtualListOrientation } from './components/VirtualList';
|
|
169
175
|
export { TagGroup, TagGroupItem, SortableTagGroup } from './components/TagGroup';
|
|
170
176
|
export type { TagGroupProps, TagGroupItemProps, SortableTagGroupProps } from './components/TagGroup';
|
|
171
177
|
export { BottomSheet } from './components/BottomSheet';
|
|
@@ -176,6 +182,8 @@ export { default as LocaleProvider, useStrings } from './components/LocaleProvid
|
|
|
176
182
|
export { defaultStrings, enUS, zhCN, jaJP, deDE, frFR, esES, itIT, ptBR, ruRU, koKR, arSA, createStrings } from './components/LocaleProvider';
|
|
177
183
|
export type { LocaleProviderProps, HazeStrings } from './components/LocaleProvider';
|
|
178
184
|
export type { DeepPartial } from './components/LocaleProvider';
|
|
185
|
+
export { default as ConfigProvider, useConfigDefaults } from './components/ConfigProvider';
|
|
186
|
+
export type { ConfigProviderProps, HazeConfig } from './components/ConfigProvider';
|
|
179
187
|
export { useDirection, getDirection, localeDirection } from './utils/direction';
|
|
180
188
|
export type { Direction } from './utils/direction';
|
|
181
189
|
export { DataTable, dataTableSum, dataTableAvg, dataTableCount, dataTableToCsv } from './components/DataTable';
|
|
@@ -187,7 +195,7 @@ export type { KbdProps } from './components/Kbd';
|
|
|
187
195
|
export { AvatarGroup } from './components/AvatarGroup';
|
|
188
196
|
export type { AvatarGroupProps } from './components/AvatarGroup';
|
|
189
197
|
export { Calendar } from './components/Calendar';
|
|
190
|
-
export type { CalendarProps, CalendarPickerMode } from './components/Calendar';
|
|
198
|
+
export type { CalendarProps, CalendarPickerMode, CalendarCellRender, } from './components/Calendar';
|
|
191
199
|
export { HoverCard } from './components/HoverCard';
|
|
192
200
|
export type { HoverCardProps } from './components/HoverCard';
|
|
193
201
|
export { Toolbar, ToolbarButton, ToolbarSeparator, ToolbarToggle } from './components/Toolbar';
|
|
@@ -2,8 +2,10 @@ export { lightTheme, darkTheme } from './colors';
|
|
|
2
2
|
export { spacing } from './spacing';
|
|
3
3
|
export { compact } from './density';
|
|
4
4
|
export { motion } from './motion';
|
|
5
|
+
export { motionPresets } from './motion';
|
|
6
|
+
export type { MotionPreset } from './motion';
|
|
5
7
|
export { typography } from './typography';
|
|
6
|
-
export { PRIMITIVES, SEMANTIC_COLOR_TOKENS } from './palette';
|
|
7
|
-
export type { Family, Mode, PrimitiveScales, SemanticColorToken } from './palette';
|
|
8
|
+
export { PRIMITIVES, SEMANTIC_COLOR_TOKENS, createBrandTheme } from './palette';
|
|
9
|
+
export type { Family, Mode, PrimitiveScales, SemanticColorToken, ScaleSeed, BrandSeedOverrides, CreateBrandThemeOptions, BrandThemeCss } from './palette';
|
|
8
10
|
export { deltaE, formatOklch, oklchToHex, parseHex, parseOklch, wcagContrast } from './oklch';
|
|
9
11
|
export type { Oklch } from './oklch';
|
|
@@ -1 +1,17 @@
|
|
|
1
1
|
export declare const motion: import("@linaria/core").LinariaClassName;
|
|
2
|
+
export declare const motionPresets: {
|
|
3
|
+
/** Opacity only — the safe default, also the one floating panels use. */
|
|
4
|
+
readonly fade: import("@linaria/core").LinariaClassName;
|
|
5
|
+
/** Fade plus a subtle settle from 97% scale — cards, dialogs, images. */
|
|
6
|
+
readonly fadeScale: import("@linaria/core").LinariaClassName;
|
|
7
|
+
/** Rises into place from just below; sinks back down on exit. */
|
|
8
|
+
readonly slideUp: import("@linaria/core").LinariaClassName;
|
|
9
|
+
/** Descends into place from just above; rises back up on exit. */
|
|
10
|
+
readonly slideDown: import("@linaria/core").LinariaClassName;
|
|
11
|
+
/** Slides in leftward, arriving from just right; exits back right. */
|
|
12
|
+
readonly slideLeft: import("@linaria/core").LinariaClassName;
|
|
13
|
+
/** Slides in rightward, arriving from just left; exits back left. */
|
|
14
|
+
readonly slideRight: import("@linaria/core").LinariaClassName;
|
|
15
|
+
};
|
|
16
|
+
/** Preset names accepted wherever a motion preset can be chosen. */
|
|
17
|
+
export type MotionPreset = keyof typeof motionPresets;
|
|
@@ -25,6 +25,18 @@ export type SemanticColorToken = {
|
|
|
25
25
|
/** Concrete computed value per mode (formula math applied to the aliased base). */
|
|
26
26
|
resolved: Record<Mode, Oklch>;
|
|
27
27
|
};
|
|
28
|
+
type ScaleSeed = Readonly<Record<number, string>>;
|
|
29
|
+
/**
|
|
30
|
+
* Brand preset seeds. Anchors sit near Tailwind's 600/700 steps (light) and
|
|
31
|
+
* one step brighter (dark), mirroring how blue's dark anchors sit one step
|
|
32
|
+
* above their light counterparts. Where a floor could not be cleared at the
|
|
33
|
+
* nearest Tailwind step, the seed is darkened — the same policy as green-9
|
|
34
|
+
* (#16a34a → #15803d): teal/cyan/orange light anchors move a full step to
|
|
35
|
+
* 700 for white-on-primary 4.5:1, and rose-600 is nudged ΔE 0.011 darker so
|
|
36
|
+
* primary-on-primary-subtle clears the 4.0 ratchet. Anchored steps 9/10
|
|
37
|
+
* (light) and 8/9 (dark) match the primary/info STATUS_STEP slots.
|
|
38
|
+
*/
|
|
39
|
+
declare const BRAND_SEEDS: Record<BrandFamily, Record<Mode, ScaleSeed>>;
|
|
28
40
|
declare const PRIMITIVES: PrimitiveScales;
|
|
29
41
|
/**
|
|
30
42
|
* Primitive scales for one theme: family name → 12 formatted steps, per
|
|
@@ -61,5 +73,50 @@ declare function buildBrandTheme(family: BrandFamily): BrandThemeDef;
|
|
|
61
73
|
declare function themeDeclarations(mode: Mode, scales: ThemeScales, semanticTokens: readonly SemanticColorToken[]): string;
|
|
62
74
|
/** Class-ready declarations for one brand preset theme — what brands.ts interpolates. */
|
|
63
75
|
declare function brandDeclarations(family: BrandFamily, mode: Mode): string;
|
|
64
|
-
export
|
|
65
|
-
|
|
76
|
+
export type BrandSeedOverrides = {
|
|
77
|
+
/** Extra light-mode anchors merged over the derived ones, e.g. `{10: '#6d28d9'}`. */
|
|
78
|
+
light?: ScaleSeed;
|
|
79
|
+
/** Extra dark-mode anchors merged over the derived ones, e.g. `{8: '#9b76fa'}`. */
|
|
80
|
+
dark?: ScaleSeed;
|
|
81
|
+
};
|
|
82
|
+
export type CreateBrandThemeOptions = {
|
|
83
|
+
/**
|
|
84
|
+
* Brand family name — becomes the primitive scale's custom-property
|
|
85
|
+
* prefix (`--haze-{name}-1…12`). Lowercase kebab (`brand`, `acme-corp`).
|
|
86
|
+
* A preset name ('violet' … 'rose') reproduces that preset's slots;
|
|
87
|
+
* 'blue' re-seeds the default theme's own scale.
|
|
88
|
+
*/
|
|
89
|
+
name: string;
|
|
90
|
+
/** Light-mode primary seed (hex) — anchors scale step 9. */
|
|
91
|
+
light: string;
|
|
92
|
+
/**
|
|
93
|
+
* Dark-mode primary seed (hex) — anchors dark step 9. Omit to derive it
|
|
94
|
+
* from `light` via the family lightness relationship (see
|
|
95
|
+
* DERIVED_SEED_OFFSETS).
|
|
96
|
+
*/
|
|
97
|
+
dark?: string;
|
|
98
|
+
/** Explicit anchors merged over the derived seeds — same slots the presets pin. */
|
|
99
|
+
overrides?: BrandSeedOverrides;
|
|
100
|
+
};
|
|
101
|
+
/** Runtime-built brand theme: class-ready declaration blocks per mode (see brands.ts for the preset shape). */
|
|
102
|
+
export type BrandThemeCss = {
|
|
103
|
+
name: string;
|
|
104
|
+
light: string;
|
|
105
|
+
dark: string;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Build a complete custom brand theme at runtime from one or two seed hexes
|
|
109
|
+
* — the same pipeline the build-time presets go through (primitive scales,
|
|
110
|
+
* semantic rerouting of primary/info to the brand family, relative-color
|
|
111
|
+
* interaction states), so the output is byte-compatible with
|
|
112
|
+
* `brandDeclarations()` given equivalent seeds.
|
|
113
|
+
*
|
|
114
|
+
* The returned blocks are bare custom-property declarations (no selector):
|
|
115
|
+
* hand them to a `<style>` tag or a Linaria `css` template as
|
|
116
|
+
* `.my-brand-light { … }` / `.my-brand-dark { … }` classes, exactly like the
|
|
117
|
+
* preset theme classes. As with the presets, the blocks are complete theme
|
|
118
|
+
* REPLACEMENTS for lightTheme/darkTheme — never stack them on top.
|
|
119
|
+
*/
|
|
120
|
+
declare function createBrandTheme({ name, light, dark, overrides }: CreateBrandThemeOptions): BrandThemeCss;
|
|
121
|
+
export { PRIMITIVES, SEMANTIC_COLOR_TOKENS, BRAND_FAMILIES, BRAND_SEEDS, buildBrandTheme, brandDeclarations, themeDeclarations, createBrandTheme };
|
|
122
|
+
export type { ThemeScales, ScaleSeed };
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import type { ComponentType, Key, ReactNode } from 'react';
|
|
2
|
+
import type { ControlOrValue } from 'react-use-control';
|
|
3
|
+
/**
|
|
4
|
+
* Data-driven menu description shared by the Menu and DropdownMenu
|
|
5
|
+
* families: an `items` array replaces composed children on the root.
|
|
6
|
+
* The renderer is family-agnostic — each root passes its own component
|
|
7
|
+
* record, so the two families keep their independent skins.
|
|
8
|
+
*/
|
|
9
|
+
export type MenuDataItem = {
|
|
10
|
+
type: 'item';
|
|
11
|
+
label: ReactNode;
|
|
12
|
+
onSelect?: () => void;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
danger?: boolean;
|
|
15
|
+
icon?: ReactNode;
|
|
16
|
+
kbdLabel?: ReactNode;
|
|
17
|
+
/** Stable React key; the array index is used when omitted. */
|
|
18
|
+
key?: Key;
|
|
19
|
+
} | {
|
|
20
|
+
type: 'checkbox';
|
|
21
|
+
label: ReactNode;
|
|
22
|
+
checked?: ControlOrValue<boolean>;
|
|
23
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
danger?: boolean;
|
|
26
|
+
icon?: ReactNode;
|
|
27
|
+
kbdLabel?: ReactNode;
|
|
28
|
+
key?: Key;
|
|
29
|
+
} | {
|
|
30
|
+
type: 'radio';
|
|
31
|
+
/** Value this option selects in its group. */
|
|
32
|
+
value: string;
|
|
33
|
+
label: ReactNode;
|
|
34
|
+
disabled?: boolean;
|
|
35
|
+
danger?: boolean;
|
|
36
|
+
icon?: ReactNode;
|
|
37
|
+
kbdLabel?: ReactNode;
|
|
38
|
+
key?: Key;
|
|
39
|
+
} | {
|
|
40
|
+
type: 'group';
|
|
41
|
+
/** Non-interactive heading above the group's items. */
|
|
42
|
+
label?: ReactNode;
|
|
43
|
+
/**
|
|
44
|
+
* When set, the group is a radio group bound to this value —
|
|
45
|
+
* its `radio` children become one single-select cluster.
|
|
46
|
+
*/
|
|
47
|
+
value?: ControlOrValue<string>;
|
|
48
|
+
onValueChange?: (value: string) => void;
|
|
49
|
+
children: MenuDataItem[];
|
|
50
|
+
key?: Key;
|
|
51
|
+
} | {
|
|
52
|
+
type: 'divider';
|
|
53
|
+
key?: Key;
|
|
54
|
+
} | {
|
|
55
|
+
type: 'sub';
|
|
56
|
+
label: ReactNode;
|
|
57
|
+
children: MenuDataItem[];
|
|
58
|
+
disabled?: boolean;
|
|
59
|
+
key?: Key;
|
|
60
|
+
};
|
|
61
|
+
/** The family's components the renderer composes `items` from. */
|
|
62
|
+
type MenuDataFamily = {
|
|
63
|
+
Item: ComponentType<{
|
|
64
|
+
children: ReactNode;
|
|
65
|
+
onSelect?: () => void;
|
|
66
|
+
disabled?: boolean;
|
|
67
|
+
danger?: boolean;
|
|
68
|
+
icon?: ReactNode;
|
|
69
|
+
kbdLabel?: ReactNode;
|
|
70
|
+
className?: string;
|
|
71
|
+
}>;
|
|
72
|
+
CheckboxItem: ComponentType<{
|
|
73
|
+
children: ReactNode;
|
|
74
|
+
checked?: ControlOrValue<boolean>;
|
|
75
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
76
|
+
disabled?: boolean;
|
|
77
|
+
danger?: boolean;
|
|
78
|
+
icon?: ReactNode;
|
|
79
|
+
kbdLabel?: ReactNode;
|
|
80
|
+
className?: string;
|
|
81
|
+
}>;
|
|
82
|
+
RadioGroup: ComponentType<{
|
|
83
|
+
children: ReactNode;
|
|
84
|
+
value?: ControlOrValue<string>;
|
|
85
|
+
onValueChange?: (value: string) => void;
|
|
86
|
+
label?: ReactNode;
|
|
87
|
+
className?: string;
|
|
88
|
+
}>;
|
|
89
|
+
RadioItem: ComponentType<{
|
|
90
|
+
children: ReactNode;
|
|
91
|
+
value: string;
|
|
92
|
+
disabled?: boolean;
|
|
93
|
+
danger?: boolean;
|
|
94
|
+
icon?: ReactNode;
|
|
95
|
+
kbdLabel?: ReactNode;
|
|
96
|
+
className?: string;
|
|
97
|
+
}>;
|
|
98
|
+
Group: ComponentType<{
|
|
99
|
+
label: ReactNode;
|
|
100
|
+
children: ReactNode;
|
|
101
|
+
className?: string;
|
|
102
|
+
}>;
|
|
103
|
+
Divider: ComponentType<{
|
|
104
|
+
className?: string;
|
|
105
|
+
}>;
|
|
106
|
+
Sub: ComponentType<{
|
|
107
|
+
children: ReactNode;
|
|
108
|
+
className?: string;
|
|
109
|
+
}>;
|
|
110
|
+
SubTrigger: ComponentType<{
|
|
111
|
+
children: ReactNode;
|
|
112
|
+
disabled?: boolean;
|
|
113
|
+
className?: string;
|
|
114
|
+
}>;
|
|
115
|
+
SubContent: ComponentType<{
|
|
116
|
+
children: ReactNode;
|
|
117
|
+
className?: string;
|
|
118
|
+
}>;
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Renders a `MenuDataItem[]` through a family's components. Recursion:
|
|
122
|
+
* `group` and `sub` render their `children` through the same walk, so
|
|
123
|
+
* nested submenus compose to any depth.
|
|
124
|
+
*/
|
|
125
|
+
export declare function renderMenuDataItems(items: MenuDataItem[], family: MenuDataFamily): ReactNode;
|
|
126
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ControlOrValue } from 'react-use-control';
|
|
2
|
+
/**
|
|
3
|
+
* Radio-group state shared by the Menu and DropdownMenu families
|
|
4
|
+
* (the same seam as utils/submenu): the group owns the single selected
|
|
5
|
+
* value through `useControl`, the items read it and request changes.
|
|
6
|
+
*/
|
|
7
|
+
type MenuRadioGroupState = {
|
|
8
|
+
/** Currently selected value ('' = nothing selected). */
|
|
9
|
+
value: string;
|
|
10
|
+
/** Selects `next`; a no-op (no event) when already selected. */
|
|
11
|
+
select: (next: string) => void;
|
|
12
|
+
};
|
|
13
|
+
export declare const MenuRadioGroupProvider: import("react").Provider<MenuRadioGroupState | undefined>;
|
|
14
|
+
/** Group-side state: controllable `value` + change notification. */
|
|
15
|
+
export declare function useMenuRadioGroup(value: ControlOrValue<string> | undefined, onValueChange?: (value: string) => void): MenuRadioGroupState;
|
|
16
|
+
/** Item-side state: whether this item is the selected one, plus select. */
|
|
17
|
+
export declare function useMenuRadioItem(itemValue: string): {
|
|
18
|
+
checked: boolean;
|
|
19
|
+
select: () => void;
|
|
20
|
+
};
|
|
21
|
+
export {};
|
package/dist/utils/floating.js
CHANGED
|
@@ -5,8 +5,8 @@ import { getDirection as t } from "./direction.js";
|
|
|
5
5
|
import { computeFloatingPosition as n, mirrorPlacement as r, resolvePadding as i } from "./collision.js";
|
|
6
6
|
import { whenExitSettles as a } from "./presence.js";
|
|
7
7
|
/* empty css */
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { useCallback as o, useEffect as s, useId as c, useRef as l, useState as u } from "react";
|
|
9
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
10
10
|
//#region src/lib/utils/floating.tsx
|
|
11
11
|
var f = 500;
|
|
12
12
|
function p() {
|
|
@@ -52,47 +52,47 @@ var F = "haze-floating__fallbackBottom", I = F, L = "haze-floating__fallbackBott
|
|
|
52
52
|
left: W,
|
|
53
53
|
right: G
|
|
54
54
|
};
|
|
55
|
-
function te({ open: e, setOpen: n, triggerRef: r, panelRef: i, animated:
|
|
56
|
-
let y = `--haze-floating-${
|
|
55
|
+
function te({ open: e, setOpen: n, triggerRef: r, panelRef: i, animated: d, collision: v }) {
|
|
56
|
+
let y = `--haze-floating-${c().replace(/[^a-zA-Z0-9]/g, "")}`, b = p(), x = m(), [S, C] = u(!e), [w, T] = u(e);
|
|
57
57
|
e !== w && (T(e), e && C(!1));
|
|
58
|
-
let E =
|
|
59
|
-
|
|
58
|
+
let E = l(!1), [D, O] = u(!1), k = l(null), A = l(-Infinity), j = l(-Infinity), M = l(null);
|
|
59
|
+
s(() => {
|
|
60
60
|
let t = i.current;
|
|
61
61
|
if (!t || !b) return;
|
|
62
62
|
t !== k.current && (k.current = t, E.current = !1, O(!1));
|
|
63
|
-
let r = !0,
|
|
63
|
+
let r = !0, o = () => {
|
|
64
64
|
M.current = { el: t }, t.hidePopover();
|
|
65
|
-
},
|
|
65
|
+
}, s = () => {
|
|
66
66
|
if (E.current && t === i.current) {
|
|
67
|
-
if (
|
|
67
|
+
if (d) {
|
|
68
68
|
let e = () => {
|
|
69
|
-
r && E.current && t === i.current &&
|
|
69
|
+
r && E.current && t === i.current && o();
|
|
70
70
|
}, n = a(t);
|
|
71
71
|
n ? n.then(e) : e();
|
|
72
|
-
} else
|
|
72
|
+
} else o();
|
|
73
73
|
}
|
|
74
|
-
},
|
|
74
|
+
}, c = (r) => {
|
|
75
75
|
let i = r.newState;
|
|
76
76
|
if (E.current = i === "open", O(E.current), i === "closed") {
|
|
77
|
-
|
|
77
|
+
d && C(!0);
|
|
78
78
|
let r = M.current?.el === t;
|
|
79
79
|
if (M.current = null, r) {
|
|
80
80
|
e && t.showPopover();
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
83
|
e && (performance.now() - A.current < f && (j.current = performance.now()), A.current = -Infinity, n(!1));
|
|
84
|
-
} else e ||
|
|
84
|
+
} else e || s();
|
|
85
85
|
};
|
|
86
|
-
return t.addEventListener("toggle",
|
|
87
|
-
r = !1, t.removeEventListener("toggle",
|
|
86
|
+
return t.addEventListener("toggle", c), e ? E.current || t.showPopover() : s(), () => {
|
|
87
|
+
r = !1, t.removeEventListener("toggle", c);
|
|
88
88
|
};
|
|
89
89
|
}, [
|
|
90
90
|
b,
|
|
91
91
|
e,
|
|
92
92
|
n,
|
|
93
93
|
i,
|
|
94
|
-
|
|
95
|
-
]),
|
|
94
|
+
d
|
|
95
|
+
]), s(() => {
|
|
96
96
|
if (b || !e) return;
|
|
97
97
|
let t = (e) => e instanceof Node && !!(r.current?.contains(e) || i.current?.contains(e)), a = (e) => {
|
|
98
98
|
t(e.target) || n(!1);
|
|
@@ -108,31 +108,31 @@ function te({ open: e, setOpen: n, triggerRef: r, panelRef: i, animated: o, coll
|
|
|
108
108
|
n,
|
|
109
109
|
r,
|
|
110
110
|
i
|
|
111
|
-
]),
|
|
112
|
-
if (b || !
|
|
113
|
-
let t = !0, n = i.current, r = n ? a(n) : null,
|
|
111
|
+
]), s(() => {
|
|
112
|
+
if (b || !d || e || S) return;
|
|
113
|
+
let t = !0, n = i.current, r = n ? a(n) : null, o = () => {
|
|
114
114
|
t && C(!0);
|
|
115
115
|
};
|
|
116
|
-
return r ? r.then(
|
|
116
|
+
return r ? r.then(o) : o(), () => {
|
|
117
117
|
t = !1;
|
|
118
118
|
};
|
|
119
119
|
}, [
|
|
120
120
|
b,
|
|
121
|
-
|
|
121
|
+
d,
|
|
122
122
|
e,
|
|
123
123
|
S,
|
|
124
124
|
i
|
|
125
125
|
]);
|
|
126
|
-
let N =
|
|
126
|
+
let N = o(() => {
|
|
127
127
|
e && (A.current = performance.now());
|
|
128
|
-
}, [e]), P =
|
|
128
|
+
}, [e]), P = o(() => {
|
|
129
129
|
if (performance.now() - j.current < f) {
|
|
130
130
|
j.current = -Infinity;
|
|
131
131
|
return;
|
|
132
132
|
}
|
|
133
133
|
n((e) => !e);
|
|
134
|
-
}, [n]), [F, I] =
|
|
135
|
-
return
|
|
134
|
+
}, [n]), [F, I] = u("ltr");
|
|
135
|
+
return s(() => {
|
|
136
136
|
let e = t(r.current);
|
|
137
137
|
I((t) => t === e ? t : e);
|
|
138
138
|
}, [r, e]), {
|
|
@@ -140,8 +140,8 @@ function te({ open: e, setOpen: n, triggerRef: r, panelRef: i, animated: o, coll
|
|
|
140
140
|
native: b,
|
|
141
141
|
anchored: x,
|
|
142
142
|
shown: b ? D : e,
|
|
143
|
-
dataState:
|
|
144
|
-
exited:
|
|
143
|
+
dataState: d ? e ? "open" : "closed" : void 0,
|
|
144
|
+
exited: d ? S : !e,
|
|
145
145
|
collision: v,
|
|
146
146
|
direction: F,
|
|
147
147
|
anchorName: y,
|
|
@@ -156,8 +156,8 @@ function te({ open: e, setOpen: n, triggerRef: r, panelRef: i, animated: o, coll
|
|
|
156
156
|
b && h,
|
|
157
157
|
b && x && g,
|
|
158
158
|
b && !x && _,
|
|
159
|
-
!b && !e && (!
|
|
160
|
-
!!
|
|
159
|
+
!b && !e && (!d || S) && "haze-floating__floatingHidden",
|
|
160
|
+
!!d && "haze-floating__floatingAnimated"
|
|
161
161
|
],
|
|
162
162
|
triggerRef: r,
|
|
163
163
|
panelRef: i
|
|
@@ -205,8 +205,8 @@ function Q(e, r, a, o) {
|
|
|
205
205
|
e.style.top = `${d}px`, e.style.left = `${f}px`;
|
|
206
206
|
}
|
|
207
207
|
function $({ behavior: e, placement: t, collision: n }) {
|
|
208
|
-
let { native: r, anchored: a, shown: o, triggerRef:
|
|
209
|
-
|
|
208
|
+
let { native: r, anchored: a, shown: o, triggerRef: c, panelRef: l } = e;
|
|
209
|
+
s(() => {
|
|
210
210
|
if (!r || t === "point" || !o) return;
|
|
211
211
|
let e = l.current;
|
|
212
212
|
if (!e) return;
|
|
@@ -223,9 +223,9 @@ function $({ behavior: e, placement: t, collision: n }) {
|
|
|
223
223
|
window.removeEventListener("scroll", s, !0), window.removeEventListener("resize", s), e.style.translate = "";
|
|
224
224
|
};
|
|
225
225
|
}
|
|
226
|
-
let
|
|
227
|
-
if (!
|
|
228
|
-
let u = () => Q(e,
|
|
226
|
+
let s = c.current;
|
|
227
|
+
if (!s) return;
|
|
228
|
+
let u = () => Q(e, s, t, n);
|
|
229
229
|
return u(), window.addEventListener("scroll", u, !0), window.addEventListener("resize", u), () => {
|
|
230
230
|
window.removeEventListener("scroll", u, !0), window.removeEventListener("resize", u);
|
|
231
231
|
};
|
|
@@ -235,32 +235,33 @@ function $({ behavior: e, placement: t, collision: n }) {
|
|
|
235
235
|
o,
|
|
236
236
|
t,
|
|
237
237
|
n,
|
|
238
|
-
|
|
238
|
+
c,
|
|
239
239
|
l
|
|
240
240
|
]);
|
|
241
241
|
}
|
|
242
|
-
function ne({ behavior: t, placement: n, collision: r, visualClass: i, className: a, style:
|
|
242
|
+
function ne({ behavior: t, placement: n, collision: r, visualClass: i, className: a, style: o, children: s, ...c }) {
|
|
243
243
|
$({
|
|
244
244
|
behavior: t,
|
|
245
245
|
placement: n ?? "point",
|
|
246
246
|
collision: r ?? t.collision
|
|
247
247
|
});
|
|
248
|
-
let
|
|
248
|
+
let l = t.panelAttrs.style || o ? {
|
|
249
249
|
...t.panelAttrs.style,
|
|
250
|
-
...
|
|
250
|
+
...o
|
|
251
251
|
} : void 0;
|
|
252
|
-
return /* @__PURE__ */
|
|
252
|
+
return /* @__PURE__ */ d("div", {
|
|
253
|
+
"data-slot": "content",
|
|
253
254
|
...t.dataState !== void 0 && { "data-state": t.dataState },
|
|
254
|
-
...
|
|
255
|
+
...c,
|
|
255
256
|
...t.panelAttrs,
|
|
256
|
-
style:
|
|
257
|
+
style: l,
|
|
257
258
|
className: e([
|
|
258
259
|
i,
|
|
259
260
|
...t.panelClasses,
|
|
260
261
|
...n ? Y(t, n, t.direction) : [],
|
|
261
262
|
a
|
|
262
263
|
]),
|
|
263
|
-
children:
|
|
264
|
+
children: s
|
|
264
265
|
});
|
|
265
266
|
}
|
|
266
267
|
//#endregion
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment as e } from "react";
|
|
3
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
4
|
+
//#region src/lib/utils/menuItems.tsx
|
|
5
|
+
function r(i, a) {
|
|
6
|
+
return i.map((i, o) => {
|
|
7
|
+
let s = i.key ?? o;
|
|
8
|
+
switch (i.type) {
|
|
9
|
+
case "divider": return /* @__PURE__ */ t(a.Divider, {}, s);
|
|
10
|
+
case "item": return /* @__PURE__ */ t(a.Item, {
|
|
11
|
+
onSelect: i.onSelect,
|
|
12
|
+
disabled: i.disabled,
|
|
13
|
+
danger: i.danger,
|
|
14
|
+
icon: i.icon,
|
|
15
|
+
kbdLabel: i.kbdLabel,
|
|
16
|
+
children: i.label
|
|
17
|
+
}, s);
|
|
18
|
+
case "checkbox": return /* @__PURE__ */ t(a.CheckboxItem, {
|
|
19
|
+
checked: i.checked,
|
|
20
|
+
onCheckedChange: i.onCheckedChange,
|
|
21
|
+
disabled: i.disabled,
|
|
22
|
+
danger: i.danger,
|
|
23
|
+
icon: i.icon,
|
|
24
|
+
kbdLabel: i.kbdLabel,
|
|
25
|
+
children: i.label
|
|
26
|
+
}, s);
|
|
27
|
+
case "radio": return /* @__PURE__ */ t(a.RadioItem, {
|
|
28
|
+
value: i.value,
|
|
29
|
+
disabled: i.disabled,
|
|
30
|
+
danger: i.danger,
|
|
31
|
+
icon: i.icon,
|
|
32
|
+
kbdLabel: i.kbdLabel,
|
|
33
|
+
children: i.label
|
|
34
|
+
}, s);
|
|
35
|
+
case "group": {
|
|
36
|
+
let n = i.value === void 0 ? i.label === void 0 ? r(i.children, a) : /* @__PURE__ */ t(a.Group, {
|
|
37
|
+
label: i.label,
|
|
38
|
+
children: r(i.children, a)
|
|
39
|
+
}) : /* @__PURE__ */ t(a.RadioGroup, {
|
|
40
|
+
value: i.value,
|
|
41
|
+
onValueChange: i.onValueChange,
|
|
42
|
+
label: i.label,
|
|
43
|
+
children: r(i.children, a)
|
|
44
|
+
});
|
|
45
|
+
return /* @__PURE__ */ t(e, { children: n }, s);
|
|
46
|
+
}
|
|
47
|
+
case "sub": return /* @__PURE__ */ n(a.Sub, { children: [/* @__PURE__ */ t(a.SubTrigger, {
|
|
48
|
+
disabled: i.disabled,
|
|
49
|
+
children: i.label
|
|
50
|
+
}), /* @__PURE__ */ t(a.SubContent, { children: r(i.children, a) })] }, s);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
export { r as renderMenuDataItems };
|