import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
var _excluded = ["action"];
import * as React from 'react';
import { useFormikContext } from './FormikContext';
// @todo tests
export var Form = /*#__PURE__*/React.forwardRef(function (props, ref) {
  // iOS needs an "action" attribute for nice input: https://stackoverflow.com/a/39485162/406725
  // We default the action to "#" in case the preventDefault fails (just updates the URL hash)
  var action = props.action,
    rest = _objectWithoutProperties(props, _excluded);
  var _action = action !== null && action !== void 0 ? action : '#';
  var _useFormikContext = useFormikContext(),
    handleReset = _useFormikContext.handleReset,
    handleSubmit = _useFormikContext.handleSubmit;
  return /*#__PURE__*/React.createElement("form", _extends({
    onSubmit: handleSubmit,
    ref: ref,
    onReset: handleReset,
    action: _action
  }, rest));
});
Form.displayName = 'Form';