import { CommonModule } from '@angular/common';
import { EventEmitter, Input, Output, HostBinding, HostListener, Component, ViewEncapsulation, NgModule } from '@angular/core';
import { trigger, transition } from '@angular/animations';
import { coerceBooleanProperty } from '@angular/cdk/coercion';
import { fadeOut } from '@ng-tangram/components/core';

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;
};
var NtCalloutComponent = (function () {
    function NtCalloutComponent() {
        this.title = '';
        this.color = 'primary';
        this.size = 'medium';
        this.class = '';
        this._closed = false;
        this.close = new EventEmitter();
        this.fadeOut = false;
    }
    Object.defineProperty(NtCalloutComponent.prototype, "closed", {
        get: function () { return this._closed; },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(NtCalloutComponent.prototype, "closable", {
        get: function () { return this._closable; },
        set: function (value) { this._closable = coerceBooleanProperty(value); },
        enumerable: true,
        configurable: true
    });
    NtCalloutComponent.prototype.onAnimationDone = function (event) {
        if (event.toState) {
            this._closed = true;
        }
    };
    NtCalloutComponent.prototype._close = function () {
        if (!this.fadeOut) {
            this.fadeOut = true;
            this.close.emit();
        }
    };
    __decorate([
        Input()
    ], NtCalloutComponent.prototype, "title", void 0);
    __decorate([
        Input()
    ], NtCalloutComponent.prototype, "color", void 0);
    __decorate([
        Input()
    ], NtCalloutComponent.prototype, "size", void 0);
    __decorate([
        Input()
    ], NtCalloutComponent.prototype, "class", void 0);
    __decorate([
        Input()
    ], NtCalloutComponent.prototype, "closable", null);
    __decorate([
        Output()
    ], NtCalloutComponent.prototype, "close", void 0);
    __decorate([
        HostBinding('@fadeOut')
    ], NtCalloutComponent.prototype, "fadeOut", void 0);
    __decorate([
        HostListener('@fadeOut.done', ['$event'])
    ], NtCalloutComponent.prototype, "onAnimationDone", null);
    NtCalloutComponent = __decorate([
        Component({
            selector: 'nt-callout',
            template: "\n    <h3 *ngIf=\"title\">{{title}}</h3>\n    <ng-content></ng-content>\n    <button *ngIf=\"this.closable\" (click)=\"_close()\" class=\"close-button\" type=\"button\">\n      <span aria-hidden=\"true\">&times;</span>\n    </button>\n  ",
            encapsulation: ViewEncapsulation.None,
            animations: [
                trigger('fadeOut', [
                    transition('* => true', fadeOut(.3))
                ])
            ],
            host: {
                '[class]': '["callout nt-callout", color || "primary", size, class].join(" ")',
                '[class.closed]': 'closed'
            }
        })
    ], NtCalloutComponent);
    return NtCalloutComponent;
}());

var __decorate$1 = (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;
};
var NtCalloutModule = (function () {
    function NtCalloutModule() {
    }
    NtCalloutModule = __decorate$1([
        NgModule({
            imports: [CommonModule],
            exports: [NtCalloutComponent],
            declarations: [NtCalloutComponent],
        })
    ], NtCalloutModule);
    return NtCalloutModule;
}());

export { NtCalloutComponent, NtCalloutModule };
//# sourceMappingURL=callout.js.map
