@visa/nova-react
Version:
Visa Product Design System Nova React library. Compatible with React ^19.
62 lines (61 loc) • 2.3 kB
TypeScript
type UseWizardOptions = {
/** Auto progress on complete */
autoProgressComplete?: boolean;
/** Auto progress on error */
autoProgressError?: boolean;
/** Current step */
defaultActiveStep?: number;
/** If the complete and error sets are mutually exclusive */
isExclusiveSets?: boolean;
/** Length of steps */
length: number;
};
type WizardEventOptions = {
/** Auto progress */
autoProgress?: boolean;
};
/**
* @docs {@link https://design.visa.com/patterns/wizard | See Docs}
* @description This hook is used to control the state of a wizard component.
* @related wizard
* @vgar TODO
* @wcag TODO
*/
export declare const useWizard: {
(useWizardOptions?: UseWizardOptions): {
/** Return the current step of the wizard */
currentStep: number;
/** Check if the wizard has any error step */
hasError: () => boolean;
/** Check if the step is available */
isStepAvailable: (index: number) => boolean;
/** Check if the current step is the first step */
isFirstStep: (index: number) => index is 0;
/** Check if the current step is the last step */
isLastStep: (index: number) => boolean;
/** Check if the step is completed */
isStepComplete: (index: number) => boolean;
/** Check if the step has an error */
isStepError: (index: number) => boolean;
/** Check if the wizard is complete */
isWizardComplete: () => boolean;
/** Return the maximum available step of the wizard */
maxStep: number;
/** Move to the selected step */
onStepChange: (index: number) => void;
/** Move to the next step */
onStepNext: () => void;
/** Move to the previous step */
onStepPrevious: () => void;
/** Mark the step as complete */
onStepComplete: (index: number, { autoProgress }?: WizardEventOptions) => void;
/** Mark the step as error */
onStepError: (index: number, { autoProgress }?: WizardEventOptions) => void;
/** Reset the step status */
onStepReset: (index: number) => void;
/** Reset the wizard status */
onWizardReset: (index?: number) => void;
};
displayName: string;
};
export default useWizard;