import { h } from "@stencil/core";
import { isNestedInIfxComponent } from "../..//shared/utils/dom-utils";
import { detectFramework } from "../..//shared/utils/framework-detection";
import { trackComponent } from "../../shared/utils/tracking";
export class Indicator {
    el;
    filteredNumber;
    /** Renders the indicator with an inverted color scheme for dark backgrounds. */
    inverted = false;
    /** Provide a short, descriptive text that explains the indicator's meaning or value. */
    ariaLabelText;
    /** Sets variant of the Indicator */
    variant = 'number';
    /** Numeric value to display when using the 'number' variant */
    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: '6c212fffc7b33332438df4e5d98154d61e4b855b', "aria-label-text": this.ariaLabelText, class: 'indicator__container' }, this.variant === 'number' &&
            h("div", { key: 'ec325f386325568ae061fb3eb7b4bd7b2ae6529e', class: `number__container ${this.inverted ? 'inverted' : ""}` }, h("div", { key: '9fcc8c347a1b0542e8edd4e77a0b73f2152a06f4', class: "number__wrapper" }, this.filteredNumber)), this.variant === 'dot' && h("div", { key: 'c16a0356314fddd1f7c5e851f0f54136f0ec7909', 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",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Renders the indicator with an inverted color scheme for dark backgrounds."
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "inverted",
                "defaultValue": "false"
            },
            "ariaLabelText": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string | null",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Provide a short, descriptive text that explains the indicator's meaning or value."
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "aria-label-text"
            },
            "variant": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Sets variant of the Indicator"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "variant",
                "defaultValue": "'number'"
            },
            "number": {
                "type": "number",
                "mutable": false,
                "complexType": {
                    "original": "number",
                    "resolved": "number",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Numeric value to display when using the 'number' variant"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "number",
                "defaultValue": "0"
            }
        };
    }
    static get states() {
        return {
            "filteredNumber": {}
        };
    }
    static get elementRef() { return "el"; }
}
