@funstack/ui 0.1.0-alpha.11 → 0.1.0-alpha.13

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 (416) hide show
  1. package/dist/accordion/accordion-context.mjs.map +1 -1
  2. package/dist/accordion/accordion-item.d.mts +3 -4
  3. package/dist/accordion/accordion-item.d.mts.map +1 -1
  4. package/dist/accordion/accordion-item.mjs +10 -4
  5. package/dist/accordion/accordion-item.mjs.map +1 -1
  6. package/dist/accordion/accordion-panel.d.mts +3 -4
  7. package/dist/accordion/accordion-panel.d.mts.map +1 -1
  8. package/dist/accordion/accordion-panel.mjs +2 -1
  9. package/dist/accordion/accordion-panel.mjs.map +1 -1
  10. package/dist/accordion/accordion-root.d.mts +3 -3
  11. package/dist/accordion/accordion-root.d.mts.map +1 -1
  12. package/dist/accordion/accordion-root.mjs +8 -19
  13. package/dist/accordion/accordion-root.mjs.map +1 -1
  14. package/dist/accordion/accordion-trigger.d.mts +3 -4
  15. package/dist/accordion/accordion-trigger.d.mts.map +1 -1
  16. package/dist/accordion/accordion-trigger.mjs +5 -3
  17. package/dist/accordion/accordion-trigger.mjs.map +1 -1
  18. package/dist/button/button.d.mts +4 -2
  19. package/dist/button/button.d.mts.map +1 -1
  20. package/dist/button/button.mjs +3 -2
  21. package/dist/button/button.mjs.map +1 -1
  22. package/dist/checkbox/checkbox.d.mts +4 -5
  23. package/dist/checkbox/checkbox.d.mts.map +1 -1
  24. package/dist/checkbox/checkbox.mjs +16 -59
  25. package/dist/checkbox/checkbox.mjs.map +1 -1
  26. package/dist/checkbox-group/checkbox-group-context.mjs.map +1 -1
  27. package/dist/checkbox-group/checkbox-group-item.d.mts +3 -4
  28. package/dist/checkbox-group/checkbox-group-item.d.mts.map +1 -1
  29. package/dist/checkbox-group/checkbox-group-item.mjs +21 -27
  30. package/dist/checkbox-group/checkbox-group-item.mjs.map +1 -1
  31. package/dist/checkbox-group/checkbox-group-label.mjs +1 -6
  32. package/dist/checkbox-group/checkbox-group-label.mjs.map +1 -1
  33. package/dist/checkbox-group/checkbox-group-parent.d.mts +3 -4
  34. package/dist/checkbox-group/checkbox-group-parent.d.mts.map +1 -1
  35. package/dist/checkbox-group/checkbox-group-parent.mjs +12 -10
  36. package/dist/checkbox-group/checkbox-group-parent.mjs.map +1 -1
  37. package/dist/checkbox-group/checkbox-group-root.d.mts +1 -1
  38. package/dist/checkbox-group/checkbox-group-root.d.mts.map +1 -1
  39. package/dist/checkbox-group/checkbox-group-root.mjs +74 -101
  40. package/dist/checkbox-group/checkbox-group-root.mjs.map +1 -1
  41. package/dist/combobox/combobox-clear.d.mts.map +1 -1
  42. package/dist/combobox/combobox-clear.mjs +5 -6
  43. package/dist/combobox/combobox-clear.mjs.map +1 -1
  44. package/dist/combobox/combobox-context.mjs.map +1 -1
  45. package/dist/combobox/combobox-group.d.mts.map +1 -1
  46. package/dist/combobox/combobox-group.mjs +2 -1
  47. package/dist/combobox/combobox-group.mjs.map +1 -1
  48. package/dist/combobox/combobox-input.d.mts +6 -5
  49. package/dist/combobox/combobox-input.d.mts.map +1 -1
  50. package/dist/combobox/combobox-input.mjs +29 -14
  51. package/dist/combobox/combobox-input.mjs.map +1 -1
  52. package/dist/combobox/combobox-list.d.mts.map +1 -1
  53. package/dist/combobox/combobox-list.mjs +6 -10
  54. package/dist/combobox/combobox-list.mjs.map +1 -1
  55. package/dist/combobox/combobox-option.d.mts.map +1 -1
  56. package/dist/combobox/combobox-option.mjs +2 -1
  57. package/dist/combobox/combobox-option.mjs.map +1 -1
  58. package/dist/combobox/combobox-popup.d.mts.map +1 -1
  59. package/dist/combobox/combobox-popup.mjs +9 -25
  60. package/dist/combobox/combobox-popup.mjs.map +1 -1
  61. package/dist/combobox/combobox-root.d.mts.map +1 -1
  62. package/dist/combobox/combobox-root.mjs +101 -106
  63. package/dist/combobox/combobox-root.mjs.map +1 -1
  64. package/dist/combobox/combobox-trigger.d.mts +9 -6
  65. package/dist/combobox/combobox-trigger.d.mts.map +1 -1
  66. package/dist/combobox/combobox-trigger.mjs +36 -43
  67. package/dist/combobox/combobox-trigger.mjs.map +1 -1
  68. package/dist/combobox/index.mjs +1 -1
  69. package/dist/combobox/use-combobox-form.mjs +56 -0
  70. package/dist/combobox/use-combobox-form.mjs.map +1 -0
  71. package/dist/combobox/use-option-registry.mjs +62 -0
  72. package/dist/combobox/use-option-registry.mjs.map +1 -0
  73. package/dist/dialog/dialog-close.d.mts.map +1 -1
  74. package/dist/dialog/dialog-close.mjs +29 -62
  75. package/dist/dialog/dialog-close.mjs.map +1 -1
  76. package/dist/dialog/dialog-context.mjs.map +1 -1
  77. package/dist/dialog/dialog-form.d.mts.map +1 -1
  78. package/dist/dialog/dialog-form.mjs +5 -4
  79. package/dist/dialog/dialog-form.mjs.map +1 -1
  80. package/dist/dialog/dialog-popup.d.mts +5 -5
  81. package/dist/dialog/dialog-popup.d.mts.map +1 -1
  82. package/dist/dialog/dialog-popup.mjs +39 -103
  83. package/dist/dialog/dialog-popup.mjs.map +1 -1
  84. package/dist/dialog/dialog-root.d.mts.map +1 -1
  85. package/dist/dialog/dialog-root.mjs +30 -118
  86. package/dist/dialog/dialog-root.mjs.map +1 -1
  87. package/dist/dialog/dialog-trigger.d.mts +2 -1
  88. package/dist/dialog/dialog-trigger.d.mts.map +1 -1
  89. package/dist/dialog/dialog-trigger.mjs +27 -23
  90. package/dist/dialog/dialog-trigger.mjs.map +1 -1
  91. package/dist/field/field-control.mjs +6 -13
  92. package/dist/field/field-control.mjs.map +1 -1
  93. package/dist/field/field-description.d.mts.map +1 -1
  94. package/dist/field/field-description.mjs +1 -2
  95. package/dist/field/field-description.mjs.map +1 -1
  96. package/dist/field/field-error.d.mts.map +1 -1
  97. package/dist/field/field-error.mjs +1 -2
  98. package/dist/field/field-error.mjs.map +1 -1
  99. package/dist/field/field-label.d.mts.map +1 -1
  100. package/dist/field/field-label.mjs +3 -11
  101. package/dist/field/field-label.mjs.map +1 -1
  102. package/dist/field/field-root.mjs +22 -42
  103. package/dist/field/field-root.mjs.map +1 -1
  104. package/dist/field/index.mjs +1 -1
  105. package/dist/field/use-server-error-visibility.mjs +44 -0
  106. package/dist/field/use-server-error-visibility.mjs.map +1 -0
  107. package/dist/form/form-root.d.mts.map +1 -1
  108. package/dist/form/form-root.mjs +6 -7
  109. package/dist/form/form-root.mjs.map +1 -1
  110. package/dist/form/form-submit.d.mts +1 -1
  111. package/dist/form/form-submit.mjs +4 -10
  112. package/dist/form/form-submit.mjs.map +1 -1
  113. package/dist/index.d.mts +2 -2
  114. package/dist/internal/anchor-position.mjs +1 -59
  115. package/dist/internal/anchor-position.mjs.map +1 -1
  116. package/dist/internal/announce.mjs +4 -42
  117. package/dist/internal/announce.mjs.map +1 -1
  118. package/dist/internal/arrow-keys.mjs +21 -0
  119. package/dist/internal/arrow-keys.mjs.map +1 -0
  120. package/dist/internal/decimal.mjs +7 -1
  121. package/dist/internal/decimal.mjs.map +1 -1
  122. package/dist/internal/dom-order.mjs +17 -0
  123. package/dist/internal/dom-order.mjs.map +1 -0
  124. package/dist/internal/field-context.d.mts.map +1 -1
  125. package/dist/internal/field-context.mjs +11 -1
  126. package/dist/internal/field-context.mjs.map +1 -1
  127. package/dist/internal/focus-first-invalid.mjs +16 -7
  128. package/dist/internal/focus-first-invalid.mjs.map +1 -1
  129. package/dist/internal/group-member.mjs +37 -0
  130. package/dist/internal/group-member.mjs.map +1 -0
  131. package/dist/internal/overlay-popup.mjs +103 -0
  132. package/dist/internal/overlay-popup.mjs.map +1 -0
  133. package/dist/internal/pointer-capture.mjs +20 -0
  134. package/dist/internal/pointer-capture.mjs.map +1 -0
  135. package/dist/internal/popover-open.mjs +18 -0
  136. package/dist/internal/popover-open.mjs.map +1 -0
  137. package/dist/internal/render-element.d.mts +2 -0
  138. package/dist/internal/render-element.mjs +20 -2
  139. package/dist/internal/render-element.mjs.map +1 -1
  140. package/dist/internal/shipped-styles.mjs +14 -0
  141. package/dist/internal/shipped-styles.mjs.map +1 -0
  142. package/dist/internal/sync-presence.mjs +5 -1
  143. package/dist/internal/sync-presence.mjs.map +1 -1
  144. package/dist/internal/toolbar-context.mjs.map +1 -1
  145. package/dist/internal/tooltip-warm.mjs +1 -1
  146. package/dist/internal/tooltip-warm.mjs.map +1 -1
  147. package/dist/internal/transition-boundary.mjs +1 -1
  148. package/dist/internal/transition-boundary.mjs.map +1 -1
  149. package/dist/internal/trigger-ref.mjs +26 -0
  150. package/dist/internal/trigger-ref.mjs.map +1 -0
  151. package/dist/internal/types.d.mts +2 -0
  152. package/dist/internal/types.d.mts.map +1 -1
  153. package/dist/internal/use-action-trigger.mjs +5 -23
  154. package/dist/internal/use-action-trigger.mjs.map +1 -1
  155. package/dist/internal/use-checkable-input.mjs +79 -0
  156. package/dist/internal/use-checkable-input.mjs.map +1 -0
  157. package/dist/internal/use-controllable-action.mjs +16 -24
  158. package/dist/internal/use-controllable-action.mjs.map +1 -1
  159. package/dist/internal/use-dev-warning.mjs +8 -4
  160. package/dist/internal/use-dev-warning.mjs.map +1 -1
  161. package/dist/internal/use-element-check.mjs +39 -0
  162. package/dist/internal/use-element-check.mjs.map +1 -0
  163. package/dist/internal/use-exit-animation.mjs +1 -1
  164. package/dist/internal/use-exit-animation.mjs.map +1 -1
  165. package/dist/internal/use-field-control.mjs +28 -12
  166. package/dist/internal/use-field-control.mjs.map +1 -1
  167. package/dist/internal/use-fieldset-group.mjs +46 -0
  168. package/dist/internal/use-fieldset-group.mjs.map +1 -0
  169. package/dist/internal/use-form-reset.mjs +1 -5
  170. package/dist/internal/use-form-reset.mjs.map +1 -1
  171. package/dist/internal/use-item-order.mjs +42 -0
  172. package/dist/internal/use-item-order.mjs.map +1 -0
  173. package/dist/internal/use-latest.mjs +4 -8
  174. package/dist/internal/use-latest.mjs.map +1 -1
  175. package/dist/internal/use-merged-refs.mjs +19 -0
  176. package/dist/internal/use-merged-refs.mjs.map +1 -0
  177. package/dist/internal/use-name-warning.mjs +84 -0
  178. package/dist/internal/use-name-warning.mjs.map +1 -0
  179. package/dist/internal/use-native-checked.mjs +4 -6
  180. package/dist/internal/use-native-checked.mjs.map +1 -1
  181. package/dist/internal/use-native-focusgroup.mjs +19 -0
  182. package/dist/internal/use-native-focusgroup.mjs.map +1 -0
  183. package/dist/internal/use-native-group-reconciliation.mjs.map +1 -1
  184. package/dist/internal/use-overlay-close.mjs +63 -0
  185. package/dist/internal/use-overlay-close.mjs.map +1 -0
  186. package/dist/internal/{use-popover-root.mjs → use-overlay-root.mjs} +32 -39
  187. package/dist/internal/use-overlay-root.mjs.map +1 -0
  188. package/dist/internal/use-popover-popup.mjs +38 -80
  189. package/dist/internal/use-popover-popup.mjs.map +1 -1
  190. package/dist/internal/use-popover-trigger.d.mts +15 -0
  191. package/dist/internal/use-popover-trigger.d.mts.map +1 -0
  192. package/dist/internal/use-popover-trigger.mjs +28 -24
  193. package/dist/internal/use-popover-trigger.mjs.map +1 -1
  194. package/dist/internal/use-register-count.mjs +24 -0
  195. package/dist/internal/use-register-count.mjs.map +1 -0
  196. package/dist/internal/use-render.d.mts +2 -0
  197. package/dist/internal/use-render.mjs +2 -2
  198. package/dist/internal/use-render.mjs.map +1 -1
  199. package/dist/internal/use-resolved-placement.mjs +38 -22
  200. package/dist/internal/use-resolved-placement.mjs.map +1 -1
  201. package/dist/internal/use-roving-focus.mjs +5 -18
  202. package/dist/internal/use-roving-focus.mjs.map +1 -1
  203. package/dist/internal/use-superseded-rejection.mjs +47 -0
  204. package/dist/internal/use-superseded-rejection.mjs.map +1 -0
  205. package/dist/internal/validity.mjs +1 -13
  206. package/dist/internal/validity.mjs.map +1 -1
  207. package/dist/internal/value-set.mjs +41 -0
  208. package/dist/internal/value-set.mjs.map +1 -0
  209. package/dist/menu/index.d.mts +1 -1
  210. package/dist/menu/menu-checkbox-item.mjs.map +1 -1
  211. package/dist/menu/menu-context-trigger.d.mts +2 -7
  212. package/dist/menu/menu-context-trigger.d.mts.map +1 -1
  213. package/dist/menu/menu-context-trigger.mjs +11 -187
  214. package/dist/menu/menu-context-trigger.mjs.map +1 -1
  215. package/dist/menu/menu-context.d.mts +1 -1
  216. package/dist/menu/menu-context.mjs +1 -1
  217. package/dist/menu/menu-context.mjs.map +1 -1
  218. package/dist/menu/menu-dom.mjs +2 -17
  219. package/dist/menu/menu-dom.mjs.map +1 -1
  220. package/dist/menu/menu-gestures.mjs +166 -0
  221. package/dist/menu/menu-gestures.mjs.map +1 -0
  222. package/dist/menu/menu-group.d.mts.map +1 -1
  223. package/dist/menu/menu-group.mjs +2 -1
  224. package/dist/menu/menu-group.mjs.map +1 -1
  225. package/dist/menu/menu-hover.mjs +0 -1
  226. package/dist/menu/menu-hover.mjs.map +1 -1
  227. package/dist/menu/menu-item.mjs.map +1 -1
  228. package/dist/menu/menu-outside.mjs +101 -0
  229. package/dist/menu/menu-outside.mjs.map +1 -0
  230. package/dist/menu/menu-point.mjs +85 -0
  231. package/dist/menu/menu-point.mjs.map +1 -0
  232. package/dist/menu/menu-popup.d.mts +6 -7
  233. package/dist/menu/menu-popup.d.mts.map +1 -1
  234. package/dist/menu/menu-popup.mjs +38 -248
  235. package/dist/menu/menu-popup.mjs.map +1 -1
  236. package/dist/menu/menu-radio-group.mjs.map +1 -1
  237. package/dist/menu/menu-radio-item.d.mts +2 -0
  238. package/dist/menu/menu-radio-item.d.mts.map +1 -1
  239. package/dist/menu/menu-radio-item.mjs +1 -0
  240. package/dist/menu/menu-radio-item.mjs.map +1 -1
  241. package/dist/menu/menu-root.d.mts +10 -0
  242. package/dist/menu/menu-root.d.mts.map +1 -1
  243. package/dist/menu/menu-root.mjs +10 -8
  244. package/dist/menu/menu-root.mjs.map +1 -1
  245. package/dist/menu/menu-submenu-trigger.d.mts.map +1 -1
  246. package/dist/menu/menu-submenu-trigger.mjs +12 -9
  247. package/dist/menu/menu-submenu-trigger.mjs.map +1 -1
  248. package/dist/menu/menu-trigger.d.mts +10 -11
  249. package/dist/menu/menu-trigger.d.mts.map +1 -1
  250. package/dist/menu/menu-trigger.mjs +14 -7
  251. package/dist/menu/menu-trigger.mjs.map +1 -1
  252. package/dist/menu/use-menu-item.mjs +14 -16
  253. package/dist/menu/use-menu-item.mjs.map +1 -1
  254. package/dist/menu/use-menu-keyboard.mjs +88 -0
  255. package/dist/menu/use-menu-keyboard.mjs.map +1 -0
  256. package/dist/meter/meter-root.mjs +1 -1
  257. package/dist/number-field/index.d.mts +2 -1
  258. package/dist/number-field/index.d.mts.map +1 -1
  259. package/dist/number-field/index.mjs +2 -2
  260. package/dist/number-field/index.mjs.map +1 -1
  261. package/dist/number-field/number-field-arithmetic.mjs +30 -11
  262. package/dist/number-field/number-field-arithmetic.mjs.map +1 -1
  263. package/dist/number-field/number-field-context.d.mts +6 -1
  264. package/dist/number-field/number-field-context.d.mts.map +1 -0
  265. package/dist/number-field/number-field-context.mjs.map +1 -1
  266. package/dist/number-field/number-field-decrement.d.mts +1 -1
  267. package/dist/number-field/number-field-decrement.mjs +1 -1
  268. package/dist/number-field/number-field-decrement.mjs.map +1 -1
  269. package/dist/number-field/number-field-increment.d.mts +2 -22
  270. package/dist/number-field/number-field-increment.d.mts.map +1 -1
  271. package/dist/number-field/number-field-increment.mjs +2 -53
  272. package/dist/number-field/number-field-increment.mjs.map +1 -1
  273. package/dist/number-field/number-field-input.d.mts.map +1 -1
  274. package/dist/number-field/number-field-input.mjs +18 -22
  275. package/dist/number-field/number-field-input.mjs.map +1 -1
  276. package/dist/number-field/number-field-label.d.mts.map +1 -1
  277. package/dist/number-field/number-field-label.mjs +3 -9
  278. package/dist/number-field/number-field-label.mjs.map +1 -1
  279. package/dist/number-field/number-field-root.d.mts +3 -2
  280. package/dist/number-field/number-field-root.d.mts.map +1 -1
  281. package/dist/number-field/number-field-root.mjs +81 -91
  282. package/dist/number-field/number-field-root.mjs.map +1 -1
  283. package/dist/number-field/use-number-field-dev-warnings.mjs +28 -0
  284. package/dist/number-field/use-number-field-dev-warnings.mjs.map +1 -0
  285. package/dist/number-field/use-step-button.d.mts +24 -0
  286. package/dist/number-field/use-step-button.d.mts.map +1 -0
  287. package/dist/number-field/use-step-button.mjs +57 -3
  288. package/dist/number-field/use-step-button.mjs.map +1 -1
  289. package/dist/popover/popover-close.d.mts.map +1 -1
  290. package/dist/popover/popover-close.mjs +28 -67
  291. package/dist/popover/popover-close.mjs.map +1 -1
  292. package/dist/popover/popover-context.mjs.map +1 -1
  293. package/dist/popover/popover-popup.d.mts +9 -6
  294. package/dist/popover/popover-popup.d.mts.map +1 -1
  295. package/dist/popover/popover-popup.mjs +13 -36
  296. package/dist/popover/popover-popup.mjs.map +1 -1
  297. package/dist/popover/popover-root.mjs +4 -3
  298. package/dist/popover/popover-root.mjs.map +1 -1
  299. package/dist/popover/popover-trigger.d.mts +10 -10
  300. package/dist/popover/popover-trigger.d.mts.map +1 -1
  301. package/dist/popover/popover-trigger.mjs +4 -2
  302. package/dist/popover/popover-trigger.mjs.map +1 -1
  303. package/dist/progress/progress-root.mjs +1 -1
  304. package/dist/radio-group/radio-group-context.mjs.map +1 -1
  305. package/dist/radio-group/radio-group-item.d.mts +3 -4
  306. package/dist/radio-group/radio-group-item.d.mts.map +1 -1
  307. package/dist/radio-group/radio-group-item.mjs +20 -25
  308. package/dist/radio-group/radio-group-item.mjs.map +1 -1
  309. package/dist/radio-group/radio-group-label.mjs +1 -6
  310. package/dist/radio-group/radio-group-label.mjs.map +1 -1
  311. package/dist/radio-group/radio-group-root.d.mts +1 -1
  312. package/dist/radio-group/radio-group-root.d.mts.map +1 -1
  313. package/dist/radio-group/radio-group-root.mjs +21 -40
  314. package/dist/radio-group/radio-group-root.mjs.map +1 -1
  315. package/dist/select/select-dom.mjs +9 -18
  316. package/dist/select/select-dom.mjs.map +1 -1
  317. package/dist/select/select-option.mjs +1 -1
  318. package/dist/select/select-root.mjs +3 -2
  319. package/dist/select/select-root.mjs.map +1 -1
  320. package/dist/slider/slider-arithmetic.mjs +74 -13
  321. package/dist/slider/slider-arithmetic.mjs.map +1 -1
  322. package/dist/slider/slider-context.mjs.map +1 -1
  323. package/dist/slider/slider-label.d.mts.map +1 -1
  324. package/dist/slider/slider-label.mjs +3 -9
  325. package/dist/slider/slider-label.mjs.map +1 -1
  326. package/dist/slider/slider-root.d.mts +2 -2
  327. package/dist/slider/slider-root.d.mts.map +1 -1
  328. package/dist/slider/slider-root.mjs +36 -116
  329. package/dist/slider/slider-root.mjs.map +1 -1
  330. package/dist/slider/slider-thumb.d.mts.map +1 -1
  331. package/dist/slider/slider-thumb.mjs +8 -6
  332. package/dist/slider/slider-thumb.mjs.map +1 -1
  333. package/dist/slider/slider-value.d.mts.map +1 -1
  334. package/dist/slider/slider-value.mjs +2 -1
  335. package/dist/slider/slider-value.mjs.map +1 -1
  336. package/dist/slider/use-slider-dev-warnings.mjs +29 -0
  337. package/dist/slider/use-slider-dev-warnings.mjs.map +1 -0
  338. package/dist/slider/use-thumb-registry.mjs +51 -0
  339. package/dist/slider/use-thumb-registry.mjs.map +1 -0
  340. package/dist/switch/switch.d.mts +4 -5
  341. package/dist/switch/switch.d.mts.map +1 -1
  342. package/dist/switch/switch.mjs +15 -55
  343. package/dist/switch/switch.mjs.map +1 -1
  344. package/dist/tabs/tabs-context.d.mts +2 -3
  345. package/dist/tabs/tabs-context.d.mts.map +1 -1
  346. package/dist/tabs/tabs-context.mjs.map +1 -1
  347. package/dist/tabs/tabs-list.d.mts.map +1 -1
  348. package/dist/tabs/tabs-list.mjs +9 -22
  349. package/dist/tabs/tabs-list.mjs.map +1 -1
  350. package/dist/tabs/tabs-panel.d.mts +3 -4
  351. package/dist/tabs/tabs-panel.d.mts.map +1 -1
  352. package/dist/tabs/tabs-panel.mjs.map +1 -1
  353. package/dist/tabs/tabs-root.d.mts +4 -3
  354. package/dist/tabs/tabs-root.d.mts.map +1 -1
  355. package/dist/tabs/tabs-root.mjs +2 -1
  356. package/dist/tabs/tabs-root.mjs.map +1 -1
  357. package/dist/tabs/tabs-tab.d.mts +3 -4
  358. package/dist/tabs/tabs-tab.d.mts.map +1 -1
  359. package/dist/tabs/tabs-tab.mjs.map +1 -1
  360. package/dist/toast/toast-action.mjs.map +1 -1
  361. package/dist/toast/toast-close.d.mts.map +1 -1
  362. package/dist/toast/toast-close.mjs +2 -8
  363. package/dist/toast/toast-close.mjs.map +1 -1
  364. package/dist/toast/toast-context.mjs.map +1 -1
  365. package/dist/toast/toast-hotkey.mjs +27 -0
  366. package/dist/toast/toast-hotkey.mjs.map +1 -0
  367. package/dist/toast/toast-queue.mjs +137 -0
  368. package/dist/toast/toast-queue.mjs.map +1 -0
  369. package/dist/toast/toast-root.d.mts.map +1 -1
  370. package/dist/toast/toast-root.mjs +2 -0
  371. package/dist/toast/toast-root.mjs.map +1 -1
  372. package/dist/toast/toast-timers.mjs +65 -0
  373. package/dist/toast/toast-timers.mjs.map +1 -0
  374. package/dist/toast/toast-viewport.d.mts.map +1 -1
  375. package/dist/toast/toast-viewport.mjs +30 -235
  376. package/dist/toast/toast-viewport.mjs.map +1 -1
  377. package/dist/toast/toast.mjs +1 -1
  378. package/dist/toast/toast.mjs.map +1 -1
  379. package/dist/toast/use-modal-portal-host.mjs +52 -0
  380. package/dist/toast/use-modal-portal-host.mjs.map +1 -0
  381. package/dist/toggle/toggle.d.mts +3 -4
  382. package/dist/toggle/toggle.d.mts.map +1 -1
  383. package/dist/toggle/toggle.mjs +7 -10
  384. package/dist/toggle/toggle.mjs.map +1 -1
  385. package/dist/toggle-group/toggle-group-context.d.mts +2 -1
  386. package/dist/toggle-group/toggle-group-context.d.mts.map +1 -1
  387. package/dist/toggle-group/toggle-group-context.mjs.map +1 -1
  388. package/dist/toggle-group/toggle-group-item.d.mts +7 -3
  389. package/dist/toggle-group/toggle-group-item.d.mts.map +1 -1
  390. package/dist/toggle-group/toggle-group-item.mjs +6 -7
  391. package/dist/toggle-group/toggle-group-item.mjs.map +1 -1
  392. package/dist/toggle-group/toggle-group-root.d.mts.map +1 -1
  393. package/dist/toggle-group/toggle-group-root.mjs +29 -64
  394. package/dist/toggle-group/toggle-group-root.mjs.map +1 -1
  395. package/dist/toolbar/toolbar-root.d.mts +2 -2
  396. package/dist/toolbar/toolbar-root.d.mts.map +1 -1
  397. package/dist/toolbar/toolbar-root.mjs +3 -4
  398. package/dist/toolbar/toolbar-root.mjs.map +1 -1
  399. package/dist/tooltip/tooltip-context.d.mts +1 -1
  400. package/dist/tooltip/tooltip-context.mjs.map +1 -1
  401. package/dist/tooltip/tooltip-popup.d.mts.map +1 -1
  402. package/dist/tooltip/tooltip-popup.mjs +6 -15
  403. package/dist/tooltip/tooltip-popup.mjs.map +1 -1
  404. package/dist/tooltip/tooltip-root.mjs +2 -2
  405. package/dist/tooltip/tooltip-root.mjs.map +1 -1
  406. package/dist/tooltip/tooltip-trigger.d.mts +2 -1
  407. package/dist/tooltip/tooltip-trigger.d.mts.map +1 -1
  408. package/dist/tooltip/tooltip-trigger.mjs +3 -2
  409. package/dist/tooltip/tooltip-trigger.mjs.map +1 -1
  410. package/dist/tooltip/use-tooltip-interaction.mjs +4 -3
  411. package/dist/tooltip/use-tooltip-interaction.mjs.map +1 -1
  412. package/package.json +3 -2
  413. package/dist/accordion/accordion-context.d.mts +0 -5
  414. package/dist/accordion/accordion-context.d.mts.map +0 -1
  415. package/dist/internal/use-popover-root.mjs.map +0 -1
  416. /package/dist/internal/{use-popover-root.d.mts → use-overlay-root.d.mts} +0 -0
@@ -1,15 +1,12 @@
1
1
  "use client";
2
- import { ToolbarContext } from "../internal/toolbar-context.mjs";
3
2
  import { useTransitionBoundary } from "../internal/transition-boundary.mjs";
4
- import { useDevWarning } from "../internal/use-dev-warning.mjs";
5
- import { mergeRefs } from "../internal/merge-props.mjs";
6
3
  import { resolveStateValue } from "../internal/render-element.mjs";
7
4
  import { useRender } from "../internal/use-render.mjs";
8
- import { POSITION_TRY_FALLBACKS, positionArea } from "../internal/anchor-position.mjs";
9
- import { useResolvedPlacement } from "../internal/use-resolved-placement.mjs";
5
+ import { useMergedRefs } from "../internal/use-merged-refs.mjs";
6
+ import { useAnchoredPlacement } from "../internal/use-resolved-placement.mjs";
7
+ import { useJsFreePropWarnings } from "../internal/overlay-popup.mjs";
10
8
  import { PopoverPopupContext, usePopoverContext } from "./popover-context.mjs";
11
9
  import { usePopoverPopup } from "../internal/use-popover-popup.mjs";
12
- import { Activity, useMemo } from "react";
13
10
  import { jsx } from "react/jsx-runtime";
14
11
  //#region src/popover/popover-popup.tsx
15
12
  /**
@@ -34,41 +31,28 @@ function PopoverPopup({ side: sideProp = "bottom", align: alignProp = "center",
34
31
  const ctx = usePopoverContext("Popover.Popup");
35
32
  const isLibrary = ctx.mode === "library";
36
33
  const { ids } = ctx;
37
- useDevWarning(!isLibrary && transition !== void 0, "Popover.Popup: `transition` has no effect in JS-free mode; the browser opens and closes the popover outside any React transition. Animate it with CSS (`@starting-style`).");
38
- useDevWarning(!isLibrary && keepMounted === false, "Popover.Popup: `keepMounted={false}` cannot be honoured in JS-free mode; the content is always mounted so that the server HTML is complete.");
39
- const { setElement, visible, wrapContent } = usePopoverPopup(ctx, {
34
+ useJsFreePropWarnings("Popover.Popup", "popover", isLibrary, transition, keepMounted);
35
+ const { setElement, renderContent } = usePopoverPopup(ctx, {
40
36
  part: "Popover.Popup",
41
37
  initialFocus,
42
38
  keepMounted,
43
39
  transition: isLibrary ? transition : void 0
44
40
  });
45
- const placement = useResolvedPlacement({
41
+ const placement = useAnchoredPlacement({
46
42
  side: sideProp,
47
43
  align: alignProp
48
44
  });
49
45
  const { side, align } = placement;
50
- const ref = useMemo(() => mergeRefs(setElement, placement.ref), [setElement, placement.ref]);
46
+ const ref = useMergedRefs(setElement, placement.ref);
51
47
  const state = {
52
48
  open: ctx.committed,
53
49
  side,
54
50
  align
55
51
  };
56
- const content = (s) => {
57
- let node;
58
- if (!isLibrary) node = resolveStateValue(children, s);
59
- else if (keepMounted === true) node = /* @__PURE__ */ jsx(Activity, {
60
- mode: visible ? "visible" : "hidden",
61
- children: wrapContent(resolveStateValue(children, s))
62
- });
63
- else node = visible ? wrapContent(resolveStateValue(children, s)) : null;
64
- return /* @__PURE__ */ jsx(PopoverPopupContext, {
65
- value: s,
66
- children: /* @__PURE__ */ jsx(ToolbarContext, {
67
- value: null,
68
- children: node
69
- })
70
- });
71
- };
52
+ const content = (s) => /* @__PURE__ */ jsx(PopoverPopupContext, {
53
+ value: s,
54
+ children: renderContent(() => resolveStateValue(children, s))
55
+ });
72
56
  const libraryProps = {
73
57
  id: ids.popup,
74
58
  popover: "auto",
@@ -76,21 +60,14 @@ function PopoverPopup({ side: sideProp = "bottom", align: alignProp = "center",
76
60
  "aria-modal": "false",
77
61
  "aria-labelledby": ids.title,
78
62
  "aria-describedby": ids.description,
79
- ...side !== null && {
80
- "data-side": side,
81
- "data-align": align
82
- }
63
+ ...placement.dataAttributes
83
64
  };
84
65
  const element = useRender({
85
66
  defaultElement: "dialog",
86
67
  render,
87
68
  state,
88
69
  className,
89
- style: sideProp === null ? style : (s) => ({
90
- positionArea: positionArea(sideProp, alignProp),
91
- positionTryFallbacks: POSITION_TRY_FALLBACKS,
92
- ...resolveStateValue(style, s)
93
- }),
70
+ style: placement.style(style),
94
71
  children: content,
95
72
  props: {
96
73
  role: "dialog",
@@ -1 +1 @@
1
- {"version":3,"file":"popover-popup.mjs","names":[],"sources":["../../src/popover/popover-popup.tsx"],"sourcesContent":["\"use client\";\nimport { Activity, useMemo } from \"react\";\nimport type {\n ComponentPropsWithRef,\n CSSProperties,\n ReactNode,\n RefObject,\n ViewTransitionClass,\n} from \"react\";\nimport { POSITION_TRY_FALLBACKS, positionArea } from \"../internal/anchor-position.js\";\nimport type { AnchorAlign, AnchorSide } from \"../internal/anchor-position.js\";\nimport { mergeRefs } from \"../internal/merge-props.js\";\nimport { ToolbarContext } from \"../internal/toolbar-context.js\";\nimport { useTransitionBoundary } from \"../internal/transition-boundary.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useDevWarning } from \"../internal/use-dev-warning.js\";\nimport { usePopoverPopup } from \"../internal/use-popover-popup.js\";\nimport { useResolvedPlacement } from \"../internal/use-resolved-placement.js\";\nimport { resolveStateValue, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport { PopoverPopupContext, usePopoverContext } from \"./popover-context.js\";\n\n/** `inline-start` / `inline-end` follow the popup's `direction` (wave 11; conventions 13.1). */\nexport type PopoverSide = AnchorSide;\nexport type PopoverAlign = AnchorAlign;\n\nexport interface PopoverPopupState {\n /** Committed open state (library mode); `false` in JS-free mode. Read `:popover-open` for the DOM truth. */\n readonly open: boolean;\n /**\n * While shown: the physical side the browser placed the popup on (after any fallback flip;\n * conventions 13.2). Otherwise the `side` prop. `null` with `side={null}`.\n */\n readonly side: PopoverSide | null;\n /** While shown: the resolved alignment; otherwise the `align` prop. */\n readonly align: PopoverAlign;\n}\n\nexport interface PopoverPopupProps extends Omit<\n ComponentPropsWithRef<\"dialog\">,\n | \"id\"\n | \"popover\"\n | \"open\"\n | \"aria-modal\"\n | \"onToggle\"\n | \"onBeforeToggle\"\n | \"className\"\n | \"style\"\n | \"children\"\n> {\n /**\n * Placement relative to the Trigger through inline `position-area`, with\n * `position-try-fallbacks` flipping it when it does not fit. Default `\"bottom\"`.\n * `\"inline-start\"` / `\"inline-end\"` follow the popup's direction. `null` emits no inline\n * positioning (and no `data-side` / `data-align`), so a stylesheet owns placement.\n */\n side?: PopoverSide | null;\n /**\n * Alignment along the side. Default `\"center\"`. On a top / bottom side `start` / `end` are\n * inline-relative (mirrored under `direction: rtl`); on the other sides the top / bottom\n * edges. Ignored when `side` is `null`.\n */\n align?: PopoverAlign;\n /**\n * Library mode: what happens to the children while the popover is closed.\n * - `false` (default): not rendered. Mounting them is part of the opening transition, so\n * content that suspends holds the open until it is ready. Unmount waits for the popover's\n * exit animation (CSS), or happens in the close commit when `transition` is set.\n * - `true`: rendered inside `<Activity mode=\"hidden\">`: DOM and state preserved, effects\n * stopped, pre-rendered at low priority. Not in the server HTML.\n *\n * Ignored in JS-free mode (always mounted).\n */\n keepMounted?: boolean;\n /**\n * Element to focus when the popover opens: a ref, or a selector resolved inside the popup.\n * The library writes `autofocus` on it right before `showPopover()` and the platform focuses\n * it. Default: the platform's choice for a `<dialog>` (first focusable descendant; the popup\n * itself if none); for `render={<div />}` focus stays on the Trigger.\n *\n * In JS-free mode the browser opens the popover itself, so the attribute is written after\n * hydration and kept while mounted; before hydration only `autoFocus` in the markup works.\n */\n initialFocus?: RefObject<HTMLElement | null> | string;\n /**\n * Library mode only. Forwarded to the `<ViewTransition default>` around the popover element\n * itself. Animates the opening commit, content changes while open, and every library-driven\n * close (Trigger, Close, controlled `open={false}`), in all engines; dismissals (Escape,\n * click outside) are the browser's and animate with CSS only. Ignored (dev warning) in JS-free\n * mode.\n *\n * Static: without `transition` the part renders no `<ViewTransition>`; changing it between\n * `undefined` and a value remounts the element. A Root inserted by a transition with\n * `transition` set on its Popup pays the page cross-fade (issue #35); a plain open does not,\n * because the children mount under the already-mounted popover element.\n */\n transition?: ViewTransitionClass;\n className?: StateValue<string | undefined, PopoverPopupState>;\n style?: StateValue<CSSProperties | undefined, PopoverPopupState>;\n children?: StateValue<ReactNode, PopoverPopupState>;\n /** A `<dialog>` (default) or a `<div>` (focus stays on the Trigger). */\n render?: RenderProp<ComponentPropsWithRef<\"dialog\">, PopoverPopupState>;\n}\n\n/**\n * The popover itself: a `<dialog popover=\"auto\" aria-modal=\"false\" role=\"dialog\">` with the id\n * the Trigger's `commandfor` names, placed against the Trigger with CSS Anchor Positioning and\n * wired to Title and Description through `aria-labelledby` / `aria-describedby`. Style it with\n * `:popover-open`; it emits `data-side` / `data-align` but no `data-open`. While shown, those are\n * where the browser placed it (the applied `position-try-fallbacks` option; conventions 13.2),\n * in both modes; otherwise the requested values.\n *\n * In library mode the children render from committed state, so content that suspends keeps the\n * popover closed (and the Trigger pending) until it is ready; `showPopover({ source: trigger })`\n * runs in the layout effect of the commit that mounted them, and a library-driven close runs\n * `hidePopover()` in the commit that ends it. Dismissals are the browser's: the native `toggle`\n * event becomes `openChangeAction(false, { reason: \"dismiss\" })`.\n *\n * Owned keys (conventions 1.2): `id`, `popover`, `open`, `aria-modal`, `aria-labelledby` and\n * `aria-describedby` (token-merged), and `data-side` / `data-align` unless `side` is `null`.\n * `role` is a default (`\"dialog\"`) the consumer may override.\n */\nexport function PopoverPopup({\n side: sideProp = \"bottom\",\n align: alignProp = \"center\",\n keepMounted,\n initialFocus,\n transition,\n className,\n style,\n children,\n render,\n ...rest\n}: PopoverPopupProps) {\n const ctx = usePopoverContext(\"Popover.Popup\");\n const isLibrary = ctx.mode === \"library\";\n const { ids } = ctx;\n\n useDevWarning(\n !isLibrary && transition !== undefined,\n \"Popover.Popup: `transition` has no effect in JS-free mode; the browser opens and closes the \" +\n \"popover outside any React transition. Animate it with CSS (`@starting-style`).\",\n );\n useDevWarning(\n !isLibrary && keepMounted === false,\n \"Popover.Popup: `keepMounted={false}` cannot be honoured in JS-free mode; the content is \" +\n \"always mounted so that the server HTML is complete.\",\n );\n\n const { setElement, visible, wrapContent } = usePopoverPopup(ctx, {\n part: \"Popover.Popup\",\n initialFocus,\n keepMounted,\n transition: isLibrary ? transition : undefined,\n });\n\n // Resolved while shown, in library and JS-free mode alike (it hangs off the element's ref and\n // the platform's `toggle`, not off library state).\n const placement = useResolvedPlacement({ side: sideProp, align: alignProp });\n const { side, align } = placement;\n const ref = useMemo(() => mergeRefs(setElement, placement.ref), [setElement, placement.ref]);\n\n const state: PopoverPopupState = { open: ctx.committed, side, align };\n\n const content = (s: PopoverPopupState): ReactNode => {\n let node: ReactNode;\n if (!isLibrary) {\n node = resolveStateValue(children, s);\n } else if (keepMounted === true) {\n // The mode changes with committed state, inside the Root's transition (conventions 5.5);\n // it stays visible while an exit animation runs.\n node = (\n <Activity mode={visible ? \"visible\" : \"hidden\"}>\n {wrapContent(resolveStateValue(children, s))}\n </Activity>\n );\n } else {\n node = visible ? wrapContent(resolveStateValue(children, s)) : null;\n }\n // Popup content is not part of an enclosing Toolbar's sequence (the engine excludes\n // `[popover]`), so parts inside it must not see the Toolbar either.\n return (\n <PopoverPopupContext value={s}>\n <ToolbarContext value={null}>{node}</ToolbarContext>\n </PopoverPopupContext>\n );\n };\n\n const libraryProps: ComponentPropsWithRef<\"dialog\"> & DataAttributes = {\n id: ids.popup,\n popover: \"auto\",\n // Never rendered: `showPopover()` does not set it, and an `open` attribute would show the\n // <dialog> outside the top layer. Owned so a `render` element cannot add it.\n open: undefined,\n // Chromium exposes a <dialog popover> as modal without it (research; issue #44).\n \"aria-modal\": \"false\",\n \"aria-labelledby\": ids.title,\n \"aria-describedby\": ids.description,\n // Not owned with `side={null}`: the stylesheet (or a render element) may set them.\n ...(side !== null && { \"data-side\": side, \"data-align\": align }),\n };\n\n const element = useRender<ComponentPropsWithRef<\"dialog\">, PopoverPopupState>({\n defaultElement: \"dialog\",\n render,\n state,\n className,\n // The inline placement is the requested one (the browser keeps choosing from it) and sits\n // under the consumer's style: the consumer wins (design 8).\n style:\n sideProp === null\n ? style\n : (s) => ({\n positionArea: positionArea(sideProp, alignProp),\n positionTryFallbacks: POSITION_TRY_FALLBACKS,\n ...resolveStateValue(style, s),\n }),\n children: content,\n // `role` is a default the consumer's `rest` overrides (design 3.3): WebKit implements no\n // minimum role for `[popover]`, and a `<div>` popup needs it.\n props: { role: \"dialog\", ...rest },\n libraryProps,\n ref,\n });\n\n return useTransitionBoundary(\"Popover.Popup\", isLibrary ? transition : undefined, element);\n}\n\nPopoverPopup.displayName = \"PopoverPopup\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0HA,SAAgB,aAAa,EAC3B,MAAM,WAAW,UACjB,OAAO,YAAY,UACnB,aACA,cACA,YACA,WACA,OACA,UACA,QACA,GAAG,QACiB;CACpB,MAAM,MAAM,kBAAkB,eAAe;CAC7C,MAAM,YAAY,IAAI,SAAS;CAC/B,MAAM,EAAE,QAAQ;CAEhB,cACE,CAAC,aAAa,eAAe,KAAA,GAC7B,4KAEF;CACA,cACE,CAAC,aAAa,gBAAgB,OAC9B,6IAEF;CAEA,MAAM,EAAE,YAAY,SAAS,gBAAgB,gBAAgB,KAAK;EAChE,MAAM;EACN;EACA;EACA,YAAY,YAAY,aAAa,KAAA;CACvC,CAAC;CAID,MAAM,YAAY,qBAAqB;EAAE,MAAM;EAAU,OAAO;CAAU,CAAC;CAC3E,MAAM,EAAE,MAAM,UAAU;CACxB,MAAM,MAAM,cAAc,UAAU,YAAY,UAAU,GAAG,GAAG,CAAC,YAAY,UAAU,GAAG,CAAC;CAE3F,MAAM,QAA2B;EAAE,MAAM,IAAI;EAAW;EAAM;CAAM;CAEpE,MAAM,WAAW,MAAoC;EACnD,IAAI;EACJ,IAAI,CAAC,WACH,OAAO,kBAAkB,UAAU,CAAC;OAC/B,IAAI,gBAAgB,MAGzB,OACE,oBAAC,UAAD;GAAU,MAAM,UAAU,YAAY;GACnC,UAAA,YAAY,kBAAkB,UAAU,CAAC,CAAC;EACnC,CAAA;OAGZ,OAAO,UAAU,YAAY,kBAAkB,UAAU,CAAC,CAAC,IAAI;EAIjE,OACE,oBAAC,qBAAD;GAAqB,OAAO;GAC1B,UAAA,oBAAC,gBAAD;IAAgB,OAAO;IAAO,UAAA;GAAqB,CAAA;EAChC,CAAA;CAEzB;CAEA,MAAM,eAAiE;EACrE,IAAI,IAAI;EACR,SAAS;EAGT,MAAM,KAAA;EAEN,cAAc;EACd,mBAAmB,IAAI;EACvB,oBAAoB,IAAI;EAExB,GAAI,SAAS,QAAQ;GAAE,aAAa;GAAM,cAAc;EAAM;CAChE;CAEA,MAAM,UAAU,UAA8D;EAC5E,gBAAgB;EAChB;EACA;EACA;EAGA,OACE,aAAa,OACT,SACC,OAAO;GACN,cAAc,aAAa,UAAU,SAAS;GAC9C,sBAAsB;GACtB,GAAG,kBAAkB,OAAO,CAAC;EAC/B;EACN,UAAU;EAGV,OAAO;GAAE,MAAM;GAAU,GAAG;EAAK;EACjC;EACA;CACF,CAAC;CAED,OAAO,sBAAsB,iBAAiB,YAAY,aAAa,KAAA,GAAW,OAAO;AAC3F;AAEA,aAAa,cAAc"}
1
+ {"version":3,"file":"popover-popup.mjs","names":[],"sources":["../../src/popover/popover-popup.tsx"],"sourcesContent":["\"use client\";\nimport type {\n ComponentPropsWithRef,\n CSSProperties,\n ReactNode,\n RefObject,\n ViewTransitionClass,\n} from \"react\";\nimport type { AnchorAlign, AnchorSide } from \"../internal/anchor-position.js\";\nimport { useTransitionBoundary } from \"../internal/transition-boundary.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useJsFreePropWarnings } from \"../internal/overlay-popup.js\";\nimport { useMergedRefs } from \"../internal/use-merged-refs.js\";\nimport { usePopoverPopup } from \"../internal/use-popover-popup.js\";\nimport { useAnchoredPlacement } from \"../internal/use-resolved-placement.js\";\nimport { resolveStateValue, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport { PopoverPopupContext, usePopoverContext } from \"./popover-context.js\";\n\n/** `inline-start` / `inline-end` follow the popup's `direction` (conventions 13.1). */\nexport type PopoverSide = AnchorSide;\nexport type PopoverAlign = AnchorAlign;\n\nexport interface PopoverPopupState {\n /**\n * Committed open state (library mode); `false` in JS-free mode. Read `:popover-open` for the\n * DOM truth.\n */\n readonly open: boolean;\n /**\n * While shown: the physical side the browser placed the popup on (after any fallback flip;\n * conventions 13.2). Otherwise the `side` prop. `null` with `side={null}`.\n */\n readonly side: PopoverSide | null;\n /** While shown: the resolved alignment; otherwise the `align` prop. */\n readonly align: PopoverAlign;\n}\n\nexport interface PopoverPopupProps extends Omit<\n ComponentPropsWithRef<\"dialog\">,\n | \"id\"\n | \"popover\"\n | \"open\"\n | \"aria-modal\"\n | \"onToggle\"\n | \"onBeforeToggle\"\n | \"className\"\n | \"style\"\n | \"children\"\n> {\n /**\n * Placement relative to the Trigger through inline `position-area`, with\n * `position-try-fallbacks` flipping it when it does not fit. Default `\"bottom\"`.\n * `\"inline-start\"` / `\"inline-end\"` follow the popup's direction. `null` emits no inline\n * positioning (and no `data-side` / `data-align`), so a stylesheet owns placement.\n */\n side?: PopoverSide | null;\n /**\n * Alignment along the side. Default `\"center\"`. On a top / bottom side `start` / `end` are\n * inline-relative (mirrored under `direction: rtl`); on the other sides the top / bottom\n * edges. Ignored when `side` is `null`.\n */\n align?: PopoverAlign;\n /**\n * Library mode: what happens to the children while the popover is closed.\n * - `false` (default): not rendered. Mounting them is part of the opening transition, so\n * content that suspends holds the open until it is ready. Unmount waits for the popover's\n * exit animation (CSS), or happens in the close commit when `transition` is set.\n * - `true`: rendered inside `<Activity mode=\"hidden\">`: DOM and state preserved, effects\n * stopped, pre-rendered at low priority. Not in the server HTML.\n *\n * Ignored in JS-free mode (always mounted).\n */\n keepMounted?: boolean;\n /**\n * Element to focus when the popover opens: a ref, or a selector resolved inside the popup.\n * The library writes `autofocus` on it right before `showPopover()` and the platform focuses\n * it. Default: the platform's choice for a `<dialog>` (first focusable descendant; the popup\n * itself if none); for `render={<div />}` focus stays on the Trigger.\n *\n * In JS-free mode the browser opens the popover itself, so the attribute is written after\n * hydration and kept while mounted; before hydration only `autoFocus` in the markup works.\n */\n initialFocus?: RefObject<HTMLElement | null> | string;\n /**\n * Library mode only. Forwarded to the `<ViewTransition default>` around the popover element\n * itself. Animates the opening commit, content changes while open, and every library-driven\n * close (Trigger, Close, controlled `open={false}`), in all engines; dismissals (Escape,\n * click outside) are the browser's and animate with CSS only. Ignored (dev warning) in JS-free\n * mode.\n *\n * Static: setting or unsetting it remounts the element. Any value, `\"none\"` included, makes a\n * mount or `<Activity>` reveal inside a transition start a document view transition (a ~250 ms\n * page cross-fade that the next transition waits for).\n * A plain open starts none: the children mount under the already-mounted popover element.\n */\n transition?: ViewTransitionClass;\n className?: StateValue<string | undefined, PopoverPopupState>;\n style?: StateValue<CSSProperties | undefined, PopoverPopupState>;\n children?: StateValue<ReactNode, PopoverPopupState>;\n /** A `<dialog>` (default) or a `<div>` (focus stays on the Trigger). */\n render?: RenderProp<ComponentPropsWithRef<\"dialog\">, PopoverPopupState>;\n}\n\n/**\n * The popover itself: a `<dialog popover=\"auto\" aria-modal=\"false\" role=\"dialog\">` with the id\n * the Trigger's `commandfor` names, placed against the Trigger with CSS Anchor Positioning and\n * wired to Title and Description through `aria-labelledby` / `aria-describedby`. Style it with\n * `:popover-open`; it emits `data-side` / `data-align` but no `data-open`. While shown, those are\n * where the browser placed it (the applied `position-try-fallbacks` option; conventions 13.2),\n * in both modes; otherwise the requested values.\n *\n * In library mode the children render from committed state, so content that suspends keeps the\n * popover closed (and the Trigger pending) until it is ready; `showPopover({ source: trigger })`\n * runs in the layout effect of the commit that mounted them, and a library-driven close runs\n * `hidePopover()` in the commit that ends it. Dismissals are the browser's: the native `toggle`\n * event becomes `openChangeAction(false, { reason: \"dismiss\" })`.\n *\n * Owned keys (conventions 1.2): `id`, `popover`, `open`, `aria-modal`, `aria-labelledby` and\n * `aria-describedby` (token-merged), and `data-side` / `data-align` unless `side` is `null`.\n * `role` is a default (`\"dialog\"`) the consumer may override.\n */\nexport function PopoverPopup({\n side: sideProp = \"bottom\",\n align: alignProp = \"center\",\n keepMounted,\n initialFocus,\n transition,\n className,\n style,\n children,\n render,\n ...rest\n}: PopoverPopupProps) {\n const ctx = usePopoverContext(\"Popover.Popup\");\n const isLibrary = ctx.mode === \"library\";\n const { ids } = ctx;\n\n useJsFreePropWarnings(\"Popover.Popup\", \"popover\", isLibrary, transition, keepMounted);\n\n const { setElement, renderContent } = usePopoverPopup(ctx, {\n part: \"Popover.Popup\",\n initialFocus,\n keepMounted,\n transition: isLibrary ? transition : undefined,\n });\n\n // Resolved while shown, in library and JS-free mode alike (it hangs off the element's ref and\n // the platform's `toggle`, not off library state).\n const placement = useAnchoredPlacement({ side: sideProp, align: alignProp });\n const { side, align } = placement;\n const ref = useMergedRefs(setElement, placement.ref);\n\n const state: PopoverPopupState = { open: ctx.committed, side, align };\n\n const content = (s: PopoverPopupState): ReactNode => (\n <PopoverPopupContext value={s}>\n {renderContent(() => resolveStateValue(children, s))}\n </PopoverPopupContext>\n );\n\n const libraryProps: ComponentPropsWithRef<\"dialog\"> & DataAttributes = {\n id: ids.popup,\n popover: \"auto\",\n // Never rendered: `showPopover()` does not set it, and an `open` attribute would show the\n // <dialog> outside the top layer. Owned so a `render` element cannot add it.\n open: undefined,\n // Chromium exposes a <dialog popover> as modal without it (research; issue #44).\n \"aria-modal\": \"false\",\n \"aria-labelledby\": ids.title,\n \"aria-describedby\": ids.description,\n // Not owned with `side={null}`: the stylesheet (or a render element) may set them.\n ...placement.dataAttributes,\n };\n\n const element = useRender<ComponentPropsWithRef<\"dialog\">, PopoverPopupState>({\n defaultElement: \"dialog\",\n render,\n state,\n className,\n // The consumer's style wins over the inline placement (design 8).\n style: placement.style(style),\n children: content,\n // `role` is a default the consumer's `rest` overrides (design 3.3): WebKit implements no\n // minimum role for `[popover]`, and a `<div>` popup needs it.\n props: { role: \"dialog\", ...rest },\n libraryProps,\n ref,\n });\n\n return useTransitionBoundary(\"Popover.Popup\", isLibrary ? transition : undefined, element);\n}\n\nPopoverPopup.displayName = \"PopoverPopup\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0HA,SAAgB,aAAa,EAC3B,MAAM,WAAW,UACjB,OAAO,YAAY,UACnB,aACA,cACA,YACA,WACA,OACA,UACA,QACA,GAAG,QACiB;CACpB,MAAM,MAAM,kBAAkB,eAAe;CAC7C,MAAM,YAAY,IAAI,SAAS;CAC/B,MAAM,EAAE,QAAQ;CAEhB,sBAAsB,iBAAiB,WAAW,WAAW,YAAY,WAAW;CAEpF,MAAM,EAAE,YAAY,kBAAkB,gBAAgB,KAAK;EACzD,MAAM;EACN;EACA;EACA,YAAY,YAAY,aAAa,KAAA;CACvC,CAAC;CAID,MAAM,YAAY,qBAAqB;EAAE,MAAM;EAAU,OAAO;CAAU,CAAC;CAC3E,MAAM,EAAE,MAAM,UAAU;CACxB,MAAM,MAAM,cAAc,YAAY,UAAU,GAAG;CAEnD,MAAM,QAA2B;EAAE,MAAM,IAAI;EAAW;EAAM;CAAM;CAEpE,MAAM,WAAW,MACf,oBAAC,qBAAD;EAAqB,OAAO;EACzB,UAAA,oBAAoB,kBAAkB,UAAU,CAAC,CAAC;CAChC,CAAA;CAGvB,MAAM,eAAiE;EACrE,IAAI,IAAI;EACR,SAAS;EAGT,MAAM,KAAA;EAEN,cAAc;EACd,mBAAmB,IAAI;EACvB,oBAAoB,IAAI;EAExB,GAAG,UAAU;CACf;CAEA,MAAM,UAAU,UAA8D;EAC5E,gBAAgB;EAChB;EACA;EACA;EAEA,OAAO,UAAU,MAAM,KAAK;EAC5B,UAAU;EAGV,OAAO;GAAE,MAAM;GAAU,GAAG;EAAK;EACjC;EACA;CACF,CAAC;CAED,OAAO,sBAAsB,iBAAiB,YAAY,aAAa,KAAA,GAAW,OAAO;AAC3F;AAEA,aAAa,cAAc"}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { resolveStateValue } from "../internal/render-element.mjs";
3
+ import { popoverDetails, useOverlayRoot } from "../internal/use-overlay-root.mjs";
3
4
  import { PopoverContext } from "./popover-context.mjs";
4
- import { usePopoverRoot } from "../internal/use-popover-root.mjs";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  //#region src/popover/popover-root.tsx
7
7
  /**
@@ -16,12 +16,13 @@ import { jsx } from "react/jsx-runtime";
16
16
  * browser's and `openChangeAction(false)` is a notification.
17
17
  */
18
18
  function PopoverRoot({ open, defaultOpen, openChangeAction, children }) {
19
- const context = usePopoverRoot({
19
+ const context = useOverlayRoot({
20
20
  component: "popover",
21
21
  part: "Popover.Root",
22
22
  open,
23
23
  defaultOpen,
24
- openChangeAction
24
+ openChangeAction,
25
+ details: popoverDetails
25
26
  });
26
27
  const state = {
27
28
  open: context.optimistic,
@@ -1 +1 @@
1
- {"version":3,"file":"popover-root.mjs","names":[],"sources":["../../src/popover/popover-root.tsx"],"sourcesContent":["\"use client\";\nimport type { ReactNode } from \"react\";\nimport type { ActionDetails, ChangeAction, ChangeReason, StateValue } from \"../internal/types.js\";\nimport { usePopoverRoot } from \"../internal/use-popover-root.js\";\nimport { resolveStateValue } from \"../internal/use-render.js\";\nimport { PopoverContext } from \"./popover-context.js\";\n\n/** Details passed as the second argument of `openChangeAction`. */\nexport interface PopoverOpenChangeDetails extends ActionDetails {\n /**\n * `\"activate\"`: the user acted on a part: Trigger (open or close), Close, or a foreign invoker\n * (`details.event` is a `CommandEvent` / `ToggleEvent` then).\n * `\"dismiss\"`: the user closed the popover without a part: Escape, Android back, an assistive-\n * technology dismiss gesture, a click outside; or script / another top-layer element hid it.\n * `\"platform\"`: the popover was found open on mount (opened before hydration); `event` is\n * `undefined`.\n */\n readonly reason: ChangeReason;\n}\n\nexport interface PopoverRootState {\n /** Optimistic open state (`false` in JS-free mode). Content rendered from it must not suspend. */\n readonly open: boolean;\n /** An `openChangeAction` dispatched through this Popover is in flight (library mode only). */\n readonly pending: boolean;\n}\n\nexport interface PopoverRootProps {\n /**\n * Controlled open state. `undefined` means uncontrolled (and, with `defaultOpen` and\n * `openChangeAction` also absent, JS-free mode).\n */\n open?: boolean;\n /**\n * Initial open state in uncontrolled library mode. Opens after hydration, never in the server\n * HTML.\n */\n defaultOpen?: boolean;\n /**\n * Awaited for `true` (the popover opens when it resolves and the content has rendered) and for\n * a `false` the user asked a part for (Trigger, Close: the popover hides when it resolves, with\n * a view transition if `transition` is set; a controlled parent that keeps `open` vetoes it).\n * A notification for a dismissal (Escape, click outside: the popover is already hidden; the\n * action runs inside the Root's transition, and a controlled parent that keeps `open` gets it\n * re-opened, which is not a veto). May be a Server Function. Rejections reach the nearest\n * Error Boundary above Root.\n *\n * A `setState` placed after your own `await` is not a Transition update; wrap it in\n * `startTransition` (React limitation).\n */\n openChangeAction?: ChangeAction<boolean, PopoverOpenChangeDetails>;\n children?: StateValue<ReactNode, PopoverRootState>;\n}\n\n/**\n * Owns the ids, the mode, the open state and the context. Renders no DOM, so it has no `ref`,\n * `className` or `style`; `pending` is exposed through `children(state)` and the Trigger.\n *\n * Without `open`, `defaultOpen` and `openChangeAction` the Popover runs in **JS-free mode**: the\n * Trigger is a native `command=\"toggle-popover\"` invoker and the browser owns everything. With any\n * of them it runs in **library mode**: opening and the closes the user asks a part for are\n * transitions (the Trigger shows `data-pending`, content renders from committed state,\n * `showPopover()` / `hidePopover()` run when the change has committed); dismissals are the\n * browser's and `openChangeAction(false)` is a notification.\n */\nexport function PopoverRoot({ open, defaultOpen, openChangeAction, children }: PopoverRootProps) {\n const context = usePopoverRoot<PopoverOpenChangeDetails>({\n component: \"popover\",\n part: \"Popover.Root\",\n open,\n defaultOpen,\n openChangeAction,\n });\n\n const state: PopoverRootState = { open: context.optimistic, pending: context.pending };\n\n return <PopoverContext value={context}>{resolveStateValue(children, state)}</PopoverContext>;\n}\n\nPopoverRoot.displayName = \"PopoverRoot\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAiEA,SAAgB,YAAY,EAAE,MAAM,aAAa,kBAAkB,YAA8B;CAC/F,MAAM,UAAU,eAAyC;EACvD,WAAW;EACX,MAAM;EACN;EACA;EACA;CACF,CAAC;CAED,MAAM,QAA0B;EAAE,MAAM,QAAQ;EAAY,SAAS,QAAQ;CAAQ;CAErF,OAAO,oBAAC,gBAAD;EAAgB,OAAO;EAAU,UAAA,kBAAkB,UAAU,KAAK;CAAkB,CAAA;AAC7F;AAEA,YAAY,cAAc"}
1
+ {"version":3,"file":"popover-root.mjs","names":[],"sources":["../../src/popover/popover-root.tsx"],"sourcesContent":["\"use client\";\nimport type { ReactNode } from \"react\";\nimport type { ActionDetails, ChangeAction, ChangeReason, StateValue } from \"../internal/types.js\";\nimport { popoverDetails, useOverlayRoot } from \"../internal/use-overlay-root.js\";\nimport { resolveStateValue } from \"../internal/use-render.js\";\nimport { PopoverContext } from \"./popover-context.js\";\n\n/** Details passed as the second argument of `openChangeAction`. */\nexport interface PopoverOpenChangeDetails extends ActionDetails {\n /**\n * `\"activate\"`: the user acted on a part: Trigger (open or close), Close, or a foreign invoker\n * (`details.event` is a `CommandEvent` / `ToggleEvent` then).\n * `\"dismiss\"`: the user closed the popover without a part: Escape, Android back, an assistive-\n * technology dismiss gesture, a click outside; or script / another top-layer element hid it.\n * `\"platform\"`: the popover was found open on mount (opened before hydration); `event` is\n * `undefined`.\n */\n readonly reason: ChangeReason;\n}\n\nexport interface PopoverRootState {\n /** Optimistic open state (`false` in JS-free mode). Content rendered from it must not suspend. */\n readonly open: boolean;\n /** An `openChangeAction` dispatched through this Popover is in flight (library mode only). */\n readonly pending: boolean;\n}\n\nexport interface PopoverRootProps {\n /**\n * Controlled open state. `undefined` means uncontrolled (and, with `defaultOpen` and\n * `openChangeAction` also absent, JS-free mode).\n */\n open?: boolean;\n /**\n * Initial open state in uncontrolled library mode. Opens after hydration, never in the server\n * HTML.\n */\n defaultOpen?: boolean;\n /**\n * Awaited for `true` (the popover opens when it resolves and the content has rendered) and for\n * a `false` the user asked a part for (Trigger, Close: the popover hides when it resolves, with\n * a view transition if `transition` is set; a controlled parent that keeps `open` vetoes it).\n * A notification for a dismissal (Escape, click outside: the popover is already hidden; the\n * action runs inside the Root's transition, and a controlled parent that keeps `open` gets it\n * re-opened, which is not a veto). May be a Server Function. Rejections reach the nearest\n * Error Boundary above Root.\n *\n * A `setState` placed after your own `await` is not a Transition update; wrap it in\n * `startTransition` (React limitation).\n */\n openChangeAction?: ChangeAction<boolean, PopoverOpenChangeDetails>;\n children?: StateValue<ReactNode, PopoverRootState>;\n}\n\n/**\n * Owns the ids, the mode, the open state and the context. Renders no DOM, so it has no `ref`,\n * `className` or `style`; `pending` is exposed through `children(state)` and the Trigger.\n *\n * Without `open`, `defaultOpen` and `openChangeAction` the Popover runs in **JS-free mode**: the\n * Trigger is a native `command=\"toggle-popover\"` invoker and the browser owns everything. With any\n * of them it runs in **library mode**: opening and the closes the user asks a part for are\n * transitions (the Trigger shows `data-pending`, content renders from committed state,\n * `showPopover()` / `hidePopover()` run when the change has committed); dismissals are the\n * browser's and `openChangeAction(false)` is a notification.\n */\nexport function PopoverRoot({ open, defaultOpen, openChangeAction, children }: PopoverRootProps) {\n const context = useOverlayRoot<PopoverOpenChangeDetails>({\n component: \"popover\",\n part: \"Popover.Root\",\n open,\n defaultOpen,\n openChangeAction,\n details: popoverDetails,\n });\n\n const state: PopoverRootState = { open: context.optimistic, pending: context.pending };\n\n return <PopoverContext value={context}>{resolveStateValue(children, state)}</PopoverContext>;\n}\n\nPopoverRoot.displayName = \"PopoverRoot\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAiEA,SAAgB,YAAY,EAAE,MAAM,aAAa,kBAAkB,YAA8B;CAC/F,MAAM,UAAU,eAAyC;EACvD,WAAW;EACX,MAAM;EACN;EACA;EACA;EACA,SAAS;CACX,CAAC;CAED,MAAM,QAA0B;EAAE,MAAM,QAAQ;EAAY,SAAS,QAAQ;CAAQ;CAErF,OAAO,oBAAC,gBAAD;EAAgB,OAAO;EAAU,UAAA,kBAAkB,UAAU,KAAK;CAAkB,CAAA;AAC7F;AAEA,YAAY,cAAc"}
@@ -1,13 +1,8 @@
1
1
  import { RenderProp, StateValue } from "../internal/types.mjs";
2
+ import { PopoverTriggerHookState } from "../internal/use-popover-trigger.mjs";
2
3
  import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
3
4
  //#region src/popover/popover-trigger.d.ts
4
- export interface PopoverTriggerState {
5
- /** Optimistic open state (library mode); `false` in JS-free mode. */
6
- readonly open: boolean;
7
- /** The Root's transition is pending (an open, a part-initiated close or a dismissal notification). */
8
- readonly pending: boolean;
9
- readonly disabled: boolean;
10
- }
5
+ export type PopoverTriggerState = PopoverTriggerHookState;
11
6
  export interface PopoverTriggerProps extends Omit<ComponentPropsWithRef<"button">, "onClick" | "aria-expanded" | "className" | "style" | "children"> {
12
7
  /**
13
8
  * Never dispatches. Native `disabled` on a `<button>` (no longer an invoker); in library mode
@@ -19,7 +14,10 @@ export interface PopoverTriggerProps extends Omit<ComponentPropsWithRef<"button"
19
14
  style?: StateValue<CSSProperties | undefined, PopoverTriggerState>;
20
15
  /** Rendered from optimistic state; must not suspend. */
21
16
  children?: StateValue<ReactNode, PopoverTriggerState>;
22
- /** Should render a `<button>`; another element works only in library mode (click handler). */
17
+ /**
18
+ * Should render a `<button>`; another element works only in library mode (click handler), and
19
+ * a press on it while the popup is open is a light dismiss rather than the awaited close.
20
+ */
23
21
  render?: RenderProp<ComponentPropsWithRef<"button">, PopoverTriggerState>;
24
22
  }
25
23
  /**
@@ -27,11 +25,13 @@ export interface PopoverTriggerProps extends Omit<ComponentPropsWithRef<"button"
27
25
  * JS-free mode the browser runs the command and the Popup keeps `aria-expanded` current. In
28
26
  * library mode the click is cancelled (so the command does not run) and dispatched through the
29
27
  * Root's transition: an open, or a library-owned close while open. The button shows optimistic
30
- * `data-open` / `aria-expanded` and `data-pending` until the change has landed.
28
+ * `data-open` and `data-pending` until the change has landed; `aria-expanded` follows the shown
29
+ * popup (in the top layer, #118).
31
30
  *
32
31
  * Owned keys (conventions 1.2): `type` (on a `<button>` only), `disabled`, `aria-disabled`
33
32
  * (library mode, link or component `render`), `commandfor`, `command`, `aria-expanded`,
34
- * `onClick` (library mode), `data-open`, `data-pending`, `data-disabled`. `aria-haspopup` and `aria-controls` pass through.
33
+ * `onClick` (library mode), `data-open`, `data-pending`, `data-disabled`. `aria-haspopup` and
34
+ * `aria-controls` pass through.
35
35
  */
36
36
  export declare function PopoverTrigger({ disabled, className, style, children, render, ...rest }: PopoverTriggerProps): ReactNode;
37
37
  export declare namespace PopoverTrigger {
@@ -1 +1 @@
1
- {"version":3,"file":"popover-trigger.d.mts","names":[],"sources":["../../src/popover/popover-trigger.tsx"],"mappings":";;;iBAOiB;;WAEN;;WAEA;WACA;;iBAGM,4BAA4B,KAC3C;;;;;;EAQA;EACA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;;EAE9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,iCAAiC;;;;;;;;;;;;;wBAcvC,iBACd,UACA,WACA,OACA,UACA,WACG,QACF,sBAAmB;yBAPN"}
1
+ {"version":3,"file":"popover-trigger.d.mts","names":[],"sources":["../../src/popover/popover-trigger.tsx"],"mappings":";;;;YAQY,sBAAsB;iBAEjB,4BAA4B,KAC3C;;;;;;EAQA;EACA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;;EAE9C,WAAW,WAAW,WAAW;;;;;EAKjC,SAAS,WAAW,iCAAiC;;;;;;;;;;;;;;;wBAgBvC,iBACd,UACA,WACA,OACA,UACA,WACG,QACF,sBAAmB;yBAPN"}
@@ -8,11 +8,13 @@ import { usePopoverTrigger } from "../internal/use-popover-trigger.mjs";
8
8
  * JS-free mode the browser runs the command and the Popup keeps `aria-expanded` current. In
9
9
  * library mode the click is cancelled (so the command does not run) and dispatched through the
10
10
  * Root's transition: an open, or a library-owned close while open. The button shows optimistic
11
- * `data-open` / `aria-expanded` and `data-pending` until the change has landed.
11
+ * `data-open` and `data-pending` until the change has landed; `aria-expanded` follows the shown
12
+ * popup (in the top layer, #118).
12
13
  *
13
14
  * Owned keys (conventions 1.2): `type` (on a `<button>` only), `disabled`, `aria-disabled`
14
15
  * (library mode, link or component `render`), `commandfor`, `command`, `aria-expanded`,
15
- * `onClick` (library mode), `data-open`, `data-pending`, `data-disabled`. `aria-haspopup` and `aria-controls` pass through.
16
+ * `onClick` (library mode), `data-open`, `data-pending`, `data-disabled`. `aria-haspopup` and
17
+ * `aria-controls` pass through.
16
18
  */
17
19
  function PopoverTrigger({ disabled = false, className, style, children, render, ...rest }) {
18
20
  const ctx = usePopoverContext("Popover.Trigger");
@@ -1 +1 @@
1
- {"version":3,"file":"popover-trigger.mjs","names":[],"sources":["../../src/popover/popover-trigger.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { usePopoverTrigger } from \"../internal/use-popover-trigger.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { usePopoverContext } from \"./popover-context.js\";\n\nexport interface PopoverTriggerState {\n /** Optimistic open state (library mode); `false` in JS-free mode. */\n readonly open: boolean;\n /** The Root's transition is pending (an open, a part-initiated close or a dismissal notification). */\n readonly pending: boolean;\n readonly disabled: boolean;\n}\n\nexport interface PopoverTriggerProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n \"onClick\" | \"aria-expanded\" | \"className\" | \"style\" | \"children\"\n> {\n /**\n * Never dispatches. Native `disabled` on a `<button>` (no longer an invoker); in library mode\n * with a link or component `render`, `aria-disabled=\"true\"` instead: the element stays\n * focusable.\n */\n disabled?: boolean;\n className?: StateValue<string | undefined, PopoverTriggerState>;\n style?: StateValue<CSSProperties | undefined, PopoverTriggerState>;\n /** Rendered from optimistic state; must not suspend. */\n children?: StateValue<ReactNode, PopoverTriggerState>;\n /** Should render a `<button>`; another element works only in library mode (click handler). */\n render?: RenderProp<ComponentPropsWithRef<\"button\">, PopoverTriggerState>;\n}\n\n/**\n * The toggle: `<button type=\"button\" commandfor command=\"toggle-popover\" aria-expanded>`. In\n * JS-free mode the browser runs the command and the Popup keeps `aria-expanded` current. In\n * library mode the click is cancelled (so the command does not run) and dispatched through the\n * Root's transition: an open, or a library-owned close while open. The button shows optimistic\n * `data-open` / `aria-expanded` and `data-pending` until the change has landed.\n *\n * Owned keys (conventions 1.2): `type` (on a `<button>` only), `disabled`, `aria-disabled`\n * (library mode, link or component `render`), `commandfor`, `command`, `aria-expanded`,\n * `onClick` (library mode), `data-open`, `data-pending`, `data-disabled`. `aria-haspopup` and `aria-controls` pass through.\n */\nexport function PopoverTrigger({\n disabled = false,\n className,\n style,\n children,\n render,\n ...rest\n}: PopoverTriggerProps) {\n const ctx = usePopoverContext(\"Popover.Trigger\");\n const { state, libraryProps, ref } = usePopoverTrigger(ctx, {\n part: \"Popover.Trigger\",\n disabled,\n render,\n });\n\n return useRender<ComponentPropsWithRef<\"button\">, PopoverTriggerState>({\n defaultElement: \"button\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps,\n ref,\n });\n}\n\nPopoverTrigger.displayName = \"PopoverTrigger\";\n"],"mappings":";;;;;;;;;;;;;;;;AA4CA,SAAgB,eAAe,EAC7B,WAAW,OACX,WACA,OACA,UACA,QACA,GAAG,QACmB;CACtB,MAAM,MAAM,kBAAkB,iBAAiB;CAC/C,MAAM,EAAE,OAAO,cAAc,QAAQ,kBAAkB,KAAK;EAC1D,MAAM;EACN;EACA;CACF,CAAC;CAED,OAAO,UAAgE;EACrE,gBAAgB;EAChB;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;EACA;CACF,CAAC;AACH;AAEA,eAAe,cAAc"}
1
+ {"version":3,"file":"popover-trigger.mjs","names":[],"sources":["../../src/popover/popover-trigger.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { usePopoverTrigger } from \"../internal/use-popover-trigger.js\";\nimport type { PopoverTriggerHookState } from \"../internal/use-popover-trigger.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { usePopoverContext } from \"./popover-context.js\";\n\nexport type PopoverTriggerState = PopoverTriggerHookState;\n\nexport interface PopoverTriggerProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n \"onClick\" | \"aria-expanded\" | \"className\" | \"style\" | \"children\"\n> {\n /**\n * Never dispatches. Native `disabled` on a `<button>` (no longer an invoker); in library mode\n * with a link or component `render`, `aria-disabled=\"true\"` instead: the element stays\n * focusable.\n */\n disabled?: boolean;\n className?: StateValue<string | undefined, PopoverTriggerState>;\n style?: StateValue<CSSProperties | undefined, PopoverTriggerState>;\n /** Rendered from optimistic state; must not suspend. */\n children?: StateValue<ReactNode, PopoverTriggerState>;\n /**\n * Should render a `<button>`; another element works only in library mode (click handler), and\n * a press on it while the popup is open is a light dismiss rather than the awaited close.\n */\n render?: RenderProp<ComponentPropsWithRef<\"button\">, PopoverTriggerState>;\n}\n\n/**\n * The toggle: `<button type=\"button\" commandfor command=\"toggle-popover\" aria-expanded>`. In\n * JS-free mode the browser runs the command and the Popup keeps `aria-expanded` current. In\n * library mode the click is cancelled (so the command does not run) and dispatched through the\n * Root's transition: an open, or a library-owned close while open. The button shows optimistic\n * `data-open` and `data-pending` until the change has landed; `aria-expanded` follows the shown\n * popup (in the top layer, #118).\n *\n * Owned keys (conventions 1.2): `type` (on a `<button>` only), `disabled`, `aria-disabled`\n * (library mode, link or component `render`), `commandfor`, `command`, `aria-expanded`,\n * `onClick` (library mode), `data-open`, `data-pending`, `data-disabled`. `aria-haspopup` and\n * `aria-controls` pass through.\n */\nexport function PopoverTrigger({\n disabled = false,\n className,\n style,\n children,\n render,\n ...rest\n}: PopoverTriggerProps) {\n const ctx = usePopoverContext(\"Popover.Trigger\");\n const { state, libraryProps, ref } = usePopoverTrigger(ctx, {\n part: \"Popover.Trigger\",\n disabled,\n render,\n });\n\n return useRender<ComponentPropsWithRef<\"button\">, PopoverTriggerState>({\n defaultElement: \"button\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps,\n ref,\n });\n}\n\nPopoverTrigger.displayName = \"PopoverTrigger\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4CA,SAAgB,eAAe,EAC7B,WAAW,OACX,WACA,OACA,UACA,QACA,GAAG,QACmB;CACtB,MAAM,MAAM,kBAAkB,iBAAiB;CAC/C,MAAM,EAAE,OAAO,cAAc,QAAQ,kBAAkB,KAAK;EAC1D,MAAM;EACN;EACA;CACF,CAAC;CAED,OAAO,UAAgE;EACrE,gBAAgB;EAChB;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;EACA;CACF,CAAC;AACH;AAEA,eAAe,cAAc"}
@@ -1,8 +1,8 @@
1
1
  import { dataAttr } from "../internal/data-attr.mjs";
2
2
  import { mergeRenderRef, renderElement, resolveStateValue } from "../internal/render-element.mjs";
3
+ import { clamp, formatRangeValue, isDegenerate, percentage } from "../internal/range-value.mjs";
3
4
  import { ProgressContext } from "./progress-context.mjs";
4
5
  import { warnOnce } from "../internal/dev-warn.mjs";
5
- import { clamp, formatRangeValue, isDegenerate, percentage } from "../internal/range-value.mjs";
6
6
  import { useId } from "react";
7
7
  import { jsx } from "react/jsx-runtime";
8
8
  //#region src/progress/progress-root.tsx
@@ -1 +1 @@
1
- {"version":3,"file":"radio-group-context.mjs","names":[],"sources":["../../src/radio-group/radio-group-context.ts"],"sourcesContent":["\"use client\";\nimport { createContext, use } from \"react\";\n\nexport interface RadioGroupContextValue {\n /** The `name` shared by every radio of the group (prop or `useId()`). */\n readonly name: string;\n readonly form: string | undefined;\n readonly required: boolean;\n /** Optimistic value: Items render `checked` from it. */\n readonly optimistic: string | null;\n readonly pending: boolean;\n /** `Root disabled` (reaches the radios natively through `<fieldset disabled>`). */\n readonly disabled: boolean;\n /**\n * Uncontrolled mode: the latest `defaultValue` (`null` when omitted), mirrored by each Item into\n * `el.defaultChecked` so that a form reset returns to it. `undefined` in controlled mode, where\n * React's mount-time value stays the reset target (conventions 3.8 rule 6).\n */\n readonly defaultValue: string | null | undefined;\n /**\n * Dispatches a user check. No-op when `value` is already the optimistic value. Checks neither\n * `disabled` (a disabled radio fires no click) nor `defaultPrevented` (the Item's\n * `guardCheckableChange` does).\n */\n readonly select: (value: string, event: Event) => void;\n /**\n * Called by each Item from its mount layout effect. An Item that mounts after the Root (under a\n * Suspense boundary, selective hydration) asks the Root to reconcile the group again, so a click\n * made before that Item hydrated is reported once (deduped by the Root's hook). Receives the\n * Item's element, which the Root uses for the dev-only partial-hydration warning.\n */\n readonly onItemMounted: (element: HTMLInputElement | null) => void;\n}\n\nexport const RadioGroupContext = createContext<RadioGroupContextValue | null>(null);\n\nexport function useRadioGroupContext(part: string): RadioGroupContextValue {\n const context = use(RadioGroupContext);\n if (context === null) {\n throw new Error(`${part} must be rendered inside a RadioGroup.Root.`);\n }\n return context;\n}\n"],"mappings":";;;AAkCA,MAAa,oBAAoB,cAA6C,IAAI;AAElF,SAAgB,qBAAqB,MAAsC;CACzE,MAAM,UAAU,IAAI,iBAAiB;CACrC,IAAI,YAAY,MACd,MAAM,IAAI,MAAM,GAAG,KAAK,4CAA4C;CAEtE,OAAO;AACT"}
1
+ {"version":3,"file":"radio-group-context.mjs","names":[],"sources":["../../src/radio-group/radio-group-context.ts"],"sourcesContent":["\"use client\";\nimport { createContext, use } from \"react\";\nimport type { RadioGroupRootState } from \"./radio-group-root.js\";\n\nexport interface RadioGroupContextValue {\n /** The `name` shared by every radio of the group (prop or `useId()`). */\n readonly name: string;\n readonly form: string | undefined;\n readonly required: boolean;\n /**\n * The Root's state: Items render `checked` from its optimistic `value`. Its `disabled` is\n * `Root disabled`, which reaches the radios natively through `<fieldset disabled>`.\n */\n readonly state: RadioGroupRootState;\n /**\n * Uncontrolled mode: the latest `defaultValue` (`null` when omitted), mirrored by each Item into\n * `el.defaultChecked` so that a form reset returns to it. `undefined` in controlled mode, where\n * React's mount-time value stays the reset target (conventions 3.8 rule 6).\n */\n readonly defaultValue: string | null | undefined;\n /**\n * Dispatches a user check. No-op when `value` is already the optimistic value. Checks neither\n * `disabled` (a disabled radio fires no click) nor `defaultPrevented` (the Item's\n * `guardCheckableChange` does).\n */\n readonly select: (value: string, event: Event) => void;\n /**\n * Called by each Item from its mount layout effect. An Item that mounts after the Root (under a\n * Suspense boundary, selective hydration) asks the Root to reconcile the group again, so a click\n * made before that Item hydrated is reported once (deduped by the Root's hook). Receives the\n * Item's element, which the Root uses for the dev-only partial-hydration warning.\n */\n readonly onItemMounted: (element: HTMLInputElement | null) => void;\n}\n\nexport const RadioGroupContext = createContext<RadioGroupContextValue | null>(null);\n\nexport function useRadioGroupContext(part: string): RadioGroupContextValue {\n const context = use(RadioGroupContext);\n if (context === null) {\n throw new Error(`${part} must be rendered inside a RadioGroup.Root.`);\n }\n return context;\n}\n"],"mappings":";;;AAmCA,MAAa,oBAAoB,cAA6C,IAAI;AAElF,SAAgB,qBAAqB,MAAsC;CACzE,MAAM,UAAU,IAAI,iBAAiB;CACrC,IAAI,YAAY,MACd,MAAM,IAAI,MAAM,GAAG,KAAK,4CAA4C;CAEtE,OAAO;AACT"}
@@ -20,10 +20,9 @@ export interface RadioGroupItemProps extends Omit<ComponentPropsWithRef<"input">
20
20
  * that settles the action (or rolls it back), never on the optimistic check; animate the check
21
21
  * itself with CSS on `:checked`.
22
22
  *
23
- * Static: without `transition` the part renders no `<ViewTransition>`; changing it between
24
- * `undefined` and a value remounts the element. Any value, `"none"` included, makes a mount or
25
- * `<Activity>` reveal of this part inside a transition start a document view transition: the
26
- * page cross-fades for about 250 ms and the next transition commit waits for it (issue #35).
23
+ * Static: setting or unsetting it remounts the element. Any value, `"none"` included, makes a
24
+ * mount or `<Activity>` reveal inside a transition start a document view transition (a ~250 ms
25
+ * page cross-fade that the next transition waits for).
27
26
  */
28
27
  transition?: ViewTransitionClass;
29
28
  className?: StateValue<string | undefined, RadioGroupItemState>;
@@ -1 +1 @@
1
- {"version":3,"file":"radio-group-item.d.mts","names":[],"sources":["../../src/radio-group/radio-group-item.tsx"],"mappings":";;;iBAUiB;WACN;;WAEA;;WAEA;;WAEA;;iBAGM,4BAA4B,KAC3C;;EAeA;;EAEA;;;;;;;;;;;EAWA,aAAa;EACb,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;;EAE9C,SAAS,WAAW,gCAAgC;;;;;;;;;;;;;;;;;wBAkBtC,iBACd,OACA,UAAU,cACV,YACA,WACA,OACA,WACG,QACF,sCAAmB;yBARN"}
1
+ {"version":3,"file":"radio-group-item.d.mts","names":[],"sources":["../../src/radio-group/radio-group-item.tsx"],"mappings":";;;iBAUiB;WACN;;WAEA;;WAEA;;WAEA;;iBAGM,4BAA4B,KAC3C;;EAeA;;EAEA;;;;;;;;;;EAUA,aAAa;EACb,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;;EAE9C,SAAS,WAAW,gCAAgC;;;;;;;;;;;;;;;;;wBAkBtC,iBACd,OACA,UAAU,cACV,YACA,WACA,OACA,WACG,QACF,sCAAmB;yBARN"}
@@ -1,9 +1,9 @@
1
1
  "use client";
2
- import { dataAttr } from "../internal/data-attr.mjs";
3
2
  import { useTransitionBoundary } from "../internal/transition-boundary.mjs";
4
3
  import { useRender } from "../internal/use-render.mjs";
5
- import { syncPresence } from "../internal/sync-presence.mjs";
6
- import { guardCheckableChange, useNativeChecked } from "../internal/use-native-checked.mjs";
4
+ import { syncPresences } from "../internal/sync-presence.mjs";
5
+ import { useNativeChecked } from "../internal/use-native-checked.mjs";
6
+ import { groupMemberProps } from "../internal/group-member.mjs";
7
7
  import { useRadioGroupContext } from "./radio-group-context.mjs";
8
8
  //#region src/radio-group/radio-group-item.tsx
9
9
  /**
@@ -23,20 +23,20 @@ import { useRadioGroupContext } from "./radio-group-context.mjs";
23
23
  */
24
24
  function RadioGroupItem({ value, disabled: disabledProp = false, transition, className, style, render, ...rest }) {
25
25
  const ctx = useRadioGroupContext("RadioGroup.Item");
26
- const checked = ctx.optimistic === value;
27
- const pending = ctx.pending && checked;
28
- const disabled = ctx.disabled || disabledProp;
26
+ const checked = ctx.state.value === value;
27
+ const pending = ctx.state.pending && checked;
28
+ const disabled = ctx.state.disabled || disabledProp;
29
29
  const inputRef = useNativeChecked({
30
30
  type: "radio",
31
31
  component: "RadioGroup.Item",
32
32
  checked,
33
33
  group: true,
34
34
  onItemMounted: (el) => {
35
- if (el !== null) {
36
- syncPresence(el, "data-checked", checked);
37
- syncPresence(el, "data-pending", pending);
38
- syncPresence(el, "data-disabled", disabled);
39
- }
35
+ if (el !== null) syncPresences(el, {
36
+ "data-checked": checked,
37
+ "data-pending": pending,
38
+ "data-disabled": disabled
39
+ });
40
40
  ctx.onItemMounted(el);
41
41
  },
42
42
  defaultChecked: ctx.defaultValue === void 0 ? void 0 : ctx.defaultValue === value
@@ -55,24 +55,19 @@ function RadioGroupItem({ value, disabled: disabledProp = false, transition, cla
55
55
  children: void 0,
56
56
  ref: inputRef,
57
57
  props: rest,
58
- libraryProps: {
58
+ libraryProps: groupMemberProps({
59
59
  type: "radio",
60
+ component: "RadioGroup.Item",
60
61
  name: ctx.name,
61
- value,
62
- checked,
63
- defaultChecked: void 0,
64
- disabled: disabledProp,
65
62
  form: ctx.form,
63
+ value,
66
64
  required: ctx.required,
67
- "data-checked": dataAttr(checked),
68
- "data-pending": dataAttr(pending),
69
- "data-disabled": dataAttr(disabled),
70
- onChange: (event) => {
71
- if (disabled) return;
72
- const nativeEvent = event.nativeEvent;
73
- guardCheckableChange(nativeEvent, () => ctx.select(value, nativeEvent), "RadioGroup.Item");
74
- }
75
- }
65
+ checked,
66
+ pending,
67
+ effectiveDisabled: disabled,
68
+ ownDisabled: disabledProp,
69
+ activate: (event) => ctx.select(value, event)
70
+ })
76
71
  });
77
72
  return useTransitionBoundary("RadioGroup.Item", transition, element);
78
73
  }
@@ -1 +1 @@
1
- {"version":3,"file":"radio-group-item.mjs","names":[],"sources":["../../src/radio-group/radio-group-item.tsx"],"sourcesContent":["\"use client\";\nimport type { ChangeEvent, ComponentPropsWithRef, CSSProperties, ViewTransitionClass } from \"react\";\nimport { useTransitionBoundary } from \"../internal/transition-boundary.js\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport { syncPresence } from \"../internal/sync-presence.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { guardCheckableChange, useNativeChecked } from \"../internal/use-native-checked.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { useRadioGroupContext } from \"./radio-group-context.js\";\n\nexport interface RadioGroupItemState {\n readonly value: string;\n /** Optimistic: true as soon as the user checks this radio, before the action settles. */\n readonly checked: boolean;\n /** The Root is pending and this radio is the optimistic target. */\n readonly pending: boolean;\n /** Disabled by its own prop or by `Root disabled`. */\n readonly disabled: boolean;\n}\n\nexport interface RadioGroupItemProps extends Omit<\n ComponentPropsWithRef<\"input\">,\n | \"type\"\n | \"name\"\n | \"value\"\n | \"checked\"\n | \"defaultChecked\"\n | \"defaultValue\"\n | \"form\"\n | \"required\"\n | \"onChange\"\n | \"className\"\n | \"style\"\n | \"children\"\n> {\n /** The value this radio checks. Must be unique within the Root. Submitted as the form value. */\n value: string;\n /** Native `disabled`: unfocusable, skipped by arrow keys, never dispatches. */\n disabled?: boolean;\n /**\n * Forwarded to the Item's `<ViewTransition default>`. Default: no boundary. Fires only on the commit\n * that settles the action (or rolls it back), never on the optimistic check; animate the check\n * itself with CSS on `:checked`.\n *\n * Static: without `transition` the part renders no `<ViewTransition>`; changing it between\n * `undefined` and a value remounts the element. Any value, `\"none\"` included, makes a mount or\n * `<Activity>` reveal of this part inside a transition start a document view transition: the\n * page cross-fades for about 250 ms and the next transition commit waits for it (issue #35).\n */\n transition?: ViewTransitionClass;\n className?: StateValue<string | undefined, RadioGroupItemState>;\n style?: StateValue<CSSProperties | undefined, RadioGroupItemState>;\n /** Replace the rendered element. Must keep an `<input>`; the library sets `type=\"radio\"`. */\n render?: RenderProp<ComponentPropsWithRef<\"input\">, RadioGroupItemState>;\n}\n\n/**\n * One `<input type=\"radio\">` of the group. Its DOM `checked` is the optimistic value\n * (`checked={optimistic === value}`): react-dom restores a controlled input to its props after\n * every event, and only the sync-lane optimistic value survives that restore.\n *\n * Owned keys (conventions 1.2; a `render` element's value is overridden): `type`, `name`,\n * `value`, `checked`, `defaultChecked` (never rendered), `disabled`, `form`, `required`,\n * `data-checked`, `data-pending`, `data-disabled`. `onChange` is merged: a `render` element's own\n * handler runs first, then the library's.\n *\n * Form reset in controlled mode: React sets an input's `defaultChecked` once, from its initial\n * `checked`. An Item added on the client while the Root's `value` equals its value gets\n * `defaultChecked` too, so two radios may carry it and a reset does not necessarily return to\n * the group's mount-time value (see `RadioGroup.Root` `value`).\n */\nexport function RadioGroupItem({\n value,\n disabled: disabledProp = false,\n transition,\n className,\n style,\n render,\n ...rest\n}: RadioGroupItemProps) {\n const ctx = useRadioGroupContext(\"RadioGroup.Item\");\n const checked = ctx.optimistic === value;\n const pending = ctx.pending && checked;\n const disabled = ctx.disabled || disabledProp;\n\n // Group mode: element check and re-apply only; the Root reports the residual paths once. The\n // hook calls `onItemMounted` at mount so that an Item mounting after its Root (a Suspense\n // boundary that hydrates later) still gets the group reconciled.\n const inputRef = useNativeChecked({\n type: \"radio\",\n component: \"RadioGroup.Item\",\n checked,\n group: true,\n onItemMounted: (el) => {\n // Hydration keeps server attributes that differ from the client render (React only warns).\n // An Item hydrating after its Root (partial hydration, Root JSDoc) can render a different\n // `checked` than the server did, e.g. after a click on an already hydrated radio, and a\n // stale `data-checked` would then stay until the prop changes again.\n if (el !== null) {\n syncPresence(el, \"data-checked\", checked);\n syncPresence(el, \"data-pending\", pending);\n syncPresence(el, \"data-disabled\", disabled);\n }\n ctx.onItemMounted(el);\n },\n defaultChecked: ctx.defaultValue === undefined ? undefined : ctx.defaultValue === value,\n });\n\n const state: RadioGroupItemState = { value, checked, pending, disabled };\n\n const element = useRender<ComponentPropsWithRef<\"input\">, RadioGroupItemState>({\n defaultElement: \"input\",\n render,\n state,\n className,\n style,\n children: undefined,\n ref: inputRef,\n // Pass-through layer: a `render` element's own props win over these.\n props: rest,\n libraryProps: {\n type: \"radio\",\n name: ctx.name,\n value,\n checked,\n defaultChecked: undefined,\n // Owned (Switch precedent) so that native disabledness, `data-disabled` and the click guard\n // agree. Only the Item's own prop: `Root disabled` reaches the radio through the fieldset.\n disabled: disabledProp,\n form: ctx.form,\n required: ctx.required,\n \"data-checked\": dataAttr(checked),\n \"data-pending\": dataAttr(pending),\n \"data-disabled\": dataAttr(disabled),\n onChange: (event: ChangeEvent<HTMLInputElement>) => {\n // A natively disabled radio fires no click; this covers `render` elements that do not\n // honour `disabled`.\n if (disabled) return;\n const nativeEvent = event.nativeEvent;\n guardCheckableChange(nativeEvent, () => ctx.select(value, nativeEvent), \"RadioGroup.Item\");\n },\n },\n });\n\n return useTransitionBoundary(\"RadioGroup.Item\", transition, element);\n}\n\nRadioGroupItem.displayName = \"RadioGroupItem\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAuEA,SAAgB,eAAe,EAC7B,OACA,UAAU,eAAe,OACzB,YACA,WACA,OACA,QACA,GAAG,QACmB;CACtB,MAAM,MAAM,qBAAqB,iBAAiB;CAClD,MAAM,UAAU,IAAI,eAAe;CACnC,MAAM,UAAU,IAAI,WAAW;CAC/B,MAAM,WAAW,IAAI,YAAY;CAKjC,MAAM,WAAW,iBAAiB;EAChC,MAAM;EACN,WAAW;EACX;EACA,OAAO;EACP,gBAAgB,OAAO;GAKrB,IAAI,OAAO,MAAM;IACf,aAAa,IAAI,gBAAgB,OAAO;IACxC,aAAa,IAAI,gBAAgB,OAAO;IACxC,aAAa,IAAI,iBAAiB,QAAQ;GAC5C;GACA,IAAI,cAAc,EAAE;EACtB;EACA,gBAAgB,IAAI,iBAAiB,KAAA,IAAY,KAAA,IAAY,IAAI,iBAAiB;CACpF,CAAC;CAID,MAAM,UAAU,UAA+D;EAC7E,gBAAgB;EAChB;EACA,OAAA;GALmC;GAAO;GAAS;GAAS;EAKxD;EACJ;EACA;EACA,UAAU,KAAA;EACV,KAAK;EAEL,OAAO;EACP,cAAc;GACZ,MAAM;GACN,MAAM,IAAI;GACV;GACA;GACA,gBAAgB,KAAA;GAGhB,UAAU;GACV,MAAM,IAAI;GACV,UAAU,IAAI;GACd,gBAAgB,SAAS,OAAO;GAChC,gBAAgB,SAAS,OAAO;GAChC,iBAAiB,SAAS,QAAQ;GAClC,WAAW,UAAyC;IAGlD,IAAI,UAAU;IACd,MAAM,cAAc,MAAM;IAC1B,qBAAqB,mBAAmB,IAAI,OAAO,OAAO,WAAW,GAAG,iBAAiB;GAC3F;EACF;CACF,CAAC;CAED,OAAO,sBAAsB,mBAAmB,YAAY,OAAO;AACrE;AAEA,eAAe,cAAc"}
1
+ {"version":3,"file":"radio-group-item.mjs","names":[],"sources":["../../src/radio-group/radio-group-item.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties, ViewTransitionClass } from \"react\";\nimport { groupMemberProps } from \"../internal/group-member.js\";\nimport { useTransitionBoundary } from \"../internal/transition-boundary.js\";\nimport { syncPresences } from \"../internal/sync-presence.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useNativeChecked } from \"../internal/use-native-checked.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { useRadioGroupContext } from \"./radio-group-context.js\";\n\nexport interface RadioGroupItemState {\n readonly value: string;\n /** Optimistic: true as soon as the user checks this radio, before the action settles. */\n readonly checked: boolean;\n /** The Root is pending and this radio is the optimistic target. */\n readonly pending: boolean;\n /** Disabled by its own prop or by `Root disabled`. */\n readonly disabled: boolean;\n}\n\nexport interface RadioGroupItemProps extends Omit<\n ComponentPropsWithRef<\"input\">,\n | \"type\"\n | \"name\"\n | \"value\"\n | \"checked\"\n | \"defaultChecked\"\n | \"defaultValue\"\n | \"form\"\n | \"required\"\n | \"onChange\"\n | \"className\"\n | \"style\"\n | \"children\"\n> {\n /** The value this radio checks. Must be unique within the Root. Submitted as the form value. */\n value: string;\n /** Native `disabled`: unfocusable, skipped by arrow keys, never dispatches. */\n disabled?: boolean;\n /**\n * Forwarded to the Item's `<ViewTransition default>`. Default: no boundary. Fires only on the commit\n * that settles the action (or rolls it back), never on the optimistic check; animate the check\n * itself with CSS on `:checked`.\n *\n * Static: setting or unsetting it remounts the element. Any value, `\"none\"` included, makes a\n * mount or `<Activity>` reveal inside a transition start a document view transition (a ~250 ms\n * page cross-fade that the next transition waits for).\n */\n transition?: ViewTransitionClass;\n className?: StateValue<string | undefined, RadioGroupItemState>;\n style?: StateValue<CSSProperties | undefined, RadioGroupItemState>;\n /** Replace the rendered element. Must keep an `<input>`; the library sets `type=\"radio\"`. */\n render?: RenderProp<ComponentPropsWithRef<\"input\">, RadioGroupItemState>;\n}\n\n/**\n * One `<input type=\"radio\">` of the group. Its DOM `checked` is the optimistic value\n * (`checked={optimistic === value}`): react-dom restores a controlled input to its props after\n * every event, and only the sync-lane optimistic value survives that restore.\n *\n * Owned keys (conventions 1.2; a `render` element's value is overridden): `type`, `name`,\n * `value`, `checked`, `defaultChecked` (never rendered), `disabled`, `form`, `required`,\n * `data-checked`, `data-pending`, `data-disabled`. `onChange` is merged: a `render` element's own\n * handler runs first, then the library's.\n *\n * Form reset in controlled mode: React sets an input's `defaultChecked` once, from its initial\n * `checked`. An Item added on the client while the Root's `value` equals its value gets\n * `defaultChecked` too, so two radios may carry it and a reset does not necessarily return to\n * the group's mount-time value (see `RadioGroup.Root` `value`).\n */\nexport function RadioGroupItem({\n value,\n disabled: disabledProp = false,\n transition,\n className,\n style,\n render,\n ...rest\n}: RadioGroupItemProps) {\n const ctx = useRadioGroupContext(\"RadioGroup.Item\");\n const checked = ctx.state.value === value;\n const pending = ctx.state.pending && checked;\n const disabled = ctx.state.disabled || disabledProp;\n\n // Group mode: element check and re-apply only; the Root reports the residual paths once. The\n // hook calls `onItemMounted` at mount so that an Item mounting after its Root (a Suspense\n // boundary that hydrates later) still gets the group reconciled.\n const inputRef = useNativeChecked({\n type: \"radio\",\n component: \"RadioGroup.Item\",\n checked,\n group: true,\n onItemMounted: (el) => {\n // Hydration keeps server attributes that differ from the client render (React only warns).\n // An Item hydrating after its Root (partial hydration, Root JSDoc) can render a different\n // `checked` than the server did, e.g. after a click on an already hydrated radio, and a\n // stale `data-checked` would then stay until the prop changes again.\n if (el !== null) {\n syncPresences(el, {\n \"data-checked\": checked,\n \"data-pending\": pending,\n \"data-disabled\": disabled,\n });\n }\n ctx.onItemMounted(el);\n },\n defaultChecked: ctx.defaultValue === undefined ? undefined : ctx.defaultValue === value,\n });\n\n const state: RadioGroupItemState = { value, checked, pending, disabled };\n\n const element = useRender<ComponentPropsWithRef<\"input\">, RadioGroupItemState>({\n defaultElement: \"input\",\n render,\n state,\n className,\n style,\n children: undefined,\n ref: inputRef,\n // Pass-through layer: a `render` element's own props win over these.\n props: rest,\n libraryProps: groupMemberProps({\n type: \"radio\",\n component: \"RadioGroup.Item\",\n name: ctx.name,\n form: ctx.form,\n value,\n required: ctx.required,\n checked,\n pending,\n effectiveDisabled: disabled,\n ownDisabled: disabledProp,\n activate: (event) => ctx.select(value, event),\n }),\n });\n\n return useTransitionBoundary(\"RadioGroup.Item\", transition, element);\n}\n\nRadioGroupItem.displayName = \"RadioGroupItem\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAsEA,SAAgB,eAAe,EAC7B,OACA,UAAU,eAAe,OACzB,YACA,WACA,OACA,QACA,GAAG,QACmB;CACtB,MAAM,MAAM,qBAAqB,iBAAiB;CAClD,MAAM,UAAU,IAAI,MAAM,UAAU;CACpC,MAAM,UAAU,IAAI,MAAM,WAAW;CACrC,MAAM,WAAW,IAAI,MAAM,YAAY;CAKvC,MAAM,WAAW,iBAAiB;EAChC,MAAM;EACN,WAAW;EACX;EACA,OAAO;EACP,gBAAgB,OAAO;GAKrB,IAAI,OAAO,MACT,cAAc,IAAI;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,iBAAiB;GACnB,CAAC;GAEH,IAAI,cAAc,EAAE;EACtB;EACA,gBAAgB,IAAI,iBAAiB,KAAA,IAAY,KAAA,IAAY,IAAI,iBAAiB;CACpF,CAAC;CAID,MAAM,UAAU,UAA+D;EAC7E,gBAAgB;EAChB;EACA,OAAA;GALmC;GAAO;GAAS;GAAS;EAKxD;EACJ;EACA;EACA,UAAU,KAAA;EACV,KAAK;EAEL,OAAO;EACP,cAAc,iBAAiB;GAC7B,MAAM;GACN,WAAW;GACX,MAAM,IAAI;GACV,MAAM,IAAI;GACV;GACA,UAAU,IAAI;GACd;GACA;GACA,mBAAmB;GACnB,aAAa;GACb,WAAW,UAAU,IAAI,OAAO,OAAO,KAAK;EAC9C,CAAC;CACH,CAAC;CAED,OAAO,sBAAsB,mBAAmB,YAAY,OAAO;AACrE;AAEA,eAAe,cAAc"}
@@ -7,12 +7,7 @@ import { useRadioGroupContext } from "./radio-group-context.mjs";
7
7
  * of `RadioGroup.Root` (HTML content model). Its state is the Root's state. Owns no keys.
8
8
  */
9
9
  function RadioGroupLabel({ className, style, children, render, ...rest }) {
10
- const ctx = useRadioGroupContext("RadioGroup.Label");
11
- const state = {
12
- value: ctx.optimistic,
13
- pending: ctx.pending,
14
- disabled: ctx.disabled
15
- };
10
+ const { state } = useRadioGroupContext("RadioGroup.Label");
16
11
  return useRender({
17
12
  defaultElement: "legend",
18
13
  render,
@@ -1 +1 @@
1
- {"version":3,"file":"radio-group-label.mjs","names":[],"sources":["../../src/radio-group/radio-group-label.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { useRadioGroupContext } from \"./radio-group-context.js\";\nimport type { RadioGroupRootState } from \"./radio-group-root.js\";\n\nexport interface RadioGroupLabelProps extends Omit<\n ComponentPropsWithRef<\"legend\">,\n \"className\" | \"style\" | \"children\"\n> {\n className?: StateValue<string | undefined, RadioGroupRootState>;\n style?: StateValue<CSSProperties | undefined, RadioGroupRootState>;\n /** Receives the Root's state: a group-level pending indicator goes here. */\n children?: StateValue<ReactNode, RadioGroupRootState>;\n render?: RenderProp<ComponentPropsWithRef<\"legend\">, RadioGroupRootState>;\n}\n\n/**\n * The group's `<legend>`, which names the fieldset natively. Optional; must be the **first child**\n * of `RadioGroup.Root` (HTML content model). Its state is the Root's state. Owns no keys.\n */\nexport function RadioGroupLabel({\n className,\n style,\n children,\n render,\n ...rest\n}: RadioGroupLabelProps) {\n const ctx = useRadioGroupContext(\"RadioGroup.Label\");\n const state: RadioGroupRootState = {\n value: ctx.optimistic,\n pending: ctx.pending,\n disabled: ctx.disabled,\n };\n return useRender<ComponentPropsWithRef<\"legend\">, RadioGroupRootState>({\n defaultElement: \"legend\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n });\n}\n\nRadioGroupLabel.displayName = \"RadioGroupLabel\";\n"],"mappings":";;;;;;;;AAsBA,SAAgB,gBAAgB,EAC9B,WACA,OACA,UACA,QACA,GAAG,QACoB;CACvB,MAAM,MAAM,qBAAqB,kBAAkB;CACnD,MAAM,QAA6B;EACjC,OAAO,IAAI;EACX,SAAS,IAAI;EACb,UAAU,IAAI;CAChB;CACA,OAAO,UAAgE;EACrE,gBAAgB;EAChB;EACA;EACA;EACA;EACA;EACA,OAAO;CACT,CAAC;AACH;AAEA,gBAAgB,cAAc"}
1
+ {"version":3,"file":"radio-group-label.mjs","names":[],"sources":["../../src/radio-group/radio-group-label.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { useRadioGroupContext } from \"./radio-group-context.js\";\nimport type { RadioGroupRootState } from \"./radio-group-root.js\";\n\nexport interface RadioGroupLabelProps extends Omit<\n ComponentPropsWithRef<\"legend\">,\n \"className\" | \"style\" | \"children\"\n> {\n className?: StateValue<string | undefined, RadioGroupRootState>;\n style?: StateValue<CSSProperties | undefined, RadioGroupRootState>;\n /** Receives the Root's state: a group-level pending indicator goes here. */\n children?: StateValue<ReactNode, RadioGroupRootState>;\n render?: RenderProp<ComponentPropsWithRef<\"legend\">, RadioGroupRootState>;\n}\n\n/**\n * The group's `<legend>`, which names the fieldset natively. Optional; must be the **first child**\n * of `RadioGroup.Root` (HTML content model). Its state is the Root's state. Owns no keys.\n */\nexport function RadioGroupLabel({\n className,\n style,\n children,\n render,\n ...rest\n}: RadioGroupLabelProps) {\n const { state } = useRadioGroupContext(\"RadioGroup.Label\");\n return useRender<ComponentPropsWithRef<\"legend\">, RadioGroupRootState>({\n defaultElement: \"legend\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n });\n}\n\nRadioGroupLabel.displayName = \"RadioGroupLabel\";\n"],"mappings":";;;;;;;;AAsBA,SAAgB,gBAAgB,EAC9B,WACA,OACA,UACA,QACA,GAAG,QACoB;CACvB,MAAM,EAAE,UAAU,qBAAqB,kBAAkB;CACzD,OAAO,UAAgE;EACrE,gBAAgB;EAChB;EACA;EACA;EACA;EACA;EACA,OAAO;CACT,CAAC;AACH;AAEA,gBAAgB,cAAc"}
@@ -16,7 +16,7 @@ export interface RadioGroupRootState {
16
16
  readonly value: string | null;
17
17
  /** An action dispatched through this group is in flight. */
18
18
  readonly pending: boolean;
19
- /** The `disabled` prop. */
19
+ /** The `disabled` prop (or the enclosing `Field.Root`'s). */
20
20
  readonly disabled: boolean;
21
21
  }
22
22
  export interface RadioGroupRootProps extends Omit<ComponentPropsWithRef<"fieldset">, "className" | "style" | "children" | "defaultValue" | "defaultChecked" | "name" | "disabled" | "form"> {
@@ -1 +1 @@
1
- {"version":3,"file":"radio-group-root.d.mts","names":[],"sources":["../../src/radio-group/radio-group-root.tsx"],"mappings":";;;;iBA2BiB,qCAAqC;;;;;;;WAO3C,QAAQ;;iBAGF;;WAEN;;WAEA;;WAEA;;iBAGM,4BAA4B,KAC3C;;;;;;;;;;;EAoBA;;;;;EAKA;;;;;;;;;;;;EAYA,oBAAoB,4BAA4B;;;;;;EAMhD;;EAEA;;;;;;EAMA;;EAEA;EACA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,mCAAmC;;;;;;;;;;;;;;;;;;wBAoCzC,iBACd,OACA,cACA,mBACA,MAAM,UACN,MACA,UAAU,cACV,UAAU,cACV,WACA,OACA,UACA,WACG,QACF,sCAAmB,IAAA;yBAbN"}
1
+ {"version":3,"file":"radio-group-root.d.mts","names":[],"sources":["../../src/radio-group/radio-group-root.tsx"],"mappings":";;;;iBAwBiB,qCAAqC;;;;;;;WAO3C,QAAQ;;iBAGF;;WAEN;;WAEA;;WAEA;;iBAGM,4BAA4B,KAC3C;;;;;;;;;;;EAoBA;;;;;EAKA;;;;;;;;;;;;EAYA,oBAAoB,4BAA4B;;;;;;EAMhD;;EAEA;;;;;;EAMA;;EAEA;EACA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,mCAAmC;;;;;;;;;;;;;;;;;;wBAoCzC,iBACd,OACA,cACA,mBACA,MAAM,UACN,MACA,UAAU,cACV,UAAU,cACV,WACA,OACA,UACA,WACG,QACF,sCAAmB,IAAA;yBAbN"}
@@ -3,11 +3,12 @@ import { createActionDetails } from "../internal/action-details.mjs";
3
3
  import { dataAttr } from "../internal/data-attr.mjs";
4
4
  import { useRender } from "../internal/use-render.mjs";
5
5
  import { transitionTypes } from "../internal/transition-types.mjs";
6
- import { useControllableAction } from "../internal/use-controllable-action.mjs";
7
- import { useFieldControl, useFieldValueChange, useMergedRef } from "../internal/use-field-control.mjs";
6
+ import { intendedValue, useControllableAction } from "../internal/use-controllable-action.mjs";
7
+ import { useFieldValueChange } from "../internal/use-field-control.mjs";
8
8
  import { RadioGroupContext } from "./radio-group-context.mjs";
9
+ import { useFieldsetGroup } from "../internal/use-fieldset-group.mjs";
9
10
  import { useNativeGroupReconciliation } from "../internal/use-native-group-reconciliation.mjs";
10
- import { useCallback, useId, useLayoutEffect, useMemo, useRef } from "react";
11
+ import { useCallback, useLayoutEffect, useMemo, useRef } from "react";
11
12
  import { jsx } from "react/jsx-runtime";
12
13
  //#region src/radio-group/radio-group-root.tsx
13
14
  const isDev = process.env.NODE_ENV !== "production";
@@ -38,19 +39,12 @@ function readGroup(fieldset, name, prop) {
38
39
  * `name` is not supported". Development warns when Items hydrate after their Root.
39
40
  */
40
41
  function RadioGroupRoot({ value, defaultValue, valueChangeAction, name: nameProp, form, required: requiredProp, disabled: disabledProp, className, style, children, render, ...rest }) {
41
- const field = useFieldControl({
42
- labelable: false,
42
+ const { field, name, required, disabled, fieldsetRef, rootRef } = useFieldsetGroup({
43
+ component: "RadioGroup.Root",
43
44
  name: nameProp,
44
45
  disabled: disabledProp,
45
- required: requiredProp,
46
- component: "RadioGroup.Root"
46
+ required: requiredProp
47
47
  });
48
- const required = field.required;
49
- const disabled = field.disabled;
50
- const fallbackName = useId();
51
- const name = field.name ?? fallbackName;
52
- const fieldsetRef = useRef(null);
53
- const warnedElement = useRef(false);
54
48
  const { optimistic, pending, dispatch, latestInFlight } = useControllableAction({
55
49
  controlled: value,
56
50
  defaultValue,
@@ -63,11 +57,7 @@ function RadioGroupRoot({ value, defaultValue, valueChangeAction, name: nameProp
63
57
  }
64
58
  });
65
59
  useFieldValueChange(optimistic);
66
- /** What the user intends: the latest in-flight dispatch, else optimistic (conventions 3.8 rule 1). */
67
- const base = () => {
68
- const inFlight = latestInFlight();
69
- return inFlight === null ? optimistic : inFlight.next;
70
- };
60
+ const base = () => intendedValue(latestInFlight, optimistic);
71
61
  const { onItemMounted } = useNativeGroupReconciliation({
72
62
  element: fieldsetRef,
73
63
  readCurrent: () => readGroup(fieldsetRef.current, name, "checked"),
@@ -84,7 +74,7 @@ function RadioGroupRoot({ value, defaultValue, valueChangeAction, name: nameProp
84
74
  return () => {
85
75
  serverRadios.current = null;
86
76
  };
87
- }, []);
77
+ }, [fieldsetRef]);
88
78
  const onItemMountedWithCheck = useCallback((element) => {
89
79
  if (isDev && !warnedPartialHydration.current && element != null && serverRadios.current?.has(element) === true) {
90
80
  warnedPartialHydration.current = true;
@@ -92,25 +82,21 @@ function RadioGroupRoot({ value, defaultValue, valueChangeAction, name: nameProp
92
82
  }
93
83
  onItemMounted(element);
94
84
  }, [onItemMounted]);
95
- const libraryRef = useCallback((el) => {
96
- fieldsetRef.current = el;
97
- if (isDev && !warnedElement.current && el.tagName !== "FIELDSET") {
98
- warnedElement.current = true;
99
- console.error(`RadioGroup.Root: expected to render a <fieldset> element but got <${el.tagName.toLowerCase()}>. The platform semantics (legend naming, disabled inheritance, form reset) need a real <fieldset>.`);
100
- }
101
- return () => {
102
- fieldsetRef.current = null;
103
- };
104
- }, []);
105
- const rootRef = useMergedRef(libraryRef, field.ref);
106
85
  const contextDefault = value === void 0 ? defaultValue ?? null : void 0;
86
+ const state = useMemo(() => ({
87
+ value: optimistic,
88
+ pending,
89
+ disabled
90
+ }), [
91
+ optimistic,
92
+ pending,
93
+ disabled
94
+ ]);
107
95
  const context = useMemo(() => ({
108
96
  name,
109
97
  form,
110
98
  required,
111
- optimistic,
112
- pending,
113
- disabled,
99
+ state,
114
100
  defaultValue: contextDefault,
115
101
  onItemMounted: onItemMountedWithCheck,
116
102
  select: (next, event) => {
@@ -121,9 +107,8 @@ function RadioGroupRoot({ value, defaultValue, valueChangeAction, name: nameProp
121
107
  name,
122
108
  form,
123
109
  required,
110
+ state,
124
111
  optimistic,
125
- pending,
126
- disabled,
127
112
  contextDefault,
128
113
  onItemMountedWithCheck,
129
114
  dispatch
@@ -131,11 +116,7 @@ function RadioGroupRoot({ value, defaultValue, valueChangeAction, name: nameProp
131
116
  const element = useRender({
132
117
  defaultElement: "fieldset",
133
118
  render,
134
- state: {
135
- value: optimistic,
136
- pending,
137
- disabled
138
- },
119
+ state,
139
120
  className,
140
121
  style,
141
122
  children,