{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "retro-carousel",
  "title": "RetroCarousel",
  "description": "A Mac OS 9 styled carousel/slideshow with inset panel container and raised bevel navigation buttons with triangle arrows, built on UI SDK Carousel. Supports horizontal and vertical orientations.",
  "dependencies": [
    "@ui-sdk/core@0.1.0-beta.1",
    "@ui-sdk/react@0.1.0-beta.1"
  ],
  "registryDependencies": [
    "https://nostalgia-ui.com/r/nostalgia-theme.json"
  ],
  "files": [
    {
      "path": "registry/new-york/ui/retro-carousel.tsx",
      "content": "\"use client\"\n\n/*\n * RetroCarousel: slides in an OS 9 inset well with beveled arrow buttons, on\n * UI SDK's Carousel. It scrolls natively, so swipes, trackpads and the\n * arrow keys (with the well focused) all page it.\n *\n * Crafted moment: the page turn. The arrows, keys and swipes settle the\n * slides a page at a time on UI SDK's spring, with no overshoot; reduced\n * motion jumps straight there.\n */\n\nimport * as React from \"react\"\nimport {\n  Carousel as CarouselPrimitive,\n  CarouselContent as CarouselContentPrimitive,\n  CarouselItem as CarouselItemPrimitive,\n  CarouselNext as CarouselNextPrimitive,\n  CarouselPrevious as CarouselPreviousPrimitive,\n  CarouselViewport as CarouselViewportPrimitive,\n  createCarouselController,\n  type CarouselAlign,\n  type CarouselController,\n  type CarouselOrientation,\n} from \"@ui-sdk/react/carousel\"\n\nimport { cn } from \"@/lib/utils\"\n\n/** The carousel's controller: `next()`, `previous()`, `setPage(n)`, `getPage()`… */\ntype CarouselApi = CarouselController\n\n/** The handful of Embla options that map onto UI SDK's carousel. */\ntype CarouselOptions = {\n  loop?: boolean\n  align?: CarouselAlign\n  /** The slide to start on, from 0. */\n  startIndex?: number\n  dragFree?: boolean\n  skipSnaps?: boolean\n  /** How many slides one page holds, or \"auto\" to fit as many as show. */\n  slidesToScroll?: number | \"auto\"\n}\n\ntype RetroCarouselProps = Omit<\n  React.ComponentProps<typeof CarouselPrimitive>,\n  \"className\" | \"children\" | \"orientation\"\n> & {\n  className?: string\n  children?: React.ReactNode\n  orientation?: CarouselOrientation\n  /** Embla-style options, kept for compatibility. UI SDK's own props win. */\n  opts?: CarouselOptions\n  /** Receives the carousel's controller once, like Embla's `setApi`. */\n  setApi?: (api: CarouselApi) => void\n}\n\nconst OrientationContext = React.createContext<CarouselOrientation>(\"horizontal\")\n\n/* ── RetroCarousel (root) ──────────────────────────────── */\n\nfunction RetroCarousel({\n  orientation = \"horizontal\",\n  opts,\n  setApi,\n  controller,\n  className,\n  children,\n  \"aria-label\": ariaLabel = \"Slides\",\n  ...props\n}: RetroCarouselProps) {\n  const [ownController] = React.useState(() => createCarouselController())\n  const api = controller ?? ownController\n\n  React.useEffect(() => {\n    setApi?.(api)\n  }, [api, setApi])\n\n  return (\n    <OrientationContext.Provider value={orientation}>\n      <CarouselPrimitive\n        orientation={orientation}\n        controller={api}\n        loop={opts?.loop}\n        align={opts?.align}\n        defaultPage={opts?.startIndex !== undefined ? opts.startIndex + 1 : undefined}\n        dragFree={opts?.dragFree}\n        skipSnaps={opts?.skipSnaps}\n        slidesPerPage={opts?.slidesToScroll}\n        aria-label={ariaLabel}\n        className={cn(\"relative\", className)}\n        {...props}\n      >\n        {children}\n      </CarouselPrimitive>\n    </OrientationContext.Provider>\n  )\n}\n\n/* ── RetroCarouselContent: the inset well and its strip ── */\n\nfunction RetroCarouselContent({\n  className,\n  ...props\n}: Omit<React.ComponentProps<typeof CarouselContentPrimitive>, \"className\"> & {\n  className?: string\n}) {\n  const orientation = React.useContext(OrientationContext)\n  return (\n    <CarouselViewportPrimitive\n      className={cn(\n        \"os9-inset outline-none [scrollbar-width:none] [&::-webkit-scrollbar]:hidden\",\n        \"focus-visible:os9-focus-ring\"\n      )}\n    >\n      <CarouselContentPrimitive\n        className={cn(\"flex\", orientation === \"vertical\" && \"flex-col\", className)}\n        {...props}\n      />\n    </CarouselViewportPrimitive>\n  )\n}\n\n/* ── RetroCarouselItem ─────────────────────────────────── */\n\nfunction RetroCarouselItem({\n  className,\n  ...props\n}: Omit<React.ComponentProps<typeof CarouselItemPrimitive>, \"className\"> & {\n  className?: string\n}) {\n  return (\n    <CarouselItemPrimitive\n      className={cn(\"min-w-0 shrink-0 grow-0 basis-full\", className)}\n      {...props}\n    />\n  )\n}\n\n/* ── arrows ────────────────────────────────────────────── */\n\nconst arrowPaths = {\n  left: \"M6 1 L2 4 L6 7 Z\",\n  right: \"M2 1 L6 4 L2 7 Z\",\n  up: \"M1 6 L4 2 L7 6 Z\",\n  down: \"M1 2 L4 6 L7 2 Z\",\n} as const\n\nconst arrowButtonClass = cn(\n  \"absolute z-10\",\n  \"inline-flex items-center justify-center\",\n  \"size-[24px] p-0\",\n  /* Raised bevel */\n  \"border border-os9-black bg-os9-gray-300\",\n  \"shadow-[inset_1px_1px_0_var(--os9-white),inset_-1px_-1px_0_var(--os9-gray-700)]\",\n  /* Pressed state */\n  \"active:shadow-[inset_1px_1px_0_var(--os9-gray-700),inset_-1px_-1px_0_var(--os9-white)]\",\n  \"outline-none focus-visible:os9-focus-ring\",\n  \"cursor-pointer select-none transition-none\",\n  /* At the end there's no page that way: dimmed, still focusable (UI SDK) */\n  \"data-disabled:cursor-default data-disabled:opacity-50\",\n  \"data-disabled:active:shadow-[inset_1px_1px_0_var(--os9-white),inset_-1px_-1px_0_var(--os9-gray-700)]\"\n)\n\nfunction Arrow({ direction }: { direction: keyof typeof arrowPaths }) {\n  return (\n    <svg width=\"8\" height=\"8\" viewBox=\"0 0 8 8\" fill=\"none\" aria-hidden=\"true\">\n      <path d={arrowPaths[direction]} fill=\"var(--os9-black)\" />\n    </svg>\n  )\n}\n\ntype StepButtonProps<T extends React.ElementType> = Omit<\n  React.ComponentProps<T>,\n  \"className\" | \"children\"\n> & {\n  className?: string\n  children?: React.ReactNode\n}\n\nfunction RetroCarouselPrevious({\n  className,\n  children,\n  ...props\n}: StepButtonProps<typeof CarouselPreviousPrimitive>) {\n  const orientation = React.useContext(OrientationContext)\n  return (\n    <CarouselPreviousPrimitive\n      aria-label=\"Previous slide\"\n      className={cn(\n        arrowButtonClass,\n        orientation === \"horizontal\"\n          ? \"top-1/2 left-[4px] -translate-y-1/2\"\n          : \"left-1/2 top-[4px] -translate-x-1/2\",\n        className\n      )}\n      {...props}\n    >\n      {children ?? <Arrow direction={orientation === \"horizontal\" ? \"left\" : \"up\"} />}\n    </CarouselPreviousPrimitive>\n  )\n}\n\nfunction RetroCarouselNext({\n  className,\n  children,\n  ...props\n}: StepButtonProps<typeof CarouselNextPrimitive>) {\n  const orientation = React.useContext(OrientationContext)\n  return (\n    <CarouselNextPrimitive\n      aria-label=\"Next slide\"\n      className={cn(\n        arrowButtonClass,\n        orientation === \"horizontal\"\n          ? \"top-1/2 right-[4px] -translate-y-1/2\"\n          : \"left-1/2 bottom-[4px] -translate-x-1/2\",\n        className\n      )}\n      {...props}\n    >\n      {children ?? <Arrow direction={orientation === \"horizontal\" ? \"right\" : \"down\"} />}\n    </CarouselNextPrimitive>\n  )\n}\n\nexport {\n  type CarouselApi,\n  type CarouselOptions,\n  type RetroCarouselProps,\n  RetroCarousel,\n  RetroCarouselContent,\n  RetroCarouselItem,\n  RetroCarouselPrevious,\n  RetroCarouselNext,\n}\n",
      "type": "registry:ui"
    }
  ],
  "type": "registry:ui"
}