import { jsx as e, jsxs as v } from "react/jsx-runtime";
import { forwardRef as b } from "react";
import { cx as w } from "../../utils/classNames.js";
import { useArrowTheme as g } from "../../hooks/useArrowTheme.js";
const x = b(
  ({ columns: i, data: n, ariaLabel: h, inverse: c, className: f }, m) => {
    const p = g(), u = c ?? p.inverse;
    return !i || !n || i.length === 0 || n.length === 0 ? null : /* @__PURE__ */ e(
      "div",
      {
        ref: m,
        className: w("tdds-table", f),
        role: "region",
        "aria-label": h,
        tabIndex: 0,
        "data-inverse": u ? "true" : void 0,
        children: /* @__PURE__ */ e("table", { children: /* @__PURE__ */ v("tbody", { children: [
          /* @__PURE__ */ e("tr", { children: i.map((t, d) => /* @__PURE__ */ e("th", { scope: "col", children: t.header }, d)) }),
          n.map((t, d) => {
            const o = i.find((l) => l.isRowHeader), a = o ? t[o.field] : void 0;
            return o && (a == null || String(a).trim() === "") ? null : /* @__PURE__ */ e("tr", { children: i.map((l, s) => {
              let r = t[l.field];
              return (r == null || r === "") && (r = "None"), l.isRowHeader ? /* @__PURE__ */ e("th", { scope: "row", children: r }, s) : /* @__PURE__ */ e("td", { children: r }, s);
            }) }, d);
          })
        ] }) })
      }
    );
  }
);
x.displayName = "Table";
export {
  x as Table
};
//# sourceMappingURL=Table.js.map
