import { slicedToArray as _slicedToArray, objectSpread2 as _objectSpread2 } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
import Case from '../../../../node_modules/case/dist/Case.esm.js';
import { useField } from 'formik';

function useConnectedField(propsOrFieldName) {
  var name = typeof propsOrFieldName === "string" ? propsOrFieldName : propsOrFieldName.name;
  var id = "".concat(name, "Field");
  var label = Case.sentence(name);

  var _useField = useField(propsOrFieldName),
      _useField2 = _slicedToArray(_useField, 3),
      field = _useField2[0],
      meta = _useField2[1],
      helpers = _useField2[2];

  var connectedProps = _objectSpread2({}, field, {
    id: id,
    label: label,
    error: meta.touched ? meta.error : ""
  });

  return [connectedProps, field, meta, helpers];
}

export { useConnectedField };
//# sourceMappingURL=useConnectedField.esm.js.map
