{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "category-grid-block",
  "title": "Category Grid Block",
  "description": "A bento grid of shop categories: one large feature tile, wide and small tiles with product photos on a light surface, product counts and starting prices, badges like 'New season' or 'Up to 40% off', subcategory chips, hover zoom and a rotating arrow, plus an 'All products' link.",
  "dependencies": [
    "motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/category-grid-block/category-grid-block.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { 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 GridCategory {\n  id: string;\n  name: string;\n  count: number;\n  from: number;\n  image?: string;\n  subcategories?: string[];\n  badge?: string;\n  /** Bento size on wide screens. */\n  size?: \"large\" | \"wide\" | \"small\";\n  href?: string;\n}\n\nexport interface CategoryGridBlockProps {\n  title?: string;\n  subtitle?: string;\n  categories?: GridCategory[];\n  currency?: string;\n  viewAllHref?: string;\n  onSelect?: (category: GridCategory) => 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)\", tile: \"#F1F1F1\", tileText: \"#111111\", tileMuted: \"rgba(17,17,17,0.55)\", chip: \"rgba(17,17,17,0.08)\", accent: \"#7CDE6A\", 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)\", tile: \"#F1F1F1\", tileText: \"#111111\", tileMuted: \"rgba(17,17,17,0.55)\", chip: \"rgba(17,17,17,0.07)\", accent: \"#2F9E44\", ring: \"rgba(0,0,0,0.45)\" },\n};\nconst CATEGORIES: GridCategory[] = [\n  { id: \"audio\", name: \"Audio\", count: 24, from: 49, image: \"/demo/wireless-earbuds.webp\", subcategories: [\"Earbuds\", \"Headphones\", \"Speakers\"], badge: \"New season\", size: \"large\" },\n  { id: \"watches\", name: \"Watches\", count: 12, from: 79, image: \"/demo/minimal-watch.webp\", subcategories: [\"Leather\", \"Steel\", \"Straps\"], size: \"small\" },\n  { id: \"running\", name: \"Running\", count: 18, from: 59, image: \"/demo/running-shoes.webp\", subcategories: [\"Shoes\", \"Socks\", \"Belts\"], size: \"small\" },\n  { id: \"drinkware\", name: \"Drinkware\", count: 9, from: 24, image: \"/demo/insulated-water-bottle.webp\", subcategories: [\"Bottles\", \"Tumblers\"], size: \"small\" },\n  { id: \"stationery\", name: \"Stationery\", count: 31, from: 8, image: \"/demo/notebook.webp\", subcategories: [\"Notebooks\", \"Pens\", \"Planners\"], size: \"small\" },\n  { id: \"desk\", name: \"Desk setup\", count: 15, from: 29, image: \"/demo/laptop-stand.webp\", subcategories: [\"Stands\", \"Lamps\", \"Organizers\"], badge: \"Up to 40% off\", size: \"wide\" },\n  { id: \"bags\", name: \"Bags\", count: 11, from: 39, image: \"/demo/blocks/product-list/backpack.webp\", subcategories: [\"Backpacks\", \"Totes\", \"Pouches\"], size: \"wide\" },\n];\nconst SPAN = { large: \"col-span-2 row-span-2 @[860px]:col-span-2 @[860px]:row-span-2\", wide: \"col-span-2\", small: \"col-span-1\" };\n\nexport function CategoryGridBlock({ title = \"Shop by category\", subtitle = \"Everyday essentials, designed to last and made to be used.\", categories = CATEGORIES, currency = \"$\", viewAllHref = \"#\", onSelect, theme = \"dark\", className }: CategoryGridBlockProps) {\n  const p = PALETTES[theme];\n  const reduce = !!useReducedMotion();\n  const [hover, setHover] = React.useState<string | null>(null);\n  const [broken, setBroken] = React.useState<Record<string, boolean>>({});\n  const ring = { [\"--tw-ring-color\" as string]: p.ring, [\"--tw-ring-offset-color\" as string]: p.bg } as React.CSSProperties;\n  const total = categories.reduce((a, c) => a + c.count, 0);\n\n  return (\n    <section className={cn(\"@container w-full\", className)} style={{ background: p.bg, color: p.title }}>\n      <div className=\"mx-auto max-w-6xl px-4 py-12 @[640px]:px-8\">\n        <div className=\"flex flex-wrap items-end justify-between gap-4\">\n          <div>\n            <h2 className=\"m-0 text-[30px] leading-tight font-semibold tracking-[-0.03em] @[640px]:text-[40px]\">{title}</h2>\n            <p className=\"m-0 mt-2 max-w-[48ch] text-[15px]\" style={{ color: p.body }}>\n              {subtitle}\n            </p>\n          </div>\n          <a href={viewAllHref} className=\"group flex items-center gap-2 rounded-full border px-4 py-2 text-[13.5px] font-medium no-underline outline-none focus-visible:ring-2 focus-visible:ring-offset-2\" style={{ borderColor: p.line, color: p.title, ...ring }}>\n            All {total} products\n            <span className=\"transition-transform group-hover:translate-x-0.5\" aria-hidden=\"true\">\n              →\n            </span>\n          </a>\n        </div>\n\n        <ul className=\"m-0 mt-8 grid list-none auto-rows-[170px] grid-cols-2 gap-3 p-0 @[640px]:auto-rows-[200px] @[860px]:grid-cols-4\">\n          {categories.map((c, i) => {\n            const size = c.size ?? \"small\";\n            const on = hover === c.id;\n            const big = size === \"large\";\n            return (\n              <motion.li key={c.id} className={cn(SPAN[size], \"min-w-0\")} initial={reduce ? false : { opacity: 0, y: 16 }} animate={{ opacity: 1, y: 0 }} transition={{ duration: 0.5, delay: reduce ? 0 : i * 0.06, ease: [0.22, 1, 0.36, 1] }}>\n                <a\n                  href={c.href ?? \"#\"}\n                  onClick={(e) => {\n                    if (onSelect) {\n                      e.preventDefault();\n                      onSelect(c);\n                    }\n                  }}\n                  onMouseEnter={() => setHover(c.id)}\n                  onMouseLeave={() => setHover(null)}\n                  onFocus={() => setHover(c.id)}\n                  onBlur={() => setHover(null)}\n                  aria-label={`${c.name}, ${c.count} products from ${currency}${c.from}`}\n                  className=\"relative flex h-full w-full overflow-hidden rounded-3xl no-underline outline-none focus-visible:ring-2 focus-visible:ring-offset-2\"\n                  style={{ background: p.tile, color: p.tileText, ...ring }}\n                >\n                  {c.image && !broken[c.id] ? (\n                    <motion.img src={c.image} alt=\"\" onError={() => setBroken((b) => ({ ...b, [c.id]: true }))} className={cn(\"pointer-events-none absolute\", size === \"small\" ? \"top-[36%] left-3 h-[calc(64%-0.75rem)] w-[calc(100%-1.5rem)] object-contain\" : size === \"wide\" ? \"top-[36%] left-3 h-[calc(64%-0.75rem)] w-[calc(100%-1.5rem)] object-contain @[640px]:top-0 @[640px]:right-0 @[640px]:left-auto @[640px]:h-full @[640px]:w-[58%] @[640px]:object-right\" : \"inset-0 h-full w-full object-cover\")} animate={{ scale: on && !reduce ? 1.06 : 1 }} transition={{ duration: 0.6, ease: [0.22, 1, 0.36, 1] }} />\n                  ) : (\n                    <span className=\"absolute right-4 bottom-2 text-[80px] leading-none font-semibold opacity-10\" aria-hidden=\"true\">\n                      {c.name[0]}\n                    </span>\n                  )}\n                  <span className={cn(\"relative flex h-full flex-col justify-between p-4 @[640px]:p-5\", size === \"wide\" ? \"w-full @[640px]:w-[56%]\" : \"w-full\")}>\n                    <span className=\"flex items-start justify-between gap-2\">\n                      <span className=\"min-w-0\">\n                        <span className={cn(\"block font-semibold tracking-[-0.02em]\", big ? \"text-[24px] @[640px]:text-[30px]\" : \"text-[16px] @[640px]:text-[18px]\")}>{c.name}</span>\n                        <span className=\"mt-0.5 block text-[12.5px]\" style={{ color: p.tileMuted }}>\n                          {c.count} products · from {currency}\n                          {c.from}\n                        </span>\n                      </span>\n                      {c.badge && (\n                        <span className=\"shrink-0 rounded-full px-2.5 py-1 text-[11px] font-medium whitespace-nowrap\" style={{ background: \"#111111\", color: \"#FFFFFF\" }}>\n                          {c.badge}\n                        </span>\n                      )}\n                    </span>\n                    <span className=\"flex items-end justify-between gap-3\">\n                      {c.subcategories && (big || size === \"wide\") ? (\n                        <motion.span className=\"flex flex-wrap gap-1.5\" initial={false} animate={{ opacity: on || big ? 1 : 0, y: on || big ? 0 : 6 }} transition={{ duration: reduce ? 0 : 0.25 }}>\n                          {c.subcategories.map((s) => (\n                            <span key={s} className=\"rounded-full px-2.5 py-1 text-[11.5px] backdrop-blur-sm\" style={{ background: \"rgba(255,255,255,0.75)\", color: p.tileText }}>\n                              {s}\n                            </span>\n                          ))}\n                        </motion.span>\n                      ) : (\n                        <span />\n                      )}\n                      <motion.span className=\"grid h-9 w-9 shrink-0 place-items-center rounded-full\" animate={{ backgroundColor: on ? \"#111111\" : \"rgba(255,255,255,0.85)\", color: on ? \"#FFFFFF\" : \"#111111\", rotate: on && !reduce ? -45 : 0 }} transition={{ duration: reduce ? 0 : 0.25 }} aria-hidden=\"true\">\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n                          <path d=\"M5 12h14M13 6l6 6-6 6\" />\n                        </svg>\n                      </motion.span>\n                    </span>\n                  </span>\n                </a>\n              </motion.li>\n            );\n          })}\n        </ul>\n      </div>\n    </section>\n  );\n}\n\nexport default CategoryGridBlock;\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}