@fuf-stack/uniform 1.11.3 → 1.13.0

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 (304) 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-BvW4D5Nm.js → Checkboxes-BQI2kTIb.js} +2 -2
  6. package/dist/{Checkboxes-BvW4D5Nm.js.map → Checkboxes-BQI2kTIb.js.map} +1 -1
  7. package/dist/{Checkboxes-Cvdazf25.cjs → Checkboxes-mc1ZItR5.cjs} +4 -4
  8. package/dist/{Checkboxes-Cvdazf25.cjs.map → Checkboxes-mc1ZItR5.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-CJpDgK_t.cjs → FieldArray-CsAyIsw9.cjs} +7 -7
  14. package/dist/{FieldArray-CJpDgK_t.cjs.map → FieldArray-CsAyIsw9.cjs.map} +1 -1
  15. package/dist/{FieldArray-omRNwxgy.js → FieldArray-D4eGdGXA.js} +4 -4
  16. package/dist/{FieldArray-omRNwxgy.js.map → FieldArray-D4eGdGXA.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-Dyi-2qr6.js → FieldCard-BPQIqqW5.js} +2 -2
  22. package/dist/{FieldCard-Dyi-2qr6.js.map → FieldCard-BPQIqqW5.js.map} +1 -1
  23. package/dist/{FieldCard-Dt6QU7o7.cjs → FieldCard-CgWjzrRD.cjs} +4 -4
  24. package/dist/{FieldCard-Dt6QU7o7.cjs.map → FieldCard-CgWjzrRD.cjs.map} +1 -1
  25. package/dist/{FieldCopyTestIdButton-By-hEZgA.cjs → FieldCopyTestIdButton-DxJYKqrz.cjs} +2 -2
  26. package/dist/{FieldCopyTestIdButton-By-hEZgA.cjs.map → FieldCopyTestIdButton-DxJYKqrz.cjs.map} +1 -1
  27. package/dist/{FieldValidationError-D64j5gnH.cjs → FieldValidationError-A384-L3Y.cjs} +2 -2
  28. package/dist/{FieldValidationError-D64j5gnH.cjs.map → FieldValidationError-A384-L3Y.cjs.map} +1 -1
  29. package/dist/Form/index.cjs +1 -1
  30. package/dist/Form/index.d.cts +1 -1
  31. package/dist/Form/index.d.ts +1 -1
  32. package/dist/Form/index.js +1 -1
  33. package/dist/{Form-B1fvbnxi.js → Form-B7bv9fDO.js} +3 -3
  34. package/dist/{Form-B1fvbnxi.js.map → Form-B7bv9fDO.js.map} +1 -1
  35. package/dist/{Form-CvnnGF45.cjs → Form-Ca3RxssB.cjs} +3 -3
  36. package/dist/{Form-CvnnGF45.cjs.map → Form-Ca3RxssB.cjs.map} +1 -1
  37. package/dist/{FormContext-Lw4YL4-B.cjs → FormContext-CeFKQmVH.cjs} +2 -2
  38. package/dist/{FormContext-Lw4YL4-B.cjs.map → FormContext-CeFKQmVH.cjs.map} +1 -1
  39. package/dist/{FormContext-Dl3k1r_k.js → FormContext-DHYlCZ2u.js} +2 -2
  40. package/dist/{FormContext-Dl3k1r_k.js.map → FormContext-DHYlCZ2u.js.map} +1 -1
  41. package/dist/Grid/index.cjs +1 -1
  42. package/dist/Grid/index.d.cts +1 -1
  43. package/dist/Grid/index.d.ts +1 -1
  44. package/dist/{Grid-DezBAZbx.cjs → Grid-CRURvciu.cjs} +2 -2
  45. package/dist/{Grid-DezBAZbx.cjs.map → Grid-CRURvciu.cjs.map} +1 -1
  46. package/dist/Input/index.cjs +1 -1
  47. package/dist/Input/index.d.cts +1 -1
  48. package/dist/Input/index.d.ts +1 -1
  49. package/dist/Input/index.js +1 -1
  50. package/dist/{Input-DR0gCf9q.cjs → Input-7TmTrrV7.cjs} +4 -4
  51. package/dist/{Input-DR0gCf9q.cjs.map → Input-7TmTrrV7.cjs.map} +1 -1
  52. package/dist/{Input-DksaHK1Y.js → Input-BUfOTtDR.js} +3 -3
  53. package/dist/{Input-DksaHK1Y.js.map → Input-BUfOTtDR.js.map} +1 -1
  54. package/dist/RadioBoxes/index.cjs +1 -1
  55. package/dist/RadioBoxes/index.d.cts +1 -1
  56. package/dist/RadioBoxes/index.d.ts +1 -1
  57. package/dist/RadioBoxes/index.js +1 -1
  58. package/dist/{RadioBoxes-h-VLhJ9d.cjs → RadioBoxes-CjxWldIR.cjs} +11 -7
  59. package/dist/RadioBoxes-CjxWldIR.cjs.map +1 -0
  60. package/dist/{RadioBoxes-DdIHH6B5.js → RadioBoxes-Dpd71z1S.js} +10 -6
  61. package/dist/RadioBoxes-Dpd71z1S.js.map +1 -0
  62. package/dist/RadioTabs/index.cjs +1 -1
  63. package/dist/RadioTabs/index.d.cts +1 -1
  64. package/dist/RadioTabs/index.d.ts +1 -1
  65. package/dist/RadioTabs/index.js +1 -1
  66. package/dist/{RadioTabs-D6yF9jE3.cjs → RadioTabs-BA-EMFRc.cjs} +11 -7
  67. package/dist/RadioTabs-BA-EMFRc.cjs.map +1 -0
  68. package/dist/{RadioTabs-dLdlF91p.js → RadioTabs-BZlC19z0.js} +10 -6
  69. package/dist/RadioTabs-BZlC19z0.js.map +1 -0
  70. package/dist/Radios/index.cjs +1 -1
  71. package/dist/Radios/index.d.cts +1 -1
  72. package/dist/Radios/index.d.ts +1 -1
  73. package/dist/Radios/index.js +1 -1
  74. package/dist/{Radios-D8alyG2f.cjs → Radios-Bfxy-Vnf.cjs} +11 -7
  75. package/dist/Radios-Bfxy-Vnf.cjs.map +1 -0
  76. package/dist/{Radios-DiZ0Dfmp.js → Radios-ClBrO7QR.js} +10 -6
  77. package/dist/Radios-ClBrO7QR.js.map +1 -0
  78. package/dist/Select/index.cjs +1 -1
  79. package/dist/Select/index.d.cts +1 -1
  80. package/dist/Select/index.d.ts +1 -1
  81. package/dist/Select/index.js +1 -1
  82. package/dist/{Select-C9otN8uu.js → Select-9MyYYGeZ.js} +12 -7
  83. package/dist/Select-9MyYYGeZ.js.map +1 -0
  84. package/dist/{Select-DQVskslz.cjs → Select-CdTgOiUU.cjs} +13 -8
  85. package/dist/Select-CdTgOiUU.cjs.map +1 -0
  86. package/dist/Slider/index.cjs +1 -1
  87. package/dist/Slider/index.d.cts +1 -1
  88. package/dist/Slider/index.d.ts +1 -1
  89. package/dist/Slider/index.js +1 -1
  90. package/dist/{Slider-DwfyCQDM.cjs → Slider-CK9n0ryX.cjs} +3 -3
  91. package/dist/{Slider-DwfyCQDM.cjs.map → Slider-CK9n0ryX.cjs.map} +1 -1
  92. package/dist/{Slider-meuLEC2k.js → Slider-Cy5vz5as.js} +2 -2
  93. package/dist/{Slider-meuLEC2k.js.map → Slider-Cy5vz5as.js.map} +1 -1
  94. package/dist/SubmitButton/index.cjs +1 -1
  95. package/dist/SubmitButton/index.d.cts +1 -1
  96. package/dist/SubmitButton/index.d.ts +1 -1
  97. package/dist/SubmitButton/index.js +1 -1
  98. package/dist/{SubmitButton-BHP9J9ml.js → SubmitButton-BrbHJcb4.js} +2 -2
  99. package/dist/{SubmitButton-BHP9J9ml.js.map → SubmitButton-BrbHJcb4.js.map} +1 -1
  100. package/dist/{SubmitButton-B0kvUqkd.cjs → SubmitButton-C6sgPR8K.cjs} +3 -3
  101. package/dist/{SubmitButton-B0kvUqkd.cjs.map → SubmitButton-C6sgPR8K.cjs.map} +1 -1
  102. package/dist/Switch/index.cjs +1 -1
  103. package/dist/Switch/index.d.cts +1 -1
  104. package/dist/Switch/index.d.ts +1 -1
  105. package/dist/Switch/index.js +1 -1
  106. package/dist/{Switch-Ds0gDzjR.cjs → Switch-BBhxgBHh.cjs} +3 -3
  107. package/dist/{Switch-Ds0gDzjR.cjs.map → Switch-BBhxgBHh.cjs.map} +1 -1
  108. package/dist/{Switch-DkciIYnD.js → Switch-s64WUP5i.js} +2 -2
  109. package/dist/{Switch-DkciIYnD.js.map → Switch-s64WUP5i.js.map} +1 -1
  110. package/dist/SwitchBox/index.cjs +1 -1
  111. package/dist/SwitchBox/index.d.cts +1 -1
  112. package/dist/SwitchBox/index.d.ts +1 -1
  113. package/dist/SwitchBox/index.js +1 -1
  114. package/dist/{SwitchBox-B9JqwDtN.cjs → SwitchBox-BwdvgHpG.cjs} +3 -3
  115. package/dist/{SwitchBox-B9JqwDtN.cjs.map → SwitchBox-BwdvgHpG.cjs.map} +1 -1
  116. package/dist/{SwitchBox-B6Z4rtWt.js → SwitchBox-CMw1MGJ0.js} +2 -2
  117. package/dist/{SwitchBox-B6Z4rtWt.js.map → SwitchBox-CMw1MGJ0.js.map} +1 -1
  118. package/dist/TextArea/index.cjs +1 -1
  119. package/dist/TextArea/index.d.cts +1 -1
  120. package/dist/TextArea/index.d.ts +1 -1
  121. package/dist/TextArea/index.js +1 -1
  122. package/dist/{TextArea-BqQtlPSV.cjs → TextArea-COe8XP7f.cjs} +4 -4
  123. package/dist/{TextArea-BqQtlPSV.cjs.map → TextArea-COe8XP7f.cjs.map} +1 -1
  124. package/dist/{TextArea-DAx49KI6.js → TextArea-DTkDJr6g.js} +3 -3
  125. package/dist/{TextArea-DAx49KI6.js.map → TextArea-DTkDJr6g.js.map} +1 -1
  126. package/dist/helpers/index.cjs +2 -1
  127. package/dist/helpers/index.d.cts +23 -1
  128. package/dist/helpers/index.d.cts.map +1 -1
  129. package/dist/helpers/index.d.ts +23 -1
  130. package/dist/helpers/index.d.ts.map +1 -1
  131. package/dist/helpers/index.js +2 -2
  132. package/dist/{helpers-nYTmL2gX.cjs → helpers-CncbgvW_.cjs} +52 -2
  133. package/dist/helpers-CncbgvW_.cjs.map +1 -0
  134. package/dist/{helpers-CCINRgQk.js → helpers-D3A5d3M1.js} +46 -2
  135. package/dist/helpers-D3A5d3M1.js.map +1 -0
  136. package/dist/hooks/useClientValidation/index.cjs +1 -1
  137. package/dist/hooks/useClientValidation/index.js +1 -1
  138. package/dist/hooks/useController/index.cjs +1 -1
  139. package/dist/hooks/useController/index.js +1 -1
  140. package/dist/hooks/useFormContext/index.cjs +1 -1
  141. package/dist/hooks/useFormContext/index.d.cts +1 -1
  142. package/dist/hooks/useFormContext/index.d.ts +1 -1
  143. package/dist/hooks/useFormContext/index.js +1 -1
  144. package/dist/hooks/useInput/index.cjs +1 -1
  145. package/dist/hooks/useInputValueDebounce/index.cjs +1 -1
  146. package/dist/hooks/useInputValueDebounce/index.js +1 -1
  147. package/dist/hooks/useInputValueTransform/index.cjs +1 -1
  148. package/dist/hooks/useUniformField/index.cjs +1 -1
  149. package/dist/hooks/useUniformField/index.d.cts +1 -1
  150. package/dist/hooks/useUniformField/index.d.ts +2 -2
  151. package/dist/hooks/useUniformField/index.js +1 -1
  152. package/dist/hooks/useUniformFieldArray/index.cjs +1 -1
  153. package/dist/hooks/useUniformFieldArray/index.d.cts +1 -1
  154. package/dist/hooks/useUniformFieldArray/index.d.ts +2 -2
  155. package/dist/hooks/useUniformFieldArray/index.js +1 -1
  156. package/dist/hooks/useWatchUserChange/index.cjs +1 -1
  157. package/dist/hooks/useWatchUserChange/index.js +1 -1
  158. package/dist/{index-BGXgvZKr.d.ts → index--J1-cUWg.d.cts} +8 -9
  159. package/dist/index--J1-cUWg.d.cts.map +1 -0
  160. package/dist/{index-BDV3JVoX.d.cts → index-7C539UUH.d.cts} +6 -6
  161. package/dist/{index-BDV3JVoX.d.cts.map → index-7C539UUH.d.cts.map} +1 -1
  162. package/dist/{index-CUn9q5KD.d.ts → index-BFeKALeM.d.ts} +4 -4
  163. package/dist/{index-CUn9q5KD.d.ts.map → index-BFeKALeM.d.ts.map} +1 -1
  164. package/dist/{index-CZyNkPDq.d.ts → index-BHmMP-ps.d.ts} +21 -21
  165. package/dist/{index-CZyNkPDq.d.ts.map → index-BHmMP-ps.d.ts.map} +1 -1
  166. package/dist/{index-B_aIzCcx.d.cts → index-BNu0EV5x.d.cts} +3 -3
  167. package/dist/{index-B_aIzCcx.d.cts.map → index-BNu0EV5x.d.cts.map} +1 -1
  168. package/dist/{index-CHXv_rNR.d.ts → index-Bd7H1tdb.d.cts} +3 -3
  169. package/dist/{index-cadUZZIY.d.cts.map → index-Bd7H1tdb.d.cts.map} +1 -1
  170. package/dist/{index-D_WidR7r.d.cts → index-BhqOFcsS.d.cts} +6 -6
  171. package/dist/{index-D_WidR7r.d.cts.map → index-BhqOFcsS.d.cts.map} +1 -1
  172. package/dist/{index-DnzC0GCS.d.ts → index-CASoDHjE.d.cts} +21 -21
  173. package/dist/{index-C2A_i57R.d.cts.map → index-CASoDHjE.d.cts.map} +1 -1
  174. package/dist/index-CNFk4ygb.d.ts +264 -0
  175. package/dist/index-CNFk4ygb.d.ts.map +1 -0
  176. package/dist/{index-C2A_i57R.d.cts → index-CPbrUN5A.d.ts} +20 -20
  177. package/dist/{index-DnzC0GCS.d.ts.map → index-CPbrUN5A.d.ts.map} +1 -1
  178. package/dist/{index-cadUZZIY.d.cts → index-CVY05bZf.d.ts} +2 -2
  179. package/dist/{index-CHXv_rNR.d.ts.map → index-CVY05bZf.d.ts.map} +1 -1
  180. package/dist/{index-DVRtBywt.d.ts → index-CXkSuHEL.d.ts} +3 -3
  181. package/dist/{index-DVRtBywt.d.ts.map → index-CXkSuHEL.d.ts.map} +1 -1
  182. package/dist/{index-CHNp5R5N.d.cts → index-CrpdF1Xw.d.cts} +6 -6
  183. package/dist/{index-CHNp5R5N.d.cts.map → index-CrpdF1Xw.d.cts.map} +1 -1
  184. package/dist/{index-CuvvZMop.d.cts → index-Cs-7Ptqc.d.cts} +3 -3
  185. package/dist/{index-CuvvZMop.d.cts.map → index-Cs-7Ptqc.d.cts.map} +1 -1
  186. package/dist/{index-CqGabrzW.d.cts → index-D3o2YTBb.d.ts} +38 -38
  187. package/dist/index-D3o2YTBb.d.ts.map +1 -0
  188. package/dist/{index-CeYRsehb.d.cts → index-D9VXD1rv.d.cts} +21 -21
  189. package/dist/index-D9VXD1rv.d.cts.map +1 -0
  190. package/dist/{index-yVkU2v6b.d.ts → index-DCZwOjSs.d.cts} +37 -37
  191. package/dist/index-DCZwOjSs.d.cts.map +1 -0
  192. package/dist/{index-op7zETAQ.d.ts → index-DEtF7ckd.d.ts} +35 -35
  193. package/dist/index-DEtF7ckd.d.ts.map +1 -0
  194. package/dist/{index-DcYFLiul.d.cts → index-DMVoX5pj.d.cts} +48 -48
  195. package/dist/{index-DcYFLiul.d.cts.map → index-DMVoX5pj.d.cts.map} +1 -1
  196. package/dist/{index-DNFUttM8.d.ts → index-DMojDmML.d.ts} +48 -48
  197. package/dist/index-DMojDmML.d.ts.map +1 -0
  198. package/dist/{index-0wXxS5M7.d.ts → index-DsuMjcQk.d.ts} +6 -6
  199. package/dist/{index-0wXxS5M7.d.ts.map → index-DsuMjcQk.d.ts.map} +1 -1
  200. package/dist/{index-g9TZhGnE.d.cts → index-DsyY9X04.d.cts} +3 -3
  201. package/dist/{index-g9TZhGnE.d.cts.map → index-DsyY9X04.d.cts.map} +1 -1
  202. package/dist/index-DtWIiEFa.d.cts +264 -0
  203. package/dist/index-DtWIiEFa.d.cts.map +1 -0
  204. package/dist/{index-1Egh73pR.d.ts → index-DvB46QAb.d.ts} +3 -3
  205. package/dist/{index-1Egh73pR.d.ts.map → index-DvB46QAb.d.ts.map} +1 -1
  206. package/dist/{index-3v_vja2i.d.ts → index-JdksqsGh.d.ts} +4 -4
  207. package/dist/{index-3v_vja2i.d.ts.map → index-JdksqsGh.d.ts.map} +1 -1
  208. package/dist/{index-CnsR8nkm.d.cts → index-JfAmWj81.d.cts} +35 -35
  209. package/dist/index-JfAmWj81.d.cts.map +1 -0
  210. package/dist/{index-BFLKkqA3.d.ts → index-KgMMIPyM.d.cts} +3 -3
  211. package/dist/{index-DvF_C1Bz.d.cts.map → index-KgMMIPyM.d.cts.map} +1 -1
  212. package/dist/{index-Bcppi5O7.d.ts → index-OwPGP648.d.ts} +5 -5
  213. package/dist/{index-BSjUaHEO.d.cts.map → index-OwPGP648.d.ts.map} +1 -1
  214. package/dist/{index-DvF_C1Bz.d.cts → index-TbDhDIfv.d.ts} +3 -3
  215. package/dist/{index-BFLKkqA3.d.ts.map → index-TbDhDIfv.d.ts.map} +1 -1
  216. package/dist/{index-7mx-IcDp.d.ts → index-Z0IxHoXS.d.ts} +3 -3
  217. package/dist/{index-7mx-IcDp.d.ts.map → index-Z0IxHoXS.d.ts.map} +1 -1
  218. package/dist/{index-CiF2KXB7.d.cts → index-_njc33cQ.d.cts} +6 -6
  219. package/dist/{index-CiF2KXB7.d.cts.map → index-_njc33cQ.d.cts.map} +1 -1
  220. package/dist/{index-CjJHVJwD.d.cts → index-_zWAtv8G.d.ts} +37 -36
  221. package/dist/index-_zWAtv8G.d.ts.map +1 -0
  222. package/dist/{index-BSjUaHEO.d.cts → index-acwVBMcR.d.cts} +5 -5
  223. package/dist/index-acwVBMcR.d.cts.map +1 -0
  224. package/dist/{index-CTp4vdDb.d.ts → index-rK5GxEPh.d.ts} +6 -6
  225. package/dist/{index-CTp4vdDb.d.ts.map → index-rK5GxEPh.d.ts.map} +1 -1
  226. package/dist/index.cjs +28 -27
  227. package/dist/index.d.cts +22 -22
  228. package/dist/index.d.ts +22 -22
  229. package/dist/index.js +23 -23
  230. package/dist/partials/FieldCopyTestIdButton/index.cjs +1 -1
  231. package/dist/partials/FieldCopyTestIdButton/index.d.cts +1 -1
  232. package/dist/partials/FieldCopyTestIdButton/index.d.ts +1 -1
  233. package/dist/partials/FieldValidationError/index.cjs +1 -1
  234. package/dist/partials/FieldValidationError/index.d.cts +1 -1
  235. package/dist/partials/FieldValidationError/index.d.ts +1 -1
  236. package/dist/{useClientValidation-BrTtRnqi.js → useClientValidation-C6Daq53C.js} +3 -3
  237. package/dist/{useClientValidation-BrTtRnqi.js.map → useClientValidation-C6Daq53C.js.map} +1 -1
  238. package/dist/{useClientValidation-CdC7lEYP.cjs → useClientValidation-DzomULfo.cjs} +4 -4
  239. package/dist/{useClientValidation-CdC7lEYP.cjs.map → useClientValidation-DzomULfo.cjs.map} +1 -1
  240. package/dist/useController-BArZd2Vp.d.cts.map +1 -1
  241. package/dist/{useController-g0AlWM__.js → useController-BPDcwfTj.js} +3 -3
  242. package/dist/{useController-g0AlWM__.js.map → useController-BPDcwfTj.js.map} +1 -1
  243. package/dist/{useController-BBxji1nQ.cjs → useController-DHRkSHem.cjs} +3 -3
  244. package/dist/{useController-BBxji1nQ.cjs.map → useController-DHRkSHem.cjs.map} +1 -1
  245. package/dist/{useFormContext-Cw6aAhos.d.ts → useFormContext-B2TS6xq0.d.ts} +3 -3
  246. package/dist/useFormContext-B2TS6xq0.d.ts.map +1 -0
  247. package/dist/{useFormContext-CEr3zcL6.cjs → useFormContext-DJiJlfGJ.cjs} +3 -3
  248. package/dist/{useFormContext-CEr3zcL6.cjs.map → useFormContext-DJiJlfGJ.cjs.map} +1 -1
  249. package/dist/{useFormContext-BFoXZNkp.js → useFormContext-UFBqUfOr.js} +3 -3
  250. package/dist/{useFormContext-BFoXZNkp.js.map → useFormContext-UFBqUfOr.js.map} +1 -1
  251. package/dist/{useFormContext--yod5xzQ.d.cts → useFormContext-n3WYgGkW.d.cts} +19 -19
  252. package/dist/useFormContext-n3WYgGkW.d.cts.map +1 -0
  253. package/dist/{useInputValueDebounce-Dop_8_OK.js → useInputValueDebounce-D9wArTKz.js} +2 -2
  254. package/dist/{useInputValueDebounce-Dop_8_OK.js.map → useInputValueDebounce-D9wArTKz.js.map} +1 -1
  255. package/dist/{useInputValueDebounce-TiNR4jtG.cjs → useInputValueDebounce-KIKsvSLm.cjs} +3 -3
  256. package/dist/{useInputValueDebounce-TiNR4jtG.cjs.map → useInputValueDebounce-KIKsvSLm.cjs.map} +1 -1
  257. package/dist/{useInputValueTransform-BNmfaj5D.cjs → useInputValueTransform-DuhPVE4L.cjs} +2 -2
  258. package/dist/{useInputValueTransform-BNmfaj5D.cjs.map → useInputValueTransform-DuhPVE4L.cjs.map} +1 -1
  259. package/dist/{useUniformField-RxZqXMuD.d.ts → useUniformField-Bzv-6MG1.d.ts} +2 -2
  260. package/dist/{useUniformField-RxZqXMuD.d.ts.map → useUniformField-Bzv-6MG1.d.ts.map} +1 -1
  261. package/dist/{useUniformField-D6fwSjrH.cjs → useUniformField-CGiibqg4.cjs} +8 -8
  262. package/dist/{useUniformField-D6fwSjrH.cjs.map → useUniformField-CGiibqg4.cjs.map} +1 -1
  263. package/dist/{useUniformField-B2zQtEbr.d.cts → useUniformField-CrEz5lkV.d.cts} +2 -2
  264. package/dist/{useUniformField-B2zQtEbr.d.cts.map → useUniformField-CrEz5lkV.d.cts.map} +1 -1
  265. package/dist/{useUniformField-BKVVns0E.js → useUniformField-D2NgevBI.js} +4 -4
  266. package/dist/{useUniformField-BKVVns0E.js.map → useUniformField-D2NgevBI.js.map} +1 -1
  267. package/dist/{useUniformFieldArray-WRuIMhw6.d.cts → useUniformFieldArray-B2-Bfl74.d.cts} +13 -13
  268. package/dist/{useUniformFieldArray-WRuIMhw6.d.cts.map → useUniformFieldArray-B2-Bfl74.d.cts.map} +1 -1
  269. package/dist/{useUniformFieldArray-Byfmzq97.cjs → useUniformFieldArray-Ct8jD7JJ.cjs} +5 -5
  270. package/dist/{useUniformFieldArray-Byfmzq97.cjs.map → useUniformFieldArray-Ct8jD7JJ.cjs.map} +1 -1
  271. package/dist/{useUniformFieldArray-BwE634m6.js → useUniformFieldArray-DcoVYtqx.js} +4 -4
  272. package/dist/{useUniformFieldArray-BwE634m6.js.map → useUniformFieldArray-DcoVYtqx.js.map} +1 -1
  273. package/dist/{useUniformFieldArray-B_c55CnX.d.ts → useUniformFieldArray-jUCzsveX.d.ts} +2 -2
  274. package/dist/{useUniformFieldArray-B_c55CnX.d.ts.map → useUniformFieldArray-jUCzsveX.d.ts.map} +1 -1
  275. package/dist/{useWatchUserChange-fZy6nGtD.js → useWatchUserChange-1ELFYX_F.js} +2 -2
  276. package/dist/{useWatchUserChange-fZy6nGtD.js.map → useWatchUserChange-1ELFYX_F.js.map} +1 -1
  277. package/dist/{useWatchUserChange-TMfaTCcp.cjs → useWatchUserChange-C1zOvSSU.cjs} +3 -3
  278. package/dist/{useWatchUserChange-TMfaTCcp.cjs.map → useWatchUserChange-C1zOvSSU.cjs.map} +1 -1
  279. package/package.json +5 -5
  280. package/dist/RadioBoxes-DdIHH6B5.js.map +0 -1
  281. package/dist/RadioBoxes-h-VLhJ9d.cjs.map +0 -1
  282. package/dist/RadioTabs-D6yF9jE3.cjs.map +0 -1
  283. package/dist/RadioTabs-dLdlF91p.js.map +0 -1
  284. package/dist/Radios-D8alyG2f.cjs.map +0 -1
  285. package/dist/Radios-DiZ0Dfmp.js.map +0 -1
  286. package/dist/Select-C9otN8uu.js.map +0 -1
  287. package/dist/Select-DQVskslz.cjs.map +0 -1
  288. package/dist/helpers-CCINRgQk.js.map +0 -1
  289. package/dist/helpers-nYTmL2gX.cjs.map +0 -1
  290. package/dist/index-BGXgvZKr.d.ts.map +0 -1
  291. package/dist/index-Bcppi5O7.d.ts.map +0 -1
  292. package/dist/index-CeYRsehb.d.cts.map +0 -1
  293. package/dist/index-CjJHVJwD.d.cts.map +0 -1
  294. package/dist/index-CnsR8nkm.d.cts.map +0 -1
  295. package/dist/index-CqGabrzW.d.cts.map +0 -1
  296. package/dist/index-DNFUttM8.d.ts.map +0 -1
  297. package/dist/index-D_egu-QT.d.cts +0 -264
  298. package/dist/index-D_egu-QT.d.cts.map +0 -1
  299. package/dist/index-DajjPPWM.d.ts +0 -264
  300. package/dist/index-DajjPPWM.d.ts.map +0 -1
  301. package/dist/index-op7zETAQ.d.ts.map +0 -1
  302. package/dist/index-yVkU2v6b.d.ts.map +0 -1
  303. package/dist/useFormContext--yod5xzQ.d.cts.map +0 -1
  304. package/dist/useFormContext-Cw6aAhos.d.ts.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,31 +1,31 @@
1
1
  import { i as useInputValueTransform, n as UseInputValueTransformOptions, r as UseInputValueTransformReturn, t as InputValueTransform } from "./useInputValueTransform-Cc0qEsnS.js";
2
- import { n as Checkboxes, r as CheckboxesProps, t as CheckboxOption } from "./index-0wXxS5M7.js";
3
- import { i as FieldArrayProps, n as FieldArrayChildrenRenderFn, r as FieldArrayFeatures, t as FieldArray } from "./index-CUn9q5KD.js";
4
- import { n as FieldCardProps, r as fieldCardVariants, t as FieldCard } from "./index-CTp4vdDb.js";
2
+ import { n as Checkboxes, r as CheckboxesProps, t as CheckboxOption } from "./index-DsuMjcQk.js";
3
+ import { i as FieldArrayProps, n as FieldArrayChildrenRenderFn, r as FieldArrayFeatures, t as FieldArray } from "./index-BFeKALeM.js";
4
+ import { n as FieldCardProps, r as fieldCardVariants, t as FieldCard } from "./index-rK5GxEPh.js";
5
5
  import "./FormContext-C2_WMi_v.js";
6
- import { n as FormProps, t as Form } from "./index-1Egh73pR.js";
7
- import { n as GridProps, t as Grid } from "./index-BFLKkqA3.js";
8
- import { n as InputProps, t as Input } from "./index-CZyNkPDq.js";
9
- import { n as RadioBoxes, r as RadioBoxesProps, t as radioBoxVariants } from "./index-BGXgvZKr.js";
10
- import { n as RadioTabsProps, t as RadioTabs } from "./index-Bcppi5O7.js";
11
- import { n as RadiosProps, t as Radios } from "./index-op7zETAQ.js";
12
- import { n as SelectProps, t as Select } from "./index-DajjPPWM.js";
13
- import { n as SliderProps, t as Slider } from "./index-DNFUttM8.js";
14
- import { n as SubmitButtonProps, t as SubmitButton } from "./index-CHXv_rNR.js";
15
- import { n as SwitchProps, t as Switch } from "./index-yVkU2v6b.js";
16
- import { n as SwitchBoxProps, r as switchBoxVariants, t as SwitchBox } from "./index-3v_vja2i.js";
17
- import { n as TextAreaProps, t as TextArea } from "./index-DnzC0GCS.js";
18
- import { flatArrayKey, fromNullishString, isValueEmpty, nameToTestId, toFormFormat, toNullishString, toValidationFormat } from "./helpers/index.js";
6
+ import { n as FormProps, t as Form } from "./index-DvB46QAb.js";
7
+ import { n as GridProps, t as Grid } from "./index-TbDhDIfv.js";
8
+ import { n as InputProps, t as Input } from "./index-BHmMP-ps.js";
9
+ import { n as RadioBoxes, r as RadioBoxesProps, t as radioBoxVariants } from "./index-_zWAtv8G.js";
10
+ import { n as RadioTabsProps, t as RadioTabs } from "./index-OwPGP648.js";
11
+ import { n as RadiosProps, t as Radios } from "./index-DEtF7ckd.js";
12
+ import { n as SelectProps, t as Select } from "./index-CNFk4ygb.js";
13
+ import { n as SliderProps, t as Slider } from "./index-DMojDmML.js";
14
+ import { n as SubmitButtonProps, t as SubmitButton } from "./index-CVY05bZf.js";
15
+ import { n as SwitchProps, t as Switch } from "./index-D3o2YTBb.js";
16
+ import { n as SwitchBoxProps, r as switchBoxVariants, t as SwitchBox } from "./index-JdksqsGh.js";
17
+ import { n as TextAreaProps, t as TextArea } from "./index-CPbrUN5A.js";
18
+ import { createOptionValueConverter, flatArrayKey, fromNullishString, isValueEmpty, nameToTestId, toFormFormat, toNullishString, toValidationFormat } from "./helpers/index.js";
19
19
  import { n as useClientValidation, t as clientValidationSchemaByName } from "./useClientValidation-Bg0q3Axc.js";
20
20
  import { n as UseControllerReturn, r as useController, t as UseControllerProps } from "./useController-MVHJ7WFp.js";
21
21
  import "./index-CFBmva_r.js";
22
- import { n as useFormContext, t as checkFieldIsRequired } from "./useFormContext-Cw6aAhos.js";
22
+ import { n as useFormContext, t as checkFieldIsRequired } from "./useFormContext-B2TS6xq0.js";
23
23
  import "./index-BRLjimYW.js";
24
24
  import { t as useInput } from "./useInput-BCdeYOOg.js";
25
25
  import { n as UseInputValueDebounceReturn, r as useInputValueDebounce, t as UseInputValueDebounceOptions } from "./useInputValueDebounce-fhmVn1aO.js";
26
- import { n as UseUniformFieldReturn, r as useUniformField, t as UseUniformFieldParams } from "./useUniformField-RxZqXMuD.js";
27
- import { n as useUniformFieldArray, t as UseUniformFieldArrayProps } from "./useUniformFieldArray-B_c55CnX.js";
26
+ import { n as UseUniformFieldReturn, r as useUniformField, t as UseUniformFieldParams } from "./useUniformField-Bzv-6MG1.js";
27
+ import { n as useUniformFieldArray, t as UseUniformFieldArrayProps } from "./useUniformFieldArray-jUCzsveX.js";
28
28
  import { n as useWatchUserChange, t as UseWatchUserChangeOptions } from "./useWatchUserChange-Bf5JKDJJ.js";
29
- import { n as FieldCopyTestIdButtonProps, t as FieldCopyTestIdButton } from "./index-DVRtBywt.js";
30
- import { n as FieldValidationErrorProps, t as FieldValidationError } from "./index-7mx-IcDp.js";
31
- export { CheckboxOption, Checkboxes, CheckboxesProps, FieldArray, FieldArrayChildrenRenderFn, FieldArrayFeatures, FieldArrayProps, FieldCard, FieldCardProps, FieldCopyTestIdButton, FieldCopyTestIdButtonProps, FieldValidationError, FieldValidationErrorProps, Form, FormProps, Grid, GridProps, Input, InputProps, InputValueTransform, RadioBoxes, RadioBoxesProps, RadioTabs, RadioTabsProps, Radios, RadiosProps, Select, SelectProps, Slider, SliderProps, SubmitButton, SubmitButtonProps, Switch, SwitchBox, SwitchBoxProps, SwitchProps, TextArea, TextAreaProps, UseControllerProps, UseControllerReturn, UseInputValueDebounceOptions, UseInputValueDebounceReturn, UseInputValueTransformOptions, UseInputValueTransformReturn, UseUniformFieldArrayProps, UseUniformFieldParams, UseUniformFieldReturn, UseWatchUserChangeOptions, checkFieldIsRequired, clientValidationSchemaByName, fieldCardVariants, flatArrayKey, fromNullishString, isValueEmpty, nameToTestId, radioBoxVariants, switchBoxVariants, toFormFormat, toNullishString, toValidationFormat, useClientValidation, useController, useFormContext, useInput, useInputValueDebounce, useInputValueTransform, useUniformField, useUniformFieldArray, useWatchUserChange };
29
+ import { n as FieldCopyTestIdButtonProps, t as FieldCopyTestIdButton } from "./index-CXkSuHEL.js";
30
+ import { n as FieldValidationErrorProps, t as FieldValidationError } from "./index-Z0IxHoXS.js";
31
+ export { CheckboxOption, Checkboxes, CheckboxesProps, FieldArray, FieldArrayChildrenRenderFn, FieldArrayFeatures, FieldArrayProps, FieldCard, FieldCardProps, FieldCopyTestIdButton, FieldCopyTestIdButtonProps, FieldValidationError, FieldValidationErrorProps, Form, FormProps, Grid, GridProps, Input, InputProps, InputValueTransform, RadioBoxes, RadioBoxesProps, RadioTabs, RadioTabsProps, Radios, RadiosProps, Select, SelectProps, Slider, SliderProps, SubmitButton, SubmitButtonProps, Switch, SwitchBox, SwitchBoxProps, SwitchProps, TextArea, TextAreaProps, UseControllerProps, UseControllerReturn, UseInputValueDebounceOptions, UseInputValueDebounceReturn, UseInputValueTransformOptions, UseInputValueTransformReturn, UseUniformFieldArrayProps, UseUniformFieldParams, UseUniformFieldReturn, UseWatchUserChangeOptions, checkFieldIsRequired, clientValidationSchemaByName, createOptionValueConverter, fieldCardVariants, flatArrayKey, fromNullishString, isValueEmpty, nameToTestId, radioBoxVariants, switchBoxVariants, toFormFormat, toNullishString, toValidationFormat, useClientValidation, useController, useFormContext, useInput, useInputValueDebounce, useInputValueTransform, useUniformField, useUniformFieldArray, useWatchUserChange };
package/dist/index.js CHANGED
@@ -1,34 +1,34 @@
1
- import { a as toFormFormat, i as nameToTestId, n as fromNullishString, o as toNullishString, r as isValueEmpty, s as toValidationFormat, t as flatArrayKey } from "./helpers-CCINRgQk.js";
1
+ import { a as toFormFormat, c as createOptionValueConverter, i as nameToTestId, n as fromNullishString, o as toNullishString, r as isValueEmpty, s as toValidationFormat, t as flatArrayKey } from "./helpers-D3A5d3M1.js";
2
2
  import { n as FieldCopyTestIdButton_default } from "./FieldCopyTestIdButton-D9f1B-VS.js";
3
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, t as checkFieldIsRequired } from "./useFormContext-BFoXZNkp.js";
4
+ import { t as useController } from "./useController-BPDcwfTj.js";
5
+ import { n as useFormContext, t as checkFieldIsRequired } from "./useFormContext-UFBqUfOr.js";
6
6
  import { t as useInput } from "./useInput-DZ6KGBxw.js";
7
7
  import { t as useInputValueTransform } from "./useInputValueTransform-CMNC21vX.js";
8
- import { t as useUniformField } from "./useUniformField-BKVVns0E.js";
9
- import { n as Checkboxes_default } from "./Checkboxes-BvW4D5Nm.js";
10
- import { t as useUniformFieldArray } from "./useUniformFieldArray-BwE634m6.js";
11
- import { n as FieldArray_default } from "./FieldArray-omRNwxgy.js";
8
+ import { t as useUniformField } from "./useUniformField-D2NgevBI.js";
9
+ import { n as Checkboxes_default } from "./Checkboxes-BQI2kTIb.js";
10
+ import { t as useUniformFieldArray } from "./useUniformFieldArray-DcoVYtqx.js";
11
+ import { n as FieldArray_default } from "./FieldArray-D4eGdGXA.js";
12
12
  import { n as Grid_default } from "./Grid-LRjQlZms.js";
13
- import { n as fieldCardVariants, t as FieldCard_default } from "./FieldCard-Dyi-2qr6.js";
14
- import { n as Form_default } from "./Form-B1fvbnxi.js";
15
- import { t as useInputValueDebounce } from "./useInputValueDebounce-Dop_8_OK.js";
16
- import { n as Input_default } from "./Input-DksaHK1Y.js";
17
- import { n as RadioBoxes_default, r as radioBoxVariants } from "./RadioBoxes-DdIHH6B5.js";
18
- import { n as RadioTabs_default } from "./RadioTabs-dLdlF91p.js";
19
- import { n as Radios_default } from "./Radios-DiZ0Dfmp.js";
20
- import { n as Select_default } from "./Select-C9otN8uu.js";
21
- import { n as Slider_default } from "./Slider-meuLEC2k.js";
22
- import { n as SubmitButton_default } from "./SubmitButton-BHP9J9ml.js";
23
- import { n as Switch_default } from "./Switch-DkciIYnD.js";
24
- import { n as SwitchBox_default, r as switchBoxVariants } from "./SwitchBox-B6Z4rtWt.js";
25
- import { n as TextArea_default } from "./TextArea-DAx49KI6.js";
26
- import { n as useClientValidation, t as clientValidationSchemaByName } from "./useClientValidation-BrTtRnqi.js";
27
- import { t as useWatchUserChange } from "./useWatchUserChange-fZy6nGtD.js";
13
+ import { n as fieldCardVariants, t as FieldCard_default } from "./FieldCard-BPQIqqW5.js";
14
+ import { n as Form_default } from "./Form-B7bv9fDO.js";
15
+ import { t as useInputValueDebounce } from "./useInputValueDebounce-D9wArTKz.js";
16
+ import { n as Input_default } from "./Input-BUfOTtDR.js";
17
+ import { n as RadioBoxes_default, r as radioBoxVariants } from "./RadioBoxes-Dpd71z1S.js";
18
+ import { n as RadioTabs_default } from "./RadioTabs-BZlC19z0.js";
19
+ import { n as Radios_default } from "./Radios-ClBrO7QR.js";
20
+ import { n as Select_default } from "./Select-9MyYYGeZ.js";
21
+ import { n as Slider_default } from "./Slider-Cy5vz5as.js";
22
+ import { n as SubmitButton_default } from "./SubmitButton-BrbHJcb4.js";
23
+ import { n as Switch_default } from "./Switch-s64WUP5i.js";
24
+ import { n as SwitchBox_default, r as switchBoxVariants } from "./SwitchBox-CMw1MGJ0.js";
25
+ import { n as TextArea_default } from "./TextArea-DTkDJr6g.js";
26
+ import { n as useClientValidation, t as clientValidationSchemaByName } from "./useClientValidation-C6Daq53C.js";
27
+ import { t as useWatchUserChange } from "./useWatchUserChange-1ELFYX_F.js";
28
28
 
29
29
  //#region src/index.ts
30
30
  /* v8 ignore stop */
31
31
 
32
32
  //#endregion
33
- export { Checkboxes_default as Checkboxes, FieldArray_default as FieldArray, FieldCard_default as FieldCard, FieldCopyTestIdButton_default as FieldCopyTestIdButton, FieldValidationError_default as FieldValidationError, Form_default as Form, Grid_default as Grid, Input_default as Input, RadioBoxes_default as RadioBoxes, RadioTabs_default as RadioTabs, Radios_default as Radios, Select_default as Select, Slider_default as Slider, SubmitButton_default as SubmitButton, Switch_default as Switch, SwitchBox_default as SwitchBox, TextArea_default as TextArea, checkFieldIsRequired, clientValidationSchemaByName, fieldCardVariants, flatArrayKey, fromNullishString, isValueEmpty, nameToTestId, radioBoxVariants, switchBoxVariants, toFormFormat, toNullishString, toValidationFormat, useClientValidation, useController, useFormContext, useInput, useInputValueDebounce, useInputValueTransform, useUniformField, useUniformFieldArray, useWatchUserChange };
33
+ export { Checkboxes_default as Checkboxes, FieldArray_default as FieldArray, FieldCard_default as FieldCard, FieldCopyTestIdButton_default as FieldCopyTestIdButton, FieldValidationError_default as FieldValidationError, Form_default as Form, Grid_default as Grid, Input_default as Input, RadioBoxes_default as RadioBoxes, RadioTabs_default as RadioTabs, Radios_default as Radios, Select_default as Select, Slider_default as Slider, SubmitButton_default as SubmitButton, Switch_default as Switch, SwitchBox_default as SwitchBox, TextArea_default as TextArea, checkFieldIsRequired, clientValidationSchemaByName, createOptionValueConverter, fieldCardVariants, flatArrayKey, fromNullishString, isValueEmpty, nameToTestId, radioBoxVariants, switchBoxVariants, toFormFormat, toNullishString, toValidationFormat, useClientValidation, useController, useFormContext, useInput, useInputValueDebounce, useInputValueTransform, useUniformField, useUniformFieldArray, useWatchUserChange };
34
34
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
- const require_FieldCopyTestIdButton = require('../../FieldCopyTestIdButton-By-hEZgA.cjs');
2
+ const require_FieldCopyTestIdButton = require('../../FieldCopyTestIdButton-DxJYKqrz.cjs');
3
3
 
4
4
  exports.FieldCopyTestIdButton = require_FieldCopyTestIdButton.FieldCopyTestIdButton_default$1;
5
5
  exports.default = require_FieldCopyTestIdButton.FieldCopyTestIdButton_default;
@@ -1,2 +1,2 @@
1
- import { n as FieldCopyTestIdButtonProps, t as FieldCopyTestIdButton } from "../../index-g9TZhGnE.cjs";
1
+ import { n as FieldCopyTestIdButtonProps, t as FieldCopyTestIdButton } from "../../index-DsyY9X04.cjs";
2
2
  export { FieldCopyTestIdButton, FieldCopyTestIdButton as default, FieldCopyTestIdButtonProps };
@@ -1,2 +1,2 @@
1
- import { n as FieldCopyTestIdButtonProps, t as FieldCopyTestIdButton } from "../../index-DVRtBywt.js";
1
+ import { n as FieldCopyTestIdButtonProps, t as FieldCopyTestIdButton } from "../../index-CXkSuHEL.js";
2
2
  export { FieldCopyTestIdButton, FieldCopyTestIdButton as default, FieldCopyTestIdButtonProps };
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
- const require_FieldValidationError = require('../../FieldValidationError-D64j5gnH.cjs');
2
+ const require_FieldValidationError = require('../../FieldValidationError-A384-L3Y.cjs');
3
3
 
4
4
  exports.FieldValidationError = require_FieldValidationError.FieldValidationError_default$1;
5
5
  exports.default = require_FieldValidationError.FieldValidationError_default;
@@ -1,2 +1,2 @@
1
- import { n as FieldValidationErrorProps, t as FieldValidationError } from "../../index-CuvvZMop.cjs";
1
+ import { n as FieldValidationErrorProps, t as FieldValidationError } from "../../index-Cs-7Ptqc.cjs";
2
2
  export { FieldValidationError, FieldValidationError as default, FieldValidationErrorProps };
@@ -1,2 +1,2 @@
1
- import { n as FieldValidationErrorProps, t as FieldValidationError } from "../../index-7mx-IcDp.js";
1
+ import { n as FieldValidationErrorProps, t as FieldValidationError } from "../../index-Z0IxHoXS.js";
2
2
  export { FieldValidationError, FieldValidationError as default, FieldValidationErrorProps };
@@ -1,5 +1,5 @@
1
- import { t as flatArrayKey } from "./helpers-CCINRgQk.js";
2
- import { n as useFormContext } from "./useFormContext-BFoXZNkp.js";
1
+ import { t as flatArrayKey } from "./helpers-D3A5d3M1.js";
2
+ import { n as useFormContext } from "./useFormContext-UFBqUfOr.js";
3
3
  import { useEffect, useId } from "react";
4
4
  import { array, objectLoose } from "@fuf-stack/veto";
5
5
 
@@ -176,4 +176,4 @@ const clientValidationSchemaByName = (name, fieldSchema) => {
176
176
 
177
177
  //#endregion
178
178
  export { useClientValidation as n, clientValidationSchemaByName as t };
179
- //# sourceMappingURL=useClientValidation-BrTtRnqi.js.map
179
+ //# sourceMappingURL=useClientValidation-C6Daq53C.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useClientValidation-BrTtRnqi.js","names":[],"sources":["../src/hooks/useClientValidation/useClientValidation.ts"],"sourcesContent":["import type { VetoTypeAny } from '@fuf-stack/veto';\n\nimport { useEffect, useId } from 'react';\n\nimport { array, objectLoose } from '@fuf-stack/veto';\n\nimport { flatArrayKey } from '../../helpers';\nimport { useFormContext } from '../useFormContext/useFormContext';\n\n/**\n * Hook for adding dynamic client-side validation to forms.\n *\n * Client validation is used for context-dependent validation rules that require external data\n * (e.g., checking if a username already exists). It complements base validation (passed to Form),\n * which handles static rules like \"required\", min/max length, format, etc.\n *\n * **Typical pattern:**\n * - Base validation: Static, always-on rules (required, format, length constraints)\n * - Client validation: Dynamic rules based on external data (uniqueness, business logic)\n * - Client schemas should use `.nullish()` to allow empty values (base validation handles \"required\")\n *\n * Automatically manages validation schema lifecycle: sets schema when data is provided,\n * clears schema when data is null/undefined, and cleans up on unmount. When the client\n * validation schema changes, automatically re-validates all touched fields.\n *\n * @param data - Data to create validation schema from (or null/undefined to clear validation)\n * @param schemaFactory - Function that creates a validation schema from the data. Schemas should typically use `.nullish()`.\n * @param options - Optional configuration object\n * @param options.key - Optional custom key for registration. Useful when multiple instances should share validation (e.g., in field arrays)\n *\n * @example\n * ```tsx\n * // Base validation handles \"required\" and format\n * const baseSchema = veto({ username: vt.string({ min: 3 }) });\n *\n * // Client validation adds dynamic uniqueness check\n * const { data: teamData } = useTeamQuery(teamId);\n * useClientValidation(teamData, (data) =>\n * vt.objectLoose({\n * username: vt.string()\n * .refine(\n * (value) => !data.existingUsers.includes(value),\n * { message: 'Username already exists' }\n * )\n * .nullish() // Allow empty - base validation handles \"required\"\n * })\n * );\n * ```\n *\n * @example\n * ```tsx\n * // Using custom key in a field array to avoid multiple registrations\n * fields.map((field, index) => (\n * useClientValidation(\n * userData,\n * (data) => clientValidationSchemaByName(\n * `items.${index}.name`,\n * vt.string()\n * .refine((val) => !data.forbidden.includes(val), { message: 'Name not allowed' })\n * .nullish()\n * ),\n * { key: 'items-validation' } // All instances share the same key\n * )\n * ));\n * ```\n */\nexport const useClientValidation = <TData = unknown>(\n data: TData | null | undefined,\n schemaFactory: (data: TData) => VetoTypeAny,\n options?: { key?: string },\n): void => {\n const {\n formState: { touchedFields },\n validation: { setClientValidationSchema },\n trigger,\n } = useFormContext();\n\n // Use provided key or auto-generate unique key\n const autoGeneratedKey = useId();\n const key = options?.key ?? autoGeneratedKey;\n\n // Use data hash instead of object reference to avoid unnecessary re-runs\n // when data object reference changes but data remains the same\n const dataHash = JSON.stringify(data);\n\n // Single effect to manage validation schema lifecycle\n useEffect(() => {\n // Set validation schema when data is available\n if (data != null) {\n const validationSchema = schemaFactory(data);\n setClientValidationSchema(key, validationSchema);\n } else {\n // Clear validation schema when no data\n setClientValidationSchema(key, null);\n }\n\n // Re-validate all touched fields when client validation schema changes\n const touchedFieldNames = Object.keys(touchedFields);\n if (touchedFieldNames.length > 0) {\n // Use setTimeout to ensure the client validation schema update has propagated\n // before triggering re-validation (fixes race condition)\n setTimeout(async () => {\n return trigger(touchedFieldNames);\n }, 1);\n }\n\n // Cleanup on unmount or when dependencies change\n return () => {\n setClientValidationSchema(key, null);\n };\n // Only re-run when data (dataHash) or key changes\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [dataHash, key]);\n};\n\n/**\n * Helper function to create a veto looseObject schema for a single field with nested path support.\n *\n * Parses field paths (dot-notation) and creates properly nested loose object schemas with array support.\n * All intermediate objects and arrays are marked as optional to allow partial data structures.\n * Numeric segments in the path are treated as array indices, and the parent field is wrapped in an array schema.\n * Supports flat arrays (arrays of primitives) via the special `__FLAT__` key.\n *\n * **Important:** The fieldSchema should typically use `.nullish()` to allow empty values. This is because:\n * - Base validation (passed to Form) handles \"required\" constraints\n * - Client validation adds dynamic, context-dependent rules (e.g., \"username already exists\")\n * - Form data processing converts empty strings in flat arrays to `null` (not `undefined`)\n * - `.nullish()` accepts both `null` and `undefined`, while `.optional()` only accepts `undefined`\n *\n * This pattern ensures client validation only validates non-empty values, while base validation\n * enforces required fields and basic constraints (min length, format, etc.).\n *\n * @param name - The dot-separated path to the field (e.g., 'username', 'user.profile.email', 'items.0.name', 'tags.0.__FLAT__')\n * @param fieldSchema - The veto validation schema for the field. Should typically use `.nullish()` to allow empty values.\n * @returns A nested loose object schema matching the field path structure with proper type inference\n *\n * @example\n * ```tsx\n * // Typical usage: base validation handles \"required\", client validation adds dynamic rules\n * // Base validation (in Form component)\n * const baseSchema = veto({ username: vt.string({ min: 3 }) }); // Required + min length\n *\n * // Client validation (dynamic check for existing usernames)\n * const { data: userData } = useUserQuery(userId);\n * useClientValidation(userData, (data) =>\n * clientValidationSchemaByName(\n * 'username',\n * vt.string()\n * .refine(\n * (value) => !data.existingUsernames.includes(value),\n * { message: 'Username already taken' }\n * )\n * .nullish() // Allow empty - base validation handles \"required\"\n * )\n * );\n * ```\n *\n * @example\n * ```tsx\n * // Nested field path with dynamic validation\n * clientValidationSchemaByName(\n * 'user.profile.email',\n * vt.string()\n * .refine(\n * (value) => !reservedEmails.includes(value),\n * { message: 'This email is reserved' }\n * )\n * .nullish()\n * )\n * // => objectLoose({ user: objectLoose({ profile: objectLoose({ email: ... }).optional() }).optional() })\n * ```\n *\n * @example\n * ```tsx\n * // Array of objects with dynamic validation\n * clientValidationSchemaByName(\n * 'items.0.tag',\n * vt.string()\n * .refine((value) => !forbiddenTags.includes(value), { message: 'Tag not allowed' })\n * .nullish()\n * )\n * // => objectLoose({ items: array(objectLoose({ tag: ... })).optional() })\n * ```\n *\n * @example\n * ```tsx\n * // Flat array (array of primitives) with dynamic validation\n * clientValidationSchemaByName(\n * 'tags.0.__FLAT__',\n * vt.string()\n * .refine((value) => !forbiddenWords.includes(value), { message: 'Word not allowed' })\n * .nullish()\n * )\n * // => objectLoose({ tags: array(vt.string().refine(...).nullish()).optional() })\n * ```\n */\nexport const clientValidationSchemaByName = <T extends VetoTypeAny>(\n name: string,\n fieldSchema: T,\n) => {\n const segments = name.split('.');\n\n // Build schema from innermost to outermost\n let schema: VetoTypeAny = fieldSchema;\n\n // Process segments in reverse order to build nested structure\n for (let i = segments.length - 1; i >= 0; i -= 1) {\n const segment = segments[i];\n\n const isNumeric = /^\\d+$/.test(segment);\n const isFlatArrayKey = segment === flatArrayKey;\n\n if (isFlatArrayKey) {\n // Skip the __FLAT__ key - it's just a marker for flat arrays\n // The schema is already correct (primitive type), just continue\n // eslint-disable-next-line no-continue\n continue;\n }\n\n if (isNumeric) {\n // Current segment is an array index - wrap current schema in optional array\n schema = array(schema).optional();\n } else {\n // Current segment is a field name - wrap in objectLoose\n // Make it optional if it's an intermediate object (not the root)\n const obj = objectLoose({\n [segment]: schema,\n });\n schema = i > 0 ? obj.optional() : obj;\n }\n }\n\n return schema;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,MAAa,uBACX,MACA,eACA,YACS;CACT,MAAM,EACJ,WAAW,EAAE,iBACb,YAAY,EAAE,6BACd,YACE,gBAAgB;CAGpB,MAAM,mBAAmB,OAAO;CAChC,MAAM,MAAM,SAAS,OAAO;AAO5B,iBAAgB;AAEd,MAAI,QAAQ,KAEV,2BAA0B,KADD,cAAc,KAAK,CACI;MAGhD,2BAA0B,KAAK,KAAK;EAItC,MAAM,oBAAoB,OAAO,KAAK,cAAc;AACpD,MAAI,kBAAkB,SAAS,EAG7B,YAAW,YAAY;AACrB,UAAO,QAAQ,kBAAkB;KAChC,EAAE;AAIP,eAAa;AACX,6BAA0B,KAAK,KAAK;;IAIrC,CA7Bc,KAAK,UAAU,KAAK,EA6BvB,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoFrB,MAAa,gCACX,MACA,gBACG;CACH,MAAM,WAAW,KAAK,MAAM,IAAI;CAGhC,IAAI,SAAsB;AAG1B,MAAK,IAAI,IAAI,SAAS,SAAS,GAAG,KAAK,GAAG,KAAK,GAAG;EAChD,MAAM,UAAU,SAAS;EAEzB,MAAM,YAAY,QAAQ,KAAK,QAAQ;AAGvC,MAFuB,YAAY,aAMjC;AAGF,MAAI,UAEF,UAAS,MAAM,OAAO,CAAC,UAAU;OAC5B;GAGL,MAAM,MAAM,YAAY,GACrB,UAAU,QACZ,CAAC;AACF,YAAS,IAAI,IAAI,IAAI,UAAU,GAAG;;;AAItC,QAAO"}
1
+ {"version":3,"file":"useClientValidation-C6Daq53C.js","names":[],"sources":["../src/hooks/useClientValidation/useClientValidation.ts"],"sourcesContent":["import type { VetoTypeAny } from '@fuf-stack/veto';\n\nimport { useEffect, useId } from 'react';\n\nimport { array, objectLoose } from '@fuf-stack/veto';\n\nimport { flatArrayKey } from '../../helpers';\nimport { useFormContext } from '../useFormContext/useFormContext';\n\n/**\n * Hook for adding dynamic client-side validation to forms.\n *\n * Client validation is used for context-dependent validation rules that require external data\n * (e.g., checking if a username already exists). It complements base validation (passed to Form),\n * which handles static rules like \"required\", min/max length, format, etc.\n *\n * **Typical pattern:**\n * - Base validation: Static, always-on rules (required, format, length constraints)\n * - Client validation: Dynamic rules based on external data (uniqueness, business logic)\n * - Client schemas should use `.nullish()` to allow empty values (base validation handles \"required\")\n *\n * Automatically manages validation schema lifecycle: sets schema when data is provided,\n * clears schema when data is null/undefined, and cleans up on unmount. When the client\n * validation schema changes, automatically re-validates all touched fields.\n *\n * @param data - Data to create validation schema from (or null/undefined to clear validation)\n * @param schemaFactory - Function that creates a validation schema from the data. Schemas should typically use `.nullish()`.\n * @param options - Optional configuration object\n * @param options.key - Optional custom key for registration. Useful when multiple instances should share validation (e.g., in field arrays)\n *\n * @example\n * ```tsx\n * // Base validation handles \"required\" and format\n * const baseSchema = veto({ username: vt.string({ min: 3 }) });\n *\n * // Client validation adds dynamic uniqueness check\n * const { data: teamData } = useTeamQuery(teamId);\n * useClientValidation(teamData, (data) =>\n * vt.objectLoose({\n * username: vt.string()\n * .refine(\n * (value) => !data.existingUsers.includes(value),\n * { message: 'Username already exists' }\n * )\n * .nullish() // Allow empty - base validation handles \"required\"\n * })\n * );\n * ```\n *\n * @example\n * ```tsx\n * // Using custom key in a field array to avoid multiple registrations\n * fields.map((field, index) => (\n * useClientValidation(\n * userData,\n * (data) => clientValidationSchemaByName(\n * `items.${index}.name`,\n * vt.string()\n * .refine((val) => !data.forbidden.includes(val), { message: 'Name not allowed' })\n * .nullish()\n * ),\n * { key: 'items-validation' } // All instances share the same key\n * )\n * ));\n * ```\n */\nexport const useClientValidation = <TData = unknown>(\n data: TData | null | undefined,\n schemaFactory: (data: TData) => VetoTypeAny,\n options?: { key?: string },\n): void => {\n const {\n formState: { touchedFields },\n validation: { setClientValidationSchema },\n trigger,\n } = useFormContext();\n\n // Use provided key or auto-generate unique key\n const autoGeneratedKey = useId();\n const key = options?.key ?? autoGeneratedKey;\n\n // Use data hash instead of object reference to avoid unnecessary re-runs\n // when data object reference changes but data remains the same\n const dataHash = JSON.stringify(data);\n\n // Single effect to manage validation schema lifecycle\n useEffect(() => {\n // Set validation schema when data is available\n if (data != null) {\n const validationSchema = schemaFactory(data);\n setClientValidationSchema(key, validationSchema);\n } else {\n // Clear validation schema when no data\n setClientValidationSchema(key, null);\n }\n\n // Re-validate all touched fields when client validation schema changes\n const touchedFieldNames = Object.keys(touchedFields);\n if (touchedFieldNames.length > 0) {\n // Use setTimeout to ensure the client validation schema update has propagated\n // before triggering re-validation (fixes race condition)\n setTimeout(async () => {\n return trigger(touchedFieldNames);\n }, 1);\n }\n\n // Cleanup on unmount or when dependencies change\n return () => {\n setClientValidationSchema(key, null);\n };\n // Only re-run when data (dataHash) or key changes\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [dataHash, key]);\n};\n\n/**\n * Helper function to create a veto looseObject schema for a single field with nested path support.\n *\n * Parses field paths (dot-notation) and creates properly nested loose object schemas with array support.\n * All intermediate objects and arrays are marked as optional to allow partial data structures.\n * Numeric segments in the path are treated as array indices, and the parent field is wrapped in an array schema.\n * Supports flat arrays (arrays of primitives) via the special `__FLAT__` key.\n *\n * **Important:** The fieldSchema should typically use `.nullish()` to allow empty values. This is because:\n * - Base validation (passed to Form) handles \"required\" constraints\n * - Client validation adds dynamic, context-dependent rules (e.g., \"username already exists\")\n * - Form data processing converts empty strings in flat arrays to `null` (not `undefined`)\n * - `.nullish()` accepts both `null` and `undefined`, while `.optional()` only accepts `undefined`\n *\n * This pattern ensures client validation only validates non-empty values, while base validation\n * enforces required fields and basic constraints (min length, format, etc.).\n *\n * @param name - The dot-separated path to the field (e.g., 'username', 'user.profile.email', 'items.0.name', 'tags.0.__FLAT__')\n * @param fieldSchema - The veto validation schema for the field. Should typically use `.nullish()` to allow empty values.\n * @returns A nested loose object schema matching the field path structure with proper type inference\n *\n * @example\n * ```tsx\n * // Typical usage: base validation handles \"required\", client validation adds dynamic rules\n * // Base validation (in Form component)\n * const baseSchema = veto({ username: vt.string({ min: 3 }) }); // Required + min length\n *\n * // Client validation (dynamic check for existing usernames)\n * const { data: userData } = useUserQuery(userId);\n * useClientValidation(userData, (data) =>\n * clientValidationSchemaByName(\n * 'username',\n * vt.string()\n * .refine(\n * (value) => !data.existingUsernames.includes(value),\n * { message: 'Username already taken' }\n * )\n * .nullish() // Allow empty - base validation handles \"required\"\n * )\n * );\n * ```\n *\n * @example\n * ```tsx\n * // Nested field path with dynamic validation\n * clientValidationSchemaByName(\n * 'user.profile.email',\n * vt.string()\n * .refine(\n * (value) => !reservedEmails.includes(value),\n * { message: 'This email is reserved' }\n * )\n * .nullish()\n * )\n * // => objectLoose({ user: objectLoose({ profile: objectLoose({ email: ... }).optional() }).optional() })\n * ```\n *\n * @example\n * ```tsx\n * // Array of objects with dynamic validation\n * clientValidationSchemaByName(\n * 'items.0.tag',\n * vt.string()\n * .refine((value) => !forbiddenTags.includes(value), { message: 'Tag not allowed' })\n * .nullish()\n * )\n * // => objectLoose({ items: array(objectLoose({ tag: ... })).optional() })\n * ```\n *\n * @example\n * ```tsx\n * // Flat array (array of primitives) with dynamic validation\n * clientValidationSchemaByName(\n * 'tags.0.__FLAT__',\n * vt.string()\n * .refine((value) => !forbiddenWords.includes(value), { message: 'Word not allowed' })\n * .nullish()\n * )\n * // => objectLoose({ tags: array(vt.string().refine(...).nullish()).optional() })\n * ```\n */\nexport const clientValidationSchemaByName = <T extends VetoTypeAny>(\n name: string,\n fieldSchema: T,\n) => {\n const segments = name.split('.');\n\n // Build schema from innermost to outermost\n let schema: VetoTypeAny = fieldSchema;\n\n // Process segments in reverse order to build nested structure\n for (let i = segments.length - 1; i >= 0; i -= 1) {\n const segment = segments[i];\n\n const isNumeric = /^\\d+$/.test(segment);\n const isFlatArrayKey = segment === flatArrayKey;\n\n if (isFlatArrayKey) {\n // Skip the __FLAT__ key - it's just a marker for flat arrays\n // The schema is already correct (primitive type), just continue\n // eslint-disable-next-line no-continue\n continue;\n }\n\n if (isNumeric) {\n // Current segment is an array index - wrap current schema in optional array\n schema = array(schema).optional();\n } else {\n // Current segment is a field name - wrap in objectLoose\n // Make it optional if it's an intermediate object (not the root)\n const obj = objectLoose({\n [segment]: schema,\n });\n schema = i > 0 ? obj.optional() : obj;\n }\n }\n\n return schema;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,MAAa,uBACX,MACA,eACA,YACS;CACT,MAAM,EACJ,WAAW,EAAE,iBACb,YAAY,EAAE,6BACd,YACE,gBAAgB;CAGpB,MAAM,mBAAmB,OAAO;CAChC,MAAM,MAAM,SAAS,OAAO;AAO5B,iBAAgB;AAEd,MAAI,QAAQ,KAEV,2BAA0B,KADD,cAAc,KAAK,CACI;MAGhD,2BAA0B,KAAK,KAAK;EAItC,MAAM,oBAAoB,OAAO,KAAK,cAAc;AACpD,MAAI,kBAAkB,SAAS,EAG7B,YAAW,YAAY;AACrB,UAAO,QAAQ,kBAAkB;KAChC,EAAE;AAIP,eAAa;AACX,6BAA0B,KAAK,KAAK;;IAIrC,CA7Bc,KAAK,UAAU,KAAK,EA6BvB,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoFrB,MAAa,gCACX,MACA,gBACG;CACH,MAAM,WAAW,KAAK,MAAM,IAAI;CAGhC,IAAI,SAAsB;AAG1B,MAAK,IAAI,IAAI,SAAS,SAAS,GAAG,KAAK,GAAG,KAAK,GAAG;EAChD,MAAM,UAAU,SAAS;EAEzB,MAAM,YAAY,QAAQ,KAAK,QAAQ;AAGvC,MAFuB,YAAY,aAMjC;AAGF,MAAI,UAEF,UAAS,MAAM,OAAO,CAAC,UAAU;OAC5B;GAGL,MAAM,MAAM,YAAY,GACrB,UAAU,QACZ,CAAC;AACF,YAAS,IAAI,IAAI,IAAI,UAAU,GAAG;;;AAItC,QAAO"}
@@ -1,6 +1,6 @@
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');
1
+ const require_FormContext = require('./FormContext-CeFKQmVH.cjs');
2
+ const require_helpers = require('./helpers-CncbgvW_.cjs');
3
+ const require_useFormContext = require('./useFormContext-DJiJlfGJ.cjs');
4
4
  let react = require("react");
5
5
  let _fuf_stack_veto = require("@fuf-stack/veto");
6
6
 
@@ -188,4 +188,4 @@ Object.defineProperty(exports, 'useClientValidation', {
188
188
  return useClientValidation;
189
189
  }
190
190
  });
191
- //# sourceMappingURL=useClientValidation-CdC7lEYP.cjs.map
191
+ //# sourceMappingURL=useClientValidation-DzomULfo.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useClientValidation-CdC7lEYP.cjs","names":["useFormContext","flatArrayKey"],"sources":["../src/hooks/useClientValidation/useClientValidation.ts"],"sourcesContent":["import type { VetoTypeAny } from '@fuf-stack/veto';\n\nimport { useEffect, useId } from 'react';\n\nimport { array, objectLoose } from '@fuf-stack/veto';\n\nimport { flatArrayKey } from '../../helpers';\nimport { useFormContext } from '../useFormContext/useFormContext';\n\n/**\n * Hook for adding dynamic client-side validation to forms.\n *\n * Client validation is used for context-dependent validation rules that require external data\n * (e.g., checking if a username already exists). It complements base validation (passed to Form),\n * which handles static rules like \"required\", min/max length, format, etc.\n *\n * **Typical pattern:**\n * - Base validation: Static, always-on rules (required, format, length constraints)\n * - Client validation: Dynamic rules based on external data (uniqueness, business logic)\n * - Client schemas should use `.nullish()` to allow empty values (base validation handles \"required\")\n *\n * Automatically manages validation schema lifecycle: sets schema when data is provided,\n * clears schema when data is null/undefined, and cleans up on unmount. When the client\n * validation schema changes, automatically re-validates all touched fields.\n *\n * @param data - Data to create validation schema from (or null/undefined to clear validation)\n * @param schemaFactory - Function that creates a validation schema from the data. Schemas should typically use `.nullish()`.\n * @param options - Optional configuration object\n * @param options.key - Optional custom key for registration. Useful when multiple instances should share validation (e.g., in field arrays)\n *\n * @example\n * ```tsx\n * // Base validation handles \"required\" and format\n * const baseSchema = veto({ username: vt.string({ min: 3 }) });\n *\n * // Client validation adds dynamic uniqueness check\n * const { data: teamData } = useTeamQuery(teamId);\n * useClientValidation(teamData, (data) =>\n * vt.objectLoose({\n * username: vt.string()\n * .refine(\n * (value) => !data.existingUsers.includes(value),\n * { message: 'Username already exists' }\n * )\n * .nullish() // Allow empty - base validation handles \"required\"\n * })\n * );\n * ```\n *\n * @example\n * ```tsx\n * // Using custom key in a field array to avoid multiple registrations\n * fields.map((field, index) => (\n * useClientValidation(\n * userData,\n * (data) => clientValidationSchemaByName(\n * `items.${index}.name`,\n * vt.string()\n * .refine((val) => !data.forbidden.includes(val), { message: 'Name not allowed' })\n * .nullish()\n * ),\n * { key: 'items-validation' } // All instances share the same key\n * )\n * ));\n * ```\n */\nexport const useClientValidation = <TData = unknown>(\n data: TData | null | undefined,\n schemaFactory: (data: TData) => VetoTypeAny,\n options?: { key?: string },\n): void => {\n const {\n formState: { touchedFields },\n validation: { setClientValidationSchema },\n trigger,\n } = useFormContext();\n\n // Use provided key or auto-generate unique key\n const autoGeneratedKey = useId();\n const key = options?.key ?? autoGeneratedKey;\n\n // Use data hash instead of object reference to avoid unnecessary re-runs\n // when data object reference changes but data remains the same\n const dataHash = JSON.stringify(data);\n\n // Single effect to manage validation schema lifecycle\n useEffect(() => {\n // Set validation schema when data is available\n if (data != null) {\n const validationSchema = schemaFactory(data);\n setClientValidationSchema(key, validationSchema);\n } else {\n // Clear validation schema when no data\n setClientValidationSchema(key, null);\n }\n\n // Re-validate all touched fields when client validation schema changes\n const touchedFieldNames = Object.keys(touchedFields);\n if (touchedFieldNames.length > 0) {\n // Use setTimeout to ensure the client validation schema update has propagated\n // before triggering re-validation (fixes race condition)\n setTimeout(async () => {\n return trigger(touchedFieldNames);\n }, 1);\n }\n\n // Cleanup on unmount or when dependencies change\n return () => {\n setClientValidationSchema(key, null);\n };\n // Only re-run when data (dataHash) or key changes\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [dataHash, key]);\n};\n\n/**\n * Helper function to create a veto looseObject schema for a single field with nested path support.\n *\n * Parses field paths (dot-notation) and creates properly nested loose object schemas with array support.\n * All intermediate objects and arrays are marked as optional to allow partial data structures.\n * Numeric segments in the path are treated as array indices, and the parent field is wrapped in an array schema.\n * Supports flat arrays (arrays of primitives) via the special `__FLAT__` key.\n *\n * **Important:** The fieldSchema should typically use `.nullish()` to allow empty values. This is because:\n * - Base validation (passed to Form) handles \"required\" constraints\n * - Client validation adds dynamic, context-dependent rules (e.g., \"username already exists\")\n * - Form data processing converts empty strings in flat arrays to `null` (not `undefined`)\n * - `.nullish()` accepts both `null` and `undefined`, while `.optional()` only accepts `undefined`\n *\n * This pattern ensures client validation only validates non-empty values, while base validation\n * enforces required fields and basic constraints (min length, format, etc.).\n *\n * @param name - The dot-separated path to the field (e.g., 'username', 'user.profile.email', 'items.0.name', 'tags.0.__FLAT__')\n * @param fieldSchema - The veto validation schema for the field. Should typically use `.nullish()` to allow empty values.\n * @returns A nested loose object schema matching the field path structure with proper type inference\n *\n * @example\n * ```tsx\n * // Typical usage: base validation handles \"required\", client validation adds dynamic rules\n * // Base validation (in Form component)\n * const baseSchema = veto({ username: vt.string({ min: 3 }) }); // Required + min length\n *\n * // Client validation (dynamic check for existing usernames)\n * const { data: userData } = useUserQuery(userId);\n * useClientValidation(userData, (data) =>\n * clientValidationSchemaByName(\n * 'username',\n * vt.string()\n * .refine(\n * (value) => !data.existingUsernames.includes(value),\n * { message: 'Username already taken' }\n * )\n * .nullish() // Allow empty - base validation handles \"required\"\n * )\n * );\n * ```\n *\n * @example\n * ```tsx\n * // Nested field path with dynamic validation\n * clientValidationSchemaByName(\n * 'user.profile.email',\n * vt.string()\n * .refine(\n * (value) => !reservedEmails.includes(value),\n * { message: 'This email is reserved' }\n * )\n * .nullish()\n * )\n * // => objectLoose({ user: objectLoose({ profile: objectLoose({ email: ... }).optional() }).optional() })\n * ```\n *\n * @example\n * ```tsx\n * // Array of objects with dynamic validation\n * clientValidationSchemaByName(\n * 'items.0.tag',\n * vt.string()\n * .refine((value) => !forbiddenTags.includes(value), { message: 'Tag not allowed' })\n * .nullish()\n * )\n * // => objectLoose({ items: array(objectLoose({ tag: ... })).optional() })\n * ```\n *\n * @example\n * ```tsx\n * // Flat array (array of primitives) with dynamic validation\n * clientValidationSchemaByName(\n * 'tags.0.__FLAT__',\n * vt.string()\n * .refine((value) => !forbiddenWords.includes(value), { message: 'Word not allowed' })\n * .nullish()\n * )\n * // => objectLoose({ tags: array(vt.string().refine(...).nullish()).optional() })\n * ```\n */\nexport const clientValidationSchemaByName = <T extends VetoTypeAny>(\n name: string,\n fieldSchema: T,\n) => {\n const segments = name.split('.');\n\n // Build schema from innermost to outermost\n let schema: VetoTypeAny = fieldSchema;\n\n // Process segments in reverse order to build nested structure\n for (let i = segments.length - 1; i >= 0; i -= 1) {\n const segment = segments[i];\n\n const isNumeric = /^\\d+$/.test(segment);\n const isFlatArrayKey = segment === flatArrayKey;\n\n if (isFlatArrayKey) {\n // Skip the __FLAT__ key - it's just a marker for flat arrays\n // The schema is already correct (primitive type), just continue\n // eslint-disable-next-line no-continue\n continue;\n }\n\n if (isNumeric) {\n // Current segment is an array index - wrap current schema in optional array\n schema = array(schema).optional();\n } else {\n // Current segment is a field name - wrap in objectLoose\n // Make it optional if it's an intermediate object (not the root)\n const obj = objectLoose({\n [segment]: schema,\n });\n schema = i > 0 ? obj.optional() : obj;\n }\n }\n\n return schema;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,MAAa,uBACX,MACA,eACA,YACS;CACT,MAAM,EACJ,WAAW,EAAE,iBACb,YAAY,EAAE,6BACd,YACEA,uCAAgB;CAGpB,MAAM,qCAA0B;CAChC,MAAM,MAAM,SAAS,OAAO;AAO5B,4BAAgB;AAEd,MAAI,QAAQ,KAEV,2BAA0B,KADD,cAAc,KAAK,CACI;MAGhD,2BAA0B,KAAK,KAAK;EAItC,MAAM,oBAAoB,OAAO,KAAK,cAAc;AACpD,MAAI,kBAAkB,SAAS,EAG7B,YAAW,YAAY;AACrB,UAAO,QAAQ,kBAAkB;KAChC,EAAE;AAIP,eAAa;AACX,6BAA0B,KAAK,KAAK;;IAIrC,CA7Bc,KAAK,UAAU,KAAK,EA6BvB,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoFrB,MAAa,gCACX,MACA,gBACG;CACH,MAAM,WAAW,KAAK,MAAM,IAAI;CAGhC,IAAI,SAAsB;AAG1B,MAAK,IAAI,IAAI,SAAS,SAAS,GAAG,KAAK,GAAG,KAAK,GAAG;EAChD,MAAM,UAAU,SAAS;EAEzB,MAAM,YAAY,QAAQ,KAAK,QAAQ;AAGvC,MAFuB,YAAYC,6BAMjC;AAGF,MAAI,UAEF,qCAAe,OAAO,CAAC,UAAU;OAC5B;GAGL,MAAM,uCAAkB,GACrB,UAAU,QACZ,CAAC;AACF,YAAS,IAAI,IAAI,IAAI,UAAU,GAAG;;;AAItC,QAAO"}
1
+ {"version":3,"file":"useClientValidation-DzomULfo.cjs","names":["useFormContext","flatArrayKey"],"sources":["../src/hooks/useClientValidation/useClientValidation.ts"],"sourcesContent":["import type { VetoTypeAny } from '@fuf-stack/veto';\n\nimport { useEffect, useId } from 'react';\n\nimport { array, objectLoose } from '@fuf-stack/veto';\n\nimport { flatArrayKey } from '../../helpers';\nimport { useFormContext } from '../useFormContext/useFormContext';\n\n/**\n * Hook for adding dynamic client-side validation to forms.\n *\n * Client validation is used for context-dependent validation rules that require external data\n * (e.g., checking if a username already exists). It complements base validation (passed to Form),\n * which handles static rules like \"required\", min/max length, format, etc.\n *\n * **Typical pattern:**\n * - Base validation: Static, always-on rules (required, format, length constraints)\n * - Client validation: Dynamic rules based on external data (uniqueness, business logic)\n * - Client schemas should use `.nullish()` to allow empty values (base validation handles \"required\")\n *\n * Automatically manages validation schema lifecycle: sets schema when data is provided,\n * clears schema when data is null/undefined, and cleans up on unmount. When the client\n * validation schema changes, automatically re-validates all touched fields.\n *\n * @param data - Data to create validation schema from (or null/undefined to clear validation)\n * @param schemaFactory - Function that creates a validation schema from the data. Schemas should typically use `.nullish()`.\n * @param options - Optional configuration object\n * @param options.key - Optional custom key for registration. Useful when multiple instances should share validation (e.g., in field arrays)\n *\n * @example\n * ```tsx\n * // Base validation handles \"required\" and format\n * const baseSchema = veto({ username: vt.string({ min: 3 }) });\n *\n * // Client validation adds dynamic uniqueness check\n * const { data: teamData } = useTeamQuery(teamId);\n * useClientValidation(teamData, (data) =>\n * vt.objectLoose({\n * username: vt.string()\n * .refine(\n * (value) => !data.existingUsers.includes(value),\n * { message: 'Username already exists' }\n * )\n * .nullish() // Allow empty - base validation handles \"required\"\n * })\n * );\n * ```\n *\n * @example\n * ```tsx\n * // Using custom key in a field array to avoid multiple registrations\n * fields.map((field, index) => (\n * useClientValidation(\n * userData,\n * (data) => clientValidationSchemaByName(\n * `items.${index}.name`,\n * vt.string()\n * .refine((val) => !data.forbidden.includes(val), { message: 'Name not allowed' })\n * .nullish()\n * ),\n * { key: 'items-validation' } // All instances share the same key\n * )\n * ));\n * ```\n */\nexport const useClientValidation = <TData = unknown>(\n data: TData | null | undefined,\n schemaFactory: (data: TData) => VetoTypeAny,\n options?: { key?: string },\n): void => {\n const {\n formState: { touchedFields },\n validation: { setClientValidationSchema },\n trigger,\n } = useFormContext();\n\n // Use provided key or auto-generate unique key\n const autoGeneratedKey = useId();\n const key = options?.key ?? autoGeneratedKey;\n\n // Use data hash instead of object reference to avoid unnecessary re-runs\n // when data object reference changes but data remains the same\n const dataHash = JSON.stringify(data);\n\n // Single effect to manage validation schema lifecycle\n useEffect(() => {\n // Set validation schema when data is available\n if (data != null) {\n const validationSchema = schemaFactory(data);\n setClientValidationSchema(key, validationSchema);\n } else {\n // Clear validation schema when no data\n setClientValidationSchema(key, null);\n }\n\n // Re-validate all touched fields when client validation schema changes\n const touchedFieldNames = Object.keys(touchedFields);\n if (touchedFieldNames.length > 0) {\n // Use setTimeout to ensure the client validation schema update has propagated\n // before triggering re-validation (fixes race condition)\n setTimeout(async () => {\n return trigger(touchedFieldNames);\n }, 1);\n }\n\n // Cleanup on unmount or when dependencies change\n return () => {\n setClientValidationSchema(key, null);\n };\n // Only re-run when data (dataHash) or key changes\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [dataHash, key]);\n};\n\n/**\n * Helper function to create a veto looseObject schema for a single field with nested path support.\n *\n * Parses field paths (dot-notation) and creates properly nested loose object schemas with array support.\n * All intermediate objects and arrays are marked as optional to allow partial data structures.\n * Numeric segments in the path are treated as array indices, and the parent field is wrapped in an array schema.\n * Supports flat arrays (arrays of primitives) via the special `__FLAT__` key.\n *\n * **Important:** The fieldSchema should typically use `.nullish()` to allow empty values. This is because:\n * - Base validation (passed to Form) handles \"required\" constraints\n * - Client validation adds dynamic, context-dependent rules (e.g., \"username already exists\")\n * - Form data processing converts empty strings in flat arrays to `null` (not `undefined`)\n * - `.nullish()` accepts both `null` and `undefined`, while `.optional()` only accepts `undefined`\n *\n * This pattern ensures client validation only validates non-empty values, while base validation\n * enforces required fields and basic constraints (min length, format, etc.).\n *\n * @param name - The dot-separated path to the field (e.g., 'username', 'user.profile.email', 'items.0.name', 'tags.0.__FLAT__')\n * @param fieldSchema - The veto validation schema for the field. Should typically use `.nullish()` to allow empty values.\n * @returns A nested loose object schema matching the field path structure with proper type inference\n *\n * @example\n * ```tsx\n * // Typical usage: base validation handles \"required\", client validation adds dynamic rules\n * // Base validation (in Form component)\n * const baseSchema = veto({ username: vt.string({ min: 3 }) }); // Required + min length\n *\n * // Client validation (dynamic check for existing usernames)\n * const { data: userData } = useUserQuery(userId);\n * useClientValidation(userData, (data) =>\n * clientValidationSchemaByName(\n * 'username',\n * vt.string()\n * .refine(\n * (value) => !data.existingUsernames.includes(value),\n * { message: 'Username already taken' }\n * )\n * .nullish() // Allow empty - base validation handles \"required\"\n * )\n * );\n * ```\n *\n * @example\n * ```tsx\n * // Nested field path with dynamic validation\n * clientValidationSchemaByName(\n * 'user.profile.email',\n * vt.string()\n * .refine(\n * (value) => !reservedEmails.includes(value),\n * { message: 'This email is reserved' }\n * )\n * .nullish()\n * )\n * // => objectLoose({ user: objectLoose({ profile: objectLoose({ email: ... }).optional() }).optional() })\n * ```\n *\n * @example\n * ```tsx\n * // Array of objects with dynamic validation\n * clientValidationSchemaByName(\n * 'items.0.tag',\n * vt.string()\n * .refine((value) => !forbiddenTags.includes(value), { message: 'Tag not allowed' })\n * .nullish()\n * )\n * // => objectLoose({ items: array(objectLoose({ tag: ... })).optional() })\n * ```\n *\n * @example\n * ```tsx\n * // Flat array (array of primitives) with dynamic validation\n * clientValidationSchemaByName(\n * 'tags.0.__FLAT__',\n * vt.string()\n * .refine((value) => !forbiddenWords.includes(value), { message: 'Word not allowed' })\n * .nullish()\n * )\n * // => objectLoose({ tags: array(vt.string().refine(...).nullish()).optional() })\n * ```\n */\nexport const clientValidationSchemaByName = <T extends VetoTypeAny>(\n name: string,\n fieldSchema: T,\n) => {\n const segments = name.split('.');\n\n // Build schema from innermost to outermost\n let schema: VetoTypeAny = fieldSchema;\n\n // Process segments in reverse order to build nested structure\n for (let i = segments.length - 1; i >= 0; i -= 1) {\n const segment = segments[i];\n\n const isNumeric = /^\\d+$/.test(segment);\n const isFlatArrayKey = segment === flatArrayKey;\n\n if (isFlatArrayKey) {\n // Skip the __FLAT__ key - it's just a marker for flat arrays\n // The schema is already correct (primitive type), just continue\n // eslint-disable-next-line no-continue\n continue;\n }\n\n if (isNumeric) {\n // Current segment is an array index - wrap current schema in optional array\n schema = array(schema).optional();\n } else {\n // Current segment is a field name - wrap in objectLoose\n // Make it optional if it's an intermediate object (not the root)\n const obj = objectLoose({\n [segment]: schema,\n });\n schema = i > 0 ? obj.optional() : obj;\n }\n }\n\n return schema;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,MAAa,uBACX,MACA,eACA,YACS;CACT,MAAM,EACJ,WAAW,EAAE,iBACb,YAAY,EAAE,6BACd,YACEA,uCAAgB;CAGpB,MAAM,qCAA0B;CAChC,MAAM,MAAM,SAAS,OAAO;AAO5B,4BAAgB;AAEd,MAAI,QAAQ,KAEV,2BAA0B,KADD,cAAc,KAAK,CACI;MAGhD,2BAA0B,KAAK,KAAK;EAItC,MAAM,oBAAoB,OAAO,KAAK,cAAc;AACpD,MAAI,kBAAkB,SAAS,EAG7B,YAAW,YAAY;AACrB,UAAO,QAAQ,kBAAkB;KAChC,EAAE;AAIP,eAAa;AACX,6BAA0B,KAAK,KAAK;;IAIrC,CA7Bc,KAAK,UAAU,KAAK,EA6BvB,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoFrB,MAAa,gCACX,MACA,gBACG;CACH,MAAM,WAAW,KAAK,MAAM,IAAI;CAGhC,IAAI,SAAsB;AAG1B,MAAK,IAAI,IAAI,SAAS,SAAS,GAAG,KAAK,GAAG,KAAK,GAAG;EAChD,MAAM,UAAU,SAAS;EAEzB,MAAM,YAAY,QAAQ,KAAK,QAAQ;AAGvC,MAFuB,YAAYC,6BAMjC;AAGF,MAAI,UAEF,qCAAe,OAAO,CAAC,UAAU;OAC5B;GAGL,MAAM,uCAAkB,GACrB,UAAU,QACZ,CAAC;AACF,YAAS,IAAI,IAAI,IAAI,UAAU,GAAG;;;AAItC,QAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"useController-BArZd2Vp.d.cts","names":[],"sources":["../src/hooks/useController/useController.ts"],"sourcesContent":[],"mappings":";;;KAaY,6DACV,mBAAsB;UAEP;EAHL,KAAA,EAIH,IAJG,CAIE,qBAJgB,CAIM,YAHZ,CAAA,EAAA,UAAA,GAAtB,OAAA,CAAA,GAAA;IAEe,QAAA,EAAA,CAAA,GAAA,KAAmB,EAAA,GAAA,EAAA,EAAA,GAAA,IAAA;IACA,KAAA,EAAA,MAAA;EAAtB,CAAA;EAAL,SAAA,EAMI,kBANJ,CAMuB,YANvB,CAAA;EAMuB,UAAA,EAClB,oBADkB;;;;AAmBhC;;;;;;;;;;;;;cAAa,6DACJ,qBAAmB,kBACzB,oBAAoB"}
1
+ {"version":3,"file":"useController-BArZd2Vp.d.cts","names":[],"sources":["../src/hooks/useController/useController.ts"],"sourcesContent":[],"mappings":";;;KAaY,6DACV,mBAAsB;UAEP;EAHL,KAAA,EAIH,IAJG,CAIE,qBAJgB,CAIM,YAJN,CACN,EAAA,UAAA,GAAtB,OAAA,CAAA,GAAA;IAEe,QAAA,EAAA,CAAA,GAAA,KAAmB,EAAA,GAAA,EAAA,EAAA,GAAA,IAAA;IACA,KAAA,EAAA,MAAA;EAAtB,CAAA;EAAL,SAAA,EAMI,kBANJ,CAMuB,YANvB,CAAA;EAMuB,UAAA,EAClB,oBADkB;;;;AAmBhC;;;;;;;;;;;;;cAAa,6DACJ,qBAAmB,kBACzB,oBAAoB"}
@@ -1,5 +1,5 @@
1
- import { n as fromNullishString, o as toNullishString } from "./helpers-CCINRgQk.js";
2
- import { n as UniformContext } from "./FormContext-Dl3k1r_k.js";
1
+ import { n as fromNullishString, o as toNullishString } from "./helpers-D3A5d3M1.js";
2
+ import { n as UniformContext } from "./FormContext-DHYlCZ2u.js";
3
3
  import { useContext } from "react";
4
4
  import { useController } from "react-hook-form";
5
5
 
@@ -40,4 +40,4 @@ const useController$1 = (props) => {
40
40
 
41
41
  //#endregion
42
42
  export { useController$1 as t };
43
- //# sourceMappingURL=useController-g0AlWM__.js.map
43
+ //# sourceMappingURL=useController-BPDcwfTj.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useController-g0AlWM__.js","names":["useController","useRHFController"],"sources":["../src/hooks/useController/useController.ts"],"sourcesContent":["import type {\n ControllerFieldState,\n ControllerRenderProps,\n UseControllerProps as RHFUseControllerProps,\n UseFormStateReturn,\n} from 'react-hook-form';\n\nimport { useContext } from 'react';\nimport { useController as useRHFController } from 'react-hook-form';\n\nimport { UniformContext } from '../../Form/subcomponents/FormContext';\nimport { fromNullishString, toNullishString } from '../../helpers';\n\nexport type UseControllerProps<TFieldValues extends object = object> =\n RHFUseControllerProps<TFieldValues>;\n\nexport interface UseControllerReturn<TFieldValues extends object = object> {\n field: Omit<ControllerRenderProps<TFieldValues>, 'onChange' | 'value'> & {\n // Using any[] to support both direct value changes and React synthetic events\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onChange: (...event: any[]) => void;\n value: string;\n };\n formState: UseFormStateReturn<TFieldValues>;\n fieldState: ControllerFieldState;\n}\n\n/**\n * A wrapper around react-hook-form's useController that transparently handles nullish string conversions.\n *\n * Key features:\n * 1. Empty strings ('') in the UI are stored as null in form state\n * 2. Null/undefined values in form state are displayed as empty strings in the UI\n * 3. Handles both direct value changes and React synthetic events\n * 4. Maintains the same API as react-hook-form's useController\n * 5. Notifies UniformContext's userChange listeners on field changes (enables useWatchUserChange hook)\n *\n * This enables consistent handling of empty/null values while keeping a clean API\n * for form inputs that expect string values.\n *\n * @see https://react-hook-form.com/docs/usecontroller\n */\nexport const useController = <TFieldValues extends object = object>(\n props: UseControllerProps<TFieldValues>,\n): UseControllerReturn<TFieldValues> => {\n const { field, formState, fieldState } = useRHFController(props);\n const { userChange } = useContext(UniformContext);\n\n return {\n field: {\n ...field,\n // Handles both direct values (onChange(\"value\")) and events (onChange(event))\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onChange: (...event: any[]) => {\n const value = event[0]?.target?.value ?? event[0];\n const formattedValue = value === '' ? '' : toNullishString(value);\n\n // Update form state first\n field.onChange(formattedValue);\n\n // Then notify userChange listeners (for useWatchUserChange hook)\n // This ensures getValues() in listeners returns the updated value\n // Guard against undefined userChange (when used outside FormProvider)\n userChange?.notify(field.name, formattedValue);\n },\n // Convert null/undefined to empty string for UI display\n value: fromNullishString(field.value) as string,\n },\n formState,\n fieldState,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA0CA,MAAaA,mBACX,UACsC;CACtC,MAAM,EAAE,OAAO,WAAW,eAAeC,cAAiB,MAAM;CAChE,MAAM,EAAE,eAAe,WAAW,eAAe;AAEjD,QAAO;EACL,OAAO;GACL,GAAG;GAGH,WAAW,GAAG,UAAiB;IAC7B,MAAM,QAAQ,MAAM,IAAI,QAAQ,SAAS,MAAM;IAC/C,MAAM,iBAAiB,UAAU,KAAK,KAAK,gBAAgB,MAAM;AAGjE,UAAM,SAAS,eAAe;AAK9B,gBAAY,OAAO,MAAM,MAAM,eAAe;;GAGhD,OAAO,kBAAkB,MAAM,MAAM;GACtC;EACD;EACA;EACD"}
1
+ {"version":3,"file":"useController-BPDcwfTj.js","names":["useController","useRHFController"],"sources":["../src/hooks/useController/useController.ts"],"sourcesContent":["import type {\n ControllerFieldState,\n ControllerRenderProps,\n UseControllerProps as RHFUseControllerProps,\n UseFormStateReturn,\n} from 'react-hook-form';\n\nimport { useContext } from 'react';\nimport { useController as useRHFController } from 'react-hook-form';\n\nimport { UniformContext } from '../../Form/subcomponents/FormContext';\nimport { fromNullishString, toNullishString } from '../../helpers';\n\nexport type UseControllerProps<TFieldValues extends object = object> =\n RHFUseControllerProps<TFieldValues>;\n\nexport interface UseControllerReturn<TFieldValues extends object = object> {\n field: Omit<ControllerRenderProps<TFieldValues>, 'onChange' | 'value'> & {\n // Using any[] to support both direct value changes and React synthetic events\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onChange: (...event: any[]) => void;\n value: string;\n };\n formState: UseFormStateReturn<TFieldValues>;\n fieldState: ControllerFieldState;\n}\n\n/**\n * A wrapper around react-hook-form's useController that transparently handles nullish string conversions.\n *\n * Key features:\n * 1. Empty strings ('') in the UI are stored as null in form state\n * 2. Null/undefined values in form state are displayed as empty strings in the UI\n * 3. Handles both direct value changes and React synthetic events\n * 4. Maintains the same API as react-hook-form's useController\n * 5. Notifies UniformContext's userChange listeners on field changes (enables useWatchUserChange hook)\n *\n * This enables consistent handling of empty/null values while keeping a clean API\n * for form inputs that expect string values.\n *\n * @see https://react-hook-form.com/docs/usecontroller\n */\nexport const useController = <TFieldValues extends object = object>(\n props: UseControllerProps<TFieldValues>,\n): UseControllerReturn<TFieldValues> => {\n const { field, formState, fieldState } = useRHFController(props);\n const { userChange } = useContext(UniformContext);\n\n return {\n field: {\n ...field,\n // Handles both direct values (onChange(\"value\")) and events (onChange(event))\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onChange: (...event: any[]) => {\n const value = event[0]?.target?.value ?? event[0];\n const formattedValue = value === '' ? '' : toNullishString(value);\n\n // Update form state first\n field.onChange(formattedValue);\n\n // Then notify userChange listeners (for useWatchUserChange hook)\n // This ensures getValues() in listeners returns the updated value\n // Guard against undefined userChange (when used outside FormProvider)\n userChange?.notify(field.name, formattedValue);\n },\n // Convert null/undefined to empty string for UI display\n value: fromNullishString(field.value) as string,\n },\n formState,\n fieldState,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA0CA,MAAaA,mBACX,UACsC;CACtC,MAAM,EAAE,OAAO,WAAW,eAAeC,cAAiB,MAAM;CAChE,MAAM,EAAE,eAAe,WAAW,eAAe;AAEjD,QAAO;EACL,OAAO;GACL,GAAG;GAGH,WAAW,GAAG,UAAiB;IAC7B,MAAM,QAAQ,MAAM,IAAI,QAAQ,SAAS,MAAM;IAC/C,MAAM,iBAAiB,UAAU,KAAK,KAAK,gBAAgB,MAAM;AAGjE,UAAM,SAAS,eAAe;AAK9B,gBAAY,OAAO,MAAM,MAAM,eAAe;;GAGhD,OAAO,kBAAkB,MAAM,MAAM;GACtC;EACD;EACA;EACD"}
@@ -1,5 +1,5 @@
1
- const require_FormContext = require('./FormContext-Lw4YL4-B.cjs');
2
- const require_helpers = require('./helpers-nYTmL2gX.cjs');
1
+ const require_FormContext = require('./FormContext-CeFKQmVH.cjs');
2
+ const require_helpers = require('./helpers-CncbgvW_.cjs');
3
3
  let react = require("react");
4
4
  let react_hook_form = require("react-hook-form");
5
5
 
@@ -45,4 +45,4 @@ Object.defineProperty(exports, 'useController', {
45
45
  return useController;
46
46
  }
47
47
  });
48
- //# sourceMappingURL=useController-BBxji1nQ.cjs.map
48
+ //# sourceMappingURL=useController-DHRkSHem.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useController-BBxji1nQ.cjs","names":["UniformContext","toNullishString","fromNullishString"],"sources":["../src/hooks/useController/useController.ts"],"sourcesContent":["import type {\n ControllerFieldState,\n ControllerRenderProps,\n UseControllerProps as RHFUseControllerProps,\n UseFormStateReturn,\n} from 'react-hook-form';\n\nimport { useContext } from 'react';\nimport { useController as useRHFController } from 'react-hook-form';\n\nimport { UniformContext } from '../../Form/subcomponents/FormContext';\nimport { fromNullishString, toNullishString } from '../../helpers';\n\nexport type UseControllerProps<TFieldValues extends object = object> =\n RHFUseControllerProps<TFieldValues>;\n\nexport interface UseControllerReturn<TFieldValues extends object = object> {\n field: Omit<ControllerRenderProps<TFieldValues>, 'onChange' | 'value'> & {\n // Using any[] to support both direct value changes and React synthetic events\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onChange: (...event: any[]) => void;\n value: string;\n };\n formState: UseFormStateReturn<TFieldValues>;\n fieldState: ControllerFieldState;\n}\n\n/**\n * A wrapper around react-hook-form's useController that transparently handles nullish string conversions.\n *\n * Key features:\n * 1. Empty strings ('') in the UI are stored as null in form state\n * 2. Null/undefined values in form state are displayed as empty strings in the UI\n * 3. Handles both direct value changes and React synthetic events\n * 4. Maintains the same API as react-hook-form's useController\n * 5. Notifies UniformContext's userChange listeners on field changes (enables useWatchUserChange hook)\n *\n * This enables consistent handling of empty/null values while keeping a clean API\n * for form inputs that expect string values.\n *\n * @see https://react-hook-form.com/docs/usecontroller\n */\nexport const useController = <TFieldValues extends object = object>(\n props: UseControllerProps<TFieldValues>,\n): UseControllerReturn<TFieldValues> => {\n const { field, formState, fieldState } = useRHFController(props);\n const { userChange } = useContext(UniformContext);\n\n return {\n field: {\n ...field,\n // Handles both direct values (onChange(\"value\")) and events (onChange(event))\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onChange: (...event: any[]) => {\n const value = event[0]?.target?.value ?? event[0];\n const formattedValue = value === '' ? '' : toNullishString(value);\n\n // Update form state first\n field.onChange(formattedValue);\n\n // Then notify userChange listeners (for useWatchUserChange hook)\n // This ensures getValues() in listeners returns the updated value\n // Guard against undefined userChange (when used outside FormProvider)\n userChange?.notify(field.name, formattedValue);\n },\n // Convert null/undefined to empty string for UI display\n value: fromNullishString(field.value) as string,\n },\n formState,\n fieldState,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA0CA,MAAa,iBACX,UACsC;CACtC,MAAM,EAAE,OAAO,WAAW,kDAAgC,MAAM;CAChE,MAAM,EAAE,qCAA0BA,mCAAe;AAEjD,QAAO;EACL,OAAO;GACL,GAAG;GAGH,WAAW,GAAG,UAAiB;IAC7B,MAAM,QAAQ,MAAM,IAAI,QAAQ,SAAS,MAAM;IAC/C,MAAM,iBAAiB,UAAU,KAAK,KAAKC,gCAAgB,MAAM;AAGjE,UAAM,SAAS,eAAe;AAK9B,gBAAY,OAAO,MAAM,MAAM,eAAe;;GAGhD,OAAOC,kCAAkB,MAAM,MAAM;GACtC;EACD;EACA;EACD"}
1
+ {"version":3,"file":"useController-DHRkSHem.cjs","names":["UniformContext","toNullishString","fromNullishString"],"sources":["../src/hooks/useController/useController.ts"],"sourcesContent":["import type {\n ControllerFieldState,\n ControllerRenderProps,\n UseControllerProps as RHFUseControllerProps,\n UseFormStateReturn,\n} from 'react-hook-form';\n\nimport { useContext } from 'react';\nimport { useController as useRHFController } from 'react-hook-form';\n\nimport { UniformContext } from '../../Form/subcomponents/FormContext';\nimport { fromNullishString, toNullishString } from '../../helpers';\n\nexport type UseControllerProps<TFieldValues extends object = object> =\n RHFUseControllerProps<TFieldValues>;\n\nexport interface UseControllerReturn<TFieldValues extends object = object> {\n field: Omit<ControllerRenderProps<TFieldValues>, 'onChange' | 'value'> & {\n // Using any[] to support both direct value changes and React synthetic events\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onChange: (...event: any[]) => void;\n value: string;\n };\n formState: UseFormStateReturn<TFieldValues>;\n fieldState: ControllerFieldState;\n}\n\n/**\n * A wrapper around react-hook-form's useController that transparently handles nullish string conversions.\n *\n * Key features:\n * 1. Empty strings ('') in the UI are stored as null in form state\n * 2. Null/undefined values in form state are displayed as empty strings in the UI\n * 3. Handles both direct value changes and React synthetic events\n * 4. Maintains the same API as react-hook-form's useController\n * 5. Notifies UniformContext's userChange listeners on field changes (enables useWatchUserChange hook)\n *\n * This enables consistent handling of empty/null values while keeping a clean API\n * for form inputs that expect string values.\n *\n * @see https://react-hook-form.com/docs/usecontroller\n */\nexport const useController = <TFieldValues extends object = object>(\n props: UseControllerProps<TFieldValues>,\n): UseControllerReturn<TFieldValues> => {\n const { field, formState, fieldState } = useRHFController(props);\n const { userChange } = useContext(UniformContext);\n\n return {\n field: {\n ...field,\n // Handles both direct values (onChange(\"value\")) and events (onChange(event))\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onChange: (...event: any[]) => {\n const value = event[0]?.target?.value ?? event[0];\n const formattedValue = value === '' ? '' : toNullishString(value);\n\n // Update form state first\n field.onChange(formattedValue);\n\n // Then notify userChange listeners (for useWatchUserChange hook)\n // This ensures getValues() in listeners returns the updated value\n // Guard against undefined userChange (when used outside FormProvider)\n userChange?.notify(field.name, formattedValue);\n },\n // Convert null/undefined to empty string for UI display\n value: fromNullishString(field.value) as string,\n },\n formState,\n fieldState,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA0CA,MAAa,iBACX,UACsC;CACtC,MAAM,EAAE,OAAO,WAAW,kDAAgC,MAAM;CAChE,MAAM,EAAE,qCAA0BA,mCAAe;AAEjD,QAAO;EACL,OAAO;GACL,GAAG;GAGH,WAAW,GAAG,UAAiB;IAC7B,MAAM,QAAQ,MAAM,IAAI,QAAQ,SAAS,MAAM;IAC/C,MAAM,iBAAiB,UAAU,KAAK,KAAKC,gCAAgB,MAAM;AAGjE,UAAM,SAAS,eAAe;AAK9B,gBAAY,OAAO,MAAM,MAAM,eAAe;;GAGhD,OAAOC,kCAAkB,MAAM,MAAM;GACtC;EACD;EACA;EACD"}
@@ -32,10 +32,10 @@ declare const useFormContext$1: <TFieldValues extends FieldValues = FieldValues,
32
32
  getValues: react_hook_form9.UseFormGetValues<TFieldValues>;
33
33
  subscribe: react_hook_form9.UseFormSubscribe<TFieldValues>;
34
34
  watch: react_hook_form9.UseFormWatch<TFieldValues>;
35
- debugMode: "debug" | "debug-testids" | "off" | "disabled";
35
+ debugMode: "disabled" | "debug" | "debug-testids" | "off";
36
36
  debugModeSettings?: DebugModeSettings;
37
37
  preventSubmit: (prevent: boolean) => void;
38
- setDebugMode: (debugMode: "debug" | "debug-testids" | "off" | "disabled") => void;
38
+ setDebugMode: (debugMode: "disabled" | "debug" | "debug-testids" | "off") => void;
39
39
  triggerSubmit: (e?: react0.BaseSyntheticEvent) => Promise<void> | void;
40
40
  userChange: {
41
41
  subscribe: (listener: UserChangeListener) => () => void;
@@ -61,4 +61,4 @@ declare const useFormContext$1: <TFieldValues extends FieldValues = FieldValues,
61
61
  };
62
62
  //#endregion
63
63
  export { useFormContext$1 as n, checkFieldIsRequired as t };
64
- //# sourceMappingURL=useFormContext-Cw6aAhos.d.ts.map
64
+ //# sourceMappingURL=useFormContext-B2TS6xq0.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFormContext-B2TS6xq0.d.ts","names":[],"sources":["../src/hooks/useFormContext/useFormContext.ts"],"sourcesContent":[],"mappings":";;;;;;;;;cAYa,mCACC;;;;;AADd;AAqEA;;;;;cAAa,wCACU,cAAc,kDAEd;EAwBa,SAAA,4BAAA,aAAA,CAAA;EAAL,aAAA,EAAA,CAAA,IAAA,EAAA,IAAA,CAAK,YAAL,CAAA,EAAA,MAAA,CAAA,EAAA,MAAA,EAAA,GAAA;;;;;;;;;WAWO,mCAAA,aAAA,CAAA;EAAA,SAAA,mCAAA,aAAA,CAAA;EAAA,KAAA,+BAAA,aAAA,CAAA;EAyBpC,SAAA,EAAA,UAAA,GAAA,OAAA,GAAA,eAAA,GAAA,KAAA;EACyB,iBAAA,CAAA,mBAAA;EAAwE,aAAA,EAAA,CAAA,OAAA,EAAA,OAAA,EAAA,GAAA,IAAA;EAAA,YAAA,EAAA,CAAA,SAAA,EAAA,UAAA,GAAA,OAAA,GAAA,eAAA,GAAA,KAAA,EAAA,GAAA,IAAA;6BA1B7D,uBAAA;;0BAAA;;;;mBAyBpC;eACyB;aAAwE;qDAAA,gBAAA,CAAA,WAAA"}
@@ -1,5 +1,5 @@
1
- const require_FormContext = require('./FormContext-Lw4YL4-B.cjs');
2
- const require_helpers = require('./helpers-nYTmL2gX.cjs');
1
+ const require_FormContext = require('./FormContext-CeFKQmVH.cjs');
2
+ const require_helpers = require('./helpers-CncbgvW_.cjs');
3
3
  let react = require("react");
4
4
  let react_hook_form = require("react-hook-form");
5
5
 
@@ -131,4 +131,4 @@ Object.defineProperty(exports, 'useFormContext', {
131
131
  return useFormContext;
132
132
  }
133
133
  });
134
- //# sourceMappingURL=useFormContext-CEr3zcL6.cjs.map
134
+ //# sourceMappingURL=useFormContext-DJiJlfGJ.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useFormContext-CEr3zcL6.cjs","names":["flatArrayKey","UniformContext","nameToTestId","toValidationFormat"],"sources":["../src/hooks/useFormContext/useFormContext.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport type { VetoFormattedError, VetoInstance } from '@fuf-stack/veto';\nimport type { FieldError, FieldValues, Path } from 'react-hook-form';\n\nimport { useContext } from 'react';\nimport { useFormContext as useHookFormContext } from 'react-hook-form';\n\nimport { UniformContext } from '../../Form/subcomponents/FormContext';\nimport { flatArrayKey, nameToTestId, toValidationFormat } from '../../helpers';\n\n/** Schema check whether a field is required or optional */\nexport const checkFieldIsRequired = (\n validation: VetoInstance,\n path: string[],\n): boolean => {\n // Handle flat array paths: strip the flatArrayKey to check the array element schema\n // e.g., ['arrayField', '0', '__FLAT__'] -> check schema at ['arrayField', '0']\n const checkPath =\n path[path.length - 1] === flatArrayKey ? path.slice(0, -1) : path;\n\n const checkRequired = (schema: any) => {\n // arrays ...\n if (schema.type === 'array') {\n // ... if array is optional or nullable it is not required\n if (schema.isOptional || schema.isNullable) {\n return false;\n }\n // ... otherwise arrays are required (display logic wise -> no asterisk in the label)\n return true;\n }\n\n // all other fields are required if they are\n // not optional and not nullable\n return !schema.isOptional && !schema.isNullable;\n };\n\n return validation.checkSchemaPath(checkRequired, checkPath);\n};\n\n/**\n * Resolve validation errors for a given field path.\n *\n * Traverses a nested `VetoFormattedError` structure using a dotted path\n * (for example: \"user.address.0.street\") and returns the matching\n * `FieldError[]` if present. If no error exists at the path, returns\n * `undefined`.\n *\n * @param errors - The formatted validation errors from Uniform's context\n * @param name - The dotted field path to resolve\n * @returns An array of `FieldError` entries for the field, or `undefined`\n */\nconst getValidationErrorsByName = (\n errors: VetoFormattedError,\n name: string,\n) => {\n // Traverse nested error structure; ignore flat array wrapper key\n const keys = name.split('.').filter((k) => {\n return k !== flatArrayKey;\n });\n let current: unknown = errors as unknown;\n keys.forEach((key) => {\n if (current && typeof current === 'object') {\n current = (current as Record<string, unknown>)[key];\n } else {\n current = undefined;\n }\n });\n return current as FieldError[] | undefined;\n};\n\n/**\n * Custom hook that extends react-hook-form's useFormContext to add validation and state management.\n *\n * Key features:\n * - Enhanced `getFieldState` that includes validation schema-based \"required\" status and testId generation\n * - Automatic conversion of form values via `getValues`, `watch`, and `subscribe`:\n * - Unwraps flat array wrappers (`{ __FLAT__: value }` → `value`)\n * - Converts nullish string markers (`__NULL__` → `null`, `__FALSE__` → `false`, `__ZERO__` → `0`)\n * - Filters out empty/null values\n */\nexport const useFormContext = <\n TFieldValues extends FieldValues = FieldValues,\n TContext = any,\n TTransformedValues = TFieldValues,\n>() => {\n const {\n formState,\n // some methods that will be enhanced below\n getFieldState: getFieldStateOrig,\n getValues: getValuesOrig,\n watch: watchOrig,\n subscribe: subscribeOrig,\n // the rest of the methods pass through unchanged\n ...otherMethods\n } = useHookFormContext<TFieldValues, TContext, TTransformedValues>();\n\n const uniformContext = useContext(UniformContext);\n\n /**\n * Updated getFieldState method which returns:\n * - Whether the field is required by checking the validation schema\n * - Existing field state information (errors, etc.)\n * - A testId generated from the field name (with flat array keys removed and slugified)\n *\n * @param name - The field path (string or array)\n * @param testId - Optional explicit testId. If provided, will be slugified. If not provided, generated from name.\n */\n const getFieldState = (name: Path<TFieldValues>, testId?: string) => {\n const fieldPath =\n typeof name === 'string' ? name.replace(/\\[\\d+\\]/g, '').split('.') : name;\n\n // Use base validation instance for checking \"required\" status\n // Client validation often uses .nullish() which would incorrectly mark fields as optional\n const validationInstance =\n uniformContext?.validation.baseInstance ??\n uniformContext?.validation.instance;\n\n // Check if the field is required using the validation schema\n const required = validationInstance\n ? checkFieldIsRequired(validationInstance, fieldPath)\n : false;\n\n const error = getValidationErrorsByName(\n uniformContext?.validation.errors ?? {},\n name,\n ) as unknown as FieldError[] | undefined;\n\n // Get everything but the error from the original field state\n const fieldState = getFieldStateOrig(name, formState);\n\n return {\n ...fieldState,\n error,\n invalid: !!error,\n required,\n testId: nameToTestId(testId ?? name),\n };\n };\n\n /**\n * Wrap form value accessor methods to automatically convert from internal storage format\n * to component-friendly format:\n *\n * - Unwrap flat array wrappers: `{ __FLAT__: value }` → `value`\n * - Convert nullish string markers: `__NULL__` → `null`, `__FALSE__` → `false`, `__ZERO__` → `0`\n * - Filter out empty/null values: fields with converted null/empty values are removed entirely\n *\n * This ensures components receive clean, predictable data without needing to handle\n * the internal nullish string conversion system or flat array wrapping manually.\n */\n const getValues = ((...args: any[]) => {\n const result = (getValuesOrig as any)(...args);\n return toValidationFormat(result);\n }) as typeof getValuesOrig;\n\n const watch = ((...args: any[]) => {\n const result = (watchOrig as any)(...args);\n return toValidationFormat(result);\n }) as typeof watchOrig;\n\n const subscribe = ((...args: any[]) => {\n // For subscribe, we need to wrap the callback to convert the values property\n const [options] = args;\n if (options?.callback) {\n const originalCallback = options.callback;\n const wrappedOptions = {\n ...options,\n callback: (subscribeFormState: any) => {\n // Convert the values property if it exists\n const convertedFormState = {\n ...subscribeFormState,\n ...(subscribeFormState.values && {\n values: toValidationFormat(subscribeFormState.values),\n }),\n };\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return originalCallback(convertedFormState);\n },\n };\n return subscribeOrig(wrappedOptions);\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return (subscribeOrig as any)(...args);\n }) as typeof subscribeOrig;\n\n return {\n ...otherMethods,\n ...uniformContext,\n formState,\n getFieldState,\n getValues,\n subscribe,\n watch,\n };\n};\n"],"mappings":";;;;;;;AAYA,MAAa,wBACX,YACA,SACY;CAGZ,MAAM,YACJ,KAAK,KAAK,SAAS,OAAOA,+BAAe,KAAK,MAAM,GAAG,GAAG,GAAG;CAE/D,MAAM,iBAAiB,WAAgB;AAErC,MAAI,OAAO,SAAS,SAAS;AAE3B,OAAI,OAAO,cAAc,OAAO,WAC9B,QAAO;AAGT,UAAO;;AAKT,SAAO,CAAC,OAAO,cAAc,CAAC,OAAO;;AAGvC,QAAO,WAAW,gBAAgB,eAAe,UAAU;;;;;;;;;;;;;;AAe7D,MAAM,6BACJ,QACA,SACG;CAEH,MAAM,OAAO,KAAK,MAAM,IAAI,CAAC,QAAQ,MAAM;AACzC,SAAO,MAAMA;GACb;CACF,IAAI,UAAmB;AACvB,MAAK,SAAS,QAAQ;AACpB,MAAI,WAAW,OAAO,YAAY,SAChC,WAAW,QAAoC;MAE/C,WAAU;GAEZ;AACF,QAAO;;;;;;;;;;;;AAaT,MAAa,uBAIN;CACL,MAAM,EACJ,WAEA,eAAe,mBACf,WAAW,eACX,OAAO,WACP,WAAW,eAEX,GAAG,sDAC+D;CAEpE,MAAM,uCAA4BC,mCAAe;;;;;;;;;;CAWjD,MAAM,iBAAiB,MAA0B,WAAoB;EACnE,MAAM,YACJ,OAAO,SAAS,WAAW,KAAK,QAAQ,YAAY,GAAG,CAAC,MAAM,IAAI,GAAG;EAIvE,MAAM,qBACJ,gBAAgB,WAAW,gBAC3B,gBAAgB,WAAW;EAG7B,MAAM,WAAW,qBACb,qBAAqB,oBAAoB,UAAU,GACnD;EAEJ,MAAM,QAAQ,0BACZ,gBAAgB,WAAW,UAAU,EAAE,EACvC,KACD;AAKD,SAAO;GACL,GAHiB,kBAAkB,MAAM,UAAU;GAInD;GACA,SAAS,CAAC,CAAC;GACX;GACA,QAAQC,6BAAa,UAAU,KAAK;GACrC;;;;;;;;;;;;;CAcH,MAAM,cAAc,GAAG,SAAgB;AAErC,SAAOC,mCADS,cAAsB,GAAG,KAAK,CACb;;CAGnC,MAAM,UAAU,GAAG,SAAgB;AAEjC,SAAOA,mCADS,UAAkB,GAAG,KAAK,CACT;;CAGnC,MAAM,cAAc,GAAG,SAAgB;EAErC,MAAM,CAAC,WAAW;AAClB,MAAI,SAAS,UAAU;GACrB,MAAM,mBAAmB,QAAQ;AAejC,UAAO,cAdgB;IACrB,GAAG;IACH,WAAW,uBAA4B;AASrC,YAAO,iBAPoB;MACzB,GAAG;MACH,GAAI,mBAAmB,UAAU,EAC/B,QAAQA,mCAAmB,mBAAmB,OAAO,EACtD;MACF,CAE0C;;IAE9C,CACmC;;AAGtC,SAAQ,cAAsB,GAAG,KAAK;;AAGxC,QAAO;EACL,GAAG;EACH,GAAG;EACH;EACA;EACA;EACA;EACA;EACD"}
1
+ {"version":3,"file":"useFormContext-DJiJlfGJ.cjs","names":["flatArrayKey","UniformContext","nameToTestId","toValidationFormat"],"sources":["../src/hooks/useFormContext/useFormContext.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport type { VetoFormattedError, VetoInstance } from '@fuf-stack/veto';\nimport type { FieldError, FieldValues, Path } from 'react-hook-form';\n\nimport { useContext } from 'react';\nimport { useFormContext as useHookFormContext } from 'react-hook-form';\n\nimport { UniformContext } from '../../Form/subcomponents/FormContext';\nimport { flatArrayKey, nameToTestId, toValidationFormat } from '../../helpers';\n\n/** Schema check whether a field is required or optional */\nexport const checkFieldIsRequired = (\n validation: VetoInstance,\n path: string[],\n): boolean => {\n // Handle flat array paths: strip the flatArrayKey to check the array element schema\n // e.g., ['arrayField', '0', '__FLAT__'] -> check schema at ['arrayField', '0']\n const checkPath =\n path[path.length - 1] === flatArrayKey ? path.slice(0, -1) : path;\n\n const checkRequired = (schema: any) => {\n // arrays ...\n if (schema.type === 'array') {\n // ... if array is optional or nullable it is not required\n if (schema.isOptional || schema.isNullable) {\n return false;\n }\n // ... otherwise arrays are required (display logic wise -> no asterisk in the label)\n return true;\n }\n\n // all other fields are required if they are\n // not optional and not nullable\n return !schema.isOptional && !schema.isNullable;\n };\n\n return validation.checkSchemaPath(checkRequired, checkPath);\n};\n\n/**\n * Resolve validation errors for a given field path.\n *\n * Traverses a nested `VetoFormattedError` structure using a dotted path\n * (for example: \"user.address.0.street\") and returns the matching\n * `FieldError[]` if present. If no error exists at the path, returns\n * `undefined`.\n *\n * @param errors - The formatted validation errors from Uniform's context\n * @param name - The dotted field path to resolve\n * @returns An array of `FieldError` entries for the field, or `undefined`\n */\nconst getValidationErrorsByName = (\n errors: VetoFormattedError,\n name: string,\n) => {\n // Traverse nested error structure; ignore flat array wrapper key\n const keys = name.split('.').filter((k) => {\n return k !== flatArrayKey;\n });\n let current: unknown = errors as unknown;\n keys.forEach((key) => {\n if (current && typeof current === 'object') {\n current = (current as Record<string, unknown>)[key];\n } else {\n current = undefined;\n }\n });\n return current as FieldError[] | undefined;\n};\n\n/**\n * Custom hook that extends react-hook-form's useFormContext to add validation and state management.\n *\n * Key features:\n * - Enhanced `getFieldState` that includes validation schema-based \"required\" status and testId generation\n * - Automatic conversion of form values via `getValues`, `watch`, and `subscribe`:\n * - Unwraps flat array wrappers (`{ __FLAT__: value }` → `value`)\n * - Converts nullish string markers (`__NULL__` → `null`, `__FALSE__` → `false`, `__ZERO__` → `0`)\n * - Filters out empty/null values\n */\nexport const useFormContext = <\n TFieldValues extends FieldValues = FieldValues,\n TContext = any,\n TTransformedValues = TFieldValues,\n>() => {\n const {\n formState,\n // some methods that will be enhanced below\n getFieldState: getFieldStateOrig,\n getValues: getValuesOrig,\n watch: watchOrig,\n subscribe: subscribeOrig,\n // the rest of the methods pass through unchanged\n ...otherMethods\n } = useHookFormContext<TFieldValues, TContext, TTransformedValues>();\n\n const uniformContext = useContext(UniformContext);\n\n /**\n * Updated getFieldState method which returns:\n * - Whether the field is required by checking the validation schema\n * - Existing field state information (errors, etc.)\n * - A testId generated from the field name (with flat array keys removed and slugified)\n *\n * @param name - The field path (string or array)\n * @param testId - Optional explicit testId. If provided, will be slugified. If not provided, generated from name.\n */\n const getFieldState = (name: Path<TFieldValues>, testId?: string) => {\n const fieldPath =\n typeof name === 'string' ? name.replace(/\\[\\d+\\]/g, '').split('.') : name;\n\n // Use base validation instance for checking \"required\" status\n // Client validation often uses .nullish() which would incorrectly mark fields as optional\n const validationInstance =\n uniformContext?.validation.baseInstance ??\n uniformContext?.validation.instance;\n\n // Check if the field is required using the validation schema\n const required = validationInstance\n ? checkFieldIsRequired(validationInstance, fieldPath)\n : false;\n\n const error = getValidationErrorsByName(\n uniformContext?.validation.errors ?? {},\n name,\n ) as unknown as FieldError[] | undefined;\n\n // Get everything but the error from the original field state\n const fieldState = getFieldStateOrig(name, formState);\n\n return {\n ...fieldState,\n error,\n invalid: !!error,\n required,\n testId: nameToTestId(testId ?? name),\n };\n };\n\n /**\n * Wrap form value accessor methods to automatically convert from internal storage format\n * to component-friendly format:\n *\n * - Unwrap flat array wrappers: `{ __FLAT__: value }` → `value`\n * - Convert nullish string markers: `__NULL__` → `null`, `__FALSE__` → `false`, `__ZERO__` → `0`\n * - Filter out empty/null values: fields with converted null/empty values are removed entirely\n *\n * This ensures components receive clean, predictable data without needing to handle\n * the internal nullish string conversion system or flat array wrapping manually.\n */\n const getValues = ((...args: any[]) => {\n const result = (getValuesOrig as any)(...args);\n return toValidationFormat(result);\n }) as typeof getValuesOrig;\n\n const watch = ((...args: any[]) => {\n const result = (watchOrig as any)(...args);\n return toValidationFormat(result);\n }) as typeof watchOrig;\n\n const subscribe = ((...args: any[]) => {\n // For subscribe, we need to wrap the callback to convert the values property\n const [options] = args;\n if (options?.callback) {\n const originalCallback = options.callback;\n const wrappedOptions = {\n ...options,\n callback: (subscribeFormState: any) => {\n // Convert the values property if it exists\n const convertedFormState = {\n ...subscribeFormState,\n ...(subscribeFormState.values && {\n values: toValidationFormat(subscribeFormState.values),\n }),\n };\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return originalCallback(convertedFormState);\n },\n };\n return subscribeOrig(wrappedOptions);\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return (subscribeOrig as any)(...args);\n }) as typeof subscribeOrig;\n\n return {\n ...otherMethods,\n ...uniformContext,\n formState,\n getFieldState,\n getValues,\n subscribe,\n watch,\n };\n};\n"],"mappings":";;;;;;;AAYA,MAAa,wBACX,YACA,SACY;CAGZ,MAAM,YACJ,KAAK,KAAK,SAAS,OAAOA,+BAAe,KAAK,MAAM,GAAG,GAAG,GAAG;CAE/D,MAAM,iBAAiB,WAAgB;AAErC,MAAI,OAAO,SAAS,SAAS;AAE3B,OAAI,OAAO,cAAc,OAAO,WAC9B,QAAO;AAGT,UAAO;;AAKT,SAAO,CAAC,OAAO,cAAc,CAAC,OAAO;;AAGvC,QAAO,WAAW,gBAAgB,eAAe,UAAU;;;;;;;;;;;;;;AAe7D,MAAM,6BACJ,QACA,SACG;CAEH,MAAM,OAAO,KAAK,MAAM,IAAI,CAAC,QAAQ,MAAM;AACzC,SAAO,MAAMA;GACb;CACF,IAAI,UAAmB;AACvB,MAAK,SAAS,QAAQ;AACpB,MAAI,WAAW,OAAO,YAAY,SAChC,WAAW,QAAoC;MAE/C,WAAU;GAEZ;AACF,QAAO;;;;;;;;;;;;AAaT,MAAa,uBAIN;CACL,MAAM,EACJ,WAEA,eAAe,mBACf,WAAW,eACX,OAAO,WACP,WAAW,eAEX,GAAG,sDAC+D;CAEpE,MAAM,uCAA4BC,mCAAe;;;;;;;;;;CAWjD,MAAM,iBAAiB,MAA0B,WAAoB;EACnE,MAAM,YACJ,OAAO,SAAS,WAAW,KAAK,QAAQ,YAAY,GAAG,CAAC,MAAM,IAAI,GAAG;EAIvE,MAAM,qBACJ,gBAAgB,WAAW,gBAC3B,gBAAgB,WAAW;EAG7B,MAAM,WAAW,qBACb,qBAAqB,oBAAoB,UAAU,GACnD;EAEJ,MAAM,QAAQ,0BACZ,gBAAgB,WAAW,UAAU,EAAE,EACvC,KACD;AAKD,SAAO;GACL,GAHiB,kBAAkB,MAAM,UAAU;GAInD;GACA,SAAS,CAAC,CAAC;GACX;GACA,QAAQC,6BAAa,UAAU,KAAK;GACrC;;;;;;;;;;;;;CAcH,MAAM,cAAc,GAAG,SAAgB;AAErC,SAAOC,mCADS,cAAsB,GAAG,KAAK,CACb;;CAGnC,MAAM,UAAU,GAAG,SAAgB;AAEjC,SAAOA,mCADS,UAAkB,GAAG,KAAK,CACT;;CAGnC,MAAM,cAAc,GAAG,SAAgB;EAErC,MAAM,CAAC,WAAW;AAClB,MAAI,SAAS,UAAU;GACrB,MAAM,mBAAmB,QAAQ;AAejC,UAAO,cAdgB;IACrB,GAAG;IACH,WAAW,uBAA4B;AASrC,YAAO,iBAPoB;MACzB,GAAG;MACH,GAAI,mBAAmB,UAAU,EAC/B,QAAQA,mCAAmB,mBAAmB,OAAO,EACtD;MACF,CAE0C;;IAE9C,CACmC;;AAGtC,SAAQ,cAAsB,GAAG,KAAK;;AAGxC,QAAO;EACL,GAAG;EACH,GAAG;EACH;EACA;EACA;EACA;EACA;EACD"}
@@ -1,5 +1,5 @@
1
- import { i as nameToTestId, s as toValidationFormat, t as flatArrayKey } from "./helpers-CCINRgQk.js";
2
- import { n as UniformContext } from "./FormContext-Dl3k1r_k.js";
1
+ import { i as nameToTestId, s as toValidationFormat, t as flatArrayKey } from "./helpers-D3A5d3M1.js";
2
+ import { n as UniformContext } from "./FormContext-DHYlCZ2u.js";
3
3
  import { useContext } from "react";
4
4
  import { useFormContext } from "react-hook-form";
5
5
 
@@ -120,4 +120,4 @@ const useFormContext$1 = () => {
120
120
 
121
121
  //#endregion
122
122
  export { useFormContext$1 as n, checkFieldIsRequired as t };
123
- //# sourceMappingURL=useFormContext-BFoXZNkp.js.map
123
+ //# sourceMappingURL=useFormContext-UFBqUfOr.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useFormContext-BFoXZNkp.js","names":["useFormContext","useHookFormContext"],"sources":["../src/hooks/useFormContext/useFormContext.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport type { VetoFormattedError, VetoInstance } from '@fuf-stack/veto';\nimport type { FieldError, FieldValues, Path } from 'react-hook-form';\n\nimport { useContext } from 'react';\nimport { useFormContext as useHookFormContext } from 'react-hook-form';\n\nimport { UniformContext } from '../../Form/subcomponents/FormContext';\nimport { flatArrayKey, nameToTestId, toValidationFormat } from '../../helpers';\n\n/** Schema check whether a field is required or optional */\nexport const checkFieldIsRequired = (\n validation: VetoInstance,\n path: string[],\n): boolean => {\n // Handle flat array paths: strip the flatArrayKey to check the array element schema\n // e.g., ['arrayField', '0', '__FLAT__'] -> check schema at ['arrayField', '0']\n const checkPath =\n path[path.length - 1] === flatArrayKey ? path.slice(0, -1) : path;\n\n const checkRequired = (schema: any) => {\n // arrays ...\n if (schema.type === 'array') {\n // ... if array is optional or nullable it is not required\n if (schema.isOptional || schema.isNullable) {\n return false;\n }\n // ... otherwise arrays are required (display logic wise -> no asterisk in the label)\n return true;\n }\n\n // all other fields are required if they are\n // not optional and not nullable\n return !schema.isOptional && !schema.isNullable;\n };\n\n return validation.checkSchemaPath(checkRequired, checkPath);\n};\n\n/**\n * Resolve validation errors for a given field path.\n *\n * Traverses a nested `VetoFormattedError` structure using a dotted path\n * (for example: \"user.address.0.street\") and returns the matching\n * `FieldError[]` if present. If no error exists at the path, returns\n * `undefined`.\n *\n * @param errors - The formatted validation errors from Uniform's context\n * @param name - The dotted field path to resolve\n * @returns An array of `FieldError` entries for the field, or `undefined`\n */\nconst getValidationErrorsByName = (\n errors: VetoFormattedError,\n name: string,\n) => {\n // Traverse nested error structure; ignore flat array wrapper key\n const keys = name.split('.').filter((k) => {\n return k !== flatArrayKey;\n });\n let current: unknown = errors as unknown;\n keys.forEach((key) => {\n if (current && typeof current === 'object') {\n current = (current as Record<string, unknown>)[key];\n } else {\n current = undefined;\n }\n });\n return current as FieldError[] | undefined;\n};\n\n/**\n * Custom hook that extends react-hook-form's useFormContext to add validation and state management.\n *\n * Key features:\n * - Enhanced `getFieldState` that includes validation schema-based \"required\" status and testId generation\n * - Automatic conversion of form values via `getValues`, `watch`, and `subscribe`:\n * - Unwraps flat array wrappers (`{ __FLAT__: value }` → `value`)\n * - Converts nullish string markers (`__NULL__` → `null`, `__FALSE__` → `false`, `__ZERO__` → `0`)\n * - Filters out empty/null values\n */\nexport const useFormContext = <\n TFieldValues extends FieldValues = FieldValues,\n TContext = any,\n TTransformedValues = TFieldValues,\n>() => {\n const {\n formState,\n // some methods that will be enhanced below\n getFieldState: getFieldStateOrig,\n getValues: getValuesOrig,\n watch: watchOrig,\n subscribe: subscribeOrig,\n // the rest of the methods pass through unchanged\n ...otherMethods\n } = useHookFormContext<TFieldValues, TContext, TTransformedValues>();\n\n const uniformContext = useContext(UniformContext);\n\n /**\n * Updated getFieldState method which returns:\n * - Whether the field is required by checking the validation schema\n * - Existing field state information (errors, etc.)\n * - A testId generated from the field name (with flat array keys removed and slugified)\n *\n * @param name - The field path (string or array)\n * @param testId - Optional explicit testId. If provided, will be slugified. If not provided, generated from name.\n */\n const getFieldState = (name: Path<TFieldValues>, testId?: string) => {\n const fieldPath =\n typeof name === 'string' ? name.replace(/\\[\\d+\\]/g, '').split('.') : name;\n\n // Use base validation instance for checking \"required\" status\n // Client validation often uses .nullish() which would incorrectly mark fields as optional\n const validationInstance =\n uniformContext?.validation.baseInstance ??\n uniformContext?.validation.instance;\n\n // Check if the field is required using the validation schema\n const required = validationInstance\n ? checkFieldIsRequired(validationInstance, fieldPath)\n : false;\n\n const error = getValidationErrorsByName(\n uniformContext?.validation.errors ?? {},\n name,\n ) as unknown as FieldError[] | undefined;\n\n // Get everything but the error from the original field state\n const fieldState = getFieldStateOrig(name, formState);\n\n return {\n ...fieldState,\n error,\n invalid: !!error,\n required,\n testId: nameToTestId(testId ?? name),\n };\n };\n\n /**\n * Wrap form value accessor methods to automatically convert from internal storage format\n * to component-friendly format:\n *\n * - Unwrap flat array wrappers: `{ __FLAT__: value }` → `value`\n * - Convert nullish string markers: `__NULL__` → `null`, `__FALSE__` → `false`, `__ZERO__` → `0`\n * - Filter out empty/null values: fields with converted null/empty values are removed entirely\n *\n * This ensures components receive clean, predictable data without needing to handle\n * the internal nullish string conversion system or flat array wrapping manually.\n */\n const getValues = ((...args: any[]) => {\n const result = (getValuesOrig as any)(...args);\n return toValidationFormat(result);\n }) as typeof getValuesOrig;\n\n const watch = ((...args: any[]) => {\n const result = (watchOrig as any)(...args);\n return toValidationFormat(result);\n }) as typeof watchOrig;\n\n const subscribe = ((...args: any[]) => {\n // For subscribe, we need to wrap the callback to convert the values property\n const [options] = args;\n if (options?.callback) {\n const originalCallback = options.callback;\n const wrappedOptions = {\n ...options,\n callback: (subscribeFormState: any) => {\n // Convert the values property if it exists\n const convertedFormState = {\n ...subscribeFormState,\n ...(subscribeFormState.values && {\n values: toValidationFormat(subscribeFormState.values),\n }),\n };\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return originalCallback(convertedFormState);\n },\n };\n return subscribeOrig(wrappedOptions);\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return (subscribeOrig as any)(...args);\n }) as typeof subscribeOrig;\n\n return {\n ...otherMethods,\n ...uniformContext,\n formState,\n getFieldState,\n getValues,\n subscribe,\n watch,\n };\n};\n"],"mappings":";;;;;;;AAYA,MAAa,wBACX,YACA,SACY;CAGZ,MAAM,YACJ,KAAK,KAAK,SAAS,OAAO,eAAe,KAAK,MAAM,GAAG,GAAG,GAAG;CAE/D,MAAM,iBAAiB,WAAgB;AAErC,MAAI,OAAO,SAAS,SAAS;AAE3B,OAAI,OAAO,cAAc,OAAO,WAC9B,QAAO;AAGT,UAAO;;AAKT,SAAO,CAAC,OAAO,cAAc,CAAC,OAAO;;AAGvC,QAAO,WAAW,gBAAgB,eAAe,UAAU;;;;;;;;;;;;;;AAe7D,MAAM,6BACJ,QACA,SACG;CAEH,MAAM,OAAO,KAAK,MAAM,IAAI,CAAC,QAAQ,MAAM;AACzC,SAAO,MAAM;GACb;CACF,IAAI,UAAmB;AACvB,MAAK,SAAS,QAAQ;AACpB,MAAI,WAAW,OAAO,YAAY,SAChC,WAAW,QAAoC;MAE/C,WAAU;GAEZ;AACF,QAAO;;;;;;;;;;;;AAaT,MAAaA,yBAIN;CACL,MAAM,EACJ,WAEA,eAAe,mBACf,WAAW,eACX,OAAO,WACP,WAAW,eAEX,GAAG,iBACDC,gBAAgE;CAEpE,MAAM,iBAAiB,WAAW,eAAe;;;;;;;;;;CAWjD,MAAM,iBAAiB,MAA0B,WAAoB;EACnE,MAAM,YACJ,OAAO,SAAS,WAAW,KAAK,QAAQ,YAAY,GAAG,CAAC,MAAM,IAAI,GAAG;EAIvE,MAAM,qBACJ,gBAAgB,WAAW,gBAC3B,gBAAgB,WAAW;EAG7B,MAAM,WAAW,qBACb,qBAAqB,oBAAoB,UAAU,GACnD;EAEJ,MAAM,QAAQ,0BACZ,gBAAgB,WAAW,UAAU,EAAE,EACvC,KACD;AAKD,SAAO;GACL,GAHiB,kBAAkB,MAAM,UAAU;GAInD;GACA,SAAS,CAAC,CAAC;GACX;GACA,QAAQ,aAAa,UAAU,KAAK;GACrC;;;;;;;;;;;;;CAcH,MAAM,cAAc,GAAG,SAAgB;AAErC,SAAO,mBADS,cAAsB,GAAG,KAAK,CACb;;CAGnC,MAAM,UAAU,GAAG,SAAgB;AAEjC,SAAO,mBADS,UAAkB,GAAG,KAAK,CACT;;CAGnC,MAAM,cAAc,GAAG,SAAgB;EAErC,MAAM,CAAC,WAAW;AAClB,MAAI,SAAS,UAAU;GACrB,MAAM,mBAAmB,QAAQ;AAejC,UAAO,cAdgB;IACrB,GAAG;IACH,WAAW,uBAA4B;AASrC,YAAO,iBAPoB;MACzB,GAAG;MACH,GAAI,mBAAmB,UAAU,EAC/B,QAAQ,mBAAmB,mBAAmB,OAAO,EACtD;MACF,CAE0C;;IAE9C,CACmC;;AAGtC,SAAQ,cAAsB,GAAG,KAAK;;AAGxC,QAAO;EACL,GAAG;EACH,GAAG;EACH;EACA;EACA;EACA;EACA;EACD"}
1
+ {"version":3,"file":"useFormContext-UFBqUfOr.js","names":["useFormContext","useHookFormContext"],"sources":["../src/hooks/useFormContext/useFormContext.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport type { VetoFormattedError, VetoInstance } from '@fuf-stack/veto';\nimport type { FieldError, FieldValues, Path } from 'react-hook-form';\n\nimport { useContext } from 'react';\nimport { useFormContext as useHookFormContext } from 'react-hook-form';\n\nimport { UniformContext } from '../../Form/subcomponents/FormContext';\nimport { flatArrayKey, nameToTestId, toValidationFormat } from '../../helpers';\n\n/** Schema check whether a field is required or optional */\nexport const checkFieldIsRequired = (\n validation: VetoInstance,\n path: string[],\n): boolean => {\n // Handle flat array paths: strip the flatArrayKey to check the array element schema\n // e.g., ['arrayField', '0', '__FLAT__'] -> check schema at ['arrayField', '0']\n const checkPath =\n path[path.length - 1] === flatArrayKey ? path.slice(0, -1) : path;\n\n const checkRequired = (schema: any) => {\n // arrays ...\n if (schema.type === 'array') {\n // ... if array is optional or nullable it is not required\n if (schema.isOptional || schema.isNullable) {\n return false;\n }\n // ... otherwise arrays are required (display logic wise -> no asterisk in the label)\n return true;\n }\n\n // all other fields are required if they are\n // not optional and not nullable\n return !schema.isOptional && !schema.isNullable;\n };\n\n return validation.checkSchemaPath(checkRequired, checkPath);\n};\n\n/**\n * Resolve validation errors for a given field path.\n *\n * Traverses a nested `VetoFormattedError` structure using a dotted path\n * (for example: \"user.address.0.street\") and returns the matching\n * `FieldError[]` if present. If no error exists at the path, returns\n * `undefined`.\n *\n * @param errors - The formatted validation errors from Uniform's context\n * @param name - The dotted field path to resolve\n * @returns An array of `FieldError` entries for the field, or `undefined`\n */\nconst getValidationErrorsByName = (\n errors: VetoFormattedError,\n name: string,\n) => {\n // Traverse nested error structure; ignore flat array wrapper key\n const keys = name.split('.').filter((k) => {\n return k !== flatArrayKey;\n });\n let current: unknown = errors as unknown;\n keys.forEach((key) => {\n if (current && typeof current === 'object') {\n current = (current as Record<string, unknown>)[key];\n } else {\n current = undefined;\n }\n });\n return current as FieldError[] | undefined;\n};\n\n/**\n * Custom hook that extends react-hook-form's useFormContext to add validation and state management.\n *\n * Key features:\n * - Enhanced `getFieldState` that includes validation schema-based \"required\" status and testId generation\n * - Automatic conversion of form values via `getValues`, `watch`, and `subscribe`:\n * - Unwraps flat array wrappers (`{ __FLAT__: value }` → `value`)\n * - Converts nullish string markers (`__NULL__` → `null`, `__FALSE__` → `false`, `__ZERO__` → `0`)\n * - Filters out empty/null values\n */\nexport const useFormContext = <\n TFieldValues extends FieldValues = FieldValues,\n TContext = any,\n TTransformedValues = TFieldValues,\n>() => {\n const {\n formState,\n // some methods that will be enhanced below\n getFieldState: getFieldStateOrig,\n getValues: getValuesOrig,\n watch: watchOrig,\n subscribe: subscribeOrig,\n // the rest of the methods pass through unchanged\n ...otherMethods\n } = useHookFormContext<TFieldValues, TContext, TTransformedValues>();\n\n const uniformContext = useContext(UniformContext);\n\n /**\n * Updated getFieldState method which returns:\n * - Whether the field is required by checking the validation schema\n * - Existing field state information (errors, etc.)\n * - A testId generated from the field name (with flat array keys removed and slugified)\n *\n * @param name - The field path (string or array)\n * @param testId - Optional explicit testId. If provided, will be slugified. If not provided, generated from name.\n */\n const getFieldState = (name: Path<TFieldValues>, testId?: string) => {\n const fieldPath =\n typeof name === 'string' ? name.replace(/\\[\\d+\\]/g, '').split('.') : name;\n\n // Use base validation instance for checking \"required\" status\n // Client validation often uses .nullish() which would incorrectly mark fields as optional\n const validationInstance =\n uniformContext?.validation.baseInstance ??\n uniformContext?.validation.instance;\n\n // Check if the field is required using the validation schema\n const required = validationInstance\n ? checkFieldIsRequired(validationInstance, fieldPath)\n : false;\n\n const error = getValidationErrorsByName(\n uniformContext?.validation.errors ?? {},\n name,\n ) as unknown as FieldError[] | undefined;\n\n // Get everything but the error from the original field state\n const fieldState = getFieldStateOrig(name, formState);\n\n return {\n ...fieldState,\n error,\n invalid: !!error,\n required,\n testId: nameToTestId(testId ?? name),\n };\n };\n\n /**\n * Wrap form value accessor methods to automatically convert from internal storage format\n * to component-friendly format:\n *\n * - Unwrap flat array wrappers: `{ __FLAT__: value }` → `value`\n * - Convert nullish string markers: `__NULL__` → `null`, `__FALSE__` → `false`, `__ZERO__` → `0`\n * - Filter out empty/null values: fields with converted null/empty values are removed entirely\n *\n * This ensures components receive clean, predictable data without needing to handle\n * the internal nullish string conversion system or flat array wrapping manually.\n */\n const getValues = ((...args: any[]) => {\n const result = (getValuesOrig as any)(...args);\n return toValidationFormat(result);\n }) as typeof getValuesOrig;\n\n const watch = ((...args: any[]) => {\n const result = (watchOrig as any)(...args);\n return toValidationFormat(result);\n }) as typeof watchOrig;\n\n const subscribe = ((...args: any[]) => {\n // For subscribe, we need to wrap the callback to convert the values property\n const [options] = args;\n if (options?.callback) {\n const originalCallback = options.callback;\n const wrappedOptions = {\n ...options,\n callback: (subscribeFormState: any) => {\n // Convert the values property if it exists\n const convertedFormState = {\n ...subscribeFormState,\n ...(subscribeFormState.values && {\n values: toValidationFormat(subscribeFormState.values),\n }),\n };\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return originalCallback(convertedFormState);\n },\n };\n return subscribeOrig(wrappedOptions);\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return (subscribeOrig as any)(...args);\n }) as typeof subscribeOrig;\n\n return {\n ...otherMethods,\n ...uniformContext,\n formState,\n getFieldState,\n getValues,\n subscribe,\n watch,\n };\n};\n"],"mappings":";;;;;;;AAYA,MAAa,wBACX,YACA,SACY;CAGZ,MAAM,YACJ,KAAK,KAAK,SAAS,OAAO,eAAe,KAAK,MAAM,GAAG,GAAG,GAAG;CAE/D,MAAM,iBAAiB,WAAgB;AAErC,MAAI,OAAO,SAAS,SAAS;AAE3B,OAAI,OAAO,cAAc,OAAO,WAC9B,QAAO;AAGT,UAAO;;AAKT,SAAO,CAAC,OAAO,cAAc,CAAC,OAAO;;AAGvC,QAAO,WAAW,gBAAgB,eAAe,UAAU;;;;;;;;;;;;;;AAe7D,MAAM,6BACJ,QACA,SACG;CAEH,MAAM,OAAO,KAAK,MAAM,IAAI,CAAC,QAAQ,MAAM;AACzC,SAAO,MAAM;GACb;CACF,IAAI,UAAmB;AACvB,MAAK,SAAS,QAAQ;AACpB,MAAI,WAAW,OAAO,YAAY,SAChC,WAAW,QAAoC;MAE/C,WAAU;GAEZ;AACF,QAAO;;;;;;;;;;;;AAaT,MAAaA,yBAIN;CACL,MAAM,EACJ,WAEA,eAAe,mBACf,WAAW,eACX,OAAO,WACP,WAAW,eAEX,GAAG,iBACDC,gBAAgE;CAEpE,MAAM,iBAAiB,WAAW,eAAe;;;;;;;;;;CAWjD,MAAM,iBAAiB,MAA0B,WAAoB;EACnE,MAAM,YACJ,OAAO,SAAS,WAAW,KAAK,QAAQ,YAAY,GAAG,CAAC,MAAM,IAAI,GAAG;EAIvE,MAAM,qBACJ,gBAAgB,WAAW,gBAC3B,gBAAgB,WAAW;EAG7B,MAAM,WAAW,qBACb,qBAAqB,oBAAoB,UAAU,GACnD;EAEJ,MAAM,QAAQ,0BACZ,gBAAgB,WAAW,UAAU,EAAE,EACvC,KACD;AAKD,SAAO;GACL,GAHiB,kBAAkB,MAAM,UAAU;GAInD;GACA,SAAS,CAAC,CAAC;GACX;GACA,QAAQ,aAAa,UAAU,KAAK;GACrC;;;;;;;;;;;;;CAcH,MAAM,cAAc,GAAG,SAAgB;AAErC,SAAO,mBADS,cAAsB,GAAG,KAAK,CACb;;CAGnC,MAAM,UAAU,GAAG,SAAgB;AAEjC,SAAO,mBADS,UAAkB,GAAG,KAAK,CACT;;CAGnC,MAAM,cAAc,GAAG,SAAgB;EAErC,MAAM,CAAC,WAAW;AAClB,MAAI,SAAS,UAAU;GACrB,MAAM,mBAAmB,QAAQ;AAejC,UAAO,cAdgB;IACrB,GAAG;IACH,WAAW,uBAA4B;AASrC,YAAO,iBAPoB;MACzB,GAAG;MACH,GAAI,mBAAmB,UAAU,EAC/B,QAAQ,mBAAmB,mBAAmB,OAAO,EACtD;MACF,CAE0C;;IAE9C,CACmC;;AAGtC,SAAQ,cAAsB,GAAG,KAAK;;AAGxC,QAAO;EACL,GAAG;EACH,GAAG;EACH;EACA;EACA;EACA;EACA;EACD"}