@indico-data/design-system 2.50.0 → 2.51.0
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 +40 -0
- package/lib/components/tanstackTable/TanstackTable.stories.d.ts +15 -0
- package/lib/components/tanstackTable/TanstakTable.d.ts +4 -0
- package/lib/components/tanstackTable/__tests__/TanstackTable.test.d.ts +1 -0
- package/lib/components/tanstackTable/__tests__/__mocks__/test-mock-data.d.ts +8 -0
- package/lib/components/tanstackTable/components/ActionBar/ActionBar.d.ts +17 -0
- package/lib/components/tanstackTable/components/ActionBar/ActionBar.stories.d.ts +10 -0
- package/lib/components/tanstackTable/components/ActionBar/__tests__/ActionBar.test.d.ts +1 -0
- package/lib/components/tanstackTable/components/ActionBar/index.d.ts +1 -0
- package/lib/components/tanstackTable/components/NoResults/NoResults.d.ts +7 -0
- package/lib/components/tanstackTable/components/NoResults/__tests__/NoResult.test.d.ts +1 -0
- package/lib/components/tanstackTable/components/NoResults/index.d.ts +1 -0
- package/lib/components/tanstackTable/components/TableBody/TableBody.d.ts +12 -0
- package/lib/components/tanstackTable/components/TableBody/index.d.ts +1 -0
- package/lib/components/tanstackTable/components/TableHeader/TableHeader.d.ts +6 -0
- package/lib/components/tanstackTable/components/TableHeader/index.d.ts +1 -0
- package/lib/components/tanstackTable/components/TablePagination/TablePagination.d.ts +9 -0
- package/lib/components/tanstackTable/components/TablePagination/__tests__/TablePagination.test.d.ts +1 -0
- package/lib/components/tanstackTable/components/TablePagination/index.d.ts +1 -0
- package/lib/components/tanstackTable/docs/pinnedColumns/PinnedColumn.stories.d.ts +7 -0
- package/lib/components/tanstackTable/docs/withRowClick/WithRowClick.stories.d.ts +7 -0
- package/lib/components/tanstackTable/helpers.d.ts +830 -0
- package/lib/components/tanstackTable/index.d.ts +2 -0
- package/lib/components/tanstackTable/mock-data/mock-data.d.ts +14 -0
- package/lib/components/tanstackTable/mock-data/table-configuration.d.ts +3 -0
- package/lib/components/tanstackTable/useTanstackTable.d.ts +16 -0
- package/lib/index.css +247 -0
- package/lib/index.d.ts +62 -17
- package/lib/index.esm.css +247 -0
- package/lib/index.esm.js +20455 -56
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +20455 -55
- package/lib/index.js.map +1 -1
- package/package.json +2 -1
- package/src/components/tanstackTable/TankstackTable.types.ts +39 -0
- package/src/components/tanstackTable/TanstackTable.mdx +122 -0
- package/src/components/tanstackTable/TanstackTable.stories.tsx +260 -0
- package/src/components/tanstackTable/TanstakTable.tsx +157 -0
- package/src/components/tanstackTable/__tests__/TanstackTable.test.tsx +87 -0
- package/src/components/tanstackTable/__tests__/__mocks__/test-mock-data.tsx +83 -0
- package/src/components/tanstackTable/components/ActionBar/ActionBar.mdx +10 -0
- package/src/components/tanstackTable/components/ActionBar/ActionBar.scss +30 -0
- package/src/components/tanstackTable/components/ActionBar/ActionBar.stories.tsx +98 -0
- package/src/components/tanstackTable/components/ActionBar/ActionBar.tsx +51 -0
- package/src/components/tanstackTable/components/ActionBar/__tests__/ActionBar.test.tsx +87 -0
- package/src/components/tanstackTable/components/ActionBar/index.ts +1 -0
- package/src/components/tanstackTable/components/NoResults/NoResults.scss +24 -0
- package/src/components/tanstackTable/components/NoResults/NoResults.tsx +22 -0
- package/src/components/tanstackTable/components/NoResults/__tests__/NoResult.test.tsx +25 -0
- package/src/components/tanstackTable/components/NoResults/index.ts +1 -0
- package/src/components/tanstackTable/components/TableBody/TableBody.tsx +87 -0
- package/src/components/tanstackTable/components/TableBody/index.ts +1 -0
- package/src/components/tanstackTable/components/TableHeader/TableHeader.tsx +49 -0
- package/src/components/tanstackTable/components/TableHeader/index.ts +1 -0
- package/src/components/tanstackTable/components/TablePagination/TablePagination.tsx +45 -0
- package/src/components/tanstackTable/components/TablePagination/__tests__/TablePagination.test.tsx +18 -0
- package/src/components/tanstackTable/components/TablePagination/index.ts +1 -0
- package/src/components/tanstackTable/docs/pinnedColumns/PinnedColumn.mdx +34 -0
- package/src/components/tanstackTable/docs/pinnedColumns/PinnedColumn.stories.tsx +40 -0
- package/src/components/tanstackTable/docs/withRowClick/WithRowClick.mdx +48 -0
- package/src/components/tanstackTable/docs/withRowClick/WithRowClick.stories.tsx +32 -0
- package/src/components/tanstackTable/helpers.ts +45 -0
- package/src/components/tanstackTable/index.ts +2 -0
- package/src/components/tanstackTable/mock-data/mock-data.ts +256 -0
- package/src/components/tanstackTable/mock-data/table-configuration.tsx +219 -0
- package/src/components/tanstackTable/styles/_variables.scss +35 -0
- package/src/components/tanstackTable/styles/table.scss +204 -0
- package/src/components/tanstackTable/styles/test.scss +19 -0
- package/src/components/tanstackTable/tanstack-table.d.ts +18 -0
- package/src/components/tanstackTable/useTanstackTable.tsx +42 -0
- package/src/index.ts +1 -0
- package/src/legacy/components/loading-indicators/CirclePulse/CirclePulse.tsx +1 -0
- package/src/styles/index.scss +1 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Light Theme Specific Variables
|
|
2
|
+
|
|
3
|
+
:root [data-theme='light'] {
|
|
4
|
+
--pf-tanstack-table-background-color: var(--pf-white-color);
|
|
5
|
+
--pf-tanstack-table-font-color: var(--pf-gray-color);
|
|
6
|
+
--pf-tanstack-table-border-color: var(--pf-gray-color-200);
|
|
7
|
+
--pf-tanstack-table-stripe-color: var(--pf-gray-color-100);
|
|
8
|
+
--pf-tanstack-table-hover-color: var(--pf-gray-color-200);
|
|
9
|
+
--pf-tanstack-table-disabled-color: var(--pf-gray-color-300);
|
|
10
|
+
--pf-tanstack-table-checked-color: var(--pf-secondary-color-950);
|
|
11
|
+
--pf-tanstack-table-clicked-color: var(--pf-secondary-color-100);
|
|
12
|
+
--pf-tanstack-table-highlighted-color: var(--pf-gray-color-200);
|
|
13
|
+
--pf-tanstack-table-highlighted-box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2),
|
|
14
|
+
0 8px 16px rgba(0, 0, 0, 0.2);
|
|
15
|
+
--pf-tanstack-table-font-size: var(--pf-font-size-body2);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Dark Theme Specific Variables
|
|
19
|
+
:root [data-theme='dark'],
|
|
20
|
+
:root {
|
|
21
|
+
--pf-tanstack-table-background-color: var(--pf-primary-color-800);
|
|
22
|
+
--pf-tanstack-table-font-color: var(--pf-white-color);
|
|
23
|
+
--pf-tanstack-table-border-color: var(--pf-tertiary-color-800);
|
|
24
|
+
--pf-tanstack-table-stripe-color: var(--pf-primary-color-700);
|
|
25
|
+
--pf-tanstack-table-hover-color: var(--pf-primary-color-600);
|
|
26
|
+
--pf-tanstack-table-disabled-color: var(--pf-gray-color-900);
|
|
27
|
+
--pf-tanstack-table-disabled-button-color: var(--pf-primary-color-100);
|
|
28
|
+
--pf-tanstack-table-checked-color: var(--pf-secondary-color-950);
|
|
29
|
+
--pf-tanstack-table-clicked-color: var(--pf-primary-color);
|
|
30
|
+
--pf-tanstack-table-highlighted-color: var(--pf-primary-color);
|
|
31
|
+
--pf-tanstack-table-highlighted-box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4),
|
|
32
|
+
0 8px 16px rgba(0, 0, 0, 0.3);
|
|
33
|
+
--pf-tanstack-table-font-size: var(--pf-font-size-body2);
|
|
34
|
+
--pf-tanstack-table-pagination-background-color: var(--pf-primary-color-700);
|
|
35
|
+
}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
@import './_variables.scss';
|
|
2
|
+
@import './test.scss';
|
|
3
|
+
|
|
4
|
+
@import '../components/ActionBar/ActionBar.scss';
|
|
5
|
+
@import '../components/NoResults/NoResults.scss';
|
|
6
|
+
|
|
7
|
+
.tanstack-table__outer-container {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
width: 100%;
|
|
11
|
+
height: 100%;
|
|
12
|
+
|
|
13
|
+
.tanstack-table__container {
|
|
14
|
+
position: relative;
|
|
15
|
+
display: block;
|
|
16
|
+
overflow: auto;
|
|
17
|
+
height: 100%;
|
|
18
|
+
|
|
19
|
+
// Webkit scrollbar styles
|
|
20
|
+
&::-webkit-scrollbar {
|
|
21
|
+
width: var(--pf-size-2);
|
|
22
|
+
height: var(--pf-size-2);
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&::-webkit-scrollbar-track {
|
|
27
|
+
background: var(--pf-tanstack-table-background-color);
|
|
28
|
+
border-radius: var(--pf-rounded);
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&::-webkit-scrollbar-thumb {
|
|
33
|
+
background: var(--pf-tanstack-table-border-color);
|
|
34
|
+
border-radius: var(--pf-rounded);
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
&:hover {
|
|
37
|
+
background: var(--pf-primary-color);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Firefox scrollbar styles
|
|
42
|
+
scrollbar-width: thin;
|
|
43
|
+
scrollbar-color: var(--pf-tanstack-table-border-color) var(--pf-tanstack-table-background-color);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.tanstack-table {
|
|
48
|
+
border-collapse: separate;
|
|
49
|
+
margin: 0;
|
|
50
|
+
table-layout: auto;
|
|
51
|
+
border-spacing: 0;
|
|
52
|
+
border-radius: var(--pf-rounded-lg);
|
|
53
|
+
width: 100%;
|
|
54
|
+
|
|
55
|
+
&.is-loading {
|
|
56
|
+
border: var(--pf-border-thin) solid var(--pf-border-color);
|
|
57
|
+
height: 100%;
|
|
58
|
+
width: 100%;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&__thead {
|
|
62
|
+
position: sticky;
|
|
63
|
+
top: 0;
|
|
64
|
+
z-index: 100;
|
|
65
|
+
box-sizing: border-box;
|
|
66
|
+
|
|
67
|
+
background-color: var(--pf-tanstack-table-background-color);
|
|
68
|
+
|
|
69
|
+
tr:first-child {
|
|
70
|
+
th {
|
|
71
|
+
&:first-child {
|
|
72
|
+
border-top-left-radius: var(--pf-rounded-lg);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&:last-child {
|
|
76
|
+
border-top-right-radius: var(--pf-rounded-lg);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&__th {
|
|
82
|
+
color: var(--pf-tanstack-table-font-color);
|
|
83
|
+
background: var(--pf-tanstack-table-background-color);
|
|
84
|
+
font-size: var(--pf-tanstack-table-font-size);
|
|
85
|
+
font-weight: var(--pf-font-weight-medium);
|
|
86
|
+
box-sizing: border-box;
|
|
87
|
+
|
|
88
|
+
border-top: var(--pf-border-sm) solid var(--pf-tanstack-table-border-color);
|
|
89
|
+
border-bottom: var(--pf-border-sm) solid var(--pf-tanstack-table-border-color);
|
|
90
|
+
border-right: var(--pf-border-sm) solid var(--pf-tanstack-table-border-color);
|
|
91
|
+
|
|
92
|
+
user-select: none;
|
|
93
|
+
|
|
94
|
+
overflow: hidden;
|
|
95
|
+
text-overflow: ellipsis;
|
|
96
|
+
white-space: nowrap;
|
|
97
|
+
|
|
98
|
+
max-width: 300px;
|
|
99
|
+
width: auto;
|
|
100
|
+
padding: 0 var(--pf-padding-2);
|
|
101
|
+
text-align: left;
|
|
102
|
+
|
|
103
|
+
&:first-child {
|
|
104
|
+
border-left: var(--pf-border-sm) solid var(--pf-tanstack-table-border-color);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
&__tbody {
|
|
110
|
+
tr:last-child {
|
|
111
|
+
td {
|
|
112
|
+
&:first-child {
|
|
113
|
+
border-bottom-left-radius: var(--pf-rounded-lg);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
&:last-child {
|
|
117
|
+
border-bottom-right-radius: var(--pf-rounded-lg);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
&__tr {
|
|
123
|
+
background: transparent;
|
|
124
|
+
width: 100%;
|
|
125
|
+
|
|
126
|
+
&.is-selected {
|
|
127
|
+
td {
|
|
128
|
+
background: var(--pf-tanstack-table-checked-color);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
&.show-hover {
|
|
133
|
+
&:hover {
|
|
134
|
+
td {
|
|
135
|
+
background-color: var(--pf-tanstack-table-hover-color);
|
|
136
|
+
cursor: pointer;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
&.is-clicked {
|
|
142
|
+
td {
|
|
143
|
+
background-color: var(--pf-tanstack-table-clicked-color);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
&__td {
|
|
149
|
+
font-size: var(--pf-font-size-base);
|
|
150
|
+
font-weight: var(--pf-font-weight-medium);
|
|
151
|
+
color: var(--pf-tanstack-table-font-color);
|
|
152
|
+
background: var(--pf-tanstack-table-background-color);
|
|
153
|
+
|
|
154
|
+
border-right: var(--pf-border-sm) solid var(--pf-tanstack-table-border-color);
|
|
155
|
+
border-bottom: var(--pf-border-sm) solid var(--pf-tanstack-table-border-color);
|
|
156
|
+
|
|
157
|
+
box-sizing: border-box;
|
|
158
|
+
|
|
159
|
+
overflow: hidden;
|
|
160
|
+
text-overflow: ellipsis;
|
|
161
|
+
white-space: nowrap;
|
|
162
|
+
|
|
163
|
+
padding: 0 var(--pf-padding-2);
|
|
164
|
+
max-width: 300px;
|
|
165
|
+
width: auto;
|
|
166
|
+
text-align: left;
|
|
167
|
+
|
|
168
|
+
&:first-child {
|
|
169
|
+
border-left: var(--pf-border-sm) solid var(--pf-tanstack-table-border-color);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
&__centered-row {
|
|
175
|
+
padding: var(--pf-padding-1) var(--pf-padding-2);
|
|
176
|
+
text-align: center;
|
|
177
|
+
vertical-align: middle;
|
|
178
|
+
height: 100%;
|
|
179
|
+
border: var(--pf-border-sm) solid var(--pf-border-color);
|
|
180
|
+
|
|
181
|
+
@keyframes shimmer {
|
|
182
|
+
0% {
|
|
183
|
+
background-color: var(--pf-primary-color-700) 40;
|
|
184
|
+
}
|
|
185
|
+
50% {
|
|
186
|
+
background-color: var(--pf-primary-color-700);
|
|
187
|
+
}
|
|
188
|
+
100% {
|
|
189
|
+
background-color: var(--pf-primary-color-700) 40;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
animation: none;
|
|
194
|
+
|
|
195
|
+
&.is-loading {
|
|
196
|
+
animation: shimmer 3s ease-in-out infinite;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
svg {
|
|
200
|
+
margin: 0 auto;
|
|
201
|
+
display: block;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
.tanstack-table__action-bar-test {
|
|
2
|
+
left: 20% !important;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.tanstack-table__action-bar-docs {
|
|
6
|
+
bottom: unset !important;
|
|
7
|
+
top: 50% !important;
|
|
8
|
+
transform: translate(-50%, -50%) !important;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.tanstack-table__column {
|
|
12
|
+
&.is-pinned {
|
|
13
|
+
opacity: 1;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&.is-not-pinned {
|
|
17
|
+
opacity: 0.3;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
+
import '@tanstack/react-table';
|
|
3
|
+
|
|
4
|
+
declare module '@tanstack/react-table' {
|
|
5
|
+
interface ColumnMeta<TData extends RowData, TValue> {
|
|
6
|
+
styles: {
|
|
7
|
+
definedColumnSize?: boolean;
|
|
8
|
+
header?: {
|
|
9
|
+
hasNoPadding?: boolean;
|
|
10
|
+
textAlign?: 'left' | 'center' | 'right';
|
|
11
|
+
};
|
|
12
|
+
cell?: {
|
|
13
|
+
hasNoPadding?: boolean;
|
|
14
|
+
textAlign?: 'left' | 'center' | 'right';
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { ColumnDef } from '@tanstack/react-table';
|
|
4
|
+
import { useEffect, useMemo } from 'react';
|
|
5
|
+
|
|
6
|
+
type Props<T> = {
|
|
7
|
+
defaultColumns: ColumnDef<T>[];
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export function useTanstackTable<T>({ defaultColumns }: Props<T>) {
|
|
11
|
+
const columns = useMemo<ColumnDef<T>[]>(() => defaultColumns, []);
|
|
12
|
+
const defaultData = useMemo(() => [], []);
|
|
13
|
+
const [windowWidth, setWindowWidth] = useState(window.innerWidth);
|
|
14
|
+
const [rowSelection, setRowSelection] = useState({});
|
|
15
|
+
const [formattedColumns, setFormattedColumns] = useState<ColumnDef<T>[]>(columns);
|
|
16
|
+
const [isClickedRow, setIsClickedRow] = useState<string[]>([]);
|
|
17
|
+
|
|
18
|
+
// Tracks changes to browser width to allow for updating of column widths
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
const handleResize = () => {
|
|
21
|
+
setWindowWidth(window.innerWidth);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
window.addEventListener('resize', handleResize);
|
|
25
|
+
|
|
26
|
+
return () => {
|
|
27
|
+
window.removeEventListener('resize', handleResize);
|
|
28
|
+
};
|
|
29
|
+
}, []);
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
columns,
|
|
33
|
+
defaultData,
|
|
34
|
+
rowSelection,
|
|
35
|
+
setRowSelection,
|
|
36
|
+
windowWidth,
|
|
37
|
+
formattedColumns,
|
|
38
|
+
setFormattedColumns,
|
|
39
|
+
isClickedRow,
|
|
40
|
+
setIsClickedRow,
|
|
41
|
+
};
|
|
42
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -28,6 +28,7 @@ export { Menu } from './components/menu';
|
|
|
28
28
|
export { Pill } from './components/pill';
|
|
29
29
|
export { Badge } from './components/badge';
|
|
30
30
|
export { Modal } from './components/modal';
|
|
31
|
+
export { TanstackTable } from './components/tanstackTable';
|
|
31
32
|
|
|
32
33
|
// Utilities
|
|
33
34
|
export { registerFontAwesomeIcons } from './setup/setupIcons';
|
|
@@ -29,6 +29,7 @@ export function CirclePulse(props: Props): React.ReactElement {
|
|
|
29
29
|
aria-hidden={true}
|
|
30
30
|
className={className}
|
|
31
31
|
data-cy={props['data-cy']}
|
|
32
|
+
data-testid={props['data-testid']}
|
|
32
33
|
id={id}
|
|
33
34
|
overallsize={returnSizeString(overallSize)}
|
|
34
35
|
ripplesize={returnSizeString(rippleSize)}
|
package/src/styles/index.scss
CHANGED
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
@import '../components/badge/styles/Badge.scss';
|
|
25
25
|
@import '../components/modal/styles/Modal.scss';
|
|
26
26
|
@import '../components/pagination/styles/Pagination.scss';
|
|
27
|
+
@import '../components/tanstackTable/styles/table.scss';
|
|
27
28
|
|
|
28
29
|
@import '../components/pill/styles/Pill.scss';
|
|
29
30
|
@import 'sheets'; // Port to an sheets component when we build it
|