{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "dot-rail-feature",
  "type": "registry:block",
  "title": "Dot Rail Feature",
  "description": "Feature Section built with Dot Rail (LED dot tab indicator): LED dots count up under self-playing tabs. A take on the tabs (tab bar) and progress bar (loading bar). A feature section that walks a release through its five stations as tabs that play by themselves. The LED dots under the current station count up like a timer before the next one comes up; point at a station and the lit run jumps under it, pick one and it stays. Each station shows what happens there, with the product's own readout beside it.",
  "author": "KeyframeUI <https://keyframeui.com>",
  "categories": [
    "blocks",
    "feature-sections",
    "features",
    "tabs",
    "progress-bar"
  ],
  "docs": "Live preview and the components it's built with: https://keyframeui.com/blocks/feature-sections/dot-rail-feature",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "https://keyframeui.com/r/dot-rail.json",
    "utils"
  ],
  "files": [
    {
      "path": "components/dot-rail-feature.tsx",
      "type": "registry:component",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { useInView, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@/lib/utils\";\nimport { DotRail } from \"@/components/ui/dot-rail\";\n\n/* ── Content ─────────────────────────────────────────────────\n * Everything you'd change to make the section yours: the\n * palette, the copy and the stations. The stations play by\n * themselves: the dots under the current one count up like a\n * timer, then the next one comes up. Point at a station and\n * the rail jumps under it; pick one and it stays.\n * ─────────────────────────────────────────────────────────── */\n\n/** Paper and ink, an electric blue for the headline's italic, and a hot signal color for the rail's lit dots. */\nconst PALETTE = {\n  light: { paper: \"#fafaf9\", ink: \"#0b0b0d\", accent: \"#2747ff\", signal: \"#ff5a1f\", platform: \"#ffffff\" },\n  dark: { paper: \"#07080c\", ink: \"#f4f4f6\", accent: \"#8292ff\", signal: \"#ff6a2b\", platform: \"#10121a\" },\n};\n\nconst HEADLINE = { before: \"Watch a release\", accent: \"ride\", after: \"the line\" };\nconst BODY =\n  \"Every Tuesday's train calls at the same five stations. Pick one to see what Milepost does there, or let it run.\";\nconst TABS_LABEL = \"Release stations\";\n/** ms each station stays up while the section plays by itself. */\nconst DWELL = 4500;\nconst TICK = 80;\n\ntype Row = { name: string; value: string; state: \"done\" | \"live\" | \"wait\" };\ntype Station = { id: string; label: string; time: string; title: string; body: string; rows: Row[] };\n\nconst STATIONS: Station[] = [\n  {\n    id: \"cut\",\n    label: \"Branch cut\",\n    time: \"Tue 10:00\",\n    title: \"The doors close on time\",\n    body: \"At ten the release branch is cut from main. Anything merged after rides next week, and nobody has to ask.\",\n    rows: [\n      { name: \"release/214\", value: \"cut from main at 4f1c9e2\", state: \"done\" },\n      { name: \"Aboard\", value: \"38 changes from 4 teams\", state: \"done\" },\n      { name: \"Next cut\", value: \"Tue 10:00\", state: \"wait\" },\n    ],\n  },\n  {\n    id: \"checks\",\n    label: \"Checks\",\n    time: \"10:04\",\n    title: \"Every change shows its ticket\",\n    body: \"Tests, migrations and the bundle budget run on the branch itself, so a red check names the change that broke it.\",\n    rows: [\n      { name: \"Unit\", value: \"2,914 passed\", state: \"done\" },\n      { name: \"End to end\", value: \"186 passed\", state: \"done\" },\n      { name: \"Migrations\", value: \"2, both reversible\", state: \"done\" },\n    ],\n  },\n  {\n    id: \"staging\",\n    label: \"Staging\",\n    time: \"10:31\",\n    title: \"A dress rehearsal with real data\",\n    body: \"The train stops on staging for an hour. The teams who own the changes get a link and a checklist, not a meeting.\",\n    rows: [\n      { name: \"Payments\", value: \"signed off\", state: \"done\" },\n      { name: \"Search\", value: \"signed off\", state: \"done\" },\n      { name: \"Mobile\", value: \"checking now\", state: \"live\" },\n    ],\n  },\n  {\n    id: \"canary\",\n    label: \"10% of users\",\n    time: \"11:15\",\n    title: \"A canary that can stop the train\",\n    body: \"One in ten requests rides the new release. If errors or latency drift past your limits, it rolls back by itself.\",\n    rows: [\n      { name: \"Error rate\", value: \"0.21%, limit 0.5%\", state: \"done\" },\n      { name: \"p95 latency\", value: \"184 ms, limit 250 ms\", state: \"done\" },\n      { name: \"Auto-rollback\", value: \"armed\", state: \"live\" },\n    ],\n  },\n  {\n    id: \"everyone\",\n    label: \"Everyone\",\n    time: \"13:00\",\n    title: \"Arrived, with the notes written\",\n    body: \"The release reaches everyone by lunch, and the changelog is drafted from the tickets that rode it.\",\n    rows: [\n      { name: \"Rollout\", value: \"100%\", state: \"done\" },\n      { name: \"Changelog\", value: \"drafted, 38 entries\", state: \"done\" },\n      { name: \"Train 215\", value: \"boarding\", state: \"wait\" },\n    ],\n  },\n];\n\n/* ── Section ─────────────────────────────────────────────── */\n\nexport function DotRailFeature() {\n  const sectionRef = React.useRef<HTMLElement>(null);\n  const tabsRef = React.useRef<HTMLDivElement>(null);\n  const inView = useInView(sectionRef, { amount: 0.35 });\n  const reduced = useReducedMotion();\n  const [clock, setClock] = React.useState({ active: 0, elapsed: 0 });\n  const [auto, setAuto] = React.useState(true);\n  const [paused, setPaused] = React.useState(false);\n\n  const playing = auto && !paused && inView && !reduced;\n  React.useEffect(() => {\n    if (!playing) return;\n    const id = window.setInterval(() => {\n      setClock(({ active, elapsed }) =>\n        elapsed + TICK >= DWELL\n          ? { active: (active + 1) % STATIONS.length, elapsed: 0 }\n          : { active, elapsed: elapsed + TICK },\n      );\n    }, TICK);\n    return () => window.clearInterval(id);\n  }, [playing]);\n\n  const pick = (index: number) => {\n    setAuto(false);\n    setClock({ active: index, elapsed: 0 });\n  };\n\n  const onKey = (e: React.KeyboardEvent<HTMLButtonElement>, index: number) => {\n    const n = STATIONS.length;\n    const to =\n      e.key === \"ArrowRight\" ? (index + 1) % n : e.key === \"ArrowLeft\" ? (index - 1 + n) % n : e.key === \"Home\" ? 0 : e.key === \"End\" ? n - 1 : -1;\n    if (to < 0) return;\n    e.preventDefault();\n    pick(to);\n    tabsRef.current?.querySelectorAll<HTMLButtonElement>('[role=\"tab\"]')[to]?.focus();\n  };\n\n  const { active, elapsed } = clock;\n\n  return (\n    <section\n      ref={sectionRef}\n      style={\n        {\n          \"--paper-light\": PALETTE.light.paper,\n          \"--ink-light\": PALETTE.light.ink,\n          \"--accent-light\": PALETTE.light.accent,\n          \"--signal-light\": PALETTE.light.signal,\n          \"--platform-light\": PALETTE.light.platform,\n          \"--paper-dark\": PALETTE.dark.paper,\n          \"--ink-dark\": PALETTE.dark.ink,\n          \"--accent-dark\": PALETTE.dark.accent,\n          \"--signal-dark\": PALETTE.dark.signal,\n          \"--platform-dark\": PALETTE.dark.platform,\n        } as React.CSSProperties\n      }\n      className=\"bg-(--paper) text-(--ink) [--accent:var(--accent-light)] [--dot-rail-accent:var(--signal)] [--ink:var(--ink-light)] [--paper:var(--paper-light)] [--platform:var(--platform-light)] [--signal:var(--signal-light)] dark:[--accent:var(--accent-dark)] dark:[--ink:var(--ink-dark)] dark:[--paper:var(--paper-dark)] dark:[--platform:var(--platform-dark)] dark:[--signal:var(--signal-dark)]\"\n    >\n      <div className=\"mx-auto max-w-6xl px-6 py-24 sm:py-28\">\n        <div className=\"grid gap-5 md:grid-cols-[minmax(0,1fr)_minmax(0,24rem)] md:items-end md:gap-12\">\n          <h2 className=\"font-serif text-4xl leading-[1.05] font-normal tracking-[-0.02em] text-balance sm:text-5xl\">\n            {HEADLINE.before} <em className=\"text-(--accent)\">{HEADLINE.accent}</em> {HEADLINE.after}\n          </h2>\n          <p className=\"text-base leading-relaxed text-pretty opacity-70\">{BODY}</p>\n        </div>\n\n        <div\n          className=\"mt-14\"\n          onPointerEnter={(e) => e.pointerType === \"mouse\" && setPaused(true)}\n          onPointerLeave={(e) => e.pointerType === \"mouse\" && setPaused(false)}\n        >\n          <div ref={tabsRef} role=\"tablist\" aria-label={TABS_LABEL} className=\"grid grid-cols-5\">\n            {STATIONS.map((station, index) => (\n              <button\n                key={station.id}\n                id={`milepost-tab-${station.id}`}\n                type=\"button\"\n                role=\"tab\"\n                aria-selected={index === active}\n                aria-controls={`milepost-panel-${station.id}`}\n                tabIndex={index === active ? 0 : -1}\n                onClick={() => pick(index)}\n                onKeyDown={(e) => onKey(e, index)}\n                className=\"group rounded-md px-1 pb-3 text-left outline-none focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-(--accent)\"\n              >\n                <span className=\"hidden font-mono text-[11px] tracking-[0.1em] uppercase tabular-nums opacity-45 sm:block\">\n                  {station.time}\n                </span>\n                <span className=\"block text-[13px] leading-tight font-medium sm:mt-1 opacity-45 transition-opacity duration-150 group-hover:opacity-100 group-aria-selected:opacity-100 sm:text-[15px]\">\n                  {station.label}\n                </span>\n              </button>\n            ))}\n          </div>\n          <DotRail trackRef={tabsRef} fill={auto && !reduced ? elapsed / DWELL : 1} />\n\n          <div className=\"mt-6 grid\">\n            {STATIONS.map((station, index) => (\n              <div\n                key={station.id}\n                id={`milepost-panel-${station.id}`}\n                role=\"tabpanel\"\n                aria-labelledby={`milepost-tab-${station.id}`}\n                inert={index !== active}\n                className={cn(\n                  \"col-start-1 row-start-1 rounded-2xl bg-(--platform) p-6 ring-1 ring-current/10 transition-[opacity,translate] duration-200 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:translate-y-0 sm:p-8\",\n                  index === active ? \"translate-y-0 opacity-100\" : \"pointer-events-none translate-y-1.5 opacity-0\",\n                )}\n              >\n                <Platform station={station} />\n              </div>\n            ))}\n          </div>\n        </div>\n      </div>\n    </section>\n  );\n}\n\n/* ── Platform ────────────────────────────────────────────── */\n\n/** What happens at one station: what it does, and a strip of the product's own readout. */\nfunction Platform({ station }: { station: Station }) {\n  return (\n    <div className=\"grid gap-6 md:grid-cols-[minmax(0,1fr)_minmax(0,22rem)] md:items-center md:gap-10\">\n      <div>\n        <h3 className=\"font-serif text-2xl leading-tight tracking-[-0.01em]\">{station.title}</h3>\n        <p className=\"mt-2 max-w-md text-[15px] leading-relaxed text-pretty opacity-70\">{station.body}</p>\n      </div>\n      <ul className=\"divide-y divide-current/10 rounded-xl px-4 ring-1 ring-current/10\">\n        {station.rows.map((row) => (\n          <li key={row.name} className=\"flex items-center gap-3 py-2.5 font-mono text-[12px]\">\n            <span\n              aria-hidden\n              className={\n                row.state === \"done\"\n                  ? \"size-1.5 rounded-full bg-current\"\n                  : row.state === \"live\"\n                    ? \"size-1.5 rounded-full bg-(--signal)\"\n                    : \"size-1.5 rounded-full ring-1 ring-current/40\"\n              }\n            />\n            <span className=\"opacity-60\">{row.name}</span>\n            <span className=\"ml-auto text-right tabular-nums\">{row.value}</span>\n          </li>\n        ))}\n      </ul>\n    </div>\n  );\n}\n"
    }
  ]
}