import { CloseButtonComponent } from '@agorapulse/ui-components/close-button';
import { SymbolRegistry, apClose, apPlus, SymbolComponent } from '@agorapulse/ui-symbol';
import * as i0 from '@angular/core';
import { inject, ElementRef, input, booleanAttribute, output, viewChild, computed, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';

class TagComponent {
    elementRef = inject(ElementRef);
    symbolRegistry = inject(SymbolRegistry);
    constructor() {
        this.symbolRegistry.registerSymbols([apClose, apPlus]);
    }
    clearable = input(false, ...(ngDevMode ? [{ debugName: "clearable", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
    add = input(false, ...(ngDevMode ? [{ debugName: "add", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
    color = input('blue', ...(ngDevMode ? [{ debugName: "color" }] : []));
    mini = input(false, ...(ngDevMode ? [{ debugName: "mini" }] : []));
    clear = output();
    added = output();
    content = viewChild.required('contentWrapper');
    contentText = computed(() => this.content().nativeElement.innerText, ...(ngDevMode ? [{ debugName: "contentText" }] : []));
    onClear($event) {
        $event.stopImmediatePropagation();
        this.elementRef.nativeElement.remove();
        this.clear.emit({ $event });
    }
    onAdd($event) {
        $event.stopImmediatePropagation();
        this.added.emit({ $event: $event });
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: TagComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: TagComponent, isStandalone: true, selector: "ap-tag", inputs: { clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, add: { classPropertyName: "add", publicName: "add", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, mini: { classPropertyName: "mini", publicName: "mini", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { clear: "clear", added: "added" }, viewQueries: [{ propertyName: "content", first: true, predicate: ["contentWrapper"], descendants: true, isSignal: true }], ngImport: i0, template: "<div\n    [class.blue]=\"color() === 'blue'\"\n    [class.menthol]=\"color() === 'menthol'\"\n    [class.grey]=\"color() === 'grey'\"\n    [class.tagOrange]=\"color() === 'tagOrange'\"\n    [class.green]=\"color() === 'green'\"\n    [class.red]=\"color() === 'red'\"\n    [class.clearable]=\"clearable()\"\n    [class.add]=\"add()\"\n    [class.mini]=\"mini()\">\n    <ng-content select=\"ap-symbol\" />\n    <ng-content select=\"ap-avatar\" />\n\n    <span #contentWrapper>\n        <ng-content />\n    </span>\n\n    @if (clearable()) {\n        <!-- FIXME implement as a directive and combine with a button tag to have to full access to all attributes (aria-labelledby) -->\n        <ap-close-button\n            [ariaLabel]=\"'clear ' + contentText()\"\n            (closed)=\"onClear($event)\" />\n    } @else if (add()) {\n        <button \n            class=\"add-button\"\n            type=\"button\"\n            aria-label=\"Add item\"\n            (click)=\"onAdd($event)\">\n            <ap-symbol size=\"xs\" symbolId=\"plus\" color=\"#344563\" />\n        </button>\n    }\n</div>\n", styles: ["ap-tag{--avatar-size: 16px;--button-size: 20px;display:inline-flex;vertical-align:middle}ap-tag>div{display:flex;align-items:center;justify-content:center;height:var(--comp-tag-height);max-height:var(--height);box-sizing:border-box;border-width:1px;border-style:solid;padding:0 var(--comp-tag-padding-right) 0 var(--comp-tag-padding-left);border-radius:var(--comp-tag-border-radius);gap:var(--ref-spacing-xxxs)}ap-tag>div.clearable,ap-tag>div.add{padding:0 calc(var(--comp-tag-closable-padding-right) - 1px) 0 var(--comp-tag-padding-left)}ap-tag>div.mini{height:var(--comp-tag-mini-height);padding:0 var(--comp-tag-mini-padding-right) 0 var(--comp-tag-mini-padding-left)}ap-tag>div span{max-width:180px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:var(--comp-tag-text-style-size);line-height:var(--comp-tag-text-style-line-height);font-weight:var(--comp-tag-text-style-font-weight);font-family:var(--comp-tag-text-style-font-family)}ap-tag>div ap-avatar{min-width:var(--avatar-size);width:var(--avatar-size);max-width:var(--avatar-size);min-height:var(--avatar-size);height:var(--avatar-size);max-height:var(--avatar-size)}ap-tag>div ap-avatar img{width:var(--avatar-size);height:var(--avatar-size)}ap-tag>div.blue{background-color:var(--comp-tag-blue-background-color);border-color:var(--comp-tag-blue-border-color);color:var(--comp-tag-blue-text-color)}ap-tag>div.grey{background-color:var(--comp-tag-grey-background-color);border-color:var(--comp-tag-grey-border-color);color:var(--comp-tag-grey-text-color)}ap-tag>div.tagOrange{background-color:var(--comp-tag-tag-orange-background-color);border-color:var(--comp-tag-tag-orange-border-color);color:var(--comp-tag-tag-orange-text-color)}ap-tag>div.menthol{background-color:var(--comp-tag-menthol-background-color);border-color:var(--comp-tag-menthol-border-color);color:var(--comp-tag-menthol-text-color)}ap-tag>div.green{background-color:var(--comp-tag-green-background-color);border-color:var(--comp-tag-green-border-color);color:var(--comp-tag-green-text-color)}ap-tag>div.red{background-color:var(--comp-tag-red-background-color);border-color:var(--comp-tag-red-border-color);color:var(--comp-tag-red-text-color)}ap-tag>div .add-button{margin:0;display:flex;justify-content:center;align-items:center;width:var(--comp-close-button-size);max-width:var(--comp-close-button-size);height:var(--comp-close-button-size);max-height:var(--comp-close-button-size);border-radius:50%;background:transparent;border:none;position:relative;transition:border .25s;padding:var(--comp-close-button-padding);outline:none;cursor:pointer}@media (hover: hover){ap-tag>div .add-button:focus:not(.disabled):not(:active){outline:2px solid var(--ref-color-electric-blue-100);outline-offset:1px}}ap-tag>div .add-button:hover{background:var(--comp-close-button-hover-background)}ap-tag>div .add-button:active{background:var(--comp-close-button-active-background);outline:none}ap-tag>div .add-button:focus:active{outline:none}\n"], dependencies: [{ kind: "component", type: CloseButtonComponent, selector: "ap-close-button", inputs: ["disabled", "ariaLabel", "dataTest"], outputs: ["closed"] }, { kind: "component", type: SymbolComponent, selector: "ap-symbol", inputs: ["symbolId", "color", "size"], outputs: ["sizeChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: TagComponent, decorators: [{
            type: Component,
            args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'ap-tag', imports: [CloseButtonComponent, SymbolComponent], encapsulation: ViewEncapsulation.None, template: "<div\n    [class.blue]=\"color() === 'blue'\"\n    [class.menthol]=\"color() === 'menthol'\"\n    [class.grey]=\"color() === 'grey'\"\n    [class.tagOrange]=\"color() === 'tagOrange'\"\n    [class.green]=\"color() === 'green'\"\n    [class.red]=\"color() === 'red'\"\n    [class.clearable]=\"clearable()\"\n    [class.add]=\"add()\"\n    [class.mini]=\"mini()\">\n    <ng-content select=\"ap-symbol\" />\n    <ng-content select=\"ap-avatar\" />\n\n    <span #contentWrapper>\n        <ng-content />\n    </span>\n\n    @if (clearable()) {\n        <!-- FIXME implement as a directive and combine with a button tag to have to full access to all attributes (aria-labelledby) -->\n        <ap-close-button\n            [ariaLabel]=\"'clear ' + contentText()\"\n            (closed)=\"onClear($event)\" />\n    } @else if (add()) {\n        <button \n            class=\"add-button\"\n            type=\"button\"\n            aria-label=\"Add item\"\n            (click)=\"onAdd($event)\">\n            <ap-symbol size=\"xs\" symbolId=\"plus\" color=\"#344563\" />\n        </button>\n    }\n</div>\n", styles: ["ap-tag{--avatar-size: 16px;--button-size: 20px;display:inline-flex;vertical-align:middle}ap-tag>div{display:flex;align-items:center;justify-content:center;height:var(--comp-tag-height);max-height:var(--height);box-sizing:border-box;border-width:1px;border-style:solid;padding:0 var(--comp-tag-padding-right) 0 var(--comp-tag-padding-left);border-radius:var(--comp-tag-border-radius);gap:var(--ref-spacing-xxxs)}ap-tag>div.clearable,ap-tag>div.add{padding:0 calc(var(--comp-tag-closable-padding-right) - 1px) 0 var(--comp-tag-padding-left)}ap-tag>div.mini{height:var(--comp-tag-mini-height);padding:0 var(--comp-tag-mini-padding-right) 0 var(--comp-tag-mini-padding-left)}ap-tag>div span{max-width:180px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:var(--comp-tag-text-style-size);line-height:var(--comp-tag-text-style-line-height);font-weight:var(--comp-tag-text-style-font-weight);font-family:var(--comp-tag-text-style-font-family)}ap-tag>div ap-avatar{min-width:var(--avatar-size);width:var(--avatar-size);max-width:var(--avatar-size);min-height:var(--avatar-size);height:var(--avatar-size);max-height:var(--avatar-size)}ap-tag>div ap-avatar img{width:var(--avatar-size);height:var(--avatar-size)}ap-tag>div.blue{background-color:var(--comp-tag-blue-background-color);border-color:var(--comp-tag-blue-border-color);color:var(--comp-tag-blue-text-color)}ap-tag>div.grey{background-color:var(--comp-tag-grey-background-color);border-color:var(--comp-tag-grey-border-color);color:var(--comp-tag-grey-text-color)}ap-tag>div.tagOrange{background-color:var(--comp-tag-tag-orange-background-color);border-color:var(--comp-tag-tag-orange-border-color);color:var(--comp-tag-tag-orange-text-color)}ap-tag>div.menthol{background-color:var(--comp-tag-menthol-background-color);border-color:var(--comp-tag-menthol-border-color);color:var(--comp-tag-menthol-text-color)}ap-tag>div.green{background-color:var(--comp-tag-green-background-color);border-color:var(--comp-tag-green-border-color);color:var(--comp-tag-green-text-color)}ap-tag>div.red{background-color:var(--comp-tag-red-background-color);border-color:var(--comp-tag-red-border-color);color:var(--comp-tag-red-text-color)}ap-tag>div .add-button{margin:0;display:flex;justify-content:center;align-items:center;width:var(--comp-close-button-size);max-width:var(--comp-close-button-size);height:var(--comp-close-button-size);max-height:var(--comp-close-button-size);border-radius:50%;background:transparent;border:none;position:relative;transition:border .25s;padding:var(--comp-close-button-padding);outline:none;cursor:pointer}@media (hover: hover){ap-tag>div .add-button:focus:not(.disabled):not(:active){outline:2px solid var(--ref-color-electric-blue-100);outline-offset:1px}}ap-tag>div .add-button:hover{background:var(--comp-close-button-hover-background)}ap-tag>div .add-button:active{background:var(--comp-close-button-active-background);outline:none}ap-tag>div .add-button:focus:active{outline:none}\n"] }]
        }], ctorParameters: () => [], propDecorators: { clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], add: [{ type: i0.Input, args: [{ isSignal: true, alias: "add", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], mini: [{ type: i0.Input, args: [{ isSignal: true, alias: "mini", required: false }] }], clear: [{ type: i0.Output, args: ["clear"] }], added: [{ type: i0.Output, args: ["added"] }], content: [{ type: i0.ViewChild, args: ['contentWrapper', { isSignal: true }] }] } });

/**
 * Generated bundle index. Do not edit.
 */

export { TagComponent };
//# sourceMappingURL=agorapulse-ui-components-tag.mjs.map
