brewkit / components

An easy-to-theme design system for creating impactful UIs using React and TypeScript.
MIT License
5 stars 5 forks source link

validation does not disable button when manually controlling disable/loading state #232

Open emdrayallday opened 2 years ago

emdrayallday commented 2 years ago

For cases when you want to manually trigger a loading or disabled state, it will override the form state of

isValid / isValidating / isSubmitting for disabled isSubmitting for loading

How to reproduce

Implementation of FormSubmit component

<FormSubmit
    disabled={customDisable}
    loading={customLoading}
/>

Brewkit FormSubmit component

The rest operator is overriding the disabled/loading state respectively when it should be included with the form state

<Button
    disabled={!formState.isValid || formState.isSubmitting || formState.isValidating}
    loading={formState.isSubmitting}
    ref={ref}
    type="submit"
    {...otherProps}
>
    {children}
</Button>