"use client";
const require_get_single_element_child = require("../../../core/utils/get-single-element-child/get-single-element-child.cjs");
const require_use_props = require("../../../core/MantineProvider/use-props/use-props.cjs");
const require_Popover_context = require("../Popover.context.cjs");
const require_create_context_menu_handlers = require("../../../utils/Floating/create-context-menu-handlers.cjs");
let react = require("react");
//#region packages/@mantine/core/src/components/Popover/PopoverContextMenu/PopoverContextMenu.tsx
function PopoverContextMenu(props) {
	const { children, disabled } = require_use_props.useProps("PopoverContextMenu", null, props);
	const child = require_get_single_element_child.getSingleElementChild(children);
	if (!child) throw new Error("Popover.ContextMenu component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");
	const ctx = require_Popover_context.usePopoverContext();
	return (0, react.cloneElement)(child, require_create_context_menu_handlers.createContextMenuHandlers({
		childProps: child.props,
		disabled: disabled || ctx.disabled,
		opened: ctx.opened,
		setReference: ctx.reference,
		open: () => {
			if (!ctx.opened) ctx.onToggle();
		}
	}));
}
PopoverContextMenu.displayName = "@mantine/core/PopoverContextMenu";
//#endregion
exports.PopoverContextMenu = PopoverContextMenu;

//# sourceMappingURL=PopoverContextMenu.cjs.map