@tutim/headless
Version:
form infrastructure for web applications
34 lines (33 loc) • 1.13 kB
TypeScript
import { FormConfig } from '@tutim/types';
import React from 'react';
interface WizardContext {
config: FormConfig;
activeStep: number;
goToStep: (stepIndex: number) => void;
wizardValues: Record<string, any>;
setWizardValues: React.Dispatch<React.SetStateAction<Record<string, any>>>;
onStepSubmit: (stepValues: any, isFinalStep?: boolean) => void;
}
export declare const WizardContext: React.Context<WizardContext>;
export declare const useWizardContext: () => WizardContext;
export declare const useWizard: ({ initialValues, onSubmit, config, wizardContext }: {
initialValues?: {} | undefined;
onSubmit: any;
config: any;
wizardContext?: undefined;
}) => {
config: any;
stepCount: any;
activeStep: number;
wizardValues: any;
goToStep: (nextStepIndex: number) => void;
setWizardValues: React.Dispatch<any>;
onStepSubmit: (stepValues: any, isFinalStep?: boolean) => void;
};
declare type WizardProvder = (props: {
wizardContext: WizardContext;
} & {
children: React.ReactNode;
}) => any;
export declare const WizardProvider: WizardProvder;
export {};