New source found from dndbeyond.com
This commit is contained in:
+6
-1
@@ -15,6 +15,7 @@ export interface DialogProps extends HTMLAttributes<HTMLDialogElement> {
|
||||
open: boolean;
|
||||
onClose: (e?: MouseEvent) => void;
|
||||
modal?: boolean;
|
||||
onBackdropClick?: () => void;
|
||||
}
|
||||
|
||||
export const Dialog: React.FC<DialogProps> = ({
|
||||
@@ -23,6 +24,7 @@ export const Dialog: React.FC<DialogProps> = ({
|
||||
modal,
|
||||
children,
|
||||
className,
|
||||
onBackdropClick,
|
||||
...props
|
||||
}) => {
|
||||
const dialogRef = useRef<HTMLDialogElement>(null);
|
||||
@@ -46,7 +48,10 @@ export const Dialog: React.FC<DialogProps> = ({
|
||||
rect.left <= e.clientX &&
|
||||
e.clientX <= rect.left + rect.width;
|
||||
|
||||
if (!isClickInDialog) handleClose();
|
||||
if (!isClickInDialog) {
|
||||
onBackdropClick?.();
|
||||
handleClose();
|
||||
}
|
||||
};
|
||||
|
||||
const handleEsc = (e: KeyboardEvent) => {
|
||||
|
||||
Reference in New Issue
Block a user