{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "clap",
  "type": "registry:ui",
  "registryDependencies": [],
  "dependencies": ["motion"],
  "devDependencies": [],
  "files": [
    {
      "path": "clap.tsx",
      "content": "\"use client\";\n\nimport type { Variants } from \"motion/react\";\nimport { motion, useAnimation } from \"motion/react\";\nimport type { HTMLAttributes } from \"react\";\nimport { forwardRef, useCallback, useImperativeHandle, useRef } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\nexport interface ClapIconHandle {\n  startAnimation: () => void;\n  stopAnimation: () => void;\n}\n\ninterface ClapIconProps extends HTMLAttributes<HTMLDivElement> {\n  size?: number;\n}\n\nconst VARIANTS: Variants = {\n  normal: {\n    rotate: 0,\n    originX: \"4px\",\n    originY: \"20px\",\n  },\n  animate: {\n    rotate: [-10, -10, 0],\n    transition: {\n      duration: 0.8,\n      times: [0, 0.5, 1],\n      ease: \"easeInOut\",\n    },\n  },\n};\n\nconst CLAP_VARIANTS: Variants = {\n  normal: {\n    rotate: 0,\n    originX: \"3px\",\n    originY: \"11px\",\n  },\n  animate: {\n    rotate: [0, -10, 16, 0],\n    transition: {\n      duration: 0.4,\n      times: [0, 0.3, 0.6, 1],\n      ease: \"easeInOut\",\n    },\n  },\n};\n\nconst ClapIcon = forwardRef<ClapIconHandle, ClapIconProps>(\n  ({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {\n    const controls = useAnimation();\n    const isControlledRef = useRef(false);\n\n    useImperativeHandle(ref, () => {\n      isControlledRef.current = true;\n\n      return {\n        startAnimation: () => controls.start(\"animate\"),\n        stopAnimation: () => controls.start(\"normal\"),\n      };\n    });\n\n    const handleMouseEnter = useCallback(\n      (e: React.MouseEvent<HTMLDivElement>) => {\n        if (isControlledRef.current) {\n          onMouseEnter?.(e);\n        } else {\n          controls.start(\"animate\");\n        }\n      },\n      [controls, onMouseEnter]\n    );\n\n    const handleMouseLeave = useCallback(\n      (e: React.MouseEvent<HTMLDivElement>) => {\n        if (isControlledRef.current) {\n          onMouseLeave?.(e);\n        } else {\n          controls.start(\"normal\");\n        }\n      },\n      [controls, onMouseLeave]\n    );\n    return (\n      <div\n        className={cn(className)}\n        onMouseEnter={handleMouseEnter}\n        onMouseLeave={handleMouseLeave}\n        {...props}\n      >\n        <svg\n          fill=\"none\"\n          height={size}\n          stroke=\"currentColor\"\n          strokeLinecap=\"round\"\n          strokeLinejoin=\"round\"\n          strokeWidth=\"2\"\n          style={{ overflow: \"visible\" }}\n          viewBox=\"0 0 24 24\"\n          width={size}\n          xmlns=\"http://www.w3.org/2000/svg\"\n        >\n          <motion.g animate={controls} variants={VARIANTS}>\n            <motion.g animate={controls} variants={CLAP_VARIANTS}>\n              <path d=\"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3Z\" />\n              <path d=\"m6.2 5.3 3.1 3.9\" />\n              <path d=\"m12.4 3.4 3.1 4\" />\n            </motion.g>\n            <path d=\"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z\" />\n          </motion.g>\n        </svg>\n      </div>\n    );\n  }\n);\n\nClapIcon.displayName = \"ClapIcon\";\n\nexport { ClapIcon };\n",
      "type": "registry:ui"
    }
  ]
}
