text: import { Directive, Input, Output, EventEmitter, ElementRef } from '@angular/core';
  import { NgbDropdownConfig } from './dropdown-config';
  /**
   * Transforms a node into a dropdown.
   */
  export var NgbDropdown = (function () {
      function NgbDropdown(config) {
          /**
           *  Defines whether or not the dropdown-menu is open initially.
           */
          this._open = false;
          /**
           *  An event fired when the dropdown is opened or closed.
           *  Event's payload equals whether dropdown is open.
           */
          this.openChange = new EventEmitter();
          this.up = config.up;
          this.autoClose = config.autoClose;
      }
      /**
       * Checks if the dropdown menu is open or not.
       */
      NgbDropdown.prototype.isOpen = function () { return this._open; };
      /**
       * Opens the dropdown menu of a given navbar or tabbed navigation.
       */
      NgbDropdown.prototype.open = function () {
          if (!this._open) {
              this._open = true;
              this.openChange.emit(true);
          }
      };
      /**
       * Closes the dropdown menu of a given navbar or tabbed navigation.
       */
      NgbDropdown.prototype.close = function () {
          if (this._open) {
              this._open = false;
              this.openChange.emit(false);
          }
      };
      /**
       * Toggles the dropdown menu of a given navbar or tabbed navigation.
       */
      NgbDropdown.prototype.toggle = function () {
          if (this.isOpen()) {
              this.close();
          }
          else {
              this.open();
          }
      };
      NgbDropdown.prototype.closeFromOutsideClick = function ($event) {
          if (this.autoClose && !this._isEventFromToggle($event)) {
              this.close();
          }
      };
      NgbDropdown.prototype.closeFromOutsideEsc = function () {
          if (this.autoClose) {
              this.close();
          }
      };
      Object.defineProperty(NgbDropdown.prototype, "toggleElement", {
          /**
           * @internal
           */
          set: function (toggleElement) { this._toggleElement = toggleElement; },
          enumerable: true,
          configurable: true
      });
      NgbDropdown.prototype._isEventFromToggle = function ($event) { return !!this._toggleElement && this._toggleElement.contains($event.target); };
      NgbDropdown.decorators = [
          { type: Directive, args: [{
                      selector: '[ngbDropdown]',
                      exportAs: 'ngbDropdown',
                      host: {
                          '[class.dropdown]': '!up',
                          '[class.dropup]': 'up',
                          '[class.show]': 'isOpen()',
                          '(keyup.esc)': 'closeFromOutsideEsc()',
                          '(document:click)': 'closeFromOutsideClick($event)'
                      }
                  },] },
      ];
      /** @nocollapse */
      NgbDropdown.ctorParameters = [
          { type: NgbDropdownConfig, },
      ];
      NgbDropdown.propDecorators = {
          'up': [{ type: Input },],
          'autoClose': [{ type: Input },],
          '_open': [{ type: Input, args: ['open',] },],
          'openChange': [{ type: Output },],
      };
      return NgbDropdown;
  }());
  /**
   * Allows the dropdown to be toggled via click. This directive is optional.
   */
  export var NgbDropdownToggle = (function () {
      function NgbDropdownToggle(dropdown, elementRef) {
          this.dropdown = dropdown;
          dropdown.toggleElement = elementRef.nativeElement;
      }
      NgbDropdownToggle.prototype.toggleOpen = function () { this.dropdown.toggle(); };
      NgbDropdownToggle.decorators = [
          { type: Directive, args: [{
                      selector: '[ngbDropdownToggle]',
                      host: {
                          'class': 'dropdown-toggle',
                          'aria-haspopup': 'true',
                          '[attr.aria-expanded]': 'dropdown.isOpen()',
                          '(click)': 'toggleOpen()'
                      }
                  },] },
      ];
      /** @nocollapse */
      NgbDropdownToggle.ctorParameters = [
          { type: NgbDropdown, },
          { type: ElementRef, },
      ];
      return NgbDropdownToggle;
  }());
  //# sourceMappingURL=dropdown.js.map