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