import { mergeRefs } from "../utils/react.js";
import { cs } from "../utils/styles.js";
import "../utils/index.js";
import { useStyleConfig } from "../core/theme.js";
import { vui } from "../core/vui.js";
import box_default from "../box/box.js";
import "../box/index.js";
import "../core/index.js";
import { usePopoverContext } from "./context.js";
import { jsx } from "react/jsx-runtime";
import { FloatingFocusManager, FloatingPortal } from "@floating-ui/react";

//#region src/popover/popoverContent.tsx
/** Displays provided content in an overlaying wrapper. */
const PopoverContent = vui((props, ref) => {
	const { children, className, ...rest } = props;
	const popoverProps = usePopoverContext() ?? {};
	const { context, floatingStyles, getFloatingProps, isLazy, isMounted, isOpen, setPopper, transitionStyles } = popoverProps;
	const styles = useStyleConfig("Popover", {
		...popoverProps,
		...props
	});
	const shouldRenderChildren = isLazy ? isOpen : true;
	if (!isMounted) return null;
	return /* @__PURE__ */ jsx(FloatingPortal, { children: /* @__PURE__ */ jsx(FloatingFocusManager, {
		context,
		modal: false,
		children: /* @__PURE__ */ jsx(box_default, {
			bg: "white",
			borderRadius: "md",
			boxShadow: "2",
			className: cs("vui-popoverContent", className),
			overflowY: "auto",
			ref: mergeRefs(setPopper, ref),
			ring: 0,
			style: {
				...floatingStyles,
				...transitionStyles
			},
			...getFloatingProps?.() ?? {},
			...styles.content,
			...rest,
			children: shouldRenderChildren ? children : null
		})
	}) });
});
PopoverContent.displayName = "PopoverContent";
var popoverContent_default = PopoverContent;

//#endregion
export { popoverContent_default as default };
globalThis.__vuiVersion__ = "4.0.0-beta.1"
//# sourceMappingURL=popoverContent.js.map