import * as React from 'react';
import { Grid, GridColumn } from '@megafon/ui-core';
import { cnCreate } from '@megafon/ui-helpers';
import "./TextBox.css";
var cn = cnCreate('mfui-9-text-box');
var TextBox = function TextBox(_ref) {
  var _ref$textCenter = _ref.textCenter,
    textCenter = _ref$textCenter === void 0 ? false : _ref$textCenter,
    _ref$centeringWithLim = _ref.centeringWithLimitedWidth,
    centeringWithLimitedWidth = _ref$centeringWithLim === void 0 ? false : _ref$centeringWithLim,
    _ref$isFullWidth = _ref.isFullWidth,
    isFullWidth = _ref$isFullWidth === void 0 ? true : _ref$isFullWidth,
    rootRef = _ref.rootRef,
    className = _ref.className,
    children = _ref.children;
  var renderContent = function renderContent() {
    return /*#__PURE__*/React.createElement("div", {
      className: cn('content')
    }, children);
  };
  var renderTextBoxWithGrid = function renderTextBoxWithGrid() {
    return /*#__PURE__*/React.createElement(Grid, {
      hAlign: centeringWithLimitedWidth ? 'center' : 'left',
      dataAttrs: {
        container: {
          'data-testid': 'TextBox-grid'
        }
      }
    }, /*#__PURE__*/React.createElement(GridColumn, {
      wide: "8",
      desktop: "10",
      tablet: "12",
      mobile: "12"
    }, renderContent()));
  };
  return /*#__PURE__*/React.createElement("div", {
    className: cn({
      'text-center': textCenter
    }, [className]),
    ref: rootRef
  }, isFullWidth ? renderContent() : renderTextBoxWithGrid());
};
export default TextBox;