import { j as t } from "../../node_modules/react/jsx-runtime.js";
import { cn as a } from "../../utils/index.js";
import { useState as m } from "react";
import { Button as d } from "../Button/base.js";
import "../Button/split-button.js";
import "../Button/login-with-button.js";
import { Icon as i } from "../Icon/index.js";
function T({
  header: e,
  footer: n,
  className: s,
  children: r,
  tableProps: { className: o, ...c } = {},
  borderless: l,
  ...u
}) {
  return /* @__PURE__ */ t.jsxs(
    "section",
    {
      className: a(
        "table-container col-span-full h-fit",
        !l && "outlined",
        s
      ),
      ...u,
      children: [
        !!e && e,
        /* @__PURE__ */ t.jsx(
          "table",
          {
            className: a("table table-striped", o),
            ...c,
            children: r
          }
        ),
        !!n && n
      ]
    }
  );
}
function b({ className: e, ...n }) {
  return /* @__PURE__ */ t.jsx("tr", { className: a(e), ...n });
}
function C({ className: e, ...n }) {
  return /* @__PURE__ */ t.jsx("td", { className: a(e), ...n });
}
function w({ className: e, ...n }) {
  return /* @__PURE__ */ t.jsx(b, { className: a(e), ...n });
}
function H({ className: e, ...n }) {
  return /* @__PURE__ */ t.jsx("th", { className: a(e), ...n });
}
function S({ className: e, children: n, ...s }) {
  const [r, o] = m("none"), c = () => {
    o((l) => {
      switch (l) {
        case "ascending":
          return "descending";
        case "descending":
          return "none";
        case "none":
          return "ascending";
        default:
          return "none";
      }
    });
  };
  return /* @__PURE__ */ t.jsx("th", { className: a(e), ...s, children: /* @__PURE__ */ t.jsxs(d, { colorScheme: "black", variant: "ghost", onClick: c, children: [
    n,
    r == "ascending" && /* @__PURE__ */ t.jsx(i, { name: "caret-up" }),
    r == "descending" && /* @__PURE__ */ t.jsx(i, { name: "caret-down" }),
    r == "none"
  ] }) });
}
function k({ className: e, ...n }) {
  return /* @__PURE__ */ t.jsx("div", { className: a("table-container-footer", e), ...n });
}
function v({ className: e, ...n }) {
  return /* @__PURE__ */ t.jsx("div", { className: a("table-container-header", e), ...n });
}
export {
  T as Table,
  C as TableCell,
  k as TableFooter,
  v as TableHeader,
  H as TableHeaderCell,
  S as TableHeaderCellSortable,
  w as TableHeaderRow,
  b as TableRow
};
