import React, { useCallback, useMemo, useRef } from 'react';
import { PopupBoundariesContext } from '../contexts/PopupBoundariesContext';
import styles from './QuickFiltersFacetPanel.module.css';
export var QuickFiltersFacetPanel = function (_a) {
    var children = _a.children, onScroll = _a.onScroll;
    var containerRef = useRef(null);
    var onContainerScroll = useCallback(function (e) {
        onScroll === null || onScroll === void 0 ? void 0 : onScroll(containerRef.current.scrollTop, e);
    }, [onScroll]);
    var boundariesElement = containerRef.current;
    var popupBoundariesValue = useMemo(function () { return ({
        element: boundariesElement,
        priority: ['top', 'bottom']
    }); }, [boundariesElement]);
    return (React.createElement("div", { ref: containerRef, className: styles.root, onScroll: onContainerScroll },
        React.createElement(PopupBoundariesContext.Provider, { value: popupBoundariesValue }, children)));
};
