@funstack/ui 0.1.0-alpha.10 → 0.1.0-alpha.12

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 (404) 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.map +1 -1
  49. package/dist/combobox/combobox-input.mjs +14 -7
  50. package/dist/combobox/combobox-input.mjs.map +1 -1
  51. package/dist/combobox/combobox-list.d.mts.map +1 -1
  52. package/dist/combobox/combobox-list.mjs +6 -10
  53. package/dist/combobox/combobox-list.mjs.map +1 -1
  54. package/dist/combobox/combobox-option.d.mts.map +1 -1
  55. package/dist/combobox/combobox-option.mjs +2 -1
  56. package/dist/combobox/combobox-option.mjs.map +1 -1
  57. package/dist/combobox/combobox-popup.d.mts.map +1 -1
  58. package/dist/combobox/combobox-popup.mjs +9 -25
  59. package/dist/combobox/combobox-popup.mjs.map +1 -1
  60. package/dist/combobox/combobox-root.d.mts +11 -10
  61. package/dist/combobox/combobox-root.d.mts.map +1 -1
  62. package/dist/combobox/combobox-root.mjs +37 -109
  63. package/dist/combobox/combobox-root.mjs.map +1 -1
  64. package/dist/combobox/combobox-trigger.d.mts.map +1 -1
  65. package/dist/combobox/combobox-trigger.mjs +6 -25
  66. package/dist/combobox/combobox-trigger.mjs.map +1 -1
  67. package/dist/combobox/index.d.mts +2 -2
  68. package/dist/combobox/index.mjs +3 -3
  69. package/dist/combobox/index.mjs.map +1 -1
  70. package/dist/combobox/use-combobox-form.mjs +56 -0
  71. package/dist/combobox/use-combobox-form.mjs.map +1 -0
  72. package/dist/combobox/use-option-registry.mjs +62 -0
  73. package/dist/combobox/use-option-registry.mjs.map +1 -0
  74. package/dist/dialog/dialog-close.d.mts.map +1 -1
  75. package/dist/dialog/dialog-close.mjs +29 -62
  76. package/dist/dialog/dialog-close.mjs.map +1 -1
  77. package/dist/dialog/dialog-context.mjs.map +1 -1
  78. package/dist/dialog/dialog-form.d.mts.map +1 -1
  79. package/dist/dialog/dialog-form.mjs +5 -4
  80. package/dist/dialog/dialog-form.mjs.map +1 -1
  81. package/dist/dialog/dialog-popup.d.mts +3 -4
  82. package/dist/dialog/dialog-popup.d.mts.map +1 -1
  83. package/dist/dialog/dialog-popup.mjs +37 -98
  84. package/dist/dialog/dialog-popup.mjs.map +1 -1
  85. package/dist/dialog/dialog-root.d.mts.map +1 -1
  86. package/dist/dialog/dialog-root.mjs +30 -118
  87. package/dist/dialog/dialog-root.mjs.map +1 -1
  88. package/dist/dialog/dialog-trigger.d.mts.map +1 -1
  89. package/dist/dialog/dialog-trigger.mjs +13 -16
  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 +21 -41
  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 +4 -4
  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.map +1 -1
  117. package/dist/internal/arrow-keys.mjs +21 -0
  118. package/dist/internal/arrow-keys.mjs.map +1 -0
  119. package/dist/internal/decimal.mjs +7 -1
  120. package/dist/internal/decimal.mjs.map +1 -1
  121. package/dist/internal/dom-order.mjs +17 -0
  122. package/dist/internal/dom-order.mjs.map +1 -0
  123. package/dist/internal/field-context.d.mts.map +1 -1
  124. package/dist/internal/field-context.mjs +11 -1
  125. package/dist/internal/field-context.mjs.map +1 -1
  126. package/dist/internal/focus-first-invalid.mjs +1 -1
  127. package/dist/internal/focus-first-invalid.mjs.map +1 -1
  128. package/dist/internal/group-member.mjs +37 -0
  129. package/dist/internal/group-member.mjs.map +1 -0
  130. package/dist/internal/overlay-popup.mjs +103 -0
  131. package/dist/internal/overlay-popup.mjs.map +1 -0
  132. package/dist/internal/popover-open.mjs +18 -0
  133. package/dist/internal/popover-open.mjs.map +1 -0
  134. package/dist/internal/render-element.d.mts +2 -0
  135. package/dist/internal/render-element.mjs +20 -2
  136. package/dist/internal/render-element.mjs.map +1 -1
  137. package/dist/internal/shipped-styles.mjs +14 -0
  138. package/dist/internal/shipped-styles.mjs.map +1 -0
  139. package/dist/internal/sync-presence.mjs +5 -1
  140. package/dist/internal/sync-presence.mjs.map +1 -1
  141. package/dist/internal/toolbar-context.mjs.map +1 -1
  142. package/dist/internal/tooltip-warm.mjs +1 -1
  143. package/dist/internal/tooltip-warm.mjs.map +1 -1
  144. package/dist/internal/transition-boundary.mjs +1 -1
  145. package/dist/internal/transition-boundary.mjs.map +1 -1
  146. package/dist/internal/types.d.mts +8 -6
  147. package/dist/internal/types.d.mts.map +1 -1
  148. package/dist/internal/use-action-trigger.mjs +5 -23
  149. package/dist/internal/use-action-trigger.mjs.map +1 -1
  150. package/dist/internal/use-checkable-input.mjs +79 -0
  151. package/dist/internal/use-checkable-input.mjs.map +1 -0
  152. package/dist/internal/use-controllable-action.mjs +16 -24
  153. package/dist/internal/use-controllable-action.mjs.map +1 -1
  154. package/dist/internal/use-dev-warning.mjs +8 -4
  155. package/dist/internal/use-dev-warning.mjs.map +1 -1
  156. package/dist/internal/use-element-check.mjs +39 -0
  157. package/dist/internal/use-element-check.mjs.map +1 -0
  158. package/dist/internal/use-exit-animation.mjs +1 -1
  159. package/dist/internal/use-exit-animation.mjs.map +1 -1
  160. package/dist/internal/use-field-control.mjs +28 -12
  161. package/dist/internal/use-field-control.mjs.map +1 -1
  162. package/dist/internal/use-fieldset-group.mjs +46 -0
  163. package/dist/internal/use-fieldset-group.mjs.map +1 -0
  164. package/dist/internal/use-form-reset.mjs +1 -5
  165. package/dist/internal/use-form-reset.mjs.map +1 -1
  166. package/dist/internal/use-item-order.mjs +42 -0
  167. package/dist/internal/use-item-order.mjs.map +1 -0
  168. package/dist/internal/use-latest.mjs +4 -8
  169. package/dist/internal/use-latest.mjs.map +1 -1
  170. package/dist/internal/use-merged-refs.mjs +19 -0
  171. package/dist/internal/use-merged-refs.mjs.map +1 -0
  172. package/dist/internal/use-name-warning.mjs +84 -0
  173. package/dist/internal/use-name-warning.mjs.map +1 -0
  174. package/dist/internal/use-native-checked.mjs +4 -6
  175. package/dist/internal/use-native-checked.mjs.map +1 -1
  176. package/dist/internal/use-native-focusgroup.mjs +19 -0
  177. package/dist/internal/use-native-focusgroup.mjs.map +1 -0
  178. package/dist/internal/use-native-group-reconciliation.mjs.map +1 -1
  179. package/dist/internal/use-overlay-close.mjs +63 -0
  180. package/dist/internal/use-overlay-close.mjs.map +1 -0
  181. package/dist/internal/{use-popover-root.mjs → use-overlay-root.mjs} +28 -39
  182. package/dist/internal/use-overlay-root.mjs.map +1 -0
  183. package/dist/internal/use-popover-popup.mjs +32 -78
  184. package/dist/internal/use-popover-popup.mjs.map +1 -1
  185. package/dist/internal/use-popover-trigger.d.mts +15 -0
  186. package/dist/internal/use-popover-trigger.d.mts.map +1 -0
  187. package/dist/internal/use-popover-trigger.mjs +13 -17
  188. package/dist/internal/use-popover-trigger.mjs.map +1 -1
  189. package/dist/internal/use-register-count.mjs +24 -0
  190. package/dist/internal/use-register-count.mjs.map +1 -0
  191. package/dist/internal/use-render.d.mts +2 -0
  192. package/dist/internal/use-render.mjs +2 -2
  193. package/dist/internal/use-render.mjs.map +1 -1
  194. package/dist/internal/use-resolved-placement.mjs +38 -22
  195. package/dist/internal/use-resolved-placement.mjs.map +1 -1
  196. package/dist/internal/use-roving-focus.mjs +5 -18
  197. package/dist/internal/use-roving-focus.mjs.map +1 -1
  198. package/dist/internal/use-superseded-rejection.mjs +47 -0
  199. package/dist/internal/use-superseded-rejection.mjs.map +1 -0
  200. package/dist/internal/validity.mjs +1 -13
  201. package/dist/internal/validity.mjs.map +1 -1
  202. package/dist/internal/value-set.mjs +41 -0
  203. package/dist/internal/value-set.mjs.map +1 -0
  204. package/dist/menu/index.d.mts +1 -1
  205. package/dist/menu/menu-checkbox-item.mjs.map +1 -1
  206. package/dist/menu/menu-context-trigger.d.mts +2 -7
  207. package/dist/menu/menu-context-trigger.d.mts.map +1 -1
  208. package/dist/menu/menu-context-trigger.mjs +10 -187
  209. package/dist/menu/menu-context-trigger.mjs.map +1 -1
  210. package/dist/menu/menu-context.d.mts +1 -1
  211. package/dist/menu/menu-context.mjs +1 -1
  212. package/dist/menu/menu-context.mjs.map +1 -1
  213. package/dist/menu/menu-dom.mjs +1 -2
  214. package/dist/menu/menu-dom.mjs.map +1 -1
  215. package/dist/menu/menu-gestures.mjs +167 -0
  216. package/dist/menu/menu-gestures.mjs.map +1 -0
  217. package/dist/menu/menu-group.d.mts.map +1 -1
  218. package/dist/menu/menu-group.mjs +2 -1
  219. package/dist/menu/menu-group.mjs.map +1 -1
  220. package/dist/menu/menu-hover.mjs +0 -1
  221. package/dist/menu/menu-hover.mjs.map +1 -1
  222. package/dist/menu/menu-item.mjs.map +1 -1
  223. package/dist/menu/menu-outside.mjs +101 -0
  224. package/dist/menu/menu-outside.mjs.map +1 -0
  225. package/dist/menu/menu-point.mjs +85 -0
  226. package/dist/menu/menu-point.mjs.map +1 -0
  227. package/dist/menu/menu-popup.d.mts +6 -7
  228. package/dist/menu/menu-popup.d.mts.map +1 -1
  229. package/dist/menu/menu-popup.mjs +37 -248
  230. package/dist/menu/menu-popup.mjs.map +1 -1
  231. package/dist/menu/menu-radio-group.mjs.map +1 -1
  232. package/dist/menu/menu-root.d.mts +10 -0
  233. package/dist/menu/menu-root.d.mts.map +1 -1
  234. package/dist/menu/menu-root.mjs +10 -8
  235. package/dist/menu/menu-root.mjs.map +1 -1
  236. package/dist/menu/menu-submenu-trigger.d.mts.map +1 -1
  237. package/dist/menu/menu-submenu-trigger.mjs +6 -6
  238. package/dist/menu/menu-submenu-trigger.mjs.map +1 -1
  239. package/dist/menu/menu-trigger.d.mts +4 -9
  240. package/dist/menu/menu-trigger.d.mts.map +1 -1
  241. package/dist/menu/menu-trigger.mjs +8 -6
  242. package/dist/menu/menu-trigger.mjs.map +1 -1
  243. package/dist/menu/use-menu-item.mjs +14 -16
  244. package/dist/menu/use-menu-item.mjs.map +1 -1
  245. package/dist/menu/use-menu-keyboard.mjs +88 -0
  246. package/dist/menu/use-menu-keyboard.mjs.map +1 -0
  247. package/dist/meter/meter-root.mjs +1 -1
  248. package/dist/number-field/index.d.mts +2 -1
  249. package/dist/number-field/index.d.mts.map +1 -1
  250. package/dist/number-field/index.mjs +2 -2
  251. package/dist/number-field/index.mjs.map +1 -1
  252. package/dist/number-field/number-field-arithmetic.mjs +30 -11
  253. package/dist/number-field/number-field-arithmetic.mjs.map +1 -1
  254. package/dist/number-field/number-field-context.d.mts +6 -1
  255. package/dist/number-field/number-field-context.d.mts.map +1 -0
  256. package/dist/number-field/number-field-context.mjs.map +1 -1
  257. package/dist/number-field/number-field-decrement.d.mts +1 -1
  258. package/dist/number-field/number-field-decrement.mjs +1 -1
  259. package/dist/number-field/number-field-decrement.mjs.map +1 -1
  260. package/dist/number-field/number-field-increment.d.mts +2 -22
  261. package/dist/number-field/number-field-increment.d.mts.map +1 -1
  262. package/dist/number-field/number-field-increment.mjs +2 -53
  263. package/dist/number-field/number-field-increment.mjs.map +1 -1
  264. package/dist/number-field/number-field-input.d.mts.map +1 -1
  265. package/dist/number-field/number-field-input.mjs +18 -22
  266. package/dist/number-field/number-field-input.mjs.map +1 -1
  267. package/dist/number-field/number-field-label.d.mts.map +1 -1
  268. package/dist/number-field/number-field-label.mjs +3 -9
  269. package/dist/number-field/number-field-label.mjs.map +1 -1
  270. package/dist/number-field/number-field-root.d.mts +2 -1
  271. package/dist/number-field/number-field-root.d.mts.map +1 -1
  272. package/dist/number-field/number-field-root.mjs +81 -91
  273. package/dist/number-field/number-field-root.mjs.map +1 -1
  274. package/dist/number-field/use-number-field-dev-warnings.mjs +28 -0
  275. package/dist/number-field/use-number-field-dev-warnings.mjs.map +1 -0
  276. package/dist/number-field/use-step-button.d.mts +24 -0
  277. package/dist/number-field/use-step-button.d.mts.map +1 -0
  278. package/dist/number-field/use-step-button.mjs +57 -3
  279. package/dist/number-field/use-step-button.mjs.map +1 -1
  280. package/dist/popover/popover-close.d.mts.map +1 -1
  281. package/dist/popover/popover-close.mjs +28 -67
  282. package/dist/popover/popover-close.mjs.map +1 -1
  283. package/dist/popover/popover-context.mjs.map +1 -1
  284. package/dist/popover/popover-popup.d.mts +9 -6
  285. package/dist/popover/popover-popup.d.mts.map +1 -1
  286. package/dist/popover/popover-popup.mjs +13 -36
  287. package/dist/popover/popover-popup.mjs.map +1 -1
  288. package/dist/popover/popover-root.mjs +4 -3
  289. package/dist/popover/popover-root.mjs.map +1 -1
  290. package/dist/popover/popover-trigger.d.mts +4 -8
  291. package/dist/popover/popover-trigger.d.mts.map +1 -1
  292. package/dist/popover/popover-trigger.mjs +2 -1
  293. package/dist/popover/popover-trigger.mjs.map +1 -1
  294. package/dist/progress/progress-root.mjs +1 -1
  295. package/dist/radio-group/radio-group-context.mjs.map +1 -1
  296. package/dist/radio-group/radio-group-item.d.mts +3 -4
  297. package/dist/radio-group/radio-group-item.d.mts.map +1 -1
  298. package/dist/radio-group/radio-group-item.mjs +20 -25
  299. package/dist/radio-group/radio-group-item.mjs.map +1 -1
  300. package/dist/radio-group/radio-group-label.mjs +1 -6
  301. package/dist/radio-group/radio-group-label.mjs.map +1 -1
  302. package/dist/radio-group/radio-group-root.d.mts +1 -1
  303. package/dist/radio-group/radio-group-root.d.mts.map +1 -1
  304. package/dist/radio-group/radio-group-root.mjs +21 -40
  305. package/dist/radio-group/radio-group-root.mjs.map +1 -1
  306. package/dist/select/select-dom.mjs +9 -18
  307. package/dist/select/select-dom.mjs.map +1 -1
  308. package/dist/select/select-option.mjs +1 -1
  309. package/dist/select/select-root.mjs +3 -2
  310. package/dist/select/select-root.mjs.map +1 -1
  311. package/dist/slider/slider-arithmetic.mjs +74 -13
  312. package/dist/slider/slider-arithmetic.mjs.map +1 -1
  313. package/dist/slider/slider-context.mjs.map +1 -1
  314. package/dist/slider/slider-label.d.mts.map +1 -1
  315. package/dist/slider/slider-label.mjs +3 -9
  316. package/dist/slider/slider-label.mjs.map +1 -1
  317. package/dist/slider/slider-root.d.mts +2 -2
  318. package/dist/slider/slider-root.d.mts.map +1 -1
  319. package/dist/slider/slider-root.mjs +36 -116
  320. package/dist/slider/slider-root.mjs.map +1 -1
  321. package/dist/slider/slider-thumb.d.mts.map +1 -1
  322. package/dist/slider/slider-thumb.mjs +8 -6
  323. package/dist/slider/slider-thumb.mjs.map +1 -1
  324. package/dist/slider/slider-value.d.mts.map +1 -1
  325. package/dist/slider/slider-value.mjs +2 -1
  326. package/dist/slider/slider-value.mjs.map +1 -1
  327. package/dist/slider/use-slider-dev-warnings.mjs +29 -0
  328. package/dist/slider/use-slider-dev-warnings.mjs.map +1 -0
  329. package/dist/slider/use-thumb-registry.mjs +51 -0
  330. package/dist/slider/use-thumb-registry.mjs.map +1 -0
  331. package/dist/switch/switch.d.mts +4 -5
  332. package/dist/switch/switch.d.mts.map +1 -1
  333. package/dist/switch/switch.mjs +15 -55
  334. package/dist/switch/switch.mjs.map +1 -1
  335. package/dist/tabs/tabs-context.d.mts +2 -3
  336. package/dist/tabs/tabs-context.d.mts.map +1 -1
  337. package/dist/tabs/tabs-context.mjs.map +1 -1
  338. package/dist/tabs/tabs-list.d.mts.map +1 -1
  339. package/dist/tabs/tabs-list.mjs +9 -22
  340. package/dist/tabs/tabs-list.mjs.map +1 -1
  341. package/dist/tabs/tabs-panel.d.mts +3 -4
  342. package/dist/tabs/tabs-panel.d.mts.map +1 -1
  343. package/dist/tabs/tabs-panel.mjs.map +1 -1
  344. package/dist/tabs/tabs-root.d.mts +4 -3
  345. package/dist/tabs/tabs-root.d.mts.map +1 -1
  346. package/dist/tabs/tabs-root.mjs +2 -1
  347. package/dist/tabs/tabs-root.mjs.map +1 -1
  348. package/dist/tabs/tabs-tab.d.mts +3 -4
  349. package/dist/tabs/tabs-tab.d.mts.map +1 -1
  350. package/dist/tabs/tabs-tab.mjs.map +1 -1
  351. package/dist/toast/toast-action.mjs.map +1 -1
  352. package/dist/toast/toast-close.d.mts.map +1 -1
  353. package/dist/toast/toast-close.mjs +2 -8
  354. package/dist/toast/toast-close.mjs.map +1 -1
  355. package/dist/toast/toast-context.mjs.map +1 -1
  356. package/dist/toast/toast-hotkey.mjs +27 -0
  357. package/dist/toast/toast-hotkey.mjs.map +1 -0
  358. package/dist/toast/toast-queue.mjs +137 -0
  359. package/dist/toast/toast-queue.mjs.map +1 -0
  360. package/dist/toast/toast-timers.mjs +65 -0
  361. package/dist/toast/toast-timers.mjs.map +1 -0
  362. package/dist/toast/toast-viewport.d.mts.map +1 -1
  363. package/dist/toast/toast-viewport.mjs +30 -235
  364. package/dist/toast/toast-viewport.mjs.map +1 -1
  365. package/dist/toast/toast.mjs +1 -1
  366. package/dist/toast/toast.mjs.map +1 -1
  367. package/dist/toast/use-modal-portal-host.mjs +52 -0
  368. package/dist/toast/use-modal-portal-host.mjs.map +1 -0
  369. package/dist/toggle/toggle.d.mts +3 -4
  370. package/dist/toggle/toggle.d.mts.map +1 -1
  371. package/dist/toggle/toggle.mjs +7 -10
  372. package/dist/toggle/toggle.mjs.map +1 -1
  373. package/dist/toggle-group/toggle-group-context.d.mts +2 -1
  374. package/dist/toggle-group/toggle-group-context.d.mts.map +1 -1
  375. package/dist/toggle-group/toggle-group-context.mjs.map +1 -1
  376. package/dist/toggle-group/toggle-group-item.d.mts +5 -3
  377. package/dist/toggle-group/toggle-group-item.d.mts.map +1 -1
  378. package/dist/toggle-group/toggle-group-item.mjs +5 -7
  379. package/dist/toggle-group/toggle-group-item.mjs.map +1 -1
  380. package/dist/toggle-group/toggle-group-root.d.mts.map +1 -1
  381. package/dist/toggle-group/toggle-group-root.mjs +29 -64
  382. package/dist/toggle-group/toggle-group-root.mjs.map +1 -1
  383. package/dist/toolbar/toolbar-root.d.mts +2 -2
  384. package/dist/toolbar/toolbar-root.d.mts.map +1 -1
  385. package/dist/toolbar/toolbar-root.mjs +3 -4
  386. package/dist/toolbar/toolbar-root.mjs.map +1 -1
  387. package/dist/tooltip/tooltip-context.d.mts +1 -1
  388. package/dist/tooltip/tooltip-context.mjs.map +1 -1
  389. package/dist/tooltip/tooltip-popup.d.mts.map +1 -1
  390. package/dist/tooltip/tooltip-popup.mjs +6 -15
  391. package/dist/tooltip/tooltip-popup.mjs.map +1 -1
  392. package/dist/tooltip/tooltip-root.mjs +2 -2
  393. package/dist/tooltip/tooltip-root.mjs.map +1 -1
  394. package/dist/tooltip/tooltip-trigger.d.mts +2 -1
  395. package/dist/tooltip/tooltip-trigger.d.mts.map +1 -1
  396. package/dist/tooltip/tooltip-trigger.mjs +3 -2
  397. package/dist/tooltip/tooltip-trigger.mjs.map +1 -1
  398. package/dist/tooltip/use-tooltip-interaction.mjs +4 -3
  399. package/dist/tooltip/use-tooltip-interaction.mjs.map +1 -1
  400. package/package.json +3 -2
  401. package/dist/accordion/accordion-context.d.mts +0 -5
  402. package/dist/accordion/accordion-context.d.mts.map +0 -1
  403. package/dist/internal/use-popover-root.mjs.map +0 -1
  404. /package/dist/internal/{use-popover-root.d.mts → use-overlay-root.d.mts} +0 -0
@@ -0,0 +1,21 @@
1
+ //#region src/internal/arrow-keys.ts
2
+ /** The move `key` makes along `orientation` (Home / End on both axes; mirrored when `rtl`). */
3
+ function resolveArrowKey(key, orientation, rtl) {
4
+ switch (key) {
5
+ case "Home": return "first";
6
+ case "End": return "last";
7
+ case "ArrowRight": return orientation === "horizontal" ? rtl ? "prev" : "next" : null;
8
+ case "ArrowLeft": return orientation === "horizontal" ? rtl ? "next" : "prev" : null;
9
+ case "ArrowDown": return orientation === "vertical" ? "next" : null;
10
+ case "ArrowUp": return orientation === "vertical" ? "prev" : null;
11
+ default: return null;
12
+ }
13
+ }
14
+ /** Keyboard focus: the ring shows even where the engine's heuristic would not. */
15
+ function focusWithRing(element) {
16
+ element.focus({ focusVisible: true });
17
+ }
18
+ //#endregion
19
+ export { focusWithRing, resolveArrowKey };
20
+
21
+ //# sourceMappingURL=arrow-keys.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arrow-keys.mjs","names":[],"sources":["../../src/internal/arrow-keys.ts"],"sourcesContent":["// Arrow-key navigation shared by the roving-focus engine and Tabs.List. No directive: pure\n// functions (conventions 7.1).\nimport type { Orientation } from \"./types.js\";\n\nexport type ArrowMove = \"next\" | \"prev\" | \"first\" | \"last\";\n\n/** The move `key` makes along `orientation` (Home / End on both axes; mirrored when `rtl`). */\nexport function resolveArrowKey(\n key: string,\n orientation: Orientation,\n rtl: boolean,\n): ArrowMove | null {\n switch (key) {\n case \"Home\":\n return \"first\";\n case \"End\":\n return \"last\";\n case \"ArrowRight\":\n return orientation === \"horizontal\" ? (rtl ? \"prev\" : \"next\") : null;\n case \"ArrowLeft\":\n return orientation === \"horizontal\" ? (rtl ? \"next\" : \"prev\") : null;\n case \"ArrowDown\":\n return orientation === \"vertical\" ? \"next\" : null;\n case \"ArrowUp\":\n return orientation === \"vertical\" ? \"prev\" : null;\n default:\n return null;\n }\n}\n\n/** Keyboard focus: the ring shows even where the engine's heuristic would not. */\nexport function focusWithRing(element: HTMLElement): void {\n element.focus({ focusVisible: true } as FocusOptions);\n}\n"],"mappings":";;AAOA,SAAgB,gBACd,KACA,aACA,KACkB;CAClB,QAAQ,KAAR;EACE,KAAK,QACH,OAAO;EACT,KAAK,OACH,OAAO;EACT,KAAK,cACH,OAAO,gBAAgB,eAAgB,MAAM,SAAS,SAAU;EAClE,KAAK,aACH,OAAO,gBAAgB,eAAgB,MAAM,SAAS,SAAU;EAClE,KAAK,aACH,OAAO,gBAAgB,aAAa,SAAS;EAC/C,KAAK,WACH,OAAO,gBAAgB,aAAa,SAAS;EAC/C,SACE,OAAO;CACX;AACF;;AAGA,SAAgB,cAAc,SAA4B;CACxD,QAAQ,MAAM,EAAE,cAAc,KAAK,CAAiB;AACtD"}
@@ -12,6 +12,12 @@ function decimalsOf(n) {
12
12
  const dot = text.indexOf(".");
13
13
  return dot === -1 ? 0 : text.length - dot - 1;
14
14
  }
15
+ /** Tolerance for grid computations on binary floating point (`0.3 / 0.1` is `2.9999999999999996`). */
16
+ const EPSILON = 1e-9;
17
+ /** The decimal places a grid of `step` from `min` needs: the larger of the two. */
18
+ function gridDecimals(step, min) {
19
+ return Math.max(decimalsOf(step), decimalsOf(min));
20
+ }
15
21
  /**
16
22
  * `value` rounded to `decimals` places through `toFixed` (decimal, not binary, rounding of the
17
23
  * written digits: `roundTo(0.1 + 0.2, 1)` is `0.3`). `-0` becomes `0`.
@@ -22,6 +28,6 @@ function roundTo(value, decimals) {
22
28
  return result === 0 ? 0 : result;
23
29
  }
24
30
  //#endregion
25
- export { decimalsOf, roundTo };
31
+ export { EPSILON, decimalsOf, gridDecimals, roundTo };
26
32
 
27
33
  //# sourceMappingURL=decimal.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"decimal.mjs","names":[],"sources":["../../src/internal/decimal.ts"],"sourcesContent":["// Decimal helpers shared by Slider and NumberField (design/components/number-field.md 5.4). No\n// directive: no React, no client-only API.\n\n/** Number of decimal places of `n` as written (`0.1` → 1, `1e-7` → 7, `5` → 0). */\nexport function decimalsOf(n: number): number {\n if (!Number.isFinite(n)) return 0;\n const text = String(n);\n const exponent = /e-(\\d+)$/i.exec(text);\n if (exponent !== null) {\n const mantissa = text.slice(0, exponent.index);\n const dot = mantissa.indexOf(\".\");\n return Number(exponent[1]) + (dot === -1 ? 0 : mantissa.length - dot - 1);\n }\n const dot = text.indexOf(\".\");\n return dot === -1 ? 0 : text.length - dot - 1;\n}\n\n/**\n * `value` rounded to `decimals` places through `toFixed` (decimal, not binary, rounding of the\n * written digits: `roundTo(0.1 + 0.2, 1)` is `0.3`). `-0` becomes `0`.\n */\nexport function roundTo(value: number, decimals: number): number {\n if (!Number.isFinite(value)) return value;\n // `toFixed` takes at most 100 digits; anything near that is already exact.\n const result = decimals <= 0 ? Math.round(value) : Number(value.toFixed(Math.min(decimals, 100)));\n return result === 0 ? 0 : result;\n}\n"],"mappings":";;AAIA,SAAgB,WAAW,GAAmB;CAC5C,IAAI,CAAC,OAAO,SAAS,CAAC,GAAG,OAAO;CAChC,MAAM,OAAO,OAAO,CAAC;CACrB,MAAM,WAAW,YAAY,KAAK,IAAI;CACtC,IAAI,aAAa,MAAM;EACrB,MAAM,WAAW,KAAK,MAAM,GAAG,SAAS,KAAK;EAC7C,MAAM,MAAM,SAAS,QAAQ,GAAG;EAChC,OAAO,OAAO,SAAS,EAAE,KAAK,QAAQ,KAAK,IAAI,SAAS,SAAS,MAAM;CACzE;CACA,MAAM,MAAM,KAAK,QAAQ,GAAG;CAC5B,OAAO,QAAQ,KAAK,IAAI,KAAK,SAAS,MAAM;AAC9C;;;;;AAMA,SAAgB,QAAQ,OAAe,UAA0B;CAC/D,IAAI,CAAC,OAAO,SAAS,KAAK,GAAG,OAAO;CAEpC,MAAM,SAAS,YAAY,IAAI,KAAK,MAAM,KAAK,IAAI,OAAO,MAAM,QAAQ,KAAK,IAAI,UAAU,GAAG,CAAC,CAAC;CAChG,OAAO,WAAW,IAAI,IAAI;AAC5B"}
1
+ {"version":3,"file":"decimal.mjs","names":[],"sources":["../../src/internal/decimal.ts"],"sourcesContent":["// Decimal helpers shared by Slider and NumberField (design/components/number-field.md 5.4). No\n// directive: no React, no client-only API.\n\n/** Number of decimal places of `n` as written (`0.1` → 1, `1e-7` → 7, `5` → 0). */\nexport function decimalsOf(n: number): number {\n if (!Number.isFinite(n)) return 0;\n const text = String(n);\n const exponent = /e-(\\d+)$/i.exec(text);\n if (exponent !== null) {\n const mantissa = text.slice(0, exponent.index);\n const dot = mantissa.indexOf(\".\");\n return Number(exponent[1]) + (dot === -1 ? 0 : mantissa.length - dot - 1);\n }\n const dot = text.indexOf(\".\");\n return dot === -1 ? 0 : text.length - dot - 1;\n}\n\n/** Tolerance for grid computations on binary floating point (`0.3 / 0.1` is `2.9999999999999996`). */\nexport const EPSILON = 1e-9;\n\n/** The decimal places a grid of `step` from `min` needs: the larger of the two. */\nexport function gridDecimals(step: number, min: number): number {\n return Math.max(decimalsOf(step), decimalsOf(min));\n}\n\n/**\n * `value` rounded to `decimals` places through `toFixed` (decimal, not binary, rounding of the\n * written digits: `roundTo(0.1 + 0.2, 1)` is `0.3`). `-0` becomes `0`.\n */\nexport function roundTo(value: number, decimals: number): number {\n if (!Number.isFinite(value)) return value;\n // `toFixed` takes at most 100 digits; anything near that is already exact.\n const result = decimals <= 0 ? Math.round(value) : Number(value.toFixed(Math.min(decimals, 100)));\n return result === 0 ? 0 : result;\n}\n"],"mappings":";;AAIA,SAAgB,WAAW,GAAmB;CAC5C,IAAI,CAAC,OAAO,SAAS,CAAC,GAAG,OAAO;CAChC,MAAM,OAAO,OAAO,CAAC;CACrB,MAAM,WAAW,YAAY,KAAK,IAAI;CACtC,IAAI,aAAa,MAAM;EACrB,MAAM,WAAW,KAAK,MAAM,GAAG,SAAS,KAAK;EAC7C,MAAM,MAAM,SAAS,QAAQ,GAAG;EAChC,OAAO,OAAO,SAAS,EAAE,KAAK,QAAQ,KAAK,IAAI,SAAS,SAAS,MAAM;CACzE;CACA,MAAM,MAAM,KAAK,QAAQ,GAAG;CAC5B,OAAO,QAAQ,KAAK,IAAI,KAAK,SAAS,MAAM;AAC9C;;AAGA,MAAa,UAAU;;AAGvB,SAAgB,aAAa,MAAc,KAAqB;CAC9D,OAAO,KAAK,IAAI,WAAW,IAAI,GAAG,WAAW,GAAG,CAAC;AACnD;;;;;AAMA,SAAgB,QAAQ,OAAe,UAA0B;CAC/D,IAAI,CAAC,OAAO,SAAS,KAAK,GAAG,OAAO;CAEpC,MAAM,SAAS,YAAY,IAAI,KAAK,MAAM,KAAK,IAAI,OAAO,MAAM,QAAQ,KAAK,IAAI,UAAU,GAAG,CAAC,CAAC;CAChG,OAAO,WAAW,IAAI,IAAI;AAC5B"}
@@ -0,0 +1,17 @@
1
+ //#region src/internal/dom-order.ts
2
+ /** A `sort` comparator putting nodes in document order. */
3
+ function compareDocumentOrder(a, b) {
4
+ if (a === b) return 0;
5
+ const position = a.compareDocumentPosition(b);
6
+ if (position & Node.DOCUMENT_POSITION_FOLLOWING) return -1;
7
+ if (position & Node.DOCUMENT_POSITION_PRECEDING) return 1;
8
+ return 0;
9
+ }
10
+ /** Sorts items into the document order of their elements. */
11
+ function sortByDocumentOrder(items, elementOf) {
12
+ return [...items].sort((a, b) => compareDocumentOrder(elementOf(a), elementOf(b)));
13
+ }
14
+ //#endregion
15
+ export { compareDocumentOrder, sortByDocumentOrder };
16
+
17
+ //# sourceMappingURL=dom-order.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dom-order.mjs","names":[],"sources":["../../src/internal/dom-order.ts"],"sourcesContent":["// Document-order helpers. No directive: pure DOM reads (conventions 7.1).\n\n/** A `sort` comparator putting nodes in document order. */\nexport function compareDocumentOrder(a: Node, b: Node): number {\n if (a === b) return 0;\n const position = a.compareDocumentPosition(b);\n if (position & Node.DOCUMENT_POSITION_FOLLOWING) return -1;\n if (position & Node.DOCUMENT_POSITION_PRECEDING) return 1;\n return 0;\n}\n\n/** Sorts items into the document order of their elements. */\nexport function sortByDocumentOrder<T>(items: readonly T[], elementOf: (item: T) => Node): T[] {\n return [...items].sort((a, b) => compareDocumentOrder(elementOf(a), elementOf(b)));\n}\n"],"mappings":";;AAGA,SAAgB,qBAAqB,GAAS,GAAiB;CAC7D,IAAI,MAAM,GAAG,OAAO;CACpB,MAAM,WAAW,EAAE,wBAAwB,CAAC;CAC5C,IAAI,WAAW,KAAK,6BAA6B,OAAO;CACxD,IAAI,WAAW,KAAK,6BAA6B,OAAO;CACxD,OAAO;AACT;;AAGA,SAAgB,oBAAuB,OAAqB,WAAmC;CAC7F,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,MAAM,GAAG,MAAM,qBAAqB,UAAU,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;AACnF"}
@@ -1 +1 @@
1
- {"version":3,"file":"field-context.d.mts","names":[],"sources":["../../src/internal/field-context.ts"],"mappings":";;;iBAKiB;;WAEN;;WAEA;;WAEA,UAAU;;WAEV;;WAEA;;WAEA"}
1
+ {"version":3,"file":"field-context.d.mts","names":[],"sources":["../../src/internal/field-context.ts"],"mappings":";;;iBAMiB;;WAEN;;WAEA;;WAEA,UAAU;;WAEV;;WAEA;;WAEA"}
@@ -1,4 +1,5 @@
1
1
  "use client";
2
+ import { dataAttr } from "./data-attr.mjs";
2
3
  import { createContext, use } from "react";
3
4
  //#region src/internal/field-context.ts
4
5
  const FieldContext = createContext(null);
@@ -8,7 +9,16 @@ function useFieldContext(part) {
8
9
  return ctx;
9
10
  }
10
11
  const FormContext = createContext(null);
12
+ /** The four state attributes every Field part renders (design 6.1). */
13
+ function fieldDataAttributes(state) {
14
+ return {
15
+ "data-invalid": dataAttr(state.invalid),
16
+ "data-disabled": dataAttr(state.disabled),
17
+ "data-required": dataAttr(state.required),
18
+ "data-pending": dataAttr(state.pending)
19
+ };
20
+ }
11
21
  //#endregion
12
- export { FieldContext, FormContext, useFieldContext };
22
+ export { FieldContext, FormContext, fieldDataAttributes, useFieldContext };
13
23
 
14
24
  //# sourceMappingURL=field-context.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"field-context.mjs","names":[],"sources":["../../src/internal/field-context.ts"],"sourcesContent":["\"use client\";\nimport { createContext, use } from \"react\";\nimport type { FieldValidity, FormErrors, ValidatableElement } from \"./validity.js\";\n\n/** The state every Field part receives (design/components/field-form.md 4.1). */\nexport interface FieldState {\n /** An error is shown: the control matches `:user-invalid`, or a server error for this field is shown. */\n readonly invalid: boolean;\n /** The messages shown: `[validationMessage]` for a native constraint, the strings `validate` returned for a custom one, the server's strings for a server error; `[]` while valid. */\n readonly messages: readonly string[];\n /** A snapshot of the control's `ValidityState` (all valid on the server and before the first read). */\n readonly validity: FieldValidity;\n /** `Field.Root disabled` or the control's own `disabled`. */\n readonly disabled: boolean;\n /** `Field.Root required` or the control's own `required`. */\n readonly required: boolean;\n /** The enclosing form's submission is in flight (`useFormStatus().pending`); `false` outside a form. */\n readonly pending: boolean;\n}\n\nexport interface FieldIds {\n readonly control: string;\n readonly label: string;\n readonly description: string;\n readonly error: string;\n}\n\n/** What a control reports to its Field (design 7.1). */\nexport interface FieldControlRegistration {\n /** The element the Field labels, describes and listens to (the input, or a group's fieldset). */\n readonly element: HTMLElement;\n /** `<label for>` can target it. Groups report `false`. */\n readonly labelable: boolean;\n /** The control's own `required` / `disabled` props (for the Field's `data-*` state). */\n readonly required: boolean;\n readonly disabled: boolean;\n /**\n * Where `validity`, `validationMessage` and the custom-validity slot are read and written when\n * that is not the registered element (NumberField: the hidden `input[type=number]` after the\n * visible text input). `:user-invalid`, the listeners and the focus target stay on `element`;\n * after writing the slot the Field mirrors this element's `validationMessage` into `element`\n * (design/components/field-form.md, amendment `validityElement`). Resolved on every read.\n */\n readonly validityElement?: (() => ValidatableElement | null) | undefined;\n}\n\nexport interface FieldContextValue {\n readonly ids: FieldIds;\n /** `Field.Root name`. */\n readonly name: string | undefined;\n /** `Field.Root disabled` / `required` (the props, not the merged state). */\n readonly disabled: boolean;\n readonly required: boolean;\n readonly state: FieldState;\n /** The registered control is labelable (default `true`, also before any registration). */\n readonly labelable: boolean;\n /** Registers the Field's control; returns the unregister function. The first one wins. */\n readonly registerControl: (registration: FieldControlRegistration) => () => void;\n /** A `Field.Error` is mounted (the Field may cancel the platform bubble). */\n readonly registerError: () => () => void;\n /**\n * The control's value changed in the DOM without an `input` / `change` event the Field could\n * hear (a Combobox selection, a CheckboxGroup's derived `required`, a rolled-back optimistic\n * value): re-reads the slot and the mirror after the commit that wrote it, and refreshes the\n * other Fields of the `Form.Root` (cross-field rules). `edit`: the user made the change, so a\n * shown server error is dismissed as by an `input` event. Call from a layout effect.\n */\n readonly notifyChange: (edit: boolean) => void;\n}\n\nexport const FieldContext = createContext<FieldContextValue | null>(null);\n\nexport function useFieldContext(part: string): FieldContextValue {\n const ctx = use(FieldContext);\n if (ctx === null) throw new Error(`${part} must be rendered inside a Field.Root.`);\n return ctx;\n}\n\n/** What a Field registers with its Form (design 3.5). */\nexport interface FormFieldRegistration {\n /** The control, or a group's first enabled (or checked) member. */\n readonly getFocusTarget: () => HTMLElement | null;\n /** The Field shows a server error at the latest commit. */\n readonly showsServerError: () => boolean;\n /** The server messages shown, for an announcement when focus does not move. */\n readonly serverMessages: () => readonly string[];\n /** Re-runs `validate` and re-reads validity (another Field's control changed). */\n readonly refresh: () => void;\n}\n\nexport interface FormContextValue {\n readonly errors: FormErrors | undefined;\n readonly registerField: (registration: FormFieldRegistration) => () => void;\n /**\n * The `FormData` of the submission in flight when the Form ran it itself (the intercepted path),\n * else `null`: the stale-value suppression of design 3.2 item 2 is computed against it.\n */\n readonly submittedData: () => FormData | null;\n /** Refreshes every registered Field except `source` (a change no DOM event carried). */\n readonly refreshFields: (source: FormFieldRegistration | null) => void;\n}\n\nexport const FormContext = createContext<FormContextValue | null>(null);\n"],"mappings":";;;AAsEA,MAAa,eAAe,cAAwC,IAAI;AAExE,SAAgB,gBAAgB,MAAiC;CAC/D,MAAM,MAAM,IAAI,YAAY;CAC5B,IAAI,QAAQ,MAAM,MAAM,IAAI,MAAM,GAAG,KAAK,uCAAuC;CACjF,OAAO;AACT;AA0BA,MAAa,cAAc,cAAuC,IAAI"}
1
+ {"version":3,"file":"field-context.mjs","names":[],"sources":["../../src/internal/field-context.ts"],"sourcesContent":["\"use client\";\nimport { createContext, use } from \"react\";\nimport { dataAttr } from \"./data-attr.js\";\nimport type { FieldValidity, FormErrors, ValidatableElement } from \"./validity.js\";\n\n/** The state every Field part receives (design/components/field-form.md 4.1). */\nexport interface FieldState {\n /** An error is shown: the control matches `:user-invalid`, or a server error for this field is shown. */\n readonly invalid: boolean;\n /** The messages shown: `[validationMessage]` for a native constraint, the strings `validate` returned for a custom one, the server's strings for a server error; `[]` while valid. */\n readonly messages: readonly string[];\n /** A snapshot of the control's `ValidityState` (all valid on the server and before the first read). */\n readonly validity: FieldValidity;\n /** `Field.Root disabled` or the control's own `disabled`. */\n readonly disabled: boolean;\n /** `Field.Root required` or the control's own `required`. */\n readonly required: boolean;\n /** The enclosing form's submission is in flight (`useFormStatus().pending`); `false` outside a form. */\n readonly pending: boolean;\n}\n\nexport interface FieldIds {\n readonly control: string;\n readonly label: string;\n readonly description: string;\n readonly error: string;\n}\n\n/** What a control reports to its Field (design 7.1). */\nexport interface FieldControlRegistration {\n /** The element the Field labels, describes and listens to (the input, or a group's fieldset). */\n readonly element: HTMLElement;\n /** `<label for>` can target it. Groups report `false`. */\n readonly labelable: boolean;\n /** The control's own `required` / `disabled` props (for the Field's `data-*` state). */\n readonly required: boolean;\n readonly disabled: boolean;\n /**\n * Where `validity`, `validationMessage` and the custom-validity slot are read and written when\n * that is not the registered element (NumberField: the hidden `input[type=number]` after the\n * visible text input). `:user-invalid`, the listeners and the focus target stay on `element`;\n * after writing the slot the Field mirrors this element's `validationMessage` into `element`\n * (design/components/field-form.md, `validityElement`). Resolved on every read.\n */\n readonly validityElement?: (() => ValidatableElement | null) | undefined;\n}\n\nexport interface FieldContextValue {\n readonly ids: FieldIds;\n /** `Field.Root name`. */\n readonly name: string | undefined;\n /** `Field.Root disabled` / `required` (the props, not the merged state). */\n readonly disabled: boolean;\n readonly required: boolean;\n readonly state: FieldState;\n /** The registered control is labelable (default `true`, also before any registration). */\n readonly labelable: boolean;\n /** Registers the Field's control; returns the unregister function. The first one wins. */\n readonly registerControl: (registration: FieldControlRegistration) => () => void;\n /** A `Field.Error` is mounted (the Field may cancel the platform bubble). */\n readonly registerError: () => () => void;\n /**\n * The control's value changed in the DOM without an `input` / `change` event the Field could\n * hear (a Combobox selection, a CheckboxGroup's derived `required`, a rolled-back optimistic\n * value): re-reads the slot and the mirror after the commit that wrote it, and refreshes the\n * other Fields of the `Form.Root` (cross-field rules). `edit`: the user made the change, so a\n * shown server error is dismissed as by an `input` event. Call from a layout effect.\n */\n readonly notifyChange: (edit: boolean) => void;\n}\n\nexport const FieldContext = createContext<FieldContextValue | null>(null);\n\nexport function useFieldContext(part: string): FieldContextValue {\n const ctx = use(FieldContext);\n if (ctx === null) throw new Error(`${part} must be rendered inside a Field.Root.`);\n return ctx;\n}\n\n/** What a Field registers with its Form (design 3.5). */\nexport interface FormFieldRegistration {\n /** The control, or a group's first enabled (or checked) member. */\n readonly getFocusTarget: () => HTMLElement | null;\n /** The Field shows a server error at the latest commit. */\n readonly showsServerError: () => boolean;\n /** The server messages shown, for an announcement when focus does not move. */\n readonly serverMessages: () => readonly string[];\n /** Re-runs `validate` and re-reads validity (another Field's control changed). */\n readonly refresh: () => void;\n}\n\nexport interface FormContextValue {\n readonly errors: FormErrors | undefined;\n readonly registerField: (registration: FormFieldRegistration) => () => void;\n /**\n * The `FormData` of the submission in flight when the Form ran it itself (the intercepted path),\n * else `null`: the stale-value suppression of design 3.2 item 2 is computed against it.\n */\n readonly submittedData: () => FormData | null;\n /** Refreshes every registered Field except `source` (a change no DOM event carried). */\n readonly refreshFields: (source: FormFieldRegistration | null) => void;\n}\n\nexport const FormContext = createContext<FormContextValue | null>(null);\n\n/** The four state attributes every Field part renders (design 6.1). */\nexport function fieldDataAttributes(state: FieldState) {\n return {\n \"data-invalid\": dataAttr(state.invalid),\n \"data-disabled\": dataAttr(state.disabled),\n \"data-required\": dataAttr(state.required),\n \"data-pending\": dataAttr(state.pending),\n };\n}\n"],"mappings":";;;;AAuEA,MAAa,eAAe,cAAwC,IAAI;AAExE,SAAgB,gBAAgB,MAAiC;CAC/D,MAAM,MAAM,IAAI,YAAY;CAC5B,IAAI,QAAQ,MAAM,MAAM,IAAI,MAAM,GAAG,KAAK,uCAAuC;CACjF,OAAO;AACT;AA0BA,MAAa,cAAc,cAAuC,IAAI;;AAGtE,SAAgB,oBAAoB,OAAmB;CACrD,OAAO;EACL,gBAAgB,SAAS,MAAM,OAAO;EACtC,iBAAiB,SAAS,MAAM,QAAQ;EACxC,iBAAiB,SAAS,MAAM,QAAQ;EACxC,gBAAgB,SAAS,MAAM,OAAO;CACxC;AACF"}
@@ -1,4 +1,4 @@
1
- import { sortByDocumentOrder } from "./validity.mjs";
1
+ import { sortByDocumentOrder } from "./dom-order.mjs";
2
2
  //#region src/internal/focus-first-invalid.ts
3
3
  /**
4
4
  * Speaks `message` through `element.ariaNotify()` where the browser has it (design 5.3: the
@@ -1 +1 @@
1
- {"version":3,"file":"focus-first-invalid.mjs","names":[],"sources":["../../src/internal/focus-first-invalid.ts"],"sourcesContent":["// Directive-free: the module-level first-invalid collector (design/components/field-form.md 2.5).\nimport { sortByDocumentOrder } from \"./validity.js\";\n\ninterface Batch {\n readonly targets: HTMLElement[];\n /** The message each target's Field shows, for the announcement when focus does not move. */\n readonly messages: Map<HTMLElement, string>;\n /** `document.activeElement` when the first target arrived. */\n readonly activeBefore: Element | null;\n /** The batch moved focus (later microtasks then re-focus, never announce). */\n moved: boolean;\n /** The target already announced. */\n announced: HTMLElement | null;\n}\n\ntype NotifyingElement = HTMLElement & { ariaNotify?: (announcement: string) => void };\n\n/**\n * Speaks `message` through `element.ariaNotify()` where the browser has it (design 5.3: the\n * error is read when focus moves to the control; when focus is already there nothing would be\n * read). Does nothing without `ariaNotify` or with an empty message.\n */\nexport function announce(element: HTMLElement, message: string): void {\n const notifying = element as NotifyingElement;\n if (message === \"\" || typeof notifying.ariaNotify !== \"function\") return;\n notifying.ariaNotify(message);\n}\n\n/** The submission attempt in progress: every target added during the current task. */\nlet batch: Batch | null = null;\n\n/**\n * Adds a control whose `invalid` event a Field cancelled during a submission attempt, and\n * focuses the first collected control in document order in a microtask, so the result does not\n * depend on the browser's dispatch order or on how many forms are on the page.\n *\n * The batch lives until the end of the task (a `setTimeout`), not just one microtask: when the\n * browser dispatches the `invalid` events itself (a click on a submit button), it runs a\n * microtask checkpoint after each listener, so the microtask of the first event runs before the\n * second event fires. Every add therefore queues a focus of the batch's first target; later ones\n * re-focus the same element, which is a no-op.\n *\n * Skips the focus when focus moved during the attempt to an element that is not one of the\n * collected targets: a plain `<input required>` with no Field kept the platform's behaviour\n * (bubble and focus), and the library does not fight it.\n */\nexport function collectInvalid(target: HTMLElement | null, message = \"\"): void {\n if (target === null) return;\n if (batch === null) {\n batch = {\n targets: [],\n messages: new Map(),\n activeBefore: target.ownerDocument.activeElement,\n moved: false,\n announced: null,\n };\n setTimeout(() => {\n batch = null;\n }, 0);\n }\n const current = batch;\n if (!current.targets.includes(target)) current.targets.push(target);\n current.messages.set(target, message);\n queueMicrotask(() => focusFirst(current));\n}\n\nfunction focusFirst(current: Batch): void {\n const { targets, activeBefore } = current;\n const connected = targets.filter((t) => t.isConnected);\n if (connected.length === 0) return;\n const active = connected[0]!.ownerDocument.activeElement;\n if (active !== activeBefore && active !== null && !connected.includes(active as HTMLElement)) {\n return;\n }\n const first = sortByDocumentOrder(connected, (t) => t)[0]!;\n if (active !== first) {\n current.moved = true;\n first.focus();\n } else if (!current.moved && current.announced !== first) {\n // Focus was already on the first invalid control (an implicit submission with Enter): the\n // cancelled bubble was the only announcement, so speak the message instead.\n current.announced = first;\n announce(first, current.messages.get(first) ?? \"\");\n }\n}\n"],"mappings":";;;;;;;AAsBA,SAAgB,SAAS,SAAsB,SAAuB;CACpE,MAAM,YAAY;CAClB,IAAI,YAAY,MAAM,OAAO,UAAU,eAAe,YAAY;CAClE,UAAU,WAAW,OAAO;AAC9B;;AAGA,IAAI,QAAsB;;;;;;;;;;;;;;;;AAiB1B,SAAgB,eAAe,QAA4B,UAAU,IAAU;CAC7E,IAAI,WAAW,MAAM;CACrB,IAAI,UAAU,MAAM;EAClB,QAAQ;GACN,SAAS,CAAC;GACV,0BAAU,IAAI,IAAI;GAClB,cAAc,OAAO,cAAc;GACnC,OAAO;GACP,WAAW;EACb;EACA,iBAAiB;GACf,QAAQ;EACV,GAAG,CAAC;CACN;CACA,MAAM,UAAU;CAChB,IAAI,CAAC,QAAQ,QAAQ,SAAS,MAAM,GAAG,QAAQ,QAAQ,KAAK,MAAM;CAClE,QAAQ,SAAS,IAAI,QAAQ,OAAO;CACpC,qBAAqB,WAAW,OAAO,CAAC;AAC1C;AAEA,SAAS,WAAW,SAAsB;CACxC,MAAM,EAAE,SAAS,iBAAiB;CAClC,MAAM,YAAY,QAAQ,QAAQ,MAAM,EAAE,WAAW;CACrD,IAAI,UAAU,WAAW,GAAG;CAC5B,MAAM,SAAS,UAAU,EAAE,CAAE,cAAc;CAC3C,IAAI,WAAW,gBAAgB,WAAW,QAAQ,CAAC,UAAU,SAAS,MAAqB,GACzF;CAEF,MAAM,QAAQ,oBAAoB,YAAY,MAAM,CAAC,CAAC,CAAC;CACvD,IAAI,WAAW,OAAO;EACpB,QAAQ,QAAQ;EAChB,MAAM,MAAM;CACd,OAAO,IAAI,CAAC,QAAQ,SAAS,QAAQ,cAAc,OAAO;EAGxD,QAAQ,YAAY;EACpB,SAAS,OAAO,QAAQ,SAAS,IAAI,KAAK,KAAK,EAAE;CACnD;AACF"}
1
+ {"version":3,"file":"focus-first-invalid.mjs","names":[],"sources":["../../src/internal/focus-first-invalid.ts"],"sourcesContent":["// Directive-free: the module-level first-invalid collector (design/components/field-form.md 2.5).\nimport type { AriaNotifyTarget } from \"./announce.js\";\nimport { sortByDocumentOrder } from \"./dom-order.js\";\n\ninterface Batch {\n readonly targets: HTMLElement[];\n /** The message each target's Field shows, for the announcement when focus does not move. */\n readonly messages: Map<HTMLElement, string>;\n /** `document.activeElement` when the first target arrived. */\n readonly activeBefore: Element | null;\n /** The batch moved focus (later microtasks then re-focus, never announce). */\n moved: boolean;\n /** The target already announced. */\n announced: HTMLElement | null;\n}\n\ntype NotifyingElement = HTMLElement & AriaNotifyTarget;\n\n/**\n * Speaks `message` through `element.ariaNotify()` where the browser has it (design 5.3: the\n * error is read when focus moves to the control; when focus is already there nothing would be\n * read). Does nothing without `ariaNotify` or with an empty message.\n */\nexport function announce(element: HTMLElement, message: string): void {\n const notifying = element as NotifyingElement;\n if (message === \"\" || typeof notifying.ariaNotify !== \"function\") return;\n notifying.ariaNotify(message);\n}\n\n/** The submission attempt in progress: every target added during the current task. */\nlet batch: Batch | null = null;\n\n/**\n * Adds a control whose `invalid` event a Field cancelled during a submission attempt, and\n * focuses the first collected control in document order in a microtask, so the result does not\n * depend on the browser's dispatch order or on how many forms are on the page.\n *\n * The batch lives until the end of the task (a `setTimeout`), not just one microtask: when the\n * browser dispatches the `invalid` events itself (a click on a submit button), it runs a\n * microtask checkpoint after each listener, so the microtask of the first event runs before the\n * second event fires. Every add therefore queues a focus of the batch's first target; later ones\n * re-focus the same element, which is a no-op.\n *\n * Skips the focus when focus moved during the attempt to an element that is not one of the\n * collected targets: a plain `<input required>` with no Field kept the platform's behaviour\n * (bubble and focus), and the library does not fight it.\n */\nexport function collectInvalid(target: HTMLElement | null, message = \"\"): void {\n if (target === null) return;\n if (batch === null) {\n batch = {\n targets: [],\n messages: new Map(),\n activeBefore: target.ownerDocument.activeElement,\n moved: false,\n announced: null,\n };\n setTimeout(() => {\n batch = null;\n }, 0);\n }\n const current = batch;\n if (!current.targets.includes(target)) current.targets.push(target);\n current.messages.set(target, message);\n queueMicrotask(() => focusFirst(current));\n}\n\nfunction focusFirst(current: Batch): void {\n const { targets, activeBefore } = current;\n const connected = targets.filter((t) => t.isConnected);\n if (connected.length === 0) return;\n const active = connected[0]!.ownerDocument.activeElement;\n if (active !== activeBefore && active !== null && !connected.includes(active as HTMLElement)) {\n return;\n }\n const first = sortByDocumentOrder(connected, (t) => t)[0]!;\n if (active !== first) {\n current.moved = true;\n first.focus();\n } else if (!current.moved && current.announced !== first) {\n // Focus was already on the first invalid control (an implicit submission with Enter): the\n // cancelled bubble was the only announcement, so speak the message instead.\n current.announced = first;\n announce(first, current.messages.get(first) ?? \"\");\n }\n}\n"],"mappings":";;;;;;;AAuBA,SAAgB,SAAS,SAAsB,SAAuB;CACpE,MAAM,YAAY;CAClB,IAAI,YAAY,MAAM,OAAO,UAAU,eAAe,YAAY;CAClE,UAAU,WAAW,OAAO;AAC9B;;AAGA,IAAI,QAAsB;;;;;;;;;;;;;;;;AAiB1B,SAAgB,eAAe,QAA4B,UAAU,IAAU;CAC7E,IAAI,WAAW,MAAM;CACrB,IAAI,UAAU,MAAM;EAClB,QAAQ;GACN,SAAS,CAAC;GACV,0BAAU,IAAI,IAAI;GAClB,cAAc,OAAO,cAAc;GACnC,OAAO;GACP,WAAW;EACb;EACA,iBAAiB;GACf,QAAQ;EACV,GAAG,CAAC;CACN;CACA,MAAM,UAAU;CAChB,IAAI,CAAC,QAAQ,QAAQ,SAAS,MAAM,GAAG,QAAQ,QAAQ,KAAK,MAAM;CAClE,QAAQ,SAAS,IAAI,QAAQ,OAAO;CACpC,qBAAqB,WAAW,OAAO,CAAC;AAC1C;AAEA,SAAS,WAAW,SAAsB;CACxC,MAAM,EAAE,SAAS,iBAAiB;CAClC,MAAM,YAAY,QAAQ,QAAQ,MAAM,EAAE,WAAW;CACrD,IAAI,UAAU,WAAW,GAAG;CAC5B,MAAM,SAAS,UAAU,EAAE,CAAE,cAAc;CAC3C,IAAI,WAAW,gBAAgB,WAAW,QAAQ,CAAC,UAAU,SAAS,MAAqB,GACzF;CAEF,MAAM,QAAQ,oBAAoB,YAAY,MAAM,CAAC,CAAC,CAAC;CACvD,IAAI,WAAW,OAAO;EACpB,QAAQ,QAAQ;EAChB,MAAM,MAAM;CACd,OAAO,IAAI,CAAC,QAAQ,SAAS,QAAQ,cAAc,OAAO;EAGxD,QAAQ,YAAY;EACpB,SAAS,OAAO,QAAQ,SAAS,IAAI,KAAK,KAAK,EAAE;CACnD;AACF"}
@@ -0,0 +1,37 @@
1
+ "use client";
2
+ import { dataAttr } from "./data-attr.mjs";
3
+ import { guardCheckableChange } from "./use-native-checked.mjs";
4
+ //#region src/internal/group-member.ts
5
+ /**
6
+ * The owned layer (conventions 1.2) of a group Item's `<input>`: `type`, the group's `name` /
7
+ * `form`, `value`, `checked` (the optimistic state), `defaultChecked` (never rendered), a
8
+ * checkbox's `aria-checked` (removed), `disabled`, `required`, the state `data-*` attributes,
9
+ * and the guarded `onChange`.
10
+ */
11
+ function groupMemberProps(options) {
12
+ const { type, component, checked, pending, effectiveDisabled, invalid, activate } = options;
13
+ return {
14
+ type,
15
+ name: options.name,
16
+ value: options.value,
17
+ checked,
18
+ defaultChecked: void 0,
19
+ ...type === "checkbox" && { "aria-checked": void 0 },
20
+ disabled: options.ownDisabled,
21
+ form: options.form,
22
+ required: options.required,
23
+ "data-checked": dataAttr(checked),
24
+ "data-pending": dataAttr(pending),
25
+ "data-disabled": dataAttr(effectiveDisabled),
26
+ ...invalid !== void 0 && { "aria-invalid": invalid },
27
+ onChange: (event) => {
28
+ if (effectiveDisabled) return;
29
+ const nativeEvent = event.nativeEvent;
30
+ guardCheckableChange(nativeEvent, () => activate(nativeEvent), component);
31
+ }
32
+ };
33
+ }
34
+ //#endregion
35
+ export { groupMemberProps };
36
+
37
+ //# sourceMappingURL=group-member.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"group-member.mjs","names":[],"sources":["../../src/internal/group-member.ts"],"sourcesContent":["\"use client\";\nimport type { ChangeEvent, ComponentPropsWithRef } from \"react\";\nimport { dataAttr } from \"./data-attr.js\";\nimport type { DataAttributes } from \"./render-element.js\";\nimport { guardCheckableChange } from \"./use-native-checked.js\";\n\nexport interface GroupMemberPropsOptions {\n readonly type: \"radio\" | \"checkbox\";\n /** Dispatch-guard name (`\"RadioGroup.Item\"`). */\n readonly component: string;\n /** The group's shared `name` and `form`. */\n readonly name: string;\n readonly form: string | undefined;\n readonly value: string;\n readonly required: boolean;\n /** Optimistic. */\n readonly checked: boolean;\n readonly pending: boolean;\n /** Own `disabled` prop or the Root's: `data-disabled` and the click guard. */\n readonly effectiveDisabled: boolean;\n /** The member's own `disabled` prop only: the Root's reaches it through `<fieldset disabled>`. */\n readonly ownDisabled: boolean;\n /** CheckboxGroup inside a Field: the group's `aria-invalid` (the fieldset cannot carry it). */\n readonly invalid?: \"true\" | \"false\" | undefined;\n /** The user checked (radio) or toggled (checkbox) the input. */\n readonly activate: (event: Event) => void;\n}\n\n/**\n * The owned layer (conventions 1.2) of a group Item's `<input>`: `type`, the group's `name` /\n * `form`, `value`, `checked` (the optimistic state), `defaultChecked` (never rendered), a\n * checkbox's `aria-checked` (removed), `disabled`, `required`, the state `data-*` attributes,\n * and the guarded `onChange`.\n */\nexport function groupMemberProps(\n options: GroupMemberPropsOptions,\n): Partial<ComponentPropsWithRef<\"input\">> & DataAttributes {\n const { type, component, checked, pending, effectiveDisabled, invalid, activate } = options;\n return {\n type,\n name: options.name,\n value: options.value,\n checked,\n defaultChecked: undefined,\n ...(type === \"checkbox\" && { \"aria-checked\": 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 input through the fieldset.\n disabled: options.ownDisabled,\n form: options.form,\n required: options.required,\n \"data-checked\": dataAttr(checked),\n \"data-pending\": dataAttr(pending),\n \"data-disabled\": dataAttr(effectiveDisabled),\n ...(invalid !== undefined && { \"aria-invalid\": invalid }),\n onChange: (event: ChangeEvent<HTMLInputElement>) => {\n // A natively disabled input fires no click; this covers `render` elements that do not\n // honour `disabled`.\n if (effectiveDisabled) return;\n const nativeEvent = event.nativeEvent;\n guardCheckableChange(nativeEvent, () => activate(nativeEvent), component);\n },\n };\n}\n"],"mappings":";;;;;;;;;;AAkCA,SAAgB,iBACd,SAC0D;CAC1D,MAAM,EAAE,MAAM,WAAW,SAAS,SAAS,mBAAmB,SAAS,aAAa;CACpF,OAAO;EACL;EACA,MAAM,QAAQ;EACd,OAAO,QAAQ;EACf;EACA,gBAAgB,KAAA;EAChB,GAAI,SAAS,cAAc,EAAE,gBAAgB,KAAA,EAAU;EAGvD,UAAU,QAAQ;EAClB,MAAM,QAAQ;EACd,UAAU,QAAQ;EAClB,gBAAgB,SAAS,OAAO;EAChC,gBAAgB,SAAS,OAAO;EAChC,iBAAiB,SAAS,iBAAiB;EAC3C,GAAI,YAAY,KAAA,KAAa,EAAE,gBAAgB,QAAQ;EACvD,WAAW,UAAyC;GAGlD,IAAI,mBAAmB;GACvB,MAAM,cAAc,MAAM;GAC1B,qBAAqB,mBAAmB,SAAS,WAAW,GAAG,SAAS;EAC1E;CACF;AACF"}
@@ -0,0 +1,103 @@
1
+ "use client";
2
+ import { ToolbarContext } from "./toolbar-context.mjs";
3
+ import { useDevWarning } from "./use-dev-warning.mjs";
4
+ import { useExitAnimation } from "./use-exit-animation.mjs";
5
+ import { Activity, useRef, useState } from "react";
6
+ import { jsx } from "react/jsx-runtime";
7
+ //#region src/internal/overlay-popup.tsx
8
+ const isDev = process.env.NODE_ENV !== "production";
9
+ /**
10
+ * The children of a popup (Popover, Dialog, Menu, Combobox). JS-free mode: always rendered.
11
+ * Library mode: rendered while `visible`, or with `keepMounted` inside an `<Activity>` whose mode
12
+ * changes with committed state, inside the Root's transition (conventions 5.5). The content is
13
+ * not part of an enclosing Toolbar's sequence (the engine excludes `[popover]` and `dialog`), so
14
+ * parts inside it see no Toolbar. `children` is called only when rendered.
15
+ */
16
+ function renderOverlayContent({ isLibrary, keepMounted, visible, wrapContent }, children) {
17
+ let node;
18
+ if (!isLibrary) node = children();
19
+ else if (keepMounted === true) node = /* @__PURE__ */ jsx(Activity, {
20
+ mode: visible ? "visible" : "hidden",
21
+ children: wrapContent(children())
22
+ });
23
+ else node = visible ? wrapContent(children()) : null;
24
+ return /* @__PURE__ */ jsx(ToolbarContext, {
25
+ value: null,
26
+ children: node
27
+ });
28
+ }
29
+ /**
30
+ * `held` for a popup (design/components/popover.md 4.4): the children stay mounted while the
31
+ * close animates. A library-driven close commits `false` first and hides in the layout effect,
32
+ * so without `transition` the children are held through the close commit ("previous value in
33
+ * state"). With `transition` the close commit unmounts them inside the view transition, whose old
34
+ * snapshot carries the content out.
35
+ */
36
+ function useCloseHold(committed, isLibrary, transition) {
37
+ const exit = useExitAnimation();
38
+ const [prevCommitted, setPrevCommitted] = useState(committed);
39
+ if (prevCommitted !== committed) {
40
+ setPrevCommitted(committed);
41
+ if (isLibrary && prevCommitted && transition === void 0) exit.holdDuringRender();
42
+ }
43
+ return {
44
+ ...exit,
45
+ afterClose: (popup, echo) => {
46
+ if (echo && transition !== void 0) return;
47
+ const animations = exit.exitAnimations(popup);
48
+ if (animations.length > 0) exit.holdUntil(animations);
49
+ else exit.release();
50
+ },
51
+ releaseIfIdle: (isCommitted, awaitingClose, shown) => {
52
+ if (exit.held && !isCommitted && !exit.waiting() && !awaitingClose && !shown) exit.release();
53
+ }
54
+ };
55
+ }
56
+ /** The lower-cased `command` of a `command` event. */
57
+ function commandOf(event) {
58
+ return String(event.command ?? "").toLowerCase();
59
+ }
60
+ /** Resolves `initialFocus` against the popup (a ref, or a selector inside the popup). */
61
+ function resolveInitialFocus(popup, initialFocus) {
62
+ if (typeof initialFocus === "string") return popup.querySelector(initialFocus);
63
+ return initialFocus.current;
64
+ }
65
+ /**
66
+ * `initialFocus` resolved right before a library open (design 6.1): the target, or `null` (the
67
+ * platform picks) without one, or when it resolves to nothing or outside the popup; those two
68
+ * warn once per instance in development. `noun` names the popup in the warning.
69
+ */
70
+ function useInitialFocusTarget(part, noun) {
71
+ const warned = useRef(false);
72
+ return (popup, initialFocus) => {
73
+ if (initialFocus === void 0) return null;
74
+ const target = resolveInitialFocus(popup, initialFocus);
75
+ if (target !== null && popup.contains(target)) return target;
76
+ if (isDev && !warned.current) {
77
+ warned.current = true;
78
+ console.error(target === null ? `${part}: \`initialFocus\` resolved to no element; the platform picks the focus target.` : `${part}: \`initialFocus\` is outside the ${noun}; the platform picks the focus target.`);
79
+ }
80
+ return null;
81
+ };
82
+ }
83
+ /**
84
+ * Design 6.2 rule 2, after a close that began with focus inside (or whose commit unmounted the
85
+ * focused content): when focus is now on `<body>` or still inside the hidden popup, focus the
86
+ * Trigger (connected, and `canFocus` when given), else blur what holds focus.
87
+ */
88
+ function returnFocusToTrigger(popup, trigger, canFocus) {
89
+ const doc = popup.ownerDocument;
90
+ const active = doc.activeElement;
91
+ if (active !== null && active !== doc.body && !popup.contains(active)) return;
92
+ if (trigger !== null && trigger.isConnected && (canFocus === void 0 || canFocus(trigger))) trigger.focus();
93
+ else if (active instanceof HTMLElement && active !== doc.body) active.blur();
94
+ }
95
+ /** The development warnings for a Popup's library-only props in JS-free mode. */
96
+ function useJsFreePropWarnings(part, noun, isLibrary, transition, keepMounted) {
97
+ useDevWarning(!isLibrary && transition !== void 0, isDev && `${part}: \`transition\` has no effect in JS-free mode; the browser opens and closes the ${noun} outside any React transition. Animate it with CSS (\`@starting-style\`).`);
98
+ useDevWarning(!isLibrary && keepMounted === false, isDev && `${part}: \`keepMounted={false}\` cannot be honoured in JS-free mode; the content is always mounted so that the server HTML is complete.`);
99
+ }
100
+ //#endregion
101
+ export { commandOf, renderOverlayContent, resolveInitialFocus, returnFocusToTrigger, useCloseHold, useInitialFocusTarget, useJsFreePropWarnings };
102
+
103
+ //# sourceMappingURL=overlay-popup.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overlay-popup.mjs","names":[],"sources":["../../src/internal/overlay-popup.tsx"],"sourcesContent":["\"use client\";\n// The pieces Dialog.Popup shares with usePopoverPopup (Popover, Menu, Combobox). The two stay\n// separate: Dialog has showModal / show, `close` / `cancel` / `submit` and light dismiss.\nimport { Activity, useRef, useState } from \"react\";\nimport type { ReactNode, RefObject, ViewTransitionClass } from \"react\";\nimport { ToolbarContext } from \"./toolbar-context.js\";\nimport { useDevWarning } from \"./use-dev-warning.js\";\nimport { useExitAnimation } from \"./use-exit-animation.js\";\nimport type { ExitAnimation } from \"./use-exit-animation.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\nexport interface OverlayContentOptions {\n readonly isLibrary: boolean;\n readonly keepMounted: boolean | undefined;\n /** Committed open, or held while the exit animates (design/components/popover.md 4.4). */\n readonly visible: boolean;\n readonly wrapContent: (children: ReactNode) => ReactNode;\n}\n\n/**\n * The children of a popup (Popover, Dialog, Menu, Combobox). JS-free mode: always rendered.\n * Library mode: rendered while `visible`, or with `keepMounted` inside an `<Activity>` whose mode\n * changes with committed state, inside the Root's transition (conventions 5.5). The content is\n * not part of an enclosing Toolbar's sequence (the engine excludes `[popover]` and `dialog`), so\n * parts inside it see no Toolbar. `children` is called only when rendered.\n */\nexport function renderOverlayContent(\n { isLibrary, keepMounted, visible, wrapContent }: OverlayContentOptions,\n children: () => ReactNode,\n): ReactNode {\n let node: ReactNode;\n if (!isLibrary) {\n node = children();\n } else if (keepMounted === true) {\n node = <Activity mode={visible ? \"visible\" : \"hidden\"}>{wrapContent(children())}</Activity>;\n } else {\n node = visible ? wrapContent(children()) : null;\n }\n return <ToolbarContext value={null}>{node}</ToolbarContext>;\n}\n\nexport interface CloseHold extends ExitAnimation {\n /**\n * The close's native event (`toggle` / `close`) arrived: hold the content until the exit\n * animations settle, or release a hold now when nothing animates (Firefox, or no CSS exit: the\n * popup is already `display: none`, the commit is invisible). Call before the notification, so\n * its commit keeps the children. Nothing for the library's own close (`echo`) with\n * `transition`: the close commit's view transition carried the content out.\n */\n readonly afterClose: (popup: Element, echo: boolean) => void;\n /**\n * The apply effect's release rule: a hold the close commit set (or a dismissal's notification\n * commit) that no exit animation is going to release, the popup being hidden and its close\n * event handled.\n */\n readonly releaseIfIdle: (committed: boolean, awaitingClose: boolean, shown: boolean) => void;\n}\n\n/**\n * `held` for a popup (design/components/popover.md 4.4): the children stay mounted while the\n * close animates. A library-driven close commits `false` first and hides in the layout effect,\n * so without `transition` the children are held through the close commit (\"previous value in\n * state\"). With `transition` the close commit unmounts them inside the view transition, whose old\n * snapshot carries the content out.\n */\nexport function useCloseHold(\n committed: boolean,\n isLibrary: boolean,\n transition: ViewTransitionClass | undefined,\n): CloseHold {\n const exit = useExitAnimation();\n const [prevCommitted, setPrevCommitted] = useState(committed);\n if (prevCommitted !== committed) {\n setPrevCommitted(committed);\n if (isLibrary && prevCommitted && transition === undefined) exit.holdDuringRender();\n }\n return {\n ...exit,\n afterClose: (popup, echo) => {\n if (echo && transition !== undefined) return;\n const animations = exit.exitAnimations(popup);\n if (animations.length > 0) exit.holdUntil(animations);\n else exit.release();\n },\n releaseIfIdle: (isCommitted, awaitingClose, shown) => {\n if (exit.held && !isCommitted && !exit.waiting() && !awaitingClose && !shown) {\n exit.release();\n }\n },\n };\n}\n\n/** The lower-cased `command` of a `command` event. */\nexport function commandOf(event: Event): string {\n return String((event as Event & { command?: string }).command ?? \"\").toLowerCase();\n}\n\n/** Resolves `initialFocus` against the popup (a ref, or a selector inside the popup). */\nexport function resolveInitialFocus(\n popup: HTMLElement,\n initialFocus: RefObject<HTMLElement | null> | string,\n): HTMLElement | null {\n if (typeof initialFocus === \"string\") return popup.querySelector<HTMLElement>(initialFocus);\n return initialFocus.current;\n}\n\nexport type InitialFocusTarget = (\n popup: HTMLElement,\n initialFocus: RefObject<HTMLElement | null> | string | undefined,\n) => HTMLElement | null;\n\n/**\n * `initialFocus` resolved right before a library open (design 6.1): the target, or `null` (the\n * platform picks) without one, or when it resolves to nothing or outside the popup; those two\n * warn once per instance in development. `noun` names the popup in the warning.\n */\nexport function useInitialFocusTarget(part: string, noun: string): InitialFocusTarget {\n const warned = useRef(false);\n return (popup, initialFocus) => {\n if (initialFocus === undefined) return null;\n const target = resolveInitialFocus(popup, initialFocus);\n if (target !== null && popup.contains(target)) return target;\n if (isDev && !warned.current) {\n warned.current = true;\n console.error(\n target === null\n ? `${part}: \\`initialFocus\\` resolved to no element; the platform picks the focus target.`\n : `${part}: \\`initialFocus\\` is outside the ${noun}; the platform picks the focus target.`,\n );\n }\n return null;\n };\n}\n\n/**\n * Design 6.2 rule 2, after a close that began with focus inside (or whose commit unmounted the\n * focused content): when focus is now on `<body>` or still inside the hidden popup, focus the\n * Trigger (connected, and `canFocus` when given), else blur what holds focus.\n */\nexport function returnFocusToTrigger(\n popup: HTMLElement,\n trigger: HTMLElement | null,\n canFocus?: (trigger: HTMLElement) => boolean,\n): void {\n const doc = popup.ownerDocument;\n const active = doc.activeElement;\n if (active !== null && active !== doc.body && !popup.contains(active)) return;\n if (trigger !== null && trigger.isConnected && (canFocus === undefined || canFocus(trigger))) {\n trigger.focus();\n } else if (active instanceof HTMLElement && active !== doc.body) {\n active.blur();\n }\n}\n\n/** The development warnings for a Popup's library-only props in JS-free mode. */\nexport function useJsFreePropWarnings(\n part: string,\n noun: string,\n isLibrary: boolean,\n transition: ViewTransitionClass | undefined,\n keepMounted: boolean | undefined,\n): void {\n useDevWarning(\n !isLibrary && transition !== undefined,\n isDev &&\n `${part}: \\`transition\\` has no effect in JS-free mode; the browser opens and closes the ` +\n `${noun} outside any React transition. Animate it with CSS (\\`@starting-style\\`).`,\n );\n useDevWarning(\n !isLibrary && keepMounted === false,\n isDev &&\n `${part}: \\`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"],"mappings":";;;;;;;AAUA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;;;AAiBvC,SAAgB,qBACd,EAAE,WAAW,aAAa,SAAS,eACnC,UACW;CACX,IAAI;CACJ,IAAI,CAAC,WACH,OAAO,SAAS;MACX,IAAI,gBAAgB,MACzB,OAAO,oBAAC,UAAD;EAAU,MAAM,UAAU,YAAY;EAAW,UAAA,YAAY,SAAS,CAAC;CAAY,CAAA;MAE1F,OAAO,UAAU,YAAY,SAAS,CAAC,IAAI;CAE7C,OAAO,oBAAC,gBAAD;EAAgB,OAAO;EAAO,UAAA;CAAqB,CAAA;AAC5D;;;;;;;;AA0BA,SAAgB,aACd,WACA,WACA,YACW;CACX,MAAM,OAAO,iBAAiB;CAC9B,MAAM,CAAC,eAAe,oBAAoB,SAAS,SAAS;CAC5D,IAAI,kBAAkB,WAAW;EAC/B,iBAAiB,SAAS;EAC1B,IAAI,aAAa,iBAAiB,eAAe,KAAA,GAAW,KAAK,iBAAiB;CACpF;CACA,OAAO;EACL,GAAG;EACH,aAAa,OAAO,SAAS;GAC3B,IAAI,QAAQ,eAAe,KAAA,GAAW;GACtC,MAAM,aAAa,KAAK,eAAe,KAAK;GAC5C,IAAI,WAAW,SAAS,GAAG,KAAK,UAAU,UAAU;QAC/C,KAAK,QAAQ;EACpB;EACA,gBAAgB,aAAa,eAAe,UAAU;GACpD,IAAI,KAAK,QAAQ,CAAC,eAAe,CAAC,KAAK,QAAQ,KAAK,CAAC,iBAAiB,CAAC,OACrE,KAAK,QAAQ;EAEjB;CACF;AACF;;AAGA,SAAgB,UAAU,OAAsB;CAC9C,OAAO,OAAQ,MAAuC,WAAW,EAAE,CAAC,CAAC,YAAY;AACnF;;AAGA,SAAgB,oBACd,OACA,cACoB;CACpB,IAAI,OAAO,iBAAiB,UAAU,OAAO,MAAM,cAA2B,YAAY;CAC1F,OAAO,aAAa;AACtB;;;;;;AAYA,SAAgB,sBAAsB,MAAc,MAAkC;CACpF,MAAM,SAAS,OAAO,KAAK;CAC3B,QAAQ,OAAO,iBAAiB;EAC9B,IAAI,iBAAiB,KAAA,GAAW,OAAO;EACvC,MAAM,SAAS,oBAAoB,OAAO,YAAY;EACtD,IAAI,WAAW,QAAQ,MAAM,SAAS,MAAM,GAAG,OAAO;EACtD,IAAI,SAAS,CAAC,OAAO,SAAS;GAC5B,OAAO,UAAU;GACjB,QAAQ,MACN,WAAW,OACP,GAAG,KAAK,mFACR,GAAG,KAAK,oCAAoC,KAAK,uCACvD;EACF;EACA,OAAO;CACT;AACF;;;;;;AAOA,SAAgB,qBACd,OACA,SACA,UACM;CACN,MAAM,MAAM,MAAM;CAClB,MAAM,SAAS,IAAI;CACnB,IAAI,WAAW,QAAQ,WAAW,IAAI,QAAQ,CAAC,MAAM,SAAS,MAAM,GAAG;CACvE,IAAI,YAAY,QAAQ,QAAQ,gBAAgB,aAAa,KAAA,KAAa,SAAS,OAAO,IACxF,QAAQ,MAAM;MACT,IAAI,kBAAkB,eAAe,WAAW,IAAI,MACzD,OAAO,KAAK;AAEhB;;AAGA,SAAgB,sBACd,MACA,MACA,WACA,YACA,aACM;CACN,cACE,CAAC,aAAa,eAAe,KAAA,GAC7B,SACE,GAAG,KAAK,mFACH,KAAK,0EACd;CACA,cACE,CAAC,aAAa,gBAAgB,OAC9B,SACE,GAAG,KAAK,iIAEZ;AACF"}
@@ -0,0 +1,18 @@
1
+ //#region src/internal/popover-open.ts
2
+ /**
3
+ * Whether `element` is a showing popover (`:popover-open`). `false` for `null` and where the
4
+ * selector is unsupported (it throws there, for example on a `render` element in an engine
5
+ * without the Popover API).
6
+ */
7
+ function isPopoverOpen(element) {
8
+ if (element === null) return false;
9
+ try {
10
+ return element.matches(":popover-open");
11
+ } catch {
12
+ return false;
13
+ }
14
+ }
15
+ //#endregion
16
+ export { isPopoverOpen };
17
+
18
+ //# sourceMappingURL=popover-open.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"popover-open.mjs","names":[],"sources":["../../src/internal/popover-open.ts"],"sourcesContent":["// No directive: a pure DOM read (conventions 7.1).\n\n/**\n * Whether `element` is a showing popover (`:popover-open`). `false` for `null` and where the\n * selector is unsupported (it throws there, for example on a `render` element in an engine\n * without the Popover API).\n */\nexport function isPopoverOpen(element: Element | null): boolean {\n if (element === null) return false;\n try {\n return element.matches(\":popover-open\");\n } catch {\n return false;\n }\n}\n"],"mappings":";;;;;;AAOA,SAAgB,cAAc,SAAkC;CAC9D,IAAI,YAAY,MAAM,OAAO;CAC7B,IAAI;EACF,OAAO,QAAQ,QAAQ,eAAe;CACxC,QAAQ;EACN,OAAO;CACT;AACF"}
@@ -0,0 +1,2 @@
1
+ import "./types.mjs";
2
+ import { CSSProperties, ReactNode, Ref } from "react";
@@ -21,13 +21,31 @@ function rendersButton(render) {
21
21
  * Whether the rendered element is certainly a host `<button>`: no `render`, the function form, or
22
22
  * a host `"button"` element. The strict predicate for native `disabled`, which means nothing on a
23
23
  * link and would expose it as enabled to assistive technology; anything else (a link, a
24
- * component) takes the `aria-disabled` branch (design/components/button.md, review fold F1).
24
+ * component) takes the `aria-disabled` branch (design/components/button.md).
25
25
  */
26
26
  function isHostButton(render) {
27
27
  if (render === void 0 || typeof render === "function") return true;
28
28
  return isValidElement(render) && render.type === "button";
29
29
  }
30
30
  /**
31
+ * The disabled rule of a button-like part that accepts an arbitrary `render`
32
+ * (conventions 1.2, design/components/button.md 17): native `disabled` on a host `<button>`, or
33
+ * where the browser handles the click (`handlesClick: false`: a JS-free command, which only
34
+ * native `disabled` stops); `aria-disabled` otherwise. `alwaysFocusable` always takes the
35
+ * `aria-disabled` branch (a menu item stays focusable).
36
+ */
37
+ function disabledButton(render, disabled, options = {}) {
38
+ const { handlesClick = true, alwaysFocusable = false } = options;
39
+ const focusable = alwaysFocusable || handlesClick && !isHostButton(render);
40
+ return {
41
+ props: {
42
+ disabled: focusable ? void 0 : disabled,
43
+ ...focusable && { "aria-disabled": disabled ? true : void 0 }
44
+ },
45
+ invoker: !(focusable && disabled)
46
+ };
47
+ }
48
+ /**
31
49
  * The ref of a part with no library ref, merged from the consumer's `ref` and a `render`
32
50
  * element's ref without memoisation (a directive-free part cannot `useMemo`, design
33
51
  * progress.md 14.1). A fresh callback ref per render is correct because every merged callback
@@ -62,6 +80,6 @@ function renderElement(options) {
62
80
  return createElement(defaultElement, resolved);
63
81
  }
64
82
  //#endregion
65
- export { isHostButton, mergeRenderRef, renderElement, rendersButton, resolveStateValue };
83
+ export { disabledButton, isHostButton, mergeRenderRef, renderElement, rendersButton, resolveStateValue };
66
84
 
67
85
  //# sourceMappingURL=render-element.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"render-element.mjs","names":[],"sources":["../../src/internal/render-element.ts"],"sourcesContent":["// No \"use client\": the pure half of `useRender`, usable from a directive-free part (a Root that\n// may run as a Server Component, design/components/progress.md 8.1 and implementation note 14.1).\nimport { cloneElement, createElement, isValidElement } from \"react\";\nimport type { CSSProperties, ReactNode, Ref } from \"react\";\nimport { mergeProps, mergeRefs } from \"./merge-props.js\";\nimport type { RenderProp, StateValue } from \"./types.js\";\n\nexport interface ElementLikeProps {\n className?: string | undefined;\n style?: CSSProperties | undefined;\n children?: ReactNode;\n ref?: Ref<unknown> | undefined;\n}\n\n/** `data-*` attributes are valid JSX but absent from the element prop types. */\nexport type DataAttributes = { [key: `data-${string}`]: string | undefined };\n\nexport interface RenderElementOptions<Props extends ElementLikeProps, State> {\n /** Intrinsic element rendered when `render` is not given. */\n defaultElement: string;\n render: RenderProp<Props, State> | undefined;\n state: State;\n className: StateValue<string | undefined, State> | undefined;\n style: StateValue<CSSProperties | undefined, State> | undefined;\n children: StateValue<ReactNode, State> | undefined;\n /**\n * The part's pass-through props for the element. A `render` element's own props win over\n * these. Their `ref` is replaced by `ref` below.\n */\n props: Omit<Props, \"className\" | \"style\" | \"children\"> & DataAttributes;\n /**\n * Library-controlled attributes the part computes (`role`, `aria-*` state, id wiring, `data-*`\n * state, the library's own event handlers). These win over a `render` element's props\n * (conventions 1.2).\n */\n libraryProps?: Partial<Omit<Props, \"className\" | \"style\" | \"children\">> & DataAttributes;\n /**\n * The element's ref, already merged from the library's ref, the consumer's `ref` and the\n * `render` element's ref. The `render` element's own ref is not attached separately.\n */\n ref: Ref<unknown> | undefined;\n}\n\nexport function resolveStateValue<T, State>(value: StateValue<T, State>, state: State): T {\n return typeof value === \"function\" ? (value as (state: State) => T)(state) : value;\n}\n\n/**\n * Whether a part whose default element is a `<button>` should add `type=\"button\"` (conventions\n * 1.2): no `render`, the function form (it receives button props and decides itself what to\n * spread), a host `<button>` element, or a **component** element (assumed to render a\n * `<button>`; if it renders a link, `type` is a harmless ignored attribute, while a missing\n * `type` on a `<button>` in a form is a silent submit). Only a host element of another tag (an\n * `<a>`) does not get it.\n */\nexport function rendersButton<Props, State>(render: RenderProp<Props, State> | undefined): boolean {\n if (render === undefined || typeof render === \"function\") return true;\n if (!isValidElement(render)) return false;\n return typeof render.type !== \"string\" || render.type === \"button\";\n}\n\n/**\n * Whether the rendered element is certainly a host `<button>`: no `render`, the function form, or\n * a host `\"button\"` element. The strict predicate for native `disabled`, which means nothing on a\n * link and would expose it as enabled to assistive technology; anything else (a link, a\n * component) takes the `aria-disabled` branch (design/components/button.md, review fold F1).\n */\nexport function isHostButton<Props, State>(render: RenderProp<Props, State> | undefined): boolean {\n if (render === undefined || typeof render === \"function\") return true;\n return isValidElement(render) && render.type === \"button\";\n}\n\n/**\n * The ref of a part with no library ref, merged from the consumer's `ref` and a `render`\n * element's ref without memoisation (a directive-free part cannot `useMemo`, design\n * progress.md 14.1). A fresh callback ref per render is correct because every merged callback\n * returns a cleanup; a single ref is passed through untouched.\n */\nexport function mergeRenderRef(\n consumerRef: Ref<unknown> | undefined,\n render: unknown,\n): Ref<unknown> | undefined {\n const elementRef = isValidElement<ElementLikeProps>(render) ? render.props.ref : undefined;\n if (consumerRef != null && elementRef != null) return mergeRefs(consumerRef, elementRef);\n return consumerRef ?? elementRef;\n}\n\n/**\n * Resolves `render` and the function-form `className` / `style` / `children` of a part against\n * its state and produces the element (conventions 1.2, 1.3, 1.4). Pure: the caller merges the\n * refs (`useRender` memoises the merge; a directive-free part merges unmemoised).\n */\nexport function renderElement<Props extends ElementLikeProps, State>(\n options: RenderElementOptions<Props, State>,\n): ReactNode {\n const { defaultElement, render, state, className, style, children, props, libraryProps, ref } =\n options;\n\n const partProps = {\n ...props,\n ref,\n className: resolveStateValue(className, state),\n style: resolveStateValue(style, state),\n children: resolveStateValue(children, state),\n } as Record<string, unknown>;\n const controlled = (libraryProps ?? {}) as Record<string, unknown>;\n\n if (isValidElement<ElementLikeProps>(render)) {\n // The element's ref is already part of `ref`.\n const { ref: _ignored, ...elementProps } = render.props as Record<string, unknown>;\n return cloneElement(render, mergeProps(partProps, elementProps, controlled) as Partial<Props>);\n }\n const resolved = mergeProps(partProps, {}, controlled) as unknown as Props;\n if (typeof render === \"function\") {\n return render(resolved, state);\n }\n return createElement(defaultElement, resolved);\n}\n"],"mappings":";;;AA2CA,SAAgB,kBAA4B,OAA6B,OAAiB;CACxF,OAAO,OAAO,UAAU,aAAc,MAA8B,KAAK,IAAI;AAC/E;;;;;;;;;AAUA,SAAgB,cAA4B,QAAuD;CACjG,IAAI,WAAW,KAAA,KAAa,OAAO,WAAW,YAAY,OAAO;CACjE,IAAI,CAAC,eAAe,MAAM,GAAG,OAAO;CACpC,OAAO,OAAO,OAAO,SAAS,YAAY,OAAO,SAAS;AAC5D;;;;;;;AAQA,SAAgB,aAA2B,QAAuD;CAChG,IAAI,WAAW,KAAA,KAAa,OAAO,WAAW,YAAY,OAAO;CACjE,OAAO,eAAe,MAAM,KAAK,OAAO,SAAS;AACnD;;;;;;;AAQA,SAAgB,eACd,aACA,QAC0B;CAC1B,MAAM,aAAa,eAAiC,MAAM,IAAI,OAAO,MAAM,MAAM,KAAA;CACjF,IAAI,eAAe,QAAQ,cAAc,MAAM,OAAO,UAAU,aAAa,UAAU;CACvF,OAAO,eAAe;AACxB;;;;;;AAOA,SAAgB,cACd,SACW;CACX,MAAM,EAAE,gBAAgB,QAAQ,OAAO,WAAW,OAAO,UAAU,OAAO,cAAc,QACtF;CAEF,MAAM,YAAY;EAChB,GAAG;EACH;EACA,WAAW,kBAAkB,WAAW,KAAK;EAC7C,OAAO,kBAAkB,OAAO,KAAK;EACrC,UAAU,kBAAkB,UAAU,KAAK;CAC7C;CACA,MAAM,aAAc,gBAAgB,CAAC;CAErC,IAAI,eAAiC,MAAM,GAAG;EAE5C,MAAM,EAAE,KAAK,UAAU,GAAG,iBAAiB,OAAO;EAClD,OAAO,aAAa,QAAQ,WAAW,WAAW,cAAc,UAAU,CAAmB;CAC/F;CACA,MAAM,WAAW,WAAW,WAAW,CAAC,GAAG,UAAU;CACrD,IAAI,OAAO,WAAW,YACpB,OAAO,OAAO,UAAU,KAAK;CAE/B,OAAO,cAAc,gBAAgB,QAAQ;AAC/C"}
1
+ {"version":3,"file":"render-element.mjs","names":[],"sources":["../../src/internal/render-element.ts"],"sourcesContent":["// No \"use client\": the pure half of `useRender`, usable from a directive-free part (a Root that\n// may run as a Server Component, design/components/progress.md 8.1 and implementation note 14.1).\nimport { cloneElement, createElement, isValidElement } from \"react\";\nimport type { CSSProperties, ReactNode, Ref } from \"react\";\nimport { mergeProps, mergeRefs } from \"./merge-props.js\";\nimport type { RenderProp, StateValue } from \"./types.js\";\n\nexport interface ElementLikeProps {\n className?: string | undefined;\n style?: CSSProperties | undefined;\n children?: ReactNode;\n ref?: Ref<unknown> | undefined;\n}\n\n/** `data-*` attributes are valid JSX but absent from the element prop types. */\nexport type DataAttributes = { [key: `data-${string}`]: string | undefined };\n\nexport interface RenderElementOptions<Props extends ElementLikeProps, State> {\n /** Intrinsic element rendered when `render` is not given. */\n defaultElement: string;\n render: RenderProp<Props, State> | undefined;\n state: State;\n className: StateValue<string | undefined, State> | undefined;\n style: StateValue<CSSProperties | undefined, State> | undefined;\n children: StateValue<ReactNode, State> | undefined;\n /**\n * The part's pass-through props for the element. A `render` element's own props win over\n * these. Their `ref` is replaced by `ref` below.\n */\n props: Omit<Props, \"className\" | \"style\" | \"children\"> & DataAttributes;\n /**\n * Library-controlled attributes the part computes (`role`, `aria-*` state, id wiring, `data-*`\n * state, the library's own event handlers). These win over a `render` element's props\n * (conventions 1.2).\n */\n libraryProps?: Partial<Omit<Props, \"className\" | \"style\" | \"children\">> & DataAttributes;\n /**\n * The element's ref, already merged from the library's ref, the consumer's `ref` and the\n * `render` element's ref. The `render` element's own ref is not attached separately.\n */\n ref: Ref<unknown> | undefined;\n}\n\nexport function resolveStateValue<T, State>(value: StateValue<T, State>, state: State): T {\n return typeof value === \"function\" ? (value as (state: State) => T)(state) : value;\n}\n\n/**\n * Whether a part whose default element is a `<button>` should add `type=\"button\"` (conventions\n * 1.2): no `render`, the function form (it receives button props and decides itself what to\n * spread), a host `<button>` element, or a **component** element (assumed to render a\n * `<button>`; if it renders a link, `type` is a harmless ignored attribute, while a missing\n * `type` on a `<button>` in a form is a silent submit). Only a host element of another tag (an\n * `<a>`) does not get it.\n */\nexport function rendersButton<Props, State>(render: RenderProp<Props, State> | undefined): boolean {\n if (render === undefined || typeof render === \"function\") return true;\n if (!isValidElement(render)) return false;\n return typeof render.type !== \"string\" || render.type === \"button\";\n}\n\n/**\n * Whether the rendered element is certainly a host `<button>`: no `render`, the function form, or\n * a host `\"button\"` element. The strict predicate for native `disabled`, which means nothing on a\n * link and would expose it as enabled to assistive technology; anything else (a link, a\n * component) takes the `aria-disabled` branch (design/components/button.md).\n */\nexport function isHostButton<Props, State>(render: RenderProp<Props, State> | undefined): boolean {\n if (render === undefined || typeof render === \"function\") return true;\n return isValidElement(render) && render.type === \"button\";\n}\n\nexport interface DisabledButton {\n /**\n * Owned keys, spread where `disabled` goes: `disabled` (owned as absent in the focusable\n * branch, where the element may not be a host `<button>` and the part's click handler refuses,\n * so a render element's own is removed), and in that branch only `aria-disabled` (a host\n * button keeps a consumer's own).\n */\n readonly props: {\n readonly disabled: boolean | undefined;\n readonly \"aria-disabled\"?: true | undefined;\n };\n /**\n * Whether an invoker part may render `commandfor` / `command`: not when disabled in the\n * focusable branch, where nothing native stops the command (a component render spreading onto\n * a real `<button>` would be a live invoker before hydration).\n */\n readonly invoker: boolean;\n}\n\n/**\n * The disabled rule of a button-like part that accepts an arbitrary `render`\n * (conventions 1.2, design/components/button.md 17): native `disabled` on a host `<button>`, or\n * where the browser handles the click (`handlesClick: false`: a JS-free command, which only\n * native `disabled` stops); `aria-disabled` otherwise. `alwaysFocusable` always takes the\n * `aria-disabled` branch (a menu item stays focusable).\n */\nexport function disabledButton<Props, State>(\n render: RenderProp<Props, State> | undefined,\n disabled: boolean,\n options: { readonly handlesClick?: boolean; readonly alwaysFocusable?: boolean } = {},\n): DisabledButton {\n const { handlesClick = true, alwaysFocusable = false } = options;\n const focusable = alwaysFocusable || (handlesClick && !isHostButton(render));\n return {\n props: {\n disabled: focusable ? undefined : disabled,\n ...(focusable && { \"aria-disabled\": disabled ? true : undefined }),\n },\n invoker: !(focusable && disabled),\n };\n}\n\n/**\n * The ref of a part with no library ref, merged from the consumer's `ref` and a `render`\n * element's ref without memoisation (a directive-free part cannot `useMemo`, design\n * progress.md 14.1). A fresh callback ref per render is correct because every merged callback\n * returns a cleanup; a single ref is passed through untouched.\n */\nexport function mergeRenderRef(\n consumerRef: Ref<unknown> | undefined,\n render: unknown,\n): Ref<unknown> | undefined {\n const elementRef = isValidElement<ElementLikeProps>(render) ? render.props.ref : undefined;\n if (consumerRef != null && elementRef != null) return mergeRefs(consumerRef, elementRef);\n return consumerRef ?? elementRef;\n}\n\n/**\n * Resolves `render` and the function-form `className` / `style` / `children` of a part against\n * its state and produces the element (conventions 1.2, 1.3, 1.4). Pure: the caller merges the\n * refs (`useRender` memoises the merge; a directive-free part merges unmemoised).\n */\nexport function renderElement<Props extends ElementLikeProps, State>(\n options: RenderElementOptions<Props, State>,\n): ReactNode {\n const { defaultElement, render, state, className, style, children, props, libraryProps, ref } =\n options;\n\n const partProps = {\n ...props,\n ref,\n className: resolveStateValue(className, state),\n style: resolveStateValue(style, state),\n children: resolveStateValue(children, state),\n } as Record<string, unknown>;\n const controlled = (libraryProps ?? {}) as Record<string, unknown>;\n\n if (isValidElement<ElementLikeProps>(render)) {\n // The element's ref is already part of `ref`.\n const { ref: _ignored, ...elementProps } = render.props as Record<string, unknown>;\n return cloneElement(render, mergeProps(partProps, elementProps, controlled) as Partial<Props>);\n }\n const resolved = mergeProps(partProps, {}, controlled) as unknown as Props;\n if (typeof render === \"function\") {\n return render(resolved, state);\n }\n return createElement(defaultElement, resolved);\n}\n"],"mappings":";;;AA2CA,SAAgB,kBAA4B,OAA6B,OAAiB;CACxF,OAAO,OAAO,UAAU,aAAc,MAA8B,KAAK,IAAI;AAC/E;;;;;;;;;AAUA,SAAgB,cAA4B,QAAuD;CACjG,IAAI,WAAW,KAAA,KAAa,OAAO,WAAW,YAAY,OAAO;CACjE,IAAI,CAAC,eAAe,MAAM,GAAG,OAAO;CACpC,OAAO,OAAO,OAAO,SAAS,YAAY,OAAO,SAAS;AAC5D;;;;;;;AAQA,SAAgB,aAA2B,QAAuD;CAChG,IAAI,WAAW,KAAA,KAAa,OAAO,WAAW,YAAY,OAAO;CACjE,OAAO,eAAe,MAAM,KAAK,OAAO,SAAS;AACnD;;;;;;;;AA4BA,SAAgB,eACd,QACA,UACA,UAAmF,CAAC,GACpE;CAChB,MAAM,EAAE,eAAe,MAAM,kBAAkB,UAAU;CACzD,MAAM,YAAY,mBAAoB,gBAAgB,CAAC,aAAa,MAAM;CAC1E,OAAO;EACL,OAAO;GACL,UAAU,YAAY,KAAA,IAAY;GAClC,GAAI,aAAa,EAAE,iBAAiB,WAAW,OAAO,KAAA,EAAU;EAClE;EACA,SAAS,EAAE,aAAa;CAC1B;AACF;;;;;;;AAQA,SAAgB,eACd,aACA,QAC0B;CAC1B,MAAM,aAAa,eAAiC,MAAM,IAAI,OAAO,MAAM,MAAM,KAAA;CACjF,IAAI,eAAe,QAAQ,cAAc,MAAM,OAAO,UAAU,aAAa,UAAU;CACvF,OAAO,eAAe;AACxB;;;;;;AAOA,SAAgB,cACd,SACW;CACX,MAAM,EAAE,gBAAgB,QAAQ,OAAO,WAAW,OAAO,UAAU,OAAO,cAAc,QACtF;CAEF,MAAM,YAAY;EAChB,GAAG;EACH;EACA,WAAW,kBAAkB,WAAW,KAAK;EAC7C,OAAO,kBAAkB,OAAO,KAAK;EACrC,UAAU,kBAAkB,UAAU,KAAK;CAC7C;CACA,MAAM,aAAc,gBAAgB,CAAC;CAErC,IAAI,eAAiC,MAAM,GAAG;EAE5C,MAAM,EAAE,KAAK,UAAU,GAAG,iBAAiB,OAAO;EAClD,OAAO,aAAa,QAAQ,WAAW,WAAW,cAAc,UAAU,CAAmB;CAC/F;CACA,MAAM,WAAW,WAAW,WAAW,CAAC,GAAG,UAAU;CACrD,IAAI,OAAO,WAAW,YACpB,OAAO,OAAO,UAAU,KAAK;CAE/B,OAAO,cAAc,gBAAgB,QAAQ;AAC/C"}
@@ -0,0 +1,14 @@
1
+ //#region src/internal/shipped-styles.ts
2
+ /**
3
+ * The React stylesheet precedence bucket of the library's functional CSS. Fizz writes every
4
+ * same-precedence `<style>` of one server flush as a single element with the texts concatenated,
5
+ * which would match none of the per-href hashes in `STYLE_SHA256`: at most one shipped stylesheet
6
+ * in this bucket may render during server rendering (today the tooltip skip-delay rule; the menu
7
+ * point rules are client-only). A second one needs a precedence of its own (guard row in
8
+ * `csp/csp.test.tsx`).
9
+ */
10
+ const FSUI_PRECEDENCE = "fsui";
11
+ //#endregion
12
+ export { FSUI_PRECEDENCE };
13
+
14
+ //# sourceMappingURL=shipped-styles.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shipped-styles.mjs","names":[],"sources":["../../src/internal/shipped-styles.ts"],"sourcesContent":["// Shared by the library's shipped functional stylesheets (conventions 12). No \"use client\"\n// directive: constants only (conventions 7.1).\n\n/**\n * The React stylesheet precedence bucket of the library's functional CSS. Fizz writes every\n * same-precedence `<style>` of one server flush as a single element with the texts concatenated,\n * which would match none of the per-href hashes in `STYLE_SHA256`: at most one shipped stylesheet\n * in this bucket may render during server rendering (today the tooltip skip-delay rule; the menu\n * point rules are client-only). A second one needs a precedence of its own (guard row in\n * `csp/csp.test.tsx`).\n */\nexport const FSUI_PRECEDENCE = \"fsui\";\n"],"mappings":";;;;;;;;;AAWA,MAAa,kBAAkB"}
@@ -13,7 +13,11 @@ function syncPresence(el, name, present) {
13
13
  else el.removeAttribute(name);
14
14
  }
15
15
  }
16
+ /** `syncPresence` for each entry of `attributes`, in order. */
17
+ function syncPresences(el, attributes) {
18
+ for (const [name, present] of Object.entries(attributes)) syncPresence(el, name, present);
19
+ }
16
20
  //#endregion
17
- export { syncPresence };
21
+ export { syncPresence, syncPresences };
18
22
 
19
23
  //# sourceMappingURL=sync-presence.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"sync-presence.mjs","names":[],"sources":["../../src/internal/sync-presence.ts"],"sourcesContent":["/**\n * Makes a boolean attribute's presence match `present`. For group members that may hydrate after\n * their Root (`RadioGroup.Item`, `CheckboxGroup.Item` / `Parent`): hydration keeps server\n * attributes that differ from the client render (React only warns), and a member hydrating late\n * can render a different state than the server did.\n *\n * No `\"use client\"` directive: no client-only API (conventions 7.1).\n */\nexport function syncPresence(el: Element, name: string, present: boolean): void {\n if (el.hasAttribute(name) !== present) {\n if (present) el.setAttribute(name, \"\");\n else el.removeAttribute(name);\n }\n}\n"],"mappings":";;;;;;;;;AAQA,SAAgB,aAAa,IAAa,MAAc,SAAwB;CAC9E,IAAI,GAAG,aAAa,IAAI,MAAM,SAAS;EACrC,IAAI,SAAS,GAAG,aAAa,MAAM,EAAE;OAChC,GAAG,gBAAgB,IAAI;CAC9B;AACF"}
1
+ {"version":3,"file":"sync-presence.mjs","names":[],"sources":["../../src/internal/sync-presence.ts"],"sourcesContent":["/**\n * Makes a boolean attribute's presence match `present`. For group members that may hydrate after\n * their Root (`RadioGroup.Item`, `CheckboxGroup.Item` / `Parent`): hydration keeps server\n * attributes that differ from the client render (React only warns), and a member hydrating late\n * can render a different state than the server did.\n *\n * No `\"use client\"` directive: no client-only API (conventions 7.1).\n */\nexport function syncPresence(el: Element, name: string, present: boolean): void {\n if (el.hasAttribute(name) !== present) {\n if (present) el.setAttribute(name, \"\");\n else el.removeAttribute(name);\n }\n}\n\n/** `syncPresence` for each entry of `attributes`, in order. */\nexport function syncPresences(el: Element, attributes: Readonly<Record<string, boolean>>): void {\n for (const [name, present] of Object.entries(attributes)) syncPresence(el, name, present);\n}\n"],"mappings":";;;;;;;;;AAQA,SAAgB,aAAa,IAAa,MAAc,SAAwB;CAC9E,IAAI,GAAG,aAAa,IAAI,MAAM,SAAS;EACrC,IAAI,SAAS,GAAG,aAAa,MAAM,EAAE;OAChC,GAAG,gBAAgB,IAAI;CAC9B;AACF;;AAGA,SAAgB,cAAc,IAAa,YAAqD;CAC9F,KAAK,MAAM,CAAC,MAAM,YAAY,OAAO,QAAQ,UAAU,GAAG,aAAa,IAAI,MAAM,OAAO;AAC1F"}
@@ -1 +1 @@
1
- {"version":3,"file":"toolbar-context.mjs","names":[],"sources":["../../src/internal/toolbar-context.ts"],"sourcesContent":["\"use client\";\nimport { createContext, use } from \"react\";\n\n/** What a part inside a `Toolbar.Root` learns about it (design/components/toggle-group.md 7.3, 7.4). */\nexport interface ToolbarContextValue {\n /** The Toolbar's arrow-key axis. */\n readonly orientation: \"horizontal\" | \"vertical\";\n}\n\n/**\n * Provided by `Toolbar.Root`; read across folders by `ToggleGroup.Root` (joins the Toolbar's\n * sequence instead of running its own engine), `Toolbar.Separator` (perpendicular orientation)\n * and `Menu.Trigger` (opening arrows in a vertical Toolbar). Conventions 7.1.\n */\nexport const ToolbarContext = createContext<ToolbarContextValue | null>(null);\n\n/** The enclosing Toolbar, or `null` outside one. Works during SSR (context, not DOM). */\nexport function useToolbarContext(): ToolbarContextValue | null {\n return use(ToolbarContext);\n}\n"],"mappings":";;;;;;;;AAcA,MAAa,iBAAiB,cAA0C,IAAI;;AAG5E,SAAgB,oBAAgD;CAC9D,OAAO,IAAI,cAAc;AAC3B"}
1
+ {"version":3,"file":"toolbar-context.mjs","names":[],"sources":["../../src/internal/toolbar-context.ts"],"sourcesContent":["\"use client\";\nimport { createContext, use } from \"react\";\nimport type { Orientation } from \"./types.js\";\n\n/** What a part inside a `Toolbar.Root` learns about it (design/components/toggle-group.md 7.3, 7.4). */\nexport interface ToolbarContextValue {\n /** The Toolbar's arrow-key axis. */\n readonly orientation: Orientation;\n}\n\n/**\n * Provided by `Toolbar.Root`; read across folders by `ToggleGroup.Root` (joins the Toolbar's\n * sequence instead of running its own engine), `Toolbar.Separator` (perpendicular orientation)\n * and `Menu.Trigger` (opening arrows in a vertical Toolbar). Conventions 7.1.\n */\nexport const ToolbarContext = createContext<ToolbarContextValue | null>(null);\n\n/** The enclosing Toolbar, or `null` outside one. Works during SSR (context, not DOM). */\nexport function useToolbarContext(): ToolbarContextValue | null {\n return use(ToolbarContext);\n}\n"],"mappings":";;;;;;;;AAeA,MAAa,iBAAiB,cAA0C,IAAI;;AAG5E,SAAgB,oBAAgD;CAC9D,OAAO,IAAI,cAAc;AAC3B"}
@@ -24,6 +24,6 @@ function warmDelay(delay) {
24
24
  return `calc(${delay}ms * (1 - var(${TOOLTIP_WARM_PROPERTY}, 0)))`;
25
25
  }
26
26
  //#endregion
27
- export { TOOLTIP_TRIGGER_MARKER, TOOLTIP_WARM_HREF, TOOLTIP_WARM_PROPERTY, TOOLTIP_WARM_RULES, warmDelay };
27
+ export { TOOLTIP_TRIGGER_MARKER, TOOLTIP_WARM_HREF, TOOLTIP_WARM_RULES, warmDelay };
28
28
 
29
29
  //# sourceMappingURL=tooltip-warm.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip-warm.mjs","names":[],"sources":["../../src/internal/tooltip-warm.ts"],"sourcesContent":["// Tooltip's skip-delay rule on the native `interestfor` path (design/components/tooltip.md 6,\n// conventions 12): while any tooltip is showing, the inline `interest-delay-start` of a flagged\n// Trigger computes to 0. No \"use client\" directive: constants only (conventions 7.1).\n\n/** Registered, non-inherited: `1` on the marked triggers while a tooltip is showing, else `0`. */\nexport const TOOLTIP_WARM_PROPERTY = \"--fsui-tooltip-warm\";\n/** The marker a flagged Trigger renders; the shipped rule matches nothing else. */\nexport const TOOLTIP_TRIGGER_MARKER = \"data-fsui-tooltip-trigger\";\n/** The dedupe key of the shipped rule (`<style href precedence>`). */\nexport const TOOLTIP_WARM_HREF = \"@funstack/ui/tooltip-warm\";\n\n/**\n * The library's second shipped stylesheet: interaction timing, nothing visual (conventions 12's\n * selector exception: it matches only the library's marker and sets only a `--fsui-` registered\n * property the Trigger's inline style consumes). Its SHA-256 is `STYLE_SHA256` in\n * `@funstack/ui/csp` (a jsdom row recomputes it). When the stylesheet is missing (blocked by a\n * CSP, or never rendered) the property is unregistered and unset: `warmDelay`'s `var()` carries\n * its own `0` fallback, so the Trigger keeps its own `delay` (without it the declaration would be\n * invalid at computed-value time and the browser's `normal` delay would apply).\n */\nexport const TOOLTIP_WARM_RULES =\n \"/* @funstack/ui: tooltip skip-delay. Functional only: while a tooltip is showing, the next \" +\n \"one opens without its delay. */\\n\" +\n `@property ${TOOLTIP_WARM_PROPERTY} { syntax: \"<number>\"; inherits: false; initial-value: 0; }\\n` +\n `:root:has([role=\"tooltip\"]:popover-open) [${TOOLTIP_TRIGGER_MARKER}] { ${TOOLTIP_WARM_PROPERTY}: 1; }\\n`;\n\n/**\n * The inline `interest-delay-start` of a flagged Trigger: `delay` when cold, `0` when warm, and\n * `delay` when the stylesheet is missing (the explicit `0` fallback).\n */\nexport function warmDelay(delay: number): string {\n return `calc(${delay}ms * (1 - var(${TOOLTIP_WARM_PROPERTY}, 0)))`;\n}\n"],"mappings":";;AAKA,MAAa,wBAAwB;;AAErC,MAAa,yBAAyB;;AAEtC,MAAa,oBAAoB;;;;;;;;;;AAWjC,MAAa,qBACX;YAEa,sBAAsB,yGACU,uBAAuB,MAAM,sBAAsB;;;;;AAMlG,SAAgB,UAAU,OAAuB;CAC/C,OAAO,QAAQ,MAAM,gBAAgB,sBAAsB;AAC7D"}
1
+ {"version":3,"file":"tooltip-warm.mjs","names":[],"sources":["../../src/internal/tooltip-warm.ts"],"sourcesContent":["// Tooltip's skip-delay rule on the native `interestfor` path (design/components/tooltip.md 6,\n// conventions 12): while any tooltip is showing, the inline `interest-delay-start` of a flagged\n// Trigger computes to 0. No \"use client\" directive: constants only (conventions 7.1).\n\n/** Registered, non-inherited: `1` on the marked triggers while a tooltip is showing, else `0`. */\nconst TOOLTIP_WARM_PROPERTY = \"--fsui-tooltip-warm\";\n/** The marker a flagged Trigger renders; the shipped rule matches nothing else. */\nexport const TOOLTIP_TRIGGER_MARKER = \"data-fsui-tooltip-trigger\";\n/** The dedupe key of the shipped rule (`<style href precedence>`). */\nexport const TOOLTIP_WARM_HREF = \"@funstack/ui/tooltip-warm\";\n\n/**\n * The library's second shipped stylesheet: interaction timing, nothing visual (conventions 12's\n * selector exception: it matches only the library's marker and sets only a `--fsui-` registered\n * property the Trigger's inline style consumes). Its SHA-256 is `STYLE_SHA256` in\n * `@funstack/ui/csp` (a jsdom row recomputes it). When the stylesheet is missing (blocked by a\n * CSP, or never rendered) the property is unregistered and unset: `warmDelay`'s `var()` carries\n * its own `0` fallback, so the Trigger keeps its own `delay` (without it the declaration would be\n * invalid at computed-value time and the browser's `normal` delay would apply).\n */\nexport const TOOLTIP_WARM_RULES =\n \"/* @funstack/ui: tooltip skip-delay. Functional only: while a tooltip is showing, the next \" +\n \"one opens without its delay. */\\n\" +\n `@property ${TOOLTIP_WARM_PROPERTY} { syntax: \"<number>\"; inherits: false; initial-value: 0; }\\n` +\n `:root:has([role=\"tooltip\"]:popover-open) [${TOOLTIP_TRIGGER_MARKER}] { ${TOOLTIP_WARM_PROPERTY}: 1; }\\n`;\n\n/**\n * The inline `interest-delay-start` of a flagged Trigger: `delay` when cold, `0` when warm, and\n * `delay` when the stylesheet is missing (the explicit `0` fallback).\n */\nexport function warmDelay(delay: number): string {\n return `calc(${delay}ms * (1 - var(${TOOLTIP_WARM_PROPERTY}, 0)))`;\n}\n"],"mappings":";;AAKA,MAAM,wBAAwB;;AAE9B,MAAa,yBAAyB;;AAEtC,MAAa,oBAAoB;;;;;;;;;;AAWjC,MAAa,qBACX;YAEa,sBAAsB,yGACU,uBAAuB,MAAM,sBAAsB;;;;;AAMlG,SAAgB,UAAU,OAAuB;CAC/C,OAAO,QAAQ,MAAM,gBAAgB,sBAAsB;AAC7D"}
@@ -8,7 +8,7 @@ const isDev = process.env.NODE_ENV !== "production";
8
8
  * passed `transition`** (conventions 5.1). With `transition === undefined` the node is returned
9
9
  * unwrapped and the part renders no boundary at all.
10
10
  *
11
- * Reason (docs/research/view-transition-mount-cost.md, issue #35): react-dom 19.3 starts a
11
+ * Reason (docs/research/view-transition-mount-cost.md): react-dom 19.3 starts a
12
12
  * document view transition whenever a `<ViewTransition>` mounts or is revealed by `<Activity>` in
13
13
  * a transition-lane commit, whatever its class resolves to (`"none"` included). The browser's
14
14
  * 250 ms root cross-fade then runs and every later transition commit waits for it. Exits and
@@ -1 +1 @@
1
- {"version":3,"file":"transition-boundary.mjs","names":[],"sources":["../../src/internal/transition-boundary.tsx"],"sourcesContent":["\"use client\";\nimport { useEffect, useRef, ViewTransition } from \"react\";\nimport type { ReactNode, ViewTransitionClass } from \"react\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/**\n * Wraps a part's output in `<ViewTransition default={transition}>` **only when the consumer\n * passed `transition`** (conventions 5.1). With `transition === undefined` the node is returned\n * unwrapped and the part renders no boundary at all.\n *\n * Reason (docs/research/view-transition-mount-cost.md, issue #35): react-dom 19.3 starts a\n * document view transition whenever a `<ViewTransition>` mounts or is revealed by `<Activity>` in\n * a transition-lane commit, whatever its class resolves to (`\"none\"` included). The browser's\n * 250 ms root cross-fade then runs and every later transition commit waits for it. Exits and\n * updates of a `\"none\"` boundary are free, so an explicit `transition=\"none\"` keeps the boundary\n * and lets a consumer switch between `\"none\"` and a class without remounting.\n *\n * The boundary stays the outermost node of the part's output, so a part that is the top of an\n * inserted subtree gets enter / exit. A plain function (not a component), so it adds no fiber\n * between the boundary and the element.\n */\nexport function transitionBoundary(\n transition: ViewTransitionClass | undefined,\n node: ReactNode,\n): ReactNode {\n if (transition === undefined) return node;\n return <ViewTransition default={transition}>{node}</ViewTransition>;\n}\n\n/**\n * {@link transitionBoundary} plus the development warning for a non-static `transition`\n * (conventions 5.1): changing it between `undefined` and a value changes the element type at the\n * part's root, so React remounts the part's subtree (DOM and state lost). Warns once per\n * instance, from an effect. `part` is the public name used in the message (`\"Tabs.Panel\"`).\n *\n * Pass the *effective* value: a part that ignores `transition` in some mode (Accordion, Dialog\n * JS-free mode) passes `undefined` there.\n */\nexport function useTransitionBoundary(\n part: string,\n transition: ViewTransitionClass | undefined,\n node: ReactNode,\n): ReactNode {\n const hasBoundary = transition !== undefined;\n const initial = useRef(hasBoundary);\n const warned = useRef(false);\n useEffect(() => {\n if (!isDev || warned.current || hasBoundary === initial.current) return;\n warned.current = true;\n console.error(\n `${part}: \\`transition\\` changed between undefined and a value after mount. The part ` +\n \"renders a <ViewTransition> only when `transition` is given, so this remounts its \" +\n 'subtree (DOM and state are lost). Keep `transition` static; use `transition=\"none\"` ' +\n \"to switch animation off without removing the boundary.\",\n );\n }, [hasBoundary, part]);\n return transitionBoundary(transition, node);\n}\n"],"mappings":";;;;AAIA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;;;;;;;;;;;;AAkBvC,SAAgB,mBACd,YACA,MACW;CACX,IAAI,eAAe,KAAA,GAAW,OAAO;CACrC,OAAO,oBAAC,gBAAD;EAAgB,SAAS;EAAa,UAAA;CAAqB,CAAA;AACpE;;;;;;;;;;AAWA,SAAgB,sBACd,MACA,YACA,MACW;CACX,MAAM,cAAc,eAAe,KAAA;CACnC,MAAM,UAAU,OAAO,WAAW;CAClC,MAAM,SAAS,OAAO,KAAK;CAC3B,gBAAgB;EACd,IAAI,CAAC,SAAS,OAAO,WAAW,gBAAgB,QAAQ,SAAS;EACjE,OAAO,UAAU;EACjB,QAAQ,MACN,GAAG,KAAK,+SAIV;CACF,GAAG,CAAC,aAAa,IAAI,CAAC;CACtB,OAAO,mBAAmB,YAAY,IAAI;AAC5C"}
1
+ {"version":3,"file":"transition-boundary.mjs","names":[],"sources":["../../src/internal/transition-boundary.tsx"],"sourcesContent":["\"use client\";\nimport { useEffect, useRef, ViewTransition } from \"react\";\nimport type { ReactNode, ViewTransitionClass } from \"react\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/**\n * Wraps a part's output in `<ViewTransition default={transition}>` **only when the consumer\n * passed `transition`** (conventions 5.1). With `transition === undefined` the node is returned\n * unwrapped and the part renders no boundary at all.\n *\n * Reason (docs/research/view-transition-mount-cost.md): react-dom 19.3 starts a\n * document view transition whenever a `<ViewTransition>` mounts or is revealed by `<Activity>` in\n * a transition-lane commit, whatever its class resolves to (`\"none\"` included). The browser's\n * 250 ms root cross-fade then runs and every later transition commit waits for it. Exits and\n * updates of a `\"none\"` boundary are free, so an explicit `transition=\"none\"` keeps the boundary\n * and lets a consumer switch between `\"none\"` and a class without remounting.\n *\n * The boundary stays the outermost node of the part's output, so a part that is the top of an\n * inserted subtree gets enter / exit. A plain function (not a component), so it adds no fiber\n * between the boundary and the element.\n */\nexport function transitionBoundary(\n transition: ViewTransitionClass | undefined,\n node: ReactNode,\n): ReactNode {\n if (transition === undefined) return node;\n return <ViewTransition default={transition}>{node}</ViewTransition>;\n}\n\n/**\n * {@link transitionBoundary} plus the development warning for a non-static `transition`\n * (conventions 5.1): changing it between `undefined` and a value changes the element type at the\n * part's root, so React remounts the part's subtree (DOM and state lost). Warns once per\n * instance, from an effect. `part` is the public name used in the message (`\"Tabs.Panel\"`).\n *\n * Pass the *effective* value: a part that ignores `transition` in some mode (Accordion, Dialog\n * JS-free mode) passes `undefined` there.\n */\nexport function useTransitionBoundary(\n part: string,\n transition: ViewTransitionClass | undefined,\n node: ReactNode,\n): ReactNode {\n const hasBoundary = transition !== undefined;\n const initial = useRef(hasBoundary);\n const warned = useRef(false);\n useEffect(() => {\n if (!isDev || warned.current || hasBoundary === initial.current) return;\n warned.current = true;\n console.error(\n `${part}: \\`transition\\` changed between undefined and a value after mount. The part ` +\n \"renders a <ViewTransition> only when `transition` is given, so this remounts its \" +\n 'subtree (DOM and state are lost). Keep `transition` static; use `transition=\"none\"` ' +\n \"to switch animation off without removing the boundary.\",\n );\n }, [hasBoundary, part]);\n return transitionBoundary(transition, node);\n}\n"],"mappings":";;;;AAIA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;;;;;;;;;;;;AAkBvC,SAAgB,mBACd,YACA,MACW;CACX,IAAI,eAAe,KAAA,GAAW,OAAO;CACrC,OAAO,oBAAC,gBAAD;EAAgB,SAAS;EAAa,UAAA;CAAqB,CAAA;AACpE;;;;;;;;;;AAWA,SAAgB,sBACd,MACA,YACA,MACW;CACX,MAAM,cAAc,eAAe,KAAA;CACnC,MAAM,UAAU,OAAO,WAAW;CAClC,MAAM,SAAS,OAAO,KAAK;CAC3B,gBAAgB;EACd,IAAI,CAAC,SAAS,OAAO,WAAW,gBAAgB,QAAQ,SAAS;EACjE,OAAO,UAAU;EACjB,QAAQ,MACN,GAAG,KAAK,+SAIV;CACF,GAAG,CAAC,aAAa,IAAI,CAAC;CACtB,OAAO,mBAAmB,YAAY,IAAI;AAC5C"}
@@ -1,5 +1,7 @@
1
1
  import { ReactElement, ReactNode } from "react";
2
2
  //#region src/internal/types.d.ts
3
+ /** The arrow-key axis of a composite widget (Toolbar, Tabs, ToggleGroup, Slider). */
4
+ export type Orientation = "horizontal" | "vertical";
3
5
  /**
4
6
  * A callback the library runs inside a Transition. May be sync or async: the library awaits
5
7
  * whatever it returns (a thenable is awaited, anything else is ignored). The return type is
@@ -14,13 +16,13 @@ export interface ActionDetails {
14
16
  /** An action called with the next value of a controllable state. */
15
17
  export type ChangeAction<T, Details extends ActionDetails = ActionDetails> = Action<[next: T, details: Details]>;
16
18
  /**
17
- * A change action the library calls **synchronously, outside any Transition, and does not
18
- * await**: the urgent lane (conventions 2.6; first used by Combobox's `inputValueChangeAction`).
19
- * The body runs during the DOM event, so `(next) => setText(next)` is an urgent update, which is
20
- * what a controlled text input needs. Nothing is pending or optimistic for it; a returned promise
21
- * is ignored (development warns once).
19
+ * A change **handler** the library calls synchronously, outside any Transition, and does not
20
+ * await: the urgent lane (conventions 2.6; first used by Combobox's `onInputValueChange`). Not an
21
+ * action: nothing is pending or optimistic for it. The body runs during the DOM event, so
22
+ * `(next) => setText(next)` is an urgent update, which is what a controlled text input needs; a
23
+ * returned promise is ignored (development warns once).
22
24
  */
23
- export type UrgentChangeAction<T, Details extends ActionDetails = ActionDetails> = (next: T, details: Details) => void;
25
+ export type UrgentChangeHandler<T, Details extends ActionDetails = ActionDetails> = (next: T, details: Details) => void;
24
26
  /**
25
27
  * Why a change action was dispatched (conventions 2.2). One library-wide vocabulary: every
26
28
  * `<Component><State>ChangeDetails` that exposes `reason` declares it with this type.