@moontra/moonui-pro
Version:
Premium React components for MoonUI - Advanced UI library with 50+ pro components including performance, interactive, and gesture components
76 lines (72 loc) • 2.33 kB
text/typescript
import { ReactNode } from "react"
export interface WizardStep {
id: string
title: string
description?: string
icon?: ReactNode | ((props: { isActive: boolean; isCompleted: boolean }) => ReactNode)
content: ReactNode | ((props: WizardStepContentProps) => ReactNode)
validation?: () => boolean | Promise<boolean>
isOptional?: boolean
isDisabled?: boolean | ((currentStep: number, steps: WizardStep[]) => boolean)
onEnter?: () => void | Promise<void>
onExit?: () => void | Promise<void>
}
export interface WizardStepContentProps {
currentStep: number
totalSteps: number
goToNext: () => void
goToPrevious: () => void
goToStep: (step: number) => void
isFirstStep: boolean
isLastStep: boolean
stepData: any
updateStepData: (data: any) => void
}
export interface FormWizardProps {
steps: WizardStep[]
currentStep?: number
onStepChange?: (step: number, previousStep: number) => void
onComplete?: (data: Record<string, any>) => void | Promise<void>
orientation?: 'horizontal' | 'vertical'
progressType?: 'linear' | 'circular' | 'dots' | 'custom'
allowStepSkip?: boolean
allowBackNavigation?: boolean
validateOnStepChange?: boolean
animationType?: 'slide' | 'fade' | 'scale' | 'none'
animationDuration?: number
showStepNumbers?: boolean
showStepTitles?: boolean
showProgressBar?: boolean
stepIconPosition?: 'top' | 'left' | 'inside'
completedStepIcon?: ReactNode
activeStepIcon?: ReactNode
errorStepIcon?: ReactNode
className?: string
progressClassName?: string
navigationClassName?: string
contentClassName?: string
stepClassName?: string
autoSave?: boolean
autoSaveDelay?: number
onAutoSave?: (stepId: string, data: any) => void | Promise<void>
persistData?: boolean
storageKey?: string
}
export interface WizardContextValue {
steps: WizardStep[]
currentStep: number
stepData: Record<string, any>
isLoading: boolean
error: string | null
goToNext: () => void
goToPrevious: () => void
goToStep: (step: number) => void
updateStepData: (stepId: string, data: any) => void
validateCurrentStep: () => Promise<boolean>
completeWizard: () => void
resetWizard: () => void
isStepCompleted: (stepIndex: number) => boolean
isStepAccessible: (stepIndex: number) => boolean
canGoNext: boolean
canGoPrevious: boolean
}