@trackunit/react-table 0.0.509 → 0.0.511

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js CHANGED
@@ -326,11 +326,21 @@ const Table = ({ rowHeight = 75, ...props }) => {
326
326
  }, children: jsxRuntime.jsx("div", { className: "grid h-full items-center", children: reactTable.flexRender(cell.column.columnDef.cell, cell.getContext()) }) }, cell.id));
327
327
  }) }, row.id));
328
328
  }
329
- }) })) : (jsxRuntime.jsx("tbody", { children: jsxRuntime.jsx("tr", { children: jsxRuntime.jsx("td", { className: "b-0", children: props.loading ? (jsxRuntime.jsx(reactComponents.Spinner, { centering: "centered", containerClassName: "absolute inset-0" })) : props.noDataMessage ? (props.noDataMessage) : (jsxRuntime.jsx(reactComponents.EmptyState, { className: "absolute inset-0", description: t("table.noResults"), image: "SEARCH_DOCUMENT" })) }) }) }))] }) }), props.hideFooter ? null : (jsxRuntime.jsxs("div", { className: "flex items-center p-2", children: [jsxRuntime.jsx("div", { className: "whitespace-nowrap text-xs font-medium text-neutral-600", children: t("table.pagination.full", {
329
+ }) })) : (jsxRuntime.jsx("tbody", { className: cvaTBody({ emptyState: !props.loading && !props.noDataMessage }), children: jsxRuntime.jsx("tr", { children: jsxRuntime.jsx("td", { className: "b-0", children: props.loading ? (jsxRuntime.jsx(reactComponents.Spinner, { centering: "centered", containerClassName: "absolute inset-0" })) : props.noDataMessage ? (props.noDataMessage) : (jsxRuntime.jsx(reactComponents.EmptyState, { className: "absolute inset-0", description: t("table.noResults"), image: "SEARCH_DOCUMENT", ...props.emptyState })) }) }) }))] }) }), props.hideFooter ? null : (jsxRuntime.jsxs("div", { className: "flex items-center p-2", children: [jsxRuntime.jsx("div", { className: "whitespace-nowrap text-xs font-medium text-neutral-600", children: t("table.pagination.full", {
330
330
  count: props.getRowModel().rows.length,
331
331
  total: ((_b = (_a = props.pagination) === null || _a === void 0 ? void 0 : _a.pageInfo) === null || _b === void 0 ? void 0 : _b.count) || 0,
332
332
  }) }), ((_c = props.pagination) === null || _c === void 0 ? void 0 : _c.isLoading) ? (jsxRuntime.jsx("span", { className: "ml-2", children: jsxRuntime.jsx(reactComponents.Spinner, { size: "small" }) })) : null, props.footerRightActions ? jsxRuntime.jsx("div", { className: "flex flex-1 justify-end", children: props.footerRightActions }) : null] }))] }));
333
333
  };
334
+ const cvaTBody = cssClassVarianceUtilities.cvaMerge([], {
335
+ variants: {
336
+ emptyState: {
337
+ true: "min-h-[400px]",
338
+ },
339
+ },
340
+ defaultVariants: {
341
+ emptyState: false,
342
+ },
343
+ });
334
344
 
335
345
  const cvaColumnFilterGrabbable = cssClassVarianceUtilities.cvaMerge(["flex", "items-center", "justify-center"], {
336
346
  variants: {
package/index.esm.js CHANGED
@@ -307,11 +307,21 @@ const Table = ({ rowHeight = 75, ...props }) => {
307
307
  }, children: jsx("div", { className: "grid h-full items-center", children: flexRender(cell.column.columnDef.cell, cell.getContext()) }) }, cell.id));
308
308
  }) }, row.id));
309
309
  }
310
- }) })) : (jsx("tbody", { children: jsx("tr", { children: jsx("td", { className: "b-0", children: props.loading ? (jsx(Spinner, { centering: "centered", containerClassName: "absolute inset-0" })) : props.noDataMessage ? (props.noDataMessage) : (jsx(EmptyState, { className: "absolute inset-0", description: t("table.noResults"), image: "SEARCH_DOCUMENT" })) }) }) }))] }) }), props.hideFooter ? null : (jsxs("div", { className: "flex items-center p-2", children: [jsx("div", { className: "whitespace-nowrap text-xs font-medium text-neutral-600", children: t("table.pagination.full", {
310
+ }) })) : (jsx("tbody", { className: cvaTBody({ emptyState: !props.loading && !props.noDataMessage }), children: jsx("tr", { children: jsx("td", { className: "b-0", children: props.loading ? (jsx(Spinner, { centering: "centered", containerClassName: "absolute inset-0" })) : props.noDataMessage ? (props.noDataMessage) : (jsx(EmptyState, { className: "absolute inset-0", description: t("table.noResults"), image: "SEARCH_DOCUMENT", ...props.emptyState })) }) }) }))] }) }), props.hideFooter ? null : (jsxs("div", { className: "flex items-center p-2", children: [jsx("div", { className: "whitespace-nowrap text-xs font-medium text-neutral-600", children: t("table.pagination.full", {
311
311
  count: props.getRowModel().rows.length,
312
312
  total: ((_b = (_a = props.pagination) === null || _a === void 0 ? void 0 : _a.pageInfo) === null || _b === void 0 ? void 0 : _b.count) || 0,
313
313
  }) }), ((_c = props.pagination) === null || _c === void 0 ? void 0 : _c.isLoading) ? (jsx("span", { className: "ml-2", children: jsx(Spinner, { size: "small" }) })) : null, props.footerRightActions ? jsx("div", { className: "flex flex-1 justify-end", children: props.footerRightActions }) : null] }))] }));
314
314
  };
315
+ const cvaTBody = cvaMerge([], {
316
+ variants: {
317
+ emptyState: {
318
+ true: "min-h-[400px]",
319
+ },
320
+ },
321
+ defaultVariants: {
322
+ emptyState: false,
323
+ },
324
+ });
315
325
 
316
326
  const cvaColumnFilterGrabbable = cvaMerge(["flex", "items-center", "justify-center"], {
317
327
  variants: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-table",
3
- "version": "0.0.509",
3
+ "version": "0.0.511",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
package/src/Table.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Table as ReactTable, Row } from "@tanstack/react-table";
2
- import { CommonProps } from "@trackunit/react-components";
2
+ import { CommonProps, EmptyStateProps } from "@trackunit/react-components";
3
3
  import { RelayPagination } from "@trackunit/react-table-pagination";
4
4
  export interface TableProps<TData extends object> extends ReactTable<TData>, CommonProps {
5
5
  pagination?: RelayPagination;
@@ -11,6 +11,7 @@ export interface TableProps<TData extends object> extends ReactTable<TData>, Com
11
11
  loading?: boolean;
12
12
  rowHeight?: number;
13
13
  hideFooter?: boolean;
14
+ emptyState?: EmptyStateProps;
14
15
  }
15
16
  /**
16
17
  * Table component for displaying large sets of data in tables with infinite scroll, sorting, filtering and others.