@fuf-stack/uniform 1.11.2 → 1.11.3

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 (350) hide show
  1. package/dist/Checkboxes/index.cjs +1 -1
  2. package/dist/Checkboxes/index.d.cts +1 -1
  3. package/dist/Checkboxes/index.d.ts +1 -1
  4. package/dist/Checkboxes/index.js +1 -1
  5. package/dist/{Checkboxes-BY4UK0Xf.js → Checkboxes-BvW4D5Nm.js} +3 -3
  6. package/dist/{Checkboxes-BY4UK0Xf.js.map → Checkboxes-BvW4D5Nm.js.map} +1 -1
  7. package/dist/{Checkboxes-DgCK-Wq-.cjs → Checkboxes-Cvdazf25.cjs} +4 -4
  8. package/dist/{Checkboxes-DgCK-Wq-.cjs.map → Checkboxes-Cvdazf25.cjs.map} +1 -1
  9. package/dist/FieldArray/index.cjs +1 -1
  10. package/dist/FieldArray/index.d.cts +1 -1
  11. package/dist/FieldArray/index.d.ts +1 -1
  12. package/dist/FieldArray/index.js +1 -1
  13. package/dist/{FieldArray-DBsyUQkU.cjs → FieldArray-CJpDgK_t.cjs} +7 -7
  14. package/dist/{FieldArray-DBsyUQkU.cjs.map → FieldArray-CJpDgK_t.cjs.map} +1 -1
  15. package/dist/{FieldArray-CDLaGvNj.js → FieldArray-omRNwxgy.js} +5 -5
  16. package/dist/{FieldArray-CDLaGvNj.js.map → FieldArray-omRNwxgy.js.map} +1 -1
  17. package/dist/FieldCard/index.cjs +1 -1
  18. package/dist/FieldCard/index.d.cts +1 -1
  19. package/dist/FieldCard/index.d.ts +1 -1
  20. package/dist/FieldCard/index.js +1 -1
  21. package/dist/{FieldCard-NKF358fO.cjs → FieldCard-Dt6QU7o7.cjs} +4 -4
  22. package/dist/{FieldCard-NKF358fO.cjs.map → FieldCard-Dt6QU7o7.cjs.map} +1 -1
  23. package/dist/{FieldCard-C1MCSbPW.js → FieldCard-Dyi-2qr6.js} +3 -3
  24. package/dist/{FieldCard-C1MCSbPW.js.map → FieldCard-Dyi-2qr6.js.map} +1 -1
  25. package/dist/{FieldCopyTestIdButton-BSYcSo2o.cjs → FieldCopyTestIdButton-By-hEZgA.cjs} +2 -2
  26. package/dist/{FieldCopyTestIdButton-BSYcSo2o.cjs.map → FieldCopyTestIdButton-By-hEZgA.cjs.map} +1 -1
  27. package/dist/{FieldCopyTestIdButton-DWPCDJ-s.js → FieldCopyTestIdButton-D9f1B-VS.js} +1 -1
  28. package/dist/{FieldCopyTestIdButton-DWPCDJ-s.js.map → FieldCopyTestIdButton-D9f1B-VS.js.map} +1 -1
  29. package/dist/{FieldValidationError-1hiDEFew.js → FieldValidationError-BYwitb_B.js} +1 -1
  30. package/dist/{FieldValidationError-1hiDEFew.js.map → FieldValidationError-BYwitb_B.js.map} +1 -1
  31. package/dist/{FieldValidationError-CE8R8qry.cjs → FieldValidationError-D64j5gnH.cjs} +2 -2
  32. package/dist/{FieldValidationError-CE8R8qry.cjs.map → FieldValidationError-D64j5gnH.cjs.map} +1 -1
  33. package/dist/Form/index.cjs +1 -1
  34. package/dist/Form/index.d.cts +1 -1
  35. package/dist/Form/index.d.ts +1 -1
  36. package/dist/Form/index.js +1 -1
  37. package/dist/{Form-DRNEwHsi.js → Form-B1fvbnxi.js} +3 -3
  38. package/dist/{Form-DRNEwHsi.js.map → Form-B1fvbnxi.js.map} +1 -1
  39. package/dist/{Form-BsD69fql.cjs → Form-CvnnGF45.cjs} +3 -3
  40. package/dist/{Form-BsD69fql.cjs.map → Form-CvnnGF45.cjs.map} +1 -1
  41. package/dist/{FormContext-CN9n_KdE.js → FormContext-Dl3k1r_k.js} +2 -2
  42. package/dist/{FormContext-CN9n_KdE.js.map → FormContext-Dl3k1r_k.js.map} +1 -1
  43. package/dist/{FormContext-Bb6d8hdG.cjs → FormContext-Lw4YL4-B.cjs} +2 -2
  44. package/dist/{FormContext-Bb6d8hdG.cjs.map → FormContext-Lw4YL4-B.cjs.map} +1 -1
  45. package/dist/Grid/index.cjs +1 -1
  46. package/dist/Grid/index.d.cts +1 -1
  47. package/dist/Grid/index.d.ts +1 -1
  48. package/dist/{Grid-D84e76CE.cjs → Grid-DezBAZbx.cjs} +2 -2
  49. package/dist/{Grid-D84e76CE.cjs.map → Grid-DezBAZbx.cjs.map} +1 -1
  50. package/dist/Input/index.cjs +1 -1
  51. package/dist/Input/index.d.cts +1 -1
  52. package/dist/Input/index.d.ts +1 -1
  53. package/dist/Input/index.js +1 -1
  54. package/dist/{Input-DeTpxiK_.cjs → Input-DR0gCf9q.cjs} +5 -4
  55. package/dist/Input-DR0gCf9q.cjs.map +1 -0
  56. package/dist/{Input-DXMWGTBh.js → Input-DksaHK1Y.js} +4 -3
  57. package/dist/Input-DksaHK1Y.js.map +1 -0
  58. package/dist/RadioBoxes/index.cjs +1 -1
  59. package/dist/RadioBoxes/index.d.cts +1 -1
  60. package/dist/RadioBoxes/index.d.ts +1 -1
  61. package/dist/RadioBoxes/index.js +1 -1
  62. package/dist/{RadioBoxes-BEln4a-B.js → RadioBoxes-DdIHH6B5.js} +2 -2
  63. package/dist/{RadioBoxes-BEln4a-B.js.map → RadioBoxes-DdIHH6B5.js.map} +1 -1
  64. package/dist/{RadioBoxes-gsQGqQCd.cjs → RadioBoxes-h-VLhJ9d.cjs} +3 -3
  65. package/dist/{RadioBoxes-gsQGqQCd.cjs.map → RadioBoxes-h-VLhJ9d.cjs.map} +1 -1
  66. package/dist/RadioTabs/index.cjs +1 -1
  67. package/dist/RadioTabs/index.d.cts +1 -1
  68. package/dist/RadioTabs/index.d.ts +1 -1
  69. package/dist/RadioTabs/index.js +1 -1
  70. package/dist/{RadioTabs-BYpP0tKA.cjs → RadioTabs-D6yF9jE3.cjs} +3 -3
  71. package/dist/{RadioTabs-BYpP0tKA.cjs.map → RadioTabs-D6yF9jE3.cjs.map} +1 -1
  72. package/dist/{RadioTabs-DLr9QiXI.js → RadioTabs-dLdlF91p.js} +2 -2
  73. package/dist/{RadioTabs-DLr9QiXI.js.map → RadioTabs-dLdlF91p.js.map} +1 -1
  74. package/dist/Radios/index.cjs +1 -1
  75. package/dist/Radios/index.d.cts +1 -1
  76. package/dist/Radios/index.d.ts +1 -1
  77. package/dist/Radios/index.js +1 -1
  78. package/dist/{Radios-BCOfnTke.cjs → Radios-D8alyG2f.cjs} +3 -3
  79. package/dist/{Radios-BCOfnTke.cjs.map → Radios-D8alyG2f.cjs.map} +1 -1
  80. package/dist/{Radios-DCXI2kMf.js → Radios-DiZ0Dfmp.js} +2 -2
  81. package/dist/{Radios-DCXI2kMf.js.map → Radios-DiZ0Dfmp.js.map} +1 -1
  82. package/dist/Select/index.cjs +1 -1
  83. package/dist/Select/index.d.cts +1 -1
  84. package/dist/Select/index.d.ts +1 -1
  85. package/dist/Select/index.js +1 -1
  86. package/dist/{Select-CyfEmWiD.js → Select-C9otN8uu.js} +3 -3
  87. package/dist/{Select-CyfEmWiD.js.map → Select-C9otN8uu.js.map} +1 -1
  88. package/dist/{Select-KnPGOO27.cjs → Select-DQVskslz.cjs} +4 -4
  89. package/dist/{Select-KnPGOO27.cjs.map → Select-DQVskslz.cjs.map} +1 -1
  90. package/dist/Slider/index.cjs +1 -1
  91. package/dist/Slider/index.d.cts +1 -1
  92. package/dist/Slider/index.d.ts +1 -1
  93. package/dist/Slider/index.js +1 -1
  94. package/dist/{Slider-C7xxYPgR.cjs → Slider-DwfyCQDM.cjs} +3 -3
  95. package/dist/{Slider-C7xxYPgR.cjs.map → Slider-DwfyCQDM.cjs.map} +1 -1
  96. package/dist/{Slider-Dlhb-9hC.js → Slider-meuLEC2k.js} +2 -2
  97. package/dist/{Slider-Dlhb-9hC.js.map → Slider-meuLEC2k.js.map} +1 -1
  98. package/dist/SubmitButton/index.cjs +1 -1
  99. package/dist/SubmitButton/index.d.cts +1 -1
  100. package/dist/SubmitButton/index.d.ts +1 -1
  101. package/dist/SubmitButton/index.js +1 -1
  102. package/dist/{SubmitButton-CUBItcBn.cjs → SubmitButton-B0kvUqkd.cjs} +3 -3
  103. package/dist/{SubmitButton-CUBItcBn.cjs.map → SubmitButton-B0kvUqkd.cjs.map} +1 -1
  104. package/dist/{SubmitButton-C5f6j0N4.js → SubmitButton-BHP9J9ml.js} +2 -2
  105. package/dist/{SubmitButton-C5f6j0N4.js.map → SubmitButton-BHP9J9ml.js.map} +1 -1
  106. package/dist/Switch/index.cjs +1 -1
  107. package/dist/Switch/index.d.cts +1 -1
  108. package/dist/Switch/index.d.ts +1 -1
  109. package/dist/Switch/index.js +1 -1
  110. package/dist/{Switch--m02Xcq8.js → Switch-DkciIYnD.js} +2 -2
  111. package/dist/{Switch--m02Xcq8.js.map → Switch-DkciIYnD.js.map} +1 -1
  112. package/dist/{Switch-6LyeZHJh.cjs → Switch-Ds0gDzjR.cjs} +3 -3
  113. package/dist/{Switch-6LyeZHJh.cjs.map → Switch-Ds0gDzjR.cjs.map} +1 -1
  114. package/dist/SwitchBox/index.cjs +1 -1
  115. package/dist/SwitchBox/index.d.cts +1 -1
  116. package/dist/SwitchBox/index.d.ts +1 -1
  117. package/dist/SwitchBox/index.js +1 -1
  118. package/dist/{SwitchBox-D0-e-pbM.js → SwitchBox-B6Z4rtWt.js} +2 -2
  119. package/dist/{SwitchBox-D0-e-pbM.js.map → SwitchBox-B6Z4rtWt.js.map} +1 -1
  120. package/dist/{SwitchBox-CtGiQdys.cjs → SwitchBox-B9JqwDtN.cjs} +3 -3
  121. package/dist/{SwitchBox-CtGiQdys.cjs.map → SwitchBox-B9JqwDtN.cjs.map} +1 -1
  122. package/dist/TextArea/index.cjs +1 -1
  123. package/dist/TextArea/index.d.cts +1 -1
  124. package/dist/TextArea/index.js +1 -1
  125. package/dist/{TextArea-PtdSABZS.cjs → TextArea-BqQtlPSV.cjs} +5 -4
  126. package/dist/{TextArea-PtdSABZS.cjs.map → TextArea-BqQtlPSV.cjs.map} +1 -1
  127. package/dist/{TextArea-BiSnvJ69.js → TextArea-DAx49KI6.js} +4 -3
  128. package/dist/{TextArea-BiSnvJ69.js.map → TextArea-DAx49KI6.js.map} +1 -1
  129. package/dist/helpers/index.cjs +2 -1
  130. package/dist/helpers/index.d.cts +164 -2
  131. package/dist/helpers/index.d.cts.map +1 -0
  132. package/dist/helpers/index.d.ts +164 -2
  133. package/dist/helpers/index.d.ts.map +1 -0
  134. package/dist/helpers/index.js +2 -2
  135. package/dist/{helpers-B-CJOBt3.js → helpers-CCINRgQk.js} +43 -2
  136. package/dist/helpers-CCINRgQk.js.map +1 -0
  137. package/dist/{helpers-B84E9vHd.cjs → helpers-nYTmL2gX.cjs} +49 -2
  138. package/dist/helpers-nYTmL2gX.cjs.map +1 -0
  139. package/dist/hooks/useClientValidation/index.cjs +1 -1
  140. package/dist/hooks/useClientValidation/index.d.cts +1 -1
  141. package/dist/hooks/useClientValidation/index.d.ts +1 -1
  142. package/dist/hooks/useClientValidation/index.js +1 -1
  143. package/dist/hooks/useController/index.cjs +1 -1
  144. package/dist/hooks/useController/index.d.cts +1 -1
  145. package/dist/hooks/useController/index.d.ts +2 -1
  146. package/dist/hooks/useController/index.js +1 -1
  147. package/dist/hooks/useFormContext/index.cjs +1 -1
  148. package/dist/hooks/useFormContext/index.d.cts +1 -1
  149. package/dist/hooks/useFormContext/index.d.ts +1 -1
  150. package/dist/hooks/useFormContext/index.js +1 -1
  151. package/dist/hooks/useInput/index.cjs +1 -1
  152. package/dist/hooks/useInputValueDebounce/index.cjs +1 -1
  153. package/dist/hooks/useInputValueDebounce/index.d.cts +1 -1
  154. package/dist/hooks/useInputValueDebounce/index.d.ts +1 -1
  155. package/dist/hooks/useInputValueDebounce/index.js +1 -1
  156. package/dist/hooks/useInputValueTransform/index.cjs +1 -1
  157. package/dist/hooks/useInputValueTransform/index.d.cts +1 -1
  158. package/dist/hooks/useInputValueTransform/index.d.ts +1 -1
  159. package/dist/hooks/useInputValueTransform/index.js +1 -1
  160. package/dist/hooks/useUniformField/index.cjs +1 -1
  161. package/dist/hooks/useUniformField/index.d.cts +1 -1
  162. package/dist/hooks/useUniformField/index.d.ts +3 -3
  163. package/dist/hooks/useUniformField/index.js +1 -1
  164. package/dist/hooks/useUniformFieldArray/index.cjs +1 -1
  165. package/dist/hooks/useUniformFieldArray/index.d.cts +1 -1
  166. package/dist/hooks/useUniformFieldArray/index.d.ts +4 -24
  167. package/dist/hooks/useUniformFieldArray/index.js +1 -1
  168. package/dist/hooks/useWatchUserChange/index.cjs +1 -1
  169. package/dist/hooks/useWatchUserChange/index.d.cts +1 -1
  170. package/dist/hooks/useWatchUserChange/index.d.ts +1 -1
  171. package/dist/hooks/useWatchUserChange/index.js +1 -1
  172. package/dist/{index-C1PUx1tH.d.ts → index-0wXxS5M7.d.ts} +7 -7
  173. package/dist/index-0wXxS5M7.d.ts.map +1 -0
  174. package/dist/{index-DvB46QAb.d.ts → index-1Egh73pR.d.ts} +3 -3
  175. package/dist/{index-DvB46QAb.d.ts.map → index-1Egh73pR.d.ts.map} +1 -1
  176. package/dist/{index-DmMenZfj.d.ts → index-3v_vja2i.d.ts} +6 -6
  177. package/dist/{index-DmMenZfj.d.ts.map → index-3v_vja2i.d.ts.map} +1 -1
  178. package/dist/{index-BTTo_ufh.d.ts → index-7mx-IcDp.d.ts} +3 -3
  179. package/dist/{index-BTTo_ufh.d.ts.map → index-7mx-IcDp.d.ts.map} +1 -1
  180. package/dist/{index-WogV9uVV.d.cts → index-BDV3JVoX.d.cts} +7 -7
  181. package/dist/{index-WogV9uVV.d.cts.map → index-BDV3JVoX.d.cts.map} +1 -1
  182. package/dist/{index-DxdaxM3o.d.cts → index-BFLKkqA3.d.ts} +2 -2
  183. package/dist/{index-Edx7MxXu.d.ts.map → index-BFLKkqA3.d.ts.map} +1 -1
  184. package/dist/{index-DG9C0kHA.d.ts → index-BGXgvZKr.d.ts} +35 -35
  185. package/dist/{index-DG9C0kHA.d.ts.map → index-BGXgvZKr.d.ts.map} +1 -1
  186. package/dist/{index-CVnn6mEI.d.ts → index-BSjUaHEO.d.cts} +4 -4
  187. package/dist/{index-BITJ-CZL.d.cts.map → index-BSjUaHEO.d.cts.map} +1 -1
  188. package/dist/{index-jmQP58tO.d.cts → index-B_aIzCcx.d.cts} +3 -3
  189. package/dist/{index-jmQP58tO.d.cts.map → index-B_aIzCcx.d.cts.map} +1 -1
  190. package/dist/{index-BITJ-CZL.d.cts → index-Bcppi5O7.d.ts} +4 -4
  191. package/dist/{index-CVnn6mEI.d.ts.map → index-Bcppi5O7.d.ts.map} +1 -1
  192. package/dist/{index-Bj_lpc5r.d.cts → index-C2A_i57R.d.cts} +21 -21
  193. package/dist/index-C2A_i57R.d.cts.map +1 -0
  194. package/dist/index-CFBmva_r.d.ts +1 -0
  195. package/dist/{index-CSBE6Et0.d.cts → index-CHNp5R5N.d.cts} +6 -6
  196. package/dist/{index-CSBE6Et0.d.cts.map → index-CHNp5R5N.d.cts.map} +1 -1
  197. package/dist/{index-BL0DnIzh.d.ts → index-CHXv_rNR.d.ts} +3 -3
  198. package/dist/{index-BL0DnIzh.d.ts.map → index-CHXv_rNR.d.ts.map} +1 -1
  199. package/dist/{index--E2ZsMya.d.ts → index-CTp4vdDb.d.ts} +6 -6
  200. package/dist/{index--E2ZsMya.d.ts.map → index-CTp4vdDb.d.ts.map} +1 -1
  201. package/dist/{index-F11geOHD.d.ts → index-CUn9q5KD.d.ts} +6 -6
  202. package/dist/{index-F11geOHD.d.ts.map → index-CUn9q5KD.d.ts.map} +1 -1
  203. package/dist/{index-BxA_pJWn.d.cts → index-CZyNkPDq.d.ts} +22 -22
  204. package/dist/{index-C-2nxT8D.d.ts.map → index-CZyNkPDq.d.ts.map} +1 -1
  205. package/dist/{index-C-2nxT8D.d.ts → index-CeYRsehb.d.cts} +22 -22
  206. package/dist/index-CeYRsehb.d.cts.map +1 -0
  207. package/dist/{index-DRij_w43.d.cts → index-CiF2KXB7.d.cts} +6 -6
  208. package/dist/{index-DRij_w43.d.cts.map → index-CiF2KXB7.d.cts.map} +1 -1
  209. package/dist/{index-DNkZrb7P.d.cts → index-CjJHVJwD.d.cts} +35 -35
  210. package/dist/{index-DNkZrb7P.d.cts.map → index-CjJHVJwD.d.cts.map} +1 -1
  211. package/dist/{index-D38wOL-M.d.ts → index-CnsR8nkm.d.cts} +34 -34
  212. package/dist/index-CnsR8nkm.d.cts.map +1 -0
  213. package/dist/{index-CGnr_e53.d.ts → index-CqGabrzW.d.cts} +38 -38
  214. package/dist/index-CqGabrzW.d.cts.map +1 -0
  215. package/dist/{index-CYdvpGJF.d.cts → index-CuvvZMop.d.cts} +3 -3
  216. package/dist/{index-CYdvpGJF.d.cts.map → index-CuvvZMop.d.cts.map} +1 -1
  217. package/dist/{index-BWNJdLDV.d.ts → index-DNFUttM8.d.ts} +21 -21
  218. package/dist/{index-BWNJdLDV.d.ts.map → index-DNFUttM8.d.ts.map} +1 -1
  219. package/dist/{index-BQDEnYTq.d.ts → index-DVRtBywt.d.ts} +1 -1
  220. package/dist/{index-BQDEnYTq.d.ts.map → index-DVRtBywt.d.ts.map} +1 -1
  221. package/dist/{index-oyX8xu0F.d.cts → index-D_WidR7r.d.cts} +6 -6
  222. package/dist/{index-oyX8xu0F.d.cts.map → index-D_WidR7r.d.cts.map} +1 -1
  223. package/dist/index-D_egu-QT.d.cts +264 -0
  224. package/dist/index-D_egu-QT.d.cts.map +1 -0
  225. package/dist/index-DajjPPWM.d.ts +264 -0
  226. package/dist/index-DajjPPWM.d.ts.map +1 -0
  227. package/dist/{index-Bo_n9sse.d.cts → index-DcYFLiul.d.cts} +48 -48
  228. package/dist/index-DcYFLiul.d.cts.map +1 -0
  229. package/dist/index-DnzC0GCS.d.ts.map +1 -1
  230. package/dist/{index-Edx7MxXu.d.ts → index-DvF_C1Bz.d.cts} +3 -3
  231. package/dist/{index-DxdaxM3o.d.cts.map → index-DvF_C1Bz.d.cts.map} +1 -1
  232. package/dist/{index-Cb0AgRRa.d.cts → index-cadUZZIY.d.cts} +3 -3
  233. package/dist/{index-Cb0AgRRa.d.cts.map → index-cadUZZIY.d.cts.map} +1 -1
  234. package/dist/{index-PU5WNOH9.d.cts → index-g9TZhGnE.d.cts} +3 -3
  235. package/dist/{index-PU5WNOH9.d.cts.map → index-g9TZhGnE.d.cts.map} +1 -1
  236. package/dist/index-lQ_hGQ08.d.cts +1 -0
  237. package/dist/{index-C0L7GvgN.d.cts → index-op7zETAQ.d.ts} +34 -34
  238. package/dist/index-op7zETAQ.d.ts.map +1 -0
  239. package/dist/{index-DoS0lVRe.d.cts → index-yVkU2v6b.d.ts} +37 -37
  240. package/dist/{index-CGnr_e53.d.ts.map → index-yVkU2v6b.d.ts.map} +1 -1
  241. package/dist/index.cjs +28 -27
  242. package/dist/index.d.cts +27 -27
  243. package/dist/index.d.ts +27 -26
  244. package/dist/index.js +26 -26
  245. package/dist/partials/FieldCopyTestIdButton/index.cjs +1 -1
  246. package/dist/partials/FieldCopyTestIdButton/index.d.cts +1 -1
  247. package/dist/partials/FieldCopyTestIdButton/index.d.ts +1 -1
  248. package/dist/partials/FieldCopyTestIdButton/index.js +1 -1
  249. package/dist/partials/FieldValidationError/index.cjs +1 -1
  250. package/dist/partials/FieldValidationError/index.d.cts +1 -1
  251. package/dist/partials/FieldValidationError/index.d.ts +1 -1
  252. package/dist/partials/FieldValidationError/index.js +1 -1
  253. package/dist/{useClientValidation-DJ4JuN_9.d.ts → useClientValidation-Bg0q3Axc.d.ts} +3 -3
  254. package/dist/{useClientValidation-DJ4JuN_9.d.ts.map → useClientValidation-Bg0q3Axc.d.ts.map} +1 -1
  255. package/dist/{useClientValidation-BnnscAEe.js → useClientValidation-BrTtRnqi.js} +3 -3
  256. package/dist/{useClientValidation-BnnscAEe.js.map → useClientValidation-BrTtRnqi.js.map} +1 -1
  257. package/dist/{useClientValidation-BQqwz628.d.cts → useClientValidation-BvPDQmf6.d.cts} +3 -3
  258. package/dist/{useClientValidation-BQqwz628.d.cts.map → useClientValidation-BvPDQmf6.d.cts.map} +1 -1
  259. package/dist/{useClientValidation-CmYVGlLr.cjs → useClientValidation-CdC7lEYP.cjs} +4 -4
  260. package/dist/{useClientValidation-CmYVGlLr.cjs.map → useClientValidation-CdC7lEYP.cjs.map} +1 -1
  261. package/dist/{useController-C_MZLZIp.d.cts → useController-BArZd2Vp.d.cts} +1 -1
  262. package/dist/{useController-C_MZLZIp.d.cts.map → useController-BArZd2Vp.d.cts.map} +1 -1
  263. package/dist/{useController-CkmO5CLh.cjs → useController-BBxji1nQ.cjs} +3 -3
  264. package/dist/{useController-CkmO5CLh.cjs.map → useController-BBxji1nQ.cjs.map} +1 -1
  265. package/dist/{useController-hjpJQf0w.d.ts → useController-MVHJ7WFp.d.ts} +1 -1
  266. package/dist/{useController-hjpJQf0w.d.ts.map → useController-MVHJ7WFp.d.ts.map} +1 -1
  267. package/dist/{useController-CumIERks.js → useController-g0AlWM__.js} +3 -3
  268. package/dist/{useController-CumIERks.js.map → useController-g0AlWM__.js.map} +1 -1
  269. package/dist/{useFormContext-B083Y-kw.d.cts → useFormContext--yod5xzQ.d.cts} +3 -3
  270. package/dist/useFormContext--yod5xzQ.d.cts.map +1 -0
  271. package/dist/{useFormContext-JCm1UR_e.js → useFormContext-BFoXZNkp.js} +3 -3
  272. package/dist/{useFormContext-JCm1UR_e.js.map → useFormContext-BFoXZNkp.js.map} +1 -1
  273. package/dist/{useFormContext-Bp0EODoO.cjs → useFormContext-CEr3zcL6.cjs} +3 -3
  274. package/dist/{useFormContext-Bp0EODoO.cjs.map → useFormContext-CEr3zcL6.cjs.map} +1 -1
  275. package/dist/{useFormContext-B2TS6xq0.d.ts → useFormContext-Cw6aAhos.d.ts} +3 -3
  276. package/dist/useFormContext-Cw6aAhos.d.ts.map +1 -0
  277. package/dist/{useInputValueDebounce-B5b-v8Hc.d.cts → useInputValueDebounce-DI1C6oaU.d.cts} +5 -1
  278. package/dist/useInputValueDebounce-DI1C6oaU.d.cts.map +1 -0
  279. package/dist/{useInputValueDebounce-DaH5ONlQ.js → useInputValueDebounce-Dop_8_OK.js} +12 -3
  280. package/dist/useInputValueDebounce-Dop_8_OK.js.map +1 -0
  281. package/dist/{useInputValueDebounce-BcUyaS94.cjs → useInputValueDebounce-TiNR4jtG.cjs} +13 -4
  282. package/dist/useInputValueDebounce-TiNR4jtG.cjs.map +1 -0
  283. package/dist/{useInputValueDebounce-DoRuSF6R.d.ts → useInputValueDebounce-fhmVn1aO.d.ts} +5 -1
  284. package/dist/useInputValueDebounce-fhmVn1aO.d.ts.map +1 -0
  285. package/dist/{useInputValueTransform-DFPA3KVy.cjs → useInputValueTransform-BNmfaj5D.cjs} +4 -3
  286. package/dist/{useInputValueTransform-DFPA3KVy.cjs.map → useInputValueTransform-BNmfaj5D.cjs.map} +1 -1
  287. package/dist/{useInputValueTransform-D7LfyYRe.d.ts → useInputValueTransform-BV8o0PMI.d.cts} +3 -2
  288. package/dist/useInputValueTransform-BV8o0PMI.d.cts.map +1 -0
  289. package/dist/{useInputValueTransform-aiIf8lq5.js → useInputValueTransform-CMNC21vX.js} +3 -2
  290. package/dist/{useInputValueTransform-aiIf8lq5.js.map → useInputValueTransform-CMNC21vX.js.map} +1 -1
  291. package/dist/{useInputValueTransform-BID-CQ-y.d.cts → useInputValueTransform-Cc0qEsnS.d.ts} +3 -2
  292. package/dist/useInputValueTransform-Cc0qEsnS.d.ts.map +1 -0
  293. package/dist/{useUniformField-B2OZ-Z1G.d.cts → useUniformField-B2zQtEbr.d.cts} +4 -4
  294. package/dist/{useUniformField-B2OZ-Z1G.d.cts.map → useUniformField-B2zQtEbr.d.cts.map} +1 -1
  295. package/dist/{useUniformField-gU4qYUwL.js → useUniformField-BKVVns0E.js} +34 -8
  296. package/dist/useUniformField-BKVVns0E.js.map +1 -0
  297. package/dist/{useUniformField-Bj23Kvbs.cjs → useUniformField-D6fwSjrH.cjs} +35 -9
  298. package/dist/useUniformField-D6fwSjrH.cjs.map +1 -0
  299. package/dist/{useUniformField-CwEHonNe.d.ts → useUniformField-RxZqXMuD.d.ts} +4 -4
  300. package/dist/{useUniformField-CwEHonNe.d.ts.map → useUniformField-RxZqXMuD.d.ts.map} +1 -1
  301. package/dist/{useUniformFieldArray-CXoWvu6m.d.ts → useUniformFieldArray-B_c55CnX.d.ts} +4 -4
  302. package/dist/useUniformFieldArray-B_c55CnX.d.ts.map +1 -0
  303. package/dist/{useUniformFieldArray-B5PyxL1P.js → useUniformFieldArray-BwE634m6.js} +4 -4
  304. package/dist/useUniformFieldArray-BwE634m6.js.map +1 -0
  305. package/dist/{useUniformFieldArray-G1lokW7x.cjs → useUniformFieldArray-Byfmzq97.cjs} +5 -5
  306. package/dist/useUniformFieldArray-Byfmzq97.cjs.map +1 -0
  307. package/dist/{useUniformFieldArray-qtJMEosJ.d.cts → useUniformFieldArray-WRuIMhw6.d.cts} +4 -4
  308. package/dist/useUniformFieldArray-WRuIMhw6.d.cts.map +1 -0
  309. package/dist/{useWatchUserChange-BAdiqg2q.d.ts → useWatchUserChange-Bf5JKDJJ.d.ts} +1 -1
  310. package/dist/{useWatchUserChange-BAdiqg2q.d.ts.map → useWatchUserChange-Bf5JKDJJ.d.ts.map} +1 -1
  311. package/dist/{useWatchUserChange-COVdHmki.d.cts → useWatchUserChange-Br4Q7syM.d.cts} +1 -1
  312. package/dist/{useWatchUserChange-COVdHmki.d.cts.map → useWatchUserChange-Br4Q7syM.d.cts.map} +1 -1
  313. package/dist/{useWatchUserChange-BnxYE-0b.cjs → useWatchUserChange-TMfaTCcp.cjs} +3 -3
  314. package/dist/{useWatchUserChange-BnxYE-0b.cjs.map → useWatchUserChange-TMfaTCcp.cjs.map} +1 -1
  315. package/dist/{useWatchUserChange-C1ezpj0t.js → useWatchUserChange-fZy6nGtD.js} +2 -2
  316. package/dist/{useWatchUserChange-C1ezpj0t.js.map → useWatchUserChange-fZy6nGtD.js.map} +1 -1
  317. package/package.json +3 -3
  318. package/dist/Input-DXMWGTBh.js.map +0 -1
  319. package/dist/Input-DeTpxiK_.cjs.map +0 -1
  320. package/dist/helpers-B-CJOBt3.js.map +0 -1
  321. package/dist/helpers-B84E9vHd.cjs.map +0 -1
  322. package/dist/index-Bj_lpc5r.d.cts.map +0 -1
  323. package/dist/index-Bo_n9sse.d.cts.map +0 -1
  324. package/dist/index-BxA_pJWn.d.cts.map +0 -1
  325. package/dist/index-C0L7GvgN.d.cts.map +0 -1
  326. package/dist/index-C1PUx1tH.d.ts.map +0 -1
  327. package/dist/index-CADnFWHq.d.ts +0 -264
  328. package/dist/index-CADnFWHq.d.ts.map +0 -1
  329. package/dist/index-D38wOL-M.d.ts.map +0 -1
  330. package/dist/index-DoS0lVRe.d.cts.map +0 -1
  331. package/dist/index-G0IgQWoU.d.cts +0 -134
  332. package/dist/index-G0IgQWoU.d.cts.map +0 -1
  333. package/dist/index-UjKqRe-8.d.ts +0 -134
  334. package/dist/index-UjKqRe-8.d.ts.map +0 -1
  335. package/dist/index-sJZ434Sg.d.cts +0 -264
  336. package/dist/index-sJZ434Sg.d.cts.map +0 -1
  337. package/dist/useFormContext-B083Y-kw.d.cts.map +0 -1
  338. package/dist/useFormContext-B2TS6xq0.d.ts.map +0 -1
  339. package/dist/useInputValueDebounce-B5b-v8Hc.d.cts.map +0 -1
  340. package/dist/useInputValueDebounce-BcUyaS94.cjs.map +0 -1
  341. package/dist/useInputValueDebounce-DaH5ONlQ.js.map +0 -1
  342. package/dist/useInputValueDebounce-DoRuSF6R.d.ts.map +0 -1
  343. package/dist/useInputValueTransform-BID-CQ-y.d.cts.map +0 -1
  344. package/dist/useInputValueTransform-D7LfyYRe.d.ts.map +0 -1
  345. package/dist/useUniformField-Bj23Kvbs.cjs.map +0 -1
  346. package/dist/useUniformField-gU4qYUwL.js.map +0 -1
  347. package/dist/useUniformFieldArray-B5PyxL1P.js.map +0 -1
  348. package/dist/useUniformFieldArray-CXoWvu6m.d.ts.map +0 -1
  349. package/dist/useUniformFieldArray-G1lokW7x.cjs.map +0 -1
  350. package/dist/useUniformFieldArray-qtJMEosJ.d.cts.map +0 -1
@@ -72,10 +72,11 @@ import { useCallback } from "react";
72
72
  *
73
73
  * const { onChange, onBlur, value } = useInputValueDebounce({
74
74
  * ...transform,
75
- * initialValue: field.value,
76
75
  * debounceDelay: 300,
76
+ * name: 'fieldName',
77
77
  * onBlur: field.onBlur,
78
78
  * onChange: field.onChange,
79
+ * value: field.value,
79
80
  * });
80
81
  *
81
82
  * return <input value={value} onChange={onChange} onBlur={onBlur} />;
@@ -107,4 +108,4 @@ const useInputValueTransform = ({ type, transform }) => {
107
108
 
108
109
  //#endregion
109
110
  export { useInputValueTransform as t };
110
- //# sourceMappingURL=useInputValueTransform-aiIf8lq5.js.map
111
+ //# sourceMappingURL=useInputValueTransform-CMNC21vX.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useInputValueTransform-aiIf8lq5.js","names":[],"sources":["../src/hooks/useInputValueTransform/useInputValueTransform.ts"],"sourcesContent":["import { useCallback } from 'react';\n\nexport interface InputValueTransform<TDisplay = unknown> {\n /** Transforms the form value to display value (e.g., 1000 → \"$1,000\" or 'a' → ['a']) */\n toDisplayValue: (value: unknown) => TDisplay;\n /** Transforms the display value to form value (e.g., \"$1,000\" → 1000 or ['a'] → 'a') */\n toFormValue: (value: TDisplay) => unknown;\n}\n\nexport interface UseInputValueTransformOptions<TDisplay = unknown> {\n /** Input type for special number handling */\n type?: 'text' | 'number' | 'password';\n /** Value transformation functions */\n transform?: InputValueTransform<TDisplay>;\n}\n\nexport interface UseInputValueTransformReturn<TDisplay = unknown> {\n /** Converts any form value to display value */\n toDisplayValue: (formValue: unknown) => TDisplay;\n /** Converts any display value to form value */\n toFormValue: (displayValue: TDisplay) => unknown;\n}\n\n/**\n * Custom hook providing utility functions for value transformations between display and form values.\n *\n * This hook provides pure conversion functions without any state management. It's useful for:\n * - Currency formatting ($1,000 display vs 1000 stored)\n * - Number inputs with special handling\n * - Date formatting (MM/DD/YYYY display vs ISO date stored)\n * - Phone number formatting ((555) 123-4567 display vs 5551234567 stored)\n * - Array/Object transformations (single value ↔ array, nested structures)\n *\n * **Key Features:**\n * - Pure conversion functions (no state)\n * - Generic support for any data type (strings, numbers, arrays, objects)\n * - Special number input handling (empty string preservation)\n * - Bidirectional value transformations\n * - Memoized functions for performance\n *\n * @param options Configuration for value transformation\n * @returns Pure conversion utility functions\n *\n * @example\n * ```tsx\n * // Currency formatting\n * const currencyTransform = {\n * toDisplayValue: (val) => val ? `$${Number(val).toLocaleString()}` : '',\n * toFormValue: (val) => parseFloat(val.replace(/[$,]/g, '')) || 0\n * };\n *\n * const { toDisplayValue, toFormValue } = useInputValueTransform({\n * transform: currencyTransform\n * });\n *\n * const displayVal = toDisplayValue(1000); // \"$1,000\"\n * const formVal = toFormValue(\"$1,500\"); // 1500\n * ```\n *\n * @example\n * ```tsx\n * // Number input (no transforms needed)\n * const { toDisplayValue, toFormValue } = useInputValueTransform({\n * type: 'number'\n * });\n *\n * // Handles empty string → empty string (not NaN)\n * // Handles \"123\" → 123 (string to number conversion)\n * ```\n *\n * @example\n * ```tsx\n * // Array to single value (for single checkbox)\n * const singleValueTransform = {\n * toDisplayValue: (val: string[]) => val?.[0] || '',\n * toFormValue: (val: string) => val ? [val] : []\n * };\n *\n * const { toDisplayValue, toFormValue } = useInputValueTransform({\n * transform: singleValueTransform\n * });\n *\n * const displayVal = toDisplayValue(['option1']); // \"option1\"\n * const formVal = toFormValue(\"option2\"); // [\"option2\"]\n * ```\n *\n * @example\n * ```tsx\n * // Integration with debouncing\n * const MyInput = ({ field, transform }) => {\n * const transform = useInputValueTransform({ transform });\n *\n * const { onChange, onBlur, value } = useInputValueDebounce({\n * ...transform,\n * initialValue: field.value,\n * debounceDelay: 300,\n * onBlur: field.onBlur,\n * onChange: field.onChange,\n * });\n *\n * return <input value={value} onChange={onChange} onBlur={onBlur} />;\n * };\n * ```\n */\nexport const useInputValueTransform = <TDisplay = unknown>({\n type,\n transform,\n}: UseInputValueTransformOptions<TDisplay>): UseInputValueTransformReturn<TDisplay> => {\n /**\n * Converts any form value to display value\n */\n const toDisplayValue = useCallback(\n (formValue: unknown): TDisplay => {\n if (transform?.toDisplayValue) {\n return transform.toDisplayValue(formValue);\n }\n\n // For number type, convert valid strings to numbers for display\n if (type === 'number') {\n if (formValue === '') {\n return '' as TDisplay;\n }\n const numValue = Number(formValue);\n return (Number.isNaN(numValue) ? formValue : numValue) as TDisplay;\n }\n\n // Default: pass through (handles primitives, arrays, objects, etc.)\n return (formValue ?? '') as TDisplay;\n },\n [type, transform],\n );\n\n /**\n * Converts any display value to form value\n */\n const toFormValue = useCallback(\n (displayValue: TDisplay): unknown => {\n if (transform?.toFormValue) {\n return transform.toFormValue(displayValue);\n }\n\n // For number type, convert strings to numbers\n if (type === 'number') {\n if (displayValue === '') {\n return '';\n }\n const numValue = Number(displayValue);\n return Number.isNaN(numValue) ? displayValue : numValue;\n }\n\n // Default: pass through (handles primitives, arrays, objects, etc.)\n return displayValue;\n },\n [type, transform],\n );\n\n return {\n toDisplayValue,\n toFormValue,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwGA,MAAa,0BAA8C,EACzD,MACA,gBACqF;AAiDrF,QAAO;EACL,gBA9CqB,aACpB,cAAiC;AAChC,OAAI,WAAW,eACb,QAAO,UAAU,eAAe,UAAU;AAI5C,OAAI,SAAS,UAAU;AACrB,QAAI,cAAc,GAChB,QAAO;IAET,MAAM,WAAW,OAAO,UAAU;AAClC,WAAQ,OAAO,MAAM,SAAS,GAAG,YAAY;;AAI/C,UAAQ,aAAa;KAEvB,CAAC,MAAM,UAAU,CAClB;EA4BC,aAvBkB,aACjB,iBAAoC;AACnC,OAAI,WAAW,YACb,QAAO,UAAU,YAAY,aAAa;AAI5C,OAAI,SAAS,UAAU;AACrB,QAAI,iBAAiB,GACnB,QAAO;IAET,MAAM,WAAW,OAAO,aAAa;AACrC,WAAO,OAAO,MAAM,SAAS,GAAG,eAAe;;AAIjD,UAAO;KAET,CAAC,MAAM,UAAU,CAClB;EAKA"}
1
+ {"version":3,"file":"useInputValueTransform-CMNC21vX.js","names":[],"sources":["../src/hooks/useInputValueTransform/useInputValueTransform.ts"],"sourcesContent":["import { useCallback } from 'react';\n\nexport interface InputValueTransform<TDisplay = unknown> {\n /** Transforms the form value to display value (e.g., 1000 → \"$1,000\" or 'a' → ['a']) */\n toDisplayValue: (value: unknown) => TDisplay;\n /** Transforms the display value to form value (e.g., \"$1,000\" → 1000 or ['a'] → 'a') */\n toFormValue: (value: TDisplay) => unknown;\n}\n\nexport interface UseInputValueTransformOptions<TDisplay = unknown> {\n /** Input type for special number handling */\n type?: 'text' | 'number' | 'password';\n /** Value transformation functions */\n transform?: InputValueTransform<TDisplay>;\n}\n\nexport interface UseInputValueTransformReturn<TDisplay = unknown> {\n /** Converts any form value to display value */\n toDisplayValue: (formValue: unknown) => TDisplay;\n /** Converts any display value to form value */\n toFormValue: (displayValue: TDisplay) => unknown;\n}\n\n/**\n * Custom hook providing utility functions for value transformations between display and form values.\n *\n * This hook provides pure conversion functions without any state management. It's useful for:\n * - Currency formatting ($1,000 display vs 1000 stored)\n * - Number inputs with special handling\n * - Date formatting (MM/DD/YYYY display vs ISO date stored)\n * - Phone number formatting ((555) 123-4567 display vs 5551234567 stored)\n * - Array/Object transformations (single value ↔ array, nested structures)\n *\n * **Key Features:**\n * - Pure conversion functions (no state)\n * - Generic support for any data type (strings, numbers, arrays, objects)\n * - Special number input handling (empty string preservation)\n * - Bidirectional value transformations\n * - Memoized functions for performance\n *\n * @param options Configuration for value transformation\n * @returns Pure conversion utility functions\n *\n * @example\n * ```tsx\n * // Currency formatting\n * const currencyTransform = {\n * toDisplayValue: (val) => val ? `$${Number(val).toLocaleString()}` : '',\n * toFormValue: (val) => parseFloat(val.replace(/[$,]/g, '')) || 0\n * };\n *\n * const { toDisplayValue, toFormValue } = useInputValueTransform({\n * transform: currencyTransform\n * });\n *\n * const displayVal = toDisplayValue(1000); // \"$1,000\"\n * const formVal = toFormValue(\"$1,500\"); // 1500\n * ```\n *\n * @example\n * ```tsx\n * // Number input (no transforms needed)\n * const { toDisplayValue, toFormValue } = useInputValueTransform({\n * type: 'number'\n * });\n *\n * // Handles empty string → empty string (not NaN)\n * // Handles \"123\" → 123 (string to number conversion)\n * ```\n *\n * @example\n * ```tsx\n * // Array to single value (for single checkbox)\n * const singleValueTransform = {\n * toDisplayValue: (val: string[]) => val?.[0] || '',\n * toFormValue: (val: string) => val ? [val] : []\n * };\n *\n * const { toDisplayValue, toFormValue } = useInputValueTransform({\n * transform: singleValueTransform\n * });\n *\n * const displayVal = toDisplayValue(['option1']); // \"option1\"\n * const formVal = toFormValue(\"option2\"); // [\"option2\"]\n * ```\n *\n * @example\n * ```tsx\n * // Integration with debouncing\n * const MyInput = ({ field, transform }) => {\n * const transform = useInputValueTransform({ transform });\n *\n * const { onChange, onBlur, value } = useInputValueDebounce({\n * ...transform,\n * debounceDelay: 300,\n * name: 'fieldName',\n * onBlur: field.onBlur,\n * onChange: field.onChange,\n * value: field.value,\n * });\n *\n * return <input value={value} onChange={onChange} onBlur={onBlur} />;\n * };\n * ```\n */\nexport const useInputValueTransform = <TDisplay = unknown>({\n type,\n transform,\n}: UseInputValueTransformOptions<TDisplay>): UseInputValueTransformReturn<TDisplay> => {\n /**\n * Converts any form value to display value\n */\n const toDisplayValue = useCallback(\n (formValue: unknown): TDisplay => {\n if (transform?.toDisplayValue) {\n return transform.toDisplayValue(formValue);\n }\n\n // For number type, convert valid strings to numbers for display\n if (type === 'number') {\n if (formValue === '') {\n return '' as TDisplay;\n }\n const numValue = Number(formValue);\n return (Number.isNaN(numValue) ? formValue : numValue) as TDisplay;\n }\n\n // Default: pass through (handles primitives, arrays, objects, etc.)\n return (formValue ?? '') as TDisplay;\n },\n [type, transform],\n );\n\n /**\n * Converts any display value to form value\n */\n const toFormValue = useCallback(\n (displayValue: TDisplay): unknown => {\n if (transform?.toFormValue) {\n return transform.toFormValue(displayValue);\n }\n\n // For number type, convert strings to numbers\n if (type === 'number') {\n if (displayValue === '') {\n return '';\n }\n const numValue = Number(displayValue);\n return Number.isNaN(numValue) ? displayValue : numValue;\n }\n\n // Default: pass through (handles primitives, arrays, objects, etc.)\n return displayValue;\n },\n [type, transform],\n );\n\n return {\n toDisplayValue,\n toFormValue,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyGA,MAAa,0BAA8C,EACzD,MACA,gBACqF;AAiDrF,QAAO;EACL,gBA9CqB,aACpB,cAAiC;AAChC,OAAI,WAAW,eACb,QAAO,UAAU,eAAe,UAAU;AAI5C,OAAI,SAAS,UAAU;AACrB,QAAI,cAAc,GAChB,QAAO;IAET,MAAM,WAAW,OAAO,UAAU;AAClC,WAAQ,OAAO,MAAM,SAAS,GAAG,YAAY;;AAI/C,UAAQ,aAAa;KAEvB,CAAC,MAAM,UAAU,CAClB;EA4BC,aAvBkB,aACjB,iBAAoC;AACnC,OAAI,WAAW,YACb,QAAO,UAAU,YAAY,aAAa;AAI5C,OAAI,SAAS,UAAU;AACrB,QAAI,iBAAiB,GACnB,QAAO;IAET,MAAM,WAAW,OAAO,aAAa;AACrC,WAAO,OAAO,MAAM,SAAS,GAAG,eAAe;;AAIjD,UAAO;KAET,CAAC,MAAM,UAAU,CAClB;EAKA"}
@@ -88,10 +88,11 @@ interface UseInputValueTransformReturn<TDisplay = unknown> {
88
88
  *
89
89
  * const { onChange, onBlur, value } = useInputValueDebounce({
90
90
  * ...transform,
91
- * initialValue: field.value,
92
91
  * debounceDelay: 300,
92
+ * name: 'fieldName',
93
93
  * onBlur: field.onBlur,
94
94
  * onChange: field.onChange,
95
+ * value: field.value,
95
96
  * });
96
97
  *
97
98
  * return <input value={value} onChange={onChange} onBlur={onBlur} />;
@@ -104,4 +105,4 @@ declare const useInputValueTransform: <TDisplay = unknown>({
104
105
  }: UseInputValueTransformOptions<TDisplay>) => UseInputValueTransformReturn<TDisplay>;
105
106
  //#endregion
106
107
  export { useInputValueTransform as i, UseInputValueTransformOptions as n, UseInputValueTransformReturn as r, InputValueTransform as t };
107
- //# sourceMappingURL=useInputValueTransform-BID-CQ-y.d.cts.map
108
+ //# sourceMappingURL=useInputValueTransform-Cc0qEsnS.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useInputValueTransform-Cc0qEsnS.d.ts","names":[],"sources":["../src/hooks/useInputValueTransform/useInputValueTransform.ts"],"sourcesContent":[],"mappings":";UAEiB;EAAA;EAOA,cAAA,EAAA,CAAA,KAAA,EAAA,OAAA,EAA6B,GALR,QAKQ;EAO7B;EAyFJ,WAAA,EAAA,CAAA,KAAA,EAnGU,QA2JtB,EAAA,GAAA,OAAA;;AAxD0D,UAhG1C,6BAgG0C,CAAA,WAAA,OAAA,CAAA,CAAA;EAG1B;EAA9B,IAAA,CAAA,EAAA,MAAA,GAAA,QAAA,GAAA,UAAA;EAAuE;EAA7B,SAAA,CAAA,EA/F/B,mBA+F+B,CA/FX,QA+FW,CAAA;;UA5F5B;;0CAEyB;;8BAEZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAqFjB;;;GAGV,8BAA8B,cAAY,6BAA6B"}
@@ -1,6 +1,6 @@
1
- import { t as InputValueTransform } from "./useInputValueTransform-BID-CQ-y.cjs";
2
- import { r as useController } from "./useController-C_MZLZIp.cjs";
3
- import { n as useFormContext } from "./useFormContext-B083Y-kw.cjs";
1
+ import { t as InputValueTransform } from "./useInputValueTransform-BV8o0PMI.cjs";
2
+ import { r as useController } from "./useController-BArZd2Vp.cjs";
3
+ import { n as useFormContext } from "./useFormContext--yod5xzQ.cjs";
4
4
  import { t as useInput } from "./useInput--wjwIBc5.cjs";
5
5
  import { ReactNode } from "react";
6
6
  import { FieldError, FieldValues, Path } from "react-hook-form";
@@ -95,4 +95,4 @@ interface UseUniformFieldReturn<TFieldValues extends FieldValues = FieldValues>
95
95
  declare const useUniformField: <TFieldValues extends FieldValues = FieldValues, TDisplay = unknown>(params: UseUniformFieldParams<TFieldValues, TDisplay>) => UseUniformFieldReturn<TFieldValues>;
96
96
  //#endregion
97
97
  export { UseUniformFieldReturn as n, useUniformField as r, UseUniformFieldParams as t };
98
- //# sourceMappingURL=useUniformField-B2OZ-Z1G.d.cts.map
98
+ //# sourceMappingURL=useUniformField-B2zQtEbr.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useUniformField-B2OZ-Z1G.d.cts","names":[],"sources":["../src/hooks/useUniformField/useUniformField.tsx"],"sourcesContent":[],"mappings":";;;;;;;;UAyCiB,2CACM,cAAc;;EADpB,IAAA,EAKT,IALS,CAKJ,YALI,CAAqB,GAAA,MAAA;EACf;EAAc,SAAA,CAAA,EAAA,MAAA;EAIxB;EAAL,QAAA,CAAA,EAAA,OAAA;EAME;EAIwB,KAAA,CAAA,EAJxB,SAIwB;EAApB;EAAmB,MAAA,CAAA,EAAA,MAAA;EAKhB;EACM,SAAA,CAAA,EANT,mBAMS,CANW,QAMX,CAAA;EAAc;EAKO,IAAA,CAAA,EAAA,MAAA,GAAA,QAAA,GAAA,UAAA;;AAAjC,UANM,qBAMN,CAAA,qBALY,WAKZ,GAL0B,WAK1B,CAAA,CAAA;EAEmC;EAAf,SAAA,EAAA,MAAA,GAAA,SAAA;EAAlB;EAMJ,OAAA,EARE,UAQF,CAAA,OARoB,cAQpB,CARmC,YAQnC,CAAA,CAAA,CAAA,SAAA,CAAA;EAEO;EAEyB,SAAA,EAV5B,UAU4B,CAAA,OAVV,cAUU,CAVK,YAUL,CAAA,CAAA,CAAA,WAAA,CAAA;EAAd;EAAlB,YAAA,EAAA,OAAA;EAEiC;EAAlB,QAAA,EAAA,OAAA,GAAA,SAAA;EAEmB;EAAlB,KAAA,EARhB,UAQgB,EAAA,GAAA,SAAA;EAEU;EAAlB,YAAA,EARD,SAQC,GAAA,IAAA;EAE6B;EAAf,KAAA,EARtB,UAQsB,CAAA,OARJ,aAQI,CARU,YAQV,CAAA,CAAA,CAAA,OAAA,CAAA;EAAlB;EAIJ,oBAAA,EAVe,UAUf,CAAA,OAViC,QAUjC,CAAA,CAAA,sBAAA,CAAA;EAEiC;EAAd,qBAAA,EAVH,UAUG,CAAA,OAVe,QAUf,CAAA,CAAA,uBAAA,CAAA;EAAlB;EAEkC,aAAA,EAV3B,UAU2B,CAAA,OAVT,QAUS,CAAA,CAAA,eAAA,CAAA;EAAd;EAAlB,SAAA,EARC,UAQD,CAAA,OARmB,cAQnB,CARkC,YAQlC,CAAA,CAAA,CAAA,WAAA,CAAA;EAE2B;EAAd,OAAA,EAAA,OAAA;EAAlB;EAIwC,KAAA,EAVtC,SAUsC,GAAA,IAAA;EAAf;EAAlB,MAAA,EARJ,UAQI,CAAA,OARc,aAQd,CAR4B,YAQ5B,CAAA,CAAA,CAAA,OAAA,CAAA,CAAA,QAAA,CAAA;EAAU;EAiCX,QAAA,EAvCD,UAqMX,CAAA,OArM6B,aAqM7B,CArM2C,YAqM3C,CAAA,CAAA,CAAA,OAAA,CAAA,CAAA,UAAA,CAAA;EA7JsB;EAAc,GAAA,EAtC9B,UAsC8B,CAAA,OAtCZ,aAsCY,CAtCE,YAsCF,CAAA,CAAA,CAAA,OAAA,CAAA,CAAA,KAAA,CAAA;EAGL;EAAc,QAAA,EAAA,OAAA;EAApC;EACe,UAAA,EAtCX,UAsCW,CAAA,OAtCO,cAsCP,CAtCsB,YAsCtB,CAAA,CAAA,CAAA,YAAA,CAAA;EAAtB;EAAqB,MAAA,EAAA,MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cALX,uCACU,cAAc,yCAG3B,sBAAsB,cAAc,cAC3C,sBAAsB"}
1
+ {"version":3,"file":"useUniformField-B2zQtEbr.d.cts","names":[],"sources":["../src/hooks/useUniformField/useUniformField.tsx"],"sourcesContent":[],"mappings":";;;;;;;;UA0CiB,2CACM,cAAc;;EADpB,IAAA,EAKT,IALS,CAKJ,YALI,CAAqB,GAAA,MAAA;EACf;EAAc,SAAA,CAAA,EAAA,MAAA;EAIxB;EAAL,QAAA,CAAA,EAAA,OAAA;EAME;EAIwB,KAAA,CAAA,EAJxB,SAIwB;EAApB;EAAmB,MAAA,CAAA,EAAA,MAAA;EAKhB;EACM,SAAA,CAAA,EANT,mBAMS,CANW,QAMX,CAAA;EAAc;EAKO,IAAA,CAAA,EAAA,MAAA,GAAA,QAAA,GAAA,UAAA;;AAAjC,UANM,qBAMN,CAAA,qBALY,WAKZ,GAL0B,WAK1B,CAAA,CAAA;EAEmC;EAAf,SAAA,EAAA,MAAA,GAAA,SAAA;EAAlB;EAMJ,OAAA,EARE,UAQF,CAAA,OARoB,cAQpB,CARmC,YAQnC,CAAA,CAAA,CAAA,SAAA,CAAA;EAEO;EAEyB,SAAA,EAV5B,UAU4B,CAAA,OAVV,cAUU,CAVK,YAUL,CAAA,CAAA,CAAA,WAAA,CAAA;EAAd;EAAlB,YAAA,EAAA,OAAA;EAEiC;EAAlB,QAAA,EAAA,OAAA,GAAA,SAAA;EAEmB;EAAlB,KAAA,EARhB,UAQgB,EAAA,GAAA,SAAA;EAEU;EAAlB,YAAA,EARD,SAQC,GAAA,IAAA;EAE6B;EAAf,KAAA,EARtB,UAQsB,CAAA,OARJ,aAQI,CARU,YAQV,CAAA,CAAA,CAAA,OAAA,CAAA;EAAlB;EAIJ,oBAAA,EAVe,UAUf,CAAA,OAViC,QAUjC,CAAA,CAAA,sBAAA,CAAA;EAEiC;EAAd,qBAAA,EAVH,UAUG,CAAA,OAVe,QAUf,CAAA,CAAA,uBAAA,CAAA;EAAlB;EAEkC,aAAA,EAV3B,UAU2B,CAAA,OAVT,QAUS,CAAA,CAAA,eAAA,CAAA;EAAd;EAAlB,SAAA,EARC,UAQD,CAAA,OARmB,cAQnB,CARkC,YAQlC,CAAA,CAAA,CAAA,WAAA,CAAA;EAE2B;EAAd,OAAA,EAAA,OAAA;EAAlB;EAIwC,KAAA,EAVtC,SAUsC,GAAA,IAAA;EAAf;EAAlB,MAAA,EARJ,UAQI,CAAA,OARc,aAQd,CAR4B,YAQ5B,CAAA,CAAA,CAAA,OAAA,CAAA,CAAA,QAAA,CAAA;EAAU;EAiCX,QAAA,EAvCD,UA6MX,CAAA,OA7M6B,aA6M7B,CA7M2C,YA6M3C,CAAA,CAAA,CAAA,OAAA,CAAA,CAAA,UAAA,CAAA;EArKsB;EAAc,GAAA,EAtC9B,UAsC8B,CAAA,OAtCZ,aAsCY,CAtCE,YAsCF,CAAA,CAAA,CAAA,OAAA,CAAA,CAAA,KAAA,CAAA;EAGL;EAAc,QAAA,EAAA,OAAA;EAApC;EACe,UAAA,EAtCX,UAsCW,CAAA,OAtCO,cAsCP,CAtCsB,YAsCtB,CAAA,CAAA,CAAA,YAAA,CAAA;EAAtB;EAAqB,MAAA,EAAA,MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cALX,uCACU,cAAc,yCAG3B,sBAAsB,cAAc,cAC3C,sBAAsB"}
@@ -1,9 +1,10 @@
1
- import { n as FieldCopyTestIdButton_default } from "./FieldCopyTestIdButton-DWPCDJ-s.js";
2
- import { n as FieldValidationError_default } from "./FieldValidationError-1hiDEFew.js";
3
- import { t as useController } from "./useController-CumIERks.js";
4
- import { n as useFormContext } from "./useFormContext-JCm1UR_e.js";
1
+ import { r as isValueEmpty } from "./helpers-CCINRgQk.js";
2
+ import { n as FieldCopyTestIdButton_default } from "./FieldCopyTestIdButton-D9f1B-VS.js";
3
+ import { n as FieldValidationError_default } from "./FieldValidationError-BYwitb_B.js";
4
+ import { t as useController } from "./useController-g0AlWM__.js";
5
+ import { n as useFormContext } from "./useFormContext-BFoXZNkp.js";
5
6
  import { t as useInput } from "./useInput-DZ6KGBxw.js";
6
- import { t as useInputValueTransform } from "./useInputValueTransform-aiIf8lq5.js";
7
+ import { t as useInputValueTransform } from "./useInputValueTransform-CMNC21vX.js";
7
8
  import { isTestEnvironment } from "@fuf-stack/pixel-utils";
8
9
  import React from "react";
9
10
  import { useDebounce } from "@fuf-stack/pixels";
@@ -60,7 +61,7 @@ const useDebouncedInvalid = (invalid, delayMs) => {
60
61
  const useUniformField = (params) => {
61
62
  const { name, ariaLabel: customAriaLabel, disabled = false, testId: explicitTestId, label, type, transform } = params;
62
63
  const { control, debugMode, formState: { submitCount }, getFieldState, getValues, resetField } = useFormContext();
63
- const { error, invalid: rawInvalid, isDirty, isTouched, required, testId } = getFieldState(name, explicitTestId);
64
+ const { error, invalid: rawInvalid, isTouched, required, testId } = getFieldState(name, explicitTestId);
64
65
  const { field } = useController({
65
66
  control,
66
67
  disabled,
@@ -76,7 +77,32 @@ const useUniformField = (params) => {
76
77
  fieldOnChange(toFormValue(eventOrValue?.target?.value ?? eventOrValue));
77
78
  };
78
79
  const defaultValue = getValues()?.[name];
79
- const invalid = useDebouncedInvalid(rawInvalid && (isDirty || isTouched || submitCount > 0), 200);
80
+ /**
81
+ * Determine when to show the invalid state to the user.
82
+ *
83
+ * Show errors when the field is invalid AND any of these conditions are met:
84
+ * - Field has a value (show validation errors like format/length while typing)
85
+ * - Field is touched (focused and blurred) - good for text inputs
86
+ * - Form has been submitted - shows all errors after submit attempt
87
+ *
88
+ * Note: We intentionally don't use isDirty because:
89
+ * - Newly added array elements are marked "dirty" by RHF, causing immediate errors
90
+ * - Field Cards with empty initial values show errors immediately
91
+ * - hasValue + isTouched covers the same use cases more reliably
92
+ *
93
+ * This prevents showing errors on pristine/untouched/empty fields for better UX.
94
+ * Examples:
95
+ * - Text input: User loads form with empty required field → no error shown yet
96
+ * - Text input: User types invalid content → error shows immediately (has value)
97
+ * - Text input: User focuses and blurs without typing → error shows (via isTouched)
98
+ * - Checkbox/radio: User selects option → error shows immediately (has value)
99
+ * - Field array: User adds element → no error yet; after blur → error shows
100
+ * - Any field: User submits form → all errors show (via submitCount)
101
+ *
102
+ * The entire condition is debounced to prevent flickering and allow smooth animations.
103
+ */
104
+ const hasValue = !isValueEmpty(fieldValue);
105
+ const invalid = useDebouncedInvalid(rawInvalid && (hasValue || isTouched || submitCount > 0), 200);
80
106
  const showTestIdCopyButton = debugMode === "debug-testids";
81
107
  const labelNode = !!label || showTestIdCopyButton ? /* @__PURE__ */ jsxs(Fragment, { children: [label !== false ? label : null, showTestIdCopyButton ? /* @__PURE__ */ jsx(FieldCopyTestIdButton_default, { testId }) : null] }) : null;
82
108
  const errorMessage = /* @__PURE__ */ jsx(FieldValidationError_default, {
@@ -126,4 +152,4 @@ const useUniformField = (params) => {
126
152
 
127
153
  //#endregion
128
154
  export { useUniformField as t };
129
- //# sourceMappingURL=useUniformField-gU4qYUwL.js.map
155
+ //# sourceMappingURL=useUniformField-BKVVns0E.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUniformField-BKVVns0E.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 { isTestEnvironment } from '@fuf-stack/pixel-utils';\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\n/**\n * Debounce invalid state changes to prevent UI flicker on rapid changes.\n *\n * Primary purpose: Reduce UI flicker when validation state changes rapidly\n * (e.g., during fast typing). Without debouncing, error messages would flash\n * in/out rapidly, creating a poor UX.\n *\n * Secondary benefit: When animations are enabled (default), gives time for\n * enter/exit animations to complete smoothly.\n *\n * Behavior:\n * - Debounces both true → false and false → true transitions by `delayMs`\n * - Disabled in test environments for immediate snapshots\n */\nconst useDebouncedInvalid = (invalid: boolean, delayMs: number) => {\n const debouncedInvalid = useDebounce(invalid, delayMs);\n\n // Disable debouncing in test environments for immediate snapshots\n if (isTestEnvironment()) {\n return invalid;\n }\n\n return debouncedInvalid;\n};\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 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 as typeof fieldValue);\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 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: We intentionally don't use isDirty because:\n * - Newly added array elements are marked \"dirty\" by RHF, causing immediate errors\n * - Field Cards with empty initial values show errors immediately\n * - hasValue + isTouched covers the same use cases more reliably\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 = rawInvalid && (hasValue || isTouched || submitCount > 0);\n const invalid = useDebouncedInvalid(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":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,uBAAuB,SAAkB,YAAoB;CACjE,MAAM,mBAAmB,YAAY,SAAS,QAAQ;AAGtD,KAAI,mBAAmB,CACrB,QAAO;AAGT,QAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgGT,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,gBAA8B;CAElC,MAAM,EACJ,OACA,SAAS,YACT,WACA,UACA,WACE,cAAc,MAAM,eAAe;CAEvC,MAAM,EAAE,UAAU,cAA4B;EAC5C;EACA;EACA;EACD,CAAC;CACF,MAAM,EACJ,UAAU,eACV,OAAO,YACP,UAAU,YACV,QACA,QACE;CAIJ,MAAM,EAAE,gBAAgB,gBAAgB,uBAAiC;EACvE;EACA;EACD,CAAC;CAGF,MAAM,mBAAmB,eAAe,WAAW;CACnD,MAAM,uBAAuB,iBAA+C;AAM1E,gBADkB,YAFf,cAAsD,QAAQ,SAC/D,aACqD,CACV;;CAG/C,MAAM,eAAgB,WAAW,GAC/B;;;;;;;;;;;;;;;;;;;;;;;;;CA6BF,MAAM,WAAW,CAAC,aAAa,WAAW;CAE1C,MAAM,UAAU,oBADI,eAAe,YAAY,aAAa,cAAc,IACzB,IAAI;CAMrD,MAAM,uBAAuB,cAAc;CAC3C,MAAM,YACJ,CAAC,CAAC,SAAS,uBACT,4CACG,UAAU,QAAQ,QAAQ,MAC1B,uBACC,oBAACA,iCAA8B,SAAU,GACvC,QACH,GACD;CAIN,MAAM,eAAe,oBAACC;EAA4B;EAAe;GAAU;CAK3E,MAAM,EAAE,sBAAsB,eAAe,0BAC3C,SAAS;EACP;EACA,YAAY,EAEV,eAAe,OAChB;EACD,cAAc,KAAK,UAAU,MAAM;EACnC,WAAW;EACX,YAAY;EACZ;EACA,gBAAgB;EACjB,CAAC;AAQJ,QAAO;EACL,WAHA,oBAAoB,OAAO,UAAU,WAAW,QAAQ;EAIxD;EACA;EACA;EACA,UAAU;EACV;EACA;EACA,OAAO;GACL,GAAG;GACH,OAAO;GACP,UAAU;GACX;EACD;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;EACA,UAAU;EACV;EACA;EACA;EACA;EACD"}
@@ -1,9 +1,10 @@
1
- const require_FormContext = require('./FormContext-Bb6d8hdG.cjs');
2
- const require_FieldCopyTestIdButton = require('./FieldCopyTestIdButton-BSYcSo2o.cjs');
3
- const require_FieldValidationError = require('./FieldValidationError-CE8R8qry.cjs');
4
- const require_useController = require('./useController-CkmO5CLh.cjs');
5
- const require_useFormContext = require('./useFormContext-Bp0EODoO.cjs');
6
- const require_useInputValueTransform = require('./useInputValueTransform-DFPA3KVy.cjs');
1
+ const require_FormContext = require('./FormContext-Lw4YL4-B.cjs');
2
+ const require_helpers = require('./helpers-nYTmL2gX.cjs');
3
+ const require_FieldCopyTestIdButton = require('./FieldCopyTestIdButton-By-hEZgA.cjs');
4
+ const require_FieldValidationError = require('./FieldValidationError-D64j5gnH.cjs');
5
+ const require_useController = require('./useController-BBxji1nQ.cjs');
6
+ const require_useFormContext = require('./useFormContext-CEr3zcL6.cjs');
7
+ const require_useInputValueTransform = require('./useInputValueTransform-BNmfaj5D.cjs');
7
8
  let _fuf_stack_pixel_utils = require("@fuf-stack/pixel-utils");
8
9
  let react = require("react");
9
10
  react = require_FormContext.__toESM(react);
@@ -62,7 +63,7 @@ const useDebouncedInvalid = (invalid, delayMs) => {
62
63
  const useUniformField = (params) => {
63
64
  const { name, ariaLabel: customAriaLabel, disabled = false, testId: explicitTestId, label, type, transform } = params;
64
65
  const { control, debugMode, formState: { submitCount }, getFieldState, getValues, resetField } = require_useFormContext.useFormContext();
65
- const { error, invalid: rawInvalid, isDirty, isTouched, required, testId } = getFieldState(name, explicitTestId);
66
+ const { error, invalid: rawInvalid, isTouched, required, testId } = getFieldState(name, explicitTestId);
66
67
  const { field } = require_useController.useController({
67
68
  control,
68
69
  disabled,
@@ -78,7 +79,32 @@ const useUniformField = (params) => {
78
79
  fieldOnChange(toFormValue(eventOrValue?.target?.value ?? eventOrValue));
79
80
  };
80
81
  const defaultValue = getValues()?.[name];
81
- const invalid = useDebouncedInvalid(rawInvalid && (isDirty || isTouched || submitCount > 0), 200);
82
+ /**
83
+ * Determine when to show the invalid state to the user.
84
+ *
85
+ * Show errors when the field is invalid AND any of these conditions are met:
86
+ * - Field has a value (show validation errors like format/length while typing)
87
+ * - Field is touched (focused and blurred) - good for text inputs
88
+ * - Form has been submitted - shows all errors after submit attempt
89
+ *
90
+ * Note: We intentionally don't use isDirty because:
91
+ * - Newly added array elements are marked "dirty" by RHF, causing immediate errors
92
+ * - Field Cards with empty initial values show errors immediately
93
+ * - hasValue + isTouched covers the same use cases more reliably
94
+ *
95
+ * This prevents showing errors on pristine/untouched/empty fields for better UX.
96
+ * Examples:
97
+ * - Text input: User loads form with empty required field → no error shown yet
98
+ * - Text input: User types invalid content → error shows immediately (has value)
99
+ * - Text input: User focuses and blurs without typing → error shows (via isTouched)
100
+ * - Checkbox/radio: User selects option → error shows immediately (has value)
101
+ * - Field array: User adds element → no error yet; after blur → error shows
102
+ * - Any field: User submits form → all errors show (via submitCount)
103
+ *
104
+ * The entire condition is debounced to prevent flickering and allow smooth animations.
105
+ */
106
+ const hasValue = !require_helpers.isValueEmpty(fieldValue);
107
+ const invalid = useDebouncedInvalid(rawInvalid && (hasValue || isTouched || submitCount > 0), 200);
82
108
  const showTestIdCopyButton = debugMode === "debug-testids";
83
109
  const labelNode = !!label || showTestIdCopyButton ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [label !== false ? label : null, showTestIdCopyButton ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FieldCopyTestIdButton.FieldCopyTestIdButton_default$1, { testId }) : null] }) : null;
84
110
  const errorMessage = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FieldValidationError.FieldValidationError_default$1, {
@@ -133,4 +159,4 @@ Object.defineProperty(exports, 'useUniformField', {
133
159
  return useUniformField;
134
160
  }
135
161
  });
136
- //# sourceMappingURL=useUniformField-Bj23Kvbs.cjs.map
162
+ //# sourceMappingURL=useUniformField-D6fwSjrH.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUniformField-D6fwSjrH.cjs","names":["useFormContext","useController","useInputValueTransform","isValueEmpty","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 { isTestEnvironment } from '@fuf-stack/pixel-utils';\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\n/**\n * Debounce invalid state changes to prevent UI flicker on rapid changes.\n *\n * Primary purpose: Reduce UI flicker when validation state changes rapidly\n * (e.g., during fast typing). Without debouncing, error messages would flash\n * in/out rapidly, creating a poor UX.\n *\n * Secondary benefit: When animations are enabled (default), gives time for\n * enter/exit animations to complete smoothly.\n *\n * Behavior:\n * - Debounces both true → false and false → true transitions by `delayMs`\n * - Disabled in test environments for immediate snapshots\n */\nconst useDebouncedInvalid = (invalid: boolean, delayMs: number) => {\n const debouncedInvalid = useDebounce(invalid, delayMs);\n\n // Disable debouncing in test environments for immediate snapshots\n if (isTestEnvironment()) {\n return invalid;\n }\n\n return debouncedInvalid;\n};\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 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 as typeof fieldValue);\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 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: We intentionally don't use isDirty because:\n * - Newly added array elements are marked \"dirty\" by RHF, causing immediate errors\n * - Field Cards with empty initial values show errors immediately\n * - hasValue + isTouched covers the same use cases more reliably\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 = rawInvalid && (hasValue || isTouched || submitCount > 0);\n const invalid = useDebouncedInvalid(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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,uBAAuB,SAAkB,YAAoB;CACjE,MAAM,sDAA+B,SAAS,QAAQ;AAGtD,oDAAuB,CACrB,QAAO;AAGT,QAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgGT,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,eACEA,uCAA8B;CAElC,MAAM,EACJ,OACA,SAAS,YACT,WACA,UACA,WACE,cAAc,MAAM,eAAe;CAEvC,MAAM,EAAE,UAAUC,oCAA4B;EAC5C;EACA;EACA;EACD,CAAC;CACF,MAAM,EACJ,UAAU,eACV,OAAO,YACP,UAAU,YACV,QACA,QACE;CAIJ,MAAM,EAAE,gBAAgB,gBAAgBC,sDAAiC;EACvE;EACA;EACD,CAAC;CAGF,MAAM,mBAAmB,eAAe,WAAW;CACnD,MAAM,uBAAuB,iBAA+C;AAM1E,gBADkB,YAFf,cAAsD,QAAQ,SAC/D,aACqD,CACV;;CAG/C,MAAM,eAAgB,WAAW,GAC/B;;;;;;;;;;;;;;;;;;;;;;;;;CA6BF,MAAM,WAAW,CAACC,6BAAa,WAAW;CAE1C,MAAM,UAAU,oBADI,eAAe,YAAY,aAAa,cAAc,IACzB,IAAI;CAMrD,MAAM,uBAAuB,cAAc;CAC3C,MAAM,YACJ,CAAC,CAAC,SAAS,uBACT,qFACG,UAAU,QAAQ,QAAQ,MAC1B,uBACC,2CAACC,iEAA8B,SAAU,GACvC,QACH,GACD;CAIN,MAAM,eAAe,2CAACC;EAA4B;EAAe;GAAU;CAK3E,MAAM,EAAE,sBAAsB,eAAe,sDAClC;EACP;EACA,YAAY,EAEV,eAAe,OAChB;EACD,cAAc,KAAK,UAAU,MAAM;EACnC,WAAW;EACX,YAAY;EACZ;EACA,gBAAgB;EACjB,CAAC;AAQJ,QAAO;EACL,WAHA,oBAAoB,OAAO,UAAU,WAAW,QAAQ;EAIxD;EACA;EACA;EACA,UAAU;EACV;EACA;EACA,OAAO;GACL,GAAG;GACH,OAAO;GACP,UAAU;GACX;EACD;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;EACA,UAAU;EACV;EACA;EACA;EACA;EACD"}
@@ -1,6 +1,6 @@
1
- import { t as InputValueTransform } from "./useInputValueTransform-D7LfyYRe.js";
2
- import { r as useController$1 } from "./useController-hjpJQf0w.js";
3
- import { n as useFormContext$1 } from "./useFormContext-B2TS6xq0.js";
1
+ import { t as InputValueTransform } from "./useInputValueTransform-Cc0qEsnS.js";
2
+ import { r as useController$1 } from "./useController-MVHJ7WFp.js";
3
+ import { n as useFormContext$1 } from "./useFormContext-Cw6aAhos.js";
4
4
  import { t as useInput } from "./useInput-BCdeYOOg.js";
5
5
  import { ReactNode } from "react";
6
6
  import { FieldError, FieldValues, Path } from "react-hook-form";
@@ -95,4 +95,4 @@ interface UseUniformFieldReturn<TFieldValues extends FieldValues = FieldValues>
95
95
  declare const useUniformField: <TFieldValues extends FieldValues = FieldValues, TDisplay = unknown>(params: UseUniformFieldParams<TFieldValues, TDisplay>) => UseUniformFieldReturn<TFieldValues>;
96
96
  //#endregion
97
97
  export { UseUniformFieldReturn as n, useUniformField as r, UseUniformFieldParams as t };
98
- //# sourceMappingURL=useUniformField-CwEHonNe.d.ts.map
98
+ //# sourceMappingURL=useUniformField-RxZqXMuD.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useUniformField-CwEHonNe.d.ts","names":[],"sources":["../src/hooks/useUniformField/useUniformField.tsx"],"sourcesContent":[],"mappings":";;;;;;;;UAyCiB,2CACM,cAAc;;EADpB,IAAA,EAKT,IALS,CAKJ,YALI,CAAqB,GAAA,MAAA;EACf;EAAc,SAAA,CAAA,EAAA,MAAA;EAIxB;EAAL,QAAA,CAAA,EAAA,OAAA;EAME;EAIwB,KAAA,CAAA,EAJxB,SAIwB;EAApB;EAAmB,MAAA,CAAA,EAAA,MAAA;EAKhB;EACM,SAAA,CAAA,EANT,mBAMS,CANW,QAMX,CAAA;EAAc;EAKO,IAAA,CAAA,EAAA,MAAA,GAAA,QAAA,GAAA,UAAA;;AAAjC,UANM,qBAMN,CAAA,qBALY,WAKZ,GAL0B,WAK1B,CAAA,CAAA;EAEmC;EAAf,SAAA,EAAA,MAAA,GAAA,SAAA;EAAlB;EAMJ,OAAA,EARE,UAQF,CAAA,OARoB,gBAQpB,CARmC,YAQnC,CAAA,CAAA,CAAA,SAAA,CAAA;EAEO;EAEyB,SAAA,EAV5B,UAU4B,CAAA,OAVV,gBAUU,CAVK,YAUL,CAAA,CAAA,CAAA,WAAA,CAAA;EAAd;EAAlB,YAAA,EAAA,OAAA;EAEiC;EAAlB,QAAA,EAAA,OAAA,GAAA,SAAA;EAEmB;EAAlB,KAAA,EARhB,UAQgB,EAAA,GAAA,SAAA;EAEU;EAAlB,YAAA,EARD,SAQC,GAAA,IAAA;EAE6B;EAAf,KAAA,EARtB,UAQsB,CAAA,OARJ,eAQI,CARU,YAQV,CAAA,CAAA,CAAA,OAAA,CAAA;EAAlB;EAIJ,oBAAA,EAVe,UAUf,CAAA,OAViC,QAUjC,CAAA,CAAA,sBAAA,CAAA;EAEiC;EAAd,qBAAA,EAVH,UAUG,CAAA,OAVe,QAUf,CAAA,CAAA,uBAAA,CAAA;EAAlB;EAEkC,aAAA,EAV3B,UAU2B,CAAA,OAVT,QAUS,CAAA,CAAA,eAAA,CAAA;EAAd;EAAlB,SAAA,EARC,UAQD,CAAA,OARmB,gBAQnB,CARkC,YAQlC,CAAA,CAAA,CAAA,WAAA,CAAA;EAE2B;EAAd,OAAA,EAAA,OAAA;EAAlB;EAIwC,KAAA,EAVtC,SAUsC,GAAA,IAAA;EAAf;EAAlB,MAAA,EARJ,UAQI,CAAA,OARc,eAQd,CAR4B,YAQ5B,CAAA,CAAA,CAAA,OAAA,CAAA,CAAA,QAAA,CAAA;EAAU;EAiCX,QAAA,EAvCD,UAqMX,CAAA,OArM6B,eAqM7B,CArM2C,YAqM3C,CAAA,CAAA,CAAA,OAAA,CAAA,CAAA,UAAA,CAAA;EA7JsB;EAAc,GAAA,EAtC9B,UAsC8B,CAAA,OAtCZ,eAsCY,CAtCE,YAsCF,CAAA,CAAA,CAAA,OAAA,CAAA,CAAA,KAAA,CAAA;EAGL;EAAc,QAAA,EAAA,OAAA;EAApC;EACe,UAAA,EAtCX,UAsCW,CAAA,OAtCO,gBAsCP,CAtCsB,YAsCtB,CAAA,CAAA,CAAA,YAAA,CAAA;EAAtB;EAAqB,MAAA,EAAA,MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cALX,uCACU,cAAc,yCAG3B,sBAAsB,cAAc,cAC3C,sBAAsB"}
1
+ {"version":3,"file":"useUniformField-RxZqXMuD.d.ts","names":[],"sources":["../src/hooks/useUniformField/useUniformField.tsx"],"sourcesContent":[],"mappings":";;;;;;;;UA0CiB,2CACM,cAAc;;EADpB,IAAA,EAKT,IALS,CAKJ,YALI,CAAqB,GAAA,MAAA;EACf;EAAc,SAAA,CAAA,EAAA,MAAA;EAIxB;EAAL,QAAA,CAAA,EAAA,OAAA;EAME;EAIwB,KAAA,CAAA,EAJxB,SAIwB;EAApB;EAAmB,MAAA,CAAA,EAAA,MAAA;EAKhB;EACM,SAAA,CAAA,EANT,mBAMS,CANW,QAMX,CAAA;EAAc;EAKO,IAAA,CAAA,EAAA,MAAA,GAAA,QAAA,GAAA,UAAA;;AAAjC,UANM,qBAMN,CAAA,qBALY,WAKZ,GAL0B,WAK1B,CAAA,CAAA;EAEmC;EAAf,SAAA,EAAA,MAAA,GAAA,SAAA;EAAlB;EAMJ,OAAA,EARE,UAQF,CAAA,OARoB,gBAQpB,CARmC,YAQnC,CAAA,CAAA,CAAA,SAAA,CAAA;EAEO;EAEyB,SAAA,EAV5B,UAU4B,CAAA,OAVV,gBAUU,CAVK,YAUL,CAAA,CAAA,CAAA,WAAA,CAAA;EAAd;EAAlB,YAAA,EAAA,OAAA;EAEiC;EAAlB,QAAA,EAAA,OAAA,GAAA,SAAA;EAEmB;EAAlB,KAAA,EARhB,UAQgB,EAAA,GAAA,SAAA;EAEU;EAAlB,YAAA,EARD,SAQC,GAAA,IAAA;EAE6B;EAAf,KAAA,EARtB,UAQsB,CAAA,OARJ,eAQI,CARU,YAQV,CAAA,CAAA,CAAA,OAAA,CAAA;EAAlB;EAIJ,oBAAA,EAVe,UAUf,CAAA,OAViC,QAUjC,CAAA,CAAA,sBAAA,CAAA;EAEiC;EAAd,qBAAA,EAVH,UAUG,CAAA,OAVe,QAUf,CAAA,CAAA,uBAAA,CAAA;EAAlB;EAEkC,aAAA,EAV3B,UAU2B,CAAA,OAVT,QAUS,CAAA,CAAA,eAAA,CAAA;EAAd;EAAlB,SAAA,EARC,UAQD,CAAA,OARmB,gBAQnB,CARkC,YAQlC,CAAA,CAAA,CAAA,WAAA,CAAA;EAE2B;EAAd,OAAA,EAAA,OAAA;EAAlB;EAIwC,KAAA,EAVtC,SAUsC,GAAA,IAAA;EAAf;EAAlB,MAAA,EARJ,UAQI,CAAA,OARc,eAQd,CAR4B,YAQ5B,CAAA,CAAA,CAAA,OAAA,CAAA,CAAA,QAAA,CAAA;EAAU;EAiCX,QAAA,EAvCD,UA6MX,CAAA,OA7M6B,eA6M7B,CA7M2C,YA6M3C,CAAA,CAAA,CAAA,OAAA,CAAA,CAAA,UAAA,CAAA;EArKsB;EAAc,GAAA,EAtC9B,UAsC8B,CAAA,OAtCZ,eAsCY,CAtCE,YAsCF,CAAA,CAAA,CAAA,OAAA,CAAA,CAAA,KAAA,CAAA;EAGL;EAAc,QAAA,EAAA,OAAA;EAApC;EACe,UAAA,EAtCX,UAsCW,CAAA,OAtCO,gBAsCP,CAtCsB,YAsCtB,CAAA,CAAA,CAAA,YAAA,CAAA;EAAtB;EAAqB,MAAA,EAAA,MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cALX,uCACU,cAAc,yCAG3B,sBAAsB,cAAc,cAC3C,sBAAsB"}
@@ -1,5 +1,5 @@
1
- import { r as useController$1 } from "./useController-hjpJQf0w.js";
2
- import { n as useFormContext$1 } from "./useFormContext-B2TS6xq0.js";
1
+ import { r as useController$1 } from "./useController-MVHJ7WFp.js";
2
+ import { n as useFormContext$1 } from "./useFormContext-Cw6aAhos.js";
3
3
  import { ReactNode } from "react";
4
4
  import * as react_hook_form0 from "react-hook-form";
5
5
  import { ArrayPath, FieldValues } from "react-hook-form";
@@ -50,7 +50,7 @@ declare const useUniformFieldArray: <TFieldValues extends FieldValues = FieldVal
50
50
  disabled: boolean | undefined;
51
51
  error: react_hook_form0.FieldError[] | undefined;
52
52
  errorMessage: ReactNode | null;
53
- field: Omit<react_hook_form0.ControllerRenderProps<TFieldValues>, "onChange" | "value"> & {
53
+ field: Omit<react_hook_form0.ControllerRenderProps<TFieldValues>, "value" | "onChange"> & {
54
54
  onChange: (...event: any[]) => void;
55
55
  value: string;
56
56
  };
@@ -76,4 +76,4 @@ declare const useUniformFieldArray: <TFieldValues extends FieldValues = FieldVal
76
76
  };
77
77
  //#endregion
78
78
  export { useUniformFieldArray as n, UseUniformFieldArrayProps as t };
79
- //# sourceMappingURL=useUniformFieldArray-CXoWvu6m.d.ts.map
79
+ //# sourceMappingURL=useUniformFieldArray-B_c55CnX.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUniformFieldArray-B_c55CnX.d.ts","names":[],"sources":["../src/hooks/useUniformFieldArray/useUniformFieldArray.ts"],"sourcesContent":[],"mappings":";;;;;;;;UAYiB,+CACM,cAAc;;QAG7B,UAAU;;;EAJD;EACM,mBAAA,CAAA,EAAA,OAAA;EAAc;EAGnB,uBAAA,CAAA,EAAA,OAAA;EAAV;EAYE,QAAA,CAAA,EAAA,OAAA;EAAS;EAeN,MAAA,CAAA,EAAA,MAAA;EACU;EAAc,KAAA,CAAA,EAhB3B,SAgB2B;;;;;;;;;;;;;;cADxB,4CACU,cAAc;;;uBACnC;;;UAAA;;GAQC,0BAA0B;;;;;;;;;;;;;;;;;EAuDpB,KAAA,WAAA,GAAA,IAAA;EAAA,MAAA,EAAA,UAAA,CAAA,sBAAA,CAAA,CAAA,OAAA,CAAA,CAAA,QAAA,CAAA;EAKwC,QAAA,EAAA,UAAA,CAAA,OALxC,eAKwC,CAAA,CAAA,OAAA,CAAA,CAAA,UAAA,CAAA;EAAA,GAAA,EACyB,UADzB,CAAA,OAAA,eAAA,CAAA,CAAA,OAAA,CAAA,CAAA,KAAA,CAAA;EACyB,QAAA,EAAA,OAAA"}
@@ -1,6 +1,6 @@
1
- import { t as flatArrayKey } from "./helpers-B-CJOBt3.js";
2
- import { n as useFormContext$1 } from "./useFormContext-JCm1UR_e.js";
3
- import { t as useUniformField } from "./useUniformField-gU4qYUwL.js";
1
+ import { t as flatArrayKey } from "./helpers-CCINRgQk.js";
2
+ import { n as useFormContext$1 } from "./useFormContext-BFoXZNkp.js";
3
+ import { t as useUniformField } from "./useUniformField-BKVVns0E.js";
4
4
  import { useEffect, useMemo, useRef, useState } from "react";
5
5
  import { useReducedMotion } from "@fuf-stack/pixel-motion";
6
6
  import { useFieldArray } from "react-hook-form";
@@ -81,4 +81,4 @@ const useUniformFieldArray = ({ name, flat = false, elementInitialValue: _elemen
81
81
 
82
82
  //#endregion
83
83
  export { useUniformFieldArray as t };
84
- //# sourceMappingURL=useUniformFieldArray-B5PyxL1P.js.map
84
+ //# sourceMappingURL=useUniformFieldArray-BwE634m6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUniformFieldArray-BwE634m6.js","names":["useRHFFieldArray","useFormContext"],"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 } from '../../helpers';\nimport { useFormContext } from '../useFormContext';\nimport { useUniformField } from '../useUniformField';\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 * - Animation control (disabled during initialization)\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 } = useRHFFieldArray({\n control,\n name,\n });\n\n const { trigger, setValue } = useFormContext<TFieldValues>();\n\n // Determine if initialization is needed (initially or after reset).\n // This flag automatically handles both scenarios:\n // - Initial mount: fields.length starts at 0\n // - Form reset: fields.length becomes 0 again\n // Additional initialization conditions can be added here later (e.g., minElements > 0)\n // Using useMemo ensures this value is properly tracked by React and effects can depend on it\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 // Initialization/Re-initialization: Add initial element when needed.\n // This handles both initial mount and form reset scenarios by reacting to needsInitialize.\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":";;;;;;;;;;;;;;;;;;;;AA2CA,MAAa,wBAEX,EACA,MACA,OAAO,OACP,qBAAqB,uBAAuB,MAC5C,0BAA0B,OAC1B,UACA,QAAQ,gBACR,YAC6C;CAE7C,MAAM,eAAe,gBAA8B;EAC3C;EACN;EACA,QAAQ;EACR;EACD,CAAC;CAEF,MAAM,EAAE,YAAY;CAEpB,MAAM,EAAE,QAAQ,QAAQ,QAAQ,QAAQ,SAASA,cAAiB;EAChE;EACA;EACD,CAAC;CAEF,MAAM,EAAE,SAAS,aAAaC,kBAA8B;CAQ5D,MAAM,kBAAkB,cAAc;AACpC,SAAO,2BAA2B,OAAO,WAAW;IACnD,CAAC,yBAAyB,OAAO,OAAO,CAAC;CAS5C,MAAM,iBAAiB,OAAO,CAAC,gBAAgB;AAK/C,iBAAgB;AACd,MAAI,gBACF,gBAAe,UAAU;IAE1B,CAAC,gBAAgB,CAAC;AAOrB,iBAAgB;AACd,MAAI,eAAe,QACjB,kBAAiB;AACf,WAAQ,KAA2B;KAClC,IAAI;IAGR,CAAC,OAAO,OAAO,CAAC;CAInB,MAAM,CAAC,kBAAkB,uBAAuB,SAAS,KAAK;CAI9D,MAAM,uBAAuB,kBAAkB;AAC/C,iBAAgB;AACd,MAAI,eAAe,QACjB,qBAAoB,CAAC,CAAC,qBAAqB;IAE5C,CAAC,qBAAqB,CAAC;CAK1B,MAAM,sBAAsB,cAAc;AACxC,SAAO,OACH,GAAG,eAAe,wBAAwB,MAAM,GAC/C,wBAAwB,EAAE;IAC9B,CAAC,MAAM,qBAAqB,CAAC;AAUhC,iBACQ;AACJ,MAAI,iBAAiB;AAGnB,YAAS,MAA4B,CAAC,oBAAoB,EAAS;IACjE,aAAa;IACb,aAAa;IACd,CAAC;AAGF,kBAAe,UAAU;AAKzB,OAAI,CAAC,wBAAwB,iBAC3B,kBAAiB;AACf,wBAAoB,MAAM;MACzB,EAAE;;IAUX,CAAC,gBAAgB,CAClB;AAED,QAAO;EAEL;EACA;EACA;EACA;EACA;EACA;EACA;EAEA,GAAG;EACJ"}
@@ -1,7 +1,7 @@
1
- const require_FormContext = require('./FormContext-Bb6d8hdG.cjs');
2
- const require_helpers = require('./helpers-B84E9vHd.cjs');
3
- const require_useFormContext = require('./useFormContext-Bp0EODoO.cjs');
4
- const require_useUniformField = require('./useUniformField-Bj23Kvbs.cjs');
1
+ const require_FormContext = require('./FormContext-Lw4YL4-B.cjs');
2
+ const require_helpers = require('./helpers-nYTmL2gX.cjs');
3
+ const require_useFormContext = require('./useFormContext-CEr3zcL6.cjs');
4
+ const require_useUniformField = require('./useUniformField-D6fwSjrH.cjs');
5
5
  let react = require("react");
6
6
  let _fuf_stack_pixel_motion = require("@fuf-stack/pixel-motion");
7
7
  let react_hook_form = require("react-hook-form");
@@ -87,4 +87,4 @@ Object.defineProperty(exports, 'useUniformFieldArray', {
87
87
  return useUniformFieldArray;
88
88
  }
89
89
  });
90
- //# sourceMappingURL=useUniformFieldArray-G1lokW7x.cjs.map
90
+ //# sourceMappingURL=useUniformFieldArray-Byfmzq97.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUniformFieldArray-Byfmzq97.cjs","names":["useUniformField","useFormContext","flatArrayKey"],"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 } from '../../helpers';\nimport { useFormContext } from '../useFormContext';\nimport { useUniformField } from '../useUniformField';\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 * - Animation control (disabled during initialization)\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 } = useRHFFieldArray({\n control,\n name,\n });\n\n const { trigger, setValue } = useFormContext<TFieldValues>();\n\n // Determine if initialization is needed (initially or after reset).\n // This flag automatically handles both scenarios:\n // - Initial mount: fields.length starts at 0\n // - Form reset: fields.length becomes 0 again\n // Additional initialization conditions can be added here later (e.g., minElements > 0)\n // Using useMemo ensures this value is properly tracked by React and effects can depend on it\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 // Initialization/Re-initialization: Add initial element when needed.\n // This handles both initial mount and form reset scenarios by reacting to needsInitialize.\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":";;;;;;;;;;;;;;;;;;;;;AA2CA,MAAa,wBAEX,EACA,MACA,OAAO,OACP,qBAAqB,uBAAuB,MAC5C,0BAA0B,OAC1B,UACA,QAAQ,gBACR,YAC6C;CAE7C,MAAM,eAAeA,wCAA8B;EAC3C;EACN;EACA,QAAQ;EACR;EACD,CAAC;CAEF,MAAM,EAAE,YAAY;CAEpB,MAAM,EAAE,QAAQ,QAAQ,QAAQ,QAAQ,4CAA0B;EAChE;EACA;EACD,CAAC;CAEF,MAAM,EAAE,SAAS,aAAaC,uCAA8B;CAQ5D,MAAM,2CAAgC;AACpC,SAAO,2BAA2B,OAAO,WAAW;IACnD,CAAC,yBAAyB,OAAO,OAAO,CAAC;CAS5C,MAAM,mCAAwB,CAAC,gBAAgB;AAK/C,4BAAgB;AACd,MAAI,gBACF,gBAAe,UAAU;IAE1B,CAAC,gBAAgB,CAAC;AAOrB,4BAAgB;AACd,MAAI,eAAe,QACjB,kBAAiB;AACf,WAAQ,KAA2B;KAClC,IAAI;IAGR,CAAC,OAAO,OAAO,CAAC;CAInB,MAAM,CAAC,kBAAkB,2CAAgC,KAAK;CAI9D,MAAM,sEAAyC;AAC/C,4BAAgB;AACd,MAAI,eAAe,QACjB,qBAAoB,CAAC,CAAC,qBAAqB;IAE5C,CAAC,qBAAqB,CAAC;CAK1B,MAAM,+CAAoC;AACxC,SAAO,OACH,GAAGC,+BAAe,wBAAwB,MAAM,GAC/C,wBAAwB,EAAE;IAC9B,CAAC,MAAM,qBAAqB,CAAC;AAUhC,4BACQ;AACJ,MAAI,iBAAiB;AAGnB,YAAS,MAA4B,CAAC,oBAAoB,EAAS;IACjE,aAAa;IACb,aAAa;IACd,CAAC;AAGF,kBAAe,UAAU;AAKzB,OAAI,CAAC,wBAAwB,iBAC3B,kBAAiB;AACf,wBAAoB,MAAM;MACzB,EAAE;;IAUX,CAAC,gBAAgB,CAClB;AAED,QAAO;EAEL;EACA;EACA;EACA;EACA;EACA;EACA;EAEA,GAAG;EACJ"}
@@ -1,5 +1,5 @@
1
- import { r as useController } from "./useController-C_MZLZIp.cjs";
2
- import { n as useFormContext } from "./useFormContext-B083Y-kw.cjs";
1
+ import { r as useController } from "./useController-BArZd2Vp.cjs";
2
+ import { n as useFormContext } from "./useFormContext--yod5xzQ.cjs";
3
3
  import { ReactNode } from "react";
4
4
  import * as react_hook_form14 from "react-hook-form";
5
5
  import { ArrayPath, FieldValues } from "react-hook-form";
@@ -50,7 +50,7 @@ declare const useUniformFieldArray: <TFieldValues extends FieldValues = FieldVal
50
50
  disabled: boolean | undefined;
51
51
  error: react_hook_form14.FieldError[] | undefined;
52
52
  errorMessage: ReactNode | null;
53
- field: Omit<react_hook_form14.ControllerRenderProps<TFieldValues>, "onChange" | "value"> & {
53
+ field: Omit<react_hook_form14.ControllerRenderProps<TFieldValues>, "value" | "onChange"> & {
54
54
  onChange: (...event: any[]) => void;
55
55
  value: string;
56
56
  };
@@ -76,4 +76,4 @@ declare const useUniformFieldArray: <TFieldValues extends FieldValues = FieldVal
76
76
  };
77
77
  //#endregion
78
78
  export { useUniformFieldArray as n, UseUniformFieldArrayProps as t };
79
- //# sourceMappingURL=useUniformFieldArray-qtJMEosJ.d.cts.map
79
+ //# sourceMappingURL=useUniformFieldArray-WRuIMhw6.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUniformFieldArray-WRuIMhw6.d.cts","names":[],"sources":["../src/hooks/useUniformFieldArray/useUniformFieldArray.ts"],"sourcesContent":[],"mappings":";;;;;;;;UAYiB,+CACM,cAAc;;QAG7B,UAAU;;;EAJD;EACM,mBAAA,CAAA,EAAA,OAAA;EAAc;EAGnB,uBAAA,CAAA,EAAA,OAAA;EAAV;EAYE,QAAA,CAAA,EAAA,OAAA;EAAS;EAeN,MAAA,CAAA,EAAA,MAAA;EACU;EAAc,KAAA,CAAA,EAhB3B,SAgB2B;;;;;;;;;;;;;;cADxB,4CACU,cAAc;;;uBACnC;;;UAAA;;GAQC,0BAA0B;;;;;;;;;;;;;;;;;EAuDpB,KAAA,WAAA,GAAA,IAAA;EAAA,MAAA,EAAA,UAAA,CAAA,oBAAA,CAAA,CAAA,OAAA,CAAA,CAAA,QAAA,CAAA;EAKwC,QAAA,EAAA,UAAA,CAAA,OALxC,aAKwC,CAAA,CAAA,OAAA,CAAA,CAAA,UAAA,CAAA;EAAA,GAAA,EACyB,UADzB,CAAA,OAAA,aAAA,CAAA,CAAA,OAAA,CAAA,CAAA,KAAA,CAAA;EACyB,QAAA,EAAA,OAAA"}
@@ -75,4 +75,4 @@ declare const useWatchUserChange: <TFieldValues extends FieldValues = FieldValue
75
75
  }: UseWatchUserChangeOptions<TFieldValues>) => void;
76
76
  //#endregion
77
77
  export { useWatchUserChange as n, UseWatchUserChangeOptions as t };
78
- //# sourceMappingURL=useWatchUserChange-BAdiqg2q.d.ts.map
78
+ //# sourceMappingURL=useWatchUserChange-Bf5JKDJJ.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useWatchUserChange-BAdiqg2q.d.ts","names":[],"sources":["../src/hooks/useWatchUserChange/useWatchUserChange.ts"],"sourcesContent":[],"mappings":";;;UAYiB,+CAA+C;;EAA/C,KAAA,EAER,IAFQ,CAEH,YAFG,CAAA;EAA+C;;;;EAUhD,QAAA,EAAA,CAAA,KAAA,EAAA,OAAA,EAAA,OAAA,EAAA;IACoB,QAAA,EADpB,eACoB,CADJ,YACI,CAAA;IAAlB,UAAA,EAAA,iBAAA,CAAkB,YAAlB,CAAA;IACQ,KAAA,EAAb,YAAa,CAAA,YAAA,CAAA;EAAb,CAAA,EAAA,GAAA,IAAA;;AA4Db;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAa,0CACU,cAAc;SACnC;;GAGC,0BAA0B"}
1
+ {"version":3,"file":"useWatchUserChange-Bf5JKDJJ.d.ts","names":[],"sources":["../src/hooks/useWatchUserChange/useWatchUserChange.ts"],"sourcesContent":[],"mappings":";;;UAYiB,+CAA+C;;EAA/C,KAAA,EAER,IAFQ,CAEH,YAFG,CAAA;EAA+C;;;;EAUhD,QAAA,EAAA,CAAA,KAAA,EAAA,OAAA,EAAA,OAAA,EAAA;IACoB,QAAA,EADpB,eACoB,CADJ,YACI,CAAA;IAAlB,UAAA,EAAA,iBAAA,CAAkB,YAAlB,CAAA;IACQ,KAAA,EAAb,YAAa,CAAA,YAAA,CAAA;EAAb,CAAA,EAAA,GAAA,IAAA;;AA4Db;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAa,0CACU,cAAc;SACnC;;GAGC,0BAA0B"}
@@ -75,4 +75,4 @@ declare const useWatchUserChange: <TFieldValues extends FieldValues = FieldValue
75
75
  }: UseWatchUserChangeOptions<TFieldValues>) => void;
76
76
  //#endregion
77
77
  export { useWatchUserChange as n, UseWatchUserChangeOptions as t };
78
- //# sourceMappingURL=useWatchUserChange-COVdHmki.d.cts.map
78
+ //# sourceMappingURL=useWatchUserChange-Br4Q7syM.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useWatchUserChange-COVdHmki.d.cts","names":[],"sources":["../src/hooks/useWatchUserChange/useWatchUserChange.ts"],"sourcesContent":[],"mappings":";;;UAYiB,+CAA+C;;EAA/C,KAAA,EAER,IAFQ,CAEH,YAFG,CAAA;EAA+C;;;;EAUhD,QAAA,EAAA,CAAA,KAAA,EAAA,OAAA,EAAA,OAAA,EAAA;IACoB,QAAA,EADpB,eACoB,CADJ,YACI,CAAA;IAAlB,UAAA,EAAA,iBAAA,CAAkB,YAAlB,CAAA;IACQ,KAAA,EAAb,YAAa,CAAA,YAAA,CAAA;EAAb,CAAA,EAAA,GAAA,IAAA;;AA4Db;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAa,0CACU,cAAc;SACnC;;GAGC,0BAA0B"}
1
+ {"version":3,"file":"useWatchUserChange-Br4Q7syM.d.cts","names":[],"sources":["../src/hooks/useWatchUserChange/useWatchUserChange.ts"],"sourcesContent":[],"mappings":";;;UAYiB,+CAA+C;;EAA/C,KAAA,EAER,IAFQ,CAEH,YAFG,CAAA;EAA+C;;;;EAUhD,QAAA,EAAA,CAAA,KAAA,EAAA,OAAA,EAAA,OAAA,EAAA;IACoB,QAAA,EADpB,eACoB,CADJ,YACI,CAAA;IAAlB,UAAA,EAAA,iBAAA,CAAkB,YAAlB,CAAA;IACQ,KAAA,EAAb,YAAa,CAAA,YAAA,CAAA;EAAb,CAAA,EAAA,GAAA,IAAA;;AA4Db;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAa,0CACU,cAAc;SACnC;;GAGC,0BAA0B"}
@@ -1,5 +1,5 @@
1
- const require_FormContext = require('./FormContext-Bb6d8hdG.cjs');
2
- const require_useFormContext = require('./useFormContext-Bp0EODoO.cjs');
1
+ const require_FormContext = require('./FormContext-Lw4YL4-B.cjs');
2
+ const require_useFormContext = require('./useFormContext-CEr3zcL6.cjs');
3
3
  let react = require("react");
4
4
 
5
5
  //#region src/hooks/useWatchUserChange/useWatchUserChange.ts
@@ -86,4 +86,4 @@ Object.defineProperty(exports, 'useWatchUserChange', {
86
86
  return useWatchUserChange;
87
87
  }
88
88
  });
89
- //# sourceMappingURL=useWatchUserChange-BnxYE-0b.cjs.map
89
+ //# sourceMappingURL=useWatchUserChange-TMfaTCcp.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useWatchUserChange-BnxYE-0b.cjs","names":["useFormContext"],"sources":["../src/hooks/useWatchUserChange/useWatchUserChange.ts"],"sourcesContent":["import type {\n FieldValues,\n Path,\n UseFormReset,\n UseFormResetField,\n UseFormSetValue,\n} from 'react-hook-form';\n\nimport { useEffect } from 'react';\n\nimport { useFormContext } from '../useFormContext/useFormContext';\n\nexport interface UseWatchUserChangeOptions<TFieldValues extends FieldValues> {\n /** Field name to watch for user changes */\n watch: Path<TFieldValues>;\n /**\n * Callback when watched field is changed by user input.\n * Receives the new value and form helpers (setValue, resetField, reset).\n */\n onChange: (\n value: unknown,\n helpers: {\n setValue: UseFormSetValue<TFieldValues>;\n resetField: UseFormResetField<TFieldValues>;\n reset: UseFormReset<TFieldValues>;\n },\n ) => void;\n}\n\n/**\n * Hook that watches for user changes on a specific form field.\n *\n * Only triggers on manual user input (typing, clicking, selecting),\n * NOT on programmatic changes like form.reset() or form.setValue().\n *\n * This hook subscribes to field changes at the source (useController),\n * ensuring immediate and accurate detection of user interactions.\n *\n * Use cases:\n * - Reset dependent fields when parent field changes\n * - Set mode-specific default values when a toggle changes\n * - Clear form sections based on user selections\n * - Trigger side effects only on user interaction\n *\n * Note: To watch multiple fields, call this hook multiple times.\n *\n * @example\n * ```tsx\n * // Reset city and address when user changes country\n * useWatchUserChange({\n * watch: 'country',\n * onChange: (value, { resetField }) => {\n * resetField('city');\n * resetField('address');\n * },\n * });\n *\n * // Set defaults when user changes payment method\n * useWatchUserChange({\n * watch: 'paymentMethod',\n * onChange: (value, { setValue }) => {\n * if (value === 'credit') {\n * setValue('installments', 3);\n * } else {\n * setValue('installments', 1);\n * }\n * },\n * });\n *\n * // Watch multiple fields by calling the hook multiple times\n * useWatchUserChange({\n * watch: 'category',\n * onChange: (value, { resetField }) => {\n * resetField('productId');\n * },\n * });\n * useWatchUserChange({\n * watch: 'brand',\n * onChange: (value, { resetField }) => {\n * resetField('productId');\n * },\n * });\n * ```\n */\nexport const useWatchUserChange = <\n TFieldValues extends FieldValues = FieldValues,\n>({\n watch: watchField,\n onChange,\n}: UseWatchUserChangeOptions<TFieldValues>) => {\n const { setValue, resetField, reset, userChange } =\n useFormContext<TFieldValues>();\n\n useEffect(() => {\n // Create listener that checks if changed field is the one we're watching\n const listener = (fieldName: Path<TFieldValues>, value: unknown) => {\n // Check if this is the field we're watching\n if (fieldName === watchField) {\n // Call the onChange callback with helpers\n onChange(value, { setValue, resetField, reset });\n }\n };\n\n // Subscribe to user changes\n const unsubscribe = userChange.subscribe(listener);\n\n // Cleanup on unmount\n return unsubscribe;\n }, [watchField, onChange, setValue, resetField, reset, userChange]);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoFA,MAAa,sBAEX,EACA,OAAO,YACP,eAC6C;CAC7C,MAAM,EAAE,UAAU,YAAY,OAAO,eACnCA,uCAA8B;AAEhC,4BAAgB;EAEd,MAAM,YAAY,WAA+B,UAAmB;AAElE,OAAI,cAAc,WAEhB,UAAS,OAAO;IAAE;IAAU;IAAY;IAAO,CAAC;;AAQpD,SAHoB,WAAW,UAAU,SAAS;IAIjD;EAAC;EAAY;EAAU;EAAU;EAAY;EAAO;EAAW,CAAC"}
1
+ {"version":3,"file":"useWatchUserChange-TMfaTCcp.cjs","names":["useFormContext"],"sources":["../src/hooks/useWatchUserChange/useWatchUserChange.ts"],"sourcesContent":["import type {\n FieldValues,\n Path,\n UseFormReset,\n UseFormResetField,\n UseFormSetValue,\n} from 'react-hook-form';\n\nimport { useEffect } from 'react';\n\nimport { useFormContext } from '../useFormContext/useFormContext';\n\nexport interface UseWatchUserChangeOptions<TFieldValues extends FieldValues> {\n /** Field name to watch for user changes */\n watch: Path<TFieldValues>;\n /**\n * Callback when watched field is changed by user input.\n * Receives the new value and form helpers (setValue, resetField, reset).\n */\n onChange: (\n value: unknown,\n helpers: {\n setValue: UseFormSetValue<TFieldValues>;\n resetField: UseFormResetField<TFieldValues>;\n reset: UseFormReset<TFieldValues>;\n },\n ) => void;\n}\n\n/**\n * Hook that watches for user changes on a specific form field.\n *\n * Only triggers on manual user input (typing, clicking, selecting),\n * NOT on programmatic changes like form.reset() or form.setValue().\n *\n * This hook subscribes to field changes at the source (useController),\n * ensuring immediate and accurate detection of user interactions.\n *\n * Use cases:\n * - Reset dependent fields when parent field changes\n * - Set mode-specific default values when a toggle changes\n * - Clear form sections based on user selections\n * - Trigger side effects only on user interaction\n *\n * Note: To watch multiple fields, call this hook multiple times.\n *\n * @example\n * ```tsx\n * // Reset city and address when user changes country\n * useWatchUserChange({\n * watch: 'country',\n * onChange: (value, { resetField }) => {\n * resetField('city');\n * resetField('address');\n * },\n * });\n *\n * // Set defaults when user changes payment method\n * useWatchUserChange({\n * watch: 'paymentMethod',\n * onChange: (value, { setValue }) => {\n * if (value === 'credit') {\n * setValue('installments', 3);\n * } else {\n * setValue('installments', 1);\n * }\n * },\n * });\n *\n * // Watch multiple fields by calling the hook multiple times\n * useWatchUserChange({\n * watch: 'category',\n * onChange: (value, { resetField }) => {\n * resetField('productId');\n * },\n * });\n * useWatchUserChange({\n * watch: 'brand',\n * onChange: (value, { resetField }) => {\n * resetField('productId');\n * },\n * });\n * ```\n */\nexport const useWatchUserChange = <\n TFieldValues extends FieldValues = FieldValues,\n>({\n watch: watchField,\n onChange,\n}: UseWatchUserChangeOptions<TFieldValues>) => {\n const { setValue, resetField, reset, userChange } =\n useFormContext<TFieldValues>();\n\n useEffect(() => {\n // Create listener that checks if changed field is the one we're watching\n const listener = (fieldName: Path<TFieldValues>, value: unknown) => {\n // Check if this is the field we're watching\n if (fieldName === watchField) {\n // Call the onChange callback with helpers\n onChange(value, { setValue, resetField, reset });\n }\n };\n\n // Subscribe to user changes\n const unsubscribe = userChange.subscribe(listener);\n\n // Cleanup on unmount\n return unsubscribe;\n }, [watchField, onChange, setValue, resetField, reset, userChange]);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoFA,MAAa,sBAEX,EACA,OAAO,YACP,eAC6C;CAC7C,MAAM,EAAE,UAAU,YAAY,OAAO,eACnCA,uCAA8B;AAEhC,4BAAgB;EAEd,MAAM,YAAY,WAA+B,UAAmB;AAElE,OAAI,cAAc,WAEhB,UAAS,OAAO;IAAE;IAAU;IAAY;IAAO,CAAC;;AAQpD,SAHoB,WAAW,UAAU,SAAS;IAIjD;EAAC;EAAY;EAAU;EAAU;EAAY;EAAO;EAAW,CAAC"}
@@ -1,4 +1,4 @@
1
- import { n as useFormContext } from "./useFormContext-JCm1UR_e.js";
1
+ import { n as useFormContext } from "./useFormContext-BFoXZNkp.js";
2
2
  import { useEffect } from "react";
3
3
 
4
4
  //#region src/hooks/useWatchUserChange/useWatchUserChange.ts
@@ -80,4 +80,4 @@ const useWatchUserChange = ({ watch: watchField, onChange }) => {
80
80
 
81
81
  //#endregion
82
82
  export { useWatchUserChange as t };
83
- //# sourceMappingURL=useWatchUserChange-C1ezpj0t.js.map
83
+ //# sourceMappingURL=useWatchUserChange-fZy6nGtD.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useWatchUserChange-C1ezpj0t.js","names":[],"sources":["../src/hooks/useWatchUserChange/useWatchUserChange.ts"],"sourcesContent":["import type {\n FieldValues,\n Path,\n UseFormReset,\n UseFormResetField,\n UseFormSetValue,\n} from 'react-hook-form';\n\nimport { useEffect } from 'react';\n\nimport { useFormContext } from '../useFormContext/useFormContext';\n\nexport interface UseWatchUserChangeOptions<TFieldValues extends FieldValues> {\n /** Field name to watch for user changes */\n watch: Path<TFieldValues>;\n /**\n * Callback when watched field is changed by user input.\n * Receives the new value and form helpers (setValue, resetField, reset).\n */\n onChange: (\n value: unknown,\n helpers: {\n setValue: UseFormSetValue<TFieldValues>;\n resetField: UseFormResetField<TFieldValues>;\n reset: UseFormReset<TFieldValues>;\n },\n ) => void;\n}\n\n/**\n * Hook that watches for user changes on a specific form field.\n *\n * Only triggers on manual user input (typing, clicking, selecting),\n * NOT on programmatic changes like form.reset() or form.setValue().\n *\n * This hook subscribes to field changes at the source (useController),\n * ensuring immediate and accurate detection of user interactions.\n *\n * Use cases:\n * - Reset dependent fields when parent field changes\n * - Set mode-specific default values when a toggle changes\n * - Clear form sections based on user selections\n * - Trigger side effects only on user interaction\n *\n * Note: To watch multiple fields, call this hook multiple times.\n *\n * @example\n * ```tsx\n * // Reset city and address when user changes country\n * useWatchUserChange({\n * watch: 'country',\n * onChange: (value, { resetField }) => {\n * resetField('city');\n * resetField('address');\n * },\n * });\n *\n * // Set defaults when user changes payment method\n * useWatchUserChange({\n * watch: 'paymentMethod',\n * onChange: (value, { setValue }) => {\n * if (value === 'credit') {\n * setValue('installments', 3);\n * } else {\n * setValue('installments', 1);\n * }\n * },\n * });\n *\n * // Watch multiple fields by calling the hook multiple times\n * useWatchUserChange({\n * watch: 'category',\n * onChange: (value, { resetField }) => {\n * resetField('productId');\n * },\n * });\n * useWatchUserChange({\n * watch: 'brand',\n * onChange: (value, { resetField }) => {\n * resetField('productId');\n * },\n * });\n * ```\n */\nexport const useWatchUserChange = <\n TFieldValues extends FieldValues = FieldValues,\n>({\n watch: watchField,\n onChange,\n}: UseWatchUserChangeOptions<TFieldValues>) => {\n const { setValue, resetField, reset, userChange } =\n useFormContext<TFieldValues>();\n\n useEffect(() => {\n // Create listener that checks if changed field is the one we're watching\n const listener = (fieldName: Path<TFieldValues>, value: unknown) => {\n // Check if this is the field we're watching\n if (fieldName === watchField) {\n // Call the onChange callback with helpers\n onChange(value, { setValue, resetField, reset });\n }\n };\n\n // Subscribe to user changes\n const unsubscribe = userChange.subscribe(listener);\n\n // Cleanup on unmount\n return unsubscribe;\n }, [watchField, onChange, setValue, resetField, reset, userChange]);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoFA,MAAa,sBAEX,EACA,OAAO,YACP,eAC6C;CAC7C,MAAM,EAAE,UAAU,YAAY,OAAO,eACnC,gBAA8B;AAEhC,iBAAgB;EAEd,MAAM,YAAY,WAA+B,UAAmB;AAElE,OAAI,cAAc,WAEhB,UAAS,OAAO;IAAE;IAAU;IAAY;IAAO,CAAC;;AAQpD,SAHoB,WAAW,UAAU,SAAS;IAIjD;EAAC;EAAY;EAAU;EAAU;EAAY;EAAO;EAAW,CAAC"}
1
+ {"version":3,"file":"useWatchUserChange-fZy6nGtD.js","names":[],"sources":["../src/hooks/useWatchUserChange/useWatchUserChange.ts"],"sourcesContent":["import type {\n FieldValues,\n Path,\n UseFormReset,\n UseFormResetField,\n UseFormSetValue,\n} from 'react-hook-form';\n\nimport { useEffect } from 'react';\n\nimport { useFormContext } from '../useFormContext/useFormContext';\n\nexport interface UseWatchUserChangeOptions<TFieldValues extends FieldValues> {\n /** Field name to watch for user changes */\n watch: Path<TFieldValues>;\n /**\n * Callback when watched field is changed by user input.\n * Receives the new value and form helpers (setValue, resetField, reset).\n */\n onChange: (\n value: unknown,\n helpers: {\n setValue: UseFormSetValue<TFieldValues>;\n resetField: UseFormResetField<TFieldValues>;\n reset: UseFormReset<TFieldValues>;\n },\n ) => void;\n}\n\n/**\n * Hook that watches for user changes on a specific form field.\n *\n * Only triggers on manual user input (typing, clicking, selecting),\n * NOT on programmatic changes like form.reset() or form.setValue().\n *\n * This hook subscribes to field changes at the source (useController),\n * ensuring immediate and accurate detection of user interactions.\n *\n * Use cases:\n * - Reset dependent fields when parent field changes\n * - Set mode-specific default values when a toggle changes\n * - Clear form sections based on user selections\n * - Trigger side effects only on user interaction\n *\n * Note: To watch multiple fields, call this hook multiple times.\n *\n * @example\n * ```tsx\n * // Reset city and address when user changes country\n * useWatchUserChange({\n * watch: 'country',\n * onChange: (value, { resetField }) => {\n * resetField('city');\n * resetField('address');\n * },\n * });\n *\n * // Set defaults when user changes payment method\n * useWatchUserChange({\n * watch: 'paymentMethod',\n * onChange: (value, { setValue }) => {\n * if (value === 'credit') {\n * setValue('installments', 3);\n * } else {\n * setValue('installments', 1);\n * }\n * },\n * });\n *\n * // Watch multiple fields by calling the hook multiple times\n * useWatchUserChange({\n * watch: 'category',\n * onChange: (value, { resetField }) => {\n * resetField('productId');\n * },\n * });\n * useWatchUserChange({\n * watch: 'brand',\n * onChange: (value, { resetField }) => {\n * resetField('productId');\n * },\n * });\n * ```\n */\nexport const useWatchUserChange = <\n TFieldValues extends FieldValues = FieldValues,\n>({\n watch: watchField,\n onChange,\n}: UseWatchUserChangeOptions<TFieldValues>) => {\n const { setValue, resetField, reset, userChange } =\n useFormContext<TFieldValues>();\n\n useEffect(() => {\n // Create listener that checks if changed field is the one we're watching\n const listener = (fieldName: Path<TFieldValues>, value: unknown) => {\n // Check if this is the field we're watching\n if (fieldName === watchField) {\n // Call the onChange callback with helpers\n onChange(value, { setValue, resetField, reset });\n }\n };\n\n // Subscribe to user changes\n const unsubscribe = userChange.subscribe(listener);\n\n // Cleanup on unmount\n return unsubscribe;\n }, [watchField, onChange, setValue, resetField, reset, userChange]);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoFA,MAAa,sBAEX,EACA,OAAO,YACP,eAC6C;CAC7C,MAAM,EAAE,UAAU,YAAY,OAAO,eACnC,gBAA8B;AAEhC,iBAAgB;EAEd,MAAM,YAAY,WAA+B,UAAmB;AAElE,OAAI,cAAc,WAEhB,UAAS,OAAO;IAAE;IAAU;IAAY;IAAO,CAAC;;AAQpD,SAHoB,WAAW,UAAU,SAAS;IAIjD;EAAC;EAAY;EAAU;EAAU;EAAY;EAAO;EAAW,CAAC"}