import * as i0 from '@angular/core';
import { Component, Input, ViewChild, ContentChildren, NgModule } from '@angular/core';
import * as i2 from '@angular/material/legacy-menu';
import { MatLegacyMenuItem, MatLegacyMenuModule } from '@angular/material/legacy-menu';
import * as i1 from '@angular/common';
import { CommonModule } from '@angular/common';
import * as i3 from '@aztrix/components/button';
import { ButtonModule } from '@aztrix/components/button';
import * as i4 from '@aztrix/icons';
import { IconsModule } from '@aztrix/icons';

class MenuButtonComponent {
    constructor() {
        this.icon = 'dots-vertical';
        this.outline = false;
        this.filled = false;
        this.hasItems = false;
        this.iconButton = true;
        this.fullWidth = false;
        this.bigButton = false;
        this._open = false;
    }
    get _hasItems() {
        var _a;
        return ((_a = this.menuItems) === null || _a === void 0 ? void 0 : _a.length) || this.hasItems;
    }
    get panelWidth() {
        var _a;
        return (_a = this.triggerButton) === null || _a === void 0 ? void 0 : _a.nativeElement.clientWidth;
    }
}
MenuButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: MenuButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
MenuButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.5", type: MenuButtonComponent, selector: "ax-menu-button", inputs: { icon: "icon", outline: "outline", filled: "filled", hasItems: "hasItems", iconButton: "iconButton", fullWidth: "fullWidth", bigButton: "bigButton", color: "color" }, queries: [{ propertyName: "menuItems", predicate: MatLegacyMenuItem }], viewQueries: [{ propertyName: "triggerButton", first: true, predicate: ["triggerButton"], descendants: true }], ngImport: i0, template: "<mat-menu #menu=\"matMenu\" [classList]=\"fullWidth ? 'menu-panel-equal-width' : null\">\n  <div [style.width.px]=\"panelWidth\">\n    <ng-content></ng-content>\n  </div>\n</mat-menu>\n\n<button\n  #triggerButton\n  *ngIf=\"_hasItems\"\n  axButton\n  class=\"menu-button cy-menu\"\n  [icon-button]=\"iconButton\"\n  [fullWidth]=\"fullWidth$ | async\"\n  [ngClass]=\"{open: _open}\"\n  [outline]=\"outline\"\n  [filled]=\"filled\"\n  [bigButton]=\"bigButton\"\n  [color]=\"color\"\n  [matMenuTriggerFor]=\"menu\"\n  (menuOpened)=\"_open = true\"\n  (menuClosed)=\"_open = false\"\n>\n  <ax-icon class=\"icon\" [name]=\"icon\"></ax-icon>\n  <ng-content select=\".menu-label\"></ng-content>\n</button>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.MatLegacyMenu, selector: "mat-menu", exportAs: ["matMenu"] }, { kind: "directive", type: i2.MatLegacyMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", exportAs: ["matMenuTrigger"] }, { kind: "directive", type: i3.ButtonDirective, selector: "[axButton]", inputs: ["color", "labelHideMobile", "smallButton", "bigButton", "fullWidth", "filled", "outline", "icon-button", "hoverLabel", "hover", "lowercase", "disabled"] }, { kind: "component", type: i4.IconComponent, selector: "ax-icon", inputs: ["name", "inline"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: MenuButtonComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ax-menu-button', template: "<mat-menu #menu=\"matMenu\" [classList]=\"fullWidth ? 'menu-panel-equal-width' : null\">\n  <div [style.width.px]=\"panelWidth\">\n    <ng-content></ng-content>\n  </div>\n</mat-menu>\n\n<button\n  #triggerButton\n  *ngIf=\"_hasItems\"\n  axButton\n  class=\"menu-button cy-menu\"\n  [icon-button]=\"iconButton\"\n  [fullWidth]=\"fullWidth$ | async\"\n  [ngClass]=\"{open: _open}\"\n  [outline]=\"outline\"\n  [filled]=\"filled\"\n  [bigButton]=\"bigButton\"\n  [color]=\"color\"\n  [matMenuTriggerFor]=\"menu\"\n  (menuOpened)=\"_open = true\"\n  (menuClosed)=\"_open = false\"\n>\n  <ax-icon class=\"icon\" [name]=\"icon\"></ax-icon>\n  <ng-content select=\".menu-label\"></ng-content>\n</button>\n" }]
        }], propDecorators: { icon: [{
                type: Input
            }], outline: [{
                type: Input
            }], filled: [{
                type: Input
            }], hasItems: [{
                type: Input
            }], iconButton: [{
                type: Input
            }], fullWidth: [{
                type: Input
            }], bigButton: [{
                type: Input
            }], color: [{
                type: Input
            }], triggerButton: [{
                type: ViewChild,
                args: ['triggerButton']
            }], menuItems: [{
                type: ContentChildren,
                args: [MatLegacyMenuItem]
            }] } });

class MenuButtonModule {
}
MenuButtonModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: MenuButtonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
MenuButtonModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.5", ngImport: i0, type: MenuButtonModule, declarations: [MenuButtonComponent], imports: [CommonModule, MatLegacyMenuModule, ButtonModule, IconsModule], exports: [MenuButtonComponent, MatLegacyMenuModule] });
MenuButtonModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: MenuButtonModule, imports: [CommonModule, MatLegacyMenuModule, ButtonModule, IconsModule, MatLegacyMenuModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: MenuButtonModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [CommonModule, MatLegacyMenuModule, ButtonModule, IconsModule],
                    declarations: [MenuButtonComponent],
                    exports: [MenuButtonComponent, MatLegacyMenuModule],
                }]
        }] });

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

export { MenuButtonComponent, MenuButtonModule };
//# sourceMappingURL=aztrix-components-menu-button.mjs.map
//# sourceMappingURL=aztrix-components-menu-button.mjs.map
