{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "calculator",
  "title": "calculator",
  "description": "Animated calculator icon for React",
  "type": "registry:ui",
  "registryDependencies": [],
  "dependencies": ["motion"],
  "files": [
    {
      "path": "calculator.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 CalculatorIconHandle {\n  startAnimation: () => void;\n  stopAnimation: () => void;\n}\n\ninterface CalculatorIconProps extends HTMLAttributes<HTMLDivElement> {\n  size?: number;\n}\n\nconst BUTTON_VARIANTS: Variants = {\n  normal: {\n    scale: 1,\n    opacity: 1,\n  },\n  animate: (delay: number) => ({\n    scale: [1, 1.5, 1],\n    opacity: [1, 0.5, 1],\n    transition: {\n      duration: 0.15,\n      delay: delay * 0.08,\n      ease: \"easeOut\",\n    },\n  }),\n};\n\nconst ENTER_VARIANTS: Variants = {\n  normal: {\n    scale: 1,\n    opacity: 1,\n  },\n  animate: {\n    scale: [1, 1.3, 1],\n    opacity: [1, 0.6, 1],\n    transition: {\n      duration: 0.2,\n      delay: 0.5,\n      ease: \"easeOut\",\n    },\n  },\n};\n\nconst SCREEN_VARIANTS: Variants = {\n  normal: {\n    opacity: 1,\n  },\n  animate: {\n    opacity: [1, 0.4, 1],\n    transition: {\n      duration: 0.2,\n      delay: 0.65,\n      ease: \"easeOut\",\n    },\n  },\n};\n\nconst CalculatorIcon = forwardRef<CalculatorIconHandle, CalculatorIconProps>(\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=\"M12 2.25C10.108 2.25 8.24156 2.35947 6.40668 2.57241C5.30608 2.70014 4.5 3.649 4.5 4.75699V19.5C4.5 20.7426 5.50736 21.75 6.75 21.75H17.25C18.4926 21.75 19.5 20.7426 19.5 19.5V4.75699C19.5 3.649 18.6939 2.70014 17.5933 2.57241C15.7584 2.35947 13.892 2.25 12 2.25Z\" />\n          <motion.path\n            animate={controls}\n            d=\"M8.25 6H15.75V8.25H8.25V6Z\"\n            initial=\"normal\"\n            variants={SCREEN_VARIANTS}\n          />\n          <motion.path\n            animate={controls}\n            custom={0}\n            d=\"M8.25 11.25H8.2575V11.2575H8.25V11.25Z\"\n            initial=\"normal\"\n            variants={BUTTON_VARIANTS}\n          />\n          <motion.path\n            animate={controls}\n            custom={2}\n            d=\"M10.7476 11.25H10.7551V11.2575H10.7476V11.25Z\"\n            initial=\"normal\"\n            variants={BUTTON_VARIANTS}\n          />\n          <motion.path\n            animate={controls}\n            custom={1}\n            d=\"M13.2524 13.5H13.2599V13.5075H13.2524V13.5Z\"\n            initial=\"normal\"\n            variants={BUTTON_VARIANTS}\n          />\n          <motion.path\n            animate={controls}\n            custom={4}\n            d=\"M8.25 15.75H8.2575V15.7575H8.25V15.75Z\"\n            initial=\"normal\"\n            variants={BUTTON_VARIANTS}\n          />\n          <motion.path\n            animate={controls}\n            custom={3}\n            d=\"M15.75 11.25H15.7575V11.2575H15.75V11.25Z\"\n            initial=\"normal\"\n            variants={BUTTON_VARIANTS}\n          />\n          <motion.path\n            animate={controls}\n            custom={5}\n            d=\"M10.7476 18H10.7551V18.0075H10.7476V18Z\"\n            initial=\"normal\"\n            variants={BUTTON_VARIANTS}\n          />\n          <path d=\"M8.25 13.5H8.2575V13.5075H8.25V13.5Z\" />\n          <path d=\"M8.25 18H8.2575V18.0075H8.25V18Z\" />\n          <path d=\"M10.7476 13.5H10.7551V13.5075H10.7476V13.5Z\" />\n          <path d=\"M10.7476 15.75H10.7551V15.7575H10.7476V15.75Z\" />\n          <path d=\"M13.2524 11.25H13.2599V11.2575H13.2524V11.25Z\" />\n          <path d=\"M13.2524 15.75H13.2599V15.7575H13.2524V15.75Z\" />\n          <path d=\"M13.2524 18H13.2599V18.0075H13.2524V18Z\" />\n          <path d=\"M15.75 13.5H15.7575V13.5075H15.75V13.5Z\" />\n          <motion.path\n            animate={controls}\n            d=\"M15.75 15.75V18\"\n            initial=\"normal\"\n            variants={ENTER_VARIANTS}\n          />\n        </svg>\n      </div>\n    );\n  }\n);\n\nCalculatorIcon.displayName = \"CalculatorIcon\";\n\nexport { CalculatorIcon };\n",
      "type": "registry:ui"
    }
  ]
}
