{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "carousel-3d",
  "title": "3D Carousel",
  "author": "VenusUI",
  "description": "Cards arranged in a ring that turns in 3D, with buttons, arrow keys and announcements.",
  "dependencies": [
    "lucide-react"
  ],
  "files": [
    {
      "path": "registry/default/ui/carousel-3d.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { ChevronLeft, ChevronRight } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\ninterface Carousel3dItem {\n  id: string\n  /** Read out when the item comes to the front. */\n  label: string\n  content: React.ReactNode\n}\n\ninterface Carousel3dProps {\n  items: Carousel3dItem[]\n  /** Card width in pixels. */\n  itemWidth?: number\n  /** Accessible name for the carousel, e.g. \"Featured projects\". */\n  label?: string\n  className?: string\n}\n\n/**\n * Cards arranged in a ring that turns in 3D. Previous and Next buttons (or the\n * arrow keys when the carousel has focus) bring each card to the front, and\n * the front card is announced. Only the front card can be focused. With\n * reduced motion the ring jumps instead of turning.\n */\nfunction Carousel3d({ items, itemWidth = 220, label = \"Carousel\", className }: Carousel3dProps) {\n  const [index, setIndex] = React.useState(0)\n  const count = items.length\n  const angle = 360 / Math.max(count, 1)\n  // Radius so neighbouring cards just touch, plus a little gap.\n  const radius = Math.round(itemWidth / 2 / Math.tan(Math.PI / Math.max(count, 3))) + 24\n  const front = ((index % count) + count) % count\n\n  const go = (step: number) => setIndex((i) => i + step)\n\n  return (\n    <section\n      aria-roledescription=\"carousel\"\n      aria-label={label}\n      data-slot=\"carousel-3d\"\n      className={cn(\"flex w-full flex-col items-center gap-6\", className)}\n      onKeyDown={(event) => {\n        if (event.key === \"ArrowLeft\") go(-1)\n        if (event.key === \"ArrowRight\") go(1)\n      }}\n    >\n      <div className=\"relative h-72 w-full overflow-hidden [perspective:1100px]\">\n        <div\n          className=\"absolute top-1/2 left-1/2 transition-transform duration-700 ease-out [transform-style:preserve-3d] motion-reduce:transition-none\"\n          style={{ transform: `translate(-50%, -50%) translateZ(${-radius}px) rotateY(${-index * angle}deg)` }}\n        >\n          {items.map((item, i) => {\n            const isFront = i === front\n            return (\n              <div\n                key={item.id}\n                role=\"group\"\n                aria-roledescription=\"slide\"\n                aria-label={`${i + 1} of ${count}: ${item.label}`}\n                aria-hidden={!isFront}\n                inert={!isFront ? true : undefined}\n                className={cn(\n                  \"absolute top-1/2 left-1/2 h-60 overflow-hidden rounded-xl border bg-card transition-opacity duration-500\",\n                  isFront ? \"opacity-100\" : \"opacity-60\"\n                )}\n                style={{\n                  width: itemWidth,\n                  transform: `translate(-50%, -50%) rotateY(${i * angle}deg) translateZ(${radius}px)`,\n                }}\n              >\n                {item.content}\n              </div>\n            )\n          })}\n        </div>\n      </div>\n      <div className=\"flex items-center gap-3\">\n        <button\n          type=\"button\"\n          aria-label=\"Previous\"\n          onClick={() => go(-1)}\n          className=\"inline-flex size-9 items-center justify-center rounded-full border bg-background outline-none hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50\"\n        >\n          <ChevronLeft aria-hidden=\"true\" className=\"size-4\" />\n        </button>\n        <p aria-live=\"polite\" className=\"min-w-32 text-center text-sm text-muted-foreground\">\n          {items[front]?.label}\n        </p>\n        <button\n          type=\"button\"\n          aria-label=\"Next\"\n          onClick={() => go(1)}\n          className=\"inline-flex size-9 items-center justify-center rounded-full border bg-background outline-none hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50\"\n        >\n          <ChevronRight aria-hidden=\"true\" className=\"size-4\" />\n        </button>\n      </div>\n    </section>\n  )\n}\n\nexport { Carousel3d, type Carousel3dItem, type Carousel3dProps }\n",
      "type": "registry:ui"
    }
  ],
  "meta": {
    "version": "0.1.0"
  },
  "categories": [
    "3d",
    "interactive"
  ],
  "type": "registry:ui"
}