import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
import { forwardRef } from 'react';
import { useFormikContext } from 'formik';
import { B as Button } from '../Button-DSvnInaL.js';
import { c as cn } from '../utils-DdHUxIdC.js';
import { FormikButton } from './Button.js';
import 'react-router-dom';
import '../renderIcon-tlvMyboj.js';
import '../primitives/Button.js';
import '../button-D6uWDFCs.js';
import '../index-D7Zy7P05.js';
import '../index-CfriMyrd.js';
import '../index-BtkPdosV.js';
import '../primitives/Spinner.js';
import 'react-i18next';
import '../loader-circle-DycHUAWN.js';
import '../createLucideIcon-C8ycilSN.js';
import '../primitives/Tooltip.js';
import '../tooltip-XkHLgxlU.js';
import '../index-DNzunGHb.js';
import '../index-CiyxEyB0.js';
import '../index-BNPynZWM.js';
import '../index-DhnfW8wQ.js';
import 'react-dom';
import '../index-CSUSJzOJ.js';
import '../index-zW4GjM5L.js';
import '../index-DOzu5J1s.js';
import '../index-C3hByjk3.js';
import '../floating-ui.react-dom-D8_f_WWh.js';
import '../index-BYZaLNq1.js';
import '../index-fV_U4ZJM.js';
import '../index-yFgkK_AM.js';
import '../index-Cor698lu.js';
import '../index-CSggBaQF.js';
import 'ramda';

const FormikActionBlock = forwardRef(({ className, submitButtonProps, cancelButtonProps, isSubmitting: isSubmittingProp, position = "left", }, ref) => {
    const { handleReset, isSubmitting: isFormikSubmitting } = useFormikContext();
    const isSubmitting = isSubmittingProp ?? isFormikSubmitting;
    const cancelButton = (jsx(Button, { "data-testid": "cancel-button", disabled: isSubmitting, label: "Cancel", variant: "ghost", onClick: handleReset, onMouseDown: (e) => e.preventDefault(), ...cancelButtonProps }));
    const submitButton = (jsx(FormikButton, { "data-testid": "save-changes-button", label: "Save changes", type: "submit", ...submitButtonProps }));
    return (jsx("div", { ref: ref, className: cn("flex items-center gap-2", position === "right" && "justify-end", className), children: position === "right" ? (jsxs(Fragment, { children: [cancelButton, submitButton] })) : (jsxs(Fragment, { children: [submitButton, cancelButton] })) }));
});
FormikActionBlock.displayName = "FormikActionBlock";

export { FormikActionBlock };
//# sourceMappingURL=ActionBlock.js.map
