{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "hover-expand-rows",
  "type": "registry:component",
  "title": "Expanding Index Rows",
  "description": "A project index where hovering a row opens it in place with a thumbnail, a one-line summary and key numbers, while the other rows fade back. Hover intent timing keeps it calm as the pointer moves down the list.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "hover",
    "list",
    "index",
    "accordion",
    "portfolio",
    "preview",
    "rows"
  ],
  "docs": "https://hyperblur.dev/effects/hover-expand-rows",
  "files": [
    {
      "path": "registry/hyperblur/hover-expand-rows.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/hover-expand-rows.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface HoverExpandRowsItem {\n  title: string;\n  tag: string;\n  year: string;\n  summary: string;\n  stats?: { label: string; value: string }[];\n  background?: string;\n  href?: string;\n}\n\nexport interface HoverExpandRowsProps extends React.HTMLAttributes<HTMLDivElement> {\n  items?: HoverExpandRowsItem[];\n  defaultOpen?: number;\n  autoPlay?: boolean;\n  accent?: string;\n  linkLabel?: string;\n  onOpenChange?: (index: number) => void;\n}\n\nconst defaults: HoverExpandRowsItem[] = [\n  { title: \"Halden Bank\", tag: \"Fintech\", year: \"2025\", summary: \"Rebuilt onboarding from 11 steps to 4.\", stats: [{ label: \"Activation\", value: \"+38%\" }, { label: \"Drop-off\", value: \"-52%\" }], background: \"radial-gradient(circle at 70% 30%, #9fd0ff 0 14%, transparent 15%), linear-gradient(135deg, #1a3a6e, #0a1630)\" },\n  { title: \"Northwind Air\", tag: \"Travel\", year: \"2024\", summary: \"A booking flow that fits on one screen.\", stats: [{ label: \"Conversion\", value: \"+21%\" }, { label: \"Time\", value: \"1m 40s\" }], background: \"linear-gradient(180deg, transparent 60%, #f3e6d0 60%), radial-gradient(circle at 30% 40%, #fff 0 10%, transparent 11%), linear-gradient(180deg, #ff9a6a, #ffcf9a)\" },\n  { title: \"Oko Health\", tag: \"Healthcare\", year: \"2024\", summary: \"Clinician dashboard for 300 clinics.\", stats: [{ label: \"Clinics\", value: \"312\" }, { label: \"NPS\", value: \"71\" }], background: \"repeating-linear-gradient(90deg, rgba(255,255,255,.08) 0 1px, transparent 1px 12px), linear-gradient(135deg, #1f7a5c, #0b2a22)\" },\n  { title: \"Parcel & Co\", tag: \"Logistics\", year: \"2023\", summary: \"Live tracking with honest arrival times.\", stats: [{ label: \"Tickets\", value: \"-44%\" }, { label: \"Routes\", value: \"9.2k\" }], background: \"linear-gradient(160deg, transparent 50%, #ffcc4d 50% 64%, transparent 64%), linear-gradient(135deg, #2b2b36, #121218)\" },\n];\n\nconst css = `\n.hb-wg12 { --hb-wg12-accent: #2f7bff; box-sizing: border-box; width: 100%; font-family: inherit; color: #ededed; border-top: 1px solid #262626; }\n.hb-wg12 *, .hb-wg12 *::before, .hb-wg12 *::after { box-sizing: border-box; }\n.hb-wg12-row { border-bottom: 1px solid #262626; transition: opacity .35s ease; }\n.hb-wg12[data-any=\"true\"] .hb-wg12-row:not([data-open=\"true\"]) { opacity: .45; }\n.hb-wg12-head { appearance: none; border: 0; margin: 0; background: none; font: inherit; color: inherit; cursor: pointer; width: 100%; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 8px 2px; text-align: left; outline: none; -webkit-tap-highlight-color: transparent; }\n.hb-wg12-head:focus-visible { box-shadow: inset 0 0 0 2px var(--hb-wg12-accent); border-radius: 6px; }\n.hb-wg12-idx { font-family: var(--font-mono, ui-monospace, monospace); font-size: 9.5px; color: #6f6f6f; font-variant-numeric: tabular-nums; transition: color .3s ease; }\n.hb-wg12-row[data-open=\"true\"] .hb-wg12-idx { color: var(--hb-wg12-accent); }\n.hb-wg12-title { display: flex; align-items: center; gap: 0; min-width: 0; font-size: 14px; font-weight: 600; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; }\n.hb-wg12-title span { overflow: hidden; text-overflow: ellipsis; }\n.hb-wg12-arrow { flex: none; width: 0; height: 13px; opacity: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: width .45s cubic-bezier(.2,.9,.25,1), opacity .3s ease, margin .45s cubic-bezier(.2,.9,.25,1); }\n.hb-wg12-row[data-open=\"true\"] .hb-wg12-arrow { width: 13px; margin-right: 7px; opacity: 1; }\n.hb-wg12-tag { font-size: 9.5px; padding: 2px 7px; border-radius: 999px; color: #a1a1a1; box-shadow: inset 0 0 0 1px #2a2a2a; white-space: nowrap; }\n.hb-wg12-year { font-family: var(--font-mono, ui-monospace, monospace); font-size: 9.5px; color: #8f8f8f; }\n.hb-wg12-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .5s cubic-bezier(.2,.9,.25,1); }\n.hb-wg12-row[data-open=\"true\"] .hb-wg12-body { grid-template-rows: 1fr; }\n.hb-wg12-inner { min-height: 0; overflow: hidden; }\n.hb-wg12-panel { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 10px; padding: 0 2px 10px 34px; opacity: 0; transform: translateY(-6px); transition: opacity .35s ease, transform .5s cubic-bezier(.2,.9,.25,1); }\n.hb-wg12-row[data-open=\"true\"] .hb-wg12-panel { opacity: 1; transform: none; transition-delay: .08s; }\n.hb-wg12-art { aspect-ratio: 4 / 3; border-radius: 7px; background: var(--hb-wg12-bg); box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); transform: scale(.92) rotate(-2deg); transition: transform .6s cubic-bezier(.2,1.3,.35,1); }\n.hb-wg12-row[data-open=\"true\"] .hb-wg12-art { transform: none; }\n.hb-wg12-copy { min-width: 0; display: grid; gap: 5px; align-content: start; }\n.hb-wg12-sum { margin: 0; font-size: 10.5px; line-height: 1.35; color: #a1a1a1; }\n.hb-wg12-stats { display: flex; gap: 12px; align-items: baseline; }\n.hb-wg12-stat { display: grid; gap: 0; }\n.hb-wg12-val { font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; }\n.hb-wg12-lab { font-size: 8.5px; color: #6f6f6f; text-transform: uppercase; letter-spacing: .08em; }\n.hb-wg12-link { margin-left: auto; align-self: center; font-size: 10px; color: #ededed; text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--hb-wg12-accent) 70%, transparent); padding-bottom: 1px; outline: none; }\n.hb-wg12-link:focus-visible { box-shadow: 0 0 0 2px var(--hb-wg12-accent); border-radius: 3px; }\n@media (prefers-reduced-motion: reduce) {\n  .hb-wg12-row, .hb-wg12-arrow, .hb-wg12-body, .hb-wg12-panel, .hb-wg12-art, .hb-wg12-idx { transition: none; }\n}\n`;\n\nexport function HoverExpandRows({\n  items = defaults,\n  defaultOpen = -1,\n  autoPlay = true,\n  accent = \"#2f7bff\",\n  linkLabel = \"View case\",\n  onOpenChange,\n  className = \"\",\n  style,\n  ...rest\n}: HoverExpandRowsProps) {\n  const [open, setOpen] = React.useState(defaultOpen);\n  const [engaged, setEngaged] = React.useState(false);\n  const timer = React.useRef(0);\n  const heads = React.useRef<(HTMLButtonElement | null)[]>([]);\n  const lastPointer = React.useRef(\"mouse\");\n  const n = items.length;\n  const baseId = React.useId();\n\n  const openRef = React.useRef(defaultOpen);\n  const change = React.useCallback(\n    (i: number) => {\n      if (openRef.current !== i) onOpenChange?.(i);\n      openRef.current = i;\n      setOpen(i);\n    },\n    [onOpenChange],\n  );\n\n  React.useEffect(() => {\n    if (!autoPlay || engaged || n === 0) return;\n    if (window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches) return;\n    let i = 0;\n    const id = window.setInterval(() => {\n      openRef.current = i;\n      setOpen(i);\n      i = (i + 1) % n;\n    }, 2200);\n    return () => window.clearInterval(id);\n  }, [autoPlay, engaged, n]);\n\n  React.useEffect(() => () => window.clearTimeout(timer.current), []);\n\n  const schedule = (i: number, delay: number) => {\n    window.clearTimeout(timer.current);\n    timer.current = window.setTimeout(() => change(i), delay);\n  };\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 (e.key === \"Escape\") change(-1);\n    if (next >= 0) {\n      e.preventDefault();\n      heads.current[next]?.focus();\n    }\n  };\n\n  return (\n    <div\n      className={`hb-wg12 ${className}`}\n      style={{ \"--hb-wg12-accent\": accent, ...style } as React.CSSProperties}\n      data-any={open >= 0 ? \"true\" : \"false\"}\n      onPointerLeave={(e) => {\n        if (e.pointerType === \"mouse\") schedule(-1, 220);\n      }}\n      {...rest}\n    >\n      <style href=\"hb-hover-expand-rows\" precedence=\"default\">{css}</style>\n      {items.map((item, i) => {\n        const isOpen = open === i;\n        const pid = `${baseId}-p${i}`;\n        return (\n          <div key={`${item.title}-${i}`} className=\"hb-wg12-row\" data-open={isOpen ? \"true\" : \"false\"}>\n            <button\n              ref={(el) => {\n                heads.current[i] = el;\n              }}\n              type=\"button\"\n              className=\"hb-wg12-head\"\n              aria-expanded={isOpen}\n              aria-controls={pid}\n              onPointerDown={(e) => {\n                lastPointer.current = e.pointerType;\n              }}\n              onPointerEnter={(e) => {\n                if (e.pointerType !== \"mouse\") return;\n                setEngaged(true);\n                schedule(i, open >= 0 ? 60 : 110);\n              }}\n              onFocus={() => {\n                setEngaged(true);\n                change(i);\n              }}\n              onKeyDown={(e) => onKey(e, i)}\n              onClick={() => {\n                setEngaged(true);\n                if (lastPointer.current === \"mouse\") change(i);\n                else change(isOpen ? -1 : i);\n                lastPointer.current = \"key\";\n              }}\n            >\n              <span className=\"hb-wg12-idx\">{String(i + 1).padStart(2, \"0\")}</span>\n              <span className=\"hb-wg12-title\">\n                <svg className=\"hb-wg12-arrow\" viewBox=\"0 0 13 13\" aria-hidden=\"true\">\n                  <path d=\"M2 6.5h9M7.5 3l3.5 3.5L7.5 10\" />\n                </svg>\n                <span>{item.title}</span>\n              </span>\n              <span className=\"hb-wg12-tag\">{item.tag}</span>\n              <span className=\"hb-wg12-year\">{item.year}</span>\n            </button>\n            <div className=\"hb-wg12-body\" id={pid} role=\"region\" aria-label={item.title} aria-hidden={!isOpen}>\n              <div className=\"hb-wg12-inner\">\n                <div className=\"hb-wg12-panel\" style={{ \"--hb-wg12-bg\": item.background ?? \"linear-gradient(135deg, #222, #111)\" } as React.CSSProperties}>\n                  <span className=\"hb-wg12-art\" aria-hidden=\"true\" />\n                  <div className=\"hb-wg12-copy\">\n                    <p className=\"hb-wg12-sum\">{item.summary}</p>\n                    <div className=\"hb-wg12-stats\">\n                      {(item.stats ?? []).map((s) => (\n                        <span key={s.label} className=\"hb-wg12-stat\">\n                          <span className=\"hb-wg12-val\">{s.value}</span>\n                          <span className=\"hb-wg12-lab\">{s.label}</span>\n                        </span>\n                      ))}\n                      <a className=\"hb-wg12-link\" href={item.href ?? \"#\"} tabIndex={isOpen ? 0 : -1}>\n                        {linkLabel}\n                      </a>\n                    </div>\n                  </div>\n                </div>\n              </div>\n            </div>\n          </div>\n        );\n      })}\n    </div>\n  );\n}\n"
    }
  ]
}