import React, { useEffect, useState } from 'react';
import { UdpFluentDrawer as UdpFluentDrawerWebComponent } from 'udp-react-stencil-component-library';
export const UdpDrawer = (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(UdpFluentDrawerWebComponent, Object.assign({}, props), shouldRender ? props.children : null));
};
//# sourceMappingURL=UdpDrawer.js.map