@transferwise/components 0.0.0-experimental-029bd71 → 0.0.0-experimental-339e531
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/build/button/Button.js.map +1 -1
- package/build/button/Button.mjs.map +1 -1
- package/build/button/legacyUtils/legacyUtils.js.map +1 -1
- package/build/button/legacyUtils/legacyUtils.mjs.map +1 -1
- package/build/i18n/en.json +0 -5
- package/build/i18n/en.json.js +0 -5
- package/build/i18n/en.json.js.map +1 -1
- package/build/i18n/en.json.mjs +0 -5
- package/build/i18n/en.json.mjs.map +1 -1
- package/build/main.css +0 -300
- package/build/styles/main.css +0 -300
- package/build/types/button/Button.d.ts +1 -1
- package/build/types/button/Button.d.ts.map +1 -1
- package/build/types/button/legacyUtils/legacyUtils.d.ts +2 -2
- package/build/types/button/legacyUtils/legacyUtils.d.ts.map +1 -1
- package/build/types/test-utils/index.d.ts +158 -0
- package/build/types/test-utils/index.d.ts.map +1 -0
- package/build/types/test-utils/jest.setup.d.ts +2 -0
- package/build/types/test-utils/jest.setup.d.ts.map +1 -0
- package/package.json +4 -3
- package/src/button/{Button.spec.js → Button.spec.tsx} +3 -2
- package/src/button/Button.tsx +1 -1
- package/src/button/legacyUtils/{legacyUtils.spec.js → legacyUtils.spec.tsx} +1 -1
- package/src/button/legacyUtils/legacyUtils.ts +2 -2
- package/src/i18n/en.json +0 -5
- package/src/main.css +0 -300
- package/src/main.less +0 -1
- package/src/modal/{Modal.rtl.spec.js → Modal.rtl.spec.tsx} +8 -7
- package/src/slidingPanel/SlidingPanel.spec.js +1 -1
- package/src/ssr.spec.tsx +264 -0
- package/src/test-utils/{index.js → index.tsx} +11 -6
- package/src/test-utils/{jest.setup.js → jest.setup.ts} +13 -8
- package/build/styles/table/Table.css +0 -300
- package/build/types/table/Table.d.ts +0 -23
- package/build/types/table/Table.d.ts.map +0 -1
- package/build/types/table/Table.messages.d.ts +0 -24
- package/build/types/table/Table.messages.d.ts.map +0 -1
- package/build/types/table/TableCell.d.ts +0 -44
- package/build/types/table/TableCell.d.ts.map +0 -1
- package/build/types/table/TableHeader.d.ts +0 -13
- package/build/types/table/TableHeader.d.ts.map +0 -1
- package/build/types/table/TableRow.d.ts +0 -17
- package/build/types/table/TableRow.d.ts.map +0 -1
- package/build/types/table/TableStatusText.d.ts +0 -9
- package/build/types/table/TableStatusText.d.ts.map +0 -1
- package/build/types/table/index.d.ts +0 -6
- package/build/types/table/index.d.ts.map +0 -1
- package/src/ssr.spec.js +0 -256
- package/src/table/Table.css +0 -300
- package/src/table/Table.less +0 -361
- package/src/table/Table.messages.ts +0 -24
- package/src/table/Table.spec.tsx +0 -88
- package/src/table/Table.story.tsx +0 -359
- package/src/table/Table.tsx +0 -166
- package/src/table/TableCell.spec.tsx +0 -304
- package/src/table/TableCell.tsx +0 -170
- package/src/table/TableHeader.spec.tsx +0 -55
- package/src/table/TableHeader.tsx +0 -75
- package/src/table/TableRow.spec.tsx +0 -117
- package/src/table/TableRow.tsx +0 -70
- package/src/table/TableStatusText.spec.tsx +0 -53
- package/src/table/TableStatusText.tsx +0 -36
- package/src/table/index.ts +0 -11
- /package/src/button/__snapshots__/{Button.spec.js.snap → Button.spec.tsx.snap} +0 -0
- /package/src/dimmer/{Dimmer.rtl.spec.js → Dimmer.rtl.spec.tsx} +0 -0
- /package/src/info/{Info.spec.js → Info.spec.jsx} +0 -0
|
@@ -1,359 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import Table from './Table';
|
|
3
|
-
import { TableHeaderType } from './TableHeader';
|
|
4
|
-
import { TableRowType, TableRowClickableType } from './TableRow';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
component: Table,
|
|
8
|
-
title: 'Option/Table',
|
|
9
|
-
tags: ['autodocs'],
|
|
10
|
-
} satisfies Meta<typeof Table>;
|
|
11
|
-
|
|
12
|
-
type Story = StoryObj<typeof Table>;
|
|
13
|
-
|
|
14
|
-
const tableData = {
|
|
15
|
-
headers: [
|
|
16
|
-
{
|
|
17
|
-
header: 'Employee',
|
|
18
|
-
width: '200px',
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
header: 'Location',
|
|
22
|
-
width: '15%',
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
header: 'Emplpyment Date',
|
|
26
|
-
className: 'np-table-header--custom-class',
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
header: 'Payment',
|
|
30
|
-
alignment: 'right',
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
header: 'Status',
|
|
34
|
-
status: 'error',
|
|
35
|
-
},
|
|
36
|
-
] satisfies TableHeaderType[],
|
|
37
|
-
rows: [
|
|
38
|
-
{
|
|
39
|
-
id: 0,
|
|
40
|
-
cells: [
|
|
41
|
-
{
|
|
42
|
-
cell: {
|
|
43
|
-
type: 'leading',
|
|
44
|
-
primaryText: 'Bob Brown',
|
|
45
|
-
secondaryText: 'Software Engineer',
|
|
46
|
-
avatar: {
|
|
47
|
-
fullName: 'Bob Brown',
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
cell: {
|
|
53
|
-
type: 'text',
|
|
54
|
-
text: 'FR, Paris',
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
cell: {
|
|
59
|
-
type: 'text',
|
|
60
|
-
text: '11 Oct 2022',
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
cell: {
|
|
65
|
-
type: 'currency',
|
|
66
|
-
primaryCurrency: {
|
|
67
|
-
value: '12345.67',
|
|
68
|
-
currency: 'eur',
|
|
69
|
-
},
|
|
70
|
-
secondaryCurrency: {
|
|
71
|
-
value: '11000.00',
|
|
72
|
-
currency: 'gbp',
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
alignment: 'right',
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
cell: {
|
|
79
|
-
type: 'status',
|
|
80
|
-
primaryText: 'Cancelled',
|
|
81
|
-
secondaryText: '1 day ago',
|
|
82
|
-
sentiment: 'negative',
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
],
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
id: 1,
|
|
89
|
-
cells: [
|
|
90
|
-
{
|
|
91
|
-
cell: {
|
|
92
|
-
type: 'leading',
|
|
93
|
-
primaryText: 'Jan Kowalski',
|
|
94
|
-
secondaryText: 'Product Manager',
|
|
95
|
-
avatar: {
|
|
96
|
-
fullName: 'Jan Kowalski',
|
|
97
|
-
backgroundColorSeed: 'Jan Kowalski',
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
cell: {
|
|
103
|
-
type: 'text',
|
|
104
|
-
text: 'US, New York',
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
cell: {
|
|
109
|
-
type: 'text',
|
|
110
|
-
text: '24 Jan 2024',
|
|
111
|
-
},
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
cell: {
|
|
115
|
-
type: 'currency',
|
|
116
|
-
primaryCurrency: {
|
|
117
|
-
value: 23456.78,
|
|
118
|
-
currency: 'usd',
|
|
119
|
-
},
|
|
120
|
-
secondaryCurrency: {
|
|
121
|
-
value: 21000.0,
|
|
122
|
-
currency: 'gbp',
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
alignment: 'right',
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
cell: {
|
|
129
|
-
type: 'status',
|
|
130
|
-
primaryText: 'Scheduled',
|
|
131
|
-
secondaryText: 'Tomorrow',
|
|
132
|
-
sentiment: 'neutral',
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
],
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
id: 2,
|
|
139
|
-
cells: [
|
|
140
|
-
{
|
|
141
|
-
cell: {
|
|
142
|
-
type: 'leading',
|
|
143
|
-
primaryText: 'William Davis',
|
|
144
|
-
secondaryText: 'Data Scientist',
|
|
145
|
-
avatar: {
|
|
146
|
-
fullName: 'William Davis',
|
|
147
|
-
backgroundColorSeed: 'William Davis',
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
cell: {
|
|
153
|
-
type: 'text',
|
|
154
|
-
text: 'UK, London',
|
|
155
|
-
},
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
cell: {
|
|
159
|
-
type: 'text',
|
|
160
|
-
text: '9 Sept 2023',
|
|
161
|
-
},
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
cell: {
|
|
165
|
-
type: 'currency',
|
|
166
|
-
primaryCurrency: {
|
|
167
|
-
value: '34567.89',
|
|
168
|
-
currency: 'gbp',
|
|
169
|
-
},
|
|
170
|
-
secondaryCurrency: {
|
|
171
|
-
value: '31000.00',
|
|
172
|
-
currency: 'eur',
|
|
173
|
-
},
|
|
174
|
-
},
|
|
175
|
-
alignment: 'right',
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
cell: {
|
|
179
|
-
type: 'status',
|
|
180
|
-
primaryText: 'Paid',
|
|
181
|
-
secondaryText: 'Yesterday',
|
|
182
|
-
sentiment: 'positive',
|
|
183
|
-
},
|
|
184
|
-
},
|
|
185
|
-
],
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
id: 3,
|
|
189
|
-
cells: [
|
|
190
|
-
{
|
|
191
|
-
cell: {
|
|
192
|
-
type: 'leading',
|
|
193
|
-
primaryText: 'Jane Smith',
|
|
194
|
-
secondaryText: 'IT Support Specialist',
|
|
195
|
-
status: 'success',
|
|
196
|
-
avatar: {
|
|
197
|
-
src: 'avatar-square-dude.webp',
|
|
198
|
-
},
|
|
199
|
-
},
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
cell: {
|
|
203
|
-
type: 'text',
|
|
204
|
-
text: 'NO, Oslo',
|
|
205
|
-
},
|
|
206
|
-
},
|
|
207
|
-
{
|
|
208
|
-
cell: {
|
|
209
|
-
type: 'text',
|
|
210
|
-
text: '12 Apr 2024',
|
|
211
|
-
status: 'success',
|
|
212
|
-
},
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
cell: {
|
|
216
|
-
type: 'currency',
|
|
217
|
-
primaryCurrency: {
|
|
218
|
-
value: '45678.90',
|
|
219
|
-
currency: 'nok',
|
|
220
|
-
},
|
|
221
|
-
secondaryCurrency: {
|
|
222
|
-
value: '41000.00',
|
|
223
|
-
currency: 'gbp',
|
|
224
|
-
},
|
|
225
|
-
status: 'success',
|
|
226
|
-
},
|
|
227
|
-
alignment: 'right',
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
cell: {
|
|
231
|
-
type: 'status',
|
|
232
|
-
primaryText: 'Overdue',
|
|
233
|
-
secondaryText: '3 days ago',
|
|
234
|
-
sentiment: 'warning',
|
|
235
|
-
},
|
|
236
|
-
},
|
|
237
|
-
],
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
id: 4,
|
|
241
|
-
cells: [
|
|
242
|
-
{
|
|
243
|
-
cell: {
|
|
244
|
-
type: 'leading',
|
|
245
|
-
primaryText: 'Alice Johnson',
|
|
246
|
-
secondaryText: 'Frontend Developer',
|
|
247
|
-
status: 'error',
|
|
248
|
-
avatar: {
|
|
249
|
-
src: 'avatar-square-dude.webp',
|
|
250
|
-
},
|
|
251
|
-
},
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
cell: {
|
|
255
|
-
type: 'text',
|
|
256
|
-
text: 'JP, Tokyo',
|
|
257
|
-
},
|
|
258
|
-
},
|
|
259
|
-
{
|
|
260
|
-
cell: {
|
|
261
|
-
type: 'text',
|
|
262
|
-
text: '27 Nov 2023',
|
|
263
|
-
status: 'error',
|
|
264
|
-
},
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
cell: {
|
|
268
|
-
type: 'currency',
|
|
269
|
-
primaryCurrency: {
|
|
270
|
-
value: '56789.01', // JPY currency's value is always cropped to zero decimals, you'll see `56789` instead of `56789.01` in screen/tests
|
|
271
|
-
currency: 'jpy',
|
|
272
|
-
},
|
|
273
|
-
secondaryCurrency: {
|
|
274
|
-
value: '51000.00',
|
|
275
|
-
currency: 'gbp',
|
|
276
|
-
},
|
|
277
|
-
status: 'error',
|
|
278
|
-
},
|
|
279
|
-
alignment: 'right',
|
|
280
|
-
},
|
|
281
|
-
{
|
|
282
|
-
cell: {
|
|
283
|
-
type: 'status',
|
|
284
|
-
primaryText: 'Overdue',
|
|
285
|
-
secondaryText: '6 days ago',
|
|
286
|
-
sentiment: 'pending',
|
|
287
|
-
},
|
|
288
|
-
},
|
|
289
|
-
],
|
|
290
|
-
},
|
|
291
|
-
] satisfies TableRowType[] | TableRowClickableType[],
|
|
292
|
-
};
|
|
293
|
-
|
|
294
|
-
export const Basic: Story = {
|
|
295
|
-
args: {
|
|
296
|
-
data: tableData,
|
|
297
|
-
},
|
|
298
|
-
render: (args) => {
|
|
299
|
-
return <Table {...args} />;
|
|
300
|
-
},
|
|
301
|
-
};
|
|
302
|
-
|
|
303
|
-
export const WithClickableRow: Story = {
|
|
304
|
-
args: {
|
|
305
|
-
data: {
|
|
306
|
-
...tableData,
|
|
307
|
-
onRowClick: (rowData: TableRowType | TableRowClickableType) => {
|
|
308
|
-
// eslint-disable-next-line no-console
|
|
309
|
-
console.log(`Row clicked, data:`, rowData);
|
|
310
|
-
},
|
|
311
|
-
},
|
|
312
|
-
},
|
|
313
|
-
render: (args) => {
|
|
314
|
-
return <Table {...args} />;
|
|
315
|
-
},
|
|
316
|
-
};
|
|
317
|
-
|
|
318
|
-
export const WithLoading: Story = {
|
|
319
|
-
args: {
|
|
320
|
-
loading: true,
|
|
321
|
-
},
|
|
322
|
-
};
|
|
323
|
-
|
|
324
|
-
export const WithEmptyData: Story = {
|
|
325
|
-
args: {
|
|
326
|
-
data: {
|
|
327
|
-
headers: tableData.headers,
|
|
328
|
-
rows: [],
|
|
329
|
-
},
|
|
330
|
-
},
|
|
331
|
-
};
|
|
332
|
-
|
|
333
|
-
export const WithError: Story = {
|
|
334
|
-
args: {
|
|
335
|
-
error: {
|
|
336
|
-
message: 'Something went wrong during data fetching',
|
|
337
|
-
action: {
|
|
338
|
-
href: '/?path=/story/option-table--with-error',
|
|
339
|
-
text: 'To Refresh page, click here',
|
|
340
|
-
},
|
|
341
|
-
},
|
|
342
|
-
},
|
|
343
|
-
};
|
|
344
|
-
|
|
345
|
-
export const WithAFewColums: Story = {
|
|
346
|
-
args: {
|
|
347
|
-
data: {
|
|
348
|
-
headers: tableData.headers
|
|
349
|
-
.slice(0, 1)
|
|
350
|
-
.concat(tableData.headers[3])
|
|
351
|
-
.concat(tableData.headers[4]),
|
|
352
|
-
rows: tableData.rows.map((row) => ({
|
|
353
|
-
id: row.id,
|
|
354
|
-
cells: row.cells.slice(0, 1).concat(row.cells[3]).concat(row.cells[4]),
|
|
355
|
-
})),
|
|
356
|
-
},
|
|
357
|
-
fullWidth: false,
|
|
358
|
-
},
|
|
359
|
-
};
|
package/src/table/Table.tsx
DELETED
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import { useIntl } from 'react-intl';
|
|
2
|
-
import TableCell from './TableCell';
|
|
3
|
-
import TableHeader, { TableHeaderType } from './TableHeader';
|
|
4
|
-
import TableRow, { TableRowClickableType, TableRowType } from './TableRow';
|
|
5
|
-
import Alert from '../alert';
|
|
6
|
-
|
|
7
|
-
import messages from './Table.messages';
|
|
8
|
-
import Loader from '../loader';
|
|
9
|
-
import { Sentiment, Size } from '../common';
|
|
10
|
-
import StatusIcon from '../statusIcon';
|
|
11
|
-
import { clsx } from 'clsx';
|
|
12
|
-
import { useTheme } from '@wise/components-theming';
|
|
13
|
-
|
|
14
|
-
export interface TableProps {
|
|
15
|
-
'aria-labelledby'?: string;
|
|
16
|
-
data: {
|
|
17
|
-
headers?: TableHeaderType[];
|
|
18
|
-
rows?: TableRowType[] | TableRowClickableType[];
|
|
19
|
-
onRowClick?: (rowData: TableRowType | TableRowClickableType) => void;
|
|
20
|
-
};
|
|
21
|
-
loading?: boolean;
|
|
22
|
-
className?: string | undefined;
|
|
23
|
-
fullWidth?: boolean;
|
|
24
|
-
error?: {
|
|
25
|
-
message?: string;
|
|
26
|
-
action?: {
|
|
27
|
-
href?: string;
|
|
28
|
-
text?: string;
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const Table = ({
|
|
34
|
-
'aria-labelledby': ariaLabelledBy,
|
|
35
|
-
data,
|
|
36
|
-
loading,
|
|
37
|
-
className,
|
|
38
|
-
fullWidth = true,
|
|
39
|
-
error,
|
|
40
|
-
}: TableProps) => {
|
|
41
|
-
const { formatMessage } = useIntl();
|
|
42
|
-
const { theme } = useTheme();
|
|
43
|
-
|
|
44
|
-
const getRowLength = () => {
|
|
45
|
-
const columnsLength = data?.headers?.length ?? 0;
|
|
46
|
-
return data?.onRowClick ? columnsLength + 1 : columnsLength;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const getTableContent = () => {
|
|
50
|
-
if (loading) {
|
|
51
|
-
return (
|
|
52
|
-
<TableRow>
|
|
53
|
-
<TableCell>
|
|
54
|
-
<Loader data-testid="np-table-loader" />
|
|
55
|
-
</TableCell>
|
|
56
|
-
</TableRow>
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// Shows the `emptyData` message when there is no data to display
|
|
61
|
-
if (!data?.rows?.length) {
|
|
62
|
-
return (
|
|
63
|
-
<TableRow>
|
|
64
|
-
<TableCell colSpan={data?.headers?.length ? data?.headers?.length : undefined}>
|
|
65
|
-
<div className="np-table-empty-data" data-testid="np-table-empty-data">
|
|
66
|
-
<StatusIcon sentiment={Sentiment.WARNING} size={Size.MEDIUM} />
|
|
67
|
-
<div className="np-text-body-default-bold">{formatMessage(messages.emptyData)}</div>
|
|
68
|
-
</div>
|
|
69
|
-
</TableCell>
|
|
70
|
-
</TableRow>
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return data?.rows?.map((rowData, rowIndex) => {
|
|
75
|
-
return (
|
|
76
|
-
<TableRow
|
|
77
|
-
key={'table-row-'.concat(rowIndex.toString())}
|
|
78
|
-
rowData={rowData}
|
|
79
|
-
hasSeparator={data?.rows?.length ? data.rows.length - 1 !== rowIndex : false}
|
|
80
|
-
onRowClick={data?.onRowClick}
|
|
81
|
-
/>
|
|
82
|
-
);
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
if (error) {
|
|
87
|
-
return (
|
|
88
|
-
<Alert
|
|
89
|
-
className="np-table-error"
|
|
90
|
-
message={error.message}
|
|
91
|
-
type={Sentiment.NEGATIVE}
|
|
92
|
-
action={{
|
|
93
|
-
href: error?.action?.href ?? '/',
|
|
94
|
-
text: error?.action?.text ?? formatMessage(messages.refreshPage),
|
|
95
|
-
}}
|
|
96
|
-
data-testid="np-table-error"
|
|
97
|
-
/>
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return (
|
|
102
|
-
<>
|
|
103
|
-
<div aria-live="polite" className="sr-only">
|
|
104
|
-
{formatMessage(messages[loading ? 'loading' : 'loaded'])}
|
|
105
|
-
</div>
|
|
106
|
-
<div
|
|
107
|
-
role={loading ? 'presentation' : 'region'}
|
|
108
|
-
aria-labelledby={ariaLabelledBy}
|
|
109
|
-
className={clsx('np-table-outer-container', className, {
|
|
110
|
-
'np-theme-personal': theme === 'bright-green',
|
|
111
|
-
'np-table-outer-container--center': !fullWidth,
|
|
112
|
-
'np-table-outer-container--full-width': fullWidth,
|
|
113
|
-
})}
|
|
114
|
-
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
115
|
-
tabIndex={0}
|
|
116
|
-
data-testid="np-table-outer-container"
|
|
117
|
-
>
|
|
118
|
-
<div
|
|
119
|
-
className={clsx('np-table-container', {
|
|
120
|
-
'np-table-container--loading': loading,
|
|
121
|
-
})}
|
|
122
|
-
data-testid="np-table-container"
|
|
123
|
-
>
|
|
124
|
-
<div className="np-table-inner-container">
|
|
125
|
-
<table className="np-table">
|
|
126
|
-
<thead role={loading ? 'presentation' : undefined}>
|
|
127
|
-
<tr>
|
|
128
|
-
{(loading ?? (data?.headers && !data?.headers.length)) ? (
|
|
129
|
-
<TableHeader />
|
|
130
|
-
) : (
|
|
131
|
-
data?.headers?.map((headerItem: TableHeaderType, index) => (
|
|
132
|
-
<TableHeader
|
|
133
|
-
key={headerItem.header?.concat(index.toString())}
|
|
134
|
-
{...headerItem}
|
|
135
|
-
/>
|
|
136
|
-
))
|
|
137
|
-
)}
|
|
138
|
-
{data?.onRowClick && <TableHeader isActionHeader />}
|
|
139
|
-
</tr>
|
|
140
|
-
</thead>
|
|
141
|
-
<tbody>
|
|
142
|
-
<tr
|
|
143
|
-
key="first-np-table-row--cosmetic"
|
|
144
|
-
aria-hidden="true"
|
|
145
|
-
className="np-table-row np-table-row--cosmetic"
|
|
146
|
-
>
|
|
147
|
-
<td className="np-table-cell" colSpan={getRowLength()} />
|
|
148
|
-
</tr>
|
|
149
|
-
{getTableContent()}
|
|
150
|
-
<tr
|
|
151
|
-
key="last-np-table-row--cosmetic"
|
|
152
|
-
aria-hidden="true"
|
|
153
|
-
className="np-table-row np-table-row--cosmetic"
|
|
154
|
-
>
|
|
155
|
-
<td className="np-table-cell" colSpan={getRowLength()} />
|
|
156
|
-
</tr>
|
|
157
|
-
</tbody>
|
|
158
|
-
</table>
|
|
159
|
-
</div>
|
|
160
|
-
</div>
|
|
161
|
-
</div>
|
|
162
|
-
</>
|
|
163
|
-
);
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
export default Table;
|