import { jsx as _jsx } from "react/jsx-runtime";
import { Slot } from "@radix-ui/react-slot";
import { cva } from "class-variance-authority";
import * as React from "react";
import { cn } from "../../lib/utils";
const ButtonSizeContext = React.createContext(undefined);
function ButtonSizeProvider({ value, children, }) {
    return (_jsx(ButtonSizeContext.Provider, { value: value, children: children }));
}
const buttonVariants = cva([
    "inline-flex",
    "items-center",
    "justify-center",
    "gap-2",
    "whitespace-nowrap",
    "rounded",
    "text-sm",
    "font-medium",
    "transition-all",
    "disabled:pointer-events-none",
    "disabled:opacity-50",
    "[&_svg]:pointer-events-none",
    "[&_svg:not([class*='size-'])]:size-4 shrink-0",
    "[&_svg]:shrink-0",
    "outline-none",
    "focus-visible:border-ring",
    "focus-visible:ring-ring/50",
    "focus-visible:ring-[3px]",
    "aria-invalid:ring-destructive/20",
    "aria-invalid:border-destructive",
], {
    variants: {
        variant: {
            default: "bg-highlight-100 text-primary-foreground shadow-xs hover:bg-highlight-100-hover",
            defaultInverted: "transition-colors duration-300 shadow-sm bg-white text-highlight-100 hover:bg-highlight-100 hover:text-white",
            destructive: "bg-feedback-red-light text-feedback-red shadow-xs hover:bg-feedback-red-light/80 hover:text-feedback-red focus-visible:ring-feedback-red/20",
            outline: "border border-border-default bg-background text-neutral-grey-100 hover:border-neutral-grey-15 hover:bg-neutral-grey-5 hover:text-neutral-grey-100",
            select: "border border-border-default bg-background text-neutral-grey-100 w-auto md:min-w-[120px] flex justify-between gap-3 roundedborder cursor-pointer hover:bg-neutral-grey-5 hover:bg-accent hover:text-accent-foreground",
            secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
            ghost: "hover:bg-accent hover:text-accent-foreground",
            link: "text-primary underline-offset-4 hover:underline",
        },
        size: {
            default: "px-4 py-[9px] text-xs has-[>svg]:px-4",
            sm: "h-8 rounded gap-1.5 px-3 has-[>svg]:px-2.5 text-xs",
            xs: "h-7 rounded gap-1 px-2 has-[>svg]:px-2 text-2xs",
            xxs: "h-5 rounded gap-1 px-2 has-[>svg]:px-2 text-2xs",
            lg: "rounded px-[20px] py-[10px] has-[>svg]:px-4",
            icon: "size-9",
            iconSm: "size-8",
            iconXs: "size-7",
            select: "",
        },
    },
    compoundVariants: [
        {
            variant: "select",
            size: "select",
            class: "h-7 md:h-8 p-[7px] py-[11px] text-xs",
        },
    ],
    defaultVariants: {
        variant: "default",
        size: "default",
    },
});
function Button({ className, variant, size, asChild = false, ...props }) {
    const Comp = asChild ? Slot : "button";
    const inheritedSize = React.useContext(ButtonSizeContext);
    const resolvedSize = variant === "select" ? "select" : (size ?? inheritedSize);
    return (_jsx(Comp, { "data-slot": "button", className: cn("cursor-pointer", buttonVariants({
            variant,
            size: resolvedSize,
            className,
        })), ...props }));
}
export { Button, ButtonSizeProvider, buttonVariants };
//# sourceMappingURL=button.js.map