{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "carousel",
  "type": "registry:block",
  "title": "Carousel",
  "description": "Carousel with Crafter styling. Explore the live example and use the source in your project.",
  "dependencies": [
    "@base-ui/react@^1.8.0",
    "class-variance-authority@^0.7.1",
    "cn@^0.2.6",
    "embla-carousel-react@^8.6.0",
    "lucide-react@^1.42.0"
  ],
  "files": [
    {
      "path": "components/ui/button.tsx",
      "type": "registry:ui",
      "content": "import { Button as ButtonPrimitive } from \"@base-ui/react/button\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { cn } from \"cn\"\n\nconst buttonVariants = cva(\n  \"group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n  {\n    variants: {\n      variant: {\n        default: \"bg-primary text-primary-foreground hover:bg-primary/80\",\n        outline:\n          \"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50\",\n        secondary:\n          \"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground\",\n        ghost:\n          \"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50\",\n        destructive:\n          \"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40\",\n        link: \"text-primary underline-offset-4 hover:underline\",\n      },\n      size: {\n        default:\n          \"h-[var(--control-height,2rem)] gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2\",\n        xs: \"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3\",\n        sm: \"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5\",\n        lg: \"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2\",\n        icon: \"size-8\",\n        \"icon-xs\":\n          \"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3\",\n        \"icon-sm\":\n          \"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg\",\n        \"icon-lg\": \"size-9\",\n      },\n    },\n    defaultVariants: {\n      variant: \"default\",\n      size: \"default\",\n    },\n  }\n)\n\nfunction Button({\n  className,\n  variant = \"default\",\n  size = \"default\",\n  ...props\n}: ButtonPrimitive.Props & VariantProps<typeof buttonVariants>) {\n  return (\n    <ButtonPrimitive\n      data-slot=\"button\"\n      className={cn(buttonVariants({ variant, size, className }))}\n      {...props}\n    />\n  )\n}\n\nexport { Button, buttonVariants }\n"
    },
    {
      "path": "components/ui/carousel.tsx",
      "type": "registry:ui",
      "content": "\"use client\";\nimport { cn } from \"cn\";\nimport useEmblaCarousel, { type UseEmblaCarouselType, } from \"embla-carousel-react\";\nimport { ChevronLeftIcon, ChevronRightIcon } from \"lucide-react\";\nimport * as React from \"react\";\nimport { Button } from \"@/components/ui/button\";\ntype CarouselApi = UseEmblaCarouselType[1];\ntype UseCarouselParameters = Parameters<typeof useEmblaCarousel>;\ntype CarouselOptions = UseCarouselParameters[0];\ntype CarouselPlugin = UseCarouselParameters[1];\ntype CarouselProps = {\n    opts?: CarouselOptions;\n    plugins?: CarouselPlugin;\n    orientation?: \"horizontal\" | \"vertical\";\n    setApi?: (api: CarouselApi) => void;\n};\ntype CarouselContextProps = {\n    carouselRef: ReturnType<typeof useEmblaCarousel>[0];\n    api: ReturnType<typeof useEmblaCarousel>[1];\n    scrollPrev: () => void;\n    scrollNext: () => void;\n    canScrollPrev: boolean;\n    canScrollNext: boolean;\n} & CarouselProps;\nconst CarouselContext = React.createContext<CarouselContextProps | null>(null);\nfunction useCarousel() {\n    const context = React.useContext(CarouselContext);\n    if (!context) {\n        throw new Error(\"useCarousel must be used within a <Carousel />\");\n    }\n    return context;\n}\nfunction Carousel({ orientation = \"horizontal\", opts, setApi, plugins, className, children, ...props }: React.ComponentProps<\"div\"> & CarouselProps) {\n    const [carouselRef, api] = useEmblaCarousel({\n        ...opts,\n        axis: orientation === \"horizontal\" ? \"x\" : \"y\",\n    }, plugins);\n    const [canScrollPrev, setCanScrollPrev] = React.useState(false);\n    const [canScrollNext, setCanScrollNext] = React.useState(false);\n    const onSelect = React.useCallback((api: CarouselApi) => {\n        if (!api)\n            return;\n        setCanScrollPrev(api.canScrollPrev());\n        setCanScrollNext(api.canScrollNext());\n    }, []);\n    const scrollPrev = React.useCallback(() => {\n        api?.scrollPrev();\n    }, [api]);\n    const scrollNext = React.useCallback(() => {\n        api?.scrollNext();\n    }, [api]);\n    const handleKeyDown = React.useCallback((event: React.KeyboardEvent<HTMLDivElement>) => {\n        if (event.key === \"ArrowLeft\") {\n            event.preventDefault();\n            scrollPrev();\n        }\n        else if (event.key === \"ArrowRight\") {\n            event.preventDefault();\n            scrollNext();\n        }\n    }, [scrollPrev, scrollNext]);\n    React.useEffect(() => {\n        if (!api || !setApi)\n            return;\n        setApi(api);\n    }, [api, setApi]);\n    React.useEffect(() => {\n        if (!api)\n            return;\n        onSelect(api);\n        api.on(\"reInit\", onSelect);\n        api.on(\"select\", onSelect);\n        return () => {\n            api?.off(\"select\", onSelect);\n        };\n    }, [api, onSelect]);\n    return (<CarouselContext.Provider value={{\n            carouselRef,\n            api: api,\n            opts,\n            orientation: orientation || (opts?.axis === \"y\" ? \"vertical\" : \"horizontal\"),\n            scrollPrev,\n            scrollNext,\n            canScrollPrev,\n            canScrollNext,\n        }}>\n      <div onKeyDownCapture={handleKeyDown} className={cn(\"relative\", className)} role=\"region\" aria-roledescription=\"carousel\" data-slot=\"carousel\" {...props}>\n        {children}\n      </div>\n    </CarouselContext.Provider>);\n}\nfunction CarouselContent({ className, ...props }: React.ComponentProps<\"div\">) {\n    const { carouselRef, orientation } = useCarousel();\n    return (<div ref={carouselRef} className=\"overflow-hidden\" data-slot=\"carousel-content\">\n      <div className={cn(\"flex\", orientation === \"horizontal\" ? \"-ml-4\" : \"-mt-4 flex-col\", className)} {...props}/>\n    </div>);\n}\nfunction CarouselItem({ className, ...props }: React.ComponentProps<\"div\">) {\n    const { orientation } = useCarousel();\n    return (<div role=\"group\" aria-roledescription=\"slide\" data-slot=\"carousel-item\" className={cn(\"min-w-0 shrink-0 grow-0 basis-full\", orientation === \"horizontal\" ? \"pl-4\" : \"pt-4\", className)} {...props}/>);\n}\nfunction CarouselPrevious({ className, variant = \"outline\", size = \"icon-sm\", ...props }: React.ComponentProps<typeof Button>) {\n    const { orientation, scrollPrev, canScrollPrev } = useCarousel();\n    return (<Button data-slot=\"carousel-previous\" variant={variant} size={size} className={cn(\"absolute touch-manipulation rounded-full\", orientation === \"horizontal\"\n            ? \"inset-y-0 -left-12 my-auto\"\n            : \"-top-12 left-1/2 -translate-x-1/2 rotate-90\", className)} disabled={!canScrollPrev} onClick={scrollPrev} {...props}>\n      <ChevronLeftIcon />\n      <span className=\"sr-only\">Previous slide</span>\n    </Button>);\n}\nfunction CarouselNext({ className, variant = \"outline\", size = \"icon-sm\", ...props }: React.ComponentProps<typeof Button>) {\n    const { orientation, scrollNext, canScrollNext } = useCarousel();\n    return (<Button data-slot=\"carousel-next\" variant={variant} size={size} className={cn(\"absolute touch-manipulation rounded-full\", orientation === \"horizontal\"\n            ? \"inset-y-0 -right-12 my-auto\"\n            : \"-bottom-12 left-1/2 -translate-x-1/2 rotate-90\", className)} disabled={!canScrollNext} onClick={scrollNext} {...props}>\n      <ChevronRightIcon />\n      <span className=\"sr-only\">Next slide</span>\n    </Button>);\n}\nexport { Carousel, type CarouselApi, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, useCarousel, };\n"
    }
  ],
  "cssVars": {
    "light": {
      "background": "#ffffff",
      "foreground": "#141414",
      "card": "#ffffff",
      "card-foreground": "#141414",
      "popover": "#ffffff",
      "popover-foreground": "#141414",
      "secondary": "#f5f5f5",
      "secondary-foreground": "#141414",
      "muted": "#f5f5f5",
      "muted-foreground": "#6b6b6b",
      "accent": "#f0f0f0",
      "accent-foreground": "#141414",
      "border": "#e6e6e6",
      "input": "#cccccc",
      "destructive": "#b91c1c",
      "syntax-text": "#242424",
      "syntax-keyword": "#754399",
      "syntax-string": "#326348",
      "syntax-function": "#315d89",
      "syntax-number": "#86551f",
      "syntax-comment": "#6b6b6b",
      "syntax-punctuation": "#616161",
      "syntax-type": "#7c464c",
      "syntax-background": "#f8f8f8",
      "sidebar": "#f5f5f5",
      "sidebar-foreground": "#141414",
      "sidebar-primary": "#141414",
      "sidebar-primary-foreground": "#ffffff",
      "sidebar-accent": "#f0f0f0",
      "sidebar-accent-foreground": "#141414",
      "sidebar-border": "#e6e6e6",
      "sidebar-ring": "#141414",
      "chart-1": "#141414",
      "chart-2": "#525252",
      "chart-3": "#737373",
      "chart-4": "#a3a3a3",
      "chart-5": "#d4d4d4",
      "primary": "#141414",
      "primary-foreground": "#ffffff",
      "ring": "#141414",
      "radius": "0rem",
      "font-sans": "ui-sans-serif, system-ui, sans-serif",
      "control-height": "2rem"
    },
    "dark": {
      "background": "#141414",
      "foreground": "#fafafa",
      "card": "#1c1c1c",
      "card-foreground": "#fafafa",
      "popover": "#1c1c1c",
      "popover-foreground": "#fafafa",
      "secondary": "#262626",
      "secondary-foreground": "#fafafa",
      "muted": "#262626",
      "muted-foreground": "#a3a3a3",
      "accent": "#303030",
      "accent-foreground": "#fafafa",
      "border": "#404040",
      "input": "#404040",
      "destructive": "#ff9d9d",
      "syntax-text": "#ededed",
      "syntax-keyword": "#c6a3df",
      "syntax-string": "#98c4a4",
      "syntax-function": "#9cbedf",
      "syntax-number": "#d7b27d",
      "syntax-comment": "#a3a3a3",
      "syntax-punctuation": "#b0b0b0",
      "syntax-type": "#dda2aa",
      "syntax-background": "#1b1b1b",
      "sidebar": "#262626",
      "sidebar-foreground": "#fafafa",
      "sidebar-primary": "#fafafa",
      "sidebar-primary-foreground": "#141414",
      "sidebar-accent": "#303030",
      "sidebar-accent-foreground": "#fafafa",
      "sidebar-border": "#404040",
      "sidebar-ring": "#fafafa",
      "chart-1": "#fafafa",
      "chart-2": "#d4d4d4",
      "chart-3": "#a3a3a3",
      "chart-4": "#737373",
      "chart-5": "#525252",
      "primary": "#fafafa",
      "primary-foreground": "#141414",
      "ring": "#fafafa",
      "radius": "0rem",
      "font-sans": "ui-sans-serif, system-ui, sans-serif",
      "control-height": "2rem"
    }
  }
}
