import { r as registerInstance, c as createEvent, h } from './index-148a7577.js';
import { T as TagSize } from './tag-size.enum-403e0cd8.js';
import { _ as _t } from './text-26e02c8d.js';

const tagCss = ".sc-digi-tag-h{--digi--tag--display:inline-block;--digi--tag--margin-bottom:var(--digi--gutter--smaller)}.sc-digi-tag-h .digi-tag.sc-digi-tag{display:var(--digi--tag--display);margin-bottom:var(--digi--tag--margin-bottom)}.sc-digi-tag-h .digi-tag__text.sc-digi-tag{display:inline-block;max-width:100%;white-space:normal}.sc-digi-tag-h .digi-tag__text--break.sc-digi-tag{overflow-wrap:anywhere;word-break:break-word;hyphens:auto}";
const DigiTagStyle0 = tagCss;

const Tag = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.afOnClick = createEvent(this, "afOnClick", 7);
        this.afText = undefined;
        this.afNoIcon = false;
        this.afAriaLabel = undefined;
        this.afSize = TagSize.SMALL;
        this.afBreakWords = false;
    }
    clickHandler(e) {
        e.stopPropagation();
        this.afOnClick.emit(e);
    }
    get ariaLabel() {
        const showIcon = !this.afNoIcon;
        if (this.afAriaLabel) {
            return this.afAriaLabel;
        }
        else if (showIcon) {
            return _t.removeItem(this.afText);
        }
        return this.afText;
    }
    render() {
        return (h("digi-button", { key: '55cce70f4de26f0a2b8650cb8ffb683b62d39157', onAfOnClick: (e) => this.clickHandler(e), "af-variation": "secondary", "af-size": this.afSize, class: "digi-tag", "af-aria-label": this.ariaLabel }, this.afText, !this.afNoIcon && h("digi-icon-x", { key: '8c4b1ff744288216ea42bd6c66826ea6fdcc7dce', slot: "icon-secondary" })));
    }
};
Tag.style = DigiTagStyle0;

export { Tag as digi_tag };
