@lobehub/ui 4.38.4 → 5.0.1
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/es/Accordion/Accordion.d.mts +2 -2
- package/es/Accordion/AccordionItem.d.mts +2 -2
- package/es/ActionIcon/ActionIcon.d.mts +2 -2
- package/es/ActionIconGroup/ActionIconGroup.mjs +1 -1
- package/es/ActionIconGroup/type.d.mts +1 -1
- package/es/Alert/Alert.d.mts +2 -2
- package/es/AutoComplete/Select.d.mts +2 -2
- package/es/Avatar/AvatarGroup/index.d.mts +2 -2
- package/es/Burger/Burger.d.mts +2 -2
- package/es/CodeDiff/CodeDiff.d.mts +2 -2
- package/es/CodeDiff/PatchDiff.d.mts +2 -2
- package/es/CodeEditor/CodeEditor.d.mts +2 -2
- package/es/Collapse/Collapse.d.mts +2 -2
- package/es/ConfigProvider/index.d.mts +2 -2
- package/es/ContextMenu/index.d.mts +6 -7
- package/es/ContextMenu/index.mjs +3 -3
- package/es/CopyButton/CopyButton.d.mts +2 -2
- package/es/DatePicker/DatePicker.d.mts +2 -2
- 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/DraggablePanelHeader.d.mts +2 -2
- package/es/DraggableSideNav/DraggableSideNav.d.mts +2 -2
- package/es/Drawer/Drawer.d.mts +2 -2
- package/es/Dropdown/Dropdown.d.mts +2 -2
- package/es/DropdownMenu/index.d.mts +6 -5
- package/es/DropdownMenu/index.mjs +4 -4
- package/es/EditableText/EditableText.d.mts +2 -2
- package/es/EditorSlashMenu/atoms.d.mts +13 -13
- package/es/EmojiPicker/EmojiPicker.d.mts +2 -2
- package/es/Flex/FlexBasic.d.mts +2 -2
- package/es/FontLoader/index.d.mts +2 -2
- package/es/Footer/Footer.d.mts +2 -2
- package/es/Form/components/FormGroup.d.mts +2 -2
- package/es/Form/components/FormItem.d.mts +2 -2
- package/es/Form/components/FormSubmitFooter.d.mts +2 -2
- package/es/FormModal/FormModal.d.mts +2 -2
- package/es/GuideCard/GuideCard.d.mts +2 -2
- package/es/Header/Header.d.mts +2 -2
- package/es/Highlighter/Highlighter.d.mts +2 -2
- package/es/Highlighter/SyntaxHighlighter/index.d.mts +2 -2
- package/es/Hotkey/Hotkey.d.mts +2 -2
- package/es/HotkeyInput/HotkeyInput.d.mts +2 -2
- package/es/Icon/Icon.d.mts +2 -2
- package/es/Icon/components/IconProvider.d.mts +3 -3
- package/es/ImageSelect/ImageSelect.d.mts +2 -2
- package/es/Input/Input.d.mts +2 -2
- package/es/Input/InputNumber.d.mts +2 -2
- package/es/Input/InputOPT.d.mts +2 -2
- package/es/Input/InputPassword.d.mts +2 -2
- package/es/Input/TextArea.d.mts +2 -2
- 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/List/ListItem/index.d.mts +2 -2
- package/es/Markdown/Markdown.d.mts +2 -2
- package/es/Markdown/Typography.d.mts +2 -2
- package/es/Markdown/components/SearchResultCards/index.d.mts +2 -2
- package/es/MaskShadow/MaskShadow.d.mts +2 -2
- package/es/Menu/Menu.d.mts +2 -2
- package/es/Mermaid/Mermaid.d.mts +2 -2
- package/es/Mermaid/SyntaxMermaid/index.d.mts +2 -2
- package/es/Modal/Modal.d.mts +2 -2
- package/es/Modal/ModalProvider.d.mts +2 -2
- package/es/Modal/imperative.d.mts +2 -2
- package/es/MotionProvider/index.d.mts +2 -2
- package/es/Popover/ArrowIcon.d.mts +2 -2
- package/es/Popover/atoms.d.mts +9 -9
- package/es/Popover/context.d.mts +2 -2
- package/es/ScrollArea/index.d.mts +5 -4
- package/es/ScrollArea/index.mjs +2 -2
- package/es/SearchBar/SearchBar.d.mts +2 -2
- package/es/Segmented/Segmented.d.mts +2 -2
- package/es/Select/Select.d.mts +3 -3
- package/es/Select/Select.mjs +1 -1
- package/es/Select/Select.mjs.map +1 -1
- package/es/SideNav/SideNav.d.mts +2 -2
- package/es/SliderWithInput/SliderWithInput.d.mts +2 -2
- package/es/SortableList/components/DragHandle.d.mts +2 -2
- package/es/SortableList/components/SortableItem.d.mts +2 -2
- package/es/ThemeProvider/ThemeProvider.d.mts +2 -2
- package/es/ThemeSwitch/ThemeSwitch.mjs +1 -1
- package/es/Toast/index.d.mts +4 -3
- package/es/Toast/index.mjs +1 -1
- package/es/Toc/Toc.d.mts +2 -2
- package/es/Video/index.d.mts +2 -2
- package/es/awesome/AuroraBackground/AuroraBackground.d.mts +2 -2
- package/es/awesome/BottomGradientButton/BottomGradientButton.d.mts +2 -2
- package/es/awesome/Features/Features.d.mts +2 -2
- package/es/awesome/Giscus/Giscus.d.mts +2 -2
- package/es/awesome/GradientButton/GradientButton.d.mts +2 -2
- package/es/awesome/GridBackground/GridBackground.d.mts +2 -2
- package/es/awesome/GridBackground/GridShowcase.d.mts +2 -2
- package/es/awesome/Hero/Hero.d.mts +2 -2
- package/es/awesome/Spline/Spine.d.mts +2 -2
- package/es/awesome/Spotlight/Spotlight.d.mts +2 -2
- package/es/awesome/SpotlightCard/SpotlightCard.d.mts +2 -2
- package/es/awesome/TypewriterEffect/TypewriterEffect.d.mts +2 -2
- package/es/base-ui/ContextMenu/ContextMenuHost.d.mts +8 -0
- package/es/{ContextMenu → base-ui/ContextMenu}/ContextMenuHost.mjs +6 -6
- package/es/base-ui/ContextMenu/ContextMenuHost.mjs.map +1 -0
- package/es/{ContextMenu → base-ui/ContextMenu}/ContextMenuTrigger.d.mts +1 -1
- package/es/{ContextMenu → base-ui/ContextMenu}/ContextMenuTrigger.mjs +2 -2
- package/es/base-ui/ContextMenu/ContextMenuTrigger.mjs.map +1 -0
- package/es/base-ui/ContextMenu/index.d.mts +7 -0
- package/es/base-ui/ContextMenu/renderItems.d.mts +4 -0
- package/es/{ContextMenu → base-ui/ContextMenu}/renderItems.mjs +7 -7
- package/es/base-ui/ContextMenu/renderItems.mjs.map +1 -0
- package/es/{ContextMenu → base-ui/ContextMenu}/store.d.mts +3 -3
- package/es/{ContextMenu → base-ui/ContextMenu}/store.mjs +1 -1
- package/es/base-ui/ContextMenu/store.mjs.map +1 -0
- package/es/base-ui/ContextMenu/type.d.mts +12 -0
- package/es/base-ui/DropdownMenu/DropdownMenu.d.mts +8 -0
- package/es/{DropdownMenu → base-ui/DropdownMenu}/DropdownMenu.mjs +3 -3
- package/es/base-ui/DropdownMenu/DropdownMenu.mjs.map +1 -0
- package/es/{DropdownMenu → base-ui/DropdownMenu}/atoms.d.mts +19 -19
- package/es/{DropdownMenu → base-ui/DropdownMenu}/atoms.mjs +7 -7
- package/es/base-ui/DropdownMenu/atoms.mjs.map +1 -0
- package/es/base-ui/DropdownMenu/index.d.mts +5 -0
- package/es/{DropdownMenu → base-ui/DropdownMenu}/renderItems.d.mts +3 -3
- package/es/{DropdownMenu → base-ui/DropdownMenu}/renderItems.mjs +3 -3
- package/es/base-ui/DropdownMenu/renderItems.mjs.map +1 -0
- package/es/{DropdownMenu → base-ui/DropdownMenu}/type.d.mts +9 -9
- package/es/{ScrollArea → base-ui/ScrollArea}/ScrollArea.d.mts +1 -1
- package/es/{ScrollArea → base-ui/ScrollArea}/ScrollArea.mjs +1 -1
- package/es/base-ui/ScrollArea/ScrollArea.mjs.map +1 -0
- package/es/{ScrollArea → base-ui/ScrollArea}/atoms.d.mts +8 -8
- package/es/{ScrollArea → base-ui/ScrollArea}/atoms.mjs +1 -1
- package/es/base-ui/ScrollArea/atoms.mjs.map +1 -0
- package/es/{ScrollArea → base-ui/ScrollArea}/globalStyle.mjs +1 -1
- package/es/base-ui/ScrollArea/globalStyle.mjs.map +1 -0
- package/es/base-ui/ScrollArea/index.d.mts +3 -0
- package/es/{ScrollArea → base-ui/ScrollArea}/style.mjs +1 -1
- package/es/base-ui/ScrollArea/style.mjs.map +1 -0
- package/es/{ScrollArea → base-ui/ScrollArea}/type.d.mts +1 -1
- package/es/base-ui/Select/Select.d.mts +8 -0
- package/es/{LobeSelect/LobeSelect.mjs → base-ui/Select/Select.mjs} +9 -9
- package/es/base-ui/Select/Select.mjs.map +1 -0
- package/es/base-ui/Select/atoms.d.mts +155 -0
- package/es/{LobeSelect → base-ui/Select}/atoms.mjs +38 -38
- package/es/base-ui/Select/atoms.mjs.map +1 -0
- package/es/base-ui/Select/index.d.mts +3 -0
- package/es/{LobeSelect → base-ui/Select}/style.mjs +2 -2
- package/es/base-ui/Select/style.mjs.map +1 -0
- package/es/{LobeSelect → base-ui/Select}/type.d.mts +24 -24
- package/es/base-ui/Switch/Switch.d.mts +8 -0
- package/es/{LobeSwitch/LobeSwitch.mjs → base-ui/Switch/Switch.mjs} +12 -12
- package/es/base-ui/Switch/Switch.mjs.map +1 -0
- package/es/base-ui/Switch/atoms.d.mts +56 -0
- package/es/{LobeSwitch → base-ui/Switch}/atoms.mjs +16 -16
- package/es/base-ui/Switch/atoms.mjs.map +1 -0
- package/es/base-ui/Switch/index.d.mts +4 -0
- package/es/{LobeSwitch → base-ui/Switch}/style.d.mts +1 -1
- package/es/{LobeSwitch → base-ui/Switch}/style.mjs +4 -4
- package/es/base-ui/Switch/style.mjs.map +1 -0
- package/es/{LobeSwitch → base-ui/Switch}/type.d.mts +21 -21
- package/es/{Toast → base-ui/Toast}/Toast.mjs +2 -2
- package/es/base-ui/Toast/Toast.mjs.map +1 -0
- package/es/{Toast → base-ui/Toast}/context.mjs +1 -1
- package/es/base-ui/Toast/context.mjs.map +1 -0
- package/es/{Toast → base-ui/Toast}/imperative.d.mts +3 -3
- package/es/{Toast → base-ui/Toast}/imperative.mjs +3 -3
- package/es/base-ui/Toast/imperative.mjs.map +1 -0
- package/es/base-ui/Toast/index.d.mts +2 -0
- package/es/{Toast → base-ui/Toast}/style.mjs +1 -1
- package/es/base-ui/Toast/style.mjs.map +1 -0
- package/es/{Toast → base-ui/Toast}/type.d.mts +3 -3
- package/es/base-ui/index.d.mts +28 -0
- package/es/base-ui/index.mjs +16 -0
- package/es/brand/LobeChat/index.d.mts +2 -2
- package/es/brand/LobeHub/index.d.mts +2 -2
- package/es/brand/LogoThree/LogoSpline.d.mts +2 -2
- package/es/brand/LogoThree/index.d.mts +2 -2
- package/es/chat/BackBottom/BackBottom.d.mts +2 -2
- package/es/chat/ChatInputArea/components/ChatInputAreaInner.d.mts +2 -2
- package/es/chat/ChatItem/ChatItem.d.mts +2 -2
- package/es/chat/ChatList/ChatList.d.mts +2 -2
- package/es/chat/EditableMessage/EditableMessage.d.mts +2 -2
- package/es/chat/EditableMessageList/EditableMessageList.d.mts +2 -2
- package/es/chat/MessageInput/MessageInput.d.mts +2 -2
- package/es/chat/MessageModal/MessageModal.d.mts +2 -2
- package/es/color/ColorScales/index.d.mts +2 -2
- package/es/color/CssVar/index.d.mts +2 -2
- package/es/hooks/useNativeButton.mjs +2 -2
- package/es/hooks/useNativeButton.mjs.map +1 -1
- package/es/i18n/context.d.mts +2 -2
- package/es/icons/lucideExtra/BotPromptIcon.d.mts +2 -2
- package/es/icons/lucideExtra/CreateBotIcon.d.mts +2 -2
- package/es/icons/lucideExtra/DiscordIcon.d.mts +3 -3
- package/es/icons/lucideExtra/GlobeOffIcon.d.mts +2 -2
- 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 +3 -3
- 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/SkillsIcon.d.mts +3 -3
- package/es/icons/lucideExtra/TreeDownRightIcon.d.mts +3 -3
- package/es/icons/lucideExtra/TreeUpDownRightIcon.d.mts +3 -3
- package/es/index.d.mts +15 -24
- package/es/index.mjs +11 -16
- package/es/mdx/Mdx/index.d.mts +2 -2
- package/es/mobile/ChatHeader/ChatHeaderTitle.d.mts +2 -2
- package/es/mobile/ChatInputArea/components/ChatSendButton.d.mts +2 -2
- package/es/mobile/TabBar/TabBar.d.mts +2 -2
- package/es/storybook/StoryBook/index.d.mts +2 -2
- package/package.json +48 -33
- package/awesome.d.ts +0 -1
- package/awesome.js +0 -1
- package/brand.d.ts +0 -1
- package/brand.js +0 -1
- package/chat.d.ts +0 -1
- package/chat.js +0 -1
- package/color.d.ts +0 -1
- package/color.js +0 -1
- package/es/ContextMenu/ContextMenuHost.d.mts +0 -8
- package/es/ContextMenu/ContextMenuHost.mjs.map +0 -1
- package/es/ContextMenu/ContextMenuTrigger.mjs.map +0 -1
- package/es/ContextMenu/renderItems.d.mts +0 -4
- package/es/ContextMenu/renderItems.mjs.map +0 -1
- package/es/ContextMenu/store.mjs.map +0 -1
- package/es/ContextMenu/type.d.mts +0 -12
- package/es/DropdownMenu/DropdownMenu.d.mts +0 -8
- package/es/DropdownMenu/DropdownMenu.mjs.map +0 -1
- package/es/DropdownMenu/atoms.mjs.map +0 -1
- package/es/DropdownMenu/renderItems.mjs.map +0 -1
- package/es/LobeSelect/LobeSelect.d.mts +0 -8
- package/es/LobeSelect/LobeSelect.mjs.map +0 -1
- package/es/LobeSelect/atoms.d.mts +0 -155
- package/es/LobeSelect/atoms.mjs.map +0 -1
- package/es/LobeSelect/index.d.mts +0 -4
- package/es/LobeSelect/index.mjs +0 -4
- package/es/LobeSelect/style.mjs.map +0 -1
- package/es/LobeSwitch/LobeSwitch.d.mts +0 -8
- package/es/LobeSwitch/LobeSwitch.mjs.map +0 -1
- package/es/LobeSwitch/atoms.d.mts +0 -56
- package/es/LobeSwitch/atoms.mjs.map +0 -1
- package/es/LobeSwitch/index.d.mts +0 -5
- package/es/LobeSwitch/index.d.ts +0 -1
- package/es/LobeSwitch/index.js +0 -1
- package/es/LobeSwitch/index.mjs +0 -5
- package/es/LobeSwitch/style.mjs.map +0 -1
- package/es/ScrollArea/ScrollArea.mjs.map +0 -1
- package/es/ScrollArea/atoms.mjs.map +0 -1
- package/es/ScrollArea/globalStyle.mjs.map +0 -1
- package/es/ScrollArea/style.mjs.map +0 -1
- package/es/Toast/Toast.mjs.map +0 -1
- package/es/Toast/context.mjs.map +0 -1
- package/es/Toast/imperative.mjs.map +0 -1
- package/es/Toast/style.mjs.map +0 -1
- package/icons.d.ts +0 -1
- package/icons.js +0 -1
- package/mdx.d.ts +0 -1
- package/mdx.js +0 -1
- package/mobile.d.ts +0 -1
- package/mobile.js +0 -1
- package/storybook.d.ts +0 -1
- package/storybook.js +0 -1
- /package/es/{ContextMenu → base-ui/ContextMenu}/imperative.d.mts +0 -0
- /package/es/{LobeSelect → base-ui}/index.d.ts +0 -0
- /package/es/{LobeSelect → base-ui}/index.js +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ChatHeaderTitleProps } from "./type.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react139 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/mobile/ChatHeader/ChatHeaderTitle.d.ts
|
|
5
|
-
declare const ChatHeaderTitle:
|
|
5
|
+
declare const ChatHeaderTitle: react139.NamedExoticComponent<ChatHeaderTitleProps>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { ChatHeaderTitle };
|
|
8
8
|
//# sourceMappingURL=ChatHeaderTitle.d.mts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ChatSendButtonProps } from "../type.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react140 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/mobile/ChatInputArea/components/ChatSendButton.d.ts
|
|
5
|
-
declare const ChatSendButton:
|
|
5
|
+
declare const ChatSendButton: react140.NamedExoticComponent<ChatSendButtonProps>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { ChatSendButton };
|
|
8
8
|
//# sourceMappingURL=ChatSendButton.d.mts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { TabBarProps } from "./type.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react138 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/mobile/TabBar/TabBar.d.ts
|
|
5
|
-
declare const TabBar:
|
|
5
|
+
declare const TabBar: react138.NamedExoticComponent<TabBarProps>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { TabBar };
|
|
8
8
|
//# sourceMappingURL=TabBar.d.mts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FlexboxProps } from "../../Flex/type.mjs";
|
|
2
2
|
import "../../Flex/index.mjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react70 from "react";
|
|
4
4
|
import { Ref } from "react";
|
|
5
5
|
import { useControls, useCreateStore } from "leva";
|
|
6
6
|
|
|
@@ -10,7 +10,7 @@ interface StoryBookProps extends FlexboxProps {
|
|
|
10
10
|
noPadding?: boolean;
|
|
11
11
|
ref?: Ref<HTMLDivElement>;
|
|
12
12
|
}
|
|
13
|
-
declare const StoryBook:
|
|
13
|
+
declare const StoryBook: react70.NamedExoticComponent<StoryBookProps>;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { StoryBook, StoryBookProps, useControls, useCreateStore };
|
|
16
16
|
//# sourceMappingURL=index.d.mts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"description": "Lobe UI is an open-source UI component library for building AIGC web apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lobehub",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"sideEffects": [
|
|
23
23
|
"**/*.css"
|
|
24
24
|
],
|
|
25
|
+
"type": "module",
|
|
25
26
|
"exports": {
|
|
26
27
|
".": {
|
|
27
28
|
"types": "./es/index.d.mts",
|
|
@@ -30,51 +31,62 @@
|
|
|
30
31
|
},
|
|
31
32
|
"./i18n": {
|
|
32
33
|
"types": "./es/i18n/index.d.mts",
|
|
33
|
-
"import": "./es/i18n/index.mjs"
|
|
34
|
-
"default": "./es/i18n/index.mjs"
|
|
34
|
+
"import": "./es/i18n/index.mjs"
|
|
35
35
|
},
|
|
36
36
|
"./i18n/resources/*": {
|
|
37
37
|
"types": "./es/i18n/resources/*.d.mts",
|
|
38
|
-
"import": "./es/i18n/resources/*.mjs"
|
|
39
|
-
"default": "./es/i18n/resources/*.mjs"
|
|
38
|
+
"import": "./es/i18n/resources/*.mjs"
|
|
40
39
|
},
|
|
41
40
|
"./i18n/*": {
|
|
42
41
|
"types": "./es/i18n/*.d.mts",
|
|
43
|
-
"import": "./es/i18n/*.mjs"
|
|
44
|
-
|
|
42
|
+
"import": "./es/i18n/*.mjs"
|
|
43
|
+
},
|
|
44
|
+
"./awesome": {
|
|
45
|
+
"types": "./es/awesome/index.d.mts",
|
|
46
|
+
"import": "./es/awesome/index.mjs"
|
|
47
|
+
},
|
|
48
|
+
"./brand": {
|
|
49
|
+
"types": "./es/brand/index.d.mts",
|
|
50
|
+
"import": "./es/brand/index.mjs"
|
|
51
|
+
},
|
|
52
|
+
"./chat": {
|
|
53
|
+
"types": "./es/chat/index.d.mts",
|
|
54
|
+
"import": "./es/chat/index.mjs"
|
|
55
|
+
},
|
|
56
|
+
"./color": {
|
|
57
|
+
"types": "./es/color/index.d.mts",
|
|
58
|
+
"import": "./es/color/index.mjs"
|
|
59
|
+
},
|
|
60
|
+
"./icons": {
|
|
61
|
+
"types": "./es/icons/index.d.mts",
|
|
62
|
+
"import": "./es/icons/index.mjs"
|
|
63
|
+
},
|
|
64
|
+
"./mdx": {
|
|
65
|
+
"types": "./es/mdx/index.d.mts",
|
|
66
|
+
"import": "./es/mdx/index.mjs"
|
|
67
|
+
},
|
|
68
|
+
"./mobile": {
|
|
69
|
+
"types": "./es/mobile/index.d.mts",
|
|
70
|
+
"import": "./es/mobile/index.mjs"
|
|
71
|
+
},
|
|
72
|
+
"./storybook": {
|
|
73
|
+
"types": "./es/storybook/index.d.mts",
|
|
74
|
+
"import": "./es/storybook/index.mjs"
|
|
75
|
+
},
|
|
76
|
+
"./base-ui": {
|
|
77
|
+
"types": "./es/base-ui/index.d.mts",
|
|
78
|
+
"import": "./es/base-ui/index.mjs"
|
|
45
79
|
},
|
|
46
80
|
"./es/*": {
|
|
47
81
|
"types": "./es/*.d.mts",
|
|
48
|
-
"import": "./es/*.mjs"
|
|
49
|
-
"default": "./es/*.mjs"
|
|
50
|
-
},
|
|
51
|
-
"./*": {
|
|
52
|
-
"types": "./*.d.ts",
|
|
53
|
-
"import": "./*.js",
|
|
54
|
-
"default": "./*.js"
|
|
82
|
+
"import": "./es/*.mjs"
|
|
55
83
|
}
|
|
56
84
|
},
|
|
57
85
|
"main": "es/index.mjs",
|
|
58
86
|
"module": "es/index.mjs",
|
|
59
87
|
"types": "es/index.d.mts",
|
|
60
88
|
"files": [
|
|
61
|
-
"es"
|
|
62
|
-
"awesome.d.ts",
|
|
63
|
-
"awesome.js",
|
|
64
|
-
"brand.d.ts",
|
|
65
|
-
"brand.js",
|
|
66
|
-
"chat.d.ts",
|
|
67
|
-
"chat.js",
|
|
68
|
-
"mdx.d.ts",
|
|
69
|
-
"mdx.js",
|
|
70
|
-
"mobile.d.ts",
|
|
71
|
-
"mobile.js",
|
|
72
|
-
"storybook.d.ts",
|
|
73
|
-
"storybook.js",
|
|
74
|
-
"color.d.ts",
|
|
75
|
-
"color.js",
|
|
76
|
-
"icons.d.ts",
|
|
77
|
-
"icons.js"
|
|
89
|
+
"es"
|
|
78
90
|
],
|
|
79
91
|
"scripts": {
|
|
80
92
|
"build": "tsdown && npm run build:packages",
|
|
@@ -224,7 +236,7 @@
|
|
|
224
236
|
"dotenv": "^17.2.3",
|
|
225
237
|
"dpdm": "^3.14.0",
|
|
226
238
|
"dumi": "^2.4.23",
|
|
227
|
-
"dumi-theme-lobehub": "^
|
|
239
|
+
"dumi-theme-lobehub": "^5",
|
|
228
240
|
"eslint": "^9.39.2",
|
|
229
241
|
"eslint-plugin-sort-keys-fix": "^1.1.2",
|
|
230
242
|
"figma-js": "1.16.1-0",
|
|
@@ -249,7 +261,7 @@
|
|
|
249
261
|
},
|
|
250
262
|
"peerDependencies": {
|
|
251
263
|
"@lobehub/fluent-emoji": "^4.0.0",
|
|
252
|
-
"@lobehub/icons": "^
|
|
264
|
+
"@lobehub/icons": "^5.0.0",
|
|
253
265
|
"antd": "^6.1.1",
|
|
254
266
|
"motion": "^12.0.0",
|
|
255
267
|
"react": "^19.0.0",
|
|
@@ -259,5 +271,8 @@
|
|
|
259
271
|
"access": "public",
|
|
260
272
|
"provenance": true,
|
|
261
273
|
"registry": "https://registry.npmjs.org"
|
|
274
|
+
},
|
|
275
|
+
"patchedDependencies": {
|
|
276
|
+
"conventional-changelog-gitmoji-config@1.5.2": "patches/conventional-changelog-gitmoji-config@1.5.2.patch"
|
|
262
277
|
}
|
|
263
278
|
}
|
package/awesome.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './es/awesome/index.mjs';
|
package/awesome.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './es/awesome/index.mjs';
|
package/brand.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './es/brand/index.mjs';
|
package/brand.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './es/brand/index.mjs';
|
package/chat.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './es/chat/index.mjs';
|
package/chat.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './es/chat/index.mjs';
|
package/color.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './es/color/index.mjs';
|
package/color.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './es/color/index.mjs';
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as react125 from "react";
|
|
2
|
-
import * as react_jsx_runtime61 from "react/jsx-runtime";
|
|
3
|
-
|
|
4
|
-
//#region src/ContextMenu/ContextMenuHost.d.ts
|
|
5
|
-
declare const ContextMenuHost: react125.MemoExoticComponent<() => react_jsx_runtime61.JSX.Element | null>;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { ContextMenuHost };
|
|
8
|
-
//# sourceMappingURL=ContextMenuHost.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenuHost.mjs","names":[],"sources":["../../src/ContextMenu/ContextMenuHost.tsx"],"sourcesContent":["'use client';\n\nimport { ContextMenu } from '@base-ui/react/context-menu';\nimport { memo, useEffect, useMemo, useSyncExternalStore } from 'react';\n\nimport { useIsClient } from '@/hooks/useIsClient';\nimport { useAppElement } from '@/ThemeProvider';\nimport { registerDevSingleton } from '@/utils/devSingleton';\nimport { preventDefaultAndStopPropagation } from '@/utils/dom';\n\nimport { renderContextMenuItems } from './renderItems';\nimport {\n closeContextMenu,\n getServerSnapshot,\n getSnapshot,\n setContextMenuState,\n subscribe,\n updateLastPointer,\n} from './store';\nimport { styles } from './style';\n\nexport const ContextMenuHost = memo(() => {\n const isClient = useIsClient();\n const appElement = useAppElement();\n const state = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n\n useEffect(() => {\n const DEV = process.env.NODE_ENV === 'development';\n if (!isClient || !DEV) return;\n return registerDevSingleton('ContextMenuHost', document.body);\n }, [isClient]);\n\n useEffect(() => {\n const handler = (event: MouseEvent | PointerEvent) => updateLastPointer(event);\n window.addEventListener('pointerdown', handler, true);\n window.addEventListener('contextmenu', handler, true);\n return () => {\n window.removeEventListener('pointerdown', handler, true);\n window.removeEventListener('contextmenu', handler, true);\n };\n }, []);\n\n const menuItems = useMemo(\n () =>\n renderContextMenuItems(state.items, [], {\n iconAlign: state.iconAlign,\n iconSpaceMode: state.iconSpaceMode,\n }),\n [state.items, state.iconAlign, state.iconSpaceMode],\n );\n if (!isClient) return null;\n if (!state.open && state.items.length === 0) return null;\n\n return (\n <ContextMenu.Root\n open={state.open}\n onOpenChange={(open) => {\n if (open) {\n setContextMenuState({ open });\n return;\n }\n closeContextMenu();\n }}\n >\n <ContextMenu.Portal container={appElement}>\n <ContextMenu.Positioner\n anchor={state.anchor ?? undefined}\n className={styles.positioner}\n sideOffset={6}\n >\n <ContextMenu.Popup\n className={styles.popup}\n onContextMenu={preventDefaultAndStopPropagation}\n >\n {menuItems}\n </ContextMenu.Popup>\n </ContextMenu.Positioner>\n </ContextMenu.Portal>\n </ContextMenu.Root>\n );\n});\n\nContextMenuHost.displayName = 'ContextMenuHost';\n"],"mappings":";;;;;;;;;;;;;;AAqBA,MAAa,kBAAkB,WAAW;CACxC,MAAM,WAAW,aAAa;CAC9B,MAAM,aAAa,eAAe;CAClC,MAAM,QAAQ,qBAAqB,WAAW,aAAa,kBAAkB;AAE7E,iBAAgB;EACd,MAAM,MAAM,QAAQ,IAAI,aAAa;AACrC,MAAI,CAAC,YAAY,CAAC,IAAK;AACvB,SAAO,qBAAqB,mBAAmB,SAAS,KAAK;IAC5D,CAAC,SAAS,CAAC;AAEd,iBAAgB;EACd,MAAM,WAAW,UAAqC,kBAAkB,MAAM;AAC9E,SAAO,iBAAiB,eAAe,SAAS,KAAK;AACrD,SAAO,iBAAiB,eAAe,SAAS,KAAK;AACrD,eAAa;AACX,UAAO,oBAAoB,eAAe,SAAS,KAAK;AACxD,UAAO,oBAAoB,eAAe,SAAS,KAAK;;IAEzD,EAAE,CAAC;CAEN,MAAM,YAAY,cAEd,uBAAuB,MAAM,OAAO,EAAE,EAAE;EACtC,WAAW,MAAM;EACjB,eAAe,MAAM;EACtB,CAAC,EACJ;EAAC,MAAM;EAAO,MAAM;EAAW,MAAM;EAAc,CACpD;AACD,KAAI,CAAC,SAAU,QAAO;AACtB,KAAI,CAAC,MAAM,QAAQ,MAAM,MAAM,WAAW,EAAG,QAAO;AAEpD,QACE,oBAAC,YAAY;EACX,MAAM,MAAM;EACZ,eAAe,SAAS;AACtB,OAAI,MAAM;AACR,wBAAoB,EAAE,MAAM,CAAC;AAC7B;;AAEF,qBAAkB;;YAGpB,oBAAC,YAAY;GAAO,WAAW;aAC7B,oBAAC,YAAY;IACX,QAAQ,MAAM,UAAU;IACxB,WAAW,OAAO;IAClB,YAAY;cAEZ,oBAAC,YAAY;KACX,WAAW,OAAO;KAClB,eAAe;eAEd;MACiB;KACG;IACN;GACJ;EAErB;AAEF,gBAAgB,cAAc"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenuTrigger.mjs","names":[],"sources":["../../src/ContextMenu/ContextMenuTrigger.tsx"],"sourcesContent":["'use client';\n\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport clsx from 'clsx';\nimport React, {\n cloneElement,\n type HTMLAttributes,\n isValidElement,\n memo,\n type MouseEvent,\n type ReactNode,\n useCallback,\n useId,\n useSyncExternalStore,\n} from 'react';\n\nimport { CLASSNAMES } from '@/styles/classNames';\n\nimport { getServerSnapshot, getSnapshot, showContextMenu, subscribe } from './store';\nimport { type ContextMenuItem } from './type';\n\nexport type ContextMenuTriggerProps = {\n children: ReactNode;\n /**\n * Menu items to display. Supports lazy rendering via function.\n * When provided, context menu will be automatically shown on right-click.\n */\n items?: ContextMenuItem[] | (() => ContextMenuItem[]);\n /**\n * Custom context menu handler. If `items` is provided, this is optional.\n */\n onContextMenu?: (event: MouseEvent<HTMLElement>) => void;\n} & Omit<HTMLAttributes<HTMLElement>, 'onContextMenu' | 'children'>;\n\nconst styles = {\n trigger: {\n display: 'contents',\n },\n};\n\nexport const ContextMenuTrigger = memo<ContextMenuTriggerProps>(\n ({ children, items, onContextMenu, ...rest }) => {\n const triggerId = useId();\n const state = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n const open = state.open && state.triggerId === triggerId;\n\n const handleContextMenu = useCallback(\n (event: MouseEvent<HTMLElement>) => {\n if (items) {\n event.preventDefault();\n const resolvedItems = typeof items === 'function' ? items() : items;\n showContextMenu(resolvedItems);\n }\n onContextMenu?.(event);\n },\n [items, onContextMenu],\n );\n\n const triggerProps = {\n ...rest,\n 'aria-expanded': open || undefined,\n 'className': clsx(CLASSNAMES.ContextTrigger, rest.className),\n 'data-contextmenu-trigger': triggerId,\n 'data-popup-open': open ? '' : undefined,\n 'data-state': open ? 'open' : undefined,\n 'onContextMenu': handleContextMenu,\n };\n\n if (isValidElement(children) && React.Children.only(children)) {\n return cloneElement(children, mergeProps(children.props as any, triggerProps));\n }\n\n return (\n <span style={styles.trigger} {...triggerProps}>\n {children}\n </span>\n );\n },\n);\n\nContextMenuTrigger.displayName = 'ContextMenuTrigger';\n"],"mappings":";;;;;;;;;;AAkCA,MAAM,SAAS,EACb,SAAS,EACP,SAAS,YACV,EACF;AAED,MAAa,qBAAqB,MAC/B,EAAE,UAAU,OAAO,eAAe,GAAG,WAAW;CAC/C,MAAM,YAAY,OAAO;CACzB,MAAM,QAAQ,qBAAqB,WAAW,aAAa,kBAAkB;CAC7E,MAAM,OAAO,MAAM,QAAQ,MAAM,cAAc;CAE/C,MAAM,oBAAoB,aACvB,UAAmC;AAClC,MAAI,OAAO;AACT,SAAM,gBAAgB;AAEtB,mBADsB,OAAO,UAAU,aAAa,OAAO,GAAG,MAChC;;AAEhC,kBAAgB,MAAM;IAExB,CAAC,OAAO,cAAc,CACvB;CAED,MAAM,eAAe;EACnB,GAAG;EACH,iBAAiB,QAAQ;EACzB,aAAa,KAAK,WAAW,gBAAgB,KAAK,UAAU;EAC5D,4BAA4B;EAC5B,mBAAmB,OAAO,KAAK;EAC/B,cAAc,OAAO,SAAS;EAC9B,iBAAiB;EAClB;AAED,KAAI,eAAe,SAAS,IAAI,MAAM,SAAS,KAAK,SAAS,CAC3D,QAAO,aAAa,UAAU,WAAW,SAAS,OAAc,aAAa,CAAC;AAGhF,QACE,oBAAC;EAAK,OAAO,OAAO;EAAS,GAAI;EAC9B;GACI;EAGZ;AAED,mBAAmB,cAAc"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"renderItems.mjs","names":["common","info: MenuInfo","label","labelText","isDanger","Icon"],"sources":["../../src/ContextMenu/renderItems.tsx"],"sourcesContent":["import { ContextMenu } from '@base-ui/react/context-menu';\nimport { Switch } from 'antd';\nimport { cx } from 'antd-style';\nimport { 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';\nimport { memo, useCallback, useState } from 'react';\n\nimport common from '@/i18n/resources/en/common';\nimport { useTranslation } from '@/i18n/useTranslation';\nimport Icon from '@/Icon';\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 { preventDefaultAndStopPropagation } from '@/utils/dom';\n\nimport { styles } from './style';\nimport {\n type ContextMenuCheckboxItem,\n type ContextMenuItem,\n type ContextMenuSwitchItem,\n} from './type';\n\nexport type { IconAlign, IconSpaceMode } from '@/Menu';\n\nconst EmptyMenuItem = memo(() => {\n const { t } = useTranslation(common);\n return (\n <ContextMenu.Item disabled className={cx(styles.item, styles.empty)}>\n <div className={styles.itemContent}>\n <span className={styles.label}>{t('common.empty')}</span>\n </div>\n </ContextMenu.Item>\n );\n});\n\nEmptyMenuItem.displayName = 'EmptyMenuItem';\n\ninterface ContextMenuSwitchItemInternalProps {\n checked?: boolean;\n children: ReactNode;\n closeOnClick?: boolean;\n danger?: boolean;\n defaultChecked?: boolean;\n disabled?: boolean;\n label?: string;\n onCheckedChange?: (checked: boolean) => void;\n}\n\nconst ContextMenuSwitchItemInternal = ({\n checked: checkedProp,\n children,\n closeOnClick = false,\n danger,\n defaultChecked,\n disabled,\n label,\n onCheckedChange,\n}: ContextMenuSwitchItemInternalProps) => {\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 <ContextMenu.Item\n className={cx(styles.item, danger && styles.danger)}\n closeOnClick={closeOnClick}\n disabled={disabled}\n label={label}\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 </ContextMenu.Item>\n );\n};\n\nconst renderItemContent = (\n item: MenuItemType | SubMenuType | ContextMenuCheckboxItem | ContextMenuSwitchItem,\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 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 <div className={styles.labelGroup}>\n <span className={styles.label}>{label}</span>\n <span className={styles.desc}>{desc}</span>\n </div>\n ) : (\n <span className={styles.label}>{label}</span>\n );\n\n return (\n <div className={cx(styles.itemContent, alignStart && styles.itemContentAlignStart)}>\n {shouldRenderIcon ? (\n <span\n aria-hidden={!hasIcon}\n className={cx(styles.icon, alignStart && styles.iconAlignStart)}\n >\n {hasCustomIcon ? iconNode : hasIcon ? renderIcon(item.icon, 'small') : null}\n </span>\n ) : null}\n {labelNode}\n {extra ? <span className={styles.extra}>{extra}</span> : null}\n {indicatorOnRight && iconNode ? iconNode : null}\n {options?.submenu ? (\n <span className={styles.submenuArrow}>\n <ChevronRight size={16} />\n </span>\n ) : null}\n </div>\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 renderContextMenuItems = (\n items: ContextMenuItem[],\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 ContextMenuCheckboxItem).type === 'checkbox') {\n const checkboxItem = item as ContextMenuCheckboxItem;\n const label = getItemLabel(checkboxItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = Boolean(checkboxItem.danger);\n const indicator = (\n <ContextMenu.CheckboxItemIndicator>\n <Icon icon={Check} size={'small'} />\n </ContextMenu.CheckboxItemIndicator>\n );\n\n return (\n <ContextMenu.CheckboxItem\n checked={checkboxItem.checked}\n className={cx(styles.item, isDanger && styles.danger)}\n closeOnClick={checkboxItem.closeOnClick}\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 </ContextMenu.CheckboxItem>\n );\n }\n\n if ((item as ContextMenuSwitchItem).type === 'switch') {\n const switchItem = item as ContextMenuSwitchItem;\n const label = getItemLabel(switchItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = Boolean(switchItem.danger);\n\n return (\n <ContextMenuSwitchItemInternal\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={switchItem.onCheckedChange}\n >\n {renderItemContent(switchItem, { iconAlign, reserveIconSpace })}\n </ContextMenuSwitchItemInternal>\n );\n }\n\n if ((item as MenuDividerType).type === 'divider') {\n return <ContextMenu.Separator className={styles.separator} 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 <ContextMenu.Group key={itemKey}>\n {group.label ? (\n <ContextMenu.GroupLabel className={styles.groupLabel}>\n {group.label}\n </ContextMenu.GroupLabel>\n ) : null}\n {group.children\n ? renderContextMenuItems(group.children, nextKeyPath, {\n iconAlign,\n iconSpaceMode,\n indicatorOnRight: groupIndicatorOnRight,\n reserveIconSpace: groupReserveIconSpace,\n })\n : null}\n </ContextMenu.Group>\n );\n }\n\n if (\n (item as SubMenuType).type === 'submenu' ||\n ('children' in item && (item as SubMenuType).children)\n ) {\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 <ContextMenu.SubmenuRoot key={itemKey}>\n <ContextMenu.SubmenuTrigger\n className={cx(styles.item, isDanger && styles.danger)}\n disabled={submenu.disabled}\n label={labelText}\n >\n {renderItemContent(submenu, {\n iconAlign,\n reserveIconSpace,\n submenu: true,\n })}\n </ContextMenu.SubmenuTrigger>\n <ContextMenu.Portal>\n <ContextMenu.Positioner\n alignOffset={-4}\n className={styles.positioner}\n data-submenu=\"\"\n sideOffset={-1}\n onContextMenu={preventDefaultAndStopPropagation}\n >\n <ContextMenu.Popup className={styles.popup}>\n {submenu.children && submenu.children.length > 0 ? (\n renderContextMenuItems(submenu.children, nextKeyPath, {\n iconAlign,\n iconSpaceMode,\n })\n ) : (\n <EmptyMenuItem />\n )}\n </ContextMenu.Popup>\n </ContextMenu.Positioner>\n </ContextMenu.Portal>\n </ContextMenu.SubmenuRoot>\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 <ContextMenu.Item\n className={cx(styles.item, isDanger && styles.danger)}\n closeOnClick={menuItem.closeOnClick}\n disabled={menuItem.disabled}\n key={itemKey}\n label={labelText}\n onClick={(event) => invokeItemClick(menuItem, nextKeyPath, event)}\n >\n {renderItemContent(menuItem, { iconAlign, reserveIconSpace })}\n </ContextMenu.Item>\n );\n });\n};\n"],"mappings":";;;;;;;;;;;;;;AAuCA,MAAM,gBAAgB,WAAW;CAC/B,MAAM,EAAE,MAAM,eAAeA,eAAO;AACpC,QACE,oBAAC,YAAY;EAAK;EAAS,WAAW,GAAG,OAAO,MAAM,OAAO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enuState: ContextMenuState"],"sources":["../../src/ContextMenu/store.ts"],"sourcesContent":["import type { VirtualElement } from '@floating-ui/react';\n\nimport type { IconAlign } from '@/Menu';\n\nimport type { IconSpaceMode } from './renderItems';\nimport type { ContextMenuItem } from './type';\n\nexport type ContextMenuState = {\n anchor: VirtualElement | null;\n iconAlign?: IconAlign;\n iconSpaceMode: IconSpaceMode;\n items: ContextMenuItem[];\n open: boolean;\n triggerId: string | null;\n};\n\nconst emptyState: ContextMenuState = {\n anchor: null,\n iconSpaceMode: 'global',\n items: [],\n open: false,\n triggerId: null,\n};\n\nlet contextMenuState: ContextMenuState = emptyState;\nconst listeners = new Set<() => void>();\nconst lastPointer = { ready: false, triggerId: null as string | null, x: 0, y: 0 };\n\nconst notify = () => {\n listeners.forEach((listener) => listener());\n};\n\nexport const subscribe = (listener: () => void) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n};\n\nexport const getSnapshot = () => contextMenuState;\nexport const getServerSnapshot = () => emptyState;\n\nexport const updateLastPointer = (event: MouseEvent | PointerEvent) => {\n lastPointer.x = event.clientX;\n lastPointer.y = event.clientY;\n lastPointer.ready = true;\n if (event.target instanceof Element) {\n const trigger = event.target.closest<HTMLElement>('[data-contextmenu-trigger]');\n lastPointer.triggerId = trigger?.dataset.contextmenuTrigger ?? null;\n } else {\n lastPointer.triggerId = null;\n }\n};\n\nconst createVirtualElement = (point: { x: number; y: number }): VirtualElement => ({\n contextElement: typeof document === 'undefined' ? undefined : document.body,\n getBoundingClientRect: () =>\n ({\n bottom: point.y,\n height: 0,\n left: point.x,\n right: point.x,\n toJSON: () => undefined,\n top: point.y,\n width: 0,\n x: point.x,\n y: point.y,\n }) as DOMRect,\n});\n\nexport const setContextMenuState = (next: Partial<ContextMenuState>) => {\n contextMenuState = { ...contextMenuState, ...next };\n notify();\n};\n\nexport interface ShowContextMenuOptions {\n iconAlign?: IconAlign;\n iconSpaceMode?: IconSpaceMode;\n}\n\nexport const showContextMenu = (items: ContextMenuItem[], options?: ShowContextMenuOptions) => {\n if (typeof window === 'undefined') return;\n\n const fallbackPoint = { x: window.innerWidth / 2, y: window.innerHeight / 2 };\n const point = lastPointer.ready ? { x: lastPointer.x, y: lastPointer.y } : fallbackPoint;\n\n setContextMenuState({\n anchor: createVirtualElement(point),\n iconAlign: options?.iconAlign,\n iconSpaceMode: options?.iconSpaceMode ?? 'global',\n items,\n open: true,\n triggerId: lastPointer.triggerId ?? null,\n });\n};\n\n/**\n * Update menu items while keeping current anchor/position.\n * Useful for interactive menu items (e.g. checkbox) to avoid re-positioning.\n */\nexport const updateContextMenuItems = (items: ContextMenuItem[]) => {\n if (typeof window === 'undefined') return;\n setContextMenuState({ items });\n};\n\nexport const closeContextMenu = () => {\n setContextMenuState({\n anchor: null,\n iconSpaceMode: 'global',\n items: [],\n open: false,\n triggerId: null,\n });\n};\n"],"mappings":";AAgBA,MAAMA,aAA+B;CACnC,QAAQ;CACR,eAAe;CACf,OAAO,EAAE;CACT,MAAM;CACN,WAAW;CACZ;AAED,IAAIC,mBAAqC;AACzC,MAAM,4BAAY,IAAI,KAAiB;AACvC,MAAM,cAAc;CAAE,OAAO;CAAO,WAAW;CAAuB,GAAG;CAAG,GAAG;CAAG;AAElF,MAAM,eAAe;AACnB,WAAU,SAAS,aAAa,UAAU,CAAC;;AAG7C,MAAa,aAAa,aAAyB;AACjD,WAAU,IAAI,SAAS;AACvB,cAAa,UAAU,OAAO,SAAS;;AAGzC,MAAa,oBAAoB;AACjC,MAAa,0BAA0B;AAEvC,MAAa,qBAAqB,UAAqC;AACrE,aAAY,IAAI,MAAM;AACtB,aAAY,IAAI,MAAM;AACtB,aAAY,QAAQ;AACpB,KAAI,MAAM,kBAAkB,QAE1B,aAAY,YADI,MAAM,OAAO,QAAqB,6BAA6B,EAC9C,QAAQ,sBAAsB;KAE/D,aAAY,YAAY;;AAI5B,MAAM,wBAAwB,WAAqD;CACjF,gBAAgB,OAAO,aAAa,cAAc,SAAY,SAAS;CACvE,8BACG;EACC,QAAQ,MAAM;EACd,QAAQ;EACR,MAAM,MAAM;EACZ,OAAO,MAAM;EACb,cAAc;EACd,KAAK,MAAM;EACX,OAAO;EACP,GAAG,MAAM;EACT,GAAG,MAAM;EACV;CACJ;AAED,MAAa,uBAAuB,SAAoC;AACtE,oBAAmB;EAAE,GAAG;EAAkB,GAAG;EAAM;AACnD,SAAQ;;AAQV,MAAa,mBAAmB,OAA0B,YAAqC;AAC7F,KAAI,OAAO,WAAW,YAAa;CAEnC,MAAM,gBAAgB;EAAE,GAAG,OAAO,aAAa;EAAG,GAAG,OAAO,cAAc;EAAG;AAG7E,qBAAoB;EAClB,QAAQ,qBAHI,YAAY,QAAQ;GAAE,GAAG,YAAY;GAAG,GAAG,YAAY;GAAG,GAAG,cAGtC;EACnC,WAAW,SAAS;EACpB,eAAe,SAAS,iBAAiB;EACzC;EACA,MAAM;EACN,WAAW,YAAY,aAAa;EACrC,CAAC;;;;;;AAOJ,MAAa,0BAA0B,UAA6B;AAClE,KAAI,OAAO,WAAW,YAAa;AACnC,qBAAoB,EAAE,OAAO,CAAC;;AAGhC,MAAa,yBAAyB;AACpC,qBAAoB;EAClB,QAAQ;EACR,eAAe;EACf,OAAO,EAAE;EACT,MAAM;EACN,WAAW;EACZ,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { MenuCheckboxItemType } from "../Menu/checkboxItem.mjs";
|
|
2
|
-
import { MenuSwitchItemType } from "../Menu/switchItem.mjs";
|
|
3
|
-
import { BaseMenuItemType } from "../Menu/baseItem.mjs";
|
|
4
|
-
import "../Menu/index.mjs";
|
|
5
|
-
|
|
6
|
-
//#region src/ContextMenu/type.d.ts
|
|
7
|
-
type ContextMenuCheckboxItem = MenuCheckboxItemType;
|
|
8
|
-
type ContextMenuSwitchItem = MenuSwitchItemType;
|
|
9
|
-
type ContextMenuItem = BaseMenuItemType;
|
|
10
|
-
//#endregion
|
|
11
|
-
export { ContextMenuCheckboxItem, ContextMenuItem, ContextMenuSwitchItem };
|
|
12
|
-
//# sourceMappingURL=type.d.mts.map
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { DropdownMenuProps } from "./type.mjs";
|
|
2
|
-
import * as react73 from "react";
|
|
3
|
-
|
|
4
|
-
//#region src/DropdownMenu/DropdownMenu.d.ts
|
|
5
|
-
declare const DropdownMenu: react73.NamedExoticComponent<DropdownMenuProps<unknown>>;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { DropdownMenu };
|
|
8
|
-
//# sourceMappingURL=DropdownMenu.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownMenu.mjs","names":[],"sources":["../../src/DropdownMenu/DropdownMenu.tsx"],"sourcesContent":["'use client';\n\nimport { Menu } from '@base-ui/react/menu';\nimport { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { useNativeButton } from '@/hooks/useNativeButton';\nimport { parseTrigger } from '@/utils/parseTrigger';\n\nimport {\n DropdownMenuPopup,\n DropdownMenuPortal,\n DropdownMenuPositioner,\n DropdownMenuTrigger,\n} from './atoms';\nimport { renderDropdownMenuItems } from './renderItems';\nimport type { DropdownMenuProps } from './type';\n\nconst DropdownMenu = memo<DropdownMenuProps>(\n ({\n children,\n defaultOpen,\n iconAlign,\n iconSpaceMode,\n items,\n nativeButton,\n onOpenChange,\n onOpenChangeComplete,\n open,\n placement = 'bottomLeft',\n popupProps,\n portalProps,\n positionerProps,\n trigger = 'click',\n triggerProps,\n ...rest\n }) => {\n const [uncontrolledOpen, setUncontrolledOpen] = useState(Boolean(defaultOpen));\n\n const { openOnHover } = useMemo(() => parseTrigger(trigger), [trigger]);\n\n useEffect(() => {\n if (open === undefined) return;\n setUncontrolledOpen(open);\n }, [open]);\n\n const handleOpenChange = useCallback(\n (nextOpen: boolean, details: Parameters<NonNullable<typeof onOpenChange>>[1]) => {\n onOpenChange?.(nextOpen, details);\n if (open === undefined) {\n setUncontrolledOpen(nextOpen);\n }\n },\n [onOpenChange, open],\n );\n\n const menuItemsRef = useRef<ReturnType<typeof renderDropdownMenuItems> | null>(null);\n const isOpen = open ?? uncontrolledOpen;\n const menuItems = useMemo(() => {\n if (isOpen) {\n const resolvedItems = typeof items === 'function' ? items() : items;\n const renderedItems = renderDropdownMenuItems(resolvedItems, [], {\n iconAlign,\n iconSpaceMode,\n });\n menuItemsRef.current = renderedItems;\n return renderedItems;\n }\n return menuItemsRef.current;\n }, [isOpen, items, iconAlign, iconSpaceMode]);\n const handleOpenChangeComplete = useCallback(\n (nextOpen: boolean) => {\n onOpenChangeComplete?.(nextOpen);\n if (!nextOpen) {\n menuItemsRef.current = null;\n }\n },\n [onOpenChangeComplete],\n );\n const { container: portalContainer, ...restPortalProps } = (portalProps ?? {}) as any;\n\n const { resolvedNativeButton } = useNativeButton({\n children,\n nativeButton,\n triggerNativeButton: triggerProps?.nativeButton,\n });\n\n const triggerElement = (\n <DropdownMenuTrigger\n {...triggerProps}\n nativeButton={resolvedNativeButton}\n openOnHover={openOnHover}\n >\n {children}\n </DropdownMenuTrigger>\n );\n\n return (\n <Menu.Root\n {...rest}\n defaultOpen={defaultOpen}\n modal={false}\n open={open}\n onOpenChange={handleOpenChange}\n onOpenChangeComplete={handleOpenChangeComplete}\n >\n {triggerElement}\n <DropdownMenuPortal container={portalContainer} {...restPortalProps}>\n <DropdownMenuPositioner\n {...positionerProps}\n hoverTrigger={openOnHover}\n placement={placement}\n >\n <DropdownMenuPopup {...popupProps}>{menuItems}</DropdownMenuPopup>\n </DropdownMenuPositioner>\n </DropdownMenuPortal>\n </Menu.Root>\n );\n },\n);\n\nDropdownMenu.displayName = 'DropdownMenuV2';\n\nexport default DropdownMenu;\n"],"mappings":";;;;;;;;;;;AAiBA,MAAM,eAAe,MAClB,EACC,UACA,aACA,WACA,eACA,OACA,cACA,cACA,sBACA,MACA,YAAY,cACZ,YACA,aACA,iBACA,UAAU,SACV,cACA,GAAG,WACC;CACJ,MAAM,CAAC,kBAAkB,uBAAuB,SAAS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,"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 { styles } from '@/Menu/sharedStyle';\nimport { CLASSNAMES } from '@/styles/classNames';\nimport { useAppElement } from '@/ThemeProvider';\nimport { placementMap } from '@/utils/placement';\n\nimport { type DropdownMenuPlacement } from './type';\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 appElement = useAppElement();\n return <Menu.Portal container={container ?? appElement ?? undefined} {...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,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,cAAc;AACtE,SAAO,aAAa,UAAiB;GACnC,GAAG;GACH,WAAW,KAAK,WAAW,qBAAqB,WAAW,YAAY,UAAU;GACjF,KAAK,UAAU;IAAE,SAAiB;IAAM,MAAc;IAAK;IAAQ,CAAC;GACrE,CAAC;;AAGJ,KAAI,eAAe,SAAS,CAC1B,QAAO,oBAACA,OAAK;EAAQ,GAAI;EAAM,cAAc;EAAsB,QAAQ;GAAmB;AAGhG,QACE,oBAACA,OAAK;EACJ,GAAI;EACJ,WAAW,KAAK,WAAW,qBAAqB,UAAU;EAC1D,cAAc;EACd,KAAK;EAEJ;GACY;;AAInB,oBAAoB,cAAc;AASlC,MAAa,sBAAsB,EAAE,WAAW,GAAG,WAAoC;CACrF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AAyB,EAAE,WAAW,GAAG,WAAuC;AAC3F,QAAO,oBAAC;EAAK,GAAI;EAAM,WAAW,GAAG,OAAO,OAAO,UAAU;GAAI;;AAGnE,sBAAsB,cAAc;AAIpC,MAAa,4BAA4B,EAAE,WAAW,GAAG,WAA0C;AACjG,QAAO,oBAAC;EAAK,GAAI;EAAM,WAAW,GAAG,OAAO,cAAc,UAAU;GAAI;;AAG1E,yBAAyB,cAAc;AAavC,MAAa,0BAA0B,EACrC,SAAS,aACT,WACA,eAAe,OACf,QACA,gBACA,UACA,iBACA,UACA,GAAG,WAC8B;CACjC,MAAM,CAAC,iBAAiB,sBAAsB,SAAS,kBAAkB,MAAM;CAC/E,MAAM,eAAe,gBAAgB;CACrC,MAAM,UAAU,eAAe,cAAc;CAE7C,MAAM,sBAAsB,aACzB,eAAwB;AACvB,MAAI,CAAC,aACH,oBAAmB,WAAW;AAEhC,oBAAkB,WAAW;IAE/B,CAAC,cAAc,gBAAgB,CAChC;AAED,QACE,qBAACA,OAAK;EACJ,GAAI;EACU;EACJ;EACV,YAAY,UACV,GACE,OAAO,MACP,UAAU,OAAO,QACjB,OAAO,cAAc,aAAa,UAAU,MAAM,GAAG,UACtD;EAEH,UAAU,MAAM;AACd,KAAE,gBAAgB;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 +0,0 @@
|
|
|
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,MAA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M,QAAQ,oBAAC,oCAAwB,MAAM,QAA+B,GAAG,MAC/E,MAAM,WACH,wBAAwB,MAAM,UAAU,aAAa;IACnD;IACA;IACA,kBAAkB;IAClB,kBAAkB;IACnB,CAAC,GACF,SATkB,QAUJ;;AAIxB,MAAK,KAAqB,SAAS,aAAa,cAAc,MAAM;GAClE,MAAM,UAAU;GAChB,MAAMD,UAAQ,aAAa,QAAQ;GACnC,MAAMC,cAAY,OAAOD,YAAU,WAAWA,UAAQ;AAGtD,UACE,qBAAC,sCACC,oBAAC;IACC,QALW,YAAY,WAAW,QAAQ,QAAQ,OAAO;IAMzD,UAAU,QAAQ;IAClB,OAAOC;cAEN,kBAAkB,SAAS;KAC1B;KACA;KACA,SAAS;KACV,CAAC;KACyB,EAC7B,oBAAC,gCACC,oBAAC;IAAuB,aAAa;IAAI,gBAAa;IAAG,YAAY;cACnE,oBAAC,+BACE,QAAQ,WACL,wBAAwB,QAAQ,UAAU,aAAa;KACrD;KACA;KACD,CAAC,GACF,OACc;KACG,GACN,KAvBO,QAwBJ;;EAI9B,MAAM,WAAW;EACjB,MAAM,QAAQ,aAAa,SAAS;EACpC,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;IAAE;IAAW;IAAkB,CAAC;KAJxD,QAKY;GAErB"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { LobeSelectProps } from "./type.mjs";
|
|
2
|
-
import * as react34 from "react";
|
|
3
|
-
|
|
4
|
-
//#region src/LobeSelect/LobeSelect.d.ts
|
|
5
|
-
declare const LobeSelect: react34.NamedExoticComponent<LobeSelectProps<any>>;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { LobeSelect };
|
|
8
|
-
//# sourceMappingURL=LobeSelect.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LobeSelect.mjs","names":["mergedOptions: LobeSelectOptions","missingValueOptions: LobeSelectOption<any>[]","styles","option","content","Icon","baseStyle: React.CSSProperties","indices: number[]","menuStyles","currentIndex"],"sources":["../../src/LobeSelect/LobeSelect.tsx"],"sourcesContent":["'use client';\n\nimport { Select } from '@base-ui/react/select';\nimport { cx, useThemeMode } from 'antd-style';\nimport { Check, ChevronDown, Loader2, X } from 'lucide-react';\nimport {\n type ChangeEvent,\n type HTMLAttributes,\n type KeyboardEvent,\n type MouseEvent,\n type MutableRefObject,\n type Ref,\n} from 'react';\nimport { isValidElement, memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { Virtualizer } from 'virtua';\n\nimport Icon from '@/Icon';\nimport { styles as menuStyles } from '@/Menu/sharedStyle';\nimport { useAppElement } from '@/ThemeProvider';\n\nimport { styles, triggerVariants } from './style';\nimport {\n type LobeSelectOption,\n type LobeSelectOptionGroup,\n type LobeSelectOptions,\n type LobeSelectProps,\n} from './type';\n\nconst isGroupOption = <Value,>(\n option: LobeSelectOption<Value> | LobeSelectOptionGroup<Value>,\n): option is LobeSelectOptionGroup<Value> =>\n Boolean((option as LobeSelectOptionGroup<Value>).options);\n\nconst getOptionSearchText = <Value,>(option: LobeSelectOption<Value>) => {\n if (typeof option.label === 'string' || typeof option.label === 'number') {\n return String(option.label);\n }\n if (typeof option.value === 'string' || typeof option.value === 'number') {\n return String(option.value);\n }\n if (option.title) return option.title;\n return '';\n};\n\nconst escapeRegExp = (value: string) => value.replaceAll(/[$()*+.?[\\\\\\]^{|}]/g, '\\\\$&');\n\nconst splitBySeparators = (value: string, separators?: string[]) => {\n if (!separators || separators.length === 0) return [value];\n const pattern = separators.map(escapeRegExp).join('|');\n return value.split(new RegExp(pattern, 'g'));\n};\n\nconst countVirtualItems = (items: LobeSelectOptions) =>\n items.reduce((count, item) => {\n if (isGroupOption(item)) {\n return count + item.options.length + 1;\n }\n return count + 1;\n }, 0);\n\nconst isValueEmpty = (value: unknown) => value === null || value === undefined || value === '';\n\nconst LobeSelect = memo<LobeSelectProps<any>>(\n ({\n allowClear,\n autoFocus,\n className,\n classNames,\n defaultOpen,\n defaultValue,\n disabled,\n id,\n labelRender,\n listHeight = 512,\n listItemHeight,\n loading,\n mode,\n name,\n onChange,\n onOpenChange,\n onSelect,\n open,\n optionRender,\n options,\n placeholder,\n popupClassName,\n popupMatchSelectWidth,\n prefix,\n readOnly,\n required,\n behaviorVariant = 'default',\n selectedIndicatorVariant = 'check',\n shadow,\n showSearch,\n size = 'middle',\n style,\n suffixIcon,\n suffixIconProps,\n tokenSeparators,\n value,\n variant,\n virtual,\n }) => {\n const { isDarkMode } = useThemeMode();\n const resolvedVariant = variant ?? (isDarkMode ? 'filled' : 'outlined');\n const isMultiple = mode === 'multiple' || mode === 'tags';\n const isItemAligned = behaviorVariant === 'item-aligned';\n\n const [uncontrolledValue, setUncontrolledValue] = useState<any>(() => {\n if (defaultValue !== undefined) return defaultValue;\n return isMultiple ? [] : null;\n });\n\n const normalizeValue = useCallback(\n (nextValue: any) => {\n if (isMultiple) {\n if (Array.isArray(nextValue)) return nextValue;\n if (nextValue === null || nextValue === undefined) return [];\n return [nextValue];\n }\n if (Array.isArray(nextValue)) return nextValue[0] ?? null;\n return nextValue === undefined ? null : nextValue;\n },\n [isMultiple],\n );\n\n const mergedValue = value !== undefined ? value : uncontrolledValue;\n const normalizedValue = useMemo(\n () => normalizeValue(mergedValue),\n [mergedValue, normalizeValue],\n );\n const valueArray = useMemo(\n () =>\n isMultiple\n ? (normalizedValue as any[])\n : isValueEmpty(normalizedValue)\n ? []\n : [normalizedValue],\n [isMultiple, normalizedValue],\n );\n\n const [extraOptions, setExtraOptions] = useState<LobeSelectOption<any>[]>([]);\n\n useEffect(() => {\n if (mode !== 'tags' && extraOptions.length > 0) {\n setExtraOptions([]);\n }\n }, [mode, extraOptions.length]);\n\n const { resolvedOptions, optionMap } = useMemo(() => {\n const baseOptions = options ?? [];\n const optionValueMap = new Map<any, LobeSelectOption<any>>();\n\n const addOption = (item: LobeSelectOption<any>) => {\n if (!optionValueMap.has(item.value)) {\n optionValueMap.set(item.value, item);\n }\n };\n\n const walkOptions = (items: LobeSelectOptions) => {\n items.forEach((item) => {\n if (isGroupOption(item)) {\n item.options.forEach(addOption);\n } else {\n addOption(item);\n }\n });\n };\n\n walkOptions(baseOptions);\n\n const filteredExtraOptions = extraOptions.filter((item) => !optionValueMap.has(item.value));\n filteredExtraOptions.forEach(addOption);\n\n const mergedOptions: LobeSelectOptions = [...baseOptions, ...filteredExtraOptions];\n\n const missingValueOptions: LobeSelectOption<any>[] = valueArray\n .filter((val) => !optionValueMap.has(val))\n .map((val) => ({\n label: String(val),\n value: val,\n }));\n missingValueOptions.forEach(addOption);\n\n return {\n optionMap: optionValueMap,\n resolvedOptions: missingValueOptions.length\n ? [...mergedOptions, ...missingValueOptions]\n : mergedOptions,\n };\n }, [extraOptions, options, valueArray]);\n\n const [uncontrolledOpen, setUncontrolledOpen] = useState(Boolean(defaultOpen));\n\n useEffect(() => {\n if (open !== undefined) {\n setUncontrolledOpen(open);\n }\n }, [open]);\n\n const mergedOpen = open ?? uncontrolledOpen;\n\n const handleOpenChange = useCallback(\n (nextOpen: boolean) => {\n onOpenChange?.(nextOpen);\n if (open === undefined) {\n setUncontrolledOpen(nextOpen);\n }\n },\n [onOpenChange, open],\n );\n\n const [searchValue, setSearchValue] = useState('');\n const shouldShowSearch = Boolean(showSearch || mode === 'tags');\n\n useEffect(() => {\n if (!mergedOpen) setSearchValue('');\n }, [mergedOpen]);\n\n const getOption = useCallback(\n (optionValue: any): LobeSelectOption<any> => {\n const matched = optionMap.get(optionValue);\n if (matched) return matched;\n if (optionValue && typeof optionValue === 'object' && 'label' in optionValue) {\n return {\n label: (optionValue as any).label,\n value: optionValue,\n };\n }\n return {\n label: String(optionValue),\n value: optionValue,\n };\n },\n [optionMap],\n );\n\n const previousValueRef = useRef<any>(normalizedValue);\n\n useEffect(() => {\n previousValueRef.current = normalizedValue;\n }, [normalizedValue]);\n\n const handleValueChange = useCallback(\n (nextValue: any) => {\n const normalizedNextValue = normalizeValue(nextValue);\n const previousValue = previousValueRef.current;\n\n if (isMultiple) {\n const prevValues = Array.isArray(previousValue) ? previousValue : [];\n const nextValues = Array.isArray(normalizedNextValue) ? normalizedNextValue : [];\n const addedValues = nextValues.filter(\n (val) => !prevValues.some((prev) => Object.is(prev, val)),\n );\n\n addedValues.forEach((val) => {\n onSelect?.(val, getOption(val));\n });\n\n if (value === undefined) {\n setUncontrolledValue(nextValues);\n }\n onChange?.(\n nextValues,\n nextValues.map((val) => getOption(val)),\n );\n } else {\n if (\n !isValueEmpty(normalizedNextValue) &&\n !Object.is(previousValue, normalizedNextValue)\n ) {\n onSelect?.(normalizedNextValue, getOption(normalizedNextValue));\n }\n if (value === undefined) {\n setUncontrolledValue(normalizedNextValue);\n }\n onChange?.(\n normalizedNextValue,\n isValueEmpty(normalizedNextValue) ? undefined : getOption(normalizedNextValue),\n );\n }\n\n previousValueRef.current = normalizedNextValue;\n },\n [getOption, isMultiple, normalizeValue, onChange, onSelect, value],\n );\n\n const appendTagValues = useCallback(\n (rawValues: string[]) => {\n const valuesToAdd = rawValues.map((val) => val.trim()).filter(Boolean);\n if (!valuesToAdd.length) return;\n\n const nextValues = [...valueArray];\n const newOptionValues = valuesToAdd.filter((val) => !optionMap.has(val));\n\n if (newOptionValues.length > 0) {\n setExtraOptions((prev) => {\n const existingValues = new Set(prev.map((item) => item.value));\n const merged = [...prev];\n newOptionValues.forEach((val) => {\n if (!existingValues.has(val)) {\n merged.push({ label: val, value: val });\n }\n });\n return merged;\n });\n }\n\n valuesToAdd.forEach((val) => {\n if (!nextValues.some((item) => Object.is(item, val))) {\n nextValues.push(val);\n }\n });\n\n if (nextValues.length !== valueArray.length) {\n handleValueChange(nextValues);\n }\n },\n [handleValueChange, optionMap, valueArray],\n );\n\n const handleSearchChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n const nextValue = event.target.value;\n if (mode === 'tags') {\n const parts = splitBySeparators(nextValue, tokenSeparators);\n if (parts.length > 1) {\n const pending = parts.pop() ?? '';\n appendTagValues(parts.filter(Boolean));\n setSearchValue(pending);\n return;\n }\n }\n setSearchValue(nextValue);\n },\n [appendTagValues, mode, tokenSeparators],\n );\n\n const handleSearchKeyDown = useCallback(\n (event: KeyboardEvent<HTMLInputElement>) => {\n event.stopPropagation();\n\n if (event.key === 'Escape') {\n handleOpenChange(false);\n return;\n }\n\n if (mode !== 'tags') return;\n\n if (event.key === 'Enter') {\n event.preventDefault();\n event.stopPropagation();\n appendTagValues([searchValue]);\n setSearchValue('');\n return;\n }\n\n if (tokenSeparators?.includes(event.key)) {\n event.preventDefault();\n event.stopPropagation();\n appendTagValues([searchValue]);\n setSearchValue('');\n }\n },\n [appendTagValues, handleOpenChange, mode, searchValue, tokenSeparators],\n );\n\n const filteredOptions = useMemo(() => {\n if (!shouldShowSearch || !searchValue.trim()) return resolvedOptions;\n const query = searchValue.trim().toLowerCase();\n\n const filterItems = (items: LobeSelectOptions): LobeSelectOptions => {\n const filtered = items\n .map((item) => {\n if (isGroupOption(item)) {\n const groupItems = item.options.filter((option) =>\n getOptionSearchText(option).toLowerCase().includes(query),\n );\n if (!groupItems.length) return null;\n return { ...item, options: groupItems };\n }\n return getOptionSearchText(item).toLowerCase().includes(query) ? item : null;\n })\n .filter(Boolean) as LobeSelectOptions;\n\n return filtered;\n };\n\n return filterItems(resolvedOptions);\n }, [resolvedOptions, searchValue, shouldShowSearch]);\n\n const renderValue = useCallback(\n (currentValue: any) => {\n const resolved = normalizeValue(currentValue);\n const placeholderNode =\n placeholder === undefined ? null : (\n <span className={styles.valueText}>{placeholder}</span>\n );\n\n if (isMultiple) {\n const values = Array.isArray(resolved) ? resolved : [];\n if (values.length === 0) return placeholderNode;\n return (\n <span className={styles.tags}>\n {values.map((val, index) => {\n const option = getOption(val);\n const content = labelRender ? labelRender(option) : (option.label ?? String(val));\n return (\n <span className={styles.tag} key={`${String(val)}-${index}`}>\n {content}\n </span>\n );\n })}\n </span>\n );\n }\n\n if (isValueEmpty(resolved)) return placeholderNode;\n const option = getOption(resolved);\n const content = labelRender ? labelRender(option) : (option.label ?? String(resolved));\n return <span className={styles.valueText}>{content}</span>;\n },\n [getOption, isMultiple, labelRender, normalizeValue, placeholder],\n );\n\n const hasValue = isMultiple ? valueArray.length > 0 : !isValueEmpty(normalizedValue);\n const showClear = Boolean(allowClear && hasValue && !disabled && !readOnly);\n\n const handleClear = useCallback(\n (event: MouseEvent) => {\n event.preventDefault();\n event.stopPropagation();\n handleValueChange(isMultiple ? [] : null);\n },\n [handleValueChange, isMultiple],\n );\n\n const prefixNode = useMemo(() => {\n if (prefix === undefined || prefix === null) return null;\n if (isValidElement(prefix) || typeof prefix === 'string' || typeof prefix === 'number') {\n return prefix;\n }\n return <Icon icon={prefix as any} size={'small'} />;\n }, [prefix]);\n\n const suffixIconNode = useMemo(() => {\n if (loading) {\n return <Icon spin icon={Loader2} size={'small'} />;\n }\n if (suffixIcon === null) return null;\n if (\n isValidElement(suffixIcon) ||\n typeof suffixIcon === 'string' ||\n typeof suffixIcon === 'number'\n ) {\n return suffixIcon;\n }\n return (\n <Icon\n icon={(suffixIcon as any) || ChevronDown}\n size={'small'}\n {...suffixIconProps}\n style={{\n pointerEvents: 'none',\n ...suffixIconProps?.style,\n }}\n />\n );\n }, [loading, suffixIcon, suffixIconProps]);\n\n const popupStyle = useMemo(() => {\n const maxHeight = isItemAligned ? '80vh' : `${listHeight}px`;\n const baseStyle: React.CSSProperties = {\n maxHeight,\n maxWidth: 'var(--available-width)',\n minWidth: 'var(--anchor-width)',\n ['--lobe-select-popup-max-height' as any]: maxHeight,\n };\n\n if (popupMatchSelectWidth === undefined || popupMatchSelectWidth === true) {\n return baseStyle;\n }\n if (typeof popupMatchSelectWidth === 'number') {\n return {\n ...baseStyle,\n minWidth: popupMatchSelectWidth,\n width: popupMatchSelectWidth,\n };\n }\n return {\n ...baseStyle,\n minWidth: 'max-content',\n };\n }, [isItemAligned, listHeight, popupMatchSelectWidth]);\n\n const triggerClassName = cx(\n triggerVariants({ shadow, size, variant: resolvedVariant }),\n className,\n classNames?.root,\n classNames?.trigger,\n );\n\n const listRef = useRef<HTMLDivElement | null>(null);\n const pointerScrollRef = useRef(false);\n const pointerScrollTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const renderVirtualItem = useCallback((props: HTMLAttributes<HTMLDivElement>) => {\n const { ref, ...rest } = props as HTMLAttributes<HTMLDivElement> & {\n ref?: Ref<HTMLDivElement>;\n };\n\n return (\n <div\n {...rest}\n ref={(node) => {\n if (node) {\n node.scrollIntoView = (...args) => {\n if (!pointerScrollRef.current) {\n HTMLElement.prototype.scrollIntoView.call(node, ...args);\n }\n };\n }\n\n if (typeof ref === 'function') {\n ref(node);\n } else if (ref && 'current' in ref) {\n (ref as MutableRefObject<HTMLDivElement | null>).current = node;\n }\n }}\n />\n );\n }, []);\n\n const markPointerScroll = useCallback(() => {\n pointerScrollRef.current = true;\n if (pointerScrollTimeoutRef.current) {\n clearTimeout(pointerScrollTimeoutRef.current);\n }\n pointerScrollTimeoutRef.current = setTimeout(() => {\n pointerScrollRef.current = false;\n }, 120);\n }, []);\n\n const handleListScroll = useCallback(() => {\n if (!virtual || !pointerScrollRef.current) return;\n const listElement = listRef.current;\n const activeElement = document.activeElement;\n if (listElement && activeElement && listElement.contains(activeElement)) {\n listElement.focus({ preventScroll: true });\n }\n }, [virtual]);\n\n useEffect(() => {\n return () => {\n if (pointerScrollTimeoutRef.current) {\n clearTimeout(pointerScrollTimeoutRef.current);\n }\n };\n }, []);\n const virtualListStyle = useMemo(() => {\n if (!virtual) return undefined;\n const rowCount = countVirtualItems(filteredOptions);\n const maxVisibleRows = 6;\n const estimatedRowHeight =\n listItemHeight ?? (size === 'large' ? 40 : size === 'small' ? 28 : 32);\n const visibleRows = Math.min(Math.max(rowCount, 1), maxVisibleRows);\n const estimatedHeight = visibleRows * estimatedRowHeight + 8;\n\n return {\n height: `min(${estimatedHeight}px, var(--lobe-select-available-height, var(--available-height)))`,\n };\n }, [filteredOptions, listItemHeight, size, virtual]);\n\n const keepMountedIndices = useMemo(() => {\n if (!virtual || valueArray.length === 0) return undefined;\n const selectedSet = new Set(valueArray);\n const indices: number[] = [];\n let index = 0;\n\n filteredOptions.forEach((item) => {\n if (isGroupOption(item)) {\n if (item.options.some((option) => selectedSet.has(option.value))) {\n indices.push(index);\n }\n index += 1;\n return;\n }\n\n if (selectedSet.has(item.value)) {\n indices.push(index);\n }\n index += 1;\n });\n\n return indices.length ? indices : undefined;\n }, [filteredOptions, valueArray, virtual]);\n\n const itemTextClassName = cx(\n optionRender ? menuStyles.itemContent : menuStyles.label,\n styles.itemText,\n classNames?.itemText,\n );\n\n const isBoldIndicator = selectedIndicatorVariant === 'bold';\n let optionIndex = 0;\n const renderOptions = (items: LobeSelectOptions) =>\n items.map((item, index) => {\n if (isGroupOption(item)) {\n return (\n <Select.Group className={cx(styles.group, classNames?.group)} key={`group-${index}`}>\n <Select.GroupLabel\n className={cx(menuStyles.groupLabel, styles.groupLabel, classNames?.groupLabel)}\n >\n {item.label}\n </Select.GroupLabel>\n {item.options.map((option) => {\n const currentIndex = optionIndex++;\n return (\n <Select.Item\n disabled={option.disabled}\n key={`${String(option.value)}-${currentIndex}`}\n label={getOptionSearchText(option)}\n render={virtual ? renderVirtualItem : undefined}\n value={option.value}\n className={cx(\n menuStyles.item,\n styles.item,\n isBoldIndicator && styles.itemBoldSelected,\n classNames?.item,\n classNames?.option,\n option.className,\n )}\n style={{\n minHeight: listItemHeight,\n ...option.style,\n }}\n >\n <Select.ItemText className={itemTextClassName}>\n {optionRender ? optionRender(option, { index: currentIndex }) : option.label}\n </Select.ItemText>\n {!isBoldIndicator && (\n <Select.ItemIndicator\n className={cx(styles.itemIndicator, classNames?.itemIndicator)}\n >\n <Icon icon={Check} size={'small'} />\n </Select.ItemIndicator>\n )}\n </Select.Item>\n );\n })}\n </Select.Group>\n );\n }\n\n const currentIndex = optionIndex++;\n return (\n <Select.Item\n disabled={item.disabled}\n key={`${String(item.value)}-${currentIndex}`}\n label={getOptionSearchText(item)}\n render={virtual ? renderVirtualItem : undefined}\n value={item.value}\n className={cx(\n menuStyles.item,\n styles.item,\n isBoldIndicator && styles.itemBoldSelected,\n classNames?.item,\n classNames?.option,\n item.className,\n )}\n style={{\n minHeight: listItemHeight,\n ...item.style,\n }}\n >\n <Select.ItemText className={itemTextClassName}>\n {optionRender ? optionRender(item, { index: currentIndex }) : item.label}\n </Select.ItemText>\n {!isBoldIndicator && (\n <Select.ItemIndicator className={cx(styles.itemIndicator, classNames?.itemIndicator)}>\n <Icon icon={Check} size={'small'} />\n </Select.ItemIndicator>\n )}\n </Select.Item>\n );\n });\n\n const appElement = useAppElement();\n return (\n <Select.Root\n disabled={disabled}\n id={id}\n modal={isItemAligned}\n multiple={isMultiple}\n name={name}\n open={mergedOpen}\n readOnly={readOnly}\n required={required}\n value={normalizedValue}\n onOpenChange={handleOpenChange}\n onValueChange={handleValueChange}\n >\n <Select.Trigger\n autoFocus={autoFocus}\n className={triggerClassName}\n disabled={disabled}\n style={style}\n >\n {prefixNode !== null && prefixNode !== undefined && (\n <span className={cx(styles.prefix, classNames?.prefix)}>{prefixNode}</span>\n )}\n <Select.Value className={cx(styles.value, classNames?.value)}>{renderValue}</Select.Value>\n <span className={cx(styles.suffix, classNames?.suffix)}>\n {showClear && (\n <span\n className={cx(styles.clear, classNames?.clear)}\n data-role=\"lobe-select-clear\"\n onClick={handleClear}\n >\n <Icon icon={X} size={'small'} />\n </span>\n )}\n {suffixIconNode !== null && suffixIconNode !== undefined && (\n <Select.Icon className={cx(styles.icon, classNames?.icon)}>\n {suffixIconNode}\n </Select.Icon>\n )}\n </span>\n </Select.Trigger>\n\n <Select.Portal container={appElement}>\n <Select.Positioner\n align=\"start\"\n alignItemWithTrigger={isItemAligned}\n className={styles.positioner}\n side=\"bottom\"\n sideOffset={6}\n >\n <Select.Popup\n style={popupStyle}\n className={cx(\n menuStyles.popup,\n styles.popup,\n popupClassName,\n classNames?.popup,\n classNames?.dropdown,\n )}\n >\n {shouldShowSearch && (\n <div className={cx(styles.search, classNames?.search)}>\n <input\n className={styles.searchInput}\n placeholder={typeof placeholder === 'string' ? placeholder : undefined}\n value={searchValue}\n onChange={handleSearchChange}\n onKeyDown={handleSearchKeyDown}\n />\n </div>\n )}\n {(() => {\n const content =\n filteredOptions.length > 0 ? (\n renderOptions(filteredOptions)\n ) : (\n <div\n className={cx(\n menuStyles.item,\n menuStyles.empty,\n styles.empty,\n classNames?.empty,\n )}\n >\n No data\n </div>\n );\n\n if (!virtual || filteredOptions.length === 0) {\n return (\n <Select.List\n className={cx(styles.list, classNames?.list)}\n data-virtual={virtual || undefined}\n >\n {content}\n </Select.List>\n );\n }\n\n return (\n <Select.List\n className={cx(styles.list, classNames?.list)}\n data-virtual={virtual || undefined}\n ref={listRef}\n style={virtualListStyle}\n tabIndex={virtual ? -1 : undefined}\n onPointerDown={virtual ? markPointerScroll : undefined}\n onScroll={virtual ? handleListScroll : undefined}\n onTouchMove={virtual ? markPointerScroll : undefined}\n onWheel={virtual ? markPointerScroll : undefined}\n >\n <Virtualizer itemSize={listItemHeight} keepMounted={keepMountedIndices}>\n {content}\n </Virtualizer>\n </Select.List>\n );\n })()}\n </Select.Popup>\n </Select.Positioner>\n </Select.Portal>\n </Select.Root>\n );\n },\n);\n\nLobeSelect.displayName = 'LobeSelect';\n\nexport default LobeSelect;\n"],"mappings":";;;;;;;;;;;;;;AA4BA,MAAM,iBACJ,WAEA,QAAS,OAAwC,QAAQ;AAE3D,MAAM,uBAA+B,WAAoC;AACvE,KAAI,OAAO,OAAO,UAAU,YAAY,OAAO,OAAO,UAAU,SAC9D,QAAO,OAAO,OAAO,MAAM;AAE7B,KAAI,OAAO,OAAO,UAAU,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