{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"grow-panels","type":"registry:ui","title":"Grow Panels","description":"Row of photo panels where the active one flex-grows open while the rest shrink, auto-advancing with a progress bar.","dependencies":[],"registryDependencies":["utils"],"files":[{"path":"registry/ui/grow-panels.tsx","type":"registry:ui","content":"\"use client\";\n\nimport { useState, type KeyboardEvent } from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nconst css = `\n@keyframes flex-carousel-fill{from{transform:scaleX(0)}to{transform:scaleX(1)}}\n.flex-carousel-bar{animation:flex-carousel-fill linear forwards;transform-origin:left}\n.grow-panels:hover .flex-carousel-bar,.grow-panels:has(:focus-visible) .flex-carousel-bar{animation-play-state:paused}\n.flex-carousel-panel{transition:flex-grow .8s cubic-bezier(.65,0,.2,1)}\n.flex-carousel-panel img{transition:transform 1.2s cubic-bezier(.2,.7,.2,1),filter .8s}\n.flex-carousel-copy{transition:opacity .5s,transform .6s cubic-bezier(.2,.7,.2,1)}\n@media (prefers-reduced-motion:reduce){.flex-carousel-bar{animation:none}.flex-carousel-panel,.flex-carousel-panel img,.flex-carousel-copy{transition:none}}\n`;\n\nexport interface GrowPanelsItem {\n  image: string;\n  title: string;\n  description?: string;\n}\n\nexport interface GrowPanelsProps {\n  items: GrowPanelsItem[];\n  /** Ms each panel stays open before advancing. */\n  interval?: number;\n  /** Advance automatically (paused on hover and keyboard focus). */\n  autoPlay?: boolean;\n  /** How many times wider the open panel is than a closed one. */\n  expand?: number;\n  /** Px between panels. */\n  gap?: number;\n  /** Height in px. */\n  height?: number;\n  className?: string;\n}\n\nexport function GrowPanels({\n  items,\n  interval = 5000,\n  autoPlay = true,\n  expand = 6,\n  gap = 10,\n  height = 420,\n  className,\n}: GrowPanelsProps) {\n  const [active, setActive] = useState(0);\n  const go = (i: number) => setActive((i + items.length) % items.length);\n\n  const onKey = (e: KeyboardEvent<HTMLDivElement>) => {\n    const d = e.key === \"ArrowRight\" ? 1 : e.key === \"ArrowLeft\" ? -1 : 0;\n    if (!d) return;\n    e.preventDefault();\n    const next = (active + d + items.length) % items.length;\n    go(next);\n    e.currentTarget.querySelectorAll(\"button\")[next]?.focus();\n  };\n\n  return (\n    <div\n      role=\"group\"\n      aria-roledescription=\"carousel\"\n      onKeyDown={onKey}\n      className={cn(\"grow-panels flex w-full\", className)}\n      style={{ gap, height }}\n    >\n      <style href=\"grow-panels\" precedence=\"default\">\n        {css}\n      </style>\n      {items.map((it, i) => {\n        const on = i === active;\n        return (\n          <button\n            key={i}\n            type=\"button\"\n            aria-label={it.title}\n            aria-current={on}\n            tabIndex={on ? 0 : -1}\n            onClick={() => go(i)}\n            className=\"flex-carousel-panel group relative min-w-0 overflow-hidden rounded-3xl bg-muted text-left outline-none ring-ring ring-offset-2 ring-offset-background focus-visible:ring-2\"\n            style={{ flexGrow: on ? expand : 1, flexBasis: 0 }}\n          >\n            {/* eslint-disable-next-line @next/next/no-img-element */}\n            <img\n              src={it.image}\n              alt=\"\"\n              draggable={false}\n              className=\"absolute inset-0 size-full object-cover\"\n              style={{\n                transform: on ? \"scale(1)\" : \"scale(1.25)\",\n                filter: on ? \"none\" : \"saturate(.6) brightness(.7)\",\n              }}\n            />\n            <div className=\"absolute inset-0 bg-gradient-to-t from-black/85 via-black/10 to-transparent\" />\n            <span\n              aria-hidden\n              className=\"flex-carousel-copy absolute bottom-6 left-1/2 -translate-x-1/2 font-mono text-sm text-white/80\"\n              style={{ opacity: on ? 0 : 1 }}\n            >\n              {String(i + 1).padStart(2, \"0\")}\n            </span>\n            <div\n              className=\"flex-carousel-copy absolute inset-x-0 bottom-0 p-6 sm:p-8\"\n              style={{\n                opacity: on ? 1 : 0,\n                transform: on ? \"none\" : \"translateY(16px)\",\n                transitionDelay: on ? \".25s\" : \"0s\",\n              }}\n            >\n              <p className=\"font-mono text-xs text-white/60\">\n                {String(i + 1).padStart(2, \"0\")} / {String(items.length).padStart(2, \"0\")}\n              </p>\n              <h3 className=\"mt-2 truncate text-2xl font-semibold tracking-tight text-white sm:text-4xl\">{it.title}</h3>\n              {it.description && <p className=\"mt-2 line-clamp-2 max-w-md text-sm text-white/70\">{it.description}</p>}\n            </div>\n            {on && autoPlay && items.length > 1 && (\n              <div className=\"absolute inset-x-6 top-5 h-[3px] overflow-hidden rounded-full bg-white/25 sm:inset-x-8\">\n                <div\n                  key={active}\n                  className=\"flex-carousel-bar h-full rounded-full bg-white\"\n                  style={{ animationDuration: `${interval}ms` }}\n                  onAnimationEnd={() => go(active + 1)}\n                />\n              </div>\n            )}\n          </button>\n        );\n      })}\n    </div>\n  );\n}\n"}]}