"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;exports.__esModule = true;exports.MobilePopupDataTids = exports.MobilePopup = void 0;var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
var _react = _interopRequireDefault(require("react"));
var _reactTransitionGroup = require("react-transition-group");


var _ThemeContext = require("../../lib/theming/ThemeContext");
var _RenderContainer = require("../RenderContainer");
var _HideBodyVerticalScroll = require("../HideBodyVerticalScroll");
var _ZIndex = require("../ZIndex");
var _RenderLayer = require("../RenderLayer");

var _rootNode = require("../../lib/rootNode");

var _MobilePopup2 = require("./MobilePopup.styles");
var _MobilePopupHeader = require("./MobilePopupHeader");
var _MobilePopupFooter = require("./MobilePopupFooter");var _class, _MobilePopup;

































var MobilePopupDataTids = exports.MobilePopupDataTids = {
  root: 'MobilePopup__root',
  container: 'MobilePopup__container'
};var


MobilePopup = exports.MobilePopup = (0, _rootNode.rootNode)(_class = (_MobilePopup = /*#__PURE__*/function (_React$Component) {function MobilePopup() {var _this;for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {args[_key] = arguments[_key];}_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;_this.






















































    close = function () {
      if (_this.props.onCloseRequest) {
        _this.props.onCloseRequest();
      }
    };return _this;}(0, _inheritsLoose2.default)(MobilePopup, _React$Component);var _proto = MobilePopup.prototype;_proto.render = function render() {var _this2 = this;return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Consumer, null, function (theme) {_this2.theme = theme;return _this2.renderMain();});};_proto.renderMain = function renderMain() {var content = /*#__PURE__*/_react.default.createElement(_ZIndex.ZIndex, { id: this.props.id, className: _MobilePopup2.jsStyles.zIndex(), priority: 'MobilePopup' }, /*#__PURE__*/_react.default.createElement(_reactTransitionGroup.Transition, { in: this.props.opened, onExited: this.props.onClose, mountOnEnter: true, unmountOnExit: true, timeout: 0 }, /*#__PURE__*/_react.default.createElement("div", { className: _MobilePopup2.jsStyles.wrapper() }, /*#__PURE__*/_react.default.createElement(_RenderLayer.RenderLayer, { onClickOutside: this.close }, /*#__PURE__*/_react.default.createElement("div", { ref: this.setRootNode, "data-tid": MobilePopupDataTids.container, className: _MobilePopup2.jsStyles.container(this.theme) }, /*#__PURE__*/_react.default.createElement("div", { "data-tid": MobilePopupDataTids.root, className: _MobilePopup2.jsStyles.root(this.theme) }, /*#__PURE__*/_react.default.createElement(_MobilePopupHeader.MobilePopupHeader, { caption: this.props.caption }, this.props.headerChildComponent), /*#__PURE__*/_react.default.createElement("div", { className: _MobilePopup2.jsStyles.content(this.theme) }, this.props.children), /*#__PURE__*/_react.default.createElement(_MobilePopupFooter.MobilePopupFooter, null, this.props.footerChildComponent)), /*#__PURE__*/_react.default.createElement("div", { onClick: this.close, className: _MobilePopup2.jsStyles.bottomIndent() }))), /*#__PURE__*/_react.default.createElement("div", { className: _MobilePopup2.jsStyles.bg() }), /*#__PURE__*/_react.default.createElement(_HideBodyVerticalScroll.HideBodyVerticalScroll, null))));if (this.props.withoutRenderContainer) {return content;}return /*#__PURE__*/_react.default.createElement(_RenderContainer.RenderContainer, null, content);};return MobilePopup;}(_react.default.Component), _MobilePopup.__KONTUR_REACT_UI__ = 'MobileMenuHeader', _MobilePopup.displayName = 'MobileMenuHeader', _MobilePopup.defaultRootNode = null, _MobilePopup)) || _class;