"use client"; import { useId, useState } from "react"; import "./thread-stepper.css"; /** * Thread Stepper * A multi-step progress indicator drawn as a thread through beads. Completing * a step pulls the thread taut to the next bead and the finished bead fills; * the current bead pulses gently. Steps are buttons, so you can go back. */ export type Step = { id: string; title: string; hint?: string }; type Props = { steps: Step[]; current?: number; onChange?: (i: number) => void }; export function ThreadStepper({ steps, current, onChange }: Props) { const uid = useId(); const [inner, setInner] = useState(0); const at = current ?? inner; const set = (i: number) => { if (current === undefined) setInner(i); onChange?.(i); }; const pct = steps.length > 1 ? (at / (steps.length - 1)) * 100 : 0; return (