UNPKG

@mantine/core

Version:

React components library focused on usability, accessibility and developer experience

28 lines (27 loc) 1.5 kB
"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_use_context_menu_handlers = require("../../../utils/Floating/use-context-menu-handlers.cjs"); let react = require("react"); //#region packages/@mantine/core/src/components/Popover/PopoverContextMenu/PopoverContextMenu.tsx function PopoverContextMenu(props) { const { children, disabled, longPressDelay } = 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_use_context_menu_handlers.useContextMenuHandlers({ childProps: child.props, disabled: disabled || ctx.disabled, opened: ctx.opened, longPressDelay, setReference: ctx.reference, open: () => { if (!ctx.opened) ctx.onToggle(); } })); } PopoverContextMenu.displayName = "@mantine/core/PopoverContextMenu"; //#endregion exports.PopoverContextMenu = PopoverContextMenu; //# sourceMappingURL=PopoverContextMenu.cjs.map