import { jsx as _jsx } from "react/jsx-runtime";
import Box from '../box';
import { useStyleConfig, v, vui } from '../core';
import { cs, mergeRefs } from '../utils';
import { usePopoverContext } from './context';
/** Displays provided content in an overlaying wrapper. */
export const PopoverContent = vui((props, ref) => {
    const { children, className, ...rest } = props;
    const popoverProps = usePopoverContext() ?? {};
    const { isLazy, isOpen, setPopper } = popoverProps;
    const styles = useStyleConfig('Popover', { ...popoverProps, ...props });
    const shouldRenderChildren = isLazy ? isOpen : true;
    return (
    // Wrapping div prevents an error thrown when conditionally unmounting this component
    _jsx(v.div, { className: "vui-popoverContainer", ring: 0, children: _jsx(Box, { bg: "white", borderRadius: "md", boxShadow: "2", className: cs('vui-popoverContent', className), overflowY: "auto", ref: mergeRefs(setPopper, ref), ring: 0, ...styles.content, ...rest, children: shouldRenderChildren ? children : null }) }));
});
PopoverContent.displayName = 'PopoverContent';
export default PopoverContent;
//# sourceMappingURL=popoverContent.js.map