{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "sheen",
  "type": "registry:ui",
  "title": "Sheen",
  "description": "A soft band of light that crosses its parent every few seconds. Drop it inside the one button or card a page most wants pressed:",
  "author": "ofri-peretz <https://github.com/ofri-peretz>",
  "categories": [
    "decorative",
    "effect"
  ],
  "dependencies": [],
  "registryDependencies": [
    "https://ds.interlace.tools/r/interlace-base.json",
    "https://ds.interlace.tools/r/cn.json",
    "https://ds.interlace.tools/r/use-reduced-motion.json"
  ],
  "files": [
    {
      "path": "registry/interlace-ui/effects/sheen.tsx",
      "target": "components/ui/effects/sheen.tsx",
      "type": "registry:ui",
      "content": "'use client';\n\nimport * as React from 'react';\n\n// @interlace/sheen v1.0.0 — Interlace design system.\n// Docs, props and live preview: https://ds.interlace.tools/c/sheen\n// What changed since: https://ds.interlace.tools/c/sheen#history\n// Generated banner — keep it, the upgrade diff reads this version.\n\n/**\n * @interlace/ui — Sheen\n *\n * A soft band of light that crosses its parent every few seconds. Drop it\n * inside the one button or card a page most wants pressed:\n *\n *   <Button variant=\"default\">\n *     <Sheen />\n *     Get started\n *   </Button>\n *\n * It is a layer, not a button, so it works on `Button`, a link styled with\n * `buttonVariants`, or anything else, and the control keeps its own variant,\n * size, focus ring, and name. `Button` is already `relative isolate`, which\n * is all Sheen needs from its parent; it clips itself to the parent's corners.\n *\n * ## Out of the way\n *\n * `aria-hidden`, `pointer-events-none`, and painted at `z-index: -1` inside\n * the parent's own stacking context: above the parent's background, under\n * its label. So it never dims the text, never takes a click and never\n * changes the accessible name. The default\n * colour is `--primary-foreground` at low strength, so on a primary button it\n * reads as light passing over the surface; pass `color` for other surfaces.\n *\n * ## Motion\n *\n * One Web Animations API sweep, then a rest of `rest` seconds, repeated. It\n * pauses off screen. Under `prefers-reduced-motion: reduce` it renders\n * nothing: a still band would look like a smudge.\n *\n * | Rule | Concept                 | Where in this file                                   |\n * | ---- | ----------------------- | ---------------------------------------------------- |\n * | R4   | Extends native el       | `span` props (minus aria-hidden)                      |\n * | R6   | data-slot per part      | sheen / -band                                         |\n * | R7   | cn + ...rest            | `cn(…, className)` + `{...props}`                     |\n * | R19  | Tokens only             | `--primary-foreground` default                        |\n * | R25  | Client component        | the sweep runs in the browser                         |\n * | R26  | A11y                    | hidden, inert to the pointer, under the label         |\n */\n\nimport { cn } from '@/lib/utils';\nimport { useReducedMotion } from '@/hooks/use-reduced-motion';\n\nexport interface SheenProps extends Omit<React.ComponentPropsWithoutRef<'span'>, 'aria-hidden' | 'children'> {\n  /** Colour of the band. @default 'var(--primary-foreground)' */\n  color?: string;\n  /** How bright the band is, 0 to 1. @default 0.35 */\n  strength?: number;\n  /** Seconds for the band to cross. @default 1.2 */\n  duration?: number;\n  /** Seconds between crossings. @default 3 */\n  rest?: number;\n}\n\nexport function Sheen({\n  color = 'var(--primary-foreground)',\n  strength = 0.35,\n  duration = 1.2,\n  rest = 3,\n  className,\n  style,\n  ...props\n}: SheenProps) {\n  const bandRef = React.useRef<HTMLSpanElement>(null);\n  const reduced = useReducedMotion();\n\n  React.useEffect(() => {\n    const band = bandRef.current;\n    if (!band || reduced || typeof band.animate !== 'function') return;\n    const total = (duration + rest) * 1000;\n    const crossing = duration * 1000;\n    const animation = band.animate(\n      [\n        { transform: 'translateX(-100%) skewX(-20deg)', offset: 0 },\n        { transform: 'translateX(250%) skewX(-20deg)', offset: crossing / total },\n        { transform: 'translateX(250%) skewX(-20deg)', offset: 1 },\n      ],\n      { duration: total, iterations: Infinity, easing: 'ease-in-out' },\n    );\n    const io =\n      typeof IntersectionObserver === 'undefined'\n        ? null\n        : new IntersectionObserver(([entry]) => {\n            if (entry?.isIntersecting) animation.play();\n            else animation.pause();\n          });\n    // The band moves past the edges; the layer it sits in never does.\n    io?.observe(band.parentElement ?? band);\n    return () => {\n      io?.disconnect();\n      animation.cancel();\n    };\n  }, [reduced, duration, rest]);\n\n  if (reduced) return null;\n\n  return (\n    <span\n      data-slot=\"sheen\"\n      className={cn('pointer-events-none absolute inset-0 -z-10 overflow-hidden rounded-[inherit]', className)}\n      style={style}\n      {...props}\n      aria-hidden\n    >\n      <span\n        ref={bandRef}\n        data-slot=\"sheen-band\"\n        className=\"absolute inset-y-0 left-0 w-2/5 -translate-x-full\"\n        style={{\n          opacity: Math.min(Math.max(strength, 0), 1),\n          background: `linear-gradient(90deg, transparent, ${color}, transparent)`,\n        }}\n      />\n    </span>\n  );\n}\n"
    }
  ],
  "meta": {
    "tier": "effect",
    "client": true,
    "minViewport": null,
    "loading": false,
    "version": "1.0.0",
    "since": null
  },
  "docs": "## @interlace/sheen\n\nInstalled to `components/ui/effects/sheen.tsx`.\n\n```tsx\nimport { /* … */ } from '@/components/ui/effects/sheen';\n```\n\nProps, a11y contract, live preview and source: https://ds.interlace.tools/c/sheen\n\nRequires the `@interlace/interlace-base` CSS baseline (installed automatically as a registry dependency). For the Interlace look, also add `@interlace/theme`."
}
