@fuf-stack/uniform 1.11.3 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Checkboxes/index.cjs +1 -1
- package/dist/Checkboxes/index.d.cts +1 -1
- package/dist/Checkboxes/index.d.ts +1 -1
- package/dist/Checkboxes/index.js +1 -1
- package/dist/{Checkboxes-BvW4D5Nm.js → Checkboxes-BQI2kTIb.js} +2 -2
- package/dist/{Checkboxes-BvW4D5Nm.js.map → Checkboxes-BQI2kTIb.js.map} +1 -1
- package/dist/{Checkboxes-Cvdazf25.cjs → Checkboxes-mc1ZItR5.cjs} +4 -4
- package/dist/{Checkboxes-Cvdazf25.cjs.map → Checkboxes-mc1ZItR5.cjs.map} +1 -1
- package/dist/FieldArray/index.cjs +1 -1
- package/dist/FieldArray/index.d.cts +1 -1
- package/dist/FieldArray/index.d.ts +1 -1
- package/dist/FieldArray/index.js +1 -1
- package/dist/{FieldArray-CJpDgK_t.cjs → FieldArray-CsAyIsw9.cjs} +7 -7
- package/dist/{FieldArray-CJpDgK_t.cjs.map → FieldArray-CsAyIsw9.cjs.map} +1 -1
- package/dist/{FieldArray-omRNwxgy.js → FieldArray-D4eGdGXA.js} +4 -4
- package/dist/{FieldArray-omRNwxgy.js.map → FieldArray-D4eGdGXA.js.map} +1 -1
- package/dist/FieldCard/index.cjs +1 -1
- package/dist/FieldCard/index.d.cts +1 -1
- package/dist/FieldCard/index.d.ts +1 -1
- package/dist/FieldCard/index.js +1 -1
- package/dist/{FieldCard-Dyi-2qr6.js → FieldCard-BPQIqqW5.js} +2 -2
- package/dist/{FieldCard-Dyi-2qr6.js.map → FieldCard-BPQIqqW5.js.map} +1 -1
- package/dist/{FieldCard-Dt6QU7o7.cjs → FieldCard-CgWjzrRD.cjs} +4 -4
- package/dist/{FieldCard-Dt6QU7o7.cjs.map → FieldCard-CgWjzrRD.cjs.map} +1 -1
- package/dist/{FieldCopyTestIdButton-By-hEZgA.cjs → FieldCopyTestIdButton-DxJYKqrz.cjs} +2 -2
- package/dist/{FieldCopyTestIdButton-By-hEZgA.cjs.map → FieldCopyTestIdButton-DxJYKqrz.cjs.map} +1 -1
- package/dist/{FieldValidationError-D64j5gnH.cjs → FieldValidationError-A384-L3Y.cjs} +2 -2
- package/dist/{FieldValidationError-D64j5gnH.cjs.map → FieldValidationError-A384-L3Y.cjs.map} +1 -1
- package/dist/Form/index.cjs +1 -1
- package/dist/Form/index.d.cts +1 -1
- package/dist/Form/index.d.ts +1 -1
- package/dist/Form/index.js +1 -1
- package/dist/{Form-B1fvbnxi.js → Form-B7bv9fDO.js} +3 -3
- package/dist/{Form-B1fvbnxi.js.map → Form-B7bv9fDO.js.map} +1 -1
- package/dist/{Form-CvnnGF45.cjs → Form-Ca3RxssB.cjs} +3 -3
- package/dist/{Form-CvnnGF45.cjs.map → Form-Ca3RxssB.cjs.map} +1 -1
- package/dist/{FormContext-Lw4YL4-B.cjs → FormContext-CeFKQmVH.cjs} +2 -2
- package/dist/{FormContext-Lw4YL4-B.cjs.map → FormContext-CeFKQmVH.cjs.map} +1 -1
- package/dist/{FormContext-Dl3k1r_k.js → FormContext-DHYlCZ2u.js} +2 -2
- package/dist/{FormContext-Dl3k1r_k.js.map → FormContext-DHYlCZ2u.js.map} +1 -1
- package/dist/Grid/index.cjs +1 -1
- package/dist/Grid/index.d.cts +1 -1
- package/dist/Grid/index.d.ts +1 -1
- package/dist/{Grid-DezBAZbx.cjs → Grid-CRURvciu.cjs} +2 -2
- package/dist/{Grid-DezBAZbx.cjs.map → Grid-CRURvciu.cjs.map} +1 -1
- package/dist/Input/index.cjs +1 -1
- package/dist/Input/index.d.cts +1 -1
- package/dist/Input/index.d.ts +1 -1
- package/dist/Input/index.js +1 -1
- package/dist/{Input-DR0gCf9q.cjs → Input-7TmTrrV7.cjs} +4 -4
- package/dist/{Input-DR0gCf9q.cjs.map → Input-7TmTrrV7.cjs.map} +1 -1
- package/dist/{Input-DksaHK1Y.js → Input-BUfOTtDR.js} +3 -3
- package/dist/{Input-DksaHK1Y.js.map → Input-BUfOTtDR.js.map} +1 -1
- package/dist/RadioBoxes/index.cjs +1 -1
- package/dist/RadioBoxes/index.d.cts +1 -1
- package/dist/RadioBoxes/index.d.ts +1 -1
- package/dist/RadioBoxes/index.js +1 -1
- package/dist/{RadioBoxes-h-VLhJ9d.cjs → RadioBoxes-CjxWldIR.cjs} +11 -7
- package/dist/RadioBoxes-CjxWldIR.cjs.map +1 -0
- package/dist/{RadioBoxes-DdIHH6B5.js → RadioBoxes-Dpd71z1S.js} +10 -6
- package/dist/RadioBoxes-Dpd71z1S.js.map +1 -0
- package/dist/RadioTabs/index.cjs +1 -1
- package/dist/RadioTabs/index.d.cts +1 -1
- package/dist/RadioTabs/index.d.ts +1 -1
- package/dist/RadioTabs/index.js +1 -1
- package/dist/{RadioTabs-D6yF9jE3.cjs → RadioTabs-BA-EMFRc.cjs} +11 -7
- package/dist/RadioTabs-BA-EMFRc.cjs.map +1 -0
- package/dist/{RadioTabs-dLdlF91p.js → RadioTabs-BZlC19z0.js} +10 -6
- package/dist/RadioTabs-BZlC19z0.js.map +1 -0
- package/dist/Radios/index.cjs +1 -1
- package/dist/Radios/index.d.cts +1 -1
- package/dist/Radios/index.d.ts +1 -1
- package/dist/Radios/index.js +1 -1
- package/dist/{Radios-D8alyG2f.cjs → Radios-Bfxy-Vnf.cjs} +11 -7
- package/dist/Radios-Bfxy-Vnf.cjs.map +1 -0
- package/dist/{Radios-DiZ0Dfmp.js → Radios-ClBrO7QR.js} +10 -6
- package/dist/Radios-ClBrO7QR.js.map +1 -0
- package/dist/Select/index.cjs +1 -1
- package/dist/Select/index.d.cts +1 -1
- package/dist/Select/index.d.ts +1 -1
- package/dist/Select/index.js +1 -1
- package/dist/{Select-C9otN8uu.js → Select-9MyYYGeZ.js} +12 -7
- package/dist/Select-9MyYYGeZ.js.map +1 -0
- package/dist/{Select-DQVskslz.cjs → Select-CdTgOiUU.cjs} +13 -8
- package/dist/Select-CdTgOiUU.cjs.map +1 -0
- package/dist/Slider/index.cjs +1 -1
- package/dist/Slider/index.d.cts +1 -1
- package/dist/Slider/index.d.ts +1 -1
- package/dist/Slider/index.js +1 -1
- package/dist/{Slider-DwfyCQDM.cjs → Slider-CK9n0ryX.cjs} +3 -3
- package/dist/{Slider-DwfyCQDM.cjs.map → Slider-CK9n0ryX.cjs.map} +1 -1
- package/dist/{Slider-meuLEC2k.js → Slider-Cy5vz5as.js} +2 -2
- package/dist/{Slider-meuLEC2k.js.map → Slider-Cy5vz5as.js.map} +1 -1
- package/dist/SubmitButton/index.cjs +1 -1
- package/dist/SubmitButton/index.d.cts +1 -1
- package/dist/SubmitButton/index.d.ts +1 -1
- package/dist/SubmitButton/index.js +1 -1
- package/dist/{SubmitButton-BHP9J9ml.js → SubmitButton-BrbHJcb4.js} +2 -2
- package/dist/{SubmitButton-BHP9J9ml.js.map → SubmitButton-BrbHJcb4.js.map} +1 -1
- package/dist/{SubmitButton-B0kvUqkd.cjs → SubmitButton-C6sgPR8K.cjs} +3 -3
- package/dist/{SubmitButton-B0kvUqkd.cjs.map → SubmitButton-C6sgPR8K.cjs.map} +1 -1
- package/dist/Switch/index.cjs +1 -1
- package/dist/Switch/index.d.cts +1 -1
- package/dist/Switch/index.d.ts +1 -1
- package/dist/Switch/index.js +1 -1
- package/dist/{Switch-Ds0gDzjR.cjs → Switch-BBhxgBHh.cjs} +3 -3
- package/dist/{Switch-Ds0gDzjR.cjs.map → Switch-BBhxgBHh.cjs.map} +1 -1
- package/dist/{Switch-DkciIYnD.js → Switch-s64WUP5i.js} +2 -2
- package/dist/{Switch-DkciIYnD.js.map → Switch-s64WUP5i.js.map} +1 -1
- package/dist/SwitchBox/index.cjs +1 -1
- package/dist/SwitchBox/index.d.cts +1 -1
- package/dist/SwitchBox/index.d.ts +1 -1
- package/dist/SwitchBox/index.js +1 -1
- package/dist/{SwitchBox-B9JqwDtN.cjs → SwitchBox-BwdvgHpG.cjs} +3 -3
- package/dist/{SwitchBox-B9JqwDtN.cjs.map → SwitchBox-BwdvgHpG.cjs.map} +1 -1
- package/dist/{SwitchBox-B6Z4rtWt.js → SwitchBox-CMw1MGJ0.js} +2 -2
- package/dist/{SwitchBox-B6Z4rtWt.js.map → SwitchBox-CMw1MGJ0.js.map} +1 -1
- package/dist/TextArea/index.cjs +1 -1
- package/dist/TextArea/index.d.cts +1 -1
- package/dist/TextArea/index.d.ts +1 -1
- package/dist/TextArea/index.js +1 -1
- package/dist/{TextArea-BqQtlPSV.cjs → TextArea-COe8XP7f.cjs} +4 -4
- package/dist/{TextArea-BqQtlPSV.cjs.map → TextArea-COe8XP7f.cjs.map} +1 -1
- package/dist/{TextArea-DAx49KI6.js → TextArea-DTkDJr6g.js} +3 -3
- package/dist/{TextArea-DAx49KI6.js.map → TextArea-DTkDJr6g.js.map} +1 -1
- package/dist/helpers/index.cjs +2 -1
- package/dist/helpers/index.d.cts +23 -1
- package/dist/helpers/index.d.cts.map +1 -1
- package/dist/helpers/index.d.ts +23 -1
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +2 -2
- package/dist/{helpers-nYTmL2gX.cjs → helpers-CncbgvW_.cjs} +52 -2
- package/dist/helpers-CncbgvW_.cjs.map +1 -0
- package/dist/{helpers-CCINRgQk.js → helpers-D3A5d3M1.js} +46 -2
- package/dist/helpers-D3A5d3M1.js.map +1 -0
- package/dist/hooks/useClientValidation/index.cjs +1 -1
- package/dist/hooks/useClientValidation/index.js +1 -1
- package/dist/hooks/useController/index.cjs +1 -1
- package/dist/hooks/useController/index.js +1 -1
- package/dist/hooks/useFormContext/index.cjs +1 -1
- package/dist/hooks/useFormContext/index.d.cts +1 -1
- package/dist/hooks/useFormContext/index.d.ts +1 -1
- package/dist/hooks/useFormContext/index.js +1 -1
- package/dist/hooks/useInput/index.cjs +1 -1
- package/dist/hooks/useInputValueDebounce/index.cjs +1 -1
- package/dist/hooks/useInputValueDebounce/index.js +1 -1
- package/dist/hooks/useInputValueTransform/index.cjs +1 -1
- package/dist/hooks/useUniformField/index.cjs +1 -1
- package/dist/hooks/useUniformField/index.d.cts +1 -1
- package/dist/hooks/useUniformField/index.d.ts +2 -2
- package/dist/hooks/useUniformField/index.js +1 -1
- package/dist/hooks/useUniformFieldArray/index.cjs +1 -1
- package/dist/hooks/useUniformFieldArray/index.d.cts +1 -1
- package/dist/hooks/useUniformFieldArray/index.d.ts +2 -2
- package/dist/hooks/useUniformFieldArray/index.js +1 -1
- package/dist/hooks/useWatchUserChange/index.cjs +1 -1
- package/dist/hooks/useWatchUserChange/index.js +1 -1
- package/dist/{index-BGXgvZKr.d.ts → index--J1-cUWg.d.cts} +8 -9
- package/dist/index--J1-cUWg.d.cts.map +1 -0
- package/dist/{index-BDV3JVoX.d.cts → index-7C539UUH.d.cts} +6 -6
- package/dist/{index-BDV3JVoX.d.cts.map → index-7C539UUH.d.cts.map} +1 -1
- package/dist/{index-CUn9q5KD.d.ts → index-BFeKALeM.d.ts} +4 -4
- package/dist/{index-CUn9q5KD.d.ts.map → index-BFeKALeM.d.ts.map} +1 -1
- package/dist/{index-CZyNkPDq.d.ts → index-BHmMP-ps.d.ts} +21 -21
- package/dist/{index-CZyNkPDq.d.ts.map → index-BHmMP-ps.d.ts.map} +1 -1
- package/dist/{index-B_aIzCcx.d.cts → index-BNu0EV5x.d.cts} +3 -3
- package/dist/{index-B_aIzCcx.d.cts.map → index-BNu0EV5x.d.cts.map} +1 -1
- package/dist/{index-CHXv_rNR.d.ts → index-Bd7H1tdb.d.cts} +3 -3
- package/dist/{index-cadUZZIY.d.cts.map → index-Bd7H1tdb.d.cts.map} +1 -1
- package/dist/{index-D_WidR7r.d.cts → index-BhqOFcsS.d.cts} +6 -6
- package/dist/{index-D_WidR7r.d.cts.map → index-BhqOFcsS.d.cts.map} +1 -1
- package/dist/{index-DnzC0GCS.d.ts → index-CASoDHjE.d.cts} +21 -21
- package/dist/{index-C2A_i57R.d.cts.map → index-CASoDHjE.d.cts.map} +1 -1
- package/dist/index-CNFk4ygb.d.ts +264 -0
- package/dist/index-CNFk4ygb.d.ts.map +1 -0
- package/dist/{index-C2A_i57R.d.cts → index-CPbrUN5A.d.ts} +20 -20
- package/dist/{index-DnzC0GCS.d.ts.map → index-CPbrUN5A.d.ts.map} +1 -1
- package/dist/{index-cadUZZIY.d.cts → index-CVY05bZf.d.ts} +2 -2
- package/dist/{index-CHXv_rNR.d.ts.map → index-CVY05bZf.d.ts.map} +1 -1
- package/dist/{index-DVRtBywt.d.ts → index-CXkSuHEL.d.ts} +3 -3
- package/dist/{index-DVRtBywt.d.ts.map → index-CXkSuHEL.d.ts.map} +1 -1
- package/dist/{index-CHNp5R5N.d.cts → index-CrpdF1Xw.d.cts} +6 -6
- package/dist/{index-CHNp5R5N.d.cts.map → index-CrpdF1Xw.d.cts.map} +1 -1
- package/dist/{index-CuvvZMop.d.cts → index-Cs-7Ptqc.d.cts} +3 -3
- package/dist/{index-CuvvZMop.d.cts.map → index-Cs-7Ptqc.d.cts.map} +1 -1
- package/dist/{index-CqGabrzW.d.cts → index-D3o2YTBb.d.ts} +38 -38
- package/dist/index-D3o2YTBb.d.ts.map +1 -0
- package/dist/{index-CeYRsehb.d.cts → index-D9VXD1rv.d.cts} +21 -21
- package/dist/index-D9VXD1rv.d.cts.map +1 -0
- package/dist/{index-yVkU2v6b.d.ts → index-DCZwOjSs.d.cts} +37 -37
- package/dist/index-DCZwOjSs.d.cts.map +1 -0
- package/dist/{index-op7zETAQ.d.ts → index-DEtF7ckd.d.ts} +35 -35
- package/dist/index-DEtF7ckd.d.ts.map +1 -0
- package/dist/{index-DcYFLiul.d.cts → index-DMVoX5pj.d.cts} +48 -48
- package/dist/{index-DcYFLiul.d.cts.map → index-DMVoX5pj.d.cts.map} +1 -1
- package/dist/{index-DNFUttM8.d.ts → index-DMojDmML.d.ts} +48 -48
- package/dist/index-DMojDmML.d.ts.map +1 -0
- package/dist/{index-0wXxS5M7.d.ts → index-DsuMjcQk.d.ts} +6 -6
- package/dist/{index-0wXxS5M7.d.ts.map → index-DsuMjcQk.d.ts.map} +1 -1
- package/dist/{index-g9TZhGnE.d.cts → index-DsyY9X04.d.cts} +3 -3
- package/dist/{index-g9TZhGnE.d.cts.map → index-DsyY9X04.d.cts.map} +1 -1
- package/dist/index-DtWIiEFa.d.cts +264 -0
- package/dist/index-DtWIiEFa.d.cts.map +1 -0
- package/dist/{index-1Egh73pR.d.ts → index-DvB46QAb.d.ts} +3 -3
- package/dist/{index-1Egh73pR.d.ts.map → index-DvB46QAb.d.ts.map} +1 -1
- package/dist/{index-3v_vja2i.d.ts → index-JdksqsGh.d.ts} +4 -4
- package/dist/{index-3v_vja2i.d.ts.map → index-JdksqsGh.d.ts.map} +1 -1
- package/dist/{index-CnsR8nkm.d.cts → index-JfAmWj81.d.cts} +35 -35
- package/dist/index-JfAmWj81.d.cts.map +1 -0
- package/dist/{index-BFLKkqA3.d.ts → index-KgMMIPyM.d.cts} +3 -3
- package/dist/{index-DvF_C1Bz.d.cts.map → index-KgMMIPyM.d.cts.map} +1 -1
- package/dist/{index-Bcppi5O7.d.ts → index-OwPGP648.d.ts} +5 -5
- package/dist/{index-BSjUaHEO.d.cts.map → index-OwPGP648.d.ts.map} +1 -1
- package/dist/{index-DvF_C1Bz.d.cts → index-TbDhDIfv.d.ts} +3 -3
- package/dist/{index-BFLKkqA3.d.ts.map → index-TbDhDIfv.d.ts.map} +1 -1
- package/dist/{index-7mx-IcDp.d.ts → index-Z0IxHoXS.d.ts} +3 -3
- package/dist/{index-7mx-IcDp.d.ts.map → index-Z0IxHoXS.d.ts.map} +1 -1
- package/dist/{index-CiF2KXB7.d.cts → index-_njc33cQ.d.cts} +6 -6
- package/dist/{index-CiF2KXB7.d.cts.map → index-_njc33cQ.d.cts.map} +1 -1
- package/dist/{index-CjJHVJwD.d.cts → index-_zWAtv8G.d.ts} +37 -36
- package/dist/index-_zWAtv8G.d.ts.map +1 -0
- package/dist/{index-BSjUaHEO.d.cts → index-acwVBMcR.d.cts} +5 -5
- package/dist/index-acwVBMcR.d.cts.map +1 -0
- package/dist/{index-CTp4vdDb.d.ts → index-rK5GxEPh.d.ts} +6 -6
- package/dist/{index-CTp4vdDb.d.ts.map → index-rK5GxEPh.d.ts.map} +1 -1
- package/dist/index.cjs +28 -27
- package/dist/index.d.cts +22 -22
- package/dist/index.d.ts +22 -22
- package/dist/index.js +23 -23
- package/dist/partials/FieldCopyTestIdButton/index.cjs +1 -1
- package/dist/partials/FieldCopyTestIdButton/index.d.cts +1 -1
- package/dist/partials/FieldCopyTestIdButton/index.d.ts +1 -1
- package/dist/partials/FieldValidationError/index.cjs +1 -1
- package/dist/partials/FieldValidationError/index.d.cts +1 -1
- package/dist/partials/FieldValidationError/index.d.ts +1 -1
- package/dist/{useClientValidation-BrTtRnqi.js → useClientValidation-C6Daq53C.js} +3 -3
- package/dist/{useClientValidation-BrTtRnqi.js.map → useClientValidation-C6Daq53C.js.map} +1 -1
- package/dist/{useClientValidation-CdC7lEYP.cjs → useClientValidation-DzomULfo.cjs} +4 -4
- package/dist/{useClientValidation-CdC7lEYP.cjs.map → useClientValidation-DzomULfo.cjs.map} +1 -1
- package/dist/useController-BArZd2Vp.d.cts.map +1 -1
- package/dist/{useController-g0AlWM__.js → useController-BPDcwfTj.js} +3 -3
- package/dist/{useController-g0AlWM__.js.map → useController-BPDcwfTj.js.map} +1 -1
- package/dist/{useController-BBxji1nQ.cjs → useController-DHRkSHem.cjs} +3 -3
- package/dist/{useController-BBxji1nQ.cjs.map → useController-DHRkSHem.cjs.map} +1 -1
- package/dist/{useFormContext-Cw6aAhos.d.ts → useFormContext-B2TS6xq0.d.ts} +3 -3
- package/dist/useFormContext-B2TS6xq0.d.ts.map +1 -0
- package/dist/{useFormContext-CEr3zcL6.cjs → useFormContext-DJiJlfGJ.cjs} +3 -3
- package/dist/{useFormContext-CEr3zcL6.cjs.map → useFormContext-DJiJlfGJ.cjs.map} +1 -1
- package/dist/{useFormContext-BFoXZNkp.js → useFormContext-UFBqUfOr.js} +3 -3
- package/dist/{useFormContext-BFoXZNkp.js.map → useFormContext-UFBqUfOr.js.map} +1 -1
- package/dist/{useFormContext--yod5xzQ.d.cts → useFormContext-n3WYgGkW.d.cts} +19 -19
- package/dist/useFormContext-n3WYgGkW.d.cts.map +1 -0
- package/dist/{useInputValueDebounce-Dop_8_OK.js → useInputValueDebounce-D9wArTKz.js} +2 -2
- package/dist/{useInputValueDebounce-Dop_8_OK.js.map → useInputValueDebounce-D9wArTKz.js.map} +1 -1
- package/dist/{useInputValueDebounce-TiNR4jtG.cjs → useInputValueDebounce-KIKsvSLm.cjs} +3 -3
- package/dist/{useInputValueDebounce-TiNR4jtG.cjs.map → useInputValueDebounce-KIKsvSLm.cjs.map} +1 -1
- package/dist/{useInputValueTransform-BNmfaj5D.cjs → useInputValueTransform-DuhPVE4L.cjs} +2 -2
- package/dist/{useInputValueTransform-BNmfaj5D.cjs.map → useInputValueTransform-DuhPVE4L.cjs.map} +1 -1
- package/dist/{useUniformField-RxZqXMuD.d.ts → useUniformField-Bzv-6MG1.d.ts} +2 -2
- package/dist/{useUniformField-RxZqXMuD.d.ts.map → useUniformField-Bzv-6MG1.d.ts.map} +1 -1
- package/dist/{useUniformField-D6fwSjrH.cjs → useUniformField-CGiibqg4.cjs} +8 -8
- package/dist/{useUniformField-D6fwSjrH.cjs.map → useUniformField-CGiibqg4.cjs.map} +1 -1
- package/dist/{useUniformField-B2zQtEbr.d.cts → useUniformField-CrEz5lkV.d.cts} +2 -2
- package/dist/{useUniformField-B2zQtEbr.d.cts.map → useUniformField-CrEz5lkV.d.cts.map} +1 -1
- package/dist/{useUniformField-BKVVns0E.js → useUniformField-D2NgevBI.js} +4 -4
- package/dist/{useUniformField-BKVVns0E.js.map → useUniformField-D2NgevBI.js.map} +1 -1
- package/dist/{useUniformFieldArray-WRuIMhw6.d.cts → useUniformFieldArray-B2-Bfl74.d.cts} +13 -13
- package/dist/{useUniformFieldArray-WRuIMhw6.d.cts.map → useUniformFieldArray-B2-Bfl74.d.cts.map} +1 -1
- package/dist/{useUniformFieldArray-Byfmzq97.cjs → useUniformFieldArray-Ct8jD7JJ.cjs} +5 -5
- package/dist/{useUniformFieldArray-Byfmzq97.cjs.map → useUniformFieldArray-Ct8jD7JJ.cjs.map} +1 -1
- package/dist/{useUniformFieldArray-BwE634m6.js → useUniformFieldArray-DcoVYtqx.js} +4 -4
- package/dist/{useUniformFieldArray-BwE634m6.js.map → useUniformFieldArray-DcoVYtqx.js.map} +1 -1
- package/dist/{useUniformFieldArray-B_c55CnX.d.ts → useUniformFieldArray-jUCzsveX.d.ts} +2 -2
- package/dist/{useUniformFieldArray-B_c55CnX.d.ts.map → useUniformFieldArray-jUCzsveX.d.ts.map} +1 -1
- package/dist/{useWatchUserChange-fZy6nGtD.js → useWatchUserChange-1ELFYX_F.js} +2 -2
- package/dist/{useWatchUserChange-fZy6nGtD.js.map → useWatchUserChange-1ELFYX_F.js.map} +1 -1
- package/dist/{useWatchUserChange-TMfaTCcp.cjs → useWatchUserChange-C1zOvSSU.cjs} +3 -3
- package/dist/{useWatchUserChange-TMfaTCcp.cjs.map → useWatchUserChange-C1zOvSSU.cjs.map} +1 -1
- package/package.json +5 -5
- package/dist/RadioBoxes-DdIHH6B5.js.map +0 -1
- package/dist/RadioBoxes-h-VLhJ9d.cjs.map +0 -1
- package/dist/RadioTabs-D6yF9jE3.cjs.map +0 -1
- package/dist/RadioTabs-dLdlF91p.js.map +0 -1
- package/dist/Radios-D8alyG2f.cjs.map +0 -1
- package/dist/Radios-DiZ0Dfmp.js.map +0 -1
- package/dist/Select-C9otN8uu.js.map +0 -1
- package/dist/Select-DQVskslz.cjs.map +0 -1
- package/dist/helpers-CCINRgQk.js.map +0 -1
- package/dist/helpers-nYTmL2gX.cjs.map +0 -1
- package/dist/index-BGXgvZKr.d.ts.map +0 -1
- package/dist/index-Bcppi5O7.d.ts.map +0 -1
- package/dist/index-CeYRsehb.d.cts.map +0 -1
- package/dist/index-CjJHVJwD.d.cts.map +0 -1
- package/dist/index-CnsR8nkm.d.cts.map +0 -1
- package/dist/index-CqGabrzW.d.cts.map +0 -1
- package/dist/index-DNFUttM8.d.ts.map +0 -1
- package/dist/index-D_egu-QT.d.cts +0 -264
- package/dist/index-D_egu-QT.d.cts.map +0 -1
- package/dist/index-DajjPPWM.d.ts +0 -264
- package/dist/index-DajjPPWM.d.ts.map +0 -1
- package/dist/index-op7zETAQ.d.ts.map +0 -1
- package/dist/index-yVkU2v6b.d.ts.map +0 -1
- package/dist/useFormContext--yod5xzQ.d.cts.map +0 -1
- package/dist/useFormContext-Cw6aAhos.d.ts.map +0 -1
|
@@ -2,7 +2,7 @@ import { n as UserChangeListener, t as DebugModeSettings } from "./FormContext-D
|
|
|
2
2
|
import * as react0 from "react";
|
|
3
3
|
import * as _fuf_stack_veto0 from "@fuf-stack/veto";
|
|
4
4
|
import { VetoFormattedError, VetoInstance } from "@fuf-stack/veto";
|
|
5
|
-
import * as
|
|
5
|
+
import * as react_hook_form9 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:
|
|
22
|
+
formState: react_hook_form9.FormState<TFieldValues>;
|
|
23
23
|
getFieldState: (name: Path<TFieldValues>, testId?: string) => {
|
|
24
24
|
error: FieldError[] | undefined;
|
|
25
25
|
invalid: boolean;
|
|
@@ -29,13 +29,13 @@ declare const useFormContext: <TFieldValues extends FieldValues = FieldValues, T
|
|
|
29
29
|
isTouched: boolean;
|
|
30
30
|
isValidating: boolean;
|
|
31
31
|
};
|
|
32
|
-
getValues:
|
|
33
|
-
subscribe:
|
|
34
|
-
watch:
|
|
35
|
-
debugMode: "
|
|
32
|
+
getValues: react_hook_form9.UseFormGetValues<TFieldValues>;
|
|
33
|
+
subscribe: react_hook_form9.UseFormSubscribe<TFieldValues>;
|
|
34
|
+
watch: react_hook_form9.UseFormWatch<TFieldValues>;
|
|
35
|
+
debugMode: "disabled" | "debug" | "debug-testids" | "off";
|
|
36
36
|
debugModeSettings?: DebugModeSettings;
|
|
37
37
|
preventSubmit: (prevent: boolean) => void;
|
|
38
|
-
setDebugMode: (debugMode: "
|
|
38
|
+
setDebugMode: (debugMode: "disabled" | "debug" | "debug-testids" | "off") => void;
|
|
39
39
|
triggerSubmit: (e?: react0.BaseSyntheticEvent) => Promise<void> | void;
|
|
40
40
|
userChange: {
|
|
41
41
|
subscribe: (listener: UserChangeListener) => () => void;
|
|
@@ -47,18 +47,18 @@ declare const useFormContext: <TFieldValues extends FieldValues = FieldValues, T
|
|
|
47
47
|
errors?: VetoFormattedError;
|
|
48
48
|
setClientValidationSchema: (key: string, schema: _fuf_stack_veto0.VetoTypeAny | null) => void;
|
|
49
49
|
};
|
|
50
|
-
setError:
|
|
51
|
-
clearErrors:
|
|
52
|
-
setValue:
|
|
53
|
-
trigger:
|
|
54
|
-
resetField:
|
|
55
|
-
reset:
|
|
56
|
-
handleSubmit:
|
|
57
|
-
unregister:
|
|
58
|
-
control:
|
|
59
|
-
register:
|
|
60
|
-
setFocus:
|
|
50
|
+
setError: react_hook_form9.UseFormSetError<TFieldValues>;
|
|
51
|
+
clearErrors: react_hook_form9.UseFormClearErrors<TFieldValues>;
|
|
52
|
+
setValue: react_hook_form9.UseFormSetValue<TFieldValues>;
|
|
53
|
+
trigger: react_hook_form9.UseFormTrigger<TFieldValues>;
|
|
54
|
+
resetField: react_hook_form9.UseFormResetField<TFieldValues>;
|
|
55
|
+
reset: react_hook_form9.UseFormReset<TFieldValues>;
|
|
56
|
+
handleSubmit: react_hook_form9.UseFormHandleSubmit<TFieldValues, TTransformedValues>;
|
|
57
|
+
unregister: react_hook_form9.UseFormUnregister<TFieldValues>;
|
|
58
|
+
control: react_hook_form9.Control<TFieldValues, TContext, TTransformedValues>;
|
|
59
|
+
register: react_hook_form9.UseFormRegister<TFieldValues>;
|
|
60
|
+
setFocus: react_hook_form9.UseFormSetFocus<TFieldValues>;
|
|
61
61
|
};
|
|
62
62
|
//#endregion
|
|
63
63
|
export { useFormContext as n, checkFieldIsRequired as t };
|
|
64
|
-
//# sourceMappingURL=useFormContext
|
|
64
|
+
//# sourceMappingURL=useFormContext-n3WYgGkW.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFormContext-n3WYgGkW.d.cts","names":[],"sources":["../src/hooks/useFormContext/useFormContext.ts"],"sourcesContent":[],"mappings":";;;;;;;;;cAYa,mCACC;;;;;AADd;AAqEA;;;;;cAAa,sCACU,cAAc,kDAEd;EAwBa,SAAA,4BAAA,aAAA,CAAA;EAAL,aAAA,EAAA,CAAA,IAAA,EAAA,IAAA,CAAK,YAAL,CAAA,EAAA,MAAA,CAAA,EAAA,MAAA,EAAA,GAAA;;;;;;;;;WAWO,mCAAA,aAAA,CAAA;EAAA,SAAA,mCAAA,aAAA,CAAA;EAAA,KAAA,+BAAA,aAAA,CAAA;EAyBpC,SAAA,EAAA,UAAA,GAAA,OAAA,GAAA,eAAA,GAAA,KAAA;EACyB,iBAAA,CAAA,mBAAA;EAAwE,aAAA,EAAA,CAAA,OAAA,EAAA,OAAA,EAAA,GAAA,IAAA;EAAA,YAAA,EAAA,CAAA,SAAA,EAAA,UAAA,GAAA,OAAA,GAAA,eAAA,GAAA,KAAA,EAAA,GAAA,IAAA;6BA1B7D,uBAAA;;0BAAA;;;;mBAyBpC;eACyB;aAAwE;qDAAA,gBAAA,CAAA,WAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as useFormContext } from "./useFormContext-
|
|
1
|
+
import { n as useFormContext } from "./useFormContext-UFBqUfOr.js";
|
|
2
2
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/hooks/useInputValueDebounce/useInputValueDebounce.ts
|
|
@@ -90,4 +90,4 @@ const useInputValueDebounce = ({ debounceDelay = 300, name, onBlur, onChange, va
|
|
|
90
90
|
|
|
91
91
|
//#endregion
|
|
92
92
|
export { useInputValueDebounce as t };
|
|
93
|
-
//# sourceMappingURL=useInputValueDebounce-
|
|
93
|
+
//# sourceMappingURL=useInputValueDebounce-D9wArTKz.js.map
|
package/dist/{useInputValueDebounce-Dop_8_OK.js.map → useInputValueDebounce-D9wArTKz.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInputValueDebounce-
|
|
1
|
+
{"version":3,"file":"useInputValueDebounce-D9wArTKz.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,5 +1,5 @@
|
|
|
1
|
-
const require_FormContext = require('./FormContext-
|
|
2
|
-
const require_useFormContext = require('./useFormContext-
|
|
1
|
+
const require_FormContext = require('./FormContext-CeFKQmVH.cjs');
|
|
2
|
+
const require_useFormContext = require('./useFormContext-DJiJlfGJ.cjs');
|
|
3
3
|
let react = require("react");
|
|
4
4
|
|
|
5
5
|
//#region src/hooks/useInputValueDebounce/useInputValueDebounce.ts
|
|
@@ -96,4 +96,4 @@ Object.defineProperty(exports, 'useInputValueDebounce', {
|
|
|
96
96
|
return useInputValueDebounce;
|
|
97
97
|
}
|
|
98
98
|
});
|
|
99
|
-
//# sourceMappingURL=useInputValueDebounce-
|
|
99
|
+
//# sourceMappingURL=useInputValueDebounce-KIKsvSLm.cjs.map
|
package/dist/{useInputValueDebounce-TiNR4jtG.cjs.map → useInputValueDebounce-KIKsvSLm.cjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInputValueDebounce-
|
|
1
|
+
{"version":3,"file":"useInputValueDebounce-KIKsvSLm.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,4 +1,4 @@
|
|
|
1
|
-
const require_FormContext = require('./FormContext-
|
|
1
|
+
const require_FormContext = require('./FormContext-CeFKQmVH.cjs');
|
|
2
2
|
let react = require("react");
|
|
3
3
|
|
|
4
4
|
//#region src/hooks/useInputValueTransform/useInputValueTransform.ts
|
|
@@ -114,4 +114,4 @@ Object.defineProperty(exports, 'useInputValueTransform', {
|
|
|
114
114
|
return useInputValueTransform;
|
|
115
115
|
}
|
|
116
116
|
});
|
|
117
|
-
//# sourceMappingURL=useInputValueTransform-
|
|
117
|
+
//# sourceMappingURL=useInputValueTransform-DuhPVE4L.cjs.map
|
package/dist/{useInputValueTransform-BNmfaj5D.cjs.map → useInputValueTransform-DuhPVE4L.cjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInputValueTransform-
|
|
1
|
+
{"version":3,"file":"useInputValueTransform-DuhPVE4L.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,wCA7CC,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,qCAtBC,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,6 +1,6 @@
|
|
|
1
1
|
import { t as InputValueTransform } from "./useInputValueTransform-Cc0qEsnS.js";
|
|
2
2
|
import { r as useController$1 } from "./useController-MVHJ7WFp.js";
|
|
3
|
-
import { n as useFormContext$1 } from "./useFormContext-
|
|
3
|
+
import { n as useFormContext$1 } from "./useFormContext-B2TS6xq0.js";
|
|
4
4
|
import { t as useInput } from "./useInput-BCdeYOOg.js";
|
|
5
5
|
import { ReactNode } from "react";
|
|
6
6
|
import { FieldError, FieldValues, Path } from "react-hook-form";
|
|
@@ -95,4 +95,4 @@ interface UseUniformFieldReturn<TFieldValues extends FieldValues = FieldValues>
|
|
|
95
95
|
declare const useUniformField: <TFieldValues extends FieldValues = FieldValues, TDisplay = unknown>(params: UseUniformFieldParams<TFieldValues, TDisplay>) => UseUniformFieldReturn<TFieldValues>;
|
|
96
96
|
//#endregion
|
|
97
97
|
export { UseUniformFieldReturn as n, useUniformField as r, UseUniformFieldParams as t };
|
|
98
|
-
//# sourceMappingURL=useUniformField-
|
|
98
|
+
//# sourceMappingURL=useUniformField-Bzv-6MG1.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUniformField-
|
|
1
|
+
{"version":3,"file":"useUniformField-Bzv-6MG1.d.ts","names":[],"sources":["../src/hooks/useUniformField/useUniformField.tsx"],"sourcesContent":[],"mappings":";;;;;;;;UA0CiB,2CACM,cAAc;;EADpB,IAAA,EAKT,IALS,CAKJ,YALI,CAAqB,GAAA,MAAA;EACf;EAAc,SAAA,CAAA,EAAA,MAAA;EAIxB;EAAL,QAAA,CAAA,EAAA,OAAA;EAME;EAIwB,KAAA,CAAA,EAJxB,SAIwB;EAApB;EAAmB,MAAA,CAAA,EAAA,MAAA;EAKhB;EACM,SAAA,CAAA,EANT,mBAMS,CANW,QAMX,CAAA;EAAc;EAKO,IAAA,CAAA,EAAA,MAAA,GAAA,QAAA,GAAA,UAAA;;AAAjC,UANM,qBAMN,CAAA,qBALY,WAKZ,GAL0B,WAK1B,CAAA,CAAA;EAEmC;EAAf,SAAA,EAAA,MAAA,GAAA,SAAA;EAAlB;EAMJ,OAAA,EARE,UAQF,CAAA,OARoB,gBAQpB,CARmC,YAQnC,CAAA,CAAA,CAAA,SAAA,CAAA;EAEO;EAEyB,SAAA,EAV5B,UAU4B,CAAA,OAVV,gBAUU,CAVK,YAUL,CAAA,CAAA,CAAA,WAAA,CAAA;EAAd;EAAlB,YAAA,EAAA,OAAA;EAEiC;EAAlB,QAAA,EAAA,OAAA,GAAA,SAAA;EAEmB;EAAlB,KAAA,EARhB,UAQgB,EAAA,GAAA,SAAA;EAEU;EAAlB,YAAA,EARD,SAQC,GAAA,IAAA;EAE6B;EAAf,KAAA,EARtB,UAQsB,CAAA,OARJ,eAQI,CARU,YAQV,CAAA,CAAA,CAAA,OAAA,CAAA;EAAlB;EAIJ,oBAAA,EAVe,UAUf,CAAA,OAViC,QAUjC,CAAA,CAAA,sBAAA,CAAA;EAEiC;EAAd,qBAAA,EAVH,UAUG,CAAA,OAVe,QAUf,CAAA,CAAA,uBAAA,CAAA;EAAlB;EAEkC,aAAA,EAV3B,UAU2B,CAAA,OAVT,QAUS,CAAA,CAAA,eAAA,CAAA;EAAd;EAAlB,SAAA,EARC,UAQD,CAAA,OARmB,gBAQnB,CARkC,YAQlC,CAAA,CAAA,CAAA,WAAA,CAAA;EAE2B;EAAd,OAAA,EAAA,OAAA;EAAlB;EAIwC,KAAA,EAVtC,SAUsC,GAAA,IAAA;EAAf;EAAlB,MAAA,EARJ,UAQI,CAAA,OARc,eAQd,CAR4B,YAQ5B,CAAA,CAAA,CAAA,OAAA,CAAA,CAAA,QAAA,CAAA;EAAU;EAiCX,QAAA,EAvCD,UA6MX,CAAA,OA7M6B,eA6M7B,CA7M2C,YA6M3C,CAAA,CAAA,CAAA,OAAA,CAAA,CAAA,UAAA,CAAA;EArKsB;EAAc,GAAA,EAtC9B,UAsC8B,CAAA,OAtCZ,eAsCY,CAtCE,YAsCF,CAAA,CAAA,CAAA,OAAA,CAAA,CAAA,KAAA,CAAA;EAGL;EAAc,QAAA,EAAA,OAAA;EAApC;EACe,UAAA,EAtCX,UAsCW,CAAA,OAtCO,gBAsCP,CAtCsB,YAsCtB,CAAA,CAAA,CAAA,YAAA,CAAA;EAAtB;EAAqB,MAAA,EAAA,MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cALX,uCACU,cAAc,yCAG3B,sBAAsB,cAAc,cAC3C,sBAAsB"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
const require_FormContext = require('./FormContext-
|
|
2
|
-
const require_helpers = require('./helpers-
|
|
3
|
-
const require_FieldCopyTestIdButton = require('./FieldCopyTestIdButton-
|
|
4
|
-
const require_FieldValidationError = require('./FieldValidationError-
|
|
5
|
-
const require_useController = require('./useController-
|
|
6
|
-
const require_useFormContext = require('./useFormContext-
|
|
7
|
-
const require_useInputValueTransform = require('./useInputValueTransform-
|
|
1
|
+
const require_FormContext = require('./FormContext-CeFKQmVH.cjs');
|
|
2
|
+
const require_helpers = require('./helpers-CncbgvW_.cjs');
|
|
3
|
+
const require_FieldCopyTestIdButton = require('./FieldCopyTestIdButton-DxJYKqrz.cjs');
|
|
4
|
+
const require_FieldValidationError = require('./FieldValidationError-A384-L3Y.cjs');
|
|
5
|
+
const require_useController = require('./useController-DHRkSHem.cjs');
|
|
6
|
+
const require_useFormContext = require('./useFormContext-DJiJlfGJ.cjs');
|
|
7
|
+
const require_useInputValueTransform = require('./useInputValueTransform-DuhPVE4L.cjs');
|
|
8
8
|
let _fuf_stack_pixel_utils = require("@fuf-stack/pixel-utils");
|
|
9
9
|
let react = require("react");
|
|
10
10
|
react = require_FormContext.__toESM(react);
|
|
@@ -159,4 +159,4 @@ Object.defineProperty(exports, 'useUniformField', {
|
|
|
159
159
|
return useUniformField;
|
|
160
160
|
}
|
|
161
161
|
});
|
|
162
|
-
//# sourceMappingURL=useUniformField-
|
|
162
|
+
//# sourceMappingURL=useUniformField-CGiibqg4.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUniformField-D6fwSjrH.cjs","names":["useFormContext","useController","useInputValueTransform","isValueEmpty","FieldCopyTestIdButton","FieldValidationError"],"sources":["../src/hooks/useUniformField/useUniformField.tsx","../src/hooks/useUniformField/index.ts"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { FieldError, FieldValues, Path } from 'react-hook-form';\nimport type { InputValueTransform } from '../useInputValueTransform/useInputValueTransform';\n\nimport React from 'react';\n\nimport { isTestEnvironment } from '@fuf-stack/pixel-utils';\nimport { useDebounce } from '@fuf-stack/pixels';\n\nimport { isValueEmpty } from '../../helpers';\nimport { FieldCopyTestIdButton } from '../../partials/FieldCopyTestIdButton';\nimport { FieldValidationError } from '../../partials/FieldValidationError';\nimport { useController } from '../useController/useController';\nimport { useFormContext } from '../useFormContext/useFormContext';\nimport { useInput } from '../useInput/useInput';\nimport { useInputValueTransform } from '../useInputValueTransform/useInputValueTransform';\n\n/**\n * Debounce invalid state changes to prevent UI flicker on rapid changes.\n *\n * Primary purpose: Reduce UI flicker when validation state changes rapidly\n * (e.g., during fast typing). Without debouncing, error messages would flash\n * in/out rapidly, creating a poor UX.\n *\n * Secondary benefit: When animations are enabled (default), gives time for\n * enter/exit animations to complete smoothly.\n *\n * Behavior:\n * - Debounces both true → false and false → true transitions by `delayMs`\n * - Disabled in test environments for immediate snapshots\n */\nconst useDebouncedInvalid = (invalid: boolean, delayMs: number) => {\n const debouncedInvalid = useDebounce(invalid, delayMs);\n\n // Disable debouncing in test environments for immediate snapshots\n if (isTestEnvironment()) {\n return invalid;\n }\n\n return debouncedInvalid;\n};\n\nexport interface UseUniformFieldParams<\n TFieldValues extends FieldValues = FieldValues,\n TDisplay = unknown,\n> {\n /** Form field name */\n name: Path<TFieldValues> & string;\n /** Custom aria-label for accessibility. If not provided, falls back to field name when no visible label exists */\n ariaLabel?: string;\n /** Disable the field */\n disabled?: boolean;\n /** Optional label content */\n label?: ReactNode;\n /** Optional explicit test id used to build stable test ids */\n testId?: string;\n /** Optional value transformation between form and display values */\n transform?: InputValueTransform<TDisplay>;\n /** Input type for special number handling */\n type?: 'text' | 'number' | 'password';\n}\n\nexport interface UseUniformFieldReturn<\n TFieldValues extends FieldValues = FieldValues,\n> {\n /** Computed aria-label fallback (field name) when no visible label exists. Components can override based on their accessibility needs (e.g., if placeholder provides sufficient context) */\n ariaLabel: string | undefined;\n /** react-hook-form control instance for advanced integrations */\n control: ReturnType<typeof useFormContext<TFieldValues>>['control'];\n /** Debug mode from Uniform provider */\n debugMode: ReturnType<typeof useFormContext<TFieldValues>>['debugMode'];\n /** Current value used to initialize uncontrolled components */\n defaultValue: unknown;\n /** Whether the field is currently disabled (from RHF) */\n disabled: boolean | undefined;\n /** Validation error(s) for the field */\n error: FieldError[] | undefined;\n /** Pre-built errorMessage node to plug into components */\n errorMessage: ReactNode | null;\n /** RHF controller field with transformed value/onChange (use this for simple components) */\n field: ReturnType<typeof useController<TFieldValues>>['field'];\n /** Helper to spread standardized error message props to underlying components */\n getErrorMessageProps: ReturnType<typeof useInput>['getErrorMessageProps'];\n /** Helper to spread standardized helper wrapper props (for spacing/animation) */\n getHelperWrapperProps: ReturnType<typeof useInput>['getHelperWrapperProps'];\n /** Helper to spread standardized label props to underlying components */\n getLabelProps: ReturnType<typeof useInput>['getLabelProps'];\n /** Access current form values (converted to validation-friendly format) */\n getValues: ReturnType<typeof useFormContext<TFieldValues>>['getValues'];\n /** Whether the field should show invalid state (debounced for smooth animations). True when field is invalid AND (dirty OR touched OR submitted) */\n invalid: boolean;\n /** Computed label node including optional test id copy button */\n label: ReactNode | null;\n /** onBlur handler from controller */\n onBlur: ReturnType<typeof useController<TFieldValues>>['field']['onBlur'];\n /** onChange handler from controller (with transform applied) */\n onChange: ReturnType<typeof useController<TFieldValues>>['field']['onChange'];\n /** Ref to forward to underlying control */\n ref: ReturnType<typeof useController<TFieldValues>>['field']['ref'];\n /** Whether the field is required according to validation schema */\n required: boolean;\n /** Reset a specific field in the form */\n resetField: ReturnType<typeof useFormContext<TFieldValues>>['resetField'];\n /** Generated HTML data-testid for the field */\n testId: string;\n}\n\n/**\n * Combines frequently used form field logic into a single hook.\n *\n * Provides:\n * - Enhanced form context (validation-aware state, `testId`, value transforms)\n * - Controller field with nullish conversion handling\n * - Value transformation via `transform` prop:\n * • Allows disentangled display and form values (e.g., string ↔ object, boolean ↔ array)\n * • Automatically applies `toDisplayValue` to field value for components\n * • Automatically applies `toFormValue` to display value when onChange is called\n * • Works with `type` prop for automatic number/string conversion\n * • Examples: storing objects while displaying strings, storing booleans as arrays, enriching values with metadata\n * - Debounced `invalid` state with smart timing:\n * • `true` (field becomes invalid): applies immediately so errors show right away\n * • `false` (field becomes valid): delayed 200ms to allow smooth exit animations\n * • Respects `prefers-reduced-motion` by skipping delays when user prefers reduced motion\n * - Smart `invalid` visibility (via `showInvalid`):\n * • Shows errors when field is dirty OR touched OR form has been submitted\n * • Prevents showing errors on pristine/untouched fields for better UX\n * • Works well for all field types (text inputs, checkboxes, radios, arrays)\n * - Prebuilt `errorMessage` React node using `FieldValidationError`\n * - Computed `label` node which appends a `FieldCopyTestIdButton` in\n * `debug-testids` mode\n * - `defaultValue` for uncontrolled defaults and all usual field handlers\n * - Access to form utilities: `control`, `getValues`, `resetField`\n * - Presentation helpers: `getLabelProps`, `getErrorMessageProps`,\n * `getHelperWrapperProps` for consistent wiring to underlying UI components\n */\nexport const useUniformField = <\n TFieldValues extends FieldValues = FieldValues,\n TDisplay = unknown,\n>(\n params: UseUniformFieldParams<TFieldValues, TDisplay>,\n): UseUniformFieldReturn<TFieldValues> => {\n const {\n name,\n ariaLabel: customAriaLabel,\n disabled = false,\n testId: explicitTestId,\n label,\n type,\n transform,\n } = params;\n\n const {\n control,\n debugMode,\n formState: { submitCount },\n getFieldState,\n getValues,\n resetField,\n } = useFormContext<TFieldValues>();\n\n const {\n error,\n invalid: rawInvalid,\n isTouched,\n required,\n testId,\n } = getFieldState(name, explicitTestId);\n\n const { field } = useController<TFieldValues>({\n control,\n disabled,\n name,\n });\n const {\n onChange: fieldOnChange,\n value: fieldValue,\n disabled: isDisabled,\n onBlur,\n ref,\n } = field;\n\n // Get transform utilities (but don't apply them automatically)\n // Components can choose how to use them (directly or via useInputValueDebounce)\n const { toDisplayValue, toFormValue } = useInputValueTransform<TDisplay>({\n type,\n transform,\n });\n\n // For components without special needs: apply transform to value and onChange\n const transformedValue = toDisplayValue(fieldValue);\n const transformedOnChange = (eventOrValue: TDisplay | React.ChangeEvent) => {\n // Extract value from event or use value directly\n const displayValue =\n (eventOrValue as React.ChangeEvent<HTMLInputElement>)?.target?.value ??\n eventOrValue;\n const formValue = toFormValue(displayValue as TDisplay);\n fieldOnChange(formValue as typeof fieldValue);\n };\n\n const defaultValue = (getValues() as Record<string, unknown>)?.[\n name as string\n ];\n\n /**\n * Determine when to show the invalid state to the user.\n *\n * Show errors when the field is invalid AND any of these conditions are met:\n * - Field has a value (show validation errors like format/length while typing)\n * - Field is touched (focused and blurred) - good for text inputs\n * - Form has been submitted - shows all errors after submit attempt\n *\n * Note: We intentionally don't use isDirty because:\n * - Newly added array elements are marked \"dirty\" by RHF, causing immediate errors\n * - Field Cards with empty initial values show errors immediately\n * - hasValue + isTouched covers the same use cases more reliably\n *\n * This prevents showing errors on pristine/untouched/empty fields for better UX.\n * Examples:\n * - Text input: User loads form with empty required field → no error shown yet\n * - Text input: User types invalid content → error shows immediately (has value)\n * - Text input: User focuses and blurs without typing → error shows (via isTouched)\n * - Checkbox/radio: User selects option → error shows immediately (has value)\n * - Field array: User adds element → no error yet; after blur → error shows\n * - Any field: User submits form → all errors show (via submitCount)\n *\n * The entire condition is debounced to prevent flickering and allow smooth animations.\n */\n\n // isValueEmpty handles marker strings, flat array wrappers, empty arrays, and empty objects\n const hasValue = !isValueEmpty(fieldValue);\n const showInvalid = rawInvalid && (hasValue || isTouched || submitCount > 0);\n const invalid = useDebouncedInvalid(showInvalid, 200);\n\n // Build a label node that:\n // - shows the provided label (unless explicitly set to false)\n // - appends a copy-to-clipboard button for the test id in `debug-testids` mode\n // Consumers can pass this directly to component `label` props\n const showTestIdCopyButton = debugMode === 'debug-testids';\n const labelNode: ReactNode | null =\n !!label || showTestIdCopyButton ? (\n <>\n {label !== false ? label : null}\n {showTestIdCopyButton ? (\n <FieldCopyTestIdButton testId={testId} />\n ) : null}\n </>\n ) : null;\n\n // Ready-to-render error message; consumers can drop this into their\n // component `errorMessage` prop without repeating mapping/markup\n const errorMessage = <FieldValidationError error={error} testId={testId} />;\n\n // Generate standardized props for label, helper wrapper and error message\n // so consumers can spread them directly into UI components (e.g. HeroUI),\n // keeping animations/spacing consistent across fields\n const { getErrorMessageProps, getLabelProps, getHelperWrapperProps } =\n useInput({\n ref,\n classNames: {\n // set padding to 0 for error message exit animation\n helperWrapper: 'p-0',\n },\n errorMessage: JSON.stringify(error),\n isInvalid: invalid,\n isRequired: required,\n label,\n labelPlacement: 'outside',\n });\n\n // Compute aria-label: prefer custom prop, then use string label if available, otherwise field name\n // Components can further override this based on their specific accessibility needs\n // (e.g., Input/TextArea may skip this if they have a meaningful placeholder)\n const ariaLabel =\n customAriaLabel ?? (typeof label === 'string' ? label : name);\n\n return {\n ariaLabel,\n control,\n debugMode,\n defaultValue,\n disabled: isDisabled,\n error,\n errorMessage,\n field: {\n ...field,\n value: transformedValue as typeof field.value,\n onChange: transformedOnChange as typeof field.onChange,\n },\n getErrorMessageProps,\n getHelperWrapperProps,\n getLabelProps,\n getValues,\n invalid,\n label: labelNode,\n onBlur,\n onChange: transformedOnChange as typeof field.onChange,\n ref,\n required,\n resetField,\n testId,\n };\n};\n","/* v8 ignore start */\n\nexport * from './useUniformField';\n\n/* v8 ignore stop */\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,uBAAuB,SAAkB,YAAoB;CACjE,MAAM,sDAA+B,SAAS,QAAQ;AAGtD,oDAAuB,CACrB,QAAO;AAGT,QAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgGT,MAAa,mBAIX,WACwC;CACxC,MAAM,EACJ,MACA,WAAW,iBACX,WAAW,OACX,QAAQ,gBACR,OACA,MACA,cACE;CAEJ,MAAM,EACJ,SACA,WACA,WAAW,EAAE,eACb,eACA,WACA,eACEA,uCAA8B;CAElC,MAAM,EACJ,OACA,SAAS,YACT,WACA,UACA,WACE,cAAc,MAAM,eAAe;CAEvC,MAAM,EAAE,UAAUC,oCAA4B;EAC5C;EACA;EACA;EACD,CAAC;CACF,MAAM,EACJ,UAAU,eACV,OAAO,YACP,UAAU,YACV,QACA,QACE;CAIJ,MAAM,EAAE,gBAAgB,gBAAgBC,sDAAiC;EACvE;EACA;EACD,CAAC;CAGF,MAAM,mBAAmB,eAAe,WAAW;CACnD,MAAM,uBAAuB,iBAA+C;AAM1E,gBADkB,YAFf,cAAsD,QAAQ,SAC/D,aACqD,CACV;;CAG/C,MAAM,eAAgB,WAAW,GAC/B;;;;;;;;;;;;;;;;;;;;;;;;;CA6BF,MAAM,WAAW,CAACC,6BAAa,WAAW;CAE1C,MAAM,UAAU,oBADI,eAAe,YAAY,aAAa,cAAc,IACzB,IAAI;CAMrD,MAAM,uBAAuB,cAAc;CAC3C,MAAM,YACJ,CAAC,CAAC,SAAS,uBACT,qFACG,UAAU,QAAQ,QAAQ,MAC1B,uBACC,2CAACC,iEAA8B,SAAU,GACvC,QACH,GACD;CAIN,MAAM,eAAe,2CAACC;EAA4B;EAAe;GAAU;CAK3E,MAAM,EAAE,sBAAsB,eAAe,sDAClC;EACP;EACA,YAAY,EAEV,eAAe,OAChB;EACD,cAAc,KAAK,UAAU,MAAM;EACnC,WAAW;EACX,YAAY;EACZ;EACA,gBAAgB;EACjB,CAAC;AAQJ,QAAO;EACL,WAHA,oBAAoB,OAAO,UAAU,WAAW,QAAQ;EAIxD;EACA;EACA;EACA,UAAU;EACV;EACA;EACA,OAAO;GACL,GAAG;GACH,OAAO;GACP,UAAU;GACX;EACD;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;EACA,UAAU;EACV;EACA;EACA;EACA;EACD"}
|
|
1
|
+
{"version":3,"file":"useUniformField-CGiibqg4.cjs","names":["useFormContext","useController","useInputValueTransform","isValueEmpty","FieldCopyTestIdButton","FieldValidationError"],"sources":["../src/hooks/useUniformField/useUniformField.tsx","../src/hooks/useUniformField/index.ts"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { FieldError, FieldValues, Path } from 'react-hook-form';\nimport type { InputValueTransform } from '../useInputValueTransform/useInputValueTransform';\n\nimport React from 'react';\n\nimport { isTestEnvironment } from '@fuf-stack/pixel-utils';\nimport { useDebounce } from '@fuf-stack/pixels';\n\nimport { isValueEmpty } from '../../helpers';\nimport { FieldCopyTestIdButton } from '../../partials/FieldCopyTestIdButton';\nimport { FieldValidationError } from '../../partials/FieldValidationError';\nimport { useController } from '../useController/useController';\nimport { useFormContext } from '../useFormContext/useFormContext';\nimport { useInput } from '../useInput/useInput';\nimport { useInputValueTransform } from '../useInputValueTransform/useInputValueTransform';\n\n/**\n * Debounce invalid state changes to prevent UI flicker on rapid changes.\n *\n * Primary purpose: Reduce UI flicker when validation state changes rapidly\n * (e.g., during fast typing). Without debouncing, error messages would flash\n * in/out rapidly, creating a poor UX.\n *\n * Secondary benefit: When animations are enabled (default), gives time for\n * enter/exit animations to complete smoothly.\n *\n * Behavior:\n * - Debounces both true → false and false → true transitions by `delayMs`\n * - Disabled in test environments for immediate snapshots\n */\nconst useDebouncedInvalid = (invalid: boolean, delayMs: number) => {\n const debouncedInvalid = useDebounce(invalid, delayMs);\n\n // Disable debouncing in test environments for immediate snapshots\n if (isTestEnvironment()) {\n return invalid;\n }\n\n return debouncedInvalid;\n};\n\nexport interface UseUniformFieldParams<\n TFieldValues extends FieldValues = FieldValues,\n TDisplay = unknown,\n> {\n /** Form field name */\n name: Path<TFieldValues> & string;\n /** Custom aria-label for accessibility. If not provided, falls back to field name when no visible label exists */\n ariaLabel?: string;\n /** Disable the field */\n disabled?: boolean;\n /** Optional label content */\n label?: ReactNode;\n /** Optional explicit test id used to build stable test ids */\n testId?: string;\n /** Optional value transformation between form and display values */\n transform?: InputValueTransform<TDisplay>;\n /** Input type for special number handling */\n type?: 'text' | 'number' | 'password';\n}\n\nexport interface UseUniformFieldReturn<\n TFieldValues extends FieldValues = FieldValues,\n> {\n /** Computed aria-label fallback (field name) when no visible label exists. Components can override based on their accessibility needs (e.g., if placeholder provides sufficient context) */\n ariaLabel: string | undefined;\n /** react-hook-form control instance for advanced integrations */\n control: ReturnType<typeof useFormContext<TFieldValues>>['control'];\n /** Debug mode from Uniform provider */\n debugMode: ReturnType<typeof useFormContext<TFieldValues>>['debugMode'];\n /** Current value used to initialize uncontrolled components */\n defaultValue: unknown;\n /** Whether the field is currently disabled (from RHF) */\n disabled: boolean | undefined;\n /** Validation error(s) for the field */\n error: FieldError[] | undefined;\n /** Pre-built errorMessage node to plug into components */\n errorMessage: ReactNode | null;\n /** RHF controller field with transformed value/onChange (use this for simple components) */\n field: ReturnType<typeof useController<TFieldValues>>['field'];\n /** Helper to spread standardized error message props to underlying components */\n getErrorMessageProps: ReturnType<typeof useInput>['getErrorMessageProps'];\n /** Helper to spread standardized helper wrapper props (for spacing/animation) */\n getHelperWrapperProps: ReturnType<typeof useInput>['getHelperWrapperProps'];\n /** Helper to spread standardized label props to underlying components */\n getLabelProps: ReturnType<typeof useInput>['getLabelProps'];\n /** Access current form values (converted to validation-friendly format) */\n getValues: ReturnType<typeof useFormContext<TFieldValues>>['getValues'];\n /** Whether the field should show invalid state (debounced for smooth animations). True when field is invalid AND (dirty OR touched OR submitted) */\n invalid: boolean;\n /** Computed label node including optional test id copy button */\n label: ReactNode | null;\n /** onBlur handler from controller */\n onBlur: ReturnType<typeof useController<TFieldValues>>['field']['onBlur'];\n /** onChange handler from controller (with transform applied) */\n onChange: ReturnType<typeof useController<TFieldValues>>['field']['onChange'];\n /** Ref to forward to underlying control */\n ref: ReturnType<typeof useController<TFieldValues>>['field']['ref'];\n /** Whether the field is required according to validation schema */\n required: boolean;\n /** Reset a specific field in the form */\n resetField: ReturnType<typeof useFormContext<TFieldValues>>['resetField'];\n /** Generated HTML data-testid for the field */\n testId: string;\n}\n\n/**\n * Combines frequently used form field logic into a single hook.\n *\n * Provides:\n * - Enhanced form context (validation-aware state, `testId`, value transforms)\n * - Controller field with nullish conversion handling\n * - Value transformation via `transform` prop:\n * • Allows disentangled display and form values (e.g., string ↔ object, boolean ↔ array)\n * • Automatically applies `toDisplayValue` to field value for components\n * • Automatically applies `toFormValue` to display value when onChange is called\n * • Works with `type` prop for automatic number/string conversion\n * • Examples: storing objects while displaying strings, storing booleans as arrays, enriching values with metadata\n * - Debounced `invalid` state with smart timing:\n * • `true` (field becomes invalid): applies immediately so errors show right away\n * • `false` (field becomes valid): delayed 200ms to allow smooth exit animations\n * • Respects `prefers-reduced-motion` by skipping delays when user prefers reduced motion\n * - Smart `invalid` visibility (via `showInvalid`):\n * • Shows errors when field is dirty OR touched OR form has been submitted\n * • Prevents showing errors on pristine/untouched fields for better UX\n * • Works well for all field types (text inputs, checkboxes, radios, arrays)\n * - Prebuilt `errorMessage` React node using `FieldValidationError`\n * - Computed `label` node which appends a `FieldCopyTestIdButton` in\n * `debug-testids` mode\n * - `defaultValue` for uncontrolled defaults and all usual field handlers\n * - Access to form utilities: `control`, `getValues`, `resetField`\n * - Presentation helpers: `getLabelProps`, `getErrorMessageProps`,\n * `getHelperWrapperProps` for consistent wiring to underlying UI components\n */\nexport const useUniformField = <\n TFieldValues extends FieldValues = FieldValues,\n TDisplay = unknown,\n>(\n params: UseUniformFieldParams<TFieldValues, TDisplay>,\n): UseUniformFieldReturn<TFieldValues> => {\n const {\n name,\n ariaLabel: customAriaLabel,\n disabled = false,\n testId: explicitTestId,\n label,\n type,\n transform,\n } = params;\n\n const {\n control,\n debugMode,\n formState: { submitCount },\n getFieldState,\n getValues,\n resetField,\n } = useFormContext<TFieldValues>();\n\n const {\n error,\n invalid: rawInvalid,\n isTouched,\n required,\n testId,\n } = getFieldState(name, explicitTestId);\n\n const { field } = useController<TFieldValues>({\n control,\n disabled,\n name,\n });\n const {\n onChange: fieldOnChange,\n value: fieldValue,\n disabled: isDisabled,\n onBlur,\n ref,\n } = field;\n\n // Get transform utilities (but don't apply them automatically)\n // Components can choose how to use them (directly or via useInputValueDebounce)\n const { toDisplayValue, toFormValue } = useInputValueTransform<TDisplay>({\n type,\n transform,\n });\n\n // For components without special needs: apply transform to value and onChange\n const transformedValue = toDisplayValue(fieldValue);\n const transformedOnChange = (eventOrValue: TDisplay | React.ChangeEvent) => {\n // Extract value from event or use value directly\n const displayValue =\n (eventOrValue as React.ChangeEvent<HTMLInputElement>)?.target?.value ??\n eventOrValue;\n const formValue = toFormValue(displayValue as TDisplay);\n fieldOnChange(formValue as typeof fieldValue);\n };\n\n const defaultValue = (getValues() as Record<string, unknown>)?.[\n name as string\n ];\n\n /**\n * Determine when to show the invalid state to the user.\n *\n * Show errors when the field is invalid AND any of these conditions are met:\n * - Field has a value (show validation errors like format/length while typing)\n * - Field is touched (focused and blurred) - good for text inputs\n * - Form has been submitted - shows all errors after submit attempt\n *\n * Note: We intentionally don't use isDirty because:\n * - Newly added array elements are marked \"dirty\" by RHF, causing immediate errors\n * - Field Cards with empty initial values show errors immediately\n * - hasValue + isTouched covers the same use cases more reliably\n *\n * This prevents showing errors on pristine/untouched/empty fields for better UX.\n * Examples:\n * - Text input: User loads form with empty required field → no error shown yet\n * - Text input: User types invalid content → error shows immediately (has value)\n * - Text input: User focuses and blurs without typing → error shows (via isTouched)\n * - Checkbox/radio: User selects option → error shows immediately (has value)\n * - Field array: User adds element → no error yet; after blur → error shows\n * - Any field: User submits form → all errors show (via submitCount)\n *\n * The entire condition is debounced to prevent flickering and allow smooth animations.\n */\n\n // isValueEmpty handles marker strings, flat array wrappers, empty arrays, and empty objects\n const hasValue = !isValueEmpty(fieldValue);\n const showInvalid = rawInvalid && (hasValue || isTouched || submitCount > 0);\n const invalid = useDebouncedInvalid(showInvalid, 200);\n\n // Build a label node that:\n // - shows the provided label (unless explicitly set to false)\n // - appends a copy-to-clipboard button for the test id in `debug-testids` mode\n // Consumers can pass this directly to component `label` props\n const showTestIdCopyButton = debugMode === 'debug-testids';\n const labelNode: ReactNode | null =\n !!label || showTestIdCopyButton ? (\n <>\n {label !== false ? label : null}\n {showTestIdCopyButton ? (\n <FieldCopyTestIdButton testId={testId} />\n ) : null}\n </>\n ) : null;\n\n // Ready-to-render error message; consumers can drop this into their\n // component `errorMessage` prop without repeating mapping/markup\n const errorMessage = <FieldValidationError error={error} testId={testId} />;\n\n // Generate standardized props for label, helper wrapper and error message\n // so consumers can spread them directly into UI components (e.g. HeroUI),\n // keeping animations/spacing consistent across fields\n const { getErrorMessageProps, getLabelProps, getHelperWrapperProps } =\n useInput({\n ref,\n classNames: {\n // set padding to 0 for error message exit animation\n helperWrapper: 'p-0',\n },\n errorMessage: JSON.stringify(error),\n isInvalid: invalid,\n isRequired: required,\n label,\n labelPlacement: 'outside',\n });\n\n // Compute aria-label: prefer custom prop, then use string label if available, otherwise field name\n // Components can further override this based on their specific accessibility needs\n // (e.g., Input/TextArea may skip this if they have a meaningful placeholder)\n const ariaLabel =\n customAriaLabel ?? (typeof label === 'string' ? label : name);\n\n return {\n ariaLabel,\n control,\n debugMode,\n defaultValue,\n disabled: isDisabled,\n error,\n errorMessage,\n field: {\n ...field,\n value: transformedValue as typeof field.value,\n onChange: transformedOnChange as typeof field.onChange,\n },\n getErrorMessageProps,\n getHelperWrapperProps,\n getLabelProps,\n getValues,\n invalid,\n label: labelNode,\n onBlur,\n onChange: transformedOnChange as typeof field.onChange,\n ref,\n required,\n resetField,\n testId,\n };\n};\n","/* v8 ignore start */\n\nexport * from './useUniformField';\n\n/* v8 ignore stop */\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,uBAAuB,SAAkB,YAAoB;CACjE,MAAM,sDAA+B,SAAS,QAAQ;AAGtD,oDAAuB,CACrB,QAAO;AAGT,QAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgGT,MAAa,mBAIX,WACwC;CACxC,MAAM,EACJ,MACA,WAAW,iBACX,WAAW,OACX,QAAQ,gBACR,OACA,MACA,cACE;CAEJ,MAAM,EACJ,SACA,WACA,WAAW,EAAE,eACb,eACA,WACA,eACEA,uCAA8B;CAElC,MAAM,EACJ,OACA,SAAS,YACT,WACA,UACA,WACE,cAAc,MAAM,eAAe;CAEvC,MAAM,EAAE,UAAUC,oCAA4B;EAC5C;EACA;EACA;EACD,CAAC;CACF,MAAM,EACJ,UAAU,eACV,OAAO,YACP,UAAU,YACV,QACA,QACE;CAIJ,MAAM,EAAE,gBAAgB,gBAAgBC,sDAAiC;EACvE;EACA;EACD,CAAC;CAGF,MAAM,mBAAmB,eAAe,WAAW;CACnD,MAAM,uBAAuB,iBAA+C;AAM1E,gBADkB,YAFf,cAAsD,QAAQ,SAC/D,aACqD,CACV;;CAG/C,MAAM,eAAgB,WAAW,GAC/B;;;;;;;;;;;;;;;;;;;;;;;;;CA6BF,MAAM,WAAW,CAACC,6BAAa,WAAW;CAE1C,MAAM,UAAU,oBADI,eAAe,YAAY,aAAa,cAAc,IACzB,IAAI;CAMrD,MAAM,uBAAuB,cAAc;CAC3C,MAAM,YACJ,CAAC,CAAC,SAAS,uBACT,qFACG,UAAU,QAAQ,QAAQ,MAC1B,uBACC,2CAACC,iEAA8B,SAAU,GACvC,QACH,GACD;CAIN,MAAM,eAAe,2CAACC;EAA4B;EAAe;GAAU;CAK3E,MAAM,EAAE,sBAAsB,eAAe,sDAClC;EACP;EACA,YAAY,EAEV,eAAe,OAChB;EACD,cAAc,KAAK,UAAU,MAAM;EACnC,WAAW;EACX,YAAY;EACZ;EACA,gBAAgB;EACjB,CAAC;AAQJ,QAAO;EACL,WAHA,oBAAoB,OAAO,UAAU,WAAW,QAAQ;EAIxD;EACA;EACA;EACA,UAAU;EACV;EACA;EACA,OAAO;GACL,GAAG;GACH,OAAO;GACP,UAAU;GACX;EACD;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;EACA,UAAU;EACV;EACA;EACA;EACA;EACD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as InputValueTransform } from "./useInputValueTransform-BV8o0PMI.cjs";
|
|
2
2
|
import { r as useController } from "./useController-BArZd2Vp.cjs";
|
|
3
|
-
import { n as useFormContext } from "./useFormContext
|
|
3
|
+
import { n as useFormContext } from "./useFormContext-n3WYgGkW.cjs";
|
|
4
4
|
import { t as useInput } from "./useInput--wjwIBc5.cjs";
|
|
5
5
|
import { ReactNode } from "react";
|
|
6
6
|
import { FieldError, FieldValues, Path } from "react-hook-form";
|
|
@@ -95,4 +95,4 @@ interface UseUniformFieldReturn<TFieldValues extends FieldValues = FieldValues>
|
|
|
95
95
|
declare const useUniformField: <TFieldValues extends FieldValues = FieldValues, TDisplay = unknown>(params: UseUniformFieldParams<TFieldValues, TDisplay>) => UseUniformFieldReturn<TFieldValues>;
|
|
96
96
|
//#endregion
|
|
97
97
|
export { UseUniformFieldReturn as n, useUniformField as r, UseUniformFieldParams as t };
|
|
98
|
-
//# sourceMappingURL=useUniformField-
|
|
98
|
+
//# sourceMappingURL=useUniformField-CrEz5lkV.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUniformField-
|
|
1
|
+
{"version":3,"file":"useUniformField-CrEz5lkV.d.cts","names":[],"sources":["../src/hooks/useUniformField/useUniformField.tsx"],"sourcesContent":[],"mappings":";;;;;;;;UA0CiB,2CACM,cAAc;;EADpB,IAAA,EAKT,IALS,CAKJ,YALI,CAAqB,GAAA,MAAA;EACf;EAAc,SAAA,CAAA,EAAA,MAAA;EAIxB;EAAL,QAAA,CAAA,EAAA,OAAA;EAME;EAIwB,KAAA,CAAA,EAJxB,SAIwB;EAApB;EAAmB,MAAA,CAAA,EAAA,MAAA;EAKhB;EACM,SAAA,CAAA,EANT,mBAMS,CANW,QAMX,CAAA;EAAc;EAKO,IAAA,CAAA,EAAA,MAAA,GAAA,QAAA,GAAA,UAAA;;AAAjC,UANM,qBAMN,CAAA,qBALY,WAKZ,GAL0B,WAK1B,CAAA,CAAA;EAEmC;EAAf,SAAA,EAAA,MAAA,GAAA,SAAA;EAAlB;EAMJ,OAAA,EARE,UAQF,CAAA,OARoB,cAQpB,CARmC,YAQnC,CAAA,CAAA,CAAA,SAAA,CAAA;EAEO;EAEyB,SAAA,EAV5B,UAU4B,CAAA,OAVV,cAUU,CAVK,YAUL,CAAA,CAAA,CAAA,WAAA,CAAA;EAAd;EAAlB,YAAA,EAAA,OAAA;EAEiC;EAAlB,QAAA,EAAA,OAAA,GAAA,SAAA;EAEmB;EAAlB,KAAA,EARhB,UAQgB,EAAA,GAAA,SAAA;EAEU;EAAlB,YAAA,EARD,SAQC,GAAA,IAAA;EAE6B;EAAf,KAAA,EARtB,UAQsB,CAAA,OARJ,aAQI,CARU,YAQV,CAAA,CAAA,CAAA,OAAA,CAAA;EAAlB;EAIJ,oBAAA,EAVe,UAUf,CAAA,OAViC,QAUjC,CAAA,CAAA,sBAAA,CAAA;EAEiC;EAAd,qBAAA,EAVH,UAUG,CAAA,OAVe,QAUf,CAAA,CAAA,uBAAA,CAAA;EAAlB;EAEkC,aAAA,EAV3B,UAU2B,CAAA,OAVT,QAUS,CAAA,CAAA,eAAA,CAAA;EAAd;EAAlB,SAAA,EARC,UAQD,CAAA,OARmB,cAQnB,CARkC,YAQlC,CAAA,CAAA,CAAA,WAAA,CAAA;EAE2B;EAAd,OAAA,EAAA,OAAA;EAAlB;EAIwC,KAAA,EAVtC,SAUsC,GAAA,IAAA;EAAf;EAAlB,MAAA,EARJ,UAQI,CAAA,OARc,aAQd,CAR4B,YAQ5B,CAAA,CAAA,CAAA,OAAA,CAAA,CAAA,QAAA,CAAA;EAAU;EAiCX,QAAA,EAvCD,UA6MX,CAAA,OA7M6B,aA6M7B,CA7M2C,YA6M3C,CAAA,CAAA,CAAA,OAAA,CAAA,CAAA,UAAA,CAAA;EArKsB;EAAc,GAAA,EAtC9B,UAsC8B,CAAA,OAtCZ,aAsCY,CAtCE,YAsCF,CAAA,CAAA,CAAA,OAAA,CAAA,CAAA,KAAA,CAAA;EAGL;EAAc,QAAA,EAAA,OAAA;EAApC;EACe,UAAA,EAtCX,UAsCW,CAAA,OAtCO,cAsCP,CAtCsB,YAsCtB,CAAA,CAAA,CAAA,YAAA,CAAA;EAAtB;EAAqB,MAAA,EAAA,MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cALX,uCACU,cAAc,yCAG3B,sBAAsB,cAAc,cAC3C,sBAAsB"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { r as isValueEmpty } from "./helpers-
|
|
1
|
+
import { r as isValueEmpty } from "./helpers-D3A5d3M1.js";
|
|
2
2
|
import { n as FieldCopyTestIdButton_default } from "./FieldCopyTestIdButton-D9f1B-VS.js";
|
|
3
3
|
import { n as FieldValidationError_default } from "./FieldValidationError-BYwitb_B.js";
|
|
4
|
-
import { t as useController } from "./useController-
|
|
5
|
-
import { n as useFormContext } from "./useFormContext-
|
|
4
|
+
import { t as useController } from "./useController-BPDcwfTj.js";
|
|
5
|
+
import { n as useFormContext } from "./useFormContext-UFBqUfOr.js";
|
|
6
6
|
import { t as useInput } from "./useInput-DZ6KGBxw.js";
|
|
7
7
|
import { t as useInputValueTransform } from "./useInputValueTransform-CMNC21vX.js";
|
|
8
8
|
import { isTestEnvironment } from "@fuf-stack/pixel-utils";
|
|
@@ -152,4 +152,4 @@ const useUniformField = (params) => {
|
|
|
152
152
|
|
|
153
153
|
//#endregion
|
|
154
154
|
export { useUniformField as t };
|
|
155
|
-
//# sourceMappingURL=useUniformField-
|
|
155
|
+
//# sourceMappingURL=useUniformField-D2NgevBI.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUniformField-BKVVns0E.js","names":["FieldCopyTestIdButton","FieldValidationError"],"sources":["../src/hooks/useUniformField/useUniformField.tsx","../src/hooks/useUniformField/index.ts"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { FieldError, FieldValues, Path } from 'react-hook-form';\nimport type { InputValueTransform } from '../useInputValueTransform/useInputValueTransform';\n\nimport React from 'react';\n\nimport { isTestEnvironment } from '@fuf-stack/pixel-utils';\nimport { useDebounce } from '@fuf-stack/pixels';\n\nimport { isValueEmpty } from '../../helpers';\nimport { FieldCopyTestIdButton } from '../../partials/FieldCopyTestIdButton';\nimport { FieldValidationError } from '../../partials/FieldValidationError';\nimport { useController } from '../useController/useController';\nimport { useFormContext } from '../useFormContext/useFormContext';\nimport { useInput } from '../useInput/useInput';\nimport { useInputValueTransform } from '../useInputValueTransform/useInputValueTransform';\n\n/**\n * Debounce invalid state changes to prevent UI flicker on rapid changes.\n *\n * Primary purpose: Reduce UI flicker when validation state changes rapidly\n * (e.g., during fast typing). Without debouncing, error messages would flash\n * in/out rapidly, creating a poor UX.\n *\n * Secondary benefit: When animations are enabled (default), gives time for\n * enter/exit animations to complete smoothly.\n *\n * Behavior:\n * - Debounces both true → false and false → true transitions by `delayMs`\n * - Disabled in test environments for immediate snapshots\n */\nconst useDebouncedInvalid = (invalid: boolean, delayMs: number) => {\n const debouncedInvalid = useDebounce(invalid, delayMs);\n\n // Disable debouncing in test environments for immediate snapshots\n if (isTestEnvironment()) {\n return invalid;\n }\n\n return debouncedInvalid;\n};\n\nexport interface UseUniformFieldParams<\n TFieldValues extends FieldValues = FieldValues,\n TDisplay = unknown,\n> {\n /** Form field name */\n name: Path<TFieldValues> & string;\n /** Custom aria-label for accessibility. If not provided, falls back to field name when no visible label exists */\n ariaLabel?: string;\n /** Disable the field */\n disabled?: boolean;\n /** Optional label content */\n label?: ReactNode;\n /** Optional explicit test id used to build stable test ids */\n testId?: string;\n /** Optional value transformation between form and display values */\n transform?: InputValueTransform<TDisplay>;\n /** Input type for special number handling */\n type?: 'text' | 'number' | 'password';\n}\n\nexport interface UseUniformFieldReturn<\n TFieldValues extends FieldValues = FieldValues,\n> {\n /** Computed aria-label fallback (field name) when no visible label exists. Components can override based on their accessibility needs (e.g., if placeholder provides sufficient context) */\n ariaLabel: string | undefined;\n /** react-hook-form control instance for advanced integrations */\n control: ReturnType<typeof useFormContext<TFieldValues>>['control'];\n /** Debug mode from Uniform provider */\n debugMode: ReturnType<typeof useFormContext<TFieldValues>>['debugMode'];\n /** Current value used to initialize uncontrolled components */\n defaultValue: unknown;\n /** Whether the field is currently disabled (from RHF) */\n disabled: boolean | undefined;\n /** Validation error(s) for the field */\n error: FieldError[] | undefined;\n /** Pre-built errorMessage node to plug into components */\n errorMessage: ReactNode | null;\n /** RHF controller field with transformed value/onChange (use this for simple components) */\n field: ReturnType<typeof useController<TFieldValues>>['field'];\n /** Helper to spread standardized error message props to underlying components */\n getErrorMessageProps: ReturnType<typeof useInput>['getErrorMessageProps'];\n /** Helper to spread standardized helper wrapper props (for spacing/animation) */\n getHelperWrapperProps: ReturnType<typeof useInput>['getHelperWrapperProps'];\n /** Helper to spread standardized label props to underlying components */\n getLabelProps: ReturnType<typeof useInput>['getLabelProps'];\n /** Access current form values (converted to validation-friendly format) */\n getValues: ReturnType<typeof useFormContext<TFieldValues>>['getValues'];\n /** Whether the field should show invalid state (debounced for smooth animations). True when field is invalid AND (dirty OR touched OR submitted) */\n invalid: boolean;\n /** Computed label node including optional test id copy button */\n label: ReactNode | null;\n /** onBlur handler from controller */\n onBlur: ReturnType<typeof useController<TFieldValues>>['field']['onBlur'];\n /** onChange handler from controller (with transform applied) */\n onChange: ReturnType<typeof useController<TFieldValues>>['field']['onChange'];\n /** Ref to forward to underlying control */\n ref: ReturnType<typeof useController<TFieldValues>>['field']['ref'];\n /** Whether the field is required according to validation schema */\n required: boolean;\n /** Reset a specific field in the form */\n resetField: ReturnType<typeof useFormContext<TFieldValues>>['resetField'];\n /** Generated HTML data-testid for the field */\n testId: string;\n}\n\n/**\n * Combines frequently used form field logic into a single hook.\n *\n * Provides:\n * - Enhanced form context (validation-aware state, `testId`, value transforms)\n * - Controller field with nullish conversion handling\n * - Value transformation via `transform` prop:\n * • Allows disentangled display and form values (e.g., string ↔ object, boolean ↔ array)\n * • Automatically applies `toDisplayValue` to field value for components\n * • Automatically applies `toFormValue` to display value when onChange is called\n * • Works with `type` prop for automatic number/string conversion\n * • Examples: storing objects while displaying strings, storing booleans as arrays, enriching values with metadata\n * - Debounced `invalid` state with smart timing:\n * • `true` (field becomes invalid): applies immediately so errors show right away\n * • `false` (field becomes valid): delayed 200ms to allow smooth exit animations\n * • Respects `prefers-reduced-motion` by skipping delays when user prefers reduced motion\n * - Smart `invalid` visibility (via `showInvalid`):\n * • Shows errors when field is dirty OR touched OR form has been submitted\n * • Prevents showing errors on pristine/untouched fields for better UX\n * • Works well for all field types (text inputs, checkboxes, radios, arrays)\n * - Prebuilt `errorMessage` React node using `FieldValidationError`\n * - Computed `label` node which appends a `FieldCopyTestIdButton` in\n * `debug-testids` mode\n * - `defaultValue` for uncontrolled defaults and all usual field handlers\n * - Access to form utilities: `control`, `getValues`, `resetField`\n * - Presentation helpers: `getLabelProps`, `getErrorMessageProps`,\n * `getHelperWrapperProps` for consistent wiring to underlying UI components\n */\nexport const useUniformField = <\n TFieldValues extends FieldValues = FieldValues,\n TDisplay = unknown,\n>(\n params: UseUniformFieldParams<TFieldValues, TDisplay>,\n): UseUniformFieldReturn<TFieldValues> => {\n const {\n name,\n ariaLabel: customAriaLabel,\n disabled = false,\n testId: explicitTestId,\n label,\n type,\n transform,\n } = params;\n\n const {\n control,\n debugMode,\n formState: { submitCount },\n getFieldState,\n getValues,\n resetField,\n } = useFormContext<TFieldValues>();\n\n const {\n error,\n invalid: rawInvalid,\n isTouched,\n required,\n testId,\n } = getFieldState(name, explicitTestId);\n\n const { field } = useController<TFieldValues>({\n control,\n disabled,\n name,\n });\n const {\n onChange: fieldOnChange,\n value: fieldValue,\n disabled: isDisabled,\n onBlur,\n ref,\n } = field;\n\n // Get transform utilities (but don't apply them automatically)\n // Components can choose how to use them (directly or via useInputValueDebounce)\n const { toDisplayValue, toFormValue } = useInputValueTransform<TDisplay>({\n type,\n transform,\n });\n\n // For components without special needs: apply transform to value and onChange\n const transformedValue = toDisplayValue(fieldValue);\n const transformedOnChange = (eventOrValue: TDisplay | React.ChangeEvent) => {\n // Extract value from event or use value directly\n const displayValue =\n (eventOrValue as React.ChangeEvent<HTMLInputElement>)?.target?.value ??\n eventOrValue;\n const formValue = toFormValue(displayValue as TDisplay);\n fieldOnChange(formValue as typeof fieldValue);\n };\n\n const defaultValue = (getValues() as Record<string, unknown>)?.[\n name as string\n ];\n\n /**\n * Determine when to show the invalid state to the user.\n *\n * Show errors when the field is invalid AND any of these conditions are met:\n * - Field has a value (show validation errors like format/length while typing)\n * - Field is touched (focused and blurred) - good for text inputs\n * - Form has been submitted - shows all errors after submit attempt\n *\n * Note: We intentionally don't use isDirty because:\n * - Newly added array elements are marked \"dirty\" by RHF, causing immediate errors\n * - Field Cards with empty initial values show errors immediately\n * - hasValue + isTouched covers the same use cases more reliably\n *\n * This prevents showing errors on pristine/untouched/empty fields for better UX.\n * Examples:\n * - Text input: User loads form with empty required field → no error shown yet\n * - Text input: User types invalid content → error shows immediately (has value)\n * - Text input: User focuses and blurs without typing → error shows (via isTouched)\n * - Checkbox/radio: User selects option → error shows immediately (has value)\n * - Field array: User adds element → no error yet; after blur → error shows\n * - Any field: User submits form → all errors show (via submitCount)\n *\n * The entire condition is debounced to prevent flickering and allow smooth animations.\n */\n\n // isValueEmpty handles marker strings, flat array wrappers, empty arrays, and empty objects\n const hasValue = !isValueEmpty(fieldValue);\n const showInvalid = rawInvalid && (hasValue || isTouched || submitCount > 0);\n const invalid = useDebouncedInvalid(showInvalid, 200);\n\n // Build a label node that:\n // - shows the provided label (unless explicitly set to false)\n // - appends a copy-to-clipboard button for the test id in `debug-testids` mode\n // Consumers can pass this directly to component `label` props\n const showTestIdCopyButton = debugMode === 'debug-testids';\n const labelNode: ReactNode | null =\n !!label || showTestIdCopyButton ? (\n <>\n {label !== false ? label : null}\n {showTestIdCopyButton ? (\n <FieldCopyTestIdButton testId={testId} />\n ) : null}\n </>\n ) : null;\n\n // Ready-to-render error message; consumers can drop this into their\n // component `errorMessage` prop without repeating mapping/markup\n const errorMessage = <FieldValidationError error={error} testId={testId} />;\n\n // Generate standardized props for label, helper wrapper and error message\n // so consumers can spread them directly into UI components (e.g. HeroUI),\n // keeping animations/spacing consistent across fields\n const { getErrorMessageProps, getLabelProps, getHelperWrapperProps } =\n useInput({\n ref,\n classNames: {\n // set padding to 0 for error message exit animation\n helperWrapper: 'p-0',\n },\n errorMessage: JSON.stringify(error),\n isInvalid: invalid,\n isRequired: required,\n label,\n labelPlacement: 'outside',\n });\n\n // Compute aria-label: prefer custom prop, then use string label if available, otherwise field name\n // Components can further override this based on their specific accessibility needs\n // (e.g., Input/TextArea may skip this if they have a meaningful placeholder)\n const ariaLabel =\n customAriaLabel ?? (typeof label === 'string' ? label : name);\n\n return {\n ariaLabel,\n control,\n debugMode,\n defaultValue,\n disabled: isDisabled,\n error,\n errorMessage,\n field: {\n ...field,\n value: transformedValue as typeof field.value,\n onChange: transformedOnChange as typeof field.onChange,\n },\n getErrorMessageProps,\n getHelperWrapperProps,\n getLabelProps,\n getValues,\n invalid,\n label: labelNode,\n onBlur,\n onChange: transformedOnChange as typeof field.onChange,\n ref,\n required,\n resetField,\n testId,\n };\n};\n","/* v8 ignore start */\n\nexport * from './useUniformField';\n\n/* v8 ignore stop */\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,uBAAuB,SAAkB,YAAoB;CACjE,MAAM,mBAAmB,YAAY,SAAS,QAAQ;AAGtD,KAAI,mBAAmB,CACrB,QAAO;AAGT,QAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgGT,MAAa,mBAIX,WACwC;CACxC,MAAM,EACJ,MACA,WAAW,iBACX,WAAW,OACX,QAAQ,gBACR,OACA,MACA,cACE;CAEJ,MAAM,EACJ,SACA,WACA,WAAW,EAAE,eACb,eACA,WACA,eACE,gBAA8B;CAElC,MAAM,EACJ,OACA,SAAS,YACT,WACA,UACA,WACE,cAAc,MAAM,eAAe;CAEvC,MAAM,EAAE,UAAU,cAA4B;EAC5C;EACA;EACA;EACD,CAAC;CACF,MAAM,EACJ,UAAU,eACV,OAAO,YACP,UAAU,YACV,QACA,QACE;CAIJ,MAAM,EAAE,gBAAgB,gBAAgB,uBAAiC;EACvE;EACA;EACD,CAAC;CAGF,MAAM,mBAAmB,eAAe,WAAW;CACnD,MAAM,uBAAuB,iBAA+C;AAM1E,gBADkB,YAFf,cAAsD,QAAQ,SAC/D,aACqD,CACV;;CAG/C,MAAM,eAAgB,WAAW,GAC/B;;;;;;;;;;;;;;;;;;;;;;;;;CA6BF,MAAM,WAAW,CAAC,aAAa,WAAW;CAE1C,MAAM,UAAU,oBADI,eAAe,YAAY,aAAa,cAAc,IACzB,IAAI;CAMrD,MAAM,uBAAuB,cAAc;CAC3C,MAAM,YACJ,CAAC,CAAC,SAAS,uBACT,4CACG,UAAU,QAAQ,QAAQ,MAC1B,uBACC,oBAACA,iCAA8B,SAAU,GACvC,QACH,GACD;CAIN,MAAM,eAAe,oBAACC;EAA4B;EAAe;GAAU;CAK3E,MAAM,EAAE,sBAAsB,eAAe,0BAC3C,SAAS;EACP;EACA,YAAY,EAEV,eAAe,OAChB;EACD,cAAc,KAAK,UAAU,MAAM;EACnC,WAAW;EACX,YAAY;EACZ;EACA,gBAAgB;EACjB,CAAC;AAQJ,QAAO;EACL,WAHA,oBAAoB,OAAO,UAAU,WAAW,QAAQ;EAIxD;EACA;EACA;EACA,UAAU;EACV;EACA;EACA,OAAO;GACL,GAAG;GACH,OAAO;GACP,UAAU;GACX;EACD;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;EACA,UAAU;EACV;EACA;EACA;EACA;EACD"}
|
|
1
|
+
{"version":3,"file":"useUniformField-D2NgevBI.js","names":["FieldCopyTestIdButton","FieldValidationError"],"sources":["../src/hooks/useUniformField/useUniformField.tsx","../src/hooks/useUniformField/index.ts"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { FieldError, FieldValues, Path } from 'react-hook-form';\nimport type { InputValueTransform } from '../useInputValueTransform/useInputValueTransform';\n\nimport React from 'react';\n\nimport { isTestEnvironment } from '@fuf-stack/pixel-utils';\nimport { useDebounce } from '@fuf-stack/pixels';\n\nimport { isValueEmpty } from '../../helpers';\nimport { FieldCopyTestIdButton } from '../../partials/FieldCopyTestIdButton';\nimport { FieldValidationError } from '../../partials/FieldValidationError';\nimport { useController } from '../useController/useController';\nimport { useFormContext } from '../useFormContext/useFormContext';\nimport { useInput } from '../useInput/useInput';\nimport { useInputValueTransform } from '../useInputValueTransform/useInputValueTransform';\n\n/**\n * Debounce invalid state changes to prevent UI flicker on rapid changes.\n *\n * Primary purpose: Reduce UI flicker when validation state changes rapidly\n * (e.g., during fast typing). Without debouncing, error messages would flash\n * in/out rapidly, creating a poor UX.\n *\n * Secondary benefit: When animations are enabled (default), gives time for\n * enter/exit animations to complete smoothly.\n *\n * Behavior:\n * - Debounces both true → false and false → true transitions by `delayMs`\n * - Disabled in test environments for immediate snapshots\n */\nconst useDebouncedInvalid = (invalid: boolean, delayMs: number) => {\n const debouncedInvalid = useDebounce(invalid, delayMs);\n\n // Disable debouncing in test environments for immediate snapshots\n if (isTestEnvironment()) {\n return invalid;\n }\n\n return debouncedInvalid;\n};\n\nexport interface UseUniformFieldParams<\n TFieldValues extends FieldValues = FieldValues,\n TDisplay = unknown,\n> {\n /** Form field name */\n name: Path<TFieldValues> & string;\n /** Custom aria-label for accessibility. If not provided, falls back to field name when no visible label exists */\n ariaLabel?: string;\n /** Disable the field */\n disabled?: boolean;\n /** Optional label content */\n label?: ReactNode;\n /** Optional explicit test id used to build stable test ids */\n testId?: string;\n /** Optional value transformation between form and display values */\n transform?: InputValueTransform<TDisplay>;\n /** Input type for special number handling */\n type?: 'text' | 'number' | 'password';\n}\n\nexport interface UseUniformFieldReturn<\n TFieldValues extends FieldValues = FieldValues,\n> {\n /** Computed aria-label fallback (field name) when no visible label exists. Components can override based on their accessibility needs (e.g., if placeholder provides sufficient context) */\n ariaLabel: string | undefined;\n /** react-hook-form control instance for advanced integrations */\n control: ReturnType<typeof useFormContext<TFieldValues>>['control'];\n /** Debug mode from Uniform provider */\n debugMode: ReturnType<typeof useFormContext<TFieldValues>>['debugMode'];\n /** Current value used to initialize uncontrolled components */\n defaultValue: unknown;\n /** Whether the field is currently disabled (from RHF) */\n disabled: boolean | undefined;\n /** Validation error(s) for the field */\n error: FieldError[] | undefined;\n /** Pre-built errorMessage node to plug into components */\n errorMessage: ReactNode | null;\n /** RHF controller field with transformed value/onChange (use this for simple components) */\n field: ReturnType<typeof useController<TFieldValues>>['field'];\n /** Helper to spread standardized error message props to underlying components */\n getErrorMessageProps: ReturnType<typeof useInput>['getErrorMessageProps'];\n /** Helper to spread standardized helper wrapper props (for spacing/animation) */\n getHelperWrapperProps: ReturnType<typeof useInput>['getHelperWrapperProps'];\n /** Helper to spread standardized label props to underlying components */\n getLabelProps: ReturnType<typeof useInput>['getLabelProps'];\n /** Access current form values (converted to validation-friendly format) */\n getValues: ReturnType<typeof useFormContext<TFieldValues>>['getValues'];\n /** Whether the field should show invalid state (debounced for smooth animations). True when field is invalid AND (dirty OR touched OR submitted) */\n invalid: boolean;\n /** Computed label node including optional test id copy button */\n label: ReactNode | null;\n /** onBlur handler from controller */\n onBlur: ReturnType<typeof useController<TFieldValues>>['field']['onBlur'];\n /** onChange handler from controller (with transform applied) */\n onChange: ReturnType<typeof useController<TFieldValues>>['field']['onChange'];\n /** Ref to forward to underlying control */\n ref: ReturnType<typeof useController<TFieldValues>>['field']['ref'];\n /** Whether the field is required according to validation schema */\n required: boolean;\n /** Reset a specific field in the form */\n resetField: ReturnType<typeof useFormContext<TFieldValues>>['resetField'];\n /** Generated HTML data-testid for the field */\n testId: string;\n}\n\n/**\n * Combines frequently used form field logic into a single hook.\n *\n * Provides:\n * - Enhanced form context (validation-aware state, `testId`, value transforms)\n * - Controller field with nullish conversion handling\n * - Value transformation via `transform` prop:\n * • Allows disentangled display and form values (e.g., string ↔ object, boolean ↔ array)\n * • Automatically applies `toDisplayValue` to field value for components\n * • Automatically applies `toFormValue` to display value when onChange is called\n * • Works with `type` prop for automatic number/string conversion\n * • Examples: storing objects while displaying strings, storing booleans as arrays, enriching values with metadata\n * - Debounced `invalid` state with smart timing:\n * • `true` (field becomes invalid): applies immediately so errors show right away\n * • `false` (field becomes valid): delayed 200ms to allow smooth exit animations\n * • Respects `prefers-reduced-motion` by skipping delays when user prefers reduced motion\n * - Smart `invalid` visibility (via `showInvalid`):\n * • Shows errors when field is dirty OR touched OR form has been submitted\n * • Prevents showing errors on pristine/untouched fields for better UX\n * • Works well for all field types (text inputs, checkboxes, radios, arrays)\n * - Prebuilt `errorMessage` React node using `FieldValidationError`\n * - Computed `label` node which appends a `FieldCopyTestIdButton` in\n * `debug-testids` mode\n * - `defaultValue` for uncontrolled defaults and all usual field handlers\n * - Access to form utilities: `control`, `getValues`, `resetField`\n * - Presentation helpers: `getLabelProps`, `getErrorMessageProps`,\n * `getHelperWrapperProps` for consistent wiring to underlying UI components\n */\nexport const useUniformField = <\n TFieldValues extends FieldValues = FieldValues,\n TDisplay = unknown,\n>(\n params: UseUniformFieldParams<TFieldValues, TDisplay>,\n): UseUniformFieldReturn<TFieldValues> => {\n const {\n name,\n ariaLabel: customAriaLabel,\n disabled = false,\n testId: explicitTestId,\n label,\n type,\n transform,\n } = params;\n\n const {\n control,\n debugMode,\n formState: { submitCount },\n getFieldState,\n getValues,\n resetField,\n } = useFormContext<TFieldValues>();\n\n const {\n error,\n invalid: rawInvalid,\n isTouched,\n required,\n testId,\n } = getFieldState(name, explicitTestId);\n\n const { field } = useController<TFieldValues>({\n control,\n disabled,\n name,\n });\n const {\n onChange: fieldOnChange,\n value: fieldValue,\n disabled: isDisabled,\n onBlur,\n ref,\n } = field;\n\n // Get transform utilities (but don't apply them automatically)\n // Components can choose how to use them (directly or via useInputValueDebounce)\n const { toDisplayValue, toFormValue } = useInputValueTransform<TDisplay>({\n type,\n transform,\n });\n\n // For components without special needs: apply transform to value and onChange\n const transformedValue = toDisplayValue(fieldValue);\n const transformedOnChange = (eventOrValue: TDisplay | React.ChangeEvent) => {\n // Extract value from event or use value directly\n const displayValue =\n (eventOrValue as React.ChangeEvent<HTMLInputElement>)?.target?.value ??\n eventOrValue;\n const formValue = toFormValue(displayValue as TDisplay);\n fieldOnChange(formValue as typeof fieldValue);\n };\n\n const defaultValue = (getValues() as Record<string, unknown>)?.[\n name as string\n ];\n\n /**\n * Determine when to show the invalid state to the user.\n *\n * Show errors when the field is invalid AND any of these conditions are met:\n * - Field has a value (show validation errors like format/length while typing)\n * - Field is touched (focused and blurred) - good for text inputs\n * - Form has been submitted - shows all errors after submit attempt\n *\n * Note: We intentionally don't use isDirty because:\n * - Newly added array elements are marked \"dirty\" by RHF, causing immediate errors\n * - Field Cards with empty initial values show errors immediately\n * - hasValue + isTouched covers the same use cases more reliably\n *\n * This prevents showing errors on pristine/untouched/empty fields for better UX.\n * Examples:\n * - Text input: User loads form with empty required field → no error shown yet\n * - Text input: User types invalid content → error shows immediately (has value)\n * - Text input: User focuses and blurs without typing → error shows (via isTouched)\n * - Checkbox/radio: User selects option → error shows immediately (has value)\n * - Field array: User adds element → no error yet; after blur → error shows\n * - Any field: User submits form → all errors show (via submitCount)\n *\n * The entire condition is debounced to prevent flickering and allow smooth animations.\n */\n\n // isValueEmpty handles marker strings, flat array wrappers, empty arrays, and empty objects\n const hasValue = !isValueEmpty(fieldValue);\n const showInvalid = rawInvalid && (hasValue || isTouched || submitCount > 0);\n const invalid = useDebouncedInvalid(showInvalid, 200);\n\n // Build a label node that:\n // - shows the provided label (unless explicitly set to false)\n // - appends a copy-to-clipboard button for the test id in `debug-testids` mode\n // Consumers can pass this directly to component `label` props\n const showTestIdCopyButton = debugMode === 'debug-testids';\n const labelNode: ReactNode | null =\n !!label || showTestIdCopyButton ? (\n <>\n {label !== false ? label : null}\n {showTestIdCopyButton ? (\n <FieldCopyTestIdButton testId={testId} />\n ) : null}\n </>\n ) : null;\n\n // Ready-to-render error message; consumers can drop this into their\n // component `errorMessage` prop without repeating mapping/markup\n const errorMessage = <FieldValidationError error={error} testId={testId} />;\n\n // Generate standardized props for label, helper wrapper and error message\n // so consumers can spread them directly into UI components (e.g. HeroUI),\n // keeping animations/spacing consistent across fields\n const { getErrorMessageProps, getLabelProps, getHelperWrapperProps } =\n useInput({\n ref,\n classNames: {\n // set padding to 0 for error message exit animation\n helperWrapper: 'p-0',\n },\n errorMessage: JSON.stringify(error),\n isInvalid: invalid,\n isRequired: required,\n label,\n labelPlacement: 'outside',\n });\n\n // Compute aria-label: prefer custom prop, then use string label if available, otherwise field name\n // Components can further override this based on their specific accessibility needs\n // (e.g., Input/TextArea may skip this if they have a meaningful placeholder)\n const ariaLabel =\n customAriaLabel ?? (typeof label === 'string' ? label : name);\n\n return {\n ariaLabel,\n control,\n debugMode,\n defaultValue,\n disabled: isDisabled,\n error,\n errorMessage,\n field: {\n ...field,\n value: transformedValue as typeof field.value,\n onChange: transformedOnChange as typeof field.onChange,\n },\n getErrorMessageProps,\n getHelperWrapperProps,\n getLabelProps,\n getValues,\n invalid,\n label: labelNode,\n onBlur,\n onChange: transformedOnChange as typeof field.onChange,\n ref,\n required,\n resetField,\n testId,\n };\n};\n","/* v8 ignore start */\n\nexport * from './useUniformField';\n\n/* v8 ignore stop */\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,uBAAuB,SAAkB,YAAoB;CACjE,MAAM,mBAAmB,YAAY,SAAS,QAAQ;AAGtD,KAAI,mBAAmB,CACrB,QAAO;AAGT,QAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgGT,MAAa,mBAIX,WACwC;CACxC,MAAM,EACJ,MACA,WAAW,iBACX,WAAW,OACX,QAAQ,gBACR,OACA,MACA,cACE;CAEJ,MAAM,EACJ,SACA,WACA,WAAW,EAAE,eACb,eACA,WACA,eACE,gBAA8B;CAElC,MAAM,EACJ,OACA,SAAS,YACT,WACA,UACA,WACE,cAAc,MAAM,eAAe;CAEvC,MAAM,EAAE,UAAU,cAA4B;EAC5C;EACA;EACA;EACD,CAAC;CACF,MAAM,EACJ,UAAU,eACV,OAAO,YACP,UAAU,YACV,QACA,QACE;CAIJ,MAAM,EAAE,gBAAgB,gBAAgB,uBAAiC;EACvE;EACA;EACD,CAAC;CAGF,MAAM,mBAAmB,eAAe,WAAW;CACnD,MAAM,uBAAuB,iBAA+C;AAM1E,gBADkB,YAFf,cAAsD,QAAQ,SAC/D,aACqD,CACV;;CAG/C,MAAM,eAAgB,WAAW,GAC/B;;;;;;;;;;;;;;;;;;;;;;;;;CA6BF,MAAM,WAAW,CAAC,aAAa,WAAW;CAE1C,MAAM,UAAU,oBADI,eAAe,YAAY,aAAa,cAAc,IACzB,IAAI;CAMrD,MAAM,uBAAuB,cAAc;CAC3C,MAAM,YACJ,CAAC,CAAC,SAAS,uBACT,4CACG,UAAU,QAAQ,QAAQ,MAC1B,uBACC,oBAACA,iCAA8B,SAAU,GACvC,QACH,GACD;CAIN,MAAM,eAAe,oBAACC;EAA4B;EAAe;GAAU;CAK3E,MAAM,EAAE,sBAAsB,eAAe,0BAC3C,SAAS;EACP;EACA,YAAY,EAEV,eAAe,OAChB;EACD,cAAc,KAAK,UAAU,MAAM;EACnC,WAAW;EACX,YAAY;EACZ;EACA,gBAAgB;EACjB,CAAC;AAQJ,QAAO;EACL,WAHA,oBAAoB,OAAO,UAAU,WAAW,QAAQ;EAIxD;EACA;EACA;EACA,UAAU;EACV;EACA;EACA,OAAO;GACL,GAAG;GACH,OAAO;GACP,UAAU;GACX;EACD;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;EACA,UAAU;EACV;EACA;EACA;EACA;EACD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as useController } from "./useController-BArZd2Vp.cjs";
|
|
2
|
-
import { n as useFormContext } from "./useFormContext
|
|
2
|
+
import { n as useFormContext } from "./useFormContext-n3WYgGkW.cjs";
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
|
-
import * as
|
|
4
|
+
import * as react_hook_form0 from "react-hook-form";
|
|
5
5
|
import { ArrayPath, FieldValues } from "react-hook-form";
|
|
6
6
|
import * as _heroui_input0 from "@heroui/input";
|
|
7
7
|
|
|
@@ -44,36 +44,36 @@ declare const useUniformFieldArray: <TFieldValues extends FieldValues = FieldVal
|
|
|
44
44
|
label
|
|
45
45
|
}: UseUniformFieldArrayProps<TFieldValues>) => {
|
|
46
46
|
ariaLabel: string | undefined;
|
|
47
|
-
control:
|
|
47
|
+
control: react_hook_form0.Control<TFieldValues, any, TFieldValues>;
|
|
48
48
|
debugMode: ReturnType<typeof useFormContext<TFieldValues_1>>["debugMode"];
|
|
49
49
|
defaultValue: unknown;
|
|
50
50
|
disabled: boolean | undefined;
|
|
51
|
-
error:
|
|
51
|
+
error: react_hook_form0.FieldError[] | undefined;
|
|
52
52
|
errorMessage: ReactNode | null;
|
|
53
|
-
field: Omit<
|
|
53
|
+
field: Omit<react_hook_form0.ControllerRenderProps<TFieldValues>, "value" | "onChange"> & {
|
|
54
54
|
onChange: (...event: any[]) => void;
|
|
55
55
|
value: string;
|
|
56
56
|
};
|
|
57
57
|
getErrorMessageProps: ReturnType<typeof _heroui_input0.useInput>["getErrorMessageProps"];
|
|
58
58
|
getHelperWrapperProps: ReturnType<typeof _heroui_input0.useInput>["getHelperWrapperProps"];
|
|
59
59
|
getLabelProps: ReturnType<typeof _heroui_input0.useInput>["getLabelProps"];
|
|
60
|
-
getValues:
|
|
60
|
+
getValues: react_hook_form0.UseFormGetValues<TFieldValues>;
|
|
61
61
|
invalid: boolean;
|
|
62
62
|
label: ReactNode | null;
|
|
63
63
|
onBlur: ReturnType<typeof useController>["field"]["onBlur"];
|
|
64
64
|
onChange: ReturnType<typeof useController>["field"]["onChange"];
|
|
65
65
|
ref: ReturnType<typeof useController>["field"]["ref"];
|
|
66
66
|
required: boolean;
|
|
67
|
-
resetField:
|
|
67
|
+
resetField: react_hook_form0.UseFormResetField<TFieldValues>;
|
|
68
68
|
testId: string;
|
|
69
|
-
fields:
|
|
70
|
-
append:
|
|
71
|
-
remove:
|
|
72
|
-
insert:
|
|
73
|
-
move:
|
|
69
|
+
fields: react_hook_form0.FieldArrayWithId<TFieldValues, ArrayPath<TFieldValues>, "id">[];
|
|
70
|
+
append: react_hook_form0.UseFieldArrayAppend<TFieldValues, ArrayPath<TFieldValues>>;
|
|
71
|
+
remove: react_hook_form0.UseFieldArrayRemove;
|
|
72
|
+
insert: react_hook_form0.UseFieldArrayInsert<TFieldValues, ArrayPath<TFieldValues>>;
|
|
73
|
+
move: react_hook_form0.UseFieldArrayMove;
|
|
74
74
|
disableAnimation: boolean;
|
|
75
75
|
elementInitialValue: {};
|
|
76
76
|
};
|
|
77
77
|
//#endregion
|
|
78
78
|
export { useUniformFieldArray as n, UseUniformFieldArrayProps as t };
|
|
79
|
-
//# sourceMappingURL=useUniformFieldArray-
|
|
79
|
+
//# sourceMappingURL=useUniformFieldArray-B2-Bfl74.d.cts.map
|
package/dist/{useUniformFieldArray-WRuIMhw6.d.cts.map → useUniformFieldArray-B2-Bfl74.d.cts.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUniformFieldArray-
|
|
1
|
+
{"version":3,"file":"useUniformFieldArray-B2-Bfl74.d.cts","names":[],"sources":["../src/hooks/useUniformFieldArray/useUniformFieldArray.ts"],"sourcesContent":[],"mappings":";;;;;;;;UAYiB,+CACM,cAAc;;QAG7B,UAAU;;;EAJD;EACM,mBAAA,CAAA,EAAA,OAAA;EAAc;EAGnB,uBAAA,CAAA,EAAA,OAAA;EAAV;EAYE,QAAA,CAAA,EAAA,OAAA;EAAS;EAeN,MAAA,CAAA,EAAA,MAAA;EACU;EAAc,KAAA,CAAA,EAhB3B,SAgB2B;;;;;;;;;;;;;;cADxB,4CACU,cAAc;;;uBACnC;;;UAAA;;GAQC,0BAA0B;;;;;;;;;;;;;;;;;EAuDpB,KAAA,WAAA,GAAA,IAAA;EAAA,MAAA,EAAA,UAAA,CAAA,oBAAA,CAAA,CAAA,OAAA,CAAA,CAAA,QAAA,CAAA;EAKwC,QAAA,EAAA,UAAA,CAAA,OALxC,aAKwC,CAAA,CAAA,OAAA,CAAA,CAAA,UAAA,CAAA;EAAA,GAAA,EACyB,UADzB,CAAA,OAAA,aAAA,CAAA,CAAA,OAAA,CAAA,CAAA,KAAA,CAAA;EACyB,QAAA,EAAA,OAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const require_FormContext = require('./FormContext-
|
|
2
|
-
const require_helpers = require('./helpers-
|
|
3
|
-
const require_useFormContext = require('./useFormContext-
|
|
4
|
-
const require_useUniformField = require('./useUniformField-
|
|
1
|
+
const require_FormContext = require('./FormContext-CeFKQmVH.cjs');
|
|
2
|
+
const require_helpers = require('./helpers-CncbgvW_.cjs');
|
|
3
|
+
const require_useFormContext = require('./useFormContext-DJiJlfGJ.cjs');
|
|
4
|
+
const require_useUniformField = require('./useUniformField-CGiibqg4.cjs');
|
|
5
5
|
let react = require("react");
|
|
6
6
|
let _fuf_stack_pixel_motion = require("@fuf-stack/pixel-motion");
|
|
7
7
|
let react_hook_form = require("react-hook-form");
|
|
@@ -87,4 +87,4 @@ Object.defineProperty(exports, 'useUniformFieldArray', {
|
|
|
87
87
|
return useUniformFieldArray;
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
|
-
//# sourceMappingURL=useUniformFieldArray-
|
|
90
|
+
//# sourceMappingURL=useUniformFieldArray-Ct8jD7JJ.cjs.map
|