diff --git a/components/Form/Input/Input.tsx b/components/Form/Input/Input.tsx index 41d8c2876..5ad1a55bc 100644 --- a/components/Form/Input/Input.tsx +++ b/components/Form/Input/Input.tsx @@ -8,16 +8,18 @@ import Alert from 'components/Alert/Alert'; import styles from './Input.module.css'; /** @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes_common_to_all_input_types */ -interface InputProps extends Omit, 'form'> { +interface InputProps extends Omit, 'disabled' | 'form'> { field: FieldInputProps; form: FormikState> & FormikHelpers>; hasValidationStyling?: boolean; + isDisabled?: boolean; isLabelHidden?: boolean; label: string; } function Input({ className, + isDisabled = false, field: { name, value, ...field }, form: { touched, errors }, hasValidationStyling = true, @@ -47,6 +49,7 @@ function Input({ [styles.valid]: touched[name] && !hasErrors && hasValidationStyling, [styles.invalid]: touched[name] && hasErrors && hasValidationStyling, })} + disabled={isDisabled} id={id || name} name={name} type={type} diff --git a/components/Form/Input/__tests__/__snapshots__/Input.test.tsx.snap b/components/Form/Input/__tests__/__snapshots__/Input.test.tsx.snap index dc8f4262d..8ad58b673 100644 --- a/components/Form/Input/__tests__/__snapshots__/Input.test.tsx.snap +++ b/components/Form/Input/__tests__/__snapshots__/Input.test.tsx.snap @@ -18,6 +18,7 @@ exports[`Input > should render with required props 1`] = ` > ( + +); interface MultiStepFormProps { initialValues: T; @@ -107,18 +113,16 @@ export function MultiStepForm {formikBag => ( -
-

{CurrentStep.title}

+ +

{CurrentStep.title}

-
- {errorMessage && {errorMessage}} -
+
{errorMessage && {errorMessage}}
-
+
{!isFirstStep && ( ) : ( )}
diff --git a/components/Form/Select/SelectMulti.tsx b/components/Form/Select/SelectMulti.tsx index 09febc4bb..3eadfcdc4 100644 --- a/components/Form/Select/SelectMulti.tsx +++ b/components/Form/Select/SelectMulti.tsx @@ -10,7 +10,7 @@ import styles from './Select.module.css'; export interface SelectMultiProps extends Pick, 'id' | 'hasValidationStyling' | 'isSearchable'> { className?: string; - field: FieldInputProps; + field: FieldInputProps<{ label: string; value: string }[]>; form: FormikState> & FormikHelpers>; isLabelHidden?: boolean; label: string; @@ -29,22 +29,8 @@ export function SelectMulti({ options, ...props // disabled, placeholder, etc. }: SelectMultiProps) { - const value = options.filter(option => fieldValue.includes(option.value)); const hasErrors = Boolean(errors[name]); - const sharedProps = { - ...props, - id: id ? `${id}` : name, - hasErrors, - hasValidationStyling, - isTouched: Boolean(touched[name]), - isSearchable, - name, - onBlur: () => setFieldTouched(name), - options, - value, - }; - return (