import _extends from "@babel/runtime/helpers/esm/extends";
import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
var _class, _SidePageBody;
import React from 'react';
import { CommonWrapper } from "../../../internal/CommonWrapper";
import { ThemeContext } from "../../../lib/theming/ThemeContext";
import { responsiveLayout } from "../../ResponsiveLayout/decorator";
import { cx } from "../../../lib/theming/Emotion";
import { rootNode } from "../../../lib/rootNode";
import { styles } from "../SidePage.styles";
import { SidePageContext } from "../SidePageContext";
export var SidePageBodyDataTids = {
  root: 'SidePageBody__root'
};
/**
 * Тело для сайдпейджа
 *
 * @visibleName SidePage.Body
 */
export var SidePageBody = responsiveLayout(_class = rootNode(_class = (_SidePageBody = /*#__PURE__*/function (_React$Component) {
  function SidePageBody() {
    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.context = _this.context;
    return _this;
  }
  _inheritsLoose(SidePageBody, _React$Component);
  var _proto = SidePageBody.prototype;
  _proto.componentDidUpdate = function componentDidUpdate() {
    this.context.updateLayout();
  };
  _proto.render = function render() {
    var _this2 = this;
    return /*#__PURE__*/(
      React.createElement(ThemeContext.Consumer, null, function (theme) {
        var _cx;
        return /*#__PURE__*/(
          React.createElement(CommonWrapper, _extends({
            rootNodeRef: _this2.setRootNode
          }, _this2.props), /*#__PURE__*/
          React.createElement("div", {
            "data-tid": SidePageBodyDataTids.root,
            className: cx(styles.body(theme), (_cx = {}, _cx[styles.mobileBody()] = _this2.isMobileLayout, _cx))
          }, _this2.props.children))
        );
      })
    );
  };
  return SidePageBody;
}(React.Component), _SidePageBody.__KONTUR_REACT_UI__ = 'SidePageBody', _SidePageBody.displayName = 'SidePageBody', _SidePageBody.contextType = SidePageContext, _SidePageBody)) || _class) || _class;