{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"process-steps","type":"registry:block","title":"Process steps","description":"How it works section with a line that draws on scroll and steps that light up as you pass them.","dependencies":["lucide-react","motion"],"registryDependencies":["utils"],"files":[{"path":"registry/items/process-steps/process-steps.tsx","type":"registry:block","target":"components/facade/process-steps.tsx","content":"\"use client\";\n\nimport * as React from \"react\";\nimport {\n  motion,\n  useMotionValueEvent,\n  useReducedMotion,\n  useScroll,\n  useSpring,\n  useTransform,\n} from \"motion/react\";\nimport { ArrowRight, Calendar, Check, CircleCheck, Phone, Wrench } from \"lucide-react\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface ProcessStep {\n  title: string;\n  description: string;\n  /** Small meta label, e.g. \"Takes 2 minutes\". */\n  meta?: string;\n  icon?: React.ComponentType<{ className?: string }>;\n}\n\nexport interface ProcessStepsProps {\n  eyebrow?: string;\n  title?: string;\n  description?: string;\n  steps?: ProcessStep[];\n  cta?: { label: string; href: string };\n  className?: string;\n}\n\nconst EASE = [0.16, 1, 0.3, 1] as const;\n\nconst DEFAULT_STEPS: ProcessStep[] = [\n  {\n    title: \"Tell us what's going on\",\n    description: \"Call, text or book online. Share a few photos and we'll confirm the issue before anyone rolls a truck.\",\n    meta: \"Takes 2 minutes\",\n    icon: Phone,\n  },\n  {\n    title: \"Get a flat-rate quote\",\n    description: \"You'll see the full price upfront, in writing. No overtime fees, no surprises on the invoice.\",\n    meta: \"Same day\",\n    icon: Calendar,\n  },\n  {\n    title: \"We do the work right\",\n    description: \"A licensed, background-checked tech arrives in a stocked van and treats your home like their own.\",\n    meta: \"Most jobs in one visit\",\n    icon: Wrench,\n  },\n  {\n    title: \"Backed for five years\",\n    description: \"Every repair is covered by our 5-year workmanship warranty. If it's not right, we come back free.\",\n    meta: \"In writing\",\n    icon: CircleCheck,\n  },\n];\n\nexport function ProcessSteps({\n  eyebrow = \"How it works\",\n  title = \"From first call to fixed, in four simple steps\",\n  description = \"We've refined this process over 9,000 jobs in Denver. It's built around one idea: you should never have to chase us.\",\n  steps = DEFAULT_STEPS,\n  cta = { label: \"Start with step one\", href: \"#quote\" },\n  className,\n}: ProcessStepsProps) {\n  const reduce = useReducedMotion();\n  const listRef = React.useRef<HTMLOListElement>(null);\n  const { scrollYProgress } = useScroll({\n    target: listRef,\n    offset: [\"start 75%\", \"end 55%\"],\n  });\n  const progress = useSpring(scrollYProgress, { stiffness: 200, damping: 40, restDelta: 0.001 });\n  const scaleY = useTransform(progress, [0, 1], [0, 1]);\n  const [progressIndex, setProgressIndex] = React.useState(-1);\n\n  useMotionValueEvent(scrollYProgress, \"change\", (v) => {\n    const n = steps.length;\n    // Marker i sits at fraction i / (n - 1) of the line; activate slightly before the line reaches it.\n    const idx = v < 0.01 ? -1 : Math.min(n - 1, Math.floor(v * Math.max(n - 1, 1) + 0.25));\n    setProgressIndex(idx);\n  });\n  const active = reduce ? steps.length - 1 : progressIndex;\n\n  return (\n    <section className={cn(\"relative bg-background py-20 text-foreground sm:py-28\", className)}>\n      <div className=\"mx-auto grid max-w-[1120px] gap-14 px-6 lg:grid-cols-[0.9fr_1.1fr] lg:gap-20\">\n        {/* Sticky intro */}\n        <div className=\"lg:sticky lg:top-24 lg:self-start\">\n          <p className=\"text-[13px] font-medium uppercase tracking-[0.08em] text-muted-foreground\">{eyebrow}</p>\n          <h2 className=\"mt-3 font-display text-[34px] font-semibold leading-[1.05] tracking-[-0.035em] text-balance sm:text-[48px]\">\n            {title}\n          </h2>\n          <p className=\"mt-5 max-w-md text-[17px] leading-[1.5] text-muted-foreground text-pretty\">\n            {description}\n          </p>\n\n          {/* Mini progress indicator */}\n          <div className=\"mt-8 hidden items-center gap-2 lg:flex\" aria-hidden>\n            {steps.map((_, i) => (\n              <span\n                key={i}\n                className={cn(\n                  \"h-1 rounded-full transition-all duration-500 ease-[cubic-bezier(0.16,1,0.3,1)]\",\n                  i <= active ? \"w-10 bg-foreground\" : \"w-5 bg-foreground/[0.12]\",\n                )}\n              />\n            ))}\n            <span className=\"ml-2 text-xs tabular-nums text-muted-foreground\">\n              {Math.max(active + 1, 0)} of {steps.length}\n            </span>\n          </div>\n\n          {cta && (\n            <a\n              href={cta.href}\n              className=\"group mt-8 inline-flex h-11 items-center gap-2 rounded-full bg-brand px-6 text-[15px] font-medium text-brand-foreground transition-colors hover:bg-brand/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\"\n            >\n              {cta.label}\n              <ArrowRight className=\"size-4 transition-transform group-hover:translate-x-0.5\" />\n            </a>\n          )}\n        </div>\n\n        {/* Steps */}\n        <ol ref={listRef} className=\"relative\">\n          {/* Track */}\n          <span aria-hidden className=\"absolute bottom-8 left-[21px] top-8 w-px bg-foreground/[0.1] sm:left-[23px]\" />\n          {/* Progress line */}\n          <motion.span\n            aria-hidden\n            className=\"absolute bottom-8 left-[21px] top-8 w-px origin-top bg-foreground sm:left-[23px]\"\n            style={{ scaleY: reduce ? 1 : scaleY }}\n          />\n\n          {steps.map((step, i) => {\n            const isActive = i <= active;\n            const Icon = step.icon ?? Check;\n            return (\n              <li key={step.title} className=\"relative flex gap-5 pb-4 last:pb-0 sm:gap-6\">\n                {/* Marker */}\n                <div className=\"relative z-10 shrink-0 pt-6\">\n                  <span\n                    className={cn(\n                      \"flex size-11 items-center justify-center rounded-full transition-colors duration-500 sm:size-12\",\n                      isActive ? \"bg-foreground text-background\" : \"bg-muted text-muted-foreground\",\n                    )}\n                  >\n                    <Icon className=\"size-5\" />\n                  </span>\n                </div>\n\n                {/* Card */}\n                <motion.div\n                  initial={reduce ? { opacity: 0 } : { opacity: 0, y: 16 }}\n                  whileInView={{ opacity: 1, y: 0 }}\n                  viewport={{ once: true, margin: \"-60px 0px\" }}\n                  transition={{ duration: 0.8, ease: EASE }}\n                  className=\"relative flex-1 rounded-[24px] bg-muted p-6 sm:p-7\"\n                >\n                  <p className=\"text-[13px] text-muted-foreground\">\n                    Step {i + 1}\n                    {step.meta && <span>, {step.meta.toLowerCase()}</span>}\n                  </p>\n                  <h3\n                    className={cn(\n                      \"mt-2 font-display text-[20px] font-semibold tracking-[-0.02em] transition-colors duration-500 sm:text-[22px]\",\n                      !isActive && \"text-foreground/60\",\n                    )}\n                  >\n                    {step.title}\n                  </h3>\n                  <p className=\"mt-2 max-w-md text-[15px] leading-[1.5] text-muted-foreground text-pretty\">\n                    {step.description}\n                  </p>\n                </motion.div>\n              </li>\n            );\n          })}\n        </ol>\n      </div>\n    </section>\n  );\n}\n\nexport default ProcessSteps;\n"}],"categories":["sections"],"meta":{"tier":"free","demo":"import { ProcessSteps } from \"./process-steps\";\n\nexport default function Demo() {\n  return <ProcessSteps />;\n}\n"}}