import { Component, HostBinding, Input } from '@angular/core';
import { AbstractButton } from './abstract-button';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "@angular/router";
import * as i3 from "@aztrix/icons";
import * as i4 from "@aztrix/components/spinner";
import * as i5 from "./button.directive";
export class ButtonComponent extends AbstractButton {
    constructor() {
        super(...arguments);
        this.pointerEvents = 'auto';
    }
    ngOnChanges(changes) {
        if (changes.disabled !== undefined || changes.loading !== undefined) {
            this.pointerEvents = this.disabled || this._loading ? 'none' : 'auto';
        }
    }
    get routerLink() {
        if (this.url?.includes('https://') || this.url?.includes('http://')) {
            return undefined;
        }
        else {
            return this.url;
        }
    }
    get href() {
        if (this.url?.includes('https://') || this.url?.includes('http://')) {
            return this.url;
        }
        else {
            return undefined;
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ButtonComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: ButtonComponent, selector: "ax-button", inputs: { url: "url", ariaLabel: "ariaLabel", target: "target" }, host: { properties: { "style.pointer-events": "this.pointerEvents" } }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<ng-template #content>\n  <ax-icon *ngIf=\"icon && !_loading\" [name]=\"icon\" class=\"icon\"></ax-icon>\n  <ax-spinner class=\"button-spinner\" *ngIf=\"_loading\"></ax-spinner>\n  <ng-content></ng-content>\n</ng-template>\n\n<a\n  *ngIf=\"href\"\n  axButton\n  [attr.type]=\"type\"\n  [color]=\"color\"\n  [hover]=\"hover\"\n  [labelHideMobile]=\"_labelHideMobile\"\n  [smallButton]=\"_smallButton\"\n  [fullWidth]=\"_fullWidth\"\n  [filled]=\"_filled\"\n  [outline]=\"_outline\"\n  [icon-button]=\"_iconButton\"\n  [hover]=\"_hover\"\n  [hoverLabel]=\"_hoverLabel\"\n  [lowercase]=\"_lowercase\"\n  [disabled]=\"disabled || _loading\"\n  [attr.href]=\"url\"\n  [attr.aria-label]=\"ariaLabel\"\n  [attr.target]=\"target\"\n>\n  <ng-container [ngTemplateOutlet]=\"content\"></ng-container>\n</a>\n\n<a\n  *ngIf=\"routerLink\"\n  axButton\n  [attr.type]=\"type\"\n  [color]=\"color\"\n  [hover]=\"hover\"\n  [labelHideMobile]=\"_labelHideMobile\"\n  [smallButton]=\"_smallButton\"\n  [fullWidth]=\"_fullWidth\"\n  [filled]=\"_filled\"\n  [outline]=\"_outline\"\n  [icon-button]=\"_iconButton\"\n  [hover]=\"_hover\"\n  [hoverLabel]=\"_hoverLabel\"\n  [lowercase]=\"_lowercase\"\n  [disabled]=\"disabled || _loading\"\n  [routerLink]=\"routerLink\"\n  [attr.aria-label]=\"ariaLabel\"\n>\n  <ng-container [ngTemplateOutlet]=\"content\"></ng-container>\n</a>\n\n<button\n  *ngIf=\"!url\"\n  axButton\n  [attr.type]=\"type\"\n  [color]=\"color\"\n  [hover]=\"hover\"\n  [labelHideMobile]=\"_labelHideMobile\"\n  [smallButton]=\"_smallButton\"\n  [fullWidth]=\"_fullWidth\"\n  [filled]=\"_filled\"\n  [outline]=\"_outline\"\n  [icon-button]=\"_iconButton\"\n  [hover]=\"_hover\"\n  [hoverLabel]=\"_hoverLabel\"\n  [lowercase]=\"_lowercase\"\n  [disabled]=\"disabled || _loading\"\n  [attr.aria-label]=\"ariaLabel\"\n>\n  <ng-container [ngTemplateOutlet]=\"content\"></ng-container>\n</button>\n", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: i3.IconComponent, selector: "ax-icon", inputs: ["name", "inline"] }, { kind: "component", type: i4.SpinnerComponent, selector: "ax-spinner" }, { kind: "directive", type: i5.ButtonDirective, selector: "[axButton]", inputs: ["color", "labelHideMobile", "smallButton", "bigButton", "fullWidth", "filled", "outline", "icon-button", "hoverLabel", "hover", "lowercase", "disabled"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ButtonComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ax-button', template: "<ng-template #content>\n  <ax-icon *ngIf=\"icon && !_loading\" [name]=\"icon\" class=\"icon\"></ax-icon>\n  <ax-spinner class=\"button-spinner\" *ngIf=\"_loading\"></ax-spinner>\n  <ng-content></ng-content>\n</ng-template>\n\n<a\n  *ngIf=\"href\"\n  axButton\n  [attr.type]=\"type\"\n  [color]=\"color\"\n  [hover]=\"hover\"\n  [labelHideMobile]=\"_labelHideMobile\"\n  [smallButton]=\"_smallButton\"\n  [fullWidth]=\"_fullWidth\"\n  [filled]=\"_filled\"\n  [outline]=\"_outline\"\n  [icon-button]=\"_iconButton\"\n  [hover]=\"_hover\"\n  [hoverLabel]=\"_hoverLabel\"\n  [lowercase]=\"_lowercase\"\n  [disabled]=\"disabled || _loading\"\n  [attr.href]=\"url\"\n  [attr.aria-label]=\"ariaLabel\"\n  [attr.target]=\"target\"\n>\n  <ng-container [ngTemplateOutlet]=\"content\"></ng-container>\n</a>\n\n<a\n  *ngIf=\"routerLink\"\n  axButton\n  [attr.type]=\"type\"\n  [color]=\"color\"\n  [hover]=\"hover\"\n  [labelHideMobile]=\"_labelHideMobile\"\n  [smallButton]=\"_smallButton\"\n  [fullWidth]=\"_fullWidth\"\n  [filled]=\"_filled\"\n  [outline]=\"_outline\"\n  [icon-button]=\"_iconButton\"\n  [hover]=\"_hover\"\n  [hoverLabel]=\"_hoverLabel\"\n  [lowercase]=\"_lowercase\"\n  [disabled]=\"disabled || _loading\"\n  [routerLink]=\"routerLink\"\n  [attr.aria-label]=\"ariaLabel\"\n>\n  <ng-container [ngTemplateOutlet]=\"content\"></ng-container>\n</a>\n\n<button\n  *ngIf=\"!url\"\n  axButton\n  [attr.type]=\"type\"\n  [color]=\"color\"\n  [hover]=\"hover\"\n  [labelHideMobile]=\"_labelHideMobile\"\n  [smallButton]=\"_smallButton\"\n  [fullWidth]=\"_fullWidth\"\n  [filled]=\"_filled\"\n  [outline]=\"_outline\"\n  [icon-button]=\"_iconButton\"\n  [hover]=\"_hover\"\n  [hoverLabel]=\"_hoverLabel\"\n  [lowercase]=\"_lowercase\"\n  [disabled]=\"disabled || _loading\"\n  [attr.aria-label]=\"ariaLabel\"\n>\n  <ng-container [ngTemplateOutlet]=\"content\"></ng-container>\n</button>\n" }]
        }], propDecorators: { url: [{
                type: Input
            }], ariaLabel: [{
                type: Input
            }], target: [{
                type: Input
            }], pointerEvents: [{
                type: HostBinding,
                args: ['style.pointer-events']
            }] } });
//# sourceMappingURL=data:application/json;base64, 