import { jsxs as A, jsx as B } from "react/jsx-runtime";
import { forwardRef as N } from "react";
import { cx as n } from "../../utils/classNames.js";
import { useArrowTheme as R } from "../../hooks/useArrowTheme.js";
const S = N(
  ({
    a11yLabel: s,
    icon: i,
    disabled: t = !1,
    inverse: d,
    size: c = "large",
    type: l = "button",
    background: m = "none",
    ariaHidden: u,
    ariaHasPopup: f,
    ariaControls: p,
    tabIndex: b,
    ariaExpanded: v,
    id: h,
    describedBy: x,
    hasBadge: a = !1,
    badgeNumber: r = 0,
    focused: g,
    hover: I,
    pressed: j,
    className: w,
    ...y
  }, L) => {
    const T = R(), k = d ?? T.inverse, o = s.trim();
    if (!o)
      return null;
    const e = r > 99 ? "99+" : r > 0 ? String(r) : "", z = a && e ? o + ", " + e : o;
    return /* @__PURE__ */ A(
      "button",
      {
        ref: L,
        id: h,
        type: l,
        className: n("tdds-icon-button", {
          "force-focus": !!g,
          "force-hover": !!I,
          "force-pressed": !!j
        }, w),
        disabled: t || void 0,
        "aria-label": z,
        "aria-disabled": t || void 0,
        "aria-hidden": u || void 0,
        "aria-haspopup": f || void 0,
        "aria-controls": p,
        "aria-expanded": v,
        "aria-describedby": x,
        "data-background": m,
        "data-size": c,
        tabIndex: b,
        ...k ? { "data-inverse": "true" } : {},
        ...y,
        children: [
          i,
          a ? /* @__PURE__ */ B(
            "span",
            {
              className: n("tdds-badge", {
                "tdds-badge--number": e.length > 0
              }),
              children: e
            }
          ) : null
        ]
      }
    );
  }
);
S.displayName = "IconButton";
export {
  S as IconButton
};
//# sourceMappingURL=IconButton.js.map
