{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"shine-button","type":"registry:block","title":"Shine button","description":"A button with a thin moving light along its border on hover and focus, in default and outline variants, three sizes, and an anchor when given an href.","dependencies":[],"registryDependencies":["utils"],"files":[{"path":"registry/prequel/shine-button/shine-button.tsx","type":"registry:component","content":"\"use client\";\n\nimport type { ReactNode } from \"react\";\nimport { cn } from \"@/lib/utils\";\n\n/* A single keyframe, shared by every instance of the block. The gradient\n   angle is registered so it can animate smoothly; the mask keeps only the\n   one-pixel border, never the fill. */\nconst SHINE_CSS = `\n@property --prequel-shine-angle {\n  syntax: \"<angle>\";\n  inherits: false;\n  initial-value: 0deg;\n}\n@keyframes prequel-shine-turn {\n  to { --prequel-shine-angle: 360deg; }\n}\n.prequel-shine-border {\n  padding: 1px;\n  opacity: 0;\n  background: conic-gradient(\n    from var(--prequel-shine-angle),\n    transparent 0deg,\n    transparent 285deg,\n    color-mix(in oklab, currentColor 85%, transparent) 330deg,\n    transparent 360deg\n  );\n  -webkit-mask:\n    linear-gradient(#000 0 0) content-box,\n    linear-gradient(#000 0 0);\n  -webkit-mask-composite: xor;\n  mask:\n    linear-gradient(#000 0 0) content-box,\n    linear-gradient(#000 0 0);\n  mask-composite: exclude;\n  transition: opacity 300ms ease;\n  animation: prequel-shine-turn 2.4s linear infinite;\n  animation-play-state: paused;\n}\n.prequel-shine-group:hover .prequel-shine-border,\n.prequel-shine-group:focus-visible .prequel-shine-border {\n  opacity: 1;\n  animation-play-state: running;\n}\n@media (prefers-reduced-motion: reduce) {\n  .prequel-shine-border { animation: none; }\n}\n`;\n\n/* ------------------------------------------------------------------ */\n/* types                                                               */\n/* ------------------------------------------------------------------ */\n\nexport type ShineButtonProps = {\n  className?: string;\n  children?: ReactNode;\n  /** Visual style. Defaults to \"default\". */\n  variant?: \"default\" | \"outline\";\n  /** Height and padding. Defaults to \"md\". */\n  size?: \"sm\" | \"md\" | \"lg\";\n  /** Renders a link instead of a button when set. */\n  href?: string;\n  /** Click handler for both the button and the link. */\n  onClick?: () => void;\n  /** Native button type. Defaults to \"button\". */\n  type?: \"button\" | \"submit\" | \"reset\";\n  /** Disables the button. Links keep their href. */\n  disabled?: boolean;\n  /** Accessible name when the visible label is not enough. */\n  ariaLabel?: string;\n};\n\nconst VARIANTS = {\n  default: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n  outline:\n    \"border border-border bg-transparent text-foreground hover:bg-muted/60\",\n} as const;\n\nconst SIZES = {\n  sm: \"h-8 px-3 text-[12.5px]\",\n  md: \"h-10 px-4 text-[13.5px]\",\n  lg: \"h-12 px-6 text-[15px]\",\n} as const;\n\n/* ------------------------------------------------------------------ */\n/* block                                                               */\n/* ------------------------------------------------------------------ */\n\nexport function ShineButton({\n  className,\n  children = \"Read the changelog\",\n  variant = \"default\",\n  size = \"md\",\n  href,\n  onClick,\n  type = \"button\",\n  disabled = false,\n  ariaLabel,\n}: ShineButtonProps) {\n  const classes = cn(\n    \"prequel-shine-group relative inline-flex select-none items-center justify-center gap-2 overflow-hidden rounded-full font-medium transition-colors duration-200\",\n    \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n    \"disabled:pointer-events-none disabled:opacity-50\",\n    VARIANTS[variant],\n    SIZES[size],\n    className\n  );\n\n  const inner = (\n    <>\n      <span\n        aria-hidden=\"true\"\n        className=\"prequel-shine-border pointer-events-none absolute inset-0 rounded-[inherit]\"\n      />\n      <span className=\"relative inline-flex items-center gap-2\">{children}</span>\n    </>\n  );\n\n  /* With neither a handler nor an href, the default demo copy still leads\n     somewhere real instead of behaving like a dead button. */\n  const link = href ?? (onClick ? undefined : \"/changelog\");\n\n  if (link) {\n    return (\n      <>\n        <style>{SHINE_CSS}</style>\n        <a\n          href={link}\n          onClick={onClick}\n          aria-label={ariaLabel}\n          aria-disabled={disabled || undefined}\n          className={classes}\n        >\n          {inner}\n        </a>\n      </>\n    );\n  }\n\n  return (\n    <>\n      <style>{SHINE_CSS}</style>\n      <button\n        type={type}\n        onClick={onClick}\n        disabled={disabled}\n        aria-label={ariaLabel}\n        className={classes}\n      >\n        {inner}\n      </button>\n    </>\n  );\n}\n\n/* Two actions side by side, handy for previews. */\nexport function ShineButtonDemo() {\n  return (\n    <div className=\"flex flex-wrap items-center gap-3\">\n      <ShineButton href=\"/blocks\">Browse the blocks</ShineButton>\n      <ShineButton href=\"/changelog\" variant=\"outline\">\n        Read the changelog\n      </ShineButton>\n    </div>\n  );\n}\n\nexport default ShineButton;\n"}]}