/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes} checked by tsc
 */
import { animate, state, style, transition, trigger } from '@angular/animations';
import { CommonModule } from '@angular/common';
import { Component, ElementRef, EventEmitter, HostBinding, Input, NgModule, Optional, Output } from '@angular/core';
import { IgxNavigationService } from '../core/navigation';
var /** @type {?} */ NEXT_ID = 0;
/**
 * **Ignite UI for Angular Toast** -
 * [Documentation](https://www.infragistics.com/products/ignite-ui-angular/angular/components/toast.html)
 *
 * The Ignite UI Toast provides information and warning messages that are non-interactive and cannot
 * be dismissed by the user. Toasts can be displayed at the bottom, middle, or top of the page.
 *
 * Example:
 * ```html
 * <button (click)="toast.show()">Show notification</button>
 * <igx-toast #toast
 *           message="Notification displayed"
 *           displayTime="1000">
 * </igx-toast>
 * ```
 */
var IgxToastComponent = /** @class */ (function () {
    function IgxToastComponent(elementRef, navService) {
        this.elementRef = elementRef;
        this.navService = navService;
        /**
         * Returns a list of available CSS classes.
         * ```typescript
         * let toastClasses =  this.toast.CSS_CLASSES;
         * ```
         * \@memberof IgxToastComponent
         */
        this.CSS_CLASSES = {
            IGX_TOAST_BOTTOM: 'igx-toast--bottom',
            IGX_TOAST_MIDDLE: 'igx-toast--middle',
            IGX_TOAST_TOP: 'igx-toast--top'
        };
        /**
         * Sets/gets the `id` of the toast.
         * If not set, the `id` will have value `"igx-toast-0"`.
         * ```html
         * <igx-toast id = "my-first-toast"></igx-toast>
         * ```
         * ```typescript
         * let toastId = this.toast.id;
         * ```
         */
        this.id = "igx-toast-" + NEXT_ID++;
        /**
         * Emits an event prior the toast is shown.
         * Provides reference to the `IgxToastComponent` as event argument.
         * ```html
         * <igx-toast (onShowing) = "onShowing($event)"></igx-toast>
         * ```
         * \@memberof IgxToastComponent
         */
        this.onShowing = new EventEmitter();
        /**
         * Emits an event when the toast is shown.
         * Provides reference to the `IgxToastComponent` as event argument.
         * ```html
         * <igx-toast (onShown) = "onShown($event)"></igx-toast>
         * ```
         * \@memberof IgxToastComponent
         */
        this.onShown = new EventEmitter();
        /**
         * Emits an event prior the toast is hidden.
         * Provides reference to the `IgxToastComponent` as event argument.
         * ```html
         * <igx-toast (onHiding) = "onHiding($event)"></igx-toast>
         * ```
         * \@memberof IgxToastComponent
         */
        this.onHiding = new EventEmitter();
        /**
         *  Emits an event when the toast is hidden.
         *  Provides reference to the `IgxToastComponent` as event argument.
         * ```html
         * <igx-toast (onHidden) = "onHidden($event)"></igx-toast>
         * ```
         * \@memberof IgxToastComponent
         */
        this.onHidden = new EventEmitter();
        /**
         * Sets/gets the `role` attribute.
         * If not set, `role` will have value `"alert"`.
         * ```html
         * <igx-toast [role] = "'notify'"></igx-toast>
         * ```
         * ```typescript
         * let toastRole = this.toast.role;
         * ```
         * \@memberof IgxToastComponent
         */
        this.role = 'alert';
        /**
         * Sets/gets whether the toast will be hidden after the `displayTime` is over.
         * Default value is `true`.
         * ```html
         * <igx-toast [autoHide] = "false"></igx-toast>
         * ```
         * ```typescript
         * let autoHide = this.toast.autoHide;
         * ```
         * \@memberof IgxToastComponent
         */
        this.autoHide = true;
        /**
         * Sets/gets the duration of time span(in milliseconds) which the toast will be visible
         * after it is being shown.
         * Default value is `4000`.
         * ```html
         * <igx-toast [displayTime] = "2500"></igx-toast>
         * ```
         * ```typescript
         * let displayTime = this.toast.displayTime;
         * ```
         * \@memberof IgxToastComponent
         */
        this.displayTime = 4000;
        /**
         * Enables/Disables the visibility of the toast.
         * If not set, the `isVisible` attribute will have value `false`.
         * ```html
         * <igx-toast [isVisible] = "true"></igx-toast>
         * ```
         * ```typescript
         * let isVisible = this.toast.isVisible;
         * ```
         * \@memberof IgxToastComponent
         */
        this.isVisible = false;
        /**
         * Sets/gets the position of the toast.
         * If not set, the `position` attribute will have value `IgxToastPosition.Bottom`.
         * ```html
         * <igx-toast [position] = "top"></igx-toast>
         * ```
         * ```typescript
         * let toastPosition = this.toast.position;
         * ```
         * \@memberof IgxToastComponent
         */
        this.position = IgxToastPosition.Bottom;
    }
    Object.defineProperty(IgxToastComponent.prototype, "element", {
        get: /**
         * Gets the nativeElement of the toast.
         * ```typescript
         * let nativeElement = this.toast.element;
         * ```
         * \@memberof IgxToastComponent
         * @return {?}
         */
        function () {
            return this.elementRef.nativeElement;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * Shows the toast.
     * If `autoHide` is enabled, the toast will hide after `displayTime` is over.
     * ```typescript
     * this.toast.show();
     * ```
     * \@memberof IgxToastComponent
     * @return {?}
     */
    IgxToastComponent.prototype.show = /**
     * Shows the toast.
     * If `autoHide` is enabled, the toast will hide after `displayTime` is over.
     * ```typescript
     * this.toast.show();
     * ```
     * \@memberof IgxToastComponent
     * @return {?}
     */
    function () {
        var _this = this;
        clearInterval(this.timeoutId);
        this.onShowing.emit(this);
        this.isVisible = true;
        if (this.autoHide) {
            this.timeoutId = setTimeout(function () {
                _this.hide();
            }, this.displayTime);
        }
        this.onShown.emit(this);
    };
    /**
     * Hides the toast.
     * ```typescript
     * this.toast.hide();
     * ```
     * \@memberof IgxToastComponent
     * @return {?}
     */
    IgxToastComponent.prototype.hide = /**
     * Hides the toast.
     * ```typescript
     * this.toast.hide();
     * ```
     * \@memberof IgxToastComponent
     * @return {?}
     */
    function () {
        this.onHiding.emit(this);
        this.isVisible = false;
        this.onHidden.emit(this);
        clearInterval(this.timeoutId);
    };
    /**
     * Wraps \@show() method due \@IToggleView interface implementation.
     * @hidden
     * @return {?}
     */
    IgxToastComponent.prototype.open = /**
     * Wraps \@show() method due \@IToggleView interface implementation.
     * @hidden
     * @return {?}
     */
    function () {
        this.show();
    };
    /**
     * Wraps \@hide() method due \@IToggleView interface implementation.
     * @hidden
     * @return {?}
     */
    IgxToastComponent.prototype.close = /**
     * Wraps \@hide() method due \@IToggleView interface implementation.
     * @hidden
     * @return {?}
     */
    function () {
        this.hide();
    };
    /**
     * Toggles the visible state of the toast.
     * ```typescript
     * this.toast.toggle();
     * ```
     * \@memberof IgxToastComponent
     * @return {?}
     */
    IgxToastComponent.prototype.toggle = /**
     * Toggles the visible state of the toast.
     * ```typescript
     * this.toast.toggle();
     * ```
     * \@memberof IgxToastComponent
     * @return {?}
     */
    function () {
        this.isVisible ? this.close() : this.open();
    };
    /**
     * Sets/gets the class name of the toast based on the `position` value.
     * ```typescript
     * let className =  this.toast.mapPositionToClassName();
     * ```
     * \@memberof IgxToastComponent
     * @return {?}
     */
    IgxToastComponent.prototype.mapPositionToClassName = /**
     * Sets/gets the class name of the toast based on the `position` value.
     * ```typescript
     * let className =  this.toast.mapPositionToClassName();
     * ```
     * \@memberof IgxToastComponent
     * @return {?}
     */
    function () {
        if (this.position === IgxToastPosition.Top) {
            return this.CSS_CLASSES.IGX_TOAST_TOP;
        }
        if (this.position === IgxToastPosition.Middle) {
            return this.CSS_CLASSES.IGX_TOAST_MIDDLE;
        }
        if (this.position === IgxToastPosition.Bottom) {
            return this.CSS_CLASSES.IGX_TOAST_BOTTOM;
        }
    };
    /**
     * @hidden
     * @return {?}
     */
    IgxToastComponent.prototype.ngOnInit = /**
     * @hidden
     * @return {?}
     */
    function () {
        if (this.navService && this.id) {
            this.navService.add(this.id, this);
        }
    };
    /**
     * @hidden
     * @return {?}
     */
    IgxToastComponent.prototype.ngOnDestroy = /**
     * @hidden
     * @return {?}
     */
    function () {
        if (this.navService && this.id) {
            this.navService.remove(this.id);
        }
    };
    IgxToastComponent.decorators = [
        { type: Component, args: [{
                    animations: [
                        trigger('animate', [
                            state('show', style({
                                opacity: 1
                            })),
                            transition('* => show', animate('.20s ease')),
                            transition('show => *', animate('.40s ease-out'))
                        ])
                    ],
                    selector: 'igx-toast',
                    template: "<div [ngClass]=\"mapPositionToClassName()\" *ngIf=\"this.isVisible\" [@animate]=\"'show'\">\n    {{ message }}\n</div>\n"
                },] },
    ];
    /** @nocollapse */
    IgxToastComponent.ctorParameters = function () { return [
        { type: ElementRef, },
        { type: IgxNavigationService, decorators: [{ type: Optional },] },
    ]; };
    IgxToastComponent.propDecorators = {
        "id": [{ type: HostBinding, args: ['attr.id',] }, { type: Input },],
        "onShowing": [{ type: Output },],
        "onShown": [{ type: Output },],
        "onHiding": [{ type: Output },],
        "onHidden": [{ type: Output },],
        "role": [{ type: Input },],
        "autoHide": [{ type: Input },],
        "displayTime": [{ type: Input },],
        "isVisible": [{ type: Input },],
        "message": [{ type: Input },],
        "position": [{ type: Input },],
    };
    return IgxToastComponent;
}());
export { IgxToastComponent };
function IgxToastComponent_tsickle_Closure_declarations() {
    /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
    IgxToastComponent.decorators;
    /**
     * @nocollapse
     * @type {function(): !Array<(null|{type: ?, decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>)})>}
     */
    IgxToastComponent.ctorParameters;
    /** @type {!Object<string,!Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
    IgxToastComponent.propDecorators;
    /**
     * Returns a list of available CSS classes.
     * ```typescript
     * let toastClasses =  this.toast.CSS_CLASSES;
     * ```
     * \@memberof IgxToastComponent
     * @type {?}
     */
    IgxToastComponent.prototype.CSS_CLASSES;
    /**
     * Sets/gets the `id` of the toast.
     * If not set, the `id` will have value `"igx-toast-0"`.
     * ```html
     * <igx-toast id = "my-first-toast"></igx-toast>
     * ```
     * ```typescript
     * let toastId = this.toast.id;
     * ```
     * @type {?}
     */
    IgxToastComponent.prototype.id;
    /**
     * Emits an event prior the toast is shown.
     * Provides reference to the `IgxToastComponent` as event argument.
     * ```html
     * <igx-toast (onShowing) = "onShowing($event)"></igx-toast>
     * ```
     * \@memberof IgxToastComponent
     * @type {?}
     */
    IgxToastComponent.prototype.onShowing;
    /**
     * Emits an event when the toast is shown.
     * Provides reference to the `IgxToastComponent` as event argument.
     * ```html
     * <igx-toast (onShown) = "onShown($event)"></igx-toast>
     * ```
     * \@memberof IgxToastComponent
     * @type {?}
     */
    IgxToastComponent.prototype.onShown;
    /**
     * Emits an event prior the toast is hidden.
     * Provides reference to the `IgxToastComponent` as event argument.
     * ```html
     * <igx-toast (onHiding) = "onHiding($event)"></igx-toast>
     * ```
     * \@memberof IgxToastComponent
     * @type {?}
     */
    IgxToastComponent.prototype.onHiding;
    /**
     *  Emits an event when the toast is hidden.
     *  Provides reference to the `IgxToastComponent` as event argument.
     * ```html
     * <igx-toast (onHidden) = "onHidden($event)"></igx-toast>
     * ```
     * \@memberof IgxToastComponent
     * @type {?}
     */
    IgxToastComponent.prototype.onHidden;
    /**
     * Sets/gets the `role` attribute.
     * If not set, `role` will have value `"alert"`.
     * ```html
     * <igx-toast [role] = "'notify'"></igx-toast>
     * ```
     * ```typescript
     * let toastRole = this.toast.role;
     * ```
     * \@memberof IgxToastComponent
     * @type {?}
     */
    IgxToastComponent.prototype.role;
    /**
     * Sets/gets whether the toast will be hidden after the `displayTime` is over.
     * Default value is `true`.
     * ```html
     * <igx-toast [autoHide] = "false"></igx-toast>
     * ```
     * ```typescript
     * let autoHide = this.toast.autoHide;
     * ```
     * \@memberof IgxToastComponent
     * @type {?}
     */
    IgxToastComponent.prototype.autoHide;
    /**
     * Sets/gets the duration of time span(in milliseconds) which the toast will be visible
     * after it is being shown.
     * Default value is `4000`.
     * ```html
     * <igx-toast [displayTime] = "2500"></igx-toast>
     * ```
     * ```typescript
     * let displayTime = this.toast.displayTime;
     * ```
     * \@memberof IgxToastComponent
     * @type {?}
     */
    IgxToastComponent.prototype.displayTime;
    /**
     * Enables/Disables the visibility of the toast.
     * If not set, the `isVisible` attribute will have value `false`.
     * ```html
     * <igx-toast [isVisible] = "true"></igx-toast>
     * ```
     * ```typescript
     * let isVisible = this.toast.isVisible;
     * ```
     * \@memberof IgxToastComponent
     * @type {?}
     */
    IgxToastComponent.prototype.isVisible;
    /**
     * Sets/gets the message that will be shown by the toast.
     * ```html
     * <igx-toast [message] = "Notification"></igx-toast>
     * ```
     * ```typescript
     * let toastMessage = this.toast.message;
     * ```
     * \@memberof IgxToastComponent
     * @type {?}
     */
    IgxToastComponent.prototype.message;
    /**
     * Sets/gets the position of the toast.
     * If not set, the `position` attribute will have value `IgxToastPosition.Bottom`.
     * ```html
     * <igx-toast [position] = "top"></igx-toast>
     * ```
     * ```typescript
     * let toastPosition = this.toast.position;
     * ```
     * \@memberof IgxToastComponent
     * @type {?}
     */
    IgxToastComponent.prototype.position;
    /**
     * @hidden
     * @type {?}
     */
    IgxToastComponent.prototype.timeoutId;
    /** @type {?} */
    IgxToastComponent.prototype.elementRef;
    /** @type {?} */
    IgxToastComponent.prototype.navService;
}
/** @enum {number} */
var IgxToastPosition = {
    Bottom: 0,
    Middle: 1,
    Top: 2,
};
export { IgxToastPosition };
IgxToastPosition[IgxToastPosition.Bottom] = "Bottom";
IgxToastPosition[IgxToastPosition.Middle] = "Middle";
IgxToastPosition[IgxToastPosition.Top] = "Top";
/**
 * The IgxToastModule provides the {\@link IgxToastComponent} inside your application.
 */
var IgxToastModule = /** @class */ (function () {
    function IgxToastModule() {
    }
    IgxToastModule.decorators = [
        { type: NgModule, args: [{
                    declarations: [IgxToastComponent],
                    exports: [IgxToastComponent],
                    imports: [CommonModule]
                },] },
    ];
    return IgxToastModule;
}());
export { IgxToastModule };
function IgxToastModule_tsickle_Closure_declarations() {
    /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
    IgxToastModule.decorators;
    /**
     * @nocollapse
     * @type {function(): !Array<(null|{type: ?, decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>)})>}
     */
    IgxToastModule.ctorParameters;
}

//# sourceMappingURL=data:application/json;base64, 