@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.
- package/dist/Checkboxes/index.cjs +7 -5
- package/dist/Checkboxes/index.d.cts +1 -1
- package/dist/Checkboxes/index.d.ts +1 -1
- package/dist/Checkboxes/index.js +2 -3
- package/dist/{Checkboxes-BGrK_mwQ.js → Checkboxes-D1hppxDE.js} +7 -10
- package/dist/Checkboxes-D1hppxDE.js.map +1 -0
- package/dist/{Checkboxes-Dk7yyRVR.cjs → Checkboxes-DegQ22uN.cjs} +18 -21
- package/dist/Checkboxes-DegQ22uN.cjs.map +1 -0
- package/dist/FieldArray/index.cjs +7 -5
- package/dist/FieldArray/index.d.cts +1 -1
- package/dist/FieldArray/index.d.ts +1 -1
- package/dist/FieldArray/index.js +2 -3
- package/dist/{FieldArray-Bs2ViU8m.js → FieldArray-BVL5Tz0Q.js} +51 -71
- package/dist/FieldArray-BVL5Tz0Q.js.map +1 -0
- package/dist/{FieldArray-C6RHZcKa.cjs → FieldArray-CeiNCobX.cjs} +66 -86
- package/dist/FieldArray-CeiNCobX.cjs.map +1 -0
- package/dist/FieldCard/index.cjs +4 -4
- package/dist/FieldCard/index.d.cts +1 -1
- package/dist/FieldCard/index.d.ts +1 -1
- package/dist/FieldCard/index.js +2 -3
- package/dist/{FieldCard-BxK_IJOR.cjs → FieldCard-C0kNSLj7.cjs} +20 -24
- package/dist/FieldCard-C0kNSLj7.cjs.map +1 -0
- package/dist/{FieldCard-16yCF83m.js → FieldCard-SjYNs4sL.js} +8 -12
- package/dist/FieldCard-SjYNs4sL.js.map +1 -0
- package/dist/{FieldCopyTestIdButton-BoEdlzLs.js → FieldCopyTestIdButton-Dpmo0uBV.js} +4 -7
- package/dist/FieldCopyTestIdButton-Dpmo0uBV.js.map +1 -0
- package/dist/{FieldCopyTestIdButton-4uupFq1U.cjs → FieldCopyTestIdButton-DrUzXwTo.cjs} +14 -17
- package/dist/FieldCopyTestIdButton-DrUzXwTo.cjs.map +1 -0
- package/dist/{FieldValidationError-Br6iopZj.cjs → FieldValidationError-8H8LxDjk.cjs} +14 -17
- package/dist/FieldValidationError-8H8LxDjk.cjs.map +1 -0
- package/dist/{FieldValidationError-XQaViV52.js → FieldValidationError-ktTyyyip.js} +4 -7
- package/dist/FieldValidationError-ktTyyyip.js.map +1 -0
- package/dist/Form/index.cjs +7 -5
- package/dist/Form/index.d.cts +1 -1
- package/dist/Form/index.d.ts +1 -2
- package/dist/Form/index.js +2 -3
- package/dist/{Form--SsSvsxl.cjs → Form-Dqa1b7Y7.cjs} +17 -22
- package/dist/Form-Dqa1b7Y7.cjs.map +1 -0
- package/dist/{Form-ccsEssie.js → Form-Wzy7pBVt.js} +8 -13
- package/dist/Form-Wzy7pBVt.js.map +1 -0
- package/dist/{FormContext-CCe8drkp.d.ts → FormContext-B4KQxdl7.d.ts} +1 -1
- package/dist/{FormContext-CCe8drkp.d.ts.map → FormContext-B4KQxdl7.d.ts.map} +1 -1
- package/dist/{FormContext-BSLO2-sO.cjs → FormContext-BrY1FQYR.cjs} +29 -37
- package/dist/{FormContext-BSLO2-sO.cjs.map → FormContext-BrY1FQYR.cjs.map} +1 -1
- package/dist/{FormContext-RSA21aDt.d.cts → FormContext-BuG3xZFe.d.cts} +1 -1
- package/dist/{FormContext-RSA21aDt.d.cts.map → FormContext-BuG3xZFe.d.cts.map} +1 -1
- package/dist/{FormContext-kE3YKhp_.js → FormContext-CLfMWHQM.js} +4 -7
- package/dist/{FormContext-kE3YKhp_.js.map → FormContext-CLfMWHQM.js.map} +1 -1
- package/dist/Grid/index.cjs +7 -5
- package/dist/Grid/index.d.cts +1 -1
- package/dist/Grid/index.d.ts +1 -1
- package/dist/Grid/index.js +2 -3
- package/dist/{Grid-BaqBa1ku.js → Grid-Bzyi97Cx.js} +4 -7
- package/dist/Grid-Bzyi97Cx.js.map +1 -0
- package/dist/{Grid-D5Yf0nD_.cjs → Grid-DdYQQ_UM.cjs} +14 -17
- package/dist/Grid-DdYQQ_UM.cjs.map +1 -0
- package/dist/Input/index.cjs +7 -5
- package/dist/Input/index.d.cts +1 -1
- package/dist/Input/index.d.ts +1 -1
- package/dist/Input/index.js +2 -3
- package/dist/{Input-BCs_eyJ9.js → Input-BDWP4hOr.js} +6 -9
- package/dist/{Input-BCs_eyJ9.js.map → Input-BDWP4hOr.js.map} +1 -1
- package/dist/{Input-B3p_4ntD.cjs → Input-BXJ4DSha.cjs} +18 -21
- package/dist/Input-BXJ4DSha.cjs.map +1 -0
- package/dist/RadioBoxes/index.cjs +7 -5
- package/dist/RadioBoxes/index.d.cts +1 -1
- package/dist/RadioBoxes/index.d.ts +1 -1
- package/dist/RadioBoxes/index.js +2 -3
- package/dist/{RadioBoxes-C3Cwrn2I.js → RadioBoxes-BR3X986V.js} +16 -23
- package/dist/RadioBoxes-BR3X986V.js.map +1 -0
- package/dist/{RadioBoxes-xRvNe5U8.cjs → RadioBoxes-Cim3InDW.cjs} +33 -40
- package/dist/RadioBoxes-Cim3InDW.cjs.map +1 -0
- package/dist/RadioTabs/index.cjs +7 -5
- package/dist/RadioTabs/index.d.cts +1 -1
- package/dist/RadioTabs/index.d.ts +1 -1
- package/dist/RadioTabs/index.js +2 -3
- package/dist/{RadioTabs-DfOGIsEf.js → RadioTabs-CsVqYCE9.js} +6 -9
- package/dist/RadioTabs-CsVqYCE9.js.map +1 -0
- package/dist/{RadioTabs-BaHvYcd-.cjs → RadioTabs-t-x2XnuI.cjs} +18 -21
- package/dist/RadioTabs-t-x2XnuI.cjs.map +1 -0
- package/dist/Radios/index.cjs +7 -5
- package/dist/Radios/index.d.cts +1 -1
- package/dist/Radios/index.d.ts +1 -1
- package/dist/Radios/index.js +2 -3
- package/dist/{Radios-xM-09vB5.js → Radios-CYwW3bZa.js} +13 -19
- package/dist/Radios-CYwW3bZa.js.map +1 -0
- package/dist/{Radios-BfA3uL35.cjs → Radios-CjEFdyD6.cjs} +25 -31
- package/dist/Radios-CjEFdyD6.cjs.map +1 -0
- package/dist/Select/index.cjs +7 -5
- package/dist/Select/index.d.cts +1 -1
- package/dist/Select/index.d.ts +1 -1
- package/dist/Select/index.js +2 -3
- package/dist/{Select-DH_YaruM.cjs → Select-BEed8xan.cjs} +23 -28
- package/dist/Select-BEed8xan.cjs.map +1 -0
- package/dist/{Select-DlEUzYl6.js → Select-BILyyM7Z.js} +9 -14
- package/dist/Select-BILyyM7Z.js.map +1 -0
- package/dist/Slider/index.cjs +7 -5
- package/dist/Slider/index.d.cts +1 -1
- package/dist/Slider/index.d.ts +1 -1
- package/dist/Slider/index.js +2 -3
- package/dist/{Slider-C-dMrJZ6.cjs → Slider-CFYP86ku.cjs} +16 -19
- package/dist/Slider-CFYP86ku.cjs.map +1 -0
- package/dist/{Slider-CTFuVrp2.js → Slider-DxRcLu-j.js} +5 -8
- package/dist/{Slider-CTFuVrp2.js.map → Slider-DxRcLu-j.js.map} +1 -1
- package/dist/SubmitButton/index.cjs +7 -5
- package/dist/SubmitButton/index.d.cts +1 -1
- package/dist/SubmitButton/index.d.ts +1 -1
- package/dist/SubmitButton/index.js +2 -3
- package/dist/{SubmitButton-Bh1RN0F1.js → SubmitButton-Bu3NNFyt.js} +5 -8
- package/dist/SubmitButton-Bu3NNFyt.js.map +1 -0
- package/dist/{SubmitButton-CJ6s1mZr.cjs → SubmitButton-D7xacDyS.cjs} +15 -18
- package/dist/SubmitButton-D7xacDyS.cjs.map +1 -0
- package/dist/Switch/index.cjs +7 -5
- package/dist/Switch/index.d.cts +1 -1
- package/dist/Switch/index.d.ts +1 -1
- package/dist/Switch/index.js +2 -3
- package/dist/{Switch-CXrz-M3V.js → Switch-CMpXZdLc.js} +5 -8
- package/dist/{Switch-CXrz-M3V.js.map → Switch-CMpXZdLc.js.map} +1 -1
- package/dist/{Switch-CeUMwheZ.cjs → Switch-Dt9TGQ8d.cjs} +16 -19
- package/dist/Switch-Dt9TGQ8d.cjs.map +1 -0
- package/dist/SwitchBox/index.cjs +7 -5
- package/dist/SwitchBox/index.d.cts +1 -1
- package/dist/SwitchBox/index.d.ts +1 -1
- package/dist/SwitchBox/index.js +2 -3
- package/dist/{SwitchBox-C-aLl2nX.js → SwitchBox-Cg7NPfp_.js} +5 -8
- package/dist/SwitchBox-Cg7NPfp_.js.map +1 -0
- package/dist/{SwitchBox-mGUPvJE0.cjs → SwitchBox-DMPp_Ed-.cjs} +21 -24
- package/dist/SwitchBox-DMPp_Ed-.cjs.map +1 -0
- package/dist/TextArea/index.cjs +7 -5
- package/dist/TextArea/index.d.cts +1 -1
- package/dist/TextArea/index.d.ts +1 -1
- package/dist/TextArea/index.js +2 -3
- package/dist/{TextArea-BLkVYmHZ.js → TextArea-Bxi2pXvY.js} +6 -9
- package/dist/TextArea-Bxi2pXvY.js.map +1 -0
- package/dist/{TextArea-BYEuk4Ng.cjs → TextArea-DDwzXW-y.cjs} +18 -21
- package/dist/TextArea-DDwzXW-y.cjs.map +1 -0
- package/dist/helpers/index.cjs +397 -10
- package/dist/helpers/index.cjs.map +1 -0
- package/dist/helpers/index.d.cts +224 -2
- package/dist/helpers/index.d.cts.map +1 -0
- package/dist/helpers/index.d.ts +224 -2
- package/dist/helpers/index.d.ts.map +1 -0
- package/dist/helpers/index.js +387 -2
- package/dist/helpers/index.js.map +1 -0
- package/dist/hooks/useClientValidation/index.cjs +3 -3
- package/dist/hooks/useClientValidation/index.d.cts +1 -1
- package/dist/hooks/useClientValidation/index.d.ts +1 -1
- package/dist/hooks/useClientValidation/index.js +2 -3
- package/dist/hooks/useController/index.cjs +3 -3
- package/dist/hooks/useController/index.d.cts +1 -1
- package/dist/hooks/useController/index.d.ts +1 -1
- package/dist/hooks/useController/index.js +2 -3
- package/dist/hooks/useFormContext/index.cjs +8 -3
- package/dist/hooks/useFormContext/index.cjs.map +1 -0
- package/dist/hooks/useFormContext/index.d.cts +1 -1
- package/dist/hooks/useFormContext/index.d.ts +1 -3
- package/dist/hooks/useFormContext/index.js +6 -2
- package/dist/hooks/useFormContext/index.js.map +1 -0
- package/dist/hooks/useInput/index.cjs +8 -8
- package/dist/hooks/useInput/index.d.cts +1 -1
- package/dist/hooks/useInput/index.d.ts +1 -1
- package/dist/hooks/useInput/index.js +2 -3
- package/dist/hooks/useInputValueDebounce/index.cjs +92 -2
- package/dist/hooks/useInputValueDebounce/index.cjs.map +1 -0
- package/dist/hooks/useInputValueDebounce/index.d.cts +1 -1
- package/dist/hooks/useInputValueDebounce/index.d.ts +1 -1
- package/dist/hooks/useInputValueDebounce/index.js +90 -2
- package/dist/hooks/useInputValueDebounce/index.js.map +1 -0
- package/dist/hooks/useInputValueTransform/index.cjs +3 -3
- package/dist/hooks/useInputValueTransform/index.d.cts +1 -1
- package/dist/hooks/useInputValueTransform/index.d.ts +1 -1
- package/dist/hooks/useInputValueTransform/index.js +2 -3
- package/dist/hooks/useUniformField/index.cjs +135 -2
- package/dist/hooks/useUniformField/index.cjs.map +1 -0
- package/dist/hooks/useUniformField/index.d.cts +1 -1
- package/dist/hooks/useUniformField/index.d.ts +1 -5
- package/dist/hooks/useUniformField/index.js +132 -2
- package/dist/hooks/useUniformField/index.js.map +1 -0
- package/dist/hooks/useUniformFieldArray/index.cjs +83 -2
- package/dist/hooks/useUniformFieldArray/index.cjs.map +1 -0
- package/dist/hooks/useUniformFieldArray/index.d.cts +1 -1
- package/dist/hooks/useUniformFieldArray/index.d.ts +1 -26
- package/dist/hooks/useUniformFieldArray/index.js +81 -2
- package/dist/hooks/useUniformFieldArray/index.js.map +1 -0
- package/dist/hooks/useWatchUserChange/index.cjs +3 -3
- package/dist/hooks/useWatchUserChange/index.d.cts +1 -1
- package/dist/hooks/useWatchUserChange/index.d.ts +1 -1
- package/dist/hooks/useWatchUserChange/index.js +2 -3
- package/dist/{index-TmijvCD0.d.ts → index-25CYKzg4.d.cts} +22 -22
- package/dist/index-25CYKzg4.d.cts.map +1 -0
- package/dist/{index-CeiIXmAI.d.cts → index-3e3711-8.d.cts} +36 -36
- package/dist/index-3e3711-8.d.cts.map +1 -0
- package/dist/{index-E6etS7_8.d.ts → index-6hu79Fof.d.ts} +34 -34
- package/dist/index-6hu79Fof.d.ts.map +1 -0
- package/dist/index-AmOFlE3L.d.cts +278 -0
- package/dist/index-AmOFlE3L.d.cts.map +1 -0
- package/dist/{index-wwmQClW-.d.cts → index-B-6CMF1H.d.ts} +21 -21
- package/dist/index-B-6CMF1H.d.ts.map +1 -0
- package/dist/{index-ahxY6Q0X.d.cts → index-B6WwxkLx2.d.ts} +3 -3
- package/dist/index-B6WwxkLx2.d.ts.map +1 -0
- package/dist/{index-BlJFGN_o.d.ts → index-B9lVf5LI.d.ts} +48 -48
- package/dist/index-B9lVf5LI.d.ts.map +1 -0
- package/dist/{index-ttNINAv3.d.ts → index-BV1VKQdy.d.cts} +3 -3
- package/dist/{index-qo0Ta_R3.d.cts.map → index-BV1VKQdy.d.cts.map} +1 -1
- package/dist/{index-C1-F9Ga-.d.cts → index-BdYKQ59a.d.cts} +7 -7
- package/dist/index-BdYKQ59a.d.cts.map +1 -0
- package/dist/{index-Bl1Adhfx.d.ts → index-BwAI1VFS.d.ts} +6 -6
- package/dist/index-BwAI1VFS.d.ts.map +1 -0
- package/dist/{index-BsCPUK2g.d.cts → index-BzIB-MQg.d.cts} +48 -48
- package/dist/index-BzIB-MQg.d.cts.map +1 -0
- package/dist/{index-DFzyOxvt.d.cts → index-C-DiLZRu.d.cts} +6 -6
- package/dist/index-C-DiLZRu.d.cts.map +1 -0
- package/dist/{index-BKQc5PQn.d.cts → index-C9up4f3f.d.cts} +34 -34
- package/dist/index-C9up4f3f.d.cts.map +1 -0
- package/dist/{index-Dty4h2eA.d.ts → index-CE0aQlFw.d.ts} +7 -7
- package/dist/index-CE0aQlFw.d.ts.map +1 -0
- package/dist/{index-BrMk3Wee.d.ts → index-CY2Mpaz3.d.cts} +4 -4
- package/dist/index-CY2Mpaz3.d.cts.map +1 -0
- package/dist/index-CuRn5Thx.d.ts +278 -0
- package/dist/index-CuRn5Thx.d.ts.map +1 -0
- package/dist/{index-qo0Ta_R3.d.cts → index-Cv4ERj3i.d.ts} +3 -3
- package/dist/{index-ttNINAv3.d.ts.map → index-Cv4ERj3i.d.ts.map} +1 -1
- package/dist/{index-ByyEP8UR.d.cts → index-D6XwSwTP.d.cts} +6 -6
- package/dist/{index-ByyEP8UR.d.cts.map → index-D6XwSwTP.d.cts.map} +1 -1
- package/dist/{index-Dr06SNZN.d.cts → index-DD_RPe91.d.ts} +4 -4
- package/dist/index-DD_RPe91.d.ts.map +1 -0
- package/dist/{index-DLR8z1lG.d.cts → index-DFWSHdua.d.ts} +3 -3
- package/dist/{index-CPkTYivq.d.ts.map → index-DFWSHdua.d.ts.map} +1 -1
- package/dist/{index-B0rp5NJy.d.cts → index-DMwNV_Br.d.cts} +35 -36
- package/dist/index-DMwNV_Br.d.cts.map +1 -0
- package/dist/index-DeEmP3Jc.d.cts +1 -0
- package/dist/{index-mmk9VKYu.d.ts → index-DiD7s23-.d.cts} +21 -21
- package/dist/index-DiD7s23-.d.cts.map +1 -0
- package/dist/{index--NM5Ctp6.d.ts → index-Dj3NDj0T.d.ts} +4 -4
- package/dist/{index--NM5Ctp6.d.ts.map → index-Dj3NDj0T.d.ts.map} +1 -1
- package/dist/{index-CPkTYivq.d.ts → index-DkiQkdCW.d.cts} +3 -3
- package/dist/{index-DLR8z1lG.d.cts.map → index-DkiQkdCW.d.cts.map} +1 -1
- package/dist/{index-CI0AWMsR.d.ts → index-DkxqHE_P2.d.ts} +3 -3
- package/dist/{index-B7Xz_OY2.d.cts.map → index-DkxqHE_P2.d.ts.map} +1 -1
- package/dist/{index-B7Xz_OY2.d.cts → index-Dld6NP_K.d.cts} +3 -3
- package/dist/index-Dld6NP_K.d.cts.map +1 -0
- package/dist/{index-CZq5eXSP.d.ts → index-DlebotZ4.d.ts} +36 -36
- package/dist/index-DlebotZ4.d.ts.map +1 -0
- package/dist/index-DsC0y6kU.d.cts +70 -0
- package/dist/index-DsC0y6kU.d.cts.map +1 -0
- package/dist/index-DwqOejxR.d.ts +70 -0
- package/dist/index-DwqOejxR.d.ts.map +1 -0
- package/dist/{index-BaxXDaOZ.d.ts → index-Gs3zrYoY.d.ts} +35 -37
- package/dist/index-Gs3zrYoY.d.ts.map +1 -0
- package/dist/{index-BlX_mF6D.d.cts → index-N5wvPOq3.d.ts} +22 -22
- package/dist/index-N5wvPOq3.d.ts.map +1 -0
- package/dist/{index-BNYtqtXt.d.cts → index-NjKV8LJD.d.cts} +4 -4
- package/dist/{index-BNYtqtXt.d.cts.map → index-NjKV8LJD.d.cts.map} +1 -1
- package/dist/{index-DVZCz730.d.ts → index-fgARdsoB.d.ts} +6 -6
- package/dist/{index-DVZCz730.d.ts.map → index-fgARdsoB.d.ts.map} +1 -1
- package/dist/{index-CMehV9mc.d.ts → index-jCfJAgDc.d.cts} +3 -3
- package/dist/index-jCfJAgDc.d.cts.map +1 -0
- package/dist/{index--KhDRPu3.d.cts → index-pwXVq8hR.d.cts} +6 -6
- package/dist/index-pwXVq8hR.d.cts.map +1 -0
- package/dist/index-sQecLSpR.d.cts +1 -0
- package/dist/{index-BgyvEfYZ.d.ts → index-wV1E_PkS.d.ts} +6 -6
- package/dist/index-wV1E_PkS.d.ts.map +1 -0
- package/dist/index.cjs +63 -63
- package/dist/index.d.cts +27 -27
- package/dist/index.d.ts +27 -29
- package/dist/index.js +29 -30
- package/dist/partials/FieldCopyTestIdButton/index.cjs +7 -5
- package/dist/partials/FieldCopyTestIdButton/index.d.cts +1 -1
- package/dist/partials/FieldCopyTestIdButton/index.d.ts +1 -1
- package/dist/partials/FieldCopyTestIdButton/index.js +2 -3
- package/dist/partials/FieldValidationError/index.cjs +7 -5
- package/dist/partials/FieldValidationError/index.d.cts +1 -1
- package/dist/partials/FieldValidationError/index.d.ts +1 -1
- package/dist/partials/FieldValidationError/index.js +2 -3
- package/dist/{useClientValidation-B4xrGBJZ.d.ts → useClientValidation-BWElhQ91.d.ts} +2 -3
- package/dist/useClientValidation-BWElhQ91.d.ts.map +1 -0
- package/dist/{useClientValidation-DksyV18M.js → useClientValidation-Dn_kJkE5.js} +5 -6
- package/dist/{useClientValidation-DksyV18M.js.map → useClientValidation-Dn_kJkE5.js.map} +1 -1
- package/dist/{useClientValidation-B_dYQB5o.d.cts → useClientValidation-DtnfCE5T.d.cts} +2 -3
- package/dist/{useClientValidation-B4xrGBJZ.d.ts.map → useClientValidation-DtnfCE5T.d.cts.map} +1 -1
- package/dist/{useClientValidation-Dnj_wuwf.cjs → useClientValidation-NKOuXuHV.cjs} +16 -17
- package/dist/useClientValidation-NKOuXuHV.cjs.map +1 -0
- package/dist/{useController-NjuthTyL.js → useController-B-6PzFna.js} +4 -5
- package/dist/{useController-NjuthTyL.js.map → useController-B-6PzFna.js.map} +1 -1
- package/dist/{useController-D8MEXnmB.d.cts → useController-CNiqy_2D.d.cts} +1 -1
- package/dist/{useController-D8MEXnmB.d.cts.map → useController-CNiqy_2D.d.cts.map} +1 -1
- package/dist/{useController-CHOpoCoz.d.ts → useController-Cc0UNQMm.d.ts} +1 -1
- package/dist/{useController-CHOpoCoz.d.ts.map → useController-Cc0UNQMm.d.ts.map} +1 -1
- package/dist/{useController-B_SSp5Z5.cjs → useController-DVRh86Zy.cjs} +11 -12
- package/dist/{useController-B_SSp5Z5.cjs.map → useController-DVRh86Zy.cjs.map} +1 -1
- package/dist/{useFormContext-vdeeDsAs.cjs → useFormContext-Bum4VP1o.cjs} +20 -21
- package/dist/{useFormContext-vdeeDsAs.cjs.map → useFormContext-Bum4VP1o.cjs.map} +1 -1
- package/dist/{useFormContext-Di67HIf7.js → useFormContext-Bzpyonu6.js} +5 -6
- package/dist/{useFormContext-Di67HIf7.js.map → useFormContext-Bzpyonu6.js.map} +1 -1
- package/dist/{useFormContext-C6OOtqZ5.d.ts → useFormContext-DEMm-bsc.d.ts} +22 -22
- package/dist/useFormContext-DEMm-bsc.d.ts.map +1 -0
- package/dist/{useFormContext-Dh97YG47.d.cts → useFormContext-Dey5DbWr.d.cts} +22 -22
- package/dist/useFormContext-Dey5DbWr.d.cts.map +1 -0
- package/dist/{useInput-BWzvIUpW.js → useInput-CVm3tP78.js} +1 -2
- package/dist/{useInputValueDebounce-ZLyAmuXV.d.cts → useInputValueDebounce-puGRVJ6t.d.cts} +1 -1
- package/dist/{useInputValueDebounce-ZLyAmuXV.d.cts.map → useInputValueDebounce-puGRVJ6t.d.cts.map} +1 -1
- package/dist/{useInputValueDebounce-Dhlv1NUY.d.ts → useInputValueDebounce-sFOlecIQ.d.ts} +1 -1
- package/dist/{useInputValueDebounce-Dhlv1NUY.d.ts.map → useInputValueDebounce-sFOlecIQ.d.ts.map} +1 -1
- package/dist/{useInputValueTransform-CNCBU7a9.d.cts → useInputValueTransform-BwAfw8Xb.d.cts} +1 -1
- package/dist/{useInputValueTransform-CNCBU7a9.d.cts.map → useInputValueTransform-BwAfw8Xb.d.cts.map} +1 -1
- package/dist/{useInputValueTransform-C-fmz3ke.js → useInputValueTransform-CXdmtc0Q.js} +2 -3
- package/dist/{useInputValueTransform-C-fmz3ke.js.map → useInputValueTransform-CXdmtc0Q.js.map} +1 -1
- package/dist/{useInputValueTransform-tsMNM7g_.d.ts → useInputValueTransform-CdoaxNyD.d.ts} +1 -1
- package/dist/{useInputValueTransform-tsMNM7g_.d.ts.map → useInputValueTransform-CdoaxNyD.d.ts.map} +1 -1
- package/dist/{useInputValueTransform-BBRvvhDe.cjs → useInputValueTransform-DKH-7F9D.cjs} +8 -9
- package/dist/{useInputValueTransform-BBRvvhDe.cjs.map → useInputValueTransform-DKH-7F9D.cjs.map} +1 -1
- package/dist/{useUniformField-Bd_oDkYE.d.cts → useUniformField-DB8jF52F.d.cts} +5 -5
- package/dist/{useUniformField-Bd_oDkYE.d.cts.map → useUniformField-DB8jF52F.d.cts.map} +1 -1
- package/dist/{useUniformField-BDKjYBKu.d.ts → useUniformField-iHk8xYXN.d.ts} +5 -5
- package/dist/{useUniformField-BDKjYBKu.d.ts.map → useUniformField-iHk8xYXN.d.ts.map} +1 -1
- package/dist/{useUniformFieldArray-lV3Nbum2.d.ts → useUniformFieldArray-B0SPtHeT.d.ts} +18 -18
- package/dist/useUniformFieldArray-B0SPtHeT.d.ts.map +1 -0
- package/dist/{useUniformFieldArray-CWiaXKO6.d.cts → useUniformFieldArray-okvikMJp.d.cts} +18 -18
- package/dist/useUniformFieldArray-okvikMJp.d.cts.map +1 -0
- package/dist/{useWatchUserChange-C1Kluht2.cjs → useWatchUserChange-CBuIa5kU.cjs} +9 -10
- package/dist/{useWatchUserChange-C1Kluht2.cjs.map → useWatchUserChange-CBuIa5kU.cjs.map} +1 -1
- package/dist/{useWatchUserChange-BnnrFjyq.d.ts → useWatchUserChange-CH4x16_r.d.ts} +1 -1
- package/dist/{useWatchUserChange-BnnrFjyq.d.ts.map → useWatchUserChange-CH4x16_r.d.ts.map} +1 -1
- package/dist/{useWatchUserChange-Dj9Imxfi.js → useWatchUserChange-CLgLc5W4.js} +3 -4
- package/dist/{useWatchUserChange-Dj9Imxfi.js.map → useWatchUserChange-CLgLc5W4.js.map} +1 -1
- package/dist/{useWatchUserChange-DalJOKBC.d.cts → useWatchUserChange-CZu_ZZ38.d.cts} +1 -1
- package/dist/{useWatchUserChange-DalJOKBC.d.cts.map → useWatchUserChange-CZu_ZZ38.d.cts.map} +1 -1
- package/package.json +74 -70
- package/dist/Checkboxes-BGrK_mwQ.js.map +0 -1
- package/dist/Checkboxes-Dk7yyRVR.cjs.map +0 -1
- package/dist/FieldArray-Bs2ViU8m.js.map +0 -1
- package/dist/FieldArray-C6RHZcKa.cjs.map +0 -1
- package/dist/FieldCard-16yCF83m.js.map +0 -1
- package/dist/FieldCard-BxK_IJOR.cjs.map +0 -1
- package/dist/FieldCopyTestIdButton-4uupFq1U.cjs.map +0 -1
- package/dist/FieldCopyTestIdButton-BoEdlzLs.js.map +0 -1
- package/dist/FieldValidationError-Br6iopZj.cjs.map +0 -1
- package/dist/FieldValidationError-XQaViV52.js.map +0 -1
- package/dist/Form--SsSvsxl.cjs.map +0 -1
- package/dist/Form-ccsEssie.js.map +0 -1
- package/dist/Grid-BaqBa1ku.js.map +0 -1
- package/dist/Grid-D5Yf0nD_.cjs.map +0 -1
- package/dist/Input-B3p_4ntD.cjs.map +0 -1
- package/dist/RadioBoxes-C3Cwrn2I.js.map +0 -1
- package/dist/RadioBoxes-xRvNe5U8.cjs.map +0 -1
- package/dist/RadioTabs-BaHvYcd-.cjs.map +0 -1
- package/dist/RadioTabs-DfOGIsEf.js.map +0 -1
- package/dist/Radios-BfA3uL35.cjs.map +0 -1
- package/dist/Radios-xM-09vB5.js.map +0 -1
- package/dist/Select-DH_YaruM.cjs.map +0 -1
- package/dist/Select-DlEUzYl6.js.map +0 -1
- package/dist/Slider-C-dMrJZ6.cjs.map +0 -1
- package/dist/SubmitButton-Bh1RN0F1.js.map +0 -1
- package/dist/SubmitButton-CJ6s1mZr.cjs.map +0 -1
- package/dist/Switch-CeUMwheZ.cjs.map +0 -1
- package/dist/SwitchBox-C-aLl2nX.js.map +0 -1
- package/dist/SwitchBox-mGUPvJE0.cjs.map +0 -1
- package/dist/TextArea-BLkVYmHZ.js.map +0 -1
- package/dist/TextArea-BYEuk4Ng.cjs.map +0 -1
- package/dist/helpers-33jajRcN.js +0 -390
- package/dist/helpers-33jajRcN.js.map +0 -1
- package/dist/helpers-Bd_QpqXg.cjs +0 -444
- package/dist/helpers-Bd_QpqXg.cjs.map +0 -1
- package/dist/index--KhDRPu3.d.cts.map +0 -1
- package/dist/index-B0rp5NJy.d.cts.map +0 -1
- package/dist/index-BBw9RSKy.d.ts +0 -278
- package/dist/index-BBw9RSKy.d.ts.map +0 -1
- package/dist/index-BKQc5PQn.d.cts.map +0 -1
- package/dist/index-BLgXFM85.d.cts +0 -224
- package/dist/index-BLgXFM85.d.cts.map +0 -1
- package/dist/index-BaxXDaOZ.d.ts.map +0 -1
- package/dist/index-BgyvEfYZ.d.ts.map +0 -1
- package/dist/index-BjHnNRSC.d.cts +0 -278
- package/dist/index-BjHnNRSC.d.cts.map +0 -1
- package/dist/index-Bl1Adhfx.d.ts.map +0 -1
- package/dist/index-BlJFGN_o.d.ts.map +0 -1
- package/dist/index-BlX_mF6D.d.cts.map +0 -1
- package/dist/index-BrMk3Wee.d.ts.map +0 -1
- package/dist/index-BsCPUK2g.d.cts.map +0 -1
- package/dist/index-C1-F9Ga-.d.cts.map +0 -1
- package/dist/index-CI0AWMsR.d.ts.map +0 -1
- package/dist/index-CMehV9mc.d.ts.map +0 -1
- package/dist/index-CZq5eXSP.d.ts.map +0 -1
- package/dist/index-CeiIXmAI.d.cts.map +0 -1
- package/dist/index-DFzyOxvt.d.cts.map +0 -1
- package/dist/index-Dr06SNZN.d.cts.map +0 -1
- package/dist/index-Dty4h2eA.d.ts.map +0 -1
- package/dist/index-E6etS7_8.d.ts.map +0 -1
- package/dist/index-TmijvCD0.d.ts.map +0 -1
- package/dist/index-ahxY6Q0X.d.cts.map +0 -1
- package/dist/index-mmk9VKYu.d.ts.map +0 -1
- package/dist/index-w8E8Koak.d.ts +0 -224
- package/dist/index-w8E8Koak.d.ts.map +0 -1
- package/dist/index-wwmQClW-.d.cts.map +0 -1
- package/dist/useClientValidation-B_dYQB5o.d.cts.map +0 -1
- package/dist/useClientValidation-Dnj_wuwf.cjs.map +0 -1
- package/dist/useFormContext-C6OOtqZ5.d.ts.map +0 -1
- package/dist/useFormContext-CLymm_7t.js +0 -6
- package/dist/useFormContext-CLymm_7t.js.map +0 -1
- package/dist/useFormContext-CkeSOfWD.cjs +0 -6
- package/dist/useFormContext-CkeSOfWD.cjs.map +0 -1
- package/dist/useFormContext-Dh97YG47.d.cts.map +0 -1
- package/dist/useInputValueDebounce-CRaM7HEM.cjs +0 -99
- package/dist/useInputValueDebounce-CRaM7HEM.cjs.map +0 -1
- package/dist/useInputValueDebounce-DJO5uzLb.js +0 -93
- package/dist/useInputValueDebounce-DJO5uzLb.js.map +0 -1
- package/dist/useUniformField-6c4OCAfb.cjs +0 -142
- package/dist/useUniformField-6c4OCAfb.cjs.map +0 -1
- package/dist/useUniformField-C-Xyu-8v.js +0 -135
- package/dist/useUniformField-C-Xyu-8v.js.map +0 -1
- package/dist/useUniformFieldArray-BKvA0FQW.js +0 -84
- package/dist/useUniformFieldArray-BKvA0FQW.js.map +0 -1
- package/dist/useUniformFieldArray-CRCbV1J2.cjs +0 -90
- package/dist/useUniformFieldArray-CRCbV1J2.cjs.map +0 -1
- package/dist/useUniformFieldArray-CWiaXKO6.d.cts.map +0 -1
- package/dist/useUniformFieldArray-lV3Nbum2.d.ts.map +0 -1
- /package/dist/{index-BMCcWGYS.d.ts → index--okzibnx.d.ts} +0 -0
- /package/dist/{index-C8k_zgEm.d.cts → index-B2TCFhpj.d.ts} +0 -0
- /package/dist/{index-DDRpa5CJ.d.cts → index-BtBZHVmz.d.cts} +0 -0
- /package/dist/{index-GGHuYh77.d.ts → index-CI4LJief.d.ts} +0 -0
- /package/dist/{useInput-BVZvtfNg.d.ts → useInput-93TCCrkB.d.cts} +0 -0
- /package/dist/{useInput-CKmKH9Ij.d.cts → useInput-C_fY--wx.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useController-
|
|
1
|
+
{"version":3,"file":"useController-DVRh86Zy.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 * 6. No-op when value unchanged: onChange is ignored if the new value equals the current value\n * (prevents unnecessary re-renders and spurious useWatchUserChange triggers)\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 // Skip if value hasn't changed (e.g., user re-selects same option)\n // We compare formattedValue (the new value after nullish conversion) with\n // field.value (the current stored value, also in nullish format)\n if (formattedValue === field.value) {\n return;\n }\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 // NOTE: We notify with the original value (not formattedValue) so that\n // listeners receive the actual value (false, 0, null) instead of marker\n // strings like '__FALSE__', '__ZERO__', '__NULL__'\n userChange?.notify(field.name, value);\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":";;;;;;;;;;;;;;;;;;;;;;AA4CA,MAAa,iBACX,UACsC;CACtC,MAAM,EAAE,OAAO,WAAW,gBAAA,GAAA,gBAAA,eAAgC,MAAM;CAChE,MAAM,EAAE,gBAAA,GAAA,MAAA,YAA0BA,oBAAAA,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,KAAKC,sBAAAA,gBAAgB,MAAM;AAKjE,QAAI,mBAAmB,MAAM,MAC3B;AAIF,UAAM,SAAS,eAAe;AAQ9B,gBAAY,OAAO,MAAM,MAAM,MAAM;;GAGvC,OAAOC,sBAAAA,kBAAkB,MAAM,MAAM;GACtC;EACD;EACA;EACD"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
const require_FormContext = require(
|
|
2
|
-
const
|
|
1
|
+
const require_FormContext = require("./FormContext-BrY1FQYR.cjs");
|
|
2
|
+
const require_helpers_index = require("./helpers/index.cjs");
|
|
3
3
|
let react = require("react");
|
|
4
4
|
let react_hook_form = require("react-hook-form");
|
|
5
|
-
|
|
6
5
|
//#region src/hooks/useFormContext/useFormContext.ts
|
|
7
6
|
/** Schema check whether a field is required or optional */
|
|
8
7
|
const checkFieldIsRequired = (validation, path) => {
|
|
9
|
-
const checkPath = path[path.length - 1] ===
|
|
8
|
+
const checkPath = path[path.length - 1] === "__FLAT__" ? path.slice(0, -1) : path;
|
|
10
9
|
const checkRequired = (schema) => {
|
|
11
10
|
if (schema.type === "array") {
|
|
12
11
|
if (schema.isOptional || schema.isNullable) return false;
|
|
@@ -30,7 +29,7 @@ const checkFieldIsRequired = (validation, path) => {
|
|
|
30
29
|
*/
|
|
31
30
|
const getValidationErrorsByName = (errors, name) => {
|
|
32
31
|
const keys = name.split(".").filter((k) => {
|
|
33
|
-
return k !==
|
|
32
|
+
return k !== require_helpers_index.flatArrayKey;
|
|
34
33
|
});
|
|
35
34
|
let current = errors;
|
|
36
35
|
keys.forEach((key) => {
|
|
@@ -71,7 +70,7 @@ const useFormContext = () => {
|
|
|
71
70
|
error,
|
|
72
71
|
invalid: !!error,
|
|
73
72
|
required,
|
|
74
|
-
testId:
|
|
73
|
+
testId: require_helpers_index.nameToTestId(testId ?? name)
|
|
75
74
|
};
|
|
76
75
|
};
|
|
77
76
|
/**
|
|
@@ -86,10 +85,10 @@ const useFormContext = () => {
|
|
|
86
85
|
* the internal nullish string conversion system or flat array wrapping manually.
|
|
87
86
|
*/
|
|
88
87
|
const getValues = ((...args) => {
|
|
89
|
-
return
|
|
88
|
+
return require_helpers_index.toValidationFormat(getValuesOrig(...args));
|
|
90
89
|
});
|
|
91
90
|
const watch = ((...args) => {
|
|
92
|
-
return
|
|
91
|
+
return require_helpers_index.toValidationFormat(watchOrig(...args));
|
|
93
92
|
});
|
|
94
93
|
const subscribe = ((...args) => {
|
|
95
94
|
const [options] = args;
|
|
@@ -100,7 +99,7 @@ const useFormContext = () => {
|
|
|
100
99
|
callback: (subscribeFormState) => {
|
|
101
100
|
return originalCallback({
|
|
102
101
|
...subscribeFormState,
|
|
103
|
-
...subscribeFormState.values && { values:
|
|
102
|
+
...subscribeFormState.values && { values: require_helpers_index.toValidationFormat(subscribeFormState.values) }
|
|
104
103
|
});
|
|
105
104
|
}
|
|
106
105
|
});
|
|
@@ -117,18 +116,18 @@ const useFormContext = () => {
|
|
|
117
116
|
watch
|
|
118
117
|
};
|
|
119
118
|
};
|
|
120
|
-
|
|
121
119
|
//#endregion
|
|
122
|
-
Object.defineProperty(exports,
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
120
|
+
Object.defineProperty(exports, "checkFieldIsRequired", {
|
|
121
|
+
enumerable: true,
|
|
122
|
+
get: function() {
|
|
123
|
+
return checkFieldIsRequired;
|
|
124
|
+
}
|
|
127
125
|
});
|
|
128
|
-
Object.defineProperty(exports,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
126
|
+
Object.defineProperty(exports, "useFormContext", {
|
|
127
|
+
enumerable: true,
|
|
128
|
+
get: function() {
|
|
129
|
+
return useFormContext;
|
|
130
|
+
}
|
|
133
131
|
});
|
|
134
|
-
|
|
132
|
+
|
|
133
|
+
//# sourceMappingURL=useFormContext-Bum4VP1o.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFormContext-
|
|
1
|
+
{"version":3,"file":"useFormContext-Bum4VP1o.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,OAAA,aAAsB,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,sBAAAA;GACb;CACF,IAAI,UAAmB;AACvB,MAAK,SAAS,QAAQ;AACpB,MAAI,WAAW,OAAO,YAAY,SAChC,WAAW,QAAoC;MAE/C,WAAU,KAAA;GAEZ;AACF,QAAO;;;;;;;;;;;;AAaT,MAAa,uBAIN;CACL,MAAM,EACJ,WAEA,eAAe,mBACf,WAAW,eACX,OAAO,WACP,WAAW,eAEX,GAAG,kBAAA,GAAA,gBAAA,iBAC+D;CAEpE,MAAM,kBAAA,GAAA,MAAA,YAA4BC,oBAAAA,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,QAAQC,sBAAAA,aAAa,UAAU,KAAK;GACrC;;;;;;;;;;;;;CAcH,MAAM,cAAc,GAAG,SAAgB;AAErC,SAAOC,sBAAAA,mBADS,cAAsB,GAAG,KAAK,CACb;;CAGnC,MAAM,UAAU,GAAG,SAAgB;AAEjC,SAAOA,sBAAAA,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,QAAQA,sBAAAA,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,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as UniformContext } from "./FormContext-
|
|
1
|
+
import { flatArrayKey, nameToTestId, toValidationFormat } from "./helpers/index.js";
|
|
2
|
+
import { n as UniformContext } from "./FormContext-CLfMWHQM.js";
|
|
3
3
|
import { useContext } from "react";
|
|
4
4
|
import { useFormContext } from "react-hook-form";
|
|
5
|
-
|
|
6
5
|
//#region src/hooks/useFormContext/useFormContext.ts
|
|
7
6
|
/** Schema check whether a field is required or optional */
|
|
8
7
|
const checkFieldIsRequired = (validation, path) => {
|
|
9
|
-
const checkPath = path[path.length - 1] ===
|
|
8
|
+
const checkPath = path[path.length - 1] === "__FLAT__" ? path.slice(0, -1) : path;
|
|
10
9
|
const checkRequired = (schema) => {
|
|
11
10
|
if (schema.type === "array") {
|
|
12
11
|
if (schema.isOptional || schema.isNullable) return false;
|
|
@@ -117,7 +116,7 @@ const useFormContext$1 = () => {
|
|
|
117
116
|
watch
|
|
118
117
|
};
|
|
119
118
|
};
|
|
120
|
-
|
|
121
119
|
//#endregion
|
|
122
120
|
export { useFormContext$1 as n, checkFieldIsRequired as t };
|
|
123
|
-
|
|
121
|
+
|
|
122
|
+
//# sourceMappingURL=useFormContext-Bzpyonu6.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFormContext-
|
|
1
|
+
{"version":3,"file":"useFormContext-Bzpyonu6.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,OAAA,aAAsB,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,KAAA;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,8 +1,8 @@
|
|
|
1
|
-
import { n as UserChangeListener, t as DebugModeSettings } from "./FormContext-
|
|
2
|
-
import * as
|
|
3
|
-
import * as react_hook_form0 from "react-hook-form";
|
|
1
|
+
import { n as UserChangeListener, t as DebugModeSettings } from "./FormContext-B4KQxdl7.js";
|
|
2
|
+
import * as _$react from "react";
|
|
3
|
+
import * as _$react_hook_form0 from "react-hook-form";
|
|
4
4
|
import { FieldError, FieldValues, Path } from "react-hook-form";
|
|
5
|
-
import * as _fuf_stack_veto0 from "@fuf-stack/veto";
|
|
5
|
+
import * as _$_fuf_stack_veto0 from "@fuf-stack/veto";
|
|
6
6
|
import { VetoFormattedError, VetoInstance } from "@fuf-stack/veto";
|
|
7
7
|
|
|
8
8
|
//#region src/hooks/useFormContext/useFormContext.d.ts
|
|
@@ -19,7 +19,7 @@ declare const checkFieldIsRequired: (validation: VetoInstance, path: string[]) =
|
|
|
19
19
|
* - Filters out empty/null values
|
|
20
20
|
*/
|
|
21
21
|
declare const useFormContext$1: <TFieldValues extends FieldValues = FieldValues, TContext = any, TTransformedValues = TFieldValues>() => {
|
|
22
|
-
formState: react_hook_form0.FormState<TFieldValues>;
|
|
22
|
+
formState: _$react_hook_form0.FormState<TFieldValues>;
|
|
23
23
|
getFieldState: (name: Path<TFieldValues>, testId?: string) => {
|
|
24
24
|
error: FieldError[] | undefined;
|
|
25
25
|
invalid: boolean;
|
|
@@ -29,14 +29,14 @@ declare const useFormContext$1: <TFieldValues extends FieldValues = FieldValues,
|
|
|
29
29
|
isTouched: boolean;
|
|
30
30
|
isValidating: boolean;
|
|
31
31
|
};
|
|
32
|
-
getValues: react_hook_form0.UseFormGetValues<TFieldValues>;
|
|
33
|
-
subscribe: react_hook_form0.UseFormSubscribe<TFieldValues>;
|
|
34
|
-
watch: react_hook_form0.UseFormWatch<TFieldValues>;
|
|
32
|
+
getValues: _$react_hook_form0.UseFormGetValues<TFieldValues>;
|
|
33
|
+
subscribe: _$react_hook_form0.UseFormSubscribe<TFieldValues>;
|
|
34
|
+
watch: _$react_hook_form0.UseFormWatch<TFieldValues>;
|
|
35
35
|
debugMode: "disabled" | "debug" | "debug-testids" | "off";
|
|
36
36
|
debugModeSettings?: DebugModeSettings;
|
|
37
37
|
preventSubmit: (prevent: boolean) => void;
|
|
38
38
|
setDebugMode: (debugMode: "disabled" | "debug" | "debug-testids" | "off") => void;
|
|
39
|
-
triggerSubmit: (e?:
|
|
39
|
+
triggerSubmit: (e?: _$react.BaseSyntheticEvent) => Promise<void> | void;
|
|
40
40
|
userChange: {
|
|
41
41
|
subscribe: (listener: UserChangeListener) => () => void;
|
|
42
42
|
notify: (fieldName: string, value: unknown) => void;
|
|
@@ -45,20 +45,20 @@ declare const useFormContext$1: <TFieldValues extends FieldValues = FieldValues,
|
|
|
45
45
|
baseInstance?: VetoInstance;
|
|
46
46
|
instance?: VetoInstance;
|
|
47
47
|
errors?: VetoFormattedError;
|
|
48
|
-
setClientValidationSchema: (key: string, schema: _fuf_stack_veto0.VetoTypeAny | null) => void;
|
|
48
|
+
setClientValidationSchema: (key: string, schema: _$_fuf_stack_veto0.VetoTypeAny | null) => void;
|
|
49
49
|
};
|
|
50
|
-
setError: react_hook_form0.UseFormSetError<TFieldValues>;
|
|
51
|
-
clearErrors: react_hook_form0.UseFormClearErrors<TFieldValues>;
|
|
52
|
-
setValue: react_hook_form0.UseFormSetValue<TFieldValues>;
|
|
53
|
-
trigger: react_hook_form0.UseFormTrigger<TFieldValues>;
|
|
54
|
-
resetField: react_hook_form0.UseFormResetField<TFieldValues>;
|
|
55
|
-
reset: react_hook_form0.UseFormReset<TFieldValues>;
|
|
56
|
-
handleSubmit: react_hook_form0.UseFormHandleSubmit<TFieldValues, TTransformedValues>;
|
|
57
|
-
unregister: react_hook_form0.UseFormUnregister<TFieldValues>;
|
|
58
|
-
control: react_hook_form0.Control<TFieldValues, TContext, TTransformedValues>;
|
|
59
|
-
register: react_hook_form0.UseFormRegister<TFieldValues>;
|
|
60
|
-
setFocus: react_hook_form0.UseFormSetFocus<TFieldValues>;
|
|
50
|
+
setError: _$react_hook_form0.UseFormSetError<TFieldValues>;
|
|
51
|
+
clearErrors: _$react_hook_form0.UseFormClearErrors<TFieldValues>;
|
|
52
|
+
setValue: _$react_hook_form0.UseFormSetValue<TFieldValues>;
|
|
53
|
+
trigger: _$react_hook_form0.UseFormTrigger<TFieldValues>;
|
|
54
|
+
resetField: _$react_hook_form0.UseFormResetField<TFieldValues>;
|
|
55
|
+
reset: _$react_hook_form0.UseFormReset<TFieldValues>;
|
|
56
|
+
handleSubmit: _$react_hook_form0.UseFormHandleSubmit<TFieldValues, TTransformedValues>;
|
|
57
|
+
unregister: _$react_hook_form0.UseFormUnregister<TFieldValues>;
|
|
58
|
+
control: _$react_hook_form0.Control<TFieldValues, TContext, TTransformedValues>;
|
|
59
|
+
register: _$react_hook_form0.UseFormRegister<TFieldValues>;
|
|
60
|
+
setFocus: _$react_hook_form0.UseFormSetFocus<TFieldValues>;
|
|
61
61
|
};
|
|
62
62
|
//#endregion
|
|
63
63
|
export { useFormContext$1 as n, checkFieldIsRequired as t };
|
|
64
|
-
//# sourceMappingURL=useFormContext-
|
|
64
|
+
//# sourceMappingURL=useFormContext-DEMm-bsc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFormContext-DEMm-bsc.d.ts","names":[],"sources":["../src/hooks/useFormContext/useFormContext.ts"],"mappings":";;;;;;;;;cAYa,oBAAA,GACX,UAAA,EAAY,YAAA,EACZ,IAAA;;;;;AAFF;;;;;;cAqEa,gBAAA,wBACU,WAAA,GAAc,WAAA,uCAEd,YAAA;;wBAwBQ,IAAA,CAAK,YAAA,GAAa,MAAA;;;;;;;;;;;;;;;;8BAWf,kBAAA,KAAA,OAAA;;0BAAA,kBAAA;;;;mBAwB/B,YAAA;eAEoB,YAAA;aAAwE,kBAAA;qDAAA,kBAAA,CAAA,WAAA;EAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as UserChangeListener, t as DebugModeSettings } from "./FormContext-
|
|
2
|
-
import * as
|
|
3
|
-
import * as _fuf_stack_veto0 from "@fuf-stack/veto";
|
|
1
|
+
import { n as UserChangeListener, t as DebugModeSettings } from "./FormContext-BuG3xZFe.cjs";
|
|
2
|
+
import * as _$react from "react";
|
|
3
|
+
import * as _$_fuf_stack_veto0 from "@fuf-stack/veto";
|
|
4
4
|
import { VetoFormattedError, VetoInstance } from "@fuf-stack/veto";
|
|
5
|
-
import * as react_hook_form0 from "react-hook-form";
|
|
5
|
+
import * as _$react_hook_form0 from "react-hook-form";
|
|
6
6
|
import { FieldError, FieldValues, Path } from "react-hook-form";
|
|
7
7
|
|
|
8
8
|
//#region src/hooks/useFormContext/useFormContext.d.ts
|
|
@@ -19,7 +19,7 @@ declare const checkFieldIsRequired: (validation: VetoInstance, path: string[]) =
|
|
|
19
19
|
* - Filters out empty/null values
|
|
20
20
|
*/
|
|
21
21
|
declare const useFormContext: <TFieldValues extends FieldValues = FieldValues, TContext = any, TTransformedValues = TFieldValues>() => {
|
|
22
|
-
formState: react_hook_form0.FormState<TFieldValues>;
|
|
22
|
+
formState: _$react_hook_form0.FormState<TFieldValues>;
|
|
23
23
|
getFieldState: (name: Path<TFieldValues>, testId?: string) => {
|
|
24
24
|
error: FieldError[] | undefined;
|
|
25
25
|
invalid: boolean;
|
|
@@ -29,14 +29,14 @@ declare const useFormContext: <TFieldValues extends FieldValues = FieldValues, T
|
|
|
29
29
|
isTouched: boolean;
|
|
30
30
|
isValidating: boolean;
|
|
31
31
|
};
|
|
32
|
-
getValues: react_hook_form0.UseFormGetValues<TFieldValues>;
|
|
33
|
-
subscribe: react_hook_form0.UseFormSubscribe<TFieldValues>;
|
|
34
|
-
watch: react_hook_form0.UseFormWatch<TFieldValues>;
|
|
32
|
+
getValues: _$react_hook_form0.UseFormGetValues<TFieldValues>;
|
|
33
|
+
subscribe: _$react_hook_form0.UseFormSubscribe<TFieldValues>;
|
|
34
|
+
watch: _$react_hook_form0.UseFormWatch<TFieldValues>;
|
|
35
35
|
debugMode: "disabled" | "debug" | "debug-testids" | "off";
|
|
36
36
|
debugModeSettings?: DebugModeSettings;
|
|
37
37
|
preventSubmit: (prevent: boolean) => void;
|
|
38
38
|
setDebugMode: (debugMode: "disabled" | "debug" | "debug-testids" | "off") => void;
|
|
39
|
-
triggerSubmit: (e?:
|
|
39
|
+
triggerSubmit: (e?: _$react.BaseSyntheticEvent) => Promise<void> | void;
|
|
40
40
|
userChange: {
|
|
41
41
|
subscribe: (listener: UserChangeListener) => () => void;
|
|
42
42
|
notify: (fieldName: string, value: unknown) => void;
|
|
@@ -45,20 +45,20 @@ declare const useFormContext: <TFieldValues extends FieldValues = FieldValues, T
|
|
|
45
45
|
baseInstance?: VetoInstance;
|
|
46
46
|
instance?: VetoInstance;
|
|
47
47
|
errors?: VetoFormattedError;
|
|
48
|
-
setClientValidationSchema: (key: string, schema: _fuf_stack_veto0.VetoTypeAny | null) => void;
|
|
48
|
+
setClientValidationSchema: (key: string, schema: _$_fuf_stack_veto0.VetoTypeAny | null) => void;
|
|
49
49
|
};
|
|
50
|
-
setError: react_hook_form0.UseFormSetError<TFieldValues>;
|
|
51
|
-
clearErrors: react_hook_form0.UseFormClearErrors<TFieldValues>;
|
|
52
|
-
setValue: react_hook_form0.UseFormSetValue<TFieldValues>;
|
|
53
|
-
trigger: react_hook_form0.UseFormTrigger<TFieldValues>;
|
|
54
|
-
resetField: react_hook_form0.UseFormResetField<TFieldValues>;
|
|
55
|
-
reset: react_hook_form0.UseFormReset<TFieldValues>;
|
|
56
|
-
handleSubmit: react_hook_form0.UseFormHandleSubmit<TFieldValues, TTransformedValues>;
|
|
57
|
-
unregister: react_hook_form0.UseFormUnregister<TFieldValues>;
|
|
58
|
-
control: react_hook_form0.Control<TFieldValues, TContext, TTransformedValues>;
|
|
59
|
-
register: react_hook_form0.UseFormRegister<TFieldValues>;
|
|
60
|
-
setFocus: react_hook_form0.UseFormSetFocus<TFieldValues>;
|
|
50
|
+
setError: _$react_hook_form0.UseFormSetError<TFieldValues>;
|
|
51
|
+
clearErrors: _$react_hook_form0.UseFormClearErrors<TFieldValues>;
|
|
52
|
+
setValue: _$react_hook_form0.UseFormSetValue<TFieldValues>;
|
|
53
|
+
trigger: _$react_hook_form0.UseFormTrigger<TFieldValues>;
|
|
54
|
+
resetField: _$react_hook_form0.UseFormResetField<TFieldValues>;
|
|
55
|
+
reset: _$react_hook_form0.UseFormReset<TFieldValues>;
|
|
56
|
+
handleSubmit: _$react_hook_form0.UseFormHandleSubmit<TFieldValues, TTransformedValues>;
|
|
57
|
+
unregister: _$react_hook_form0.UseFormUnregister<TFieldValues>;
|
|
58
|
+
control: _$react_hook_form0.Control<TFieldValues, TContext, TTransformedValues>;
|
|
59
|
+
register: _$react_hook_form0.UseFormRegister<TFieldValues>;
|
|
60
|
+
setFocus: _$react_hook_form0.UseFormSetFocus<TFieldValues>;
|
|
61
61
|
};
|
|
62
62
|
//#endregion
|
|
63
63
|
export { useFormContext as n, checkFieldIsRequired as t };
|
|
64
|
-
//# sourceMappingURL=useFormContext-
|
|
64
|
+
//# sourceMappingURL=useFormContext-Dey5DbWr.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFormContext-Dey5DbWr.d.cts","names":[],"sources":["../src/hooks/useFormContext/useFormContext.ts"],"mappings":";;;;;;;;;cAYa,oBAAA,GACX,UAAA,EAAY,YAAA,EACZ,IAAA;;;;;AAFF;;;;;;cAqEa,cAAA,wBACU,WAAA,GAAc,WAAA,uCAEd,YAAA;;wBAwBQ,IAAA,CAAK,YAAA,GAAa,MAAA;;;;;;;;;;;;;;;;8BAWf,kBAAA,KAAA,OAAA;;0BAAA,kBAAA;;;;mBAwB/B,YAAA;eAEoB,YAAA;aAAwE,kBAAA;qDAAA,kBAAA,CAAA,WAAA;EAAA"}
|
|
@@ -63,4 +63,4 @@ declare const useInputValueDebounce: <TValue = unknown>({
|
|
|
63
63
|
}: UseInputValueDebounceOptions<TValue>) => UseInputValueDebounceReturn<TValue>;
|
|
64
64
|
//#endregion
|
|
65
65
|
export { UseInputValueDebounceReturn as n, useInputValueDebounce as r, UseInputValueDebounceOptions as t };
|
|
66
|
-
//# sourceMappingURL=useInputValueDebounce-
|
|
66
|
+
//# sourceMappingURL=useInputValueDebounce-puGRVJ6t.d.cts.map
|
package/dist/{useInputValueDebounce-ZLyAmuXV.d.cts.map → useInputValueDebounce-puGRVJ6t.d.cts.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInputValueDebounce-
|
|
1
|
+
{"version":3,"file":"useInputValueDebounce-puGRVJ6t.d.cts","names":[],"sources":["../src/hooks/useInputValueDebounce/useInputValueDebounce.ts"],"mappings":";UAIiB,4BAAA;EAAA;EAEf,aAAA;EAF2C;EAI3C,IAAA;EAJ4C;EAM5C,MAAA;EAFA;EAKA,QAAA,MAAc,KAAA;EAAd;EAEA,KAAA,EAAO,MAAA;AAAA;AAAA,UAGQ,2BAAA;EAHF;EAMb,QAAA,MAAc,KAAA;EAHC;EAKf,MAAA;EAL0C;EAO1C,KAAA,EAAO,MAAA;AAAA;;;;;;;;AAsCT;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAa,qBAAA;EAA2C,aAAA;EAAA,IAAA;EAAA,MAAA;EAAA,QAAA;EAAA;AAAA,GAMrD,4BAAA,CAA6B,MAAA,MAAU,2BAAA,CAA4B,MAAA"}
|
|
@@ -63,4 +63,4 @@ declare const useInputValueDebounce: <TValue = unknown>({
|
|
|
63
63
|
}: UseInputValueDebounceOptions<TValue>) => UseInputValueDebounceReturn<TValue>;
|
|
64
64
|
//#endregion
|
|
65
65
|
export { UseInputValueDebounceReturn as n, useInputValueDebounce as r, UseInputValueDebounceOptions as t };
|
|
66
|
-
//# sourceMappingURL=useInputValueDebounce-
|
|
66
|
+
//# sourceMappingURL=useInputValueDebounce-sFOlecIQ.d.ts.map
|
package/dist/{useInputValueDebounce-Dhlv1NUY.d.ts.map → useInputValueDebounce-sFOlecIQ.d.ts.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInputValueDebounce-
|
|
1
|
+
{"version":3,"file":"useInputValueDebounce-sFOlecIQ.d.ts","names":[],"sources":["../src/hooks/useInputValueDebounce/useInputValueDebounce.ts"],"mappings":";UAIiB,4BAAA;EAAA;EAEf,aAAA;EAF2C;EAI3C,IAAA;EAJ4C;EAM5C,MAAA;EAFA;EAKA,QAAA,MAAc,KAAA;EAAd;EAEA,KAAA,EAAO,MAAA;AAAA;AAAA,UAGQ,2BAAA;EAHF;EAMb,QAAA,MAAc,KAAA;EAHC;EAKf,MAAA;EAL0C;EAO1C,KAAA,EAAO,MAAA;AAAA;;;;;;;;AAsCT;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAa,qBAAA;EAA2C,aAAA;EAAA,IAAA;EAAA,MAAA;EAAA,QAAA;EAAA;AAAA,GAMrD,4BAAA,CAA6B,MAAA,MAAU,2BAAA,CAA4B,MAAA"}
|
package/dist/{useInputValueTransform-CNCBU7a9.d.cts → useInputValueTransform-BwAfw8Xb.d.cts}
RENAMED
|
@@ -105,4 +105,4 @@ declare const useInputValueTransform: <TDisplay = unknown>({
|
|
|
105
105
|
}: UseInputValueTransformOptions<TDisplay>) => UseInputValueTransformReturn<TDisplay>;
|
|
106
106
|
//#endregion
|
|
107
107
|
export { useInputValueTransform as i, UseInputValueTransformOptions as n, UseInputValueTransformReturn as r, InputValueTransform as t };
|
|
108
|
-
//# sourceMappingURL=useInputValueTransform-
|
|
108
|
+
//# sourceMappingURL=useInputValueTransform-BwAfw8Xb.d.cts.map
|
package/dist/{useInputValueTransform-CNCBU7a9.d.cts.map → useInputValueTransform-BwAfw8Xb.d.cts.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInputValueTransform-
|
|
1
|
+
{"version":3,"file":"useInputValueTransform-BwAfw8Xb.d.cts","names":[],"sources":["../src/hooks/useInputValueTransform/useInputValueTransform.ts"],"mappings":";UAEiB,mBAAA;EAAA;EAEf,cAAA,GAAiB,KAAA,cAAmB,QAAA;EAFF;EAIlC,WAAA,GAAc,KAAA,EAAO,QAAA;AAAA;AAAA,UAGN,6BAAA;EALE;EAOjB,IAAA;EALA;EAOA,SAAA,GAAY,mBAAA,CAAoB,QAAA;AAAA;AAAA,UAGjB,4BAAA;EAVc;EAY7B,cAAA,GAAiB,SAAA,cAAuB,QAAA;EATI;EAW5C,WAAA,GAAc,YAAA,EAAc,QAAA;AAAA;;;;;;;;AAJ9B;;;;;;;;;;;;;AAyFA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAa,sBAAA;EAA8C,IAAA;EAAA;AAAA,GAGxD,6BAAA,CAA8B,QAAA,MAAY,4BAAA,CAA6B,QAAA"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { useCallback } from "react";
|
|
2
|
-
|
|
3
2
|
//#region src/hooks/useInputValueTransform/useInputValueTransform.ts
|
|
4
3
|
/**
|
|
5
4
|
* Custom hook providing utility functions for value transformations between display and form values.
|
|
@@ -105,7 +104,7 @@ const useInputValueTransform = ({ type, transform }) => {
|
|
|
105
104
|
}, [type, transform])
|
|
106
105
|
};
|
|
107
106
|
};
|
|
108
|
-
|
|
109
107
|
//#endregion
|
|
110
108
|
export { useInputValueTransform as t };
|
|
111
|
-
|
|
109
|
+
|
|
110
|
+
//# sourceMappingURL=useInputValueTransform-CXdmtc0Q.js.map
|
package/dist/{useInputValueTransform-C-fmz3ke.js.map → useInputValueTransform-CXdmtc0Q.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInputValueTransform-
|
|
1
|
+
{"version":3,"file":"useInputValueTransform-CXdmtc0Q.js","names":[],"sources":["../src/hooks/useInputValueTransform/useInputValueTransform.ts"],"sourcesContent":["import { useCallback } from 'react';\n\nexport interface InputValueTransform<TDisplay = unknown> {\n /** Transforms the form value to display value (e.g., 1000 → \"$1,000\" or 'a' → ['a']) */\n toDisplayValue: (value: unknown) => TDisplay;\n /** Transforms the display value to form value (e.g., \"$1,000\" → 1000 or ['a'] → 'a') */\n toFormValue: (value: TDisplay) => unknown;\n}\n\nexport interface UseInputValueTransformOptions<TDisplay = unknown> {\n /** Input type for special number handling */\n type?: 'text' | 'number' | 'password';\n /** Value transformation functions */\n transform?: InputValueTransform<TDisplay>;\n}\n\nexport interface UseInputValueTransformReturn<TDisplay = unknown> {\n /** Converts any form value to display value */\n toDisplayValue: (formValue: unknown) => TDisplay;\n /** Converts any display value to form value */\n toFormValue: (displayValue: TDisplay) => unknown;\n}\n\n/**\n * Custom hook providing utility functions for value transformations between display and form values.\n *\n * This hook provides pure conversion functions without any state management. It's useful for:\n * - Currency formatting ($1,000 display vs 1000 stored)\n * - Number inputs with special handling\n * - Date formatting (MM/DD/YYYY display vs ISO date stored)\n * - Phone number formatting ((555) 123-4567 display vs 5551234567 stored)\n * - Array/Object transformations (single value ↔ array, nested structures)\n *\n * **Key Features:**\n * - Pure conversion functions (no state)\n * - Generic support for any data type (strings, numbers, arrays, objects)\n * - Special number input handling (empty string preservation)\n * - Bidirectional value transformations\n * - Memoized functions for performance\n *\n * @param options Configuration for value transformation\n * @returns Pure conversion utility functions\n *\n * @example\n * ```tsx\n * // Currency formatting\n * const currencyTransform = {\n * toDisplayValue: (val) => val ? `$${Number(val).toLocaleString()}` : '',\n * toFormValue: (val) => parseFloat(val.replace(/[$,]/g, '')) || 0\n * };\n *\n * const { toDisplayValue, toFormValue } = useInputValueTransform({\n * transform: currencyTransform\n * });\n *\n * const displayVal = toDisplayValue(1000); // \"$1,000\"\n * const formVal = toFormValue(\"$1,500\"); // 1500\n * ```\n *\n * @example\n * ```tsx\n * // Number input (no transforms needed)\n * const { toDisplayValue, toFormValue } = useInputValueTransform({\n * type: 'number'\n * });\n *\n * // Handles empty string → empty string (not NaN)\n * // Handles \"123\" → 123 (string to number conversion)\n * ```\n *\n * @example\n * ```tsx\n * // Array to single value (for single checkbox)\n * const singleValueTransform = {\n * toDisplayValue: (val: string[]) => val?.[0] || '',\n * toFormValue: (val: string) => val ? [val] : []\n * };\n *\n * const { toDisplayValue, toFormValue } = useInputValueTransform({\n * transform: singleValueTransform\n * });\n *\n * const displayVal = toDisplayValue(['option1']); // \"option1\"\n * const formVal = toFormValue(\"option2\"); // [\"option2\"]\n * ```\n *\n * @example\n * ```tsx\n * // Integration with debouncing\n * const MyInput = ({ field, transform }) => {\n * const transform = useInputValueTransform({ transform });\n *\n * const { onChange, onBlur, value } = useInputValueDebounce({\n * ...transform,\n * debounceDelay: 300,\n * name: 'fieldName',\n * onBlur: field.onBlur,\n * onChange: field.onChange,\n * value: field.value,\n * });\n *\n * return <input value={value} onChange={onChange} onBlur={onBlur} />;\n * };\n * ```\n */\nexport const useInputValueTransform = <TDisplay = unknown>({\n type,\n transform,\n}: UseInputValueTransformOptions<TDisplay>): UseInputValueTransformReturn<TDisplay> => {\n /**\n * Converts any form value to display value\n */\n const toDisplayValue = useCallback(\n (formValue: unknown): TDisplay => {\n if (transform?.toDisplayValue) {\n return transform.toDisplayValue(formValue);\n }\n\n // For number type, convert valid strings to numbers for display\n if (type === 'number') {\n if (formValue === '') {\n return '' as TDisplay;\n }\n const numValue = Number(formValue);\n return (Number.isNaN(numValue) ? formValue : numValue) as TDisplay;\n }\n\n // Default: pass through (handles primitives, arrays, objects, etc.)\n return (formValue ?? '') as TDisplay;\n },\n [type, transform],\n );\n\n /**\n * Converts any display value to form value\n */\n const toFormValue = useCallback(\n (displayValue: TDisplay): unknown => {\n if (transform?.toFormValue) {\n return transform.toFormValue(displayValue);\n }\n\n // For number type, convert strings to numbers\n if (type === 'number') {\n if (displayValue === '') {\n return '';\n }\n const numValue = Number(displayValue);\n return Number.isNaN(numValue) ? displayValue : numValue;\n }\n\n // Default: pass through (handles primitives, arrays, objects, etc.)\n return displayValue;\n },\n [type, transform],\n );\n\n return {\n toDisplayValue,\n toFormValue,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyGA,MAAa,0BAA8C,EACzD,MACA,gBACqF;AAiDrF,QAAO;EACL,gBA9CqB,aACpB,cAAiC;AAChC,OAAI,WAAW,eACb,QAAO,UAAU,eAAe,UAAU;AAI5C,OAAI,SAAS,UAAU;AACrB,QAAI,cAAc,GAChB,QAAO;IAET,MAAM,WAAW,OAAO,UAAU;AAClC,WAAQ,OAAO,MAAM,SAAS,GAAG,YAAY;;AAI/C,UAAQ,aAAa;KAEvB,CAAC,MAAM,UAAU,CAClB;EA4BC,aAvBkB,aACjB,iBAAoC;AACnC,OAAI,WAAW,YACb,QAAO,UAAU,YAAY,aAAa;AAI5C,OAAI,SAAS,UAAU;AACrB,QAAI,iBAAiB,GACnB,QAAO;IAET,MAAM,WAAW,OAAO,aAAa;AACrC,WAAO,OAAO,MAAM,SAAS,GAAG,eAAe;;AAIjD,UAAO;KAET,CAAC,MAAM,UAAU,CAClB;EAKA"}
|
|
@@ -105,4 +105,4 @@ declare const useInputValueTransform: <TDisplay = unknown>({
|
|
|
105
105
|
}: UseInputValueTransformOptions<TDisplay>) => UseInputValueTransformReturn<TDisplay>;
|
|
106
106
|
//#endregion
|
|
107
107
|
export { useInputValueTransform as i, UseInputValueTransformOptions as n, UseInputValueTransformReturn as r, InputValueTransform as t };
|
|
108
|
-
//# sourceMappingURL=useInputValueTransform-
|
|
108
|
+
//# sourceMappingURL=useInputValueTransform-CdoaxNyD.d.ts.map
|
package/dist/{useInputValueTransform-tsMNM7g_.d.ts.map → useInputValueTransform-CdoaxNyD.d.ts.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInputValueTransform-
|
|
1
|
+
{"version":3,"file":"useInputValueTransform-CdoaxNyD.d.ts","names":[],"sources":["../src/hooks/useInputValueTransform/useInputValueTransform.ts"],"mappings":";UAEiB,mBAAA;EAAA;EAEf,cAAA,GAAiB,KAAA,cAAmB,QAAA;EAFF;EAIlC,WAAA,GAAc,KAAA,EAAO,QAAA;AAAA;AAAA,UAGN,6BAAA;EALE;EAOjB,IAAA;EALA;EAOA,SAAA,GAAY,mBAAA,CAAoB,QAAA;AAAA;AAAA,UAGjB,4BAAA;EAVc;EAY7B,cAAA,GAAiB,SAAA,cAAuB,QAAA;EATI;EAW5C,WAAA,GAAc,YAAA,EAAc,QAAA;AAAA;;;;;;;;AAJ9B;;;;;;;;;;;;;AAyFA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAa,sBAAA;EAA8C,IAAA;EAAA;AAAA,GAGxD,6BAAA,CAA8B,QAAA,MAAY,4BAAA,CAA6B,QAAA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
require("./FormContext-BrY1FQYR.cjs");
|
|
2
2
|
let react = require("react");
|
|
3
|
-
|
|
4
3
|
//#region src/hooks/useInputValueTransform/useInputValueTransform.ts
|
|
5
4
|
/**
|
|
6
5
|
* Custom hook providing utility functions for value transformations between display and form values.
|
|
@@ -106,12 +105,12 @@ const useInputValueTransform = ({ type, transform }) => {
|
|
|
106
105
|
}, [type, transform])
|
|
107
106
|
};
|
|
108
107
|
};
|
|
109
|
-
|
|
110
108
|
//#endregion
|
|
111
|
-
Object.defineProperty(exports,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
109
|
+
Object.defineProperty(exports, "useInputValueTransform", {
|
|
110
|
+
enumerable: true,
|
|
111
|
+
get: function() {
|
|
112
|
+
return useInputValueTransform;
|
|
113
|
+
}
|
|
116
114
|
});
|
|
117
|
-
|
|
115
|
+
|
|
116
|
+
//# sourceMappingURL=useInputValueTransform-DKH-7F9D.cjs.map
|
package/dist/{useInputValueTransform-BBRvvhDe.cjs.map → useInputValueTransform-DKH-7F9D.cjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInputValueTransform-
|
|
1
|
+
{"version":3,"file":"useInputValueTransform-DKH-7F9D.cjs","names":[],"sources":["../src/hooks/useInputValueTransform/useInputValueTransform.ts"],"sourcesContent":["import { useCallback } from 'react';\n\nexport interface InputValueTransform<TDisplay = unknown> {\n /** Transforms the form value to display value (e.g., 1000 → \"$1,000\" or 'a' → ['a']) */\n toDisplayValue: (value: unknown) => TDisplay;\n /** Transforms the display value to form value (e.g., \"$1,000\" → 1000 or ['a'] → 'a') */\n toFormValue: (value: TDisplay) => unknown;\n}\n\nexport interface UseInputValueTransformOptions<TDisplay = unknown> {\n /** Input type for special number handling */\n type?: 'text' | 'number' | 'password';\n /** Value transformation functions */\n transform?: InputValueTransform<TDisplay>;\n}\n\nexport interface UseInputValueTransformReturn<TDisplay = unknown> {\n /** Converts any form value to display value */\n toDisplayValue: (formValue: unknown) => TDisplay;\n /** Converts any display value to form value */\n toFormValue: (displayValue: TDisplay) => unknown;\n}\n\n/**\n * Custom hook providing utility functions for value transformations between display and form values.\n *\n * This hook provides pure conversion functions without any state management. It's useful for:\n * - Currency formatting ($1,000 display vs 1000 stored)\n * - Number inputs with special handling\n * - Date formatting (MM/DD/YYYY display vs ISO date stored)\n * - Phone number formatting ((555) 123-4567 display vs 5551234567 stored)\n * - Array/Object transformations (single value ↔ array, nested structures)\n *\n * **Key Features:**\n * - Pure conversion functions (no state)\n * - Generic support for any data type (strings, numbers, arrays, objects)\n * - Special number input handling (empty string preservation)\n * - Bidirectional value transformations\n * - Memoized functions for performance\n *\n * @param options Configuration for value transformation\n * @returns Pure conversion utility functions\n *\n * @example\n * ```tsx\n * // Currency formatting\n * const currencyTransform = {\n * toDisplayValue: (val) => val ? `$${Number(val).toLocaleString()}` : '',\n * toFormValue: (val) => parseFloat(val.replace(/[$,]/g, '')) || 0\n * };\n *\n * const { toDisplayValue, toFormValue } = useInputValueTransform({\n * transform: currencyTransform\n * });\n *\n * const displayVal = toDisplayValue(1000); // \"$1,000\"\n * const formVal = toFormValue(\"$1,500\"); // 1500\n * ```\n *\n * @example\n * ```tsx\n * // Number input (no transforms needed)\n * const { toDisplayValue, toFormValue } = useInputValueTransform({\n * type: 'number'\n * });\n *\n * // Handles empty string → empty string (not NaN)\n * // Handles \"123\" → 123 (string to number conversion)\n * ```\n *\n * @example\n * ```tsx\n * // Array to single value (for single checkbox)\n * const singleValueTransform = {\n * toDisplayValue: (val: string[]) => val?.[0] || '',\n * toFormValue: (val: string) => val ? [val] : []\n * };\n *\n * const { toDisplayValue, toFormValue } = useInputValueTransform({\n * transform: singleValueTransform\n * });\n *\n * const displayVal = toDisplayValue(['option1']); // \"option1\"\n * const formVal = toFormValue(\"option2\"); // [\"option2\"]\n * ```\n *\n * @example\n * ```tsx\n * // Integration with debouncing\n * const MyInput = ({ field, transform }) => {\n * const transform = useInputValueTransform({ transform });\n *\n * const { onChange, onBlur, value } = useInputValueDebounce({\n * ...transform,\n * debounceDelay: 300,\n * name: 'fieldName',\n * onBlur: field.onBlur,\n * onChange: field.onChange,\n * value: field.value,\n * });\n *\n * return <input value={value} onChange={onChange} onBlur={onBlur} />;\n * };\n * ```\n */\nexport const useInputValueTransform = <TDisplay = unknown>({\n type,\n transform,\n}: UseInputValueTransformOptions<TDisplay>): UseInputValueTransformReturn<TDisplay> => {\n /**\n * Converts any form value to display value\n */\n const toDisplayValue = useCallback(\n (formValue: unknown): TDisplay => {\n if (transform?.toDisplayValue) {\n return transform.toDisplayValue(formValue);\n }\n\n // For number type, convert valid strings to numbers for display\n if (type === 'number') {\n if (formValue === '') {\n return '' as TDisplay;\n }\n const numValue = Number(formValue);\n return (Number.isNaN(numValue) ? formValue : numValue) as TDisplay;\n }\n\n // Default: pass through (handles primitives, arrays, objects, etc.)\n return (formValue ?? '') as TDisplay;\n },\n [type, transform],\n );\n\n /**\n * Converts any display value to form value\n */\n const toFormValue = useCallback(\n (displayValue: TDisplay): unknown => {\n if (transform?.toFormValue) {\n return transform.toFormValue(displayValue);\n }\n\n // For number type, convert strings to numbers\n if (type === 'number') {\n if (displayValue === '') {\n return '';\n }\n const numValue = Number(displayValue);\n return Number.isNaN(numValue) ? displayValue : numValue;\n }\n\n // Default: pass through (handles primitives, arrays, objects, etc.)\n return displayValue;\n },\n [type, transform],\n );\n\n return {\n toDisplayValue,\n toFormValue,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyGA,MAAa,0BAA8C,EACzD,MACA,gBACqF;AAiDrF,QAAO;EACL,iBAAA,GAAA,MAAA,cA7CC,cAAiC;AAChC,OAAI,WAAW,eACb,QAAO,UAAU,eAAe,UAAU;AAI5C,OAAI,SAAS,UAAU;AACrB,QAAI,cAAc,GAChB,QAAO;IAET,MAAM,WAAW,OAAO,UAAU;AAClC,WAAQ,OAAO,MAAM,SAAS,GAAG,YAAY;;AAI/C,UAAQ,aAAa;KAEvB,CAAC,MAAM,UAAU,CAClB;EA4BC,cAAA,GAAA,MAAA,cAtBC,iBAAoC;AACnC,OAAI,WAAW,YACb,QAAO,UAAU,YAAY,aAAa;AAI5C,OAAI,SAAS,UAAU;AACrB,QAAI,iBAAiB,GACnB,QAAO;IAET,MAAM,WAAW,OAAO,aAAa;AACrC,WAAO,OAAO,MAAM,SAAS,GAAG,eAAe;;AAIjD,UAAO;KAET,CAAC,MAAM,UAAU,CAClB;EAKA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as InputValueTransform } from "./useInputValueTransform-
|
|
2
|
-
import { r as useController } from "./useController-
|
|
3
|
-
import { n as useFormContext } from "./useFormContext-
|
|
4
|
-
import { t as useInput } from "./useInput-
|
|
1
|
+
import { t as InputValueTransform } from "./useInputValueTransform-BwAfw8Xb.cjs";
|
|
2
|
+
import { r as useController } from "./useController-CNiqy_2D.cjs";
|
|
3
|
+
import { n as useFormContext } from "./useFormContext-Dey5DbWr.cjs";
|
|
4
|
+
import { t as useInput } from "./useInput-93TCCrkB.cjs";
|
|
5
5
|
import { ReactNode } from "react";
|
|
6
6
|
import { FieldError, FieldValues, Path } from "react-hook-form";
|
|
7
7
|
|
|
@@ -95,4 +95,4 @@ interface UseUniformFieldReturn<TFieldValues extends FieldValues = FieldValues>
|
|
|
95
95
|
declare const useUniformField: <TFieldValues extends FieldValues = FieldValues, TDisplay = unknown>(params: UseUniformFieldParams<TFieldValues, TDisplay>) => UseUniformFieldReturn<TFieldValues>;
|
|
96
96
|
//#endregion
|
|
97
97
|
export { UseUniformFieldReturn as n, useUniformField as r, UseUniformFieldParams as t };
|
|
98
|
-
//# sourceMappingURL=useUniformField-
|
|
98
|
+
//# sourceMappingURL=useUniformField-DB8jF52F.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUniformField-
|
|
1
|
+
{"version":3,"file":"useUniformField-DB8jF52F.d.cts","names":[],"sources":["../src/hooks/useUniformField/useUniformField.tsx"],"mappings":";;;;;;;;UAgBiB,qBAAA,sBACM,WAAA,GAAc,WAAA;;EAInC,IAAA,EAAM,IAAA,CAAK,YAAA;EALyB;EAOpC,SAAA;EANqB;EAQrB,QAAA;EAJW;EAMX,KAAA,GAAQ,SAAA;EAAA;EAER,MAAA;EAEY;EAAZ,SAAA,GAAY,mBAAA,CAAoB,QAAA;EAAD;EAE/B,IAAA;AAAA;AAAA,UAGe,qBAAA,sBACM,WAAA,GAAc,WAAA;EAnBnC;EAsBA,SAAA;EAnBM;EAqBN,OAAA,EAAS,UAAA,QAAkB,cAAA,CAAe,YAAA;EAnB1C;EAqBA,SAAA,EAAW,UAAA,QAAkB,cAAA,CAAe,YAAA;EAjB5C;EAmBA,YAAA;EAjBA;EAmBA,QAAA;EAjBY;EAmBZ,KAAA,EAAO,UAAA;EAjBP;EAmBA,YAAA,EAAc,SAAA;EAnBV;EAqBJ,KAAA,EAAO,UAAA,QAAkB,aAAA,CAAc,YAAA;EAlBH;EAoBpC,oBAAA,EAAsB,UAAA,QAAkB,QAAA;EAnBnB;EAqBrB,qBAAA,EAAuB,UAAA,QAAkB,QAAA;EAhBC;EAkB1C,aAAA,EAAe,UAAA,QAAkB,QAAA;EAlBxB;EAoBT,SAAA,EAAW,UAAA,QAAkB,cAAA,CAAe,YAAA;EAlBf;EAoB7B,OAAA;EAdO;EAgBP,KAAA,EAAO,SAAA;EAZgC;EAcvC,MAAA,EAAQ,UAAA,QAAkB,aAAA,CAAc,YAAA;EAdjC;EAgBP,QAAA,EAAU,UAAA,QAAkB,aAAA,CAAc,YAAA;EAdpB;EAgBtB,GAAA,EAAK,UAAA,QAAkB,aAAA,CAAc,YAAA;EAdd;EAgBvB,QAAA;EAde;EAgBf,UAAA,EAAY,UAAA,QAAkB,cAAA,CAAe,YAAA;EAdhB;EAgB7B,MAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA+BW,eAAA,wBACU,WAAA,GAAc,WAAA,sBAGnC,MAAA,EAAQ,qBAAA,CAAsB,YAAA,EAAc,QAAA,MAC3C,qBAAA,CAAsB,YAAA"}
|