import React from 'react';
import { isEmptyText } from '../../utils/validate';
import FieldWrapper from './FieldWrapper';
import withField from './withField'; // input field that applies state-template styling

var FieldInput = function FieldInput(props) {
  var input = props.input,
      type = props.type,
      disabled = props.disabled;
  var name = input.name;
  var Control = type === 'textarea' ? 'textarea' : 'input';
  return React.createElement(FieldWrapper, props, React.createElement(Control, Object.assign({
    type: type,
    className: "form-control",
    id: name,
    disabled: disabled
  }, input)));
};

FieldInput.defaultProps = {
  type: 'text',
  disabled: false
};
var withReduxField = withField(isEmptyText);
export default withReduxField(FieldInput);