{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "shimmer-text",
  "title": "Shimmer Text",
  "description": "A soft band of light that sweeps through a line of text, for loading states, AI status lines and quiet emphasis.",
  "dependencies": [],
  "files": [
    {
      "path": "registry/new-york/shimmer-text/shimmer-text.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface ShimmerTextProps extends Omit<\n  React.ComponentPropsWithoutRef<\"span\">,\n  \"children\"\n> {\n  text?: string;\n  /** Seconds per sweep. */\n  seconds?: number;\n  /** Colour at rest. Defaults to a dimmed version of the text colour. */\n  base?: string;\n  /** Colour of the sweep. Defaults to the text colour. */\n  shine?: string;\n  /** Width of the sweep, in percent. */\n  band?: number;\n}\n\nfunction useReducedMotion() {\n  return React.useSyncExternalStore(\n    (callback) => {\n      const query = window.matchMedia(\"(prefers-reduced-motion: reduce)\");\n      query.addEventListener(\"change\", callback);\n      return () => query.removeEventListener(\"change\", callback);\n    },\n    () => window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches,\n    () => false,\n  );\n}\n\nexport function ShimmerText({\n  text = \"Generating your report\",\n  seconds = 2,\n  base = \"color-mix(in srgb, currentColor 42%, transparent)\",\n  shine = \"currentColor\",\n  band = 16,\n  className,\n  style,\n  ...props\n}: ShimmerTextProps) {\n  const reduce = useReducedMotion();\n  const ref = React.useRef<HTMLSpanElement>(null);\n\n  // Runs as an animation on the background position, so React is not involved once it starts.\n  React.useEffect(() => {\n    if (reduce) return;\n    const run = ref.current?.animate(\n      [{ backgroundPosition: \"130% 0\" }, { backgroundPosition: \"-30% 0\" }],\n      {\n        duration: Math.max(0.4, seconds) * 1000,\n        iterations: Infinity,\n        easing: \"linear\",\n      },\n    );\n    return () => run?.cancel();\n  }, [reduce, seconds]);\n\n  return (\n    <span\n      ref={ref}\n      className={`inline-block bg-clip-text ${className ?? \"\"}`}\n      style={{\n        // A transparent fill rather than a transparent colour, so currentColor still works in the gradient.\n        WebkitTextFillColor: \"transparent\",\n        backgroundImage: `linear-gradient(100deg, ${base} ${50 - band}%, ${shine} 50%, ${base} ${50 + band}%)`,\n        backgroundSize: \"250% 100%\",\n        backgroundRepeat: \"no-repeat\",\n        backgroundPosition: \"130% 0\",\n        WebkitBackgroundClip: \"text\",\n        ...style,\n      }}\n      {...props}\n    >\n      {text}\n    </span>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}