@lobehub/ui 4.33.3 → 4.34.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 +3 -3
- package/es/A/index.mjs.map +1 -1
- package/es/Accordion/Accordion.d.mts +2 -2
- package/es/Accordion/Accordion.mjs +3 -3
- package/es/Accordion/Accordion.mjs.map +1 -1
- package/es/Accordion/AccordionItem.d.mts +2 -2
- package/es/Accordion/AccordionItem.mjs +15 -15
- package/es/Accordion/AccordionItem.mjs.map +1 -1
- package/es/Accordion/context.mjs +2 -2
- package/es/Accordion/context.mjs.map +1 -1
- package/es/ActionIcon/ActionIcon.d.mts +2 -2
- package/es/ActionIcon/ActionIcon.mjs +2 -2
- package/es/ActionIcon/ActionIcon.mjs.map +1 -1
- package/es/ActionIcon/style.mjs.map +1 -1
- package/es/ActionIconGroup/ActionIconGroup.mjs +3 -3
- package/es/ActionIconGroup/ActionIconGroup.mjs.map +1 -1
- package/es/ActionIconGroup/style.mjs.map +1 -1
- package/es/Alert/Alert.d.mts +2 -2
- package/es/Alert/Alert.mjs +6 -6
- package/es/Alert/Alert.mjs.map +1 -1
- package/es/Alert/style.mjs.map +1 -1
- package/es/AutoComplete/Select.d.mts +2 -2
- package/es/AutoComplete/Select.mjs +1 -1
- package/es/AutoComplete/Select.mjs.map +1 -1
- package/es/AutoComplete/style.mjs.map +1 -1
- package/es/Avatar/Avatar.mjs +4 -4
- package/es/Avatar/Avatar.mjs.map +1 -1
- package/es/Avatar/AvatarGroup/index.d.mts +2 -2
- package/es/Avatar/AvatarGroup/index.mjs +5 -5
- package/es/Avatar/AvatarGroup/index.mjs.map +1 -1
- package/es/Avatar/index.mjs.map +1 -1
- package/es/Avatar/style.mjs.map +1 -1
- package/es/Avatar/utils.mjs.map +1 -1
- package/es/Block/style.mjs.map +1 -1
- package/es/Burger/Burger.d.mts +2 -2
- package/es/Burger/Burger.mjs +2 -2
- package/es/Burger/Burger.mjs.map +1 -1
- package/es/Burger/type.d.mts +1 -1
- package/es/Button/Button.mjs +7 -7
- package/es/Button/Button.mjs.map +1 -1
- package/es/Button/style.mjs.map +1 -1
- package/es/Checkbox/Checkbox.mjs +8 -8
- package/es/Checkbox/Checkbox.mjs.map +1 -1
- package/es/Checkbox/CheckboxGroup.mjs +4 -4
- package/es/Checkbox/CheckboxGroup.mjs.map +1 -1
- package/es/Checkbox/index.mjs.map +1 -1
- package/es/CodeDiff/CodeDiff.d.mts +2 -2
- package/es/CodeDiff/CodeDiff.mjs +3 -3
- package/es/CodeDiff/CodeDiff.mjs.map +1 -1
- package/es/CodeDiff/PatchDiff.d.mts +2 -2
- package/es/CodeDiff/PatchDiff.mjs +3 -3
- package/es/CodeDiff/PatchDiff.mjs.map +1 -1
- package/es/CodeDiff/style.mjs.map +1 -1
- package/es/CodeEditor/CodeEditor.d.mts +2 -2
- package/es/CodeEditor/CodeEditor.mjs +5 -5
- package/es/CodeEditor/CodeEditor.mjs.map +1 -1
- package/es/CodeEditor/style.mjs.map +1 -1
- package/es/Collapse/Collapse.d.mts +2 -2
- package/es/Collapse/Collapse.mjs +5 -5
- package/es/Collapse/Collapse.mjs.map +1 -1
- package/es/Collapse/style.mjs.map +1 -1
- package/es/ColorSwatches/ColorSwatches.mjs +11 -11
- package/es/ColorSwatches/ColorSwatches.mjs.map +1 -1
- package/es/ConfigProvider/index.d.mts +3 -3
- package/es/ConfigProvider/index.mjs.map +1 -1
- package/es/ContextMenu/ContextMenuHost.d.mts +3 -3
- package/es/ContextMenu/ContextMenuHost.mjs +10 -3
- package/es/ContextMenu/ContextMenuHost.mjs.map +1 -1
- package/es/ContextMenu/ContextMenuTrigger.mjs.map +1 -1
- package/es/ContextMenu/renderItems.d.mts +1 -1
- package/es/ContextMenu/renderItems.mjs +39 -14
- package/es/ContextMenu/renderItems.mjs.map +1 -1
- package/es/ContextMenu/store.d.mts +3 -1
- package/es/ContextMenu/store.mjs +1 -0
- package/es/ContextMenu/store.mjs.map +1 -1
- package/es/CopyButton/CopyButton.d.mts +2 -2
- package/es/DatePicker/DatePicker.d.mts +2 -2
- package/es/DatePicker/DatePicker.mjs +1 -1
- package/es/DatePicker/DatePicker.mjs.map +1 -1
- package/es/DatePicker/style.mjs.map +1 -1
- package/es/DraggablePanel/DraggablePanel.mjs +9 -9
- package/es/DraggablePanel/DraggablePanel.mjs.map +1 -1
- package/es/DraggablePanel/components/DraggablePanelBody.d.mts +2 -2
- package/es/DraggablePanel/components/DraggablePanelContainer.d.mts +2 -2
- package/es/DraggablePanel/components/DraggablePanelFooter.d.mts +2 -2
- package/es/DraggablePanel/components/DraggablePanelFooter.mjs +1 -1
- package/es/DraggablePanel/components/DraggablePanelFooter.mjs.map +1 -1
- package/es/DraggablePanel/components/DraggablePanelHeader.d.mts +2 -2
- package/es/DraggablePanel/components/DraggablePanelHeader.mjs +7 -7
- package/es/DraggablePanel/components/DraggablePanelHeader.mjs.map +1 -1
- package/es/DraggablePanel/index.mjs +1 -1
- package/es/DraggablePanel/index.mjs.map +1 -1
- package/es/DraggablePanel/style.mjs.map +1 -1
- package/es/DraggableSideNav/DraggableSideNav.d.mts +2 -2
- package/es/DraggableSideNav/DraggableSideNav.mjs +5 -5
- package/es/DraggableSideNav/DraggableSideNav.mjs.map +1 -1
- package/es/Drawer/Drawer.d.mts +2 -2
- package/es/Drawer/Drawer.mjs +5 -5
- package/es/Drawer/Drawer.mjs.map +1 -1
- package/es/Dropdown/Dropdown.d.mts +2 -2
- package/es/DropdownMenu/DropdownMenu.d.mts +2 -2
- package/es/DropdownMenu/DropdownMenu.mjs +7 -3
- package/es/DropdownMenu/DropdownMenu.mjs.map +1 -1
- package/es/DropdownMenu/atoms.d.mts +33 -17
- package/es/DropdownMenu/atoms.mjs +20 -6
- package/es/DropdownMenu/atoms.mjs.map +1 -1
- package/es/DropdownMenu/index.d.mts +2 -2
- package/es/DropdownMenu/index.mjs +2 -2
- package/es/DropdownMenu/renderItems.d.mts +1 -1
- package/es/DropdownMenu/renderItems.mjs +36 -14
- package/es/DropdownMenu/renderItems.mjs.map +1 -1
- package/es/DropdownMenu/type.d.mts +8 -1
- package/es/EditableText/ControlInput.mjs +29 -29
- package/es/EditableText/ControlInput.mjs.map +1 -1
- package/es/EditableText/EditableText.d.mts +2 -2
- package/es/EditableText/EditableText.mjs +16 -16
- package/es/EditableText/EditableText.mjs.map +1 -1
- package/es/EditorSlashMenu/EditorSlashMenu.mjs +2 -2
- package/es/EditorSlashMenu/EditorSlashMenu.mjs.map +1 -1
- package/es/EditorSlashMenu/MenuItemRenderer.mjs +1 -1
- package/es/EditorSlashMenu/MenuItemRenderer.mjs.map +1 -1
- package/es/EditorSlashMenu/atoms.d.mts +22 -13
- package/es/EditorSlashMenu/atoms.mjs +3 -4
- package/es/EditorSlashMenu/atoms.mjs.map +1 -1
- package/es/EmojiPicker/AvatarUploader.mjs +5 -5
- package/es/EmojiPicker/AvatarUploader.mjs.map +1 -1
- package/es/EmojiPicker/EmojiPicker.d.mts +2 -2
- package/es/EmojiPicker/EmojiPicker.mjs +23 -23
- package/es/EmojiPicker/EmojiPicker.mjs.map +1 -1
- package/es/Empty/Empty.mjs +2 -2
- package/es/Empty/Empty.mjs.map +1 -1
- package/es/FileTypeIcon/components/FileIcon.mjs.map +1 -1
- package/es/FileTypeIcon/components/FolderIcon.mjs.map +1 -1
- package/es/Flex/FlexBasic.d.mts +2 -2
- package/es/FluentEmoji/FluentEmoji.mjs +1 -1
- package/es/FluentEmoji/FluentEmoji.mjs.map +1 -1
- package/es/FontLoader/index.d.mts +2 -2
- package/es/Footer/Footer.d.mts +2 -2
- package/es/Footer/Footer.mjs +1 -1
- package/es/Footer/Footer.mjs.map +1 -1
- package/es/Form/Form.mjs +12 -12
- package/es/Form/Form.mjs.map +1 -1
- package/es/Form/components/FormGroup.d.mts +2 -2
- package/es/Form/components/FormGroup.mjs +5 -5
- package/es/Form/components/FormGroup.mjs.map +1 -1
- package/es/Form/components/FormItem.d.mts +2 -2
- package/es/Form/components/FormProvider.mjs.map +1 -1
- package/es/Form/components/FormSubmitFooter.d.mts +2 -2
- package/es/Form/components/FormSubmitFooter.mjs +5 -5
- package/es/Form/components/FormSubmitFooter.mjs.map +1 -1
- package/es/Form/components/FormTitle.mjs +1 -1
- package/es/Form/components/FormTitle.mjs.map +1 -1
- package/es/Form/components/merge.mjs.map +1 -1
- package/es/Form/index.mjs +1 -1
- package/es/Form/index.mjs.map +1 -1
- package/es/Form/style.mjs.map +1 -1
- package/es/Form/type.d.mts +1 -1
- package/es/FormModal/FormModal.d.mts +2 -2
- package/es/FormModal/FormModal.mjs +10 -10
- package/es/FormModal/FormModal.mjs.map +1 -1
- package/es/GroupAvatar/style.mjs.map +1 -1
- package/es/GroupAvatar/type.d.mts +1 -1
- package/es/GuideCard/GuideCard.d.mts +2 -2
- package/es/GuideCard/style.mjs.map +1 -1
- package/es/Header/Header.d.mts +2 -2
- package/es/Header/Header.mjs +5 -5
- package/es/Header/Header.mjs.map +1 -1
- package/es/Highlighter/FullFeatured.mjs +9 -9
- package/es/Highlighter/FullFeatured.mjs.map +1 -1
- package/es/Highlighter/Highlighter.d.mts +2 -2
- package/es/Highlighter/Highlighter.mjs +4 -4
- package/es/Highlighter/Highlighter.mjs.map +1 -1
- package/es/Highlighter/LangSelect.mjs +6 -6
- package/es/Highlighter/LangSelect.mjs.map +1 -1
- package/es/Highlighter/SyntaxHighlighter/StaticRenderer.mjs +2 -2
- package/es/Highlighter/SyntaxHighlighter/StaticRenderer.mjs.map +1 -1
- package/es/Highlighter/SyntaxHighlighter/index.d.mts +2 -2
- package/es/Highlighter/SyntaxHighlighter/style.mjs.map +1 -1
- package/es/Highlighter/style.mjs.map +1 -1
- package/es/Hotkey/Hotkey.d.mts +2 -2
- package/es/Hotkey/Hotkey.mjs +5 -5
- package/es/Hotkey/Hotkey.mjs.map +1 -1
- package/es/Hotkey/style.mjs.map +1 -1
- package/es/HotkeyInput/HotkeyInput.d.mts +2 -2
- package/es/HotkeyInput/HotkeyInput.mjs +10 -10
- package/es/HotkeyInput/HotkeyInput.mjs.map +1 -1
- package/es/HotkeyInput/style.mjs.map +1 -1
- package/es/Icon/Icon.d.mts +2 -2
- package/es/Icon/Icon.mjs.map +1 -1
- package/es/Icon/components/IconProvider.d.mts +3 -3
- package/es/Icon/components/IconProvider.mjs.map +1 -1
- package/es/Icon/style.mjs.map +1 -1
- package/es/Image/Image.mjs +3 -3
- package/es/Image/Image.mjs.map +1 -1
- package/es/Image/PreviewGroup.d.mts +2 -2
- package/es/Image/PreviewGroup.mjs.map +1 -1
- package/es/Image/components/Preview.mjs.map +1 -1
- package/es/Image/components/Toolbar.mjs +1 -1
- package/es/Image/components/Toolbar.mjs.map +1 -1
- package/es/Image/components/usePreviewGroup.mjs.map +1 -1
- package/es/Image/style.mjs.map +1 -1
- package/es/ImageSelect/ImageSelect.d.mts +2 -2
- package/es/ImageSelect/ImageSelect.mjs +7 -7
- package/es/ImageSelect/ImageSelect.mjs.map +1 -1
- package/es/Img/index.mjs.map +1 -1
- package/es/Input/Input.d.mts +2 -2
- package/es/Input/Input.mjs +2 -2
- package/es/Input/Input.mjs.map +1 -1
- package/es/Input/InputNumber.d.mts +2 -2
- package/es/Input/InputNumber.mjs +2 -2
- package/es/Input/InputNumber.mjs.map +1 -1
- package/es/Input/InputOPT.mjs +2 -2
- package/es/Input/InputOPT.mjs.map +1 -1
- package/es/Input/InputPassword.d.mts +2 -2
- package/es/Input/InputPassword.mjs +2 -2
- package/es/Input/InputPassword.mjs.map +1 -1
- package/es/Input/TextArea.d.mts +2 -2
- package/es/Input/TextArea.mjs +2 -2
- package/es/Input/TextArea.mjs.map +1 -1
- package/es/Input/style.mjs.map +1 -1
- package/es/Layout/Layout.mjs +1 -1
- package/es/Layout/Layout.mjs.map +1 -1
- package/es/Layout/components/LayoutFooter.d.mts +2 -2
- package/es/Layout/components/LayoutHeader.d.mts +2 -2
- package/es/Layout/components/LayoutMain.d.mts +2 -2
- package/es/Layout/components/LayoutSidebar.d.mts +2 -2
- package/es/Layout/components/LayoutSidebarInner.d.mts +2 -2
- package/es/Layout/components/LayoutToc.d.mts +2 -2
- package/es/Layout/index.mjs.map +1 -1
- package/es/List/List.mjs +6 -6
- package/es/List/List.mjs.map +1 -1
- package/es/List/ListItem/index.d.mts +2 -2
- package/es/List/ListItem/index.mjs +11 -11
- package/es/List/ListItem/index.mjs.map +1 -1
- package/es/LobeSelect/LobeSelect.d.mts +2 -2
- package/es/LobeSelect/LobeSelect.mjs +16 -16
- package/es/LobeSelect/LobeSelect.mjs.map +1 -1
- package/es/LobeSelect/atoms.d.mts +19 -19
- package/es/LobeSelect/atoms.mjs +1 -1
- package/es/LobeSelect/atoms.mjs.map +1 -1
- package/es/LobeSwitch/LobeSwitch.d.mts +2 -2
- package/es/LobeSwitch/LobeSwitch.mjs +2 -2
- package/es/LobeSwitch/LobeSwitch.mjs.map +1 -1
- package/es/LobeSwitch/atoms.d.mts +4 -4
- package/es/LobeSwitch/atoms.mjs +10 -10
- package/es/LobeSwitch/atoms.mjs.map +1 -1
- package/es/Markdown/Markdown.d.mts +2 -2
- package/es/Markdown/Markdown.mjs +3 -3
- package/es/Markdown/Markdown.mjs.map +1 -1
- package/es/Markdown/SyntaxMarkdown/StreamdownRender.mjs.map +1 -1
- package/es/Markdown/Typography.d.mts +2 -2
- package/es/Markdown/components/CodeBlock.mjs.map +1 -1
- package/es/Markdown/components/Footnotes.mjs +3 -3
- package/es/Markdown/components/Footnotes.mjs.map +1 -1
- package/es/Markdown/components/MarkdownProvider.mjs.map +1 -1
- package/es/Markdown/components/SearchResultCards/SearchResultCard.mjs +3 -3
- package/es/Markdown/components/SearchResultCards/SearchResultCard.mjs.map +1 -1
- package/es/Markdown/components/SearchResultCards/index.d.mts +2 -2
- package/es/Markdown/components/SearchResultCards/index.mjs +1 -1
- package/es/Markdown/components/SearchResultCards/index.mjs.map +1 -1
- package/es/Markdown/plugins/rehypeCustomFootnotes.mjs.map +1 -1
- package/es/Markdown/plugins/rehypeKatexDir.mjs.map +1 -1
- package/es/Markdown/plugins/rehypeStreamAnimated.mjs.map +1 -1
- package/es/Markdown/plugins/remarkColor.mjs +1 -1
- package/es/Markdown/plugins/remarkColor.mjs.map +1 -1
- package/es/Markdown/plugins/remarkCustomFootnotes.mjs.map +1 -1
- package/es/Markdown/plugins/remarkVideo.mjs +3 -3
- package/es/Markdown/plugins/remarkVideo.mjs.map +1 -1
- package/es/Markdown/style.mjs.map +1 -1
- package/es/MaskShadow/MaskShadow.d.mts +2 -2
- package/es/MaskShadow/style.mjs.map +1 -1
- package/es/Menu/Menu.d.mts +2 -2
- package/es/Menu/Menu.mjs.map +1 -1
- package/es/Menu/checkboxItem.d.mts +1 -0
- package/es/Menu/index.d.mts +2 -2
- package/es/Menu/renderUtils.d.mts +4 -1
- package/es/Menu/renderUtils.mjs.map +1 -1
- package/es/Menu/sharedStyle.d.mts +4 -0
- package/es/Menu/sharedStyle.mjs +24 -0
- package/es/Menu/sharedStyle.mjs.map +1 -1
- package/es/Menu/style.mjs.map +1 -1
- package/es/Menu/switchItem.d.mts +1 -0
- package/es/Menu/type.d.mts +3 -1
- package/es/Mermaid/FullFeatured.mjs +7 -7
- package/es/Mermaid/FullFeatured.mjs.map +1 -1
- package/es/Mermaid/Mermaid.d.mts +2 -2
- package/es/Mermaid/Mermaid.mjs +1 -1
- package/es/Mermaid/Mermaid.mjs.map +1 -1
- package/es/Mermaid/SyntaxMermaid/StaticMermaid.mjs +3 -3
- package/es/Mermaid/SyntaxMermaid/StaticMermaid.mjs.map +1 -1
- package/es/Mermaid/SyntaxMermaid/StreamMermaid.mjs +3 -3
- package/es/Mermaid/SyntaxMermaid/StreamMermaid.mjs.map +1 -1
- package/es/Mermaid/SyntaxMermaid/index.d.mts +2 -2
- package/es/Mermaid/SyntaxMermaid/style.mjs.map +1 -1
- package/es/Modal/Modal.d.mts +2 -2
- package/es/Modal/Modal.mjs +25 -25
- package/es/Modal/Modal.mjs.map +1 -1
- package/es/Modal/ModalProvider.d.mts +2 -2
- package/es/Modal/ModalStackItem.mjs +1 -1
- package/es/Modal/ModalStackItem.mjs.map +1 -1
- package/es/Modal/imperative.d.mts +2 -2
- package/es/Modal/imperative.mjs +5 -5
- package/es/Modal/imperative.mjs.map +1 -1
- package/es/MotionProvider/index.d.mts +2 -2
- package/es/MotionProvider/index.mjs.map +1 -1
- package/es/Popover/ArrowIcon.d.mts +2 -2
- package/es/Popover/Popover.mjs +2 -2
- package/es/Popover/Popover.mjs.map +1 -1
- package/es/Popover/PopoverGroup.mjs +2 -2
- package/es/Popover/PopoverGroup.mjs.map +1 -1
- package/es/Popover/PopoverInGroup.mjs +2 -2
- package/es/Popover/PopoverInGroup.mjs.map +1 -1
- package/es/Popover/PopoverStandalone.mjs +1 -1
- package/es/Popover/PopoverStandalone.mjs.map +1 -1
- package/es/Popover/atoms.d.mts +9 -9
- package/es/Popover/atoms.mjs +1 -1
- package/es/Popover/atoms.mjs.map +1 -1
- package/es/Popover/context.d.mts +2 -2
- package/es/Popover/context.mjs.map +1 -1
- package/es/Popover/groupContext.mjs.map +1 -1
- package/es/ScrollArea/atoms.d.mts +7 -7
- package/es/ScrollArea/type.d.mts +1 -1
- package/es/ScrollShadow/style.mjs.map +1 -1
- package/es/ScrollShadow/useScrollOverflow.mjs.map +1 -1
- package/es/SearchBar/SearchBar.d.mts +2 -2
- package/es/SearchBar/SearchBar.mjs +14 -14
- package/es/SearchBar/SearchBar.mjs.map +1 -1
- package/es/Segmented/Segmented.d.mts +2 -2
- package/es/Segmented/style.mjs.map +1 -1
- package/es/Select/Select.d.mts +2 -2
- package/es/Select/Select.mjs +2 -2
- package/es/Select/Select.mjs.map +1 -1
- package/es/Select/style.mjs.map +1 -1
- package/es/SideNav/SideNav.d.mts +2 -2
- package/es/Skeleton/Skeleton.mjs +1 -1
- package/es/Skeleton/Skeleton.mjs.map +1 -1
- package/es/Skeleton/SkeletonBlock.mjs.map +1 -1
- package/es/Skeleton/SkeletonTags.mjs +3 -3
- package/es/Skeleton/SkeletonTags.mjs.map +1 -1
- package/es/Skeleton/SkeletonTitle.mjs +1 -1
- package/es/Skeleton/SkeletonTitle.mjs.map +1 -1
- package/es/SliderWithInput/SliderWithInput.d.mts +2 -2
- package/es/SliderWithInput/SliderWithInput.mjs +3 -3
- package/es/SliderWithInput/SliderWithInput.mjs.map +1 -1
- package/es/Snippet/Snippet.mjs +1 -1
- package/es/Snippet/Snippet.mjs.map +1 -1
- package/es/Snippet/style.mjs.map +1 -1
- package/es/SortableList/SortableList.mjs +1 -1
- package/es/SortableList/SortableList.mjs.map +1 -1
- package/es/SortableList/components/DragHandle.d.mts +2 -2
- package/es/SortableList/components/DragHandle.mjs +3 -3
- package/es/SortableList/components/DragHandle.mjs.map +1 -1
- package/es/SortableList/components/SortableItem.d.mts +2 -2
- package/es/SortableList/components/SortableItem.mjs +1 -1
- package/es/SortableList/components/SortableItem.mjs.map +1 -1
- package/es/SortableList/components/SortableOverlay.mjs.map +1 -1
- package/es/SortableList/style.mjs.map +1 -1
- package/es/SortableList/type.d.mts +2 -2
- package/es/Tabs/style.mjs.map +1 -1
- package/es/Tag/Tag.mjs +2 -2
- package/es/Tag/Tag.mjs.map +1 -1
- package/es/Tag/styles.mjs.map +1 -1
- package/es/Text/Text.mjs +27 -14
- package/es/Text/Text.mjs.map +1 -1
- package/es/Text/type.d.mts +18 -1
- package/es/ThemeProvider/ConfigProvider.mjs.map +1 -1
- package/es/ThemeProvider/GlobalStyle/antdOverride.mjs.map +1 -1
- package/es/ThemeProvider/GlobalStyle/global.mjs.map +1 -1
- package/es/ThemeProvider/ThemeProvider.d.mts +2 -2
- package/es/ThemeProvider/ThemeProvider.mjs.map +1 -1
- package/es/ThemeSwitch/ThemeSwitch.mjs +4 -4
- package/es/ThemeSwitch/ThemeSwitch.mjs.map +1 -1
- package/es/Toast/Toast.mjs +3 -3
- package/es/Toast/Toast.mjs.map +1 -1
- package/es/Toast/imperative.d.mts +3 -3
- package/es/Toast/imperative.mjs +1 -1
- package/es/Toast/imperative.mjs.map +1 -1
- package/es/Toc/Toc.d.mts +2 -2
- package/es/Toc/Toc.mjs.map +1 -1
- package/es/Toc/TocMobile.mjs +6 -6
- package/es/Toc/TocMobile.mjs.map +1 -1
- package/es/Toc/utils.mjs.map +1 -1
- package/es/Tooltip/Tooltip.mjs +2 -2
- package/es/Tooltip/Tooltip.mjs.map +1 -1
- package/es/Tooltip/TooltipContent.mjs.map +1 -1
- package/es/Tooltip/TooltipGroup.mjs +3 -3
- package/es/Tooltip/TooltipGroup.mjs.map +1 -1
- package/es/Tooltip/TooltipInGroup.mjs +3 -3
- package/es/Tooltip/TooltipInGroup.mjs.map +1 -1
- package/es/Tooltip/TooltipStandalone.mjs +2 -2
- package/es/Tooltip/TooltipStandalone.mjs.map +1 -1
- package/es/Tooltip/groupContext.mjs.map +1 -1
- package/es/Tooltip/type.d.mts +1 -1
- package/es/Video/index.d.mts +2 -2
- package/es/Video/index.mjs +8 -8
- package/es/Video/index.mjs.map +1 -1
- package/es/Video/style.mjs.map +1 -1
- package/es/awesome/AuroraBackground/AuroraBackground.d.mts +2 -2
- package/es/awesome/BottomGradientButton/BottomGradientButton.d.mts +2 -2
- package/es/awesome/BottomGradientButton/BottomGradientButton.mjs +1 -1
- package/es/awesome/BottomGradientButton/BottomGradientButton.mjs.map +1 -1
- package/es/awesome/Features/FeatureItem.mjs +1 -1
- package/es/awesome/Features/FeatureItem.mjs.map +1 -1
- package/es/awesome/Features/Features.d.mts +2 -2
- package/es/awesome/Features/Features.mjs +4 -4
- package/es/awesome/Features/Features.mjs.map +1 -1
- package/es/awesome/Features/type.d.mts +1 -1
- package/es/awesome/Giscus/Giscus.d.mts +2 -2
- package/es/awesome/GradientButton/GradientButton.mjs +2 -2
- package/es/awesome/GradientButton/GradientButton.mjs.map +1 -1
- package/es/awesome/GridBackground/GridBackground.d.mts +2 -2
- package/es/awesome/GridBackground/GridShowcase.d.mts +2 -2
- package/es/awesome/GridBackground/GridShowcase.mjs +5 -5
- package/es/awesome/GridBackground/GridShowcase.mjs.map +1 -1
- package/es/awesome/GridBackground/components/Grid.mjs.map +1 -1
- package/es/awesome/Hero/Hero.d.mts +2 -2
- package/es/awesome/Hero/Hero.mjs +3 -3
- package/es/awesome/Hero/Hero.mjs.map +1 -1
- package/es/awesome/Hero/type.d.mts +1 -1
- package/es/awesome/Spline/ParentSize.mjs.map +1 -1
- package/es/awesome/Spline/Spine.mjs +2 -2
- package/es/awesome/Spline/Spine.mjs.map +1 -1
- package/es/awesome/Spotlight/Spotlight.d.mts +2 -2
- package/es/awesome/SpotlightCard/SpotlightCard.d.mts +2 -2
- package/es/brand/BrandLoading/index.mjs.map +1 -1
- package/es/brand/LobeChat/index.d.mts +2 -2
- package/es/brand/LobeChat/index.mjs +3 -3
- package/es/brand/LobeChat/index.mjs.map +1 -1
- package/es/brand/LobeChatText/index.mjs.map +1 -1
- package/es/brand/LobeHub/index.d.mts +2 -2
- package/es/brand/LobeHub/index.mjs +3 -3
- package/es/brand/LobeHub/index.mjs.map +1 -1
- package/es/brand/LobeHubText/index.mjs.map +1 -1
- package/es/brand/Logo3d/index.mjs.map +1 -1
- package/es/brand/LogoThree/Loading.mjs +2 -2
- package/es/brand/LogoThree/Loading.mjs.map +1 -1
- package/es/brand/LogoThree/LogoSpline.d.mts +2 -2
- package/es/brand/LogoThree/LogoSpline.mjs +1 -1
- package/es/brand/LogoThree/LogoSpline.mjs.map +1 -1
- package/es/brand/LogoThree/index.d.mts +2 -2
- package/es/brand/LogoThree/index.mjs +4 -4
- package/es/brand/LogoThree/index.mjs.map +1 -1
- package/es/brand/components/Divider.mjs.map +1 -1
- package/es/chat/BackBottom/BackBottom.d.mts +2 -2
- package/es/chat/BackBottom/BackBottom.mjs +2 -2
- package/es/chat/BackBottom/BackBottom.mjs.map +1 -1
- package/es/chat/ChatHeader/ChatHeader.mjs +6 -6
- package/es/chat/ChatHeader/ChatHeader.mjs.map +1 -1
- package/es/chat/ChatHeader/ChatHeaderTitle.mjs +4 -4
- package/es/chat/ChatHeader/ChatHeaderTitle.mjs.map +1 -1
- package/es/chat/ChatInputArea/ChatInputArea.mjs +3 -3
- package/es/chat/ChatInputArea/ChatInputArea.mjs.map +1 -1
- package/es/chat/ChatInputArea/components/ChatInputActionBar.mjs +3 -3
- package/es/chat/ChatInputArea/components/ChatInputActionBar.mjs.map +1 -1
- package/es/chat/ChatInputArea/components/ChatInputAreaInner.d.mts +2 -2
- package/es/chat/ChatInputArea/components/ChatInputAreaInner.mjs +3 -3
- package/es/chat/ChatInputArea/components/ChatInputAreaInner.mjs.map +1 -1
- package/es/chat/ChatInputArea/components/ChatSendButton.mjs +5 -5
- package/es/chat/ChatInputArea/components/ChatSendButton.mjs.map +1 -1
- package/es/chat/ChatItem/ChatItem.mjs +9 -9
- package/es/chat/ChatItem/ChatItem.mjs.map +1 -1
- package/es/chat/ChatItem/components/Actions.mjs.map +1 -1
- package/es/chat/ChatItem/components/Avatar.mjs +2 -2
- package/es/chat/ChatItem/components/Avatar.mjs.map +1 -1
- package/es/chat/ChatItem/components/ErrorContent.mjs +1 -1
- package/es/chat/ChatItem/components/ErrorContent.mjs.map +1 -1
- package/es/chat/ChatItem/components/Loading.mjs +2 -2
- package/es/chat/ChatItem/components/Loading.mjs.map +1 -1
- package/es/chat/ChatItem/components/MessageContent.mjs +4 -4
- package/es/chat/ChatItem/components/MessageContent.mjs.map +1 -1
- package/es/chat/ChatItem/components/Title.mjs.map +1 -1
- package/es/chat/ChatList/ChatList.d.mts +2 -2
- package/es/chat/ChatList/components/ChatListItem.mjs +14 -14
- package/es/chat/ChatList/components/ChatListItem.mjs.map +1 -1
- package/es/chat/ChatList/type.d.mts +1 -1
- package/es/chat/EditableMessage/EditableMessage.d.mts +2 -2
- package/es/chat/EditableMessage/EditableMessage.mjs +18 -18
- package/es/chat/EditableMessage/EditableMessage.mjs.map +1 -1
- package/es/chat/EditableMessageList/EditableMessageList.mjs +17 -17
- package/es/chat/EditableMessageList/EditableMessageList.mjs.map +1 -1
- package/es/chat/MessageInput/MessageInput.d.mts +2 -2
- package/es/chat/MessageInput/MessageInput.mjs +8 -8
- package/es/chat/MessageInput/MessageInput.mjs.map +1 -1
- package/es/chat/MessageModal/MessageModal.d.mts +2 -2
- package/es/chat/MessageModal/MessageModal.mjs +15 -15
- package/es/chat/MessageModal/MessageModal.mjs.map +1 -1
- package/es/chat/TokenTag/TokenTag.mjs +2 -2
- package/es/chat/TokenTag/TokenTag.mjs.map +1 -1
- package/es/chat/types/error.mjs.map +1 -1
- package/es/color/ColorScales/ScaleRow.mjs +3 -3
- package/es/color/ColorScales/ScaleRow.mjs.map +1 -1
- package/es/color/ColorScales/index.d.mts +2 -2
- package/es/color/ColorScales/index.mjs +4 -4
- package/es/color/ColorScales/index.mjs.map +1 -1
- package/es/color/CssVar/ScaleRow.mjs +4 -4
- package/es/color/CssVar/ScaleRow.mjs.map +1 -1
- package/es/color/CssVar/VarRow.mjs +2 -2
- package/es/color/CssVar/VarRow.mjs.map +1 -1
- package/es/color/CssVar/index.d.mts +2 -2
- package/es/color/CssVar/index.mjs +4 -4
- package/es/color/CssVar/index.mjs.map +1 -1
- package/es/color/colors/blue.mjs.map +1 -1
- package/es/color/colors/cyan.mjs.map +1 -1
- package/es/color/colors/geekblue.mjs.map +1 -1
- package/es/color/colors/gold.mjs.map +1 -1
- package/es/color/colors/gray.mjs.map +1 -1
- package/es/color/colors/green.mjs.map +1 -1
- package/es/color/colors/lime.mjs.map +1 -1
- package/es/color/colors/magenta.mjs.map +1 -1
- package/es/color/colors/orange.mjs.map +1 -1
- package/es/color/colors/primary.mjs.map +1 -1
- package/es/color/colors/purple.mjs.map +1 -1
- package/es/color/colors/red.mjs.map +1 -1
- package/es/color/colors/volcano.mjs.map +1 -1
- package/es/color/colors/yellow.mjs.map +1 -1
- package/es/color/neutrals/mauve.mjs.map +1 -1
- package/es/color/neutrals/olive.mjs.map +1 -1
- package/es/color/neutrals/sage.mjs.map +1 -1
- package/es/color/neutrals/sand.mjs.map +1 -1
- package/es/color/neutrals/slate.mjs.map +1 -1
- package/es/hooks/useFloatingLayer.mjs +2 -2
- package/es/hooks/useFloatingLayer.mjs.map +1 -1
- package/es/hooks/useHighlight.mjs.map +1 -1
- package/es/hooks/useMarkdown/latex.mjs +12 -12
- package/es/hooks/useMarkdown/latex.mjs.map +1 -1
- package/es/hooks/useMarkdown/useMarkdownComponents.mjs +1 -1
- package/es/hooks/useMarkdown/useMarkdownComponents.mjs.map +1 -1
- package/es/hooks/useMarkdown/utils.mjs +4 -4
- package/es/hooks/useMarkdown/utils.mjs.map +1 -1
- package/es/hooks/useNativeButton.mjs.map +1 -1
- package/es/hooks/useStreamHighlight.mjs.map +1 -1
- package/es/i18n/context.d.mts +3 -3
- package/es/i18n/context.mjs.map +1 -1
- package/es/icons/Authelia/components/Color.mjs.map +1 -1
- package/es/icons/lucideExtra/BotPromptIcon.d.mts +2 -2
- package/es/icons/lucideExtra/CreateBotIcon.d.mts +3 -3
- package/es/icons/lucideExtra/DiscordIcon.d.mts +2 -2
- package/es/icons/lucideExtra/GlobeOffIcon.d.mts +3 -3
- package/es/icons/lucideExtra/GroupBotIcon.d.mts +2 -2
- package/es/icons/lucideExtra/GroupBotSquareIcon.d.mts +3 -3
- package/es/icons/lucideExtra/LeftClickIcon.d.mts +3 -3
- package/es/icons/lucideExtra/LeftDoubleClickIcon.d.mts +3 -3
- package/es/icons/lucideExtra/McpIcon.d.mts +2 -2
- package/es/icons/lucideExtra/ProviderIcon.d.mts +3 -3
- package/es/icons/lucideExtra/RightClickIcon.d.mts +3 -3
- package/es/icons/lucideExtra/RightDoubleClickIcon.d.mts +3 -3
- package/es/icons/lucideExtra/ShapesUploadIcon.d.mts +3 -3
- package/es/icons/lucideExtra/TreeDownRightIcon.d.mts +3 -3
- package/es/icons/lucideExtra/TreeUpDownRightIcon.d.mts +3 -3
- package/es/mdx/Callout/index.mjs +1 -1
- package/es/mdx/Callout/index.mjs.map +1 -1
- package/es/mdx/Cards/Card.mjs +2 -2
- package/es/mdx/Cards/Card.mjs.map +1 -1
- package/es/mdx/FileTree/File.mjs +1 -1
- package/es/mdx/FileTree/File.mjs.map +1 -1
- package/es/mdx/FileTree/Folder.mjs +1 -1
- package/es/mdx/FileTree/Folder.mjs.map +1 -1
- package/es/mdx/FileTree/index.mjs.map +1 -1
- package/es/mdx/Mdx/index.d.mts +2 -2
- package/es/mdx/Mdx/index.mjs +3 -3
- package/es/mdx/Mdx/index.mjs.map +1 -1
- package/es/mdx/Steps/index.mjs.map +1 -1
- package/es/mdx/Tabs/Tab.mjs.map +1 -1
- package/es/mdx/Tabs/index.mjs +1 -1
- package/es/mdx/Tabs/index.mjs.map +1 -1
- package/es/mdx/mdxComponents/Citation/PopoverPanel.mjs +3 -3
- package/es/mdx/mdxComponents/Citation/PopoverPanel.mjs.map +1 -1
- package/es/mdx/mdxComponents/Citation/index.mjs.map +1 -1
- package/es/mdx/mdxComponents/Link.mjs +1 -1
- package/es/mdx/mdxComponents/Link.mjs.map +1 -1
- package/es/mobile/ChatHeader/ChatHeader.mjs +4 -4
- package/es/mobile/ChatHeader/ChatHeader.mjs.map +1 -1
- package/es/mobile/ChatHeader/ChatHeaderTitle.d.mts +2 -2
- package/es/mobile/ChatHeader/ChatHeaderTitle.mjs +5 -5
- package/es/mobile/ChatHeader/ChatHeaderTitle.mjs.map +1 -1
- package/es/mobile/ChatInputArea/ChatInputArea.mjs +9 -9
- package/es/mobile/ChatInputArea/ChatInputArea.mjs.map +1 -1
- package/es/mobile/ChatInputArea/components/ChatSendButton.d.mts +2 -2
- package/es/mobile/ChatInputArea/components/ChatSendButton.mjs +2 -2
- package/es/mobile/ChatInputArea/components/ChatSendButton.mjs.map +1 -1
- package/es/mobile/SafeArea/SafeArea.mjs.map +1 -1
- package/es/mobile/TabBar/TabBar.d.mts +2 -2
- package/es/mobile/TabBar/TabBar.mjs +3 -3
- package/es/mobile/TabBar/TabBar.mjs.map +1 -1
- package/es/storybook/StoryBook/index.d.mts +2 -2
- package/es/storybook/StoryBook/index.mjs.map +1 -1
- package/es/styles/theme/algorithms/darkAlgorithm.mjs.map +1 -1
- package/es/styles/theme/algorithms/lightAlgorithm.mjs.map +1 -1
- package/es/styles/theme/antdTheme.mjs.map +1 -1
- package/es/styles/theme/customStylish.mjs.map +1 -1
- package/es/styles/theme/customToken.mjs.map +1 -1
- package/es/styles/theme/generateColorPalette.mjs.map +1 -1
- package/es/styles/theme/token/base.mjs.map +1 -1
- package/es/styles/theme/token/dark.mjs.map +1 -1
- package/es/styles/theme/token/light.mjs.map +1 -1
- package/package.json +79 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DropdownMenuPlacement } from "./type.mjs";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime30 from "react/jsx-runtime";
|
|
4
4
|
import * as _base_ui_react_menu0 from "@base-ui/react/menu";
|
|
5
5
|
import { Menu } from "@base-ui/react/menu";
|
|
6
6
|
|
|
@@ -19,7 +19,7 @@ declare const DropdownMenuTrigger: {
|
|
|
19
19
|
nativeButton,
|
|
20
20
|
ref: refProp,
|
|
21
21
|
...rest
|
|
22
|
-
}: DropdownMenuTriggerProps):
|
|
22
|
+
}: DropdownMenuTriggerProps): react_jsx_runtime30.JSX.Element;
|
|
23
23
|
displayName: string;
|
|
24
24
|
};
|
|
25
25
|
type DropdownMenuPortalProps = React.ComponentProps<typeof Menu.Portal> & {
|
|
@@ -32,7 +32,7 @@ declare const DropdownMenuPortal: {
|
|
|
32
32
|
({
|
|
33
33
|
container,
|
|
34
34
|
...rest
|
|
35
|
-
}: DropdownMenuPortalProps):
|
|
35
|
+
}: DropdownMenuPortalProps): react_jsx_runtime30.JSX.Element;
|
|
36
36
|
displayName: string;
|
|
37
37
|
};
|
|
38
38
|
type DropdownMenuPositionerProps = React.ComponentProps<typeof Menu.Positioner> & {
|
|
@@ -49,7 +49,7 @@ declare const DropdownMenuPositioner: {
|
|
|
49
49
|
sideOffset,
|
|
50
50
|
children,
|
|
51
51
|
...rest
|
|
52
|
-
}: DropdownMenuPositionerProps):
|
|
52
|
+
}: DropdownMenuPositionerProps): react_jsx_runtime30.JSX.Element;
|
|
53
53
|
displayName: string;
|
|
54
54
|
};
|
|
55
55
|
type DropdownMenuPopupProps = React.ComponentProps<typeof Menu.Popup>;
|
|
@@ -57,7 +57,7 @@ declare const DropdownMenuPopup: {
|
|
|
57
57
|
({
|
|
58
58
|
className,
|
|
59
59
|
...rest
|
|
60
|
-
}: DropdownMenuPopupProps):
|
|
60
|
+
}: DropdownMenuPopupProps): react_jsx_runtime30.JSX.Element;
|
|
61
61
|
displayName: string;
|
|
62
62
|
};
|
|
63
63
|
type DropdownMenuItemProps = React.ComponentProps<typeof Menu.Item> & {
|
|
@@ -68,7 +68,7 @@ declare const DropdownMenuItem: {
|
|
|
68
68
|
className,
|
|
69
69
|
danger,
|
|
70
70
|
...rest
|
|
71
|
-
}: DropdownMenuItemProps):
|
|
71
|
+
}: DropdownMenuItemProps): react_jsx_runtime30.JSX.Element;
|
|
72
72
|
displayName: string;
|
|
73
73
|
};
|
|
74
74
|
type DropdownMenuCheckboxItemProps = React.ComponentProps<typeof Menu.CheckboxItem> & {
|
|
@@ -79,7 +79,7 @@ declare const DropdownMenuCheckboxItemPrimitive: {
|
|
|
79
79
|
className,
|
|
80
80
|
danger,
|
|
81
81
|
...rest
|
|
82
|
-
}: DropdownMenuCheckboxItemProps):
|
|
82
|
+
}: DropdownMenuCheckboxItemProps): react_jsx_runtime30.JSX.Element;
|
|
83
83
|
displayName: string;
|
|
84
84
|
};
|
|
85
85
|
type DropdownMenuSeparatorProps = React.ComponentProps<typeof Menu.Separator>;
|
|
@@ -87,7 +87,7 @@ declare const DropdownMenuSeparator: {
|
|
|
87
87
|
({
|
|
88
88
|
className,
|
|
89
89
|
...rest
|
|
90
|
-
}: DropdownMenuSeparatorProps):
|
|
90
|
+
}: DropdownMenuSeparatorProps): react_jsx_runtime30.JSX.Element;
|
|
91
91
|
displayName: string;
|
|
92
92
|
};
|
|
93
93
|
declare const DropdownMenuGroup: React.ForwardRefExoticComponent<_base_ui_react_menu0.MenuGroupProps & React.RefAttributes<Element>>;
|
|
@@ -96,7 +96,7 @@ declare const DropdownMenuGroupLabel: {
|
|
|
96
96
|
({
|
|
97
97
|
className,
|
|
98
98
|
...rest
|
|
99
|
-
}: DropdownMenuGroupLabelProps):
|
|
99
|
+
}: DropdownMenuGroupLabelProps): react_jsx_runtime30.JSX.Element;
|
|
100
100
|
displayName: string;
|
|
101
101
|
};
|
|
102
102
|
type DropdownMenuSubmenuTriggerProps = React.ComponentProps<typeof Menu.SubmenuTrigger> & {
|
|
@@ -107,7 +107,7 @@ declare const DropdownMenuSubmenuTrigger: {
|
|
|
107
107
|
className,
|
|
108
108
|
danger,
|
|
109
109
|
...rest
|
|
110
|
-
}: DropdownMenuSubmenuTriggerProps):
|
|
110
|
+
}: DropdownMenuSubmenuTriggerProps): react_jsx_runtime30.JSX.Element;
|
|
111
111
|
displayName: string;
|
|
112
112
|
};
|
|
113
113
|
type DropdownMenuItemContentProps = React.HTMLAttributes<HTMLDivElement>;
|
|
@@ -115,7 +115,7 @@ declare const DropdownMenuItemContent: {
|
|
|
115
115
|
({
|
|
116
116
|
className,
|
|
117
117
|
...rest
|
|
118
|
-
}: DropdownMenuItemContentProps):
|
|
118
|
+
}: DropdownMenuItemContentProps): react_jsx_runtime30.JSX.Element;
|
|
119
119
|
displayName: string;
|
|
120
120
|
};
|
|
121
121
|
type DropdownMenuItemIconProps = React.HTMLAttributes<HTMLSpanElement>;
|
|
@@ -123,7 +123,15 @@ declare const DropdownMenuItemIcon: {
|
|
|
123
123
|
({
|
|
124
124
|
className,
|
|
125
125
|
...rest
|
|
126
|
-
}: DropdownMenuItemIconProps):
|
|
126
|
+
}: DropdownMenuItemIconProps): react_jsx_runtime30.JSX.Element;
|
|
127
|
+
displayName: string;
|
|
128
|
+
};
|
|
129
|
+
type DropdownMenuItemLabelGroupProps = React.HTMLAttributes<HTMLDivElement>;
|
|
130
|
+
declare const DropdownMenuItemLabelGroup: {
|
|
131
|
+
({
|
|
132
|
+
className,
|
|
133
|
+
...rest
|
|
134
|
+
}: DropdownMenuItemLabelGroupProps): react_jsx_runtime30.JSX.Element;
|
|
127
135
|
displayName: string;
|
|
128
136
|
};
|
|
129
137
|
type DropdownMenuItemLabelProps = React.HTMLAttributes<HTMLSpanElement>;
|
|
@@ -131,7 +139,15 @@ declare const DropdownMenuItemLabel: {
|
|
|
131
139
|
({
|
|
132
140
|
className,
|
|
133
141
|
...rest
|
|
134
|
-
}: DropdownMenuItemLabelProps):
|
|
142
|
+
}: DropdownMenuItemLabelProps): react_jsx_runtime30.JSX.Element;
|
|
143
|
+
displayName: string;
|
|
144
|
+
};
|
|
145
|
+
type DropdownMenuItemDescProps = React.HTMLAttributes<HTMLSpanElement>;
|
|
146
|
+
declare const DropdownMenuItemDesc: {
|
|
147
|
+
({
|
|
148
|
+
className,
|
|
149
|
+
...rest
|
|
150
|
+
}: DropdownMenuItemDescProps): react_jsx_runtime30.JSX.Element;
|
|
135
151
|
displayName: string;
|
|
136
152
|
};
|
|
137
153
|
type DropdownMenuItemExtraProps = React.HTMLAttributes<HTMLSpanElement>;
|
|
@@ -139,7 +155,7 @@ declare const DropdownMenuItemExtra: {
|
|
|
139
155
|
({
|
|
140
156
|
className,
|
|
141
157
|
...rest
|
|
142
|
-
}: DropdownMenuItemExtraProps):
|
|
158
|
+
}: DropdownMenuItemExtraProps): react_jsx_runtime30.JSX.Element;
|
|
143
159
|
displayName: string;
|
|
144
160
|
};
|
|
145
161
|
type DropdownMenuSubmenuArrowProps = React.HTMLAttributes<HTMLSpanElement>;
|
|
@@ -147,7 +163,7 @@ declare const DropdownMenuSubmenuArrow: {
|
|
|
147
163
|
({
|
|
148
164
|
className,
|
|
149
165
|
...rest
|
|
150
|
-
}: DropdownMenuSubmenuArrowProps):
|
|
166
|
+
}: DropdownMenuSubmenuArrowProps): react_jsx_runtime30.JSX.Element;
|
|
151
167
|
displayName: string;
|
|
152
168
|
};
|
|
153
169
|
type DropdownMenuSwitchItemProps = Omit<React.ComponentProps<typeof Menu.Item>, 'onClick'> & {
|
|
@@ -168,9 +184,9 @@ declare const DropdownMenuSwitchItem: {
|
|
|
168
184
|
onCheckedChange,
|
|
169
185
|
children,
|
|
170
186
|
...rest
|
|
171
|
-
}: DropdownMenuSwitchItemProps):
|
|
187
|
+
}: DropdownMenuSwitchItemProps): react_jsx_runtime30.JSX.Element;
|
|
172
188
|
displayName: string;
|
|
173
189
|
};
|
|
174
190
|
//#endregion
|
|
175
|
-
export { DROPDOWN_MENU_CONTAINER_ATTR, DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuCheckboxItemProps, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuGroupLabelProps, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemContentProps, DropdownMenuItemExtra, DropdownMenuItemExtraProps, DropdownMenuItemIcon, DropdownMenuItemIconProps, DropdownMenuItemLabel, DropdownMenuItemLabelProps, DropdownMenuItemProps, DropdownMenuPopup, DropdownMenuPopupProps, DropdownMenuPortal, DropdownMenuPortalProps, DropdownMenuPositioner, DropdownMenuPositionerProps, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuSeparatorProps, DropdownMenuSubmenuArrow, DropdownMenuSubmenuArrowProps, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSubmenuTriggerProps, DropdownMenuSwitchItem, DropdownMenuSwitchItemProps, DropdownMenuTrigger, DropdownMenuTriggerProps };
|
|
191
|
+
export { DROPDOWN_MENU_CONTAINER_ATTR, DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuCheckboxItemProps, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuGroupLabelProps, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemContentProps, DropdownMenuItemDesc, DropdownMenuItemDescProps, DropdownMenuItemExtra, DropdownMenuItemExtraProps, DropdownMenuItemIcon, DropdownMenuItemIconProps, DropdownMenuItemLabel, DropdownMenuItemLabelGroup, DropdownMenuItemLabelGroupProps, DropdownMenuItemLabelProps, DropdownMenuItemProps, DropdownMenuPopup, DropdownMenuPopupProps, DropdownMenuPortal, DropdownMenuPortalProps, DropdownMenuPositioner, DropdownMenuPositionerProps, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuSeparatorProps, DropdownMenuSubmenuArrow, DropdownMenuSubmenuArrowProps, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSubmenuTriggerProps, DropdownMenuSwitchItem, DropdownMenuSwitchItemProps, DropdownMenuTrigger, DropdownMenuTriggerProps };
|
|
176
192
|
//# sourceMappingURL=atoms.d.mts.map
|
|
@@ -4,8 +4,8 @@ import { useNativeButton } from "../hooks/useNativeButton.mjs";
|
|
|
4
4
|
import { FloatingLayerProvider } from "../hooks/useFloatingLayer.mjs";
|
|
5
5
|
import { placementMap } from "../utils/placement.mjs";
|
|
6
6
|
import { CLASSNAMES } from "../styles/classNames.mjs";
|
|
7
|
-
import { styles } from "../Menu/sharedStyle.mjs";
|
|
8
7
|
import { usePortalContainer } from "../hooks/usePortalContainer.mjs";
|
|
8
|
+
import { styles } from "../Menu/sharedStyle.mjs";
|
|
9
9
|
import { cloneElement, isValidElement, useCallback, useState } from "react";
|
|
10
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
11
|
import { Switch } from "antd";
|
|
@@ -147,6 +147,13 @@ const DropdownMenuItemIcon = ({ className, ...rest }) => {
|
|
|
147
147
|
});
|
|
148
148
|
};
|
|
149
149
|
DropdownMenuItemIcon.displayName = "DropdownMenuItemIcon";
|
|
150
|
+
const DropdownMenuItemLabelGroup = ({ className, ...rest }) => {
|
|
151
|
+
return /* @__PURE__ */ jsx("div", {
|
|
152
|
+
...rest,
|
|
153
|
+
className: cx(styles.labelGroup, className)
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
DropdownMenuItemLabelGroup.displayName = "DropdownMenuItemLabelGroup";
|
|
150
157
|
const DropdownMenuItemLabel = ({ className, ...rest }) => {
|
|
151
158
|
return /* @__PURE__ */ jsx("span", {
|
|
152
159
|
...rest,
|
|
@@ -154,6 +161,13 @@ const DropdownMenuItemLabel = ({ className, ...rest }) => {
|
|
|
154
161
|
});
|
|
155
162
|
};
|
|
156
163
|
DropdownMenuItemLabel.displayName = "DropdownMenuItemLabel";
|
|
164
|
+
const DropdownMenuItemDesc = ({ className, ...rest }) => {
|
|
165
|
+
return /* @__PURE__ */ jsx("span", {
|
|
166
|
+
...rest,
|
|
167
|
+
className: cx(styles.desc, className)
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
DropdownMenuItemDesc.displayName = "DropdownMenuItemDesc";
|
|
157
171
|
const DropdownMenuItemExtra = ({ className, ...rest }) => {
|
|
158
172
|
return /* @__PURE__ */ jsx("span", {
|
|
159
173
|
...rest,
|
|
@@ -178,9 +192,9 @@ const DropdownMenuSwitchItem = ({ checked: checkedProp, className, closeOnClick
|
|
|
178
192
|
}, [isControlled, onCheckedChange]);
|
|
179
193
|
return /* @__PURE__ */ jsxs(Menu$1.Item, {
|
|
180
194
|
...rest,
|
|
181
|
-
className: (state) => cx(styles.item, danger && styles.danger, typeof className === "function" ? className(state) : className),
|
|
182
195
|
closeOnClick,
|
|
183
196
|
disabled,
|
|
197
|
+
className: (state) => cx(styles.item, danger && styles.danger, typeof className === "function" ? className(state) : className),
|
|
184
198
|
onClick: (e) => {
|
|
185
199
|
e.preventDefault();
|
|
186
200
|
if (!disabled) handleCheckedChange(!checked);
|
|
@@ -188,15 +202,15 @@ const DropdownMenuSwitchItem = ({ checked: checkedProp, className, closeOnClick
|
|
|
188
202
|
children: [children, /* @__PURE__ */ jsx(Switch, {
|
|
189
203
|
checked,
|
|
190
204
|
disabled,
|
|
191
|
-
onChange: handleCheckedChange,
|
|
192
|
-
onClick: (_, e) => e.stopPropagation(),
|
|
193
205
|
size: "small",
|
|
194
|
-
style: { marginInlineStart: 16 }
|
|
206
|
+
style: { marginInlineStart: 16 },
|
|
207
|
+
onChange: handleCheckedChange,
|
|
208
|
+
onClick: (_, e) => e.stopPropagation()
|
|
195
209
|
})]
|
|
196
210
|
});
|
|
197
211
|
};
|
|
198
212
|
DropdownMenuSwitchItem.displayName = "DropdownMenuSwitchItem";
|
|
199
213
|
|
|
200
214
|
//#endregion
|
|
201
|
-
export { DROPDOWN_MENU_CONTAINER_ATTR, DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemExtra, DropdownMenuItemIcon, DropdownMenuItemLabel, DropdownMenuPopup, DropdownMenuPortal, DropdownMenuPositioner, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuSubmenuArrow, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSwitchItem, DropdownMenuTrigger };
|
|
215
|
+
export { DROPDOWN_MENU_CONTAINER_ATTR, DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemDesc, DropdownMenuItemExtra, DropdownMenuItemIcon, DropdownMenuItemLabel, DropdownMenuItemLabelGroup, DropdownMenuPopup, DropdownMenuPortal, DropdownMenuPositioner, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuSubmenuArrow, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSwitchItem, DropdownMenuTrigger };
|
|
202
216
|
//# sourceMappingURL=atoms.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atoms.mjs","names":["DropdownMenuRoot: typeof Menu.Root","Menu"],"sources":["../../src/DropdownMenu/atoms.tsx"],"sourcesContent":["'use client';\n\nimport { Menu } from '@base-ui/react/menu';\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport { Switch } from 'antd';\nimport { cx } from 'antd-style';\nimport clsx from 'clsx';\nimport type React from 'react';\nimport { cloneElement, isValidElement, useCallback, useState } from 'react';\nimport { mergeRefs } from 'react-merge-refs';\n\nimport { styles } from '@/Menu/sharedStyle';\nimport { FloatingLayerProvider } from '@/hooks/useFloatingLayer';\nimport { useNativeButton } from '@/hooks/useNativeButton';\nimport { usePortalContainer } from '@/hooks/usePortalContainer';\nimport { CLASSNAMES } from '@/styles/classNames';\nimport { placementMap } from '@/utils/placement';\n\nimport type { DropdownMenuPlacement } from './type';\n\nexport const DROPDOWN_MENU_CONTAINER_ATTR = 'data-lobe-ui-dropdown-menu-container';\n\nexport const DropdownMenuRoot: typeof Menu.Root = (props) => <Menu.Root modal={false} {...props} />;\nexport const DropdownMenuSubmenuRoot = Menu.SubmenuRoot;\nexport const DropdownMenuCheckboxItemIndicator = Menu.CheckboxItemIndicator;\n\nconst mergeStateClassName = <TState,>(\n base: string,\n className: string | ((state: TState) => string | undefined) | undefined,\n) => {\n if (typeof className === 'function') return (state: TState) => cx(base, className(state));\n return cx(base, className);\n};\n\nexport type DropdownMenuTriggerProps = Omit<\n React.ComponentPropsWithRef<typeof Menu.Trigger>,\n 'children' | 'render'\n> & {\n children: React.ReactNode;\n};\n\nexport const DropdownMenuTrigger = ({\n children,\n className,\n nativeButton,\n ref: refProp,\n ...rest\n}: DropdownMenuTriggerProps) => {\n const { isNativeButtonTriggerElement, resolvedNativeButton } = useNativeButton({\n children,\n nativeButton,\n });\n\n const renderer = (props: any) => {\n // Base UI's trigger props include `type=\"button\"` by default.\n // If we render into a non-<button> element, that prop is invalid and can warn.\n const resolvedProps = (() => {\n if (isNativeButtonTriggerElement) return props as any;\n // eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars\n const { type, ...restProps } = props as any;\n return restProps;\n })();\n\n const mergedProps = mergeProps((children as any).props, resolvedProps);\n return cloneElement(children as any, {\n ...mergedProps,\n className: clsx(CLASSNAMES.DropdownMenuTrigger, className, mergedProps.className),\n ref: mergeRefs([(children as any).ref, (props as any).ref, refProp]),\n });\n };\n\n if (isValidElement(children)) {\n return <Menu.Trigger {...rest} nativeButton={resolvedNativeButton} render={renderer as any} />;\n }\n\n return (\n <Menu.Trigger\n {...rest}\n className={clsx(CLASSNAMES.DropdownMenuTrigger, className)}\n nativeButton={resolvedNativeButton}\n ref={refProp as any}\n >\n {children}\n </Menu.Trigger>\n );\n};\n\nDropdownMenuTrigger.displayName = 'DropdownMenuTrigger';\n\nexport type DropdownMenuPortalProps = React.ComponentProps<typeof Menu.Portal> & {\n /**\n * When `container` is not provided, it uses a shared container created by `usePortalContainer`.\n */\n container?: HTMLElement | null;\n};\n\nexport const DropdownMenuPortal = ({ container, ...rest }: DropdownMenuPortalProps) => {\n const defaultContainer = usePortalContainer(DROPDOWN_MENU_CONTAINER_ATTR);\n return <Menu.Portal container={container ?? defaultContainer} {...rest} />;\n};\n\nDropdownMenuPortal.displayName = 'DropdownMenuPortal';\n\nexport type DropdownMenuPositionerProps = React.ComponentProps<typeof Menu.Positioner> & {\n hoverTrigger?: boolean;\n placement?: DropdownMenuPlacement;\n};\n\nexport const DropdownMenuPositioner = ({\n className,\n placement,\n hoverTrigger,\n align,\n side,\n sideOffset,\n children,\n ...rest\n}: DropdownMenuPositionerProps) => {\n const placementConfig = placement ? placementMap[placement] : undefined;\n const [positionerNode, setPositionerNode] = useState<HTMLDivElement | null>(null);\n\n return (\n <Menu.Positioner\n {...rest}\n align={align ?? placementConfig?.align}\n className={mergeStateClassName(styles.positioner, className as any) as any}\n data-hover-trigger={hoverTrigger || undefined}\n data-placement={placement}\n ref={setPositionerNode}\n side={side ?? placementConfig?.side}\n sideOffset={sideOffset ?? (placementConfig ? 6 : undefined)}\n >\n <FloatingLayerProvider value={positionerNode}>{children}</FloatingLayerProvider>\n </Menu.Positioner>\n );\n};\n\nDropdownMenuPositioner.displayName = 'DropdownMenuPositioner';\n\nexport type DropdownMenuPopupProps = React.ComponentProps<typeof Menu.Popup>;\n\nexport const DropdownMenuPopup = ({ className, ...rest }: DropdownMenuPopupProps) => {\n return (\n <Menu.Popup {...rest} className={mergeStateClassName(styles.popup, className as any) as any} />\n );\n};\n\nDropdownMenuPopup.displayName = 'DropdownMenuPopup';\n\nexport type DropdownMenuItemProps = React.ComponentProps<typeof Menu.Item> & { danger?: boolean };\n\nexport const DropdownMenuItem = ({ className, danger, ...rest }: DropdownMenuItemProps) => {\n return (\n <Menu.Item\n {...rest}\n className={(state) =>\n cx(\n styles.item,\n danger && styles.danger,\n typeof className === 'function' ? className(state) : className,\n )\n }\n />\n );\n};\n\nDropdownMenuItem.displayName = 'DropdownMenuItem';\n\nexport type DropdownMenuCheckboxItemProps = React.ComponentProps<typeof Menu.CheckboxItem> & {\n danger?: boolean;\n};\n\nexport const DropdownMenuCheckboxItemPrimitive = ({\n className,\n danger,\n ...rest\n}: DropdownMenuCheckboxItemProps) => {\n return (\n <Menu.CheckboxItem\n {...rest}\n className={(state) =>\n cx(\n styles.item,\n danger && styles.danger,\n typeof className === 'function' ? className(state) : className,\n )\n }\n />\n );\n};\n\nDropdownMenuCheckboxItemPrimitive.displayName = 'DropdownMenuCheckboxItemPrimitive';\n\nexport type DropdownMenuSeparatorProps = React.ComponentProps<typeof Menu.Separator>;\n\nexport const DropdownMenuSeparator = ({ className, ...rest }: DropdownMenuSeparatorProps) => {\n return (\n <Menu.Separator\n {...rest}\n className={(state) =>\n cx(styles.separator, typeof className === 'function' ? className(state) : className)\n }\n />\n );\n};\n\nDropdownMenuSeparator.displayName = 'DropdownMenuSeparator';\n\nexport const DropdownMenuGroup = Menu.Group;\n\nexport type DropdownMenuGroupLabelProps = React.ComponentProps<typeof Menu.GroupLabel>;\n\nexport const DropdownMenuGroupLabel = ({ className, ...rest }: DropdownMenuGroupLabelProps) => {\n return (\n <Menu.GroupLabel\n {...rest}\n className={(state) =>\n cx(styles.groupLabel, typeof className === 'function' ? className(state) : className)\n }\n />\n );\n};\n\nDropdownMenuGroupLabel.displayName = 'DropdownMenuGroupLabel';\n\nexport type DropdownMenuSubmenuTriggerProps = React.ComponentProps<typeof Menu.SubmenuTrigger> & {\n danger?: boolean;\n};\n\nexport const DropdownMenuSubmenuTrigger = ({\n className,\n danger,\n ...rest\n}: DropdownMenuSubmenuTriggerProps) => {\n return (\n <Menu.SubmenuTrigger\n {...rest}\n className={(state) =>\n cx(\n styles.item,\n danger && styles.danger,\n typeof className === 'function' ? className(state) : className,\n )\n }\n />\n );\n};\n\nDropdownMenuSubmenuTrigger.displayName = 'DropdownMenuSubmenuTrigger';\n\nexport type DropdownMenuItemContentProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const DropdownMenuItemContent = ({ className, ...rest }: DropdownMenuItemContentProps) => {\n return <div {...rest} className={cx(styles.itemContent, className)} />;\n};\n\nDropdownMenuItemContent.displayName = 'DropdownMenuItemContent';\n\nexport type DropdownMenuItemIconProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuItemIcon = ({ className, ...rest }: DropdownMenuItemIconProps) => {\n return <span {...rest} className={cx(styles.icon, className)} />;\n};\n\nDropdownMenuItemIcon.displayName = 'DropdownMenuItemIcon';\n\nexport type DropdownMenuItemLabelProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuItemLabel = ({ className, ...rest }: DropdownMenuItemLabelProps) => {\n return <span {...rest} className={cx(styles.label, className)} />;\n};\n\nDropdownMenuItemLabel.displayName = 'DropdownMenuItemLabel';\n\nexport type DropdownMenuItemExtraProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuItemExtra = ({ className, ...rest }: DropdownMenuItemExtraProps) => {\n return <span {...rest} className={cx(styles.extra, className)} />;\n};\n\nDropdownMenuItemExtra.displayName = 'DropdownMenuItemExtra';\n\nexport type DropdownMenuSubmenuArrowProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuSubmenuArrow = ({ className, ...rest }: DropdownMenuSubmenuArrowProps) => {\n return <span {...rest} className={cx(styles.submenuArrow, className)} />;\n};\n\nDropdownMenuSubmenuArrow.displayName = 'DropdownMenuSubmenuArrow';\n\nexport type DropdownMenuSwitchItemProps = Omit<\n React.ComponentProps<typeof Menu.Item>,\n 'onClick'\n> & {\n checked?: boolean;\n closeOnClick?: boolean;\n danger?: boolean;\n defaultChecked?: boolean;\n onCheckedChange?: (checked: boolean) => void;\n};\n\nexport const DropdownMenuSwitchItem = ({\n checked: checkedProp,\n className,\n closeOnClick = false,\n danger,\n defaultChecked,\n disabled,\n onCheckedChange,\n children,\n ...rest\n}: DropdownMenuSwitchItemProps) => {\n const [internalChecked, setInternalChecked] = useState(defaultChecked ?? false);\n const isControlled = checkedProp !== undefined;\n const checked = isControlled ? checkedProp : internalChecked;\n\n const handleCheckedChange = useCallback(\n (newChecked: boolean) => {\n if (!isControlled) {\n setInternalChecked(newChecked);\n }\n onCheckedChange?.(newChecked);\n },\n [isControlled, onCheckedChange],\n );\n\n return (\n <Menu.Item\n {...rest}\n className={(state) =>\n cx(\n styles.item,\n danger && styles.danger,\n typeof className === 'function' ? className(state) : className,\n )\n }\n closeOnClick={closeOnClick}\n disabled={disabled}\n onClick={(e) => {\n e.preventDefault();\n if (!disabled) {\n handleCheckedChange(!checked);\n }\n }}\n >\n {children}\n <Switch\n checked={checked}\n disabled={disabled}\n onChange={handleCheckedChange}\n onClick={(_, e) => e.stopPropagation()}\n size=\"small\"\n style={{ marginInlineStart: 16 }}\n />\n </Menu.Item>\n );\n};\n\nDropdownMenuSwitchItem.displayName = 'DropdownMenuSwitchItem';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAoBA,MAAa,+BAA+B;AAE5C,MAAaA,oBAAsC,UAAU,oBAACC,OAAK;CAAK,OAAO;CAAO,GAAI;EAAS;AACnG,MAAa,0BAA0BA,OAAK;AAC5C,MAAa,oCAAoCA,OAAK;AAEtD,MAAM,uBACJ,MACA,cACG;AACH,KAAI,OAAO,cAAc,WAA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U,OAAO,QACjB,OAAO,cAAc,aAAa,UAAU,MAAM,GAAG,UACtD;EAEW;EACJ;EACV,UAAU,MAAM;AACd,KAAE,gBAAgB;AAClB,OAAI,CAAC,SACH,qBAAoB,CAAC,QAAQ;;aAIhC,UACD,oBAAC;GACU;GACC;GACV,UAAU;GACV,UAAU,GAAG,MAAM,EAAE,iBAAiB;GACtC,MAAK;GACL,OAAO,EAAE,mBAAmB,IAAI;IAChC;GACQ;;AAIhB,uBAAuB,cAAc"}
|
|
1
|
+
{"version":3,"file":"atoms.mjs","names":["DropdownMenuRoot: typeof Menu.Root","Menu"],"sources":["../../src/DropdownMenu/atoms.tsx"],"sourcesContent":["'use client';\n\nimport { Menu } from '@base-ui/react/menu';\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport { Switch } from 'antd';\nimport { cx } from 'antd-style';\nimport clsx from 'clsx';\nimport type React from 'react';\nimport { cloneElement, isValidElement, useCallback, useState } from 'react';\nimport { mergeRefs } from 'react-merge-refs';\n\nimport { FloatingLayerProvider } from '@/hooks/useFloatingLayer';\nimport { useNativeButton } from '@/hooks/useNativeButton';\nimport { usePortalContainer } from '@/hooks/usePortalContainer';\nimport { styles } from '@/Menu/sharedStyle';\nimport { CLASSNAMES } from '@/styles/classNames';\nimport { placementMap } from '@/utils/placement';\n\nimport { type DropdownMenuPlacement } from './type';\n\nexport const DROPDOWN_MENU_CONTAINER_ATTR = 'data-lobe-ui-dropdown-menu-container';\n\nexport const DropdownMenuRoot: typeof Menu.Root = (props) => <Menu.Root modal={false} {...props} />;\nexport const DropdownMenuSubmenuRoot = Menu.SubmenuRoot;\nexport const DropdownMenuCheckboxItemIndicator = Menu.CheckboxItemIndicator;\n\nconst mergeStateClassName = <TState,>(\n base: string,\n className: string | ((state: TState) => string | undefined) | undefined,\n) => {\n if (typeof className === 'function') return (state: TState) => cx(base, className(state));\n return cx(base, className);\n};\n\nexport type DropdownMenuTriggerProps = Omit<\n React.ComponentPropsWithRef<typeof Menu.Trigger>,\n 'children' | 'render'\n> & {\n children: React.ReactNode;\n};\n\nexport const DropdownMenuTrigger = ({\n children,\n className,\n nativeButton,\n ref: refProp,\n ...rest\n}: DropdownMenuTriggerProps) => {\n const { isNativeButtonTriggerElement, resolvedNativeButton } = useNativeButton({\n children,\n nativeButton,\n });\n\n const renderer = (props: any) => {\n // Base UI's trigger props include `type=\"button\"` by default.\n // If we render into a non-<button> element, that prop is invalid and can warn.\n const resolvedProps = (() => {\n if (isNativeButtonTriggerElement) return props as any;\n // eslint-disable-next-line unused-imports/no-unused-vars\n const { type, ...restProps } = props as any;\n return restProps;\n })();\n\n const mergedProps = mergeProps((children as any).props, resolvedProps);\n return cloneElement(children as any, {\n ...mergedProps,\n className: clsx(CLASSNAMES.DropdownMenuTrigger, className, mergedProps.className),\n ref: mergeRefs([(children as any).ref, (props as any).ref, refProp]),\n });\n };\n\n if (isValidElement(children)) {\n return <Menu.Trigger {...rest} nativeButton={resolvedNativeButton} render={renderer as any} />;\n }\n\n return (\n <Menu.Trigger\n {...rest}\n className={clsx(CLASSNAMES.DropdownMenuTrigger, className)}\n nativeButton={resolvedNativeButton}\n ref={refProp as any}\n >\n {children}\n </Menu.Trigger>\n );\n};\n\nDropdownMenuTrigger.displayName = 'DropdownMenuTrigger';\n\nexport type DropdownMenuPortalProps = React.ComponentProps<typeof Menu.Portal> & {\n /**\n * When `container` is not provided, it uses a shared container created by `usePortalContainer`.\n */\n container?: HTMLElement | null;\n};\n\nexport const DropdownMenuPortal = ({ container, ...rest }: DropdownMenuPortalProps) => {\n const defaultContainer = usePortalContainer(DROPDOWN_MENU_CONTAINER_ATTR);\n return <Menu.Portal container={container ?? defaultContainer} {...rest} />;\n};\n\nDropdownMenuPortal.displayName = 'DropdownMenuPortal';\n\nexport type DropdownMenuPositionerProps = React.ComponentProps<typeof Menu.Positioner> & {\n hoverTrigger?: boolean;\n placement?: DropdownMenuPlacement;\n};\n\nexport const DropdownMenuPositioner = ({\n className,\n placement,\n hoverTrigger,\n align,\n side,\n sideOffset,\n children,\n ...rest\n}: DropdownMenuPositionerProps) => {\n const placementConfig = placement ? placementMap[placement] : undefined;\n const [positionerNode, setPositionerNode] = useState<HTMLDivElement | null>(null);\n\n return (\n <Menu.Positioner\n {...rest}\n align={align ?? placementConfig?.align}\n className={mergeStateClassName(styles.positioner, className as any) as any}\n data-hover-trigger={hoverTrigger || undefined}\n data-placement={placement}\n ref={setPositionerNode}\n side={side ?? placementConfig?.side}\n sideOffset={sideOffset ?? (placementConfig ? 6 : undefined)}\n >\n <FloatingLayerProvider value={positionerNode}>{children}</FloatingLayerProvider>\n </Menu.Positioner>\n );\n};\n\nDropdownMenuPositioner.displayName = 'DropdownMenuPositioner';\n\nexport type DropdownMenuPopupProps = React.ComponentProps<typeof Menu.Popup>;\n\nexport const DropdownMenuPopup = ({ className, ...rest }: DropdownMenuPopupProps) => {\n return (\n <Menu.Popup {...rest} className={mergeStateClassName(styles.popup, className as any) as any} />\n );\n};\n\nDropdownMenuPopup.displayName = 'DropdownMenuPopup';\n\nexport type DropdownMenuItemProps = React.ComponentProps<typeof Menu.Item> & { danger?: boolean };\n\nexport const DropdownMenuItem = ({ className, danger, ...rest }: DropdownMenuItemProps) => {\n return (\n <Menu.Item\n {...rest}\n className={(state) =>\n cx(\n styles.item,\n danger && styles.danger,\n typeof className === 'function' ? className(state) : className,\n )\n }\n />\n );\n};\n\nDropdownMenuItem.displayName = 'DropdownMenuItem';\n\nexport type DropdownMenuCheckboxItemProps = React.ComponentProps<typeof Menu.CheckboxItem> & {\n danger?: boolean;\n};\n\nexport const DropdownMenuCheckboxItemPrimitive = ({\n className,\n danger,\n ...rest\n}: DropdownMenuCheckboxItemProps) => {\n return (\n <Menu.CheckboxItem\n {...rest}\n className={(state) =>\n cx(\n styles.item,\n danger && styles.danger,\n typeof className === 'function' ? className(state) : className,\n )\n }\n />\n );\n};\n\nDropdownMenuCheckboxItemPrimitive.displayName = 'DropdownMenuCheckboxItemPrimitive';\n\nexport type DropdownMenuSeparatorProps = React.ComponentProps<typeof Menu.Separator>;\n\nexport const DropdownMenuSeparator = ({ className, ...rest }: DropdownMenuSeparatorProps) => {\n return (\n <Menu.Separator\n {...rest}\n className={(state) =>\n cx(styles.separator, typeof className === 'function' ? className(state) : className)\n }\n />\n );\n};\n\nDropdownMenuSeparator.displayName = 'DropdownMenuSeparator';\n\nexport const DropdownMenuGroup = Menu.Group;\n\nexport type DropdownMenuGroupLabelProps = React.ComponentProps<typeof Menu.GroupLabel>;\n\nexport const DropdownMenuGroupLabel = ({ className, ...rest }: DropdownMenuGroupLabelProps) => {\n return (\n <Menu.GroupLabel\n {...rest}\n className={(state) =>\n cx(styles.groupLabel, typeof className === 'function' ? className(state) : className)\n }\n />\n );\n};\n\nDropdownMenuGroupLabel.displayName = 'DropdownMenuGroupLabel';\n\nexport type DropdownMenuSubmenuTriggerProps = React.ComponentProps<typeof Menu.SubmenuTrigger> & {\n danger?: boolean;\n};\n\nexport const DropdownMenuSubmenuTrigger = ({\n className,\n danger,\n ...rest\n}: DropdownMenuSubmenuTriggerProps) => {\n return (\n <Menu.SubmenuTrigger\n {...rest}\n className={(state) =>\n cx(\n styles.item,\n danger && styles.danger,\n typeof className === 'function' ? className(state) : className,\n )\n }\n />\n );\n};\n\nDropdownMenuSubmenuTrigger.displayName = 'DropdownMenuSubmenuTrigger';\n\nexport type DropdownMenuItemContentProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const DropdownMenuItemContent = ({ className, ...rest }: DropdownMenuItemContentProps) => {\n return <div {...rest} className={cx(styles.itemContent, className)} />;\n};\n\nDropdownMenuItemContent.displayName = 'DropdownMenuItemContent';\n\nexport type DropdownMenuItemIconProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuItemIcon = ({ className, ...rest }: DropdownMenuItemIconProps) => {\n return <span {...rest} className={cx(styles.icon, className)} />;\n};\n\nDropdownMenuItemIcon.displayName = 'DropdownMenuItemIcon';\n\nexport type DropdownMenuItemLabelGroupProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const DropdownMenuItemLabelGroup = ({\n className,\n ...rest\n}: DropdownMenuItemLabelGroupProps) => {\n return <div {...rest} className={cx(styles.labelGroup, className)} />;\n};\n\nDropdownMenuItemLabelGroup.displayName = 'DropdownMenuItemLabelGroup';\n\nexport type DropdownMenuItemLabelProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuItemLabel = ({ className, ...rest }: DropdownMenuItemLabelProps) => {\n return <span {...rest} className={cx(styles.label, className)} />;\n};\n\nDropdownMenuItemLabel.displayName = 'DropdownMenuItemLabel';\n\nexport type DropdownMenuItemDescProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuItemDesc = ({ className, ...rest }: DropdownMenuItemDescProps) => {\n return <span {...rest} className={cx(styles.desc, className)} />;\n};\n\nDropdownMenuItemDesc.displayName = 'DropdownMenuItemDesc';\n\nexport type DropdownMenuItemExtraProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuItemExtra = ({ className, ...rest }: DropdownMenuItemExtraProps) => {\n return <span {...rest} className={cx(styles.extra, className)} />;\n};\n\nDropdownMenuItemExtra.displayName = 'DropdownMenuItemExtra';\n\nexport type DropdownMenuSubmenuArrowProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuSubmenuArrow = ({ className, ...rest }: DropdownMenuSubmenuArrowProps) => {\n return <span {...rest} className={cx(styles.submenuArrow, className)} />;\n};\n\nDropdownMenuSubmenuArrow.displayName = 'DropdownMenuSubmenuArrow';\n\nexport type DropdownMenuSwitchItemProps = Omit<\n React.ComponentProps<typeof Menu.Item>,\n 'onClick'\n> & {\n checked?: boolean;\n closeOnClick?: boolean;\n danger?: boolean;\n defaultChecked?: boolean;\n onCheckedChange?: (checked: boolean) => void;\n};\n\nexport const DropdownMenuSwitchItem = ({\n checked: checkedProp,\n className,\n closeOnClick = false,\n danger,\n defaultChecked,\n disabled,\n onCheckedChange,\n children,\n ...rest\n}: DropdownMenuSwitchItemProps) => {\n const [internalChecked, setInternalChecked] = useState(defaultChecked ?? false);\n const isControlled = checkedProp !== undefined;\n const checked = isControlled ? checkedProp : internalChecked;\n\n const handleCheckedChange = useCallback(\n (newChecked: boolean) => {\n if (!isControlled) {\n setInternalChecked(newChecked);\n }\n onCheckedChange?.(newChecked);\n },\n [isControlled, onCheckedChange],\n );\n\n return (\n <Menu.Item\n {...rest}\n closeOnClick={closeOnClick}\n disabled={disabled}\n className={(state) =>\n cx(\n styles.item,\n danger && styles.danger,\n typeof className === 'function' ? className(state) : className,\n )\n }\n onClick={(e) => {\n e.preventDefault();\n if (!disabled) {\n handleCheckedChange(!checked);\n }\n }}\n >\n {children}\n <Switch\n checked={checked}\n disabled={disabled}\n size=\"small\"\n style={{ marginInlineStart: 16 }}\n onChange={handleCheckedChange}\n onClick={(_, e) => e.stopPropagation()}\n />\n </Menu.Item>\n );\n};\n\nDropdownMenuSwitchItem.displayName = 'DropdownMenuSwitchItem';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAoBA,MAAa,+BAA+B;AAE5C,MAAaA,oBAAsC,UAAU,oBAACC,OAAK;CAAK,OAAO;CAAO,GAAI;EAAS;AACnG,MAAa,0BAA0BA,OAAK;AAC5C,MAAa,oCAAoCA,OAAK;AAEtD,MAAM,uBACJ,MACA,cACG;AACH,KAAI,OAAO,cAAc,WAAY,SAAQ,UAAkB,GAAG,MAAM,UAAU,MAAM,CAAC;AACzF,QAAO,GAAG,MAAM,UAAU;;AAU5B,MAAa,uBAAuB,EAClC,UACA,WACA,cACA,KAAK,SACL,GAAG,WAC2B;CAC9B,MAAM,EAAE,8BAA8B,yBAAyB,gBAAgB;EAC7E;EACA;EACD,CAAC;CAEF,MAAM,YAAY,UAAe;EAG/B,MAAM,uBAAuB;AAC3B,OAAI,6BAA8B,QAAO;GAEzC,MAAM,EAAE,MAAM,GAAG,cAAc;AAC/B,UAAO;MACL;EAEJ,MAAM,cAAc,WAAY,SAAiB,OAAO,cA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AgB;AAClB,OAAI,CAAC,SACH,qBAAoB,CAAC,QAAQ;;aAIhC,UACD,oBAAC;GACU;GACC;GACV,MAAK;GACL,OAAO,EAAE,mBAAmB,IAAI;GAChC,UAAU;GACV,UAAU,GAAG,MAAM,EAAE,iBAAiB;IACtC;GACQ;;AAIhB,uBAAuB,cAAc"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IconSpaceMode } from "../Menu/renderUtils.mjs";
|
|
2
2
|
import { renderDropdownMenuItems } from "./renderItems.mjs";
|
|
3
3
|
import { DropdownItem, DropdownMenuCheckboxItem, DropdownMenuPlacement, DropdownMenuProps, DropdownMenuSwitchItem as DropdownMenuSwitchItem$1 } from "./type.mjs";
|
|
4
|
-
import { DROPDOWN_MENU_CONTAINER_ATTR, DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuCheckboxItemProps, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuGroupLabelProps, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemContentProps, DropdownMenuItemExtra, DropdownMenuItemExtraProps, DropdownMenuItemIcon, DropdownMenuItemIconProps, DropdownMenuItemLabel, DropdownMenuItemLabelProps, DropdownMenuItemProps, DropdownMenuPopup, DropdownMenuPopupProps, DropdownMenuPortal, DropdownMenuPortalProps, DropdownMenuPositioner, DropdownMenuPositionerProps, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuSeparatorProps, DropdownMenuSubmenuArrow, DropdownMenuSubmenuArrowProps, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSubmenuTriggerProps, DropdownMenuSwitchItem, DropdownMenuSwitchItemProps, DropdownMenuTrigger, DropdownMenuTriggerProps } from "./atoms.mjs";
|
|
4
|
+
import { DROPDOWN_MENU_CONTAINER_ATTR, DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuCheckboxItemProps, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuGroupLabelProps, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemContentProps, DropdownMenuItemDesc, DropdownMenuItemDescProps, DropdownMenuItemExtra, DropdownMenuItemExtraProps, DropdownMenuItemIcon, DropdownMenuItemIconProps, DropdownMenuItemLabel, DropdownMenuItemLabelGroup, DropdownMenuItemLabelGroupProps, DropdownMenuItemLabelProps, DropdownMenuItemProps, DropdownMenuPopup, DropdownMenuPopupProps, DropdownMenuPortal, DropdownMenuPortalProps, DropdownMenuPositioner, DropdownMenuPositionerProps, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuSeparatorProps, DropdownMenuSubmenuArrow, DropdownMenuSubmenuArrowProps, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSubmenuTriggerProps, DropdownMenuSwitchItem, DropdownMenuSwitchItemProps, DropdownMenuTrigger, DropdownMenuTriggerProps } from "./atoms.mjs";
|
|
5
5
|
import { DropdownMenu } from "./DropdownMenu.mjs";
|
|
6
|
-
export { DROPDOWN_MENU_CONTAINER_ATTR, type DropdownItem, type DropdownMenuCheckboxItem, DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, type DropdownMenuCheckboxItemProps, DropdownMenuGroup, DropdownMenuGroupLabel, type DropdownMenuGroupLabelProps, DropdownMenuItem, DropdownMenuItemContent, type DropdownMenuItemContentProps, DropdownMenuItemExtra, type DropdownMenuItemExtraProps, DropdownMenuItemIcon, type DropdownMenuItemIconProps, DropdownMenuItemLabel, type DropdownMenuItemLabelProps, type DropdownMenuItemProps, type DropdownMenuPlacement, DropdownMenuPopup, type DropdownMenuPopupProps, DropdownMenuPortal, type DropdownMenuPortalProps, DropdownMenuPositioner, type DropdownMenuPositionerProps, type DropdownMenuProps, DropdownMenuRoot, DropdownMenuSeparator, type DropdownMenuSeparatorProps, DropdownMenuSubmenuArrow, type DropdownMenuSubmenuArrowProps, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, type DropdownMenuSubmenuTriggerProps, DropdownMenuSwitchItem, type DropdownMenuSwitchItemProps, type DropdownMenuSwitchItem$1 as DropdownMenuSwitchItemType, DropdownMenuTrigger, type DropdownMenuTriggerProps, type IconSpaceMode, DropdownMenu as default, renderDropdownMenuItems };
|
|
6
|
+
export { DROPDOWN_MENU_CONTAINER_ATTR, type DropdownItem, type DropdownMenuCheckboxItem, DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, type DropdownMenuCheckboxItemProps, DropdownMenuGroup, DropdownMenuGroupLabel, type DropdownMenuGroupLabelProps, DropdownMenuItem, DropdownMenuItemContent, type DropdownMenuItemContentProps, DropdownMenuItemDesc, type DropdownMenuItemDescProps, DropdownMenuItemExtra, type DropdownMenuItemExtraProps, DropdownMenuItemIcon, type DropdownMenuItemIconProps, DropdownMenuItemLabel, DropdownMenuItemLabelGroup, type DropdownMenuItemLabelGroupProps, type DropdownMenuItemLabelProps, type DropdownMenuItemProps, type DropdownMenuPlacement, DropdownMenuPopup, type DropdownMenuPopupProps, DropdownMenuPortal, type DropdownMenuPortalProps, DropdownMenuPositioner, type DropdownMenuPositionerProps, type DropdownMenuProps, DropdownMenuRoot, DropdownMenuSeparator, type DropdownMenuSeparatorProps, DropdownMenuSubmenuArrow, type DropdownMenuSubmenuArrowProps, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, type DropdownMenuSubmenuTriggerProps, DropdownMenuSwitchItem, type DropdownMenuSwitchItemProps, type DropdownMenuSwitchItem$1 as DropdownMenuSwitchItemType, DropdownMenuTrigger, type DropdownMenuTriggerProps, type IconSpaceMode, DropdownMenu as default, renderDropdownMenuItems };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DROPDOWN_MENU_CONTAINER_ATTR, DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemExtra, DropdownMenuItemIcon, DropdownMenuItemLabel, DropdownMenuPopup, DropdownMenuPortal, DropdownMenuPositioner, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuSubmenuArrow, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSwitchItem, DropdownMenuTrigger } from "./atoms.mjs";
|
|
1
|
+
import { DROPDOWN_MENU_CONTAINER_ATTR, DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemDesc, DropdownMenuItemExtra, DropdownMenuItemIcon, DropdownMenuItemLabel, DropdownMenuItemLabelGroup, DropdownMenuPopup, DropdownMenuPortal, DropdownMenuPositioner, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuSubmenuArrow, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSwitchItem, DropdownMenuTrigger } from "./atoms.mjs";
|
|
2
2
|
import { renderDropdownMenuItems } from "./renderItems.mjs";
|
|
3
3
|
import DropdownMenu_default from "./DropdownMenu.mjs";
|
|
4
4
|
|
|
5
|
-
export { DROPDOWN_MENU_CONTAINER_ATTR, DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemExtra, DropdownMenuItemIcon, DropdownMenuItemLabel, DropdownMenuPopup, DropdownMenuPortal, DropdownMenuPositioner, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuSubmenuArrow, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSwitchItem, DropdownMenuTrigger, DropdownMenu_default as default, renderDropdownMenuItems };
|
|
5
|
+
export { DROPDOWN_MENU_CONTAINER_ATTR, DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemDesc, DropdownMenuItemExtra, DropdownMenuItemIcon, DropdownMenuItemLabel, DropdownMenuItemLabelGroup, DropdownMenuPopup, DropdownMenuPortal, DropdownMenuPositioner, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuSubmenuArrow, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSwitchItem, DropdownMenuTrigger, DropdownMenu_default as default, renderDropdownMenuItems };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { styles } from "../Menu/sharedStyle.mjs";
|
|
2
|
+
import { DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemDesc, DropdownMenuItemExtra, DropdownMenuItemIcon, DropdownMenuItemLabel, DropdownMenuItemLabelGroup, DropdownMenuPopup, DropdownMenuPortal, DropdownMenuPositioner, DropdownMenuSeparator, DropdownMenuSubmenuArrow, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSwitchItem } from "./atoms.mjs";
|
|
2
3
|
import { getItemKey, getItemLabel, hasAnyIcon, hasCheckboxAndIcon, renderIcon } from "../Menu/renderUtils.mjs";
|
|
3
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
5
|
import { Check, ChevronRight } from "lucide-react";
|
|
@@ -6,20 +7,28 @@ import { Check, ChevronRight } from "lucide-react";
|
|
|
6
7
|
//#region src/DropdownMenu/renderItems.tsx
|
|
7
8
|
const renderItemContent = (item, options, iconNode) => {
|
|
8
9
|
const label = getItemLabel(item);
|
|
10
|
+
const desc = "desc" in item ? item.desc : void 0;
|
|
9
11
|
const extra = "extra" in item ? item.extra : void 0;
|
|
10
12
|
const indicatorOnRight = options?.indicatorOnRight;
|
|
13
|
+
const alignStart = Boolean(desc) && options?.iconAlign === "start";
|
|
11
14
|
const hasCustomIcon = iconNode !== void 0 && !indicatorOnRight;
|
|
12
15
|
const hasIcon = hasCustomIcon ? Boolean(iconNode) : Boolean(item.icon);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
const shouldRenderIcon = hasCustomIcon ? Boolean(options?.reserveIconSpace || iconNode) : Boolean(hasIcon || options?.reserveIconSpace);
|
|
17
|
+
const labelNode = desc ? /* @__PURE__ */ jsxs(DropdownMenuItemLabelGroup, { children: [/* @__PURE__ */ jsx(DropdownMenuItemLabel, { children: label }), /* @__PURE__ */ jsx(DropdownMenuItemDesc, { children: desc })] }) : /* @__PURE__ */ jsx(DropdownMenuItemLabel, { children: label });
|
|
18
|
+
return /* @__PURE__ */ jsxs(DropdownMenuItemContent, {
|
|
19
|
+
className: alignStart ? styles.itemContentAlignStart : void 0,
|
|
20
|
+
children: [
|
|
21
|
+
shouldRenderIcon ? /* @__PURE__ */ jsx(DropdownMenuItemIcon, {
|
|
22
|
+
"aria-hidden": !hasIcon,
|
|
23
|
+
className: alignStart ? styles.iconAlignStart : void 0,
|
|
24
|
+
children: hasCustomIcon ? iconNode : hasIcon ? renderIcon(item.icon) : null
|
|
25
|
+
}) : null,
|
|
26
|
+
labelNode,
|
|
27
|
+
extra ? /* @__PURE__ */ jsx(DropdownMenuItemExtra, { children: extra }) : null,
|
|
28
|
+
indicatorOnRight && iconNode ? iconNode : null,
|
|
29
|
+
options?.submenu ? /* @__PURE__ */ jsx(DropdownMenuSubmenuArrow, { children: /* @__PURE__ */ jsx(ChevronRight, { size: 16 }) }) : null
|
|
30
|
+
]
|
|
31
|
+
});
|
|
23
32
|
};
|
|
24
33
|
const invokeItemClick = (item, keyPath, event) => {
|
|
25
34
|
if (!item.onClick) return;
|
|
@@ -33,6 +42,7 @@ const invokeItemClick = (item, keyPath, event) => {
|
|
|
33
42
|
item.onClick(info);
|
|
34
43
|
};
|
|
35
44
|
const renderDropdownMenuItems = (items, keyPath = [], options) => {
|
|
45
|
+
const iconAlign = options?.iconAlign;
|
|
36
46
|
const iconSpaceMode = options?.iconSpaceMode ?? "global";
|
|
37
47
|
const reserveIconSpace = options?.reserveIconSpace ?? hasAnyIcon(items, iconSpaceMode === "global");
|
|
38
48
|
const indicatorOnRight = options?.indicatorOnRight ?? hasCheckboxAndIcon(items);
|
|
@@ -55,6 +65,7 @@ const renderDropdownMenuItems = (items, keyPath = [], options) => {
|
|
|
55
65
|
label: labelText$1,
|
|
56
66
|
onCheckedChange: (checked) => checkboxItem.onCheckedChange?.(checked),
|
|
57
67
|
children: renderItemContent(checkboxItem, {
|
|
68
|
+
iconAlign,
|
|
58
69
|
indicatorOnRight,
|
|
59
70
|
reserveIconSpace
|
|
60
71
|
}, indicator)
|
|
@@ -73,7 +84,10 @@ const renderDropdownMenuItems = (items, keyPath = [], options) => {
|
|
|
73
84
|
disabled: switchItem.disabled,
|
|
74
85
|
label: labelText$1,
|
|
75
86
|
onCheckedChange: (checked) => switchItem.onCheckedChange?.(checked),
|
|
76
|
-
children: renderItemContent(switchItem, {
|
|
87
|
+
children: renderItemContent(switchItem, {
|
|
88
|
+
iconAlign,
|
|
89
|
+
reserveIconSpace
|
|
90
|
+
})
|
|
77
91
|
}, itemKey);
|
|
78
92
|
}
|
|
79
93
|
if (item.type === "divider") return /* @__PURE__ */ jsx(DropdownMenuSeparator, {}, itemKey);
|
|
@@ -82,6 +96,7 @@ const renderDropdownMenuItems = (items, keyPath = [], options) => {
|
|
|
82
96
|
const groupReserveIconSpace = iconSpaceMode === "group" ? group.children ? hasAnyIcon(group.children) : false : reserveIconSpace;
|
|
83
97
|
const groupIndicatorOnRight = group.children ? hasCheckboxAndIcon(group.children) : false;
|
|
84
98
|
return /* @__PURE__ */ jsxs(DropdownMenuGroup, { children: [group.label ? /* @__PURE__ */ jsx(DropdownMenuGroupLabel, { children: group.label }) : null, group.children ? renderDropdownMenuItems(group.children, nextKeyPath, {
|
|
99
|
+
iconAlign,
|
|
85
100
|
iconSpaceMode,
|
|
86
101
|
indicatorOnRight: groupIndicatorOnRight,
|
|
87
102
|
reserveIconSpace: groupReserveIconSpace
|
|
@@ -96,6 +111,7 @@ const renderDropdownMenuItems = (items, keyPath = [], options) => {
|
|
|
96
111
|
disabled: submenu.disabled,
|
|
97
112
|
label: labelText$1,
|
|
98
113
|
children: renderItemContent(submenu, {
|
|
114
|
+
iconAlign,
|
|
99
115
|
reserveIconSpace,
|
|
100
116
|
submenu: true
|
|
101
117
|
})
|
|
@@ -103,7 +119,10 @@ const renderDropdownMenuItems = (items, keyPath = [], options) => {
|
|
|
103
119
|
alignOffset: -4,
|
|
104
120
|
"data-submenu": "",
|
|
105
121
|
sideOffset: -1,
|
|
106
|
-
children: /* @__PURE__ */ jsx(DropdownMenuPopup, { children: submenu.children ? renderDropdownMenuItems(submenu.children, nextKeyPath, {
|
|
122
|
+
children: /* @__PURE__ */ jsx(DropdownMenuPopup, { children: submenu.children ? renderDropdownMenuItems(submenu.children, nextKeyPath, {
|
|
123
|
+
iconAlign,
|
|
124
|
+
iconSpaceMode
|
|
125
|
+
}) : null })
|
|
107
126
|
}) })] }, itemKey);
|
|
108
127
|
}
|
|
109
128
|
const menuItem = item;
|
|
@@ -116,7 +135,10 @@ const renderDropdownMenuItems = (items, keyPath = [], options) => {
|
|
|
116
135
|
disabled: menuItem.disabled,
|
|
117
136
|
label: labelText,
|
|
118
137
|
onClick: (event) => invokeItemClick(menuItem, nextKeyPath, event),
|
|
119
|
-
children: renderItemContent(menuItem, {
|
|
138
|
+
children: renderItemContent(menuItem, {
|
|
139
|
+
iconAlign,
|
|
140
|
+
reserveIconSpace
|
|
141
|
+
})
|
|
120
142
|
}, itemKey);
|
|
121
143
|
});
|
|
122
144
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderItems.mjs","names":["info: MenuInfo","label","labelText","isDanger"],"sources":["../../src/DropdownMenu/renderItems.tsx"],"sourcesContent":["import { Check, ChevronRight } from 'lucide-react';\nimport type { MenuInfo } from 'rc-menu/es/interface';\nimport type {\n KeyboardEvent as ReactKeyboardEvent,\n MouseEvent as ReactMouseEvent,\n ReactNode,\n} from 'react';\n\nimport {\n type MenuDividerType,\n type MenuItemGroupType,\n type MenuItemType,\n type RenderItemContentOptions,\n type RenderOptions,\n type SubMenuType,\n getItemKey,\n getItemLabel,\n hasAnyIcon,\n hasCheckboxAndIcon,\n renderIcon,\n} from '@/Menu';\n\nimport {\n DropdownMenuCheckboxItemIndicator,\n DropdownMenuCheckboxItemPrimitive,\n DropdownMenuGroup,\n DropdownMenuGroupLabel,\n DropdownMenuItem,\n DropdownMenuItemContent,\n DropdownMenuItemExtra,\n DropdownMenuItemIcon,\n DropdownMenuItemLabel,\n DropdownMenuPopup,\n DropdownMenuPortal,\n DropdownMenuPositioner,\n DropdownMenuSeparator,\n DropdownMenuSubmenuArrow,\n DropdownMenuSubmenuRoot,\n DropdownMenuSubmenuTrigger,\n DropdownMenuSwitchItem,\n} from './atoms';\nimport type {\n DropdownItem,\n DropdownMenuCheckboxItem as DropdownMenuCheckboxItemType,\n DropdownMenuSwitchItem as DropdownMenuSwitchItemType,\n} from './type';\n\nexport type { IconSpaceMode } from '@/Menu';\n\nconst renderItemContent = (\n item: MenuItemType | SubMenuType | DropdownMenuCheckboxItemType | DropdownMenuSwitchItemType,\n options?: RenderItemContentOptions,\n iconNode?: ReactNode,\n) => {\n const label = getItemLabel(item);\n const extra = 'extra' in item ? item.extra : undefined;\n const indicatorOnRight = options?.indicatorOnRight;\n const hasCustomIcon = iconNode !== undefined && !indicatorOnRight;\n const hasIcon = hasCustomIcon ? Boolean(iconNode) : Boolean(item.icon);\n const shouldRenderIcon = hasCustomIcon\n ? Boolean(options?.reserveIconSpace || iconNode)\n : Boolean(hasIcon || options?.reserveIconSpace);\n\n return (\n <DropdownMenuItemContent>\n {shouldRenderIcon ? (\n <DropdownMenuItemIcon aria-hidden={!hasIcon}>\n {hasCustomIcon ? iconNode : hasIcon ? renderIcon(item.icon) : null}\n </DropdownMenuItemIcon>\n ) : null}\n <DropdownMenuItemLabel>{label}</DropdownMenuItemLabel>\n {extra ? <DropdownMenuItemExtra>{extra}</DropdownMenuItemExtra> : null}\n {indicatorOnRight && iconNode ? iconNode : null}\n {options?.submenu ? (\n <DropdownMenuSubmenuArrow>\n <ChevronRight size={16} />\n </DropdownMenuSubmenuArrow>\n ) : null}\n </DropdownMenuItemContent>\n );\n};\n\nconst invokeItemClick = (\n item: MenuItemType,\n keyPath: string[],\n event: ReactMouseEvent<HTMLElement> | ReactKeyboardEvent<HTMLElement>,\n) => {\n if (!item.onClick) return;\n const key = item.key ?? keyPath.at(-1) ?? '';\n const info: MenuInfo = {\n domEvent: event,\n item: event.currentTarget as MenuInfo['item'],\n key: String(key),\n keyPath,\n };\n item.onClick(info);\n};\n\nexport const renderDropdownMenuItems = (\n items: DropdownItem[],\n keyPath: string[] = [],\n options?: RenderOptions,\n): ReactNode[] => {\n const iconSpaceMode = options?.iconSpaceMode ?? 'global';\n const reserveIconSpace =\n options?.reserveIconSpace ?? hasAnyIcon(items, iconSpaceMode === 'global');\n const indicatorOnRight = options?.indicatorOnRight ?? hasCheckboxAndIcon(items);\n\n return items.map((item, index) => {\n if (!item) return null;\n\n const fallbackKey = `${keyPath.join('-') || 'root'}-${index}`;\n const itemKey = getItemKey(item, fallbackKey);\n const nextKeyPath = [...keyPath, String(itemKey)];\n\n if ((item as DropdownMenuCheckboxItemType).type === 'checkbox') {\n const checkboxItem = item as DropdownMenuCheckboxItemType;\n const label = getItemLabel(checkboxItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = Boolean(checkboxItem.danger);\n const indicator = (\n <DropdownMenuCheckboxItemIndicator>{renderIcon(Check)}</DropdownMenuCheckboxItemIndicator>\n );\n\n return (\n <DropdownMenuCheckboxItemPrimitive\n checked={checkboxItem.checked}\n closeOnClick={checkboxItem.closeOnClick}\n danger={isDanger}\n defaultChecked={checkboxItem.defaultChecked}\n disabled={checkboxItem.disabled}\n key={itemKey}\n label={labelText}\n onCheckedChange={(checked) => checkboxItem.onCheckedChange?.(checked)}\n >\n {renderItemContent(checkboxItem, { indicatorOnRight, reserveIconSpace }, indicator)}\n </DropdownMenuCheckboxItemPrimitive>\n );\n }\n\n if ((item as DropdownMenuSwitchItemType).type === 'switch') {\n const switchItem = item as DropdownMenuSwitchItemType;\n const label = getItemLabel(switchItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = Boolean(switchItem.danger);\n\n return (\n <DropdownMenuSwitchItem\n checked={switchItem.checked}\n closeOnClick={switchItem.closeOnClick}\n danger={isDanger}\n defaultChecked={switchItem.defaultChecked}\n disabled={switchItem.disabled}\n key={itemKey}\n label={labelText}\n onCheckedChange={(checked) => switchItem.onCheckedChange?.(checked)}\n >\n {renderItemContent(switchItem, { reserveIconSpace })}\n </DropdownMenuSwitchItem>\n );\n }\n\n if ((item as MenuDividerType).type === 'divider') {\n return <DropdownMenuSeparator key={itemKey} />;\n }\n\n if ((item as MenuItemGroupType).type === 'group') {\n const group = item as MenuItemGroupType;\n const groupReserveIconSpace =\n iconSpaceMode === 'group'\n ? group.children\n ? hasAnyIcon(group.children)\n : false\n : reserveIconSpace;\n const groupIndicatorOnRight = group.children ? hasCheckboxAndIcon(group.children) : false;\n return (\n <DropdownMenuGroup key={itemKey}>\n {group.label ? <DropdownMenuGroupLabel>{group.label}</DropdownMenuGroupLabel> : null}\n {group.children\n ? renderDropdownMenuItems(group.children, nextKeyPath, {\n iconSpaceMode,\n indicatorOnRight: groupIndicatorOnRight,\n reserveIconSpace: groupReserveIconSpace,\n })\n : null}\n </DropdownMenuGroup>\n );\n }\n\n if ((item as SubMenuType).type === 'submenu' || 'children' in item) {\n const submenu = item as SubMenuType;\n const label = getItemLabel(submenu);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = 'danger' in submenu && Boolean(submenu.danger);\n\n return (\n <DropdownMenuSubmenuRoot key={itemKey}>\n <DropdownMenuSubmenuTrigger\n danger={isDanger}\n disabled={submenu.disabled}\n label={labelText}\n >\n {renderItemContent(submenu, {\n reserveIconSpace,\n submenu: true,\n })}\n </DropdownMenuSubmenuTrigger>\n <DropdownMenuPortal>\n <DropdownMenuPositioner alignOffset={-4} data-submenu=\"\" sideOffset={-1}>\n <DropdownMenuPopup>\n {submenu.children\n ? renderDropdownMenuItems(submenu.children, nextKeyPath, { iconSpaceMode })\n : null}\n </DropdownMenuPopup>\n </DropdownMenuPositioner>\n </DropdownMenuPortal>\n </DropdownMenuSubmenuRoot>\n );\n }\n\n const menuItem = item as MenuItemType;\n const label = getItemLabel(menuItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = 'danger' in menuItem && Boolean(menuItem.danger);\n\n return (\n <DropdownMenuItem\n closeOnClick={menuItem.closeOnClick}\n danger={isDanger}\n disabled={menuItem.disabled}\n key={itemKey}\n label={labelText}\n onClick={(event) => invokeItemClick(menuItem, nextKeyPath, event)}\n >\n {renderItemContent(menuItem, { reserveIconSpace })}\n </DropdownMenuItem>\n );\n });\n};\n"],"mappings":";;;;;;AAiDA,MAAM,qBACJ,MACA,SACA,aACG;CACH,MAAM,QAAQ,aAAa,KAAK;CAChC,MAAM,QAAQ,WAAW,OAAO,KAAK,QAAQ;CAC7C,MAAM,mBAAmB,SAAS;CAClC,MAAM,gBAAgB,aAAa,UAAa,CAAC;CACjD,MAAM,UAAU,gBAAgB,QAAQ,SAAS,GAAG,QAAQ,KAAK,KAAK;AAKtE,QACE,qBAAC;GALsB,gBACrB,QAAQ,SAAS,oBAAoB,SAAS,GAC9C,QAAQ,WAAW,SAAS,iBAAiB,IAK3C,oBAAC;GAAqB,eAAa,CAAC;aACjC,gBAAgB,WAAW,UAAU,WAAW,KAAK,KAAK,GAAG;IACzC,GACrB;EACJ,oBAAC,mCAAuB,QAA8B;EACrD,QAAQ,oBAAC,mCAAuB,QAA8B,GAAG;EACjE,oBAAoB,WAAW,WAAW;EAC1C,SAAS,UACR,oBAAC,sCACC,oBAAC,gBAAa,MA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MAAM,YAAY,OAAO,UAAU,WAAW,QAAQ;EACtD,MAAM,WAAW,YAAY,YAAY,QAAQ,SAAS,OAAO;AAEjE,SACE,oBAAC;GACC,cAAc,SAAS;GACvB,QAAQ;GACR,UAAU,SAAS;GAEnB,OAAO;GACP,UAAU,UAAU,gBAAgB,UAAU,aAAa,MAAM;aAEhE,kBAAkB,UAAU,EAAE,kBAAkB,CAAC;KAJ7C,QAKY;GAErB"}
|
|
1
|
+
{"version":3,"file":"renderItems.mjs","names":["info: MenuInfo","label","labelText","isDanger"],"sources":["../../src/DropdownMenu/renderItems.tsx"],"sourcesContent":["import { Check, ChevronRight } from 'lucide-react';\nimport { type MenuInfo } from 'rc-menu/es/interface';\nimport {\n type KeyboardEvent as ReactKeyboardEvent,\n type MouseEvent as ReactMouseEvent,\n type ReactNode,\n} from 'react';\n\nimport {\n getItemKey,\n getItemLabel,\n hasAnyIcon,\n hasCheckboxAndIcon,\n type MenuDividerType,\n type MenuItemGroupType,\n type MenuItemType,\n renderIcon,\n type RenderItemContentOptions,\n type RenderOptions,\n type SubMenuType,\n} from '@/Menu';\nimport { styles } from '@/Menu/sharedStyle';\n\nimport {\n DropdownMenuCheckboxItemIndicator,\n DropdownMenuCheckboxItemPrimitive,\n DropdownMenuGroup,\n DropdownMenuGroupLabel,\n DropdownMenuItem,\n DropdownMenuItemContent,\n DropdownMenuItemDesc,\n DropdownMenuItemExtra,\n DropdownMenuItemIcon,\n DropdownMenuItemLabel,\n DropdownMenuItemLabelGroup,\n DropdownMenuPopup,\n DropdownMenuPortal,\n DropdownMenuPositioner,\n DropdownMenuSeparator,\n DropdownMenuSubmenuArrow,\n DropdownMenuSubmenuRoot,\n DropdownMenuSubmenuTrigger,\n DropdownMenuSwitchItem,\n} from './atoms';\nimport {\n type DropdownItem,\n type DropdownMenuCheckboxItem as DropdownMenuCheckboxItemType,\n type DropdownMenuSwitchItem as DropdownMenuSwitchItemType,\n} from './type';\n\nexport type { IconAlign, IconSpaceMode } from '@/Menu';\n\nconst renderItemContent = (\n item: MenuItemType | SubMenuType | DropdownMenuCheckboxItemType | DropdownMenuSwitchItemType,\n options?: RenderItemContentOptions,\n iconNode?: ReactNode,\n) => {\n const label = getItemLabel(item);\n const desc = 'desc' in item ? item.desc : undefined;\n const extra = 'extra' in item ? item.extra : undefined;\n const indicatorOnRight = options?.indicatorOnRight;\n const alignStart = Boolean(desc) && options?.iconAlign === 'start';\n\n const hasCustomIcon = iconNode !== undefined && !indicatorOnRight;\n const hasIcon = hasCustomIcon ? Boolean(iconNode) : Boolean(item.icon);\n const shouldRenderIcon = hasCustomIcon\n ? Boolean(options?.reserveIconSpace || iconNode)\n : Boolean(hasIcon || options?.reserveIconSpace);\n\n const labelNode = desc ? (\n <DropdownMenuItemLabelGroup>\n <DropdownMenuItemLabel>{label}</DropdownMenuItemLabel>\n <DropdownMenuItemDesc>{desc}</DropdownMenuItemDesc>\n </DropdownMenuItemLabelGroup>\n ) : (\n <DropdownMenuItemLabel>{label}</DropdownMenuItemLabel>\n );\n\n return (\n <DropdownMenuItemContent className={alignStart ? styles.itemContentAlignStart : undefined}>\n {shouldRenderIcon ? (\n <DropdownMenuItemIcon\n aria-hidden={!hasIcon}\n className={alignStart ? styles.iconAlignStart : undefined}\n >\n {hasCustomIcon ? iconNode : hasIcon ? renderIcon(item.icon) : null}\n </DropdownMenuItemIcon>\n ) : null}\n {labelNode}\n {extra ? <DropdownMenuItemExtra>{extra}</DropdownMenuItemExtra> : null}\n {indicatorOnRight && iconNode ? iconNode : null}\n {options?.submenu ? (\n <DropdownMenuSubmenuArrow>\n <ChevronRight size={16} />\n </DropdownMenuSubmenuArrow>\n ) : null}\n </DropdownMenuItemContent>\n );\n};\n\nconst invokeItemClick = (\n item: MenuItemType,\n keyPath: string[],\n event: ReactMouseEvent<HTMLElement> | ReactKeyboardEvent<HTMLElement>,\n) => {\n if (!item.onClick) return;\n const key = item.key ?? keyPath.at(-1) ?? '';\n const info: MenuInfo = {\n domEvent: event,\n item: event.currentTarget as MenuInfo['item'],\n key: String(key),\n keyPath,\n };\n item.onClick(info);\n};\n\nexport const renderDropdownMenuItems = (\n items: DropdownItem[],\n keyPath: string[] = [],\n options?: RenderOptions,\n): ReactNode[] => {\n const iconAlign = options?.iconAlign;\n const iconSpaceMode = options?.iconSpaceMode ?? 'global';\n const reserveIconSpace =\n options?.reserveIconSpace ?? hasAnyIcon(items, iconSpaceMode === 'global');\n const indicatorOnRight = options?.indicatorOnRight ?? hasCheckboxAndIcon(items);\n\n return items.map((item, index) => {\n if (!item) return null;\n\n const fallbackKey = `${keyPath.join('-') || 'root'}-${index}`;\n const itemKey = getItemKey(item, fallbackKey);\n const nextKeyPath = [...keyPath, String(itemKey)];\n\n if ((item as DropdownMenuCheckboxItemType).type === 'checkbox') {\n const checkboxItem = item as DropdownMenuCheckboxItemType;\n const label = getItemLabel(checkboxItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = Boolean(checkboxItem.danger);\n const indicator = (\n <DropdownMenuCheckboxItemIndicator>{renderIcon(Check)}</DropdownMenuCheckboxItemIndicator>\n );\n\n return (\n <DropdownMenuCheckboxItemPrimitive\n checked={checkboxItem.checked}\n closeOnClick={checkboxItem.closeOnClick}\n danger={isDanger}\n defaultChecked={checkboxItem.defaultChecked}\n disabled={checkboxItem.disabled}\n key={itemKey}\n label={labelText}\n onCheckedChange={(checked) => checkboxItem.onCheckedChange?.(checked)}\n >\n {renderItemContent(\n checkboxItem,\n { iconAlign, indicatorOnRight, reserveIconSpace },\n indicator,\n )}\n </DropdownMenuCheckboxItemPrimitive>\n );\n }\n\n if ((item as DropdownMenuSwitchItemType).type === 'switch') {\n const switchItem = item as DropdownMenuSwitchItemType;\n const label = getItemLabel(switchItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = Boolean(switchItem.danger);\n\n return (\n <DropdownMenuSwitchItem\n checked={switchItem.checked}\n closeOnClick={switchItem.closeOnClick}\n danger={isDanger}\n defaultChecked={switchItem.defaultChecked}\n disabled={switchItem.disabled}\n key={itemKey}\n label={labelText}\n onCheckedChange={(checked) => switchItem.onCheckedChange?.(checked)}\n >\n {renderItemContent(switchItem, { iconAlign, reserveIconSpace })}\n </DropdownMenuSwitchItem>\n );\n }\n\n if ((item as MenuDividerType).type === 'divider') {\n return <DropdownMenuSeparator key={itemKey} />;\n }\n\n if ((item as MenuItemGroupType).type === 'group') {\n const group = item as MenuItemGroupType;\n const groupReserveIconSpace =\n iconSpaceMode === 'group'\n ? group.children\n ? hasAnyIcon(group.children)\n : false\n : reserveIconSpace;\n const groupIndicatorOnRight = group.children ? hasCheckboxAndIcon(group.children) : false;\n return (\n <DropdownMenuGroup key={itemKey}>\n {group.label ? <DropdownMenuGroupLabel>{group.label}</DropdownMenuGroupLabel> : null}\n {group.children\n ? renderDropdownMenuItems(group.children, nextKeyPath, {\n iconAlign,\n iconSpaceMode,\n indicatorOnRight: groupIndicatorOnRight,\n reserveIconSpace: groupReserveIconSpace,\n })\n : null}\n </DropdownMenuGroup>\n );\n }\n\n if ((item as SubMenuType).type === 'submenu' || 'children' in item) {\n const submenu = item as SubMenuType;\n const label = getItemLabel(submenu);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = 'danger' in submenu && Boolean(submenu.danger);\n\n return (\n <DropdownMenuSubmenuRoot key={itemKey}>\n <DropdownMenuSubmenuTrigger\n danger={isDanger}\n disabled={submenu.disabled}\n label={labelText}\n >\n {renderItemContent(submenu, {\n iconAlign,\n reserveIconSpace,\n submenu: true,\n })}\n </DropdownMenuSubmenuTrigger>\n <DropdownMenuPortal>\n <DropdownMenuPositioner alignOffset={-4} data-submenu=\"\" sideOffset={-1}>\n <DropdownMenuPopup>\n {submenu.children\n ? renderDropdownMenuItems(submenu.children, nextKeyPath, {\n iconAlign,\n iconSpaceMode,\n })\n : null}\n </DropdownMenuPopup>\n </DropdownMenuPositioner>\n </DropdownMenuPortal>\n </DropdownMenuSubmenuRoot>\n );\n }\n\n const menuItem = item as MenuItemType;\n const label = getItemLabel(menuItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = 'danger' in menuItem && Boolean(menuItem.danger);\n\n return (\n <DropdownMenuItem\n closeOnClick={menuItem.closeOnClick}\n danger={isDanger}\n disabled={menuItem.disabled}\n key={itemKey}\n label={labelText}\n onClick={(event) => invokeItemClick(menuItem, nextKeyPath, event)}\n >\n {renderItemContent(menuItem, { iconAlign, reserveIconSpace })}\n </DropdownMenuItem>\n );\n });\n};\n"],"mappings":";;;;;;;AAoDA,MAAM,qBACJ,MACA,SACA,aACG;CACH,MAAM,QAAQ,aAAa,KAAK;CAChC,MAAM,OAAO,UAAU,OAAO,KAAK,OAAO;CAC1C,MAAM,QAAQ,WAAW,OAAO,KAAK,QAAQ;CAC7C,MAAM,mBAAmB,SAAS;CAClC,MAAM,aAAa,QAAQ,KAAK,IAAI,SAAS,cAAc;CAE3D,MAAM,gBAAgB,aAAa,UAAa,CAAC;CACjD,MAAM,UAAU,gBAAgB,QAAQ,SAAS,GAAG,QAAQ,KAAK,KAAK;CACtE,MAAM,mBAAmB,gBACrB,QAAQ,SAAS,oBAAoB,SAAS,GAC9C,QAAQ,WAAW,SAAS,iBAAiB;CAEjD,MAAM,YAAY,OAChB,qBAAC,yCACC,oBAAC,mCAAuB,QAA8B,EACtD,oBAAC,kCAAsB,OAA4B,IACxB,GAE7B,oBAAC,mCAAuB,QAA8B;AAGxD,QACE,qBAAC;EAAwB,WAAW,aAAa,OAAO,wBAAwB;;GAC7E,mBACC,oBAAC;IACC,eAAa,CAAC;IACd,WAAW,aAAa,OAAO,iBAAiB;cAE/C,gBAAgB,WAAW,UAAU,WAAW,KAAK,KAAK,GAAG;KACzC,GACrB;GACH;GACA,QAAQ,oBAAC,mCAAuB,QAA8B,GAAG;GACjE,oBAAoB,WAAW,WAAW;GAC1C,SAAS,UACR,oBAAC,sCACC,oBAAC,gBAAa,MAAM,KAAM,GACD,GACzB;;GACoB;;AAI9B,MAAM,mBACJ,MACA,SACA,UACG;A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,WAAW,QAAQ;EACtD,MAAM,WAAW,YAAY,YAAY,QAAQ,SAAS,OAAO;AAEjE,SACE,oBAAC;GACC,cAAc,SAAS;GACvB,QAAQ;GACR,UAAU,SAAS;GAEnB,OAAO;GACP,UAAU,UAAU,gBAAgB,UAAU,aAAa,MAAM;aAEhE,kBAAkB,UAAU;IAAE;IAAW;IAAkB,CAAC;KAJxD,QAKY;GAErB"}
|
|
@@ -4,7 +4,7 @@ import { Placement } from "../utils/placement.mjs";
|
|
|
4
4
|
import { MenuCheckboxItemType } from "../Menu/checkboxItem.mjs";
|
|
5
5
|
import { MenuSwitchItemType } from "../Menu/switchItem.mjs";
|
|
6
6
|
import { BaseMenuItemType } from "../Menu/baseItem.mjs";
|
|
7
|
-
import { IconSpaceMode } from "../Menu/renderUtils.mjs";
|
|
7
|
+
import { IconAlign, IconSpaceMode } from "../Menu/renderUtils.mjs";
|
|
8
8
|
import "../Menu/index.mjs";
|
|
9
9
|
import "./renderItems.mjs";
|
|
10
10
|
import { ReactNode } from "react";
|
|
@@ -17,6 +17,13 @@ type DropdownMenuSwitchItem = MenuSwitchItemType;
|
|
|
17
17
|
type DropdownItem = BaseMenuItemType;
|
|
18
18
|
interface DropdownMenuProps<Payload = unknown> extends Omit<MenuRootProps<Payload>, 'children'> {
|
|
19
19
|
children: ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* 图标与 label+desc 的垂直对齐方式
|
|
22
|
+
* - 'center': 图标垂直居中(默认)
|
|
23
|
+
* - 'start': 图标与第一行文本顶部对齐,仅在 item 有 desc 时生效
|
|
24
|
+
* @default 'center'
|
|
25
|
+
*/
|
|
26
|
+
iconAlign?: IconAlign;
|
|
20
27
|
/**
|
|
21
28
|
* 图标空间保留模式
|
|
22
29
|
* - 'global': 当任何一个选项有图标时,所有 item 都保留图标位
|
|
@@ -22,58 +22,58 @@ const ControlInput = memo(({ value, onChange, onValueChanging, onChangeEnd, onCo
|
|
|
22
22
|
};
|
|
23
23
|
return /* @__PURE__ */ jsx(Input_default, {
|
|
24
24
|
autoFocus: true,
|
|
25
|
-
onChange: (e) => {
|
|
26
|
-
setInput(e.target.value);
|
|
27
|
-
onValueChanging?.(e.target.value);
|
|
28
|
-
},
|
|
29
|
-
onCompositionEnd: (e) => {
|
|
30
|
-
isChineseInput.current = false;
|
|
31
|
-
onCompositionEnd?.(e);
|
|
32
|
-
},
|
|
33
|
-
onCompositionStart: (e) => {
|
|
34
|
-
isChineseInput.current = true;
|
|
35
|
-
onCompositionStart?.(e);
|
|
36
|
-
},
|
|
37
|
-
onFocus,
|
|
38
|
-
onPressEnter: (e) => {
|
|
39
|
-
if (!e.shiftKey && !isChineseInput.current) {
|
|
40
|
-
e.preventDefault();
|
|
41
|
-
handleUpload();
|
|
42
|
-
onPressEnter?.(e);
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
25
|
ref,
|
|
26
|
+
value: input,
|
|
46
27
|
style: {
|
|
47
28
|
width: "100%",
|
|
48
29
|
...style
|
|
49
30
|
},
|
|
50
31
|
suffix: value === input ? /* @__PURE__ */ jsx("span", {}) : /* @__PURE__ */ jsxs(FlexBasic_default, {
|
|
51
|
-
gap: 2,
|
|
52
32
|
horizontal: true,
|
|
33
|
+
gap: 2,
|
|
53
34
|
style: {
|
|
54
35
|
marginRight: -4,
|
|
55
36
|
zIndex: 1
|
|
56
37
|
},
|
|
57
38
|
children: [/* @__PURE__ */ jsx(ActionIcon_default, {
|
|
58
39
|
icon: RotateCcw,
|
|
40
|
+
size: "small",
|
|
41
|
+
title: texts?.reset || "Reset",
|
|
59
42
|
onClick: (e) => {
|
|
60
43
|
e.preventDefault();
|
|
61
44
|
setInput(value || "");
|
|
62
|
-
}
|
|
63
|
-
size: "small",
|
|
64
|
-
title: texts?.reset || "Reset"
|
|
45
|
+
}
|
|
65
46
|
}), /* @__PURE__ */ jsx(ActionIcon_default, {
|
|
66
47
|
icon: submitIcon || Save,
|
|
48
|
+
size: "small",
|
|
49
|
+
title: texts?.submit || "Submit",
|
|
50
|
+
variant: "filled",
|
|
67
51
|
onClick: (e) => {
|
|
68
52
|
e.preventDefault();
|
|
69
53
|
handleUpload();
|
|
70
|
-
}
|
|
71
|
-
size: "small",
|
|
72
|
-
title: texts?.submit || "Submit",
|
|
73
|
-
variant: "filled"
|
|
54
|
+
}
|
|
74
55
|
})]
|
|
75
56
|
}),
|
|
76
|
-
|
|
57
|
+
onFocus,
|
|
58
|
+
onChange: (e) => {
|
|
59
|
+
setInput(e.target.value);
|
|
60
|
+
onValueChanging?.(e.target.value);
|
|
61
|
+
},
|
|
62
|
+
onCompositionEnd: (e) => {
|
|
63
|
+
isChineseInput.current = false;
|
|
64
|
+
onCompositionEnd?.(e);
|
|
65
|
+
},
|
|
66
|
+
onCompositionStart: (e) => {
|
|
67
|
+
isChineseInput.current = true;
|
|
68
|
+
onCompositionStart?.(e);
|
|
69
|
+
},
|
|
70
|
+
onPressEnter: (e) => {
|
|
71
|
+
if (!e.shiftKey && !isChineseInput.current) {
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
handleUpload();
|
|
74
|
+
onPressEnter?.(e);
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
77
|
...rest
|
|
78
78
|
});
|
|
79
79
|
});
|