import { jsx, jsxs } from 'react/jsx-runtime';
import { Tooltip, TooltipTrigger, TooltipContent } from '../../tooltip.mjs';
import { Toggle } from '../../toggle.mjs';
import { cn } from '../../../lib/utils.mjs';

const ToolbarButton = ({
  isActive,
  children,
  tooltip,
  className,
  tooltipOptions,
  ...props
}) => {
  const toggleButton = /* @__PURE__ */ jsx(Toggle, { className: cn({ "bg-accent": isActive }, className), ...props, children });
  if (!tooltip) {
    return toggleButton;
  }
  return /* @__PURE__ */ jsxs(Tooltip, { children: [
    /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: toggleButton }),
    /* @__PURE__ */ jsx(TooltipContent, { ...tooltipOptions, children: /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center text-center", children: tooltip }) })
  ] });
};
ToolbarButton.displayName = "ToolbarButton";

export { ToolbarButton, ToolbarButton as default };
