'use strict';

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

exports.__esModule = true;
exports.TextAreaControl = 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 _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));

var _react = _interopRequireDefault(require("react"));

var _FormControlStatic = _interopRequireDefault(require("react-bootstrap/lib/FormControlStatic"));

var _FormControl2 = _interopRequireDefault(require("react-bootstrap/lib/FormControl"));

var _FormControl3 = require("./FormControl");

var TextAreaControl =
/*#__PURE__*/
function (_FormControl) {
  (0, _inheritsLoose2.default)(TextAreaControl, _FormControl);

  function TextAreaControl() {
    return _FormControl.apply(this, arguments) || this;
  }

  var _proto = TextAreaControl.prototype;

  _proto.render = function render() {
    var _this$getPropsFromCon = this.getPropsFromContext(),
        maxLength = _this$getPropsFromCon.maxLength,
        props = (0, _objectWithoutPropertiesLoose2.default)(_this$getPropsFromCon, ["maxLength"]);

    return props.readOnly ? _react.default.createElement(_FormControlStatic.default, (0, _extends2.default)({
      ref: "input"
    }, this.getSafeProps(props), {
      "data-test-automation-id": "input"
    }), props.value) : _react.default.createElement(_FormControl2.default, (0, _extends2.default)({}, this.getSafeProps(props), {
      "data-test-automation-id": "input",
      ref: "input",
      componentClass: "textarea",
      maxLength: maxLength
    }));
  };

  return TextAreaControl;
}(_FormControl3.FormControl);

exports.TextAreaControl = TextAreaControl;
(0, _defineProperty2.default)(TextAreaControl, "propTypes", Object.assign({}, _FormControl3.FormControl.propTypes));
(0, _defineProperty2.default)(TextAreaControl, "defaultProps", Object.assign({}, _FormControl3.FormControl.defaultProps, {
  maxLength: 256
}));