@blueprintjs/popover2
Version:
Re-exports of popover-related components from @blueprintjs/core
50 lines • 2.92 kB
JavaScript
;
/*
* 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.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.Popover2 = void 0;
var tslib_1 = require("tslib");
/* eslint-disable @typescript-eslint/no-deprecated, @blueprintjs/no-deprecated-components */
var classnames_1 = tslib_1.__importDefault(require("classnames"));
var React = tslib_1.__importStar(require("react"));
var core_1 = require("@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 = core_1.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) {
tslib_1.__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 = tslib_1.__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(core_1.Popover, tslib_1.__assign({ className: (0, classnames_1.default)(POPOVER2_TARGET, className), popoverClassName: (0, classnames_1.default)(POPOVER2, popoverClassName), ref: (0, core_1.mergeRefs)(ref, this.ref) }, props)));
};
return Popover2;
}(React.PureComponent));
exports.Popover2 = Popover2;
//# sourceMappingURL=popover2.js.map