import * as i0 from '@angular/core';
import { EventEmitter, Component, Input, Output, NgModule } from '@angular/core';
import { NgClass } from '@angular/common';

/**
 * @description Componente de lista de tokens (etiquetas) clicáveis e opcionalmente
 * removíveis. Emite eventos ao selecionar ou remover um token.
 *
 * @example
 * ```html
 * <s-token-list
 *   [tokens]="listaDeTokens"
 *   [removableTokens]="true"
 *   (tokenSelected)="onTokenSelecionado($event)"
 *   (tokenRemoved)="onTokenRemovido($event)" />
 * ```
 *
 * @category Summary
 */
class TokenListComponent {
    static nextId = 0;
    /** @description Identificador único do componente no DOM. Gerado automaticamente se não informado. */
    id = `s-token-list-${TokenListComponent.nextId++}`;
    /** @description Lista de tokens exibidos. Campo obrigatório. */
    tokens;
    /** @description Exibe o botão de remoção em cada token. @default false */
    removableTokens = false;
    /** @description Quando `true`, remove os eventos de ponteiro (hover/clique) dos tokens. @default false */
    hidePointerEvents = false;
    /** @description Emitido quando o usuário clica em um token não desabilitado. */
    tokenSelected = new EventEmitter();
    /** @description Emitido quando o usuário remove um token não desabilitado. */
    tokenRemoved = new EventEmitter();
    onTokenSelected(token) {
        if (!token.disabled) {
            this.tokenSelected.next(token);
        }
    }
    onTokenRemoved(token) {
        if (!token.disabled) {
            this.tokenRemoved.next(token);
        }
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TokenListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: TokenListComponent, isStandalone: true, selector: "s-token-list", inputs: { id: "id", tokens: "tokens", removableTokens: "removableTokens", hidePointerEvents: "hidePointerEvents" }, outputs: { tokenSelected: "tokenSelected", tokenRemoved: "tokenRemoved" }, ngImport: i0, template: "<div\n    [id]=\"id\"\n    class=\"token-list\"\n>\n    @for (token of tokens; track $index) {\n        <span\n            [id]=\"token.id\"\n            class=\"token\"\n            [ngClass]=\"{\n                'no-pointer-events': hidePointerEvents,\n                'token--disabled': token.disabled,\n            }\"\n        >\n            <a\n                [id]=\"(token.id || 'token') + '-label'\"\n                class=\"token-label\"\n                (click)=\"onTokenSelected(token)\"\n            >\n                {{ token.label }}\n            </a>\n            @if (removableTokens && !token.notRemovable) {\n                <span\n                    [id]=\"token.id + '-remove'\"\n                    class=\"far fa-times\"\n                    (click)=\"onTokenRemoved(token)\"\n                >\n                </span>\n            }\n        </span>\n    }\n</div>\n", styles: [".no-pointer-events{pointer-events:none}.token-list{align-items:center;display:inline-flex;flex-wrap:wrap;max-width:100%;padding:0 10px;text-transform:none}.token-list .token{align-items:center;background-color:#e5eaea;border:1px solid #697882;border-radius:4px;color:#212533;display:flex;font:400 12px/150% Open Sans,sans-serif;gap:8px;margin:2px 5px 0 0;max-width:100%;padding:2px 8px;-webkit-user-select:none;user-select:none}.token-list .token-label{max-width:50ch;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.token-list .token:not(.token--disabled):hover,.token-list .token:not(.token--disabled):focus{background-color:#ccc}.token-list .token a{text-decoration:none;color:#212533}.token-list .token--disabled{opacity:50%}.token-list .token--disabled a{cursor:default}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TokenListComponent, decorators: [{
            type: Component,
            args: [{ selector: 's-token-list', standalone: true, imports: [NgClass], template: "<div\n    [id]=\"id\"\n    class=\"token-list\"\n>\n    @for (token of tokens; track $index) {\n        <span\n            [id]=\"token.id\"\n            class=\"token\"\n            [ngClass]=\"{\n                'no-pointer-events': hidePointerEvents,\n                'token--disabled': token.disabled,\n            }\"\n        >\n            <a\n                [id]=\"(token.id || 'token') + '-label'\"\n                class=\"token-label\"\n                (click)=\"onTokenSelected(token)\"\n            >\n                {{ token.label }}\n            </a>\n            @if (removableTokens && !token.notRemovable) {\n                <span\n                    [id]=\"token.id + '-remove'\"\n                    class=\"far fa-times\"\n                    (click)=\"onTokenRemoved(token)\"\n                >\n                </span>\n            }\n        </span>\n    }\n</div>\n", styles: [".no-pointer-events{pointer-events:none}.token-list{align-items:center;display:inline-flex;flex-wrap:wrap;max-width:100%;padding:0 10px;text-transform:none}.token-list .token{align-items:center;background-color:#e5eaea;border:1px solid #697882;border-radius:4px;color:#212533;display:flex;font:400 12px/150% Open Sans,sans-serif;gap:8px;margin:2px 5px 0 0;max-width:100%;padding:2px 8px;-webkit-user-select:none;user-select:none}.token-list .token-label{max-width:50ch;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.token-list .token:not(.token--disabled):hover,.token-list .token:not(.token--disabled):focus{background-color:#ccc}.token-list .token a{text-decoration:none;color:#212533}.token-list .token--disabled{opacity:50%}.token-list .token--disabled a{cursor:default}\n"] }]
        }], propDecorators: { id: [{
                type: Input
            }], tokens: [{
                type: Input,
                args: [{ required: true }]
            }], removableTokens: [{
                type: Input
            }], hidePointerEvents: [{
                type: Input
            }], tokenSelected: [{
                type: Output
            }], tokenRemoved: [{
                type: Output
            }] } });

class TokenListModule {
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TokenListModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
    static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: TokenListModule, imports: [TokenListComponent], exports: [TokenListComponent] });
    static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TokenListModule });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TokenListModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [TokenListComponent],
                    exports: [TokenListComponent],
                }]
        }] });

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

export { TokenListComponent, TokenListModule };
//# sourceMappingURL=seniorsistemas-angular-components-token-list.mjs.map
