import { jsx, jsxs } from "react/jsx-runtime";
import { memo } from "react";
import { Close } from "@elliemae/ds-icons";
import { DSButtonV2 } from "@elliemae/ds-button";
import {
  DSDialog,
  DSDialogHeader,
  DSDialogBody,
  DSDialogFooter,
  DSDialogSeparator,
  DSDialogAddon
} from "@elliemae/ds-dialog";
import { useAppDispatch } from "../../../data/react.js";
import { navigationPrompt } from "../../../data/navigation-prompt/actions.js";
const NavigationPrompt = memo(
  ({ open = false }) => {
    const dispatch = useAppDispatch();
    const cancelDialog = () => dispatch(navigationPrompt.cancel());
    const confirmDialog = () => dispatch(navigationPrompt.confirm());
    return /* @__PURE__ */ jsxs(DSDialog, { isOpen: open, onClickOutside: cancelDialog, centered: true, children: [
      /* @__PURE__ */ jsx(DSDialogHeader, { children: /* @__PURE__ */ jsx(DSDialogAddon, { children: /* @__PURE__ */ jsx(DSButtonV2, { buttonType: "icon", onClick: cancelDialog, children: /* @__PURE__ */ jsx(Close, { color: ["neutral", "900"] }) }) }) }),
      /* @__PURE__ */ jsx(DSDialogSeparator, {}),
      /* @__PURE__ */ jsx(DSDialogBody, { px: 24, mb: 16, children: "You currently have unsaved changes. Are you sure you want to proceed without saving?" }),
      /* @__PURE__ */ jsx(DSDialogSeparator, {}),
      /* @__PURE__ */ jsxs(DSDialogFooter, { children: [
        /* @__PURE__ */ jsx(DSButtonV2, { buttonType: "outline", onClick: cancelDialog, children: "Continue without saving" }),
        /* @__PURE__ */ jsx(DSButtonV2, { onClick: confirmDialog, children: "Save & Continue" })
      ] })
    ] });
  }
);
export {
  NavigationPrompt
};
