import { jsx as t, jsxs as d, Fragment as k } from "react/jsx-runtime";
import { useFocusRing as H } from "@react-aria/focus";
import { MenuItemContent as W } from "./MenuItemContent.es.js";
import O from "../../foundation/Icon/Generated/IconCaretRight.es.js";
import V from "../../foundation/Icon/Generated/IconCheckMark.es.js";
import { IconSize as A } from "../../foundation/Icon/IconSize.es.js";
import { getItemElementType as X } from "../../utilities/elements.es.js";
import { FOCUS_STYLE_NO_OFFSET as _ } from "../../utilities/focusStyle.es.js";
import { merge as i } from "../../utilities/merge.es.js";
import { MenuItemContentSize as a, MenuItemStyle as e, SelectionIndicatorIcon as m } from "./types.es.js";
const $ = {
  [a.XSmall]: "tw-px-5 tw-py-2 tw-min-h-[36px]",
  [a.Small]: "tw-px-5 tw-py-2.5 tw-min-h-[36px]",
  [a.Large]: "tw-px-5 tw-py-3 tw-min-h-[60px]"
};
var K = /* @__PURE__ */ ((r) => (r.Default = "Default", r.Active = "Active", r.Disabled = "Disabled", r))(K || {});
const U = {
  [e.Primary]: {
    Default: "tw-text-text-x-weak",
    Active: "tw-text-text",
    Disabled: "tw-text-text-disabled"
  },
  [e.Danger]: {
    Default: "tw-text-red-60",
    Active: "tw-text-red-70",
    Disabled: "tw-text-text-disabled"
  },
  [e.Warning]: {
    Default: "tw-text-text-warning",
    Active: "tw-text-yellow-90",
    Disabled: "tw-text-text-disabled"
  }
}, Y = {
  [e.Primary]: "hover:tw-text-text",
  [e.Danger]: "hover:tw-text-text-negative",
  [e.Warning]: "hover:tw-text-text-warning"
}, N = "tw-cursor-pointer tw-flex tw-items-center tw-justify-between tw-transition-colors tw-gap-2", q = "hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover", f = i(["tw-w-full tw-text-left tw-py-2 tw-px-5 tw-rounded", q]), B = "tw-bg-box-selected", G = ({
  title: r,
  decorator: R,
  switchComponent: F,
  subtitle: L,
  size: o = a.Small,
  style: u = e.Primary,
  disabled: s = !1,
  active: l = !1,
  checked: P = !1,
  selectionIndicator: z = m.Check,
  children: n,
  link: S,
  onBlur: b,
  onClick: w,
  onFocus: g,
  onMouseEnter: v,
  onMouseOut: h,
  onMouseOver: E,
  onMouseLeave: I,
  "data-test-id": c = "menu-item",
  type: M
}) => {
  const D = o === a.XSmall ? A.Size16 : A.Size20, T = {
    [m.CaretRight]: /* @__PURE__ */ t(O, { "data-test-id": `${c}-caret`, size: D }),
    [m.Check]: l && /* @__PURE__ */ t(V, { "data-test-id": `${c}-active`, size: D }),
    [m.None]: null
  }[z], { isFocusVisible: y, focusProps: C } = H();
  let x = "Default";
  s ? x = "Disabled" : l && (x = "Active");
  const j = U[u][x], p = X(S, w);
  return /* @__PURE__ */ d(k, { children: [
    n ? /* @__PURE__ */ d(
      "li",
      {
        "data-test-id": c,
        "data-type": M,
        role: "menuitem",
        className: i([
          "tw-text-sm tw-leading-4 tw-text-text-weak",
          N,
          P ? B : ""
        ]),
        children: [
          p === "a" && /* @__PURE__ */ t(
            "a",
            {
              href: S,
              className: i([f, y && _]),
              onBlur: b,
              onClick: w,
              onFocus: g,
              onMouseEnter: v,
              onMouseLeave: I,
              onMouseOut: h,
              onMouseOver: E,
              ...C,
              children: n
            }
          ),
          p === "button" && /* @__PURE__ */ t(
            "button",
            {
              type: "button",
              disabled: s,
              className: i([f, y && _]),
              onBlur: b,
              onClick: w,
              onFocus: g,
              onMouseEnter: v,
              onMouseLeave: I,
              onMouseOut: h,
              onMouseOver: E,
              ...C,
              children: n
            }
          ),
          p === "span" && /* @__PURE__ */ t("span", { className: f, children: n })
        ]
      }
    ) : null,
    !n && /* @__PURE__ */ d(
      "div",
      {
        className: i([
          N,
          Y[u],
          $[o],
          s && "tw-bg-box-disabled tw-pointer-events-none",
          l && "tw-font-medium",
          j
        ]),
        children: [
          /* @__PURE__ */ t(
            W,
            {
              title: r,
              decorator: R,
              subtitle: o === a.Large ? L : void 0,
              size: o,
              switchComponent: F
            }
          ),
          /* @__PURE__ */ t("div", { className: "tw-flex-none", children: T })
        ]
      }
    )
  ] });
};
G.displayName = "FondueMenuItem";
export {
  G as MenuItem,
  K as MenuItemTextColorState,
  $ as menuItemSizeClassMap,
  U as menuItemTextColorRecord
};
//# sourceMappingURL=MenuItem.es.js.map
