@fuf-stack/uniform 1.22.4 → 1.22.6

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 (442) hide show
  1. package/dist/Checkboxes/index.cjs +113 -3
  2. package/dist/Checkboxes/index.cjs.map +1 -0
  3. package/dist/Checkboxes/index.d.cts +534 -2
  4. package/dist/Checkboxes/index.d.cts.map +1 -0
  5. package/dist/Checkboxes/index.d.ts +534 -2
  6. package/dist/Checkboxes/index.d.ts.map +1 -0
  7. package/dist/Checkboxes/index.js +112 -2
  8. package/dist/Checkboxes/index.js.map +1 -0
  9. package/dist/DatePicker/index.cjs +194 -3
  10. package/dist/DatePicker/index.cjs.map +1 -0
  11. package/dist/DatePicker/index.d.cts +1413 -2
  12. package/dist/DatePicker/index.d.cts.map +1 -0
  13. package/dist/DatePicker/index.d.ts +1413 -2
  14. package/dist/DatePicker/index.d.ts.map +1 -0
  15. package/dist/DatePicker/index.js +193 -2
  16. package/dist/DatePicker/index.js.map +1 -0
  17. package/dist/FieldArray/index.cjs +495 -3
  18. package/dist/FieldArray/index.cjs.map +1 -0
  19. package/dist/FieldArray/index.d.cts +539 -2
  20. package/dist/FieldArray/index.d.cts.map +1 -0
  21. package/dist/FieldArray/index.d.ts +539 -2
  22. package/dist/FieldArray/index.d.ts.map +1 -0
  23. package/dist/FieldArray/index.js +494 -2
  24. package/dist/FieldArray/index.js.map +1 -0
  25. package/dist/FieldCard/index.cjs +230 -4
  26. package/dist/FieldCard/index.cjs.map +1 -0
  27. package/dist/FieldCard/index.d.cts +314 -2
  28. package/dist/FieldCard/index.d.cts.map +1 -0
  29. package/dist/FieldCard/index.d.ts +314 -2
  30. package/dist/FieldCard/index.d.ts.map +1 -0
  31. package/dist/FieldCard/index.js +225 -2
  32. package/dist/FieldCard/index.js.map +1 -0
  33. package/dist/{FieldCopyTestIdButton-Dpmo0uBV.js → FieldCopyTestIdButton-CRJBix9D.js} +2 -2
  34. package/dist/{FieldCopyTestIdButton-Dpmo0uBV.js.map → FieldCopyTestIdButton-CRJBix9D.js.map} +1 -1
  35. package/dist/{FieldCopyTestIdButton-ptoB1F75.cjs → FieldCopyTestIdButton-D3D_LmJh.cjs} +1 -8
  36. package/dist/{FieldCopyTestIdButton-ptoB1F75.cjs.map → FieldCopyTestIdButton-D3D_LmJh.cjs.map} +1 -1
  37. package/dist/{FieldValidationError-ktTyyyip.js → FieldValidationError-ByRoIxaM.js} +5 -5
  38. package/dist/{FieldValidationError-ktTyyyip.js.map → FieldValidationError-ByRoIxaM.js.map} +1 -1
  39. package/dist/{FieldValidationError-BQcvvU9i.cjs → FieldValidationError-CfYKzl7P.cjs} +5 -6
  40. package/dist/{FieldValidationError-BQcvvU9i.cjs.map → FieldValidationError-CfYKzl7P.cjs.map} +1 -1
  41. package/dist/Form/index.cjs +118 -3
  42. package/dist/Form/index.cjs.map +1 -0
  43. package/dist/Form/index.d.cts +43 -2
  44. package/dist/Form/index.d.cts.map +1 -0
  45. package/dist/Form/index.d.ts +43 -2
  46. package/dist/Form/index.d.ts.map +1 -0
  47. package/dist/Form/index.js +118 -2
  48. package/dist/Form/index.js.map +1 -0
  49. package/dist/{FormContext-3kamRn2C.d.cts → FormContext-BLWS7bhO.d.cts} +1 -1
  50. package/dist/{FormContext-3kamRn2C.d.cts.map → FormContext-BLWS7bhO.d.cts.map} +1 -1
  51. package/dist/{FormContext-BQeKOV-0.js → FormContext-DjJOJKxj.js} +1 -1
  52. package/dist/{FormContext-BQeKOV-0.js.map → FormContext-DjJOJKxj.js.map} +1 -1
  53. package/dist/{FormContext-DsmS_mkO.cjs → FormContext-EGH0cVnH.cjs} +1 -1
  54. package/dist/{FormContext-DsmS_mkO.cjs.map → FormContext-EGH0cVnH.cjs.map} +1 -1
  55. package/dist/{FormContext-i66vM5f1.d.ts → FormContext-LgzrDWu1.d.ts} +1 -1
  56. package/dist/{FormContext-i66vM5f1.d.ts.map → FormContext-LgzrDWu1.d.ts.map} +1 -1
  57. package/dist/Grid/index.cjs +1 -2
  58. package/dist/Grid/index.d.cts +22 -2
  59. package/dist/Grid/index.d.cts.map +1 -0
  60. package/dist/Grid/index.d.ts +22 -2
  61. package/dist/Grid/index.d.ts.map +1 -0
  62. package/dist/Grid/index.js +2 -2
  63. package/dist/{Grid-D-VcRGi9.cjs → Grid-BbqCRkuY.cjs} +1 -8
  64. package/dist/{Grid-D-VcRGi9.cjs.map → Grid-BbqCRkuY.cjs.map} +1 -1
  65. package/dist/{Grid-BQpLOB0G.js → Grid-CTs-Rb9G.js} +2 -2
  66. package/dist/{Grid-BQpLOB0G.js.map → Grid-CTs-Rb9G.js.map} +1 -1
  67. package/dist/Input/index.cjs +96 -3
  68. package/dist/Input/index.cjs.map +1 -0
  69. package/dist/Input/index.d.cts +677 -2
  70. package/dist/Input/index.d.cts.map +1 -0
  71. package/dist/Input/index.d.ts +677 -2
  72. package/dist/Input/index.d.ts.map +1 -0
  73. package/dist/Input/index.js +96 -2
  74. package/dist/Input/index.js.map +1 -0
  75. package/dist/RadioBoxes/index.cjs +136 -4
  76. package/dist/RadioBoxes/index.cjs.map +1 -0
  77. package/dist/RadioBoxes/index.d.cts +1477 -2
  78. package/dist/RadioBoxes/index.d.cts.map +1 -0
  79. package/dist/RadioBoxes/index.d.ts +1477 -2
  80. package/dist/RadioBoxes/index.d.ts.map +1 -0
  81. package/dist/RadioBoxes/index.js +135 -2
  82. package/dist/RadioBoxes/index.js.map +1 -0
  83. package/dist/RadioTabs/index.cjs +123 -3
  84. package/dist/RadioTabs/index.cjs.map +1 -0
  85. package/dist/RadioTabs/index.d.cts +585 -2
  86. package/dist/RadioTabs/index.d.cts.map +1 -0
  87. package/dist/RadioTabs/index.d.ts +585 -2
  88. package/dist/RadioTabs/index.d.ts.map +1 -0
  89. package/dist/RadioTabs/index.js +120 -2
  90. package/dist/RadioTabs/index.js.map +1 -0
  91. package/dist/Radios/index.cjs +74 -3
  92. package/dist/Radios/index.cjs.map +1 -0
  93. package/dist/Radios/index.d.cts +1263 -2
  94. package/dist/Radios/index.d.cts.map +1 -0
  95. package/dist/Radios/index.d.ts +1263 -2
  96. package/dist/Radios/index.d.ts.map +1 -0
  97. package/dist/Radios/index.js +73 -2
  98. package/dist/Radios/index.js.map +1 -0
  99. package/dist/Select/index.cjs +286 -3
  100. package/dist/Select/index.cjs.map +1 -0
  101. package/dist/Select/index.d.cts +3917 -2
  102. package/dist/Select/index.d.cts.map +1 -0
  103. package/dist/Select/index.d.ts +3917 -2
  104. package/dist/Select/index.d.ts.map +1 -0
  105. package/dist/Select/index.js +283 -2
  106. package/dist/Select/index.js.map +1 -0
  107. package/dist/Slider/index.cjs +109 -3
  108. package/dist/Slider/index.cjs.map +1 -0
  109. package/dist/Slider/index.d.cts +1760 -2
  110. package/dist/Slider/index.d.cts.map +1 -0
  111. package/dist/Slider/index.d.ts +1760 -2
  112. package/dist/Slider/index.d.ts.map +1 -0
  113. package/dist/Slider/index.js +108 -2
  114. package/dist/Slider/index.js.map +1 -0
  115. package/dist/SubmitButton/index.cjs +31 -3
  116. package/dist/SubmitButton/index.cjs.map +1 -0
  117. package/dist/SubmitButton/index.d.cts +38 -2
  118. package/dist/SubmitButton/index.d.cts.map +1 -0
  119. package/dist/SubmitButton/index.d.ts +38 -2
  120. package/dist/SubmitButton/index.d.ts.map +1 -0
  121. package/dist/SubmitButton/index.js +31 -2
  122. package/dist/SubmitButton/index.js.map +1 -0
  123. package/dist/Switch/index.cjs +82 -3
  124. package/dist/Switch/index.cjs.map +1 -0
  125. package/dist/Switch/index.d.cts +1257 -2
  126. package/dist/Switch/index.d.cts.map +1 -0
  127. package/dist/Switch/index.d.ts +1257 -2
  128. package/dist/Switch/index.d.ts.map +1 -0
  129. package/dist/Switch/index.js +81 -2
  130. package/dist/Switch/index.js.map +1 -0
  131. package/dist/SwitchBox/index.cjs +154 -4
  132. package/dist/SwitchBox/index.cjs.map +1 -0
  133. package/dist/SwitchBox/index.d.cts +473 -2
  134. package/dist/SwitchBox/index.d.cts.map +1 -0
  135. package/dist/SwitchBox/index.d.ts +473 -2
  136. package/dist/SwitchBox/index.d.ts.map +1 -0
  137. package/dist/SwitchBox/index.js +153 -2
  138. package/dist/SwitchBox/index.js.map +1 -0
  139. package/dist/TextArea/index.cjs +66 -3
  140. package/dist/TextArea/index.cjs.map +1 -0
  141. package/dist/TextArea/index.d.cts +659 -2
  142. package/dist/TextArea/index.d.cts.map +1 -0
  143. package/dist/TextArea/index.d.ts +659 -2
  144. package/dist/TextArea/index.d.ts.map +1 -0
  145. package/dist/TextArea/index.js +66 -2
  146. package/dist/TextArea/index.js.map +1 -0
  147. package/dist/Time/index.cjs +221 -3
  148. package/dist/Time/index.cjs.map +1 -0
  149. package/dist/Time/index.d.cts +1028 -2
  150. package/dist/Time/index.d.cts.map +1 -0
  151. package/dist/Time/index.d.ts +1028 -2
  152. package/dist/Time/index.d.ts.map +1 -0
  153. package/dist/Time/index.js +216 -2
  154. package/dist/Time/index.js.map +1 -0
  155. package/dist/helpers/index.cjs +0 -1
  156. package/dist/helpers/index.cjs.map +1 -1
  157. package/dist/helpers/index.js.map +1 -1
  158. package/dist/hooks/useClientValidation/index.cjs +177 -3
  159. package/dist/hooks/useClientValidation/index.cjs.map +1 -1
  160. package/dist/hooks/useClientValidation/index.d.cts +148 -2
  161. package/dist/hooks/useClientValidation/index.d.cts.map +1 -0
  162. package/dist/hooks/useClientValidation/index.d.ts +148 -2
  163. package/dist/hooks/useClientValidation/index.d.ts.map +1 -0
  164. package/dist/hooks/useClientValidation/index.js +175 -1
  165. package/dist/hooks/useClientValidation/index.js.map +1 -1
  166. package/dist/hooks/useController/index.cjs +1 -1
  167. package/dist/hooks/useController/index.d.cts +1 -1
  168. package/dist/hooks/useController/index.d.ts +1 -1
  169. package/dist/hooks/useController/index.js +1 -1
  170. package/dist/hooks/useFormContext/index.cjs +1 -1
  171. package/dist/hooks/useFormContext/index.d.cts +1 -1
  172. package/dist/hooks/useFormContext/index.d.ts +1 -1
  173. package/dist/hooks/useFormContext/index.js +1 -1
  174. package/dist/hooks/useInput/index.cjs +0 -1
  175. package/dist/hooks/useInput/index.d.cts +1 -1
  176. package/dist/hooks/useInput/index.d.ts +1 -1
  177. package/dist/hooks/useInput/index.js +1 -1
  178. package/dist/hooks/useInputValueDebounce/index.cjs +1 -2
  179. package/dist/hooks/useInputValueDebounce/index.cjs.map +1 -1
  180. package/dist/hooks/useInputValueDebounce/index.d.cts +66 -2
  181. package/dist/hooks/useInputValueDebounce/index.d.cts.map +1 -0
  182. package/dist/hooks/useInputValueDebounce/index.d.ts +66 -2
  183. package/dist/hooks/useInputValueDebounce/index.d.ts.map +1 -0
  184. package/dist/hooks/useInputValueDebounce/index.js +1 -1
  185. package/dist/hooks/useInputValueTransform/index.cjs +1 -1
  186. package/dist/hooks/useInputValueTransform/index.d.cts +1 -1
  187. package/dist/hooks/useInputValueTransform/index.d.ts +1 -1
  188. package/dist/hooks/useInputValueTransform/index.js +1 -1
  189. package/dist/hooks/useUniformField/index.cjs +8 -8
  190. package/dist/hooks/useUniformField/index.cjs.map +1 -1
  191. package/dist/hooks/useUniformField/index.d.cts +98 -2
  192. package/dist/hooks/useUniformField/index.d.cts.map +1 -0
  193. package/dist/hooks/useUniformField/index.d.ts +98 -2
  194. package/dist/hooks/useUniformField/index.d.ts.map +1 -0
  195. package/dist/hooks/useUniformField/index.js +8 -8
  196. package/dist/hooks/useUniformField/index.js.map +1 -1
  197. package/dist/hooks/useUniformFieldArray/index.cjs +1 -2
  198. package/dist/hooks/useUniformFieldArray/index.cjs.map +1 -1
  199. package/dist/hooks/useUniformFieldArray/index.d.cts +79 -2
  200. package/dist/hooks/useUniformFieldArray/index.d.cts.map +1 -0
  201. package/dist/hooks/useUniformFieldArray/index.d.ts +79 -2
  202. package/dist/hooks/useUniformFieldArray/index.d.ts.map +1 -0
  203. package/dist/hooks/useUniformFieldArray/index.js +1 -1
  204. package/dist/hooks/useWatchFormReset/index.cjs +1 -2
  205. package/dist/hooks/useWatchFormReset/index.cjs.map +1 -1
  206. package/dist/hooks/useWatchFormReset/index.d.cts +38 -2
  207. package/dist/hooks/useWatchFormReset/index.d.cts.map +1 -0
  208. package/dist/hooks/useWatchFormReset/index.d.ts +38 -2
  209. package/dist/hooks/useWatchFormReset/index.d.ts.map +1 -0
  210. package/dist/hooks/useWatchFormReset/index.js +1 -1
  211. package/dist/hooks/useWatchUserChange/index.cjs +82 -2
  212. package/dist/hooks/useWatchUserChange/index.cjs.map +1 -1
  213. package/dist/hooks/useWatchUserChange/index.d.cts +80 -2
  214. package/dist/hooks/useWatchUserChange/index.d.cts.map +1 -0
  215. package/dist/hooks/useWatchUserChange/index.d.ts +80 -2
  216. package/dist/hooks/useWatchUserChange/index.d.ts.map +1 -0
  217. package/dist/hooks/useWatchUserChange/index.js +81 -1
  218. package/dist/hooks/useWatchUserChange/index.js.map +1 -1
  219. package/dist/partials/FieldCopyTestIdButton/index.cjs +1 -2
  220. package/dist/partials/FieldCopyTestIdButton/index.d.cts +14 -2
  221. package/dist/partials/FieldCopyTestIdButton/index.d.cts.map +1 -0
  222. package/dist/partials/FieldCopyTestIdButton/index.d.ts +14 -2
  223. package/dist/partials/FieldCopyTestIdButton/index.d.ts.map +1 -0
  224. package/dist/partials/FieldCopyTestIdButton/index.js +2 -2
  225. package/dist/partials/FieldValidationError/index.cjs +1 -2
  226. package/dist/partials/FieldValidationError/index.d.cts +22 -2
  227. package/dist/partials/FieldValidationError/index.d.cts.map +1 -0
  228. package/dist/partials/FieldValidationError/index.d.ts +22 -2
  229. package/dist/partials/FieldValidationError/index.d.ts.map +1 -0
  230. package/dist/partials/FieldValidationError/index.js +2 -2
  231. package/dist/{useController-CzP0aVFC.d.ts → useController-CvQqCvFJ.d.ts} +1 -1
  232. package/dist/{useController-CzP0aVFC.d.ts.map → useController-CvQqCvFJ.d.ts.map} +1 -1
  233. package/dist/{useController--lRPWBuD.cjs → useController-Dbe7ADG6.cjs} +2 -2
  234. package/dist/{useController--lRPWBuD.cjs.map → useController-Dbe7ADG6.cjs.map} +1 -1
  235. package/dist/{useController-B287flU_.js → useController-DxFS0u7c.js} +2 -2
  236. package/dist/{useController-B287flU_.js.map → useController-DxFS0u7c.js.map} +1 -1
  237. package/dist/{useController-BT3Fd0IO.d.cts → useController-fblEApv_.d.cts} +1 -1
  238. package/dist/{useController-BT3Fd0IO.d.cts.map → useController-fblEApv_.d.cts.map} +1 -1
  239. package/dist/{useFormContext-CpLVpNAf.d.ts → useFormContext-B1-deU4Z.d.ts} +4 -4
  240. package/dist/{useFormContext-CpLVpNAf.d.ts.map → useFormContext-B1-deU4Z.d.ts.map} +1 -1
  241. package/dist/{useFormContext-CT8H8xIe.js → useFormContext-BJqa1FoT.js} +2 -2
  242. package/dist/{useFormContext-CT8H8xIe.js.map → useFormContext-BJqa1FoT.js.map} +1 -1
  243. package/dist/{useFormContext-Ddc1HWKv.d.cts → useFormContext-D5vrT2sg.d.cts} +4 -4
  244. package/dist/{useFormContext-Ddc1HWKv.d.cts.map → useFormContext-D5vrT2sg.d.cts.map} +1 -1
  245. package/dist/{useFormContext-CrXwNYiB.cjs → useFormContext-kUHonwgu.cjs} +2 -2
  246. package/dist/{useFormContext-CrXwNYiB.cjs.map → useFormContext-kUHonwgu.cjs.map} +1 -1
  247. package/dist/{useInputValueTransform-CNCBU7a9.d.cts → useInputValueTransform-DCXXb2Lp.d.cts} +1 -1
  248. package/dist/{useInputValueTransform-CNCBU7a9.d.cts.map → useInputValueTransform-DCXXb2Lp.d.cts.map} +1 -1
  249. package/dist/{useInputValueTransform-dLfFIYW4.d.ts → useInputValueTransform-DCXXb2Lp.d.ts} +1 -1
  250. package/dist/{useInputValueTransform-dLfFIYW4.d.ts.map → useInputValueTransform-DCXXb2Lp.d.ts.map} +1 -1
  251. package/dist/{useInputValueTransform-CXdmtc0Q.js → useInputValueTransform-DJ5zkqSy.js} +1 -1
  252. package/dist/{useInputValueTransform-CXdmtc0Q.js.map → useInputValueTransform-DJ5zkqSy.js.map} +1 -1
  253. package/dist/{useInputValueTransform-Bm65K8LX.cjs → useInputValueTransform-P62UUZBl.cjs} +1 -2
  254. package/dist/{useInputValueTransform-Bm65K8LX.cjs.map → useInputValueTransform-P62UUZBl.cjs.map} +1 -1
  255. package/package.json +6 -13
  256. package/dist/Checkboxes-D1hppxDE.js +0 -112
  257. package/dist/Checkboxes-D1hppxDE.js.map +0 -1
  258. package/dist/Checkboxes-DHk09GmH.cjs +0 -124
  259. package/dist/Checkboxes-DHk09GmH.cjs.map +0 -1
  260. package/dist/DatePicker-BUSi8SWQ.js +0 -193
  261. package/dist/DatePicker-BUSi8SWQ.js.map +0 -1
  262. package/dist/DatePicker-DuBjvS5g.cjs +0 -205
  263. package/dist/DatePicker-DuBjvS5g.cjs.map +0 -1
  264. package/dist/FieldArray-BxmK1NRd.js +0 -494
  265. package/dist/FieldArray-BxmK1NRd.js.map +0 -1
  266. package/dist/FieldArray-DgiQpIdr.cjs +0 -506
  267. package/dist/FieldArray-DgiQpIdr.cjs.map +0 -1
  268. package/dist/FieldCard-BK6SNqFY.js +0 -222
  269. package/dist/FieldCard-BK6SNqFY.js.map +0 -1
  270. package/dist/FieldCard-C-DZ5ARr.cjs +0 -234
  271. package/dist/FieldCard-C-DZ5ARr.cjs.map +0 -1
  272. package/dist/Form-CYlsIABv.cjs +0 -125
  273. package/dist/Form-CYlsIABv.cjs.map +0 -1
  274. package/dist/Form-D3yfDu4L.js +0 -114
  275. package/dist/Form-D3yfDu4L.js.map +0 -1
  276. package/dist/Input-B5RxbkNS.js +0 -96
  277. package/dist/Input-B5RxbkNS.js.map +0 -1
  278. package/dist/Input-DvVViuWH.cjs +0 -108
  279. package/dist/Input-DvVViuWH.cjs.map +0 -1
  280. package/dist/RadioBoxes-BJz-aJp3.js +0 -135
  281. package/dist/RadioBoxes-BJz-aJp3.js.map +0 -1
  282. package/dist/RadioBoxes-CR--FBhQ.cjs +0 -153
  283. package/dist/RadioBoxes-CR--FBhQ.cjs.map +0 -1
  284. package/dist/RadioTabs-Btt582Nl.cjs +0 -133
  285. package/dist/RadioTabs-Btt582Nl.cjs.map +0 -1
  286. package/dist/RadioTabs-CYmzrPBG.js +0 -120
  287. package/dist/RadioTabs-CYmzrPBG.js.map +0 -1
  288. package/dist/Radios-DZxhrX96.js +0 -73
  289. package/dist/Radios-DZxhrX96.js.map +0 -1
  290. package/dist/Radios-Jg9mwE0B.cjs +0 -85
  291. package/dist/Radios-Jg9mwE0B.cjs.map +0 -1
  292. package/dist/Select-CZwuEAB5.cjs +0 -296
  293. package/dist/Select-CZwuEAB5.cjs.map +0 -1
  294. package/dist/Select-CgeqhZIC.js +0 -283
  295. package/dist/Select-CgeqhZIC.js.map +0 -1
  296. package/dist/Slider-Bpxt-Qgj.cjs +0 -120
  297. package/dist/Slider-Bpxt-Qgj.cjs.map +0 -1
  298. package/dist/Slider-DRfSw0uE.js +0 -108
  299. package/dist/Slider-DRfSw0uE.js.map +0 -1
  300. package/dist/SubmitButton-D-wn1PJV.cjs +0 -43
  301. package/dist/SubmitButton-D-wn1PJV.cjs.map +0 -1
  302. package/dist/SubmitButton-D6aU7IgC.js +0 -31
  303. package/dist/SubmitButton-D6aU7IgC.js.map +0 -1
  304. package/dist/Switch-D9DNrqmj.js +0 -81
  305. package/dist/Switch-D9DNrqmj.js.map +0 -1
  306. package/dist/Switch-hjjy34QB.cjs +0 -93
  307. package/dist/Switch-hjjy34QB.cjs.map +0 -1
  308. package/dist/SwitchBox-BU1XieaZ.js +0 -153
  309. package/dist/SwitchBox-BU1XieaZ.js.map +0 -1
  310. package/dist/SwitchBox-Dl-F5y2m.cjs +0 -171
  311. package/dist/SwitchBox-Dl-F5y2m.cjs.map +0 -1
  312. package/dist/TextArea-CMXm-kTK.cjs +0 -78
  313. package/dist/TextArea-CMXm-kTK.cjs.map +0 -1
  314. package/dist/TextArea-DAg_K-QP.js +0 -66
  315. package/dist/TextArea-DAg_K-QP.js.map +0 -1
  316. package/dist/Time-CDptQ3CK.js +0 -213
  317. package/dist/Time-CDptQ3CK.js.map +0 -1
  318. package/dist/Time-WKgbji5k.cjs +0 -219
  319. package/dist/Time-WKgbji5k.cjs.map +0 -1
  320. package/dist/index-54OZEaUU.d.ts +0 -43
  321. package/dist/index-54OZEaUU.d.ts.map +0 -1
  322. package/dist/index-7UT2Ki5e.d.cts +0 -113
  323. package/dist/index-7UT2Ki5e.d.cts.map +0 -1
  324. package/dist/index-9_3XTDJC.d.cts +0 -174
  325. package/dist/index-9_3XTDJC.d.cts.map +0 -1
  326. package/dist/index-B5SfdA5O.d.cts +0 -99
  327. package/dist/index-B5SfdA5O.d.cts.map +0 -1
  328. package/dist/index-B61zRzeS.d.cts +0 -101
  329. package/dist/index-B61zRzeS.d.cts.map +0 -1
  330. package/dist/index-B7gQppgQ.d.ts +0 -116
  331. package/dist/index-B7gQppgQ.d.ts.map +0 -1
  332. package/dist/index-BDFJDKmz.d.ts +0 -166
  333. package/dist/index-BDFJDKmz.d.ts.map +0 -1
  334. package/dist/index-BPaSE_7b.d.ts +0 -179
  335. package/dist/index-BPaSE_7b.d.ts.map +0 -1
  336. package/dist/index-BSjcTo7A.d.ts +0 -147
  337. package/dist/index-BSjcTo7A.d.ts.map +0 -1
  338. package/dist/index-BmMspnsJ.d.cts +0 -137
  339. package/dist/index-BmMspnsJ.d.cts.map +0 -1
  340. package/dist/index-BqxDWhNr.d.cts +0 -22
  341. package/dist/index-BqxDWhNr.d.cts.map +0 -1
  342. package/dist/index-Bzs7_gnk.d.cts +0 -116
  343. package/dist/index-Bzs7_gnk.d.cts.map +0 -1
  344. package/dist/index-C3-TV4Up.d.cts +0 -43
  345. package/dist/index-C3-TV4Up.d.cts.map +0 -1
  346. package/dist/index-C4GJH8Xv.d.ts +0 -290
  347. package/dist/index-C4GJH8Xv.d.ts.map +0 -1
  348. package/dist/index-CE8fnXuQ.d.ts +0 -167
  349. package/dist/index-CE8fnXuQ.d.ts.map +0 -1
  350. package/dist/index-CEJxjf5R.d.ts +0 -22
  351. package/dist/index-CEJxjf5R.d.ts.map +0 -1
  352. package/dist/index-CHQKk_fN2.d.ts +0 -14
  353. package/dist/index-CHQKk_fN2.d.ts.map +0 -1
  354. package/dist/index-CIiOXrrY.d.ts +0 -99
  355. package/dist/index-CIiOXrrY.d.ts.map +0 -1
  356. package/dist/index-CV7wqRev.d.ts +0 -38
  357. package/dist/index-CV7wqRev.d.ts.map +0 -1
  358. package/dist/index-CXvUaeCL.d.cts +0 -14
  359. package/dist/index-CXvUaeCL.d.cts.map +0 -1
  360. package/dist/index-C_zjtsGM.d.ts +0 -113
  361. package/dist/index-C_zjtsGM.d.ts.map +0 -1
  362. package/dist/index-CbPJiRK2.d.ts +0 -83
  363. package/dist/index-CbPJiRK2.d.ts.map +0 -1
  364. package/dist/index-CvP3tbVV.d.ts +0 -137
  365. package/dist/index-CvP3tbVV.d.ts.map +0 -1
  366. package/dist/index-Cwb7sTO0.d.ts +0 -154
  367. package/dist/index-Cwb7sTO0.d.ts.map +0 -1
  368. package/dist/index-CxY9VWv5.d.cts +0 -154
  369. package/dist/index-CxY9VWv5.d.cts.map +0 -1
  370. package/dist/index-D8udSkgA.d.cts +0 -167
  371. package/dist/index-D8udSkgA.d.cts.map +0 -1
  372. package/dist/index-DBsF7xsq.d.cts +0 -147
  373. package/dist/index-DBsF7xsq.d.cts.map +0 -1
  374. package/dist/index-DNADTCoc.d.cts +0 -290
  375. package/dist/index-DNADTCoc.d.cts.map +0 -1
  376. package/dist/index-DRg0anjB.d.cts +0 -179
  377. package/dist/index-DRg0anjB.d.cts.map +0 -1
  378. package/dist/index-DUmNI6cE.d.cts +0 -83
  379. package/dist/index-DUmNI6cE.d.cts.map +0 -1
  380. package/dist/index-Db0WD4d1.d.cts +0 -166
  381. package/dist/index-Db0WD4d1.d.cts.map +0 -1
  382. package/dist/index-DpXSZCZe.d.cts +0 -38
  383. package/dist/index-DpXSZCZe.d.cts.map +0 -1
  384. package/dist/index-GxTY7aAc.d.ts +0 -174
  385. package/dist/index-GxTY7aAc.d.ts.map +0 -1
  386. package/dist/index-P30z4VRT.d.cts +0 -22
  387. package/dist/index-P30z4VRT.d.cts.map +0 -1
  388. package/dist/index-PMCqBX0t.d.ts +0 -101
  389. package/dist/index-PMCqBX0t.d.ts.map +0 -1
  390. package/dist/index-PWRw2bPH.d.ts +0 -22
  391. package/dist/index-PWRw2bPH.d.ts.map +0 -1
  392. package/dist/index-QgVr4iWX.d.cts +0 -122
  393. package/dist/index-QgVr4iWX.d.cts.map +0 -1
  394. package/dist/index-dgho7gpc.d.ts +0 -122
  395. package/dist/index-dgho7gpc.d.ts.map +0 -1
  396. package/dist/index.cjs +0 -85
  397. package/dist/index.cjs.map +0 -1
  398. package/dist/index.d.cts +0 -31
  399. package/dist/index.d.ts +0 -31
  400. package/dist/index.js +0 -36
  401. package/dist/index.js.map +0 -1
  402. package/dist/useClientValidation-BRfhqRom.cjs +0 -190
  403. package/dist/useClientValidation-BRfhqRom.cjs.map +0 -1
  404. package/dist/useClientValidation-C2dLJnDI.d.cts +0 -148
  405. package/dist/useClientValidation-C2dLJnDI.d.cts.map +0 -1
  406. package/dist/useClientValidation-DpLdzIAb.js +0 -178
  407. package/dist/useClientValidation-DpLdzIAb.js.map +0 -1
  408. package/dist/useClientValidation-qRq2_spX.d.ts +0 -148
  409. package/dist/useClientValidation-qRq2_spX.d.ts.map +0 -1
  410. package/dist/useInputValueDebounce-CfQDiomI.d.cts +0 -66
  411. package/dist/useInputValueDebounce-CfQDiomI.d.cts.map +0 -1
  412. package/dist/useInputValueDebounce-DZgzL7GQ.d.ts +0 -66
  413. package/dist/useInputValueDebounce-DZgzL7GQ.d.ts.map +0 -1
  414. package/dist/useUniformField-CmAYcGER.d.cts +0 -98
  415. package/dist/useUniformField-CmAYcGER.d.cts.map +0 -1
  416. package/dist/useUniformField-DJDpQzRo.d.ts +0 -98
  417. package/dist/useUniformField-DJDpQzRo.d.ts.map +0 -1
  418. package/dist/useUniformFieldArray-D3fdzwzD.d.cts +0 -79
  419. package/dist/useUniformFieldArray-D3fdzwzD.d.cts.map +0 -1
  420. package/dist/useUniformFieldArray-zGcIhwhF.d.ts +0 -79
  421. package/dist/useUniformFieldArray-zGcIhwhF.d.ts.map +0 -1
  422. package/dist/useWatchFormReset-BSd6jMxU.d.cts +0 -38
  423. package/dist/useWatchFormReset-BSd6jMxU.d.cts.map +0 -1
  424. package/dist/useWatchFormReset-C7YJ-I3N.d.ts +0 -38
  425. package/dist/useWatchFormReset-C7YJ-I3N.d.ts.map +0 -1
  426. package/dist/useWatchUserChange-C1xWHtFG.cjs +0 -90
  427. package/dist/useWatchUserChange-C1xWHtFG.cjs.map +0 -1
  428. package/dist/useWatchUserChange-CpyZz2i7.d.ts +0 -80
  429. package/dist/useWatchUserChange-CpyZz2i7.d.ts.map +0 -1
  430. package/dist/useWatchUserChange-DSAboNCs.d.cts +0 -80
  431. package/dist/useWatchUserChange-DSAboNCs.d.cts.map +0 -1
  432. package/dist/useWatchUserChange-DSQGsl1R.js +0 -84
  433. package/dist/useWatchUserChange-DSQGsl1R.js.map +0 -1
  434. /package/dist/{index-BLwMeReG.d.ts → index-BKZ67WMa.d.cts} +0 -0
  435. /package/dist/{index-C2gUMYkE.d.cts → index-BKZ67WMa.d.ts} +0 -0
  436. /package/dist/{index-CJgP-E0M.d.cts → index-BVVgDSdq.d.cts} +0 -0
  437. /package/dist/{index-Cg9utiy0.d.ts → index-BVVgDSdq.d.ts} +0 -0
  438. /package/dist/{index-CspKFJM1.d.cts → index-DmtQKWjk.d.cts} +0 -0
  439. /package/dist/{index-h64gcVNJ.d.ts → index-DmtQKWjk.d.ts} +0 -0
  440. /package/dist/{useInput-CVm3tP78.js → useInput-C0aJaAGe.js} +0 -0
  441. /package/dist/{useInput-BdH8oftG.d.ts → useInput-ClpHDPdr.d.cts} +0 -0
  442. /package/dist/{useInput-DZOmMKcp.d.cts → useInput-ClpHDPdr.d.ts} +0 -0
@@ -1,2 +1,98 @@
1
- import { n as UseUniformFieldReturn, r as useUniformField, t as UseUniformFieldParams } from "../../useUniformField-CmAYcGER.cjs";
2
- export { UseUniformFieldParams, UseUniformFieldReturn, useUniformField };
1
+ import { t as InputValueTransform } from "../../useInputValueTransform-DCXXb2Lp.cjs";
2
+ import { r as useController } from "../../useController-fblEApv_.cjs";
3
+ import { n as useFormContext } from "../../useFormContext-D5vrT2sg.cjs";
4
+ import { t as useInput } from "../../useInput-ClpHDPdr.cjs";
5
+ import { ReactNode } from "react";
6
+ import { FieldError, FieldValues, Path } from "react-hook-form";
7
+
8
+ //#region src/hooks/useUniformField/useUniformField.d.ts
9
+ interface UseUniformFieldParams<TFieldValues extends FieldValues = FieldValues, TDisplay = unknown> {
10
+ /** Form field name */
11
+ name: Path<TFieldValues> & string;
12
+ /** Custom aria-label for accessibility. If not provided, falls back to field name when no visible label exists */
13
+ ariaLabel?: string;
14
+ /** Disable the field */
15
+ disabled?: boolean;
16
+ /** Optional label content */
17
+ label?: ReactNode;
18
+ /** Optional explicit test id used to build stable test ids */
19
+ testId?: string;
20
+ /** Optional value transformation between form and display values */
21
+ transform?: InputValueTransform<TDisplay>;
22
+ /** Input type for special number handling */
23
+ type?: 'text' | 'number' | 'password';
24
+ }
25
+ interface UseUniformFieldReturn<TFieldValues extends FieldValues = FieldValues> {
26
+ /** Computed aria-label fallback (field name) when no visible label exists. Components can override based on their accessibility needs (e.g., if placeholder provides sufficient context) */
27
+ ariaLabel: string | undefined;
28
+ /** react-hook-form control instance for advanced integrations */
29
+ control: ReturnType<typeof useFormContext<TFieldValues>>['control'];
30
+ /** Debug mode from Uniform provider */
31
+ debugMode: ReturnType<typeof useFormContext<TFieldValues>>['debugMode'];
32
+ /** Current value used to initialize uncontrolled components */
33
+ defaultValue: unknown;
34
+ /** Whether the field is currently disabled (from RHF) */
35
+ disabled: boolean | undefined;
36
+ /** Validation error(s) for the field */
37
+ error: FieldError[] | undefined;
38
+ /** Pre-built errorMessage node to plug into components */
39
+ errorMessage: ReactNode | null;
40
+ /** RHF controller field with transformed value/onChange (use this for simple components) */
41
+ field: ReturnType<typeof useController<TFieldValues>>['field'];
42
+ /** Helper to spread standardized error message props to underlying components */
43
+ getErrorMessageProps: ReturnType<typeof useInput>['getErrorMessageProps'];
44
+ /** Helper to spread standardized helper wrapper props (for spacing/animation) */
45
+ getHelperWrapperProps: ReturnType<typeof useInput>['getHelperWrapperProps'];
46
+ /** Helper to spread standardized label props to underlying components */
47
+ getLabelProps: ReturnType<typeof useInput>['getLabelProps'];
48
+ /** Access current form values (converted to validation-friendly format) */
49
+ getValues: ReturnType<typeof useFormContext<TFieldValues>>['getValues'];
50
+ /** Whether the field should show invalid state (debounced for smooth animations). True when field is invalid AND (dirty OR touched OR submitted) */
51
+ invalid: boolean;
52
+ /** Computed label node including optional test id copy button */
53
+ label: ReactNode | null;
54
+ /** onBlur handler from controller */
55
+ onBlur: ReturnType<typeof useController<TFieldValues>>['field']['onBlur'];
56
+ /** onChange handler from controller (with transform applied) */
57
+ onChange: ReturnType<typeof useController<TFieldValues>>['field']['onChange'];
58
+ /** Ref to forward to underlying control */
59
+ ref: ReturnType<typeof useController<TFieldValues>>['field']['ref'];
60
+ /** Whether the field is required according to validation schema */
61
+ required: boolean;
62
+ /** Reset a specific field in the form */
63
+ resetField: ReturnType<typeof useFormContext<TFieldValues>>['resetField'];
64
+ /** Generated HTML data-testid for the field */
65
+ testId: string;
66
+ }
67
+ /**
68
+ * Combines frequently used form field logic into a single hook.
69
+ *
70
+ * Provides:
71
+ * - Enhanced form context (validation-aware state, `testId`, value transforms)
72
+ * - Controller field with nullish conversion handling
73
+ * - Value transformation via `transform` prop:
74
+ * • Allows disentangled display and form values (e.g., string ↔ object, boolean ↔ array)
75
+ * • Automatically applies `toDisplayValue` to field value for components
76
+ * • Automatically applies `toFormValue` to display value when onChange is called
77
+ * • Works with `type` prop for automatic number/string conversion
78
+ * • Examples: storing objects while displaying strings, storing booleans as arrays, enriching values with metadata
79
+ * - Debounced `invalid` state with smart timing:
80
+ * • `true` (field becomes invalid): applies immediately so errors show right away
81
+ * • `false` (field becomes valid): delayed 200ms to allow smooth exit animations
82
+ * • Respects `prefers-reduced-motion` by skipping delays when user prefers reduced motion
83
+ * - Smart `invalid` visibility (via `showInvalid`):
84
+ * • Shows errors when field is dirty OR touched OR form has been submitted
85
+ * • Prevents showing errors on pristine/untouched fields for better UX
86
+ * • Works well for all field types (text inputs, checkboxes, radios, arrays)
87
+ * - Prebuilt `errorMessage` React node using `FieldValidationError`
88
+ * - Computed `label` node which appends a `FieldCopyTestIdButton` in
89
+ * `debug-testids` mode
90
+ * - `defaultValue` for uncontrolled defaults and all usual field handlers
91
+ * - Access to form utilities: `control`, `getValues`, `resetField`
92
+ * - Presentation helpers: `getLabelProps`, `getErrorMessageProps`,
93
+ * `getHelperWrapperProps` for consistent wiring to underlying UI components
94
+ */
95
+ declare const useUniformField: <TFieldValues extends FieldValues = FieldValues, TDisplay = unknown>(params: UseUniformFieldParams<TFieldValues, TDisplay>) => UseUniformFieldReturn<TFieldValues>;
96
+ //#endregion
97
+ export { UseUniformFieldParams, UseUniformFieldReturn, useUniformField };
98
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../../../src/hooks/useUniformField/useUniformField.tsx"],"mappings":";;;;;;;;UAgBiB,qBAAA,sBACM,WAAA,GAAc,WAAA;;EAInC,IAAA,EAAM,IAAA,CAAK,YAAA;EALyB;EAOpC,SAAA;EANqB;EAQrB,QAAA;EAJW;EAMX,KAAA,GAAQ,SAAA;EAAA;EAER,MAAA;EAEY;EAAZ,SAAA,GAAY,mBAAA,CAAoB,QAAA;EAAD;EAE/B,IAAA;AAAA;AAAA,UAGe,qBAAA,sBACM,WAAA,GAAc,WAAA;EAnBnC;EAsBA,SAAA;EAnBM;EAqBN,OAAA,EAAS,UAAA,QAAkB,cAAA,CAAe,YAAA;EAnB1C;EAqBA,SAAA,EAAW,UAAA,QAAkB,cAAA,CAAe,YAAA;EAjB5C;EAmBA,YAAA;EAjBA;EAmBA,QAAA;EAjBY;EAmBZ,KAAA,EAAO,UAAA;EAjBP;EAmBA,YAAA,EAAc,SAAA;EAnBV;EAqBJ,KAAA,EAAO,UAAA,QAAkB,aAAA,CAAc,YAAA;EAlBH;EAoBpC,oBAAA,EAAsB,UAAA,QAAkB,QAAA;EAnBnB;EAqBrB,qBAAA,EAAuB,UAAA,QAAkB,QAAA;EAhBC;EAkB1C,aAAA,EAAe,UAAA,QAAkB,QAAA;EAlBxB;EAoBT,SAAA,EAAW,UAAA,QAAkB,cAAA,CAAe,YAAA;EAlBf;EAoB7B,OAAA;EAdO;EAgBP,KAAA,EAAO,SAAA;EAZgC;EAcvC,MAAA,EAAQ,UAAA,QAAkB,aAAA,CAAc,YAAA;EAdjC;EAgBP,QAAA,EAAU,UAAA,QAAkB,aAAA,CAAc,YAAA;EAdpB;EAgBtB,GAAA,EAAK,UAAA,QAAkB,aAAA,CAAc,YAAA;EAdd;EAgBvB,QAAA;EAde;EAgBf,UAAA,EAAY,UAAA,QAAkB,cAAA,CAAe,YAAA;EAdhB;EAgB7B,MAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA+BW,eAAA,wBACU,WAAA,GAAc,WAAA,sBAGnC,MAAA,EAAQ,qBAAA,CAAsB,YAAA,EAAc,QAAA,MAC3C,qBAAA,CAAsB,YAAA"}
@@ -1,2 +1,98 @@
1
- import { n as UseUniformFieldReturn, r as useUniformField, t as UseUniformFieldParams } from "../../useUniformField-DJDpQzRo.js";
2
- export { UseUniformFieldParams, UseUniformFieldReturn, useUniformField };
1
+ import { t as InputValueTransform } from "../../useInputValueTransform-DCXXb2Lp.js";
2
+ import { r as useController$1 } from "../../useController-CvQqCvFJ.js";
3
+ import { n as useFormContext$1 } from "../../useFormContext-B1-deU4Z.js";
4
+ import { t as useInput } from "../../useInput-ClpHDPdr.js";
5
+ import { ReactNode } from "react";
6
+ import { FieldError, FieldValues, Path } from "react-hook-form";
7
+
8
+ //#region src/hooks/useUniformField/useUniformField.d.ts
9
+ interface UseUniformFieldParams<TFieldValues extends FieldValues = FieldValues, TDisplay = unknown> {
10
+ /** Form field name */
11
+ name: Path<TFieldValues> & string;
12
+ /** Custom aria-label for accessibility. If not provided, falls back to field name when no visible label exists */
13
+ ariaLabel?: string;
14
+ /** Disable the field */
15
+ disabled?: boolean;
16
+ /** Optional label content */
17
+ label?: ReactNode;
18
+ /** Optional explicit test id used to build stable test ids */
19
+ testId?: string;
20
+ /** Optional value transformation between form and display values */
21
+ transform?: InputValueTransform<TDisplay>;
22
+ /** Input type for special number handling */
23
+ type?: 'text' | 'number' | 'password';
24
+ }
25
+ interface UseUniformFieldReturn<TFieldValues extends FieldValues = FieldValues> {
26
+ /** Computed aria-label fallback (field name) when no visible label exists. Components can override based on their accessibility needs (e.g., if placeholder provides sufficient context) */
27
+ ariaLabel: string | undefined;
28
+ /** react-hook-form control instance for advanced integrations */
29
+ control: ReturnType<typeof useFormContext$1<TFieldValues>>['control'];
30
+ /** Debug mode from Uniform provider */
31
+ debugMode: ReturnType<typeof useFormContext$1<TFieldValues>>['debugMode'];
32
+ /** Current value used to initialize uncontrolled components */
33
+ defaultValue: unknown;
34
+ /** Whether the field is currently disabled (from RHF) */
35
+ disabled: boolean | undefined;
36
+ /** Validation error(s) for the field */
37
+ error: FieldError[] | undefined;
38
+ /** Pre-built errorMessage node to plug into components */
39
+ errorMessage: ReactNode | null;
40
+ /** RHF controller field with transformed value/onChange (use this for simple components) */
41
+ field: ReturnType<typeof useController$1<TFieldValues>>['field'];
42
+ /** Helper to spread standardized error message props to underlying components */
43
+ getErrorMessageProps: ReturnType<typeof useInput>['getErrorMessageProps'];
44
+ /** Helper to spread standardized helper wrapper props (for spacing/animation) */
45
+ getHelperWrapperProps: ReturnType<typeof useInput>['getHelperWrapperProps'];
46
+ /** Helper to spread standardized label props to underlying components */
47
+ getLabelProps: ReturnType<typeof useInput>['getLabelProps'];
48
+ /** Access current form values (converted to validation-friendly format) */
49
+ getValues: ReturnType<typeof useFormContext$1<TFieldValues>>['getValues'];
50
+ /** Whether the field should show invalid state (debounced for smooth animations). True when field is invalid AND (dirty OR touched OR submitted) */
51
+ invalid: boolean;
52
+ /** Computed label node including optional test id copy button */
53
+ label: ReactNode | null;
54
+ /** onBlur handler from controller */
55
+ onBlur: ReturnType<typeof useController$1<TFieldValues>>['field']['onBlur'];
56
+ /** onChange handler from controller (with transform applied) */
57
+ onChange: ReturnType<typeof useController$1<TFieldValues>>['field']['onChange'];
58
+ /** Ref to forward to underlying control */
59
+ ref: ReturnType<typeof useController$1<TFieldValues>>['field']['ref'];
60
+ /** Whether the field is required according to validation schema */
61
+ required: boolean;
62
+ /** Reset a specific field in the form */
63
+ resetField: ReturnType<typeof useFormContext$1<TFieldValues>>['resetField'];
64
+ /** Generated HTML data-testid for the field */
65
+ testId: string;
66
+ }
67
+ /**
68
+ * Combines frequently used form field logic into a single hook.
69
+ *
70
+ * Provides:
71
+ * - Enhanced form context (validation-aware state, `testId`, value transforms)
72
+ * - Controller field with nullish conversion handling
73
+ * - Value transformation via `transform` prop:
74
+ * • Allows disentangled display and form values (e.g., string ↔ object, boolean ↔ array)
75
+ * • Automatically applies `toDisplayValue` to field value for components
76
+ * • Automatically applies `toFormValue` to display value when onChange is called
77
+ * • Works with `type` prop for automatic number/string conversion
78
+ * • Examples: storing objects while displaying strings, storing booleans as arrays, enriching values with metadata
79
+ * - Debounced `invalid` state with smart timing:
80
+ * • `true` (field becomes invalid): applies immediately so errors show right away
81
+ * • `false` (field becomes valid): delayed 200ms to allow smooth exit animations
82
+ * • Respects `prefers-reduced-motion` by skipping delays when user prefers reduced motion
83
+ * - Smart `invalid` visibility (via `showInvalid`):
84
+ * • Shows errors when field is dirty OR touched OR form has been submitted
85
+ * • Prevents showing errors on pristine/untouched fields for better UX
86
+ * • Works well for all field types (text inputs, checkboxes, radios, arrays)
87
+ * - Prebuilt `errorMessage` React node using `FieldValidationError`
88
+ * - Computed `label` node which appends a `FieldCopyTestIdButton` in
89
+ * `debug-testids` mode
90
+ * - `defaultValue` for uncontrolled defaults and all usual field handlers
91
+ * - Access to form utilities: `control`, `getValues`, `resetField`
92
+ * - Presentation helpers: `getLabelProps`, `getErrorMessageProps`,
93
+ * `getHelperWrapperProps` for consistent wiring to underlying UI components
94
+ */
95
+ declare const useUniformField: <TFieldValues extends FieldValues = FieldValues, TDisplay = unknown>(params: UseUniformFieldParams<TFieldValues, TDisplay>) => UseUniformFieldReturn<TFieldValues>;
96
+ //#endregion
97
+ export { UseUniformFieldParams, UseUniformFieldReturn, useUniformField };
98
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/hooks/useUniformField/useUniformField.tsx"],"mappings":";;;;;;;;UAgBiB,qBAAA,sBACM,WAAA,GAAc,WAAA;;EAInC,IAAA,EAAM,IAAA,CAAK,YAAA;EALyB;EAOpC,SAAA;EANqB;EAQrB,QAAA;EAJW;EAMX,KAAA,GAAQ,SAAA;EAAA;EAER,MAAA;EAEY;EAAZ,SAAA,GAAY,mBAAA,CAAoB,QAAA;EAAD;EAE/B,IAAA;AAAA;AAAA,UAGe,qBAAA,sBACM,WAAA,GAAc,WAAA;EAnBnC;EAsBA,SAAA;EAnBM;EAqBN,OAAA,EAAS,UAAA,QAAkB,gBAAA,CAAe,YAAA;EAnB1C;EAqBA,SAAA,EAAW,UAAA,QAAkB,gBAAA,CAAe,YAAA;EAjB5C;EAmBA,YAAA;EAjBA;EAmBA,QAAA;EAjBY;EAmBZ,KAAA,EAAO,UAAA;EAjBP;EAmBA,YAAA,EAAc,SAAA;EAnBV;EAqBJ,KAAA,EAAO,UAAA,QAAkB,eAAA,CAAc,YAAA;EAlBH;EAoBpC,oBAAA,EAAsB,UAAA,QAAkB,QAAA;EAnBnB;EAqBrB,qBAAA,EAAuB,UAAA,QAAkB,QAAA;EAhBC;EAkB1C,aAAA,EAAe,UAAA,QAAkB,QAAA;EAlBxB;EAoBT,SAAA,EAAW,UAAA,QAAkB,gBAAA,CAAe,YAAA;EAlBf;EAoB7B,OAAA;EAdO;EAgBP,KAAA,EAAO,SAAA;EAZgC;EAcvC,MAAA,EAAQ,UAAA,QAAkB,eAAA,CAAc,YAAA;EAdjC;EAgBP,QAAA,EAAU,UAAA,QAAkB,eAAA,CAAc,YAAA;EAdpB;EAgBtB,GAAA,EAAK,UAAA,QAAkB,eAAA,CAAc,YAAA;EAdd;EAgBvB,QAAA;EAde;EAgBf,UAAA,EAAY,UAAA,QAAkB,gBAAA,CAAe,YAAA;EAdhB;EAgB7B,MAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA+BW,eAAA,wBACU,WAAA,GAAc,WAAA,sBAGnC,MAAA,EAAQ,qBAAA,CAAsB,YAAA,EAAc,QAAA,MAC3C,qBAAA,CAAsB,YAAA"}
@@ -1,10 +1,10 @@
1
1
  import { isValueEmpty } from "../../helpers/index.js";
2
- import { n as FieldCopyTestIdButton } from "../../FieldCopyTestIdButton-Dpmo0uBV.js";
3
- import { n as FieldValidationError } from "../../FieldValidationError-ktTyyyip.js";
4
- import { t as useController } from "../../useController-B287flU_.js";
5
- import { n as useFormContext } from "../../useFormContext-CT8H8xIe.js";
6
- import { t as useInput } from "../../useInput-CVm3tP78.js";
7
- import { t as useInputValueTransform } from "../../useInputValueTransform-CXdmtc0Q.js";
2
+ import { t as FieldCopyTestIdButton_default } from "../../FieldCopyTestIdButton-CRJBix9D.js";
3
+ import { t as FieldValidationError_default } from "../../FieldValidationError-ByRoIxaM.js";
4
+ import { t as useController } from "../../useController-DxFS0u7c.js";
5
+ import { n as useFormContext } from "../../useFormContext-BJqa1FoT.js";
6
+ import { t as useInput } from "../../useInput-C0aJaAGe.js";
7
+ import { t as useInputValueTransform } from "../../useInputValueTransform-DJ5zkqSy.js";
8
8
  import "react";
9
9
  import { useDebounce } from "@fuf-stack/pixels";
10
10
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -83,8 +83,8 @@ const useUniformField = (params) => {
83
83
  const hasValue = !isValueEmpty(fieldValue);
84
84
  const invalid = useDebounce(rawInvalid && (isDirty && hasValue || isTouched || submitCount > 0), 200);
85
85
  const showTestIdCopyButton = debugMode === "debug-testids";
86
- const labelNode = !!label || showTestIdCopyButton ? /* @__PURE__ */ jsxs(Fragment, { children: [label !== false ? label : null, showTestIdCopyButton ? /* @__PURE__ */ jsx(FieldCopyTestIdButton, { testId }) : null] }) : null;
87
- const errorMessage = /* @__PURE__ */ jsx(FieldValidationError, {
86
+ const labelNode = !!label || showTestIdCopyButton ? /* @__PURE__ */ jsxs(Fragment, { children: [label !== false ? label : null, showTestIdCopyButton ? /* @__PURE__ */ jsx(FieldCopyTestIdButton_default, { testId }) : null] }) : null;
87
+ const errorMessage = /* @__PURE__ */ jsx(FieldValidationError_default, {
88
88
  error,
89
89
  testId
90
90
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/hooks/useUniformField/useUniformField.tsx","../../../src/hooks/useUniformField/index.ts"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { FieldError, FieldValues, Path } from 'react-hook-form';\nimport type { InputValueTransform } from '../useInputValueTransform/useInputValueTransform';\n\nimport React from 'react';\n\nimport { useDebounce } from '@fuf-stack/pixels';\n\nimport { isValueEmpty } from '../../helpers';\nimport { FieldCopyTestIdButton } from '../../partials/FieldCopyTestIdButton';\nimport { FieldValidationError } from '../../partials/FieldValidationError';\nimport { useController } from '../useController/useController';\nimport { useFormContext } from '../useFormContext/useFormContext';\nimport { useInput } from '../useInput/useInput';\nimport { useInputValueTransform } from '../useInputValueTransform/useInputValueTransform';\n\nexport interface UseUniformFieldParams<\n TFieldValues extends FieldValues = FieldValues,\n TDisplay = unknown,\n> {\n /** Form field name */\n name: Path<TFieldValues> & string;\n /** Custom aria-label for accessibility. If not provided, falls back to field name when no visible label exists */\n ariaLabel?: string;\n /** Disable the field */\n disabled?: boolean;\n /** Optional label content */\n label?: ReactNode;\n /** Optional explicit test id used to build stable test ids */\n testId?: string;\n /** Optional value transformation between form and display values */\n transform?: InputValueTransform<TDisplay>;\n /** Input type for special number handling */\n type?: 'text' | 'number' | 'password';\n}\n\nexport interface UseUniformFieldReturn<\n TFieldValues extends FieldValues = FieldValues,\n> {\n /** Computed aria-label fallback (field name) when no visible label exists. Components can override based on their accessibility needs (e.g., if placeholder provides sufficient context) */\n ariaLabel: string | undefined;\n /** react-hook-form control instance for advanced integrations */\n control: ReturnType<typeof useFormContext<TFieldValues>>['control'];\n /** Debug mode from Uniform provider */\n debugMode: ReturnType<typeof useFormContext<TFieldValues>>['debugMode'];\n /** Current value used to initialize uncontrolled components */\n defaultValue: unknown;\n /** Whether the field is currently disabled (from RHF) */\n disabled: boolean | undefined;\n /** Validation error(s) for the field */\n error: FieldError[] | undefined;\n /** Pre-built errorMessage node to plug into components */\n errorMessage: ReactNode | null;\n /** RHF controller field with transformed value/onChange (use this for simple components) */\n field: ReturnType<typeof useController<TFieldValues>>['field'];\n /** Helper to spread standardized error message props to underlying components */\n getErrorMessageProps: ReturnType<typeof useInput>['getErrorMessageProps'];\n /** Helper to spread standardized helper wrapper props (for spacing/animation) */\n getHelperWrapperProps: ReturnType<typeof useInput>['getHelperWrapperProps'];\n /** Helper to spread standardized label props to underlying components */\n getLabelProps: ReturnType<typeof useInput>['getLabelProps'];\n /** Access current form values (converted to validation-friendly format) */\n getValues: ReturnType<typeof useFormContext<TFieldValues>>['getValues'];\n /** Whether the field should show invalid state (debounced for smooth animations). True when field is invalid AND (dirty OR touched OR submitted) */\n invalid: boolean;\n /** Computed label node including optional test id copy button */\n label: ReactNode | null;\n /** onBlur handler from controller */\n onBlur: ReturnType<typeof useController<TFieldValues>>['field']['onBlur'];\n /** onChange handler from controller (with transform applied) */\n onChange: ReturnType<typeof useController<TFieldValues>>['field']['onChange'];\n /** Ref to forward to underlying control */\n ref: ReturnType<typeof useController<TFieldValues>>['field']['ref'];\n /** Whether the field is required according to validation schema */\n required: boolean;\n /** Reset a specific field in the form */\n resetField: ReturnType<typeof useFormContext<TFieldValues>>['resetField'];\n /** Generated HTML data-testid for the field */\n testId: string;\n}\n\n/**\n * Combines frequently used form field logic into a single hook.\n *\n * Provides:\n * - Enhanced form context (validation-aware state, `testId`, value transforms)\n * - Controller field with nullish conversion handling\n * - Value transformation via `transform` prop:\n * • Allows disentangled display and form values (e.g., string ↔ object, boolean ↔ array)\n * • Automatically applies `toDisplayValue` to field value for components\n * • Automatically applies `toFormValue` to display value when onChange is called\n * • Works with `type` prop for automatic number/string conversion\n * • Examples: storing objects while displaying strings, storing booleans as arrays, enriching values with metadata\n * - Debounced `invalid` state with smart timing:\n * • `true` (field becomes invalid): applies immediately so errors show right away\n * • `false` (field becomes valid): delayed 200ms to allow smooth exit animations\n * • Respects `prefers-reduced-motion` by skipping delays when user prefers reduced motion\n * - Smart `invalid` visibility (via `showInvalid`):\n * • Shows errors when field is dirty OR touched OR form has been submitted\n * • Prevents showing errors on pristine/untouched fields for better UX\n * • Works well for all field types (text inputs, checkboxes, radios, arrays)\n * - Prebuilt `errorMessage` React node using `FieldValidationError`\n * - Computed `label` node which appends a `FieldCopyTestIdButton` in\n * `debug-testids` mode\n * - `defaultValue` for uncontrolled defaults and all usual field handlers\n * - Access to form utilities: `control`, `getValues`, `resetField`\n * - Presentation helpers: `getLabelProps`, `getErrorMessageProps`,\n * `getHelperWrapperProps` for consistent wiring to underlying UI components\n */\nexport const useUniformField = <\n TFieldValues extends FieldValues = FieldValues,\n TDisplay = unknown,\n>(\n params: UseUniformFieldParams<TFieldValues, TDisplay>,\n): UseUniformFieldReturn<TFieldValues> => {\n const {\n name,\n ariaLabel: customAriaLabel,\n disabled = false,\n testId: explicitTestId,\n label,\n type,\n transform,\n } = params;\n\n const {\n control,\n debugMode,\n formState: { submitCount },\n getFieldState,\n getValues,\n resetField,\n } = useFormContext<TFieldValues>();\n\n const {\n error,\n invalid: rawInvalid,\n isDirty,\n isTouched,\n required,\n testId,\n } = getFieldState(name, explicitTestId);\n\n const { field } = useController<TFieldValues>({\n control,\n disabled,\n name,\n });\n const {\n onChange: fieldOnChange,\n value: fieldValue,\n disabled: isDisabled,\n onBlur,\n ref,\n } = field;\n\n // Get transform utilities (but don't apply them automatically)\n // Components can choose how to use them (directly or via useInputValueDebounce)\n const { toDisplayValue, toFormValue } = useInputValueTransform<TDisplay>({\n type,\n transform,\n });\n\n // For components without special needs: apply transform to value and onChange\n const transformedValue = toDisplayValue(fieldValue);\n const transformedOnChange = (eventOrValue: TDisplay | React.ChangeEvent) => {\n // Extract value from event or use value directly\n const displayValue =\n (eventOrValue as React.ChangeEvent<HTMLInputElement>)?.target?.value ??\n eventOrValue;\n const formValue = toFormValue(displayValue as TDisplay);\n fieldOnChange(formValue);\n };\n\n const defaultValue = (getValues() as Record<string, unknown>)?.[\n name as string\n ];\n\n /**\n * Determine when to show the invalid state to the user.\n *\n * Show errors when the field is invalid AND any of these conditions are met:\n * - Field has a user-entered value (show validation errors like format/length while typing)\n * - Field is touched (focused and blurred) - good for text inputs\n * - Form has been submitted - shows all errors after submit attempt\n *\n * Note: `hasValue` is gated by `isDirty` so invalid initial values do not\n * show errors just because resolver-backed validation state is available.\n * Newly added empty array elements can be dirty, but stay hidden until blur\n * because they do not have a value yet.\n *\n * This prevents showing errors on pristine/untouched/empty fields for better UX.\n * Examples:\n * - Text input: User loads form with empty required field → no error shown yet\n * - Text input: User types invalid content → error shows immediately (has value)\n * - Text input: User focuses and blurs without typing → error shows (via isTouched)\n * - Checkbox/radio: User selects option → error shows immediately (has value)\n * - Field array: User adds element → no error yet; after blur → error shows\n * - Any field: User submits form → all errors show (via submitCount)\n *\n * The entire condition is debounced to prevent flickering and allow smooth animations.\n */\n\n // isValueEmpty handles marker strings, flat array wrappers, empty arrays, and empty objects\n const hasValue = !isValueEmpty(fieldValue);\n const showInvalid =\n rawInvalid && ((isDirty && hasValue) || isTouched || submitCount > 0);\n // Debounce to prevent flickering during rapid state changes\n const invalid = useDebounce(showInvalid, 200);\n\n // Build a label node that:\n // - shows the provided label (unless explicitly set to false)\n // - appends a copy-to-clipboard button for the test id in `debug-testids` mode\n // Consumers can pass this directly to component `label` props\n const showTestIdCopyButton = debugMode === 'debug-testids';\n const labelNode: ReactNode | null =\n !!label || showTestIdCopyButton ? (\n <>\n {label !== false ? label : null}\n {showTestIdCopyButton ? (\n <FieldCopyTestIdButton testId={testId} />\n ) : null}\n </>\n ) : null;\n\n // Ready-to-render error message; consumers can drop this into their\n // component `errorMessage` prop without repeating mapping/markup\n const errorMessage = <FieldValidationError error={error} testId={testId} />;\n\n // Generate standardized props for label, helper wrapper and error message\n // so consumers can spread them directly into UI components (e.g. HeroUI),\n // keeping animations/spacing consistent across fields\n const { getErrorMessageProps, getLabelProps, getHelperWrapperProps } =\n useInput({\n ref,\n classNames: {\n // set padding to 0 for error message exit animation\n helperWrapper: 'p-0',\n },\n errorMessage: JSON.stringify(error),\n isInvalid: invalid,\n isRequired: required,\n label,\n labelPlacement: 'outside',\n });\n\n // Compute aria-label: prefer custom prop, then use string label if available, otherwise field name\n // Components can further override this based on their specific accessibility needs\n // (e.g., Input/TextArea may skip this if they have a meaningful placeholder)\n const ariaLabel =\n customAriaLabel ?? (typeof label === 'string' ? label : name);\n\n return {\n ariaLabel,\n control,\n debugMode,\n defaultValue,\n disabled: isDisabled,\n error,\n errorMessage,\n field: {\n ...field,\n value: transformedValue as typeof field.value,\n onChange: transformedOnChange as typeof field.onChange,\n },\n getErrorMessageProps,\n getHelperWrapperProps,\n getLabelProps,\n getValues,\n invalid,\n label: labelNode,\n onBlur,\n onChange: transformedOnChange as typeof field.onChange,\n ref,\n required,\n resetField,\n testId,\n };\n};\n","/* v8 ignore start */\n\nexport * from './useUniformField';\n\n/* v8 ignore stop */\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6GA,MAAa,mBAIX,WACwC;CACxC,MAAM,EACJ,MACA,WAAW,iBACX,WAAW,OACX,QAAQ,gBACR,OACA,MACA,cACE;CAEJ,MAAM,EACJ,SACA,WACA,WAAW,EAAE,eACb,eACA,WACA,eACE,eAA6B;CAEjC,MAAM,EACJ,OACA,SAAS,YACT,SACA,WACA,UACA,WACE,cAAc,MAAM,cAAc;CAEtC,MAAM,EAAE,UAAU,cAA4B;EAC5C;EACA;EACA;CACF,CAAC;CACD,MAAM,EACJ,UAAU,eACV,OAAO,YACP,UAAU,YACV,QACA,QACE;CAIJ,MAAM,EAAE,gBAAgB,gBAAgB,uBAAiC;EACvE;EACA;CACF,CAAC;CAGD,MAAM,mBAAmB,eAAe,UAAU;CAClD,MAAM,uBAAuB,iBAA+C;EAM1E,cADkB,YAFf,cAAsD,QAAQ,SAC/D,YAEoB,CAAC;CACzB;CAEA,MAAM,eAAgB,UAAU,IAC9B;;;;;;;;;;;;;;;;;;;;;;;;;CA6BF,MAAM,WAAW,CAAC,aAAa,UAAU;CAIzC,MAAM,UAAU,YAFd,eAAgB,WAAW,YAAa,aAAa,cAAc,IAE5B,GAAG;CAM5C,MAAM,uBAAuB,cAAc;CAC3C,MAAM,YACJ,CAAC,CAAC,SAAS,uBACT,qBAAA,UAAA,EAAA,UAAA,CACG,UAAU,QAAQ,QAAQ,MAC1B,uBACC,oBAAC,uBAAD,EAA+B,OAAS,CAAA,IACtC,IACJ,EAAA,CAAA,IACA;CAIN,MAAM,eAAe,oBAAC,sBAAD;EAA6B;EAAe;CAAS,CAAA;CAK1E,MAAM,EAAE,sBAAsB,eAAe,0BAC3C,SAAS;EACP;EACA,YAAY,EAEV,eAAe,MACjB;EACA,cAAc,KAAK,UAAU,KAAK;EAClC,WAAW;EACX,YAAY;EACZ;EACA,gBAAgB;CAClB,CAAC;CAQH,OAAO;EACL,WAHA,oBAAoB,OAAO,UAAU,WAAW,QAAQ;EAIxD;EACA;EACA;EACA,UAAU;EACV;EACA;EACA,OAAO;GACL,GAAG;GACH,OAAO;GACP,UAAU;EACZ;EACA;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;EACA,UAAU;EACV;EACA;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"index.js","names":["FieldCopyTestIdButton","FieldValidationError"],"sources":["../../../src/hooks/useUniformField/useUniformField.tsx","../../../src/hooks/useUniformField/index.ts"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { FieldError, FieldValues, Path } from 'react-hook-form';\nimport type { InputValueTransform } from '../useInputValueTransform/useInputValueTransform';\n\nimport React from 'react';\n\nimport { useDebounce } from '@fuf-stack/pixels';\n\nimport { isValueEmpty } from '../../helpers';\nimport FieldCopyTestIdButton from '../../partials/FieldCopyTestIdButton';\nimport FieldValidationError from '../../partials/FieldValidationError';\nimport { useController } from '../useController/useController';\nimport { useFormContext } from '../useFormContext/useFormContext';\nimport { useInput } from '../useInput/useInput';\nimport { useInputValueTransform } from '../useInputValueTransform/useInputValueTransform';\n\nexport interface UseUniformFieldParams<\n TFieldValues extends FieldValues = FieldValues,\n TDisplay = unknown,\n> {\n /** Form field name */\n name: Path<TFieldValues> & string;\n /** Custom aria-label for accessibility. If not provided, falls back to field name when no visible label exists */\n ariaLabel?: string;\n /** Disable the field */\n disabled?: boolean;\n /** Optional label content */\n label?: ReactNode;\n /** Optional explicit test id used to build stable test ids */\n testId?: string;\n /** Optional value transformation between form and display values */\n transform?: InputValueTransform<TDisplay>;\n /** Input type for special number handling */\n type?: 'text' | 'number' | 'password';\n}\n\nexport interface UseUniformFieldReturn<\n TFieldValues extends FieldValues = FieldValues,\n> {\n /** Computed aria-label fallback (field name) when no visible label exists. Components can override based on their accessibility needs (e.g., if placeholder provides sufficient context) */\n ariaLabel: string | undefined;\n /** react-hook-form control instance for advanced integrations */\n control: ReturnType<typeof useFormContext<TFieldValues>>['control'];\n /** Debug mode from Uniform provider */\n debugMode: ReturnType<typeof useFormContext<TFieldValues>>['debugMode'];\n /** Current value used to initialize uncontrolled components */\n defaultValue: unknown;\n /** Whether the field is currently disabled (from RHF) */\n disabled: boolean | undefined;\n /** Validation error(s) for the field */\n error: FieldError[] | undefined;\n /** Pre-built errorMessage node to plug into components */\n errorMessage: ReactNode | null;\n /** RHF controller field with transformed value/onChange (use this for simple components) */\n field: ReturnType<typeof useController<TFieldValues>>['field'];\n /** Helper to spread standardized error message props to underlying components */\n getErrorMessageProps: ReturnType<typeof useInput>['getErrorMessageProps'];\n /** Helper to spread standardized helper wrapper props (for spacing/animation) */\n getHelperWrapperProps: ReturnType<typeof useInput>['getHelperWrapperProps'];\n /** Helper to spread standardized label props to underlying components */\n getLabelProps: ReturnType<typeof useInput>['getLabelProps'];\n /** Access current form values (converted to validation-friendly format) */\n getValues: ReturnType<typeof useFormContext<TFieldValues>>['getValues'];\n /** Whether the field should show invalid state (debounced for smooth animations). True when field is invalid AND (dirty OR touched OR submitted) */\n invalid: boolean;\n /** Computed label node including optional test id copy button */\n label: ReactNode | null;\n /** onBlur handler from controller */\n onBlur: ReturnType<typeof useController<TFieldValues>>['field']['onBlur'];\n /** onChange handler from controller (with transform applied) */\n onChange: ReturnType<typeof useController<TFieldValues>>['field']['onChange'];\n /** Ref to forward to underlying control */\n ref: ReturnType<typeof useController<TFieldValues>>['field']['ref'];\n /** Whether the field is required according to validation schema */\n required: boolean;\n /** Reset a specific field in the form */\n resetField: ReturnType<typeof useFormContext<TFieldValues>>['resetField'];\n /** Generated HTML data-testid for the field */\n testId: string;\n}\n\n/**\n * Combines frequently used form field logic into a single hook.\n *\n * Provides:\n * - Enhanced form context (validation-aware state, `testId`, value transforms)\n * - Controller field with nullish conversion handling\n * - Value transformation via `transform` prop:\n * • Allows disentangled display and form values (e.g., string ↔ object, boolean ↔ array)\n * • Automatically applies `toDisplayValue` to field value for components\n * • Automatically applies `toFormValue` to display value when onChange is called\n * • Works with `type` prop for automatic number/string conversion\n * • Examples: storing objects while displaying strings, storing booleans as arrays, enriching values with metadata\n * - Debounced `invalid` state with smart timing:\n * • `true` (field becomes invalid): applies immediately so errors show right away\n * • `false` (field becomes valid): delayed 200ms to allow smooth exit animations\n * • Respects `prefers-reduced-motion` by skipping delays when user prefers reduced motion\n * - Smart `invalid` visibility (via `showInvalid`):\n * • Shows errors when field is dirty OR touched OR form has been submitted\n * • Prevents showing errors on pristine/untouched fields for better UX\n * • Works well for all field types (text inputs, checkboxes, radios, arrays)\n * - Prebuilt `errorMessage` React node using `FieldValidationError`\n * - Computed `label` node which appends a `FieldCopyTestIdButton` in\n * `debug-testids` mode\n * - `defaultValue` for uncontrolled defaults and all usual field handlers\n * - Access to form utilities: `control`, `getValues`, `resetField`\n * - Presentation helpers: `getLabelProps`, `getErrorMessageProps`,\n * `getHelperWrapperProps` for consistent wiring to underlying UI components\n */\nexport const useUniformField = <\n TFieldValues extends FieldValues = FieldValues,\n TDisplay = unknown,\n>(\n params: UseUniformFieldParams<TFieldValues, TDisplay>,\n): UseUniformFieldReturn<TFieldValues> => {\n const {\n name,\n ariaLabel: customAriaLabel,\n disabled = false,\n testId: explicitTestId,\n label,\n type,\n transform,\n } = params;\n\n const {\n control,\n debugMode,\n formState: { submitCount },\n getFieldState,\n getValues,\n resetField,\n } = useFormContext<TFieldValues>();\n\n const {\n error,\n invalid: rawInvalid,\n isDirty,\n isTouched,\n required,\n testId,\n } = getFieldState(name, explicitTestId);\n\n const { field } = useController<TFieldValues>({\n control,\n disabled,\n name,\n });\n const {\n onChange: fieldOnChange,\n value: fieldValue,\n disabled: isDisabled,\n onBlur,\n ref,\n } = field;\n\n // Get transform utilities (but don't apply them automatically)\n // Components can choose how to use them (directly or via useInputValueDebounce)\n const { toDisplayValue, toFormValue } = useInputValueTransform<TDisplay>({\n type,\n transform,\n });\n\n // For components without special needs: apply transform to value and onChange\n const transformedValue = toDisplayValue(fieldValue);\n const transformedOnChange = (eventOrValue: TDisplay | React.ChangeEvent) => {\n // Extract value from event or use value directly\n const displayValue =\n (eventOrValue as React.ChangeEvent<HTMLInputElement>)?.target?.value ??\n eventOrValue;\n const formValue = toFormValue(displayValue as TDisplay);\n fieldOnChange(formValue);\n };\n\n const defaultValue = (getValues() as Record<string, unknown>)?.[\n name as string\n ];\n\n /**\n * Determine when to show the invalid state to the user.\n *\n * Show errors when the field is invalid AND any of these conditions are met:\n * - Field has a user-entered value (show validation errors like format/length while typing)\n * - Field is touched (focused and blurred) - good for text inputs\n * - Form has been submitted - shows all errors after submit attempt\n *\n * Note: `hasValue` is gated by `isDirty` so invalid initial values do not\n * show errors just because resolver-backed validation state is available.\n * Newly added empty array elements can be dirty, but stay hidden until blur\n * because they do not have a value yet.\n *\n * This prevents showing errors on pristine/untouched/empty fields for better UX.\n * Examples:\n * - Text input: User loads form with empty required field → no error shown yet\n * - Text input: User types invalid content → error shows immediately (has value)\n * - Text input: User focuses and blurs without typing → error shows (via isTouched)\n * - Checkbox/radio: User selects option → error shows immediately (has value)\n * - Field array: User adds element → no error yet; after blur → error shows\n * - Any field: User submits form → all errors show (via submitCount)\n *\n * The entire condition is debounced to prevent flickering and allow smooth animations.\n */\n\n // isValueEmpty handles marker strings, flat array wrappers, empty arrays, and empty objects\n const hasValue = !isValueEmpty(fieldValue);\n const showInvalid =\n rawInvalid && ((isDirty && hasValue) || isTouched || submitCount > 0);\n // Debounce to prevent flickering during rapid state changes\n const invalid = useDebounce(showInvalid, 200);\n\n // Build a label node that:\n // - shows the provided label (unless explicitly set to false)\n // - appends a copy-to-clipboard button for the test id in `debug-testids` mode\n // Consumers can pass this directly to component `label` props\n const showTestIdCopyButton = debugMode === 'debug-testids';\n const labelNode: ReactNode | null =\n !!label || showTestIdCopyButton ? (\n <>\n {label !== false ? label : null}\n {showTestIdCopyButton ? (\n <FieldCopyTestIdButton testId={testId} />\n ) : null}\n </>\n ) : null;\n\n // Ready-to-render error message; consumers can drop this into their\n // component `errorMessage` prop without repeating mapping/markup\n const errorMessage = <FieldValidationError error={error} testId={testId} />;\n\n // Generate standardized props for label, helper wrapper and error message\n // so consumers can spread them directly into UI components (e.g. HeroUI),\n // keeping animations/spacing consistent across fields\n const { getErrorMessageProps, getLabelProps, getHelperWrapperProps } =\n useInput({\n ref,\n classNames: {\n // set padding to 0 for error message exit animation\n helperWrapper: 'p-0',\n },\n errorMessage: JSON.stringify(error),\n isInvalid: invalid,\n isRequired: required,\n label,\n labelPlacement: 'outside',\n });\n\n // Compute aria-label: prefer custom prop, then use string label if available, otherwise field name\n // Components can further override this based on their specific accessibility needs\n // (e.g., Input/TextArea may skip this if they have a meaningful placeholder)\n const ariaLabel =\n customAriaLabel ?? (typeof label === 'string' ? label : name);\n\n return {\n ariaLabel,\n control,\n debugMode,\n defaultValue,\n disabled: isDisabled,\n error,\n errorMessage,\n field: {\n ...field,\n value: transformedValue as typeof field.value,\n onChange: transformedOnChange as typeof field.onChange,\n },\n getErrorMessageProps,\n getHelperWrapperProps,\n getLabelProps,\n getValues,\n invalid,\n label: labelNode,\n onBlur,\n onChange: transformedOnChange as typeof field.onChange,\n ref,\n required,\n resetField,\n testId,\n };\n};\n","/* v8 ignore start */\n\nexport * from './useUniformField';\n\n/* v8 ignore stop */\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6GA,MAAa,mBAIX,WACwC;CACxC,MAAM,EACJ,MACA,WAAW,iBACX,WAAW,OACX,QAAQ,gBACR,OACA,MACA,cACE;CAEJ,MAAM,EACJ,SACA,WACA,WAAW,EAAE,eACb,eACA,WACA,eACE,eAA6B;CAEjC,MAAM,EACJ,OACA,SAAS,YACT,SACA,WACA,UACA,WACE,cAAc,MAAM,cAAc;CAEtC,MAAM,EAAE,UAAU,cAA4B;EAC5C;EACA;EACA;CACF,CAAC;CACD,MAAM,EACJ,UAAU,eACV,OAAO,YACP,UAAU,YACV,QACA,QACE;CAIJ,MAAM,EAAE,gBAAgB,gBAAgB,uBAAiC;EACvE;EACA;CACF,CAAC;CAGD,MAAM,mBAAmB,eAAe,UAAU;CAClD,MAAM,uBAAuB,iBAA+C;EAM1E,cADkB,YAFf,cAAsD,QAAQ,SAC/D,YAEoB,CAAC;CACzB;CAEA,MAAM,eAAgB,UAAU,IAC9B;;;;;;;;;;;;;;;;;;;;;;;;;CA6BF,MAAM,WAAW,CAAC,aAAa,UAAU;CAIzC,MAAM,UAAU,YAFd,eAAgB,WAAW,YAAa,aAAa,cAAc,IAE5B,GAAG;CAM5C,MAAM,uBAAuB,cAAc;CAC3C,MAAM,YACJ,CAAC,CAAC,SAAS,uBACT,qBAAA,UAAA,EAAA,UAAA,CACG,UAAU,QAAQ,QAAQ,MAC1B,uBACC,oBAACA,+BAAD,EAA+B,OAAS,CAAA,IACtC,IACJ,EAAA,CAAA,IACA;CAIN,MAAM,eAAe,oBAACC,8BAAD;EAA6B;EAAe;CAAS,CAAA;CAK1E,MAAM,EAAE,sBAAsB,eAAe,0BAC3C,SAAS;EACP;EACA,YAAY,EAEV,eAAe,MACjB;EACA,cAAc,KAAK,UAAU,KAAK;EAClC,WAAW;EACX,YAAY;EACZ;EACA,gBAAgB;CAClB,CAAC;CAQH,OAAO;EACL,WAHA,oBAAoB,OAAO,UAAU,WAAW,QAAQ;EAIxD;EACA;EACA;EACA,UAAU;EACV;EACA;EACA,OAAO;GACL,GAAG;GACH,OAAO;GACP,UAAU;EACZ;EACA;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;EACA,UAAU;EACV;EACA;EACA;EACA;CACF;AACF"}
@@ -1,7 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- require("../../FormContext-DsmS_mkO.cjs");
3
2
  const require_helpers_index = require("../../helpers/index.cjs");
4
- const require_useFormContext = require("../../useFormContext-CrXwNYiB.cjs");
3
+ const require_useFormContext = require("../../useFormContext-kUHonwgu.cjs");
5
4
  const require_hooks_useUniformField_index = require("../useUniformField/index.cjs");
6
5
  const require_hooks_useWatchFormReset_index = require("../useWatchFormReset/index.cjs");
7
6
  let react = require("react");
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["useUniformField","useFormContext","flatArrayKey","isValueEmpty"],"sources":["../../../src/hooks/useUniformFieldArray/useUniformFieldArray.ts","../../../src/hooks/useUniformFieldArray/index.ts"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { ArrayPath, FieldValues, Path } from 'react-hook-form';\n\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport { useFieldArray as useRHFFieldArray } from 'react-hook-form';\n\nimport { useReducedMotion } from '@fuf-stack/pixel-motion';\n\nimport { flatArrayKey, isValueEmpty } from '../../helpers';\nimport { useFormContext } from '../useFormContext';\nimport { useUniformField } from '../useUniformField';\nimport { useWatchFormReset } from '../useWatchFormReset';\n\nexport interface UseUniformFieldArrayProps<\n TFieldValues extends FieldValues = FieldValues,\n> {\n /** Field name for the array */\n name: ArrayPath<TFieldValues>;\n /** Whether this is a flat array (array of primitives) */\n flat?: boolean;\n /** Initial value for new array elements */\n elementInitialValue?: unknown;\n /** Whether the last element cannot be removed (always maintain at least one element) */\n lastElementNotRemovable?: boolean;\n /** Disable the field */\n disabled?: boolean;\n /** Optional explicit test id used to build stable test ids */\n testId?: string;\n /** Optional label content */\n label?: ReactNode;\n}\n\n/**\n * Enhanced useFieldArray hook with initialization and animation logic.\n * Based on React Hook Form's useFieldArray with additional features:\n * - Automatic initialization when lastElementNotRemovable is set\n * - Reset-only normalization for stale empty placeholder rows (via useWatchFormReset)\n * - Animation control (disabled during initialization)\n * - Temporary animation disable during reset normalization collapse\n * - Support for flat arrays (arrays of primitives)\n *\n * Note: Automatic validation triggering on length change is disabled to prevent\n * triggering form-wide validation. Array validation still runs on form submission.\n *\n * @see https://react-hook-form.com/docs/usefieldarray\n */\nexport const useUniformFieldArray = <\n TFieldValues extends FieldValues = FieldValues,\n>({\n name,\n flat = false,\n elementInitialValue: _elementInitialValue = null,\n lastElementNotRemovable = false,\n disabled,\n testId: explicitTestId,\n label,\n}: UseUniformFieldArrayProps<TFieldValues>) => {\n // Get uniform field state and utilities\n const uniformField = useUniformField<TFieldValues>({\n name: name as Path<TFieldValues> & string,\n disabled,\n testId: explicitTestId,\n label,\n });\n\n const { control } = uniformField;\n\n const { fields, append, remove, insert, move, replace } = useRHFFieldArray({\n control,\n name,\n });\n\n const { trigger, setValue, getValues } = useFormContext<TFieldValues>();\n\n // Determine if initialization is needed (initially or after reset).\n // lastElementNotRemovable is purely a minimum-count guarantee: when there are\n // no rows, add one. This handles both:\n // - Initial mount: fields.length starts at 0\n // - Form reset to an empty array: fields.length becomes 0 again\n // It intentionally does NOT inspect row contents, so manually added empty rows\n // are never collapsed.\n const needsInitialize = useMemo(() => {\n return lastElementNotRemovable && fields.length === 0;\n }, [lastElementNotRemovable, fields.length]);\n\n // Track whether initialization has completed. Initialized contextually:\n // - If initialization IS needed (needsInitialize = true): starts as false, set to true after init\n // - If initialization is NOT needed (needsInitialize = false): starts as true (already initialized)\n // This ref is used to:\n // 1. Skip validation during initialization/re-initialization\n // 2. Gate animation enabling until after initialization\n // 3. Gate motion preference effect until after initialization\n const hasInitialized = useRef(!needsInitialize);\n\n // Reset initialization flag when needsInitialize changes to true.\n // This handles form reset: when fields become empty (needsInitialize becomes true),\n // hasInitialized is reset to false, triggering re-initialization in the effect below.\n useEffect(() => {\n if (needsInitialize) {\n hasInitialized.current = false;\n }\n }, [needsInitialize]);\n\n // Validate array-level constraints (min/max items) when length changes.\n // This ensures min/max errors appear instantly when user adds/removes items.\n // Note: Child field validation also runs, but new empty fields won't show as invalid\n // because useFormContext only sets invalid=true for touched fields or after form submission.\n // Skip validation during initialization/re-initialization to avoid showing errors prematurely.\n useEffect(() => {\n if (hasInitialized.current) {\n setTimeout(() => {\n trigger(name as Path<TFieldValues>);\n }, 200);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [fields.length]);\n\n // Animation control: Start with animations disabled to prevent animating in initial elements.\n // Will be enabled after initialization completes (unless user prefers reduced motion).\n const [disableAnimation, setDisableAnimation] = useState(true);\n\n // Respond to user's motion preference changes (after initialization).\n // During initialization, animations stay disabled regardless of preference.\n const prefersReducedMotion = useReducedMotion();\n useEffect(() => {\n if (hasInitialized.current) {\n setDisableAnimation(!!prefersReducedMotion);\n }\n }, [prefersReducedMotion]);\n\n // Prepare initial element value based on mode\n // - flat=true: arrays of primitives → object with flatArrayKey and null value by default\n // - flat=false: arrays of objects → empty object by default\n const elementInitialValue = useMemo(() => {\n return flat\n ? { [flatArrayKey]: _elementInitialValue ?? null }\n : (_elementInitialValue ?? {});\n }, [flat, _elementInitialValue]);\n\n // Reset normalization:\n // Run ONLY when an actual form reset is emitted (via useWatchFormReset), not\n // on regular field edits. This does not collapse rows users add manually.\n //\n // Why this exists:\n // RHF can keep stale field-array rows after reset when array defaults are\n // missing (e.g. value becomes undefined or [null, null] while UI still has\n // multiple rows). We normalize this reset-only state to:\n // - one row when lastElementNotRemovable is enabled\n // - zero rows otherwise\n useWatchFormReset({\n onReset: () => {\n const currentValue = getValues(name as Path<TFieldValues>) as unknown;\n const valueIsArray = Array.isArray(currentValue);\n const arrayValue = valueIsArray ? (currentValue as unknown[]) : [];\n const normalizedLength = lastElementNotRemovable ? 1 : 0;\n const alreadyNormalized =\n valueIsArray && arrayValue.length === normalizedLength;\n\n // Treat these as \"effectively empty after reset\":\n // - value missing/not-array\n // - empty array\n // - array where all entries are empty placeholders\n const isEffectivelyEmptyAfterReset =\n !valueIsArray ||\n arrayValue.length === 0 ||\n arrayValue.every((entry) => {\n return isValueEmpty(entry);\n });\n\n // Nothing to fix when the reset restored real values (e.g. from defaults).\n if (!isEffectivelyEmptyAfterReset) {\n return;\n }\n\n // Already normalized to the target row count.\n if (alreadyNormalized) {\n return;\n }\n\n // Avoid collapse animation flicker during reset normalization.\n setDisableAnimation(true);\n\n // use replace so the RHF field-array length actually matches the target.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n replace((lastElementNotRemovable ? [elementInitialValue] : []) as any);\n\n // Restore normal animation state right after normalization.\n if (!prefersReducedMotion) {\n setTimeout(() => {\n setDisableAnimation(false);\n }, 1);\n }\n },\n });\n\n // Initialization/Re-initialization: add one element only when array length is 0.\n // This is the min-count behavior for lastElementNotRemovable and is intentionally\n // separate from reset normalization above.\n //\n // Reset behavior in this hook is split into two phases:\n // 1) Reset normalization (useWatchFormReset): collapse stale placeholder rows\n // left by reset edge cases.\n // 2) Length-based initialization (this effect): ensure a min-one array when\n // the field array is truly empty.\n // CRITICAL: This effect MUST be the LAST hook in this component.\n // It sets hasInitialized.current = true, which acts as a gate for other effects.\n // If this runs before other effects, hasInitialized will be true during their first run,\n // causing them to execute logic meant only for post-initialization (e.g., validation,\n // animation enabling). By placing this last, all other effects run first with\n // hasInitialized = false, allowing them to skip initialization-phase logic.\n useEffect(\n () => {\n if (needsInitialize) {\n // use setValue instead of append to avoid focusing the added element\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n setValue(name as Path<TFieldValues>, [elementInitialValue] as any, {\n shouldDirty: false,\n shouldTouch: false,\n });\n\n // Mark initialization as complete\n hasInitialized.current = true;\n\n // Enable animations after a brief delay (unless user prefers reduced motion or animations are already enabled).\n // This only runs on initial mount when animations start disabled.\n // On reset, disableAnimation is typically false, so this setTimeout won't run and animations stay enabled.\n if (!prefersReducedMotion && disableAnimation) {\n setTimeout(() => {\n setDisableAnimation(false);\n }, 1);\n }\n }\n },\n // Run when needsInitialize changes (initial mount or reset)\n // needsInitialize is memoized based on fields.length and lastElementNotRemovable\n // Other dependencies are intentionally omitted:\n // - append, setValue, trigger, setDisableAnimation are stable refs/functions\n // - elementInitialValue, name, flat, prefersReducedMotion, disableAnimation are props/stable values\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [needsInitialize],\n );\n\n return {\n // Field array methods and state\n fields,\n append,\n remove,\n insert,\n move,\n disableAnimation,\n elementInitialValue,\n // Uniform field state and utilities (spread all)\n ...uniformField,\n };\n};\n","/* v8 ignore start */\n\nexport * from './useUniformFieldArray';\n\n/* v8 ignore stop */\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA8CA,MAAa,wBAEX,EACA,MACA,OAAO,OACP,qBAAqB,uBAAuB,MAC5C,0BAA0B,OAC1B,UACA,QAAQ,gBACR,YAC6C;CAE7C,MAAM,eAAeA,oCAAAA,gBAA8B;EAC3C;EACN;EACA,QAAQ;EACR;CACF,CAAC;CAED,MAAM,EAAE,YAAY;CAEpB,MAAM,EAAE,QAAQ,QAAQ,QAAQ,QAAQ,MAAM,aAAA,GAAA,gBAAA,eAA6B;EACzE;EACA;CACF,CAAC;CAED,MAAM,EAAE,SAAS,UAAU,cAAcC,uBAAAA,eAA6B;CAStE,MAAM,mBAAA,GAAA,MAAA,eAAgC;EACpC,OAAO,2BAA2B,OAAO,WAAW;CACtD,GAAG,CAAC,yBAAyB,OAAO,MAAM,CAAC;CAS3C,MAAM,kBAAA,GAAA,MAAA,QAAwB,CAAC,eAAe;CAK9C,CAAA,GAAA,MAAA,iBAAgB;EACd,IAAI,iBACF,eAAe,UAAU;CAE7B,GAAG,CAAC,eAAe,CAAC;CAOpB,CAAA,GAAA,MAAA,iBAAgB;EACd,IAAI,eAAe,SACjB,iBAAiB;GACf,QAAQ,IAA0B;EACpC,GAAG,GAAG;CAGV,GAAG,CAAC,OAAO,MAAM,CAAC;CAIlB,MAAM,CAAC,kBAAkB,wBAAA,GAAA,MAAA,UAAgC,IAAI;CAI7D,MAAM,wBAAA,GAAA,wBAAA,kBAAwC;CAC9C,CAAA,GAAA,MAAA,iBAAgB;EACd,IAAI,eAAe,SACjB,oBAAoB,CAAC,CAAC,oBAAoB;CAE9C,GAAG,CAAC,oBAAoB,CAAC;CAKzB,MAAM,uBAAA,GAAA,MAAA,eAAoC;EACxC,OAAO,OACH,GAAGC,sBAAAA,eAAe,wBAAwB,KAAK,IAC9C,wBAAwB,CAAC;CAChC,GAAG,CAAC,MAAM,oBAAoB,CAAC;CAY/B,sCAAA,kBAAkB,EAChB,eAAe;EACb,MAAM,eAAe,UAAU,IAA0B;EACzD,MAAM,eAAe,MAAM,QAAQ,YAAY;EAC/C,MAAM,aAAa,eAAgB,eAA6B,CAAC;EACjE,MAAM,mBAAmB,0BAA0B,IAAI;EACvD,MAAM,oBACJ,gBAAgB,WAAW,WAAW;EAcxC,IAAI,EAPF,CAAC,gBACD,WAAW,WAAW,KACtB,WAAW,OAAO,UAAU;GAC1B,OAAOC,sBAAAA,aAAa,KAAK;EAC3B,CAAC,IAID;EAIF,IAAI,mBACF;EAIF,oBAAoB,IAAI;EAIxB,QAAS,0BAA0B,CAAC,mBAAmB,IAAI,CAAC,CAAS;EAGrE,IAAI,CAAC,sBACH,iBAAiB;GACf,oBAAoB,KAAK;EAC3B,GAAG,CAAC;CAER,EACF,CAAC;CAiBD,CAAA,GAAA,MAAA,iBACQ;EACJ,IAAI,iBAAiB;GAGnB,SAAS,MAA4B,CAAC,mBAAmB,GAAU;IACjE,aAAa;IACb,aAAa;GACf,CAAC;GAGD,eAAe,UAAU;GAKzB,IAAI,CAAC,wBAAwB,kBAC3B,iBAAiB;IACf,oBAAoB,KAAK;GAC3B,GAAG,CAAC;EAER;CACF,GAOA,CAAC,eAAe,CAClB;CAEA,OAAO;EAEL;EACA;EACA;EACA;EACA;EACA;EACA;EAEA,GAAG;CACL;AACF"}
1
+ {"version":3,"file":"index.cjs","names":["useUniformField","useFormContext","flatArrayKey","isValueEmpty"],"sources":["../../../src/hooks/useUniformFieldArray/useUniformFieldArray.ts","../../../src/hooks/useUniformFieldArray/index.ts"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { ArrayPath, FieldValues, Path } from 'react-hook-form';\n\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport { useFieldArray as useRHFFieldArray } from 'react-hook-form';\n\nimport { useReducedMotion } from '@fuf-stack/pixel-motion';\n\nimport { flatArrayKey, isValueEmpty } from '../../helpers';\nimport { useFormContext } from '../useFormContext';\nimport { useUniformField } from '../useUniformField';\nimport { useWatchFormReset } from '../useWatchFormReset';\n\nexport interface UseUniformFieldArrayProps<\n TFieldValues extends FieldValues = FieldValues,\n> {\n /** Field name for the array */\n name: ArrayPath<TFieldValues>;\n /** Whether this is a flat array (array of primitives) */\n flat?: boolean;\n /** Initial value for new array elements */\n elementInitialValue?: unknown;\n /** Whether the last element cannot be removed (always maintain at least one element) */\n lastElementNotRemovable?: boolean;\n /** Disable the field */\n disabled?: boolean;\n /** Optional explicit test id used to build stable test ids */\n testId?: string;\n /** Optional label content */\n label?: ReactNode;\n}\n\n/**\n * Enhanced useFieldArray hook with initialization and animation logic.\n * Based on React Hook Form's useFieldArray with additional features:\n * - Automatic initialization when lastElementNotRemovable is set\n * - Reset-only normalization for stale empty placeholder rows (via useWatchFormReset)\n * - Animation control (disabled during initialization)\n * - Temporary animation disable during reset normalization collapse\n * - Support for flat arrays (arrays of primitives)\n *\n * Note: Automatic validation triggering on length change is disabled to prevent\n * triggering form-wide validation. Array validation still runs on form submission.\n *\n * @see https://react-hook-form.com/docs/usefieldarray\n */\nexport const useUniformFieldArray = <\n TFieldValues extends FieldValues = FieldValues,\n>({\n name,\n flat = false,\n elementInitialValue: _elementInitialValue = null,\n lastElementNotRemovable = false,\n disabled,\n testId: explicitTestId,\n label,\n}: UseUniformFieldArrayProps<TFieldValues>) => {\n // Get uniform field state and utilities\n const uniformField = useUniformField<TFieldValues>({\n name: name as Path<TFieldValues> & string,\n disabled,\n testId: explicitTestId,\n label,\n });\n\n const { control } = uniformField;\n\n const { fields, append, remove, insert, move, replace } = useRHFFieldArray({\n control,\n name,\n });\n\n const { trigger, setValue, getValues } = useFormContext<TFieldValues>();\n\n // Determine if initialization is needed (initially or after reset).\n // lastElementNotRemovable is purely a minimum-count guarantee: when there are\n // no rows, add one. This handles both:\n // - Initial mount: fields.length starts at 0\n // - Form reset to an empty array: fields.length becomes 0 again\n // It intentionally does NOT inspect row contents, so manually added empty rows\n // are never collapsed.\n const needsInitialize = useMemo(() => {\n return lastElementNotRemovable && fields.length === 0;\n }, [lastElementNotRemovable, fields.length]);\n\n // Track whether initialization has completed. Initialized contextually:\n // - If initialization IS needed (needsInitialize = true): starts as false, set to true after init\n // - If initialization is NOT needed (needsInitialize = false): starts as true (already initialized)\n // This ref is used to:\n // 1. Skip validation during initialization/re-initialization\n // 2. Gate animation enabling until after initialization\n // 3. Gate motion preference effect until after initialization\n const hasInitialized = useRef(!needsInitialize);\n\n // Reset initialization flag when needsInitialize changes to true.\n // This handles form reset: when fields become empty (needsInitialize becomes true),\n // hasInitialized is reset to false, triggering re-initialization in the effect below.\n useEffect(() => {\n if (needsInitialize) {\n hasInitialized.current = false;\n }\n }, [needsInitialize]);\n\n // Validate array-level constraints (min/max items) when length changes.\n // This ensures min/max errors appear instantly when user adds/removes items.\n // Note: Child field validation also runs, but new empty fields won't show as invalid\n // because useFormContext only sets invalid=true for touched fields or after form submission.\n // Skip validation during initialization/re-initialization to avoid showing errors prematurely.\n useEffect(() => {\n if (hasInitialized.current) {\n setTimeout(() => {\n trigger(name as Path<TFieldValues>);\n }, 200);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [fields.length]);\n\n // Animation control: Start with animations disabled to prevent animating in initial elements.\n // Will be enabled after initialization completes (unless user prefers reduced motion).\n const [disableAnimation, setDisableAnimation] = useState(true);\n\n // Respond to user's motion preference changes (after initialization).\n // During initialization, animations stay disabled regardless of preference.\n const prefersReducedMotion = useReducedMotion();\n useEffect(() => {\n if (hasInitialized.current) {\n setDisableAnimation(!!prefersReducedMotion);\n }\n }, [prefersReducedMotion]);\n\n // Prepare initial element value based on mode\n // - flat=true: arrays of primitives → object with flatArrayKey and null value by default\n // - flat=false: arrays of objects → empty object by default\n const elementInitialValue = useMemo(() => {\n return flat\n ? { [flatArrayKey]: _elementInitialValue ?? null }\n : (_elementInitialValue ?? {});\n }, [flat, _elementInitialValue]);\n\n // Reset normalization:\n // Run ONLY when an actual form reset is emitted (via useWatchFormReset), not\n // on regular field edits. This does not collapse rows users add manually.\n //\n // Why this exists:\n // RHF can keep stale field-array rows after reset when array defaults are\n // missing (e.g. value becomes undefined or [null, null] while UI still has\n // multiple rows). We normalize this reset-only state to:\n // - one row when lastElementNotRemovable is enabled\n // - zero rows otherwise\n useWatchFormReset({\n onReset: () => {\n const currentValue = getValues(name as Path<TFieldValues>) as unknown;\n const valueIsArray = Array.isArray(currentValue);\n const arrayValue = valueIsArray ? (currentValue as unknown[]) : [];\n const normalizedLength = lastElementNotRemovable ? 1 : 0;\n const alreadyNormalized =\n valueIsArray && arrayValue.length === normalizedLength;\n\n // Treat these as \"effectively empty after reset\":\n // - value missing/not-array\n // - empty array\n // - array where all entries are empty placeholders\n const isEffectivelyEmptyAfterReset =\n !valueIsArray ||\n arrayValue.length === 0 ||\n arrayValue.every((entry) => {\n return isValueEmpty(entry);\n });\n\n // Nothing to fix when the reset restored real values (e.g. from defaults).\n if (!isEffectivelyEmptyAfterReset) {\n return;\n }\n\n // Already normalized to the target row count.\n if (alreadyNormalized) {\n return;\n }\n\n // Avoid collapse animation flicker during reset normalization.\n setDisableAnimation(true);\n\n // use replace so the RHF field-array length actually matches the target.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n replace((lastElementNotRemovable ? [elementInitialValue] : []) as any);\n\n // Restore normal animation state right after normalization.\n if (!prefersReducedMotion) {\n setTimeout(() => {\n setDisableAnimation(false);\n }, 1);\n }\n },\n });\n\n // Initialization/Re-initialization: add one element only when array length is 0.\n // This is the min-count behavior for lastElementNotRemovable and is intentionally\n // separate from reset normalization above.\n //\n // Reset behavior in this hook is split into two phases:\n // 1) Reset normalization (useWatchFormReset): collapse stale placeholder rows\n // left by reset edge cases.\n // 2) Length-based initialization (this effect): ensure a min-one array when\n // the field array is truly empty.\n // CRITICAL: This effect MUST be the LAST hook in this component.\n // It sets hasInitialized.current = true, which acts as a gate for other effects.\n // If this runs before other effects, hasInitialized will be true during their first run,\n // causing them to execute logic meant only for post-initialization (e.g., validation,\n // animation enabling). By placing this last, all other effects run first with\n // hasInitialized = false, allowing them to skip initialization-phase logic.\n useEffect(\n () => {\n if (needsInitialize) {\n // use setValue instead of append to avoid focusing the added element\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n setValue(name as Path<TFieldValues>, [elementInitialValue] as any, {\n shouldDirty: false,\n shouldTouch: false,\n });\n\n // Mark initialization as complete\n hasInitialized.current = true;\n\n // Enable animations after a brief delay (unless user prefers reduced motion or animations are already enabled).\n // This only runs on initial mount when animations start disabled.\n // On reset, disableAnimation is typically false, so this setTimeout won't run and animations stay enabled.\n if (!prefersReducedMotion && disableAnimation) {\n setTimeout(() => {\n setDisableAnimation(false);\n }, 1);\n }\n }\n },\n // Run when needsInitialize changes (initial mount or reset)\n // needsInitialize is memoized based on fields.length and lastElementNotRemovable\n // Other dependencies are intentionally omitted:\n // - append, setValue, trigger, setDisableAnimation are stable refs/functions\n // - elementInitialValue, name, flat, prefersReducedMotion, disableAnimation are props/stable values\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [needsInitialize],\n );\n\n return {\n // Field array methods and state\n fields,\n append,\n remove,\n insert,\n move,\n disableAnimation,\n elementInitialValue,\n // Uniform field state and utilities (spread all)\n ...uniformField,\n };\n};\n","/* v8 ignore start */\n\nexport * from './useUniformFieldArray';\n\n/* v8 ignore stop */\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA8CA,MAAa,wBAEX,EACA,MACA,OAAO,OACP,qBAAqB,uBAAuB,MAC5C,0BAA0B,OAC1B,UACA,QAAQ,gBACR,YAC6C;CAE7C,MAAM,eAAeA,oCAAAA,gBAA8B;EAC3C;EACN;EACA,QAAQ;EACR;CACF,CAAC;CAED,MAAM,EAAE,YAAY;CAEpB,MAAM,EAAE,QAAQ,QAAQ,QAAQ,QAAQ,MAAM,aAAA,GAAA,gBAAA,eAA6B;EACzE;EACA;CACF,CAAC;CAED,MAAM,EAAE,SAAS,UAAU,cAAcC,uBAAAA,eAA6B;CAStE,MAAM,mBAAA,GAAA,MAAA,eAAgC;EACpC,OAAO,2BAA2B,OAAO,WAAW;CACtD,GAAG,CAAC,yBAAyB,OAAO,MAAM,CAAC;CAS3C,MAAM,kBAAA,GAAA,MAAA,QAAwB,CAAC,eAAe;CAK9C,CAAA,GAAA,MAAA,iBAAgB;EACd,IAAI,iBACF,eAAe,UAAU;CAE7B,GAAG,CAAC,eAAe,CAAC;CAOpB,CAAA,GAAA,MAAA,iBAAgB;EACd,IAAI,eAAe,SACjB,iBAAiB;GACf,QAAQ,IAA0B;EACpC,GAAG,GAAG;CAGV,GAAG,CAAC,OAAO,MAAM,CAAC;CAIlB,MAAM,CAAC,kBAAkB,wBAAA,GAAA,MAAA,UAAgC,IAAI;CAI7D,MAAM,wBAAA,GAAA,wBAAA,kBAAwC;CAC9C,CAAA,GAAA,MAAA,iBAAgB;EACd,IAAI,eAAe,SACjB,oBAAoB,CAAC,CAAC,oBAAoB;CAE9C,GAAG,CAAC,oBAAoB,CAAC;CAKzB,MAAM,uBAAA,GAAA,MAAA,eAAoC;EACxC,OAAO,OACH,GAAGC,sBAAAA,eAAe,wBAAwB,KAAK,IAC9C,wBAAwB,CAAC;CAChC,GAAG,CAAC,MAAM,oBAAoB,CAAC;CAY/B,sCAAA,kBAAkB,EAChB,eAAe;EACb,MAAM,eAAe,UAAU,IAA0B;EACzD,MAAM,eAAe,MAAM,QAAQ,YAAY;EAC/C,MAAM,aAAa,eAAgB,eAA6B,CAAC;EACjE,MAAM,mBAAmB,0BAA0B,IAAI;EACvD,MAAM,oBACJ,gBAAgB,WAAW,WAAW;EAcxC,IAAI,EAPF,CAAC,gBACD,WAAW,WAAW,KACtB,WAAW,OAAO,UAAU;GAC1B,OAAOC,sBAAAA,aAAa,KAAK;EAC3B,CAAC,IAID;EAIF,IAAI,mBACF;EAIF,oBAAoB,IAAI;EAIxB,QAAS,0BAA0B,CAAC,mBAAmB,IAAI,CAAC,CAAS;EAGrE,IAAI,CAAC,sBACH,iBAAiB;GACf,oBAAoB,KAAK;EAC3B,GAAG,CAAC;CAER,EACF,CAAC;CAiBD,CAAA,GAAA,MAAA,iBACQ;EACJ,IAAI,iBAAiB;GAGnB,SAAS,MAA4B,CAAC,mBAAmB,GAAU;IACjE,aAAa;IACb,aAAa;GACf,CAAC;GAGD,eAAe,UAAU;GAKzB,IAAI,CAAC,wBAAwB,kBAC3B,iBAAiB;IACf,oBAAoB,KAAK;GAC3B,GAAG,CAAC;EAER;CACF,GAOA,CAAC,eAAe,CAClB;CAEA,OAAO;EAEL;EACA;EACA;EACA;EACA;EACA;EACA;EAEA,GAAG;CACL;AACF"}
@@ -1,2 +1,79 @@
1
- import { n as useUniformFieldArray, t as UseUniformFieldArrayProps } from "../../useUniformFieldArray-D3fdzwzD.cjs";
2
- export { UseUniformFieldArrayProps, useUniformFieldArray };
1
+ import { r as useController } from "../../useController-fblEApv_.cjs";
2
+ import { n as useFormContext } from "../../useFormContext-D5vrT2sg.cjs";
3
+ import { ReactNode } from "react";
4
+ import { ArrayPath, FieldValues } from "react-hook-form";
5
+
6
+ //#region src/hooks/useUniformFieldArray/useUniformFieldArray.d.ts
7
+ interface UseUniformFieldArrayProps<TFieldValues extends FieldValues = FieldValues> {
8
+ /** Field name for the array */
9
+ name: ArrayPath<TFieldValues>;
10
+ /** Whether this is a flat array (array of primitives) */
11
+ flat?: boolean;
12
+ /** Initial value for new array elements */
13
+ elementInitialValue?: unknown;
14
+ /** Whether the last element cannot be removed (always maintain at least one element) */
15
+ lastElementNotRemovable?: boolean;
16
+ /** Disable the field */
17
+ disabled?: boolean;
18
+ /** Optional explicit test id used to build stable test ids */
19
+ testId?: string;
20
+ /** Optional label content */
21
+ label?: ReactNode;
22
+ }
23
+ /**
24
+ * Enhanced useFieldArray hook with initialization and animation logic.
25
+ * Based on React Hook Form's useFieldArray with additional features:
26
+ * - Automatic initialization when lastElementNotRemovable is set
27
+ * - Reset-only normalization for stale empty placeholder rows (via useWatchFormReset)
28
+ * - Animation control (disabled during initialization)
29
+ * - Temporary animation disable during reset normalization collapse
30
+ * - Support for flat arrays (arrays of primitives)
31
+ *
32
+ * Note: Automatic validation triggering on length change is disabled to prevent
33
+ * triggering form-wide validation. Array validation still runs on form submission.
34
+ *
35
+ * @see https://react-hook-form.com/docs/usefieldarray
36
+ */
37
+ declare const useUniformFieldArray: <TFieldValues extends FieldValues = FieldValues>({
38
+ name,
39
+ flat,
40
+ elementInitialValue: _elementInitialValue,
41
+ lastElementNotRemovable,
42
+ disabled,
43
+ testId: explicitTestId,
44
+ label
45
+ }: UseUniformFieldArrayProps<TFieldValues>) => {
46
+ ariaLabel: string | undefined;
47
+ control: import("react-hook-form").Control<TFieldValues, any, TFieldValues>;
48
+ debugMode: ReturnType<typeof useFormContext<TFieldValues_1>>["debugMode"];
49
+ defaultValue: unknown;
50
+ disabled: boolean | undefined;
51
+ error: import("react-hook-form").FieldError[] | undefined;
52
+ errorMessage: ReactNode | null;
53
+ field: Omit<import("react-hook-form").ControllerRenderProps<TFieldValues>, "onChange" | "value"> & {
54
+ onChange: (...event: any[]) => void;
55
+ value: string;
56
+ };
57
+ getErrorMessageProps: ReturnType<typeof import("@heroui/input").useInput>["getErrorMessageProps"];
58
+ getHelperWrapperProps: ReturnType<typeof import("@heroui/input").useInput>["getHelperWrapperProps"];
59
+ getLabelProps: ReturnType<typeof import("@heroui/input").useInput>["getLabelProps"];
60
+ getValues: import("react-hook-form").UseFormGetValues<TFieldValues>;
61
+ invalid: boolean;
62
+ label: ReactNode | null;
63
+ onBlur: ReturnType<typeof useController>["field"]["onBlur"];
64
+ onChange: ReturnType<typeof useController>["field"]["onChange"];
65
+ ref: ReturnType<typeof useController>["field"]["ref"];
66
+ required: boolean;
67
+ resetField: import("react-hook-form").UseFormResetField<TFieldValues>;
68
+ testId: string;
69
+ fields: import("react-hook-form").FieldArrayWithId<TFieldValues, ArrayPath<TFieldValues>, "id">[];
70
+ append: import("react-hook-form").UseFieldArrayAppend<TFieldValues, ArrayPath<TFieldValues>>;
71
+ remove: import("react-hook-form").UseFieldArrayRemove;
72
+ insert: import("react-hook-form").UseFieldArrayInsert<TFieldValues, ArrayPath<TFieldValues>>;
73
+ move: import("react-hook-form").UseFieldArrayMove;
74
+ disableAnimation: boolean;
75
+ elementInitialValue: {};
76
+ };
77
+ //#endregion
78
+ export { UseUniformFieldArrayProps, useUniformFieldArray };
79
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../../../src/hooks/useUniformFieldArray/useUniformFieldArray.ts"],"mappings":";;;;;;UAaiB,yBAAA,sBACM,WAAA,GAAc,WAAA;;EAGnC,IAAA,EAAM,SAAA,CAAU,YAAA;;EAEhB,IAAA;EANe;EAQf,mBAAA;EARwC;EAUxC,uBAAA;EATmC;EAWnC,QAAA;EARM;EAUN,MAAA;EAEiB;EAAjB,KAAA,GAAQ,SAAA;AAAA;;;;;;;;;;;;;;AAAS;cAiBN,oBAAA,wBACU,WAAA,GAAc,WAAA;EACnC,IAAA;EAAA,IAAA;EAAA,mBAAA,EAAA,oBAAA;EAAA,uBAAA;EAAA,QAAA;EAAA,MAAA,EAAA,cAAA;EAAA;AAAA,GAQC,yBAAA,CAA0B,YAAA;;;;;;;;;kBAnCR,KAAA;;;;;;;;;UAoEZ,UAAA;YAEuB,UAAA,QAFvB,aAAA;OAK4B,UAAA,QAHL,aAAA"}
@@ -1,2 +1,79 @@
1
- import { n as useUniformFieldArray, t as UseUniformFieldArrayProps } from "../../useUniformFieldArray-zGcIhwhF.js";
2
- export { UseUniformFieldArrayProps, useUniformFieldArray };
1
+ import { r as useController$1 } from "../../useController-CvQqCvFJ.js";
2
+ import { n as useFormContext$1 } from "../../useFormContext-B1-deU4Z.js";
3
+ import { ReactNode } from "react";
4
+ import { ArrayPath, FieldValues } from "react-hook-form";
5
+
6
+ //#region src/hooks/useUniformFieldArray/useUniformFieldArray.d.ts
7
+ interface UseUniformFieldArrayProps<TFieldValues extends FieldValues = FieldValues> {
8
+ /** Field name for the array */
9
+ name: ArrayPath<TFieldValues>;
10
+ /** Whether this is a flat array (array of primitives) */
11
+ flat?: boolean;
12
+ /** Initial value for new array elements */
13
+ elementInitialValue?: unknown;
14
+ /** Whether the last element cannot be removed (always maintain at least one element) */
15
+ lastElementNotRemovable?: boolean;
16
+ /** Disable the field */
17
+ disabled?: boolean;
18
+ /** Optional explicit test id used to build stable test ids */
19
+ testId?: string;
20
+ /** Optional label content */
21
+ label?: ReactNode;
22
+ }
23
+ /**
24
+ * Enhanced useFieldArray hook with initialization and animation logic.
25
+ * Based on React Hook Form's useFieldArray with additional features:
26
+ * - Automatic initialization when lastElementNotRemovable is set
27
+ * - Reset-only normalization for stale empty placeholder rows (via useWatchFormReset)
28
+ * - Animation control (disabled during initialization)
29
+ * - Temporary animation disable during reset normalization collapse
30
+ * - Support for flat arrays (arrays of primitives)
31
+ *
32
+ * Note: Automatic validation triggering on length change is disabled to prevent
33
+ * triggering form-wide validation. Array validation still runs on form submission.
34
+ *
35
+ * @see https://react-hook-form.com/docs/usefieldarray
36
+ */
37
+ declare const useUniformFieldArray: <TFieldValues extends FieldValues = FieldValues>({
38
+ name,
39
+ flat,
40
+ elementInitialValue: _elementInitialValue,
41
+ lastElementNotRemovable,
42
+ disabled,
43
+ testId: explicitTestId,
44
+ label
45
+ }: UseUniformFieldArrayProps<TFieldValues>) => {
46
+ ariaLabel: string | undefined;
47
+ control: import("react-hook-form").Control<TFieldValues, any, TFieldValues>;
48
+ debugMode: ReturnType<typeof useFormContext$1<TFieldValues_1>>["debugMode"];
49
+ defaultValue: unknown;
50
+ disabled: boolean | undefined;
51
+ error: import("react-hook-form").FieldError[] | undefined;
52
+ errorMessage: ReactNode | null;
53
+ field: Omit<import("react-hook-form").ControllerRenderProps<TFieldValues>, "onChange" | "value"> & {
54
+ onChange: (...event: any[]) => void;
55
+ value: string;
56
+ };
57
+ getErrorMessageProps: ReturnType<typeof import("@heroui/input").useInput>["getErrorMessageProps"];
58
+ getHelperWrapperProps: ReturnType<typeof import("@heroui/input").useInput>["getHelperWrapperProps"];
59
+ getLabelProps: ReturnType<typeof import("@heroui/input").useInput>["getLabelProps"];
60
+ getValues: import("react-hook-form").UseFormGetValues<TFieldValues>;
61
+ invalid: boolean;
62
+ label: ReactNode | null;
63
+ onBlur: ReturnType<typeof useController$1>["field"]["onBlur"];
64
+ onChange: ReturnType<typeof useController$1>["field"]["onChange"];
65
+ ref: ReturnType<typeof useController$1>["field"]["ref"];
66
+ required: boolean;
67
+ resetField: import("react-hook-form").UseFormResetField<TFieldValues>;
68
+ testId: string;
69
+ fields: import("react-hook-form").FieldArrayWithId<TFieldValues, ArrayPath<TFieldValues>, "id">[];
70
+ append: import("react-hook-form").UseFieldArrayAppend<TFieldValues, ArrayPath<TFieldValues>>;
71
+ remove: import("react-hook-form").UseFieldArrayRemove;
72
+ insert: import("react-hook-form").UseFieldArrayInsert<TFieldValues, ArrayPath<TFieldValues>>;
73
+ move: import("react-hook-form").UseFieldArrayMove;
74
+ disableAnimation: boolean;
75
+ elementInitialValue: {};
76
+ };
77
+ //#endregion
78
+ export { UseUniformFieldArrayProps, useUniformFieldArray };
79
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/hooks/useUniformFieldArray/useUniformFieldArray.ts"],"mappings":";;;;;;UAaiB,yBAAA,sBACM,WAAA,GAAc,WAAA;;EAGnC,IAAA,EAAM,SAAA,CAAU,YAAA;;EAEhB,IAAA;EANe;EAQf,mBAAA;EARwC;EAUxC,uBAAA;EATmC;EAWnC,QAAA;EARM;EAUN,MAAA;EAEiB;EAAjB,KAAA,GAAQ,SAAA;AAAA;;;;;;;;;;;;;;AAAS;cAiBN,oBAAA,wBACU,WAAA,GAAc,WAAA;EACnC,IAAA;EAAA,IAAA;EAAA,mBAAA,EAAA,oBAAA;EAAA,uBAAA;EAAA,QAAA;EAAA,MAAA,EAAA,cAAA;EAAA;AAAA,GAQC,yBAAA,CAA0B,YAAA;;;;;;;;;kBAnCR,KAAA;;;;;;;;;UAoEZ,UAAA;YAEuB,UAAA,QAFvB,eAAA;OAK4B,UAAA,QAHL,eAAA"}
@@ -1,5 +1,5 @@
1
1
  import { flatArrayKey, isValueEmpty } from "../../helpers/index.js";
2
- import { n as useFormContext$1 } from "../../useFormContext-CT8H8xIe.js";
2
+ import { n as useFormContext$1 } from "../../useFormContext-BJqa1FoT.js";
3
3
  import { useUniformField } from "../useUniformField/index.js";
4
4
  import { useWatchFormReset } from "../useWatchFormReset/index.js";
5
5
  import { useEffect, useMemo, useRef, useState } from "react";
@@ -1,6 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- require("../../FormContext-DsmS_mkO.cjs");
3
- const require_useFormContext = require("../../useFormContext-CrXwNYiB.cjs");
2
+ const require_useFormContext = require("../../useFormContext-kUHonwgu.cjs");
4
3
  let react = require("react");
5
4
  //#region src/hooks/useWatchFormReset/useWatchFormReset.ts
6
5
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["useFormContext"],"sources":["../../../src/hooks/useWatchFormReset/useWatchFormReset.ts","../../../src/hooks/useWatchFormReset/index.ts"],"sourcesContent":["import { useEffect } from 'react';\n\nimport { useFormContext } from '../useFormContext/useFormContext';\n\nexport interface UseWatchFormResetOptions {\n /**\n * Callback that runs whenever a programmatic form reset is observed.\n *\n * Resets are signalled via the uniform `formReset` pub/sub channel. The event\n * is emitted by the wrapped `reset()` method in `useFormContext`.\n *\n * Current primary use case:\n * - `useUniformFieldArray` listens for reset events to normalize stale\n * placeholder rows left by RHF after reset when array defaults are missing.\n */\n onReset: () => void;\n}\n\n/**\n * Hook that watches for programmatic form reset events.\n *\n * It lets consumers run a callback when a programmatic form reset is triggered\n * through the wrapped `reset()` from `useFormContext`.\n *\n * Why this exists:\n * - Components should not infer \"a reset happened\" from field values alone.\n * Value-based heuristics can conflict with valid user interactions.\n * - This hook provides an explicit reset signal so components can run\n * reset-only logic safely.\n *\n * Current usage:\n * - `useUniformFieldArray` uses this hook to handle resets when no default\n * array value was provided. In that case, RHF can leave stale empty\n * placeholder rows. It normalizes only on reset and does not collapse rows\n * during normal editing.\n */\nexport const useWatchFormReset = ({ onReset }: UseWatchFormResetOptions) => {\n const { formReset } = useFormContext();\n\n useEffect(() => {\n const listener = () => {\n onReset();\n };\n\n const unsubscribe = formReset.subscribe(listener);\n return unsubscribe;\n }, [formReset, onReset]);\n};\n","/* v8 ignore start */\n\nexport * from './useWatchFormReset';\n\n/* v8 ignore stop */\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAa,qBAAqB,EAAE,cAAwC;CAC1E,MAAM,EAAE,cAAcA,uBAAAA,eAAe;CAErC,CAAA,GAAA,MAAA,iBAAgB;EACd,MAAM,iBAAiB;GACrB,QAAQ;EACV;EAGA,OADoB,UAAU,UAAU,QACvB;CACnB,GAAG,CAAC,WAAW,OAAO,CAAC;AACzB"}
1
+ {"version":3,"file":"index.cjs","names":["useFormContext"],"sources":["../../../src/hooks/useWatchFormReset/useWatchFormReset.ts","../../../src/hooks/useWatchFormReset/index.ts"],"sourcesContent":["import { useEffect } from 'react';\n\nimport { useFormContext } from '../useFormContext/useFormContext';\n\nexport interface UseWatchFormResetOptions {\n /**\n * Callback that runs whenever a programmatic form reset is observed.\n *\n * Resets are signalled via the uniform `formReset` pub/sub channel. The event\n * is emitted by the wrapped `reset()` method in `useFormContext`.\n *\n * Current primary use case:\n * - `useUniformFieldArray` listens for reset events to normalize stale\n * placeholder rows left by RHF after reset when array defaults are missing.\n */\n onReset: () => void;\n}\n\n/**\n * Hook that watches for programmatic form reset events.\n *\n * It lets consumers run a callback when a programmatic form reset is triggered\n * through the wrapped `reset()` from `useFormContext`.\n *\n * Why this exists:\n * - Components should not infer \"a reset happened\" from field values alone.\n * Value-based heuristics can conflict with valid user interactions.\n * - This hook provides an explicit reset signal so components can run\n * reset-only logic safely.\n *\n * Current usage:\n * - `useUniformFieldArray` uses this hook to handle resets when no default\n * array value was provided. In that case, RHF can leave stale empty\n * placeholder rows. It normalizes only on reset and does not collapse rows\n * during normal editing.\n */\nexport const useWatchFormReset = ({ onReset }: UseWatchFormResetOptions) => {\n const { formReset } = useFormContext();\n\n useEffect(() => {\n const listener = () => {\n onReset();\n };\n\n const unsubscribe = formReset.subscribe(listener);\n return unsubscribe;\n }, [formReset, onReset]);\n};\n","/* v8 ignore start */\n\nexport * from './useWatchFormReset';\n\n/* v8 ignore stop */\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAa,qBAAqB,EAAE,cAAwC;CAC1E,MAAM,EAAE,cAAcA,uBAAAA,eAAe;CAErC,CAAA,GAAA,MAAA,iBAAgB;EACd,MAAM,iBAAiB;GACrB,QAAQ;EACV;EAGA,OADoB,UAAU,UAAU,QACvB;CACnB,GAAG,CAAC,WAAW,OAAO,CAAC;AACzB"}