import _defineProperty from '@babel/runtime/helpers/defineProperty';
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
import { forwardRef } from 'react';
import { useFormikContext } from 'formik';
import { equals } from 'ramda';
import Button from '../Button.js';
import { jsx } from 'react/jsx-runtime';
import 'classnames';
import 'react-router-dom';
import '../Spinner.js';
import '../Tooltip.js';
import '@babel/runtime/helpers/slicedToArray';
import '@tippyjs/react';
import 'tippy.js';
import '@bigbinary/neeto-hotkeys';
import '../overlayManager.js';
import '@babel/runtime/helpers/classCallCheck';
import '@babel/runtime/helpers/createClass';
import '@bigbinary/neeto-cist';
import 'qs';
import '../index-DyUNP5G9.js';
import '@babel/runtime/helpers/toConsumableArray';
import 'dayjs';
import 'dayjs/plugin/localeData';
import 'dayjs/plugin/utc';
import 'dayjs/plugin/weekday';
import 'dayjs/plugin/weekOfYear';
import 'i18next';
import '../usePrefersReducedMotion-n4ZJtExQ.js';

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(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__*/forwardRef(function (_ref, ref) {
  var disabled = _ref.disabled,
    otherProps = _objectWithoutProperties(_ref, _excluded);
  var _useFormikContext = 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 || equals(values, initialValues);
  return /*#__PURE__*/jsx(Button, _objectSpread({
    ref: ref,
    disabled: isDisabled,
    loading: isSubmitting && isValid,
    onClick: handleSubmit
  }, otherProps));
});
FormikButton.displayName = "FormikButton";

export { FormikButton as default };
//# sourceMappingURL=Button.js.map
