@koide-labs/ui 0.0.0 → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (383) hide show
  1. package/README.md +53 -3
  2. package/{src/-types.ts → dist/-types.d.ts} +1 -6
  3. package/dist/-types.js +1 -0
  4. package/dist/-utils.d.ts +19 -0
  5. package/dist/-utils.js +33 -0
  6. package/dist/Button-DrPFFzo7.js +31 -0
  7. package/dist/CompositeRoot-CVk5a-pR.js +233 -0
  8. package/dist/DirectionContext-C2o_MF_i.js +9 -0
  9. package/dist/FieldItemContext-DAvk99to.js +11 -0
  10. package/dist/FloatingPortal-tWyuKRSN.js +435 -0
  11. package/dist/FloatingPortalLite-DVyq6YhV.js +28 -0
  12. package/dist/InternalBackdrop-jYAiOJ8v.js +574 -0
  13. package/dist/LabelableContext-BMvjVwor.js +169 -0
  14. package/dist/ToolbarRootContext-CvvL0Tk1.js +9 -0
  15. package/dist/clamp-D0KDAQIz.js +6 -0
  16. package/dist/clsx-OuTLNxxd.js +16 -0
  17. package/dist/components/accordion/index.d.ts +12 -0
  18. package/dist/components/accordion/index.js +699 -0
  19. package/dist/components/alert-dialog/index.d.ts +26 -0
  20. package/dist/components/alert-dialog/index.js +136 -0
  21. package/dist/components/anchor/index.d.ts +8 -0
  22. package/dist/components/anchor/index.js +38 -0
  23. package/dist/components/avatar/index.d.ts +21 -0
  24. package/dist/components/avatar/index.js +161 -0
  25. package/dist/components/badge/index.d.ts +16 -0
  26. package/dist/components/badge/index.js +40 -0
  27. package/dist/components/button/index.d.ts +24 -0
  28. package/dist/components/button/index.js +47 -0
  29. package/dist/components/checkbox/index.d.ts +9 -0
  30. package/dist/components/checkbox/index.js +269 -0
  31. package/dist/components/code/index.d.ts +9 -0
  32. package/dist/components/code/index.js +10 -0
  33. package/dist/components/collapse/index.d.ts +11 -0
  34. package/dist/components/collapse/index.js +41 -0
  35. package/dist/components/command/index.d.ts +14 -0
  36. package/dist/components/command/index.js +1695 -0
  37. package/dist/components/context-menu/index.d.ts +42 -0
  38. package/dist/components/context-menu/index.js +1444 -0
  39. package/dist/components/dialog/index.d.ts +48 -0
  40. package/dist/components/dialog/index.js +138 -0
  41. package/dist/components/heading/index.d.ts +44 -0
  42. package/dist/components/heading/index.js +56 -0
  43. package/dist/components/icon/icon-names.d.ts +1 -0
  44. package/dist/components/icon/icon-names.js +1 -0
  45. package/dist/components/icon/index.d.ts +23 -0
  46. package/dist/components/icon/index.js +43 -0
  47. package/dist/components/icon-button/index.d.ts +12 -0
  48. package/dist/components/icon-button/index.js +45 -0
  49. package/dist/components/inline-code/index.d.ts +6 -0
  50. package/dist/components/inline-code/index.js +22 -0
  51. package/dist/components/input/index.d.ts +3 -0
  52. package/dist/components/input/index.js +119 -0
  53. package/dist/components/meter/index.d.ts +18 -0
  54. package/dist/components/meter/index.js +165 -0
  55. package/dist/components/multiline-input/index.d.ts +6 -0
  56. package/dist/components/multiline-input/index.js +100 -0
  57. package/dist/components/number-input/index.d.ts +10 -0
  58. package/dist/components/number-input/index.js +1169 -0
  59. package/dist/components/password-input/index.d.ts +2 -0
  60. package/dist/components/password-input/index.js +29 -0
  61. package/dist/components/pill/index.d.ts +13 -0
  62. package/dist/components/pill/index.js +38 -0
  63. package/dist/components/popover/index.d.ts +21 -0
  64. package/dist/components/popover/index.js +636 -0
  65. package/dist/components/preview-card/index.d.ts +17 -0
  66. package/dist/components/preview-card/index.js +402 -0
  67. package/dist/components/radio/index.d.ts +13 -0
  68. package/dist/components/radio/index.js +404 -0
  69. package/dist/components/search-bar/index.d.ts +12 -0
  70. package/dist/components/search-bar/index.js +48 -0
  71. package/dist/components/select/index.d.ts +16 -0
  72. package/dist/components/select/index.js +1263 -0
  73. package/dist/components/separator/index.d.ts +7 -0
  74. package/dist/components/separator/index.js +6 -0
  75. package/dist/components/slider/index.d.ts +5 -0
  76. package/dist/components/slider/index.js +902 -0
  77. package/dist/components/spinner/index.d.ts +2 -0
  78. package/dist/components/spinner/index.js +13 -0
  79. package/dist/components/stacked-avatars/index.d.ts +14 -0
  80. package/dist/components/stacked-avatars/index.js +92 -0
  81. package/dist/components/status-banner/index.d.ts +17 -0
  82. package/dist/components/status-banner/index.js +69 -0
  83. package/dist/components/surface/index.d.ts +27 -0
  84. package/dist/components/surface/index.js +41 -0
  85. package/dist/components/switch/index.d.ts +5 -0
  86. package/dist/components/switch/index.js +196 -0
  87. package/dist/components/tabs/index.d.ts +18 -0
  88. package/dist/components/tabs/index.js +509 -0
  89. package/dist/components/text/index.d.ts +26 -0
  90. package/dist/components/text/index.js +51 -0
  91. package/dist/components/theme-provider/index.d.ts +2 -0
  92. package/dist/components/theme-provider/index.js +6 -0
  93. package/dist/components/theme-provider/theme-context.d.ts +9 -0
  94. package/dist/components/theme-provider/theme-context.js +13 -0
  95. package/dist/components/theme-provider/theme-provider.d.ts +17 -0
  96. package/dist/components/theme-provider/theme-provider.js +30 -0
  97. package/dist/components/timestamp/index.d.ts +23 -0
  98. package/dist/components/timestamp/index.js +1392 -0
  99. package/dist/components/toast/index.d.ts +2 -0
  100. package/dist/components/toast/index.js +7 -0
  101. package/dist/components/toast/toast.d.ts +2 -0
  102. package/dist/components/toast/toast.js +878 -0
  103. package/dist/components/toast/use-toast-manager.d.ts +27 -0
  104. package/dist/components/toast/use-toast-manager.js +4 -0
  105. package/dist/components/tooltip/index.d.ts +14 -0
  106. package/dist/components/tooltip/index.js +712 -0
  107. package/dist/components/tooltip/tooltip-arrow.d.ts +3 -0
  108. package/dist/components/tooltip/tooltip-arrow.js +6 -0
  109. package/dist/components/view/index.d.ts +30 -0
  110. package/dist/components/view/index.js +84 -0
  111. package/dist/components/visually-hidden/index.d.ts +1 -0
  112. package/dist/components/visually-hidden/index.js +4 -0
  113. package/dist/composite-Bx7Szd_T.js +208 -0
  114. package/dist/composite-C9L5QmZL.js +66 -0
  115. package/dist/createBaseUIEventDetails-D8M2Yl-a.js +59 -0
  116. package/dist/detectBrowser-I-s3yzIE.js +43 -0
  117. package/dist/dialog.css +1 -0
  118. package/dist/dialog.module-BeF-6XAo.js +415 -0
  119. package/dist/element-CZEOj04G.js +80 -0
  120. package/dist/event-CKoGyQEJ.js +30 -0
  121. package/dist/floating-ui.utils-C7pRWMZ_.js +128 -0
  122. package/dist/floating-ui.utils.dom-C7FS5id0.js +135 -0
  123. package/dist/formatErrorMessage-BqPuTBN-.js +7 -0
  124. package/dist/formatNumber-1UNwjeqf.js +25 -0
  125. package/dist/getDisabledMountTransitionStyles-YfHPge6T.js +1510 -0
  126. package/dist/index-BX1XbbRk.js +1206 -0
  127. package/dist/index-CeuccO-T.js +109 -0
  128. package/dist/index-DN9Bn1qm.js +29 -0
  129. package/dist/index-FMoPxlJ2.js +52 -0
  130. package/dist/index.css +1 -0
  131. package/dist/index.d.ts +42 -0
  132. package/dist/index.js +108 -0
  133. package/dist/index10.css +1 -0
  134. package/dist/index11.css +1 -0
  135. package/dist/index12.css +1 -0
  136. package/dist/index13.css +1 -0
  137. package/dist/index14.css +1 -0
  138. package/dist/index15.css +1 -0
  139. package/dist/index16.css +1 -0
  140. package/dist/index17.css +1 -0
  141. package/dist/index18.css +1 -0
  142. package/dist/index19.css +1 -0
  143. package/dist/index2.css +1 -0
  144. package/dist/index20.css +1 -0
  145. package/dist/index21.css +1 -0
  146. package/dist/index22.css +1 -0
  147. package/dist/index23.css +1 -0
  148. package/dist/index24.css +1 -0
  149. package/dist/index25.css +1 -0
  150. package/dist/index26.css +1 -0
  151. package/dist/index27.css +1 -0
  152. package/dist/index28.css +1 -0
  153. package/dist/index29.css +1 -0
  154. package/dist/index3.css +1 -0
  155. package/dist/index30.css +1 -0
  156. package/dist/index31.css +1 -0
  157. package/dist/index32.css +1 -0
  158. package/dist/index33.css +1 -0
  159. package/dist/index34.css +1 -0
  160. package/dist/index35.css +1 -0
  161. package/dist/index36.css +1 -0
  162. package/dist/index37.css +1 -0
  163. package/dist/index4.css +1 -0
  164. package/dist/index5.css +1 -0
  165. package/dist/index6.css +1 -0
  166. package/dist/index7.css +1 -0
  167. package/dist/index8.css +1 -0
  168. package/dist/index9.css +1 -0
  169. package/dist/inertValue-BCYGsdmf.js +7 -0
  170. package/dist/input.css +1 -0
  171. package/dist/input.module-DDQY_Ij6.js +7 -0
  172. package/dist/integrations/react-markdown/index.d.ts +5 -0
  173. package/dist/integrations/react-markdown/index.js +6895 -0
  174. package/dist/integrations/remix/index.d.ts +9 -0
  175. package/{src/integrations/remix.ts → dist/integrations/remix/index.js} +7 -4
  176. package/dist/integrations/tailwind.css +1 -0
  177. package/dist/integrations/twemoij/index.d.ts +3 -0
  178. package/dist/integrations/twemoij/index.js +18 -0
  179. package/dist/isElementDisabled-Cbd8W9kH.js +6 -0
  180. package/dist/owner-rKN292Q9.js +6 -0
  181. package/dist/safePolygon-DWy1dGKJ.js +308 -0
  182. package/dist/styles/core.css +1 -0
  183. package/dist/styles/tokens.d.ts +400 -0
  184. package/{src/styles/tokens.ts → dist/styles/tokens.js} +54 -96
  185. package/dist/toast.css +1 -0
  186. package/dist/tooltip-arrow-C1qXdi5T.js +24 -0
  187. package/dist/tooltip-arrow.css +1 -0
  188. package/dist/transitions.css +1 -0
  189. package/dist/transitions.module-CWX8e5cx.js +1343 -0
  190. package/dist/use-toast-manager-Dq-44AuW.js +37 -0
  191. package/dist/useAnimationFrame-451ugS_6.js +68 -0
  192. package/dist/useBaseUiId-B7WyxtIE.js +7 -0
  193. package/dist/useButton-DfIwsdb8.js +127 -0
  194. package/dist/useCompositeListItem-OkcAim_1.js +148 -0
  195. package/dist/useControlled-Du4sJyMj.js +31 -0
  196. package/dist/useHoverReferenceInteraction-SfOBPoXM.js +264 -0
  197. package/dist/useId-C5kyn6tA.js +22 -0
  198. package/dist/useIsoLayoutEffect-CIDbvm3Q.js +6 -0
  199. package/dist/useLabelableId-Ci_jDvmv.js +29 -0
  200. package/dist/useOnMount-VRW6CK2u.js +8 -0
  201. package/dist/useOpenChangeComplete-Dse9kY9E.js +61 -0
  202. package/dist/usePopupAutoResize-CNR6Ekmx.js +85 -0
  203. package/dist/useRender-CLx7dR_1.js +7 -0
  204. package/dist/useRenderElement-DwToLA61.js +244 -0
  205. package/dist/useRole-oDBdbuwQ.js +77 -0
  206. package/dist/useStableCallback-CkTrVkNX.js +29 -0
  207. package/dist/useSyncedFloatingRootContext-Dorsv-jf.js +167 -0
  208. package/dist/useTimeout-CflX-kz3.js +32 -0
  209. package/dist/useTransitionStatus-CUfcuGAV.js +42 -0
  210. package/dist/useTypeahead-D85V2IUx.js +333 -0
  211. package/dist/useValueAsRef-HURLzret.js +19 -0
  212. package/dist/useValueChanged-DL757-yD.js +14 -0
  213. package/dist/valueToPercent-DaP9qN4u.js +6 -0
  214. package/dist/view.css +1 -0
  215. package/dist/view.module-DfDLgJE0.js +6 -0
  216. package/dist/visuallyHidden-CpJ-mhai.js +16 -0
  217. package/dist/warn-CKtX8MLJ.js +11 -0
  218. package/package.json +18 -2
  219. package/.husky/pre-commit +0 -1
  220. package/.storybook/main.ts +0 -25
  221. package/.storybook/preview-head.html +0 -6
  222. package/.storybook/preview.tsx +0 -48
  223. package/.storybook/vitest.setup.ts +0 -8
  224. package/eslint.config.mjs +0 -29
  225. package/lint-staged.config.js +0 -15
  226. package/pnpm-workspace.yaml +0 -2
  227. package/postcss.config.mjs +0 -7
  228. package/prettier.config.mjs +0 -24
  229. package/scripts/build-icon-types.ts +0 -38
  230. package/src/-utils.tsx +0 -64
  231. package/src/components/accordion/accordion.module.css +0 -44
  232. package/src/components/accordion/accordion.stories.tsx +0 -36
  233. package/src/components/accordion/index.tsx +0 -67
  234. package/src/components/alert-dialog/alert-dialog.module.css +0 -5
  235. package/src/components/alert-dialog/alert-dialog.stories.tsx +0 -53
  236. package/src/components/alert-dialog/index.tsx +0 -138
  237. package/src/components/anchor/anchor.module.css +0 -18
  238. package/src/components/anchor/anchor.stories.tsx +0 -28
  239. package/src/components/anchor/index.tsx +0 -45
  240. package/src/components/avatar/avatar.module.css +0 -56
  241. package/src/components/avatar/avatar.stories.tsx +0 -61
  242. package/src/components/avatar/index.tsx +0 -82
  243. package/src/components/badge/badge.module.css +0 -35
  244. package/src/components/badge/badge.stories.tsx +0 -60
  245. package/src/components/badge/index.tsx +0 -71
  246. package/src/components/button/button.module.css +0 -42
  247. package/src/components/button/button.stories.tsx +0 -108
  248. package/src/components/button/index.tsx +0 -63
  249. package/src/components/checkbox/checkbox.module.css +0 -36
  250. package/src/components/checkbox/checkbox.stories.tsx +0 -21
  251. package/src/components/checkbox/index.tsx +0 -41
  252. package/src/components/code/code.module.css +0 -20
  253. package/src/components/code/code.stories.tsx +0 -42
  254. package/src/components/code/index.tsx +0 -73
  255. package/src/components/collapse/collapse.module.css +0 -27
  256. package/src/components/collapse/collapse.stories.tsx +0 -27
  257. package/src/components/collapse/index.tsx +0 -59
  258. package/src/components/command/command.module.css +0 -95
  259. package/src/components/command/command.stories.tsx +0 -38
  260. package/src/components/command/index.tsx +0 -108
  261. package/src/components/context-menu/context-menu.module.css +0 -36
  262. package/src/components/context-menu/context-menu.stories.tsx +0 -99
  263. package/src/components/context-menu/index.tsx +0 -242
  264. package/src/components/dialog/dialog.module.css +0 -71
  265. package/src/components/dialog/dialog.stories.tsx +0 -29
  266. package/src/components/dialog/index.tsx +0 -148
  267. package/src/components/heading/heading.module.css +0 -3
  268. package/src/components/heading/heading.stories.tsx +0 -52
  269. package/src/components/heading/index.tsx +0 -112
  270. package/src/components/icon/icon-names.ts +0 -3189
  271. package/src/components/icon/icon.module.css +0 -36
  272. package/src/components/icon/icon.stories.tsx +0 -40
  273. package/src/components/icon/index.tsx +0 -60
  274. package/src/components/icon-button/icon-button.module.css +0 -33
  275. package/src/components/icon-button/icon-button.stories.tsx +0 -59
  276. package/src/components/icon-button/index.tsx +0 -48
  277. package/src/components/inline-code/index.tsx +0 -29
  278. package/src/components/inline-code/inline-code.module.css +0 -13
  279. package/src/components/inline-code/inline-code.stories.tsx +0 -31
  280. package/src/components/input/index.tsx +0 -22
  281. package/src/components/input/input.module.css +0 -23
  282. package/src/components/input/input.stories.tsx +0 -52
  283. package/src/components/meter/index.tsx +0 -55
  284. package/src/components/meter/meter.module.css +0 -23
  285. package/src/components/meter/meter.stories.tsx +0 -31
  286. package/src/components/multiline-input/index.tsx +0 -58
  287. package/src/components/multiline-input/multiline-input.stories.tsx +0 -26
  288. package/src/components/number-input/index.tsx +0 -74
  289. package/src/components/number-input/number-input.module.css +0 -41
  290. package/src/components/number-input/number-input.stories.tsx +0 -24
  291. package/src/components/password-input/index.tsx +0 -24
  292. package/src/components/password-input/password-input.module.css +0 -10
  293. package/src/components/password-input/password-input.stories.tsx +0 -24
  294. package/src/components/pill/index.tsx +0 -45
  295. package/src/components/pill/pill.module.css +0 -22
  296. package/src/components/pill/pill.stories.tsx +0 -83
  297. package/src/components/popover/index.tsx +0 -94
  298. package/src/components/popover/popover.module.css +0 -8
  299. package/src/components/popover/popover.stories.tsx +0 -53
  300. package/src/components/preview-card/index.tsx +0 -68
  301. package/src/components/preview-card/preview-card.module.css +0 -5
  302. package/src/components/preview-card/preview-card.stories.tsx +0 -58
  303. package/src/components/radio/index.tsx +0 -67
  304. package/src/components/radio/radio-group.module.css +0 -5
  305. package/src/components/radio/radio.module.css +0 -36
  306. package/src/components/radio/radio.stories.tsx +0 -27
  307. package/src/components/search-bar/index.tsx +0 -60
  308. package/src/components/search-bar/search-bar.module.css +0 -29
  309. package/src/components/search-bar/search-bar.stories.tsx +0 -37
  310. package/src/components/select/index.tsx +0 -132
  311. package/src/components/select/select.module.css +0 -63
  312. package/src/components/select/select.stories.tsx +0 -49
  313. package/src/components/separator/index.tsx +0 -28
  314. package/src/components/separator/separator.module.css +0 -24
  315. package/src/components/separator/separator.stories.tsx +0 -40
  316. package/src/components/slider/index.tsx +0 -28
  317. package/src/components/slider/slider.module.css +0 -52
  318. package/src/components/slider/slider.stories.tsx +0 -53
  319. package/src/components/spinner/index.tsx +0 -14
  320. package/src/components/spinner/spinner.module.css +0 -13
  321. package/src/components/spinner/spinner.stories.tsx +0 -17
  322. package/src/components/stacked-avatars/index.tsx +0 -88
  323. package/src/components/stacked-avatars/stacked-avatars.module.css +0 -79
  324. package/src/components/stacked-avatars/stacked-avatars.stories.tsx +0 -48
  325. package/src/components/status-banner/index.tsx +0 -96
  326. package/src/components/status-banner/status-banner.module.css +0 -52
  327. package/src/components/status-banner/status-banner.stories.tsx +0 -44
  328. package/src/components/surface/index.tsx +0 -83
  329. package/src/components/surface/surface.module.css +0 -35
  330. package/src/components/surface/surface.stories.tsx +0 -84
  331. package/src/components/switch/index.tsx +0 -23
  332. package/src/components/switch/switch.module.css +0 -45
  333. package/src/components/switch/switch.stories.tsx +0 -48
  334. package/src/components/tabs/index.tsx +0 -126
  335. package/src/components/tabs/tabs.module.css +0 -134
  336. package/src/components/tabs/tabs.stories.tsx +0 -88
  337. package/src/components/text/index.tsx +0 -69
  338. package/src/components/text/text.module.css +0 -76
  339. package/src/components/text/text.stories.tsx +0 -107
  340. package/src/components/theme-provider/index.ts +0 -2
  341. package/src/components/theme-provider/theme-context.tsx +0 -18
  342. package/src/components/theme-provider/theme-provider.stories.tsx +0 -47
  343. package/src/components/theme-provider/theme-provider.tsx +0 -77
  344. package/src/components/timestamp/index.tsx +0 -131
  345. package/src/components/timestamp/timestamp.module.css +0 -8
  346. package/src/components/timestamp/timestamp.stories.tsx +0 -37
  347. package/src/components/toast/index.ts +0 -2
  348. package/src/components/toast/toast.module.css +0 -163
  349. package/src/components/toast/toast.stories.tsx +0 -53
  350. package/src/components/toast/toast.tsx +0 -104
  351. package/src/components/toast/use-toast-manager.ts +0 -63
  352. package/src/components/tooltip/index.tsx +0 -61
  353. package/src/components/tooltip/tooltip-arrow.tsx +0 -17
  354. package/src/components/tooltip/tooltip.module.css +0 -44
  355. package/src/components/tooltip/tooltip.stories.tsx +0 -76
  356. package/src/components/view/index.tsx +0 -137
  357. package/src/components/view/view.module.css +0 -11
  358. package/src/components/view/view.stories.tsx +0 -131
  359. package/src/components/view/view_colorway.module.css +0 -280
  360. package/src/components/view/view_interactive.module.css +0 -127
  361. package/src/components/view/view_loading.module.css +0 -58
  362. package/src/components/visually-hidden/index.ts +0 -1
  363. package/src/index.ts +0 -49
  364. package/src/integrations/react-markdown/index.tsx +0 -134
  365. package/src/integrations/react-markdown/react-markdown.module.css +0 -62
  366. package/src/integrations/react-markdown/react-markdown.stories.tsx +0 -31
  367. package/src/integrations/tailwind.css +0 -173
  368. package/src/integrations/twemoij/index.tsx +0 -13
  369. package/src/integrations/twemoij/twemoji.module.css +0 -7
  370. package/src/integrations/twemoij/twemoji.stories.tsx +0 -40
  371. package/src/stories/components/all-variants.tsx +0 -40
  372. package/src/stories/data.ts +0 -72
  373. package/src/stories/utils.ts +0 -20
  374. package/src/styles/core.css +0 -153
  375. package/src/styles/themes/dark.css +0 -86
  376. package/src/styles/themes/light.css +0 -86
  377. package/src/styles/transitions.module.css +0 -31
  378. package/stylelint.config.mjs +0 -29
  379. package/tsconfig.app.json +0 -35
  380. package/tsconfig.json +0 -7
  381. package/tsconfig.node.json +0 -26
  382. package/vite.config.ts +0 -103
  383. package/vitest.shims.d.ts +0 -1
@@ -0,0 +1,1444 @@
1
+ import { jsx as c, jsxs as ee } from "react/jsx-runtime";
2
+ import { c as de } from "../../clsx-OuTLNxxd.js";
3
+ import * as t from "react";
4
+ import { createContext as Kt, useContext as Wt } from "react";
5
+ import { textify as Ce } from "../../-utils.js";
6
+ import { tokens as st } from "../../styles/tokens.js";
7
+ import { Icon as ce } from "../icon/index.js";
8
+ import { S as Xt, a as jt } from "../../index-FMoPxlJ2.js";
9
+ import { Surface as it } from "../surface/index.js";
10
+ import { Text as at } from "../text/index.js";
11
+ import { View as Re } from "../view/index.js";
12
+ import { p as ut, k as qt, R as $t, P as Jt, c as U, m as Qt, j as Zt, u as en, d as tn, e as ct, h as nn, f as on, i as rn, t as lt } from "../../transitions.module-CWX8e5cx.js";
13
+ import { u as dt } from "../../useControlled-Du4sJyMj.js";
14
+ import { u as le } from "../../useStableCallback-CkTrVkNX.js";
15
+ import { f as J } from "../../formatErrorMessage-BqPuTBN-.js";
16
+ import { m as Se, c as sn, u as Y, a as an, E as un, b as cn } from "../../useRenderElement-DwToLA61.js";
17
+ import { u as pt } from "../../useId-C5kyn6tA.js";
18
+ import * as ln from "react-dom";
19
+ import { u as Me } from "../../useTimeout-CflX-kz3.js";
20
+ import { u as Te } from "../../useIsoLayoutEffect-CIDbvm3Q.js";
21
+ import { u as dn } from "../../useAnimationFrame-451ugS_6.js";
22
+ import { F as pn, I as fn, u as mn, a as gn, b as hn } from "../../InternalBackdrop-jYAiOJ8v.js";
23
+ import { h as xn, m as Mn, P as Cn, T as Rn } from "../../FloatingPortal-tWyuKRSN.js";
24
+ import { u as bn } from "../../DirectionContext-C2o_MF_i.js";
25
+ import { x as be, c as $, o as vn, t as xe, y as ue, b as et, a as ft, f as En, l as In, e as yn, i as Nn, v as Pn } from "../../createBaseUIEventDetails-D8M2Yl-a.js";
26
+ import { p as Sn, c as Tn, u as On, a as kn, b as _n, e as wn } from "../../useSyncedFloatingRootContext-Dorsv-jf.js";
27
+ import { u as Dn } from "../../useRole-oDBdbuwQ.js";
28
+ import { u as Vn, a as An } from "../../useTypeahead-D85V2IUx.js";
29
+ import { o as tt } from "../../owner-rKN292Q9.js";
30
+ import { i as Un, o as Ln, n as Fn } from "../../floating-ui.utils.dom-C7FS5id0.js";
31
+ import { e as nt, f as he } from "../../element-CZEOj04G.js";
32
+ import { s as Bn } from "../../event-CKoGyQEJ.js";
33
+ import { i as Gn } from "../../inertValue-BCYGsdmf.js";
34
+ import { g as Hn, a as Yn } from "../../getDisabledMountTransitionStyles-YfHPge6T.js";
35
+ import { u as ve, C as zn } from "../../useCompositeListItem-OkcAim_1.js";
36
+ import { t as mt, a as Oe } from "../../useOpenChangeComplete-Dse9kY9E.js";
37
+ import { u as Kn } from "../../ToolbarRootContext-CvvL0Tk1.js";
38
+ import { C as Wn } from "../../composite-C9L5QmZL.js";
39
+ import { a as Xn, u as jn } from "../../useHoverReferenceInteraction-SfOBPoXM.js";
40
+ import { u as gt } from "../../useTransitionStatus-CUfcuGAV.js";
41
+ import { u as qn } from "../../useButton-DfIwsdb8.js";
42
+ import { u as pe } from "../../useBaseUiId-B7WyxtIE.js";
43
+ import { s as $n } from "../../safePolygon-DWy1dGKJ.js";
44
+ import '../../index34.css';const ke = /* @__PURE__ */ t.createContext(void 0);
45
+ process.env.NODE_ENV !== "production" && (ke.displayName = "ContextMenuRootContext");
46
+ function Ee(e = !0) {
47
+ const o = t.useContext(ke);
48
+ if (o === void 0 && !e)
49
+ throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: ContextMenuRootContext is missing. ContextMenu parts must be placed within <ContextMenu.Root>." : J(25));
50
+ return o;
51
+ }
52
+ const _e = /* @__PURE__ */ t.createContext(void 0);
53
+ process.env.NODE_ENV !== "production" && (_e.displayName = "MenuPositionerContext");
54
+ function fe(e) {
55
+ const o = t.useContext(_e);
56
+ if (o === void 0 && !e)
57
+ throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: MenuPositionerContext is missing. MenuPositioner parts must be placed within <Menu.Positioner>." : J(33));
58
+ return o;
59
+ }
60
+ const Ie = /* @__PURE__ */ t.createContext(void 0);
61
+ process.env.NODE_ENV !== "production" && (Ie.displayName = "MenuRootContext");
62
+ function q(e) {
63
+ const o = t.useContext(Ie);
64
+ if (o === void 0 && !e)
65
+ throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: MenuRootContext is missing. Menu parts must be placed within <Menu.Root>." : J(36));
66
+ return o;
67
+ }
68
+ const we = /* @__PURE__ */ t.createContext(void 0);
69
+ process.env.NODE_ENV !== "production" && (we.displayName = "MenuCheckboxItemContext");
70
+ function Jn() {
71
+ const e = t.useContext(we);
72
+ if (e === void 0)
73
+ throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: MenuCheckboxItemContext is missing. MenuCheckboxItem parts must be placed within <Menu.CheckboxItem>." : J(30));
74
+ return e;
75
+ }
76
+ const De = {
77
+ type: "regular-item"
78
+ };
79
+ function ye(e) {
80
+ const {
81
+ closeOnClick: o,
82
+ disabled: i = !1,
83
+ highlighted: C,
84
+ id: E,
85
+ store: d,
86
+ nativeButton: R,
87
+ itemMetadata: r,
88
+ nodeId: a
89
+ } = e, f = t.useRef(null), g = Ee(!0), b = g !== void 0, {
90
+ events: I
91
+ } = d.useState("floatingTreeRoot"), {
92
+ getButtonProps: P,
93
+ buttonRef: k
94
+ } = qn({
95
+ disabled: i,
96
+ focusableWhenDisabled: !0,
97
+ native: R
98
+ }), l = t.useCallback((u) => Se({
99
+ id: E,
100
+ role: "menuitem",
101
+ tabIndex: C ? 0 : -1,
102
+ onMouseMove(s) {
103
+ a && I.emit("itemhover", {
104
+ nodeId: a,
105
+ target: s.currentTarget
106
+ });
107
+ },
108
+ onMouseEnter() {
109
+ r.type === "submenu-trigger" && r.setActive();
110
+ },
111
+ onKeyUp(s) {
112
+ s.key === " " && d.context.typingRef.current && s.preventBaseUIHandler();
113
+ },
114
+ onClick(s) {
115
+ o && I.emit("close", {
116
+ domEvent: s,
117
+ reason: be
118
+ });
119
+ },
120
+ onMouseUp(s) {
121
+ if (g) {
122
+ const _ = g.initialCursorPointRef.current;
123
+ if (g.initialCursorPointRef.current = null, b && _ && Math.abs(s.clientX - _.x) <= 1 && Math.abs(s.clientY - _.y) <= 1)
124
+ return;
125
+ }
126
+ f.current && d.context.allowMouseUpTriggerRef.current && (!b || s.button === 2) && r.type === "regular-item" && f.current.click();
127
+ }
128
+ }, u, P), [E, C, P, o, I, d, b, g, r, a]), h = sn(f, k);
129
+ return t.useMemo(() => ({
130
+ getItemProps: l,
131
+ itemRef: h
132
+ }), [l, h]);
133
+ }
134
+ let ot = /* @__PURE__ */ (function(e) {
135
+ return e.checked = "data-checked", e.unchecked = "data-unchecked", e.disabled = "data-disabled", e.highlighted = "data-highlighted", e;
136
+ })({});
137
+ const Ne = {
138
+ checked(e) {
139
+ return e ? {
140
+ [ot.checked]: ""
141
+ } : {
142
+ [ot.unchecked]: ""
143
+ };
144
+ },
145
+ ...mt
146
+ }, ht = /* @__PURE__ */ t.forwardRef(function(o, i) {
147
+ const {
148
+ render: C,
149
+ className: E,
150
+ id: d,
151
+ label: R,
152
+ nativeButton: r = !1,
153
+ disabled: a = !1,
154
+ closeOnClick: f = !1,
155
+ checked: g,
156
+ defaultChecked: b,
157
+ onCheckedChange: I,
158
+ ...P
159
+ } = o, k = ve({
160
+ label: R
161
+ }), l = fe(!0), h = pe(d), {
162
+ store: u
163
+ } = q(), s = u.useState("isActive", k.index), _ = u.useState("itemProps"), [O, n] = dt({
164
+ controlled: g,
165
+ default: b ?? !1,
166
+ name: "MenuCheckboxItem",
167
+ state: "checked"
168
+ }), {
169
+ getItemProps: A,
170
+ itemRef: y
171
+ } = ye({
172
+ closeOnClick: f,
173
+ disabled: a,
174
+ highlighted: s,
175
+ id: h,
176
+ store: u,
177
+ nativeButton: r,
178
+ nodeId: l?.nodeId,
179
+ itemMetadata: De
180
+ }), D = t.useMemo(() => ({
181
+ disabled: a,
182
+ highlighted: s,
183
+ checked: O
184
+ }), [a, s, O]), p = le((w) => {
185
+ const x = {
186
+ ...$(be, w.nativeEvent),
187
+ preventUnmountOnClose: () => {
188
+ }
189
+ };
190
+ I?.(!O, x), !x.isCanceled && n((m) => !m);
191
+ }), B = Y("div", o, {
192
+ state: D,
193
+ stateAttributesMapping: Ne,
194
+ props: [_, {
195
+ role: "menuitemcheckbox",
196
+ "aria-checked": O,
197
+ onClick: p
198
+ }, P, A],
199
+ ref: [y, i, k.ref]
200
+ });
201
+ return /* @__PURE__ */ c(we.Provider, {
202
+ value: D,
203
+ children: B
204
+ });
205
+ });
206
+ process.env.NODE_ENV !== "production" && (ht.displayName = "MenuCheckboxItem");
207
+ const xt = /* @__PURE__ */ t.forwardRef(function(o, i) {
208
+ const {
209
+ render: C,
210
+ className: E,
211
+ keepMounted: d = !1,
212
+ ...R
213
+ } = o, r = Jn(), a = t.useRef(null), {
214
+ transitionStatus: f,
215
+ setMounted: g
216
+ } = gt(r.checked);
217
+ Oe({
218
+ open: r.checked,
219
+ ref: a,
220
+ onComplete() {
221
+ r.checked || g(!1);
222
+ }
223
+ });
224
+ const b = t.useMemo(() => ({
225
+ checked: r.checked,
226
+ disabled: r.disabled,
227
+ highlighted: r.highlighted,
228
+ transitionStatus: f
229
+ }), [r.checked, r.disabled, r.highlighted, f]);
230
+ return Y("span", o, {
231
+ state: b,
232
+ ref: [i, a],
233
+ stateAttributesMapping: Ne,
234
+ props: {
235
+ "aria-hidden": !0,
236
+ ...R
237
+ },
238
+ enabled: d || r.checked
239
+ });
240
+ });
241
+ process.env.NODE_ENV !== "production" && (xt.displayName = "MenuCheckboxItemIndicator");
242
+ const Ve = /* @__PURE__ */ t.createContext(void 0);
243
+ process.env.NODE_ENV !== "production" && (Ve.displayName = "MenuGroupContext");
244
+ function Qn() {
245
+ const e = t.useContext(Ve);
246
+ if (e === void 0)
247
+ throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: MenuGroupRootContext is missing. Menu group parts must be used within <Menu.Group>." : J(31));
248
+ return e;
249
+ }
250
+ const Mt = /* @__PURE__ */ t.forwardRef(function(o, i) {
251
+ const {
252
+ render: C,
253
+ className: E,
254
+ ...d
255
+ } = o, [R, r] = t.useState(void 0), a = t.useMemo(() => ({
256
+ setLabelId: r
257
+ }), [r]), f = Y("div", o, {
258
+ ref: i,
259
+ props: {
260
+ role: "group",
261
+ "aria-labelledby": R,
262
+ ...d
263
+ }
264
+ });
265
+ return /* @__PURE__ */ c(Ve.Provider, {
266
+ value: a,
267
+ children: f
268
+ });
269
+ });
270
+ process.env.NODE_ENV !== "production" && (Mt.displayName = "MenuGroup");
271
+ const Ct = /* @__PURE__ */ t.forwardRef(function(o, i) {
272
+ const {
273
+ className: C,
274
+ render: E,
275
+ id: d,
276
+ ...R
277
+ } = o, r = pe(d), {
278
+ setLabelId: a
279
+ } = Qn();
280
+ return Te(() => (a(r), () => {
281
+ a(void 0);
282
+ }), [a, r]), Y("div", o, {
283
+ ref: i,
284
+ props: {
285
+ id: r,
286
+ role: "presentation",
287
+ ...R
288
+ }
289
+ });
290
+ });
291
+ process.env.NODE_ENV !== "production" && (Ct.displayName = "MenuGroupLabel");
292
+ const Rt = /* @__PURE__ */ t.forwardRef(function(o, i) {
293
+ const {
294
+ render: C,
295
+ className: E,
296
+ id: d,
297
+ label: R,
298
+ nativeButton: r = !1,
299
+ disabled: a = !1,
300
+ closeOnClick: f = !0,
301
+ ...g
302
+ } = o, b = ve({
303
+ label: R
304
+ }), I = fe(!0), P = pe(d), {
305
+ store: k
306
+ } = q(), l = k.useState("isActive", b.index), h = k.useState("itemProps"), {
307
+ getItemProps: u,
308
+ itemRef: s
309
+ } = ye({
310
+ closeOnClick: f,
311
+ disabled: a,
312
+ highlighted: l,
313
+ id: P,
314
+ store: k,
315
+ nativeButton: r,
316
+ nodeId: I?.nodeId,
317
+ itemMetadata: De
318
+ }), _ = t.useMemo(() => ({
319
+ disabled: a,
320
+ highlighted: l
321
+ }), [a, l]);
322
+ return Y("div", o, {
323
+ state: _,
324
+ props: [h, g, u],
325
+ ref: [s, i, b.ref]
326
+ });
327
+ });
328
+ process.env.NODE_ENV !== "production" && (Rt.displayName = "MenuItem");
329
+ const Zn = {
330
+ ...ut,
331
+ ...mt
332
+ }, Ae = /* @__PURE__ */ t.forwardRef(function(o, i) {
333
+ const {
334
+ render: C,
335
+ className: E,
336
+ finalFocus: d,
337
+ ...R
338
+ } = o, {
339
+ store: r
340
+ } = q(), {
341
+ side: a,
342
+ align: f
343
+ } = fe(), g = Kn() != null, b = r.useState("open"), I = r.useState("transitionStatus"), P = r.useState("popupProps"), k = r.useState("mounted"), l = r.useState("instantType"), h = r.useState("activeTriggerElement"), u = r.useState("parent"), s = r.useState("lastOpenChangeReason"), _ = r.useState("rootId"), O = r.useState("floatingRootContext"), n = r.useState("floatingTreeRoot"), A = r.useState("closeDelay"), y = r.useState("activeTriggerElement");
344
+ Oe({
345
+ open: b,
346
+ ref: r.context.popupRef,
347
+ onComplete() {
348
+ b && r.context.onOpenChangeComplete?.(!0);
349
+ }
350
+ }), t.useEffect(() => {
351
+ function m(N) {
352
+ r.setOpen(!1, $(N.reason, N.domEvent));
353
+ }
354
+ return n.events.on("close", m), () => {
355
+ n.events.off("close", m);
356
+ };
357
+ }, [n.events, r]);
358
+ const D = r.useState("hoverEnabled"), p = r.useState("disabled");
359
+ Xn(O, {
360
+ enabled: D && !p && u.type !== "context-menu" && u.type !== "menubar",
361
+ closeDelay: A
362
+ });
363
+ const B = t.useMemo(() => ({
364
+ transitionStatus: I,
365
+ side: a,
366
+ align: f,
367
+ open: b,
368
+ nested: u.type === "menu",
369
+ instant: l
370
+ }), [I, a, f, b, u.type, l]), w = Y("div", o, {
371
+ state: B,
372
+ ref: [i, r.context.popupRef],
373
+ stateAttributesMapping: Zn,
374
+ props: [P, {
375
+ onKeyDown(m) {
376
+ g && Wn.has(m.key) && m.stopPropagation();
377
+ }
378
+ }, Hn(I), R, {
379
+ "data-rootownerid": _
380
+ }]
381
+ });
382
+ let x = u.type === void 0 || u.type === "context-menu";
383
+ return (h || u.type === "menubar" && s !== vn) && (x = !0), /* @__PURE__ */ c(pn, {
384
+ context: O,
385
+ modal: !1,
386
+ disabled: !k,
387
+ returnFocus: d === void 0 ? x : d,
388
+ initialFocus: u.type !== "menu",
389
+ restoreFocus: !0,
390
+ externalTree: u.type !== "menubar" ? n : void 0,
391
+ previousFocusableElement: y,
392
+ nextFocusableElement: u.type === void 0 ? r.context.triggerFocusTargetRef : void 0,
393
+ beforeContentFocusGuardRef: u.type === void 0 ? r.context.beforeContentFocusGuardRef : void 0,
394
+ children: w
395
+ });
396
+ });
397
+ process.env.NODE_ENV !== "production" && (Ae.displayName = "MenuPopup");
398
+ const Ue = /* @__PURE__ */ t.createContext(void 0);
399
+ process.env.NODE_ENV !== "production" && (Ue.displayName = "MenuPortalContext");
400
+ function eo() {
401
+ const e = t.useContext(Ue);
402
+ if (e === void 0)
403
+ throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: <Menu.Portal> is missing." : J(32));
404
+ return e;
405
+ }
406
+ const Le = /* @__PURE__ */ t.forwardRef(function(o, i) {
407
+ const {
408
+ keepMounted: C = !1,
409
+ ...E
410
+ } = o, {
411
+ store: d
412
+ } = q();
413
+ return d.useState("mounted") || C ? /* @__PURE__ */ c(Ue.Provider, {
414
+ value: C,
415
+ children: /* @__PURE__ */ c(xn, {
416
+ ref: i,
417
+ ...E
418
+ })
419
+ }) : null;
420
+ });
421
+ process.env.NODE_ENV !== "production" && (Le.displayName = "MenuPortal");
422
+ const Fe = /* @__PURE__ */ t.forwardRef(function(o, i) {
423
+ const {
424
+ anchor: C,
425
+ positionMethod: E = "absolute",
426
+ className: d,
427
+ render: R,
428
+ side: r,
429
+ align: a,
430
+ sideOffset: f = 0,
431
+ alignOffset: g = 0,
432
+ collisionBoundary: b = "clipping-ancestors",
433
+ collisionPadding: I = 5,
434
+ arrowPadding: P = 5,
435
+ sticky: k = !1,
436
+ disableAnchorTracking: l = !1,
437
+ collisionAvoidance: h = Mn,
438
+ ...u
439
+ } = o, {
440
+ store: s
441
+ } = q(), _ = eo(), O = Ee(!0), n = s.useState("parent"), A = s.useState("floatingRootContext"), y = s.useState("floatingTreeRoot"), D = s.useState("mounted"), p = s.useState("open"), B = s.useState("modal"), w = s.useState("activeTriggerElement"), x = s.useState("lastOpenChangeReason"), m = s.useState("floatingNodeId"), N = s.useState("floatingParentNodeId");
442
+ let L = C, v = f, X = g, Q = a, ne = h;
443
+ n.type === "context-menu" && (L = C ?? n.context?.anchor, Q = Q ?? "start", !r && Q !== "center" && (X = o.alignOffset ?? 2, v = o.sideOffset ?? -5));
444
+ let z = r, K = Q;
445
+ n.type === "menu" ? (z = z ?? "inline-end", K = K ?? "start", ne = o.collisionAvoidance ?? Cn) : n.type === "menubar" && (z = z ?? "bottom", K = K ?? "start");
446
+ const W = n.type === "context-menu", T = Yn({
447
+ anchor: L,
448
+ floatingRootContext: A,
449
+ positionMethod: O ? "fixed" : E,
450
+ mounted: D,
451
+ side: z,
452
+ sideOffset: v,
453
+ align: K,
454
+ alignOffset: X,
455
+ arrowPadding: W ? 0 : P,
456
+ collisionBoundary: b,
457
+ collisionPadding: I,
458
+ sticky: k,
459
+ nodeId: m,
460
+ keepMounted: _,
461
+ disableAnchorTracking: l,
462
+ collisionAvoidance: ne,
463
+ shiftCrossAxis: W,
464
+ externalTree: y
465
+ }), te = t.useMemo(() => {
466
+ const F = {};
467
+ return p || (F.pointerEvents = "none"), {
468
+ role: "presentation",
469
+ hidden: !D,
470
+ style: {
471
+ ...T.positionerStyles,
472
+ ...F
473
+ }
474
+ };
475
+ }, [p, D, T.positionerStyles]);
476
+ t.useEffect(() => {
477
+ function F(V) {
478
+ V.open ? (V.parentNodeId === m && s.set("hoverEnabled", !1), V.nodeId !== m && V.parentNodeId === s.select("floatingParentNodeId") && s.setOpen(!1, $(ue))) : V.parentNodeId === m && V.reason !== ue && s.set("hoverEnabled", !0);
479
+ }
480
+ return y.events.on("menuopenchange", F), () => {
481
+ y.events.off("menuopenchange", F);
482
+ };
483
+ }, [s, y.events, m]), t.useEffect(() => {
484
+ if (s.select("floatingParentNodeId") == null)
485
+ return;
486
+ function F(V) {
487
+ if (V.open || V.nodeId !== s.select("floatingParentNodeId"))
488
+ return;
489
+ const me = V.reason ?? ue;
490
+ s.setOpen(!1, $(me));
491
+ }
492
+ return y.events.on("menuopenchange", F), () => {
493
+ y.events.off("menuopenchange", F);
494
+ };
495
+ }, [y.events, s]), t.useEffect(() => {
496
+ function F(V) {
497
+ !p || V.nodeId !== s.select("floatingParentNodeId") || V.target && w && w !== V.target && s.setOpen(!1, $(ue));
498
+ }
499
+ return y.events.on("itemhover", F), () => {
500
+ y.events.off("itemhover", F);
501
+ };
502
+ }, [y.events, p, w, s]), t.useEffect(() => {
503
+ const F = {
504
+ open: p,
505
+ nodeId: m,
506
+ parentNodeId: N,
507
+ reason: s.select("lastOpenChangeReason")
508
+ };
509
+ y.events.emit("menuopenchange", F);
510
+ }, [y.events, p, s, m, N]);
511
+ const j = t.useMemo(() => ({
512
+ open: p,
513
+ side: T.side,
514
+ align: T.align,
515
+ anchorHidden: T.anchorHidden,
516
+ nested: n.type === "menu"
517
+ }), [p, T.side, T.align, T.anchorHidden, n.type]), oe = t.useMemo(() => ({
518
+ side: T.side,
519
+ align: T.align,
520
+ arrowRef: T.arrowRef,
521
+ arrowUncentered: T.arrowUncentered,
522
+ arrowStyles: T.arrowStyles,
523
+ nodeId: T.context.nodeId
524
+ }), [T.side, T.align, T.arrowRef, T.arrowUncentered, T.arrowStyles, T.context.nodeId]), se = Y("div", o, {
525
+ state: j,
526
+ stateAttributesMapping: ut,
527
+ ref: [i, s.useStateSetter("positionerElement")],
528
+ props: [te, u]
529
+ }), ie = D && n.type !== "menu" && (n.type !== "menubar" && B && x !== xe || n.type === "menubar" && n.context.modal);
530
+ let Z = null;
531
+ return n.type === "menubar" ? Z = n.context.contentElement : n.type === void 0 && (Z = w), /* @__PURE__ */ ee(_e.Provider, {
532
+ value: oe,
533
+ children: [ie && /* @__PURE__ */ c(fn, {
534
+ ref: n.type === "context-menu" || n.type === "nested-context-menu" ? n.context.internalBackdropRef : null,
535
+ inert: Gn(!p),
536
+ cutout: Z
537
+ }), /* @__PURE__ */ c(qt, {
538
+ id: m,
539
+ children: /* @__PURE__ */ c(zn, {
540
+ elementsRef: s.context.itemDomElements,
541
+ labelsRef: s.context.itemLabels,
542
+ children: se
543
+ })
544
+ })]
545
+ });
546
+ });
547
+ process.env.NODE_ENV !== "production" && (Fe.displayName = "MenuPositioner");
548
+ const Be = /* @__PURE__ */ t.createContext(void 0);
549
+ process.env.NODE_ENV !== "production" && (Be.displayName = "MenuRadioGroupContext");
550
+ function to() {
551
+ const e = t.useContext(Be);
552
+ if (e === void 0)
553
+ throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: MenuRadioGroupContext is missing. MenuRadioGroup parts must be placed within <Menu.RadioGroup>." : J(34));
554
+ return e;
555
+ }
556
+ const bt = /* @__PURE__ */ t.memo(/* @__PURE__ */ t.forwardRef(function(o, i) {
557
+ const {
558
+ render: C,
559
+ className: E,
560
+ value: d,
561
+ defaultValue: R,
562
+ onValueChange: r,
563
+ disabled: a = !1,
564
+ ...f
565
+ } = o, [g, b] = dt({
566
+ controlled: d,
567
+ default: R,
568
+ name: "MenuRadioGroup"
569
+ }), I = le(r), P = le((u, s) => {
570
+ I?.(u, s), !s.isCanceled && b(u);
571
+ }), k = t.useMemo(() => ({
572
+ disabled: a
573
+ }), [a]), l = Y("div", o, {
574
+ state: k,
575
+ ref: i,
576
+ props: {
577
+ role: "group",
578
+ "aria-disabled": a || void 0,
579
+ ...f
580
+ }
581
+ }), h = t.useMemo(() => ({
582
+ value: g,
583
+ setValue: P,
584
+ disabled: a
585
+ }), [g, P, a]);
586
+ return /* @__PURE__ */ c(Be.Provider, {
587
+ value: h,
588
+ children: l
589
+ });
590
+ }));
591
+ process.env.NODE_ENV !== "production" && (bt.displayName = "MenuRadioGroup");
592
+ const Ge = /* @__PURE__ */ t.createContext(void 0);
593
+ process.env.NODE_ENV !== "production" && (Ge.displayName = "MenuRadioItemContext");
594
+ function no() {
595
+ const e = t.useContext(Ge);
596
+ if (e === void 0)
597
+ throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: MenuRadioItemContext is missing. MenuRadioItem parts must be placed within <Menu.RadioItem>." : J(35));
598
+ return e;
599
+ }
600
+ const vt = /* @__PURE__ */ t.forwardRef(function(o, i) {
601
+ const {
602
+ render: C,
603
+ className: E,
604
+ id: d,
605
+ label: R,
606
+ nativeButton: r = !1,
607
+ disabled: a = !1,
608
+ closeOnClick: f = !1,
609
+ value: g,
610
+ ...b
611
+ } = o, I = ve({
612
+ label: R
613
+ }), P = fe(!0), k = pe(d), {
614
+ store: l
615
+ } = q(), h = l.useState("isActive", I.index), u = l.useState("itemProps"), {
616
+ value: s,
617
+ setValue: _,
618
+ disabled: O
619
+ } = to(), n = O || a, A = s === g, {
620
+ getItemProps: y,
621
+ itemRef: D
622
+ } = ye({
623
+ closeOnClick: f,
624
+ disabled: n,
625
+ highlighted: h,
626
+ id: k,
627
+ store: l,
628
+ nativeButton: r,
629
+ nodeId: P?.nodeId,
630
+ itemMetadata: De
631
+ }), p = t.useMemo(() => ({
632
+ disabled: n,
633
+ highlighted: h,
634
+ checked: A
635
+ }), [n, h, A]), B = le((x) => {
636
+ const m = {
637
+ ...$(be, x.nativeEvent),
638
+ preventUnmountOnClose: () => {
639
+ }
640
+ };
641
+ _(g, m);
642
+ }), w = Y("div", o, {
643
+ state: p,
644
+ stateAttributesMapping: Ne,
645
+ props: [u, {
646
+ role: "menuitemradio",
647
+ "aria-checked": A,
648
+ onClick: B
649
+ }, b, y],
650
+ ref: [D, i, I.ref]
651
+ });
652
+ return /* @__PURE__ */ c(Ge.Provider, {
653
+ value: p,
654
+ children: w
655
+ });
656
+ });
657
+ process.env.NODE_ENV !== "production" && (vt.displayName = "MenuRadioItem");
658
+ const Et = /* @__PURE__ */ t.forwardRef(function(o, i) {
659
+ const {
660
+ render: C,
661
+ className: E,
662
+ keepMounted: d = !1,
663
+ ...R
664
+ } = o, r = no(), a = t.useRef(null), {
665
+ transitionStatus: f,
666
+ setMounted: g
667
+ } = gt(r.checked);
668
+ Oe({
669
+ open: r.checked,
670
+ ref: a,
671
+ onComplete() {
672
+ r.checked || g(!1);
673
+ }
674
+ });
675
+ const b = t.useMemo(() => ({
676
+ checked: r.checked,
677
+ disabled: r.disabled,
678
+ highlighted: r.highlighted,
679
+ transitionStatus: f
680
+ }), [r.checked, r.disabled, r.highlighted, f]);
681
+ return Y("span", o, {
682
+ state: b,
683
+ stateAttributesMapping: Ne,
684
+ ref: [i, a],
685
+ props: {
686
+ "aria-hidden": !0,
687
+ ...R
688
+ },
689
+ enabled: d || r.checked
690
+ });
691
+ });
692
+ process.env.NODE_ENV !== "production" && (Et.displayName = "MenuRadioItemIndicator");
693
+ const It = /* @__PURE__ */ t.createContext(null);
694
+ process.env.NODE_ENV !== "production" && (It.displayName = "MenubarContext");
695
+ function oo(e) {
696
+ return t.useContext(It);
697
+ }
698
+ const ro = {
699
+ ...Sn,
700
+ disabled: U((e) => e.parent.type === "menubar" && e.parent.context.disabled || e.disabled),
701
+ modal: U((e) => (e.parent.type === void 0 || e.parent.type === "context-menu") && (e.modal ?? !0)),
702
+ allowMouseEnter: U((e) => e.parent.type === "menu" ? e.parent.store.select("allowMouseEnter") : e.allowMouseEnter),
703
+ stickIfOpen: U((e) => e.stickIfOpen),
704
+ parent: U((e) => e.parent),
705
+ rootId: U((e) => e.parent.type === "menu" ? e.parent.store.select("rootId") : e.parent.type !== void 0 ? e.parent.context.rootId : e.rootId),
706
+ activeIndex: U((e) => e.activeIndex),
707
+ isActive: U((e, o) => e.activeIndex === o),
708
+ hoverEnabled: U((e) => e.hoverEnabled),
709
+ instantType: U((e) => e.instantType),
710
+ lastOpenChangeReason: U((e) => e.openChangeReason),
711
+ floatingTreeRoot: U((e) => e.parent.type === "menu" ? e.parent.store.select("floatingTreeRoot") : e.floatingTreeRoot),
712
+ floatingNodeId: U((e) => e.floatingNodeId),
713
+ floatingParentNodeId: U((e) => e.floatingParentNodeId),
714
+ itemProps: U((e) => e.itemProps),
715
+ closeDelay: U((e) => e.closeDelay),
716
+ keyboardEventRelay: U((e) => {
717
+ if (e.keyboardEventRelay)
718
+ return e.keyboardEventRelay;
719
+ if (e.parent.type === "menu")
720
+ return e.parent.store.select("keyboardEventRelay");
721
+ })
722
+ };
723
+ class He extends $t {
724
+ constructor(o) {
725
+ super({
726
+ ...so(),
727
+ ...o
728
+ }, {
729
+ positionerRef: /* @__PURE__ */ t.createRef(),
730
+ popupRef: /* @__PURE__ */ t.createRef(),
731
+ typingRef: {
732
+ current: !1
733
+ },
734
+ itemDomElements: {
735
+ current: []
736
+ },
737
+ itemLabels: {
738
+ current: []
739
+ },
740
+ allowMouseUpTriggerRef: {
741
+ current: !1
742
+ },
743
+ triggerFocusTargetRef: /* @__PURE__ */ t.createRef(),
744
+ beforeContentFocusGuardRef: /* @__PURE__ */ t.createRef(),
745
+ onOpenChangeComplete: void 0,
746
+ triggerElements: new Jt()
747
+ }, ro), this.observe(U((i) => i.allowMouseEnter), (i, C) => {
748
+ this.state.parent.type === "menu" && i !== C && this.state.parent.store.set("allowMouseEnter", i);
749
+ }), this.unsubscribeParentListener = this.observe("parent", (i) => {
750
+ if (this.unsubscribeParentListener?.(), i.type === "menu") {
751
+ this.unsubscribeParentListener = i.store.subscribe(() => {
752
+ this.notifyAll();
753
+ }), this.context.allowMouseUpTriggerRef = i.store.context.allowMouseUpTriggerRef;
754
+ return;
755
+ }
756
+ i.type !== void 0 && (this.context.allowMouseUpTriggerRef = i.context.allowMouseUpTriggerRef), this.unsubscribeParentListener = null;
757
+ });
758
+ }
759
+ setOpen(o, i) {
760
+ this.state.floatingRootContext.context.events.emit("setOpen", {
761
+ open: o,
762
+ eventDetails: i
763
+ });
764
+ }
765
+ static useStore(o, i) {
766
+ return an(() => o ?? new He(i)).current;
767
+ }
768
+ unsubscribeParentListener = null;
769
+ }
770
+ function so() {
771
+ return {
772
+ ...Tn(),
773
+ disabled: !1,
774
+ modal: !0,
775
+ allowMouseEnter: !0,
776
+ stickIfOpen: !0,
777
+ parent: {
778
+ type: void 0
779
+ },
780
+ rootId: void 0,
781
+ activeIndex: null,
782
+ hoverEnabled: !0,
783
+ instantType: void 0,
784
+ openChangeReason: null,
785
+ floatingTreeRoot: new Qt(),
786
+ floatingNodeId: void 0,
787
+ floatingParentNodeId: null,
788
+ itemProps: un,
789
+ keyboardEventRelay: void 0,
790
+ closeDelay: 0
791
+ };
792
+ }
793
+ const Ye = /* @__PURE__ */ t.createContext(void 0);
794
+ process.env.NODE_ENV !== "production" && (Ye.displayName = "MenuSubmenuRootContext");
795
+ function yt() {
796
+ return t.useContext(Ye);
797
+ }
798
+ function Nt(e) {
799
+ const {
800
+ children: o,
801
+ open: i,
802
+ onOpenChange: C,
803
+ onOpenChangeComplete: E,
804
+ defaultOpen: d = !1,
805
+ disabled: R = !1,
806
+ modal: r,
807
+ loopFocus: a = !0,
808
+ orientation: f = "vertical",
809
+ actionsRef: g,
810
+ closeParentOnEsc: b = !1,
811
+ handle: I,
812
+ triggerId: P,
813
+ defaultTriggerId: k = null,
814
+ highlightItemOnHover: l = !0
815
+ } = e, h = Ee(!0), u = q(!0), s = oo(), _ = yt(), O = t.useMemo(() => _ && u ? {
816
+ type: "menu",
817
+ store: u.store
818
+ } : s ? {
819
+ type: "menubar",
820
+ context: s
821
+ } : h && !u ? {
822
+ type: "context-menu",
823
+ context: h
824
+ } : {
825
+ type: void 0
826
+ }, [h, u, s, _]), n = He.useStore(I?.store, {
827
+ parent: O
828
+ }), A = n.useState("floatingTreeRoot"), y = Zt(A), D = en();
829
+ Te(() => {
830
+ h && !u ? n.update({
831
+ parent: {
832
+ type: "context-menu",
833
+ context: h
834
+ },
835
+ floatingNodeId: y,
836
+ floatingParentNodeId: D
837
+ }) : u && n.update({
838
+ floatingNodeId: y,
839
+ floatingParentNodeId: D
840
+ });
841
+ }, [h, u, y, D, n]), n.useControlledProp("open", i, d), n.useControlledProp("activeTriggerId", P, k), n.useContextCallback("onOpenChangeComplete", E);
842
+ const p = n.useState("open"), B = n.useState("activeTriggerElement"), w = n.useState("positionerElement"), x = n.useState("hoverEnabled"), m = n.useState("modal"), N = n.useState("disabled"), L = n.useState("lastOpenChangeReason"), v = n.useState("parent"), X = n.useState("activeIndex"), Q = n.useState("payload"), ne = n.useState("floatingParentNodeId"), z = t.useRef(null), K = ne != null;
843
+ let W;
844
+ process.env.NODE_ENV !== "production" && v.type !== void 0 && r !== void 0 && console.warn("Base UI: The `modal` prop is not supported on nested menus. It will be ignored."), n.useSyncedValues({
845
+ disabled: R,
846
+ modal: v.type === void 0 ? r : void 0,
847
+ rootId: pt()
848
+ });
849
+ const {
850
+ openMethod: T,
851
+ triggerProps: te,
852
+ reset: j
853
+ } = mn(p);
854
+ On(n);
855
+ const {
856
+ forceUnmount: oe
857
+ } = kn(p, n, () => {
858
+ n.update({
859
+ allowMouseEnter: !1,
860
+ stickIfOpen: !0
861
+ }), j();
862
+ }), se = t.useRef(v.type !== "context-menu"), ie = Me();
863
+ t.useEffect(() => {
864
+ if (p || (z.current = null), v.type === "context-menu") {
865
+ if (!p) {
866
+ ie.clear(), se.current = !1;
867
+ return;
868
+ }
869
+ ie.start(500, () => {
870
+ se.current = !0;
871
+ });
872
+ }
873
+ }, [ie, p, v.type]), gn(p && m && L !== xe && T !== "touch", w), Te(() => {
874
+ !p && !x && n.set("hoverEnabled", !0);
875
+ }, [p, x, n]);
876
+ const Z = t.useRef(!0), F = Me(), V = le((M, S) => {
877
+ const G = S.reason;
878
+ if (p === M && S.trigger === B || (S.preventUnmountOnClose = () => {
879
+ n.set("preventUnmountingOnClose", !0);
880
+ }, !M && S.trigger == null && (S.trigger = B ?? void 0), C?.(M, S), S.isCanceled))
881
+ return;
882
+ const Yt = {
883
+ open: M,
884
+ nativeEvent: S.event,
885
+ reason: S.reason,
886
+ nested: K
887
+ };
888
+ W?.emit("openchange", Yt);
889
+ const ge = S.event;
890
+ if (M === !1 && ge?.type === "click" && ge.pointerType === "touch" && !Z.current)
891
+ return;
892
+ if (!M && X !== null) {
893
+ const ae = n.context.itemDomElements.current[X];
894
+ queueMicrotask(() => {
895
+ ae?.setAttribute("tabindex", "-1");
896
+ });
897
+ }
898
+ M && G === et ? (Z.current = !1, F.start(300, () => {
899
+ Z.current = !0;
900
+ })) : (Z.current = !0, F.clear());
901
+ const Je = (G === ft || G === be) && ge.detail === 0 && ge?.isTrusted, zt = !M && (G === yn || G == null);
902
+ function Qe() {
903
+ const ae = {
904
+ open: M,
905
+ openChangeReason: G
906
+ };
907
+ z.current = S.event ?? null;
908
+ const Ze = S.trigger?.id ?? null;
909
+ (Ze || M) && (ae.activeTriggerId = Ze, ae.activeTriggerElement = S.trigger ?? null), n.update(ae);
910
+ }
911
+ G === xe ? ln.flushSync(Qe) : Qe(), v.type === "menubar" && (G === et || G === En || G === xe || G === In || G === ue) ? n.set("instantType", "group") : Je || zt ? n.set("instantType", Je ? "click" : "dismiss") : n.set("instantType", void 0);
912
+ }), me = t.useCallback((M) => {
913
+ const S = $(M);
914
+ return S.preventUnmountOnClose = () => {
915
+ n.set("preventUnmountingOnClose", !0);
916
+ }, S;
917
+ }, [n]), ze = t.useCallback(() => {
918
+ n.setOpen(!1, me(Nn));
919
+ }, [n, me]);
920
+ t.useImperativeHandle(g, () => ({
921
+ unmount: oe,
922
+ close: ze
923
+ }), [oe, ze]);
924
+ let Pe;
925
+ v.type === "context-menu" && (Pe = v.context), t.useImperativeHandle(Pe?.positionerRef, () => w, [w]), t.useImperativeHandle(Pe?.actionsRef, () => ({
926
+ setOpen: V
927
+ }), [V]);
928
+ const re = _n({
929
+ popupStore: n,
930
+ onOpenChange: V
931
+ });
932
+ W = re.context.events, t.useEffect(() => {
933
+ const M = ({
934
+ open: S,
935
+ eventDetails: G
936
+ }) => V(S, G);
937
+ return W.on("setOpen", M), () => {
938
+ W?.off("setOpen", M);
939
+ };
940
+ }, [W, V]);
941
+ const kt = tn(re, {
942
+ enabled: !N,
943
+ bubbles: b && v.type === "menu",
944
+ outsidePress() {
945
+ return v.type !== "context-menu" || z.current?.type === "contextmenu" ? !0 : se.current;
946
+ },
947
+ externalTree: K ? A : void 0
948
+ }), _t = Dn(re, {
949
+ role: "menu"
950
+ }), wt = bn(), Dt = t.useCallback((M) => {
951
+ n.select("activeIndex") !== M && n.set("activeIndex", M);
952
+ }, [n]), Vt = Vn(re, {
953
+ enabled: !N,
954
+ listRef: n.context.itemDomElements,
955
+ activeIndex: X,
956
+ nested: v.type !== void 0,
957
+ loopFocus: a,
958
+ orientation: f,
959
+ parentOrientation: v.type === "menubar" ? v.context.orientation : void 0,
960
+ rtl: wt === "rtl",
961
+ disabledIndices: cn,
962
+ onNavigate: Dt,
963
+ openOnArrowKeyDown: v.type !== "context-menu",
964
+ externalTree: K ? A : void 0,
965
+ focusItemOnHover: l
966
+ }), At = t.useCallback((M) => {
967
+ n.context.typingRef.current = M;
968
+ }, [n]), Ut = An(re, {
969
+ listRef: n.context.itemLabels,
970
+ activeIndex: X,
971
+ resetMs: Rn,
972
+ onMatch: (M) => {
973
+ p && M !== X && n.set("activeIndex", M);
974
+ },
975
+ onTypingChange: At
976
+ }), {
977
+ getReferenceProps: Ke,
978
+ getFloatingProps: We,
979
+ getItemProps: Xe,
980
+ getTriggerProps: je
981
+ } = ct([kt, _t, Vt, Ut]), Lt = t.useMemo(() => {
982
+ const M = Se(Ke(), {
983
+ onMouseEnter() {
984
+ n.set("hoverEnabled", !0);
985
+ },
986
+ onMouseMove() {
987
+ n.set("allowMouseEnter", !0);
988
+ }
989
+ }, te);
990
+ return delete M.role, M;
991
+ }, [Ke, n, te]), Ft = t.useMemo(() => {
992
+ const M = je();
993
+ if (!M)
994
+ return M;
995
+ const S = Se(M, te);
996
+ return delete S.role, delete S["aria-controls"], S;
997
+ }, [je, te]), qe = dn(), Bt = t.useMemo(() => We({
998
+ onMouseEnter() {
999
+ v.type === "menu" && qe.request(() => n.set("hoverEnabled", !1));
1000
+ },
1001
+ onMouseMove() {
1002
+ n.set("allowMouseEnter", !0);
1003
+ },
1004
+ onClick() {
1005
+ n.select("hoverEnabled") && n.set("hoverEnabled", !1);
1006
+ },
1007
+ onKeyDown(M) {
1008
+ const S = n.select("keyboardEventRelay");
1009
+ S && !M.isPropagationStopped() && S(M);
1010
+ }
1011
+ }), [We, v.type, qe, n]), Gt = t.useMemo(() => Xe(), [Xe]);
1012
+ n.useSyncedValues({
1013
+ floatingRootContext: re,
1014
+ activeTriggerProps: Lt,
1015
+ inactiveTriggerProps: Ft,
1016
+ popupProps: Bt,
1017
+ itemProps: Gt
1018
+ });
1019
+ const Ht = t.useMemo(() => ({
1020
+ store: n,
1021
+ parent: O
1022
+ }), [n, O]), $e = /* @__PURE__ */ c(Ie.Provider, {
1023
+ value: Ht,
1024
+ children: typeof o == "function" ? o({
1025
+ payload: Q
1026
+ }) : o
1027
+ });
1028
+ return v.type === void 0 || v.type === "context-menu" ? /* @__PURE__ */ c(nn, {
1029
+ externalTree: A,
1030
+ children: $e
1031
+ }) : $e;
1032
+ }
1033
+ function io(e) {
1034
+ const o = q().store, i = t.useMemo(() => ({
1035
+ parentMenu: o
1036
+ }), [o]);
1037
+ return /* @__PURE__ */ c(Ye.Provider, {
1038
+ value: i,
1039
+ children: /* @__PURE__ */ c(Nt, {
1040
+ ...e
1041
+ })
1042
+ });
1043
+ }
1044
+ function Pt(e) {
1045
+ if (Un(e) && e.hasAttribute("data-rootownerid"))
1046
+ return e.getAttribute("data-rootownerid") ?? void 0;
1047
+ if (!Ln(e))
1048
+ return Pt(Fn(e));
1049
+ }
1050
+ const St = /* @__PURE__ */ t.forwardRef(function(o, i) {
1051
+ const {
1052
+ render: C,
1053
+ className: E,
1054
+ label: d,
1055
+ id: R,
1056
+ nativeButton: r = !1,
1057
+ openOnHover: a = !0,
1058
+ delay: f = 100,
1059
+ closeDelay: g = 0,
1060
+ disabled: b = !1,
1061
+ ...I
1062
+ } = o, P = ve(), k = fe(), {
1063
+ store: l
1064
+ } = q(), h = pe(R), u = l.useState("open"), s = l.useState("floatingRootContext"), _ = l.useState("floatingTreeRoot"), O = wn(h, l), n = t.useCallback((j) => {
1065
+ const oe = O(j);
1066
+ return j !== null && l.select("open") && l.select("activeTriggerId") == null && l.update({
1067
+ activeTriggerId: h,
1068
+ activeTriggerElement: j,
1069
+ closeDelay: g
1070
+ }), oe;
1071
+ }, [O, g, l, h]), A = t.useRef(null), y = t.useCallback((j) => {
1072
+ A.current = j, l.set("activeTriggerElement", j);
1073
+ }, [l]), D = yt();
1074
+ if (!D?.parentMenu)
1075
+ throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: <Menu.SubmenuTrigger> must be placed in <Menu.SubmenuRoot>." : J(37));
1076
+ l.useSyncedValue("closeDelay", g);
1077
+ const p = D.parentMenu, B = p.useState("itemProps"), w = p.useState("isActive", P.index), x = t.useMemo(() => ({
1078
+ type: "submenu-trigger",
1079
+ setActive: () => p.set("activeIndex", P.index)
1080
+ }), [p, P.index]), m = l.useState("disabled"), N = b || m, {
1081
+ getItemProps: L,
1082
+ itemRef: v
1083
+ } = ye({
1084
+ closeOnClick: !1,
1085
+ disabled: N,
1086
+ highlighted: w,
1087
+ id: h,
1088
+ store: l,
1089
+ nativeButton: r,
1090
+ itemMetadata: x,
1091
+ nodeId: k?.nodeId
1092
+ }), X = l.useState("hoverEnabled"), Q = l.useState("allowMouseEnter"), ne = jn(s, {
1093
+ enabled: X && a && !N && Q,
1094
+ handleClose: $n({
1095
+ blockPointerEvents: !0
1096
+ }),
1097
+ mouseOnly: !0,
1098
+ move: !0,
1099
+ restMs: f,
1100
+ delay: {
1101
+ open: f,
1102
+ close: g
1103
+ },
1104
+ triggerElementRef: A,
1105
+ externalTree: _
1106
+ }), z = hn(s, {
1107
+ enabled: !N,
1108
+ event: "mousedown",
1109
+ toggle: !a,
1110
+ ignoreMouse: a,
1111
+ stickIfOpen: !1
1112
+ }), K = ct([z]), W = l.useState("triggerProps", !0);
1113
+ delete W.id;
1114
+ const T = t.useMemo(() => ({
1115
+ disabled: N,
1116
+ highlighted: w,
1117
+ open: u
1118
+ }), [N, w, u]);
1119
+ return Y("div", o, {
1120
+ state: T,
1121
+ stateAttributesMapping: on,
1122
+ props: [K.getReferenceProps(), ne, W, B, {
1123
+ tabIndex: u || w ? 0 : -1,
1124
+ onBlur() {
1125
+ w && p.set("activeIndex", null);
1126
+ }
1127
+ }, I, L],
1128
+ ref: [i, P.ref, v, n, y]
1129
+ });
1130
+ });
1131
+ process.env.NODE_ENV !== "production" && (St.displayName = "MenuSubmenuTrigger");
1132
+ function ao(e) {
1133
+ const [o, i] = t.useState({
1134
+ getBoundingClientRect() {
1135
+ return DOMRect.fromRect({
1136
+ width: 0,
1137
+ height: 0,
1138
+ x: 0,
1139
+ y: 0
1140
+ });
1141
+ }
1142
+ }), C = t.useRef(null), E = t.useRef(null), d = t.useRef(null), R = t.useRef(null), r = t.useRef(!0), a = t.useRef(null), f = pt(), g = t.useMemo(() => ({
1143
+ anchor: o,
1144
+ setAnchor: i,
1145
+ actionsRef: d,
1146
+ backdropRef: C,
1147
+ internalBackdropRef: E,
1148
+ positionerRef: R,
1149
+ allowMouseUpTriggerRef: r,
1150
+ initialCursorPointRef: a,
1151
+ rootId: f
1152
+ }), [o, f]);
1153
+ return /* @__PURE__ */ c(ke.Provider, {
1154
+ value: g,
1155
+ children: /* @__PURE__ */ c(Ie.Provider, {
1156
+ value: void 0,
1157
+ children: /* @__PURE__ */ c(Nt, {
1158
+ ...e
1159
+ })
1160
+ })
1161
+ });
1162
+ }
1163
+ const rt = 500, Tt = /* @__PURE__ */ t.forwardRef(function(o, i) {
1164
+ const {
1165
+ render: C,
1166
+ className: E,
1167
+ ...d
1168
+ } = o, {
1169
+ setAnchor: R,
1170
+ actionsRef: r,
1171
+ internalBackdropRef: a,
1172
+ backdropRef: f,
1173
+ positionerRef: g,
1174
+ allowMouseUpTriggerRef: b,
1175
+ initialCursorPointRef: I,
1176
+ rootId: P
1177
+ } = Ee(!1), {
1178
+ store: k
1179
+ } = q(!1), l = k.useState("open"), h = t.useRef(null), u = t.useRef(null), s = Me(), _ = Me(), O = t.useRef(!1);
1180
+ function n(x, m, N) {
1181
+ const L = N.type.startsWith("touch");
1182
+ I.current = {
1183
+ x,
1184
+ y: m
1185
+ }, R({
1186
+ getBoundingClientRect() {
1187
+ return DOMRect.fromRect({
1188
+ width: L ? 10 : 0,
1189
+ height: L ? 10 : 0,
1190
+ x,
1191
+ y: m
1192
+ });
1193
+ }
1194
+ }), O.current = !1, r.current?.setOpen(!0, $(ft, N)), _.start(rt, () => {
1195
+ O.current = !0;
1196
+ });
1197
+ }
1198
+ function A(x) {
1199
+ b.current = !0, Bn(x), n(x.clientX, x.clientY, x.nativeEvent), tt(h.current).addEventListener("mouseup", (N) => {
1200
+ if (b.current = !1, !O.current)
1201
+ return;
1202
+ _.clear(), O.current = !1;
1203
+ const L = nt(N);
1204
+ he(g.current, L) || P && L && Pt(L) === P || r.current?.setOpen(!1, $(Pn, N));
1205
+ }, {
1206
+ once: !0
1207
+ });
1208
+ }
1209
+ function y(x) {
1210
+ if (b.current = !1, x.touches.length === 1) {
1211
+ x.stopPropagation();
1212
+ const m = x.touches[0];
1213
+ u.current = {
1214
+ x: m.clientX,
1215
+ y: m.clientY
1216
+ }, s.start(rt, () => {
1217
+ u.current && n(u.current.x, u.current.y, x.nativeEvent);
1218
+ });
1219
+ }
1220
+ }
1221
+ function D(x) {
1222
+ if (s.isStarted() && u.current && x.touches.length === 1) {
1223
+ const m = x.touches[0], N = 10, L = Math.abs(m.clientX - u.current.x), v = Math.abs(m.clientY - u.current.y);
1224
+ (L > N || v > N) && s.clear();
1225
+ }
1226
+ }
1227
+ function p() {
1228
+ s.clear(), u.current = null;
1229
+ }
1230
+ t.useEffect(() => {
1231
+ function x(N) {
1232
+ const v = nt(N);
1233
+ (he(h.current, v) || he(a.current, v) || he(f.current, v)) && N.preventDefault();
1234
+ }
1235
+ const m = tt(h.current);
1236
+ return m.addEventListener("contextmenu", x), () => {
1237
+ m.removeEventListener("contextmenu", x);
1238
+ };
1239
+ }, [f, a]);
1240
+ const B = t.useMemo(() => ({
1241
+ open: l
1242
+ }), [l]);
1243
+ return Y("div", o, {
1244
+ state: B,
1245
+ ref: [h, i],
1246
+ props: [{
1247
+ onContextMenu: A,
1248
+ onTouchStart: y,
1249
+ onTouchMove: D,
1250
+ onTouchEnd: p,
1251
+ onTouchCancel: p,
1252
+ style: {
1253
+ WebkitTouchCallout: "none"
1254
+ }
1255
+ }, d],
1256
+ stateAttributesMapping: rn
1257
+ });
1258
+ });
1259
+ process.env.NODE_ENV !== "production" && (Tt.displayName = "ContextMenuTrigger");
1260
+ const H = {
1261
+ "context-menu": "_context-menu_zcfxh_1",
1262
+ "context-menu__item": "_context-menu__item_zcfxh_10",
1263
+ "context-menu__item-icon": "_context-menu__item-icon_zcfxh_22",
1264
+ "context-menu__item-shortcut": "_context-menu__item-shortcut_zcfxh_29",
1265
+ "context-menu__label": "_context-menu__label_zcfxh_34"
1266
+ }, Ot = Kt("root");
1267
+ function $o({
1268
+ trigger: e,
1269
+ background: o = "root",
1270
+ className: i,
1271
+ children: C,
1272
+ style: E,
1273
+ ...d
1274
+ }) {
1275
+ return /* @__PURE__ */ c(Ot.Provider, { value: o, children: /* @__PURE__ */ ee(ao, { ...d, children: [
1276
+ e ? /* @__PURE__ */ c(Tt, { render: e }) : null,
1277
+ /* @__PURE__ */ c(Le, { children: /* @__PURE__ */ c(Fe, { children: /* @__PURE__ */ c(
1278
+ Ae,
1279
+ {
1280
+ render: /* @__PURE__ */ c(it, { background: o }),
1281
+ className: de(
1282
+ H["context-menu"],
1283
+ lt["transition_fade-out"],
1284
+ i
1285
+ ),
1286
+ style: E,
1287
+ children: C
1288
+ }
1289
+ ) }) })
1290
+ ] }) });
1291
+ }
1292
+ function Jo({
1293
+ icon: e,
1294
+ shortcut: o,
1295
+ className: i,
1296
+ children: C,
1297
+ ...E
1298
+ }) {
1299
+ return /* @__PURE__ */ ee(
1300
+ Re,
1301
+ {
1302
+ render: /* @__PURE__ */ c(Rt, { ...E }),
1303
+ interactive: "list-item",
1304
+ className: de(H["context-menu__item"], i),
1305
+ children: [
1306
+ e ? /* @__PURE__ */ c(ce, { name: e, className: H["context-menu__item-icon"] }) : null,
1307
+ Ce(C),
1308
+ o ? /* @__PURE__ */ c(
1309
+ at,
1310
+ {
1311
+ className: H["context-menu__item-shortcut"],
1312
+ color: "dimmest",
1313
+ size: "sm",
1314
+ children: o
1315
+ }
1316
+ ) : null
1317
+ ]
1318
+ }
1319
+ );
1320
+ }
1321
+ function Qo(e) {
1322
+ return /* @__PURE__ */ c(Xt, { render: /* @__PURE__ */ c(jt, {}), ...e });
1323
+ }
1324
+ function Zo({
1325
+ label: e,
1326
+ children: o,
1327
+ ...i
1328
+ }) {
1329
+ return /* @__PURE__ */ ee(Mt, { ...i, children: [
1330
+ e ? /* @__PURE__ */ c(
1331
+ at,
1332
+ {
1333
+ render: /* @__PURE__ */ c(Ct, {}),
1334
+ className: H["context-menu__label"],
1335
+ color: "dimmest",
1336
+ size: "sm",
1337
+ children: e
1338
+ }
1339
+ ) : null,
1340
+ o
1341
+ ] });
1342
+ }
1343
+ const er = bt;
1344
+ function tr({
1345
+ className: e,
1346
+ children: o,
1347
+ ...i
1348
+ }) {
1349
+ return /* @__PURE__ */ ee(
1350
+ Re,
1351
+ {
1352
+ interactive: "list-item",
1353
+ render: /* @__PURE__ */ c(vt, { ...i }),
1354
+ className: de(H["context-menu__item"], e),
1355
+ children: [
1356
+ /* @__PURE__ */ c(
1357
+ Et,
1358
+ {
1359
+ className: H["context-menu__item-icon"],
1360
+ children: /* @__PURE__ */ c(ce, { name: "checkbox-circle-line", color: st.primaryDefault })
1361
+ }
1362
+ ),
1363
+ Ce(o)
1364
+ ]
1365
+ }
1366
+ );
1367
+ }
1368
+ function nr({
1369
+ className: e,
1370
+ children: o,
1371
+ ...i
1372
+ }) {
1373
+ return /* @__PURE__ */ ee(
1374
+ Re,
1375
+ {
1376
+ interactive: "list-item",
1377
+ render: /* @__PURE__ */ c(ht, { ...i }),
1378
+ className: de(H["context-menu__item"], e),
1379
+ children: [
1380
+ /* @__PURE__ */ c(
1381
+ xt,
1382
+ {
1383
+ className: H["context-menu__item-icon"],
1384
+ children: /* @__PURE__ */ c(ce, { name: "check-line", color: st.primaryDefault })
1385
+ }
1386
+ ),
1387
+ Ce(o)
1388
+ ]
1389
+ }
1390
+ );
1391
+ }
1392
+ function or({
1393
+ label: e,
1394
+ icon: o,
1395
+ children: i,
1396
+ className: C,
1397
+ style: E,
1398
+ ...d
1399
+ }) {
1400
+ const R = Wt(Ot);
1401
+ return /* @__PURE__ */ ee(io, { ...d, children: [
1402
+ /* @__PURE__ */ ee(
1403
+ Re,
1404
+ {
1405
+ render: /* @__PURE__ */ c(St, {}),
1406
+ className: H["context-menu__item"],
1407
+ children: [
1408
+ o ? /* @__PURE__ */ c(ce, { name: o, className: H["context-menu__item-icon"] }) : null,
1409
+ Ce(e),
1410
+ /* @__PURE__ */ c(
1411
+ ce,
1412
+ {
1413
+ name: "arrow-right-line",
1414
+ className: H["context-menu__item-shortcut"]
1415
+ }
1416
+ )
1417
+ ]
1418
+ }
1419
+ ),
1420
+ /* @__PURE__ */ c(Le, { children: /* @__PURE__ */ c(Fe, { alignOffset: -4, sideOffset: -4, children: /* @__PURE__ */ c(
1421
+ Ae,
1422
+ {
1423
+ render: /* @__PURE__ */ c(it, { background: R }),
1424
+ className: de(
1425
+ H["context-menu"],
1426
+ lt.transition_scale,
1427
+ C
1428
+ ),
1429
+ style: E,
1430
+ children: i
1431
+ }
1432
+ ) }) })
1433
+ ] });
1434
+ }
1435
+ export {
1436
+ $o as ContextMenu,
1437
+ nr as ContextMenuCheckboxItem,
1438
+ Zo as ContextMenuGroup,
1439
+ Jo as ContextMenuItem,
1440
+ or as ContextMenuMore,
1441
+ er as ContextMenuRadioGroup,
1442
+ tr as ContextMenuRadioItem,
1443
+ Qo as ContextMenuSeparator
1444
+ };