'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-7a477838.js');
const tagSize_enum = require('./tag-size.enum-387c516c.js');
const text = require('./text-3157012b.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) {
        index.registerInstance(this, hostRef);
        this.afOnClick = index.createEvent(this, "afOnClick", 7);
        this.afText = undefined;
        this.afNoIcon = false;
        this.afAriaLabel = undefined;
        this.afSize = tagSize_enum.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 text._t.removeItem(this.afText);
        }
        return this.afText;
    }
    render() {
        return (index.h("digi-button", { key: '8ec218f2ec9c75252bc0dd30a8e1c2b875c38f07', onAfOnClick: (e) => this.clickHandler(e), "af-variation": "secondary", "af-size": this.afSize, class: "digi-tag", "af-aria-label": this.ariaLabel }, this.afText, !this.afNoIcon && index.h("digi-icon-x", { key: '882a55acb0f3cc2e52a25d0969faf360858b3cea', slot: "icon-secondary" })));
    }
};
Tag.style = DigiTagStyle0;

exports.digi_tag = Tag;
