import { h, Host } from "@stencil/core";
import { AttachmentsClass } from "./constants";
import { validateWcagProp } from "../../helpers/Validate/wcag";
import { canValidateWcagOnRender } from "../../helpers/Dom/win";
import { delay } from "../../utils/utils";
import { govHost } from "../../helpers/Dom/template";
export class GovAttachments {
    constructor() {
        this.h = govHost(this.host);
    }
    async componentDidRender() {
        if (canValidateWcagOnRender()) {
            await delay(500);
            await this.validateWcag();
        }
    }
    render() {
        return (h(Host, { key: '80effc5b697215f9a0cf731b6562c137edbc0efa', class: this.h.classes(AttachmentsClass.root) }, this.label ? h("p", { class: AttachmentsClass.label }, this.label) : null, h("div", { key: '3b7388299a3da27be78732562ded94bb6581525b', class: AttachmentsClass.list, role: "list", "aria-label": this.wcagLabel }, h("slot", { key: '38c1592a7501f166a462fbb70eef92d6c855d0ec' }))));
    }
    /**
     * Validate the WCAG attributes of the component
     */
    async validateWcag() {
        validateWcagProp(this.wcagLabel, 'wcag-label', AttachmentsClass.root);
    }
    static get is() { return "gov-attachments"; }
    static get properties() {
        return {
            "label": {
                "type": "string",
                "attribute": "label",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Label of attachments section"
                },
                "getter": false,
                "setter": false,
                "reflect": false
            },
            "wcagLabel": {
                "type": "string",
                "attribute": "wcag-label",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Adds accessible label for the attachment section that is only shown for screen readers."
                },
                "getter": false,
                "setter": false,
                "reflect": false
            }
        };
    }
    static get methods() {
        return {
            "validateWcag": {
                "complexType": {
                    "signature": "() => Promise<void>",
                    "parameters": [],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        }
                    },
                    "return": "Promise<void>"
                },
                "docs": {
                    "text": "Validate the WCAG attributes of the component",
                    "tags": []
                }
            }
        };
    }
    static get elementRef() { return "host"; }
}
//# sourceMappingURL=gov-attachments.js.map
