@lobehub/ui 4.10.0 → 4.11.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/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/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/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/ContextMenuHost.d.mts +2 -2
- 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/DropdownMenu.d.mts +2 -2
- package/es/DropdownMenu/DropdownMenu.mjs +6 -16
- package/es/DropdownMenu/DropdownMenu.mjs.map +1 -1
- package/es/EditableText/EditableText.d.mts +2 -2
- 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/Image/PreviewGroup.d.mts +2 -2
- 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/MotionProvider/index.d.mts +2 -2
- package/es/Popover/ArrowIcon.mjs +1 -1
- package/es/Popover/ArrowIcon.mjs.map +1 -1
- package/es/Popover/PopoverGroup.mjs +12 -3
- package/es/Popover/PopoverGroup.mjs.map +1 -1
- package/es/Popover/PopoverInGroup.mjs +19 -4
- package/es/Popover/PopoverInGroup.mjs.map +1 -1
- package/es/Popover/PopoverStandalone.mjs +46 -23
- package/es/Popover/PopoverStandalone.mjs.map +1 -1
- package/es/Popover/context.d.mts +15 -0
- package/es/Popover/context.mjs +21 -0
- package/es/Popover/context.mjs.map +1 -0
- package/es/Popover/index.d.mts +2 -1
- package/es/Popover/index.mjs +2 -1
- package/es/Popover/type.d.mts +5 -0
- package/es/Popover/useMergedPopoverProps.mjs +4 -1
- package/es/Popover/useMergedPopoverProps.mjs.map +1 -1
- package/es/SearchBar/SearchBar.d.mts +2 -2
- package/es/Segmented/Segmented.d.mts +2 -2
- package/es/Select/Select.d.mts +2 -2
- 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/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/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 +34 -0
- package/es/hooks/useNativeButton.mjs.map +1 -0
- 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 +2 -2
- 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 +2 -2
- package/es/icons/lucideExtra/LeftClickIcon.d.mts +2 -2
- 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/TreeDownRightIcon.d.mts +3 -3
- package/es/icons/lucideExtra/TreeUpDownRightIcon.d.mts +3 -3
- package/es/index.d.mts +2 -1
- package/es/index.mjs +2 -1
- 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 +1 -1
package/es/Input/InputOPT.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { InputOPTProps } from "./type.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react140 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/Input/InputOPT.d.ts
|
|
5
|
-
declare const InputOPT:
|
|
5
|
+
declare const InputOPT: react140.NamedExoticComponent<InputOPTProps>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { InputOPT };
|
|
8
8
|
//# sourceMappingURL=InputOPT.d.mts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { InputPasswordProps } from "./type.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react141 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/Input/InputPassword.d.ts
|
|
5
|
-
declare const InputPassword:
|
|
5
|
+
declare const InputPassword: react141.NamedExoticComponent<InputPasswordProps>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { InputPassword };
|
|
8
8
|
//# sourceMappingURL=InputPassword.d.mts.map
|
package/es/Input/TextArea.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { TextAreaProps } from "./type.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react142 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/Input/TextArea.d.ts
|
|
5
|
-
declare const TextArea:
|
|
5
|
+
declare const TextArea: react142.NamedExoticComponent<TextAreaProps>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { TextArea };
|
|
8
8
|
//# sourceMappingURL=TextArea.d.mts.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DivProps } from "../../types/index.mjs";
|
|
2
2
|
import "../../index.mjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react21 from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/Layout/components/LayoutFooter.d.ts
|
|
6
|
-
declare const LayoutFooter:
|
|
6
|
+
declare const LayoutFooter: react21.NamedExoticComponent<DivProps>;
|
|
7
7
|
//#endregion
|
|
8
8
|
export { LayoutFooter };
|
|
9
9
|
//# sourceMappingURL=LayoutFooter.d.mts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { LayoutHeaderProps } from "../type.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react20 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/Layout/components/LayoutHeader.d.ts
|
|
5
|
-
declare const LayoutHeader:
|
|
5
|
+
declare const LayoutHeader: react20.NamedExoticComponent<LayoutHeaderProps>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { LayoutHeader };
|
|
8
8
|
//# sourceMappingURL=LayoutHeader.d.mts.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DivProps } from "../../types/index.mjs";
|
|
2
2
|
import "../../index.mjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react22 from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/Layout/components/LayoutMain.d.ts
|
|
6
|
-
declare const LayoutMain:
|
|
6
|
+
declare const LayoutMain: react22.NamedExoticComponent<DivProps>;
|
|
7
7
|
//#endregion
|
|
8
8
|
export { LayoutMain };
|
|
9
9
|
//# sourceMappingURL=LayoutMain.d.mts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { LayoutSidebarProps } from "../type.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react23 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/Layout/components/LayoutSidebar.d.ts
|
|
5
|
-
declare const LayoutSidebar:
|
|
5
|
+
declare const LayoutSidebar: react23.NamedExoticComponent<LayoutSidebarProps>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { LayoutSidebar };
|
|
8
8
|
//# sourceMappingURL=LayoutSidebar.d.mts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { LayoutSidebarInnerProps } from "../type.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react24 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/Layout/components/LayoutSidebarInner.d.ts
|
|
5
|
-
declare const LayoutSidebarInner:
|
|
5
|
+
declare const LayoutSidebarInner: react24.NamedExoticComponent<LayoutSidebarInnerProps>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { LayoutSidebarInner };
|
|
8
8
|
//# sourceMappingURL=LayoutSidebarInner.d.mts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { LayoutTocProps } from "../type.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react25 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/Layout/components/LayoutToc.d.ts
|
|
5
|
-
declare const LayoutToc:
|
|
5
|
+
declare const LayoutToc: react25.NamedExoticComponent<LayoutTocProps>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { LayoutToc };
|
|
8
8
|
//# sourceMappingURL=LayoutToc.d.mts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ListItemProps } from "../type.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react30 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/List/ListItem/index.d.ts
|
|
5
|
-
declare const ListItem:
|
|
5
|
+
declare const ListItem: react30.NamedExoticComponent<ListItemProps>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { ListItem };
|
|
8
8
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { MarkdownProps } from "./type.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react2 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/Markdown/Markdown.d.ts
|
|
5
|
-
declare const Markdown:
|
|
5
|
+
declare const Markdown: react2.NamedExoticComponent<MarkdownProps>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { Markdown };
|
|
8
8
|
//# sourceMappingURL=Markdown.d.mts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { TypographyProps } from "./type.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react3 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/Markdown/Typography.d.ts
|
|
5
|
-
declare const Typography:
|
|
5
|
+
declare const Typography: react3.NamedExoticComponent<TypographyProps>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { Typography };
|
|
8
8
|
//# sourceMappingURL=Typography.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 react46 from "react";
|
|
4
4
|
import { Ref } from "react";
|
|
5
5
|
|
|
6
6
|
//#region src/Markdown/components/SearchResultCards/index.d.ts
|
|
@@ -14,7 +14,7 @@ interface SearchResultCardsProps extends FlexboxProps {
|
|
|
14
14
|
dataSource: string[] | SearchResultItem[];
|
|
15
15
|
ref?: Ref<HTMLDivElement>;
|
|
16
16
|
}
|
|
17
|
-
declare const SearchResultCards:
|
|
17
|
+
declare const SearchResultCards: react46.NamedExoticComponent<SearchResultCardsProps>;
|
|
18
18
|
//#endregion
|
|
19
19
|
export { SearchResultCards, SearchResultCardsProps };
|
|
20
20
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { MaskShadowProps } from "./type.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react4 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/MaskShadow/MaskShadow.d.ts
|
|
5
|
-
declare const MaskShadow:
|
|
5
|
+
declare const MaskShadow: react4.NamedExoticComponent<MaskShadowProps>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { MaskShadow };
|
|
8
8
|
//# sourceMappingURL=MaskShadow.d.mts.map
|
package/es/Menu/Menu.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { MenuProps } from "./type.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react0 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/Menu/Menu.d.ts
|
|
5
|
-
declare const Menu:
|
|
5
|
+
declare const Menu: react0.NamedExoticComponent<MenuProps<unknown>>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { Menu };
|
|
8
8
|
//# sourceMappingURL=Menu.d.mts.map
|
package/es/Mermaid/Mermaid.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { MermaidProps } from "./type.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react39 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/Mermaid/Mermaid.d.ts
|
|
5
|
-
declare const Mermaid:
|
|
5
|
+
declare const Mermaid: react39.NamedExoticComponent<MermaidProps>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { Mermaid };
|
|
8
8
|
//# sourceMappingURL=Mermaid.d.mts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SyntaxMermaidProps } from "../type.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react40 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/Mermaid/SyntaxMermaid/index.d.ts
|
|
5
|
-
declare const SyntaxMermaid:
|
|
5
|
+
declare const SyntaxMermaid: react40.NamedExoticComponent<SyntaxMermaidProps>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { SyntaxMermaid };
|
|
8
8
|
//# sourceMappingURL=index.d.mts.map
|
package/es/Modal/Modal.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ModalProps } from "./type.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react60 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/Modal/Modal.d.ts
|
|
5
|
-
declare const Modal:
|
|
5
|
+
declare const Modal: react60.NamedExoticComponent<ModalProps>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { Modal };
|
|
8
8
|
//# sourceMappingURL=Modal.d.mts.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ModalContextValue } from "./type.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react61 from "react";
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/Modal/ModalProvider.d.ts
|
|
6
|
-
declare const ModalProvider:
|
|
6
|
+
declare const ModalProvider: react61.NamedExoticComponent<{
|
|
7
7
|
children: ReactNode;
|
|
8
8
|
value: ModalContextValue;
|
|
9
9
|
}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react47 from "react";
|
|
2
2
|
import { Context, ReactNode } from "react";
|
|
3
3
|
import * as motion_react0 from "motion/react";
|
|
4
4
|
import * as m from "motion/react-m";
|
|
@@ -6,7 +6,7 @@ import * as m from "motion/react-m";
|
|
|
6
6
|
//#region src/MotionProvider/index.d.ts
|
|
7
7
|
type MotionComponentType = typeof motion_react0.motion | typeof m;
|
|
8
8
|
declare const MotionComponent: Context<MotionComponentType>;
|
|
9
|
-
declare const MotionProvider:
|
|
9
|
+
declare const MotionProvider: react47.NamedExoticComponent<{
|
|
10
10
|
children: ReactNode;
|
|
11
11
|
motion: MotionComponentType;
|
|
12
12
|
}>;
|
package/es/Popover/ArrowIcon.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/Popover/ArrowIcon.tsx
|
|
6
|
-
const PopoverArrowIcon =
|
|
6
|
+
const PopoverArrowIcon = /* @__PURE__ */ jsxs("svg", {
|
|
7
7
|
"aria-hidden": "true",
|
|
8
8
|
height: "6",
|
|
9
9
|
viewBox: "0 0 12 6",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArrowIcon.mjs","names":[
|
|
1
|
+
{"version":3,"file":"ArrowIcon.mjs","names":[],"sources":["../../src/Popover/ArrowIcon.tsx"],"sourcesContent":["'use client';\n\nexport const PopoverArrowIcon = (\n <svg aria-hidden=\"true\" height=\"6\" viewBox=\"0 0 12 6\" width=\"12\">\n <path d=\"M0 6L6 0L12 6Z\" data-role=\"fill\" />\n <path d=\"M0 6L6 0L12 6\" data-role=\"stroke\" />\n </svg>\n);\n"],"mappings":";;;;;AAEA,MAAa,mBACX,qBAAC;CAAI,eAAY;CAAO,QAAO;CAAI,SAAQ;CAAW,OAAM;YAC1D,oBAAC;EAAK,GAAE;EAAiB,aAAU;GAAS,EAC5C,oBAAC;EAAK,GAAE;EAAgB,aAAU;GAAW;EACzC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { placementMap } from "../utils/placement.mjs";
|
|
4
|
+
import { PopoverProvider } from "./context.mjs";
|
|
4
5
|
import { PopoverGroupHandleContext, PopoverGroupPropsContext } from "./groupContext.mjs";
|
|
5
6
|
import { parseTrigger } from "./parseTrigger.mjs";
|
|
6
7
|
import { PopoverArrowIcon } from "./ArrowIcon.mjs";
|
|
@@ -15,6 +16,10 @@ import { Popover } from "@base-ui/react/popover";
|
|
|
15
16
|
const PopoverGroup = ({ children, contentLayoutAnimation = true, ...sharedProps }) => {
|
|
16
17
|
const handle = useMemo(() => Popover.createHandle(), []);
|
|
17
18
|
const activeItemRef = useRef(null);
|
|
19
|
+
const close = useCallback(() => {
|
|
20
|
+
handle.close();
|
|
21
|
+
}, [handle]);
|
|
22
|
+
const contextValue = useMemo(() => ({ close }), [close]);
|
|
18
23
|
const handleOpenChange = useCallback((open) => {
|
|
19
24
|
activeItemRef.current?.onOpenChange?.(open);
|
|
20
25
|
}, []);
|
|
@@ -53,6 +58,10 @@ const PopoverGroup = ({ children, contentLayoutAnimation = true, ...sharedProps
|
|
|
53
58
|
},
|
|
54
59
|
viewport: item.styles?.content
|
|
55
60
|
};
|
|
61
|
+
const contentNode = /* @__PURE__ */ jsx(PopoverProvider, {
|
|
62
|
+
value: contextValue,
|
|
63
|
+
children: item.content
|
|
64
|
+
});
|
|
56
65
|
const popup = /* @__PURE__ */ jsx(Popover.Positioner, {
|
|
57
66
|
align: placementConfig.align,
|
|
58
67
|
className: resolvedClassNames.positioner,
|
|
@@ -66,15 +75,15 @@ const PopoverGroup = ({ children, contentLayoutAnimation = true, ...sharedProps
|
|
|
66
75
|
children: [arrow && /* @__PURE__ */ jsx(Popover.Arrow, {
|
|
67
76
|
className: resolvedClassNames.arrow,
|
|
68
77
|
style: resolvedStyles.arrow,
|
|
69
|
-
children:
|
|
78
|
+
children: PopoverArrowIcon
|
|
70
79
|
}), contentLayoutAnimation ? /* @__PURE__ */ jsx(Popover.Viewport, {
|
|
71
80
|
className: resolvedClassNames.viewport,
|
|
72
81
|
style: resolvedStyles.viewport,
|
|
73
|
-
children:
|
|
82
|
+
children: contentNode
|
|
74
83
|
}) : /* @__PURE__ */ jsx("div", {
|
|
75
84
|
className: resolvedClassNames.viewport,
|
|
76
85
|
style: resolvedStyles.viewport,
|
|
77
|
-
children:
|
|
86
|
+
children: contentNode
|
|
78
87
|
})]
|
|
79
88
|
})
|
|
80
89
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopoverGroup.mjs","names":["PopoverGroup: FC<PopoverGroupProps>","BasePopover"],"sources":["../../src/Popover/PopoverGroup.tsx"],"sourcesContent":["'use client';\n\nimport { Popover as BasePopover } from '@base-ui/react/popover';\nimport type { Side } from '@base-ui/react/utils/useAnchorPositioning';\nimport { cx } from 'antd-style';\nimport { type FC, type ReactNode, useCallback, useMemo, useRef } from 'react';\n\nimport { placementMap } from '@/utils/placement';\n\nimport { PopoverArrowIcon } from './ArrowIcon';\nimport { usePopoverPortalContainer } from './PopoverPortal';\nimport {\n PopoverGroupHandleContext,\n type PopoverGroupItem,\n PopoverGroupPropsContext,\n type PopoverGroupSharedProps,\n} from './groupContext';\nimport { parseTrigger } from './parseTrigger';\nimport { styles } from './style';\n\ntype PopoverGroupProps = PopoverGroupSharedProps & {\n children: ReactNode;\n};\n\nconst PopoverGroup: FC<PopoverGroupProps> = ({\n children,\n contentLayoutAnimation = true,\n ...sharedProps\n}) => {\n const handle = useMemo(() => BasePopover.createHandle<PopoverGroupItem>(), []);\n const activeItemRef = useRef<PopoverGroupItem | null>(null);\n\n const handleOpenChange = useCallback((open: boolean) => {\n activeItemRef.current?.onOpenChange?.(open);\n }, []);\n\n const portalContainer = usePopoverPortalContainer();\n\n return (\n <PopoverGroupHandleContext.Provider value={handle}>\n <PopoverGroupPropsContext.Provider value={sharedProps}>\n {children}\n <BasePopover.Root handle={handle} onOpenChange={handleOpenChange}>\n {({ payload }) => {\n const item = (payload as PopoverGroupItem | null) ?? null;\n activeItemRef.current = item;\n\n if (!item?.content) return null;\n\n const arrow = item.inset ? false : (item.arrow ?? true);\n const placement = item.placement ?? 'top';\n const { openOnHover } = parseTrigger(item.trigger ?? 'hover');\n\n const placementConfig = placementMap[placement] ?? placementMap.top;\n const baseSideOffset = arrow ? 10 : 6;\n const resolvedSideOffset = item.inset\n ? ({\n side,\n positioner,\n }: {\n positioner: { height: number; width: number };\n side: Side;\n }) => {\n if (\n side === 'left' ||\n side === 'right' ||\n side === 'inline-start' ||\n side === 'inline-end'\n ) {\n return -positioner.width;\n }\n return -positioner.height;\n }\n : baseSideOffset;\n\n const resolvedClassNames = {\n arrow: cx(styles.arrow, item.classNames?.arrow),\n popup: cx(styles.popup, item.className),\n positioner: cx(styles.positioner, item.classNames?.root),\n viewport: cx(styles.viewport, item.classNames?.content),\n };\n\n const resolvedStyles = {\n arrow: item.styles?.arrow,\n positioner: {\n ...item.styles?.root,\n zIndex: item.zIndex ?? 1100,\n },\n viewport: item.styles?.content,\n };\n\n const popup = (\n <BasePopover.Positioner\n align={placementConfig.align}\n className={resolvedClassNames.positioner}\n data-hover-trigger={openOnHover || undefined}\n data-placement={placement}\n side={placementConfig.side}\n sideOffset={resolvedSideOffset}\n style={resolvedStyles.positioner}\n >\n <BasePopover.Popup className={resolvedClassNames.popup}>\n {arrow && (\n <BasePopover.Arrow\n className={resolvedClassNames.arrow}\n style={resolvedStyles.arrow}\n >\n
|
|
1
|
+
{"version":3,"file":"PopoverGroup.mjs","names":["PopoverGroup: FC<PopoverGroupProps>","BasePopover"],"sources":["../../src/Popover/PopoverGroup.tsx"],"sourcesContent":["'use client';\n\nimport { Popover as BasePopover } from '@base-ui/react/popover';\nimport type { Side } from '@base-ui/react/utils/useAnchorPositioning';\nimport { cx } from 'antd-style';\nimport { type FC, type ReactNode, useCallback, useMemo, useRef } from 'react';\n\nimport { placementMap } from '@/utils/placement';\n\nimport { PopoverArrowIcon } from './ArrowIcon';\nimport { usePopoverPortalContainer } from './PopoverPortal';\nimport { PopoverProvider } from './context';\nimport {\n PopoverGroupHandleContext,\n type PopoverGroupItem,\n PopoverGroupPropsContext,\n type PopoverGroupSharedProps,\n} from './groupContext';\nimport { parseTrigger } from './parseTrigger';\nimport { styles } from './style';\n\ntype PopoverGroupProps = PopoverGroupSharedProps & {\n children: ReactNode;\n};\n\nconst PopoverGroup: FC<PopoverGroupProps> = ({\n children,\n contentLayoutAnimation = true,\n ...sharedProps\n}) => {\n const handle = useMemo(() => BasePopover.createHandle<PopoverGroupItem>(), []);\n const activeItemRef = useRef<PopoverGroupItem | null>(null);\n const close = useCallback(() => {\n handle.close();\n }, [handle]);\n const contextValue = useMemo(() => ({ close }), [close]);\n\n const handleOpenChange = useCallback((open: boolean) => {\n activeItemRef.current?.onOpenChange?.(open);\n }, []);\n\n const portalContainer = usePopoverPortalContainer();\n\n return (\n <PopoverGroupHandleContext.Provider value={handle}>\n <PopoverGroupPropsContext.Provider value={sharedProps}>\n {children}\n <BasePopover.Root handle={handle} onOpenChange={handleOpenChange}>\n {({ payload }) => {\n const item = (payload as PopoverGroupItem | null) ?? null;\n activeItemRef.current = item;\n\n if (!item?.content) return null;\n\n const arrow = item.inset ? false : (item.arrow ?? true);\n const placement = item.placement ?? 'top';\n const { openOnHover } = parseTrigger(item.trigger ?? 'hover');\n\n const placementConfig = placementMap[placement] ?? placementMap.top;\n const baseSideOffset = arrow ? 10 : 6;\n const resolvedSideOffset = item.inset\n ? ({\n side,\n positioner,\n }: {\n positioner: { height: number; width: number };\n side: Side;\n }) => {\n if (\n side === 'left' ||\n side === 'right' ||\n side === 'inline-start' ||\n side === 'inline-end'\n ) {\n return -positioner.width;\n }\n return -positioner.height;\n }\n : baseSideOffset;\n\n const resolvedClassNames = {\n arrow: cx(styles.arrow, item.classNames?.arrow),\n popup: cx(styles.popup, item.className),\n positioner: cx(styles.positioner, item.classNames?.root),\n viewport: cx(styles.viewport, item.classNames?.content),\n };\n\n const resolvedStyles = {\n arrow: item.styles?.arrow,\n positioner: {\n ...item.styles?.root,\n zIndex: item.zIndex ?? 1100,\n },\n viewport: item.styles?.content,\n };\n\n const contentNode = (\n <PopoverProvider value={contextValue}>{item.content}</PopoverProvider>\n );\n\n const popup = (\n <BasePopover.Positioner\n align={placementConfig.align}\n className={resolvedClassNames.positioner}\n data-hover-trigger={openOnHover || undefined}\n data-placement={placement}\n side={placementConfig.side}\n sideOffset={resolvedSideOffset}\n style={resolvedStyles.positioner}\n >\n <BasePopover.Popup className={resolvedClassNames.popup}>\n {arrow && (\n <BasePopover.Arrow\n className={resolvedClassNames.arrow}\n style={resolvedStyles.arrow}\n >\n {PopoverArrowIcon}\n </BasePopover.Arrow>\n )}\n {contentLayoutAnimation ? (\n <BasePopover.Viewport\n className={resolvedClassNames.viewport}\n style={resolvedStyles.viewport}\n >\n {contentNode}\n </BasePopover.Viewport>\n ) : (\n <div className={resolvedClassNames.viewport} style={resolvedStyles.viewport}>\n {contentNode}\n </div>\n )}\n </BasePopover.Popup>\n </BasePopover.Positioner>\n );\n\n const resolvedPortalContainer = portalContainer;\n const portalled = item.portalled ?? true;\n\n return portalled ? (\n resolvedPortalContainer ? (\n <BasePopover.Portal container={resolvedPortalContainer}>{popup}</BasePopover.Portal>\n ) : null\n ) : (\n popup\n );\n }}\n </BasePopover.Root>\n </PopoverGroupPropsContext.Provider>\n </PopoverGroupHandleContext.Provider>\n );\n};\n\nPopoverGroup.displayName = 'PopoverGroup';\n\nexport default PopoverGroup;\n"],"mappings":";;;;;;;;;;;;;;;AAyBA,MAAMA,gBAAuC,EAC3C,UACA,yBAAyB,MACzB,GAAG,kBACC;CACJ,MAAM,SAAS,cAAcC,QAAY,cAAgC,EAAE,EAAE,CAAC;CAC9E,MAAM,gBAAgB,OAAgC,KAAK;CAC3D,MAAM,QAAQ,kBAAkB;AAC9B,SAAO,OAAO;IACb,CAAC,OAAO,CAAC;CACZ,MAAM,eAAe,eAAe,EAAE,OAAO,GAAG,CAAC,MAAM,CAAC;CAExD,MAAM,mBAAmB,aAAa,SAAkB;AACtD,gBAAc,SAAS,eAAe,KAAK;IAC1C,EAAE,CAAC;CAEN,MAAM,kBAAkB,2BAA2B;AAEnD,QACE,oBAAC,0BAA0B;EAAS,OAAO;YACzC,qBAAC,yBAAyB;GAAS,OAAO;cACvC,UACD,oBAACA,QAAY;IAAa;IAAQ,cAAc;eAC5C,EAAE,cAAc;KAChB,MAAM,OAAQ,WAAuC;AACrD,mBAAc,UAAU;AAExB,SAAI,CAAC,MAAM,QAAS,QAAO;KAE3B,MAAM,QAAQ,KAAK,QAAQ,QAAS,KAAK,SAAS;KAClD,MAAM,YAAY,KAAK,aAAa;KACpC,MAAM,EAAE,gBAAgB,aAAa,KAAK,WAAW,QAAQ;KAE7D,MAAM,kBAAkB,aAAa,cAAc,aAAa;KAChE,MAAM,iBAAiB,QAAQ,KAAK;KACpC,MAAM,qBAAqB,KAAK,SAC3B,EACC,MACA,iBAII;AACJ,UACE,SAAS,UACT,SAAS,WACT,SAAS,kBACT,SAAS,aAET,QAAO,CAAC,WAAW;AAErB,aAAO,CAAC,WAAW;SAErB;KAEJ,MAAM,qBAAqB;MACzB,OAAO,GAAG,OAAO,OAAO,KAAK,YAAY,MAAM;MAC/C,OAAO,GAAG,OAAO,OAAO,KAAK,UAAU;MACvC,YAAY,GAAG,OAAO,YAAY,KAAK,YAAY,KAAK;MACxD,UAAU,GAAG,OAAO,UAAU,KAAK,YAAY,QAAQ;MACxD;KAED,MAAM,iBAAiB;MACrB,OAAO,KAAK,QAAQ;MACpB,YAAY;OACV,GAAG,KAAK,QAAQ;OAChB,QAAQ,KAAK,UAAU;OACxB;MACD,UAAU,KAAK,QAAQ;MACxB;KAED,MAAM,cACJ,oBAAC;MAAgB,OAAO;gBAAe,KAAK;OAA0B;KAGxE,MAAM,QACJ,oBAACA,QAAY;MACX,OAAO,gBAAgB;MACvB,WAAW,mBAAmB;MAC9B,sBAAoB,eAAe;MACnC,kBAAgB;MAChB,MAAM,gBAAgB;MACtB,YAAY;MACZ,OAAO,eAAe;gBAEtB,qBAACA,QAAY;OAAM,WAAW,mBAAmB;kBAC9C,SACC,oBAACA,QAAY;QACX,WAAW,mBAAmB;QAC9B,OAAO,eAAe;kBAErB;SACiB,EAErB,yBACC,oBAACA,QAAY;QACX,WAAW,mBAAmB;QAC9B,OAAO,eAAe;kBAErB;SACoB,GAEvB,oBAAC;QAAI,WAAW,mBAAmB;QAAU,OAAO,eAAe;kBAChE;SACG;QAEU;OACG;KAG3B,MAAM,0BAA0B;AAGhC,YAFkB,KAAK,aAAa,OAGlC,0BACE,oBAACA,QAAY;MAAO,WAAW;gBAA0B;OAA2B,GAClF,OAEJ;;KAGa;IACe;GACD;;AAIzC,aAAa,cAAc;AAE3B,2BAAe"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import { useNativeButton } from "../hooks/useNativeButton.mjs";
|
|
3
4
|
import { PopoverGroupHandleContext } from "./groupContext.mjs";
|
|
4
5
|
import { parseTrigger } from "./parseTrigger.mjs";
|
|
5
6
|
import { useMergedPopoverProps } from "./useMergedPopoverProps.mjs";
|
|
6
7
|
import { cloneElement, isValidElement, useContext, useMemo } from "react";
|
|
7
8
|
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
import { cx } from "antd-style";
|
|
8
10
|
import { mergeRefs } from "react-merge-refs";
|
|
9
11
|
import { mergeProps } from "@base-ui/react/merge-props";
|
|
10
12
|
import { Popover } from "@base-ui/react/popover";
|
|
@@ -17,6 +19,10 @@ const PopoverInGroup = ({ children, ref: refProp, ...props }) => {
|
|
|
17
19
|
const resolvedOpenDelay = item.openDelay ?? (item.mouseEnterDelay ?? .1) * 1e3;
|
|
18
20
|
const resolvedCloseDelay = item.closeDelay ?? (item.mouseLeaveDelay ?? .1) * 1e3;
|
|
19
21
|
const disabled = Boolean(item.disabled);
|
|
22
|
+
const { isNativeButtonTriggerElement, resolvedNativeButton } = useNativeButton({
|
|
23
|
+
children,
|
|
24
|
+
nativeButton: item.nativeButton
|
|
25
|
+
});
|
|
20
26
|
if (!item.content) return children;
|
|
21
27
|
const triggerProps = {
|
|
22
28
|
closeDelay: resolvedCloseDelay,
|
|
@@ -25,17 +31,24 @@ const PopoverInGroup = ({ children, ref: refProp, ...props }) => {
|
|
|
25
31
|
openOnHover: openOnHover && !disabled,
|
|
26
32
|
payload: item
|
|
27
33
|
};
|
|
34
|
+
const triggerClassName = item.classNames?.trigger;
|
|
28
35
|
if (isValidElement(children)) return /* @__PURE__ */ jsx(Popover.Trigger, {
|
|
29
36
|
handle: group ?? void 0,
|
|
30
37
|
...triggerProps,
|
|
38
|
+
nativeButton: resolvedNativeButton,
|
|
31
39
|
render: (renderProps) => {
|
|
32
|
-
const
|
|
33
|
-
|
|
40
|
+
const resolvedProps = (() => {
|
|
41
|
+
if (isNativeButtonTriggerElement) return renderProps;
|
|
42
|
+
const { type, ref: triggerRef, ...restProps } = renderProps;
|
|
43
|
+
return restProps;
|
|
44
|
+
})();
|
|
45
|
+
const mergedProps = mergeProps(children.props, resolvedProps);
|
|
34
46
|
return cloneElement(children, {
|
|
35
|
-
...
|
|
47
|
+
...mergedProps,
|
|
48
|
+
className: cx(mergedProps.className, triggerClassName),
|
|
36
49
|
ref: mergeRefs([
|
|
37
50
|
children.ref,
|
|
38
|
-
|
|
51
|
+
renderProps.ref,
|
|
39
52
|
refProp
|
|
40
53
|
])
|
|
41
54
|
});
|
|
@@ -44,6 +57,8 @@ const PopoverInGroup = ({ children, ref: refProp, ...props }) => {
|
|
|
44
57
|
return /* @__PURE__ */ jsx(Popover.Trigger, {
|
|
45
58
|
handle: group ?? void 0,
|
|
46
59
|
...triggerProps,
|
|
60
|
+
className: triggerClassName,
|
|
61
|
+
nativeButton: resolvedNativeButton,
|
|
47
62
|
ref: refProp,
|
|
48
63
|
children
|
|
49
64
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopoverInGroup.mjs","names":["PopoverInGroup: FC<PopoverProps>","BasePopover"],"sources":["../../src/Popover/PopoverInGroup.tsx"],"sourcesContent":["'use client';\n\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport { Popover as BasePopover } from '@base-ui/react/popover';\nimport { type FC, cloneElement, isValidElement, useContext, useMemo } from 'react';\nimport { mergeRefs } from 'react-merge-refs';\n\nimport { PopoverGroupHandleContext } from './groupContext';\nimport { parseTrigger } from './parseTrigger';\nimport type { PopoverProps } from './type';\nimport { useMergedPopoverProps } from './useMergedPopoverProps';\n\nexport const PopoverInGroup: FC<PopoverProps> = ({ children, ref: refProp, ...props }) => {\n const group = useContext(PopoverGroupHandleContext);\n const item = useMergedPopoverProps(props);\n\n const { openOnHover } = useMemo(() => parseTrigger(item.trigger ?? 'hover'), [item.trigger]);\n\n const resolvedOpenDelay = item.openDelay ?? (item.mouseEnterDelay ?? 0.1) * 1000;\n const resolvedCloseDelay = item.closeDelay ?? (item.mouseLeaveDelay ?? 0.1) * 1000;\n const disabled = Boolean(item.disabled);\n\n // Don't render trigger behavior if no content\n if (!item.content) {\n return children as any;\n }\n\n const triggerProps = {\n closeDelay: resolvedCloseDelay,\n delay: resolvedOpenDelay,\n disabled,\n openOnHover: openOnHover && !disabled,\n payload: item,\n };\n\n if (isValidElement(children)) {\n return (\n <BasePopover.Trigger\n handle={group ?? undefined}\n {...triggerProps}\n render={(renderProps) => {\n //
|
|
1
|
+
{"version":3,"file":"PopoverInGroup.mjs","names":["PopoverInGroup: FC<PopoverProps>","BasePopover"],"sources":["../../src/Popover/PopoverInGroup.tsx"],"sourcesContent":["'use client';\n\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport { Popover as BasePopover } from '@base-ui/react/popover';\nimport { cx } from 'antd-style';\nimport { type FC, cloneElement, isValidElement, useContext, useMemo } from 'react';\nimport { mergeRefs } from 'react-merge-refs';\n\nimport { useNativeButton } from '@/hooks/useNativeButton';\n\nimport { PopoverGroupHandleContext } from './groupContext';\nimport { parseTrigger } from './parseTrigger';\nimport type { PopoverProps } from './type';\nimport { useMergedPopoverProps } from './useMergedPopoverProps';\n\nexport const PopoverInGroup: FC<PopoverProps> = ({ children, ref: refProp, ...props }) => {\n const group = useContext(PopoverGroupHandleContext);\n const item = useMergedPopoverProps(props);\n\n const { openOnHover } = useMemo(() => parseTrigger(item.trigger ?? 'hover'), [item.trigger]);\n\n const resolvedOpenDelay = item.openDelay ?? (item.mouseEnterDelay ?? 0.1) * 1000;\n const resolvedCloseDelay = item.closeDelay ?? (item.mouseLeaveDelay ?? 0.1) * 1000;\n const disabled = Boolean(item.disabled);\n\n const { isNativeButtonTriggerElement, resolvedNativeButton } = useNativeButton({\n children,\n nativeButton: item.nativeButton,\n });\n\n // Don't render trigger behavior if no content\n if (!item.content) {\n return children as any;\n }\n\n const triggerProps = {\n closeDelay: resolvedCloseDelay,\n delay: resolvedOpenDelay,\n disabled,\n openOnHover: openOnHover && !disabled,\n payload: item,\n };\n\n const triggerClassName = item.classNames?.trigger;\n\n if (isValidElement(children)) {\n return (\n <BasePopover.Trigger\n handle={group ?? undefined}\n {...triggerProps}\n nativeButton={resolvedNativeButton}\n render={(renderProps) => {\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 renderProps as any;\n // eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars\n const { type, ref: triggerRef, ...restProps } = renderProps 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: cx(mergedProps.className, triggerClassName),\n ref: mergeRefs([(children as any).ref, (renderProps as any).ref, refProp]),\n });\n }}\n />\n );\n }\n\n return (\n <BasePopover.Trigger\n handle={group ?? undefined}\n {...triggerProps}\n className={triggerClassName}\n nativeButton={resolvedNativeButton}\n ref={refProp}\n >\n {children}\n </BasePopover.Trigger>\n );\n};\n\nPopoverInGroup.displayName = 'PopoverInGroup';\n"],"mappings":";;;;;;;;;;;;;;AAeA,MAAaA,kBAAoC,EAAE,UAAU,KAAK,SAAS,GAAG,YAAY;CACxF,MAAM,QAAQ,WAAW,0BAA0B;CACnD,MAAM,OAAO,sBAAsB,MAAM;CAEzC,MAAM,EAAE,gBAAgB,cAAc,aAAa,KAAK,WAAW,QAAQ,EAAE,CAAC,KAAK,QAAQ,CAAC;CAE5F,MAAM,oBAAoB,KAAK,cAAc,KAAK,mBAAmB,MAAO;CAC5E,MAAM,qBAAqB,KAAK,eAAe,KAAK,mBAAmB,MAAO;CAC9E,MAAM,WAAW,QAAQ,KAAK,SAAS;CAEvC,MAAM,EAAE,8BAA8B,yBAAyB,gBAAgB;EAC7E;EACA,cAAc,KAAK;EACpB,CAAC;AAGF,KAAI,CAAC,KAAK,QACR,QAAO;CAGT,MAAM,eAAe;EACnB,YAAY;EACZ,OAAO;EACP;EACA,aAAa,eAAe,CAAC;EAC7B,SAAS;EACV;CAED,MAAM,mBAAmB,KAAK,YAAY;AAE1C,KAAI,eAAe,SAAS,CAC1B,QACE,oBAACC,QAAY;EACX,QAAQ,SAAS;EACjB,GAAI;EACJ,cAAc;EACd,SAAS,gBAAgB;GAGvB,MAAM,uBAAuB;AAC3B,QAAI,6BAA8B,QAAO;IAEzC,MAAM,EAAE,MAAM,KAAK,YAAY,GAAG,cAAc;AAChD,WAAO;OACL;GAEJ,MAAM,cAAc,WAAY,SAAiB,OAAO,cAAc;AACtE,UAAO,aAAa,UAAiB;IACnC,GAAG;IACH,WAAW,GAAG,YAAY,WAAW,iBAAiB;IACtD,KAAK,UAAU;KAAE,SAAiB;KAAM,YAAoB;KAAK;KAAQ,CAAC;IAC3E,CAAC;;GAEJ;AAIN,QACE,oBAACA,QAAY;EACX,QAAQ,SAAS;EACjB,GAAI;EACJ,WAAW;EACX,cAAc;EACd,KAAK;EAEJ;GACmB;;AAI1B,eAAe,cAAc"}
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import { placementMap } from "../utils/placement.mjs";
|
|
4
4
|
import { useIsClient } from "../hooks/useIsClient.mjs";
|
|
5
|
+
import { useNativeButton } from "../hooks/useNativeButton.mjs";
|
|
6
|
+
import { PopoverProvider } from "./context.mjs";
|
|
5
7
|
import { parseTrigger } from "./parseTrigger.mjs";
|
|
6
8
|
import { PopoverArrowIcon } from "./ArrowIcon.mjs";
|
|
7
9
|
import { usePopoverPortalContainer } from "./PopoverPortal.mjs";
|
|
8
10
|
import { styles } from "./style.mjs";
|
|
9
|
-
import { cloneElement, isValidElement, memo, useCallback,
|
|
11
|
+
import { cloneElement, isValidElement, memo, useCallback, useMemo, useState } from "react";
|
|
10
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
13
|
import { cx } from "antd-style";
|
|
12
14
|
import { mergeRefs } from "react-merge-refs";
|
|
@@ -18,15 +20,15 @@ import { Popover } from "@base-ui/react/popover";
|
|
|
18
20
|
* Popover component - displays floating content relative to a trigger element
|
|
19
21
|
* Compatible with Ant Design Popover API
|
|
20
22
|
*/
|
|
21
|
-
const PopoverStandalone = memo(({ children, content, arrow: originArrow = true, inset = false, trigger = "hover", placement = "top", styles: styleProps, classNames, className, open, onOpenChange, defaultOpen = false, mouseEnterDelay = .1, mouseLeaveDelay = .1, openDelay, closeDelay, portalled = true, getPopupContainer, disabled = false, zIndex, ref: refProp }) => {
|
|
23
|
+
const PopoverStandalone = memo(({ children, content, arrow: originArrow = true, inset = false, trigger = "hover", placement = "top", styles: styleProps, classNames, className, open, onOpenChange, defaultOpen = false, mouseEnterDelay = .1, mouseLeaveDelay = .1, openDelay, closeDelay, portalled = true, getPopupContainer, disabled = false, zIndex, nativeButton, ref: refProp }) => {
|
|
22
24
|
const arrow = inset ? false : originArrow;
|
|
23
25
|
const isClient = useIsClient();
|
|
24
26
|
const popoverHandle = useMemo(() => Popover.createHandle(), []);
|
|
25
27
|
const [uncontrolledOpen, setUncontrolledOpen] = useState(Boolean(defaultOpen));
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}, [
|
|
28
|
+
const close = useCallback(() => {
|
|
29
|
+
popoverHandle.close();
|
|
30
|
+
}, [popoverHandle]);
|
|
31
|
+
const contextValue = useMemo(() => ({ close }), [close]);
|
|
30
32
|
const resolvedOpen = disabled ? false : open ?? uncontrolledOpen;
|
|
31
33
|
const handleOpenChange = useCallback((nextOpen) => {
|
|
32
34
|
if (disabled && nextOpen) return;
|
|
@@ -50,6 +52,23 @@ const PopoverStandalone = memo(({ children, content, arrow: originArrow = true,
|
|
|
50
52
|
};
|
|
51
53
|
}, [baseSideOffset, inset]);
|
|
52
54
|
const portalContainer = usePopoverPortalContainer();
|
|
55
|
+
const { isNativeButtonTriggerElement, resolvedNativeButton } = useNativeButton({
|
|
56
|
+
children,
|
|
57
|
+
nativeButton
|
|
58
|
+
});
|
|
59
|
+
const resolvedClassNames = useMemo(() => ({
|
|
60
|
+
arrow: cx(styles.arrow, classNames?.arrow),
|
|
61
|
+
popup: cx(styles.popup, className),
|
|
62
|
+
positioner: cx(styles.positioner, classNames?.root),
|
|
63
|
+
trigger: classNames?.trigger,
|
|
64
|
+
viewport: cx(styles.viewport, classNames?.content)
|
|
65
|
+
}), [
|
|
66
|
+
className,
|
|
67
|
+
classNames?.arrow,
|
|
68
|
+
classNames?.content,
|
|
69
|
+
classNames?.root,
|
|
70
|
+
classNames?.trigger
|
|
71
|
+
]);
|
|
53
72
|
const triggerElement = useMemo(() => {
|
|
54
73
|
const triggerProps = {
|
|
55
74
|
closeDelay: resolvedCloseDelay,
|
|
@@ -60,14 +79,20 @@ const PopoverStandalone = memo(({ children, content, arrow: originArrow = true,
|
|
|
60
79
|
if (isValidElement(children)) return /* @__PURE__ */ jsx(Popover.Trigger, {
|
|
61
80
|
handle: popoverHandle,
|
|
62
81
|
...triggerProps,
|
|
82
|
+
nativeButton: resolvedNativeButton,
|
|
63
83
|
render: (props) => {
|
|
64
|
-
const
|
|
65
|
-
|
|
84
|
+
const resolvedProps = (() => {
|
|
85
|
+
if (isNativeButtonTriggerElement) return props;
|
|
86
|
+
const { type, ref: triggerRef, ...restProps } = props;
|
|
87
|
+
return restProps;
|
|
88
|
+
})();
|
|
89
|
+
const mergedProps = mergeProps(children.props, resolvedProps);
|
|
66
90
|
return cloneElement(children, {
|
|
67
|
-
...
|
|
91
|
+
...mergedProps,
|
|
92
|
+
className: cx(mergedProps.className, resolvedClassNames.trigger),
|
|
68
93
|
ref: mergeRefs([
|
|
69
94
|
children.ref,
|
|
70
|
-
|
|
95
|
+
props.ref,
|
|
71
96
|
refProp
|
|
72
97
|
])
|
|
73
98
|
});
|
|
@@ -76,32 +101,26 @@ const PopoverStandalone = memo(({ children, content, arrow: originArrow = true,
|
|
|
76
101
|
return /* @__PURE__ */ jsx(Popover.Trigger, {
|
|
77
102
|
handle: popoverHandle,
|
|
78
103
|
...triggerProps,
|
|
104
|
+
className: resolvedClassNames.trigger,
|
|
105
|
+
nativeButton: resolvedNativeButton,
|
|
79
106
|
ref: refProp,
|
|
80
107
|
children
|
|
81
108
|
});
|
|
82
109
|
}, [
|
|
83
110
|
children,
|
|
84
111
|
disabled,
|
|
112
|
+
isNativeButtonTriggerElement,
|
|
85
113
|
openOnHover,
|
|
86
114
|
popoverHandle,
|
|
87
115
|
refProp,
|
|
116
|
+
resolvedClassNames.trigger,
|
|
117
|
+
resolvedNativeButton,
|
|
88
118
|
resolvedOpenDelay,
|
|
89
119
|
resolvedCloseDelay
|
|
90
120
|
]);
|
|
91
121
|
const customContainer = useMemo(() => {
|
|
92
122
|
if (!getPopupContainer || !isClient) return void 0;
|
|
93
123
|
}, [getPopupContainer, isClient]);
|
|
94
|
-
const resolvedClassNames = useMemo(() => ({
|
|
95
|
-
arrow: cx(styles.arrow, classNames?.arrow),
|
|
96
|
-
popup: cx(styles.popup, className),
|
|
97
|
-
positioner: cx(styles.positioner, classNames?.root),
|
|
98
|
-
viewport: cx(styles.viewport, classNames?.content)
|
|
99
|
-
}), [
|
|
100
|
-
className,
|
|
101
|
-
classNames?.arrow,
|
|
102
|
-
classNames?.content,
|
|
103
|
-
classNames?.root
|
|
104
|
-
]);
|
|
105
124
|
const resolvedStyles = useMemo(() => ({
|
|
106
125
|
arrow: styleProps?.arrow,
|
|
107
126
|
positioner: {
|
|
@@ -128,16 +147,20 @@ const PopoverStandalone = memo(({ children, content, arrow: originArrow = true,
|
|
|
128
147
|
children: [arrow && /* @__PURE__ */ jsx(Popover.Arrow, {
|
|
129
148
|
className: resolvedClassNames.arrow,
|
|
130
149
|
style: resolvedStyles.arrow,
|
|
131
|
-
children:
|
|
150
|
+
children: PopoverArrowIcon
|
|
132
151
|
}), /* @__PURE__ */ jsx(Popover.Viewport, {
|
|
133
152
|
className: resolvedClassNames.viewport,
|
|
134
153
|
style: resolvedStyles.viewport,
|
|
135
|
-
children:
|
|
154
|
+
children: /* @__PURE__ */ jsx(PopoverProvider, {
|
|
155
|
+
value: contextValue,
|
|
156
|
+
children: content
|
|
157
|
+
})
|
|
136
158
|
})]
|
|
137
159
|
})
|
|
138
160
|
}), [
|
|
139
161
|
arrow,
|
|
140
162
|
content,
|
|
163
|
+
contextValue,
|
|
141
164
|
openOnHover,
|
|
142
165
|
placement,
|
|
143
166
|
placementConfig.align,
|