/**
 *
 * carbon-angular v0.0.0 | toast.component.js
 *
 * Copyright 2014, 2020 IBM
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0

 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


var __extends = (this && this.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
import { Component, Input, HostBinding } from "@angular/core";
import { Notification } from "./notification.component";
import { ExperimentalService } from "./../experimental.module";
import { NotificationDisplayService } from "./notification-display.service";
import { I18n } from "./../i18n/i18n.module";
/**
 * Toast messages are displayed toward the top of the UI and do not interrupt user’s work.
 *
 * [See demo](../../?path=/story/notification--toast)
 *
 * <example-url>../../iframe.html?id=notification--toast</example-url>
 */
var Toast = /** @class */ (function (_super) {
    __extends(Toast, _super);
    function Toast(notificationDisplayService, i18n, experimental) {
        var _this = _super.call(this, notificationDisplayService, i18n) || this;
        _this.notificationDisplayService = notificationDisplayService;
        _this.i18n = i18n;
        _this.experimental = experimental;
        _this.toastID = "toast-" + Toast.toastCount++;
        _this.toastClass = true;
        _this.role = "alert";
        // disable inline notification styles
        _this.notificationClass = false;
        return _this;
    }
    Object.defineProperty(Toast.prototype, "isError", {
        get: function () { return this.notificationObj["type"] === "error"; },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Toast.prototype, "isInfo", {
        get: function () { return this.notificationObj["type"] === "info"; },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Toast.prototype, "isSuccess", {
        get: function () { return this.notificationObj["type"] === "success"; },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Toast.prototype, "isWarning", {
        get: function () { return this.notificationObj["type"] === "warning"; },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Toast.prototype, "isLowContrast", {
        get: function () { return this.notificationObj.lowContrast; },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Toast.prototype, "isExperimental", {
        get: function () {
            return this.experimental.isExperimental;
        },
        enumerable: true,
        configurable: true
    });
    Toast.prototype.ngOnInit = function () {
        if (!this.notificationObj.closeLabel) {
            this.notificationObj.closeLabel = this.i18n.get().NOTIFICATION.CLOSE_BUTTON;
        }
    };
    Toast.toastCount = 0;
    Toast.decorators = [
        { type: Component, args: [{
                    selector: "ibm-toast",
                    template: "\n\t\t<ibm-icon-error-filled16\n\t\t\t*ngIf=\"notificationObj.type === 'error'\"\n\t\t\tclass=\"bx--toast-notification__icon\">\n\t\t</ibm-icon-error-filled16>\n\t\t<ibm-icon-warning-filled16\n\t\t\t*ngIf=\"notificationObj.type === 'warning'\"\n\t\t\tclass=\"bx--toast-notification__icon\">\n\t\t</ibm-icon-warning-filled16>\n\t\t<ibm-icon-checkmark-filled16\n\t\t\t*ngIf=\"notificationObj.type === 'success'\"\n\t\t\tclass=\"bx--toast-notification__icon\">\n\t\t</ibm-icon-checkmark-filled16>\n\t\t<div class=\"bx--toast-notification__details\">\n\t\t\t<h3 ibmToastTitle [innerHTML]=\"notificationObj.title\"></h3>\n\t\t\t<p ibmToastSubtitle [innerHTML]=\"notificationObj.subtitle\"></p>\n\t\t\t<p ibmToastCaption [innerHTML]=\"notificationObj.caption\"></p>\n\t\t\t<ng-container *ngTemplateOutlet=\"notificationObj.template\"></ng-container>\n\t\t</div>\n\t\t<button\n\t\t\t*ngIf=\"showClose\"\n\t\t\tclass=\"bx--toast-notification__close-button\"\n\t\t\ttype=\"button\"\n\t\t\t[attr.aria-label]=\"notificationObj.closeLabel\"\n\t\t\t(click)=\"onClose()\">\n\t\t\t<ibm-icon-close16 class=\"bx--toast-notification__close-icon\"></ibm-icon-close16>\n\t\t</button>\n\t"
                },] },
    ];
    /** @nocollapse */
    Toast.ctorParameters = function () { return [
        { type: NotificationDisplayService },
        { type: I18n },
        { type: ExperimentalService }
    ]; };
    Toast.propDecorators = {
        notificationObj: [{ type: Input }],
        toastID: [{ type: HostBinding, args: ["attr.id",] }],
        toastClass: [{ type: HostBinding, args: ["class.bx--toast-notification",] }],
        role: [{ type: HostBinding, args: ["attr.role",] }],
        isError: [{ type: HostBinding, args: ["class.bx--toast-notification--error",] }],
        isInfo: [{ type: HostBinding, args: ["class.bx--toast-notification--info",] }],
        isSuccess: [{ type: HostBinding, args: ["class.bx--toast-notification--success",] }],
        isWarning: [{ type: HostBinding, args: ["class.bx--toast-notification--warning",] }],
        isLowContrast: [{ type: HostBinding, args: ["class.bx--toast-notification--low-contrast",] }]
    };
    return Toast;
}(Notification));
export { Toast };
//# sourceMappingURL=toast.component.js.map