import { useFilterRenderingContext } from '../components/FilterRenderingContext';
import { useRef, useState } from 'react';
import { addResizeObserver } from '@wix/bex-core';
export function useWindowFlipPopoverProps({ popoverProps, }) {
    const { location } = useFilterRenderingContext();
    const inputRef = useRef();
    const [dropdownWidth, setDropdownWidth] = useState();
    addResizeObserver(inputRef.current, () => {
        if (inputRef.current) {
            setDropdownWidth(inputRef.current.width);
        }
    });
    return {
        inputRef,
        windowFlipPopoverProps: {
            appendTo: 'window',
            flip: true,
            fixed: false,
            maxWidth: dropdownWidth,
            ...(location === 'modal' && { zIndex: 5001 }),
            ...popoverProps,
        },
    };
}
//# sourceMappingURL=useWindowFlipPopoverProps.js.map