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