{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "card-swipe-base",
  "type": "registry:component",
  "title": "Card Swipe (base)",
  "description": "Theme-ready base variant of A tactile, gesture-driven card stack that supports velocity-based swiping and smooth pagination..",
  "dependencies": [
    "@hugeicons/core-free-icons",
    "@hugeicons/react",
    "motion",
    "next-themes"
  ],
  "registryDependencies": [
    "utils"
  ],
  "files": [
    {
      "path": "components/watermelon/card-swipe.tsx",
      "type": "registry:component",
      "content": "'use client';\n\nimport React, { useState, type ReactNode } from 'react';\nimport {\n  motion,\n  useMotionValue,\n  useTransform,\n  type PanInfo,\n  type Transition,\n} from 'motion/react';\nimport { HugeiconsIcon } from '@hugeicons/react';\nimport {\n  Book02Icon,\n  Brain02Icon,\n  DropletFreeIcons,\n  RunningShoesIcon,\n  SwimmingIcon,\n} from '@hugeicons/core-free-icons';\nimport { cn } from '@/lib/utils';\n\nexport interface CardItem {\n  id: number;\n  title: string;\n  description: string;\n  icon: () => ReactNode;\n}\n\ninterface CardCarouselProps {\n  items?: CardItem[];\n}\n\nconst DEFAULT_CARDS: CardItem[] = [\n  {\n    id: 1,\n    title: 'Reading',\n    description: 'Sharpen your mind & escape to new adventures.',\n    icon: () => (\n      <HugeiconsIcon\n        icon={Book02Icon}\n        size={52}\n        color=\"currentColor\"\n        strokeWidth={1.5}\n      />\n    ),\n  },\n  {\n    id: 2,\n    title: 'Drink Water',\n    description: 'Stay hydrated & energized. Your body will thank you!',\n    icon: () => (\n      <HugeiconsIcon\n        icon={DropletFreeIcons}\n        size={52}\n        color=\"currentColor\"\n        strokeWidth={1.5}\n      />\n    ),\n  },\n  {\n    id: 3,\n    title: 'Running',\n    description: 'Feel the endorphins! Get a quick energy boost.',\n    icon: () => (\n      <HugeiconsIcon\n        icon={RunningShoesIcon}\n        size={52}\n        color=\"currentColor\"\n        strokeWidth={1.5}\n      />\n    ),\n  },\n  {\n    id: 4,\n    title: 'Swimming',\n    description: 'Low-impact workout. Refreshing & invigorating.',\n    icon: () => (\n      <HugeiconsIcon\n        icon={SwimmingIcon}\n        size={52}\n        color=\"currentColor\"\n        strokeWidth={1.5}\n      />\n    ),\n  },\n  {\n    id: 5,\n    title: 'Meditation',\n    description: 'Find inner peace. Just 5 minutes can de-stress.',\n    icon: () => (\n      <HugeiconsIcon\n        icon={Brain02Icon}\n        size={52}\n        color=\"currentColor\"\n        strokeWidth={1.5}\n      />\n    ),\n  },\n];\n\nconst ITEM_WIDTH = 320;\nconst GAP = 16;\nconst CONTAINER_WIDTH = ITEM_WIDTH + GAP;\nconst DRAG_BUFFER = 50;\nconst VELOCITY_THRESHOLD = 500;\n\nconst SPRING_OPTIONS: Transition = {\n  type: 'spring',\n  stiffness: 330,\n  damping: 30,\n};\n\ninterface CarouselCardProps {\n  item: CardItem;\n  index: number;\n  x: ReturnType<typeof useMotionValue<number>>;\n  itemCount: number;\n}\n\nconst CarouselCard: React.FC<CarouselCardProps> = ({\n  item,\n  index,\n  x,\n  itemCount,\n}) => {\n  const nextIndex = Math.min(index + 1, itemCount - 1);\n  const prevIndex = Math.max(index - 1, 0);\n\n  const range = [\n    (-100 * (index + 1) * CONTAINER_WIDTH) / 100,\n    (-100 * index * CONTAINER_WIDTH) / 100,\n    (-100 * (index - 1) * CONTAINER_WIDTH) / 100,\n  ];\n  const outputRange = [nextIndex ? 90 : 90, 0, prevIndex ? -90 : -90];\n\n  const rotateY = useTransform(x, range, outputRange, { clamp: false });\n\n  return (\n    <motion.div\n      style={{\n        width: ITEM_WIDTH,\n        height: 420,\n        rotateY,\n        flexShrink: 0,\n      }}\n      transition={SPRING_OPTIONS}\n      className=\"border-border bg-card dark:border-border dark:bg-card flex cursor-grab flex-col items-start rounded-4xl border-[1.6px] p-8 transition-colors active:cursor-grabbing sm:p-10\"\n    >\n      <div className=\"border-border bg-card text-foreground dark:border-border dark:bg-card dark:text-foreground mb-6 flex h-20 w-20 items-center justify-center rounded-2xl border-[1.6px] shadow-md transition-colors sm:mb-10 sm:h-24 sm:w-24 sm:rounded-3xl\">\n        {item.icon()}\n      </div>\n\n      <h2 className=\"text-foreground dark:text-foreground mb-2 font-sans text-2xl font-bold sm:text-[32px]\">\n        {item.title}\n      </h2>\n\n      <p className=\"text-muted-foreground dark:text-muted-foreground mb-5 font-sans text-lg sm:text-[22px]\">\n        {item.description}\n      </p>\n\n      <motion.button\n        whileHover={{ scale: 1.02 }}\n        whileTap={{ scale: 0.98 }}\n        className=\"bg-primary text-primary-foreground dark:bg-primary dark:text-primary-foreground rounded-full px-6 py-2.5 font-sans text-sm shadow-sm sm:px-7 sm:py-3 sm:text-base\"\n      >\n        Get Started\n      </motion.button>\n    </motion.div>\n  );\n};\n\nexport const CardSwipe: React.FC<CardCarouselProps> = ({\n  items = DEFAULT_CARDS,\n}) => {\n  const [currentIndex, setCurrentIndex] = useState(0);\n\n  const x = useMotionValue(0);\n\n  const handleDragEnd = (_: unknown, info: PanInfo) => {\n    const offset = info.offset.x;\n    const velocity = info.velocity.x;\n\n    if (offset < -DRAG_BUFFER || velocity < -VELOCITY_THRESHOLD) {\n      setCurrentIndex((prev) => Math.min(prev + 1, items.length - 1));\n    } else if (offset > DRAG_BUFFER || velocity > VELOCITY_THRESHOLD) {\n      setCurrentIndex((prev) => Math.max(prev - 1, 0));\n    }\n  };\n\n  const leftConstraint = -((ITEM_WIDTH + GAP) * (items.length - 1));\n\n  return (\n    <div className=\"theme-injected flex flex-col items-center justify-center\">\n      <div\n        className=\"relative overflow-hidden\"\n        style={{ width: ITEM_WIDTH, height: 420 }}\n      >\n        <motion.div\n          className=\"flex\"\n          drag=\"x\"\n          dragConstraints={{ left: leftConstraint, right: 0 }}\n          style={{\n            gap: GAP,\n            perspective: 1000,\n            perspectiveOrigin: currentIndex * ITEM_WIDTH + ITEM_WIDTH / 2,\n            x,\n          }}\n          onDragEnd={handleDragEnd}\n          animate={{ x: -(currentIndex * CONTAINER_WIDTH) }}\n          transition={SPRING_OPTIONS}\n        >\n          {items.map((item, index) => (\n            <CarouselCard\n              key={item.id}\n              item={item}\n              index={index}\n              x={x}\n              itemCount={items.length}\n            />\n          ))}\n        </motion.div>\n      </div>\n\n      <div className=\"mt-4 flex gap-3 sm:mt-6\">\n        {items.map((_, i) => (\n          <div\n            key={i}\n            className={cn(\n              'bg-secondary h-2 w-2 cursor-pointer rounded-full transition-colors duration-200',\n              currentIndex === i && 'bg-primary',\n            )}\n            onClick={() => setCurrentIndex(i)}\n          />\n        ))}\n      </div>\n    </div>\n  );\n};\n\nexport default CardSwipe;\n"
    }
  ]
}
