// src/components/table/TableSortButton.tsx
import { ChevronDown, ChevronsUpDown, ChevronUp } from "lucide-react";

// src/components/user-action/Button.tsx
import clsx from "clsx";
import { jsx, jsxs } from "react/jsx-runtime";
var ButtonColorUtil = {
  solid: ["primary", "secondary", "tertiary", "positive", "warning", "negative", "neutral"],
  text: ["primary", "negative", "neutral"],
  outline: ["primary"]
};
var IconButtonUtil = {
  icon: [...ButtonColorUtil.solid, "transparent"]
};
var paddingMapping = {
  small: "btn-sm",
  medium: "btn-md",
  large: "btn-lg"
};
var iconPaddingMapping = {
  tiny: "icon-btn-xs",
  small: "icon-btn-sm",
  medium: "icon-btn-md",
  large: "icon-btn-lg"
};
var ButtonUtil = {
  paddingMapping,
  iconPaddingMapping
};
var IconButton = ({
  children,
  disabled = false,
  color = "primary",
  size = "medium",
  onClick,
  className,
  ...restProps
}) => {
  const colorClasses = {
    primary: "bg-button-solid-primary-background text-button-solid-primary-text",
    secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
    tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
    positive: "bg-button-solid-positive-background text-button-solid-positive-text",
    warning: "bg-button-solid-warning-background text-button-solid-warning-text",
    negative: "bg-button-solid-negative-background text-button-solid-negative-text",
    neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text",
    transparent: "bg-transparent"
  }[color];
  return /* @__PURE__ */ jsx(
    "button",
    {
      onClick: disabled ? void 0 : onClick,
      disabled: disabled || onClick === void 0,
      className: clsx(
        {
          "text-disabled-text bg-disabled-background cursor-not-allowed": disabled && color !== "transparent",
          "text-disabled-text cursor-not-allowed opacity-70": disabled && color === "transparent",
          "hover:bg-button-text-hover-background": !disabled && color === "transparent",
          [clsx(colorClasses, "hover:brightness-90")]: !disabled
        },
        ButtonUtil.iconPaddingMapping[size],
        className
      ),
      ...restProps,
      children
    }
  );
};

// src/components/table/TableSortButton.tsx
import clsx2 from "clsx";
import { jsx as jsx2 } from "react/jsx-runtime";
var TableSortButton = ({
  sortDirection,
  invert = false,
  color = "neutral",
  className,
  ...buttonProps
}) => {
  let icon = /* @__PURE__ */ jsx2(ChevronsUpDown, { className: "w-full h-full" });
  if (sortDirection) {
    let usedSortDirection = sortDirection;
    if (invert) {
      usedSortDirection = usedSortDirection === "desc" ? "asc" : "desc";
    }
    icon = usedSortDirection === "asc" ? /* @__PURE__ */ jsx2(ChevronUp, { className: "w-full h-full" }) : /* @__PURE__ */ jsx2(ChevronDown, { className: "w-full h-full" });
  }
  return /* @__PURE__ */ jsx2(
    IconButton,
    {
      size: "tiny",
      color,
      className: clsx2(className),
      ...buttonProps,
      children: icon
    }
  );
};
export {
  TableSortButton
};
//# sourceMappingURL=TableSortButton.mjs.map