-
Notifications
You must be signed in to change notification settings - Fork 26
/
types.ts
48 lines (43 loc) · 1.38 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { FormikProps, FormikErrors } from 'formik'
import { WizardContext, WizardProps } from 'react-albus'
import { Schema } from 'yup'
export type FormikWizardBaseValues = any
export interface FormikWizardContextValue<V = any, S = any> {
status: S
setStatus: React.Dispatch<React.SetStateAction<S>>
values: V
setValues: React.Dispatch<React.SetStateAction<V>>
}
export interface FormikWizardStepType {
id: string
component: React.SFC<{}>
validationSchema?: Schema<any>
validate?: (values: any) => void | object | Promise<FormikErrors<any>>,
initialValues?: FormikWizardBaseValues
actionLabel?: string
onAction?: (
sectionValues: FormikWizardBaseValues,
formValues: FormikWizardBaseValues
) => Promise<any>
keepValuesOnPrevious?: boolean
}
export interface FormikWizardWrapperProps<Values, Status = any>
extends FormikWizardContextValue<Values, Status> {
canGoBack: boolean
goToPreviousStep: () => void
currentStep: string
actionLabel?: string
isLastStep: boolean
steps: string[]
wizard: WizardContext
children: React.ReactNode
isSubmitting: boolean
}
export interface FormikWizardProps<Values, Status = any> {
steps: FormikWizardStepType[]
render: React.SFC<FormikWizardWrapperProps<Values, Status>>
onSubmit: (values: Values) => void | Promise<void>
formikProps?: Partial<FormikProps<Values>>
albusProps?: Partial<WizardProps>
Form?: any
}