'use client';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { forwardRef } from 'react';
import { cv } from '../../lib/cv.js';
const button = cv(
// Base classes apply to every variant.
'focus-visible:ring-offset-background inline-flex items-center justify-center gap-2 rounded-[var(--radius)] font-medium transition-colors focus-visible:ring-2 focus-visible:ring-[var(--ring)] focus-visible:ring-offset-2 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50', {
    variants: {
        variant: {
            primary: 'bg-[var(--primary)] text-[var(--primary-foreground)] hover:opacity-90',
            secondary: 'bg-[var(--secondary)] text-[var(--secondary-foreground)] hover:opacity-80',
            danger: 'bg-[var(--destructive)] text-[var(--destructive-foreground)] hover:opacity-90',
            ghost: 'bg-transparent text-[var(--foreground)] hover:bg-[var(--accent)]',
            outline: 'border border-[var(--border)] bg-transparent text-[var(--foreground)] hover:bg-[var(--accent)]',
            link: 'bg-transparent text-[var(--primary)] underline-offset-4 hover:underline',
        },
        size: {
            xs: 'h-7 px-2 text-xs',
            sm: 'h-8 px-2.5 text-xs',
            md: 'h-9 px-4 text-sm',
            lg: 'h-10 px-6 text-base',
            icon: 'h-9 w-9 p-0',
        },
    },
    defaultVariants: {
        variant: 'primary',
        size: 'md',
    },
});
export const Button = forwardRef(function Button({ variant, size, full, loading = false, disabled, leftIcon, rightIcon, children, className, ...rest }, ref) {
    return (_jsxs("button", { ref: ref, disabled: disabled || loading, "aria-busy": loading || undefined, className: button({
            variant,
            size,
            class: [full ? 'w-full' : '', className].filter(Boolean).join(' '),
        }), ...rest, children: [loading ? (_jsxs("svg", { className: "h-4 w-4 animate-spin", viewBox: "0 0 24 24", fill: "none", "aria-hidden": true, children: [_jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }), _jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z" })] })) : (leftIcon), children, !loading && rightIcon] }));
});
export { button as buttonVariants };
//# sourceMappingURL=Button.js.map