form-test-victor
Version:
# Performant forms and wizard library for React
34 lines • 1.87 kB
TypeScript
import { Dispatch, ReactNode, SetStateAction } from 'react';
import { FieldValues, VALIDATION_OUTCOME } from '../../shared';
import { PlaceholderContentSetter, StepValidator } from '../types';
export declare type ValidationStatusesSetter = Dispatch<SetStateAction<VALIDATION_OUTCOME>>;
export interface WizardContextApi {
steps: string[];
currentStep: string | undefined;
registerStep: (name: string, validationFn?: StepValidator, noFooter?: boolean, title?: string) => void;
unregisterStep: (name: string) => void;
handleOnNext: () => Promise<void>;
handleOnPrevious: () => void;
updatePlaceholderContent: (placement: string, children: ReactNode) => void;
resetPlaceholderContent: (placement?: string) => void;
registerPlaceholder: (placeholderContentSetter: PlaceholderContentSetter, stepStatusSetter: ValidationStatusesSetter) => void;
unregisterPlaceholder: (placeholderContentSetter: PlaceholderContentSetter, stepStatusSetter: ValidationStatusesSetter) => void;
isLastStep: boolean;
isFirstStep: boolean;
hasNoFooter: boolean;
stepStatusSetter: ValidationStatusesSetter;
isStepReady: boolean;
stepsTitles: {
name: string;
title: string | undefined;
}[];
setIsStepReady: Dispatch<SetStateAction<boolean>>;
setValuesGetterForCurrentStep: (stepValuesGetter: () => FieldValues | undefined) => void;
getValuesOfCurrentStep: () => FieldValues | undefined;
getValuesOfStep: (stepName: string) => FieldValues | undefined;
getValuesOfSteps: () => Record<string, FieldValues | undefined>;
}
export declare const CONTEXT_WIZARD_DEFAULT: WizardContextApi;
export declare const WizardContext: import("react").Context<WizardContextApi>;
export declare function useWizardContext(): WizardContextApi;
//# sourceMappingURL=WizardContext.d.ts.map