import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
import React from 'react';
var FormContext = React.createContext({});
export default FormContext;
export function connect(Component) {
  function WrappedField(props) {
    var forwardedRef = props.forwardedRef,
        other = _objectWithoutProperties(props, ["forwardedRef"]);

    return React.createElement(FormContext.Consumer, null, function (context) {
      return React.createElement(Component, _extends({}, context, other, {
        ref: forwardedRef
      }));
    });
  }

  function forwardRef(props, ref) {
    return React.createElement(WrappedField, _extends({}, props, {
      forwardedRef: ref
    }));
  } // Give this component a more helpful display name in DevTools.


  var name = Component.displayName || Component.name;
  forwardRef.displayName = "WithFormValues(".concat(name, ")");
  return React.forwardRef(forwardRef);
}