'use strict';

import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
import React from 'react';
import Static from 'react-bootstrap/lib/FormControlStatic';
import BSFormControl from 'react-bootstrap/lib/FormControl';
import { FormControl } from './FormControl';
export var TextAreaControl =
/*#__PURE__*/
function (_FormControl) {
  _inheritsLoose(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 = _objectWithoutPropertiesLoose(_this$getPropsFromCon, ["maxLength"]);

    return props.readOnly ? React.createElement(Static, _extends({
      ref: "input"
    }, this.getSafeProps(props), {
      "data-test-automation-id": "input"
    }), props.value) : React.createElement(BSFormControl, _extends({}, this.getSafeProps(props), {
      "data-test-automation-id": "input",
      ref: "input",
      componentClass: "textarea",
      maxLength: maxLength
    }));
  };

  return TextAreaControl;
}(FormControl);

_defineProperty(TextAreaControl, "propTypes", Object.assign({}, FormControl.propTypes));

_defineProperty(TextAreaControl, "defaultProps", Object.assign({}, FormControl.defaultProps, {
  maxLength: 256
}));