UNPKG

@trail-ui/react

Version:
41 lines (38 loc) 1.62 kB
import { EditableTableCell } from "./chunk-FPIKPO4Q.mjs"; import { _Spinner } from "./chunk-OJCLZ6LD.mjs"; // src/editable-table/table-body/editable-table-body.tsx import { jsx, jsxs } from "react/jsx-runtime"; function EditableTableBody({ isLoading, columns, table, isCellDisabled }) { var _a; return /* @__PURE__ */ jsx("tbody", { children: isLoading ? /* @__PURE__ */ jsx("tr", { className: "h-[300px]", children: /* @__PURE__ */ jsx("td", { colSpan: columns.length, children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center gap-1", children: [ /* @__PURE__ */ jsx(_Spinner, { className: "h-8 w-8 animate-spin" }), /* @__PURE__ */ jsx("p", { className: "pt-1 text-neutral-700", children: "Loading..." }) ] }) }) }) : ((_a = table.getRowModel().rows) == null ? void 0 : _a.length) ? ( // Normal rows table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx("tr", { children: row.getVisibleCells().map((cell) => { return /* @__PURE__ */ jsx( EditableTableCell, { cell, isCellDisabled }, `${cell.column.getIndex()}-${cell.row.index}` ); }) }, row.id)) ) : ( // Empty state /* @__PURE__ */ jsx("tr", { className: "h-[300px]", children: /* @__PURE__ */ jsx("td", { colSpan: columns.length, children: /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center justify-center gap-1", children: /* @__PURE__ */ jsx("p", { role: "alert", "aria-live": "polite", className: "text-neutral-700", children: "No data" }) }) }) }) ) }); } export { EditableTableBody };