@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,127 @@
1
+ "use client";
2
+ import { cn as e } from "../../lib/cn.mjs";
3
+ import { warnOnce as t } from "../../lib/dev.mjs";
4
+ import { materialiseSlotContent as n, renderSlot as r, slotRendersContent as i } from "../../lib/slot.mjs";
5
+ import { ChevronRightIcon as a } from "../../lib/icons.mjs";
6
+ import { isOwnEvent as o } from "../../lib/events.mjs";
7
+ import { MenuSubmenuTriggerContext as s, useMenuListContext as c, useOptionalMenuContext as l } from "./Menu.context.mjs";
8
+ import { menuItemClasses as u } from "./Menu.shared.mjs";
9
+ import * as d from "react";
10
+ import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
11
+ //#region src/components/navigation/Menu.items.tsx
12
+ function h(e) {
13
+ return e === "checkmark" ? /* @__PURE__ */ p("span", {
14
+ "aria-hidden": "true",
15
+ "data-menu-column-space": "checkmark",
16
+ className: "hidden w-4 shrink-0 group-has-[[data-menu-checkmark]]/menu:inline-flex"
17
+ }) : /* @__PURE__ */ p("span", {
18
+ "aria-hidden": "true",
19
+ "data-menu-column-space": "icon",
20
+ className: "hidden h-5 w-5 shrink-0 group-has-[[data-menu-icon]]/menu:inline-flex"
21
+ });
22
+ }
23
+ function g({ checkmark: e, icon: t, label: a, shortcut: o, end: s, markLabel: c = !0 }) {
24
+ let l = i(a), u = t && i(t) ? r(t, "span", "flex h-5 w-5 shrink-0 items-center justify-center", {
25
+ "aria-hidden": !0,
26
+ "data-menu-icon": ""
27
+ }) : null;
28
+ return /* @__PURE__ */ m(f, { children: [
29
+ e === void 0 ? l && h("checkmark") : /* @__PURE__ */ p("span", {
30
+ "aria-hidden": "true",
31
+ "data-menu-checkmark": "",
32
+ className: "inline-flex w-4 shrink-0 items-center justify-center",
33
+ children: e
34
+ }),
35
+ u ?? (l && h("icon")),
36
+ /* @__PURE__ */ p("span", {
37
+ className: "flex-1",
38
+ "data-menu-label": c && l && typeof a != "string" ? "" : void 0,
39
+ children: n(a)
40
+ }),
41
+ o && /* @__PURE__ */ p("span", {
42
+ dir: "auto",
43
+ className: "ms-4 text-caption-1 text-muted-foreground",
44
+ children: o
45
+ }),
46
+ s
47
+ ] });
48
+ }
49
+ g.displayName = "MenuItemRow";
50
+ function _() {
51
+ return /* @__PURE__ */ m(f, { children: [h("checkmark"), h("icon")] });
52
+ }
53
+ _.displayName = "MenuColumnSpacers";
54
+ function v({ disabled: e, persistOnClick: t, onClick: n, onKeyDown: r, onActivate: i, keepOpenOnSpace: a = !1, nativeEnter: s = !1, hasSubmenu: l = !1 }) {
55
+ let u = c(), f = d.useRef(!1);
56
+ return {
57
+ onClick: (r) => {
58
+ let s = o(r);
59
+ if (e) {
60
+ s && r.preventDefault();
61
+ return;
62
+ }
63
+ n?.(r), s && !r.defaultPrevented && (i?.(r), !(r.defaultPrevented || l) && (a && f.current || (t ?? u?.menu.persistOnItemClick ?? !1) || u?.closeFromItem()));
64
+ },
65
+ onKeyDown: (t) => {
66
+ if (r?.(t), !t.defaultPrevented && o(t) && (t.key === "Enter" || t.key === " ") && !(t.key === "Enter" && s) && !(t.ctrlKey || t.altKey || t.metaKey) && (t.preventDefault(), !e)) {
67
+ f.current = t.key === " ";
68
+ try {
69
+ t.currentTarget.click();
70
+ } finally {
71
+ f.current = !1;
72
+ }
73
+ }
74
+ }
75
+ };
76
+ }
77
+ function y(e) {
78
+ let n = c(), r = l(), i = r !== null && r.popup && n === null;
79
+ d.useEffect(() => {
80
+ i && t("Menu:item-outside-popover", `${e}: rendered in a popup menu outside Menu.Popover, so it has no \`role="menu"\` parent. A Menu with \`open\`, \`defaultOpen\` or \`onOpenChange\` is a popup menu that renders no element of its own: put the items in Menu.Popover, or leave these props out for a static menu.`);
81
+ }, [i, e]);
82
+ }
83
+ var b = ({ icon: t, shortcut: n, disabled: r = !1, persistOnClick: i, onClick: o, onKeyDown: c, children: l, className: f, ref: m, ...h }) => {
84
+ let _ = d.useContext(s);
85
+ y("Menu.Item");
86
+ let b = typeof l == "string" ? l : void 0, x = h["data-roving-text"] !== void 0, S = v({
87
+ disabled: r,
88
+ persistOnClick: i,
89
+ onClick: o,
90
+ onKeyDown: c,
91
+ hasSubmenu: _
92
+ });
93
+ return /* @__PURE__ */ p("div", {
94
+ role: "menuitem",
95
+ "data-roving-text": b,
96
+ ...h,
97
+ ref: m,
98
+ "aria-disabled": r ? !0 : h["aria-disabled"],
99
+ "data-disabled": r ? "" : void 0,
100
+ "data-has-submenu": _ ? "" : void 0,
101
+ onClick: S.onClick,
102
+ onKeyDown: S.onKeyDown,
103
+ className: e(u, f),
104
+ children: /* @__PURE__ */ p(g, {
105
+ icon: t,
106
+ label: l,
107
+ shortcut: n,
108
+ markLabel: !x,
109
+ end: _ ? /* @__PURE__ */ p(a, {
110
+ size: 16,
111
+ className: "ms-auto shrink-0 wave-rtl:-scale-x-100"
112
+ }) : void 0
113
+ })
114
+ });
115
+ };
116
+ b.displayName = "MenuItem";
117
+ var x = ({ className: t, ref: n, ...r }) => /* @__PURE__ */ p("div", {
118
+ role: "separator",
119
+ ...r,
120
+ ref: n,
121
+ className: e("my-1 border-t border-border", t)
122
+ });
123
+ x.displayName = "MenuDivider";
124
+ //#endregion
125
+ export { _ as MenuColumnSpacers, x as MenuDivider, b as MenuItem, g as MenuItemRow, v as useMenuItemActivation, y as useMenuItemPlacementWarning };
126
+
127
+ //# sourceMappingURL=Menu.items.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Menu.items.mjs","names":["_Fragment","React","renderColumnSpace","column","MenuItemRow","hasLabel","slotRendersContent","label","iconNode","icon","renderSlot","Fragment","checkmark","markLabel","materialiseSlotContent","shortcut","end","MenuColumnSpacers","useMenuItemActivation","list","useMenuListContext","clickFromSpaceRef","own","isOwnEvent","event","disabled","onClick","onActivate","hasSubmenu","keepOpenOnSpace","persistOnClick","onKeyDown","nativeEnter","useMenuItemPlacementWarning","menu","useOptionalMenuContext","outsidePopover","warnOnce","componentName","MenuItem","rest","isSubmenuTrigger","MenuSubmenuTriggerContext","stringLabel","children","ownRovingText","activation","cn","menuItemClasses","className","ChevronRightIcon","MenuDivider"],"sources":["../../../src/components/navigation/Menu.items.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport type { Slot } from '../../lib/types';\nimport { materialiseSlotContent, renderSlot, slotRendersContent } from '../../lib/slot';\nimport { warnOnce } from '../../lib/dev';\nimport { isOwnEvent } from '../../lib/events';\nimport { ChevronRightIcon } from '../../lib/icons';\nimport {\n MenuSubmenuTriggerContext,\n useMenuListContext,\n useOptionalMenuContext,\n} from './Menu.context';\nimport { menuItemClasses } from './Menu.shared';\n\n/** Properties for the MenuItem sub-component. */\nexport interface MenuItemProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Slot for an icon displayed before the item text. Rendered with `aria-hidden=\"true\"`. A falsy\n * icon (`''`, `0`) or a list of nothing renders no icon box.\n */\n icon?: Slot<'span'>;\n /**\n * Keyboard shortcut text displayed at the end of the item. Its direction comes from its own text\n * (`dir=\"auto\"`), so \"Ctrl+,\" keeps its order in an RTL menu.\n */\n shortcut?: string;\n /** Whether the menu item is disabled (`aria-disabled`; skipped by keyboard navigation). */\n disabled?: boolean;\n /**\n * Keep a popup menu open after this item is activated. `true` or `false` here wins over the\n * Menu's `persistOnItemClick`.\n * @default the Menu's `persistOnItemClick` (`false`)\n */\n persistOnClick?: boolean;\n /**\n * Label content of the menu item. Leave it out only for the submenu half of a\n * `Menu.SplitGroup`, which then needs `aria-label`.\n */\n children?: React.ReactNode;\n /**\n * Ref to the item element (`role=\"menuitem\"`; `menuitemcheckbox` or `menuitemradio` for the\n * checkable items).\n */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/** Properties for the MenuDivider sub-component. */\nexport interface MenuDividerProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Ref to the `role=\"separator\"` element. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n// ---------------------------------------------------------------------------\n// The item row and the column alignment\n// ---------------------------------------------------------------------------\n\n/** Internal: the content of one menu item row, rendered inside the item element. */\nexport interface MenuItemRowProps {\n /**\n * Checkable items: the checkmark column's content (the glyph, or `null` while unchecked); the\n * column renders in both states, marked `data-menu-checkmark`. `undefined` for other items,\n * which render a hidden placeholder instead.\n */\n checkmark?: React.ReactNode | null;\n /** The icon slot (a falsy icon or a list of nothing is no icon). */\n icon?: Slot<'span'>;\n /** The label (typeahead reads a non-string label through its `data-menu-label` element). */\n label: React.ReactNode;\n /** The shortcut text (rendered with `dir=\"auto\"`). */\n shortcut?: string;\n /** Content at the row's end: the submenu chevron or a switch. */\n end?: React.ReactNode;\n /**\n * Whether a non-string label is marked `data-menu-label` for typeahead. Pass `false` when the\n * item carries its own `data-roving-text`, which the label's text must not replace.\n * @default true\n */\n markLabel?: boolean;\n}\n\n/**\n * The placeholder of the checkmark or the icon column: hidden, and shown as soon as any item of\n * the same menu list (the `group/menu` element) renders that column, so every label starts at the\n * same place. Decorative (`aria-hidden`).\n */\nfunction renderColumnSpace(column: 'checkmark' | 'icon'): React.ReactElement {\n return column === 'checkmark' ? (\n <span\n aria-hidden=\"true\"\n data-menu-column-space=\"checkmark\"\n className=\"hidden w-4 shrink-0 group-has-[[data-menu-checkmark]]/menu:inline-flex\"\n />\n ) : (\n <span\n aria-hidden=\"true\"\n data-menu-column-space=\"icon\"\n className=\"hidden h-5 w-5 shrink-0 group-has-[[data-menu-icon]]/menu:inline-flex\"\n />\n );\n}\n\n/**\n * Internal: one menu item row, in DOM order (RTL mirrors it): the checkmark column, the icon\n * column, the label, the shortcut and the end content. A row without a checkmark or an icon\n * renders the column's placeholder instead; a row whose label renders nothing (the icon-only\n * submenu half of a split group) renders no placeholders.\n */\nexport function MenuItemRow({\n checkmark,\n icon,\n label,\n shortcut,\n end,\n markLabel = true,\n}: MenuItemRowProps): React.ReactElement {\n // The check does not consume a one-shot iterable label: it is rendered materialised.\n const hasLabel = slotRendersContent(label);\n // A falsy icon (`icon={name && <Icon />}` with `name` '' or a count of 0) is no icon, as in Nav,\n // Tree and Avatar, and so is a collection whose items render nothing: no empty 20px box before\n // the label. The check does not consume a generator: renderSlot still renders its items.\n const iconNode =\n icon && slotRendersContent(icon)\n ? renderSlot(icon, 'span', 'flex h-5 w-5 shrink-0 items-center justify-center', {\n 'aria-hidden': true,\n 'data-menu-icon': '',\n })\n : null;\n\n return (\n <>\n {checkmark !== undefined ? (\n <span\n aria-hidden=\"true\"\n data-menu-checkmark=\"\"\n className=\"inline-flex w-4 shrink-0 items-center justify-center\"\n >\n {checkmark}\n </span>\n ) : (\n hasLabel && renderColumnSpace('checkmark')\n )}\n {iconNode ?? (hasLabel && renderColumnSpace('icon'))}\n <span\n className=\"flex-1\"\n data-menu-label={markLabel && hasLabel && typeof label !== 'string' ? '' : undefined}\n >\n {materialiseSlotContent(label)}\n </span>\n {/* The shortcut takes its direction from its own text (`dir=\"auto\"` also isolates it): in an\n RTL menu, \"Ctrl+,\" would otherwise be reordered to \",+Ctrl\". */}\n {shortcut && (\n <span dir=\"auto\" className=\"ms-4 text-caption-1 text-muted-foreground\">\n {shortcut}\n </span>\n )}\n {end}\n </>\n );\n}\nMenuItemRow.displayName = 'MenuItemRow';\n\n/** Internal: the two column placeholders alone, for a row that is not an item (a group header). */\nexport function MenuColumnSpacers(): React.ReactElement {\n return (\n <>\n {renderColumnSpace('checkmark')}\n {renderColumnSpace('icon')}\n </>\n );\n}\nMenuColumnSpacers.displayName = 'MenuColumnSpacers';\n\n// ---------------------------------------------------------------------------\n// Item activation\n// ---------------------------------------------------------------------------\n\n/** Internal: the activation of every menu item kind. */\nexport interface MenuItemActivationOptions {\n disabled: boolean;\n /**\n * The item's own `persistOnClick`; `undefined` falls back to the Menu's `persistOnItemClick`.\n * A link item passes `false` (a link always closes).\n */\n persistOnClick: boolean | undefined;\n /** The consumer's handlers, composed consumer first (C-COMPOSE). */\n onClick?: React.MouseEventHandler<HTMLElement>;\n onKeyDown?: React.KeyboardEventHandler<HTMLElement>;\n /**\n * Runs on an own, enabled click after the consumer's `onClick`, unless it prevented the default.\n * Its own `preventDefault()` keeps the menu open.\n */\n onActivate?: (event: React.MouseEvent<HTMLElement>) => void;\n /** Space activates and keeps the menu open (checkbox, radio and switch items). */\n keepOpenOnSpace?: boolean;\n /** Enter is left to the element's native activation (links); Space still clicks. */\n nativeEnter?: boolean;\n /** The item opens a submenu: activation never closes its menu. */\n hasSubmenu?: boolean;\n}\n\n/**\n * Internal: the click and key handlers of a menu item.\n *\n * - Events from a portal opened inside the item (a Popover, a Dialog) reach the consumer's\n * handlers, as React bubbles them, but never activate the item or close the menu.\n * - A disabled item calls no `onClick` and prevents its own click; its Enter and Space are still\n * consumed.\n * - Enter and Space are consumed (no page scroll) and click the item; with Ctrl, Alt or Meta they\n * are left to the page. A Space that continues a typeahead search is skipped (the roving\n * capture handler prevented it). With `nativeEnter`, Enter is left to the element.\n * - After the consumer's `onClick` and `onActivate`, the item closes its menu through the list's\n * `closeFromItem`, unless the click was not its own, its default was prevented, `hasSubmenu` is\n * set, `keepOpenOnSpace` is set and Space caused the click, or\n * `persistOnClick ?? menu.persistOnItemClick` is `true`.\n */\nexport function useMenuItemActivation({\n disabled,\n persistOnClick,\n onClick,\n onKeyDown,\n onActivate,\n keepOpenOnSpace = false,\n nativeEnter = false,\n hasSubmenu = false,\n}: MenuItemActivationOptions): {\n onClick: React.MouseEventHandler<HTMLElement>;\n onKeyDown: React.KeyboardEventHandler<HTMLElement>;\n} {\n const list = useMenuListContext();\n // Set while the key handler's click runs, so the click knows that Space caused it.\n const clickFromSpaceRef = React.useRef(false);\n\n const handleClick = (event: React.MouseEvent<HTMLElement>) => {\n // A click inside a portal opened from the item reaches the consumer's onClick (React bubbles\n // it), but is not a click on the item: it never activates the item or closes the menu. A\n // disabled item calls no onClick, as a disabled button; a portal's click keeps its default.\n const own = isOwnEvent(event);\n if (disabled) {\n if (own) event.preventDefault();\n return;\n }\n onClick?.(event);\n if (!own || event.defaultPrevented) return;\n onActivate?.(event);\n if (event.defaultPrevented || hasSubmenu) return;\n if (keepOpenOnSpace && clickFromSpaceRef.current) return;\n if (persistOnClick ?? list?.menu.persistOnItemClick ?? false) return;\n list?.closeFromItem();\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLElement>) => {\n // C-COMPOSE: the consumer's onKeyDown runs first; preventDefault() skips the built-in keys.\n onKeyDown?.(event);\n if (event.defaultPrevented) return;\n // Enter and Space typed in a portal opened from the item belong to that portal.\n if (!isOwnEvent(event)) return;\n if (event.key !== 'Enter' && event.key !== ' ') return;\n // A link follows itself on Enter (Shift, Ctrl and Meta keep opening a new window or tab).\n if (event.key === 'Enter' && nativeEnter) return;\n // With Ctrl, Alt or Meta (Ctrl+Alt+Space included) the key is a shortcut, left to the page.\n if (event.ctrlKey || event.altKey || event.metaKey) return;\n // Menu items consume Enter/Space (no page scroll), whether or not they can be activated.\n event.preventDefault();\n if (disabled) return;\n clickFromSpaceRef.current = event.key === ' ';\n try {\n event.currentTarget.click();\n } finally {\n clickFromSpaceRef.current = false;\n }\n };\n\n return { onClick: handleClick, onKeyDown: handleKeyDown };\n}\n\n/**\n * Internal (C-DEV): warns once, from an effect, when an item of any kind renders in a popup menu\n * outside `Menu.Popover`. A Menu with `open`, `defaultOpen` or `onOpenChange` is a popup menu that\n * renders no element of its own, so such an item has no `role=\"menu\"` parent.\n *\n * @param componentName The item's name in the message, e.g. `'Menu.ItemCheckbox'`.\n */\nexport function useMenuItemPlacementWarning(componentName: string): void {\n const list = useMenuListContext();\n const menu = useOptionalMenuContext();\n const outsidePopover = menu !== null && menu.popup && list === null;\n React.useEffect(() => {\n if (!outsidePopover) return;\n warnOnce(\n 'Menu:item-outside-popover',\n `${componentName}: rendered in a popup menu outside Menu.Popover, so it has no \\`role=\"menu\"\\` parent. A Menu with \\`open\\`, \\`defaultOpen\\` or \\`onOpenChange\\` is a popup menu that renders no element of its own: put the items in Menu.Popover, or leave these props out for a static menu.`,\n );\n }, [outsidePopover, componentName]);\n}\n\n// ---------------------------------------------------------------------------\n// Menu.Item / Menu.Divider\n// ---------------------------------------------------------------------------\n\n/**\n * An action in a menu (`role=\"menuitem\"`). Enter and Space activate it (a Space typed within 500 ms\n * of a typeahead character continues the search instead; with Ctrl, Alt or Meta they are left to\n * the page); in a popup menu, activation closes the menu and returns focus to the trigger unless\n * `persistOnClick` (or the Menu's `persistOnItemClick`) keeps it open or the consumer's `onClick`\n * calls `preventDefault()`. Disabled items are `aria-disabled`, skipped by keyboard navigation and\n * never activated: their `onClick` is not called. A consumer `aria-disabled` without `disabled`\n * only changes the look and keyboard navigation: activation still runs `onClick` (guard it\n * yourself), as on Button. The item's tab index is managed by the menu. Typeahead matches the\n * label (`children`), not the icon or the shortcut; a `data-roving-text` you pass replaces the\n * label's text. Clicks and keys from a portal opened inside the item (a Popover, a Dialog) still\n * reach your `onClick` (on an enabled item) and `onKeyDown`, as React bubbles them, but never\n * activate the item or close the menu.\n *\n * The labels of a menu line up: when any item of the menu shows an icon (or a check), every item\n * keeps an empty column of that width before its label.\n *\n * As the child of a submenu's `Menu.Trigger` (a `Menu` nested in a menu list), the item is the\n * submenu's trigger: it shows a chevron at its end (mirrored in RTL) and `data-has-submenu`, and\n * activating it never closes its own menu. ArrowRight (ArrowLeft in RTL), Enter, Space and a click\n * open the submenu and move focus to its first item; resting the mouse on the item opens it\n * without moving focus.\n *\n * Also exported as `MenuItem` (import the flat name from React Server Components).\n */\nexport const MenuItem = ({\n icon,\n shortcut,\n disabled = false,\n persistOnClick,\n onClick,\n onKeyDown,\n children,\n className,\n ref,\n ...rest\n}: MenuItemProps) => {\n const isSubmenuTrigger = React.useContext(MenuSubmenuTriggerContext);\n useMenuItemPlacementWarning('Menu.Item');\n\n // Typeahead text: a string label directly; any other label through its marked element.\n const stringLabel = typeof children === 'string' ? children : undefined;\n const ownRovingText = (rest as Record<string, unknown>)['data-roving-text'] !== undefined;\n\n // A submenu trigger item opens its submenu (the trigger's composed onClick): activating it never\n // closes its own menu.\n const activation = useMenuItemActivation({\n disabled,\n persistOnClick,\n onClick,\n onKeyDown,\n hasSubmenu: isSubmenuTrigger,\n });\n\n return (\n <div\n role=\"menuitem\"\n data-roving-text={stringLabel}\n {...rest}\n ref={ref}\n aria-disabled={disabled ? true : rest['aria-disabled']}\n data-disabled={disabled ? '' : undefined}\n data-has-submenu={isSubmenuTrigger ? '' : undefined}\n onClick={activation.onClick}\n onKeyDown={activation.onKeyDown}\n className={cn(menuItemClasses, className)}\n >\n <MenuItemRow\n icon={icon}\n label={children}\n shortcut={shortcut}\n markLabel={!ownRovingText}\n end={\n isSubmenuTrigger ? (\n <ChevronRightIcon size={16} className=\"ms-auto shrink-0 wave-rtl:-scale-x-100\" />\n ) : undefined\n }\n />\n </div>\n );\n};\nMenuItem.displayName = 'MenuItem';\n\n/**\n * A separator between groups of menu items (`role=\"separator\"`).\n *\n * Also exported as `MenuDivider` (import the flat name from React Server Components).\n */\nexport const MenuDivider = ({ className, ref, ...rest }: MenuDividerProps) => {\n return (\n <div\n role=\"separator\"\n {...rest}\n ref={ref}\n className={cn('my-1 border-t border-border', className)}\n />\n );\n};\nMenuDivider.displayName = 'MenuDivider';\n"],"mappings":";;;;;;;;;;;AAqFA,SAASE,EAAkB,GAAkD;CAC3E,OAAOC,MAAW,cAChB,kBAAC,QAAD;EACE,eAAY;EACZ,0BAAuB;EACvB,WAAU;CACX,CAAA,IAED,kBAAC,QAAD;EACE,eAAY;EACZ,0BAAuB;EACvB,WAAU;CACX,CAAA;AAEL;AAQA,SAAgBC,EAAY,EAC1B,cACA,SACA,UACA,aACA,QACA,eAAY,MAC2B;CAEvC,IAAMC,IAAWC,EAAmBC,CAAK,GAInCC,IACJC,KAAQH,EAAmBG,CAAI,IAC3BC,EAAWD,GAAM,QAAQ,qDAAqD;EAC5E,eAAe;EACf,kBAAkB;CACpB,CAAC,IACD;CAEN,OACE,kBAAAT,GAAA,EAAA,UAAA;EACGY,MAAc,KAAA,IASbP,KAAYH,EAAkB,WAAW,IARzC,kBAAC,QAAD;GACE,eAAY;GACZ,uBAAoB;GACpB,WAAU;GAET,UAAAU;EACG,CAAA;EAIPJ,MAAaH,KAAYH,EAAkB,MAAM;EAClD,kBAAC,QAAD;GACE,WAAU;GACV,mBAAiBW,KAAaR,KAAY,OAAOE,KAAU,WAAW,KAAK,KAAA;GAE1E,UAAAO,EAAuBP,CAAK;EACzB,CAAA;EAGLQ,KACC,kBAAC,QAAD;GAAM,KAAI;GAAO,WAAU;GACxB,UAAAA;EACG,CAAA;EAEPC;CACD,EAAA,CAAA;AAEN;AACA,EAAY,cAAc;AAG1B,SAAgBC,IAAwC;CACtD,OACE,kBAAAjB,GAAA,EAAA,UAAA,CACGE,EAAkB,WAAW,GAC7BA,EAAkB,MAAM,CACzB,EAAA,CAAA;AAEN;AACA,EAAkB,cAAc;AA6ChC,SAAgBgB,EAAsB,EACpC,aACA,mBACA,YACA,cACA,eACA,qBAAkB,IAClB,iBAAc,IACd,gBAAa,MAIb;CACA,IAAMC,IAAOC,EAAmB,GAE1BC,IAAoBpB,EAAM,OAAO,EAAK;CA0C5C,OAAO;EAAE,UAxCY,MAAyC;GAI5D,IAAMqB,IAAMC,EAAWC,CAAK;GAC5B,IAAIC,GAAU;IACZ,AAAIH,KAAKE,EAAM,eAAe;IAC9B;GACF;GAEA,AADAE,IAAUF,CAAK,GACVF,KAAO,GAAM,qBAClBK,IAAaH,CAAK,GACd,IAAM,oBAAoBI,OAC1BC,KAAmBR,EAAkB,YACrCS,KAAkBX,GAAM,KAAK,sBAAsB,OACvDA,GAAM,cAAc;EACtB;EAwB+B,YAtBR,MAA4C;GAGjE,IADAY,IAAYP,CAAK,GACb,GAAM,oBAELD,EAAWC,CAAK,MACjBA,EAAM,QAAQ,WAAWA,EAAM,QAAQ,QAEvC,IAAM,QAAQ,WAAWQ,MAEzB,IAAM,WAAWR,EAAM,UAAUA,EAAM,aAE3CA,EAAM,eAAe,GACjB,KACJ;MAAkB,UAAUA,EAAM,QAAQ;IAC1C,IAAI;KACF,EAAM,cAAc,MAAM;IAC5B,UAAU;KACR,EAAkB,UAAU;IAC9B;GAL0C;EAM5C;CAEwD;AAC1D;AASA,SAAgBS,EAA4B,GAA6B;CACvE,IAAMd,IAAOC,EAAmB,GAC1Bc,IAAOC,EAAuB,GAC9BC,IAAiBF,MAAS,QAAQA,EAAK,SAASf,MAAS;CAC/D,EAAM,gBAAgB;EACpB,AAAKiB,KACLC,EACE,6BACA,GAAGC,EAAc,+QACnB;CACF,GAAG,CAACF,GAAgBE,CAAa,CAAC;AACpC;AA+BA,IAAaC,KAAY,EACvB,SACA,aACA,cAAW,IACX,mBACA,YACA,cACA,aACA,cACA,QACA,GAAGC,QACgB;CACnB,IAAMC,IAAmBxC,EAAM,WAAWyC,CAAyB;CACnE,EAA4B,WAAW;CAGvC,IAAMC,IAAc,OAAOC,KAAa,WAAWA,IAAW,KAAA,GACxDC,IAAiBL,EAAiC,wBAAwB,KAAA,GAI1EM,IAAa5B,EAAsB;EACvC;EACA;EACA;EACA;EACA,YAAYuB;CACd,CAAC;CAED,OACE,kBAAC,OAAD;EACE,MAAK;EACL,oBAAkBE;EAClB,GAAIH;EACC;EACL,iBAAef,IAAW,KAAOe,EAAK;EACtC,iBAAef,IAAW,KAAK,KAAA;EAC/B,oBAAkBgB,IAAmB,KAAK,KAAA;EAC1C,SAASK,EAAW;EACpB,WAAWA,EAAW;EACtB,WAAWC,EAAGC,GAAiBC,CAAS;EAExC,UAAA,kBAAC7C,GAAD;GACQ;GACN,OAAOwC;GACG;GACV,WAAW,CAACC;GACZ,KACEJ,IACE,kBAACS,GAAD;IAAkB,MAAM;IAAI,WAAU;GAA0C,CAAA,IAC9E,KAAA;EAEP,CAAA;CACE,CAAA;AAET;AACA,EAAS,cAAc;AAOvB,IAAaC,KAAe,EAAE,cAAW,QAAK,GAAGX,QAE7C,kBAAC,OAAD;CACE,MAAK;CACL,GAAIA;CACC;CACL,WAAWO,EAAG,+BAA+BE,CAAS;AACvD,CAAA;AAGL,EAAY,cAAc"}
@@ -0,0 +1,2 @@
1
+ "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("./Menu.shared.cjs"),r=require("./Menu.items.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("react/jsx-runtime");var o=e=>{let{as:i,icon:o,shortcut:s,disabled:c=!1,children:l,className:u,onClick:d,onKeyDown:f,ref:p,...m}=e,h=i??`a`;r.useMenuItemPlacementWarning(`Menu.ItemLink`);let g=r.useMenuItemActivation({disabled:c,persistOnClick:!1,onClick:d,onKeyDown:f,nativeEnter:!0}),_=typeof l==`string`?l:void 0,v=m[`data-roving-text`]!==void 0,y=c&&typeof h==`string`?{href:void 0}:null;return(0,a.jsx)(h,{role:`menuitem`,"data-roving-text":_,...m,...y,ref:p,"aria-disabled":c?!0:m[`aria-disabled`],"data-disabled":c?``:void 0,onClick:g.onClick,onKeyDown:g.onKeyDown,className:t.cn(n.menuItemClasses,`text-foreground no-underline`,u),children:(0,a.jsx)(r.MenuItemRow,{icon:o,label:l,shortcut:s,markLabel:!v})})};o.displayName=`MenuItemLink`,exports.MenuItemLink=o;
2
+ //# sourceMappingURL=Menu.link.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Menu.link.cjs","names":["useMenuItemActivation","cn","menuItemClasses","MenuItemRow","require_runtime","require_cn","require_Menu_shared","require_Menu_items","react","react_jsx_runtime","MenuItemLink","rest","props","Component","as","activation","stringLabel","children","ownRovingText","disabledHref","disabled","className"],"sources":["../../../src/components/navigation/Menu.link.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport type { PolymorphicComponent, PolymorphicProps } from '../../lib/polymorphic';\nimport type { Slot } from '../../lib/types';\nimport { MenuItemRow, useMenuItemActivation, useMenuItemPlacementWarning } from './Menu.items';\nimport { menuItemClasses } from './Menu.shared';\n\n/** The MenuItemLink's own props (the XOwnProps rule: component-specific props only). */\nexport interface MenuItemLinkOwnProps {\n /** Icon before the label (decorative); the rules of `Menu.Item.icon`. */\n icon?: Slot<'span'>;\n /** Keyboard shortcut text at the end of the item; the rules of `Menu.Item.shortcut`. */\n shortcut?: string;\n /**\n * Unavailable: `aria-disabled`, skipped by the arrow keys, never activated, and its click is\n * cancelled (`preventDefault()`, which router links respect). On the default `'a'` the `href`\n * is removed too, so it cannot navigate at all; with `as` (a router link) the component's own\n * `to` still renders an `href`, so middle click or \"open in new tab\" can still follow it:\n * render a disabled router link without its target.\n * @default false\n */\n disabled?: boolean;\n /** Label of the link. */\n children: React.ReactNode;\n}\n\n/** Props of {@link MenuItemLink} rendered as `C` (default `'a'`, or a router link component). */\nexport type MenuItemLinkProps<C extends React.ElementType = 'a'> = PolymorphicProps<\n C,\n MenuItemLinkOwnProps\n>;\n\n/** The props the implementation reads, for any `as`. */\ntype MenuItemLinkImplProps = MenuItemLinkOwnProps &\n Omit<React.HTMLAttributes<HTMLElement>, 'onClick' | 'onKeyDown' | 'children'> & {\n as?: React.ElementType;\n ref?: React.Ref<HTMLElement>;\n onClick?: React.MouseEventHandler<HTMLElement>;\n onKeyDown?: React.KeyboardEventHandler<HTMLElement>;\n };\n\n/**\n * A menu item that navigates (`role=\"menuitem\"` on the link element). Enter follows the link the\n * way the browser does (Shift+Enter, Ctrl+Enter and Cmd+Enter open a new window or tab), Space\n * follows it too, and every click follows it and closes a popup menu (focus returns to the\n * trigger first), a Ctrl- or Cmd-click that opens a new tab included; the Menu's\n * `persistOnItemClick` does not keep it open. Middle click and the browser's link context menu\n * keep working and close nothing. A consumer `onClick` that calls `preventDefault()` cancels the\n * navigation and keeps the menu open. In a static menu a click navigates and closes nothing. In\n * forced colors the browser draws the text in its link color (`LinkText`). Typeahead matches the\n * label (`children`). `as` takes a router link component, which must forward `ref` and spread its\n * props onto the anchor.\n *\n * Also exported as `MenuItemLink` (import the flat name from React Server Components).\n *\n * @example\n * <Menu.ItemLink href=\"/settings\">Settings</Menu.ItemLink>\n * <Menu.ItemLink as={RouterLink} to=\"/billing\">Billing</Menu.ItemLink>\n */\nexport const MenuItemLink: PolymorphicComponent<'a', MenuItemLinkOwnProps> = (props) => {\n const {\n as,\n icon,\n shortcut,\n disabled = false,\n children,\n className,\n onClick,\n onKeyDown,\n ref,\n ...rest\n } = props as MenuItemLinkImplProps;\n const Component: React.ElementType = as ?? 'a';\n useMenuItemPlacementWarning('Menu.ItemLink');\n\n // Enter is the browser's (a link keeps Shift, Ctrl and Meta for a new window or tab); Space\n // clicks it. Every activation closes the popup menu: a navigation ends the menu's job.\n const activation = useMenuItemActivation({\n disabled,\n persistOnClick: false,\n onClick,\n onKeyDown,\n nativeEnter: true,\n });\n\n // Typeahead text: a string label directly; any other label through its marked element.\n const stringLabel = typeof children === 'string' ? children : undefined;\n const ownRovingText = (rest as Record<string, unknown>)['data-roving-text'] !== undefined;\n // A disabled element link cannot navigate at all (middle click, \"open in new tab\" included); a\n // router link keeps what its own props render, and its prevented click stops it.\n const disabledHref = disabled && typeof Component === 'string' ? { href: undefined } : null;\n\n return (\n <Component\n role=\"menuitem\"\n data-roving-text={stringLabel}\n {...rest}\n {...disabledHref}\n ref={ref}\n aria-disabled={disabled ? true : rest['aria-disabled']}\n data-disabled={disabled ? '' : undefined}\n onClick={activation.onClick}\n onKeyDown={activation.onKeyDown}\n className={cn(menuItemClasses, 'text-foreground no-underline', className)}\n >\n <MenuItemRow icon={icon} label={children} shortcut={shortcut} markLabel={!ownRovingText} />\n </Component>\n );\n};\nMenuItemLink.displayName = 'MenuItemLink';\n"],"mappings":"2OA2DA,IAAaU,EAAiE,GAAU,CACtF,GAAM,CACJ,KACA,OACA,WACA,WAAW,GACX,WACA,YACA,UACA,YACA,MACA,GAAGC,GACDC,EACEC,EAA+BC,GAAM,IAC3CP,EAAA,4BAA4B,eAAe,EAI3C,IAAMQ,EAAaf,EAAAA,sBAAsB,CACvC,WACA,eAAgB,GAChB,UACA,YACA,YAAa,EACf,CAAC,EAGKgB,EAAc,OAAOC,GAAa,SAAWA,EAAW,IAAA,GACxDC,EAAiBP,EAAiC,sBAAwB,IAAA,GAG1EQ,EAAeC,GAAY,OAAOP,GAAc,SAAW,CAAE,KAAM,IAAA,EAAU,EAAI,KAEvF,OACE,EAAAJ,EAAA,IAAA,CAACI,EAAD,CACE,KAAK,WACL,mBAAkBG,EAClB,GAAIL,EACJ,GAAIQ,EACC,MACL,gBAAeC,EAAW,GAAOT,EAAK,iBACtC,gBAAeS,EAAW,GAAK,IAAA,GAC/B,QAASL,EAAW,QACpB,UAAWA,EAAW,UACtB,UAAWd,EAAAA,GAAGC,EAAAA,gBAAiB,+BAAgCmB,CAAS,EAExE,UAAA,EAAAZ,EAAA,IAAA,CAACN,EAAAA,YAAD,CAAmB,OAAM,MAAOc,EAAoB,WAAU,UAAW,CAACC,CAAgB,CAAA,CACjF,CAAA,CAEf,EACA,EAAa,YAAc"}
@@ -0,0 +1,41 @@
1
+ "use client";
2
+ import { cn as e } from "../../lib/cn.mjs";
3
+ import { menuItemClasses as t } from "./Menu.shared.mjs";
4
+ import { MenuItemRow as n, useMenuItemActivation as r, useMenuItemPlacementWarning as i } from "./Menu.items.mjs";
5
+ import "react";
6
+ import { jsx as a } from "react/jsx-runtime";
7
+ //#region src/components/navigation/Menu.link.tsx
8
+ var o = (o) => {
9
+ let { as: s, icon: c, shortcut: l, disabled: u = !1, children: d, className: f, onClick: p, onKeyDown: m, ref: h, ...g } = o, _ = s ?? "a";
10
+ i("Menu.ItemLink");
11
+ let v = r({
12
+ disabled: u,
13
+ persistOnClick: !1,
14
+ onClick: p,
15
+ onKeyDown: m,
16
+ nativeEnter: !0
17
+ }), y = typeof d == "string" ? d : void 0, b = g["data-roving-text"] !== void 0, x = u && typeof _ == "string" ? { href: void 0 } : null;
18
+ return /* @__PURE__ */ a(_, {
19
+ role: "menuitem",
20
+ "data-roving-text": y,
21
+ ...g,
22
+ ...x,
23
+ ref: h,
24
+ "aria-disabled": u ? !0 : g["aria-disabled"],
25
+ "data-disabled": u ? "" : void 0,
26
+ onClick: v.onClick,
27
+ onKeyDown: v.onKeyDown,
28
+ className: e(t, "text-foreground no-underline", f),
29
+ children: /* @__PURE__ */ a(n, {
30
+ icon: c,
31
+ label: d,
32
+ shortcut: l,
33
+ markLabel: !b
34
+ })
35
+ });
36
+ };
37
+ o.displayName = "MenuItemLink";
38
+ //#endregion
39
+ export { o as MenuItemLink };
40
+
41
+ //# sourceMappingURL=Menu.link.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Menu.link.mjs","names":["MenuItemLink","rest","props","Component","as","activation","useMenuItemActivation","stringLabel","children","ownRovingText","disabledHref","disabled","cn","menuItemClasses","className","MenuItemRow"],"sources":["../../../src/components/navigation/Menu.link.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport type { PolymorphicComponent, PolymorphicProps } from '../../lib/polymorphic';\nimport type { Slot } from '../../lib/types';\nimport { MenuItemRow, useMenuItemActivation, useMenuItemPlacementWarning } from './Menu.items';\nimport { menuItemClasses } from './Menu.shared';\n\n/** The MenuItemLink's own props (the XOwnProps rule: component-specific props only). */\nexport interface MenuItemLinkOwnProps {\n /** Icon before the label (decorative); the rules of `Menu.Item.icon`. */\n icon?: Slot<'span'>;\n /** Keyboard shortcut text at the end of the item; the rules of `Menu.Item.shortcut`. */\n shortcut?: string;\n /**\n * Unavailable: `aria-disabled`, skipped by the arrow keys, never activated, and its click is\n * cancelled (`preventDefault()`, which router links respect). On the default `'a'` the `href`\n * is removed too, so it cannot navigate at all; with `as` (a router link) the component's own\n * `to` still renders an `href`, so middle click or \"open in new tab\" can still follow it:\n * render a disabled router link without its target.\n * @default false\n */\n disabled?: boolean;\n /** Label of the link. */\n children: React.ReactNode;\n}\n\n/** Props of {@link MenuItemLink} rendered as `C` (default `'a'`, or a router link component). */\nexport type MenuItemLinkProps<C extends React.ElementType = 'a'> = PolymorphicProps<\n C,\n MenuItemLinkOwnProps\n>;\n\n/** The props the implementation reads, for any `as`. */\ntype MenuItemLinkImplProps = MenuItemLinkOwnProps &\n Omit<React.HTMLAttributes<HTMLElement>, 'onClick' | 'onKeyDown' | 'children'> & {\n as?: React.ElementType;\n ref?: React.Ref<HTMLElement>;\n onClick?: React.MouseEventHandler<HTMLElement>;\n onKeyDown?: React.KeyboardEventHandler<HTMLElement>;\n };\n\n/**\n * A menu item that navigates (`role=\"menuitem\"` on the link element). Enter follows the link the\n * way the browser does (Shift+Enter, Ctrl+Enter and Cmd+Enter open a new window or tab), Space\n * follows it too, and every click follows it and closes a popup menu (focus returns to the\n * trigger first), a Ctrl- or Cmd-click that opens a new tab included; the Menu's\n * `persistOnItemClick` does not keep it open. Middle click and the browser's link context menu\n * keep working and close nothing. A consumer `onClick` that calls `preventDefault()` cancels the\n * navigation and keeps the menu open. In a static menu a click navigates and closes nothing. In\n * forced colors the browser draws the text in its link color (`LinkText`). Typeahead matches the\n * label (`children`). `as` takes a router link component, which must forward `ref` and spread its\n * props onto the anchor.\n *\n * Also exported as `MenuItemLink` (import the flat name from React Server Components).\n *\n * @example\n * <Menu.ItemLink href=\"/settings\">Settings</Menu.ItemLink>\n * <Menu.ItemLink as={RouterLink} to=\"/billing\">Billing</Menu.ItemLink>\n */\nexport const MenuItemLink: PolymorphicComponent<'a', MenuItemLinkOwnProps> = (props) => {\n const {\n as,\n icon,\n shortcut,\n disabled = false,\n children,\n className,\n onClick,\n onKeyDown,\n ref,\n ...rest\n } = props as MenuItemLinkImplProps;\n const Component: React.ElementType = as ?? 'a';\n useMenuItemPlacementWarning('Menu.ItemLink');\n\n // Enter is the browser's (a link keeps Shift, Ctrl and Meta for a new window or tab); Space\n // clicks it. Every activation closes the popup menu: a navigation ends the menu's job.\n const activation = useMenuItemActivation({\n disabled,\n persistOnClick: false,\n onClick,\n onKeyDown,\n nativeEnter: true,\n });\n\n // Typeahead text: a string label directly; any other label through its marked element.\n const stringLabel = typeof children === 'string' ? children : undefined;\n const ownRovingText = (rest as Record<string, unknown>)['data-roving-text'] !== undefined;\n // A disabled element link cannot navigate at all (middle click, \"open in new tab\" included); a\n // router link keeps what its own props render, and its prevented click stops it.\n const disabledHref = disabled && typeof Component === 'string' ? { href: undefined } : null;\n\n return (\n <Component\n role=\"menuitem\"\n data-roving-text={stringLabel}\n {...rest}\n {...disabledHref}\n ref={ref}\n aria-disabled={disabled ? true : rest['aria-disabled']}\n data-disabled={disabled ? '' : undefined}\n onClick={activation.onClick}\n onKeyDown={activation.onKeyDown}\n className={cn(menuItemClasses, 'text-foreground no-underline', className)}\n >\n <MenuItemRow icon={icon} label={children} shortcut={shortcut} markLabel={!ownRovingText} />\n </Component>\n );\n};\nMenuItemLink.displayName = 'MenuItemLink';\n"],"mappings":";;;;;;;AA2DA,IAAaA,KAAiE,MAAU;CACtF,IAAM,EACJ,OACA,SACA,aACA,cAAW,IACX,aACA,cACA,YACA,cACA,QACA,GAAGC,MACDC,GACEC,IAA+BC,KAAM;CAC3C,EAA4B,eAAe;CAI3C,IAAMC,IAAaC,EAAsB;EACvC;EACA,gBAAgB;EAChB;EACA;EACA,aAAa;CACf,CAAC,GAGKC,IAAc,OAAOC,KAAa,WAAWA,IAAW,KAAA,GACxDC,IAAiBR,EAAiC,wBAAwB,KAAA,GAG1ES,IAAeC,KAAY,OAAOR,KAAc,WAAW,EAAE,MAAM,KAAA,EAAU,IAAI;CAEvF,OACE,kBAACA,GAAD;EACE,MAAK;EACL,oBAAkBI;EAClB,GAAIN;EACJ,GAAIS;EACC;EACL,iBAAeC,IAAW,KAAOV,EAAK;EACtC,iBAAeU,IAAW,KAAK,KAAA;EAC/B,SAASN,EAAW;EACpB,WAAWA,EAAW;EACtB,WAAWO,EAAGC,GAAiB,gCAAgCC,CAAS;EAExE,UAAA,kBAACC,GAAD;GAAmB;GAAM,OAAOP;GAAoB;GAAU,WAAW,CAACC;EAAgB,CAAA;CACjF,CAAA;AAEf;AACA,EAAa,cAAc"}
@@ -0,0 +1,27 @@
1
+ "use client";
2
+ import { MenuDivider as e, MenuItem as t } from "./Menu.items.mjs";
3
+ import { MenuGroup as n, MenuGroupHeader as r } from "./Menu.group.mjs";
4
+ import { MenuItemLink as i } from "./Menu.link.mjs";
5
+ import { MenuPopover as a } from "./Menu.popover.mjs";
6
+ import { MenuTrigger as o } from "./Menu.trigger.mjs";
7
+ import { MenuRoot as s } from "./Menu.root.mjs";
8
+ import { MenuItemCheckbox as c, MenuItemRadio as l, MenuItemSwitch as u } from "./Menu.selectable.mjs";
9
+ import { MenuSplitGroup as d } from "./Menu.splitGroup.mjs";
10
+ //#region src/components/navigation/Menu.tsx
11
+ var f = /* @__PURE__ */ Object.assign(s, {
12
+ Item: t,
13
+ Divider: e,
14
+ Trigger: o,
15
+ Popover: a,
16
+ ItemCheckbox: c,
17
+ ItemRadio: l,
18
+ ItemSwitch: u,
19
+ ItemLink: i,
20
+ Group: n,
21
+ GroupHeader: r,
22
+ SplitGroup: d
23
+ });
24
+ //#endregion
25
+ export { f as Menu, e as MenuDivider, n as MenuGroup, r as MenuGroupHeader, t as MenuItem, c as MenuItemCheckbox, i as MenuItemLink, l as MenuItemRadio, u as MenuItemSwitch, a as MenuPopover, d as MenuSplitGroup, o as MenuTrigger };
26
+
27
+ //# sourceMappingURL=Menu.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Menu.mjs","names":["Menu","MenuRoot","MenuItem","MenuDivider","MenuTrigger","MenuPopover","MenuItemCheckbox","MenuItemRadio","MenuItemSwitch","MenuItemLink","MenuGroup","MenuGroupHeader","MenuSplitGroup"],"sources":["../../../src/components/navigation/Menu.tsx"],"sourcesContent":["import { MenuGroup, MenuGroupHeader } from './Menu.group';\nimport { MenuDivider, MenuItem } from './Menu.items';\nimport { MenuItemLink } from './Menu.link';\nimport { MenuPopover } from './Menu.popover';\nimport { MenuRoot } from './Menu.root';\nimport { MenuItemCheckbox, MenuItemRadio, MenuItemSwitch } from './Menu.selectable';\nimport { MenuSplitGroup } from './Menu.splitGroup';\nimport { MenuTrigger } from './Menu.trigger';\n\nexport type { MenuProps } from './Menu.root';\nexport type { MenuItemProps, MenuDividerProps } from './Menu.items';\nexport type { MenuTriggerProps, MenuTriggerComponentProps } from './Menu.trigger';\nexport type { MenuPopoverProps } from './Menu.popover';\nexport type {\n MenuItemSelectableProps,\n MenuItemCheckboxProps,\n MenuItemRadioProps,\n MenuItemSwitchProps,\n} from './Menu.selectable';\nexport type { MenuItemLinkProps, MenuItemLinkOwnProps } from './Menu.link';\nexport type { MenuGroupProps, MenuGroupHeaderProps } from './Menu.group';\nexport type { MenuSplitGroupProps } from './Menu.splitGroup';\n\n/**\n * A menu of actions (`role=\"menu\"`), in one of two forms:\n *\n * - **Static menu** — `Menu.Item`/`Menu.Divider` children render inline inside the `role=\"menu\"`\n * element. The menu itself is not a tab stop: one item is (the last focused enabled item, else\n * the first enabled one). When every item is disabled, the menu element holds the tab stop\n * instead, so keyboard and screen-reader users still reach it. Arrow keys, Home/End and\n * typeahead move between enabled items; Enter and Space activate the focused item (a Space typed\n * within 500 ms of a typeahead character continues the search instead).\n * - **Popup menu** — with `Menu.Trigger` and `Menu.Popover` children, or whenever `open`,\n * `defaultOpen` or `onOpenChange` is passed (even `false`), the root renders no element of its\n * own: the trigger opens the portaled `Menu.Popover`, item activation returns focus to the\n * trigger and closes it (focus is on the trigger before the menu goes, so a Dialog the item\n * opens returns focus there when it closes), unless `persistOnItemClick` (or the item's own\n * `persistOnClick`) keeps it open. Open state is `open`/`defaultOpen`/`onOpenChange`. With\n * `openOnHover` a mouse pointer resting on the trigger opens it without moving focus; with\n * `openOnContext` the trigger is a context-menu region (a right click, Shift+F10 or the\n * ContextMenu key opens the menu there).\n * - **Submenus** — a `<Menu>` rendered in a menu list (inside `Menu.Popover`, or among the items\n * of a static menu) is a submenu. Its `Menu.Trigger` wraps a `Menu.Item`, which becomes the\n * submenu's trigger item (`aria-haspopup=\"menu\"`, a chevron that mirrors in RTL):\n * ```tsx\n * <Menu.Popover>\n * <Menu>\n * <Menu.Trigger><Menu.Item>Open recent</Menu.Item></Menu.Trigger>\n * <Menu.Popover><Menu.Item>report.docx</Menu.Item></Menu.Popover>\n * </Menu>\n * </Menu.Popover>\n * ```\n * ArrowRight (ArrowLeft in RTL), Enter, Space, a click, or the mouse resting on the item opens\n * the submenu (the keys and the click move focus to its first item); ArrowLeft (ArrowRight in\n * RTL) and Escape close only that submenu and return focus to its item; item activation and Tab\n * close every level and put focus on the root trigger (under a static menu, on the submenu's\n * trigger item). One submenu of a menu is open at a time. It works in static menus too. A Menu\n * inside a Popover or Dialog opened from an item is a root menu of its own, not a submenu.\n * `Menu.SplitGroup` puts an action and the button of its submenu in one row.\n *\n * **Checked values**: `Menu.ItemCheckbox`, `Menu.ItemRadio` and `Menu.ItemSwitch` are bound by\n * `name` and `value` to the Menu's `checkedValues` (`defaultCheckedValues`,\n * `onCheckedValuesChange`), in static and popup menus alike: unlike `open`, they do not make a\n * Menu a popup menu. Space changes a checkable item and keeps the menu open; Enter and a click\n * change it and close a popup menu. A submenu shares its parent's checked values unless it sets\n * `checkedValues` or `defaultCheckedValues` of its own. `Menu.Group` and `Menu.GroupHeader` label\n * a set of items; `Menu.ItemLink` navigates. The item labels line up: once an item of a menu shows\n * a check or an icon, every item keeps that column.\n *\n * **Popup detection**: Menu looks for `Menu.Trigger`/`Menu.Popover` (also under their flat names\n * from a Server Component) among its direct children and inside Fragments only. When they are\n * wrapped in another element or component, pass `open`, `defaultOpen` or `onOpenChange` to force\n * popup mode; otherwise the static `role=\"menu\"` element is rendered around them (development\n * warning). A popup menu renders no root element, so `className`, `ref` and other DOM props on\n * `Menu` are ignored (development warning): put them on `Menu.Popover`. Items rendered in a popup\n * menu outside `Menu.Popover` have no `role=\"menu\"` parent (development warning).\n *\n * Sub-components are also exported under flat names (`MenuItem`, `MenuDivider`, `MenuTrigger`,\n * `MenuPopover`, `MenuItemCheckbox`, `MenuItemRadio`, `MenuItemSwitch`, `MenuItemLink`,\n * `MenuGroup`, `MenuGroupHeader`, `MenuSplitGroup`): React Server Components import those, because\n * dotted access (`Menu.Item`) needs a client file.\n */\nexport const Menu = /* @__PURE__ */ Object.assign(MenuRoot, {\n Item: MenuItem,\n Divider: MenuDivider,\n Trigger: MenuTrigger,\n Popover: MenuPopover,\n ItemCheckbox: MenuItemCheckbox,\n ItemRadio: MenuItemRadio,\n ItemSwitch: MenuItemSwitch,\n ItemLink: MenuItemLink,\n Group: MenuGroup,\n GroupHeader: MenuGroupHeader,\n SplitGroup: MenuSplitGroup,\n});\n\nexport {\n MenuItem,\n MenuDivider,\n MenuTrigger,\n MenuPopover,\n MenuItemCheckbox,\n MenuItemRadio,\n MenuItemSwitch,\n MenuItemLink,\n MenuGroup,\n MenuGroupHeader,\n MenuSplitGroup,\n};\n"],"mappings":";;;;;;;;;;AAkFA,IAAaA,IAAuB,uBAAO,OAAOC,GAAU;CAC1D,MAAMC;CACN,SAASC;CACT,SAASC;CACT,SAASC;CACT,cAAcC;CACd,WAAWC;CACX,YAAYC;CACZ,UAAUC;CACV,OAAOC;CACP,aAAaC;CACb,YAAYC;AACd,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/dev.cjs"),r=require("../../lib/composeEventHandlers.cjs"),i=require("../../hooks/useEventCallback.cjs"),a=require("../../lib/direction.cjs"),o=require("../../lib/focus.cjs"),ee=require("../../hooks/useRovingTabIndex.cjs"),te=require("../../hooks/useMergedRefs.cjs"),ne=require("../../hooks/usePresence.cjs"),re=require("../../hooks/useDismiss.cjs"),s=require("../portal/Portal.cjs"),ie=require("../../hooks/usePopupPosition.cjs"),ae=require("../../hooks/useRestoreFocus.cjs"),c=require("../../hooks/useTriggerElement.cjs"),l=require("../../lib/events.cjs"),u=require("./Menu.context.cjs"),d=require("./Menu.shared.cjs"),f=require("../../hooks/useHoverIntent.cjs");let p=require("react");p=e.__toESM(p,1);let m=require("react/jsx-runtime");var oe={padding:8,crossAxis:!0};function se(e){return!!e&&e.nodeType===1}function h(e){let[t]=p.useState(f.createHoverIntentGroup),n=p.useRef(!1);return{hoverGroup:t,isHoverFocusing:p.useCallback(()=>n.current,[]),onPointerMove:i.useEventCallback(r=>{if(r.pointerType===`touch`||r.pointerType===`pen`||!l.isOwnEvent(r))return;let i=r.target.closest(d.MENU_ITEM_SELECTOR);if(!i||!r.currentTarget.contains(i)||i.getAttribute(`aria-disabled`)===`true`||i.ownerDocument.activeElement===i)return;let a=e;for(;a.parent;)a=a.parent;a.listContainsFocus()&&!t.isHeld(r.clientX,r.clientY)&&(n.current=!0,i.focus({preventScroll:!0}),queueMicrotask(()=>{n.current=!1}))})}}var g=({side:e,align:f=`start`,offset:g,target:_,children:ce,className:le,style:ue,onKeyDown:de,onKeyDownCapture:fe,onFocus:pe,onPointerEnter:me,onPointerLeave:he,onPointerMove:ge,onContextMenu:_e,ref:ve,...v})=>{let y=u.useMenuContext(`Menu.Popover`),{popup:ye,open:b,takeInitialFocus:x,registerSurface:S,menuId:be,labelledBy:xe,triggerRef:C,triggerElement:w,isSubmenu:T,requestClose:Se,closeChain:E,dismiss:Ce,hoverSurfaceHandlers:D,isHoverClose:we,openOnContext:O,contextSurfaceHandlers:Te,contextAnchor:k,fromContext:A,contextOpener:j}=y;d.useStaticMenuPartWarning(`Menu.Popover`,ye);let M=se(_)?_:null,[N,Ee]=p.useState(null),P=p.useRef(null),De=p.useCallback(e=>{P.current=e,Ee(e)},[]),{isMounted:F,ref:Oe,presenceProps:ke}=ne.usePresence(b),{setReference:I,setFloating:Ae,floatingProps:L,isPositioned:R}=ie.usePopupPosition({open:b,side:e??(T?`end`:`bottom`),align:f,offset:g??(T?0:4),fitViewport:!0,shift:T?oe:void 0}),{maxHeight:je,maxWidth:Me,...Ne}=L.style;p.useLayoutEffect(()=>{I(A?k??c.getTriggerFocusTarget(w)??w:_??w)},[I,k,A,_,w]);let z=i.useEventCallback(()=>{let e=O?j.current:null;return e&&o.isConnectedAndFocusable(e)?e:c.getTriggerFocusTarget(C.current)||(M&&o.isConnectedAndFocusable(M)?M:null)}),Pe=p.useMemo(()=>({get current(){return z()??C.current}}),[z,C]),B={current:M},{layerId:V}=re.useDismiss({open:b,onDismiss:Ce,refs:O?[P,B]:[P,C,B],anchorRef:Pe,kind:`menu`,focusOutside:!0,outsidePress:O?e=>!(e.ctrlKey&&e.target instanceof Node&&C.current?.contains(e.target)):!0}),H=c.useTriggerFocusRef(C),U=p.useRef(null),W=p.useRef(!1),Fe=i.useEventCallback(()=>{let e=P.current,t=(C.current??e)?.ownerDocument??document,n=n=>!!n&&n!==t.body&&n!==t.documentElement&&!e?.contains(n),r=O?null:H.current,i=t.activeElement;U.current=n(r)?r:n(i)?i:null});p.useInsertionEffect(()=>{let e=W.current;W.current=b,b&&!e&&Fe()});let Ie=i.useEventCallback(()=>{let e=P.current;return[O?j.current:null,U.current,z()].find(t=>!!t&&o.isConnectedAndFocusable(t)&&!e?.contains(t))??null});ae.useRestoreFocus({enabled:b,container:N,triggerRef:O?void 0:H,finalFocusRef:O?j:void 0,fallback:z,onlyIfFocusInside:!0,isHoverClose:we});let G=F&&(O||_!=null&&!w)&&v[`aria-label`]===void 0&&v[`aria-labelledby`]===void 0;p.useEffect(()=>{G&&n.warnOnce(`Menu.Popover:name`,"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.")},[G]);let{containerProps:{ref:Le},handleKeyDown:Re,handleKeyDownCapture:ze,handleFocus:Be,focusFirst:K,focusLast:q}=ee.useRovingTabIndex({orientation:`vertical`,loop:!0,typeahead:!0,manageTabIndex:!0,itemSelector:d.MENU_ITEM_SELECTOR}),Ve=te.useMergedRefs(ve,De,Le,Ae,Oe);p.useLayoutEffect(()=>{if(N&&b)return S({focusFirst:K,focusLast:q,surface:N,layerId:V,getReturnFocus:z}),()=>S(null)},[N,b,S,K,q,V,z]);let J=p.useRef(!1);p.useLayoutEffect(()=>(J.current=!1,()=>{J.current=!0}),[]);let Y=i.useEventCallback(()=>{let e=P.current,t=e?.ownerDocument.activeElement;!J.current&&e&&t&&e.contains(t)&&Ie()?.focus({preventScroll:!0})});p.useLayoutEffect(()=>{if(b)return Y},[b,Y]),p.useLayoutEffect(()=>{if(!b||!N||N.contains(N.ownerDocument.activeElement))return;let e=x();e===`last`?q():e===`first`&&K()},[b,N,x,K,q]),p.useLayoutEffect(()=>{if(!R||!N)return;let e=N.ownerDocument.activeElement;e&&e!==N&&N.contains(e)&&e.scrollIntoView?.({block:`nearest`})},[R,N]);let X=p.useContext(s.PortalDepthContext)+1,Z=u.useCheckableRegistry(),{hoverGroup:Q,isHoverFocusing:$,onPointerMove:He}=h(y),Ue=p.useMemo(()=>({menu:y,isStatic:!1,portalDepth:X,closeFromItem:E,registerCheckable:Z,hoverGroup:Q,isHoverFocusing:$}),[y,X,E,Z,Q,$]),We=e=>{if(de?.(e),!e.defaultPrevented&&l.isOwnEvent(e)){if(e.key===`Tab`){E();return}if(T&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&!l.isEditableTarget(e.target)&&a.getArrowIntent(e.key,{orientation:`horizontal`,dir:a.getDirection(e.currentTarget)})===`prev`){e.preventDefault(),z()?.focus({preventScroll:!0}),Se();return}Re(e)}};return F?(0,m.jsx)(s.Portal,{layerId:V,children:(0,m.jsx)(u.MenuListContext.Provider,{value:Ue,children:(0,m.jsx)(`div`,{role:`menu`,...v,"aria-labelledby":v[`aria-labelledby`]===void 0?w&&!O&&v[`aria-label`]===void 0?xe:void 0:v[`aria-labelledby`],...ke,ref:Ve,id:be,"data-state":b?`open`:`closed`,"data-side":L[`data-side`],"data-align":L[`data-align`],"data-roving-container":``,style:{...Ne,...ue},onKeyDown:We,onKeyDownCapture:d.withTypeaheadText(r.composeEventHandlers(fe,ze)),onFocus:r.composeEventHandlers(pe,Be,{checkDefaultPrevented:!1}),onPointerEnter:r.composeEventHandlers(me,D.onPointerEnter),onPointerLeave:r.composeEventHandlers(he,D.onPointerLeave),onPointerMove:r.composeEventHandlers(ge,He),onContextMenu:r.composeEventHandlers(_e,Te.onContextMenu),className:t.cn(d.menuPopoverClasses,le),children:ce})})}):null};g.displayName=`MenuPopover`,exports.MenuPopover=g,exports.useMenuListPointer=h;
2
+ //# sourceMappingURL=Menu.popover.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Menu.popover.cjs","names":["React","createHoverIntentGroup","useEventCallback","isOwnEvent","MENU_ITEM_SELECTOR","useMenuContext","usePresence","usePopupPosition","getTriggerFocusTarget","isConnectedAndFocusable","useDismiss","useTriggerFocusRef","useRovingTabIndex","useMergedRefs","PortalDepthContext","useCheckableRegistry","isEditableTarget","getArrowIntent","getDirection","Portal","MenuListContext","withTypeaheadText","composeEventHandlers","cn","menuPopoverClasses","require_runtime","require_cn","require_dev","require_composeEventHandlers","require_useEventCallback","require_direction","require_focus","require_useRovingTabIndex","require_useMergedRefs","require_usePresence","require_useDismiss","require_Portal","require_usePopupPosition","require_useRestoreFocus","require_useTriggerElement","require_events","require_Menu_context","require_Menu_shared","require_useHoverIntent","react","react_jsx_runtime","SUBMENU_SHIFT","isElementTarget","target","useMenuListPointer","hoverGroup","hoverFocusingRef","event","item","root","menu","MenuPopover","rest","popup","targetElement","surface","setSurface","surfaceRef","setSurfaceElement","element","presenceRef","open","side","isSubmenu","offset","_maxHeight","_maxWidth","positionStyle","floatingProps","setReference","fromContext","contextAnchor","triggerElement","getReturnFocus","opener","openOnContext","contextOpener","triggerRef","returnFocusRef","targetRef","dismiss","triggerFocusRef","openerRef","wasOpenRef","captureOpener","container","doc","isCandidate","el","trigger","active","wasOpen","getCloseFocus","unnamed","isMounted","rovingRef","rovingKeyDown","rovingKeyDownCapture","rovingFocus","mergedRef","ref","setFloating","registerSurface","focusFirst","focusLast","layerId","unmountingRef","focusReturnTargetOnClose","surfaceElement","takeInitialFocus","isPositioned","portalDepth","registerCheckable","listPointerMove","listContext","closeChain","isHoverFocusing","handleKeyDown","onKeyDown","requestClose","labelledBy","presenceProps","menuId","style","onKeyDownCapture","onFocus","onPointerEnter","hoverSurfaceHandlers","onPointerLeave","onPointerMove","onContextMenu","contextSurfaceHandlers","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":"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"}
@@ -0,0 +1,231 @@
1
+ "use client";
2
+ import { cn as e } from "../../lib/cn.mjs";
3
+ import { warnOnce as t } from "../../lib/dev.mjs";
4
+ import { composeEventHandlers as n } from "../../lib/composeEventHandlers.mjs";
5
+ import { useEventCallback as r } from "../../hooks/useEventCallback.mjs";
6
+ import { getArrowIntent as i, getDirection as a } from "../../lib/direction.mjs";
7
+ import { isConnectedAndFocusable as o } from "../../lib/focus.mjs";
8
+ import { useRovingTabIndex as ee } from "../../hooks/useRovingTabIndex.mjs";
9
+ import { useMergedRefs as te } from "../../hooks/useMergedRefs.mjs";
10
+ import { usePresence as ne } from "../../hooks/usePresence.mjs";
11
+ import { useDismiss as re } from "../../hooks/useDismiss.mjs";
12
+ import { Portal as ie, PortalDepthContext as ae } from "../portal/Portal.mjs";
13
+ import { usePopupPosition as oe } from "../../hooks/usePopupPosition.mjs";
14
+ import { useRestoreFocus as se } from "../../hooks/useRestoreFocus.mjs";
15
+ import { getTriggerFocusTarget as s, useTriggerFocusRef as ce } from "../../hooks/useTriggerElement.mjs";
16
+ import { isEditableTarget as le, isOwnEvent as c } from "../../lib/events.mjs";
17
+ import { MenuListContext as ue, useCheckableRegistry as de, useMenuContext as l } from "./Menu.context.mjs";
18
+ import { MENU_ITEM_SELECTOR as u, menuPopoverClasses as fe, useStaticMenuPartWarning as pe, withTypeaheadText as me } from "./Menu.shared.mjs";
19
+ import { createHoverIntentGroup as d } from "../../hooks/useHoverIntent.mjs";
20
+ import * as f from "react";
21
+ import { jsx as p } from "react/jsx-runtime";
22
+ //#region src/components/navigation/Menu.popover.tsx
23
+ var he = {
24
+ padding: 8,
25
+ crossAxis: !0
26
+ };
27
+ function ge(e) {
28
+ return !!e && e.nodeType === 1;
29
+ }
30
+ function m(e) {
31
+ let [t] = f.useState(d), n = f.useRef(!1);
32
+ return {
33
+ hoverGroup: t,
34
+ isHoverFocusing: f.useCallback(() => n.current, []),
35
+ onPointerMove: r((r) => {
36
+ if (r.pointerType === "touch" || r.pointerType === "pen" || !c(r)) return;
37
+ let i = r.target.closest(u);
38
+ if (!i || !r.currentTarget.contains(i) || i.getAttribute("aria-disabled") === "true" || i.ownerDocument.activeElement === i) return;
39
+ let a = e;
40
+ for (; a.parent;) a = a.parent;
41
+ a.listContainsFocus() && !t.isHeld(r.clientX, r.clientY) && (n.current = !0, i.focus({ preventScroll: !0 }), queueMicrotask(() => {
42
+ n.current = !1;
43
+ }));
44
+ })
45
+ };
46
+ }
47
+ var h = ({ side: d, align: h = "start", offset: _e, target: g, children: ve, className: ye, style: be, onKeyDown: xe, onKeyDownCapture: Se, onFocus: Ce, onPointerEnter: we, onPointerLeave: Te, onPointerMove: Ee, onContextMenu: De, ref: Oe, ..._ }) => {
48
+ let v = l("Menu.Popover"), { popup: ke, open: y, takeInitialFocus: b, registerSurface: x, menuId: Ae, labelledBy: je, triggerRef: S, triggerElement: C, isSubmenu: w, requestClose: Me, closeChain: T, dismiss: Ne, hoverSurfaceHandlers: E, isHoverClose: Pe, openOnContext: D, contextSurfaceHandlers: Fe, contextAnchor: O, fromContext: k, contextOpener: A } = v;
49
+ pe("Menu.Popover", ke);
50
+ let j = ge(g) ? g : null, [M, Ie] = f.useState(null), N = f.useRef(null), Le = f.useCallback((e) => {
51
+ N.current = e, Ie(e);
52
+ }, []), { isMounted: P, ref: Re, presenceProps: ze } = ne(y), { setReference: F, setFloating: Be, floatingProps: I, isPositioned: L } = oe({
53
+ open: y,
54
+ side: d ?? (w ? "end" : "bottom"),
55
+ align: h,
56
+ offset: _e ?? (w ? 0 : 4),
57
+ fitViewport: !0,
58
+ shift: w ? he : void 0
59
+ }), { maxHeight: Ve, maxWidth: He, ...Ue } = I.style;
60
+ f.useLayoutEffect(() => {
61
+ F(k ? O ?? s(C) ?? C : g ?? C);
62
+ }, [
63
+ F,
64
+ O,
65
+ k,
66
+ g,
67
+ C
68
+ ]);
69
+ let R = r(() => {
70
+ let e = D ? A.current : null;
71
+ return e && o(e) ? e : s(S.current) || (j && o(j) ? j : null);
72
+ }), We = f.useMemo(() => ({ get current() {
73
+ return R() ?? S.current;
74
+ } }), [R, S]), z = { current: j }, { layerId: B } = re({
75
+ open: y,
76
+ onDismiss: Ne,
77
+ refs: D ? [N, z] : [
78
+ N,
79
+ S,
80
+ z
81
+ ],
82
+ anchorRef: We,
83
+ kind: "menu",
84
+ focusOutside: !0,
85
+ outsidePress: D ? (e) => !(e.ctrlKey && e.target instanceof Node && S.current?.contains(e.target)) : !0
86
+ }), V = ce(S), H = f.useRef(null), U = f.useRef(!1), Ge = r(() => {
87
+ let e = N.current, t = (S.current ?? e)?.ownerDocument ?? document, n = (n) => !!n && n !== t.body && n !== t.documentElement && !e?.contains(n), r = D ? null : V.current, i = t.activeElement;
88
+ H.current = n(r) ? r : n(i) ? i : null;
89
+ });
90
+ f.useInsertionEffect(() => {
91
+ let e = U.current;
92
+ U.current = y, y && !e && Ge();
93
+ });
94
+ let Ke = r(() => {
95
+ let e = N.current;
96
+ return [
97
+ D ? A.current : null,
98
+ H.current,
99
+ R()
100
+ ].find((t) => !!t && o(t) && !e?.contains(t)) ?? null;
101
+ });
102
+ se({
103
+ enabled: y,
104
+ container: M,
105
+ triggerRef: D ? void 0 : V,
106
+ finalFocusRef: D ? A : void 0,
107
+ fallback: R,
108
+ onlyIfFocusInside: !0,
109
+ isHoverClose: Pe
110
+ });
111
+ let W = P && (D || g != null && !C) && _["aria-label"] === void 0 && _["aria-labelledby"] === void 0;
112
+ f.useEffect(() => {
113
+ W && t("Menu.Popover:name", "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.");
114
+ }, [W]);
115
+ let { containerProps: { ref: qe }, handleKeyDown: Je, handleKeyDownCapture: Ye, handleFocus: Xe, focusFirst: G, focusLast: K } = ee({
116
+ orientation: "vertical",
117
+ loop: !0,
118
+ typeahead: !0,
119
+ manageTabIndex: !0,
120
+ itemSelector: u
121
+ }), q = te(Oe, Le, qe, Be, Re);
122
+ f.useLayoutEffect(() => {
123
+ if (M && y) return x({
124
+ focusFirst: G,
125
+ focusLast: K,
126
+ surface: M,
127
+ layerId: B,
128
+ getReturnFocus: R
129
+ }), () => x(null);
130
+ }, [
131
+ M,
132
+ y,
133
+ x,
134
+ G,
135
+ K,
136
+ B,
137
+ R
138
+ ]);
139
+ let J = f.useRef(!1);
140
+ f.useLayoutEffect(() => (J.current = !1, () => {
141
+ J.current = !0;
142
+ }), []);
143
+ let Y = r(() => {
144
+ let e = N.current, t = e?.ownerDocument.activeElement;
145
+ !J.current && e && t && e.contains(t) && Ke()?.focus({ preventScroll: !0 });
146
+ });
147
+ f.useLayoutEffect(() => {
148
+ if (y) return Y;
149
+ }, [y, Y]), f.useLayoutEffect(() => {
150
+ if (!y || !M || M.contains(M.ownerDocument.activeElement)) return;
151
+ let e = b();
152
+ e === "last" ? K() : e === "first" && G();
153
+ }, [
154
+ y,
155
+ M,
156
+ b,
157
+ G,
158
+ K
159
+ ]), f.useLayoutEffect(() => {
160
+ if (!L || !M) return;
161
+ let e = M.ownerDocument.activeElement;
162
+ e && e !== M && M.contains(e) && e.scrollIntoView?.({ block: "nearest" });
163
+ }, [L, M]);
164
+ let X = f.useContext(ae) + 1, Z = de(), { hoverGroup: Q, isHoverFocusing: $, onPointerMove: Ze } = m(v), Qe = f.useMemo(() => ({
165
+ menu: v,
166
+ isStatic: !1,
167
+ portalDepth: X,
168
+ closeFromItem: T,
169
+ registerCheckable: Z,
170
+ hoverGroup: Q,
171
+ isHoverFocusing: $
172
+ }), [
173
+ v,
174
+ X,
175
+ T,
176
+ Z,
177
+ Q,
178
+ $
179
+ ]), $e = (e) => {
180
+ if (xe?.(e), !e.defaultPrevented && c(e)) {
181
+ if (e.key === "Tab") {
182
+ T();
183
+ return;
184
+ }
185
+ if (w && !e.altKey && !e.ctrlKey && !e.metaKey && !le(e.target) && i(e.key, {
186
+ orientation: "horizontal",
187
+ dir: a(e.currentTarget)
188
+ }) === "prev") {
189
+ e.preventDefault(), R()?.focus({ preventScroll: !0 }), Me();
190
+ return;
191
+ }
192
+ Je(e);
193
+ }
194
+ };
195
+ return P ? /* @__PURE__ */ p(ie, {
196
+ layerId: B,
197
+ children: /* @__PURE__ */ p(ue.Provider, {
198
+ value: Qe,
199
+ children: /* @__PURE__ */ p("div", {
200
+ role: "menu",
201
+ ..._,
202
+ "aria-labelledby": _["aria-labelledby"] === void 0 ? C && !D && _["aria-label"] === void 0 ? je : void 0 : _["aria-labelledby"],
203
+ ...ze,
204
+ ref: q,
205
+ id: Ae,
206
+ "data-state": y ? "open" : "closed",
207
+ "data-side": I["data-side"],
208
+ "data-align": I["data-align"],
209
+ "data-roving-container": "",
210
+ style: {
211
+ ...Ue,
212
+ ...be
213
+ },
214
+ onKeyDown: $e,
215
+ onKeyDownCapture: me(n(Se, Ye)),
216
+ onFocus: n(Ce, Xe, { checkDefaultPrevented: !1 }),
217
+ onPointerEnter: n(we, E.onPointerEnter),
218
+ onPointerLeave: n(Te, E.onPointerLeave),
219
+ onPointerMove: n(Ee, Ze),
220
+ onContextMenu: n(De, Fe.onContextMenu),
221
+ className: e(fe, ye),
222
+ children: ve
223
+ })
224
+ })
225
+ }) : null;
226
+ };
227
+ h.displayName = "MenuPopover";
228
+ //#endregion
229
+ export { h as MenuPopover, m as useMenuListPointer };
230
+
231
+ //# sourceMappingURL=Menu.popover.mjs.map