UNPKG

formik-pf

Version:

A UI library that provides formik bindings with PF components.

45 lines (44 loc) 2.19 kB
import * as React from 'react'; import { FormikConfig, FormikHelpers, FormikValues } from 'formik'; import { InternalWizardProps } from './InternalWizard'; export type FormikWizardStep = { /** Optional identifier */ id?: string | number; /** The name of the step */ name: React.ReactNode; /** The component to render in the main body */ component: React.ReactNode; /** Optional validation schema object for the current step */ validationSchema?: any | (() => any); /** Tells Formik to validate the form on each input's onChange event */ validateOnChange?: boolean; /** Tells Formik to validate the form on each input's onBlur event */ validateOnBlur?: boolean; /** Tells Formik to validate upon mount */ validateOnMount?: boolean; /** (Unused if footer is controlled) The Next button text */ nextButtonText?: React.ReactNode; /** (Unused if footer is controlled) The Back button text */ backButtonText?: React.ReactNode; /** (Unused if footer is controlled) The Cancel button text */ cancelButtonText?: React.ReactNode; /** (Unused if footer is controlled) The condition needed to disable the Next button */ disableNext?: boolean; /** (Unused if footer is controlled) The condition needed to disable the Back button */ disableBack?: boolean; /** Enables or disables the step in the navigation. Enabled by default. */ canJumpTo?: boolean; /** Removes the default body padding for the step. */ hasNoBodyPadding?: boolean; /** Sets the Form to horizontal. */ isFormHorizontal?: boolean; /** Flag to limit the max-width to 500px. */ isFormWidthLimited?: boolean; /** Handler to be called before moving to next step */ onSubmit?: (values: FormikValues, formikBag: FormikHelpers<FormikValues>) => Promise<any>; }; type FormikWizardProps = InternalWizardProps & Pick<FormikConfig<FormikValues>, 'initialValues' | 'onSubmit' | 'onReset' | 'enableReinitialize' | 'validateOnChange' | 'validateOnBlur' | 'validateOnMount'> & { steps: FormikWizardStep[]; }; declare const FormikWizard: React.FunctionComponent<FormikWizardProps>; export default FormikWizard;