| 1 |
import { createContext } from 'react'; |
| 2 |
import { WizardStep } from './Wizard'; |
| 3 |
|
| 4 |
export interface WizardContextType { |
| 5 |
goToStepById: (stepId: number | string) => void; |
| 6 |
goToStepByName: (stepName: string) => void; |
| 7 |
onNext: () => void; |
| 8 |
onBack: () => void; |
| 9 |
onClose: () => void; |
| 10 |
activeStep: WizardStep; |
| 11 |
} |
| 12 |
|
| 13 |
export const WizardContext = createContext<WizardContextType>({ |
| 14 |
goToStepById: () => null, |
| 15 |
goToStepByName: () => null, |
| 16 |
onNext: () => null, |
| 17 |
onBack: () => null, |
| 18 |
onClose: () => null, |
| 19 |
activeStep: { name: null } |
| 20 |
}); |
| 21 |
|
| 22 |
export const WizardContextProvider = WizardContext.Provider; |
| 23 |
export const WizardContextConsumer = WizardContext.Consumer; |