@indico-data/design-system 3.0.2 → 3.0.4
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/lib/components/forms/checkbox/Checkbox.d.ts +1 -0
- package/lib/components/tanstackTable/TankstackTable.types.d.ts +1 -0
- package/lib/components/tanstackTable/TanstackTable.d.ts +1 -1
- package/lib/components/tanstackTable/components/TableBody/TableBody.d.ts +1 -3
- package/lib/components/tanstackTable/components/TableLoading/TableLoading.d.ts +6 -0
- package/lib/index.css +5 -24
- package/lib/index.d.ts +3 -1
- package/lib/index.esm.css +5 -24
- package/lib/index.esm.js +35 -28
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +35 -28
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/forms/checkbox/Checkbox.tsx +7 -2
- package/src/components/forms/input/Input.tsx +1 -0
- package/src/components/forms/input/styles/Input.scss +3 -0
- package/src/components/pagination/Pagination.tsx +2 -2
- package/src/components/tanstackTable/TankstackTable.types.ts +1 -0
- package/src/components/tanstackTable/TanstackTable.stories.tsx +10 -0
- package/src/components/tanstackTable/TanstackTable.tsx +11 -4
- package/src/components/tanstackTable/components/NoResults/NoResults.scss +2 -2
- package/src/components/tanstackTable/components/TableBody/TableBody.tsx +1 -25
- package/src/components/tanstackTable/components/TableLoading/TableLoading.tsx +18 -0
- package/src/components/tanstackTable/mock-data/table-configuration.tsx +6 -7
- package/src/components/tanstackTable/styles/table.scss +0 -7
- package/src/components/tanstackTable/styles/test.scss +0 -19
|
@@ -9,5 +9,6 @@ export interface CheckboxProps {
|
|
|
9
9
|
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
10
10
|
isDisabled?: boolean;
|
|
11
11
|
defaultChecked?: boolean;
|
|
12
|
+
className?: string;
|
|
12
13
|
}
|
|
13
14
|
export declare const Checkbox: React.ForwardRefExoticComponent<Omit<CheckboxProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -36,6 +36,7 @@ export type Props<T extends object> = {
|
|
|
36
36
|
clearFilters?: () => void;
|
|
37
37
|
hasFilters?: boolean;
|
|
38
38
|
isLoading?: boolean;
|
|
39
|
+
isLoadingMessage?: string;
|
|
39
40
|
defaultPinnedColumns?: string[];
|
|
40
41
|
onClickRow?: ((row: Row<T>) => void) | null;
|
|
41
42
|
onRowClick?: (row: T) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Props } from './TankstackTable.types';
|
|
2
|
-
export declare function TanstackTable<T extends object>({ columns: defaultColumns, data, className, currentPage, rowCount, rowsPerPage, onChangePage, totalEntriesText, TableActions, error, enableRowSelection, clearFilters, hasFilters, showPagination, isLoading, defaultPinnedColumns, onRowClick, activeRows, isStriped, actionBarClassName, defaultSorting, ...rest }: Props<T & {
|
|
2
|
+
export declare function TanstackTable<T extends object>({ columns: defaultColumns, data, className, currentPage, rowCount, rowsPerPage, onChangePage, totalEntriesText, TableActions, error, enableRowSelection, clearFilters, hasFilters, showPagination, isLoading, isLoadingMessage, defaultPinnedColumns, onRowClick, activeRows, isStriped, actionBarClassName, defaultSorting, ...rest }: Props<T & {
|
|
3
3
|
id: string;
|
|
4
4
|
}>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,8 +4,6 @@ export type Props<T> = {
|
|
|
4
4
|
onRowClick?: ((row: T & {
|
|
5
5
|
id: string;
|
|
6
6
|
}) => void) | null | undefined;
|
|
7
|
-
isLoading: boolean;
|
|
8
|
-
columnsLength: number;
|
|
9
7
|
activeRows: string[];
|
|
10
8
|
};
|
|
11
|
-
export declare const TableBody: <T>({ table, onRowClick,
|
|
9
|
+
export declare const TableBody: <T>({ table, onRowClick, activeRows }: Props<T>) => import("react/jsx-runtime").JSX.Element;
|
package/lib/index.css
CHANGED
|
@@ -1287,6 +1287,9 @@ a:hover,
|
|
|
1287
1287
|
color: var(--pf-form-input-color);
|
|
1288
1288
|
cursor: pointer;
|
|
1289
1289
|
}
|
|
1290
|
+
.input-wrapper .is-clearable {
|
|
1291
|
+
padding-right: var(--pf-padding-6);
|
|
1292
|
+
}
|
|
1290
1293
|
|
|
1291
1294
|
:root {
|
|
1292
1295
|
--pf-number-input-padding: 10px;
|
|
@@ -2459,23 +2462,6 @@ body div[class*=select__single-value] {
|
|
|
2459
2462
|
--pf-tanstack-table-pagination-font-color: var(--pf-tanstack-table-font-color);
|
|
2460
2463
|
}
|
|
2461
2464
|
|
|
2462
|
-
.tanstack-table__action-bar-test {
|
|
2463
|
-
left: 20% !important;
|
|
2464
|
-
}
|
|
2465
|
-
|
|
2466
|
-
.tanstack-table__action-bar-docs {
|
|
2467
|
-
bottom: unset !important;
|
|
2468
|
-
top: 50% !important;
|
|
2469
|
-
transform: translate(-50%, -50%) !important;
|
|
2470
|
-
}
|
|
2471
|
-
|
|
2472
|
-
.tanstack-table__column.is-pinned {
|
|
2473
|
-
opacity: 1;
|
|
2474
|
-
}
|
|
2475
|
-
.tanstack-table__column.is-not-pinned {
|
|
2476
|
-
opacity: 0.3;
|
|
2477
|
-
}
|
|
2478
|
-
|
|
2479
2465
|
.tanstack-table__action-bar {
|
|
2480
2466
|
position: fixed;
|
|
2481
2467
|
bottom: 170px;
|
|
@@ -2516,10 +2502,10 @@ body div[class*=select__single-value] {
|
|
|
2516
2502
|
.tanstack-table__no-results__text {
|
|
2517
2503
|
font-size: var(--pf-line-height-md);
|
|
2518
2504
|
font-weight: var(--pf-font-weight-medium);
|
|
2519
|
-
color: var(--pf-
|
|
2505
|
+
color: var(--pf-tanstack-table-font-color);
|
|
2520
2506
|
}
|
|
2521
2507
|
.tanstack-table__no-results__text span {
|
|
2522
|
-
color: var(--pf-
|
|
2508
|
+
color: var(--pf-tanstack-table-font-color);
|
|
2523
2509
|
cursor: pointer;
|
|
2524
2510
|
}
|
|
2525
2511
|
.tanstack-table__no-results__text span:hover {
|
|
@@ -2582,11 +2568,6 @@ body div[class*=select__single-value] {
|
|
|
2582
2568
|
.tanstack-table.is-striped .tanstack-table__tbody tr:nth-child(odd) td {
|
|
2583
2569
|
background-color: var(--pf-tanstack-table-stripe-color);
|
|
2584
2570
|
}
|
|
2585
|
-
.tanstack-table .is-loading {
|
|
2586
|
-
border: var(--pf-border-thin) solid var(--pf-border-color-primary);
|
|
2587
|
-
height: 350px;
|
|
2588
|
-
width: 100%;
|
|
2589
|
-
}
|
|
2590
2571
|
.tanstack-table__thead {
|
|
2591
2572
|
position: sticky;
|
|
2592
2573
|
top: 0;
|
package/lib/index.d.ts
CHANGED
|
@@ -311,6 +311,7 @@ interface CheckboxProps {
|
|
|
311
311
|
onChange: (e: React$1.ChangeEvent<HTMLInputElement>) => void;
|
|
312
312
|
isDisabled?: boolean;
|
|
313
313
|
defaultChecked?: boolean;
|
|
314
|
+
className?: string;
|
|
314
315
|
}
|
|
315
316
|
declare const Checkbox: React$1.ForwardRefExoticComponent<Omit<CheckboxProps, "ref"> & React$1.RefAttributes<HTMLInputElement>>;
|
|
316
317
|
|
|
@@ -617,6 +618,7 @@ type Props<T extends object> = {
|
|
|
617
618
|
clearFilters?: () => void;
|
|
618
619
|
hasFilters?: boolean;
|
|
619
620
|
isLoading?: boolean;
|
|
621
|
+
isLoadingMessage?: string;
|
|
620
622
|
defaultPinnedColumns?: string[];
|
|
621
623
|
onClickRow?: ((row: Row$1<T>) => void) | null;
|
|
622
624
|
onRowClick?: (row: T) => void;
|
|
@@ -627,7 +629,7 @@ type Props<T extends object> = {
|
|
|
627
629
|
defaultSorting?: SortingState;
|
|
628
630
|
} & PaginationProps$1;
|
|
629
631
|
|
|
630
|
-
declare function TanstackTable<T extends object>({ columns: defaultColumns, data, className, currentPage, rowCount, rowsPerPage, onChangePage, totalEntriesText, TableActions, error, enableRowSelection, clearFilters, hasFilters, showPagination, isLoading, defaultPinnedColumns, onRowClick, activeRows, isStriped, actionBarClassName, defaultSorting, ...rest }: Props<T & {
|
|
632
|
+
declare function TanstackTable<T extends object>({ columns: defaultColumns, data, className, currentPage, rowCount, rowsPerPage, onChangePage, totalEntriesText, TableActions, error, enableRowSelection, clearFilters, hasFilters, showPagination, isLoading, isLoadingMessage, defaultPinnedColumns, onRowClick, activeRows, isStriped, actionBarClassName, defaultSorting, ...rest }: Props<T & {
|
|
631
633
|
id: string;
|
|
632
634
|
}>): react_jsx_runtime.JSX.Element;
|
|
633
635
|
|
package/lib/index.esm.css
CHANGED
|
@@ -1287,6 +1287,9 @@ a:hover,
|
|
|
1287
1287
|
color: var(--pf-form-input-color);
|
|
1288
1288
|
cursor: pointer;
|
|
1289
1289
|
}
|
|
1290
|
+
.input-wrapper .is-clearable {
|
|
1291
|
+
padding-right: var(--pf-padding-6);
|
|
1292
|
+
}
|
|
1290
1293
|
|
|
1291
1294
|
:root {
|
|
1292
1295
|
--pf-number-input-padding: 10px;
|
|
@@ -2459,23 +2462,6 @@ body div[class*=select__single-value] {
|
|
|
2459
2462
|
--pf-tanstack-table-pagination-font-color: var(--pf-tanstack-table-font-color);
|
|
2460
2463
|
}
|
|
2461
2464
|
|
|
2462
|
-
.tanstack-table__action-bar-test {
|
|
2463
|
-
left: 20% !important;
|
|
2464
|
-
}
|
|
2465
|
-
|
|
2466
|
-
.tanstack-table__action-bar-docs {
|
|
2467
|
-
bottom: unset !important;
|
|
2468
|
-
top: 50% !important;
|
|
2469
|
-
transform: translate(-50%, -50%) !important;
|
|
2470
|
-
}
|
|
2471
|
-
|
|
2472
|
-
.tanstack-table__column.is-pinned {
|
|
2473
|
-
opacity: 1;
|
|
2474
|
-
}
|
|
2475
|
-
.tanstack-table__column.is-not-pinned {
|
|
2476
|
-
opacity: 0.3;
|
|
2477
|
-
}
|
|
2478
|
-
|
|
2479
2465
|
.tanstack-table__action-bar {
|
|
2480
2466
|
position: fixed;
|
|
2481
2467
|
bottom: 170px;
|
|
@@ -2516,10 +2502,10 @@ body div[class*=select__single-value] {
|
|
|
2516
2502
|
.tanstack-table__no-results__text {
|
|
2517
2503
|
font-size: var(--pf-line-height-md);
|
|
2518
2504
|
font-weight: var(--pf-font-weight-medium);
|
|
2519
|
-
color: var(--pf-
|
|
2505
|
+
color: var(--pf-tanstack-table-font-color);
|
|
2520
2506
|
}
|
|
2521
2507
|
.tanstack-table__no-results__text span {
|
|
2522
|
-
color: var(--pf-
|
|
2508
|
+
color: var(--pf-tanstack-table-font-color);
|
|
2523
2509
|
cursor: pointer;
|
|
2524
2510
|
}
|
|
2525
2511
|
.tanstack-table__no-results__text span:hover {
|
|
@@ -2582,11 +2568,6 @@ body div[class*=select__single-value] {
|
|
|
2582
2568
|
.tanstack-table.is-striped .tanstack-table__tbody tr:nth-child(odd) td {
|
|
2583
2569
|
background-color: var(--pf-tanstack-table-stripe-color);
|
|
2584
2570
|
}
|
|
2585
|
-
.tanstack-table .is-loading {
|
|
2586
|
-
border: var(--pf-border-thin) solid var(--pf-border-color-primary);
|
|
2587
|
-
height: 350px;
|
|
2588
|
-
width: 100%;
|
|
2589
|
-
}
|
|
2590
2571
|
.tanstack-table__thead {
|
|
2591
2572
|
position: sticky;
|
|
2592
2573
|
top: 0;
|
package/lib/index.esm.js
CHANGED
|
@@ -5473,6 +5473,7 @@ const Input = React__default.forwardRef((_a, ref) => {
|
|
|
5473
5473
|
onChange === null || onChange === void 0 ? void 0 : onChange({ target: { value: '' } });
|
|
5474
5474
|
};
|
|
5475
5475
|
const inputClasses = classNames('input', {
|
|
5476
|
+
'is-clearable': isClearable,
|
|
5476
5477
|
error: hasErrors,
|
|
5477
5478
|
'input--has-icon': iconName,
|
|
5478
5479
|
}, className);
|
|
@@ -5515,7 +5516,7 @@ const Pagination = (_a) => {
|
|
|
5515
5516
|
const isNextButtonDisabled = currentPage === totalPages;
|
|
5516
5517
|
const isPreviousButtonDisabled = currentPage === 1;
|
|
5517
5518
|
const hasError = Number(inputValue) > totalPages || Number(inputValue) < 1;
|
|
5518
|
-
return (jsx("div", Object.assign({ className: classes }, rest, { children: jsx(Container, { children: jsxs(Row, { gutterWidth: 12, align: "center", children: [jsx(Col, { xs: "content", children: jsx("div", { className: "pagination__previous", children: jsx(Button$1, { "data-testid": "pagination-previous-button", ariaLabel: "Previous Page", variant: "link", onClick: handlePreviousPage, iconLeft: "chevron-left", isDisabled: isPreviousButtonDisabled }) }) }), jsx(Col, { xs: "content", children: jsx("div", { className: "pagination__current-page", children: jsx(LabeledInput, { "data-testid": "pagination-current-page-input", className: classNames('pagination__current-page-input', {
|
|
5519
|
+
return (jsx("div", Object.assign({ className: classes }, rest, { children: jsx(Container, { children: jsxs(Row, { gutterWidth: 12, align: "center", children: [jsx(Col, { xs: "content", children: jsx("div", { className: "pagination__previous", children: jsx(Button$1, { "data-testid": "pagination-previous-button", ariaLabel: "Previous Page", variant: "link", onClick: handlePreviousPage, iconLeft: "chevron-left", isDisabled: isPreviousButtonDisabled || totalPages === 0 }) }) }), jsx(Col, { xs: "content", children: jsx("div", { className: "pagination__current-page", children: jsx(LabeledInput, { "data-testid": "pagination-current-page-input", className: classNames('pagination__current-page-input', {
|
|
5519
5520
|
'has-error': hasError,
|
|
5520
5521
|
}), value: totalPages === 0 ? '0' : inputValue, name: "currentPage", label: "Current Page", hasHiddenLabel: true, onKeyDown: (e) => {
|
|
5521
5522
|
if (e.key === 'Enter') {
|
|
@@ -5527,7 +5528,7 @@ const Pagination = (_a) => {
|
|
|
5527
5528
|
if (value === '' || /^\d*$/.test(value)) {
|
|
5528
5529
|
setInputValue(value);
|
|
5529
5530
|
}
|
|
5530
|
-
}, onBlur: (e) => validateAndUpdatePage(e.currentTarget.value) }) }) }), jsx(Col, { xs: "content", children: jsx("p", { className: "pagination__page-total", children: totalPagesText }) }), jsx(Col, { xs: "content", children: jsx("div", { className: "pagination__next", children: jsx(Button$1, { "data-testid": "pagination-next-button", ariaLabel: "Next Page", variant: "link", onClick: handleNextPage, iconLeft: "chevron-right", isDisabled: isNextButtonDisabled }) }) })] }) }) })));
|
|
5531
|
+
}, onBlur: (e) => validateAndUpdatePage(e.currentTarget.value) }) }) }), jsx(Col, { xs: "content", children: jsx("p", { className: "pagination__page-total", children: totalPagesText }) }), jsx(Col, { xs: "content", children: jsx("div", { className: "pagination__next", children: jsx(Button$1, { "data-testid": "pagination-next-button", ariaLabel: "Next Page", variant: "link", onClick: handleNextPage, iconLeft: "chevron-right", isDisabled: isNextButtonDisabled || totalPages === 0 }) }) })] }) }) })));
|
|
5531
5532
|
};
|
|
5532
5533
|
|
|
5533
5534
|
const TablePagination$1 = ({ rowsPerPage, rowCount, onChangePage, currentPage, totalEntriesText, }) => {
|
|
@@ -5779,8 +5780,8 @@ const Radio = React__default.forwardRef((_a, ref) => {
|
|
|
5779
5780
|
});
|
|
5780
5781
|
|
|
5781
5782
|
const Checkbox = React__default.forwardRef((_a, ref) => {
|
|
5782
|
-
var { id, label, name, value, onChange, isDisabled, isChecked = false } = _a, rest = __rest(_a, ["id", "label", "name", "value", "onChange", "isDisabled", "isChecked"]);
|
|
5783
|
-
return (jsx("div", { className: "form-control", children: jsxs("div", { className: "checkbox-wrapper", children: [jsx("input", Object.assign({ "data-testid": `form-checkbox-input-${name}`, className:
|
|
5783
|
+
var { id, label, name, value, onChange, isDisabled, isChecked = false, className } = _a, rest = __rest(_a, ["id", "label", "name", "value", "onChange", "isDisabled", "isChecked", "className"]);
|
|
5784
|
+
return (jsx("div", { className: "form-control", children: jsxs("div", { className: "checkbox-wrapper", children: [jsx("input", Object.assign({ "data-testid": `form-checkbox-input-${name}`, className: classNames('checkbox-input', className), type: "checkbox", id: id, name: name, value: value, checked: isChecked, disabled: isDisabled, ref: ref, onChange: onChange, tabIndex: 0, "aria-describedby": id, "aria-label": label }, rest)), jsx("label", { htmlFor: id, className: "checkbox-input-label", "data-testid": `label-checkbox-input-${name}`, children: label })] }) }));
|
|
5784
5785
|
});
|
|
5785
5786
|
|
|
5786
5787
|
const Toggle = React__default.forwardRef((_a, ref) => {
|
|
@@ -41453,35 +41454,37 @@ const TableHeader = forwardRef(({ table }, ref) => {
|
|
|
41453
41454
|
}) }, headerGroup.id))) }));
|
|
41454
41455
|
});
|
|
41455
41456
|
|
|
41457
|
+
const TableBody = ({ table, onRowClick, activeRows }) => {
|
|
41458
|
+
return (jsx(Fragment, { children: table.getRowModel().rows.map((row) => (jsx("tr", { className: classNames('tanstack-table__tbody__tr', {
|
|
41459
|
+
'is-selected': row.getIsSelected(),
|
|
41460
|
+
'show-hover': !!onRowClick,
|
|
41461
|
+
'is-clicked': activeRows.includes(row.id), // Checkbox Is clicked
|
|
41462
|
+
}), children: row.getVisibleCells().map((cell) => {
|
|
41463
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
41464
|
+
const { columnDef } = cell.column;
|
|
41465
|
+
return (jsx("td", { className: classNames('tanstack-table__tbody__td', {
|
|
41466
|
+
'pa-0': !!((_c = (_b = (_a = columnDef.meta) === null || _a === void 0 ? void 0 : _a.styles) === null || _b === void 0 ? void 0 : _b.cell) === null || _c === void 0 ? void 0 : _c.hasNoPadding),
|
|
41467
|
+
}), style: Object.assign({}, getTdStyles(cell.column, (_f = (_e = (_d = columnDef.meta) === null || _d === void 0 ? void 0 : _d.styles) === null || _e === void 0 ? void 0 : _e.cell) === null || _f === void 0 ? void 0 : _f.textAlign, (_h = (_g = columnDef.meta) === null || _g === void 0 ? void 0 : _g.styles) === null || _h === void 0 ? void 0 : _h.definedColumnSize, cell.column.getSize())), onClick: () => {
|
|
41468
|
+
var _a, _b, _c;
|
|
41469
|
+
// if the cell is not preventRowSelection, then we can click the row
|
|
41470
|
+
if (!((_c = (_b = (_a = columnDef.meta) === null || _a === void 0 ? void 0 : _a.styles) === null || _b === void 0 ? void 0 : _b.cell) === null || _c === void 0 ? void 0 : _c.preventRowSelection)) {
|
|
41471
|
+
onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(row);
|
|
41472
|
+
}
|
|
41473
|
+
}, children: flexRender(columnDef.cell, cell.getContext()) }, cell.id));
|
|
41474
|
+
}) }, row.id))) }));
|
|
41475
|
+
};
|
|
41476
|
+
|
|
41456
41477
|
function CirclePulse(_a) {
|
|
41457
41478
|
var { size = 'md', className } = _a, rest = __rest(_a, ["size", "className"]);
|
|
41458
41479
|
return (jsx("div", Object.assign({ className: `circle-pulse circle-pulse-${size} ${className}`, "aria-hidden": true }, rest)));
|
|
41459
41480
|
}
|
|
41460
41481
|
|
|
41461
|
-
const
|
|
41462
|
-
return (
|
|
41463
|
-
'is-selected': row.getIsSelected(),
|
|
41464
|
-
'show-hover': !!onRowClick,
|
|
41465
|
-
'is-clicked': activeRows.includes(row.id), // Checkbox Is clicked
|
|
41466
|
-
}), children: row.getVisibleCells().map((cell) => {
|
|
41467
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
41468
|
-
const { columnDef } = cell.column;
|
|
41469
|
-
return (jsx("td", { className: classNames('tanstack-table__tbody__td', {
|
|
41470
|
-
'pa-0': !!((_c = (_b = (_a = columnDef.meta) === null || _a === void 0 ? void 0 : _a.styles) === null || _b === void 0 ? void 0 : _b.cell) === null || _c === void 0 ? void 0 : _c.hasNoPadding),
|
|
41471
|
-
}), style: Object.assign({}, getTdStyles(cell.column, (_f = (_e = (_d = columnDef.meta) === null || _d === void 0 ? void 0 : _d.styles) === null || _e === void 0 ? void 0 : _e.cell) === null || _f === void 0 ? void 0 : _f.textAlign, (_h = (_g = columnDef.meta) === null || _g === void 0 ? void 0 : _g.styles) === null || _h === void 0 ? void 0 : _h.definedColumnSize, cell.column.getSize())), onClick: () => {
|
|
41472
|
-
var _a, _b, _c;
|
|
41473
|
-
// if the cell is not preventRowSelection, then we can click the row
|
|
41474
|
-
if (!((_c = (_b = (_a = columnDef.meta) === null || _a === void 0 ? void 0 : _a.styles) === null || _b === void 0 ? void 0 : _b.cell) === null || _c === void 0 ? void 0 : _c.preventRowSelection)) {
|
|
41475
|
-
onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(row);
|
|
41476
|
-
}
|
|
41477
|
-
}, children: flexRender(columnDef.cell, cell.getContext()) }, cell.id));
|
|
41478
|
-
}) }, row.id))), isLoading && (jsx("tr", { className: "tanstack-table__tbody__tr", children: jsxs("td", { className: classNames('tanstack-table__centered-row', {
|
|
41479
|
-
'is-loading': isLoading,
|
|
41480
|
-
}), colSpan: columnsLength, children: [jsx("h2", { className: "mb-12", children: "Table is loading..." }), jsx(CirclePulse, { "data-testid": "loading-indicator" })] }) }))] }));
|
|
41482
|
+
const TableLoading = ({ columns, message }) => {
|
|
41483
|
+
return (jsx("tr", { className: "tanstack-table__tbody__tr ", children: jsxs("td", { className: "tanstack-table__centered-row pa-6", colSpan: columns.length, children: [jsx("h2", { className: "my-12", children: message }), jsx(CirclePulse, { "data-testid": "loading-indicator", className: "mb-14" })] }) }));
|
|
41481
41484
|
};
|
|
41482
41485
|
|
|
41483
41486
|
function TanstackTable(_a) {
|
|
41484
|
-
var { columns: defaultColumns, data, className, currentPage, rowCount, rowsPerPage = 1000, onChangePage, totalEntriesText, TableActions, error, enableRowSelection = true, clearFilters, hasFilters, showPagination = true, isLoading = false, defaultPinnedColumns, onRowClick, activeRows = [], isStriped = true, actionBarClassName, defaultSorting } = _a, rest = __rest(_a, ["columns", "data", "className", "currentPage", "rowCount", "rowsPerPage", "onChangePage", "totalEntriesText", "TableActions", "error", "enableRowSelection", "clearFilters", "hasFilters", "showPagination", "isLoading", "defaultPinnedColumns", "onRowClick", "activeRows", "isStriped", "actionBarClassName", "defaultSorting"]);
|
|
41487
|
+
var { columns: defaultColumns, data, className, currentPage, rowCount, rowsPerPage = 1000, onChangePage, totalEntriesText, TableActions, error, enableRowSelection = true, clearFilters, hasFilters, showPagination = true, isLoading = false, isLoadingMessage = 'Table is loading...', defaultPinnedColumns, onRowClick, activeRows = [], isStriped = true, actionBarClassName, defaultSorting } = _a, rest = __rest(_a, ["columns", "data", "className", "currentPage", "rowCount", "rowsPerPage", "onChangePage", "totalEntriesText", "TableActions", "error", "enableRowSelection", "clearFilters", "hasFilters", "showPagination", "isLoading", "isLoadingMessage", "defaultPinnedColumns", "onRowClick", "activeRows", "isStriped", "actionBarClassName", "defaultSorting"]);
|
|
41485
41488
|
const { columns, defaultData, windowWidth, rowSelection, // This refers to the checkboxes.
|
|
41486
41489
|
setRowSelection, formattedColumns, setFormattedColumns, } = useTanstackTable({
|
|
41487
41490
|
defaultColumns,
|
|
@@ -41524,12 +41527,16 @@ function TanstackTable(_a) {
|
|
|
41524
41527
|
? (_a = error === null || error === void 0 ? void 0 : error.errorMessage) !== null && _a !== void 0 ? _a : 'There was an error isLoading the data.'
|
|
41525
41528
|
: 'No results found.' }) }) }));
|
|
41526
41529
|
}
|
|
41527
|
-
|
|
41530
|
+
if (isLoading) {
|
|
41531
|
+
return jsx(TableLoading, { columns: columns, message: isLoadingMessage });
|
|
41532
|
+
}
|
|
41533
|
+
return (jsx(TableBody, { table: table, onRowClick: onRowClick, activeRows: activeRows }));
|
|
41528
41534
|
};
|
|
41529
41535
|
return (jsxs("div", { className: "tanstack-table__outer-container", children: [jsxs("div", { className: "tanstack-table__container", children: [jsxs("table", { className: classNames('tanstack-table', className, {
|
|
41530
|
-
'is-Loading': isLoading,
|
|
41531
41536
|
'is-striped': isStriped,
|
|
41532
|
-
}), children: [jsx("thead", { className: "tanstack-table__thead", children: jsx(TableHeader, { table: table, ref: thRefs }) }), jsx("tbody", { className: "tanstack-table__tbody", children: renderBody() })] }), hasSelectedRows && (jsx(ActionBar, { table: table, TableActions: TableActions, className: actionBarClassName }))] }), shouldRenderPagination ? (jsx(TablePagination, { currentPage: currentPage, rowCount: rowCount, onChangePage: onChangePage, rowsPerPage: rowsPerPage, totalEntriesText: totalEntriesText !== null && totalEntriesText !== void 0 ? totalEntriesText :
|
|
41537
|
+
}), children: [jsx("thead", { className: "tanstack-table__thead", children: jsx(TableHeader, { table: table, ref: thRefs }) }), jsx("tbody", { className: "tanstack-table__tbody", children: renderBody() })] }), hasSelectedRows && (jsx(ActionBar, { table: table, TableActions: TableActions, className: actionBarClassName }))] }), shouldRenderPagination ? (jsx(TablePagination, { currentPage: currentPage, rowCount: rowCount, onChangePage: onChangePage, rowsPerPage: rowsPerPage, totalEntriesText: (totalEntriesText !== null && totalEntriesText !== void 0 ? totalEntriesText : rowCount === 1)
|
|
41538
|
+
? '1 entry'
|
|
41539
|
+
: `${totalRowsOnPage} of ${rowCount} entries` })) : null] }));
|
|
41533
41540
|
}
|
|
41534
41541
|
|
|
41535
41542
|
/**
|