'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const core = require('./core-feab21d4.js');

const CcButton = class {
    constructor(hostRef) {
        core.registerInstance(this, hostRef);
        this.iconName = "";
        this.iconReverse = false;
        this.iconOnly = false;
        this.disabled = false;
        this.fill = "solid";
        this.expand = false;
        this.color = "primary";
        this.size = "lg";
        this.glow = false;
        this.type = "button";
        this.loading = false;
        this.download = false;
    }
    render() {
        const BtnElem = this.href ? "a" : "button";
        const attrs = {
            disabled: this.href ? false : this.disabled,
            href: this.href,
            download: this.download,
            target: this.target,
            type: this.type
        };
        return (core.h(core.Host, { class: {
                button__host: true,
                "button--block": this.expand,
                "button--secondary": this.color === "secondary"
            }, "data-testid": "cc-button" }, core.h(BtnElem, Object.assign({ "data-testid": "cc-button__element", class: {
                button: true,
                "button--reverse": this.iconReverse,
                "button--disabled": this.href ? false : this.disabled,
                "button--outline": this.fill === "outline",
                "button--clear": this.fill === "clear",
                "button--md": this.size === "md",
                "button--sm": this.size === "sm",
                "button--iconOnly": this.iconOnly,
                "button--glow": this.glow
            } }, attrs), this.iconName && !this.loading && (core.h("cc-icon", { class: {
                button__icon: true
            }, name: this.iconName, size: this.size === "sm" ? 16 : 24 })), this.loading && (core.h("cc-loader", { class: {
                button__icon: true
            }, size: this.size === "sm" ? 16 : 24 })), core.h("span", { "data-testid": "cc-button__text", class: { button__text: !this.iconOnly, hidden: this.iconOnly } }, core.h("slot", null)))));
    }
    static get style() { return ".button__host.sc-cc-button-h{display:inline-block;--cc-button-color-base:var(--primary);--cc-button-color-dark:var(--primary-dark);--cc-button-color-lightest:var(--primary-10);--cc-button-color-contrast:var(--neutral-04)}.button--block.sc-cc-button-h{display:block}.button--secondary.sc-cc-button-h{--cc-button-color-base:var(--secondary);--cc-button-color-dark:var(--secondary-dark);--cc-button-color-lightest:var(--secondary-10);--cc-button-color-contrast:var(--neutral-04)}.button.sc-cc-button{border-width:0;padding-left:1.6rem;padding-right:1.6rem;padding-top:.4rem;padding-bottom:.4rem;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;font-size:1.4rem;font-weight:700;border-radius:.4rem;outline:0;width:100%;line-height:2rem;border:1px solid transparent;line-height:2.4rem;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:inherit;height:4.8rem;background-color:var(--cc-button-color-base);color:var(--cc-button-color-contrast);cursor:pointer;text-decoration:none}.button--glow.sc-cc-button{background-image:-webkit-gradient(linear,left top,left bottom,from(var(--cc-button-color-base)),color-stop(50%,var(--cc-button-color-base)),color-stop(50%,var(--cc-button-color-dark)),to(var(--cc-button-color-dark)));background-image:linear-gradient(var(--cc-button-color-base),var(--cc-button-color-base) 50%,var(--cc-button-color-dark) 0,var(--cc-button-color-dark))}.button__text.sc-cc-button{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex}.button__icon.sc-cc-button{margin-right:.4rem}.button--reverse.sc-cc-button .button__icon.sc-cc-button{margin-right:0;margin-left:.4rem}.button--iconOnly.sc-cc-button .button__icon.sc-cc-button{margin:0}.button--iconOnly.sc-cc-button{width:4.8rem}.button--md.sc-cc-button{height:4rem}.button--md.button--iconOnly.sc-cc-button{width:4rem}.button--sm.sc-cc-button{font-size:1.2rem;font-weight:900;line-height:1.6rem;height:3.2rem}.button--sm.button--iconOnly.sc-cc-button{width:3.2rem}.button--reverse.sc-cc-button{-webkit-box-orient:horizontal;-webkit-box-direction:reverse;-ms-flex-direction:row-reverse;flex-direction:row-reverse}.button--outline.sc-cc-button{border-color:var(--cc-button-color-base);color:var(--cc-button-color-base);background:var(--cc-button-color-contrast)}.button--outline.button--glow.sc-cc-button{background-image:-webkit-gradient(linear,left top,left bottom,from(var(--cc-button-color-contrast)),color-stop(50%,var(--cc-button-color-contrast)),color-stop(50%,var(--cc-button-color-lightest)),to(var(--cc-button-color-lightest)));background-image:linear-gradient(var(--cc-button-color-contrast),var(--cc-button-color-contrast) 50%,var(--cc-button-color-lightest) 0,var(--cc-button-color-lightest))}.button--clear.sc-cc-button{background:transparent;color:var(--cc-button-color-base)}.button--disabled.sc-cc-button, .button.sc-cc-button:disabled{background:none;background-color:var(--disabled-background);color:var(--disabled-text);cursor:not-allowed}.button--disabled.button--clear.sc-cc-button, .button.sc-cc-button:disabled.button--clear{background:transparent}.button--disabled.button--outline.sc-cc-button, .button.sc-cc-button:disabled.button--outline{background:transparent;border-color:var(--disabled-background)}"; }
};

exports.cc_button = CcButton;
