@fuf-stack/uniform 1.18.2 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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-Dk7yyRVR.cjs → Checkboxes-Ca9fTce_.cjs} +18 -21
- package/dist/Checkboxes-Ca9fTce_.cjs.map +1 -0
- package/dist/{Checkboxes-BGrK_mwQ.js → Checkboxes-D1hppxDE.js} +7 -10
- package/dist/Checkboxes-D1hppxDE.js.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-BnZW6fwm.cjs → FieldArray-CnxCQt0o.cjs} +34 -53
- package/dist/FieldArray-CnxCQt0o.cjs.map +1 -0
- package/dist/{FieldArray-C53ox8yB.js → FieldArray-n39Aj9AV.js} +19 -38
- package/dist/FieldArray-n39Aj9AV.js.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-DbuGSb_j.cjs} +20 -24
- package/dist/FieldCard-DbuGSb_j.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-4uupFq1U.cjs → FieldCopyTestIdButton-BvVBidko.cjs} +14 -17
- package/dist/FieldCopyTestIdButton-BvVBidko.cjs.map +1 -0
- package/dist/{FieldCopyTestIdButton-BoEdlzLs.js → FieldCopyTestIdButton-Dpmo0uBV.js} +4 -7
- package/dist/FieldCopyTestIdButton-Dpmo0uBV.js.map +1 -0
- package/dist/{FieldValidationError-Br6iopZj.cjs → FieldValidationError-EecXNx5F.cjs} +14 -17
- package/dist/FieldValidationError-EecXNx5F.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-Diivw8pg.cjs} +17 -22
- package/dist/Form-Diivw8pg.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-BSLO2-sO.cjs → FormContext-3GzWxXSS.cjs} +28 -36
- package/dist/{FormContext-BSLO2-sO.cjs.map → FormContext-3GzWxXSS.cjs.map} +1 -1
- 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-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-CeaybCIF.js → Grid-Bzyi97Cx.js} +5 -8
- package/dist/Grid-Bzyi97Cx.js.map +1 -0
- package/dist/Grid-V1pCY2LC.cjs +32 -0
- package/dist/Grid-V1pCY2LC.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-C6kRsqx1.cjs} +18 -21
- package/dist/Input-C6kRsqx1.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-DNQCynvF.js} +6 -10
- package/dist/RadioBoxes-DNQCynvF.js.map +1 -0
- package/dist/{RadioBoxes-xRvNe5U8.cjs → RadioBoxes-DVxDhpbp.cjs} +23 -27
- package/dist/RadioBoxes-DVxDhpbp.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-BaHvYcd-.cjs → RadioTabs-CFraIx6w.cjs} +18 -21
- package/dist/RadioTabs-CFraIx6w.cjs.map +1 -0
- package/dist/{RadioTabs-DfOGIsEf.js → RadioTabs-CsVqYCE9.js} +6 -9
- package/dist/RadioTabs-CsVqYCE9.js.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-C-Zf3Yij.js} +6 -9
- package/dist/Radios-C-Zf3Yij.js.map +1 -0
- package/dist/{Radios-BfA3uL35.cjs → Radios-OhSB1oFo.cjs} +18 -21
- package/dist/Radios-OhSB1oFo.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-DlEUzYl6.js → Select-DMpCAYLB.js} +7 -10
- package/dist/Select-DMpCAYLB.js.map +1 -0
- package/dist/{Select-DH_YaruM.cjs → Select-fEJPVWJa.cjs} +21 -24
- package/dist/Select-fEJPVWJa.cjs.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-ChBNfwS2.cjs} +16 -19
- package/dist/Slider-ChBNfwS2.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-CfuPpJKk.cjs} +15 -18
- package/dist/SubmitButton-CfuPpJKk.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-MDrnacFJ.cjs} +16 -19
- package/dist/Switch-MDrnacFJ.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-kp93uE8e.cjs} +21 -24
- package/dist/SwitchBox-kp93uE8e.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-BYEuk4Ng.cjs → TextArea-B8XYKqFg.cjs} +18 -21
- package/dist/TextArea-B8XYKqFg.cjs.map +1 -0
- package/dist/{TextArea-BLkVYmHZ.js → TextArea-Bxi2pXvY.js} +6 -9
- package/dist/TextArea-Bxi2pXvY.js.map +1 -0
- package/dist/helpers/index.cjs +397 -10
- package/dist/helpers/index.cjs.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 -2
- 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 -6
- 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-C6iTO4TR.d.cts → index-1Gzrph8R.d.cts} +35 -36
- package/dist/index-1Gzrph8R.d.cts.map +1 -0
- package/dist/index-B0Fw1BAy.d.cts +278 -0
- package/dist/index-B0Fw1BAy.d.cts.map +1 -0
- package/dist/{index-BRvTllFR.d.cts → index-B2tIMFYh.d.cts} +22 -22
- package/dist/index-B2tIMFYh.d.cts.map +1 -0
- package/dist/{index-CC2Rnywy.d.cts → index-B6WwxkLx2.d.ts} +3 -3
- package/dist/index-B6WwxkLx2.d.ts.map +1 -0
- package/dist/{index-CYbsLxVV.d.ts → index-BExpqT81.d.ts} +22 -22
- package/dist/index-BExpqT81.d.ts.map +1 -0
- package/dist/{index-Dkfbf-VN.d.ts → index-BLctuwc0.d.ts} +36 -36
- package/dist/index-BLctuwc0.d.ts.map +1 -0
- package/dist/{index-DelQykFp.d.ts → index-BV1VKQdy.d.cts} +3 -3
- package/dist/{index-CUIi5IqH.d.cts.map → index-BV1VKQdy.d.cts.map} +1 -1
- package/dist/{index-D_iyWuBa.d.cts → index-BdYKQ59a.d.cts} +7 -7
- package/dist/index-BdYKQ59a.d.cts.map +1 -0
- package/dist/{index-_6c2OwSa.d.cts → index-BqWtWLeP.d.cts} +36 -36
- package/dist/index-BqWtWLeP.d.cts.map +1 -0
- package/dist/{index-DhayQWKz.d.ts → index-BwAI1VFS.d.ts} +6 -6
- package/dist/index-BwAI1VFS.d.ts.map +1 -0
- package/dist/{index-QFAAtvOV.d.cts → index-C-DiLZRu.d.cts} +6 -6
- package/dist/index-C-DiLZRu.d.cts.map +1 -0
- package/dist/{index-BvRjEXt-.d.ts → index-C6dMrOEm.d.cts} +48 -48
- package/dist/index-C6dMrOEm.d.cts.map +1 -0
- package/dist/{index-Bg3AbFZf.d.ts → index-CE0aQlFw.d.ts} +7 -7
- package/dist/index-CE0aQlFw.d.ts.map +1 -0
- package/dist/{index-D0OJCk7N.d.ts → index-CKJumX37.d.cts} +34 -34
- package/dist/index-CKJumX37.d.cts.map +1 -0
- package/dist/{index-BdrSpcmR.d.ts → index-CY2Mpaz3.d.cts} +4 -4
- package/dist/index-CY2Mpaz3.d.cts.map +1 -0
- package/dist/{index-DiFA3eG2.d.ts → index-CZJ_lWQ0.d.ts} +21 -21
- package/dist/index-CZJ_lWQ0.d.ts.map +1 -0
- package/dist/{index-CUIi5IqH.d.cts → index-Cv4ERj3i.d.ts} +3 -3
- package/dist/{index-DelQykFp.d.ts.map → index-Cv4ERj3i.d.ts.map} +1 -1
- package/dist/{index-B3ly1uwg.d.ts → index-D6XwSwTP.d.cts} +6 -6
- package/dist/{index-CxeYvJ7m.d.cts.map → index-D6XwSwTP.d.cts.map} +1 -1
- package/dist/{index-DqY28C4j.d.cts → index-DD_RPe91.d.ts} +4 -4
- package/dist/index-DD_RPe91.d.ts.map +1 -0
- package/dist/{index-DIMnCRyt.d.ts → index-DFWSHdua.d.ts} +3 -3
- package/dist/{index-DIMnCRyt.d.ts.map → index-DFWSHdua.d.ts.map} +1 -1
- package/dist/index-DGHBlmnV.d.ts +278 -0
- package/dist/index-DGHBlmnV.d.ts.map +1 -0
- package/dist/{index-CHACvIcy.d.ts → index-DJe_1ZdK.d.ts} +35 -37
- package/dist/index-DJe_1ZdK.d.ts.map +1 -0
- package/dist/{index-D3L2S2b3.d.cts → index-DZzfeV4O.d.cts} +21 -21
- package/dist/index-DZzfeV4O.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-NykXDzr-.d.cts → index-DkiQkdCW.d.cts} +3 -3
- package/dist/{index-NykXDzr-.d.cts.map → index-DkiQkdCW.d.cts.map} +1 -1
- package/dist/{index-CuNl43Zr.d.ts → index-DkxqHE_P2.d.ts} +3 -3
- package/dist/{index-DuJr42nE.d.cts.map → index-DkxqHE_P2.d.ts.map} +1 -1
- package/dist/{index-DuJr42nE.d.cts → index-Dld6NP_K.d.cts} +3 -3
- package/dist/index-Dld6NP_K.d.cts.map +1 -0
- package/dist/{index-BtX5upPu.d.cts → index-DpNf55K6.d.ts} +34 -34
- package/dist/index-DpNf55K6.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-BE6hzbN3.d.cts → index-NjKV8LJD.d.cts} +4 -4
- package/dist/{index-BE6hzbN3.d.cts.map → index-NjKV8LJD.d.cts.map} +1 -1
- package/dist/{index-HfbCo9ep.d.cts → index-Yj6VEhqF.d.ts} +48 -48
- package/dist/index-Yj6VEhqF.d.ts.map +1 -0
- package/dist/{index-CxeYvJ7m.d.cts → index-fgARdsoB.d.ts} +6 -6
- package/dist/{index-B3ly1uwg.d.ts.map → index-fgARdsoB.d.ts.map} +1 -1
- package/dist/{index-DmlsX2k6.d.ts → index-jCfJAgDc.d.cts} +3 -3
- package/dist/index-jCfJAgDc.d.cts.map +1 -0
- package/dist/{index-D6strMx0.d.ts → index-pwXVq8hR.d.cts} +6 -6
- package/dist/index-pwXVq8hR.d.cts.map +1 -0
- package/dist/{index-C_EyZKET.d.cts → 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 +26 -26
- package/dist/index.d.ts +26 -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-Dw-dmynu.d.cts → useClientValidation-Bu3mNZpf.d.cts} +3 -3
- package/dist/{useClientValidation-Dw-dmynu.d.cts.map → useClientValidation-Bu3mNZpf.d.cts.map} +1 -1
- 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-Dnj_wuwf.cjs → useClientValidation-HqsAYK9K.cjs} +16 -17
- package/dist/useClientValidation-HqsAYK9K.cjs.map +1 -0
- package/dist/{useClientValidation-DxFgfsEI.d.ts → useClientValidation-_8PTmv8i.d.ts} +3 -3
- package/dist/{useClientValidation-DxFgfsEI.d.ts.map → useClientValidation-_8PTmv8i.d.ts.map} +1 -1
- 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-CvPWE2Sy.d.cts → useController-CNiqy_2D.d.cts} +1 -1
- package/dist/{useController-CvPWE2Sy.d.cts.map → useController-CNiqy_2D.d.cts.map} +1 -1
- package/dist/{useController-DfiNbuEz.d.ts → useController-Cc0UNQMm.d.ts} +1 -1
- package/dist/{useController-DfiNbuEz.d.ts.map → useController-Cc0UNQMm.d.ts.map} +1 -1
- package/dist/{useController-B_SSp5Z5.cjs → useController-D3a0qufz.cjs} +11 -12
- package/dist/{useController-B_SSp5Z5.cjs.map → useController-D3a0qufz.cjs.map} +1 -1
- package/dist/{useFormContext-vdeeDsAs.cjs → useFormContext-BQeGmV8j.cjs} +20 -21
- package/dist/{useFormContext-vdeeDsAs.cjs.map → useFormContext-BQeGmV8j.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-Dh97YG47.d.cts → useFormContext-C06aufHt.d.cts} +24 -24
- package/dist/useFormContext-C06aufHt.d.cts.map +1 -0
- package/dist/{useFormContext-C6OOtqZ5.d.ts → useFormContext-CHA8GnKp.d.ts} +24 -24
- package/dist/useFormContext-CHA8GnKp.d.ts.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-Cl6Xeso7.cjs} +8 -9
- package/dist/{useInputValueTransform-BBRvvhDe.cjs.map → useInputValueTransform-Cl6Xeso7.cjs.map} +1 -1
- package/dist/{useUniformField-CqqIJtqo.d.ts → useUniformField-BTBS1Kv-.d.ts} +5 -5
- package/dist/{useUniformField-CqqIJtqo.d.ts.map → useUniformField-BTBS1Kv-.d.ts.map} +1 -1
- package/dist/{useUniformField-DIb__gKK.d.cts → useUniformField-j22kM31n.d.cts} +5 -5
- package/dist/{useUniformField-DIb__gKK.d.cts.map → useUniformField-j22kM31n.d.cts.map} +1 -1
- package/dist/{useUniformFieldArray-BChcZvc5.d.cts → useUniformFieldArray-CDEagafl.d.cts} +18 -18
- package/dist/useUniformFieldArray-CDEagafl.d.cts.map +1 -0
- package/dist/{useUniformFieldArray-4MOU0xac.d.ts → useUniformFieldArray-CMHoo4o3.d.ts} +18 -18
- package/dist/useUniformFieldArray-CMHoo4o3.d.ts.map +1 -0
- package/dist/{useWatchUserChange-CYd_8zeN.d.ts → useWatchUserChange-CH4x16_r.d.ts} +1 -1
- package/dist/{useWatchUserChange-CYd_8zeN.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-DedTNvGV.d.cts → useWatchUserChange-CZu_ZZ38.d.cts} +1 -1
- package/dist/{useWatchUserChange-DedTNvGV.d.cts.map → useWatchUserChange-CZu_ZZ38.d.cts.map} +1 -1
- package/dist/{useWatchUserChange-C1Kluht2.cjs → useWatchUserChange-DkZ0Vqv3.cjs} +9 -10
- package/dist/{useWatchUserChange-C1Kluht2.cjs.map → useWatchUserChange-DkZ0Vqv3.cjs.map} +1 -1
- package/package.json +71 -67
- package/dist/Checkboxes-BGrK_mwQ.js.map +0 -1
- package/dist/Checkboxes-Dk7yyRVR.cjs.map +0 -1
- package/dist/FieldArray-BnZW6fwm.cjs.map +0 -1
- package/dist/FieldArray-C53ox8yB.js.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-CE1fZKmV.cjs +0 -35
- package/dist/Grid-CE1fZKmV.cjs.map +0 -1
- package/dist/Grid-CeaybCIF.js.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-BRvTllFR.d.cts.map +0 -1
- package/dist/index-BdrSpcmR.d.ts.map +0 -1
- package/dist/index-Bg3AbFZf.d.ts.map +0 -1
- package/dist/index-BtX5upPu.d.cts.map +0 -1
- package/dist/index-BvRjEXt-.d.ts.map +0 -1
- package/dist/index-C6iTO4TR.d.cts.map +0 -1
- package/dist/index-CC2Rnywy.d.cts.map +0 -1
- package/dist/index-CHACvIcy.d.ts.map +0 -1
- package/dist/index-CM7UugT3.d.cts +0 -278
- package/dist/index-CM7UugT3.d.cts.map +0 -1
- package/dist/index-CYbsLxVV.d.ts.map +0 -1
- package/dist/index-C_EyZKET.d.cts.map +0 -1
- package/dist/index-Ca2ovPTq.d.ts +0 -278
- package/dist/index-Ca2ovPTq.d.ts.map +0 -1
- package/dist/index-CuNl43Zr.d.ts.map +0 -1
- package/dist/index-D0OJCk7N.d.ts.map +0 -1
- package/dist/index-D3L2S2b3.d.cts.map +0 -1
- package/dist/index-D6strMx0.d.ts.map +0 -1
- package/dist/index-D_iyWuBa.d.cts.map +0 -1
- package/dist/index-DhayQWKz.d.ts.map +0 -1
- package/dist/index-DiFA3eG2.d.ts.map +0 -1
- package/dist/index-Dkfbf-VN.d.ts.map +0 -1
- package/dist/index-DmlsX2k6.d.ts.map +0 -1
- package/dist/index-DqY28C4j.d.cts.map +0 -1
- package/dist/index-HfbCo9ep.d.cts.map +0 -1
- package/dist/index-QFAAtvOV.d.cts.map +0 -1
- package/dist/index-_6c2OwSa.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-4MOU0xac.d.ts.map +0 -1
- package/dist/useUniformFieldArray-BChcZvc5.d.cts.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/{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-D86jXpHS.d.cts → index-BtBZHVmz.d.cts} +0 -0
- /package/dist/{index-DDRpa5CJ.d.cts → index-CI4LJief.d.ts} +0 -0
- /package/dist/{index-GGHuYh77.d.ts → index-DeEmP3Jc.d.cts} +0 -0
- /package/dist/{index-hIBrhvnj.d.ts → index-sQecLSpR.d.cts} +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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useFormContext-CLymm_7t.js","names":[],"sources":["../src/hooks/useFormContext/index.ts"],"sourcesContent":["/* v8 ignore start */\n\nexport * from './useFormContext';\n\n/* v8 ignore stop */\n"],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useFormContext-CkeSOfWD.cjs","names":[],"sources":["../src/hooks/useFormContext/index.ts"],"sourcesContent":["/* v8 ignore start */\n\nexport * from './useFormContext';\n\n/* v8 ignore stop */\n"],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useFormContext-Dh97YG47.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;;;;;;;;;;;;;;;;6BAWf,kBAAA,KAAA,OAAA;;0BAAA,kBAAA;;;;mBAwB/B,YAAA;eAEoB,YAAA;aAAwE,kBAAA;qDAAA,gBAAA,CAAA,WAAA;EAAA"}
|
|
@@ -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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useUniformFieldArray-4MOU0xac.d.ts","names":[],"sources":["../src/hooks/useUniformFieldArray/useUniformFieldArray.ts"],"mappings":";;;;;;;;UAYiB,yBAAA,sBACM,WAAA,GAAc,WAAA;;EAGnC,IAAA,EAAM,SAAA,CAAU,YAAA;;EAEhB,IAAA;EANe;EAQf,mBAAA;EARwC;EAUxC,uBAAA;EATmC;EAWnC,QAAA;EARM;EAUN,MAAA;EAEiB;EAAjB,KAAA,GAAQ,SAAA;AAAA;;;;;;;;;;;;;cAeG,oBAAA,wBACU,WAAA,GAAc,WAAA;EACnC,IAAA;EAAA,IAAA;EAAA,mBAAA,EAAA,oBAAA;EAAA,uBAAA;EAAA,QAAA;EAAA,MAAA,EAAA,cAAA;EAAA;AAAA,GAQC,yBAAA,CAA0B,YAAA;;;;;;;;;kBAhC+B,KAAA;;;;;;;;;UAqExB,UAAA;YAEX,UAAA,QAFW,eAAA;OAKzB,UAAA,QAHc,eAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useUniformFieldArray-BChcZvc5.d.cts","names":[],"sources":["../src/hooks/useUniformFieldArray/useUniformFieldArray.ts"],"mappings":";;;;;;;;UAYiB,yBAAA,sBACM,WAAA,GAAc,WAAA;;EAGnC,IAAA,EAAM,SAAA,CAAU,YAAA;;EAEhB,IAAA;EANe;EAQf,mBAAA;EARwC;EAUxC,uBAAA;EATmC;EAWnC,QAAA;EARM;EAUN,MAAA;EAEiB;EAAjB,KAAA,GAAQ,SAAA;AAAA;;;;;;;;;;;;;cAeG,oBAAA,wBACU,WAAA,GAAc,WAAA;EACnC,IAAA;EAAA,IAAA;EAAA,mBAAA,EAAA,oBAAA;EAAA,uBAAA;EAAA,QAAA;EAAA,MAAA,EAAA,cAAA;EAAA;AAAA,GAQC,yBAAA,CAA0B,YAAA;;;;;;;;;kBAhC+B,KAAA;;;;;;;;;UAqExB,UAAA;YAEX,UAAA,QAFW,aAAA;OAKzB,UAAA,QAHc,aAAA"}
|