import { Host, h } from "@stencil/core";
/**
 * @slot label - Default slot for Loader label text.
 */
export class PdsLoader {
    constructor() {
        this.style = () => {
            if (this.size !== undefined) {
                return {
                    height: this.loaderSize(),
                    width: this.loaderSize(),
                };
            }
        };
        this.isLoading = true;
        this.showLabel = false;
        this.size = 'md';
        this.variant = 'spinner';
    }
    loaderSize() {
        const sizes = {
            xs: '24px',
            sm: '32px',
            md: '48px',
            lg: '64px',
            xl: '80px',
        };
        if (sizes[this.size]) {
            return sizes[this.size];
        }
        else {
            return this.size;
        }
    }
    render() {
        return (h(Host, { key: 'd86c3a84f772eedb15662d0d2e22e53ec7064245', class: `pds-loader ${this.isLoading ? '' : 'pds-loader--hidden'}`, "aria-hidden": !this.isLoading, "aria-busy": this.isLoading, "aria-live": "polite" }, this.variant === 'spinner' && (h("div", { key: 'ec7cda5951617f46427729e5497c7d1b46562ae0', class: "pds-loader--spinner" }, h("svg", { key: '5a7bc867400981ba2190dd00836af63cd2492e80', style: this.style(), viewBox: "0 0 200 200", fill: "none" }, h("defs", { key: 'ee88cb4c138868b286f017f84925d3cf8226eeb8' }, h("linearGradient", { key: '435c54ff00cf11654e01d3d6932e77e74fdef8ae', id: "spinner-secondHalf" }, h("stop", { key: '4b9b65cde42833c14285f97c7f4b4acb681db89c', offset: "0%", "stop-opacity": "0", "stop-color": "currentColor" }), h("stop", { key: '207b3963322e1f7f54f2b7b42b328e868a9b8e78', offset: "100%", "stop-opacity": "0.5", "stop-color": "currentColor" })), h("linearGradient", { key: 'fc877ee5738a8184227fe022534e9cdfd8e27bd1', id: "spinner-firstHalf" }, h("stop", { key: '3d210b400691e364e9d1214531c86003a7588d2c', offset: "0%", "stop-opacity": "1", "stop-color": "currentColor" }), h("stop", { key: 'e99b0c940dc876637d90c3d86ce87f35e2f82687', offset: "100%", "stop-opacity": "0.5", "stop-color": "currentColor" }))), h("g", { key: 'f2acd79941647de3a5c5aae6383d021d1fad7493', class: "pds-loader__spinner-path" }, h("path", { key: '9f1d64d00c633dc7ff0a0f2173c7f0e0c04198d6', stroke: "url(#spinner-secondHalf)", d: "M 4 100 A 96 96 0 0 1 196 100" }), h("path", { key: 'd5ff2bd47100be8eee961b00102e77b3456e8236', stroke: "url(#spinner-firstHalf)", d: "M 196 100 A 96 96 0 0 1 4 100" }), h("path", { key: 'd7cc6e2da92238c023d322f023e7e437a5d41404', stroke: "currentColor", "stroke-linecap": "round", d: "M 4 100 A 96 96 0 0 1 4 98" }))))), this.variant === 'typing' && (h("div", { key: '3c893dc1ae4f39f2b5873ba46d4ae30f873d1158', class: "pds-loader--typing" }, h("span", { key: '8b38041018e2039fcc19ad3dbce6de3924725cc3' }), h("span", { key: 'b3e827a9fded83368404e8bb5c83306ff6a35979' }), h("span", { key: '41fedabc2db044862892ae68476756c6400a58fa' }))), h("div", { key: 'b4cf5add3094c4824612216b8ca7291a4e40ff08', class: `pds-loader__label ${this.showLabel ? '' : 'pds-loader--hidden'}` }, h("slot", { key: 'c7b10e65a5a5350e7973a49c540907edf44c71fa', name: "label" }, "Loading..."))));
    }
    static get is() { return "pds-loader"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() {
        return {
            "$": ["../../global/styles/base.scss", "pds-loader.scss"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["../../global/styles/base.css", "pds-loader.css"]
        };
    }
    static get properties() {
        return {
            "isLoading": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "If false, the loader will be hidden."
                },
                "attribute": "is-loading",
                "reflect": false,
                "defaultValue": "true"
            },
            "showLabel": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Determines whether the loader should display a label."
                },
                "attribute": "show-label",
                "reflect": false,
                "defaultValue": "false"
            },
            "size": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "| 'xs' // 24px\n  | 'sm' // 32px\n  | 'md' // 48px\n  | 'lg' // 64px\n  | 'xl' // 80px\n  | string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Sets the size of the spinner loader. Value can be preset or custom."
                },
                "attribute": "size",
                "reflect": true,
                "defaultValue": "'md'"
            },
            "variant": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "'spinner' | 'typing'",
                    "resolved": "\"spinner\" | \"typing\"",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Determines the type of loader."
                },
                "attribute": "variant",
                "reflect": false,
                "defaultValue": "'spinner'"
            }
        };
    }
}
//# sourceMappingURL=pds-loader.js.map
