{
  "name": "cai-animated-volume",
  "type": "registry:ui",
  "description": "cai-animated-volume component for the Canadian AI design system",
  "dependencies": [
    "motion"
  ],
  "files": [
    {
      "path": "components/lucide-animated/volume.tsx",
      "target": "@components/lucide-animated/cai-animated-volume.tsx",
      "content": "/*\nMIT License\n\nCopyright (c) 2024-2026 pqoqubbw\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\n\"use client\";\n\nimport { AnimatePresence, motion } from \"motion/react\";\nimport type { HTMLAttributes } from \"react\";\nimport {\n  Fragment,\n  forwardRef,\n  useCallback,\n  useImperativeHandle,\n  useRef,\n  useState,\n} from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\nexport interface VolumeIconHandle {\n  startAnimation: () => void;\n  stopAnimation: () => void;\n}\n\ninterface VolumeIconProps extends HTMLAttributes<HTMLDivElement> {\n  size?: number;\n}\n\nconst VolumeIcon = forwardRef<VolumeIconHandle, VolumeIconProps>(\n  ({ onMouseEnter, onMouseLeave, className, size = 20, ...props }, ref) => {\n    const [isHovered, setIsHovered] = useState(false);\n    const isControlledRef = useRef(false);\n\n    useImperativeHandle(ref, () => {\n      isControlledRef.current = true;\n\n      return {\n        startAnimation: () => setIsHovered(true),\n        stopAnimation: () => setIsHovered(false),\n      };\n    });\n\n    const handleMouseEnter = useCallback(\n      (e: React.MouseEvent<HTMLDivElement>) => {\n        if (isControlledRef.current) {\n          onMouseEnter?.(e);\n        } else {\n          setIsHovered(true);\n        }\n      },\n      [onMouseEnter]\n    );\n\n    const handleMouseLeave = useCallback(\n      (e: React.MouseEvent<HTMLDivElement>) => {\n        if (isControlledRef.current) {\n          onMouseLeave?.(e);\n        } else {\n          setIsHovered(false);\n        }\n      },\n      [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=\"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z\" />\n          <AnimatePresence initial={false} mode=\"wait\">\n            {isHovered ? (\n              <Fragment key=\"volume-icon-active\">\n                <motion.path\n                  animate={{ opacity: 1, transition: { delay: 0.1 } }}\n                  d=\"M16 9a5 5 0 0 1 0 6\"\n                  exit={{ opacity: 0 }}\n                  initial={{ opacity: 0 }}\n                />\n                <motion.path\n                  animate={{ opacity: 1, transition: { delay: 0.2 } }}\n                  d=\"M19.364 18.364a9 9 0 0 0 0-12.728\"\n                  exit={{ opacity: 0 }}\n                  initial={{ opacity: 0 }}\n                />\n              </Fragment>\n            ) : (\n              <Fragment key=\"volume-icon-inactive\">\n                <motion.line\n                  animate={{\n                    pathLength: [0, 1],\n                    opacity: [0, 1],\n                    transition: { delay: 0.1 },\n                  }}\n                  exit={{ pathLength: 1, opacity: 1 }}\n                  initial={{ pathLength: 1, opacity: 1 }}\n                  x1=\"22\"\n                  x2=\"16\"\n                  y1=\"9\"\n                  y2=\"15\"\n                />\n                <motion.line\n                  animate={{\n                    pathLength: [0, 1],\n                    opacity: [0, 1],\n                    transition: { delay: 0.2 },\n                  }}\n                  exit={{ pathLength: 1, opacity: 1 }}\n                  initial={{ pathLength: 1, opacity: 1 }}\n                  x1=\"16\"\n                  x2=\"22\"\n                  y1=\"9\"\n                  y2=\"15\"\n                />\n              </Fragment>\n            )}\n          </AnimatePresence>\n        </svg>\n      </div>\n    );\n  }\n);\n\nVolumeIcon.displayName = \"VolumeIcon\";\n\nexport { VolumeIcon };\n",
      "type": "registry:ui"
    }
  ]
}