@fuf-stack/uniform 1.22.5 → 1.22.6
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 +113 -4
- package/dist/Checkboxes/index.cjs.map +1 -0
- package/dist/Checkboxes/index.d.cts +534 -2
- package/dist/Checkboxes/index.d.cts.map +1 -0
- package/dist/Checkboxes/index.d.ts +534 -2
- package/dist/Checkboxes/index.d.ts.map +1 -0
- package/dist/Checkboxes/index.js +112 -2
- package/dist/Checkboxes/index.js.map +1 -0
- package/dist/DatePicker/index.cjs +194 -4
- package/dist/DatePicker/index.cjs.map +1 -0
- package/dist/DatePicker/index.d.cts +1413 -2
- package/dist/{index-D7AUghFx.d.ts.map → DatePicker/index.d.cts.map} +1 -1
- package/dist/DatePicker/index.d.ts +1413 -2
- package/dist/{index-CD0Wpla3.d.cts.map → DatePicker/index.d.ts.map} +1 -1
- package/dist/DatePicker/index.js +193 -2
- package/dist/DatePicker/index.js.map +1 -0
- package/dist/FieldArray/index.cjs +495 -4
- package/dist/FieldArray/index.cjs.map +1 -0
- package/dist/FieldArray/index.d.cts +539 -2
- package/dist/{index-B4XExHDi.d.cts.map → FieldArray/index.d.cts.map} +1 -1
- package/dist/FieldArray/index.d.ts +539 -2
- package/dist/{index-yYjVSHlN.d.ts.map → FieldArray/index.d.ts.map} +1 -1
- package/dist/FieldArray/index.js +494 -2
- package/dist/FieldArray/index.js.map +1 -0
- package/dist/FieldCard/index.cjs +226 -4
- package/dist/FieldCard/index.cjs.map +1 -0
- package/dist/FieldCard/index.d.cts +314 -2
- package/dist/FieldCard/index.d.cts.map +1 -0
- package/dist/FieldCard/index.d.ts +314 -2
- package/dist/FieldCard/index.d.ts.map +1 -0
- package/dist/FieldCard/index.js +225 -2
- package/dist/FieldCard/index.js.map +1 -0
- package/dist/{FieldCopyTestIdButton-Dpmo0uBV.js → FieldCopyTestIdButton-CRJBix9D.js} +2 -2
- package/dist/{FieldCopyTestIdButton-Dpmo0uBV.js.map → FieldCopyTestIdButton-CRJBix9D.js.map} +1 -1
- package/dist/{FieldCopyTestIdButton-ptoB1F75.cjs → FieldCopyTestIdButton-D3D_LmJh.cjs} +1 -8
- package/dist/{FieldCopyTestIdButton-ptoB1F75.cjs.map → FieldCopyTestIdButton-D3D_LmJh.cjs.map} +1 -1
- package/dist/{FieldValidationError-ktTyyyip.js → FieldValidationError-ByRoIxaM.js} +5 -5
- package/dist/{FieldValidationError-ktTyyyip.js.map → FieldValidationError-ByRoIxaM.js.map} +1 -1
- package/dist/{FieldValidationError-BQcvvU9i.cjs → FieldValidationError-CfYKzl7P.cjs} +5 -6
- package/dist/{FieldValidationError-BQcvvU9i.cjs.map → FieldValidationError-CfYKzl7P.cjs.map} +1 -1
- package/dist/Form/index.cjs +118 -3
- package/dist/Form/index.cjs.map +1 -0
- package/dist/Form/index.d.cts +43 -2
- package/dist/Form/index.d.cts.map +1 -0
- package/dist/Form/index.d.ts +43 -2
- package/dist/Form/index.d.ts.map +1 -0
- package/dist/Form/index.js +118 -2
- package/dist/Form/index.js.map +1 -0
- package/dist/{FormContext-3kamRn2C.d.cts → FormContext-BLWS7bhO.d.cts} +1 -1
- package/dist/{FormContext-3kamRn2C.d.cts.map → FormContext-BLWS7bhO.d.cts.map} +1 -1
- package/dist/{FormContext-BQeKOV-0.js → FormContext-DjJOJKxj.js} +1 -1
- package/dist/{FormContext-BQeKOV-0.js.map → FormContext-DjJOJKxj.js.map} +1 -1
- package/dist/{FormContext-DsmS_mkO.cjs → FormContext-EGH0cVnH.cjs} +1 -1
- package/dist/{FormContext-DsmS_mkO.cjs.map → FormContext-EGH0cVnH.cjs.map} +1 -1
- package/dist/{FormContext-i66vM5f1.d.ts → FormContext-LgzrDWu1.d.ts} +1 -1
- package/dist/{FormContext-i66vM5f1.d.ts.map → FormContext-LgzrDWu1.d.ts.map} +1 -1
- package/dist/Grid/index.cjs +1 -2
- package/dist/Grid/index.d.cts +22 -2
- package/dist/Grid/index.d.cts.map +1 -0
- package/dist/Grid/index.d.ts +22 -2
- package/dist/Grid/index.d.ts.map +1 -0
- package/dist/Grid/index.js +2 -2
- package/dist/{Grid-D-VcRGi9.cjs → Grid-BbqCRkuY.cjs} +1 -8
- package/dist/{Grid-D-VcRGi9.cjs.map → Grid-BbqCRkuY.cjs.map} +1 -1
- package/dist/{Grid-BQpLOB0G.js → Grid-CTs-Rb9G.js} +2 -2
- package/dist/{Grid-BQpLOB0G.js.map → Grid-CTs-Rb9G.js.map} +1 -1
- package/dist/Input/index.cjs +96 -3
- package/dist/Input/index.cjs.map +1 -0
- package/dist/Input/index.d.cts +677 -2
- package/dist/Input/index.d.cts.map +1 -0
- package/dist/Input/index.d.ts +677 -2
- package/dist/Input/index.d.ts.map +1 -0
- package/dist/Input/index.js +96 -2
- package/dist/Input/index.js.map +1 -0
- package/dist/RadioBoxes/index.cjs +136 -4
- package/dist/RadioBoxes/index.cjs.map +1 -0
- package/dist/RadioBoxes/index.d.cts +1477 -2
- package/dist/RadioBoxes/index.d.cts.map +1 -0
- package/dist/RadioBoxes/index.d.ts +1477 -2
- package/dist/RadioBoxes/index.d.ts.map +1 -0
- package/dist/RadioBoxes/index.js +135 -2
- package/dist/RadioBoxes/index.js.map +1 -0
- package/dist/RadioTabs/index.cjs +123 -4
- package/dist/RadioTabs/index.cjs.map +1 -0
- package/dist/RadioTabs/index.d.cts +585 -2
- package/dist/RadioTabs/index.d.cts.map +1 -0
- package/dist/RadioTabs/index.d.ts +585 -2
- package/dist/RadioTabs/index.d.ts.map +1 -0
- package/dist/RadioTabs/index.js +120 -2
- package/dist/RadioTabs/index.js.map +1 -0
- package/dist/Radios/index.cjs +74 -4
- package/dist/Radios/index.cjs.map +1 -0
- package/dist/Radios/index.d.cts +1263 -2
- package/dist/{index-DCwffq1f.d.ts.map → Radios/index.d.cts.map} +1 -1
- package/dist/Radios/index.d.ts +1263 -2
- package/dist/{index-CqXEYILn.d.cts.map → Radios/index.d.ts.map} +1 -1
- package/dist/Radios/index.js +73 -2
- package/dist/Radios/index.js.map +1 -0
- package/dist/Select/index.cjs +286 -4
- package/dist/Select/index.cjs.map +1 -0
- package/dist/Select/index.d.cts +3917 -2
- package/dist/{index-D1cB3mbB.d.ts.map → Select/index.d.cts.map} +1 -1
- package/dist/Select/index.d.ts +3917 -2
- package/dist/{index-veBM95Gw.d.cts.map → Select/index.d.ts.map} +1 -1
- package/dist/Select/index.js +283 -2
- package/dist/Select/index.js.map +1 -0
- package/dist/Slider/index.cjs +109 -4
- package/dist/Slider/index.cjs.map +1 -0
- package/dist/Slider/index.d.cts +1760 -2
- package/dist/{index-BUZEnZDm.d.ts.map → Slider/index.d.cts.map} +1 -1
- package/dist/Slider/index.d.ts +1760 -2
- package/dist/{index-Bie3CWyW.d.cts.map → Slider/index.d.ts.map} +1 -1
- package/dist/Slider/index.js +108 -2
- package/dist/Slider/index.js.map +1 -0
- package/dist/SubmitButton/index.cjs +31 -3
- package/dist/SubmitButton/index.cjs.map +1 -0
- package/dist/SubmitButton/index.d.cts +38 -2
- package/dist/SubmitButton/index.d.cts.map +1 -0
- package/dist/SubmitButton/index.d.ts +38 -2
- package/dist/SubmitButton/index.d.ts.map +1 -0
- package/dist/SubmitButton/index.js +31 -2
- package/dist/SubmitButton/index.js.map +1 -0
- package/dist/Switch/index.cjs +82 -4
- package/dist/Switch/index.cjs.map +1 -0
- package/dist/Switch/index.d.cts +1257 -2
- package/dist/{index-DqMpHpu7.d.ts.map → Switch/index.d.cts.map} +1 -1
- package/dist/Switch/index.d.ts +1257 -2
- package/dist/{index-19JGtN7H.d.cts.map → Switch/index.d.ts.map} +1 -1
- package/dist/Switch/index.js +81 -2
- package/dist/Switch/index.js.map +1 -0
- package/dist/SwitchBox/index.cjs +154 -4
- package/dist/SwitchBox/index.cjs.map +1 -0
- package/dist/SwitchBox/index.d.cts +473 -2
- package/dist/SwitchBox/index.d.cts.map +1 -0
- package/dist/SwitchBox/index.d.ts +473 -2
- package/dist/SwitchBox/index.d.ts.map +1 -0
- package/dist/SwitchBox/index.js +153 -2
- package/dist/SwitchBox/index.js.map +1 -0
- package/dist/TextArea/index.cjs +66 -3
- package/dist/TextArea/index.cjs.map +1 -0
- package/dist/TextArea/index.d.cts +659 -2
- package/dist/TextArea/index.d.cts.map +1 -0
- package/dist/TextArea/index.d.ts +659 -2
- package/dist/TextArea/index.d.ts.map +1 -0
- package/dist/TextArea/index.js +66 -2
- package/dist/TextArea/index.js.map +1 -0
- package/dist/Time/index.cjs +217 -4
- package/dist/Time/index.cjs.map +1 -0
- package/dist/Time/index.d.cts +1028 -2
- package/dist/Time/index.d.cts.map +1 -0
- package/dist/Time/index.d.ts +1028 -2
- package/dist/Time/index.d.ts.map +1 -0
- package/dist/Time/index.js +216 -2
- package/dist/Time/index.js.map +1 -0
- package/dist/helpers/index.cjs +0 -1
- package/dist/helpers/index.cjs.map +1 -1
- package/dist/helpers/index.js.map +1 -1
- package/dist/hooks/useClientValidation/index.cjs +177 -3
- package/dist/hooks/useClientValidation/index.cjs.map +1 -1
- package/dist/hooks/useClientValidation/index.d.cts +148 -2
- package/dist/hooks/useClientValidation/index.d.cts.map +1 -0
- package/dist/hooks/useClientValidation/index.d.ts +148 -2
- package/dist/hooks/useClientValidation/index.d.ts.map +1 -0
- package/dist/hooks/useClientValidation/index.js +175 -1
- package/dist/hooks/useClientValidation/index.js.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.cjs +1 -1
- package/dist/hooks/useFormContext/index.d.cts +1 -1
- package/dist/hooks/useFormContext/index.d.ts +1 -1
- package/dist/hooks/useFormContext/index.js +1 -1
- package/dist/hooks/useInput/index.cjs +0 -1
- package/dist/hooks/useInput/index.d.cts +1 -1
- package/dist/hooks/useInput/index.d.ts +1 -1
- package/dist/hooks/useInput/index.js +1 -1
- package/dist/hooks/useInputValueDebounce/index.cjs +1 -2
- package/dist/hooks/useInputValueDebounce/index.cjs.map +1 -1
- package/dist/hooks/useInputValueDebounce/index.d.cts +66 -2
- package/dist/hooks/useInputValueDebounce/index.d.cts.map +1 -0
- package/dist/hooks/useInputValueDebounce/index.d.ts +66 -2
- package/dist/hooks/useInputValueDebounce/index.d.ts.map +1 -0
- package/dist/hooks/useInputValueDebounce/index.js +1 -1
- package/dist/hooks/useInputValueTransform/index.cjs +1 -1
- package/dist/hooks/useInputValueTransform/index.d.cts +1 -1
- package/dist/hooks/useInputValueTransform/index.d.ts +1 -1
- package/dist/hooks/useInputValueTransform/index.js +1 -1
- package/dist/hooks/useUniformField/index.cjs +8 -8
- package/dist/hooks/useUniformField/index.cjs.map +1 -1
- package/dist/hooks/useUniformField/index.d.cts +98 -2
- package/dist/hooks/useUniformField/index.d.cts.map +1 -0
- package/dist/hooks/useUniformField/index.d.ts +98 -2
- package/dist/hooks/useUniformField/index.d.ts.map +1 -0
- package/dist/hooks/useUniformField/index.js +8 -8
- package/dist/hooks/useUniformField/index.js.map +1 -1
- package/dist/hooks/useUniformFieldArray/index.cjs +1 -2
- package/dist/hooks/useUniformFieldArray/index.cjs.map +1 -1
- package/dist/hooks/useUniformFieldArray/index.d.cts +79 -2
- package/dist/hooks/useUniformFieldArray/index.d.cts.map +1 -0
- package/dist/hooks/useUniformFieldArray/index.d.ts +79 -2
- package/dist/hooks/useUniformFieldArray/index.d.ts.map +1 -0
- package/dist/hooks/useUniformFieldArray/index.js +1 -1
- package/dist/hooks/useWatchFormReset/index.cjs +1 -2
- package/dist/hooks/useWatchFormReset/index.cjs.map +1 -1
- package/dist/hooks/useWatchFormReset/index.d.cts +38 -2
- package/dist/hooks/useWatchFormReset/index.d.cts.map +1 -0
- package/dist/hooks/useWatchFormReset/index.d.ts +38 -2
- package/dist/hooks/useWatchFormReset/index.d.ts.map +1 -0
- package/dist/hooks/useWatchFormReset/index.js +1 -1
- package/dist/hooks/useWatchUserChange/index.cjs +82 -2
- package/dist/hooks/useWatchUserChange/index.cjs.map +1 -1
- package/dist/hooks/useWatchUserChange/index.d.cts +80 -2
- package/dist/hooks/useWatchUserChange/index.d.cts.map +1 -0
- package/dist/hooks/useWatchUserChange/index.d.ts +80 -2
- package/dist/hooks/useWatchUserChange/index.d.ts.map +1 -0
- package/dist/hooks/useWatchUserChange/index.js +81 -1
- package/dist/hooks/useWatchUserChange/index.js.map +1 -1
- package/dist/partials/FieldCopyTestIdButton/index.cjs +1 -2
- package/dist/partials/FieldCopyTestIdButton/index.d.cts +14 -2
- package/dist/partials/FieldCopyTestIdButton/index.d.cts.map +1 -0
- package/dist/partials/FieldCopyTestIdButton/index.d.ts +14 -2
- package/dist/partials/FieldCopyTestIdButton/index.d.ts.map +1 -0
- package/dist/partials/FieldCopyTestIdButton/index.js +2 -2
- package/dist/partials/FieldValidationError/index.cjs +1 -2
- package/dist/partials/FieldValidationError/index.d.cts +22 -2
- package/dist/partials/FieldValidationError/index.d.cts.map +1 -0
- package/dist/partials/FieldValidationError/index.d.ts +22 -2
- package/dist/partials/FieldValidationError/index.d.ts.map +1 -0
- package/dist/partials/FieldValidationError/index.js +2 -2
- package/dist/{useController-CzP0aVFC.d.ts → useController-CvQqCvFJ.d.ts} +1 -1
- package/dist/{useController-CzP0aVFC.d.ts.map → useController-CvQqCvFJ.d.ts.map} +1 -1
- package/dist/{useController--lRPWBuD.cjs → useController-Dbe7ADG6.cjs} +2 -2
- package/dist/{useController--lRPWBuD.cjs.map → useController-Dbe7ADG6.cjs.map} +1 -1
- package/dist/{useController-B287flU_.js → useController-DxFS0u7c.js} +2 -2
- package/dist/{useController-B287flU_.js.map → useController-DxFS0u7c.js.map} +1 -1
- package/dist/{useController-BT3Fd0IO.d.cts → useController-fblEApv_.d.cts} +1 -1
- package/dist/{useController-BT3Fd0IO.d.cts.map → useController-fblEApv_.d.cts.map} +1 -1
- package/dist/{useFormContext-Bj1gXLt_.d.ts → useFormContext-B1-deU4Z.d.ts} +2 -2
- package/dist/{useFormContext-Bj1gXLt_.d.ts.map → useFormContext-B1-deU4Z.d.ts.map} +1 -1
- package/dist/{useFormContext-CT8H8xIe.js → useFormContext-BJqa1FoT.js} +2 -2
- package/dist/{useFormContext-CT8H8xIe.js.map → useFormContext-BJqa1FoT.js.map} +1 -1
- package/dist/{useFormContext-M94eQfHm.d.cts → useFormContext-D5vrT2sg.d.cts} +2 -2
- package/dist/{useFormContext-M94eQfHm.d.cts.map → useFormContext-D5vrT2sg.d.cts.map} +1 -1
- package/dist/{useFormContext-CrXwNYiB.cjs → useFormContext-kUHonwgu.cjs} +2 -2
- package/dist/{useFormContext-CrXwNYiB.cjs.map → useFormContext-kUHonwgu.cjs.map} +1 -1
- package/dist/{useInputValueTransform-CNCBU7a9.d.cts → useInputValueTransform-DCXXb2Lp.d.cts} +1 -1
- package/dist/{useInputValueTransform-CNCBU7a9.d.cts.map → useInputValueTransform-DCXXb2Lp.d.cts.map} +1 -1
- package/dist/{useInputValueTransform-dLfFIYW4.d.ts → useInputValueTransform-DCXXb2Lp.d.ts} +1 -1
- package/dist/{useInputValueTransform-dLfFIYW4.d.ts.map → useInputValueTransform-DCXXb2Lp.d.ts.map} +1 -1
- package/dist/{useInputValueTransform-CXdmtc0Q.js → useInputValueTransform-DJ5zkqSy.js} +1 -1
- package/dist/{useInputValueTransform-CXdmtc0Q.js.map → useInputValueTransform-DJ5zkqSy.js.map} +1 -1
- package/dist/{useInputValueTransform-Bm65K8LX.cjs → useInputValueTransform-P62UUZBl.cjs} +1 -2
- package/dist/{useInputValueTransform-Bm65K8LX.cjs.map → useInputValueTransform-P62UUZBl.cjs.map} +1 -1
- package/package.json +5 -12
- package/dist/Checkboxes-DrJqx6O2.cjs +0 -130
- package/dist/Checkboxes-DrJqx6O2.cjs.map +0 -1
- package/dist/Checkboxes-X6FRwI50.js +0 -112
- package/dist/Checkboxes-X6FRwI50.js.map +0 -1
- package/dist/DatePicker-CGIWizz9.js +0 -193
- package/dist/DatePicker-CGIWizz9.js.map +0 -1
- package/dist/DatePicker-CYUuwwsm.cjs +0 -211
- package/dist/DatePicker-CYUuwwsm.cjs.map +0 -1
- package/dist/FieldArray-Dkw6JBnT.js +0 -494
- package/dist/FieldArray-Dkw6JBnT.js.map +0 -1
- package/dist/FieldArray-V66fsvtd.cjs +0 -512
- package/dist/FieldArray-V66fsvtd.cjs.map +0 -1
- package/dist/FieldCard-CAHnM8C0.cjs +0 -243
- package/dist/FieldCard-CAHnM8C0.cjs.map +0 -1
- package/dist/FieldCard-Cg31ce9J.js +0 -225
- package/dist/FieldCard-Cg31ce9J.js.map +0 -1
- package/dist/Form-CYlsIABv.cjs +0 -125
- package/dist/Form-CYlsIABv.cjs.map +0 -1
- package/dist/Form-D3yfDu4L.js +0 -114
- package/dist/Form-D3yfDu4L.js.map +0 -1
- package/dist/Input-B5RxbkNS.js +0 -96
- package/dist/Input-B5RxbkNS.js.map +0 -1
- package/dist/Input-DvVViuWH.cjs +0 -108
- package/dist/Input-DvVViuWH.cjs.map +0 -1
- package/dist/RadioBoxes-BmLrbYXt.cjs +0 -153
- package/dist/RadioBoxes-BmLrbYXt.cjs.map +0 -1
- package/dist/RadioBoxes-DWxJBTKR.js +0 -135
- package/dist/RadioBoxes-DWxJBTKR.js.map +0 -1
- package/dist/RadioTabs-14XTbTJU.cjs +0 -139
- package/dist/RadioTabs-14XTbTJU.cjs.map +0 -1
- package/dist/RadioTabs-DAY6MYJI.js +0 -120
- package/dist/RadioTabs-DAY6MYJI.js.map +0 -1
- package/dist/Radios-C938-msm.js +0 -73
- package/dist/Radios-C938-msm.js.map +0 -1
- package/dist/Radios-D_B9Y8s2.cjs +0 -91
- package/dist/Radios-D_B9Y8s2.cjs.map +0 -1
- package/dist/Select-BL6k_e-D.js +0 -283
- package/dist/Select-BL6k_e-D.js.map +0 -1
- package/dist/Select-D66A-hYm.cjs +0 -302
- package/dist/Select-D66A-hYm.cjs.map +0 -1
- package/dist/Slider-ChC2PZNb.cjs +0 -126
- package/dist/Slider-ChC2PZNb.cjs.map +0 -1
- package/dist/Slider-DmEwhC1T.js +0 -108
- package/dist/Slider-DmEwhC1T.js.map +0 -1
- package/dist/SubmitButton-D-wn1PJV.cjs +0 -43
- package/dist/SubmitButton-D-wn1PJV.cjs.map +0 -1
- package/dist/SubmitButton-D6aU7IgC.js +0 -31
- package/dist/SubmitButton-D6aU7IgC.js.map +0 -1
- package/dist/Switch-Ch6_VInV.cjs +0 -99
- package/dist/Switch-Ch6_VInV.cjs.map +0 -1
- package/dist/Switch-DvKRPFcC.js +0 -81
- package/dist/Switch-DvKRPFcC.js.map +0 -1
- package/dist/SwitchBox-BU1XieaZ.js +0 -153
- package/dist/SwitchBox-BU1XieaZ.js.map +0 -1
- package/dist/SwitchBox-Dl-F5y2m.cjs +0 -171
- package/dist/SwitchBox-Dl-F5y2m.cjs.map +0 -1
- package/dist/TextArea-CMXm-kTK.cjs +0 -78
- package/dist/TextArea-CMXm-kTK.cjs.map +0 -1
- package/dist/TextArea-DAg_K-QP.js +0 -66
- package/dist/TextArea-DAg_K-QP.js.map +0 -1
- package/dist/Time-B_SXrKWK.js +0 -216
- package/dist/Time-B_SXrKWK.js.map +0 -1
- package/dist/Time-CYoWaQsz.cjs +0 -234
- package/dist/Time-CYoWaQsz.cjs.map +0 -1
- package/dist/index-19JGtN7H.d.cts +0 -1257
- package/dist/index-54OZEaUU.d.ts +0 -43
- package/dist/index-54OZEaUU.d.ts.map +0 -1
- package/dist/index-B4XExHDi.d.cts +0 -539
- package/dist/index-BUZEnZDm.d.ts +0 -1760
- package/dist/index-Bbaubtxp.d.cts +0 -677
- package/dist/index-Bbaubtxp.d.cts.map +0 -1
- package/dist/index-BdgFJ-dj.d.ts +0 -1028
- package/dist/index-BdgFJ-dj.d.ts.map +0 -1
- package/dist/index-BiZNkLK3.d.cts +0 -1477
- package/dist/index-BiZNkLK3.d.cts.map +0 -1
- package/dist/index-Bie3CWyW.d.cts +0 -1760
- package/dist/index-BqxDWhNr.d.cts +0 -22
- package/dist/index-BqxDWhNr.d.cts.map +0 -1
- package/dist/index-BsTqcI1C.d.cts +0 -659
- package/dist/index-BsTqcI1C.d.cts.map +0 -1
- package/dist/index-C3-TV4Up.d.cts +0 -43
- package/dist/index-C3-TV4Up.d.cts.map +0 -1
- package/dist/index-C6Y8KybK.d.ts +0 -677
- package/dist/index-C6Y8KybK.d.ts.map +0 -1
- package/dist/index-CD0Wpla3.d.cts +0 -1413
- package/dist/index-CEJxjf5R.d.ts +0 -22
- package/dist/index-CEJxjf5R.d.ts.map +0 -1
- package/dist/index-CHQKk_fN2.d.ts +0 -14
- package/dist/index-CHQKk_fN2.d.ts.map +0 -1
- package/dist/index-CUByIf_d.d.ts +0 -314
- package/dist/index-CUByIf_d.d.ts.map +0 -1
- package/dist/index-CV7wqRev.d.ts +0 -38
- package/dist/index-CV7wqRev.d.ts.map +0 -1
- package/dist/index-CXvUaeCL.d.cts +0 -14
- package/dist/index-CXvUaeCL.d.cts.map +0 -1
- package/dist/index-Cf2B9woY.d.cts +0 -473
- package/dist/index-Cf2B9woY.d.cts.map +0 -1
- package/dist/index-CqXEYILn.d.cts +0 -1263
- package/dist/index-D1cB3mbB.d.ts +0 -3917
- package/dist/index-D7AUghFx.d.ts +0 -1413
- package/dist/index-DCwffq1f.d.ts +0 -1263
- package/dist/index-DFbuWomg.d.ts +0 -534
- package/dist/index-DFbuWomg.d.ts.map +0 -1
- package/dist/index-DXOBPBft.d.ts +0 -659
- package/dist/index-DXOBPBft.d.ts.map +0 -1
- package/dist/index-DY-d4cFe.d.cts +0 -1028
- package/dist/index-DY-d4cFe.d.cts.map +0 -1
- package/dist/index-DpXSZCZe.d.cts +0 -38
- package/dist/index-DpXSZCZe.d.cts.map +0 -1
- package/dist/index-DqMpHpu7.d.ts +0 -1257
- package/dist/index-DwnqyNnX.d.cts +0 -534
- package/dist/index-DwnqyNnX.d.cts.map +0 -1
- package/dist/index-OdNTqjhQ.d.ts +0 -585
- package/dist/index-OdNTqjhQ.d.ts.map +0 -1
- package/dist/index-P30z4VRT.d.cts +0 -22
- package/dist/index-P30z4VRT.d.cts.map +0 -1
- package/dist/index-PWRw2bPH.d.ts +0 -22
- package/dist/index-PWRw2bPH.d.ts.map +0 -1
- package/dist/index-QPDvw5Z5.d.cts +0 -585
- package/dist/index-QPDvw5Z5.d.cts.map +0 -1
- package/dist/index-amMd-sQN.d.ts +0 -473
- package/dist/index-amMd-sQN.d.ts.map +0 -1
- package/dist/index-clztdahp.d.ts +0 -1477
- package/dist/index-clztdahp.d.ts.map +0 -1
- package/dist/index-jK092-MJ.d.cts +0 -314
- package/dist/index-jK092-MJ.d.cts.map +0 -1
- package/dist/index-veBM95Gw.d.cts +0 -3917
- package/dist/index-yYjVSHlN.d.ts +0 -539
- package/dist/index.cjs +0 -94
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -31
- package/dist/index.d.ts +0 -31
- package/dist/index.js +0 -36
- package/dist/index.js.map +0 -1
- package/dist/useClientValidation-BRfhqRom.cjs +0 -190
- package/dist/useClientValidation-BRfhqRom.cjs.map +0 -1
- package/dist/useClientValidation-C2dLJnDI.d.cts +0 -148
- package/dist/useClientValidation-C2dLJnDI.d.cts.map +0 -1
- package/dist/useClientValidation-DpLdzIAb.js +0 -178
- package/dist/useClientValidation-DpLdzIAb.js.map +0 -1
- package/dist/useClientValidation-qRq2_spX.d.ts +0 -148
- package/dist/useClientValidation-qRq2_spX.d.ts.map +0 -1
- package/dist/useInputValueDebounce-CfQDiomI.d.cts +0 -66
- package/dist/useInputValueDebounce-CfQDiomI.d.cts.map +0 -1
- package/dist/useInputValueDebounce-DZgzL7GQ.d.ts +0 -66
- package/dist/useInputValueDebounce-DZgzL7GQ.d.ts.map +0 -1
- package/dist/useUniformField-BE-e3C4Y.d.cts +0 -98
- package/dist/useUniformField-BE-e3C4Y.d.cts.map +0 -1
- package/dist/useUniformField-DUW-svZD.d.ts +0 -98
- package/dist/useUniformField-DUW-svZD.d.ts.map +0 -1
- package/dist/useUniformFieldArray-CdWv1SEk.d.ts +0 -79
- package/dist/useUniformFieldArray-CdWv1SEk.d.ts.map +0 -1
- package/dist/useUniformFieldArray-kkOHxNFF.d.cts +0 -79
- package/dist/useUniformFieldArray-kkOHxNFF.d.cts.map +0 -1
- package/dist/useWatchFormReset-BSd6jMxU.d.cts +0 -38
- package/dist/useWatchFormReset-BSd6jMxU.d.cts.map +0 -1
- package/dist/useWatchFormReset-C7YJ-I3N.d.ts +0 -38
- package/dist/useWatchFormReset-C7YJ-I3N.d.ts.map +0 -1
- package/dist/useWatchUserChange-C1xWHtFG.cjs +0 -90
- package/dist/useWatchUserChange-C1xWHtFG.cjs.map +0 -1
- package/dist/useWatchUserChange-CpyZz2i7.d.ts +0 -80
- package/dist/useWatchUserChange-CpyZz2i7.d.ts.map +0 -1
- package/dist/useWatchUserChange-DSAboNCs.d.cts +0 -80
- package/dist/useWatchUserChange-DSAboNCs.d.cts.map +0 -1
- package/dist/useWatchUserChange-DSQGsl1R.js +0 -84
- package/dist/useWatchUserChange-DSQGsl1R.js.map +0 -1
- /package/dist/{index-BLwMeReG.d.ts → index-BKZ67WMa.d.cts} +0 -0
- /package/dist/{index-C2gUMYkE.d.cts → index-BKZ67WMa.d.ts} +0 -0
- /package/dist/{index-CJgP-E0M.d.cts → index-BVVgDSdq.d.cts} +0 -0
- /package/dist/{index-Cg9utiy0.d.ts → index-BVVgDSdq.d.ts} +0 -0
- /package/dist/{index-CspKFJM1.d.cts → index-DmtQKWjk.d.cts} +0 -0
- /package/dist/{index-h64gcVNJ.d.ts → index-DmtQKWjk.d.ts} +0 -0
- /package/dist/{useInput-CVm3tP78.js → useInput-C0aJaAGe.js} +0 -0
- /package/dist/{useInput-BdH8oftG.d.ts → useInput-ClpHDPdr.d.cts} +0 -0
- /package/dist/{useInput-DZOmMKcp.d.cts → useInput-ClpHDPdr.d.ts} +0 -0
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
import "./helpers/index.js";
|
|
2
|
-
import { n as useFormContext } from "./useFormContext-CT8H8xIe.js";
|
|
3
|
-
import { useEffect, useId } from "react";
|
|
4
|
-
import { array, objectLoose } from "@fuf-stack/veto";
|
|
5
|
-
//#region src/hooks/useClientValidation/useClientValidation.ts
|
|
6
|
-
/**
|
|
7
|
-
* Hook for adding dynamic client-side validation to forms.
|
|
8
|
-
*
|
|
9
|
-
* Client validation is used for context-dependent validation rules that require external data
|
|
10
|
-
* (e.g., checking if a username already exists). It complements base validation (passed to Form),
|
|
11
|
-
* which handles static rules like "required", min/max length, format, etc.
|
|
12
|
-
*
|
|
13
|
-
* **Typical pattern:**
|
|
14
|
-
* - Base validation: Static, always-on rules (required, format, length constraints)
|
|
15
|
-
* - Client validation: Dynamic rules based on external data (uniqueness, business logic)
|
|
16
|
-
* - Client schemas should use `.nullish()` to allow empty values (base validation handles "required")
|
|
17
|
-
*
|
|
18
|
-
* Automatically manages validation schema lifecycle: sets schema when data is provided,
|
|
19
|
-
* clears schema when data is null/undefined, and cleans up on unmount. When the client
|
|
20
|
-
* validation schema changes, automatically re-validates all touched fields.
|
|
21
|
-
*
|
|
22
|
-
* @param data - Data to create validation schema from (or null/undefined to clear validation)
|
|
23
|
-
* @param schemaFactory - Function that creates a validation schema from the data. Schemas should typically use `.nullish()`.
|
|
24
|
-
* @param options - Optional configuration object
|
|
25
|
-
* @param options.key - Optional custom key for registration. Useful when multiple instances should share validation (e.g., in field arrays)
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```tsx
|
|
29
|
-
* // Base validation handles "required" and format
|
|
30
|
-
* const baseSchema = veto({ username: vt.string({ min: 3 }) });
|
|
31
|
-
*
|
|
32
|
-
* // Client validation adds dynamic uniqueness check
|
|
33
|
-
* const { data: teamData } = useTeamQuery(teamId);
|
|
34
|
-
* useClientValidation(teamData, (data) =>
|
|
35
|
-
* vt.objectLoose({
|
|
36
|
-
* username: vt.string()
|
|
37
|
-
* .refine(
|
|
38
|
-
* (value) => !data.existingUsers.includes(value),
|
|
39
|
-
* { message: 'Username already exists' }
|
|
40
|
-
* )
|
|
41
|
-
* .nullish() // Allow empty - base validation handles "required"
|
|
42
|
-
* })
|
|
43
|
-
* );
|
|
44
|
-
* ```
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* ```tsx
|
|
48
|
-
* // Using custom key in a field array to avoid multiple registrations
|
|
49
|
-
* fields.map((field, index) => (
|
|
50
|
-
* useClientValidation(
|
|
51
|
-
* userData,
|
|
52
|
-
* (data) => clientValidationSchemaByName(
|
|
53
|
-
* `items.${index}.name`,
|
|
54
|
-
* vt.string()
|
|
55
|
-
* .refine((val) => !data.forbidden.includes(val), { message: 'Name not allowed' })
|
|
56
|
-
* .nullish()
|
|
57
|
-
* ),
|
|
58
|
-
* { key: 'items-validation' } // All instances share the same key
|
|
59
|
-
* )
|
|
60
|
-
* ));
|
|
61
|
-
* ```
|
|
62
|
-
*/
|
|
63
|
-
const useClientValidation = (data, schemaFactory, options) => {
|
|
64
|
-
const { formState: { touchedFields }, validation: { setClientValidationSchema }, trigger } = useFormContext();
|
|
65
|
-
const autoGeneratedKey = useId();
|
|
66
|
-
const key = options?.key ?? autoGeneratedKey;
|
|
67
|
-
useEffect(() => {
|
|
68
|
-
if (data != null) setClientValidationSchema(key, schemaFactory(data));
|
|
69
|
-
else setClientValidationSchema(key, null);
|
|
70
|
-
const touchedFieldNames = Object.keys(touchedFields);
|
|
71
|
-
if (touchedFieldNames.length > 0) setTimeout(async () => {
|
|
72
|
-
return trigger(touchedFieldNames);
|
|
73
|
-
}, 1);
|
|
74
|
-
return () => {
|
|
75
|
-
setClientValidationSchema(key, null);
|
|
76
|
-
};
|
|
77
|
-
}, [JSON.stringify(data), key]);
|
|
78
|
-
};
|
|
79
|
-
/**
|
|
80
|
-
* Helper function to create a veto looseObject schema for a single field with nested path support.
|
|
81
|
-
*
|
|
82
|
-
* Parses field paths (dot-notation) and creates properly nested loose object schemas with array support.
|
|
83
|
-
* All intermediate objects and arrays are marked as optional to allow partial data structures.
|
|
84
|
-
* Numeric segments in the path are treated as array indices, and the parent field is wrapped in an array schema.
|
|
85
|
-
* Supports flat arrays (arrays of primitives) via the special `__FLAT__` key.
|
|
86
|
-
*
|
|
87
|
-
* **Important:** The fieldSchema should typically use `.nullish()` to allow empty values. This is because:
|
|
88
|
-
* - Base validation (passed to Form) handles "required" constraints
|
|
89
|
-
* - Client validation adds dynamic, context-dependent rules (e.g., "username already exists")
|
|
90
|
-
* - Form data processing converts empty strings in flat arrays to `null` (not `undefined`)
|
|
91
|
-
* - `.nullish()` accepts both `null` and `undefined`, while `.optional()` only accepts `undefined`
|
|
92
|
-
*
|
|
93
|
-
* This pattern ensures client validation only validates non-empty values, while base validation
|
|
94
|
-
* enforces required fields and basic constraints (min length, format, etc.).
|
|
95
|
-
*
|
|
96
|
-
* @param name - The dot-separated path to the field (e.g., 'username', 'user.profile.email', 'items.0.name', 'tags.0.__FLAT__')
|
|
97
|
-
* @param fieldSchema - The veto validation schema for the field. Should typically use `.nullish()` to allow empty values.
|
|
98
|
-
* @returns A nested loose object schema matching the field path structure with proper type inference
|
|
99
|
-
*
|
|
100
|
-
* @example
|
|
101
|
-
* ```tsx
|
|
102
|
-
* // Typical usage: base validation handles "required", client validation adds dynamic rules
|
|
103
|
-
* // Base validation (in Form component)
|
|
104
|
-
* const baseSchema = veto({ username: vt.string({ min: 3 }) }); // Required + min length
|
|
105
|
-
*
|
|
106
|
-
* // Client validation (dynamic check for existing usernames)
|
|
107
|
-
* const { data: userData } = useUserQuery(userId);
|
|
108
|
-
* useClientValidation(userData, (data) =>
|
|
109
|
-
* clientValidationSchemaByName(
|
|
110
|
-
* 'username',
|
|
111
|
-
* vt.string()
|
|
112
|
-
* .refine(
|
|
113
|
-
* (value) => !data.existingUsernames.includes(value),
|
|
114
|
-
* { message: 'Username already taken' }
|
|
115
|
-
* )
|
|
116
|
-
* .nullish() // Allow empty - base validation handles "required"
|
|
117
|
-
* )
|
|
118
|
-
* );
|
|
119
|
-
* ```
|
|
120
|
-
*
|
|
121
|
-
* @example
|
|
122
|
-
* ```tsx
|
|
123
|
-
* // Nested field path with dynamic validation
|
|
124
|
-
* clientValidationSchemaByName(
|
|
125
|
-
* 'user.profile.email',
|
|
126
|
-
* vt.string()
|
|
127
|
-
* .refine(
|
|
128
|
-
* (value) => !reservedEmails.includes(value),
|
|
129
|
-
* { message: 'This email is reserved' }
|
|
130
|
-
* )
|
|
131
|
-
* .nullish()
|
|
132
|
-
* )
|
|
133
|
-
* // => objectLoose({ user: objectLoose({ profile: objectLoose({ email: ... }).optional() }).optional() })
|
|
134
|
-
* ```
|
|
135
|
-
*
|
|
136
|
-
* @example
|
|
137
|
-
* ```tsx
|
|
138
|
-
* // Array of objects with dynamic validation
|
|
139
|
-
* clientValidationSchemaByName(
|
|
140
|
-
* 'items.0.tag',
|
|
141
|
-
* vt.string()
|
|
142
|
-
* .refine((value) => !forbiddenTags.includes(value), { message: 'Tag not allowed' })
|
|
143
|
-
* .nullish()
|
|
144
|
-
* )
|
|
145
|
-
* // => objectLoose({ items: array(objectLoose({ tag: ... })).optional() })
|
|
146
|
-
* ```
|
|
147
|
-
*
|
|
148
|
-
* @example
|
|
149
|
-
* ```tsx
|
|
150
|
-
* // Flat array (array of primitives) with dynamic validation
|
|
151
|
-
* clientValidationSchemaByName(
|
|
152
|
-
* 'tags.0.__FLAT__',
|
|
153
|
-
* vt.string()
|
|
154
|
-
* .refine((value) => !forbiddenWords.includes(value), { message: 'Word not allowed' })
|
|
155
|
-
* .nullish()
|
|
156
|
-
* )
|
|
157
|
-
* // => objectLoose({ tags: array(vt.string().refine(...).nullish()).optional() })
|
|
158
|
-
* ```
|
|
159
|
-
*/
|
|
160
|
-
const clientValidationSchemaByName = (name, fieldSchema) => {
|
|
161
|
-
const segments = name.split(".");
|
|
162
|
-
let schema = fieldSchema;
|
|
163
|
-
for (let i = segments.length - 1; i >= 0; i -= 1) {
|
|
164
|
-
const segment = segments[i];
|
|
165
|
-
const isNumeric = /^\d+$/.test(segment);
|
|
166
|
-
if (segment === "__FLAT__") continue;
|
|
167
|
-
if (isNumeric) schema = array(schema).optional();
|
|
168
|
-
else {
|
|
169
|
-
const obj = objectLoose({ [segment]: schema });
|
|
170
|
-
schema = i > 0 ? obj.optional() : obj;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
return schema;
|
|
174
|
-
};
|
|
175
|
-
//#endregion
|
|
176
|
-
export { useClientValidation as n, clientValidationSchemaByName as t };
|
|
177
|
-
|
|
178
|
-
//# sourceMappingURL=useClientValidation-DpLdzIAb.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useClientValidation-DpLdzIAb.js","names":[],"sources":["../src/hooks/useClientValidation/useClientValidation.ts"],"sourcesContent":["import type { VetoTypeAny } from '@fuf-stack/veto';\n\nimport { useEffect, useId } from 'react';\n\nimport { array, objectLoose } from '@fuf-stack/veto';\n\nimport { flatArrayKey } from '../../helpers';\nimport { useFormContext } from '../useFormContext/useFormContext';\n\n/**\n * Hook for adding dynamic client-side validation to forms.\n *\n * Client validation is used for context-dependent validation rules that require external data\n * (e.g., checking if a username already exists). It complements base validation (passed to Form),\n * which handles static rules like \"required\", min/max length, format, etc.\n *\n * **Typical pattern:**\n * - Base validation: Static, always-on rules (required, format, length constraints)\n * - Client validation: Dynamic rules based on external data (uniqueness, business logic)\n * - Client schemas should use `.nullish()` to allow empty values (base validation handles \"required\")\n *\n * Automatically manages validation schema lifecycle: sets schema when data is provided,\n * clears schema when data is null/undefined, and cleans up on unmount. When the client\n * validation schema changes, automatically re-validates all touched fields.\n *\n * @param data - Data to create validation schema from (or null/undefined to clear validation)\n * @param schemaFactory - Function that creates a validation schema from the data. Schemas should typically use `.nullish()`.\n * @param options - Optional configuration object\n * @param options.key - Optional custom key for registration. Useful when multiple instances should share validation (e.g., in field arrays)\n *\n * @example\n * ```tsx\n * // Base validation handles \"required\" and format\n * const baseSchema = veto({ username: vt.string({ min: 3 }) });\n *\n * // Client validation adds dynamic uniqueness check\n * const { data: teamData } = useTeamQuery(teamId);\n * useClientValidation(teamData, (data) =>\n * vt.objectLoose({\n * username: vt.string()\n * .refine(\n * (value) => !data.existingUsers.includes(value),\n * { message: 'Username already exists' }\n * )\n * .nullish() // Allow empty - base validation handles \"required\"\n * })\n * );\n * ```\n *\n * @example\n * ```tsx\n * // Using custom key in a field array to avoid multiple registrations\n * fields.map((field, index) => (\n * useClientValidation(\n * userData,\n * (data) => clientValidationSchemaByName(\n * `items.${index}.name`,\n * vt.string()\n * .refine((val) => !data.forbidden.includes(val), { message: 'Name not allowed' })\n * .nullish()\n * ),\n * { key: 'items-validation' } // All instances share the same key\n * )\n * ));\n * ```\n */\nexport const useClientValidation = <TData = unknown>(\n data: TData | null | undefined,\n schemaFactory: (data: TData) => VetoTypeAny,\n options?: { key?: string },\n): void => {\n const {\n formState: { touchedFields },\n validation: { setClientValidationSchema },\n trigger,\n } = useFormContext();\n\n // Use provided key or auto-generate unique key\n const autoGeneratedKey = useId();\n const key = options?.key ?? autoGeneratedKey;\n\n // Use data hash instead of object reference to avoid unnecessary re-runs\n // when data object reference changes but data remains the same\n const dataHash = JSON.stringify(data);\n\n // Single effect to manage validation schema lifecycle\n useEffect(() => {\n // Set validation schema when data is available\n if (data != null) {\n const validationSchema = schemaFactory(data);\n setClientValidationSchema(key, validationSchema);\n } else {\n // Clear validation schema when no data\n setClientValidationSchema(key, null);\n }\n\n // Re-validate all touched fields when client validation schema changes\n const touchedFieldNames = Object.keys(touchedFields);\n if (touchedFieldNames.length > 0) {\n // Use setTimeout to ensure the client validation schema update has propagated\n // before triggering re-validation (fixes race condition)\n setTimeout(async () => {\n return trigger(touchedFieldNames);\n }, 1);\n }\n\n // Cleanup on unmount or when dependencies change\n return () => {\n setClientValidationSchema(key, null);\n };\n // Only re-run when data (dataHash) or key changes\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [dataHash, key]);\n};\n\n/**\n * Helper function to create a veto looseObject schema for a single field with nested path support.\n *\n * Parses field paths (dot-notation) and creates properly nested loose object schemas with array support.\n * All intermediate objects and arrays are marked as optional to allow partial data structures.\n * Numeric segments in the path are treated as array indices, and the parent field is wrapped in an array schema.\n * Supports flat arrays (arrays of primitives) via the special `__FLAT__` key.\n *\n * **Important:** The fieldSchema should typically use `.nullish()` to allow empty values. This is because:\n * - Base validation (passed to Form) handles \"required\" constraints\n * - Client validation adds dynamic, context-dependent rules (e.g., \"username already exists\")\n * - Form data processing converts empty strings in flat arrays to `null` (not `undefined`)\n * - `.nullish()` accepts both `null` and `undefined`, while `.optional()` only accepts `undefined`\n *\n * This pattern ensures client validation only validates non-empty values, while base validation\n * enforces required fields and basic constraints (min length, format, etc.).\n *\n * @param name - The dot-separated path to the field (e.g., 'username', 'user.profile.email', 'items.0.name', 'tags.0.__FLAT__')\n * @param fieldSchema - The veto validation schema for the field. Should typically use `.nullish()` to allow empty values.\n * @returns A nested loose object schema matching the field path structure with proper type inference\n *\n * @example\n * ```tsx\n * // Typical usage: base validation handles \"required\", client validation adds dynamic rules\n * // Base validation (in Form component)\n * const baseSchema = veto({ username: vt.string({ min: 3 }) }); // Required + min length\n *\n * // Client validation (dynamic check for existing usernames)\n * const { data: userData } = useUserQuery(userId);\n * useClientValidation(userData, (data) =>\n * clientValidationSchemaByName(\n * 'username',\n * vt.string()\n * .refine(\n * (value) => !data.existingUsernames.includes(value),\n * { message: 'Username already taken' }\n * )\n * .nullish() // Allow empty - base validation handles \"required\"\n * )\n * );\n * ```\n *\n * @example\n * ```tsx\n * // Nested field path with dynamic validation\n * clientValidationSchemaByName(\n * 'user.profile.email',\n * vt.string()\n * .refine(\n * (value) => !reservedEmails.includes(value),\n * { message: 'This email is reserved' }\n * )\n * .nullish()\n * )\n * // => objectLoose({ user: objectLoose({ profile: objectLoose({ email: ... }).optional() }).optional() })\n * ```\n *\n * @example\n * ```tsx\n * // Array of objects with dynamic validation\n * clientValidationSchemaByName(\n * 'items.0.tag',\n * vt.string()\n * .refine((value) => !forbiddenTags.includes(value), { message: 'Tag not allowed' })\n * .nullish()\n * )\n * // => objectLoose({ items: array(objectLoose({ tag: ... })).optional() })\n * ```\n *\n * @example\n * ```tsx\n * // Flat array (array of primitives) with dynamic validation\n * clientValidationSchemaByName(\n * 'tags.0.__FLAT__',\n * vt.string()\n * .refine((value) => !forbiddenWords.includes(value), { message: 'Word not allowed' })\n * .nullish()\n * )\n * // => objectLoose({ tags: array(vt.string().refine(...).nullish()).optional() })\n * ```\n */\nexport const clientValidationSchemaByName = <T extends VetoTypeAny>(\n name: string,\n fieldSchema: T,\n) => {\n const segments = name.split('.');\n\n // Build schema from innermost to outermost\n let schema: VetoTypeAny = fieldSchema;\n\n // Process segments in reverse order to build nested structure\n for (let i = segments.length - 1; i >= 0; i -= 1) {\n const segment = segments[i];\n\n const isNumeric = /^\\d+$/.test(segment);\n const isFlatArrayKey = segment === flatArrayKey;\n\n if (isFlatArrayKey) {\n // Skip the __FLAT__ key - it's just a marker for flat arrays\n // The schema is already correct (primitive type), just continue\n // eslint-disable-next-line no-continue\n continue;\n }\n\n if (isNumeric) {\n // Current segment is an array index - wrap current schema in optional array\n schema = array(schema).optional();\n } else {\n // Current segment is a field name - wrap in objectLoose\n // Make it optional if it's an intermediate object (not the root)\n const obj = objectLoose({\n [segment]: schema,\n });\n schema = i > 0 ? obj.optional() : obj;\n }\n }\n\n return schema;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,MAAa,uBACX,MACA,eACA,YACS;CACT,MAAM,EACJ,WAAW,EAAE,iBACb,YAAY,EAAE,6BACd,YACE,eAAe;CAGnB,MAAM,mBAAmB,MAAM;CAC/B,MAAM,MAAM,SAAS,OAAO;CAO5B,gBAAgB;EAEd,IAAI,QAAQ,MAEV,0BAA0B,KADD,cAAc,IACO,CAAC;OAG/C,0BAA0B,KAAK,IAAI;EAIrC,MAAM,oBAAoB,OAAO,KAAK,aAAa;EACnD,IAAI,kBAAkB,SAAS,GAG7B,WAAW,YAAY;GACrB,OAAO,QAAQ,iBAAiB;EAClC,GAAG,CAAC;EAIN,aAAa;GACX,0BAA0B,KAAK,IAAI;EACrC;CAGF,GAAG,CA7Bc,KAAK,UAAU,IA6BrB,GAAG,GAAG,CAAC;AACpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmFA,MAAa,gCACX,MACA,gBACG;CACH,MAAM,WAAW,KAAK,MAAM,GAAG;CAG/B,IAAI,SAAsB;CAG1B,KAAK,IAAI,IAAI,SAAS,SAAS,GAAG,KAAK,GAAG,KAAK,GAAG;EAChD,MAAM,UAAU,SAAS;EAEzB,MAAM,YAAY,QAAQ,KAAK,OAAO;EAGtC,IAFuB,YAAA,YAMrB;EAGF,IAAI,WAEF,SAAS,MAAM,MAAM,EAAE,SAAS;OAC3B;GAGL,MAAM,MAAM,YAAY,GACrB,UAAU,OACb,CAAC;GACD,SAAS,IAAI,IAAI,IAAI,SAAS,IAAI;EACpC;CACF;CAEA,OAAO;AACT"}
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import { VetoTypeAny } from "@fuf-stack/veto";
|
|
2
|
-
|
|
3
|
-
//#region src/hooks/useClientValidation/useClientValidation.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Hook for adding dynamic client-side validation to forms.
|
|
6
|
-
*
|
|
7
|
-
* Client validation is used for context-dependent validation rules that require external data
|
|
8
|
-
* (e.g., checking if a username already exists). It complements base validation (passed to Form),
|
|
9
|
-
* which handles static rules like "required", min/max length, format, etc.
|
|
10
|
-
*
|
|
11
|
-
* **Typical pattern:**
|
|
12
|
-
* - Base validation: Static, always-on rules (required, format, length constraints)
|
|
13
|
-
* - Client validation: Dynamic rules based on external data (uniqueness, business logic)
|
|
14
|
-
* - Client schemas should use `.nullish()` to allow empty values (base validation handles "required")
|
|
15
|
-
*
|
|
16
|
-
* Automatically manages validation schema lifecycle: sets schema when data is provided,
|
|
17
|
-
* clears schema when data is null/undefined, and cleans up on unmount. When the client
|
|
18
|
-
* validation schema changes, automatically re-validates all touched fields.
|
|
19
|
-
*
|
|
20
|
-
* @param data - Data to create validation schema from (or null/undefined to clear validation)
|
|
21
|
-
* @param schemaFactory - Function that creates a validation schema from the data. Schemas should typically use `.nullish()`.
|
|
22
|
-
* @param options - Optional configuration object
|
|
23
|
-
* @param options.key - Optional custom key for registration. Useful when multiple instances should share validation (e.g., in field arrays)
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* ```tsx
|
|
27
|
-
* // Base validation handles "required" and format
|
|
28
|
-
* const baseSchema = veto({ username: vt.string({ min: 3 }) });
|
|
29
|
-
*
|
|
30
|
-
* // Client validation adds dynamic uniqueness check
|
|
31
|
-
* const { data: teamData } = useTeamQuery(teamId);
|
|
32
|
-
* useClientValidation(teamData, (data) =>
|
|
33
|
-
* vt.objectLoose({
|
|
34
|
-
* username: vt.string()
|
|
35
|
-
* .refine(
|
|
36
|
-
* (value) => !data.existingUsers.includes(value),
|
|
37
|
-
* { message: 'Username already exists' }
|
|
38
|
-
* )
|
|
39
|
-
* .nullish() // Allow empty - base validation handles "required"
|
|
40
|
-
* })
|
|
41
|
-
* );
|
|
42
|
-
* ```
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* ```tsx
|
|
46
|
-
* // Using custom key in a field array to avoid multiple registrations
|
|
47
|
-
* fields.map((field, index) => (
|
|
48
|
-
* useClientValidation(
|
|
49
|
-
* userData,
|
|
50
|
-
* (data) => clientValidationSchemaByName(
|
|
51
|
-
* `items.${index}.name`,
|
|
52
|
-
* vt.string()
|
|
53
|
-
* .refine((val) => !data.forbidden.includes(val), { message: 'Name not allowed' })
|
|
54
|
-
* .nullish()
|
|
55
|
-
* ),
|
|
56
|
-
* { key: 'items-validation' } // All instances share the same key
|
|
57
|
-
* )
|
|
58
|
-
* ));
|
|
59
|
-
* ```
|
|
60
|
-
*/
|
|
61
|
-
declare const useClientValidation: <TData = unknown>(data: TData | null | undefined, schemaFactory: (data: TData) => VetoTypeAny, options?: {
|
|
62
|
-
key?: string;
|
|
63
|
-
}) => void;
|
|
64
|
-
/**
|
|
65
|
-
* Helper function to create a veto looseObject schema for a single field with nested path support.
|
|
66
|
-
*
|
|
67
|
-
* Parses field paths (dot-notation) and creates properly nested loose object schemas with array support.
|
|
68
|
-
* All intermediate objects and arrays are marked as optional to allow partial data structures.
|
|
69
|
-
* Numeric segments in the path are treated as array indices, and the parent field is wrapped in an array schema.
|
|
70
|
-
* Supports flat arrays (arrays of primitives) via the special `__FLAT__` key.
|
|
71
|
-
*
|
|
72
|
-
* **Important:** The fieldSchema should typically use `.nullish()` to allow empty values. This is because:
|
|
73
|
-
* - Base validation (passed to Form) handles "required" constraints
|
|
74
|
-
* - Client validation adds dynamic, context-dependent rules (e.g., "username already exists")
|
|
75
|
-
* - Form data processing converts empty strings in flat arrays to `null` (not `undefined`)
|
|
76
|
-
* - `.nullish()` accepts both `null` and `undefined`, while `.optional()` only accepts `undefined`
|
|
77
|
-
*
|
|
78
|
-
* This pattern ensures client validation only validates non-empty values, while base validation
|
|
79
|
-
* enforces required fields and basic constraints (min length, format, etc.).
|
|
80
|
-
*
|
|
81
|
-
* @param name - The dot-separated path to the field (e.g., 'username', 'user.profile.email', 'items.0.name', 'tags.0.__FLAT__')
|
|
82
|
-
* @param fieldSchema - The veto validation schema for the field. Should typically use `.nullish()` to allow empty values.
|
|
83
|
-
* @returns A nested loose object schema matching the field path structure with proper type inference
|
|
84
|
-
*
|
|
85
|
-
* @example
|
|
86
|
-
* ```tsx
|
|
87
|
-
* // Typical usage: base validation handles "required", client validation adds dynamic rules
|
|
88
|
-
* // Base validation (in Form component)
|
|
89
|
-
* const baseSchema = veto({ username: vt.string({ min: 3 }) }); // Required + min length
|
|
90
|
-
*
|
|
91
|
-
* // Client validation (dynamic check for existing usernames)
|
|
92
|
-
* const { data: userData } = useUserQuery(userId);
|
|
93
|
-
* useClientValidation(userData, (data) =>
|
|
94
|
-
* clientValidationSchemaByName(
|
|
95
|
-
* 'username',
|
|
96
|
-
* vt.string()
|
|
97
|
-
* .refine(
|
|
98
|
-
* (value) => !data.existingUsernames.includes(value),
|
|
99
|
-
* { message: 'Username already taken' }
|
|
100
|
-
* )
|
|
101
|
-
* .nullish() // Allow empty - base validation handles "required"
|
|
102
|
-
* )
|
|
103
|
-
* );
|
|
104
|
-
* ```
|
|
105
|
-
*
|
|
106
|
-
* @example
|
|
107
|
-
* ```tsx
|
|
108
|
-
* // Nested field path with dynamic validation
|
|
109
|
-
* clientValidationSchemaByName(
|
|
110
|
-
* 'user.profile.email',
|
|
111
|
-
* vt.string()
|
|
112
|
-
* .refine(
|
|
113
|
-
* (value) => !reservedEmails.includes(value),
|
|
114
|
-
* { message: 'This email is reserved' }
|
|
115
|
-
* )
|
|
116
|
-
* .nullish()
|
|
117
|
-
* )
|
|
118
|
-
* // => objectLoose({ user: objectLoose({ profile: objectLoose({ email: ... }).optional() }).optional() })
|
|
119
|
-
* ```
|
|
120
|
-
*
|
|
121
|
-
* @example
|
|
122
|
-
* ```tsx
|
|
123
|
-
* // Array of objects with dynamic validation
|
|
124
|
-
* clientValidationSchemaByName(
|
|
125
|
-
* 'items.0.tag',
|
|
126
|
-
* vt.string()
|
|
127
|
-
* .refine((value) => !forbiddenTags.includes(value), { message: 'Tag not allowed' })
|
|
128
|
-
* .nullish()
|
|
129
|
-
* )
|
|
130
|
-
* // => objectLoose({ items: array(objectLoose({ tag: ... })).optional() })
|
|
131
|
-
* ```
|
|
132
|
-
*
|
|
133
|
-
* @example
|
|
134
|
-
* ```tsx
|
|
135
|
-
* // Flat array (array of primitives) with dynamic validation
|
|
136
|
-
* clientValidationSchemaByName(
|
|
137
|
-
* 'tags.0.__FLAT__',
|
|
138
|
-
* vt.string()
|
|
139
|
-
* .refine((value) => !forbiddenWords.includes(value), { message: 'Word not allowed' })
|
|
140
|
-
* .nullish()
|
|
141
|
-
* )
|
|
142
|
-
* // => objectLoose({ tags: array(vt.string().refine(...).nullish()).optional() })
|
|
143
|
-
* ```
|
|
144
|
-
*/
|
|
145
|
-
declare const clientValidationSchemaByName: <T extends VetoTypeAny>(name: string, fieldSchema: T) => VetoTypeAny;
|
|
146
|
-
//#endregion
|
|
147
|
-
export { useClientValidation as n, clientValidationSchemaByName as t };
|
|
148
|
-
//# sourceMappingURL=useClientValidation-qRq2_spX.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useClientValidation-qRq2_spX.d.ts","names":[],"sources":["../src/hooks/useClientValidation/useClientValidation.ts"],"mappings":";;;;;AAkEA;;;;;;;;;;;;;;;;;;AAG4B;AA+H5B;;;;;;;;;;;;;;;AAqCC;;;;;;;;;;;;;;;;;;;;;cAvKY,mBAAA,oBACX,IAAA,EAAM,KAAA,qBACN,aAAA,GAAgB,IAAA,EAAM,KAAA,KAAU,WAAA,EAChC,OAAA;EAAY,GAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA+HD,4BAAA,aAA0C,WAAA,EACrD,IAAA,UACA,WAAA,EAAa,CAAA,KAAC,WAAA"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
//#region src/hooks/useInputValueDebounce/useInputValueDebounce.d.ts
|
|
2
|
-
interface UseInputValueDebounceOptions<TValue = unknown> {
|
|
3
|
-
/** Debounce delay in milliseconds (default: 300) */
|
|
4
|
-
debounceDelay?: number;
|
|
5
|
-
/** Field name for triggering validation after debounced value commits */
|
|
6
|
-
name: string;
|
|
7
|
-
/** The onBlur function to call after flushing debounced value */
|
|
8
|
-
onBlur: () => void;
|
|
9
|
-
/** The onChange function to call with debounced value */
|
|
10
|
-
onChange: (...event: any[]) => void;
|
|
11
|
-
/** The field value */
|
|
12
|
-
value: TValue;
|
|
13
|
-
}
|
|
14
|
-
interface UseInputValueDebounceReturn<TValue = unknown> {
|
|
15
|
-
/** Enhanced onChange function with debouncing */
|
|
16
|
-
onChange: (...event: any[]) => void;
|
|
17
|
-
/** Enhanced onBlur function that flushes current value immediately */
|
|
18
|
-
onBlur: () => void;
|
|
19
|
-
/** The field value that is displayed - updates immediately */
|
|
20
|
-
value: TValue;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Custom hook for debouncing value changes with immediate blur support.
|
|
24
|
-
*
|
|
25
|
-
* Provides immediate visual feedback by updating the value instantly,
|
|
26
|
-
* while debouncing the actual onChange calls. When focus is lost,
|
|
27
|
-
* any pending debounced changes are immediately flushed.
|
|
28
|
-
*
|
|
29
|
-
* **Key Features:**
|
|
30
|
-
* - **Debouncing**: Delays onChange calls until user stops typing
|
|
31
|
-
* - **Generic type support**: Works with any data type (strings, numbers, arrays, objects)
|
|
32
|
-
* - **Immediate value updates**: UI stays responsive during debouncing
|
|
33
|
-
* - **Blur flushing**: Immediately applies pending changes on blur
|
|
34
|
-
*
|
|
35
|
-
* **Note:** Value transformations should be handled at the `useUniformField` level,
|
|
36
|
-
* not in this hook. This hook only handles debouncing timing.
|
|
37
|
-
*
|
|
38
|
-
* @param options Configuration for debounced value handling
|
|
39
|
-
* @param options.debounceDelay Delay in milliseconds (default: 300)
|
|
40
|
-
* @param options.onBlur Function to call after flushing debounced value
|
|
41
|
-
* @param options.onChange Function to call with debounced value
|
|
42
|
-
* @param options.value The field value
|
|
43
|
-
* @returns Object containing enhanced onChange, onBlur, and immediate value
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* Basic usage with debouncing:
|
|
47
|
-
* ```tsx
|
|
48
|
-
* const { onChange, onBlur, value } = useInputValueDebounce({
|
|
49
|
-
* debounceDelay: 300,
|
|
50
|
-
* name: 'fieldName',
|
|
51
|
-
* onBlur: field.onBlur,
|
|
52
|
-
* onChange: field.onChange,
|
|
53
|
-
* value: field.value,
|
|
54
|
-
* });
|
|
55
|
-
* ```
|
|
56
|
-
*/
|
|
57
|
-
declare const useInputValueDebounce: <TValue = unknown>({
|
|
58
|
-
debounceDelay,
|
|
59
|
-
name,
|
|
60
|
-
onBlur,
|
|
61
|
-
onChange,
|
|
62
|
-
value
|
|
63
|
-
}: UseInputValueDebounceOptions<TValue>) => UseInputValueDebounceReturn<TValue>;
|
|
64
|
-
//#endregion
|
|
65
|
-
export { UseInputValueDebounceReturn as n, useInputValueDebounce as r, UseInputValueDebounceOptions as t };
|
|
66
|
-
//# sourceMappingURL=useInputValueDebounce-CfQDiomI.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useInputValueDebounce-CfQDiomI.d.cts","names":[],"sources":["../src/hooks/useInputValueDebounce/useInputValueDebounce.ts"],"mappings":";UAIiB,4BAAA;EAAA;EAEf,aAAA;EAF2C;EAI3C,IAAA;EAJ4C;EAM5C,MAAA;EAFA;EAKA,QAAA,MAAc,KAAA;EAAd;EAEA,KAAA,EAAO,MAAM;AAAA;AAAA,UAGE,2BAAA;EAHF;EAMb,QAAA,MAAc,KAAA;EAHC;EAKf,MAAA;EAL0C;EAO1C,KAAA,EAAO,MAAM;AAAA;;;;;;;AAAA;AAsCf;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAa,qBAAA;EAA2C,aAAA;EAAA,IAAA;EAAA,MAAA;EAAA,QAAA;EAAA;AAAA,GAMrD,4BAAA,CAA6B,MAAA,MAAU,2BAAA,CAA4B,MAAA"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
//#region src/hooks/useInputValueDebounce/useInputValueDebounce.d.ts
|
|
2
|
-
interface UseInputValueDebounceOptions<TValue = unknown> {
|
|
3
|
-
/** Debounce delay in milliseconds (default: 300) */
|
|
4
|
-
debounceDelay?: number;
|
|
5
|
-
/** Field name for triggering validation after debounced value commits */
|
|
6
|
-
name: string;
|
|
7
|
-
/** The onBlur function to call after flushing debounced value */
|
|
8
|
-
onBlur: () => void;
|
|
9
|
-
/** The onChange function to call with debounced value */
|
|
10
|
-
onChange: (...event: any[]) => void;
|
|
11
|
-
/** The field value */
|
|
12
|
-
value: TValue;
|
|
13
|
-
}
|
|
14
|
-
interface UseInputValueDebounceReturn<TValue = unknown> {
|
|
15
|
-
/** Enhanced onChange function with debouncing */
|
|
16
|
-
onChange: (...event: any[]) => void;
|
|
17
|
-
/** Enhanced onBlur function that flushes current value immediately */
|
|
18
|
-
onBlur: () => void;
|
|
19
|
-
/** The field value that is displayed - updates immediately */
|
|
20
|
-
value: TValue;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Custom hook for debouncing value changes with immediate blur support.
|
|
24
|
-
*
|
|
25
|
-
* Provides immediate visual feedback by updating the value instantly,
|
|
26
|
-
* while debouncing the actual onChange calls. When focus is lost,
|
|
27
|
-
* any pending debounced changes are immediately flushed.
|
|
28
|
-
*
|
|
29
|
-
* **Key Features:**
|
|
30
|
-
* - **Debouncing**: Delays onChange calls until user stops typing
|
|
31
|
-
* - **Generic type support**: Works with any data type (strings, numbers, arrays, objects)
|
|
32
|
-
* - **Immediate value updates**: UI stays responsive during debouncing
|
|
33
|
-
* - **Blur flushing**: Immediately applies pending changes on blur
|
|
34
|
-
*
|
|
35
|
-
* **Note:** Value transformations should be handled at the `useUniformField` level,
|
|
36
|
-
* not in this hook. This hook only handles debouncing timing.
|
|
37
|
-
*
|
|
38
|
-
* @param options Configuration for debounced value handling
|
|
39
|
-
* @param options.debounceDelay Delay in milliseconds (default: 300)
|
|
40
|
-
* @param options.onBlur Function to call after flushing debounced value
|
|
41
|
-
* @param options.onChange Function to call with debounced value
|
|
42
|
-
* @param options.value The field value
|
|
43
|
-
* @returns Object containing enhanced onChange, onBlur, and immediate value
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* Basic usage with debouncing:
|
|
47
|
-
* ```tsx
|
|
48
|
-
* const { onChange, onBlur, value } = useInputValueDebounce({
|
|
49
|
-
* debounceDelay: 300,
|
|
50
|
-
* name: 'fieldName',
|
|
51
|
-
* onBlur: field.onBlur,
|
|
52
|
-
* onChange: field.onChange,
|
|
53
|
-
* value: field.value,
|
|
54
|
-
* });
|
|
55
|
-
* ```
|
|
56
|
-
*/
|
|
57
|
-
declare const useInputValueDebounce: <TValue = unknown>({
|
|
58
|
-
debounceDelay,
|
|
59
|
-
name,
|
|
60
|
-
onBlur,
|
|
61
|
-
onChange,
|
|
62
|
-
value
|
|
63
|
-
}: UseInputValueDebounceOptions<TValue>) => UseInputValueDebounceReturn<TValue>;
|
|
64
|
-
//#endregion
|
|
65
|
-
export { UseInputValueDebounceReturn as n, useInputValueDebounce as r, UseInputValueDebounceOptions as t };
|
|
66
|
-
//# sourceMappingURL=useInputValueDebounce-DZgzL7GQ.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useInputValueDebounce-DZgzL7GQ.d.ts","names":[],"sources":["../src/hooks/useInputValueDebounce/useInputValueDebounce.ts"],"mappings":";UAIiB,4BAAA;EAAA;EAEf,aAAA;EAF2C;EAI3C,IAAA;EAJ4C;EAM5C,MAAA;EAFA;EAKA,QAAA,MAAc,KAAA;EAAd;EAEA,KAAA,EAAO,MAAM;AAAA;AAAA,UAGE,2BAAA;EAHF;EAMb,QAAA,MAAc,KAAA;EAHC;EAKf,MAAA;EAL0C;EAO1C,KAAA,EAAO,MAAM;AAAA;;;;;;;AAAA;AAsCf;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAa,qBAAA;EAA2C,aAAA;EAAA,IAAA;EAAA,MAAA;EAAA,QAAA;EAAA;AAAA,GAMrD,4BAAA,CAA6B,MAAA,MAAU,2BAAA,CAA4B,MAAA"}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { t as InputValueTransform } from "./useInputValueTransform-CNCBU7a9.cjs";
|
|
2
|
-
import { r as useController } from "./useController-BT3Fd0IO.cjs";
|
|
3
|
-
import { n as useFormContext } from "./useFormContext-M94eQfHm.cjs";
|
|
4
|
-
import { t as useInput } from "./useInput-DZOmMKcp.cjs";
|
|
5
|
-
import { ReactNode } from "react";
|
|
6
|
-
import { FieldError, FieldValues, Path } from "react-hook-form";
|
|
7
|
-
|
|
8
|
-
//#region src/hooks/useUniformField/useUniformField.d.ts
|
|
9
|
-
interface UseUniformFieldParams<TFieldValues extends FieldValues = FieldValues, TDisplay = unknown> {
|
|
10
|
-
/** Form field name */
|
|
11
|
-
name: Path<TFieldValues> & string;
|
|
12
|
-
/** Custom aria-label for accessibility. If not provided, falls back to field name when no visible label exists */
|
|
13
|
-
ariaLabel?: string;
|
|
14
|
-
/** Disable the field */
|
|
15
|
-
disabled?: boolean;
|
|
16
|
-
/** Optional label content */
|
|
17
|
-
label?: ReactNode;
|
|
18
|
-
/** Optional explicit test id used to build stable test ids */
|
|
19
|
-
testId?: string;
|
|
20
|
-
/** Optional value transformation between form and display values */
|
|
21
|
-
transform?: InputValueTransform<TDisplay>;
|
|
22
|
-
/** Input type for special number handling */
|
|
23
|
-
type?: 'text' | 'number' | 'password';
|
|
24
|
-
}
|
|
25
|
-
interface UseUniformFieldReturn<TFieldValues extends FieldValues = FieldValues> {
|
|
26
|
-
/** 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) */
|
|
27
|
-
ariaLabel: string | undefined;
|
|
28
|
-
/** react-hook-form control instance for advanced integrations */
|
|
29
|
-
control: ReturnType<typeof useFormContext<TFieldValues>>['control'];
|
|
30
|
-
/** Debug mode from Uniform provider */
|
|
31
|
-
debugMode: ReturnType<typeof useFormContext<TFieldValues>>['debugMode'];
|
|
32
|
-
/** Current value used to initialize uncontrolled components */
|
|
33
|
-
defaultValue: unknown;
|
|
34
|
-
/** Whether the field is currently disabled (from RHF) */
|
|
35
|
-
disabled: boolean | undefined;
|
|
36
|
-
/** Validation error(s) for the field */
|
|
37
|
-
error: FieldError[] | undefined;
|
|
38
|
-
/** Pre-built errorMessage node to plug into components */
|
|
39
|
-
errorMessage: ReactNode | null;
|
|
40
|
-
/** RHF controller field with transformed value/onChange (use this for simple components) */
|
|
41
|
-
field: ReturnType<typeof useController<TFieldValues>>['field'];
|
|
42
|
-
/** Helper to spread standardized error message props to underlying components */
|
|
43
|
-
getErrorMessageProps: ReturnType<typeof useInput>['getErrorMessageProps'];
|
|
44
|
-
/** Helper to spread standardized helper wrapper props (for spacing/animation) */
|
|
45
|
-
getHelperWrapperProps: ReturnType<typeof useInput>['getHelperWrapperProps'];
|
|
46
|
-
/** Helper to spread standardized label props to underlying components */
|
|
47
|
-
getLabelProps: ReturnType<typeof useInput>['getLabelProps'];
|
|
48
|
-
/** Access current form values (converted to validation-friendly format) */
|
|
49
|
-
getValues: ReturnType<typeof useFormContext<TFieldValues>>['getValues'];
|
|
50
|
-
/** Whether the field should show invalid state (debounced for smooth animations). True when field is invalid AND (dirty OR touched OR submitted) */
|
|
51
|
-
invalid: boolean;
|
|
52
|
-
/** Computed label node including optional test id copy button */
|
|
53
|
-
label: ReactNode | null;
|
|
54
|
-
/** onBlur handler from controller */
|
|
55
|
-
onBlur: ReturnType<typeof useController<TFieldValues>>['field']['onBlur'];
|
|
56
|
-
/** onChange handler from controller (with transform applied) */
|
|
57
|
-
onChange: ReturnType<typeof useController<TFieldValues>>['field']['onChange'];
|
|
58
|
-
/** Ref to forward to underlying control */
|
|
59
|
-
ref: ReturnType<typeof useController<TFieldValues>>['field']['ref'];
|
|
60
|
-
/** Whether the field is required according to validation schema */
|
|
61
|
-
required: boolean;
|
|
62
|
-
/** Reset a specific field in the form */
|
|
63
|
-
resetField: ReturnType<typeof useFormContext<TFieldValues>>['resetField'];
|
|
64
|
-
/** Generated HTML data-testid for the field */
|
|
65
|
-
testId: string;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Combines frequently used form field logic into a single hook.
|
|
69
|
-
*
|
|
70
|
-
* Provides:
|
|
71
|
-
* - Enhanced form context (validation-aware state, `testId`, value transforms)
|
|
72
|
-
* - Controller field with nullish conversion handling
|
|
73
|
-
* - Value transformation via `transform` prop:
|
|
74
|
-
* • Allows disentangled display and form values (e.g., string ↔ object, boolean ↔ array)
|
|
75
|
-
* • Automatically applies `toDisplayValue` to field value for components
|
|
76
|
-
* • Automatically applies `toFormValue` to display value when onChange is called
|
|
77
|
-
* • Works with `type` prop for automatic number/string conversion
|
|
78
|
-
* • Examples: storing objects while displaying strings, storing booleans as arrays, enriching values with metadata
|
|
79
|
-
* - Debounced `invalid` state with smart timing:
|
|
80
|
-
* • `true` (field becomes invalid): applies immediately so errors show right away
|
|
81
|
-
* • `false` (field becomes valid): delayed 200ms to allow smooth exit animations
|
|
82
|
-
* • Respects `prefers-reduced-motion` by skipping delays when user prefers reduced motion
|
|
83
|
-
* - Smart `invalid` visibility (via `showInvalid`):
|
|
84
|
-
* • Shows errors when field is dirty OR touched OR form has been submitted
|
|
85
|
-
* • Prevents showing errors on pristine/untouched fields for better UX
|
|
86
|
-
* • Works well for all field types (text inputs, checkboxes, radios, arrays)
|
|
87
|
-
* - Prebuilt `errorMessage` React node using `FieldValidationError`
|
|
88
|
-
* - Computed `label` node which appends a `FieldCopyTestIdButton` in
|
|
89
|
-
* `debug-testids` mode
|
|
90
|
-
* - `defaultValue` for uncontrolled defaults and all usual field handlers
|
|
91
|
-
* - Access to form utilities: `control`, `getValues`, `resetField`
|
|
92
|
-
* - Presentation helpers: `getLabelProps`, `getErrorMessageProps`,
|
|
93
|
-
* `getHelperWrapperProps` for consistent wiring to underlying UI components
|
|
94
|
-
*/
|
|
95
|
-
declare const useUniformField: <TFieldValues extends FieldValues = FieldValues, TDisplay = unknown>(params: UseUniformFieldParams<TFieldValues, TDisplay>) => UseUniformFieldReturn<TFieldValues>;
|
|
96
|
-
//#endregion
|
|
97
|
-
export { UseUniformFieldReturn as n, useUniformField as r, UseUniformFieldParams as t };
|
|
98
|
-
//# sourceMappingURL=useUniformField-BE-e3C4Y.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useUniformField-BE-e3C4Y.d.cts","names":[],"sources":["../src/hooks/useUniformField/useUniformField.tsx"],"mappings":";;;;;;;;UAgBiB,qBAAA,sBACM,WAAA,GAAc,WAAA;;EAInC,IAAA,EAAM,IAAA,CAAK,YAAA;EALyB;EAOpC,SAAA;EANqB;EAQrB,QAAA;EAJW;EAMX,KAAA,GAAQ,SAAA;EAAA;EAER,MAAA;EAEY;EAAZ,SAAA,GAAY,mBAAA,CAAoB,QAAA;EAAD;EAE/B,IAAA;AAAA;AAAA,UAGe,qBAAA,sBACM,WAAA,GAAc,WAAA;EAnBnC;EAsBA,SAAA;EAnBM;EAqBN,OAAA,EAAS,UAAA,QAAkB,cAAA,CAAe,YAAA;EAnB1C;EAqBA,SAAA,EAAW,UAAA,QAAkB,cAAA,CAAe,YAAA;EAjB5C;EAmBA,YAAA;EAjBA;EAmBA,QAAA;EAjBY;EAmBZ,KAAA,EAAO,UAAA;EAjBP;EAmBA,YAAA,EAAc,SAAA;EAnBV;EAqBJ,KAAA,EAAO,UAAA,QAAkB,aAAA,CAAc,YAAA;EAlBH;EAoBpC,oBAAA,EAAsB,UAAA,QAAkB,QAAA;EAnBnB;EAqBrB,qBAAA,EAAuB,UAAA,QAAkB,QAAA;EAhBC;EAkB1C,aAAA,EAAe,UAAA,QAAkB,QAAA;EAlBxB;EAoBT,SAAA,EAAW,UAAA,QAAkB,cAAA,CAAe,YAAA;EAlBf;EAoB7B,OAAA;EAdO;EAgBP,KAAA,EAAO,SAAA;EAZgC;EAcvC,MAAA,EAAQ,UAAA,QAAkB,aAAA,CAAc,YAAA;EAdjC;EAgBP,QAAA,EAAU,UAAA,QAAkB,aAAA,CAAc,YAAA;EAdpB;EAgBtB,GAAA,EAAK,UAAA,QAAkB,aAAA,CAAc,YAAA;EAdd;EAgBvB,QAAA;EAde;EAgBf,UAAA,EAAY,UAAA,QAAkB,cAAA,CAAe,YAAA;EAdhB;EAgB7B,MAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA+BW,eAAA,wBACU,WAAA,GAAc,WAAA,sBAGnC,MAAA,EAAQ,qBAAA,CAAsB,YAAA,EAAc,QAAA,MAC3C,qBAAA,CAAsB,YAAA"}
|