import { jsx as i, jsxs as h } from "react/jsx-runtime";
import { forwardRef as v } from "react";
import { cx as t } from "../../utils/classNames.js";
import { useArrowTheme as b } from "../../hooks/useArrowTheme.js";
const M = {
  "Single select": "menuitemradio",
  "Multi select": "menuitemcheckbox",
  "Action items": "menuitem"
}, R = v(
  ({ id: c, inverse: d, behavior: o, items: s, a11yLabelledBy: r, role: n, className: l, ...a }, u) => {
    const m = b(), p = d ?? m.inverse, f = o !== "Multi select" && s.every((e) => !!e.icon), x = n === "menu" ? M[o] : "option";
    return /* @__PURE__ */ i(
      "ul",
      {
        ref: u,
        className: t("tdds-menu", l),
        role: n,
        ...p ? { "data-inverse": "true" } : {},
        "aria-labelledby": r || void 0,
        tabIndex: 0,
        id: c,
        ...a,
        children: s.filter((e) => !!e.text).map((e) => /* @__PURE__ */ h(
          "li",
          {
            id: e.id,
            className: t({ "force-focus": !!e.focused }),
            role: x,
            "aria-selected": n === "listbox" ? !!e.selected : void 0,
            "aria-disabled": e.disabled ? "true" : void 0,
            "aria-checked": n === "menu" && o !== "Action items" ? !!e.selected : void 0,
            children: [
              f && e.icon ? e.icon : null,
              /* @__PURE__ */ i("span", { children: e.text })
            ]
          },
          e.id
        ))
      }
    );
  }
);
R.displayName = "Menu";
export {
  R as Menu
};
//# sourceMappingURL=Menu.js.map
