import React, { memo, useEffect, useRef } from 'react';
// eslint-disable-next-line prefer-arrow-callback
export default memo(function ModalDialog({ onClose, className, children }) {
    const ref = useRef(null);
    useEffect(() => {
        if (ref.current) {
            ref.current.showModal();
            document.documentElement.style.overflow = 'hidden';
            ref.current.addEventListener('close', onClose);
        }
        return () => {
            var _a;
            (_a = ref.current) === null || _a === void 0 ? void 0 : _a.close();
            document.documentElement.style.overflow = '';
        };
    }, []);
    return (React.createElement("dialog", { ref: ref, className: className }, children));
});
//# sourceMappingURL=ModalDialog.js.map