import { NavigationType } from "../shared/types/header.js"; import React from "react"; //#region src/components/form/StepControlContext.d.ts /** * Interface for step control context values */ interface StepControlContextType { /** * Current active step index */ currentStep: number; /** * Navigate to a specific step * @param step - The step index to navigate to */ goToStep: (step: number) => void; /** * Jump to a specific step without transition animation * @param step - The step index to jump to */ jumpTo: (step: number) => void; /** * Navigate to the next step */ handleNext: () => Promise; /** * Navigate to the previous step */ handlePrevious: () => Promise; /** * Retry the current step */ handleRetry: () => Promise; /** * Number of times the current step has been retried */ retryCount: number; /** * Whether the current step is the first step */ isFirstStep: boolean; /** * Whether the current step is the last step */ isLastStep: boolean; /** * Total number of steps */ totalSteps: number; /** * Transition state with navigation direction */ transitionState: { direction: "backward" | "forward" | null; enteringStep: null | number; exitingStep: null | number; }; } interface StepControlProviderProps { children: React.ReactNode; /** * Default step to start on */ defaultStep?: number; /** * Function to handle step submission */ handleStepSubmit?: () => Promise; /** * Whether to validate when going back steps */ isBackValidate?: boolean; /** * Callback when step changes */ onStepChange?: (step: number) => void; /** * Callback when step is retried */ onStepRetry?: (step: number) => void; /** * Callback when navigation starts */ onNavigationStart?: (fromStep: number, toStep: number, type: NavigationType) => void; /** * Callback when navigation ends successfully */ onNavigationEnd?: (fromStep: number, toStep: number, type: NavigationType) => void; /** * Callback when navigation fails */ onNavigationError?: (fromStep: number, toStep: number, type: NavigationType, error: any) => void; /** * Total number of steps */ totalSteps?: number; /** * Function to trigger validation for the current step */ triggerValidation?: () => Promise; } /** * Hook to create step control state independently * This hook can be used outside of StepControlProvider */ interface UseCreateStepControlOptions { /** * Default step to start on * @default 1 */ defaultStep?: number; /** * Function to handle step submission */ handleStepSubmit?: () => Promise; /** * Whether to validate when going back steps * @default false */ isBackValidate?: boolean; /** * Callback when step changes */ onStepChange?: (step: number) => void; /** * Callback when step is retried */ onStepRetry?: (step: number) => void; /** * Callback when navigation starts */ onNavigationStart?: (fromStep: number, toStep: number, type: NavigationType) => void; /** * Callback when navigation ends successfully */ onNavigationEnd?: (fromStep: number, toStep: number, type: NavigationType) => void; /** * Callback when navigation fails */ onNavigationError?: (fromStep: number, toStep: number, type: NavigationType, error: any) => void; /** * Total number of steps */ totalSteps: number; /** * Function to trigger validation for the current step */ triggerValidation?: () => Promise; } /** * Provider component for step control functionality * Handles step navigation logic and state management */ declare function StepControlProvider({ children, defaultStep, handleStepSubmit, isBackValidate, onStepChange, onStepRetry, onNavigationStart, onNavigationEnd, onNavigationError, totalSteps, triggerValidation }: StepControlProviderProps): React.JSX.Element; declare function useCreateStepControl({ defaultStep, handleStepSubmit, isBackValidate, onStepChange, onStepRetry, onNavigationStart, onNavigationEnd, onNavigationError, totalSteps: totalStepsProp, triggerValidation }: UseCreateStepControlOptions): StepControlContextType; /** * Hook to optionally consume the step control context * @returns StepControlContextType | undefined - Step control methods and state, or undefined if not in context */ declare function useOptionalStepControlContext(): StepControlContextType | undefined; /** * Backward compatibility hook * This maintains the original API where useStepControl could be used as both * a context consumer and a creator depending on whether options were passed */ declare function useStepControl(options?: UseCreateStepControlOptions): StepControlContextType; /** * Hook to consume the step control context * @returns StepControlContextType - Step control methods and state * @throws Error if used outside StepControlProvider */ declare function useStepControlContext(): StepControlContextType; //#endregion export { StepControlContextType, StepControlProvider, StepControlProviderProps, UseCreateStepControlOptions, useCreateStepControl, useOptionalStepControlContext, useStepControl, useStepControlContext }; //# sourceMappingURL=StepControlContext.d.ts.map