import { jsxs as f, Fragment as F, jsx as r } from "react/jsx-runtime";
import { forwardRef as R } from "react";
import { cx as $ } from "../../utils/classNames.js";
import { useArrowTheme as q } from "../../hooks/useArrowTheme.js";
const B = R(
  ({
    children: p,
    variant: n = "primary",
    size: h = "large",
    inverse: d,
    disabled: a = !1,
    type: v = "button",
    icon: g,
    trailingIcon: i,
    monochrome: x = !1,
    loading: c = !1,
    ariaLabel: o,
    describedBy: m,
    focused: y,
    hover: N,
    pressed: b,
    className: j,
    onClick: s,
    ...w
  }, S) => {
    const T = q(), _ = d ?? T.inverse, u = n === "tertiary", t = c && !u, e = t && !m ? "loading-region" : m, z = $(
      "tdds-button",
      `tdds-button--${n}`,
      {
        "force-focus": !!y,
        "force-hover": !!N,
        "force-pressed": !!b
      },
      j
    ), A = (l) => {
      if (a || t) {
        l.preventDefault();
        return;
      }
      s == null || s(l);
    };
    return /* @__PURE__ */ f(F, { children: [
      /* @__PURE__ */ f(
        "button",
        {
          ref: S,
          type: v,
          className: z,
          "aria-disabled": a || t || void 0,
          "aria-label": (o == null ? void 0 : o.trim()) || void 0,
          "aria-describedby": (e == null ? void 0 : e.trim()) || void 0,
          "data-inverse": d != null ? String(_) : void 0,
          "data-size": h || void 0,
          "data-monochrome": x || void 0,
          "data-loading": t ? "true" : void 0,
          onClick: A,
          ...w,
          children: [
            g,
            /* @__PURE__ */ r("span", { children: p }),
            u && i && /* @__PURE__ */ r("span", { className: "tdds-button__decoration-end", children: i })
          ]
        }
      ),
      c && /* @__PURE__ */ r("span", { className: "tdds:screen-reader-only", role: "status", children: /* @__PURE__ */ r("span", { id: e, children: "Submitting" }) })
    ] });
  }
);
B.displayName = "Button";
export {
  B as Button
};
//# sourceMappingURL=Button.js.map
