@lobehub/ui 4.30.1 → 4.31.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 (156) hide show
  1. package/es/ActionIcon/ActionIcon.d.mts +2 -2
  2. package/es/Alert/Alert.d.mts +2 -2
  3. package/es/AutoComplete/Select.d.mts +2 -2
  4. package/es/Avatar/AvatarGroup/index.d.mts +2 -2
  5. package/es/Burger/Burger.d.mts +2 -2
  6. package/es/CodeDiff/CodeDiff.d.mts +2 -2
  7. package/es/CodeDiff/PatchDiff.d.mts +2 -2
  8. package/es/CodeEditor/CodeEditor.d.mts +2 -2
  9. package/es/Collapse/Collapse.d.mts +2 -2
  10. package/es/ConfigProvider/index.d.mts +2 -2
  11. package/es/ContextMenu/ContextMenuHost.mjs +1 -1
  12. package/es/ContextMenu/ContextMenuHost.mjs.map +1 -1
  13. package/es/ContextMenu/index.d.mts +4 -2
  14. package/es/ContextMenu/renderItems.d.mts +4 -0
  15. package/es/ContextMenu/renderItems.mjs +21 -32
  16. package/es/ContextMenu/renderItems.mjs.map +1 -1
  17. package/es/ContextMenu/store.d.mts +7 -2
  18. package/es/ContextMenu/store.mjs +4 -1
  19. package/es/ContextMenu/store.mjs.map +1 -1
  20. package/es/CopyButton/CopyButton.d.mts +2 -2
  21. package/es/DatePicker/DatePicker.d.mts +2 -2
  22. package/es/DraggablePanel/components/DraggablePanelBody.d.mts +2 -2
  23. package/es/DraggablePanel/components/DraggablePanelContainer.d.mts +2 -2
  24. package/es/DraggablePanel/components/DraggablePanelFooter.d.mts +2 -2
  25. package/es/DraggablePanel/components/DraggablePanelHeader.d.mts +2 -2
  26. package/es/DraggableSideNav/DraggableSideNav.d.mts +2 -2
  27. package/es/Drawer/Drawer.d.mts +2 -2
  28. package/es/Dropdown/Dropdown.d.mts +2 -2
  29. package/es/DropdownMenu/DropdownMenu.d.mts +2 -2
  30. package/es/DropdownMenu/DropdownMenu.mjs +7 -3
  31. package/es/DropdownMenu/DropdownMenu.mjs.map +1 -1
  32. package/es/DropdownMenu/atoms.d.mts +16 -16
  33. package/es/DropdownMenu/index.d.mts +3 -2
  34. package/es/DropdownMenu/renderItems.d.mts +3 -3
  35. package/es/DropdownMenu/renderItems.mjs +20 -30
  36. package/es/DropdownMenu/renderItems.mjs.map +1 -1
  37. package/es/DropdownMenu/type.d.mts +9 -0
  38. package/es/EditableText/EditableText.d.mts +2 -2
  39. package/es/EditorSlashMenu/atoms.d.mts +12 -12
  40. package/es/EmojiPicker/EmojiPicker.d.mts +2 -2
  41. package/es/Flex/FlexBasic.d.mts +2 -2
  42. package/es/FontLoader/index.d.mts +2 -2
  43. package/es/Footer/Footer.d.mts +2 -2
  44. package/es/Form/components/FormGroup.d.mts +2 -2
  45. package/es/Form/components/FormItem.d.mts +2 -2
  46. package/es/Form/components/FormSubmitFooter.d.mts +2 -2
  47. package/es/FormModal/FormModal.d.mts +2 -2
  48. package/es/GuideCard/GuideCard.d.mts +2 -2
  49. package/es/Header/Header.d.mts +2 -2
  50. package/es/Highlighter/Highlighter.d.mts +2 -2
  51. package/es/Highlighter/SyntaxHighlighter/index.d.mts +2 -2
  52. package/es/Hotkey/Hotkey.d.mts +2 -2
  53. package/es/HotkeyInput/HotkeyInput.d.mts +2 -2
  54. package/es/Icon/Icon.d.mts +2 -2
  55. package/es/Icon/components/IconProvider.d.mts +3 -3
  56. package/es/Image/PreviewGroup.d.mts +2 -2
  57. package/es/ImageSelect/ImageSelect.d.mts +2 -2
  58. package/es/Input/Input.d.mts +2 -2
  59. package/es/Input/InputNumber.d.mts +2 -2
  60. package/es/Input/InputOPT.d.mts +2 -2
  61. package/es/Input/InputPassword.d.mts +2 -2
  62. package/es/Input/TextArea.d.mts +2 -2
  63. package/es/Layout/components/LayoutFooter.d.mts +2 -2
  64. package/es/Layout/components/LayoutHeader.d.mts +2 -2
  65. package/es/Layout/components/LayoutMain.d.mts +2 -2
  66. package/es/Layout/components/LayoutSidebar.d.mts +2 -2
  67. package/es/Layout/components/LayoutSidebarInner.d.mts +2 -2
  68. package/es/Layout/components/LayoutToc.d.mts +2 -2
  69. package/es/List/ListItem/index.d.mts +2 -2
  70. package/es/LobeSelect/LobeSelect.d.mts +2 -2
  71. package/es/LobeSelect/LobeSelect.mjs +1 -1
  72. package/es/LobeSelect/LobeSelect.mjs.map +1 -1
  73. package/es/LobeSelect/atoms.d.mts +19 -19
  74. package/es/LobeSwitch/LobeSwitch.d.mts +2 -2
  75. package/es/LobeSwitch/atoms.d.mts +4 -4
  76. package/es/Markdown/Markdown.d.mts +2 -2
  77. package/es/Markdown/Typography.d.mts +2 -2
  78. package/es/Markdown/components/SearchResultCards/index.d.mts +2 -2
  79. package/es/MaskShadow/MaskShadow.d.mts +2 -2
  80. package/es/Menu/Menu.d.mts +2 -2
  81. package/es/Menu/baseItem.d.mts +21 -3
  82. package/es/Menu/index.d.mts +3 -2
  83. package/es/Menu/index.mjs +2 -1
  84. package/es/Menu/renderUtils.d.mts +35 -0
  85. package/es/Menu/renderUtils.mjs +46 -0
  86. package/es/Menu/renderUtils.mjs.map +1 -0
  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/atoms.d.mts +9 -9
  95. package/es/Popover/context.d.mts +2 -2
  96. package/es/SearchBar/SearchBar.d.mts +2 -2
  97. package/es/Segmented/Segmented.d.mts +2 -2
  98. package/es/Select/Select.d.mts +2 -2
  99. package/es/SideNav/SideNav.d.mts +2 -2
  100. package/es/SliderWithInput/SliderWithInput.d.mts +2 -2
  101. package/es/SortableList/components/DragHandle.d.mts +2 -2
  102. package/es/SortableList/components/SortableItem.d.mts +2 -2
  103. package/es/ThemeProvider/ThemeProvider.d.mts +2 -2
  104. package/es/Toast/imperative.d.mts +3 -3
  105. package/es/Toc/Toc.d.mts +2 -2
  106. package/es/Video/index.d.mts +2 -2
  107. package/es/awesome/AuroraBackground/AuroraBackground.d.mts +2 -2
  108. package/es/awesome/BottomGradientButton/BottomGradientButton.d.mts +2 -2
  109. package/es/awesome/Features/Features.d.mts +2 -2
  110. package/es/awesome/Giscus/Giscus.d.mts +2 -2
  111. package/es/awesome/GradientButton/GradientButton.d.mts +2 -2
  112. package/es/awesome/GridBackground/GridBackground.d.mts +2 -2
  113. package/es/awesome/GridBackground/GridShowcase.d.mts +2 -2
  114. package/es/awesome/Hero/Hero.d.mts +2 -2
  115. package/es/awesome/Spline/Spine.d.mts +2 -2
  116. package/es/awesome/Spotlight/Spotlight.d.mts +2 -2
  117. package/es/awesome/SpotlightCard/SpotlightCard.d.mts +2 -2
  118. package/es/awesome/TypewriterEffect/TypewriterEffect.d.mts +2 -2
  119. package/es/brand/LobeChat/index.d.mts +2 -2
  120. package/es/brand/LobeHub/index.d.mts +2 -2
  121. package/es/brand/LogoThree/LogoSpline.d.mts +2 -2
  122. package/es/brand/LogoThree/index.d.mts +2 -2
  123. package/es/chat/BackBottom/BackBottom.d.mts +2 -2
  124. package/es/chat/ChatInputArea/components/ChatInputAreaInner.d.mts +2 -2
  125. package/es/chat/ChatItem/ChatItem.d.mts +2 -2
  126. package/es/chat/ChatList/ChatList.d.mts +2 -2
  127. package/es/chat/EditableMessage/EditableMessage.d.mts +2 -2
  128. package/es/chat/EditableMessageList/EditableMessageList.d.mts +2 -2
  129. package/es/chat/MessageInput/MessageInput.d.mts +2 -2
  130. package/es/chat/MessageModal/MessageModal.d.mts +2 -2
  131. package/es/color/ColorScales/index.d.mts +2 -2
  132. package/es/color/CssVar/index.d.mts +2 -2
  133. package/es/i18n/context.d.mts +2 -2
  134. package/es/icons/lucideExtra/BotPromptIcon.d.mts +2 -2
  135. package/es/icons/lucideExtra/CreateBotIcon.d.mts +2 -2
  136. package/es/icons/lucideExtra/DiscordIcon.d.mts +3 -3
  137. package/es/icons/lucideExtra/GlobeOffIcon.d.mts +2 -2
  138. package/es/icons/lucideExtra/GroupBotIcon.d.mts +3 -3
  139. package/es/icons/lucideExtra/GroupBotSquareIcon.d.mts +3 -3
  140. package/es/icons/lucideExtra/LeftClickIcon.d.mts +3 -3
  141. package/es/icons/lucideExtra/LeftDoubleClickIcon.d.mts +3 -3
  142. package/es/icons/lucideExtra/McpIcon.d.mts +3 -3
  143. package/es/icons/lucideExtra/ProviderIcon.d.mts +3 -3
  144. package/es/icons/lucideExtra/RightClickIcon.d.mts +3 -3
  145. package/es/icons/lucideExtra/RightDoubleClickIcon.d.mts +2 -2
  146. package/es/icons/lucideExtra/ShapesUploadIcon.d.mts +2 -2
  147. package/es/icons/lucideExtra/TreeDownRightIcon.d.mts +2 -2
  148. package/es/icons/lucideExtra/TreeUpDownRightIcon.d.mts +3 -3
  149. package/es/index.d.mts +1 -1
  150. package/es/index.mjs +1 -1
  151. package/es/mdx/Mdx/index.d.mts +2 -2
  152. package/es/mobile/ChatHeader/ChatHeaderTitle.d.mts +2 -2
  153. package/es/mobile/ChatInputArea/components/ChatSendButton.d.mts +2 -2
  154. package/es/mobile/TabBar/TabBar.d.mts +2 -2
  155. package/es/storybook/StoryBook/index.d.mts +2 -2
  156. package/package.json +1 -1
@@ -1,8 +1,8 @@
1
1
  import { ActionIconProps } from "./type.mjs";
2
- import * as react8 from "react";
2
+ import * as react27 from "react";
3
3
 
4
4
  //#region src/ActionIcon/ActionIcon.d.ts
5
- declare const ActionIcon: react8.NamedExoticComponent<ActionIconProps>;
5
+ declare const ActionIcon: react27.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 react22 from "react";
2
+ import * as react26 from "react";
3
3
 
4
4
  //#region src/Alert/Alert.d.ts
5
- declare const Alert: react22.NamedExoticComponent<AlertProps>;
5
+ declare const Alert: react26.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 react27 from "react";
2
+ import * as react87 from "react";
3
3
 
4
4
  //#region src/AutoComplete/Select.d.ts
5
- declare const AutoComplete: react27.NamedExoticComponent<AutoCompleteProps>;
5
+ declare const AutoComplete: react87.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 react20 from "react";
2
+ import * as react23 from "react";
3
3
 
4
4
  //#region src/Avatar/AvatarGroup/index.d.ts
5
- declare const AvatarGroup: react20.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 react6 from "react";
2
+ import * as react22 from "react";
3
3
 
4
4
  //#region src/Burger/Burger.d.ts
5
- declare const Burger: react6.NamedExoticComponent<BurgerProps>;
5
+ declare const Burger: react22.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 react18 from "react";
2
+ import * as react21 from "react";
3
3
 
4
4
  //#region src/CodeDiff/CodeDiff.d.ts
5
- declare const CodeDiff: react18.NamedExoticComponent<CodeDiffProps>;
5
+ declare const CodeDiff: react21.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 react19 from "react";
2
+ import * as react20 from "react";
3
3
 
4
4
  //#region src/CodeDiff/PatchDiff.d.ts
5
- declare const PatchDiff: react19.NamedExoticComponent<PatchDiffProps>;
5
+ declare const PatchDiff: react20.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 react17 from "react";
2
+ import * as react19 from "react";
3
3
 
4
4
  //#region src/CodeEditor/CodeEditor.d.ts
5
- declare const CodeEditor: react17.NamedExoticComponent<CodeEditorProps>;
5
+ declare const CodeEditor: react19.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 react21 from "react";
2
+ import * as react18 from "react";
3
3
 
4
4
  //#region src/Collapse/Collapse.d.ts
5
- declare const Collapse: react21.NamedExoticComponent<CollapseProps>;
5
+ declare const Collapse: react18.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 react80 from "react";
4
+ import * as react36 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: react80.NamedExoticComponent<ConfigProviderProps>;
22
+ declare const ConfigProvider: react36.NamedExoticComponent<ConfigProviderProps>;
23
23
  type CdnFn = ({
24
24
  pkg,
25
25
  version,
@@ -33,7 +33,7 @@ const ContextMenuHost = memo(() => {
33
33
  window.removeEventListener("contextmenu", handler, true);
34
34
  };
35
35
  }, []);
36
- const menuItems = useMemo(() => renderContextMenuItems(state.items), [state.items]);
36
+ const menuItems = useMemo(() => renderContextMenuItems(state.items, [], { iconSpaceMode: state.iconSpaceMode }), [state.items, state.iconSpaceMode]);
37
37
  const portalContainer = usePortalContainer(CONTEXT_MENU_CONTAINER_ATTR);
38
38
  if (!isClient) return null;
39
39
  if (!state.open && state.items.length === 0) return null;
@@ -1 +1 @@
1
- {"version":3,"file":"ContextMenuHost.mjs","names":[],"sources":["../../src/ContextMenu/ContextMenuHost.tsx"],"sourcesContent":["'use client';\n\nimport { ContextMenu } from '@base-ui/react/context-menu';\nimport { memo, useEffect, useMemo, useSyncExternalStore } from 'react';\n\nimport { LOBE_THEME_APP_ID } from '@/ThemeProvider';\nimport { useIsClient } from '@/hooks/useIsClient';\nimport { usePortalContainer } from '@/hooks/usePortalContainer';\nimport { registerDevSingleton } from '@/utils/devSingleton';\nimport { preventDefaultAndStopPropagation } from '@/utils/dom';\n\nimport { renderContextMenuItems } from './renderItems';\nimport {\n closeContextMenu,\n getServerSnapshot,\n getSnapshot,\n setContextMenuState,\n subscribe,\n updateLastPointer,\n} from './store';\nimport { styles } from './style';\n\nconst CONTEXT_MENU_CONTAINER_ATTR = 'data-lobe-ui-context-menu-container';\n\nexport const ContextMenuHost = memo(() => {\n const isClient = useIsClient();\n const state = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n\n useEffect(() => {\n const DEV = process.env.NODE_ENV === 'development';\n if (!isClient || !DEV) return;\n // Enforce singleton per portal container (dev-only).\n const themeApp = document.querySelector<HTMLElement>(`#${LOBE_THEME_APP_ID}`);\n const contextMenuContainer = document.querySelector<HTMLElement>(\n `[${CONTEXT_MENU_CONTAINER_ATTR}=\"true\"]`,\n );\n const scope = themeApp ?? contextMenuContainer ?? document.body;\n return registerDevSingleton('ContextMenuHost', scope);\n }, [isClient]);\n\n useEffect(() => {\n const handler = (event: MouseEvent | PointerEvent) => updateLastPointer(event);\n window.addEventListener('pointerdown', handler, true);\n window.addEventListener('contextmenu', handler, true);\n return () => {\n window.removeEventListener('pointerdown', handler, true);\n window.removeEventListener('contextmenu', handler, true);\n };\n }, []);\n\n const menuItems = useMemo(() => renderContextMenuItems(state.items), [state.items]);\n const portalContainer = usePortalContainer(CONTEXT_MENU_CONTAINER_ATTR);\n\n if (!isClient) return null;\n if (!state.open && state.items.length === 0) return null;\n if (!portalContainer) return null;\n\n return (\n <ContextMenu.Root\n onOpenChange={(open) => {\n if (open) {\n setContextMenuState({ open });\n return;\n }\n closeContextMenu();\n }}\n open={state.open}\n >\n <ContextMenu.Portal container={portalContainer}>\n <ContextMenu.Positioner\n anchor={state.anchor ?? undefined}\n className={styles.positioner}\n sideOffset={6}\n >\n <ContextMenu.Popup\n className={styles.popup}\n onContextMenu={preventDefaultAndStopPropagation}\n >\n {menuItems}\n </ContextMenu.Popup>\n </ContextMenu.Positioner>\n </ContextMenu.Portal>\n </ContextMenu.Root>\n );\n});\n\nContextMenuHost.displayName = 'ContextMenuHost';\n"],"mappings":";;;;;;;;;;;;;;;AAsBA,MAAM,8BAA8B;AAEpC,MAAa,kBAAkB,WAAW;CACxC,MAAM,WAAW,aAAa;CAC9B,MAAM,QAAQ,qBAAqB,WAAW,aAAa,kBAAkB;AAE7E,iBAAgB;EACd,MAAM,MAAM,QAAQ,IAAI,aAAa;AACrC,MAAI,CAAC,YAAY,CAAC,IAAK;EAEvB,MAAM,WAAW,SAAS,cAA2B,IAAI,oBAAoB;EAC7E,MAAM,uBAAuB,SAAS,cACpC,IAAI,4BAA4B,UACjC;AAED,SAAO,qBAAqB,mBADd,YAAY,wBAAwB,SAAS,KACN;IACpD,CAAC,SAAS,CAAC;AAEd,iBAAgB;EACd,MAAM,WAAW,UAAqC,kBAAkB,MAAM;AAC9E,SAAO,iBAAiB,eAAe,SAAS,KAAK;AACrD,SAAO,iBAAiB,eAAe,SAAS,KAAK;AACrD,eAAa;AACX,UAAO,oBAAoB,eAAe,SAAS,KAAK;AACxD,UAAO,oBAAoB,eAAe,SAAS,KAAK;;IAEzD,EAAE,CAAC;CAEN,MAAM,YAAY,cAAc,uBAAuB,MAAM,MAAM,EAAE,CAAC,MAAM,MAAM,CAAC;CACnF,MAAM,kBAAkB,mBAAmB,4BAA4B;AAEvE,KAAI,CAAC,SAAU,QAAO;AACtB,KAAI,CAAC,MAAM,QAAQ,MAAM,MAAM,WAAW,EAAG,QAAO;AACpD,KAAI,CAAC,gBAAiB,QAAO;AAE7B,QACE,oBAAC,YAAY;EACX,eAAe,SAAS;AACtB,OAAI,MAAM;AACR,wBAAoB,EAAE,MAAM,CAAC;AAC7B;;AAEF,qBAAkB;;EAEpB,MAAM,MAAM;YAEZ,oBAAC,YAAY;GAAO,WAAW;aAC7B,oBAAC,YAAY;IACX,QAAQ,MAAM,UAAU;IACxB,WAAW,OAAO;IAClB,YAAY;cAEZ,oBAAC,YAAY;KACX,WAAW,OAAO;KAClB,eAAe;eAEd;MACiB;KACG;IACN;GACJ;EAErB;AAEF,gBAAgB,cAAc"}
1
+ {"version":3,"file":"ContextMenuHost.mjs","names":[],"sources":["../../src/ContextMenu/ContextMenuHost.tsx"],"sourcesContent":["'use client';\n\nimport { ContextMenu } from '@base-ui/react/context-menu';\nimport { memo, useEffect, useMemo, useSyncExternalStore } from 'react';\n\nimport { LOBE_THEME_APP_ID } from '@/ThemeProvider';\nimport { useIsClient } from '@/hooks/useIsClient';\nimport { usePortalContainer } from '@/hooks/usePortalContainer';\nimport { registerDevSingleton } from '@/utils/devSingleton';\nimport { preventDefaultAndStopPropagation } from '@/utils/dom';\n\nimport { renderContextMenuItems } from './renderItems';\nimport {\n closeContextMenu,\n getServerSnapshot,\n getSnapshot,\n setContextMenuState,\n subscribe,\n updateLastPointer,\n} from './store';\nimport { styles } from './style';\n\nconst CONTEXT_MENU_CONTAINER_ATTR = 'data-lobe-ui-context-menu-container';\n\nexport const ContextMenuHost = memo(() => {\n const isClient = useIsClient();\n const state = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n\n useEffect(() => {\n const DEV = process.env.NODE_ENV === 'development';\n if (!isClient || !DEV) return;\n // Enforce singleton per portal container (dev-only).\n const themeApp = document.querySelector<HTMLElement>(`#${LOBE_THEME_APP_ID}`);\n const contextMenuContainer = document.querySelector<HTMLElement>(\n `[${CONTEXT_MENU_CONTAINER_ATTR}=\"true\"]`,\n );\n const scope = themeApp ?? contextMenuContainer ?? document.body;\n return registerDevSingleton('ContextMenuHost', scope);\n }, [isClient]);\n\n useEffect(() => {\n const handler = (event: MouseEvent | PointerEvent) => updateLastPointer(event);\n window.addEventListener('pointerdown', handler, true);\n window.addEventListener('contextmenu', handler, true);\n return () => {\n window.removeEventListener('pointerdown', handler, true);\n window.removeEventListener('contextmenu', handler, true);\n };\n }, []);\n\n const menuItems = useMemo(\n () => renderContextMenuItems(state.items, [], { iconSpaceMode: state.iconSpaceMode }),\n [state.items, state.iconSpaceMode],\n );\n const portalContainer = usePortalContainer(CONTEXT_MENU_CONTAINER_ATTR);\n\n if (!isClient) return null;\n if (!state.open && state.items.length === 0) return null;\n if (!portalContainer) return null;\n\n return (\n <ContextMenu.Root\n onOpenChange={(open) => {\n if (open) {\n setContextMenuState({ open });\n return;\n }\n closeContextMenu();\n }}\n open={state.open}\n >\n <ContextMenu.Portal container={portalContainer}>\n <ContextMenu.Positioner\n anchor={state.anchor ?? undefined}\n className={styles.positioner}\n sideOffset={6}\n >\n <ContextMenu.Popup\n className={styles.popup}\n onContextMenu={preventDefaultAndStopPropagation}\n >\n {menuItems}\n </ContextMenu.Popup>\n </ContextMenu.Positioner>\n </ContextMenu.Portal>\n </ContextMenu.Root>\n );\n});\n\nContextMenuHost.displayName = 'ContextMenuHost';\n"],"mappings":";;;;;;;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IACN;GACJ;EAErB;AAEF,gBAAgB,cAAc"}
@@ -1,6 +1,8 @@
1
+ import { IconSpaceMode } from "../Menu/renderUtils.mjs";
1
2
  import { ContextMenuCheckboxItem, ContextMenuItem, ContextMenuSwitchItem } from "./type.mjs";
2
3
  import { ContextMenuTrigger, ContextMenuTriggerProps } from "./ContextMenuTrigger.mjs";
3
4
  import { ContextMenuHost } from "./ContextMenuHost.mjs";
4
- import { closeContextMenu, showContextMenu, updateContextMenuItems } from "./store.mjs";
5
+ import "./renderItems.mjs";
6
+ import { ShowContextMenuOptions, closeContextMenu, showContextMenu, updateContextMenuItems } from "./store.mjs";
5
7
  import "./imperative.mjs";
6
- export { type ContextMenuCheckboxItem, ContextMenuHost, type ContextMenuItem, type ContextMenuSwitchItem, ContextMenuTrigger, type ContextMenuTriggerProps, closeContextMenu, showContextMenu, updateContextMenuItems };
8
+ export { type ContextMenuCheckboxItem, ContextMenuHost, type ContextMenuItem, type ContextMenuSwitchItem, ContextMenuTrigger, type ContextMenuTriggerProps, type IconSpaceMode, type ShowContextMenuOptions, closeContextMenu, showContextMenu, updateContextMenuItems };
@@ -0,0 +1,4 @@
1
+ import { IconSpaceMode } from "../Menu/renderUtils.mjs";
2
+ import "../Menu/index.mjs";
3
+ import "./type.mjs";
4
+ import { ReactNode } from "react";
@@ -1,9 +1,10 @@
1
1
  import Icon_default from "../Icon/Icon.mjs";
2
2
  import { preventDefaultAndStopPropagation } from "../utils/dom.mjs";
3
3
  import { styles } from "../Menu/sharedStyle.mjs";
4
+ import { getItemKey, getItemLabel, hasAnyIcon, hasCheckboxAndIcon, renderIcon } from "../Menu/renderUtils.mjs";
4
5
  import common_default from "../i18n/resources/en/common.mjs";
5
6
  import { useTranslation } from "../i18n/useTranslation.mjs";
6
- import { isValidElement, memo, useCallback, useState } from "react";
7
+ import { memo, useCallback, useState } from "react";
7
8
  import { jsx, jsxs } from "react/jsx-runtime";
8
9
  import { Switch } from "antd";
9
10
  import { cx } from "antd-style";
@@ -53,35 +54,11 @@ const ContextMenuSwitchItemInternal = ({ checked: checkedProp, children, closeOn
53
54
  })]
54
55
  });
55
56
  };
56
- const getItemKey = (item, fallback) => {
57
- if (item && "key" in item && item.key !== void 0) return item.key;
58
- return fallback;
59
- };
60
- const getItemLabel = (item) => {
61
- if (item.label !== void 0) return item.label;
62
- if ("title" in item && item.title !== void 0) return item.title;
63
- return item.key;
64
- };
65
- const renderIcon = (icon) => {
66
- if (!icon) return null;
67
- if (isValidElement(icon)) return icon;
68
- return /* @__PURE__ */ jsx(Icon_default, {
69
- icon,
70
- size: "small"
71
- });
72
- };
73
- const hasAnyIcon = (items) => {
74
- return items.some((item) => {
75
- if (!item) return false;
76
- if (item.type === "checkbox") return true;
77
- if ("icon" in item && item.icon) return true;
78
- return false;
79
- });
80
- };
81
57
  const renderItemContent = (item, options, iconNode) => {
82
58
  const label = getItemLabel(item);
83
59
  const extra = "extra" in item ? item.extra : void 0;
84
- const hasCustomIcon = iconNode !== void 0;
60
+ const indicatorOnRight = options?.indicatorOnRight;
61
+ const hasCustomIcon = iconNode !== void 0 && !indicatorOnRight;
85
62
  const hasIcon = hasCustomIcon ? Boolean(iconNode) : Boolean(item.icon);
86
63
  const shouldRenderIcon = hasCustomIcon ? Boolean(options?.reserveIconSpace || iconNode) : Boolean(hasIcon || options?.reserveIconSpace);
87
64
  return /* @__PURE__ */ jsxs("div", {
@@ -90,7 +67,7 @@ const renderItemContent = (item, options, iconNode) => {
90
67
  shouldRenderIcon ? /* @__PURE__ */ jsx("span", {
91
68
  "aria-hidden": !hasIcon,
92
69
  className: styles.icon,
93
- children: hasCustomIcon ? iconNode : hasIcon ? renderIcon(item.icon) : null
70
+ children: hasCustomIcon ? iconNode : hasIcon ? renderIcon(item.icon, "small") : null
94
71
  }) : null,
95
72
  /* @__PURE__ */ jsx("span", {
96
73
  className: styles.label,
@@ -100,6 +77,7 @@ const renderItemContent = (item, options, iconNode) => {
100
77
  className: styles.extra,
101
78
  children: extra
102
79
  }) : null,
80
+ indicatorOnRight && iconNode ? iconNode : null,
103
81
  options?.submenu ? /* @__PURE__ */ jsx("span", {
104
82
  className: styles.submenuArrow,
105
83
  children: /* @__PURE__ */ jsx(ChevronRight, { size: 16 })
@@ -119,7 +97,9 @@ const invokeItemClick = (item, keyPath, event) => {
119
97
  item.onClick(info);
120
98
  };
121
99
  const renderContextMenuItems = (items, keyPath = [], options) => {
122
- const reserveIconSpace = options?.reserveIconSpace ?? hasAnyIcon(items);
100
+ const iconSpaceMode = options?.iconSpaceMode ?? "global";
101
+ const reserveIconSpace = options?.reserveIconSpace ?? hasAnyIcon(items, iconSpaceMode === "global");
102
+ const indicatorOnRight = options?.indicatorOnRight ?? hasCheckboxAndIcon(items);
123
103
  return items.map((item, index) => {
124
104
  if (!item) return null;
125
105
  const itemKey = getItemKey(item, `${keyPath.join("-") || "root"}-${index}`);
@@ -141,7 +121,10 @@ const renderContextMenuItems = (items, keyPath = [], options) => {
141
121
  disabled: checkboxItem.disabled,
142
122
  label: labelText$1,
143
123
  onCheckedChange: (checked) => checkboxItem.onCheckedChange?.(checked),
144
- children: renderItemContent(checkboxItem, { reserveIconSpace }, indicator)
124
+ children: renderItemContent(checkboxItem, {
125
+ indicatorOnRight,
126
+ reserveIconSpace
127
+ }, indicator)
145
128
  }, itemKey);
146
129
  }
147
130
  if (item.type === "switch") {
@@ -163,10 +146,16 @@ const renderContextMenuItems = (items, keyPath = [], options) => {
163
146
  if (item.type === "divider") return /* @__PURE__ */ jsx(ContextMenu.Separator, { className: styles.separator }, itemKey);
164
147
  if (item.type === "group") {
165
148
  const group = item;
149
+ const groupReserveIconSpace = iconSpaceMode === "group" ? group.children ? hasAnyIcon(group.children) : false : reserveIconSpace;
150
+ const groupIndicatorOnRight = group.children ? hasCheckboxAndIcon(group.children) : false;
166
151
  return /* @__PURE__ */ jsxs(ContextMenu.Group, { children: [group.label ? /* @__PURE__ */ jsx(ContextMenu.GroupLabel, {
167
152
  className: styles.groupLabel,
168
153
  children: group.label
169
- }) : null, group.children ? renderContextMenuItems(group.children, nextKeyPath, { reserveIconSpace }) : null] }, itemKey);
154
+ }) : null, group.children ? renderContextMenuItems(group.children, nextKeyPath, {
155
+ iconSpaceMode,
156
+ indicatorOnRight: groupIndicatorOnRight,
157
+ reserveIconSpace: groupReserveIconSpace
158
+ }) : null] }, itemKey);
170
159
  }
171
160
  if (item.type === "submenu" || "children" in item && item.children) {
172
161
  const submenu = item;
@@ -188,7 +177,7 @@ const renderContextMenuItems = (items, keyPath = [], options) => {
188
177
  sideOffset: -1,
189
178
  children: /* @__PURE__ */ jsx(ContextMenu.Popup, {
190
179
  className: styles.popup,
191
- children: submenu.children && submenu.children.length > 0 ? renderContextMenuItems(submenu.children, nextKeyPath) : /* @__PURE__ */ jsx(EmptyMenuItem, {})
180
+ children: submenu.children && submenu.children.length > 0 ? renderContextMenuItems(submenu.children, nextKeyPath, { iconSpaceMode }) : /* @__PURE__ */ jsx(EmptyMenuItem, {})
192
181
  })
193
182
  }) })] }, itemKey);
194
183
  }
@@ -1 +1 @@
1
- {"version":3,"file":"renderItems.mjs","names":["common","Icon","info: MenuInfo","label","labelText","isDanger"],"sources":["../../src/ContextMenu/renderItems.tsx"],"sourcesContent":["import { ContextMenu } from '@base-ui/react/context-menu';\nimport { Switch } from 'antd';\nimport { cx } from 'antd-style';\nimport { Check, ChevronRight } from 'lucide-react';\nimport type { MenuInfo } from 'rc-menu/es/interface';\nimport type {\n Key,\n KeyboardEvent as ReactKeyboardEvent,\n MouseEvent as ReactMouseEvent,\n ReactNode,\n} from 'react';\nimport { isValidElement, memo, useCallback, useState } from 'react';\n\nimport Icon from '@/Icon';\nimport type { MenuDividerType, MenuItemGroupType, MenuItemType, SubMenuType } from '@/Menu';\nimport common from '@/i18n/resources/en/common';\nimport { useTranslation } from '@/i18n/useTranslation';\nimport { preventDefaultAndStopPropagation } from '@/utils/dom';\n\nimport { styles } from './style';\nimport type { ContextMenuCheckboxItem, ContextMenuItem, ContextMenuSwitchItem } from './type';\n\nconst EmptyMenuItem = memo(() => {\n const { t } = useTranslation(common);\n return (\n <ContextMenu.Item className={cx(styles.item, styles.empty)} disabled>\n <div className={styles.itemContent}>\n <span className={styles.label}>{t('common.empty')}</span>\n </div>\n </ContextMenu.Item>\n );\n});\n\nEmptyMenuItem.displayName = 'EmptyMenuItem';\n\ninterface ContextMenuSwitchItemInternalProps {\n checked?: boolean;\n children: ReactNode;\n closeOnClick?: boolean;\n danger?: boolean;\n defaultChecked?: boolean;\n disabled?: boolean;\n label?: string;\n onCheckedChange?: (checked: boolean) => void;\n}\n\nconst ContextMenuSwitchItemInternal = ({\n checked: checkedProp,\n children,\n closeOnClick = false,\n danger,\n defaultChecked,\n disabled,\n label,\n onCheckedChange,\n}: ContextMenuSwitchItemInternalProps) => {\n const [internalChecked, setInternalChecked] = useState(defaultChecked ?? false);\n const isControlled = checkedProp !== undefined;\n const checked = isControlled ? checkedProp : internalChecked;\n\n const handleCheckedChange = useCallback(\n (newChecked: boolean) => {\n if (!isControlled) {\n setInternalChecked(newChecked);\n }\n onCheckedChange?.(newChecked);\n },\n [isControlled, onCheckedChange],\n );\n\n return (\n <ContextMenu.Item\n className={cx(styles.item, danger && styles.danger)}\n closeOnClick={closeOnClick}\n disabled={disabled}\n label={label}\n onClick={(e) => {\n e.preventDefault();\n if (!disabled) {\n handleCheckedChange(!checked);\n }\n }}\n >\n {children}\n <Switch\n checked={checked}\n disabled={disabled}\n onChange={handleCheckedChange}\n onClick={(_, e) => e.stopPropagation()}\n size=\"small\"\n style={{ marginInlineStart: 16 }}\n />\n </ContextMenu.Item>\n );\n};\n\ntype KeyableItem = { key?: Key };\n\nconst getItemKey = (item: KeyableItem, fallback: string): Key => {\n if (item && 'key' in item && item.key !== undefined) return item.key;\n return fallback;\n};\n\ntype LabelableItem = {\n key?: Key;\n label?: ReactNode;\n title?: ReactNode;\n};\n\nconst getItemLabel = (\n item: MenuItemType | SubMenuType | ContextMenuCheckboxItem | LabelableItem,\n): ReactNode => {\n if (item.label !== undefined) return item.label;\n if ('title' in item && item.title !== undefined) return item.title;\n return item.key;\n};\n\nconst renderIcon = (icon: MenuItemType['icon']) => {\n if (!icon) return null;\n if (isValidElement(icon)) return icon;\n return <Icon icon={icon} size={'small'} />;\n};\n\nconst hasAnyIcon = (items: ContextMenuItem[]): boolean => {\n return items.some((item) => {\n if (!item) return false;\n if ((item as ContextMenuCheckboxItem).type === 'checkbox') return true;\n if ('icon' in item && item.icon) return true;\n return false;\n });\n};\n\nconst renderItemContent = (\n item: MenuItemType | SubMenuType | ContextMenuCheckboxItem | ContextMenuSwitchItem,\n options?: { reserveIconSpace?: boolean; submenu?: boolean },\n iconNode?: ReactNode,\n) => {\n const label = getItemLabel(item);\n const extra = 'extra' in item ? item.extra : undefined;\n const hasCustomIcon = iconNode !== undefined;\n const hasIcon = hasCustomIcon ? Boolean(iconNode) : Boolean(item.icon);\n const shouldRenderIcon = hasCustomIcon\n ? Boolean(options?.reserveIconSpace || iconNode)\n : Boolean(hasIcon || options?.reserveIconSpace);\n\n return (\n <div className={styles.itemContent}>\n {shouldRenderIcon ? (\n <span aria-hidden={!hasIcon} className={styles.icon}>\n {hasCustomIcon ? iconNode : hasIcon ? renderIcon(item.icon) : null}\n </span>\n ) : null}\n <span className={styles.label}>{label}</span>\n {extra ? <span className={styles.extra}>{extra}</span> : null}\n {options?.submenu ? (\n <span className={styles.submenuArrow}>\n <ChevronRight size={16} />\n </span>\n ) : null}\n </div>\n );\n};\n\nconst invokeItemClick = (\n item: MenuItemType,\n keyPath: string[],\n event: ReactMouseEvent<HTMLElement> | ReactKeyboardEvent<HTMLElement>,\n) => {\n if (!item.onClick) return;\n const key = item.key ?? keyPath.at(-1) ?? '';\n const info: MenuInfo = {\n domEvent: event,\n item: event.currentTarget as MenuInfo['item'],\n key: String(key),\n keyPath,\n };\n item.onClick(info);\n};\n\nexport const renderContextMenuItems = (\n items: ContextMenuItem[],\n keyPath: string[] = [],\n options?: { reserveIconSpace?: boolean },\n): ReactNode[] => {\n const reserveIconSpace = options?.reserveIconSpace ?? hasAnyIcon(items);\n\n return items.map((item, index) => {\n if (!item) return null;\n\n const fallbackKey = `${keyPath.join('-') || 'root'}-${index}`;\n const itemKey = getItemKey(item, fallbackKey);\n const nextKeyPath = [...keyPath, String(itemKey)];\n\n if ((item as ContextMenuCheckboxItem).type === 'checkbox') {\n const checkboxItem = item as ContextMenuCheckboxItem;\n const label = getItemLabel(checkboxItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = Boolean(checkboxItem.danger);\n const indicator = (\n <ContextMenu.CheckboxItemIndicator>\n <Icon icon={Check} size={'small'} />\n </ContextMenu.CheckboxItemIndicator>\n );\n\n return (\n <ContextMenu.CheckboxItem\n checked={checkboxItem.checked}\n className={cx(styles.item, isDanger && styles.danger)}\n closeOnClick={checkboxItem.closeOnClick}\n defaultChecked={checkboxItem.defaultChecked}\n disabled={checkboxItem.disabled}\n key={itemKey}\n label={labelText}\n onCheckedChange={(checked) => checkboxItem.onCheckedChange?.(checked)}\n >\n {renderItemContent(checkboxItem, { reserveIconSpace }, indicator)}\n </ContextMenu.CheckboxItem>\n );\n }\n\n if ((item as ContextMenuSwitchItem).type === 'switch') {\n const switchItem = item as ContextMenuSwitchItem;\n const label = getItemLabel(switchItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = Boolean(switchItem.danger);\n\n return (\n <ContextMenuSwitchItemInternal\n checked={switchItem.checked}\n closeOnClick={switchItem.closeOnClick}\n danger={isDanger}\n defaultChecked={switchItem.defaultChecked}\n disabled={switchItem.disabled}\n key={itemKey}\n label={labelText}\n onCheckedChange={switchItem.onCheckedChange}\n >\n {renderItemContent(switchItem, { reserveIconSpace })}\n </ContextMenuSwitchItemInternal>\n );\n }\n\n if ((item as MenuDividerType).type === 'divider') {\n return <ContextMenu.Separator className={styles.separator} key={itemKey} />;\n }\n\n if ((item as MenuItemGroupType).type === 'group') {\n const group = item as MenuItemGroupType;\n return (\n <ContextMenu.Group key={itemKey}>\n {group.label ? (\n <ContextMenu.GroupLabel className={styles.groupLabel}>\n {group.label}\n </ContextMenu.GroupLabel>\n ) : null}\n {group.children\n ? renderContextMenuItems(group.children, nextKeyPath, { reserveIconSpace })\n : null}\n </ContextMenu.Group>\n );\n }\n\n if (\n (item as SubMenuType).type === 'submenu' ||\n ('children' in item && (item as SubMenuType).children)\n ) {\n const submenu = item as SubMenuType;\n const label = getItemLabel(submenu);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = 'danger' in submenu && Boolean(submenu.danger);\n\n return (\n <ContextMenu.SubmenuRoot key={itemKey}>\n <ContextMenu.SubmenuTrigger\n className={cx(styles.item, isDanger && styles.danger)}\n disabled={submenu.disabled}\n label={labelText}\n >\n {renderItemContent(submenu, {\n reserveIconSpace,\n submenu: true,\n })}\n </ContextMenu.SubmenuTrigger>\n <ContextMenu.Portal>\n <ContextMenu.Positioner\n alignOffset={-4}\n className={styles.positioner}\n onContextMenu={preventDefaultAndStopPropagation}\n sideOffset={-1}\n >\n <ContextMenu.Popup className={styles.popup}>\n {submenu.children && submenu.children.length > 0 ? (\n renderContextMenuItems(submenu.children, nextKeyPath)\n ) : (\n <EmptyMenuItem />\n )}\n </ContextMenu.Popup>\n </ContextMenu.Positioner>\n </ContextMenu.Portal>\n </ContextMenu.SubmenuRoot>\n );\n }\n\n const menuItem = item as MenuItemType;\n const label = getItemLabel(menuItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = 'danger' in menuItem && Boolean(menuItem.danger);\n\n return (\n <ContextMenu.Item\n className={cx(styles.item, isDanger && styles.danger)}\n closeOnClick={menuItem.closeOnClick}\n disabled={menuItem.disabled}\n key={itemKey}\n label={labelText}\n onClick={(event) => invokeItemClick(menuItem, nextKeyPath, event)}\n >\n {renderItemContent(menuItem, { reserveIconSpace })}\n </ContextMenu.Item>\n );\n });\n};\n"],"mappings":";;;;;;;;;;;;;AAsBA,MAAM,gBAAgB,WAAW;CAC/B,MAAM,EAAE,M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vB,MACH,MAAM,WACH,uBAAuB,MAAM,UAAU,aAAa,EAAE,kBAAkB,CAAC,GACzE,SARkB,QASJ;;AAIxB,MACG,KAAqB,SAAS,aAC9B,cAAc,QAAS,KAAqB,UAC7C;GACA,MAAM,UAAU;GAChB,MAAMD,UAAQ,aAAa,QAAQ;GACnC,MAAMC,cAAY,OAAOD,YAAU,WAAWA,UAAQ;GACtD,MAAME,aAAW,YAAY,WAAW,QAAQ,QAAQ,OAAO;AAE/D,UACE,qBAAC,YAAY,0BACX,oBAAC,YAAY;IACX,WAAW,GAAG,OAAO,MAAMA,cAAY,OAAO,OAAO;IACrD,UAAU,QAAQ;IAClB,OAAOD;cAEN,kBAAkB,SAAS;KAC1B;KACA,SAAS;KACV,CAAC;KACyB,EAC7B,oBAAC,YAAY,oBACX,oBAAC,YAAY;IACX,aAAa;IACb,WAAW,OAAO;IAClB,eAAe;IACf,YAAY;cAEZ,oBAAC,YAAY;KAAM,WAAW,OAAO;eAClC,QAAQ,YAAY,QAAQ,SAAS,SAAS,IAC7C,uBAAuB,QAAQ,UAAU,YAAY,GAErD,oBAAC,kBAAgB;MAED;KACG,GACN,KA1BO,QA2BJ;;EAI9B,MAAM,WAAW;EACjB,MAAM,QAAQ,aAAa,SAAS;EACpC,MAAM,YAAY,OAAO,UAAU,WAAW,QAAQ;EACtD,MAAM,WAAW,YAAY,YAAY,QAAQ,SAAS,OAAO;AAEjE,SACE,oBAAC,YAAY;GACX,WAAW,GAAG,OAAO,MAAM,YAAY,OAAO,OAAO;GACrD,cAAc,SAAS;GACvB,UAAU,SAAS;GAEnB,OAAO;GACP,UAAU,UAAU,gBAAgB,UAAU,aAAa,MAAM;aAEhE,kBAAkB,UAAU,EAAE,kBAAkB,CAAC;KAJ7C,QAKY;GAErB"}
1
+ {"version":3,"file":"renderItems.mjs","names":["common","info: MenuInfo","label","labelText","isDanger","Icon"],"sources":["../../src/ContextMenu/renderItems.tsx"],"sourcesContent":["import { ContextMenu } from '@base-ui/react/context-menu';\nimport { Switch } from 'antd';\nimport { cx } from 'antd-style';\nimport { Check, ChevronRight } from 'lucide-react';\nimport type { MenuInfo } from 'rc-menu/es/interface';\nimport type {\n KeyboardEvent as ReactKeyboardEvent,\n MouseEvent as ReactMouseEvent,\n ReactNode,\n} from 'react';\nimport { memo, useCallback, useState } from 'react';\n\nimport Icon from '@/Icon';\nimport {\n type MenuDividerType,\n type MenuItemGroupType,\n type MenuItemType,\n type RenderItemContentOptions,\n type RenderOptions,\n type SubMenuType,\n getItemKey,\n getItemLabel,\n hasAnyIcon,\n hasCheckboxAndIcon,\n renderIcon,\n} from '@/Menu';\nimport common from '@/i18n/resources/en/common';\nimport { useTranslation } from '@/i18n/useTranslation';\nimport { preventDefaultAndStopPropagation } from '@/utils/dom';\n\nimport { styles } from './style';\nimport type { ContextMenuCheckboxItem, ContextMenuItem, ContextMenuSwitchItem } from './type';\n\nexport type { IconSpaceMode } from '@/Menu';\n\nconst EmptyMenuItem = memo(() => {\n const { t } = useTranslation(common);\n return (\n <ContextMenu.Item className={cx(styles.item, styles.empty)} disabled>\n <div className={styles.itemContent}>\n <span className={styles.label}>{t('common.empty')}</span>\n </div>\n </ContextMenu.Item>\n );\n});\n\nEmptyMenuItem.displayName = 'EmptyMenuItem';\n\ninterface ContextMenuSwitchItemInternalProps {\n checked?: boolean;\n children: ReactNode;\n closeOnClick?: boolean;\n danger?: boolean;\n defaultChecked?: boolean;\n disabled?: boolean;\n label?: string;\n onCheckedChange?: (checked: boolean) => void;\n}\n\nconst ContextMenuSwitchItemInternal = ({\n checked: checkedProp,\n children,\n closeOnClick = false,\n danger,\n defaultChecked,\n disabled,\n label,\n onCheckedChange,\n}: ContextMenuSwitchItemInternalProps) => {\n const [internalChecked, setInternalChecked] = useState(defaultChecked ?? false);\n const isControlled = checkedProp !== undefined;\n const checked = isControlled ? checkedProp : internalChecked;\n\n const handleCheckedChange = useCallback(\n (newChecked: boolean) => {\n if (!isControlled) {\n setInternalChecked(newChecked);\n }\n onCheckedChange?.(newChecked);\n },\n [isControlled, onCheckedChange],\n );\n\n return (\n <ContextMenu.Item\n className={cx(styles.item, danger && styles.danger)}\n closeOnClick={closeOnClick}\n disabled={disabled}\n label={label}\n onClick={(e) => {\n e.preventDefault();\n if (!disabled) {\n handleCheckedChange(!checked);\n }\n }}\n >\n {children}\n <Switch\n checked={checked}\n disabled={disabled}\n onChange={handleCheckedChange}\n onClick={(_, e) => e.stopPropagation()}\n size=\"small\"\n style={{ marginInlineStart: 16 }}\n />\n </ContextMenu.Item>\n );\n};\n\nconst renderItemContent = (\n item: MenuItemType | SubMenuType | ContextMenuCheckboxItem | ContextMenuSwitchItem,\n options?: RenderItemContentOptions,\n iconNode?: ReactNode,\n) => {\n const label = getItemLabel(item);\n const extra = 'extra' in item ? item.extra : undefined;\n const indicatorOnRight = options?.indicatorOnRight;\n const hasCustomIcon = iconNode !== undefined && !indicatorOnRight;\n const hasIcon = hasCustomIcon ? Boolean(iconNode) : Boolean(item.icon);\n const shouldRenderIcon = hasCustomIcon\n ? Boolean(options?.reserveIconSpace || iconNode)\n : Boolean(hasIcon || options?.reserveIconSpace);\n\n return (\n <div className={styles.itemContent}>\n {shouldRenderIcon ? (\n <span aria-hidden={!hasIcon} className={styles.icon}>\n {hasCustomIcon ? iconNode : hasIcon ? renderIcon(item.icon, 'small') : null}\n </span>\n ) : null}\n <span className={styles.label}>{label}</span>\n {extra ? <span className={styles.extra}>{extra}</span> : null}\n {indicatorOnRight && iconNode ? iconNode : null}\n {options?.submenu ? (\n <span className={styles.submenuArrow}>\n <ChevronRight size={16} />\n </span>\n ) : null}\n </div>\n );\n};\n\nconst invokeItemClick = (\n item: MenuItemType,\n keyPath: string[],\n event: ReactMouseEvent<HTMLElement> | ReactKeyboardEvent<HTMLElement>,\n) => {\n if (!item.onClick) return;\n const key = item.key ?? keyPath.at(-1) ?? '';\n const info: MenuInfo = {\n domEvent: event,\n item: event.currentTarget as MenuInfo['item'],\n key: String(key),\n keyPath,\n };\n item.onClick(info);\n};\n\nexport const renderContextMenuItems = (\n items: ContextMenuItem[],\n keyPath: string[] = [],\n options?: RenderOptions,\n): ReactNode[] => {\n const iconSpaceMode = options?.iconSpaceMode ?? 'global';\n const reserveIconSpace =\n options?.reserveIconSpace ?? hasAnyIcon(items, iconSpaceMode === 'global');\n const indicatorOnRight = options?.indicatorOnRight ?? hasCheckboxAndIcon(items);\n\n return items.map((item, index) => {\n if (!item) return null;\n\n const fallbackKey = `${keyPath.join('-') || 'root'}-${index}`;\n const itemKey = getItemKey(item, fallbackKey);\n const nextKeyPath = [...keyPath, String(itemKey)];\n\n if ((item as ContextMenuCheckboxItem).type === 'checkbox') {\n const checkboxItem = item as ContextMenuCheckboxItem;\n const label = getItemLabel(checkboxItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = Boolean(checkboxItem.danger);\n const indicator = (\n <ContextMenu.CheckboxItemIndicator>\n <Icon icon={Check} size={'small'} />\n </ContextMenu.CheckboxItemIndicator>\n );\n\n return (\n <ContextMenu.CheckboxItem\n checked={checkboxItem.checked}\n className={cx(styles.item, isDanger && styles.danger)}\n closeOnClick={checkboxItem.closeOnClick}\n defaultChecked={checkboxItem.defaultChecked}\n disabled={checkboxItem.disabled}\n key={itemKey}\n label={labelText}\n onCheckedChange={(checked) => checkboxItem.onCheckedChange?.(checked)}\n >\n {renderItemContent(checkboxItem, { indicatorOnRight, reserveIconSpace }, indicator)}\n </ContextMenu.CheckboxItem>\n );\n }\n\n if ((item as ContextMenuSwitchItem).type === 'switch') {\n const switchItem = item as ContextMenuSwitchItem;\n const label = getItemLabel(switchItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = Boolean(switchItem.danger);\n\n return (\n <ContextMenuSwitchItemInternal\n checked={switchItem.checked}\n closeOnClick={switchItem.closeOnClick}\n danger={isDanger}\n defaultChecked={switchItem.defaultChecked}\n disabled={switchItem.disabled}\n key={itemKey}\n label={labelText}\n onCheckedChange={switchItem.onCheckedChange}\n >\n {renderItemContent(switchItem, { reserveIconSpace })}\n </ContextMenuSwitchItemInternal>\n );\n }\n\n if ((item as MenuDividerType).type === 'divider') {\n return <ContextMenu.Separator className={styles.separator} key={itemKey} />;\n }\n\n if ((item as MenuItemGroupType).type === 'group') {\n const group = item as MenuItemGroupType;\n const groupReserveIconSpace =\n iconSpaceMode === 'group'\n ? group.children\n ? hasAnyIcon(group.children)\n : false\n : reserveIconSpace;\n const groupIndicatorOnRight = group.children ? hasCheckboxAndIcon(group.children) : false;\n return (\n <ContextMenu.Group key={itemKey}>\n {group.label ? (\n <ContextMenu.GroupLabel className={styles.groupLabel}>\n {group.label}\n </ContextMenu.GroupLabel>\n ) : null}\n {group.children\n ? renderContextMenuItems(group.children, nextKeyPath, {\n iconSpaceMode,\n indicatorOnRight: groupIndicatorOnRight,\n reserveIconSpace: groupReserveIconSpace,\n })\n : null}\n </ContextMenu.Group>\n );\n }\n\n if (\n (item as SubMenuType).type === 'submenu' ||\n ('children' in item && (item as SubMenuType).children)\n ) {\n const submenu = item as SubMenuType;\n const label = getItemLabel(submenu);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = 'danger' in submenu && Boolean(submenu.danger);\n\n return (\n <ContextMenu.SubmenuRoot key={itemKey}>\n <ContextMenu.SubmenuTrigger\n className={cx(styles.item, isDanger && styles.danger)}\n disabled={submenu.disabled}\n label={labelText}\n >\n {renderItemContent(submenu, {\n reserveIconSpace,\n submenu: true,\n })}\n </ContextMenu.SubmenuTrigger>\n <ContextMenu.Portal>\n <ContextMenu.Positioner\n alignOffset={-4}\n className={styles.positioner}\n onContextMenu={preventDefaultAndStopPropagation}\n sideOffset={-1}\n >\n <ContextMenu.Popup className={styles.popup}>\n {submenu.children && submenu.children.length > 0 ? (\n renderContextMenuItems(submenu.children, nextKeyPath, { iconSpaceMode })\n ) : (\n <EmptyMenuItem />\n )}\n </ContextMenu.Popup>\n </ContextMenu.Positioner>\n </ContextMenu.Portal>\n </ContextMenu.SubmenuRoot>\n );\n }\n\n const menuItem = item as MenuItemType;\n const label = getItemLabel(menuItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = 'danger' in menuItem && Boolean(menuItem.danger);\n\n return (\n <ContextMenu.Item\n className={cx(styles.item, isDanger && styles.danger)}\n closeOnClick={menuItem.closeOnClick}\n disabled={menuItem.disabled}\n key={itemKey}\n label={labelText}\n onClick={(event) => invokeItemClick(menuItem, nextKeyPath, event)}\n >\n {renderItemContent(menuItem, { reserveIconSpace })}\n </ContextMenu.Item>\n );\n });\n};\n"],"mappings":";;;;;;;;;;;;;;AAmCA,MAAM,gBAAgB,WAAW;CAC/B,MAAM,EAAE,MAAM,eAAeA,eAAO;AACpC,QACE,oBAAC,YAAY;EAAK,WAAW,GAAG,OAAO,MAAM,OAAO,MAAM;EAAE;YAC1D,oBAAC;GAAI,WAAW,OAAO;aACrB,oBAAC;IAAK,WAAW,OAAO;cAAQ,EAAE,eAAe;KAAQ;IACrD;GACW;EAErB;AAEF,cAAc,cAAc;AAa5B,MAAM,iCAAiC,EACrC,SAAS,aACT,UACA,eAAe,OACf,QACA,gBACA,UACA,OACA,sBACwC;CACxC,MAAM,CAAC,iBAAiB,sBAAsB,SAAS,kBAAkB,MAAM;CAC/E,MAAM,eAAe,gBAAgB;CACrC,MAAM,UAAU,eAAe,cAAc;CAE7C,MAAM,sBAAsB,aACzB,eAAwB;AACvB,MAAI,CAAC,aACH,oBAAmB,WAAW;AAEhC,oBAAkB,WAAW;IAE/B,CAAC,cAAc,gBAAgB,CAChC;AAED,QACE,qBAAC,YAAY;EACX,WAAW,GAAG,OAAO,MAAM,UAAU,OAAO,OAAO;EACrC;EACJ;EACH;EACP,UAAU,MAAM;AACd,KAAE,gBAAgB;AAClB,OAAI,CAAC,SACH,qBAAoB,CAAC,QAAQ;;aAIhC,UACD,oBAAC;GACU;GACC;GACV,UAAU;GACV,UAAU,GAAG,MAAM,EAAE,iBAAiB;GACtC,MAAK;GACL,OAAO,EAAE,mBAAmB,IAAI;IAChC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AAU,EAAE,kBAAkB,CAAC;KAJ7C,QAKY;GAErB"}
@@ -1,9 +1,14 @@
1
+ import { IconSpaceMode } from "../Menu/renderUtils.mjs";
1
2
  import { ContextMenuItem } from "./type.mjs";
3
+ import "./renderItems.mjs";
2
4
  import "@floating-ui/react";
3
5
 
4
6
  //#region src/ContextMenu/store.d.ts
5
7
 
6
- declare const showContextMenu: (items: ContextMenuItem[]) => void;
8
+ interface ShowContextMenuOptions {
9
+ iconSpaceMode?: IconSpaceMode;
10
+ }
11
+ declare const showContextMenu: (items: ContextMenuItem[], options?: ShowContextMenuOptions) => void;
7
12
  /**
8
13
  * Update menu items while keeping current anchor/position.
9
14
  * Useful for interactive menu items (e.g. checkbox) to avoid re-positioning.
@@ -11,5 +16,5 @@ declare const showContextMenu: (items: ContextMenuItem[]) => void;
11
16
  declare const updateContextMenuItems: (items: ContextMenuItem[]) => void;
12
17
  declare const closeContextMenu: () => void;
13
18
  //#endregion
14
- export { closeContextMenu, showContextMenu, updateContextMenuItems };
19
+ export { ShowContextMenuOptions, closeContextMenu, showContextMenu, updateContextMenuItems };
15
20
  //# sourceMappingURL=store.d.mts.map
@@ -1,6 +1,7 @@
1
1
  //#region src/ContextMenu/store.ts
2
2
  const emptyState = {
3
3
  anchor: null,
4
+ iconSpaceMode: "global",
4
5
  items: [],
5
6
  open: false,
6
7
  triggerId: null
@@ -50,7 +51,7 @@ const setContextMenuState = (next) => {
50
51
  };
51
52
  notify();
52
53
  };
53
- const showContextMenu = (items) => {
54
+ const showContextMenu = (items, options) => {
54
55
  if (typeof window === "undefined") return;
55
56
  const fallbackPoint = {
56
57
  x: window.innerWidth / 2,
@@ -61,6 +62,7 @@ const showContextMenu = (items) => {
61
62
  x: lastPointer.x,
62
63
  y: lastPointer.y
63
64
  } : fallbackPoint),
65
+ iconSpaceMode: options?.iconSpaceMode ?? "global",
64
66
  items,
65
67
  open: true,
66
68
  triggerId: lastPointer.triggerId ?? null
@@ -77,6 +79,7 @@ const updateContextMenuItems = (items) => {
77
79
  const closeContextMenu = () => {
78
80
  setContextMenuState({
79
81
  anchor: null,
82
+ iconSpaceMode: "global",
80
83
  items: [],
81
84
  open: false,
82
85
  triggerId: null
@@ -1 +1 @@
1
- {"version":3,"file":"store.mjs","names":["emptyState: ContextMenuState","contextMenuState: ContextMenuState"],"sources":["../../src/ContextMenu/store.ts"],"sourcesContent":["import type { VirtualElement } from '@floating-ui/react';\n\nimport type { ContextMenuItem } from './type';\n\nexport type ContextMenuState = {\n anchor: VirtualElement | null;\n items: ContextMenuItem[];\n open: boolean;\n triggerId: string | null;\n};\n\nconst emptyState: ContextMenuState = {\n anchor: null,\n items: [],\n open: false,\n triggerId: null,\n};\n\nlet contextMenuState: ContextMenuState = emptyState;\nconst listeners = new Set<() => void>();\nconst lastPointer = { ready: false, triggerId: null as string | null, x: 0, y: 0 };\n\nconst notify = () => {\n listeners.forEach((listener) => listener());\n};\n\nexport const subscribe = (listener: () => void) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n};\n\nexport const getSnapshot = () => contextMenuState;\nexport const getServerSnapshot = () => emptyState;\n\nexport const updateLastPointer = (event: MouseEvent | PointerEvent) => {\n lastPointer.x = event.clientX;\n lastPointer.y = event.clientY;\n lastPointer.ready = true;\n if (event.target instanceof Element) {\n const trigger = event.target.closest<HTMLElement>('[data-contextmenu-trigger]');\n lastPointer.triggerId = trigger?.dataset.contextmenuTrigger ?? null;\n } else {\n lastPointer.triggerId = null;\n }\n};\n\nconst createVirtualElement = (point: { x: number; y: number }): VirtualElement => ({\n contextElement: typeof document === 'undefined' ? undefined : document.body,\n getBoundingClientRect: () =>\n ({\n bottom: point.y,\n height: 0,\n left: point.x,\n right: point.x,\n toJSON: () => undefined,\n top: point.y,\n width: 0,\n x: point.x,\n y: point.y,\n }) as DOMRect,\n});\n\nexport const setContextMenuState = (next: Partial<ContextMenuState>) => {\n contextMenuState = { ...contextMenuState, ...next };\n notify();\n};\n\nexport const showContextMenu = (items: ContextMenuItem[]) => {\n if (typeof window === 'undefined') return;\n\n const fallbackPoint = { x: window.innerWidth / 2, y: window.innerHeight / 2 };\n const point = lastPointer.ready ? { x: lastPointer.x, y: lastPointer.y } : fallbackPoint;\n\n setContextMenuState({\n anchor: createVirtualElement(point),\n items,\n open: true,\n triggerId: lastPointer.triggerId ?? null,\n });\n};\n\n/**\n * Update menu items while keeping current anchor/position.\n * Useful for interactive menu items (e.g. checkbox) to avoid re-positioning.\n */\nexport const updateContextMenuItems = (items: ContextMenuItem[]) => {\n if (typeof window === 'undefined') return;\n setContextMenuState({ items });\n};\n\nexport const closeContextMenu = () => {\n setContextMenuState({ anchor: null, items: [], open: false, triggerId: null });\n};\n"],"mappings":";AAWA,MAAMA,aAA+B;CACnC,QAAQ;CACR,OAAO,EAAE;CACT,MAAM;CACN,WAAW;CACZ;AAED,IAAIC,mBAAqC;AACzC,MAAM,4BAAY,IAAI,KAAiB;AACvC,MAAM,cAAc;CAAE,OAAO;CAAO,WAAW;CAAuB,GAAG;CAAG,GAAG;CAAG;AAElF,MAAM,eAAe;AACnB,WAAU,SAAS,aAAa,UAAU,CAAC;;AAG7C,MAAa,aAAa,aAAyB;AACjD,WAAU,IAAI,SAAS;AACvB,cAAa,UAAU,OAAO,SAAS;;AAGzC,MAAa,oBAAoB;AACjC,MAAa,0BAA0B;AAEvC,MAAa,qBAAqB,UAAqC;AACrE,aAAY,IAAI,MAAM;AACtB,aAAY,IAAI,MAAM;AACtB,aAAY,QAAQ;AACpB,KAAI,MAAM,kBAAkB,QAE1B,aAAY,YADI,MAAM,OAAO,QAAqB,6BAA6B,EAC9C,QAAQ,sBAAsB;KAE/D,aAAY,YAAY;;AAI5B,MAAM,wBAAwB,WAAqD;CACjF,gBAAgB,OAAO,aAAa,cAAc,SAAY,SAAS;CACvE,8BACG;EACC,QAAQ,MAAM;EACd,QAAQ;EACR,MAAM,MAAM;EACZ,OAAO,MAAM;EACb,cAAc;EACd,KAAK,MAAM;EACX,OAAO;EACP,GAAG,MAAM;EACT,GAAG,MAAM;EACV;CACJ;AAED,MAAa,uBAAuB,SAAoC;AACtE,oBAAmB;EAAE,GAAG;EAAkB,GAAG;EAAM;AACnD,SAAQ;;AAGV,MAAa,mBAAmB,UAA6B;AAC3D,KAAI,OAAO,WAAW,YAAa;CAEnC,MAAM,gBAAgB;EAAE,GAAG,OAAO,aAAa;EAAG,GAAG,OAAO,cAAc;EAAG;AAG7E,qBAAoB;EAClB,QAAQ,qBAHI,YAAY,QAAQ;GAAE,GAAG,YAAY;GAAG,GAAG,YAAY;GAAG,GAAG,cAGtC;EACnC;EACA,MAAM;EACN,WAAW,YAAY,aAAa;EACrC,CAAC;;;;;;AAOJ,MAAa,0BAA0B,UAA6B;AAClE,KAAI,OAAO,WAAW,YAAa;AACnC,qBAAoB,EAAE,OAAO,CAAC;;AAGhC,MAAa,yBAAyB;AACpC,qBAAoB;EAAE,QAAQ;EAAM,OAAO,EAAE;EAAE,MAAM;EAAO,WAAW;EAAM,CAAC"}
1
+ {"version":3,"file":"store.mjs","names":["emptyState: ContextMenuState","contextMenuState: ContextMenuState"],"sources":["../../src/ContextMenu/store.ts"],"sourcesContent":["import type { VirtualElement } from '@floating-ui/react';\n\nimport type { IconSpaceMode } from './renderItems';\nimport type { ContextMenuItem } from './type';\n\nexport type ContextMenuState = {\n anchor: VirtualElement | null;\n iconSpaceMode: IconSpaceMode;\n items: ContextMenuItem[];\n open: boolean;\n triggerId: string | null;\n};\n\nconst emptyState: ContextMenuState = {\n anchor: null,\n iconSpaceMode: 'global',\n items: [],\n open: false,\n triggerId: null,\n};\n\nlet contextMenuState: ContextMenuState = emptyState;\nconst listeners = new Set<() => void>();\nconst lastPointer = { ready: false, triggerId: null as string | null, x: 0, y: 0 };\n\nconst notify = () => {\n listeners.forEach((listener) => listener());\n};\n\nexport const subscribe = (listener: () => void) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n};\n\nexport const getSnapshot = () => contextMenuState;\nexport const getServerSnapshot = () => emptyState;\n\nexport const updateLastPointer = (event: MouseEvent | PointerEvent) => {\n lastPointer.x = event.clientX;\n lastPointer.y = event.clientY;\n lastPointer.ready = true;\n if (event.target instanceof Element) {\n const trigger = event.target.closest<HTMLElement>('[data-contextmenu-trigger]');\n lastPointer.triggerId = trigger?.dataset.contextmenuTrigger ?? null;\n } else {\n lastPointer.triggerId = null;\n }\n};\n\nconst createVirtualElement = (point: { x: number; y: number }): VirtualElement => ({\n contextElement: typeof document === 'undefined' ? undefined : document.body,\n getBoundingClientRect: () =>\n ({\n bottom: point.y,\n height: 0,\n left: point.x,\n right: point.x,\n toJSON: () => undefined,\n top: point.y,\n width: 0,\n x: point.x,\n y: point.y,\n }) as DOMRect,\n});\n\nexport const setContextMenuState = (next: Partial<ContextMenuState>) => {\n contextMenuState = { ...contextMenuState, ...next };\n notify();\n};\n\nexport interface ShowContextMenuOptions {\n iconSpaceMode?: IconSpaceMode;\n}\n\nexport const showContextMenu = (items: ContextMenuItem[], options?: ShowContextMenuOptions) => {\n if (typeof window === 'undefined') return;\n\n const fallbackPoint = { x: window.innerWidth / 2, y: window.innerHeight / 2 };\n const point = lastPointer.ready ? { x: lastPointer.x, y: lastPointer.y } : fallbackPoint;\n\n setContextMenuState({\n anchor: createVirtualElement(point),\n iconSpaceMode: options?.iconSpaceMode ?? 'global',\n items,\n open: true,\n triggerId: lastPointer.triggerId ?? null,\n });\n};\n\n/**\n * Update menu items while keeping current anchor/position.\n * Useful for interactive menu items (e.g. checkbox) to avoid re-positioning.\n */\nexport const updateContextMenuItems = (items: ContextMenuItem[]) => {\n if (typeof window === 'undefined') return;\n setContextMenuState({ items });\n};\n\nexport const closeContextMenu = () => {\n setContextMenuState({\n anchor: null,\n iconSpaceMode: 'global',\n items: [],\n open: false,\n triggerId: null,\n });\n};\n"],"mappings":";AAaA,MAAMA,aAA+B;CACnC,QAAQ;CACR,eAAe;CACf,OAAO,EAAE;CACT,MAAM;CACN,WAAW;CACZ;AAED,IAAIC,mBAAqC;AACzC,MAAM,4B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,MAAa,yBAAyB;AACpC,qBAAoB;EAClB,QAAQ;EACR,eAAe;EACf,OAAO,EAAE;EACT,MAAM;EACN,WAAW;EACZ,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import { CopyButtonProps } from "./type.mjs";
2
- import * as react5 from "react";
2
+ import * as react76 from "react";
3
3
 
4
4
  //#region src/CopyButton/CopyButton.d.ts
5
- declare const CopyButton: react5.NamedExoticComponent<CopyButtonProps>;
5
+ declare const CopyButton: react76.NamedExoticComponent<CopyButtonProps>;
6
6
  //#endregion
7
7
  export { CopyButton };
8
8
  //# sourceMappingURL=CopyButton.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { DatePickerProps } from "./type.mjs";
2
- import * as react7 from "react";
2
+ import * as react74 from "react";
3
3
 
4
4
  //#region src/DatePicker/DatePicker.d.ts
5
- declare const DatePicker: react7.NamedExoticComponent<DatePickerProps>;
5
+ declare const DatePicker: react74.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 react3 from "react";
2
+ import * as react69 from "react";
3
3
 
4
4
  //#region src/DraggablePanel/components/DraggablePanelBody.d.ts
5
5
  type DraggablePanelBodyProps = DivProps;
6
- declare const DraggablePanelBody: react3.NamedExoticComponent<DivProps>;
6
+ declare const DraggablePanelBody: react69.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 react2 from "react";
2
+ import * as react70 from "react";
3
3
 
4
4
  //#region src/DraggablePanel/components/DraggablePanelContainer.d.ts
5
5
  type DraggablePanelContainerProps = DivProps;
6
- declare const DraggablePanelContainer: react2.NamedExoticComponent<DivProps>;
6
+ declare const DraggablePanelContainer: react70.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 react1 from "react";
2
+ import * as react71 from "react";
3
3
 
4
4
  //#region src/DraggablePanel/components/DraggablePanelFooter.d.ts
5
5
  type DraggablePanelFooterProps = DivProps;
6
- declare const DraggablePanelFooter: react1.NamedExoticComponent<DivProps>;
6
+ declare const DraggablePanelFooter: react71.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 react4 from "react";
2
+ import * as react72 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: react4.NamedExoticComponent<DraggablePanelHeaderProps>;
12
+ declare const DraggablePanelHeader: react72.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 react38 from "react";
2
+ import * as react73 from "react";
3
3
 
4
4
  //#region src/DraggableSideNav/DraggableSideNav.d.ts
5
- declare const DraggableSideNav: react38.NamedExoticComponent<DraggableSideNavProps>;
5
+ declare const DraggableSideNav: react73.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 react23 from "react";
2
+ import * as react68 from "react";
3
3
 
4
4
  //#region src/Drawer/Drawer.d.ts
5
- declare const Drawer: react23.NamedExoticComponent<DrawerProps>;
5
+ declare const Drawer: react68.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 react87 from "react";
2
+ import * as react65 from "react";
3
3
 
4
4
  //#region src/Dropdown/Dropdown.d.ts
5
5
 
@@ -9,7 +9,7 @@ import * as react87 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: react87.NamedExoticComponent<DropdownProps>;
12
+ declare const Dropdown: react65.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 react16 from "react";
2
+ import * as react67 from "react";
3
3
 
4
4
  //#region src/DropdownMenu/DropdownMenu.d.ts
5
- declare const DropdownMenu: react16.NamedExoticComponent<DropdownMenuProps<unknown>>;
5
+ declare const DropdownMenu: react67.NamedExoticComponent<DropdownMenuProps<unknown>>;
6
6
  //#endregion
7
7
  export { DropdownMenu };
8
8
  //# sourceMappingURL=DropdownMenu.d.mts.map
@@ -9,7 +9,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
9
9
  import { Menu } from "@base-ui/react/menu";
10
10
 
11
11
  //#region src/DropdownMenu/DropdownMenu.tsx
12
- const DropdownMenu = memo(({ children, defaultOpen, items, nativeButton, onOpenChange, onOpenChangeComplete, open, placement = "bottomLeft", popupProps, portalProps, positionerProps, trigger = "click", triggerProps, ...rest }) => {
12
+ const DropdownMenu = memo(({ children, defaultOpen, iconSpaceMode, items, nativeButton, onOpenChange, onOpenChangeComplete, open, placement = "bottomLeft", popupProps, portalProps, positionerProps, trigger = "click", triggerProps, ...rest }) => {
13
13
  const [uncontrolledOpen, setUncontrolledOpen] = useState(Boolean(defaultOpen));
14
14
  const { openOnHover } = useMemo(() => parseTrigger(trigger), [trigger]);
15
15
  useEffect(() => {
@@ -24,12 +24,16 @@ const DropdownMenu = memo(({ children, defaultOpen, items, nativeButton, onOpenC
24
24
  const isOpen = open ?? uncontrolledOpen;
25
25
  const menuItems = useMemo(() => {
26
26
  if (isOpen) {
27
- const renderedItems = renderDropdownMenuItems(typeof items === "function" ? items() : items);
27
+ const renderedItems = renderDropdownMenuItems(typeof items === "function" ? items() : items, [], { iconSpaceMode });
28
28
  menuItemsRef.current = renderedItems;
29
29
  return renderedItems;
30
30
  }
31
31
  return menuItemsRef.current;
32
- }, [isOpen, items]);
32
+ }, [
33
+ isOpen,
34
+ items,
35
+ iconSpaceMode
36
+ ]);
33
37
  const handleOpenChangeComplete = useCallback((nextOpen) => {
34
38
  onOpenChangeComplete?.(nextOpen);
35
39
  if (!nextOpen) menuItemsRef.current = null;