{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "phone-call",
  "type": "registry:ui",
  "registryDependencies": [],
  "dependencies": ["motion"],
  "devDependencies": [],
  "files": [
    {
      "path": "phone-call.tsx",
      "content": "\"use client\";\n\nimport { motion, useAnimation, type Variants } from \"motion/react\";\nimport type { HTMLAttributes } from \"react\";\nimport { forwardRef, useCallback, useImperativeHandle, useRef } from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface PhoneCallIconHandle {\n  startAnimation: () => void;\n  stopAnimation: () => void;\n}\n\ninterface PhoneCallIconProps extends HTMLAttributes<HTMLDivElement> {\n  size?: number;\n}\n\nconst PHONE_CALL_VARIANTS: Variants = {\n  normal: {\n    rotate: 0,\n    scale: 1,\n  },\n  animate: {\n    rotate: [10, 20, -10, 10, 0],\n    scale: [1, 1.1, 1.2, 1.1, 1],\n    transition: {\n      duration: 0.9,\n      ease: \"easeInOut\",\n    },\n  },\n};\n\nconst PATH_VARIANTS: Variants = {\n  normal: {\n    opacity: 1,\n    transition: {\n      duration: 0.4,\n    },\n  },\n  fadeOut: {\n    opacity: 0,\n    transition: { duration: 0.3 },\n  },\n  fadeIn: (i: number) => ({\n    opacity: 1,\n    transition: {\n      type: \"spring\",\n      stiffness: 300,\n      damping: 20,\n      delay: i * 0.1,\n    },\n  }),\n};\n\nconst PhoneCallIcon = forwardRef<PhoneCallIconHandle, PhoneCallIconProps>(\n  ({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {\n    const svgControls = useAnimation();\n    const pathControls = useAnimation();\n    const isControlledRef = useRef(false);\n\n    const runPathIntro = useCallback(async () => {\n      await pathControls.start(\"fadeOut\");\n      pathControls.start(\"fadeIn\");\n    }, [pathControls]);\n\n    useImperativeHandle(ref, () => {\n      isControlledRef.current = ref != null;\n      return {\n        startAnimation: async () => {\n          await Promise.all([svgControls.start(\"animate\"), runPathIntro()]);\n        },\n        stopAnimation: () => {\n          svgControls.start(\"normal\");\n          pathControls.start(\"normal\");\n        },\n      };\n    }, [pathControls, runPathIntro, ref, svgControls]);\n\n    const handleMouseEnter = useCallback(\n      async (e: React.MouseEvent<HTMLDivElement>) => {\n        if (isControlledRef.current) {\n          onMouseEnter?.(e);\n        } else {\n          await Promise.all([svgControls.start(\"animate\"), runPathIntro()]);\n        }\n      },\n      [onMouseEnter, runPathIntro, svgControls]\n    );\n\n    const handleMouseLeave = useCallback(\n      (e: React.MouseEvent<HTMLDivElement>) => {\n        if (isControlledRef.current) {\n          onMouseLeave?.(e);\n        } else {\n          svgControls.start(\"normal\");\n          pathControls.start(\"normal\");\n        }\n      },\n      [onMouseLeave, pathControls, svgControls]\n    );\n\n    return (\n      <div\n        className={cn(className)}\n        onMouseEnter={handleMouseEnter}\n        onMouseLeave={handleMouseLeave}\n        {...props}\n      >\n        <motion.svg\n          animate={svgControls}\n          fill=\"none\"\n          height={size}\n          initial=\"normal\"\n          stroke=\"currentColor\"\n          strokeLinecap=\"round\"\n          strokeLinejoin=\"round\"\n          strokeWidth=\"2\"\n          style={{ overflow: \"visible\" }}\n          variants={PHONE_CALL_VARIANTS}\n          viewBox=\"0 0 24 24\"\n          width={size}\n          xmlns=\"http://www.w3.org/2000/svg\"\n        >\n          <motion.path\n            animate={pathControls}\n            custom={2}\n            d=\"M13 2a9 9 0 0 1 9 9\"\n            initial={{ opacity: 1 }}\n            variants={PATH_VARIANTS}\n          />\n          <motion.path\n            animate={pathControls}\n            custom={1}\n            d=\"M13 6a5 5 0 0 1 5 5\"\n            initial={{ opacity: 1 }}\n            variants={PATH_VARIANTS}\n          />\n          <path d=\"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384\" />\n        </motion.svg>\n      </div>\n    );\n  }\n);\n\nPhoneCallIcon.displayName = \"PhoneCallIcon\";\n\nexport { PhoneCallIcon };\n",
      "type": "registry:ui"
    }
  ]
}
