UNPKG

synapse-react-client

Version:

[![npm version](https://badge.fury.io/js/synapse-react-client.svg)](https://badge.fury.io/js/synapse-react-client) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettie

77 lines (76 loc) 2.3 kB
import { jsxs as l, Fragment as d, jsx as t } from "react/jsx-runtime"; import { hasDifference as f } from "../../utils/functions/ArrayUtils.js"; import { Box as m, Typography as s } from "@mui/material"; import { useState as a, useEffect as h, useMemo as u } from "react"; import { ConfirmationDialog as C } from "../ConfirmationDialog/ConfirmationDialog.js"; import { WarningDialog as g } from "../SynapseForm/WarningDialog.js"; import { EntityFinder as S } from "./EntityFinder.js"; const y = "Unsaved Changes", A = (e) => { const [n, o] = a([]); h(() => { e.initialSelected && o(e.initialSelected); }, [e.initialSelected]); const [r, i] = a(!1), c = u(() => e.initialSelected == null ? n.length > 0 : f(e.initialSelected, n), [e.initialSelected, n]); return /* @__PURE__ */ l(d, { children: [ /* @__PURE__ */ t( g, { title: y, content: "Any unsaved changes will be lost. Are you sure you want to close the finder?", open: r, confirmButtonText: "Close Finder", onConfirm: () => { i(!1), e.onCancel(); }, onCancel: () => { i(!1); } } ), /* @__PURE__ */ t( C, { open: e.show, title: e.title, fullWidth: !1, maxWidth: "xl", titleHelpPopoverProps: e.titleHelpPopoverProps, confirmButtonProps: { children: e.confirmButtonCopy }, onConfirm: () => { e.onConfirm(n); }, onCancel: () => { c ? i(!0) : e.onCancel(); }, content: /* @__PURE__ */ l(m, { children: [ /* @__PURE__ */ t( s, { variant: "body1", sx: { mb: "10px", // Do not allow the help text to expand the dialog width minWidth: "100%", width: 0 }, children: e.promptCopy } ), /* @__PURE__ */ t( S, { ...e.configuration, initialSelected: e.initialSelected, onSelectedChange: o } ) ] }) } ) ] }); }; export { A as EntityFinderModal, y as UNSAVED_CHANGES }; //# sourceMappingURL=EntityFinderModal.js.map