{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "gallery-accordion",
  "type": "registry:component",
  "title": "Gallery Accordion",
  "description": "A row of image panels where the hovered or focused one grows wide and the rest fold into slim strips with vertical labels.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "components",
    "gallery",
    "accordion",
    "panels",
    "horizontal",
    "hover",
    "keyboard"
  ],
  "docs": "https://hyperblur.dev/effects/gallery-accordion",
  "files": [
    {
      "path": "registry/hyperblur/gallery-accordion.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/gallery-accordion.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface AccordionPanel {\n  title: string;\n  subtitle?: string;\n  color?: string;\n  src?: string;\n}\n\nexport interface GalleryAccordionProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n  items?: AccordionPanel[];\n  value?: number;\n  defaultValue?: number;\n  onChange?: (index: number) => void;\n  openOn?: \"hover\" | \"click\";\n  height?: number;\n  grow?: number;\n  idle?: boolean;\n}\n\nconst css = `\n.hb-qk8 {\n  display: flex;\n  width: 100%;\n  height: var(--hb-qk8-h);\n  gap: 6px;\n  font-family: inherit;\n  box-sizing: border-box;\n}\n.hb-qk8 *, .hb-qk8 *::before, .hb-qk8 *::after { box-sizing: border-box; }\n.hb-qk8-p {\n  position: relative;\n  flex: 1 1 0;\n  min-width: 0;\n  margin: 0;\n  padding: 0;\n  overflow: hidden;\n  border: 1px solid rgba(255, 255, 255, 0.1);\n  border-radius: 14px;\n  background-color: var(--hb-qk8-c);\n  background-size: cover;\n  background-position: center;\n  color: #ffffff;\n  font: inherit;\n  text-align: left;\n  cursor: pointer;\n  outline: none;\n  transition: flex-grow 0.65s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.3s ease;\n  -webkit-tap-highlight-color: transparent;\n}\n.hb-qk8-p[data-active=\"true\"] { flex-grow: var(--hb-qk8-g); border-color: rgba(255, 255, 255, 0.22); }\n.hb-qk8-p:focus-visible { outline: 2px solid #ededed; outline-offset: 2px; }\n.hb-qk8-art {\n  position: absolute;\n  inset: 0;\n  background:\n    radial-gradient(120% 80% at 15% 0%, color-mix(in srgb, var(--hb-qk8-c) 60%, #ffffff) 0%, transparent 58%),\n    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0 2px, transparent 2px 12px),\n    linear-gradient(165deg, var(--hb-qk8-c), color-mix(in srgb, var(--hb-qk8-c) 24%, #050508));\n  transform: scale(1.12);\n  transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);\n}\n.hb-qk8-p[data-active=\"true\"] .hb-qk8-art { transform: scale(1); }\n.hb-qk8-p[data-src=\"true\"] .hb-qk8-art { background: none; }\n.hb-qk8-scrim {\n  position: absolute;\n  inset: 0;\n  background: linear-gradient(180deg, rgba(5, 5, 8, 0.05) 30%, rgba(5, 5, 8, 0.78) 100%);\n  opacity: 0.6;\n  transition: opacity 0.5s ease;\n}\n.hb-qk8-p[data-active=\"true\"] .hb-qk8-scrim { opacity: 1; }\n.hb-qk8-idx {\n  position: absolute;\n  left: 12px;\n  top: 11px;\n  font-size: 10px;\n  font-weight: 500;\n  letter-spacing: 0.12em;\n  color: rgba(255, 255, 255, 0.78);\n  font-variant-numeric: tabular-nums;\n}\n.hb-qk8-vert {\n  position: absolute;\n  left: 50%;\n  bottom: 12px;\n  font-size: 12px;\n  font-weight: 500;\n  letter-spacing: 0.1em;\n  text-transform: uppercase;\n  white-space: nowrap;\n  writing-mode: vertical-rl;\n  transform: translateX(-50%) rotate(180deg);\n  opacity: 1;\n  transition: opacity 0.3s ease 0.1s;\n  color: rgba(255, 255, 255, 0.9);\n}\n.hb-qk8-p[data-active=\"true\"] .hb-qk8-vert { opacity: 0; transition-delay: 0s; transition-duration: 0.15s; }\n.hb-qk8-info {\n  position: absolute;\n  left: 14px;\n  bottom: 13px;\n  width: max-content;\n  max-width: calc(100% - 28px);\n  opacity: 0;\n  transform: translateY(8px);\n  transition: opacity 0.2s ease, transform 0.2s ease;\n}\n.hb-qk8-p[data-active=\"true\"] .hb-qk8-info { opacity: 1; transform: none; transition: opacity 0.4s ease 0.28s, transform 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.28s; }\n.hb-qk8-title {\n  display: block;\n  font-size: 20px;\n  font-weight: 600;\n  line-height: 1.1;\n  letter-spacing: -0.01em;\n  white-space: nowrap;\n}\n.hb-qk8-sub {\n  display: block;\n  margin-top: 4px;\n  font-size: 12px;\n  line-height: 1.3;\n  white-space: nowrap;\n  color: rgba(255, 255, 255, 0.78);\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-qk8-p, .hb-qk8-art, .hb-qk8-scrim, .hb-qk8-vert, .hb-qk8-info { transition: none !important; }\n}\n`;\n\nconst defaultItems: AccordionPanel[] = [\n  { title: \"Lofoten\", subtitle: \"Arctic Norway, 68 N\", color: \"#2c7bd9\" },\n  { title: \"Kyoto\", subtitle: \"Autumn temples\", color: \"#d9573b\" },\n  { title: \"Atacama\", subtitle: \"Chile, 2,400 m\", color: \"#c4872a\" },\n  { title: \"Faroe\", subtitle: \"Eighteen islands\", color: \"#2f9c78\" },\n  { title: \"Dolomites\", subtitle: \"Italian Alps\", color: \"#8a62d6\" },\n];\n\nexport function GalleryAccordion({\n  items = defaultItems,\n  value,\n  defaultValue = 0,\n  onChange,\n  openOn = \"hover\",\n  height = 200,\n  grow = 5,\n  idle = true,\n  className = \"\",\n  style,\n  onPointerEnter,\n  onPointerLeave,\n  onKeyDown,\n  ...rest\n}: GalleryAccordionProps) {\n  const root = React.useRef<HTMLDivElement>(null);\n  const buttons = React.useRef<(HTMLButtonElement | null)[]>([]);\n  const [inner, setInner] = React.useState(defaultValue);\n  const controlled = value !== undefined;\n  const active = Math.min(items.length - 1, Math.max(0, controlled ? value : inner));\n  const user = React.useRef(false);\n  const visible = React.useRef(true);\n\n  const select = React.useCallback(\n    (index: number) => {\n      if (!controlled) setInner(index);\n      onChange?.(index);\n    },\n    [controlled, onChange],\n  );\n\n  React.useEffect(() => {\n    const el = root.current;\n    if (!el || !idle || controlled || items.length < 2) return;\n    if (window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches) return;\n    const io = new IntersectionObserver(([entry]) => {\n      visible.current = entry.isIntersecting;\n    });\n    io.observe(el);\n    const timer = window.setInterval(() => {\n      if (user.current || !visible.current) return;\n      setInner((i) => (i + 1) % items.length);\n    }, 2400);\n    return () => {\n      io.disconnect();\n      window.clearInterval(timer);\n    };\n  }, [idle, controlled, items.length]);\n\n  const go = (index: number) => {\n    buttons.current[(index + items.length) % items.length]?.focus();\n  };\n\n  return (\n    <div\n      ref={root}\n      role=\"group\"\n      aria-label=\"Gallery\"\n      className={`hb-qk8 ${className}`}\n      style={{ \"--hb-qk8-h\": `${height}px`, \"--hb-qk8-g\": grow, ...style } as React.CSSProperties}\n      onPointerEnter={(e) => {\n        onPointerEnter?.(e);\n        user.current = true;\n      }}\n      onPointerLeave={(e) => {\n        onPointerLeave?.(e);\n        user.current = false;\n      }}\n      onKeyDown={(e) => {\n        onKeyDown?.(e);\n        if (e.key === \"ArrowRight\" || e.key === \"ArrowDown\") {\n          e.preventDefault();\n          go(active + 1);\n        } else if (e.key === \"ArrowLeft\" || e.key === \"ArrowUp\") {\n          e.preventDefault();\n          go(active - 1);\n        } else if (e.key === \"Home\") {\n          e.preventDefault();\n          go(0);\n        } else if (e.key === \"End\") {\n          e.preventDefault();\n          go(items.length - 1);\n        }\n      }}\n      {...rest}\n    >\n      <style href=\"hb-gallery-accordion\" precedence=\"default\">{css}</style>\n      {items.map((item, i) => (\n        <button\n          key={`${item.title}-${i}`}\n          ref={(node) => {\n            buttons.current[i] = node;\n          }}\n          type=\"button\"\n          className=\"hb-qk8-p\"\n          data-active={i === active ? \"true\" : \"false\"}\n          data-src={item.src ? \"true\" : \"false\"}\n          aria-expanded={i === active}\n          aria-label={item.subtitle ? `${item.title}, ${item.subtitle}` : item.title}\n          style={\n            {\n              \"--hb-qk8-c\": item.color ?? \"#2f7bff\",\n              backgroundImage: item.src ? `url(${JSON.stringify(item.src)})` : undefined,\n            } as React.CSSProperties\n          }\n          onPointerEnter={(e) => {\n            if (openOn === \"hover\" && e.pointerType !== \"touch\" && i !== active) select(i);\n          }}\n          onFocus={() => {\n            if (i !== active) select(i);\n          }}\n          onClick={() => {\n            if (i !== active) select(i);\n          }}\n        >\n          <span className=\"hb-qk8-art\" aria-hidden=\"true\" />\n          <span className=\"hb-qk8-scrim\" aria-hidden=\"true\" />\n          <span className=\"hb-qk8-idx\" aria-hidden=\"true\">\n            {String(i + 1).padStart(2, \"0\")}\n          </span>\n          <span className=\"hb-qk8-vert\" aria-hidden=\"true\">\n            {item.title}\n          </span>\n          <span className=\"hb-qk8-info\" aria-hidden=\"true\">\n            <span className=\"hb-qk8-title\">{item.title}</span>\n            {item.subtitle ? <span className=\"hb-qk8-sub\">{item.subtitle}</span> : null}\n          </span>\n        </button>\n      ))}\n    </div>\n  );\n}\n"
    }
  ]
}