"use client";
const require_create_event_handler = require("../../../core/utils/create-event-handler/create-event-handler.cjs");
const require_use_props = require("../../../core/MantineProvider/use-props/use-props.cjs");
const require_factory = require("../../../core/factory/factory.cjs");
const require_Popover = require("../../Popover/Popover.cjs");
const require_Menu_context = require("../Menu.context.cjs");
const require_MenuSub_context = require("../MenuSub/MenuSub.context.cjs");
const require_Menu_module = require("../Menu.module.cjs");
const require_use_menu_type_ahead = require("../use-menu-type-ahead.cjs");
let react = require("react");
let _mantine_hooks = require("@mantine/hooks");
let react_jsx_runtime = require("react/jsx-runtime");
//#region packages/@mantine/core/src/components/Menu/MenuSubDropdown/MenuSubDropdown.tsx
const MenuSubDropdown = require_factory.factory((props) => {
	const { classNames, className, style, styles, vars, onMouseEnter, onMouseLeave, onPointerEnter, onPointerLeave, onKeyDown, children, ref, ...others } = require_use_props.useProps("MenuSubDropdown", null, props);
	const wrapperRef = (0, react.useRef)(null);
	const ctx = require_Menu_context.useMenuContext();
	const subCtx = (0, react.use)(require_MenuSub_context.SubMenuContext);
	const typeAhead = require_use_menu_type_ahead.useMenuTypeAhead({
		enabled: !ctx.hasSearch,
		opened: subCtx?.opened ?? false,
		getDropdown: () => wrapperRef.current
	});
	const handleKeyDown = require_create_event_handler.createEventHandler(onKeyDown, (event) => {
		typeAhead(event);
		if (!event.ctrlKey && !event.metaKey && !event.altKey && event.key.length === 1 && event.key !== " ") event.stopPropagation();
	});
	const floatingProps = subCtx?.getFloatingProps({
		onMouseEnter,
		onMouseLeave,
		onPointerEnter,
		onPointerLeave
	});
	return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Popover.Popover.Dropdown, {
		...others,
		...floatingProps,
		role: "menu",
		"aria-orientation": "vertical",
		ref: (0, _mantine_hooks.useMergedRef)(ref, wrapperRef, subCtx?.setFloating),
		...ctx.getStyles("dropdown", {
			className,
			style,
			styles,
			classNames,
			withStaticClass: false
		}),
		tabIndex: -1,
		"data-menu-dropdown": true,
		onKeyDown: handleKeyDown,
		children
	});
});
MenuSubDropdown.classes = require_Menu_module.default;
MenuSubDropdown.displayName = "@mantine/core/MenuSubDropdown";
//#endregion
exports.MenuSubDropdown = MenuSubDropdown;

//# sourceMappingURL=MenuSubDropdown.cjs.map