@lobehub/ui 4.30.2 → 4.32.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 (202) hide show
  1. package/es/Accordion/Accordion.d.mts +2 -2
  2. package/es/Accordion/Accordion.mjs +2 -2
  3. package/es/Accordion/Accordion.mjs.map +1 -1
  4. package/es/Accordion/AccordionItem.d.mts +2 -2
  5. package/es/Accordion/AccordionItem.mjs +2 -2
  6. package/es/Accordion/AccordionItem.mjs.map +1 -1
  7. package/es/ActionIcon/ActionIcon.d.mts +2 -2
  8. package/es/Alert/Alert.d.mts +2 -2
  9. package/es/AutoComplete/Select.d.mts +2 -2
  10. package/es/Avatar/AvatarGroup/index.d.mts +2 -2
  11. package/es/Burger/Burger.d.mts +2 -2
  12. package/es/Checkbox/Checkbox.mjs +2 -2
  13. package/es/Checkbox/Checkbox.mjs.map +1 -1
  14. package/es/Checkbox/CheckboxGroup.mjs +2 -2
  15. package/es/Checkbox/CheckboxGroup.mjs.map +1 -1
  16. package/es/CodeDiff/CodeDiff.d.mts +2 -2
  17. package/es/CodeDiff/PatchDiff.d.mts +2 -2
  18. package/es/CodeEditor/CodeEditor.d.mts +2 -2
  19. package/es/CodeEditor/CodeEditor.mjs +2 -2
  20. package/es/CodeEditor/CodeEditor.mjs.map +1 -1
  21. package/es/Collapse/Collapse.d.mts +2 -2
  22. package/es/ColorSwatches/ColorSwatches.mjs +2 -2
  23. package/es/ColorSwatches/ColorSwatches.mjs.map +1 -1
  24. package/es/ConfigProvider/index.d.mts +2 -2
  25. package/es/ContextMenu/ContextMenuHost.d.mts +2 -2
  26. package/es/ContextMenu/ContextMenuHost.mjs +1 -1
  27. package/es/ContextMenu/ContextMenuHost.mjs.map +1 -1
  28. package/es/ContextMenu/index.d.mts +4 -2
  29. package/es/ContextMenu/renderItems.d.mts +4 -0
  30. package/es/ContextMenu/renderItems.mjs +21 -32
  31. package/es/ContextMenu/renderItems.mjs.map +1 -1
  32. package/es/ContextMenu/store.d.mts +7 -2
  33. package/es/ContextMenu/store.mjs +4 -1
  34. package/es/ContextMenu/store.mjs.map +1 -1
  35. package/es/CopyButton/CopyButton.d.mts +2 -2
  36. package/es/DatePicker/DatePicker.d.mts +2 -2
  37. package/es/DraggablePanel/DraggablePanel.mjs +2 -2
  38. package/es/DraggablePanel/DraggablePanel.mjs.map +1 -1
  39. package/es/DraggablePanel/components/DraggablePanelBody.d.mts +2 -2
  40. package/es/DraggablePanel/components/DraggablePanelContainer.d.mts +2 -2
  41. package/es/DraggablePanel/components/DraggablePanelFooter.d.mts +2 -2
  42. package/es/DraggablePanel/components/DraggablePanelHeader.d.mts +2 -2
  43. package/es/DraggablePanel/components/DraggablePanelHeader.mjs +2 -2
  44. package/es/DraggablePanel/components/DraggablePanelHeader.mjs.map +1 -1
  45. package/es/DraggableSideNav/DraggableSideNav.d.mts +2 -2
  46. package/es/DraggableSideNav/DraggableSideNav.mjs +2 -2
  47. package/es/DraggableSideNav/DraggableSideNav.mjs.map +1 -1
  48. package/es/Drawer/Drawer.d.mts +2 -2
  49. package/es/Dropdown/Dropdown.d.mts +2 -2
  50. package/es/DropdownMenu/DropdownMenu.d.mts +2 -2
  51. package/es/DropdownMenu/DropdownMenu.mjs +7 -3
  52. package/es/DropdownMenu/DropdownMenu.mjs.map +1 -1
  53. package/es/DropdownMenu/index.d.mts +3 -2
  54. package/es/DropdownMenu/renderItems.d.mts +3 -3
  55. package/es/DropdownMenu/renderItems.mjs +20 -30
  56. package/es/DropdownMenu/renderItems.mjs.map +1 -1
  57. package/es/DropdownMenu/type.d.mts +9 -0
  58. package/es/EditableText/EditableText.d.mts +2 -2
  59. package/es/EditableText/EditableText.mjs +2 -2
  60. package/es/EditableText/EditableText.mjs.map +1 -1
  61. package/es/EditorSlashMenu/atoms.d.mts +12 -12
  62. package/es/EmojiPicker/EmojiPicker.d.mts +2 -2
  63. package/es/EmojiPicker/EmojiPicker.mjs +3 -3
  64. package/es/EmojiPicker/EmojiPicker.mjs.map +1 -1
  65. package/es/Flex/FlexBasic.d.mts +2 -2
  66. package/es/FontLoader/index.d.mts +2 -2
  67. package/es/Footer/Footer.d.mts +2 -2
  68. package/es/Form/components/FormGroup.d.mts +2 -2
  69. package/es/Form/components/FormItem.d.mts +2 -2
  70. package/es/Form/components/FormSubmitFooter.d.mts +2 -2
  71. package/es/FormModal/FormModal.d.mts +2 -2
  72. package/es/GuideCard/GuideCard.d.mts +2 -2
  73. package/es/Header/Header.d.mts +2 -2
  74. package/es/Highlighter/Highlighter.d.mts +2 -2
  75. package/es/Highlighter/SyntaxHighlighter/index.d.mts +2 -2
  76. package/es/Hotkey/Hotkey.d.mts +2 -2
  77. package/es/HotkeyInput/HotkeyInput.d.mts +2 -2
  78. package/es/HotkeyInput/HotkeyInput.mjs +2 -2
  79. package/es/HotkeyInput/HotkeyInput.mjs.map +1 -1
  80. package/es/Icon/Icon.d.mts +2 -2
  81. package/es/Icon/components/IconProvider.d.mts +3 -3
  82. package/es/Image/PreviewGroup.d.mts +2 -2
  83. package/es/ImageSelect/ImageSelect.d.mts +2 -2
  84. package/es/ImageSelect/ImageSelect.mjs +2 -2
  85. package/es/ImageSelect/ImageSelect.mjs.map +1 -1
  86. package/es/Input/Input.d.mts +2 -2
  87. package/es/Input/InputNumber.d.mts +2 -2
  88. package/es/Input/InputOPT.d.mts +2 -2
  89. package/es/Input/InputPassword.d.mts +2 -2
  90. package/es/Input/TextArea.d.mts +2 -2
  91. package/es/Layout/components/LayoutFooter.d.mts +2 -2
  92. package/es/Layout/components/LayoutHeader.d.mts +2 -2
  93. package/es/Layout/components/LayoutMain.d.mts +2 -2
  94. package/es/Layout/components/LayoutSidebar.d.mts +2 -2
  95. package/es/Layout/components/LayoutSidebarInner.d.mts +2 -2
  96. package/es/Layout/components/LayoutToc.d.mts +2 -2
  97. package/es/List/ListItem/index.d.mts +2 -2
  98. package/es/LobeSelect/LobeSelect.d.mts +2 -2
  99. package/es/LobeSelect/atoms.d.mts +19 -19
  100. package/es/LobeSwitch/LobeSwitch.d.mts +2 -2
  101. package/es/LobeSwitch/atoms.d.mts +4 -4
  102. package/es/LobeSwitch/atoms.mjs +2 -2
  103. package/es/LobeSwitch/atoms.mjs.map +1 -1
  104. package/es/Markdown/Markdown.d.mts +2 -2
  105. package/es/Markdown/Typography.d.mts +2 -2
  106. package/es/Markdown/components/SearchResultCards/index.d.mts +2 -2
  107. package/es/MaskShadow/MaskShadow.d.mts +2 -2
  108. package/es/Menu/Menu.d.mts +2 -2
  109. package/es/Menu/baseItem.d.mts +21 -3
  110. package/es/Menu/index.d.mts +3 -2
  111. package/es/Menu/index.mjs +2 -1
  112. package/es/Menu/renderUtils.d.mts +35 -0
  113. package/es/Menu/renderUtils.mjs +46 -0
  114. package/es/Menu/renderUtils.mjs.map +1 -0
  115. package/es/Mermaid/Mermaid.d.mts +2 -2
  116. package/es/Mermaid/SyntaxMermaid/index.d.mts +2 -2
  117. package/es/Modal/Modal.d.mts +2 -2
  118. package/es/Modal/ModalProvider.d.mts +2 -2
  119. package/es/Modal/imperative.d.mts +2 -2
  120. package/es/MotionProvider/index.d.mts +2 -2
  121. package/es/Popover/ArrowIcon.d.mts +2 -2
  122. package/es/Popover/atoms.d.mts +9 -9
  123. package/es/Popover/context.d.mts +2 -2
  124. package/es/SearchBar/SearchBar.d.mts +2 -2
  125. package/es/SearchBar/SearchBar.mjs +2 -2
  126. package/es/SearchBar/SearchBar.mjs.map +1 -1
  127. package/es/Segmented/Segmented.d.mts +2 -2
  128. package/es/Select/Select.d.mts +6 -3
  129. package/es/Select/Select.mjs +6 -3
  130. package/es/Select/Select.mjs.map +1 -1
  131. package/es/Select/index.d.mts +2 -2
  132. package/es/SideNav/SideNav.d.mts +2 -2
  133. package/es/SliderWithInput/SliderWithInput.d.mts +2 -2
  134. package/es/SortableList/components/DragHandle.d.mts +2 -2
  135. package/es/SortableList/components/SortableItem.d.mts +2 -2
  136. package/es/ThemeProvider/ThemeProvider.d.mts +2 -2
  137. package/es/Toast/Toast.mjs +40 -22
  138. package/es/Toast/Toast.mjs.map +1 -1
  139. package/es/Toast/imperative.d.mts +3 -3
  140. package/es/Toast/index.d.mts +2 -2
  141. package/es/Toast/style.mjs +99 -12
  142. package/es/Toast/style.mjs.map +1 -1
  143. package/es/Toast/type.d.mts +33 -1
  144. package/es/Toc/Toc.d.mts +2 -2
  145. package/es/Toc/TocMobile.mjs +2 -2
  146. package/es/Toc/TocMobile.mjs.map +1 -1
  147. package/es/Video/index.d.mts +2 -2
  148. package/es/awesome/AuroraBackground/AuroraBackground.d.mts +2 -2
  149. package/es/awesome/BottomGradientButton/BottomGradientButton.d.mts +2 -2
  150. package/es/awesome/Features/Features.d.mts +2 -2
  151. package/es/awesome/Giscus/Giscus.d.mts +2 -2
  152. package/es/awesome/GradientButton/GradientButton.d.mts +2 -2
  153. package/es/awesome/GridBackground/GridBackground.d.mts +2 -2
  154. package/es/awesome/GridBackground/GridShowcase.d.mts +2 -2
  155. package/es/awesome/Hero/Hero.d.mts +2 -2
  156. package/es/awesome/Spline/Spine.d.mts +2 -2
  157. package/es/awesome/Spotlight/Spotlight.d.mts +2 -2
  158. package/es/awesome/SpotlightCard/SpotlightCard.d.mts +2 -2
  159. package/es/awesome/TypewriterEffect/TypewriterEffect.d.mts +2 -2
  160. package/es/brand/LobeChat/index.d.mts +2 -2
  161. package/es/brand/LobeHub/index.d.mts +2 -2
  162. package/es/brand/LogoThree/LogoSpline.d.mts +2 -2
  163. package/es/brand/LogoThree/index.d.mts +2 -2
  164. package/es/chat/BackBottom/BackBottom.d.mts +2 -2
  165. package/es/chat/ChatInputArea/components/ChatInputAreaInner.d.mts +2 -2
  166. package/es/chat/ChatItem/ChatItem.d.mts +2 -2
  167. package/es/chat/ChatList/ChatList.d.mts +2 -2
  168. package/es/chat/EditableMessage/EditableMessage.d.mts +2 -2
  169. package/es/chat/EditableMessage/EditableMessage.mjs +3 -3
  170. package/es/chat/EditableMessage/EditableMessage.mjs.map +1 -1
  171. package/es/chat/EditableMessageList/EditableMessageList.d.mts +2 -2
  172. package/es/chat/MessageInput/MessageInput.d.mts +2 -2
  173. package/es/chat/MessageModal/MessageModal.d.mts +2 -2
  174. package/es/chat/MessageModal/MessageModal.mjs +3 -3
  175. package/es/chat/MessageModal/MessageModal.mjs.map +1 -1
  176. package/es/color/ColorScales/index.d.mts +2 -2
  177. package/es/color/CssVar/index.d.mts +2 -2
  178. package/es/i18n/context.d.mts +2 -2
  179. package/es/icons/lucideExtra/BotPromptIcon.d.mts +2 -2
  180. package/es/icons/lucideExtra/CreateBotIcon.d.mts +3 -3
  181. package/es/icons/lucideExtra/DiscordIcon.d.mts +3 -3
  182. package/es/icons/lucideExtra/GlobeOffIcon.d.mts +2 -2
  183. package/es/icons/lucideExtra/GroupBotIcon.d.mts +2 -2
  184. package/es/icons/lucideExtra/GroupBotSquareIcon.d.mts +3 -3
  185. package/es/icons/lucideExtra/LeftClickIcon.d.mts +3 -3
  186. package/es/icons/lucideExtra/LeftDoubleClickIcon.d.mts +2 -2
  187. package/es/icons/lucideExtra/McpIcon.d.mts +3 -3
  188. package/es/icons/lucideExtra/ProviderIcon.d.mts +2 -2
  189. package/es/icons/lucideExtra/RightClickIcon.d.mts +3 -3
  190. package/es/icons/lucideExtra/RightDoubleClickIcon.d.mts +3 -3
  191. package/es/icons/lucideExtra/ShapesUploadIcon.d.mts +2 -2
  192. package/es/icons/lucideExtra/TreeDownRightIcon.d.mts +2 -2
  193. package/es/icons/lucideExtra/TreeUpDownRightIcon.d.mts +2 -2
  194. package/es/index.d.mts +3 -3
  195. package/es/index.mjs +1 -1
  196. package/es/mdx/Mdx/index.d.mts +2 -2
  197. package/es/mobile/ChatHeader/ChatHeaderTitle.d.mts +2 -2
  198. package/es/mobile/ChatInputArea/components/ChatSendButton.d.mts +2 -2
  199. package/es/mobile/TabBar/TabBar.mjs +2 -2
  200. package/es/mobile/TabBar/TabBar.mjs.map +1 -1
  201. package/es/storybook/StoryBook/index.d.mts +2 -2
  202. package/package.json +1 -1
@@ -1,16 +1,16 @@
1
1
  import { LobeSelectSize, LobeSelectVariant } from "./type.mjs";
2
2
  import { LOBE_SELECT_CONTAINER_ATTR } from "./constants.mjs";
3
- import * as react71 from "react";
3
+ import * as react40 from "react";
4
4
  import { ComponentProps, ComponentPropsWithRef } from "react";
5
- import * as react_jsx_runtime21 from "react/jsx-runtime";
5
+ import * as react_jsx_runtime10 from "react/jsx-runtime";
6
6
  import * as _base_ui_react_select0 from "@base-ui/react/select";
7
7
  import { Select } from "@base-ui/react/select";
8
8
  import * as node_modules__base_ui_react_esm_separator_Separator0 from "node_modules/@base-ui/react/esm/separator/Separator";
9
9
 
10
10
  //#region src/LobeSelect/atoms.d.ts
11
11
  declare const LobeSelectRoot: typeof Select.Root;
12
- declare const LobeSelectBackdrop: react71.ForwardRefExoticComponent<_base_ui_react_select0.SelectBackdropProps & react71.RefAttributes<HTMLDivElement>>;
13
- declare const LobeSelectSeparator: react71.ForwardRefExoticComponent<node_modules__base_ui_react_esm_separator_Separator0.SeparatorProps & react71.RefAttributes<HTMLDivElement>>;
12
+ declare const LobeSelectBackdrop: react40.ForwardRefExoticComponent<_base_ui_react_select0.SelectBackdropProps & react40.RefAttributes<HTMLDivElement>>;
13
+ declare const LobeSelectSeparator: react40.ForwardRefExoticComponent<node_modules__base_ui_react_esm_separator_Separator0.SeparatorProps & react40.RefAttributes<HTMLDivElement>>;
14
14
  type LobeSelectTriggerProps = Omit<ComponentPropsWithRef<typeof Select.Trigger>, 'children' | 'render'> & {
15
15
  children: ComponentProps<typeof Select.Trigger>['children'];
16
16
  shadow?: boolean;
@@ -27,7 +27,7 @@ declare const LobeSelectTrigger: {
27
27
  variant,
28
28
  ref: refProp,
29
29
  ...rest
30
- }: LobeSelectTriggerProps): react_jsx_runtime21.JSX.Element;
30
+ }: LobeSelectTriggerProps): react_jsx_runtime10.JSX.Element;
31
31
  displayName: string;
32
32
  };
33
33
  type LobeSelectIconProps = ComponentProps<typeof Select.Icon>;
@@ -35,7 +35,7 @@ declare const LobeSelectIcon: {
35
35
  ({
36
36
  className,
37
37
  ...rest
38
- }: LobeSelectIconProps): react_jsx_runtime21.JSX.Element;
38
+ }: LobeSelectIconProps): react_jsx_runtime10.JSX.Element;
39
39
  displayName: string;
40
40
  };
41
41
  type LobeSelectValueProps = ComponentProps<typeof Select.Value>;
@@ -43,7 +43,7 @@ declare const LobeSelectValue: {
43
43
  ({
44
44
  className,
45
45
  ...rest
46
- }: LobeSelectValueProps): react_jsx_runtime21.JSX.Element;
46
+ }: LobeSelectValueProps): react_jsx_runtime10.JSX.Element;
47
47
  displayName: string;
48
48
  };
49
49
  type LobeSelectPortalProps = ComponentProps<typeof Select.Portal> & {
@@ -56,7 +56,7 @@ declare const LobeSelectPortal: {
56
56
  ({
57
57
  container,
58
58
  ...rest
59
- }: LobeSelectPortalProps): react_jsx_runtime21.JSX.Element;
59
+ }: LobeSelectPortalProps): react_jsx_runtime10.JSX.Element;
60
60
  displayName: string;
61
61
  };
62
62
  type LobeSelectPositionerProps = ComponentProps<typeof Select.Positioner>;
@@ -68,7 +68,7 @@ declare const LobeSelectPositioner: {
68
68
  side,
69
69
  sideOffset,
70
70
  ...rest
71
- }: LobeSelectPositionerProps): react_jsx_runtime21.JSX.Element;
71
+ }: LobeSelectPositionerProps): react_jsx_runtime10.JSX.Element;
72
72
  displayName: string;
73
73
  };
74
74
  type LobeSelectPopupProps = ComponentProps<typeof Select.Popup>;
@@ -76,7 +76,7 @@ declare const LobeSelectPopup: {
76
76
  ({
77
77
  className,
78
78
  ...rest
79
- }: LobeSelectPopupProps): react_jsx_runtime21.JSX.Element;
79
+ }: LobeSelectPopupProps): react_jsx_runtime10.JSX.Element;
80
80
  displayName: string;
81
81
  };
82
82
  type LobeSelectListProps = ComponentProps<typeof Select.List>;
@@ -84,7 +84,7 @@ declare const LobeSelectList: {
84
84
  ({
85
85
  className,
86
86
  ...rest
87
- }: LobeSelectListProps): react_jsx_runtime21.JSX.Element;
87
+ }: LobeSelectListProps): react_jsx_runtime10.JSX.Element;
88
88
  displayName: string;
89
89
  };
90
90
  type LobeSelectItemProps = ComponentProps<typeof Select.Item>;
@@ -92,7 +92,7 @@ declare const LobeSelectItem: {
92
92
  ({
93
93
  className,
94
94
  ...rest
95
- }: LobeSelectItemProps): react_jsx_runtime21.JSX.Element;
95
+ }: LobeSelectItemProps): react_jsx_runtime10.JSX.Element;
96
96
  displayName: string;
97
97
  };
98
98
  type LobeSelectItemTextProps = ComponentProps<typeof Select.ItemText>;
@@ -100,7 +100,7 @@ declare const LobeSelectItemText: {
100
100
  ({
101
101
  className,
102
102
  ...rest
103
- }: LobeSelectItemTextProps): react_jsx_runtime21.JSX.Element;
103
+ }: LobeSelectItemTextProps): react_jsx_runtime10.JSX.Element;
104
104
  displayName: string;
105
105
  };
106
106
  type LobeSelectItemIndicatorProps = ComponentProps<typeof Select.ItemIndicator>;
@@ -108,7 +108,7 @@ declare const LobeSelectItemIndicator: {
108
108
  ({
109
109
  className,
110
110
  ...rest
111
- }: LobeSelectItemIndicatorProps): react_jsx_runtime21.JSX.Element;
111
+ }: LobeSelectItemIndicatorProps): react_jsx_runtime10.JSX.Element;
112
112
  displayName: string;
113
113
  };
114
114
  type LobeSelectGroupProps = ComponentProps<typeof Select.Group>;
@@ -116,7 +116,7 @@ declare const LobeSelectGroup: {
116
116
  ({
117
117
  className,
118
118
  ...rest
119
- }: LobeSelectGroupProps): react_jsx_runtime21.JSX.Element;
119
+ }: LobeSelectGroupProps): react_jsx_runtime10.JSX.Element;
120
120
  displayName: string;
121
121
  };
122
122
  type LobeSelectGroupLabelProps = ComponentProps<typeof Select.GroupLabel>;
@@ -124,7 +124,7 @@ declare const LobeSelectGroupLabel: {
124
124
  ({
125
125
  className,
126
126
  ...rest
127
- }: LobeSelectGroupLabelProps): react_jsx_runtime21.JSX.Element;
127
+ }: LobeSelectGroupLabelProps): react_jsx_runtime10.JSX.Element;
128
128
  displayName: string;
129
129
  };
130
130
  type LobeSelectScrollUpArrowProps = ComponentProps<typeof Select.ScrollUpArrow>;
@@ -132,7 +132,7 @@ declare const LobeSelectScrollUpArrow: {
132
132
  ({
133
133
  className,
134
134
  ...rest
135
- }: LobeSelectScrollUpArrowProps): react_jsx_runtime21.JSX.Element;
135
+ }: LobeSelectScrollUpArrowProps): react_jsx_runtime10.JSX.Element;
136
136
  displayName: string;
137
137
  };
138
138
  type LobeSelectScrollDownArrowProps = ComponentProps<typeof Select.ScrollDownArrow>;
@@ -140,7 +140,7 @@ declare const LobeSelectScrollDownArrow: {
140
140
  ({
141
141
  className,
142
142
  ...rest
143
- }: LobeSelectScrollDownArrowProps): react_jsx_runtime21.JSX.Element;
143
+ }: LobeSelectScrollDownArrowProps): react_jsx_runtime10.JSX.Element;
144
144
  displayName: string;
145
145
  };
146
146
  type LobeSelectArrowProps = ComponentProps<typeof Select.Arrow>;
@@ -148,7 +148,7 @@ declare const LobeSelectArrow: {
148
148
  ({
149
149
  className,
150
150
  ...rest
151
- }: LobeSelectArrowProps): react_jsx_runtime21.JSX.Element;
151
+ }: LobeSelectArrowProps): react_jsx_runtime10.JSX.Element;
152
152
  displayName: string;
153
153
  };
154
154
  //#endregion
@@ -1,8 +1,8 @@
1
1
  import { LobeSwitchProps } from "./type.mjs";
2
- import * as react5 from "react";
2
+ import * as react39 from "react";
3
3
 
4
4
  //#region src/LobeSwitch/LobeSwitch.d.ts
5
- declare const LobeSwitch: react5.NamedExoticComponent<LobeSwitchProps>;
5
+ declare const LobeSwitch: react39.NamedExoticComponent<LobeSwitchProps>;
6
6
  //#endregion
7
7
  export { LobeSwitch };
8
8
  //# sourceMappingURL=LobeSwitch.d.mts.map
@@ -1,6 +1,6 @@
1
1
  import { LobeSwitchChangeEventHandler, LobeSwitchContextType, LobeSwitchIconProps, LobeSwitchRootProps, LobeSwitchThumbProps } from "./type.mjs";
2
2
  import { styles } from "./style.mjs";
3
- import * as react_jsx_runtime0 from "react/jsx-runtime";
3
+ import * as react_jsx_runtime7 from "react/jsx-runtime";
4
4
 
5
5
  //#region src/LobeSwitch/atoms.d.ts
6
6
  declare const useLobeSwitchContext: () => LobeSwitchContextType;
@@ -24,7 +24,7 @@ declare const LobeSwitchRoot: {
24
24
  id,
25
25
  name,
26
26
  ...rest
27
- }: LobeSwitchRootInternalProps): react_jsx_runtime0.JSX.Element;
27
+ }: LobeSwitchRootInternalProps): react_jsx_runtime7.JSX.Element;
28
28
  displayName: string;
29
29
  };
30
30
  declare const LobeSwitchThumb: {
@@ -35,7 +35,7 @@ declare const LobeSwitchThumb: {
35
35
  transition,
36
36
  children,
37
37
  ...rest
38
- }: LobeSwitchThumbProps): react_jsx_runtime0.JSX.Element;
38
+ }: LobeSwitchThumbProps): react_jsx_runtime7.JSX.Element;
39
39
  displayName: string;
40
40
  };
41
41
  declare const LobeSwitchIcon: {
@@ -48,7 +48,7 @@ declare const LobeSwitchIcon: {
48
48
  }: LobeSwitchIconProps & {
49
49
  children?: React.ReactNode;
50
50
  size?: "default" | "small";
51
- }): react_jsx_runtime0.JSX.Element;
51
+ }): react_jsx_runtime7.JSX.Element;
52
52
  displayName: string;
53
53
  };
54
54
  //#endregion
@@ -5,7 +5,7 @@ import { rootVariants, styles, thumbVariants } from "./style.mjs";
5
5
  import { createContext, useContext, useMemo, useRef, useState } from "react";
6
6
  import { jsx } from "react/jsx-runtime";
7
7
  import { cx } from "antd-style";
8
- import useControlledState from "use-merge-value";
8
+ import useMergeState from "use-merge-value";
9
9
  import { Switch } from "@base-ui/react/switch";
10
10
 
11
11
  //#region src/LobeSwitch/atoms.tsx
@@ -19,7 +19,7 @@ const LobeSwitchRoot = ({ checked, className, defaultChecked, onCheckedChange, o
19
19
  const Motion = useMotionComponent();
20
20
  const [isPressed, setIsPressed] = useState(false);
21
21
  const lastEventRef = useRef(null);
22
- const [isChecked, setIsChecked] = useControlledState(defaultChecked ?? false, {
22
+ const [isChecked, setIsChecked] = useMergeState(defaultChecked ?? false, {
23
23
  defaultValue: defaultChecked,
24
24
  onChange: (value) => {
25
25
  if (lastEventRef.current) onCheckedChange?.(value, lastEventRef.current);
@@ -1 +1 @@
1
- {"version":3,"file":"atoms.mjs","names":[],"sources":["../../src/LobeSwitch/atoms.tsx"],"sourcesContent":["'use client';\n\nimport { Switch } from '@base-ui/react/switch';\nimport { cx } from 'antd-style';\nimport type { KeyboardEvent, MouseEvent } from 'react';\nimport { createContext, useContext, useMemo, useRef, useState } from 'react';\nimport useControlledState from 'use-merge-value';\n\nimport { useMotionComponent } from '@/MotionProvider';\n\nimport { rootVariants, styles, thumbVariants } from './style';\nimport type {\n LobeSwitchChangeEventHandler,\n LobeSwitchContextType,\n LobeSwitchIconPosition,\n LobeSwitchIconProps,\n LobeSwitchRootProps,\n LobeSwitchThumbProps,\n} from './type';\n\nconst LobeSwitchContext = createContext<LobeSwitchContextType | null>(null);\n\nexport const useLobeSwitchContext = () => {\n const context = useContext(LobeSwitchContext);\n if (!context) {\n throw new Error('useLobeSwitchContext must be used within a LobeSwitchRoot');\n }\n return context;\n};\n\ntype LobeSwitchRootInternalProps = Omit<LobeSwitchRootProps, 'onCheckedChange' | 'onClick'> & {\n onCheckedChange?: LobeSwitchChangeEventHandler;\n onClick?: LobeSwitchChangeEventHandler;\n};\n\nexport const LobeSwitchRoot = ({\n checked,\n className,\n defaultChecked,\n onCheckedChange,\n onClick,\n size = 'default',\n children,\n disabled,\n readOnly,\n required,\n inputRef,\n id,\n name,\n ...rest\n}: LobeSwitchRootInternalProps) => {\n const Motion = useMotionComponent();\n const [isPressed, setIsPressed] = useState(false);\n const lastEventRef = useRef<MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLButtonElement>>(\n null,\n );\n\n const [isChecked, setIsChecked] = useControlledState(defaultChecked ?? false, {\n defaultValue: defaultChecked,\n onChange: (value: boolean) => {\n if (lastEventRef.current) {\n onCheckedChange?.(value, lastEventRef.current);\n }\n },\n value: checked,\n });\n\n const baseClassName = rootVariants({ size });\n\n const contextValue = useMemo(\n () => ({\n isChecked: Boolean(isChecked),\n isPressed,\n setIsChecked: (value: boolean) => setIsChecked(value),\n setIsPressed,\n }),\n [isChecked, isPressed, setIsChecked],\n );\n\n const handleClick = (event: MouseEvent<HTMLButtonElement>) => {\n lastEventRef.current = event;\n onClick?.(!isChecked, event);\n };\n\n const handleKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {\n if (event.key === 'Enter' || event.key === ' ') {\n lastEventRef.current = event;\n }\n (rest as any).onKeyDown?.(event);\n };\n\n return (\n <LobeSwitchContext.Provider value={contextValue}>\n <Switch.Root\n checked={isChecked}\n defaultChecked={defaultChecked}\n disabled={disabled}\n id={id}\n inputRef={inputRef}\n name={name}\n onCheckedChange={setIsChecked}\n readOnly={readOnly}\n render={\n <Motion.button\n {...rest}\n className={cx(baseClassName, className)}\n initial={false}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n onTap={() => setIsPressed(false)}\n onTapCancel={() => setIsPressed(false)}\n onTapStart={() => setIsPressed(true)}\n whileTap=\"tap\"\n />\n }\n required={required}\n >\n {children}\n </Switch.Root>\n </LobeSwitchContext.Provider>\n );\n};\n\nLobeSwitchRoot.displayName = 'LobeSwitchRoot';\n\nexport const LobeSwitchThumb = ({\n className,\n pressedAnimation,\n size = 'default',\n transition = { damping: 25, stiffness: 300, type: 'spring' },\n children,\n ...rest\n}: LobeSwitchThumbProps) => {\n const Motion = useMotionComponent();\n const { isPressed } = useLobeSwitchContext();\n const baseClassName = thumbVariants({ size });\n\n const defaultPressedAnimation = {\n width: size === 'small' ? 16 : 22,\n };\n\n return (\n <Switch.Thumb\n render={\n <Motion.span\n animate={isPressed ? pressedAnimation || defaultPressedAnimation : undefined}\n className={cx(baseClassName, className)}\n layout\n transition={transition}\n {...rest}\n >\n {children}\n </Motion.span>\n }\n />\n );\n};\n\nLobeSwitchThumb.displayName = 'LobeSwitchThumb';\n\nconst getIconPositionClass = (position: LobeSwitchIconPosition, size: 'default' | 'small') => {\n if (position === 'thumb') return styles.iconThumb;\n if (position === 'left') return size === 'small' ? styles.iconLeftSmall : styles.iconLeft;\n return size === 'small' ? styles.iconRightSmall : styles.iconRight;\n};\n\nexport const LobeSwitchIcon = ({\n children,\n className,\n position,\n transition = { bounce: 0, type: 'spring' },\n ...rest\n}: LobeSwitchIconProps & { children?: React.ReactNode; size?: 'default' | 'small' }) => {\n const Motion = useMotionComponent();\n const { isChecked } = useLobeSwitchContext();\n const size = (rest as any).size || 'default';\n\n const isAnimated = useMemo(() => {\n if (position === 'right') return !isChecked;\n if (position === 'left') return isChecked;\n if (position === 'thumb') return true;\n return false;\n }, [position, isChecked]);\n\n const positionClass = getIconPositionClass(position, size);\n\n return (\n <Motion.span\n animate={isAnimated ? { opacity: 1, scale: 1 } : { opacity: 0, scale: 0 }}\n className={cx(styles.icon, positionClass, className)}\n transition={transition}\n {...rest}\n >\n {children}\n </Motion.span>\n );\n};\n\nLobeSwitchIcon.displayName = 'LobeSwitchIcon';\n\nexport { styles as lobeSwitchStyles } from './style';\n"],"mappings":";;;;;;;;;;;AAoBA,MAAM,oBAAoB,cAA4C,KAAK;AAE3E,MAAa,6BAA6B;CACxC,MAAM,UAAU,WAAW,kBAAkB;AAC7C,KAAI,CAAC,QACH,OAAM,IAAI,MAAM,4DAA4D;AAE9E,QAAO;;AAQT,MAAa,kBAAkB,EAC7B,SACA,WACA,gBACA,iBACA,SACA,OAAO,WACP,UACA,UACA,UACA,UACA,UACA,IACA,MACA,GAAG,WAC8B;CACjC,MAAM,SAAS,oBAAoB;CACnC,MAAM,CAAC,WAAW,gBAAgB,SAAS,MAAM;CACjD,MAAM,eAAe,OACnB,KACD;CAED,MAAM,CAAC,WAAW,gBAAgB,mBAAmB,kBAAkB,OAAO;EAC5E,cAAc;EACd,WAAW,UAAmB;AAC5B,OAAI,aAAa,QACf,mBAAkB,OAAO,aAAa,QAAQ;;EAGlD,OAAO;EACR,CAAC;CAEF,MAAM,gBAAgB,aAAa,EAAE,MAAM,CAAC;CAE5C,MAAM,eAAe,eACZ;EACL,W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B,OAAO;AACjF,QAAO,SAAS,UAAU,OAAO,iBAAiB,OAAO;;AAG3D,MAAa,kBAAkB,EAC7B,UACA,WACA,UACA,aAAa;CAAE,QAAQ;CAAG,MAAM;CAAU,EAC1C,GAAG,WACmF;CACtF,MAAM,SAAS,oBAAoB;CACnC,MAAM,EAAE,cAAc,sBAAsB;CAC5C,MAAM,OAAQ,KAAa,QAAQ;CAEnC,MAAM,aAAa,cAAc;AAC/B,MAAI,aAAa,QAAS,QAAO,CAAC;AAClC,MAAI,aAAa,OAAQ,QAAO;AAChC,MAAI,aAAa,QAAS,QAAO;AACjC,SAAO;IACN,CAAC,UAAU,UAAU,CAAC;CAEzB,MAAM,gBAAgB,qBAAqB,UAAU,KAAK;AAE1D,QACE,oBAAC,OAAO;EACN,SAAS,aAAa;GAAE,SAAS;GAAG,OAAO;GAAG,GAAG;GAAE,SAAS;GAAG,OAAO;GAAG;EACzE,WAAW,GAAG,OAAO,MAAM,eAAe,UAAU;EACxC;EACZ,GAAI;EAEH;GACW;;AAIlB,eAAe,cAAc"}
1
+ {"version":3,"file":"atoms.mjs","names":["useControlledState"],"sources":["../../src/LobeSwitch/atoms.tsx"],"sourcesContent":["'use client';\n\nimport { Switch } from '@base-ui/react/switch';\nimport { cx } from 'antd-style';\nimport type { KeyboardEvent, MouseEvent } from 'react';\nimport { createContext, useContext, useMemo, useRef, useState } from 'react';\nimport useControlledState from 'use-merge-value';\n\nimport { useMotionComponent } from '@/MotionProvider';\n\nimport { rootVariants, styles, thumbVariants } from './style';\nimport type {\n LobeSwitchChangeEventHandler,\n LobeSwitchContextType,\n LobeSwitchIconPosition,\n LobeSwitchIconProps,\n LobeSwitchRootProps,\n LobeSwitchThumbProps,\n} from './type';\n\nconst LobeSwitchContext = createContext<LobeSwitchContextType | null>(null);\n\nexport const useLobeSwitchContext = () => {\n const context = useContext(LobeSwitchContext);\n if (!context) {\n throw new Error('useLobeSwitchContext must be used within a LobeSwitchRoot');\n }\n return context;\n};\n\ntype LobeSwitchRootInternalProps = Omit<LobeSwitchRootProps, 'onCheckedChange' | 'onClick'> & {\n onCheckedChange?: LobeSwitchChangeEventHandler;\n onClick?: LobeSwitchChangeEventHandler;\n};\n\nexport const LobeSwitchRoot = ({\n checked,\n className,\n defaultChecked,\n onCheckedChange,\n onClick,\n size = 'default',\n children,\n disabled,\n readOnly,\n required,\n inputRef,\n id,\n name,\n ...rest\n}: LobeSwitchRootInternalProps) => {\n const Motion = useMotionComponent();\n const [isPressed, setIsPressed] = useState(false);\n const lastEventRef = useRef<MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLButtonElement>>(\n null,\n );\n\n const [isChecked, setIsChecked] = useControlledState(defaultChecked ?? false, {\n defaultValue: defaultChecked,\n onChange: (value: boolean) => {\n if (lastEventRef.current) {\n onCheckedChange?.(value, lastEventRef.current);\n }\n },\n value: checked,\n });\n\n const baseClassName = rootVariants({ size });\n\n const contextValue = useMemo(\n () => ({\n isChecked: Boolean(isChecked),\n isPressed,\n setIsChecked: (value: boolean) => setIsChecked(value),\n setIsPressed,\n }),\n [isChecked, isPressed, setIsChecked],\n );\n\n const handleClick = (event: MouseEvent<HTMLButtonElement>) => {\n lastEventRef.current = event;\n onClick?.(!isChecked, event);\n };\n\n const handleKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {\n if (event.key === 'Enter' || event.key === ' ') {\n lastEventRef.current = event;\n }\n (rest as any).onKeyDown?.(event);\n };\n\n return (\n <LobeSwitchContext.Provider value={contextValue}>\n <Switch.Root\n checked={isChecked}\n defaultChecked={defaultChecked}\n disabled={disabled}\n id={id}\n inputRef={inputRef}\n name={name}\n onCheckedChange={setIsChecked}\n readOnly={readOnly}\n render={\n <Motion.button\n {...rest}\n className={cx(baseClassName, className)}\n initial={false}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n onTap={() => setIsPressed(false)}\n onTapCancel={() => setIsPressed(false)}\n onTapStart={() => setIsPressed(true)}\n whileTap=\"tap\"\n />\n }\n required={required}\n >\n {children}\n </Switch.Root>\n </LobeSwitchContext.Provider>\n );\n};\n\nLobeSwitchRoot.displayName = 'LobeSwitchRoot';\n\nexport const LobeSwitchThumb = ({\n className,\n pressedAnimation,\n size = 'default',\n transition = { damping: 25, stiffness: 300, type: 'spring' },\n children,\n ...rest\n}: LobeSwitchThumbProps) => {\n const Motion = useMotionComponent();\n const { isPressed } = useLobeSwitchContext();\n const baseClassName = thumbVariants({ size });\n\n const defaultPressedAnimation = {\n width: size === 'small' ? 16 : 22,\n };\n\n return (\n <Switch.Thumb\n render={\n <Motion.span\n animate={isPressed ? pressedAnimation || defaultPressedAnimation : undefined}\n className={cx(baseClassName, className)}\n layout\n transition={transition}\n {...rest}\n >\n {children}\n </Motion.span>\n }\n />\n );\n};\n\nLobeSwitchThumb.displayName = 'LobeSwitchThumb';\n\nconst getIconPositionClass = (position: LobeSwitchIconPosition, size: 'default' | 'small') => {\n if (position === 'thumb') return styles.iconThumb;\n if (position === 'left') return size === 'small' ? styles.iconLeftSmall : styles.iconLeft;\n return size === 'small' ? styles.iconRightSmall : styles.iconRight;\n};\n\nexport const LobeSwitchIcon = ({\n children,\n className,\n position,\n transition = { bounce: 0, type: 'spring' },\n ...rest\n}: LobeSwitchIconProps & { children?: React.ReactNode; size?: 'default' | 'small' }) => {\n const Motion = useMotionComponent();\n const { isChecked } = useLobeSwitchContext();\n const size = (rest as any).size || 'default';\n\n const isAnimated = useMemo(() => {\n if (position === 'right') return !isChecked;\n if (position === 'left') return isChecked;\n if (position === 'thumb') return true;\n return false;\n }, [position, isChecked]);\n\n const positionClass = getIconPositionClass(position, size);\n\n return (\n <Motion.span\n animate={isAnimated ? { opacity: 1, scale: 1 } : { opacity: 0, scale: 0 }}\n className={cx(styles.icon, positionClass, className)}\n transition={transition}\n {...rest}\n >\n {children}\n </Motion.span>\n );\n};\n\nLobeSwitchIcon.displayName = 'LobeSwitchIcon';\n\nexport { styles as lobeSwitchStyles } from './style';\n"],"mappings":";;;;;;;;;;;AAoBA,MA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lB,eAAe,cAAc"}
@@ -1,8 +1,8 @@
1
1
  import { MarkdownProps } from "./type.mjs";
2
- import * as react59 from "react";
2
+ import * as react13 from "react";
3
3
 
4
4
  //#region src/Markdown/Markdown.d.ts
5
- declare const Markdown: react59.NamedExoticComponent<MarkdownProps>;
5
+ declare const Markdown: react13.NamedExoticComponent<MarkdownProps>;
6
6
  //#endregion
7
7
  export { Markdown };
8
8
  //# sourceMappingURL=Markdown.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { TypographyProps } from "./type.mjs";
2
- import * as react60 from "react";
2
+ import * as react12 from "react";
3
3
 
4
4
  //#region src/Markdown/Typography.d.ts
5
- declare const Typography: react60.NamedExoticComponent<TypographyProps>;
5
+ declare const Typography: react12.NamedExoticComponent<TypographyProps>;
6
6
  //#endregion
7
7
  export { Typography };
8
8
  //# sourceMappingURL=Typography.d.mts.map
@@ -1,6 +1,6 @@
1
1
  import { FlexboxProps } from "../../../Flex/type.mjs";
2
2
  import "../../../Flex/index.mjs";
3
- import * as react83 from "react";
3
+ import * as react63 from "react";
4
4
  import { Ref } from "react";
5
5
 
6
6
  //#region src/Markdown/components/SearchResultCards/index.d.ts
@@ -14,7 +14,7 @@ interface SearchResultCardsProps extends FlexboxProps {
14
14
  dataSource: string[] | SearchResultItem[];
15
15
  ref?: Ref<HTMLDivElement>;
16
16
  }
17
- declare const SearchResultCards: react83.NamedExoticComponent<SearchResultCardsProps>;
17
+ declare const SearchResultCards: react63.NamedExoticComponent<SearchResultCardsProps>;
18
18
  //#endregion
19
19
  export { SearchResultCards, SearchResultCardsProps };
20
20
  //# sourceMappingURL=index.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { MaskShadowProps } from "./type.mjs";
2
- import * as react4 from "react";
2
+ import * as react21 from "react";
3
3
 
4
4
  //#region src/MaskShadow/MaskShadow.d.ts
5
- declare const MaskShadow: react4.NamedExoticComponent<MaskShadowProps>;
5
+ declare const MaskShadow: react21.NamedExoticComponent<MaskShadowProps>;
6
6
  //#endregion
7
7
  export { MaskShadow };
8
8
  //# sourceMappingURL=MaskShadow.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { MenuProps } from "./type.mjs";
2
- import * as react2 from "react";
2
+ import * as react36 from "react";
3
3
 
4
4
  //#region src/Menu/Menu.d.ts
5
- declare const Menu: react2.NamedExoticComponent<MenuProps<unknown>>;
5
+ declare const Menu: react36.NamedExoticComponent<MenuProps<unknown>>;
6
6
  //#endregion
7
7
  export { Menu };
8
8
  //# sourceMappingURL=Menu.d.mts.map
@@ -1,16 +1,34 @@
1
1
  import { MenuCheckboxItemType } from "./checkboxItem.mjs";
2
2
  import { MenuSwitchItemType } from "./switchItem.mjs";
3
- import { GenericItemType } from "./type.mjs";
3
+ import { MenuDividerType, MenuItemType, SubMenuType } from "./type.mjs";
4
+ import { Key, ReactNode } from "react";
4
5
 
5
6
  //#region src/Menu/baseItem.d.ts
6
7
 
8
+ /**
9
+ * Group type for Base UI driven menus (DropdownMenu / ContextMenu).
10
+ * Unlike MenuItemGroupType, this supports checkbox/switch items in children.
11
+ */
12
+ interface BaseMenuItemGroupType {
13
+ children?: BaseMenuItemType[];
14
+ key?: Key;
15
+ label?: ReactNode;
16
+ type: 'group';
17
+ }
18
+ /**
19
+ * Submenu type for Base UI driven menus (DropdownMenu / ContextMenu).
20
+ * Unlike SubMenuType, this supports checkbox/switch items in children.
21
+ */
22
+ interface BaseSubMenuType extends Omit<SubMenuType, 'children'> {
23
+ children?: BaseMenuItemType[];
24
+ }
7
25
  /**
8
26
  * Base item union for Base UI driven menus (DropdownMenu / ContextMenu).
9
27
  *
10
28
  * Note: This intentionally does NOT change `GenericItemType` itself,
11
29
  * because `GenericItemType` maps to rc-menu/antd Menu item types.
12
30
  */
13
- type BaseMenuItemType<T = unknown> = GenericItemType<T> | MenuCheckboxItemType | MenuSwitchItemType;
31
+ type BaseMenuItemType = MenuItemType | BaseSubMenuType | BaseMenuItemGroupType | MenuDividerType | MenuCheckboxItemType | MenuSwitchItemType | null;
14
32
  //#endregion
15
- export { BaseMenuItemType };
33
+ export { BaseMenuItemGroupType, BaseMenuItemType, BaseSubMenuType };
16
34
  //# sourceMappingURL=baseItem.d.mts.map
@@ -1,7 +1,8 @@
1
1
  import { MenuCheckboxItemType } from "./checkboxItem.mjs";
2
2
  import { MenuSwitchItemType } from "./switchItem.mjs";
3
3
  import { GenericItemType, ItemType, MenuDividerType, MenuInfo, MenuItemGroupType, MenuItemType, MenuProps, SubMenuType } from "./type.mjs";
4
- import { BaseMenuItemType } from "./baseItem.mjs";
4
+ import { BaseMenuItemGroupType, BaseMenuItemType, BaseSubMenuType } from "./baseItem.mjs";
5
5
  import { Menu } from "./Menu.mjs";
6
+ import { IconSpaceMode, RenderItemContentOptions, RenderOptions, getItemKey, getItemLabel, hasAnyIcon, hasCheckboxAndIcon, renderIcon } from "./renderUtils.mjs";
6
7
  import { mapItems } from "./utils.mjs";
7
- export { type BaseMenuItemType, GenericItemType, ItemType, type MenuCheckboxItemType, MenuDividerType, MenuInfo, MenuItemGroupType, MenuItemType, MenuProps, type MenuSwitchItemType, SubMenuType, Menu as default, mapItems };
8
+ export { type BaseMenuItemGroupType, type BaseMenuItemType, type BaseSubMenuType, GenericItemType, type IconSpaceMode, ItemType, type MenuCheckboxItemType, MenuDividerType, MenuInfo, MenuItemGroupType, MenuItemType, MenuProps, type MenuSwitchItemType, type RenderItemContentOptions, type RenderOptions, SubMenuType, Menu as default, getItemKey, getItemLabel, hasAnyIcon, hasCheckboxAndIcon, mapItems, renderIcon };
package/es/Menu/index.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  import { mapItems } from "./utils.mjs";
2
2
  import Menu_default from "./Menu.mjs";
3
+ import { getItemKey, getItemLabel, hasAnyIcon, hasCheckboxAndIcon, renderIcon } from "./renderUtils.mjs";
3
4
 
4
- export { Menu_default as default, mapItems };
5
+ export { Menu_default as default, getItemKey, getItemLabel, hasAnyIcon, hasCheckboxAndIcon, mapItems, renderIcon };
@@ -0,0 +1,35 @@
1
+ import { IconSize } from "../Icon/type.mjs";
2
+ import "../Icon/index.mjs";
3
+ import { MenuCheckboxItemType } from "./checkboxItem.mjs";
4
+ import { MenuItemType, SubMenuType } from "./type.mjs";
5
+ import { BaseMenuItemType } from "./baseItem.mjs";
6
+ import { Key, ReactNode } from "react";
7
+
8
+ //#region src/Menu/renderUtils.d.ts
9
+ type IconSpaceMode = 'global' | 'group';
10
+ interface RenderOptions {
11
+ iconSpaceMode?: IconSpaceMode;
12
+ indicatorOnRight?: boolean;
13
+ reserveIconSpace?: boolean;
14
+ }
15
+ interface RenderItemContentOptions {
16
+ indicatorOnRight?: boolean;
17
+ reserveIconSpace?: boolean;
18
+ submenu?: boolean;
19
+ }
20
+ type KeyableItem = {
21
+ key?: Key;
22
+ };
23
+ declare const getItemKey: (item: KeyableItem, fallback: string) => Key;
24
+ type LabelableItem = {
25
+ key?: Key;
26
+ label?: ReactNode;
27
+ title?: ReactNode;
28
+ };
29
+ declare const getItemLabel: (item: MenuItemType | SubMenuType | MenuCheckboxItemType | LabelableItem) => ReactNode;
30
+ declare const renderIcon: (icon: MenuItemType["icon"], size?: IconSize) => ReactNode;
31
+ declare const hasAnyIcon: (items: BaseMenuItemType[], recursive?: boolean) => boolean;
32
+ declare const hasCheckboxAndIcon: (items: BaseMenuItemType[]) => boolean;
33
+ //#endregion
34
+ export { IconSpaceMode, RenderItemContentOptions, RenderOptions, getItemKey, getItemLabel, hasAnyIcon, hasCheckboxAndIcon, renderIcon };
35
+ //# sourceMappingURL=renderUtils.d.mts.map
@@ -0,0 +1,46 @@
1
+ import Icon_default from "../Icon/Icon.mjs";
2
+ import { isValidElement } from "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+
5
+ //#region src/Menu/renderUtils.tsx
6
+ const getItemKey = (item, fallback) => {
7
+ if (item && "key" in item && item.key !== void 0) return item.key;
8
+ return fallback;
9
+ };
10
+ const getItemLabel = (item) => {
11
+ if (item.label !== void 0) return item.label;
12
+ if ("title" in item && item.title !== void 0) return item.title;
13
+ return item.key;
14
+ };
15
+ const renderIcon = (icon, size) => {
16
+ if (!icon) return null;
17
+ if (isValidElement(icon)) return icon;
18
+ return /* @__PURE__ */ jsx(Icon_default, {
19
+ icon,
20
+ size
21
+ });
22
+ };
23
+ const hasAnyIcon = (items, recursive = false) => {
24
+ return items.some((item) => {
25
+ if (!item) return false;
26
+ if (item.type === "checkbox") return true;
27
+ if ("icon" in item && item.icon) return true;
28
+ if (recursive && "children" in item && item.children) return hasAnyIcon(item.children, true);
29
+ return false;
30
+ });
31
+ };
32
+ const hasCheckboxAndIcon = (items) => {
33
+ let hasCheckbox = false;
34
+ let hasIcon = false;
35
+ for (const item of items) {
36
+ if (!item) continue;
37
+ if (item.type === "checkbox") hasCheckbox = true;
38
+ if ("icon" in item && item.icon) hasIcon = true;
39
+ if (hasCheckbox && hasIcon) return true;
40
+ }
41
+ return false;
42
+ };
43
+
44
+ //#endregion
45
+ export { getItemKey, getItemLabel, hasAnyIcon, hasCheckboxAndIcon, renderIcon };
46
+ //# sourceMappingURL=renderUtils.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderUtils.mjs","names":["Icon"],"sources":["../../src/Menu/renderUtils.tsx"],"sourcesContent":["import type { Key, ReactNode } from 'react';\nimport { isValidElement } from 'react';\n\nimport Icon, { type IconSize } from '@/Icon';\n\nimport type { BaseMenuItemType } from './baseItem';\nimport type { MenuCheckboxItemType } from './checkboxItem';\nimport type { MenuItemType, SubMenuType } from './type';\n\nexport type IconSpaceMode = 'global' | 'group';\n\nexport interface RenderOptions {\n iconSpaceMode?: IconSpaceMode;\n indicatorOnRight?: boolean;\n reserveIconSpace?: boolean;\n}\n\nexport interface RenderItemContentOptions {\n indicatorOnRight?: boolean;\n reserveIconSpace?: boolean;\n submenu?: boolean;\n}\n\ntype KeyableItem = { key?: Key };\n\nexport const 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\nexport const getItemLabel = (\n item: MenuItemType | SubMenuType | MenuCheckboxItemType | 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\nexport const renderIcon = (icon: MenuItemType['icon'], size?: IconSize): ReactNode => {\n if (!icon) return null;\n if (isValidElement(icon)) return icon;\n return <Icon icon={icon} size={size} />;\n};\n\nexport const hasAnyIcon = (items: BaseMenuItemType[], recursive = false): boolean => {\n return items.some((item) => {\n if (!item) return false;\n if ((item as MenuCheckboxItemType).type === 'checkbox') return true;\n if ('icon' in item && item.icon) return true;\n if (recursive && 'children' in item && item.children) {\n return hasAnyIcon(item.children as BaseMenuItemType[], true);\n }\n return false;\n });\n};\n\nexport const hasCheckboxAndIcon = (items: BaseMenuItemType[]): boolean => {\n let hasCheckbox = false;\n let hasIcon = false;\n for (const item of items) {\n if (!item) continue;\n if ((item as MenuCheckboxItemType).type === 'checkbox') {\n hasCheckbox = true;\n }\n if ('icon' in item && item.icon) {\n hasIcon = true;\n }\n if (hasCheckbox && hasIcon) return true;\n }\n return false;\n};\n"],"mappings":";;;;;AAyBA,MAAa,cAAc,MAAmB,aAA0B;AACtE,KAAI,QAAQ,SAAS,QAAQ,KAAK,QAAQ,OAAW,QAAO,KAAK;AACjE,QAAO;;AAST,MAAa,gBACX,SACc;AACd,KAAI,KAAK,UAAU,OAAW,QAAO,KAAK;AAC1C,KAAI,WAAW,QAAQ,KAAK,UAAU,OAAW,QAAO,KAAK;AAC7D,QAAO,KAAK;;AAGd,MAAa,cAAc,MAA4B,SAA+B;AACpF,KAAI,CAAC,KAAM,QAAO;AAClB,KAAI,eAAe,KAAK,CAAE,QAAO;AACjC,QAAO,oBAACA;EAAW;EAAY;GAAQ;;AAGzC,MAAa,cAAc,OAA2B,YAAY,UAAmB;AACnF,QAAO,MAAM,MAAM,SAAS;AAC1B,MAAI,CAAC,KAAM,QAAO;AAClB,MAAK,KAA8B,SAAS,WAAY,QAAO;AAC/D,MAAI,UAAU,QAAQ,KAAK,KAAM,QAAO;AACxC,MAAI,aAAa,cAAc,QAAQ,KAAK,SAC1C,QAAO,WAAW,KAAK,UAAgC,KAAK;AAE9D,SAAO;GACP;;AAGJ,MAAa,sBAAsB,UAAuC;CACxE,IAAI,cAAc;CAClB,IAAI,UAAU;AACd,MAAK,MAAM,QAAQ,OAAO;AACxB,MAAI,CAAC,KAAM;AACX,MAAK,KAA8B,SAAS,WAC1C,eAAc;AAEhB,MAAI,UAAU,QAAQ,KAAK,KACzB,WAAU;AAEZ,MAAI,eAAe,QAAS,QAAO;;AAErC,QAAO"}
@@ -1,8 +1,8 @@
1
1
  import { MermaidProps } from "./type.mjs";
2
- import * as react8 from "react";
2
+ import * as react32 from "react";
3
3
 
4
4
  //#region src/Mermaid/Mermaid.d.ts
5
- declare const Mermaid: react8.NamedExoticComponent<MermaidProps>;
5
+ declare const Mermaid: react32.NamedExoticComponent<MermaidProps>;
6
6
  //#endregion
7
7
  export { Mermaid };
8
8
  //# sourceMappingURL=Mermaid.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { SyntaxMermaidProps } from "../type.mjs";
2
- import * as react9 from "react";
2
+ import * as react33 from "react";
3
3
 
4
4
  //#region src/Mermaid/SyntaxMermaid/index.d.ts
5
- declare const SyntaxMermaid: react9.NamedExoticComponent<SyntaxMermaidProps>;
5
+ declare const SyntaxMermaid: react33.NamedExoticComponent<SyntaxMermaidProps>;
6
6
  //#endregion
7
7
  export { SyntaxMermaid };
8
8
  //# sourceMappingURL=index.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { ModalProps } from "./type.mjs";
2
- import * as react43 from "react";
2
+ import * as react25 from "react";
3
3
 
4
4
  //#region src/Modal/Modal.d.ts
5
- declare const Modal: react43.NamedExoticComponent<ModalProps>;
5
+ declare const Modal: react25.NamedExoticComponent<ModalProps>;
6
6
  //#endregion
7
7
  export { Modal };
8
8
  //# sourceMappingURL=Modal.d.mts.map
@@ -1,9 +1,9 @@
1
1
  import { ModalContextValue } from "./type.mjs";
2
- import * as react44 from "react";
2
+ import * as react26 from "react";
3
3
  import { ReactNode } from "react";
4
4
 
5
5
  //#region src/Modal/ModalProvider.d.ts
6
- declare const ModalProvider: react44.NamedExoticComponent<{
6
+ declare const ModalProvider: react26.NamedExoticComponent<{
7
7
  children: ReactNode;
8
8
  value: ModalContextValue;
9
9
  }>;
@@ -1,5 +1,5 @@
1
1
  import { ImperativeModalProps, ModalInstance, RawModalComponent, RawModalComponentProps, RawModalInstance, RawModalKeyOptions, RawModalOptions } from "./type.mjs";
2
- import * as react_jsx_runtime13 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/Modal/imperative.d.ts
5
5
  type ModalHostProps = {
@@ -7,7 +7,7 @@ type ModalHostProps = {
7
7
  };
8
8
  declare const ModalHost: ({
9
9
  root
10
- }: ModalHostProps) => react_jsx_runtime13.JSX.Element | null;
10
+ }: ModalHostProps) => react_jsx_runtime0.JSX.Element | null;
11
11
  declare const createModal: (props: ImperativeModalProps) => ModalInstance;
12
12
  declare function createRawModal<P extends RawModalComponentProps>(component: RawModalComponent<P>, props: Omit<P, 'open' | 'onClose'>, options?: RawModalOptions): RawModalInstance<P>;
13
13
  declare function createRawModal<P, OpenKey extends keyof P, CloseKey extends keyof P>(component: RawModalComponent<P>, props: Omit<P, OpenKey | CloseKey>, options: RawModalKeyOptions<OpenKey, CloseKey>): RawModalInstance<P, OpenKey, CloseKey>;
@@ -1,4 +1,4 @@
1
- import * as react85 from "react";
1
+ import * as react64 from "react";
2
2
  import { Context, ReactNode } from "react";
3
3
  import * as motion_react0 from "motion/react";
4
4
  import * as m from "motion/react-m";
@@ -6,7 +6,7 @@ import * as m from "motion/react-m";
6
6
  //#region src/MotionProvider/index.d.ts
7
7
  type MotionComponentType = typeof motion_react0.motion | typeof m;
8
8
  declare const MotionComponent: Context<MotionComponentType>;
9
- declare const MotionProvider: react85.NamedExoticComponent<{
9
+ declare const MotionProvider: react64.NamedExoticComponent<{
10
10
  children: ReactNode;
11
11
  motion: MotionComponentType;
12
12
  }>;
@@ -1,7 +1,7 @@
1
- import * as react_jsx_runtime14 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/Popover/ArrowIcon.d.ts
4
- declare const PopoverArrowIcon: react_jsx_runtime14.JSX.Element;
4
+ declare const PopoverArrowIcon: react_jsx_runtime0.JSX.Element;
5
5
  //#endregion
6
6
  export { PopoverArrowIcon };
7
7
  //# sourceMappingURL=ArrowIcon.d.mts.map
@@ -1,13 +1,13 @@
1
1
  import { PopoverPlacement } from "./type.mjs";
2
- import * as react68 from "react";
2
+ import * as react28 from "react";
3
3
  import { ComponentProps, ComponentPropsWithRef } from "react";
4
- import * as react_jsx_runtime15 from "react/jsx-runtime";
4
+ import * as react_jsx_runtime1 from "react/jsx-runtime";
5
5
  import * as _base_ui_react_popover0 from "@base-ui/react/popover";
6
6
  import { Popover } from "@base-ui/react/popover";
7
7
 
8
8
  //#region src/Popover/atoms.d.ts
9
9
  declare const PopoverRoot: typeof Popover.Root;
10
- declare const PopoverBackdrop: react68.ForwardRefExoticComponent<_base_ui_react_popover0.PopoverBackdropProps & react68.RefAttributes<HTMLDivElement>>;
10
+ declare const PopoverBackdrop: react28.ForwardRefExoticComponent<_base_ui_react_popover0.PopoverBackdropProps & react28.RefAttributes<HTMLDivElement>>;
11
11
  type PopoverTriggerElementProps = Omit<ComponentPropsWithRef<typeof Popover.Trigger>, 'children' | 'render'> & {
12
12
  children: ComponentProps<typeof Popover.Trigger>['children'];
13
13
  };
@@ -18,7 +18,7 @@ declare const PopoverTriggerElement: {
18
18
  nativeButton,
19
19
  ref: refProp,
20
20
  ...rest
21
- }: PopoverTriggerElementProps): react_jsx_runtime15.JSX.Element;
21
+ }: PopoverTriggerElementProps): react_jsx_runtime1.JSX.Element;
22
22
  displayName: string;
23
23
  };
24
24
  type PopoverPortalAtomProps = Omit<ComponentProps<typeof Popover.Portal>, 'container'> & {
@@ -37,7 +37,7 @@ declare const PopoverPortal: {
37
37
  root,
38
38
  children,
39
39
  ...rest
40
- }: PopoverPortalAtomProps): react_jsx_runtime15.JSX.Element | null;
40
+ }: PopoverPortalAtomProps): react_jsx_runtime1.JSX.Element | null;
41
41
  displayName: string;
42
42
  };
43
43
  type PopoverPositionerAtomProps = ComponentProps<typeof Popover.Positioner> & {
@@ -54,7 +54,7 @@ declare const PopoverPositioner: {
54
54
  side,
55
55
  sideOffset,
56
56
  ...rest
57
- }: PopoverPositionerAtomProps): react_jsx_runtime15.JSX.Element;
57
+ }: PopoverPositionerAtomProps): react_jsx_runtime1.JSX.Element;
58
58
  displayName: string;
59
59
  };
60
60
  type PopoverPopupAtomProps = ComponentProps<typeof Popover.Popup>;
@@ -62,7 +62,7 @@ declare const PopoverPopup: {
62
62
  ({
63
63
  className,
64
64
  ...rest
65
- }: PopoverPopupAtomProps): react_jsx_runtime15.JSX.Element;
65
+ }: PopoverPopupAtomProps): react_jsx_runtime1.JSX.Element;
66
66
  displayName: string;
67
67
  };
68
68
  type PopoverArrowAtomProps = ComponentProps<typeof Popover.Arrow>;
@@ -71,7 +71,7 @@ declare const PopoverArrow: {
71
71
  className,
72
72
  children,
73
73
  ...rest
74
- }: PopoverArrowAtomProps): react_jsx_runtime15.JSX.Element;
74
+ }: PopoverArrowAtomProps): react_jsx_runtime1.JSX.Element;
75
75
  displayName: string;
76
76
  };
77
77
  type PopoverViewportAtomProps = ComponentProps<typeof Popover.Viewport>;
@@ -79,7 +79,7 @@ declare const PopoverViewport: {
79
79
  ({
80
80
  className,
81
81
  ...rest
82
- }: PopoverViewportAtomProps): react_jsx_runtime15.JSX.Element;
82
+ }: PopoverViewportAtomProps): react_jsx_runtime1.JSX.Element;
83
83
  displayName: string;
84
84
  };
85
85
  //#endregion