import React, { useEffect, useState } from 'react';
import { UdpFluentDialog as UdpFluentDialogWebComponent } from 'udp-react-stencil-component-library';
export const UdpDialog = (props) => {
    const [shouldRender, setShouldRender] = useState(props.open);
    // Immediately allow rendering when opened (no effect needed)
    if (props.open && !shouldRender) {
        setShouldRender(true);
    }
    // Delay unmounting on close to allow exit animation
    useEffect(() => {
        if (!props.open && shouldRender) {
            const timeoutId = setTimeout(() => {
                setShouldRender(false);
            }, 500);
            return () => clearTimeout(timeoutId);
        }
    }, [props.open, shouldRender]);
    return (React.createElement(UdpFluentDialogWebComponent, Object.assign({}, props), shouldRender ? props.children : null));
};
//# sourceMappingURL=UdpDialog.js.map