UNPKG

2.92 kBJavaScriptView Raw
1/*
2 * Copyright 2015 Palantir Technologies, Inc. All rights reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16import { __assign, __extends, __rest } from "tslib";
17import classNames from "classnames";
18import * as React from "react";
19import { AbstractPureComponent2, Classes } from "../../common";
20import { DISPLAYNAME_PREFIX } from "../../common/props";
21// eslint-disable-next-line import/no-cycle
22import { Popover, PopoverInteractionKind } from "../popover/popover";
23/**
24 * Tooltip component.
25 *
26 * @see https://blueprintjs.com/docs/#core/components/tooltip
27 * @deprecated use { Tooltip2 } from "@blueprintjs/popover2"
28 */
29// eslint-disable-next-line deprecation/deprecation
30var Tooltip = /** @class */ (function (_super) {
31 __extends(Tooltip, _super);
32 function Tooltip() {
33 var _this = _super !== null && _super.apply(this, arguments) || this;
34 // eslint-disable-next-line deprecation/deprecation
35 _this.popover = null;
36 return _this;
37 }
38 Tooltip.prototype.render = function () {
39 var _a;
40 var _this = this;
41 var _b = this.props, children = _b.children, intent = _b.intent, popoverClassName = _b.popoverClassName, restProps = __rest(_b, ["children", "intent", "popoverClassName"]);
42 var classes = classNames(Classes.TOOLTIP, (_a = {}, _a[Classes.MINIMAL] = this.props.minimal, _a), Classes.intentClass(intent), popoverClassName);
43 return (
44 /* eslint-disable deprecation/deprecation */
45 React.createElement(Popover, __assign({ interactionKind: PopoverInteractionKind.HOVER_TARGET_ONLY, modifiers: { arrow: { enabled: !this.props.minimal } } }, restProps, { autoFocus: false, canEscapeKeyClose: false, enforceFocus: false, lazy: true, popoverClassName: classes, portalContainer: this.props.portalContainer, ref: function (ref) { return (_this.popover = ref); } }), children));
46 };
47 Tooltip.prototype.reposition = function () {
48 if (this.popover != null) {
49 this.popover.reposition();
50 }
51 };
52 Tooltip.displayName = "".concat(DISPLAYNAME_PREFIX, ".Tooltip");
53 // eslint-disable-next-line deprecation/deprecation
54 Tooltip.defaultProps = {
55 hoverCloseDelay: 0,
56 hoverOpenDelay: 100,
57 minimal: false,
58 transitionDuration: 100,
59 };
60 return Tooltip;
61}(AbstractPureComponent2));
62export { Tooltip };
63//# sourceMappingURL=tooltip.js.map
\No newline at end of file