@fuf-stack/uniform 1.14.0 → 1.16.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-D5sibD6f.cjs → Checkboxes-3Rg0gyfO.cjs} +2 -2
- package/dist/{Checkboxes-D5sibD6f.cjs.map → Checkboxes-3Rg0gyfO.cjs.map} +1 -1
- package/dist/{Checkboxes-C57URc95.js → Checkboxes-BfUtbKe-.js} +2 -2
- package/dist/{Checkboxes-C57URc95.js.map → Checkboxes-BfUtbKe-.js.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-CWxV0Q6O.cjs → FieldArray-BgvSTDWi.cjs} +5 -5
- package/dist/FieldArray-BgvSTDWi.cjs.map +1 -0
- package/dist/{FieldArray-D-vR7oCb.js → FieldArray-C8Ipn-tM.js} +5 -5
- package/dist/FieldArray-C8Ipn-tM.js.map +1 -0
- 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-CKEeknzL.js → FieldCard-DZSiMFoO.js} +71 -16
- package/dist/FieldCard-DZSiMFoO.js.map +1 -0
- package/dist/{FieldCard-DiaY4qXt.cjs → FieldCard-DcMORXZR.cjs} +71 -16
- package/dist/FieldCard-DcMORXZR.cjs.map +1 -0
- package/dist/Form/index.d.cts +1 -1
- package/dist/Grid/index.d.cts +1 -1
- package/dist/Grid/index.d.ts +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-CUeTrgO_.js → Input-ChXItabV.js} +2 -2
- package/dist/{Input-CUeTrgO_.js.map → Input-ChXItabV.js.map} +1 -1
- package/dist/{Input-BJkL5IVO.cjs → Input-DlyrGFYf.cjs} +2 -2
- package/dist/{Input-BJkL5IVO.cjs.map → Input-DlyrGFYf.cjs.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-BXAo2Nom.cjs → RadioBoxes-ClDOhQkO.cjs} +2 -2
- package/dist/{RadioBoxes-BXAo2Nom.cjs.map → RadioBoxes-ClDOhQkO.cjs.map} +1 -1
- package/dist/{RadioBoxes-B-EbjvDm.js → RadioBoxes-D6ULFGfd.js} +2 -2
- package/dist/{RadioBoxes-B-EbjvDm.js.map → RadioBoxes-D6ULFGfd.js.map} +1 -1
- 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-rDuug93J.cjs → RadioTabs-CgB0MmbK.cjs} +2 -2
- package/dist/{RadioTabs-rDuug93J.cjs.map → RadioTabs-CgB0MmbK.cjs.map} +1 -1
- package/dist/{RadioTabs-C2FIAjx-.js → RadioTabs-eSB6OXD7.js} +2 -2
- package/dist/{RadioTabs-C2FIAjx-.js.map → RadioTabs-eSB6OXD7.js.map} +1 -1
- 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-N5qCQRBU.js → Radios-BXuyREKO.js} +2 -2
- package/dist/{Radios-N5qCQRBU.js.map → Radios-BXuyREKO.js.map} +1 -1
- package/dist/{Radios-LD2USByC.cjs → Radios-DWsCLUVl.cjs} +2 -2
- package/dist/{Radios-LD2USByC.cjs.map → Radios-DWsCLUVl.cjs.map} +1 -1
- 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-C5mS7WZC.cjs → Select-CTbXrAjL.cjs} +34 -13
- package/dist/Select-CTbXrAjL.cjs.map +1 -0
- package/dist/{Select-D_LJBu0p.js → Select-Dk_K_Q0F.js} +35 -14
- package/dist/Select-Dk_K_Q0F.js.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-D-bfkzoh.cjs → Slider-ChGkOSJJ.cjs} +2 -2
- package/dist/{Slider-D-bfkzoh.cjs.map → Slider-ChGkOSJJ.cjs.map} +1 -1
- package/dist/{Slider-CNlNpxV-.js → Slider-DdF0ZBzn.js} +2 -2
- package/dist/{Slider-CNlNpxV-.js.map → Slider-DdF0ZBzn.js.map} +1 -1
- package/dist/SubmitButton/index.d.cts +1 -1
- package/dist/SubmitButton/index.d.ts +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-DZptJsFF.js → Switch-DW9SOeIv.js} +2 -2
- package/dist/{Switch-DZptJsFF.js.map → Switch-DW9SOeIv.js.map} +1 -1
- package/dist/{Switch-BBAkWBHA.cjs → Switch-Lt61rKxf.cjs} +2 -2
- package/dist/{Switch-BBAkWBHA.cjs.map → Switch-Lt61rKxf.cjs.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-DZQCW3SK.js → SwitchBox-9KAu4WWd.js} +2 -2
- package/dist/{SwitchBox-DZQCW3SK.js.map → SwitchBox-9KAu4WWd.js.map} +1 -1
- package/dist/{SwitchBox-DHAJ_YXU.cjs → SwitchBox-D-EI9Sl-.cjs} +2 -2
- package/dist/{SwitchBox-DHAJ_YXU.cjs.map → SwitchBox-D-EI9Sl-.cjs.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-Dg2ZqJm2.js → TextArea-B0zYpNy-.js} +2 -2
- package/dist/{TextArea-Dg2ZqJm2.js.map → TextArea-B0zYpNy-.js.map} +1 -1
- package/dist/{TextArea-BBpGkB5f.cjs → TextArea-DRSFdn5v.cjs} +2 -2
- package/dist/{TextArea-BBpGkB5f.cjs.map → TextArea-DRSFdn5v.cjs.map} +1 -1
- package/dist/hooks/useController/index.cjs +1 -1
- package/dist/hooks/useController/index.d.cts +1 -1
- package/dist/hooks/useController/index.d.ts +1 -1
- package/dist/hooks/useController/index.js +1 -1
- package/dist/hooks/useFormContext/index.d.cts +1 -1
- package/dist/hooks/useFormContext/index.d.ts +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 +3 -3
- 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 +21 -21
- package/dist/hooks/useUniformFieldArray/index.js +1 -1
- package/dist/hooks/useWatchUserChange/index.cjs +1 -1
- package/dist/hooks/useWatchUserChange/index.d.cts +1 -1
- package/dist/hooks/useWatchUserChange/index.d.ts +1 -1
- package/dist/hooks/useWatchUserChange/index.js +1 -1
- package/dist/{index-CEzwxdlZ.d.ts → index-2SVlCM0Y.d.cts} +21 -21
- package/dist/{index-BeinxTzw.d.cts.map → index-2SVlCM0Y.d.cts.map} +1 -1
- package/dist/{index-CYdvpGJF.d.cts → index-B2IL9Zt7.d.cts} +3 -3
- package/dist/{index-CYdvpGJF.d.cts.map → index-B2IL9Zt7.d.cts.map} +1 -1
- package/dist/{index-BeinxTzw.d.cts → index-BDvr4eaz.d.ts} +21 -21
- package/dist/{index-CEzwxdlZ.d.ts.map → index-BDvr4eaz.d.ts.map} +1 -1
- package/dist/{index-nE7tTo2d.d.cts → index-BKCiuwim.d.cts} +46 -46
- package/dist/{index-nE7tTo2d.d.cts.map → index-BKCiuwim.d.cts.map} +1 -1
- package/dist/index-BTr_gid3.d.cts.map +1 -1
- package/dist/{index-C0--RHyE.d.cts → index-BZrLB2p0.d.cts} +34 -34
- package/dist/{index-C0--RHyE.d.cts.map → index-BZrLB2p0.d.cts.map} +1 -1
- package/dist/{index-P3_aBCSt.d.cts → index-BbA9HcNa.d.cts} +3 -3
- package/dist/{index-P3_aBCSt.d.cts.map → index-BbA9HcNa.d.cts.map} +1 -1
- package/dist/{index-BNu0EV5x.d.cts → index-Bo79xzb4.d.cts} +3 -3
- package/dist/{index-BNu0EV5x.d.cts.map → index-Bo79xzb4.d.cts.map} +1 -1
- package/dist/{index-ByQXPNeM.d.ts → index-BuX42Bbd.d.ts} +7 -6
- package/dist/index-BuX42Bbd.d.ts.map +1 -0
- package/dist/{index-BuaPmiMt.d.ts → index-CCeHSmIe.d.ts} +3 -3
- package/dist/{index-BuaPmiMt.d.ts.map → index-CCeHSmIe.d.ts.map} +1 -1
- package/dist/{index-CkhVD2Pw.d.ts → index-CJ90vm9t.d.ts} +6 -6
- package/dist/{index-CkhVD2Pw.d.ts.map → index-CJ90vm9t.d.ts.map} +1 -1
- package/dist/{index-DElTYKk8.d.ts → index-CPcJGZVS.d.ts} +3 -3
- package/dist/{index-DElTYKk8.d.ts.map → index-CPcJGZVS.d.ts.map} +1 -1
- package/dist/index-CRYEKT3o.d.ts +278 -0
- package/dist/index-CRYEKT3o.d.ts.map +1 -0
- package/dist/{index-B5BDC8Al.d.ts → index-CVY05bZf.d.ts} +3 -3
- package/dist/{index-B5BDC8Al.d.ts.map → index-CVY05bZf.d.ts.map} +1 -1
- package/dist/{index-DS54nHWk.d.cts → index-CZ5EIIjq.d.cts} +6 -6
- package/dist/{index-DS54nHWk.d.cts.map → index-CZ5EIIjq.d.cts.map} +1 -1
- package/dist/{index-BHklv3dW.d.ts → index-CdXOAPMb.d.ts} +48 -48
- package/dist/index-CdXOAPMb.d.ts.map +1 -0
- package/dist/{index-BOgOCyFF.d.cts → index-Cj5CLBt2.d.cts} +4 -4
- package/dist/{index-BOgOCyFF.d.cts.map → index-Cj5CLBt2.d.cts.map} +1 -1
- package/dist/{index-Cb0AgRRa.d.cts → index-CpVfOXNv.d.cts} +3 -3
- package/dist/{index-Cb0AgRRa.d.cts.map → index-CpVfOXNv.d.cts.map} +1 -1
- package/dist/{index-BbAjuXqS.d.cts → index-Ct2YYfiU.d.cts} +6 -6
- package/dist/{index-BbAjuXqS.d.cts.map → index-Ct2YYfiU.d.cts.map} +1 -1
- package/dist/{index-CbK-kEVY.d.cts → index-D-ucmG60.d.ts} +22 -22
- package/dist/index-D-ucmG60.d.ts.map +1 -0
- package/dist/index-D5rTKWm9.d.cts +278 -0
- package/dist/index-D5rTKWm9.d.cts.map +1 -0
- package/dist/{index-DsQabhNC.d.cts → index-DS4AP9pV.d.ts} +6 -6
- package/dist/{index-DMOAkVG4.d.ts.map → index-DS4AP9pV.d.ts.map} +1 -1
- package/dist/{index-5Hp_MzN_.d.cts → index-DW1uBiAf.d.cts} +5 -4
- package/dist/index-DW1uBiAf.d.cts.map +1 -0
- package/dist/{index-DamFEDHU.d.cts → index-DYErnCVV.d.cts} +36 -36
- package/dist/index-DYErnCVV.d.cts.map +1 -0
- package/dist/{index-DeHDOwxr.d.ts → index-DaBgwR1t.d.cts} +7 -7
- package/dist/{index-CbK-kEVY.d.cts.map → index-DaBgwR1t.d.cts.map} +1 -1
- package/dist/{index-Cb8jQhHS.d.ts → index-Djc5tmi3.d.ts} +36 -36
- package/dist/index-Djc5tmi3.d.ts.map +1 -0
- package/dist/{index-qNwZcAWj.d.ts → index-DubKudrE.d.ts} +6 -6
- package/dist/{index-qNwZcAWj.d.ts.map → index-DubKudrE.d.ts.map} +1 -1
- package/dist/{index-DMOAkVG4.d.ts → index-DymdaDrj.d.cts} +6 -6
- package/dist/{index-DsQabhNC.d.cts.map → index-DymdaDrj.d.cts.map} +1 -1
- package/dist/{index-CusdoJv3.d.ts → index-FHPC_VE1.d.ts} +35 -35
- package/dist/{index-CusdoJv3.d.ts.map → index-FHPC_VE1.d.ts.map} +1 -1
- package/dist/{index-6eckRMZA.d.cts → index-PU5WNOH9.d.cts} +3 -3
- package/dist/{index-6eckRMZA.d.cts.map → index-PU5WNOH9.d.cts.map} +1 -1
- package/dist/{index-BZ9HvBM6.d.cts → index-hacHTzh4.d.cts} +35 -35
- package/dist/{index-BZ9HvBM6.d.cts.map → index-hacHTzh4.d.cts.map} +1 -1
- package/dist/{index-CJcgEkPo.d.ts → index-lot50R9R.d.ts} +3 -3
- package/dist/{index-CJcgEkPo.d.ts.map → index-lot50R9R.d.ts.map} +1 -1
- package/dist/{index-ClQFLoqX.d.ts → index-noH6pESQ.d.ts} +34 -34
- package/dist/index-noH6pESQ.d.ts.map +1 -0
- package/dist/{index-ecrJ75NW.d.ts → index-tIGuHSXb.d.ts} +4 -4
- package/dist/{index-ecrJ75NW.d.ts.map → index-tIGuHSXb.d.ts.map} +1 -1
- package/dist/index.cjs +16 -16
- package/dist/index.d.cts +22 -22
- package/dist/index.d.ts +21 -21
- package/dist/index.js +16 -16
- package/dist/partials/FieldCopyTestIdButton/index.d.cts +1 -1
- package/dist/partials/FieldCopyTestIdButton/index.d.ts +1 -1
- package/dist/partials/FieldValidationError/index.d.cts +1 -1
- package/dist/partials/FieldValidationError/index.d.ts +1 -1
- package/dist/{useController-C_MZLZIp.d.cts → useController-B-DhUPpA.d.cts} +3 -1
- package/dist/{useController-C_MZLZIp.d.cts.map → useController-B-DhUPpA.d.cts.map} +1 -1
- package/dist/{useController-hjpJQf0w.d.ts → useController-Co8wbo-Y.d.ts} +3 -1
- package/dist/{useController-hjpJQf0w.d.ts.map → useController-Co8wbo-Y.d.ts.map} +1 -1
- package/dist/{useController-Dleq15tG.js → useController-QcOl0O0v.js} +4 -1
- package/dist/useController-QcOl0O0v.js.map +1 -0
- package/dist/{useController-BySgDIes.cjs → useController-oCYPeezC.cjs} +4 -1
- package/dist/useController-oCYPeezC.cjs.map +1 -0
- package/dist/{useFormContext-B7ooPCfd.d.ts → useFormContext-DDx8LD8e.d.ts} +3 -3
- package/dist/{useFormContext-B7ooPCfd.d.ts.map → useFormContext-DDx8LD8e.d.ts.map} +1 -1
- package/dist/{useFormContext-DihY1N8O.d.cts → useFormContext-oEivkWtB.d.cts} +19 -19
- package/dist/{useFormContext-DihY1N8O.d.cts.map → useFormContext-oEivkWtB.d.cts.map} +1 -1
- package/dist/{useUniformField-Brwxoghf.js → useUniformField-C6oSAFa3.js} +2 -2
- package/dist/{useUniformField-Brwxoghf.js.map → useUniformField-C6oSAFa3.js.map} +1 -1
- package/dist/{useUniformField-Dz_-tPrO.d.cts → useUniformField-DFXQO9dw.d.cts} +3 -3
- package/dist/{useUniformField-Dz_-tPrO.d.cts.map → useUniformField-DFXQO9dw.d.cts.map} +1 -1
- package/dist/{useUniformField-BJTRfqCQ.cjs → useUniformField-Dd3AnpgE.cjs} +2 -2
- package/dist/{useUniformField-BJTRfqCQ.cjs.map → useUniformField-Dd3AnpgE.cjs.map} +1 -1
- package/dist/{useUniformField-giYkUMG_.d.ts → useUniformField-q3GCAV85.d.ts} +3 -3
- package/dist/{useUniformField-giYkUMG_.d.ts.map → useUniformField-q3GCAV85.d.ts.map} +1 -1
- package/dist/{useUniformFieldArray-BMBc3o7P.d.cts → useUniformFieldArray-B3smveBW.d.cts} +14 -14
- package/dist/{useUniformFieldArray-BMBc3o7P.d.cts.map → useUniformFieldArray-B3smveBW.d.cts.map} +1 -1
- package/dist/{useUniformFieldArray-COp7qAwf.d.ts → useUniformFieldArray-CmACueEO.d.ts} +4 -4
- package/dist/{useUniformFieldArray-COp7qAwf.d.ts.map → useUniformFieldArray-CmACueEO.d.ts.map} +1 -1
- package/dist/{useUniformFieldArray-N5uHlvRy.cjs → useUniformFieldArray-D93AUZI4.cjs} +2 -2
- package/dist/{useUniformFieldArray-N5uHlvRy.cjs.map → useUniformFieldArray-D93AUZI4.cjs.map} +1 -1
- package/dist/{useUniformFieldArray-SlUu--d6.js → useUniformFieldArray-DNrmEXLg.js} +2 -2
- package/dist/{useUniformFieldArray-SlUu--d6.js.map → useUniformFieldArray-DNrmEXLg.js.map} +1 -1
- package/dist/{useWatchUserChange-BAdiqg2q.d.ts → useWatchUserChange-DahNCPDG.d.cts} +3 -1
- package/dist/{useWatchUserChange-COVdHmki.d.cts.map → useWatchUserChange-DahNCPDG.d.cts.map} +1 -1
- package/dist/{useWatchUserChange-1ELFYX_F.js → useWatchUserChange-DyhUYlrN.js} +3 -1
- package/dist/useWatchUserChange-DyhUYlrN.js.map +1 -0
- package/dist/{useWatchUserChange-COVdHmki.d.cts → useWatchUserChange-JMU-vN92.d.ts} +3 -1
- package/dist/{useWatchUserChange-BAdiqg2q.d.ts.map → useWatchUserChange-JMU-vN92.d.ts.map} +1 -1
- package/dist/{useWatchUserChange-C1zOvSSU.cjs → useWatchUserChange-jivI5KIB.cjs} +3 -1
- package/dist/useWatchUserChange-jivI5KIB.cjs.map +1 -0
- package/package.json +2 -2
- package/dist/FieldArray-CWxV0Q6O.cjs.map +0 -1
- package/dist/FieldArray-D-vR7oCb.js.map +0 -1
- package/dist/FieldCard-CKEeknzL.js.map +0 -1
- package/dist/FieldCard-DiaY4qXt.cjs.map +0 -1
- package/dist/Select-C5mS7WZC.cjs.map +0 -1
- package/dist/Select-D_LJBu0p.js.map +0 -1
- package/dist/index-5Hp_MzN_.d.cts.map +0 -1
- package/dist/index-BHklv3dW.d.ts.map +0 -1
- package/dist/index-ByQXPNeM.d.ts.map +0 -1
- package/dist/index-CPE2gcz3.d.ts +0 -264
- package/dist/index-CPE2gcz3.d.ts.map +0 -1
- package/dist/index-Cb8jQhHS.d.ts.map +0 -1
- package/dist/index-ClQFLoqX.d.ts.map +0 -1
- package/dist/index-DamFEDHU.d.cts.map +0 -1
- package/dist/index-DeHDOwxr.d.ts.map +0 -1
- package/dist/index-jeFGTign.d.cts +0 -264
- package/dist/index-jeFGTign.d.cts.map +0 -1
- package/dist/useController-BySgDIes.cjs.map +0 -1
- package/dist/useController-Dleq15tG.js.map +0 -1
- package/dist/useWatchUserChange-1ELFYX_F.js.map +0 -1
- package/dist/useWatchUserChange-C1zOvSSU.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUniformField-BJTRfqCQ.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-Dd3AnpgE.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-Cc0qEsnS.js";
|
|
2
|
-
import { r as useController$1 } from "./useController-
|
|
3
|
-
import { n as useFormContext$1 } from "./useFormContext-
|
|
2
|
+
import { r as useController$1 } from "./useController-Co8wbo-Y.js";
|
|
3
|
+
import { n as useFormContext$1 } from "./useFormContext-DDx8LD8e.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-q3GCAV85.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUniformField-
|
|
1
|
+
{"version":3,"file":"useUniformField-q3GCAV85.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,7 +1,7 @@
|
|
|
1
|
-
import { r as useController } from "./useController-
|
|
2
|
-
import { n as useFormContext } from "./useFormContext-
|
|
1
|
+
import { r as useController } from "./useController-B-DhUPpA.cjs";
|
|
2
|
+
import { n as useFormContext } from "./useFormContext-oEivkWtB.cjs";
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
|
-
import * as
|
|
4
|
+
import * as react_hook_form14 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_form14.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_form14.FieldError[] | undefined;
|
|
52
52
|
errorMessage: ReactNode | null;
|
|
53
|
-
field: Omit<
|
|
53
|
+
field: Omit<react_hook_form14.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_form14.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_form14.UseFormResetField<TFieldValues>;
|
|
68
68
|
testId: string;
|
|
69
|
-
fields:
|
|
70
|
-
append:
|
|
71
|
-
remove:
|
|
72
|
-
insert:
|
|
73
|
-
move:
|
|
69
|
+
fields: react_hook_form14.FieldArrayWithId<TFieldValues, ArrayPath<TFieldValues>, "id">[];
|
|
70
|
+
append: react_hook_form14.UseFieldArrayAppend<TFieldValues, ArrayPath<TFieldValues>>;
|
|
71
|
+
remove: react_hook_form14.UseFieldArrayRemove;
|
|
72
|
+
insert: react_hook_form14.UseFieldArrayInsert<TFieldValues, ArrayPath<TFieldValues>>;
|
|
73
|
+
move: react_hook_form14.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-B3smveBW.d.cts.map
|
package/dist/{useUniformFieldArray-BMBc3o7P.d.cts.map → useUniformFieldArray-B3smveBW.d.cts.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUniformFieldArray-
|
|
1
|
+
{"version":3,"file":"useUniformFieldArray-B3smveBW.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,5 +1,5 @@
|
|
|
1
|
-
import { r as useController$1 } from "./useController-
|
|
2
|
-
import { n as useFormContext$1 } from "./useFormContext-
|
|
1
|
+
import { r as useController$1 } from "./useController-Co8wbo-Y.js";
|
|
2
|
+
import { n as useFormContext$1 } from "./useFormContext-DDx8LD8e.js";
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
4
|
import * as react_hook_form0 from "react-hook-form";
|
|
5
5
|
import { ArrayPath, FieldValues } from "react-hook-form";
|
|
@@ -50,7 +50,7 @@ declare const useUniformFieldArray: <TFieldValues extends FieldValues = FieldVal
|
|
|
50
50
|
disabled: boolean | undefined;
|
|
51
51
|
error: react_hook_form0.FieldError[] | undefined;
|
|
52
52
|
errorMessage: ReactNode | null;
|
|
53
|
-
field: Omit<react_hook_form0.ControllerRenderProps<TFieldValues>, "
|
|
53
|
+
field: Omit<react_hook_form0.ControllerRenderProps<TFieldValues>, "value" | "onChange"> & {
|
|
54
54
|
onChange: (...event: any[]) => void;
|
|
55
55
|
value: string;
|
|
56
56
|
};
|
|
@@ -76,4 +76,4 @@ declare const useUniformFieldArray: <TFieldValues extends FieldValues = FieldVal
|
|
|
76
76
|
};
|
|
77
77
|
//#endregion
|
|
78
78
|
export { useUniformFieldArray as n, UseUniformFieldArrayProps as t };
|
|
79
|
-
//# sourceMappingURL=useUniformFieldArray-
|
|
79
|
+
//# sourceMappingURL=useUniformFieldArray-CmACueEO.d.ts.map
|
package/dist/{useUniformFieldArray-COp7qAwf.d.ts.map → useUniformFieldArray-CmACueEO.d.ts.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUniformFieldArray-
|
|
1
|
+
{"version":3,"file":"useUniformFieldArray-CmACueEO.d.ts","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,sBAAA,CAAA,CAAA,OAAA,CAAA,CAAA,QAAA,CAAA;EAKwC,QAAA,EAAA,UAAA,CAAA,OALxC,eAKwC,CAAA,CAAA,OAAA,CAAA,CAAA,UAAA,CAAA;EAAA,GAAA,EACyB,UADzB,CAAA,OAAA,eAAA,CAAA,CAAA,OAAA,CAAA,CAAA,KAAA,CAAA;EACyB,QAAA,EAAA,OAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_FormContext = require('./FormContext-CeFKQmVH.cjs');
|
|
2
2
|
const require_helpers = require('./helpers-CncbgvW_.cjs');
|
|
3
3
|
const require_useFormContext = require('./useFormContext-DJiJlfGJ.cjs');
|
|
4
|
-
const require_useUniformField = require('./useUniformField-
|
|
4
|
+
const require_useUniformField = require('./useUniformField-Dd3AnpgE.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-D93AUZI4.cjs.map
|
package/dist/{useUniformFieldArray-N5uHlvRy.cjs.map → useUniformFieldArray-D93AUZI4.cjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUniformFieldArray-
|
|
1
|
+
{"version":3,"file":"useUniformFieldArray-D93AUZI4.cjs","names":["useUniformField","useFormContext","flatArrayKey"],"sources":["../src/hooks/useUniformFieldArray/useUniformFieldArray.ts","../src/hooks/useUniformFieldArray/index.ts"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { ArrayPath, FieldValues, Path } from 'react-hook-form';\n\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport { useFieldArray as useRHFFieldArray } from 'react-hook-form';\n\nimport { useReducedMotion } from '@fuf-stack/pixel-motion';\n\nimport { flatArrayKey } from '../../helpers';\nimport { useFormContext } from '../useFormContext';\nimport { useUniformField } from '../useUniformField';\n\nexport interface UseUniformFieldArrayProps<\n TFieldValues extends FieldValues = FieldValues,\n> {\n /** Field name for the array */\n name: ArrayPath<TFieldValues>;\n /** Whether this is a flat array (array of primitives) */\n flat?: boolean;\n /** Initial value for new array elements */\n elementInitialValue?: unknown;\n /** Whether the last element cannot be removed (always maintain at least one element) */\n lastElementNotRemovable?: boolean;\n /** Disable the field */\n disabled?: boolean;\n /** Optional explicit test id used to build stable test ids */\n testId?: string;\n /** Optional label content */\n label?: ReactNode;\n}\n\n/**\n * Enhanced useFieldArray hook with initialization and animation logic.\n * Based on React Hook Form's useFieldArray with additional features:\n * - Automatic initialization when lastElementNotRemovable is set\n * - Animation control (disabled during initialization)\n * - Support for flat arrays (arrays of primitives)\n *\n * Note: Automatic validation triggering on length change is disabled to prevent\n * triggering form-wide validation. Array validation still runs on form submission.\n *\n * @see https://react-hook-form.com/docs/usefieldarray\n */\nexport const useUniformFieldArray = <\n TFieldValues extends FieldValues = FieldValues,\n>({\n name,\n flat = false,\n elementInitialValue: _elementInitialValue = null,\n lastElementNotRemovable = false,\n disabled,\n testId: explicitTestId,\n label,\n}: UseUniformFieldArrayProps<TFieldValues>) => {\n // Get uniform field state and utilities\n const uniformField = useUniformField<TFieldValues>({\n name: name as Path<TFieldValues> & string,\n disabled,\n testId: explicitTestId,\n label,\n });\n\n const { control } = uniformField;\n\n const { fields, append, remove, insert, move } = useRHFFieldArray({\n control,\n name,\n });\n\n const { trigger, setValue } = useFormContext<TFieldValues>();\n\n // Determine if initialization is needed (initially or after reset).\n // This flag automatically handles both scenarios:\n // - Initial mount: fields.length starts at 0\n // - Form reset: fields.length becomes 0 again\n // Additional initialization conditions can be added here later (e.g., minElements > 0)\n // Using useMemo ensures this value is properly tracked by React and effects can depend on it\n const needsInitialize = useMemo(() => {\n return lastElementNotRemovable && fields.length === 0;\n }, [lastElementNotRemovable, fields.length]);\n\n // Track whether initialization has completed. Initialized contextually:\n // - If initialization IS needed (needsInitialize = true): starts as false, set to true after init\n // - If initialization is NOT needed (needsInitialize = false): starts as true (already initialized)\n // This ref is used to:\n // 1. Skip validation during initialization/re-initialization\n // 2. Gate animation enabling until after initialization\n // 3. Gate motion preference effect until after initialization\n const hasInitialized = useRef(!needsInitialize);\n\n // Reset initialization flag when needsInitialize changes to true.\n // This handles form reset: when fields become empty (needsInitialize becomes true),\n // hasInitialized is reset to false, triggering re-initialization in the effect below.\n useEffect(() => {\n if (needsInitialize) {\n hasInitialized.current = false;\n }\n }, [needsInitialize]);\n\n // Validate array-level constraints (min/max items) when length changes.\n // This ensures min/max errors appear instantly when user adds/removes items.\n // Note: Child field validation also runs, but new empty fields won't show as invalid\n // because useFormContext only sets invalid=true for touched fields or after form submission.\n // Skip validation during initialization/re-initialization to avoid showing errors prematurely.\n useEffect(() => {\n if (hasInitialized.current) {\n setTimeout(() => {\n trigger(name as Path<TFieldValues>);\n }, 200);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [fields.length]);\n\n // Animation control: Start with animations disabled to prevent animating in initial elements.\n // Will be enabled after initialization completes (unless user prefers reduced motion).\n const [disableAnimation, setDisableAnimation] = useState(true);\n\n // Respond to user's motion preference changes (after initialization).\n // During initialization, animations stay disabled regardless of preference.\n const prefersReducedMotion = useReducedMotion();\n useEffect(() => {\n if (hasInitialized.current) {\n setDisableAnimation(!!prefersReducedMotion);\n }\n }, [prefersReducedMotion]);\n\n // Prepare initial element value based on mode\n // - flat=true: arrays of primitives → object with flatArrayKey and null value by default\n // - flat=false: arrays of objects → empty object by default\n const elementInitialValue = useMemo(() => {\n return flat\n ? { [flatArrayKey]: _elementInitialValue ?? null }\n : (_elementInitialValue ?? {});\n }, [flat, _elementInitialValue]);\n\n // Initialization/Re-initialization: Add initial element when needed.\n // This handles both initial mount and form reset scenarios by reacting to needsInitialize.\n // CRITICAL: This effect MUST be the LAST hook in this component.\n // It sets hasInitialized.current = true, which acts as a gate for other effects.\n // If this runs before other effects, hasInitialized will be true during their first run,\n // causing them to execute logic meant only for post-initialization (e.g., validation,\n // animation enabling). By placing this last, all other effects run first with\n // hasInitialized = false, allowing them to skip initialization-phase logic.\n useEffect(\n () => {\n if (needsInitialize) {\n // use setValue instead of append to avoid focusing the added element\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n setValue(name as Path<TFieldValues>, [elementInitialValue] as any, {\n shouldDirty: false,\n shouldTouch: false,\n });\n\n // Mark initialization as complete\n hasInitialized.current = true;\n\n // Enable animations after a brief delay (unless user prefers reduced motion or animations are already enabled).\n // This only runs on initial mount when animations start disabled.\n // On reset, disableAnimation is typically false, so this setTimeout won't run and animations stay enabled.\n if (!prefersReducedMotion && disableAnimation) {\n setTimeout(() => {\n setDisableAnimation(false);\n }, 1);\n }\n }\n },\n // Run when needsInitialize changes (initial mount or reset)\n // needsInitialize is memoized based on fields.length and lastElementNotRemovable\n // Other dependencies are intentionally omitted:\n // - append, setValue, trigger, setDisableAnimation are stable refs/functions\n // - elementInitialValue, name, flat, prefersReducedMotion, disableAnimation are props/stable values\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [needsInitialize],\n );\n\n return {\n // Field array methods and state\n fields,\n append,\n remove,\n insert,\n move,\n disableAnimation,\n elementInitialValue,\n // Uniform field state and utilities (spread all)\n ...uniformField,\n };\n};\n","/* v8 ignore start */\n\nexport * from './useUniformFieldArray';\n\n/* v8 ignore stop */\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA2CA,MAAa,wBAEX,EACA,MACA,OAAO,OACP,qBAAqB,uBAAuB,MAC5C,0BAA0B,OAC1B,UACA,QAAQ,gBACR,YAC6C;CAE7C,MAAM,eAAeA,wCAA8B;EAC3C;EACN;EACA,QAAQ;EACR;EACD,CAAC;CAEF,MAAM,EAAE,YAAY;CAEpB,MAAM,EAAE,QAAQ,QAAQ,QAAQ,QAAQ,4CAA0B;EAChE;EACA;EACD,CAAC;CAEF,MAAM,EAAE,SAAS,aAAaC,uCAA8B;CAQ5D,MAAM,2CAAgC;AACpC,SAAO,2BAA2B,OAAO,WAAW;IACnD,CAAC,yBAAyB,OAAO,OAAO,CAAC;CAS5C,MAAM,mCAAwB,CAAC,gBAAgB;AAK/C,4BAAgB;AACd,MAAI,gBACF,gBAAe,UAAU;IAE1B,CAAC,gBAAgB,CAAC;AAOrB,4BAAgB;AACd,MAAI,eAAe,QACjB,kBAAiB;AACf,WAAQ,KAA2B;KAClC,IAAI;IAGR,CAAC,OAAO,OAAO,CAAC;CAInB,MAAM,CAAC,kBAAkB,2CAAgC,KAAK;CAI9D,MAAM,sEAAyC;AAC/C,4BAAgB;AACd,MAAI,eAAe,QACjB,qBAAoB,CAAC,CAAC,qBAAqB;IAE5C,CAAC,qBAAqB,CAAC;CAK1B,MAAM,+CAAoC;AACxC,SAAO,OACH,GAAGC,+BAAe,wBAAwB,MAAM,GAC/C,wBAAwB,EAAE;IAC9B,CAAC,MAAM,qBAAqB,CAAC;AAUhC,4BACQ;AACJ,MAAI,iBAAiB;AAGnB,YAAS,MAA4B,CAAC,oBAAoB,EAAS;IACjE,aAAa;IACb,aAAa;IACd,CAAC;AAGF,kBAAe,UAAU;AAKzB,OAAI,CAAC,wBAAwB,iBAC3B,kBAAiB;AACf,wBAAoB,MAAM;MACzB,EAAE;;IAUX,CAAC,gBAAgB,CAClB;AAED,QAAO;EAEL;EACA;EACA;EACA;EACA;EACA;EACA;EAEA,GAAG;EACJ"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as flatArrayKey } from "./helpers-D3A5d3M1.js";
|
|
2
2
|
import { n as useFormContext$1 } from "./useFormContext-UFBqUfOr.js";
|
|
3
|
-
import { t as useUniformField } from "./useUniformField-
|
|
3
|
+
import { t as useUniformField } from "./useUniformField-C6oSAFa3.js";
|
|
4
4
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
5
5
|
import { useReducedMotion } from "@fuf-stack/pixel-motion";
|
|
6
6
|
import { useFieldArray } from "react-hook-form";
|
|
@@ -81,4 +81,4 @@ const useUniformFieldArray = ({ name, flat = false, elementInitialValue: _elemen
|
|
|
81
81
|
|
|
82
82
|
//#endregion
|
|
83
83
|
export { useUniformFieldArray as t };
|
|
84
|
-
//# sourceMappingURL=useUniformFieldArray-
|
|
84
|
+
//# sourceMappingURL=useUniformFieldArray-DNrmEXLg.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUniformFieldArray-
|
|
1
|
+
{"version":3,"file":"useUniformFieldArray-DNrmEXLg.js","names":["useRHFFieldArray","useFormContext"],"sources":["../src/hooks/useUniformFieldArray/useUniformFieldArray.ts","../src/hooks/useUniformFieldArray/index.ts"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { ArrayPath, FieldValues, Path } from 'react-hook-form';\n\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport { useFieldArray as useRHFFieldArray } from 'react-hook-form';\n\nimport { useReducedMotion } from '@fuf-stack/pixel-motion';\n\nimport { flatArrayKey } from '../../helpers';\nimport { useFormContext } from '../useFormContext';\nimport { useUniformField } from '../useUniformField';\n\nexport interface UseUniformFieldArrayProps<\n TFieldValues extends FieldValues = FieldValues,\n> {\n /** Field name for the array */\n name: ArrayPath<TFieldValues>;\n /** Whether this is a flat array (array of primitives) */\n flat?: boolean;\n /** Initial value for new array elements */\n elementInitialValue?: unknown;\n /** Whether the last element cannot be removed (always maintain at least one element) */\n lastElementNotRemovable?: boolean;\n /** Disable the field */\n disabled?: boolean;\n /** Optional explicit test id used to build stable test ids */\n testId?: string;\n /** Optional label content */\n label?: ReactNode;\n}\n\n/**\n * Enhanced useFieldArray hook with initialization and animation logic.\n * Based on React Hook Form's useFieldArray with additional features:\n * - Automatic initialization when lastElementNotRemovable is set\n * - Animation control (disabled during initialization)\n * - Support for flat arrays (arrays of primitives)\n *\n * Note: Automatic validation triggering on length change is disabled to prevent\n * triggering form-wide validation. Array validation still runs on form submission.\n *\n * @see https://react-hook-form.com/docs/usefieldarray\n */\nexport const useUniformFieldArray = <\n TFieldValues extends FieldValues = FieldValues,\n>({\n name,\n flat = false,\n elementInitialValue: _elementInitialValue = null,\n lastElementNotRemovable = false,\n disabled,\n testId: explicitTestId,\n label,\n}: UseUniformFieldArrayProps<TFieldValues>) => {\n // Get uniform field state and utilities\n const uniformField = useUniformField<TFieldValues>({\n name: name as Path<TFieldValues> & string,\n disabled,\n testId: explicitTestId,\n label,\n });\n\n const { control } = uniformField;\n\n const { fields, append, remove, insert, move } = useRHFFieldArray({\n control,\n name,\n });\n\n const { trigger, setValue } = useFormContext<TFieldValues>();\n\n // Determine if initialization is needed (initially or after reset).\n // This flag automatically handles both scenarios:\n // - Initial mount: fields.length starts at 0\n // - Form reset: fields.length becomes 0 again\n // Additional initialization conditions can be added here later (e.g., minElements > 0)\n // Using useMemo ensures this value is properly tracked by React and effects can depend on it\n const needsInitialize = useMemo(() => {\n return lastElementNotRemovable && fields.length === 0;\n }, [lastElementNotRemovable, fields.length]);\n\n // Track whether initialization has completed. Initialized contextually:\n // - If initialization IS needed (needsInitialize = true): starts as false, set to true after init\n // - If initialization is NOT needed (needsInitialize = false): starts as true (already initialized)\n // This ref is used to:\n // 1. Skip validation during initialization/re-initialization\n // 2. Gate animation enabling until after initialization\n // 3. Gate motion preference effect until after initialization\n const hasInitialized = useRef(!needsInitialize);\n\n // Reset initialization flag when needsInitialize changes to true.\n // This handles form reset: when fields become empty (needsInitialize becomes true),\n // hasInitialized is reset to false, triggering re-initialization in the effect below.\n useEffect(() => {\n if (needsInitialize) {\n hasInitialized.current = false;\n }\n }, [needsInitialize]);\n\n // Validate array-level constraints (min/max items) when length changes.\n // This ensures min/max errors appear instantly when user adds/removes items.\n // Note: Child field validation also runs, but new empty fields won't show as invalid\n // because useFormContext only sets invalid=true for touched fields or after form submission.\n // Skip validation during initialization/re-initialization to avoid showing errors prematurely.\n useEffect(() => {\n if (hasInitialized.current) {\n setTimeout(() => {\n trigger(name as Path<TFieldValues>);\n }, 200);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [fields.length]);\n\n // Animation control: Start with animations disabled to prevent animating in initial elements.\n // Will be enabled after initialization completes (unless user prefers reduced motion).\n const [disableAnimation, setDisableAnimation] = useState(true);\n\n // Respond to user's motion preference changes (after initialization).\n // During initialization, animations stay disabled regardless of preference.\n const prefersReducedMotion = useReducedMotion();\n useEffect(() => {\n if (hasInitialized.current) {\n setDisableAnimation(!!prefersReducedMotion);\n }\n }, [prefersReducedMotion]);\n\n // Prepare initial element value based on mode\n // - flat=true: arrays of primitives → object with flatArrayKey and null value by default\n // - flat=false: arrays of objects → empty object by default\n const elementInitialValue = useMemo(() => {\n return flat\n ? { [flatArrayKey]: _elementInitialValue ?? null }\n : (_elementInitialValue ?? {});\n }, [flat, _elementInitialValue]);\n\n // Initialization/Re-initialization: Add initial element when needed.\n // This handles both initial mount and form reset scenarios by reacting to needsInitialize.\n // CRITICAL: This effect MUST be the LAST hook in this component.\n // It sets hasInitialized.current = true, which acts as a gate for other effects.\n // If this runs before other effects, hasInitialized will be true during their first run,\n // causing them to execute logic meant only for post-initialization (e.g., validation,\n // animation enabling). By placing this last, all other effects run first with\n // hasInitialized = false, allowing them to skip initialization-phase logic.\n useEffect(\n () => {\n if (needsInitialize) {\n // use setValue instead of append to avoid focusing the added element\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n setValue(name as Path<TFieldValues>, [elementInitialValue] as any, {\n shouldDirty: false,\n shouldTouch: false,\n });\n\n // Mark initialization as complete\n hasInitialized.current = true;\n\n // Enable animations after a brief delay (unless user prefers reduced motion or animations are already enabled).\n // This only runs on initial mount when animations start disabled.\n // On reset, disableAnimation is typically false, so this setTimeout won't run and animations stay enabled.\n if (!prefersReducedMotion && disableAnimation) {\n setTimeout(() => {\n setDisableAnimation(false);\n }, 1);\n }\n }\n },\n // Run when needsInitialize changes (initial mount or reset)\n // needsInitialize is memoized based on fields.length and lastElementNotRemovable\n // Other dependencies are intentionally omitted:\n // - append, setValue, trigger, setDisableAnimation are stable refs/functions\n // - elementInitialValue, name, flat, prefersReducedMotion, disableAnimation are props/stable values\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [needsInitialize],\n );\n\n return {\n // Field array methods and state\n fields,\n append,\n remove,\n insert,\n move,\n disableAnimation,\n elementInitialValue,\n // Uniform field state and utilities (spread all)\n ...uniformField,\n };\n};\n","/* v8 ignore start */\n\nexport * from './useUniformFieldArray';\n\n/* v8 ignore stop */\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA2CA,MAAa,wBAEX,EACA,MACA,OAAO,OACP,qBAAqB,uBAAuB,MAC5C,0BAA0B,OAC1B,UACA,QAAQ,gBACR,YAC6C;CAE7C,MAAM,eAAe,gBAA8B;EAC3C;EACN;EACA,QAAQ;EACR;EACD,CAAC;CAEF,MAAM,EAAE,YAAY;CAEpB,MAAM,EAAE,QAAQ,QAAQ,QAAQ,QAAQ,SAASA,cAAiB;EAChE;EACA;EACD,CAAC;CAEF,MAAM,EAAE,SAAS,aAAaC,kBAA8B;CAQ5D,MAAM,kBAAkB,cAAc;AACpC,SAAO,2BAA2B,OAAO,WAAW;IACnD,CAAC,yBAAyB,OAAO,OAAO,CAAC;CAS5C,MAAM,iBAAiB,OAAO,CAAC,gBAAgB;AAK/C,iBAAgB;AACd,MAAI,gBACF,gBAAe,UAAU;IAE1B,CAAC,gBAAgB,CAAC;AAOrB,iBAAgB;AACd,MAAI,eAAe,QACjB,kBAAiB;AACf,WAAQ,KAA2B;KAClC,IAAI;IAGR,CAAC,OAAO,OAAO,CAAC;CAInB,MAAM,CAAC,kBAAkB,uBAAuB,SAAS,KAAK;CAI9D,MAAM,uBAAuB,kBAAkB;AAC/C,iBAAgB;AACd,MAAI,eAAe,QACjB,qBAAoB,CAAC,CAAC,qBAAqB;IAE5C,CAAC,qBAAqB,CAAC;CAK1B,MAAM,sBAAsB,cAAc;AACxC,SAAO,OACH,GAAG,eAAe,wBAAwB,MAAM,GAC/C,wBAAwB,EAAE;IAC9B,CAAC,MAAM,qBAAqB,CAAC;AAUhC,iBACQ;AACJ,MAAI,iBAAiB;AAGnB,YAAS,MAA4B,CAAC,oBAAoB,EAAS;IACjE,aAAa;IACb,aAAa;IACd,CAAC;AAGF,kBAAe,UAAU;AAKzB,OAAI,CAAC,wBAAwB,iBAC3B,kBAAiB;AACf,wBAAoB,MAAM;MACzB,EAAE;;IAUX,CAAC,gBAAgB,CAClB;AAED,QAAO;EAEL;EACA;EACA;EACA;EACA;EACA;EACA;EAEA,GAAG;EACJ"}
|
|
@@ -19,6 +19,8 @@ interface UseWatchUserChangeOptions<TFieldValues extends FieldValues> {
|
|
|
19
19
|
*
|
|
20
20
|
* Only triggers on manual user input (typing, clicking, selecting),
|
|
21
21
|
* NOT on programmatic changes like form.reset() or form.setValue().
|
|
22
|
+
* Also does NOT trigger when selecting the same value (e.g., clicking
|
|
23
|
+
* an already-selected option in a Select).
|
|
22
24
|
*
|
|
23
25
|
* This hook subscribes to field changes at the source (useController),
|
|
24
26
|
* ensuring immediate and accurate detection of user interactions.
|
|
@@ -75,4 +77,4 @@ declare const useWatchUserChange: <TFieldValues extends FieldValues = FieldValue
|
|
|
75
77
|
}: UseWatchUserChangeOptions<TFieldValues>) => void;
|
|
76
78
|
//#endregion
|
|
77
79
|
export { useWatchUserChange as n, UseWatchUserChangeOptions as t };
|
|
78
|
-
//# sourceMappingURL=useWatchUserChange-
|
|
80
|
+
//# sourceMappingURL=useWatchUserChange-DahNCPDG.d.cts.map
|
package/dist/{useWatchUserChange-COVdHmki.d.cts.map → useWatchUserChange-DahNCPDG.d.cts.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWatchUserChange-
|
|
1
|
+
{"version":3,"file":"useWatchUserChange-DahNCPDG.d.cts","names":[],"sources":["../src/hooks/useWatchUserChange/useWatchUserChange.ts"],"sourcesContent":[],"mappings":";;;UAYiB,+CAA+C;;EAA/C,KAAA,EAER,IAFQ,CAEH,YAFG,CAAA;EAA+C;;;;EAUhD,QAAA,EAAA,CAAA,KAAA,EAAA,OAAA,EAAA,OAAA,EAAA;IACoB,QAAA,EADpB,eACoB,CADJ,YACI,CAAA;IAAlB,UAAA,EAAA,iBAAA,CAAkB,YAAlB,CAAA;IACQ,KAAA,EAAb,YAAa,CAAA,YAAA,CAAA;EAAb,CAAA,EAAA,GAAA,IAAA;;AA8Db;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAa,0CACU,cAAc;SACnC;;GAGC,0BAA0B"}
|
|
@@ -7,6 +7,8 @@ import { useEffect } from "react";
|
|
|
7
7
|
*
|
|
8
8
|
* Only triggers on manual user input (typing, clicking, selecting),
|
|
9
9
|
* NOT on programmatic changes like form.reset() or form.setValue().
|
|
10
|
+
* Also does NOT trigger when selecting the same value (e.g., clicking
|
|
11
|
+
* an already-selected option in a Select).
|
|
10
12
|
*
|
|
11
13
|
* This hook subscribes to field changes at the source (useController),
|
|
12
14
|
* ensuring immediate and accurate detection of user interactions.
|
|
@@ -80,4 +82,4 @@ const useWatchUserChange = ({ watch: watchField, onChange }) => {
|
|
|
80
82
|
|
|
81
83
|
//#endregion
|
|
82
84
|
export { useWatchUserChange as t };
|
|
83
|
-
//# sourceMappingURL=useWatchUserChange-
|
|
85
|
+
//# sourceMappingURL=useWatchUserChange-DyhUYlrN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWatchUserChange-DyhUYlrN.js","names":[],"sources":["../src/hooks/useWatchUserChange/useWatchUserChange.ts"],"sourcesContent":["import type {\n FieldValues,\n Path,\n UseFormReset,\n UseFormResetField,\n UseFormSetValue,\n} from 'react-hook-form';\n\nimport { useEffect } from 'react';\n\nimport { useFormContext } from '../useFormContext/useFormContext';\n\nexport interface UseWatchUserChangeOptions<TFieldValues extends FieldValues> {\n /** Field name to watch for user changes */\n watch: Path<TFieldValues>;\n /**\n * Callback when watched field is changed by user input.\n * Receives the new value and form helpers (setValue, resetField, reset).\n */\n onChange: (\n value: unknown,\n helpers: {\n setValue: UseFormSetValue<TFieldValues>;\n resetField: UseFormResetField<TFieldValues>;\n reset: UseFormReset<TFieldValues>;\n },\n ) => void;\n}\n\n/**\n * Hook that watches for user changes on a specific form field.\n *\n * Only triggers on manual user input (typing, clicking, selecting),\n * NOT on programmatic changes like form.reset() or form.setValue().\n * Also does NOT trigger when selecting the same value (e.g., clicking\n * an already-selected option in a Select).\n *\n * This hook subscribes to field changes at the source (useController),\n * ensuring immediate and accurate detection of user interactions.\n *\n * Use cases:\n * - Reset dependent fields when parent field changes\n * - Set mode-specific default values when a toggle changes\n * - Clear form sections based on user selections\n * - Trigger side effects only on user interaction\n *\n * Note: To watch multiple fields, call this hook multiple times.\n *\n * @example\n * ```tsx\n * // Reset city and address when user changes country\n * useWatchUserChange({\n * watch: 'country',\n * onChange: (value, { resetField }) => {\n * resetField('city');\n * resetField('address');\n * },\n * });\n *\n * // Set defaults when user changes payment method\n * useWatchUserChange({\n * watch: 'paymentMethod',\n * onChange: (value, { setValue }) => {\n * if (value === 'credit') {\n * setValue('installments', 3);\n * } else {\n * setValue('installments', 1);\n * }\n * },\n * });\n *\n * // Watch multiple fields by calling the hook multiple times\n * useWatchUserChange({\n * watch: 'category',\n * onChange: (value, { resetField }) => {\n * resetField('productId');\n * },\n * });\n * useWatchUserChange({\n * watch: 'brand',\n * onChange: (value, { resetField }) => {\n * resetField('productId');\n * },\n * });\n * ```\n */\nexport const useWatchUserChange = <\n TFieldValues extends FieldValues = FieldValues,\n>({\n watch: watchField,\n onChange,\n}: UseWatchUserChangeOptions<TFieldValues>) => {\n const { setValue, resetField, reset, userChange } =\n useFormContext<TFieldValues>();\n\n useEffect(() => {\n // Create listener that checks if changed field is the one we're watching\n const listener = (fieldName: Path<TFieldValues>, value: unknown) => {\n // Check if this is the field we're watching\n if (fieldName === watchField) {\n // Call the onChange callback with helpers\n onChange(value, { setValue, resetField, reset });\n }\n };\n\n // Subscribe to user changes\n const unsubscribe = userChange.subscribe(listener);\n\n // Cleanup on unmount\n return unsubscribe;\n }, [watchField, onChange, setValue, resetField, reset, userChange]);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsFA,MAAa,sBAEX,EACA,OAAO,YACP,eAC6C;CAC7C,MAAM,EAAE,UAAU,YAAY,OAAO,eACnC,gBAA8B;AAEhC,iBAAgB;EAEd,MAAM,YAAY,WAA+B,UAAmB;AAElE,OAAI,cAAc,WAEhB,UAAS,OAAO;IAAE;IAAU;IAAY;IAAO,CAAC;;AAQpD,SAHoB,WAAW,UAAU,SAAS;IAIjD;EAAC;EAAY;EAAU;EAAU;EAAY;EAAO;EAAW,CAAC"}
|
|
@@ -19,6 +19,8 @@ interface UseWatchUserChangeOptions<TFieldValues extends FieldValues> {
|
|
|
19
19
|
*
|
|
20
20
|
* Only triggers on manual user input (typing, clicking, selecting),
|
|
21
21
|
* NOT on programmatic changes like form.reset() or form.setValue().
|
|
22
|
+
* Also does NOT trigger when selecting the same value (e.g., clicking
|
|
23
|
+
* an already-selected option in a Select).
|
|
22
24
|
*
|
|
23
25
|
* This hook subscribes to field changes at the source (useController),
|
|
24
26
|
* ensuring immediate and accurate detection of user interactions.
|
|
@@ -75,4 +77,4 @@ declare const useWatchUserChange: <TFieldValues extends FieldValues = FieldValue
|
|
|
75
77
|
}: UseWatchUserChangeOptions<TFieldValues>) => void;
|
|
76
78
|
//#endregion
|
|
77
79
|
export { useWatchUserChange as n, UseWatchUserChangeOptions as t };
|
|
78
|
-
//# sourceMappingURL=useWatchUserChange-
|
|
80
|
+
//# sourceMappingURL=useWatchUserChange-JMU-vN92.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWatchUserChange-
|
|
1
|
+
{"version":3,"file":"useWatchUserChange-JMU-vN92.d.ts","names":[],"sources":["../src/hooks/useWatchUserChange/useWatchUserChange.ts"],"sourcesContent":[],"mappings":";;;UAYiB,+CAA+C;;EAA/C,KAAA,EAER,IAFQ,CAEH,YAFG,CAAA;EAA+C;;;;EAUhD,QAAA,EAAA,CAAA,KAAA,EAAA,OAAA,EAAA,OAAA,EAAA;IACoB,QAAA,EADpB,eACoB,CADJ,YACI,CAAA;IAAlB,UAAA,EAAA,iBAAA,CAAkB,YAAlB,CAAA;IACQ,KAAA,EAAb,YAAa,CAAA,YAAA,CAAA;EAAb,CAAA,EAAA,GAAA,IAAA;;AA8Db;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAa,0CACU,cAAc;SACnC;;GAGC,0BAA0B"}
|
|
@@ -8,6 +8,8 @@ let react = require("react");
|
|
|
8
8
|
*
|
|
9
9
|
* Only triggers on manual user input (typing, clicking, selecting),
|
|
10
10
|
* NOT on programmatic changes like form.reset() or form.setValue().
|
|
11
|
+
* Also does NOT trigger when selecting the same value (e.g., clicking
|
|
12
|
+
* an already-selected option in a Select).
|
|
11
13
|
*
|
|
12
14
|
* This hook subscribes to field changes at the source (useController),
|
|
13
15
|
* ensuring immediate and accurate detection of user interactions.
|
|
@@ -86,4 +88,4 @@ Object.defineProperty(exports, 'useWatchUserChange', {
|
|
|
86
88
|
return useWatchUserChange;
|
|
87
89
|
}
|
|
88
90
|
});
|
|
89
|
-
//# sourceMappingURL=useWatchUserChange-
|
|
91
|
+
//# sourceMappingURL=useWatchUserChange-jivI5KIB.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWatchUserChange-jivI5KIB.cjs","names":["useFormContext"],"sources":["../src/hooks/useWatchUserChange/useWatchUserChange.ts"],"sourcesContent":["import type {\n FieldValues,\n Path,\n UseFormReset,\n UseFormResetField,\n UseFormSetValue,\n} from 'react-hook-form';\n\nimport { useEffect } from 'react';\n\nimport { useFormContext } from '../useFormContext/useFormContext';\n\nexport interface UseWatchUserChangeOptions<TFieldValues extends FieldValues> {\n /** Field name to watch for user changes */\n watch: Path<TFieldValues>;\n /**\n * Callback when watched field is changed by user input.\n * Receives the new value and form helpers (setValue, resetField, reset).\n */\n onChange: (\n value: unknown,\n helpers: {\n setValue: UseFormSetValue<TFieldValues>;\n resetField: UseFormResetField<TFieldValues>;\n reset: UseFormReset<TFieldValues>;\n },\n ) => void;\n}\n\n/**\n * Hook that watches for user changes on a specific form field.\n *\n * Only triggers on manual user input (typing, clicking, selecting),\n * NOT on programmatic changes like form.reset() or form.setValue().\n * Also does NOT trigger when selecting the same value (e.g., clicking\n * an already-selected option in a Select).\n *\n * This hook subscribes to field changes at the source (useController),\n * ensuring immediate and accurate detection of user interactions.\n *\n * Use cases:\n * - Reset dependent fields when parent field changes\n * - Set mode-specific default values when a toggle changes\n * - Clear form sections based on user selections\n * - Trigger side effects only on user interaction\n *\n * Note: To watch multiple fields, call this hook multiple times.\n *\n * @example\n * ```tsx\n * // Reset city and address when user changes country\n * useWatchUserChange({\n * watch: 'country',\n * onChange: (value, { resetField }) => {\n * resetField('city');\n * resetField('address');\n * },\n * });\n *\n * // Set defaults when user changes payment method\n * useWatchUserChange({\n * watch: 'paymentMethod',\n * onChange: (value, { setValue }) => {\n * if (value === 'credit') {\n * setValue('installments', 3);\n * } else {\n * setValue('installments', 1);\n * }\n * },\n * });\n *\n * // Watch multiple fields by calling the hook multiple times\n * useWatchUserChange({\n * watch: 'category',\n * onChange: (value, { resetField }) => {\n * resetField('productId');\n * },\n * });\n * useWatchUserChange({\n * watch: 'brand',\n * onChange: (value, { resetField }) => {\n * resetField('productId');\n * },\n * });\n * ```\n */\nexport const useWatchUserChange = <\n TFieldValues extends FieldValues = FieldValues,\n>({\n watch: watchField,\n onChange,\n}: UseWatchUserChangeOptions<TFieldValues>) => {\n const { setValue, resetField, reset, userChange } =\n useFormContext<TFieldValues>();\n\n useEffect(() => {\n // Create listener that checks if changed field is the one we're watching\n const listener = (fieldName: Path<TFieldValues>, value: unknown) => {\n // Check if this is the field we're watching\n if (fieldName === watchField) {\n // Call the onChange callback with helpers\n onChange(value, { setValue, resetField, reset });\n }\n };\n\n // Subscribe to user changes\n const unsubscribe = userChange.subscribe(listener);\n\n // Cleanup on unmount\n return unsubscribe;\n }, [watchField, onChange, setValue, resetField, reset, userChange]);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsFA,MAAa,sBAEX,EACA,OAAO,YACP,eAC6C;CAC7C,MAAM,EAAE,UAAU,YAAY,OAAO,eACnCA,uCAA8B;AAEhC,4BAAgB;EAEd,MAAM,YAAY,WAA+B,UAAmB;AAElE,OAAI,cAAc,WAEhB,UAAS,OAAO;IAAE;IAAU;IAAY;IAAO,CAAC;;AAQpD,SAHoB,WAAW,UAAU,SAAS;IAIjD;EAAC;EAAY;EAAU;EAAU;EAAY;EAAO;EAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fuf-stack/uniform",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.0",
|
|
4
4
|
"description": "fuf react form library",
|
|
5
5
|
"author": "Fröhlich ∧ Frei",
|
|
6
6
|
"homepage": "https://github.com/fuf-stack/pixels#readme",
|
|
@@ -181,5 +181,5 @@
|
|
|
181
181
|
"react": "19.2.3",
|
|
182
182
|
"react-dom": "19.2.3"
|
|
183
183
|
},
|
|
184
|
-
"gitHead": "
|
|
184
|
+
"gitHead": "fa9efd9affa263c0e08601cd349d955bc16a8605"
|
|
185
185
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FieldArray-CWxV0Q6O.cjs","names":["Button","FaPlus","FaCopy","VscInsert","FaTimes","Menu","Button","FaTimes","motion","FaGripVertical","CSS","AnimatePresence","motion","SortDragHandle","Grid","ElementActionsMenu","ElementRemoveButton","useUniformField","useUniformField","AnimatePresence","motion","FieldValidationError","PointerSensor","KeyboardSensor","DndContext","closestCenter","restrictToVerticalAxis","restrictToWindowEdges","SortableContext","verticalListSortingStrategy","useUniformFieldArray","FieldArrayLabel","SortContext","flatArrayKey","FieldArrayElement","FieldArrayValidationError","ElementAppendButton","FieldArray"],"sources":["../src/FieldArray/subcomponents/ElementAppendButton.tsx","../src/FieldArray/subcomponents/ElementActionsMenu.tsx","../src/FieldArray/subcomponents/ElementRemoveButton.tsx","../src/FieldArray/subcomponents/SortDragHandle.tsx","../src/FieldArray/subcomponents/FieldArrayElement.tsx","../src/FieldArray/subcomponents/FieldArrayLabel.tsx","../src/FieldArray/subcomponents/FieldArrayValidationError.tsx","../src/FieldArray/subcomponents/SortContext.tsx","../src/FieldArray/FieldArray.tsx","../src/FieldArray/index.ts"],"sourcesContent":["import type { ClassValue } from '@fuf-stack/pixel-utils';\n\nimport { FaPlus } from 'react-icons/fa';\n\nimport { cn } from '@fuf-stack/pixel-utils';\nimport { Button } from '@fuf-stack/pixels';\n\ninterface ElementAppendButtonProps {\n /** text of the append element button */\n appendButtonText?: string;\n /** CSS class name */\n className?: ClassValue;\n /** click handler */\n onClick: () => void;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n}\n\nconst ElementAppendButton = ({\n appendButtonText = 'Add Element',\n className = undefined,\n onClick,\n testId = undefined,\n}: ElementAppendButtonProps) => {\n return (\n <Button\n disableAnimation\n className={cn(className)}\n onClick={onClick}\n size=\"sm\"\n testId={testId}\n variant=\"light\"\n >\n <FaPlus />\n <span>{appendButtonText}</span>\n </Button>\n );\n};\n\nexport default ElementAppendButton;\n","import type { ClassValue } from '@fuf-stack/pixel-utils';\nimport type { MenuItem } from '@fuf-stack/pixels';\nimport type { Key } from 'react';\nimport type { FieldArrayElementMethods } from './FieldArrayElement';\n\nimport { FaCopy, FaTimes } from 'react-icons/fa';\nimport { VscInsert } from 'react-icons/vsc';\n\nimport { cn } from '@fuf-stack/pixel-utils';\nimport { Menu } from '@fuf-stack/pixels';\n\nexport interface ElementActionsMenuProps {\n /** CSS class name */\n className?: ClassValue;\n /** Whether duplicate action is available */\n duplicate?: boolean;\n /** Whether insert after action is available */\n insertAfter?: boolean;\n /** Whether to show remove button (false when last element is not deletable) */\n showRemove?: boolean;\n /** Field array operation methods */\n methods: FieldArrayElementMethods;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n}\n\n/**\n * Menu component for field array element actions (remove, duplicate, insert after)\n */\nconst ElementActionsMenu = ({\n className = undefined,\n duplicate = false,\n insertAfter = false,\n showRemove = true,\n methods,\n testId = undefined,\n}: ElementActionsMenuProps) => {\n const handleAction = (key: Key) => {\n switch (key) {\n case 'remove':\n methods.remove();\n break;\n case 'duplicate':\n methods.duplicate();\n break;\n case 'insertAfter':\n methods.insert();\n break;\n default:\n break;\n }\n };\n\n // Build menu items based on available actions\n const menuItems: MenuItem[] = [];\n\n if (duplicate) {\n menuItems.push({\n key: 'duplicate',\n label: 'Duplicate',\n icon: <FaCopy />,\n });\n }\n\n if (insertAfter) {\n menuItems.push({\n key: 'insertAfter',\n label: 'Insert After',\n icon: <VscInsert />,\n });\n }\n\n if (showRemove) {\n menuItems.push({\n key: 'remove',\n className: 'text-danger',\n label: 'Remove',\n icon: <FaTimes />,\n });\n }\n\n return (\n <Menu\n ariaLabel=\"Element actions\"\n items={menuItems}\n onAction={handleAction}\n placement=\"right\"\n testId={testId}\n triggerButtonProps={{\n className: cn(className),\n disableRipple: true,\n size: 'md',\n variant: 'light',\n }}\n />\n );\n};\n\nexport default ElementActionsMenu;\n","import type { ClassValue } from '@fuf-stack/pixel-utils';\n\nimport { FaTimes } from 'react-icons/fa';\n\nimport { motion } from '@fuf-stack/pixel-motion';\nimport { cn } from '@fuf-stack/pixel-utils';\nimport { Button } from '@fuf-stack/pixels';\n\ninterface ElementRemoveButtonProps {\n /** CSS class name */\n className?: ClassValue;\n /** Globally disable animations (used for first render or prefers-reduced-motion) */\n disableAnimation?: boolean;\n /** click handler */\n onClick: () => void;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n}\n\nconst ElementRemoveButton = ({\n className = undefined,\n disableAnimation = false,\n onClick,\n testId = undefined,\n}: ElementRemoveButtonProps) => {\n const button = (\n <Button\n ariaLabel=\"remove element\"\n className={cn(className)}\n color=\"danger\"\n icon={<FaTimes />}\n onClick={onClick}\n size=\"sm\"\n testId={testId}\n variant=\"light\"\n />\n );\n\n if (disableAnimation) {\n return button;\n }\n\n return (\n <motion.div\n animate={{ opacity: 1, width: 'auto' }}\n className=\"flex\"\n exit={{ opacity: 0, width: 0 }}\n initial={{ opacity: 0, width: 0 }}\n transition={{ duration: 0.2 }}\n >\n {button}\n </motion.div>\n );\n};\n\nexport default ElementRemoveButton;\n","import type { ClassValue } from '@fuf-stack/pixel-utils';\n\nimport { FaGripVertical } from 'react-icons/fa';\n\nimport { useSortable } from '@dnd-kit/sortable';\n\nimport { cn } from '@fuf-stack/pixel-utils';\n\ninterface SortDragHandleProps {\n /** Optional CSS class name */\n className?: ClassValue;\n /** Unique identifier for sortable item */\n id: string | number;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n}\n\n/**\n * Drag handle component that integrates with dnd-kit sortable functionality.\n * Renders a vertical grip icon that can be used to reorder items.\n */\nconst SortDragHandle = ({\n className = undefined,\n id,\n testId = undefined,\n}: SortDragHandleProps) => {\n // Get dnd-kit sortable attributes and listeners\n const { attributes, listeners } = useSortable({ id });\n\n return (\n <div\n className={cn(className)}\n data-testid={testId}\n {...attributes}\n {...listeners}\n >\n <FaGripVertical />\n </div>\n );\n};\n\nexport default SortDragHandle;\n","import type { Variants as MotionVariants } from '@fuf-stack/pixel-motion';\nimport type { ClassValue } from '@fuf-stack/pixel-utils';\nimport type { FieldArrayFeatures } from '../types';\n\nimport { useState } from 'react';\n\nimport { useSortable } from '@dnd-kit/sortable';\nimport { CSS } from '@dnd-kit/utilities';\n\nimport { AnimatePresence, motion } from '@fuf-stack/pixel-motion';\nimport { cn } from '@fuf-stack/pixel-utils';\n\nimport { Grid } from '../../Grid';\nimport ElementActionsMenu from './ElementActionsMenu';\nimport ElementRemoveButton from './ElementRemoveButton';\nimport SortDragHandle from './SortDragHandle';\n\nexport interface FieldArrayElementMethods {\n /** Add new element at end */\n append: () => void;\n /** Clone current element */\n duplicate: () => void;\n /** Add new element after current */\n insert: () => void;\n /** Remove current element */\n remove: () => void;\n}\n\ninterface FieldArrayElementProps extends FieldArrayFeatures {\n /** Form elements to render inside array element */\n children: React.ReactNode;\n /** CSS class names for component parts */\n className: {\n /** Class of wrapper grid inside the li that wraps the rendered element fields directly */\n elementFieldsGrid?: ClassValue;\n /** Class for the li (performs motion animations) */\n listItem?: ClassValue;\n /** Class for the li inner div (wraps the rendered element fields) */\n listItemInner?: ClassValue;\n /** Class for the actions menu button */\n actionsMenuButton?: ClassValue;\n /** Class for the remove element button (when menu is not used) */\n removeButton?: ClassValue;\n /** Class for the drag handle when sorting enabled */\n sortDragHandle?: ClassValue;\n };\n /** Globally disable animations for this item (used for first render or prefers-reduced-motion) */\n disableAnimation?: boolean;\n /** Bottom margin for elements (for backwards compatibility) */\n elementMarginBottom?: React.CSSProperties['marginBottom'];\n /** All fields in the form array */\n fields: Record<'id', string>[];\n /** Unique identifier for drag/drop */\n id: string | number;\n /** Field index in array */\n index: number;\n /** Prevent deletion of last remaining element */\n lastNotDeletable?: boolean;\n /** Field array operation methods */\n methods: FieldArrayElementMethods;\n /** HTML data-testid of the element */\n testId?: string;\n}\n\n/**\n * Form array element component using react-hook-form with drag-drop sorting\n * and validation capabilities. Animations when elements are added or removed\n * improve the user experience and provide a better visual feedback.\n */\nconst FieldArrayElement = ({\n children,\n className,\n disableAnimation = false,\n duplicate = false,\n elementMarginBottom: _elementMarginBottom = undefined,\n fields,\n id,\n index: _index,\n insertAfter = false,\n lastNotDeletable = true,\n methods,\n sortable = false,\n testId = undefined,\n}: FieldArrayElementProps) => {\n // Apply transform styles when sortable is enabled for smooth drag animations\n // transform: handles the item's position during drag\n // transition: controls the animation timing when dropping\n const { setNodeRef, transform, transition, isDragging } = useSortable({ id });\n const sortingStyle = sortable\n ? {\n transform: CSS.Translate.toString(transform),\n transition,\n zIndex: isDragging ? 50 : undefined,\n }\n : undefined;\n\n // Local visibility to allow exit animation before removing from RHF state\n const [isVisible, setIsVisible] = useState(true);\n\n // Motion variants for the list item\n const listItemMotionVariants: MotionVariants = {\n hidden: { opacity: 0, height: 0, marginBottom: 0 },\n visible: {\n opacity: 1,\n height: 'auto',\n transition: { duration: 0.2, ease: 'circOut' },\n // push last visible item down to overlap with append button (hide double border)\n marginBottom: '-1px',\n },\n exit: {\n opacity: 0,\n height: 0,\n marginBottom: 0,\n transition: {\n // on exit first fade out, then shrink\n opacity: { duration: 0.1, ease: 'circOut' },\n height: { delay: 0.1, duration: 0.2, ease: 'circOut' },\n },\n },\n };\n\n // Height animation handled on <motion.li> using overflow hidden\n return (\n <AnimatePresence\n mode=\"wait\"\n // remove from RHF state after exit animation\n onExitComplete={() => {\n methods.remove();\n }}\n >\n {isVisible ? (\n <motion.li\n key={id}\n ref={setNodeRef}\n animate={disableAnimation ? undefined : 'visible'}\n className={cn(className.listItem)}\n data-dragging={isDragging}\n data-testid={`${testId}_element`}\n exit={disableAnimation ? undefined : 'exit'}\n initial={disableAnimation ? false : 'hidden'}\n style={sortingStyle}\n variants={disableAnimation ? undefined : listItemMotionVariants}\n >\n <div className={cn(className.listItemInner)}>\n {/** sorting drag handle */}\n {sortable ? (\n <SortDragHandle\n className={className.sortDragHandle}\n id={id}\n testId={`${testId}_sort_drag_handle`}\n />\n ) : null}\n\n {/** render element fields in Grid component */}\n <Grid\n className={cn(className.elementFieldsGrid)}\n testId={`${testId}_element_fields_grid`}\n >\n {/* render actual fields */}\n {children}\n </Grid>\n\n {/** actions menu when duplicate or insertAfter is enabled */}\n {duplicate || insertAfter ? (\n <ElementActionsMenu\n className={className.actionsMenuButton}\n duplicate={duplicate}\n insertAfter={insertAfter}\n showRemove={!(lastNotDeletable && fields.length === 1)}\n testId={`${testId}_actions_menu`}\n methods={{\n ...methods,\n remove: () => {\n if (disableAnimation) {\n methods.remove();\n } else {\n setIsVisible(false);\n }\n },\n }}\n />\n ) : (\n <>\n {/** remove element button (when menu is not used) */}\n <AnimatePresence initial={false}>\n {lastNotDeletable && fields.length === 1 ? null : (\n <ElementRemoveButton\n key=\"remove-button\"\n className={className.removeButton}\n disableAnimation={disableAnimation}\n testId={`${testId}_remove_button`}\n onClick={() => {\n if (disableAnimation) {\n methods.remove();\n } else {\n setIsVisible(false);\n }\n }}\n />\n )}\n </AnimatePresence>\n </>\n )}\n </div>\n </motion.li>\n ) : null}\n </AnimatePresence>\n );\n};\n\nexport default FieldArrayElement;\n","import type { ReactNode } from 'react';\n\nimport { cn } from '@fuf-stack/pixel-utils';\n\nimport { useUniformField } from '../../hooks/useUniformField';\n\nexport interface FieldArrayLabelProps {\n /** CSS class name */\n className?: string;\n /** Label content */\n label: ReactNode;\n /** Field name */\n name: string;\n}\n\n/**\n * Renders the label for a FieldArray component.\n *\n * This component handles displaying the array label with proper accessibility\n * attributes using the label props from useUniformField.\n */\nconst FieldArrayLabel = ({\n className = undefined,\n label: _label,\n name,\n}: FieldArrayLabelProps) => {\n const { error, getLabelProps, invalid, label } = useUniformField({\n name,\n label: _label,\n });\n\n // when no label is provided, don't render anything\n if (!_label) {\n return null;\n }\n\n // @ts-expect-error - error._errors exists but not typed\n const hasErrors = invalid && error?._errors;\n\n return (\n <div\n {...getLabelProps()}\n aria-level={3}\n role=\"heading\"\n className={cn(getLabelProps()?.className, className, {\n // when there are no array level errors, the label should have foreground color\n 'text-foreground!': !hasErrors,\n })}\n >\n {label}\n </div>\n );\n};\n\nexport default FieldArrayLabel;\n","import {\n AnimatePresence,\n motion,\n useReducedMotion,\n} from '@fuf-stack/pixel-motion';\nimport { cn } from '@fuf-stack/pixel-utils';\n\nimport { useUniformField } from '../../hooks/useUniformField';\nimport FieldValidationError from '../../partials/FieldValidationError/FieldValidationError';\n\nexport interface FieldArrayValidationErrorProps {\n /** Field name */\n name: string;\n}\n\n/**\n * Renders array-level validation errors for FieldArray.\n *\n * This component handles validation errors that apply to the entire array\n * (e.g., \"Array must contain at least 3 elements\", \"Array elements are not unique\"),\n * as opposed to field-level errors which apply to individual array elements.\n *\n * The component wraps errors in the proper accessibility markup and animates\n * them in/out using Framer Motion when they appear or are resolved.\n */\nconst FieldArrayValidationError = ({\n name,\n}: FieldArrayValidationErrorProps) => {\n const {\n error,\n getErrorMessageProps,\n getHelperWrapperProps,\n invalid,\n testId,\n } = useUniformField({\n name,\n });\n\n // disable all animation if user prefers reduced motion\n const disableAnimation = useReducedMotion();\n\n // @ts-expect-error - error._errors exists but not typed\n const hasErrors = invalid && error?._errors;\n\n return (\n <AnimatePresence initial={!disableAnimation}>\n {hasErrors ? (\n <motion.div\n key=\"field-array-errors\"\n exit={disableAnimation ? undefined : { opacity: 0, height: 0 }}\n initial={disableAnimation ? false : { height: 0, opacity: 0 }}\n style={{ overflow: 'hidden' }}\n transition={{ duration: 0.2, ease: 'circOut' }}\n animate={\n disableAnimation ? undefined : { opacity: 1, height: 'auto' }\n }\n >\n <div\n {...getHelperWrapperProps()}\n className={cn(\n getHelperWrapperProps()?.className,\n // force helper to be visible (for some reason it's hidden by default) and add padding\n 'block px-3 py-2',\n )}\n >\n <div {...getErrorMessageProps()}>\n <FieldValidationError\n // @ts-expect-error - error._errors exists but not typed\n error={error._errors}\n testId={testId}\n />\n </div>\n </div>\n </motion.div>\n ) : null}\n </AnimatePresence>\n );\n};\n\nexport default FieldArrayValidationError;\n","import type { DragEndEvent } from '@dnd-kit/core';\nimport type { ReactNode } from 'react';\nimport type { UseFieldArrayMove } from 'react-hook-form';\n\nimport { useFormContext } from 'react-hook-form';\n\nimport {\n closestCenter,\n DndContext,\n KeyboardSensor,\n PointerSensor,\n useSensor,\n useSensors,\n} from '@dnd-kit/core';\nimport {\n restrictToVerticalAxis,\n restrictToWindowEdges,\n} from '@dnd-kit/modifiers';\nimport {\n SortableContext,\n verticalListSortingStrategy,\n} from '@dnd-kit/sortable';\n\ninterface SortContextProps {\n /** child components */\n children: ReactNode;\n /** Array of objects containing unique IDs for sortable items */\n fields: Record<'id', string>[];\n /** name of the field array */\n name: string;\n /** react-hook-form's move function to update field array indices */\n move: UseFieldArrayMove;\n /** enable/disable sorting functionality */\n sortable: boolean;\n}\n\n/**\n * A wrapper component that provides drag-and-drop sorting functionality for field arrays\n * using dnd-kit and react-hook-form.\n *\n * This component integrates with react-hook-form's field arrays to enable vertical\n * drag-and-drop reordering of form fields. It supports both pointer (mouse/touch)\n * and keyboard interactions for accessibility.\n */\nconst SortContext = ({\n children,\n fields,\n move,\n name,\n sortable,\n}: SortContextProps): ReactNode => {\n const { trigger } = useFormContext();\n\n // Initialize sensors for both pointer (mouse/touch) and keyboard interactions\n const sensors = useSensors(\n useSensor(PointerSensor),\n useSensor(KeyboardSensor),\n );\n\n // Early return if sorting is disabled\n if (!sortable) {\n return children;\n }\n\n /**\n * Handles the end of a drag operation by updating field positions\n * @param event - The drag end event containing active and over elements\n */\n const handleDragEnd = (event: DragEndEvent) => {\n const { active, over } = event;\n\n // Only move if dropping over a different item\n if (active.id !== over?.id) {\n // Find the indices of the dragged item and drop target\n const oldIndex = fields.findIndex((field) => {\n return field.id === active.id;\n });\n const newIndex = fields.findIndex((field) => {\n return field.id === over?.id;\n });\n // Update the field array order using react-hook-form's move function\n move(oldIndex, newIndex);\n\n // Finally trigger validation for the array field,\n // so validation errors are updated for the new order\n trigger(name);\n }\n };\n\n return (\n <DndContext\n collisionDetection={closestCenter}\n modifiers={[restrictToVerticalAxis, restrictToWindowEdges]}\n onDragEnd={handleDragEnd}\n sensors={sensors}\n >\n <SortableContext\n strategy={verticalListSortingStrategy}\n items={fields.map((field) => {\n return field.id;\n })}\n >\n {children}\n </SortableContext>\n </DndContext>\n );\n};\n\nexport default SortContext;\n","import type { FieldArrayElementMethods } from './subcomponents/FieldArrayElement';\nimport type { FieldArrayProps } from './types';\n\nimport { cn, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { flatArrayKey } from '../helpers';\nimport { useUniformFieldArray } from '../hooks/useUniformFieldArray';\nimport ElementAppendButton from './subcomponents/ElementAppendButton';\nimport FieldArrayElement from './subcomponents/FieldArrayElement';\nimport FieldArrayLabel from './subcomponents/FieldArrayLabel';\nimport FieldArrayValidationError from './subcomponents/FieldArrayValidationError';\nimport SortContext from './subcomponents/SortContext';\n\nexport const fieldArrayVariants = tv({\n slots: {\n /** base class for the field array wrapper */\n base: [\n // base styles\n 'overflow-hidden rounded-small border border-divider bg-content1',\n // divider between items\n 'divide-y divide-divider',\n ],\n /** class for the actions menu button */\n actionsMenuButton: [\n // base styles\n 'flex items-center justify-center text-default-600',\n // fixed height/no round corners/center align\n 'h-full rounded-none',\n // focus styles - inset ring\n 'outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus',\n ],\n /** class for the append button */\n appendButton: [\n // base styles\n 'w-full justify-start rounded-b-small rounded-t-none font-semibold',\n // match label height (p-3 = 12px vertical padding + text-base line height)\n '!h-[48px] !min-h-0',\n // focus styles - inset ring with rounded bottom corners to match container\n 'outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus',\n ],\n /** class for the element fields grid */\n elementFieldsGrid: ['w-full grow p-3'],\n /** class for the label */\n label: [\n // override HeroUI label positioning and display\n 'pointer-events-auto! static! z-auto! block! w-full!',\n // reset any transforms or translations\n 'translate-x-0! translate-y-0! transform-none!',\n // card header styling - use text-medium (16px) instead of text-base for correct 48px height\n 'rounded-t-small p-3 font-semibold text-medium',\n ],\n /** class for the list */\n list: ['overflow-hidden'],\n /** class for the list wrapper */\n listWrapper: ['overflow-hidden'],\n /** class for the list item (performs motion animations) */\n listItem: [\n // base styles\n 'group relative flex flex-row',\n // overlap borders by shifting first item up 1px (similar to how last item overlaps with append button)\n 'first:-mt-px',\n ],\n /** class for the list item inner */\n listItemInner: [\n // base styles\n 'flex w-full flex-row items-stretch divide-divider bg-content1',\n // x division and borders\n 'divide-x divide-solid border-b border-t border-divider',\n ],\n /** class for the remove button */\n removeButton: [\n // base styles\n 'flex items-center justify-center',\n // fixed height/no round corners\n '!h-full !min-h-0 !rounded-none px-3',\n // focus styles - inset ring\n 'outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus',\n ],\n /** class for the sort drag handle */\n sortDragHandle: [\n // base styles\n 'flex cursor-grab items-center justify-center px-2 text-default-600 transition-colors',\n // hover and dragging state\n 'hover:bg-default-100 active:cursor-grabbing group-data-[dragging=true]:bg-default-100',\n // focus styles - inset ring\n 'outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus',\n ],\n },\n variants: {\n hasLabel: {\n false: {\n // focus styles - when there is no label, the first item actions menu button should have rounded top right corners\n actionsMenuButton:\n 'group-[:first-child]:!rounded-tr-small group-[:first-child]:group-data-[dragging=true]:!rounded-tr-none',\n // focus styles - when there is no label, the first item remove button focus ring should have rounded top right corners\n removeButton:\n 'group-[:first-child]:!rounded-tr-small group-[:first-child]:group-data-[dragging=true]:!rounded-tr-none',\n // focus styles - when there is no label, the first item sort drag handle focus ring should have rounded top left corners\n sortDragHandle:\n 'group-[:first-child]:rounded-tl-small group-[:first-child]:group-data-[dragging=true]:rounded-tl-none',\n },\n },\n },\n});\n\n/**\n * FieldArray component based in [RHF useFieldArray](https://react-hook-form.com/docs/usefieldarray)\n */\nconst FieldArray = ({\n appendButtonText = 'Add Element',\n children,\n className: _className = undefined,\n duplicate = false,\n elementInitialValue: _elementInitialValue = null,\n elementMarginBottom = undefined,\n flat = false,\n insertAfter = false,\n lastElementNotRemovable = false,\n name,\n sortable = false,\n ...uniformFieldProps\n}: FieldArrayProps) => {\n const {\n fields,\n append,\n remove,\n insert,\n move,\n disableAnimation,\n elementInitialValue,\n getValues,\n testId,\n } = useUniformFieldArray({\n name,\n flat,\n elementInitialValue: _elementInitialValue,\n lastElementNotRemovable,\n ...uniformFieldProps,\n });\n\n // className from slots\n const variants = fieldArrayVariants({ hasLabel: !!uniformFieldProps.label });\n const className = variantsToClassNames(variants, _className, 'base');\n\n return (\n <div className={className.base}>\n {/* field array label */}\n <FieldArrayLabel\n className={className.label}\n label={uniformFieldProps.label}\n name={name}\n />\n\n {fields.length ? (\n /* list wrapper */\n <div className={cn(className.listWrapper)}>\n {/* sortable context */}\n <SortContext\n fields={fields}\n move={move}\n name={name}\n sortable={sortable}\n >\n {/* list container */}\n <ul className={className.list} data-testid={testId}>\n {/* fields / list elements */}\n {fields.map((field, index) => {\n const elementName = flat\n ? `${name}.${index}.${flatArrayKey}`\n : `${name}.${index}`;\n const elementTestId = `${testId}_${index}`;\n\n // create methods for element\n const elementMethods: FieldArrayElementMethods = {\n append: () => {\n append(elementInitialValue);\n },\n duplicate: () => {\n const values = getValues(name);\n const currentValue = (values as unknown[])[index];\n const nextValue = flat\n ? { [flatArrayKey]: currentValue }\n : currentValue;\n insert(index + 1, nextValue);\n },\n insert: () => {\n insert(index + 1, elementInitialValue);\n },\n remove: () => {\n remove(index);\n },\n };\n\n return (\n <FieldArrayElement\n key={field.id}\n className={className}\n disableAnimation={disableAnimation}\n duplicate={duplicate}\n elementMarginBottom={elementMarginBottom}\n fields={fields}\n id={field.id}\n index={index}\n insertAfter={insertAfter}\n lastNotDeletable={lastElementNotRemovable}\n methods={elementMethods}\n sortable={sortable}\n testId={elementTestId}\n >\n {children({\n index,\n length: fields.length,\n methods: elementMethods,\n name: elementName,\n testId: elementTestId,\n })}\n </FieldArrayElement>\n );\n })}\n </ul>\n </SortContext>\n </div>\n ) : null}\n\n {/* top level field array errors */}\n <FieldArrayValidationError name={name} />\n\n {/* append elements button */}\n <ElementAppendButton\n appendButtonText={appendButtonText}\n className={className.appendButton}\n testId={`${testId}_append_button`}\n onClick={() => {\n append(elementInitialValue);\n }}\n />\n </div>\n );\n};\n\nexport default FieldArray;\n","import FieldArray from './FieldArray';\n\nexport type * from './types';\n\nexport { FieldArray };\n\nexport default FieldArray;\n"],"mappings":"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"}
|