'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _TextArea = require('../inputs/TextArea');

var _TextArea2 = _interopRequireDefault(_TextArea);

var _FieldWrapper = require('./FieldWrapper');

var _FieldWrapper2 = _interopRequireDefault(_FieldWrapper);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var TextAreaField = function (_React$Component) {
  _inherits(TextAreaField, _React$Component);

  function TextAreaField() {
    _classCallCheck(this, TextAreaField);

    return _possibleConstructorReturn(this, (TextAreaField.__proto__ || Object.getPrototypeOf(TextAreaField)).apply(this, arguments));
  }

  _createClass(TextAreaField, [{
    key: 'render',
    value: function render() {
      var _props = this.props,
          input = _props.input,
          label = _props.label,
          id = _props.id,
          disabled = _props.disabled,
          required = _props.required,
          helpText = _props.helpText,
          callout = _props.callout;

      return _react2.default.createElement(
        _FieldWrapper2.default,
        {
          label: label,
          helpText: helpText,
          disabled: disabled,
          required: required,
          callout: callout
        },
        _react2.default.createElement(_TextArea2.default, _extends({}, input, { id: id, disabled: disabled, required: required }))
      );
    }
  }]);

  return TextAreaField;
}(_react2.default.Component);

TextAreaField.propTypes = {
  input: _propTypes2.default.shape({
    value: _propTypes2.default.string,
    onChange: _propTypes2.default.func
  }),
  disabled: _propTypes2.default.bool,
  required: _propTypes2.default.bool,
  label: _propTypes2.default.string,
  id: _propTypes2.default.string,
  helpText: _propTypes2.default.string,
  callout: _propTypes2.default.node
};
TextAreaField.defaultProps = {
  disabled: false,
  required: false,
  label: null,
  id: null,
  helpText: null,
  callout: null
};


TextAreaField.usage = '\n# TextAreaField\n\nAn input component that renders a large field for entering long text.\n\nProps:\n\n* `input`: supplied by Redux Form\'s Field component, you can also specify this manually. Should contain `value` and `onChange` at least.\n* `label`: a renderable label to go above the component\n* `helpText`: some text to be rendered below the component\n* `disabled`: disables the component\n* `required`: adds a required mark and HTML field validation\n* `callout`: optional flyout to show on hover\n\n```\n<TextAreaField input={input} label="big text" helpText="write a lot here" required />\n```\n';

exports.default = TextAreaField;