import _extends from "@babel/runtime/helpers/esm/extends";
import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
var _class, _SidePageContainer;
import React from 'react';
import { ThemeContext } from "../../../lib/theming/ThemeContext";
import { CommonWrapper } from "../../../internal/CommonWrapper";
import { cx } from "../../../lib/theming/Emotion";
import { responsiveLayout } from "../../ResponsiveLayout/decorator";
import { rootNode } from "../../../lib/rootNode";
import { styles } from "../SidePage.styles";
import { SidePageContext } from "../SidePageContext";
export var SidePageContainerDataTids = {
  root: 'SidePageContainer__root'
};

/**
 * Контейнер с отступами
 *
 * @visibleName SidePage.Container
 */
export var SidePageContainer = responsiveLayout(_class = rootNode(_class = (_SidePageContainer = /*#__PURE__*/function (_React$Component) {
  function SidePageContainer() {
    return _React$Component.apply(this, arguments) || this;
  }
  _inheritsLoose(SidePageContainer, _React$Component);
  var _proto = SidePageContainer.prototype;
  _proto.render = function render() {
    var _this = this;
    return /*#__PURE__*/(
      React.createElement(ThemeContext.Consumer, null, function (theme) {
        _this.theme = theme;
        return _this.renderMain();
      })
    );
  };
  _proto.renderMain = function renderMain() {
    var _this2 = this;
    return /*#__PURE__*/(
      React.createElement(SidePageContext.Consumer, null, function (_ref) {
        var _cx;
        var hasHeader = _ref.hasHeader,
          hasFooter = _ref.hasFooter,
          hasPanel = _ref.hasPanel;
        return /*#__PURE__*/(
          React.createElement(CommonWrapper, _extends({
            rootNodeRef: _this2.setRootNode
          }, _this2.props), /*#__PURE__*/
          React.createElement("div", {
            "data-tid": SidePageContainerDataTids.root,
            className: cx((_cx = {}, _cx[styles.container(_this2.theme)] = true, _cx[styles.containerWithoutHeader(_this2.theme)] = !hasHeader, _cx[styles.containerWithoutFooter(_this2.theme)] = !hasFooter, _cx[styles.containerWithPanel(_this2.theme)] = hasPanel, _cx[styles.mobileContainer(_this2.theme)] = _this2.isMobileLayout, _cx[styles.mobileContainerWithoutHeader(_this2.theme)] = _this2.isMobileLayout && !hasHeader, _cx))
          }, _this2.props.children))
        );
      })
    );
  };
  return SidePageContainer;
}(React.Component), _SidePageContainer.__KONTUR_REACT_UI__ = 'SidePageContainer', _SidePageContainer.displayName = 'SidePageContainer', _SidePageContainer)) || _class) || _class;