/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
"use client";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
require("../../../_virtual/_rolldown/runtime.cjs");
const require_styles_styler = require("../../../styles/styler.cjs");
const require_components_Box = require("../../Box.cjs");
let react = require("react");
let react_jsx_runtime = require("react/jsx-runtime");
let _ariakit_react_menu = require("@ariakit/react/menu");
//#region src/components/client/Menu/Menu.Trigger.tsx
/**
* **⚡ A Menu Trigger component**
*
* @componentType Server component
*
* @description
* A trigger component for the menu, which is used to toggle the menus open state.
*
* @see The {@link https://uds.build/docs/components/menu-trigger Menu.Trigger Docs} for more info
*
* @example
* ```tsx
* 'use client'; // Next.js client component
*
* import { Menu, Button } from "@yahoo/uds";
* import { Calendar, Clipboard } from "@yahoo/uds-icons";
*
* export function MenuProviderExample() {
*   return (
*     <Menu.Provider>
*       <Menu.Trigger asChild>
*         <Button>Menu Options</Button>
*       </Menu.Trigger>
*       <Menu.Content>
*         <Menu.Item startIcon={Calendar}>Calendar</Menu.Item>
*         <Menu.Item startIcon={Clipboard} endIcon={DiagonalRightUp}>
*           Clipboard
*         </Menu.Item>
*         <Menu.Item active>Active Item</Menu.Item>
*       </Menu.Content>
*     </Menu.Provider>
*   )
* }
* ```
*
* @usage
* Use MenuTrigger to toggle the open state of a menu.
*
* @related [Menu](https://uds.build/docs/components/menu), [Menu.ItemCheckbox](https://uds.build/docs/components/menu-item-checkbox)
**/
const MenuTrigger = (0, react.forwardRef)(function MenuTrigger({ asChild, children, className, ...props }, ref) {
	const slotRef = (0, react.useRef)(null);
	const renderProps = asChild ? { render: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Box.Box, {
		asChild: true,
		ref: slotRef,
		className: "uds-ring h-fit w-fit",
		children
	}) } : { children };
	const handleFocusVisible = (0, react.useCallback)(() => {
		const firstChild = slotRef.current?.firstChild;
		if (firstChild instanceof HTMLElement && typeof firstChild.focus === "function") firstChild.focus();
	}, [slotRef]);
	return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ariakit_react_menu.MenuButton, {
		onFocus: handleFocusVisible,
		onFocusVisible: handleFocusVisible,
		ref,
		className: require_styles_styler.cx("uds-menu-trigger", className),
		...renderProps,
		...props
	});
});
MenuTrigger.displayName = "MenuTrigger";
//#endregion
exports.MenuTrigger = MenuTrigger;
