import { jsx as _jsx } from "react/jsx-runtime";
import { ControlledMenu } from "./ControlledMenu.js";
import { MenuState } from "./MenuState.js";
const DEFAULT_ALIGNMENT = ["bottom", "right"];
/**
 * @internal
 */
export function Menu({ alignment = DEFAULT_ALIGNMENT, children, closeOnScroll = false, defaultOpened, offset, onOpenedChange, openAction = "click", opened, portalTarget, spacing, toggler, togglerWrapperClassName, }) {
    return (_jsx(MenuState, { opened: opened, defaultOpened: defaultOpened, onOpenedChange: onOpenedChange, children: (controlledProps) => (_jsx(ControlledMenu, { opened: controlledProps.opened, onOpenedChange: controlledProps.onOpenedChange, openAction: openAction, alignment: alignment, spacing: spacing, offset: offset, toggler: toggler, togglerWrapperClassName: togglerWrapperClassName, portalTarget: portalTarget, closeOnScroll: closeOnScroll, children: typeof children === "function"
                ? children({
                    closeMenu: () => controlledProps.onOpenedChange({
                        opened: false,
                        source: "CLOSE_MENU_RENDER_PROP",
                    }),
                })
                : children })) }));
}
