/*! © 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_client_Pressable = require("../Pressable.cjs");
const require_components_IconSlot = require("../../IconSlot.cjs");
const require_components_HStack = require("../../HStack.cjs");
let react = require("react");
let react_jsx_runtime = require("react/jsx-runtime");
let motion_react = require("motion/react");
//#region src/components/client/Menu/Menu.ItemBase.tsx
const ITEM_CLASS_NAME = "uds-menu-item";
const iconAnimationVariants = {
	visible: {
		scale: 1,
		opacity: 1
	},
	hidden: {
		scale: .7,
		opacity: 0
	}
};
/** Builds the class names for the menu item */
const buildMenuItemClasses = ({ active, disabled, className }) => {
	return require_styles_styler.cx(ITEM_CLASS_NAME, "flex", "focus-visible:text-brand", "focus-visible:bg-brand-secondary", "focus-visible:z-10", "uds-ring", "!-outline-offset-2", active && ["[&:not([aria-checked])]:cursor-default"], disabled && "opacity-25 cursor-not-allowed", "duration-20 transition-[font-variation-settings] ease-in-out", "z-0", className);
};
/**
* @private This is an internal component shared by [Menu.Item](https://uds.build/docs/components/menu#menu-item) and [Menu.ItemCheckbox](https://uds.build/docs/components/menu#menu-item-checkbox)
* and may change without notice. Please do not use this component directly.
*/
const MenuItemBase = (0, react.forwardRef)(function MenuItemBase({ spacing = "0", spacingBottom, spacingEnd, spacingHorizontal = "4", spacingStart, spacingTop, spacingVertical = "3.5", columnGap = "2", className, children, endIcon, startIcon, hideEndIcon, active, disabled, multiline, as: RootComponent, name, alignItems = "center", justifyContent = "space-between", slotProps, slots, rootProps, ...props }, ref) {
	const hasMultipleChildren = react.Children.count(children) > 1;
	const menuItemClassName = buildMenuItemClasses({
		active,
		disabled,
		className
	});
	const { className: rootClassName, ...rootSlotProps } = slotProps?.root ?? {};
	const { className: textClassName, ...textSlotProps } = slotProps?.text ?? {};
	const { className: startIconClassName, ...startIconSlotProps } = slotProps?.startIcon ?? {};
	const { className: endIconClassName, ...endIconSlotProps } = slotProps?.endIcon ?? {};
	/**
	* Get content styles based on children layout needs
	*/
	const contentStyles = require_styles_styler.getStyles({
		className: require_styles_styler.cx(`${ITEM_CLASS_NAME}-content`, !multiline && "truncate", textClassName),
		textAlign: "start",
		...hasMultipleChildren && {
			columnGap,
			display: "flex",
			alignItems: "center",
			width: "full",
			justifyContent: "space-between"
		}
	});
	/**
	* Styles
	*/
	const classNames = (0, react.useMemo)(() => ({
		root: require_styles_styler.getStyles({
			menuitemSizeRoot: "default",
			flexDirection: "row",
			spacing,
			spacingBottom,
			spacingEnd,
			spacingHorizontal,
			spacingStart,
			spacingTop,
			spacingVertical,
			columnGap,
			alignItems,
			justifyContent,
			className: require_styles_styler.cx(menuItemClassName, rootClassName)
		}),
		startIcon: require_styles_styler.getStyles({
			menuitemSizeStartIcon: "default",
			className: startIconClassName
		}),
		endIcon: require_styles_styler.getStyles({
			menuitemSizeEndIcon: "default",
			className: endIconClassName
		})
	}), [
		alignItems,
		columnGap,
		justifyContent,
		endIconClassName,
		rootClassName,
		startIconClassName,
		menuItemClassName,
		spacing,
		spacingBottom,
		spacingEnd,
		spacingHorizontal,
		spacingStart,
		spacingTop,
		spacingVertical
	]);
	const rootRender = slots?.root ?? ((p) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_Pressable.Pressable, {
		...p,
		...props,
		onClick: (e) => {
			p.onClick?.(e);
			props.onClick?.(e);
		}
	}));
	return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(RootComponent, {
		ref,
		name: name ?? "",
		...rootProps,
		render: rootRender,
		disabled,
		className: classNames.root,
		...rootSlotProps,
		children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_HStack.HStack, {
			gap: columnGap,
			alignItems: "center",
			width: "full",
			children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.AnimatePresence, {
				initial: false,
				children: startIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.m.span, {
					variants: iconAnimationVariants,
					initial: "hidden",
					animate: "visible",
					exit: "hidden",
					className: "uds-start-icon",
					children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
						icon: startIcon,
						className: classNames.startIcon,
						iconProps: {
							size: "sm",
							variant: active ? "fill" : "outline",
							color: "current",
							...endIconSlotProps,
							...startIconSlotProps
						}
					})
				})
			}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
				className: contentStyles,
				...textSlotProps,
				children
			})]
		}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.AnimatePresence, {
			initial: false,
			mode: "popLayout",
			children: !hideEndIcon && endIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.m.span, {
				variants: iconAnimationVariants,
				initial: "hidden",
				animate: "visible",
				exit: "hidden",
				className: "uds-end-icon",
				children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
					icon: endIcon,
					className: classNames.endIcon,
					iconProps: {
						size: "sm",
						variant: active ? "fill" : "outline",
						color: "current"
					}
				})
			})
		})]
	});
});
MenuItemBase.displayName = "MenuItemBase";
//#endregion
exports.ITEM_CLASS_NAME = ITEM_CLASS_NAME;
exports.MenuItemBase = MenuItemBase;
