import { jsx as e, jsxs as s, Fragment as n } from "react/jsx-runtime";
import * as a from "@radix-ui/react-toolbar";
import { forwardRef as m } from "react";
import { merge as i } from "../../../../utilities/merge.es.js";
import { withTooltip as b } from "./Tooltip.es.js";
import c from "../../../../foundation/Icon/Generated/IconCaretDown16.es.js";
const w = m(({ isDropdown: r, children: l, pressed: o, ...t }, d) => typeof o == "boolean" ? /* @__PURE__ */ e(
  a.ToolbarToggleGroup,
  {
    className: "tw-flex tw-items-center",
    type: "single",
    value: "single",
    disabled: t.disabled,
    children: /* @__PURE__ */ e(
      a.ToggleItem,
      {
        ref: d,
        "data-testid": "ToolbarButton",
        className: i([
          "!tw-w-6 !tw-h-6 !tw-items-center !tw-px-2 tw-ml-0.5 !tw-text-text-weak !tw-rounded-md !tw-flex !tw-justify-center  disabled:!tw-cursor-not-allowed disabled:!tw-opacity-50 disabled:!tw-pointer-events-auto",
          o && !t.disabled ? "!tw-bg-box-selected" : "",
          t.disabled ? "" : "hover:!tw-bg-box-selected hover:!tw-text-box-selected-inverse"
        ]),
        value: o ? "single" : "",
        ...t,
        tabIndex: 0,
        children: r ? /* @__PURE__ */ s(n, { children: [
          /* @__PURE__ */ e("div", { className: "tw-flex tw-flex-1", children: l }),
          /* @__PURE__ */ e("div", { className: "tw-w-4 tw-ml-0.5", children: /* @__PURE__ */ e(c, {}) })
        ] }) : l
      }
    )
  }
) : /* @__PURE__ */ e("div", { className: "tw-flex tw-items-center", children: /* @__PURE__ */ e(
  a.Button,
  {
    ref: d,
    "data-testid": "ToolbarButton",
    className: i([
      "!tw-w-6 !tw-h-6 !tw-items-center !tw-px-2 tw-ml-0.5 !tw-text-text-weak !tw-rounded-md !tw-flex !tw-justify-center  disabled:!tw-cursor-not-allowed disabled:!tw-opacity-50 disabled:!tw-pointer-events-auto",
      o && !t.disabled ? "!tw-bg-box-selected" : "",
      t.disabled ? "" : "hover:!tw-bg-box-selected hover:!tw-text-box-selected-inverse"
    ]),
    ...t,
    tabIndex: 0,
    children: l
  }
) }));
w.displayName = "ToolbarButtonComponent";
const x = b(w);
x.displayName = "ToolbarButton";
export {
  x as ToolbarButton
};
//# sourceMappingURL=ToolbarButton.es.js.map
