{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "gradient-button",
  "title": "Gradient Button",
  "description": "A button with an animated gradient border or fill.",
  "dependencies": [
    "cn"
  ],
  "registryDependencies": [
    "@gnostic/button"
  ],
  "files": [
    {
      "path": "packages/ui/src/components/ui/gradient-button/gradient-button.astro",
      "content": "---\nimport type { HTMLTag, Polymorphic } from \"astro/types\"\nimport { cn } from \"cn\"\n\nimport { Button } from \"@/components/ui/button\"\nimport type { GradientButtonProps } from \"./types.ts\"\n\ntype Props<Tag extends HTMLTag = \"button\"> = Polymorphic<{ as: Tag }> &\n  GradientButtonProps\n\nconst {\n  variant = \"outline\",\n  colors,\n  class: className,\n  style: styleProp,\n  ...props\n} = Astro.props\nconst stops = colors\n  ? {\n      \"--gradient-button-from\": colors.from,\n      \"--gradient-button-via\": colors.via,\n      \"--gradient-button-to\": colors.to,\n    }\n  : {}\nconst style =\n  typeof styleProp === \"string\"\n    ? Object.entries(stops)\n        .map(([name, value]) => `${name}:${value};`)\n        .join(\"\") + styleProp\n    : { ...stops, ...styleProp }\n---\n\n<Button\n  {...props}\n  variant={null}\n  data-slot=\"gradient-button\"\n  data-variant={variant}\n  style={style}\n  class={cn(\n    \"border-2 border-transparent\",\n    variant === \"filled\" ? \"text-black\" : \"text-foreground\",\n    className,\n  )}\n>\n  <slot />\n  {Astro.slots.has(\"button-loading-indicator\") && (\n    <slot name=\"button-loading-indicator\" slot=\"button-loading-indicator\" />\n  )}\n</Button>\n\n<style>\n  @property --gradient-button-phase {\n    syntax: \"<angle>\";\n    initial-value: 0deg;\n    inherits: false;\n  }\n\n  [data-slot=\"gradient-button\"] {\n    --gradient-button-surface: var(--background);\n    --gradient-button-angle: calc(12deg + var(--gradient-button-phase));\n    --gradient-button-stop: calc(75% - 25% * cos(var(--gradient-button-phase)));\n    --gradient-button-middle: var(\n      --gradient-button-via,\n      var(--color-teal-500, #00bba7)\n    );\n\n    /* Clip the solid surface to the padding box to expose the gradient border. */\n    background-image:\n      linear-gradient(\n        var(--gradient-button-surface),\n        var(--gradient-button-surface)\n      ),\n      linear-gradient(\n        var(--gradient-button-angle) in lch shorter hue,\n        color-mix(\n          in srgb,\n          var(--gradient-button-from, var(--color-indigo-500, #615fff)) 40%,\n          transparent\n        ),\n        color-mix(in srgb, var(--gradient-button-middle) 50%, transparent)\n          var(--gradient-button-stop),\n        color-mix(\n          in srgb,\n          var(--gradient-button-to, var(--color-indigo-500, #615fff)) 50%,\n          transparent\n        )\n      ),\n      radial-gradient(\n        in lch shorter hue,\n        var(--gradient-button-from, var(--color-blue-500, #2b7fff)),\n        var(--gradient-button-middle),\n        var(--gradient-button-to, var(--color-blue-600, #155dfc))\n      );\n    background-origin: border-box;\n    background-clip: padding-box, border-box, border-box;\n    background-size:\n      100% 100%,\n      calc(100% + var(--gradient-button-stop)) 160%,\n      200% 200%;\n    background-position:\n      center,\n      left center,\n      var(--gradient-button-stop) center;\n    background-repeat: no-repeat;\n  }\n\n  [data-slot=\"gradient-button\"][data-variant=\"filled\"] {\n    --gradient-button-surface: transparent;\n  }\n\n  @media (prefers-reduced-motion: no-preference) {\n    [data-slot=\"gradient-button\"]:not(:disabled) {\n      /* Resume the second animation on hover or focus to increase the speed. */\n      animation:\n        gradient-button-flow 10s linear infinite,\n        gradient-button-flow 10s linear infinite;\n      animation-composition: add;\n      animation-play-state: running, paused;\n    }\n\n    [data-slot=\"gradient-button\"]:not(:disabled):is(:hover, :focus-visible) {\n      animation-play-state: running, running;\n    }\n  }\n\n  @keyframes gradient-button-flow {\n    from {\n      --gradient-button-phase: 0deg;\n    }\n    to {\n      --gradient-button-phase: 1turn;\n    }\n  }\n</style>\n",
      "type": "registry:file",
      "target": "~/src/components/ui/gradient-button/gradient-button.astro"
    },
    {
      "path": "packages/ui/src/components/ui/gradient-button/index.ts",
      "content": "export { default as GradientButton } from './gradient-button.astro'\n\nexport type { GradientButtonProps } from './types.ts'\n",
      "type": "registry:file",
      "target": "~/src/components/ui/gradient-button/index.ts"
    },
    {
      "path": "packages/ui/src/components/ui/gradient-button/types.ts",
      "content": "import type { ButtonProps } from '@/components/ui/button/types.ts'\n\n/** Props for a button with an animated gradient. */\nexport interface GradientButtonProps extends Omit<ButtonProps, 'variant'> {\n    /** Apply the gradient to the border or the full button. @default 'outline' */\n    variant?: 'outline' | 'filled'\n    /** CSS colors for the start, middle, and end of the gradient. */\n    colors?: { from: string; via: string; to: string }\n}\n",
      "type": "registry:file",
      "target": "~/src/components/ui/gradient-button/types.ts"
    }
  ],
  "meta": {
    "framework": "astro",
    "source": "@gnostic/ui",
    "testedDependencies": {
      "cn": "0.5.2"
    }
  },
  "docs": "https://gnosticai.com/ui/components/gradient-button",
  "categories": [
    "ui"
  ],
  "type": "registry:ui"
}
