@lobehub/ui 4.6.2 → 4.6.3

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 (148) 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/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.d.mts +2 -2
  12. package/es/ContextMenu/ContextMenuHost.mjs +2 -1
  13. package/es/ContextMenu/ContextMenuHost.mjs.map +1 -1
  14. package/es/ContextMenu/ContextMenuTrigger.d.mts +21 -0
  15. package/es/ContextMenu/ContextMenuTrigger.mjs +40 -0
  16. package/es/ContextMenu/ContextMenuTrigger.mjs.map +1 -0
  17. package/es/ContextMenu/imperative.d.mts +1 -0
  18. package/es/ContextMenu/index.d.mts +2 -1
  19. package/es/ContextMenu/index.mjs +2 -1
  20. package/es/ContextMenu/renderItems.mjs +5 -2
  21. package/es/ContextMenu/renderItems.mjs.map +1 -1
  22. package/es/ContextMenu/store.mjs +9 -3
  23. package/es/ContextMenu/store.mjs.map +1 -1
  24. package/es/CopyButton/CopyButton.d.mts +2 -2
  25. package/es/DatePicker/DatePicker.d.mts +2 -2
  26. package/es/DraggablePanel/components/DraggablePanelBody.d.mts +2 -2
  27. package/es/DraggablePanel/components/DraggablePanelContainer.d.mts +2 -2
  28. package/es/DraggablePanel/components/DraggablePanelFooter.d.mts +2 -2
  29. package/es/DraggablePanel/components/DraggablePanelHeader.d.mts +2 -2
  30. package/es/DraggableSideNav/DraggableSideNav.d.mts +2 -2
  31. package/es/Drawer/Drawer.d.mts +2 -2
  32. package/es/Dropdown/Dropdown.d.mts +2 -2
  33. package/es/DropdownMenu/DropdownMenu.d.mts +8 -0
  34. package/es/DropdownMenu/DropdownMenu.mjs +101 -0
  35. package/es/DropdownMenu/DropdownMenu.mjs.map +1 -0
  36. package/es/DropdownMenu/index.d.mts +3 -0
  37. package/es/DropdownMenu/index.d.ts +1 -0
  38. package/es/DropdownMenu/index.js +1 -0
  39. package/es/DropdownMenu/index.mjs +3 -0
  40. package/es/DropdownMenu/renderItems.mjs +161 -0
  41. package/es/DropdownMenu/renderItems.mjs.map +1 -0
  42. package/es/DropdownMenu/type.d.mts +36 -0
  43. package/es/EditableText/EditableText.d.mts +2 -2
  44. package/es/EmojiPicker/EmojiPicker.d.mts +2 -2
  45. package/es/Flex/FlexBasic.d.mts +2 -2
  46. package/es/FontLoader/index.d.mts +2 -2
  47. package/es/Footer/Footer.d.mts +2 -2
  48. package/es/Form/components/FormGroup.d.mts +2 -2
  49. package/es/Form/components/FormItem.d.mts +2 -2
  50. package/es/Form/components/FormSubmitFooter.d.mts +2 -2
  51. package/es/FormModal/FormModal.d.mts +2 -2
  52. package/es/GuideCard/GuideCard.d.mts +2 -2
  53. package/es/Header/Header.d.mts +2 -2
  54. package/es/Highlighter/Highlighter.d.mts +2 -2
  55. package/es/Highlighter/SyntaxHighlighter/index.d.mts +2 -2
  56. package/es/Hotkey/Hotkey.d.mts +2 -2
  57. package/es/HotkeyInput/HotkeyInput.d.mts +2 -2
  58. package/es/Icon/Icon.d.mts +2 -2
  59. package/es/Icon/components/IconProvider.d.mts +3 -3
  60. package/es/Image/PreviewGroup.d.mts +2 -2
  61. package/es/ImageSelect/ImageSelect.d.mts +2 -2
  62. package/es/Input/Input.d.mts +2 -2
  63. package/es/Input/InputNumber.d.mts +2 -2
  64. package/es/Input/InputOPT.d.mts +2 -2
  65. package/es/Input/InputPassword.d.mts +2 -2
  66. package/es/Input/TextArea.d.mts +2 -2
  67. package/es/Layout/components/LayoutFooter.d.mts +2 -2
  68. package/es/Layout/components/LayoutHeader.d.mts +2 -2
  69. package/es/Layout/components/LayoutMain.d.mts +2 -2
  70. package/es/Layout/components/LayoutSidebar.d.mts +2 -2
  71. package/es/Layout/components/LayoutSidebarInner.d.mts +2 -2
  72. package/es/Layout/components/LayoutToc.d.mts +2 -2
  73. package/es/List/ListItem/index.d.mts +2 -2
  74. package/es/Markdown/Markdown.d.mts +2 -2
  75. package/es/Markdown/Typography.d.mts +2 -2
  76. package/es/Markdown/components/SearchResultCards/index.d.mts +2 -2
  77. package/es/MaskShadow/MaskShadow.d.mts +2 -2
  78. package/es/Menu/Menu.d.mts +2 -2
  79. package/es/{ContextMenu/style.mjs → Menu/sharedStyle.mjs} +7 -6
  80. package/es/Menu/sharedStyle.mjs.map +1 -0
  81. package/es/Mermaid/Mermaid.d.mts +2 -2
  82. package/es/Mermaid/SyntaxMermaid/index.d.mts +2 -2
  83. package/es/Modal/Modal.d.mts +2 -2
  84. package/es/Modal/ModalProvider.d.mts +2 -2
  85. package/es/MotionProvider/index.d.mts +2 -2
  86. package/es/SearchBar/SearchBar.d.mts +2 -2
  87. package/es/Segmented/Segmented.d.mts +2 -2
  88. package/es/Select/Select.d.mts +2 -2
  89. package/es/SideNav/SideNav.d.mts +2 -2
  90. package/es/SliderWithInput/SliderWithInput.d.mts +2 -2
  91. package/es/SortableList/components/DragHandle.d.mts +2 -2
  92. package/es/SortableList/components/SortableItem.d.mts +2 -2
  93. package/es/ThemeProvider/ThemeProvider.d.mts +2 -2
  94. package/es/Toc/Toc.d.mts +2 -2
  95. package/es/Video/index.d.mts +2 -2
  96. package/es/awesome/AuroraBackground/AuroraBackground.d.mts +2 -2
  97. package/es/awesome/BottomGradientButton/BottomGradientButton.d.mts +2 -2
  98. package/es/awesome/Features/Features.d.mts +2 -2
  99. package/es/awesome/Giscus/Giscus.d.mts +2 -2
  100. package/es/awesome/GradientButton/GradientButton.d.mts +2 -2
  101. package/es/awesome/GridBackground/GridBackground.d.mts +2 -2
  102. package/es/awesome/GridBackground/GridShowcase.d.mts +2 -2
  103. package/es/awesome/Hero/Hero.d.mts +2 -2
  104. package/es/awesome/Spline/Spine.d.mts +2 -2
  105. package/es/awesome/Spotlight/Spotlight.d.mts +2 -2
  106. package/es/awesome/SpotlightCard/SpotlightCard.d.mts +2 -2
  107. package/es/awesome/TypewriterEffect/TypewriterEffect.d.mts +2 -2
  108. package/es/brand/LobeChat/index.d.mts +2 -2
  109. package/es/brand/LobeHub/index.d.mts +2 -2
  110. package/es/brand/LogoThree/LogoSpline.d.mts +2 -2
  111. package/es/brand/LogoThree/index.d.mts +2 -2
  112. package/es/chat/BackBottom/BackBottom.d.mts +2 -2
  113. package/es/chat/ChatInputArea/components/ChatInputAreaInner.d.mts +2 -2
  114. package/es/chat/ChatItem/ChatItem.d.mts +2 -2
  115. package/es/chat/ChatList/ChatList.d.mts +2 -2
  116. package/es/chat/EditableMessage/EditableMessage.d.mts +2 -2
  117. package/es/chat/EditableMessageList/EditableMessageList.d.mts +2 -2
  118. package/es/chat/MessageInput/MessageInput.d.mts +2 -2
  119. package/es/chat/MessageModal/MessageModal.d.mts +2 -2
  120. package/es/color/ColorScales/index.d.mts +2 -2
  121. package/es/color/CssVar/index.d.mts +2 -2
  122. package/es/i18n/context.d.mts +2 -2
  123. package/es/icons/lucideExtra/BotPromptIcon.d.mts +2 -2
  124. package/es/icons/lucideExtra/CreateBotIcon.d.mts +2 -2
  125. package/es/icons/lucideExtra/DiscordIcon.d.mts +3 -3
  126. package/es/icons/lucideExtra/GlobeOffIcon.d.mts +2 -2
  127. package/es/icons/lucideExtra/GroupBotIcon.d.mts +3 -3
  128. package/es/icons/lucideExtra/GroupBotSquareIcon.d.mts +3 -3
  129. package/es/icons/lucideExtra/LeftClickIcon.d.mts +3 -3
  130. package/es/icons/lucideExtra/LeftDoubleClickIcon.d.mts +3 -3
  131. package/es/icons/lucideExtra/McpIcon.d.mts +3 -3
  132. package/es/icons/lucideExtra/ProviderIcon.d.mts +3 -3
  133. package/es/icons/lucideExtra/RightClickIcon.d.mts +3 -3
  134. package/es/icons/lucideExtra/RightDoubleClickIcon.d.mts +3 -3
  135. package/es/icons/lucideExtra/ShapesUploadIcon.d.mts +2 -2
  136. package/es/icons/lucideExtra/TreeDownRightIcon.d.mts +2 -2
  137. package/es/icons/lucideExtra/TreeUpDownRightIcon.d.mts +3 -3
  138. package/es/index.d.mts +5 -1
  139. package/es/index.mjs +3 -1
  140. package/es/mdx/Mdx/index.d.mts +2 -2
  141. package/es/mobile/ChatHeader/ChatHeaderTitle.d.mts +2 -2
  142. package/es/mobile/ChatInputArea/components/ChatSendButton.d.mts +2 -2
  143. package/es/mobile/TabBar/TabBar.d.mts +2 -2
  144. package/es/storybook/StoryBook/index.d.mts +2 -2
  145. package/es/utils/dom.mjs +1 -0
  146. package/es/utils/dom.mjs.map +1 -1
  147. package/package.json +1 -1
  148. package/es/ContextMenu/style.mjs.map +0 -1
@@ -1,8 +1,8 @@
1
1
  import { AccordionProps } from "./type.mjs";
2
- import * as react3 from "react";
2
+ import * as react50 from "react";
3
3
 
4
4
  //#region src/Accordion/Accordion.d.ts
5
- declare const Accordion: react3.NamedExoticComponent<AccordionProps>;
5
+ declare const Accordion: react50.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 react4 from "react";
2
+ import * as react51 from "react";
3
3
 
4
4
  //#region src/Accordion/AccordionItem.d.ts
5
- declare const AccordionItem: react4.NamedExoticComponent<AccordionItemProps>;
5
+ declare const AccordionItem: react51.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 react41 from "react";
2
+ import * as react48 from "react";
3
3
 
4
4
  //#region src/ActionIcon/ActionIcon.d.ts
5
- declare const ActionIcon: react41.NamedExoticComponent<ActionIconProps>;
5
+ declare const ActionIcon: react48.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 react6 from "react";
3
3
 
4
4
  //#region src/Alert/Alert.d.ts
5
- declare const Alert: react22.NamedExoticComponent<AlertProps>;
5
+ declare const Alert: react6.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 react67 from "react";
2
+ import * as react49 from "react";
3
3
 
4
4
  //#region src/AutoComplete/Select.d.ts
5
- declare const AutoComplete: react67.NamedExoticComponent<AutoCompleteProps>;
5
+ declare const AutoComplete: react49.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 react68 from "react";
2
+ import * as react39 from "react";
3
3
 
4
4
  //#region src/Avatar/AvatarGroup/index.d.ts
5
- declare const AvatarGroup: react68.NamedExoticComponent<AvatarGroupProps>;
5
+ declare const AvatarGroup: react39.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 react66 from "react";
2
+ import * as react0 from "react";
3
3
 
4
4
  //#region src/Burger/Burger.d.ts
5
- declare const Burger: react66.NamedExoticComponent<BurgerProps>;
5
+ declare const Burger: react0.NamedExoticComponent<BurgerProps>;
6
6
  //#endregion
7
7
  export { Burger };
8
8
  //# sourceMappingURL=Burger.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { CodeEditorProps } from "./type.mjs";
2
- import * as react65 from "react";
2
+ import * as react52 from "react";
3
3
 
4
4
  //#region src/CodeEditor/CodeEditor.d.ts
5
- declare const CodeEditor: react65.NamedExoticComponent<CodeEditorProps>;
5
+ declare const CodeEditor: react52.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 react6 from "react";
2
+ import * as react44 from "react";
3
3
 
4
4
  //#region src/Collapse/Collapse.d.ts
5
- declare const Collapse: react6.NamedExoticComponent<CollapseProps>;
5
+ declare const Collapse: react44.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 react8 from "react";
4
+ import * as react70 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: react8.NamedExoticComponent<ConfigProviderProps>;
22
+ declare const ConfigProvider: react70.NamedExoticComponent<ConfigProviderProps>;
23
23
  type CdnFn = ({
24
24
  pkg,
25
25
  version,
@@ -1,8 +1,8 @@
1
- import * as react72 from "react";
1
+ import * as react78 from "react";
2
2
  import * as react_jsx_runtime0 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/ContextMenu/ContextMenuHost.d.ts
5
- declare const ContextMenuHost: react72.MemoExoticComponent<() => react_jsx_runtime0.JSX.Element | null>;
5
+ declare const ContextMenuHost: react78.MemoExoticComponent<() => react_jsx_runtime0.JSX.Element | null>;
6
6
  //#endregion
7
7
  export { ContextMenuHost };
8
8
  //# sourceMappingURL=ContextMenuHost.d.mts.map
@@ -4,7 +4,7 @@ import { LOBE_THEME_APP_ID } from "../ThemeProvider/constants.mjs";
4
4
  import { TOOLTIP_CONTAINER_ATTR } from "../Tooltip/TooltipPortal.mjs";
5
5
  import { preventDefaultAndStopPropagation } from "../utils/dom.mjs";
6
6
  import { useIsClient } from "../hooks/useIsClient.mjs";
7
- import { styles } from "./style.mjs";
7
+ import { styles } from "../Menu/sharedStyle.mjs";
8
8
  import { renderContextMenuItems } from "./renderItems.mjs";
9
9
  import { closeContextMenu, getServerSnapshot, getSnapshot, setContextMenuState, subscribe, updateLastPointer } from "./store.mjs";
10
10
  import { memo, useEffect, useMemo, useSyncExternalStore } from "react";
@@ -49,6 +49,7 @@ const ContextMenuHost = memo(() => {
49
49
  container: portalContainer,
50
50
  children: /* @__PURE__ */ jsx(ContextMenu.Positioner, {
51
51
  anchor: state.anchor ?? void 0,
52
+ className: styles.positioner,
52
53
  sideOffset: 6,
53
54
  children: /* @__PURE__ */ jsx(ContextMenu.Popup, {
54
55
  className: styles.popup,
@@ -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 { TOOLTIP_CONTAINER_ATTR } from '@/Tooltip/TooltipPortal';\nimport { useIsClient } from '@/hooks/useIsClient';\nimport { preventDefaultAndStopPropagation } from '@/utils/dom';\n\nimport { renderContextMenuItems } from './renderItems';\nimport {\n closeContextMenu,\n getServerSnapshot,\n getSnapshot,\n setContextMenuState,\n subscribe,\n updateLastPointer,\n} from './store';\nimport { styles } from './style';\n\nexport const ContextMenuHost = memo(() => {\n const isClient = useIsClient();\n const state = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\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 = useMemo(() => {\n if (!isClient) return null;\n\n const themeApp = document.querySelector<HTMLElement>(`#${LOBE_THEME_APP_ID}`);\n if (themeApp) return themeApp;\n\n const tooltipContainer = document.querySelector<HTMLElement>(\n `[${TOOLTIP_CONTAINER_ATTR}=\"true\"]`,\n );\n if (tooltipContainer) return tooltipContainer;\n\n return document.body;\n }, [isClient]);\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 anchor={state.anchor ?? undefined} sideOffset={6}>\n <ContextMenu.Popup\n className={styles.popup}\n onContextMenu={preventDefaultAndStopPropagation}\n >\n {menuItems}\n </ContextMenu.Popup>\n </ContextMenu.Positioner>\n </ContextMenu.Portal>\n </ContextMenu.Root>\n );\n});\n\nContextMenuHost.displayName = 'ContextMenuHost';\n"],"mappings":";;;;;;;;;;;;;;AAqBA,MAAa,kBAAkB,WAAW;CACxC,MAAM,WAAW,aAAa;CAC9B,MAAM,QAAQ,qBAAqB,WAAW,aAAa,kBAAkB;AAE7E,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,cAAc;AACpC,MAAI,CAAC,SAAU,QAAO;EAEtB,MAAM,WAAW,SAAS,cAA2B,IAAI,oBAAoB;AAC7E,MAAI,SAAU,QAAO;EAErB,MAAM,mBAAmB,SAAS,cAChC,IAAI,uBAAuB,UAC5B;AACD,MAAI,iBAAkB,QAAO;AAE7B,SAAO,SAAS;IACf,CAAC,SAAS,CAAC;AAEd,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;IAAW,QAAQ,MAAM,UAAU;IAAW,YAAY;cACrE,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 { TOOLTIP_CONTAINER_ATTR } from '@/Tooltip/TooltipPortal';\nimport { useIsClient } from '@/hooks/useIsClient';\nimport { preventDefaultAndStopPropagation } from '@/utils/dom';\n\nimport { renderContextMenuItems } from './renderItems';\nimport {\n closeContextMenu,\n getServerSnapshot,\n getSnapshot,\n setContextMenuState,\n subscribe,\n updateLastPointer,\n} from './store';\nimport { styles } from './style';\n\nexport const ContextMenuHost = memo(() => {\n const isClient = useIsClient();\n const state = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\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 = useMemo(() => {\n if (!isClient) return null;\n\n const themeApp = document.querySelector<HTMLElement>(`#${LOBE_THEME_APP_ID}`);\n if (themeApp) return themeApp;\n\n const tooltipContainer = document.querySelector<HTMLElement>(\n `[${TOOLTIP_CONTAINER_ATTR}=\"true\"]`,\n );\n if (tooltipContainer) return tooltipContainer;\n\n return document.body;\n }, [isClient]);\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":";;;;;;;;;;;;;;AAqBA,MAAa,kBAAkB,WAAW;CACxC,MAAM,WAAW,aAAa;CAC9B,MAAM,QAAQ,qBAAqB,WAAW,aAAa,kBAAkB;AAE7E,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,cAAc;AACpC,MAAI,CAAC,SAAU,QAAO;EAEtB,MAAM,WAAW,SAAS,cAA2B,IAAI,oBAAoB;AAC7E,MAAI,SAAU,QAAO;EAErB,MAAM,mBAAmB,SAAS,cAChC,IAAI,uBAAuB,UAC5B;AACD,MAAI,iBAAkB,QAAO;AAE7B,SAAO,SAAS;IACf,CAAC,SAAS,CAAC;AAEd,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"}
@@ -0,0 +1,21 @@
1
+ import { GenericItemType } from "../Menu/type.mjs";
2
+ import "../Menu/index.mjs";
3
+ import React, { HTMLAttributes, MouseEvent, ReactNode } from "react";
4
+
5
+ //#region src/ContextMenu/ContextMenuTrigger.d.ts
6
+ type ContextMenuTriggerProps = {
7
+ children: ReactNode;
8
+ /**
9
+ * Menu items to display. Supports lazy rendering via function.
10
+ * When provided, context menu will be automatically shown on right-click.
11
+ */
12
+ items?: GenericItemType[] | (() => GenericItemType[]);
13
+ /**
14
+ * Custom context menu handler. If `items` is provided, this is optional.
15
+ */
16
+ onContextMenu?: (event: MouseEvent<HTMLElement>) => void;
17
+ } & Omit<HTMLAttributes<HTMLElement>, 'onContextMenu' | 'children'>;
18
+ declare const ContextMenuTrigger: React.NamedExoticComponent<ContextMenuTriggerProps>;
19
+ //#endregion
20
+ export { ContextMenuTrigger, ContextMenuTriggerProps };
21
+ //# sourceMappingURL=ContextMenuTrigger.d.mts.map
@@ -0,0 +1,40 @@
1
+ 'use client';
2
+
3
+ import { getServerSnapshot, getSnapshot, showContextMenu, subscribe } from "./store.mjs";
4
+ import React, { cloneElement, isValidElement, memo, useCallback, useId, useSyncExternalStore } from "react";
5
+ import { jsx } from "react/jsx-runtime";
6
+ import { mergeProps } from "@base-ui/react/merge-props";
7
+
8
+ //#region src/ContextMenu/ContextMenuTrigger.tsx
9
+ const styles = { trigger: { display: "contents" } };
10
+ const ContextMenuTrigger = memo(({ children, items, onContextMenu, ...rest }) => {
11
+ const triggerId = useId();
12
+ const state = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
13
+ const open = state.open && state.triggerId === triggerId;
14
+ const handleContextMenu = useCallback((event) => {
15
+ if (items) {
16
+ event.preventDefault();
17
+ showContextMenu(typeof items === "function" ? items() : items);
18
+ }
19
+ onContextMenu?.(event);
20
+ }, [items, onContextMenu]);
21
+ const triggerProps = {
22
+ ...rest,
23
+ "aria-expanded": open || void 0,
24
+ "data-contextmenu-trigger": triggerId,
25
+ "data-popup-open": open ? "" : void 0,
26
+ "data-state": open ? "open" : void 0,
27
+ "onContextMenu": handleContextMenu
28
+ };
29
+ if (isValidElement(children) && React.Children.only(children)) return cloneElement(children, mergeProps(children.props, triggerProps));
30
+ return /* @__PURE__ */ jsx("span", {
31
+ style: styles.trigger,
32
+ ...triggerProps,
33
+ children
34
+ });
35
+ });
36
+ ContextMenuTrigger.displayName = "ContextMenuTrigger";
37
+
38
+ //#endregion
39
+ export { ContextMenuTrigger };
40
+ //# sourceMappingURL=ContextMenuTrigger.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContextMenuTrigger.mjs","names":[],"sources":["../../src/ContextMenu/ContextMenuTrigger.tsx"],"sourcesContent":["'use client';\n\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport React, {\n type HTMLAttributes,\n type MouseEvent,\n type ReactNode,\n cloneElement,\n isValidElement,\n memo,\n useCallback,\n useId,\n useSyncExternalStore,\n} from 'react';\n\nimport type { GenericItemType } from '@/Menu';\n\nimport { getServerSnapshot, getSnapshot, showContextMenu, subscribe } from './store';\n\nexport type ContextMenuTriggerProps = {\n children: ReactNode;\n /**\n * Menu items to display. Supports lazy rendering via function.\n * When provided, context menu will be automatically shown on right-click.\n */\n items?: GenericItemType[] | (() => GenericItemType[]);\n /**\n * Custom context menu handler. If `items` is provided, this is optional.\n */\n onContextMenu?: (event: MouseEvent<HTMLElement>) => void;\n} & Omit<HTMLAttributes<HTMLElement>, 'onContextMenu' | 'children'>;\n\nconst styles = {\n trigger: {\n display: 'contents',\n },\n};\n\nexport const ContextMenuTrigger = memo<ContextMenuTriggerProps>(\n ({ children, items, onContextMenu, ...rest }) => {\n const triggerId = useId();\n const state = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n const open = state.open && state.triggerId === triggerId;\n\n const handleContextMenu = useCallback(\n (event: MouseEvent<HTMLElement>) => {\n if (items) {\n event.preventDefault();\n const resolvedItems = typeof items === 'function' ? items() : items;\n showContextMenu(resolvedItems);\n }\n onContextMenu?.(event);\n },\n [items, onContextMenu],\n );\n\n const triggerProps = {\n ...rest,\n 'aria-expanded': open || undefined,\n 'data-contextmenu-trigger': triggerId,\n 'data-popup-open': open ? '' : undefined,\n 'data-state': open ? 'open' : undefined,\n 'onContextMenu': handleContextMenu,\n };\n\n if (isValidElement(children) && React.Children.only(children)) {\n return cloneElement(children, mergeProps(children.props as any, triggerProps));\n }\n\n return (\n <span style={styles.trigger} {...triggerProps}>\n {children}\n </span>\n );\n },\n);\n\nContextMenuTrigger.displayName = 'ContextMenuTrigger';\n"],"mappings":";;;;;;;;AAgCA,MAAM,SAAS,EACb,SAAS,EACP,SAAS,YACV,EACF;AAED,MAAa,qBAAqB,MAC/B,EAAE,UAAU,OAAO,eAAe,GAAG,WAAW;CAC/C,MAAM,YAAY,OAAO;CACzB,MAAM,QAAQ,qBAAqB,WAAW,aAAa,kBAAkB;CAC7E,MAAM,OAAO,MAAM,QAAQ,MAAM,cAAc;CAE/C,MAAM,oBAAoB,aACvB,UAAmC;AAClC,MAAI,OAAO;AACT,SAAM,gBAAgB;AAEtB,mBADsB,OAAO,UAAU,aAAa,OAAO,GAAG,MAChC;;AAEhC,kBAAgB,MAAM;IAExB,CAAC,OAAO,cAAc,CACvB;CAED,MAAM,eAAe;EACnB,GAAG;EACH,iBAAiB,QAAQ;EACzB,4BAA4B;EAC5B,mBAAmB,OAAO,KAAK;EAC/B,cAAc,OAAO,SAAS;EAC9B,iBAAiB;EAClB;AAED,KAAI,eAAe,SAAS,IAAI,MAAM,SAAS,KAAK,SAAS,CAC3D,QAAO,aAAa,UAAU,WAAW,SAAS,OAAc,aAAa,CAAC;AAGhF,QACE,oBAAC;EAAK,OAAO,OAAO;EAAS,GAAI;EAC9B;GACI;EAGZ;AAED,mBAAmB,cAAc"}
@@ -1,2 +1,3 @@
1
+ import { ContextMenuTrigger } from "./ContextMenuTrigger.mjs";
1
2
  import { ContextMenuHost } from "./ContextMenuHost.mjs";
2
3
  import { showContextMenu } from "./store.mjs";
@@ -1,4 +1,5 @@
1
+ import { ContextMenuTrigger, ContextMenuTriggerProps } from "./ContextMenuTrigger.mjs";
1
2
  import { ContextMenuHost } from "./ContextMenuHost.mjs";
2
3
  import { showContextMenu } from "./store.mjs";
3
4
  import "./imperative.mjs";
4
- export { ContextMenuHost, showContextMenu };
5
+ export { ContextMenuHost, ContextMenuTrigger, type ContextMenuTriggerProps, showContextMenu };
@@ -1,4 +1,5 @@
1
1
  import { showContextMenu } from "./store.mjs";
2
2
  import { ContextMenuHost } from "./ContextMenuHost.mjs";
3
+ import { ContextMenuTrigger } from "./ContextMenuTrigger.mjs";
3
4
 
4
- export { ContextMenuHost, showContextMenu };
5
+ export { ContextMenuHost, ContextMenuTrigger, showContextMenu };
@@ -1,5 +1,6 @@
1
1
  import Icon_default from "../Icon/Icon.mjs";
2
- import { styles } from "./style.mjs";
2
+ import { preventDefaultAndStopPropagation } from "../utils/dom.mjs";
3
+ import { styles } from "../Menu/sharedStyle.mjs";
3
4
  import { isValidElement } from "react";
4
5
  import { jsx, jsxs } from "react/jsx-runtime";
5
6
  import { cx } from "antd-style";
@@ -115,7 +116,9 @@ const renderContextMenuItems = (items, keyPath = [], options) => {
115
116
  })
116
117
  }), /* @__PURE__ */ jsx(ContextMenu.Portal, { children: /* @__PURE__ */ jsx(ContextMenu.Positioner, {
117
118
  alignOffset: -4,
118
- sideOffset: 6,
119
+ className: styles.positioner,
120
+ onContextMenu: preventDefaultAndStopPropagation,
121
+ sideOffset: -1,
119
122
  children: /* @__PURE__ */ jsx(ContextMenu.Popup, {
120
123
  className: styles.popup,
121
124
  children: submenu.children ? renderContextMenuItems(submenu.children, nextKeyPath) : null
@@ -1 +1 @@
1
- {"version":3,"file":"renderItems.mjs","names":["Icon","segmentIndices: number[]","info: MenuInfo","label","labelText","isDanger"],"sources":["../../src/ContextMenu/renderItems.tsx"],"sourcesContent":["import { ContextMenu } from '@base-ui/react/context-menu';\nimport { cx } from 'antd-style';\nimport { 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 } from 'react';\n\nimport Icon from '@/Icon';\nimport type {\n GenericItemType,\n ItemType,\n MenuDividerType,\n MenuItemGroupType,\n MenuItemType,\n SubMenuType,\n} from '@/Menu';\n\nimport { styles } from './style';\n\nconst getItemKey = (item: ItemType, fallback: string): Key => {\n if (item && 'key' in item && item.key !== undefined) return item.key;\n return fallback;\n};\n\nconst getItemLabel = (item: MenuItemType | SubMenuType): 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 getReserveIconSpaceMap = (items: GenericItemType[]) => {\n const flags = Array.from({ length: items.length }).fill(false);\n let segmentIndices: number[] = [];\n let segmentHasIcon = false;\n\n const flush = () => {\n if (segmentHasIcon) {\n for (const index of segmentIndices) flags[index] = true;\n }\n segmentIndices = [];\n segmentHasIcon = false;\n };\n\n items.forEach((item, index) => {\n if (!item) return;\n if (\n (item as MenuDividerType).type === 'divider' ||\n (item as MenuItemGroupType).type === 'group'\n ) {\n flush();\n return;\n }\n\n segmentIndices.push(index);\n if ('icon' in item && item.icon) segmentHasIcon = true;\n });\n\n flush();\n return flags;\n};\n\nconst renderItemContent = (\n item: MenuItemType | SubMenuType,\n options?: { reserveIconSpace?: boolean; submenu?: boolean },\n) => {\n const label = getItemLabel(item);\n const extra = 'extra' in item ? item.extra : undefined;\n const hasIcon = Boolean(item.icon);\n const shouldRenderIcon = hasIcon || options?.reserveIconSpace;\n\n return (\n <div className={styles.itemContent}>\n {shouldRenderIcon ? (\n <span aria-hidden={!hasIcon} className={styles.icon}>\n {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: GenericItemType[],\n keyPath: string[] = [],\n options?: { reserveIconSpace?: boolean },\n): ReactNode[] => {\n const reserveIconSpaceMap =\n options?.reserveIconSpace === undefined ? getReserveIconSpaceMap(items) : null;\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 const reserveIconSpace = options?.reserveIconSpace ?? Boolean(reserveIconSpaceMap?.[index]);\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 = Boolean(\n group.children?.some((child) => Boolean(child && 'icon' in child && child.icon)),\n );\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 reserveIconSpace: groupReserveIconSpace,\n })\n : null}\n </ContextMenu.Group>\n );\n }\n\n if ((item as SubMenuType).type === 'submenu' || 'children' in item) {\n const submenu = item as SubMenuType;\n const label = getItemLabel(submenu);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = 'danger' in submenu && Boolean(submenu.danger);\n\n return (\n <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 alignOffset={-4} sideOffset={6}>\n <ContextMenu.Popup className={styles.popup}>\n {submenu.children ? renderContextMenuItems(submenu.children, nextKeyPath) : null}\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 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":";;;;;;;;;AAwBA,MAAM,cAAc,MAAgB,aAA0B;AAC5D,KAAI,QAAQ,SAAS,QAAQ,KAAK,QAAQ,OAAW,QAAO,KAAK;AACjE,QAAO;;AAGT,MAAM,gBAAgB,SAAgD;AACpE,KAAI,KAAK,UAAU,OAAW,QAAO,KAAK;AAC1C,KAAI,WAAW,QAAQ,KAAK,UAAU,OAAW,QAAO,KAAK;AAC7D,QAAO,KAAK;;AAGd,MAAM,cAAc,SAA+B;AACjD,KAAI,CAAC,KAAM,QAAO;AAClB,KAAI,eAAe,KAAK,CAAE,QAAO;AACjC,QAAO,oBAACA;EAAW;EAAM,MAAM;GAAW;;AAG5C,MAAM,0BAA0B,UAA6B;CAC3D,MAAM,QAAQ,MAAM,KAAK,EAAE,QAAQ,MAAM,QAAQ,CAAC,CAAC,KAAK,MAAM;CAC9D,IAAIC,iBAA2B,EAAE;CACjC,IAAI,iBAAiB;CAErB,MAAM,cAAc;AAClB,MAAI,eACF,MAAK,MAAM,SAAS,eAAgB,OAAM,SAAS;AAErD,mBAAiB,EAAE;AACnB,mBAAiB;;AAGnB,OAAM,SAAS,MAAM,UAAU;AAC7B,MAAI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MAAM,YAAY,OAAO,OAAO;GACrD,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":["Icon","segmentIndices: number[]","info: MenuInfo","label","labelText","isDanger"],"sources":["../../src/ContextMenu/renderItems.tsx"],"sourcesContent":["import { ContextMenu } from '@base-ui/react/context-menu';\nimport { cx } from 'antd-style';\nimport { 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 } from 'react';\n\nimport Icon from '@/Icon';\nimport type {\n GenericItemType,\n ItemType,\n MenuDividerType,\n MenuItemGroupType,\n MenuItemType,\n SubMenuType,\n} from '@/Menu';\nimport { preventDefaultAndStopPropagation } from '@/utils/dom';\n\nimport { styles } from './style';\n\nconst getItemKey = (item: ItemType, fallback: string): Key => {\n if (item && 'key' in item && item.key !== undefined) return item.key;\n return fallback;\n};\n\nconst getItemLabel = (item: MenuItemType | SubMenuType): 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 getReserveIconSpaceMap = (items: GenericItemType[]) => {\n const flags = Array.from({ length: items.length }).fill(false);\n let segmentIndices: number[] = [];\n let segmentHasIcon = false;\n\n const flush = () => {\n if (segmentHasIcon) {\n for (const index of segmentIndices) flags[index] = true;\n }\n segmentIndices = [];\n segmentHasIcon = false;\n };\n\n items.forEach((item, index) => {\n if (!item) return;\n if (\n (item as MenuDividerType).type === 'divider' ||\n (item as MenuItemGroupType).type === 'group'\n ) {\n flush();\n return;\n }\n\n segmentIndices.push(index);\n if ('icon' in item && item.icon) segmentHasIcon = true;\n });\n\n flush();\n return flags;\n};\n\nconst renderItemContent = (\n item: MenuItemType | SubMenuType,\n options?: { reserveIconSpace?: boolean; submenu?: boolean },\n) => {\n const label = getItemLabel(item);\n const extra = 'extra' in item ? item.extra : undefined;\n const hasIcon = Boolean(item.icon);\n const shouldRenderIcon = hasIcon || options?.reserveIconSpace;\n\n return (\n <div className={styles.itemContent}>\n {shouldRenderIcon ? (\n <span aria-hidden={!hasIcon} className={styles.icon}>\n {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: GenericItemType[],\n keyPath: string[] = [],\n options?: { reserveIconSpace?: boolean },\n): ReactNode[] => {\n const reserveIconSpaceMap =\n options?.reserveIconSpace === undefined ? getReserveIconSpaceMap(items) : null;\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 const reserveIconSpace = options?.reserveIconSpace ?? Boolean(reserveIconSpaceMap?.[index]);\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 = Boolean(\n group.children?.some((child) => Boolean(child && 'icon' in child && child.icon)),\n );\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 reserveIconSpace: groupReserveIconSpace,\n })\n : null}\n </ContextMenu.Group>\n );\n }\n\n if ((item as SubMenuType).type === 'submenu' || 'children' in item) {\n const submenu = item as SubMenuType;\n const label = getItemLabel(submenu);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = 'danger' in submenu && Boolean(submenu.danger);\n\n return (\n <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 ? renderContextMenuItems(submenu.children, nextKeyPath) : null}\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 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":";;;;;;;;;;AAyBA,MAAM,cAAc,MAAgB,aAA0B;AAC5D,KAAI,QA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;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,WAAW,uBAAuB,QAAQ,UAAU,YAAY,GAAG;MAC1D;KACG,GACN,KAtBO,QAuBJ;;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,UAAU,SAAS;GAEnB,OAAO;GACP,UAAU,UAAU,gBAAgB,UAAU,aAAa,MAAM;aAEhE,kBAAkB,UAAU,EAAE,kBAAkB,CAAC;KAJ7C,QAKY;GAErB"}
@@ -2,12 +2,14 @@
2
2
  const emptyState = {
3
3
  anchor: null,
4
4
  items: [],
5
- open: false
5
+ open: false,
6
+ triggerId: null
6
7
  };
7
8
  let contextMenuState = emptyState;
8
9
  const listeners = /* @__PURE__ */ new Set();
9
10
  const lastPointer = {
10
11
  ready: false,
12
+ triggerId: null,
11
13
  x: 0,
12
14
  y: 0
13
15
  };
@@ -24,6 +26,8 @@ const updateLastPointer = (event) => {
24
26
  lastPointer.x = event.clientX;
25
27
  lastPointer.y = event.clientY;
26
28
  lastPointer.ready = true;
29
+ if (event.target instanceof Element) lastPointer.triggerId = event.target.closest("[data-contextmenu-trigger]")?.dataset.contextmenuTrigger ?? null;
30
+ else lastPointer.triggerId = null;
27
31
  };
28
32
  const createVirtualElement = (point) => ({
29
33
  contextElement: typeof document === "undefined" ? void 0 : document.body,
@@ -58,14 +62,16 @@ const showContextMenu = (items) => {
58
62
  y: lastPointer.y
59
63
  } : fallbackPoint),
60
64
  items,
61
- open: true
65
+ open: true,
66
+ triggerId: lastPointer.triggerId ?? null
62
67
  });
63
68
  };
64
69
  const closeContextMenu = () => {
65
70
  setContextMenuState({
66
71
  anchor: null,
67
72
  items: [],
68
- open: false
73
+ open: false,
74
+ triggerId: null
69
75
  });
70
76
  };
71
77
 
@@ -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 { GenericItemType } from '@/Menu';\n\nexport type ContextMenuState = {\n anchor: VirtualElement | null;\n items: GenericItemType[];\n open: boolean;\n};\n\nconst emptyState: ContextMenuState = {\n anchor: null,\n items: [],\n open: false,\n};\n\nlet contextMenuState: ContextMenuState = emptyState;\nconst listeners = new Set<() => void>();\nconst lastPointer = { ready: false, 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};\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: GenericItemType[]) => {\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 });\n};\n\nexport const closeContextMenu = () => {\n setContextMenuState({ anchor: null, items: [], open: false });\n};\n"],"mappings":";AAUA,MAAMA,aAA+B;CACnC,QAAQ;CACR,OAAO,EAAE;CACT,MAAM;CACP;AAED,IAAIC,mBAAqC;AACzC,MAAM,4BAAY,IAAI,KAAiB;AACvC,MAAM,cAAc;CAAE,OAAO;CAAO,GAAG;CAAG,GAAG;CAAG;AAEhD,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;;AAGtB,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;EACP,CAAC;;AAGJ,MAAa,yBAAyB;AACpC,qBAAoB;EAAE,QAAQ;EAAM,OAAO,EAAE;EAAE,MAAM;EAAO,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 { GenericItemType } from '@/Menu';\n\nexport type ContextMenuState = {\n anchor: VirtualElement | null;\n items: GenericItemType[];\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: GenericItemType[]) => {\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\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;;AAGJ,MAAa,yBAAyB;AACpC,qBAAoB;EAAE,QAAQ;EAAM,OAAO,EAAE;EAAE,MAAM;EAAO,WAAW;EAAM,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import { CopyButtonProps } from "./type.mjs";
2
- import * as react7 from "react";
2
+ import * as react41 from "react";
3
3
 
4
4
  //#region src/CopyButton/CopyButton.d.ts
5
- declare const CopyButton: react7.NamedExoticComponent<CopyButtonProps>;
5
+ declare const CopyButton: react41.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 react11 from "react";
2
+ import * as react58 from "react";
3
3
 
4
4
  //#region src/DatePicker/DatePicker.d.ts
5
- declare const DatePicker: react11.NamedExoticComponent<DatePickerProps>;
5
+ declare const DatePicker: react58.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 react60 from "react";
2
+ import * as react53 from "react";
3
3
 
4
4
  //#region src/DraggablePanel/components/DraggablePanelBody.d.ts
5
5
  type DraggablePanelBodyProps = DivProps;
6
- declare const DraggablePanelBody: react60.NamedExoticComponent<DivProps>;
6
+ declare const DraggablePanelBody: react53.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 react61 from "react";
2
+ import * as react54 from "react";
3
3
 
4
4
  //#region src/DraggablePanel/components/DraggablePanelContainer.d.ts
5
5
  type DraggablePanelContainerProps = DivProps;
6
- declare const DraggablePanelContainer: react61.NamedExoticComponent<DivProps>;
6
+ declare const DraggablePanelContainer: react54.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 react62 from "react";
2
+ import * as react55 from "react";
3
3
 
4
4
  //#region src/DraggablePanel/components/DraggablePanelFooter.d.ts
5
5
  type DraggablePanelFooterProps = DivProps;
6
- declare const DraggablePanelFooter: react62.NamedExoticComponent<DivProps>;
6
+ declare const DraggablePanelFooter: react55.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 react63 from "react";
2
+ import * as react56 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: react63.NamedExoticComponent<DraggablePanelHeaderProps>;
12
+ declare const DraggablePanelHeader: react56.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 react58 from "react";
2
+ import * as react57 from "react";
3
3
 
4
4
  //#region src/DraggableSideNav/DraggableSideNav.d.ts
5
- declare const DraggableSideNav: react58.NamedExoticComponent<DraggableSideNavProps>;
5
+ declare const DraggableSideNav: react57.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 react57 from "react";
2
+ import * as react43 from "react";
3
3
 
4
4
  //#region src/Drawer/Drawer.d.ts
5
- declare const Drawer: react57.NamedExoticComponent<DrawerProps>;
5
+ declare const Drawer: react43.NamedExoticComponent<DrawerProps>;
6
6
  //#endregion
7
7
  export { Drawer };
8
8
  //# sourceMappingURL=Drawer.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { DropdownProps } from "./type.mjs";
2
- import * as react55 from "react";
2
+ import * as react59 from "react";
3
3
 
4
4
  //#region src/Dropdown/Dropdown.d.ts
5
- declare const Dropdown: react55.NamedExoticComponent<DropdownProps>;
5
+ declare const Dropdown: react59.NamedExoticComponent<DropdownProps>;
6
6
  //#endregion
7
7
  export { Dropdown };
8
8
  //# sourceMappingURL=Dropdown.d.mts.map
@@ -0,0 +1,8 @@
1
+ import { DropdownMenuProps } from "./type.mjs";
2
+ import * as react47 from "react";
3
+
4
+ //#region src/DropdownMenu/DropdownMenu.d.ts
5
+ declare const DropdownMenu: react47.NamedExoticComponent<DropdownMenuProps<unknown>>;
6
+ //#endregion
7
+ export { DropdownMenu };
8
+ //# sourceMappingURL=DropdownMenu.d.mts.map