import { h } from "@stencil/core";
export class ButtonCollapse {
    constructor() {
        this.expanded = true;
        /**
         * If true will render as a free button instead of the standard icon.
         */
        this.free = false;
    }
    onClick() {
        if (this.context !== 'clear') {
            this.anjCollapse.emit(this.expanded);
        }
        this.expanded = !this.expanded;
    }
    render() {
        return (h("anj-button", { context: this.free ? 'free' : 'icon', onClick: () => this.onClick(), ariaLabel: this.expanded ? 'Collapse' : 'Expand' }, this.expanded
            ? h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24" },
                h("path", { fill: "none", d: "M0 0h24v24H0V0z" }),
                h("path", { d: "M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6 1.41 1.41z" }))
            : h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24" },
                h("path", { fill: "none", d: "M0 0h24v24H0V0z" }),
                h("path", { d: "M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z" }))));
    }
    static get is() { return "anj-button-collapse"; }
    static get encapsulation() { return "scoped"; }
    static get originalStyleUrls() { return {
        "$": ["button-collapse.scss"]
    }; }
    static get styleUrls() { return {
        "$": ["button-collapse.css"]
    }; }
    static get properties() { return {
        "context": {
            "type": "string",
            "mutable": false,
            "complexType": {
                "original": "'clear' | 'floating' | undefined",
                "resolved": "\"clear\" | \"floating\"",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": "Let's you use the collapse button styling in various ways.\nOptions are `\"clear\"`, `\"floating\"`, and undefined.\nclear: same great styling, no anjCollapse event.\nfloating: positions the button absolutely in the top right of the closest positioned ancestor"
            },
            "attribute": "context",
            "reflect": true
        },
        "free": {
            "type": "boolean",
            "mutable": false,
            "complexType": {
                "original": "boolean",
                "resolved": "boolean",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": "If true will render as a free button instead of the standard icon."
            },
            "attribute": "free",
            "reflect": false,
            "defaultValue": "false"
        }
    }; }
    static get states() { return {
        "expanded": {}
    }; }
    static get events() { return [{
            "method": "anjCollapse",
            "name": "anjCollapse",
            "bubbles": true,
            "cancelable": true,
            "composed": true,
            "docs": {
                "tags": [],
                "text": "Emitted when the button is clicked unless suppressed by setting the context prop to `clear`."
            },
            "complexType": {
                "original": "boolean",
                "resolved": "boolean",
                "references": {}
            }
        }]; }
}
