/*!
 *
 * carbon-angular v0.0.7 | header-item.component.js
 *
 * Copyright 2014, 2019 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.
 */


import { Component, Input, Optional, EventEmitter, Output } from "@angular/core";
import { DomSanitizer } from "@angular/platform-browser";
import { Router } from "@angular/router";
/**
 * Individual item in the header. May be used a direct child of `HeaderNavigation` or `HeaderMenu`
 */
var HeaderItem = /** @class */ (function () {
    function HeaderItem(domSanitizer, router) {
        this.domSanitizer = domSanitizer;
        this.router = router;
        /**
         * Emits the navigation status promise when the link is activated
         */
        this.navigation = new EventEmitter();
        this._href = "javascript:void(0)";
    }
    Object.defineProperty(HeaderItem.prototype, "href", {
        get: function () {
            return this.domSanitizer.bypassSecurityTrustUrl(this._href);
        },
        set: function (v) {
            this._href = v;
        },
        enumerable: true,
        configurable: true
    });
    HeaderItem.prototype.navigate = function (event) {
        if (this.router && this.route) {
            event.preventDefault();
            var status_1 = this.router.navigate(this.route, this.routeExtras);
            this.navigation.emit(status_1);
        }
    };
    HeaderItem.decorators = [
        { type: Component, args: [{
                    selector: "ibm-header-item",
                    template: "\n\t\t<li style=\"height: 100%\">\n\t\t\t<a\n\t\t\t\tclass=\"bx--header__menu-item\"\n\t\t\t\trole=\"menuitem\"\n\t\t\t\ttabindex=\"0\"\n\t\t\t\t[href]=\"href\"\n\t\t\t\t(click)=\"navigate($event)\">\n\t\t\t\t<ng-content></ng-content>\n\t\t\t</a>\n\t\t</li>\n\t"
                },] },
    ];
    /** @nocollapse */
    HeaderItem.ctorParameters = function () { return [
        { type: DomSanitizer },
        { type: Router, decorators: [{ type: Optional }] }
    ]; };
    HeaderItem.propDecorators = {
        href: [{ type: Input }],
        route: [{ type: Input }],
        routeExtras: [{ type: Input }],
        navigation: [{ type: Output }]
    };
    return HeaderItem;
}());
export { HeaderItem };
//# sourceMappingURL=header-item.component.js.map