{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "featured-categories-banner",
  "title": "Featured Categories Banner",
  "description": "A banner of expanding category panels: the open one grows to show its photo, headline, tagline, product count and a Shop button while the others shrink to vertical labels, rotating on a timer with a progress line that pauses on hover; on phones it becomes a vertical accordion.",
  "dependencies": [
    "motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/featured-categories-banner/featured-categories-banner.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nfunction cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\nexport interface FeaturedPanel {\n  id: string;\n  name: string;\n  headline: string;\n  tagline: string;\n  image: string;\n  from: number;\n  count: number;\n  href?: string;\n  /** object-position for the photo, e.g. \"60% 50%\". */\n  focus?: string;\n}\n\nexport interface FeaturedCategoriesBannerProps {\n  kicker?: string;\n  title?: string;\n  panels?: FeaturedPanel[];\n  /** Milliseconds per panel. Set to 0 to turn autoplay off. */\n  interval?: number;\n  currency?: string;\n  onShop?: (panel: FeaturedPanel) => void;\n  theme?: \"dark\" | \"light\";\n  className?: string;\n}\n\nconst PALETTES = {\n  dark: { bg: \"#0A0A0A\", title: \"#FFFFFF\", muted: \"rgba(255,255,255,0.45)\", body: \"rgba(255,255,255,0.62)\", line: \"rgba(255,255,255,0.12)\", ring: \"rgba(255,255,255,0.55)\" },\n  light: { bg: \"#FFFFFF\", title: \"#111111\", muted: \"rgba(0,0,0,0.45)\", body: \"rgba(0,0,0,0.62)\", line: \"rgba(0,0,0,0.1)\", ring: \"rgba(0,0,0,0.45)\" },\n};\n// Panels are photo tiles: #F1F1F1 with dark ink in both themes.\nconst TILE = { bg: \"#F1F1F1\", ink: \"#111111\", soft: \"rgba(17,17,17,0.6)\", faint: \"rgba(17,17,17,0.12)\", accent: \"#7CDE6A\" };\n\nconst PANELS: FeaturedPanel[] = [\n  { id: \"audio\", name: \"Audio\", headline: \"Hear the detail.\", tagline: \"Earbuds and headphones tuned flat, with cases that close with a click.\", image: \"/demo/wireless-earbuds.webp\", from: 129, count: 12, focus: \"55% 50%\" },\n  { id: \"watches\", name: \"Watches\", headline: \"Time, quietly.\", tagline: \"Matte cases, no logos on the dial, straps that soften with wear.\", image: \"/demo/minimal-watch.webp\", from: 79, count: 8, focus: \"50% 50%\" },\n  { id: \"desk\", name: \"Desk\", headline: \"Raise your setup.\", tagline: \"Aluminium stands, dot-grid notebooks and lamps that stay out of the way.\", image: \"/demo/laptop-stand.webp\", from: 24, count: 21, focus: \"50% 55%\" },\n  { id: \"running\", name: \"Running\", headline: \"Miles feel shorter.\", tagline: \"Light trainers with a rocker sole for easy days and long ones.\", image: \"/demo/running-shoes.webp\", from: 99, count: 6, focus: \"45% 50%\" },\n];\n\nexport function FeaturedCategoriesBanner({ kicker = \"Featured\", title = \"This season’s edit\", panels = PANELS, interval = 5000, currency = \"$\", onShop, theme = \"dark\", className }: FeaturedCategoriesBannerProps) {\n  const p = PALETTES[theme];\n  const reduce = !!useReducedMotion();\n  const uid = React.useId();\n  const [active, setActive] = React.useState(0);\n  const [hovering, setHovering] = React.useState(false);\n  const [focusWithin, setFocusWithin] = React.useState(false);\n  const [stopped, setStopped] = React.useState(false);\n  const [cycle, setCycle] = React.useState(0);\n  const hoverTimer = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n  React.useEffect(() => () => void (hoverTimer.current && clearTimeout(hoverTimer.current)), []);\n\n  const autoplay = interval > 0 && !reduce && !stopped;\n  const paused = hovering || focusWithin;\n  const go = (i: number) => {\n    setActive((i + panels.length) % panels.length);\n    setCycle((c) => c + 1);\n  };\n  // A short delay so sweeping the mouse across the row doesn't open every panel on the way.\n  const hoverOpen = (i: number) => {\n    if (hoverTimer.current) clearTimeout(hoverTimer.current);\n    hoverTimer.current = setTimeout(() => {\n      if (i !== active) go(i);\n    }, 140);\n  };\n\n  const ring = { [\"--tw-ring-color\" as string]: p.ring, [\"--tw-ring-offset-color\" as string]: p.bg } as React.CSSProperties;\n  const focus = \"outline-none focus-visible:ring-2 focus-visible:ring-offset-2\";\n  const pad = (n: number) => String(n + 1).padStart(2, \"0\");\n\n  return (\n    <section className={cn(\"@container w-full py-12\", className)} style={{ background: p.bg, color: p.title }}>\n      <style>{`@keyframes fcb-progress { from { transform: scaleX(0) } to { transform: scaleX(1) } }`}</style>\n      <div className=\"mx-auto max-w-6xl px-4 @[640px]:px-8\">\n        <div className=\"flex items-end justify-between gap-4\">\n          <div>\n            <p className=\"m-0 text-[12px] font-semibold tracking-[0.14em] uppercase\" style={{ color: p.muted }}>\n              {kicker}\n            </p>\n            <h2 className=\"m-0 mt-1.5 text-[28px] leading-tight font-semibold tracking-[-0.02em] @[640px]:text-[34px]\">{title}</h2>\n          </div>\n          <div className=\"flex shrink-0 items-center gap-3\">\n            <span className=\"font-mono text-[13px] tabular-nums\" style={{ color: p.body }} aria-hidden=\"true\">\n              <span style={{ color: p.title }}>{pad(active)}</span> / {pad(panels.length - 1)}\n            </span>\n            {interval > 0 && !reduce && (\n              <button type=\"button\" onClick={() => setStopped((s) => !s)} aria-label={stopped ? \"Play slideshow\" : \"Pause slideshow\"} aria-pressed={stopped} className={cn(\"grid h-9 w-9 cursor-pointer place-items-center rounded-full border bg-transparent\", focus)} style={{ borderColor: p.line, color: p.title, ...ring }}>\n                {stopped ? (\n                  <svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden=\"true\">\n                    <path d=\"M7 4.5v15l13-7.5z\" />\n                  </svg>\n                ) : (\n                  <svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden=\"true\">\n                    <path d=\"M6 4h4v16H6zM14 4h4v16h-4z\" />\n                  </svg>\n                )}\n              </button>\n            )}\n          </div>\n        </div>\n\n        <div\n          className=\"mt-7 flex h-[640px] flex-col gap-2 @[760px]:h-[520px] @[760px]:flex-row @[760px]:gap-3\"\n          onMouseEnter={() => setHovering(true)}\n          onMouseLeave={() => {\n            setHovering(false);\n            if (hoverTimer.current) clearTimeout(hoverTimer.current);\n          }}\n          onFocus={() => setFocusWithin(true)}\n          onBlur={(e) => {\n            if (!e.currentTarget.contains(e.relatedTarget as Node)) setFocusWithin(false);\n          }}\n        >\n          {panels.map((x, i) => {\n            const on = i === active;\n            return (\n              <motion.div\n                key={x.id}\n                className=\"relative min-h-[64px] min-w-0 overflow-hidden rounded-3xl @[760px]:min-h-0 @[760px]:min-w-[76px]\"\n                style={{ background: TILE.bg, color: TILE.ink }}\n                initial={false}\n                animate={{ flexGrow: on ? 5 : 1 }}\n                transition={reduce ? { duration: 0 } : { type: \"spring\", stiffness: 170, damping: 26 }}\n                onMouseEnter={() => hoverOpen(i)}\n              >\n                <motion.img src={x.image} alt=\"\" draggable={false} className=\"absolute inset-0 h-full w-full object-cover\" style={{ objectPosition: x.focus ?? \"50% 50%\" }} initial={false} animate={{ scale: on ? 0.84 : 1.35, x: on ? \"9%\" : \"0%\", y: on ? \"8%\" : \"0%\", opacity: on ? 1 : 0.55, filter: on ? \"grayscale(0)\" : \"grayscale(1)\" }} transition={{ duration: reduce ? 0 : 0.7, ease: [0.22, 1, 0.36, 1] }} />\n\n                {/* Paper-coloured wash behind the copy so the headline never sits on the product */}\n                <motion.span aria-hidden=\"true\" className=\"pointer-events-none absolute inset-0\" style={{ background: `linear-gradient(180deg, ${TILE.bg} 0%, ${TILE.bg}E6 22%, ${TILE.bg}00 52%, ${TILE.bg}00 78%, ${TILE.bg}CC 100%)` }} initial={false} animate={{ opacity: on ? 1 : 0 }} transition={{ duration: reduce ? 0 : 0.5 }} />\n\n                {/* Closed rows on narrow screens: a side wash so the label stays readable */}\n                {!on && <span aria-hidden=\"true\" className=\"pointer-events-none absolute inset-0 @[760px]:hidden\" style={{ background: `linear-gradient(90deg, ${TILE.bg} 0%, ${TILE.bg}D9 38%, ${TILE.bg}00 75%)` }} />}\n\n                {/* Header button: opens the panel */}\n                <h3 className=\"m-0\">\n                  <button\n                    type=\"button\"\n                    id={`${uid}-h-${x.id}`}\n                    aria-expanded={on}\n                    aria-controls={`${uid}-p-${x.id}`}\n                    onClick={() => go(i)}\n                    className={cn(\"absolute inset-0 z-10 flex cursor-pointer items-center justify-between border-0 bg-transparent px-5 text-left outline-none focus-visible:ring-2 focus-visible:ring-inset @[760px]:items-end @[760px]:justify-center @[760px]:px-0 @[760px]:pb-6\", on && \"pointer-events-none\")}\n                    style={{ color: TILE.ink, [\"--tw-ring-color\" as string]: TILE.ink }}\n                    tabIndex={on ? -1 : 0}\n                  >\n                    <AnimatePresence initial={false}>\n                      {!on && (\n                        <motion.span key=\"label\" className=\"flex items-center gap-3 @[760px]:flex-col-reverse @[760px]:gap-4\" initial={reduce ? false : { opacity: 0 }} animate={{ opacity: 1, transition: { delay: reduce ? 0 : 0.25 } }} exit={{ opacity: 0, transition: { duration: 0.1 } }}>\n                          <span className=\"font-mono text-[12px]\" style={{ color: TILE.soft }}>\n                            {pad(i)}\n                          </span>\n                          <span className=\"text-[17px] font-semibold tracking-[-0.01em] @[760px]:[writing-mode:vertical-rl] @[760px]:rotate-180\">{x.name}</span>\n                        </motion.span>\n                      )}\n                    </AnimatePresence>\n                    {!on && (\n                      <span className=\"@[760px]:hidden\" aria-hidden=\"true\" style={{ color: TILE.soft }}>\n                        +\n                      </span>\n                    )}\n                  </button>\n                </h3>\n\n                {/* Open content */}\n                <div id={`${uid}-p-${x.id}`} role=\"region\" aria-labelledby={`${uid}-h-${x.id}`} hidden={!on} className=\"absolute inset-0 z-20\">\n                  <AnimatePresence>\n                    {on && (\n                      <motion.div key=\"body\" className=\"flex h-full flex-col justify-between p-5 @[640px]:p-7 @[760px]:min-w-[440px]\" initial={reduce ? false : \"hide\"} animate=\"show\" exit=\"hide\" variants={{ hide: {}, show: { transition: { staggerChildren: 0.06, delayChildren: 0.18 } } }}>\n                        <div className=\"max-w-[340px]\">\n                          <motion.p variants={{ hide: { opacity: 0, y: 10 }, show: { opacity: 1, y: 0 } }} className=\"m-0 flex items-center gap-2 font-mono text-[12px]\" style={{ color: TILE.soft }}>\n                            <span>{pad(i)}</span>\n                            <span className=\"h-px w-6\" style={{ background: TILE.soft }} />\n                            <span className=\"tracking-[0.12em] uppercase\">{x.name}</span>\n                          </motion.p>\n                          <motion.p variants={{ hide: { opacity: 0, y: 14 }, show: { opacity: 1, y: 0 } }} className=\"m-0 mt-3 text-[30px] leading-[1.02] font-semibold tracking-[-0.03em] @[640px]:text-[44px]\">\n                            {x.headline}\n                          </motion.p>\n                          <motion.p variants={{ hide: { opacity: 0, y: 14 }, show: { opacity: 1, y: 0 } }} className=\"m-0 mt-3 hidden text-[14.5px] leading-relaxed @[480px]:block\" style={{ color: TILE.soft }}>\n                            {x.tagline}\n                          </motion.p>\n                        </div>\n                        <motion.div variants={{ hide: { opacity: 0, y: 10 }, show: { opacity: 1, y: 0 } }} className=\"flex flex-wrap items-end justify-between gap-3\">\n                          <p className=\"m-0 text-[13px]\" style={{ color: TILE.soft }}>\n                            {x.count} products · from{\" \"}\n                            <span className=\"font-semibold tabular-nums\" style={{ color: TILE.ink }}>\n                              {currency}\n                              {x.from}\n                            </span>\n                          </p>\n                          <a\n                            href={x.href ?? \"#\"}\n                            onClick={(e) => {\n                              if (!x.href) e.preventDefault();\n                              onShop?.(x);\n                            }}\n                            className=\"group/cta flex h-11 items-center gap-2 rounded-full pr-2 pl-5 text-[14px] font-semibold no-underline outline-none focus-visible:ring-2 focus-visible:ring-offset-2\"\n                            style={{ background: TILE.ink, color: \"#FFFFFF\", [\"--tw-ring-color\" as string]: TILE.ink, [\"--tw-ring-offset-color\" as string]: TILE.bg }}\n                          >\n                            Shop {x.name.toLowerCase()}\n                            <span className=\"grid h-7 w-7 place-items-center rounded-full transition-transform duration-300 group-hover/cta:translate-x-0.5 group-hover/cta:-rotate-45\" style={{ background: TILE.accent, color: TILE.ink }} aria-hidden=\"true\">\n                              <svg width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.4\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n                                <path d=\"M5 12h14M13 6l6 6-6 6\" />\n                              </svg>\n                            </span>\n                          </a>\n                        </motion.div>\n                      </motion.div>\n                    )}\n                  </AnimatePresence>\n                </div>\n\n                {/* Autoplay progress */}\n                {on && autoplay && (\n                  <span aria-hidden=\"true\" className=\"absolute inset-x-0 bottom-0 z-30 h-[3px]\" style={{ background: TILE.faint }}>\n                    <span\n                      key={cycle}\n                      className=\"block h-full origin-left\"\n                      style={{ background: TILE.ink, animation: `fcb-progress ${interval}ms linear forwards`, animationPlayState: paused ? \"paused\" : \"running\" }}\n                      onAnimationEnd={() => go(i + 1)}\n                    />\n                  </span>\n                )}\n              </motion.div>\n            );\n          })}\n        </div>\n        <p className=\"sr-only\" aria-live=\"polite\">\n          {panels[active]?.name}: {panels[active]?.headline}\n        </p>\n      </div>\n    </section>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}