UNPKG

carbon-components-angular

Version:
65 lines (62 loc) 2.88 kB
/*! * * Neutrino v0.0.0 | tooltip.component.js * * Copyright 2014, 2018 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, TemplateRef, HostBinding } from "@angular/core"; import { Dialog } from "./../dialog.component"; /** * Extend the `Dialog` component to create a tooltip for exposing content. */ var Tooltip = /** @class */ (function (_super) { __extends(Tooltip, _super); function Tooltip() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.style = "inline-block"; /** * Value is set to `true` if the `Tooltip` is to display a `TemplateRef` instead of a string. */ _this.hasContentTemplate = false; return _this; } /** * Check whether there is a template for the `Tooltip` content. */ Tooltip.prototype.onDialogInit = function () { this.hasContentTemplate = this.dialogConfig.content instanceof TemplateRef; }; Tooltip.decorators = [ { type: Component, args: [{ selector: "ibm-tooltip", template: "\n\t\t<div\n\t\t\t#dialog\n\t\t\t[id]=\"dialogConfig.compID\"\n\t\t\trole=\"tooltip\"\n\t\t\ttabindex=\"0\"\n\t\t\tclass=\"bx--tooltip bx--tooltip--shown\">\n\t\t\t<span class=\"bx--tooltip__caret\" aria-hidden=\"true\"></span>\n\t\t\t<ng-template\n\t\t\t\t\t*ngIf=\"hasContentTemplate\"\n\t\t\t\t\t[ngTemplateOutlet]=\"dialogConfig.content\"\n\t\t\t\t\t[ngTemplateOutletContext]=\"{tooltip: this}\">\n\t\t\t</ng-template>\n\t\t\t<p\n\t\t\t\t*ngIf=\"!hasContentTemplate\">\n\t\t\t\t{{dialogConfig.content}}\n\t\t\t</p>\n\t\t</div>\n\t\t" },] }, ]; Tooltip.propDecorators = { style: [{ type: HostBinding, args: ["style.display",] }] }; return Tooltip; }(Dialog)); export { Tooltip }; //# sourceMappingURL=tooltip.component.js.map