UNPKG

@skbkontur/ui-kit

Version:

26 lines 1.19 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var React = tslib_1.__importStar(require("react")); var ZIndexStorage_1 = tslib_1.__importDefault(require("./ZIndexStorage")); var ZIndex = /** @class */ (function (_super) { tslib_1.__extends(ZIndex, _super); function ZIndex(props) { var _this = _super.call(this, props) || this; _this.zIndex = ZIndexStorage_1.default.incrementZIndex(_this.props.delta); return _this; } ZIndex.prototype.componentWillUnmount = function () { ZIndexStorage_1.default.removeZIndex(this.zIndex); }; ZIndex.prototype.render = function () { var _a = this.props, render = _a.render, style = _a.style, children = _a.children, delta = _a.delta, props = tslib_1.__rest(_a, ["render", "style", "children", "delta"]); return render ? (React.createElement("div", tslib_1.__assign({ style: tslib_1.__assign({}, style, { zIndex: this.zIndex }) }, props), children)) : (children); }; ZIndex.defaultProps = { render: true }; return ZIndex; }(React.Component)); exports.default = ZIndex; //# sourceMappingURL=ZIndex.js.map