UNPKG

@blueprintjs/popover2

Version:

Re-exports of popover-related components from @blueprintjs/core

47 lines 2.72 kB
/* * Copyright 2023 Palantir Technologies, Inc. All rights reserved. * * 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 { __assign, __extends, __rest } from "tslib"; /* eslint-disable @typescript-eslint/no-deprecated, @blueprintjs/no-deprecated-components */ import classNames from "classnames"; import * as React from "react"; import { Classes, mergeRefs, Popover } from "@blueprintjs/core"; // Legacy classes from @blueprintjs/popover2 v1.x. Note that these are distinct from the `Classes` aliases in // "./classes.ts" - those strings will continue to work with Popover in Blueprint v5.x, while these values are // completely deprecated. var NS = Classes.getClassNamespace(); var POPOVER2 = "".concat(NS, "-popover2"); var POPOVER2_TARGET = "".concat(NS, "-popover2-target"); /** @deprecated use `{ Popover } from "blueprintjs/core"` instead */ var Popover2 = /** @class */ (function (_super) { __extends(Popover2, _super); function Popover2() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.ref = React.createRef(); // Add support for the one public instance method available on the popover component _this.reposition = function () { var _a; return (_a = _this.ref.current) === null || _a === void 0 ? void 0 : _a.reposition(); }; return _this; } Popover2.prototype.render = function () { var _a = this.props, className = _a.className, popoverClassName = _a.popoverClassName, ref = _a.ref, props = __rest(_a, ["className", "popoverClassName", "ref"]); // Inject two classes commonly referenced in CSS selectors in user code which was compatible with // @blueprintjs/popover2 v1.x. Users should ideally migrate to the "-popover-" classes instead, but we want // to allow some of their custom styles to continue working when upgrading from Blueprint v4 -> v5. return (React.createElement(Popover, __assign({ className: classNames(POPOVER2_TARGET, className), popoverClassName: classNames(POPOVER2, popoverClassName), ref: mergeRefs(ref, this.ref) }, props))); }; return Popover2; }(React.PureComponent)); export { Popover2 }; //# sourceMappingURL=popover2.js.map