{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "viewfinder-circle",
  "title": "viewfinder-circle",
  "description": "Animated viewfinder-circle icon for React",
  "type": "registry:ui",
  "registryDependencies": [],
  "dependencies": ["motion"],
  "files": [
    {
      "path": "viewfinder-circle.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\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface ViewfinderCircleIconHandle {\n  startAnimation: () => void;\n  stopAnimation: () => void;\n}\n\ninterface ViewfinderCircleIconProps extends HTMLAttributes<HTMLDivElement> {\n  size?: number;\n}\n\nconst CORNER_VARIANTS: Variants = {\n  normal: {\n    scale: 1,\n    rotate: 0,\n    opacity: 1,\n    transition: {\n      type: \"spring\",\n      stiffness: 200,\n      damping: 20,\n    },\n  },\n  animate: {\n    scale: 1.2,\n    rotate: 45,\n    opacity: 0,\n    transition: {\n      type: \"spring\",\n      stiffness: 200,\n      damping: 20,\n    },\n  },\n};\n\nconst CIRCLE_VARIANTS: Variants = {\n  normal: {\n    scale: 1,\n    opacity: 1,\n    transition: {\n      duration: 0.3,\n      delay: 0.1,\n    },\n  },\n  animate: {\n    scale: 0.8,\n    opacity: 0,\n    transition: {\n      duration: 0.3,\n      delay: 0.1,\n    },\n  },\n};\n\nconst ViewfinderCircleIcon = forwardRef<\n  ViewfinderCircleIconHandle,\n  ViewfinderCircleIconProps\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: async () => {\n        await controls.start(\"animate\");\n        await controls.start(\"normal\");\n      },\n      stopAnimation: () => controls.start(\"normal\"),\n    };\n  });\n\n  const handleMouseEnter = useCallback(\n    async (e: React.MouseEvent<HTMLDivElement>) => {\n      if (isControlledRef.current) {\n        onMouseEnter?.(e);\n      } else {\n        await controls.start(\"animate\");\n        await controls.start(\"normal\");\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\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=\"1.5\"\n        viewBox=\"0 0 24 24\"\n        width={size}\n        xmlns=\"http://www.w3.org/2000/svg\"\n      >\n        <motion.path\n          animate={controls}\n          d=\"M7.5 3.75H6C4.75736 3.75 3.75 4.75736 3.75 6V7.5\"\n          initial=\"normal\"\n          variants={CORNER_VARIANTS}\n        />\n        <motion.path\n          animate={controls}\n          d=\"M16.5 3.75H18C19.2426 3.75 20.25 4.75736 20.25 6V7.5\"\n          initial=\"normal\"\n          variants={CORNER_VARIANTS}\n        />\n        <motion.path\n          animate={controls}\n          d=\"M20.25 16.5V18C20.25 19.2426 19.2426 20.25 18 20.25H16.5\"\n          initial=\"normal\"\n          variants={CORNER_VARIANTS}\n        />\n        <motion.path\n          animate={controls}\n          d=\"M7.5 20.25H6C4.75736 20.25 3.75 19.2426 3.75 18V16.5\"\n          initial=\"normal\"\n          variants={CORNER_VARIANTS}\n        />\n        <motion.path\n          animate={controls}\n          d=\"M15 12C15 13.6569 13.6569 15 12 15C10.3431 15 9 13.6569 9 12C9 10.3431 10.3431 9 12 9C13.6569 9 15 10.3431 15 12Z\"\n          initial=\"normal\"\n          variants={CIRCLE_VARIANTS}\n        />\n      </svg>\n    </div>\n  );\n});\n\nViewfinderCircleIcon.displayName = \"ViewfinderCircleIcon\";\n\nexport { ViewfinderCircleIcon };\n",
      "type": "registry:ui"
    }
  ]
}
