import { cnb } from "cnbuilder";
import { cssUtils } from "../cssUtils.js";
import { bem } from "../utils/bem.js";
const styles = bem("rmd-button");
/**
 * Creates a button theme based on the button theming props. This is really just
 * used so that other elements like clickable `<div>`s or `<input type="file">`
 * can look like buttons.
 *
 * @param options - An object containing the themeable button props to generate a
 * button theme className.
 * @returns a string of class names to create an element with a button theme.
 * @since 6.0.0 This used to be called `buttonThemeClassNames`.
 */ export function button(options = {}) {
    const { theme: propTheme = "clear", themeType = "flat", iconSize, buttonType = "text", disabled: propDisabled = false, responsive, pressed = false, pressedClassName, className } = options;
    const theme = propTheme === "disabled" ? "clear" : propTheme;
    const disabled = propDisabled || propTheme === "disabled";
    const text = buttonType === "text" && !responsive && !iconSize;
    const icon = !text;
    const outline = themeType === "outline";
    const contained = themeType === "contained";
    const clear = theme === "clear";
    const isThemed = !disabled && !clear;
    let textColor;
    let outlineColor;
    let backgroundColor;
    if (isThemed && !contained) {
        textColor = theme;
    } else if (disabled) {
        textColor = "text-disabled";
    }
    if (isThemed && contained) {
        backgroundColor = theme;
    }
    if (outline) {
        outlineColor = clear ? "greyscale" : theme;
    }
    return cnb(styles({
        text,
        icon,
        "icon-square": buttonType === "icon-square",
        disabled,
        contained: !disabled && contained,
        pressed: contained && pressed,
        responsive,
        small: icon && iconSize === "small",
        large: icon && iconSize === "large"
    }), pressedClassName, cssUtils({
        surface: true,
        textColor,
        outlineColor,
        backgroundColor
    }), className);
}

//# sourceMappingURL=buttonStyles.js.map