'use strict';

var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
var React = require('react');
var formik = require('formik');
var ramda = require('ramda');
var Button = require('../Button.js');
var jsxRuntime = require('react/jsx-runtime');
require('classnames');
require('react-router-dom');
require('../Spinner.js');
require('../Tooltip.js');
require('@babel/runtime/helpers/slicedToArray');
require('@tippyjs/react');
require('tippy.js');
require('@bigbinary/neeto-hotkeys');
require('../overlayManager.js');
require('@babel/runtime/helpers/classCallCheck');
require('@babel/runtime/helpers/createClass');
require('@bigbinary/neeto-cist');
require('qs');
require('../index-BgzkP01c.js');
require('@babel/runtime/helpers/toConsumableArray');
require('dayjs');
require('dayjs/plugin/localeData');
require('dayjs/plugin/utc');
require('dayjs/plugin/weekday');
require('dayjs/plugin/weekOfYear');
require('i18next');
require('../usePrefersReducedMotion-D2Ck84HM.js');

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var _defineProperty__default = /*#__PURE__*/_interopDefault(_defineProperty);
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefault(_objectWithoutProperties);

var _excluded = ["disabled"];
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty__default.default(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var FormikButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
  var disabled = _ref.disabled,
    otherProps = _objectWithoutProperties__default.default(_ref, _excluded);
  var _useFormikContext = formik.useFormikContext(),
    handleSubmit = _useFormikContext.handleSubmit,
    isSubmitting = _useFormikContext.isSubmitting,
    values = _useFormikContext.values,
    initialValues = _useFormikContext.initialValues,
    isValid = _useFormikContext.isValid;
  var isDisabled = disabled !== null && disabled !== void 0 ? disabled : isSubmitting || ramda.equals(values, initialValues);
  return /*#__PURE__*/jsxRuntime.jsx(Button, _objectSpread({
    ref: ref,
    disabled: isDisabled,
    loading: isSubmitting && isValid,
    onClick: handleSubmit
  }, otherProps));
});
FormikButton.displayName = "FormikButton";

module.exports = FormikButton;
//# sourceMappingURL=Button.js.map
