const minModalHeight = 40;
const minOffsetY = 8;
export const setModalPosition = (container, modal) => {
    if (!container.current)
        return;
    if (!modal.current)
        return;
    const containerRect = container.current.getBoundingClientRect();
    modal.current.style.left = `${containerRect.left}px`;
    modal.current.style.top = `${containerRect.top + containerRect.height}px`;
    modal.current.style.width = `${containerRect.width}px`;
    if (globalThis.innerHeight - containerRect.bottom < minModalHeight) {
        modal.current.style.height = `${2 * minModalHeight}px`;
        modal.current.style.top = `${containerRect.top + containerRect.height - 2 * minModalHeight}px`;
    }
    else {
        modal.current.style.maxHeight = `calc(100vh - ${containerRect.height + containerRect.top + minOffsetY}px)`;
    }
};
export const showModal = (modal) => {
    if (!modal.current)
        return;
    modal.current.style.opacity = "1";
};
//# sourceMappingURL=util.js.map