{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "ripple-button",
  "title": "Ripple Button",
  "author": "VenusUI",
  "description": "A button that sends a ripple out from where it was pressed.",
  "files": [
    {
      "path": "registry/default/ui/ripple-button.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\ninterface Ripple {\n  id: number\n  x: number\n  y: number\n  size: number\n}\n\ninterface RippleButtonProps extends React.ComponentProps<\"button\"> {\n  /** Ripple color. Any CSS color. Defaults to the text color at low opacity. */\n  rippleColor?: string\n}\n\n/**\n * A button that sends a ripple out from the point where it was pressed.\n * Keyboard presses ripple from the center. No ripple with reduced motion.\n */\nfunction RippleButton({ className, rippleColor, type = \"button\", onPointerDown, onKeyDown, children, ...props }: RippleButtonProps) {\n  const [ripples, setRipples] = React.useState<Ripple[]>([])\n  const nextId = React.useRef(0)\n\n  function addRipple(element: HTMLElement, clientX?: number, clientY?: number) {\n    if (window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches) return\n    const rect = element.getBoundingClientRect()\n    const size = Math.max(rect.width, rect.height) * 2\n    const x = (clientX ?? rect.left + rect.width / 2) - rect.left - size / 2\n    const y = (clientY ?? rect.top + rect.height / 2) - rect.top - size / 2\n    const id = nextId.current++\n    setRipples((current) => [...current, { id, x, y, size }])\n  }\n\n  return (\n    <button\n      type={type}\n      data-slot=\"ripple-button\"\n      className={cn(\n        \"relative inline-flex h-9 items-center justify-center gap-2 overflow-hidden rounded-lg bg-primary px-4 text-sm font-medium whitespace-nowrap text-primary-foreground outline-none select-none\",\n        \"transition-[translate,background-color] hover:bg-primary/90 focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px disabled:pointer-events-none disabled:opacity-50\",\n        \"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n        className\n      )}\n      onPointerDown={(event) => {\n        onPointerDown?.(event)\n        addRipple(event.currentTarget, event.clientX, event.clientY)\n      }}\n      onKeyDown={(event) => {\n        onKeyDown?.(event)\n        if ((event.key === \"Enter\" || event.key === \" \") && !event.repeat) addRipple(event.currentTarget)\n      }}\n      {...props}\n    >\n      <span className=\"relative z-10 inline-flex items-center gap-2\">{children}</span>\n      {ripples.map((ripple) => (\n        <span\n          key={ripple.id}\n          aria-hidden=\"true\"\n          className=\"pointer-events-none absolute animate-ripple rounded-full\"\n          style={{\n            left: ripple.x,\n            top: ripple.y,\n            width: ripple.size,\n            height: ripple.size,\n            background: rippleColor ?? \"color-mix(in oklch, currentColor 30%, transparent)\",\n          }}\n          onAnimationEnd={() => setRipples((current) => current.filter((r) => r.id !== ripple.id))}\n        />\n      ))}\n    </button>\n  )\n}\n\nexport { RippleButton, type RippleButtonProps }\n",
      "type": "registry:ui"
    }
  ],
  "cssVars": {
    "theme": {
      "animate-ripple": "ripple 600ms ease-out forwards"
    }
  },
  "css": {
    "@keyframes ripple": {
      "from": {
        "transform": "scale(0)",
        "opacity": "1"
      },
      "to": {
        "transform": "scale(1)",
        "opacity": "0"
      }
    }
  },
  "meta": {
    "version": "0.1.0"
  },
  "categories": [
    "buttons",
    "animations"
  ],
  "type": "registry:ui"
}