/**
 * al-tip
 *
 * @author Rob Parker <robert.parker@alertlogic.com>
 *
 * @copyright Alert Logic, Inc 2021
 *
 */
import { Component, Input, ElementRef } from '@angular/core';
import * as i0 from "@angular/core";
import * as i1 from "primeng-lts/tooltip";
import * as i2 from "../al-icon/al-icon.component";
var AlTipComponent = /** @class */ (function () {
    function AlTipComponent(eref) {
        this.eref = eref;
        this.tip = 'This is a tip';
        this.showTip = false;
    }
    AlTipComponent.prototype.ngOnInit = function () {
    };
    AlTipComponent.prototype.clickOut = function (event) {
        if (!this.eref.nativeElement.contains(event.target)) {
            this.showTip = false;
        }
    };
    /** @nocollapse */ AlTipComponent.ɵfac = function AlTipComponent_Factory(t) { return new (t || AlTipComponent)(i0.ɵɵdirectiveInject(i0.ElementRef)); };
    /** @nocollapse */ AlTipComponent.ɵcmp = i0.ɵɵdefineComponent({ type: AlTipComponent, selectors: [["al2-tip"]], hostBindings: function AlTipComponent_HostBindings(rf, ctx) { if (rf & 1) {
            i0.ɵɵlistener("click", function AlTipComponent_click_HostBindingHandler($event) { return ctx.clickOut($event); }, false, i0.ɵɵresolveDocument);
        } }, inputs: { tip: "tip" }, decls: 2, vars: 1, consts: [[1, "ald-tip", 3, "pTooltip"], ["iconClass", "material-icons", "icon", "info_outline", 3, "click"]], template: function AlTipComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵelementStart(0, "div", 0);
            i0.ɵɵelementStart(1, "al2-icon", 1);
            i0.ɵɵlistener("click", function AlTipComponent_Template_al2_icon_click_1_listener() { return ctx.showTip = !ctx.showTip; });
            i0.ɵɵelementEnd();
            i0.ɵɵelementEnd();
        } if (rf & 2) {
            i0.ɵɵproperty("pTooltip", ctx.tip);
        } }, directives: [i1.Tooltip, i2.AlIconComponent], encapsulation: 2 });
    return AlTipComponent;
}());
export { AlTipComponent };
/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(AlTipComponent, [{
        type: Component,
        args: [{
                selector: 'al2-tip',
                templateUrl: './al-tip.component.html',
                host: {
                    '(document:click)': 'clickOut($event)'
                }
            }]
    }], function () { return [{ type: i0.ElementRef }]; }, { tip: [{
            type: Input
        }] }); })();
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWwtdGlwLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiJuZzovL0BhbC9uZy1nZW5lcmljLWNvbXBvbmVudHMvIiwic291cmNlcyI6WyJuZXctY29tcG9uZW50cy9hbC10aXAvYWwtdGlwLmNvbXBvbmVudC50cyIsIm5ldy1jb21wb25lbnRzL2FsLXRpcC9hbC10aXAuY29tcG9uZW50Lmh0bWwiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7R0FPRztBQUVGLE9BQU8sRUFBRSxTQUFTLEVBQUUsS0FBSyxFQUFVLFVBQVUsRUFBRSxNQUFNLGVBQWUsQ0FBQzs7OztBQUVyRTtJQWFFLHdCQUNVLElBQWdCO1FBQWhCLFNBQUksR0FBSixJQUFJLENBQVk7UUFMakIsUUFBRyxHQUFXLGVBQWUsQ0FBQztRQUV2QyxZQUFPLEdBQUcsS0FBSyxDQUFDO0lBSVosQ0FBQztJQUVMLGlDQUFRLEdBQVI7SUFDQSxDQUFDO0lBRUQsaUNBQVEsR0FBUixVQUFTLEtBQVk7UUFDbkIsSUFBSSxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsYUFBYSxDQUFDLFFBQVEsQ0FBQyxLQUFLLENBQUMsTUFBTSxDQUFDLEVBQUU7WUFDbkQsSUFBSSxDQUFDLE9BQU8sR0FBRyxLQUFLLENBQUM7U0FDdEI7SUFDSCxDQUFDO21HQWpCVSxjQUFjOzBFQUFkLGNBQWM7cUdBQWQsb0JBQWdCOztZQ2xCOUIsOEJBQ0k7WUFBQSxtQ0FBaUc7WUFBeEMsMkhBQTRCO1lBQUMsaUJBQVc7WUFDckcsaUJBQU07O1lBRmUsa0NBQWdCOzt5QkRBckM7Q0FxQ0UsQUExQk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