@lobehub/ui 5.23.4 → 5.24.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 (299) hide show
  1. package/es/Accordion/Accordion.mjs.map +1 -1
  2. package/es/Accordion/AccordionItem.mjs.map +1 -1
  3. package/es/Accordion/ArrowIcon.mjs.map +1 -1
  4. package/es/ActionIcon/ActionIcon.mjs.map +1 -1
  5. package/es/ActionIconGroup/ActionIconGroup.mjs.map +1 -1
  6. package/es/Alert/Alert.mjs.map +1 -1
  7. package/es/Avatar/Avatar.mjs.map +1 -1
  8. package/es/Avatar/AvatarGroup/index.mjs.map +1 -1
  9. package/es/Burger/Burger.mjs.map +1 -1
  10. package/es/Checkbox/Checkbox.mjs.map +1 -1
  11. package/es/Checkbox/CheckboxGroup.mjs.map +1 -1
  12. package/es/CodeDiff/DiffPanel.mjs.map +1 -1
  13. package/es/CodeEditor/CodeEditor.mjs.map +1 -1
  14. package/es/Collapse/Collapse.mjs.map +1 -1
  15. package/es/ColorSwatches/ColorSwatches.mjs.map +1 -1
  16. package/es/ConfigProvider/index.mjs.map +1 -1
  17. package/es/ContextMenu/index.d.mts +2 -2
  18. package/es/ContextMenu/index.mjs +2 -2
  19. package/es/DraggablePanel/DraggablePanel.mjs.map +1 -1
  20. package/es/DraggablePanel/components/DraggablePanelHeader.mjs.map +1 -1
  21. package/es/DraggableSideNav/DraggableSideNav.mjs.map +1 -1
  22. package/es/Drawer/Drawer.mjs.map +1 -1
  23. package/es/Dropdown/Dropdown.mjs.map +1 -1
  24. package/es/EditableText/ControlInput.mjs.map +1 -1
  25. package/es/EditableText/EditableText.mjs.map +1 -1
  26. package/es/EditorSlashMenu/EditorSlashMenu.mjs.map +1 -1
  27. package/es/EditorSlashMenu/MenuItemRenderer.mjs.map +1 -1
  28. package/es/EmojiPicker/AvatarUploader.mjs.map +1 -1
  29. package/es/EmojiPicker/EmojiPicker.mjs.map +1 -1
  30. package/es/Empty/Empty.mjs.map +1 -1
  31. package/es/FileTypeIcon/FileTypeIcon.mjs.map +1 -1
  32. package/es/FileTypeIcon/components/FileIcon.mjs.map +1 -1
  33. package/es/FileTypeIcon/components/FolderIcon.mjs.map +1 -1
  34. package/es/FluentEmoji/FluentEmoji.mjs.map +1 -1
  35. package/es/Footer/Footer.mjs.map +1 -1
  36. package/es/Form/Form.mjs.map +1 -1
  37. package/es/Form/components/FormGroup.mjs.map +1 -1
  38. package/es/Form/components/FormSubmitFooter.mjs.map +1 -1
  39. package/es/Form/components/FormTitle.mjs.map +1 -1
  40. package/es/FormModal/FormModal.mjs.map +1 -1
  41. package/es/Freeze/Freeze.mjs.map +1 -1
  42. package/es/GroupAvatar/GroupAvatar.mjs.map +1 -1
  43. package/es/GuideCard/GuideCard.mjs.map +1 -1
  44. package/es/Header/Header.mjs.map +1 -1
  45. package/es/Highlighter/FullFeatured.mjs.map +1 -1
  46. package/es/Highlighter/Highlighter.mjs.map +1 -1
  47. package/es/Highlighter/LangSelect.mjs.map +1 -1
  48. package/es/Highlighter/SyntaxHighlighter/StreamRenderer.mjs.map +1 -1
  49. package/es/Highlighter/SyntaxHighlighter/style.mjs +2 -2
  50. package/es/Highlighter/SyntaxHighlighter/style.mjs.map +1 -1
  51. package/es/Hotkey/Hotkey.mjs.map +1 -1
  52. package/es/HotkeyInput/HotkeyInput.mjs.map +1 -1
  53. package/es/HtmlPreview/HtmlPreview.mjs.map +1 -1
  54. package/es/HtmlPreview/Iframe.mjs.map +1 -1
  55. package/es/Icon/Icon.mjs.map +1 -1
  56. package/es/Image/Image.mjs.map +1 -1
  57. package/es/Image/components/Toolbar.mjs.map +1 -1
  58. package/es/Image/components/usePreview.mjs.map +1 -1
  59. package/es/Image/components/usePreviewGroup.mjs.map +1 -1
  60. package/es/ImageSelect/ImageSelect.mjs.map +1 -1
  61. package/es/Layout/Layout.mjs.map +1 -1
  62. package/es/List/List.mjs.map +1 -1
  63. package/es/List/ListItem/index.mjs.map +1 -1
  64. package/es/Markdown/Markdown.mjs.map +1 -1
  65. package/es/Markdown/SyntaxMarkdown/MarkdownRender.mjs.map +1 -1
  66. package/es/Markdown/SyntaxMarkdown/StreamdownRender.mjs.map +1 -1
  67. package/es/Markdown/SyntaxMarkdown/style.mjs.map +1 -1
  68. package/es/Markdown/components/CodeBlock.mjs.map +1 -1
  69. package/es/Markdown/components/Footnotes.mjs.map +1 -1
  70. package/es/Markdown/components/MarkdownTable/index.mjs.map +1 -1
  71. package/es/Markdown/components/SearchResultCards/SearchResultCard.mjs.map +1 -1
  72. package/es/Markdown/components/SearchResultCards/index.mjs.map +1 -1
  73. package/es/MaterialFileTypeIcon/MaterialFileTypeIcon.mjs.map +1 -1
  74. package/es/Menu/Menu.mjs.map +1 -1
  75. package/es/Mermaid/FullFeatured.mjs.map +1 -1
  76. package/es/Mermaid/Mermaid.mjs.map +1 -1
  77. package/es/Mermaid/SyntaxMermaid/MermaidFallback.mjs +35 -0
  78. package/es/Mermaid/SyntaxMermaid/MermaidFallback.mjs.map +1 -0
  79. package/es/Mermaid/SyntaxMermaid/MermaidSvg.mjs +52 -0
  80. package/es/Mermaid/SyntaxMermaid/MermaidSvg.mjs.map +1 -0
  81. package/es/Mermaid/SyntaxMermaid/StaticMermaid.mjs +13 -42
  82. package/es/Mermaid/SyntaxMermaid/StaticMermaid.mjs.map +1 -1
  83. package/es/Mermaid/SyntaxMermaid/StreamMermaid.mjs +13 -43
  84. package/es/Mermaid/SyntaxMermaid/StreamMermaid.mjs.map +1 -1
  85. package/es/Mermaid/SyntaxMermaid/prepareInlineSvg.mjs +52 -0
  86. package/es/Mermaid/SyntaxMermaid/prepareInlineSvg.mjs.map +1 -0
  87. package/es/Mermaid/SyntaxMermaid/prepareMermaidSvg.mjs +20 -0
  88. package/es/Mermaid/SyntaxMermaid/prepareMermaidSvg.mjs.map +1 -0
  89. package/es/Mermaid/SyntaxMermaid/style.mjs +11 -0
  90. package/es/Mermaid/SyntaxMermaid/style.mjs.map +1 -1
  91. package/es/Mermaid/const.mjs +10 -31
  92. package/es/Mermaid/const.mjs.map +1 -1
  93. package/es/Mermaid/index.d.mts +2 -1
  94. package/es/Mermaid/index.mjs +2 -1
  95. package/es/Mermaid/type.d.mts +2 -2
  96. package/es/Modal/Modal.mjs.map +1 -1
  97. package/es/Modal/ModalStackItem.mjs.map +1 -1
  98. package/es/Modal/RawModalStackItem.mjs.map +1 -1
  99. package/es/Modal/imperative.mjs.map +1 -1
  100. package/es/Modal/style.mjs.map +1 -1
  101. package/es/NeuralNetworkLoading/NeuralNetworkLoading.mjs.map +1 -1
  102. package/es/ScrollShadow/ScrollShadow.mjs.map +1 -1
  103. package/es/SearchBar/SearchBar.mjs.map +1 -1
  104. package/es/SideNav/SideNav.mjs.map +1 -1
  105. package/es/Skeleton/Skeleton.mjs.map +1 -1
  106. package/es/Skeleton/SkeletonParagraph.mjs.map +1 -1
  107. package/es/Skeleton/SkeletonTags.mjs.map +1 -1
  108. package/es/SliderWithInput/SliderWithInput.mjs.map +1 -1
  109. package/es/Snippet/Snippet.mjs.map +1 -1
  110. package/es/SortableList/SortableList.mjs.map +1 -1
  111. package/es/SortableList/components/SortableItem.mjs.map +1 -1
  112. package/es/Text/Text.mjs.map +1 -1
  113. package/es/ThemeProvider/ThemeProvider.mjs +1 -1
  114. package/es/ThemeProvider/ThemeProvider.mjs.map +1 -1
  115. package/es/ThemeSwitch/ThemeSwitch.mjs.map +1 -1
  116. package/es/Toc/Toc.mjs.map +1 -1
  117. package/es/Toc/TocMobile.mjs.map +1 -1
  118. package/es/Video/index.mjs.map +1 -1
  119. package/es/awesome/AuroraBackground/AuroraBackground.mjs.map +1 -1
  120. package/es/awesome/Features/FeatureItem.mjs.map +1 -1
  121. package/es/awesome/Giscus/Giscus.mjs.map +1 -1
  122. package/es/awesome/GradientButton/GradientButton.mjs.map +1 -1
  123. package/es/awesome/GridBackground/GridBackground.mjs.map +1 -1
  124. package/es/awesome/GridBackground/GridShowcase.mjs.map +1 -1
  125. package/es/awesome/GridBackground/components/Grid.mjs.map +1 -1
  126. package/es/awesome/Hero/Hero.mjs.map +1 -1
  127. package/es/awesome/Spline/ParentSize.mjs.map +1 -1
  128. package/es/awesome/Spline/Spine.mjs.map +1 -1
  129. package/es/awesome/SpotlightCard/SpotlightCard.mjs.map +1 -1
  130. package/es/awesome/SpotlightCard/SpotlightCardItem.mjs.map +1 -1
  131. package/es/awesome/TypewriterEffect/TypewriterEffect.mjs.map +1 -1
  132. package/es/base-ui/AutoComplete/AutoComplete.mjs.map +1 -1
  133. package/es/base-ui/Button/Button.mjs.map +1 -1
  134. package/es/base-ui/Button/SplitButton.mjs.map +1 -1
  135. package/es/base-ui/Checkbox/Checkbox.mjs.map +1 -1
  136. package/es/base-ui/Checkbox/CheckboxGroup.mjs.map +1 -1
  137. package/es/base-ui/ContextMenu/ContextMenuHost.mjs.map +1 -1
  138. package/es/base-ui/ContextMenu/imperative.d.mts +2 -2
  139. package/es/base-ui/ContextMenu/index.d.mts +2 -2
  140. package/es/base-ui/ContextMenu/renderItems.mjs.map +1 -1
  141. package/es/base-ui/ContextMenu/store.d.mts +13 -1
  142. package/es/base-ui/ContextMenu/store.mjs +29 -4
  143. package/es/base-ui/ContextMenu/store.mjs.map +1 -1
  144. package/es/base-ui/DropdownMenu/DropdownMenu.mjs.map +1 -1
  145. package/es/base-ui/DropdownMenu/atoms.mjs.map +1 -1
  146. package/es/base-ui/DropdownMenu/renderItems.mjs.map +1 -1
  147. package/es/base-ui/DropdownMenu/sharedStyle.mjs +3 -0
  148. package/es/base-ui/DropdownMenu/sharedStyle.mjs.map +1 -1
  149. package/es/base-ui/FloatingPanel/FloatingPanel.mjs.map +1 -1
  150. package/es/base-ui/FloatingSheet/FloatingSheet.mjs.map +1 -1
  151. package/es/base-ui/FloatingSheet/FloatingSheetHeader.mjs.map +1 -1
  152. package/es/base-ui/Form/Form.mjs.map +1 -1
  153. package/es/base-ui/Form/components/FormField.mjs.map +1 -1
  154. package/es/base-ui/Form/components/FormGroup.mjs.map +1 -1
  155. package/es/base-ui/Form/components/FormSubmitFooter.mjs.map +1 -1
  156. package/es/base-ui/Form/components/FormTitle.mjs.map +1 -1
  157. package/es/base-ui/Input/Input.mjs.map +1 -1
  158. package/es/base-ui/Input/InputNumber.mjs.map +1 -1
  159. package/es/base-ui/Input/InputOTP.mjs.map +1 -1
  160. package/es/base-ui/Input/InputPassword.mjs.map +1 -1
  161. package/es/base-ui/Input/TextArea.mjs.map +1 -1
  162. package/es/base-ui/Input/style.d.mts +1 -1
  163. package/es/base-ui/Modal/Modal.mjs.map +1 -1
  164. package/es/base-ui/Modal/atoms.mjs.map +1 -1
  165. package/es/base-ui/Modal/imperative.mjs.map +1 -1
  166. package/es/base-ui/Popover/ArrowIcon.mjs.map +1 -1
  167. package/es/base-ui/Popover/PopoverGroup.mjs.map +1 -1
  168. package/es/base-ui/Popover/PopoverStandalone.mjs.map +1 -1
  169. package/es/base-ui/Popover/atoms.mjs.map +1 -1
  170. package/es/base-ui/Radio/Radio.mjs.map +1 -1
  171. package/es/base-ui/Radio/RadioGroup.mjs.map +1 -1
  172. package/es/base-ui/ScrollArea/ScrollArea.mjs.map +1 -1
  173. package/es/base-ui/Segmented/Segmented.mjs.map +1 -1
  174. package/es/base-ui/Select/Select.mjs.map +1 -1
  175. package/es/base-ui/Select/parts.mjs.map +1 -1
  176. package/es/base-ui/Select/renderOptions.mjs.map +1 -1
  177. package/es/base-ui/Slider/Slider.mjs.map +1 -1
  178. package/es/base-ui/Slider/SliderWithInput.mjs.map +1 -1
  179. package/es/base-ui/SubmenuArrowIcon.mjs.map +1 -1
  180. package/es/base-ui/Switch/Switch.mjs.map +1 -1
  181. package/es/base-ui/Switch/atoms.d.mts +3 -3
  182. package/es/base-ui/Switch/atoms.mjs +99 -50
  183. package/es/base-ui/Switch/atoms.mjs.map +1 -1
  184. package/es/base-ui/Switch/style.mjs +44 -1
  185. package/es/base-ui/Switch/style.mjs.map +1 -1
  186. package/es/base-ui/Switch/type.d.mts +3 -7
  187. package/es/base-ui/Tabs/Tabs.mjs.map +1 -1
  188. package/es/base-ui/Tabs/atoms.mjs.map +1 -1
  189. package/es/base-ui/Toast/Toast.mjs.map +1 -1
  190. package/es/base-ui/Toast/imperative.mjs.map +1 -1
  191. package/es/base-ui/Tooltip/ArrowIcon.mjs.map +1 -1
  192. package/es/base-ui/Tooltip/TooltipGroup.mjs.map +1 -1
  193. package/es/base-ui/Tooltip/TooltipStandalone.mjs.map +1 -1
  194. package/es/base-ui/index.d.mts +2 -2
  195. package/es/base-ui/index.mjs +2 -2
  196. package/es/brand/LobeChat/index.mjs.map +1 -1
  197. package/es/brand/LobeChatText/index.mjs.map +1 -1
  198. package/es/brand/LobeHub/index.mjs.map +1 -1
  199. package/es/brand/LobeHubText/index.mjs.map +1 -1
  200. package/es/brand/LogoThree/Loading.mjs.map +1 -1
  201. package/es/brand/LogoThree/LogoSpline.mjs.map +1 -1
  202. package/es/brand/LogoThree/index.mjs.map +1 -1
  203. package/es/brand/components/Divider.mjs.map +1 -1
  204. package/es/chat/BackBottom/BackBottom.mjs.map +1 -1
  205. package/es/chat/ChatHeader/ChatHeader.mjs.map +1 -1
  206. package/es/chat/ChatHeader/ChatHeaderTitle.mjs.map +1 -1
  207. package/es/chat/ChatInputArea/ChatInputArea.mjs.map +1 -1
  208. package/es/chat/ChatInputArea/components/ChatInputActionBar.mjs.map +1 -1
  209. package/es/chat/ChatInputArea/components/ChatSendButton.mjs.map +1 -1
  210. package/es/chat/ChatItem/ChatItem.mjs.map +1 -1
  211. package/es/chat/ChatItem/components/Actions.mjs.map +1 -1
  212. package/es/chat/ChatItem/components/Avatar.mjs.map +1 -1
  213. package/es/chat/ChatItem/components/ErrorContent.mjs.map +1 -1
  214. package/es/chat/ChatItem/components/Loading.mjs.map +1 -1
  215. package/es/chat/ChatItem/components/MessageContent.mjs.map +1 -1
  216. package/es/chat/ChatItem/components/Title.mjs.map +1 -1
  217. package/es/chat/ChatList/ChatList.mjs.map +1 -1
  218. package/es/chat/ChatList/components/HistoryDivider.mjs.map +1 -1
  219. package/es/chat/EditableMessage/EditableMessage.mjs.map +1 -1
  220. package/es/chat/EditableMessageList/EditableMessageList.mjs.map +1 -1
  221. package/es/chat/LoadingDots/LoadingDots.mjs.map +1 -1
  222. package/es/chat/MessageInput/MessageInput.mjs.map +1 -1
  223. package/es/chat/MessageModal/MessageModal.mjs.map +1 -1
  224. package/es/color/ColorScales/ScaleRow.mjs.map +1 -1
  225. package/es/color/ColorScales/index.mjs.map +1 -1
  226. package/es/color/CssVar/ScaleRow.mjs.map +1 -1
  227. package/es/color/CssVar/VarRow.mjs.map +1 -1
  228. package/es/color/CssVar/index.mjs.map +1 -1
  229. package/es/hooks/useMarkdown/latex.mjs.map +1 -1
  230. package/es/hooks/useMarkdown/useMarkdownContent.mjs.map +1 -1
  231. package/es/hooks/useMermaid.mjs +80 -116
  232. package/es/hooks/useMermaid.mjs.map +1 -1
  233. package/es/hooks/useMermaidCdn.d.mts +10 -0
  234. package/es/hooks/useMermaidCdn.mjs +97 -0
  235. package/es/hooks/useMermaidCdn.mjs.map +1 -0
  236. package/es/hooks/useStreamMermaid.mjs +19 -70
  237. package/es/hooks/useStreamMermaid.mjs.map +1 -1
  238. package/es/icons/Auth0/components/Mono.mjs.map +1 -1
  239. package/es/icons/Authelia/components/Color.mjs.map +1 -1
  240. package/es/icons/Authelia/components/Mono.mjs.map +1 -1
  241. package/es/icons/Authentik/components/Color.mjs.map +1 -1
  242. package/es/icons/Authentik/components/Mono.mjs.map +1 -1
  243. package/es/icons/Casdoor/components/Color.mjs.map +1 -1
  244. package/es/icons/Casdoor/components/Mono.mjs.map +1 -1
  245. package/es/icons/Clerk/components/Color.mjs.map +1 -1
  246. package/es/icons/Clerk/components/Mono.mjs.map +1 -1
  247. package/es/icons/DingTalk/components/Color.mjs.map +1 -1
  248. package/es/icons/DingTalk/components/Mono.mjs.map +1 -1
  249. package/es/icons/Discord/components/Color.mjs.map +1 -1
  250. package/es/icons/Discord/components/Mono.mjs.map +1 -1
  251. package/es/icons/GoogleChat/components/Color.mjs.map +1 -1
  252. package/es/icons/GoogleChat/components/Mono.mjs.map +1 -1
  253. package/es/icons/IMessage/components/Color.mjs.map +1 -1
  254. package/es/icons/IMessage/components/Inner.mjs.map +1 -1
  255. package/es/icons/IMessage/components/Mono.mjs.map +1 -1
  256. package/es/icons/Lark/components/Color.mjs.map +1 -1
  257. package/es/icons/Lark/components/Mono.mjs.map +1 -1
  258. package/es/icons/Line/components/Color.mjs.map +1 -1
  259. package/es/icons/Line/components/Mono.mjs.map +1 -1
  260. package/es/icons/Logto/components/Color.mjs.map +1 -1
  261. package/es/icons/Logto/components/Mono.mjs.map +1 -1
  262. package/es/icons/MicrosoftEntra/components/Color.mjs.map +1 -1
  263. package/es/icons/MicrosoftEntra/components/Mono.mjs.map +1 -1
  264. package/es/icons/MicrosoftTeams/components/Color.mjs.map +1 -1
  265. package/es/icons/MicrosoftTeams/components/Mono.mjs.map +1 -1
  266. package/es/icons/NextAuth/components/Color.mjs.map +1 -1
  267. package/es/icons/NextAuth/components/Mono.mjs.map +1 -1
  268. package/es/icons/QQ/components/Color.mjs.map +1 -1
  269. package/es/icons/QQ/components/Mono.mjs.map +1 -1
  270. package/es/icons/Slack/components/Color.mjs.map +1 -1
  271. package/es/icons/Slack/components/Mono.mjs.map +1 -1
  272. package/es/icons/Telegram/components/Color.mjs.map +1 -1
  273. package/es/icons/Telegram/components/Inner.mjs.map +1 -1
  274. package/es/icons/Telegram/components/Mono.mjs.map +1 -1
  275. package/es/icons/WeChat/components/Color.mjs.map +1 -1
  276. package/es/icons/WeChat/components/Mono.mjs.map +1 -1
  277. package/es/icons/WhatsApp/components/Color.mjs.map +1 -1
  278. package/es/icons/WhatsApp/components/Mono.mjs.map +1 -1
  279. package/es/icons/Zitadel/components/Color.mjs.map +1 -1
  280. package/es/icons/Zitadel/components/Mono.mjs.map +1 -1
  281. package/es/index.d.mts +2 -2
  282. package/es/index.mjs +2 -2
  283. package/es/mdx/Callout/index.mjs.map +1 -1
  284. package/es/mdx/Cards/Card.mjs.map +1 -1
  285. package/es/mdx/FileTree/File.mjs.map +1 -1
  286. package/es/mdx/FileTree/Folder.mjs.map +1 -1
  287. package/es/mdx/Mdx/index.mjs.map +1 -1
  288. package/es/mdx/Tabs/Tab.mjs.map +1 -1
  289. package/es/mdx/Tabs/index.mjs.map +1 -1
  290. package/es/mdx/mdxComponents/Citation/PopoverPanel.mjs.map +1 -1
  291. package/es/mdx/mdxComponents/Citation/index.mjs.map +1 -1
  292. package/es/mdx/mdxComponents/CodeBlock.mjs.map +1 -1
  293. package/es/mdx/mdxComponents/Link.mjs.map +1 -1
  294. package/es/mobile/ChatHeader/ChatHeader.mjs.map +1 -1
  295. package/es/mobile/ChatHeader/ChatHeaderTitle.mjs.map +1 -1
  296. package/es/mobile/ChatInputArea/ChatInputArea.mjs.map +1 -1
  297. package/es/mobile/TabBar/TabBar.mjs.map +1 -1
  298. package/es/storybook/StoryBook/index.mjs.map +1 -1
  299. package/package.json +3 -4
@@ -1 +1 @@
1
- {"version":3,"file":"renderItems.mjs","names":[],"sources":["../../../src/base-ui/DropdownMenu/renderItems.tsx"],"sourcesContent":["import { Check } from 'lucide-react';\nimport { type MenuInfo } from 'rc-menu/es/interface';\nimport {\n type KeyboardEvent as ReactKeyboardEvent,\n type MouseEvent as ReactMouseEvent,\n type ReactNode,\n} from 'react';\n\nimport { SubmenuArrowIcon } from '@/base-ui/SubmenuArrowIcon';\nimport {\n type BaseMenuItemGroupType,\n type BaseSubMenuType,\n getItemKey,\n getItemLabel,\n hasAnyIcon,\n hasCheckboxAndIcon,\n type MenuDividerType,\n type MenuItemType,\n renderIcon,\n type RenderItemContentOptions,\n type RenderOptions,\n} from '@/Menu';\n\nimport {\n DropdownMenuCheckboxItemIndicator,\n DropdownMenuCheckboxItemPrimitive,\n DropdownMenuFooter,\n DropdownMenuGroup,\n DropdownMenuGroupLabel,\n DropdownMenuHeader,\n DropdownMenuItem,\n DropdownMenuItemContent,\n DropdownMenuItemDesc,\n DropdownMenuItemExtra,\n DropdownMenuItemIcon,\n DropdownMenuItemLabel,\n DropdownMenuItemLabelGroup,\n DropdownMenuPopup,\n DropdownMenuPortal,\n DropdownMenuPositioner,\n DropdownMenuScrollViewport,\n DropdownMenuSeparator,\n DropdownMenuSubmenuArrow,\n DropdownMenuSubmenuRoot,\n DropdownMenuSubmenuTrigger,\n DropdownMenuSwitchItem,\n} from './atoms';\nimport { styles } from './sharedStyle';\nimport {\n type DropdownItem,\n type DropdownMenuCheckboxItem as DropdownMenuCheckboxItemType,\n type DropdownMenuSwitchItem as DropdownMenuSwitchItemType,\n} from './type';\n\nexport type { IconAlign, IconSpaceMode } from '@/Menu';\n\nconst renderItemContent = (\n item: MenuItemType | BaseSubMenuType | DropdownMenuCheckboxItemType | DropdownMenuSwitchItemType,\n options?: RenderItemContentOptions,\n iconNode?: ReactNode,\n) => {\n const label = getItemLabel(item);\n const desc = 'desc' in item ? item.desc : undefined;\n const extra = 'extra' in item ? item.extra : undefined;\n const indicatorOnRight = options?.indicatorOnRight;\n const alignStart = Boolean(desc) && options?.iconAlign === 'start';\n\n const hasCustomIcon = iconNode !== undefined && !indicatorOnRight;\n const hasIcon = hasCustomIcon ? Boolean(iconNode) : Boolean(item.icon);\n const shouldRenderIcon = hasCustomIcon\n ? Boolean(options?.reserveIconSpace || iconNode)\n : Boolean(hasIcon || options?.reserveIconSpace);\n\n const labelNode = desc ? (\n <DropdownMenuItemLabelGroup>\n <DropdownMenuItemLabel>{label}</DropdownMenuItemLabel>\n <DropdownMenuItemDesc>{desc}</DropdownMenuItemDesc>\n </DropdownMenuItemLabelGroup>\n ) : (\n <DropdownMenuItemLabel>{label}</DropdownMenuItemLabel>\n );\n\n return (\n <DropdownMenuItemContent className={alignStart ? styles.itemContentAlignStart : undefined}>\n {shouldRenderIcon ? (\n <DropdownMenuItemIcon\n aria-hidden={!hasIcon}\n className={alignStart ? styles.iconAlignStart : undefined}\n >\n {hasCustomIcon ? iconNode : hasIcon ? renderIcon(item.icon) : null}\n </DropdownMenuItemIcon>\n ) : null}\n {labelNode}\n {extra ? <DropdownMenuItemExtra>{extra}</DropdownMenuItemExtra> : null}\n {indicatorOnRight && iconNode ? iconNode : null}\n {options?.submenu ? (\n <DropdownMenuSubmenuArrow>\n <SubmenuArrowIcon />\n </DropdownMenuSubmenuArrow>\n ) : null}\n </DropdownMenuItemContent>\n );\n};\n\nconst invokeItemClick = (\n item: MenuItemType,\n keyPath: string[],\n event: ReactMouseEvent<HTMLElement> | ReactKeyboardEvent<HTMLElement>,\n) => {\n if (!item.onClick) return;\n const key = item.key ?? keyPath.at(-1) ?? '';\n const info: MenuInfo = {\n domEvent: event,\n item: event.currentTarget as MenuInfo['item'],\n key: String(key),\n keyPath,\n };\n item.onClick(info);\n};\n\nexport const renderDropdownMenuItems = (\n items: DropdownItem[],\n keyPath: string[] = [],\n options?: RenderOptions,\n): ReactNode[] => {\n const iconAlign = options?.iconAlign;\n const iconSpaceMode = options?.iconSpaceMode ?? 'global';\n const reserveIconSpace =\n options?.reserveIconSpace ?? hasAnyIcon(items, iconSpaceMode === 'global');\n const indicatorOnRight = options?.indicatorOnRight ?? hasCheckboxAndIcon(items);\n\n return items.map((item, index) => {\n if (!item) return null;\n\n const fallbackKey = `${keyPath.join('-') || 'root'}-${index}`;\n const itemKey = getItemKey(item, fallbackKey);\n const nextKeyPath = [...keyPath, String(itemKey)];\n\n if ((item as DropdownMenuCheckboxItemType).type === 'checkbox') {\n const checkboxItem = item as DropdownMenuCheckboxItemType;\n const label = getItemLabel(checkboxItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = Boolean(checkboxItem.danger);\n const indicator = (\n <DropdownMenuCheckboxItemIndicator>{renderIcon(Check)}</DropdownMenuCheckboxItemIndicator>\n );\n\n return (\n <DropdownMenuCheckboxItemPrimitive\n checked={checkboxItem.checked}\n closeOnClick={checkboxItem.closeOnClick}\n danger={isDanger}\n defaultChecked={checkboxItem.defaultChecked}\n disabled={checkboxItem.disabled}\n key={itemKey}\n label={labelText}\n onCheckedChange={(checked) => checkboxItem.onCheckedChange?.(checked)}\n >\n {renderItemContent(\n checkboxItem,\n { iconAlign, indicatorOnRight, reserveIconSpace },\n indicator,\n )}\n </DropdownMenuCheckboxItemPrimitive>\n );\n }\n\n if ((item as DropdownMenuSwitchItemType).type === 'switch') {\n const switchItem = item as DropdownMenuSwitchItemType;\n const label = getItemLabel(switchItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = Boolean(switchItem.danger);\n\n return (\n <DropdownMenuSwitchItem\n checked={switchItem.checked}\n closeOnClick={switchItem.closeOnClick}\n danger={isDanger}\n defaultChecked={switchItem.defaultChecked}\n disabled={switchItem.disabled}\n key={itemKey}\n label={labelText}\n onCheckedChange={(checked) => switchItem.onCheckedChange?.(checked)}\n >\n {renderItemContent(switchItem, { iconAlign, reserveIconSpace })}\n </DropdownMenuSwitchItem>\n );\n }\n\n if ((item as MenuDividerType).type === 'divider') {\n return <DropdownMenuSeparator key={itemKey} />;\n }\n\n if ((item as BaseMenuItemGroupType).type === 'group') {\n const group = item as BaseMenuItemGroupType;\n const groupReserveIconSpace =\n iconSpaceMode === 'group'\n ? group.children\n ? hasAnyIcon(group.children)\n : false\n : reserveIconSpace;\n const groupIndicatorOnRight = group.children ? hasCheckboxAndIcon(group.children) : false;\n return (\n <DropdownMenuGroup key={itemKey}>\n {group.label ? <DropdownMenuGroupLabel>{group.label}</DropdownMenuGroupLabel> : null}\n {group.children\n ? renderDropdownMenuItems(group.children, nextKeyPath, {\n iconAlign,\n iconSpaceMode,\n indicatorOnRight: groupIndicatorOnRight,\n reserveIconSpace: groupReserveIconSpace,\n })\n : null}\n </DropdownMenuGroup>\n );\n }\n\n if ((item as BaseSubMenuType).type === 'submenu' || 'children' in item) {\n const submenu = item as BaseSubMenuType;\n const label = getItemLabel(submenu);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = 'danger' in submenu && Boolean(submenu.danger);\n const submenuHasSlots = submenu.header != null || submenu.footer != null;\n const submenuItems = submenu.children\n ? renderDropdownMenuItems(submenu.children, nextKeyPath, {\n iconAlign,\n iconSpaceMode,\n })\n : null;\n\n return (\n <DropdownMenuSubmenuRoot\n defaultOpen={submenu.defaultOpen}\n key={itemKey}\n open={submenu.open}\n onOpenChange={submenu.onOpenChange}\n >\n <DropdownMenuSubmenuTrigger\n {...submenu.triggerProps}\n closeDelay={submenu.closeDelay}\n danger={isDanger}\n delay={submenu.delay}\n disabled={submenu.disabled}\n label={labelText}\n openOnHover={submenu.openOnHover}\n onClick={submenu.onClick}\n >\n {renderItemContent(submenu, {\n iconAlign,\n reserveIconSpace,\n submenu: true,\n })}\n </DropdownMenuSubmenuTrigger>\n <DropdownMenuPortal>\n <DropdownMenuPositioner alignOffset={-4} data-submenu=\"\" sideOffset={-1}>\n <DropdownMenuPopup className={submenuHasSlots ? styles.popupWithSlots : undefined}>\n {submenu.header == null ? null : (\n <DropdownMenuHeader>{submenu.header}</DropdownMenuHeader>\n )}\n {submenuHasSlots ? (\n <DropdownMenuScrollViewport>{submenuItems}</DropdownMenuScrollViewport>\n ) : (\n submenuItems\n )}\n {submenu.footer == null ? null : (\n <DropdownMenuFooter>{submenu.footer}</DropdownMenuFooter>\n )}\n </DropdownMenuPopup>\n </DropdownMenuPositioner>\n </DropdownMenuPortal>\n </DropdownMenuSubmenuRoot>\n );\n }\n\n const menuItem = item as MenuItemType;\n const label = getItemLabel(menuItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = 'danger' in menuItem && Boolean(menuItem.danger);\n\n return (\n <DropdownMenuItem\n closeOnClick={menuItem.closeOnClick}\n danger={isDanger}\n disabled={menuItem.disabled}\n key={itemKey}\n label={labelText}\n onClick={(event) => invokeItemClick(menuItem, nextKeyPath, event)}\n >\n {renderItemContent(menuItem, { iconAlign, reserveIconSpace })}\n </DropdownMenuItem>\n );\n });\n};\n"],"mappings":";;;;;;;AAwDA,MAAM,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,SAAS;MAC1B;MACA;MACA,SAAS;KACX,CAAC;IACyB,CAAA,GAC5B,oBAAC,oBAAD,EAAA,UACE,oBAAC,wBAAD;KAAwB,aAAa;KAAI,gBAAa;KAAG,YAAY;eACnE,qBAAC,mBAAD;MAAmB,WAAW,kBAAkB,OAAO,iBAAiB,KAAA;gBAAxE;OACG,QAAQ,UAAU,OAAO,OACxB,oBAAC,oBAAD,EAAA,UAAqB,QAAQ,OAA2B,CAAA;OAEzD,kBACC,oBAAC,4BAAD,EAAA,UAA6B,aAAyC,CAAA,IAEtE;OAED,QAAQ,UAAU,OAAO,OACxB,oBAAC,oBAAD,EAAA,UAAqB,QAAQ,OAA2B,CAAA;MAEzC;;IACG,CAAA,EACN,CAAA,CACG;MArClB,OAqCkB;EAE7B;EAEA,MAAM,WAAW;EACjB,MAAM,QAAQ,aAAa,QAAQ;EACnC,MAAM,YAAY,OAAO,UAAU,WAAW,QAAQ,KAAA;EACtD,MAAM,WAAW,YAAY,YAAY,QAAQ,SAAS,MAAM;EAEhE,OACE,oBAAC,kBAAD;GACE,cAAc,SAAS;GACvB,QAAQ;GACR,UAAU,SAAS;GAEnB,OAAO;GACP,UAAU,UAAU,gBAAgB,UAAU,aAAa,KAAK;aAE/D,kBAAkB,UAAU;IAAE;IAAW;GAAiB,CAAC;EAC5C,GALX,OAKW;CAEtB,CAAC;AACH"}
1
+ {"version":3,"file":"renderItems.mjs","names":[],"sources":["../../../src/base-ui/DropdownMenu/renderItems.tsx"],"sourcesContent":["import { Check } from 'lucide-react';\nimport { type MenuInfo } from 'rc-menu/es/interface';\nimport {\n type KeyboardEvent as ReactKeyboardEvent,\n type MouseEvent as ReactMouseEvent,\n type ReactNode,\n} from 'react';\n\nimport { SubmenuArrowIcon } from '@/base-ui/SubmenuArrowIcon';\nimport {\n type BaseMenuItemGroupType,\n type BaseSubMenuType,\n getItemKey,\n getItemLabel,\n hasAnyIcon,\n hasCheckboxAndIcon,\n type MenuDividerType,\n type MenuItemType,\n renderIcon,\n type RenderItemContentOptions,\n type RenderOptions,\n} from '@/Menu';\n\nimport {\n DropdownMenuCheckboxItemIndicator,\n DropdownMenuCheckboxItemPrimitive,\n DropdownMenuFooter,\n DropdownMenuGroup,\n DropdownMenuGroupLabel,\n DropdownMenuHeader,\n DropdownMenuItem,\n DropdownMenuItemContent,\n DropdownMenuItemDesc,\n DropdownMenuItemExtra,\n DropdownMenuItemIcon,\n DropdownMenuItemLabel,\n DropdownMenuItemLabelGroup,\n DropdownMenuPopup,\n DropdownMenuPortal,\n DropdownMenuPositioner,\n DropdownMenuScrollViewport,\n DropdownMenuSeparator,\n DropdownMenuSubmenuArrow,\n DropdownMenuSubmenuRoot,\n DropdownMenuSubmenuTrigger,\n DropdownMenuSwitchItem,\n} from './atoms';\nimport { styles } from './sharedStyle';\nimport {\n type DropdownItem,\n type DropdownMenuCheckboxItem as DropdownMenuCheckboxItemType,\n type DropdownMenuSwitchItem as DropdownMenuSwitchItemType,\n} from './type';\n\nexport type { IconAlign, IconSpaceMode } from '@/Menu';\n\nconst renderItemContent = (\n item: MenuItemType | BaseSubMenuType | DropdownMenuCheckboxItemType | DropdownMenuSwitchItemType,\n options?: RenderItemContentOptions,\n iconNode?: ReactNode,\n) => {\n const label = getItemLabel(item);\n const desc = 'desc' in item ? item.desc : undefined;\n const extra = 'extra' in item ? item.extra : undefined;\n const indicatorOnRight = options?.indicatorOnRight;\n const alignStart = Boolean(desc) && options?.iconAlign === 'start';\n\n const hasCustomIcon = iconNode !== undefined && !indicatorOnRight;\n const hasIcon = hasCustomIcon ? Boolean(iconNode) : Boolean(item.icon);\n const shouldRenderIcon = hasCustomIcon\n ? Boolean(options?.reserveIconSpace || iconNode)\n : Boolean(hasIcon || options?.reserveIconSpace);\n\n const labelNode = desc ? (\n <DropdownMenuItemLabelGroup>\n <DropdownMenuItemLabel>{label}</DropdownMenuItemLabel>\n <DropdownMenuItemDesc>{desc}</DropdownMenuItemDesc>\n </DropdownMenuItemLabelGroup>\n ) : (\n <DropdownMenuItemLabel>{label}</DropdownMenuItemLabel>\n );\n\n return (\n <DropdownMenuItemContent className={alignStart ? styles.itemContentAlignStart : undefined}>\n {shouldRenderIcon ? (\n <DropdownMenuItemIcon\n aria-hidden={!hasIcon}\n className={alignStart ? styles.iconAlignStart : undefined}\n >\n {hasCustomIcon ? iconNode : hasIcon ? renderIcon(item.icon) : null}\n </DropdownMenuItemIcon>\n ) : null}\n {labelNode}\n {extra ? <DropdownMenuItemExtra>{extra}</DropdownMenuItemExtra> : null}\n {indicatorOnRight && iconNode ? iconNode : null}\n {options?.submenu ? (\n <DropdownMenuSubmenuArrow>\n <SubmenuArrowIcon />\n </DropdownMenuSubmenuArrow>\n ) : null}\n </DropdownMenuItemContent>\n );\n};\n\nconst invokeItemClick = (\n item: MenuItemType,\n keyPath: string[],\n event: ReactMouseEvent<HTMLElement> | ReactKeyboardEvent<HTMLElement>,\n) => {\n if (!item.onClick) return;\n const key = item.key ?? keyPath.at(-1) ?? '';\n const info: MenuInfo = {\n domEvent: event,\n item: event.currentTarget as MenuInfo['item'],\n key: String(key),\n keyPath,\n };\n item.onClick(info);\n};\n\nexport const renderDropdownMenuItems = (\n items: DropdownItem[],\n keyPath: string[] = [],\n options?: RenderOptions,\n): ReactNode[] => {\n const iconAlign = options?.iconAlign;\n const iconSpaceMode = options?.iconSpaceMode ?? 'global';\n const reserveIconSpace =\n options?.reserveIconSpace ?? hasAnyIcon(items, iconSpaceMode === 'global');\n const indicatorOnRight = options?.indicatorOnRight ?? hasCheckboxAndIcon(items);\n\n return items.map((item, index) => {\n if (!item) return null;\n\n const fallbackKey = `${keyPath.join('-') || 'root'}-${index}`;\n const itemKey = getItemKey(item, fallbackKey);\n const nextKeyPath = [...keyPath, String(itemKey)];\n\n if ((item as DropdownMenuCheckboxItemType).type === 'checkbox') {\n const checkboxItem = item as DropdownMenuCheckboxItemType;\n const label = getItemLabel(checkboxItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = Boolean(checkboxItem.danger);\n const indicator = (\n <DropdownMenuCheckboxItemIndicator>{renderIcon(Check)}</DropdownMenuCheckboxItemIndicator>\n );\n\n return (\n <DropdownMenuCheckboxItemPrimitive\n checked={checkboxItem.checked}\n closeOnClick={checkboxItem.closeOnClick}\n danger={isDanger}\n defaultChecked={checkboxItem.defaultChecked}\n disabled={checkboxItem.disabled}\n key={itemKey}\n label={labelText}\n onCheckedChange={(checked) => checkboxItem.onCheckedChange?.(checked)}\n >\n {renderItemContent(\n checkboxItem,\n { iconAlign, indicatorOnRight, reserveIconSpace },\n indicator,\n )}\n </DropdownMenuCheckboxItemPrimitive>\n );\n }\n\n if ((item as DropdownMenuSwitchItemType).type === 'switch') {\n const switchItem = item as DropdownMenuSwitchItemType;\n const label = getItemLabel(switchItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = Boolean(switchItem.danger);\n\n return (\n <DropdownMenuSwitchItem\n checked={switchItem.checked}\n closeOnClick={switchItem.closeOnClick}\n danger={isDanger}\n defaultChecked={switchItem.defaultChecked}\n disabled={switchItem.disabled}\n key={itemKey}\n label={labelText}\n onCheckedChange={(checked) => switchItem.onCheckedChange?.(checked)}\n >\n {renderItemContent(switchItem, { iconAlign, reserveIconSpace })}\n </DropdownMenuSwitchItem>\n );\n }\n\n if ((item as MenuDividerType).type === 'divider') {\n return <DropdownMenuSeparator key={itemKey} />;\n }\n\n if ((item as BaseMenuItemGroupType).type === 'group') {\n const group = item as BaseMenuItemGroupType;\n const groupReserveIconSpace =\n iconSpaceMode === 'group'\n ? group.children\n ? hasAnyIcon(group.children)\n : false\n : reserveIconSpace;\n const groupIndicatorOnRight = group.children ? hasCheckboxAndIcon(group.children) : false;\n return (\n <DropdownMenuGroup key={itemKey}>\n {group.label ? <DropdownMenuGroupLabel>{group.label}</DropdownMenuGroupLabel> : null}\n {group.children\n ? renderDropdownMenuItems(group.children, nextKeyPath, {\n iconAlign,\n iconSpaceMode,\n indicatorOnRight: groupIndicatorOnRight,\n reserveIconSpace: groupReserveIconSpace,\n })\n : null}\n </DropdownMenuGroup>\n );\n }\n\n if ((item as BaseSubMenuType).type === 'submenu' || 'children' in item) {\n const submenu = item as BaseSubMenuType;\n const label = getItemLabel(submenu);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = 'danger' in submenu && Boolean(submenu.danger);\n const submenuHasSlots = submenu.header != null || submenu.footer != null;\n const submenuItems = submenu.children\n ? renderDropdownMenuItems(submenu.children, nextKeyPath, {\n iconAlign,\n iconSpaceMode,\n })\n : null;\n\n return (\n <DropdownMenuSubmenuRoot\n defaultOpen={submenu.defaultOpen}\n key={itemKey}\n open={submenu.open}\n onOpenChange={submenu.onOpenChange}\n >\n <DropdownMenuSubmenuTrigger\n {...submenu.triggerProps}\n closeDelay={submenu.closeDelay}\n danger={isDanger}\n delay={submenu.delay}\n disabled={submenu.disabled}\n label={labelText}\n openOnHover={submenu.openOnHover}\n onClick={submenu.onClick}\n >\n {renderItemContent(submenu, {\n iconAlign,\n reserveIconSpace,\n submenu: true,\n })}\n </DropdownMenuSubmenuTrigger>\n <DropdownMenuPortal>\n <DropdownMenuPositioner alignOffset={-4} data-submenu=\"\" sideOffset={-1}>\n <DropdownMenuPopup className={submenuHasSlots ? styles.popupWithSlots : undefined}>\n {submenu.header == null ? null : (\n <DropdownMenuHeader>{submenu.header}</DropdownMenuHeader>\n )}\n {submenuHasSlots ? (\n <DropdownMenuScrollViewport>{submenuItems}</DropdownMenuScrollViewport>\n ) : (\n submenuItems\n )}\n {submenu.footer == null ? null : (\n <DropdownMenuFooter>{submenu.footer}</DropdownMenuFooter>\n )}\n </DropdownMenuPopup>\n </DropdownMenuPositioner>\n </DropdownMenuPortal>\n </DropdownMenuSubmenuRoot>\n );\n }\n\n const menuItem = item as MenuItemType;\n const label = getItemLabel(menuItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = 'danger' in menuItem && Boolean(menuItem.danger);\n\n return (\n <DropdownMenuItem\n closeOnClick={menuItem.closeOnClick}\n danger={isDanger}\n disabled={menuItem.disabled}\n key={itemKey}\n label={labelText}\n onClick={(event) => invokeItemClick(menuItem, nextKeyPath, event)}\n >\n {renderItemContent(menuItem, { iconAlign, reserveIconSpace })}\n </DropdownMenuItem>\n );\n });\n};\n"],"mappings":";;;;;;;AAwDA,MAAM,qBACJ,MACA,SACA,aACG;CACH,MAAM,QAAQ,aAAa,IAAI;CAC/B,MAAM,OAAO,UAAU,OAAO,KAAK,OAAO,KAAA;CAC1C,MAAM,QAAQ,WAAW,OAAO,KAAK,QAAQ,KAAA;CAC7C,MAAM,mBAAmB,SAAS;CAClC,MAAM,aAAa,QAAQ,IAAI,KAAK,SAAS,cAAc;CAE3D,MAAM,gBAAgB,aAAa,KAAA,KAAa,CAAC;CACjD,MAAM,UAAU,gBAAgB,QAAQ,QAAQ,IAAI,QAAQ,KAAK,IAAI;CACrE,MAAM,mBAAmB,gBACrB,QAAQ,SAAS,oBAAoB,QAAQ,IAC7C,QAAQ,WAAW,SAAS,gBAAgB;CAEhD,MAAM,YAAY,OAChB,qBAAC,4BAAD,EAAA,UAAA,CACE,oBAAC,uBAAD,EAAA,UAAwB,MAA6B,CAAA,GACrD,oBAAC,sBAAD,EAAA,UAAuB,KAA2B,CAAA,CACxB,EAAA,CAAA,IAE5B,oBAAC,uBAAD,EAAA,UAAwB,MAA6B,CAAA;CAGvD,OACE,qBAAC,yBAAD;EAAyB,WAAW,aAAa,OAAO,wBAAwB,KAAA;EAAhF,UAAA;GACG,mBACC,oBAAC,sBAAD;IACE,eAAa,CAAC;IACd,WAAW,aAAa,OAAO,iBAAiB,KAAA;IAE/C,UAAA,gBAAgB,WAAW,UAAU,WAAW,KAAK,IAAI,IAAI;GAC1C,CAAA,IACpB;GACH;GACA,QAAQ,oBAAC,uBAAD,EAAA,UAAwB,MAA6B,CAAA,IAAI;GACjE,oBAAoB,WAAW,WAAW;GAC1C,SAAS,UACR,oBAAC,0BAAD,EAAA,UACE,oBAAC,kBAAD,CAAmB,CAAA,E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IAErB,MAAM,QAAQ;IACd,cAAc,QAAQ;IAJxB,UAAA,CAME,oBAAC,4BAAD;KACE,GAAI,QAAQ;KACZ,YAAY,QAAQ;KACpB,QAAQ;KACR,OAAO,QAAQ;KACf,UAAU,QAAQ;KAClB,OAAO;KACP,aAAa,QAAQ;KACrB,SAAS,QAAQ;KAEhB,UAAA,kBAAkB,SAAS;MAC1B;MACA;MACA,SAAS;KACX,CAAC;IACyB,CAAA,GAC5B,oBAAC,oBAAD,EAAA,UACE,oBAAC,wBAAD;KAAwB,aAAa;KAAI,gBAAa;KAAG,YAAY;KACnE,UAAA,qBAAC,mBAAD;MAAmB,WAAW,kBAAkB,OAAO,iBAAiB,KAAA;MAAxE,UAAA;OACG,QAAQ,UAAU,OAAO,OACxB,oBAAC,oBAAD,EAAA,UAAqB,QAAQ,OAA2B,CAAA;OAEzD,kBACC,oBAAC,4BAAD,EAAA,UAA6B,aAAyC,CAAA,IAEtE;OAED,QAAQ,UAAU,OAAO,OACxB,oBAAC,oBAAD,EAAA,UAAqB,QAAQ,OAA2B,CAAA;MAEzC;;IACG,CAAA,EACN,CAAA,CACG;GArClB,GAAA,OAqCkB;EAE7B;EAEA,MAAM,WAAW;EACjB,MAAM,QAAQ,aAAa,QAAQ;EACnC,MAAM,YAAY,OAAO,UAAU,WAAW,QAAQ,KAAA;EACtD,MAAM,WAAW,YAAY,YAAY,QAAQ,SAAS,MAAM;EAEhE,OACE,oBAAC,kBAAD;GACE,cAAc,SAAS;GACvB,QAAQ;GACR,UAAU,SAAS;GAEnB,OAAO;GACP,UAAU,UAAU,gBAAgB,UAAU,aAAa,KAAK;GAE/D,UAAA,kBAAkB,UAAU;IAAE;IAAW;GAAiB,CAAC;EAC5C,GALX,OAKW;CAEtB,CAAC;AACH"}
@@ -164,7 +164,10 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
164
164
  white-space: nowrap;
165
165
  `,
166
166
  popup: css`
167
+ overflow-y: auto;
168
+
167
169
  min-width: 220px;
170
+ max-height: var(--available-height);
168
171
  padding: 4px;
169
172
  border-radius: ${cssVar.borderRadius};
170
173
 
@@ -1 +1 @@
1
- {"version":3,"file":"sharedStyle.mjs","names":[],"sources":["../../../src/base-ui/DropdownMenu/sharedStyle.ts"],"sourcesContent":["import { createStaticStyles } from 'antd-style';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => ({\n danger: css`\n --lobe-menu-icon-color: ${cssVar.colorError};\n\n color: ${cssVar.colorError} !important;\n\n &:hover {\n background: ${cssVar.colorErrorBg} !important;\n }\n `,\n\n empty: css`\n cursor: default;\n font-style: italic;\n color: ${cssVar.colorTextTertiary};\n `,\n\n extra: css`\n margin-inline-start: auto;\n padding-inline-start: 16px;\n\n font-family: ${cssVar.fontFamilyCode};\n font-size: 12px;\n color: ${cssVar.colorTextTertiary};\n `,\n\n footer: css`\n flex-shrink: 0;\n padding-block: 8px;\n padding-inline: 12px;\n border-block-start: 1px solid ${cssVar.colorBorder};\n `,\n\n header: css`\n flex-shrink: 0;\n padding-block: 8px;\n padding-inline: 12px;\n border-block-end: 1px solid ${cssVar.colorBorder};\n `,\n\n groupLabel: css`\n user-select: none;\n\n padding-block: 8px 4px;\n padding-inline: 12px;\n\n font-size: 10px;\n font-weight: 600;\n line-height: 14px;\n color: ${cssVar.colorTextTertiary};\n text-transform: uppercase;\n letter-spacing: 0.6px;\n\n [role='group']:first-child > & {\n padding-block-start: 4px;\n }\n `,\n\n icon: css`\n display: flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n\n width: 14px;\n height: 14px;\n margin-inline-end: 12px;\n\n color: var(--lobe-menu-icon-color, ${cssVar.colorTextSecondary});\n\n & svg {\n width: 100%;\n height: 100%;\n }\n `,\n\n item: css`\n user-select: none;\n\n position: relative;\n\n overflow: hidden;\n display: flex;\n align-items: center;\n\n width: 100%;\n min-height: 32px;\n padding-block: 6px;\n padding-inline: 12px;\n border-radius: ${cssVar.borderRadiusSM};\n\n font-size: 14px;\n line-height: 20px;\n color: ${cssVar.colorText};\n\n outline: none;\n\n transition: all 150ms ${cssVar.motionEaseOut};\n\n &:hover {\n background: ${cssVar.colorFillTertiary};\n }\n\n &:active {\n background: ${cssVar.colorFillSecondary};\n }\n\n &[data-disabled] {\n cursor: not-allowed;\n color: ${cssVar.colorTextDisabled};\n opacity: 0.5;\n\n &:hover {\n background: transparent;\n }\n }\n\n &[data-highlighted]:not([data-disabled]) {\n background: ${cssVar.colorFillTertiary};\n }\n\n &[data-state='open']:not([data-disabled]),\n &[data-open]:not([data-disabled]),\n &[aria-expanded='true']:not([data-disabled]) {\n background: ${cssVar.colorFillTertiary};\n }\n `,\n\n itemContent: css`\n display: flex;\n flex: 1;\n gap: 0;\n align-items: center;\n `,\n\n itemContentAlignStart: css`\n align-items: flex-start;\n `,\n\n iconAlignStart: css`\n align-self: flex-start;\n margin-block-start: 2px;\n `,\n\n label: css`\n overflow: hidden;\n flex: 1;\n text-overflow: ellipsis;\n white-space: nowrap;\n\n & a,\n & a:visited,\n & a:hover,\n & a:active {\n color: inherit;\n }\n `,\n\n labelGroup: css`\n overflow: hidden;\n display: flex;\n flex: 1;\n flex-direction: column;\n\n min-width: 0;\n `,\n\n desc: css`\n overflow: hidden;\n\n font-size: 12px;\n line-height: 16px;\n color: ${cssVar.colorTextTertiary};\n text-overflow: ellipsis;\n white-space: nowrap;\n `,\n\n popup: css`\n min-width: 220px;\n padding: 4px;\n border-radius: ${cssVar.borderRadius};\n\n background: ${cssVar.colorBgElevated};\n outline: none;\n box-shadow:\n 0 0 0 1px ${cssVar.colorBorder},\n 0 4px 12px 0 rgb(0 0 0 / 8%),\n 0 1px 3px 0 rgb(0 0 0 / 6%);\n\n &[data-has-header] {\n padding-block-start: 0;\n }\n\n &[data-has-footer] {\n padding-block-end: 0;\n }\n `,\n\n popupWithSlots: css`\n overflow: hidden;\n display: flex;\n flex-direction: column;\n max-height: var(--available-height);\n `,\n\n slotViewport: css`\n overflow-y: auto;\n flex: 1;\n min-height: 0;\n `,\n\n positioner: css`\n --lobe-dropdown-animation-duration: 140ms;\n --lobe-dropdown-animation-scale-y: 0.92;\n --lobe-dropdown-animation-ease-in: ease-in;\n --lobe-dropdown-animation-ease-out: ${cssVar.motionEaseOut};\n\n z-index: 1100;\n\n & > * {\n will-change: opacity, transform;\n transform-origin: var(--transform-origin);\n animation: none;\n }\n\n &[data-open] > * {\n transform: scaleY(1);\n opacity: 1;\n transition:\n opacity var(--lobe-dropdown-animation-duration) var(--lobe-dropdown-animation-ease-out),\n transform var(--lobe-dropdown-animation-duration) var(--lobe-dropdown-animation-ease-out);\n }\n\n &[data-open] > *[data-starting-style] {\n transform: scaleY(var(--lobe-dropdown-animation-scale-y));\n opacity: 0;\n }\n\n &[data-closed] > * {\n transform: scaleY(var(--lobe-dropdown-animation-scale-y));\n opacity: 0;\n transition:\n opacity var(--lobe-dropdown-animation-duration) var(--lobe-dropdown-animation-ease-in),\n transform var(--lobe-dropdown-animation-duration) var(--lobe-dropdown-animation-ease-in);\n }\n\n &[data-hover-trigger] {\n --lobe-dropdown-animation-duration: 140ms;\n }\n\n &[data-submenu],\n &[data-nested] {\n --lobe-dropdown-animation-duration: 0ms;\n --lobe-dropdown-animation-scale-y: 1;\n\n z-index: 1199;\n }\n\n &[data-side='left'],\n &[data-side='right'] {\n --lobe-dropdown-animation-duration: 0ms;\n --lobe-dropdown-animation-scale-y: 1;\n }\n `,\n\n separator: css`\n height: 1px;\n margin-block: 4px;\n margin-inline: 0;\n background: ${cssVar.colorBorder};\n `,\n\n submenuArrow: css`\n display: flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n\n width: 16px;\n height: 16px;\n margin-inline-start: 8px;\n\n color: var(--lobe-menu-icon-color, ${cssVar.colorTextSecondary});\n\n & svg {\n width: 12px;\n height: 12px;\n }\n `,\n}));\n"],"mappings":";;AAEA,MAAa,SAAS,oBAAoB,EAAE,KAAK,cAAc;CAC7D,QAAQ,GAAG;8BACiB,OAAO,WAAW;;aAEnC,OAAO,WAAW;;;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'antd-style';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => ({\n danger: css`\n --lobe-menu-icon-color: ${cssVar.colorError};\n\n color: ${cssVar.colorError} !important;\n\n &:hover {\n background: ${cssVar.colorErrorBg} !important;\n }\n `,\n\n empty: css`\n cursor: default;\n font-style: italic;\n color: ${cssVar.colorTextTertiary};\n `,\n\n extra: css`\n margin-inline-start: auto;\n padding-inline-start: 16px;\n\n font-family: ${cssVar.fontFamilyCode};\n font-size: 12px;\n color: ${cssVar.colorTextTertiary};\n `,\n\n footer: css`\n flex-shrink: 0;\n padding-block: 8px;\n padding-inline: 12px;\n border-block-start: 1px solid ${cssVar.colorBorder};\n `,\n\n header: css`\n flex-shrink: 0;\n padding-block: 8px;\n padding-inline: 12px;\n border-block-end: 1px solid ${cssVar.colorBorder};\n `,\n\n groupLabel: css`\n user-select: none;\n\n padding-block: 8px 4px;\n padding-inline: 12px;\n\n font-size: 10px;\n font-weight: 600;\n line-height: 14px;\n color: ${cssVar.colorTextTertiary};\n text-transform: uppercase;\n letter-spacing: 0.6px;\n\n [role='group']:first-child > & {\n padding-block-start: 4px;\n }\n `,\n\n icon: css`\n display: flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n\n width: 14px;\n height: 14px;\n margin-inline-end: 12px;\n\n color: var(--lobe-menu-icon-color, ${cssVar.colorTextSecondary});\n\n & svg {\n width: 100%;\n height: 100%;\n }\n `,\n\n item: css`\n user-select: none;\n\n position: relative;\n\n overflow: hidden;\n display: flex;\n align-items: center;\n\n width: 100%;\n min-height: 32px;\n padding-block: 6px;\n padding-inline: 12px;\n border-radius: ${cssVar.borderRadiusSM};\n\n font-size: 14px;\n line-height: 20px;\n color: ${cssVar.colorText};\n\n outline: none;\n\n transition: all 150ms ${cssVar.motionEaseOut};\n\n &:hover {\n background: ${cssVar.colorFillTertiary};\n }\n\n &:active {\n background: ${cssVar.colorFillSecondary};\n }\n\n &[data-disabled] {\n cursor: not-allowed;\n color: ${cssVar.colorTextDisabled};\n opacity: 0.5;\n\n &:hover {\n background: transparent;\n }\n }\n\n &[data-highlighted]:not([data-disabled]) {\n background: ${cssVar.colorFillTertiary};\n }\n\n &[data-state='open']:not([data-disabled]),\n &[data-open]:not([data-disabled]),\n &[aria-expanded='true']:not([data-disabled]) {\n background: ${cssVar.colorFillTertiary};\n }\n `,\n\n itemContent: css`\n display: flex;\n flex: 1;\n gap: 0;\n align-items: center;\n `,\n\n itemContentAlignStart: css`\n align-items: flex-start;\n `,\n\n iconAlignStart: css`\n align-self: flex-start;\n margin-block-start: 2px;\n `,\n\n label: css`\n overflow: hidden;\n flex: 1;\n text-overflow: ellipsis;\n white-space: nowrap;\n\n & a,\n & a:visited,\n & a:hover,\n & a:active {\n color: inherit;\n }\n `,\n\n labelGroup: css`\n overflow: hidden;\n display: flex;\n flex: 1;\n flex-direction: column;\n\n min-width: 0;\n `,\n\n desc: css`\n overflow: hidden;\n\n font-size: 12px;\n line-height: 16px;\n color: ${cssVar.colorTextTertiary};\n text-overflow: ellipsis;\n white-space: nowrap;\n `,\n\n popup: css`\n overflow-y: auto;\n\n min-width: 220px;\n max-height: var(--available-height);\n padding: 4px;\n border-radius: ${cssVar.borderRadius};\n\n background: ${cssVar.colorBgElevated};\n outline: none;\n box-shadow:\n 0 0 0 1px ${cssVar.colorBorder},\n 0 4px 12px 0 rgb(0 0 0 / 8%),\n 0 1px 3px 0 rgb(0 0 0 / 6%);\n\n &[data-has-header] {\n padding-block-start: 0;\n }\n\n &[data-has-footer] {\n padding-block-end: 0;\n }\n `,\n\n popupWithSlots: css`\n overflow: hidden;\n display: flex;\n flex-direction: column;\n max-height: var(--available-height);\n `,\n\n slotViewport: css`\n overflow-y: auto;\n flex: 1;\n min-height: 0;\n `,\n\n positioner: css`\n --lobe-dropdown-animation-duration: 140ms;\n --lobe-dropdown-animation-scale-y: 0.92;\n --lobe-dropdown-animation-ease-in: ease-in;\n --lobe-dropdown-animation-ease-out: ${cssVar.motionEaseOut};\n\n z-index: 1100;\n\n & > * {\n will-change: opacity, transform;\n transform-origin: var(--transform-origin);\n animation: none;\n }\n\n &[data-open] > * {\n transform: scaleY(1);\n opacity: 1;\n transition:\n opacity var(--lobe-dropdown-animation-duration) var(--lobe-dropdown-animation-ease-out),\n transform var(--lobe-dropdown-animation-duration) var(--lobe-dropdown-animation-ease-out);\n }\n\n &[data-open] > *[data-starting-style] {\n transform: scaleY(var(--lobe-dropdown-animation-scale-y));\n opacity: 0;\n }\n\n &[data-closed] > * {\n transform: scaleY(var(--lobe-dropdown-animation-scale-y));\n opacity: 0;\n transition:\n opacity var(--lobe-dropdown-animation-duration) var(--lobe-dropdown-animation-ease-in),\n transform var(--lobe-dropdown-animation-duration) var(--lobe-dropdown-animation-ease-in);\n }\n\n &[data-hover-trigger] {\n --lobe-dropdown-animation-duration: 140ms;\n }\n\n &[data-submenu],\n &[data-nested] {\n --lobe-dropdown-animation-duration: 0ms;\n --lobe-dropdown-animation-scale-y: 1;\n\n z-index: 1199;\n }\n\n &[data-side='left'],\n &[data-side='right'] {\n --lobe-dropdown-animation-duration: 0ms;\n --lobe-dropdown-animation-scale-y: 1;\n }\n `,\n\n separator: css`\n height: 1px;\n margin-block: 4px;\n margin-inline: 0;\n background: ${cssVar.colorBorder};\n `,\n\n submenuArrow: css`\n display: flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n\n width: 16px;\n height: 16px;\n margin-inline-start: 8px;\n\n color: var(--lobe-menu-icon-color, ${cssVar.colorTextSecondary});\n\n & svg {\n width: 12px;\n height: 12px;\n }\n `,\n}));\n"],"mappings":";;AAEA,MAAa,SAAS,oBAAoB,EAAE,KAAK,cAAc;CAC7D,QAAQ,GAAG;8BACiB,OAAO,WAAW;;aAEnC,OAAO,WAAW;;;oBAGX,OAAO,aAAa;;;CAItC,OAAO,GAAG;;;aAGC,OAAO,kBAAkB;;CAGpC,OAAO,GAAG;;;;mBAIO,OAAO,eAAe;;aAE5B,OAAO,kBAAkB;;CAGpC,QAAQ,GAAG;;;;oCAIuB,OAAO,YAAY;;CAGrD,QAAQ,GAAG;;;;kCAIqB,OAAO,YAAY;;CAGnD,YAAY,GAAG;;;;;;;;;aASJ,OAAO,kBAAkB;;;;;;;;CASpC,MAAM,GAAG;;;;;;;;;;yCAU8B,OAAO,mBAAmB;;;;;;;CAQjE,MAAM,GAAG;;;;;;;;;;;;;qBAaU,OAAO,eAAe;;;;aAI9B,OAAO,UAAU;;;;4BAIF,OAAO,cAAc;;;oBAG7B,OAAO,kBAAkB;;;;oBAIzB,OAAO,mBAAmB;;;;;eAK/B,OAAO,kBAAkB;;;;;;;;;oBASpB,OAAO,kBAAkB;;;;;;oBAMzB,OAAO,kBAAkB;;;CAI3C,aAAa,GAAG;;;;;;CAOhB,uBAAuB,GAAG;;;CAI1B,gBAAgB,GAAG;;;;CAKnB,OAAO,GAAG;;;;;;;;;;;;;CAcV,YAAY,GAAG;;;;;;;;CASf,MAAM,GAAG;;;;;aAKE,OAAO,kBAAkB;;;;CAKpC,OAAO,GAAG;;;;;;qBAMS,OAAO,aAAa;;kBAEvB,OAAO,gBAAgB;;;kBAGvB,OAAO,YAAY;;;;;;;;;;;;CAanC,gBAAgB,GAAG;;;;;;CAOnB,cAAc,GAAG;;;;;CAMjB,YAAY,GAAG;;;;0CAIyB,OAAO,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkD7D,WAAW,GAAG;;;;kBAIE,OAAO,YAAY;;CAGnC,cAAc,GAAG;;;;;;;;;;yCAUsB,OAAO,mBAAmB;;;;;;;AAOnE,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"file":"FloatingPanel.mjs","names":[],"sources":["../../../src/base-ui/FloatingPanel/FloatingPanel.tsx"],"sourcesContent":["'use client';\n\nimport { cx } from 'antd-style';\nimport { X } from 'lucide-react';\nimport type { MotionProps } from 'motion/react';\nimport type { CSSProperties, PointerEvent as ReactPointerEvent } from 'react';\nimport { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport type { ModalRootProps } from '../Modal';\nimport {\n ModalBackdrop,\n ModalClose,\n ModalContent,\n ModalFooter,\n ModalHeader,\n ModalPopup,\n ModalPortal,\n ModalRoot,\n ModalTitle,\n} from '../Modal';\nimport { styles } from './style';\nimport type {\n FloatingPanelOffset,\n FloatingPanelPlacement,\n FloatingPanelProps,\n FloatingPanelResizeHandle,\n FloatingPanelSize,\n} from './type';\n\nconst DEFAULT_MIN_HEIGHT = 180;\nconst DEFAULT_MIN_WIDTH = 320;\n\ninterface InternalFloatingPanelSize extends FloatingPanelSize {\n sourceHeight?: number | string;\n sourceWidth?: number | string;\n}\n\nconst defaultMotionProps: MotionProps = {\n animate: { opacity: 1, scale: 1, x: 0, y: 0 },\n exit: {\n opacity: 0,\n scale: 0.98,\n transition: { duration: 0.14, ease: [0.4, 0, 1, 1] },\n y: 12,\n },\n initial: { opacity: 0, scale: 0.98, y: 12 },\n transition: { duration: 0.2, ease: [0.32, 0.72, 0, 1] },\n};\n\nconst topMotionProps: MotionProps = {\n animate: { opacity: 1, scale: 1, x: 0, y: 0 },\n exit: {\n opacity: 0,\n scale: 0.98,\n transition: { duration: 0.14, ease: [0.4, 0, 1, 1] },\n y: -12,\n },\n initial: { opacity: 0, scale: 0.98, y: -12 },\n transition: { duration: 0.2, ease: [0.32, 0.72, 0, 1] },\n};\n\nconst resolveOffset = (offset: FloatingPanelOffset) => {\n if (typeof offset === 'object') {\n return {\n x: offset.x ?? 8,\n y: offset.y ?? 8,\n };\n }\n\n return { x: offset, y: offset };\n};\n\nconst getPlacementStyle = (\n placement: FloatingPanelPlacement,\n offset: FloatingPanelOffset,\n): CSSProperties => {\n const { x, y } = resolveOffset(offset);\n const isTop = placement.startsWith('top');\n const isLeft = placement.endsWith('Left');\n\n return {\n alignItems: isTop ? 'flex-start' : 'flex-end',\n justifyContent: isLeft ? 'flex-start' : 'flex-end',\n paddingBlockEnd: isTop ? undefined : y,\n paddingBlockStart: isTop ? y : undefined,\n paddingInlineEnd: isLeft ? undefined : x,\n paddingInlineStart: isLeft ? x : undefined,\n };\n};\n\nconst clamp = (value: number, min: number, max: number) => Math.min(Math.max(value, min), max);\n\nconst getViewportMaxSize = () => ({\n height: Math.max(DEFAULT_MIN_HEIGHT, window.innerHeight - 16),\n width: Math.max(DEFAULT_MIN_WIDTH, window.innerWidth - 16),\n});\n\nconst getResizeHandles = (placement: FloatingPanelPlacement): FloatingPanelResizeHandle[] => {\n switch (placement) {\n case 'bottomLeft': {\n return ['top', 'right', 'topRight'];\n }\n case 'topLeft': {\n return ['bottom', 'right', 'bottomRight'];\n }\n case 'topRight': {\n return ['bottom', 'left', 'bottomLeft'];\n }\n default: {\n return ['top', 'left', 'topLeft'];\n }\n }\n};\n\nconst getResizeHandleClassName = (s: typeof styles, handle: FloatingPanelResizeHandle) => {\n const handleClassMap: Record<FloatingPanelResizeHandle, string> = {\n bottom: s.resizeHandleBottom,\n bottomLeft: s.resizeHandleBottomLeft,\n bottomRight: s.resizeHandleBottomRight,\n left: s.resizeHandleLeft,\n right: s.resizeHandleRight,\n top: s.resizeHandleTop,\n topLeft: s.resizeHandleTopLeft,\n topRight: s.resizeHandleTopRight,\n };\n\n return handleClassMap[handle];\n};\n\nconst resolveResizeSize = ({\n handle,\n maxHeight,\n maxWidth,\n minHeight,\n minWidth,\n startHeight,\n startWidth,\n startX,\n startY,\n x,\n y,\n}: {\n handle: FloatingPanelResizeHandle;\n maxHeight: number;\n maxWidth: number;\n minHeight: number;\n minWidth: number;\n startHeight: number;\n startWidth: number;\n startX: number;\n startY: number;\n x: number;\n y: number;\n}): FloatingPanelSize => {\n const deltaX = x - startX;\n const deltaY = y - startY;\n const growsLeft = handle.includes('Left') || handle === 'left';\n const growsRight = handle.includes('Right') || handle === 'right';\n const growsTop = handle.includes('top') || handle === 'top';\n const growsBottom = handle.includes('bottom') || handle === 'bottom';\n\n const nextWidth = growsLeft ? startWidth - deltaX : growsRight ? startWidth + deltaX : startWidth;\n const nextHeight = growsTop\n ? startHeight - deltaY\n : growsBottom\n ? startHeight + deltaY\n : startHeight;\n\n return {\n height: clamp(nextHeight, minHeight, maxHeight),\n width: clamp(nextWidth, minWidth, maxWidth),\n };\n};\n\nconst FloatingPanel = memo<FloatingPanelProps>(\n ({\n afterClose,\n ariaLabel,\n children,\n className,\n classNames,\n closable = true,\n closeIcon,\n closeLabel = 'Close',\n defaultOpen,\n actions,\n footer,\n getContainer,\n height,\n keyboard = true,\n mask = false,\n maskClosable = true,\n maxHeight,\n maxWidth,\n minHeight = DEFAULT_MIN_HEIGHT,\n minWidth = DEFAULT_MIN_WIDTH,\n modal = false,\n motionProps,\n offset = 8,\n onClose,\n onOpenChange,\n onResize,\n onResizeEnd,\n open,\n placement = 'bottomRight',\n resizable = true,\n styles: semanticStyles,\n title,\n width = 640,\n zIndex,\n }) => {\n const s = styles;\n const isTop = placement.startsWith('top');\n const container = getContainer === false ? undefined : getContainer;\n const [resizeSize, setResizeSize] = useState<InternalFloatingPanelSize>();\n const latestResizeSizeRef = useRef<FloatingPanelSize | undefined>(undefined);\n const resizeCleanupRef = useRef<(() => void) | undefined>(undefined);\n const activeResizeSize =\n resizeSize?.sourceWidth === width && resizeSize.sourceHeight === height\n ? resizeSize\n : undefined;\n\n useEffect(\n () => () => {\n resizeCleanupRef.current?.();\n },\n [],\n );\n\n const popupStyle = useMemo(\n () => ({\n ...getPlacementStyle(placement, offset),\n ...semanticStyles?.wrapper,\n }),\n [offset, placement, semanticStyles?.wrapper],\n );\n\n const handleOpenChange = useCallback<NonNullable<ModalRootProps['onOpenChange']>>(\n (nextOpen, eventDetails) => {\n if (!nextOpen) {\n if (keyboard === false && eventDetails.reason === 'escape-key') return;\n if (maskClosable === false && eventDetails.reason === 'outside-press') return;\n onClose?.();\n }\n\n onOpenChange?.(nextOpen, eventDetails);\n },\n [keyboard, maskClosable, onClose, onOpenChange],\n );\n\n const showHeader = title !== undefined || actions !== undefined || closable;\n const resolvedMotionProps = motionProps ?? (isTop ? topMotionProps : defaultMotionProps);\n const resizeHandles = useMemo(() => getResizeHandles(placement), [placement]);\n\n const handleResizeStart = useCallback(\n (handle: FloatingPanelResizeHandle) => (event: ReactPointerEvent<HTMLDivElement>) => {\n event.preventDefault();\n event.stopPropagation();\n\n const panel = event.currentTarget.parentElement;\n if (!panel) return;\n\n const rect = panel.getBoundingClientRect();\n const viewportMaxSize = getViewportMaxSize();\n const resolvedMaxWidth = Math.max(minWidth, maxWidth ?? viewportMaxSize.width);\n const resolvedMaxHeight = Math.max(minHeight, maxHeight ?? viewportMaxSize.height);\n const startX = event.clientX;\n const startY = event.clientY;\n\n const handleResizeMove = (moveEvent: PointerEvent) => {\n const nextSize = resolveResizeSize({\n handle,\n maxHeight: resolvedMaxHeight,\n maxWidth: resolvedMaxWidth,\n minHeight,\n minWidth,\n startHeight: rect.height,\n startWidth: rect.width,\n startX,\n startY,\n x: moveEvent.clientX,\n y: moveEvent.clientY,\n });\n\n const nextState = { ...nextSize, sourceHeight: height, sourceWidth: width };\n latestResizeSizeRef.current = nextSize;\n setResizeSize(nextState);\n onResize?.(nextSize);\n };\n\n const handleResizeEnd = () => {\n resizeCleanupRef.current?.();\n resizeCleanupRef.current = undefined;\n\n if (latestResizeSizeRef.current) onResizeEnd?.(latestResizeSizeRef.current);\n };\n\n resizeCleanupRef.current?.();\n window.addEventListener('pointermove', handleResizeMove);\n window.addEventListener('pointerup', handleResizeEnd);\n resizeCleanupRef.current = () => {\n window.removeEventListener('pointermove', handleResizeMove);\n window.removeEventListener('pointerup', handleResizeEnd);\n };\n },\n [height, maxHeight, maxWidth, minHeight, minWidth, onResize, onResizeEnd, width],\n );\n\n return (\n <ModalRoot\n defaultOpen={defaultOpen}\n modal={modal}\n open={open}\n zIndex={zIndex}\n onExitComplete={afterClose}\n onOpenChange={handleOpenChange}\n >\n <ModalPortal container={container}>\n {mask && (\n <ModalBackdrop className={classNames?.backdrop} style={semanticStyles?.backdrop} />\n )}\n <ModalPopup\n aria-label={ariaLabel}\n className={cx(s.wrapper, classNames?.wrapper)}\n motionProps={resolvedMotionProps}\n panelClassName={cx(s.panel, isTop && s.panelTop, className, classNames?.panel)}\n popupStyle={popupStyle}\n width={activeResizeSize?.width ?? width}\n style={{\n height: activeResizeSize?.height ?? height,\n minHeight,\n minWidth,\n width: activeResizeSize?.width,\n ...semanticStyles?.panel,\n }}\n >\n {resizable &&\n resizeHandles.map((handle) => (\n <div\n aria-hidden\n data-floating-panel-resize-handle={handle}\n key={handle}\n style={semanticStyles?.resizeHandle}\n className={cx(\n s.resizeHandle,\n getResizeHandleClassName(s, handle),\n classNames?.resizeHandle,\n )}\n onPointerDown={handleResizeStart(handle)}\n />\n ))}\n {showHeader && (\n <ModalHeader\n className={cx(s.header, classNames?.header)}\n style={semanticStyles?.header}\n >\n {title !== undefined ? (\n <ModalTitle\n className={cx(s.title, classNames?.title)}\n style={semanticStyles?.title}\n >\n {title}\n </ModalTitle>\n ) : (\n <span />\n )}\n <div className={s.headerActions}>\n {actions && (\n <div\n className={cx(s.actions, classNames?.actions)}\n style={semanticStyles?.actions}\n >\n {actions}\n </div>\n )}\n {closable && (\n <ModalClose\n aria-label={closeLabel}\n className={cx(s.close, classNames?.close)}\n style={semanticStyles?.close}\n >\n {closeIcon ?? <X size={16} />}\n </ModalClose>\n )}\n </div>\n </ModalHeader>\n )}\n <ModalContent className={cx(s.body, classNames?.body)} style={semanticStyles?.body}>\n {children}\n </ModalContent>\n {footer && (\n <ModalFooter\n className={cx(s.footer, classNames?.footer)}\n style={semanticStyles?.footer}\n >\n {footer}\n </ModalFooter>\n )}\n </ModalPopup>\n </ModalPortal>\n </ModalRoot>\n );\n },\n);\n\nFloatingPanel.displayName = 'FloatingPanel';\n\nexport { FloatingPanel };\n"],"mappings":";;;;;;;;AA6BA,MAAM,qBAAqB;AAC3B,MAAM,oBAAoB;AAO1B,MAAM,qBAAkC;CACtC,SAAS;EAAE,SAAS;EAAG,OAAO;EAAG,GAAG;EAAG,GAAG;CAAE;CAC5C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KACpC;KACA;KACA,OAAO,kBAAkB;KACzB,GAAG,gBAAgB;IACrB;cAbF;KAeG,aACC,cAAc,KAAK,WACjB,oBAAC,OAAD;MACE,eAAA;MACA,qCAAmC;MAEnC,OAAO,gBAAgB;MACvB,WAAW,GACT,EAAE,cACF,yBAAyB,GAAG,MAAM,GAClC,YAAY,YACd;MACA,eAAe,kBAAkB,MAAM;KACxC,GARM,MAQN,CACF;KACF,cACC,qBAAC,aAAD;MACE,WAAW,GAAG,EAAE,QAAQ,YAAY,MAAM;MAC1C,OAAO,gBAAgB;gBAFzB,CAIG,UAAU,KAAA,IACT,oBAAC,YAAD;OACE,WAAW,GAAG,EAAE,OAAO,YAAY,KAAK;OACxC,OAAO,gBAAgB;iBAEtB;MACS,CAAA,IAEZ,oBAAC,QAAD,CAAO,CAAA,GAET,qBAAC,OAAD;OAAK,WAAW,EAAE;iBAAlB,CACG,WACC,oBAAC,OAAD;QACE,WAAW,GAAG,EAAE,SAAS,YAAY,OAAO;QAC5C,OAAO,gBAAgB;kBAEtB;OACE,CAAA,GAEN,YACC,oBAAC,YAAD;QACE,cAAY;QACZ,WAAW,GAAG,EAAE,OAAO,YAAY,KAAK;QACxC,OAAO,gBAAgB;kBAEtB,aAAa,oBAAC,GAAD,EAAG,MAAM,GAAK,CAAA;OAClB,CAAA,CAEX;QACM;;KAEf,oBAAC,cAAD;MAAc,WAAW,GAAG,EAAE,MAAM,YAAY,IAAI;MAAG,OAAO,gBAAgB;MAC3E;KACW,CAAA;KACb,UACC,oBAAC,aAAD;MACE,WAAW,GAAG,EAAE,QAAQ,YAAY,MAAM;MAC1C,OAAO,gBAAgB;gBAEtB;KACU,CAAA;IAEL;KACD;;CACJ,CAAA;AAEf,CACF;AAEA,cAAc,cAAc"}
1
+ {"version":3,"file":"FloatingPanel.mjs","names":[],"sources":["../../../src/base-ui/FloatingPanel/FloatingPanel.tsx"],"sourcesContent":["'use client';\n\nimport { cx } from 'antd-style';\nimport { X } from 'lucide-react';\nimport type { MotionProps } from 'motion/react';\nimport type { CSSProperties, PointerEvent as ReactPointerEvent } from 'react';\nimport { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport type { ModalRootProps } from '../Modal';\nimport {\n ModalBackdrop,\n ModalClose,\n ModalContent,\n ModalFooter,\n ModalHeader,\n ModalPopup,\n ModalPortal,\n ModalRoot,\n ModalTitle,\n} from '../Modal';\nimport { styles } from './style';\nimport type {\n FloatingPanelOffset,\n FloatingPanelPlacement,\n FloatingPanelProps,\n FloatingPanelResizeHandle,\n FloatingPanelSize,\n} from './type';\n\nconst DEFAULT_MIN_HEIGHT = 180;\nconst DEFAULT_MIN_WIDTH = 320;\n\ninterface InternalFloatingPanelSize extends FloatingPanelSize {\n sourceHeight?: number | string;\n sourceWidth?: number | string;\n}\n\nconst defaultMotionProps: MotionProps = {\n animate: { opacity: 1, scale: 1, x: 0, y: 0 },\n exit: {\n opacity: 0,\n scale: 0.98,\n transition: { duration: 0.14, ease: [0.4, 0, 1, 1] },\n y: 12,\n },\n initial: { opacity: 0, scale: 0.98, y: 12 },\n transition: { duration: 0.2, ease: [0.32, 0.72, 0, 1] },\n};\n\nconst topMotionProps: MotionProps = {\n animate: { opacity: 1, scale: 1, x: 0, y: 0 },\n exit: {\n opacity: 0,\n scale: 0.98,\n transition: { duration: 0.14, ease: [0.4, 0, 1, 1] },\n y: -12,\n },\n initial: { opacity: 0, scale: 0.98, y: -12 },\n transition: { duration: 0.2, ease: [0.32, 0.72, 0, 1] },\n};\n\nconst resolveOffset = (offset: FloatingPanelOffset) => {\n if (typeof offset === 'object') {\n return {\n x: offset.x ?? 8,\n y: offset.y ?? 8,\n };\n }\n\n return { x: offset, y: offset };\n};\n\nconst getPlacementStyle = (\n placement: FloatingPanelPlacement,\n offset: FloatingPanelOffset,\n): CSSProperties => {\n const { x, y } = resolveOffset(offset);\n const isTop = placement.startsWith('top');\n const isLeft = placement.endsWith('Left');\n\n return {\n alignItems: isTop ? 'flex-start' : 'flex-end',\n justifyContent: isLeft ? 'flex-start' : 'flex-end',\n paddingBlockEnd: isTop ? undefined : y,\n paddingBlockStart: isTop ? y : undefined,\n paddingInlineEnd: isLeft ? undefined : x,\n paddingInlineStart: isLeft ? x : undefined,\n };\n};\n\nconst clamp = (value: number, min: number, max: number) => Math.min(Math.max(value, min), max);\n\nconst getViewportMaxSize = () => ({\n height: Math.max(DEFAULT_MIN_HEIGHT, window.innerHeight - 16),\n width: Math.max(DEFAULT_MIN_WIDTH, window.innerWidth - 16),\n});\n\nconst getResizeHandles = (placement: FloatingPanelPlacement): FloatingPanelResizeHandle[] => {\n switch (placement) {\n case 'bottomLeft': {\n return ['top', 'right', 'topRight'];\n }\n case 'topLeft': {\n return ['bottom', 'right', 'bottomRight'];\n }\n case 'topRight': {\n return ['bottom', 'left', 'bottomLeft'];\n }\n default: {\n return ['top', 'left', 'topLeft'];\n }\n }\n};\n\nconst getResizeHandleClassName = (s: typeof styles, handle: FloatingPanelResizeHandle) => {\n const handleClassMap: Record<FloatingPanelResizeHandle, string> = {\n bottom: s.resizeHandleBottom,\n bottomLeft: s.resizeHandleBottomLeft,\n bottomRight: s.resizeHandleBottomRight,\n left: s.resizeHandleLeft,\n right: s.resizeHandleRight,\n top: s.resizeHandleTop,\n topLeft: s.resizeHandleTopLeft,\n topRight: s.resizeHandleTopRight,\n };\n\n return handleClassMap[handle];\n};\n\nconst resolveResizeSize = ({\n handle,\n maxHeight,\n maxWidth,\n minHeight,\n minWidth,\n startHeight,\n startWidth,\n startX,\n startY,\n x,\n y,\n}: {\n handle: FloatingPanelResizeHandle;\n maxHeight: number;\n maxWidth: number;\n minHeight: number;\n minWidth: number;\n startHeight: number;\n startWidth: number;\n startX: number;\n startY: number;\n x: number;\n y: number;\n}): FloatingPanelSize => {\n const deltaX = x - startX;\n const deltaY = y - startY;\n const growsLeft = handle.includes('Left') || handle === 'left';\n const growsRight = handle.includes('Right') || handle === 'right';\n const growsTop = handle.includes('top') || handle === 'top';\n const growsBottom = handle.includes('bottom') || handle === 'bottom';\n\n const nextWidth = growsLeft ? startWidth - deltaX : growsRight ? startWidth + deltaX : startWidth;\n const nextHeight = growsTop\n ? startHeight - deltaY\n : growsBottom\n ? startHeight + deltaY\n : startHeight;\n\n return {\n height: clamp(nextHeight, minHeight, maxHeight),\n width: clamp(nextWidth, minWidth, maxWidth),\n };\n};\n\nconst FloatingPanel = memo<FloatingPanelProps>(\n ({\n afterClose,\n ariaLabel,\n children,\n className,\n classNames,\n closable = true,\n closeIcon,\n closeLabel = 'Close',\n defaultOpen,\n actions,\n footer,\n getContainer,\n height,\n keyboard = true,\n mask = false,\n maskClosable = true,\n maxHeight,\n maxWidth,\n minHeight = DEFAULT_MIN_HEIGHT,\n minWidth = DEFAULT_MIN_WIDTH,\n modal = false,\n motionProps,\n offset = 8,\n onClose,\n onOpenChange,\n onResize,\n onResizeEnd,\n open,\n placement = 'bottomRight',\n resizable = true,\n styles: semanticStyles,\n title,\n width = 640,\n zIndex,\n }) => {\n const s = styles;\n const isTop = placement.startsWith('top');\n const container = getContainer === false ? undefined : getContainer;\n const [resizeSize, setResizeSize] = useState<InternalFloatingPanelSize>();\n const latestResizeSizeRef = useRef<FloatingPanelSize | undefined>(undefined);\n const resizeCleanupRef = useRef<(() => void) | undefined>(undefined);\n const activeResizeSize =\n resizeSize?.sourceWidth === width && resizeSize.sourceHeight === height\n ? resizeSize\n : undefined;\n\n useEffect(\n () => () => {\n resizeCleanupRef.current?.();\n },\n [],\n );\n\n const popupStyle = useMemo(\n () => ({\n ...getPlacementStyle(placement, offset),\n ...semanticStyles?.wrapper,\n }),\n [offset, placement, semanticStyles?.wrapper],\n );\n\n const handleOpenChange = useCallback<NonNullable<ModalRootProps['onOpenChange']>>(\n (nextOpen, eventDetails) => {\n if (!nextOpen) {\n if (keyboard === false && eventDetails.reason === 'escape-key') return;\n if (maskClosable === false && eventDetails.reason === 'outside-press') return;\n onClose?.();\n }\n\n onOpenChange?.(nextOpen, eventDetails);\n },\n [keyboard, maskClosable, onClose, onOpenChange],\n );\n\n const showHeader = title !== undefined || actions !== undefined || closable;\n const resolvedMotionProps = motionProps ?? (isTop ? topMotionProps : defaultMotionProps);\n const resizeHandles = useMemo(() => getResizeHandles(placement), [placement]);\n\n const handleResizeStart = useCallback(\n (handle: FloatingPanelResizeHandle) => (event: ReactPointerEvent<HTMLDivElement>) => {\n event.preventDefault();\n event.stopPropagation();\n\n const panel = event.currentTarget.parentElement;\n if (!panel) return;\n\n const rect = panel.getBoundingClientRect();\n const viewportMaxSize = getViewportMaxSize();\n const resolvedMaxWidth = Math.max(minWidth, maxWidth ?? viewportMaxSize.width);\n const resolvedMaxHeight = Math.max(minHeight, maxHeight ?? viewportMaxSize.height);\n const startX = event.clientX;\n const startY = event.clientY;\n\n const handleResizeMove = (moveEvent: PointerEvent) => {\n const nextSize = resolveResizeSize({\n handle,\n maxHeight: resolvedMaxHeight,\n maxWidth: resolvedMaxWidth,\n minHeight,\n minWidth,\n startHeight: rect.height,\n startWidth: rect.width,\n startX,\n startY,\n x: moveEvent.clientX,\n y: moveEvent.clientY,\n });\n\n const nextState = { ...nextSize, sourceHeight: height, sourceWidth: width };\n latestResizeSizeRef.current = nextSize;\n setResizeSize(nextState);\n onResize?.(nextSize);\n };\n\n const handleResizeEnd = () => {\n resizeCleanupRef.current?.();\n resizeCleanupRef.current = undefined;\n\n if (latestResizeSizeRef.current) onResizeEnd?.(latestResizeSizeRef.current);\n };\n\n resizeCleanupRef.current?.();\n window.addEventListener('pointermove', handleResizeMove);\n window.addEventListener('pointerup', handleResizeEnd);\n resizeCleanupRef.current = () => {\n window.removeEventListener('pointermove', handleResizeMove);\n window.removeEventListener('pointerup', handleResizeEnd);\n };\n },\n [height, maxHeight, maxWidth, minHeight, minWidth, onResize, onResizeEnd, width],\n );\n\n return (\n <ModalRoot\n defaultOpen={defaultOpen}\n modal={modal}\n open={open}\n zIndex={zIndex}\n onExitComplete={afterClose}\n onOpenChange={handleOpenChange}\n >\n <ModalPortal container={container}>\n {mask && (\n <ModalBackdrop className={classNames?.backdrop} style={semanticStyles?.backdrop} />\n )}\n <ModalPopup\n aria-label={ariaLabel}\n className={cx(s.wrapper, classNames?.wrapper)}\n motionProps={resolvedMotionProps}\n panelClassName={cx(s.panel, isTop && s.panelTop, className, classNames?.panel)}\n popupStyle={popupStyle}\n width={activeResizeSize?.width ?? width}\n style={{\n height: activeResizeSize?.height ?? height,\n minHeight,\n minWidth,\n width: activeResizeSize?.width,\n ...semanticStyles?.panel,\n }}\n >\n {resizable &&\n resizeHandles.map((handle) => (\n <div\n aria-hidden\n data-floating-panel-resize-handle={handle}\n key={handle}\n style={semanticStyles?.resizeHandle}\n className={cx(\n s.resizeHandle,\n getResizeHandleClassName(s, handle),\n classNames?.resizeHandle,\n )}\n onPointerDown={handleResizeStart(handle)}\n />\n ))}\n {showHeader && (\n <ModalHeader\n className={cx(s.header, classNames?.header)}\n style={semanticStyles?.header}\n >\n {title !== undefined ? (\n <ModalTitle\n className={cx(s.title, classNames?.title)}\n style={semanticStyles?.title}\n >\n {title}\n </ModalTitle>\n ) : (\n <span />\n )}\n <div className={s.headerActions}>\n {actions && (\n <div\n className={cx(s.actions, classNames?.actions)}\n style={semanticStyles?.actions}\n >\n {actions}\n </div>\n )}\n {closable && (\n <ModalClose\n aria-label={closeLabel}\n className={cx(s.close, classNames?.close)}\n style={semanticStyles?.close}\n >\n {closeIcon ?? <X size={16} />}\n </ModalClose>\n )}\n </div>\n </ModalHeader>\n )}\n <ModalContent className={cx(s.body, classNames?.body)} style={semanticStyles?.body}>\n {children}\n </ModalContent>\n {footer && (\n <ModalFooter\n className={cx(s.footer, classNames?.footer)}\n style={semanticStyles?.footer}\n >\n {footer}\n </ModalFooter>\n )}\n </ModalPopup>\n </ModalPortal>\n </ModalRoot>\n );\n },\n);\n\nFloatingPanel.displayName = 'FloatingPanel';\n\nexport { FloatingPanel };\n"],"mappings":";;;;;;;;AA6BA,MAAM,qBAAqB;AAC3B,MAAM,oBAAoB;AA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AAEA,cAAc,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"FloatingSheet.mjs","names":[],"sources":["../../../src/base-ui/FloatingSheet/FloatingSheet.tsx"],"sourcesContent":["import { cx } from 'antd-style';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { FloatingSheetHeader } from './FloatingSheetHeader';\nimport { clamp, dampenValue, resolveSize } from './helpers';\nimport { styles } from './style';\nimport type { FloatingSheetProps } from './type';\nimport { useSheetDrag } from './useSheetDrag';\nimport { useSnapPoints } from './useSnapPoints';\n\nconst ANIMATION_MS = 300;\n\nexport function FloatingSheet({\n open: openProp,\n onOpenChange,\n defaultOpen = false,\n snapPoints: snapPointsProp,\n activeSnapPoint: activeSnapPointProp,\n onSnapPointChange,\n minHeight: minHeightProp = 200,\n maxHeight: maxHeightProp = 0.8,\n restingHeight: restingHeightProp,\n mode = 'overlay',\n variant = 'elevated',\n width = '100%',\n title,\n headerActions,\n dismissible = true,\n closeThreshold = 0.25,\n children,\n className,\n}: FloatingSheetProps) {\n const s = styles;\n\n // Controlled / uncontrolled open state\n const isControlled = openProp !== undefined;\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n const isOpen = isControlled ? openProp : internalOpen;\n\n const setOpen = useCallback(\n (value: boolean) => {\n if (!isControlled) setInternalOpen(value);\n onOpenChange?.(value);\n },\n [isControlled, onOpenChange],\n );\n\n // Container measurement via ResizeObserver\n const containerRef = useRef<HTMLElement | null>(null);\n const sheetRef = useRef<HTMLDivElement>(null);\n const [containerHeight, setContainerHeight] = useState(0);\n\n useEffect(() => {\n const parent = sheetRef.current?.parentElement;\n if (!parent) return;\n containerRef.current = parent;\n\n const observer = new ResizeObserver((entries) => {\n for (const entry of entries) {\n setContainerHeight(entry.contentRect.height);\n }\n });\n observer.observe(parent);\n setContainerHeight(parent.getBoundingClientRect().height);\n\n return () => observer.disconnect();\n }, []);\n\n // Resolve min/max to px\n const minHeightPx = useMemo(\n () => resolveSize(minHeightProp, containerHeight),\n [minHeightProp, containerHeight],\n );\n const maxHeightPx = useMemo(\n () => resolveSize(maxHeightProp, containerHeight),\n [maxHeightProp, containerHeight],\n );\n const restingHeightPx = useMemo(\n () =>\n restingHeightProp !== undefined\n ? clamp(resolveSize(restingHeightProp, containerHeight), minHeightPx, maxHeightPx)\n : minHeightPx,\n [restingHeightProp, containerHeight, minHeightPx, maxHeightPx],\n );\n\n // Snap points\n const hasSnapPoints = !!snapPointsProp && snapPointsProp.length > 0;\n const { snapPointHeights, findActiveIndex, getSnapRelease } = useSnapPoints({\n closeThreshold,\n containerHeight,\n containerRef,\n maxHeightPx,\n minHeightPx,\n snapPoints: snapPointsProp ?? [],\n });\n\n // Compute the \"resting\" height for the current open + snap state\n const restingHeight = useMemo(() => {\n if (!containerHeight) return 0;\n if (hasSnapPoints && activeSnapPointProp !== undefined) {\n const resolved = resolveSize(activeSnapPointProp, containerHeight);\n return clamp(resolved, minHeightPx, maxHeightPx);\n }\n if (hasSnapPoints && snapPointHeights.length > 0) {\n return snapPointHeights[0];\n }\n return restingHeightPx;\n }, [\n containerHeight,\n hasSnapPoints,\n activeSnapPointProp,\n snapPointHeights,\n minHeightPx,\n maxHeightPx,\n restingHeightPx,\n ]);\n\n const [height, setHeight] = useState(isOpen ? restingHeight : 0);\n const [isAnimating, setIsAnimating] = useState(false);\n // Keeps sheet visible during close animation (height → 0)\n const [isClosing, setIsClosing] = useState(false);\n const heightBeforeDrag = useRef(0);\n const prevOpenRef = useRef(isOpen);\n\n // Handle open/close transitions\n useEffect(() => {\n const wasOpen = prevOpenRef.current;\n prevOpenRef.current = isOpen;\n\n if (isOpen && !wasOpen) {\n // Opening: animate from 0 → resting height\n setIsClosing(false);\n setIsAnimating(true);\n setHeight(restingHeight);\n const timer = setTimeout(() => setIsAnimating(false), ANIMATION_MS);\n return () => clearTimeout(timer);\n }\n\n if (!isOpen && wasOpen) {\n // Closing: animate from current height → 0, then hide\n setIsClosing(true);\n setIsAnimating(true);\n setHeight(0);\n const timer = setTimeout(() => {\n setIsAnimating(false);\n setIsClosing(false);\n }, ANIMATION_MS);\n return () => clearTimeout(timer);\n }\n }, [isOpen]); // eslint-disable-line react-hooks/exhaustive-deps\n\n // Sync height when resting height changes (container resize, snap point change)\n useEffect(() => {\n if (isOpen && !isDragging) {\n setHeight(restingHeight);\n }\n }, [restingHeight]); // eslint-disable-line react-hooks/exhaustive-deps\n\n // Drag handlers\n const onDragChange = useCallback(\n (draggedDistance: number) => {\n const newHeight = heightBeforeDrag.current + draggedDistance;\n\n if (hasSnapPoints) {\n const highest = snapPointHeights.at(-1) ?? maxHeightPx;\n const lowest = snapPointHeights[0] ?? minHeightPx;\n\n if (newHeight > highest) {\n const overshoot = newHeight - highest;\n setHeight(highest + dampenValue(overshoot));\n } else if (newHeight < lowest) {\n const undershoot = lowest - newHeight;\n setHeight(Math.max(0, lowest - dampenValue(undershoot)));\n } else {\n setHeight(newHeight);\n }\n } else {\n setHeight(clamp(newHeight, 0, maxHeightPx));\n }\n },\n [hasSnapPoints, snapPointHeights, maxHeightPx, minHeightPx],\n );\n\n const onDragEnd = useCallback(\n (draggedDistance: number, velocity: number) => {\n setIsAnimating(true);\n const currentHeight = heightBeforeDrag.current + draggedDistance;\n\n if (hasSnapPoints) {\n const activeIndex = findActiveIndex(heightBeforeDrag.current);\n const result = getSnapRelease({\n activeIndex,\n currentHeight,\n dismissible,\n draggedDistance,\n velocity,\n });\n\n if (result.type === 'dismiss') {\n setIsClosing(true);\n setHeight(0);\n const timer = setTimeout(() => {\n setOpen(false);\n setIsAnimating(false);\n setIsClosing(false);\n }, ANIMATION_MS);\n return () => clearTimeout(timer);\n }\n\n setHeight(result.height);\n const originalSnapValue = snapPointsProp?.find(\n (sp) =>\n resolveSize(sp, containerHeight) === result.height ||\n clamp(resolveSize(sp, containerHeight), minHeightPx, maxHeightPx) === result.height,\n );\n if (originalSnapValue !== undefined) {\n onSnapPointChange?.(originalSnapValue);\n }\n } else {\n if (dismissible && currentHeight < minHeightPx * closeThreshold) {\n setIsClosing(true);\n setHeight(0);\n const timer = setTimeout(() => {\n setOpen(false);\n setIsAnimating(false);\n setIsClosing(false);\n }, ANIMATION_MS);\n return () => clearTimeout(timer);\n }\n setHeight(clamp(currentHeight, minHeightPx, maxHeightPx));\n }\n\n setTimeout(() => setIsAnimating(false), ANIMATION_MS);\n },\n [\n hasSnapPoints,\n findActiveIndex,\n getSnapRelease,\n dismissible,\n snapPointsProp,\n containerHeight,\n minHeightPx,\n maxHeightPx,\n closeThreshold,\n setOpen,\n onSnapPointChange,\n ],\n );\n\n const { isDragging, handleProps } = useSheetDrag({\n enabled: isOpen ?? false,\n onDragChange,\n onDragEnd,\n });\n\n // Record height at drag start\n useEffect(() => {\n if (isDragging) {\n heightBeforeDrag.current = height;\n }\n }, [isDragging]); // eslint-disable-line react-hooks/exhaustive-deps\n\n const isVisible = isOpen || isClosing || height > 0;\n const shouldAnimate = !isDragging && isAnimating;\n const inlineOverflowUp =\n mode === 'inline' && isVisible ? Math.max(0, height - restingHeightPx) : 0;\n\n return (\n <div\n data-floating-sheet=\"\"\n data-state={isOpen ? 'open' : 'closed'}\n ref={sheetRef}\n className={cx(\n s.root,\n variant === 'embedded' ? s.embedded : s.elevated,\n mode === 'overlay' ? s.overlay : s.inline,\n mode === 'overlay' ? s.overlayRadius : s.inlineRadius,\n shouldAnimate && s.transition,\n !isVisible && s.hidden,\n className,\n )}\n style={{\n height: isVisible ? height : 0,\n marginTop: inlineOverflowUp ? -inlineOverflowUp : undefined,\n width,\n }}\n >\n <FloatingSheetHeader\n handleProps={handleProps}\n headerActions={headerActions}\n isDragging={isDragging}\n title={title}\n />\n <div className={s.content}>{children}</div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAUA,MAAM,eAAe;AAErB,SAAgB,cAAc,EAC5B,MAAM,UACN,cACA,cAAc,OACd,YAAY,gBACZ,iBAAiB,qBACjB,mBACA,WAAW,gBAAgB,KAC3B,WAAW,gBAAgB,IAC3B,eAAe,mBACf,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A;EACA;EACA;EACA;CACF,CACF;CAEA,MAAM,EAAE,YAAY,gBAAgB,aAAa;EAC/C,SAAS,UAAU;EACnB;EACA;CACF,CAAC;CAGD,gBAAgB;EACd,IAAI,YACF,iBAAiB,UAAU;CAE/B,GAAG,CAAC,UAAU,CAAC;CAEf,MAAM,YAAY,UAAU,aAAa,SAAS;CAClD,MAAM,gBAAgB,CAAC,cAAc;CACrC,MAAM,mBACJ,SAAS,YAAY,YAAY,KAAK,IAAI,GAAG,SAAS,eAAe,IAAI;CAE3E,OACE,qBAAC,OAAD;EACE,uBAAoB;EACpB,cAAY,SAAS,SAAS;EAC9B,KAAK;EACL,WAAW,GACT,EAAE,MACF,YAAY,aAAa,EAAE,WAAW,EAAE,UACxC,SAAS,YAAY,EAAE,UAAU,EAAE,QACnC,SAAS,YAAY,EAAE,gBAAgB,EAAE,cACzC,iBAAiB,EAAE,YACnB,CAAC,aAAa,EAAE,QAChB,SACF;EACA,OAAO;GACL,QAAQ,YAAY,SAAS;GAC7B,WAAW,mBAAmB,CAAC,mBAAmB,KAAA;GAClD;EACF;YAjBF,CAmBE,oBAAC,qBAAD;GACe;GACE;GACH;GACL;EACR,CAAA,GACD,oBAAC,OAAD;GAAK,WAAW,EAAE;GAAU;EAAc,CAAA,CACvC;;AAET"}
1
+ {"version":3,"file":"FloatingSheet.mjs","names":[],"sources":["../../../src/base-ui/FloatingSheet/FloatingSheet.tsx"],"sourcesContent":["import { cx } from 'antd-style';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { FloatingSheetHeader } from './FloatingSheetHeader';\nimport { clamp, dampenValue, resolveSize } from './helpers';\nimport { styles } from './style';\nimport type { FloatingSheetProps } from './type';\nimport { useSheetDrag } from './useSheetDrag';\nimport { useSnapPoints } from './useSnapPoints';\n\nconst ANIMATION_MS = 300;\n\nexport function FloatingSheet({\n open: openProp,\n onOpenChange,\n defaultOpen = false,\n snapPoints: snapPointsProp,\n activeSnapPoint: activeSnapPointProp,\n onSnapPointChange,\n minHeight: minHeightProp = 200,\n maxHeight: maxHeightProp = 0.8,\n restingHeight: restingHeightProp,\n mode = 'overlay',\n variant = 'elevated',\n width = '100%',\n title,\n headerActions,\n dismissible = true,\n closeThreshold = 0.25,\n children,\n className,\n}: FloatingSheetProps) {\n const s = styles;\n\n // Controlled / uncontrolled open state\n const isControlled = openProp !== undefined;\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n const isOpen = isControlled ? openProp : internalOpen;\n\n const setOpen = useCallback(\n (value: boolean) => {\n if (!isControlled) setInternalOpen(value);\n onOpenChange?.(value);\n },\n [isControlled, onOpenChange],\n );\n\n // Container measurement via ResizeObserver\n const containerRef = useRef<HTMLElement | null>(null);\n const sheetRef = useRef<HTMLDivElement>(null);\n const [containerHeight, setContainerHeight] = useState(0);\n\n useEffect(() => {\n const parent = sheetRef.current?.parentElement;\n if (!parent) return;\n containerRef.current = parent;\n\n const observer = new ResizeObserver((entries) => {\n for (const entry of entries) {\n setContainerHeight(entry.contentRect.height);\n }\n });\n observer.observe(parent);\n setContainerHeight(parent.getBoundingClientRect().height);\n\n return () => observer.disconnect();\n }, []);\n\n // Resolve min/max to px\n const minHeightPx = useMemo(\n () => resolveSize(minHeightProp, containerHeight),\n [minHeightProp, containerHeight],\n );\n const maxHeightPx = useMemo(\n () => resolveSize(maxHeightProp, containerHeight),\n [maxHeightProp, containerHeight],\n );\n const restingHeightPx = useMemo(\n () =>\n restingHeightProp !== undefined\n ? clamp(resolveSize(restingHeightProp, containerHeight), minHeightPx, maxHeightPx)\n : minHeightPx,\n [restingHeightProp, containerHeight, minHeightPx, maxHeightPx],\n );\n\n // Snap points\n const hasSnapPoints = !!snapPointsProp && snapPointsProp.length > 0;\n const { snapPointHeights, findActiveIndex, getSnapRelease } = useSnapPoints({\n closeThreshold,\n containerHeight,\n containerRef,\n maxHeightPx,\n minHeightPx,\n snapPoints: snapPointsProp ?? [],\n });\n\n // Compute the \"resting\" height for the current open + snap state\n const restingHeight = useMemo(() => {\n if (!containerHeight) return 0;\n if (hasSnapPoints && activeSnapPointProp !== undefined) {\n const resolved = resolveSize(activeSnapPointProp, containerHeight);\n return clamp(resolved, minHeightPx, maxHeightPx);\n }\n if (hasSnapPoints && snapPointHeights.length > 0) {\n return snapPointHeights[0];\n }\n return restingHeightPx;\n }, [\n containerHeight,\n hasSnapPoints,\n activeSnapPointProp,\n snapPointHeights,\n minHeightPx,\n maxHeightPx,\n restingHeightPx,\n ]);\n\n const [height, setHeight] = useState(isOpen ? restingHeight : 0);\n const [isAnimating, setIsAnimating] = useState(false);\n // Keeps sheet visible during close animation (height → 0)\n const [isClosing, setIsClosing] = useState(false);\n const heightBeforeDrag = useRef(0);\n const prevOpenRef = useRef(isOpen);\n\n // Handle open/close transitions\n useEffect(() => {\n const wasOpen = prevOpenRef.current;\n prevOpenRef.current = isOpen;\n\n if (isOpen && !wasOpen) {\n // Opening: animate from 0 → resting height\n setIsClosing(false);\n setIsAnimating(true);\n setHeight(restingHeight);\n const timer = setTimeout(() => setIsAnimating(false), ANIMATION_MS);\n return () => clearTimeout(timer);\n }\n\n if (!isOpen && wasOpen) {\n // Closing: animate from current height → 0, then hide\n setIsClosing(true);\n setIsAnimating(true);\n setHeight(0);\n const timer = setTimeout(() => {\n setIsAnimating(false);\n setIsClosing(false);\n }, ANIMATION_MS);\n return () => clearTimeout(timer);\n }\n }, [isOpen]); // eslint-disable-line react-hooks/exhaustive-deps\n\n // Sync height when resting height changes (container resize, snap point change)\n useEffect(() => {\n if (isOpen && !isDragging) {\n setHeight(restingHeight);\n }\n }, [restingHeight]); // eslint-disable-line react-hooks/exhaustive-deps\n\n // Drag handlers\n const onDragChange = useCallback(\n (draggedDistance: number) => {\n const newHeight = heightBeforeDrag.current + draggedDistance;\n\n if (hasSnapPoints) {\n const highest = snapPointHeights.at(-1) ?? maxHeightPx;\n const lowest = snapPointHeights[0] ?? minHeightPx;\n\n if (newHeight > highest) {\n const overshoot = newHeight - highest;\n setHeight(highest + dampenValue(overshoot));\n } else if (newHeight < lowest) {\n const undershoot = lowest - newHeight;\n setHeight(Math.max(0, lowest - dampenValue(undershoot)));\n } else {\n setHeight(newHeight);\n }\n } else {\n setHeight(clamp(newHeight, 0, maxHeightPx));\n }\n },\n [hasSnapPoints, snapPointHeights, maxHeightPx, minHeightPx],\n );\n\n const onDragEnd = useCallback(\n (draggedDistance: number, velocity: number) => {\n setIsAnimating(true);\n const currentHeight = heightBeforeDrag.current + draggedDistance;\n\n if (hasSnapPoints) {\n const activeIndex = findActiveIndex(heightBeforeDrag.current);\n const result = getSnapRelease({\n activeIndex,\n currentHeight,\n dismissible,\n draggedDistance,\n velocity,\n });\n\n if (result.type === 'dismiss') {\n setIsClosing(true);\n setHeight(0);\n const timer = setTimeout(() => {\n setOpen(false);\n setIsAnimating(false);\n setIsClosing(false);\n }, ANIMATION_MS);\n return () => clearTimeout(timer);\n }\n\n setHeight(result.height);\n const originalSnapValue = snapPointsProp?.find(\n (sp) =>\n resolveSize(sp, containerHeight) === result.height ||\n clamp(resolveSize(sp, containerHeight), minHeightPx, maxHeightPx) === result.height,\n );\n if (originalSnapValue !== undefined) {\n onSnapPointChange?.(originalSnapValue);\n }\n } else {\n if (dismissible && currentHeight < minHeightPx * closeThreshold) {\n setIsClosing(true);\n setHeight(0);\n const timer = setTimeout(() => {\n setOpen(false);\n setIsAnimating(false);\n setIsClosing(false);\n }, ANIMATION_MS);\n return () => clearTimeout(timer);\n }\n setHeight(clamp(currentHeight, minHeightPx, maxHeightPx));\n }\n\n setTimeout(() => setIsAnimating(false), ANIMATION_MS);\n },\n [\n hasSnapPoints,\n findActiveIndex,\n getSnapRelease,\n dismissible,\n snapPointsProp,\n containerHeight,\n minHeightPx,\n maxHeightPx,\n closeThreshold,\n setOpen,\n onSnapPointChange,\n ],\n );\n\n const { isDragging, handleProps } = useSheetDrag({\n enabled: isOpen ?? false,\n onDragChange,\n onDragEnd,\n });\n\n // Record height at drag start\n useEffect(() => {\n if (isDragging) {\n heightBeforeDrag.current = height;\n }\n }, [isDragging]); // eslint-disable-line react-hooks/exhaustive-deps\n\n const isVisible = isOpen || isClosing || height > 0;\n const shouldAnimate = !isDragging && isAnimating;\n const inlineOverflowUp =\n mode === 'inline' && isVisible ? Math.max(0, height - restingHeightPx) : 0;\n\n return (\n <div\n data-floating-sheet=\"\"\n data-state={isOpen ? 'open' : 'closed'}\n ref={sheetRef}\n className={cx(\n s.root,\n variant === 'embedded' ? s.embedded : s.elevated,\n mode === 'overlay' ? s.overlay : s.inline,\n mode === 'overlay' ? s.overlayRadius : s.inlineRadius,\n shouldAnimate && s.transition,\n !isVisible && s.hidden,\n className,\n )}\n style={{\n height: isVisible ? height : 0,\n marginTop: inlineOverflowUp ? -inlineOverflowUp : undefined,\n width,\n }}\n >\n <FloatingSheetHeader\n handleProps={handleProps}\n headerActions={headerActions}\n isDragging={isDragging}\n title={title}\n />\n <div className={s.content}>{children}</div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAUA,MAAM,eAAe;AAErB,SAAgB,cAAc,EAC5B,MAAM,UACN,cACA,cAAc,OACd,YAAY,gBACZ,iBAAiB,qBACjB,mBACA,WAAW,gBAAgB,KAC3B,WAAW,gBAAgB,IAC3B,eAAe,mBACf,OAAO,WACP,UAAU,YACV,QAAQ,QACR,OACA,eACA,cAAc,MACd,iBAAiB,KACjB,UACA,aACqB;CACrB,MAAM,IAAI;CAGV,MAAM,eAAe,aAAa,KAAA;CAClC,MAAM,CAAC,cAAc,mBAAmB,SAAS,WAAW;CAC5D,MAAM,SAAS,eAAe,WAAW;CAEzC,MAAM,UAAU,aACb,UAAmB;EAClB,IAAI,CAAC,cAAc,gBAAgB,KAAK;EACxC,eAAe,KAAK;CACtB,GACA,CAAC,cAAc,YAAY,CAC7B;CAGA,MAAM,eAAe,OAA2B,IAAI;CACpD,MAAM,WAAW,OAAuB,IAAI;CAC5C,MAAM,CAAC,iBAAiB,sBAAsB,SAAS,CAAC;CAExD,gBAAgB;EACd,MAAM,S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AS,YAAY,EAAE,UAAU,EAAE,QACnC,SAAS,YAAY,EAAE,gBAAgB,EAAE,cACzC,iBAAiB,EAAE,YACnB,CAAC,aAAa,EAAE,QAChB,SACF;EACA,OAAO;GACL,QAAQ,YAAY,SAAS;GAC7B,WAAW,mBAAmB,CAAC,mBAAmB,KAAA;GAClD;EACF;EAjBF,UAAA,CAmBE,oBAAC,qBAAD;GACe;GACE;GACH;GACL;EACR,CAAA,GACD,oBAAC,OAAD;GAAK,WAAW,EAAE;GAAU;EAAc,CAAA,CACvC;;AAET"}
@@ -1 +1 @@
1
- {"version":3,"file":"FloatingSheetHeader.mjs","names":[],"sources":["../../../src/base-ui/FloatingSheet/FloatingSheetHeader.tsx"],"sourcesContent":["import { cx } from 'antd-style';\nimport { type ReactNode } from 'react';\n\nimport { styles } from './style';\n\ninterface FloatingSheetHeaderProps {\n handleProps: {\n onMouseDown: (e: React.MouseEvent<HTMLDivElement>) => void;\n };\n headerActions?: ReactNode;\n isDragging: boolean;\n title?: ReactNode;\n}\n\nexport function FloatingSheetHeader({\n title,\n headerActions,\n isDragging,\n handleProps,\n}: FloatingSheetHeaderProps) {\n const s = styles;\n\n return (\n <div className={cx(s.header, isDragging && s.headerDragging)} {...handleProps}>\n <div className={s.handle} />\n <div className={s.headerContent}>\n {title && <div className={s.headerTitle}>{title}</div>}\n {headerActions && (\n <div className={s.headerActions} data-no-drag=\"\">\n {headerActions}\n </div>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;AAcA,SAAgB,oBAAoB,EAClC,OACA,eACA,YACA,eAC2B;CAC3B,MAAM,IAAI;CAEV,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,EAAE,QAAQ,cAAc,EAAE,cAAc;EAAG,GAAI;YAAlE,CACE,oBAAC,OAAD,EAAK,WAAW,EAAE,OAAS,CAAA,GAC3B,qBAAC,OAAD;GAAK,WAAW,EAAE;aAAlB,CACG,SAAS,oBAAC,OAAD;IAAK,WAAW,EAAE;cAAc;GAAW,CAAA,GACpD,iBACC,oBAAC,OAAD;IAAK,WAAW,EAAE;IAAe,gBAAa;cAC3C;GACE,CAAA,CAEJ;IACF;;AAET"}
1
+ {"version":3,"file":"FloatingSheetHeader.mjs","names":[],"sources":["../../../src/base-ui/FloatingSheet/FloatingSheetHeader.tsx"],"sourcesContent":["import { cx } from 'antd-style';\nimport { type ReactNode } from 'react';\n\nimport { styles } from './style';\n\ninterface FloatingSheetHeaderProps {\n handleProps: {\n onMouseDown: (e: React.MouseEvent<HTMLDivElement>) => void;\n };\n headerActions?: ReactNode;\n isDragging: boolean;\n title?: ReactNode;\n}\n\nexport function FloatingSheetHeader({\n title,\n headerActions,\n isDragging,\n handleProps,\n}: FloatingSheetHeaderProps) {\n const s = styles;\n\n return (\n <div className={cx(s.header, isDragging && s.headerDragging)} {...handleProps}>\n <div className={s.handle} />\n <div className={s.headerContent}>\n {title && <div className={s.headerTitle}>{title}</div>}\n {headerActions && (\n <div className={s.headerActions} data-no-drag=\"\">\n {headerActions}\n </div>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;AAcA,SAAgB,oBAAoB,EAClC,OACA,eACA,YACA,eAC2B;CAC3B,MAAM,IAAI;CAEV,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,EAAE,QAAQ,cAAc,EAAE,cAAc;EAAG,GAAI;EAAlE,UAAA,CACE,oBAAC,OAAD,EAAK,WAAW,EAAE,OAAS,CAAA,GAC3B,qBAAC,OAAD;GAAK,WAAW,EAAE;GAAlB,UAAA,CACG,SAAS,oBAAC,OAAD;IAAK,WAAW,EAAE;IAAc,UAAA;GAAW,CAAA,GACpD,iBACC,oBAAC,OAAD;IAAK,WAAW,EAAE;IAAe,gBAAa;IAC3C,UAAA;GACE,CAAA,CAEJ;EACF,CAAA,CAAA;;AAET"}
@@ -1 +1 @@
1
- {"version":3,"file":"Form.mjs","names":["Form","BaseForm"],"sources":["../../../src/base-ui/Form/Form.tsx"],"sourcesContent":["'use client';\n\nimport { Form as BaseForm } from '@base-ui/react/form';\nimport { cx, useResponsive } from 'antd-style';\nimport { isUndefined } from 'es-toolkit/compat';\nimport { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport FormField from './components/FormField';\nimport FormFlatGroup from './components/FormFlatGroup';\nimport FormGroup from './components/FormGroup';\nimport { FormContext } from './context';\nimport { rootVariants } from './style';\nimport type { FormFieldProps, FormGroupItemType, FormProps } from './type';\n\nconst serializeForm = (form: HTMLFormElement | null) => {\n if (!form) return '';\n const entries = [...new FormData(form).entries()].filter(\n ([, value]) => typeof value === 'string',\n ) as [string, string][];\n return JSON.stringify(entries.sort((a, b) => a[0].localeCompare(b[0])));\n};\n\nconst Form = memo<FormProps>(\n ({\n className,\n itemMinWidth,\n footer,\n items = [],\n children,\n itemsType = 'group',\n variant = 'borderless',\n classNames,\n styles: customStyles,\n gap,\n style,\n collapsible,\n defaultActiveKey,\n initialValues,\n activeKey,\n onCollapse,\n onFinish,\n onFormSubmit,\n layout,\n ref,\n ...rest\n }) => {\n const { mobile } = useResponsive();\n const formRef = useRef<HTMLFormElement>(null);\n const [submitLoading, setSubmitLoading] = useState(false);\n const [hasUnsavedChanges, setHasUnsavedChanges] = useState(false);\n const snapshotRef = useRef('');\n\n const syncUnsaved = useCallback(() => {\n setHasUnsavedChanges(serializeForm(formRef.current) !== snapshotRef.current);\n }, []);\n\n useEffect(() => {\n const form = formRef.current;\n if (!form) return;\n snapshotRef.current = serializeForm(form);\n let resetTimer: ReturnType<typeof setTimeout>;\n const handleMutation = () => syncUnsaved();\n const handleReset = () => {\n resetTimer = setTimeout(() => {\n snapshotRef.current = serializeForm(formRef.current);\n syncUnsaved();\n }, 0);\n };\n form.addEventListener('input', handleMutation);\n form.addEventListener('change', handleMutation);\n form.addEventListener('reset', handleReset);\n return () => {\n clearTimeout(resetTimer);\n form.removeEventListener('input', handleMutation);\n form.removeEventListener('change', handleMutation);\n form.removeEventListener('reset', handleReset);\n };\n }, [syncUnsaved]);\n\n const requestReset = useCallback(() => {\n formRef.current?.reset();\n }, []);\n\n const mergedRef = useCallback(\n (node: HTMLFormElement | null) => {\n formRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) ref.current = node;\n },\n [ref],\n );\n\n const context = useMemo(\n () => ({\n hasUnsavedChanges,\n initialValues,\n itemMinWidth,\n layout: layout || (mobile ? ('vertical' as const) : ('horizontal' as const)),\n requestReset,\n submitLoading,\n variant,\n }),\n [\n hasUnsavedChanges,\n initialValues,\n itemMinWidth,\n layout,\n mobile,\n requestReset,\n submitLoading,\n variant,\n ],\n );\n\n const mapFlat = useCallback(\n (item: FormFieldProps, itemIndex: number) => (\n <FormField\n className={classNames?.item}\n divider={itemIndex !== 0}\n key={itemIndex}\n style={customStyles?.item}\n variant={variant}\n {...item}\n />\n ),\n [variant, classNames, customStyles],\n );\n\n const mapTree = useCallback(\n (group: FormGroupItemType, groupIndex: number) => {\n const key = group?.key || groupIndex;\n return (\n <FormGroup\n active={activeKey && group?.key ? activeKey.includes(key) : undefined}\n className={classNames?.group}\n collapsible={isUndefined(group.collapsible) ? collapsible : group.collapsible}\n desc={group?.desc}\n extra={group?.extra}\n icon={group?.icon}\n key={key}\n style={customStyles?.group}\n title={group.title}\n variant={group?.variant || variant}\n defaultActive={\n defaultActiveKey && group?.key ? defaultActiveKey.includes(key) : group?.defaultActive\n }\n onCollapse={(active) => {\n let keys: (string | number)[] = activeKey || defaultActiveKey || [];\n keys = keys.filter((k) => k !== key);\n onCollapse?.(active ? [...keys, key] : keys);\n }}\n >\n {Array.isArray(group.children)\n ? group.children.filter((item) => !item.hidden).map((item, i) => mapFlat(item, i))\n : group.children}\n </FormGroup>\n );\n },\n [\n activeKey,\n collapsible,\n defaultActiveKey,\n onCollapse,\n variant,\n classNames,\n customStyles,\n mapFlat,\n ],\n );\n\n return (\n <FormContext value={context}>\n <BaseForm\n className={cx(rootVariants({ variant }), className)}\n ref={mergedRef}\n style={{ gap, ...style }}\n onFormSubmit={async (values, eventDetails) => {\n onFormSubmit?.(values, eventDetails);\n if (!onFinish) return;\n setSubmitLoading(true);\n try {\n await onFinish(values, eventDetails);\n snapshotRef.current = serializeForm(formRef.current);\n syncUnsaved();\n } finally {\n setSubmitLoading(false);\n }\n }}\n {...rest}\n >\n {items && items.length > 0 ? (\n itemsType === 'group' ? (\n (items as FormGroupItemType[]).map((item, i) => mapTree(item, i))\n ) : (\n <FormFlatGroup\n className={classNames?.group}\n style={customStyles?.group}\n variant={variant}\n >\n {(items as FormFieldProps[])\n .filter((item) => !item.hidden)\n .map((item, i) => mapFlat(item, i))}\n </FormFlatGroup>\n )\n ) : undefined}\n {children}\n {footer}\n </BaseForm>\n </FormContext>\n );\n },\n);\n\nForm.displayName = 'Form';\n\nexport default Form;\n"],"mappings":";;;;;;;;;;;;AAcA,MAAM,iBAAiB,SAAiC;CACtD,IAAI,CAAC,MAAM,OAAO;CAClB,MAAM,UAAU,CAAC,GAAG,IAAI,SAAS,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAC/C,GAAG,WAAW,OAAO,UAAU,QAClC;CACA,OAAO,KAAK,UAAU,QAAQ,MAAM,GAAG,MAAM,EAAE,EAAE,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;AACxE;AAEA,MAAMA,SAAO,MACV,EACC,WACA,cACA,QACA,QAAQ,CAAC,GACT,UACA,YAAY,SACZ,UAAU,cACV,YACA,QAAQ,cACR,KACA,OACA,aACA,kBACA,eACA,WACA,YACA,UACA,cACA,QACA,KACA,GAAG,WACC;CACJ,MAAM,EAAE,WAAW,cAAc;CACjC,MAAM,UAAU,OAAwB,IAAI;CAC5C,MAAM,CAAC,eAAe,oBAAoB,SAAS,KAAK;CACxD,MAAM,CAAC,mBAAmB,wBAAwB,SAAS,KAAK;CAChE,MAAM,cAAc,OAAO,EAAE;CAE7B,MAAM,cAAc,kBAAkB;EACpC,qBAAqB,cAAc,QAAQ,OAAO,MAAM,YAAY,OAAO;CAC7E,GAAG,CAAC,CAAC;CAEL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,MAAM,QAAQ,MAAM,CAAC,CAAC;IACvB,CAAA,IAEf,KAAA;IACH;IACA;GACO;;CACC,CAAA;AAEjB,CACF;AAEA,OAAK,cAAc"}
1
+ {"version":3,"file":"Form.mjs","names":["Form","BaseForm"],"sources":["../../../src/base-ui/Form/Form.tsx"],"sourcesContent":["'use client';\n\nimport { Form as BaseForm } from '@base-ui/react/form';\nimport { cx, useResponsive } from 'antd-style';\nimport { isUndefined } from 'es-toolkit/compat';\nimport { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport FormField from './components/FormField';\nimport FormFlatGroup from './components/FormFlatGroup';\nimport FormGroup from './components/FormGroup';\nimport { FormContext } from './context';\nimport { rootVariants } from './style';\nimport type { FormFieldProps, FormGroupItemType, FormProps } from './type';\n\nconst serializeForm = (form: HTMLFormElement | null) => {\n if (!form) return '';\n const entries = [...new FormData(form).entries()].filter(\n ([, value]) => typeof value === 'string',\n ) as [string, string][];\n return JSON.stringify(entries.sort((a, b) => a[0].localeCompare(b[0])));\n};\n\nconst Form = memo<FormProps>(\n ({\n className,\n itemMinWidth,\n footer,\n items = [],\n children,\n itemsType = 'group',\n variant = 'borderless',\n classNames,\n styles: customStyles,\n gap,\n style,\n collapsible,\n defaultActiveKey,\n initialValues,\n activeKey,\n onCollapse,\n onFinish,\n onFormSubmit,\n layout,\n ref,\n ...rest\n }) => {\n const { mobile } = useResponsive();\n const formRef = useRef<HTMLFormElement>(null);\n const [submitLoading, setSubmitLoading] = useState(false);\n const [hasUnsavedChanges, setHasUnsavedChanges] = useState(false);\n const snapshotRef = useRef('');\n\n const syncUnsaved = useCallback(() => {\n setHasUnsavedChanges(serializeForm(formRef.current) !== snapshotRef.current);\n }, []);\n\n useEffect(() => {\n const form = formRef.current;\n if (!form) return;\n snapshotRef.current = serializeForm(form);\n let resetTimer: ReturnType<typeof setTimeout>;\n const handleMutation = () => syncUnsaved();\n const handleReset = () => {\n resetTimer = setTimeout(() => {\n snapshotRef.current = serializeForm(formRef.current);\n syncUnsaved();\n }, 0);\n };\n form.addEventListener('input', handleMutation);\n form.addEventListener('change', handleMutation);\n form.addEventListener('reset', handleReset);\n return () => {\n clearTimeout(resetTimer);\n form.removeEventListener('input', handleMutation);\n form.removeEventListener('change', handleMutation);\n form.removeEventListener('reset', handleReset);\n };\n }, [syncUnsaved]);\n\n const requestReset = useCallback(() => {\n formRef.current?.reset();\n }, []);\n\n const mergedRef = useCallback(\n (node: HTMLFormElement | null) => {\n formRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) ref.current = node;\n },\n [ref],\n );\n\n const context = useMemo(\n () => ({\n hasUnsavedChanges,\n initialValues,\n itemMinWidth,\n layout: layout || (mobile ? ('vertical' as const) : ('horizontal' as const)),\n requestReset,\n submitLoading,\n variant,\n }),\n [\n hasUnsavedChanges,\n initialValues,\n itemMinWidth,\n layout,\n mobile,\n requestReset,\n submitLoading,\n variant,\n ],\n );\n\n const mapFlat = useCallback(\n (item: FormFieldProps, itemIndex: number) => (\n <FormField\n className={classNames?.item}\n divider={itemIndex !== 0}\n key={itemIndex}\n style={customStyles?.item}\n variant={variant}\n {...item}\n />\n ),\n [variant, classNames, customStyles],\n );\n\n const mapTree = useCallback(\n (group: FormGroupItemType, groupIndex: number) => {\n const key = group?.key || groupIndex;\n return (\n <FormGroup\n active={activeKey && group?.key ? activeKey.includes(key) : undefined}\n className={classNames?.group}\n collapsible={isUndefined(group.collapsible) ? collapsible : group.collapsible}\n desc={group?.desc}\n extra={group?.extra}\n icon={group?.icon}\n key={key}\n style={customStyles?.group}\n title={group.title}\n variant={group?.variant || variant}\n defaultActive={\n defaultActiveKey && group?.key ? defaultActiveKey.includes(key) : group?.defaultActive\n }\n onCollapse={(active) => {\n let keys: (string | number)[] = activeKey || defaultActiveKey || [];\n keys = keys.filter((k) => k !== key);\n onCollapse?.(active ? [...keys, key] : keys);\n }}\n >\n {Array.isArray(group.children)\n ? group.children.filter((item) => !item.hidden).map((item, i) => mapFlat(item, i))\n : group.children}\n </FormGroup>\n );\n },\n [\n activeKey,\n collapsible,\n defaultActiveKey,\n onCollapse,\n variant,\n classNames,\n customStyles,\n mapFlat,\n ],\n );\n\n return (\n <FormContext value={context}>\n <BaseForm\n className={cx(rootVariants({ variant }), className)}\n ref={mergedRef}\n style={{ gap, ...style }}\n onFormSubmit={async (values, eventDetails) => {\n onFormSubmit?.(values, eventDetails);\n if (!onFinish) return;\n setSubmitLoading(true);\n try {\n await onFinish(values, eventDetails);\n snapshotRef.current = serializeForm(formRef.current);\n syncUnsaved();\n } finally {\n setSubmitLoading(false);\n }\n }}\n {...rest}\n >\n {items && items.length > 0 ? (\n itemsType === 'group' ? (\n (items as FormGroupItemType[]).map((item, i) => mapTree(item, i))\n ) : (\n <FormFlatGroup\n className={classNames?.group}\n style={customStyles?.group}\n variant={variant}\n >\n {(items as FormFieldProps[])\n .filter((item) => !item.hidden)\n .map((item, i) => mapFlat(item, i))}\n </FormFlatGroup>\n )\n ) : undefined}\n {children}\n {footer}\n </BaseForm>\n </FormContext>\n );\n },\n);\n\nForm.displayName = 'Form';\n\nexport default Form;\n"],"mappings":";;;;;;;;;;;;AAcA,MAAM,iBAAiB,SAAiC;CACtD,IAAI,CAAC,MAAM,OAAO;CAClB,MAAM,UAAU,CAAC,GAAG,IAAI,SAAS,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAC/C,GAAG,WAAW,OAAO,UAAU,QAClC;CACA,OAAO,KAAK,UAAU,QAAQ,MAAM,GAAG,MAAM,EAAE,EAAE,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;AACxE;AAEA,MAAMA,SAAO,MACV,EACC,WACA,cACA,QACA,QAAQ,CAAC,GACT,UACA,YAAY,SACZ,UAAU,cACV,YACA,QAAQ,cACR,KACA,OACA,aACA,kBACA,eACA,WACA,YACA,UACA,cACA,QACA,KACA,GAAG,WACC;CACJ,MAAM,EAAE,WAAW,cAAc;CACjC,MAAM,UAAU,OAAwB,IAAI;CAC5C,MAAM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AAI;GAhBN,UAAA;IAkBG,SAAS,MAAM,SAAS,IACvB,cAAc,UACX,MAA8B,KAAK,MAAM,MAAM,QAAQ,MAAM,CAAC,CAAC,IAEhE,oBAAC,eAAD;KACE,WAAW,YAAY;KACvB,OAAO,cAAc;KACZ;KAEP,UAAA,MACC,QAAQ,SAAS,CAAC,KAAK,MAAM,CAAC,CAC9B,KAAK,MAAM,MAAM,QAAQ,MAAM,CAAC,CAAC;IACvB,CAAA,IAEf,KAAA;IACH;IACA;GACO;;CACC,CAAA;AAEjB,CACF;AAEA,OAAK,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"FormField.mjs","names":[],"sources":["../../../../src/base-ui/Form/components/FormField.tsx"],"sourcesContent":["'use client';\n\nimport { Field } from '@base-ui/react/field';\nimport { cx, useResponsive } from 'antd-style';\nimport { cloneElement, isValidElement, memo, useMemo } from 'react';\n\nimport { useFormContext } from '../context';\nimport { fieldStyles, fieldVariants } from '../style';\nimport type { FormFieldProps } from '../type';\nimport FormDivider from './FormDivider';\nimport FormTitle from './FormTitle';\n\nconst FormField = memo<FormFieldProps>(\n ({\n avatar,\n children,\n className,\n desc,\n divider,\n hidden,\n label,\n layout,\n minWidth,\n name,\n required,\n style,\n tag,\n variant,\n ...rest\n }) => {\n const { mobile } = useResponsive();\n const config = useFormContext();\n\n const mergedLayout = layout || (mobile ? 'vertical' : config.layout);\n const mergedVariant = variant || config.variant;\n const mergedMinWidth = minWidth ?? config.itemMinWidth;\n\n const control = useMemo(() => {\n if (!isValidElement(children)) return children;\n const props = children.props as Record<string, unknown>;\n const injected: Record<string, unknown> = {};\n if (required && props.required === undefined) injected.required = true;\n if (name) {\n const initialValue = config.initialValues?.[name];\n if (\n initialValue !== undefined &&\n props.value === undefined &&\n props.defaultValue === undefined\n )\n injected.defaultValue = initialValue;\n }\n if (Object.keys(injected).length === 0) return children;\n return cloneElement(children, injected as never);\n }, [children, name, required, config.initialValues]);\n\n if (hidden) return null;\n\n return (\n <>\n {divider && <FormDivider visible={mergedVariant !== 'borderless'} />}\n <Field.Root\n className={cx(fieldVariants({ layout: mergedLayout }), className)}\n name={name}\n style={style}\n {...rest}\n >\n <Field.Label className={fieldStyles.label}>\n <FormTitle avatar={avatar} desc={desc} tag={tag} title={label} />\n </Field.Label>\n <div\n className={cx(\n fieldStyles.control,\n mergedLayout === 'vertical' && fieldStyles.controlVertical,\n )}\n style={\n mergedMinWidth === undefined || mergedMinWidth === null || mergedMinWidth === ''\n ? undefined\n : {\n minWidth:\n typeof mergedMinWidth === 'number' ? `${mergedMinWidth}px` : mergedMinWidth,\n }\n }\n >\n {control}\n <Field.Error className={fieldStyles.error} />\n </div>\n </Field.Root>\n </>\n );\n },\n);\n\nFormField.displayName = 'FormField';\n\nexport default FormField;\n"],"mappings":";;;;;;;;;;AAYA,MAAM,YAAY,MACf,EACC,QACA,UACA,WACA,MACA,SACA,QACA,OACA,QACA,UACA,MACA,UACA,OACA,KACA,SACA,GAAG,WACC;CACJ,MAAM,EAAE,WAAW,cAAc;CACjC,MAAM,SAAS,eAAe;CAE9B,MAAM,eAAe,WAAW,SAAS,aAAa,OAAO;CAC7D,MAAM,gBAAgB,WAAW,OAAO;CACxC,MAAM,iBAAiB,YAAY,OAAO;CAE1C,MAAM,UAAU,cAAc;EAC5B,IAAI,CAAC,eAAe,QAAQ,GAAG,OAAO;EACtC,MAAM,QAAQ,SAAS;EACvB,MAAM,WAAoC,CAAC;EAC3C,IAAI,YAAY,MAAM,aAAa,KAAA,GAAW,SAAS,WAAW;EAClE,IAAI,MAAM;GACR,MAAM,eAAe,OAAO,gBAAgB;GAC5C,IACE,iBAAiB,KAAA,KACjB,MAAM,UAAU,KAAA,KAChB,MAAM,iBAAiB,KAAA,GAEvB,SAAS,eAAe;EAC5B;EACA,IAAI,OAAO,KAAK,QAAQ,CAAC,CAAC,WAAW,GAAG,OAAO;EAC/C,OAAO,aAAa,UAAU,QAAiB;CACjD,GAAG;EAAC;EAAU;EAAM;EAAU,OAAO;CAAa,CAAC;CAEnD,IAAI,QAAQ,OAAO;CAEnB,OACE,qBAAA,YAAA,EAAA,UAAA,CACG,WAAW,oBAAC,aAAD,EAAa,SAAS,kBAAkB,aAAe,CAAA,GACnE,qBAAC,MAAM,MAAP;EACE,WAAW,GAAG,cAAc,EAAE,QAAQ,aAAa,CAAC,GAAG,SAAS;EAC1D;EACC;EACP,GAAI;YAJN,CAME,oBAAC,MAAM,OAAP;GAAa,WAAW,YAAY;aAClC,oBAAC,WAAD;IAAmB;IAAc;IAAW;IAAK,OAAO;GAAQ,CAAA;EACrD,CAAA,GACb,qBAAC,OAAD;GACE,WAAW,GACT,YAAY,SACZ,iBAAiB,cAAc,YAAY,eAC7C;GACA,OACE,mBAAmB,KAAA,KAAa,mBAAmB,QAAQ,mBAAmB,KAC1E,KAAA,IACA,EACE,UACE,OAAO,mBAAmB,WAAW,GAAG,eAAe,MAAM,eACjE;aAXR,CAcG,SACD,oBAAC,MAAM,OAAP,EAAa,WAAW,YAAY,MAAQ,CAAA,CACzC;IACK;GACZ,EAAA,CAAA;AAEN,CACF;AAEA,UAAU,cAAc"}
1
+ {"version":3,"file":"FormField.mjs","names":[],"sources":["../../../../src/base-ui/Form/components/FormField.tsx"],"sourcesContent":["'use client';\n\nimport { Field } from '@base-ui/react/field';\nimport { cx, useResponsive } from 'antd-style';\nimport { cloneElement, isValidElement, memo, useMemo } from 'react';\n\nimport { useFormContext } from '../context';\nimport { fieldStyles, fieldVariants } from '../style';\nimport type { FormFieldProps } from '../type';\nimport FormDivider from './FormDivider';\nimport FormTitle from './FormTitle';\n\nconst FormField = memo<FormFieldProps>(\n ({\n avatar,\n children,\n className,\n desc,\n divider,\n hidden,\n label,\n layout,\n minWidth,\n name,\n required,\n style,\n tag,\n variant,\n ...rest\n }) => {\n const { mobile } = useResponsive();\n const config = useFormContext();\n\n const mergedLayout = layout || (mobile ? 'vertical' : config.layout);\n const mergedVariant = variant || config.variant;\n const mergedMinWidth = minWidth ?? config.itemMinWidth;\n\n const control = useMemo(() => {\n if (!isValidElement(children)) return children;\n const props = children.props as Record<string, unknown>;\n const injected: Record<string, unknown> = {};\n if (required && props.required === undefined) injected.required = true;\n if (name) {\n const initialValue = config.initialValues?.[name];\n if (\n initialValue !== undefined &&\n props.value === undefined &&\n props.defaultValue === undefined\n )\n injected.defaultValue = initialValue;\n }\n if (Object.keys(injected).length === 0) return children;\n return cloneElement(children, injected as never);\n }, [children, name, required, config.initialValues]);\n\n if (hidden) return null;\n\n return (\n <>\n {divider && <FormDivider visible={mergedVariant !== 'borderless'} />}\n <Field.Root\n className={cx(fieldVariants({ layout: mergedLayout }), className)}\n name={name}\n style={style}\n {...rest}\n >\n <Field.Label className={fieldStyles.label}>\n <FormTitle avatar={avatar} desc={desc} tag={tag} title={label} />\n </Field.Label>\n <div\n className={cx(\n fieldStyles.control,\n mergedLayout === 'vertical' && fieldStyles.controlVertical,\n )}\n style={\n mergedMinWidth === undefined || mergedMinWidth === null || mergedMinWidth === ''\n ? undefined\n : {\n minWidth:\n typeof mergedMinWidth === 'number' ? `${mergedMinWidth}px` : mergedMinWidth,\n }\n }\n >\n {control}\n <Field.Error className={fieldStyles.error} />\n </div>\n </Field.Root>\n </>\n );\n },\n);\n\nFormField.displayName = 'FormField';\n\nexport default FormField;\n"],"mappings":";;;;;;;;;;AAYA,MAAM,YAAY,MACf,EACC,QACA,UACA,WACA,MACA,SACA,QACA,OACA,QACA,UACA,MACA,UACA,OACA,KACA,SACA,GAAG,WACC;CACJ,MAAM,EAAE,WAAW,cAAc;CACjC,MAAM,SAAS,eAAe;CAE9B,MAAM,eAAe,WAAW,SAAS,aAAa,OAAO;CAC7D,MAAM,gBAAgB,WAAW,OAAO;CACxC,MAAM,iBAAiB,YAAY,OAAO;CAE1C,MAAM,UAAU,cAAc;EAC5B,IAAI,CAAC,eAAe,QAAQ,GAAG,OAAO;EACtC,MAAM,QAAQ,SAAS;EACvB,MAAM,WAAoC,CAAC;EAC3C,IAAI,YAAY,MAAM,aAAa,KAAA,GAAW,SAAS,WAAW;EAClE,IAAI,MAAM;GACR,MAAM,eAAe,OAAO,gBAAgB;GAC5C,IACE,iBAAiB,KAAA,KACjB,MAAM,UAAU,KAAA,KAChB,MAAM,iBAAiB,KAAA,GAEvB,SAAS,eAAe;EAC5B;EACA,IAAI,OAAO,KAAK,QAAQ,CAAC,CAAC,WAAW,GAAG,OAAO;EAC/C,OAAO,aAAa,UAAU,QAAiB;CACjD,GAAG;EAAC;EAAU;EAAM;EAAU,OAAO;CAAa,CAAC;CAEnD,IAAI,QAAQ,OAAO;CAEnB,OACE,qBAAA,YAAA,EAAA,UAAA,CACG,WAAW,oBAAC,aAAD,EAAa,SAAS,kBAAkB,aAAe,CAAA,GACnE,qBAAC,MAAM,MAAP;EACE,WAAW,GAAG,cAAc,EAAE,QAAQ,aAAa,CAAC,GAAG,SAAS;EAC1D;EACC;EACP,GAAI;EAJN,UAAA,CAME,oBAAC,MAAM,OAAP;GAAa,WAAW,YAAY;GAClC,UAAA,oBAAC,WAAD;IAAmB;IAAc;IAAW;IAAK,OAAO;GAAQ,CAAA;EACrD,CAAA,GACb,qBAAC,OAAD;GACE,WAAW,GACT,YAAY,SACZ,iBAAiB,cAAc,YAAY,eAC7C;GACA,OACE,mBAAmB,KAAA,KAAa,mBAAmB,QAAQ,mBAAmB,KAC1E,KAAA,IACA,EACE,UACE,OAAO,mBAAmB,WAAW,GAAG,eAAe,MAAM,eACjE;GAXR,UAAA,CAcG,SACD,oBAAC,MAAM,OAAP,EAAa,WAAW,YAAY,MAAQ,CAAA,CACzC;EACK,CAAA,CAAA;CACZ,CAAA,CAAA,EAAA,CAAA;AAEN,CACF;AAEA,UAAU,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"FormGroup.mjs","names":[],"sources":["../../../../src/base-ui/Form/components/FormGroup.tsx"],"sourcesContent":["'use client';\n\nimport { Collapsible } from '@base-ui/react/collapsible';\nimport { cx, useResponsive } from 'antd-style';\nimport { ChevronDown } from 'lucide-react';\nimport { memo, type ReactNode } from 'react';\n\nimport Icon from '@/Icon';\n\nimport { groupStyles, groupVariants } from '../style';\nimport type { FormGroupProps } from '../type';\n\nconst GroupTitle = memo<{\n desc?: ReactNode;\n icon?: FormGroupProps['icon'];\n mobile?: boolean;\n title?: ReactNode;\n variant?: FormGroupProps['variant'];\n}>(({ icon, title, desc, variant, mobile }) => (\n <div\n className={cx(\n groupStyles.title,\n variant === 'borderless' && !mobile && groupStyles.titleBorderless,\n mobile && groupStyles.mobileTitle,\n )}\n >\n {icon && <Icon icon={icon} />}\n <div>\n {title}\n {desc && <div className={groupStyles.desc}>{desc}</div>}\n </div>\n </div>\n));\n\nGroupTitle.displayName = 'GroupTitle';\n\nconst FormGroup = memo<FormGroupProps>(\n ({\n className,\n icon,\n title,\n children,\n extra,\n variant = 'borderless',\n defaultActive = true,\n collapsible,\n active,\n onCollapse,\n desc,\n keyValue: _keyValue,\n ...rest\n }) => {\n const { mobile } = useResponsive();\n const isBorderless = variant === 'borderless';\n const isCollapsible = collapsible === undefined ? !isBorderless : collapsible;\n\n if (mobile)\n return (\n <div className={className} {...rest}>\n <div className={cx(groupStyles.header, groupStyles.mobileHeader)}>\n <GroupTitle mobile desc={desc} icon={icon} title={title} />\n {extra}\n </div>\n <div className={groupStyles.mobileBody}>{children}</div>\n </div>\n );\n\n if (!isCollapsible)\n return (\n <div className={cx(groupVariants({ variant }), className)} {...rest}>\n {title && (\n <div\n className={cx(\n groupStyles.header,\n isBorderless ? groupStyles.headerBorderless : groupStyles.headerBoxed,\n )}\n >\n <GroupTitle desc={desc} icon={icon} title={title} variant={variant} />\n {extra}\n </div>\n )}\n <div className={cx(groupStyles.body, !isBorderless && groupStyles.bodyBoxed)}>\n {children}\n </div>\n </div>\n );\n\n return (\n <Collapsible.Root\n className={cx(groupVariants({ variant }), className)}\n defaultOpen={defaultActive}\n open={active}\n onOpenChange={onCollapse}\n {...rest}\n >\n <div\n className={cx(\n groupStyles.header,\n isBorderless ? groupStyles.headerBorderless : groupStyles.headerBoxed,\n )}\n >\n <Collapsible.Trigger className={groupStyles.trigger}>\n <GroupTitle desc={desc} icon={icon} title={title} variant={variant} />\n <Icon className={groupStyles.chevron} icon={ChevronDown} />\n </Collapsible.Trigger>\n {extra}\n </div>\n <Collapsible.Panel className={groupStyles.panel}>\n <div className={cx(groupStyles.body, !isBorderless && groupStyles.bodyBoxed)}>\n {children}\n </div>\n </Collapsible.Panel>\n </Collapsible.Root>\n );\n },\n);\n\nFormGroup.displayName = 'FormGroup';\n\nexport default FormGroup;\n"],"mappings":";;;;;;;;;AAYA,MAAM,aAAa,MAMf,EAAE,MAAM,OAAO,MAAM,SAAS,aAChC,qBAAC,OAAD;CACE,WAAW,GACT,YAAY,OACZ,YAAY,gBAAgB,CAAC,UAAU,YAAY,iBACnD,UAAU,YAAY,WACxB;WALF,CAOG,QAAQ,oBAAC,MAAD,EAAY,KAAO,CAAA,GAC5B,qBAAC,OAAD,EAAA,UAAA,CACG,OACA,QAAQ,oBAAC,OAAD;EAAK,WAAW,YAAY;YAAO;CAAU,CAAA,CACnD,EAAA,CAAA,CACF;EACN;AAED,WAAW,cAAc;AAEzB,MAAM,YAAY,MACf,EACC,WACA,MACA,OACA,UACA,OACA,UAAU,cACV,gBAAgB,MAChB,aACA,QACA,YACA,MACA,UAAU,WACV,GAAG,WACC;CACJ,MAAM,EAAE,WAAW,cAAc;CACjC,MAAM,eAAe,YAAY;CACjC,MAAM,gBAAgB,gBAAgB,KAAA,IAAY,CAAC,eAAe;CAElE,IAAI,QACF,OACE,qBAAC,OAAD;EAAgB;EAAW,GAAI;YAA/B,CACE,qBAAC,OAAD;GAAK,WAAW,GAAG,YAAY,QAAQ,YAAY,YAAY;aAA/D,CACE,oBAAC,YAAD;IAAY,QAAA;IAAa;IAAY;IAAa;GAAQ,CAAA,GACzD,KACE;MACL,oBAAC,OAAD;GAAK,WAAW,YAAY;GAAa;EAAc,CAAA,CACpD;;CAGT,IAAI,CAAC,eACH,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,cAAc,EAAE,QAAQ,CAAC,GAAG,SAAS;EAAG,GAAI;YAA/D,CACG,SACC,qBAAC,OAAD;GACE,WAAW,GACT,YAAY,QACZ,eAAe,YAAY,mBAAmB,YAAY,WAC5D;aAJF,CAME,oBAAC,YAAD;IAAkB;IAAY;IAAa;IAAgB;GAAU,CAAA,GACpE,KACE;MAEP,oBAAC,OAAD;GAAK,WAAW,GAAG,YAAY,MAAM,CAAC,gBAAgB,YAAY,SAAS;GACxE;EACE,CAAA,CACF;;CAGT,OACE,qBAAC,YAAY,MAAb;EACE,WAAW,GAAG,cAAc,EAAE,QAAQ,CAAC,GAAG,SAAS;EACnD,aAAa;EACb,MAAM;EACN,cAAc;EACd,GAAI;YALN,CAOE,qBAAC,OAAD;GACE,WAAW,GACT,YAAY,QACZ,eAAe,YAAY,mBAAmB,YAAY,WAC5D;aAJF,CAME,qBAAC,YAAY,SAAb;IAAqB,WAAW,YAAY;cAA5C,CACE,oBAAC,YAAD;KAAkB;KAAY;KAAa;KAAgB;IAAU,CAAA,GACrE,oBAAC,MAAD;KAAM,WAAW,YAAY;KAAS,MAAM;IAAc,CAAA,CACvC;OACpB,KACE;MACL,oBAAC,YAAY,OAAb;GAAmB,WAAW,YAAY;aACxC,oBAAC,OAAD;IAAK,WAAW,GAAG,YAAY,MAAM,CAAC,gBAAgB,YAAY,SAAS;IACxE;GACE,CAAA;EACY,CAAA,CACH;;AAEtB,CACF;AAEA,UAAU,cAAc"}
1
+ {"version":3,"file":"FormGroup.mjs","names":[],"sources":["../../../../src/base-ui/Form/components/FormGroup.tsx"],"sourcesContent":["'use client';\n\nimport { Collapsible } from '@base-ui/react/collapsible';\nimport { cx, useResponsive } from 'antd-style';\nimport { ChevronDown } from 'lucide-react';\nimport { memo, type ReactNode } from 'react';\n\nimport Icon from '@/Icon';\n\nimport { groupStyles, groupVariants } from '../style';\nimport type { FormGroupProps } from '../type';\n\nconst GroupTitle = memo<{\n desc?: ReactNode;\n icon?: FormGroupProps['icon'];\n mobile?: boolean;\n title?: ReactNode;\n variant?: FormGroupProps['variant'];\n}>(({ icon, title, desc, variant, mobile }) => (\n <div\n className={cx(\n groupStyles.title,\n variant === 'borderless' && !mobile && groupStyles.titleBorderless,\n mobile && groupStyles.mobileTitle,\n )}\n >\n {icon && <Icon icon={icon} />}\n <div>\n {title}\n {desc && <div className={groupStyles.desc}>{desc}</div>}\n </div>\n </div>\n));\n\nGroupTitle.displayName = 'GroupTitle';\n\nconst FormGroup = memo<FormGroupProps>(\n ({\n className,\n icon,\n title,\n children,\n extra,\n variant = 'borderless',\n defaultActive = true,\n collapsible,\n active,\n onCollapse,\n desc,\n keyValue: _keyValue,\n ...rest\n }) => {\n const { mobile } = useResponsive();\n const isBorderless = variant === 'borderless';\n const isCollapsible = collapsible === undefined ? !isBorderless : collapsible;\n\n if (mobile)\n return (\n <div className={className} {...rest}>\n <div className={cx(groupStyles.header, groupStyles.mobileHeader)}>\n <GroupTitle mobile desc={desc} icon={icon} title={title} />\n {extra}\n </div>\n <div className={groupStyles.mobileBody}>{children}</div>\n </div>\n );\n\n if (!isCollapsible)\n return (\n <div className={cx(groupVariants({ variant }), className)} {...rest}>\n {title && (\n <div\n className={cx(\n groupStyles.header,\n isBorderless ? groupStyles.headerBorderless : groupStyles.headerBoxed,\n )}\n >\n <GroupTitle desc={desc} icon={icon} title={title} variant={variant} />\n {extra}\n </div>\n )}\n <div className={cx(groupStyles.body, !isBorderless && groupStyles.bodyBoxed)}>\n {children}\n </div>\n </div>\n );\n\n return (\n <Collapsible.Root\n className={cx(groupVariants({ variant }), className)}\n defaultOpen={defaultActive}\n open={active}\n onOpenChange={onCollapse}\n {...rest}\n >\n <div\n className={cx(\n groupStyles.header,\n isBorderless ? groupStyles.headerBorderless : groupStyles.headerBoxed,\n )}\n >\n <Collapsible.Trigger className={groupStyles.trigger}>\n <GroupTitle desc={desc} icon={icon} title={title} variant={variant} />\n <Icon className={groupStyles.chevron} icon={ChevronDown} />\n </Collapsible.Trigger>\n {extra}\n </div>\n <Collapsible.Panel className={groupStyles.panel}>\n <div className={cx(groupStyles.body, !isBorderless && groupStyles.bodyBoxed)}>\n {children}\n </div>\n </Collapsible.Panel>\n </Collapsible.Root>\n );\n },\n);\n\nFormGroup.displayName = 'FormGroup';\n\nexport default FormGroup;\n"],"mappings":";;;;;;;;;AAYA,MAAM,aAAa,MAMf,EAAE,MAAM,OAAO,MAAM,SAAS,aAChC,qBAAC,OAAD;CACE,WAAW,GACT,YAAY,OACZ,YAAY,gBAAgB,CAAC,UAAU,YAAY,iBACnD,UAAU,YAAY,WACxB;CALF,UAAA,CAOG,QAAQ,oBAAC,MAAD,EAAY,KAAO,CAAA,GAC5B,qBAAC,OAAD,EAAA,UAAA,CACG,OACA,QAAQ,oBAAC,OAAD;EAAK,WAAW,YAAY;EAAO,UAAA;CAAU,CAAA,CACnD,EAAA,CAAA,CACF;AACN,CAAA,CAAA;AAED,WAAW,cAAc;AAEzB,MAAM,YAAY,MACf,EACC,WACA,MACA,OACA,UACA,OACA,UAAU,cACV,gBAAgB,MAChB,aACA,QACA,YACA,MACA,UAAU,WACV,GAAG,WACC;CACJ,MAAM,EAAE,WAAW,cAAc;CACjC,MAAM,eAAe,YAAY;CACjC,MAAM,gBAAgB,gBAAgB,KAAA,IAAY,CAAC,eAAe;CAElE,IAAI,QACF,OACE,qBAAC,OAAD;EAAgB;EAAW,GAAI;EAA/B,UAAA,CACE,qBAAC,OAAD;GAAK,WAAW,GAAG,YAAY,QAAQ,YAAY,YAAY;GAA/D,UAAA,CACE,oBAAC,YAAD;IAAY,QAAA;IAAa;IAAY;IAAa;GAAQ,CAAA,GACzD,KACE;EACL,CAAA,GAAA,oBAAC,OAAD;GAAK,WAAW,YAAY;GAAa;EAAc,CAAA,CACpD;;CAGT,IAAI,CAAC,eACH,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,cAAc,EAAE,QAAQ,CAAC,GAAG,SAAS;EAAG,GAAI;EAA/D,UAAA,CACG,SACC,qBAAC,OAAD;GACE,WAAW,GACT,YAAY,QACZ,eAAe,YAAY,mBAAmB,YAAY,WAC5D;GAJF,UAAA,CAME,oBAAC,YAAD;IAAkB;IAAY;IAAa;IAAgB;GAAU,CAAA,GACpE,KACE;EAEP,CAAA,GAAA,oBAAC,OAAD;GAAK,WAAW,GAAG,YAAY,MAAM,CAAC,gBAAgB,YAAY,SAAS;GACxE;EACE,CAAA,CACF;;CAGT,OACE,qBAAC,YAAY,MAAb;EACE,WAAW,GAAG,cAAc,EAAE,QAAQ,CAAC,GAAG,SAAS;EACnD,aAAa;EACb,MAAM;EACN,cAAc;EACd,GAAI;EALN,UAAA,CAOE,qBAAC,OAAD;GACE,WAAW,GACT,YAAY,QACZ,eAAe,YAAY,mBAAmB,YAAY,WAC5D;GAJF,UAAA,CAME,qBAAC,YAAY,SAAb;IAAqB,WAAW,YAAY;IAA5C,UAAA,CACE,oBAAC,YAAD;KAAkB;KAAY;KAAa;KAAgB;IAAU,CAAA,GACrE,oBAAC,MAAD;KAAM,WAAW,YAAY;KAAS,MAAM;IAAc,CAAA,CACvC;GACpB,CAAA,GAAA,KACE;EACL,CAAA,GAAA,oBAAC,YAAY,OAAb;GAAmB,WAAW,YAAY;GACxC,UAAA,oBAAC,OAAD;IAAK,WAAW,GAAG,YAAY,MAAM,CAAC,gBAAgB,YAAY,SAAS;IACxE;GACE,CAAA;EACY,CAAA,CACH;;AAEtB,CACF;AAEA,UAAU,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"FormSubmitFooter.mjs","names":["formMessages","Flexbox","styles"],"sources":["../../../../src/base-ui/Form/components/FormSubmitFooter.tsx"],"sourcesContent":["'use client';\n\nimport { cssVar, cx } from 'antd-style';\nimport { InfoIcon } from 'lucide-react';\nimport { memo, useEffect } from 'react';\n\nimport Button from '@/base-ui/Button';\nimport { Flexbox } from '@/Flex';\nimport formMessages from '@/i18n/resources/en/form';\nimport { useTranslation } from '@/i18n/useTranslation';\nimport Icon from '@/Icon';\nimport { useMotionComponent } from '@/MotionProvider';\n\nimport { useFormContext } from '../context';\nimport { submitFooterStyles as styles } from '../style';\nimport type { FormSubmitFooterProps } from '../type';\n\nconst FormSubmitFooter = memo<FormSubmitFooterProps>(\n ({\n enableReset = true,\n buttonProps,\n float,\n onReset,\n saveButtonProps,\n resetButtonProps,\n enableUnsavedWarning,\n children,\n texts,\n className,\n ...rest\n }) => {\n const Motion = useMotionComponent();\n const { hasUnsavedChanges, requestReset, submitLoading } = useFormContext();\n const { t } = useTranslation(formMessages);\n\n const unsavedWarningText = texts?.unSavedWarning ?? t('form.unsavedWarning');\n const unsavedText = texts?.unSaved ?? t('form.unsavedChanges');\n const resetText = texts?.reset ?? t('form.reset');\n const submitText = texts?.submit ?? t('form.submit');\n\n useEffect(() => {\n if (!enableUnsavedWarning || typeof window === 'undefined' || !hasUnsavedChanges) return;\n const fn = (e: BeforeUnloadEvent) => {\n e.preventDefault();\n e.returnValue = unsavedWarningText;\n };\n window.addEventListener('beforeunload', fn);\n return () => window.removeEventListener('beforeunload', fn);\n }, [enableUnsavedWarning, hasUnsavedChanges, unsavedWarningText]);\n\n const content = (\n <>\n {(float || hasUnsavedChanges) && (\n <>\n <Icon\n color={cssVar.colorTextDescription}\n icon={InfoIcon}\n size={12}\n style={{ marginLeft: 8 }}\n />\n <span\n style={{\n color: cssVar.colorTextDescription,\n flex: 'none',\n fontSize: 12,\n marginRight: float ? 16 : 4,\n }}\n >\n {unsavedText}\n </span>\n </>\n )}\n {children}\n {enableReset && (float || hasUnsavedChanges) && (\n <Button\n htmlType={'button'}\n shape={float ? 'round' : undefined}\n type={'fill'}\n onClick={() => {\n requestReset();\n onReset?.();\n }}\n {...buttonProps}\n {...resetButtonProps}\n >\n {resetText}\n </Button>\n )}\n <Button\n htmlType={'submit'}\n loading={submitLoading}\n shape={float ? 'round' : undefined}\n type={'primary'}\n {...buttonProps}\n {...saveButtonProps}\n >\n {submitText}\n </Button>\n </>\n );\n\n if (!float)\n return (\n <Flexbox\n horizontal\n align={'center'}\n className={cx(styles.footer, className)}\n gap={8}\n justify={'flex-end'}\n {...rest}\n >\n {content}\n </Flexbox>\n );\n\n return (\n <Motion.div\n animate={hasUnsavedChanges ? 'visible' : 'hidden'}\n className={styles.floatFooter}\n initial={'hidden'}\n transition={{ duration: 0.1, ease: 'easeOut' }}\n variants={{\n hidden: {\n opacity: 0,\n x: '-50%',\n y: 20,\n },\n visible: {\n opacity: 1,\n x: '-50%',\n y: 0,\n },\n }}\n >\n <Flexbox\n horizontal\n align={'center'}\n className={className}\n gap={8}\n justify={'center'}\n {...rest}\n >\n {content}\n </Flexbox>\n </Motion.div>\n );\n },\n);\n\nFormSubmitFooter.displayName = 'FormSubmitFooter';\n\nexport default FormSubmitFooter;\n"],"mappings":";;;;;;;;;;;;;;AAiBA,MAAM,mBAAmB,MACtB,EACC,cAAc,MACd,aACA,OACA,SACA,iBACA,kBACA,sBACA,UACA,OACA,WACA,GAAG,WACC;CACJ,MAAM,SAAS,mBAAmB;CAClC,MAAM,EAAE,mBAAmB,cAAc,kBAAkB,eAAe;CAC1E,MAAM,EAAE,MAAM,eAAeA,YAAY;CAEzC,MAAM,qBAAqB,OAAO,kBAAkB,EAAE,qBAAqB;CAC3E,MAAM,cAAc,OAAO,WAAW,EAAE,qBAAqB;CAC7D,MAAM,YAAY,OAAO,SAAS,EAAE,YAAY;CAChD,MAAM,aAAa,OAAO,UAAU,EAAE,aAAa;CAEnD,gBAAgB;EACd,IAAI,CAAC,wBAAwB,OAAO,WAAW,eAAe,CAAC,mBAAmB;EAClF,MAAM,MAAM,MAAyB;GACnC,EAAE,eAAe;GACjB,EAAE,cAAc;EAClB;EACA,OAAO,iBAAiB,gBAAgB,EAAE;EAC1C,aAAa,OAAO,oBAAoB,gBAAgB,EAAE;CAC5D,GAAG;EAAC;EAAsB;EAAmB;CAAkB,CAAC;CAEhE,MAAM,UACJ,qBAAA,YAAA,EAAA,UAAA;GACI,SAAS,sBACT,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,MAAD;GACE,OAAO,OAAO;GACd,MAAM;GACN,MAAM;GACN,OAAO,EAAE,YAAY,EAAE;EACxB,CAAA,GACD,oBAAC,QAAD;GACE,OAAO;IACL,OAAO,OAAO;IACd,MAAM;IACN,UAAU;IACV,aAAa,QAAQ,KAAK;GAC5B;aAEC;EACG,CAAA,CACN,EAAA,CAAA;EAEH;EACA,gBAAgB,SAAS,sBACxB,oBAAC,QAAD;GACE,UAAU;GACV,OAAO,QAAQ,UAAU,KAAA;GACzB,MAAM;GACN,eAAe;IACb,aAAa;IACb,UAAU;GACZ;GACA,GAAI;GACJ,GAAI;aAEH;EACK,CAAA;EAEV,oBAAC,QAAD;GACE,UAAU;GACV,SAAS;GACT,OAAO,QAAQ,UAAU,KAAA;GACzB,MAAM;GACN,GAAI;GACJ,GAAI;aAEH;EACK,CAAA;CACR,EAAA,CAAA;CAGJ,IAAI,CAAC,OACH,OACE,oBAACC,mBAAD;EACE,YAAA;EACA,OAAO;EACP,WAAW,GAAGC,mBAAO,QAAQ,SAAS;EACtC,KAAK;EACL,SAAS;EACT,GAAI;YAEH;CACM,CAAA;CAGb,OACE,oBAAC,OAAO,KAAR;EACE,SAAS,oBAAoB,YAAY;EACzC,WAAWA,mBAAO;EAClB,SAAS;EACT,YAAY;GAAE,UAAU;GAAK,MAAM;EAAU;EAC7C,UAAU;GACR,QAAQ;IACN,SAAS;IACT,GAAG;IACH,GAAG;GACL;GACA,SAAS;IACP,SAAS;IACT,GAAG;IACH,GAAG;GACL;EACF;YAEA,oBAACD,mBAAD;GACE,YAAA;GACA,OAAO;GACI;GACX,KAAK;GACL,SAAS;GACT,GAAI;aAEH;EACM,CAAA;CACC,CAAA;AAEhB,CACF;AAEA,iBAAiB,cAAc"}
1
+ {"version":3,"file":"FormSubmitFooter.mjs","names":["formMessages","Flexbox","styles"],"sources":["../../../../src/base-ui/Form/components/FormSubmitFooter.tsx"],"sourcesContent":["'use client';\n\nimport { cssVar, cx } from 'antd-style';\nimport { InfoIcon } from 'lucide-react';\nimport { memo, useEffect } from 'react';\n\nimport Button from '@/base-ui/Button';\nimport { Flexbox } from '@/Flex';\nimport formMessages from '@/i18n/resources/en/form';\nimport { useTranslation } from '@/i18n/useTranslation';\nimport Icon from '@/Icon';\nimport { useMotionComponent } from '@/MotionProvider';\n\nimport { useFormContext } from '../context';\nimport { submitFooterStyles as styles } from '../style';\nimport type { FormSubmitFooterProps } from '../type';\n\nconst FormSubmitFooter = memo<FormSubmitFooterProps>(\n ({\n enableReset = true,\n buttonProps,\n float,\n onReset,\n saveButtonProps,\n resetButtonProps,\n enableUnsavedWarning,\n children,\n texts,\n className,\n ...rest\n }) => {\n const Motion = useMotionComponent();\n const { hasUnsavedChanges, requestReset, submitLoading } = useFormContext();\n const { t } = useTranslation(formMessages);\n\n const unsavedWarningText = texts?.unSavedWarning ?? t('form.unsavedWarning');\n const unsavedText = texts?.unSaved ?? t('form.unsavedChanges');\n const resetText = texts?.reset ?? t('form.reset');\n const submitText = texts?.submit ?? t('form.submit');\n\n useEffect(() => {\n if (!enableUnsavedWarning || typeof window === 'undefined' || !hasUnsavedChanges) return;\n const fn = (e: BeforeUnloadEvent) => {\n e.preventDefault();\n e.returnValue = unsavedWarningText;\n };\n window.addEventListener('beforeunload', fn);\n return () => window.removeEventListener('beforeunload', fn);\n }, [enableUnsavedWarning, hasUnsavedChanges, unsavedWarningText]);\n\n const content = (\n <>\n {(float || hasUnsavedChanges) && (\n <>\n <Icon\n color={cssVar.colorTextDescription}\n icon={InfoIcon}\n size={12}\n style={{ marginLeft: 8 }}\n />\n <span\n style={{\n color: cssVar.colorTextDescription,\n flex: 'none',\n fontSize: 12,\n marginRight: float ? 16 : 4,\n }}\n >\n {unsavedText}\n </span>\n </>\n )}\n {children}\n {enableReset && (float || hasUnsavedChanges) && (\n <Button\n htmlType={'button'}\n shape={float ? 'round' : undefined}\n type={'fill'}\n onClick={() => {\n requestReset();\n onReset?.();\n }}\n {...buttonProps}\n {...resetButtonProps}\n >\n {resetText}\n </Button>\n )}\n <Button\n htmlType={'submit'}\n loading={submitLoading}\n shape={float ? 'round' : undefined}\n type={'primary'}\n {...buttonProps}\n {...saveButtonProps}\n >\n {submitText}\n </Button>\n </>\n );\n\n if (!float)\n return (\n <Flexbox\n horizontal\n align={'center'}\n className={cx(styles.footer, className)}\n gap={8}\n justify={'flex-end'}\n {...rest}\n >\n {content}\n </Flexbox>\n );\n\n return (\n <Motion.div\n animate={hasUnsavedChanges ? 'visible' : 'hidden'}\n className={styles.floatFooter}\n initial={'hidden'}\n transition={{ duration: 0.1, ease: 'easeOut' }}\n variants={{\n hidden: {\n opacity: 0,\n x: '-50%',\n y: 20,\n },\n visible: {\n opacity: 1,\n x: '-50%',\n y: 0,\n },\n }}\n >\n <Flexbox\n horizontal\n align={'center'}\n className={className}\n gap={8}\n justify={'center'}\n {...rest}\n >\n {content}\n </Flexbox>\n </Motion.div>\n );\n },\n);\n\nFormSubmitFooter.displayName = 'FormSubmitFooter';\n\nexport default FormSubmitFooter;\n"],"mappings":";;;;;;;;;;;;;;AAiBA,MAAM,mBAAmB,MACtB,EACC,cAAc,MACd,aACA,OACA,SACA,iBACA,kBACA,sBACA,UACA,OACA,WACA,GAAG,WACC;CACJ,MAAM,SAAS,mBAAmB;CAClC,MAAM,EAAE,mBAAmB,cAAc,kBAAkB,eAAe;CAC1E,MAAM,EAAE,MAAM,eAAeA,YAAY;CAEzC,MAAM,qBAAqB,OAAO,kBAAkB,EAAE,qBAAqB;CAC3E,MAAM,cAAc,OAAO,WAAW,EAAE,qBAAqB;CAC7D,MAAM,YAAY,OAAO,SAAS,EAAE,YAAY;CAChD,MAAM,aAAa,OAAO,UAAU,EAAE,aAAa;CAEnD,gBAAgB;EACd,IAAI,CAAC,wBAAwB,OAAO,WAAW,eAAe,CAAC,mBAAmB;EAClF,MAAM,MAAM,MAAyB;GACnC,EAAE,eAAe;GACjB,EAAE,cAAc;EAClB;EACA,OAAO,i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L,SAAS;GACT,GAAI;GAEH,UAAA;EACM,CAAA;CACC,CAAA;AAEhB,CACF;AAEA,iBAAiB,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"FormTitle.mjs","names":["Flexbox","styles"],"sources":["../../../../src/base-ui/Form/components/FormTitle.tsx"],"sourcesContent":["'use client';\n\nimport { cx } from 'antd-style';\nimport { type FC } from 'react';\n\nimport { Flexbox } from '@/Flex';\nimport Tag from '@/Tag';\n\nimport { titleStyles as styles } from '../style';\nimport type { FormTitleProps } from '../type';\n\nconst FormTitle: FC<FormTitleProps> = ({\n tag,\n title,\n desc,\n avatar,\n classNames,\n styles: customStyles,\n tagProps,\n ...rest\n}) => {\n return (\n <Flexbox horizontal align={'center'} gap={8} {...rest}>\n {avatar}\n <Flexbox\n className={cx(styles.content, classNames?.content)}\n gap={8}\n style={customStyles?.content}\n >\n <Flexbox\n horizontal\n align={'center'}\n className={cx(styles.title, classNames?.title)}\n gap={8}\n style={customStyles?.title}\n >\n {title}\n {tag && (\n <Tag className={classNames?.tag} style={customStyles?.tag} {...tagProps}>\n {tag}\n </Tag>\n )}\n </Flexbox>\n {desc && (\n <small className={cx(styles.desc, classNames?.desc)} style={customStyles?.desc}>\n {desc}\n </small>\n )}\n </Flexbox>\n </Flexbox>\n );\n};\n\nFormTitle.displayName = 'FormTitle';\n\nexport default FormTitle;\n"],"mappings":";;;;;;;AAWA,MAAM,aAAiC,EACrC,KACA,OACA,MACA,QACA,YACA,QAAQ,cACR,UACA,GAAG,WACC;CACJ,OACE,qBAACA,mBAAD;EAAS,YAAA;EAAW,OAAO;EAAU,KAAK;EAAG,GAAI;YAAjD,CACG,QACD,qBAACA,mBAAD;GACE,WAAW,GAAGC,YAAO,SAAS,YAAY,OAAO;GACjD,KAAK;GACL,OAAO,cAAc;aAHvB,CAKE,qBAACD,mBAAD;IACE,YAAA;IACA,OAAO;IACP,WAAW,GAAGC,YAAO,OAAO,YAAY,KAAK;IAC7C,KAAK;IACL,OAAO,cAAc;cALvB,CAOG,OACA,OACC,oBAAC,KAAD;KAAK,WAAW,YAAY;KAAK,OAAO,cAAc;KAAK,GAAI;eAC5D;IACE,CAAA,CAEA;OACR,QACC,oBAAC,SAAD;IAAO,WAAW,GAAGA,YAAO,MAAM,YAAY,IAAI;IAAG,OAAO,cAAc;cACvE;GACI,CAAA,CAEF;IACF;;AAEb;AAEA,UAAU,cAAc"}
1
+ {"version":3,"file":"FormTitle.mjs","names":["Flexbox","styles"],"sources":["../../../../src/base-ui/Form/components/FormTitle.tsx"],"sourcesContent":["'use client';\n\nimport { cx } from 'antd-style';\nimport { type FC } from 'react';\n\nimport { Flexbox } from '@/Flex';\nimport Tag from '@/Tag';\n\nimport { titleStyles as styles } from '../style';\nimport type { FormTitleProps } from '../type';\n\nconst FormTitle: FC<FormTitleProps> = ({\n tag,\n title,\n desc,\n avatar,\n classNames,\n styles: customStyles,\n tagProps,\n ...rest\n}) => {\n return (\n <Flexbox horizontal align={'center'} gap={8} {...rest}>\n {avatar}\n <Flexbox\n className={cx(styles.content, classNames?.content)}\n gap={8}\n style={customStyles?.content}\n >\n <Flexbox\n horizontal\n align={'center'}\n className={cx(styles.title, classNames?.title)}\n gap={8}\n style={customStyles?.title}\n >\n {title}\n {tag && (\n <Tag className={classNames?.tag} style={customStyles?.tag} {...tagProps}>\n {tag}\n </Tag>\n )}\n </Flexbox>\n {desc && (\n <small className={cx(styles.desc, classNames?.desc)} style={customStyles?.desc}>\n {desc}\n </small>\n )}\n </Flexbox>\n </Flexbox>\n );\n};\n\nFormTitle.displayName = 'FormTitle';\n\nexport default FormTitle;\n"],"mappings":";;;;;;;AAWA,MAAM,aAAiC,EACrC,KACA,OACA,MACA,QACA,YACA,QAAQ,cACR,UACA,GAAG,WACC;CACJ,OACE,qBAACA,mBAAD;EAAS,YAAA;EAAW,OAAO;EAAU,KAAK;EAAG,GAAI;EAAjD,UAAA,CACG,QACD,qBAACA,mBAAD;GACE,WAAW,GAAGC,YAAO,SAAS,YAAY,OAAO;GACjD,KAAK;GACL,OAAO,cAAc;GAHvB,UAAA,CAKE,qBAACD,mBAAD;IACE,YAAA;IACA,OAAO;IACP,WAAW,GAAGC,YAAO,OAAO,YAAY,KAAK;IAC7C,KAAK;IACL,OAAO,cAAc;IALvB,UAAA,CAOG,OACA,OACC,oBAAC,KAAD;KAAK,WAAW,YAAY;KAAK,OAAO,cAAc;KAAK,GAAI;KAC5D,UAAA;IACE,CAAA,CAEA;GACR,CAAA,GAAA,QACC,oBAAC,SAAD;IAAO,WAAW,GAAGA,YAAO,MAAM,YAAY,IAAI;IAAG,OAAO,cAAc;IACvE,UAAA;GACI,CAAA,CAEF;EACF,CAAA,CAAA;;AAEb;AAEA,UAAU,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"Input.mjs","names":["Input","BaseInput"],"sources":["../../../src/base-ui/Input/Input.tsx"],"sourcesContent":["'use client';\n\nimport { Input as BaseInput } from '@base-ui/react/input';\nimport { cx, useThemeMode } from 'antd-style';\nimport { memo } from 'react';\n\nimport { rootVariants, styles } from './style';\nimport type { InputProps } from './type';\n\nconst Input = memo<InputProps>(\n ({\n ref,\n className,\n classNames,\n styles: customStyles,\n style,\n variant,\n shadow,\n size = 'middle',\n prefix,\n suffix,\n disabled,\n ...rest\n }) => {\n const { isDarkMode } = useThemeMode();\n const mergedVariant = variant || (isDarkMode ? 'filled' : 'outlined');\n\n return (\n <div\n className={cx(rootVariants({ shadow, size, variant: mergedVariant }), className)}\n data-disabled={disabled ? '' : undefined}\n style={style}\n >\n {prefix && (\n <span className={cx(styles.slot, classNames?.prefix)} style={customStyles?.prefix}>\n {prefix}\n </span>\n )}\n <BaseInput\n className={cx(styles.input, classNames?.input)}\n disabled={disabled}\n ref={ref}\n style={customStyles?.input}\n {...rest}\n />\n {suffix && (\n <span className={cx(styles.slot, classNames?.suffix)} style={customStyles?.suffix}>\n {suffix}\n </span>\n )}\n </div>\n );\n },\n);\n\nInput.displayName = 'Input';\n\nexport default Input;\n"],"mappings":";;;;;;;AASA,MAAMA,UAAQ,MACX,EACC,KACA,WACA,YACA,QAAQ,cACR,OACA,SACA,QACA,OAAO,UACP,QACA,QACA,UACA,GAAG,WACC;CACJ,MAAM,EAAE,eAAe,aAAa;CAGpC,OACE,qBAAC,OAAD;EACE,WAAW,GAAG,aAAa;GAAE;GAAQ;GAAM,SAJzB,YAAY,aAAa,WAAW;EAIY,CAAC,GAAG,SAAS;EAC/E,iBAAe,WAAW,KAAK,KAAA;EACxB;YAHT;GAKG,UACC,oBAAC,QAAD;IAAM,WAAW,GAAG,OAAO,MAAM,YAAY,MAAM;IAAG,OAAO,cAAc;cACxE;GACG,CAAA;GAER,oBAACC,OAAD;IACE,WAAW,GAAG,OAAO,OAAO,YAAY,KAAK;IACnC;IACL;IACL,OAAO,cAAc;IACrB,GAAI;GACL,CAAA;GACA,UACC,oBAAC,QAAD;IAAM,WAAW,GAAG,OAAO,MAAM,YAAY,MAAM;IAAG,OAAO,cAAc;cACxE;GACG,CAAA;EAEL;;AAET,CACF;AAEA,QAAM,cAAc"}
1
+ {"version":3,"file":"Input.mjs","names":["Input","BaseInput"],"sources":["../../../src/base-ui/Input/Input.tsx"],"sourcesContent":["'use client';\n\nimport { Input as BaseInput } from '@base-ui/react/input';\nimport { cx, useThemeMode } from 'antd-style';\nimport { memo } from 'react';\n\nimport { rootVariants, styles } from './style';\nimport type { InputProps } from './type';\n\nconst Input = memo<InputProps>(\n ({\n ref,\n className,\n classNames,\n styles: customStyles,\n style,\n variant,\n shadow,\n size = 'middle',\n prefix,\n suffix,\n disabled,\n ...rest\n }) => {\n const { isDarkMode } = useThemeMode();\n const mergedVariant = variant || (isDarkMode ? 'filled' : 'outlined');\n\n return (\n <div\n className={cx(rootVariants({ shadow, size, variant: mergedVariant }), className)}\n data-disabled={disabled ? '' : undefined}\n style={style}\n >\n {prefix && (\n <span className={cx(styles.slot, classNames?.prefix)} style={customStyles?.prefix}>\n {prefix}\n </span>\n )}\n <BaseInput\n className={cx(styles.input, classNames?.input)}\n disabled={disabled}\n ref={ref}\n style={customStyles?.input}\n {...rest}\n />\n {suffix && (\n <span className={cx(styles.slot, classNames?.suffix)} style={customStyles?.suffix}>\n {suffix}\n </span>\n )}\n </div>\n );\n },\n);\n\nInput.displayName = 'Input';\n\nexport default Input;\n"],"mappings":";;;;;;;AASA,MAAMA,UAAQ,MACX,EACC,KACA,WACA,YACA,QAAQ,cACR,OACA,SACA,QACA,OAAO,UACP,QACA,QACA,UACA,GAAG,WACC;CACJ,MAAM,EAAE,eAAe,aAAa;CAGpC,OACE,qBAAC,OAAD;EACE,WAAW,GAAG,aAAa;GAAE;GAAQ;GAAM,SAJzB,YAAY,aAAa,WAAW;EAIY,CAAC,GAAG,SAAS;EAC/E,iBAAe,WAAW,KAAK,KAAA;EACxB;EAHT,UAAA;GAKG,UACC,oBAAC,QAAD;IAAM,WAAW,GAAG,OAAO,MAAM,YAAY,MAAM;IAAG,OAAO,cAAc;IACxE,UAAA;GACG,CAAA;GAER,oBAACC,OAAD;IACE,WAAW,GAAG,OAAO,OAAO,YAAY,KAAK;IACnC;IACL;IACL,OAAO,cAAc;IACrB,GAAI;GACL,CAAA;GACA,UACC,oBAAC,QAAD;IAAM,WAAW,GAAG,OAAO,MAAM,YAAY,MAAM;IAAG,OAAO,cAAc;IACxE,UAAA;GACG,CAAA;EAEL;;AAET,CACF;AAEA,QAAM,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"InputNumber.mjs","names":[],"sources":["../../../src/base-ui/Input/InputNumber.tsx"],"sourcesContent":["'use client';\n\nimport { NumberField } from '@base-ui/react/number-field';\nimport { cx, useThemeMode } from 'antd-style';\nimport { ChevronDown, ChevronUp } from 'lucide-react';\nimport { memo } from 'react';\n\nimport Icon from '@/Icon';\n\nimport { rootVariants, styles } from './style';\nimport type { InputNumberProps } from './type';\n\nconst InputNumber = memo<InputNumberProps>(\n ({\n ref,\n className,\n classNames,\n styles: customStyles,\n style,\n variant,\n shadow,\n size = 'middle',\n controls = true,\n changeOnWheel,\n onChange,\n placeholder,\n ...rest\n }) => {\n const { isDarkMode } = useThemeMode();\n const mergedVariant = variant || (isDarkMode ? 'filled' : 'outlined');\n\n return (\n <NumberField.Root\n allowWheelScrub={changeOnWheel}\n className={cx(rootVariants({ shadow, size, variant: mergedVariant }), className)}\n style={style}\n onValueChange={onChange}\n {...rest}\n >\n <NumberField.Input\n className={cx(styles.input, styles.numberInput, classNames?.input)}\n placeholder={placeholder}\n ref={ref}\n style={customStyles?.input}\n />\n {controls && (\n <div className={styles.numberControls}>\n <NumberField.Increment className={styles.numberControl}>\n <Icon icon={ChevronUp} size={12} />\n </NumberField.Increment>\n <NumberField.Decrement className={styles.numberControl}>\n <Icon icon={ChevronDown} size={12} />\n </NumberField.Decrement>\n </div>\n )}\n </NumberField.Root>\n );\n },\n);\n\nInputNumber.displayName = 'InputNumber';\n\nexport default InputNumber;\n"],"mappings":";;;;;;;;;AAYA,MAAM,cAAc,MACjB,EACC,KACA,WACA,YACA,QAAQ,cACR,OACA,SACA,QACA,OAAO,UACP,WAAW,MACX,eACA,UACA,aACA,GAAG,WACC;CACJ,MAAM,EAAE,eAAe,aAAa;CACpC,MAAM,gBAAgB,YAAY,aAAa,WAAW;CAE1D,OACE,qBAAC,YAAY,MAAb;EACE,iBAAiB;EACjB,WAAW,GAAG,aAAa;GAAE;GAAQ;GAAM,SAAS;EAAc,CAAC,GAAG,SAAS;EACxE;EACP,eAAe;EACf,GAAI;YALN,CAOE,oBAAC,YAAY,OAAb;GACE,WAAW,GAAG,OAAO,OAAO,OAAO,aAAa,YAAY,KAAK;GACpD;GACR;GACL,OAAO,cAAc;EACtB,CAAA,GACA,YACC,qBAAC,OAAD;GAAK,WAAW,OAAO;aAAvB,CACE,oBAAC,YAAY,WAAb;IAAuB,WAAW,OAAO;cACvC,oBAAC,MAAD;KAAM,MAAM;KAAW,MAAM;IAAK,CAAA;GACb,CAAA,GACvB,oBAAC,YAAY,WAAb;IAAuB,WAAW,OAAO;cACvC,oBAAC,MAAD;KAAM,MAAM;KAAa,MAAM;IAAK,CAAA;GACf,CAAA,CACpB;IAES;;AAEtB,CACF;AAEA,YAAY,cAAc"}
1
+ {"version":3,"file":"InputNumber.mjs","names":[],"sources":["../../../src/base-ui/Input/InputNumber.tsx"],"sourcesContent":["'use client';\n\nimport { NumberField } from '@base-ui/react/number-field';\nimport { cx, useThemeMode } from 'antd-style';\nimport { ChevronDown, ChevronUp } from 'lucide-react';\nimport { memo } from 'react';\n\nimport Icon from '@/Icon';\n\nimport { rootVariants, styles } from './style';\nimport type { InputNumberProps } from './type';\n\nconst InputNumber = memo<InputNumberProps>(\n ({\n ref,\n className,\n classNames,\n styles: customStyles,\n style,\n variant,\n shadow,\n size = 'middle',\n controls = true,\n changeOnWheel,\n onChange,\n placeholder,\n ...rest\n }) => {\n const { isDarkMode } = useThemeMode();\n const mergedVariant = variant || (isDarkMode ? 'filled' : 'outlined');\n\n return (\n <NumberField.Root\n allowWheelScrub={changeOnWheel}\n className={cx(rootVariants({ shadow, size, variant: mergedVariant }), className)}\n style={style}\n onValueChange={onChange}\n {...rest}\n >\n <NumberField.Input\n className={cx(styles.input, styles.numberInput, classNames?.input)}\n placeholder={placeholder}\n ref={ref}\n style={customStyles?.input}\n />\n {controls && (\n <div className={styles.numberControls}>\n <NumberField.Increment className={styles.numberControl}>\n <Icon icon={ChevronUp} size={12} />\n </NumberField.Increment>\n <NumberField.Decrement className={styles.numberControl}>\n <Icon icon={ChevronDown} size={12} />\n </NumberField.Decrement>\n </div>\n )}\n </NumberField.Root>\n );\n },\n);\n\nInputNumber.displayName = 'InputNumber';\n\nexport default InputNumber;\n"],"mappings":";;;;;;;;;AAYA,MAAM,cAAc,MACjB,EACC,KACA,WACA,YACA,QAAQ,cACR,OACA,SACA,QACA,OAAO,UACP,WAAW,MACX,eACA,UACA,aACA,GAAG,WACC;CACJ,MAAM,EAAE,eAAe,aAAa;CACpC,MAAM,gBAAgB,YAAY,aAAa,WAAW;CAE1D,OACE,qBAAC,YAAY,MAAb;EACE,iBAAiB;EACjB,WAAW,GAAG,aAAa;GAAE;GAAQ;GAAM,SAAS;EAAc,CAAC,GAAG,SAAS;EACxE;EACP,eAAe;EACf,GAAI;EALN,UAAA,CAOE,oBAAC,YAAY,OAAb;GACE,WAAW,GAAG,OAAO,OAAO,OAAO,aAAa,YAAY,KAAK;GACpD;GACR;GACL,OAAO,cAAc;EACtB,CAAA,GACA,YACC,qBAAC,OAAD;GAAK,WAAW,OAAO;GAAvB,UAAA,CACE,oBAAC,YAAY,WAAb;IAAuB,WAAW,OAAO;IACvC,UAAA,oBAAC,MAAD;KAAM,MAAM;KAAW,MAAM;IAAK,CAAA;GACb,CAAA,GACvB,oBAAC,YAAY,WAAb;IAAuB,WAAW,OAAO;IACvC,UAAA,oBAAC,MAAD;KAAM,MAAM;KAAa,MAAM;IAAK,CAAA;GACf,CAAA,CACpB;EAES,CAAA,CAAA;;AAEtB,CACF;AAEA,YAAY,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"InputOTP.mjs","names":[],"sources":["../../../src/base-ui/Input/InputOTP.tsx"],"sourcesContent":["'use client';\n\nimport { OTPField } from '@base-ui/react/otp-field';\nimport { cx, useThemeMode } from 'antd-style';\nimport { memo } from 'react';\n\nimport { rootVariants, styles } from './style';\nimport type { InputOTPProps } from './type';\n\nconst InputOTP = memo<InputOTPProps>(\n ({\n className,\n classNames,\n styles: customStyles,\n style,\n variant,\n shadow,\n size = 'middle',\n length = 6,\n onChange,\n ...rest\n }) => {\n const { isDarkMode } = useThemeMode();\n const mergedVariant = variant || (isDarkMode ? 'filled' : 'outlined');\n\n return (\n <OTPField.Root\n className={cx(styles.otpRoot, className)}\n length={length}\n style={style}\n onValueChange={onChange}\n {...rest}\n >\n {Array.from({ length }, (_, index) => (\n <OTPField.Input\n key={index}\n style={customStyles?.input}\n className={cx(\n rootVariants({ shadow, size, variant: mergedVariant }),\n styles.otpCell,\n classNames?.input,\n )}\n />\n ))}\n </OTPField.Root>\n );\n },\n);\n\nInputOTP.displayName = 'InputOTP';\n\nexport default InputOTP;\n"],"mappings":";;;;;;;AASA,MAAM,WAAW,MACd,EACC,WACA,YACA,QAAQ,cACR,OACA,SACA,QACA,OAAO,UACP,SAAS,GACT,UACA,GAAG,WACC;CACJ,MAAM,EAAE,eAAe,aAAa;CACpC,MAAM,gBAAgB,YAAY,aAAa,WAAW;CAE1D,OACE,oBAAC,SAAS,MAAV;EACE,WAAW,GAAG,OAAO,SAAS,SAAS;EAC/B;EACD;EACP,eAAe;EACf,GAAI;YAEH,MAAM,KAAK,EAAE,OAAO,IAAI,GAAG,UAC1B,oBAAC,SAAS,OAAV;GAEE,OAAO,cAAc;GACrB,WAAW,GACT,aAAa;IAAE;IAAQ;IAAM,SAAS;GAAc,CAAC,GACrD,OAAO,SACP,YAAY,KACd;EACD,GAPM,KAON,CACF;CACY,CAAA;AAEnB,CACF;AAEA,SAAS,cAAc"}
1
+ {"version":3,"file":"InputOTP.mjs","names":[],"sources":["../../../src/base-ui/Input/InputOTP.tsx"],"sourcesContent":["'use client';\n\nimport { OTPField } from '@base-ui/react/otp-field';\nimport { cx, useThemeMode } from 'antd-style';\nimport { memo } from 'react';\n\nimport { rootVariants, styles } from './style';\nimport type { InputOTPProps } from './type';\n\nconst InputOTP = memo<InputOTPProps>(\n ({\n className,\n classNames,\n styles: customStyles,\n style,\n variant,\n shadow,\n size = 'middle',\n length = 6,\n onChange,\n ...rest\n }) => {\n const { isDarkMode } = useThemeMode();\n const mergedVariant = variant || (isDarkMode ? 'filled' : 'outlined');\n\n return (\n <OTPField.Root\n className={cx(styles.otpRoot, className)}\n length={length}\n style={style}\n onValueChange={onChange}\n {...rest}\n >\n {Array.from({ length }, (_, index) => (\n <OTPField.Input\n key={index}\n style={customStyles?.input}\n className={cx(\n rootVariants({ shadow, size, variant: mergedVariant }),\n styles.otpCell,\n classNames?.input,\n )}\n />\n ))}\n </OTPField.Root>\n );\n },\n);\n\nInputOTP.displayName = 'InputOTP';\n\nexport default InputOTP;\n"],"mappings":";;;;;;;AASA,MAAM,WAAW,MACd,EACC,WACA,YACA,QAAQ,cACR,OACA,SACA,QACA,OAAO,UACP,SAAS,GACT,UACA,GAAG,WACC;CACJ,MAAM,EAAE,eAAe,aAAa;CACpC,MAAM,gBAAgB,YAAY,aAAa,WAAW;CAE1D,OACE,oBAAC,SAAS,MAAV;EACE,WAAW,GAAG,OAAO,SAAS,SAAS;EAC/B;EACD;EACP,eAAe;EACf,GAAI;EAEH,UAAA,MAAM,KAAK,EAAE,OAAO,IAAI,GAAG,UAC1B,oBAAC,SAAS,OAAV;GAEE,OAAO,cAAc;GACrB,WAAW,GACT,aAAa;IAAE;IAAQ;IAAM,SAAS;GAAc,CAAC,GACrD,OAAO,SACP,YAAY,KACd;EACD,GAPM,KAON,CACF;CACY,CAAA;AAEnB,CACF;AAEA,SAAS,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"InputPassword.mjs","names":[],"sources":["../../../src/base-ui/Input/InputPassword.tsx"],"sourcesContent":["'use client';\n\nimport { Eye, EyeOff } from 'lucide-react';\nimport { memo, useState } from 'react';\n\nimport Icon from '@/Icon';\n\nimport Input from './Input';\nimport { styles } from './style';\nimport type { InputPasswordProps } from './type';\n\nconst InputPassword = memo<InputPasswordProps>(({ visibilityToggle = true, suffix, ...rest }) => {\n const [visible, setVisible] = useState(false);\n\n return (\n <Input\n type={visible ? 'text' : 'password'}\n suffix={\n <>\n {suffix}\n {visibilityToggle && (\n <button\n aria-label={visible ? 'Hide password' : 'Show password'}\n className={styles.passwordToggle}\n tabIndex={-1}\n type={'button'}\n onClick={() => setVisible((v) => !v)}\n >\n <Icon icon={visible ? Eye : EyeOff} size={16} />\n </button>\n )}\n </>\n }\n {...rest}\n />\n );\n});\n\nInputPassword.displayName = 'InputPassword';\n\nexport default InputPassword;\n"],"mappings":";;;;;;;;AAWA,MAAM,gBAAgB,MAA0B,EAAE,mBAAmB,MAAM,QAAQ,GAAG,WAAW;CAC/F,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAE5C,OACE,oBAAC,OAAD;EACE,MAAM,UAAU,SAAS;EACzB,QACE,qBAAA,YAAA,EAAA,UAAA,CACG,QACA,oBACC,oBAAC,UAAD;GACE,cAAY,UAAU,kBAAkB;GACxC,WAAW,OAAO;GAClB,UAAU;GACV,MAAM;GACN,eAAe,YAAY,MAAM,CAAC,CAAC;aAEnC,oBAAC,MAAD;IAAM,MAAM,UAAU,MAAM;IAAQ,MAAM;GAAK,CAAA;EACzC,CAAA,CAEV,EAAA,CAAA;EAEJ,GAAI;CACL,CAAA;AAEL,CAAC;AAED,cAAc,cAAc"}
1
+ {"version":3,"file":"InputPassword.mjs","names":[],"sources":["../../../src/base-ui/Input/InputPassword.tsx"],"sourcesContent":["'use client';\n\nimport { Eye, EyeOff } from 'lucide-react';\nimport { memo, useState } from 'react';\n\nimport Icon from '@/Icon';\n\nimport Input from './Input';\nimport { styles } from './style';\nimport type { InputPasswordProps } from './type';\n\nconst InputPassword = memo<InputPasswordProps>(({ visibilityToggle = true, suffix, ...rest }) => {\n const [visible, setVisible] = useState(false);\n\n return (\n <Input\n type={visible ? 'text' : 'password'}\n suffix={\n <>\n {suffix}\n {visibilityToggle && (\n <button\n aria-label={visible ? 'Hide password' : 'Show password'}\n className={styles.passwordToggle}\n tabIndex={-1}\n type={'button'}\n onClick={() => setVisible((v) => !v)}\n >\n <Icon icon={visible ? Eye : EyeOff} size={16} />\n </button>\n )}\n </>\n }\n {...rest}\n />\n );\n});\n\nInputPassword.displayName = 'InputPassword';\n\nexport default InputPassword;\n"],"mappings":";;;;;;;;AAWA,MAAM,gBAAgB,MAA0B,EAAE,mBAAmB,MAAM,QAAQ,GAAG,WAAW;CAC/F,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAE5C,OACE,oBAAC,OAAD;EACE,MAAM,UAAU,SAAS;EACzB,QACE,qBAAA,YAAA,EAAA,UAAA,CACG,QACA,oBACC,oBAAC,UAAD;GACE,cAAY,UAAU,kBAAkB;GACxC,WAAW,OAAO;GAClB,UAAU;GACV,MAAM;GACN,eAAe,YAAY,MAAM,CAAC,CAAC;GAEnC,UAAA,oBAAC,MAAD;IAAM,MAAM,UAAU,MAAM;IAAQ,MAAM;GAAK,CAAA;EACzC,CAAA,CAEV,EAAA,CAAA;EAEJ,GAAI;CACL,CAAA;AAEL,CAAC;AAED,cAAc,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"TextArea.mjs","names":[],"sources":["../../../src/base-ui/Input/TextArea.tsx"],"sourcesContent":["'use client';\n\nimport { Field } from '@base-ui/react/field';\nimport { cx, useThemeMode } from 'antd-style';\nimport { type CSSProperties, memo, useMemo } from 'react';\n\nimport { rootVariants, styles } from './style';\nimport type { TextAreaProps } from './type';\n\nconst TextArea = memo<TextAreaProps>(\n ({\n ref,\n className,\n classNames,\n styles: customStyles,\n style,\n variant,\n shadow,\n autoSize,\n resize = false,\n disabled,\n ...rest\n }) => {\n const { isDarkMode } = useThemeMode();\n const mergedVariant = variant || (isDarkMode ? 'filled' : 'outlined');\n\n const cssVariables = useMemo<CSSProperties>(() => {\n if (typeof autoSize !== 'object') return {};\n return {\n '--textarea-max-height': autoSize.maxRows ? `calc(1.5em * ${autoSize.maxRows})` : undefined,\n '--textarea-min-rows': autoSize.minRows,\n } as CSSProperties;\n }, [autoSize]);\n\n return (\n <div\n data-disabled={disabled ? '' : undefined}\n style={{ ...cssVariables, ...style }}\n className={cx(\n rootVariants({ shadow, variant: mergedVariant }),\n styles.textarea,\n autoSize && styles.textareaAutoSize,\n resize && styles.textareaResize,\n className,\n )}\n >\n <Field.Control\n className={cx(styles.input, classNames?.input)}\n disabled={disabled}\n render={<textarea ref={ref} {...rest} />}\n style={customStyles?.input}\n />\n </div>\n );\n },\n);\n\nTextArea.displayName = 'TextArea';\n\nexport default TextArea;\n"],"mappings":";;;;;;;AASA,MAAM,WAAW,MACd,EACC,KACA,WACA,YACA,QAAQ,cACR,OACA,SACA,QACA,UACA,SAAS,OACT,UACA,GAAG,WACC;CACJ,MAAM,EAAE,eAAe,aAAa;CACpC,MAAM,gBAAgB,YAAY,aAAa,WAAW;CAE1D,MAAM,eAAe,cAA6B;EAChD,IAAI,OAAO,aAAa,UAAU,OAAO,CAAC;EAC1C,OAAO;GACL,yBAAyB,SAAS,UAAU,gBAAgB,SAAS,QAAQ,KAAK,KAAA;GAClF,uBAAuB,SAAS;EAClC;CACF,GAAG,CAAC,QAAQ,CAAC;CAEb,OACE,oBAAC,OAAD;EACE,iBAAe,WAAW,KAAK,KAAA;EAC/B,OAAO;GAAE,GAAG;GAAc,GAAG;EAAM;EACnC,WAAW,GACT,aAAa;GAAE;GAAQ,SAAS;EAAc,CAAC,GAC/C,OAAO,UACP,YAAY,OAAO,kBACnB,UAAU,OAAO,gBACjB,SACF;YAEA,oBAAC,MAAM,SAAP;GACE,WAAW,GAAG,OAAO,OAAO,YAAY,KAAK;GACnC;GACV,QAAQ,oBAAC,YAAD;IAAe;IAAK,GAAI;GAAO,CAAA;GACvC,OAAO,cAAc;EACtB,CAAA;CACE,CAAA;AAET,CACF;AAEA,SAAS,cAAc"}
1
+ {"version":3,"file":"TextArea.mjs","names":[],"sources":["../../../src/base-ui/Input/TextArea.tsx"],"sourcesContent":["'use client';\n\nimport { Field } from '@base-ui/react/field';\nimport { cx, useThemeMode } from 'antd-style';\nimport { type CSSProperties, memo, useMemo } from 'react';\n\nimport { rootVariants, styles } from './style';\nimport type { TextAreaProps } from './type';\n\nconst TextArea = memo<TextAreaProps>(\n ({\n ref,\n className,\n classNames,\n styles: customStyles,\n style,\n variant,\n shadow,\n autoSize,\n resize = false,\n disabled,\n ...rest\n }) => {\n const { isDarkMode } = useThemeMode();\n const mergedVariant = variant || (isDarkMode ? 'filled' : 'outlined');\n\n const cssVariables = useMemo<CSSProperties>(() => {\n if (typeof autoSize !== 'object') return {};\n return {\n '--textarea-max-height': autoSize.maxRows ? `calc(1.5em * ${autoSize.maxRows})` : undefined,\n '--textarea-min-rows': autoSize.minRows,\n } as CSSProperties;\n }, [autoSize]);\n\n return (\n <div\n data-disabled={disabled ? '' : undefined}\n style={{ ...cssVariables, ...style }}\n className={cx(\n rootVariants({ shadow, variant: mergedVariant }),\n styles.textarea,\n autoSize && styles.textareaAutoSize,\n resize && styles.textareaResize,\n className,\n )}\n >\n <Field.Control\n className={cx(styles.input, classNames?.input)}\n disabled={disabled}\n render={<textarea ref={ref} {...rest} />}\n style={customStyles?.input}\n />\n </div>\n );\n },\n);\n\nTextArea.displayName = 'TextArea';\n\nexport default TextArea;\n"],"mappings":";;;;;;;AASA,MAAM,WAAW,MACd,EACC,KACA,WACA,YACA,QAAQ,cACR,OACA,SACA,QACA,UACA,SAAS,OACT,UACA,GAAG,WACC;CACJ,MAAM,EAAE,eAAe,aAAa;CACpC,MAAM,gBAAgB,YAAY,aAAa,WAAW;CAE1D,MAAM,eAAe,cAA6B;EAChD,IAAI,OAAO,aAAa,UAAU,OAAO,CAAC;EAC1C,OAAO;GACL,yBAAyB,SAAS,UAAU,gBAAgB,SAAS,QAAQ,KAAK,KAAA;GAClF,uBAAuB,SAAS;EAClC;CACF,GAAG,CAAC,QAAQ,CAAC;CAEb,OACE,oBAAC,OAAD;EACE,iBAAe,WAAW,KAAK,KAAA;EAC/B,OAAO;GAAE,GAAG;GAAc,GAAG;EAAM;EACnC,WAAW,GACT,aAAa;GAAE;GAAQ,SAAS;EAAc,CAAC,GAC/C,OAAO,UACP,YAAY,OAAO,kBACnB,UAAU,OAAO,gBACjB,SACF;EAEA,UAAA,oBAAC,MAAM,SAAP;GACE,WAAW,GAAG,OAAO,OAAO,YAAY,KAAK;GACnC;GACV,QAAQ,oBAAC,YAAD;IAAe;IAAK,GAAI;GAAO,CAAA;GACvC,OAAO,cAAc;EACtB,CAAA;CACE,CAAA;AAET,CACF;AAEA,SAAS,cAAc"}
@@ -24,7 +24,7 @@ declare const styles: {
24
24
  declare const rootVariants: (props?: ({
25
25
  shadow?: boolean | null | undefined;
26
26
  size?: "large" | "middle" | "small" | null | undefined;
27
- variant?: "filled" | "outlined" | "borderless" | null | undefined;
27
+ variant?: "outlined" | "borderless" | "filled" | null | undefined;
28
28
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
29
29
  //#endregion
30
30
  export { rootVariants, styles };