@mortenbrudvik/waveui 0.4.0 → 0.7.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 (574) hide show
  1. package/README.md +1221 -173
  2. package/dist/_virtual/_rolldown/runtime.cjs +1 -0
  3. package/dist/components/button/Button.cjs +2 -0
  4. package/dist/components/button/Button.cjs.map +1 -0
  5. package/dist/components/button/Button.mjs +50 -0
  6. package/dist/components/button/Button.mjs.map +1 -0
  7. package/dist/components/button/Button.semantics.cjs +2 -0
  8. package/dist/components/button/Button.semantics.cjs.map +1 -0
  9. package/dist/components/button/Button.semantics.mjs +61 -0
  10. package/dist/components/button/Button.semantics.mjs.map +1 -0
  11. package/dist/components/button/Button.slots.cjs +2 -0
  12. package/dist/components/button/Button.slots.cjs.map +1 -0
  13. package/dist/components/button/Button.slots.mjs +47 -0
  14. package/dist/components/button/Button.slots.mjs.map +1 -0
  15. package/dist/components/button/CompoundButton.cjs +2 -0
  16. package/dist/components/button/CompoundButton.cjs.map +1 -0
  17. package/dist/components/button/CompoundButton.mjs +53 -0
  18. package/dist/components/button/CompoundButton.mjs.map +1 -0
  19. package/dist/components/button/Link.cjs +2 -0
  20. package/dist/components/button/Link.cjs.map +1 -0
  21. package/dist/components/button/Link.mjs +37 -0
  22. package/dist/components/button/Link.mjs.map +1 -0
  23. package/dist/components/button/MenuButton.cjs +2 -0
  24. package/dist/components/button/MenuButton.cjs.map +1 -0
  25. package/dist/components/button/MenuButton.mjs +45 -0
  26. package/dist/components/button/MenuButton.mjs.map +1 -0
  27. package/dist/components/button/SplitButton.cjs +2 -0
  28. package/dist/components/button/SplitButton.cjs.map +1 -0
  29. package/dist/components/button/SplitButton.mjs +66 -0
  30. package/dist/components/button/SplitButton.mjs.map +1 -0
  31. package/dist/components/button/ToggleButton.cjs +2 -0
  32. package/dist/components/button/ToggleButton.cjs.map +1 -0
  33. package/dist/components/button/ToggleButton.mjs +65 -0
  34. package/dist/components/button/ToggleButton.mjs.map +1 -0
  35. package/dist/components/button/Toolbar.cjs +2 -0
  36. package/dist/components/button/Toolbar.cjs.map +1 -0
  37. package/dist/components/button/Toolbar.context.cjs +2 -0
  38. package/dist/components/button/Toolbar.context.cjs.map +1 -0
  39. package/dist/components/button/Toolbar.context.mjs +31 -0
  40. package/dist/components/button/Toolbar.context.mjs.map +1 -0
  41. package/dist/components/button/Toolbar.mjs +63 -0
  42. package/dist/components/button/Toolbar.mjs.map +1 -0
  43. package/dist/components/button/Toolbar.parts.cjs +2 -0
  44. package/dist/components/button/Toolbar.parts.cjs.map +1 -0
  45. package/dist/components/button/Toolbar.parts.mjs +131 -0
  46. package/dist/components/button/Toolbar.parts.mjs.map +1 -0
  47. package/dist/components/button/buttonStyles.cjs +2 -0
  48. package/dist/components/button/buttonStyles.cjs.map +1 -0
  49. package/dist/components/button/buttonStyles.mjs +39 -0
  50. package/dist/components/button/buttonStyles.mjs.map +1 -0
  51. package/dist/components/data-display/Avatar.cjs +2 -0
  52. package/dist/components/data-display/Avatar.cjs.map +1 -0
  53. package/dist/components/data-display/Avatar.mjs +157 -0
  54. package/dist/components/data-display/Avatar.mjs.map +1 -0
  55. package/dist/components/data-display/AvatarGroup.cjs +2 -0
  56. package/dist/components/data-display/AvatarGroup.cjs.map +1 -0
  57. package/dist/components/data-display/AvatarGroup.mjs +134 -0
  58. package/dist/components/data-display/AvatarGroup.mjs.map +1 -0
  59. package/dist/components/data-display/Badge.cjs +2 -0
  60. package/dist/components/data-display/Badge.cjs.map +1 -0
  61. package/dist/components/data-display/Badge.colors.cjs +2 -0
  62. package/dist/components/data-display/Badge.colors.cjs.map +1 -0
  63. package/dist/components/data-display/Badge.colors.mjs +58 -0
  64. package/dist/components/data-display/Badge.colors.mjs.map +1 -0
  65. package/dist/components/data-display/Badge.mjs +32 -0
  66. package/dist/components/data-display/Badge.mjs.map +1 -0
  67. package/dist/components/data-display/CounterBadge.cjs +2 -0
  68. package/dist/components/data-display/CounterBadge.cjs.map +1 -0
  69. package/dist/components/data-display/CounterBadge.mjs +28 -0
  70. package/dist/components/data-display/CounterBadge.mjs.map +1 -0
  71. package/dist/components/data-display/Divider.cjs +2 -0
  72. package/dist/components/data-display/Divider.cjs.map +1 -0
  73. package/dist/components/data-display/Divider.mjs +52 -0
  74. package/dist/components/data-display/Divider.mjs.map +1 -0
  75. package/dist/components/data-display/Image.cjs +2 -0
  76. package/dist/components/data-display/Image.cjs.map +1 -0
  77. package/dist/components/data-display/Image.mjs +32 -0
  78. package/dist/components/data-display/Image.mjs.map +1 -0
  79. package/dist/components/data-display/InfoLabel.cjs +2 -0
  80. package/dist/components/data-display/InfoLabel.cjs.map +1 -0
  81. package/dist/components/data-display/InfoLabel.mjs +104 -0
  82. package/dist/components/data-display/InfoLabel.mjs.map +1 -0
  83. package/dist/components/data-display/List.cjs +2 -0
  84. package/dist/components/data-display/List.cjs.map +1 -0
  85. package/dist/components/data-display/List.mjs +381 -0
  86. package/dist/components/data-display/List.mjs.map +1 -0
  87. package/dist/components/data-display/List.registry.cjs +2 -0
  88. package/dist/components/data-display/List.registry.cjs.map +1 -0
  89. package/dist/components/data-display/List.registry.mjs +101 -0
  90. package/dist/components/data-display/List.registry.mjs.map +1 -0
  91. package/dist/components/data-display/Persona.cjs +2 -0
  92. package/dist/components/data-display/Persona.cjs.map +1 -0
  93. package/dist/components/data-display/Persona.mjs +48 -0
  94. package/dist/components/data-display/Persona.mjs.map +1 -0
  95. package/dist/components/data-display/PresenceBadge.cjs +2 -0
  96. package/dist/components/data-display/PresenceBadge.cjs.map +1 -0
  97. package/dist/components/data-display/PresenceBadge.mjs +71 -0
  98. package/dist/components/data-display/PresenceBadge.mjs.map +1 -0
  99. package/dist/components/data-display/Tag.cjs +2 -0
  100. package/dist/components/data-display/Tag.cjs.map +1 -0
  101. package/dist/components/data-display/Tag.mjs +147 -0
  102. package/dist/components/data-display/Tag.mjs.map +1 -0
  103. package/dist/components/feedback/MessageBar.cjs +2 -0
  104. package/dist/components/feedback/MessageBar.cjs.map +1 -0
  105. package/dist/components/feedback/MessageBar.mjs +144 -0
  106. package/dist/components/feedback/MessageBar.mjs.map +1 -0
  107. package/dist/components/feedback/MessageBar.status.cjs +2 -0
  108. package/dist/components/feedback/MessageBar.status.cjs.map +1 -0
  109. package/dist/components/feedback/MessageBar.status.mjs +45 -0
  110. package/dist/components/feedback/MessageBar.status.mjs.map +1 -0
  111. package/dist/components/feedback/ProgressBar.cjs +2 -0
  112. package/dist/components/feedback/ProgressBar.cjs.map +1 -0
  113. package/dist/components/feedback/ProgressBar.mjs +72 -0
  114. package/dist/components/feedback/ProgressBar.mjs.map +1 -0
  115. package/dist/components/feedback/Skeleton.cjs +2 -0
  116. package/dist/components/feedback/Skeleton.cjs.map +1 -0
  117. package/dist/components/feedback/Skeleton.mjs +47 -0
  118. package/dist/components/feedback/Skeleton.mjs.map +1 -0
  119. package/dist/components/feedback/Spinner.cjs +2 -0
  120. package/dist/components/feedback/Spinner.cjs.map +1 -0
  121. package/dist/components/feedback/Spinner.mjs +60 -0
  122. package/dist/components/feedback/Spinner.mjs.map +1 -0
  123. package/dist/components/feedback/Toast.cjs +2 -0
  124. package/dist/components/feedback/Toast.cjs.map +1 -0
  125. package/dist/components/feedback/Toast.mjs +347 -0
  126. package/dist/components/feedback/Toast.mjs.map +1 -0
  127. package/dist/components/input/Checkbox.cjs +2 -0
  128. package/dist/components/input/Checkbox.cjs.map +1 -0
  129. package/dist/components/input/Checkbox.mjs +96 -0
  130. package/dist/components/input/Checkbox.mjs.map +1 -0
  131. package/dist/components/input/ColorPicker.cjs +6 -0
  132. package/dist/components/input/ColorPicker.cjs.map +1 -0
  133. package/dist/components/input/ColorPicker.mjs +236 -0
  134. package/dist/components/input/ColorPicker.mjs.map +1 -0
  135. package/dist/components/input/Combobox.cjs +2 -0
  136. package/dist/components/input/Combobox.cjs.map +1 -0
  137. package/dist/components/input/Combobox.expand.cjs +2 -0
  138. package/dist/components/input/Combobox.expand.cjs.map +1 -0
  139. package/dist/components/input/Combobox.expand.mjs +38 -0
  140. package/dist/components/input/Combobox.expand.mjs.map +1 -0
  141. package/dist/components/input/Combobox.mjs +187 -0
  142. package/dist/components/input/Combobox.mjs.map +1 -0
  143. package/dist/components/input/DatePicker.cjs +2 -0
  144. package/dist/components/input/DatePicker.cjs.map +1 -0
  145. package/dist/components/input/DatePicker.mjs +340 -0
  146. package/dist/components/input/DatePicker.mjs.map +1 -0
  147. package/dist/components/input/Dropdown.cjs +2 -0
  148. package/dist/components/input/Dropdown.cjs.map +1 -0
  149. package/dist/components/input/Dropdown.mjs +128 -0
  150. package/dist/components/input/Dropdown.mjs.map +1 -0
  151. package/dist/components/input/Field.cjs +2 -0
  152. package/dist/components/input/Field.cjs.map +1 -0
  153. package/dist/components/input/Field.mjs +200 -0
  154. package/dist/components/input/Field.mjs.map +1 -0
  155. package/dist/components/input/Input.cjs +2 -0
  156. package/dist/components/input/Input.cjs.map +1 -0
  157. package/dist/components/input/Input.mjs +81 -0
  158. package/dist/components/input/Input.mjs.map +1 -0
  159. package/dist/components/input/Label.cjs +2 -0
  160. package/dist/components/input/Label.cjs.map +1 -0
  161. package/dist/components/input/Label.mjs +28 -0
  162. package/dist/components/input/Label.mjs.map +1 -0
  163. package/dist/components/input/Option.cjs +2 -0
  164. package/dist/components/input/Option.cjs.map +1 -0
  165. package/dist/components/input/Option.mjs +169 -0
  166. package/dist/components/input/Option.mjs.map +1 -0
  167. package/dist/components/input/RadioGroup.cjs +2 -0
  168. package/dist/components/input/RadioGroup.cjs.map +1 -0
  169. package/dist/components/input/RadioGroup.mjs +139 -0
  170. package/dist/components/input/RadioGroup.mjs.map +1 -0
  171. package/dist/components/input/Rating.cjs +2 -0
  172. package/dist/components/input/Rating.cjs.map +1 -0
  173. package/dist/components/input/Rating.mjs +196 -0
  174. package/dist/components/input/Rating.mjs.map +1 -0
  175. package/dist/components/input/SearchBox.cjs +2 -0
  176. package/dist/components/input/SearchBox.cjs.map +1 -0
  177. package/dist/components/input/SearchBox.mjs +205 -0
  178. package/dist/components/input/SearchBox.mjs.map +1 -0
  179. package/dist/components/input/Select.cjs +2 -0
  180. package/dist/components/input/Select.cjs.map +1 -0
  181. package/dist/components/input/Select.mjs +33 -0
  182. package/dist/components/input/Select.mjs.map +1 -0
  183. package/dist/components/input/Slider.cjs +2 -0
  184. package/dist/components/input/Slider.cjs.map +1 -0
  185. package/dist/components/input/Slider.mjs +79 -0
  186. package/dist/components/input/Slider.mjs.map +1 -0
  187. package/dist/components/input/SpinButton.cjs +2 -0
  188. package/dist/components/input/SpinButton.cjs.map +1 -0
  189. package/dist/components/input/SpinButton.mjs +157 -0
  190. package/dist/components/input/SpinButton.mjs.map +1 -0
  191. package/dist/components/input/SwatchPicker.cjs +2 -0
  192. package/dist/components/input/SwatchPicker.cjs.map +1 -0
  193. package/dist/components/input/SwatchPicker.mjs +113 -0
  194. package/dist/components/input/SwatchPicker.mjs.map +1 -0
  195. package/dist/components/input/Switch.cjs +2 -0
  196. package/dist/components/input/Switch.cjs.map +1 -0
  197. package/dist/components/input/Switch.mjs +92 -0
  198. package/dist/components/input/Switch.mjs.map +1 -0
  199. package/dist/components/input/TagPicker.cjs +2 -0
  200. package/dist/components/input/TagPicker.cjs.map +1 -0
  201. package/dist/components/input/TagPicker.mjs +249 -0
  202. package/dist/components/input/TagPicker.mjs.map +1 -0
  203. package/dist/components/input/Textarea.cjs +2 -0
  204. package/dist/components/input/Textarea.cjs.map +1 -0
  205. package/dist/components/input/Textarea.mjs +32 -0
  206. package/dist/components/input/Textarea.mjs.map +1 -0
  207. package/dist/components/input/TimePicker.cjs +2 -0
  208. package/dist/components/input/TimePicker.cjs.map +1 -0
  209. package/dist/components/input/TimePicker.mjs +292 -0
  210. package/dist/components/input/TimePicker.mjs.map +1 -0
  211. package/dist/components/input/colorUtils.cjs +2 -0
  212. package/dist/components/input/colorUtils.cjs.map +1 -0
  213. package/dist/components/input/colorUtils.mjs +96 -0
  214. package/dist/components/input/colorUtils.mjs.map +1 -0
  215. package/dist/components/input/dateUtils.cjs +2 -0
  216. package/dist/components/input/dateUtils.cjs.map +1 -0
  217. package/dist/components/input/dateUtils.mjs +250 -0
  218. package/dist/components/input/dateUtils.mjs.map +1 -0
  219. package/dist/components/input/pickerStyles.cjs +2 -0
  220. package/dist/components/input/pickerStyles.cjs.map +1 -0
  221. package/dist/components/input/pickerStyles.mjs +10 -0
  222. package/dist/components/input/pickerStyles.mjs.map +1 -0
  223. package/dist/components/internal/HiddenInput.cjs +2 -0
  224. package/dist/components/internal/HiddenInput.cjs.map +1 -0
  225. package/dist/components/internal/HiddenInput.mjs +88 -0
  226. package/dist/components/internal/HiddenInput.mjs.map +1 -0
  227. package/dist/components/layout/Accordion.cjs +2 -0
  228. package/dist/components/layout/Accordion.cjs.map +1 -0
  229. package/dist/components/layout/Accordion.mjs +236 -0
  230. package/dist/components/layout/Accordion.mjs.map +1 -0
  231. package/dist/components/layout/Card.cjs +2 -0
  232. package/dist/components/layout/Card.cjs.map +1 -0
  233. package/dist/components/layout/Card.mjs +121 -0
  234. package/dist/components/layout/Card.mjs.map +1 -0
  235. package/dist/components/layout/Carousel.cjs +2 -0
  236. package/dist/components/layout/Carousel.cjs.map +1 -0
  237. package/dist/components/layout/Carousel.mjs +205 -0
  238. package/dist/components/layout/Carousel.mjs.map +1 -0
  239. package/dist/components/layout/Flex.cjs +2 -0
  240. package/dist/components/layout/Flex.cjs.map +1 -0
  241. package/dist/components/layout/Flex.mjs +54 -0
  242. package/dist/components/layout/Flex.mjs.map +1 -0
  243. package/dist/components/layout/Grid.cjs +2 -0
  244. package/dist/components/layout/Grid.cjs.map +1 -0
  245. package/dist/components/layout/Grid.mjs +62 -0
  246. package/dist/components/layout/Grid.mjs.map +1 -0
  247. package/dist/components/layout/Overflow.cjs +2 -0
  248. package/dist/components/layout/Overflow.cjs.map +1 -0
  249. package/dist/components/layout/Overflow.mjs +269 -0
  250. package/dist/components/layout/Overflow.mjs.map +1 -0
  251. package/dist/components/layout/Stack.cjs +2 -0
  252. package/dist/components/layout/Stack.cjs.map +1 -0
  253. package/dist/components/layout/Stack.mjs +39 -0
  254. package/dist/components/layout/Stack.mjs.map +1 -0
  255. package/dist/components/layout/TabList.cjs +2 -0
  256. package/dist/components/layout/TabList.cjs.map +1 -0
  257. package/dist/components/layout/TabList.mjs +238 -0
  258. package/dist/components/layout/TabList.mjs.map +1 -0
  259. package/dist/components/layout/Tree.cjs +2 -0
  260. package/dist/components/layout/Tree.cjs.map +1 -0
  261. package/dist/components/layout/Tree.mjs +220 -0
  262. package/dist/components/layout/Tree.mjs.map +1 -0
  263. package/dist/components/layout/disclosureIds.cjs +2 -0
  264. package/dist/components/layout/disclosureIds.cjs.map +1 -0
  265. package/dist/components/layout/disclosureIds.mjs +12 -0
  266. package/dist/components/layout/disclosureIds.mjs.map +1 -0
  267. package/dist/components/motion/Presence.cjs +2 -0
  268. package/dist/components/motion/Presence.cjs.map +1 -0
  269. package/dist/components/motion/Presence.mjs +35 -0
  270. package/dist/components/motion/Presence.mjs.map +1 -0
  271. package/dist/components/navigation/Breadcrumb.cjs +2 -0
  272. package/dist/components/navigation/Breadcrumb.cjs.map +1 -0
  273. package/dist/components/navigation/Breadcrumb.mjs +144 -0
  274. package/dist/components/navigation/Breadcrumb.mjs.map +1 -0
  275. package/dist/components/navigation/Menu.cjs +2 -0
  276. package/dist/components/navigation/Menu.cjs.map +1 -0
  277. package/dist/components/navigation/Menu.context.cjs +2 -0
  278. package/dist/components/navigation/Menu.context.cjs.map +1 -0
  279. package/dist/components/navigation/Menu.context.mjs +82 -0
  280. package/dist/components/navigation/Menu.context.mjs.map +1 -0
  281. package/dist/components/navigation/Menu.group.cjs +2 -0
  282. package/dist/components/navigation/Menu.group.cjs.map +1 -0
  283. package/dist/components/navigation/Menu.group.mjs +58 -0
  284. package/dist/components/navigation/Menu.group.mjs.map +1 -0
  285. package/dist/components/navigation/Menu.items.cjs +2 -0
  286. package/dist/components/navigation/Menu.items.cjs.map +1 -0
  287. package/dist/components/navigation/Menu.items.mjs +127 -0
  288. package/dist/components/navigation/Menu.items.mjs.map +1 -0
  289. package/dist/components/navigation/Menu.link.cjs +2 -0
  290. package/dist/components/navigation/Menu.link.cjs.map +1 -0
  291. package/dist/components/navigation/Menu.link.mjs +41 -0
  292. package/dist/components/navigation/Menu.link.mjs.map +1 -0
  293. package/dist/components/navigation/Menu.mjs +27 -0
  294. package/dist/components/navigation/Menu.mjs.map +1 -0
  295. package/dist/components/navigation/Menu.popover.cjs +2 -0
  296. package/dist/components/navigation/Menu.popover.cjs.map +1 -0
  297. package/dist/components/navigation/Menu.popover.mjs +231 -0
  298. package/dist/components/navigation/Menu.popover.mjs.map +1 -0
  299. package/dist/components/navigation/Menu.root.cjs +2 -0
  300. package/dist/components/navigation/Menu.root.cjs.map +1 -0
  301. package/dist/components/navigation/Menu.root.mjs +308 -0
  302. package/dist/components/navigation/Menu.root.mjs.map +1 -0
  303. package/dist/components/navigation/Menu.selectable.cjs +2 -0
  304. package/dist/components/navigation/Menu.selectable.cjs.map +1 -0
  305. package/dist/components/navigation/Menu.selectable.mjs +89 -0
  306. package/dist/components/navigation/Menu.selectable.mjs.map +1 -0
  307. package/dist/components/navigation/Menu.shared.cjs +2 -0
  308. package/dist/components/navigation/Menu.shared.cjs.map +1 -0
  309. package/dist/components/navigation/Menu.shared.mjs +23 -0
  310. package/dist/components/navigation/Menu.shared.mjs.map +1 -0
  311. package/dist/components/navigation/Menu.splitGroup.cjs +2 -0
  312. package/dist/components/navigation/Menu.splitGroup.cjs.map +1 -0
  313. package/dist/components/navigation/Menu.splitGroup.mjs +51 -0
  314. package/dist/components/navigation/Menu.splitGroup.mjs.map +1 -0
  315. package/dist/components/navigation/Menu.trigger.cjs +2 -0
  316. package/dist/components/navigation/Menu.trigger.cjs.map +1 -0
  317. package/dist/components/navigation/Menu.trigger.mjs +79 -0
  318. package/dist/components/navigation/Menu.trigger.mjs.map +1 -0
  319. package/dist/components/navigation/Nav.cjs +2 -0
  320. package/dist/components/navigation/Nav.cjs.map +1 -0
  321. package/dist/components/navigation/Nav.mjs +276 -0
  322. package/dist/components/navigation/Nav.mjs.map +1 -0
  323. package/dist/components/navigation/Pagination.cjs +2 -0
  324. package/dist/components/navigation/Pagination.cjs.map +1 -0
  325. package/dist/components/navigation/Pagination.mjs +110 -0
  326. package/dist/components/navigation/Pagination.mjs.map +1 -0
  327. package/dist/components/navigation/Stepper.cjs +2 -0
  328. package/dist/components/navigation/Stepper.cjs.map +1 -0
  329. package/dist/components/navigation/Stepper.mjs +204 -0
  330. package/dist/components/navigation/Stepper.mjs.map +1 -0
  331. package/dist/components/overlays/Dialog.cjs +2 -0
  332. package/dist/components/overlays/Dialog.cjs.map +1 -0
  333. package/dist/components/overlays/Dialog.mjs +180 -0
  334. package/dist/components/overlays/Dialog.mjs.map +1 -0
  335. package/dist/components/overlays/Dialog.shared.cjs +2 -0
  336. package/dist/components/overlays/Dialog.shared.cjs.map +1 -0
  337. package/dist/components/overlays/Dialog.shared.mjs +227 -0
  338. package/dist/components/overlays/Dialog.shared.mjs.map +1 -0
  339. package/dist/components/overlays/Drawer.cjs +2 -0
  340. package/dist/components/overlays/Drawer.cjs.map +1 -0
  341. package/dist/components/overlays/Drawer.mjs +192 -0
  342. package/dist/components/overlays/Drawer.mjs.map +1 -0
  343. package/dist/components/overlays/Popover.cjs +2 -0
  344. package/dist/components/overlays/Popover.cjs.map +1 -0
  345. package/dist/components/overlays/Popover.mjs +365 -0
  346. package/dist/components/overlays/Popover.mjs.map +1 -0
  347. package/dist/components/overlays/Popover.shared.cjs +2 -0
  348. package/dist/components/overlays/Popover.shared.cjs.map +1 -0
  349. package/dist/components/overlays/Popover.shared.mjs +182 -0
  350. package/dist/components/overlays/Popover.shared.mjs.map +1 -0
  351. package/dist/components/overlays/TeachingPopover.cjs +2 -0
  352. package/dist/components/overlays/TeachingPopover.cjs.map +1 -0
  353. package/dist/components/overlays/TeachingPopover.mjs +181 -0
  354. package/dist/components/overlays/TeachingPopover.mjs.map +1 -0
  355. package/dist/components/overlays/Tooltip.cjs +2 -0
  356. package/dist/components/overlays/Tooltip.cjs.map +1 -0
  357. package/dist/components/overlays/Tooltip.mjs +160 -0
  358. package/dist/components/overlays/Tooltip.mjs.map +1 -0
  359. package/dist/components/portal/Portal.cjs +2 -0
  360. package/dist/components/portal/Portal.cjs.map +1 -0
  361. package/dist/components/portal/Portal.mjs +45 -0
  362. package/dist/components/portal/Portal.mjs.map +1 -0
  363. package/dist/components/provider/WaveProvider.cjs +2 -0
  364. package/dist/components/provider/WaveProvider.cjs.map +1 -0
  365. package/dist/components/provider/WaveProvider.mjs +51 -0
  366. package/dist/components/provider/WaveProvider.mjs.map +1 -0
  367. package/dist/components/table/DataGrid.cjs +2 -0
  368. package/dist/components/table/DataGrid.cjs.map +1 -0
  369. package/dist/components/table/DataGrid.mjs +489 -0
  370. package/dist/components/table/DataGrid.mjs.map +1 -0
  371. package/dist/components/table/Table.cjs +2 -0
  372. package/dist/components/table/Table.cjs.map +1 -0
  373. package/dist/components/table/Table.mjs +99 -0
  374. package/dist/components/table/Table.mjs.map +1 -0
  375. package/dist/components/table/useGridNavigation.cjs +2 -0
  376. package/dist/components/table/useGridNavigation.cjs.map +1 -0
  377. package/dist/components/table/useGridNavigation.mjs +336 -0
  378. package/dist/components/table/useGridNavigation.mjs.map +1 -0
  379. package/dist/components/typography/Text.cjs +2 -0
  380. package/dist/components/typography/Text.cjs.map +1 -0
  381. package/dist/components/typography/Text.mjs +38 -0
  382. package/dist/components/typography/Text.mjs.map +1 -0
  383. package/dist/hooks/useAnnounce.cjs +2 -0
  384. package/dist/hooks/useAnnounce.cjs.map +1 -0
  385. package/dist/hooks/useAnnounce.mjs +88 -0
  386. package/dist/hooks/useAnnounce.mjs.map +1 -0
  387. package/dist/hooks/useCheckedValues.cjs +2 -0
  388. package/dist/hooks/useCheckedValues.cjs.map +1 -0
  389. package/dist/hooks/useCheckedValues.mjs +102 -0
  390. package/dist/hooks/useCheckedValues.mjs.map +1 -0
  391. package/dist/hooks/useContextMenuAnchor.cjs +2 -0
  392. package/dist/hooks/useContextMenuAnchor.cjs.map +1 -0
  393. package/dist/hooks/useContextMenuAnchor.mjs +132 -0
  394. package/dist/hooks/useContextMenuAnchor.mjs.map +1 -0
  395. package/dist/hooks/useControllable.cjs +2 -0
  396. package/dist/hooks/useControllable.cjs.map +1 -0
  397. package/dist/hooks/useControllable.mjs +37 -0
  398. package/dist/hooks/useControllable.mjs.map +1 -0
  399. package/dist/hooks/useDirection.cjs +2 -0
  400. package/dist/hooks/useDirection.cjs.map +1 -0
  401. package/dist/hooks/useDirection.mjs +57 -0
  402. package/dist/hooks/useDirection.mjs.map +1 -0
  403. package/dist/hooks/useDismiss.cjs +2 -0
  404. package/dist/hooks/useDismiss.cjs.map +1 -0
  405. package/dist/hooks/useDismiss.mjs +57 -0
  406. package/dist/hooks/useDismiss.mjs.map +1 -0
  407. package/dist/hooks/useEventCallback.cjs +2 -0
  408. package/dist/hooks/useEventCallback.cjs.map +1 -0
  409. package/dist/hooks/useEventCallback.mjs +16 -0
  410. package/dist/hooks/useEventCallback.mjs.map +1 -0
  411. package/dist/hooks/useFieldControl.cjs +2 -0
  412. package/dist/hooks/useFieldControl.cjs.map +1 -0
  413. package/dist/hooks/useFieldControl.mjs +62 -0
  414. package/dist/hooks/useFieldControl.mjs.map +1 -0
  415. package/dist/hooks/useFocusTrap.cjs +2 -0
  416. package/dist/hooks/useFocusTrap.cjs.map +1 -0
  417. package/dist/hooks/useFocusTrap.mjs +266 -0
  418. package/dist/hooks/useFocusTrap.mjs.map +1 -0
  419. package/dist/hooks/useFormReset.cjs +2 -0
  420. package/dist/hooks/useFormReset.cjs.map +1 -0
  421. package/dist/hooks/useFormReset.mjs +33 -0
  422. package/dist/hooks/useFormReset.mjs.map +1 -0
  423. package/dist/hooks/useHoverIntent.cjs +2 -0
  424. package/dist/hooks/useHoverIntent.cjs.map +1 -0
  425. package/dist/hooks/useHoverIntent.mjs +201 -0
  426. package/dist/hooks/useHoverIntent.mjs.map +1 -0
  427. package/dist/hooks/useId.cjs +2 -0
  428. package/dist/hooks/useId.cjs.map +1 -0
  429. package/dist/hooks/useId.mjs +11 -0
  430. package/dist/hooks/useId.mjs.map +1 -0
  431. package/dist/hooks/useIsClient.cjs +2 -0
  432. package/dist/hooks/useIsClient.cjs.map +1 -0
  433. package/dist/hooks/useIsClient.mjs +19 -0
  434. package/dist/hooks/useIsClient.mjs.map +1 -0
  435. package/dist/hooks/useListbox.cjs +2 -0
  436. package/dist/hooks/useListbox.cjs.map +1 -0
  437. package/dist/hooks/useListbox.mjs +492 -0
  438. package/dist/hooks/useListbox.mjs.map +1 -0
  439. package/dist/hooks/useMergedRefs.cjs +2 -0
  440. package/dist/hooks/useMergedRefs.cjs.map +1 -0
  441. package/dist/hooks/useMergedRefs.mjs +57 -0
  442. package/dist/hooks/useMergedRefs.mjs.map +1 -0
  443. package/dist/hooks/useModalIsolation.cjs +2 -0
  444. package/dist/hooks/useModalIsolation.cjs.map +1 -0
  445. package/dist/hooks/useModalIsolation.mjs +87 -0
  446. package/dist/hooks/useModalIsolation.mjs.map +1 -0
  447. package/dist/hooks/useModalLayer.cjs +2 -0
  448. package/dist/hooks/useModalLayer.cjs.map +1 -0
  449. package/dist/hooks/useModalLayer.mjs +30 -0
  450. package/dist/hooks/useModalLayer.mjs.map +1 -0
  451. package/dist/hooks/usePopupPosition.cjs +2 -0
  452. package/dist/hooks/usePopupPosition.cjs.map +1 -0
  453. package/dist/hooks/usePopupPosition.mjs +117 -0
  454. package/dist/hooks/usePopupPosition.mjs.map +1 -0
  455. package/dist/hooks/usePrefersReducedMotion.cjs +2 -0
  456. package/dist/hooks/usePrefersReducedMotion.cjs.map +1 -0
  457. package/dist/hooks/usePrefersReducedMotion.mjs +24 -0
  458. package/dist/hooks/usePrefersReducedMotion.mjs.map +1 -0
  459. package/dist/hooks/usePresence.cjs +2 -0
  460. package/dist/hooks/usePresence.cjs.map +1 -0
  461. package/dist/hooks/usePresence.mjs +136 -0
  462. package/dist/hooks/usePresence.mjs.map +1 -0
  463. package/dist/hooks/usePreserveFocus.cjs +2 -0
  464. package/dist/hooks/usePreserveFocus.cjs.map +1 -0
  465. package/dist/hooks/usePreserveFocus.mjs +50 -0
  466. package/dist/hooks/usePreserveFocus.mjs.map +1 -0
  467. package/dist/hooks/useRestoreFocus.cjs +2 -0
  468. package/dist/hooks/useRestoreFocus.cjs.map +1 -0
  469. package/dist/hooks/useRestoreFocus.mjs +271 -0
  470. package/dist/hooks/useRestoreFocus.mjs.map +1 -0
  471. package/dist/hooks/useRovingTabIndex.cjs +2 -0
  472. package/dist/hooks/useRovingTabIndex.cjs.map +1 -0
  473. package/dist/hooks/useRovingTabIndex.mjs +389 -0
  474. package/dist/hooks/useRovingTabIndex.mjs.map +1 -0
  475. package/dist/hooks/useScrollLock.cjs +2 -0
  476. package/dist/hooks/useScrollLock.cjs.map +1 -0
  477. package/dist/hooks/useScrollLock.mjs +71 -0
  478. package/dist/hooks/useScrollLock.mjs.map +1 -0
  479. package/dist/hooks/useTriggerElement.cjs +2 -0
  480. package/dist/hooks/useTriggerElement.cjs.map +1 -0
  481. package/dist/hooks/useTriggerElement.mjs +126 -0
  482. package/dist/hooks/useTriggerElement.mjs.map +1 -0
  483. package/dist/hooks/useTypeahead.cjs +2 -0
  484. package/dist/hooks/useTypeahead.cjs.map +1 -0
  485. package/dist/hooks/useTypeahead.mjs +38 -0
  486. package/dist/hooks/useTypeahead.mjs.map +1 -0
  487. package/dist/index.cjs +1 -1
  488. package/dist/index.d.cts +9099 -0
  489. package/dist/index.d.ts +7688 -1027
  490. package/dist/index.mjs +91 -5695
  491. package/dist/lib/aria.cjs +2 -0
  492. package/dist/lib/aria.cjs.map +1 -0
  493. package/dist/lib/aria.mjs +29 -0
  494. package/dist/lib/aria.mjs.map +1 -0
  495. package/dist/lib/children.cjs +2 -0
  496. package/dist/lib/children.cjs.map +1 -0
  497. package/dist/lib/children.mjs +37 -0
  498. package/dist/lib/children.mjs.map +1 -0
  499. package/dist/lib/cn.cjs +2 -0
  500. package/dist/lib/cn.cjs.map +1 -0
  501. package/dist/lib/cn.mjs +64 -0
  502. package/dist/lib/cn.mjs.map +1 -0
  503. package/dist/lib/composeEventHandlers.cjs +2 -0
  504. package/dist/lib/composeEventHandlers.cjs.map +1 -0
  505. package/dist/lib/composeEventHandlers.mjs +11 -0
  506. package/dist/lib/composeEventHandlers.mjs.map +1 -0
  507. package/dist/lib/dev.cjs +2 -0
  508. package/dist/lib/dev.cjs.map +1 -0
  509. package/dist/lib/dev.mjs +42 -0
  510. package/dist/lib/dev.mjs.map +1 -0
  511. package/dist/lib/direction.cjs +2 -0
  512. package/dist/lib/direction.cjs.map +1 -0
  513. package/dist/lib/direction.mjs +35 -0
  514. package/dist/lib/direction.mjs.map +1 -0
  515. package/dist/lib/events.cjs +2 -0
  516. package/dist/lib/events.cjs.map +1 -0
  517. package/dist/lib/events.mjs +31 -0
  518. package/dist/lib/events.mjs.map +1 -0
  519. package/dist/lib/focus.cjs +2 -0
  520. package/dist/lib/focus.cjs.map +1 -0
  521. package/dist/lib/focus.mjs +119 -0
  522. package/dist/lib/focus.mjs.map +1 -0
  523. package/dist/lib/globalRegistry.cjs +2 -0
  524. package/dist/lib/globalRegistry.cjs.map +1 -0
  525. package/dist/lib/globalRegistry.mjs +13 -0
  526. package/dist/lib/globalRegistry.mjs.map +1 -0
  527. package/dist/lib/icons.cjs +2 -0
  528. package/dist/lib/icons.cjs.map +1 -0
  529. package/dist/lib/icons.mjs +254 -0
  530. package/dist/lib/icons.mjs.map +1 -0
  531. package/dist/lib/labelInName.cjs +2 -0
  532. package/dist/lib/labelInName.cjs.map +1 -0
  533. package/dist/lib/labelInName.mjs +54 -0
  534. package/dist/lib/labelInName.mjs.map +1 -0
  535. package/dist/lib/layers.cjs +2 -0
  536. package/dist/lib/layers.cjs.map +1 -0
  537. package/dist/lib/layers.mjs +224 -0
  538. package/dist/lib/layers.mjs.map +1 -0
  539. package/dist/lib/mergeProps.cjs +2 -0
  540. package/dist/lib/mergeProps.cjs.map +1 -0
  541. package/dist/lib/mergeProps.mjs +21 -0
  542. package/dist/lib/mergeProps.mjs.map +1 -0
  543. package/dist/lib/mergeRefs.cjs +2 -0
  544. package/dist/lib/mergeRefs.cjs.map +1 -0
  545. package/dist/lib/mergeRefs.mjs +29 -0
  546. package/dist/lib/mergeRefs.mjs.map +1 -0
  547. package/dist/lib/renderTrigger.cjs +2 -0
  548. package/dist/lib/renderTrigger.cjs.map +1 -0
  549. package/dist/lib/renderTrigger.mjs +29 -0
  550. package/dist/lib/renderTrigger.mjs.map +1 -0
  551. package/dist/lib/slot.cjs +2 -0
  552. package/dist/lib/slot.cjs.map +1 -0
  553. package/dist/lib/slot.mjs +122 -0
  554. package/dist/lib/slot.mjs.map +1 -0
  555. package/dist/lib/styles.cjs +2 -0
  556. package/dist/lib/styles.cjs.map +1 -0
  557. package/dist/lib/styles.mjs +16 -0
  558. package/dist/lib/styles.mjs.map +1 -0
  559. package/dist/lib/theme.cjs +2 -0
  560. package/dist/lib/theme.cjs.map +1 -0
  561. package/dist/lib/theme.mjs +16 -0
  562. package/dist/lib/theme.mjs.map +1 -0
  563. package/dist/preflight.css +2 -0
  564. package/dist/styles.css +2 -0
  565. package/package.json +149 -100
  566. package/src/styles/animations.css +7 -39
  567. package/src/styles/base.css +103 -0
  568. package/src/styles/globals.css +10 -22
  569. package/src/styles/legacy-tokens.css +184 -0
  570. package/src/styles/preflight.css +7 -0
  571. package/src/styles/styles.css +32 -0
  572. package/src/styles/tailwind.css +17 -0
  573. package/src/styles/tokens.css +561 -221
  574. package/src/styles/variants.css +29 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Menu.popover.mjs","names":["React","SUBMENU_SHIFT","isElementTarget","target","useMenuListPointer","hoverGroup","createHoverIntentGroup","hoverFocusingRef","useEventCallback","event","isOwnEvent","item","MENU_ITEM_SELECTOR","root","menu","MenuPopover","rest","useMenuContext","popup","targetElement","surface","setSurface","surfaceRef","setSurfaceElement","element","presenceRef","usePresence","open","usePopupPosition","side","isSubmenu","offset","_maxHeight","_maxWidth","positionStyle","floatingProps","fromContext","contextAnchor","getTriggerFocusTarget","triggerElement","setReference","getReturnFocus","opener","openOnContext","contextOpener","isConnectedAndFocusable","triggerRef","returnFocusRef","targetRef","useDismiss","dismiss","triggerFocusRef","useTriggerFocusRef","openerRef","wasOpenRef","captureOpener","container","doc","isCandidate","el","trigger","active","wasOpen","getCloseFocus","unnamed","isMounted","warnOnce","rovingRef","rovingKeyDown","rovingKeyDownCapture","rovingFocus","useRovingTabIndex","mergedRef","useMergedRefs","ref","setFloating","registerSurface","focusFirst","focusLast","layerId","unmountingRef","focusReturnTargetOnClose","surfaceElement","takeInitialFocus","isPositioned","portalDepth","PortalDepthContext","registerCheckable","useCheckableRegistry","listPointerMove","listContext","closeChain","isHoverFocusing","handleKeyDown","onKeyDown","isEditableTarget","getArrowIntent","getDirection","requestClose","Portal","MenuListContext","labelledBy","presenceProps","menuId","style","withTypeaheadText","composeEventHandlers","onKeyDownCapture","onFocus","onPointerEnter","hoverSurfaceHandlers","onPointerLeave","onPointerMove","onContextMenu","contextSurfaceHandlers","cn","menuPopoverClasses","className"],"sources":["../../../src/components/navigation/Menu.popover.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport type { PopupAlign, PopupSide, PopupTarget } from '../../lib/types';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { warnOnce } from '../../lib/dev';\nimport { getArrowIntent, getDirection } from '../../lib/direction';\nimport { isEditableTarget, isOwnEvent } from '../../lib/events';\nimport { isConnectedAndFocusable } from '../../lib/focus';\nimport { useDismiss } from '../../hooks/useDismiss';\nimport { useEventCallback } from '../../hooks/useEventCallback';\nimport { createHoverIntentGroup, type HoverIntentGroup } from '../../hooks/useHoverIntent';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { usePopupPosition } from '../../hooks/usePopupPosition';\nimport { usePresence } from '../../hooks/usePresence';\nimport { useRestoreFocus } from '../../hooks/useRestoreFocus';\nimport { useRovingTabIndex } from '../../hooks/useRovingTabIndex';\nimport { getTriggerFocusTarget, useTriggerFocusRef } from '../../hooks/useTriggerElement';\nimport { Portal, PortalDepthContext } from '../portal/Portal';\nimport { MenuListContext, useCheckableRegistry, useMenuContext } from './Menu.context';\nimport type { MenuContextValue, MenuListContextValue } from './Menu.context';\nimport {\n MENU_ITEM_SELECTOR,\n menuPopoverClasses,\n useStaticMenuPartWarning,\n withTypeaheadText,\n} from './Menu.shared';\n\n/** Properties for the MenuPopover sub-component. */\nexport interface MenuPopoverProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'id'> {\n /**\n * Side of the trigger the menu opens on (`start`/`end` follow the writing direction).\n * @default 'bottom' ('end' in a submenu)\n */\n side?: PopupSide;\n /** Alignment along that side. @default 'start' */\n align?: PopupAlign;\n /** Distance from the trigger in px. @default 4 (0 in a submenu) */\n offset?: number;\n /**\n * Where to place the menu instead of next to `Menu.Trigger`: an element or a `VirtualElement`\n * (a rectangle, such as a point; an inline object is fine). With a controlled `open`, a menu\n * with a `target` needs no trigger; name it with `aria-label`, and give a toggle button you use\n * as the target `aria-haspopup=\"menu\"` and `aria-expanded` yourself (the menu's `id` is\n * generated, so the toggle cannot point `aria-controls` at it). A press on a target element\n * does not close the menu. Hold the element in state (a ref cannot be observed;\n * TeachingPopover's `target` also takes a ref). A menu opened by `openOnContext` is placed at\n * the gesture instead.\n */\n target?: PopupTarget;\n /** Menu items and dividers. */\n children: React.ReactNode;\n /**\n * Ref to the portaled `role=\"menu\"` surface. Its `id` is generated (the trigger's\n * `aria-controls` points to it), and it is labelled by the trigger unless `aria-label` or\n * `aria-labelledby` is given (one that holds `undefined` counts as not given).\n */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/**\n * A submenu with room on neither side of its trigger item is shifted across that side, over its\n * parent menu, to stay inside the viewport (as native and Fluent menus do).\n */\nconst SUBMENU_SHIFT = { padding: 8, crossAxis: true } as const;\n\n/** Whether a `target` is an element (duck typed, so an element of another realm counts). */\nfunction isElementTarget(target: PopupTarget | undefined): target is HTMLElement {\n return !!target && (target as Partial<Node>).nodeType === 1;\n}\n\n/**\n * Internal: the mouse behaviour of a menu list (the static root and every `Menu.Popover`\n * surface). While focus is inside a list of the menu tree (the chain's root list or any of its\n * submenus), a mouse `pointermove` over an enabled item of this list focuses it (`preventScroll`),\n * unless it already has focus or a submenu's safe zone of this list holds the point. Hover moves\n * no focus while focus is elsewhere, so a hover-opened menu or a static menu the user is not in\n * never takes focus from the page, and a Popover, Dialog or other portal opened from an item\n * keeps it. Also returns the list's hover group (the safe zones of its submenu trigger items) and\n * the flag the submenus of the list read while such a focus change runs.\n */\nexport function useMenuListPointer(menu: MenuContextValue): {\n hoverGroup: HoverIntentGroup;\n isHoverFocusing: () => boolean;\n onPointerMove: React.PointerEventHandler<HTMLElement>;\n} {\n const [hoverGroup] = React.useState(createHoverIntentGroup);\n const hoverFocusingRef = React.useRef(false);\n const isHoverFocusing = React.useCallback(() => hoverFocusingRef.current, []);\n const onPointerMove = useEventCallback((event: React.PointerEvent<HTMLElement>) => {\n if (event.pointerType === 'touch' || event.pointerType === 'pen' || !isOwnEvent(event)) return;\n const target = event.target as Element;\n const item = target.closest<HTMLElement>(MENU_ITEM_SELECTOR);\n if (!item || !event.currentTarget.contains(item)) return;\n if (item.getAttribute('aria-disabled') === 'true') return;\n if (item.ownerDocument.activeElement === item) return;\n let root = menu;\n while (root.parent) root = root.parent;\n if (!root.listContainsFocus() || hoverGroup.isHeld(event.clientX, event.clientY)) return;\n hoverFocusingRef.current = true;\n item.focus({ preventScroll: true });\n // A submenu that just lost focus is dismissed (focus outside) in a microtask the focus change\n // queued; the flag is cleared after it.\n queueMicrotask(() => {\n hoverFocusingRef.current = false;\n });\n });\n return { hoverGroup, isHoverFocusing, onPointerMove };\n}\n\n/**\n * The portaled `role=\"menu\"` surface of a popup menu, positioned next to `Menu.Trigger`. A menu\n * taller than the space available scrolls inside the viewport: the surface is limited to the space\n * next to the trigger (`max-height`/`max-width` classes, which a `max-h-*`/`max-w-*` class in\n * `className` or a `style` replaces) and scrolls, and an item that receives focus is scrolled into\n * view. Focus moves to the first (ArrowUp: last) enabled item when it opens; arrows, Home/End and\n * typeahead move between enabled items. Escape closes it and returns focus to the trigger. An\n * outside press closes it and leaves focus where the press put it (on the trigger only when focus\n * was still in the menu or lost to the page). Tab closes it and moves focus to the trigger without\n * preventing the default, so tabbing continues from the trigger (inside a Dialog, the focus trap\n * moves on from there). The trigger here is the element that takes its focus: for a wrapper span,\n * the element inside it that carries the state ARIA (the span itself when you made it the trigger\n * with a `role` such as `button` and `tabIndex={0}`, or when nothing inside it can take focus).\n * Keys from a portal opened inside the menu (a Popover of an item) are left to that portal: Tab\n * there moves on inside it and keeps the menu open.\n *\n * In a submenu it opens at the end side of its trigger item (`side=\"end\"`, `offset={0}`) and\n * flips to fit the viewport; with room on neither side, it overlaps its parent menu inside the\n * viewport. ArrowLeft (ArrowRight in RTL) and Escape close only the submenu and return focus to\n * its trigger item; item activation and Tab close every menu of the chain and put focus on the\n * root trigger.\n *\n * While focus is inside the menu (or one of its submenus), the item under the mouse pointer takes\n * focus, so Enter activates the item you point at. Focus in a Popover, Dialog or other portal\n * opened from an item stays there.\n *\n * A context menu (`openOnContext`) opens at the pointer or at the focused row and returns focus to\n * the element focused at the gesture; it is not labelled by its region, so give it `aria-label`\n * (development warning otherwise), as for a menu placed at a `target` without `Menu.Trigger`.\n *\n * The surface mounts through the presence core (`usePresence`): it carries\n * `data-presence=\"entering\" | \"entered\" | \"exiting\"` and, while it closes, `data-state=\"closed\"`\n * and `inert`, so exit motion classes on `data-presence` keep it on screen until they end. Focus,\n * the dismiss layer and positioning follow the open state, not the exit. Without motion it unmounts\n * as soon as it closes.\n *\n * Also exported as `MenuPopover` (import the flat name from React Server Components).\n */\nexport const MenuPopover = ({\n side,\n align = 'start',\n offset,\n target,\n children,\n className,\n style,\n onKeyDown,\n onKeyDownCapture,\n onFocus,\n onPointerEnter,\n onPointerLeave,\n onPointerMove,\n onContextMenu,\n ref,\n ...rest\n}: MenuPopoverProps) => {\n const menu = useMenuContext('Menu.Popover');\n const {\n popup,\n open,\n takeInitialFocus,\n registerSurface,\n menuId,\n labelledBy,\n triggerRef,\n triggerElement,\n isSubmenu,\n requestClose,\n closeChain,\n dismiss,\n hoverSurfaceHandlers,\n isHoverClose,\n openOnContext,\n contextSurfaceHandlers,\n contextAnchor,\n fromContext,\n contextOpener,\n } = menu;\n useStaticMenuPartWarning('Menu.Popover', popup);\n const targetElement = isElementTarget(target) ? target : null;\n\n const [surface, setSurface] = React.useState<HTMLDivElement | null>(null);\n const surfaceRef = React.useRef<HTMLDivElement | null>(null);\n const setSurfaceElement = React.useCallback((element: HTMLDivElement | null) => {\n surfaceRef.current = element;\n setSurface(element);\n }, []);\n\n // The surface mounts and unmounts through the presence core; everything else below keys on\n // `open`, so focus returns and the layer goes on close, not after an exit motion.\n const { isMounted, ref: presenceRef, presenceProps } = usePresence(open);\n\n const { setReference, setFloating, floatingProps, isPositioned } = usePopupPosition({\n open,\n side: side ?? (isSubmenu ? 'end' : 'bottom'),\n align,\n offset: offset ?? (isSubmenu ? 0 : 4),\n fitViewport: true,\n shift: isSubmenu ? SUBMENU_SHIFT : undefined,\n });\n // The size limits come from menuPopoverClasses, which a consumer class can replace; an inline\n // max-height/max-width would beat every class.\n const { maxHeight: _maxHeight, maxWidth: _maxWidth, ...positionStyle } = floatingProps.style;\n // The positioning reference: the anchor of a context gesture (the point, else the focused row,\n // else the trigger's focus target), else `target`, else the trigger. Kept while the surface\n // exits, so it does not jump; a new inline VirtualElement only recomputes the position.\n React.useLayoutEffect(() => {\n setReference(\n fromContext\n ? (contextAnchor ?? getTriggerFocusTarget(triggerElement) ?? triggerElement)\n : (target ?? triggerElement),\n );\n }, [setReference, contextAnchor, fromContext, target, triggerElement]);\n\n // Where focus returns when the menu closes (item activation, Tab, Escape): in a context menu,\n // the element focused at the gesture when it can take focus; else the element that takes focus\n // for the trigger (for a wrapper span, the element inside it that carries the state ARIA; for a\n // submenu, its trigger item); else a focusable `target` element.\n const getReturnFocus = useEventCallback((): HTMLElement | null => {\n const opener = openOnContext ? contextOpener.current : null;\n if (opener && isConnectedAndFocusable(opener)) return opener;\n const triggerTarget = getTriggerFocusTarget(triggerRef.current);\n if (triggerTarget) return triggerTarget;\n return targetElement && isConnectedAndFocusable(targetElement) ? targetElement : null;\n });\n\n // The layer's anchor (where a surface opened from an item that is gone by then restores focus):\n // the return target, else the trigger itself.\n const returnFocusRef = React.useMemo<React.RefObject<HTMLElement | null>>(\n () => ({\n get current() {\n return getReturnFocus() ?? triggerRef.current;\n },\n }),\n [getReturnFocus, triggerRef],\n );\n // A context region is not part of the layer (a press on another row closes the menu), and a\n // Ctrl+press there is a macOS context click, which moves the menu instead; a target element is.\n const targetRef = { current: targetElement };\n const { layerId } = useDismiss({\n open,\n onDismiss: dismiss,\n refs: openOnContext ? [surfaceRef, targetRef] : [surfaceRef, triggerRef, targetRef],\n anchorRef: returnFocusRef,\n kind: 'menu',\n focusOutside: true,\n outsidePress: openOnContext\n ? (event) =>\n !(\n event.ctrlKey &&\n event.target instanceof Node &&\n triggerRef.current?.contains(event.target)\n )\n : true,\n });\n\n const triggerFocusRef = useTriggerFocusRef(triggerRef);\n\n // The element focused when the menu opened, captured as useRestoreFocus captures its opener: in\n // the commit that opens the menu, before the initial focus moves into it; the trigger's focus\n // target first (not in a context menu, whose region is no opener), else the focused element.\n const openerRef = React.useRef<HTMLElement | null>(null);\n const wasOpenRef = React.useRef(false);\n const captureOpener = useEventCallback(() => {\n const container = surfaceRef.current;\n const doc = (triggerRef.current ?? container)?.ownerDocument ?? document;\n const isCandidate = (el: Element | null | undefined): el is HTMLElement =>\n !!el && el !== doc.body && el !== doc.documentElement && !container?.contains(el);\n const trigger = openOnContext ? null : triggerFocusRef.current;\n const active = doc.activeElement;\n openerRef.current = isCandidate(trigger) ? trigger : isCandidate(active) ? active : null;\n });\n React.useInsertionEffect(() => {\n const wasOpen = wasOpenRef.current;\n wasOpenRef.current = open;\n if (open && !wasOpen) captureOpener();\n });\n // Where focus goes when the menu closes with focus inside it (Escape, a close by the app): where\n // useRestoreFocus would put it, in its order: the context opener, the element focused when the\n // menu opened, then the return target (a menu with a `target` and no trigger returns focus to\n // its opener, not to a focusable target element).\n const getCloseFocus = useEventCallback((): HTMLElement | null => {\n const container = surfaceRef.current;\n const candidates = [\n openOnContext ? contextOpener.current : null,\n openerRef.current,\n getReturnFocus(),\n ];\n return (\n candidates.find(\n (el): el is HTMLElement => !!el && isConnectedAndFocusable(el) && !container?.contains(el),\n ) ?? null\n );\n });\n\n useRestoreFocus({\n enabled: open,\n container: surface,\n // A context menu returns focus to the opener (the focused row), not to the region.\n triggerRef: openOnContext ? undefined : triggerFocusRef,\n finalFocusRef: openOnContext ? contextOpener : undefined,\n fallback: getReturnFocus,\n onlyIfFocusInside: true,\n // A hover close moves no focus (a submenu closing with it is taken along by the hook).\n isHoverClose,\n });\n\n // C-DEV: a surface that no trigger labels needs its own name.\n const unnamed =\n isMounted &&\n (openOnContext || (target != null && !triggerElement)) &&\n rest['aria-label'] === undefined &&\n rest['aria-labelledby'] === undefined;\n React.useEffect(() => {\n if (!unnamed) return;\n warnOnce(\n 'Menu.Popover:name',\n 'Menu.Popover: this menu has no trigger to name it (a context menu, or a menu placed at a `target` without Menu.Trigger): give Menu.Popover an aria-label or aria-labelledby.',\n );\n }, [unnamed]);\n\n const {\n containerProps: { ref: rovingRef },\n handleKeyDown: rovingKeyDown,\n handleKeyDownCapture: rovingKeyDownCapture,\n handleFocus: rovingFocus,\n focusFirst,\n focusLast,\n } = useRovingTabIndex({\n orientation: 'vertical',\n loop: true,\n typeahead: true,\n manageTabIndex: true,\n itemSelector: MENU_ITEM_SELECTOR,\n });\n\n const mergedRef = useMergedRefs<HTMLDivElement>(\n ref,\n setSurfaceElement,\n rovingRef,\n setFloating,\n presenceRef,\n );\n\n // Lets the trigger move focus into an already open menu (ArrowDown/ArrowUp on the trigger) and\n // the root reach the surface. Only an open surface registers, and it unregisters in the commit\n // that closes the menu: a surface that stays mounted while it exits would otherwise make the next\n // opening focus its (inert) items instead of opening the menu.\n React.useLayoutEffect(() => {\n if (!surface || !open) return;\n registerSurface({ focusFirst, focusLast, surface, layerId, getReturnFocus });\n return () => registerSurface(null);\n }, [surface, open, registerSurface, focusFirst, focusLast, layerId, getReturnFocus]);\n\n // Focus before close, on every close: when the menu closes with focus inside it, focus moves to\n // where the restore would put it (`getCloseFocus`) in the closing commit's mutation phase (a\n // layout effect cleanup), before a surface opened in the same update (a Dialog rendered after\n // the menu, opened by the item that closed it) records the focused element as its opener. The\n // closing surface is still in the document then (it unmounts once its exit phase ends), so that\n // opener would be its item, gone by the time the Dialog closes. The surface is inert from this\n // commit on, so in a browser React cannot put focus back on the item after the commit, and\n // useRestoreFocus, which then finds focus outside, leaves it there: the two must agree on the\n // target. Unmounting is left to useRestoreFocus.\n const unmountingRef = React.useRef(false);\n React.useLayoutEffect(() => {\n unmountingRef.current = false;\n return () => {\n unmountingRef.current = true;\n };\n }, []);\n const focusReturnTargetOnClose = useEventCallback(() => {\n const surfaceElement = surfaceRef.current;\n const active = surfaceElement?.ownerDocument.activeElement;\n if (unmountingRef.current || !surfaceElement || !active || !surfaceElement.contains(active)) {\n return;\n }\n getCloseFocus()?.focus({ preventScroll: true });\n });\n React.useLayoutEffect(() => {\n if (!open) return undefined;\n return focusReturnTargetOnClose;\n }, [open, focusReturnTargetOnClose]);\n\n // Initial focus: the first (or last) enabled item, unless focus is already inside. A hover\n // opening moves no focus.\n React.useLayoutEffect(() => {\n if (!open || !surface) return;\n if (surface.contains(surface.ownerDocument.activeElement)) return;\n const target = takeInitialFocus();\n if (target === 'last') focusLast();\n else if (target === 'first') focusFirst();\n }, [open, surface, takeInitialFocus, focusFirst, focusLast]);\n\n // The initial focus lands before the surface is limited to the available height (floating-ui\n // measures after mount), so it scrolls nothing: once positioned, the focused item (the last one\n // after ArrowUp) is scrolled into view. Later focus moves scroll through the native focus().\n React.useLayoutEffect(() => {\n if (!isPositioned || !surface) return;\n const active = surface.ownerDocument.activeElement as HTMLElement | null;\n if (active && active !== surface && surface.contains(active)) {\n active.scrollIntoView?.({ block: 'nearest' });\n }\n }, [isPositioned, surface]);\n\n // The list the items render in. Its children sit inside the Portal, one portal level deeper.\n // Item activation closes the whole chain; the item under the mouse takes focus while focus is\n // inside the menu tree.\n const portalDepth = React.useContext(PortalDepthContext) + 1;\n const registerCheckable = useCheckableRegistry();\n const { hoverGroup, isHoverFocusing, onPointerMove: listPointerMove } = useMenuListPointer(menu);\n const listContext = React.useMemo<MenuListContextValue>(\n () => ({\n menu,\n isStatic: false,\n portalDepth,\n closeFromItem: closeChain,\n registerCheckable,\n hoverGroup,\n isHoverFocusing,\n }),\n [menu, portalDepth, closeChain, registerCheckable, hoverGroup, isHoverFocusing],\n );\n\n // C-COMPOSE: the consumer's onKeyDown runs first; preventDefault() skips the built-in keys. A key\n // from a portal opened inside the menu (a Popover of an item, a submenu) is that portal's: Tab\n // moves on inside it and never closes the menu.\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n if (event.defaultPrevented || !isOwnEvent(event)) return;\n if (event.key === 'Tab') {\n // Close every menu of the chain and put focus on the root trigger; the default Tab action\n // then continues from there.\n closeChain();\n return;\n }\n // \"Previous\" (ArrowLeft, ArrowRight in RTL) closes a submenu and returns to its trigger item.\n if (\n isSubmenu &&\n !event.altKey &&\n !event.ctrlKey &&\n !event.metaKey &&\n !isEditableTarget(event.target) &&\n getArrowIntent(event.key, {\n orientation: 'horizontal',\n dir: getDirection(event.currentTarget),\n }) === 'prev'\n ) {\n event.preventDefault();\n getReturnFocus()?.focus({ preventScroll: true });\n requestClose();\n return;\n }\n rovingKeyDown(event);\n };\n\n if (!isMounted) return null;\n\n return (\n <Portal layerId={layerId}>\n <MenuListContext.Provider value={listContext}>\n <div\n role=\"menu\"\n {...rest}\n // After the spread: a consumer name wins when it is defined, and a forwarded key that\n // holds `undefined` does not remove the trigger's. A context region's whole text is no\n // name: a context menu is named by aria-label.\n aria-labelledby={\n rest['aria-labelledby'] !== undefined\n ? rest['aria-labelledby']\n : triggerElement && !openOnContext && rest['aria-label'] === undefined\n ? labelledBy\n : undefined\n }\n {...presenceProps}\n ref={mergedRef}\n id={menuId}\n data-state={open ? 'open' : 'closed'}\n data-side={floatingProps['data-side']}\n data-align={floatingProps['data-align']}\n data-roving-container=\"\"\n style={{ ...positionStyle, ...style }}\n onKeyDown={handleKeyDown}\n onKeyDownCapture={withTypeaheadText(\n composeEventHandlers(onKeyDownCapture, rovingKeyDownCapture),\n )}\n onFocus={composeEventHandlers(onFocus, rovingFocus, { checkDefaultPrevented: false })}\n onPointerEnter={composeEventHandlers(onPointerEnter, hoverSurfaceHandlers.onPointerEnter)}\n onPointerLeave={composeEventHandlers(onPointerLeave, hoverSurfaceHandlers.onPointerLeave)}\n onPointerMove={composeEventHandlers(onPointerMove, listPointerMove)}\n onContextMenu={composeEventHandlers(onContextMenu, contextSurfaceHandlers.onContextMenu)}\n className={cn(menuPopoverClasses, className)}\n >\n {children}\n </div>\n </MenuListContext.Provider>\n </Portal>\n );\n};\nMenuPopover.displayName = 'MenuPopover';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA+DA,IAAMC,KAAgB;CAAE,SAAS;CAAG,WAAW;AAAK;AAGpD,SAASC,GAAgB,GAAwD;CAC/E,OAAO,CAAC,CAACC,KAAWA,EAAyB,aAAa;AAC5D;AAYA,SAAgBC,EAAmB,GAIjC;CACA,IAAM,CAACC,KAAcL,EAAM,SAASM,CAAsB,GACpDC,IAAmBP,EAAM,OAAO,EAAK;CAoB3C,OAAO;EAAE;EAAY,iBAnBGA,EAAM,kBAAkBO,EAAiB,SAAS,CAAC,CAmBtD;EAAiB,eAlBhBC,GAAkB,MAA2C;GACjF,IAAIC,EAAM,g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qBO,IAAeC,GAAuB,aAAa;IACvF,WAAWC,EAAGC,IAAoBC,EAAS;IAE1C;GACE,CAAA;EACmB,CAAA;CACpB,CAAA,IAxCa;AA0CzB;AACA,EAAY,cAAc"}
@@ -0,0 +1,2 @@
1
+ "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/children.cjs"),r=require("../../lib/dev.cjs"),i=require("../../lib/composeEventHandlers.cjs"),a=require("../../hooks/useEventCallback.cjs"),ee=require("../../hooks/useControllable.cjs"),te=require("../../hooks/useId.cjs"),ne=require("../../lib/focus.cjs"),re=require("../../hooks/useRovingTabIndex.cjs"),ie=require("../../hooks/useMergedRefs.cjs"),ae=require("../../hooks/useIsClient.cjs"),oe=require("../../lib/layers.cjs"),se=require("../portal/Portal.cjs"),ce=require("../../lib/styles.cjs"),le=require("../../hooks/useCheckedValues.cjs"),o=require("./Menu.context.cjs"),s=require("./Menu.shared.cjs"),ue=require("../../hooks/useHoverIntent.cjs"),de=require("./Menu.popover.cjs"),fe=require("../../hooks/useContextMenuAnchor.cjs"),c=require("./Menu.trigger.cjs");let l=require("react");l=e.__toESM(l,1);let u=require("react/jsx-runtime");var pe=()=>{},me=250;function he(e){return n.flattenChildren(e).some(({node:e})=>n.isElementOfType(e,c.MenuTrigger,de.MenuPopover))}function ge(e){let t=e.map(e=>`\`${e}\``);return t.length>1?`${t.slice(0,-1).join(`, `)} and ${t[t.length-1]}`:t.join(``)}var d=({children:e,open:n,defaultOpen:c,onOpenChange:d,checkedValues:_e,defaultCheckedValues:ve,onCheckedValuesChange:f,persistOnItemClick:ye,openOnHover:p,openDelay:be,closeDelay:xe,openOnContext:Se,className:Ce,onKeyDown:we,onKeyDownCapture:Te,onFocus:Ee,onPointerMove:De,ref:Oe,...m})=>{let h=o.useMenuListContext(),g=l.useContext(se.PortalDepthContext),_=h!==null&&h.portalDepth===g?h:null,v=_?.menu??null,y=v!==null,[b,x,ke]=ee.useControllable(n,c??!1,d),Ae=ae.useIsClient(),S=v===null||!v.popup||v.open,C=b&&Ae&&S;l.useLayoutEffect(()=>{S||!b||ke||x(!1)},[S,b,ke,x]);let w=n!==void 0||c!==void 0||d!==void 0||he(e),T=te.useId(`wave-menu-trigger`),je=te.useId(`wave-menu`),[Me,Ne]=l.useState(T),E=l.useRef(null),[D,Pe]=l.useState(null),Fe=l.useCallback(e=>{E.current=e,Pe(e)},[]),O=l.useRef(null),[Ie,Le]=l.useState(null),[Re,ze]=l.useState(``),Be=l.useCallback(e=>{O.current=e,Le(e?.surface??null),e&&ze(e.layerId)},[]),Ve=le.useCheckedValues(_e,ve,f),k=v?.checked??null,He=k===null||_e!==void 0||ve!==void 0,Ue=f!==void 0,We=a.useEventCallback(f),Ge=l.useMemo(()=>k&&Ue?le.withCheckedValuesListener(k,We):k,[k,Ue,We]),A=He||Ge===null?Ve:Ge,Ke=ye??v?.persistOnItemClick??!1,j=be??v?.openDelay??me,M=xe??v?.closeDelay??me,N=w&&!y&&Se===!0,qe=w&&!N&&(p??y),P=[];if(w){Ce!==void 0&&P.push(`className`),we!==void 0&&P.push(`onKeyDown`),Te!==void 0&&P.push(`onKeyDownCapture`),Ee!==void 0&&P.push(`onFocus`),De!==void 0&&P.push(`onPointerMove`);for(let[e,t]of Object.entries(m))t!==void 0&&P.push(e);Oe!=null&&P.push(`ref`)}let F=P.length===0?``:`Menu: a popup menu (Menu.Trigger + Menu.Popover) renders no element of its own, so ${P.map(e=>`\`${e}\``).join(`, `)} on Menu ${P.length===1?`is`:`are`} ignored. Pass ${P.length===1?`it`:`them`} to Menu.Popover (the menu surface) or to the trigger's child instead.`;l.useEffect(()=>{F&&r.warnOnce(`Menu:popup-ignored-props`,F)},[F]);let I=w?``:ge([p?`openOnHover`:null,Se?`openOnContext`:null].filter(e=>e!==null)),Je=N&&p===!0;l.useEffect(()=>{if(!I)return;let[e,t]=I.includes(` and `)?[`are`,`they`]:[`is`,`it`];r.warnOnce(`Menu:static-popup-props`,`Menu: ${I} ${e} ignored on a static menu: ${t} apply to a popup menu (Menu.Trigger + Menu.Popover). A static menu passes openDelay and closeDelay on to its submenus.`)},[I]),l.useEffect(()=>{Je&&r.warnOnce(`Menu:hover-and-context`,`Menu: openOnHover is ignored with openOnContext: a context menu opens only from a context gesture (a right click, Shift+F10 or the ContextMenu key).`)},[Je]);let L=l.useRef(null),R=l.useRef(null),z=a.useEventCallback(()=>{let e=O.current,t=e?.surface??L.current,n=t?.ownerDocument.activeElement;return!t||!n?!1:t.contains(n)?!0:e?oe.getLayerTreeElements(e.layerId,{includeOwnElements:!1}).some(e=>e.contains(n)):R.current?.containsFocus()??!1}),B=a.useEventCallback(()=>{let e=O.current?.surface??L.current,t=e?.ownerDocument.activeElement;return e&&t&&e.contains(t)?!0:R.current?.listContainsFocus()??!1}),V=l.useRef(!1),Ye=l.useCallback(()=>V.current,[]),Xe=e=>{V.current=e,R.current?.close(),x(!1)},H=a.useEventCallback(()=>Xe(!1)),Ze=a.useEventCallback(()=>Xe(!0)),U=l.useRef(`other`),W=l.useRef(!1),G=l.useRef(`first`);l.useLayoutEffect(()=>{C&&(U.current=W.current?`hover`:`other`,V.current=!1),W.current=!1},[C]);let Qe=l.useCallback(()=>U.current===`hover`,[]),{triggerHandlers:K,surfaceHandlers:$e,cancel:et,startClose:tt}=ue.useHoverIntent({enabled:qe,open:C,openDelay:j,closeDelay:M,trigger:D,surface:Ie,group:_?.hoverGroup,onOpen:()=>{W.current=!0,G.current=`none`,x(!0)},onClose:Ze,canClose:()=>U.current===`hover`&&!z()}),nt=a.useEventCallback(()=>{C||(W.current=!1,G.current===`none`&&(G.current=`first`))}),rt=l.useMemo(()=>({...K,onPointerLeave:e=>{K.onPointerLeave(e),nt()}}),[K,nt]),q=l.useCallback(e=>{U.current=`other`,W.current=!1,et();let t=O.current;if(t){e===`last`?t.focusLast():e===`first`&&t.focusFirst();return}G.current=e,x(!0)},[x,et]),it=l.useCallback(()=>{let e=G.current;return G.current=`first`,e},[]),{anchor:at,fromContext:ot,opener:st,triggerHandlers:ct,surfaceHandlers:lt}=fe.useContextMenuAnchor({enabled:N,open:C,trigger:D,layerId:Re,onOpen:()=>q(`first`),onClose:H}),ut=_?.isHoverFocusing,dt=v?.isHoverFocusing,J=a.useEventCallback(()=>(ut?.()??!1)||(dt?.()??!1)),Y=l.useRef(!1);l.useEffect(()=>{if(!N||!C||!D)return;let e=D.ownerDocument,t=e=>{Y.current=e.button===2||e.button===0&&(e.ctrlKey||e.pointerType===`touch`||e.pointerType===`pen`)},n=()=>{Y.current=!1};return e.addEventListener(`pointerdown`,t,!0),e.addEventListener(`pointerup`,n,!0),e.addEventListener(`pointercancel`,n,!0),()=>{e.removeEventListener(`pointerdown`,t,!0),e.removeEventListener(`pointerup`,n,!0),e.removeEventListener(`pointercancel`,n,!0),Y.current=!1}},[N,C,D]);let ft=a.useEventCallback((e,t)=>{if(!(e===`focus-outside`&&N&&Y.current&&t.target instanceof Node&&E.current?.contains(t.target))){if(e===`focus-outside`&&y&&qe&&J()){U.current=`hover`,tt(t);return}H()}}),pt=l.useCallback(e=>{let t=R.current;return R.current=e,t&&t!==e&&t.close(),()=>{R.current===e&&(R.current=null)}},[]),mt=l.useMemo(()=>({close:H,containsFocus:z,listContainsFocus:B}),[H,z,B]),X=v?.registerOpenSubmenu;l.useLayoutEffect(()=>{if(C&&X)return X(mt)},[C,X,mt]);let ht=v?.popup?v.closeChain:null,gt=a.useEventCallback(()=>{if(ht){ht();return}if(!w)return;let e=O.current?.getReturnFocus()??null;if(e){let t=e.ownerDocument,n=t.activeElement;(!n||n===t.body||n===t.documentElement||z())&&e.focus({preventScroll:!0})}H()}),Z=l.useMemo(()=>({popup:w,open:C,setOpen:x,openWithFocus:q,takeInitialFocus:it,registerSurface:Be,triggerId:T,labelledBy:Me,onTriggerId:Ne,menuId:je,triggerRef:E,triggerElement:D,setTriggerElement:Fe,parent:v,checked:A,persistOnItemClick:Ke,isSubmenu:y,requestClose:H,closeChain:gt,registerOpenSubmenu:pt,listContainsFocus:B,openDelay:j,closeDelay:M,dismiss:ft,isHoverFocusing:J,isHoverOpen:Qe,isHoverClose:Ye,hoverTriggerHandlers:rt,hoverSurfaceHandlers:$e,openOnContext:N,contextTriggerHandlers:ct,contextSurfaceHandlers:lt,contextAnchor:at,fromContext:ot,contextOpener:st}),[w,C,x,q,it,Be,T,Me,je,D,Fe,v,A,Ke,y,H,gt,pt,B,j,M,ft,J,Qe,Ye,rt,$e,N,ct,lt,at,ot,st]),{containerProps:{ref:_t},handleKeyDown:vt,handleKeyDownCapture:yt,handleFocus:bt,focusFirst:xt,getTabIndex:St}=re.useRovingTabIndex({orientation:`vertical`,loop:!0,typeahead:!0,tabStop:`last-focused`,manageTabIndex:!0,itemSelector:s.MENU_ITEM_SELECTOR}),Ct=ie.useMergedRefs(Oe,_t,L),[Q,wt]=l.useState(!1);l.useLayoutEffect(()=>{let e=L.current;if(w||!e)return;let t=ne.getFirstTabbable(e)===null;t!==Q&&(wt(t),!t&&e.ownerDocument.activeElement===e&&xt())},[w,Q,xt,St]);let Tt=o.useCheckableRegistry(),{hoverGroup:Et,isHoverFocusing:$,onPointerMove:Dt}=de.useMenuListPointer(Z),Ot=l.useMemo(()=>({menu:Z,isStatic:!0,portalDepth:g,closeFromItem:pe,registerCheckable:Tt,hoverGroup:Et,isHoverFocusing:$}),[Z,g,Tt,Et,$]);return w?(0,u.jsx)(o.MenuContext.Provider,{value:Z,children:e}):(0,u.jsx)(o.MenuContext.Provider,{value:Z,children:(0,u.jsx)(o.MenuListContext.Provider,{value:Ot,children:(0,u.jsx)(`div`,{role:`menu`,...m,ref:Ct,tabIndex:m.tabIndex??(Q?0:void 0),"data-roving-container":``,onKeyDown:i.composeEventHandlers(we,vt),onKeyDownCapture:s.withTypeaheadText(i.composeEventHandlers(Te,yt)),onFocus:i.composeEventHandlers(Ee,bt,{checkDefaultPrevented:!1}),onPointerMove:i.composeEventHandlers(De,Dt),className:t.cn(s.menuSurfaceClasses,ce.focusRing,Ce),children:e})})})};d.displayName=`Menu`,exports.MenuRoot=d,exports.hasPopupParts=he;
2
+ //# sourceMappingURL=Menu.root.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Menu.root.cjs","names":["flattenChildren","isElementOfType","MenuTrigger","MenuPopover","useMenuListContext","React","PortalDepthContext","useControllable","useIsClient","useId","useCheckedValues","useEventCallback","withCheckedValuesListener","getLayerTreeElements","useHoverIntent","useContextMenuAnchor","useRovingTabIndex","MENU_ITEM_SELECTOR","useMergedRefs","getFirstTabbable","useCheckableRegistry","useMenuListPointer","MenuContext","MenuListContext","composeEventHandlers","withTypeaheadText","cn","menuSurfaceClasses","focusRing","require_runtime","require_cn","require_children","require_dev","require_composeEventHandlers","require_useEventCallback","require_useControllable","require_useId","require_focus","require_useRovingTabIndex","require_useMergedRefs","require_useIsClient","require_layers","require_Portal","require_styles","require_useCheckedValues","require_Menu_context","require_Menu_shared","require_useHoverIntent","require_Menu_popover","require_useContextMenuAnchor","require_Menu_trigger","react","react_jsx_runtime","noop","HOVER_DELAY_MS","hasPopupParts","children","node","listProps","quoted","names","name","MenuRoot","openProp","persistOnItemClickProp","openOnHoverProp","openDelayProp","closeDelayProp","openOnContextProp","rest","list","portalDepth","parentList","parent","isSubmenu","openState","setOpen","openControlled","defaultOpen","onOpenChange","isClient","parentOpen","open","popup","triggerId","menuId","labelledBy","setLabelledBy","triggerRef","triggerElement","setTriggerElementState","setTriggerElement","element","surfaceApiRef","surfaceElement","setSurfaceElement","surfaceLayerId","setSurfaceLayerId","registerSurface","api","ownChecked","checkedValues","defaultCheckedValues","onCheckedValuesChange","parentChecked","ownsCheckedState","listens","listener","sharedChecked","checked","persistOnItemClick","openDelay","closeDelay","contextMode","hoverMode","ignoredProps","className","onKeyDown","onKeyDownCapture","onFocus","onPointerMove","value","ref","ignoredMessage","staticPopupProps","hoverAndContext","verb","pronoun","staticMenuRef","openSubmenuRef","containsFocus","surfaceApi","active","el","listContainsFocus","hoverCloseRef","isHoverClose","closeMenu","byHover","requestClose","requestHoverClose","openReasonRef","hoverOpenPendingRef","initialFocusRef","isHoverOpen","hoverIntentTriggerHandlers","hoverSurfaceHandlers","cancelHover","startHoverClose","forgetHoverOpening","hoverTriggerHandlers","event","openWithFocus","target","takeInitialFocus","contextAnchor","contextOpener","contextTriggerHandlers","contextSurfaceHandlers","parentListHoverFocusing","parentHoverFocusing","isHoverFocusing","contextPressRef","doc","onPointerDown","onPointerEnd","dismiss","reason","registerOpenSubmenu","previous","submenu","submenuHandle","registerWithParent","parentCloseChain","closeChain","contextValue","fromContext","rovingRef","rovingKeyDown","rovingKeyDownCapture","rovingFocus","mergedRef","menuIsTabStop","setMenuIsTabStop","menu","noItemTabStop","focusFirst","getTabIndex","registerCheckable","isListHoverFocusing","listPointerMove","listContext","hoverGroup"],"sources":["../../../src/components/navigation/Menu.root.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { warnOnce } from '../../lib/dev';\nimport { flattenChildren, isElementOfType } from '../../lib/children';\nimport { getFirstTabbable } from '../../lib/focus';\nimport { getLayerTreeElements, type DismissReason } from '../../lib/layers';\nimport { focusRing } from '../../lib/styles';\nimport type { CheckedValues, CheckedValuesChangeHandler } from '../../lib/types';\nimport { useCheckedValues, withCheckedValuesListener } from '../../hooks/useCheckedValues';\nimport { useContextMenuAnchor } from '../../hooks/useContextMenuAnchor';\nimport { useControllable } from '../../hooks/useControllable';\nimport { useEventCallback } from '../../hooks/useEventCallback';\nimport { useHoverIntent, type HoverIntent } from '../../hooks/useHoverIntent';\nimport { useId } from '../../hooks/useId';\nimport { useIsClient } from '../../hooks/useIsClient';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { useRovingTabIndex } from '../../hooks/useRovingTabIndex';\nimport { PortalDepthContext } from '../portal/Portal';\nimport {\n MenuContext,\n MenuListContext,\n useCheckableRegistry,\n useMenuListContext,\n} from './Menu.context';\nimport type {\n InitialFocus,\n MenuContextValue,\n MenuListContextValue,\n MenuSurfaceApi,\n OpenSubmenu,\n} from './Menu.context';\nimport { MENU_ITEM_SELECTOR, menuSurfaceClasses, withTypeaheadText } from './Menu.shared';\nimport { MenuPopover, useMenuListPointer } from './Menu.popover';\nimport { MenuTrigger } from './Menu.trigger';\n\n/** Properties for the Menu component. */\nexport interface MenuProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Menu items and dividers (static menu), or a `Menu.Trigger` and a `Menu.Popover` (popup menu).\n */\n children: React.ReactNode;\n /**\n * Controlled open state of a popup menu (`Menu.Trigger` + `Menu.Popover`). Passing it, even\n * `false` (like passing `defaultOpen` or `onOpenChange`), makes Menu a popup menu that renders no\n * element of its own: use it only with `Menu.Trigger`/`Menu.Popover`. Items outside\n * `Menu.Popover` then have no `role=\"menu\"` parent (development warning). Leave all three out\n * for a static menu. The popup renders only in the browser: an open menu is closed in the\n * server HTML and opens once it has hydrated.\n */\n open?: boolean;\n /**\n * Initial open state of an uncontrolled popup menu; a popup menu starts closed without it.\n * Passing it, even `false`, makes Menu a popup menu (see `open`), so for a Menu without\n * `Menu.Trigger`/`Menu.Popover` children, leaving it out is not the same as `false`. The popup\n * renders only in the browser: a menu open by default is closed in the server HTML and opens\n * once it has hydrated.\n */\n defaultOpen?: boolean;\n /**\n * Called with the next open state when the popup menu opens or closes (only on change). Passing\n * it makes Menu a popup menu (see `open`).\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Checked items of the menu's checkbox, radio and switch items, per group `name` (controlled).\n * A submenu without its own `checkedValues` or `defaultCheckedValues` shares its parent menu's\n * state. Works for static and popup menus; unlike `open`, it does not make Menu a popup menu.\n */\n checkedValues?: CheckedValues;\n /** Initial checked items for uncontrolled usage (gives a submenu its own state). @default {} */\n defaultCheckedValues?: CheckedValues;\n /**\n * Called when an item changes the checked items (only on change): the new checked values of every\n * group first, then `details` with the group's `name`, its `checkedItems` and the `event` (Fluent's\n * `onCheckedValueChange(event, { name, checkedItems })`). WaveUI always passes `details`; it is\n * typed optional until 1.0. On a submenu that shares its parent's state it only listens: it is\n * called after the parent's callback, for changes made in this submenu.\n */\n onCheckedValuesChange?: CheckedValuesChangeHandler;\n /**\n * Keep a popup menu open after any of its items is activated; an item's own `persistOnClick`\n * wins. A submenu inherits it unless it sets it.\n * @default false\n */\n persistOnItemClick?: boolean;\n /**\n * Open the popup menu when a mouse pointer rests on its trigger, and close it once the pointer\n * has been off the trigger and the menu for `closeDelay` while focus is not inside the menu. A\n * menu opened by hover does not take focus; a click (or Enter, Space, ArrowDown) on its trigger\n * keeps it open and moves focus into it, as opening it that way does. After Escape or an\n * outside press it does not reopen until the pointer has left the trigger. Touch and pen never\n * open it by hover, and an `aria-disabled` trigger never opens. A triangle between the trigger\n * and the menu keeps it open while the pointer moves diagonally into it. Ignored with\n * `openOnContext` (development warning) and on a static menu (development warning).\n * @default false (true for a submenu)\n */\n openOnHover?: boolean;\n /**\n * Milliseconds a hovering mouse pointer rests on the trigger before the menu opens (mouse hover\n * only). A submenu inherits its parent's, also from a static menu. @default 250\n */\n openDelay?: number;\n /**\n * Milliseconds before a hover-opened menu closes once the mouse pointer has left it and its\n * trigger (mouse hover only). A submenu inherits its parent's, also from a static menu.\n * @default 250\n */\n closeDelay?: number;\n /**\n * Make `Menu.Trigger` a context-menu region: a right click (a Ctrl+click on macOS, a long press\n * where the browser reports one) opens the menu at the pointer, and Shift+F10 or the\n * ContextMenu key opens it at the focused element inside the region, instead of a click; a\n * second gesture while it is open moves it there. Focus returns to the element that had it.\n * The browser's context menu is suppressed there and inside the menu, except in text fields\n * inside the region, which keep it. A press elsewhere, a right click outside or a scroll that\n * moves the region or the row of the gesture (the one under the pointer, or the focused one)\n * closes it. The trigger gets no `aria-haspopup`/`aria-expanded` (it is not a menu button; with\n * a render-prop child, do not spread them): name the menu with `aria-label` on `Menu.Popover`,\n * and consider `aria-keyshortcuts=\"Shift+F10\"` on the region. iOS Safari reports no long press.\n * Ignored on a submenu; `openOnHover` is ignored with it.\n * @default false\n */\n openOnContext?: boolean;\n /**\n * Ref to the static menu element (`role=\"menu\"`). A popup menu renders no root element, so it\n * ignores `ref`, `className` and other DOM props (development warning): pass them to\n * `Menu.Popover`.\n */\n ref?: React.Ref<HTMLDivElement>;\n}\n\nconst noop = () => {};\n\n/** Default of `openDelay` and `closeDelay` (InfoLabel's hover delays). */\nconst HOVER_DELAY_MS = 250;\n\n/**\n * Whether the children contain a `Menu.Trigger` or `Menu.Popover`: direct children and the\n * children of Fragments only (other elements and components are not searched). Parts written in\n * a Server Component (lazy client references) are recognised too.\n */\nexport function hasPopupParts(children: React.ReactNode): boolean {\n return flattenChildren(children).some(({ node }) =>\n isElementOfType(node, MenuTrigger, MenuPopover),\n );\n}\n\n/** Joins prop names for a message: `a`, `` `a` and `b` ``. */\nfunction listProps(names: string[]): string {\n const quoted = names.map((name) => `\\`${name}\\``);\n return quoted.length > 1\n ? `${quoted.slice(0, -1).join(', ')} and ${quoted[quoted.length - 1]}`\n : quoted.join('');\n}\n\n// The root of the `Menu` compound. Its component JSDoc is on the `Menu` export (Menu.tsx) only\n// (C-DOCS): a docblock here would replace it as the Storybook description.\nexport const MenuRoot = ({\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n checkedValues,\n defaultCheckedValues,\n onCheckedValuesChange,\n persistOnItemClick: persistOnItemClickProp,\n openOnHover: openOnHoverProp,\n openDelay: openDelayProp,\n closeDelay: closeDelayProp,\n openOnContext: openOnContextProp,\n className,\n onKeyDown,\n onKeyDownCapture,\n onFocus,\n onPointerMove,\n ref,\n ...rest\n}: MenuProps) => {\n // A Menu rendered in a menu list with no portal between them is a submenu of that list's menu.\n // A Menu inside a Popover or Dialog opened from an item sits one portal deeper: a root menu.\n const list = useMenuListContext();\n const portalDepth = React.useContext(PortalDepthContext);\n const parentList = list !== null && list.portalDepth === portalDepth ? list : null;\n const parent = parentList?.menu ?? null;\n const isSubmenu = parent !== null;\n\n const [openState, setOpen, openControlled] = useControllable(\n openProp,\n defaultOpen ?? false,\n onOpenChange,\n );\n // The popup menu lives in a portal, which renders only in the browser: until then (the server\n // HTML, hydration) the menu reports itself closed, so the trigger's aria-expanded and\n // aria-controls never describe a menu that is not there. A submenu of a popup menu is open only\n // while that menu is: a parent that closes (through its controlled prop, or while it runs an\n // exit motion) takes the submenu's surface, layer and focus restore along in the same commit.\n const isClient = useIsClient();\n const parentOpen = parent === null || !parent.popup || parent.open;\n const open = openState && isClient && parentOpen;\n // A parent that closed without closing this submenu (its controlled `open` prop): an\n // uncontrolled submenu closes too, so it does not reopen with the parent. A controlled\n // submenu's state is the app's.\n React.useLayoutEffect(() => {\n if (parentOpen || !openState || openControlled) return;\n setOpen(false);\n }, [parentOpen, openState, openControlled, setOpen]);\n\n const popup =\n openProp !== undefined ||\n defaultOpen !== undefined ||\n onOpenChange !== undefined ||\n hasPopupParts(children);\n\n const triggerId = useId('wave-menu-trigger');\n const menuId = useId('wave-menu');\n const [labelledBy, setLabelledBy] = React.useState(triggerId);\n const triggerRef = React.useRef<HTMLElement | null>(null);\n const [triggerElement, setTriggerElementState] = React.useState<HTMLElement | null>(null);\n const setTriggerElement = React.useCallback((element: HTMLElement | null) => {\n triggerRef.current = element;\n setTriggerElementState(element);\n }, []);\n\n // The open surface: its API in a ref (read in events), its element and layer in state (the\n // hover and context-menu hooks observe them).\n const surfaceApiRef = React.useRef<MenuSurfaceApi | null>(null);\n const [surfaceElement, setSurfaceElement] = React.useState<HTMLElement | null>(null);\n const [surfaceLayerId, setSurfaceLayerId] = React.useState('');\n const registerSurface = React.useCallback((api: MenuSurfaceApi | null) => {\n surfaceApiRef.current = api;\n setSurfaceElement(api?.surface ?? null);\n // Kept after the surface closes: a context gesture records its opener against the last layer.\n if (api) setSurfaceLayerId(api.layerId);\n }, []);\n\n // Checked values: one state per menu tree. A Menu owns its state when it sets `checkedValues` or\n // `defaultCheckedValues`, or has no parent; otherwise it uses its parent's, and its own\n // `onCheckedValuesChange` only listens to the changes its items make (called after the owner's).\n const ownChecked = useCheckedValues(checkedValues, defaultCheckedValues, onCheckedValuesChange);\n const parentChecked = parent?.checked ?? null;\n const ownsCheckedState =\n parentChecked === null || checkedValues !== undefined || defaultCheckedValues !== undefined;\n const listens = onCheckedValuesChange !== undefined;\n const listener = useEventCallback(onCheckedValuesChange);\n const sharedChecked = React.useMemo(\n () =>\n parentChecked && listens ? withCheckedValuesListener(parentChecked, listener) : parentChecked,\n [parentChecked, listens, listener],\n );\n const checked = ownsCheckedState || sharedChecked === null ? ownChecked : sharedChecked;\n const persistOnItemClick = persistOnItemClickProp ?? parent?.persistOnItemClick ?? false;\n const openDelay = openDelayProp ?? parent?.openDelay ?? HOVER_DELAY_MS;\n const closeDelay = closeDelayProp ?? parent?.closeDelay ?? HOVER_DELAY_MS;\n\n // Context mode applies to a root popup menu; hover to a popup menu outside context mode.\n const contextMode = popup && !isSubmenu && openOnContextProp === true;\n const hoverMode = popup && !contextMode && (openOnHoverProp ?? isSubmenu);\n\n // C-DEV: a popup menu renders no root element, so root DOM props and the ref go nowhere.\n const ignoredProps: string[] = [];\n if (popup) {\n if (className !== undefined) ignoredProps.push('className');\n if (onKeyDown !== undefined) ignoredProps.push('onKeyDown');\n if (onKeyDownCapture !== undefined) ignoredProps.push('onKeyDownCapture');\n if (onFocus !== undefined) ignoredProps.push('onFocus');\n if (onPointerMove !== undefined) ignoredProps.push('onPointerMove');\n for (const [name, value] of Object.entries(rest)) {\n if (value !== undefined) ignoredProps.push(name);\n }\n if (ref != null) ignoredProps.push('ref');\n }\n const ignoredMessage =\n ignoredProps.length === 0\n ? ''\n : `Menu: a popup menu (Menu.Trigger + Menu.Popover) renders no element of its own, so ${ignoredProps\n .map((name) => `\\`${name}\\``)\n .join(', ')} on Menu ${ignoredProps.length === 1 ? 'is' : 'are'} ignored. Pass ${\n ignoredProps.length === 1 ? 'it' : 'them'\n } to Menu.Popover (the menu surface) or to the trigger's child instead.`;\n React.useEffect(() => {\n if (ignoredMessage) warnOnce('Menu:popup-ignored-props', ignoredMessage);\n }, [ignoredMessage]);\n\n // C-DEV: the popup openings do nothing on a static menu; hover gives way to context gestures.\n const staticPopupProps = popup\n ? ''\n : listProps(\n [openOnHoverProp ? 'openOnHover' : null, openOnContextProp ? 'openOnContext' : null].filter(\n (name): name is string => name !== null,\n ),\n );\n const hoverAndContext = contextMode && openOnHoverProp === true;\n React.useEffect(() => {\n if (!staticPopupProps) return;\n const [verb, pronoun] = staticPopupProps.includes(' and ') ? ['are', 'they'] : ['is', 'it'];\n warnOnce(\n 'Menu:static-popup-props',\n `Menu: ${staticPopupProps} ${verb} ignored on a static menu: ${pronoun} apply to a popup menu (Menu.Trigger + Menu.Popover). A static menu passes openDelay and closeDelay on to its submenus.`,\n );\n }, [staticPopupProps]);\n React.useEffect(() => {\n if (!hoverAndContext) return;\n warnOnce(\n 'Menu:hover-and-context',\n 'Menu: openOnHover is ignored with openOnContext: a context menu opens only from a context gesture (a right click, Shift+F10 or the ContextMenu key).',\n );\n }, [hoverAndContext]);\n\n const staticMenuRef = React.useRef<HTMLDivElement | null>(null);\n\n // The open submenu of this menu's list (one at a time) and what focus inside means for the chain.\n const openSubmenuRef = React.useRef<OpenSubmenu | null>(null);\n const containsFocus = useEventCallback((): boolean => {\n const surfaceApi = surfaceApiRef.current;\n const element = surfaceApi?.surface ?? staticMenuRef.current;\n const active = element?.ownerDocument.activeElement;\n if (!element || !active) return false;\n if (element.contains(active)) return true;\n // A popup menu's layer tree holds its submenus and the portals opened from its items; its own\n // elements (the trigger) do not count.\n if (surfaceApi) {\n return getLayerTreeElements(surfaceApi.layerId, { includeOwnElements: false }).some((el) =>\n el.contains(active),\n );\n }\n return openSubmenuRef.current?.containsFocus() ?? false;\n });\n // Focus in a list of the chain: this menu's list, else (recursively) its open submenu's. A\n // portal opened from an item does not count, so hover never takes focus from it.\n const listContainsFocus = useEventCallback((): boolean => {\n const element = surfaceApiRef.current?.surface ?? staticMenuRef.current;\n const active = element?.ownerDocument.activeElement;\n if (element && active && element.contains(active)) return true;\n return openSubmenuRef.current?.listContainsFocus() ?? false;\n });\n\n // Every close of this menu closes its open submenu first, innermost first, through the\n // submenu's own state: each controlled submenu hears onOpenChange(false) once. A close asked for\n // by the hover intent is marked (before the request, in case the app applies it synchronously),\n // so the surface's focus restore moves no focus; every other close request, and the next\n // opening, clears the mark. A submenu closed along with it is taken along by the restore itself.\n const hoverCloseRef = React.useRef(false);\n const isHoverClose = React.useCallback(() => hoverCloseRef.current, []);\n const closeMenu = (byHover: boolean) => {\n hoverCloseRef.current = byHover;\n openSubmenuRef.current?.close();\n setOpen(false);\n };\n const requestClose = useEventCallback(() => closeMenu(false));\n const requestHoverClose = useEventCallback(() => closeMenu(true));\n\n // Why the open menu is open: a hover opening stays unpinned (the hover close applies) until the\n // trigger is activated; every other opening (click, keys, context, a controlled `open`) pins it.\n const openReasonRef = React.useRef<'hover' | 'other'>('other');\n const hoverOpenPendingRef = React.useRef(false);\n const initialFocusRef = React.useRef<InitialFocus>('first');\n React.useLayoutEffect(() => {\n if (open) {\n openReasonRef.current = hoverOpenPendingRef.current ? 'hover' : 'other';\n hoverCloseRef.current = false;\n }\n hoverOpenPendingRef.current = false;\n }, [open]);\n const isHoverOpen = React.useCallback(() => openReasonRef.current === 'hover', []);\n\n const {\n triggerHandlers: hoverIntentTriggerHandlers,\n surfaceHandlers: hoverSurfaceHandlers,\n cancel: cancelHover,\n startClose: startHoverClose,\n } = useHoverIntent({\n enabled: hoverMode,\n open,\n openDelay,\n closeDelay,\n trigger: triggerElement,\n surface: surfaceElement,\n group: parentList?.hoverGroup,\n onOpen: () => {\n hoverOpenPendingRef.current = true;\n initialFocusRef.current = 'none';\n setOpen(true);\n },\n onClose: requestHoverClose,\n // Pinned, or focus inside the menu (not on its trigger): the hover close waits.\n canClose: () => openReasonRef.current === 'hover' && !containsFocus(),\n });\n\n // A hover opening stays pending until the menu opens, in a later render too (an app that\n // applies it in a transition). One the app has not applied when the pointer leaves the trigger\n // (a controlled menu whose app kept `open` false) is forgotten then, so a later opening by the\n // app is an ordinary one: it focuses the first item and is pinned.\n const forgetHoverOpening = useEventCallback(() => {\n if (open) return;\n hoverOpenPendingRef.current = false;\n if (initialFocusRef.current === 'none') initialFocusRef.current = 'first';\n });\n const hoverTriggerHandlers = React.useMemo<HoverIntent['triggerHandlers']>(\n () => ({\n ...hoverIntentTriggerHandlers,\n onPointerLeave: (event) => {\n hoverIntentTriggerHandlers.onPointerLeave(event);\n forgetHoverOpening();\n },\n }),\n [hoverIntentTriggerHandlers, forgetHoverOpening],\n );\n\n const openWithFocus = React.useCallback(\n (target: InitialFocus) => {\n // Any opening but hover pins the menu; an open, hover-opened menu is pinned and focused.\n openReasonRef.current = 'other';\n hoverOpenPendingRef.current = false;\n cancelHover();\n const surfaceApi = surfaceApiRef.current;\n if (surfaceApi) {\n if (target === 'last') surfaceApi.focusLast();\n else if (target === 'first') surfaceApi.focusFirst();\n return;\n }\n initialFocusRef.current = target;\n setOpen(true);\n },\n [setOpen, cancelHover],\n );\n const takeInitialFocus = React.useCallback((): InitialFocus => {\n const target = initialFocusRef.current;\n initialFocusRef.current = 'first';\n return target;\n }, []);\n\n // Context gestures on the trigger region: a context gesture opens the menu (focus on its first\n // item) at the pointer or the focused row; a right click outside or an anchor-moving scroll\n // closes it.\n const {\n anchor: contextAnchor,\n fromContext,\n opener: contextOpener,\n triggerHandlers: contextTriggerHandlers,\n surfaceHandlers: contextSurfaceHandlers,\n } = useContextMenuAnchor({\n enabled: contextMode,\n open,\n trigger: triggerElement,\n layerId: surfaceLayerId,\n onOpen: () => openWithFocus('first'),\n onClose: requestClose,\n });\n\n // Focus follows the mouse: a submenu that loses focus to an item the pointer is focusing in an\n // enclosing list becomes a hover-opened submenu and closes through the hover close. A submenu\n // with `openOnHover={false}` has no hover close, so it closes at once, as for a keyboard move.\n const parentListHoverFocusing = parentList?.isHoverFocusing;\n const parentHoverFocusing = parent?.isHoverFocusing;\n const isHoverFocusing = useEventCallback(\n (): boolean => (parentListHoverFocusing?.() ?? false) || (parentHoverFocusing?.() ?? false),\n );\n // A press in progress that can be a context gesture: the right button, a Ctrl+press (the macOS\n // context click) or a touch or pen press (a long press). Recorded at its pointerdown and\n // forgotten at its pointerup, while a context menu is open.\n const contextPressRef = React.useRef(false);\n React.useEffect(() => {\n if (!contextMode || !open || !triggerElement) return undefined;\n const doc = triggerElement.ownerDocument;\n const onPointerDown = (event: PointerEvent) => {\n contextPressRef.current =\n event.button === 2 ||\n (event.button === 0 &&\n (event.ctrlKey || event.pointerType === 'touch' || event.pointerType === 'pen'));\n };\n const onPointerEnd = () => {\n contextPressRef.current = false;\n };\n doc.addEventListener('pointerdown', onPointerDown, true);\n doc.addEventListener('pointerup', onPointerEnd, true);\n doc.addEventListener('pointercancel', onPointerEnd, true);\n return () => {\n doc.removeEventListener('pointerdown', onPointerDown, true);\n doc.removeEventListener('pointerup', onPointerEnd, true);\n doc.removeEventListener('pointercancel', onPointerEnd, true);\n contextPressRef.current = false;\n };\n }, [contextMode, open, triggerElement]);\n\n const dismiss = useEventCallback((reason: DismissReason, event: Event) => {\n // Focus that such a press moves into a context menu's region does not close the menu: a\n // right-button (or macOS Ctrl+) press focuses the row under the pointer before the contextmenu\n // event that moves the menu there (Chromium, Firefox). Any other focus move into the region (a\n // primary press, the app) closes it, as does an outside press and Tab (the surface's handler).\n if (\n reason === 'focus-outside' &&\n contextMode &&\n contextPressRef.current &&\n event.target instanceof Node &&\n triggerRef.current?.contains(event.target)\n ) {\n return;\n }\n if (reason === 'focus-outside' && isSubmenu && hoverMode && isHoverFocusing()) {\n openReasonRef.current = 'hover';\n startHoverClose(event);\n return;\n }\n requestClose();\n });\n\n const registerOpenSubmenu = React.useCallback((submenu: OpenSubmenu) => {\n const previous = openSubmenuRef.current;\n openSubmenuRef.current = submenu;\n // One open submenu per list: the one open before closes.\n if (previous && previous !== submenu) previous.close();\n return () => {\n if (openSubmenuRef.current === submenu) openSubmenuRef.current = null;\n };\n }, []);\n\n // A submenu registers with its parent while it is open.\n const submenuHandle = React.useMemo<OpenSubmenu>(\n () => ({ close: requestClose, containsFocus, listContainsFocus }),\n [requestClose, containsFocus, listContainsFocus],\n );\n const registerWithParent = parent?.registerOpenSubmenu;\n React.useLayoutEffect(() => {\n if (!open || !registerWithParent) return undefined;\n return registerWithParent(submenuHandle);\n }, [open, registerWithParent, submenuHandle]);\n\n // Item activation and Tab close the whole chain: a submenu of a popup menu hands the close up,\n // and the top menu (the root, or a submenu of a static menu) puts focus on its return target\n // first (focus before close: a Dialog an item opens returns focus there), then closes.\n const parentCloseChain = parent?.popup ? parent.closeChain : null;\n const closeChain = useEventCallback(() => {\n if (parentCloseChain) {\n parentCloseChain();\n return;\n }\n if (!popup) return;\n const target = surfaceApiRef.current?.getReturnFocus() ?? null;\n if (target) {\n const doc = target.ownerDocument;\n const active = doc.activeElement;\n const lost = !active || active === doc.body || active === doc.documentElement;\n if (lost || containsFocus()) target.focus({ preventScroll: true });\n }\n requestClose();\n });\n\n const contextValue = React.useMemo<MenuContextValue>(\n () => ({\n popup,\n open,\n setOpen,\n openWithFocus,\n takeInitialFocus,\n registerSurface,\n triggerId,\n labelledBy,\n onTriggerId: setLabelledBy,\n menuId,\n triggerRef,\n triggerElement,\n setTriggerElement,\n parent,\n checked,\n persistOnItemClick,\n isSubmenu,\n requestClose,\n closeChain,\n registerOpenSubmenu,\n listContainsFocus,\n openDelay,\n closeDelay,\n dismiss,\n isHoverFocusing,\n isHoverOpen,\n isHoverClose,\n hoverTriggerHandlers,\n hoverSurfaceHandlers,\n openOnContext: contextMode,\n contextTriggerHandlers,\n contextSurfaceHandlers,\n contextAnchor,\n fromContext,\n contextOpener,\n }),\n [\n popup,\n open,\n setOpen,\n openWithFocus,\n takeInitialFocus,\n registerSurface,\n triggerId,\n labelledBy,\n menuId,\n triggerElement,\n setTriggerElement,\n parent,\n checked,\n persistOnItemClick,\n isSubmenu,\n requestClose,\n closeChain,\n registerOpenSubmenu,\n listContainsFocus,\n openDelay,\n closeDelay,\n dismiss,\n isHoverFocusing,\n isHoverOpen,\n isHoverClose,\n hoverTriggerHandlers,\n hoverSurfaceHandlers,\n contextMode,\n contextTriggerHandlers,\n contextSurfaceHandlers,\n contextAnchor,\n fromContext,\n contextOpener,\n ],\n );\n\n // Static menu: roving tab stop over the items (the last focused one keeps it).\n const {\n containerProps: { ref: rovingRef },\n handleKeyDown: rovingKeyDown,\n handleKeyDownCapture: rovingKeyDownCapture,\n handleFocus: rovingFocus,\n focusFirst,\n getTabIndex,\n } = useRovingTabIndex({\n orientation: 'vertical',\n loop: true,\n typeahead: true,\n tabStop: 'last-focused',\n manageTabIndex: true,\n itemSelector: MENU_ITEM_SELECTOR,\n });\n const mergedRef = useMergedRefs<HTMLDivElement>(ref, rovingRef, staticMenuRef);\n\n // Disabled items never hold the tab stop, so with no enabled item the static menu itself does:\n // Tab still reaches it and a screen reader announces it. Checked whenever the roving hook's tab\n // stop changes (`getTabIndex` changes with it: an item enabled, disabled, added or removed), and\n // after it is stamped (this effect runs after the hook's).\n const [menuIsTabStop, setMenuIsTabStop] = React.useState(false);\n React.useLayoutEffect(() => {\n const menu = staticMenuRef.current;\n if (popup || !menu) return;\n const noItemTabStop = getFirstTabbable(menu) === null;\n if (noItemTabStop === menuIsTabStop) return;\n setMenuIsTabStop(noItemTabStop);\n // An item became enabled while the menu itself had focus: focus moves on to it, rather than\n // staying on an element that is no longer focusable.\n if (!noItemTabStop && menu.ownerDocument.activeElement === menu) focusFirst();\n }, [popup, menuIsTabStop, focusFirst, getTabIndex]);\n\n // The static menu is a menu list: its items close nothing when activated, and the item under\n // the mouse takes focus while focus is inside the menu tree.\n const registerCheckable = useCheckableRegistry();\n const {\n hoverGroup,\n isHoverFocusing: isListHoverFocusing,\n onPointerMove: listPointerMove,\n } = useMenuListPointer(contextValue);\n const listContext = React.useMemo<MenuListContextValue>(\n () => ({\n menu: contextValue,\n isStatic: true,\n portalDepth,\n closeFromItem: noop,\n registerCheckable,\n hoverGroup,\n isHoverFocusing: isListHoverFocusing,\n }),\n [contextValue, portalDepth, registerCheckable, hoverGroup, isListHoverFocusing],\n );\n\n if (popup) {\n return <MenuContext.Provider value={contextValue}>{children}</MenuContext.Provider>;\n }\n\n return (\n <MenuContext.Provider value={contextValue}>\n <MenuListContext.Provider value={listContext}>\n <div\n role=\"menu\"\n {...rest}\n ref={mergedRef}\n tabIndex={rest.tabIndex ?? (menuIsTabStop ? 0 : undefined)}\n data-roving-container=\"\"\n onKeyDown={composeEventHandlers(onKeyDown, rovingKeyDown)}\n onKeyDownCapture={withTypeaheadText(\n composeEventHandlers(onKeyDownCapture, rovingKeyDownCapture),\n )}\n onFocus={composeEventHandlers(onFocus, rovingFocus, { checkDefaultPrevented: false })}\n onPointerMove={composeEventHandlers(onPointerMove, listPointerMove)}\n className={cn(menuSurfaceClasses, focusRing, className)}\n >\n {children}\n </div>\n </MenuListContext.Provider>\n </MenuContext.Provider>\n );\n};\nMenuRoot.displayName = 'Menu';\n"],"mappings":"i8BAoIA,IAAMqD,OAAa,CAAC,EAGdC,GAAiB,IAOvB,SAAgBC,GAAc,EAAoC,CAChE,OAAOvD,EAAAA,gBAAgBwD,CAAQ,CAAC,CAAC,MAAM,CAAE,UACvCvD,EAAAA,gBAAgBwD,EAAMvD,EAAAA,YAAaC,GAAAA,WAAW,CAChD,CACF,CAGA,SAASuD,GAAU,EAAyB,CAC1C,IAAMC,EAASC,EAAM,IAAK,GAAS,KAAKC,EAAK,GAAG,EAChD,OAAOF,EAAO,OAAS,EACnB,GAAGA,EAAO,MAAM,EAAG,EAAE,CAAC,CAAC,KAAK,IAAI,EAAE,OAAOA,EAAOA,EAAO,OAAS,KAChEA,EAAO,KAAK,EAAE,CACpB,CAIA,IAAaG,GAAY,CACvB,WACA,KAAMC,EACN,cACA,eACA,iBACA,wBACA,wBACA,mBAAoBC,GACpB,YAAaC,EACb,UAAWC,GACX,WAAYC,GACZ,cAAeC,GACf,aACA,aACA,oBACA,WACA,iBACA,OACA,GAAGC,KACY,C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CAAC,CACnE,CACAd,EAAa,CACf,CAAC,EAEKoC,EAAe1K,EAAM,aAClB,CACL,QACA,OACA,UACA,gBACA,oBACA,mBACA,YACA,cACA,YAAakF,GACb,UACA,aACA,iBACA,qBACA,SACA,UACA,sBACA,YACA,eACA,cACA,uBACA,oBACA,YACA,aACA,WACA,kBACA,eACA,gBACA,wBACA,wBACA,cAAe0B,EACf,0BACA,0BACA,iBACA,eACA,gBACF,GACA,CACE9B,EACAD,EACAN,EACA4E,EACAE,GACAxD,GACAd,EACAE,GACAD,GACAI,EACAE,GACAlB,EACAoC,EACAC,GACApC,EACAiE,EACAmC,GACAN,GACAlC,EACAvB,EACAC,EACAsD,GACAL,EACAjB,GACAR,GACAc,GACAJ,GACAjC,EACA4C,GACAC,GACAH,GACAqB,GACApB,EACF,CACF,EAGM,CACJ,eAAgB,CAAE,IAAKqB,IACvB,cAAeC,GACf,qBAAsBC,GACtB,YAAaC,GACb,cACA,gBACEpK,GAAAA,kBAAkB,CACpB,YAAa,WACb,KAAM,GACN,UAAW,GACX,QAAS,eACT,eAAgB,GAChB,aAAcC,EAAAA,kBAChB,CAAC,EACKoK,GAAYnK,GAAAA,cAA8BwG,GAAKuD,GAAWjD,CAAa,EAMvE,CAACsD,EAAeC,IAAoBlL,EAAM,SAAS,EAAK,EAC9D8C,EAAM,oBAAsB,CAC1B,IAAMqI,EAAOxD,EAAc,QAC3B,GAAI7C,GAAS,CAACqG,EAAM,OACpB,IAAMC,EAAgBtK,GAAAA,iBAAiBqK,CAAI,IAAM,KAC7CC,IAAkBH,IACtBC,GAAiBE,CAAa,EAG1B,CAACA,GAAiBD,EAAK,cAAc,gBAAkBA,GAAME,GAAW,EAC9E,EAAG,CAACvG,EAAOmG,EAAeI,GAAYC,EAAW,CAAC,EAIlD,IAAMC,GAAoBxK,EAAAA,qBAAqB,EACzC,CACJ,cACA,gBAAiByK,EACjB,cAAeC,IACbzK,GAAAA,mBAAmB0J,CAAY,EAC7BgB,GAAc1L,EAAM,aACjB,CACL,KAAM0K,EACN,SAAU,GACV,cACA,cAAe1H,GACf,qBACA,cACA,gBAAiBwI,CACnB,GACA,CAACd,EAAcxG,EAAaqH,GAAmBI,GAAYH,CAAmB,CAChF,EAMA,OAJI1G,GACK,EAAA/B,EAAA,IAAA,CAAC9B,EAAAA,YAAY,SAAb,CAAsB,MAAOyJ,EAAe,UAA+B,CAAA,GAIlF,EAAA3H,EAAA,IAAA,CAAC9B,EAAAA,YAAY,SAAb,CAAsB,MAAOyJ,EAC3B,UAAA,EAAA3H,EAAA,IAAA,CAAC7B,EAAAA,gBAAgB,SAAjB,CAA0B,MAAOwK,GAC/B,UAAA,EAAA3I,EAAA,IAAA,CAAC,MAAD,CACE,KAAK,OACL,GAAIiB,EACJ,IAAKgH,GACL,SAAUhH,EAAK,WAAaiH,EAAgB,EAAI,IAAA,IAChD,wBAAsB,GACtB,UAAW9J,EAAAA,qBAAqB6F,GAAW6D,EAAa,EACxD,iBAAkBzJ,EAAAA,kBAChBD,EAAAA,qBAAqB8F,GAAkB6D,EAAoB,CAC7D,EACA,QAAS3J,EAAAA,qBAAqB+F,GAAS6D,GAAa,CAAE,sBAAuB,EAAM,CAAC,EACpF,cAAe5J,EAAAA,qBAAqBgG,GAAesE,EAAe,EAClE,UAAWpK,EAAAA,GAAGC,EAAAA,mBAAoBC,GAAAA,UAAWwF,EAAS,EAErD,UACE,CAAA,CACmB,CAAA,CACN,CAAA,CAE1B,EACA,EAAS,YAAc"}
@@ -0,0 +1,308 @@
1
+ "use client";
2
+ import { cn as e } from "../../lib/cn.mjs";
3
+ import { flattenChildren as t, isElementOfType as n } from "../../lib/children.mjs";
4
+ import { warnOnce as r } from "../../lib/dev.mjs";
5
+ import { composeEventHandlers as i } from "../../lib/composeEventHandlers.mjs";
6
+ import { useEventCallback as a } from "../../hooks/useEventCallback.mjs";
7
+ import { useControllable as ee } from "../../hooks/useControllable.mjs";
8
+ import { useId as te } from "../../hooks/useId.mjs";
9
+ import { getFirstTabbable as ne } from "../../lib/focus.mjs";
10
+ import { useRovingTabIndex as re } from "../../hooks/useRovingTabIndex.mjs";
11
+ import { useMergedRefs as ie } from "../../hooks/useMergedRefs.mjs";
12
+ import { useIsClient as ae } from "../../hooks/useIsClient.mjs";
13
+ import { getLayerTreeElements as oe } from "../../lib/layers.mjs";
14
+ import { PortalDepthContext as se } from "../portal/Portal.mjs";
15
+ import { focusRing as ce } from "../../lib/styles.mjs";
16
+ import { useCheckedValues as le, withCheckedValuesListener as ue } from "../../hooks/useCheckedValues.mjs";
17
+ import { MenuContext as o, MenuListContext as de, useCheckableRegistry as fe, useMenuListContext as pe } from "./Menu.context.mjs";
18
+ import { MENU_ITEM_SELECTOR as me, menuSurfaceClasses as he, withTypeaheadText as ge } from "./Menu.shared.mjs";
19
+ import { useHoverIntent as _e } from "../../hooks/useHoverIntent.mjs";
20
+ import { MenuPopover as s, useMenuListPointer as ve } from "./Menu.popover.mjs";
21
+ import { useContextMenuAnchor as ye } from "../../hooks/useContextMenuAnchor.mjs";
22
+ import { MenuTrigger as c } from "./Menu.trigger.mjs";
23
+ import * as l from "react";
24
+ import { jsx as u } from "react/jsx-runtime";
25
+ //#region src/components/navigation/Menu.root.tsx
26
+ var be = () => {}, xe = 250;
27
+ function Se(e) {
28
+ return t(e).some(({ node: e }) => n(e, c, s));
29
+ }
30
+ function Ce(e) {
31
+ let t = e.map((e) => `\`${e}\``);
32
+ return t.length > 1 ? `${t.slice(0, -1).join(", ")} and ${t[t.length - 1]}` : t.join("");
33
+ }
34
+ var d = ({ children: t, open: n, defaultOpen: s, onOpenChange: c, checkedValues: d, defaultCheckedValues: we, onCheckedValuesChange: f, persistOnItemClick: Te, openOnHover: p, openDelay: Ee, closeDelay: De, openOnContext: Oe, className: ke, onKeyDown: Ae, onKeyDownCapture: je, onFocus: Me, onPointerMove: Ne, ref: Pe, ...m }) => {
35
+ let h = pe(), g = l.useContext(se), _ = h !== null && h.portalDepth === g ? h : null, v = _?.menu ?? null, y = v !== null, [b, x, Fe] = ee(n, s ?? !1, c), Ie = ae(), S = v === null || !v.popup || v.open, C = b && Ie && S;
36
+ l.useLayoutEffect(() => {
37
+ S || !b || Fe || x(!1);
38
+ }, [
39
+ S,
40
+ b,
41
+ Fe,
42
+ x
43
+ ]);
44
+ let w = n !== void 0 || s !== void 0 || c !== void 0 || Se(t), T = te("wave-menu-trigger"), Le = te("wave-menu"), [Re, ze] = l.useState(T), E = l.useRef(null), [D, Be] = l.useState(null), Ve = l.useCallback((e) => {
45
+ E.current = e, Be(e);
46
+ }, []), O = l.useRef(null), [He, Ue] = l.useState(null), [We, Ge] = l.useState(""), Ke = l.useCallback((e) => {
47
+ O.current = e, Ue(e?.surface ?? null), e && Ge(e.layerId);
48
+ }, []), qe = le(d, we, f), k = v?.checked ?? null, Je = k === null || d !== void 0 || we !== void 0, Ye = f !== void 0, Xe = a(f), Ze = l.useMemo(() => k && Ye ? ue(k, Xe) : k, [
49
+ k,
50
+ Ye,
51
+ Xe
52
+ ]), Qe = Je || Ze === null ? qe : Ze, $e = Te ?? v?.persistOnItemClick ?? !1, A = Ee ?? v?.openDelay ?? xe, j = De ?? v?.closeDelay ?? xe, M = w && !y && Oe === !0, N = w && !M && (p ?? y), P = [];
53
+ if (w) {
54
+ ke !== void 0 && P.push("className"), Ae !== void 0 && P.push("onKeyDown"), je !== void 0 && P.push("onKeyDownCapture"), Me !== void 0 && P.push("onFocus"), Ne !== void 0 && P.push("onPointerMove");
55
+ for (let [e, t] of Object.entries(m)) t !== void 0 && P.push(e);
56
+ Pe != null && P.push("ref");
57
+ }
58
+ let F = P.length === 0 ? "" : `Menu: a popup menu (Menu.Trigger + Menu.Popover) renders no element of its own, so ${P.map((e) => `\`${e}\``).join(", ")} on Menu ${P.length === 1 ? "is" : "are"} ignored. Pass ${P.length === 1 ? "it" : "them"} to Menu.Popover (the menu surface) or to the trigger's child instead.`;
59
+ l.useEffect(() => {
60
+ F && r("Menu:popup-ignored-props", F);
61
+ }, [F]);
62
+ let I = w ? "" : Ce([p ? "openOnHover" : null, Oe ? "openOnContext" : null].filter((e) => e !== null)), et = M && p === !0;
63
+ l.useEffect(() => {
64
+ if (!I) return;
65
+ let [e, t] = I.includes(" and ") ? ["are", "they"] : ["is", "it"];
66
+ r("Menu:static-popup-props", `Menu: ${I} ${e} ignored on a static menu: ${t} apply to a popup menu (Menu.Trigger + Menu.Popover). A static menu passes openDelay and closeDelay on to its submenus.`);
67
+ }, [I]), l.useEffect(() => {
68
+ et && r("Menu:hover-and-context", "Menu: openOnHover is ignored with openOnContext: a context menu opens only from a context gesture (a right click, Shift+F10 or the ContextMenu key).");
69
+ }, [et]);
70
+ let L = l.useRef(null), R = l.useRef(null), z = a(() => {
71
+ let e = O.current, t = e?.surface ?? L.current, n = t?.ownerDocument.activeElement;
72
+ return !t || !n ? !1 : t.contains(n) ? !0 : e ? oe(e.layerId, { includeOwnElements: !1 }).some((e) => e.contains(n)) : R.current?.containsFocus() ?? !1;
73
+ }), B = a(() => {
74
+ let e = O.current?.surface ?? L.current, t = e?.ownerDocument.activeElement;
75
+ return e && t && e.contains(t) ? !0 : R.current?.listContainsFocus() ?? !1;
76
+ }), V = l.useRef(!1), tt = l.useCallback(() => V.current, []), H = (e) => {
77
+ V.current = e, R.current?.close(), x(!1);
78
+ }, U = a(() => H(!1)), nt = a(() => H(!0)), W = l.useRef("other"), G = l.useRef(!1), K = l.useRef("first");
79
+ l.useLayoutEffect(() => {
80
+ C && (W.current = G.current ? "hover" : "other", V.current = !1), G.current = !1;
81
+ }, [C]);
82
+ let rt = l.useCallback(() => W.current === "hover", []), { triggerHandlers: q, surfaceHandlers: it, cancel: at, startClose: ot } = _e({
83
+ enabled: N,
84
+ open: C,
85
+ openDelay: A,
86
+ closeDelay: j,
87
+ trigger: D,
88
+ surface: He,
89
+ group: _?.hoverGroup,
90
+ onOpen: () => {
91
+ G.current = !0, K.current = "none", x(!0);
92
+ },
93
+ onClose: nt,
94
+ canClose: () => W.current === "hover" && !z()
95
+ }), st = a(() => {
96
+ C || (G.current = !1, K.current === "none" && (K.current = "first"));
97
+ }), ct = l.useMemo(() => ({
98
+ ...q,
99
+ onPointerLeave: (e) => {
100
+ q.onPointerLeave(e), st();
101
+ }
102
+ }), [q, st]), J = l.useCallback((e) => {
103
+ W.current = "other", G.current = !1, at();
104
+ let t = O.current;
105
+ if (t) {
106
+ e === "last" ? t.focusLast() : e === "first" && t.focusFirst();
107
+ return;
108
+ }
109
+ K.current = e, x(!0);
110
+ }, [x, at]), lt = l.useCallback(() => {
111
+ let e = K.current;
112
+ return K.current = "first", e;
113
+ }, []), { anchor: ut, fromContext: dt, opener: ft, triggerHandlers: pt, surfaceHandlers: mt } = ye({
114
+ enabled: M,
115
+ open: C,
116
+ trigger: D,
117
+ layerId: We,
118
+ onOpen: () => J("first"),
119
+ onClose: U
120
+ }), ht = _?.isHoverFocusing, gt = v?.isHoverFocusing, Y = a(() => (ht?.() ?? !1) || (gt?.() ?? !1)), X = l.useRef(!1);
121
+ l.useEffect(() => {
122
+ if (!M || !C || !D) return;
123
+ let e = D.ownerDocument, t = (e) => {
124
+ X.current = e.button === 2 || e.button === 0 && (e.ctrlKey || e.pointerType === "touch" || e.pointerType === "pen");
125
+ }, n = () => {
126
+ X.current = !1;
127
+ };
128
+ return e.addEventListener("pointerdown", t, !0), e.addEventListener("pointerup", n, !0), e.addEventListener("pointercancel", n, !0), () => {
129
+ e.removeEventListener("pointerdown", t, !0), e.removeEventListener("pointerup", n, !0), e.removeEventListener("pointercancel", n, !0), X.current = !1;
130
+ };
131
+ }, [
132
+ M,
133
+ C,
134
+ D
135
+ ]);
136
+ let _t = a((e, t) => {
137
+ if (!(e === "focus-outside" && M && X.current && t.target instanceof Node && E.current?.contains(t.target))) {
138
+ if (e === "focus-outside" && y && N && Y()) {
139
+ W.current = "hover", ot(t);
140
+ return;
141
+ }
142
+ U();
143
+ }
144
+ }), vt = l.useCallback((e) => {
145
+ let t = R.current;
146
+ return R.current = e, t && t !== e && t.close(), () => {
147
+ R.current === e && (R.current = null);
148
+ };
149
+ }, []), yt = l.useMemo(() => ({
150
+ close: U,
151
+ containsFocus: z,
152
+ listContainsFocus: B
153
+ }), [
154
+ U,
155
+ z,
156
+ B
157
+ ]), Z = v?.registerOpenSubmenu;
158
+ l.useLayoutEffect(() => {
159
+ if (C && Z) return Z(yt);
160
+ }, [
161
+ C,
162
+ Z,
163
+ yt
164
+ ]);
165
+ let bt = v?.popup ? v.closeChain : null, xt = a(() => {
166
+ if (bt) {
167
+ bt();
168
+ return;
169
+ }
170
+ if (!w) return;
171
+ let e = O.current?.getReturnFocus() ?? null;
172
+ if (e) {
173
+ let t = e.ownerDocument, n = t.activeElement;
174
+ (!n || n === t.body || n === t.documentElement || z()) && e.focus({ preventScroll: !0 });
175
+ }
176
+ U();
177
+ }), Q = l.useMemo(() => ({
178
+ popup: w,
179
+ open: C,
180
+ setOpen: x,
181
+ openWithFocus: J,
182
+ takeInitialFocus: lt,
183
+ registerSurface: Ke,
184
+ triggerId: T,
185
+ labelledBy: Re,
186
+ onTriggerId: ze,
187
+ menuId: Le,
188
+ triggerRef: E,
189
+ triggerElement: D,
190
+ setTriggerElement: Ve,
191
+ parent: v,
192
+ checked: Qe,
193
+ persistOnItemClick: $e,
194
+ isSubmenu: y,
195
+ requestClose: U,
196
+ closeChain: xt,
197
+ registerOpenSubmenu: vt,
198
+ listContainsFocus: B,
199
+ openDelay: A,
200
+ closeDelay: j,
201
+ dismiss: _t,
202
+ isHoverFocusing: Y,
203
+ isHoverOpen: rt,
204
+ isHoverClose: tt,
205
+ hoverTriggerHandlers: ct,
206
+ hoverSurfaceHandlers: it,
207
+ openOnContext: M,
208
+ contextTriggerHandlers: pt,
209
+ contextSurfaceHandlers: mt,
210
+ contextAnchor: ut,
211
+ fromContext: dt,
212
+ contextOpener: ft
213
+ }), [
214
+ w,
215
+ C,
216
+ x,
217
+ J,
218
+ lt,
219
+ Ke,
220
+ T,
221
+ Re,
222
+ Le,
223
+ D,
224
+ Ve,
225
+ v,
226
+ Qe,
227
+ $e,
228
+ y,
229
+ U,
230
+ xt,
231
+ vt,
232
+ B,
233
+ A,
234
+ j,
235
+ _t,
236
+ Y,
237
+ rt,
238
+ tt,
239
+ ct,
240
+ it,
241
+ M,
242
+ pt,
243
+ mt,
244
+ ut,
245
+ dt,
246
+ ft
247
+ ]), { containerProps: { ref: St }, handleKeyDown: Ct, handleKeyDownCapture: wt, handleFocus: Tt, focusFirst: Et, getTabIndex: Dt } = re({
248
+ orientation: "vertical",
249
+ loop: !0,
250
+ typeahead: !0,
251
+ tabStop: "last-focused",
252
+ manageTabIndex: !0,
253
+ itemSelector: me
254
+ }), Ot = ie(Pe, St, L), [$, kt] = l.useState(!1);
255
+ l.useLayoutEffect(() => {
256
+ let e = L.current;
257
+ if (w || !e) return;
258
+ let t = ne(e) === null;
259
+ t !== $ && (kt(t), !t && e.ownerDocument.activeElement === e && Et());
260
+ }, [
261
+ w,
262
+ $,
263
+ Et,
264
+ Dt
265
+ ]);
266
+ let At = fe(), { hoverGroup: jt, isHoverFocusing: Mt, onPointerMove: Nt } = ve(Q), Pt = l.useMemo(() => ({
267
+ menu: Q,
268
+ isStatic: !0,
269
+ portalDepth: g,
270
+ closeFromItem: be,
271
+ registerCheckable: At,
272
+ hoverGroup: jt,
273
+ isHoverFocusing: Mt
274
+ }), [
275
+ Q,
276
+ g,
277
+ At,
278
+ jt,
279
+ Mt
280
+ ]);
281
+ return w ? /* @__PURE__ */ u(o.Provider, {
282
+ value: Q,
283
+ children: t
284
+ }) : /* @__PURE__ */ u(o.Provider, {
285
+ value: Q,
286
+ children: /* @__PURE__ */ u(de.Provider, {
287
+ value: Pt,
288
+ children: /* @__PURE__ */ u("div", {
289
+ role: "menu",
290
+ ...m,
291
+ ref: Ot,
292
+ tabIndex: m.tabIndex ?? ($ ? 0 : void 0),
293
+ "data-roving-container": "",
294
+ onKeyDown: i(Ae, Ct),
295
+ onKeyDownCapture: ge(i(je, wt)),
296
+ onFocus: i(Me, Tt, { checkDefaultPrevented: !1 }),
297
+ onPointerMove: i(Ne, Nt),
298
+ className: e(he, ce, ke),
299
+ children: t
300
+ })
301
+ })
302
+ });
303
+ };
304
+ d.displayName = "Menu";
305
+ //#endregion
306
+ export { d as MenuRoot, Se as hasPopupParts };
307
+
308
+ //# sourceMappingURL=Menu.root.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Menu.root.mjs","names":["useId","useId$1","React","noop","HOVER_DELAY_MS","hasPopupParts","flattenChildren","children","isElementOfType","node","MenuTrigger","MenuPopover","listProps","quoted","names","name","MenuRoot","openProp","persistOnItemClickProp","openOnHoverProp","openDelayProp","closeDelayProp","openOnContextProp","rest","list","useMenuListContext","portalDepth","PortalDepthContext","parentList","parent","isSubmenu","openState","setOpen","openControlled","useControllable","defaultOpen","onOpenChange","isClient","useIsClient","parentOpen","open","popup","triggerId","menuId","labelledBy","setLabelledBy","triggerRef","triggerElement","setTriggerElementState","setTriggerElement","element","surfaceApiRef","surfaceElement","setSurfaceElement","surfaceLayerId","setSurfaceLayerId","registerSurface","api","ownChecked","useCheckedValues","checkedValues","defaultCheckedValues","onCheckedValuesChange","parentChecked","ownsCheckedState","listens","listener","useEventCallback","sharedChecked","withCheckedValuesListener","checked","persistOnItemClick","openDelay","closeDelay","contextMode","hoverMode","ignoredProps","className","onKeyDown","onKeyDownCapture","onFocus","onPointerMove","value","ref","ignoredMessage","warnOnce","staticPopupProps","hoverAndContext","verb","pronoun","staticMenuRef","openSubmenuRef","containsFocus","surfaceApi","active","getLayerTreeElements","el","listContainsFocus","hoverCloseRef","isHoverClose","closeMenu","byHover","requestClose","requestHoverClose","openReasonRef","hoverOpenPendingRef","initialFocusRef","isHoverOpen","hoverIntentTriggerHandlers","hoverSurfaceHandlers","cancelHover","startHoverClose","useHoverIntent","forgetHoverOpening","hoverTriggerHandlers","event","openWithFocus","target","takeInitialFocus","contextAnchor","contextOpener","contextTriggerHandlers","contextSurfaceHandlers","useContextMenuAnchor","parentListHoverFocusing","parentHoverFocusing","isHoverFocusing","contextPressRef","doc","onPointerDown","onPointerEnd","dismiss","reason","registerOpenSubmenu","previous","submenu","submenuHandle","registerWithParent","parentCloseChain","closeChain","contextValue","fromContext","rovingRef","rovingKeyDown","rovingKeyDownCapture","rovingFocus","useRovingTabIndex","MENU_ITEM_SELECTOR","mergedRef","useMergedRefs","menuIsTabStop","setMenuIsTabStop","menu","noItemTabStop","getFirstTabbable","focusFirst","getTabIndex","registerCheckable","useCheckableRegistry","isListHoverFocusing","listPointerMove","useMenuListPointer","listContext","hoverGroup","MenuContext","MenuListContext","composeEventHandlers","withTypeaheadText","cn","menuSurfaceClasses","focusRing"],"sources":["../../../src/components/navigation/Menu.root.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { warnOnce } from '../../lib/dev';\nimport { flattenChildren, isElementOfType } from '../../lib/children';\nimport { getFirstTabbable } from '../../lib/focus';\nimport { getLayerTreeElements, type DismissReason } from '../../lib/layers';\nimport { focusRing } from '../../lib/styles';\nimport type { CheckedValues, CheckedValuesChangeHandler } from '../../lib/types';\nimport { useCheckedValues, withCheckedValuesListener } from '../../hooks/useCheckedValues';\nimport { useContextMenuAnchor } from '../../hooks/useContextMenuAnchor';\nimport { useControllable } from '../../hooks/useControllable';\nimport { useEventCallback } from '../../hooks/useEventCallback';\nimport { useHoverIntent, type HoverIntent } from '../../hooks/useHoverIntent';\nimport { useId } from '../../hooks/useId';\nimport { useIsClient } from '../../hooks/useIsClient';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { useRovingTabIndex } from '../../hooks/useRovingTabIndex';\nimport { PortalDepthContext } from '../portal/Portal';\nimport {\n MenuContext,\n MenuListContext,\n useCheckableRegistry,\n useMenuListContext,\n} from './Menu.context';\nimport type {\n InitialFocus,\n MenuContextValue,\n MenuListContextValue,\n MenuSurfaceApi,\n OpenSubmenu,\n} from './Menu.context';\nimport { MENU_ITEM_SELECTOR, menuSurfaceClasses, withTypeaheadText } from './Menu.shared';\nimport { MenuPopover, useMenuListPointer } from './Menu.popover';\nimport { MenuTrigger } from './Menu.trigger';\n\n/** Properties for the Menu component. */\nexport interface MenuProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Menu items and dividers (static menu), or a `Menu.Trigger` and a `Menu.Popover` (popup menu).\n */\n children: React.ReactNode;\n /**\n * Controlled open state of a popup menu (`Menu.Trigger` + `Menu.Popover`). Passing it, even\n * `false` (like passing `defaultOpen` or `onOpenChange`), makes Menu a popup menu that renders no\n * element of its own: use it only with `Menu.Trigger`/`Menu.Popover`. Items outside\n * `Menu.Popover` then have no `role=\"menu\"` parent (development warning). Leave all three out\n * for a static menu. The popup renders only in the browser: an open menu is closed in the\n * server HTML and opens once it has hydrated.\n */\n open?: boolean;\n /**\n * Initial open state of an uncontrolled popup menu; a popup menu starts closed without it.\n * Passing it, even `false`, makes Menu a popup menu (see `open`), so for a Menu without\n * `Menu.Trigger`/`Menu.Popover` children, leaving it out is not the same as `false`. The popup\n * renders only in the browser: a menu open by default is closed in the server HTML and opens\n * once it has hydrated.\n */\n defaultOpen?: boolean;\n /**\n * Called with the next open state when the popup menu opens or closes (only on change). Passing\n * it makes Menu a popup menu (see `open`).\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Checked items of the menu's checkbox, radio and switch items, per group `name` (controlled).\n * A submenu without its own `checkedValues` or `defaultCheckedValues` shares its parent menu's\n * state. Works for static and popup menus; unlike `open`, it does not make Menu a popup menu.\n */\n checkedValues?: CheckedValues;\n /** Initial checked items for uncontrolled usage (gives a submenu its own state). @default {} */\n defaultCheckedValues?: CheckedValues;\n /**\n * Called when an item changes the checked items (only on change): the new checked values of every\n * group first, then `details` with the group's `name`, its `checkedItems` and the `event` (Fluent's\n * `onCheckedValueChange(event, { name, checkedItems })`). WaveUI always passes `details`; it is\n * typed optional until 1.0. On a submenu that shares its parent's state it only listens: it is\n * called after the parent's callback, for changes made in this submenu.\n */\n onCheckedValuesChange?: CheckedValuesChangeHandler;\n /**\n * Keep a popup menu open after any of its items is activated; an item's own `persistOnClick`\n * wins. A submenu inherits it unless it sets it.\n * @default false\n */\n persistOnItemClick?: boolean;\n /**\n * Open the popup menu when a mouse pointer rests on its trigger, and close it once the pointer\n * has been off the trigger and the menu for `closeDelay` while focus is not inside the menu. A\n * menu opened by hover does not take focus; a click (or Enter, Space, ArrowDown) on its trigger\n * keeps it open and moves focus into it, as opening it that way does. After Escape or an\n * outside press it does not reopen until the pointer has left the trigger. Touch and pen never\n * open it by hover, and an `aria-disabled` trigger never opens. A triangle between the trigger\n * and the menu keeps it open while the pointer moves diagonally into it. Ignored with\n * `openOnContext` (development warning) and on a static menu (development warning).\n * @default false (true for a submenu)\n */\n openOnHover?: boolean;\n /**\n * Milliseconds a hovering mouse pointer rests on the trigger before the menu opens (mouse hover\n * only). A submenu inherits its parent's, also from a static menu. @default 250\n */\n openDelay?: number;\n /**\n * Milliseconds before a hover-opened menu closes once the mouse pointer has left it and its\n * trigger (mouse hover only). A submenu inherits its parent's, also from a static menu.\n * @default 250\n */\n closeDelay?: number;\n /**\n * Make `Menu.Trigger` a context-menu region: a right click (a Ctrl+click on macOS, a long press\n * where the browser reports one) opens the menu at the pointer, and Shift+F10 or the\n * ContextMenu key opens it at the focused element inside the region, instead of a click; a\n * second gesture while it is open moves it there. Focus returns to the element that had it.\n * The browser's context menu is suppressed there and inside the menu, except in text fields\n * inside the region, which keep it. A press elsewhere, a right click outside or a scroll that\n * moves the region or the row of the gesture (the one under the pointer, or the focused one)\n * closes it. The trigger gets no `aria-haspopup`/`aria-expanded` (it is not a menu button; with\n * a render-prop child, do not spread them): name the menu with `aria-label` on `Menu.Popover`,\n * and consider `aria-keyshortcuts=\"Shift+F10\"` on the region. iOS Safari reports no long press.\n * Ignored on a submenu; `openOnHover` is ignored with it.\n * @default false\n */\n openOnContext?: boolean;\n /**\n * Ref to the static menu element (`role=\"menu\"`). A popup menu renders no root element, so it\n * ignores `ref`, `className` and other DOM props (development warning): pass them to\n * `Menu.Popover`.\n */\n ref?: React.Ref<HTMLDivElement>;\n}\n\nconst noop = () => {};\n\n/** Default of `openDelay` and `closeDelay` (InfoLabel's hover delays). */\nconst HOVER_DELAY_MS = 250;\n\n/**\n * Whether the children contain a `Menu.Trigger` or `Menu.Popover`: direct children and the\n * children of Fragments only (other elements and components are not searched). Parts written in\n * a Server Component (lazy client references) are recognised too.\n */\nexport function hasPopupParts(children: React.ReactNode): boolean {\n return flattenChildren(children).some(({ node }) =>\n isElementOfType(node, MenuTrigger, MenuPopover),\n );\n}\n\n/** Joins prop names for a message: `a`, `` `a` and `b` ``. */\nfunction listProps(names: string[]): string {\n const quoted = names.map((name) => `\\`${name}\\``);\n return quoted.length > 1\n ? `${quoted.slice(0, -1).join(', ')} and ${quoted[quoted.length - 1]}`\n : quoted.join('');\n}\n\n// The root of the `Menu` compound. Its component JSDoc is on the `Menu` export (Menu.tsx) only\n// (C-DOCS): a docblock here would replace it as the Storybook description.\nexport const MenuRoot = ({\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n checkedValues,\n defaultCheckedValues,\n onCheckedValuesChange,\n persistOnItemClick: persistOnItemClickProp,\n openOnHover: openOnHoverProp,\n openDelay: openDelayProp,\n closeDelay: closeDelayProp,\n openOnContext: openOnContextProp,\n className,\n onKeyDown,\n onKeyDownCapture,\n onFocus,\n onPointerMove,\n ref,\n ...rest\n}: MenuProps) => {\n // A Menu rendered in a menu list with no portal between them is a submenu of that list's menu.\n // A Menu inside a Popover or Dialog opened from an item sits one portal deeper: a root menu.\n const list = useMenuListContext();\n const portalDepth = React.useContext(PortalDepthContext);\n const parentList = list !== null && list.portalDepth === portalDepth ? list : null;\n const parent = parentList?.menu ?? null;\n const isSubmenu = parent !== null;\n\n const [openState, setOpen, openControlled] = useControllable(\n openProp,\n defaultOpen ?? false,\n onOpenChange,\n );\n // The popup menu lives in a portal, which renders only in the browser: until then (the server\n // HTML, hydration) the menu reports itself closed, so the trigger's aria-expanded and\n // aria-controls never describe a menu that is not there. A submenu of a popup menu is open only\n // while that menu is: a parent that closes (through its controlled prop, or while it runs an\n // exit motion) takes the submenu's surface, layer and focus restore along in the same commit.\n const isClient = useIsClient();\n const parentOpen = parent === null || !parent.popup || parent.open;\n const open = openState && isClient && parentOpen;\n // A parent that closed without closing this submenu (its controlled `open` prop): an\n // uncontrolled submenu closes too, so it does not reopen with the parent. A controlled\n // submenu's state is the app's.\n React.useLayoutEffect(() => {\n if (parentOpen || !openState || openControlled) return;\n setOpen(false);\n }, [parentOpen, openState, openControlled, setOpen]);\n\n const popup =\n openProp !== undefined ||\n defaultOpen !== undefined ||\n onOpenChange !== undefined ||\n hasPopupParts(children);\n\n const triggerId = useId('wave-menu-trigger');\n const menuId = useId('wave-menu');\n const [labelledBy, setLabelledBy] = React.useState(triggerId);\n const triggerRef = React.useRef<HTMLElement | null>(null);\n const [triggerElement, setTriggerElementState] = React.useState<HTMLElement | null>(null);\n const setTriggerElement = React.useCallback((element: HTMLElement | null) => {\n triggerRef.current = element;\n setTriggerElementState(element);\n }, []);\n\n // The open surface: its API in a ref (read in events), its element and layer in state (the\n // hover and context-menu hooks observe them).\n const surfaceApiRef = React.useRef<MenuSurfaceApi | null>(null);\n const [surfaceElement, setSurfaceElement] = React.useState<HTMLElement | null>(null);\n const [surfaceLayerId, setSurfaceLayerId] = React.useState('');\n const registerSurface = React.useCallback((api: MenuSurfaceApi | null) => {\n surfaceApiRef.current = api;\n setSurfaceElement(api?.surface ?? null);\n // Kept after the surface closes: a context gesture records its opener against the last layer.\n if (api) setSurfaceLayerId(api.layerId);\n }, []);\n\n // Checked values: one state per menu tree. A Menu owns its state when it sets `checkedValues` or\n // `defaultCheckedValues`, or has no parent; otherwise it uses its parent's, and its own\n // `onCheckedValuesChange` only listens to the changes its items make (called after the owner's).\n const ownChecked = useCheckedValues(checkedValues, defaultCheckedValues, onCheckedValuesChange);\n const parentChecked = parent?.checked ?? null;\n const ownsCheckedState =\n parentChecked === null || checkedValues !== undefined || defaultCheckedValues !== undefined;\n const listens = onCheckedValuesChange !== undefined;\n const listener = useEventCallback(onCheckedValuesChange);\n const sharedChecked = React.useMemo(\n () =>\n parentChecked && listens ? withCheckedValuesListener(parentChecked, listener) : parentChecked,\n [parentChecked, listens, listener],\n );\n const checked = ownsCheckedState || sharedChecked === null ? ownChecked : sharedChecked;\n const persistOnItemClick = persistOnItemClickProp ?? parent?.persistOnItemClick ?? false;\n const openDelay = openDelayProp ?? parent?.openDelay ?? HOVER_DELAY_MS;\n const closeDelay = closeDelayProp ?? parent?.closeDelay ?? HOVER_DELAY_MS;\n\n // Context mode applies to a root popup menu; hover to a popup menu outside context mode.\n const contextMode = popup && !isSubmenu && openOnContextProp === true;\n const hoverMode = popup && !contextMode && (openOnHoverProp ?? isSubmenu);\n\n // C-DEV: a popup menu renders no root element, so root DOM props and the ref go nowhere.\n const ignoredProps: string[] = [];\n if (popup) {\n if (className !== undefined) ignoredProps.push('className');\n if (onKeyDown !== undefined) ignoredProps.push('onKeyDown');\n if (onKeyDownCapture !== undefined) ignoredProps.push('onKeyDownCapture');\n if (onFocus !== undefined) ignoredProps.push('onFocus');\n if (onPointerMove !== undefined) ignoredProps.push('onPointerMove');\n for (const [name, value] of Object.entries(rest)) {\n if (value !== undefined) ignoredProps.push(name);\n }\n if (ref != null) ignoredProps.push('ref');\n }\n const ignoredMessage =\n ignoredProps.length === 0\n ? ''\n : `Menu: a popup menu (Menu.Trigger + Menu.Popover) renders no element of its own, so ${ignoredProps\n .map((name) => `\\`${name}\\``)\n .join(', ')} on Menu ${ignoredProps.length === 1 ? 'is' : 'are'} ignored. Pass ${\n ignoredProps.length === 1 ? 'it' : 'them'\n } to Menu.Popover (the menu surface) or to the trigger's child instead.`;\n React.useEffect(() => {\n if (ignoredMessage) warnOnce('Menu:popup-ignored-props', ignoredMessage);\n }, [ignoredMessage]);\n\n // C-DEV: the popup openings do nothing on a static menu; hover gives way to context gestures.\n const staticPopupProps = popup\n ? ''\n : listProps(\n [openOnHoverProp ? 'openOnHover' : null, openOnContextProp ? 'openOnContext' : null].filter(\n (name): name is string => name !== null,\n ),\n );\n const hoverAndContext = contextMode && openOnHoverProp === true;\n React.useEffect(() => {\n if (!staticPopupProps) return;\n const [verb, pronoun] = staticPopupProps.includes(' and ') ? ['are', 'they'] : ['is', 'it'];\n warnOnce(\n 'Menu:static-popup-props',\n `Menu: ${staticPopupProps} ${verb} ignored on a static menu: ${pronoun} apply to a popup menu (Menu.Trigger + Menu.Popover). A static menu passes openDelay and closeDelay on to its submenus.`,\n );\n }, [staticPopupProps]);\n React.useEffect(() => {\n if (!hoverAndContext) return;\n warnOnce(\n 'Menu:hover-and-context',\n 'Menu: openOnHover is ignored with openOnContext: a context menu opens only from a context gesture (a right click, Shift+F10 or the ContextMenu key).',\n );\n }, [hoverAndContext]);\n\n const staticMenuRef = React.useRef<HTMLDivElement | null>(null);\n\n // The open submenu of this menu's list (one at a time) and what focus inside means for the chain.\n const openSubmenuRef = React.useRef<OpenSubmenu | null>(null);\n const containsFocus = useEventCallback((): boolean => {\n const surfaceApi = surfaceApiRef.current;\n const element = surfaceApi?.surface ?? staticMenuRef.current;\n const active = element?.ownerDocument.activeElement;\n if (!element || !active) return false;\n if (element.contains(active)) return true;\n // A popup menu's layer tree holds its submenus and the portals opened from its items; its own\n // elements (the trigger) do not count.\n if (surfaceApi) {\n return getLayerTreeElements(surfaceApi.layerId, { includeOwnElements: false }).some((el) =>\n el.contains(active),\n );\n }\n return openSubmenuRef.current?.containsFocus() ?? false;\n });\n // Focus in a list of the chain: this menu's list, else (recursively) its open submenu's. A\n // portal opened from an item does not count, so hover never takes focus from it.\n const listContainsFocus = useEventCallback((): boolean => {\n const element = surfaceApiRef.current?.surface ?? staticMenuRef.current;\n const active = element?.ownerDocument.activeElement;\n if (element && active && element.contains(active)) return true;\n return openSubmenuRef.current?.listContainsFocus() ?? false;\n });\n\n // Every close of this menu closes its open submenu first, innermost first, through the\n // submenu's own state: each controlled submenu hears onOpenChange(false) once. A close asked for\n // by the hover intent is marked (before the request, in case the app applies it synchronously),\n // so the surface's focus restore moves no focus; every other close request, and the next\n // opening, clears the mark. A submenu closed along with it is taken along by the restore itself.\n const hoverCloseRef = React.useRef(false);\n const isHoverClose = React.useCallback(() => hoverCloseRef.current, []);\n const closeMenu = (byHover: boolean) => {\n hoverCloseRef.current = byHover;\n openSubmenuRef.current?.close();\n setOpen(false);\n };\n const requestClose = useEventCallback(() => closeMenu(false));\n const requestHoverClose = useEventCallback(() => closeMenu(true));\n\n // Why the open menu is open: a hover opening stays unpinned (the hover close applies) until the\n // trigger is activated; every other opening (click, keys, context, a controlled `open`) pins it.\n const openReasonRef = React.useRef<'hover' | 'other'>('other');\n const hoverOpenPendingRef = React.useRef(false);\n const initialFocusRef = React.useRef<InitialFocus>('first');\n React.useLayoutEffect(() => {\n if (open) {\n openReasonRef.current = hoverOpenPendingRef.current ? 'hover' : 'other';\n hoverCloseRef.current = false;\n }\n hoverOpenPendingRef.current = false;\n }, [open]);\n const isHoverOpen = React.useCallback(() => openReasonRef.current === 'hover', []);\n\n const {\n triggerHandlers: hoverIntentTriggerHandlers,\n surfaceHandlers: hoverSurfaceHandlers,\n cancel: cancelHover,\n startClose: startHoverClose,\n } = useHoverIntent({\n enabled: hoverMode,\n open,\n openDelay,\n closeDelay,\n trigger: triggerElement,\n surface: surfaceElement,\n group: parentList?.hoverGroup,\n onOpen: () => {\n hoverOpenPendingRef.current = true;\n initialFocusRef.current = 'none';\n setOpen(true);\n },\n onClose: requestHoverClose,\n // Pinned, or focus inside the menu (not on its trigger): the hover close waits.\n canClose: () => openReasonRef.current === 'hover' && !containsFocus(),\n });\n\n // A hover opening stays pending until the menu opens, in a later render too (an app that\n // applies it in a transition). One the app has not applied when the pointer leaves the trigger\n // (a controlled menu whose app kept `open` false) is forgotten then, so a later opening by the\n // app is an ordinary one: it focuses the first item and is pinned.\n const forgetHoverOpening = useEventCallback(() => {\n if (open) return;\n hoverOpenPendingRef.current = false;\n if (initialFocusRef.current === 'none') initialFocusRef.current = 'first';\n });\n const hoverTriggerHandlers = React.useMemo<HoverIntent['triggerHandlers']>(\n () => ({\n ...hoverIntentTriggerHandlers,\n onPointerLeave: (event) => {\n hoverIntentTriggerHandlers.onPointerLeave(event);\n forgetHoverOpening();\n },\n }),\n [hoverIntentTriggerHandlers, forgetHoverOpening],\n );\n\n const openWithFocus = React.useCallback(\n (target: InitialFocus) => {\n // Any opening but hover pins the menu; an open, hover-opened menu is pinned and focused.\n openReasonRef.current = 'other';\n hoverOpenPendingRef.current = false;\n cancelHover();\n const surfaceApi = surfaceApiRef.current;\n if (surfaceApi) {\n if (target === 'last') surfaceApi.focusLast();\n else if (target === 'first') surfaceApi.focusFirst();\n return;\n }\n initialFocusRef.current = target;\n setOpen(true);\n },\n [setOpen, cancelHover],\n );\n const takeInitialFocus = React.useCallback((): InitialFocus => {\n const target = initialFocusRef.current;\n initialFocusRef.current = 'first';\n return target;\n }, []);\n\n // Context gestures on the trigger region: a context gesture opens the menu (focus on its first\n // item) at the pointer or the focused row; a right click outside or an anchor-moving scroll\n // closes it.\n const {\n anchor: contextAnchor,\n fromContext,\n opener: contextOpener,\n triggerHandlers: contextTriggerHandlers,\n surfaceHandlers: contextSurfaceHandlers,\n } = useContextMenuAnchor({\n enabled: contextMode,\n open,\n trigger: triggerElement,\n layerId: surfaceLayerId,\n onOpen: () => openWithFocus('first'),\n onClose: requestClose,\n });\n\n // Focus follows the mouse: a submenu that loses focus to an item the pointer is focusing in an\n // enclosing list becomes a hover-opened submenu and closes through the hover close. A submenu\n // with `openOnHover={false}` has no hover close, so it closes at once, as for a keyboard move.\n const parentListHoverFocusing = parentList?.isHoverFocusing;\n const parentHoverFocusing = parent?.isHoverFocusing;\n const isHoverFocusing = useEventCallback(\n (): boolean => (parentListHoverFocusing?.() ?? false) || (parentHoverFocusing?.() ?? false),\n );\n // A press in progress that can be a context gesture: the right button, a Ctrl+press (the macOS\n // context click) or a touch or pen press (a long press). Recorded at its pointerdown and\n // forgotten at its pointerup, while a context menu is open.\n const contextPressRef = React.useRef(false);\n React.useEffect(() => {\n if (!contextMode || !open || !triggerElement) return undefined;\n const doc = triggerElement.ownerDocument;\n const onPointerDown = (event: PointerEvent) => {\n contextPressRef.current =\n event.button === 2 ||\n (event.button === 0 &&\n (event.ctrlKey || event.pointerType === 'touch' || event.pointerType === 'pen'));\n };\n const onPointerEnd = () => {\n contextPressRef.current = false;\n };\n doc.addEventListener('pointerdown', onPointerDown, true);\n doc.addEventListener('pointerup', onPointerEnd, true);\n doc.addEventListener('pointercancel', onPointerEnd, true);\n return () => {\n doc.removeEventListener('pointerdown', onPointerDown, true);\n doc.removeEventListener('pointerup', onPointerEnd, true);\n doc.removeEventListener('pointercancel', onPointerEnd, true);\n contextPressRef.current = false;\n };\n }, [contextMode, open, triggerElement]);\n\n const dismiss = useEventCallback((reason: DismissReason, event: Event) => {\n // Focus that such a press moves into a context menu's region does not close the menu: a\n // right-button (or macOS Ctrl+) press focuses the row under the pointer before the contextmenu\n // event that moves the menu there (Chromium, Firefox). Any other focus move into the region (a\n // primary press, the app) closes it, as does an outside press and Tab (the surface's handler).\n if (\n reason === 'focus-outside' &&\n contextMode &&\n contextPressRef.current &&\n event.target instanceof Node &&\n triggerRef.current?.contains(event.target)\n ) {\n return;\n }\n if (reason === 'focus-outside' && isSubmenu && hoverMode && isHoverFocusing()) {\n openReasonRef.current = 'hover';\n startHoverClose(event);\n return;\n }\n requestClose();\n });\n\n const registerOpenSubmenu = React.useCallback((submenu: OpenSubmenu) => {\n const previous = openSubmenuRef.current;\n openSubmenuRef.current = submenu;\n // One open submenu per list: the one open before closes.\n if (previous && previous !== submenu) previous.close();\n return () => {\n if (openSubmenuRef.current === submenu) openSubmenuRef.current = null;\n };\n }, []);\n\n // A submenu registers with its parent while it is open.\n const submenuHandle = React.useMemo<OpenSubmenu>(\n () => ({ close: requestClose, containsFocus, listContainsFocus }),\n [requestClose, containsFocus, listContainsFocus],\n );\n const registerWithParent = parent?.registerOpenSubmenu;\n React.useLayoutEffect(() => {\n if (!open || !registerWithParent) return undefined;\n return registerWithParent(submenuHandle);\n }, [open, registerWithParent, submenuHandle]);\n\n // Item activation and Tab close the whole chain: a submenu of a popup menu hands the close up,\n // and the top menu (the root, or a submenu of a static menu) puts focus on its return target\n // first (focus before close: a Dialog an item opens returns focus there), then closes.\n const parentCloseChain = parent?.popup ? parent.closeChain : null;\n const closeChain = useEventCallback(() => {\n if (parentCloseChain) {\n parentCloseChain();\n return;\n }\n if (!popup) return;\n const target = surfaceApiRef.current?.getReturnFocus() ?? null;\n if (target) {\n const doc = target.ownerDocument;\n const active = doc.activeElement;\n const lost = !active || active === doc.body || active === doc.documentElement;\n if (lost || containsFocus()) target.focus({ preventScroll: true });\n }\n requestClose();\n });\n\n const contextValue = React.useMemo<MenuContextValue>(\n () => ({\n popup,\n open,\n setOpen,\n openWithFocus,\n takeInitialFocus,\n registerSurface,\n triggerId,\n labelledBy,\n onTriggerId: setLabelledBy,\n menuId,\n triggerRef,\n triggerElement,\n setTriggerElement,\n parent,\n checked,\n persistOnItemClick,\n isSubmenu,\n requestClose,\n closeChain,\n registerOpenSubmenu,\n listContainsFocus,\n openDelay,\n closeDelay,\n dismiss,\n isHoverFocusing,\n isHoverOpen,\n isHoverClose,\n hoverTriggerHandlers,\n hoverSurfaceHandlers,\n openOnContext: contextMode,\n contextTriggerHandlers,\n contextSurfaceHandlers,\n contextAnchor,\n fromContext,\n contextOpener,\n }),\n [\n popup,\n open,\n setOpen,\n openWithFocus,\n takeInitialFocus,\n registerSurface,\n triggerId,\n labelledBy,\n menuId,\n triggerElement,\n setTriggerElement,\n parent,\n checked,\n persistOnItemClick,\n isSubmenu,\n requestClose,\n closeChain,\n registerOpenSubmenu,\n listContainsFocus,\n openDelay,\n closeDelay,\n dismiss,\n isHoverFocusing,\n isHoverOpen,\n isHoverClose,\n hoverTriggerHandlers,\n hoverSurfaceHandlers,\n contextMode,\n contextTriggerHandlers,\n contextSurfaceHandlers,\n contextAnchor,\n fromContext,\n contextOpener,\n ],\n );\n\n // Static menu: roving tab stop over the items (the last focused one keeps it).\n const {\n containerProps: { ref: rovingRef },\n handleKeyDown: rovingKeyDown,\n handleKeyDownCapture: rovingKeyDownCapture,\n handleFocus: rovingFocus,\n focusFirst,\n getTabIndex,\n } = useRovingTabIndex({\n orientation: 'vertical',\n loop: true,\n typeahead: true,\n tabStop: 'last-focused',\n manageTabIndex: true,\n itemSelector: MENU_ITEM_SELECTOR,\n });\n const mergedRef = useMergedRefs<HTMLDivElement>(ref, rovingRef, staticMenuRef);\n\n // Disabled items never hold the tab stop, so with no enabled item the static menu itself does:\n // Tab still reaches it and a screen reader announces it. Checked whenever the roving hook's tab\n // stop changes (`getTabIndex` changes with it: an item enabled, disabled, added or removed), and\n // after it is stamped (this effect runs after the hook's).\n const [menuIsTabStop, setMenuIsTabStop] = React.useState(false);\n React.useLayoutEffect(() => {\n const menu = staticMenuRef.current;\n if (popup || !menu) return;\n const noItemTabStop = getFirstTabbable(menu) === null;\n if (noItemTabStop === menuIsTabStop) return;\n setMenuIsTabStop(noItemTabStop);\n // An item became enabled while the menu itself had focus: focus moves on to it, rather than\n // staying on an element that is no longer focusable.\n if (!noItemTabStop && menu.ownerDocument.activeElement === menu) focusFirst();\n }, [popup, menuIsTabStop, focusFirst, getTabIndex]);\n\n // The static menu is a menu list: its items close nothing when activated, and the item under\n // the mouse takes focus while focus is inside the menu tree.\n const registerCheckable = useCheckableRegistry();\n const {\n hoverGroup,\n isHoverFocusing: isListHoverFocusing,\n onPointerMove: listPointerMove,\n } = useMenuListPointer(contextValue);\n const listContext = React.useMemo<MenuListContextValue>(\n () => ({\n menu: contextValue,\n isStatic: true,\n portalDepth,\n closeFromItem: noop,\n registerCheckable,\n hoverGroup,\n isHoverFocusing: isListHoverFocusing,\n }),\n [contextValue, portalDepth, registerCheckable, hoverGroup, isListHoverFocusing],\n );\n\n if (popup) {\n return <MenuContext.Provider value={contextValue}>{children}</MenuContext.Provider>;\n }\n\n return (\n <MenuContext.Provider value={contextValue}>\n <MenuListContext.Provider value={listContext}>\n <div\n role=\"menu\"\n {...rest}\n ref={mergedRef}\n tabIndex={rest.tabIndex ?? (menuIsTabStop ? 0 : undefined)}\n data-roving-container=\"\"\n onKeyDown={composeEventHandlers(onKeyDown, rovingKeyDown)}\n onKeyDownCapture={withTypeaheadText(\n composeEventHandlers(onKeyDownCapture, rovingKeyDownCapture),\n )}\n onFocus={composeEventHandlers(onFocus, rovingFocus, { checkDefaultPrevented: false })}\n onPointerMove={composeEventHandlers(onPointerMove, listPointerMove)}\n className={cn(menuSurfaceClasses, focusRing, className)}\n >\n {children}\n </div>\n </MenuListContext.Provider>\n </MenuContext.Provider>\n );\n};\nMenuRoot.displayName = 'Menu';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAoIA,IAAMG,WAAa,CAAC,GAGdC,KAAiB;AAOvB,SAAgBC,GAAc,GAAoC;CAChE,OAAOC,EAAgBC,CAAQ,CAAC,CAAC,MAAM,EAAE,cACvCC,EAAgBC,GAAMC,GAAaC,CAAW,CAChD;AACF;AAGA,SAASC,GAAU,GAAyB;CAC1C,IAAMC,IAASC,EAAM,KAAK,MAAS,KAAKC,EAAK,GAAG;CAChD,OAAOF,EAAO,SAAS,IACnB,GAAGA,EAAO,MAAM,GAAG,EAAE,CAAC,CAAC,KAAK,IAAI,EAAE,OAAOA,EAAOA,EAAO,SAAS,OAChEA,EAAO,KAAK,EAAE;AACpB;AAIA,IAAaG,KAAY,EACvB,aACA,MAAMC,GACN,gBACA,iBACA,kBACA,0BACA,0BACA,oBAAoBC,IACpB,aAAaC,GACb,WAAWC,IACX,YAAYC,IACZ,eAAeC,IACf,eACA,eACA,sBACA,aACA,mBACA,SACA,GAAGC,QACY;CAGf,IAAMC,IAAOC,GAAmB,GAC1BC,IAAcxB,EAAM,WAAWyB,EAAkB,GACjDC,IAAaJ,MAAS,QAAQA,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