import { h, Host } from "@stencil/core";
import { FormMessageClass, FormMessageColors } from "./constants";
import { govHost } from "../../../helpers/Dom/template";
import { validateProp } from "../../../helpers/Validate/props";
import { createID } from "../../../utils/string.utils";
export class GovFormMessage {
    constructor() {
        /**
         * Style variation of the message.
         */
        this.color = 'neutral';
        /**
         * Message's size.
         */
        this.size = 'm';
        this.h = govHost(this.host);
        this.messageId = createID('GovFormMessage');
    }
    validateColor(newValue) {
        validateProp(FormMessageColors, newValue, FormMessageClass.root);
    }
    componentWillLoad() {
        this.validateColor(this.color);
    }
    render() {
        return (h(Host, { key: 'f23989a9ea8f6c47ae43cbc8655a9c7d281d36e6', class: this.h.classes(FormMessageClass.root), color: this.color, size: this.size }, this.h.hasSlot('icon') && (h("slot", { key: '0cfae3a030761bbd352411054f2a89a13da07bee', name: "icon" })), h("span", { key: 'f2d7c7a835f38b3bfe006c75fae9f8a25db7e5e1', id: this.messageId, class: FormMessageClass.content }, h("slot", { key: 'c6e752c2143d5002a50c233a1ea6cd73ef5e61b9' }))));
    }
    /**
     * Returns unique identifier of message
     */
    async identifier() {
        return this.messageId;
    }
    static get is() { return "gov-form-message"; }
    static get properties() {
        return {
            "color": {
                "type": "string",
                "attribute": "color",
                "mutable": false,
                "complexType": {
                    "original": "FormMessageColorType",
                    "resolved": "\"error\" | \"neutral\" | \"success\" | \"warning\"",
                    "references": {
                        "FormMessageColorType": {
                            "location": "import",
                            "path": "./constants",
                            "id": "../../../packages/core/src/components/gov-form/message/constants.ts::FormMessageColorType"
                        }
                    }
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Style variation of the message."
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "'neutral'"
            },
            "size": {
                "type": "string",
                "attribute": "size",
                "mutable": false,
                "complexType": {
                    "original": "FormMessageSizesTypes",
                    "resolved": "\"l\" | \"m\" | \"s\" | \"xl\" | \"xs\"",
                    "references": {
                        "FormMessageSizesTypes": {
                            "location": "import",
                            "path": "./constants",
                            "id": "../../../packages/core/src/components/gov-form/message/constants.ts::FormMessageSizesTypes"
                        }
                    }
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Message's size."
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "'m'"
            }
        };
    }
    static get methods() {
        return {
            "identifier": {
                "complexType": {
                    "signature": "() => Promise<string>",
                    "parameters": [],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        }
                    },
                    "return": "Promise<string>"
                },
                "docs": {
                    "text": "Returns unique identifier of message",
                    "tags": []
                }
            }
        };
    }
    static get elementRef() { return "host"; }
    static get watchers() {
        return [{
                "propName": "color",
                "methodName": "validateColor"
            }];
    }
}
//# sourceMappingURL=gov-form-message.js.map
