import { h } from "@stencil/core";
import { trackComponent } from "../../global/utils/tracking";
import { isNestedInIfxComponent } from "../../global/utils/dom-utils";
import { detectFramework } from "../../global/utils/framework-detection";
export class Indicator {
    constructor() {
        this.inverted = false;
        this.variant = 'number';
        this.number = 0;
    }
    handleNumber() {
        this.filteredNumber = !isNaN(this.number) && this.number > 99 ? '99+' : this.number;
    }
    componentWillLoad() {
        this.handleNumber();
    }
    async componentDidLoad() {
        if (!isNestedInIfxComponent(this.el)) {
            const framework = detectFramework();
            trackComponent('ifx-indicator', await framework);
        }
    }
    componentWillUpdate() {
        this.handleNumber();
    }
    render() {
        return (h("div", { key: '35211d70a31d9bf69b84614694d4669877c8a6d9', "aria-label": this.ariaLabel, class: 'indicator__container' }, this.variant === 'number' &&
            h("div", { key: '888f42cb6ad70bb973b62468734bae7abf73f3d9', class: `number__container ${this.inverted ? 'inverted' : ""}` }, h("div", { key: '4578b32ca5e7b7747eb7ae729e9732d06da3fcbc', class: "number__wrapper" }, this.filteredNumber)), this.variant === 'dot' && h("div", { key: '2b3cd2500d4d64bbb27131201ca2d56f720209a0', class: "dot__wrapper" })));
    }
    static get is() { return "ifx-indicator"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() {
        return {
            "$": ["indicator.scss"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["indicator.css"]
        };
    }
    static get properties() {
        return {
            "inverted": {
                "type": "boolean",
                "attribute": "inverted",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "false"
            },
            "ariaLabel": {
                "type": "string",
                "attribute": "aria-label",
                "mutable": false,
                "complexType": {
                    "original": "string | null",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false
            },
            "variant": {
                "type": "string",
                "attribute": "variant",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "'number'"
            },
            "number": {
                "type": "number",
                "attribute": "number",
                "mutable": false,
                "complexType": {
                    "original": "number",
                    "resolved": "number",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "0"
            }
        };
    }
    static get states() {
        return {
            "filteredNumber": {}
        };
    }
    static get elementRef() { return "el"; }
}
//# sourceMappingURL=indicator.js.map
