import _extends from "@babel/runtime/helpers/extends";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
var _excluded = ["className", "error", "helpText", "inverse", "success", "warning"];

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }

import React, { forwardRef } from 'react';
import Box from '../box/Box';
import cx from 'classnames';
import theme from './theme.css';
import { omitBoxProps, pickBoxProps } from '../box';
import InputBase from './InputBase';
import ValidationText from '../validationText';
var Textarea = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
  var _cx;

  var className = _ref.className,
      error = _ref.error,
      helpText = _ref.helpText,
      _ref$inverse = _ref.inverse,
      inverse = _ref$inverse === void 0 ? false : _ref$inverse,
      success = _ref.success,
      warning = _ref.warning,
      others = _objectWithoutProperties(_ref, _excluded);

  var classNames = cx(theme['wrapper'], (_cx = {}, _defineProperty(_cx, theme['has-error'], error), _defineProperty(_cx, theme['has-success'], success), _defineProperty(_cx, theme['has-warning'], warning), _cx), className);
  var boxProps = pickBoxProps(others);

  var inputProps = _objectSpread({
    inverse: inverse
  }, omitBoxProps(others));

  return /*#__PURE__*/React.createElement(Box, _extends({
    className: classNames
  }, boxProps), /*#__PURE__*/React.createElement(InputBase, _extends({
    ref: forwardedRef,
    className: theme['textarea'],
    element: "textarea"
  }, inputProps)), /*#__PURE__*/React.createElement(ValidationText, {
    error: error,
    help: helpText,
    inverse: inverse,
    success: success,
    warning: warning
  }));
});
Textarea.displayName = 'TextArea';
export default Textarea;