import m, { forwardRef as R, cloneElement as F } from "react";
import { useButton as M } from "../../../../../@react-aria/button/dist/module.es.js";
import { merge as i } from "../../utilities/merge.es.es.js";
import { useForwardedRef as P } from "../../utilities/useForwardedRef.es.es.js";
import { ButtonStyle as s, ButtonEmphasis as r, ButtonType as T, ButtonSize as _, ButtonRounding as k } from "./ButtonTypes.es.es.js";
import { ButtonEmphasis as ot, ButtonRounding as at, ButtonSize as nt, ButtonStyle as it, ButtonType as rt } from "./ButtonTypes.es.es.js";
import { ButtonCommonClasses as v, ButtonRoundingClasses as L, ButtonSizeClasses as c, IconSpacingClasses as N, ButtonDisabledClasses as O, ButtonStyleClasses as V } from "./ButtonClasses.es.es.js";
import { ButtonCommonClasses as lt, ButtonDisabledClasses as dt, ButtonRoundingClasses as mt, ButtonSizeClasses as ft, ButtonStyleClasses as pt, IconSpacingClasses as ct } from "./ButtonClasses.es.es.js";
import { FOCUS_VISIBLE_STYLE as W } from "../../utilities/focusStyle.es.es.js";
import { buttonTypeMap as A, buttonIconSizeMap as U } from "./mappings.es.es.js";
import { useFocusRing as Y } from "../../../../../@react-aria/focus/dist/module.es.js";
const j = ({
  type: B = T.Button,
  style: t = s.Default,
  size: e = _.Medium,
  rounding: b = k.Medium,
  emphasis: o = r.Strong,
  hideLabel: u = !1,
  disabled: a = !1,
  icon: l,
  children: n,
  onClick: f,
  hugWidth: S = !0,
  "aria-label": C,
  formId: g,
  solid: y,
  inverted: D
}, x) => {
  t === s.Primary ? (t = s.Default, o = r.Strong) : t === s.Secondary && (t = s.Default, o = r.Default), y === !1 && (o = r.Weak);
  const p = P(x), { buttonProps: E } = M(
    { onPress: () => f && f(), isDisabled: a, type: A[B] },
    p
  ), { isFocusVisible: h, focusProps: w } = Y(), d = (I) => a ? O : `${V[o][t][I]}`, z = i([
    d("button"),
    v,
    L[b],
    l && !n || u ? c[e].iconOnly : c[e].default,
    !S && "tw-w-full"
  ]);
  return /* @__PURE__ */ m.createElement("button", {
    "aria-label": C,
    "aria-disabled": a,
    ref: p,
    className: i([z, D && "tw-dark", h && W]),
    disabled: a,
    "data-test-id": "button",
    form: g,
    ...E,
    ...w
  }, l && /* @__PURE__ */ m.createElement("span", {
    "data-test-id": "button-icon",
    className: i([n && !u ? N[e] : "", d("icon")])
  }, F(l, { size: U[e] })), n && /* @__PURE__ */ m.createElement("span", {
    "data-test-id": "button-text",
    className: i([d("text"), u && "tw-sr-only"])
  }, n));
}, tt = R(j);
export {
  tt as Button,
  lt as ButtonCommonClasses,
  dt as ButtonDisabledClasses,
  ot as ButtonEmphasis,
  at as ButtonRounding,
  mt as ButtonRoundingClasses,
  nt as ButtonSize,
  ft as ButtonSizeClasses,
  it as ButtonStyle,
  pt as ButtonStyleClasses,
  rt as ButtonType,
  ct as IconSpacingClasses
};
//# sourceMappingURL=Button.es.es.js.map
