text: import { ElementRef, Input, Directive, EventEmitter, Output, Component, ChangeDetectionStrategy, NgModule } from '@angular/core';
  import { DomHandler } from 'primeng/dom';
  import { CommonModule } from '@angular/common';
  
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
      var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
      if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
      else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
      return c > 3 && r && Object.defineProperty(target, key, r), r;
  };
  let ButtonDirective = class ButtonDirective {
      constructor(el) {
          this.el = el;
          this.iconPos = 'left';
          this.cornerStyleClass = 'ui-corner-all';
      }
      ngAfterViewInit() {
          DomHandler.addMultipleClasses(this.el.nativeElement, this.getStyleClass());
          if (this.icon) {
              let iconElement = document.createElement("span");
              iconElement.setAttribute("aria-hidden", "true");
              let iconPosClass = (this.iconPos == 'right') ? 'ui-button-icon-right' : 'ui-button-icon-left';
              iconElement.className = iconPosClass + ' ui-clickable ' + this.icon;
              this.el.nativeElement.appendChild(iconElement);
          }
          let labelElement = document.createElement("span");
          if (this.icon && !this.label) {
              labelElement.setAttribute('aria-hidden', 'true');
          }
          labelElement.className = 'ui-button-text ui-clickable';
          labelElement.appendChild(document.createTextNode(this.label || 'ui-btn'));
          this.el.nativeElement.appendChild(labelElement);
          this.initialized = true;
      }
      getStyleClass() {
          let styleClass = 'ui-button ui-widget ui-state-default ' + this.cornerStyleClass;
          if (this.icon) {
              if (this.label != null && this.label != undefined) {
                  if (this.iconPos == 'left')
                      styleClass = styleClass + ' ui-button-text-icon-left';
                  else
                      styleClass = styleClass + ' ui-button-text-icon-right';
              }
              else {
                  styleClass = styleClass + ' ui-button-icon-only';
              }
          }
          else {
              if (this.label) {
                  styleClass = styleClass + ' ui-button-text-only';
              }
              else {
                  styleClass = styleClass + ' ui-button-text-empty';
              }
          }
          return styleClass;
      }
      get label() {
          return this._label;
      }
      set label(val) {
          this._label = val;
          if (this.initialized) {
              DomHandler.findSingle(this.el.nativeElement, '.ui-button-text').textContent = this._label;
              if (!this.icon) {
                  if (this._label) {
                      DomHandler.removeClass(this.el.nativeElement, 'ui-button-text-empty');
                      DomHandler.addClass(this.el.nativeElement, 'ui-button-text-only');
                  }
                  else {
                      DomHandler.addClass(this.el.nativeElement, 'ui-button-text-empty');
                      DomHandler.removeClass(this.el.nativeElement, 'ui-button-text-only');
                  }
              }
          }
      }
      get icon() {
          return this._icon;
      }
      set icon(val) {
          this._icon = val;
          if (this.initialized) {
              let iconPosClass = (this.iconPos == 'right') ? 'ui-button-icon-right' : 'ui-button-icon-left';
              DomHandler.findSingle(this.el.nativeElement, '.ui-clickable').className =
                  iconPosClass + ' ui-clickable ' + this.icon;
          }
      }
      ngOnDestroy() {
          while (this.el.nativeElement.hasChildNodes()) {
              this.el.nativeElement.removeChild(this.el.nativeElement.lastChild);
          }
          this.initialized = false;
      }
  };
  ButtonDirective.ctorParameters = () => [
      { type: ElementRef }
  ];
  __decorate([
      Input()
  ], ButtonDirective.prototype, "iconPos", void 0);
  __decorate([
      Input()
  ], ButtonDirective.prototype, "cornerStyleClass", void 0);
  __decorate([
      Input()
  ], ButtonDirective.prototype, "label", null);
  __decorate([
      Input()
  ], ButtonDirective.prototype, "icon", null);
  ButtonDirective = __decorate([
      Directive({
          selector: '[pButton]'
      })
  ], ButtonDirective);
  let Button = class Button {
      constructor() {
          this.iconPos = 'left';
          this.onClick = new EventEmitter();
          this.onFocus = new EventEmitter();
          this.onBlur = new EventEmitter();
      }
  };
  __decorate([
      Input()
  ], Button.prototype, "type", void 0);
  __decorate([
      Input()
  ], Button.prototype, "iconPos", void 0);
  __decorate([
      Input()
  ], Button.prototype, "icon", void 0);
  __decorate([
      Input()
  ], Button.prototype, "label", void 0);
  __decorate([
      Input()
  ], Button.prototype, "disabled", void 0);
  __decorate([
      Input()
  ], Button.prototype, "style", void 0);
  __decorate([
      Input()
  ], Button.prototype, "styleClass", void 0);
  __decorate([
      Output()
  ], Button.prototype, "onClick", void 0);
  __decorate([
      Output()
  ], Button.prototype, "onFocus", void 0);
  __decorate([
      Output()
  ], Button.prototype, "onBlur", void 0);
  Button = __decorate([
      Component({
          selector: 'p-button',
          template: `
          <button [attr.type]="type" [class]="styleClass" [ngStyle]="style" [disabled]="disabled"
              [ngClass]="{'ui-button ui-widget ui-state-default ui-corner-all':true,
                          'ui-button-icon-only': (icon && !label),
                          'ui-button-text-icon-left': (icon && label && iconPos === 'left'),
                          'ui-button-text-icon-right': (icon && label && iconPos === 'right'),
                          'ui-button-text-only': (!icon && label),
                          'ui-button-text-empty': (!icon && !label),
                          'ui-state-disabled': disabled}"
                          (click)="onClick.emit($event)" (focus)="onFocus.emit($event)" (blur)="onBlur.emit($event)">
              <ng-content></ng-content>
              <span [ngClass]="{'ui-clickable': true,
                          'ui-button-icon-left': (iconPos === 'left'), 
                          'ui-button-icon-right': (iconPos === 'right')}"
                          [class]="icon" *ngIf="icon" [attr.aria-hidden]="true"></span>
              <span class="ui-button-text ui-clickable" [attr.aria-hidden]="icon && !label">{{label||'ui-btn'}}</span>
          </button>
      `,
          changeDetection: ChangeDetectionStrategy.Default
      })
  ], Button);
  let ButtonModule = class ButtonModule {
  };
  ButtonModule = __decorate([
      NgModule({
          imports: [CommonModule],
          exports: [ButtonDirective, Button],
          declarations: [ButtonDirective, Button]
      })
  ], ButtonModule);
  
  /**
   * Generated bundle index. Do not edit.
   */
  
  export { Button, ButtonDirective, ButtonModule };
  //# sourceMappingURL=primeng-button.js.map
  