{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "gif",
  "title": "gif",
  "description": "Animated gif icon for React",
  "type": "registry:ui",
  "registryDependencies": [],
  "dependencies": ["motion"],
  "files": [
    {
      "path": "gif.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 GifIconHandle {\n  startAnimation: () => void;\n  stopAnimation: () => void;\n}\n\ninterface GifIconProps extends HTMLAttributes<HTMLDivElement> {\n  size?: number;\n}\n\nconst LETTER_VARIANTS: Variants = {\n  normal: {\n    x: 0,\n    y: 0,\n  },\n  animate: {\n    x: [0, -0.5, 0.5, -0.3, 0.3, -0.5, 0.5, 0],\n    y: [0, 0.5, -0.5, 0.3, -0.3, 0.5, -0.5, 0],\n    transition: {\n      duration: 0.5,\n      ease: \"linear\",\n      repeat: Number.POSITIVE_INFINITY,\n      repeatType: \"loop\",\n    },\n  },\n};\n\nconst GifIcon = forwardRef<GifIconHandle, GifIconProps>(\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=\"M4.5 19.5H19.5C20.7426 19.5 21.75 18.4926 21.75 17.25V6.75C21.75 5.50736 20.7426 4.5 19.5 4.5H4.5C3.25736 4.5 2.25 5.50736 2.25 6.75V17.25C2.25 18.4926 3.25736 19.5 4.5 19.5Z\" />\n          <motion.g\n            animate={controls}\n            initial=\"normal\"\n            variants={LETTER_VARIANTS}\n          >\n            <path d=\"M9.75 9.34835C8.72056 7.88388 7.05152 7.88388 6.02208 9.34835C4.99264 10.8128 4.99264 13.1872 6.02208 14.6517C7.05152 16.1161 8.72056 16.1161 9.75 14.6517V12H8.25\" />\n            <path d=\"M12.75 8.25V15.75\" />\n            <path d=\"M18.75 8.25H15.75V12M15.75 12V15.75M15.75 12H18\" />\n          </motion.g>\n        </svg>\n      </div>\n    );\n  }\n);\n\nGifIcon.displayName = \"GifIcon\";\n\nexport { GifIcon };\n",
      "type": "registry:ui"
    }
  ]
}
