{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "animated-loader",
  "title": "Animated Loader",
  "description": "A loading spinner kit with 4 variants, rotating lines, ring, dual counter-rotating ring, and bouncing dots, sharing a common color/size/speed API.",
  "dependencies": [
    "motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/animated-loader/animated-loader.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { motion } from \"motion/react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nfunction cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\nexport type AnimatedLoaderVariant = \"lines\" | \"ring\" | \"dual-ring\" | \"dots\";\n\nexport interface AnimatedLoaderProps extends Omit<React.ComponentPropsWithoutRef<\"div\">, \"children\"> {\n  variant?: AnimatedLoaderVariant;\n  lineCount?: 8 | 12;\n  color?: string;\n  trackColor?: string;\n  background?: string;\n  size?: number;\n  thickness?: number;\n  speed?: number;\n}\n\nfunction LinesLoader({ count, color, size, thickness, speed }: { count: number; color: string; size: number; thickness: number; speed: number }) {\n  const barHeight = size * 0.26;\n  const radius = size / 2 - barHeight / 2 - 2;\n\n  return (\n    <motion.div style={{ position: \"relative\", width: size, height: size }} animate={{ rotate: 360 }} transition={{ duration: speed, repeat: Infinity, ease: \"linear\" }}>\n      {Array.from({ length: count }).map((_, i) => {\n        const angle = (360 / count) * i;\n        const opacity = 1 - (i / count) * 0.82;\n        return (\n          <div\n            key={i}\n            className=\"absolute top-1/2 left-1/2\"\n            style={{ width: thickness, height: barHeight, borderRadius: thickness, backgroundColor: color, opacity, transform: `translate(-50%, -50%) rotate(${angle}deg) translateY(-${radius}px)` }}\n          />\n        );\n      })}\n    </motion.div>\n  );\n}\n\nfunction RingLoader({ color, trackColor, size, thickness, speed }: { color: string; trackColor: string; size: number; thickness: number; speed: number }) {\n  const radius = (size - thickness) / 2;\n  const circumference = 2 * Math.PI * radius;\n  const dash = circumference * 0.26;\n\n  return (\n    <div className=\"relative\" style={{ width: size, height: size }}>\n      <svg width={size} height={size} className=\"absolute inset-0\">\n        <circle cx={size / 2} cy={size / 2} r={radius} fill=\"none\" stroke={trackColor} strokeWidth={thickness} />\n      </svg>\n      <motion.div className=\"absolute inset-0\" animate={{ rotate: 360 }} transition={{ duration: speed, repeat: Infinity, ease: \"linear\" }}>\n        <svg width={size} height={size}>\n          <circle cx={size / 2} cy={size / 2} r={radius} fill=\"none\" stroke={color} strokeWidth={thickness} strokeLinecap=\"round\" strokeDasharray={`${dash} ${circumference - dash}`} />\n        </svg>\n      </motion.div>\n    </div>\n  );\n}\n\nfunction DualRingLoader({ color, size, thickness, speed }: { color: string; size: number; thickness: number; speed: number }) {\n  const outerR = (size - thickness) / 2;\n  const innerR = Math.max(outerR - thickness * 2.4, thickness);\n  const outerC = 2 * Math.PI * outerR;\n  const innerC = 2 * Math.PI * innerR;\n  const outerDash = outerC * 0.28;\n  const innerDash = innerC * 0.28;\n\n  return (\n    <div className=\"relative\" style={{ width: size, height: size }}>\n      <motion.div className=\"absolute inset-0\" animate={{ rotate: 360 }} transition={{ duration: speed, repeat: Infinity, ease: \"linear\" }}>\n        <svg width={size} height={size}>\n          <circle cx={size / 2} cy={size / 2} r={outerR} fill=\"none\" stroke={color} strokeWidth={thickness} strokeLinecap=\"round\" strokeDasharray={`${outerDash} ${outerC - outerDash}`} />\n        </svg>\n      </motion.div>\n      <motion.div className=\"absolute inset-0\" animate={{ rotate: -360 }} transition={{ duration: speed * 0.75, repeat: Infinity, ease: \"linear\" }}>\n        <svg width={size} height={size}>\n          <circle\n            cx={size / 2}\n            cy={size / 2}\n            r={innerR}\n            fill=\"none\"\n            stroke={color}\n            strokeOpacity={0.35}\n            strokeWidth={Math.max(thickness * 0.7, 1.5)}\n            strokeLinecap=\"round\"\n            strokeDasharray={`${innerDash} ${innerC - innerDash}`}\n          />\n        </svg>\n      </motion.div>\n    </div>\n  );\n}\n\nfunction DotsLoader({ color, size, thickness, speed }: { color: string; size: number; thickness: number; speed: number }) {\n  const dotSize = thickness * 2.4;\n  const gap = dotSize * 0.85;\n  const duration = speed * 0.6;\n\n  return (\n    <div className=\"flex items-center justify-center\" style={{ width: size, height: size, gap }}>\n      {[0, 1, 2].map((i) => (\n        <motion.div\n          key={i}\n          className=\"rounded-full\"\n          style={{ width: dotSize, height: dotSize, backgroundColor: color }}\n          animate={{ y: [0, -dotSize * 1.1, 0], opacity: [0.35, 1, 0.35] }}\n          transition={{ duration, repeat: Infinity, ease: \"easeInOut\", delay: i * (duration / 3) }}\n        />\n      ))}\n    </div>\n  );\n}\n\nfunction renderLoader(variant: AnimatedLoaderVariant, color: string, trackColor: string, size: number, thickness: number, speed: number, lineCount: number) {\n  switch (variant) {\n    case \"ring\":\n      return <RingLoader color={color} trackColor={trackColor} size={size} thickness={thickness} speed={speed} />;\n    case \"dual-ring\":\n      return <DualRingLoader color={color} size={size} thickness={thickness} speed={speed} />;\n    case \"dots\":\n      return <DotsLoader color={color} size={size} thickness={thickness} speed={speed} />;\n    default:\n      return <LinesLoader count={lineCount} color={color} size={size} thickness={thickness} speed={speed} />;\n  }\n}\n\nexport function AnimatedLoader({\n  variant = \"dots\",\n  lineCount = 8,\n  color = \"#F39C12\",\n  trackColor = \"color-mix(in srgb, currentColor 15%, transparent)\",\n  background = \"rgba(0,0,0,0)\",\n  size = 56,\n  thickness = 4,\n  speed = 1.2,\n  className,\n  style,\n  ...props\n}: AnimatedLoaderProps) {\n  return (\n    <div className={cn(\"inline-flex items-center justify-center\", className)} style={{ backgroundColor: background, ...style }} {...props}>\n      {renderLoader(variant, color, trackColor, size, thickness, speed, lineCount)}\n    </div>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}