"use client"; import * as React from "react"; import { cn } from "./lib/utils"; export interface TourStep { title: string; description: string; } export interface TourProps extends React.HTMLAttributes { steps: TourStep[]; currentStep?: number; onStepChange?: (step: number) => void; onComplete?: () => void; onSkip?: () => void; className?: string; } export function Tour({ steps, currentStep: controlledStep, onStepChange, onComplete, onSkip, className, ...props }: TourProps) { const [internalStep, setInternalStep] = React.useState(0); const isControlled = controlledStep !== undefined; const stepIdx = isControlled ? controlledStep : internalStep; const current = steps[stepIdx] || steps[0]; const isLast = stepIdx === steps.length - 1; const handleNext = () => { if (isLast) { onComplete?.(); } else { const next = stepIdx + 1; if (!isControlled) setInternalStep(next); onStepChange?.(next); } }; const handlePrev = () => { if (stepIdx > 0) { const prev = stepIdx - 1; if (!isControlled) setInternalStep(prev); onStepChange?.(prev); } }; if (!current) return null; return (
{/* Top Header */}
TICKET TOUR · STEP {stepIdx + 1}/{steps.length}
{/* Content */}

{current.title}

{current.description}

{/* Footer Controls */}
{/* Step Dots */}
{steps.map((_, i) => (
))}
{/* Buttons */}
{stepIdx > 0 && ( )}
); }