{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "truck",
  "title": "truck",
  "description": "Animated truck icon for React",
  "type": "registry:ui",
  "registryDependencies": [],
  "dependencies": ["motion"],
  "files": [
    {
      "path": "truck.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 TruckIconHandle {\n  startAnimation: () => void;\n  stopAnimation: () => void;\n}\n\ninterface TruckIconProps extends HTMLAttributes<HTMLDivElement> {\n  size?: number;\n}\n\nconst TRUCK_VARIANTS: Variants = {\n  normal: { x: 0, y: 0 },\n  animate: {\n    y: [0, -1, 0, -0.5, 0],\n    transition: {\n      duration: 0.4,\n      ease: \"easeInOut\",\n      repeat: Number.POSITIVE_INFINITY,\n      repeatType: \"loop\",\n    },\n  },\n};\n\nconst SPEED_LINE_VARIANTS: Variants = {\n  normal: {\n    opacity: 0,\n    x: 0,\n    scaleX: 0,\n  },\n  animate: (custom: number) => ({\n    opacity: [0, 0.7, 0.5, 0],\n    x: [0, -4, -10, -16],\n    scaleX: [0.2, 1, 0.8, 0.3],\n    transition: {\n      duration: 0.5,\n      ease: \"easeOut\",\n      repeat: Number.POSITIVE_INFINITY,\n      delay: custom * 0.08,\n      times: [0, 0.2, 0.6, 1],\n    },\n  }),\n};\n\nconst TruckIcon = forwardRef<TruckIconHandle, TruckIconProps>(\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          className=\"overflow-visible\"\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          {[\n            { y: 8, width: 5, x: 0 },\n            { y: 11, width: 7, x: -1 },\n            { y: 14, width: 4, x: 0 },\n          ].map((line, i) => (\n            <motion.line\n              animate={controls}\n              custom={i}\n              initial=\"normal\"\n              key={`speed-${i}`}\n              strokeLinecap=\"round\"\n              strokeWidth=\"1.5\"\n              variants={SPEED_LINE_VARIANTS}\n              x1={line.x}\n              x2={line.x + line.width}\n              y1={line.y}\n              y2={line.y}\n            />\n          ))}\n\n          <motion.path\n            animate={controls}\n            d=\"M8.25 18.75a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m3 0h6m-9 0H3.375a1.125 1.125 0 0 1-1.125-1.125V14.25m17.25 4.5a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m3 0h1.125c.621 0 1.129-.504 1.09-1.124a17.902 17.902 0 0 0-3.213-9.193 2.056 2.056 0 0 0-1.58-.86H14.25M16.5 18.75h-2.25m0-11.177v-.958c0-.568-.422-1.048-.987-1.106a48.554 48.554 0 0 0-10.026 0 1.106 1.106 0 0 0-.987 1.106v7.635m12-6.677v6.677m0 4.5v-4.5m0 0h-12\"\n            initial=\"normal\"\n            variants={TRUCK_VARIANTS}\n          />\n        </svg>\n      </div>\n    );\n  }\n);\n\nTruckIcon.displayName = \"TruckIcon\";\n\nexport { TruckIcon };\n",
      "type": "registry:ui"
    }
  ]
}
