"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.TextArea = exports.TEXTAREA_RESIZE_VALUES = void 0;
var _classnames = _interopRequireDefault(require("classnames"));
var _react = _interopRequireWildcard(require("react"));
var _formField = require("../form-field");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const TEXTAREA_RESIZE_VALUES = exports.TEXTAREA_RESIZE_VALUES = {
  VERTICAL: 'vertical',
  HORIZONTAL: 'horizontal'
};
/**
 * TextArea component, which supports label, helper text and validation
 * [CAPITALIZATION] Use sentence case for label and placeholder, no colon
 * [CAPITALIZATION] Helper text, in most cases, should be a complete sentence with a period
export function TextArea(props: FormFieldProps) {
 * [CAPITALIZATION] Don't have mixed format in one text block, use sentence case
 */
const TextArea = exports.TextArea = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
  const {
    fieldClass,
    useFont,
    allowResizing,
    ...rest
  } = props;
  const fieldClassName = (0, _classnames.default)('text-area', fieldClass, {
    'no-font': !useFont,
    'vertical-resize': allowResizing === TEXTAREA_RESIZE_VALUES.VERTICAL,
    'horizontal-resize': allowResizing === TEXTAREA_RESIZE_VALUES.HORIZONTAL,
    'no-resize': !allowResizing
  });
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_formField.FormField, {
    ...rest,
    fieldClass: fieldClassName,
    children: /*#__PURE__*/(0, _jsxRuntime.jsx)("textarea", {
      ref: ref
    })
  });
});
TextArea.displayName = 'TextArea';
TextArea.defaultProps = {
  value: '',
  label: '',
  helperText: '',
  fieldClass: '',
  className: '',
  isDisabled: false,
  autoFocus: false,
  labelIcon: null,
  placeholder: '',
  required: false,
  useFont: true,
  onChange() {},
  onBlur() {},
  onFocus() {},
  allowResizing: true
};