@funstack/ui 0.1.0-alpha.21 → 0.1.0-alpha.23

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 (767) hide show
  1. package/dist/accordion/accordion-context.mjs +1 -2
  2. package/dist/accordion/accordion-item.d.mts +1 -3
  3. package/dist/accordion/accordion-item.d.mts.map +1 -1
  4. package/dist/accordion/accordion-item.mjs +14 -8
  5. package/dist/accordion/accordion-item.mjs.map +1 -1
  6. package/dist/accordion/accordion-panel.d.mts +1 -3
  7. package/dist/accordion/accordion-panel.d.mts.map +1 -1
  8. package/dist/accordion/accordion-panel.mjs +3 -4
  9. package/dist/accordion/accordion-root.d.mts +1 -3
  10. package/dist/accordion/accordion-root.d.mts.map +1 -1
  11. package/dist/accordion/accordion-root.mjs +12 -15
  12. package/dist/accordion/accordion-root.mjs.map +1 -1
  13. package/dist/accordion/accordion-trigger.d.mts +1 -3
  14. package/dist/accordion/accordion-trigger.d.mts.map +1 -1
  15. package/dist/accordion/accordion-trigger.mjs +4 -5
  16. package/dist/accordion/index.d.mts +0 -2
  17. package/dist/accordion/index.d.mts.map +1 -1
  18. package/dist/accordion/index.mjs +1 -2
  19. package/dist/alert-dialog/alert-dialog-action.d.mts +5 -5
  20. package/dist/alert-dialog/alert-dialog-action.d.mts.map +1 -1
  21. package/dist/alert-dialog/alert-dialog-action.mjs +1 -2
  22. package/dist/alert-dialog/alert-dialog-action.mjs.map +1 -1
  23. package/dist/alert-dialog/alert-dialog-cancel.d.mts +0 -2
  24. package/dist/alert-dialog/alert-dialog-cancel.d.mts.map +1 -1
  25. package/dist/alert-dialog/alert-dialog-cancel.mjs +4 -5
  26. package/dist/alert-dialog/alert-dialog-context.mjs +2 -3
  27. package/dist/alert-dialog/alert-dialog-description.d.mts +0 -2
  28. package/dist/alert-dialog/alert-dialog-description.d.mts.map +1 -1
  29. package/dist/alert-dialog/alert-dialog-description.mjs +1 -2
  30. package/dist/alert-dialog/alert-dialog-form.d.mts +0 -2
  31. package/dist/alert-dialog/alert-dialog-form.d.mts.map +1 -1
  32. package/dist/alert-dialog/alert-dialog-form.mjs +1 -2
  33. package/dist/alert-dialog/alert-dialog-popup.d.mts +1 -3
  34. package/dist/alert-dialog/alert-dialog-popup.d.mts.map +1 -1
  35. package/dist/alert-dialog/alert-dialog-popup.mjs +3 -4
  36. package/dist/alert-dialog/alert-dialog-root.d.mts +0 -2
  37. package/dist/alert-dialog/alert-dialog-root.d.mts.map +1 -1
  38. package/dist/alert-dialog/alert-dialog-root.mjs +1 -2
  39. package/dist/alert-dialog/alert-dialog-title.d.mts +0 -2
  40. package/dist/alert-dialog/alert-dialog-title.d.mts.map +1 -1
  41. package/dist/alert-dialog/alert-dialog-title.mjs +1 -2
  42. package/dist/alert-dialog/alert-dialog-trigger.d.mts +0 -2
  43. package/dist/alert-dialog/alert-dialog-trigger.d.mts.map +1 -1
  44. package/dist/alert-dialog/alert-dialog-trigger.mjs +1 -2
  45. package/dist/alert-dialog/index.d.mts +0 -2
  46. package/dist/alert-dialog/index.d.mts.map +1 -1
  47. package/dist/alert-dialog/index.mjs +1 -2
  48. package/dist/avatar/avatar-context.mjs +1 -2
  49. package/dist/avatar/avatar-fallback.d.mts +1 -3
  50. package/dist/avatar/avatar-fallback.d.mts.map +1 -1
  51. package/dist/avatar/avatar-fallback.mjs +1 -2
  52. package/dist/avatar/avatar-image.d.mts +1 -3
  53. package/dist/avatar/avatar-image.d.mts.map +1 -1
  54. package/dist/avatar/avatar-image.mjs +2 -3
  55. package/dist/avatar/avatar-root.d.mts +1 -3
  56. package/dist/avatar/avatar-root.d.mts.map +1 -1
  57. package/dist/avatar/avatar-root.mjs +2 -3
  58. package/dist/avatar/index.d.mts +1 -3
  59. package/dist/avatar/index.d.mts.map +1 -1
  60. package/dist/avatar/index.mjs +1 -2
  61. package/dist/bin/skill-installer.mjs +1 -2
  62. package/dist/button/button.d.mts +1 -3
  63. package/dist/button/button.d.mts.map +1 -1
  64. package/dist/button/button.mjs +4 -5
  65. package/dist/checkbox/checkbox.d.mts +1 -3
  66. package/dist/checkbox/checkbox.d.mts.map +1 -1
  67. package/dist/checkbox/checkbox.mjs +2 -3
  68. package/dist/checkbox-group/checkbox-group-context.mjs +1 -2
  69. package/dist/checkbox-group/checkbox-group-item.d.mts +1 -3
  70. package/dist/checkbox-group/checkbox-group-item.d.mts.map +1 -1
  71. package/dist/checkbox-group/checkbox-group-item.mjs +5 -6
  72. package/dist/checkbox-group/checkbox-group-label.d.mts +1 -3
  73. package/dist/checkbox-group/checkbox-group-label.d.mts.map +1 -1
  74. package/dist/checkbox-group/checkbox-group-label.mjs +1 -2
  75. package/dist/checkbox-group/checkbox-group-parent.d.mts +1 -3
  76. package/dist/checkbox-group/checkbox-group-parent.d.mts.map +1 -1
  77. package/dist/checkbox-group/checkbox-group-parent.mjs +7 -8
  78. package/dist/checkbox-group/checkbox-group-parent.mjs.map +1 -1
  79. package/dist/checkbox-group/checkbox-group-root.d.mts +1 -3
  80. package/dist/checkbox-group/checkbox-group-root.d.mts.map +1 -1
  81. package/dist/checkbox-group/checkbox-group-root.mjs +7 -8
  82. package/dist/checkbox-group/index.d.mts +1 -3
  83. package/dist/checkbox-group/index.d.mts.map +1 -1
  84. package/dist/checkbox-group/index.mjs +1 -2
  85. package/dist/collapsible/collapsible-context.mjs +1 -2
  86. package/dist/collapsible/collapsible-panel.d.mts +1 -3
  87. package/dist/collapsible/collapsible-panel.d.mts.map +1 -1
  88. package/dist/collapsible/collapsible-panel.mjs +3 -4
  89. package/dist/collapsible/collapsible-root.d.mts +1 -3
  90. package/dist/collapsible/collapsible-root.d.mts.map +1 -1
  91. package/dist/collapsible/collapsible-root.mjs +18 -18
  92. package/dist/collapsible/collapsible-root.mjs.map +1 -1
  93. package/dist/collapsible/collapsible-trigger.d.mts +1 -3
  94. package/dist/collapsible/collapsible-trigger.d.mts.map +1 -1
  95. package/dist/collapsible/collapsible-trigger.mjs +4 -5
  96. package/dist/collapsible/index.d.mts +0 -2
  97. package/dist/collapsible/index.d.mts.map +1 -1
  98. package/dist/collapsible/index.mjs +1 -2
  99. package/dist/combobox/chip-text.mjs +1 -2
  100. package/dist/combobox/combobox-chips.d.mts +1 -3
  101. package/dist/combobox/combobox-chips.d.mts.map +1 -1
  102. package/dist/combobox/combobox-chips.mjs +3 -4
  103. package/dist/combobox/combobox-clear.d.mts +1 -3
  104. package/dist/combobox/combobox-clear.d.mts.map +1 -1
  105. package/dist/combobox/combobox-clear.mjs +2 -3
  106. package/dist/combobox/combobox-context.mjs +1 -2
  107. package/dist/combobox/combobox-group.d.mts +1 -3
  108. package/dist/combobox/combobox-group.d.mts.map +1 -1
  109. package/dist/combobox/combobox-group.mjs +2 -3
  110. package/dist/combobox/combobox-input.d.mts +1 -3
  111. package/dist/combobox/combobox-input.d.mts.map +1 -1
  112. package/dist/combobox/combobox-input.mjs +5 -6
  113. package/dist/combobox/combobox-keyboard.mjs +2 -3
  114. package/dist/combobox/combobox-label.d.mts +1 -3
  115. package/dist/combobox/combobox-label.d.mts.map +1 -1
  116. package/dist/combobox/combobox-label.mjs +2 -3
  117. package/dist/combobox/combobox-list.d.mts +1 -3
  118. package/dist/combobox/combobox-list.d.mts.map +1 -1
  119. package/dist/combobox/combobox-list.mjs +3 -4
  120. package/dist/combobox/combobox-option.d.mts +1 -3
  121. package/dist/combobox/combobox-option.d.mts.map +1 -1
  122. package/dist/combobox/combobox-option.mjs +2 -3
  123. package/dist/combobox/combobox-popup.d.mts +1 -3
  124. package/dist/combobox/combobox-popup.d.mts.map +1 -1
  125. package/dist/combobox/combobox-popup.mjs +4 -5
  126. package/dist/combobox/combobox-root.d.mts +1 -3
  127. package/dist/combobox/combobox-root.d.mts.map +1 -1
  128. package/dist/combobox/combobox-root.mjs +14 -15
  129. package/dist/combobox/combobox-trigger.d.mts +1 -3
  130. package/dist/combobox/combobox-trigger.d.mts.map +1 -1
  131. package/dist/combobox/combobox-trigger.mjs +5 -6
  132. package/dist/combobox/index.d.mts +1 -3
  133. package/dist/combobox/index.d.mts.map +1 -1
  134. package/dist/combobox/index.mjs +1 -2
  135. package/dist/combobox/use-combobox-form.mjs +3 -5
  136. package/dist/combobox/use-combobox-form.mjs.map +1 -1
  137. package/dist/combobox/use-combobox-text.mjs +3 -4
  138. package/dist/csp/csp-provider.d.mts +0 -2
  139. package/dist/csp/csp-provider.d.mts.map +1 -1
  140. package/dist/csp/csp-provider.mjs +2 -3
  141. package/dist/csp/style-hashes.d.mts +0 -2
  142. package/dist/csp/style-hashes.d.mts.map +1 -1
  143. package/dist/csp/style-hashes.mjs +1 -2
  144. package/dist/dialog/dialog-close.d.mts +10 -6
  145. package/dist/dialog/dialog-close.d.mts.map +1 -1
  146. package/dist/dialog/dialog-close.mjs +5 -5
  147. package/dist/dialog/dialog-close.mjs.map +1 -1
  148. package/dist/dialog/dialog-context.mjs +1 -2
  149. package/dist/dialog/dialog-description.d.mts +1 -3
  150. package/dist/dialog/dialog-description.d.mts.map +1 -1
  151. package/dist/dialog/dialog-description.mjs +1 -2
  152. package/dist/dialog/dialog-dismiss.mjs +51 -21
  153. package/dist/dialog/dialog-dismiss.mjs.map +1 -1
  154. package/dist/dialog/dialog-form.d.mts +1 -3
  155. package/dist/dialog/dialog-form.d.mts.map +1 -1
  156. package/dist/dialog/dialog-form.mjs +6 -7
  157. package/dist/dialog/dialog-popup.d.mts +2 -4
  158. package/dist/dialog/dialog-popup.d.mts.map +1 -1
  159. package/dist/dialog/dialog-popup.mjs +10 -11
  160. package/dist/dialog/dialog-root.d.mts +1 -3
  161. package/dist/dialog/dialog-root.d.mts.map +1 -1
  162. package/dist/dialog/dialog-root.mjs +3 -4
  163. package/dist/dialog/dialog-title.d.mts +1 -3
  164. package/dist/dialog/dialog-title.d.mts.map +1 -1
  165. package/dist/dialog/dialog-title.mjs +1 -2
  166. package/dist/dialog/dialog-trigger.d.mts +1 -3
  167. package/dist/dialog/dialog-trigger.d.mts.map +1 -1
  168. package/dist/dialog/dialog-trigger.mjs +4 -5
  169. package/dist/dialog/index.d.mts +1 -3
  170. package/dist/dialog/index.d.mts.map +1 -1
  171. package/dist/dialog/index.mjs +1 -2
  172. package/dist/docs/components/accordion.md +1 -1
  173. package/dist/docs/components/alert-dialog.md +15 -7
  174. package/dist/docs/components/collapsible.md +1 -1
  175. package/dist/docs/components/dialog.md +14 -6
  176. package/dist/docs/components/drawer.md +3 -3
  177. package/dist/docs/components/menu.md +4 -4
  178. package/dist/docs/components/menubar.md +309 -0
  179. package/dist/docs/components/meter.md +1 -1
  180. package/dist/docs/components/navigation-menu.md +501 -0
  181. package/dist/docs/components/number-field.md +2 -2
  182. package/dist/docs/components/otp-field.md +8 -1
  183. package/dist/docs/components/popover.md +6 -6
  184. package/dist/docs/components/progress.md +1 -1
  185. package/dist/docs/components/radio-group.md +1 -1
  186. package/dist/docs/components/slider.md +1 -1
  187. package/dist/docs/concepts/direction-and-locales.md +106 -0
  188. package/dist/docs/concepts/pending-and-optimistic.md +1 -0
  189. package/dist/docs/index.md +4 -1
  190. package/dist/docs/roadmap.md +11 -0
  191. package/dist/drawer/drawer-close.d.mts +0 -2
  192. package/dist/drawer/drawer-close.d.mts.map +1 -1
  193. package/dist/drawer/drawer-close.mjs +1 -2
  194. package/dist/drawer/drawer-description.d.mts +0 -2
  195. package/dist/drawer/drawer-description.d.mts.map +1 -1
  196. package/dist/drawer/drawer-description.mjs +1 -2
  197. package/dist/drawer/drawer-form.d.mts +0 -2
  198. package/dist/drawer/drawer-form.d.mts.map +1 -1
  199. package/dist/drawer/drawer-form.mjs +1 -2
  200. package/dist/drawer/drawer-popup.d.mts +2 -4
  201. package/dist/drawer/drawer-popup.d.mts.map +1 -1
  202. package/dist/drawer/drawer-popup.mjs +3 -4
  203. package/dist/drawer/drawer-root.d.mts +0 -2
  204. package/dist/drawer/drawer-root.d.mts.map +1 -1
  205. package/dist/drawer/drawer-root.mjs +1 -2
  206. package/dist/drawer/drawer-swipe.d.mts +0 -2
  207. package/dist/drawer/drawer-swipe.d.mts.map +1 -1
  208. package/dist/drawer/drawer-swipe.mjs +1 -2
  209. package/dist/drawer/drawer-swipe.mjs.map +1 -1
  210. package/dist/drawer/drawer-title.d.mts +0 -2
  211. package/dist/drawer/drawer-title.d.mts.map +1 -1
  212. package/dist/drawer/drawer-title.mjs +1 -2
  213. package/dist/drawer/drawer-trigger.d.mts +0 -2
  214. package/dist/drawer/drawer-trigger.d.mts.map +1 -1
  215. package/dist/drawer/drawer-trigger.mjs +1 -2
  216. package/dist/drawer/index.d.mts +0 -2
  217. package/dist/drawer/index.d.mts.map +1 -1
  218. package/dist/drawer/index.mjs +1 -2
  219. package/dist/field/field-control.d.mts +2 -4
  220. package/dist/field/field-control.d.mts.map +1 -1
  221. package/dist/field/field-control.mjs +6 -7
  222. package/dist/field/field-description.d.mts +2 -4
  223. package/dist/field/field-description.d.mts.map +1 -1
  224. package/dist/field/field-description.mjs +2 -3
  225. package/dist/field/field-error.d.mts +2 -4
  226. package/dist/field/field-error.d.mts.map +1 -1
  227. package/dist/field/field-error.mjs +3 -4
  228. package/dist/field/field-label.d.mts +2 -4
  229. package/dist/field/field-label.d.mts.map +1 -1
  230. package/dist/field/field-label.mjs +3 -4
  231. package/dist/field/field-root.d.mts +2 -4
  232. package/dist/field/field-root.d.mts.map +1 -1
  233. package/dist/field/field-root.mjs +11 -16
  234. package/dist/field/field-root.mjs.map +1 -1
  235. package/dist/field/index.d.mts +0 -2
  236. package/dist/field/index.d.mts.map +1 -1
  237. package/dist/field/index.mjs +1 -2
  238. package/dist/field/use-server-error-visibility.mjs +1 -2
  239. package/dist/form/form-root.d.mts +1 -3
  240. package/dist/form/form-root.d.mts.map +1 -1
  241. package/dist/form/form-root.mjs +8 -9
  242. package/dist/form/form-submit.d.mts +1 -3
  243. package/dist/form/form-submit.d.mts.map +1 -1
  244. package/dist/form/form-submit.mjs +3 -4
  245. package/dist/form/index.d.mts +0 -2
  246. package/dist/form/index.d.mts.map +1 -1
  247. package/dist/form/index.mjs +1 -2
  248. package/dist/hover-card/hover-card-context.mjs +1 -2
  249. package/dist/hover-card/hover-card-popup.d.mts +2 -4
  250. package/dist/hover-card/hover-card-popup.d.mts.map +1 -1
  251. package/dist/hover-card/hover-card-popup.mjs +6 -7
  252. package/dist/hover-card/hover-card-root.d.mts +1 -3
  253. package/dist/hover-card/hover-card-root.d.mts.map +1 -1
  254. package/dist/hover-card/hover-card-root.mjs +3 -4
  255. package/dist/hover-card/hover-card-trigger.d.mts +1 -3
  256. package/dist/hover-card/hover-card-trigger.d.mts.map +1 -1
  257. package/dist/hover-card/hover-card-trigger.mjs +5 -6
  258. package/dist/hover-card/index.d.mts +0 -2
  259. package/dist/hover-card/index.d.mts.map +1 -1
  260. package/dist/hover-card/index.mjs +1 -2
  261. package/dist/hover-card/use-hover-card-interest.mjs +14 -8
  262. package/dist/hover-card/use-hover-card-interest.mjs.map +1 -1
  263. package/dist/index.d.mts +50 -35
  264. package/dist/index.mjs +3 -1
  265. package/dist/internal/action/action-details.mjs +1 -2
  266. package/dist/internal/action/call-urgent-handler.mjs +1 -2
  267. package/dist/internal/action/report-dropped.mjs +1 -2
  268. package/dist/internal/action/use-action-trigger.mjs +2 -3
  269. package/dist/internal/action/use-connected.mjs +1 -2
  270. package/dist/internal/action/use-controllable-action.mjs +4 -5
  271. package/dist/internal/action/use-multiple-selection.mjs +4 -5
  272. package/dist/internal/action/use-pure-trigger.mjs +1 -2
  273. package/dist/internal/action/use-pure-trigger.mjs.map +1 -1
  274. package/dist/internal/action/use-step-commit.mjs +3 -4
  275. package/dist/internal/after-dispatch.mjs +23 -0
  276. package/dist/internal/after-dispatch.mjs.map +1 -0
  277. package/dist/internal/announce.mjs +1 -2
  278. package/dist/internal/arrow-keys.mjs +1 -2
  279. package/dist/internal/csp-context.mjs +1 -2
  280. package/dist/internal/data-attr.mjs +1 -2
  281. package/dist/internal/decimal.mjs +1 -2
  282. package/dist/internal/details-summary.mjs +51 -3
  283. package/dist/internal/details-summary.mjs.map +1 -1
  284. package/dist/internal/dev-warn.mjs +1 -2
  285. package/dist/internal/dom-order.mjs +1 -2
  286. package/dist/internal/form/field-context.d.mts +0 -2
  287. package/dist/internal/form/field-context.d.mts.map +1 -1
  288. package/dist/internal/form/field-context.mjs +2 -3
  289. package/dist/internal/form/focus-first-invalid.mjs +2 -3
  290. package/dist/internal/form/form-status-watcher.mjs +1 -2
  291. package/dist/internal/form/group-member.mjs +1 -2
  292. package/dist/internal/form/hidden-values.mjs +1 -2
  293. package/dist/internal/form/sync-presence.mjs +1 -2
  294. package/dist/internal/form/use-checkable-input.mjs +2 -3
  295. package/dist/internal/form/use-field-control.mjs +3 -4
  296. package/dist/internal/form/use-fieldset-group.mjs +3 -4
  297. package/dist/internal/form/use-form-owner-event.mjs +1 -2
  298. package/dist/internal/form/use-form-reset.mjs +10 -8
  299. package/dist/internal/form/use-form-reset.mjs.map +1 -1
  300. package/dist/internal/form/use-native-checked.mjs +2 -3
  301. package/dist/internal/form/use-native-group-reconciliation.mjs +3 -4
  302. package/dist/internal/form/use-native-select-value.mjs +2 -3
  303. package/dist/internal/form/validity.d.mts +0 -2
  304. package/dist/internal/form/validity.d.mts.map +1 -1
  305. package/dist/internal/form/validity.mjs +1 -2
  306. package/dist/internal/menubar-context.mjs +11 -0
  307. package/dist/internal/menubar-context.mjs.map +1 -0
  308. package/dist/internal/merge-props.mjs +1 -2
  309. package/dist/internal/overlay/anchor-position.d.mts +0 -2
  310. package/dist/internal/overlay/anchor-position.d.mts.map +1 -1
  311. package/dist/internal/overlay/anchor-position.mjs +1 -2
  312. package/dist/internal/overlay/content-focus-probe.mjs +1 -2
  313. package/dist/internal/overlay/css-transition-cut.mjs +1 -2
  314. package/dist/internal/overlay/css-transition-cut.mjs.map +1 -1
  315. package/dist/internal/overlay/focus-visible.mjs +1 -2
  316. package/dist/internal/overlay/invokers.mjs +1 -2
  317. package/dist/internal/overlay/modal-registry.mjs +1 -2
  318. package/dist/internal/overlay/overlay-popup.mjs +2 -3
  319. package/dist/internal/overlay/overlay-show.mjs +1 -2
  320. package/dist/internal/overlay/popover-open.mjs +1 -2
  321. package/dist/internal/overlay/trigger-ref.mjs +2 -3
  322. package/dist/internal/overlay/trigger-ref.mjs.map +1 -1
  323. package/dist/internal/overlay/use-apply-open-state.mjs +1 -2
  324. package/dist/internal/overlay/use-exit-animation.mjs +1 -2
  325. package/dist/internal/overlay/use-exit-animation.mjs.map +1 -1
  326. package/dist/internal/overlay/use-interest-dismiss.mjs +3 -4
  327. package/dist/internal/overlay/use-modal-registration.mjs +2 -3
  328. package/dist/internal/overlay/use-overlay-close.mjs +11 -9
  329. package/dist/internal/overlay/use-overlay-close.mjs.map +1 -1
  330. package/dist/internal/overlay/use-overlay-root.d.mts +2 -2
  331. package/dist/internal/overlay/use-overlay-root.mjs +9 -9
  332. package/dist/internal/overlay/use-overlay-root.mjs.map +1 -1
  333. package/dist/internal/overlay/use-popover-popup.mjs +6 -7
  334. package/dist/internal/overlay/use-popover-trigger.d.mts +2 -4
  335. package/dist/internal/overlay/use-popover-trigger.d.mts.map +1 -1
  336. package/dist/internal/overlay/use-popover-trigger.mjs +6 -7
  337. package/dist/internal/overlay/use-popover-trigger.mjs.map +1 -1
  338. package/dist/internal/overlay/use-resolved-placement.mjs +4 -5
  339. package/dist/internal/platform-attributes.d.mts +0 -2
  340. package/dist/internal/platform-attributes.d.mts.map +1 -1
  341. package/dist/internal/pointer-capture.mjs +1 -2
  342. package/dist/internal/range-value.mjs +6 -5
  343. package/dist/internal/range-value.mjs.map +1 -1
  344. package/dist/internal/render-element.d.mts +2 -2
  345. package/dist/internal/render-element.mjs +2 -3
  346. package/dist/internal/shipped-styles.mjs +1 -2
  347. package/dist/internal/swipe-arithmetic.mjs +0 -1
  348. package/dist/internal/swipe.mjs +2 -3
  349. package/dist/internal/toolbar-context.mjs +1 -2
  350. package/dist/internal/transition-boundary.mjs +2 -3
  351. package/dist/internal/transition-types.mjs +1 -2
  352. package/dist/internal/typeahead.mjs +0 -1
  353. package/dist/internal/types.d.mts +0 -2
  354. package/dist/internal/types.d.mts.map +1 -1
  355. package/dist/internal/use-active-option.mjs +1 -2
  356. package/dist/internal/use-deferred-leave.mjs +2 -3
  357. package/dist/internal/use-delayed-pair.mjs +1 -2
  358. package/dist/internal/use-dev-warning.mjs +0 -1
  359. package/dist/internal/use-element-check.mjs +1 -2
  360. package/dist/internal/use-hydrated-mount.mjs +1 -2
  361. package/dist/internal/use-item-order.mjs +2 -3
  362. package/dist/internal/use-latest.mjs +1 -2
  363. package/dist/internal/use-merged-refs.mjs +2 -3
  364. package/dist/internal/use-mount-fixed.mjs +2 -3
  365. package/dist/internal/use-name-warning.mjs +1 -2
  366. package/dist/internal/use-native-focusgroup.mjs +1 -2
  367. package/dist/internal/use-option-registry.mjs +3 -4
  368. package/dist/internal/use-register-count.mjs +1 -2
  369. package/dist/internal/use-render.d.mts +2 -2
  370. package/dist/internal/use-render.mjs +2 -3
  371. package/dist/internal/use-roving-focus.mjs +2 -3
  372. package/dist/internal/use-value-set.mjs +2 -3
  373. package/dist/internal/value-set.mjs +1 -2
  374. package/dist/menu/index.d.mts +2 -4
  375. package/dist/menu/index.d.mts.map +1 -1
  376. package/dist/menu/index.mjs +2 -3
  377. package/dist/menu/menu-checkbox-item.d.mts +1 -3
  378. package/dist/menu/menu-checkbox-item.d.mts.map +1 -1
  379. package/dist/menu/menu-checkbox-item.mjs +3 -4
  380. package/dist/menu/menu-context-trigger.d.mts +1 -3
  381. package/dist/menu/menu-context-trigger.d.mts.map +1 -1
  382. package/dist/menu/menu-context-trigger.mjs +4 -5
  383. package/dist/menu/menu-context.mjs +1 -2
  384. package/dist/menu/menu-dom.mjs +1 -2
  385. package/dist/menu/menu-gestures.mjs +1 -2
  386. package/dist/menu/menu-group.d.mts +1 -3
  387. package/dist/menu/menu-group.d.mts.map +1 -1
  388. package/dist/menu/menu-group.mjs +2 -3
  389. package/dist/menu/menu-hover.mjs +1 -2
  390. package/dist/menu/menu-item.d.mts +3 -4
  391. package/dist/menu/menu-item.d.mts.map +1 -1
  392. package/dist/menu/menu-item.mjs +6 -3
  393. package/dist/menu/menu-item.mjs.map +1 -1
  394. package/dist/menu/menu-outside.mjs +1 -2
  395. package/dist/menu/menu-point.mjs +1 -2
  396. package/dist/menu/menu-popup.d.mts +2 -4
  397. package/dist/menu/menu-popup.d.mts.map +1 -1
  398. package/dist/menu/menu-popup.mjs +45 -19
  399. package/dist/menu/menu-popup.mjs.map +1 -1
  400. package/dist/menu/menu-radio-group.d.mts +1 -3
  401. package/dist/menu/menu-radio-group.d.mts.map +1 -1
  402. package/dist/menu/menu-radio-group.mjs +3 -4
  403. package/dist/menu/menu-radio-item.d.mts +1 -3
  404. package/dist/menu/menu-radio-item.d.mts.map +1 -1
  405. package/dist/menu/menu-radio-item.mjs +2 -3
  406. package/dist/menu/menu-root.d.mts +1 -3
  407. package/dist/menu/menu-root.d.mts.map +1 -1
  408. package/dist/menu/menu-root.mjs +4 -5
  409. package/dist/menu/menu-submenu-trigger.d.mts +1 -3
  410. package/dist/menu/menu-submenu-trigger.d.mts.map +1 -1
  411. package/dist/menu/menu-submenu-trigger.mjs +5 -6
  412. package/dist/menu/menu-trigger.d.mts +11 -6
  413. package/dist/menu/menu-trigger.d.mts.map +1 -1
  414. package/dist/menu/menu-trigger.mjs +56 -9
  415. package/dist/menu/menu-trigger.mjs.map +1 -1
  416. package/dist/menu/use-menu-item.mjs +2 -3
  417. package/dist/menu/use-menu-keyboard.mjs +2 -3
  418. package/dist/menubar/index.d.mts +3 -0
  419. package/dist/menubar/index.mjs +1 -0
  420. package/dist/menubar/menubar.d.mts +47 -0
  421. package/dist/menubar/menubar.d.mts.map +1 -0
  422. package/dist/menubar/menubar.mjs +146 -0
  423. package/dist/menubar/menubar.mjs.map +1 -0
  424. package/dist/meter/index.d.mts +1 -3
  425. package/dist/meter/index.d.mts.map +1 -1
  426. package/dist/meter/index.mjs +1 -2
  427. package/dist/meter/meter-context.mjs +1 -2
  428. package/dist/meter/meter-indicator.d.mts +1 -3
  429. package/dist/meter/meter-indicator.d.mts.map +1 -1
  430. package/dist/meter/meter-indicator.mjs +1 -2
  431. package/dist/meter/meter-label.d.mts +1 -3
  432. package/dist/meter/meter-label.d.mts.map +1 -1
  433. package/dist/meter/meter-label.mjs +1 -2
  434. package/dist/meter/meter-region.d.mts +0 -2
  435. package/dist/meter/meter-region.d.mts.map +1 -1
  436. package/dist/meter/meter-region.mjs +1 -2
  437. package/dist/meter/meter-root.d.mts +4 -5
  438. package/dist/meter/meter-root.d.mts.map +1 -1
  439. package/dist/meter/meter-root.mjs +4 -5
  440. package/dist/meter/meter-root.mjs.map +1 -1
  441. package/dist/meter/meter-track.d.mts +1 -3
  442. package/dist/meter/meter-track.d.mts.map +1 -1
  443. package/dist/meter/meter-track.mjs +1 -2
  444. package/dist/meter/meter-value.d.mts +1 -3
  445. package/dist/meter/meter-value.d.mts.map +1 -1
  446. package/dist/meter/meter-value.mjs +1 -2
  447. package/dist/multi-select/index.d.mts +1 -3
  448. package/dist/multi-select/index.d.mts.map +1 -1
  449. package/dist/multi-select/index.mjs +1 -2
  450. package/dist/multi-select/multi-select-context.mjs +1 -2
  451. package/dist/multi-select/multi-select-group.d.mts +1 -3
  452. package/dist/multi-select/multi-select-group.d.mts.map +1 -1
  453. package/dist/multi-select/multi-select-group.mjs +2 -3
  454. package/dist/multi-select/multi-select-keyboard.mjs +1 -2
  455. package/dist/multi-select/multi-select-label.d.mts +1 -3
  456. package/dist/multi-select/multi-select-label.d.mts.map +1 -1
  457. package/dist/multi-select/multi-select-label.mjs +2 -3
  458. package/dist/multi-select/multi-select-list.d.mts +1 -3
  459. package/dist/multi-select/multi-select-list.d.mts.map +1 -1
  460. package/dist/multi-select/multi-select-list.mjs +3 -4
  461. package/dist/multi-select/multi-select-option.d.mts +1 -3
  462. package/dist/multi-select/multi-select-option.d.mts.map +1 -1
  463. package/dist/multi-select/multi-select-option.mjs +3 -4
  464. package/dist/multi-select/multi-select-popup.d.mts +1 -3
  465. package/dist/multi-select/multi-select-popup.d.mts.map +1 -1
  466. package/dist/multi-select/multi-select-popup.mjs +5 -6
  467. package/dist/multi-select/multi-select-root.d.mts +1 -3
  468. package/dist/multi-select/multi-select-root.d.mts.map +1 -1
  469. package/dist/multi-select/multi-select-root.mjs +11 -12
  470. package/dist/multi-select/multi-select-trigger.d.mts +1 -3
  471. package/dist/multi-select/multi-select-trigger.d.mts.map +1 -1
  472. package/dist/multi-select/multi-select-trigger.mjs +7 -8
  473. package/dist/multi-select/multi-select-value.d.mts +1 -3
  474. package/dist/multi-select/multi-select-value.d.mts.map +1 -1
  475. package/dist/multi-select/multi-select-value.mjs +1 -2
  476. package/dist/navigation-menu/index.d.mts +30 -0
  477. package/dist/navigation-menu/index.d.mts.map +1 -0
  478. package/dist/navigation-menu/index.mjs +31 -0
  479. package/dist/navigation-menu/index.mjs.map +1 -0
  480. package/dist/navigation-menu/navigation-menu-context.mjs +18 -0
  481. package/dist/navigation-menu/navigation-menu-context.mjs.map +1 -0
  482. package/dist/navigation-menu/navigation-menu-item.d.mts +77 -0
  483. package/dist/navigation-menu/navigation-menu-item.d.mts.map +1 -0
  484. package/dist/navigation-menu/navigation-menu-item.mjs +79 -0
  485. package/dist/navigation-menu/navigation-menu-item.mjs.map +1 -0
  486. package/dist/navigation-menu/navigation-menu-link.d.mts +46 -0
  487. package/dist/navigation-menu/navigation-menu-link.d.mts.map +1 -0
  488. package/dist/navigation-menu/navigation-menu-link.mjs +65 -0
  489. package/dist/navigation-menu/navigation-menu-link.mjs.map +1 -0
  490. package/dist/navigation-menu/navigation-menu-list.d.mts +31 -0
  491. package/dist/navigation-menu/navigation-menu-list.d.mts.map +1 -0
  492. package/dist/navigation-menu/navigation-menu-list.mjs +29 -0
  493. package/dist/navigation-menu/navigation-menu-list.mjs.map +1 -0
  494. package/dist/navigation-menu/navigation-menu-popup.d.mts +100 -0
  495. package/dist/navigation-menu/navigation-menu-popup.d.mts.map +1 -0
  496. package/dist/navigation-menu/navigation-menu-popup.mjs +92 -0
  497. package/dist/navigation-menu/navigation-menu-popup.mjs.map +1 -0
  498. package/dist/navigation-menu/navigation-menu-root.d.mts +31 -0
  499. package/dist/navigation-menu/navigation-menu-root.d.mts.map +1 -0
  500. package/dist/navigation-menu/navigation-menu-root.mjs +26 -0
  501. package/dist/navigation-menu/navigation-menu-root.mjs.map +1 -0
  502. package/dist/navigation-menu/navigation-menu-trigger.d.mts +30 -0
  503. package/dist/navigation-menu/navigation-menu-trigger.d.mts.map +1 -0
  504. package/dist/navigation-menu/navigation-menu-trigger.mjs +41 -0
  505. package/dist/navigation-menu/navigation-menu-trigger.mjs.map +1 -0
  506. package/dist/number-field/index.d.mts +2 -4
  507. package/dist/number-field/index.d.mts.map +1 -1
  508. package/dist/number-field/index.mjs +1 -2
  509. package/dist/number-field/number-field-arithmetic.mjs +1 -2
  510. package/dist/number-field/number-field-context.d.mts +1 -3
  511. package/dist/number-field/number-field-context.d.mts.map +1 -1
  512. package/dist/number-field/number-field-context.mjs +1 -2
  513. package/dist/number-field/number-field-decrement.d.mts +0 -2
  514. package/dist/number-field/number-field-decrement.d.mts.map +1 -1
  515. package/dist/number-field/number-field-decrement.mjs +1 -2
  516. package/dist/number-field/number-field-format.mjs +1 -2
  517. package/dist/number-field/number-field-increment.d.mts +0 -2
  518. package/dist/number-field/number-field-increment.d.mts.map +1 -1
  519. package/dist/number-field/number-field-increment.mjs +1 -2
  520. package/dist/number-field/number-field-input.d.mts +1 -3
  521. package/dist/number-field/number-field-input.d.mts.map +1 -1
  522. package/dist/number-field/number-field-input.mjs +4 -5
  523. package/dist/number-field/number-field-label.d.mts +1 -3
  524. package/dist/number-field/number-field-label.d.mts.map +1 -1
  525. package/dist/number-field/number-field-label.mjs +3 -4
  526. package/dist/number-field/number-field-root.d.mts +1 -3
  527. package/dist/number-field/number-field-root.d.mts.map +1 -1
  528. package/dist/number-field/number-field-root.mjs +7 -8
  529. package/dist/number-field/number-field-root.mjs.map +1 -1
  530. package/dist/number-field/use-number-field-dev-warnings.mjs +2 -3
  531. package/dist/number-field/use-step-button.d.mts +1 -3
  532. package/dist/number-field/use-step-button.d.mts.map +1 -1
  533. package/dist/number-field/use-step-button.mjs +2 -3
  534. package/dist/otp-field/index.d.mts +2 -4
  535. package/dist/otp-field/index.d.mts.map +1 -1
  536. package/dist/otp-field/index.mjs +1 -2
  537. package/dist/otp-field/otp-field-context.mjs +1 -2
  538. package/dist/otp-field/otp-field-filter.d.mts +0 -2
  539. package/dist/otp-field/otp-field-filter.d.mts.map +1 -1
  540. package/dist/otp-field/otp-field-filter.mjs +1 -2
  541. package/dist/otp-field/otp-field-input.d.mts +1 -3
  542. package/dist/otp-field/otp-field-input.d.mts.map +1 -1
  543. package/dist/otp-field/otp-field-input.mjs +6 -7
  544. package/dist/otp-field/otp-field-root.d.mts +10 -3
  545. package/dist/otp-field/otp-field-root.d.mts.map +1 -1
  546. package/dist/otp-field/otp-field-root.mjs +15 -13
  547. package/dist/otp-field/otp-field-root.mjs.map +1 -1
  548. package/dist/otp-field/otp-field-slot.d.mts +1 -3
  549. package/dist/otp-field/otp-field-slot.d.mts.map +1 -1
  550. package/dist/otp-field/otp-field-slot.mjs +2 -3
  551. package/dist/popover/index.d.mts +1 -3
  552. package/dist/popover/index.d.mts.map +1 -1
  553. package/dist/popover/index.mjs +1 -2
  554. package/dist/popover/popover-close.d.mts +10 -6
  555. package/dist/popover/popover-close.d.mts.map +1 -1
  556. package/dist/popover/popover-close.mjs +3 -3
  557. package/dist/popover/popover-close.mjs.map +1 -1
  558. package/dist/popover/popover-context.mjs +1 -2
  559. package/dist/popover/popover-description.d.mts +1 -3
  560. package/dist/popover/popover-description.d.mts.map +1 -1
  561. package/dist/popover/popover-description.mjs +1 -2
  562. package/dist/popover/popover-popup.d.mts +2 -4
  563. package/dist/popover/popover-popup.d.mts.map +1 -1
  564. package/dist/popover/popover-popup.mjs +4 -5
  565. package/dist/popover/popover-root.d.mts +1 -3
  566. package/dist/popover/popover-root.d.mts.map +1 -1
  567. package/dist/popover/popover-root.mjs +2 -3
  568. package/dist/popover/popover-title.d.mts +1 -3
  569. package/dist/popover/popover-title.d.mts.map +1 -1
  570. package/dist/popover/popover-title.mjs +1 -2
  571. package/dist/popover/popover-trigger.d.mts +1 -3
  572. package/dist/popover/popover-trigger.d.mts.map +1 -1
  573. package/dist/popover/popover-trigger.mjs +2 -3
  574. package/dist/progress/index.d.mts +1 -3
  575. package/dist/progress/index.d.mts.map +1 -1
  576. package/dist/progress/index.mjs +1 -2
  577. package/dist/progress/progress-context.mjs +1 -2
  578. package/dist/progress/progress-indicator.d.mts +1 -3
  579. package/dist/progress/progress-indicator.d.mts.map +1 -1
  580. package/dist/progress/progress-indicator.mjs +1 -2
  581. package/dist/progress/progress-label.d.mts +1 -3
  582. package/dist/progress/progress-label.d.mts.map +1 -1
  583. package/dist/progress/progress-label.mjs +1 -2
  584. package/dist/progress/progress-root.d.mts +4 -5
  585. package/dist/progress/progress-root.d.mts.map +1 -1
  586. package/dist/progress/progress-root.mjs +4 -5
  587. package/dist/progress/progress-root.mjs.map +1 -1
  588. package/dist/progress/progress-track.d.mts +1 -3
  589. package/dist/progress/progress-track.d.mts.map +1 -1
  590. package/dist/progress/progress-track.mjs +1 -2
  591. package/dist/progress/progress-value.d.mts +1 -3
  592. package/dist/progress/progress-value.d.mts.map +1 -1
  593. package/dist/progress/progress-value.mjs +1 -2
  594. package/dist/radio-group/index.d.mts +1 -3
  595. package/dist/radio-group/index.d.mts.map +1 -1
  596. package/dist/radio-group/index.mjs +1 -2
  597. package/dist/radio-group/radio-group-context.mjs +1 -2
  598. package/dist/radio-group/radio-group-item.d.mts +1 -3
  599. package/dist/radio-group/radio-group-item.d.mts.map +1 -1
  600. package/dist/radio-group/radio-group-item.mjs +3 -4
  601. package/dist/radio-group/radio-group-label.d.mts +1 -3
  602. package/dist/radio-group/radio-group-label.d.mts.map +1 -1
  603. package/dist/radio-group/radio-group-label.mjs +1 -2
  604. package/dist/radio-group/radio-group-root.d.mts +1 -3
  605. package/dist/radio-group/radio-group-root.d.mts.map +1 -1
  606. package/dist/radio-group/radio-group-root.mjs +4 -5
  607. package/dist/select/index.d.mts +1 -3
  608. package/dist/select/index.d.mts.map +1 -1
  609. package/dist/select/index.mjs +1 -2
  610. package/dist/select/select-context.mjs +1 -2
  611. package/dist/select/select-dom.mjs +2 -3
  612. package/dist/select/select-group-label.d.mts +1 -3
  613. package/dist/select/select-group-label.d.mts.map +1 -1
  614. package/dist/select/select-group-label.mjs +1 -2
  615. package/dist/select/select-group.d.mts +1 -3
  616. package/dist/select/select-group.d.mts.map +1 -1
  617. package/dist/select/select-group.mjs +2 -3
  618. package/dist/select/select-option.d.mts +1 -3
  619. package/dist/select/select-option.d.mts.map +1 -1
  620. package/dist/select/select-option.mjs +3 -4
  621. package/dist/select/select-root.d.mts +1 -3
  622. package/dist/select/select-root.d.mts.map +1 -1
  623. package/dist/select/select-root.mjs +6 -7
  624. package/dist/select/select-separator.d.mts +1 -3
  625. package/dist/select/select-separator.d.mts.map +1 -1
  626. package/dist/select/select-separator.mjs +1 -2
  627. package/dist/select/select-trigger.d.mts +1 -3
  628. package/dist/select/select-trigger.d.mts.map +1 -1
  629. package/dist/select/select-trigger.mjs +1 -2
  630. package/dist/select/select-value.d.mts +1 -3
  631. package/dist/select/select-value.d.mts.map +1 -1
  632. package/dist/select/select-value.mjs +3 -4
  633. package/dist/select/select-value.mjs.map +1 -1
  634. package/dist/separator/separator.d.mts +1 -3
  635. package/dist/separator/separator.d.mts.map +1 -1
  636. package/dist/separator/separator.mjs +1 -2
  637. package/dist/slider/index.d.mts +2 -4
  638. package/dist/slider/index.d.mts.map +1 -1
  639. package/dist/slider/index.mjs +1 -2
  640. package/dist/slider/slider-arithmetic.mjs +1 -2
  641. package/dist/slider/slider-context.mjs +1 -2
  642. package/dist/slider/slider-indicator.d.mts +1 -3
  643. package/dist/slider/slider-indicator.d.mts.map +1 -1
  644. package/dist/slider/slider-indicator.mjs +1 -2
  645. package/dist/slider/slider-label.d.mts +1 -3
  646. package/dist/slider/slider-label.d.mts.map +1 -1
  647. package/dist/slider/slider-label.mjs +3 -4
  648. package/dist/slider/slider-root.d.mts +1 -3
  649. package/dist/slider/slider-root.d.mts.map +1 -1
  650. package/dist/slider/slider-root.mjs +8 -9
  651. package/dist/slider/slider-thumb.d.mts +1 -3
  652. package/dist/slider/slider-thumb.d.mts.map +1 -1
  653. package/dist/slider/slider-thumb.mjs +5 -6
  654. package/dist/slider/slider-track.d.mts +1 -3
  655. package/dist/slider/slider-track.d.mts.map +1 -1
  656. package/dist/slider/slider-track.mjs +2 -3
  657. package/dist/slider/slider-value.d.mts +1 -3
  658. package/dist/slider/slider-value.d.mts.map +1 -1
  659. package/dist/slider/slider-value.mjs +1 -2
  660. package/dist/slider/use-slider-dev-warnings.mjs +2 -3
  661. package/dist/slider/use-thumb-registry.mjs +1 -2
  662. package/dist/switch/switch.d.mts +1 -3
  663. package/dist/switch/switch.d.mts.map +1 -1
  664. package/dist/switch/switch.mjs +2 -3
  665. package/dist/tabs/index.d.mts +0 -2
  666. package/dist/tabs/index.d.mts.map +1 -1
  667. package/dist/tabs/index.mjs +1 -2
  668. package/dist/tabs/tabs-context.d.mts +0 -2
  669. package/dist/tabs/tabs-context.d.mts.map +1 -1
  670. package/dist/tabs/tabs-context.mjs +1 -2
  671. package/dist/tabs/tabs-ids.mjs +1 -2
  672. package/dist/tabs/tabs-indicator.d.mts +1 -3
  673. package/dist/tabs/tabs-indicator.d.mts.map +1 -1
  674. package/dist/tabs/tabs-indicator.mjs +1 -2
  675. package/dist/tabs/tabs-list.d.mts +1 -3
  676. package/dist/tabs/tabs-list.d.mts.map +1 -1
  677. package/dist/tabs/tabs-list.mjs +4 -5
  678. package/dist/tabs/tabs-panel.d.mts +1 -3
  679. package/dist/tabs/tabs-panel.d.mts.map +1 -1
  680. package/dist/tabs/tabs-panel.mjs +4 -5
  681. package/dist/tabs/tabs-root.d.mts +1 -3
  682. package/dist/tabs/tabs-root.d.mts.map +1 -1
  683. package/dist/tabs/tabs-root.mjs +5 -6
  684. package/dist/tabs/tabs-tab.d.mts +1 -3
  685. package/dist/tabs/tabs-tab.d.mts.map +1 -1
  686. package/dist/tabs/tabs-tab.mjs +3 -4
  687. package/dist/tabs/use-until-found.mjs +1 -2
  688. package/dist/toast/index.d.mts +2 -4
  689. package/dist/toast/index.d.mts.map +1 -1
  690. package/dist/toast/index.mjs +2 -3
  691. package/dist/toast/toast-action.d.mts +1 -3
  692. package/dist/toast/toast-action.d.mts.map +1 -1
  693. package/dist/toast/toast-action.mjs +2 -3
  694. package/dist/toast/toast-close.d.mts +1 -3
  695. package/dist/toast/toast-close.d.mts.map +1 -1
  696. package/dist/toast/toast-close.mjs +2 -3
  697. package/dist/toast/toast-context.mjs +1 -2
  698. package/dist/toast/toast-description.d.mts +1 -3
  699. package/dist/toast/toast-description.d.mts.map +1 -1
  700. package/dist/toast/toast-description.mjs +2 -3
  701. package/dist/toast/toast-hotkey.mjs +1 -2
  702. package/dist/toast/toast-queue.mjs +1 -2
  703. package/dist/toast/toast-root.d.mts +1 -3
  704. package/dist/toast/toast-root.d.mts.map +1 -1
  705. package/dist/toast/toast-root.mjs +4 -5
  706. package/dist/toast/toast-root.mjs.map +1 -1
  707. package/dist/toast/toast-timers.mjs +1 -2
  708. package/dist/toast/toast-title.d.mts +1 -3
  709. package/dist/toast/toast-title.d.mts.map +1 -1
  710. package/dist/toast/toast-title.mjs +2 -3
  711. package/dist/toast/toast-viewport.d.mts +1 -3
  712. package/dist/toast/toast-viewport.d.mts.map +1 -1
  713. package/dist/toast/toast-viewport.mjs +9 -10
  714. package/dist/toast/toast.d.mts +1 -3
  715. package/dist/toast/toast.d.mts.map +1 -1
  716. package/dist/toast/toast.mjs +1 -2
  717. package/dist/toast/use-modal-portal-host.mjs +2 -3
  718. package/dist/toast/use-toast-announcements.mjs +2 -3
  719. package/dist/toast/use-toast-announcements.mjs.map +1 -1
  720. package/dist/toast/use-toast-focus.mjs +2 -3
  721. package/dist/toast/use-toast-pauses.mjs +2 -3
  722. package/dist/toggle/toggle.d.mts +1 -3
  723. package/dist/toggle/toggle.d.mts.map +1 -1
  724. package/dist/toggle/toggle.mjs +3 -4
  725. package/dist/toggle-group/index.d.mts +0 -2
  726. package/dist/toggle-group/index.d.mts.map +1 -1
  727. package/dist/toggle-group/index.mjs +1 -2
  728. package/dist/toggle-group/toggle-group-context.d.mts +0 -2
  729. package/dist/toggle-group/toggle-group-context.d.mts.map +1 -1
  730. package/dist/toggle-group/toggle-group-context.mjs +1 -2
  731. package/dist/toggle-group/toggle-group-item.d.mts +1 -3
  732. package/dist/toggle-group/toggle-group-item.d.mts.map +1 -1
  733. package/dist/toggle-group/toggle-group-item.mjs +2 -3
  734. package/dist/toggle-group/toggle-group-root.d.mts +1 -3
  735. package/dist/toggle-group/toggle-group-root.d.mts.map +1 -1
  736. package/dist/toggle-group/toggle-group-root.mjs +8 -9
  737. package/dist/toolbar/index.d.mts +0 -2
  738. package/dist/toolbar/index.d.mts.map +1 -1
  739. package/dist/toolbar/index.mjs +1 -2
  740. package/dist/toolbar/toolbar-root.d.mts +1 -3
  741. package/dist/toolbar/toolbar-root.d.mts.map +1 -1
  742. package/dist/toolbar/toolbar-root.mjs +3 -4
  743. package/dist/toolbar/toolbar-separator.d.mts +1 -3
  744. package/dist/toolbar/toolbar-separator.d.mts.map +1 -1
  745. package/dist/toolbar/toolbar-separator.mjs +1 -2
  746. package/dist/tooltip/index.d.mts +0 -2
  747. package/dist/tooltip/index.d.mts.map +1 -1
  748. package/dist/tooltip/index.mjs +1 -2
  749. package/dist/tooltip/tooltip-arrow.d.mts +1 -3
  750. package/dist/tooltip/tooltip-arrow.d.mts.map +1 -1
  751. package/dist/tooltip/tooltip-arrow.mjs +2 -3
  752. package/dist/tooltip/tooltip-context.d.mts +0 -2
  753. package/dist/tooltip/tooltip-context.d.mts.map +1 -1
  754. package/dist/tooltip/tooltip-context.mjs +1 -2
  755. package/dist/tooltip/tooltip-popup.d.mts +1 -3
  756. package/dist/tooltip/tooltip-popup.d.mts.map +1 -1
  757. package/dist/tooltip/tooltip-popup.mjs +4 -5
  758. package/dist/tooltip/tooltip-root.d.mts +1 -3
  759. package/dist/tooltip/tooltip-root.d.mts.map +1 -1
  760. package/dist/tooltip/tooltip-root.mjs +2 -3
  761. package/dist/tooltip/tooltip-trigger.d.mts +1 -3
  762. package/dist/tooltip/tooltip-trigger.d.mts.map +1 -1
  763. package/dist/tooltip/tooltip-trigger.mjs +6 -7
  764. package/dist/tooltip/tooltip-warm.mjs +1 -2
  765. package/dist/tooltip/use-tooltip-interaction.mjs +2 -3
  766. package/package.json +11 -8
  767. package/skills/funstack-ui-knowledge/SKILL.md +5 -2
@@ -1 +1 @@
1
- {"version":3,"file":"use-overlay-close.mjs","names":[],"sources":["../../../src/internal/overlay/use-overlay-close.ts"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties, MouseEvent, ReactNode } from \"react\";\nimport { dataAttr } from \"../data-attr.js\";\nimport type { Action, ActionDetails, RenderProp, StateValue, WhilePending } from \"../types.js\";\nimport { useElementCheck } from \"../use-element-check.js\";\nimport { usePureTrigger } from \"../action/use-pure-trigger.js\";\nimport { cancelClick, disabledButton, rendersButton, useRender } from \"../use-render.js\";\nimport type { DataAttributes } from \"../use-render.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/** The state of Popover.Close and Dialog.Close. */\nexport interface OverlayCloseState {\n /** The `action` is in flight. */\n readonly pending: boolean;\n readonly disabled: boolean;\n}\n\nexport interface OverlayCloseOptions<Details extends ActionDetails> {\n /** Public name of the part (`\"Popover.Close\"`). */\n readonly part: string;\n /** What the part closes, for the development warning (`\"popover\"`). */\n readonly noun: string;\n readonly isLibrary: boolean;\n /** The popup's id (`commandfor`) and the native command. */\n readonly popupId: string;\n readonly command: \"hide-popover\" | \"request-close\";\n readonly openGeneration: () => number;\n readonly action: Action<[details: Details]> | undefined;\n /** The part's `whilePending` prop; `\"ignore\"` when omitted (conventions 2.5.1). */\n readonly whilePending: WhilePending | undefined;\n /** The `action`'s details, built at the click. */\n readonly details: (event: Event) => Details;\n /** The close after the action (or at once without one): through the Root, or natively. */\n readonly close: (event: Event) => void;\n /** Owned keys after `command` (Dialog.Close's `value`). */\n readonly ownProps?: ComponentPropsWithRef<\"button\">;\n readonly disabled: boolean;\n readonly className: StateValue<string | undefined, OverlayCloseState> | undefined;\n readonly style: StateValue<CSSProperties | undefined, OverlayCloseState> | undefined;\n readonly children: StateValue<ReactNode, OverlayCloseState> | undefined;\n readonly render: RenderProp<ComponentPropsWithRef<\"button\">, OverlayCloseState> | undefined;\n readonly rest: Omit<ComponentPropsWithRef<\"button\">, \"className\" | \"style\" | \"children\">;\n}\n\n/**\n * The Close part of a popover-like or dialog overlay (design/components/popover.md 3.4,\n * dialog.md 3.4): `<button type=\"button\" commandfor command>` without `action`, a plain\n * `<button type=\"button\">` with one (#182). In JS-free mode without `action`\n * the browser runs the command. Otherwise the click is cancelled, refused while disabled, and\n * `close` runs, after the `action` when there is one, inside this part's own transition; a\n * second click meanwhile starts nothing (`whilePending`, default `\"ignore\"`) or runs the action\n * again (`\"run\"`; the close happens once, after the last run and only if the latest one\n * resolved), and a close whose open was superseded by a\n * newer one (dismissed and re-opened meanwhile) is dropped (the open-generation guard).\n */\nexport function useOverlayClose<Details extends ActionDetails>(\n options: OverlayCloseOptions<Details>,\n): ReactNode {\n const { part, noun, isLibrary, popupId, command, action, disabled, render } = options;\n // A Close with `action` is no native invoker (#182, alert-dialog.md 3.2): before hydration a\n // click would close the popup without running the action. It renders a plain button, and the\n // click handler is the only thing that closes it.\n const nativeCommand = action === undefined;\n // The library owns the close, so a Close ignores clicks while pending by default (2.5.1).\n const trigger = usePureTrigger({\n whilePending: options.whilePending,\n defaultWhilePending: \"ignore\",\n openGeneration: options.openGeneration,\n });\n const { pending } = trigger;\n const installClick = isLibrary || action !== undefined;\n // JS-free mode without `action` is the browser's command, which only native `disabled` stops.\n const disabledProps = disabledButton(render, disabled, { handlesClick: installClick });\n\n const ref = useElementCheck(\n isDev &&\n ((element) =>\n !installClick && element.tagName !== \"BUTTON\"\n ? `${part}: rendered a <${element.tagName.toLowerCase()}> in JS-free mode without ` +\n `\\`action\\`. Only a <button> runs \\`command=\"${command}\"\\`; this element will not ` +\n `close the ${noun}.`\n : null),\n [installClick],\n );\n\n const onClick = (event: MouseEvent<HTMLElement>) => {\n // Cancelling the click cancels the command.\n event.preventDefault();\n if (disabled) return;\n const native = event.nativeEvent;\n if (action === undefined) {\n options.close(native);\n return;\n }\n const details = options.details(native);\n // An ignored run needs no extra cancel: the click is already cancelled above.\n trigger.run(\n () => action(details),\n () => options.close(native),\n );\n };\n\n const libraryProps: ComponentPropsWithRef<\"button\"> & DataAttributes = {\n ...(rendersButton(render) && { type: \"button\" as const }),\n // Owned: a render element must not re-enable a disabled Close.\n disabled: disabledProps.props.disabled,\n // Only on a button (or a component, assumed to render one): another element is no invoker.\n // Not rendered with `action` (above).\n commandfor:\n nativeCommand && disabledProps.invoker && rendersButton(render) ? popupId : undefined,\n command: nativeCommand && disabledProps.invoker && rendersButton(render) ? command : undefined,\n ...options.ownProps,\n ...(installClick && { onClick }),\n // JS-free mode without `action`, disabled in the `aria-disabled` branch (a host link):\n // nothing native stops the click, so it is cancelled (a disabled link must not navigate).\n ...(!installClick && !disabledProps.invoker && { onClick: cancelClick }),\n // Exactly while `data-pending` when ignoring: a Close that will not act is unavailable to\n // AT; one that runs again is not; native `disabled` wins. Owned, so an idle Close removes a\n // render element's own.\n ...trigger.pendingProps(disabledProps.props),\n \"data-disabled\": dataAttr(disabled),\n };\n\n return useRender<ComponentPropsWithRef<\"button\">, OverlayCloseState>({\n defaultElement: \"button\",\n render,\n state: { pending, disabled },\n className: options.className,\n style: options.style,\n children: options.children,\n props: options.rest,\n libraryProps,\n ref,\n });\n}\n"],"mappings":";;;;;;;AASA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;;;;;;;A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;GAAS;EAAS;EAC3B,WAAW,QAAQ;EACnB,OAAO,QAAQ;EACf,UAAU,QAAQ;EAClB,OAAO,QAAQ;EACf;EACA;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"use-overlay-close.mjs","names":[],"sources":["../../../src/internal/overlay/use-overlay-close.ts"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties, MouseEvent, ReactNode } from \"react\";\nimport { dataAttr } from \"../data-attr.js\";\nimport type { Action, ActionDetails, RenderProp, StateValue, WhilePending } from \"../types.js\";\nimport { useElementCheck } from \"../use-element-check.js\";\nimport { usePureTrigger } from \"../action/use-pure-trigger.js\";\nimport { cancelClick, disabledButton, rendersButton, useRender } from \"../use-render.js\";\nimport type { DataAttributes } from \"../use-render.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/** The state of Popover.Close and Dialog.Close. */\nexport interface OverlayCloseState {\n /**\n * From the click until the close this part asked for has committed: the `action` in flight,\n * then the Root's close (an awaited `openChangeAction(false)`, or an async action the close is\n * entangled with), with or without `action` (conventions 4.3).\n */\n readonly pending: boolean;\n readonly disabled: boolean;\n}\n\nexport interface OverlayCloseOptions<Details extends ActionDetails> {\n /** Public name of the part (`\"Popover.Close\"`). */\n readonly part: string;\n /** What the part closes, for the development warning (`\"popover\"`). */\n readonly noun: string;\n readonly isLibrary: boolean;\n /** The popup's id (`commandfor`) and the native command. */\n readonly popupId: string;\n readonly command: \"hide-popover\" | \"request-close\";\n readonly openGeneration: () => number;\n readonly action: Action<[details: Details]> | undefined;\n /**\n * The part's `whilePending` prop; `\"ignore\"` when omitted, and `\"run\"` whatever it says\n * without `action` (conventions 2.5.1).\n */\n readonly whilePending: WhilePending | undefined;\n /** The `action`'s details, built at the click. */\n readonly details: (event: Event) => Details;\n /** The close after the action (or at once without one): through the Root, or natively. */\n readonly close: (event: Event) => void;\n /** Owned keys after `command` (Dialog.Close's `value`). */\n readonly ownProps?: ComponentPropsWithRef<\"button\">;\n readonly disabled: boolean;\n readonly className: StateValue<string | undefined, OverlayCloseState> | undefined;\n readonly style: StateValue<CSSProperties | undefined, OverlayCloseState> | undefined;\n readonly children: StateValue<ReactNode, OverlayCloseState> | undefined;\n readonly render: RenderProp<ComponentPropsWithRef<\"button\">, OverlayCloseState> | undefined;\n readonly rest: Omit<ComponentPropsWithRef<\"button\">, \"className\" | \"style\" | \"children\">;\n}\n\n/**\n * The Close part of a popover-like or dialog overlay (design/components/popover.md 3.4,\n * dialog.md 3.4): `<button type=\"button\" commandfor command>` without `action`, a plain\n * `<button type=\"button\">` with one (#182). In JS-free mode without `action`\n * the browser runs the command. Otherwise the click is cancelled, refused while disabled, and\n * `close` runs, after the `action` when there is one, inside this part's own transition, so the\n * part is pending until that close has committed (conventions 4.3). Without `action` the close\n * is requested synchronously in the click and a second click requests it again (`whilePending`\n * resolves to `\"run\"`: no pending `aria-disabled`). With one, a second click meanwhile starts\n * nothing (`whilePending`, default `\"ignore\"`) or runs the action again (`\"run\"`; the close\n * happens once, after the last run and only if the latest one resolved), and a close whose open\n * was superseded by a\n * newer one (dismissed and re-opened meanwhile) is dropped (the open-generation guard).\n */\nexport function useOverlayClose<Details extends ActionDetails>(\n options: OverlayCloseOptions<Details>,\n): ReactNode {\n const { part, noun, isLibrary, popupId, command, action, disabled, render } = options;\n // A Close with `action` is no native invoker (#182, alert-dialog.md 3.2): before hydration a\n // click would close the popup without running the action. It renders a plain button, and the\n // click handler is the only thing that closes it.\n const nativeCommand = action === undefined;\n // The library owns the close, so a Close ignores clicks while pending by default (2.5.1).\n // Without `action` there is no run of its own to guard: `\"run\"`, no pending `aria-disabled`.\n const trigger = usePureTrigger({\n whilePending: action === undefined ? \"run\" : options.whilePending,\n defaultWhilePending: \"ignore\",\n openGeneration: options.openGeneration,\n });\n const { pending } = trigger;\n const installClick = isLibrary || action !== undefined;\n // JS-free mode without `action` is the browser's command, which only native `disabled` stops.\n const disabledProps = disabledButton(render, disabled, { handlesClick: installClick });\n\n const ref = useElementCheck(\n isDev &&\n ((element) =>\n !installClick && element.tagName !== \"BUTTON\"\n ? `${part}: rendered a <${element.tagName.toLowerCase()}> in JS-free mode without ` +\n `\\`action\\`. Only a <button> runs \\`command=\"${command}\"\\`; this element will not ` +\n `close the ${noun}.`\n : null),\n [installClick],\n );\n\n const onClick = (event: MouseEvent<HTMLElement>) => {\n // Cancelling the click cancels the command.\n event.preventDefault();\n if (disabled) return;\n const native = event.nativeEvent;\n if (action === undefined) {\n // In the part's own transition, so it shows `data-pending` until the close commits\n // (conventions 4.3). The request is made synchronously in the click: the synchronous\n // prefix of `openChangeAction` still runs during the event dispatch (2.3 item 3).\n trigger.run(() => options.close(native));\n return;\n }\n const details = options.details(native);\n // An ignored run needs no extra cancel: the click is already cancelled above.\n trigger.run(\n () => action(details),\n () => options.close(native),\n );\n };\n\n const libraryProps: ComponentPropsWithRef<\"button\"> & DataAttributes = {\n ...(rendersButton(render) && { type: \"button\" as const }),\n // Owned: a render element must not re-enable a disabled Close.\n disabled: disabledProps.props.disabled,\n // Only on a button (or a component, assumed to render one): another element is no invoker.\n // Not rendered with `action` (above).\n commandfor:\n nativeCommand && disabledProps.invoker && rendersButton(render) ? popupId : undefined,\n command: nativeCommand && disabledProps.invoker && rendersButton(render) ? command : undefined,\n ...options.ownProps,\n ...(installClick && { onClick }),\n // JS-free mode without `action`, disabled in the `aria-disabled` branch (a host link):\n // nothing native stops the click, so it is cancelled (a disabled link must not navigate).\n ...(!installClick && !disabledProps.invoker && { onClick: cancelClick }),\n // Exactly while `data-pending` when ignoring: a Close that will not act is unavailable to\n // AT; one that runs again is not; native `disabled` wins. Owned, so an idle Close removes a\n // render element's own.\n ...trigger.pendingProps(disabledProps.props),\n \"data-disabled\": dataAttr(disabled),\n };\n\n return useRender<ComponentPropsWithRef<\"button\">, OverlayCloseState>({\n defaultElement: \"button\",\n render,\n state: { pending, disabled },\n className: options.className,\n style: options.style,\n children: options.children,\n props: options.rest,\n libraryProps,\n ref,\n });\n}\n"],"mappings":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,aAAa,cAAc,KAAK;EAC3C,iBAAiB,SAAS,QAAQ;CACpC;CAEA,OAAO,UAA8D;EACnE,gBAAgB;EAChB;EACA,OAAO;GAAE;GAAS;EAAS;EAC3B,WAAW,QAAQ;EACnB,OAAO,QAAQ;EACf,UAAU,QAAQ;EAClB,OAAO,QAAQ;EACf;EACA;CACF,CAAC;AACH"}
@@ -1,2 +1,2 @@
1
- import "../types.mjs";
2
- import { RefObject } from "react";
1
+ import "react";
2
+ import "../types.mjs";
@@ -1,14 +1,14 @@
1
1
  "use client";
2
+ import { useCallback, useId, useMemo, useRef, useState } from "react";
2
3
  import { createActionDetails } from "../action/action-details.mjs";
3
- import { useDevWarning } from "../use-dev-warning.mjs";
4
+ import { callUrgentHandler } from "../action/call-urgent-handler.mjs";
5
+ import { isPopoverOpen } from "./popover-open.mjs";
4
6
  import { transitionTypes } from "../transition-types.mjs";
5
- import { useLatest } from "../use-latest.mjs";
6
7
  import { intendedValue, useControllableAction } from "../action/use-controllable-action.mjs";
8
+ import { useDevWarning } from "../use-dev-warning.mjs";
7
9
  import { useMountFixed } from "../use-mount-fixed.mjs";
8
- import { isPopoverOpen } from "./popover-open.mjs";
9
- import { callUrgentHandler } from "../action/call-urgent-handler.mjs";
10
- import { useCallback, useId, useMemo, useRef, useState } from "react";
11
- //#region src/internal/overlay/use-overlay-root.ts
10
+ import { useLatest } from "../use-latest.mjs";
11
+ // src/internal/overlay/use-overlay-root.ts
12
12
  const isDev = process.env.NODE_ENV !== "production";
13
13
  /** How long a recorded close intent survives when the popup did not close (design 2.3). */
14
14
  function clearLater(intentRef, intent, popupRef, isShown) {
@@ -20,7 +20,8 @@ function clearLater(intentRef, intent, popupRef, isShown) {
20
20
  /** What the popup is called in the controlled-without-`onOpenChange` warning. */
21
21
  const nouns = {
22
22
  combobox: "listbox",
23
- "hover-card": "card"
23
+ "hover-card": "card",
24
+ "navigation-menu": "panel"
24
25
  };
25
26
  /** The `details` of a popover-like component: `{ reason }` (and `event`). */
26
27
  const popoverDetails = (event, reason) => createActionDetails(event, { reason });
@@ -35,7 +36,7 @@ function useOverlayRoot(options) {
35
36
  const mode = useMountFixed(isLibraryNow ? "library" : "static", isDev && `${part}: the mode changed after mount (\`open\`, \`defaultOpen\`, \`openChangeAction\` and \`onOpenChange\` were all absent on one render and present on another). Switching between JS-free and library mode is not supported.`);
36
37
  const isLibrary = mode === "library";
37
38
  const noun = nouns[component] ?? component;
38
- useDevWarning(isLibrary && open !== void 0 && onOpenChange === void 0, isDev && `${part}: \`open\` is set without \`onOpenChange\`. The browser can close this ${noun} without asking (Escape, a click outside), and \`onOpenChange\` is where a controlled Root is told. Without it the ${noun} re-opens after every dismissal. Pass \`onOpenChange={setOpen}\`, or \`onOpenChange={() => {}}\` if re-opening is what you want.`);
39
+ useDevWarning(isLibrary && open !== void 0 && onOpenChange === void 0, isDev && `${part}: \`open\` is set without \`onOpenChange\`. The browser can close this ${noun} without asking (Escape, a click outside), and \`onOpenChange\` is where a controlled ${part} is told. Without it the ${noun} re-opens after every dismissal. Pass \`onOpenChange={setOpen}\`, or \`onOpenChange={() => {}}\` if re-opening is what you want.`);
39
40
  const { committed, optimistic, pending, dispatch, latestInFlight, adoptFact, epoch } = useControllableAction({
40
41
  controlled: isLibrary ? open : void 0,
41
42
  defaultValue: isLibrary ? defaultOpen : void 0,
@@ -187,7 +188,6 @@ function usePopoverRoot(options) {
187
188
  hiddenBeforeToggle
188
189
  ]);
189
190
  }
190
- //#endregion
191
191
  export { popoverDetails, useOverlayRoot, usePopoverRoot };
192
192
 
193
193
  //# sourceMappingURL=use-overlay-root.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-overlay-root.mjs","names":[],"sources":["../../../src/internal/overlay/use-overlay-root.ts"],"sourcesContent":["\"use client\";\nimport { useCallback, useId, useMemo, useRef, useState } from \"react\";\nimport type { RefObject } from \"react\";\nimport { createActionDetails } from \"../action/action-details.js\";\nimport { callUrgentHandler } from \"../action/call-urgent-handler.js\";\nimport { isPopoverOpen } from \"./popover-open.js\";\nimport { transitionTypes } from \"../transition-types.js\";\nimport type { ActionDetails, ChangeAction, ChangeReason, UrgentChangeHandler } from \"../types.js\";\nimport { intendedValue, useControllableAction } from \"../action/use-controllable-action.js\";\nimport { useDevWarning } from \"../use-dev-warning.js\";\nimport { useMountFixed } from \"../use-mount-fixed.js\";\nimport { useLatest } from \"../use-latest.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/**\n * \"static\": JS-free mode, the browser owns open and close through Invoker Commands. \"library\":\n * opening and part-initiated closing are library-owned requests (transitions keyed on committed\n * state, `openChangeAction`); dismissals are the browser's facts, adopted urgently and reported to\n * `onOpenChange` (design/components/popover.md section 2, conventions 3.9).\n */\nexport type OverlayMode = \"static\" | \"library\";\n\n/**\n * What caused the next close, recorded just before it happens (design 2.3). The `toggle` event\n * names no cause beyond its invoker (`ToggleEvent.source`: a `popovertarget`, `commandfor` or\n * `interestfor` button); without an intent a close is a `\"dismiss\"`.\n */\nexport interface OverlayCloseIntent {\n readonly reason: ChangeReason;\n readonly event: Event | undefined;\n}\n\n/**\n * The `details` every overlay `openChangeAction` and `onOpenChange` receives (Dialog's adds\n * `returnValue`).\n */\nexport interface OverlayDetails extends ActionDetails {\n readonly reason: ChangeReason;\n}\n\n/** What the parts render from (every part). */\nexport interface OverlayRootState {\n readonly mode: OverlayMode;\n /** `useId`-based ids: the popup, its Title and its Description. */\n readonly ids: { readonly popup: string; readonly title: string; readonly description: string };\n /** Committed open state (library mode); `false` in JS-free mode. */\n readonly committed: boolean;\n /** Optimistic open state (library mode); `false` in JS-free mode. */\n readonly optimistic: boolean;\n /** The Root's transition is pending (library mode). */\n readonly pending: boolean;\n /**\n * Grows with every fact (`notifyClosed`). No part reads it: it is part of the memoised value so\n * that a fact always re-renders the parts, even when a controlled parent keeps `open={true}` and\n * nothing else changed: the Popup's apply effect then re-opens the popup (design 2.4).\n */\n readonly epoch: number;\n}\n\n/**\n * How a part asks for an open or a close, from its handlers: the Triggers, the Close parts,\n * Menu's items, keys and hover intent, Combobox's handlers, Dialog's Form; the Popup too, for a\n * foreign open or close it catches.\n */\nexport interface OverlayRootRequests<CloseArgs extends unknown[]> {\n /**\n * What the user already intends: the latest in-flight dispatch's `next`, else the optimistic\n * value of the last commit. Safe to call from handlers and effects (layout effects included,\n * also in the commit that changed it), and after an `await`. Not during render.\n */\n readonly intended: () => boolean;\n /**\n * Open through the Root's transition (library mode): a Trigger click, a foreign open caught at\n * `beforetoggle`, or mount reconciliation. A no-op when `true` is already intended.\n */\n readonly requestOpen: (event: Event | undefined, reason: ChangeReason) => void;\n /**\n * A library-owned close (library mode): a Trigger click while open, a Close part, Menu's item\n * activation. `openChangeAction(false)` is awaited and the popup hides in the commit. A no-op\n * when `false` is already intended.\n */\n readonly requestClose: (\n event: Event | undefined,\n reason: ChangeReason,\n ...args: CloseArgs\n ) => void;\n /**\n * A counter that grows with every open (a requested open, or the popup being shown). A part\n * whose close runs after an `await` records it first and drops the close when it changed: the\n * user dismissed and re-opened meanwhile (Popover.Close, design 3.4). Handlers only.\n */\n readonly openGeneration: () => number;\n /**\n * Record what causes the next close. Cleared after a task if the popover did not close.\n * `unlessRecorded`: keep an intent already recorded for this close (the `command` listener runs\n * before the `beforetoggle` of the same click).\n */\n readonly recordCloseIntent: (\n intent: OverlayCloseIntent | undefined,\n options?: { readonly unlessRecorded?: boolean },\n ) => void;\n}\n\n/**\n * What only the Popup implementation calls (`usePopoverPopup`, Dialog.Popup and their shared\n * `useApplyOpenState`): the platform events' bookkeeping and the apply effect's in-flight check.\n */\nexport interface OverlayRootPopupChannel<CloseArgs extends unknown[]> {\n /**\n * A fact (#148, conventions 3.9.2): the browser hid the popup and the library did not\n * hide it (the caller has already excluded the library's own hide). Supersedes every request in\n * flight, writes committed `false` urgently (uncontrolled), and calls `onOpenChange(false,\n * details)` synchronously through the handler rule (`callUrgentHandler`). Call it from the\n * platform event's listener (`toggle` / `close`), never inside a transition.\n */\n readonly notifyClosed: (\n event: Event | undefined,\n reason: ChangeReason,\n ...args: CloseArgs\n ) => void;\n /** Advance `openGeneration` (the Popup's `beforetoggle` for an open). */\n readonly nextOpenGeneration: () => void;\n /** Read and clear the recorded intent (the Popup's `toggle` / `close` listener). */\n readonly takeCloseIntent: () => OverlayCloseIntent | undefined;\n /**\n * From `useControllableAction`: the latest in-flight intent, or `null`. Also read by\n * Dialog.Root, for its pending `returnValue`.\n */\n readonly latestInFlight: () => { readonly next: boolean } | null;\n}\n\n/** The two elements, each set by its own part and read by the others. */\nexport interface OverlayRootRefs<Popup extends HTMLElement> {\n /** The registered Trigger: `showPopover({ source })` and the focus-return fallback. */\n readonly triggerRef: RefObject<HTMLElement | null>;\n /** The popup element, set by the Popup's ref; how Close reaches `hidePopover()` / `close()`. */\n readonly popupRef: RefObject<Popup | null>;\n}\n\n/**\n * The Root's state and machinery, shared by Popover, Menu, Combobox (design 14) and Dialog,\n * grouped by who uses it. The component puts it in its own context (the popover-like ones\n * extend it, `PopoverRootValue`). `Popup` is the popup element's type; `CloseArgs` are the extra\n * arguments of a close (Dialog's `returnValue`), passed on to the `details` builder.\n */\nexport interface OverlayRootValue<Popup extends HTMLElement, CloseArgs extends unknown[]>\n extends\n OverlayRootState,\n OverlayRootRequests<CloseArgs>,\n OverlayRootPopupChannel<CloseArgs>,\n OverlayRootRefs<Popup> {}\n\n/**\n * The root value of the popover-like components (Popover, Menu, Combobox), from `usePopoverRoot`:\n * the overlay Root plus the `shown` mirror that their Popup (`usePopoverPopup`) writes and their\n * Triggers (`usePopoverTrigger`, Combobox.Trigger) and the Combobox Input read. Dialog has none.\n */\nexport interface PopoverRootValue extends OverlayRootValue<HTMLElement, []> {\n /**\n * The popup is in the top layer, mirrored from its `toggle` (urgent, conventions 3.5): what\n * `aria-expanded` renders on a non-button Trigger and the Combobox Input (a `<button>`\n * Trigger renders none). Written by the Popup in library mode.\n */\n readonly shown: boolean;\n /** Writes `shown` from the DOM (`:popover-open`); the Popup's `toggle`, ref attach and detach. */\n readonly setShown: (shown: boolean) => void;\n /**\n * The popup was shown at its last `toggle` and the DOM has it hidden now: the browser hid it\n * and its `toggle` has not arrived yet. A non-button Trigger's click lands in that window after\n * light dismiss hid the popup at `pointerup` (#115): it records an `\"activate\"` intent for the\n * fact instead of requesting a close. Handlers only.\n */\n readonly hiddenBeforeToggle: () => boolean;\n}\n\nexport interface UseOverlayRootOptions<\n Details extends ActionDetails,\n Popup extends HTMLElement = HTMLElement,\n CloseArgs extends unknown[] = [],\n> {\n /** Transition types and messages: `\"popover\"` gives `fsui-popover`, `fsui-popover-open`, … */\n readonly component: string;\n /** Public name of the Root part for development warnings (`\"Popover.Root\"`). */\n readonly part: string;\n readonly open: boolean | undefined;\n readonly defaultOpen: boolean | undefined;\n readonly openChangeAction: ChangeAction<boolean, Details> | undefined;\n /** The fact handler (#148): called for a hide the library did not perform. */\n readonly onOpenChange: UrgentChangeHandler<boolean, Details> | undefined;\n /**\n * `\"library\"` forces library mode whatever the props (Menu, which has no JS-free mode). Default:\n * detected from `open` / `defaultOpen` / `openChangeAction` / `onOpenChange` on the first\n * render.\n */\n readonly mode?: \"library\";\n /**\n * Called synchronously for every dispatch, before the action runs, and for every fact, before\n * `onOpenChange` (Menu: cancel hover timers, read the open cause).\n */\n readonly onDispatch?: (next: boolean, details: Details) => void;\n /** Builds the `details` of a dispatch (`popoverDetails`: `{ reason }`); an open passes no args. */\n readonly details: (\n event: Event | undefined,\n reason: ChangeReason,\n ...args: CloseArgs | []\n ) => Details;\n /**\n * Whether the popup is shown, for a stale close intent: `:popover-open` (`usePopoverRoot`), a\n * `<dialog>`'s `open` (Dialog).\n */\n readonly isShown: (popup: Popup) => boolean;\n}\n\n/** How long a recorded close intent survives when the popup did not close (design 2.3). */\nfunction clearLater<Popup extends HTMLElement>(\n intentRef: { current: OverlayCloseIntent | undefined },\n intent: OverlayCloseIntent,\n popupRef: { current: Popup | null },\n isShown: (popup: Popup) => boolean,\n): void {\n setTimeout(() => {\n // Closed: its `toggle` / `close` event (queued as a task) consumes the intent. Still open: the\n // close was cancelled or invalid, so the intent is stale.\n const popup = popupRef.current;\n if (intentRef.current === intent && popup !== null && isShown(popup)) {\n intentRef.current = undefined;\n }\n }, 0);\n}\n\n/** What the popup is called in the controlled-without-`onOpenChange` warning. */\nconst nouns: Record<string, string> = { combobox: \"listbox\", \"hover-card\": \"card\" };\n\n/** The `details` of a popover-like component: `{ reason }` (and `event`). */\nexport const popoverDetails = (event: Event | undefined, reason: ChangeReason): OverlayDetails =>\n createActionDetails(event, { reason });\n\n/**\n * The Root of an overlay without its public props: mode detection (once, from the first\n * render), `useControllableAction<boolean>`, ids, refs, close intents, the open generation and\n * the intent-aware `requestOpen` / `requestClose`, and `notifyClosed` for facts.\n */\nexport function useOverlayRoot<\n Details extends ActionDetails,\n Popup extends HTMLElement = HTMLElement,\n CloseArgs extends unknown[] = [],\n>(options: UseOverlayRootOptions<Details, Popup, CloseArgs>): OverlayRootValue<Popup, CloseArgs> {\n const {\n component,\n part,\n open,\n defaultOpen,\n openChangeAction,\n onOpenChange,\n details,\n onDispatch,\n } = options;\n\n // Mode is decided once, from the first render's props (design 2).\n const isLibraryNow =\n options.mode === \"library\" ||\n open !== undefined ||\n defaultOpen !== undefined ||\n openChangeAction !== undefined ||\n onOpenChange !== undefined;\n const mode = useMountFixed<OverlayMode>(\n isLibraryNow ? \"library\" : \"static\",\n isDev &&\n `${part}: the mode changed after mount (\\`open\\`, \\`defaultOpen\\`, \\`openChangeAction\\` ` +\n \"and `onOpenChange` were all absent on one render and present on another). Switching \" +\n \"between JS-free and library mode is not supported.\",\n );\n const isLibrary = mode === \"library\";\n // W1 (conventions 3.9.13): React's `value` without `onChange`. Static only: a handler\n // that adopts late (in a transition, after an `await`) cannot be told from an intentional\n // re-open, so nothing at runtime warns.\n const noun = nouns[component] ?? component;\n useDevWarning(\n isLibrary && open !== undefined && onOpenChange === undefined,\n isDev &&\n `${part}: \\`open\\` is set without \\`onOpenChange\\`. The browser can close this ${noun} ` +\n \"without asking (Escape, a click outside), and `onOpenChange` is where a controlled Root \" +\n `is told. Without it the ${noun} re-opens after every dismissal. Pass ` +\n \"`onOpenChange={setOpen}`, or `onOpenChange={() => {}}` if re-opening is what you want.\",\n );\n\n // Hooks cannot be conditional: JS-free mode calls the hook too and never dispatches.\n const { committed, optimistic, pending, dispatch, latestInFlight, adoptFact, epoch } =\n useControllableAction<boolean, Details>({\n controlled: isLibrary ? open : undefined,\n defaultValue: isLibrary ? defaultOpen : undefined,\n initialValue: false,\n action: isLibrary ? openChangeAction : undefined,\n transitionTypes: (next) => transitionTypes(component, next ? \"open\" : \"close\"),\n warn: { component: part, prop: \"open\" },\n });\n\n const id = useId();\n const triggerRef = useRef<HTMLElement | null>(null);\n const popupRef = useRef<Popup | null>(null);\n const closeIntent = useRef<OverlayCloseIntent | undefined>(undefined);\n\n // The optimistic value of the last commit, for callers that run after an `await` (a Close\n // action's continuation) and would otherwise read the value of the render they were created in.\n // An insertion effect runs in the mutation phase, before any layout effect of the same commit\n // (a child's included), so `intended()` is current there too.\n const committedOptimistic = useLatest(optimistic);\n // `details`, `onDispatch` and `isShown` are usually inline functions: read the committed render's\n // through a ref so that the functions below, and with them the returned value, stay stable.\n const callbacks = useLatest({ details, onDispatch, onOpenChange, isShown: options.isShown });\n const generation = useRef(0);\n const openGeneration = useCallback(() => generation.current, []);\n const nextOpenGeneration = useCallback(() => {\n generation.current++;\n }, []);\n\n const recordCloseIntent = useCallback(\n (intent: OverlayCloseIntent | undefined, options?: { readonly unlessRecorded?: boolean }) => {\n if (options?.unlessRecorded === true && closeIntent.current !== undefined) return;\n closeIntent.current = intent;\n if (intent !== undefined) {\n clearLater(closeIntent, intent, popupRef, callbacks.current.isShown);\n }\n },\n [callbacks],\n );\n const takeCloseIntent = useCallback(() => {\n const intent = closeIntent.current;\n closeIntent.current = undefined;\n return intent;\n }, []);\n\n // Conventions 3.8 rule 1: judge no-ops against what the user already intends. That also\n // deduplicates the StrictMode re-run of the mount reconciliation and recognises the library's\n // own `hidePopover()` echoing back through `toggle`.\n const intended = useCallback(\n (): boolean => intendedValue(latestInFlight, committedOptimistic.current),\n [latestInFlight, committedOptimistic],\n );\n\n const send = useCallback(\n (next: boolean, event: Event | undefined, reason: ChangeReason, args: CloseArgs | []): void => {\n const { details, onDispatch } = callbacks.current;\n const built = details(event, reason, ...args);\n if (next) nextOpenGeneration();\n onDispatch?.(next, built);\n dispatch(next, built);\n },\n [callbacks, nextOpenGeneration, dispatch],\n );\n\n const requestOpen = useCallback(\n (event: Event | undefined, reason: ChangeReason): void => {\n if (!isLibrary || intended()) return;\n send(true, event, reason, []);\n },\n [isLibrary, intended, send],\n );\n\n const requestClose = useCallback(\n (event: Event | undefined, reason: ChangeReason, ...args: CloseArgs): void => {\n if (!isLibrary || !intended()) return;\n send(false, event, reason, args);\n },\n [isLibrary, intended, send],\n );\n\n const notifyClosed = useCallback(\n (event: Event | undefined, reason: ChangeReason, ...args: CloseArgs): void => {\n if (!isLibrary) return;\n const { details, onDispatch, onOpenChange } = callbacks.current;\n const built = details(event, reason, ...args);\n onDispatch?.(false, built);\n // Supersede the requests in flight and write committed `false` (urgent), then tell the\n // consumer; both in the platform event, so one discrete commit follows (design 2.3).\n adoptFact(false);\n callUrgentHandler(onOpenChange, false, built);\n },\n [isLibrary, callbacks, adoptFact],\n );\n\n const ids = useMemo(\n () => ({ popup: id, title: `${id}-title`, description: `${id}-description` }),\n [id],\n );\n\n // Memoised: every function above is stable, so the value changes only with the open state and\n // pending, and the components' context values built on it are reused otherwise.\n return useMemo(\n () => ({\n mode,\n ids,\n committed: isLibrary && committed,\n optimistic: isLibrary && optimistic,\n pending: isLibrary && pending,\n epoch,\n intended,\n openGeneration,\n nextOpenGeneration,\n requestOpen,\n requestClose,\n notifyClosed,\n latestInFlight,\n triggerRef,\n popupRef,\n recordCloseIntent,\n takeCloseIntent,\n }),\n [\n mode,\n ids,\n isLibrary,\n committed,\n optimistic,\n pending,\n epoch,\n intended,\n openGeneration,\n nextOpenGeneration,\n requestOpen,\n requestClose,\n notifyClosed,\n latestInFlight,\n recordCloseIntent,\n takeCloseIntent,\n ],\n );\n}\n\n/**\n * The Root of a popover-like component (Popover, Menu, Combobox): `useOverlayRoot` over a\n * `popover` element (`:popover-open`), plus the `shown` mirror and `hiddenBeforeToggle`.\n */\nexport function usePopoverRoot<Details extends ActionDetails>(\n options: Omit<UseOverlayRootOptions<Details>, \"isShown\">,\n): PopoverRootValue {\n const root = useOverlayRoot<Details>({ ...options, isShown: isPopoverOpen });\n const { popupRef } = root;\n\n const [shown, setShownState] = useState(false);\n // The last value written, for handlers (`hiddenBeforeToggle`).\n const shownNow = useRef(false);\n const setShown = useCallback((next: boolean) => {\n shownNow.current = next;\n setShownState(next);\n }, []);\n const hiddenBeforeToggle = useCallback((): boolean => {\n const popup = popupRef.current;\n return shownNow.current && popup !== null && !isPopoverOpen(popup);\n }, [popupRef]);\n\n // Changes only with `root` and `shown`, so as rarely as `root` itself does.\n return useMemo(\n () => ({ ...root, shown, setShown, hiddenBeforeToggle }),\n [root, shown, setShown, hiddenBeforeToggle],\n );\n}\n"],"mappings":";;;;;;;;;;;AAaA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;AA0MvC,SAAS,WACP,WACA,QACA,UACA,SACM;CACN,iBAAiB;EAGf,MAAM,QAAQ,SAAS;EACvB,IAAI,UAAU,YAAY,UAAU,UAAU,QAAQ,QAAQ,KAAK,GACjE,UAAU,UAAU,KAAA;CAExB,GAAG,CAAC;AACN;;AAGA,MAAM,QAAgC;CAAE,UAAU;CAAW,cAAc;AAAO;;AAGlF,MAAa,kBAAkB,OAA0B,WACvD,oBAAoB,OAAO,EAAE,OAAO,CAAC;;;;;;AAOvC,SAAgB,eAId,SAA+F;CAC/F,MAAM,EACJ,WACA,MACA,MACA,aACA,kBACA,cACA,SACA,eACE;CAGJ,MAAM,eACJ,QAAQ,SAAS,aACjB,SAAS,KAAA,KACT,gBAAgB,KAAA,KAChB,qBAAqB,KAAA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A;EACA;EACA;EACA;EACA;EACA;CACF,IACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;AACF;;;;;AAMA,SAAgB,eACd,SACkB;CAClB,MAAM,OAAO,eAAwB;EAAE,GAAG;EAAS,SAAS;CAAc,CAAC;CAC3E,MAAM,EAAE,aAAa;CAErB,MAAM,CAAC,OAAO,iBAAiB,SAAS,KAAK;CAE7C,MAAM,WAAW,OAAO,KAAK;CAC7B,MAAM,WAAW,aAAa,SAAkB;EAC9C,SAAS,UAAU;EACnB,cAAc,IAAI;CACpB,GAAG,CAAC,CAAC;CACL,MAAM,qBAAqB,kBAA2B;EACpD,MAAM,QAAQ,SAAS;EACvB,OAAO,SAAS,WAAW,UAAU,QAAQ,CAAC,cAAc,KAAK;CACnE,GAAG,CAAC,QAAQ,CAAC;CAGb,OAAO,eACE;EAAE,GAAG;EAAM;EAAO;EAAU;CAAmB,IACtD;EAAC;EAAM;EAAO;EAAU;CAAkB,CAC5C;AACF"}
1
+ {"version":3,"file":"use-overlay-root.mjs","names":[],"sources":["../../../src/internal/overlay/use-overlay-root.ts"],"sourcesContent":["\"use client\";\nimport { useCallback, useId, useMemo, useRef, useState } from \"react\";\nimport type { RefObject } from \"react\";\nimport { createActionDetails } from \"../action/action-details.js\";\nimport { callUrgentHandler } from \"../action/call-urgent-handler.js\";\nimport { isPopoverOpen } from \"./popover-open.js\";\nimport { transitionTypes } from \"../transition-types.js\";\nimport type { ActionDetails, ChangeAction, ChangeReason, UrgentChangeHandler } from \"../types.js\";\nimport { intendedValue, useControllableAction } from \"../action/use-controllable-action.js\";\nimport { useDevWarning } from \"../use-dev-warning.js\";\nimport { useMountFixed } from \"../use-mount-fixed.js\";\nimport { useLatest } from \"../use-latest.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/**\n * \"static\": JS-free mode, the browser owns open and close through Invoker Commands. \"library\":\n * opening and part-initiated closing are library-owned requests (transitions keyed on committed\n * state, `openChangeAction`); dismissals are the browser's facts, adopted urgently and reported to\n * `onOpenChange` (design/components/popover.md section 2, conventions 3.9).\n */\nexport type OverlayMode = \"static\" | \"library\";\n\n/**\n * What caused the next close, recorded just before it happens (design 2.3). The `toggle` event\n * names no cause beyond its invoker (`ToggleEvent.source`: a `popovertarget`, `commandfor` or\n * `interestfor` button); without an intent a close is a `\"dismiss\"`.\n */\nexport interface OverlayCloseIntent {\n readonly reason: ChangeReason;\n readonly event: Event | undefined;\n}\n\n/**\n * The `details` every overlay `openChangeAction` and `onOpenChange` receives (Dialog's adds\n * `returnValue`).\n */\nexport interface OverlayDetails extends ActionDetails {\n readonly reason: ChangeReason;\n}\n\n/** What the parts render from (every part). */\nexport interface OverlayRootState {\n readonly mode: OverlayMode;\n /** `useId`-based ids: the popup, its Title and its Description. */\n readonly ids: { readonly popup: string; readonly title: string; readonly description: string };\n /** Committed open state (library mode); `false` in JS-free mode. */\n readonly committed: boolean;\n /** Optimistic open state (library mode); `false` in JS-free mode. */\n readonly optimistic: boolean;\n /** The Root's transition is pending (library mode). */\n readonly pending: boolean;\n /**\n * Grows with every fact (`notifyClosed`). No part reads it: it is part of the memoised value so\n * that a fact always re-renders the parts, even when a controlled parent keeps `open={true}` and\n * nothing else changed: the Popup's apply effect then re-opens the popup (design 2.4).\n */\n readonly epoch: number;\n}\n\n/**\n * How a part asks for an open or a close, from its handlers: the Triggers, the Close parts,\n * Menu's items, keys and hover intent, Combobox's handlers, Dialog's Form; the Popup too, for a\n * foreign open or close it catches.\n */\nexport interface OverlayRootRequests<CloseArgs extends unknown[]> {\n /**\n * What the user already intends: the latest in-flight dispatch's `next`, else the optimistic\n * value of the last commit. Safe to call from handlers and effects (layout effects included,\n * also in the commit that changed it), and after an `await`. Not during render.\n */\n readonly intended: () => boolean;\n /**\n * Open through the Root's transition (library mode): a Trigger click, a foreign open caught at\n * `beforetoggle`, or mount reconciliation. A no-op when `true` is already intended.\n */\n readonly requestOpen: (event: Event | undefined, reason: ChangeReason) => void;\n /**\n * A library-owned close (library mode): a Trigger click while open, a Close part, Menu's item\n * activation. `openChangeAction(false)` is awaited and the popup hides in the commit. A no-op\n * when `false` is already intended.\n */\n readonly requestClose: (\n event: Event | undefined,\n reason: ChangeReason,\n ...args: CloseArgs\n ) => void;\n /**\n * A counter that grows with every open (a requested open, or the popup being shown). A part\n * whose close runs after an `await` records it first and drops the close when it changed: the\n * user dismissed and re-opened meanwhile (Popover.Close, design 3.4). Handlers only.\n */\n readonly openGeneration: () => number;\n /**\n * Record what causes the next close. Cleared after a task if the popover did not close.\n * `unlessRecorded`: keep an intent already recorded for this close (the `command` listener runs\n * before the `beforetoggle` of the same click).\n */\n readonly recordCloseIntent: (\n intent: OverlayCloseIntent | undefined,\n options?: { readonly unlessRecorded?: boolean },\n ) => void;\n}\n\n/**\n * What only the Popup implementation calls (`usePopoverPopup`, Dialog.Popup and their shared\n * `useApplyOpenState`): the platform events' bookkeeping and the apply effect's in-flight check.\n */\nexport interface OverlayRootPopupChannel<CloseArgs extends unknown[]> {\n /**\n * A fact (#148, conventions 3.9.2): the browser hid the popup and the library did not\n * hide it (the caller has already excluded the library's own hide). Supersedes every request in\n * flight, writes committed `false` urgently (uncontrolled), and calls `onOpenChange(false,\n * details)` synchronously through the handler rule (`callUrgentHandler`). Call it from the\n * platform event's listener (`toggle` / `close`), never inside a transition.\n */\n readonly notifyClosed: (\n event: Event | undefined,\n reason: ChangeReason,\n ...args: CloseArgs\n ) => void;\n /** Advance `openGeneration` (the Popup's `beforetoggle` for an open). */\n readonly nextOpenGeneration: () => void;\n /** Read and clear the recorded intent (the Popup's `toggle` / `close` listener). */\n readonly takeCloseIntent: () => OverlayCloseIntent | undefined;\n /**\n * From `useControllableAction`: the latest in-flight intent, or `null`. Also read by\n * Dialog.Root, for its pending `returnValue`.\n */\n readonly latestInFlight: () => { readonly next: boolean } | null;\n}\n\n/** The two elements, each set by its own part and read by the others. */\nexport interface OverlayRootRefs<Popup extends HTMLElement> {\n /** The registered Trigger: `showPopover({ source })` and the focus-return fallback. */\n readonly triggerRef: RefObject<HTMLElement | null>;\n /** The popup element, set by the Popup's ref; how Close reaches `hidePopover()` / `close()`. */\n readonly popupRef: RefObject<Popup | null>;\n}\n\n/**\n * The Root's state and machinery, shared by Popover, Menu, Combobox (design 14) and Dialog,\n * grouped by who uses it. The component puts it in its own context (the popover-like ones\n * extend it, `PopoverRootValue`). `Popup` is the popup element's type; `CloseArgs` are the extra\n * arguments of a close (Dialog's `returnValue`), passed on to the `details` builder.\n */\nexport interface OverlayRootValue<Popup extends HTMLElement, CloseArgs extends unknown[]>\n extends\n OverlayRootState,\n OverlayRootRequests<CloseArgs>,\n OverlayRootPopupChannel<CloseArgs>,\n OverlayRootRefs<Popup> {}\n\n/**\n * The root value of the popover-like components (Popover, Menu, Combobox), from `usePopoverRoot`:\n * the overlay Root plus the `shown` mirror that their Popup (`usePopoverPopup`) writes and their\n * Triggers (`usePopoverTrigger`, Combobox.Trigger) and the Combobox Input read. Dialog has none.\n */\nexport interface PopoverRootValue extends OverlayRootValue<HTMLElement, []> {\n /**\n * The popup is in the top layer, mirrored from its `toggle` (urgent, conventions 3.5): what\n * `aria-expanded` renders on a non-button Trigger and the Combobox Input (a `<button>`\n * Trigger renders none). Written by the Popup in library mode.\n */\n readonly shown: boolean;\n /** Writes `shown` from the DOM (`:popover-open`); the Popup's `toggle`, ref attach and detach. */\n readonly setShown: (shown: boolean) => void;\n /**\n * The popup was shown at its last `toggle` and the DOM has it hidden now: the browser hid it\n * and its `toggle` has not arrived yet. A non-button Trigger's click lands in that window after\n * light dismiss hid the popup at `pointerup` (#115): it records an `\"activate\"` intent for the\n * fact instead of requesting a close. Handlers only.\n */\n readonly hiddenBeforeToggle: () => boolean;\n}\n\nexport interface UseOverlayRootOptions<\n Details extends ActionDetails,\n Popup extends HTMLElement = HTMLElement,\n CloseArgs extends unknown[] = [],\n> {\n /** Transition types and messages: `\"popover\"` gives `fsui-popover`, `fsui-popover-open`, … */\n readonly component: string;\n /** Public name of the Root part for development warnings (`\"Popover.Root\"`). */\n readonly part: string;\n readonly open: boolean | undefined;\n readonly defaultOpen: boolean | undefined;\n readonly openChangeAction: ChangeAction<boolean, Details> | undefined;\n /** The fact handler (#148): called for a hide the library did not perform. */\n readonly onOpenChange: UrgentChangeHandler<boolean, Details> | undefined;\n /**\n * `\"library\"` forces library mode whatever the props (Menu, which has no JS-free mode). Default:\n * detected from `open` / `defaultOpen` / `openChangeAction` / `onOpenChange` on the first\n * render.\n */\n readonly mode?: \"library\";\n /**\n * Called synchronously for every dispatch, before the action runs, and for every fact, before\n * `onOpenChange` (Menu: cancel hover timers, read the open cause).\n */\n readonly onDispatch?: (next: boolean, details: Details) => void;\n /** Builds the `details` of a dispatch (`popoverDetails`: `{ reason }`); an open passes no args. */\n readonly details: (\n event: Event | undefined,\n reason: ChangeReason,\n ...args: CloseArgs | []\n ) => Details;\n /**\n * Whether the popup is shown, for a stale close intent: `:popover-open` (`usePopoverRoot`), a\n * `<dialog>`'s `open` (Dialog).\n */\n readonly isShown: (popup: Popup) => boolean;\n}\n\n/** How long a recorded close intent survives when the popup did not close (design 2.3). */\nfunction clearLater<Popup extends HTMLElement>(\n intentRef: { current: OverlayCloseIntent | undefined },\n intent: OverlayCloseIntent,\n popupRef: { current: Popup | null },\n isShown: (popup: Popup) => boolean,\n): void {\n setTimeout(() => {\n // Closed: its `toggle` / `close` event (queued as a task) consumes the intent. Still open: the\n // close was cancelled or invalid, so the intent is stale.\n const popup = popupRef.current;\n if (intentRef.current === intent && popup !== null && isShown(popup)) {\n intentRef.current = undefined;\n }\n }, 0);\n}\n\n/** What the popup is called in the controlled-without-`onOpenChange` warning. */\nconst nouns: Record<string, string> = {\n combobox: \"listbox\",\n \"hover-card\": \"card\",\n \"navigation-menu\": \"panel\",\n};\n\n/** The `details` of a popover-like component: `{ reason }` (and `event`). */\nexport const popoverDetails = (event: Event | undefined, reason: ChangeReason): OverlayDetails =>\n createActionDetails(event, { reason });\n\n/**\n * The Root of an overlay without its public props: mode detection (once, from the first\n * render), `useControllableAction<boolean>`, ids, refs, close intents, the open generation and\n * the intent-aware `requestOpen` / `requestClose`, and `notifyClosed` for facts.\n */\nexport function useOverlayRoot<\n Details extends ActionDetails,\n Popup extends HTMLElement = HTMLElement,\n CloseArgs extends unknown[] = [],\n>(options: UseOverlayRootOptions<Details, Popup, CloseArgs>): OverlayRootValue<Popup, CloseArgs> {\n const {\n component,\n part,\n open,\n defaultOpen,\n openChangeAction,\n onOpenChange,\n details,\n onDispatch,\n } = options;\n\n // Mode is decided once, from the first render's props (design 2).\n const isLibraryNow =\n options.mode === \"library\" ||\n open !== undefined ||\n defaultOpen !== undefined ||\n openChangeAction !== undefined ||\n onOpenChange !== undefined;\n const mode = useMountFixed<OverlayMode>(\n isLibraryNow ? \"library\" : \"static\",\n isDev &&\n `${part}: the mode changed after mount (\\`open\\`, \\`defaultOpen\\`, \\`openChangeAction\\` ` +\n \"and `onOpenChange` were all absent on one render and present on another). Switching \" +\n \"between JS-free and library mode is not supported.\",\n );\n const isLibrary = mode === \"library\";\n // W1 (conventions 3.9.13): React's `value` without `onChange`. Static only: a handler\n // that adopts late (in a transition, after an `await`) cannot be told from an intentional\n // re-open, so nothing at runtime warns.\n const noun = nouns[component] ?? component;\n useDevWarning(\n isLibrary && open !== undefined && onOpenChange === undefined,\n isDev &&\n `${part}: \\`open\\` is set without \\`onOpenChange\\`. The browser can close this ${noun} ` +\n \"without asking (Escape, a click outside), and `onOpenChange` is where a controlled \" +\n `${part} is told. Without it the ${noun} re-opens after every dismissal. Pass ` +\n \"`onOpenChange={setOpen}`, or `onOpenChange={() => {}}` if re-opening is what you want.\",\n );\n\n // Hooks cannot be conditional: JS-free mode calls the hook too and never dispatches.\n const { committed, optimistic, pending, dispatch, latestInFlight, adoptFact, epoch } =\n useControllableAction<boolean, Details>({\n controlled: isLibrary ? open : undefined,\n defaultValue: isLibrary ? defaultOpen : undefined,\n initialValue: false,\n action: isLibrary ? openChangeAction : undefined,\n transitionTypes: (next) => transitionTypes(component, next ? \"open\" : \"close\"),\n warn: { component: part, prop: \"open\" },\n });\n\n const id = useId();\n const triggerRef = useRef<HTMLElement | null>(null);\n const popupRef = useRef<Popup | null>(null);\n const closeIntent = useRef<OverlayCloseIntent | undefined>(undefined);\n\n // The optimistic value of the last commit, for callers that run after an `await` (a Close\n // action's continuation) and would otherwise read the value of the render they were created in.\n // An insertion effect runs in the mutation phase, before any layout effect of the same commit\n // (a child's included), so `intended()` is current there too.\n const committedOptimistic = useLatest(optimistic);\n // `details`, `onDispatch` and `isShown` are usually inline functions: read the committed render's\n // through a ref so that the functions below, and with them the returned value, stay stable.\n const callbacks = useLatest({ details, onDispatch, onOpenChange, isShown: options.isShown });\n const generation = useRef(0);\n const openGeneration = useCallback(() => generation.current, []);\n const nextOpenGeneration = useCallback(() => {\n generation.current++;\n }, []);\n\n const recordCloseIntent = useCallback(\n (intent: OverlayCloseIntent | undefined, options?: { readonly unlessRecorded?: boolean }) => {\n if (options?.unlessRecorded === true && closeIntent.current !== undefined) return;\n closeIntent.current = intent;\n if (intent !== undefined) {\n clearLater(closeIntent, intent, popupRef, callbacks.current.isShown);\n }\n },\n [callbacks],\n );\n const takeCloseIntent = useCallback(() => {\n const intent = closeIntent.current;\n closeIntent.current = undefined;\n return intent;\n }, []);\n\n // Conventions 3.8 rule 1: judge no-ops against what the user already intends. That also\n // deduplicates the StrictMode re-run of the mount reconciliation and recognises the library's\n // own `hidePopover()` echoing back through `toggle`.\n const intended = useCallback(\n (): boolean => intendedValue(latestInFlight, committedOptimistic.current),\n [latestInFlight, committedOptimistic],\n );\n\n const send = useCallback(\n (next: boolean, event: Event | undefined, reason: ChangeReason, args: CloseArgs | []): void => {\n const { details, onDispatch } = callbacks.current;\n const built = details(event, reason, ...args);\n if (next) nextOpenGeneration();\n onDispatch?.(next, built);\n dispatch(next, built);\n },\n [callbacks, nextOpenGeneration, dispatch],\n );\n\n const requestOpen = useCallback(\n (event: Event | undefined, reason: ChangeReason): void => {\n if (!isLibrary || intended()) return;\n send(true, event, reason, []);\n },\n [isLibrary, intended, send],\n );\n\n const requestClose = useCallback(\n (event: Event | undefined, reason: ChangeReason, ...args: CloseArgs): void => {\n if (!isLibrary || !intended()) return;\n send(false, event, reason, args);\n },\n [isLibrary, intended, send],\n );\n\n const notifyClosed = useCallback(\n (event: Event | undefined, reason: ChangeReason, ...args: CloseArgs): void => {\n if (!isLibrary) return;\n const { details, onDispatch, onOpenChange } = callbacks.current;\n const built = details(event, reason, ...args);\n onDispatch?.(false, built);\n // Supersede the requests in flight and write committed `false` (urgent), then tell the\n // consumer; both in the platform event, so one discrete commit follows (design 2.3).\n adoptFact(false);\n callUrgentHandler(onOpenChange, false, built);\n },\n [isLibrary, callbacks, adoptFact],\n );\n\n const ids = useMemo(\n () => ({ popup: id, title: `${id}-title`, description: `${id}-description` }),\n [id],\n );\n\n // Memoised: every function above is stable, so the value changes only with the open state and\n // pending, and the components' context values built on it are reused otherwise.\n return useMemo(\n () => ({\n mode,\n ids,\n committed: isLibrary && committed,\n optimistic: isLibrary && optimistic,\n pending: isLibrary && pending,\n epoch,\n intended,\n openGeneration,\n nextOpenGeneration,\n requestOpen,\n requestClose,\n notifyClosed,\n latestInFlight,\n triggerRef,\n popupRef,\n recordCloseIntent,\n takeCloseIntent,\n }),\n [\n mode,\n ids,\n isLibrary,\n committed,\n optimistic,\n pending,\n epoch,\n intended,\n openGeneration,\n nextOpenGeneration,\n requestOpen,\n requestClose,\n notifyClosed,\n latestInFlight,\n recordCloseIntent,\n takeCloseIntent,\n ],\n );\n}\n\n/**\n * The Root of a popover-like component (Popover, Menu, Combobox): `useOverlayRoot` over a\n * `popover` element (`:popover-open`), plus the `shown` mirror and `hiddenBeforeToggle`.\n */\nexport function usePopoverRoot<Details extends ActionDetails>(\n options: Omit<UseOverlayRootOptions<Details>, \"isShown\">,\n): PopoverRootValue {\n const root = useOverlayRoot<Details>({ ...options, isShown: isPopoverOpen });\n const { popupRef } = root;\n\n const [shown, setShownState] = useState(false);\n // The last value written, for handlers (`hiddenBeforeToggle`).\n const shownNow = useRef(false);\n const setShown = useCallback((next: boolean) => {\n shownNow.current = next;\n setShownState(next);\n }, []);\n const hiddenBeforeToggle = useCallback((): boolean => {\n const popup = popupRef.current;\n return shownNow.current && popup !== null && !isPopoverOpen(popup);\n }, [popupRef]);\n\n // Changes only with `root` and `shown`, so as rarely as `root` itself does.\n return useMemo(\n () => ({ ...root, shown, setShown, hiddenBeforeToggle }),\n [root, shown, setShown, hiddenBeforeToggle],\n );\n}\n"],"mappings":";;;;;;;;;;;AAaA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;AA0MvC,SAAS,WACP,WACA,QACA,UACA,SACM;CACN,iBAAiB;EAGf,MAAM,QAAQ,SAAS;EACvB,IAAI,UAAU,YAAY,UAAU,UAAU,QAAQ,QAAQ,KAAK,GACjE,UAAU,UAAU,KAAA;CAExB,GAAG,CAAC;AACN;;AAGA,MAAM,QAAgC;CACpC,UAAU;CACV,cAAc;CACd,mBAAmB;AACrB;;AAGA,MAAa,kBAAkB,OAA0B,WACvD,oBAAoB,OAAO,EAAE,OAAO,CAAC;;;;;;AAOvC,SAAgB,eAId,SAA+F;CAC/F,MAAM,EACJ,WACA,MACA,MACA,aACA,kBACA,cACA,SACA,eACE;CAGJ,MAAM,eACJ,QAAQ,SAAS,aACjB,SAAS,KAAA,KACT,gBAAgB,KAAA,KAChB,qBAAqB,KAAA,KACrB,iBAAiB,KAAA;CACnB,MAAM,OAAO,cACX,eAAe,YAAY,UAC3B,SACE,GAAG,KAAK,yNAGZ;CACA,MAAM,YAAY,SAAS;CAI3B,MAAM,OAAO,MAAM,cAAc;CACjC,cACE,aAAa,SAAS,KAAA,KAAa,iBAAiB,KAAA,GACpD,SACE,GAAG,KAAK,yEAAyE,KAAK,wFAEjF,KAAK,2BAA2B,KAAK,iIAE9C;CAGA,MAAM,EAAE,WAAW,YAAY,SAAS,UAAU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,MAAM,WAAW,OAAO,KAAK;CAC7B,MAAM,WAAW,aAAa,SAAkB;EAC9C,SAAS,UAAU;EACnB,cAAc,IAAI;CACpB,GAAG,CAAC,CAAC;CACL,MAAM,qBAAqB,kBAA2B;EACpD,MAAM,QAAQ,SAAS;EACvB,OAAO,SAAS,WAAW,UAAU,QAAQ,CAAC,cAAc,KAAK;CACnE,GAAG,CAAC,QAAQ,CAAC;CAGb,OAAO,eACE;EAAE,GAAG;EAAM;EAAO;EAAU;CAAmB,IACtD;EAAC;EAAM;EAAO;EAAU;CAAkB,CAC5C;AACF"}
@@ -1,18 +1,18 @@
1
1
  "use client";
2
- import { useLatest } from "../use-latest.mjs";
3
- import { useElementCheck } from "../use-element-check.mjs";
4
- import { isPopoverOpen } from "./popover-open.mjs";
5
- import { closedByPopoverTarget } from "./invokers.mjs";
2
+ import { useCallback, useEffect, useEffectEvent, useLayoutEffect, useRef, useState } from "react";
6
3
  import { useContentFocusProbe } from "./content-focus-probe.mjs";
7
4
  import { withCssTransitionCut } from "./css-transition-cut.mjs";
5
+ import { closedByPopoverTarget } from "./invokers.mjs";
8
6
  import { supportsFocusVisibleOption } from "./focus-visible.mjs";
9
7
  import { commandOf, renderOverlayContent, resolveInitialFocus, returnFocusToTrigger, useCloseHold, useInitialFocusTarget } from "./overlay-popup.mjs";
10
8
  import { createPopupFlags, showWithFocus } from "./overlay-show.mjs";
11
9
  import { useApplyOpenState } from "./use-apply-open-state.mjs";
10
+ import { isPopoverOpen } from "./popover-open.mjs";
11
+ import { useElementCheck } from "../use-element-check.mjs";
12
12
  import { useInterestDismiss } from "./use-interest-dismiss.mjs";
13
+ import { useLatest } from "../use-latest.mjs";
13
14
  import { useShownNameWarning } from "../use-name-warning.mjs";
14
- import { useCallback, useEffect, useEffectEvent, useLayoutEffect, useRef, useState } from "react";
15
- //#region src/internal/overlay/use-popover-popup.ts
15
+ // src/internal/overlay/use-popover-popup.ts
16
16
  const isDev = process.env.NODE_ENV !== "production";
17
17
  const DEFAULT_ELEMENTS = ["DIALOG", "DIV"];
18
18
  /** `["DIALOG", "DIV"]` as "a <dialog> or a <div>". */
@@ -281,7 +281,6 @@ function usePopoverPopup(ctx, options) {
281
281
  reshow
282
282
  };
283
283
  }
284
- //#endregion
285
284
  export { usePopoverPopup };
286
285
 
287
286
  //# sourceMappingURL=use-popover-popup.mjs.map
@@ -1,8 +1,7 @@
1
+ import "react";
1
2
  import "../types.mjs";
2
- import "./use-overlay-root.mjs";
3
3
  import "../use-render.mjs";
4
- import { ComponentPropsWithRef } from "react";
5
- //#region src/internal/overlay/use-popover-trigger.d.ts
4
+ import "./use-overlay-root.mjs";
6
5
  /** The state of an overlay Trigger (Popover.Trigger, Menu.Trigger and its siblings). */
7
6
  export interface PopoverTriggerHookState {
8
7
  /** Optimistic open state. A Popover in JS-free mode (the browser owns it) reports `false`. */
@@ -12,5 +11,4 @@ export interface PopoverTriggerHookState {
12
11
  /** The `disabled` prop. */
13
12
  readonly disabled: boolean;
14
13
  }
15
- //#endregion
16
14
  //# sourceMappingURL=use-popover-trigger.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-popover-trigger.d.mts","names":[],"sources":["../../../src/internal/overlay/use-popover-trigger.ts"],"mappings":";;;;;;iBA8EiB;;WAEN;;WAEA;;WAEA"}
1
+ {"version":3,"file":"use-popover-trigger.d.mts","names":[],"sources":["../../../src/internal/overlay/use-popover-trigger.ts"],"mappings":";;;;;iBA8EiB;;WAEN;;WAEA;;WAEA"}
@@ -1,11 +1,11 @@
1
1
  "use client";
2
+ import { useCallback } from "react";
2
3
  import { dataAttr } from "../data-attr.mjs";
3
- import { cancelClick, disabledButton, rendersButton } from "../render-element.mjs";
4
- import { useElementCheck } from "../use-element-check.mjs";
5
4
  import { isPopoverOpen } from "./popover-open.mjs";
6
5
  import { registerTrigger } from "./trigger-ref.mjs";
7
- import { useCallback } from "react";
8
- //#region src/internal/overlay/use-popover-trigger.ts
6
+ import { useElementCheck } from "../use-element-check.mjs";
7
+ import { cancelClick, disabledButton, rendersButton } from "../render-element.mjs";
8
+ // src/internal/overlay/use-popover-trigger.ts
9
9
  const isDev = process.env.NODE_ENV !== "production";
10
10
  /**
11
11
  * The click rule of a Trigger that toggles a popover-kind Root (popover.md 2.8): Popover.Trigger,
@@ -68,7 +68,7 @@ function nonInvokerMessage(part, tag, popover, popup) {
68
68
  * Menu adds `aria-haspopup="menu"` and its own key handling on top.
69
69
  */
70
70
  function usePopoverTrigger(ctx, options) {
71
- const { part, disabled, render, handlers, onActivate, submenuItem = false } = options;
71
+ const { part, disabled, render, handlers, onActivate, submenuItem = false, alwaysFocusable = false } = options;
72
72
  const isLibrary = ctx.mode === "library";
73
73
  const { ids, triggerRef, popupRef } = ctx;
74
74
  const state = {
@@ -110,7 +110,7 @@ function usePopoverTrigger(ctx, options) {
110
110
  }
111
111
  const disabledProps = disabledButton(render, disabled, {
112
112
  handlesClick: isLibrary,
113
- alwaysFocusable: submenuItem
113
+ alwaysFocusable: submenuItem || alwaysFocusable
114
114
  });
115
115
  if (!isLibrary && !disabledProps.invoker) {
116
116
  const extra = handlers?.onClick;
@@ -136,7 +136,6 @@ function usePopoverTrigger(ctx, options) {
136
136
  ref
137
137
  };
138
138
  }
139
- //#endregion
140
139
  export { RESERVED_INVOKER_KEYS, nonInvokerMessage, toggleFromTrigger, usePopoverTrigger };
141
140
 
142
141
  //# sourceMappingURL=use-popover-trigger.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-popover-trigger.mjs","names":[],"sources":["../../../src/internal/overlay/use-popover-trigger.ts"],"sourcesContent":["\"use client\";\nimport { useCallback } from \"react\";\nimport type { ComponentPropsWithRef, DOMAttributes, MouseEvent } from \"react\";\nimport { dataAttr } from \"../data-attr.js\";\nimport { isPopoverOpen } from \"./popover-open.js\";\nimport { registerTrigger } from \"./trigger-ref.js\";\nimport type { RenderProp } from \"../types.js\";\nimport { useElementCheck } from \"../use-element-check.js\";\nimport { cancelClick, disabledButton, rendersButton } from \"../use-render.js\";\nimport type { DataAttributes } from \"../use-render.js\";\nimport type { PopoverRootValue } from \"./use-overlay-root.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/**\n * The click rule of a Trigger that toggles a popover-kind Root (popover.md 2.8): Popover.Trigger,\n * Menu.Trigger, Menu.SubmenuTrigger (through `usePopoverTrigger`) and Combobox.Trigger. It toggles\n * against what the user already intends (`intended()`, conventions 3.8 rule 1), not the DOM:\n *\n * - intended open, and the browser already hid the popup (a non-button Trigger, #115: light\n * dismiss hid it at `pointerup`, before this click): the hide is a fact, reported by its pending\n * `toggle`; the click only names its cause, an `\"activate\"` close intent;\n * - intended open otherwise: `requestClose(event, \"activate\")`;\n * - intended closed: `beforeOpen()`, then `requestOpen(event, \"activate\")`. First, because what\n * it records (Menu's open cause) must be in place before anything can show the popup. Today the\n * show waits for the apply effect, so the order is not observable.\n *\n * The caller cancels the click and checks `disabled` first. Handlers only.\n */\nexport function toggleFromTrigger(\n ctx: PopoverRootValue,\n event: Event,\n beforeOpen?: () => void,\n): void {\n if (ctx.intended()) {\n if (ctx.hiddenBeforeToggle()) {\n ctx.recordCloseIntent({ reason: \"activate\", event });\n return;\n }\n ctx.requestClose(event, \"activate\");\n } else {\n beforeOpen?.();\n ctx.requestOpen(event, \"activate\");\n }\n}\n\n/**\n * Owned and never written on an overlay Trigger (Popover, Menu, Combobox): the default\n * `popovertarget` action, which a render element must not change, and an Invoker Command, which\n * would take precedence over `popovertarget` and act on another element.\n */\nexport const RESERVED_INVOKER_KEYS = {\n popoverTargetAction: undefined,\n commandfor: undefined,\n command: undefined,\n} as const;\n\n/**\n * The library-mode dev warning for a Trigger rendered as another element than a `<button>`: only\n * an invoker button is spared by the popover's light dismiss, so a press while the popup is open\n * hides it before the click. `popover` and `popup` are the nouns the text uses for it.\n */\nexport function nonInvokerMessage(\n part: string,\n tag: string,\n popover: string,\n popup: string,\n): string {\n return (\n `${part}: rendered a <${tag}>. Only a <button> is the ${popover}'s invoker: a press on ` +\n `this element while the ${popup} is open closes it through light dismiss before the ` +\n \"click, so the close is a dismissal (reported to onOpenChange) rather than a request: \" +\n \"openChangeAction(false) is not called, cannot veto it and there is no view transition. \" +\n \"Render a <button>.\"\n );\n}\n\n/** The state of an overlay Trigger (Popover.Trigger, Menu.Trigger and its siblings). */\nexport interface PopoverTriggerHookState {\n /** Optimistic open state. A Popover in JS-free mode (the browser owns it) reports `false`. */\n readonly open: boolean;\n /** The Root's transition is pending: an open or a part-initiated close (never a dismissal). */\n readonly pending: boolean;\n /** The `disabled` prop. */\n readonly disabled: boolean;\n}\n\n/** Event handlers a component layers onto the Trigger's own (Menu's keys and hover intent). */\nexport type PopoverTriggerHandlers = Pick<\n DOMAttributes<HTMLButtonElement>,\n \"onClick\" | \"onKeyDown\" | \"onMouseDown\" | \"onPointerMove\" | \"onPointerEnter\" | \"onPointerLeave\"\n>;\n\nexport interface UsePopoverTriggerOptions<State> {\n /** Public name of the part for development warnings (`\"Popover.Trigger\"`). */\n readonly part: string;\n readonly disabled: boolean;\n readonly render: RenderProp<ComponentPropsWithRef<\"button\">, State> | undefined;\n /**\n * Extra handlers, merged in front of the Trigger's own: for a key both define, the extra one\n * runs first (the consumer's pass-through handler still runs before both, conventions 1.2).\n */\n readonly handlers?: PopoverTriggerHandlers;\n /**\n * What a click does in library mode, after the command has been cancelled and `disabled`\n * checked. Default: `toggleFromTrigger(ctx, event.nativeEvent)`, the toggle against\n * `intended()` (`requestOpen` / `requestClose`). Menu.Trigger toggles with its open cause;\n * Menu.SubmenuTrigger opens, or moves focus into an already open submenu.\n */\n readonly onActivate?: (event: MouseEvent<HTMLElement>) => void;\n /**\n * Menu.SubmenuTrigger: the Trigger is also an item of the parent menu, whose click\n * (`onActivate`) never closes the popup. `disabled` renders `aria-disabled=\"true\"` and no\n * `disabled` attribute, so the item stays focusable (the click handler still refuses); without\n * it `disabled` is the native attribute, so the button is no invoker at all (in library mode a\n * link or component `render` still gets `aria-disabled`, because native `disabled` means\n * nothing on a link and the installed click handler is what refuses). And the library-mode\n * non-button warning says a press while open dismisses the popup instead of moving focus into\n * it.\n */\n readonly submenuItem?: boolean;\n}\n\nexport interface PopoverTriggerHook {\n readonly state: PopoverTriggerHookState;\n /** Owned props (conventions 1.2) for `useRender`'s `libraryProps`. */\n readonly libraryProps: ComponentPropsWithRef<\"button\"> & DataAttributes;\n /** Registers the element as the Root's Trigger; pass as `useRender`'s `ref`. */\n readonly ref: (element: HTMLElement) => () => void;\n}\n\n/**\n * The Trigger of a popover-like component (design/components/popover.md 14.3):\n * `button[popoverTarget]`, with no `aria-expanded` on an invoker: every engine exposes the\n * popover's shown state from the invoker relationship. In JS-free mode the browser toggles\n * the popover and the Popup keeps `data-open` current on the element. In library mode the click\n * is cancelled (so the activation does not run) and toggles against what the user already\n * intends: an open through `requestOpen`, a library-owned close through `requestClose`. There\n * `data-open` and `state.open` are optimistic; a non-button `render` (no invoker) renders\n * `aria-expanded` from whether the popup is shown (in the top layer).\n *\n * Menu adds `aria-haspopup=\"menu\"` and its own key handling on top.\n */\nexport function usePopoverTrigger<State>(\n ctx: PopoverRootValue,\n options: UsePopoverTriggerOptions<State>,\n): PopoverTriggerHook {\n const { part, disabled, render, handlers, onActivate, submenuItem = false } = options;\n const isLibrary = ctx.mode === \"library\";\n const { ids, triggerRef, popupRef } = ctx;\n\n const state: PopoverTriggerHookState = {\n open: ctx.optimistic,\n // Opens and part-initiated closes belong to the Trigger (4.2); a dismissal is a fact and\n // pends nothing (conventions 3.9.7).\n pending: ctx.pending,\n disabled,\n };\n\n const checkElement = useElementCheck(\n isDev &&\n ((element) => {\n if (element.tagName === \"BUTTON\") return null;\n const tag = element.tagName.toLowerCase();\n // Library mode: the click handler works, but only an invoker button is spared by the\n // popover's light dismiss, so a press while open hides the popup before the click.\n if (isLibrary && submenuItem) {\n return (\n `${part}: rendered a <${tag}>. Only a <button> is the popover's invoker: a press on ` +\n \"this element while its popup is open dismisses the popup through light dismiss \" +\n \"instead of moving focus into it. Render a <button>.\"\n );\n }\n return isLibrary\n ? nonInvokerMessage(part, tag, \"popover\", \"popup\")\n : `${part}: rendered a <${tag}> in JS-free mode. Only a <button> is a ` +\n \"`popovertarget` invoker; this trigger will not open the popover. Render a \" +\n \"<button>, or put the component in library mode (`defaultOpen={false}`).\";\n }),\n );\n const ref = useCallback(\n (element: HTMLElement) => {\n checkElement?.(element);\n const unregister = registerTrigger(triggerRef, element, part);\n // JS-free mode: the DOM owns `data-open` (design 9). A Trigger that mounts after the\n // Popup (or is re-created) picks up the current state here.\n if (!isLibrary && popupRef.current !== null) {\n element.toggleAttribute(\"data-open\", isPopoverOpen(popupRef.current));\n }\n return unregister;\n },\n [isLibrary, checkElement, triggerRef, popupRef, part],\n );\n\n const onClick = (event: MouseEvent<HTMLElement>) => {\n // Cancelling the click cancels the popover toggle (it runs as the button's activation\n // behaviour, only if the click was not cancelled). Enter and Space synthesise the same click.\n event.preventDefault();\n if (disabled) return;\n if (onActivate !== undefined) onActivate(event);\n else toggleFromTrigger(ctx, event.nativeEvent);\n };\n\n // The component's handlers first, then the Trigger's (design/components/menu.md 14). The click\n // handler is only owned when installed, so a render element keeps its own `onClick` in JS-free\n // mode.\n const merged: PopoverTriggerHandlers = { ...handlers };\n if (isLibrary) {\n const extra = handlers?.onClick;\n merged.onClick =\n extra === undefined\n ? onClick\n : (event) => {\n extra(event);\n onClick(event);\n };\n }\n // The click handler is installed in library mode only; in JS-free mode the activation needs\n // native `disabled` to stop it.\n const disabledProps = disabledButton(render, disabled, {\n handlesClick: isLibrary,\n alwaysFocusable: submenuItem,\n });\n if (!isLibrary && !disabledProps.invoker) {\n // JS-free mode, disabled in the `aria-disabled` branch (a host link): nothing native stops the\n // click, so cancel it (a disabled link must not navigate). Only while disabled, after the\n // component's own handler.\n const extra = handlers?.onClick;\n merged.onClick =\n extra === undefined\n ? cancelClick\n : (event) => {\n extra(event);\n cancelClick(event);\n };\n }\n\n const invoker = disabledProps.invoker && rendersButton(render);\n\n const libraryProps: ComponentPropsWithRef<\"button\"> & DataAttributes = {\n // `type` only applies to a <button>; on any other element the key is not owned.\n ...(rendersButton(render) && { type: \"button\" as const }),\n // Owned: a render element must not re-enable a disabled Trigger (in JS-free mode the browser\n // would toggle the popover).\n ...disabledProps.props,\n // Only on a button (or a component, assumed to render one): another element is no invoker,\n // and the attribute would claim otherwise.\n popoverTarget: invoker ? ids.popup : undefined,\n ...RESERVED_INVOKER_KEYS,\n // No `aria-expanded` on an invoker: every engine exposes the popover's shown state from\n // `popovertarget`, and ARIA in HTML forbids the attribute there. Otherwise nothing else\n // exposes the state: library mode renders shown (the popup is in the top layer; `data-open`\n // is the optimistic one), JS-free mode cannot know it and renders \"false\".\n \"aria-expanded\": invoker ? undefined : isLibrary ? ctx.shown : false,\n ...merged,\n \"data-open\": dataAttr(state.open),\n \"data-pending\": dataAttr(state.pending),\n // Every mode: the styling hook agrees with the rendered `disabled` / `aria-disabled`\n // (conventions 1.2).\n \"data-disabled\": dataAttr(disabled),\n };\n\n return { state, libraryProps, ref };\n}\n"],"mappings":";;;;;;;;AAYA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;;;;;;;;;;;AAiBvC,SAAgB,kBACd,KACA,OACA,YACM;CACN,IAAI,IAAI,SAAS,GAAG;EAClB,IAAI,IAAI,mBAAmB,GAAG;GAC5B,IAAI,kBAAkB;IAAE,QAAQ;IAAY;GAAM,CAAC;GACnD;EACF;EACA,IAAI,aAAa,OAAO,UAAU;CACpC,OAAO;EACL,aAAa;EACb,IAAI,YAAY,OAAO,UAAU;CACnC;AACF;;;;;;AAOA,MAAa,wBAAwB;CACnC,qBAAqB,KAAA;CACrB,YAAY,KAAA;CACZ,SAAS,KAAA;AACX;;;;;;AAOA,SAAgB,kBACd,MACA,KACA,SACA,OACQ;CACR,OACE,GAAG,KAAK,gBAAgB,IAAI,4BAA4B,QAAQ,gDACtC,MAAM;AAKpC;;;;;;;;;;;;;AAoEA,SAAgB,kBACd,KACA,SACoB;CACpB,MAAM,EAAE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R;CAEA,MAAM,UAAU,cAAc,WAAW,cAAc,MAAM;CAyB7D,OAAO;EAAE;EAAO,cAAA;GArBd,GAAI,cAAc,MAAM,KAAK,EAAE,MAAM,SAAkB;GAGvD,GAAG,cAAc;GAGjB,eAAe,UAAU,IAAI,QAAQ,KAAA;GACrC,GAAG;GAKH,iBAAiB,UAAU,KAAA,IAAY,YAAY,IAAI,QAAQ;GAC/D,GAAG;GACH,aAAa,SAAS,MAAM,IAAI;GAChC,gBAAgB,SAAS,MAAM,OAAO;GAGtC,iBAAiB,SAAS,QAAQ;EAGT;EAAG;CAAI;AACpC"}
1
+ {"version":3,"file":"use-popover-trigger.mjs","names":[],"sources":["../../../src/internal/overlay/use-popover-trigger.ts"],"sourcesContent":["\"use client\";\nimport { useCallback } from \"react\";\nimport type { ComponentPropsWithRef, DOMAttributes, MouseEvent } from \"react\";\nimport { dataAttr } from \"../data-attr.js\";\nimport { isPopoverOpen } from \"./popover-open.js\";\nimport { registerTrigger } from \"./trigger-ref.js\";\nimport type { RenderProp } from \"../types.js\";\nimport { useElementCheck } from \"../use-element-check.js\";\nimport { cancelClick, disabledButton, rendersButton } from \"../use-render.js\";\nimport type { DataAttributes } from \"../use-render.js\";\nimport type { PopoverRootValue } from \"./use-overlay-root.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/**\n * The click rule of a Trigger that toggles a popover-kind Root (popover.md 2.8): Popover.Trigger,\n * Menu.Trigger, Menu.SubmenuTrigger (through `usePopoverTrigger`) and Combobox.Trigger. It toggles\n * against what the user already intends (`intended()`, conventions 3.8 rule 1), not the DOM:\n *\n * - intended open, and the browser already hid the popup (a non-button Trigger, #115: light\n * dismiss hid it at `pointerup`, before this click): the hide is a fact, reported by its pending\n * `toggle`; the click only names its cause, an `\"activate\"` close intent;\n * - intended open otherwise: `requestClose(event, \"activate\")`;\n * - intended closed: `beforeOpen()`, then `requestOpen(event, \"activate\")`. First, because what\n * it records (Menu's open cause) must be in place before anything can show the popup. Today the\n * show waits for the apply effect, so the order is not observable.\n *\n * The caller cancels the click and checks `disabled` first. Handlers only.\n */\nexport function toggleFromTrigger(\n ctx: PopoverRootValue,\n event: Event,\n beforeOpen?: () => void,\n): void {\n if (ctx.intended()) {\n if (ctx.hiddenBeforeToggle()) {\n ctx.recordCloseIntent({ reason: \"activate\", event });\n return;\n }\n ctx.requestClose(event, \"activate\");\n } else {\n beforeOpen?.();\n ctx.requestOpen(event, \"activate\");\n }\n}\n\n/**\n * Owned and never written on an overlay Trigger (Popover, Menu, Combobox): the default\n * `popovertarget` action, which a render element must not change, and an Invoker Command, which\n * would take precedence over `popovertarget` and act on another element.\n */\nexport const RESERVED_INVOKER_KEYS = {\n popoverTargetAction: undefined,\n commandfor: undefined,\n command: undefined,\n} as const;\n\n/**\n * The library-mode dev warning for a Trigger rendered as another element than a `<button>`: only\n * an invoker button is spared by the popover's light dismiss, so a press while the popup is open\n * hides it before the click. `popover` and `popup` are the nouns the text uses for it.\n */\nexport function nonInvokerMessage(\n part: string,\n tag: string,\n popover: string,\n popup: string,\n): string {\n return (\n `${part}: rendered a <${tag}>. Only a <button> is the ${popover}'s invoker: a press on ` +\n `this element while the ${popup} is open closes it through light dismiss before the ` +\n \"click, so the close is a dismissal (reported to onOpenChange) rather than a request: \" +\n \"openChangeAction(false) is not called, cannot veto it and there is no view transition. \" +\n \"Render a <button>.\"\n );\n}\n\n/** The state of an overlay Trigger (Popover.Trigger, Menu.Trigger and its siblings). */\nexport interface PopoverTriggerHookState {\n /** Optimistic open state. A Popover in JS-free mode (the browser owns it) reports `false`. */\n readonly open: boolean;\n /** The Root's transition is pending: an open or a part-initiated close (never a dismissal). */\n readonly pending: boolean;\n /** The `disabled` prop. */\n readonly disabled: boolean;\n}\n\n/** Event handlers a component layers onto the Trigger's own (Menu's keys and hover intent). */\nexport type PopoverTriggerHandlers = Pick<\n DOMAttributes<HTMLButtonElement>,\n \"onClick\" | \"onKeyDown\" | \"onMouseDown\" | \"onPointerMove\" | \"onPointerEnter\" | \"onPointerLeave\"\n>;\n\nexport interface UsePopoverTriggerOptions<State> {\n /** Public name of the part for development warnings (`\"Popover.Trigger\"`). */\n readonly part: string;\n readonly disabled: boolean;\n readonly render: RenderProp<ComponentPropsWithRef<\"button\">, State> | undefined;\n /**\n * Extra handlers, merged in front of the Trigger's own: for a key both define, the extra one\n * runs first (the consumer's pass-through handler still runs before both, conventions 1.2).\n */\n readonly handlers?: PopoverTriggerHandlers;\n /**\n * What a click does in library mode, after the command has been cancelled and `disabled`\n * checked. Default: `toggleFromTrigger(ctx, event.nativeEvent)`, the toggle against\n * `intended()` (`requestOpen` / `requestClose`). Menu.Trigger toggles with its open cause;\n * Menu.SubmenuTrigger opens, or moves focus into an already open submenu.\n */\n readonly onActivate?: (event: MouseEvent<HTMLElement>) => void;\n /**\n * Menu.SubmenuTrigger: the Trigger is also an item of the parent menu, whose click\n * (`onActivate`) never closes the popup. `disabled` renders `aria-disabled=\"true\"` and no\n * `disabled` attribute, so the item stays focusable (the click handler still refuses); without\n * it `disabled` is the native attribute, so the button is no invoker at all (in library mode a\n * link or component `render` still gets `aria-disabled`, because native `disabled` means\n * nothing on a link and the installed click handler is what refuses). And the library-mode\n * non-button warning says a press while open dismisses the popup instead of moving focus into\n * it.\n */\n readonly submenuItem?: boolean;\n /**\n * `Menu.Trigger` inside a `Menubar`: an item of the bar, so `disabled` renders\n * `aria-disabled=\"true\"` and the element stays focusable, as with `submenuItem`; the click\n * still toggles and the non-button warning is the ordinary one\n * (design/components/menubar.md 5).\n */\n readonly alwaysFocusable?: boolean;\n}\n\nexport interface PopoverTriggerHook {\n readonly state: PopoverTriggerHookState;\n /** Owned props (conventions 1.2) for `useRender`'s `libraryProps`. */\n readonly libraryProps: ComponentPropsWithRef<\"button\"> & DataAttributes;\n /** Registers the element as the Root's Trigger; pass as `useRender`'s `ref`. */\n readonly ref: (element: HTMLElement) => () => void;\n}\n\n/**\n * The Trigger of a popover-like component (design/components/popover.md 14.3):\n * `button[popoverTarget]`, with no `aria-expanded` on an invoker: every engine exposes the\n * popover's shown state from the invoker relationship. In JS-free mode the browser toggles\n * the popover and the Popup keeps `data-open` current on the element. In library mode the click\n * is cancelled (so the activation does not run) and toggles against what the user already\n * intends: an open through `requestOpen`, a library-owned close through `requestClose`. There\n * `data-open` and `state.open` are optimistic; a non-button `render` (no invoker) renders\n * `aria-expanded` from whether the popup is shown (in the top layer).\n *\n * Menu adds `aria-haspopup=\"menu\"` and its own key handling on top.\n */\nexport function usePopoverTrigger<State>(\n ctx: PopoverRootValue,\n options: UsePopoverTriggerOptions<State>,\n): PopoverTriggerHook {\n const {\n part,\n disabled,\n render,\n handlers,\n onActivate,\n submenuItem = false,\n alwaysFocusable = false,\n } = options;\n const isLibrary = ctx.mode === \"library\";\n const { ids, triggerRef, popupRef } = ctx;\n\n const state: PopoverTriggerHookState = {\n open: ctx.optimistic,\n // Opens and part-initiated closes belong to the Trigger (4.2); a dismissal is a fact and\n // pends nothing (conventions 3.9.7).\n pending: ctx.pending,\n disabled,\n };\n\n const checkElement = useElementCheck(\n isDev &&\n ((element) => {\n if (element.tagName === \"BUTTON\") return null;\n const tag = element.tagName.toLowerCase();\n // Library mode: the click handler works, but only an invoker button is spared by the\n // popover's light dismiss, so a press while open hides the popup before the click.\n if (isLibrary && submenuItem) {\n return (\n `${part}: rendered a <${tag}>. Only a <button> is the popover's invoker: a press on ` +\n \"this element while its popup is open dismisses the popup through light dismiss \" +\n \"instead of moving focus into it. Render a <button>.\"\n );\n }\n return isLibrary\n ? nonInvokerMessage(part, tag, \"popover\", \"popup\")\n : `${part}: rendered a <${tag}> in JS-free mode. Only a <button> is a ` +\n \"`popovertarget` invoker; this trigger will not open the popover. Render a \" +\n \"<button>, or put the component in library mode (`defaultOpen={false}`).\";\n }),\n );\n const ref = useCallback(\n (element: HTMLElement) => {\n checkElement?.(element);\n const unregister = registerTrigger(triggerRef, element, part);\n // JS-free mode: the DOM owns `data-open` (design 9). A Trigger that mounts after the\n // Popup (or is re-created) picks up the current state here.\n if (!isLibrary && popupRef.current !== null) {\n element.toggleAttribute(\"data-open\", isPopoverOpen(popupRef.current));\n }\n return unregister;\n },\n [isLibrary, checkElement, triggerRef, popupRef, part],\n );\n\n const onClick = (event: MouseEvent<HTMLElement>) => {\n // Cancelling the click cancels the popover toggle (it runs as the button's activation\n // behaviour, only if the click was not cancelled). Enter and Space synthesise the same click.\n event.preventDefault();\n if (disabled) return;\n if (onActivate !== undefined) onActivate(event);\n else toggleFromTrigger(ctx, event.nativeEvent);\n };\n\n // The component's handlers first, then the Trigger's (design/components/menu.md 14). The click\n // handler is only owned when installed, so a render element keeps its own `onClick` in JS-free\n // mode.\n const merged: PopoverTriggerHandlers = { ...handlers };\n if (isLibrary) {\n const extra = handlers?.onClick;\n merged.onClick =\n extra === undefined\n ? onClick\n : (event) => {\n extra(event);\n onClick(event);\n };\n }\n // The click handler is installed in library mode only; in JS-free mode the activation needs\n // native `disabled` to stop it.\n const disabledProps = disabledButton(render, disabled, {\n handlesClick: isLibrary,\n alwaysFocusable: submenuItem || alwaysFocusable,\n });\n if (!isLibrary && !disabledProps.invoker) {\n // JS-free mode, disabled in the `aria-disabled` branch (a host link): nothing native stops the\n // click, so cancel it (a disabled link must not navigate). Only while disabled, after the\n // component's own handler.\n const extra = handlers?.onClick;\n merged.onClick =\n extra === undefined\n ? cancelClick\n : (event) => {\n extra(event);\n cancelClick(event);\n };\n }\n\n const invoker = disabledProps.invoker && rendersButton(render);\n\n const libraryProps: ComponentPropsWithRef<\"button\"> & DataAttributes = {\n // `type` only applies to a <button>; on any other element the key is not owned.\n ...(rendersButton(render) && { type: \"button\" as const }),\n // Owned: a render element must not re-enable a disabled Trigger (in JS-free mode the browser\n // would toggle the popover).\n ...disabledProps.props,\n // Only on a button (or a component, assumed to render one): another element is no invoker,\n // and the attribute would claim otherwise.\n popoverTarget: invoker ? ids.popup : undefined,\n ...RESERVED_INVOKER_KEYS,\n // No `aria-expanded` on an invoker: every engine exposes the popover's shown state from\n // `popovertarget`, and ARIA in HTML forbids the attribute there. Otherwise nothing else\n // exposes the state: library mode renders shown (the popup is in the top layer; `data-open`\n // is the optimistic one), JS-free mode cannot know it and renders \"false\".\n \"aria-expanded\": invoker ? undefined : isLibrary ? ctx.shown : false,\n ...merged,\n \"data-open\": dataAttr(state.open),\n \"data-pending\": dataAttr(state.pending),\n // Every mode: the styling hook agrees with the rendered `disabled` / `aria-disabled`\n // (conventions 1.2).\n \"data-disabled\": dataAttr(disabled),\n };\n\n return { state, libraryProps, ref };\n}\n"],"mappings":";;;;;;;;AAYA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;;;;;;;;;;;AAiBvC,SAAgB,kBACd,KACA,OACA,YACM;CACN,IAAI,IAAI,SAAS,GAAG;EAClB,IAAI,IAAI,mBAAmB,GAAG;GAC5B,IAAI,kBAAkB;IAAE,QAAQ;IAAY;GAAM,CAAC;GACnD;EACF;EACA,IAAI,aAAa,OAAO,UAAU;CACpC,OAAO;EACL,aAAa;EACb,IAAI,YAAY,OAAO,UAAU;CACnC;AACF;;;;;;AAOA,MAAa,wBAAwB;CACnC,qBAAqB,KAAA;CACrB,YAAY,KAAA;CACZ,SAAS,KAAA;AACX;;;;;;AAOA,SAAgB,kBACd,MACA,KACA,SACA,OACQ;CACR,OACE,GAAG,KAAK,gBAAgB,IAAI,4BAA4B,QAAQ,gDACtC,MAAM;AAKpC;;;;;;;;;;;;;AA2EA,SAAgB,kBACd,KACA,SACoB;CACpB,MAAM,EACJ,MACA,UACA,QACA,UACA,YACA,cAAc,OACd,kBAAkB,UAChB;CACJ,MAAM,YAAY,IAAI,SAAS;CAC/B,MAAM,EAAE,KAAK,YAAY,aAAa;CAEtC,MAAM,QAAiC;EACrC,MAAM,IAAI;EAGV,SAAS,IAAI;EACb;CACF;CAEA,MAAM,eAAe,gBACnB,WACI,YAAY;EACZ,IAAI,QAAQ,YAAY,UAAU,OAAO;EACzC,MAAM,MAAM,QAAQ,QAAQ,YAAY;EAGxC,I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C,gBAAgB,SAAS,MAAM,OAAO;GAGtC,iBAAiB,SAAS,QAAQ;EAGT;EAAG;CAAI;AACpC"}
@@ -1,10 +1,10 @@
1
1
  "use client";
2
- import { resolveStateValue } from "../render-element.mjs";
3
- import { POSITION_TRY_FALLBACKS, parsePositionArea, positionArea } from "./anchor-position.mjs";
4
- import { isPopoverOpen } from "./popover-open.mjs";
5
2
  import { useCallback, useLayoutEffect, useRef, useState } from "react";
6
3
  import { flushSync } from "react-dom";
7
- //#region src/internal/overlay/use-resolved-placement.ts
4
+ import { POSITION_TRY_FALLBACKS, parsePositionArea, positionArea } from "./anchor-position.mjs";
5
+ import { isPopoverOpen } from "./popover-open.mjs";
6
+ import { resolveStateValue } from "../render-element.mjs";
7
+ // src/internal/overlay/use-resolved-placement.ts
8
8
  const toDirection = (value) => value === "rtl" ? "rtl" : "ltr";
9
9
  /**
10
10
  * Where the browser actually placed an anchored popup (design/conventions.md 13.2): the
@@ -156,7 +156,6 @@ function useAnchoredPlacement(request) {
156
156
  style
157
157
  };
158
158
  }
159
- //#endregion
160
159
  export { useAnchoredPlacement, useResolvedPlacement };
161
160
 
162
161
  //# sourceMappingURL=use-resolved-placement.mjs.map
@@ -1,5 +1,4 @@
1
1
  import * as React from "react";
2
- //#region src/internal/platform-attributes.d.ts
3
2
  declare module "react" {
4
3
  interface HTMLAttributes<T> {
5
4
  /**
@@ -63,5 +62,4 @@ declare module "react" {
63
62
  interestDelayEnd?: string | undefined;
64
63
  }
65
64
  }
66
- //#endregion
67
65
  //# sourceMappingURL=platform-attributes.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"platform-attributes.d.mts","names":[],"sources":["../../src/internal/platform-attributes.ts"],"mappings":";;;YAkBY,eAAe;;;;;;IAMvB;;;;;;IAMA;;YAGQ,qBAAqB;;;;;;IAM7B;;;;;;IAMA;;;;;;IAMA;;YAWQ,qBAAqB;;IAE7B;;YAGQ,mBAAmB;;IAE3B;;YAGQ;cACE;;;;;;;MAOR,iBAAiB,MAAM,kBAAkB,MAAM,eAAe,cAAc;;;YAItE;;IAER;;IAEA;;IAEA"}
1
+ {"version":3,"file":"platform-attributes.d.mts","names":[],"sources":["../../src/internal/platform-attributes.ts"],"mappings":";;YAkBY,eAAe;;;;;;IAMvB;;;;;;IAMA;;YAGQ,qBAAqB;;;;;;IAM7B;;;;;;IAMA;;;;;;IAMA;;YAWQ,qBAAqB;;IAE7B;;YAGQ,mBAAmB;;IAE3B;;YAGQ;cACE;;;;;;;MAOR,iBAAiB,MAAM,kBAAkB,MAAM,eAAe,cAAc;;;YAItE;;IAER;;IAEA;;IAEA"}
@@ -1,4 +1,4 @@
1
- //#region src/internal/pointer-capture.ts
1
+ // src/internal/pointer-capture.ts
2
2
  /**
3
3
  * `setPointerCapture`, which throws `NotFoundError` for a pointer the engine no longer tracks
4
4
  * (context-menu.md 2.1). A silent no-op when no button is down. `true` when the capture was
@@ -14,7 +14,6 @@ function capturePointer(element, pointerId) {
14
14
  return false;
15
15
  }
16
16
  }
17
- //#endregion
18
17
  export { capturePointer };
19
18
 
20
19
  //# sourceMappingURL=pointer-capture.mjs.map
@@ -1,4 +1,4 @@
1
- //#region src/internal/range-value.ts
1
+ // src/internal/range-value.ts
2
2
  /** The platform's clamp (`<progress>` 150 of 100 is 100). A degenerate range yields `min`. */
3
3
  function clamp(value, min, max) {
4
4
  return Math.max(min, Math.min(max, value));
@@ -20,14 +20,16 @@ const CACHE_LIMIT = 32;
20
20
  const formatters = /* @__PURE__ */ new Map();
21
21
  /**
22
22
  * One `Intl.NumberFormat` per `locale` + `format`, so an update loop does not construct one per
23
- * render. Bounded: past 32 entries the oldest is dropped.
23
+ * render. Bounded: past 32 entries the oldest is dropped. The key is JSON, as in
24
+ * `number-field/number-field-format.ts`, so a list and a string never collide.
24
25
  */
25
26
  function getNumberFormat(locale, format) {
26
27
  const options = format ?? PERCENT;
27
- const key = `${locale ?? ""}\u0000${JSON.stringify(options)}`;
28
+ const key = JSON.stringify([locale ?? null, options]);
28
29
  let formatter = formatters.get(key);
29
30
  if (formatter === void 0) {
30
- formatter = new Intl.NumberFormat(locale, options);
31
+ const locales = typeof locale === "string" || locale === void 0 ? locale : [...locale];
32
+ formatter = new Intl.NumberFormat(locales, options);
31
33
  if (formatters.size >= CACHE_LIMIT) {
32
34
  const oldest = formatters.keys().next().value;
33
35
  if (oldest !== void 0) formatters.delete(oldest);
@@ -45,7 +47,6 @@ function formatRangeValue(value, min, max, format, locale) {
45
47
  const percentStyle = format === void 0 || format.style === "percent";
46
48
  return getNumberFormat(locale, format).format(percentStyle ? fraction(value, min, max) : value);
47
49
  }
48
- //#endregion
49
50
  export { clamp, formatRangeValue, fraction, getNumberFormat, isDegenerate, percentage };
50
51
 
51
52
  //# sourceMappingURL=range-value.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"range-value.mjs","names":[],"sources":["../../src/internal/range-value.ts"],"sourcesContent":["// No \"use client\": pure arithmetic and formatting shared by the directive-free `Progress.Root`\n// and `Meter.Root` (design/components/progress.md 2.1, 2.2 and implementation note 14.4).\n\n/** The platform's clamp (`<progress>` 150 of 100 is 100). A degenerate range yields `min`. */\nexport function clamp(value: number, min: number, max: number): number {\n return Math.max(min, Math.min(max, value));\n}\n\n/** Whether `[min, max]` is empty or a point (`max <= min`): a bug at the call site. */\nexport function isDegenerate(min: number, max: number): boolean {\n return !(max > min);\n}\n\n/** `(value - min) / (max - min)`, `0` for a degenerate range. */\nexport function fraction(value: number, min: number, max: number): number {\n return isDegenerate(min, max) ? 0 : (value - min) / (max - min);\n}\n\n/** The fraction as a number 0–100. */\nexport function percentage(value: number, min: number, max: number): number {\n return fraction(value, min, max) * 100;\n}\n\nconst PERCENT: Intl.NumberFormatOptions = { style: \"percent\" };\nconst CACHE_LIMIT = 32;\nconst formatters = new Map<string, Intl.NumberFormat>();\n\n/**\n * One `Intl.NumberFormat` per `locale` + `format`, so an update loop does not construct one per\n * render. Bounded: past 32 entries the oldest is dropped.\n */\nexport function getNumberFormat(\n locale: string | undefined,\n format: Intl.NumberFormatOptions | undefined,\n): Intl.NumberFormat {\n const options = format ?? PERCENT;\n const key = `${locale ?? \"\"}\\u0000${JSON.stringify(options)}`;\n let formatter = formatters.get(key);\n if (formatter === undefined) {\n formatter = new Intl.NumberFormat(locale, options);\n if (formatters.size >= CACHE_LIMIT) {\n const oldest = formatters.keys().next().value;\n if (oldest !== undefined) formatters.delete(oldest);\n }\n formatters.set(key, formatter);\n }\n return formatter;\n}\n\n/**\n * The visible text of a (clamped) value: the fraction of the range for the `percent` style (the\n * default when `format` is absent), the value itself for any other style. A `format` without\n * `style` is `decimal` per `Intl` and formats the value.\n */\nexport function formatRangeValue(\n value: number,\n min: number,\n max: number,\n format: Intl.NumberFormatOptions | undefined,\n locale: string | undefined,\n): string {\n const percentStyle = format === undefined || format.style === \"percent\";\n return getNumberFormat(locale, format).format(percentStyle ? fraction(value, min, max) : value);\n}\n"],"mappings":";;AAIA,SAAgB,MAAM,OAAe,KAAa,KAAqB;CACrE,OAAO,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,KAAK,CAAC;AAC3C;;AAGA,SAAgB,aAAa,KAAa,KAAsB;CAC9D,OAAO,EAAE,MAAM;AACjB;;AAGA,SAAgB,SAAS,OAAe,KAAa,KAAqB;CACxE,OAAO,aAAa,KAAK,GAAG,IAAI,KAAK,QAAQ,QAAQ,MAAM;AAC7D;;AAGA,SAAgB,WAAW,OAAe,KAAa,KAAqB;CAC1E,OAAO,SAAS,OAAO,KAAK,GAAG,IAAI;AACrC;AAEA,MAAM,UAAoC,EAAE,OAAO,UAAU;AAC7D,MAAM,cAAc;AACpB,MAAM,6BAAa,IAAI,IAA+B;;;;;AAMtD,SAAgB,gBACd,QACA,QACmB;CACnB,MAAM,UAAU,UAAU;CAC1B,MAAM,MAAM,GAAG,UAAU,GAAG,QAAQ,KAAK,UAAU,OAAO;CAC1D,IAAI,YAAY,WAAW,IAAI,GAAG;CAClC,IAAI,cAAc,KAAA,GAAW;EAC3B,YAAY,IAAI,KAAK,aAAa,QAAQ,OAAO;EACjD,IAAI,WAAW,QAAQ,aAAa;GAClC,MAAM,SAAS,WAAW,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC;GACxC,IAAI,WAAW,KAAA,GAAW,WAAW,OAAO,MAAM;EACpD;EACA,WAAW,IAAI,KAAK,SAAS;CAC/B;CACA,OAAO;AACT;;;;;;AAOA,SAAgB,iBACd,OACA,KACA,KACA,QACA,QACQ;CACR,MAAM,eAAe,WAAW,KAAA,KAAa,OAAO,UAAU;CAC9D,OAAO,gBAAgB,QAAQ,MAAM,CAAC,CAAC,OAAO,eAAe,SAAS,OAAO,KAAK,GAAG,IAAI,KAAK;AAChG"}
1
+ {"version":3,"file":"range-value.mjs","names":[],"sources":["../../src/internal/range-value.ts"],"sourcesContent":["// No \"use client\": pure arithmetic and formatting shared by the directive-free `Progress.Root`\n// and `Meter.Root` (design/components/progress.md 2.1, 2.2 and implementation note 14.4).\n\n/** The platform's clamp (`<progress>` 150 of 100 is 100). A degenerate range yields `min`. */\nexport function clamp(value: number, min: number, max: number): number {\n return Math.max(min, Math.min(max, value));\n}\n\n/** Whether `[min, max]` is empty or a point (`max <= min`): a bug at the call site. */\nexport function isDegenerate(min: number, max: number): boolean {\n return !(max > min);\n}\n\n/** `(value - min) / (max - min)`, `0` for a degenerate range. */\nexport function fraction(value: number, min: number, max: number): number {\n return isDegenerate(min, max) ? 0 : (value - min) / (max - min);\n}\n\n/** The fraction as a number 0–100. */\nexport function percentage(value: number, min: number, max: number): number {\n return fraction(value, min, max) * 100;\n}\n\nconst PERCENT: Intl.NumberFormatOptions = { style: \"percent\" };\nconst CACHE_LIMIT = 32;\nconst formatters = new Map<string, Intl.NumberFormat>();\n\n/** A tag or a preference list of tags, what the `Intl` constructors take (conventions 14.2). */\nexport type RangeLocale = string | readonly string[];\n\n/**\n * One `Intl.NumberFormat` per `locale` + `format`, so an update loop does not construct one per\n * render. Bounded: past 32 entries the oldest is dropped. The key is JSON, as in\n * `number-field/number-field-format.ts`, so a list and a string never collide.\n */\nexport function getNumberFormat(\n locale: RangeLocale | undefined,\n format: Intl.NumberFormatOptions | undefined,\n): Intl.NumberFormat {\n const options = format ?? PERCENT;\n const key = JSON.stringify([locale ?? null, options]);\n let formatter = formatters.get(key);\n if (formatter === undefined) {\n // `Intl` takes a mutable `string[]`: copy a readonly list rather than cast it.\n const locales = typeof locale === \"string\" || locale === undefined ? locale : [...locale];\n formatter = new Intl.NumberFormat(locales, options);\n if (formatters.size >= CACHE_LIMIT) {\n const oldest = formatters.keys().next().value;\n if (oldest !== undefined) formatters.delete(oldest);\n }\n formatters.set(key, formatter);\n }\n return formatter;\n}\n\n/**\n * The visible text of a (clamped) value: the fraction of the range for the `percent` style (the\n * default when `format` is absent), the value itself for any other style. A `format` without\n * `style` is `decimal` per `Intl` and formats the value.\n */\nexport function formatRangeValue(\n value: number,\n min: number,\n max: number,\n format: Intl.NumberFormatOptions | undefined,\n locale: RangeLocale | undefined,\n): string {\n const percentStyle = format === undefined || format.style === \"percent\";\n return getNumberFormat(locale, format).format(percentStyle ? fraction(value, min, max) : value);\n}\n"],"mappings":";;AAIA,SAAgB,MAAM,OAAe,KAAa,KAAqB;CACrE,OAAO,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,KAAK,CAAC;AAC3C;;AAGA,SAAgB,aAAa,KAAa,KAAsB;CAC9D,OAAO,EAAE,MAAM;AACjB;;AAGA,SAAgB,SAAS,OAAe,KAAa,KAAqB;CACxE,OAAO,aAAa,KAAK,GAAG,IAAI,KAAK,QAAQ,QAAQ,MAAM;AAC7D;;AAGA,SAAgB,WAAW,OAAe,KAAa,KAAqB;CAC1E,OAAO,SAAS,OAAO,KAAK,GAAG,IAAI;AACrC;AAEA,MAAM,UAAoC,EAAE,OAAO,UAAU;AAC7D,MAAM,cAAc;AACpB,MAAM,6BAAa,IAAI,IAA+B;;;;;;AAUtD,SAAgB,gBACd,QACA,QACmB;CACnB,MAAM,UAAU,UAAU;CAC1B,MAAM,MAAM,KAAK,UAAU,CAAC,UAAU,MAAM,OAAO,CAAC;CACpD,IAAI,YAAY,WAAW,IAAI,GAAG;CAClC,IAAI,cAAc,KAAA,GAAW;EAE3B,MAAM,UAAU,OAAO,WAAW,YAAY,WAAW,KAAA,IAAY,SAAS,CAAC,GAAG,MAAM;EACxF,YAAY,IAAI,KAAK,aAAa,SAAS,OAAO;EAClD,IAAI,WAAW,QAAQ,aAAa;GAClC,MAAM,SAAS,WAAW,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC;GACxC,IAAI,WAAW,KAAA,GAAW,WAAW,OAAO,MAAM;EACpD;EACA,WAAW,IAAI,KAAK,SAAS;CAC/B;CACA,OAAO;AACT;;;;;;AAOA,SAAgB,iBACd,OACA,KACA,KACA,QACA,QACQ;CACR,MAAM,eAAe,WAAW,KAAA,KAAa,OAAO,UAAU;CAC9D,OAAO,gBAAgB,QAAQ,MAAM,CAAC,CAAC,OAAO,eAAe,SAAS,OAAO,KAAK,GAAG,IAAI,KAAK;AAChG"}
@@ -1,2 +1,2 @@
1
- import "./types.mjs";
2
- import { CSSProperties, ReactNode, Ref } from "react";
1
+ import "react";
2
+ import "./types.mjs";
@@ -1,6 +1,6 @@
1
- import { mergeProps, mergeRefs } from "./merge-props.mjs";
2
1
  import { cloneElement, createElement, isValidElement } from "react";
3
- //#region src/internal/render-element.ts
2
+ import { mergeProps, mergeRefs } from "./merge-props.mjs";
3
+ // src/internal/render-element.ts
4
4
  function resolveStateValue(value, state) {
5
5
  return typeof value === "function" ? value(state) : value;
6
6
  }
@@ -117,7 +117,6 @@ function renderElement(options) {
117
117
  if (typeof render === "function") return render(resolved, state);
118
118
  return createElement(defaultElement, resolved);
119
119
  }
120
- //#endregion
121
120
  export { cancelClick, disabledButton, isHostButton, mergeRenderRef, pendingAriaDisabled, renderElement, rendersButton, resolveStateValue };
122
121
 
123
122
  //# sourceMappingURL=render-element.mjs.map
@@ -1,4 +1,4 @@
1
- //#region src/internal/shipped-styles.ts
1
+ // src/internal/shipped-styles.ts
2
2
  /**
3
3
  * The React stylesheet precedence bucket of the library's functional CSS. Fizz writes every
4
4
  * same-precedence `<style>` of one server flush as a single element with the texts concatenated,
@@ -8,7 +8,6 @@
8
8
  * `csp/csp.test.tsx`).
9
9
  */
10
10
  const FSUI_PRECEDENCE = "fsui";
11
- //#endregion
12
11
  export { FSUI_PRECEDENCE };
13
12
 
14
13
  //# sourceMappingURL=shipped-styles.mjs.map
@@ -69,7 +69,6 @@ function releaseOutcome(offset, extent, velocity) {
69
69
  if (velocity >= .5) return "dismiss";
70
70
  return extent > 0 && offset >= extent * .25 ? "dismiss" : "return";
71
71
  }
72
- //#endregion
73
72
  export { SWIPE_DISMISS_FRACTION, SWIPE_FLICK_VELOCITY, classifyPress, releaseOutcome, releaseVelocity, swipeOffset, swipeProgress, swipeTranslation, swipeVector, towardEdge };
74
73
 
75
74
  //# sourceMappingURL=swipe-arithmetic.mjs.map
@@ -1,6 +1,6 @@
1
- import { classifyPress, releaseOutcome, releaseVelocity, swipeOffset, swipeProgress, towardEdge } from "./swipe-arithmetic.mjs";
2
1
  import { capturePointer } from "./pointer-capture.mjs";
3
- //#region src/internal/swipe.ts
2
+ import { classifyPress, releaseOutcome, releaseVelocity, swipeOffset, swipeProgress, towardEdge } from "./swipe-arithmetic.mjs";
3
+ // src/internal/swipe.ts
4
4
  /** The document's selection when it is not collapsed, else `null`. */
5
5
  function selectionOf(doc) {
6
6
  const selection = doc.getSelection();
@@ -163,7 +163,6 @@ function trackSwipe(element, options) {
163
163
  }
164
164
  };
165
165
  }
166
- //#endregion
167
166
  export { trackSwipe };
168
167
 
169
168
  //# sourceMappingURL=swipe.mjs.map
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { createContext, use } from "react";
3
- //#region src/internal/toolbar-context.ts
3
+ // src/internal/toolbar-context.ts
4
4
  /**
5
5
  * Provided by `Toolbar.Root`; read across folders by `ToggleGroup.Root` (joins the Toolbar's
6
6
  * sequence instead of running its own engine), `Toolbar.Separator` (perpendicular orientation)
@@ -11,7 +11,6 @@ const ToolbarContext = createContext(null);
11
11
  function useToolbarContext() {
12
12
  return use(ToolbarContext);
13
13
  }
14
- //#endregion
15
14
  export { ToolbarContext, useToolbarContext };
16
15
 
17
16
  //# sourceMappingURL=toolbar-context.mjs.map
@@ -1,8 +1,8 @@
1
1
  "use client";
2
- import { useDevWarning } from "./use-dev-warning.mjs";
3
2
  import { ViewTransition, useState } from "react";
3
+ import { useDevWarning } from "./use-dev-warning.mjs";
4
4
  import { jsx } from "react/jsx-runtime";
5
- //#region src/internal/transition-boundary.tsx
5
+ // src/internal/transition-boundary.tsx
6
6
  const isDev = process.env.NODE_ENV !== "production";
7
7
  /**
8
8
  * Wraps a part's output in `<ViewTransition default={transition}>` **only when the consumer
@@ -42,7 +42,6 @@ function useTransitionBoundary(part, transition, node) {
42
42
  useDevWarning(hasBoundary !== initial, isDev && `${part}: \`transition\` changed between undefined and a value after mount. The part renders a <ViewTransition> only when \`transition\` is given, so this remounts its subtree (DOM and state are lost). Keep \`transition\` static; use \`transition="none"\` to switch animation off without removing the boundary.`);
43
43
  return transitionBoundary(transition, node);
44
44
  }
45
- //#endregion
46
45
  export { transitionBoundary, useTransitionBoundary };
47
46
 
48
47
  //# sourceMappingURL=transition-boundary.mjs.map