"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;exports.__esModule = true;exports.CenterDataTids = exports.Center = void 0;var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));var _react = _interopRequireDefault(require("react"));



var _CommonWrapper = require("../../internal/CommonWrapper");
var _Emotion = require("../../lib/theming/Emotion");

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

var _createPropsGetter = require("../../lib/createPropsGetter");

var _Center2 = require("./Center.styles");var _excluded = ["align"];var _class, _Center;













var CenterDataTids = exports.CenterDataTids = {
  root: 'Center__root'
};




/**
 * `Center` — контейнер, который центрирует элементы внутри себя.
 *
 * Выравнивание задается пропом `align`.
 */var

Center = exports.Center = (0, _rootNode.rootNode)(_class = (_Center = /*#__PURE__*/function (_React$Component) {function Center() {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.






    getProps = (0, _createPropsGetter.createPropsGetter)(Center.defaultProps);_this.











    renderMain = function (props) {var _cx;
      var align = props.align,rest = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);

      return /*#__PURE__*/(
        _react.default.createElement("div", (0, _extends2.default)({
          "data-tid": CenterDataTids.root },
        rest, {
          className: (0, _Emotion.cx)((_cx = {}, _cx[
          _Center2.styles.root()] = true, _cx[
          _Center2.styles.rootAlignLeft()] = align === 'left', _cx[
          _Center2.styles.rootAlignRight()] = align === 'right', _cx)
          ) }), /*#__PURE__*/

        _react.default.createElement("span", { className: _Center2.styles.spring() }), /*#__PURE__*/
        _react.default.createElement("span", { className: _Center2.styles.container() }, _this.props.children)
        ));

    };return _this;}(0, _inheritsLoose2.default)(Center, _React$Component);var _proto = Center.prototype;_proto.render = function render() {return /*#__PURE__*/_react.default.createElement(_CommonWrapper.CommonWrapper, (0, _extends2.default)({ rootNodeRef: this.setRootNode }, this.getProps()), this.renderMain);};return Center;}(_react.default.Component), _Center.__KONTUR_REACT_UI__ = 'Center', _Center.displayName = 'Center', _Center.defaultProps = { align: 'center' }, _Center)) || _class;