import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-ClISz4NF.js';
import { b as validateWcagProp, v as validateAccessibleLabel } from './wcag-CD6_13JO.js';
import { c as canValidateWcagOnRender } from './gov.log-BtqD9K8d.js';
import { d as delay } from './utils-CQvUntGY.js';
import { g as govHost } from './template-CoD1xawt.js';
import { i as isString } from './helpers.types-DNztiAH0.js';
import { F as FormMessageClass, a as FormMessageColors } from './constants-BegH8u6i.js';
import { v as validateProp } from './props-CJZgTDla.js';
import { c as createID } from './string.utils-vN03FcXN.js';
import './colors-U40vKHrs.js';
import './sizes-BcQO4NH2.js';

const AttachmentsClass = {
    root: 'gov-attachments',
    label: 'gov-attachments__label',
    list: 'gov-attachments__list',
};
const AttachmentsItemClass = {
    root: 'gov-attachments-item',
    name: 'gov-attachments-item__name',
    file: 'gov-attachments-item__file',
    messages: 'gov-attachments-item__messages',
};

const GovAttachments = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        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);
    }
    get host() { return getElement(this); }
};

const govAttachmentsItemCss = "gov-attachments-item,.gov-attachments-item{display:flex;flex-direction:column}gov-attachments-item__messages>*:last-child,.gov-attachments-item__messages>*:last-child{margin-bottom:0}gov-attachments-item__messages>*,.gov-attachments-item__messages>*{position:relative;top:calc(-1 * var(--spacing-xs))}gov-attachments-item__file,.gov-attachments-item__file{display:flex;gap:var(--spacing-s);max-width:100%}gov-attachments-item__name,.gov-attachments-item__name{display:flex;-moz-column-gap:var(--spacing-s);column-gap:var(--spacing-s);align-items:center;max-width:calc(100% - var(--spacing-s) - var(--icon-size-s) - (var(--spacing-s-nudge) + var(--border-width, 0.0625rem)) * 2);margin:0}gov-attachments-item__name>gov-tooltip,gov-attachments-item__name .gov-tooltip,.gov-attachments-item__name>gov-tooltip,.gov-attachments-item__name .gov-tooltip{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%;color:var(--name-color, var(--text-primary))}gov-attachments-item__name span[slot=info],.gov-attachments-item__name span[slot=info]{font-size:var(--font-size-body-xs);line-height:150%;font-weight:400;color:var(--decor-color, var(--text-secondary));white-space:nowrap}";

const GovAttachmentsItem = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.govRemove = createEvent(this, "gov-remove");
        /**
         * Adds accessible label for the remove button that is only shown for screen readers.
         */
        this.accessibleRemoveLabel = "Odebrat soubor {FILE_NAME}";
        this.h = govHost(this.host);
    }
    async componentDidRender() {
        if (canValidateWcagOnRender()) {
            await delay(500);
            await this.validateAccessibility();
        }
    }
    render() {
        return (h(Host, { key: '2b75f45ecc4b9a72a0e471c4f92588e0df19bfb6', class: this.h.classes(AttachmentsItemClass.root), role: "listitem" }, h("div", { key: '472c55271bc6a0c10c315e44053ca30a41d667ab', class: AttachmentsItemClass.file }, h("div", { key: '13f199a67dcbb07226451d67dc4e0ff242f7b66f', class: AttachmentsItemClass.name }, h("gov-tooltip", { key: 'b65c03b2f2838b74e163f89ac171eeee527e16c6', position: "top", icon: true }, h("slot", { key: '6c273a499bfeb40859ad5ffe79181df25250290d' }), h("gov-tooltip-content", { key: '82ecb87b7f00bcc56a122c54706e9ba614e04bb8' }, this.h.getSlotContent(`name`))), h("slot", { key: 'a43693ee308113468fa7083771d89f668fbeef53', name: "info" })), h("gov-button", { key: 'a735520757a7140199c182e46cedcb3b549796d3', color: "primary", type: "base", size: "s", "aria-label": isString(this.accessibleRemoveLabel) ? this.accessibleRemoveLabel.replace('{FILE_NAME}', this.h.getSlotContent(`name`) || '').trim() : null, "aria-labelledby": this.accessibleRemoveLabelledBy, "on-gov-click": this.govRemove.emit }, h("gov-icon", { key: 'c130f0225431f0b522e0ddbc3e59bb50aa234857', slot: "icon-start", name: "x-lg", type: "components" }))), this.h.hasSlot('message') && (h("div", { key: 'e3779227622c456d014bd118ab3b9886fd799f57', class: AttachmentsItemClass.messages }, h("slot", { key: 'eef992883000f87ac5bcd460e53078c08839c920', name: "message" })))));
    }
    /**
     * Validate the accessible attributes of the component
     */
    async validateAccessibility() {
        validateAccessibleLabel(this.accessibleRemoveLabel, this.accessibleRemoveLabelledBy, AttachmentsItemClass.root, this.host);
    }
    get host() { return getElement(this); }
};
GovAttachmentsItem.style = govAttachmentsItemCss;

const GovFormMessage = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        /**
         * 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;
    }
    get host() { return getElement(this); }
    static get watchers() { return {
        "color": ["validateColor"]
    }; }
};

export { GovAttachments as gov_attachments, GovAttachmentsItem as gov_attachments_item, GovFormMessage as gov_form_message };
//# sourceMappingURL=gov-attachments.gov-attachments-item.gov-form-message.entry.js.map

//# sourceMappingURL=gov-attachments_3.entry.js.map