{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "app-screenshots-shelf",
  "title": "App Screenshots Shelf",
  "description": "Use this when an app listing shows screenshots: a drag-and-fling shelf with a caption under every screen and a phone or tablet switch that changes the frame shape.",
  "registryDependencies": [
    "@tealmac/carousel-free-scroll"
  ],
  "files": [
    {
      "path": "registry/patterns/app-screenshots-shelf/app-screenshots-shelf.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { CarouselFreeScroll } from \"@/components/ui/carousel-free-scroll\"\n\nexport interface Screenshot {\n  id: string\n  caption: string\n  picture: React.ReactNode\n}\n\nexport type Device = \"phone\" | \"tablet\"\n\nexport interface AppScreenshotsShelfProps {\n  screens: Screenshot[]\n  label: string\n  defaultDevice?: Device\n  className?: string\n}\n\nconst frames: Record<Device, { slide: string; frame: string }> = {\n  phone: { slide: \"basis-40\", frame: \"aspect-[9/19]\" },\n  tablet: { slide: \"basis-72\", frame: \"aspect-[4/3]\" },\n}\n\nexport function AppScreenshotsShelf({\n  screens,\n  label,\n  defaultDevice = \"phone\",\n  className,\n}: AppScreenshotsShelfProps) {\n  const [device, setDevice] = React.useState<Device>(defaultDevice)\n  const group = React.useId()\n  const shape = frames[device]\n\n  return (\n    <div className={cn(\"grid gap-3\", className)}>\n      <fieldset className=\"flex items-center gap-3\">\n        <legend className=\"sr-only\">Device</legend>\n        {([\"phone\", \"tablet\"] as const).map((value) => (\n          <label key={value} className=\"relative cursor-pointer\">\n            <input\n              type=\"radio\"\n              name={group}\n              value={value}\n              checked={device === value}\n              onChange={() => setDevice(value)}\n              className=\"peer sr-only\"\n            />\n            <span className=\"peer-checked:border-primary peer-checked:bg-primary peer-checked:text-primary-foreground peer-focus-visible:ring-ring/50 inline-flex h-8 items-center rounded-full border px-3 text-sm capitalize peer-focus-visible:ring-[3px]\">\n              {value}\n            </span>\n          </label>\n        ))}\n      </fieldset>\n      <CarouselFreeScroll\n        key={device}\n        label={label}\n        slideClassName={shape.slide}\n        items={screens.map((screen) => ({\n          id: screen.id,\n          label: screen.caption,\n          content: (\n            <figure className=\"grid gap-2\">\n              <div\n                aria-hidden\n                className={cn(\n                  \"border-foreground/80 overflow-hidden rounded-2xl border-4\",\n                  shape.frame\n                )}\n              >\n                {screen.picture}\n              </div>\n              <figcaption className=\"text-center text-sm\">\n                {screen.caption}\n              </figcaption>\n            </figure>\n          ),\n        }))}\n      />\n    </div>\n  )\n}\n",
      "type": "registry:block"
    }
  ],
  "type": "registry:block"
}