@lobehub/ui 4.35.3 → 4.36.1

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 (163) 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/Avatar/Avatar.mjs +1 -1
  6. package/es/Avatar/AvatarGroup/index.d.mts +2 -2
  7. package/es/Burger/Burger.d.mts +2 -2
  8. package/es/CodeDiff/CodeDiff.d.mts +2 -2
  9. package/es/CodeDiff/PatchDiff.d.mts +2 -2
  10. package/es/CodeEditor/CodeEditor.d.mts +2 -2
  11. package/es/Collapse/Collapse.d.mts +2 -2
  12. package/es/ColorSwatches/ColorSwatches.mjs +1 -1
  13. package/es/ConfigProvider/index.d.mts +2 -2
  14. package/es/ContextMenu/ContextMenuHost.d.mts +3 -3
  15. package/es/ContextMenu/ContextMenuHost.mjs +14 -9
  16. package/es/ContextMenu/ContextMenuHost.mjs.map +1 -1
  17. package/es/CopyButton/CopyButton.d.mts +2 -2
  18. package/es/DatePicker/DatePicker.d.mts +2 -2
  19. package/es/DraggablePanel/components/DraggablePanelBody.d.mts +2 -2
  20. package/es/DraggablePanel/components/DraggablePanelContainer.d.mts +2 -2
  21. package/es/DraggablePanel/components/DraggablePanelFooter.d.mts +2 -2
  22. package/es/DraggablePanel/components/DraggablePanelHeader.d.mts +2 -2
  23. package/es/DraggableSideNav/DraggableSideNav.d.mts +2 -2
  24. package/es/Drawer/Drawer.d.mts +2 -2
  25. package/es/Dropdown/Dropdown.d.mts +2 -2
  26. package/es/DropdownMenu/DropdownMenu.d.mts +2 -2
  27. package/es/DropdownMenu/atoms.d.mts +18 -18
  28. package/es/DropdownMenu/atoms.mjs +4 -2
  29. package/es/DropdownMenu/atoms.mjs.map +1 -1
  30. package/es/EditableText/EditableText.d.mts +2 -2
  31. package/es/EditorSlashMenu/atoms.d.mts +20 -14
  32. package/es/EditorSlashMenu/atoms.mjs +8 -1
  33. package/es/EditorSlashMenu/atoms.mjs.map +1 -1
  34. package/es/EmojiPicker/EmojiPicker.d.mts +2 -2
  35. package/es/Flex/FlexBasic.d.mts +2 -2
  36. package/es/FontLoader/index.d.mts +2 -2
  37. package/es/Footer/Footer.d.mts +2 -2
  38. package/es/Form/components/FormGroup.d.mts +2 -2
  39. package/es/Form/components/FormItem.d.mts +2 -2
  40. package/es/Form/components/FormSubmitFooter.d.mts +2 -2
  41. package/es/FormModal/FormModal.d.mts +2 -2
  42. package/es/Freeze/Freeze.d.mts +2 -2
  43. package/es/GuideCard/GuideCard.d.mts +2 -2
  44. package/es/Header/Header.d.mts +2 -2
  45. package/es/Highlighter/Highlighter.d.mts +2 -2
  46. package/es/Highlighter/SyntaxHighlighter/index.d.mts +2 -2
  47. package/es/Hotkey/Hotkey.d.mts +2 -2
  48. package/es/HotkeyInput/HotkeyInput.d.mts +2 -2
  49. package/es/Icon/Icon.d.mts +2 -2
  50. package/es/Icon/components/IconProvider.d.mts +3 -3
  51. package/es/Image/PreviewGroup.d.mts +2 -2
  52. package/es/ImageSelect/ImageSelect.d.mts +2 -2
  53. package/es/Input/Input.d.mts +2 -2
  54. package/es/Input/InputNumber.d.mts +2 -2
  55. package/es/Input/InputOPT.d.mts +2 -2
  56. package/es/Input/InputPassword.d.mts +2 -2
  57. package/es/Input/TextArea.d.mts +2 -2
  58. package/es/Layout/components/LayoutFooter.d.mts +2 -2
  59. package/es/Layout/components/LayoutHeader.d.mts +2 -2
  60. package/es/Layout/components/LayoutMain.d.mts +2 -2
  61. package/es/Layout/components/LayoutSidebar.d.mts +2 -2
  62. package/es/Layout/components/LayoutSidebarInner.d.mts +2 -2
  63. package/es/Layout/components/LayoutToc.d.mts +2 -2
  64. package/es/List/ListItem/index.d.mts +2 -2
  65. package/es/LobeSelect/LobeSelect.d.mts +2 -2
  66. package/es/LobeSelect/atoms.d.mts +19 -19
  67. package/es/LobeSelect/atoms.mjs +3 -1
  68. package/es/LobeSelect/atoms.mjs.map +1 -1
  69. package/es/LobeSwitch/LobeSwitch.d.mts +2 -2
  70. package/es/LobeSwitch/atoms.d.mts +4 -4
  71. package/es/Markdown/Markdown.d.mts +2 -2
  72. package/es/Markdown/Typography.d.mts +2 -2
  73. package/es/Markdown/components/SearchResultCards/index.d.mts +2 -2
  74. package/es/MaskShadow/MaskShadow.d.mts +2 -2
  75. package/es/Menu/Menu.d.mts +2 -2
  76. package/es/Mermaid/Mermaid.d.mts +2 -2
  77. package/es/Mermaid/SyntaxMermaid/index.d.mts +2 -2
  78. package/es/Modal/Modal.d.mts +2 -2
  79. package/es/Modal/ModalProvider.d.mts +2 -2
  80. package/es/Modal/imperative.d.mts +2 -2
  81. package/es/Modal/imperative.mjs +4 -24
  82. package/es/Modal/imperative.mjs.map +1 -1
  83. package/es/MotionProvider/index.d.mts +2 -2
  84. package/es/Popover/ArrowIcon.d.mts +2 -2
  85. package/es/Popover/PopoverPortal.mjs +4 -28
  86. package/es/Popover/PopoverPortal.mjs.map +1 -1
  87. package/es/Popover/atoms.d.mts +9 -9
  88. package/es/Popover/context.d.mts +2 -2
  89. package/es/ScrollArea/atoms.d.mts +7 -7
  90. package/es/SearchBar/SearchBar.d.mts +2 -2
  91. package/es/Segmented/Segmented.d.mts +2 -2
  92. package/es/Select/Select.d.mts +2 -2
  93. package/es/SideNav/SideNav.d.mts +2 -2
  94. package/es/SliderWithInput/SliderWithInput.d.mts +2 -2
  95. package/es/SortableList/components/DragHandle.d.mts +2 -2
  96. package/es/SortableList/components/SortableItem.d.mts +2 -2
  97. package/es/ThemeProvider/AppElementContext.d.mts +7 -0
  98. package/es/ThemeProvider/AppElementContext.mjs +14 -0
  99. package/es/ThemeProvider/AppElementContext.mjs.map +1 -0
  100. package/es/ThemeProvider/ThemeProvider.d.mts +2 -2
  101. package/es/ThemeProvider/ThemeProvider.mjs +9 -34
  102. package/es/ThemeProvider/ThemeProvider.mjs.map +1 -1
  103. package/es/ThemeProvider/index.d.mts +2 -1
  104. package/es/ThemeProvider/index.mjs +2 -1
  105. package/es/Toast/imperative.d.mts +3 -3
  106. package/es/Toc/Toc.d.mts +2 -2
  107. package/es/Tooltip/TooltipGroup.mjs +3 -3
  108. package/es/Tooltip/TooltipGroup.mjs.map +1 -1
  109. package/es/Tooltip/TooltipStandalone.mjs +3 -3
  110. package/es/Tooltip/TooltipStandalone.mjs.map +1 -1
  111. package/es/Video/index.d.mts +2 -2
  112. package/es/awesome/AuroraBackground/AuroraBackground.d.mts +2 -2
  113. package/es/awesome/BottomGradientButton/BottomGradientButton.d.mts +2 -2
  114. package/es/awesome/Features/Features.d.mts +2 -2
  115. package/es/awesome/Giscus/Giscus.d.mts +2 -2
  116. package/es/awesome/GradientButton/GradientButton.d.mts +2 -2
  117. package/es/awesome/GridBackground/GridBackground.d.mts +2 -2
  118. package/es/awesome/GridBackground/GridShowcase.d.mts +2 -2
  119. package/es/awesome/Hero/Hero.d.mts +2 -2
  120. package/es/awesome/Spline/Spine.d.mts +2 -2
  121. package/es/awesome/Spotlight/Spotlight.d.mts +2 -2
  122. package/es/awesome/SpotlightCard/SpotlightCard.d.mts +2 -2
  123. package/es/awesome/TypewriterEffect/TypewriterEffect.d.mts +2 -2
  124. package/es/brand/LobeChat/index.d.mts +2 -2
  125. package/es/brand/LobeHub/index.d.mts +2 -2
  126. package/es/brand/LogoThree/LogoSpline.d.mts +2 -2
  127. package/es/brand/LogoThree/index.d.mts +2 -2
  128. package/es/chat/BackBottom/BackBottom.d.mts +2 -2
  129. package/es/chat/ChatInputArea/components/ChatInputAreaInner.d.mts +2 -2
  130. package/es/chat/ChatItem/ChatItem.d.mts +2 -2
  131. package/es/chat/ChatList/ChatList.d.mts +2 -2
  132. package/es/chat/EditableMessage/EditableMessage.d.mts +2 -2
  133. package/es/chat/EditableMessageList/EditableMessageList.d.mts +2 -2
  134. package/es/chat/MessageInput/MessageInput.d.mts +2 -2
  135. package/es/chat/MessageModal/MessageModal.d.mts +2 -2
  136. package/es/color/ColorScales/index.d.mts +2 -2
  137. package/es/color/CssVar/index.d.mts +2 -2
  138. package/es/i18n/context.d.mts +2 -2
  139. package/es/icons/lucideExtra/BotPromptIcon.d.mts +2 -2
  140. package/es/icons/lucideExtra/CreateBotIcon.d.mts +3 -3
  141. package/es/icons/lucideExtra/DiscordIcon.d.mts +3 -3
  142. package/es/icons/lucideExtra/GlobeOffIcon.d.mts +2 -2
  143. package/es/icons/lucideExtra/GroupBotIcon.d.mts +2 -2
  144. package/es/icons/lucideExtra/GroupBotSquareIcon.d.mts +3 -3
  145. package/es/icons/lucideExtra/LeftClickIcon.d.mts +2 -2
  146. package/es/icons/lucideExtra/LeftDoubleClickIcon.d.mts +3 -3
  147. package/es/icons/lucideExtra/McpIcon.d.mts +3 -3
  148. package/es/icons/lucideExtra/ProviderIcon.d.mts +3 -3
  149. package/es/icons/lucideExtra/RightClickIcon.d.mts +2 -2
  150. package/es/icons/lucideExtra/RightDoubleClickIcon.d.mts +3 -3
  151. package/es/icons/lucideExtra/ShapesUploadIcon.d.mts +3 -3
  152. package/es/icons/lucideExtra/TreeDownRightIcon.d.mts +3 -3
  153. package/es/icons/lucideExtra/TreeUpDownRightIcon.d.mts +3 -3
  154. package/es/index.d.mts +2 -1
  155. package/es/index.mjs +7 -6
  156. package/es/mdx/Mdx/index.d.mts +2 -2
  157. package/es/mobile/ChatHeader/ChatHeaderTitle.d.mts +2 -2
  158. package/es/mobile/ChatInputArea/components/ChatSendButton.d.mts +2 -2
  159. package/es/mobile/TabBar/TabBar.d.mts +2 -2
  160. package/es/storybook/StoryBook/index.d.mts +2 -2
  161. package/package.json +1 -1
  162. package/es/Tooltip/TooltipPortal.mjs +0 -38
  163. package/es/Tooltip/TooltipPortal.mjs.map +0 -1
@@ -1,8 +1,8 @@
1
1
  import { LayoutSidebarInnerProps } from "../type.mjs";
2
- import * as react12 from "react";
2
+ import * as react70 from "react";
3
3
 
4
4
  //#region src/Layout/components/LayoutSidebarInner.d.ts
5
- declare const LayoutSidebarInner: react12.NamedExoticComponent<LayoutSidebarInnerProps>;
5
+ declare const LayoutSidebarInner: react70.NamedExoticComponent<LayoutSidebarInnerProps>;
6
6
  //#endregion
7
7
  export { LayoutSidebarInner };
8
8
  //# sourceMappingURL=LayoutSidebarInner.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { LayoutTocProps } from "../type.mjs";
2
- import * as react13 from "react";
2
+ import * as react71 from "react";
3
3
 
4
4
  //#region src/Layout/components/LayoutToc.d.ts
5
- declare const LayoutToc: react13.NamedExoticComponent<LayoutTocProps>;
5
+ declare const LayoutToc: react71.NamedExoticComponent<LayoutTocProps>;
6
6
  //#endregion
7
7
  export { LayoutToc };
8
8
  //# sourceMappingURL=LayoutToc.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { ListItemProps } from "../type.mjs";
2
- import * as react5 from "react";
2
+ import * as react35 from "react";
3
3
 
4
4
  //#region src/List/ListItem/index.d.ts
5
- declare const ListItem: react5.NamedExoticComponent<ListItemProps>;
5
+ declare const ListItem: react35.NamedExoticComponent<ListItemProps>;
6
6
  //#endregion
7
7
  export { ListItem };
8
8
  //# sourceMappingURL=index.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { LobeSelectProps } from "./type.mjs";
2
- import * as react3 from "react";
2
+ import * as react32 from "react";
3
3
 
4
4
  //#region src/LobeSelect/LobeSelect.d.ts
5
- declare const LobeSelect: react3.NamedExoticComponent<LobeSelectProps<any>>;
5
+ declare const LobeSelect: react32.NamedExoticComponent<LobeSelectProps<any>>;
6
6
  //#endregion
7
7
  export { LobeSelect };
8
8
  //# sourceMappingURL=LobeSelect.d.mts.map
@@ -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 react0 from "react";
3
+ import * as react28 from "react";
4
4
  import { ComponentProps, ComponentPropsWithRef } from "react";
5
- import * as react_jsx_runtime0 from "react/jsx-runtime";
5
+ import * as react_jsx_runtime12 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: react0.ForwardRefExoticComponent<_base_ui_react_select0.SelectBackdropProps & react0.RefAttributes<HTMLDivElement>>;
13
- declare const LobeSelectSeparator: react0.ForwardRefExoticComponent<node_modules__base_ui_react_esm_separator_Separator0.SeparatorProps & react0.RefAttributes<HTMLDivElement>>;
12
+ declare const LobeSelectBackdrop: react28.ForwardRefExoticComponent<_base_ui_react_select0.SelectBackdropProps & react28.RefAttributes<HTMLDivElement>>;
13
+ declare const LobeSelectSeparator: react28.ForwardRefExoticComponent<node_modules__base_ui_react_esm_separator_Separator0.SeparatorProps & react28.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_runtime0.JSX.Element;
30
+ }: LobeSelectTriggerProps): react_jsx_runtime12.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_runtime0.JSX.Element;
38
+ }: LobeSelectIconProps): react_jsx_runtime12.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_runtime0.JSX.Element;
46
+ }: LobeSelectValueProps): react_jsx_runtime12.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_runtime0.JSX.Element;
59
+ }: LobeSelectPortalProps): react_jsx_runtime12.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_runtime0.JSX.Element;
71
+ }: LobeSelectPositionerProps): react_jsx_runtime12.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_runtime0.JSX.Element;
79
+ }: LobeSelectPopupProps): react_jsx_runtime12.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_runtime0.JSX.Element;
87
+ }: LobeSelectListProps): react_jsx_runtime12.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_runtime0.JSX.Element;
95
+ }: LobeSelectItemProps): react_jsx_runtime12.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_runtime0.JSX.Element;
103
+ }: LobeSelectItemTextProps): react_jsx_runtime12.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_runtime0.JSX.Element;
111
+ }: LobeSelectItemIndicatorProps): react_jsx_runtime12.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_runtime0.JSX.Element;
119
+ }: LobeSelectGroupProps): react_jsx_runtime12.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_runtime0.JSX.Element;
127
+ }: LobeSelectGroupLabelProps): react_jsx_runtime12.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_runtime0.JSX.Element;
135
+ }: LobeSelectScrollUpArrowProps): react_jsx_runtime12.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_runtime0.JSX.Element;
143
+ }: LobeSelectScrollDownArrowProps): react_jsx_runtime12.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_runtime0.JSX.Element;
151
+ }: LobeSelectArrowProps): react_jsx_runtime12.JSX.Element;
152
152
  displayName: string;
153
153
  };
154
154
  //#endregion
@@ -1,6 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import { useNativeButton } from "../hooks/useNativeButton.mjs";
4
+ import { useAppElement } from "../ThemeProvider/AppElementContext.mjs";
4
5
  import { styles } from "../Menu/sharedStyle.mjs";
5
6
  import { styles as styles$1, triggerVariants } from "./style.mjs";
6
7
  import { LOBE_SELECT_CONTAINER_ATTR } from "./constants.mjs";
@@ -77,8 +78,9 @@ const LobeSelectValue = ({ className, ...rest }) => {
77
78
  };
78
79
  LobeSelectValue.displayName = "LobeSelectValue";
79
80
  const LobeSelectPortal = ({ container, ...rest }) => {
81
+ const appElement = useAppElement();
80
82
  return /* @__PURE__ */ jsx(Select.Portal, {
81
- container: container ?? void 0,
83
+ container: container ?? appElement ?? void 0,
82
84
  ...rest
83
85
  });
84
86
  };
@@ -1 +1 @@
1
- {"version":3,"file":"atoms.mjs","names":["styles","menuStyles"],"sources":["../../src/LobeSelect/atoms.tsx"],"sourcesContent":["'use client';\n\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport { Select } from '@base-ui/react/select';\nimport { cx, useThemeMode } from 'antd-style';\nimport {\n cloneElement,\n type ComponentProps,\n type ComponentPropsWithRef,\n isValidElement,\n} from 'react';\nimport { mergeRefs } from 'react-merge-refs';\n\nimport { useNativeButton } from '@/hooks/useNativeButton';\nimport { styles as menuStyles } from '@/Menu/sharedStyle';\n\nimport { styles, triggerVariants } from './style';\nimport { type LobeSelectSize, type LobeSelectVariant } from './type';\n\nconst mergeStateClassName = <TState,>(\n base: string,\n className: string | ((state: TState) => string | undefined) | undefined,\n) => {\n if (typeof className === 'function') return (state: TState) => cx(base, className(state));\n return cx(base, className);\n};\n\nexport const LobeSelectRoot = Select.Root;\nexport const LobeSelectBackdrop = Select.Backdrop;\nexport const LobeSelectSeparator = Select.Separator;\n\nexport type LobeSelectTriggerProps = Omit<\n ComponentPropsWithRef<typeof Select.Trigger>,\n 'children' | 'render'\n> & {\n children: ComponentProps<typeof Select.Trigger>['children'];\n shadow?: boolean;\n size?: LobeSelectSize;\n variant?: LobeSelectVariant;\n};\n\nexport const LobeSelectTrigger = ({\n children,\n className,\n nativeButton,\n shadow,\n size = 'middle',\n variant,\n ref: refProp,\n ...rest\n}: LobeSelectTriggerProps) => {\n const { isDarkMode } = useThemeMode();\n const resolvedVariant = variant ?? (isDarkMode ? 'filled' : 'outlined');\n const baseClassName = triggerVariants({ shadow, size, variant: resolvedVariant });\n\n const { isNativeButtonTriggerElement, resolvedNativeButton } = useNativeButton({\n children,\n nativeButton,\n });\n\n if (isValidElement(children)) {\n return (\n <Select.Trigger\n {...rest}\n nativeButton={resolvedNativeButton}\n render={(props, state) => {\n // Base UI's trigger props include `type=\"button\"` by default.\n // If we render into a non-<button> element, that prop is invalid and can warn.\n const resolvedProps = (() => {\n if (isNativeButtonTriggerElement) return props as any;\n // eslint-disable-next-line unused-imports/no-unused-vars\n const { type, ref: triggerRef, ...restProps } = props as any;\n return restProps;\n })();\n\n const mergedProps = mergeProps((children as any).props, resolvedProps);\n const childClassName =\n typeof (mergedProps as any).className === 'function'\n ? (mergedProps as any).className(state)\n : (mergedProps as any).className;\n const extraClassName = typeof className === 'function' ? className(state) : className;\n\n return cloneElement(children as any, {\n ...mergedProps,\n className: cx(baseClassName, childClassName, extraClassName),\n ref: mergeRefs([(children as any).ref, (props as any).ref, refProp]),\n });\n }}\n />\n );\n }\n\n return (\n <Select.Trigger\n {...rest}\n className={mergeStateClassName(baseClassName, className) as any}\n nativeButton={resolvedNativeButton}\n ref={refProp as any}\n >\n {children}\n </Select.Trigger>\n );\n};\n\nLobeSelectTrigger.displayName = 'LobeSelectTrigger';\n\nexport type LobeSelectIconProps = ComponentProps<typeof Select.Icon>;\n\nexport const LobeSelectIcon = ({ className, ...rest }: LobeSelectIconProps) => {\n return <Select.Icon className={mergeStateClassName(styles.icon, className) as any} {...rest} />;\n};\n\nLobeSelectIcon.displayName = 'LobeSelectIcon';\n\nexport type LobeSelectValueProps = ComponentProps<typeof Select.Value>;\n\nexport const LobeSelectValue = ({ className, ...rest }: LobeSelectValueProps) => {\n return <Select.Value className={mergeStateClassName(styles.value, className) as any} {...rest} />;\n};\n\nLobeSelectValue.displayName = 'LobeSelectValue';\n\nexport type LobeSelectPortalProps = ComponentProps<typeof Select.Portal> & {\n /**\n * When `container` is not provided, it uses a shared container created by `usePortalContainer`.\n */\n container?: HTMLElement | null;\n};\n\nexport const LobeSelectPortal = ({ container, ...rest }: LobeSelectPortalProps) => {\n return <Select.Portal container={container ?? undefined} {...rest} />;\n};\n\nLobeSelectPortal.displayName = 'LobeSelectPortal';\n\nexport type LobeSelectPositionerProps = ComponentProps<typeof Select.Positioner>;\n\nexport const LobeSelectPositioner = ({\n align,\n alignItemWithTrigger,\n className,\n side,\n sideOffset,\n ...rest\n}: LobeSelectPositionerProps) => {\n return (\n <Select.Positioner\n align={align ?? 'start'}\n alignItemWithTrigger={alignItemWithTrigger ?? false}\n className={mergeStateClassName(styles.positioner, className) as any}\n side={side ?? 'bottom'}\n sideOffset={sideOffset ?? 6}\n {...rest}\n />\n );\n};\n\nLobeSelectPositioner.displayName = 'LobeSelectPositioner';\n\nexport type LobeSelectPopupProps = ComponentProps<typeof Select.Popup>;\n\nexport const LobeSelectPopup = ({ className, ...rest }: LobeSelectPopupProps) => {\n return (\n <Select.Popup\n className={mergeStateClassName(cx(menuStyles.popup, styles.popup), className) as any}\n {...rest}\n />\n );\n};\n\nLobeSelectPopup.displayName = 'LobeSelectPopup';\n\nexport type LobeSelectListProps = ComponentProps<typeof Select.List>;\n\nexport const LobeSelectList = ({ className, ...rest }: LobeSelectListProps) => {\n return <Select.List className={mergeStateClassName(styles.list, className) as any} {...rest} />;\n};\n\nLobeSelectList.displayName = 'LobeSelectList';\n\nexport type LobeSelectItemProps = ComponentProps<typeof Select.Item>;\n\nexport const LobeSelectItem = ({ className, ...rest }: LobeSelectItemProps) => {\n return (\n <Select.Item\n className={mergeStateClassName(cx(menuStyles.item, styles.item), className) as any}\n {...rest}\n />\n );\n};\n\nLobeSelectItem.displayName = 'LobeSelectItem';\n\nexport type LobeSelectItemTextProps = ComponentProps<typeof Select.ItemText>;\n\nexport const LobeSelectItemText = ({ className, ...rest }: LobeSelectItemTextProps) => {\n return (\n <Select.ItemText\n className={mergeStateClassName(cx(menuStyles.label, styles.itemText), className) as any}\n {...rest}\n />\n );\n};\n\nLobeSelectItemText.displayName = 'LobeSelectItemText';\n\nexport type LobeSelectItemIndicatorProps = ComponentProps<typeof Select.ItemIndicator>;\n\nexport const LobeSelectItemIndicator = ({ className, ...rest }: LobeSelectItemIndicatorProps) => {\n return (\n <Select.ItemIndicator\n className={mergeStateClassName(styles.itemIndicator, className) as any}\n {...rest}\n />\n );\n};\n\nLobeSelectItemIndicator.displayName = 'LobeSelectItemIndicator';\n\nexport type LobeSelectGroupProps = ComponentProps<typeof Select.Group>;\n\nexport const LobeSelectGroup = ({ className, ...rest }: LobeSelectGroupProps) => {\n return <Select.Group className={mergeStateClassName(styles.group, className) as any} {...rest} />;\n};\n\nLobeSelectGroup.displayName = 'LobeSelectGroup';\n\nexport type LobeSelectGroupLabelProps = ComponentProps<typeof Select.GroupLabel>;\n\nexport const LobeSelectGroupLabel = ({ className, ...rest }: LobeSelectGroupLabelProps) => {\n return (\n <Select.GroupLabel\n className={\n mergeStateClassName(cx(menuStyles.groupLabel, styles.groupLabel), className) as any\n }\n {...rest}\n />\n );\n};\n\nLobeSelectGroupLabel.displayName = 'LobeSelectGroupLabel';\n\nexport type LobeSelectScrollUpArrowProps = ComponentProps<typeof Select.ScrollUpArrow>;\n\nexport const LobeSelectScrollUpArrow = ({ className, ...rest }: LobeSelectScrollUpArrowProps) => {\n return (\n <Select.ScrollUpArrow\n className={mergeStateClassName(styles.scrollArrow, className) as any}\n {...rest}\n />\n );\n};\n\nLobeSelectScrollUpArrow.displayName = 'LobeSelectScrollUpArrow';\n\nexport type LobeSelectScrollDownArrowProps = ComponentProps<typeof Select.ScrollDownArrow>;\n\nexport const LobeSelectScrollDownArrow = ({\n className,\n ...rest\n}: LobeSelectScrollDownArrowProps) => {\n return (\n <Select.ScrollDownArrow\n className={mergeStateClassName(styles.scrollArrow, className) as any}\n {...rest}\n />\n );\n};\n\nLobeSelectScrollDownArrow.displayName = 'LobeSelectScrollDownArrow';\n\nexport type LobeSelectArrowProps = ComponentProps<typeof Select.Arrow>;\n\nexport const LobeSelectArrow = ({ className, ...rest }: LobeSelectArrowProps) => {\n return <Select.Arrow className={mergeStateClassName(styles.arrow, className) as any} {...rest} />;\n};\n\nLobeSelectArrow.displayName = 'LobeSelectArrow';\n\nexport { LOBE_SELECT_CONTAINER_ATTR } from './constants';\n"],"mappings":";;;;;;;;;;;;;;AAmBA,MAAM,uBACJ,MACA,cACG;AACH,KAAI,OAAO,cAAc,WAAY,SAAQ,UAAkB,GAAG,MAAM,UAAU,MAAM,CAAC;AACzF,QAAO,GAAG,MAAM,UAAU;;AAG5B,MAAa,iBAAiB,OAAO;AACrC,MAAa,qBAAqB,OAAO;AACzC,MAAa,sBAAsB,OAAO;AAY1C,MAAa,qBAAqB,EAChC,UACA,WACA,cACA,QACA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;AAC/E,QAAO,oBAAC,OAAO;EAAM,WAAW,oBAAoBA,SAAO,OAAO,UAAU;EAAS,GAAI;GAAQ;;AAGnG,gBAAgB,cAAc;AAI9B,MAAa,wBAAwB,EAAE,WAAW,GAAG,WAAsC;AACzF,QACE,oBAAC,OAAO;EACN,WACE,oBAAoB,GAAGC,OAAW,YAAYD,SAAO,WAAW,EAAE,UAAU;EAE9E,GAAI;GACJ;;AAIN,qBAAqB,cAAc;AAInC,MAAa,2BAA2B,EAAE,WAAW,GAAG,WAAyC;AAC/F,QACE,oBAAC,OAAO;EACN,WAAW,oBAAoBA,SAAO,aAAa,UAAU;EAC7D,GAAI;GACJ;;AAIN,wBAAwB,cAAc;AAItC,MAAa,6BAA6B,EACxC,WACA,GAAG,WACiC;AACpC,QACE,oBAAC,OAAO;EACN,WAAW,oBAAoBA,SAAO,aAAa,UAAU;EAC7D,GAAI;GACJ;;AAIN,0BAA0B,cAAc;AAIxC,MAAa,mBAAmB,EAAE,WAAW,GAAG,WAAiC;AAC/E,QAAO,oBAAC,OAAO;EAAM,WAAW,oBAAoBA,SAAO,OAAO,UAAU;EAAS,GAAI;GAAQ;;AAGnG,gBAAgB,cAAc"}
1
+ {"version":3,"file":"atoms.mjs","names":["styles","menuStyles"],"sources":["../../src/LobeSelect/atoms.tsx"],"sourcesContent":["'use client';\n\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport { Select } from '@base-ui/react/select';\nimport { cx, useThemeMode } from 'antd-style';\nimport {\n cloneElement,\n type ComponentProps,\n type ComponentPropsWithRef,\n isValidElement,\n} from 'react';\nimport { mergeRefs } from 'react-merge-refs';\n\nimport { useNativeButton } from '@/hooks/useNativeButton';\nimport { styles as menuStyles } from '@/Menu/sharedStyle';\nimport { useAppElement } from '@/ThemeProvider';\n\nimport { styles, triggerVariants } from './style';\nimport { type LobeSelectSize, type LobeSelectVariant } from './type';\n\nconst mergeStateClassName = <TState,>(\n base: string,\n className: string | ((state: TState) => string | undefined) | undefined,\n) => {\n if (typeof className === 'function') return (state: TState) => cx(base, className(state));\n return cx(base, className);\n};\n\nexport const LobeSelectRoot = Select.Root;\nexport const LobeSelectBackdrop = Select.Backdrop;\nexport const LobeSelectSeparator = Select.Separator;\n\nexport type LobeSelectTriggerProps = Omit<\n ComponentPropsWithRef<typeof Select.Trigger>,\n 'children' | 'render'\n> & {\n children: ComponentProps<typeof Select.Trigger>['children'];\n shadow?: boolean;\n size?: LobeSelectSize;\n variant?: LobeSelectVariant;\n};\n\nexport const LobeSelectTrigger = ({\n children,\n className,\n nativeButton,\n shadow,\n size = 'middle',\n variant,\n ref: refProp,\n ...rest\n}: LobeSelectTriggerProps) => {\n const { isDarkMode } = useThemeMode();\n const resolvedVariant = variant ?? (isDarkMode ? 'filled' : 'outlined');\n const baseClassName = triggerVariants({ shadow, size, variant: resolvedVariant });\n\n const { isNativeButtonTriggerElement, resolvedNativeButton } = useNativeButton({\n children,\n nativeButton,\n });\n\n if (isValidElement(children)) {\n return (\n <Select.Trigger\n {...rest}\n nativeButton={resolvedNativeButton}\n render={(props, state) => {\n // Base UI's trigger props include `type=\"button\"` by default.\n // If we render into a non-<button> element, that prop is invalid and can warn.\n const resolvedProps = (() => {\n if (isNativeButtonTriggerElement) return props as any;\n // eslint-disable-next-line unused-imports/no-unused-vars\n const { type, ref: triggerRef, ...restProps } = props as any;\n return restProps;\n })();\n\n const mergedProps = mergeProps((children as any).props, resolvedProps);\n const childClassName =\n typeof (mergedProps as any).className === 'function'\n ? (mergedProps as any).className(state)\n : (mergedProps as any).className;\n const extraClassName = typeof className === 'function' ? className(state) : className;\n\n return cloneElement(children as any, {\n ...mergedProps,\n className: cx(baseClassName, childClassName, extraClassName),\n ref: mergeRefs([(children as any).ref, (props as any).ref, refProp]),\n });\n }}\n />\n );\n }\n\n return (\n <Select.Trigger\n {...rest}\n className={mergeStateClassName(baseClassName, className) as any}\n nativeButton={resolvedNativeButton}\n ref={refProp as any}\n >\n {children}\n </Select.Trigger>\n );\n};\n\nLobeSelectTrigger.displayName = 'LobeSelectTrigger';\n\nexport type LobeSelectIconProps = ComponentProps<typeof Select.Icon>;\n\nexport const LobeSelectIcon = ({ className, ...rest }: LobeSelectIconProps) => {\n return <Select.Icon className={mergeStateClassName(styles.icon, className) as any} {...rest} />;\n};\n\nLobeSelectIcon.displayName = 'LobeSelectIcon';\n\nexport type LobeSelectValueProps = ComponentProps<typeof Select.Value>;\n\nexport const LobeSelectValue = ({ className, ...rest }: LobeSelectValueProps) => {\n return <Select.Value className={mergeStateClassName(styles.value, className) as any} {...rest} />;\n};\n\nLobeSelectValue.displayName = 'LobeSelectValue';\n\nexport type LobeSelectPortalProps = ComponentProps<typeof Select.Portal> & {\n /**\n * When `container` is not provided, it uses a shared container created by `usePortalContainer`.\n */\n container?: HTMLElement | null;\n};\n\nexport const LobeSelectPortal = ({ container, ...rest }: LobeSelectPortalProps) => {\n const appElement = useAppElement();\n return <Select.Portal container={container ?? appElement ?? undefined} {...rest} />;\n};\n\nLobeSelectPortal.displayName = 'LobeSelectPortal';\n\nexport type LobeSelectPositionerProps = ComponentProps<typeof Select.Positioner>;\n\nexport const LobeSelectPositioner = ({\n align,\n alignItemWithTrigger,\n className,\n side,\n sideOffset,\n ...rest\n}: LobeSelectPositionerProps) => {\n return (\n <Select.Positioner\n align={align ?? 'start'}\n alignItemWithTrigger={alignItemWithTrigger ?? false}\n className={mergeStateClassName(styles.positioner, className) as any}\n side={side ?? 'bottom'}\n sideOffset={sideOffset ?? 6}\n {...rest}\n />\n );\n};\n\nLobeSelectPositioner.displayName = 'LobeSelectPositioner';\n\nexport type LobeSelectPopupProps = ComponentProps<typeof Select.Popup>;\n\nexport const LobeSelectPopup = ({ className, ...rest }: LobeSelectPopupProps) => {\n return (\n <Select.Popup\n className={mergeStateClassName(cx(menuStyles.popup, styles.popup), className) as any}\n {...rest}\n />\n );\n};\n\nLobeSelectPopup.displayName = 'LobeSelectPopup';\n\nexport type LobeSelectListProps = ComponentProps<typeof Select.List>;\n\nexport const LobeSelectList = ({ className, ...rest }: LobeSelectListProps) => {\n return <Select.List className={mergeStateClassName(styles.list, className) as any} {...rest} />;\n};\n\nLobeSelectList.displayName = 'LobeSelectList';\n\nexport type LobeSelectItemProps = ComponentProps<typeof Select.Item>;\n\nexport const LobeSelectItem = ({ className, ...rest }: LobeSelectItemProps) => {\n return (\n <Select.Item\n className={mergeStateClassName(cx(menuStyles.item, styles.item), className) as any}\n {...rest}\n />\n );\n};\n\nLobeSelectItem.displayName = 'LobeSelectItem';\n\nexport type LobeSelectItemTextProps = ComponentProps<typeof Select.ItemText>;\n\nexport const LobeSelectItemText = ({ className, ...rest }: LobeSelectItemTextProps) => {\n return (\n <Select.ItemText\n className={mergeStateClassName(cx(menuStyles.label, styles.itemText), className) as any}\n {...rest}\n />\n );\n};\n\nLobeSelectItemText.displayName = 'LobeSelectItemText';\n\nexport type LobeSelectItemIndicatorProps = ComponentProps<typeof Select.ItemIndicator>;\n\nexport const LobeSelectItemIndicator = ({ className, ...rest }: LobeSelectItemIndicatorProps) => {\n return (\n <Select.ItemIndicator\n className={mergeStateClassName(styles.itemIndicator, className) as any}\n {...rest}\n />\n );\n};\n\nLobeSelectItemIndicator.displayName = 'LobeSelectItemIndicator';\n\nexport type LobeSelectGroupProps = ComponentProps<typeof Select.Group>;\n\nexport const LobeSelectGroup = ({ className, ...rest }: LobeSelectGroupProps) => {\n return <Select.Group className={mergeStateClassName(styles.group, className) as any} {...rest} />;\n};\n\nLobeSelectGroup.displayName = 'LobeSelectGroup';\n\nexport type LobeSelectGroupLabelProps = ComponentProps<typeof Select.GroupLabel>;\n\nexport const LobeSelectGroupLabel = ({ className, ...rest }: LobeSelectGroupLabelProps) => {\n return (\n <Select.GroupLabel\n className={\n mergeStateClassName(cx(menuStyles.groupLabel, styles.groupLabel), className) as any\n }\n {...rest}\n />\n );\n};\n\nLobeSelectGroupLabel.displayName = 'LobeSelectGroupLabel';\n\nexport type LobeSelectScrollUpArrowProps = ComponentProps<typeof Select.ScrollUpArrow>;\n\nexport const LobeSelectScrollUpArrow = ({ className, ...rest }: LobeSelectScrollUpArrowProps) => {\n return (\n <Select.ScrollUpArrow\n className={mergeStateClassName(styles.scrollArrow, className) as any}\n {...rest}\n />\n );\n};\n\nLobeSelectScrollUpArrow.displayName = 'LobeSelectScrollUpArrow';\n\nexport type LobeSelectScrollDownArrowProps = ComponentProps<typeof Select.ScrollDownArrow>;\n\nexport const LobeSelectScrollDownArrow = ({\n className,\n ...rest\n}: LobeSelectScrollDownArrowProps) => {\n return (\n <Select.ScrollDownArrow\n className={mergeStateClassName(styles.scrollArrow, className) as any}\n {...rest}\n />\n );\n};\n\nLobeSelectScrollDownArrow.displayName = 'LobeSelectScrollDownArrow';\n\nexport type LobeSelectArrowProps = ComponentProps<typeof Select.Arrow>;\n\nexport const LobeSelectArrow = ({ className, ...rest }: LobeSelectArrowProps) => {\n return <Select.Arrow className={mergeStateClassName(styles.arrow, className) as any} {...rest} />;\n};\n\nLobeSelectArrow.displayName = 'LobeSelectArrow';\n\nexport { LOBE_SELECT_CONTAINER_ATTR } from './constants';\n"],"mappings":";;;;;;;;;;;;;;;AAoBA,MAAM,uBACJ,MACA,cACG;AACH,KAAI,OAAO,cAAc,WAAY,SAAQ,UAAkB,GAAG,MAAM,UAAU,MAAM,CAAC;AACzF,QAAO,GAAG,MAAM,UAAU;;AAG5B,MAAa,iBAAiB,OAAO;AACrC,MAAa,qBAAqB,OAAO;AACzC,MAAa,sBAAsB,OAAO;AAY1C,MAAa,qBAAqB,EAChC,UACA,WACA,cACA,QACA,OAAO,UACP,SACA,KAAK,SACL,GAAG,WACyB;CAC5B,MAAM,EAAE,eAAe,cAAc;CAErC,MAAM,gBAAgB,gBAAgB;EAAE;EAAQ;EAAM,SAD9B,YAAY,aAAa,WAAW;EACoB,CAAC;CAEjF,MAAM,EAAE,8BAA8B,yBAAyB,gBAAgB;EAC7E;EACA;EACD,CAAC;AAEF,KAAI,eAAe,SAAS,CAC1B,QACE,oBAAC,OA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AU;EAE9E,GAAI;GACJ;;AAIN,qBAAqB,cAAc;AAInC,MAAa,2BAA2B,EAAE,WAAW,GAAG,WAAyC;AAC/F,QACE,oBAAC,OAAO;EACN,WAAW,oBAAoBA,SAAO,aAAa,UAAU;EAC7D,GAAI;GACJ;;AAIN,wBAAwB,cAAc;AAItC,MAAa,6BAA6B,EACxC,WACA,GAAG,WACiC;AACpC,QACE,oBAAC,OAAO;EACN,WAAW,oBAAoBA,SAAO,aAAa,UAAU;EAC7D,GAAI;GACJ;;AAIN,0BAA0B,cAAc;AAIxC,MAAa,mBAAmB,EAAE,WAAW,GAAG,WAAiC;AAC/E,QAAO,oBAAC,OAAO;EAAM,WAAW,oBAAoBA,SAAO,OAAO,UAAU;EAAS,GAAI;GAAQ;;AAGnG,gBAAgB,cAAc"}
@@ -1,8 +1,8 @@
1
1
  import { LobeSwitchProps } from "./type.mjs";
2
- import * as react7 from "react";
2
+ import * as react33 from "react";
3
3
 
4
4
  //#region src/LobeSwitch/LobeSwitch.d.ts
5
- declare const LobeSwitch: react7.NamedExoticComponent<LobeSwitchProps>;
5
+ declare const LobeSwitch: react33.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_runtime14 from "react/jsx-runtime";
3
+ import * as react_jsx_runtime27 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_runtime14.JSX.Element;
27
+ }: LobeSwitchRootInternalProps): react_jsx_runtime27.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_runtime14.JSX.Element;
38
+ }: LobeSwitchThumbProps): react_jsx_runtime27.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_runtime14.JSX.Element;
51
+ }): react_jsx_runtime27.JSX.Element;
52
52
  displayName: string;
53
53
  };
54
54
  //#endregion
@@ -1,8 +1,8 @@
1
1
  import { MarkdownProps } from "./type.mjs";
2
- import * as react72 from "react";
2
+ import * as react26 from "react";
3
3
 
4
4
  //#region src/Markdown/Markdown.d.ts
5
- declare const Markdown: react72.NamedExoticComponent<MarkdownProps>;
5
+ declare const Markdown: react26.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 react71 from "react";
2
+ import * as react25 from "react";
3
3
 
4
4
  //#region src/Markdown/Typography.d.ts
5
- declare const Typography: react71.NamedExoticComponent<TypographyProps>;
5
+ declare const Typography: react25.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 react82 from "react";
3
+ import * as react3 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: react82.NamedExoticComponent<SearchResultCardsProps>;
17
+ declare const SearchResultCards: react3.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 react59 from "react";
2
+ import * as react27 from "react";
3
3
 
4
4
  //#region src/MaskShadow/MaskShadow.d.ts
5
- declare const MaskShadow: react59.NamedExoticComponent<MaskShadowProps>;
5
+ declare const MaskShadow: react27.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 react58 from "react";
2
+ import * as react24 from "react";
3
3
 
4
4
  //#region src/Menu/Menu.d.ts
5
- declare const Menu: react58.NamedExoticComponent<MenuProps<unknown>>;
5
+ declare const Menu: react24.NamedExoticComponent<MenuProps<unknown>>;
6
6
  //#endregion
7
7
  export { Menu };
8
8
  //# sourceMappingURL=Menu.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { MermaidProps } from "./type.mjs";
2
- import * as react56 from "react";
2
+ import * as react22 from "react";
3
3
 
4
4
  //#region src/Mermaid/Mermaid.d.ts
5
- declare const Mermaid: react56.NamedExoticComponent<MermaidProps>;
5
+ declare const Mermaid: react22.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 react57 from "react";
2
+ import * as react23 from "react";
3
3
 
4
4
  //#region src/Mermaid/SyntaxMermaid/index.d.ts
5
- declare const SyntaxMermaid: react57.NamedExoticComponent<SyntaxMermaidProps>;
5
+ declare const SyntaxMermaid: react23.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 react49 from "react";
2
+ import * as react38 from "react";
3
3
 
4
4
  //#region src/Modal/Modal.d.ts
5
- declare const Modal: react49.NamedExoticComponent<ModalProps>;
5
+ declare const Modal: react38.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 react50 from "react";
2
+ import * as react36 from "react";
3
3
  import { ReactNode } from "react";
4
4
 
5
5
  //#region src/Modal/ModalProvider.d.ts
6
- declare const ModalProvider: react50.NamedExoticComponent<{
6
+ declare const ModalProvider: react36.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_runtime52 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime30 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_runtime52.JSX.Element | null;
10
+ }: ModalHostProps) => react_jsx_runtime30.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,16 +1,15 @@
1
1
  'use client';
2
2
 
3
3
  import { useIsClient } from "../hooks/useIsClient.mjs";
4
+ import { useAppElement } from "../ThemeProvider/AppElementContext.mjs";
4
5
  import { registerDevSingleton } from "../utils/devSingleton.mjs";
5
6
  import { ModalStackItem } from "./ModalStackItem.mjs";
6
7
  import { RawModalStackItem } from "./RawModalStackItem.mjs";
7
- import { memo, useEffect, useState, useSyncExternalStore } from "react";
8
+ import { memo, useEffect, useSyncExternalStore } from "react";
8
9
  import { jsx } from "react/jsx-runtime";
9
10
  import { createPortal } from "react-dom";
10
11
 
11
12
  //#region src/Modal/imperative.tsx
12
- const MODAL_PORTAL_ATTR = "data-lobe-ui-modal-portal";
13
- const containerMap = /* @__PURE__ */ new WeakMap();
14
13
  let modalStack = [];
15
14
  let modalSeed = 0;
16
15
  const listeners = /* @__PURE__ */ new Set();
@@ -25,28 +24,9 @@ const subscribe = (listener) => {
25
24
  const EMPTY_STACK = [];
26
25
  const getSnapshot = () => modalStack;
27
26
  const getServerSnapshot = () => EMPTY_STACK;
28
- const getOrCreateContainer = (root) => {
29
- const cached = containerMap.get(root);
30
- if (cached && cached.isConnected) return cached;
31
- const el = document.createElement("div");
32
- el.setAttribute(MODAL_PORTAL_ATTR, "true");
33
- root.append(el);
34
- containerMap.set(root, el);
35
- return el;
36
- };
37
- const resolveRoot = (root) => {
38
- if (root) return root;
39
- return document.body;
40
- };
41
27
  const ModalPortal = ({ children, root }) => {
42
- const [container, setContainer] = useState(() => {
43
- const resolved = resolveRoot(root);
44
- if (!resolved) return null;
45
- return getOrCreateContainer(resolved);
46
- });
47
- if (!container) setContainer(getOrCreateContainer(document.body));
48
- if (!container) return null;
49
- return createPortal(children, container);
28
+ const appElement = useAppElement();
29
+ return createPortal(children, root ?? appElement ?? document.body);
50
30
  };
51
31
  const updateModal = (id, nextProps) => {
52
32
  let changed = false;
@@ -1 +1 @@
1
- {"version":3,"file":"imperative.mjs","names":["modalStack: TModalStackItem[]","EMPTY_STACK: TModalStackItem[]"],"sources":["../../src/Modal/imperative.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode } from 'react';\nimport { memo, useEffect, useState, useSyncExternalStore } from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { useIsClient } from '@/hooks/useIsClient';\nimport { registerDevSingleton } from '@/utils/devSingleton';\n\nimport { ModalStackItem } from './ModalStackItem';\nimport { RawModalStackItem } from './RawModalStackItem';\nimport type {\n ImperativeModalProps,\n ModalInstance,\n RawModalComponent,\n RawModalComponentProps,\n RawModalInstance,\n RawModalKeyOptions,\n RawModalOptions,\n} from './type';\n\ntype ModalStackItemBase = {\n id: string;\n};\n\ntype ModalStackItemModal = ModalStackItemBase & {\n kind: 'modal';\n props: ImperativeModalProps;\n};\n\ntype ModalStackItemRaw = ModalStackItemBase & {\n component: RawModalComponent;\n kind: 'raw';\n open: boolean;\n options?: RawModalOptions<PropertyKey, PropertyKey>;\n props: Record<string, unknown>;\n};\n\ntype TModalStackItem = ModalStackItemModal | ModalStackItemRaw;\n\ntype ModalStackProps = {\n stack: TModalStackItem[];\n};\n\nexport type ModalHostProps = {\n root?: HTMLElement | ShadowRoot | null;\n};\n\nconst MODAL_PORTAL_ATTR = 'data-lobe-ui-modal-portal';\n\n// Reuse one portal container per root (document.body by default).\nconst containerMap = new WeakMap<object, HTMLElement>();\n\nlet modalStack: TModalStackItem[] = [];\nlet modalSeed = 0;\nconst listeners = new Set<() => void>();\nconst rawDestroyTimers = new Map<string, number>();\n\nconst notify = () => {\n listeners.forEach((listener) => listener());\n};\n\nconst subscribe = (listener: () => void) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n};\n\nconst EMPTY_STACK: TModalStackItem[] = [];\nconst getSnapshot = () => modalStack;\nconst getServerSnapshot = () => EMPTY_STACK;\n\nconst getOrCreateContainer = (root: HTMLElement | ShadowRoot): HTMLElement => {\n const cached = containerMap.get(root);\n if (cached && cached.isConnected) return cached;\n\n const el = document.createElement('div');\n el.setAttribute(MODAL_PORTAL_ATTR, 'true');\n root.append(el);\n containerMap.set(root, el);\n return el;\n};\n\nconst resolveRoot = (root?: HTMLElement | ShadowRoot | null): HTMLElement | ShadowRoot | null => {\n if (root) return root;\n return document.body;\n};\n\nconst ModalPortal = ({\n children,\n root,\n}: {\n children: ReactNode;\n root?: HTMLElement | ShadowRoot | null;\n}) => {\n const [container, setContainer] = useState<HTMLElement | null>(() => {\n const resolved = resolveRoot(root);\n if (!resolved) return null;\n return getOrCreateContainer(resolved);\n });\n\n if (!container) {\n setContainer(getOrCreateContainer(document.body));\n }\n\n if (!container) return null;\n return createPortal(children, container);\n};\n\nconst updateModal = (id: string, nextProps: Partial<ImperativeModalProps>) => {\n let changed = false;\n modalStack = modalStack.map((item) => {\n if (item.id !== id) return item;\n if (item.kind !== 'modal') return item;\n changed = true;\n return {\n ...item,\n props: { ...item.props, ...nextProps },\n };\n });\n\n if (changed) notify();\n};\n\nconst updateRawProps = (id: string, nextProps: Record<string, unknown>) => {\n let changed = false;\n modalStack = modalStack.map((item) => {\n if (item.id !== id) return item;\n if (item.kind !== 'raw') return item;\n changed = true;\n return {\n ...item,\n props: { ...item.props, ...nextProps },\n };\n });\n\n if (changed) notify();\n};\n\nconst setRawOpen = (id: string, open: boolean) => {\n let changed = false;\n modalStack = modalStack.map((item) => {\n if (item.id !== id) return item;\n if (item.kind !== 'raw') return item;\n if (item.open === open) return item;\n changed = true;\n return { ...item, open };\n });\n\n if (open) {\n const timer = rawDestroyTimers.get(id);\n if (timer) {\n clearTimeout(timer);\n rawDestroyTimers.delete(id);\n }\n }\n\n if (changed) notify();\n};\n\nconst closeModal = (id: string) => {\n const target = modalStack.find((item) => item.id === id);\n if (!target) return;\n\n if (target.kind === 'modal') {\n updateModal(id, { open: false });\n return;\n }\n\n setRawOpen(id, false);\n\n const shouldDestroy = target.options?.destroyOnClose ?? true;\n if (!shouldDestroy) return;\n\n const delay = target.options?.destroyDelay ?? 200;\n const existing = rawDestroyTimers.get(id);\n if (existing) clearTimeout(existing);\n const timer = window.setTimeout(() => {\n rawDestroyTimers.delete(id);\n\n destroyModal(id);\n }, delay);\n rawDestroyTimers.set(id, timer);\n};\n\nconst destroyModal = (id: string) => {\n const timer = rawDestroyTimers.get(id);\n if (timer) {\n clearTimeout(timer);\n rawDestroyTimers.delete(id);\n }\n const nextStack = modalStack.filter((item) => item.id !== id);\n if (nextStack.length === modalStack.length) return;\n modalStack = nextStack;\n notify();\n};\n\nconst ModalStack = memo(({ stack }: ModalStackProps) => {\n const isClient = useIsClient();\n if (!isClient) return null;\n return stack.map((item) => {\n if (item.kind === 'modal') {\n return (\n <ModalStackItem\n id={item.id}\n key={item.id}\n props={item.props}\n onClose={closeModal}\n onDestroy={destroyModal}\n onUpdate={updateModal}\n />\n );\n }\n\n return (\n <RawModalStackItem\n component={item.component}\n id={item.id}\n key={item.id}\n open={item.open}\n options={item.options}\n props={item.props}\n onClose={closeModal}\n onUpdate={updateRawProps}\n />\n );\n });\n});\n\nModalStack.displayName = 'ModalStack';\n\nexport const ModalHost = ({ root }: ModalHostProps) => {\n const stack = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n const isClient = useIsClient();\n\n useEffect(() => {\n if (!isClient) return;\n // Enforce singleton per portal root (dev-only).\n const scope = root ?? document.body;\n return registerDevSingleton('ModalHost', scope);\n }, [isClient, root]);\n\n if (!isClient) return null;\n if (stack.length === 0) return null;\n\n return (\n <ModalPortal root={root}>\n <ModalStack stack={stack} />\n </ModalPortal>\n );\n};\n\nexport const createModal = (props: ImperativeModalProps): ModalInstance => {\n const id = `modal-${Date.now()}-${modalSeed++}`;\n modalStack = [\n ...modalStack,\n { id, kind: 'modal', props: { ...props, open: props.open ?? true } },\n ];\n notify();\n\n return {\n close: () => closeModal(id),\n destroy: () => destroyModal(id),\n setCanDismissByClickOutside: (value) => updateModal(id, { maskClosable: value }),\n update: (nextProps) => updateModal(id, nextProps),\n };\n};\n\nexport function createRawModal<P extends RawModalComponentProps>(\n component: RawModalComponent<P>,\n props: Omit<P, 'open' | 'onClose'>,\n options?: RawModalOptions,\n): RawModalInstance<P>;\n\nexport function createRawModal<P, OpenKey extends keyof P, CloseKey extends keyof P>(\n component: RawModalComponent<P>,\n props: Omit<P, OpenKey | CloseKey>,\n options: RawModalKeyOptions<OpenKey, CloseKey>,\n): RawModalInstance<P, OpenKey, CloseKey>;\n\nexport function createRawModal<P, OpenKey extends keyof P, CloseKey extends keyof P>(\n component: RawModalComponent<P>,\n props: Omit<P, OpenKey | CloseKey>,\n options?: RawModalOptions<OpenKey, CloseKey>,\n): RawModalInstance<P, OpenKey, CloseKey> {\n const id = `modal-${Date.now()}-${modalSeed++}`;\n modalStack = [\n ...modalStack,\n {\n component,\n id,\n kind: 'raw',\n open: true,\n options,\n props: props as Record<string, unknown>,\n },\n ];\n notify();\n\n return {\n close: () => closeModal(id),\n destroy: () => destroyModal(id),\n setCanDismissByClickOutside: (value) => updateRawProps(id, { maskClosable: value }),\n update: (nextProps) => updateRawProps(id, nextProps as Record<string, unknown>),\n };\n}\n"],"mappings":";;;;;;;;;;;AAgDA,MAAM,oBAAoB;AAG1B,MAAM,+BAAe,IAAI,SAA8B;AAEvD,IAAIA,aAAgC,EAAE;AACtC,IAAI,YAAY;AAChB,MAAM,4BAAY,IAAI,KAAiB;AACvC,MAAM,mCAAmB,IAAI,KAAqB;AAElD,MAAM,eAAe;AACnB,WAAU,SAAS,aAAa,UAAU,CAAC;;AAG7C,MAAM,aAAa,aAAyB;AAC1C,WAAU,IAAI,SAAS;AACvB,cAAa,UAAU,OAAO,SAAS;;AAGzC,MAAMC,cAAiC,EAAE;AACzC,MAAM,oBAAoB;AAC1B,MAAM,0BAA0B;AAEhC,MAAM,wBAAwB,SAAgD;CAC5E,MAAM,SAAS,aAAa,IAAI,KAAK;AACrC,KAAI,UAAU,OAAO,Y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]"],"sources":["../../src/Modal/imperative.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode } from 'react';\nimport { memo, useEffect, useSyncExternalStore } from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { useIsClient } from '@/hooks/useIsClient';\nimport { useAppElement } from '@/ThemeProvider';\nimport { registerDevSingleton } from '@/utils/devSingleton';\n\nimport { ModalStackItem } from './ModalStackItem';\nimport { RawModalStackItem } from './RawModalStackItem';\nimport type {\n ImperativeModalProps,\n ModalInstance,\n RawModalComponent,\n RawModalComponentProps,\n RawModalInstance,\n RawModalKeyOptions,\n RawModalOptions,\n} from './type';\n\ntype ModalStackItemBase = {\n id: string;\n};\n\ntype ModalStackItemModal = ModalStackItemBase & {\n kind: 'modal';\n props: ImperativeModalProps;\n};\n\ntype ModalStackItemRaw = ModalStackItemBase & {\n component: RawModalComponent;\n kind: 'raw';\n open: boolean;\n options?: RawModalOptions<PropertyKey, PropertyKey>;\n props: Record<string, unknown>;\n};\n\ntype TModalStackItem = ModalStackItemModal | ModalStackItemRaw;\n\ntype ModalStackProps = {\n stack: TModalStackItem[];\n};\n\nexport type ModalHostProps = {\n root?: HTMLElement | ShadowRoot | null;\n};\n\nlet modalStack: TModalStackItem[] = [];\nlet modalSeed = 0;\nconst listeners = new Set<() => void>();\nconst rawDestroyTimers = new Map<string, number>();\n\nconst notify = () => {\n listeners.forEach((listener) => listener());\n};\n\nconst subscribe = (listener: () => void) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n};\n\nconst EMPTY_STACK: TModalStackItem[] = [];\nconst getSnapshot = () => modalStack;\nconst getServerSnapshot = () => EMPTY_STACK;\n\nconst ModalPortal = ({\n children,\n root,\n}: {\n children: ReactNode;\n root?: HTMLElement | ShadowRoot | null;\n}) => {\n const appElement = useAppElement();\n const container = root ?? appElement ?? document.body;\n\n return createPortal(children, container);\n};\n\nconst updateModal = (id: string, nextProps: Partial<ImperativeModalProps>) => {\n let changed = false;\n modalStack = modalStack.map((item) => {\n if (item.id !== id) return item;\n if (item.kind !== 'modal') return item;\n changed = true;\n return {\n ...item,\n props: { ...item.props, ...nextProps },\n };\n });\n\n if (changed) notify();\n};\n\nconst updateRawProps = (id: string, nextProps: Record<string, unknown>) => {\n let changed = false;\n modalStack = modalStack.map((item) => {\n if (item.id !== id) return item;\n if (item.kind !== 'raw') return item;\n changed = true;\n return {\n ...item,\n props: { ...item.props, ...nextProps },\n };\n });\n\n if (changed) notify();\n};\n\nconst setRawOpen = (id: string, open: boolean) => {\n let changed = false;\n modalStack = modalStack.map((item) => {\n if (item.id !== id) return item;\n if (item.kind !== 'raw') return item;\n if (item.open === open) return item;\n changed = true;\n return { ...item, open };\n });\n\n if (open) {\n const timer = rawDestroyTimers.get(id);\n if (timer) {\n clearTimeout(timer);\n rawDestroyTimers.delete(id);\n }\n }\n\n if (changed) notify();\n};\n\nconst closeModal = (id: string) => {\n const target = modalStack.find((item) => item.id === id);\n if (!target) return;\n\n if (target.kind === 'modal') {\n updateModal(id, { open: false });\n return;\n }\n\n setRawOpen(id, false);\n\n const shouldDestroy = target.options?.destroyOnClose ?? true;\n if (!shouldDestroy) return;\n\n const delay = target.options?.destroyDelay ?? 200;\n const existing = rawDestroyTimers.get(id);\n if (existing) clearTimeout(existing);\n const timer = window.setTimeout(() => {\n rawDestroyTimers.delete(id);\n\n destroyModal(id);\n }, delay);\n rawDestroyTimers.set(id, timer);\n};\n\nconst destroyModal = (id: string) => {\n const timer = rawDestroyTimers.get(id);\n if (timer) {\n clearTimeout(timer);\n rawDestroyTimers.delete(id);\n }\n const nextStack = modalStack.filter((item) => item.id !== id);\n if (nextStack.length === modalStack.length) return;\n modalStack = nextStack;\n notify();\n};\n\nconst ModalStack = memo(({ stack }: ModalStackProps) => {\n const isClient = useIsClient();\n if (!isClient) return null;\n return stack.map((item) => {\n if (item.kind === 'modal') {\n return (\n <ModalStackItem\n id={item.id}\n key={item.id}\n props={item.props}\n onClose={closeModal}\n onDestroy={destroyModal}\n onUpdate={updateModal}\n />\n );\n }\n\n return (\n <RawModalStackItem\n component={item.component}\n id={item.id}\n key={item.id}\n open={item.open}\n options={item.options}\n props={item.props}\n onClose={closeModal}\n onUpdate={updateRawProps}\n />\n );\n });\n});\n\nModalStack.displayName = 'ModalStack';\n\nexport const ModalHost = ({ root }: ModalHostProps) => {\n const stack = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n const isClient = useIsClient();\n\n useEffect(() => {\n if (!isClient) return;\n // Enforce singleton per portal root (dev-only).\n const scope = root ?? document.body;\n return registerDevSingleton('ModalHost', scope);\n }, [isClient, root]);\n\n if (!isClient) return null;\n if (stack.length === 0) return null;\n\n return (\n <ModalPortal root={root}>\n <ModalStack stack={stack} />\n </ModalPortal>\n );\n};\n\nexport const createModal = (props: ImperativeModalProps): ModalInstance => {\n const id = `modal-${Date.now()}-${modalSeed++}`;\n modalStack = [\n ...modalStack,\n { id, kind: 'modal', props: { ...props, open: props.open ?? true } },\n ];\n notify();\n\n return {\n close: () => closeModal(id),\n destroy: () => destroyModal(id),\n setCanDismissByClickOutside: (value) => updateModal(id, { maskClosable: value }),\n update: (nextProps) => updateModal(id, nextProps),\n };\n};\n\nexport function createRawModal<P extends RawModalComponentProps>(\n component: RawModalComponent<P>,\n props: Omit<P, 'open' | 'onClose'>,\n options?: RawModalOptions,\n): RawModalInstance<P>;\n\nexport function createRawModal<P, OpenKey extends keyof P, CloseKey extends keyof P>(\n component: RawModalComponent<P>,\n props: Omit<P, OpenKey | CloseKey>,\n options: RawModalKeyOptions<OpenKey, CloseKey>,\n): RawModalInstance<P, OpenKey, CloseKey>;\n\nexport function createRawModal<P, OpenKey extends keyof P, CloseKey extends keyof P>(\n component: RawModalComponent<P>,\n props: Omit<P, OpenKey | CloseKey>,\n options?: RawModalOptions<OpenKey, CloseKey>,\n): RawModalInstance<P, OpenKey, CloseKey> {\n const id = `modal-${Date.now()}-${modalSeed++}`;\n modalStack = [\n ...modalStack,\n {\n component,\n id,\n kind: 'raw',\n open: true,\n options,\n props: props as Record<string, unknown>,\n },\n ];\n notify();\n\n return {\n close: () => closeModal(id),\n destroy: () => destroyModal(id),\n setCanDismissByClickOutside: (value) => updateRawProps(id, { maskClosable: value }),\n update: (nextProps) => updateRawProps(id, nextProps as Record<string, unknown>),\n };\n}\n"],"mappings":";;;;;;;;;;;;AAiDA,IAAIA,aAAgC,EAAE;AACtC,IAAI,YAAY;AAChB,MAAM,4BAAY,IAAI,KAAiB;AACvC,MAAM,mCAAmB,IAAI,KAAqB;AAElD,MAAM,eAAe;AACnB,WAAU,SAAS,aAAa,UAAU,CAAC;;AAG7C,MAAM,aAAa,aAAyB;AAC1C,WAAU,IAAI,SAAS;AACvB,cAAa,UAAU,OAAO,SAAS;;AAGzC,MAAMC,cAAiC,EAAE;AACzC,MAAM,oBAAoB;AAC1B,MAAM,0BAA0B;AAEhC,MAAM,eAAe,EACnB,UACA,WAII;CACJ,MAAM,aAAa,eAAe;AAGlC,QAAO,aAAa,UAFF,QAAQ,cAAc,SAAS,KAET;;AAG1C,MAAM,eAAe,IAAY,cAA6C;CAC5E,IAAI,UAAU;AACd,cAAa,WAAW,KAAK,SAAS;AACpC,MAAI,KAAK,OAAO,GAAI,QAAO;AAC3B,MAAI,KAAK,SAAS,QAAS,QAAO;AAClC,YAAU;AACV,SAAO;GACL,GAAG;GACH,OAAO;IAAE,GAAG,KAAK;IAAO,GAAG;IAAW;GACvC;GACD;AAEF,KAAI,QAAS,SAAQ;;AAGvB,MAAM,kBAAkB,IAAY,cAAuC;CACzE,IAAI,UAAU;AACd,cAAa,WAAW,KAAK,SAAS;AACpC,MAAI,KAAK,OAAO,GAAI,QAAO;AAC3B,MAAI,KAAK,SAAS,MAAO,QAAO;AAChC,YAAU;AACV,SAAO;GACL,GAAG;GACH,OAAO;IAAE,GAAG,KAAK;IAAO,GAAG;IAAW;GACvC;GACD;AAEF,KAAI,QAAS,SAAQ;;AAGvB,MAAM,cAAc,IAAY,SAAkB;CAChD,IAAI,UAAU;AACd,cAAa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,CAAC;EACnF,SAAS,cAAc,eAAe,IAAI,UAAqC;EAChF"}
@@ -1,4 +1,4 @@
1
- import * as react83 from "react";
1
+ import * as react4 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: react83.NamedExoticComponent<{
9
+ declare const MotionProvider: react4.NamedExoticComponent<{
10
10
  children: ReactNode;
11
11
  motion: MotionComponentType;
12
12
  }>;
@@ -1,7 +1,7 @@
1
- import * as react_jsx_runtime53 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime5 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/Popover/ArrowIcon.d.ts
4
- declare const PopoverArrowIcon: react_jsx_runtime53.JSX.Element;
4
+ declare const PopoverArrowIcon: react_jsx_runtime5.JSX.Element;
5
5
  //#endregion
6
6
  export { PopoverArrowIcon };
7
7
  //# sourceMappingURL=ArrowIcon.d.mts.map
@@ -1,37 +1,13 @@
1
1
  'use client';
2
2
 
3
- import { useEffect, useState } from "react";
3
+ import { useAppElement } from "../ThemeProvider/AppElementContext.mjs";
4
4
 
5
5
  //#region src/Popover/PopoverPortal.tsx
6
- const PORTAL_ATTR = "data-lobe-ui-popover-portal";
7
6
  const POPOVER_CONTAINER_ATTR = "data-lobe-ui-popover-container";
8
- const containerMap = /* @__PURE__ */ new WeakMap();
9
- const getOrCreateContainer = (root) => {
10
- const resolvedRoot = (() => {
11
- if (typeof document === "undefined") return root;
12
- if (typeof ShadowRoot !== "undefined" && root instanceof ShadowRoot) return root;
13
- return root;
14
- })();
15
- const cached = containerMap.get(resolvedRoot);
16
- if (cached && cached.isConnected) return cached;
17
- const el = document.createElement("div");
18
- el.setAttribute(PORTAL_ATTR, "true");
19
- resolvedRoot.append(el);
20
- containerMap.set(resolvedRoot, el);
21
- return el;
22
- };
23
- const resolveRoot = (root) => {
24
- if (root) return root;
25
- return document.body;
26
- };
27
7
  const usePopoverPortalContainer = (root) => {
28
- const [container, setContainer] = useState(null);
29
- useEffect(() => {
30
- const resolved = resolveRoot(root);
31
- if (!resolved) return;
32
- setContainer(getOrCreateContainer(resolved));
33
- }, [root, container?.isConnected]);
34
- return container;
8
+ const appElement = useAppElement();
9
+ if (typeof document === "undefined") return null;
10
+ return root ?? appElement ?? document.body;
35
11
  };
36
12
 
37
13
  //#endregion