{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"foil-sweep","type":"registry:ui","title":"Foil Sweep","description":"A glossy band of light sweeps across the card on hover or focus, like light catching foil.","dependencies":[],"registryDependencies":["utils"],"files":[{"path":"registry/ui/foil-sweep.tsx","type":"registry:ui","content":"\"use client\";\n\nimport type { CSSProperties, ReactNode } from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nconst css = `\n[data-glare-hover]>[data-glare]{position:absolute;inset:0;pointer-events:none;border-radius:inherit;z-index:1;\nbackground:linear-gradient(var(--glare-angle),transparent calc(50% - var(--glare-size)/2),var(--glare-color) 50%,transparent calc(50% + var(--glare-size)/2));\nbackground-size:250% 250%;background-repeat:no-repeat;background-position:100% 100%;\ntransition:background-position var(--glare-duration) cubic-bezier(.3,.7,.3,1)}\n[data-glare-hover]:hover>[data-glare],[data-glare-hover]:focus-within>[data-glare]{background-position:0 0}\n[data-glare-once]:not(:hover):not(:focus-within)>[data-glare]{transition:none}\n@media (prefers-reduced-motion: reduce){[data-glare-hover]>[data-glare]{transition:none}}\n`;\n\nexport interface FoilSweepProps {\n  children: ReactNode;\n  /** Angle of the glare band in degrees. */\n  angle?: number;\n  color?: string;\n  /** Peak opacity of the glare, 0–1. */\n  opacity?: number;\n  /** Band width, % of the sweep. */\n  size?: number;\n  /** Ms for one sweep. */\n  duration?: number;\n  /** Sweep only on enter; skip the return sweep on leave. */\n  playOnce?: boolean;\n  className?: string;\n}\n\nexport function FoilSweep({\n  children,\n  angle = -45,\n  color = \"#ffffff\",\n  opacity = 0.5,\n  size = 20,\n  duration = 800,\n  playOnce = false,\n  className,\n}: FoilSweepProps) {\n  return (\n    <div\n      data-glare-hover=\"\"\n      data-glare-once={playOnce ? \"\" : undefined}\n      className={cn(\"relative inline-block overflow-hidden\", className)}\n      style={\n        {\n          \"--glare-angle\": `${angle}deg`,\n          \"--glare-color\": `color-mix(in srgb, ${color} ${opacity * 100}%, transparent)`,\n          \"--glare-size\": `${size}%`,\n          \"--glare-duration\": `${duration}ms`,\n        } as CSSProperties\n      }\n    >\n      <style href=\"foil-sweep\" precedence=\"default\">\n        {css}\n      </style>\n      {children}\n      <div data-glare=\"\" aria-hidden />\n    </div>\n  );\n}\n"}]}