@funstack/ui 0.1.0-alpha.11 → 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 (401) 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.map +1 -1
  61. package/dist/combobox/combobox-root.mjs +30 -102
  62. package/dist/combobox/combobox-root.mjs.map +1 -1
  63. package/dist/combobox/combobox-trigger.d.mts.map +1 -1
  64. package/dist/combobox/combobox-trigger.mjs +6 -25
  65. package/dist/combobox/combobox-trigger.mjs.map +1 -1
  66. package/dist/combobox/index.mjs +1 -1
  67. package/dist/combobox/use-combobox-form.mjs +56 -0
  68. package/dist/combobox/use-combobox-form.mjs.map +1 -0
  69. package/dist/combobox/use-option-registry.mjs +62 -0
  70. package/dist/combobox/use-option-registry.mjs.map +1 -0
  71. package/dist/dialog/dialog-close.d.mts.map +1 -1
  72. package/dist/dialog/dialog-close.mjs +29 -62
  73. package/dist/dialog/dialog-close.mjs.map +1 -1
  74. package/dist/dialog/dialog-context.mjs.map +1 -1
  75. package/dist/dialog/dialog-form.d.mts.map +1 -1
  76. package/dist/dialog/dialog-form.mjs +5 -4
  77. package/dist/dialog/dialog-form.mjs.map +1 -1
  78. package/dist/dialog/dialog-popup.d.mts +3 -4
  79. package/dist/dialog/dialog-popup.d.mts.map +1 -1
  80. package/dist/dialog/dialog-popup.mjs +37 -98
  81. package/dist/dialog/dialog-popup.mjs.map +1 -1
  82. package/dist/dialog/dialog-root.d.mts.map +1 -1
  83. package/dist/dialog/dialog-root.mjs +30 -118
  84. package/dist/dialog/dialog-root.mjs.map +1 -1
  85. package/dist/dialog/dialog-trigger.d.mts.map +1 -1
  86. package/dist/dialog/dialog-trigger.mjs +13 -16
  87. package/dist/dialog/dialog-trigger.mjs.map +1 -1
  88. package/dist/field/field-control.mjs +6 -13
  89. package/dist/field/field-control.mjs.map +1 -1
  90. package/dist/field/field-description.d.mts.map +1 -1
  91. package/dist/field/field-description.mjs +1 -2
  92. package/dist/field/field-description.mjs.map +1 -1
  93. package/dist/field/field-error.d.mts.map +1 -1
  94. package/dist/field/field-error.mjs +1 -2
  95. package/dist/field/field-error.mjs.map +1 -1
  96. package/dist/field/field-label.d.mts.map +1 -1
  97. package/dist/field/field-label.mjs +3 -11
  98. package/dist/field/field-label.mjs.map +1 -1
  99. package/dist/field/field-root.mjs +21 -41
  100. package/dist/field/field-root.mjs.map +1 -1
  101. package/dist/field/index.mjs +1 -1
  102. package/dist/field/use-server-error-visibility.mjs +44 -0
  103. package/dist/field/use-server-error-visibility.mjs.map +1 -0
  104. package/dist/form/form-root.d.mts.map +1 -1
  105. package/dist/form/form-root.mjs +6 -7
  106. package/dist/form/form-root.mjs.map +1 -1
  107. package/dist/form/form-submit.d.mts +1 -1
  108. package/dist/form/form-submit.mjs +4 -10
  109. package/dist/form/form-submit.mjs.map +1 -1
  110. package/dist/index.d.mts +2 -2
  111. package/dist/internal/anchor-position.mjs +1 -59
  112. package/dist/internal/anchor-position.mjs.map +1 -1
  113. package/dist/internal/announce.mjs.map +1 -1
  114. package/dist/internal/arrow-keys.mjs +21 -0
  115. package/dist/internal/arrow-keys.mjs.map +1 -0
  116. package/dist/internal/decimal.mjs +7 -1
  117. package/dist/internal/decimal.mjs.map +1 -1
  118. package/dist/internal/dom-order.mjs +17 -0
  119. package/dist/internal/dom-order.mjs.map +1 -0
  120. package/dist/internal/field-context.d.mts.map +1 -1
  121. package/dist/internal/field-context.mjs +11 -1
  122. package/dist/internal/field-context.mjs.map +1 -1
  123. package/dist/internal/focus-first-invalid.mjs +1 -1
  124. package/dist/internal/focus-first-invalid.mjs.map +1 -1
  125. package/dist/internal/group-member.mjs +37 -0
  126. package/dist/internal/group-member.mjs.map +1 -0
  127. package/dist/internal/overlay-popup.mjs +103 -0
  128. package/dist/internal/overlay-popup.mjs.map +1 -0
  129. package/dist/internal/popover-open.mjs +18 -0
  130. package/dist/internal/popover-open.mjs.map +1 -0
  131. package/dist/internal/render-element.d.mts +2 -0
  132. package/dist/internal/render-element.mjs +20 -2
  133. package/dist/internal/render-element.mjs.map +1 -1
  134. package/dist/internal/shipped-styles.mjs +14 -0
  135. package/dist/internal/shipped-styles.mjs.map +1 -0
  136. package/dist/internal/sync-presence.mjs +5 -1
  137. package/dist/internal/sync-presence.mjs.map +1 -1
  138. package/dist/internal/toolbar-context.mjs.map +1 -1
  139. package/dist/internal/tooltip-warm.mjs +1 -1
  140. package/dist/internal/tooltip-warm.mjs.map +1 -1
  141. package/dist/internal/transition-boundary.mjs +1 -1
  142. package/dist/internal/transition-boundary.mjs.map +1 -1
  143. package/dist/internal/types.d.mts +2 -0
  144. package/dist/internal/types.d.mts.map +1 -1
  145. package/dist/internal/use-action-trigger.mjs +5 -23
  146. package/dist/internal/use-action-trigger.mjs.map +1 -1
  147. package/dist/internal/use-checkable-input.mjs +79 -0
  148. package/dist/internal/use-checkable-input.mjs.map +1 -0
  149. package/dist/internal/use-controllable-action.mjs +16 -24
  150. package/dist/internal/use-controllable-action.mjs.map +1 -1
  151. package/dist/internal/use-dev-warning.mjs +8 -4
  152. package/dist/internal/use-dev-warning.mjs.map +1 -1
  153. package/dist/internal/use-element-check.mjs +39 -0
  154. package/dist/internal/use-element-check.mjs.map +1 -0
  155. package/dist/internal/use-exit-animation.mjs +1 -1
  156. package/dist/internal/use-exit-animation.mjs.map +1 -1
  157. package/dist/internal/use-field-control.mjs +28 -12
  158. package/dist/internal/use-field-control.mjs.map +1 -1
  159. package/dist/internal/use-fieldset-group.mjs +46 -0
  160. package/dist/internal/use-fieldset-group.mjs.map +1 -0
  161. package/dist/internal/use-form-reset.mjs +1 -5
  162. package/dist/internal/use-form-reset.mjs.map +1 -1
  163. package/dist/internal/use-item-order.mjs +42 -0
  164. package/dist/internal/use-item-order.mjs.map +1 -0
  165. package/dist/internal/use-latest.mjs +4 -8
  166. package/dist/internal/use-latest.mjs.map +1 -1
  167. package/dist/internal/use-merged-refs.mjs +19 -0
  168. package/dist/internal/use-merged-refs.mjs.map +1 -0
  169. package/dist/internal/use-name-warning.mjs +84 -0
  170. package/dist/internal/use-name-warning.mjs.map +1 -0
  171. package/dist/internal/use-native-checked.mjs +4 -6
  172. package/dist/internal/use-native-checked.mjs.map +1 -1
  173. package/dist/internal/use-native-focusgroup.mjs +19 -0
  174. package/dist/internal/use-native-focusgroup.mjs.map +1 -0
  175. package/dist/internal/use-native-group-reconciliation.mjs.map +1 -1
  176. package/dist/internal/use-overlay-close.mjs +63 -0
  177. package/dist/internal/use-overlay-close.mjs.map +1 -0
  178. package/dist/internal/{use-popover-root.mjs → use-overlay-root.mjs} +28 -39
  179. package/dist/internal/use-overlay-root.mjs.map +1 -0
  180. package/dist/internal/use-popover-popup.mjs +32 -78
  181. package/dist/internal/use-popover-popup.mjs.map +1 -1
  182. package/dist/internal/use-popover-trigger.d.mts +15 -0
  183. package/dist/internal/use-popover-trigger.d.mts.map +1 -0
  184. package/dist/internal/use-popover-trigger.mjs +13 -17
  185. package/dist/internal/use-popover-trigger.mjs.map +1 -1
  186. package/dist/internal/use-register-count.mjs +24 -0
  187. package/dist/internal/use-register-count.mjs.map +1 -0
  188. package/dist/internal/use-render.d.mts +2 -0
  189. package/dist/internal/use-render.mjs +2 -2
  190. package/dist/internal/use-render.mjs.map +1 -1
  191. package/dist/internal/use-resolved-placement.mjs +38 -22
  192. package/dist/internal/use-resolved-placement.mjs.map +1 -1
  193. package/dist/internal/use-roving-focus.mjs +5 -18
  194. package/dist/internal/use-roving-focus.mjs.map +1 -1
  195. package/dist/internal/use-superseded-rejection.mjs +47 -0
  196. package/dist/internal/use-superseded-rejection.mjs.map +1 -0
  197. package/dist/internal/validity.mjs +1 -13
  198. package/dist/internal/validity.mjs.map +1 -1
  199. package/dist/internal/value-set.mjs +41 -0
  200. package/dist/internal/value-set.mjs.map +1 -0
  201. package/dist/menu/index.d.mts +1 -1
  202. package/dist/menu/menu-checkbox-item.mjs.map +1 -1
  203. package/dist/menu/menu-context-trigger.d.mts +2 -7
  204. package/dist/menu/menu-context-trigger.d.mts.map +1 -1
  205. package/dist/menu/menu-context-trigger.mjs +10 -187
  206. package/dist/menu/menu-context-trigger.mjs.map +1 -1
  207. package/dist/menu/menu-context.d.mts +1 -1
  208. package/dist/menu/menu-context.mjs +1 -1
  209. package/dist/menu/menu-context.mjs.map +1 -1
  210. package/dist/menu/menu-dom.mjs +1 -2
  211. package/dist/menu/menu-dom.mjs.map +1 -1
  212. package/dist/menu/menu-gestures.mjs +167 -0
  213. package/dist/menu/menu-gestures.mjs.map +1 -0
  214. package/dist/menu/menu-group.d.mts.map +1 -1
  215. package/dist/menu/menu-group.mjs +2 -1
  216. package/dist/menu/menu-group.mjs.map +1 -1
  217. package/dist/menu/menu-hover.mjs +0 -1
  218. package/dist/menu/menu-hover.mjs.map +1 -1
  219. package/dist/menu/menu-item.mjs.map +1 -1
  220. package/dist/menu/menu-outside.mjs +101 -0
  221. package/dist/menu/menu-outside.mjs.map +1 -0
  222. package/dist/menu/menu-point.mjs +85 -0
  223. package/dist/menu/menu-point.mjs.map +1 -0
  224. package/dist/menu/menu-popup.d.mts +6 -7
  225. package/dist/menu/menu-popup.d.mts.map +1 -1
  226. package/dist/menu/menu-popup.mjs +37 -248
  227. package/dist/menu/menu-popup.mjs.map +1 -1
  228. package/dist/menu/menu-radio-group.mjs.map +1 -1
  229. package/dist/menu/menu-root.d.mts +10 -0
  230. package/dist/menu/menu-root.d.mts.map +1 -1
  231. package/dist/menu/menu-root.mjs +10 -8
  232. package/dist/menu/menu-root.mjs.map +1 -1
  233. package/dist/menu/menu-submenu-trigger.d.mts.map +1 -1
  234. package/dist/menu/menu-submenu-trigger.mjs +6 -6
  235. package/dist/menu/menu-submenu-trigger.mjs.map +1 -1
  236. package/dist/menu/menu-trigger.d.mts +4 -9
  237. package/dist/menu/menu-trigger.d.mts.map +1 -1
  238. package/dist/menu/menu-trigger.mjs +8 -6
  239. package/dist/menu/menu-trigger.mjs.map +1 -1
  240. package/dist/menu/use-menu-item.mjs +14 -16
  241. package/dist/menu/use-menu-item.mjs.map +1 -1
  242. package/dist/menu/use-menu-keyboard.mjs +88 -0
  243. package/dist/menu/use-menu-keyboard.mjs.map +1 -0
  244. package/dist/meter/meter-root.mjs +1 -1
  245. package/dist/number-field/index.d.mts +2 -1
  246. package/dist/number-field/index.d.mts.map +1 -1
  247. package/dist/number-field/index.mjs +2 -2
  248. package/dist/number-field/index.mjs.map +1 -1
  249. package/dist/number-field/number-field-arithmetic.mjs +30 -11
  250. package/dist/number-field/number-field-arithmetic.mjs.map +1 -1
  251. package/dist/number-field/number-field-context.d.mts +6 -1
  252. package/dist/number-field/number-field-context.d.mts.map +1 -0
  253. package/dist/number-field/number-field-context.mjs.map +1 -1
  254. package/dist/number-field/number-field-decrement.d.mts +1 -1
  255. package/dist/number-field/number-field-decrement.mjs +1 -1
  256. package/dist/number-field/number-field-decrement.mjs.map +1 -1
  257. package/dist/number-field/number-field-increment.d.mts +2 -22
  258. package/dist/number-field/number-field-increment.d.mts.map +1 -1
  259. package/dist/number-field/number-field-increment.mjs +2 -53
  260. package/dist/number-field/number-field-increment.mjs.map +1 -1
  261. package/dist/number-field/number-field-input.d.mts.map +1 -1
  262. package/dist/number-field/number-field-input.mjs +18 -22
  263. package/dist/number-field/number-field-input.mjs.map +1 -1
  264. package/dist/number-field/number-field-label.d.mts.map +1 -1
  265. package/dist/number-field/number-field-label.mjs +3 -9
  266. package/dist/number-field/number-field-label.mjs.map +1 -1
  267. package/dist/number-field/number-field-root.d.mts +2 -1
  268. package/dist/number-field/number-field-root.d.mts.map +1 -1
  269. package/dist/number-field/number-field-root.mjs +81 -91
  270. package/dist/number-field/number-field-root.mjs.map +1 -1
  271. package/dist/number-field/use-number-field-dev-warnings.mjs +28 -0
  272. package/dist/number-field/use-number-field-dev-warnings.mjs.map +1 -0
  273. package/dist/number-field/use-step-button.d.mts +24 -0
  274. package/dist/number-field/use-step-button.d.mts.map +1 -0
  275. package/dist/number-field/use-step-button.mjs +57 -3
  276. package/dist/number-field/use-step-button.mjs.map +1 -1
  277. package/dist/popover/popover-close.d.mts.map +1 -1
  278. package/dist/popover/popover-close.mjs +28 -67
  279. package/dist/popover/popover-close.mjs.map +1 -1
  280. package/dist/popover/popover-context.mjs.map +1 -1
  281. package/dist/popover/popover-popup.d.mts +9 -6
  282. package/dist/popover/popover-popup.d.mts.map +1 -1
  283. package/dist/popover/popover-popup.mjs +13 -36
  284. package/dist/popover/popover-popup.mjs.map +1 -1
  285. package/dist/popover/popover-root.mjs +4 -3
  286. package/dist/popover/popover-root.mjs.map +1 -1
  287. package/dist/popover/popover-trigger.d.mts +4 -8
  288. package/dist/popover/popover-trigger.d.mts.map +1 -1
  289. package/dist/popover/popover-trigger.mjs +2 -1
  290. package/dist/popover/popover-trigger.mjs.map +1 -1
  291. package/dist/progress/progress-root.mjs +1 -1
  292. package/dist/radio-group/radio-group-context.mjs.map +1 -1
  293. package/dist/radio-group/radio-group-item.d.mts +3 -4
  294. package/dist/radio-group/radio-group-item.d.mts.map +1 -1
  295. package/dist/radio-group/radio-group-item.mjs +20 -25
  296. package/dist/radio-group/radio-group-item.mjs.map +1 -1
  297. package/dist/radio-group/radio-group-label.mjs +1 -6
  298. package/dist/radio-group/radio-group-label.mjs.map +1 -1
  299. package/dist/radio-group/radio-group-root.d.mts +1 -1
  300. package/dist/radio-group/radio-group-root.d.mts.map +1 -1
  301. package/dist/radio-group/radio-group-root.mjs +21 -40
  302. package/dist/radio-group/radio-group-root.mjs.map +1 -1
  303. package/dist/select/select-dom.mjs +9 -18
  304. package/dist/select/select-dom.mjs.map +1 -1
  305. package/dist/select/select-option.mjs +1 -1
  306. package/dist/select/select-root.mjs +3 -2
  307. package/dist/select/select-root.mjs.map +1 -1
  308. package/dist/slider/slider-arithmetic.mjs +74 -13
  309. package/dist/slider/slider-arithmetic.mjs.map +1 -1
  310. package/dist/slider/slider-context.mjs.map +1 -1
  311. package/dist/slider/slider-label.d.mts.map +1 -1
  312. package/dist/slider/slider-label.mjs +3 -9
  313. package/dist/slider/slider-label.mjs.map +1 -1
  314. package/dist/slider/slider-root.d.mts +2 -2
  315. package/dist/slider/slider-root.d.mts.map +1 -1
  316. package/dist/slider/slider-root.mjs +36 -116
  317. package/dist/slider/slider-root.mjs.map +1 -1
  318. package/dist/slider/slider-thumb.d.mts.map +1 -1
  319. package/dist/slider/slider-thumb.mjs +8 -6
  320. package/dist/slider/slider-thumb.mjs.map +1 -1
  321. package/dist/slider/slider-value.d.mts.map +1 -1
  322. package/dist/slider/slider-value.mjs +2 -1
  323. package/dist/slider/slider-value.mjs.map +1 -1
  324. package/dist/slider/use-slider-dev-warnings.mjs +29 -0
  325. package/dist/slider/use-slider-dev-warnings.mjs.map +1 -0
  326. package/dist/slider/use-thumb-registry.mjs +51 -0
  327. package/dist/slider/use-thumb-registry.mjs.map +1 -0
  328. package/dist/switch/switch.d.mts +4 -5
  329. package/dist/switch/switch.d.mts.map +1 -1
  330. package/dist/switch/switch.mjs +15 -55
  331. package/dist/switch/switch.mjs.map +1 -1
  332. package/dist/tabs/tabs-context.d.mts +2 -3
  333. package/dist/tabs/tabs-context.d.mts.map +1 -1
  334. package/dist/tabs/tabs-context.mjs.map +1 -1
  335. package/dist/tabs/tabs-list.d.mts.map +1 -1
  336. package/dist/tabs/tabs-list.mjs +9 -22
  337. package/dist/tabs/tabs-list.mjs.map +1 -1
  338. package/dist/tabs/tabs-panel.d.mts +3 -4
  339. package/dist/tabs/tabs-panel.d.mts.map +1 -1
  340. package/dist/tabs/tabs-panel.mjs.map +1 -1
  341. package/dist/tabs/tabs-root.d.mts +4 -3
  342. package/dist/tabs/tabs-root.d.mts.map +1 -1
  343. package/dist/tabs/tabs-root.mjs +2 -1
  344. package/dist/tabs/tabs-root.mjs.map +1 -1
  345. package/dist/tabs/tabs-tab.d.mts +3 -4
  346. package/dist/tabs/tabs-tab.d.mts.map +1 -1
  347. package/dist/tabs/tabs-tab.mjs.map +1 -1
  348. package/dist/toast/toast-action.mjs.map +1 -1
  349. package/dist/toast/toast-close.d.mts.map +1 -1
  350. package/dist/toast/toast-close.mjs +2 -8
  351. package/dist/toast/toast-close.mjs.map +1 -1
  352. package/dist/toast/toast-context.mjs.map +1 -1
  353. package/dist/toast/toast-hotkey.mjs +27 -0
  354. package/dist/toast/toast-hotkey.mjs.map +1 -0
  355. package/dist/toast/toast-queue.mjs +137 -0
  356. package/dist/toast/toast-queue.mjs.map +1 -0
  357. package/dist/toast/toast-timers.mjs +65 -0
  358. package/dist/toast/toast-timers.mjs.map +1 -0
  359. package/dist/toast/toast-viewport.d.mts.map +1 -1
  360. package/dist/toast/toast-viewport.mjs +30 -235
  361. package/dist/toast/toast-viewport.mjs.map +1 -1
  362. package/dist/toast/toast.mjs +1 -1
  363. package/dist/toast/toast.mjs.map +1 -1
  364. package/dist/toast/use-modal-portal-host.mjs +52 -0
  365. package/dist/toast/use-modal-portal-host.mjs.map +1 -0
  366. package/dist/toggle/toggle.d.mts +3 -4
  367. package/dist/toggle/toggle.d.mts.map +1 -1
  368. package/dist/toggle/toggle.mjs +7 -10
  369. package/dist/toggle/toggle.mjs.map +1 -1
  370. package/dist/toggle-group/toggle-group-context.d.mts +2 -1
  371. package/dist/toggle-group/toggle-group-context.d.mts.map +1 -1
  372. package/dist/toggle-group/toggle-group-context.mjs.map +1 -1
  373. package/dist/toggle-group/toggle-group-item.d.mts +5 -3
  374. package/dist/toggle-group/toggle-group-item.d.mts.map +1 -1
  375. package/dist/toggle-group/toggle-group-item.mjs +5 -7
  376. package/dist/toggle-group/toggle-group-item.mjs.map +1 -1
  377. package/dist/toggle-group/toggle-group-root.d.mts.map +1 -1
  378. package/dist/toggle-group/toggle-group-root.mjs +29 -64
  379. package/dist/toggle-group/toggle-group-root.mjs.map +1 -1
  380. package/dist/toolbar/toolbar-root.d.mts +2 -2
  381. package/dist/toolbar/toolbar-root.d.mts.map +1 -1
  382. package/dist/toolbar/toolbar-root.mjs +3 -4
  383. package/dist/toolbar/toolbar-root.mjs.map +1 -1
  384. package/dist/tooltip/tooltip-context.d.mts +1 -1
  385. package/dist/tooltip/tooltip-context.mjs.map +1 -1
  386. package/dist/tooltip/tooltip-popup.d.mts.map +1 -1
  387. package/dist/tooltip/tooltip-popup.mjs +6 -15
  388. package/dist/tooltip/tooltip-popup.mjs.map +1 -1
  389. package/dist/tooltip/tooltip-root.mjs +2 -2
  390. package/dist/tooltip/tooltip-root.mjs.map +1 -1
  391. package/dist/tooltip/tooltip-trigger.d.mts +2 -1
  392. package/dist/tooltip/tooltip-trigger.d.mts.map +1 -1
  393. package/dist/tooltip/tooltip-trigger.mjs +3 -2
  394. package/dist/tooltip/tooltip-trigger.mjs.map +1 -1
  395. package/dist/tooltip/use-tooltip-interaction.mjs +4 -3
  396. package/dist/tooltip/use-tooltip-interaction.mjs.map +1 -1
  397. package/package.json +3 -2
  398. package/dist/accordion/accordion-context.d.mts +0 -5
  399. package/dist/accordion/accordion-context.d.mts.map +0 -1
  400. package/dist/internal/use-popover-root.mjs.map +0 -1
  401. /package/dist/internal/{use-popover-root.d.mts → use-overlay-root.d.mts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"field-control.mjs","names":[],"sources":["../../src/field/field-control.tsx"],"sourcesContent":["\"use client\";\nimport { useCallback, useRef } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties } from \"react\";\nimport { useFieldContext } from \"../internal/field-context.js\";\nimport type { FieldState } from \"../internal/field-context.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useFieldControl, useMergedRef } from \"../internal/use-field-control.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { fieldDataAttributes } from \"./field-root.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\nexport interface FieldControlProps extends Omit<\n ComponentPropsWithRef<\"input\">,\n \"id\" | \"aria-invalid\" | \"className\" | \"style\" | \"children\"\n> {\n /** Native `name`; defaults to the Field's `name`. */\n name?: string;\n /** Native `disabled`; the Field's `disabled` also disables the control. Owned. */\n disabled?: boolean;\n /** Native `required`; the Field's `required` also requires the control. Owned. */\n required?: boolean;\n className?: StateValue<string | undefined, FieldState>;\n style?: StateValue<CSSProperties | undefined, FieldState>;\n /** Must render an `<input>`, `<textarea>` or `<select>`: `render={<textarea rows={3} />}`. */\n render?: RenderProp<ComponentPropsWithRef<\"input\">, FieldState>;\n}\n\nconst CONTROL_TAGS = new Set([\"INPUT\", \"TEXTAREA\", \"SELECT\"]);\n\n/**\n * The field's native control: an `<input>` (or a `<textarea>` / `<select>` through `render`)\n * wired to the Field: `id` for the Label, `aria-describedby` (the consumer's tokens, the\n * description, the error while shown), an explicit `aria-invalid`, and `name` / `disabled` /\n * `required` from the Field unless given. Everything else passes through, including `onChange`\n * / `value` for a controlled input; the Field's listeners are native and run independently.\n *\n * Owned keys (conventions 1.2): `id`, `name`, `disabled`, `required`, `aria-invalid`,\n * `aria-describedby` (token-merged), `data-invalid`, `data-disabled`, `data-required`,\n * `data-pending`.\n */\nexport function FieldControl({\n name,\n disabled,\n required,\n className,\n style,\n render,\n ...rest\n}: FieldControlProps) {\n const ctx = useFieldContext(\"Field.Control\");\n // `id` is not in the props type (the Field owns it); a JS caller's is ignored with a warning.\n const { id: consumerId, ...props } = rest as typeof rest & { id?: string };\n const field = useFieldControl({\n labelable: true,\n name,\n disabled,\n required,\n id: consumerId,\n component: \"Field.Control\",\n });\n const warned = useRef(false);\n const checkElement = useCallback((el: HTMLElement) => {\n if (isDev && !warned.current && !CONTROL_TAGS.has(el.tagName)) {\n warned.current = true;\n console.error(\n \"Field.Control: expected to render an <input>, <textarea> or <select> but got \" +\n `<${el.tagName.toLowerCase()}>. Validation, labelling and form participation need a ` +\n \"native form control.\",\n );\n }\n // A cleanup, so the merged ref never calls this with `null`.\n return () => {};\n }, []);\n const ref = useMergedRef<HTMLElement>(checkElement, field.ref);\n\n return useRender<ComponentPropsWithRef<\"input\">, FieldState>({\n defaultElement: \"input\",\n render,\n state: ctx.state,\n className,\n style,\n children: undefined,\n props,\n libraryProps: {\n id: field.id,\n name: field.name,\n disabled: field.disabled,\n required: field.required,\n ...field.attributes,\n ...fieldDataAttributes(ctx.state),\n },\n ref,\n });\n}\n\nFieldControl.displayName = \"FieldControl\";\n"],"mappings":";;;;;;;AAUA,MAAM,QAAQ,QAAQ,IAAI,aAAa;AAkBvC,MAAM,+BAAe,IAAI,IAAI;CAAC;CAAS;CAAY;AAAQ,CAAC;;;;;;;;;;;;AAa5D,SAAgB,aAAa,EAC3B,MACA,UACA,UACA,WACA,OACA,QACA,GAAG,QACiB;CACpB,MAAM,MAAM,gBAAgB,eAAe;CAE3C,MAAM,EAAE,IAAI,YAAY,GAAG,UAAU;CACrC,MAAM,QAAQ,gBAAgB;EAC5B,WAAW;EACX;EACA;EACA;EACA,IAAI;EACJ,WAAW;CACb,CAAC;CACD,MAAM,SAAS,OAAO,KAAK;CAC3B,MAAM,eAAe,aAAa,OAAoB;EACpD,IAAI,SAAS,CAAC,OAAO,WAAW,CAAC,aAAa,IAAI,GAAG,OAAO,GAAG;GAC7D,OAAO,UAAU;GACjB,QAAQ,MACN,iFACM,GAAG,QAAQ,YAAY,EAAE,4EAEjC;EACF;EAEA,aAAa,CAAC;CAChB,GAAG,CAAC,CAAC;CACL,MAAM,MAAM,aAA0B,cAAc,MAAM,GAAG;CAE7D,OAAO,UAAsD;EAC3D,gBAAgB;EAChB;EACA,OAAO,IAAI;EACX;EACA;EACA,UAAU,KAAA;EACV;EACA,cAAc;GACZ,IAAI,MAAM;GACV,MAAM,MAAM;GACZ,UAAU,MAAM;GAChB,UAAU,MAAM;GAChB,GAAG,MAAM;GACT,GAAG,oBAAoB,IAAI,KAAK;EAClC;EACA;CACF,CAAC;AACH;AAEA,aAAa,cAAc"}
1
+ {"version":3,"file":"field-control.mjs","names":[],"sources":["../../src/field/field-control.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties } from \"react\";\nimport { fieldDataAttributes, useFieldContext } from \"../internal/field-context.js\";\nimport type { FieldState } from \"../internal/field-context.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useElementCheck } from \"../internal/use-element-check.js\";\nimport { useFieldControl } from \"../internal/use-field-control.js\";\nimport { useMergedRefs } from \"../internal/use-merged-refs.js\";\nimport { useRender } from \"../internal/use-render.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\nexport interface FieldControlProps extends Omit<\n ComponentPropsWithRef<\"input\">,\n \"id\" | \"aria-invalid\" | \"className\" | \"style\" | \"children\"\n> {\n /** Native `name`; defaults to the Field's `name`. */\n name?: string;\n /** Native `disabled`; the Field's `disabled` also disables the control. Owned. */\n disabled?: boolean;\n /** Native `required`; the Field's `required` also requires the control. Owned. */\n required?: boolean;\n className?: StateValue<string | undefined, FieldState>;\n style?: StateValue<CSSProperties | undefined, FieldState>;\n /** Must render an `<input>`, `<textarea>` or `<select>`: `render={<textarea rows={3} />}`. */\n render?: RenderProp<ComponentPropsWithRef<\"input\">, FieldState>;\n}\n\nconst CONTROL_TAGS = new Set([\"INPUT\", \"TEXTAREA\", \"SELECT\"]);\n\n/**\n * The field's native control: an `<input>` (or a `<textarea>` / `<select>` through `render`)\n * wired to the Field: `id` for the Label, `aria-describedby` (the consumer's tokens, the\n * description, the error while shown), an explicit `aria-invalid`, and `name` / `disabled` /\n * `required` from the Field unless given. Everything else passes through, including `onChange`\n * / `value` for a controlled input; the Field's listeners are native and run independently.\n *\n * Owned keys (conventions 1.2): `id`, `name`, `disabled`, `required`, `aria-invalid`,\n * `aria-describedby` (token-merged), `data-invalid`, `data-disabled`, `data-required`,\n * `data-pending`.\n */\nexport function FieldControl({\n name,\n disabled,\n required,\n className,\n style,\n render,\n ...rest\n}: FieldControlProps) {\n const ctx = useFieldContext(\"Field.Control\");\n // `id` is not in the props type (the Field owns it); a JS caller's is ignored with a warning.\n const { id: consumerId, ...props } = rest as typeof rest & { id?: string };\n const field = useFieldControl({\n labelable: true,\n name,\n disabled,\n required,\n id: consumerId,\n component: \"Field.Control\",\n });\n const checkElement = useElementCheck(\n isDev &&\n ((el) =>\n !CONTROL_TAGS.has(el.tagName)\n ? \"Field.Control: expected to render an <input>, <textarea> or <select> but got \" +\n `<${el.tagName.toLowerCase()}>. Validation, labelling and form participation need a ` +\n \"native form control.\"\n : null),\n );\n const ref = useMergedRefs<HTMLElement>(checkElement, field.ref);\n\n return useRender<ComponentPropsWithRef<\"input\">, FieldState>({\n defaultElement: \"input\",\n render,\n state: ctx.state,\n className,\n style,\n children: undefined,\n props,\n libraryProps: {\n id: field.id,\n name: field.name,\n disabled: field.disabled,\n required: field.required,\n ...field.attributes,\n ...fieldDataAttributes(ctx.state),\n },\n ref,\n });\n}\n\nFieldControl.displayName = \"FieldControl\";\n"],"mappings":";;;;;;;AAUA,MAAM,QAAQ,QAAQ,IAAI,aAAa;AAkBvC,MAAM,+BAAe,IAAI,IAAI;CAAC;CAAS;CAAY;AAAQ,CAAC;;;;;;;;;;;;AAa5D,SAAgB,aAAa,EAC3B,MACA,UACA,UACA,WACA,OACA,QACA,GAAG,QACiB;CACpB,MAAM,MAAM,gBAAgB,eAAe;CAE3C,MAAM,EAAE,IAAI,YAAY,GAAG,UAAU;CACrC,MAAM,QAAQ,gBAAgB;EAC5B,WAAW;EACX;EACA;EACA;EACA,IAAI;EACJ,WAAW;CACb,CAAC;CACD,MAAM,eAAe,gBACnB,WACI,OACA,CAAC,aAAa,IAAI,GAAG,OAAO,IACxB,iFACI,GAAG,QAAQ,YAAY,EAAE,+EAE7B,KACV;CACA,MAAM,MAAM,cAA2B,cAAc,MAAM,GAAG;CAE9D,OAAO,UAAsD;EAC3D,gBAAgB;EAChB;EACA,OAAO,IAAI;EACX;EACA;EACA,UAAU,KAAA;EACV;EACA,cAAc;GACZ,IAAI,MAAM;GACV,MAAM,MAAM;GACZ,UAAU,MAAM;GAChB,UAAU,MAAM;GAChB,GAAG,MAAM;GACT,GAAG,oBAAoB,IAAI,KAAK;EAClC;EACA;CACF,CAAC;AACH;AAEA,aAAa,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"field-description.d.mts","names":[],"sources":["../../src/field/field-description.tsx"],"mappings":";;;;iBAQiB,8BAA8B,KAC7C;EAGA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,WAAW,WAAW,WAAW;EACjC,SAAS,WAAW,4BAA4B;;;;;;;;;;wBAWlC,mBACd,WACA,OACA,UACA,WACG,QACF,wBAAqB;yBANR"}
1
+ {"version":3,"file":"field-description.d.mts","names":[],"sources":["../../src/field/field-description.tsx"],"mappings":";;;;iBAOiB,8BAA8B,KAC7C;EAGA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,WAAW,WAAW,WAAW;EACjC,SAAS,WAAW,4BAA4B;;;;;;;;;;wBAWlC,mBACd,WACA,OACA,UACA,WACG,QACF,wBAAqB;yBANR"}
@@ -1,7 +1,6 @@
1
1
  "use client";
2
2
  import { useRender } from "../internal/use-render.mjs";
3
- import { useFieldContext } from "../internal/field-context.mjs";
4
- import { fieldDataAttributes } from "./field-root.mjs";
3
+ import { fieldDataAttributes, useFieldContext } from "../internal/field-context.mjs";
5
4
  //#region src/field/field-description.tsx
6
5
  /**
7
6
  * Help text for the field: a `<p>` whose id the control always lists in `aria-describedby`
@@ -1 +1 @@
1
- {"version":3,"file":"field-description.mjs","names":[],"sources":["../../src/field/field-description.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { useFieldContext } from \"../internal/field-context.js\";\nimport type { FieldState } from \"../internal/field-context.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { fieldDataAttributes } from \"./field-root.js\";\n\nexport interface FieldDescriptionProps extends Omit<\n ComponentPropsWithRef<\"p\">,\n \"id\" | \"className\" | \"style\" | \"children\"\n> {\n className?: StateValue<string | undefined, FieldState>;\n style?: StateValue<CSSProperties | undefined, FieldState>;\n children?: StateValue<ReactNode, FieldState>;\n render?: RenderProp<ComponentPropsWithRef<\"p\">, FieldState>;\n}\n\n/**\n * Help text for the field: a `<p>` whose id the control always lists in `aria-describedby`\n * (a dangling reference when no Description is rendered is skipped by assistive technology, so\n * nothing registers and the server HTML is exact).\n *\n * Owned keys (conventions 1.2): `id`, `data-invalid`, `data-disabled`, `data-required`,\n * `data-pending`.\n */\nexport function FieldDescription({\n className,\n style,\n children,\n render,\n ...rest\n}: FieldDescriptionProps) {\n const ctx = useFieldContext(\"Field.Description\");\n return useRender<ComponentPropsWithRef<\"p\">, FieldState>({\n defaultElement: \"p\",\n render,\n state: ctx.state,\n className,\n style,\n children,\n props: rest,\n libraryProps: { id: ctx.ids.description, ...fieldDataAttributes(ctx.state) },\n });\n}\n\nFieldDescription.displayName = \"FieldDescription\";\n"],"mappings":";;;;;;;;;;;;;AA0BA,SAAgB,iBAAiB,EAC/B,WACA,OACA,UACA,QACA,GAAG,QACqB;CACxB,MAAM,MAAM,gBAAgB,mBAAmB;CAC/C,OAAO,UAAkD;EACvD,gBAAgB;EAChB;EACA,OAAO,IAAI;EACX;EACA;EACA;EACA,OAAO;EACP,cAAc;GAAE,IAAI,IAAI,IAAI;GAAa,GAAG,oBAAoB,IAAI,KAAK;EAAE;CAC7E,CAAC;AACH;AAEA,iBAAiB,cAAc"}
1
+ {"version":3,"file":"field-description.mjs","names":[],"sources":["../../src/field/field-description.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { fieldDataAttributes, useFieldContext } from \"../internal/field-context.js\";\nimport type { FieldState } from \"../internal/field-context.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useRender } from \"../internal/use-render.js\";\n\nexport interface FieldDescriptionProps extends Omit<\n ComponentPropsWithRef<\"p\">,\n \"id\" | \"className\" | \"style\" | \"children\"\n> {\n className?: StateValue<string | undefined, FieldState>;\n style?: StateValue<CSSProperties | undefined, FieldState>;\n children?: StateValue<ReactNode, FieldState>;\n render?: RenderProp<ComponentPropsWithRef<\"p\">, FieldState>;\n}\n\n/**\n * Help text for the field: a `<p>` whose id the control always lists in `aria-describedby`\n * (a dangling reference when no Description is rendered is skipped by assistive technology, so\n * nothing registers and the server HTML is exact).\n *\n * Owned keys (conventions 1.2): `id`, `data-invalid`, `data-disabled`, `data-required`,\n * `data-pending`.\n */\nexport function FieldDescription({\n className,\n style,\n children,\n render,\n ...rest\n}: FieldDescriptionProps) {\n const ctx = useFieldContext(\"Field.Description\");\n return useRender<ComponentPropsWithRef<\"p\">, FieldState>({\n defaultElement: \"p\",\n render,\n state: ctx.state,\n className,\n style,\n children,\n props: rest,\n libraryProps: { id: ctx.ids.description, ...fieldDataAttributes(ctx.state) },\n });\n}\n\nFieldDescription.displayName = \"FieldDescription\";\n"],"mappings":";;;;;;;;;;;;AAyBA,SAAgB,iBAAiB,EAC/B,WACA,OACA,UACA,QACA,GAAG,QACqB;CACxB,MAAM,MAAM,gBAAgB,mBAAmB;CAC/C,OAAO,UAAkD;EACvD,gBAAgB;EAChB;EACA,OAAO,IAAI;EACX;EACA;EACA;EACA,OAAO;EACP,cAAc;GAAE,IAAI,IAAI,IAAI;GAAa,GAAG,oBAAoB,IAAI,KAAK;EAAE;CAC7E,CAAC;AACH;AAEA,iBAAiB,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"field-error.d.mts","names":[],"sources":["../../src/field/field-error.tsx"],"mappings":";;;;iBASiB,wBAAwB,KACvC;EAGA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;;;;;;EAM9C,WAAW,WAAW,WAAW;EACjC,SAAS,WAAW,8BAA8B;;;;;;;;;;;wBAgBpC,aACd,WACA,OACA,UACA,WACG,QACF,kBAAe;yBANF"}
1
+ {"version":3,"file":"field-error.d.mts","names":[],"sources":["../../src/field/field-error.tsx"],"mappings":";;;;iBAQiB,wBAAwB,KACvC;EAGA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;;;;;;EAM9C,WAAW,WAAW,WAAW;EACjC,SAAS,WAAW,8BAA8B;;;;;;;;;;;wBAgBpC,aACd,WACA,OACA,UACA,WACG,QACF,kBAAe;yBANF"}
@@ -1,7 +1,6 @@
1
1
  "use client";
2
2
  import { useRender } from "../internal/use-render.mjs";
3
- import { useFieldContext } from "../internal/field-context.mjs";
4
- import { fieldDataAttributes } from "./field-root.mjs";
3
+ import { fieldDataAttributes, useFieldContext } from "../internal/field-context.mjs";
5
4
  import { useLayoutEffect } from "react";
6
5
  //#region src/field/field-error.tsx
7
6
  function defaultChildren(state) {
@@ -1 +1 @@
1
- {"version":3,"file":"field-error.mjs","names":[],"sources":["../../src/field/field-error.tsx"],"sourcesContent":["\"use client\";\nimport { useLayoutEffect } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { useFieldContext } from \"../internal/field-context.js\";\nimport type { FieldState } from \"../internal/field-context.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { fieldDataAttributes } from \"./field-root.js\";\n\nexport interface FieldErrorProps extends Omit<\n ComponentPropsWithRef<\"div\">,\n \"id\" | \"className\" | \"style\" | \"children\"\n> {\n className?: StateValue<string | undefined, FieldState>;\n style?: StateValue<CSSProperties | undefined, FieldState>;\n /**\n * Rendered only while `state.invalid`. Default: `state.messages` joined by a space. A function\n * gets the state: `({ validity, messages }) => validity.valueMissing ? \"Enter your email\" : messages.join(\" \")`.\n * Must not suspend (urgent render, design 2.4).\n */\n children?: StateValue<ReactNode, FieldState>;\n render?: RenderProp<ComponentPropsWithRef<\"div\">, FieldState>;\n}\n\nfunction defaultChildren(state: FieldState): ReactNode {\n return state.messages.join(\" \");\n}\n\n/**\n * The field's error message: a `div` rendered only while an error is shown, whose id the control\n * then lists in `aria-describedby`. No role and no live region: the library focuses the first\n * invalid control after a submission attempt, and focus reads the description (design 4.2).\n * Its presence lets the Field cancel the platform's validation bubble.\n *\n * Owned keys (conventions 1.2): `id`, `data-invalid`, `data-disabled`, `data-required`,\n * `data-pending`.\n */\nexport function FieldError({\n className,\n style,\n children = defaultChildren,\n render,\n ...rest\n}: FieldErrorProps) {\n const ctx = useFieldContext(\"Field.Error\");\n const { registerError } = ctx;\n useLayoutEffect(registerError, [registerError]);\n const element = useRender<ComponentPropsWithRef<\"div\">, FieldState>({\n defaultElement: \"div\",\n render,\n state: ctx.state,\n className,\n style,\n children,\n props: rest,\n libraryProps: { id: ctx.ids.error, ...fieldDataAttributes(ctx.state) },\n });\n return ctx.state.invalid ? element : null;\n}\n\nFieldError.displayName = \"FieldError\";\n"],"mappings":";;;;;;AAwBA,SAAS,gBAAgB,OAA8B;CACrD,OAAO,MAAM,SAAS,KAAK,GAAG;AAChC;;;;;;;;;;AAWA,SAAgB,WAAW,EACzB,WACA,OACA,WAAW,iBACX,QACA,GAAG,QACe;CAClB,MAAM,MAAM,gBAAgB,aAAa;CACzC,MAAM,EAAE,kBAAkB;CAC1B,gBAAgB,eAAe,CAAC,aAAa,CAAC;CAC9C,MAAM,UAAU,UAAoD;EAClE,gBAAgB;EAChB;EACA,OAAO,IAAI;EACX;EACA;EACA;EACA,OAAO;EACP,cAAc;GAAE,IAAI,IAAI,IAAI;GAAO,GAAG,oBAAoB,IAAI,KAAK;EAAE;CACvE,CAAC;CACD,OAAO,IAAI,MAAM,UAAU,UAAU;AACvC;AAEA,WAAW,cAAc"}
1
+ {"version":3,"file":"field-error.mjs","names":[],"sources":["../../src/field/field-error.tsx"],"sourcesContent":["\"use client\";\nimport { useLayoutEffect } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { fieldDataAttributes, useFieldContext } from \"../internal/field-context.js\";\nimport type { FieldState } from \"../internal/field-context.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useRender } from \"../internal/use-render.js\";\n\nexport interface FieldErrorProps extends Omit<\n ComponentPropsWithRef<\"div\">,\n \"id\" | \"className\" | \"style\" | \"children\"\n> {\n className?: StateValue<string | undefined, FieldState>;\n style?: StateValue<CSSProperties | undefined, FieldState>;\n /**\n * Rendered only while `state.invalid`. Default: `state.messages` joined by a space. A function\n * gets the state: `({ validity, messages }) => validity.valueMissing ? \"Enter your email\" : messages.join(\" \")`.\n * Must not suspend (urgent render, design 2.4).\n */\n children?: StateValue<ReactNode, FieldState>;\n render?: RenderProp<ComponentPropsWithRef<\"div\">, FieldState>;\n}\n\nfunction defaultChildren(state: FieldState): ReactNode {\n return state.messages.join(\" \");\n}\n\n/**\n * The field's error message: a `div` rendered only while an error is shown, whose id the control\n * then lists in `aria-describedby`. No role and no live region: the library focuses the first\n * invalid control after a submission attempt, and focus reads the description (design 4.2).\n * Its presence lets the Field cancel the platform's validation bubble.\n *\n * Owned keys (conventions 1.2): `id`, `data-invalid`, `data-disabled`, `data-required`,\n * `data-pending`.\n */\nexport function FieldError({\n className,\n style,\n children = defaultChildren,\n render,\n ...rest\n}: FieldErrorProps) {\n const ctx = useFieldContext(\"Field.Error\");\n const { registerError } = ctx;\n useLayoutEffect(registerError, [registerError]);\n const element = useRender<ComponentPropsWithRef<\"div\">, FieldState>({\n defaultElement: \"div\",\n render,\n state: ctx.state,\n className,\n style,\n children,\n props: rest,\n libraryProps: { id: ctx.ids.error, ...fieldDataAttributes(ctx.state) },\n });\n return ctx.state.invalid ? element : null;\n}\n\nFieldError.displayName = \"FieldError\";\n"],"mappings":";;;;;AAuBA,SAAS,gBAAgB,OAA8B;CACrD,OAAO,MAAM,SAAS,KAAK,GAAG;AAChC;;;;;;;;;;AAWA,SAAgB,WAAW,EACzB,WACA,OACA,WAAW,iBACX,QACA,GAAG,QACe;CAClB,MAAM,MAAM,gBAAgB,aAAa;CACzC,MAAM,EAAE,kBAAkB;CAC1B,gBAAgB,eAAe,CAAC,aAAa,CAAC;CAC9C,MAAM,UAAU,UAAoD;EAClE,gBAAgB;EAChB;EACA,OAAO,IAAI;EACX;EACA;EACA;EACA,OAAO;EACP,cAAc;GAAE,IAAI,IAAI,IAAI;GAAO,GAAG,oBAAoB,IAAI,KAAK;EAAE;CACvE,CAAC;CACD,OAAO,IAAI,MAAM,UAAU,UAAU;AACvC;AAEA,WAAW,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"field-label.d.mts","names":[],"sources":["../../src/field/field-label.tsx"],"mappings":";;;;iBAWiB,wBAAwB,KACvC;EAGA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,gCAAgC;;;;;;;;;;wBAWtC,aAAa,WAAW,OAAO,UAAU,WAAW,QAAQ,kBAAe;yBAA3E"}
1
+ {"version":3,"file":"field-label.d.mts","names":[],"sources":["../../src/field/field-label.tsx"],"mappings":";;;;iBAUiB,wBAAwB,KACvC;EAGA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,gCAAgC;;;;;;;;;;wBAWtC,aAAa,WAAW,OAAO,UAAU,WAAW,QAAQ,kBAAe;yBAA3E"}
@@ -1,8 +1,7 @@
1
1
  "use client";
2
2
  import { useRender } from "../internal/use-render.mjs";
3
- import { useFieldContext } from "../internal/field-context.mjs";
4
- import { fieldDataAttributes } from "./field-root.mjs";
5
- import { useCallback, useRef } from "react";
3
+ import { useElementCheck } from "../internal/use-element-check.mjs";
4
+ import { fieldDataAttributes, useFieldContext } from "../internal/field-context.mjs";
6
5
  //#region src/field/field-label.tsx
7
6
  const isDev = process.env.NODE_ENV !== "production";
8
7
  /**
@@ -15,14 +14,7 @@ const isDev = process.env.NODE_ENV !== "production";
15
14
  */
16
15
  function FieldLabel({ className, style, children, render, ...rest }) {
17
16
  const ctx = useFieldContext("Field.Label");
18
- const warned = useRef(false);
19
- const ref = useCallback((el) => {
20
- if (isDev && !warned.current && el.tagName !== "LABEL") {
21
- warned.current = true;
22
- console.error(`Field.Label: expected to render a <label> element but got <${el.tagName.toLowerCase()}>. Label activation and the control's accessible name need a real <label>.`);
23
- }
24
- return () => {};
25
- }, []);
17
+ const ref = useElementCheck(isDev && ((el) => el.tagName !== "LABEL" ? `Field.Label: expected to render a <label> element but got <${el.tagName.toLowerCase()}>. Label activation and the control's accessible name need a real <label>.` : null));
26
18
  return useRender({
27
19
  defaultElement: "label",
28
20
  render,
@@ -1 +1 @@
1
- {"version":3,"file":"field-label.mjs","names":[],"sources":["../../src/field/field-label.tsx"],"sourcesContent":["\"use client\";\nimport { useCallback, useRef } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { useFieldContext } from \"../internal/field-context.js\";\nimport type { FieldState } from \"../internal/field-context.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { fieldDataAttributes } from \"./field-root.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\nexport interface FieldLabelProps extends Omit<\n ComponentPropsWithRef<\"label\">,\n \"htmlFor\" | \"id\" | \"className\" | \"style\" | \"children\"\n> {\n className?: StateValue<string | undefined, FieldState>;\n style?: StateValue<CSSProperties | undefined, FieldState>;\n children?: StateValue<ReactNode, FieldState>;\n /** Must render a `<label>`. */\n render?: RenderProp<ComponentPropsWithRef<\"label\">, FieldState>;\n}\n\n/**\n * The field's visible name: `<label for>` pointing at the control. For a group control (a\n * RadioGroup or CheckboxGroup `<fieldset>`) it renders no `for` once the group registered, and\n * the group names itself with `aria-labelledby` → this id (design 4.2).\n *\n * Owned keys (conventions 1.2): `id`, `htmlFor`, `data-invalid`, `data-disabled`,\n * `data-required`, `data-pending`.\n */\nexport function FieldLabel({ className, style, children, render, ...rest }: FieldLabelProps) {\n const ctx = useFieldContext(\"Field.Label\");\n const warned = useRef(false);\n const ref = useCallback((el: HTMLElement) => {\n if (isDev && !warned.current && el.tagName !== \"LABEL\") {\n warned.current = true;\n console.error(\n `Field.Label: expected to render a <label> element but got <${el.tagName.toLowerCase()}>. ` +\n \"Label activation and the control's accessible name need a real <label>.\",\n );\n }\n // A cleanup, so the merged ref never calls this with `null`.\n return () => {};\n }, []);\n return useRender<ComponentPropsWithRef<\"label\">, FieldState>({\n defaultElement: \"label\",\n render,\n state: ctx.state,\n className,\n style,\n children,\n props: rest,\n libraryProps: {\n id: ctx.ids.label,\n htmlFor: ctx.labelable ? ctx.ids.control : undefined,\n ...fieldDataAttributes(ctx.state),\n },\n ref,\n });\n}\n\nFieldLabel.displayName = \"FieldLabel\";\n"],"mappings":";;;;;;AASA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;;;;AAqBvC,SAAgB,WAAW,EAAE,WAAW,OAAO,UAAU,QAAQ,GAAG,QAAyB;CAC3F,MAAM,MAAM,gBAAgB,aAAa;CACzC,MAAM,SAAS,OAAO,KAAK;CAC3B,MAAM,MAAM,aAAa,OAAoB;EAC3C,IAAI,SAAS,CAAC,OAAO,WAAW,GAAG,YAAY,SAAS;GACtD,OAAO,UAAU;GACjB,QAAQ,MACN,8DAA8D,GAAG,QAAQ,YAAY,EAAE,2EAEzF;EACF;EAEA,aAAa,CAAC;CAChB,GAAG,CAAC,CAAC;CACL,OAAO,UAAsD;EAC3D,gBAAgB;EAChB;EACA,OAAO,IAAI;EACX;EACA;EACA;EACA,OAAO;EACP,cAAc;GACZ,IAAI,IAAI,IAAI;GACZ,SAAS,IAAI,YAAY,IAAI,IAAI,UAAU,KAAA;GAC3C,GAAG,oBAAoB,IAAI,KAAK;EAClC;EACA;CACF,CAAC;AACH;AAEA,WAAW,cAAc"}
1
+ {"version":3,"file":"field-label.mjs","names":[],"sources":["../../src/field/field-label.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { fieldDataAttributes, useFieldContext } from \"../internal/field-context.js\";\nimport type { FieldState } from \"../internal/field-context.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useElementCheck } from \"../internal/use-element-check.js\";\nimport { useRender } from \"../internal/use-render.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\nexport interface FieldLabelProps extends Omit<\n ComponentPropsWithRef<\"label\">,\n \"htmlFor\" | \"id\" | \"className\" | \"style\" | \"children\"\n> {\n className?: StateValue<string | undefined, FieldState>;\n style?: StateValue<CSSProperties | undefined, FieldState>;\n children?: StateValue<ReactNode, FieldState>;\n /** Must render a `<label>`. */\n render?: RenderProp<ComponentPropsWithRef<\"label\">, FieldState>;\n}\n\n/**\n * The field's visible name: `<label for>` pointing at the control. For a group control (a\n * RadioGroup or CheckboxGroup `<fieldset>`) it renders no `for` once the group registered, and\n * the group names itself with `aria-labelledby` → this id (design 4.2).\n *\n * Owned keys (conventions 1.2): `id`, `htmlFor`, `data-invalid`, `data-disabled`,\n * `data-required`, `data-pending`.\n */\nexport function FieldLabel({ className, style, children, render, ...rest }: FieldLabelProps) {\n const ctx = useFieldContext(\"Field.Label\");\n const ref = useElementCheck(\n isDev &&\n ((el) =>\n el.tagName !== \"LABEL\"\n ? `Field.Label: expected to render a <label> element but got <${el.tagName.toLowerCase()}>. ` +\n \"Label activation and the control's accessible name need a real <label>.\"\n : null),\n );\n return useRender<ComponentPropsWithRef<\"label\">, FieldState>({\n defaultElement: \"label\",\n render,\n state: ctx.state,\n className,\n style,\n children,\n props: rest,\n libraryProps: {\n id: ctx.ids.label,\n htmlFor: ctx.labelable ? ctx.ids.control : undefined,\n ...fieldDataAttributes(ctx.state),\n },\n ref,\n });\n}\n\nFieldLabel.displayName = \"FieldLabel\";\n"],"mappings":";;;;;AAQA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;;;;AAqBvC,SAAgB,WAAW,EAAE,WAAW,OAAO,UAAU,QAAQ,GAAG,QAAyB;CAC3F,MAAM,MAAM,gBAAgB,aAAa;CACzC,MAAM,MAAM,gBACV,WACI,OACA,GAAG,YAAY,UACX,8DAA8D,GAAG,QAAQ,YAAY,EAAE,8EAEvF,KACV;CACA,OAAO,UAAsD;EAC3D,gBAAgB;EAChB;EACA,OAAO,IAAI;EACX;EACA;EACA;EACA,OAAO;EACP,cAAc;GACZ,IAAI,IAAI,IAAI;GACZ,SAAS,IAAI,YAAY,IAAI,IAAI,UAAU,KAAA;GAC3C,GAAG,oBAAoB,IAAI,KAAK;EAClC;EACA;CACF,CAAC;AACH;AAEA,WAAW,cAAc"}
@@ -1,12 +1,13 @@
1
1
  "use client";
2
- import { dataAttr } from "../internal/data-attr.mjs";
3
2
  import { useDevWarning } from "../internal/use-dev-warning.mjs";
4
3
  import { useRender } from "../internal/use-render.mjs";
5
4
  import { useLatest } from "../internal/use-latest.mjs";
6
- import { FieldContext, FormContext } from "../internal/field-context.mjs";
5
+ import { arraysEqual } from "../internal/value-set.mjs";
6
+ import { FieldContext, FormContext, fieldDataAttributes } from "../internal/field-context.mjs";
7
7
  import { useFormOwnerEvent } from "../internal/use-form-owner-event.mjs";
8
- import { VALID, arraysEqual, focusTargetOf, normaliseErrorValue, snapshotValidity, supportsUserInvalid, validityElementOf, validityEquals } from "../internal/validity.mjs";
8
+ import { VALID, focusTargetOf, normaliseErrorValue, snapshotValidity, supportsUserInvalid, validityElementOf, validityEquals } from "../internal/validity.mjs";
9
9
  import { collectInvalid } from "../internal/focus-first-invalid.mjs";
10
+ import { useServerErrorVisibility } from "./use-server-error-visibility.mjs";
10
11
  import { use, useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
11
12
  import { useFormStatus } from "react-dom";
12
13
  import { jsx } from "react/jsx-runtime";
@@ -37,8 +38,8 @@ function entryStrings(entries) {
37
38
  function FieldRoot({ name, disabled = false, required = false, validate, className, style, children, render, ...rest }) {
38
39
  const parent = use(FieldContext);
39
40
  const form = use(FormContext);
40
- useDevWarning(parent !== null, "Field.Root: nested inside another Field.Root. A control registers with the nearest Field only; give each control its own, sibling Field.");
41
- useDevWarning(validate !== void 0 && name === void 0, "Field.Root: `validate` without `name`. `validate` receives `formData.get(name)`, which is always \"\" without a name.");
41
+ useDevWarning(parent !== null, isDev && "Field.Root: nested inside another Field.Root. A control registers with the nearest Field only; give each control its own, sibling Field.");
42
+ useDevWarning(validate !== void 0 && name === void 0, isDev && "Field.Root: `validate` without `name`. `validate` receives `formData.get(name)`, which is always \"\" without a name.");
42
43
  const id = useId();
43
44
  const ids = useMemo(() => ({
44
45
  control: `${id}-control`,
@@ -78,27 +79,7 @@ function FieldRoot({ name, disabled = false, required = false, validate, classNa
78
79
  const errors = form?.errors;
79
80
  const serverMessages = useMemo(() => normaliseErrorValue(name === void 0 ? void 0 : errors?.[name]), [errors, name]);
80
81
  const serverKey = serverMessages.join("\n");
81
- /** The user edited the control since the last settled submission. */
82
- const [dismissed, setDismissed] = useState(false);
83
- /**
84
- * The errors shown now answer a value the user had already changed during their flight
85
- * (intercepted path). Fixed from one settle to the next, so a hidden stale error stays hidden
86
- * while the next submission is in flight (the `errors` prop still holds that result).
87
- */
88
- const [suppressed, setSuppressed] = useState(false);
89
- /** The user changed the value during the flight in progress: becomes `suppressed` at its settle. */
90
- const [suppressNext, setSuppressNext] = useState(false);
91
- const [previousFormPending, setPreviousFormPending] = useState(formPending);
92
- if (previousFormPending !== formPending) {
93
- setPreviousFormPending(formPending);
94
- if (formPending) setSuppressNext(false);
95
- else {
96
- setDismissed(false);
97
- setSuppressed(suppressNext);
98
- setSuppressNext(false);
99
- }
100
- }
101
- const serverShown = serverMessages.length > 0 && !dismissed && !suppressed;
82
+ const { serverShown, dismiss, setSuppressNext } = useServerErrorVisibility(formPending, serverMessages);
102
83
  const [mirror, setMirror] = useState(INITIAL_MIRROR);
103
84
  /** The last mirror written: `refresh` compares against it, so an unchanged read renders nothing. */
104
85
  const mirrorRef = useRef(INITIAL_MIRROR);
@@ -147,7 +128,7 @@ function FieldRoot({ name, disabled = false, required = false, validate, classNa
147
128
  const submitted = formPending && name !== void 0 ? form?.submittedData() ?? null : null;
148
129
  if (submitted !== null && name !== void 0) setSuppressNext(!arraysEqual(entryStrings(formData.getAll(name)), entryStrings(submitted.getAll(name))));
149
130
  return showServer ? serverMessages : messages;
150
- }, [latest]);
131
+ }, [latest, setSuppressNext]);
151
132
  useLayoutEffect(() => {
152
133
  refresh();
153
134
  }, [
@@ -165,7 +146,7 @@ function FieldRoot({ name, disabled = false, required = false, validate, classNa
165
146
  useLayoutEffect(() => {
166
147
  if (element === null) return;
167
148
  const onEdit = () => {
168
- setDismissed(true);
149
+ dismiss();
169
150
  refresh({ dismiss: true });
170
151
  };
171
152
  const onBlur = () => refresh();
@@ -191,7 +172,11 @@ function FieldRoot({ name, disabled = false, required = false, validate, classNa
191
172
  element.removeEventListener("focusout", onBlur, true);
192
173
  element.removeEventListener("invalid", onInvalid, true);
193
174
  };
194
- }, [element, refresh]);
175
+ }, [
176
+ element,
177
+ refresh,
178
+ dismiss
179
+ ]);
195
180
  const ownerRef = useMemo(() => ({
196
181
  get current() {
197
182
  return controlRef.current?.element ?? null;
@@ -238,10 +223,14 @@ function FieldRoot({ name, disabled = false, required = false, validate, classNa
238
223
  refresh
239
224
  ]);
240
225
  const notifyChange = useCallback((edit) => {
241
- if (edit) setDismissed(true);
226
+ if (edit) dismiss();
242
227
  refresh(edit ? { dismiss: true } : {});
243
228
  latest.current.form?.refreshFields(formRegistration.current);
244
- }, [refresh, latest]);
229
+ }, [
230
+ refresh,
231
+ latest,
232
+ dismiss
233
+ ]);
245
234
  useEffect(() => {
246
235
  if (!isDev || controlRef.current !== null) return;
247
236
  console.error("Field.Root: no form control registered. Render a Field.Control or a FUNSTACK form control (Checkbox, Switch, RadioGroup, CheckboxGroup, Select, Combobox, Slider, NumberField) inside it.");
@@ -304,16 +293,7 @@ function FieldRoot({ name, disabled = false, required = false, validate, classNa
304
293
  });
305
294
  }
306
295
  FieldRoot.displayName = "FieldRoot";
307
- /** The four state attributes every Field part renders (design 6.1). */
308
- function fieldDataAttributes(state) {
309
- return {
310
- "data-invalid": dataAttr(state.invalid),
311
- "data-disabled": dataAttr(state.disabled),
312
- "data-required": dataAttr(state.required),
313
- "data-pending": dataAttr(state.pending)
314
- };
315
- }
316
296
  //#endregion
317
- export { FieldRoot, fieldDataAttributes };
297
+ export { FieldRoot };
318
298
 
319
299
  //# sourceMappingURL=field-root.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"field-root.mjs","names":[],"sources":["../../src/field/field-root.tsx"],"sourcesContent":["\"use client\";\nimport {\n use,\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode, RefObject } from \"react\";\nimport { useFormStatus } from \"react-dom\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport { FieldContext, FormContext } from \"../internal/field-context.js\";\nimport type {\n FieldContextValue,\n FieldControlRegistration,\n FieldState,\n FormFieldRegistration,\n} from \"../internal/field-context.js\";\nimport { collectInvalid } from \"../internal/focus-first-invalid.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useDevWarning } from \"../internal/use-dev-warning.js\";\nimport { useFormOwnerEvent } from \"../internal/use-form-owner-event.js\";\nimport { useLatest } from \"../internal/use-latest.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport {\n arraysEqual,\n focusTargetOf,\n normaliseErrorValue,\n snapshotValidity,\n supportsUserInvalid,\n VALID,\n validityElementOf,\n validityEquals,\n} from \"../internal/validity.js\";\nimport type { FieldErrorValue, FieldValidity, ValidatableElement } from \"../internal/validity.js\";\n\nexport type { FieldState } from \"../internal/field-context.js\";\nexport type { FieldValidity } from \"../internal/validity.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/**\n * A custom constraint: receives the field's submitted value (`formData.get(name)` as a string,\n * `\"\"` when absent) and the whole form's `FormData`. Return a message (or several) for an error,\n * `null` / `undefined` / `\"\"` for none.\n */\nexport type FieldValidate = (value: string, formData: FormData) => FieldErrorValue;\n\nexport interface FieldRootProps extends Omit<\n ComponentPropsWithRef<\"div\">,\n \"className\" | \"style\" | \"children\"\n> {\n /** Form field name: the control's default `name`, the key in `Form.Root errors`, and the entry `validate` reads. */\n name?: string;\n /** Disables the control (native `disabled`) and marks every part `data-disabled`. */\n disabled?: boolean;\n /** Makes the control `required` (native) and marks every part `data-required`. */\n required?: boolean;\n /**\n * A custom constraint, written into the control with `setCustomValidity`. Sync. Receives the\n * field's submitted value (`formData.get(name)` as a string, `\"\"` when absent) and the whole\n * form's `FormData`, so a cross-field rule can read the other field. Runs at mount, on every\n * `input` / `change` in the form (and a FUNSTACK control's value change), on blur, after a\n * reset, on a submission attempt, and in every commit in which this prop changed identity, so\n * a rule that reads outside state (a list that loads, a sibling value in React state) updates\n * on render. An inline function therefore re-runs on every render of the Field; wrap it in\n * `useCallback` to re-run only when its inputs change. Return a string\n * or strings for an error, `null` / `undefined` / `\"\"` for none. Shown when the platform's\n * `:user-invalid` heuristic says so, like a native constraint. Not serialisable: a Field with\n * `validate` is rendered from a client component.\n */\n validate?: FieldValidate;\n className?: StateValue<string | undefined, FieldState>;\n style?: StateValue<CSSProperties | undefined, FieldState>;\n children?: StateValue<ReactNode, FieldState>;\n render?: RenderProp<ComponentPropsWithRef<\"div\">, FieldState>;\n}\n\n/** The urgent mirror of browser-owned validity (design 2.4). */\ninterface Mirror {\n readonly userInvalid: boolean;\n readonly validity: FieldValidity;\n readonly messages: readonly string[];\n}\n\nconst NONE: readonly string[] = Object.freeze([]);\nconst INITIAL_MIRROR: Mirror = { userInvalid: false, validity: VALID, messages: NONE };\n\nfunction mirrorEquals(a: Mirror, b: Mirror): boolean {\n return (\n a.userInvalid === b.userInvalid &&\n validityEquals(a.validity, b.validity) &&\n arraysEqual(a.messages, b.messages)\n );\n}\n\n/** `FormData` entries as comparable strings; a `File` counts as unchanged (design 3.2 item 2). */\nfunction entryStrings(entries: readonly FormDataEntryValue[]): string[] {\n return entries.map((entry) => (typeof entry === \"string\" ? entry : \"\\u0000file\"));\n}\n\ninterface RefreshOptions {\n /** The user edited the control: the server message is dropped from the slot at once. */\n readonly dismiss?: boolean;\n /** After a form reset: the user-validity flag is clear again. */\n readonly reset?: boolean;\n}\n\n/**\n * The field: a `div` that owns the ids, the urgent validity mirror, the custom-validity slot\n * (`validate` and the server error), the control registration and the native listeners\n * (design/components/field-form.md 2, 14). `data-pending` is the enclosing form's submission\n * (`useFormStatus`), the one part that folds the form channel into its own state, because a\n * Field has no action of its own.\n *\n * Owned keys (conventions 1.2): `data-invalid`, `data-disabled`, `data-required`, `data-pending`.\n */\nexport function FieldRoot({\n name,\n disabled = false,\n required = false,\n validate,\n className,\n style,\n children,\n render,\n ...rest\n}: FieldRootProps) {\n const parent = use(FieldContext);\n const form = use(FormContext);\n useDevWarning(\n parent !== null,\n \"Field.Root: nested inside another Field.Root. A control registers with the nearest Field \" +\n \"only; give each control its own, sibling Field.\",\n );\n useDevWarning(\n validate !== undefined && name === undefined,\n \"Field.Root: `validate` without `name`. `validate` receives `formData.get(name)`, which is \" +\n 'always \"\" without a name.',\n );\n\n const id = useId();\n const ids = useMemo(\n () => ({\n control: `${id}-control`,\n label: `${id}-label`,\n description: `${id}-description`,\n error: `${id}-error`,\n }),\n [id],\n );\n\n const { pending: formPending } = useFormStatus();\n\n // --- Registration -------------------------------------------------------------------------\n\n const controlRef = useRef<FieldControlRegistration | null>(null);\n const [control, setControl] = useState<FieldControlRegistration | null>(null);\n const warnedTwoControls = useRef(false);\n const registerControl = useCallback((registration: FieldControlRegistration) => {\n const current = controlRef.current;\n if (current !== null && current.element !== registration.element) {\n if (isDev && !warnedTwoControls.current) {\n warnedTwoControls.current = true;\n console.error(\n \"Field.Root: two form controls registered in one Field. The first one is the \" +\n \"Field's control; give each control its own Field.Root.\",\n );\n }\n return () => {};\n }\n controlRef.current = registration;\n setControl(registration);\n return () => {\n if (controlRef.current !== registration) return;\n controlRef.current = null;\n setControl(null);\n };\n }, []);\n\n const errorCount = useRef(0);\n const registerError = useCallback(() => {\n errorCount.current += 1;\n if (isDev && errorCount.current === 2) {\n console.error(\n \"Field.Error: two Field.Error parts in one Field.Root. Render one; its function \" +\n \"`children` receives `validity` for per-constraint wording.\",\n );\n }\n return () => {\n errorCount.current -= 1;\n };\n }, []);\n\n // --- Server errors: shown, dismissed, re-armed, suppressed (design 3.4) -------------------\n\n const errors = form?.errors;\n const serverMessages = useMemo(\n () => normaliseErrorValue(name === undefined ? undefined : errors?.[name]),\n [errors, name],\n );\n const serverKey = serverMessages.join(\"\\n\");\n /** The user edited the control since the last settled submission. */\n const [dismissed, setDismissed] = useState(false);\n /**\n * The errors shown now answer a value the user had already changed during their flight\n * (intercepted path). Fixed from one settle to the next, so a hidden stale error stays hidden\n * while the next submission is in flight (the `errors` prop still holds that result).\n */\n const [suppressed, setSuppressed] = useState(false);\n /** The user changed the value during the flight in progress: becomes `suppressed` at its settle. */\n const [suppressNext, setSuppressNext] = useState(false);\n // The settle edge of the enclosing form, seen in the render that commits the result (the\n // action's result and `useFormStatus`'s NotPending land together), so the next submission's\n // errors are shown in that same commit, before the Form's settle effect focuses them.\n const [previousFormPending, setPreviousFormPending] = useState(formPending);\n if (previousFormPending !== formPending) {\n setPreviousFormPending(formPending);\n if (formPending) {\n setSuppressNext(false);\n } else {\n setDismissed(false);\n setSuppressed(suppressNext);\n setSuppressNext(false);\n }\n }\n const serverShown = serverMessages.length > 0 && !dismissed && !suppressed;\n\n // --- The mirror -----------------------------------------------------------------------------\n\n const [mirror, setMirror] = useState<Mirror>(INITIAL_MIRROR);\n /** The last mirror written: `refresh` compares against it, so an unchanged read renders nothing. */\n const mirrorRef = useRef<Mirror>(INITIAL_MIRROR);\n /** jsdom fallback for `:user-invalid` (design 2.2): `invalid` fired, cleared by a reset. */\n const attempted = useRef(false);\n /** The element the slot was last written on (a group's first member can change). */\n const slotElement = useRef<ValidatableElement | null>(null);\n\n const latest = useLatest({ name, validate, serverMessages, serverShown, formPending, form });\n\n /** Re-reads the slot and the mirror; returns the messages the Field shows for the control. */\n const refresh = useCallback(\n (options: RefreshOptions = {}): readonly string[] => {\n const registration = controlRef.current;\n if (registration === null) return NONE;\n // The element whose validity is real (field-form.md amendment `validityElement`) and the\n // element whose `:user-invalid` the user's interaction sets; the same for every control but\n // NumberField.\n const surface = validityElementOf(registration.element);\n const el = registration.validityElement?.() ?? surface;\n if (el === null) return NONE;\n const { name, validate, serverMessages, serverShown, formPending, form } = latest.current;\n\n const owner = el.form;\n const formData = owner === null ? new FormData() : new FormData(owner);\n const entry = name === undefined ? null : formData.get(name);\n const value = typeof entry === \"string\" ? entry : \"\";\n const custom = validate === undefined ? NONE : normaliseErrorValue(validate(value, formData));\n\n // The slot (design 2.1): the server message while shown, else `validate`'s.\n const showServer = serverShown && options.dismiss !== true;\n if (slotElement.current !== null && slotElement.current !== el) {\n slotElement.current.setCustomValidity(\"\");\n }\n slotElement.current = el;\n el.setCustomValidity(showServer ? serverMessages.join(\"\\n\") : custom.join(\"\\n\"));\n // Mirror onto the surface so its `:user-invalid` read below sees the new state (the control\n // writes the same derived value after each of its own writes).\n if (\n surface !== null &&\n surface !== el &&\n surface.validationMessage !== el.validationMessage\n ) {\n surface.setCustomValidity(el.validationMessage);\n }\n\n if (options.reset === true) attempted.current = false;\n const userInvalid = supportsUserInvalid()\n ? (surface ?? el).matches(\":user-invalid\")\n : attempted.current && !el.validity.valid;\n const validity = snapshotValidity(el.validity);\n const messages = validity.valid\n ? NONE\n : validity.customError && !showServer && custom.length > 0\n ? custom\n : el.validationMessage === \"\"\n ? NONE\n : [el.validationMessage];\n const next: Mirror = { userInvalid, validity, messages };\n // Only a change schedules a render (a `focusout` with nothing new causes none).\n if (!mirrorEquals(mirrorRef.current, next)) {\n mirrorRef.current = next;\n setMirror(next);\n }\n\n // Stale-value suppression (design 3.2 item 2): while the Form's own submission is in\n // flight, an error is about the value it sent; compare with what the field holds now.\n const submitted = formPending && name !== undefined ? (form?.submittedData() ?? null) : null;\n if (submitted !== null && name !== undefined) {\n setSuppressNext(\n !arraysEqual(entryStrings(formData.getAll(name)), entryStrings(submitted.getAll(name))),\n );\n }\n return showServer ? serverMessages : messages;\n },\n [latest],\n );\n\n // The slot follows the server error and `validate` (and is written once the control is known).\n // Keyed on `validate`'s identity (design 2.1): a rule reading outside state updates in the\n // commit that changed it. An inline function re-runs on every render (documented: `useCallback`\n // avoids it); the form's own values are covered by the listeners below.\n useLayoutEffect(() => {\n refresh();\n }, [refresh, control, serverShown, serverKey, validate]);\n\n // Clear the slot when the control goes away (it may be reused outside the Field).\n useLayoutEffect(\n () => () => {\n slotElement.current?.setCustomValidity(\"\");\n slotElement.current = null;\n },\n [],\n );\n\n // The control's own events (capture, so a group's members are seen on its fieldset).\n const element = control?.element ?? null;\n useLayoutEffect(() => {\n if (element === null) return;\n const onEdit = () => {\n setDismissed(true);\n refresh({ dismiss: true });\n };\n const onBlur = () => refresh();\n const onInvalid = (event: Event) => {\n const target = event.target as ValidatableElement;\n // A submission attempt sets user validity before validating; `checkValidity()` and\n // `reportValidity()` do not (design 2.5). The fallback cannot tell them apart.\n const attempt = supportsUserInvalid() ? target.matches(\":user-invalid\") : true;\n if (!supportsUserInvalid()) attempted.current = true;\n if (attempt && errorCount.current > 0) {\n event.preventDefault();\n const messages = refresh();\n collectInvalid(focusTargetOf(element), messages.join(\" \"));\n return;\n }\n refresh();\n };\n element.addEventListener(\"input\", onEdit, true);\n element.addEventListener(\"change\", onEdit, true);\n element.addEventListener(\"focusout\", onBlur, true);\n element.addEventListener(\"invalid\", onInvalid, true);\n return () => {\n element.removeEventListener(\"input\", onEdit, true);\n element.removeEventListener(\"change\", onEdit, true);\n element.removeEventListener(\"focusout\", onBlur, true);\n element.removeEventListener(\"invalid\", onInvalid, true);\n };\n }, [element, refresh]);\n\n // The form owner's events: another field's edit re-runs `validate` (cross-field rules); a reset\n // clears the user-validity flag, re-read when the controls hold their reset values.\n const ownerRef = useMemo<RefObject<Element | null>>(\n () => ({\n get current() {\n return controlRef.current?.element ?? null;\n },\n set current(_ignored) {},\n }),\n [],\n );\n const onOwnerEdit = (event: Event) => {\n const target = event.target;\n if (target instanceof Node && controlRef.current?.element.contains(target) === true) return;\n refresh();\n };\n useFormOwnerEvent(ownerRef, \"input\", onOwnerEdit);\n useFormOwnerEvent(ownerRef, \"change\", onOwnerEdit);\n // A new submission sends the current values: nothing differs from it yet (a queued second\n // submit arrives while the status stays pending, so the pending edge alone would miss it).\n useFormOwnerEvent(ownerRef, \"submit\", () => {\n setSuppressNext(false);\n });\n useFormOwnerEvent(ownerRef, \"reset\", (event) => {\n queueMicrotask(() => {\n if (event.defaultPrevented) return;\n refresh({ reset: true });\n });\n });\n\n // Registration with the Form, for the first-error focus after a settle (design 3.5) and the\n // refresh of the other Fields on a change no DOM event carried.\n const registerField = form?.registerField;\n const formRegistration = useRef<FormFieldRegistration | null>(null);\n useLayoutEffect(() => {\n if (registerField === undefined) return;\n const registration: FormFieldRegistration = {\n getFocusTarget: () => focusTargetOf(controlRef.current?.element ?? null),\n showsServerError: () => latest.current.serverShown,\n serverMessages: () => latest.current.serverMessages,\n refresh: () => {\n refresh();\n },\n };\n formRegistration.current = registration;\n const unregister = registerField(registration);\n return () => {\n unregister();\n if (formRegistration.current === registration) formRegistration.current = null;\n };\n }, [registerField, latest, refresh]);\n\n const notifyChange = useCallback(\n (edit: boolean) => {\n if (edit) setDismissed(true);\n refresh(edit ? { dismiss: true } : {});\n latest.current.form?.refreshFields(formRegistration.current);\n },\n [refresh, latest],\n );\n\n // Development: a Field around something that is not a form control (Toggle, Menu, ...).\n useEffect(() => {\n if (!isDev || controlRef.current !== null) return;\n console.error(\n \"Field.Root: no form control registered. Render a Field.Control or a FUNSTACK form \" +\n \"control (Checkbox, Switch, RadioGroup, CheckboxGroup, Select, Combobox, Slider, \" +\n \"NumberField) inside it.\",\n );\n }, []);\n\n const invalid = mirror.userInvalid || serverShown;\n const messages = serverShown ? serverMessages : mirror.userInvalid ? mirror.messages : NONE;\n const validity = mirror.validity;\n const stateDisabled = disabled || (control?.disabled ?? false);\n const stateRequired = required || (control?.required ?? false);\n // Memoised: the context value (and so every part) changes only with the state.\n const memoState = useMemo<FieldState>(\n () => ({\n invalid,\n messages,\n validity,\n disabled: stateDisabled,\n required: stateRequired,\n pending: formPending,\n }),\n [invalid, messages, validity, stateDisabled, stateRequired, formPending],\n );\n\n const labelable = control?.labelable ?? true;\n const context = useMemo<FieldContextValue>(\n () => ({\n ids,\n name,\n disabled,\n required,\n state: memoState,\n labelable,\n registerControl,\n registerError,\n notifyChange,\n }),\n [\n ids,\n name,\n disabled,\n required,\n memoState,\n labelable,\n registerControl,\n registerError,\n notifyChange,\n ],\n );\n\n const element$ = useRender<ComponentPropsWithRef<\"div\">, FieldState>({\n defaultElement: \"div\",\n render,\n state: memoState,\n className,\n style,\n children,\n props: rest,\n libraryProps: fieldDataAttributes(memoState),\n });\n\n return <FieldContext value={context}>{element$}</FieldContext>;\n}\n\nFieldRoot.displayName = \"FieldRoot\";\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":";;;;;;;;;;;;;AA0CA,MAAM,QAAQ,QAAQ,IAAI,aAAa;AA8CvC,MAAM,OAA0B,OAAO,OAAO,CAAC,CAAC;AAChD,MAAM,iBAAyB;CAAE,aAAa;CAAO,UAAU;CAAO,UAAU;AAAK;AAErF,SAAS,aAAa,GAAW,GAAoB;CACnD,OACE,EAAE,gBAAgB,EAAE,eACpB,eAAe,EAAE,UAAU,EAAE,QAAQ,KACrC,YAAY,EAAE,UAAU,EAAE,QAAQ;AAEtC;;AAGA,SAAS,aAAa,SAAkD;CACtE,OAAO,QAAQ,KAAK,UAAW,OAAO,UAAU,WAAW,QAAQ,QAAa;AAClF;;;;;;;;;;AAkBA,SAAgB,UAAU,EACxB,MACA,WAAW,OACX,WAAW,OACX,UACA,WACA,OACA,UACA,QACA,GAAG,QACc;CACjB,MAAM,SAAS,IAAI,YAAY;CAC/B,MAAM,OAAO,IAAI,WAAW;CAC5B,cACE,WAAW,MACX,0IAEF;CACA,cACE,aAAa,KAAA,KAAa,SAAS,KAAA,GACnC,uHAEF;CAEA,MAAM,KAAK,MAAM;CACjB,MAAM,MAAM,eACH;EACL,SAAS,GAAG,GAAG;EACf,OAAO,GAAG,GAAG;EACb,aAAa,GAAG,GAAG;EACnB,OAAO,GAAG,GAAG;CACf,IACA,CAAC,EAAE,CACL;CAEA,MAAM,EAAE,SAAS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AM,OAAO;CACxC;AACF"}
1
+ {"version":3,"file":"field-root.mjs","names":[],"sources":["../../src/field/field-root.tsx"],"sourcesContent":["\"use client\";\nimport {\n use,\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode, RefObject } from \"react\";\nimport { useFormStatus } from \"react-dom\";\nimport { FieldContext, fieldDataAttributes, FormContext } from \"../internal/field-context.js\";\nimport type {\n FieldContextValue,\n FieldControlRegistration,\n FieldState,\n FormFieldRegistration,\n} from \"../internal/field-context.js\";\nimport { collectInvalid } from \"../internal/focus-first-invalid.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useDevWarning } from \"../internal/use-dev-warning.js\";\nimport { useFormOwnerEvent } from \"../internal/use-form-owner-event.js\";\nimport { useLatest } from \"../internal/use-latest.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { useServerErrorVisibility } from \"./use-server-error-visibility.js\";\nimport {\n focusTargetOf,\n normaliseErrorValue,\n snapshotValidity,\n supportsUserInvalid,\n VALID,\n validityElementOf,\n validityEquals,\n} from \"../internal/validity.js\";\nimport type { FieldErrorValue, FieldValidity, ValidatableElement } from \"../internal/validity.js\";\nimport { arraysEqual } from \"../internal/value-set.js\";\n\nexport type { FieldState } from \"../internal/field-context.js\";\nexport type { FieldValidity } from \"../internal/validity.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/**\n * A custom constraint: receives the field's submitted value (`formData.get(name)` as a string,\n * `\"\"` when absent) and the whole form's `FormData`. Return a message (or several) for an error,\n * `null` / `undefined` / `\"\"` for none.\n */\nexport type FieldValidate = (value: string, formData: FormData) => FieldErrorValue;\n\nexport interface FieldRootProps extends Omit<\n ComponentPropsWithRef<\"div\">,\n \"className\" | \"style\" | \"children\"\n> {\n /** Form field name: the control's default `name`, the key in `Form.Root errors`, and the entry `validate` reads. */\n name?: string;\n /** Disables the control (native `disabled`) and marks every part `data-disabled`. */\n disabled?: boolean;\n /** Makes the control `required` (native) and marks every part `data-required`. */\n required?: boolean;\n /**\n * A custom constraint, written into the control with `setCustomValidity`. Sync. Receives the\n * field's submitted value (`formData.get(name)` as a string, `\"\"` when absent) and the whole\n * form's `FormData`, so a cross-field rule can read the other field. Runs at mount, on every\n * `input` / `change` in the form (and a FUNSTACK control's value change), on blur, after a\n * reset, on a submission attempt, and in every commit in which this prop changed identity, so\n * a rule that reads outside state (a list that loads, a sibling value in React state) updates\n * on render. An inline function therefore re-runs on every render of the Field; wrap it in\n * `useCallback` to re-run only when its inputs change. Return a string\n * or strings for an error, `null` / `undefined` / `\"\"` for none. Shown when the platform's\n * `:user-invalid` heuristic says so, like a native constraint. Not serialisable: a Field with\n * `validate` is rendered from a client component.\n */\n validate?: FieldValidate;\n className?: StateValue<string | undefined, FieldState>;\n style?: StateValue<CSSProperties | undefined, FieldState>;\n children?: StateValue<ReactNode, FieldState>;\n render?: RenderProp<ComponentPropsWithRef<\"div\">, FieldState>;\n}\n\n/** The urgent mirror of browser-owned validity (design 2.4). */\ninterface Mirror {\n readonly userInvalid: boolean;\n readonly validity: FieldValidity;\n readonly messages: readonly string[];\n}\n\nconst NONE: readonly string[] = Object.freeze([]);\nconst INITIAL_MIRROR: Mirror = { userInvalid: false, validity: VALID, messages: NONE };\n\ninterface RefreshOptions {\n /** The user edited the control: the server message is dropped from the slot at once. */\n readonly dismiss?: boolean;\n /** After a form reset: the user-validity flag is clear again. */\n readonly reset?: boolean;\n}\n\nfunction mirrorEquals(a: Mirror, b: Mirror): boolean {\n return (\n a.userInvalid === b.userInvalid &&\n validityEquals(a.validity, b.validity) &&\n arraysEqual(a.messages, b.messages)\n );\n}\n\n/** `FormData` entries as comparable strings; a `File` counts as unchanged (design 3.2 item 2). */\nfunction entryStrings(entries: readonly FormDataEntryValue[]): string[] {\n return entries.map((entry) => (typeof entry === \"string\" ? entry : \"\\u0000file\"));\n}\n\n/**\n * The field: a `div` that owns the ids, the urgent validity mirror, the custom-validity slot\n * (`validate` and the server error), the control registration and the native listeners\n * (design/components/field-form.md 2, 14). `data-pending` is the enclosing form's submission\n * (`useFormStatus`), the one part that folds the form channel into its own state, because a\n * Field has no action of its own.\n *\n * Owned keys (conventions 1.2): `data-invalid`, `data-disabled`, `data-required`, `data-pending`.\n */\nexport function FieldRoot({\n name,\n disabled = false,\n required = false,\n validate,\n className,\n style,\n children,\n render,\n ...rest\n}: FieldRootProps) {\n const parent = use(FieldContext);\n const form = use(FormContext);\n useDevWarning(\n parent !== null,\n isDev &&\n \"Field.Root: nested inside another Field.Root. A control registers with the nearest Field \" +\n \"only; give each control its own, sibling Field.\",\n );\n useDevWarning(\n validate !== undefined && name === undefined,\n isDev &&\n \"Field.Root: `validate` without `name`. `validate` receives `formData.get(name)`, which is \" +\n 'always \"\" without a name.',\n );\n\n const id = useId();\n const ids = useMemo(\n () => ({\n control: `${id}-control`,\n label: `${id}-label`,\n description: `${id}-description`,\n error: `${id}-error`,\n }),\n [id],\n );\n\n const { pending: formPending } = useFormStatus();\n\n // --- Registration -------------------------------------------------------------------------\n\n const controlRef = useRef<FieldControlRegistration | null>(null);\n const [control, setControl] = useState<FieldControlRegistration | null>(null);\n const warnedTwoControls = useRef(false);\n const registerControl = useCallback((registration: FieldControlRegistration) => {\n const current = controlRef.current;\n if (current !== null && current.element !== registration.element) {\n if (isDev && !warnedTwoControls.current) {\n warnedTwoControls.current = true;\n console.error(\n \"Field.Root: two form controls registered in one Field. The first one is the \" +\n \"Field's control; give each control its own Field.Root.\",\n );\n }\n return () => {};\n }\n controlRef.current = registration;\n setControl(registration);\n return () => {\n if (controlRef.current !== registration) return;\n controlRef.current = null;\n setControl(null);\n };\n }, []);\n\n const errorCount = useRef(0);\n const registerError = useCallback(() => {\n errorCount.current += 1;\n if (isDev && errorCount.current === 2) {\n console.error(\n \"Field.Error: two Field.Error parts in one Field.Root. Render one; its function \" +\n \"`children` receives `validity` for per-constraint wording.\",\n );\n }\n return () => {\n errorCount.current -= 1;\n };\n }, []);\n\n // --- Server errors: shown, dismissed, re-armed, suppressed (design 3.4) -------------------\n\n const errors = form?.errors;\n const serverMessages = useMemo(\n () => normaliseErrorValue(name === undefined ? undefined : errors?.[name]),\n [errors, name],\n );\n const serverKey = serverMessages.join(\"\\n\");\n const { serverShown, dismiss, setSuppressNext } = useServerErrorVisibility(\n formPending,\n serverMessages,\n );\n\n // --- The mirror -----------------------------------------------------------------------------\n\n const [mirror, setMirror] = useState<Mirror>(INITIAL_MIRROR);\n /** The last mirror written: `refresh` compares against it, so an unchanged read renders nothing. */\n const mirrorRef = useRef<Mirror>(INITIAL_MIRROR);\n /** jsdom fallback for `:user-invalid` (design 2.2): `invalid` fired, cleared by a reset. */\n const attempted = useRef(false);\n /** The element the slot was last written on (a group's first member can change). */\n const slotElement = useRef<ValidatableElement | null>(null);\n\n const latest = useLatest({ name, validate, serverMessages, serverShown, formPending, form });\n\n /** Re-reads the slot and the mirror; returns the messages the Field shows for the control. */\n const refresh = useCallback(\n (options: RefreshOptions = {}): readonly string[] => {\n const registration = controlRef.current;\n if (registration === null) return NONE;\n // The element whose validity is real (field-form.md, `validityElement`) and the\n // element whose `:user-invalid` the user's interaction sets; the same for every control but\n // NumberField.\n const surface = validityElementOf(registration.element);\n const el = registration.validityElement?.() ?? surface;\n if (el === null) return NONE;\n const { name, validate, serverMessages, serverShown, formPending, form } = latest.current;\n\n const owner = el.form;\n const formData = owner === null ? new FormData() : new FormData(owner);\n const entry = name === undefined ? null : formData.get(name);\n const value = typeof entry === \"string\" ? entry : \"\";\n const custom = validate === undefined ? NONE : normaliseErrorValue(validate(value, formData));\n\n // The slot (design 2.1): the server message while shown, else `validate`'s.\n const showServer = serverShown && options.dismiss !== true;\n if (slotElement.current !== null && slotElement.current !== el) {\n slotElement.current.setCustomValidity(\"\");\n }\n slotElement.current = el;\n el.setCustomValidity(showServer ? serverMessages.join(\"\\n\") : custom.join(\"\\n\"));\n // Mirror onto the surface so its `:user-invalid` read below sees the new state (the control\n // writes the same derived value after each of its own writes).\n if (\n surface !== null &&\n surface !== el &&\n surface.validationMessage !== el.validationMessage\n ) {\n surface.setCustomValidity(el.validationMessage);\n }\n\n if (options.reset === true) attempted.current = false;\n const userInvalid = supportsUserInvalid()\n ? (surface ?? el).matches(\":user-invalid\")\n : attempted.current && !el.validity.valid;\n const validity = snapshotValidity(el.validity);\n const messages = validity.valid\n ? NONE\n : validity.customError && !showServer && custom.length > 0\n ? custom\n : el.validationMessage === \"\"\n ? NONE\n : [el.validationMessage];\n const next: Mirror = { userInvalid, validity, messages };\n // Only a change schedules a render (a `focusout` with nothing new causes none).\n if (!mirrorEquals(mirrorRef.current, next)) {\n mirrorRef.current = next;\n setMirror(next);\n }\n\n // Stale-value suppression (design 3.2 item 2): while the Form's own submission is in\n // flight, an error is about the value it sent; compare with what the field holds now.\n const submitted = formPending && name !== undefined ? (form?.submittedData() ?? null) : null;\n if (submitted !== null && name !== undefined) {\n setSuppressNext(\n !arraysEqual(entryStrings(formData.getAll(name)), entryStrings(submitted.getAll(name))),\n );\n }\n return showServer ? serverMessages : messages;\n },\n [latest, setSuppressNext],\n );\n\n // The slot follows the server error and `validate` (and is written once the control is known).\n // Keyed on `validate`'s identity (design 2.1): a rule reading outside state updates in the\n // commit that changed it. An inline function re-runs on every render (documented: `useCallback`\n // avoids it); the form's own values are covered by the listeners below.\n useLayoutEffect(() => {\n refresh();\n }, [refresh, control, serverShown, serverKey, validate]);\n\n // Clear the slot when the control goes away (it may be reused outside the Field).\n useLayoutEffect(\n () => () => {\n slotElement.current?.setCustomValidity(\"\");\n slotElement.current = null;\n },\n [],\n );\n\n // The control's own events (capture, so a group's members are seen on its fieldset).\n const element = control?.element ?? null;\n useLayoutEffect(() => {\n if (element === null) return;\n const onEdit = () => {\n dismiss();\n refresh({ dismiss: true });\n };\n const onBlur = () => refresh();\n const onInvalid = (event: Event) => {\n const target = event.target as ValidatableElement;\n // A submission attempt sets user validity before validating; `checkValidity()` and\n // `reportValidity()` do not (design 2.5). The fallback cannot tell them apart.\n const attempt = supportsUserInvalid() ? target.matches(\":user-invalid\") : true;\n if (!supportsUserInvalid()) attempted.current = true;\n if (attempt && errorCount.current > 0) {\n event.preventDefault();\n const messages = refresh();\n collectInvalid(focusTargetOf(element), messages.join(\" \"));\n return;\n }\n refresh();\n };\n element.addEventListener(\"input\", onEdit, true);\n element.addEventListener(\"change\", onEdit, true);\n element.addEventListener(\"focusout\", onBlur, true);\n element.addEventListener(\"invalid\", onInvalid, true);\n return () => {\n element.removeEventListener(\"input\", onEdit, true);\n element.removeEventListener(\"change\", onEdit, true);\n element.removeEventListener(\"focusout\", onBlur, true);\n element.removeEventListener(\"invalid\", onInvalid, true);\n };\n }, [element, refresh, dismiss]);\n\n // The form owner's events: another field's edit re-runs `validate` (cross-field rules); a reset\n // clears the user-validity flag, re-read when the controls hold their reset values.\n const ownerRef = useMemo<RefObject<Element | null>>(\n () => ({\n get current() {\n return controlRef.current?.element ?? null;\n },\n set current(_ignored) {},\n }),\n [],\n );\n const onOwnerEdit = (event: Event) => {\n const target = event.target;\n if (target instanceof Node && controlRef.current?.element.contains(target) === true) return;\n refresh();\n };\n useFormOwnerEvent(ownerRef, \"input\", onOwnerEdit);\n useFormOwnerEvent(ownerRef, \"change\", onOwnerEdit);\n // A new submission sends the current values: nothing differs from it yet (a queued second\n // submit arrives while the status stays pending, so the pending edge alone would miss it).\n useFormOwnerEvent(ownerRef, \"submit\", () => {\n setSuppressNext(false);\n });\n useFormOwnerEvent(ownerRef, \"reset\", (event) => {\n queueMicrotask(() => {\n if (event.defaultPrevented) return;\n refresh({ reset: true });\n });\n });\n\n // Registration with the Form, for the first-error focus after a settle (design 3.5) and the\n // refresh of the other Fields on a change no DOM event carried.\n const registerField = form?.registerField;\n const formRegistration = useRef<FormFieldRegistration | null>(null);\n useLayoutEffect(() => {\n if (registerField === undefined) return;\n const registration: FormFieldRegistration = {\n getFocusTarget: () => focusTargetOf(controlRef.current?.element ?? null),\n showsServerError: () => latest.current.serverShown,\n serverMessages: () => latest.current.serverMessages,\n refresh: () => {\n refresh();\n },\n };\n formRegistration.current = registration;\n const unregister = registerField(registration);\n return () => {\n unregister();\n if (formRegistration.current === registration) formRegistration.current = null;\n };\n }, [registerField, latest, refresh]);\n\n const notifyChange = useCallback(\n (edit: boolean) => {\n if (edit) dismiss();\n refresh(edit ? { dismiss: true } : {});\n latest.current.form?.refreshFields(formRegistration.current);\n },\n [refresh, latest, dismiss],\n );\n\n // Development: a Field around something that is not a form control (Toggle, Menu, ...).\n useEffect(() => {\n if (!isDev || controlRef.current !== null) return;\n console.error(\n \"Field.Root: no form control registered. Render a Field.Control or a FUNSTACK form \" +\n \"control (Checkbox, Switch, RadioGroup, CheckboxGroup, Select, Combobox, Slider, \" +\n \"NumberField) inside it.\",\n );\n }, []);\n\n const invalid = mirror.userInvalid || serverShown;\n const messages = serverShown ? serverMessages : mirror.userInvalid ? mirror.messages : NONE;\n const validity = mirror.validity;\n const stateDisabled = disabled || (control?.disabled ?? false);\n const stateRequired = required || (control?.required ?? false);\n // Memoised: the context value (and so every part) changes only with the state.\n const memoState = useMemo<FieldState>(\n () => ({\n invalid,\n messages,\n validity,\n disabled: stateDisabled,\n required: stateRequired,\n pending: formPending,\n }),\n [invalid, messages, validity, stateDisabled, stateRequired, formPending],\n );\n\n const labelable = control?.labelable ?? true;\n const context = useMemo<FieldContextValue>(\n () => ({\n ids,\n name,\n disabled,\n required,\n state: memoState,\n labelable,\n registerControl,\n registerError,\n notifyChange,\n }),\n [\n ids,\n name,\n disabled,\n required,\n memoState,\n labelable,\n registerControl,\n registerError,\n notifyChange,\n ],\n );\n\n const element$ = useRender<ComponentPropsWithRef<\"div\">, FieldState>({\n defaultElement: \"div\",\n render,\n state: memoState,\n className,\n style,\n children,\n props: rest,\n libraryProps: fieldDataAttributes(memoState),\n });\n\n return <FieldContext value={context}>{element$}</FieldContext>;\n}\n\nFieldRoot.displayName = \"FieldRoot\";\n"],"mappings":";;;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,aAAa;CACxC,MAAM,UAAU,eACP;EACL;EACA;EACA;EACA;EACA,OAAO;EACP;EACA;EACA;EACA;CACF,IACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CAEA,MAAM,WAAW,UAAoD;EACnE,gBAAgB;EAChB;EACA,OAAO;EACP;EACA;EACA;EACA,OAAO;EACP,cAAc,oBAAoB,SAAS;CAC7C,CAAC;CAED,OAAO,oBAAC,cAAD;EAAc,OAAO;EAAU,UAAA;CAAuB,CAAA;AAC/D;AAEA,UAAU,cAAc"}
@@ -1,8 +1,8 @@
1
- import { FieldRoot } from "./field-root.mjs";
2
1
  import { FieldControl } from "./field-control.mjs";
3
2
  import { FieldDescription } from "./field-description.mjs";
4
3
  import { FieldError } from "./field-error.mjs";
5
4
  import { FieldLabel } from "./field-label.mjs";
5
+ import { FieldRoot } from "./field-root.mjs";
6
6
  //#region src/field/index.ts
7
7
  const Field = {
8
8
  Root: FieldRoot,
@@ -0,0 +1,44 @@
1
+ "use client";
2
+ import { useCallback, useState } from "react";
3
+ //#region src/field/use-server-error-visibility.ts
4
+ /**
5
+ * When `Field.Root` shows the server error for its field (design 3.4): shown, dismissed by an
6
+ * edit, re-armed at the enclosing form's settle, and suppressed when it answers a value the user
7
+ * had already changed during the flight.
8
+ *
9
+ * The settle edge is seen in the render that commits the result (the action's result and
10
+ * `useFormStatus`'s NotPending land together), so the next submission's errors are shown in that
11
+ * same commit, before the Form's settle effect focuses them.
12
+ */
13
+ function useServerErrorVisibility(formPending, serverMessages) {
14
+ /** The user edited the control since the last settled submission. */
15
+ const [dismissed, setDismissed] = useState(false);
16
+ /**
17
+ * The errors shown now answer a value the user had already changed during their flight
18
+ * (intercepted path). Fixed from one settle to the next, so a hidden stale error stays hidden
19
+ * while the next submission is in flight (the `errors` prop still holds that result).
20
+ */
21
+ const [suppressed, setSuppressed] = useState(false);
22
+ /** The user changed the value during the flight in progress: becomes `suppressed` at its settle. */
23
+ const [suppressNext, setSuppressNext] = useState(false);
24
+ const [previousFormPending, setPreviousFormPending] = useState(formPending);
25
+ if (previousFormPending !== formPending) {
26
+ setPreviousFormPending(formPending);
27
+ if (formPending) setSuppressNext(false);
28
+ else {
29
+ setDismissed(false);
30
+ setSuppressed(suppressNext);
31
+ setSuppressNext(false);
32
+ }
33
+ }
34
+ const dismiss = useCallback(() => setDismissed(true), []);
35
+ return {
36
+ serverShown: serverMessages.length > 0 && !dismissed && !suppressed,
37
+ dismiss,
38
+ setSuppressNext
39
+ };
40
+ }
41
+ //#endregion
42
+ export { useServerErrorVisibility };
43
+
44
+ //# sourceMappingURL=use-server-error-visibility.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-server-error-visibility.mjs","names":[],"sources":["../../src/field/use-server-error-visibility.ts"],"sourcesContent":["\"use client\";\nimport { useCallback, useState } from \"react\";\n\nexport interface ServerErrorVisibility {\n /** The server's messages for this field are shown. */\n readonly serverShown: boolean;\n /** Stable. The user edited the control: hide the server error until the next settle. */\n readonly dismiss: () => void;\n /**\n * Stable. Whether the value differs from the one the submission in flight sent: if so, that\n * submission's errors stay hidden when it settles (design 3.2 item 2).\n */\n readonly setSuppressNext: (differs: boolean) => void;\n}\n\n/**\n * When `Field.Root` shows the server error for its field (design 3.4): shown, dismissed by an\n * edit, re-armed at the enclosing form's settle, and suppressed when it answers a value the user\n * had already changed during the flight.\n *\n * The settle edge is seen in the render that commits the result (the action's result and\n * `useFormStatus`'s NotPending land together), so the next submission's errors are shown in that\n * same commit, before the Form's settle effect focuses them.\n */\nexport function useServerErrorVisibility(\n formPending: boolean,\n serverMessages: readonly string[],\n): ServerErrorVisibility {\n /** The user edited the control since the last settled submission. */\n const [dismissed, setDismissed] = useState(false);\n /**\n * The errors shown now answer a value the user had already changed during their flight\n * (intercepted path). Fixed from one settle to the next, so a hidden stale error stays hidden\n * while the next submission is in flight (the `errors` prop still holds that result).\n */\n const [suppressed, setSuppressed] = useState(false);\n /** The user changed the value during the flight in progress: becomes `suppressed` at its settle. */\n const [suppressNext, setSuppressNext] = useState(false);\n const [previousFormPending, setPreviousFormPending] = useState(formPending);\n if (previousFormPending !== formPending) {\n setPreviousFormPending(formPending);\n if (formPending) {\n setSuppressNext(false);\n } else {\n setDismissed(false);\n setSuppressed(suppressNext);\n setSuppressNext(false);\n }\n }\n const dismiss = useCallback(() => setDismissed(true), []);\n return {\n serverShown: serverMessages.length > 0 && !dismissed && !suppressed,\n dismiss,\n setSuppressNext,\n };\n}\n"],"mappings":";;;;;;;;;;;;AAwBA,SAAgB,yBACd,aACA,gBACuB;;CAEvB,MAAM,CAAC,WAAW,gBAAgB,SAAS,KAAK;;;;;;CAMhD,MAAM,CAAC,YAAY,iBAAiB,SAAS,KAAK;;CAElD,MAAM,CAAC,cAAc,mBAAmB,SAAS,KAAK;CACtD,MAAM,CAAC,qBAAqB,0BAA0B,SAAS,WAAW;CAC1E,IAAI,wBAAwB,aAAa;EACvC,uBAAuB,WAAW;EAClC,IAAI,aACF,gBAAgB,KAAK;OAChB;GACL,aAAa,KAAK;GAClB,cAAc,YAAY;GAC1B,gBAAgB,KAAK;EACvB;CACF;CACA,MAAM,UAAU,kBAAkB,aAAa,IAAI,GAAG,CAAC,CAAC;CACxD,OAAO;EACL,aAAa,eAAe,SAAS,KAAK,CAAC,aAAa,CAAC;EACzD;EACA;CACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"form-root.d.mts","names":[],"sources":["../../src/form/form-root.tsx"],"mappings":";;;;iBAkBiB;;WAEN;;iBAGM,sBAAsB,KACrC;;;;;;;;EAUA,oBAAoB,UAAU;;;;;;;EAO9B,SAAS;;;;;;EAMT;;EAEA,SAAS;EACT,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,+BAA+B;;;;;;;;;;;;;;;wBAsBrC,WACd,QACA,QACA,WACA,QACA,WACA,OACA,UACA,WACG,QACF,gCAAa,IAAA;yBAVA"}
1
+ {"version":3,"file":"form-root.d.mts","names":[],"sources":["../../src/form/form-root.tsx"],"mappings":";;;;iBAoBiB;;WAEN;;iBAGM,sBAAsB,KACrC;;;;;;;;EAUA,oBAAoB,UAAU;;;;;;;EAO9B,SAAS;;;;;;EAMT;;EAEA,SAAS;EACT,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,+BAA+B;;;;;;;;;;;;;;;wBAsBrC,WACd,QACA,QACA,WACA,QACA,WACA,OACA,UACA,WACG,QACF,gCAAa,IAAA;yBAVA"}
@@ -3,9 +3,11 @@ import { dataAttr } from "../internal/data-attr.mjs";
3
3
  import { resolveStateValue } from "../internal/render-element.mjs";
4
4
  import { useRender } from "../internal/use-render.mjs";
5
5
  import { useLatest } from "../internal/use-latest.mjs";
6
+ import { sortByDocumentOrder } from "../internal/dom-order.mjs";
7
+ import { useElementCheck } from "../internal/use-element-check.mjs";
6
8
  import { FormContext } from "../internal/field-context.mjs";
7
9
  import { FormStatusWatcher } from "../internal/form-status-watcher.mjs";
8
- import { hasAnyError, sortByDocumentOrder } from "../internal/validity.mjs";
10
+ import { hasAnyError } from "../internal/validity.mjs";
9
11
  import { announce } from "../internal/focus-first-invalid.mjs";
10
12
  import { useCallback, useMemo, useRef, useState, useTransition } from "react";
11
13
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -31,18 +33,15 @@ function FormRoot({ action, errors, autoReset = true, method, className, style,
31
33
  const formRef = useRef(null);
32
34
  const submission = useRef(null);
33
35
  const fields = useRef(/* @__PURE__ */ new Set());
34
- const warnedElement = useRef(false);
35
36
  const latest = useLatest({
36
37
  errors,
37
38
  autoReset
38
39
  });
39
40
  const isFunction = typeof action === "function";
41
+ const checkElement = useElementCheck(isDev && ((form) => form.tagName !== "FORM" ? `Form.Root: expected to render a <form> element but got <${form.tagName.toLowerCase()}>.` : null));
40
42
  const libraryRef = useCallback((form) => {
41
43
  formRef.current = form;
42
- if (isDev && !warnedElement.current && form.tagName !== "FORM") {
43
- warnedElement.current = true;
44
- console.error(`Form.Root: expected to render a <form> element but got <${form.tagName.toLowerCase()}>.`);
45
- }
44
+ checkElement?.(form);
46
45
  const onSubmit = (event) => {
47
46
  if (event.target !== form) return;
48
47
  submission.current = {
@@ -55,7 +54,7 @@ function FormRoot({ action, errors, autoReset = true, method, className, style,
55
54
  form.removeEventListener("submit", onSubmit, true);
56
55
  if (formRef.current === form) formRef.current = null;
57
56
  };
58
- }, []);
57
+ }, [checkElement]);
59
58
  const onSubmit = (event) => {
60
59
  if (typeof action !== "function") return;
61
60
  if (event.defaultPrevented) {
@@ -1 +1 @@
1
- {"version":3,"file":"form-root.mjs","names":[],"sources":["../../src/form/form-root.tsx"],"sourcesContent":["\"use client\";\nimport { useCallback, useMemo, useRef, useState, useTransition } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, FormEvent, ReactNode } from \"react\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport { FormContext } from \"../internal/field-context.js\";\nimport type { FormContextValue, FormFieldRegistration } from \"../internal/field-context.js\";\nimport { announce } from \"../internal/focus-first-invalid.js\";\nimport { FormStatusWatcher } from \"../internal/form-status-watcher.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useLatest } from \"../internal/use-latest.js\";\nimport { resolveStateValue, useRender } from \"../internal/use-render.js\";\nimport { hasAnyError, sortByDocumentOrder } from \"../internal/validity.js\";\nimport type { FormErrors } from \"../internal/validity.js\";\n\nexport type { FieldErrorValue, FormErrors } from \"../internal/validity.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\nexport interface FormRootState {\n /** A submission is in flight: the Form's own transition, or the form's status (`useFormStatus`), including the Suspense wait of the result. */\n readonly pending: boolean;\n}\n\nexport interface FormRootProps extends Omit<\n ComponentPropsWithRef<\"form\">,\n \"onSubmit\" | \"method\" | \"action\" | \"className\" | \"style\" | \"children\"\n> {\n /**\n * React form action (`(formData) => unknown`: a Server Function, a `useActionState` dispatch,\n * or a client function), rendered on the form unwrapped so React's progressive enhancement is\n * kept, and run by the Form inside its own transition after hydration (no automatic reset; see\n * `autoReset`). A string is a navigating form. A submitter with its own `formAction` is left to\n * React (automatic reset applies to it).\n */\n action?: string | ((formData: FormData) => unknown);\n /**\n * Field errors keyed by field `name` (usually `state.errors` from `useActionState`). Each\n * `Field.Root` with that name shows its entry, writes it into the control's custom validity,\n * and clears it on the user's next edit; the next settled submission shows the new entries.\n * Errors present at mount are shown without moving focus.\n */\n errors?: FormErrors;\n /**\n * Reset the form (`form.reset()`) when a submission the Form ran settles with no non-empty\n * entry in `errors`. Default `true`. A submission that reports errors never resets, so the\n * user's input, `:user-invalid` and custom validity stay. `false`: never reset.\n */\n autoReset?: boolean;\n /** Only with a string `action`. Owned otherwise (React's own with a function action). */\n method?: ComponentPropsWithRef<\"form\">[\"method\"];\n className?: StateValue<string | undefined, FormRootState>;\n style?: StateValue<CSSProperties | undefined, FormRootState>;\n children?: StateValue<ReactNode, FormRootState>;\n /** Must render a `<form>`. */\n render?: RenderProp<ComponentPropsWithRef<\"form\">, FormRootState>;\n}\n\ninterface Submission {\n /** The Form ran the action itself (`onSubmit` + its own transition). */\n readonly intercepted: boolean;\n readonly formData: FormData | null;\n}\n\n/**\n * A `<form>` that runs its function `action` itself after hydration (design/components/field-form.md\n * 3): `onSubmit` cancels the native submission, so react-dom neither runs the action nor schedules\n * its automatic reset, and the Form awaits `action(formData)` inside its own transition, which\n * still starts the form's status (`useFormStatus`). The action stays rendered unwrapped on the\n * element, so a Server Function posts before hydration.\n *\n * When a submission settles, the Form focuses the first Field that shows a server error (from\n * `errors`), or, when `errors` has no entry and `autoReset` is on, resets the form.\n *\n * Owned keys (conventions 1.2): `action`, `method` (except with a string `action`), `onSubmit`,\n * `data-pending`.\n */\nexport function FormRoot({\n action,\n errors,\n autoReset = true,\n method,\n className,\n style,\n children,\n render,\n ...rest\n}: FormRootProps) {\n const [isPending, startTransition] = useTransition();\n const [statusPending, setStatusPending] = useState(false);\n const pending = isPending || statusPending;\n\n const formRef = useRef<HTMLFormElement | null>(null);\n const submission = useRef<Submission | null>(null);\n const fields = useRef(new Set<FormFieldRegistration>());\n const warnedElement = useRef(false);\n const latest = useLatest({ errors, autoReset });\n const isFunction = typeof action === \"function\";\n\n // A native capture listener sees every submission, React's path included (a submitter with its\n // own `formAction`), before React's `onSubmit` runs and marks it intercepted.\n const libraryRef = useCallback((form: HTMLFormElement) => {\n formRef.current = form;\n if (isDev && !warnedElement.current && form.tagName !== \"FORM\") {\n warnedElement.current = true;\n console.error(\n `Form.Root: expected to render a <form> element but got <${form.tagName.toLowerCase()}>.`,\n );\n }\n const onSubmit = (event: Event) => {\n if (event.target !== form) return;\n submission.current = { intercepted: false, formData: null };\n };\n form.addEventListener(\"submit\", onSubmit, true);\n return () => {\n form.removeEventListener(\"submit\", onSubmit, true);\n if (formRef.current === form) formRef.current = null;\n };\n }, []);\n\n const onSubmit = (event: FormEvent<HTMLFormElement>) => {\n if (typeof action !== \"function\") return; // a navigating form: the browser's\n // A `render` element's own `onSubmit` (merged, it runs first) vetoed the submission\n // (conventions: a `preventDefault()` in the consumer's handler cancels the library's work).\n if (event.defaultPrevented) {\n submission.current = null;\n return;\n }\n const native = event.nativeEvent as SubmitEvent;\n const submitter = native.submitter;\n // A per-button action: React's own path (and its automatic reset).\n if (submitter?.hasAttribute(\"formaction\") === true) return;\n // react-dom now skips its action run and its reset, and still starts the form's status.\n event.preventDefault();\n const formData = new FormData(event.currentTarget, submitter);\n submission.current = { intercepted: true, formData };\n startTransition(async () => {\n await action(formData);\n });\n };\n\n const registerField = useCallback((registration: FormFieldRegistration) => {\n fields.current.add(registration);\n return () => {\n fields.current.delete(registration);\n };\n }, []);\n\n // The settle (design 3.2): the form's status went `true → false`. The Fields rendered the\n // result's errors in that commit; this effect runs after it.\n const onSettled = useCallback(() => {\n const settled = submission.current;\n submission.current = null;\n const form = formRef.current;\n if (form === null) return;\n const shown = [...fields.current]\n .filter((field) => field.showsServerError())\n .map((field) => ({ field, target: field.getFocusTarget() }))\n .filter(\n (entry): entry is { field: FormFieldRegistration; target: HTMLElement } =>\n entry.target !== null && entry.target.isConnected,\n );\n if (shown.length > 0) {\n const first = sortByDocumentOrder(shown, (entry) => entry.target)[0]!;\n // Focus already there (the user pressed Enter in that field): `focus()` does nothing and\n // nothing reads the new description, so the message is announced instead (design 5.3).\n if (first.target.ownerDocument.activeElement === first.target) {\n announce(first.target, first.field.serverMessages().join(\" \"));\n } else {\n first.target.focus();\n }\n return;\n }\n const { errors, autoReset } = latest.current;\n if (autoReset && settled?.intercepted === true && !hasAnyError(errors)) form.reset();\n }, [latest]);\n\n const submittedData = useCallback(() => {\n const current = submission.current;\n return current?.intercepted === true ? current.formData : null;\n }, []);\n\n const refreshFields = useCallback((source: FormFieldRegistration | null) => {\n for (const field of fields.current) if (field !== source) field.refresh();\n }, []);\n\n const context = useMemo<FormContextValue>(\n () => ({ errors, registerField, submittedData, refreshFields }),\n [errors, registerField, submittedData, refreshFields],\n );\n\n const state: FormRootState = { pending };\n\n const element = useRender<ComponentPropsWithRef<\"form\">, FormRootState>({\n defaultElement: \"form\",\n render,\n state,\n className,\n style,\n children: (s) => (\n <>\n {resolveStateValue(children, s)}\n {isFunction && (\n <FormStatusWatcher onPendingChange={setStatusPending} onSettled={onSettled} />\n )}\n </>\n ),\n props: rest,\n libraryProps: {\n method: typeof action === \"string\" ? method : undefined,\n // React's own type wants `void | Promise<void>`; the library's actions return `unknown`\n // (conventions 2.2) and React ignores the result.\n action: action as ComponentPropsWithRef<\"form\">[\"action\"],\n onSubmit: isFunction ? onSubmit : undefined,\n \"data-pending\": dataAttr(pending),\n },\n ref: libraryRef,\n });\n\n return <FormContext value={context}>{element}</FormContext>;\n}\n\nFormRoot.displayName = \"FormRoot\";\n"],"mappings":";;;;;;;;;;;;AAgBA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;;;;;;;;;AA4DvC,SAAg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;EACtE,gBAAgB;EAChB;EACA,OAAA,EAL6B,QAKzB;EACJ;EACA;EACA,WAAW,MACT,qBAAA,UAAA,EAAA,UAAA,CACG,kBAAkB,UAAU,CAAC,GAC7B,cACC,oBAAC,mBAAD;GAAmB,iBAAiB;GAA6B;EAAY,CAAA,CAE/E,EAAA,CAAA;EAEJ,OAAO;EACP,cAAc;GACZ,QAAQ,OAAO,WAAW,WAAW,SAAS,KAAA;GAGtC;GACR,UAAU,aAAa,WAAW,KAAA;GAClC,gBAAgB,SAAS,OAAO;EAClC;EACA,KAAK;CACP,CAAC;CAED,OAAO,oBAAC,aAAD;EAAa,OAAO;EAAU,UAAA;CAAqB,CAAA;AAC5D;AAEA,SAAS,cAAc"}
1
+ {"version":3,"file":"form-root.mjs","names":[],"sources":["../../src/form/form-root.tsx"],"sourcesContent":["\"use client\";\nimport { useCallback, useMemo, useRef, useState, useTransition } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, FormEvent, ReactNode } from \"react\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport { sortByDocumentOrder } from \"../internal/dom-order.js\";\nimport { FormContext } from \"../internal/field-context.js\";\nimport type { FormContextValue, FormFieldRegistration } from \"../internal/field-context.js\";\nimport { announce } from \"../internal/focus-first-invalid.js\";\nimport { FormStatusWatcher } from \"../internal/form-status-watcher.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useElementCheck } from \"../internal/use-element-check.js\";\nimport { useLatest } from \"../internal/use-latest.js\";\nimport { resolveStateValue, useRender } from \"../internal/use-render.js\";\nimport { hasAnyError } from \"../internal/validity.js\";\nimport type { FormErrors } from \"../internal/validity.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\nexport type { FieldErrorValue, FormErrors } from \"../internal/validity.js\";\n\nexport interface FormRootState {\n /** A submission is in flight: the Form's own transition, or the form's status (`useFormStatus`), including the Suspense wait of the result. */\n readonly pending: boolean;\n}\n\nexport interface FormRootProps extends Omit<\n ComponentPropsWithRef<\"form\">,\n \"onSubmit\" | \"method\" | \"action\" | \"className\" | \"style\" | \"children\"\n> {\n /**\n * React form action (`(formData) => unknown`: a Server Function, a `useActionState` dispatch,\n * or a client function), rendered on the form unwrapped so React's progressive enhancement is\n * kept, and run by the Form inside its own transition after hydration (no automatic reset; see\n * `autoReset`). A string is a navigating form. A submitter with its own `formAction` is left to\n * React (automatic reset applies to it).\n */\n action?: string | ((formData: FormData) => unknown);\n /**\n * Field errors keyed by field `name` (usually `state.errors` from `useActionState`). Each\n * `Field.Root` with that name shows its entry, writes it into the control's custom validity,\n * and clears it on the user's next edit; the next settled submission shows the new entries.\n * Errors present at mount are shown without moving focus.\n */\n errors?: FormErrors;\n /**\n * Reset the form (`form.reset()`) when a submission the Form ran settles with no non-empty\n * entry in `errors`. Default `true`. A submission that reports errors never resets, so the\n * user's input, `:user-invalid` and custom validity stay. `false`: never reset.\n */\n autoReset?: boolean;\n /** Only with a string `action`. Owned otherwise (React's own with a function action). */\n method?: ComponentPropsWithRef<\"form\">[\"method\"];\n className?: StateValue<string | undefined, FormRootState>;\n style?: StateValue<CSSProperties | undefined, FormRootState>;\n children?: StateValue<ReactNode, FormRootState>;\n /** Must render a `<form>`. */\n render?: RenderProp<ComponentPropsWithRef<\"form\">, FormRootState>;\n}\n\ninterface Submission {\n /** The Form ran the action itself (`onSubmit` + its own transition). */\n readonly intercepted: boolean;\n readonly formData: FormData | null;\n}\n\n/**\n * A `<form>` that runs its function `action` itself after hydration (design/components/field-form.md\n * 3): `onSubmit` cancels the native submission, so react-dom neither runs the action nor schedules\n * its automatic reset, and the Form awaits `action(formData)` inside its own transition, which\n * still starts the form's status (`useFormStatus`). The action stays rendered unwrapped on the\n * element, so a Server Function posts before hydration.\n *\n * When a submission settles, the Form focuses the first Field that shows a server error (from\n * `errors`), or, when `errors` has no entry and `autoReset` is on, resets the form.\n *\n * Owned keys (conventions 1.2): `action`, `method` (except with a string `action`), `onSubmit`,\n * `data-pending`.\n */\nexport function FormRoot({\n action,\n errors,\n autoReset = true,\n method,\n className,\n style,\n children,\n render,\n ...rest\n}: FormRootProps) {\n const [isPending, startTransition] = useTransition();\n const [statusPending, setStatusPending] = useState(false);\n const pending = isPending || statusPending;\n\n const formRef = useRef<HTMLFormElement | null>(null);\n const submission = useRef<Submission | null>(null);\n const fields = useRef(new Set<FormFieldRegistration>());\n const latest = useLatest({ errors, autoReset });\n const isFunction = typeof action === \"function\";\n\n // A native capture listener sees every submission, React's path included (a submitter with its\n // own `formAction`), before React's `onSubmit` runs and marks it intercepted.\n const checkElement = useElementCheck<HTMLFormElement>(\n isDev &&\n ((form) =>\n form.tagName !== \"FORM\"\n ? `Form.Root: expected to render a <form> element but got <${form.tagName.toLowerCase()}>.`\n : null),\n );\n const libraryRef = useCallback(\n (form: HTMLFormElement) => {\n formRef.current = form;\n checkElement?.(form);\n const onSubmit = (event: Event) => {\n if (event.target !== form) return;\n submission.current = { intercepted: false, formData: null };\n };\n form.addEventListener(\"submit\", onSubmit, true);\n return () => {\n form.removeEventListener(\"submit\", onSubmit, true);\n if (formRef.current === form) formRef.current = null;\n };\n },\n [checkElement],\n );\n\n const onSubmit = (event: FormEvent<HTMLFormElement>) => {\n if (typeof action !== \"function\") return; // a navigating form: the browser's\n // A `render` element's own `onSubmit` (merged, it runs first) vetoed the submission\n // (conventions: a `preventDefault()` in the consumer's handler cancels the library's work).\n if (event.defaultPrevented) {\n submission.current = null;\n return;\n }\n const native = event.nativeEvent as SubmitEvent;\n const submitter = native.submitter;\n // A per-button action: React's own path (and its automatic reset).\n if (submitter?.hasAttribute(\"formaction\") === true) return;\n // react-dom now skips its action run and its reset, and still starts the form's status.\n event.preventDefault();\n const formData = new FormData(event.currentTarget, submitter);\n submission.current = { intercepted: true, formData };\n startTransition(async () => {\n await action(formData);\n });\n };\n\n const registerField = useCallback((registration: FormFieldRegistration) => {\n fields.current.add(registration);\n return () => {\n fields.current.delete(registration);\n };\n }, []);\n\n // The settle (design 3.2): the form's status went `true → false`. The Fields rendered the\n // result's errors in that commit; this effect runs after it.\n const onSettled = useCallback(() => {\n const settled = submission.current;\n submission.current = null;\n const form = formRef.current;\n if (form === null) return;\n const shown = [...fields.current]\n .filter((field) => field.showsServerError())\n .map((field) => ({ field, target: field.getFocusTarget() }))\n .filter(\n (entry): entry is { field: FormFieldRegistration; target: HTMLElement } =>\n entry.target !== null && entry.target.isConnected,\n );\n if (shown.length > 0) {\n const first = sortByDocumentOrder(shown, (entry) => entry.target)[0]!;\n // Focus already there (the user pressed Enter in that field): `focus()` does nothing and\n // nothing reads the new description, so the message is announced instead (design 5.3).\n if (first.target.ownerDocument.activeElement === first.target) {\n announce(first.target, first.field.serverMessages().join(\" \"));\n } else {\n first.target.focus();\n }\n return;\n }\n const { errors, autoReset } = latest.current;\n if (autoReset && settled?.intercepted === true && !hasAnyError(errors)) form.reset();\n }, [latest]);\n\n const submittedData = useCallback(() => {\n const current = submission.current;\n return current?.intercepted === true ? current.formData : null;\n }, []);\n\n const refreshFields = useCallback((source: FormFieldRegistration | null) => {\n for (const field of fields.current) if (field !== source) field.refresh();\n }, []);\n\n const context = useMemo<FormContextValue>(\n () => ({ errors, registerField, submittedData, refreshFields }),\n [errors, registerField, submittedData, refreshFields],\n );\n\n const state: FormRootState = { pending };\n\n const element = useRender<ComponentPropsWithRef<\"form\">, FormRootState>({\n defaultElement: \"form\",\n render,\n state,\n className,\n style,\n children: (s) => (\n <>\n {resolveStateValue(children, s)}\n {isFunction && (\n <FormStatusWatcher onPendingChange={setStatusPending} onSettled={onSettled} />\n )}\n </>\n ),\n props: rest,\n libraryProps: {\n method: typeof action === \"string\" ? method : undefined,\n // React's own type wants `void | Promise<void>`; the library's actions return `unknown`\n // (conventions 2.2) and React ignores the result.\n action: action as ComponentPropsWithRef<\"form\">[\"action\"],\n onSubmit: isFunction ? onSubmit : undefined,\n \"data-pending\": dataAttr(pending),\n },\n ref: libraryRef,\n });\n\n return <FormContext value={context}>{element}</FormContext>;\n}\n\nFormRoot.displayName =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EAAQ;EAAe;EAAe;CAAa,CACtD;CAIA,MAAM,UAAU,UAAwD;EACtE,gBAAgB;EAChB;EACA,OAAA,EAL6B,QAKzB;EACJ;EACA;EACA,WAAW,MACT,qBAAA,UAAA,EAAA,UAAA,CACG,kBAAkB,UAAU,CAAC,GAC7B,cACC,oBAAC,mBAAD;GAAmB,iBAAiB;GAA6B;EAAY,CAAA,CAE/E,EAAA,CAAA;EAEJ,OAAO;EACP,cAAc;GACZ,QAAQ,OAAO,WAAW,WAAW,SAAS,KAAA;GAGtC;GACR,UAAU,aAAa,WAAW,KAAA;GAClC,gBAAgB,SAAS,OAAO;EAClC;EACA,KAAK;CACP,CAAC;CAED,OAAO,oBAAC,aAAD;EAAa,OAAO;EAAU,UAAA;CAAqB,CAAA;AAC5D;AAEA,SAAS,cAAc"}
@@ -9,7 +9,7 @@ export interface FormSubmitState {
9
9
  export interface FormSubmitProps extends Omit<ComponentPropsWithRef<"button">, "type" | "className" | "style" | "children"> {
10
10
  /**
11
11
  * Native `disabled`; owned. Never set by the library (conventions 3.6). Always native, also
12
- * with a component `render`: a submitter has no handler to honour `aria-disabled` (#83).
12
+ * with a component `render`: a submitter has no handler to honour `aria-disabled`.
13
13
  */
14
14
  disabled?: boolean;
15
15
  className?: StateValue<string | undefined, FormSubmitState>;