"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.iconButtonVariants = void 0;
exports.IconButton = IconButton;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_slot_1 = require("@radix-ui/react-slot");
const class_variance_authority_1 = require("class-variance-authority");
const button_1 = require("../button");
const utils_1 = require("../../../lib/utils");
exports.iconButtonVariants = (0, class_variance_authority_1.cva)('icon-button-base icon-button-read-only icon-button-disabled', {
    variants: {
        rounded: {
            true: 'icon-button-rounded',
            false: ''
        },
        size: {
            default: '',
            small: 'icon-button-small'
        }
    },
    defaultVariants: {
        size: 'default'
    }
});
function IconButton({ className, variant, rounded, size, asChild, readOnly, onClick, ...props }) {
    const Comp = asChild ? react_slot_1.Slot : 'button';
    const handleClick = (e) => {
        if (readOnly) {
            e.preventDefault();
            return;
        }
        onClick?.(e);
    };
    return ((0, jsx_runtime_1.jsx)(Comp, { className: (0, utils_1.cn)((0, button_1.buttonVariants)({ variant, size }), (0, exports.iconButtonVariants)({ rounded, size }), className), "data-read-only": readOnly, "data-slot": "button", ...props, onClick: handleClick }));
}
