import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Slot, Slottable } from "@radix-ui/react-slot";
import clsx from "clsx";
import { forwardRef } from "react";
const normalIconButtonVariants = {
    primary: "openui-icon-button-primary",
    secondary: "openui-icon-button-secondary",
    tertiary: "openui-icon-button-tertiary",
};
const destructiveIconButtonVariants = {
    primary: "openui-icon-button-destructive-primary",
    secondary: "openui-icon-button-destructive-secondary",
    tertiary: "openui-icon-button-destructive-tertiary",
};
const iconButtonSizes = {
    "3-extra-small": "openui-icon-button-3-extra-small",
    "2-extra-small": "openui-icon-button-2-extra-small",
    "extra-small": "openui-icon-button-extra-small",
    small: "openui-icon-button-small",
    medium: "openui-icon-button-medium",
    large: "openui-icon-button-large",
};
const iconButtonShapes = {
    square: "openui-icon-button-square",
    circle: "openui-icon-button-circle",
};
export const IconButton = forwardRef((props, ref) => {
    const { className, icon, variant = "primary", size = "medium", shape = "square", appearance = "normal", asChild = false, children, ...rest } = props;
    const iconButtonVariants = appearance === "normal" ? normalIconButtonVariants : destructiveIconButtonVariants;
    const Comp = asChild ? Slot : "button";
    return (_jsxs(Comp, { ref: ref, className: clsx("openui-icon-button", iconButtonVariants[variant], iconButtonSizes[size], iconButtonShapes[shape], className), ...rest, children: [_jsx(Slottable, { children: children }), icon && _jsx("span", { className: "openui-icon-button-icon", children: icon })] }));
});
IconButton.displayName = "IconButton";
//# sourceMappingURL=IconButton.js.map