{
  "name": "fill-battery-default",
  "type": "registry:ui",
  "tier": "free",
  "dependencies": [
    "framer-motion"
  ],
  "registryDependencies": [
    "https://www.craftui.space/r/craftui-base.json"
  ],
  "files": [
    {
      "path": "components/craftui/loaders/fill-battery/default.tsx",
      "content": "'use client';\n\nimport { useEffect } from 'react';\nimport { motion, useAnimation } from 'motion/react';\n\ninterface FillBatteryProps {\n  width?: number;\n  height?: number;\n  color?: string;\n  strokeColor?: string;\n  backgroundColor?: string;\n  isAnimating?: boolean;\n  duration?: number;\n  ease?: any;\n}\n\n// Fixed 100x100 viewBox; width/height scale the svg.\nconst FULL_WIDTH = 58;\n\nexport function FillBattery({\n  width = 60,\n  height = 60,\n  color = \"#4ade80\",\n  strokeColor = \"#1f1f1f\",\n  backgroundColor = \"#ffffff\",\n  isAnimating = true,\n  duration = 2.5,\n  ease = 'linear',\n}: FillBatteryProps) {\n  const controls = useAnimation();\n\n  useEffect(() => {\n    if (isAnimating) {\n      // Charge over ~85% of the cycle, then hold full while the level fades\n      // out so the loop restarts at empty without a visible snap.\n      controls.start({\n        width: [0, FULL_WIDTH, FULL_WIDTH],\n        opacity: [1, 1, 0],\n        transition: { duration, repeat: Infinity, ease, times: [0, 0.85, 1] },\n      });\n    } else {\n      controls.stop();\n      controls.set({ width: 0, opacity: 1 });\n    }\n  }, [isAnimating, duration, ease, controls]);\n\n  return (\n    <svg\n      width={width}\n      height={height}\n      viewBox=\"0 0 100 100\"\n      fill=\"none\"\n      xmlns=\"http://www.w3.org/2000/svg\"\n      aria-label=\"Loading\"\n      role=\"img\"\n    >\n      <defs>\n        <clipPath id={`fill-battery-clip-${width}`}>\n          <rect x={16} y={36} width={FULL_WIDTH} height={28} rx={5} />\n        </clipPath>\n      </defs>\n      {/* Body interior */}\n      <rect x={12} y={32} width={66} height={36} rx={8} fill={backgroundColor} />\n      {/* Charge level */}\n      <g clipPath={`url(#fill-battery-clip-${width})`}>\n        <motion.rect\n          x={16}\n          y={36}\n          height={28}\n          rx={5}\n          fill={color}\n          initial={{ width: 0 }}\n          animate={controls}\n        />\n      </g>\n      {/* Body outline */}\n      <rect\n        x={12}\n        y={32}\n        width={66}\n        height={36}\n        rx={8}\n        stroke={strokeColor}\n        strokeWidth={5}\n        fill=\"none\"\n      />\n      {/* Terminal nub */}\n      <rect x={83} y={42} width={8} height={16} rx={3} fill={strokeColor} />\n    </svg>\n  );\n}\n",
      "type": "registry:ui",
      "target": "~/components/craftui/loaders/fill-battery/default.tsx"
    }
  ],
  "meta": {
    "displayName": "Battery - Battery",
    "description": "An outlined battery charges up as the level sweeps from empty to full in a loop",
    "category": "loaders",
    "tags": [
      "battery",
      "charging",
      "power",
      "energy",
      "fill",
      "level",
      "progress"
    ],
    "animationType": "loop"
  }
}