@algorithm-shift/design-system 1.2.45 → 1.2.46

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/dist/index.d.mts CHANGED
@@ -102,6 +102,7 @@ interface TableProps extends ElementProps {
102
102
  cellClickEnabled?: (cellData: Record<string, any>, columnId: string) => boolean;
103
103
  onCellClick?: (cellData: Record<string, any>, columnId: string) => void;
104
104
  getRowSelection?: (rowSelection: Record<string, boolean>) => void;
105
+ totalRecords?: number;
105
106
  }
106
107
 
107
108
  interface TabsProps extends ElementProps {
@@ -246,7 +247,7 @@ declare const DateRange: ({ className, style, ...props }: DateRangeInputProps) =
246
247
 
247
248
  declare const TextInputGroup: ({ className, style, prepend, append, ...props }: TextInputGroupProps) => react_jsx_runtime.JSX.Element;
248
249
 
249
- declare const Table: ({ columns, data, rowActions, className, style, pagination, itemsPerPage, onPageChange, loading, ...props }: TableProps) => react_jsx_runtime.JSX.Element;
250
+ declare const Table: ({ columns, data, rowActions, className, style, pagination, itemsPerPage, onPageChange, loading, totalRecords, ...props }: TableProps) => react_jsx_runtime.JSX.Element;
250
251
 
251
252
  interface CustomPaginationProps {
252
253
  totalPages: number;
package/dist/index.d.ts CHANGED
@@ -102,6 +102,7 @@ interface TableProps extends ElementProps {
102
102
  cellClickEnabled?: (cellData: Record<string, any>, columnId: string) => boolean;
103
103
  onCellClick?: (cellData: Record<string, any>, columnId: string) => void;
104
104
  getRowSelection?: (rowSelection: Record<string, boolean>) => void;
105
+ totalRecords?: number;
105
106
  }
106
107
 
107
108
  interface TabsProps extends ElementProps {
@@ -246,7 +247,7 @@ declare const DateRange: ({ className, style, ...props }: DateRangeInputProps) =
246
247
 
247
248
  declare const TextInputGroup: ({ className, style, prepend, append, ...props }: TextInputGroupProps) => react_jsx_runtime.JSX.Element;
248
249
 
249
- declare const Table: ({ columns, data, rowActions, className, style, pagination, itemsPerPage, onPageChange, loading, ...props }: TableProps) => react_jsx_runtime.JSX.Element;
250
+ declare const Table: ({ columns, data, rowActions, className, style, pagination, itemsPerPage, onPageChange, loading, totalRecords, ...props }: TableProps) => react_jsx_runtime.JSX.Element;
250
251
 
251
252
  interface CustomPaginationProps {
252
253
  totalPages: number;
package/dist/index.js CHANGED
@@ -2290,13 +2290,14 @@ var Table2 = ({
2290
2290
  itemsPerPage = 10,
2291
2291
  onPageChange,
2292
2292
  loading = false,
2293
+ totalRecords = 0,
2293
2294
  ...props
2294
2295
  }) => {
2295
2296
  const rawColumns = Array.isArray(columns) ? columns : [];
2296
2297
  const rawData = Array.isArray(data) ? data : [];
2297
2298
  const rawRowActions = Array.isArray(rowActions) ? rowActions : [];
2298
2299
  const [currentPage, setCurrentPage] = (0, import_react6.useState)(1);
2299
- const enablePagination = pagination && rawData.length > itemsPerPage;
2300
+ const enablePagination = pagination && totalRecords > itemsPerPage;
2300
2301
  const handlePageChange = (page) => {
2301
2302
  setCurrentPage(page);
2302
2303
  onPageChange?.(page);
@@ -2316,7 +2317,7 @@ var Table2 = ({
2316
2317
  enablePagination && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
2317
2318
  Pagination_default,
2318
2319
  {
2319
- totalPages: Math.ceil(rawData.length / itemsPerPage),
2320
+ totalPages: Math.ceil(totalRecords / itemsPerPage),
2320
2321
  currentPage,
2321
2322
  onPageChange: handlePageChange
2322
2323
  }