{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "hover-spotlight-list",
  "type": "registry:component",
  "title": "Spotlight Border List",
  "description": "A list where one light source travels across all rows at once and lights their borders where it passes, while a soft highlight glides to the row under the pointer.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "hover",
    "list",
    "spotlight",
    "border",
    "glow",
    "rows",
    "status"
  ],
  "docs": "https://hyperblur.dev/effects/hover-spotlight-list",
  "files": [
    {
      "path": "registry/hyperblur/hover-spotlight-list.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/hover-spotlight-list.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface HoverSpotlightListItem {\n  title: string;\n  detail: string;\n  status?: string;\n  tone?: string;\n}\n\nexport interface HoverSpotlightListProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onSelect\"> {\n  items?: HoverSpotlightListItem[];\n  accent?: string;\n  radius?: number;\n  autoPlay?: boolean;\n  onSelect?: (index: number, item: HoverSpotlightListItem) => void;\n}\n\nconst defaults: HoverSpotlightListItem[] = [\n  { title: \"Payments webhook\", detail: \"POST /v2/events · 41ms p95\", status: \"Healthy\", tone: \"#4ade80\" },\n  { title: \"Search indexer\", detail: \"Queue 1,284 jobs · 3 workers\", status: \"Busy\", tone: \"#fbbf24\" },\n  { title: \"Image resizer\", detail: \"Edge · 12 regions\", status: \"Healthy\", tone: \"#4ade80\" },\n  { title: \"Email digest\", detail: \"Next run 18:00 UTC\", status: \"Paused\", tone: \"#8f8f8f\" },\n];\n\nconst css = `\n.hb-wg4 { --hb-wg4-accent: #2f7bff; --hb-wg4-r: 110px; --hb-wg4-x: -999px; --hb-wg4-y: -999px; --hb-wg4-o: 0; position: relative; box-sizing: border-box; width: 100%; display: grid; gap: 6px; font-family: inherit; color: #ededed; isolation: isolate; }\n.hb-wg4 *, .hb-wg4 *::before, .hb-wg4 *::after { box-sizing: border-box; }\n.hb-wg4-glide { position: absolute; left: 0; right: 0; top: 0; z-index: 0; border-radius: 11px; background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.015)); box-shadow: inset 0 1px 0 rgba(255,255,255,.05); opacity: 0; transform: translateY(var(--hb-wg4-gy, 0px)); height: var(--hb-wg4-gh, 0px); transition: transform .42s cubic-bezier(.2,.9,.25,1), height .42s cubic-bezier(.2,.9,.25,1), opacity .3s ease; pointer-events: none; }\n.hb-wg4[data-glide=\"true\"] .hb-wg4-glide { opacity: 1; }\n.hb-wg4-row { appearance: none; margin: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; position: relative; z-index: 1; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; padding: 9px 11px; border: 0; border-radius: 11px; background: rgba(17,17,17,.7); outline: none; -webkit-tap-highlight-color: transparent; }\n.hb-wg4-row::before { content: \"\"; position: absolute; inset: 0; border-radius: inherit; padding: 1px; background: radial-gradient(var(--hb-wg4-r) circle at calc(var(--hb-wg4-x) - var(--hb-wg4-ox, 0px)) calc(var(--hb-wg4-y) - var(--hb-wg4-oy, 0px)), color-mix(in srgb, var(--hb-wg4-accent) 95%, #fff 5%), color-mix(in srgb, var(--hb-wg4-accent) 30%, transparent) 45%, transparent 75%), #232323; -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); pointer-events: none; }\n.hb-wg4-row::after { content: \"\"; position: absolute; inset: 0; border-radius: inherit; background: radial-gradient(calc(var(--hb-wg4-r) * .9) circle at calc(var(--hb-wg4-x) - var(--hb-wg4-ox, 0px)) calc(var(--hb-wg4-y) - var(--hb-wg4-oy, 0px)), color-mix(in srgb, var(--hb-wg4-accent) 9%, transparent), transparent 70%); opacity: var(--hb-wg4-o); pointer-events: none; transition: opacity .3s ease; }\n.hb-wg4-row:focus-visible { box-shadow: 0 0 0 2px #0a0a0a, 0 0 0 4px var(--hb-wg4-accent); }\n.hb-wg4-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--hb-wg4-tone); box-shadow: 0 0 0 3px color-mix(in srgb, var(--hb-wg4-tone) 18%, transparent); }\n.hb-wg4-main { min-width: 0; display: grid; gap: 2px; }\n.hb-wg4-title { font-size: 12.5px; font-weight: 600; letter-spacing: -.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n.hb-wg4-detail { font-family: var(--font-mono, ui-monospace, monospace); font-size: 10px; color: #8f8f8f; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n.hb-wg4-status { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; color: #a1a1a1; }\n.hb-wg4-chev { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .35; transform: translateX(-3px); transition: transform .35s cubic-bezier(.2,.9,.25,1), opacity .3s ease; }\n.hb-wg4-row[data-hot=\"true\"] .hb-wg4-chev, .hb-wg4-row:focus-visible .hb-wg4-chev { opacity: 1; transform: none; color: #ededed; }\n.hb-wg4-row[aria-current=\"true\"] .hb-wg4-title::after { content: \"\"; display: inline-block; width: 5px; height: 5px; margin-left: 7px; vertical-align: middle; border-radius: 50%; background: var(--hb-wg4-accent); }\n@media (prefers-reduced-motion: reduce) {\n  .hb-wg4-glide, .hb-wg4-chev, .hb-wg4-row::after { transition: none; }\n}\n`;\n\nexport function HoverSpotlightList({\n  items = defaults,\n  accent = \"#2f7bff\",\n  radius = 110,\n  autoPlay = true,\n  onSelect,\n  className = \"\",\n  style,\n  ...rest\n}: HoverSpotlightListProps) {\n  const rootRef = React.useRef<HTMLDivElement>(null);\n  const rowRefs = React.useRef<(HTMLButtonElement | null)[]>([]);\n  const [current, setCurrent] = React.useState(-1);\n  const n = items.length;\n\n  React.useEffect(() => {\n    const root = rootRef.current;\n    if (!root) return;\n    const reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n    const rows = () => rowRefs.current.slice(0, n).filter((r): r is HTMLButtonElement => !!r);\n    let inside = false;\n    let px = 0;\n    let py = 0;\n    let cx = root.offsetWidth * 0.3;\n    let cy = 0;\n    let t = 0;\n    let raf = 0;\n    let last = performance.now();\n    let visible = true;\n    let hot = -1;\n    let glow = 0;\n\n    const setHot = (i: number) => {\n      if (i === hot) return;\n      const list = rows();\n      if (hot >= 0 && list[hot]) list[hot].dataset.hot = \"false\";\n      hot = i;\n      if (i >= 0 && list[i]) {\n        list[i].dataset.hot = \"true\";\n        root.style.setProperty(\"--hb-wg4-gy\", `${list[i].offsetTop}px`);\n        root.style.setProperty(\"--hb-wg4-gh\", `${list[i].offsetHeight}px`);\n        root.dataset.glide = \"true\";\n      } else {\n        root.dataset.glide = \"false\";\n      }\n    };\n\n    const paint = () => {\n      root.style.setProperty(\"--hb-wg4-x\", `${cx.toFixed(1)}px`);\n      root.style.setProperty(\"--hb-wg4-y\", `${cy.toFixed(1)}px`);\n      root.style.setProperty(\"--hb-wg4-o\", glow.toFixed(3));\n      rows().forEach((r) => {\n        r.style.setProperty(\"--hb-wg4-ox\", `${r.offsetLeft}px`);\n        r.style.setProperty(\"--hb-wg4-oy\", `${r.offsetTop}px`);\n      });\n    };\n\n    const frame = (now: number) => {\n      const dt = Math.min(0.05, (now - last) / 1000);\n      last = now;\n      t += dt;\n      const w = root.offsetWidth;\n      const h = root.offsetHeight;\n      const phase = (Math.sin(t * 0.55) + 1) / 2;\n      const ax = w * (0.18 + 0.64 * ((Math.sin(t * 0.9) + 1) / 2));\n      const ay = h * (0.08 + 0.84 * phase);\n      const tx = inside ? px : autoPlay ? ax : cx;\n      const ty = inside ? py : autoPlay ? ay : cy;\n      const k = 1 - Math.exp(-dt * (inside ? 18 : 4));\n      cx += (tx - cx) * k;\n      cy += (ty - cy) * k;\n      glow += ((inside || autoPlay ? 1 : 0) - glow) * (1 - Math.exp(-dt * 6));\n      if (!inside) {\n        if (autoPlay) {\n          const list = rows();\n          let idx = -1;\n          list.forEach((r, i) => {\n            if (cy >= r.offsetTop && cy <= r.offsetTop + r.offsetHeight) idx = i;\n          });\n          if (idx >= 0) setHot(idx);\n        } else setHot(-1);\n      }\n      paint();\n      raf = requestAnimationFrame(frame);\n    };\n    const start = () => {\n      if (raf || !visible || reduce) return;\n      last = performance.now();\n      raf = requestAnimationFrame(frame);\n    };\n    const stop = () => {\n      if (raf) cancelAnimationFrame(raf);\n      raf = 0;\n    };\n    const onMove = (e: PointerEvent) => {\n      const r = root.getBoundingClientRect();\n      const s = r.width ? root.offsetWidth / r.width : 1;\n      px = (e.clientX - r.left) * s;\n      py = (e.clientY - r.top) * s;\n      inside = true;\n      let idx = -1;\n      rows().forEach((row, i) => {\n        if (py >= row.offsetTop && py <= row.offsetTop + row.offsetHeight) idx = i;\n      });\n      setHot(idx);\n      if (reduce) {\n        cx = px;\n        cy = py;\n        glow = 1;\n        paint();\n      }\n    };\n    const onLeave = () => {\n      inside = false;\n      if (reduce || !autoPlay) setHot(-1);\n    };\n    const onUp = (e: PointerEvent) => {\n      if (e.pointerType !== \"mouse\") window.setTimeout(onLeave, 1400);\n    };\n    const onFocusIn = (e: FocusEvent) => {\n      const i = rows().indexOf(e.target as HTMLButtonElement);\n      if (i < 0) return;\n      const row = rows()[i];\n      inside = true;\n      px = row.offsetLeft + row.offsetWidth * 0.5;\n      py = row.offsetTop + row.offsetHeight * 0.5;\n      setHot(i);\n      if (reduce) {\n        cx = px;\n        cy = py;\n        glow = 1;\n        paint();\n      }\n    };\n    const onFocusOut = (e: FocusEvent) => {\n      if (!root.contains(e.relatedTarget as Node | null)) onLeave();\n    };\n    root.addEventListener(\"pointermove\", onMove);\n    root.addEventListener(\"pointerdown\", onMove);\n    root.addEventListener(\"pointerleave\", onLeave);\n    root.addEventListener(\"pointerup\", onUp);\n    root.addEventListener(\"focusin\", onFocusIn);\n    root.addEventListener(\"focusout\", onFocusOut);\n    const io = new IntersectionObserver(([entry]) => {\n      visible = entry.isIntersecting;\n      if (visible) start();\n      else stop();\n    });\n    io.observe(root);\n    if (reduce) paint();\n    start();\n    return () => {\n      stop();\n      io.disconnect();\n      root.removeEventListener(\"pointermove\", onMove);\n      root.removeEventListener(\"pointerdown\", onMove);\n      root.removeEventListener(\"pointerleave\", onLeave);\n      root.removeEventListener(\"pointerup\", onUp);\n      root.removeEventListener(\"focusin\", onFocusIn);\n      root.removeEventListener(\"focusout\", onFocusOut);\n    };\n  }, [n, autoPlay]);\n\n  const onKey = (e: React.KeyboardEvent<HTMLButtonElement>, i: number) => {\n    let next = -1;\n    if (e.key === \"ArrowDown\") next = (i + 1) % n;\n    if (e.key === \"ArrowUp\") next = (i - 1 + n) % n;\n    if (next >= 0) {\n      e.preventDefault();\n      rowRefs.current[next]?.focus();\n    }\n  };\n\n  const vars = { \"--hb-wg4-accent\": accent, \"--hb-wg4-r\": `${radius}px` } as React.CSSProperties;\n\n  return (\n    <div ref={rootRef} className={`hb-wg4 ${className}`} style={{ ...vars, ...style }} data-glide=\"false\" role=\"list\" {...rest}>\n      <style href=\"hb-hover-spotlight-list\" precedence=\"default\">{css}</style>\n      <span className=\"hb-wg4-glide\" aria-hidden=\"true\" />\n      {items.map((item, i) => (\n        <div role=\"listitem\" key={`${item.title}-${i}`} style={{ display: \"contents\" }}>\n          <button\n            ref={(el) => {\n              rowRefs.current[i] = el;\n            }}\n            type=\"button\"\n            className=\"hb-wg4-row\"\n            data-hot=\"false\"\n            aria-current={current === i ? \"true\" : undefined}\n            onKeyDown={(e) => onKey(e, i)}\n            onClick={() => {\n              setCurrent(i);\n              onSelect?.(i, item);\n            }}\n            style={{ \"--hb-wg4-tone\": item.tone ?? accent } as React.CSSProperties}\n          >\n            <span className=\"hb-wg4-dot\" aria-hidden=\"true\" />\n            <span className=\"hb-wg4-main\">\n              <span className=\"hb-wg4-title\">{item.title}</span>\n              <span className=\"hb-wg4-detail\">{item.detail}</span>\n            </span>\n            <span className=\"hb-wg4-status\">\n              {item.status}\n              <svg className=\"hb-wg4-chev\" viewBox=\"0 0 12 12\" aria-hidden=\"true\">\n                <path d=\"M4.5 2.5L8 6l-3.5 3.5\" />\n              </svg>\n            </span>\n          </button>\n        </div>\n      ))}\n    </div>\n  );\n}\n"
    }
  ]
}