{
  "name": "button",
  "title": "Button",
  "description": "Kura Button component source.",
  "type": "ui",
  "add": "when-added",
  "files": [
    {
      "type": "ui",
      "role": "file",
      "content": "<script lang=\"ts\" module>\n  import { cn, type WithElementRef } from '$lib/utils.js';\n  import type { HTMLAnchorAttributes, HTMLButtonAttributes } from 'svelte/elements';\n  import { type VariantProps, tv } from 'tailwind-variants';\n\n  export const buttonVariants = tv({\n    base: \"focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-control border border-transparent bg-clip-padding text-xs font-medium focus-visible:ring-1 active:not-aria-[haspopup]:translate-y-px aria-invalid:ring-1 [&_svg:not([class*='size-'])]:size-4 group/button inline-flex shrink-0 items-center justify-center whitespace-nowrap transition-all outline-none select-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0\",\n    variants: {\n      variant: {\n        default: 'bg-primary text-primary-foreground hover:bg-primary/90',\n        outline:\n          'border-border bg-background hover:bg-muted hover:text-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 aria-expanded:bg-muted aria-expanded:text-foreground',\n        secondary:\n          'bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground',\n        ghost:\n          'hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground',\n        destructive:\n          'bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30',\n        link: 'rounded-control px-0 text-link underline underline-offset-4 hover:text-foreground'\n      },\n      size: {\n        default:\n          'h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2',\n        xs: \"h-6 gap-1 rounded-control px-2 text-xs has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3\",\n        sm: \"h-7 gap-1 rounded-control px-2.5 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5\",\n        lg: 'h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2',\n        icon: 'size-8',\n        'icon-xs': \"size-6 rounded-control [&_svg:not([class*='size-'])]:size-3\",\n        'icon-sm': 'size-7 rounded-control',\n        'icon-lg': 'size-9'\n      }\n    },\n    defaultVariants: {\n      variant: 'default',\n      size: 'default'\n    }\n  });\n\n  export type ButtonVariant = VariantProps<typeof buttonVariants>['variant'];\n  export type ButtonSize = VariantProps<typeof buttonVariants>['size'];\n\n  export type ButtonProps = WithElementRef<HTMLButtonAttributes> &\n    WithElementRef<HTMLAnchorAttributes> & {\n      variant?: ButtonVariant;\n      size?: ButtonSize;\n    };\n</script>\n\n<script lang=\"ts\">\n  let {\n    class: className,\n    variant = 'default',\n    size = 'default',\n    ref = $bindable(null),\n    href = undefined,\n    type = 'button',\n    disabled,\n    children,\n    ...restProps\n  }: ButtonProps = $props();\n</script>\n\n{#if href}\n  <a\n    bind:this={ref}\n    data-slot=\"button\"\n    class={cn(buttonVariants({ variant, size }), className)}\n    href={disabled ? undefined : href}\n    aria-disabled={disabled}\n    role={disabled ? 'link' : undefined}\n    tabindex={disabled ? -1 : undefined}\n    {...restProps}\n  >\n    {@render children?.()}\n  </a>\n{:else}\n  <button\n    bind:this={ref}\n    data-slot=\"button\"\n    class={cn(buttonVariants({ variant, size }), className)}\n    {type}\n    {disabled}\n    {...restProps}\n  >\n    {@render children?.()}\n  </button>\n{/if}\n",
      "path": "button/button.svelte",
      "_imports_": [
        {
          "import": "$lib/utils.js",
          "item": "utils",
          "file": {
            "type": "lib",
            "path": "utils.ts"
          },
          "meta": {}
        }
      ],
      "registryDependencies": [],
      "dependencies": [],
      "devDependencies": []
    },
    {
      "type": "ui",
      "role": "file",
      "content": "import Root, {\n  type ButtonProps,\n  type ButtonSize,\n  type ButtonVariant,\n  buttonVariants\n} from './button.svelte';\nimport PillButton from './pill-button.svelte';\n\nexport {\n  Root,\n  PillButton,\n  type ButtonProps as Props,\n  //\n  Root as Button,\n  buttonVariants,\n  type ButtonProps,\n  type ButtonSize,\n  type ButtonVariant\n};\n",
      "path": "button/index.ts",
      "_imports_": [
        {
          "import": "./button.svelte",
          "item": "button",
          "file": {
            "type": "ui",
            "path": "button/button.svelte"
          },
          "meta": {}
        },
        {
          "import": "./pill-button.svelte",
          "item": "button",
          "file": {
            "type": "ui",
            "path": "button/pill-button.svelte"
          },
          "meta": {}
        }
      ],
      "registryDependencies": [],
      "dependencies": [],
      "devDependencies": []
    },
    {
      "type": "ui",
      "role": "file",
      "content": "<script lang=\"ts\" module>\n  import { Button, type ButtonProps } from './index.js';\n  import { cn } from '$lib/utils.js';\n\n  const PILL_CLASS =\n    'rounded-full h-9 px-5 has-data-[icon=inline-end]:pr-4 has-data-[icon=inline-start]:pl-4';\n</script>\n\n<script lang=\"ts\">\n  let {\n    class: className,\n    variant = 'default',\n    size = 'default',\n    ref = $bindable(null),\n    href = undefined,\n    type = 'button',\n    disabled,\n    children,\n    ...restProps\n  }: ButtonProps = $props();\n\n  const safeVariant = $derived(variant === 'outline' ? 'outline' : 'default');\n</script>\n\n{#if href}\n  <Button\n    bind:ref\n    {href}\n    variant={safeVariant}\n    {size}\n    {disabled}\n    class={cn(PILL_CLASS, className)}\n    {...restProps}\n  >\n    {@render children?.()}\n  </Button>\n{:else}\n  <Button\n    bind:ref\n    variant={safeVariant}\n    {size}\n    {type}\n    {disabled}\n    class={cn(PILL_CLASS, className)}\n    {...restProps}\n  >\n    {@render children?.()}\n  </Button>\n{/if}\n",
      "path": "button/pill-button.svelte",
      "_imports_": [
        {
          "import": "./index.js",
          "item": "button",
          "file": {
            "type": "ui",
            "path": "button/index.ts"
          },
          "meta": {}
        },
        {
          "import": "$lib/utils.js",
          "item": "utils",
          "file": {
            "type": "lib",
            "path": "utils.ts"
          },
          "meta": {}
        }
      ],
      "registryDependencies": [],
      "dependencies": [],
      "devDependencies": []
    }
  ],
  "registryDependencies": [
    "styles",
    "utils"
  ],
  "dependencies": [
    {
      "ecosystem": "js",
      "name": "tailwind-variants",
      "version": "^3.2.2"
    }
  ],
  "devDependencies": []
}