{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "revealing-cards",
  "type": "registry:component",
  "title": "Revealing Cards",
  "description": "Interactive micro-interaction component for revealing cards.",
  "dependencies": [
    "framer-motion"
  ],
  "files": [
    {
      "path": "components/watermelon/revealing-cards.tsx",
      "type": "registry:component",
      "content": "\"use client\";\n\nimport { motion, useMotionValue, type PanInfo } from \"framer-motion\";\nimport React, { useState } from \"react\";\n\ntype CardData = {\n  id: number;\n  z: number;\n  label: string;\n  date: string;\n  amount: string;\n  accentColor: string;\n};\n\nconst INITIAL_CARDS: CardData[] = [\n  {\n    id: 1,\n    z: 4,\n    label: \"Credit Card\",\n    date: \"Wed, 13 May\",\n    amount: \"$1,200\",\n    accentColor: \"#ef4444\",\n  },\n  {\n    id: 2,\n    z: 3,\n    label: \"Home Loan\",\n    date: \"Wed, 13 May\",\n    amount: \"$2,700\",\n    accentColor: \"#ef4444\",\n  },\n];\n\ninterface CardProps {\n  children: React.ReactNode;\n  updatePosition: () => void;\n}\nconst MAX_DRAG = 150;\nfunction Card({ children, updatePosition }: CardProps) {\n  const x = useMotionValue(0);\n  const y = useMotionValue(0);\n\n  function handleDragEnd(_: unknown, info: PanInfo) {\n    if (\n      Math.abs(info.offset.x) > MAX_DRAG ||\n      Math.abs(info.offset.y) > MAX_DRAG\n    ) {\n      updatePosition();\n    } else {\n      x.set(0);\n      y.set(0);\n    }\n  }\n\n  return (\n    <motion.div\n      style={{ x, y }}\n      drag\n      dragConstraints={{ top: 0, right: 0, bottom: 0, left: 0 }}\n      dragElastic={0.6}\n      whileTap={{ cursor: \"grabbing\" }}\n      onDragEnd={handleDragEnd}\n      className=\"absolute inset-0 cursor-grab\"\n    >\n      {children}\n    </motion.div>\n  );\n}\n\nexport default function SwipeableStackCards() {\n  const [cards, setCards] = useState<CardData[]>(INITIAL_CARDS);\n\n  const updatePosition = (id: number) => {\n    setCards((prev) => {\n      const newCards = [...prev];\n      const index = newCards.findIndex((card) => card.id === id);\n      const [card] = newCards.splice(index, 1);\n      newCards.unshift(card);\n      return newCards;\n    });\n  };\n\n  return (\n    <div className=\"flex min-h-screen items-center justify-center font-sans\">\n      <div className=\"relative h-[300px] w-[300px]\">\n        {cards.map((card, index) => (\n          <Card key={card.id} updatePosition={() => updatePosition(card.id)}>\n            <motion.div\n              style={{\n                borderRadius: \"32px\",\n                transformOrigin: \"0% 100%\",\n              }}\n              animate={{\n                rotateZ: -(cards.length - index - 1) * 10,\n                scale: 1 + index * 0.1 - cards.length * 0.1,\n              }}\n              initial={false}\n              transition={{ type: \"spring\", bounce: 0.1, duration: 0.5 }}\n              className=\"size-full overflow-hidden bg-white dark:bg-zinc-900 shadow-[0px_0px_0px_1px_rgba(0,0,0,0.03),0px_1px_2px_-1px_rgba(0,0,0,0.06),0px_2px_4px_0px_rgba(0,0,0,0.04)] dark:shadow-[0px_0px_0px_1px_rgba(255,255,255,0.06),0px_2px_8px_0px_rgba(0,0,0,0.4)] flex flex-col p-2\"\n            >\n              <div className=\"flex-1 flex h-full select-none flex-col p-4 pointer-events-none box-border\">\n                <p className=\"text-lg font-normal tracking-wide text-zinc-400 dark:text-zinc-500\">\n                  {card.label}\n                </p>\n\n                <p\n                  className=\"text-2xl font-bold leading-tight\"\n                  style={{ color: card.accentColor }}\n                >\n                  {card.date}\n                </p>\n\n                <p className=\"text-xl font-semibold text-zinc-900 dark:text-zinc-50\">\n                  {card.amount}\n                </p>\n\n                <div className=\"flex-1\" />\n\n                <div\n                  className=\"pointer-events-auto\"\n                  onClick={(e) => e.stopPropagation()}\n                ></div>\n              </div>\n              <button className=\"w-full cursor-pointer rounded-full bg-zinc-900 dark:bg-zinc-50 py-4 text-base font-semibold tracking-wide text-white dark:text-zinc-900 border-none\">\n                Pay Now\n              </button>\n            </motion.div>\n          </Card>\n        ))}\n      </div>\n    </div>\n  );\n}\n"
    }
  ]
}
