import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { cva } from "class-variance-authority";
import * as React from "react";
import { Tooltip, TooltipContent, TooltipTrigger } from "./tooltip";
import { cn } from "../../lib/utils";
import { DeleteIcon } from "./delete-icon";
const ICON_SIZE = {
    xs: "xs",
    sm: "sm",
    md: "md",
    lg: "lg",
};
export const deleteButtonVariants = cva("inline-flex shrink-0 cursor-pointer items-center justify-center rounded-md bg-feedback-red-light text-feedback-red transition-colors hover:bg-feedback-red-light/80 hover:text-feedback-red disabled:cursor-default disabled:opacity-40", {
    variants: {
        size: {
            xs: "h-5 w-5",
            sm: "h-7 w-7",
            md: "h-8 w-8",
            lg: "h-9 w-9",
        },
    },
    defaultVariants: {
        size: "sm",
    },
});
/** Standard delete/trash icon button with the destructive light-red treatment. */
export const DeleteButton = React.forwardRef(({ className, size, label, iconSize, showTooltip = true, type = "button", ...props }, ref) => {
    const resolvedSize = size ?? "sm";
    const button = (_jsx("button", { ref: ref, type: type, "aria-label": label, className: cn(deleteButtonVariants({ size: resolvedSize }), className), ...props, children: _jsx(DeleteIcon, { size: iconSize ?? ICON_SIZE[resolvedSize] }) }));
    if (!showTooltip) {
        return button;
    }
    return (_jsxs(Tooltip, { delayDuration: 500, children: [_jsx(TooltipTrigger, { asChild: true, children: button }), _jsx(TooltipContent, { children: label })] }));
});
DeleteButton.displayName = "DeleteButton";
//# sourceMappingURL=delete-button.js.map