{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "qr-code",
  "title": "qr-code",
  "description": "Animated qr-code icon for React",
  "type": "registry:ui",
  "registryDependencies": [],
  "dependencies": ["motion"],
  "files": [
    {
      "path": "qr-code.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 QrCodeIconHandle {\n  startAnimation: () => void;\n  stopAnimation: () => void;\n}\n\ninterface QrCodeIconProps extends HTMLAttributes<HTMLDivElement> {\n  size?: number;\n}\n\nconst DOT_VARIANTS: Variants = {\n  normal: {\n    opacity: 1,\n    scale: 1,\n  },\n  animate: (delay: number) => ({\n    opacity: [0, 1],\n    scale: [0, 1.2, 1],\n    transition: {\n      delay,\n      duration: 0.3,\n      ease: \"easeOut\",\n    },\n  }),\n};\n\nconst QrCodeIcon = forwardRef<QrCodeIconHandle, QrCodeIconProps>(\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\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          <path d=\"M3.75 4.875C3.75 4.25368 4.25368 3.75 4.875 3.75H9.375C9.99632 3.75 10.5 4.25368 10.5 4.875V9.375C10.5 9.99632 9.99632 10.5 9.375 10.5H4.875C4.25368 10.5 3.75 9.99632 3.75 9.375V4.875Z\" />\n          <path d=\"M3.75 14.625C3.75 14.0037 4.25368 13.5 4.875 13.5H9.375C9.99632 13.5 10.5 14.0037 10.5 14.625V19.125C10.5 19.7463 9.99632 20.25 9.375 20.25H4.875C4.25368 20.25 3.75 19.7463 3.75 19.125V14.625Z\" />\n          <path d=\"M13.5 4.875C13.5 4.25368 14.0037 3.75 14.625 3.75H19.125C19.7463 3.75 20.25 4.25368 20.25 4.875V9.375C20.25 9.99632 19.7463 10.5 19.125 10.5H14.625C14.0037 10.5 13.5 9.99632 13.5 9.375V4.875Z\" />\n          <motion.path\n            animate={controls}\n            custom={0}\n            d=\"M6.75 6.75H7.5V7.5H6.75V6.75Z\"\n            initial=\"normal\"\n            variants={DOT_VARIANTS}\n          />\n          <motion.path\n            animate={controls}\n            custom={0.05}\n            d=\"M6.75 16.5H7.5V17.25H6.75V16.5Z\"\n            initial=\"normal\"\n            variants={DOT_VARIANTS}\n          />\n          <motion.path\n            animate={controls}\n            custom={0.1}\n            d=\"M16.5 6.75H17.25V7.5H16.5V6.75Z\"\n            initial=\"normal\"\n            variants={DOT_VARIANTS}\n          />\n          <motion.path\n            animate={controls}\n            custom={0.15}\n            d=\"M13.5 13.5H14.25V14.25H13.5V13.5Z\"\n            initial=\"normal\"\n            variants={DOT_VARIANTS}\n          />\n          <motion.path\n            animate={controls}\n            custom={0.2}\n            d=\"M13.5 19.5H14.25V20.25H13.5V19.5Z\"\n            initial=\"normal\"\n            variants={DOT_VARIANTS}\n          />\n          <motion.path\n            animate={controls}\n            custom={0.25}\n            d=\"M19.5 13.5H20.25V14.25H19.5V13.5Z\"\n            initial=\"normal\"\n            variants={DOT_VARIANTS}\n          />\n          <motion.path\n            animate={controls}\n            custom={0.3}\n            d=\"M19.5 19.5H20.25V20.25H19.5V19.5Z\"\n            initial=\"normal\"\n            variants={DOT_VARIANTS}\n          />\n          <motion.path\n            animate={controls}\n            custom={0.35}\n            d=\"M16.5 16.5H17.25V17.25H16.5V16.5Z\"\n            initial=\"normal\"\n            variants={DOT_VARIANTS}\n          />\n        </svg>\n      </div>\n    );\n  }\n);\n\nQrCodeIcon.displayName = \"QrCodeIcon\";\n\nexport { QrCodeIcon };\n",
      "type": "registry:ui"
    }
  ]
}
