{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "animated-slider",
  "title": "Animated Slider",
  "description": "Premium animated image and content slider with directional transitions, swipe gestures, captions, and numbered progress.",
  "dependencies": [
    "framer-motion",
    "@solar-icons/react"
  ],
  "files": [
    {
      "path": "components/gallery/AnimatedSlider.tsx",
      "content": "'use client';\n\nimport { useEffect, useState, type KeyboardEvent, type ReactNode } from 'react';\nimport { AnimatePresence, motion, useReducedMotion } from 'framer-motion';\nimport {\n  AltArrowLeftBoldIcon,\n  AltArrowRightBoldIcon,\n} from '@solar-icons/react';\n\nexport type AnimatedSlide = {\n  id: string;\n  image?: { src: string; alt: string };\n  content?: ReactNode;\n  eyebrow?: string;\n  title?: string;\n  description?: string;\n};\n\ntype AnimatedSliderProps = {\n  slides: AnimatedSlide[];\n  index?: number;\n  defaultIndex?: number;\n  // eslint-disable-next-line no-unused-vars\n  onIndexChange?: (index: number) => void;\n  className?: string;\n};\n\nexport default function AnimatedSlider({\n  slides,\n  index,\n  defaultIndex = 0,\n  onIndexChange,\n  className = '',\n}: AnimatedSliderProps) {\n  const [internalIndex, setInternalIndex] = useState(defaultIndex);\n  const [direction, setDirection] = useState(1);\n  const reduceMotion = useReducedMotion();\n  const lastIndex = Math.max(0, slides.length - 1);\n  const activeIndex = Math.min(Math.max(index ?? internalIndex, 0), lastIndex);\n  const activeSlide = slides[activeIndex];\n\n  useEffect(() => {\n    if (index === undefined && internalIndex > lastIndex) setInternalIndex(lastIndex);\n  }, [index, internalIndex, lastIndex]);\n\n  if (!activeSlide) return null;\n\n  const goTo = (next: number) => {\n    const clamped = Math.min(Math.max(next, 0), lastIndex);\n    if (clamped === activeIndex) return;\n    setDirection(clamped > activeIndex ? 1 : -1);\n    if (index === undefined) setInternalIndex(clamped);\n    onIndexChange?.(clamped);\n  };\n\n  const onKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n    if (event.key === 'ArrowRight') goTo(activeIndex + 1);\n    if (event.key === 'ArrowLeft') goTo(activeIndex - 1);\n  };\n\n  return (\n    <div\n      tabIndex={0}\n      role=\"region\"\n      aria-roledescription=\"carousel\"\n      aria-label=\"Featured content\"\n      onKeyDown={onKeyDown}\n      className={['w-full outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--color-ring,#6366f1)] focus-visible:ring-offset-4', className].filter(Boolean).join(' ')}\n    >\n      <div className=\"relative aspect-[16/10] overflow-hidden rounded-[var(--radius-3xl,1.5rem)] bg-[var(--color-muted,#f3f4f6)] shadow-[0_20px_60px_rgba(15,23,42,0.16)]\">\n        <AnimatePresence initial={false} custom={direction} mode=\"popLayout\">\n          <motion.div\n            key={activeSlide.id}\n            custom={direction}\n            initial={reduceMotion ? { opacity: 0 } : { opacity: 0, x: direction * 80 }}\n            animate={{ opacity: 1, x: 0 }}\n            exit={reduceMotion ? { opacity: 0 } : { opacity: 0, x: direction * -80 }}\n            transition={{ duration: reduceMotion ? 0.15 : 0.45, ease: [0.22, 1, 0.36, 1] }}\n            drag={reduceMotion ? false : 'x'}\n            dragConstraints={{ left: 0, right: 0 }}\n            dragElastic={0.12}\n            onDragEnd={(_, info) => {\n              if (info.offset.x < -50) goTo(activeIndex + 1);\n              if (info.offset.x > 50) goTo(activeIndex - 1);\n            }}\n            className=\"absolute inset-0 touch-pan-y\"\n          >\n            {activeSlide.image ? (\n              // eslint-disable-next-line @next/next/no-img-element\n              <img src={activeSlide.image.src} alt={activeSlide.image.alt} draggable={false} className=\"h-full w-full select-none object-cover\" />\n            ) : (\n              activeSlide.content\n            )}\n            {(activeSlide.eyebrow || activeSlide.title || activeSlide.description) ? (\n              <div className=\"absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/80 via-black/35 to-transparent p-5 pt-24 text-white sm:p-8 sm:pt-32\">\n                <motion.div\n                  initial={reduceMotion ? false : { opacity: 0, y: 16 }}\n                  animate={{ opacity: 1, y: 0 }}\n                  transition={{ delay: reduceMotion ? 0 : 0.16, duration: 0.35 }}\n                  className=\"max-w-lg\"\n                >\n                  {activeSlide.eyebrow ? <p className=\"text-xs font-semibold uppercase tracking-[0.18em] text-white/70\">{activeSlide.eyebrow}</p> : null}\n                  {activeSlide.title ? <h3 className=\"mt-2 text-2xl font-semibold tracking-tight sm:text-4xl\">{activeSlide.title}</h3> : null}\n                  {activeSlide.description ? <p className=\"mt-2 hidden text-sm leading-6 text-white/75 sm:block\">{activeSlide.description}</p> : null}\n                </motion.div>\n              </div>\n            ) : null}\n          </motion.div>\n        </AnimatePresence>\n      </div>\n\n      <div className=\"mt-4 flex items-center justify-between gap-4\">\n        <div className=\"flex gap-1.5\" aria-label=\"Choose slide\">\n          {slides.map((slide, slideIndex) => (\n            <button\n              key={slide.id}\n              type=\"button\"\n              aria-label={`Go to slide ${slideIndex + 1}`}\n              aria-current={slideIndex === activeIndex ? 'true' : undefined}\n              onClick={() => goTo(slideIndex)}\n              className={['h-1.5 rounded-full transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--color-ring,#6366f1)] motion-reduce:transition-none', slideIndex === activeIndex ? 'w-8 bg-[var(--color-primary,#030712)]' : 'w-3 bg-[var(--color-muted,#d1d5db)] hover:opacity-75'].join(' ')}\n            />\n          ))}\n        </div>\n        <div className=\"flex gap-2\">\n          <button type=\"button\" aria-label=\"Previous slide\" disabled={activeIndex === 0} onClick={() => goTo(activeIndex - 1)} className=\"grid h-10 w-10 place-items-center rounded-full border border-[color:var(--color-border,#e5e7eb)] bg-[var(--color-background,#fff)] text-[color:var(--color-foreground,#374151)] transition hover:bg-[var(--color-muted,#f9fafb)] focus:outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--color-ring,#6366f1)] disabled:opacity-30\">\n            <AltArrowLeftBoldIcon className=\"h-5 w-5\" aria-hidden=\"true\" />\n          </button>\n          <button type=\"button\" aria-label=\"Next slide\" disabled={activeIndex === lastIndex} onClick={() => goTo(activeIndex + 1)} className=\"grid h-10 w-10 place-items-center rounded-full border border-[color:var(--color-border,#e5e7eb)] bg-[var(--color-background,#fff)] text-[color:var(--color-foreground,#374151)] transition hover:bg-[var(--color-muted,#f9fafb)] focus:outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--color-ring,#6366f1)] disabled:opacity-30\">\n            <AltArrowRightBoldIcon className=\"h-5 w-5\" aria-hidden=\"true\" />\n          </button>\n        </div>\n      </div>\n      <p className=\"sr-only\" aria-live=\"polite\">Slide {activeIndex + 1} of {slides.length}: {activeSlide.title}</p>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "@components/gallery/AnimatedSlider.tsx"
    }
  ],
  "categories": [
    "gallery"
  ],
  "type": "registry:component"
}