import { AsyncPipe, NgFor, NgIf, NgTemplateOutlet } from '@angular/common';
import { ChangeDetectionStrategy, Component, ContentChildren, EventEmitter, inject, Input, Output, TemplateRef, ViewEncapsulation, } from '@angular/core';
import { EMPTY_QUERY } from '@taiga-ui/cdk/constants';
import { TuiItem } from '@taiga-ui/cdk/directives/item';
import { TuiButton } from '@taiga-ui/core/components/button';
import { TuiExpandComponent } from '@taiga-ui/core/components/expand';
import { TuiGroup, tuiGroupOptionsProvider } from '@taiga-ui/core/directives/group';
import { TUI_HIDE_TEXT, TUI_SHOW_ALL_TEXT } from '@taiga-ui/kit/tokens';
import * as i0 from "@angular/core";
import * as i1 from "@taiga-ui/core/directives/group";
class TuiFilesComponent {
    constructor() {
        this.items = EMPTY_QUERY;
        this.hideText$ = inject(TUI_HIDE_TEXT);
        this.showAllText$ = inject(TUI_SHOW_ALL_TEXT);
        this.max = 0;
        this.expanded = false;
        this.expandedChange = new EventEmitter();
    }
    get hasExtraItems() {
        return !!this.max && this.items.length > this.max;
    }
    toggle() {
        this.expanded = !this.expanded;
        this.expandedChange.emit(this.expanded);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiFilesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TuiFilesComponent, isStandalone: true, selector: "tui-files", inputs: { max: "max", expanded: "expanded" }, outputs: { expandedChange: "expandedChange" }, providers: [
            tuiGroupOptionsProvider({ size: 'm', collapsed: true, orientation: 'vertical' }),
        ], queries: [{ propertyName: "items", predicate: TuiItem, read: TemplateRef }], hostDirectives: [{ directive: i1.TuiGroup }], ngImport: i0, template: "<ng-container *ngIf=\"items?.changes | async\" />\n<ng-content />\n<ng-container *ngFor=\"let item of items; let index = index\">\n    <ng-container\n        *ngIf=\"!max || index < max\"\n        [ngTemplateOutlet]=\"item\"\n    />\n</ng-container>\n<tui-expand\n    *ngIf=\"hasExtraItems\"\n    [expanded]=\"expanded\"\n>\n    <div\n        tuiGroup\n        class=\"t-extra-items\"\n    >\n        <ng-container *ngFor=\"let item of items; let index = index\">\n            <ng-container\n                *ngIf=\"max && index >= max\"\n                [ngTemplateOutlet]=\"item\"\n            />\n        </ng-container>\n    </div>\n</tui-expand>\n<div\n    *ngIf=\"hasExtraItems\"\n    class=\"t-bottom\"\n    [class.t-bottom_collapsed]=\"!expanded\"\n>\n    <button\n        appearance=\"outline\"\n        size=\"m\"\n        tuiButton\n        type=\"button\"\n        class=\"t-button\"\n        (click)=\"toggle()\"\n    >\n        {{ (expanded ? hideText$ : showAllText$) | async }}\n    </button>\n</div>\n", styles: ["tui-files{inline-size:100%;overflow:hidden;border-radius:var(--tui-radius-m)}tui-files:empty:empty{display:none}tui-files .t-files{position:relative;display:block;inline-size:100%;block-size:100%;border-radius:var(--tui-radius-m);overflow:hidden}tui-files .t-button{inline-size:100%;border-radius:inherit}tui-files .t-bottom{z-index:3;inline-size:100%;background:var(--tui-background-base);-webkit-mask:none!important;mask:none!important}tui-files .t-bottom_collapsed{box-shadow:var(--tui-shadow-popup);margin-block-start:-1.5rem}tui-files .t-extra-items{inline-size:100%}tui-files .t-extra-items>*{border-radius:0!important}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: TuiButton, selector: "a[tuiButton],button[tuiButton],a[tuiIconButton],button[tuiIconButton]", inputs: ["size"] }, { kind: "component", type: TuiExpandComponent, selector: "tui-expand", inputs: ["async", "expanded"] }, { kind: "directive", type: TuiGroup, selector: "[tuiGroup]:not(ng-container)", inputs: ["orientation", "collapsed", "rounded", "size"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
export { TuiFilesComponent };
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiFilesComponent, decorators: [{
            type: Component,
            args: [{ standalone: true, selector: 'tui-files', imports: [
                        AsyncPipe,
                        NgFor,
                        NgIf,
                        NgTemplateOutlet,
                        TuiButton,
                        TuiExpandComponent,
                        TuiGroup,
                    ], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
                        tuiGroupOptionsProvider({ size: 'm', collapsed: true, orientation: 'vertical' }),
                    ], hostDirectives: [TuiGroup], template: "<ng-container *ngIf=\"items?.changes | async\" />\n<ng-content />\n<ng-container *ngFor=\"let item of items; let index = index\">\n    <ng-container\n        *ngIf=\"!max || index < max\"\n        [ngTemplateOutlet]=\"item\"\n    />\n</ng-container>\n<tui-expand\n    *ngIf=\"hasExtraItems\"\n    [expanded]=\"expanded\"\n>\n    <div\n        tuiGroup\n        class=\"t-extra-items\"\n    >\n        <ng-container *ngFor=\"let item of items; let index = index\">\n            <ng-container\n                *ngIf=\"max && index >= max\"\n                [ngTemplateOutlet]=\"item\"\n            />\n        </ng-container>\n    </div>\n</tui-expand>\n<div\n    *ngIf=\"hasExtraItems\"\n    class=\"t-bottom\"\n    [class.t-bottom_collapsed]=\"!expanded\"\n>\n    <button\n        appearance=\"outline\"\n        size=\"m\"\n        tuiButton\n        type=\"button\"\n        class=\"t-button\"\n        (click)=\"toggle()\"\n    >\n        {{ (expanded ? hideText$ : showAllText$) | async }}\n    </button>\n</div>\n", styles: ["tui-files{inline-size:100%;overflow:hidden;border-radius:var(--tui-radius-m)}tui-files:empty:empty{display:none}tui-files .t-files{position:relative;display:block;inline-size:100%;block-size:100%;border-radius:var(--tui-radius-m);overflow:hidden}tui-files .t-button{inline-size:100%;border-radius:inherit}tui-files .t-bottom{z-index:3;inline-size:100%;background:var(--tui-background-base);-webkit-mask:none!important;mask:none!important}tui-files .t-bottom_collapsed{box-shadow:var(--tui-shadow-popup);margin-block-start:-1.5rem}tui-files .t-extra-items{inline-size:100%}tui-files .t-extra-items>*{border-radius:0!important}\n"] }]
        }], propDecorators: { items: [{
                type: ContentChildren,
                args: [TuiItem, { read: TemplateRef }]
            }], max: [{
                type: Input
            }], expanded: [{
                type: Input
            }], expandedChange: [{
                type: Output
            }] } });
//# sourceMappingURL=data:application/json;base64, 