@fuf-stack/uniform 1.22.5 → 1.22.7
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 +122 -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 +122 -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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/FieldCard/subcomponents/FieldCardValidationError.tsx","../../src/FieldCard/FieldCard.tsx","../../src/FieldCard/index.ts"],"sourcesContent":["import type { FieldError } from 'react-hook-form';\n\nimport {\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 FieldCardValidationErrorProps {\n /** CSS class name for the error footer wrapper */\n className?: string;\n /** Error object from parent FieldCard (passed directly to avoid duplicate hook calls) */\n error?: FieldError[] | undefined;\n /** CSS class name for the error text (controls color based on invalid state) */\n errorTextClassName?: string;\n /** Field name */\n name: string;\n}\n\n/**\n * Renders validation errors in the footer of a FieldCard component.\n *\n * This component handles displaying field-level validation errors with proper\n * accessibility attributes and animates them in/out using Framer Motion.\n *\n * Note: Object-level errors (_errors) are always shown when they exist,\n * but the danger styling is controlled by the parent FieldCard based on\n * whether child fields have been touched.\n */\nconst FieldCardValidationError = ({\n className = undefined,\n error = undefined,\n errorTextClassName = undefined,\n name,\n}: FieldCardValidationErrorProps) => {\n const { getErrorMessageProps, getHelperWrapperProps, testId } =\n useUniformField({\n name,\n });\n\n // disable all animation if user prefers reduced motion\n const disableAnimation = useReducedMotion();\n\n // Always show object-level errors (_errors) when they exist\n // @ts-expect-error - error._errors exists but not typed\n const hasErrors = !!error?._errors;\n\n return (\n <AnimatePresence initial={!disableAnimation}>\n {hasErrors ? (\n <motion.div\n key=\"field-card-errors\"\n animate={\n disableAnimation ? undefined : { opacity: 1, height: 'auto' }\n }\n exit={disableAnimation ? undefined : { opacity: 0, height: 0 }}\n initial={disableAnimation ? false : { height: 0, opacity: 0 }}\n style={{ overflow: 'hidden' }}\n transition={{ duration: 0.4, ease: 'circOut' }}\n >\n <div\n {...getHelperWrapperProps()}\n className={cn(getHelperWrapperProps()?.className, className)}\n >\n <div\n {...getErrorMessageProps()}\n className={cn(\n getErrorMessageProps()?.className,\n errorTextClassName,\n )}\n >\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 FieldCardValidationError;\n","import type { TVClassName } from '@fuf-stack/pixel-utils';\nimport type { ReactNode } from 'react';\n\nimport { tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\nimport { useDebounce } from '@fuf-stack/pixels';\n\nimport { checkFieldIsRequired, useFormContext } from '../hooks/useFormContext';\nimport { useUniformField } from '../hooks/useUniformField';\nimport FieldCardValidationError from './subcomponents/FieldCardValidationError';\n\n/**\n * Recursively checks if any child field has an error (regardless of touched state).\n * Returns true if at least one child has an error.\n */\nexport const hasAnyChildErrors = (\n errors: Record<string, unknown> | undefined,\n): boolean => {\n if (!errors) {\n return false;\n }\n\n return Object.keys(errors)\n .filter((key) => {\n return key !== '_errors';\n })\n .some((key) => {\n const errorValue = errors[key];\n if (errorValue === undefined) {\n return false;\n }\n // If errorValue is an array, it's a leaf field error\n if (Array.isArray(errorValue)) {\n return true;\n }\n // Recursively check nested objects\n if (typeof errorValue === 'object' && errorValue !== null) {\n return hasAnyChildErrors(errorValue as Record<string, unknown>);\n }\n return false;\n });\n};\n\n/**\n * Recursively checks if any child field is touched.\n * Returns true if at least one child is touched.\n */\nexport const hasAnyChildTouched = (\n touched: Record<string, unknown> | undefined,\n): boolean => {\n if (!touched) {\n return false;\n }\n\n return Object.keys(touched)\n .filter((key) => {\n return key !== '_errors';\n })\n .some((key) => {\n const touchedValue = touched[key];\n if (touchedValue === undefined) {\n return false;\n }\n // If touchedValue is truthy (boolean true), field is touched\n if (touchedValue === true) {\n return true;\n }\n // Recursively check nested objects\n if (typeof touchedValue === 'object' && touchedValue !== null) {\n return hasAnyChildTouched(touchedValue as Record<string, unknown>);\n }\n return false;\n });\n};\n\n/**\n * Recursively checks if any child field with an error is also touched.\n * Returns true if at least one touched child has an error.\n */\nexport const hasVisibleChildErrors = (\n errors: Record<string, unknown> | undefined,\n touched: Record<string, unknown> | undefined,\n): boolean => {\n if (!errors || !touched) {\n return false;\n }\n\n return Object.keys(errors)\n .filter((key) => {\n // Skip object-level errors (_errors) - those are handled separately\n return key !== '_errors';\n })\n .some((key) => {\n const errorValue = errors[key];\n const touchedValue = touched[key];\n\n // If this key doesn't exist in both errors and touched, skip\n if (errorValue === undefined || touchedValue === undefined) {\n return false;\n }\n\n // If errorValue is an array, it's a leaf field error\n if (Array.isArray(errorValue)) {\n // touchedValue being truthy means the field is touched\n return !!touchedValue;\n }\n\n // Recursively check nested objects\n if (typeof errorValue === 'object' && errorValue !== null) {\n return hasVisibleChildErrors(\n errorValue as Record<string, unknown>,\n touchedValue as Record<string, unknown>,\n );\n }\n\n return false;\n });\n};\n\nexport const fieldCardVariants = tv({\n slots: {\n /** base class for the field card wrapper */\n base: [\n // base styles\n 'overflow-hidden rounded-small border bg-content1',\n // animate border color change, respect reduced motion\n 'transition-colors duration-150 motion-reduce:transition-none',\n ],\n /** class for the label/header */\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) for proper header size\n 'rounded-t-small border-b p-3 font-semibold text-medium',\n // animate border and text color change, respect reduced motion\n 'transition-colors duration-150 motion-reduce:transition-none',\n ],\n /** class for the content */\n content: [\n // same as p-3 of Card component\n 'p-3',\n // default grid for form components (see Grid component)\n 'grid gap-4',\n ],\n /** class for the error footer wrapper */\n errorFooter: [\n 'border-t',\n // force helper to be visible and add padding (pt-1 to compensate for inner content's top padding)\n 'block px-3 pb-2 pt-1',\n // animate border color change, respect reduced motion\n 'transition-colors duration-150 motion-reduce:transition-none',\n ],\n /** class for the error text (empty base, color controlled by variant) */\n errorText: [],\n },\n variants: {\n invalid: {\n true: {\n base: 'border-danger-200',\n label: 'border-danger-200 text-danger',\n errorFooter: 'border-danger-200',\n errorText: '!text-danger text-tiny',\n },\n false: {\n base: 'border-divider',\n label: 'border-divider text-foreground',\n errorFooter: 'border-divider',\n errorText: '!text-foreground-500 text-tiny',\n },\n },\n },\n defaultVariants: {\n invalid: false,\n },\n});\n\ntype ClassName = TVClassName<typeof fieldCardVariants>;\n\nexport interface FieldCardProps {\n /** Content to render inside the card */\n children: ReactNode;\n /** CSS class name */\n className?: ClassName;\n /** Label content for the card header */\n label: ReactNode;\n /** Field name for validation */\n name: string;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n}\n\n/**\n * FieldCard component - A card-styled container with label header and error footer\n *\n * Displays form field content in a card layout with:\n * - Label/title in the header\n * - Content in the body\n * - Validation errors in the footer\n * - Danger outline when validation errors exist\n */\nconst FieldCard = ({\n children,\n className: _className = undefined,\n name,\n ...uniformFieldProps\n}: FieldCardProps) => {\n const { error, getLabelProps, label } = useUniformField({\n name,\n ...uniformFieldProps,\n });\n\n const {\n control,\n formState: { touchedFields, submitCount },\n validation,\n } = useFormContext();\n\n // Check if any registered child field is required\n const validationInstance = validation?.baseInstance ?? validation?.instance;\n const registeredFields: string[] = Array.from(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (control as any)._names?.mount ?? [],\n );\n const childFieldPrefix = `${name}.`;\n const isRequired = validationInstance\n ? registeredFields\n .filter((f) => {\n return f.startsWith(childFieldPrefix);\n })\n .some((f) => {\n return checkFieldIsRequired(\n validationInstance,\n f.split('.').filter((k) => {\n return k !== '';\n }),\n );\n })\n : false;\n\n // Get touched state for this field's children by traversing the path\n const getNestedValue = (\n obj: Record<string, unknown> | undefined,\n path: string,\n ): Record<string, unknown> | undefined => {\n if (!obj) {\n return undefined;\n }\n const keys = path.split('.');\n let current: unknown = obj;\n keys.every((key) => {\n if (current && typeof current === 'object') {\n current = (current as Record<string, unknown>)[key];\n return true;\n }\n current = undefined;\n return false;\n });\n return current as Record<string, unknown> | undefined;\n };\n\n const fieldTouched = getNestedValue(touchedFields, name);\n\n // Check for object-level errors (_errors)\n // @ts-expect-error - error._errors exists but not typed\n const hasObjectErrors = !!error?._errors;\n\n const errorRecord = error as unknown as Record<string, unknown>;\n\n // Check if any child field has errors (regardless of touched state)\n const hasChildErrors = hasAnyChildErrors(errorRecord);\n // Check if any child field is touched\n const isAnyChildTouched = hasAnyChildTouched(fieldTouched);\n\n // Show invalid styling (danger border/header/error text) when:\n // 1. Any child field has an error AND (it's touched OR form was submitted), OR\n // 2. Object-level _errors exists AND no child errors AND (any child touched OR submitted)\n const rawShowInvalid =\n (hasChildErrors &&\n (hasVisibleChildErrors(errorRecord, fieldTouched) || submitCount > 0)) ||\n (hasObjectErrors &&\n !hasChildErrors &&\n (isAnyChildTouched || submitCount > 0));\n\n // Debounce to prevent flickering during rapid state changes\n const showInvalid = useDebounce(rawShowInvalid, 200);\n\n // className from slots\n const variants = fieldCardVariants({ invalid: showInvalid });\n const className = variantsToClassNames(variants, _className, 'base');\n\n return (\n <div className={className.base}>\n {/* card header with label */}\n {label ? (\n <div\n {...getLabelProps()}\n aria-level={3}\n // Override getLabelProps className to use our own invalid styling based on hasErrors,\n // not HeroUI's which is based on any child field being invalid\n className={className.label}\n role=\"heading\"\n >\n {label}\n {/* Manual asterisk: getLabelProps uses schema-required for the object itself,\n but FieldCard needs asterisk based on whether any CHILD field is required */}\n {isRequired ? (\n <span aria-hidden=\"true\" className=\"ml-0.5 text-danger\">\n *\n </span>\n ) : null}\n </div>\n ) : null}\n\n {/* card content */}\n <div className={className.content}>{children}</div>\n\n {/* card footer with validation errors - always show _errors, but danger styling controlled by showInvalid */}\n <FieldCardValidationError\n className={className.errorFooter}\n error={error}\n errorTextClassName={className.errorText}\n name={name}\n />\n </div>\n );\n};\n\nexport default FieldCard;\n","import FieldCard from './FieldCard';\n\nexport type { FieldCardProps } from './FieldCard';\n\nexport { fieldCardVariants } from './FieldCard';\n\nexport default FieldCard;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiCA,MAAM,4BAA4B,EAChC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,eAAY;KAAO,WAAU;eAAqB;IAElD,CAAA,IACJ,IACD;QACH;GAGJ,oBAAC,OAAD;IAAK,WAAW,UAAU;IAAU;GAAc,CAAA;GAGlD,oBAAC,0BAAD;IACE,WAAW,UAAU;IACd;IACP,oBAAoB,UAAU;IACxB;GACP,CAAA;EACE;;AAET;;;AChUA,IAAA,oBAAe"}
|
|
@@ -21,6 +21,6 @@ const FieldCopyTestIdButton = ({ className = void 0, testId }) => {
|
|
|
21
21
|
//#region src/partials/FieldCopyTestIdButton/index.ts
|
|
22
22
|
var FieldCopyTestIdButton_default = FieldCopyTestIdButton;
|
|
23
23
|
//#endregion
|
|
24
|
-
export {
|
|
24
|
+
export { FieldCopyTestIdButton_default as t };
|
|
25
25
|
|
|
26
|
-
//# sourceMappingURL=FieldCopyTestIdButton-
|
|
26
|
+
//# sourceMappingURL=FieldCopyTestIdButton-CRJBix9D.js.map
|
package/dist/{FieldCopyTestIdButton-Dpmo0uBV.js.map → FieldCopyTestIdButton-CRJBix9D.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldCopyTestIdButton-
|
|
1
|
+
{"version":3,"file":"FieldCopyTestIdButton-CRJBix9D.js","names":[],"sources":["../src/partials/FieldCopyTestIdButton/FieldCopyTestIdButton.tsx","../src/partials/FieldCopyTestIdButton/index.ts"],"sourcesContent":["import { FaBullseye } from 'react-icons/fa6';\n\nimport { cn } from '@fuf-stack/pixel-utils';\nimport { Button } from '@fuf-stack/pixels';\n\nexport interface FieldCopyTestIdButtonProps {\n /** CSS class name */\n className?: string;\n /** HTML data-testid attribute used in e2e tests */\n testId: string;\n}\n\nconst FieldCopyTestIdButton = ({\n className = undefined,\n testId,\n}: FieldCopyTestIdButtonProps) => {\n const copyToClipboard = () => {\n navigator.clipboard.writeText(testId).catch((err) => {\n console.error('Error copying TestId to clipboard', err);\n });\n };\n\n return (\n <Button\n className={cn(className, 'pointer-events-auto')}\n icon={<FaBullseye />}\n onClick={copyToClipboard}\n size=\"sm\"\n variant=\"light\"\n />\n );\n};\nexport default FieldCopyTestIdButton;\n","import FieldCopyTestIdButton from './FieldCopyTestIdButton';\n\nexport type { FieldCopyTestIdButtonProps } from './FieldCopyTestIdButton';\n\nexport default FieldCopyTestIdButton;\n"],"mappings":";;;;;AAYA,MAAM,yBAAyB,EAC7B,YAAY,KAAA,GACZ,aACgC;CAChC,MAAM,wBAAwB;EAC5B,UAAU,UAAU,UAAU,MAAM,EAAE,OAAO,QAAQ;GACnD,QAAQ,MAAM,qCAAqC,GAAG;EACxD,CAAC;CACH;CAEA,OACE,oBAAC,QAAD;EACE,WAAW,GAAG,WAAW,qBAAqB;EAC9C,MAAM,oBAAC,YAAD,CAAa,CAAA;EACnB,SAAS;EACT,MAAK;EACL,SAAQ;CACT,CAAA;AAEL;;;AC3BA,IAAA,gCAAe"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
require("./FormContext-DsmS_mkO.cjs");
|
|
2
1
|
let _fuf_stack_pixel_utils = require("@fuf-stack/pixel-utils");
|
|
3
2
|
let _fuf_stack_pixels = require("@fuf-stack/pixels");
|
|
4
3
|
let react_icons_fa6 = require("react-icons/fa6");
|
|
@@ -22,12 +21,6 @@ const FieldCopyTestIdButton = ({ className = void 0, testId }) => {
|
|
|
22
21
|
//#region src/partials/FieldCopyTestIdButton/index.ts
|
|
23
22
|
var FieldCopyTestIdButton_default = FieldCopyTestIdButton;
|
|
24
23
|
//#endregion
|
|
25
|
-
Object.defineProperty(exports, "FieldCopyTestIdButton", {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: function() {
|
|
28
|
-
return FieldCopyTestIdButton;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
24
|
Object.defineProperty(exports, "FieldCopyTestIdButton_default", {
|
|
32
25
|
enumerable: true,
|
|
33
26
|
get: function() {
|
|
@@ -35,4 +28,4 @@ Object.defineProperty(exports, "FieldCopyTestIdButton_default", {
|
|
|
35
28
|
}
|
|
36
29
|
});
|
|
37
30
|
|
|
38
|
-
//# sourceMappingURL=FieldCopyTestIdButton-
|
|
31
|
+
//# sourceMappingURL=FieldCopyTestIdButton-D3D_LmJh.cjs.map
|
package/dist/{FieldCopyTestIdButton-ptoB1F75.cjs.map → FieldCopyTestIdButton-D3D_LmJh.cjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldCopyTestIdButton-
|
|
1
|
+
{"version":3,"file":"FieldCopyTestIdButton-D3D_LmJh.cjs","names":["Button","FaBullseye"],"sources":["../src/partials/FieldCopyTestIdButton/FieldCopyTestIdButton.tsx","../src/partials/FieldCopyTestIdButton/index.ts"],"sourcesContent":["import { FaBullseye } from 'react-icons/fa6';\n\nimport { cn } from '@fuf-stack/pixel-utils';\nimport { Button } from '@fuf-stack/pixels';\n\nexport interface FieldCopyTestIdButtonProps {\n /** CSS class name */\n className?: string;\n /** HTML data-testid attribute used in e2e tests */\n testId: string;\n}\n\nconst FieldCopyTestIdButton = ({\n className = undefined,\n testId,\n}: FieldCopyTestIdButtonProps) => {\n const copyToClipboard = () => {\n navigator.clipboard.writeText(testId).catch((err) => {\n console.error('Error copying TestId to clipboard', err);\n });\n };\n\n return (\n <Button\n className={cn(className, 'pointer-events-auto')}\n icon={<FaBullseye />}\n onClick={copyToClipboard}\n size=\"sm\"\n variant=\"light\"\n />\n );\n};\nexport default FieldCopyTestIdButton;\n","import FieldCopyTestIdButton from './FieldCopyTestIdButton';\n\nexport type { FieldCopyTestIdButtonProps } from './FieldCopyTestIdButton';\n\nexport default FieldCopyTestIdButton;\n"],"mappings":";;;;;AAYA,MAAM,yBAAyB,EAC7B,YAAY,KAAA,GACZ,aACgC;CAChC,MAAM,wBAAwB;EAC5B,UAAU,UAAU,UAAU,MAAM,EAAE,OAAO,QAAQ;GACnD,QAAQ,MAAM,qCAAqC,GAAG;EACxD,CAAC;CACH;CAEA,OACE,iBAAA,GAAA,kBAAA,KAACA,kBAAAA,QAAD;EACE,YAAA,GAAA,uBAAA,IAAc,WAAW,qBAAqB;EAC9C,MAAM,iBAAA,GAAA,kBAAA,KAACC,gBAAAA,YAAD,CAAa,CAAA;EACnB,SAAS;EACT,MAAK;EACL,SAAQ;CACT,CAAA;AAEL;;;AC3BA,IAAA,gCAAe"}
|
|
@@ -15,6 +15,10 @@ const FieldValidationError = ({ className = void 0, error = void 0, testId }) =>
|
|
|
15
15
|
initial: !disableAnimation,
|
|
16
16
|
children: error?.map(({ message }, i) => {
|
|
17
17
|
return /* @__PURE__ */ jsx(motion.li, {
|
|
18
|
+
animate: disableAnimation ? void 0 : {
|
|
19
|
+
opacity: 1,
|
|
20
|
+
height: "auto"
|
|
21
|
+
},
|
|
18
22
|
exit: disableAnimation ? void 0 : {
|
|
19
23
|
opacity: 0,
|
|
20
24
|
height: 0
|
|
@@ -28,10 +32,6 @@ const FieldValidationError = ({ className = void 0, error = void 0, testId }) =>
|
|
|
28
32
|
duration: .2,
|
|
29
33
|
ease: "circOut"
|
|
30
34
|
},
|
|
31
|
-
animate: disableAnimation ? void 0 : {
|
|
32
|
-
opacity: 1,
|
|
33
|
-
height: "auto"
|
|
34
|
-
},
|
|
35
35
|
children: /* @__PURE__ */ jsx("div", {
|
|
36
36
|
className: "px-1 pt-1",
|
|
37
37
|
children: message
|
|
@@ -47,4 +47,4 @@ var FieldValidationError_default = FieldValidationError;
|
|
|
47
47
|
//#endregion
|
|
48
48
|
export { FieldValidationError as n, FieldValidationError_default as t };
|
|
49
49
|
|
|
50
|
-
//# sourceMappingURL=FieldValidationError-
|
|
50
|
+
//# sourceMappingURL=FieldValidationError-ByRoIxaM.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldValidationError-
|
|
1
|
+
{"version":3,"file":"FieldValidationError-ByRoIxaM.js","names":[],"sources":["../src/partials/FieldValidationError/FieldValidationError.tsx","../src/partials/FieldValidationError/index.ts"],"sourcesContent":["import type { FieldError } from 'react-hook-form';\n\nimport {\n AnimatePresence,\n motion,\n useReducedMotion,\n} from '@fuf-stack/pixel-motion';\nimport { slugify } from '@fuf-stack/pixel-utils';\n\nexport interface FieldValidationErrorProps {\n /** CSS class name */\n className?: string;\n /** Field errors */\n error?: FieldError[];\n /** HTML data-testid attribute used in e2e tests */\n testId: string;\n}\n\n/**\n * Renders a validation error of a field\n */\nconst FieldValidationError = ({\n className = undefined,\n error = undefined,\n testId,\n}: FieldValidationErrorProps) => {\n // disable all animation if user prefers reduced motion\n const disableAnimation = useReducedMotion();\n\n return (\n <ul\n aria-label={`Validation errors of field ${testId}`}\n className={className}\n data-testid={slugify(`${testId}_error`)}\n >\n <AnimatePresence initial={!disableAnimation}>\n {error?.map(({ message }, i) => {\n return (\n <motion.li\n key={slugify(`${testId}_error_${i}`)}\n animate={\n disableAnimation ? undefined : { opacity: 1, height: 'auto' }\n }\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 >\n {/* wrap in div to apply padding and animation does not jump */}\n <div className=\"px-1 pt-1\">{message}</div>\n </motion.li>\n );\n })}\n </AnimatePresence>\n </ul>\n );\n};\n\nexport default FieldValidationError;\n","import FieldValidationError from './FieldValidationError';\n\nexport type { FieldValidationErrorProps } from './FieldValidationError';\n\nexport default FieldValidationError;\n"],"mappings":";;;;;;;AAqBA,MAAM,wBAAwB,EAC5B,YAAY,KAAA,GACZ,QAAQ,KAAA,GACR,aAC+B;CAE/B,MAAM,mBAAmB,iBAAiB;CAE1C,OACE,oBAAC,MAAD;EACE,cAAY,8BAA8B;EAC/B;EACX,eAAa,QAAQ,GAAG,OAAO,OAAO;YAEtC,oBAAC,iBAAD;GAAiB,SAAS,CAAC;aACxB,OAAO,KAAK,EAAE,WAAW,MAAM;IAC9B,OACE,oBAAC,OAAO,IAAR;KAEE,SACE,mBAAmB,KAAA,IAAY;MAAE,SAAS;MAAG,QAAQ;KAAO;KAE9D,MAAM,mBAAmB,KAAA,IAAY;MAAE,SAAS;MAAG,QAAQ;KAAE;KAC7D,SAAS,mBAAmB,QAAQ;MAAE,QAAQ;MAAG,SAAS;KAAE;KAC5D,OAAO,EAAE,UAAU,SAAS;KAC5B,YAAY;MAAE,UAAU;MAAK,MAAM;KAAU;eAG7C,oBAAC,OAAD;MAAK,WAAU;gBAAa;KAAa,CAAA;IAChC,GAXJ,QAAQ,GAAG,OAAO,SAAS,GAAG,CAW1B;GAEf,CAAC;EACc,CAAA;CACf,CAAA;AAER;;;ACpDA,IAAA,+BAAe"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
require("./FormContext-DsmS_mkO.cjs");
|
|
2
1
|
let _fuf_stack_pixel_utils = require("@fuf-stack/pixel-utils");
|
|
3
2
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
3
|
let _fuf_stack_pixel_motion = require("@fuf-stack/pixel-motion");
|
|
@@ -16,6 +15,10 @@ const FieldValidationError = ({ className = void 0, error = void 0, testId }) =>
|
|
|
16
15
|
initial: !disableAnimation,
|
|
17
16
|
children: error?.map(({ message }, i) => {
|
|
18
17
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_fuf_stack_pixel_motion.motion.li, {
|
|
18
|
+
animate: disableAnimation ? void 0 : {
|
|
19
|
+
opacity: 1,
|
|
20
|
+
height: "auto"
|
|
21
|
+
},
|
|
19
22
|
exit: disableAnimation ? void 0 : {
|
|
20
23
|
opacity: 0,
|
|
21
24
|
height: 0
|
|
@@ -29,10 +32,6 @@ const FieldValidationError = ({ className = void 0, error = void 0, testId }) =>
|
|
|
29
32
|
duration: .2,
|
|
30
33
|
ease: "circOut"
|
|
31
34
|
},
|
|
32
|
-
animate: disableAnimation ? void 0 : {
|
|
33
|
-
opacity: 1,
|
|
34
|
-
height: "auto"
|
|
35
|
-
},
|
|
36
35
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
37
36
|
className: "px-1 pt-1",
|
|
38
37
|
children: message
|
|
@@ -59,4 +58,4 @@ Object.defineProperty(exports, "FieldValidationError_default", {
|
|
|
59
58
|
}
|
|
60
59
|
});
|
|
61
60
|
|
|
62
|
-
//# sourceMappingURL=FieldValidationError-
|
|
61
|
+
//# sourceMappingURL=FieldValidationError-CfYKzl7P.cjs.map
|
package/dist/{FieldValidationError-BQcvvU9i.cjs.map → FieldValidationError-CfYKzl7P.cjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldValidationError-
|
|
1
|
+
{"version":3,"file":"FieldValidationError-CfYKzl7P.cjs","names":["AnimatePresence","motion"],"sources":["../src/partials/FieldValidationError/FieldValidationError.tsx","../src/partials/FieldValidationError/index.ts"],"sourcesContent":["import type { FieldError } from 'react-hook-form';\n\nimport {\n AnimatePresence,\n motion,\n useReducedMotion,\n} from '@fuf-stack/pixel-motion';\nimport { slugify } from '@fuf-stack/pixel-utils';\n\nexport interface FieldValidationErrorProps {\n /** CSS class name */\n className?: string;\n /** Field errors */\n error?: FieldError[];\n /** HTML data-testid attribute used in e2e tests */\n testId: string;\n}\n\n/**\n * Renders a validation error of a field\n */\nconst FieldValidationError = ({\n className = undefined,\n error = undefined,\n testId,\n}: FieldValidationErrorProps) => {\n // disable all animation if user prefers reduced motion\n const disableAnimation = useReducedMotion();\n\n return (\n <ul\n aria-label={`Validation errors of field ${testId}`}\n className={className}\n data-testid={slugify(`${testId}_error`)}\n >\n <AnimatePresence initial={!disableAnimation}>\n {error?.map(({ message }, i) => {\n return (\n <motion.li\n key={slugify(`${testId}_error_${i}`)}\n animate={\n disableAnimation ? undefined : { opacity: 1, height: 'auto' }\n }\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 >\n {/* wrap in div to apply padding and animation does not jump */}\n <div className=\"px-1 pt-1\">{message}</div>\n </motion.li>\n );\n })}\n </AnimatePresence>\n </ul>\n );\n};\n\nexport default FieldValidationError;\n","import FieldValidationError from './FieldValidationError';\n\nexport type { FieldValidationErrorProps } from './FieldValidationError';\n\nexport default FieldValidationError;\n"],"mappings":";;;;;;;AAqBA,MAAM,wBAAwB,EAC5B,YAAY,KAAA,GACZ,QAAQ,KAAA,GACR,aAC+B;CAE/B,MAAM,oBAAA,GAAA,wBAAA,kBAAoC;CAE1C,OACE,iBAAA,GAAA,kBAAA,KAAC,MAAD;EACE,cAAY,8BAA8B;EAC/B;EACX,gBAAA,GAAA,uBAAA,SAAqB,GAAG,OAAO,OAAO;YAEtC,iBAAA,GAAA,kBAAA,KAACA,wBAAAA,iBAAD;GAAiB,SAAS,CAAC;aACxB,OAAO,KAAK,EAAE,WAAW,MAAM;IAC9B,OACE,iBAAA,GAAA,kBAAA,KAACC,wBAAAA,OAAO,IAAR;KAEE,SACE,mBAAmB,KAAA,IAAY;MAAE,SAAS;MAAG,QAAQ;KAAO;KAE9D,MAAM,mBAAmB,KAAA,IAAY;MAAE,SAAS;MAAG,QAAQ;KAAE;KAC7D,SAAS,mBAAmB,QAAQ;MAAE,QAAQ;MAAG,SAAS;KAAE;KAC5D,OAAO,EAAE,UAAU,SAAS;KAC5B,YAAY;MAAE,UAAU;MAAK,MAAM;KAAU;eAG7C,iBAAA,GAAA,kBAAA,KAAC,OAAD;MAAK,WAAU;gBAAa;KAAa,CAAA;IAChC,IAAA,GAAA,uBAAA,SAXI,GAAG,OAAO,SAAS,GAAG,CAW1B;GAEf,CAAC;EACc,CAAA;CACf,CAAA;AAER;;;ACpDA,IAAA,+BAAe"}
|
package/dist/Form/index.cjs
CHANGED
|
@@ -2,6 +2,125 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const require_FormContext = require("../FormContext-EGH0cVnH.cjs");
|
|
6
|
+
const require_useFormContext = require("../useFormContext-kUHonwgu.cjs");
|
|
7
|
+
let _fuf_stack_pixel_utils = require("@fuf-stack/pixel-utils");
|
|
8
|
+
let react = require("react");
|
|
9
|
+
let react_icons_fa6 = require("react-icons/fa6");
|
|
10
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
|
+
let react_icons_fa = require("react-icons/fa");
|
|
12
|
+
let _fuf_stack_pixels_Button = require("@fuf-stack/pixels/Button");
|
|
13
|
+
let _fuf_stack_pixels_Card = require("@fuf-stack/pixels/Card");
|
|
14
|
+
let _fuf_stack_pixels_Json = require("@fuf-stack/pixels/Json");
|
|
15
|
+
require("@fuf-stack/pixels/Json.css");
|
|
16
|
+
//#region src/Form/subcomponents/FormDebugViewer.tsx
|
|
17
|
+
const EMPTY_VALUES = {};
|
|
18
|
+
/** Renders a form debug panel with information about the current form state */
|
|
19
|
+
const FormDebugViewer = ({ className = void 0 }) => {
|
|
20
|
+
const { debugMode, formState: { isValid, isSubmitting, submitCount, isSubmitSuccessful }, getValues, setDebugMode, validation: { errors }, subscribe } = require_useFormContext.useFormContext();
|
|
21
|
+
const showDebugButton = debugMode === "off";
|
|
22
|
+
const showDebugCard = debugMode === "debug" || debugMode === "debug-testids";
|
|
23
|
+
const showDebugTestIds = debugMode === "debug-testids";
|
|
24
|
+
const latestValuesRef = (0, react.useRef)(EMPTY_VALUES);
|
|
25
|
+
const values = (0, react.useSyncExternalStore)((onStoreChange) => {
|
|
26
|
+
if (!showDebugCard) return () => {};
|
|
27
|
+
latestValuesRef.current = getValues() ?? EMPTY_VALUES;
|
|
28
|
+
onStoreChange();
|
|
29
|
+
const unsubscribe = subscribe({
|
|
30
|
+
formState: { values: true },
|
|
31
|
+
callback: (state) => {
|
|
32
|
+
latestValuesRef.current = state.values ?? EMPTY_VALUES;
|
|
33
|
+
onStoreChange();
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
return () => {
|
|
37
|
+
unsubscribe();
|
|
38
|
+
};
|
|
39
|
+
}, () => {
|
|
40
|
+
if (!showDebugCard) return EMPTY_VALUES;
|
|
41
|
+
return latestValuesRef.current;
|
|
42
|
+
}, () => {
|
|
43
|
+
return EMPTY_VALUES;
|
|
44
|
+
});
|
|
45
|
+
if (showDebugButton) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_fuf_stack_pixels_Button.Button, {
|
|
46
|
+
ariaLabel: "Enable form debug mode",
|
|
47
|
+
className: "fixed bottom-2.5 right-2.5 w-5 text-default-400",
|
|
48
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_icons_fa6.FaBug, {}),
|
|
49
|
+
onClick: () => {
|
|
50
|
+
setDebugMode("debug");
|
|
51
|
+
},
|
|
52
|
+
variant: "light"
|
|
53
|
+
});
|
|
54
|
+
if (!showDebugCard) return null;
|
|
55
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_fuf_stack_pixels_Card.Card, {
|
|
56
|
+
className: (0, _fuf_stack_pixel_utils.cn)(className),
|
|
57
|
+
header: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
58
|
+
className: "flex w-full flex-row justify-between",
|
|
59
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
60
|
+
className: "text-lg",
|
|
61
|
+
children: "Debug Mode"
|
|
62
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_fuf_stack_pixels_Button.Button, {
|
|
63
|
+
color: "danger",
|
|
64
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_icons_fa.FaTimes, {}),
|
|
65
|
+
onClick: () => {
|
|
66
|
+
setDebugMode("off");
|
|
67
|
+
},
|
|
68
|
+
size: "sm",
|
|
69
|
+
variant: "light"
|
|
70
|
+
})]
|
|
71
|
+
}),
|
|
72
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_fuf_stack_pixels_Button.Button, {
|
|
73
|
+
className: "mb-4 ml-auto mr-auto",
|
|
74
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_icons_fa6.FaBullseye, {}),
|
|
75
|
+
onClick: () => {
|
|
76
|
+
setDebugMode(debugMode === "debug" ? "debug-testids" : "debug");
|
|
77
|
+
},
|
|
78
|
+
variant: showDebugTestIds ? "solid" : "light",
|
|
79
|
+
children: showDebugTestIds ? "Hide CopyButton" : "Show CopyButton"
|
|
80
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_fuf_stack_pixels_Json.Json, { value: {
|
|
81
|
+
values,
|
|
82
|
+
errors: errors ?? null,
|
|
83
|
+
submit: {
|
|
84
|
+
isValid,
|
|
85
|
+
isSubmitting,
|
|
86
|
+
isSubmitSuccessful,
|
|
87
|
+
submitCount
|
|
88
|
+
}
|
|
89
|
+
} })]
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
//#endregion
|
|
93
|
+
//#region src/Form/Form.tsx
|
|
94
|
+
const IS_TEST = process.env.NODE_ENV === "test";
|
|
95
|
+
/**
|
|
96
|
+
* Form component that has to wrap every uniform
|
|
97
|
+
*/
|
|
98
|
+
const Form = ({ children, className = void 0, debug = void 0, initialValues = void 0, name = void 0, onSubmit, testId = void 0, validation = void 0, validationTrigger = "all" }) => {
|
|
99
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FormContext.FormProvider, {
|
|
100
|
+
debugModeSettings: debug,
|
|
101
|
+
initialValues,
|
|
102
|
+
onSubmit,
|
|
103
|
+
validation,
|
|
104
|
+
validationTrigger,
|
|
105
|
+
children: ({ handleSubmit, isValid }) => {
|
|
106
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
107
|
+
className: "flex w-full flex-row justify-between gap-6",
|
|
108
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("form", {
|
|
109
|
+
className: (0, _fuf_stack_pixel_utils.cn)("grow", className),
|
|
110
|
+
"data-form-is-valid": isValid,
|
|
111
|
+
"data-testid": (0, _fuf_stack_pixel_utils.slugify)(testId ?? name ?? ""),
|
|
112
|
+
name,
|
|
113
|
+
onSubmit: handleSubmit,
|
|
114
|
+
children
|
|
115
|
+
}), !IS_TEST && !debug?.disable && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FormDebugViewer, { className: "w-96 shrink" })]
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
//#endregion
|
|
121
|
+
//#region src/Form/index.ts
|
|
122
|
+
var Form_default = Form;
|
|
123
|
+
//#endregion
|
|
124
|
+
exports.default = Form_default;
|
|
125
|
+
|
|
126
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["useFormContext","Button","FaBug","Card","FaTimes","FaBullseye","Json","FormProvider"],"sources":["../../src/Form/subcomponents/FormDebugViewer.tsx","../../src/Form/Form.tsx","../../src/Form/index.ts"],"sourcesContent":["import { useRef, useSyncExternalStore } from 'react';\nimport { FaTimes } from 'react-icons/fa';\nimport { FaBug, FaBullseye } from 'react-icons/fa6';\n\nimport { cn } from '@fuf-stack/pixel-utils';\nimport { Button } from '@fuf-stack/pixels/Button';\nimport { Card } from '@fuf-stack/pixels/Card';\nimport { Json } from '@fuf-stack/pixels/Json';\n\nimport { useFormContext } from '../../hooks/useFormContext';\n\n// import Json css (theme)\nimport '@fuf-stack/pixels/Json.css';\n\n// Stable empty snapshot used by useSyncExternalStore to avoid re-render loops.\nconst EMPTY_VALUES: Record<string, unknown> = {};\n\ninterface FormDebugViewerProps {\n /** CSS class name */\n className?: string;\n}\n\n/** Renders a form debug panel with information about the current form state */\nconst FormDebugViewer = ({ className = undefined }: FormDebugViewerProps) => {\n const {\n debugMode,\n formState: { isValid, isSubmitting, submitCount, isSubmitSuccessful },\n getValues,\n setDebugMode,\n validation: { errors },\n subscribe,\n } = useFormContext();\n\n const showDebugButton = debugMode === 'off';\n const showDebugCard = debugMode === 'debug' || debugMode === 'debug-testids';\n const showDebugTestIds = debugMode === 'debug-testids';\n const latestValuesRef = useRef<Record<string, unknown>>(EMPTY_VALUES);\n\n // Subscribe to RHF as an external store so this component updates itself\n // without forcing parent re-renders via watch().\n const values = useSyncExternalStore<Record<string, unknown>>(\n // subscribe: tell React how to listen for external store changes\n (onStoreChange) => {\n if (!showDebugCard) {\n // No-op while the panel is hidden to avoid unnecessary subscriptions.\n return () => {};\n }\n\n // Seed the snapshot once when the debug panel becomes visible.\n latestValuesRef.current = getValues() ?? EMPTY_VALUES;\n onStoreChange();\n\n const unsubscribe = subscribe({\n formState: { values: true },\n callback: (state) => {\n latestValuesRef.current = state.values ?? EMPTY_VALUES;\n // Notify React that a new snapshot is available.\n onStoreChange();\n },\n });\n\n return () => {\n // Ensure RHF subscription is always cleaned up.\n unsubscribe();\n };\n },\n // getSnapshot: return the current client-side value for this render.\n () => {\n if (!showDebugCard) {\n // Keep the debug payload empty when the panel is not visible.\n return EMPTY_VALUES;\n }\n\n return latestValuesRef.current;\n },\n // getServerSnapshot: stable fallback for non-client rendering environments.\n () => {\n return EMPTY_VALUES;\n },\n );\n\n if (showDebugButton) {\n return (\n <Button\n ariaLabel=\"Enable form debug mode\"\n className=\"fixed bottom-2.5 right-2.5 w-5 text-default-400\"\n icon={<FaBug />}\n onClick={() => {\n setDebugMode('debug');\n }}\n variant=\"light\"\n />\n );\n }\n\n // do not show card\n if (!showDebugCard) {\n return null;\n }\n\n return (\n <Card\n className={cn(className)}\n header={\n <div className=\"flex w-full flex-row justify-between\">\n <span className=\"text-lg\">Debug Mode</span>\n <Button\n color=\"danger\"\n icon={<FaTimes />}\n onClick={() => {\n setDebugMode('off');\n }}\n size=\"sm\"\n variant=\"light\"\n />\n </div>\n }\n >\n <Button\n className=\"mb-4 ml-auto mr-auto\"\n icon={<FaBullseye />}\n onClick={() => {\n setDebugMode(debugMode === 'debug' ? 'debug-testids' : 'debug');\n }}\n variant={showDebugTestIds ? 'solid' : 'light'}\n >\n {showDebugTestIds ? 'Hide CopyButton' : 'Show CopyButton'}\n </Button>\n <Json\n value={{\n values,\n errors: errors ?? null,\n submit: {\n isValid,\n isSubmitting,\n isSubmitSuccessful,\n submitCount,\n },\n }}\n />\n </Card>\n );\n};\n\nexport default FormDebugViewer;\n","import type { VetoInstance } from '@fuf-stack/veto';\nimport type { ReactNode } from 'react';\nimport type { FieldValues, SubmitHandler } from 'react-hook-form';\nimport type { DebugModeSettings } from './subcomponents/FormContext';\n\nimport { cn, slugify } from '@fuf-stack/pixel-utils';\n\nimport FormProvider from './subcomponents/FormContext';\nimport FormDebugViewer from './subcomponents/FormDebugViewer';\n\nconst IS_TEST = process.env.NODE_ENV === 'test';\n\nexport interface FormProps {\n /** form children */\n children: ReactNode | ReactNode[];\n /** CSS class name */\n className?: string | string[];\n /** settings for from debug mode */\n debug?: DebugModeSettings;\n /** initial form values */\n initialValues?: FieldValues;\n /** name of the form */\n name?: string;\n /** form submit handler */\n onSubmit: SubmitHandler<FieldValues>;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n /** veto validation schema */\n validation?: VetoInstance;\n /** when the validation should be triggered */\n validationTrigger?: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';\n}\n\n/**\n * Form component that has to wrap every uniform\n */\nconst Form = ({\n children,\n className = undefined,\n debug = undefined,\n initialValues = undefined,\n name = undefined,\n onSubmit,\n testId = undefined,\n validation = undefined,\n validationTrigger = 'all',\n}: FormProps) => {\n return (\n <FormProvider\n debugModeSettings={debug}\n initialValues={initialValues}\n onSubmit={onSubmit}\n validation={validation}\n validationTrigger={validationTrigger}\n >\n {({ handleSubmit, isValid }) => {\n return (\n <div className=\"flex w-full flex-row justify-between gap-6\">\n <form\n className={cn('grow', className)}\n data-form-is-valid={isValid}\n data-testid={slugify(testId ?? name ?? '')}\n name={name}\n onSubmit={handleSubmit}\n >\n {children}\n </form>\n {/* render debug viewer when not in test environment and debug not disabled */}\n {!IS_TEST && !debug?.disable && (\n <FormDebugViewer className=\"w-96 shrink\" />\n )}\n </div>\n );\n }}\n </FormProvider>\n );\n};\n\nexport default Form;\n","import Form from './Form';\n\nexport type { FormProps } from './Form';\n\nexport default Form;\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,MAAM,eAAwC,CAAC;;AAQ/C,MAAM,mBAAmB,EAAE,YAAY,KAAA,QAAsC;CAC3E,MAAM,EACJ,WACA,WAAW,EAAE,SAAS,cAAc,aAAa,sBACjD,WACA,cACA,YAAY,EAAE,UACd,cACEA,uBAAAA,eAAe;CAEnB,MAAM,kBAAkB,cAAc;CACtC,MAAM,gBAAgB,cAAc,WAAW,cAAc;CAC7D,MAAM,mBAAmB,cAAc;CACvC,MAAM,mBAAA,GAAA,MAAA,QAAkD,YAAY;CAIpE,MAAM,UAAA,GAAA,MAAA,uBAEH,kBAAkB;EACjB,IAAI,CAAC,eAEH,aAAa,CAAC;EAIhB,gBAAgB,UAAU,UAAU,KAAK;EACzC,cAAc;EAEd,MAAM,cAAc,UAAU;GAC5B,WAAW,EAAE,QAAQ,KAAK;GAC1B,WAAW,UAAU;IACnB,gBAAgB,UAAU,MAAM,UAAU;IAE1C,cAAc;GAChB;EACF,CAAC;EAED,aAAa;GAEX,YAAY;EACd;CACF,SAEM;EACJ,IAAI,CAAC,eAEH,OAAO;EAGT,OAAO,gBAAgB;CACzB,SAEM;EACJ,OAAO;CACT,CACF;CAEA,IAAI,iBACF,OACE,iBAAA,GAAA,kBAAA,KAACC,yBAAAA,QAAD;EACE,WAAU;EACV,WAAU;EACV,MAAM,iBAAA,GAAA,kBAAA,KAACC,gBAAAA,OAAD,CAAQ,CAAA;EACd,eAAe;GACb,aAAa,OAAO;EACtB;EACA,SAAQ;CACT,CAAA;CAKL,IAAI,CAAC,eACH,OAAO;CAGT,OACE,iBAAA,GAAA,kBAAA,MAACC,uBAAAA,MAAD;EACE,YAAA,GAAA,uBAAA,IAAc,SAAS;EACvB,QACE,iBAAA,GAAA,k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ET;IACG,CAAA,GAEL,CAAC,WAAW,CAAC,OAAO,WACnB,iBAAA,GAAA,kBAAA,KAAC,iBAAD,EAAiB,WAAU,cAAe,CAAA,CAEzC;;EAET;CACY,CAAA;AAElB;;;ACxEA,IAAA,eAAe"}
|
package/dist/Form/index.d.cts
CHANGED
|
@@ -1,2 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { t as DebugModeSettings } from "../FormContext-BLWS7bhO.cjs";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
import { VetoInstance } from "@fuf-stack/veto";
|
|
4
|
+
import { FieldValues, SubmitHandler } from "react-hook-form";
|
|
5
|
+
|
|
6
|
+
//#region src/Form/Form.d.ts
|
|
7
|
+
interface FormProps {
|
|
8
|
+
/** form children */
|
|
9
|
+
children: ReactNode | ReactNode[];
|
|
10
|
+
/** CSS class name */
|
|
11
|
+
className?: string | string[];
|
|
12
|
+
/** settings for from debug mode */
|
|
13
|
+
debug?: DebugModeSettings;
|
|
14
|
+
/** initial form values */
|
|
15
|
+
initialValues?: FieldValues;
|
|
16
|
+
/** name of the form */
|
|
17
|
+
name?: string;
|
|
18
|
+
/** form submit handler */
|
|
19
|
+
onSubmit: SubmitHandler<FieldValues>;
|
|
20
|
+
/** HTML data-testid attribute used in e2e tests */
|
|
21
|
+
testId?: string;
|
|
22
|
+
/** veto validation schema */
|
|
23
|
+
validation?: VetoInstance;
|
|
24
|
+
/** when the validation should be triggered */
|
|
25
|
+
validationTrigger?: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Form component that has to wrap every uniform
|
|
29
|
+
*/
|
|
30
|
+
declare const Form: ({
|
|
31
|
+
children,
|
|
32
|
+
className,
|
|
33
|
+
debug,
|
|
34
|
+
initialValues,
|
|
35
|
+
name,
|
|
36
|
+
onSubmit,
|
|
37
|
+
testId,
|
|
38
|
+
validation,
|
|
39
|
+
validationTrigger
|
|
40
|
+
}: FormProps) => import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
//#endregion
|
|
42
|
+
export { type FormProps, Form as default };
|
|
43
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/Form/Form.tsx"],"mappings":";;;;;;UAYiB,SAAA;;EAEf,QAAA,EAAU,SAAA,GAAY,SAAA;EAFE;EAIxB,SAAA;EAFU;EAIV,KAAA,GAAQ,iBAAA;EAAA;EAER,aAAA,GAAgB,WAAA;EAIQ;EAFxB,IAAA;EAMa;EAJb,QAAA,EAAU,aAAA,CAAc,WAAA;EAIC;EAFzB,MAAA;EAZU;EAcV,UAAA,GAAa,YAAA;EAZb;EAcA,iBAAA;AAAA;;;;cAMI,IAAA;EAAQ,QAAA;EAAA,SAAA;EAAA,KAAA;EAAA,aAAA;EAAA,IAAA;EAAA,QAAA;EAAA,MAAA;EAAA,UAAA;EAAA;AAAA,GAUX,SAAA,iCAAS,GAAA,CAAA,OAAA"}
|
package/dist/Form/index.d.ts
CHANGED
|
@@ -1,2 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { t as DebugModeSettings } from "../FormContext-LgzrDWu1.js";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
import { FieldValues, SubmitHandler } from "react-hook-form";
|
|
4
|
+
import { VetoInstance } from "@fuf-stack/veto";
|
|
5
|
+
|
|
6
|
+
//#region src/Form/Form.d.ts
|
|
7
|
+
interface FormProps {
|
|
8
|
+
/** form children */
|
|
9
|
+
children: ReactNode | ReactNode[];
|
|
10
|
+
/** CSS class name */
|
|
11
|
+
className?: string | string[];
|
|
12
|
+
/** settings for from debug mode */
|
|
13
|
+
debug?: DebugModeSettings;
|
|
14
|
+
/** initial form values */
|
|
15
|
+
initialValues?: FieldValues;
|
|
16
|
+
/** name of the form */
|
|
17
|
+
name?: string;
|
|
18
|
+
/** form submit handler */
|
|
19
|
+
onSubmit: SubmitHandler<FieldValues>;
|
|
20
|
+
/** HTML data-testid attribute used in e2e tests */
|
|
21
|
+
testId?: string;
|
|
22
|
+
/** veto validation schema */
|
|
23
|
+
validation?: VetoInstance;
|
|
24
|
+
/** when the validation should be triggered */
|
|
25
|
+
validationTrigger?: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Form component that has to wrap every uniform
|
|
29
|
+
*/
|
|
30
|
+
declare const Form: ({
|
|
31
|
+
children,
|
|
32
|
+
className,
|
|
33
|
+
debug,
|
|
34
|
+
initialValues,
|
|
35
|
+
name,
|
|
36
|
+
onSubmit,
|
|
37
|
+
testId,
|
|
38
|
+
validation,
|
|
39
|
+
validationTrigger
|
|
40
|
+
}: FormProps) => import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
//#endregion
|
|
42
|
+
export { type FormProps, Form as default };
|
|
43
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/Form/Form.tsx"],"mappings":";;;;;;UAYiB,SAAA;;EAEf,QAAA,EAAU,SAAA,GAAY,SAAA;EAFE;EAIxB,SAAA;EAFU;EAIV,KAAA,GAAQ,iBAAA;EAAA;EAER,aAAA,GAAgB,WAAA;EAIQ;EAFxB,IAAA;EAMa;EAJb,QAAA,EAAU,aAAA,CAAc,WAAA;EAIC;EAFzB,MAAA;EAZU;EAcV,UAAA,GAAa,YAAA;EAZb;EAcA,iBAAA;AAAA;;;;cAMI,IAAA;EAAQ,QAAA;EAAA,SAAA;EAAA,KAAA;EAAA,aAAA;EAAA,IAAA;EAAA,QAAA;EAAA,MAAA;EAAA,UAAA;EAAA;AAAA,GAUX,SAAA,iCAAS,GAAA,CAAA,OAAA"}
|
package/dist/Form/index.js
CHANGED
|
@@ -1,2 +1,122 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { t as FormProvider } from "../FormContext-DjJOJKxj.js";
|
|
2
|
+
import { n as useFormContext } from "../useFormContext-BJqa1FoT.js";
|
|
3
|
+
import { cn, slugify } from "@fuf-stack/pixel-utils";
|
|
4
|
+
import { useRef, useSyncExternalStore } from "react";
|
|
5
|
+
import { FaBug, FaBullseye } from "react-icons/fa6";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { FaTimes } from "react-icons/fa";
|
|
8
|
+
import { Button } from "@fuf-stack/pixels/Button";
|
|
9
|
+
import { Card } from "@fuf-stack/pixels/Card";
|
|
10
|
+
import { Json } from "@fuf-stack/pixels/Json";
|
|
11
|
+
import "@fuf-stack/pixels/Json.css";
|
|
12
|
+
//#region src/Form/subcomponents/FormDebugViewer.tsx
|
|
13
|
+
const EMPTY_VALUES = {};
|
|
14
|
+
/** Renders a form debug panel with information about the current form state */
|
|
15
|
+
const FormDebugViewer = ({ className = void 0 }) => {
|
|
16
|
+
const { debugMode, formState: { isValid, isSubmitting, submitCount, isSubmitSuccessful }, getValues, setDebugMode, validation: { errors }, subscribe } = useFormContext();
|
|
17
|
+
const showDebugButton = debugMode === "off";
|
|
18
|
+
const showDebugCard = debugMode === "debug" || debugMode === "debug-testids";
|
|
19
|
+
const showDebugTestIds = debugMode === "debug-testids";
|
|
20
|
+
const latestValuesRef = useRef(EMPTY_VALUES);
|
|
21
|
+
const values = useSyncExternalStore((onStoreChange) => {
|
|
22
|
+
if (!showDebugCard) return () => {};
|
|
23
|
+
latestValuesRef.current = getValues() ?? EMPTY_VALUES;
|
|
24
|
+
onStoreChange();
|
|
25
|
+
const unsubscribe = subscribe({
|
|
26
|
+
formState: { values: true },
|
|
27
|
+
callback: (state) => {
|
|
28
|
+
latestValuesRef.current = state.values ?? EMPTY_VALUES;
|
|
29
|
+
onStoreChange();
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
return () => {
|
|
33
|
+
unsubscribe();
|
|
34
|
+
};
|
|
35
|
+
}, () => {
|
|
36
|
+
if (!showDebugCard) return EMPTY_VALUES;
|
|
37
|
+
return latestValuesRef.current;
|
|
38
|
+
}, () => {
|
|
39
|
+
return EMPTY_VALUES;
|
|
40
|
+
});
|
|
41
|
+
if (showDebugButton) return /* @__PURE__ */ jsx(Button, {
|
|
42
|
+
ariaLabel: "Enable form debug mode",
|
|
43
|
+
className: "fixed bottom-2.5 right-2.5 w-5 text-default-400",
|
|
44
|
+
icon: /* @__PURE__ */ jsx(FaBug, {}),
|
|
45
|
+
onClick: () => {
|
|
46
|
+
setDebugMode("debug");
|
|
47
|
+
},
|
|
48
|
+
variant: "light"
|
|
49
|
+
});
|
|
50
|
+
if (!showDebugCard) return null;
|
|
51
|
+
return /* @__PURE__ */ jsxs(Card, {
|
|
52
|
+
className: cn(className),
|
|
53
|
+
header: /* @__PURE__ */ jsxs("div", {
|
|
54
|
+
className: "flex w-full flex-row justify-between",
|
|
55
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
56
|
+
className: "text-lg",
|
|
57
|
+
children: "Debug Mode"
|
|
58
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
59
|
+
color: "danger",
|
|
60
|
+
icon: /* @__PURE__ */ jsx(FaTimes, {}),
|
|
61
|
+
onClick: () => {
|
|
62
|
+
setDebugMode("off");
|
|
63
|
+
},
|
|
64
|
+
size: "sm",
|
|
65
|
+
variant: "light"
|
|
66
|
+
})]
|
|
67
|
+
}),
|
|
68
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
69
|
+
className: "mb-4 ml-auto mr-auto",
|
|
70
|
+
icon: /* @__PURE__ */ jsx(FaBullseye, {}),
|
|
71
|
+
onClick: () => {
|
|
72
|
+
setDebugMode(debugMode === "debug" ? "debug-testids" : "debug");
|
|
73
|
+
},
|
|
74
|
+
variant: showDebugTestIds ? "solid" : "light",
|
|
75
|
+
children: showDebugTestIds ? "Hide CopyButton" : "Show CopyButton"
|
|
76
|
+
}), /* @__PURE__ */ jsx(Json, { value: {
|
|
77
|
+
values,
|
|
78
|
+
errors: errors ?? null,
|
|
79
|
+
submit: {
|
|
80
|
+
isValid,
|
|
81
|
+
isSubmitting,
|
|
82
|
+
isSubmitSuccessful,
|
|
83
|
+
submitCount
|
|
84
|
+
}
|
|
85
|
+
} })]
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/Form/Form.tsx
|
|
90
|
+
const IS_TEST = process.env.NODE_ENV === "test";
|
|
91
|
+
/**
|
|
92
|
+
* Form component that has to wrap every uniform
|
|
93
|
+
*/
|
|
94
|
+
const Form = ({ children, className = void 0, debug = void 0, initialValues = void 0, name = void 0, onSubmit, testId = void 0, validation = void 0, validationTrigger = "all" }) => {
|
|
95
|
+
return /* @__PURE__ */ jsx(FormProvider, {
|
|
96
|
+
debugModeSettings: debug,
|
|
97
|
+
initialValues,
|
|
98
|
+
onSubmit,
|
|
99
|
+
validation,
|
|
100
|
+
validationTrigger,
|
|
101
|
+
children: ({ handleSubmit, isValid }) => {
|
|
102
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
103
|
+
className: "flex w-full flex-row justify-between gap-6",
|
|
104
|
+
children: [/* @__PURE__ */ jsx("form", {
|
|
105
|
+
className: cn("grow", className),
|
|
106
|
+
"data-form-is-valid": isValid,
|
|
107
|
+
"data-testid": slugify(testId ?? name ?? ""),
|
|
108
|
+
name,
|
|
109
|
+
onSubmit: handleSubmit,
|
|
110
|
+
children
|
|
111
|
+
}), !IS_TEST && !debug?.disable && /* @__PURE__ */ jsx(FormDebugViewer, { className: "w-96 shrink" })]
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region src/Form/index.ts
|
|
118
|
+
var Form_default = Form;
|
|
119
|
+
//#endregion
|
|
120
|
+
export { Form_default as default };
|
|
121
|
+
|
|
122
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/Form/subcomponents/FormDebugViewer.tsx","../../src/Form/Form.tsx","../../src/Form/index.ts"],"sourcesContent":["import { useRef, useSyncExternalStore } from 'react';\nimport { FaTimes } from 'react-icons/fa';\nimport { FaBug, FaBullseye } from 'react-icons/fa6';\n\nimport { cn } from '@fuf-stack/pixel-utils';\nimport { Button } from '@fuf-stack/pixels/Button';\nimport { Card } from '@fuf-stack/pixels/Card';\nimport { Json } from '@fuf-stack/pixels/Json';\n\nimport { useFormContext } from '../../hooks/useFormContext';\n\n// import Json css (theme)\nimport '@fuf-stack/pixels/Json.css';\n\n// Stable empty snapshot used by useSyncExternalStore to avoid re-render loops.\nconst EMPTY_VALUES: Record<string, unknown> = {};\n\ninterface FormDebugViewerProps {\n /** CSS class name */\n className?: string;\n}\n\n/** Renders a form debug panel with information about the current form state */\nconst FormDebugViewer = ({ className = undefined }: FormDebugViewerProps) => {\n const {\n debugMode,\n formState: { isValid, isSubmitting, submitCount, isSubmitSuccessful },\n getValues,\n setDebugMode,\n validation: { errors },\n subscribe,\n } = useFormContext();\n\n const showDebugButton = debugMode === 'off';\n const showDebugCard = debugMode === 'debug' || debugMode === 'debug-testids';\n const showDebugTestIds = debugMode === 'debug-testids';\n const latestValuesRef = useRef<Record<string, unknown>>(EMPTY_VALUES);\n\n // Subscribe to RHF as an external store so this component updates itself\n // without forcing parent re-renders via watch().\n const values = useSyncExternalStore<Record<string, unknown>>(\n // subscribe: tell React how to listen for external store changes\n (onStoreChange) => {\n if (!showDebugCard) {\n // No-op while the panel is hidden to avoid unnecessary subscriptions.\n return () => {};\n }\n\n // Seed the snapshot once when the debug panel becomes visible.\n latestValuesRef.current = getValues() ?? EMPTY_VALUES;\n onStoreChange();\n\n const unsubscribe = subscribe({\n formState: { values: true },\n callback: (state) => {\n latestValuesRef.current = state.values ?? EMPTY_VALUES;\n // Notify React that a new snapshot is available.\n onStoreChange();\n },\n });\n\n return () => {\n // Ensure RHF subscription is always cleaned up.\n unsubscribe();\n };\n },\n // getSnapshot: return the current client-side value for this render.\n () => {\n if (!showDebugCard) {\n // Keep the debug payload empty when the panel is not visible.\n return EMPTY_VALUES;\n }\n\n return latestValuesRef.current;\n },\n // getServerSnapshot: stable fallback for non-client rendering environments.\n () => {\n return EMPTY_VALUES;\n },\n );\n\n if (showDebugButton) {\n return (\n <Button\n ariaLabel=\"Enable form debug mode\"\n className=\"fixed bottom-2.5 right-2.5 w-5 text-default-400\"\n icon={<FaBug />}\n onClick={() => {\n setDebugMode('debug');\n }}\n variant=\"light\"\n />\n );\n }\n\n // do not show card\n if (!showDebugCard) {\n return null;\n }\n\n return (\n <Card\n className={cn(className)}\n header={\n <div className=\"flex w-full flex-row justify-between\">\n <span className=\"text-lg\">Debug Mode</span>\n <Button\n color=\"danger\"\n icon={<FaTimes />}\n onClick={() => {\n setDebugMode('off');\n }}\n size=\"sm\"\n variant=\"light\"\n />\n </div>\n }\n >\n <Button\n className=\"mb-4 ml-auto mr-auto\"\n icon={<FaBullseye />}\n onClick={() => {\n setDebugMode(debugMode === 'debug' ? 'debug-testids' : 'debug');\n }}\n variant={showDebugTestIds ? 'solid' : 'light'}\n >\n {showDebugTestIds ? 'Hide CopyButton' : 'Show CopyButton'}\n </Button>\n <Json\n value={{\n values,\n errors: errors ?? null,\n submit: {\n isValid,\n isSubmitting,\n isSubmitSuccessful,\n submitCount,\n },\n }}\n />\n </Card>\n );\n};\n\nexport default FormDebugViewer;\n","import type { VetoInstance } from '@fuf-stack/veto';\nimport type { ReactNode } from 'react';\nimport type { FieldValues, SubmitHandler } from 'react-hook-form';\nimport type { DebugModeSettings } from './subcomponents/FormContext';\n\nimport { cn, slugify } from '@fuf-stack/pixel-utils';\n\nimport FormProvider from './subcomponents/FormContext';\nimport FormDebugViewer from './subcomponents/FormDebugViewer';\n\nconst IS_TEST = process.env.NODE_ENV === 'test';\n\nexport interface FormProps {\n /** form children */\n children: ReactNode | ReactNode[];\n /** CSS class name */\n className?: string | string[];\n /** settings for from debug mode */\n debug?: DebugModeSettings;\n /** initial form values */\n initialValues?: FieldValues;\n /** name of the form */\n name?: string;\n /** form submit handler */\n onSubmit: SubmitHandler<FieldValues>;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n /** veto validation schema */\n validation?: VetoInstance;\n /** when the validation should be triggered */\n validationTrigger?: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';\n}\n\n/**\n * Form component that has to wrap every uniform\n */\nconst Form = ({\n children,\n className = undefined,\n debug = undefined,\n initialValues = undefined,\n name = undefined,\n onSubmit,\n testId = undefined,\n validation = undefined,\n validationTrigger = 'all',\n}: FormProps) => {\n return (\n <FormProvider\n debugModeSettings={debug}\n initialValues={initialValues}\n onSubmit={onSubmit}\n validation={validation}\n validationTrigger={validationTrigger}\n >\n {({ handleSubmit, isValid }) => {\n return (\n <div className=\"flex w-full flex-row justify-between gap-6\">\n <form\n className={cn('grow', className)}\n data-form-is-valid={isValid}\n data-testid={slugify(testId ?? name ?? '')}\n name={name}\n onSubmit={handleSubmit}\n >\n {children}\n </form>\n {/* render debug viewer when not in test environment and debug not disabled */}\n {!IS_TEST && !debug?.disable && (\n <FormDebugViewer className=\"w-96 shrink\" />\n )}\n </div>\n );\n }}\n </FormProvider>\n );\n};\n\nexport default Form;\n","import Form from './Form';\n\nexport type { FormProps } from './Form';\n\nexport default Form;\n"],"mappings":";;;;;;;;;;;;AAeA,MAAM,eAAwC,CAAC;;AAQ/C,MAAM,mBAAmB,EAAE,YAAY,KAAA,QAAsC;CAC3E,MAAM,EACJ,WACA,WAAW,EAAE,SAAS,cAAc,aAAa,sBACjD,WACA,cACA,YAAY,EAAE,UACd,cACE,eAAe;CAEnB,MAAM,kBAAkB,cAAc;CACtC,MAAM,gBAAgB,cAAc,WAAW,cAAc;CAC7D,MAAM,mBAAmB,cAAc;CACvC,MAAM,kBAAkB,OAAgC,YAAY;CAIpE,MAAM,SAAS,sBAEZ,kBA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gB,KAAA,GAChB,OAAO,KAAA,GACP,UACA,SAAS,KAAA,GACT,aAAa,KAAA,GACb,oBAAoB,YACL;CACf,OACE,oBAAC,cAAD;EACE,mBAAmB;EACJ;EACL;EACE;EACO;aAEjB,EAAE,cAAc,cAAc;GAC9B,OACE,qBAAC,OAAD;IAAK,WAAU;cAAf,CACE,oBAAC,QAAD;KACE,WAAW,GAAG,QAAQ,SAAS;KAC/B,sBAAoB;KACpB,eAAa,QAAQ,UAAU,QAAQ,EAAE;KACnC;KACN,UAAU;KAET;IACG,CAAA,GAEL,CAAC,WAAW,CAAC,OAAO,WACnB,oBAAC,iBAAD,EAAiB,WAAU,cAAe,CAAA,CAEzC;;EAET;CACY,CAAA;AAElB;;;ACxEA,IAAA,eAAe"}
|
|
@@ -17,4 +17,4 @@ type FormResetListener = () => void;
|
|
|
17
17
|
type UserChangeListener<TFieldValues extends object = object> = (fieldName: Path<TFieldValues>, value: unknown) => void;
|
|
18
18
|
//#endregion
|
|
19
19
|
export { FormResetListener as n, UserChangeListener as r, DebugModeSettings as t };
|
|
20
|
-
//# sourceMappingURL=FormContext-
|
|
20
|
+
//# sourceMappingURL=FormContext-BLWS7bhO.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormContext-
|
|
1
|
+
{"version":3,"file":"FormContext-BLWS7bhO.d.cts","names":[],"sources":["../src/Form/subcomponents/FormContext.tsx"],"mappings":";;;;;UAsBiB,iBAAA;EAAiB;EAEhC,OAAA;EAAA;EAEA,eAAe;AAAA;;KAIL,iBAAA;;AAAiB;AAK7B;KAAY,kBAAA,0CACV,SAAA,EAAW,IAAI,CAAC,YAAA,GAChB,KAAA"}
|