fix confirm close dialog + add restart confirm dialog (#12761)
Test: - On upload > No dialog at modal closing - On match > Confirm cancel dialog at closing (escape, click outside, cancel cross) - On match > Restart dialog at Restart Import - On validation > Confirm cancel dialog at closing (escape, click outside, cancel cross) - On import > Confirm cancel dialog at closing (escape, click outside, cancel cross) - On import > No confirm at import end closes : https://github.com/twentyhq/core-team-issues/issues/1071
This commit is contained in:
@ -195,6 +195,7 @@ export type ModalProps = React.PropsWithChildren & {
|
||||
onEnter?: () => void;
|
||||
modalVariant?: ModalVariants;
|
||||
dataGloballyPreventClickOutside?: boolean;
|
||||
shouldCloseModalOnClickOutsideOrEscape?: boolean;
|
||||
} & (
|
||||
| { isClosable: true; onClose?: () => void }
|
||||
| { isClosable?: false; onClose?: never }
|
||||
@ -217,6 +218,7 @@ export const Modal = ({
|
||||
onClose,
|
||||
modalVariant = 'primary',
|
||||
dataGloballyPreventClickOutside = false,
|
||||
shouldCloseModalOnClickOutsideOrEscape = true,
|
||||
}: ModalProps) => {
|
||||
const isMobile = useIsMobile();
|
||||
const modalRef = useRef<HTMLDivElement>(null);
|
||||
@ -236,7 +238,7 @@ export const Modal = ({
|
||||
|
||||
const handleClose = () => {
|
||||
onClose?.();
|
||||
closeModal(modalId);
|
||||
if (shouldCloseModalOnClickOutsideOrEscape) closeModal(modalId);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user