import { Component, ContentChildren, ElementRef, Input, QueryList, ViewChild } from '@angular/core';
import { MatLegacyMenuItem as MatMenuItem } from '@angular/material/legacy-menu';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "@angular/material/legacy-menu";
import * as i3 from "@aztrix/components/button";
import * as i4 from "@aztrix/icons";
export 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() {
        return this.menuItems?.length || this.hasItems;
    }
    get panelWidth() {
        return this.triggerButton?.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: MatMenuItem }], 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: [MatMenuItem]
            }] } });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWVudS1idXR0b24uY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vbGlicy9jb21wb25lbnRzL21lbnUtYnV0dG9uL21lbnUtYnV0dG9uLmNvbXBvbmVudC50cyIsIi4uLy4uLy4uLy4uLy4uL2xpYnMvY29tcG9uZW50cy9tZW51LWJ1dHRvbi9tZW51LWJ1dHRvbi5jb21wb25lbnQuaHRtbCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUMsU0FBUyxFQUFFLGVBQWUsRUFBRSxVQUFVLEVBQUUsS0FBSyxFQUFFLFNBQVMsRUFBRSxTQUFTLEVBQUMsTUFBTSxlQUFlLENBQUM7QUFDbEcsT0FBTyxFQUFDLGlCQUFpQixJQUFJLFdBQVcsRUFBQyxNQUFNLCtCQUErQixDQUFDOzs7Ozs7QUFPL0UsTUFBTSxPQUFPLG1CQUFtQjtJQUxoQztRQU1XLFNBQUksR0FBRyxlQUFlLENBQUM7UUFDdkIsWUFBTyxHQUFHLEtBQUssQ0FBQztRQUNoQixXQUFNLEdBQUcsS0FBSyxDQUFDO1FBQ2YsYUFBUSxHQUFHLEtBQUssQ0FBQztRQUNqQixlQUFVLEdBQUcsSUFBSSxDQUFDO1FBQ2xCLGNBQVMsR0FBRyxLQUFLLENBQUM7UUFDbEIsY0FBUyxHQUFHLEtBQUssQ0FBQztRQUszQixVQUFLLEdBQUcsS0FBSyxDQUFDO0tBV2Y7SU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