{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "shopping-cart",
  "title": "shopping-cart",
  "description": "Animated shopping-cart icon for React",
  "type": "registry:ui",
  "registryDependencies": [],
  "dependencies": ["motion"],
  "files": [
    {
      "path": "shopping-cart.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 ShoppingCartIconHandle {\n  startAnimation: () => void;\n  stopAnimation: () => void;\n}\n\ninterface ShoppingCartIconProps extends HTMLAttributes<HTMLDivElement> {\n  size?: number;\n}\n\nconst CART_VARIANTS: Variants = {\n  normal: { scale: 1 },\n  animate: {\n    scale: 1.1,\n    y: [0, -5, 0],\n    transition: {\n      duration: 0.3,\n      ease: \"easeInOut\",\n      y: { repeat: 1, delay: 0.1, duration: 0.4 },\n    },\n  },\n};\n\nconst ShoppingCartIcon = forwardRef<\n  ShoppingCartIconHandle,\n  ShoppingCartIconProps\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      <motion.svg\n        animate={controls}\n        fill=\"none\"\n        height={size}\n        stroke=\"currentColor\"\n        strokeLinecap=\"round\"\n        strokeLinejoin=\"round\"\n        strokeWidth=\"1.5\"\n        transition={{ duration: 0.2 }}\n        variants={CART_VARIANTS}\n        viewBox=\"0 0 24 24\"\n        width={size}\n        xmlns=\"http://www.w3.org/2000/svg\"\n      >\n        <path d=\"M2.25 3h1.386c.51 0 .955.343 1.087.835l.383 1.437M7.5 14.25a3 3 0 0 0-3 3h15.75m-12.75-3h11.218c1.121-2.3 2.1-4.684 2.924-7.138a60.114 60.114 0 0 0-16.536-1.84M7.5 14.25 5.106 5.272M6 20.25a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0Zm12.75 0a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0Z\" />\n      </motion.svg>\n    </div>\n  );\n});\n\nShoppingCartIcon.displayName = \"ShoppingCartIcon\";\n\nexport { ShoppingCartIcon };\n",
      "type": "registry:ui"
    }
  ]
}
