import { jsx as _jsx } from "react/jsx-runtime";
import { filterUndefined, runIfFn } from '../utils';
import { PopoverProvider } from './context';
import PopoverContent from './popoverContent';
import PopoverTrigger from './popoverTrigger';
import usePopover from './usePopover';
/**
 * Uses 'usePopover' hook to expose relevant data to its children parts.
 * By default, renders provided content only when popover is opened (lazy).
 */
export default function Popover(props) {
    const { children, isLazy = true, options, ...rest } = props;
    const popoverProps = usePopover({ options, ...rest });
    const { close, isOpen, open } = popoverProps;
    const context = filterUndefined({ isLazy, ...popoverProps });
    return _jsx(PopoverProvider, { value: context, children: runIfFn(children, { close, isOpen, open }) });
}
Popover.Content = PopoverContent;
Popover.Trigger = PopoverTrigger;
Popover.displayName = 'Popover';
//# sourceMappingURL=popover.js.map