@indico-data/design-system 2.60.0 → 2.60.2
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/tanstackTable/TankstackTable.types.d.ts +1 -0
- package/lib/components/tanstackTable/TanstackTable.d.ts +1 -1
- package/lib/index.css +30 -21
- package/lib/index.d.ts +2 -1
- package/lib/index.esm.css +30 -21
- package/lib/index.esm.js +2 -1
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/table/styles/Table.scss +0 -9
- package/src/components/tanstackTable/TankstackTable.types.ts +1 -0
- package/src/components/tanstackTable/TanstackTable.stories.tsx +54 -0
- package/src/components/tanstackTable/TanstackTable.tsx +3 -2
- package/src/components/tanstackTable/components/ActionBar/ActionBar.scss +1 -1
- package/src/components/tanstackTable/styles/_variables.scss +16 -9
- package/src/components/tanstackTable/styles/table.scss +24 -4
package/package.json
CHANGED
|
@@ -166,12 +166,3 @@
|
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
|
|
170
|
-
.table__pagination {
|
|
171
|
-
padding-bottom: var(--pf-padding-4);
|
|
172
|
-
padding-top: var(--pf-padding-4);
|
|
173
|
-
background-color: var(--pf-table-pagination-background-color);
|
|
174
|
-
padding-left: var(
|
|
175
|
-
--pf-padding-4
|
|
176
|
-
); // buttons have a visual illusion of having a gap, so we add padding to adjust the left side when the total results exist
|
|
177
|
-
}
|
|
@@ -22,8 +22,18 @@ const meta: Meta = {
|
|
|
22
22
|
enableRowSelection: true,
|
|
23
23
|
showPagination: false,
|
|
24
24
|
onClickRow: null,
|
|
25
|
+
isStriped: true,
|
|
25
26
|
},
|
|
26
27
|
argTypes: {
|
|
28
|
+
isStriped: {
|
|
29
|
+
description: 'Striped rows',
|
|
30
|
+
defaultValue: { summary: 'true' },
|
|
31
|
+
control: { type: 'boolean' },
|
|
32
|
+
table: {
|
|
33
|
+
category: 'Props',
|
|
34
|
+
type: { summary: 'boolean' },
|
|
35
|
+
},
|
|
36
|
+
},
|
|
27
37
|
data: {
|
|
28
38
|
description:
|
|
29
39
|
'Array of data items. These are the items that will be displayed in the table cell.',
|
|
@@ -181,6 +191,50 @@ const meta: Meta = {
|
|
|
181
191
|
type: { summary: 'string' },
|
|
182
192
|
},
|
|
183
193
|
},
|
|
194
|
+
|
|
195
|
+
onRowClick: {
|
|
196
|
+
description: 'Callback when a row is clicked.',
|
|
197
|
+
action: 'onRowClick',
|
|
198
|
+
control: false,
|
|
199
|
+
table: {
|
|
200
|
+
category: 'Callbacks',
|
|
201
|
+
type: { summary: '(row: Row<T>) => void' },
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
activeRows: {
|
|
205
|
+
description: 'Array of active rows.',
|
|
206
|
+
control: false,
|
|
207
|
+
table: {
|
|
208
|
+
category: 'Props',
|
|
209
|
+
type: { summary: 'string[]' },
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
onSelectAllChange: {
|
|
213
|
+
description: 'Callback when all rows are selected.',
|
|
214
|
+
action: 'onSelectAllChange',
|
|
215
|
+
control: false,
|
|
216
|
+
table: {
|
|
217
|
+
category: 'Callbacks',
|
|
218
|
+
type: { summary: '(isSelected: boolean) => void' },
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
onRowSelectionChange: {
|
|
222
|
+
description: 'Callback when a row is selected.',
|
|
223
|
+
action: 'onRowSelectionChange',
|
|
224
|
+
control: false,
|
|
225
|
+
table: {
|
|
226
|
+
category: 'Callbacks',
|
|
227
|
+
type: { summary: '(updater: Record<string, boolean>) => void' },
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
rowSelection: {
|
|
231
|
+
description: 'Row selection state.',
|
|
232
|
+
control: false,
|
|
233
|
+
table: {
|
|
234
|
+
category: 'Props',
|
|
235
|
+
type: { summary: 'Record<string, boolean>' },
|
|
236
|
+
},
|
|
237
|
+
},
|
|
184
238
|
},
|
|
185
239
|
decorators: [(Story) => <Story />],
|
|
186
240
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect, useRef } from 'react';
|
|
2
2
|
|
|
3
|
-
import { useReactTable, getCoreRowModel
|
|
3
|
+
import { useReactTable, getCoreRowModel } from '@tanstack/react-table';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
|
|
6
6
|
import { ActionBar } from './components/ActionBar';
|
|
@@ -11,7 +11,6 @@ import { Props } from './TankstackTable.types';
|
|
|
11
11
|
import { useTanstackTable } from './useTanstackTable';
|
|
12
12
|
import { TableHeader } from './components/TableHeader';
|
|
13
13
|
import { TableBody } from './components/TableBody';
|
|
14
|
-
import { columns } from './mock-data/table-configuration';
|
|
15
14
|
|
|
16
15
|
export function TanstackTable<T extends object>({
|
|
17
16
|
columns: defaultColumns,
|
|
@@ -32,6 +31,7 @@ export function TanstackTable<T extends object>({
|
|
|
32
31
|
defaultPinnedColumns,
|
|
33
32
|
onRowClick,
|
|
34
33
|
activeRows = [],
|
|
34
|
+
isStriped = true,
|
|
35
35
|
actionBarClassName,
|
|
36
36
|
...rest
|
|
37
37
|
}: Props<T & { id: string }>) {
|
|
@@ -135,6 +135,7 @@ export function TanstackTable<T extends object>({
|
|
|
135
135
|
<table
|
|
136
136
|
className={classNames('tanstack-table', className, {
|
|
137
137
|
'is-Loading': isLoading,
|
|
138
|
+
'is-striped': isStriped,
|
|
138
139
|
})}
|
|
139
140
|
>
|
|
140
141
|
<thead className="tanstack-table__thead">
|
|
@@ -2,23 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
:root [data-theme='light'] {
|
|
4
4
|
--pf-tanstack-table-background-color: var(--pf-white-color);
|
|
5
|
-
--pf-tanstack-table-
|
|
6
|
-
|
|
7
|
-
--pf-tanstack-table-
|
|
8
|
-
--pf-tanstack-table-
|
|
5
|
+
--pf-tanstack-table-header-background-color: var(--pf-gray-color-900);
|
|
6
|
+
|
|
7
|
+
--pf-tanstack-table-font-color: var(--pf-gray-color-300);
|
|
8
|
+
--pf-tanstack-table-border-color: var(--pf-gray-color-700);
|
|
9
|
+
--pf-tanstack-table-stripe-color: var(--pf-gray-color-950);
|
|
10
|
+
--pf-tanstack-table-hover-color: var(--pf-secondary-color-900);
|
|
9
11
|
--pf-tanstack-table-disabled-color: var(--pf-gray-color-300);
|
|
10
|
-
--pf-tanstack-table-checked-color: var(--pf-
|
|
11
|
-
--pf-tanstack-table-clicked-color: var(--pf-
|
|
12
|
-
--pf-tanstack-table-highlighted-color: var(--pf-gray-color-
|
|
13
|
-
--pf-tanstack-table-highlighted-box-shadow: 0 4px 8px rgba(0, 0, 0, 0.
|
|
14
|
-
0 8px
|
|
12
|
+
--pf-tanstack-table-checked-color: var(--pf-gray-color-900);
|
|
13
|
+
--pf-tanstack-table-clicked-color: var(--pf-gray-color-800);
|
|
14
|
+
--pf-tanstack-table-highlighted-color: var(--pf-gray-color-700);
|
|
15
|
+
--pf-tanstack-table-highlighted-box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1),
|
|
16
|
+
0 4px 8px rgba(0, 0, 0, 0.1);
|
|
15
17
|
--pf-tanstack-table-font-size: var(--pf-font-size-body2);
|
|
18
|
+
--pf-tanstack-table-pagination-background-color: var(--pf-tanstack-table-background-color);
|
|
19
|
+
--pf-tanstack-table-pagination-font-color: var(--pf-tanstack-table-font-color);
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
// Dark Theme Specific Variables
|
|
19
23
|
:root [data-theme='dark'],
|
|
20
24
|
:root {
|
|
21
25
|
--pf-tanstack-table-background-color: var(--pf-primary-color-800);
|
|
26
|
+
--pf-tanstack-table-header-background-color: var(--pf-primary-color-800);
|
|
27
|
+
|
|
22
28
|
--pf-tanstack-table-font-color: var(--pf-white-color);
|
|
23
29
|
--pf-tanstack-table-border-color: var(--pf-tertiary-color-800);
|
|
24
30
|
--pf-tanstack-table-stripe-color: var(--pf-primary-color-700);
|
|
@@ -32,4 +38,5 @@
|
|
|
32
38
|
0 8px 16px rgba(0, 0, 0, 0.3);
|
|
33
39
|
--pf-tanstack-table-font-size: var(--pf-font-size-body2);
|
|
34
40
|
--pf-tanstack-table-pagination-background-color: var(--pf-primary-color-700);
|
|
41
|
+
--pf-tanstack-table-pagination-font-color: var(--pf-tanstack-table-font-color);
|
|
35
42
|
}
|
|
@@ -64,6 +64,16 @@
|
|
|
64
64
|
border-radius: var(--pf-rounded-lg);
|
|
65
65
|
width: 100%;
|
|
66
66
|
|
|
67
|
+
&.is-striped {
|
|
68
|
+
.tanstack-table__tbody {
|
|
69
|
+
tr:nth-child(odd) {
|
|
70
|
+
td {
|
|
71
|
+
background-color: var(--pf-tanstack-table-stripe-color);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
67
77
|
.is-loading {
|
|
68
78
|
border: var(--pf-border-thin) solid var(--pf-border-color);
|
|
69
79
|
height: 350px;
|
|
@@ -92,7 +102,7 @@
|
|
|
92
102
|
|
|
93
103
|
&__th {
|
|
94
104
|
color: var(--pf-tanstack-table-font-color);
|
|
95
|
-
background: var(--pf-tanstack-table-background-color);
|
|
105
|
+
background: var(--pf-tanstack-table-header-background-color);
|
|
96
106
|
font-size: var(--pf-tanstack-table-font-size);
|
|
97
107
|
font-weight: var(--pf-font-weight-medium);
|
|
98
108
|
box-sizing: border-box;
|
|
@@ -135,14 +145,14 @@
|
|
|
135
145
|
|
|
136
146
|
&.is-selected {
|
|
137
147
|
td {
|
|
138
|
-
background: var(--pf-tanstack-table-checked-color);
|
|
148
|
+
background: var(--pf-tanstack-table-checked-color) !important;
|
|
139
149
|
}
|
|
140
150
|
}
|
|
141
151
|
|
|
142
152
|
&.show-hover {
|
|
143
153
|
&:hover {
|
|
144
154
|
td {
|
|
145
|
-
background-color: var(--pf-tanstack-table-hover-color);
|
|
155
|
+
background-color: var(--pf-tanstack-table-hover-color) !important;
|
|
146
156
|
cursor: pointer;
|
|
147
157
|
}
|
|
148
158
|
}
|
|
@@ -150,7 +160,7 @@
|
|
|
150
160
|
|
|
151
161
|
&.is-clicked {
|
|
152
162
|
td {
|
|
153
|
-
background-color: var(--pf-tanstack-table-clicked-color);
|
|
163
|
+
background-color: var(--pf-tanstack-table-clicked-color) !important;
|
|
154
164
|
}
|
|
155
165
|
}
|
|
156
166
|
}
|
|
@@ -216,3 +226,13 @@
|
|
|
216
226
|
}
|
|
217
227
|
}
|
|
218
228
|
}
|
|
229
|
+
|
|
230
|
+
.table__pagination {
|
|
231
|
+
padding-bottom: var(--pf-padding-4);
|
|
232
|
+
padding-top: var(--pf-padding-4);
|
|
233
|
+
color: var(--pf-tanstack-table-pagination-font-color);
|
|
234
|
+
background-color: var(--pf-tanstack-table-pagination-background-color);
|
|
235
|
+
padding-left: var(
|
|
236
|
+
--pf-padding-4
|
|
237
|
+
); // buttons have a visual illusion of having a gap, so we add padding to adjust the left side when the total results exist
|
|
238
|
+
}
|