@lobehub/ui 5.51.2 → 5.52.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 (322) hide show
  1. package/es/Accordion/Accordion.mjs +1 -1
  2. package/es/Accordion/Accordion.mjs.map +1 -1
  3. package/es/ActionIconGroup/type.d.mts +2 -1
  4. package/es/Alert/Alert.mjs +1 -1
  5. package/es/AutoComplete/Select.mjs +1 -1
  6. package/es/Avatar/Avatar.mjs +2 -2
  7. package/es/Burger/Burger.mjs +2 -2
  8. package/es/Burger/Burger.mjs.map +1 -1
  9. package/es/Button/Button.mjs +1 -1
  10. package/es/CodeDiff/DiffPanel.mjs +1 -1
  11. package/es/CodeDiff/DiffPanel.mjs.map +1 -1
  12. package/es/Collapse/Collapse.mjs +1 -1
  13. package/es/ColorSwatches/ColorSwatches.mjs +21 -21
  14. package/es/ColorSwatches/ColorSwatches.mjs.map +1 -1
  15. package/es/ColorSwatches/style.mjs +3 -12
  16. package/es/ColorSwatches/style.mjs.map +1 -1
  17. package/es/DatePicker/DatePicker.mjs +1 -1
  18. package/es/DraggablePanel/DraggablePanel.mjs +1 -1
  19. package/es/Drawer/Drawer.mjs +1 -1
  20. package/es/EditableText/ControlInput.d.mts +2 -2
  21. package/es/EditableText/ControlInput.mjs +1 -1
  22. package/es/EditableText/ControlInput.mjs.map +1 -1
  23. package/es/EditableText/EditableText.mjs +1 -0
  24. package/es/EditableText/EditableText.mjs.map +1 -1
  25. package/es/EditableText/type.d.mts +5 -1
  26. package/es/EmojiPicker/AvatarUploader.mjs +76 -71
  27. package/es/EmojiPicker/AvatarUploader.mjs.map +1 -1
  28. package/es/EmojiPicker/EmojiPicker.mjs +12 -6
  29. package/es/EmojiPicker/EmojiPicker.mjs.map +1 -1
  30. package/es/EmojiPicker/style.mjs +32 -9
  31. package/es/EmojiPicker/style.mjs.map +1 -1
  32. package/es/EmojiPicker/type.d.mts +2 -1
  33. package/es/Form/Form.mjs +1 -1
  34. package/es/Form/components/FormDivider.mjs +1 -1
  35. package/es/Form/components/FormItem.mjs +1 -1
  36. package/es/Form/components/FormSubmitFooter.mjs +1 -1
  37. package/es/Form/components/FormTitle.mjs +1 -1
  38. package/es/GroupAvatar/GroupAvatar.mjs +1 -1
  39. package/es/GroupAvatar/GroupAvatar.mjs.map +1 -1
  40. package/es/GroupAvatar/type.d.mts +2 -1
  41. package/es/Highlighter/Highlighter.mjs +1 -1
  42. package/es/Highlighter/Highlighter.mjs.map +1 -1
  43. package/es/Highlighter/LangSelect.mjs +23 -13
  44. package/es/Highlighter/LangSelect.mjs.map +1 -1
  45. package/es/Highlighter/style.mjs +1 -1
  46. package/es/Highlighter/style.mjs.map +1 -1
  47. package/es/HtmlPreview/HtmlPreview.mjs +28 -1
  48. package/es/HtmlPreview/HtmlPreview.mjs.map +1 -1
  49. package/es/Image/viewer/ImageViewer.mjs +1 -1
  50. package/es/Image/viewer/ImageViewer.mjs.map +1 -1
  51. package/es/Image/viewer/Toolbar.mjs +1 -1
  52. package/es/Input/Input.mjs +1 -1
  53. package/es/Input/InputNumber.mjs +1 -1
  54. package/es/Input/InputOPT.mjs +1 -1
  55. package/es/Input/InputPassword.mjs +1 -1
  56. package/es/Input/TextArea.mjs +1 -1
  57. package/es/Menu/Menu.mjs +1 -1
  58. package/es/Menu/index.d.mts +2 -1
  59. package/es/Menu/index.mjs +1 -1
  60. package/es/Menu/itemInterface.d.mts +71 -0
  61. package/es/Menu/type.d.mts +8 -8
  62. package/es/Mermaid/Mermaid.mjs +1 -1
  63. package/es/Mermaid/Mermaid.mjs.map +1 -1
  64. package/es/Modal/Modal.mjs +1 -1
  65. package/es/SearchBar/SearchBar.mjs +1 -1
  66. package/es/SearchBar/SearchBar.mjs.map +1 -1
  67. package/es/SearchBar/type.d.mts +2 -2
  68. package/es/Segmented/Segmented.mjs +1 -1
  69. package/es/Select/Select.mjs +1 -1
  70. package/es/SliderWithInput/SliderWithInput.mjs +1 -1
  71. package/es/Tabs/Tabs.mjs +1 -1
  72. package/es/Tag/Tag.mjs +1 -1
  73. package/es/ThemeProvider/ConfigProvider.mjs +1 -1
  74. package/es/ThemeProvider/ThemeProvider.mjs +1 -1
  75. package/es/ThemeSwitch/ThemeSwitch.mjs +1 -1
  76. package/es/Toc/Toc.mjs +1 -1
  77. package/es/Toc/TocMobile.mjs +1 -1
  78. package/es/awesome/AgentSkillCard/AgentSkillCard.mjs +1 -1
  79. package/es/awesome/Hero/Hero.mjs +1 -1
  80. package/es/awesome/LandingSection/LandingSection.mjs +1 -1
  81. package/es/base-ui/Anchor/Anchor.d.mts +6 -0
  82. package/es/base-ui/Anchor/Anchor.mjs +141 -0
  83. package/es/base-ui/Anchor/Anchor.mjs.map +1 -0
  84. package/es/base-ui/Anchor/index.d.mts +3 -0
  85. package/es/base-ui/Anchor/style.mjs +80 -0
  86. package/es/base-ui/Anchor/style.mjs.map +1 -0
  87. package/es/base-ui/Anchor/type.d.mts +20 -0
  88. package/es/base-ui/AutoComplete/AutoComplete.mjs.map +1 -1
  89. package/es/base-ui/Avatar/Avatar.mjs +1 -1
  90. package/es/base-ui/Breadcrumb/Breadcrumb.d.mts +6 -0
  91. package/es/base-ui/Breadcrumb/Breadcrumb.mjs +58 -0
  92. package/es/base-ui/Breadcrumb/Breadcrumb.mjs.map +1 -0
  93. package/es/base-ui/Breadcrumb/index.d.mts +3 -0
  94. package/es/base-ui/Breadcrumb/style.mjs +65 -0
  95. package/es/base-ui/Breadcrumb/style.mjs.map +1 -0
  96. package/es/base-ui/Breadcrumb/type.d.mts +24 -0
  97. package/es/base-ui/Burger/Burger.d.mts +6 -0
  98. package/es/base-ui/Burger/Burger.mjs +69 -0
  99. package/es/base-ui/Burger/Burger.mjs.map +1 -0
  100. package/es/base-ui/Burger/index.d.mts +3 -0
  101. package/es/base-ui/Burger/style.mjs +63 -0
  102. package/es/base-ui/Burger/style.mjs.map +1 -0
  103. package/es/base-ui/Burger/type.d.mts +23 -0
  104. package/es/base-ui/Carousel/Carousel.d.mts +6 -0
  105. package/es/base-ui/Carousel/Carousel.mjs +157 -0
  106. package/es/base-ui/Carousel/Carousel.mjs.map +1 -0
  107. package/es/base-ui/Carousel/index.d.mts +3 -0
  108. package/es/base-ui/Carousel/style.mjs +88 -0
  109. package/es/base-ui/Carousel/style.mjs.map +1 -0
  110. package/es/base-ui/Carousel/type.d.mts +23 -0
  111. package/es/base-ui/ColorPicker/ColorPicker.d.mts +6 -0
  112. package/es/base-ui/ColorPicker/ColorPicker.mjs +227 -0
  113. package/es/base-ui/ColorPicker/ColorPicker.mjs.map +1 -0
  114. package/es/base-ui/ColorPicker/SaturationArea.mjs +64 -0
  115. package/es/base-ui/ColorPicker/SaturationArea.mjs.map +1 -0
  116. package/es/base-ui/ColorPicker/color.mjs +28 -0
  117. package/es/base-ui/ColorPicker/color.mjs.map +1 -0
  118. package/es/base-ui/ColorPicker/index.d.mts +3 -0
  119. package/es/base-ui/ColorPicker/style.mjs +180 -0
  120. package/es/base-ui/ColorPicker/style.mjs.map +1 -0
  121. package/es/base-ui/ColorPicker/type.d.mts +20 -0
  122. package/es/base-ui/ContextMenu/ContextMenuHost.mjs.map +1 -1
  123. package/es/base-ui/ContextMenu/renderItems.d.mts +0 -1
  124. package/es/base-ui/ContextMenu/renderItems.mjs.map +1 -1
  125. package/es/base-ui/DatePicker/CalendarPanel.mjs +188 -0
  126. package/es/base-ui/DatePicker/CalendarPanel.mjs.map +1 -0
  127. package/es/base-ui/DatePicker/DatePicker.d.mts +6 -0
  128. package/es/base-ui/DatePicker/DatePicker.mjs +88 -0
  129. package/es/base-ui/DatePicker/DatePicker.mjs.map +1 -0
  130. package/es/base-ui/DatePicker/DateRangePicker.d.mts +6 -0
  131. package/es/base-ui/DatePicker/DateRangePicker.mjs +128 -0
  132. package/es/base-ui/DatePicker/DateRangePicker.mjs.map +1 -0
  133. package/es/base-ui/DatePicker/PickerShell.mjs +43 -0
  134. package/es/base-ui/DatePicker/PickerShell.mjs.map +1 -0
  135. package/es/base-ui/DatePicker/calendar.d.mts +5 -0
  136. package/es/base-ui/DatePicker/calendar.mjs +46 -0
  137. package/es/base-ui/DatePicker/calendar.mjs.map +1 -0
  138. package/es/base-ui/DatePicker/index.d.mts +5 -0
  139. package/es/base-ui/DatePicker/style.mjs +193 -0
  140. package/es/base-ui/DatePicker/style.mjs.map +1 -0
  141. package/es/base-ui/DatePicker/type.d.mts +35 -0
  142. package/es/base-ui/Descriptions/Descriptions.d.mts +6 -0
  143. package/es/base-ui/Descriptions/Descriptions.mjs +62 -0
  144. package/es/base-ui/Descriptions/Descriptions.mjs.map +1 -0
  145. package/es/base-ui/Descriptions/index.d.mts +3 -0
  146. package/es/base-ui/Descriptions/style.mjs +64 -0
  147. package/es/base-ui/Descriptions/style.mjs.map +1 -0
  148. package/es/base-ui/Descriptions/type.d.mts +28 -0
  149. package/es/base-ui/Divider/Divider.d.mts +6 -0
  150. package/es/base-ui/Divider/Divider.mjs +30 -0
  151. package/es/base-ui/Divider/Divider.mjs.map +1 -0
  152. package/es/base-ui/Divider/index.d.mts +3 -0
  153. package/es/base-ui/Divider/style.mjs +59 -0
  154. package/es/base-ui/Divider/style.mjs.map +1 -0
  155. package/es/base-ui/Divider/type.d.mts +12 -0
  156. package/es/base-ui/Drawer/atoms.mjs.map +1 -1
  157. package/es/base-ui/DropdownMenu/atoms.mjs +1 -1
  158. package/es/base-ui/DropdownMenu/atoms.mjs.map +1 -1
  159. package/es/base-ui/DropdownMenu/renderItems.d.mts +0 -1
  160. package/es/base-ui/DropdownMenu/renderItems.mjs.map +1 -1
  161. package/es/base-ui/Form/components/FormTitle.mjs +1 -1
  162. package/es/base-ui/Form/components/FormTitle.mjs.map +1 -1
  163. package/es/base-ui/Form/type.d.mts +2 -2
  164. package/es/base-ui/Input/ClearButton.mjs +32 -0
  165. package/es/base-ui/Input/ClearButton.mjs.map +1 -0
  166. package/es/base-ui/Input/Input.mjs +30 -4
  167. package/es/base-ui/Input/Input.mjs.map +1 -1
  168. package/es/base-ui/Input/InputNumber.mjs +43 -22
  169. package/es/base-ui/Input/InputNumber.mjs.map +1 -1
  170. package/es/base-ui/Input/TextArea.mjs +50 -13
  171. package/es/base-ui/Input/TextArea.mjs.map +1 -1
  172. package/es/base-ui/Input/clearNativeValue.mjs +12 -0
  173. package/es/base-ui/Input/clearNativeValue.mjs.map +1 -0
  174. package/es/base-ui/Input/pressEnter.mjs +6 -0
  175. package/es/base-ui/Input/pressEnter.mjs.map +1 -0
  176. package/es/base-ui/Input/style.d.mts +5 -1
  177. package/es/base-ui/Input/style.mjs +67 -4
  178. package/es/base-ui/Input/style.mjs.map +1 -1
  179. package/es/base-ui/Input/type.d.mts +13 -2
  180. package/es/base-ui/List/List.d.mts +6 -0
  181. package/es/base-ui/List/List.mjs +50 -0
  182. package/es/base-ui/List/List.mjs.map +1 -0
  183. package/es/base-ui/List/ListRow.mjs +74 -0
  184. package/es/base-ui/List/ListRow.mjs.map +1 -0
  185. package/es/base-ui/List/index.d.mts +3 -0
  186. package/es/base-ui/List/style.mjs +146 -0
  187. package/es/base-ui/List/style.mjs.map +1 -0
  188. package/es/base-ui/List/type.d.mts +48 -0
  189. package/es/base-ui/Modal/atoms.mjs.map +1 -1
  190. package/es/base-ui/Modal/imperative.mjs +1 -1
  191. package/es/base-ui/Modal/imperative.mjs.map +1 -1
  192. package/es/base-ui/Modal/type.d.mts +1 -0
  193. package/es/base-ui/Popover/PopoverPortal.mjs.map +1 -1
  194. package/es/base-ui/Progress/Progress.mjs +16 -14
  195. package/es/base-ui/Progress/Progress.mjs.map +1 -1
  196. package/es/base-ui/Progress/style.mjs +16 -25
  197. package/es/base-ui/Progress/style.mjs.map +1 -1
  198. package/es/base-ui/QRCode/QRCode.d.mts +6 -0
  199. package/es/base-ui/QRCode/QRCode.mjs +105 -0
  200. package/es/base-ui/QRCode/QRCode.mjs.map +1 -0
  201. package/es/base-ui/QRCode/index.d.mts +3 -0
  202. package/es/base-ui/QRCode/qrPath.mjs +16 -0
  203. package/es/base-ui/QRCode/qrPath.mjs.map +1 -0
  204. package/es/base-ui/QRCode/style.mjs +52 -0
  205. package/es/base-ui/QRCode/style.mjs.map +1 -0
  206. package/es/base-ui/QRCode/type.d.mts +19 -0
  207. package/es/base-ui/Rate/Rate.d.mts +6 -0
  208. package/es/base-ui/Rate/Rate.mjs +111 -0
  209. package/es/base-ui/Rate/Rate.mjs.map +1 -0
  210. package/es/base-ui/Rate/index.d.mts +3 -0
  211. package/es/base-ui/Rate/style.mjs +81 -0
  212. package/es/base-ui/Rate/style.mjs.map +1 -0
  213. package/es/base-ui/Rate/type.d.mts +19 -0
  214. package/es/base-ui/Select/atoms.mjs.map +1 -1
  215. package/es/base-ui/Select/hooks.mjs.map +1 -1
  216. package/es/base-ui/Statistic/Statistic.d.mts +6 -0
  217. package/es/base-ui/Statistic/Statistic.mjs +42 -0
  218. package/es/base-ui/Statistic/Statistic.mjs.map +1 -0
  219. package/es/base-ui/Statistic/formatValue.d.mts +5 -0
  220. package/es/base-ui/Statistic/formatValue.mjs +23 -0
  221. package/es/base-ui/Statistic/formatValue.mjs.map +1 -0
  222. package/es/base-ui/Statistic/index.d.mts +4 -0
  223. package/es/base-ui/Statistic/style.mjs +34 -0
  224. package/es/base-ui/Statistic/style.mjs.map +1 -0
  225. package/es/base-ui/Statistic/type.d.mts +23 -0
  226. package/es/base-ui/Steps/Steps.d.mts +6 -0
  227. package/es/base-ui/Steps/Steps.mjs +74 -0
  228. package/es/base-ui/Steps/Steps.mjs.map +1 -0
  229. package/es/base-ui/Steps/index.d.mts +3 -0
  230. package/es/base-ui/Steps/style.mjs +155 -0
  231. package/es/base-ui/Steps/style.mjs.map +1 -0
  232. package/es/base-ui/Steps/type.d.mts +32 -0
  233. package/es/base-ui/Table/FilterMenu.mjs +45 -0
  234. package/es/base-ui/Table/FilterMenu.mjs.map +1 -0
  235. package/es/base-ui/Table/Table.d.mts +10 -0
  236. package/es/base-ui/Table/Table.mjs +134 -0
  237. package/es/base-ui/Table/Table.mjs.map +1 -0
  238. package/es/base-ui/Table/TableBody.mjs +59 -0
  239. package/es/base-ui/Table/TableBody.mjs.map +1 -0
  240. package/es/base-ui/Table/TableHead.mjs +50 -0
  241. package/es/base-ui/Table/TableHead.mjs.map +1 -0
  242. package/es/base-ui/Table/features.mjs +12 -0
  243. package/es/base-ui/Table/features.mjs.map +1 -0
  244. package/es/base-ui/Table/fixedOffsets.mjs +29 -0
  245. package/es/base-ui/Table/fixedOffsets.mjs.map +1 -0
  246. package/es/base-ui/Table/index.d.mts +3 -0
  247. package/es/base-ui/Table/style.mjs +168 -0
  248. package/es/base-ui/Table/style.mjs.map +1 -0
  249. package/es/base-ui/Table/toColumnDefs.mjs +26 -0
  250. package/es/base-ui/Table/toColumnDefs.mjs.map +1 -0
  251. package/es/base-ui/Table/type.d.mts +68 -0
  252. package/es/base-ui/Table/useTableState.mjs +99 -0
  253. package/es/base-ui/Table/useTableState.mjs.map +1 -0
  254. package/es/base-ui/Toast/imperative.mjs.map +1 -1
  255. package/es/base-ui/Tooltip/TooltipGroup.mjs.map +1 -1
  256. package/es/base-ui/Tooltip/TooltipStandalone.mjs.map +1 -1
  257. package/es/base-ui/index.d.mts +66 -21
  258. package/es/base-ui/index.mjs +42 -26
  259. package/es/base-ui/panelStyles.mjs +95 -0
  260. package/es/base-ui/panelStyles.mjs.map +1 -0
  261. package/es/chat/ChatList/components/HistoryDivider.mjs +9 -6
  262. package/es/chat/ChatList/components/HistoryDivider.mjs.map +1 -1
  263. package/es/chat/MessageModal/MessageModal.mjs +1 -1
  264. package/es/chat/TokenTag/TokenTag.mjs +1 -1
  265. package/es/color/CssVar/VarRow.mjs +1 -1
  266. package/es/color/CssVar/index.mjs +1 -1
  267. package/es/dashboard/FilterSidebar/FilterSidebar.mjs +1 -1
  268. package/es/i18n/resources/en/burger.d.mts +8 -0
  269. package/es/i18n/resources/en/burger.mjs +9 -0
  270. package/es/i18n/resources/en/burger.mjs.map +1 -0
  271. package/es/i18n/resources/en/colorPicker.d.mts +12 -0
  272. package/es/i18n/resources/en/colorPicker.mjs +13 -0
  273. package/es/i18n/resources/en/colorPicker.mjs.map +1 -0
  274. package/es/i18n/resources/en/common.d.mts +1 -0
  275. package/es/i18n/resources/en/common.mjs +1 -0
  276. package/es/i18n/resources/en/common.mjs.map +1 -1
  277. package/es/i18n/resources/en/datePicker.d.mts +13 -0
  278. package/es/i18n/resources/en/datePicker.mjs +14 -0
  279. package/es/i18n/resources/en/datePicker.mjs.map +1 -0
  280. package/es/i18n/resources/en/index.d.mts +15 -11
  281. package/es/i18n/resources/en/index.mjs +9 -1
  282. package/es/i18n/resources/en/index.mjs.map +1 -1
  283. package/es/i18n/resources/en/qrCode.d.mts +9 -0
  284. package/es/i18n/resources/en/qrCode.mjs +10 -0
  285. package/es/i18n/resources/en/qrCode.mjs.map +1 -0
  286. package/es/i18n/resources/zhCn/burger.d.mts +8 -0
  287. package/es/i18n/resources/zhCn/burger.mjs +9 -0
  288. package/es/i18n/resources/zhCn/burger.mjs.map +1 -0
  289. package/es/i18n/resources/zhCn/colorPicker.d.mts +12 -0
  290. package/es/i18n/resources/zhCn/colorPicker.mjs +13 -0
  291. package/es/i18n/resources/zhCn/colorPicker.mjs.map +1 -0
  292. package/es/i18n/resources/zhCn/common.d.mts +1 -0
  293. package/es/i18n/resources/zhCn/common.mjs +1 -0
  294. package/es/i18n/resources/zhCn/common.mjs.map +1 -1
  295. package/es/i18n/resources/zhCn/datePicker.d.mts +13 -0
  296. package/es/i18n/resources/zhCn/datePicker.mjs +14 -0
  297. package/es/i18n/resources/zhCn/datePicker.mjs.map +1 -0
  298. package/es/i18n/resources/zhCn/index.d.mts +15 -11
  299. package/es/i18n/resources/zhCn/index.mjs +9 -1
  300. package/es/i18n/resources/zhCn/index.mjs.map +1 -1
  301. package/es/i18n/resources/zhCn/qrCode.d.mts +9 -0
  302. package/es/i18n/resources/zhCn/qrCode.mjs +10 -0
  303. package/es/i18n/resources/zhCn/qrCode.mjs.map +1 -0
  304. package/es/i18n/types.d.mts +14 -10
  305. package/es/index.d.mts +12 -11
  306. package/es/index.mjs +23 -23
  307. package/es/mdx/Cards/Card.d.mts +2 -2
  308. package/es/mdx/Cards/Card.mjs +1 -1
  309. package/es/mdx/Cards/Card.mjs.map +1 -1
  310. package/es/mdx/Mdx/index.mjs +1 -1
  311. package/es/mdx/Mdx/index.mjs.map +1 -1
  312. package/es/mdx/Tabs/index.d.mts +2 -2
  313. package/es/mdx/Tabs/index.mjs +7 -2
  314. package/es/mdx/Tabs/index.mjs.map +1 -1
  315. package/es/mdx/Tabs/style.mjs +33 -1
  316. package/es/mdx/Tabs/style.mjs.map +1 -1
  317. package/es/mdx/mdxComponents/Citation/PopoverPanel.mjs +1 -1
  318. package/es/mdx/mdxComponents/Citation/PopoverPanel.mjs.map +1 -1
  319. package/es/static-css/baseline.mjs +1 -4
  320. package/es/static-css/baseline.mjs.map +1 -1
  321. package/es/static-css/buildAntdStaticCss.mjs +1 -1
  322. package/package.json +3 -1
@@ -1 +1 @@
1
- {"version":3,"file":"atoms.mjs","names":[],"sources":["../../../src/base-ui/Drawer/atoms.tsx"],"sourcesContent":["'use client';\n\nimport { Dialog } from '@base-ui/react/dialog';\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport { cx } from 'antd-style';\nimport { X } from 'lucide-react';\nimport { AnimatePresence } from 'motion/react';\nimport type React from 'react';\nimport {\n cloneElement,\n createContext,\n isValidElement,\n use,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { mergeRefs, useMergeRefs } from 'react-merge-refs';\n\nimport { useNativeButton } from '@/hooks/useNativeButton';\nimport { useMotionComponent } from '@/MotionProvider';\nimport { useAppElement } from '@/ThemeProvider';\n\nimport { useLayerZIndex } from '../zIndex';\nimport { drawerBackdropTransition, getDrawerMotionConfig, pushAxis } from './constants';\nimport { DrawerLayerProvider, useDrawerLayer } from './DrawerLayerContext';\nimport { styles } from './style';\nimport type { DrawerPlacement } from './type';\n\nconst mergeStateClassName = <TState,>(\n base: string,\n className: string | ((state: TState) => string | undefined) | undefined,\n) => {\n if (typeof className === 'function') return (state: TState) => cx(base, className(state));\n return cx(base, className);\n};\n\nconst popupPlacementClass: Record<DrawerPlacement, string> = {\n bottom: styles.popupBottom,\n left: styles.popupLeft,\n right: styles.popupRight,\n top: styles.popupTop,\n};\n\nconst panelPlacementClass: Record<DrawerPlacement, string> = {\n bottom: styles.panelBottom,\n left: styles.panelLeft,\n right: styles.panelRight,\n top: styles.panelTop,\n};\n\nconst panelRoundedClass: Record<DrawerPlacement, string> = {\n bottom: styles.panelRoundedBottom,\n left: styles.panelRoundedLeft,\n right: styles.panelRoundedRight,\n top: styles.panelRoundedTop,\n};\n\nconst DrawerOpenContext = createContext<boolean | null>(null);\n\ninterface DrawerAnimationActions {\n onExitComplete: () => void;\n}\nconst DrawerActionsContext = createContext<DrawerAnimationActions | null>(null);\n\nexport const useDrawerOpen = () => use(DrawerOpenContext);\nexport const useDrawerActions = () => use(DrawerActionsContext);\n\nexport type DrawerRootProps = Dialog.Root.Props & {\n onExitComplete?: () => void;\n zIndex?: number;\n};\n\nconst AnimatedDrawerRoot = ({\n open,\n children,\n onExitComplete: onExitCompleteProp,\n zIndex: explicitZIndex,\n ...rest\n}: Omit<DrawerRootProps, 'open'> & { open: boolean }) => {\n const [isPresent, setIsPresent] = useState(!!open);\n\n useEffect(() => {\n if (open) setIsPresent(true);\n }, [open]);\n\n const handleExitComplete = useCallback(() => {\n setIsPresent(false);\n onExitCompleteProp?.();\n }, [onExitCompleteProp]);\n\n const actions = useMemo(() => ({ onExitComplete: handleExitComplete }), [handleExitComplete]);\n\n const { zIndex, ref: popupRef } = useLayerZIndex<HTMLDivElement>('modal', explicitZIndex);\n const layer = useMemo(\n () => ({ popupRef: popupRef as (node: HTMLElement | null) => void, zIndex }),\n [zIndex, popupRef],\n );\n\n if (!isPresent) return null;\n\n return (\n <DrawerOpenContext value={open}>\n <DrawerActionsContext value={actions}>\n <DrawerLayerProvider value={layer}>\n <Dialog.Root modal open {...rest}>\n {children}\n </Dialog.Root>\n </DrawerLayerProvider>\n </DrawerActionsContext>\n </DrawerOpenContext>\n );\n};\n\nconst NonAnimatedDrawerRoot = ({ zIndex: explicitZIndex, children, ...rest }: DrawerRootProps) => {\n const { zIndex, ref: popupRef } = useLayerZIndex<HTMLDivElement>('modal', explicitZIndex);\n const layer = useMemo(\n () => ({ popupRef: popupRef as (node: HTMLElement | null) => void, zIndex }),\n [zIndex, popupRef],\n );\n\n return (\n <DrawerLayerProvider value={layer}>\n <Dialog.Root modal {...rest}>\n {children}\n </Dialog.Root>\n </DrawerLayerProvider>\n );\n};\n\nexport const DrawerRoot = ({ open, onExitComplete, ...rest }: DrawerRootProps) => {\n if (open !== undefined) {\n return <AnimatedDrawerRoot open={open} onExitComplete={onExitComplete} {...rest} />;\n }\n return <NonAnimatedDrawerRoot {...rest} />;\n};\n\nexport type DrawerPortalProps = React.ComponentProps<typeof Dialog.Portal> & {\n container?: HTMLElement | null;\n};\nexport const DrawerPortal = ({ container, ...rest }: DrawerPortalProps) => {\n const appElement = useAppElement();\n return <Dialog.Portal container={container ?? appElement ?? undefined} {...rest} />;\n};\n\nexport type DrawerBackdropProps = React.ComponentProps<typeof Dialog.Backdrop>;\nexport const DrawerBackdrop = ({ className, style, ...rest }: DrawerBackdropProps) => {\n const open = useDrawerOpen();\n const layer = useDrawerLayer();\n const Motion = useMotionComponent();\n const layerStyle = layer?.zIndex !== undefined ? { zIndex: layer.zIndex } : undefined;\n\n if (open !== null) {\n return (\n <Dialog.Backdrop\n {...rest}\n className={cx(styles.backdrop, className as string)}\n style={{ ...layerStyle, ...style, transition: 'none' }}\n render={\n <Motion.div\n animate={{ opacity: open ? 1 : 0 }}\n initial={{ opacity: 0 }}\n transition={drawerBackdropTransition}\n />\n }\n />\n );\n }\n\n return (\n <Dialog.Backdrop\n {...rest}\n className={mergeStateClassName(styles.backdrop, className as any) as any}\n style={{ ...layerStyle, ...style }}\n />\n );\n};\n\nexport type DrawerPopupProps = React.ComponentProps<typeof Dialog.Popup> & {\n flush?: boolean;\n height?: number | string;\n motionProps?: Record<string, any>;\n panelClassName?: string;\n panelStyle?: React.CSSProperties;\n placement?: DrawerPlacement;\n popupStyle?: React.CSSProperties;\n pushOffset?: number;\n width?: number | string;\n};\n\nexport const DrawerPopup = ({\n className,\n children,\n placement: placementProp = 'right',\n width: widthProp,\n height: heightProp,\n flush,\n pushOffset = 0,\n motionProps,\n panelClassName,\n panelStyle,\n popupStyle,\n ref: forwardedRef,\n ...rest\n}: DrawerPopupProps) => {\n const open = useDrawerOpen();\n const actions = useDrawerActions();\n const layer = useDrawerLayer();\n const Motion = useMotionComponent();\n const composedRef = useMergeRefs([forwardedRef, layer?.popupRef]);\n\n // The exiting panel lives inside AnimatePresence and keeps the props it had while open,\n // but this popup re-renders with whatever the consumer passes now. Freezing the geometry\n // during exit keeps the two in sync — otherwise a placement change on close teleports the\n // popup to the new edge while the panel animates out along the old axis.\n const openGeometryRef = useRef({\n height: heightProp,\n placement: placementProp,\n width: widthProp,\n });\n if (open !== false) {\n openGeometryRef.current = { height: heightProp, placement: placementProp, width: widthProp };\n }\n const { height, placement, width } = openGeometryRef.current;\n\n const isHorizontal = placement === 'left' || placement === 'right';\n const sizeStyle: React.CSSProperties = isHorizontal ? { width } : { height };\n const resolvedPopupStyle: React.CSSProperties = {\n ...(layer?.zIndex === undefined ? undefined : { zIndex: layer.zIndex + 1 }),\n ...sizeStyle,\n ...popupStyle,\n };\n const popupBaseClassName = cx(styles.popup, popupPlacementClass[placement]);\n const resolvedPanelClassName = cx(\n styles.panel,\n panelPlacementClass[placement],\n flush ? styles.panelFlush : panelRoundedClass[placement],\n panelClassName,\n );\n\n if (open !== null && actions) {\n const motionConfig = getDrawerMotionConfig(placement, pushOffset);\n return (\n <Dialog.Popup\n {...rest}\n className={cx(popupBaseClassName, className as string)}\n data-drawer-anchor={placement}\n ref={composedRef as any}\n style={resolvedPopupStyle}\n >\n <AnimatePresence onExitComplete={actions.onExitComplete}>\n {open ? (\n <Motion.div\n {...motionConfig}\n {...motionProps}\n className={resolvedPanelClassName}\n data-drawer-placement={placement}\n key=\"drawer-popup-panel\"\n style={{ transition: 'none', ...panelStyle }}\n >\n {children}\n </Motion.div>\n ) : null}\n </AnimatePresence>\n </Dialog.Popup>\n );\n }\n\n const { axis, sign } = pushAxis[placement];\n const pushVars = {\n [axis === 'x' ? '--drawer-push-x' : '--drawer-push-y']: `${pushOffset * sign}px`,\n } as React.CSSProperties;\n\n return (\n <Dialog.Popup\n {...rest}\n className={mergeStateClassName(popupBaseClassName, className as any) as any}\n data-drawer-anchor={placement}\n ref={composedRef as any}\n style={resolvedPopupStyle}\n >\n <div\n className={resolvedPanelClassName}\n data-drawer-placement={placement}\n style={{ ...pushVars, ...panelStyle }}\n >\n {children}\n </div>\n </Dialog.Popup>\n );\n};\n\nexport type DrawerHeaderProps = React.HTMLAttributes<HTMLDivElement> & {\n ref?: React.Ref<HTMLDivElement>;\n};\nexport const DrawerHeader = ({ className, ...rest }: DrawerHeaderProps) => (\n <div {...rest} className={cx(styles.header, className)} />\n);\n\nexport type DrawerTitleProps = React.ComponentProps<typeof Dialog.Title>;\nexport const DrawerTitle = ({ className, ...rest }: DrawerTitleProps) => (\n <Dialog.Title {...rest} className={mergeStateClassName(styles.title, className as any) as any} />\n);\n\nexport type DrawerDescriptionProps = React.ComponentProps<typeof Dialog.Description>;\nexport const DrawerDescription: React.FC<DrawerDescriptionProps> = Dialog.Description;\n\nexport type DrawerContentProps = React.HTMLAttributes<HTMLDivElement> & {\n ref?: React.Ref<HTMLDivElement>;\n};\nexport const DrawerContent = ({ className, ...rest }: DrawerContentProps) => (\n <div {...rest} className={cx(styles.content, className)} />\n);\n\nexport type DrawerFooterProps = React.HTMLAttributes<HTMLDivElement> & {\n ref?: React.Ref<HTMLDivElement>;\n};\nexport const DrawerFooter = ({ className, ...rest }: DrawerFooterProps) => (\n <div {...rest} className={cx(styles.footer, className)} />\n);\n\nexport type DrawerCloseProps = React.ComponentProps<typeof Dialog.Close>;\nexport const DrawerClose = ({ className, children, ...rest }: DrawerCloseProps) => (\n <Dialog.Close {...rest} className={mergeStateClassName(styles.close, className as any) as any}>\n {children ?? <X size={16} />}\n </Dialog.Close>\n);\n\nexport type DrawerTriggerProps = Omit<\n React.ComponentPropsWithRef<typeof Dialog.Trigger>,\n 'children' | 'render'\n> & {\n children?: React.ReactNode;\n nativeButton?: boolean;\n};\n\nexport const DrawerTrigger = ({\n children,\n className,\n nativeButton,\n ref: refProp,\n ...rest\n}: DrawerTriggerProps) => {\n const { isNativeButtonTriggerElement, resolvedNativeButton } = useNativeButton({\n children,\n nativeButton,\n });\n\n const renderer = (props: any) => {\n const resolvedProps = (() => {\n if (isNativeButtonTriggerElement) return props as any;\n // eslint-disable-next-line unused-imports/no-unused-vars\n const { type, ...restProps } = props as any;\n return restProps;\n })();\n\n const mergedProps = mergeProps((children as any).props, resolvedProps);\n return cloneElement(children as any, {\n ...mergedProps,\n ref: mergeRefs([(children as any).ref, (props as any).ref, refProp]),\n });\n };\n\n if (isValidElement(children)) {\n return (\n <Dialog.Trigger\n {...rest}\n className={className}\n nativeButton={resolvedNativeButton}\n render={renderer as any}\n />\n );\n }\n\n return (\n <Dialog.Trigger\n {...rest}\n className={className}\n nativeButton={resolvedNativeButton}\n ref={refProp as any}\n >\n {children}\n </Dialog.Trigger>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AA+BA,MAAM,uBACJ,MACA,cACG;CACH,IAAI,OAAO,cAAc,YAAY,QAAQ,UAAkB,GAAG,MAAM,UAAU,KAAK,CAAC;CACxF,OAAO,GAAG,MAAM,SAAS;AAC3B;AAEA,MAAM,sBAAuD;CAC3D,QAAQ,OAAO;CACf,MAAM,OAAO;CACb,OAAO,OAAO;CACd,KAAK,OAAO;AACd;AAEA,MAAM,sBAAuD;CAC3D,QAAQ,OAAO;CACf,MAAM,OAAO;CACb,OAAO,OAAO;CACd,KAAK,OAAO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,OAAO;EACT,EAAA,CAAG;EAEH,MAAM,cAAc,WAAY,SAAiB,OAAO,aAAa;EACrE,OAAO,aAAa,UAAiB;GACnC,GAAG;GACH,KAAK,UAAU;IAAE,SAAiB;IAAM,MAAc;IAAK;GAAO,CAAC;EACrE,CAAC;CACH;CAEA,IAAI,eAAe,QAAQ,GACzB,OACE,oBAAC,OAAO,SAAR;EACE,GAAI;EACO;EACX,cAAc;EACd,QAAQ;CACT,CAAA;CAIL,OACE,oBAAC,OAAO,SAAR;EACE,GAAI;EACO;EACX,cAAc;EACd,KAAK;EAEJ;CACa,CAAA;AAEpB"}
1
+ {"version":3,"file":"atoms.mjs","names":[],"sources":["../../../src/base-ui/Drawer/atoms.tsx"],"sourcesContent":["'use client';\n\nimport { Dialog } from '@base-ui/react/dialog';\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport { cx } from 'antd-style';\nimport { X } from 'lucide-react';\nimport { AnimatePresence } from 'motion/react';\nimport type React from 'react';\nimport {\n cloneElement,\n createContext,\n isValidElement,\n use,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { mergeRefs, useMergeRefs } from 'react-merge-refs';\n\nimport { useNativeButton } from '@/hooks/useNativeButton';\nimport { useMotionComponent } from '@/MotionProvider';\nimport { useAppElement } from '@/ThemeProvider/AppElementContext';\n\nimport { useLayerZIndex } from '../zIndex';\nimport { drawerBackdropTransition, getDrawerMotionConfig, pushAxis } from './constants';\nimport { DrawerLayerProvider, useDrawerLayer } from './DrawerLayerContext';\nimport { styles } from './style';\nimport type { DrawerPlacement } from './type';\n\nconst mergeStateClassName = <TState,>(\n base: string,\n className: string | ((state: TState) => string | undefined) | undefined,\n) => {\n if (typeof className === 'function') return (state: TState) => cx(base, className(state));\n return cx(base, className);\n};\n\nconst popupPlacementClass: Record<DrawerPlacement, string> = {\n bottom: styles.popupBottom,\n left: styles.popupLeft,\n right: styles.popupRight,\n top: styles.popupTop,\n};\n\nconst panelPlacementClass: Record<DrawerPlacement, string> = {\n bottom: styles.panelBottom,\n left: styles.panelLeft,\n right: styles.panelRight,\n top: styles.panelTop,\n};\n\nconst panelRoundedClass: Record<DrawerPlacement, string> = {\n bottom: styles.panelRoundedBottom,\n left: styles.panelRoundedLeft,\n right: styles.panelRoundedRight,\n top: styles.panelRoundedTop,\n};\n\nconst DrawerOpenContext = createContext<boolean | null>(null);\n\ninterface DrawerAnimationActions {\n onExitComplete: () => void;\n}\nconst DrawerActionsContext = createContext<DrawerAnimationActions | null>(null);\n\nexport const useDrawerOpen = () => use(DrawerOpenContext);\nexport const useDrawerActions = () => use(DrawerActionsContext);\n\nexport type DrawerRootProps = Dialog.Root.Props & {\n onExitComplete?: () => void;\n zIndex?: number;\n};\n\nconst AnimatedDrawerRoot = ({\n open,\n children,\n onExitComplete: onExitCompleteProp,\n zIndex: explicitZIndex,\n ...rest\n}: Omit<DrawerRootProps, 'open'> & { open: boolean }) => {\n const [isPresent, setIsPresent] = useState(!!open);\n\n useEffect(() => {\n if (open) setIsPresent(true);\n }, [open]);\n\n const handleExitComplete = useCallback(() => {\n setIsPresent(false);\n onExitCompleteProp?.();\n }, [onExitCompleteProp]);\n\n const actions = useMemo(() => ({ onExitComplete: handleExitComplete }), [handleExitComplete]);\n\n const { zIndex, ref: popupRef } = useLayerZIndex<HTMLDivElement>('modal', explicitZIndex);\n const layer = useMemo(\n () => ({ popupRef: popupRef as (node: HTMLElement | null) => void, zIndex }),\n [zIndex, popupRef],\n );\n\n if (!isPresent) return null;\n\n return (\n <DrawerOpenContext value={open}>\n <DrawerActionsContext value={actions}>\n <DrawerLayerProvider value={layer}>\n <Dialog.Root modal open {...rest}>\n {children}\n </Dialog.Root>\n </DrawerLayerProvider>\n </DrawerActionsContext>\n </DrawerOpenContext>\n );\n};\n\nconst NonAnimatedDrawerRoot = ({ zIndex: explicitZIndex, children, ...rest }: DrawerRootProps) => {\n const { zIndex, ref: popupRef } = useLayerZIndex<HTMLDivElement>('modal', explicitZIndex);\n const layer = useMemo(\n () => ({ popupRef: popupRef as (node: HTMLElement | null) => void, zIndex }),\n [zIndex, popupRef],\n );\n\n return (\n <DrawerLayerProvider value={layer}>\n <Dialog.Root modal {...rest}>\n {children}\n </Dialog.Root>\n </DrawerLayerProvider>\n );\n};\n\nexport const DrawerRoot = ({ open, onExitComplete, ...rest }: DrawerRootProps) => {\n if (open !== undefined) {\n return <AnimatedDrawerRoot open={open} onExitComplete={onExitComplete} {...rest} />;\n }\n return <NonAnimatedDrawerRoot {...rest} />;\n};\n\nexport type DrawerPortalProps = React.ComponentProps<typeof Dialog.Portal> & {\n container?: HTMLElement | null;\n};\nexport const DrawerPortal = ({ container, ...rest }: DrawerPortalProps) => {\n const appElement = useAppElement();\n return <Dialog.Portal container={container ?? appElement ?? undefined} {...rest} />;\n};\n\nexport type DrawerBackdropProps = React.ComponentProps<typeof Dialog.Backdrop>;\nexport const DrawerBackdrop = ({ className, style, ...rest }: DrawerBackdropProps) => {\n const open = useDrawerOpen();\n const layer = useDrawerLayer();\n const Motion = useMotionComponent();\n const layerStyle = layer?.zIndex !== undefined ? { zIndex: layer.zIndex } : undefined;\n\n if (open !== null) {\n return (\n <Dialog.Backdrop\n {...rest}\n className={cx(styles.backdrop, className as string)}\n style={{ ...layerStyle, ...style, transition: 'none' }}\n render={\n <Motion.div\n animate={{ opacity: open ? 1 : 0 }}\n initial={{ opacity: 0 }}\n transition={drawerBackdropTransition}\n />\n }\n />\n );\n }\n\n return (\n <Dialog.Backdrop\n {...rest}\n className={mergeStateClassName(styles.backdrop, className as any) as any}\n style={{ ...layerStyle, ...style }}\n />\n );\n};\n\nexport type DrawerPopupProps = React.ComponentProps<typeof Dialog.Popup> & {\n flush?: boolean;\n height?: number | string;\n motionProps?: Record<string, any>;\n panelClassName?: string;\n panelStyle?: React.CSSProperties;\n placement?: DrawerPlacement;\n popupStyle?: React.CSSProperties;\n pushOffset?: number;\n width?: number | string;\n};\n\nexport const DrawerPopup = ({\n className,\n children,\n placement: placementProp = 'right',\n width: widthProp,\n height: heightProp,\n flush,\n pushOffset = 0,\n motionProps,\n panelClassName,\n panelStyle,\n popupStyle,\n ref: forwardedRef,\n ...rest\n}: DrawerPopupProps) => {\n const open = useDrawerOpen();\n const actions = useDrawerActions();\n const layer = useDrawerLayer();\n const Motion = useMotionComponent();\n const composedRef = useMergeRefs([forwardedRef, layer?.popupRef]);\n\n // The exiting panel lives inside AnimatePresence and keeps the props it had while open,\n // but this popup re-renders with whatever the consumer passes now. Freezing the geometry\n // during exit keeps the two in sync — otherwise a placement change on close teleports the\n // popup to the new edge while the panel animates out along the old axis.\n const openGeometryRef = useRef({\n height: heightProp,\n placement: placementProp,\n width: widthProp,\n });\n if (open !== false) {\n openGeometryRef.current = { height: heightProp, placement: placementProp, width: widthProp };\n }\n const { height, placement, width } = openGeometryRef.current;\n\n const isHorizontal = placement === 'left' || placement === 'right';\n const sizeStyle: React.CSSProperties = isHorizontal ? { width } : { height };\n const resolvedPopupStyle: React.CSSProperties = {\n ...(layer?.zIndex === undefined ? undefined : { zIndex: layer.zIndex + 1 }),\n ...sizeStyle,\n ...popupStyle,\n };\n const popupBaseClassName = cx(styles.popup, popupPlacementClass[placement]);\n const resolvedPanelClassName = cx(\n styles.panel,\n panelPlacementClass[placement],\n flush ? styles.panelFlush : panelRoundedClass[placement],\n panelClassName,\n );\n\n if (open !== null && actions) {\n const motionConfig = getDrawerMotionConfig(placement, pushOffset);\n return (\n <Dialog.Popup\n {...rest}\n className={cx(popupBaseClassName, className as string)}\n data-drawer-anchor={placement}\n ref={composedRef as any}\n style={resolvedPopupStyle}\n >\n <AnimatePresence onExitComplete={actions.onExitComplete}>\n {open ? (\n <Motion.div\n {...motionConfig}\n {...motionProps}\n className={resolvedPanelClassName}\n data-drawer-placement={placement}\n key=\"drawer-popup-panel\"\n style={{ transition: 'none', ...panelStyle }}\n >\n {children}\n </Motion.div>\n ) : null}\n </AnimatePresence>\n </Dialog.Popup>\n );\n }\n\n const { axis, sign } = pushAxis[placement];\n const pushVars = {\n [axis === 'x' ? '--drawer-push-x' : '--drawer-push-y']: `${pushOffset * sign}px`,\n } as React.CSSProperties;\n\n return (\n <Dialog.Popup\n {...rest}\n className={mergeStateClassName(popupBaseClassName, className as any) as any}\n data-drawer-anchor={placement}\n ref={composedRef as any}\n style={resolvedPopupStyle}\n >\n <div\n className={resolvedPanelClassName}\n data-drawer-placement={placement}\n style={{ ...pushVars, ...panelStyle }}\n >\n {children}\n </div>\n </Dialog.Popup>\n );\n};\n\nexport type DrawerHeaderProps = React.HTMLAttributes<HTMLDivElement> & {\n ref?: React.Ref<HTMLDivElement>;\n};\nexport const DrawerHeader = ({ className, ...rest }: DrawerHeaderProps) => (\n <div {...rest} className={cx(styles.header, className)} />\n);\n\nexport type DrawerTitleProps = React.ComponentProps<typeof Dialog.Title>;\nexport const DrawerTitle = ({ className, ...rest }: DrawerTitleProps) => (\n <Dialog.Title {...rest} className={mergeStateClassName(styles.title, className as any) as any} />\n);\n\nexport type DrawerDescriptionProps = React.ComponentProps<typeof Dialog.Description>;\nexport const DrawerDescription: React.FC<DrawerDescriptionProps> = Dialog.Description;\n\nexport type DrawerContentProps = React.HTMLAttributes<HTMLDivElement> & {\n ref?: React.Ref<HTMLDivElement>;\n};\nexport const DrawerContent = ({ className, ...rest }: DrawerContentProps) => (\n <div {...rest} className={cx(styles.content, className)} />\n);\n\nexport type DrawerFooterProps = React.HTMLAttributes<HTMLDivElement> & {\n ref?: React.Ref<HTMLDivElement>;\n};\nexport const DrawerFooter = ({ className, ...rest }: DrawerFooterProps) => (\n <div {...rest} className={cx(styles.footer, className)} />\n);\n\nexport type DrawerCloseProps = React.ComponentProps<typeof Dialog.Close>;\nexport const DrawerClose = ({ className, children, ...rest }: DrawerCloseProps) => (\n <Dialog.Close {...rest} className={mergeStateClassName(styles.close, className as any) as any}>\n {children ?? <X size={16} />}\n </Dialog.Close>\n);\n\nexport type DrawerTriggerProps = Omit<\n React.ComponentPropsWithRef<typeof Dialog.Trigger>,\n 'children' | 'render'\n> & {\n children?: React.ReactNode;\n nativeButton?: boolean;\n};\n\nexport const DrawerTrigger = ({\n children,\n className,\n nativeButton,\n ref: refProp,\n ...rest\n}: DrawerTriggerProps) => {\n const { isNativeButtonTriggerElement, resolvedNativeButton } = useNativeButton({\n children,\n nativeButton,\n });\n\n const renderer = (props: any) => {\n const resolvedProps = (() => {\n if (isNativeButtonTriggerElement) return props as any;\n // eslint-disable-next-line unused-imports/no-unused-vars\n const { type, ...restProps } = props as any;\n return restProps;\n })();\n\n const mergedProps = mergeProps((children as any).props, resolvedProps);\n return cloneElement(children as any, {\n ...mergedProps,\n ref: mergeRefs([(children as any).ref, (props as any).ref, refProp]),\n });\n };\n\n if (isValidElement(children)) {\n return (\n <Dialog.Trigger\n {...rest}\n className={className}\n nativeButton={resolvedNativeButton}\n render={renderer as any}\n />\n );\n }\n\n return (\n <Dialog.Trigger\n {...rest}\n className={className}\n nativeButton={resolvedNativeButton}\n ref={refProp as any}\n >\n {children}\n </Dialog.Trigger>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AA+BA,MAAM,uBACJ,MACA,cACG;CACH,IAAI,OAAO,cAAc,YAAY,QAAQ,UAAkB,GAAG,MAAM,UAAU,KAAK,CAAC;CACxF,OAAO,GAAG,MAAM,SAAS;AAC3B;AAEA,MAAM,sBAAuD;CAC3D,QAAQ,OAAO;CACf,MAAM,OAAO;CACb,OAAO,OAAO;CACd,KAAK,OAAO;AACd;AAEA,MAAM,sBAAuD;CAC3D,QAAQ,OAAO;CACf,MAAM,OAAO;CACb,OAAO,OAAO;CACd,KAAK,OAAO;AACd;AAEA,MAAM,oBAAqD;CACzD,QAAQ,OAAO;CACf,MAAM,OAAO;CACb,OAAO,OAAO;CACd,KAAK,OAAO;AACd;AAEA,MAAM,oBAAoB,cAA8B,IAAI;AAK5D,MAAM,uBAAuB,cAA6C,IAAI;AAE9E,MAAa,sBAAsB,IAAI,iBAAiB;AACxD,MAAa,yBAAyB,IAAI,oBAA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EACE,GAAI;EACO;EACX,cAAc;EACd,QAAQ;CACT,CAAA;CAIL,OACE,oBAAC,OAAO,SAAR;EACE,GAAI;EACO;EACX,cAAc;EACd,KAAK;EAEJ;CACa,CAAA;AAEpB"}
@@ -3,10 +3,10 @@ import { useNativeButton } from "../../hooks/useNativeButton.mjs";
3
3
  import { getFloatingCollisionPadding } from "../floating/collisionPadding.mjs";
4
4
  import { FloatingLayerProvider } from "../../hooks/useFloatingLayer.mjs";
5
5
  import { useAppElement } from "../../ThemeProvider/AppElementContext.mjs";
6
- import { CLASSNAMES } from "../../styles/classNames.mjs";
7
6
  import { placementMap } from "../../utils/placement.mjs";
8
7
  import Switch from "../Switch/Switch.mjs";
9
8
  import { MenuVirtualList } from "../virtual/MenuVirtualList.mjs";
9
+ import { CLASSNAMES } from "../../styles/classNames.mjs";
10
10
  import { useLayerZIndex } from "../zIndex/useLayerZIndex.mjs";
11
11
  import { styles } from "./sharedStyle.mjs";
12
12
  import { cloneElement, isValidElement, useCallback, useState } from "react";
@@ -1 +1 @@
1
- {"version":3,"file":"atoms.mjs","names":[],"sources":["../../../src/base-ui/DropdownMenu/atoms.tsx"],"sourcesContent":["'use client';\n\nimport { Menu } from '@base-ui/react/menu';\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport { cx } from 'antd-style';\nimport clsx from 'clsx';\nimport type React from 'react';\nimport { cloneElement, isValidElement, useCallback, useState } from 'react';\nimport { mergeRefs, useMergeRefs } from 'react-merge-refs';\n\nimport { getFloatingCollisionPadding } from '@/base-ui/floating';\nimport Switch from '@/base-ui/Switch';\nimport { MenuVirtualList, type VirtualListProps } from '@/base-ui/virtual';\nimport { FloatingLayerProvider } from '@/hooks/useFloatingLayer';\nimport { useNativeButton } from '@/hooks/useNativeButton';\nimport { CLASSNAMES } from '@/styles/classNames';\nimport { useAppElement } from '@/ThemeProvider';\nimport { placementMap } from '@/utils/placement';\n\nimport { useLayerZIndex } from '../zIndex';\nimport { styles } from './sharedStyle';\nimport { type DropdownMenuPlacement } from './type';\n\nexport const DropdownMenuRoot: typeof Menu.Root = (props) => <Menu.Root modal={false} {...props} />;\nexport const DropdownMenuSubmenuRoot = Menu.SubmenuRoot;\nexport const DropdownMenuCheckboxItemIndicator = Menu.CheckboxItemIndicator;\n\nconst mergeStateClassName = <TState,>(\n base: string,\n className: string | ((state: TState) => string | undefined) | undefined,\n) => {\n if (typeof className === 'function') return (state: TState) => cx(base, className(state));\n return cx(base, className);\n};\n\nexport type DropdownMenuTriggerProps = Omit<\n React.ComponentPropsWithRef<typeof Menu.Trigger>,\n 'children' | 'render'\n> & {\n children: React.ReactNode;\n};\n\nexport const DropdownMenuTrigger = ({\n children,\n className,\n nativeButton,\n ref: refProp,\n ...rest\n}: DropdownMenuTriggerProps) => {\n const { isNativeButtonTriggerElement, resolvedNativeButton } = useNativeButton({\n children,\n nativeButton,\n });\n\n const renderer = (props: any) => {\n // Base UI's trigger props include `type=\"button\"` by default.\n // If we render into a non-<button> element, that prop is invalid and can warn.\n const resolvedProps = (() => {\n if (isNativeButtonTriggerElement) return props as any;\n // eslint-disable-next-line unused-imports/no-unused-vars\n const { type, ...restProps } = props as any;\n return restProps;\n })();\n\n const mergedProps = mergeProps((children as any).props, resolvedProps);\n return cloneElement(children as any, {\n ...mergedProps,\n className: clsx(CLASSNAMES.DropdownMenuTrigger, className, mergedProps.className),\n ref: mergeRefs([(children as any).ref, (props as any).ref, refProp]),\n });\n };\n\n if (isValidElement(children)) {\n return <Menu.Trigger {...rest} nativeButton={resolvedNativeButton} render={renderer as any} />;\n }\n\n return (\n <Menu.Trigger\n {...rest}\n className={clsx(CLASSNAMES.DropdownMenuTrigger, className)}\n nativeButton={resolvedNativeButton}\n ref={refProp as any}\n >\n {children}\n </Menu.Trigger>\n );\n};\n\nDropdownMenuTrigger.displayName = 'DropdownMenuTrigger';\n\nexport type DropdownMenuPortalProps = React.ComponentProps<typeof Menu.Portal> & {\n /**\n * When `container` is not provided, it uses a shared container created by `usePortalContainer`.\n */\n container?: HTMLElement | null;\n};\n\nexport const DropdownMenuPortal = ({ container, ...rest }: DropdownMenuPortalProps) => {\n const appElement = useAppElement();\n return <Menu.Portal container={container ?? appElement ?? undefined} {...rest} />;\n};\n\nDropdownMenuPortal.displayName = 'DropdownMenuPortal';\n\nexport type DropdownMenuPositionerProps = React.ComponentProps<typeof Menu.Positioner> & {\n hoverTrigger?: boolean;\n placement?: DropdownMenuPlacement;\n};\n\nexport const DropdownMenuPositioner = ({\n className,\n collisionPadding,\n placement,\n hoverTrigger,\n align,\n side,\n sideOffset,\n children,\n style,\n ...rest\n}: DropdownMenuPositionerProps) => {\n const placementConfig = placement ? placementMap[placement] : undefined;\n const [positionerNode, setPositionerNode] = useState<HTMLDivElement | null>(null);\n\n const explicitZIndex =\n typeof style !== 'function' && style?.zIndex != null && typeof style.zIndex === 'number'\n ? style.zIndex\n : undefined;\n const { zIndex, ref: zRef } = useLayerZIndex<HTMLDivElement>('floating', explicitZIndex);\n const composedRef = useMergeRefs([setPositionerNode, zRef]);\n\n const resolvedStyle =\n typeof style === 'function'\n ? (state: any) => ({ zIndex, ...style(state) })\n : { zIndex, ...style };\n\n return (\n <Menu.Positioner\n {...rest}\n align={align ?? placementConfig?.align}\n className={mergeStateClassName(styles.positioner, className as any) as any}\n collisionPadding={collisionPadding ?? getFloatingCollisionPadding()}\n data-hover-trigger={hoverTrigger || undefined}\n data-placement={placement}\n ref={composedRef as any}\n side={side ?? placementConfig?.side}\n sideOffset={sideOffset ?? (placementConfig ? 6 : undefined)}\n style={resolvedStyle}\n >\n <FloatingLayerProvider value={positionerNode}>{children}</FloatingLayerProvider>\n </Menu.Positioner>\n );\n};\n\nDropdownMenuPositioner.displayName = 'DropdownMenuPositioner';\n\nexport type DropdownMenuPopupProps = React.ComponentProps<typeof Menu.Popup>;\n\nexport const DropdownMenuPopup = ({ className, ...rest }: DropdownMenuPopupProps) => {\n return (\n <Menu.Popup {...rest} className={mergeStateClassName(styles.popup, className as any) as any} />\n );\n};\n\nDropdownMenuPopup.displayName = 'DropdownMenuPopup';\n\nexport type DropdownMenuHeaderProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const DropdownMenuHeader = ({ className, ...rest }: DropdownMenuHeaderProps) => {\n return <div {...rest} className={cx(styles.header, className)} data-slot=\"header\" />;\n};\n\nDropdownMenuHeader.displayName = 'DropdownMenuHeader';\n\nexport type DropdownMenuFooterProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const DropdownMenuFooter = ({ className, ...rest }: DropdownMenuFooterProps) => {\n return <div {...rest} className={cx(styles.footer, className)} data-slot=\"footer\" />;\n};\n\nDropdownMenuFooter.displayName = 'DropdownMenuFooter';\n\nexport type DropdownMenuScrollViewportProps = React.HTMLAttributes<HTMLDivElement> &\n VirtualListProps;\n\nexport const DropdownMenuScrollViewport = ({\n children,\n className,\n getItemLabel,\n keepMounted,\n listItemHeight,\n virtual,\n ...rest\n}: DropdownMenuScrollViewportProps) => {\n if (!virtual) {\n return (\n <div {...rest} className={cx(styles.slotViewport, className)}>\n {children}\n </div>\n );\n }\n\n return (\n <MenuVirtualList\n {...rest}\n className={className}\n getItemLabel={getItemLabel}\n itemSize={listItemHeight}\n keepMounted={keepMounted}\n >\n {children}\n </MenuVirtualList>\n );\n};\n\nDropdownMenuScrollViewport.displayName = 'DropdownMenuScrollViewport';\n\nexport type DropdownMenuItemProps = React.ComponentProps<typeof Menu.Item> & { danger?: boolean };\n\nexport const DropdownMenuItem = ({ className, danger, ...rest }: DropdownMenuItemProps) => {\n return (\n <Menu.Item\n {...rest}\n className={(state) =>\n cx(\n styles.item,\n danger && styles.danger,\n typeof className === 'function' ? className(state) : className,\n )\n }\n />\n );\n};\n\nDropdownMenuItem.displayName = 'DropdownMenuItem';\n\nexport type DropdownMenuCheckboxItemProps = React.ComponentProps<typeof Menu.CheckboxItem> & {\n danger?: boolean;\n};\n\nexport const DropdownMenuCheckboxItemPrimitive = ({\n className,\n danger,\n ...rest\n}: DropdownMenuCheckboxItemProps) => {\n return (\n <Menu.CheckboxItem\n {...rest}\n className={(state) =>\n cx(\n styles.item,\n danger && styles.danger,\n typeof className === 'function' ? className(state) : className,\n )\n }\n />\n );\n};\n\nDropdownMenuCheckboxItemPrimitive.displayName = 'DropdownMenuCheckboxItemPrimitive';\n\nexport type DropdownMenuSeparatorProps = React.ComponentProps<typeof Menu.Separator>;\n\nexport const DropdownMenuSeparator = ({ className, ...rest }: DropdownMenuSeparatorProps) => {\n return (\n <Menu.Separator\n {...rest}\n className={(state) =>\n cx(styles.separator, typeof className === 'function' ? className(state) : className)\n }\n />\n );\n};\n\nDropdownMenuSeparator.displayName = 'DropdownMenuSeparator';\n\nexport const DropdownMenuGroup = Menu.Group;\n\nexport type DropdownMenuGroupLabelProps = React.ComponentProps<typeof Menu.GroupLabel>;\n\nexport const DropdownMenuGroupLabel = ({ className, ...rest }: DropdownMenuGroupLabelProps) => {\n return (\n <Menu.GroupLabel\n {...rest}\n className={(state) =>\n cx(styles.groupLabel, typeof className === 'function' ? className(state) : className)\n }\n />\n );\n};\n\nDropdownMenuGroupLabel.displayName = 'DropdownMenuGroupLabel';\n\nexport type DropdownMenuSubmenuTriggerProps = React.ComponentProps<typeof Menu.SubmenuTrigger> & {\n danger?: boolean;\n};\n\nexport const DropdownMenuSubmenuTrigger = ({\n className,\n danger,\n ...rest\n}: DropdownMenuSubmenuTriggerProps) => {\n return (\n <Menu.SubmenuTrigger\n {...rest}\n className={(state) =>\n cx(\n styles.item,\n danger && styles.danger,\n typeof className === 'function' ? className(state) : className,\n )\n }\n />\n );\n};\n\nDropdownMenuSubmenuTrigger.displayName = 'DropdownMenuSubmenuTrigger';\n\nexport type DropdownMenuItemContentProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const DropdownMenuItemContent = ({ className, ...rest }: DropdownMenuItemContentProps) => {\n return <div {...rest} className={cx(styles.itemContent, className)} />;\n};\n\nDropdownMenuItemContent.displayName = 'DropdownMenuItemContent';\n\nexport type DropdownMenuItemIconProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuItemIcon = ({ className, ...rest }: DropdownMenuItemIconProps) => {\n return <span {...rest} className={cx(styles.icon, className)} />;\n};\n\nDropdownMenuItemIcon.displayName = 'DropdownMenuItemIcon';\n\nexport type DropdownMenuItemLabelGroupProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const DropdownMenuItemLabelGroup = ({\n className,\n ...rest\n}: DropdownMenuItemLabelGroupProps) => {\n return <div {...rest} className={cx(styles.labelGroup, className)} />;\n};\n\nDropdownMenuItemLabelGroup.displayName = 'DropdownMenuItemLabelGroup';\n\nexport type DropdownMenuItemLabelProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuItemLabel = ({ className, ...rest }: DropdownMenuItemLabelProps) => {\n return <span {...rest} className={cx(styles.label, className)} />;\n};\n\nDropdownMenuItemLabel.displayName = 'DropdownMenuItemLabel';\n\nexport type DropdownMenuItemDescProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuItemDesc = ({ className, ...rest }: DropdownMenuItemDescProps) => {\n return <span {...rest} className={cx(styles.desc, className)} />;\n};\n\nDropdownMenuItemDesc.displayName = 'DropdownMenuItemDesc';\n\nexport type DropdownMenuItemExtraProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuItemExtra = ({ className, ...rest }: DropdownMenuItemExtraProps) => {\n return <span {...rest} className={cx(styles.extra, className)} />;\n};\n\nDropdownMenuItemExtra.displayName = 'DropdownMenuItemExtra';\n\nexport type DropdownMenuSubmenuArrowProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuSubmenuArrow = ({ className, ...rest }: DropdownMenuSubmenuArrowProps) => {\n return <span {...rest} className={cx(styles.submenuArrow, className)} />;\n};\n\nDropdownMenuSubmenuArrow.displayName = 'DropdownMenuSubmenuArrow';\n\nexport type DropdownMenuSwitchItemProps = Omit<\n React.ComponentProps<typeof Menu.Item>,\n 'onClick'\n> & {\n checked?: boolean;\n closeOnClick?: boolean;\n danger?: boolean;\n defaultChecked?: boolean;\n onCheckedChange?: (checked: boolean) => void;\n};\n\nexport const DropdownMenuSwitchItem = ({\n checked: checkedProp,\n className,\n closeOnClick = false,\n danger,\n defaultChecked,\n disabled,\n onCheckedChange,\n children,\n ...rest\n}: DropdownMenuSwitchItemProps) => {\n const [internalChecked, setInternalChecked] = useState(defaultChecked ?? false);\n const isControlled = checkedProp !== undefined;\n const checked = isControlled ? checkedProp : internalChecked;\n\n const handleCheckedChange = useCallback(\n (newChecked: boolean) => {\n if (!isControlled) {\n setInternalChecked(newChecked);\n }\n onCheckedChange?.(newChecked);\n },\n [isControlled, onCheckedChange],\n );\n\n return (\n <Menu.Item\n {...rest}\n closeOnClick={closeOnClick}\n disabled={disabled}\n className={(state) =>\n cx(\n styles.item,\n danger && styles.danger,\n typeof className === 'function' ? className(state) : className,\n )\n }\n onClick={(e) => {\n e.preventDefault();\n if (!disabled) {\n handleCheckedChange(!checked);\n }\n }}\n >\n {children}\n <span\n style={{ display: 'inline-flex', marginInlineStart: 16 }}\n onFocus={(e) => e.stopPropagation()}\n >\n <Switch\n checked={checked}\n disabled={disabled}\n size=\"small\"\n tabIndex={-1}\n onChange={handleCheckedChange}\n onClick={(_, e) => e.stopPropagation()}\n />\n </span>\n </Menu.Item>\n );\n};\n\nDropdownMenuSwitchItem.displayName = 'DropdownMenuSwitchItem';\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAuBA,MAAa,oBAAsC,UAAU,oBAAC,KAAK,MAAN;CAAW,OAAO;CAAO,GAAI;AAAQ,CAAA;AAClG,MAAa,0BAA0B,KAAK;AAC5C,MAAa,oCAAoC,KAAK;AAEtD,MAAM,uBACJ,MACA,cACG;CACH,IAAI,OAAO,cAAc,YAAY,QAAQ,UAAkB,GAAG,MAAM,UAAU,KAAK,CAAC;CACxF,OAAO,GAAG,MAAM,SAAS;AAC3B;AASA,MAAa,uBAAuB,EAClC,UACA,WACA,cACA,KAAK,SACL,GAA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ACrC,MAAM,UAAU,eAAe,cAAc;CAE7C,MAAM,sBAAsB,aACzB,eAAwB;EACvB,IAAI,CAAC,cACH,mBAAmB,UAAU;EAE/B,kBAAkB,UAAU;CAC9B,GACA,CAAC,cAAc,eAAe,CAChC;CAEA,OACE,qBAAC,KAAK,MAAN;EACE,GAAI;EACU;EACJ;EACV,YAAY,UACV,GACE,OAAO,MACP,UAAU,OAAO,QACjB,OAAO,cAAc,aAAa,UAAU,KAAK,IAAI,SACvD;EAEF,UAAU,MAAM;GACd,EAAE,eAAe;GACjB,IAAI,CAAC,UACH,oBAAoB,CAAC,OAAO;EAEhC;EAhBF,UAAA,CAkBG,UACD,oBAAC,QAAD;GACE,OAAO;IAAE,SAAS;IAAe,mBAAmB;GAAG;GACvD,UAAU,MAAM,EAAE,gBAAgB;GAElC,UAAA,oBAAC,QAAD;IACW;IACC;IACV,MAAK;IACL,UAAU;IACV,UAAU;IACV,UAAU,GAAG,MAAM,EAAE,gBAAgB;GACtC,CAAA;EACG,CAAA,CACG;;AAEf;AAEA,uBAAuB,cAAc"}
1
+ {"version":3,"file":"atoms.mjs","names":[],"sources":["../../../src/base-ui/DropdownMenu/atoms.tsx"],"sourcesContent":["'use client';\n\nimport { Menu } from '@base-ui/react/menu';\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport { cx } from 'antd-style';\nimport clsx from 'clsx';\nimport type React from 'react';\nimport { cloneElement, isValidElement, useCallback, useState } from 'react';\nimport { mergeRefs, useMergeRefs } from 'react-merge-refs';\n\nimport { getFloatingCollisionPadding } from '@/base-ui/floating';\nimport Switch from '@/base-ui/Switch';\nimport { MenuVirtualList, type VirtualListProps } from '@/base-ui/virtual';\nimport { FloatingLayerProvider } from '@/hooks/useFloatingLayer';\nimport { useNativeButton } from '@/hooks/useNativeButton';\nimport { CLASSNAMES } from '@/styles/classNames';\nimport { useAppElement } from '@/ThemeProvider/AppElementContext';\nimport { placementMap } from '@/utils/placement';\n\nimport { useLayerZIndex } from '../zIndex';\nimport { styles } from './sharedStyle';\nimport { type DropdownMenuPlacement } from './type';\n\nexport const DropdownMenuRoot: typeof Menu.Root = (props) => <Menu.Root modal={false} {...props} />;\nexport const DropdownMenuSubmenuRoot = Menu.SubmenuRoot;\nexport const DropdownMenuCheckboxItemIndicator = Menu.CheckboxItemIndicator;\n\nconst mergeStateClassName = <TState,>(\n base: string,\n className: string | ((state: TState) => string | undefined) | undefined,\n) => {\n if (typeof className === 'function') return (state: TState) => cx(base, className(state));\n return cx(base, className);\n};\n\nexport type DropdownMenuTriggerProps = Omit<\n React.ComponentPropsWithRef<typeof Menu.Trigger>,\n 'children' | 'render'\n> & {\n children: React.ReactNode;\n};\n\nexport const DropdownMenuTrigger = ({\n children,\n className,\n nativeButton,\n ref: refProp,\n ...rest\n}: DropdownMenuTriggerProps) => {\n const { isNativeButtonTriggerElement, resolvedNativeButton } = useNativeButton({\n children,\n nativeButton,\n });\n\n const renderer = (props: any) => {\n // Base UI's trigger props include `type=\"button\"` by default.\n // If we render into a non-<button> element, that prop is invalid and can warn.\n const resolvedProps = (() => {\n if (isNativeButtonTriggerElement) return props as any;\n // eslint-disable-next-line unused-imports/no-unused-vars\n const { type, ...restProps } = props as any;\n return restProps;\n })();\n\n const mergedProps = mergeProps((children as any).props, resolvedProps);\n return cloneElement(children as any, {\n ...mergedProps,\n className: clsx(CLASSNAMES.DropdownMenuTrigger, className, mergedProps.className),\n ref: mergeRefs([(children as any).ref, (props as any).ref, refProp]),\n });\n };\n\n if (isValidElement(children)) {\n return <Menu.Trigger {...rest} nativeButton={resolvedNativeButton} render={renderer as any} />;\n }\n\n return (\n <Menu.Trigger\n {...rest}\n className={clsx(CLASSNAMES.DropdownMenuTrigger, className)}\n nativeButton={resolvedNativeButton}\n ref={refProp as any}\n >\n {children}\n </Menu.Trigger>\n );\n};\n\nDropdownMenuTrigger.displayName = 'DropdownMenuTrigger';\n\nexport type DropdownMenuPortalProps = React.ComponentProps<typeof Menu.Portal> & {\n /**\n * When `container` is not provided, it uses a shared container created by `usePortalContainer`.\n */\n container?: HTMLElement | null;\n};\n\nexport const DropdownMenuPortal = ({ container, ...rest }: DropdownMenuPortalProps) => {\n const appElement = useAppElement();\n return <Menu.Portal container={container ?? appElement ?? undefined} {...rest} />;\n};\n\nDropdownMenuPortal.displayName = 'DropdownMenuPortal';\n\nexport type DropdownMenuPositionerProps = React.ComponentProps<typeof Menu.Positioner> & {\n hoverTrigger?: boolean;\n placement?: DropdownMenuPlacement;\n};\n\nexport const DropdownMenuPositioner = ({\n className,\n collisionPadding,\n placement,\n hoverTrigger,\n align,\n side,\n sideOffset,\n children,\n style,\n ...rest\n}: DropdownMenuPositionerProps) => {\n const placementConfig = placement ? placementMap[placement] : undefined;\n const [positionerNode, setPositionerNode] = useState<HTMLDivElement | null>(null);\n\n const explicitZIndex =\n typeof style !== 'function' && style?.zIndex != null && typeof style.zIndex === 'number'\n ? style.zIndex\n : undefined;\n const { zIndex, ref: zRef } = useLayerZIndex<HTMLDivElement>('floating', explicitZIndex);\n const composedRef = useMergeRefs([setPositionerNode, zRef]);\n\n const resolvedStyle =\n typeof style === 'function'\n ? (state: any) => ({ zIndex, ...style(state) })\n : { zIndex, ...style };\n\n return (\n <Menu.Positioner\n {...rest}\n align={align ?? placementConfig?.align}\n className={mergeStateClassName(styles.positioner, className as any) as any}\n collisionPadding={collisionPadding ?? getFloatingCollisionPadding()}\n data-hover-trigger={hoverTrigger || undefined}\n data-placement={placement}\n ref={composedRef as any}\n side={side ?? placementConfig?.side}\n sideOffset={sideOffset ?? (placementConfig ? 6 : undefined)}\n style={resolvedStyle}\n >\n <FloatingLayerProvider value={positionerNode}>{children}</FloatingLayerProvider>\n </Menu.Positioner>\n );\n};\n\nDropdownMenuPositioner.displayName = 'DropdownMenuPositioner';\n\nexport type DropdownMenuPopupProps = React.ComponentProps<typeof Menu.Popup>;\n\nexport const DropdownMenuPopup = ({ className, ...rest }: DropdownMenuPopupProps) => {\n return (\n <Menu.Popup {...rest} className={mergeStateClassName(styles.popup, className as any) as any} />\n );\n};\n\nDropdownMenuPopup.displayName = 'DropdownMenuPopup';\n\nexport type DropdownMenuHeaderProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const DropdownMenuHeader = ({ className, ...rest }: DropdownMenuHeaderProps) => {\n return <div {...rest} className={cx(styles.header, className)} data-slot=\"header\" />;\n};\n\nDropdownMenuHeader.displayName = 'DropdownMenuHeader';\n\nexport type DropdownMenuFooterProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const DropdownMenuFooter = ({ className, ...rest }: DropdownMenuFooterProps) => {\n return <div {...rest} className={cx(styles.footer, className)} data-slot=\"footer\" />;\n};\n\nDropdownMenuFooter.displayName = 'DropdownMenuFooter';\n\nexport type DropdownMenuScrollViewportProps = React.HTMLAttributes<HTMLDivElement> &\n VirtualListProps;\n\nexport const DropdownMenuScrollViewport = ({\n children,\n className,\n getItemLabel,\n keepMounted,\n listItemHeight,\n virtual,\n ...rest\n}: DropdownMenuScrollViewportProps) => {\n if (!virtual) {\n return (\n <div {...rest} className={cx(styles.slotViewport, className)}>\n {children}\n </div>\n );\n }\n\n return (\n <MenuVirtualList\n {...rest}\n className={className}\n getItemLabel={getItemLabel}\n itemSize={listItemHeight}\n keepMounted={keepMounted}\n >\n {children}\n </MenuVirtualList>\n );\n};\n\nDropdownMenuScrollViewport.displayName = 'DropdownMenuScrollViewport';\n\nexport type DropdownMenuItemProps = React.ComponentProps<typeof Menu.Item> & { danger?: boolean };\n\nexport const DropdownMenuItem = ({ className, danger, ...rest }: DropdownMenuItemProps) => {\n return (\n <Menu.Item\n {...rest}\n className={(state) =>\n cx(\n styles.item,\n danger && styles.danger,\n typeof className === 'function' ? className(state) : className,\n )\n }\n />\n );\n};\n\nDropdownMenuItem.displayName = 'DropdownMenuItem';\n\nexport type DropdownMenuCheckboxItemProps = React.ComponentProps<typeof Menu.CheckboxItem> & {\n danger?: boolean;\n};\n\nexport const DropdownMenuCheckboxItemPrimitive = ({\n className,\n danger,\n ...rest\n}: DropdownMenuCheckboxItemProps) => {\n return (\n <Menu.CheckboxItem\n {...rest}\n className={(state) =>\n cx(\n styles.item,\n danger && styles.danger,\n typeof className === 'function' ? className(state) : className,\n )\n }\n />\n );\n};\n\nDropdownMenuCheckboxItemPrimitive.displayName = 'DropdownMenuCheckboxItemPrimitive';\n\nexport type DropdownMenuSeparatorProps = React.ComponentProps<typeof Menu.Separator>;\n\nexport const DropdownMenuSeparator = ({ className, ...rest }: DropdownMenuSeparatorProps) => {\n return (\n <Menu.Separator\n {...rest}\n className={(state) =>\n cx(styles.separator, typeof className === 'function' ? className(state) : className)\n }\n />\n );\n};\n\nDropdownMenuSeparator.displayName = 'DropdownMenuSeparator';\n\nexport const DropdownMenuGroup = Menu.Group;\n\nexport type DropdownMenuGroupLabelProps = React.ComponentProps<typeof Menu.GroupLabel>;\n\nexport const DropdownMenuGroupLabel = ({ className, ...rest }: DropdownMenuGroupLabelProps) => {\n return (\n <Menu.GroupLabel\n {...rest}\n className={(state) =>\n cx(styles.groupLabel, typeof className === 'function' ? className(state) : className)\n }\n />\n );\n};\n\nDropdownMenuGroupLabel.displayName = 'DropdownMenuGroupLabel';\n\nexport type DropdownMenuSubmenuTriggerProps = React.ComponentProps<typeof Menu.SubmenuTrigger> & {\n danger?: boolean;\n};\n\nexport const DropdownMenuSubmenuTrigger = ({\n className,\n danger,\n ...rest\n}: DropdownMenuSubmenuTriggerProps) => {\n return (\n <Menu.SubmenuTrigger\n {...rest}\n className={(state) =>\n cx(\n styles.item,\n danger && styles.danger,\n typeof className === 'function' ? className(state) : className,\n )\n }\n />\n );\n};\n\nDropdownMenuSubmenuTrigger.displayName = 'DropdownMenuSubmenuTrigger';\n\nexport type DropdownMenuItemContentProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const DropdownMenuItemContent = ({ className, ...rest }: DropdownMenuItemContentProps) => {\n return <div {...rest} className={cx(styles.itemContent, className)} />;\n};\n\nDropdownMenuItemContent.displayName = 'DropdownMenuItemContent';\n\nexport type DropdownMenuItemIconProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuItemIcon = ({ className, ...rest }: DropdownMenuItemIconProps) => {\n return <span {...rest} className={cx(styles.icon, className)} />;\n};\n\nDropdownMenuItemIcon.displayName = 'DropdownMenuItemIcon';\n\nexport type DropdownMenuItemLabelGroupProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const DropdownMenuItemLabelGroup = ({\n className,\n ...rest\n}: DropdownMenuItemLabelGroupProps) => {\n return <div {...rest} className={cx(styles.labelGroup, className)} />;\n};\n\nDropdownMenuItemLabelGroup.displayName = 'DropdownMenuItemLabelGroup';\n\nexport type DropdownMenuItemLabelProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuItemLabel = ({ className, ...rest }: DropdownMenuItemLabelProps) => {\n return <span {...rest} className={cx(styles.label, className)} />;\n};\n\nDropdownMenuItemLabel.displayName = 'DropdownMenuItemLabel';\n\nexport type DropdownMenuItemDescProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuItemDesc = ({ className, ...rest }: DropdownMenuItemDescProps) => {\n return <span {...rest} className={cx(styles.desc, className)} />;\n};\n\nDropdownMenuItemDesc.displayName = 'DropdownMenuItemDesc';\n\nexport type DropdownMenuItemExtraProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuItemExtra = ({ className, ...rest }: DropdownMenuItemExtraProps) => {\n return <span {...rest} className={cx(styles.extra, className)} />;\n};\n\nDropdownMenuItemExtra.displayName = 'DropdownMenuItemExtra';\n\nexport type DropdownMenuSubmenuArrowProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuSubmenuArrow = ({ className, ...rest }: DropdownMenuSubmenuArrowProps) => {\n return <span {...rest} className={cx(styles.submenuArrow, className)} />;\n};\n\nDropdownMenuSubmenuArrow.displayName = 'DropdownMenuSubmenuArrow';\n\nexport type DropdownMenuSwitchItemProps = Omit<\n React.ComponentProps<typeof Menu.Item>,\n 'onClick'\n> & {\n checked?: boolean;\n closeOnClick?: boolean;\n danger?: boolean;\n defaultChecked?: boolean;\n onCheckedChange?: (checked: boolean) => void;\n};\n\nexport const DropdownMenuSwitchItem = ({\n checked: checkedProp,\n className,\n closeOnClick = false,\n danger,\n defaultChecked,\n disabled,\n onCheckedChange,\n children,\n ...rest\n}: DropdownMenuSwitchItemProps) => {\n const [internalChecked, setInternalChecked] = useState(defaultChecked ?? false);\n const isControlled = checkedProp !== undefined;\n const checked = isControlled ? checkedProp : internalChecked;\n\n const handleCheckedChange = useCallback(\n (newChecked: boolean) => {\n if (!isControlled) {\n setInternalChecked(newChecked);\n }\n onCheckedChange?.(newChecked);\n },\n [isControlled, onCheckedChange],\n );\n\n return (\n <Menu.Item\n {...rest}\n closeOnClick={closeOnClick}\n disabled={disabled}\n className={(state) =>\n cx(\n styles.item,\n danger && styles.danger,\n typeof className === 'function' ? className(state) : className,\n )\n }\n onClick={(e) => {\n e.preventDefault();\n if (!disabled) {\n handleCheckedChange(!checked);\n }\n }}\n >\n {children}\n <span\n style={{ display: 'inline-flex', marginInlineStart: 16 }}\n onFocus={(e) => e.stopPropagation()}\n >\n <Switch\n checked={checked}\n disabled={disabled}\n size=\"small\"\n tabIndex={-1}\n onChange={handleCheckedChange}\n onClick={(_, e) => e.stopPropagation()}\n />\n </span>\n </Menu.Item>\n );\n};\n\nDropdownMenuSwitchItem.displayName = 'DropdownMenuSwitchItem';\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAuBA,MAAa,oBAAsC,UAAU,oBAAC,KAAK,MAAN;CAAW,OAAO;CAAO,GAAI;AAAQ,CAAA;AAClG,MAAa,0BAA0B,KAAK;AAC5C,MAAa,oCAAoC,KAAK;AAEtD,MAAM,uBACJ,MACA,cACG;CACH,IAAI,OAAO,cAAc,YAAY,QAAQ,UAAkB,GAAG,MAAM,UAAU,KAAK,CAAC;CACxF,OAAO,GAAG,MAAM,SAAS;AAC3B;AASA,MAAa,uBAAuB,EAClC,U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MAAM,eAAe,gBAAgB,KAAA;CACrC,MAAM,UAAU,eAAe,cAAc;CAE7C,MAAM,sBAAsB,aACzB,eAAwB;EACvB,IAAI,CAAC,cACH,mBAAmB,UAAU;EAE/B,kBAAkB,UAAU;CAC9B,GACA,CAAC,cAAc,eAAe,CAChC;CAEA,OACE,qBAAC,KAAK,MAAN;EACE,GAAI;EACU;EACJ;EACV,YAAY,UACV,GACE,OAAO,MACP,UAAU,OAAO,QACjB,OAAO,cAAc,aAAa,UAAU,KAAK,IAAI,SACvD;EAEF,UAAU,MAAM;GACd,EAAE,eAAe;GACjB,IAAI,CAAC,UACH,oBAAoB,CAAC,OAAO;EAEhC;EAhBF,UAAA,CAkBG,UACD,oBAAC,QAAD;GACE,OAAO;IAAE,SAAS;IAAe,mBAAmB;GAAG;GACvD,UAAU,MAAM,EAAE,gBAAgB;GAElC,UAAA,oBAAC,QAAD;IACW;IACC;IACV,MAAK;IACL,UAAU;IACV,UAAU;IACV,UAAU,GAAG,MAAM,EAAE,gBAAgB;GACtC,CAAA;EACG,CAAA,CACG;;AAEf;AAEA,uBAAuB,cAAc"}
@@ -1,5 +1,4 @@
1
1
  import { IconAlign, IconSpaceMode, RenderOptions } from "../../Menu/renderUtils.mjs";
2
- import "../../Menu/index.mjs";
3
2
  import { DropdownItem } from "./type.mjs";
4
3
  import { ReactNode } from "react";
5
4
  //#region src/base-ui/DropdownMenu/renderItems.d.ts
@@ -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,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,0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"],"sourcesContent":["import { Check } from 'lucide-react';\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 type { BaseMenuItemGroupType, BaseSubMenuType } from '@/Menu/baseItem';\nimport {\n getItemKey,\n getItemLabel,\n hasAnyIcon,\n hasCheckboxAndIcon,\n renderIcon,\n type RenderItemContentOptions,\n type RenderOptions,\n} from '@/Menu/renderUtils';\nimport type { MenuDividerType, MenuInfo, MenuItemType } from '@/Menu/type';\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/renderUtils';\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":";;;;;;;AAqDA,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;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E,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"}
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import FlexBasic_default from "../../../Flex/FlexBasic.mjs";
3
- import Tag from "../../../Tag/Tag.mjs";
3
+ import Tag from "../../Tag/Tag.mjs";
4
4
  import { titleStyles } from "../style.mjs";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import { cx } from "antd-style";
@@ -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;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
+ {"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 Tag from '@/base-ui/Tag';\nimport { Flexbox } from '@/Flex';\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"}
@@ -3,8 +3,8 @@ import "../../Flex/index.mjs";
3
3
  import { DivProps } from "../../types/index.mjs";
4
4
  import { IconProps } from "../../Icon/type.mjs";
5
5
  import "../../Icon/index.mjs";
6
- import { TagProps } from "../../Tag/type.mjs";
7
- import "../../Tag/index.mjs";
6
+ import { TagProps } from "../Tag/type.mjs";
7
+ import "../Tag/index.mjs";
8
8
  import { ButtonProps } from "../Button/type.mjs";
9
9
  import "../Button/index.mjs";
10
10
  import { CSSProperties, ComponentProps, ReactNode, Ref } from "react";
@@ -0,0 +1,32 @@
1
+ "use client";
2
+ import Icon from "../../Icon/Icon.mjs";
3
+ import common_default from "../../i18n/resources/en/common.mjs";
4
+ import { useTranslation } from "../../i18n/useTranslation.mjs";
5
+ import { styles } from "./style.mjs";
6
+ import { memo } from "react";
7
+ import { jsx } from "react/jsx-runtime";
8
+ import { cx } from "antd-style";
9
+ import { X } from "lucide-react";
10
+ //#region src/base-ui/Input/ClearButton.tsx
11
+ const ClearButton = memo(({ className, onClear }) => {
12
+ const { t } = useTranslation(common_default);
13
+ return /* @__PURE__ */ jsx("button", {
14
+ "aria-label": t("common.clear"),
15
+ className: cx(styles.clear, className),
16
+ "data-lobe-input-clear": "",
17
+ tabIndex: -1,
18
+ type: "button",
19
+ onClick: onClear,
20
+ onMouseDown: (event) => event.preventDefault(),
21
+ children: /* @__PURE__ */ jsx(Icon, {
22
+ icon: X,
23
+ size: 10,
24
+ style: { strokeWidth: 3 }
25
+ })
26
+ });
27
+ });
28
+ ClearButton.displayName = "InputClearButton";
29
+ //#endregion
30
+ export { ClearButton as default };
31
+
32
+ //# sourceMappingURL=ClearButton.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClearButton.mjs","names":["common"],"sources":["../../../src/base-ui/Input/ClearButton.tsx"],"sourcesContent":["'use client';\n\nimport { cx } from 'antd-style';\nimport { X } from 'lucide-react';\nimport { memo } from 'react';\n\nimport common from '@/i18n/resources/en/common';\nimport { useTranslation } from '@/i18n/useTranslation';\nimport Icon from '@/Icon';\n\nimport { styles } from './style';\n\ninterface ClearButtonProps {\n className?: string;\n onClear: () => void;\n}\n\nconst ClearButton = memo<ClearButtonProps>(({ className, onClear }) => {\n const { t } = useTranslation(common);\n\n return (\n <button\n aria-label={t('common.clear')}\n className={cx(styles.clear, className)}\n data-lobe-input-clear=\"\"\n tabIndex={-1}\n type=\"button\"\n onClick={onClear}\n onMouseDown={(event) => event.preventDefault()}\n >\n <Icon icon={X} size={10} style={{ strokeWidth: 3 }} />\n </button>\n );\n});\n\nClearButton.displayName = 'InputClearButton';\n\nexport default ClearButton;\n"],"mappings":";;;;;;;;;;AAiBA,MAAM,cAAc,MAAwB,EAAE,WAAW,cAAc;CACrE,MAAM,EAAE,MAAM,eAAeA,cAAM;CAEnC,OACE,oBAAC,UAAD;EACE,cAAY,EAAE,cAAc;EAC5B,WAAW,GAAG,OAAO,OAAO,SAAS;EACrC,yBAAsB;EACtB,UAAU;EACV,MAAK;EACL,SAAS;EACT,cAAc,UAAU,MAAM,eAAe;EAE7C,UAAA,oBAAC,MAAD;GAAM,MAAM;GAAG,MAAM;GAAI,OAAO,EAAE,aAAa,EAAE;EAAI,CAAA;CAC/C,CAAA;AAEZ,CAAC;AAED,YAAY,cAAc"}
@@ -1,17 +1,28 @@
1
1
  "use client";
2
2
  import { rootVariants, styles } from "./style.mjs";
3
- import { memo } from "react";
3
+ import ClearButton from "./ClearButton.mjs";
4
+ import { clearNativeValue } from "./clearNativeValue.mjs";
5
+ import { isPressEnter } from "./pressEnter.mjs";
6
+ import { memo, useRef, useState } from "react";
4
7
  import { jsx, jsxs } from "react/jsx-runtime";
5
8
  import { cx, useThemeMode } from "antd-style";
9
+ import { useMergeRefs } from "react-merge-refs";
6
10
  import { Input } from "@base-ui/react/input";
7
11
  //#region src/base-ui/Input/Input.tsx
8
- const Input$1 = memo(({ ref, className, classNames, styles: customStyles, style, variant, shadow, size = "middle", prefix, suffix, disabled, ...rest }) => {
12
+ const hasText = (value) => value !== void 0 && value !== null && String(value).length > 0;
13
+ const Input$1 = memo(({ ref, className, classNames, styles: customStyles, style, variant, shadow, size = "middle", prefix, suffix, disabled, readOnly, allowClear, onClear, onPressEnter, onKeyDown, onChange, value, defaultValue, ...rest }) => {
9
14
  const { isDarkMode } = useThemeMode();
15
+ const mergedVariant = variant || (isDarkMode ? "filled" : "outlined");
16
+ const inputRef = useRef(null);
17
+ const mergedRef = useMergeRefs([ref, inputRef]);
18
+ const [filled, setFilled] = useState(() => hasText(value ?? defaultValue));
19
+ const isFilled = value === void 0 ? filled : hasText(value);
20
+ const showClear = allowClear && isFilled && !disabled && !readOnly;
10
21
  return /* @__PURE__ */ jsxs("div", {
11
22
  className: cx(rootVariants({
12
23
  shadow,
13
24
  size,
14
- variant: variant || (isDarkMode ? "filled" : "outlined")
25
+ variant: mergedVariant
15
26
  }), className),
16
27
  "data-disabled": disabled ? "" : void 0,
17
28
  style,
@@ -23,11 +34,26 @@ const Input$1 = memo(({ ref, className, classNames, styles: customStyles, style,
23
34
  }),
24
35
  /* @__PURE__ */ jsx(Input, {
25
36
  className: cx(styles.input, classNames?.input),
37
+ defaultValue,
26
38
  disabled,
27
- ref,
39
+ readOnly,
40
+ ref: mergedRef,
28
41
  style: customStyles?.input,
42
+ value,
43
+ onChange: (event) => {
44
+ setFilled(event.currentTarget.value.length > 0);
45
+ onChange?.(event);
46
+ },
47
+ onKeyDown: (event) => {
48
+ if (isPressEnter(event)) onPressEnter?.(event);
49
+ onKeyDown?.(event);
50
+ },
29
51
  ...rest
30
52
  }),
53
+ showClear && /* @__PURE__ */ jsx(ClearButton, { onClear: () => {
54
+ clearNativeValue(inputRef.current);
55
+ onClear?.();
56
+ } }),
31
57
  suffix && /* @__PURE__ */ jsx("span", {
32
58
  className: cx(styles.slot, classNames?.suffix),
33
59
  style: customStyles?.suffix,
@@ -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;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
+ {"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, useRef, useState } from 'react';\nimport { useMergeRefs } from 'react-merge-refs';\n\nimport ClearButton from './ClearButton';\nimport { clearNativeValue } from './clearNativeValue';\nimport { isPressEnter } from './pressEnter';\nimport { rootVariants, styles } from './style';\nimport type { InputProps } from './type';\n\nconst hasText = (value: unknown) =>\n value !== undefined && value !== null && String(value).length > 0;\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 readOnly,\n allowClear,\n onClear,\n onPressEnter,\n onKeyDown,\n onChange,\n value,\n defaultValue,\n ...rest\n }) => {\n const { isDarkMode } = useThemeMode();\n const mergedVariant = variant || (isDarkMode ? 'filled' : 'outlined');\n const inputRef = useRef<HTMLInputElement>(null);\n const mergedRef = useMergeRefs([ref, inputRef]);\n const [filled, setFilled] = useState(() => hasText(value ?? defaultValue));\n const isFilled = value === undefined ? filled : hasText(value);\n const showClear = allowClear && isFilled && !disabled && !readOnly;\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 defaultValue={defaultValue}\n disabled={disabled}\n readOnly={readOnly}\n ref={mergedRef}\n style={customStyles?.input}\n value={value}\n onChange={(event) => {\n setFilled(event.currentTarget.value.length > 0);\n onChange?.(event);\n }}\n onKeyDown={(event) => {\n if (isPressEnter(event)) onPressEnter?.(event);\n onKeyDown?.(event);\n }}\n {...rest}\n />\n {showClear && (\n <ClearButton\n onClear={() => {\n clearNativeValue(inputRef.current);\n onClear?.();\n }}\n />\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":";;;;;;;;;;;AAaA,MAAM,WAAW,UACf,UAAU,KAAA,KAAa,UAAU,QAAQ,OAAO,KAAK,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;EAEL;;AAET,CACF;AAEA,QAAM,cAAc"}
@@ -1,15 +1,21 @@
1
1
  "use client";
2
2
  import Icon from "../../Icon/Icon.mjs";
3
3
  import { rootVariants, styles } from "./style.mjs";
4
+ import { isPressEnter } from "./pressEnter.mjs";
4
5
  import { memo } from "react";
5
6
  import { jsx, jsxs } from "react/jsx-runtime";
6
7
  import { cx, useThemeMode } from "antd-style";
7
8
  import { ChevronDown, ChevronUp } from "lucide-react";
8
9
  import { NumberField } from "@base-ui/react/number-field";
9
10
  //#region src/base-ui/Input/InputNumber.tsx
10
- const InputNumber = memo(({ ref, className, classNames, styles: customStyles, style, variant, shadow, size = "middle", controls = true, changeOnWheel, onChange, placeholder, ...rest }) => {
11
+ const InputNumber = memo(({ ref, className, classNames, styles: customStyles, style, variant, shadow, size = "middle", controls = true, changeOnWheel, onChange, placeholder, format, precision, prefix, suffix, onPressEnter, ...rest }) => {
11
12
  const { isDarkMode } = useThemeMode();
12
13
  const mergedVariant = variant || (isDarkMode ? "filled" : "outlined");
14
+ const mergedFormat = precision === void 0 ? format : {
15
+ ...format,
16
+ maximumFractionDigits: precision,
17
+ minimumFractionDigits: precision
18
+ };
13
19
  return /* @__PURE__ */ jsxs(NumberField.Root, {
14
20
  allowWheelScrub: changeOnWheel,
15
21
  className: cx(rootVariants({
@@ -17,30 +23,45 @@ const InputNumber = memo(({ ref, className, classNames, styles: customStyles, st
17
23
  size,
18
24
  variant: mergedVariant
19
25
  }), className),
26
+ format: mergedFormat,
20
27
  style,
21
28
  onValueChange: onChange,
22
29
  ...rest,
23
- children: [/* @__PURE__ */ jsx(NumberField.Input, {
24
- className: cx(styles.input, styles.numberInput, classNames?.input),
25
- placeholder,
26
- ref,
27
- style: customStyles?.input
28
- }), controls && /* @__PURE__ */ jsxs("div", {
29
- className: styles.numberControls,
30
- children: [/* @__PURE__ */ jsx(NumberField.Increment, {
31
- className: styles.numberControl,
32
- children: /* @__PURE__ */ jsx(Icon, {
33
- icon: ChevronUp,
34
- size: 12
35
- })
36
- }), /* @__PURE__ */ jsx(NumberField.Decrement, {
37
- className: styles.numberControl,
38
- children: /* @__PURE__ */ jsx(Icon, {
39
- icon: ChevronDown,
40
- size: 12
41
- })
42
- })]
43
- })]
30
+ children: [
31
+ prefix && /* @__PURE__ */ jsx("span", {
32
+ className: styles.slot,
33
+ children: prefix
34
+ }),
35
+ /* @__PURE__ */ jsx(NumberField.Input, {
36
+ className: cx(styles.input, styles.numberInput, classNames?.input),
37
+ placeholder,
38
+ ref,
39
+ style: customStyles?.input,
40
+ onKeyDown: (event) => {
41
+ if (isPressEnter(event)) onPressEnter?.(event);
42
+ }
43
+ }),
44
+ suffix && /* @__PURE__ */ jsx("span", {
45
+ className: styles.slot,
46
+ children: suffix
47
+ }),
48
+ controls && /* @__PURE__ */ jsxs("div", {
49
+ className: styles.numberControls,
50
+ children: [/* @__PURE__ */ jsx(NumberField.Increment, {
51
+ className: styles.numberControl,
52
+ children: /* @__PURE__ */ jsx(Icon, {
53
+ icon: ChevronUp,
54
+ size: 12
55
+ })
56
+ }), /* @__PURE__ */ jsx(NumberField.Decrement, {
57
+ className: styles.numberControl,
58
+ children: /* @__PURE__ */ jsx(Icon, {
59
+ icon: ChevronDown,
60
+ size: 12
61
+ })
62
+ })]
63
+ })
64
+ ]
44
65
  });
45
66
  });
46
67
  InputNumber.displayName = "InputNumber";
@@ -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;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
+ {"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 { isPressEnter } from './pressEnter';\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 format,\n precision,\n prefix,\n suffix,\n onPressEnter,\n ...rest\n }) => {\n const { isDarkMode } = useThemeMode();\n const mergedVariant = variant || (isDarkMode ? 'filled' : 'outlined');\n const mergedFormat =\n precision === undefined\n ? format\n : { ...format, maximumFractionDigits: precision, minimumFractionDigits: precision };\n\n return (\n <NumberField.Root\n allowWheelScrub={changeOnWheel}\n className={cx(rootVariants({ shadow, size, variant: mergedVariant }), className)}\n format={mergedFormat}\n style={style}\n onValueChange={onChange}\n {...rest}\n >\n {prefix && <span className={styles.slot}>{prefix}</span>}\n <NumberField.Input\n className={cx(styles.input, styles.numberInput, classNames?.input)}\n placeholder={placeholder}\n ref={ref}\n style={customStyles?.input}\n onKeyDown={(event) => {\n if (isPressEnter(event)) onPressEnter?.(event);\n }}\n />\n {suffix && <span className={styles.slot}>{suffix}</span>}\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":";;;;;;;;;;AAaA,MAAM,cAAc,MACjB,EACC,KACA,WACA,YACA,QAAQ,cACR,OACA,SACA,QACA,OAAO,UACP,WAAW,MACX,eACA,UACA,aACA,QACA,WACA,QACA,QACA,cACA,GAAG,WACC;CACJ,MAAM,EAAE,eAAe,aAAa;CACpC,MAAM,gBAAgB,YAAY,aAAa,WAAW;CAC1D,MAAM,eACJ,cAAc,KAAA,IACV,SACA;EAAE,GAAG;EAAQ,uBAAuB;EAAW,uBAAuB;CAAU;CAEtF,OACE,qBAAC,YAAY,MAAb;EACE,iBAAiB;EACjB,WAAW,GAAG,aAAa;GAAE;GAAQ;GAAM,SAAS;EAAc,CAAC,GAAG,SAAS;EAC/E,QAAQ;EACD;EACP,eAAe;EACf,GAAI;EANN,UAAA;GAQG,UAAU,oBAAC,QAAD;IAAM,WAAW,OAAO;IAAO,UAAA;GAAa,CAAA;GACvD,oBAAC,YAAY,OAAb;IACE,WAAW,GAAG,OAAO,OAAO,OAAO,aAAa,YAAY,KAAK;IACpD;IACR;IACL,OAAO,cAAc;IACrB,YAAY,UAAU;KACpB,IAAI,aAAa,KAAK,GAAG,eAAe,KAAK;IAC/C;GACD,CAAA;GACA,UAAU,oBAAC,QAAD;IAAM,WAAW,OAAO;IAAO,UAAA;GAAa,CAAA;GACtD,YACC,qBAAC,OAAD;IAAK,WAAW,OAAO;IAAvB,UAAA,CACE,oBAAC,YAAY,WAAb;KAAuB,WAAW,OAAO;KACvC,UAAA,oBAAC,MAAD;MAAM,MAAM;MAAW,MAAM;KAAK,CAAA;IACb,CAAA,GACvB,oBAAC,YAAY,WAAb;KAAuB,WAAW,OAAO;KACvC,UAAA,oBAAC,MAAD;MAAM,MAAM;MAAa,MAAM;KAAK,CAAA;IACf,CAAA,CACpB;;EAES;;AAEtB,CACF;AAEA,YAAY,cAAc"}