import { h, Host } from "@stencil/core";
import { govHost } from "../../helpers/Dom/template";
import { validateProp } from "../../helpers/Validate/props";
import { ButtonSizes, ButtonColors } from "../gov-button/button/constants";
import { TagClass, TagSizes } from "./constants";
import { prepareIconFormat } from "../gov-icon/helpers";
export class GovTag {
    constructor() {
        /**
         * Tag’s size.
         */
        this.size = TagSizes._S;
        /**
         * Style variation of the tag.
         */
        this.color = ButtonColors.PRIMARY;
        /**
         * Expands the tag to fill 100% of the container width
         */
        this.expanded = false;
        this.h = govHost(this.host);
    }
    validateColor(newValue) {
        validateProp(ButtonColors, newValue, TagClass.root);
    }
    validateSize(newValue) {
        validateProp(ButtonSizes, newValue, TagClass.root);
    }
    componentWillLoad() {
        this.validateColor(this.color);
        this.validateSize(this.size);
    }
    render() {
        const iconStart = prepareIconFormat(this.iconStart);
        const iconEnd = prepareIconFormat(this.iconEnd);
        return (h(Host, { key: 'bb366b85a94d134d58766604e6410e17bed07adc', class: this.h.classes(TagClass.root), color: this.color, size: this.size, type: this.type }, h("span", { key: '963aa53926b6b65bbc155c349a119f46aabe59c8', class: "element" }, h("slot", { key: '3164cfa09970ac3e0f97df7265afd45a623b09aa', name: "icon-start" }, iconStart && h("gov-icon", { key: '335c0e5db0cb5a808c553bd4c9f6893d17a8fac9', type: iconStart.type, name: iconStart.name })), h("slot", { key: '9be29754dcefdaa37daee39befdc6a708e36324d' }), h("slot", { key: '6dffe882089838615e9fe451fc800b728885746a', name: "icon-end" }, iconEnd && h("gov-icon", { key: '415d8c03fefdf6281ae13668fb7b3aeaa572856e', type: iconEnd.type, name: iconEnd.name })))));
    }
    static get is() { return "gov-tag"; }
    static get properties() {
        return {
            "iconStart": {
                "type": "string",
                "attribute": "icon-start",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Definition of the button icon on the left. The icon must be defined in the form \"type/name\"."
                },
                "getter": false,
                "setter": false,
                "reflect": false
            },
            "iconEnd": {
                "type": "string",
                "attribute": "icon-end",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Definition of the button icon on the left. The icon must be defined in the form \"type/name\"."
                },
                "getter": false,
                "setter": false,
                "reflect": false
            },
            "size": {
                "type": "string",
                "attribute": "size",
                "mutable": false,
                "complexType": {
                    "original": "TagSizesType",
                    "resolved": "\"m\" | \"s\" | \"xs\"",
                    "references": {
                        "TagSizesType": {
                            "location": "import",
                            "path": "./constants",
                            "id": "../../../packages/core/src/components/gov-tag/constants.ts::TagSizesType"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Tag\u2019s size."
                },
                "getter": false,
                "setter": false,
                "reflect": true,
                "defaultValue": "TagSizes._S"
            },
            "color": {
                "type": "string",
                "attribute": "color",
                "mutable": false,
                "complexType": {
                    "original": "ButtonColorType",
                    "resolved": "\"error\" | \"neutral\" | \"primary\" | \"secondary\" | \"success\" | \"warning\"",
                    "references": {
                        "ButtonColorType": {
                            "location": "import",
                            "path": "../gov-button/button/constants",
                            "id": "../../../packages/core/src/components/gov-button/button/constants.ts::ButtonColorType"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Style variation of the tag."
                },
                "getter": false,
                "setter": false,
                "reflect": true,
                "defaultValue": "ButtonColors.PRIMARY"
            },
            "type": {
                "type": "string",
                "attribute": "type",
                "mutable": false,
                "complexType": {
                    "original": "TagTypesType",
                    "resolved": "\"bold\" | \"subtle\"",
                    "references": {
                        "TagTypesType": {
                            "location": "import",
                            "path": "./constants",
                            "id": "../../../packages/core/src/components/gov-tag/constants.ts::TagTypesType"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Tag\u2019s type"
                },
                "getter": false,
                "setter": false,
                "reflect": true
            },
            "expanded": {
                "type": "boolean",
                "attribute": "expanded",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Expands the tag to fill 100% of the container width"
                },
                "getter": false,
                "setter": false,
                "reflect": true,
                "defaultValue": "false"
            }
        };
    }
    static get elementRef() { return "host"; }
    static get watchers() {
        return [{
                "propName": "color",
                "methodName": "validateColor"
            }, {
                "propName": "size",
                "methodName": "validateSize"
            }];
    }
}
//# sourceMappingURL=gov-tag.js.map
