import { j as r } from "../../_virtual/jsx-runtime.js";
import { useRef as x } from "react";
import { IconButtonContainer as j } from "./styles.js";
import { Spinner as S } from "../Spinner/index.js";
import { getSpinnerSize as b, getSpinnerType as g } from "./utils.js";
import h from "../../icons/Placeholder.js";
import { useHasFocus as B } from "../../hooks/useHasFocus.js";
function C({
  variant: a = "primary",
  icon: i = /* @__PURE__ */ r.jsx(h, {}),
  size: o = "large",
  className: s,
  disabled: m = !1,
  isLoading: e = !1,
  type: l = "button",
  onClick: c,
  ...t
}) {
  const f = b(o) || "L", u = g(a) || "brand", n = x(null), { hasFocus: d, setHasFocus: p } = B(n);
  return /* @__PURE__ */ r.jsx(
    j,
    {
      hasFocus: d,
      ref: n,
      variant: a,
      size: o,
      className: s,
      isLoading: e,
      disabled: m,
      type: l,
      onClick: c,
      "data-testid": t["data-testid"],
      "data-trackid": t["data-trackid"],
      "aria-label": t["aria-label"],
      onBlur: () => p(!1),
      children: e ? /* @__PURE__ */ r.jsx(S, { variant: u, size: f }) : i
    }
  );
}
export {
  C as IconButton
};
