@fuf-stack/uniform 1.18.3 → 1.19.1

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 (422) hide show
  1. package/dist/Checkboxes/index.cjs +7 -5
  2. package/dist/Checkboxes/index.d.cts +1 -1
  3. package/dist/Checkboxes/index.d.ts +1 -1
  4. package/dist/Checkboxes/index.js +2 -3
  5. package/dist/{Checkboxes-BGrK_mwQ.js → Checkboxes-D1hppxDE.js} +7 -10
  6. package/dist/Checkboxes-D1hppxDE.js.map +1 -0
  7. package/dist/{Checkboxes-Dk7yyRVR.cjs → Checkboxes-DegQ22uN.cjs} +18 -21
  8. package/dist/Checkboxes-DegQ22uN.cjs.map +1 -0
  9. package/dist/FieldArray/index.cjs +7 -5
  10. package/dist/FieldArray/index.d.cts +1 -1
  11. package/dist/FieldArray/index.d.ts +1 -1
  12. package/dist/FieldArray/index.js +2 -3
  13. package/dist/{FieldArray-Bs2ViU8m.js → FieldArray-BVL5Tz0Q.js} +51 -71
  14. package/dist/FieldArray-BVL5Tz0Q.js.map +1 -0
  15. package/dist/{FieldArray-C6RHZcKa.cjs → FieldArray-CeiNCobX.cjs} +66 -86
  16. package/dist/FieldArray-CeiNCobX.cjs.map +1 -0
  17. package/dist/FieldCard/index.cjs +4 -4
  18. package/dist/FieldCard/index.d.cts +1 -1
  19. package/dist/FieldCard/index.d.ts +1 -1
  20. package/dist/FieldCard/index.js +2 -3
  21. package/dist/{FieldCard-BxK_IJOR.cjs → FieldCard-C0kNSLj7.cjs} +20 -24
  22. package/dist/FieldCard-C0kNSLj7.cjs.map +1 -0
  23. package/dist/{FieldCard-16yCF83m.js → FieldCard-SjYNs4sL.js} +8 -12
  24. package/dist/FieldCard-SjYNs4sL.js.map +1 -0
  25. package/dist/{FieldCopyTestIdButton-BoEdlzLs.js → FieldCopyTestIdButton-Dpmo0uBV.js} +4 -7
  26. package/dist/FieldCopyTestIdButton-Dpmo0uBV.js.map +1 -0
  27. package/dist/{FieldCopyTestIdButton-4uupFq1U.cjs → FieldCopyTestIdButton-DrUzXwTo.cjs} +14 -17
  28. package/dist/FieldCopyTestIdButton-DrUzXwTo.cjs.map +1 -0
  29. package/dist/{FieldValidationError-Br6iopZj.cjs → FieldValidationError-8H8LxDjk.cjs} +14 -17
  30. package/dist/FieldValidationError-8H8LxDjk.cjs.map +1 -0
  31. package/dist/{FieldValidationError-XQaViV52.js → FieldValidationError-ktTyyyip.js} +4 -7
  32. package/dist/FieldValidationError-ktTyyyip.js.map +1 -0
  33. package/dist/Form/index.cjs +7 -5
  34. package/dist/Form/index.d.cts +1 -1
  35. package/dist/Form/index.d.ts +1 -2
  36. package/dist/Form/index.js +2 -3
  37. package/dist/{Form--SsSvsxl.cjs → Form-Dqa1b7Y7.cjs} +17 -22
  38. package/dist/Form-Dqa1b7Y7.cjs.map +1 -0
  39. package/dist/{Form-ccsEssie.js → Form-Wzy7pBVt.js} +8 -13
  40. package/dist/Form-Wzy7pBVt.js.map +1 -0
  41. package/dist/{FormContext-CCe8drkp.d.ts → FormContext-B4KQxdl7.d.ts} +1 -1
  42. package/dist/{FormContext-CCe8drkp.d.ts.map → FormContext-B4KQxdl7.d.ts.map} +1 -1
  43. package/dist/{FormContext-BSLO2-sO.cjs → FormContext-BrY1FQYR.cjs} +29 -37
  44. package/dist/{FormContext-BSLO2-sO.cjs.map → FormContext-BrY1FQYR.cjs.map} +1 -1
  45. package/dist/{FormContext-RSA21aDt.d.cts → FormContext-BuG3xZFe.d.cts} +1 -1
  46. package/dist/{FormContext-RSA21aDt.d.cts.map → FormContext-BuG3xZFe.d.cts.map} +1 -1
  47. package/dist/{FormContext-kE3YKhp_.js → FormContext-CLfMWHQM.js} +4 -7
  48. package/dist/{FormContext-kE3YKhp_.js.map → FormContext-CLfMWHQM.js.map} +1 -1
  49. package/dist/Grid/index.cjs +7 -5
  50. package/dist/Grid/index.d.cts +1 -1
  51. package/dist/Grid/index.d.ts +1 -1
  52. package/dist/Grid/index.js +2 -3
  53. package/dist/{Grid-BaqBa1ku.js → Grid-Bzyi97Cx.js} +4 -7
  54. package/dist/Grid-Bzyi97Cx.js.map +1 -0
  55. package/dist/{Grid-D5Yf0nD_.cjs → Grid-DdYQQ_UM.cjs} +14 -17
  56. package/dist/Grid-DdYQQ_UM.cjs.map +1 -0
  57. package/dist/Input/index.cjs +7 -5
  58. package/dist/Input/index.d.cts +1 -1
  59. package/dist/Input/index.d.ts +1 -1
  60. package/dist/Input/index.js +2 -3
  61. package/dist/{Input-BCs_eyJ9.js → Input-BDWP4hOr.js} +6 -9
  62. package/dist/{Input-BCs_eyJ9.js.map → Input-BDWP4hOr.js.map} +1 -1
  63. package/dist/{Input-B3p_4ntD.cjs → Input-BXJ4DSha.cjs} +18 -21
  64. package/dist/Input-BXJ4DSha.cjs.map +1 -0
  65. package/dist/RadioBoxes/index.cjs +7 -5
  66. package/dist/RadioBoxes/index.d.cts +1 -1
  67. package/dist/RadioBoxes/index.d.ts +1 -1
  68. package/dist/RadioBoxes/index.js +2 -3
  69. package/dist/{RadioBoxes-C3Cwrn2I.js → RadioBoxes-BR3X986V.js} +16 -23
  70. package/dist/RadioBoxes-BR3X986V.js.map +1 -0
  71. package/dist/{RadioBoxes-xRvNe5U8.cjs → RadioBoxes-Cim3InDW.cjs} +33 -40
  72. package/dist/RadioBoxes-Cim3InDW.cjs.map +1 -0
  73. package/dist/RadioTabs/index.cjs +7 -5
  74. package/dist/RadioTabs/index.d.cts +1 -1
  75. package/dist/RadioTabs/index.d.ts +1 -1
  76. package/dist/RadioTabs/index.js +2 -3
  77. package/dist/{RadioTabs-DfOGIsEf.js → RadioTabs-CsVqYCE9.js} +6 -9
  78. package/dist/RadioTabs-CsVqYCE9.js.map +1 -0
  79. package/dist/{RadioTabs-BaHvYcd-.cjs → RadioTabs-t-x2XnuI.cjs} +18 -21
  80. package/dist/RadioTabs-t-x2XnuI.cjs.map +1 -0
  81. package/dist/Radios/index.cjs +7 -5
  82. package/dist/Radios/index.d.cts +1 -1
  83. package/dist/Radios/index.d.ts +1 -1
  84. package/dist/Radios/index.js +2 -3
  85. package/dist/{Radios-xM-09vB5.js → Radios-CYwW3bZa.js} +13 -19
  86. package/dist/Radios-CYwW3bZa.js.map +1 -0
  87. package/dist/{Radios-BfA3uL35.cjs → Radios-CjEFdyD6.cjs} +25 -31
  88. package/dist/Radios-CjEFdyD6.cjs.map +1 -0
  89. package/dist/Select/index.cjs +7 -5
  90. package/dist/Select/index.d.cts +1 -1
  91. package/dist/Select/index.d.ts +1 -1
  92. package/dist/Select/index.js +2 -3
  93. package/dist/{Select-DH_YaruM.cjs → Select-BEed8xan.cjs} +23 -28
  94. package/dist/Select-BEed8xan.cjs.map +1 -0
  95. package/dist/{Select-DlEUzYl6.js → Select-BILyyM7Z.js} +9 -14
  96. package/dist/Select-BILyyM7Z.js.map +1 -0
  97. package/dist/Slider/index.cjs +7 -5
  98. package/dist/Slider/index.d.cts +1 -1
  99. package/dist/Slider/index.d.ts +1 -1
  100. package/dist/Slider/index.js +2 -3
  101. package/dist/{Slider-C-dMrJZ6.cjs → Slider-CFYP86ku.cjs} +16 -19
  102. package/dist/Slider-CFYP86ku.cjs.map +1 -0
  103. package/dist/{Slider-CTFuVrp2.js → Slider-DxRcLu-j.js} +5 -8
  104. package/dist/{Slider-CTFuVrp2.js.map → Slider-DxRcLu-j.js.map} +1 -1
  105. package/dist/SubmitButton/index.cjs +7 -5
  106. package/dist/SubmitButton/index.d.cts +1 -1
  107. package/dist/SubmitButton/index.d.ts +1 -1
  108. package/dist/SubmitButton/index.js +2 -3
  109. package/dist/{SubmitButton-Bh1RN0F1.js → SubmitButton-Bu3NNFyt.js} +5 -8
  110. package/dist/SubmitButton-Bu3NNFyt.js.map +1 -0
  111. package/dist/{SubmitButton-CJ6s1mZr.cjs → SubmitButton-D7xacDyS.cjs} +15 -18
  112. package/dist/SubmitButton-D7xacDyS.cjs.map +1 -0
  113. package/dist/Switch/index.cjs +7 -5
  114. package/dist/Switch/index.d.cts +1 -1
  115. package/dist/Switch/index.d.ts +1 -1
  116. package/dist/Switch/index.js +2 -3
  117. package/dist/{Switch-CXrz-M3V.js → Switch-CMpXZdLc.js} +5 -8
  118. package/dist/{Switch-CXrz-M3V.js.map → Switch-CMpXZdLc.js.map} +1 -1
  119. package/dist/{Switch-CeUMwheZ.cjs → Switch-Dt9TGQ8d.cjs} +16 -19
  120. package/dist/Switch-Dt9TGQ8d.cjs.map +1 -0
  121. package/dist/SwitchBox/index.cjs +7 -5
  122. package/dist/SwitchBox/index.d.cts +1 -1
  123. package/dist/SwitchBox/index.d.ts +1 -1
  124. package/dist/SwitchBox/index.js +2 -3
  125. package/dist/{SwitchBox-C-aLl2nX.js → SwitchBox-Cg7NPfp_.js} +5 -8
  126. package/dist/SwitchBox-Cg7NPfp_.js.map +1 -0
  127. package/dist/{SwitchBox-mGUPvJE0.cjs → SwitchBox-DMPp_Ed-.cjs} +21 -24
  128. package/dist/SwitchBox-DMPp_Ed-.cjs.map +1 -0
  129. package/dist/TextArea/index.cjs +7 -5
  130. package/dist/TextArea/index.d.cts +1 -1
  131. package/dist/TextArea/index.d.ts +1 -1
  132. package/dist/TextArea/index.js +2 -3
  133. package/dist/{TextArea-BLkVYmHZ.js → TextArea-Bxi2pXvY.js} +6 -9
  134. package/dist/TextArea-Bxi2pXvY.js.map +1 -0
  135. package/dist/{TextArea-BYEuk4Ng.cjs → TextArea-DDwzXW-y.cjs} +18 -21
  136. package/dist/TextArea-DDwzXW-y.cjs.map +1 -0
  137. package/dist/helpers/index.cjs +397 -10
  138. package/dist/helpers/index.cjs.map +1 -0
  139. package/dist/helpers/index.d.cts +224 -2
  140. package/dist/helpers/index.d.cts.map +1 -0
  141. package/dist/helpers/index.d.ts +224 -2
  142. package/dist/helpers/index.d.ts.map +1 -0
  143. package/dist/helpers/index.js +387 -2
  144. package/dist/helpers/index.js.map +1 -0
  145. package/dist/hooks/useClientValidation/index.cjs +3 -3
  146. package/dist/hooks/useClientValidation/index.d.cts +1 -1
  147. package/dist/hooks/useClientValidation/index.d.ts +1 -1
  148. package/dist/hooks/useClientValidation/index.js +2 -3
  149. package/dist/hooks/useController/index.cjs +3 -3
  150. package/dist/hooks/useController/index.d.cts +1 -1
  151. package/dist/hooks/useController/index.d.ts +1 -1
  152. package/dist/hooks/useController/index.js +2 -3
  153. package/dist/hooks/useFormContext/index.cjs +8 -3
  154. package/dist/hooks/useFormContext/index.cjs.map +1 -0
  155. package/dist/hooks/useFormContext/index.d.cts +1 -1
  156. package/dist/hooks/useFormContext/index.d.ts +1 -3
  157. package/dist/hooks/useFormContext/index.js +6 -2
  158. package/dist/hooks/useFormContext/index.js.map +1 -0
  159. package/dist/hooks/useInput/index.cjs +8 -8
  160. package/dist/hooks/useInput/index.d.cts +1 -1
  161. package/dist/hooks/useInput/index.d.ts +1 -1
  162. package/dist/hooks/useInput/index.js +2 -3
  163. package/dist/hooks/useInputValueDebounce/index.cjs +92 -2
  164. package/dist/hooks/useInputValueDebounce/index.cjs.map +1 -0
  165. package/dist/hooks/useInputValueDebounce/index.d.cts +1 -1
  166. package/dist/hooks/useInputValueDebounce/index.d.ts +1 -1
  167. package/dist/hooks/useInputValueDebounce/index.js +90 -2
  168. package/dist/hooks/useInputValueDebounce/index.js.map +1 -0
  169. package/dist/hooks/useInputValueTransform/index.cjs +3 -3
  170. package/dist/hooks/useInputValueTransform/index.d.cts +1 -1
  171. package/dist/hooks/useInputValueTransform/index.d.ts +1 -1
  172. package/dist/hooks/useInputValueTransform/index.js +2 -3
  173. package/dist/hooks/useUniformField/index.cjs +135 -2
  174. package/dist/hooks/useUniformField/index.cjs.map +1 -0
  175. package/dist/hooks/useUniformField/index.d.cts +1 -1
  176. package/dist/hooks/useUniformField/index.d.ts +1 -5
  177. package/dist/hooks/useUniformField/index.js +132 -2
  178. package/dist/hooks/useUniformField/index.js.map +1 -0
  179. package/dist/hooks/useUniformFieldArray/index.cjs +83 -2
  180. package/dist/hooks/useUniformFieldArray/index.cjs.map +1 -0
  181. package/dist/hooks/useUniformFieldArray/index.d.cts +1 -1
  182. package/dist/hooks/useUniformFieldArray/index.d.ts +1 -26
  183. package/dist/hooks/useUniformFieldArray/index.js +81 -2
  184. package/dist/hooks/useUniformFieldArray/index.js.map +1 -0
  185. package/dist/hooks/useWatchUserChange/index.cjs +3 -3
  186. package/dist/hooks/useWatchUserChange/index.d.cts +1 -1
  187. package/dist/hooks/useWatchUserChange/index.d.ts +1 -1
  188. package/dist/hooks/useWatchUserChange/index.js +2 -3
  189. package/dist/{index-TmijvCD0.d.ts → index-25CYKzg4.d.cts} +22 -22
  190. package/dist/index-25CYKzg4.d.cts.map +1 -0
  191. package/dist/{index-CeiIXmAI.d.cts → index-3e3711-8.d.cts} +36 -36
  192. package/dist/index-3e3711-8.d.cts.map +1 -0
  193. package/dist/{index-E6etS7_8.d.ts → index-6hu79Fof.d.ts} +34 -34
  194. package/dist/index-6hu79Fof.d.ts.map +1 -0
  195. package/dist/index-AmOFlE3L.d.cts +278 -0
  196. package/dist/index-AmOFlE3L.d.cts.map +1 -0
  197. package/dist/{index-wwmQClW-.d.cts → index-B-6CMF1H.d.ts} +21 -21
  198. package/dist/index-B-6CMF1H.d.ts.map +1 -0
  199. package/dist/{index-ahxY6Q0X.d.cts → index-B6WwxkLx2.d.ts} +3 -3
  200. package/dist/index-B6WwxkLx2.d.ts.map +1 -0
  201. package/dist/{index-BlJFGN_o.d.ts → index-B9lVf5LI.d.ts} +48 -48
  202. package/dist/index-B9lVf5LI.d.ts.map +1 -0
  203. package/dist/{index-ttNINAv3.d.ts → index-BV1VKQdy.d.cts} +3 -3
  204. package/dist/{index-qo0Ta_R3.d.cts.map → index-BV1VKQdy.d.cts.map} +1 -1
  205. package/dist/{index-C1-F9Ga-.d.cts → index-BdYKQ59a.d.cts} +7 -7
  206. package/dist/index-BdYKQ59a.d.cts.map +1 -0
  207. package/dist/{index-Bl1Adhfx.d.ts → index-BwAI1VFS.d.ts} +6 -6
  208. package/dist/index-BwAI1VFS.d.ts.map +1 -0
  209. package/dist/{index-BsCPUK2g.d.cts → index-BzIB-MQg.d.cts} +48 -48
  210. package/dist/index-BzIB-MQg.d.cts.map +1 -0
  211. package/dist/{index-DFzyOxvt.d.cts → index-C-DiLZRu.d.cts} +6 -6
  212. package/dist/index-C-DiLZRu.d.cts.map +1 -0
  213. package/dist/{index-BKQc5PQn.d.cts → index-C9up4f3f.d.cts} +34 -34
  214. package/dist/index-C9up4f3f.d.cts.map +1 -0
  215. package/dist/{index-Dty4h2eA.d.ts → index-CE0aQlFw.d.ts} +7 -7
  216. package/dist/index-CE0aQlFw.d.ts.map +1 -0
  217. package/dist/{index-BrMk3Wee.d.ts → index-CY2Mpaz3.d.cts} +4 -4
  218. package/dist/index-CY2Mpaz3.d.cts.map +1 -0
  219. package/dist/index-CuRn5Thx.d.ts +278 -0
  220. package/dist/index-CuRn5Thx.d.ts.map +1 -0
  221. package/dist/{index-qo0Ta_R3.d.cts → index-Cv4ERj3i.d.ts} +3 -3
  222. package/dist/{index-ttNINAv3.d.ts.map → index-Cv4ERj3i.d.ts.map} +1 -1
  223. package/dist/{index-ByyEP8UR.d.cts → index-D6XwSwTP.d.cts} +6 -6
  224. package/dist/{index-ByyEP8UR.d.cts.map → index-D6XwSwTP.d.cts.map} +1 -1
  225. package/dist/{index-Dr06SNZN.d.cts → index-DD_RPe91.d.ts} +4 -4
  226. package/dist/index-DD_RPe91.d.ts.map +1 -0
  227. package/dist/{index-DLR8z1lG.d.cts → index-DFWSHdua.d.ts} +3 -3
  228. package/dist/{index-CPkTYivq.d.ts.map → index-DFWSHdua.d.ts.map} +1 -1
  229. package/dist/{index-B0rp5NJy.d.cts → index-DMwNV_Br.d.cts} +35 -36
  230. package/dist/index-DMwNV_Br.d.cts.map +1 -0
  231. package/dist/index-DeEmP3Jc.d.cts +1 -0
  232. package/dist/{index-mmk9VKYu.d.ts → index-DiD7s23-.d.cts} +21 -21
  233. package/dist/index-DiD7s23-.d.cts.map +1 -0
  234. package/dist/{index--NM5Ctp6.d.ts → index-Dj3NDj0T.d.ts} +4 -4
  235. package/dist/{index--NM5Ctp6.d.ts.map → index-Dj3NDj0T.d.ts.map} +1 -1
  236. package/dist/{index-CPkTYivq.d.ts → index-DkiQkdCW.d.cts} +3 -3
  237. package/dist/{index-DLR8z1lG.d.cts.map → index-DkiQkdCW.d.cts.map} +1 -1
  238. package/dist/{index-CI0AWMsR.d.ts → index-DkxqHE_P2.d.ts} +3 -3
  239. package/dist/{index-B7Xz_OY2.d.cts.map → index-DkxqHE_P2.d.ts.map} +1 -1
  240. package/dist/{index-B7Xz_OY2.d.cts → index-Dld6NP_K.d.cts} +3 -3
  241. package/dist/index-Dld6NP_K.d.cts.map +1 -0
  242. package/dist/{index-CZq5eXSP.d.ts → index-DlebotZ4.d.ts} +36 -36
  243. package/dist/index-DlebotZ4.d.ts.map +1 -0
  244. package/dist/index-DsC0y6kU.d.cts +70 -0
  245. package/dist/index-DsC0y6kU.d.cts.map +1 -0
  246. package/dist/index-DwqOejxR.d.ts +70 -0
  247. package/dist/index-DwqOejxR.d.ts.map +1 -0
  248. package/dist/{index-BaxXDaOZ.d.ts → index-Gs3zrYoY.d.ts} +35 -37
  249. package/dist/index-Gs3zrYoY.d.ts.map +1 -0
  250. package/dist/{index-BlX_mF6D.d.cts → index-N5wvPOq3.d.ts} +22 -22
  251. package/dist/index-N5wvPOq3.d.ts.map +1 -0
  252. package/dist/{index-BNYtqtXt.d.cts → index-NjKV8LJD.d.cts} +4 -4
  253. package/dist/{index-BNYtqtXt.d.cts.map → index-NjKV8LJD.d.cts.map} +1 -1
  254. package/dist/{index-DVZCz730.d.ts → index-fgARdsoB.d.ts} +6 -6
  255. package/dist/{index-DVZCz730.d.ts.map → index-fgARdsoB.d.ts.map} +1 -1
  256. package/dist/{index-CMehV9mc.d.ts → index-jCfJAgDc.d.cts} +3 -3
  257. package/dist/index-jCfJAgDc.d.cts.map +1 -0
  258. package/dist/{index--KhDRPu3.d.cts → index-pwXVq8hR.d.cts} +6 -6
  259. package/dist/index-pwXVq8hR.d.cts.map +1 -0
  260. package/dist/index-sQecLSpR.d.cts +1 -0
  261. package/dist/{index-BgyvEfYZ.d.ts → index-wV1E_PkS.d.ts} +6 -6
  262. package/dist/index-wV1E_PkS.d.ts.map +1 -0
  263. package/dist/index.cjs +63 -63
  264. package/dist/index.d.cts +27 -27
  265. package/dist/index.d.ts +27 -29
  266. package/dist/index.js +29 -30
  267. package/dist/partials/FieldCopyTestIdButton/index.cjs +7 -5
  268. package/dist/partials/FieldCopyTestIdButton/index.d.cts +1 -1
  269. package/dist/partials/FieldCopyTestIdButton/index.d.ts +1 -1
  270. package/dist/partials/FieldCopyTestIdButton/index.js +2 -3
  271. package/dist/partials/FieldValidationError/index.cjs +7 -5
  272. package/dist/partials/FieldValidationError/index.d.cts +1 -1
  273. package/dist/partials/FieldValidationError/index.d.ts +1 -1
  274. package/dist/partials/FieldValidationError/index.js +2 -3
  275. package/dist/{useClientValidation-B4xrGBJZ.d.ts → useClientValidation-BWElhQ91.d.ts} +2 -3
  276. package/dist/useClientValidation-BWElhQ91.d.ts.map +1 -0
  277. package/dist/{useClientValidation-DksyV18M.js → useClientValidation-Dn_kJkE5.js} +5 -6
  278. package/dist/{useClientValidation-DksyV18M.js.map → useClientValidation-Dn_kJkE5.js.map} +1 -1
  279. package/dist/{useClientValidation-B_dYQB5o.d.cts → useClientValidation-DtnfCE5T.d.cts} +2 -3
  280. package/dist/{useClientValidation-B4xrGBJZ.d.ts.map → useClientValidation-DtnfCE5T.d.cts.map} +1 -1
  281. package/dist/{useClientValidation-Dnj_wuwf.cjs → useClientValidation-NKOuXuHV.cjs} +16 -17
  282. package/dist/useClientValidation-NKOuXuHV.cjs.map +1 -0
  283. package/dist/{useController-NjuthTyL.js → useController-B-6PzFna.js} +4 -5
  284. package/dist/{useController-NjuthTyL.js.map → useController-B-6PzFna.js.map} +1 -1
  285. package/dist/{useController-D8MEXnmB.d.cts → useController-CNiqy_2D.d.cts} +1 -1
  286. package/dist/{useController-D8MEXnmB.d.cts.map → useController-CNiqy_2D.d.cts.map} +1 -1
  287. package/dist/{useController-CHOpoCoz.d.ts → useController-Cc0UNQMm.d.ts} +1 -1
  288. package/dist/{useController-CHOpoCoz.d.ts.map → useController-Cc0UNQMm.d.ts.map} +1 -1
  289. package/dist/{useController-B_SSp5Z5.cjs → useController-DVRh86Zy.cjs} +11 -12
  290. package/dist/{useController-B_SSp5Z5.cjs.map → useController-DVRh86Zy.cjs.map} +1 -1
  291. package/dist/{useFormContext-vdeeDsAs.cjs → useFormContext-Bum4VP1o.cjs} +20 -21
  292. package/dist/{useFormContext-vdeeDsAs.cjs.map → useFormContext-Bum4VP1o.cjs.map} +1 -1
  293. package/dist/{useFormContext-Di67HIf7.js → useFormContext-Bzpyonu6.js} +5 -6
  294. package/dist/{useFormContext-Di67HIf7.js.map → useFormContext-Bzpyonu6.js.map} +1 -1
  295. package/dist/{useFormContext-C6OOtqZ5.d.ts → useFormContext-DEMm-bsc.d.ts} +22 -22
  296. package/dist/useFormContext-DEMm-bsc.d.ts.map +1 -0
  297. package/dist/{useFormContext-Dh97YG47.d.cts → useFormContext-Dey5DbWr.d.cts} +22 -22
  298. package/dist/useFormContext-Dey5DbWr.d.cts.map +1 -0
  299. package/dist/{useInput-BWzvIUpW.js → useInput-CVm3tP78.js} +1 -2
  300. package/dist/{useInputValueDebounce-ZLyAmuXV.d.cts → useInputValueDebounce-puGRVJ6t.d.cts} +1 -1
  301. package/dist/{useInputValueDebounce-ZLyAmuXV.d.cts.map → useInputValueDebounce-puGRVJ6t.d.cts.map} +1 -1
  302. package/dist/{useInputValueDebounce-Dhlv1NUY.d.ts → useInputValueDebounce-sFOlecIQ.d.ts} +1 -1
  303. package/dist/{useInputValueDebounce-Dhlv1NUY.d.ts.map → useInputValueDebounce-sFOlecIQ.d.ts.map} +1 -1
  304. package/dist/{useInputValueTransform-CNCBU7a9.d.cts → useInputValueTransform-BwAfw8Xb.d.cts} +1 -1
  305. package/dist/{useInputValueTransform-CNCBU7a9.d.cts.map → useInputValueTransform-BwAfw8Xb.d.cts.map} +1 -1
  306. package/dist/{useInputValueTransform-C-fmz3ke.js → useInputValueTransform-CXdmtc0Q.js} +2 -3
  307. package/dist/{useInputValueTransform-C-fmz3ke.js.map → useInputValueTransform-CXdmtc0Q.js.map} +1 -1
  308. package/dist/{useInputValueTransform-tsMNM7g_.d.ts → useInputValueTransform-CdoaxNyD.d.ts} +1 -1
  309. package/dist/{useInputValueTransform-tsMNM7g_.d.ts.map → useInputValueTransform-CdoaxNyD.d.ts.map} +1 -1
  310. package/dist/{useInputValueTransform-BBRvvhDe.cjs → useInputValueTransform-DKH-7F9D.cjs} +8 -9
  311. package/dist/{useInputValueTransform-BBRvvhDe.cjs.map → useInputValueTransform-DKH-7F9D.cjs.map} +1 -1
  312. package/dist/{useUniformField-Bd_oDkYE.d.cts → useUniformField-DB8jF52F.d.cts} +5 -5
  313. package/dist/{useUniformField-Bd_oDkYE.d.cts.map → useUniformField-DB8jF52F.d.cts.map} +1 -1
  314. package/dist/{useUniformField-BDKjYBKu.d.ts → useUniformField-iHk8xYXN.d.ts} +5 -5
  315. package/dist/{useUniformField-BDKjYBKu.d.ts.map → useUniformField-iHk8xYXN.d.ts.map} +1 -1
  316. package/dist/{useUniformFieldArray-lV3Nbum2.d.ts → useUniformFieldArray-B0SPtHeT.d.ts} +18 -18
  317. package/dist/useUniformFieldArray-B0SPtHeT.d.ts.map +1 -0
  318. package/dist/{useUniformFieldArray-CWiaXKO6.d.cts → useUniformFieldArray-okvikMJp.d.cts} +18 -18
  319. package/dist/useUniformFieldArray-okvikMJp.d.cts.map +1 -0
  320. package/dist/{useWatchUserChange-C1Kluht2.cjs → useWatchUserChange-CBuIa5kU.cjs} +9 -10
  321. package/dist/{useWatchUserChange-C1Kluht2.cjs.map → useWatchUserChange-CBuIa5kU.cjs.map} +1 -1
  322. package/dist/{useWatchUserChange-BnnrFjyq.d.ts → useWatchUserChange-CH4x16_r.d.ts} +1 -1
  323. package/dist/{useWatchUserChange-BnnrFjyq.d.ts.map → useWatchUserChange-CH4x16_r.d.ts.map} +1 -1
  324. package/dist/{useWatchUserChange-Dj9Imxfi.js → useWatchUserChange-CLgLc5W4.js} +3 -4
  325. package/dist/{useWatchUserChange-Dj9Imxfi.js.map → useWatchUserChange-CLgLc5W4.js.map} +1 -1
  326. package/dist/{useWatchUserChange-DalJOKBC.d.cts → useWatchUserChange-CZu_ZZ38.d.cts} +1 -1
  327. package/dist/{useWatchUserChange-DalJOKBC.d.cts.map → useWatchUserChange-CZu_ZZ38.d.cts.map} +1 -1
  328. package/package.json +74 -70
  329. package/dist/Checkboxes-BGrK_mwQ.js.map +0 -1
  330. package/dist/Checkboxes-Dk7yyRVR.cjs.map +0 -1
  331. package/dist/FieldArray-Bs2ViU8m.js.map +0 -1
  332. package/dist/FieldArray-C6RHZcKa.cjs.map +0 -1
  333. package/dist/FieldCard-16yCF83m.js.map +0 -1
  334. package/dist/FieldCard-BxK_IJOR.cjs.map +0 -1
  335. package/dist/FieldCopyTestIdButton-4uupFq1U.cjs.map +0 -1
  336. package/dist/FieldCopyTestIdButton-BoEdlzLs.js.map +0 -1
  337. package/dist/FieldValidationError-Br6iopZj.cjs.map +0 -1
  338. package/dist/FieldValidationError-XQaViV52.js.map +0 -1
  339. package/dist/Form--SsSvsxl.cjs.map +0 -1
  340. package/dist/Form-ccsEssie.js.map +0 -1
  341. package/dist/Grid-BaqBa1ku.js.map +0 -1
  342. package/dist/Grid-D5Yf0nD_.cjs.map +0 -1
  343. package/dist/Input-B3p_4ntD.cjs.map +0 -1
  344. package/dist/RadioBoxes-C3Cwrn2I.js.map +0 -1
  345. package/dist/RadioBoxes-xRvNe5U8.cjs.map +0 -1
  346. package/dist/RadioTabs-BaHvYcd-.cjs.map +0 -1
  347. package/dist/RadioTabs-DfOGIsEf.js.map +0 -1
  348. package/dist/Radios-BfA3uL35.cjs.map +0 -1
  349. package/dist/Radios-xM-09vB5.js.map +0 -1
  350. package/dist/Select-DH_YaruM.cjs.map +0 -1
  351. package/dist/Select-DlEUzYl6.js.map +0 -1
  352. package/dist/Slider-C-dMrJZ6.cjs.map +0 -1
  353. package/dist/SubmitButton-Bh1RN0F1.js.map +0 -1
  354. package/dist/SubmitButton-CJ6s1mZr.cjs.map +0 -1
  355. package/dist/Switch-CeUMwheZ.cjs.map +0 -1
  356. package/dist/SwitchBox-C-aLl2nX.js.map +0 -1
  357. package/dist/SwitchBox-mGUPvJE0.cjs.map +0 -1
  358. package/dist/TextArea-BLkVYmHZ.js.map +0 -1
  359. package/dist/TextArea-BYEuk4Ng.cjs.map +0 -1
  360. package/dist/helpers-33jajRcN.js +0 -390
  361. package/dist/helpers-33jajRcN.js.map +0 -1
  362. package/dist/helpers-Bd_QpqXg.cjs +0 -444
  363. package/dist/helpers-Bd_QpqXg.cjs.map +0 -1
  364. package/dist/index--KhDRPu3.d.cts.map +0 -1
  365. package/dist/index-B0rp5NJy.d.cts.map +0 -1
  366. package/dist/index-BBw9RSKy.d.ts +0 -278
  367. package/dist/index-BBw9RSKy.d.ts.map +0 -1
  368. package/dist/index-BKQc5PQn.d.cts.map +0 -1
  369. package/dist/index-BLgXFM85.d.cts +0 -224
  370. package/dist/index-BLgXFM85.d.cts.map +0 -1
  371. package/dist/index-BaxXDaOZ.d.ts.map +0 -1
  372. package/dist/index-BgyvEfYZ.d.ts.map +0 -1
  373. package/dist/index-BjHnNRSC.d.cts +0 -278
  374. package/dist/index-BjHnNRSC.d.cts.map +0 -1
  375. package/dist/index-Bl1Adhfx.d.ts.map +0 -1
  376. package/dist/index-BlJFGN_o.d.ts.map +0 -1
  377. package/dist/index-BlX_mF6D.d.cts.map +0 -1
  378. package/dist/index-BrMk3Wee.d.ts.map +0 -1
  379. package/dist/index-BsCPUK2g.d.cts.map +0 -1
  380. package/dist/index-C1-F9Ga-.d.cts.map +0 -1
  381. package/dist/index-CI0AWMsR.d.ts.map +0 -1
  382. package/dist/index-CMehV9mc.d.ts.map +0 -1
  383. package/dist/index-CZq5eXSP.d.ts.map +0 -1
  384. package/dist/index-CeiIXmAI.d.cts.map +0 -1
  385. package/dist/index-DFzyOxvt.d.cts.map +0 -1
  386. package/dist/index-Dr06SNZN.d.cts.map +0 -1
  387. package/dist/index-Dty4h2eA.d.ts.map +0 -1
  388. package/dist/index-E6etS7_8.d.ts.map +0 -1
  389. package/dist/index-TmijvCD0.d.ts.map +0 -1
  390. package/dist/index-ahxY6Q0X.d.cts.map +0 -1
  391. package/dist/index-mmk9VKYu.d.ts.map +0 -1
  392. package/dist/index-w8E8Koak.d.ts +0 -224
  393. package/dist/index-w8E8Koak.d.ts.map +0 -1
  394. package/dist/index-wwmQClW-.d.cts.map +0 -1
  395. package/dist/useClientValidation-B_dYQB5o.d.cts.map +0 -1
  396. package/dist/useClientValidation-Dnj_wuwf.cjs.map +0 -1
  397. package/dist/useFormContext-C6OOtqZ5.d.ts.map +0 -1
  398. package/dist/useFormContext-CLymm_7t.js +0 -6
  399. package/dist/useFormContext-CLymm_7t.js.map +0 -1
  400. package/dist/useFormContext-CkeSOfWD.cjs +0 -6
  401. package/dist/useFormContext-CkeSOfWD.cjs.map +0 -1
  402. package/dist/useFormContext-Dh97YG47.d.cts.map +0 -1
  403. package/dist/useInputValueDebounce-CRaM7HEM.cjs +0 -99
  404. package/dist/useInputValueDebounce-CRaM7HEM.cjs.map +0 -1
  405. package/dist/useInputValueDebounce-DJO5uzLb.js +0 -93
  406. package/dist/useInputValueDebounce-DJO5uzLb.js.map +0 -1
  407. package/dist/useUniformField-6c4OCAfb.cjs +0 -142
  408. package/dist/useUniformField-6c4OCAfb.cjs.map +0 -1
  409. package/dist/useUniformField-C-Xyu-8v.js +0 -135
  410. package/dist/useUniformField-C-Xyu-8v.js.map +0 -1
  411. package/dist/useUniformFieldArray-BKvA0FQW.js +0 -84
  412. package/dist/useUniformFieldArray-BKvA0FQW.js.map +0 -1
  413. package/dist/useUniformFieldArray-CRCbV1J2.cjs +0 -90
  414. package/dist/useUniformFieldArray-CRCbV1J2.cjs.map +0 -1
  415. package/dist/useUniformFieldArray-CWiaXKO6.d.cts.map +0 -1
  416. package/dist/useUniformFieldArray-lV3Nbum2.d.ts.map +0 -1
  417. /package/dist/{index-BMCcWGYS.d.ts → index--okzibnx.d.ts} +0 -0
  418. /package/dist/{index-C8k_zgEm.d.cts → index-B2TCFhpj.d.ts} +0 -0
  419. /package/dist/{index-DDRpa5CJ.d.cts → index-BtBZHVmz.d.cts} +0 -0
  420. /package/dist/{index-GGHuYh77.d.ts → index-CI4LJief.d.ts} +0 -0
  421. /package/dist/{useInput-BVZvtfNg.d.ts → useInput-93TCCrkB.d.cts} +0 -0
  422. /package/dist/{useInput-CKmKH9Ij.d.cts → useInput-C_fY--wx.d.ts} +0 -0
@@ -1,99 +0,0 @@
1
- const require_FormContext = require('./FormContext-BSLO2-sO.cjs');
2
- const require_useFormContext = require('./useFormContext-vdeeDsAs.cjs');
3
- let react = require("react");
4
-
5
- //#region src/hooks/useInputValueDebounce/useInputValueDebounce.ts
6
- /**
7
- * Custom hook for debouncing value changes with immediate blur support.
8
- *
9
- * Provides immediate visual feedback by updating the value instantly,
10
- * while debouncing the actual onChange calls. When focus is lost,
11
- * any pending debounced changes are immediately flushed.
12
- *
13
- * **Key Features:**
14
- * - **Debouncing**: Delays onChange calls until user stops typing
15
- * - **Generic type support**: Works with any data type (strings, numbers, arrays, objects)
16
- * - **Immediate value updates**: UI stays responsive during debouncing
17
- * - **Blur flushing**: Immediately applies pending changes on blur
18
- *
19
- * **Note:** Value transformations should be handled at the `useUniformField` level,
20
- * not in this hook. This hook only handles debouncing timing.
21
- *
22
- * @param options Configuration for debounced value handling
23
- * @param options.debounceDelay Delay in milliseconds (default: 300)
24
- * @param options.onBlur Function to call after flushing debounced value
25
- * @param options.onChange Function to call with debounced value
26
- * @param options.value The field value
27
- * @returns Object containing enhanced onChange, onBlur, and immediate value
28
- *
29
- * @example
30
- * Basic usage with debouncing:
31
- * ```tsx
32
- * const { onChange, onBlur, value } = useInputValueDebounce({
33
- * debounceDelay: 300,
34
- * name: 'fieldName',
35
- * onBlur: field.onBlur,
36
- * onChange: field.onChange,
37
- * value: field.value,
38
- * });
39
- * ```
40
- */
41
- const useInputValueDebounce = ({ debounceDelay = 300, name, onBlur, onChange, value }) => {
42
- const { trigger } = require_useFormContext.useFormContext();
43
- const [currentValue, setCurrentValue] = (0, react.useState)(value);
44
- const timeoutRef = (0, react.useRef)(null);
45
- (0, react.useEffect)(() => {
46
- setCurrentValue(value);
47
- }, [value]);
48
- return {
49
- onChange: (0, react.useCallback)((...event) => {
50
- const newValue = event[0]?.target?.value ?? event[0];
51
- setCurrentValue(newValue);
52
- if (timeoutRef.current) clearTimeout(timeoutRef.current);
53
- const executeOnChange = () => {
54
- if (event[0]?.target) onChange({
55
- ...event[0],
56
- target: {
57
- ...event[0].target,
58
- value: newValue
59
- }
60
- }, ...event.slice(1));
61
- else onChange(newValue);
62
- trigger(name);
63
- };
64
- if (debounceDelay <= 0) executeOnChange();
65
- else timeoutRef.current = setTimeout(executeOnChange, debounceDelay);
66
- }, [
67
- onChange,
68
- debounceDelay,
69
- trigger,
70
- name
71
- ]),
72
- onBlur: (0, react.useCallback)(() => {
73
- if (timeoutRef.current) {
74
- clearTimeout(timeoutRef.current);
75
- timeoutRef.current = null;
76
- onChange(currentValue);
77
- }
78
- onBlur();
79
- }, [
80
- onChange,
81
- onBlur,
82
- currentValue
83
- ]),
84
- value: currentValue
85
- };
86
- };
87
-
88
- //#endregion
89
- //#region src/hooks/useInputValueDebounce/index.ts
90
- /* v8 ignore stop */
91
-
92
- //#endregion
93
- Object.defineProperty(exports, 'useInputValueDebounce', {
94
- enumerable: true,
95
- get: function () {
96
- return useInputValueDebounce;
97
- }
98
- });
99
- //# sourceMappingURL=useInputValueDebounce-CRaM7HEM.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useInputValueDebounce-CRaM7HEM.cjs","names":["useFormContext"],"sources":["../src/hooks/useInputValueDebounce/useInputValueDebounce.ts","../src/hooks/useInputValueDebounce/index.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\nimport { useFormContext } from '../useFormContext';\n\nexport interface UseInputValueDebounceOptions<TValue = unknown> {\n /** Debounce delay in milliseconds (default: 300) */\n debounceDelay?: number;\n /** Field name for triggering validation after debounced value commits */\n name: string;\n /** The onBlur function to call after flushing debounced value */\n onBlur: () => void;\n /** The onChange function to call with debounced value */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onChange: (...event: any[]) => void;\n /** The field value */\n value: TValue;\n}\n\nexport interface UseInputValueDebounceReturn<TValue = unknown> {\n /** Enhanced onChange function with debouncing */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onChange: (...event: any[]) => void;\n /** Enhanced onBlur function that flushes current value immediately */\n onBlur: () => void;\n /** The field value that is displayed - updates immediately */\n value: TValue;\n}\n\n/**\n * Custom hook for debouncing value changes with immediate blur support.\n *\n * Provides immediate visual feedback by updating the value instantly,\n * while debouncing the actual onChange calls. When focus is lost,\n * any pending debounced changes are immediately flushed.\n *\n * **Key Features:**\n * - **Debouncing**: Delays onChange calls until user stops typing\n * - **Generic type support**: Works with any data type (strings, numbers, arrays, objects)\n * - **Immediate value updates**: UI stays responsive during debouncing\n * - **Blur flushing**: Immediately applies pending changes on blur\n *\n * **Note:** Value transformations should be handled at the `useUniformField` level,\n * not in this hook. This hook only handles debouncing timing.\n *\n * @param options Configuration for debounced value handling\n * @param options.debounceDelay Delay in milliseconds (default: 300)\n * @param options.onBlur Function to call after flushing debounced value\n * @param options.onChange Function to call with debounced value\n * @param options.value The field value\n * @returns Object containing enhanced onChange, onBlur, and immediate value\n *\n * @example\n * Basic usage with debouncing:\n * ```tsx\n * const { onChange, onBlur, value } = useInputValueDebounce({\n * debounceDelay: 300,\n * name: 'fieldName',\n * onBlur: field.onBlur,\n * onChange: field.onChange,\n * value: field.value,\n * });\n * ```\n */\nexport const useInputValueDebounce = <TValue = unknown>({\n debounceDelay = 300,\n name,\n onBlur,\n onChange,\n value,\n}: UseInputValueDebounceOptions<TValue>): UseInputValueDebounceReturn<TValue> => {\n const { trigger } = useFormContext();\n\n // Track value for synchronous updates\n const [currentValue, setCurrentValue] = useState<TValue>(value);\n\n const timeoutRef = useRef<NodeJS.Timeout | null>(null);\n\n // Sync with external value changes\n useEffect(() => {\n setCurrentValue(value);\n }, [value]);\n\n // Enhanced onChange handler with debouncing\n const handleChange = useCallback(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (...event: any[]) => {\n // Extract the raw value\n const newValue = (event[0]?.target?.value ?? event[0]) as TValue;\n setCurrentValue(newValue);\n\n // Clear existing timeout\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n }\n\n const executeOnChange = () => {\n // Preserve event structure if original was an event\n if (event[0]?.target) {\n const convertedEvent = {\n ...event[0],\n target: {\n ...event[0].target,\n value: newValue,\n },\n };\n onChange(convertedEvent, ...event.slice(1));\n } else {\n onChange(newValue);\n }\n // Trigger validation after debounced value commits\n // This ensures errors are updated immediately when field becomes valid\n trigger(name);\n };\n\n // Execute immediately or after delay\n if (debounceDelay <= 0) {\n executeOnChange();\n } else {\n timeoutRef.current = setTimeout(executeOnChange, debounceDelay);\n }\n },\n [onChange, debounceDelay, trigger, name],\n );\n\n // Enhanced blur handler\n const handleBlur = useCallback(() => {\n // Flush pending changes\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = null;\n onChange(currentValue);\n }\n onBlur();\n }, [onChange, onBlur, currentValue]);\n\n return {\n onChange: handleChange,\n onBlur: handleBlur,\n value: currentValue,\n };\n};\n","/* v8 ignore start */\n\nexport * from './useInputValueDebounce';\n\n/* v8 ignore stop */\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+DA,MAAa,yBAA2C,EACtD,gBAAgB,KAChB,MACA,QACA,UACA,YAC+E;CAC/E,MAAM,EAAE,YAAYA,uCAAgB;CAGpC,MAAM,CAAC,cAAc,uCAAoC,MAAM;CAE/D,MAAM,+BAA2C,KAAK;AAGtD,4BAAgB;AACd,kBAAgB,MAAM;IACrB,CAAC,MAAM,CAAC;AAuDX,QAAO;EACL,kCAnDC,GAAG,UAAiB;GAEnB,MAAM,WAAY,MAAM,IAAI,QAAQ,SAAS,MAAM;AACnD,mBAAgB,SAAS;AAGzB,OAAI,WAAW,QACb,cAAa,WAAW,QAAQ;GAGlC,MAAM,wBAAwB;AAE5B,QAAI,MAAM,IAAI,OAQZ,UAPuB;KACrB,GAAG,MAAM;KACT,QAAQ;MACN,GAAG,MAAM,GAAG;MACZ,OAAO;MACR;KACF,EACwB,GAAG,MAAM,MAAM,EAAE,CAAC;QAE3C,UAAS,SAAS;AAIpB,YAAQ,KAAK;;AAIf,OAAI,iBAAiB,EACnB,kBAAiB;OAEjB,YAAW,UAAU,WAAW,iBAAiB,cAAc;KAGnE;GAAC;GAAU;GAAe;GAAS;GAAK,CACzC;EAeC,qCAZmC;AAEnC,OAAI,WAAW,SAAS;AACtB,iBAAa,WAAW,QAAQ;AAChC,eAAW,UAAU;AACrB,aAAS,aAAa;;AAExB,WAAQ;KACP;GAAC;GAAU;GAAQ;GAAa,CAAC;EAKlC,OAAO;EACR"}
@@ -1,93 +0,0 @@
1
- import { n as useFormContext } from "./useFormContext-Di67HIf7.js";
2
- import { useCallback, useEffect, useRef, useState } from "react";
3
-
4
- //#region src/hooks/useInputValueDebounce/useInputValueDebounce.ts
5
- /**
6
- * Custom hook for debouncing value changes with immediate blur support.
7
- *
8
- * Provides immediate visual feedback by updating the value instantly,
9
- * while debouncing the actual onChange calls. When focus is lost,
10
- * any pending debounced changes are immediately flushed.
11
- *
12
- * **Key Features:**
13
- * - **Debouncing**: Delays onChange calls until user stops typing
14
- * - **Generic type support**: Works with any data type (strings, numbers, arrays, objects)
15
- * - **Immediate value updates**: UI stays responsive during debouncing
16
- * - **Blur flushing**: Immediately applies pending changes on blur
17
- *
18
- * **Note:** Value transformations should be handled at the `useUniformField` level,
19
- * not in this hook. This hook only handles debouncing timing.
20
- *
21
- * @param options Configuration for debounced value handling
22
- * @param options.debounceDelay Delay in milliseconds (default: 300)
23
- * @param options.onBlur Function to call after flushing debounced value
24
- * @param options.onChange Function to call with debounced value
25
- * @param options.value The field value
26
- * @returns Object containing enhanced onChange, onBlur, and immediate value
27
- *
28
- * @example
29
- * Basic usage with debouncing:
30
- * ```tsx
31
- * const { onChange, onBlur, value } = useInputValueDebounce({
32
- * debounceDelay: 300,
33
- * name: 'fieldName',
34
- * onBlur: field.onBlur,
35
- * onChange: field.onChange,
36
- * value: field.value,
37
- * });
38
- * ```
39
- */
40
- const useInputValueDebounce = ({ debounceDelay = 300, name, onBlur, onChange, value }) => {
41
- const { trigger } = useFormContext();
42
- const [currentValue, setCurrentValue] = useState(value);
43
- const timeoutRef = useRef(null);
44
- useEffect(() => {
45
- setCurrentValue(value);
46
- }, [value]);
47
- return {
48
- onChange: useCallback((...event) => {
49
- const newValue = event[0]?.target?.value ?? event[0];
50
- setCurrentValue(newValue);
51
- if (timeoutRef.current) clearTimeout(timeoutRef.current);
52
- const executeOnChange = () => {
53
- if (event[0]?.target) onChange({
54
- ...event[0],
55
- target: {
56
- ...event[0].target,
57
- value: newValue
58
- }
59
- }, ...event.slice(1));
60
- else onChange(newValue);
61
- trigger(name);
62
- };
63
- if (debounceDelay <= 0) executeOnChange();
64
- else timeoutRef.current = setTimeout(executeOnChange, debounceDelay);
65
- }, [
66
- onChange,
67
- debounceDelay,
68
- trigger,
69
- name
70
- ]),
71
- onBlur: useCallback(() => {
72
- if (timeoutRef.current) {
73
- clearTimeout(timeoutRef.current);
74
- timeoutRef.current = null;
75
- onChange(currentValue);
76
- }
77
- onBlur();
78
- }, [
79
- onChange,
80
- onBlur,
81
- currentValue
82
- ]),
83
- value: currentValue
84
- };
85
- };
86
-
87
- //#endregion
88
- //#region src/hooks/useInputValueDebounce/index.ts
89
- /* v8 ignore stop */
90
-
91
- //#endregion
92
- export { useInputValueDebounce as t };
93
- //# sourceMappingURL=useInputValueDebounce-DJO5uzLb.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useInputValueDebounce-DJO5uzLb.js","names":[],"sources":["../src/hooks/useInputValueDebounce/useInputValueDebounce.ts","../src/hooks/useInputValueDebounce/index.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\nimport { useFormContext } from '../useFormContext';\n\nexport interface UseInputValueDebounceOptions<TValue = unknown> {\n /** Debounce delay in milliseconds (default: 300) */\n debounceDelay?: number;\n /** Field name for triggering validation after debounced value commits */\n name: string;\n /** The onBlur function to call after flushing debounced value */\n onBlur: () => void;\n /** The onChange function to call with debounced value */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onChange: (...event: any[]) => void;\n /** The field value */\n value: TValue;\n}\n\nexport interface UseInputValueDebounceReturn<TValue = unknown> {\n /** Enhanced onChange function with debouncing */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onChange: (...event: any[]) => void;\n /** Enhanced onBlur function that flushes current value immediately */\n onBlur: () => void;\n /** The field value that is displayed - updates immediately */\n value: TValue;\n}\n\n/**\n * Custom hook for debouncing value changes with immediate blur support.\n *\n * Provides immediate visual feedback by updating the value instantly,\n * while debouncing the actual onChange calls. When focus is lost,\n * any pending debounced changes are immediately flushed.\n *\n * **Key Features:**\n * - **Debouncing**: Delays onChange calls until user stops typing\n * - **Generic type support**: Works with any data type (strings, numbers, arrays, objects)\n * - **Immediate value updates**: UI stays responsive during debouncing\n * - **Blur flushing**: Immediately applies pending changes on blur\n *\n * **Note:** Value transformations should be handled at the `useUniformField` level,\n * not in this hook. This hook only handles debouncing timing.\n *\n * @param options Configuration for debounced value handling\n * @param options.debounceDelay Delay in milliseconds (default: 300)\n * @param options.onBlur Function to call after flushing debounced value\n * @param options.onChange Function to call with debounced value\n * @param options.value The field value\n * @returns Object containing enhanced onChange, onBlur, and immediate value\n *\n * @example\n * Basic usage with debouncing:\n * ```tsx\n * const { onChange, onBlur, value } = useInputValueDebounce({\n * debounceDelay: 300,\n * name: 'fieldName',\n * onBlur: field.onBlur,\n * onChange: field.onChange,\n * value: field.value,\n * });\n * ```\n */\nexport const useInputValueDebounce = <TValue = unknown>({\n debounceDelay = 300,\n name,\n onBlur,\n onChange,\n value,\n}: UseInputValueDebounceOptions<TValue>): UseInputValueDebounceReturn<TValue> => {\n const { trigger } = useFormContext();\n\n // Track value for synchronous updates\n const [currentValue, setCurrentValue] = useState<TValue>(value);\n\n const timeoutRef = useRef<NodeJS.Timeout | null>(null);\n\n // Sync with external value changes\n useEffect(() => {\n setCurrentValue(value);\n }, [value]);\n\n // Enhanced onChange handler with debouncing\n const handleChange = useCallback(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (...event: any[]) => {\n // Extract the raw value\n const newValue = (event[0]?.target?.value ?? event[0]) as TValue;\n setCurrentValue(newValue);\n\n // Clear existing timeout\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n }\n\n const executeOnChange = () => {\n // Preserve event structure if original was an event\n if (event[0]?.target) {\n const convertedEvent = {\n ...event[0],\n target: {\n ...event[0].target,\n value: newValue,\n },\n };\n onChange(convertedEvent, ...event.slice(1));\n } else {\n onChange(newValue);\n }\n // Trigger validation after debounced value commits\n // This ensures errors are updated immediately when field becomes valid\n trigger(name);\n };\n\n // Execute immediately or after delay\n if (debounceDelay <= 0) {\n executeOnChange();\n } else {\n timeoutRef.current = setTimeout(executeOnChange, debounceDelay);\n }\n },\n [onChange, debounceDelay, trigger, name],\n );\n\n // Enhanced blur handler\n const handleBlur = useCallback(() => {\n // Flush pending changes\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = null;\n onChange(currentValue);\n }\n onBlur();\n }, [onChange, onBlur, currentValue]);\n\n return {\n onChange: handleChange,\n onBlur: handleBlur,\n value: currentValue,\n };\n};\n","/* v8 ignore start */\n\nexport * from './useInputValueDebounce';\n\n/* v8 ignore stop */\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+DA,MAAa,yBAA2C,EACtD,gBAAgB,KAChB,MACA,QACA,UACA,YAC+E;CAC/E,MAAM,EAAE,YAAY,gBAAgB;CAGpC,MAAM,CAAC,cAAc,mBAAmB,SAAiB,MAAM;CAE/D,MAAM,aAAa,OAA8B,KAAK;AAGtD,iBAAgB;AACd,kBAAgB,MAAM;IACrB,CAAC,MAAM,CAAC;AAuDX,QAAO;EACL,UArDmB,aAElB,GAAG,UAAiB;GAEnB,MAAM,WAAY,MAAM,IAAI,QAAQ,SAAS,MAAM;AACnD,mBAAgB,SAAS;AAGzB,OAAI,WAAW,QACb,cAAa,WAAW,QAAQ;GAGlC,MAAM,wBAAwB;AAE5B,QAAI,MAAM,IAAI,OAQZ,UAPuB;KACrB,GAAG,MAAM;KACT,QAAQ;MACN,GAAG,MAAM,GAAG;MACZ,OAAO;MACR;KACF,EACwB,GAAG,MAAM,MAAM,EAAE,CAAC;QAE3C,UAAS,SAAS;AAIpB,YAAQ,KAAK;;AAIf,OAAI,iBAAiB,EACnB,kBAAiB;OAEjB,YAAW,UAAU,WAAW,iBAAiB,cAAc;KAGnE;GAAC;GAAU;GAAe;GAAS;GAAK,CACzC;EAeC,QAZiB,kBAAkB;AAEnC,OAAI,WAAW,SAAS;AACtB,iBAAa,WAAW,QAAQ;AAChC,eAAW,UAAU;AACrB,aAAS,aAAa;;AAExB,WAAQ;KACP;GAAC;GAAU;GAAQ;GAAa,CAAC;EAKlC,OAAO;EACR"}
@@ -1,142 +0,0 @@
1
- const require_FormContext = require('./FormContext-BSLO2-sO.cjs');
2
- const require_helpers = require('./helpers-Bd_QpqXg.cjs');
3
- const require_FieldCopyTestIdButton = require('./FieldCopyTestIdButton-4uupFq1U.cjs');
4
- const require_FieldValidationError = require('./FieldValidationError-Br6iopZj.cjs');
5
- const require_useController = require('./useController-B_SSp5Z5.cjs');
6
- const require_useFormContext = require('./useFormContext-vdeeDsAs.cjs');
7
- const require_useInputValueTransform = require('./useInputValueTransform-BBRvvhDe.cjs');
8
- let react = require("react");
9
- react = require_FormContext.__toESM(react);
10
- let _fuf_stack_pixels = require("@fuf-stack/pixels");
11
- let react_jsx_runtime = require("react/jsx-runtime");
12
- let _heroui_input = require("@heroui/input");
13
-
14
- //#region src/hooks/useUniformField/useUniformField.tsx
15
- /**
16
- * Combines frequently used form field logic into a single hook.
17
- *
18
- * Provides:
19
- * - Enhanced form context (validation-aware state, `testId`, value transforms)
20
- * - Controller field with nullish conversion handling
21
- * - Value transformation via `transform` prop:
22
- * • Allows disentangled display and form values (e.g., string ↔ object, boolean ↔ array)
23
- * • Automatically applies `toDisplayValue` to field value for components
24
- * • Automatically applies `toFormValue` to display value when onChange is called
25
- * • Works with `type` prop for automatic number/string conversion
26
- * • Examples: storing objects while displaying strings, storing booleans as arrays, enriching values with metadata
27
- * - Debounced `invalid` state with smart timing:
28
- * • `true` (field becomes invalid): applies immediately so errors show right away
29
- * • `false` (field becomes valid): delayed 200ms to allow smooth exit animations
30
- * • Respects `prefers-reduced-motion` by skipping delays when user prefers reduced motion
31
- * - Smart `invalid` visibility (via `showInvalid`):
32
- * • Shows errors when field is dirty OR touched OR form has been submitted
33
- * • Prevents showing errors on pristine/untouched fields for better UX
34
- * • Works well for all field types (text inputs, checkboxes, radios, arrays)
35
- * - Prebuilt `errorMessage` React node using `FieldValidationError`
36
- * - Computed `label` node which appends a `FieldCopyTestIdButton` in
37
- * `debug-testids` mode
38
- * - `defaultValue` for uncontrolled defaults and all usual field handlers
39
- * - Access to form utilities: `control`, `getValues`, `resetField`
40
- * - Presentation helpers: `getLabelProps`, `getErrorMessageProps`,
41
- * `getHelperWrapperProps` for consistent wiring to underlying UI components
42
- */
43
- const useUniformField = (params) => {
44
- const { name, ariaLabel: customAriaLabel, disabled = false, testId: explicitTestId, label, type, transform } = params;
45
- const { control, debugMode, formState: { submitCount }, getFieldState, getValues, resetField } = require_useFormContext.useFormContext();
46
- const { error, invalid: rawInvalid, isTouched, required, testId } = getFieldState(name, explicitTestId);
47
- const { field } = require_useController.useController({
48
- control,
49
- disabled,
50
- name
51
- });
52
- const { onChange: fieldOnChange, value: fieldValue, disabled: isDisabled, onBlur, ref } = field;
53
- const { toDisplayValue, toFormValue } = require_useInputValueTransform.useInputValueTransform({
54
- type,
55
- transform
56
- });
57
- const transformedValue = toDisplayValue(fieldValue);
58
- const transformedOnChange = (eventOrValue) => {
59
- fieldOnChange(toFormValue(eventOrValue?.target?.value ?? eventOrValue));
60
- };
61
- const defaultValue = getValues()?.[name];
62
- /**
63
- * Determine when to show the invalid state to the user.
64
- *
65
- * Show errors when the field is invalid AND any of these conditions are met:
66
- * - Field has a value (show validation errors like format/length while typing)
67
- * - Field is touched (focused and blurred) - good for text inputs
68
- * - Form has been submitted - shows all errors after submit attempt
69
- *
70
- * Note: We intentionally don't use isDirty because:
71
- * - Newly added array elements are marked "dirty" by RHF, causing immediate errors
72
- * - Field Cards with empty initial values show errors immediately
73
- * - hasValue + isTouched covers the same use cases more reliably
74
- *
75
- * This prevents showing errors on pristine/untouched/empty fields for better UX.
76
- * Examples:
77
- * - Text input: User loads form with empty required field → no error shown yet
78
- * - Text input: User types invalid content → error shows immediately (has value)
79
- * - Text input: User focuses and blurs without typing → error shows (via isTouched)
80
- * - Checkbox/radio: User selects option → error shows immediately (has value)
81
- * - Field array: User adds element → no error yet; after blur → error shows
82
- * - Any field: User submits form → all errors show (via submitCount)
83
- *
84
- * The entire condition is debounced to prevent flickering and allow smooth animations.
85
- */
86
- const hasValue = !require_helpers.isValueEmpty(fieldValue);
87
- const invalid = (0, _fuf_stack_pixels.useDebounce)(rawInvalid && (hasValue || isTouched || submitCount > 0), 200);
88
- const showTestIdCopyButton = debugMode === "debug-testids";
89
- const labelNode = !!label || showTestIdCopyButton ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [label !== false ? label : null, showTestIdCopyButton ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FieldCopyTestIdButton.FieldCopyTestIdButton_default$1, { testId }) : null] }) : null;
90
- const errorMessage = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FieldValidationError.FieldValidationError_default$1, {
91
- error,
92
- testId
93
- });
94
- const { getErrorMessageProps, getLabelProps, getHelperWrapperProps } = (0, _heroui_input.useInput)({
95
- ref,
96
- classNames: { helperWrapper: "p-0" },
97
- errorMessage: JSON.stringify(error),
98
- isInvalid: invalid,
99
- isRequired: required,
100
- label,
101
- labelPlacement: "outside"
102
- });
103
- return {
104
- ariaLabel: customAriaLabel ?? (typeof label === "string" ? label : name),
105
- control,
106
- debugMode,
107
- defaultValue,
108
- disabled: isDisabled,
109
- error,
110
- errorMessage,
111
- field: {
112
- ...field,
113
- value: transformedValue,
114
- onChange: transformedOnChange
115
- },
116
- getErrorMessageProps,
117
- getHelperWrapperProps,
118
- getLabelProps,
119
- getValues,
120
- invalid,
121
- label: labelNode,
122
- onBlur,
123
- onChange: transformedOnChange,
124
- ref,
125
- required,
126
- resetField,
127
- testId
128
- };
129
- };
130
-
131
- //#endregion
132
- //#region src/hooks/useUniformField/index.ts
133
- /* v8 ignore stop */
134
-
135
- //#endregion
136
- Object.defineProperty(exports, 'useUniformField', {
137
- enumerable: true,
138
- get: function () {
139
- return useUniformField;
140
- }
141
- });
142
- //# sourceMappingURL=useUniformField-6c4OCAfb.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useUniformField-6c4OCAfb.cjs","names":["useFormContext","useController","useInputValueTransform","isValueEmpty","FieldCopyTestIdButton","FieldValidationError"],"sources":["../src/hooks/useUniformField/useUniformField.tsx","../src/hooks/useUniformField/index.ts"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { FieldError, FieldValues, Path } from 'react-hook-form';\nimport type { InputValueTransform } from '../useInputValueTransform/useInputValueTransform';\n\nimport React from 'react';\n\nimport { useDebounce } from '@fuf-stack/pixels';\n\nimport { isValueEmpty } from '../../helpers';\nimport { FieldCopyTestIdButton } from '../../partials/FieldCopyTestIdButton';\nimport { FieldValidationError } from '../../partials/FieldValidationError';\nimport { useController } from '../useController/useController';\nimport { useFormContext } from '../useFormContext/useFormContext';\nimport { useInput } from '../useInput/useInput';\nimport { useInputValueTransform } from '../useInputValueTransform/useInputValueTransform';\n\nexport interface UseUniformFieldParams<\n TFieldValues extends FieldValues = FieldValues,\n TDisplay = unknown,\n> {\n /** Form field name */\n name: Path<TFieldValues> & string;\n /** Custom aria-label for accessibility. If not provided, falls back to field name when no visible label exists */\n ariaLabel?: string;\n /** Disable the field */\n disabled?: boolean;\n /** Optional label content */\n label?: ReactNode;\n /** Optional explicit test id used to build stable test ids */\n testId?: string;\n /** Optional value transformation between form and display values */\n transform?: InputValueTransform<TDisplay>;\n /** Input type for special number handling */\n type?: 'text' | 'number' | 'password';\n}\n\nexport interface UseUniformFieldReturn<\n TFieldValues extends FieldValues = FieldValues,\n> {\n /** Computed aria-label fallback (field name) when no visible label exists. Components can override based on their accessibility needs (e.g., if placeholder provides sufficient context) */\n ariaLabel: string | undefined;\n /** react-hook-form control instance for advanced integrations */\n control: ReturnType<typeof useFormContext<TFieldValues>>['control'];\n /** Debug mode from Uniform provider */\n debugMode: ReturnType<typeof useFormContext<TFieldValues>>['debugMode'];\n /** Current value used to initialize uncontrolled components */\n defaultValue: unknown;\n /** Whether the field is currently disabled (from RHF) */\n disabled: boolean | undefined;\n /** Validation error(s) for the field */\n error: FieldError[] | undefined;\n /** Pre-built errorMessage node to plug into components */\n errorMessage: ReactNode | null;\n /** RHF controller field with transformed value/onChange (use this for simple components) */\n field: ReturnType<typeof useController<TFieldValues>>['field'];\n /** Helper to spread standardized error message props to underlying components */\n getErrorMessageProps: ReturnType<typeof useInput>['getErrorMessageProps'];\n /** Helper to spread standardized helper wrapper props (for spacing/animation) */\n getHelperWrapperProps: ReturnType<typeof useInput>['getHelperWrapperProps'];\n /** Helper to spread standardized label props to underlying components */\n getLabelProps: ReturnType<typeof useInput>['getLabelProps'];\n /** Access current form values (converted to validation-friendly format) */\n getValues: ReturnType<typeof useFormContext<TFieldValues>>['getValues'];\n /** Whether the field should show invalid state (debounced for smooth animations). True when field is invalid AND (dirty OR touched OR submitted) */\n invalid: boolean;\n /** Computed label node including optional test id copy button */\n label: ReactNode | null;\n /** onBlur handler from controller */\n onBlur: ReturnType<typeof useController<TFieldValues>>['field']['onBlur'];\n /** onChange handler from controller (with transform applied) */\n onChange: ReturnType<typeof useController<TFieldValues>>['field']['onChange'];\n /** Ref to forward to underlying control */\n ref: ReturnType<typeof useController<TFieldValues>>['field']['ref'];\n /** Whether the field is required according to validation schema */\n required: boolean;\n /** Reset a specific field in the form */\n resetField: ReturnType<typeof useFormContext<TFieldValues>>['resetField'];\n /** Generated HTML data-testid for the field */\n testId: string;\n}\n\n/**\n * Combines frequently used form field logic into a single hook.\n *\n * Provides:\n * - Enhanced form context (validation-aware state, `testId`, value transforms)\n * - Controller field with nullish conversion handling\n * - Value transformation via `transform` prop:\n * • Allows disentangled display and form values (e.g., string ↔ object, boolean ↔ array)\n * • Automatically applies `toDisplayValue` to field value for components\n * • Automatically applies `toFormValue` to display value when onChange is called\n * • Works with `type` prop for automatic number/string conversion\n * • Examples: storing objects while displaying strings, storing booleans as arrays, enriching values with metadata\n * - Debounced `invalid` state with smart timing:\n * • `true` (field becomes invalid): applies immediately so errors show right away\n * • `false` (field becomes valid): delayed 200ms to allow smooth exit animations\n * • Respects `prefers-reduced-motion` by skipping delays when user prefers reduced motion\n * - Smart `invalid` visibility (via `showInvalid`):\n * • Shows errors when field is dirty OR touched OR form has been submitted\n * • Prevents showing errors on pristine/untouched fields for better UX\n * • Works well for all field types (text inputs, checkboxes, radios, arrays)\n * - Prebuilt `errorMessage` React node using `FieldValidationError`\n * - Computed `label` node which appends a `FieldCopyTestIdButton` in\n * `debug-testids` mode\n * - `defaultValue` for uncontrolled defaults and all usual field handlers\n * - Access to form utilities: `control`, `getValues`, `resetField`\n * - Presentation helpers: `getLabelProps`, `getErrorMessageProps`,\n * `getHelperWrapperProps` for consistent wiring to underlying UI components\n */\nexport const useUniformField = <\n TFieldValues extends FieldValues = FieldValues,\n TDisplay = unknown,\n>(\n params: UseUniformFieldParams<TFieldValues, TDisplay>,\n): UseUniformFieldReturn<TFieldValues> => {\n const {\n name,\n ariaLabel: customAriaLabel,\n disabled = false,\n testId: explicitTestId,\n label,\n type,\n transform,\n } = params;\n\n const {\n control,\n debugMode,\n formState: { submitCount },\n getFieldState,\n getValues,\n resetField,\n } = useFormContext<TFieldValues>();\n\n const {\n error,\n invalid: rawInvalid,\n isTouched,\n required,\n testId,\n } = getFieldState(name, explicitTestId);\n\n const { field } = useController<TFieldValues>({\n control,\n disabled,\n name,\n });\n const {\n onChange: fieldOnChange,\n value: fieldValue,\n disabled: isDisabled,\n onBlur,\n ref,\n } = field;\n\n // Get transform utilities (but don't apply them automatically)\n // Components can choose how to use them (directly or via useInputValueDebounce)\n const { toDisplayValue, toFormValue } = useInputValueTransform<TDisplay>({\n type,\n transform,\n });\n\n // For components without special needs: apply transform to value and onChange\n const transformedValue = toDisplayValue(fieldValue);\n const transformedOnChange = (eventOrValue: TDisplay | React.ChangeEvent) => {\n // Extract value from event or use value directly\n const displayValue =\n (eventOrValue as React.ChangeEvent<HTMLInputElement>)?.target?.value ??\n eventOrValue;\n const formValue = toFormValue(displayValue as TDisplay);\n fieldOnChange(formValue as typeof fieldValue);\n };\n\n const defaultValue = (getValues() as Record<string, unknown>)?.[\n name as string\n ];\n\n /**\n * Determine when to show the invalid state to the user.\n *\n * Show errors when the field is invalid AND any of these conditions are met:\n * - Field has a value (show validation errors like format/length while typing)\n * - Field is touched (focused and blurred) - good for text inputs\n * - Form has been submitted - shows all errors after submit attempt\n *\n * Note: We intentionally don't use isDirty because:\n * - Newly added array elements are marked \"dirty\" by RHF, causing immediate errors\n * - Field Cards with empty initial values show errors immediately\n * - hasValue + isTouched covers the same use cases more reliably\n *\n * This prevents showing errors on pristine/untouched/empty fields for better UX.\n * Examples:\n * - Text input: User loads form with empty required field → no error shown yet\n * - Text input: User types invalid content → error shows immediately (has value)\n * - Text input: User focuses and blurs without typing → error shows (via isTouched)\n * - Checkbox/radio: User selects option → error shows immediately (has value)\n * - Field array: User adds element → no error yet; after blur → error shows\n * - Any field: User submits form → all errors show (via submitCount)\n *\n * The entire condition is debounced to prevent flickering and allow smooth animations.\n */\n\n // isValueEmpty handles marker strings, flat array wrappers, empty arrays, and empty objects\n const hasValue = !isValueEmpty(fieldValue);\n const showInvalid = rawInvalid && (hasValue || isTouched || submitCount > 0);\n // Debounce to prevent flickering during rapid state changes\n const invalid = useDebounce(showInvalid, 200);\n\n // Build a label node that:\n // - shows the provided label (unless explicitly set to false)\n // - appends a copy-to-clipboard button for the test id in `debug-testids` mode\n // Consumers can pass this directly to component `label` props\n const showTestIdCopyButton = debugMode === 'debug-testids';\n const labelNode: ReactNode | null =\n !!label || showTestIdCopyButton ? (\n <>\n {label !== false ? label : null}\n {showTestIdCopyButton ? (\n <FieldCopyTestIdButton testId={testId} />\n ) : null}\n </>\n ) : null;\n\n // Ready-to-render error message; consumers can drop this into their\n // component `errorMessage` prop without repeating mapping/markup\n const errorMessage = <FieldValidationError error={error} testId={testId} />;\n\n // Generate standardized props for label, helper wrapper and error message\n // so consumers can spread them directly into UI components (e.g. HeroUI),\n // keeping animations/spacing consistent across fields\n const { getErrorMessageProps, getLabelProps, getHelperWrapperProps } =\n useInput({\n ref,\n classNames: {\n // set padding to 0 for error message exit animation\n helperWrapper: 'p-0',\n },\n errorMessage: JSON.stringify(error),\n isInvalid: invalid,\n isRequired: required,\n label,\n labelPlacement: 'outside',\n });\n\n // Compute aria-label: prefer custom prop, then use string label if available, otherwise field name\n // Components can further override this based on their specific accessibility needs\n // (e.g., Input/TextArea may skip this if they have a meaningful placeholder)\n const ariaLabel =\n customAriaLabel ?? (typeof label === 'string' ? label : name);\n\n return {\n ariaLabel,\n control,\n debugMode,\n defaultValue,\n disabled: isDisabled,\n error,\n errorMessage,\n field: {\n ...field,\n value: transformedValue as typeof field.value,\n onChange: transformedOnChange as typeof field.onChange,\n },\n getErrorMessageProps,\n getHelperWrapperProps,\n getLabelProps,\n getValues,\n invalid,\n label: labelNode,\n onBlur,\n onChange: transformedOnChange as typeof field.onChange,\n ref,\n required,\n resetField,\n testId,\n };\n};\n","/* v8 ignore start */\n\nexport * from './useUniformField';\n\n/* v8 ignore stop */\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6GA,MAAa,mBAIX,WACwC;CACxC,MAAM,EACJ,MACA,WAAW,iBACX,WAAW,OACX,QAAQ,gBACR,OACA,MACA,cACE;CAEJ,MAAM,EACJ,SACA,WACA,WAAW,EAAE,eACb,eACA,WACA,eACEA,uCAA8B;CAElC,MAAM,EACJ,OACA,SAAS,YACT,WACA,UACA,WACE,cAAc,MAAM,eAAe;CAEvC,MAAM,EAAE,UAAUC,oCAA4B;EAC5C;EACA;EACA;EACD,CAAC;CACF,MAAM,EACJ,UAAU,eACV,OAAO,YACP,UAAU,YACV,QACA,QACE;CAIJ,MAAM,EAAE,gBAAgB,gBAAgBC,sDAAiC;EACvE;EACA;EACD,CAAC;CAGF,MAAM,mBAAmB,eAAe,WAAW;CACnD,MAAM,uBAAuB,iBAA+C;AAM1E,gBADkB,YAFf,cAAsD,QAAQ,SAC/D,aACqD,CACV;;CAG/C,MAAM,eAAgB,WAAW,GAC/B;;;;;;;;;;;;;;;;;;;;;;;;;CA6BF,MAAM,WAAW,CAACC,6BAAa,WAAW;CAG1C,MAAM,6CAFc,eAAe,YAAY,aAAa,cAAc,IAEjC,IAAI;CAM7C,MAAM,uBAAuB,cAAc;CAC3C,MAAM,YACJ,CAAC,CAAC,SAAS,uBACT,qFACG,UAAU,QAAQ,QAAQ,MAC1B,uBACC,2CAACC,iEAA8B,SAAU,GACvC,QACH,GACD;CAIN,MAAM,eAAe,2CAACC;EAA4B;EAAe;GAAU;CAK3E,MAAM,EAAE,sBAAsB,eAAe,sDAClC;EACP;EACA,YAAY,EAEV,eAAe,OAChB;EACD,cAAc,KAAK,UAAU,MAAM;EACnC,WAAW;EACX,YAAY;EACZ;EACA,gBAAgB;EACjB,CAAC;AAQJ,QAAO;EACL,WAHA,oBAAoB,OAAO,UAAU,WAAW,QAAQ;EAIxD;EACA;EACA;EACA,UAAU;EACV;EACA;EACA,OAAO;GACL,GAAG;GACH,OAAO;GACP,UAAU;GACX;EACD;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;EACA,UAAU;EACV;EACA;EACA;EACA;EACD"}
@@ -1,135 +0,0 @@
1
- import { r as isValueEmpty } from "./helpers-33jajRcN.js";
2
- import { n as FieldCopyTestIdButton_default } from "./FieldCopyTestIdButton-BoEdlzLs.js";
3
- import { n as FieldValidationError_default } from "./FieldValidationError-XQaViV52.js";
4
- import { t as useController } from "./useController-NjuthTyL.js";
5
- import { n as useFormContext } from "./useFormContext-Di67HIf7.js";
6
- import { t as useInput } from "./useInput-BWzvIUpW.js";
7
- import { t as useInputValueTransform } from "./useInputValueTransform-C-fmz3ke.js";
8
- import React from "react";
9
- import { useDebounce } from "@fuf-stack/pixels";
10
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
-
12
- //#region src/hooks/useUniformField/useUniformField.tsx
13
- /**
14
- * Combines frequently used form field logic into a single hook.
15
- *
16
- * Provides:
17
- * - Enhanced form context (validation-aware state, `testId`, value transforms)
18
- * - Controller field with nullish conversion handling
19
- * - Value transformation via `transform` prop:
20
- * • Allows disentangled display and form values (e.g., string ↔ object, boolean ↔ array)
21
- * • Automatically applies `toDisplayValue` to field value for components
22
- * • Automatically applies `toFormValue` to display value when onChange is called
23
- * • Works with `type` prop for automatic number/string conversion
24
- * • Examples: storing objects while displaying strings, storing booleans as arrays, enriching values with metadata
25
- * - Debounced `invalid` state with smart timing:
26
- * • `true` (field becomes invalid): applies immediately so errors show right away
27
- * • `false` (field becomes valid): delayed 200ms to allow smooth exit animations
28
- * • Respects `prefers-reduced-motion` by skipping delays when user prefers reduced motion
29
- * - Smart `invalid` visibility (via `showInvalid`):
30
- * • Shows errors when field is dirty OR touched OR form has been submitted
31
- * • Prevents showing errors on pristine/untouched fields for better UX
32
- * • Works well for all field types (text inputs, checkboxes, radios, arrays)
33
- * - Prebuilt `errorMessage` React node using `FieldValidationError`
34
- * - Computed `label` node which appends a `FieldCopyTestIdButton` in
35
- * `debug-testids` mode
36
- * - `defaultValue` for uncontrolled defaults and all usual field handlers
37
- * - Access to form utilities: `control`, `getValues`, `resetField`
38
- * - Presentation helpers: `getLabelProps`, `getErrorMessageProps`,
39
- * `getHelperWrapperProps` for consistent wiring to underlying UI components
40
- */
41
- const useUniformField = (params) => {
42
- const { name, ariaLabel: customAriaLabel, disabled = false, testId: explicitTestId, label, type, transform } = params;
43
- const { control, debugMode, formState: { submitCount }, getFieldState, getValues, resetField } = useFormContext();
44
- const { error, invalid: rawInvalid, isTouched, required, testId } = getFieldState(name, explicitTestId);
45
- const { field } = useController({
46
- control,
47
- disabled,
48
- name
49
- });
50
- const { onChange: fieldOnChange, value: fieldValue, disabled: isDisabled, onBlur, ref } = field;
51
- const { toDisplayValue, toFormValue } = useInputValueTransform({
52
- type,
53
- transform
54
- });
55
- const transformedValue = toDisplayValue(fieldValue);
56
- const transformedOnChange = (eventOrValue) => {
57
- fieldOnChange(toFormValue(eventOrValue?.target?.value ?? eventOrValue));
58
- };
59
- const defaultValue = getValues()?.[name];
60
- /**
61
- * Determine when to show the invalid state to the user.
62
- *
63
- * Show errors when the field is invalid AND any of these conditions are met:
64
- * - Field has a value (show validation errors like format/length while typing)
65
- * - Field is touched (focused and blurred) - good for text inputs
66
- * - Form has been submitted - shows all errors after submit attempt
67
- *
68
- * Note: We intentionally don't use isDirty because:
69
- * - Newly added array elements are marked "dirty" by RHF, causing immediate errors
70
- * - Field Cards with empty initial values show errors immediately
71
- * - hasValue + isTouched covers the same use cases more reliably
72
- *
73
- * This prevents showing errors on pristine/untouched/empty fields for better UX.
74
- * Examples:
75
- * - Text input: User loads form with empty required field → no error shown yet
76
- * - Text input: User types invalid content → error shows immediately (has value)
77
- * - Text input: User focuses and blurs without typing → error shows (via isTouched)
78
- * - Checkbox/radio: User selects option → error shows immediately (has value)
79
- * - Field array: User adds element → no error yet; after blur → error shows
80
- * - Any field: User submits form → all errors show (via submitCount)
81
- *
82
- * The entire condition is debounced to prevent flickering and allow smooth animations.
83
- */
84
- const hasValue = !isValueEmpty(fieldValue);
85
- const invalid = useDebounce(rawInvalid && (hasValue || isTouched || submitCount > 0), 200);
86
- const showTestIdCopyButton = debugMode === "debug-testids";
87
- const labelNode = !!label || showTestIdCopyButton ? /* @__PURE__ */ jsxs(Fragment, { children: [label !== false ? label : null, showTestIdCopyButton ? /* @__PURE__ */ jsx(FieldCopyTestIdButton_default, { testId }) : null] }) : null;
88
- const errorMessage = /* @__PURE__ */ jsx(FieldValidationError_default, {
89
- error,
90
- testId
91
- });
92
- const { getErrorMessageProps, getLabelProps, getHelperWrapperProps } = useInput({
93
- ref,
94
- classNames: { helperWrapper: "p-0" },
95
- errorMessage: JSON.stringify(error),
96
- isInvalid: invalid,
97
- isRequired: required,
98
- label,
99
- labelPlacement: "outside"
100
- });
101
- return {
102
- ariaLabel: customAriaLabel ?? (typeof label === "string" ? label : name),
103
- control,
104
- debugMode,
105
- defaultValue,
106
- disabled: isDisabled,
107
- error,
108
- errorMessage,
109
- field: {
110
- ...field,
111
- value: transformedValue,
112
- onChange: transformedOnChange
113
- },
114
- getErrorMessageProps,
115
- getHelperWrapperProps,
116
- getLabelProps,
117
- getValues,
118
- invalid,
119
- label: labelNode,
120
- onBlur,
121
- onChange: transformedOnChange,
122
- ref,
123
- required,
124
- resetField,
125
- testId
126
- };
127
- };
128
-
129
- //#endregion
130
- //#region src/hooks/useUniformField/index.ts
131
- /* v8 ignore stop */
132
-
133
- //#endregion
134
- export { useUniformField as t };
135
- //# sourceMappingURL=useUniformField-C-Xyu-8v.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useUniformField-C-Xyu-8v.js","names":["FieldCopyTestIdButton","FieldValidationError"],"sources":["../src/hooks/useUniformField/useUniformField.tsx","../src/hooks/useUniformField/index.ts"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { FieldError, FieldValues, Path } from 'react-hook-form';\nimport type { InputValueTransform } from '../useInputValueTransform/useInputValueTransform';\n\nimport React from 'react';\n\nimport { useDebounce } from '@fuf-stack/pixels';\n\nimport { isValueEmpty } from '../../helpers';\nimport { FieldCopyTestIdButton } from '../../partials/FieldCopyTestIdButton';\nimport { FieldValidationError } from '../../partials/FieldValidationError';\nimport { useController } from '../useController/useController';\nimport { useFormContext } from '../useFormContext/useFormContext';\nimport { useInput } from '../useInput/useInput';\nimport { useInputValueTransform } from '../useInputValueTransform/useInputValueTransform';\n\nexport interface UseUniformFieldParams<\n TFieldValues extends FieldValues = FieldValues,\n TDisplay = unknown,\n> {\n /** Form field name */\n name: Path<TFieldValues> & string;\n /** Custom aria-label for accessibility. If not provided, falls back to field name when no visible label exists */\n ariaLabel?: string;\n /** Disable the field */\n disabled?: boolean;\n /** Optional label content */\n label?: ReactNode;\n /** Optional explicit test id used to build stable test ids */\n testId?: string;\n /** Optional value transformation between form and display values */\n transform?: InputValueTransform<TDisplay>;\n /** Input type for special number handling */\n type?: 'text' | 'number' | 'password';\n}\n\nexport interface UseUniformFieldReturn<\n TFieldValues extends FieldValues = FieldValues,\n> {\n /** Computed aria-label fallback (field name) when no visible label exists. Components can override based on their accessibility needs (e.g., if placeholder provides sufficient context) */\n ariaLabel: string | undefined;\n /** react-hook-form control instance for advanced integrations */\n control: ReturnType<typeof useFormContext<TFieldValues>>['control'];\n /** Debug mode from Uniform provider */\n debugMode: ReturnType<typeof useFormContext<TFieldValues>>['debugMode'];\n /** Current value used to initialize uncontrolled components */\n defaultValue: unknown;\n /** Whether the field is currently disabled (from RHF) */\n disabled: boolean | undefined;\n /** Validation error(s) for the field */\n error: FieldError[] | undefined;\n /** Pre-built errorMessage node to plug into components */\n errorMessage: ReactNode | null;\n /** RHF controller field with transformed value/onChange (use this for simple components) */\n field: ReturnType<typeof useController<TFieldValues>>['field'];\n /** Helper to spread standardized error message props to underlying components */\n getErrorMessageProps: ReturnType<typeof useInput>['getErrorMessageProps'];\n /** Helper to spread standardized helper wrapper props (for spacing/animation) */\n getHelperWrapperProps: ReturnType<typeof useInput>['getHelperWrapperProps'];\n /** Helper to spread standardized label props to underlying components */\n getLabelProps: ReturnType<typeof useInput>['getLabelProps'];\n /** Access current form values (converted to validation-friendly format) */\n getValues: ReturnType<typeof useFormContext<TFieldValues>>['getValues'];\n /** Whether the field should show invalid state (debounced for smooth animations). True when field is invalid AND (dirty OR touched OR submitted) */\n invalid: boolean;\n /** Computed label node including optional test id copy button */\n label: ReactNode | null;\n /** onBlur handler from controller */\n onBlur: ReturnType<typeof useController<TFieldValues>>['field']['onBlur'];\n /** onChange handler from controller (with transform applied) */\n onChange: ReturnType<typeof useController<TFieldValues>>['field']['onChange'];\n /** Ref to forward to underlying control */\n ref: ReturnType<typeof useController<TFieldValues>>['field']['ref'];\n /** Whether the field is required according to validation schema */\n required: boolean;\n /** Reset a specific field in the form */\n resetField: ReturnType<typeof useFormContext<TFieldValues>>['resetField'];\n /** Generated HTML data-testid for the field */\n testId: string;\n}\n\n/**\n * Combines frequently used form field logic into a single hook.\n *\n * Provides:\n * - Enhanced form context (validation-aware state, `testId`, value transforms)\n * - Controller field with nullish conversion handling\n * - Value transformation via `transform` prop:\n * • Allows disentangled display and form values (e.g., string ↔ object, boolean ↔ array)\n * • Automatically applies `toDisplayValue` to field value for components\n * • Automatically applies `toFormValue` to display value when onChange is called\n * • Works with `type` prop for automatic number/string conversion\n * • Examples: storing objects while displaying strings, storing booleans as arrays, enriching values with metadata\n * - Debounced `invalid` state with smart timing:\n * • `true` (field becomes invalid): applies immediately so errors show right away\n * • `false` (field becomes valid): delayed 200ms to allow smooth exit animations\n * • Respects `prefers-reduced-motion` by skipping delays when user prefers reduced motion\n * - Smart `invalid` visibility (via `showInvalid`):\n * • Shows errors when field is dirty OR touched OR form has been submitted\n * • Prevents showing errors on pristine/untouched fields for better UX\n * • Works well for all field types (text inputs, checkboxes, radios, arrays)\n * - Prebuilt `errorMessage` React node using `FieldValidationError`\n * - Computed `label` node which appends a `FieldCopyTestIdButton` in\n * `debug-testids` mode\n * - `defaultValue` for uncontrolled defaults and all usual field handlers\n * - Access to form utilities: `control`, `getValues`, `resetField`\n * - Presentation helpers: `getLabelProps`, `getErrorMessageProps`,\n * `getHelperWrapperProps` for consistent wiring to underlying UI components\n */\nexport const useUniformField = <\n TFieldValues extends FieldValues = FieldValues,\n TDisplay = unknown,\n>(\n params: UseUniformFieldParams<TFieldValues, TDisplay>,\n): UseUniformFieldReturn<TFieldValues> => {\n const {\n name,\n ariaLabel: customAriaLabel,\n disabled = false,\n testId: explicitTestId,\n label,\n type,\n transform,\n } = params;\n\n const {\n control,\n debugMode,\n formState: { submitCount },\n getFieldState,\n getValues,\n resetField,\n } = useFormContext<TFieldValues>();\n\n const {\n error,\n invalid: rawInvalid,\n isTouched,\n required,\n testId,\n } = getFieldState(name, explicitTestId);\n\n const { field } = useController<TFieldValues>({\n control,\n disabled,\n name,\n });\n const {\n onChange: fieldOnChange,\n value: fieldValue,\n disabled: isDisabled,\n onBlur,\n ref,\n } = field;\n\n // Get transform utilities (but don't apply them automatically)\n // Components can choose how to use them (directly or via useInputValueDebounce)\n const { toDisplayValue, toFormValue } = useInputValueTransform<TDisplay>({\n type,\n transform,\n });\n\n // For components without special needs: apply transform to value and onChange\n const transformedValue = toDisplayValue(fieldValue);\n const transformedOnChange = (eventOrValue: TDisplay | React.ChangeEvent) => {\n // Extract value from event or use value directly\n const displayValue =\n (eventOrValue as React.ChangeEvent<HTMLInputElement>)?.target?.value ??\n eventOrValue;\n const formValue = toFormValue(displayValue as TDisplay);\n fieldOnChange(formValue as typeof fieldValue);\n };\n\n const defaultValue = (getValues() as Record<string, unknown>)?.[\n name as string\n ];\n\n /**\n * Determine when to show the invalid state to the user.\n *\n * Show errors when the field is invalid AND any of these conditions are met:\n * - Field has a value (show validation errors like format/length while typing)\n * - Field is touched (focused and blurred) - good for text inputs\n * - Form has been submitted - shows all errors after submit attempt\n *\n * Note: We intentionally don't use isDirty because:\n * - Newly added array elements are marked \"dirty\" by RHF, causing immediate errors\n * - Field Cards with empty initial values show errors immediately\n * - hasValue + isTouched covers the same use cases more reliably\n *\n * This prevents showing errors on pristine/untouched/empty fields for better UX.\n * Examples:\n * - Text input: User loads form with empty required field → no error shown yet\n * - Text input: User types invalid content → error shows immediately (has value)\n * - Text input: User focuses and blurs without typing → error shows (via isTouched)\n * - Checkbox/radio: User selects option → error shows immediately (has value)\n * - Field array: User adds element → no error yet; after blur → error shows\n * - Any field: User submits form → all errors show (via submitCount)\n *\n * The entire condition is debounced to prevent flickering and allow smooth animations.\n */\n\n // isValueEmpty handles marker strings, flat array wrappers, empty arrays, and empty objects\n const hasValue = !isValueEmpty(fieldValue);\n const showInvalid = rawInvalid && (hasValue || isTouched || submitCount > 0);\n // Debounce to prevent flickering during rapid state changes\n const invalid = useDebounce(showInvalid, 200);\n\n // Build a label node that:\n // - shows the provided label (unless explicitly set to false)\n // - appends a copy-to-clipboard button for the test id in `debug-testids` mode\n // Consumers can pass this directly to component `label` props\n const showTestIdCopyButton = debugMode === 'debug-testids';\n const labelNode: ReactNode | null =\n !!label || showTestIdCopyButton ? (\n <>\n {label !== false ? label : null}\n {showTestIdCopyButton ? (\n <FieldCopyTestIdButton testId={testId} />\n ) : null}\n </>\n ) : null;\n\n // Ready-to-render error message; consumers can drop this into their\n // component `errorMessage` prop without repeating mapping/markup\n const errorMessage = <FieldValidationError error={error} testId={testId} />;\n\n // Generate standardized props for label, helper wrapper and error message\n // so consumers can spread them directly into UI components (e.g. HeroUI),\n // keeping animations/spacing consistent across fields\n const { getErrorMessageProps, getLabelProps, getHelperWrapperProps } =\n useInput({\n ref,\n classNames: {\n // set padding to 0 for error message exit animation\n helperWrapper: 'p-0',\n },\n errorMessage: JSON.stringify(error),\n isInvalid: invalid,\n isRequired: required,\n label,\n labelPlacement: 'outside',\n });\n\n // Compute aria-label: prefer custom prop, then use string label if available, otherwise field name\n // Components can further override this based on their specific accessibility needs\n // (e.g., Input/TextArea may skip this if they have a meaningful placeholder)\n const ariaLabel =\n customAriaLabel ?? (typeof label === 'string' ? label : name);\n\n return {\n ariaLabel,\n control,\n debugMode,\n defaultValue,\n disabled: isDisabled,\n error,\n errorMessage,\n field: {\n ...field,\n value: transformedValue as typeof field.value,\n onChange: transformedOnChange as typeof field.onChange,\n },\n getErrorMessageProps,\n getHelperWrapperProps,\n getLabelProps,\n getValues,\n invalid,\n label: labelNode,\n onBlur,\n onChange: transformedOnChange as typeof field.onChange,\n ref,\n required,\n resetField,\n testId,\n };\n};\n","/* v8 ignore start */\n\nexport * from './useUniformField';\n\n/* v8 ignore stop */\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6GA,MAAa,mBAIX,WACwC;CACxC,MAAM,EACJ,MACA,WAAW,iBACX,WAAW,OACX,QAAQ,gBACR,OACA,MACA,cACE;CAEJ,MAAM,EACJ,SACA,WACA,WAAW,EAAE,eACb,eACA,WACA,eACE,gBAA8B;CAElC,MAAM,EACJ,OACA,SAAS,YACT,WACA,UACA,WACE,cAAc,MAAM,eAAe;CAEvC,MAAM,EAAE,UAAU,cAA4B;EAC5C;EACA;EACA;EACD,CAAC;CACF,MAAM,EACJ,UAAU,eACV,OAAO,YACP,UAAU,YACV,QACA,QACE;CAIJ,MAAM,EAAE,gBAAgB,gBAAgB,uBAAiC;EACvE;EACA;EACD,CAAC;CAGF,MAAM,mBAAmB,eAAe,WAAW;CACnD,MAAM,uBAAuB,iBAA+C;AAM1E,gBADkB,YAFf,cAAsD,QAAQ,SAC/D,aACqD,CACV;;CAG/C,MAAM,eAAgB,WAAW,GAC/B;;;;;;;;;;;;;;;;;;;;;;;;;CA6BF,MAAM,WAAW,CAAC,aAAa,WAAW;CAG1C,MAAM,UAAU,YAFI,eAAe,YAAY,aAAa,cAAc,IAEjC,IAAI;CAM7C,MAAM,uBAAuB,cAAc;CAC3C,MAAM,YACJ,CAAC,CAAC,SAAS,uBACT,4CACG,UAAU,QAAQ,QAAQ,MAC1B,uBACC,oBAACA,iCAA8B,SAAU,GACvC,QACH,GACD;CAIN,MAAM,eAAe,oBAACC;EAA4B;EAAe;GAAU;CAK3E,MAAM,EAAE,sBAAsB,eAAe,0BAC3C,SAAS;EACP;EACA,YAAY,EAEV,eAAe,OAChB;EACD,cAAc,KAAK,UAAU,MAAM;EACnC,WAAW;EACX,YAAY;EACZ;EACA,gBAAgB;EACjB,CAAC;AAQJ,QAAO;EACL,WAHA,oBAAoB,OAAO,UAAU,WAAW,QAAQ;EAIxD;EACA;EACA;EACA,UAAU;EACV;EACA;EACA,OAAO;GACL,GAAG;GACH,OAAO;GACP,UAAU;GACX;EACD;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;EACA,UAAU;EACV;EACA;EACA;EACA;EACD"}
@@ -1,84 +0,0 @@
1
- import { t as flatArrayKey } from "./helpers-33jajRcN.js";
2
- import { n as useFormContext$1 } from "./useFormContext-Di67HIf7.js";
3
- import { t as useUniformField } from "./useUniformField-C-Xyu-8v.js";
4
- import { useEffect, useMemo, useRef, useState } from "react";
5
- import { useReducedMotion } from "@fuf-stack/pixel-motion";
6
- import { useFieldArray } from "react-hook-form";
7
-
8
- //#region src/hooks/useUniformFieldArray/useUniformFieldArray.ts
9
- /**
10
- * Enhanced useFieldArray hook with initialization and animation logic.
11
- * Based on React Hook Form's useFieldArray with additional features:
12
- * - Automatic initialization when lastElementNotRemovable is set
13
- * - Animation control (disabled during initialization)
14
- * - Support for flat arrays (arrays of primitives)
15
- *
16
- * Note: Automatic validation triggering on length change is disabled to prevent
17
- * triggering form-wide validation. Array validation still runs on form submission.
18
- *
19
- * @see https://react-hook-form.com/docs/usefieldarray
20
- */
21
- const useUniformFieldArray = ({ name, flat = false, elementInitialValue: _elementInitialValue = null, lastElementNotRemovable = false, disabled, testId: explicitTestId, label }) => {
22
- const uniformField = useUniformField({
23
- name,
24
- disabled,
25
- testId: explicitTestId,
26
- label
27
- });
28
- const { control } = uniformField;
29
- const { fields, append, remove, insert, move } = useFieldArray({
30
- control,
31
- name
32
- });
33
- const { trigger, setValue } = useFormContext$1();
34
- const needsInitialize = useMemo(() => {
35
- return lastElementNotRemovable && fields.length === 0;
36
- }, [lastElementNotRemovable, fields.length]);
37
- const hasInitialized = useRef(!needsInitialize);
38
- useEffect(() => {
39
- if (needsInitialize) hasInitialized.current = false;
40
- }, [needsInitialize]);
41
- useEffect(() => {
42
- if (hasInitialized.current) setTimeout(() => {
43
- trigger(name);
44
- }, 200);
45
- }, [fields.length]);
46
- const [disableAnimation, setDisableAnimation] = useState(true);
47
- const prefersReducedMotion = useReducedMotion();
48
- useEffect(() => {
49
- if (hasInitialized.current) setDisableAnimation(!!prefersReducedMotion);
50
- }, [prefersReducedMotion]);
51
- const elementInitialValue = useMemo(() => {
52
- return flat ? { [flatArrayKey]: _elementInitialValue ?? null } : _elementInitialValue ?? {};
53
- }, [flat, _elementInitialValue]);
54
- useEffect(() => {
55
- if (needsInitialize) {
56
- setValue(name, [elementInitialValue], {
57
- shouldDirty: false,
58
- shouldTouch: false
59
- });
60
- hasInitialized.current = true;
61
- if (!prefersReducedMotion && disableAnimation) setTimeout(() => {
62
- setDisableAnimation(false);
63
- }, 1);
64
- }
65
- }, [needsInitialize]);
66
- return {
67
- fields,
68
- append,
69
- remove,
70
- insert,
71
- move,
72
- disableAnimation,
73
- elementInitialValue,
74
- ...uniformField
75
- };
76
- };
77
-
78
- //#endregion
79
- //#region src/hooks/useUniformFieldArray/index.ts
80
- /* v8 ignore stop */
81
-
82
- //#endregion
83
- export { useUniformFieldArray as t };
84
- //# sourceMappingURL=useUniformFieldArray-BKvA0FQW.js.map