@lobehub/ui 4.20.0 → 4.21.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.
Files changed (182) hide show
  1. package/es/Accordion/Accordion.d.mts +2 -2
  2. package/es/Accordion/AccordionItem.d.mts +2 -2
  3. package/es/ActionIcon/ActionIcon.d.mts +2 -2
  4. package/es/Alert/Alert.d.mts +2 -2
  5. package/es/AutoComplete/Select.d.mts +2 -2
  6. package/es/Avatar/AvatarGroup/index.d.mts +2 -2
  7. package/es/Burger/Burger.d.mts +2 -2
  8. package/es/CodeDiff/CodeDiff.d.mts +2 -2
  9. package/es/CodeDiff/PatchDiff.d.mts +2 -2
  10. package/es/CodeEditor/CodeEditor.d.mts +2 -2
  11. package/es/Collapse/Collapse.d.mts +2 -2
  12. package/es/ConfigProvider/index.d.mts +2 -2
  13. package/es/ContextMenu/ContextMenuHost.d.mts +3 -3
  14. package/es/DatePicker/DatePicker.d.mts +2 -2
  15. package/es/DraggablePanel/components/DraggablePanelBody.d.mts +2 -2
  16. package/es/DraggablePanel/components/DraggablePanelContainer.d.mts +2 -2
  17. package/es/DraggablePanel/components/DraggablePanelFooter.d.mts +2 -2
  18. package/es/DraggablePanel/components/DraggablePanelHeader.d.mts +2 -2
  19. package/es/DraggableSideNav/DraggableSideNav.d.mts +2 -2
  20. package/es/Drawer/Drawer.d.mts +2 -2
  21. package/es/Dropdown/Dropdown.d.mts +2 -2
  22. package/es/DropdownMenu/DropdownMenu.d.mts +2 -2
  23. package/es/DropdownMenu/DropdownMenu.mjs +7 -5
  24. package/es/DropdownMenu/DropdownMenu.mjs.map +1 -1
  25. package/es/DropdownMenu/atoms.d.mts +29 -20
  26. package/es/DropdownMenu/atoms.mjs +5 -5
  27. package/es/DropdownMenu/atoms.mjs.map +1 -1
  28. package/es/DropdownMenu/type.d.mts +7 -0
  29. package/es/EditableText/EditableText.d.mts +2 -2
  30. package/es/EmojiPicker/EmojiPicker.d.mts +2 -2
  31. package/es/EmojiPicker/EmojiPicker.mjs +5 -1
  32. package/es/EmojiPicker/EmojiPicker.mjs.map +1 -1
  33. package/es/EmojiPicker/style.mjs +4 -0
  34. package/es/EmojiPicker/style.mjs.map +1 -1
  35. package/es/Flex/FlexBasic.d.mts +2 -2
  36. package/es/FontLoader/index.d.mts +2 -2
  37. package/es/Footer/Footer.d.mts +2 -2
  38. package/es/Form/components/FormGroup.d.mts +2 -2
  39. package/es/Form/components/FormItem.d.mts +2 -2
  40. package/es/Form/components/FormSubmitFooter.d.mts +2 -2
  41. package/es/FormModal/FormModal.d.mts +2 -2
  42. package/es/GuideCard/GuideCard.d.mts +2 -2
  43. package/es/Header/Header.d.mts +2 -2
  44. package/es/Highlighter/Highlighter.d.mts +2 -2
  45. package/es/Highlighter/SyntaxHighlighter/index.d.mts +2 -2
  46. package/es/Hotkey/Hotkey.d.mts +2 -2
  47. package/es/HotkeyInput/HotkeyInput.d.mts +2 -2
  48. package/es/Icon/Icon.d.mts +2 -2
  49. package/es/Icon/components/IconProvider.d.mts +3 -3
  50. package/es/Image/PreviewGroup.d.mts +2 -2
  51. package/es/ImageSelect/ImageSelect.d.mts +2 -2
  52. package/es/Input/Input.d.mts +2 -2
  53. package/es/Input/InputNumber.d.mts +2 -2
  54. package/es/Input/InputOPT.d.mts +2 -2
  55. package/es/Input/InputPassword.d.mts +2 -2
  56. package/es/Input/TextArea.d.mts +2 -2
  57. package/es/Layout/components/LayoutFooter.d.mts +2 -2
  58. package/es/Layout/components/LayoutHeader.d.mts +2 -2
  59. package/es/Layout/components/LayoutMain.d.mts +2 -2
  60. package/es/Layout/components/LayoutSidebar.d.mts +2 -2
  61. package/es/Layout/components/LayoutSidebarInner.d.mts +2 -2
  62. package/es/Layout/components/LayoutToc.d.mts +2 -2
  63. package/es/List/ListItem/index.d.mts +2 -2
  64. package/es/LobeSelect/LobeSelect.d.mts +8 -0
  65. package/es/LobeSelect/LobeSelect.mjs +486 -0
  66. package/es/LobeSelect/LobeSelect.mjs.map +1 -0
  67. package/es/LobeSelect/atoms.d.mts +155 -0
  68. package/es/LobeSelect/atoms.mjs +172 -0
  69. package/es/LobeSelect/atoms.mjs.map +1 -0
  70. package/es/LobeSelect/constants.d.mts +5 -0
  71. package/es/LobeSelect/constants.mjs +6 -0
  72. package/es/LobeSelect/constants.mjs.map +1 -0
  73. package/es/LobeSelect/index.d.mts +5 -0
  74. package/es/LobeSelect/index.d.ts +1 -0
  75. package/es/LobeSelect/index.js +1 -0
  76. package/es/LobeSelect/index.mjs +5 -0
  77. package/es/LobeSelect/style.mjs +274 -0
  78. package/es/LobeSelect/style.mjs.map +1 -0
  79. package/es/LobeSelect/type.d.mts +83 -0
  80. package/es/Markdown/Markdown.d.mts +2 -2
  81. package/es/Markdown/Typography.d.mts +2 -2
  82. package/es/Markdown/components/SearchResultCards/index.d.mts +2 -2
  83. package/es/Markdown/markdown.style.mjs +40 -15
  84. package/es/Markdown/markdown.style.mjs.map +1 -1
  85. package/es/MaskShadow/MaskShadow.d.mts +2 -2
  86. package/es/Menu/Menu.d.mts +2 -2
  87. package/es/Mermaid/Mermaid.d.mts +2 -2
  88. package/es/Mermaid/SyntaxMermaid/index.d.mts +2 -2
  89. package/es/Modal/Modal.d.mts +2 -2
  90. package/es/Modal/ModalProvider.d.mts +2 -2
  91. package/es/Modal/imperative.d.mts +2 -2
  92. package/es/MotionProvider/index.d.mts +2 -2
  93. package/es/Popover/ArrowIcon.d.mts +2 -2
  94. package/es/Popover/Popover.d.mts +1 -1
  95. package/es/Popover/Popover.mjs +1 -1
  96. package/es/Popover/Popover.mjs.map +1 -1
  97. package/es/Popover/PopoverGroup.mjs +1 -1
  98. package/es/Popover/PopoverGroup.mjs.map +1 -1
  99. package/es/Popover/PopoverInGroup.mjs +1 -1
  100. package/es/Popover/PopoverInGroup.mjs.map +1 -1
  101. package/es/Popover/PopoverStandalone.mjs +1 -1
  102. package/es/Popover/PopoverStandalone.mjs.map +1 -1
  103. package/es/Popover/atoms.d.mts +21 -12
  104. package/es/Popover/atoms.mjs +5 -5
  105. package/es/Popover/atoms.mjs.map +1 -1
  106. package/es/Popover/context.d.mts +2 -2
  107. package/es/Popover/index.d.mts +1 -1
  108. package/es/Popover/index.mjs +1 -1
  109. package/es/Popover/style.mjs +2 -2
  110. package/es/Popover/style.mjs.map +1 -1
  111. package/es/Popover/type.d.mts +7 -5
  112. package/es/SearchBar/SearchBar.d.mts +2 -2
  113. package/es/Segmented/Segmented.d.mts +2 -2
  114. package/es/Select/Select.d.mts +2 -2
  115. package/es/SideNav/SideNav.d.mts +2 -2
  116. package/es/SliderWithInput/SliderWithInput.d.mts +2 -2
  117. package/es/SortableList/components/DragHandle.d.mts +2 -2
  118. package/es/SortableList/components/SortableItem.d.mts +2 -2
  119. package/es/ThemeProvider/ThemeProvider.d.mts +2 -2
  120. package/es/Toast/imperative.d.mts +3 -3
  121. package/es/Toast/style.mjs +6 -3
  122. package/es/Toast/style.mjs.map +1 -1
  123. package/es/Toc/Toc.d.mts +2 -2
  124. package/es/Tooltip/style.mjs +2 -2
  125. package/es/Tooltip/style.mjs.map +1 -1
  126. package/es/Tooltip/type.d.mts +3 -3
  127. package/es/Video/index.d.mts +2 -2
  128. package/es/awesome/AuroraBackground/AuroraBackground.d.mts +2 -2
  129. package/es/awesome/BottomGradientButton/BottomGradientButton.d.mts +2 -2
  130. package/es/awesome/Features/Features.d.mts +2 -2
  131. package/es/awesome/Giscus/Giscus.d.mts +2 -2
  132. package/es/awesome/GradientButton/GradientButton.d.mts +2 -2
  133. package/es/awesome/GridBackground/GridBackground.d.mts +2 -2
  134. package/es/awesome/GridBackground/GridShowcase.d.mts +2 -2
  135. package/es/awesome/Hero/Hero.d.mts +2 -2
  136. package/es/awesome/Spline/Spine.d.mts +2 -2
  137. package/es/awesome/Spotlight/Spotlight.d.mts +2 -2
  138. package/es/awesome/SpotlightCard/SpotlightCard.d.mts +2 -2
  139. package/es/awesome/TypewriterEffect/TypewriterEffect.d.mts +2 -2
  140. package/es/brand/LobeChat/index.d.mts +2 -2
  141. package/es/brand/LobeHub/index.d.mts +2 -2
  142. package/es/brand/LogoThree/LogoSpline.d.mts +2 -2
  143. package/es/brand/LogoThree/index.d.mts +2 -2
  144. package/es/chat/BackBottom/BackBottom.d.mts +2 -2
  145. package/es/chat/ChatItem/ChatItem.d.mts +2 -2
  146. package/es/chat/ChatList/ChatList.d.mts +2 -2
  147. package/es/chat/EditableMessageList/EditableMessageList.d.mts +2 -2
  148. package/es/chat/MessageInput/MessageInput.d.mts +2 -2
  149. package/es/chat/MessageModal/MessageModal.d.mts +2 -2
  150. package/es/color/ColorScales/index.d.mts +2 -2
  151. package/es/color/CssVar/index.d.mts +2 -2
  152. package/es/i18n/context.d.mts +2 -2
  153. package/es/icons/lucideExtra/BotPromptIcon.d.mts +2 -2
  154. package/es/icons/lucideExtra/CreateBotIcon.d.mts +2 -2
  155. package/es/icons/lucideExtra/DiscordIcon.d.mts +2 -2
  156. package/es/icons/lucideExtra/GlobeOffIcon.d.mts +2 -2
  157. package/es/icons/lucideExtra/GroupBotIcon.d.mts +2 -2
  158. package/es/icons/lucideExtra/GroupBotSquareIcon.d.mts +3 -3
  159. package/es/icons/lucideExtra/LeftClickIcon.d.mts +3 -3
  160. package/es/icons/lucideExtra/LeftDoubleClickIcon.d.mts +2 -2
  161. package/es/icons/lucideExtra/McpIcon.d.mts +3 -3
  162. package/es/icons/lucideExtra/ProviderIcon.d.mts +3 -3
  163. package/es/icons/lucideExtra/RightClickIcon.d.mts +3 -3
  164. package/es/icons/lucideExtra/RightDoubleClickIcon.d.mts +3 -3
  165. package/es/icons/lucideExtra/ShapesUploadIcon.d.mts +3 -3
  166. package/es/icons/lucideExtra/TreeDownRightIcon.d.mts +3 -3
  167. package/es/icons/lucideExtra/TreeUpDownRightIcon.d.mts +3 -3
  168. package/es/index.d.mts +7 -1
  169. package/es/index.mjs +4 -1
  170. package/es/mdx/Mdx/index.d.mts +2 -2
  171. package/es/mobile/ChatHeader/ChatHeaderTitle.d.mts +2 -2
  172. package/es/mobile/ChatInputArea/components/ChatSendButton.d.mts +2 -2
  173. package/es/mobile/TabBar/TabBar.d.mts +2 -2
  174. package/es/storybook/StoryBook/index.d.mts +2 -2
  175. package/es/types/index.d.mts +2 -1
  176. package/es/types/trigger.d.mts +8 -0
  177. package/es/utils/parseTrigger.d.mts +14 -0
  178. package/es/{Popover → utils}/parseTrigger.mjs +1 -1
  179. package/es/utils/parseTrigger.mjs.map +1 -0
  180. package/package.json +3 -2
  181. package/es/Popover/parseTrigger.d.mts +0 -14
  182. package/es/Popover/parseTrigger.mjs.map +0 -1
@@ -1,8 +1,8 @@
1
1
  import { AccordionProps } from "./type.mjs";
2
- import * as react49 from "react";
2
+ import * as react14 from "react";
3
3
 
4
4
  //#region src/Accordion/Accordion.d.ts
5
- declare const Accordion: react49.NamedExoticComponent<AccordionProps>;
5
+ declare const Accordion: react14.NamedExoticComponent<AccordionProps>;
6
6
  //#endregion
7
7
  export { Accordion };
8
8
  //# sourceMappingURL=Accordion.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { AccordionItemProps } from "./type.mjs";
2
- import * as react50 from "react";
2
+ import * as react13 from "react";
3
3
 
4
4
  //#region src/Accordion/AccordionItem.d.ts
5
- declare const AccordionItem: react50.NamedExoticComponent<AccordionItemProps>;
5
+ declare const AccordionItem: react13.NamedExoticComponent<AccordionItemProps>;
6
6
  //#endregion
7
7
  export { AccordionItem };
8
8
  //# sourceMappingURL=AccordionItem.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { ActionIconProps } from "./type.mjs";
2
- import * as react0 from "react";
2
+ import * as react11 from "react";
3
3
 
4
4
  //#region src/ActionIcon/ActionIcon.d.ts
5
- declare const ActionIcon: react0.NamedExoticComponent<ActionIconProps>;
5
+ declare const ActionIcon: react11.NamedExoticComponent<ActionIconProps>;
6
6
  //#endregion
7
7
  export { ActionIcon };
8
8
  //# sourceMappingURL=ActionIcon.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { AlertProps } from "./type.mjs";
2
- import * as react44 from "react";
2
+ import * as react9 from "react";
3
3
 
4
4
  //#region src/Alert/Alert.d.ts
5
- declare const Alert: react44.NamedExoticComponent<AlertProps>;
5
+ declare const Alert: react9.NamedExoticComponent<AlertProps>;
6
6
  //#endregion
7
7
  export { Alert };
8
8
  //# sourceMappingURL=Alert.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { AutoCompleteProps } from "./type.mjs";
2
- import * as react43 from "react";
2
+ import * as react12 from "react";
3
3
 
4
4
  //#region src/AutoComplete/Select.d.ts
5
- declare const AutoComplete: react43.NamedExoticComponent<AutoCompleteProps>;
5
+ declare const AutoComplete: react12.NamedExoticComponent<AutoCompleteProps>;
6
6
  //#endregion
7
7
  export { AutoComplete };
8
8
  //# sourceMappingURL=Select.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { AvatarGroupProps } from "../type.mjs";
2
- import * as react42 from "react";
2
+ import * as react23 from "react";
3
3
 
4
4
  //#region src/Avatar/AvatarGroup/index.d.ts
5
- declare const AvatarGroup: react42.NamedExoticComponent<AvatarGroupProps>;
5
+ declare const AvatarGroup: react23.NamedExoticComponent<AvatarGroupProps>;
6
6
  //#endregion
7
7
  export { AvatarGroup };
8
8
  //# sourceMappingURL=index.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { BurgerProps } from "./type.mjs";
2
- import * as react68 from "react";
2
+ import * as react17 from "react";
3
3
 
4
4
  //#region src/Burger/Burger.d.ts
5
- declare const Burger: react68.NamedExoticComponent<BurgerProps>;
5
+ declare const Burger: react17.NamedExoticComponent<BurgerProps>;
6
6
  //#endregion
7
7
  export { Burger };
8
8
  //# sourceMappingURL=Burger.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { CodeDiffProps } from "./type.mjs";
2
- import * as react66 from "react";
2
+ import * as react15 from "react";
3
3
 
4
4
  //#region src/CodeDiff/CodeDiff.d.ts
5
- declare const CodeDiff: react66.NamedExoticComponent<CodeDiffProps>;
5
+ declare const CodeDiff: react15.NamedExoticComponent<CodeDiffProps>;
6
6
  //#endregion
7
7
  export { CodeDiff };
8
8
  //# sourceMappingURL=CodeDiff.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { PatchDiffProps } from "./type.mjs";
2
- import * as react67 from "react";
2
+ import * as react16 from "react";
3
3
 
4
4
  //#region src/CodeDiff/PatchDiff.d.ts
5
- declare const PatchDiff: react67.NamedExoticComponent<PatchDiffProps>;
5
+ declare const PatchDiff: react16.NamedExoticComponent<PatchDiffProps>;
6
6
  //#endregion
7
7
  export { PatchDiff };
8
8
  //# sourceMappingURL=PatchDiff.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { CodeEditorProps } from "./type.mjs";
2
- import * as react65 from "react";
2
+ import * as react18 from "react";
3
3
 
4
4
  //#region src/CodeEditor/CodeEditor.d.ts
5
- declare const CodeEditor: react65.NamedExoticComponent<CodeEditorProps>;
5
+ declare const CodeEditor: react18.NamedExoticComponent<CodeEditorProps>;
6
6
  //#endregion
7
7
  export { CodeEditor };
8
8
  //# sourceMappingURL=CodeEditor.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { CollapseProps } from "./type.mjs";
2
- import * as react64 from "react";
2
+ import * as react4 from "react";
3
3
 
4
4
  //#region src/Collapse/Collapse.d.ts
5
- declare const Collapse: react64.NamedExoticComponent<CollapseProps>;
5
+ declare const Collapse: react4.NamedExoticComponent<CollapseProps>;
6
6
  //#endregion
7
7
  export { Collapse };
8
8
  //# sourceMappingURL=Collapse.d.mts.map
@@ -1,7 +1,7 @@
1
1
  import { MotionComponentType } from "../MotionProvider/index.mjs";
2
2
  import { TranslationResourcesInput } from "../i18n/types.mjs";
3
3
  import { CDN, CdnApi } from "../utils/genCdnUrl.mjs";
4
- import * as react75 from "react";
4
+ import * as react80 from "react";
5
5
  import { ElementType, ReactNode } from "react";
6
6
 
7
7
  //#region src/ConfigProvider/index.d.ts
@@ -19,7 +19,7 @@ interface ConfigProviderProps {
19
19
  motion: MotionComponentType;
20
20
  resources?: TranslationResourcesInput;
21
21
  }
22
- declare const ConfigProvider: react75.NamedExoticComponent<ConfigProviderProps>;
22
+ declare const ConfigProvider: react80.NamedExoticComponent<ConfigProviderProps>;
23
23
  type CdnFn = ({
24
24
  pkg,
25
25
  version,
@@ -1,8 +1,8 @@
1
- import * as react120 from "react";
2
- import * as react_jsx_runtime20 from "react/jsx-runtime";
1
+ import * as react123 from "react";
2
+ import * as react_jsx_runtime37 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/ContextMenu/ContextMenuHost.d.ts
5
- declare const ContextMenuHost: react120.MemoExoticComponent<() => react_jsx_runtime20.JSX.Element | null>;
5
+ declare const ContextMenuHost: react123.MemoExoticComponent<() => react_jsx_runtime37.JSX.Element | null>;
6
6
  //#endregion
7
7
  export { ContextMenuHost };
8
8
  //# sourceMappingURL=ContextMenuHost.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { DatePickerProps } from "./type.mjs";
2
- import * as react63 from "react";
2
+ import * as react6 from "react";
3
3
 
4
4
  //#region src/DatePicker/DatePicker.d.ts
5
- declare const DatePicker: react63.NamedExoticComponent<DatePickerProps>;
5
+ declare const DatePicker: react6.NamedExoticComponent<DatePickerProps>;
6
6
  //#endregion
7
7
  export { DatePicker };
8
8
  //# sourceMappingURL=DatePicker.d.mts.map
@@ -1,9 +1,9 @@
1
1
  import { DivProps } from "../../types/index.mjs";
2
- import * as react45 from "react";
2
+ import * as react0 from "react";
3
3
 
4
4
  //#region src/DraggablePanel/components/DraggablePanelBody.d.ts
5
5
  type DraggablePanelBodyProps = DivProps;
6
- declare const DraggablePanelBody: react45.NamedExoticComponent<DivProps>;
6
+ declare const DraggablePanelBody: react0.NamedExoticComponent<DivProps>;
7
7
  //#endregion
8
8
  export { DraggablePanelBody, DraggablePanelBodyProps };
9
9
  //# sourceMappingURL=DraggablePanelBody.d.mts.map
@@ -1,9 +1,9 @@
1
1
  import { DivProps } from "../../types/index.mjs";
2
- import * as react46 from "react";
2
+ import * as react2 from "react";
3
3
 
4
4
  //#region src/DraggablePanel/components/DraggablePanelContainer.d.ts
5
5
  type DraggablePanelContainerProps = DivProps;
6
- declare const DraggablePanelContainer: react46.NamedExoticComponent<DivProps>;
6
+ declare const DraggablePanelContainer: react2.NamedExoticComponent<DivProps>;
7
7
  //#endregion
8
8
  export { DraggablePanelContainer, DraggablePanelContainerProps };
9
9
  //# sourceMappingURL=DraggablePanelContainer.d.mts.map
@@ -1,9 +1,9 @@
1
1
  import { DivProps } from "../../types/index.mjs";
2
- import * as react47 from "react";
2
+ import * as react1 from "react";
3
3
 
4
4
  //#region src/DraggablePanel/components/DraggablePanelFooter.d.ts
5
5
  type DraggablePanelFooterProps = DivProps;
6
- declare const DraggablePanelFooter: react47.NamedExoticComponent<DivProps>;
6
+ declare const DraggablePanelFooter: react1.NamedExoticComponent<DivProps>;
7
7
  //#endregion
8
8
  export { DraggablePanelFooter, DraggablePanelFooterProps };
9
9
  //# sourceMappingURL=DraggablePanelFooter.d.mts.map
@@ -1,5 +1,5 @@
1
1
  import { DivProps } from "../../types/index.mjs";
2
- import * as react48 from "react";
2
+ import * as react3 from "react";
3
3
 
4
4
  //#region src/DraggablePanel/components/DraggablePanelHeader.d.ts
5
5
  interface DraggablePanelHeaderProps extends Omit<DivProps, 'children'> {
@@ -9,7 +9,7 @@ interface DraggablePanelHeaderProps extends Omit<DivProps, 'children'> {
9
9
  setPin?: (pin: boolean) => void;
10
10
  title?: string;
11
11
  }
12
- declare const DraggablePanelHeader: react48.NamedExoticComponent<DraggablePanelHeaderProps>;
12
+ declare const DraggablePanelHeader: react3.NamedExoticComponent<DraggablePanelHeaderProps>;
13
13
  //#endregion
14
14
  export { DraggablePanelHeader, DraggablePanelHeaderProps };
15
15
  //# sourceMappingURL=DraggablePanelHeader.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { DraggableSideNavProps } from "./type.mjs";
2
- import * as react40 from "react";
2
+ import * as react7 from "react";
3
3
 
4
4
  //#region src/DraggableSideNav/DraggableSideNav.d.ts
5
- declare const DraggableSideNav: react40.NamedExoticComponent<DraggableSideNavProps>;
5
+ declare const DraggableSideNav: react7.NamedExoticComponent<DraggableSideNavProps>;
6
6
  //#endregion
7
7
  export { DraggableSideNav };
8
8
  //# sourceMappingURL=DraggableSideNav.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { DrawerProps } from "./type.mjs";
2
- import * as react41 from "react";
2
+ import * as react5 from "react";
3
3
 
4
4
  //#region src/Drawer/Drawer.d.ts
5
- declare const Drawer: react41.NamedExoticComponent<DrawerProps>;
5
+ declare const Drawer: react5.NamedExoticComponent<DrawerProps>;
6
6
  //#endregion
7
7
  export { Drawer };
8
8
  //# sourceMappingURL=Drawer.d.mts.map
@@ -1,5 +1,5 @@
1
1
  import { DropdownProps } from "./type.mjs";
2
- import * as react39 from "react";
2
+ import * as react20 from "react";
3
3
 
4
4
  //#region src/Dropdown/Dropdown.d.ts
5
5
 
@@ -9,7 +9,7 @@ import * as react39 from "react";
9
9
  * @see https://ui.lobehub.com/components/context-menu
10
10
  * @see https://ui.lobehub.com/components/dropdown-menu
11
11
  */
12
- declare const Dropdown: react39.NamedExoticComponent<DropdownProps>;
12
+ declare const Dropdown: react20.NamedExoticComponent<DropdownProps>;
13
13
  //#endregion
14
14
  export { Dropdown };
15
15
  //# sourceMappingURL=Dropdown.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { DropdownMenuProps } from "./type.mjs";
2
- import * as react37 from "react";
2
+ import * as react21 from "react";
3
3
 
4
4
  //#region src/DropdownMenu/DropdownMenu.d.ts
5
- declare const DropdownMenu: react37.NamedExoticComponent<DropdownMenuProps<unknown>>;
5
+ declare const DropdownMenu: react21.NamedExoticComponent<DropdownMenuProps<unknown>>;
6
6
  //#endregion
7
7
  export { DropdownMenu };
8
8
  //# sourceMappingURL=DropdownMenu.d.mts.map
@@ -2,14 +2,16 @@
2
2
 
3
3
  import { useNativeButton } from "../hooks/useNativeButton.mjs";
4
4
  import { DropdownMenuPopup, DropdownMenuPortal, DropdownMenuPositioner, DropdownMenuTrigger } from "./atoms.mjs";
5
+ import { parseTrigger } from "../utils/parseTrigger.mjs";
5
6
  import { renderDropdownMenuItems } from "./renderItems.mjs";
6
7
  import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
7
8
  import { jsx, jsxs } from "react/jsx-runtime";
8
9
  import { Menu } from "@base-ui/react/menu";
9
10
 
10
11
  //#region src/DropdownMenu/DropdownMenu.tsx
11
- const DropdownMenu = memo(({ children, defaultOpen, items, nativeButton, onOpenChange, onOpenChangeComplete, open, placement = "bottomLeft", popupProps, portalProps, positionerProps, triggerProps, ...rest }) => {
12
+ const DropdownMenu = memo(({ children, defaultOpen, items, nativeButton, onOpenChange, onOpenChangeComplete, open, placement = "bottomLeft", popupProps, portalProps, positionerProps, trigger = "click", triggerProps, ...rest }) => {
12
13
  const [uncontrolledOpen, setUncontrolledOpen] = useState(Boolean(defaultOpen));
14
+ const { openOnHover } = useMemo(() => parseTrigger(trigger), [trigger]);
13
15
  useEffect(() => {
14
16
  if (open === void 0) return;
15
17
  setUncontrolledOpen(open);
@@ -32,16 +34,16 @@ const DropdownMenu = memo(({ children, defaultOpen, items, nativeButton, onOpenC
32
34
  onOpenChangeComplete?.(nextOpen);
33
35
  if (!nextOpen) menuItemsRef.current = null;
34
36
  }, [onOpenChangeComplete]);
35
- const hoverTrigger = Boolean(triggerProps?.openOnHover);
36
37
  const { container: portalContainer, ...restPortalProps } = portalProps ?? {};
37
38
  const { resolvedNativeButton } = useNativeButton({
38
39
  children,
39
40
  nativeButton,
40
41
  triggerNativeButton: triggerProps?.nativeButton
41
42
  });
42
- const trigger = /* @__PURE__ */ jsx(DropdownMenuTrigger, {
43
+ const triggerElement = /* @__PURE__ */ jsx(DropdownMenuTrigger, {
43
44
  ...triggerProps,
44
45
  nativeButton: resolvedNativeButton,
46
+ openOnHover,
45
47
  children
46
48
  });
47
49
  return /* @__PURE__ */ jsxs(Menu.Root, {
@@ -50,12 +52,12 @@ const DropdownMenu = memo(({ children, defaultOpen, items, nativeButton, onOpenC
50
52
  onOpenChange: handleOpenChange,
51
53
  onOpenChangeComplete: handleOpenChangeComplete,
52
54
  open,
53
- children: [trigger, /* @__PURE__ */ jsx(DropdownMenuPortal, {
55
+ children: [triggerElement, /* @__PURE__ */ jsx(DropdownMenuPortal, {
54
56
  container: portalContainer,
55
57
  ...restPortalProps,
56
58
  children: /* @__PURE__ */ jsx(DropdownMenuPositioner, {
57
59
  ...positionerProps,
58
- hoverTrigger,
60
+ hoverTrigger: openOnHover,
59
61
  placement,
60
62
  children: /* @__PURE__ */ jsx(DropdownMenuPopup, {
61
63
  ...popupProps,
@@ -1 +1 @@
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';\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\n items,\n nativeButton,\n onOpenChange,\n onOpenChangeComplete,\n open,\n placement = 'bottomLeft',\n popupProps,\n portalProps,\n positionerProps,\n triggerProps,\n ...rest\n }) => {\n const [uncontrolledOpen, setUncontrolledOpen] = useState(Boolean(defaultOpen));\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 menuItemsRef.current = renderedItems;\n return renderedItems;\n }\n return menuItemsRef.current;\n }, [isOpen, items]);\n const handleOpenChangeComplete = useCallback(\n (nextOpen: boolean) => {\n onOpenChangeComplete?.(nextOpen);\n if (!nextOpen) {\n menuItemsRef.current = null;\n }\n },\n [onOpenChangeComplete],\n );\n const hoverTrigger = Boolean((triggerProps as any)?.openOnHover);\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 trigger = (\n <DropdownMenuTrigger {...triggerProps} nativeButton={resolvedNativeButton}>\n {children}\n </DropdownMenuTrigger>\n );\n\n return (\n <Menu.Root\n {...rest}\n defaultOpen={defaultOpen}\n onOpenChange={handleOpenChange}\n onOpenChangeComplete={handleOpenChangeComplete}\n open={open}\n >\n {trigger}\n <DropdownMenuPortal container={portalContainer} {...restPortalProps}>\n <DropdownMenuPositioner\n {...positionerProps}\n hoverTrigger={hoverTrigger}\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":";;;;;;;;;;AAgBA,MAAM,eAAe,MAClB,EACC,UACA,aAEA,OACA,cACA,cACA,sBACA,MACA,YAAY,cACZ,YACA,aACA,iBACA,cACA,GAAG,WACC;CACJ,MAAM,CAAC,kBAAkB,uBAAuB,SAAS,QAAQ,YAAY,CAAC;AAE9E,iBAAgB;AACd,MAAI,SAAS,OAAW;AACxB,sBAAoB,KAAK;IACxB,CAAC,KAAK,CAAC;CAEV,MAAM,mBAAmB,aACtB,UAAmB,YAA6D;AAC/E,iBAAe,UAAU,QAAQ;AACjC,MAAI,SAAS,OACX,qBAAoB,SAAS;IAGjC,CAAC,cAAc,KAAK,CACrB;CAED,MAAM,eAAe,OAA0D,KAAK;CACpF,MAAM,SAAS,QAAQ;CACvB,MAAM,YAAY,cAAc;AAC9B,MAAI,QAAQ;GAEV,MAAM,gBAAgB,wBADA,OAAO,UAAU,aAAa,OAAO,GAAG,MACF;AAC5D,gBAAa,UAAU;AACvB,UAAO;;AAET,SAAO,aAAa;IACnB,CAAC,QAAQ,MAAM,CAAC;CACnB,MAAM,2BAA2B,aAC9B,aAAsB;AACrB,yBAAuB,SAAS;AAChC,MAAI,CAAC,SACH,cAAa,UAAU;IAG3B,CAAC,qBAAqB,CACvB;CACD,MAAM,eAAe,QAAS,cAAsB,YAAY;CAChE,MAAM,EAAE,WAAW,iBAAiB,GAAG,oBAAqB,eAAe,EAAE;CAE7E,MAAM,EAAE,yBAAyB,gBAAgB;EAC/C;EACA;EACA,qBAAqB,cAAc;EACpC,CAAC;CAEF,MAAM,UACJ,oBAAC;EAAoB,GAAI;EAAc,cAAc;EAClD;GACmB;AAGxB,QACE,qBAAC,KAAK;EACJ,GAAI;EACS;EACb,cAAc;EACd,sBAAsB;EAChB;aAEL,SACD,oBAAC;GAAmB,WAAW;GAAiB,GAAI;aAClD,oBAAC;IACC,GAAI;IACU;IACH;cAEX,oBAAC;KAAkB,GAAI;eAAa;MAA8B;KAC3C;IACN;GACX;EAGjB;AAED,aAAa,cAAc;AAE3B,2BAAe"}
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\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 menuItemsRef.current = renderedItems;\n return renderedItems;\n }\n return menuItemsRef.current;\n }, [isOpen, items]);\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 onOpenChange={handleOpenChange}\n onOpenChangeComplete={handleOpenChangeComplete}\n open={open}\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,aAEA,OACA,cACA,cACA,sBACA,MACA,YAAY,cACZ,YACA,aACA,iBACA,UAAU,SACV,cACA,GAAG,WACC;CACJ,MAAM,CAAC,kBAAkB,uBAAuB,SAAS,QAAQ,YAAY,CAAC;CAE9E,MAAM,EAAE,gBAAgB,cAAc,aAAa,QAAQ,EAAE,CAAC,QAAQ,CAAC;AAEvE,iBAAgB;AACd,MAAI,SAAS,OAAW;AACxB,sBAAoB,KAAK;IACxB,CAAC,KAAK,CAAC;CAEV,MAAM,mBAAmB,aACtB,UAAmB,YAA6D;AAC/E,iBAAe,UAAU,QAAQ;AACjC,MAAI,SAAS,OACX,qBAAoB,SAAS;IAGjC,CAAC,cAAc,KAAK,CACrB;CAED,MAAM,eAAe,OAA0D,KAAK;CACpF,MAAM,SAAS,QAAQ;CACvB,MAAM,YAAY,cAAc;AAC9B,MAAI,QAAQ;GAEV,MAAM,gBAAgB,wBADA,OAAO,UAAU,aAAa,OAAO,GAAG,MACF;AAC5D,gBAAa,UAAU;AACvB,UAAO;;AAET,SAAO,aAAa;IACnB,CAAC,QAAQ,MAAM,CAAC;CACnB,MAAM,2BAA2B,aAC9B,aAAsB;AACrB,yBAAuB,SAAS;AAChC,MAAI,CAAC,SACH,cAAa,UAAU;IAG3B,CAAC,qBAAqB,CACvB;CACD,MAAM,EAAE,WAAW,iBAAiB,GAAG,oBAAqB,eAAe,EAAE;CAE7E,MAAM,EAAE,yBAAyB,gBAAgB;EAC/C;EACA;EACA,qBAAqB,cAAc;EACpC,CAAC;CAEF,MAAM,iBACJ,oBAAC;EACC,GAAI;EACJ,cAAc;EACD;EAEZ;GACmB;AAGxB,QACE,qBAAC,KAAK;EACJ,GAAI;EACS;EACb,cAAc;EACd,sBAAsB;EAChB;aAEL,gBACD,oBAAC;GAAmB,WAAW;GAAiB,GAAI;aAClD,oBAAC;IACC,GAAI;IACJ,cAAc;IACH;cAEX,oBAAC;KAAkB,GAAI;eAAa;MAA8B;KAC3C;IACN;GACX;EAGjB;AAED,aAAa,cAAc;AAE3B,2BAAe"}
@@ -1,18 +1,27 @@
1
1
  import { DropdownMenuPlacement } from "./type.mjs";
2
2
  import React from "react";
3
- import * as react_jsx_runtime6 from "react/jsx-runtime";
4
- import * as _base_ui_react_menu0 from "@base-ui/react/menu";
3
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
5
4
  import { Menu } from "@base-ui/react/menu";
5
+ import * as _base_ui_react0 from "@base-ui/react";
6
6
 
7
7
  //#region src/DropdownMenu/atoms.d.ts
8
8
  declare const DROPDOWN_MENU_CONTAINER_ATTR = "data-lobe-ui-dropdown-menu-container";
9
9
  declare const DropdownMenuRoot: typeof Menu.Root;
10
10
  declare const DropdownMenuSubmenuRoot: typeof Menu.SubmenuRoot;
11
- declare const DropdownMenuCheckboxItemIndicator: React.ForwardRefExoticComponent<_base_ui_react_menu0.MenuCheckboxItemIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
12
- type DropdownMenuTriggerProps = Omit<React.ComponentProps<typeof Menu.Trigger>, 'children' | 'render'> & {
11
+ declare const DropdownMenuCheckboxItemIndicator: React.ForwardRefExoticComponent<Omit<_base_ui_react0.ContextMenuCheckboxItemIndicatorProps, "ref"> & React.RefAttributes<HTMLSpanElement>>;
12
+ type DropdownMenuTriggerProps = Omit<React.ComponentPropsWithRef<typeof Menu.Trigger>, 'children' | 'render'> & {
13
13
  children: React.ReactNode;
14
14
  };
15
- declare const DropdownMenuTrigger: React.ForwardRefExoticComponent<Omit<DropdownMenuTriggerProps, "ref"> & React.RefAttributes<HTMLElement>>;
15
+ declare const DropdownMenuTrigger: {
16
+ ({
17
+ children,
18
+ className,
19
+ nativeButton,
20
+ ref: refProp,
21
+ ...rest
22
+ }: DropdownMenuTriggerProps): react_jsx_runtime0.JSX.Element;
23
+ displayName: string;
24
+ };
16
25
  type DropdownMenuPortalProps = React.ComponentProps<typeof Menu.Portal> & {
17
26
  /**
18
27
  * When `container` is not provided, it uses a shared container created by `usePortalContainer`.
@@ -23,7 +32,7 @@ declare const DropdownMenuPortal: {
23
32
  ({
24
33
  container,
25
34
  ...rest
26
- }: DropdownMenuPortalProps): react_jsx_runtime6.JSX.Element;
35
+ }: DropdownMenuPortalProps): react_jsx_runtime0.JSX.Element;
27
36
  displayName: string;
28
37
  };
29
38
  type DropdownMenuPositionerProps = React.ComponentProps<typeof Menu.Positioner> & {
@@ -39,7 +48,7 @@ declare const DropdownMenuPositioner: {
39
48
  side,
40
49
  sideOffset,
41
50
  ...rest
42
- }: DropdownMenuPositionerProps): react_jsx_runtime6.JSX.Element;
51
+ }: DropdownMenuPositionerProps): react_jsx_runtime0.JSX.Element;
43
52
  displayName: string;
44
53
  };
45
54
  type DropdownMenuPopupProps = React.ComponentProps<typeof Menu.Popup>;
@@ -47,7 +56,7 @@ declare const DropdownMenuPopup: {
47
56
  ({
48
57
  className,
49
58
  ...rest
50
- }: DropdownMenuPopupProps): react_jsx_runtime6.JSX.Element;
59
+ }: DropdownMenuPopupProps): react_jsx_runtime0.JSX.Element;
51
60
  displayName: string;
52
61
  };
53
62
  type DropdownMenuItemProps = React.ComponentProps<typeof Menu.Item> & {
@@ -58,7 +67,7 @@ declare const DropdownMenuItem: {
58
67
  className,
59
68
  danger,
60
69
  ...rest
61
- }: DropdownMenuItemProps): react_jsx_runtime6.JSX.Element;
70
+ }: DropdownMenuItemProps): react_jsx_runtime0.JSX.Element;
62
71
  displayName: string;
63
72
  };
64
73
  type DropdownMenuCheckboxItemProps = React.ComponentProps<typeof Menu.CheckboxItem> & {
@@ -69,7 +78,7 @@ declare const DropdownMenuCheckboxItemPrimitive: {
69
78
  className,
70
79
  danger,
71
80
  ...rest
72
- }: DropdownMenuCheckboxItemProps): react_jsx_runtime6.JSX.Element;
81
+ }: DropdownMenuCheckboxItemProps): react_jsx_runtime0.JSX.Element;
73
82
  displayName: string;
74
83
  };
75
84
  type DropdownMenuSeparatorProps = React.ComponentProps<typeof Menu.Separator>;
@@ -77,16 +86,16 @@ declare const DropdownMenuSeparator: {
77
86
  ({
78
87
  className,
79
88
  ...rest
80
- }: DropdownMenuSeparatorProps): react_jsx_runtime6.JSX.Element;
89
+ }: DropdownMenuSeparatorProps): react_jsx_runtime0.JSX.Element;
81
90
  displayName: string;
82
91
  };
83
- declare const DropdownMenuGroup: React.ForwardRefExoticComponent<_base_ui_react_menu0.MenuGroupProps & React.RefAttributes<Element>>;
92
+ declare const DropdownMenuGroup: React.ForwardRefExoticComponent<Omit<_base_ui_react0.ContextMenuGroupProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
84
93
  type DropdownMenuGroupLabelProps = React.ComponentProps<typeof Menu.GroupLabel>;
85
94
  declare const DropdownMenuGroupLabel: {
86
95
  ({
87
96
  className,
88
97
  ...rest
89
- }: DropdownMenuGroupLabelProps): react_jsx_runtime6.JSX.Element;
98
+ }: DropdownMenuGroupLabelProps): react_jsx_runtime0.JSX.Element;
90
99
  displayName: string;
91
100
  };
92
101
  type DropdownMenuSubmenuTriggerProps = React.ComponentProps<typeof Menu.SubmenuTrigger> & {
@@ -97,7 +106,7 @@ declare const DropdownMenuSubmenuTrigger: {
97
106
  className,
98
107
  danger,
99
108
  ...rest
100
- }: DropdownMenuSubmenuTriggerProps): react_jsx_runtime6.JSX.Element;
109
+ }: DropdownMenuSubmenuTriggerProps): react_jsx_runtime0.JSX.Element;
101
110
  displayName: string;
102
111
  };
103
112
  type DropdownMenuItemContentProps = React.HTMLAttributes<HTMLDivElement>;
@@ -105,7 +114,7 @@ declare const DropdownMenuItemContent: {
105
114
  ({
106
115
  className,
107
116
  ...rest
108
- }: DropdownMenuItemContentProps): react_jsx_runtime6.JSX.Element;
117
+ }: DropdownMenuItemContentProps): react_jsx_runtime0.JSX.Element;
109
118
  displayName: string;
110
119
  };
111
120
  type DropdownMenuItemIconProps = React.HTMLAttributes<HTMLSpanElement>;
@@ -113,7 +122,7 @@ declare const DropdownMenuItemIcon: {
113
122
  ({
114
123
  className,
115
124
  ...rest
116
- }: DropdownMenuItemIconProps): react_jsx_runtime6.JSX.Element;
125
+ }: DropdownMenuItemIconProps): react_jsx_runtime0.JSX.Element;
117
126
  displayName: string;
118
127
  };
119
128
  type DropdownMenuItemLabelProps = React.HTMLAttributes<HTMLSpanElement>;
@@ -121,7 +130,7 @@ declare const DropdownMenuItemLabel: {
121
130
  ({
122
131
  className,
123
132
  ...rest
124
- }: DropdownMenuItemLabelProps): react_jsx_runtime6.JSX.Element;
133
+ }: DropdownMenuItemLabelProps): react_jsx_runtime0.JSX.Element;
125
134
  displayName: string;
126
135
  };
127
136
  type DropdownMenuItemExtraProps = React.HTMLAttributes<HTMLSpanElement>;
@@ -129,7 +138,7 @@ declare const DropdownMenuItemExtra: {
129
138
  ({
130
139
  className,
131
140
  ...rest
132
- }: DropdownMenuItemExtraProps): react_jsx_runtime6.JSX.Element;
141
+ }: DropdownMenuItemExtraProps): react_jsx_runtime0.JSX.Element;
133
142
  displayName: string;
134
143
  };
135
144
  type DropdownMenuSubmenuArrowProps = React.HTMLAttributes<HTMLSpanElement>;
@@ -137,7 +146,7 @@ declare const DropdownMenuSubmenuArrow: {
137
146
  ({
138
147
  className,
139
148
  ...rest
140
- }: DropdownMenuSubmenuArrowProps): react_jsx_runtime6.JSX.Element;
149
+ }: DropdownMenuSubmenuArrowProps): react_jsx_runtime0.JSX.Element;
141
150
  displayName: string;
142
151
  };
143
152
  type DropdownMenuSwitchItemProps = Omit<React.ComponentProps<typeof Menu.Item>, 'onClick'> & {
@@ -158,7 +167,7 @@ declare const DropdownMenuSwitchItem: {
158
167
  onCheckedChange,
159
168
  children,
160
169
  ...rest
161
- }: DropdownMenuSwitchItemProps): react_jsx_runtime6.JSX.Element;
170
+ }: DropdownMenuSwitchItemProps): react_jsx_runtime0.JSX.Element;
162
171
  displayName: string;
163
172
  };
164
173
  //#endregion
@@ -5,7 +5,7 @@ import { placementMap } from "../utils/placement.mjs";
5
5
  import { CLASSNAMES } from "../styles/classNames.mjs";
6
6
  import { styles } from "../Menu/sharedStyle.mjs";
7
7
  import { usePortalContainer } from "../hooks/usePortalContainer.mjs";
8
- import { cloneElement, forwardRef, isValidElement, useCallback, useState } from "react";
8
+ import { cloneElement, isValidElement, useCallback, useState } from "react";
9
9
  import { jsx, jsxs } from "react/jsx-runtime";
10
10
  import { Switch } from "antd";
11
11
  import { cx } from "antd-style";
@@ -23,7 +23,7 @@ const mergeStateClassName = (base, className) => {
23
23
  if (typeof className === "function") return (state) => cx(base, className(state));
24
24
  return cx(base, className);
25
25
  };
26
- const DropdownMenuTrigger = forwardRef(({ children, className, nativeButton, ...rest }, ref) => {
26
+ const DropdownMenuTrigger = ({ children, className, nativeButton, ref: refProp, ...rest }) => {
27
27
  const { isNativeButtonTriggerElement, resolvedNativeButton } = useNativeButton({
28
28
  children,
29
29
  nativeButton
@@ -41,7 +41,7 @@ const DropdownMenuTrigger = forwardRef(({ children, className, nativeButton, ...
41
41
  ref: mergeRefs([
42
42
  children.ref,
43
43
  props.ref,
44
- ref
44
+ refProp
45
45
  ])
46
46
  });
47
47
  };
@@ -54,10 +54,10 @@ const DropdownMenuTrigger = forwardRef(({ children, className, nativeButton, ...
54
54
  ...rest,
55
55
  className: clsx(CLASSNAMES.DropdownMenuTrigger, className),
56
56
  nativeButton: resolvedNativeButton,
57
- ref,
57
+ ref: refProp,
58
58
  children
59
59
  });
60
- });
60
+ };
61
61
  DropdownMenuTrigger.displayName = "DropdownMenuTrigger";
62
62
  const DropdownMenuPortal = ({ container, ...rest }) => {
63
63
  const defaultContainer = usePortalContainer(DROPDOWN_MENU_CONTAINER_ATTR);
@@ -1 +1 @@
1
- {"version":3,"file":"atoms.mjs","names":["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, forwardRef, isValidElement, useCallback, useState } from 'react';\nimport { mergeRefs } from 'react-merge-refs';\n\nimport { styles } from '@/Menu/sharedStyle';\nimport { useNativeButton } from '@/hooks/useNativeButton';\nimport { usePortalContainer } from '@/hooks/usePortalContainer';\nimport { CLASSNAMES } from '@/styles/classNames';\nimport { placementMap } from '@/utils/placement';\n\nimport type { DropdownMenuPlacement } from './type';\n\nexport const DROPDOWN_MENU_CONTAINER_ATTR = 'data-lobe-ui-dropdown-menu-container';\n\nexport const DropdownMenuRoot = Menu.Root;\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.ComponentProps<typeof Menu.Trigger>,\n 'children' | 'render'\n> & {\n children: React.ReactNode;\n};\n\nexport const DropdownMenuTrigger = forwardRef<HTMLElement, DropdownMenuTriggerProps>(\n ({ children, className, nativeButton, ...rest }, ref) => {\n const { isNativeButtonTriggerElement, resolvedNativeButton } = useNativeButton({\n children,\n nativeButton,\n });\n\n const renderer = (props: any) => {\n // Base UI's trigger props include `type=\"button\"` by default.\n // If we render into a non-<button> element, that prop is invalid and can warn.\n const resolvedProps = (() => {\n if (isNativeButtonTriggerElement) return props as any;\n // eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars\n const { type, ...restProps } = props as any;\n return restProps;\n })();\n\n const mergedProps = mergeProps((children as any).props, resolvedProps);\n return cloneElement(children as any, {\n ...mergedProps,\n className: clsx(CLASSNAMES.DropdownMenuTrigger, className, mergedProps.className),\n ref: mergeRefs([(children as any).ref, (props as any).ref, ref]),\n });\n };\n\n if (isValidElement(children)) {\n return (\n <Menu.Trigger {...rest} nativeButton={resolvedNativeButton} render={renderer as any} />\n );\n }\n\n return (\n <Menu.Trigger\n {...rest}\n className={clsx(CLASSNAMES.DropdownMenuTrigger, className)}\n nativeButton={resolvedNativeButton}\n ref={ref as any}\n >\n {children}\n </Menu.Trigger>\n );\n },\n);\n\nDropdownMenuTrigger.displayName = 'DropdownMenuTrigger';\n\nexport type DropdownMenuPortalProps = React.ComponentProps<typeof Menu.Portal> & {\n /**\n * When `container` is not provided, it uses a shared container created by `usePortalContainer`.\n */\n container?: HTMLElement | null;\n};\n\nexport const DropdownMenuPortal = ({ container, ...rest }: DropdownMenuPortalProps) => {\n const defaultContainer = usePortalContainer(DROPDOWN_MENU_CONTAINER_ATTR);\n return <Menu.Portal container={container ?? defaultContainer} {...rest} />;\n};\n\nDropdownMenuPortal.displayName = 'DropdownMenuPortal';\n\nexport type DropdownMenuPositionerProps = React.ComponentProps<typeof Menu.Positioner> & {\n hoverTrigger?: boolean;\n placement?: DropdownMenuPlacement;\n};\n\nexport const DropdownMenuPositioner = ({\n className,\n placement,\n hoverTrigger,\n align,\n side,\n sideOffset,\n ...rest\n}: DropdownMenuPositionerProps) => {\n const placementConfig = placement ? placementMap[placement] : undefined;\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 side={side ?? placementConfig?.side}\n sideOffset={sideOffset ?? (placementConfig ? 6 : undefined)}\n />\n );\n};\n\nDropdownMenuPositioner.displayName = 'DropdownMenuPositioner';\n\nexport type DropdownMenuPopupProps = React.ComponentProps<typeof Menu.Popup>;\n\nexport const DropdownMenuPopup = ({ className, ...rest }: DropdownMenuPopupProps) => {\n return (\n <Menu.Popup {...rest} className={mergeStateClassName(styles.popup, className as any) as any} />\n );\n};\n\nDropdownMenuPopup.displayName = 'DropdownMenuPopup';\n\nexport type DropdownMenuItemProps = React.ComponentProps<typeof Menu.Item> & { danger?: boolean };\n\nexport const DropdownMenuItem = ({ className, danger, ...rest }: DropdownMenuItemProps) => {\n return (\n <Menu.Item\n {...rest}\n className={(state) =>\n cx(\n styles.item,\n danger && styles.danger,\n typeof className === 'function' ? className(state) : className,\n )\n }\n />\n );\n};\n\nDropdownMenuItem.displayName = 'DropdownMenuItem';\n\nexport type DropdownMenuCheckboxItemProps = React.ComponentProps<typeof Menu.CheckboxItem> & {\n danger?: boolean;\n};\n\nexport const DropdownMenuCheckboxItemPrimitive = ({\n className,\n danger,\n ...rest\n}: DropdownMenuCheckboxItemProps) => {\n return (\n <Menu.CheckboxItem\n {...rest}\n className={(state) =>\n cx(\n styles.item,\n danger && styles.danger,\n typeof className === 'function' ? className(state) : className,\n )\n }\n />\n );\n};\n\nDropdownMenuCheckboxItemPrimitive.displayName = 'DropdownMenuCheckboxItemPrimitive';\n\nexport type DropdownMenuSeparatorProps = React.ComponentProps<typeof Menu.Separator>;\n\nexport const DropdownMenuSeparator = ({ className, ...rest }: DropdownMenuSeparatorProps) => {\n return (\n <Menu.Separator\n {...rest}\n className={(state) =>\n cx(styles.separator, typeof className === 'function' ? className(state) : className)\n }\n />\n );\n};\n\nDropdownMenuSeparator.displayName = 'DropdownMenuSeparator';\n\nexport const DropdownMenuGroup = Menu.Group;\n\nexport type DropdownMenuGroupLabelProps = React.ComponentProps<typeof Menu.GroupLabel>;\n\nexport const DropdownMenuGroupLabel = ({ className, ...rest }: DropdownMenuGroupLabelProps) => {\n return (\n <Menu.GroupLabel\n {...rest}\n className={(state) =>\n cx(styles.groupLabel, typeof className === 'function' ? className(state) : className)\n }\n />\n );\n};\n\nDropdownMenuGroupLabel.displayName = 'DropdownMenuGroupLabel';\n\nexport type DropdownMenuSubmenuTriggerProps = React.ComponentProps<typeof Menu.SubmenuTrigger> & {\n danger?: boolean;\n};\n\nexport const DropdownMenuSubmenuTrigger = ({\n className,\n danger,\n ...rest\n}: DropdownMenuSubmenuTriggerProps) => {\n return (\n <Menu.SubmenuTrigger\n {...rest}\n className={(state) =>\n cx(\n styles.item,\n danger && styles.danger,\n typeof className === 'function' ? className(state) : className,\n )\n }\n />\n );\n};\n\nDropdownMenuSubmenuTrigger.displayName = 'DropdownMenuSubmenuTrigger';\n\nexport type DropdownMenuItemContentProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const DropdownMenuItemContent = ({ className, ...rest }: DropdownMenuItemContentProps) => {\n return <div {...rest} className={cx(styles.itemContent, className)} />;\n};\n\nDropdownMenuItemContent.displayName = 'DropdownMenuItemContent';\n\nexport type DropdownMenuItemIconProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuItemIcon = ({ className, ...rest }: DropdownMenuItemIconProps) => {\n return <span {...rest} className={cx(styles.icon, className)} />;\n};\n\nDropdownMenuItemIcon.displayName = 'DropdownMenuItemIcon';\n\nexport type DropdownMenuItemLabelProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuItemLabel = ({ className, ...rest }: DropdownMenuItemLabelProps) => {\n return <span {...rest} className={cx(styles.label, className)} />;\n};\n\nDropdownMenuItemLabel.displayName = 'DropdownMenuItemLabel';\n\nexport type DropdownMenuItemExtraProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuItemExtra = ({ className, ...rest }: DropdownMenuItemExtraProps) => {\n return <span {...rest} className={cx(styles.extra, className)} />;\n};\n\nDropdownMenuItemExtra.displayName = 'DropdownMenuItemExtra';\n\nexport type DropdownMenuSubmenuArrowProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuSubmenuArrow = ({ className, ...rest }: DropdownMenuSubmenuArrowProps) => {\n return <span {...rest} className={cx(styles.submenuArrow, className)} />;\n};\n\nDropdownMenuSubmenuArrow.displayName = 'DropdownMenuSubmenuArrow';\n\nexport type DropdownMenuSwitchItemProps = Omit<\n React.ComponentProps<typeof Menu.Item>,\n 'onClick'\n> & {\n checked?: boolean;\n closeOnClick?: boolean;\n danger?: boolean;\n defaultChecked?: boolean;\n onCheckedChange?: (checked: boolean) => void;\n};\n\nexport const DropdownMenuSwitchItem = ({\n checked: checkedProp,\n className,\n closeOnClick = false,\n danger,\n defaultChecked,\n disabled,\n onCheckedChange,\n children,\n ...rest\n}: DropdownMenuSwitchItemProps) => {\n const [internalChecked, setInternalChecked] = useState(defaultChecked ?? false);\n const isControlled = checkedProp !== undefined;\n const checked = isControlled ? checkedProp : internalChecked;\n\n const handleCheckedChange = useCallback(\n (newChecked: boolean) => {\n if (!isControlled) {\n setInternalChecked(newChecked);\n }\n onCheckedChange?.(newChecked);\n },\n [isControlled, onCheckedChange],\n );\n\n return (\n <Menu.Item\n {...rest}\n className={(state) =>\n cx(\n styles.item,\n danger && styles.danger,\n typeof className === 'function' ? className(state) : className,\n )\n }\n closeOnClick={closeOnClick}\n disabled={disabled}\n onClick={(e) => {\n e.preventDefault();\n if (!disabled) {\n handleCheckedChange(!checked);\n }\n }}\n >\n {children}\n <Switch\n checked={checked}\n disabled={disabled}\n onChange={handleCheckedChange}\n onClick={(_, e) => e.stopPropagation()}\n size=\"small\"\n style={{ marginInlineStart: 16 }}\n />\n </Menu.Item>\n );\n};\n\nDropdownMenuSwitchItem.displayName = 'DropdownMenuSwitchItem';\n"],"mappings":";;;;;;;;;;;;;;;;;AAmBA,MAAa,+BAA+B;AAE5C,MAAa,mBAAmBA,OAAK;AACrC,MAAa,0BAA0BA,OAAK;AAC5C,MAAa,oCAAoCA,OAAK;AAEtD,MAAM,uBACJ,MACA,c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AU,MAAM;AACd,KAAE,gBAAgB;AAClB,OAAI,CAAC,SACH,qBAAoB,CAAC,QAAQ;;aAIhC,UACD,oBAAC;GACU;GACC;GACV,UAAU;GACV,UAAU,GAAG,MAAM,EAAE,iBAAiB;GACtC,MAAK;GACL,OAAO,EAAE,mBAAmB,IAAI;IAChC;GACQ;;AAIhB,uBAAuB,cAAc"}
1
+ {"version":3,"file":"atoms.mjs","names":["Menu"],"sources":["../../src/DropdownMenu/atoms.tsx"],"sourcesContent":["'use client';\n\nimport { Menu } from '@base-ui/react/menu';\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport { Switch } from 'antd';\nimport { cx } from 'antd-style';\nimport clsx from 'clsx';\nimport type React from 'react';\nimport { cloneElement, isValidElement, useCallback, useState } from 'react';\nimport { mergeRefs } from 'react-merge-refs';\n\nimport { styles } from '@/Menu/sharedStyle';\nimport { useNativeButton } from '@/hooks/useNativeButton';\nimport { usePortalContainer } from '@/hooks/usePortalContainer';\nimport { CLASSNAMES } from '@/styles/classNames';\nimport { placementMap } from '@/utils/placement';\n\nimport type { DropdownMenuPlacement } from './type';\n\nexport const DROPDOWN_MENU_CONTAINER_ATTR = 'data-lobe-ui-dropdown-menu-container';\n\nexport const DropdownMenuRoot = Menu.Root;\nexport const DropdownMenuSubmenuRoot = Menu.SubmenuRoot;\nexport const DropdownMenuCheckboxItemIndicator = Menu.CheckboxItemIndicator;\n\nconst mergeStateClassName = <TState,>(\n base: string,\n className: string | ((state: TState) => string | undefined) | undefined,\n) => {\n if (typeof className === 'function') return (state: TState) => cx(base, className(state));\n return cx(base, className);\n};\n\nexport type DropdownMenuTriggerProps = Omit<\n React.ComponentPropsWithRef<typeof Menu.Trigger>,\n 'children' | 'render'\n> & {\n children: React.ReactNode;\n};\n\nexport const DropdownMenuTrigger = ({\n children,\n className,\n nativeButton,\n ref: refProp,\n ...rest\n}: DropdownMenuTriggerProps) => {\n const { isNativeButtonTriggerElement, resolvedNativeButton } = useNativeButton({\n children,\n nativeButton,\n });\n\n const renderer = (props: any) => {\n // Base UI's trigger props include `type=\"button\"` by default.\n // If we render into a non-<button> element, that prop is invalid and can warn.\n const resolvedProps = (() => {\n if (isNativeButtonTriggerElement) return props as any;\n // eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars\n const { type, ...restProps } = props as any;\n return restProps;\n })();\n\n const mergedProps = mergeProps((children as any).props, resolvedProps);\n return cloneElement(children as any, {\n ...mergedProps,\n className: clsx(CLASSNAMES.DropdownMenuTrigger, className, mergedProps.className),\n ref: mergeRefs([(children as any).ref, (props as any).ref, refProp]),\n });\n };\n\n if (isValidElement(children)) {\n return <Menu.Trigger {...rest} nativeButton={resolvedNativeButton} render={renderer as any} />;\n }\n\n return (\n <Menu.Trigger\n {...rest}\n className={clsx(CLASSNAMES.DropdownMenuTrigger, className)}\n nativeButton={resolvedNativeButton}\n ref={refProp as any}\n >\n {children}\n </Menu.Trigger>\n );\n};\n\nDropdownMenuTrigger.displayName = 'DropdownMenuTrigger';\n\nexport type DropdownMenuPortalProps = React.ComponentProps<typeof Menu.Portal> & {\n /**\n * When `container` is not provided, it uses a shared container created by `usePortalContainer`.\n */\n container?: HTMLElement | null;\n};\n\nexport const DropdownMenuPortal = ({ container, ...rest }: DropdownMenuPortalProps) => {\n const defaultContainer = usePortalContainer(DROPDOWN_MENU_CONTAINER_ATTR);\n return <Menu.Portal container={container ?? defaultContainer} {...rest} />;\n};\n\nDropdownMenuPortal.displayName = 'DropdownMenuPortal';\n\nexport type DropdownMenuPositionerProps = React.ComponentProps<typeof Menu.Positioner> & {\n hoverTrigger?: boolean;\n placement?: DropdownMenuPlacement;\n};\n\nexport const DropdownMenuPositioner = ({\n className,\n placement,\n hoverTrigger,\n align,\n side,\n sideOffset,\n ...rest\n}: DropdownMenuPositionerProps) => {\n const placementConfig = placement ? placementMap[placement] : undefined;\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 side={side ?? placementConfig?.side}\n sideOffset={sideOffset ?? (placementConfig ? 6 : undefined)}\n />\n );\n};\n\nDropdownMenuPositioner.displayName = 'DropdownMenuPositioner';\n\nexport type DropdownMenuPopupProps = React.ComponentProps<typeof Menu.Popup>;\n\nexport const DropdownMenuPopup = ({ className, ...rest }: DropdownMenuPopupProps) => {\n return (\n <Menu.Popup {...rest} className={mergeStateClassName(styles.popup, className as any) as any} />\n );\n};\n\nDropdownMenuPopup.displayName = 'DropdownMenuPopup';\n\nexport type DropdownMenuItemProps = React.ComponentProps<typeof Menu.Item> & { danger?: boolean };\n\nexport const DropdownMenuItem = ({ className, danger, ...rest }: DropdownMenuItemProps) => {\n return (\n <Menu.Item\n {...rest}\n className={(state) =>\n cx(\n styles.item,\n danger && styles.danger,\n typeof className === 'function' ? className(state) : className,\n )\n }\n />\n );\n};\n\nDropdownMenuItem.displayName = 'DropdownMenuItem';\n\nexport type DropdownMenuCheckboxItemProps = React.ComponentProps<typeof Menu.CheckboxItem> & {\n danger?: boolean;\n};\n\nexport const DropdownMenuCheckboxItemPrimitive = ({\n className,\n danger,\n ...rest\n}: DropdownMenuCheckboxItemProps) => {\n return (\n <Menu.CheckboxItem\n {...rest}\n className={(state) =>\n cx(\n styles.item,\n danger && styles.danger,\n typeof className === 'function' ? className(state) : className,\n )\n }\n />\n );\n};\n\nDropdownMenuCheckboxItemPrimitive.displayName = 'DropdownMenuCheckboxItemPrimitive';\n\nexport type DropdownMenuSeparatorProps = React.ComponentProps<typeof Menu.Separator>;\n\nexport const DropdownMenuSeparator = ({ className, ...rest }: DropdownMenuSeparatorProps) => {\n return (\n <Menu.Separator\n {...rest}\n className={(state) =>\n cx(styles.separator, typeof className === 'function' ? className(state) : className)\n }\n />\n );\n};\n\nDropdownMenuSeparator.displayName = 'DropdownMenuSeparator';\n\nexport const DropdownMenuGroup = Menu.Group;\n\nexport type DropdownMenuGroupLabelProps = React.ComponentProps<typeof Menu.GroupLabel>;\n\nexport const DropdownMenuGroupLabel = ({ className, ...rest }: DropdownMenuGroupLabelProps) => {\n return (\n <Menu.GroupLabel\n {...rest}\n className={(state) =>\n cx(styles.groupLabel, typeof className === 'function' ? className(state) : className)\n }\n />\n );\n};\n\nDropdownMenuGroupLabel.displayName = 'DropdownMenuGroupLabel';\n\nexport type DropdownMenuSubmenuTriggerProps = React.ComponentProps<typeof Menu.SubmenuTrigger> & {\n danger?: boolean;\n};\n\nexport const DropdownMenuSubmenuTrigger = ({\n className,\n danger,\n ...rest\n}: DropdownMenuSubmenuTriggerProps) => {\n return (\n <Menu.SubmenuTrigger\n {...rest}\n className={(state) =>\n cx(\n styles.item,\n danger && styles.danger,\n typeof className === 'function' ? className(state) : className,\n )\n }\n />\n );\n};\n\nDropdownMenuSubmenuTrigger.displayName = 'DropdownMenuSubmenuTrigger';\n\nexport type DropdownMenuItemContentProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const DropdownMenuItemContent = ({ className, ...rest }: DropdownMenuItemContentProps) => {\n return <div {...rest} className={cx(styles.itemContent, className)} />;\n};\n\nDropdownMenuItemContent.displayName = 'DropdownMenuItemContent';\n\nexport type DropdownMenuItemIconProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuItemIcon = ({ className, ...rest }: DropdownMenuItemIconProps) => {\n return <span {...rest} className={cx(styles.icon, className)} />;\n};\n\nDropdownMenuItemIcon.displayName = 'DropdownMenuItemIcon';\n\nexport type DropdownMenuItemLabelProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuItemLabel = ({ className, ...rest }: DropdownMenuItemLabelProps) => {\n return <span {...rest} className={cx(styles.label, className)} />;\n};\n\nDropdownMenuItemLabel.displayName = 'DropdownMenuItemLabel';\n\nexport type DropdownMenuItemExtraProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuItemExtra = ({ className, ...rest }: DropdownMenuItemExtraProps) => {\n return <span {...rest} className={cx(styles.extra, className)} />;\n};\n\nDropdownMenuItemExtra.displayName = 'DropdownMenuItemExtra';\n\nexport type DropdownMenuSubmenuArrowProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuSubmenuArrow = ({ className, ...rest }: DropdownMenuSubmenuArrowProps) => {\n return <span {...rest} className={cx(styles.submenuArrow, className)} />;\n};\n\nDropdownMenuSubmenuArrow.displayName = 'DropdownMenuSubmenuArrow';\n\nexport type DropdownMenuSwitchItemProps = Omit<\n React.ComponentProps<typeof Menu.Item>,\n 'onClick'\n> & {\n checked?: boolean;\n closeOnClick?: boolean;\n danger?: boolean;\n defaultChecked?: boolean;\n onCheckedChange?: (checked: boolean) => void;\n};\n\nexport const DropdownMenuSwitchItem = ({\n checked: checkedProp,\n className,\n closeOnClick = false,\n danger,\n defaultChecked,\n disabled,\n onCheckedChange,\n children,\n ...rest\n}: DropdownMenuSwitchItemProps) => {\n const [internalChecked, setInternalChecked] = useState(defaultChecked ?? false);\n const isControlled = checkedProp !== undefined;\n const checked = isControlled ? checkedProp : internalChecked;\n\n const handleCheckedChange = useCallback(\n (newChecked: boolean) => {\n if (!isControlled) {\n setInternalChecked(newChecked);\n }\n onCheckedChange?.(newChecked);\n },\n [isControlled, onCheckedChange],\n );\n\n return (\n <Menu.Item\n {...rest}\n className={(state) =>\n cx(\n styles.item,\n danger && styles.danger,\n typeof className === 'function' ? className(state) : className,\n )\n }\n closeOnClick={closeOnClick}\n disabled={disabled}\n onClick={(e) => {\n e.preventDefault();\n if (!disabled) {\n handleCheckedChange(!checked);\n }\n }}\n >\n {children}\n <Switch\n checked={checked}\n disabled={disabled}\n onChange={handleCheckedChange}\n onClick={(_, e) => e.stopPropagation()}\n size=\"small\"\n style={{ marginInlineStart: 16 }}\n />\n </Menu.Item>\n );\n};\n\nDropdownMenuSwitchItem.displayName = 'DropdownMenuSwitchItem';\n"],"mappings":";;;;;;;;;;;;;;;;;AAmBA,MAAa,+BAA+B;AAE5C,MAAa,mBAA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