{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "cursor-click",
  "type": "registry:ui",
  "registryDependencies": [],
  "dependencies": ["motion"],
  "devDependencies": [],
  "files": [
    {
      "path": "cursor-click.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 CursorClickIconHandle {\n  startAnimation: () => void;\n  stopAnimation: () => void;\n}\n\ninterface CursorClickIconProps extends HTMLAttributes<HTMLDivElement> {\n  size?: number;\n}\n\nconst CURSOR_VARIANTS: Variants = {\n  initial: { x: 0, y: 0 },\n  hover: {\n    x: [0, 0, -3, 0],\n    y: [0, -4, 0, 0],\n    transition: {\n      duration: 1,\n      bounce: 0.3,\n    },\n  },\n};\n\nconst LINE_VARIANTS: Variants = {\n  initial: { opacity: 1, x: 0, y: 0 },\n  spread: (custom: { x: number; y: number }) => ({\n    opacity: [0, 1, 0, 0, 0, 0, 1],\n    x: [0, custom.x, 0, 0],\n    y: [0, custom.y, 0, 0],\n    transition: {\n      type: \"spring\",\n      stiffness: 70,\n      damping: 10,\n      mass: 0.4,\n    },\n  }),\n};\n\nconst CursorClickIcon = forwardRef<CursorClickIconHandle, CursorClickIconProps>(\n  ({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {\n    const clickControls = useAnimation();\n    const cursorControls = useAnimation();\n    const isControlledRef = useRef(false);\n\n    useImperativeHandle(ref, () => {\n      isControlledRef.current = true;\n\n      return {\n        startAnimation: () => {\n          cursorControls.start(\"hover\");\n          clickControls.start(\"spread\", { delay: 1.3 });\n        },\n        stopAnimation: () => {\n          cursorControls.start(\"initial\");\n          clickControls.start(\"initial\");\n        },\n      };\n    });\n\n    const handleMouseEnter = useCallback(\n      (e: React.MouseEvent<HTMLDivElement>) => {\n        if (isControlledRef.current) {\n          onMouseEnter?.(e);\n        } else {\n          cursorControls.start(\"hover\");\n          clickControls.start(\"spread\", { delay: 1.3 });\n        }\n      },\n      [clickControls, cursorControls, onMouseEnter]\n    );\n\n    const handleMouseLeave = useCallback(\n      (e: React.MouseEvent<HTMLDivElement>) => {\n        if (isControlledRef.current) {\n          onMouseLeave?.(e);\n        } else {\n          cursorControls.start(\"initial\");\n          clickControls.start(\"initial\");\n        }\n      },\n      [cursorControls, clickControls, onMouseLeave]\n    );\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          viewBox=\"0 0 24 24\"\n          width={size}\n          xmlns=\"http://www.w3.org/2000/svg\"\n        >\n          <motion.path\n            animate={cursorControls}\n            d=\"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z\"\n            variants={CURSOR_VARIANTS}\n          />\n          <motion.path\n            animate={clickControls}\n            custom={{ x: 1, y: -1 }}\n            d=\"M14 4.1 12 6\"\n            variants={LINE_VARIANTS}\n          />\n          <motion.path\n            animate={clickControls}\n            custom={{ x: -1, y: 0 }}\n            d=\"m5.1 8-2.9-.8\"\n            variants={LINE_VARIANTS}\n          />\n          <motion.path\n            animate={clickControls}\n            custom={{ x: -1, y: 1 }}\n            d=\"m6 12-1.9 2\"\n            variants={LINE_VARIANTS}\n          />\n          <motion.path\n            animate={clickControls}\n            custom={{ x: 0, y: -1 }}\n            d=\"M7.2 2.2 8 5.1\"\n            variants={LINE_VARIANTS}\n          />\n        </svg>\n      </div>\n    );\n  }\n);\n\nCursorClickIcon.displayName = \"CursorClickIcon\";\n\nexport { CursorClickIcon };\n",
      "type": "registry:ui"
    }
  ]
}
