import { runIfFn } from "../utils/function.js";
import { filterUndefined } from "../utils/object.js";
import { PopoverProvider } from "./context.js";
import PopoverContent from "./popoverContent.js";
import PopoverTrigger from "./popoverTrigger.js";
import usePopover from "./usePopover.js";
import { jsx } from "react/jsx-runtime";

//#region src/popover/popover.tsx
/**
* Uses 'usePopover' hook to expose relevant data to its children parts.
* By default, renders provided content only when popover is opened (lazy).
*/
function Popover(props) {
	const { children, isLazy = true, ...rest } = props;
	const popoverProps = usePopover(rest);
	const { close, isOpen, open } = popoverProps;
	return /* @__PURE__ */ jsx(PopoverProvider, {
		value: filterUndefined({
			isLazy,
			...popoverProps
		}),
		children: runIfFn(children, {
			close,
			isOpen,
			open
		})
	});
}
Popover.Content = PopoverContent;
Popover.Trigger = PopoverTrigger;
Popover.displayName = "Popover";

//#endregion
export { Popover as default };
globalThis.__vuiVersion__ = "4.0.0"
//# sourceMappingURL=popover.js.map