@popsure/dirty-swan 0.27.13 → 0.27.15
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.ts +2 -2
- package/dist/index.js +5462 -5523
- package/dist/index.js.map +1 -1
- package/dist/lib/components/button/index.d.ts +1 -1
- package/dist/lib/components/comparisonTable/components/AccordionItem/AccordionItem.d.ts +11 -0
- package/dist/lib/components/comparisonTable/components/AccordionItem/index.d.ts +1 -0
- package/dist/lib/components/comparisonTable/components/Row/index.d.ts +1 -1
- package/dist/lib/components/comparisonTable/components/TableArrows/index.d.ts +4 -2
- package/dist/lib/components/comparisonTable/hooks/useComparisonTable.d.ts +14 -0
- package/dist/lib/components/comparisonTable/index.d.ts +10 -4
- package/dist/lib/components/input/index.d.ts +1 -1
- package/dist/lib/index.d.ts +1 -4
- package/package.json +2 -1
- package/src/App.tsx +0 -8
- package/src/index.tsx +1 -7
- package/src/lib/components/cards/cardWithTopIcon/index.stories.mdx +8 -8
- package/src/lib/components/cards/cardWithTopIcon/index.tsx +1 -5
- package/src/lib/components/comparisonTable/components/AccordionItem/AccordionItem.module.scss +44 -0
- package/src/lib/components/comparisonTable/components/AccordionItem/AccordionItem.tsx +73 -0
- package/src/lib/components/comparisonTable/components/AccordionItem/index.tsx +1 -0
- package/src/lib/components/comparisonTable/components/Row/index.tsx +1 -3
- package/src/lib/components/comparisonTable/components/Row/style.module.scss +11 -2
- package/src/lib/components/comparisonTable/components/TableArrows/index.tsx +1 -3
- package/src/lib/components/comparisonTable/components/TableArrows/style.module.scss +1 -1
- package/src/lib/components/comparisonTable/hooks/useComparisonTable.ts +124 -0
- package/src/lib/components/comparisonTable/index.stories.mdx +226 -8
- package/src/lib/components/comparisonTable/index.tsx +172 -123
- package/src/lib/components/comparisonTable/style.module.scss +16 -6
- package/src/lib/components/dateSelector/datepicker.scss +2 -8
- package/src/lib/components/dateSelector/index.tsx +2 -0
- package/src/lib/index.tsx +0 -5
- package/dist/lib/components/comparisonTable/hooks/useActiveTableArrows.d.ts +0 -10
- package/dist/lib/components/downloadRing/icons/check-outside-circle.d.ts +0 -3
- package/dist/lib/components/downloadRing/icons/download-cloud.d.ts +0 -3
- package/dist/lib/components/downloadRing/index.d.ts +0 -8
- package/dist/lib/components/dropzone/images/error.d.ts +0 -3
- package/dist/lib/components/dropzone/images/file.d.ts +0 -3
- package/dist/lib/components/dropzone/images/upload-complete.d.ts +0 -3
- package/dist/lib/components/dropzone/images/upload.d.ts +0 -3
- package/dist/lib/components/dropzone/index.d.ts +0 -11
- package/dist/lib/models/downloadRing/index.d.ts +0 -1
- package/src/lib/components/comparisonTable/hooks/useActiveTableArrows.ts +0 -63
- package/src/lib/components/downloadRing/icons/check-outside-circle.tsx +0 -26
- package/src/lib/components/downloadRing/icons/download-cloud.tsx +0 -18
- package/src/lib/components/downloadRing/icons/style.module.scss +0 -7
- package/src/lib/components/downloadRing/index.stories.mdx +0 -35
- package/src/lib/components/downloadRing/index.tsx +0 -79
- package/src/lib/components/downloadRing/style.module.scss +0 -66
- package/src/lib/components/dropzone/images/error.tsx +0 -18
- package/src/lib/components/dropzone/images/file.tsx +0 -26
- package/src/lib/components/dropzone/images/style.module.scss +0 -7
- package/src/lib/components/dropzone/images/upload-complete.tsx +0 -24
- package/src/lib/components/dropzone/images/upload.tsx +0 -18
- package/src/lib/components/dropzone/index.stories.mdx +0 -44
- package/src/lib/components/dropzone/index.tsx +0 -152
- package/src/lib/components/dropzone/style.module.scss +0 -90
- package/src/lib/models/downloadRing/index.ts +0 -6
|
@@ -19,11 +19,17 @@ The Comparison Table component provides an easy way to compare vast amounts of i
|
|
|
19
19
|
|
|
20
20
|
## Arguments
|
|
21
21
|
|
|
22
|
-
| attribute
|
|
23
|
-
|
|
|
24
|
-
| headers
|
|
25
|
-
| data
|
|
26
|
-
| hideDetails
|
|
22
|
+
| attribute | unit | description | default value | required |
|
|
23
|
+
| --------------------- | ------------------- | ---------------------------------------------------------- | ------------- | -------- |
|
|
24
|
+
| headers | [Header[]](#header) | The structure of the table | n/a | true |
|
|
25
|
+
| data | array | The title text that needs to be displayed | n/a | true |
|
|
26
|
+
| hideDetails | boolean | Hide table groups that do not have the `default` attribute | false | false |
|
|
27
|
+
| hideScrollBars | boolean | Hide scroll bars | false | false |
|
|
28
|
+
| collapsibleSections | boolean | Make table groups with a label collapsible | false | false |
|
|
29
|
+
| cellWidth | number | Width of a table content cell | 256px | false |
|
|
30
|
+
| firstColumnWidth | number | Width of the first column of the table | 288px | false |
|
|
31
|
+
| stickyHeaderTopOffset | number | Y-offset of the sticky header row | 0px | false |
|
|
32
|
+
| growContent | boolean | Makes the content area grow to fill the available space | false | false |
|
|
27
33
|
|
|
28
34
|
## Types
|
|
29
35
|
|
|
@@ -55,6 +61,105 @@ export const ComparisonTableWithData = () => {
|
|
|
55
61
|
const headers = [
|
|
56
62
|
{
|
|
57
63
|
id: 1,
|
|
64
|
+
default: true,
|
|
65
|
+
cells: [
|
|
66
|
+
{
|
|
67
|
+
id: 1,
|
|
68
|
+
key: 'name',
|
|
69
|
+
label: 'Films',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: 2,
|
|
73
|
+
key: 'country',
|
|
74
|
+
label: 'Country',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: 4,
|
|
78
|
+
key: 'imdb',
|
|
79
|
+
label: 'IMDB rating',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
id: 3,
|
|
83
|
+
key: 'rating',
|
|
84
|
+
label: 'Our rating',
|
|
85
|
+
render: (value) => <TableRating type="star" rating={value} />,
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
id: 5,
|
|
89
|
+
key: 'recommended',
|
|
90
|
+
label: 'Recommended',
|
|
91
|
+
render: (value) => <TableRating type="zap" rating={value} />,
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
id: 5,
|
|
95
|
+
key: 'familyFriendly',
|
|
96
|
+
label: 'Family friendly',
|
|
97
|
+
render: (value) => <TableTrueFalse value={value} />,
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
id: 6,
|
|
101
|
+
key: 'boxOffice',
|
|
102
|
+
label: 'Box office',
|
|
103
|
+
render: (value) =>
|
|
104
|
+
value.toLocaleString('de-DE', {
|
|
105
|
+
style: 'currency',
|
|
106
|
+
currency: 'EUR',
|
|
107
|
+
}),
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
id: 2,
|
|
113
|
+
label: 'SUBSECTION',
|
|
114
|
+
cells: [
|
|
115
|
+
{
|
|
116
|
+
id: 1,
|
|
117
|
+
key: 'name',
|
|
118
|
+
label: 'Films',
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
id: 2,
|
|
122
|
+
key: 'country',
|
|
123
|
+
label: 'Country',
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
id: 4,
|
|
127
|
+
key: 'imdb',
|
|
128
|
+
label: 'IMDB rating',
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
id: 3,
|
|
132
|
+
key: 'rating',
|
|
133
|
+
label: 'Our rating',
|
|
134
|
+
render: (value) => <TableRating type="star" rating={value} />,
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
id: 5,
|
|
138
|
+
key: 'recommended',
|
|
139
|
+
label: 'Recommended',
|
|
140
|
+
render: (value) => <TableRating type="zap" rating={value} />,
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
id: 5,
|
|
144
|
+
key: 'familyFriendly',
|
|
145
|
+
label: 'Family friendly',
|
|
146
|
+
render: (value) => <TableTrueFalse value={value} />,
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
id: 6,
|
|
150
|
+
key: 'boxOffice',
|
|
151
|
+
label: 'Box office',
|
|
152
|
+
render: (value) =>
|
|
153
|
+
value.toLocaleString('de-DE', {
|
|
154
|
+
style: 'currency',
|
|
155
|
+
currency: 'EUR',
|
|
156
|
+
}),
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
id: 3,
|
|
162
|
+
label: 'SUBSECTION 2',
|
|
58
163
|
cells: [
|
|
59
164
|
{
|
|
60
165
|
id: 1,
|
|
@@ -137,7 +242,14 @@ export const ComparisonTableWithData = () => {
|
|
|
137
242
|
boxOffice: 258908054,
|
|
138
243
|
},
|
|
139
244
|
];
|
|
140
|
-
return
|
|
245
|
+
return (
|
|
246
|
+
<ComparisonTable
|
|
247
|
+
data={data}
|
|
248
|
+
headers={headers}
|
|
249
|
+
collapsibleSections
|
|
250
|
+
hideDetails
|
|
251
|
+
/>
|
|
252
|
+
);
|
|
141
253
|
};
|
|
142
254
|
|
|
143
255
|
<ComparisonTableWithData />
|
|
@@ -162,9 +274,108 @@ interface TableData {
|
|
|
162
274
|
}
|
|
163
275
|
|
|
164
276
|
export const ComparisonTableWithData = () => {
|
|
165
|
-
const headers
|
|
277
|
+
const headers = [
|
|
166
278
|
{
|
|
167
279
|
id: 1,
|
|
280
|
+
default: true,
|
|
281
|
+
cells: [
|
|
282
|
+
{
|
|
283
|
+
id: 1,
|
|
284
|
+
key: 'name',
|
|
285
|
+
label: 'Films',
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
id: 2,
|
|
289
|
+
key: 'country',
|
|
290
|
+
label: 'Country',
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
id: 4,
|
|
294
|
+
key: 'imdb',
|
|
295
|
+
label: 'IMDB rating',
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
id: 3,
|
|
299
|
+
key: 'rating',
|
|
300
|
+
label: 'Our rating',
|
|
301
|
+
render: (value) => <TableRating type="star" rating={value} />,
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
id: 5,
|
|
305
|
+
key: 'recommended',
|
|
306
|
+
label: 'Recommended',
|
|
307
|
+
render: (value) => <TableRating type="zap" rating={value} />,
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
id: 5,
|
|
311
|
+
key: 'familyFriendly',
|
|
312
|
+
label: 'Family friendly',
|
|
313
|
+
render: (value) => <TableTrueFalse value={value} />,
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
id: 6,
|
|
317
|
+
key: 'boxOffice',
|
|
318
|
+
label: 'Box office',
|
|
319
|
+
render: (value) =>
|
|
320
|
+
value.toLocaleString('de-DE', {
|
|
321
|
+
style: 'currency',
|
|
322
|
+
currency: 'EUR',
|
|
323
|
+
}),
|
|
324
|
+
},
|
|
325
|
+
],
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
id: 2,
|
|
329
|
+
label: 'SUBSECTION',
|
|
330
|
+
cells: [
|
|
331
|
+
{
|
|
332
|
+
id: 1,
|
|
333
|
+
key: 'name',
|
|
334
|
+
label: 'Films',
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
id: 2,
|
|
338
|
+
key: 'country',
|
|
339
|
+
label: 'Country',
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
id: 4,
|
|
343
|
+
key: 'imdb',
|
|
344
|
+
label: 'IMDB rating',
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
id: 3,
|
|
348
|
+
key: 'rating',
|
|
349
|
+
label: 'Our rating',
|
|
350
|
+
render: (value) => <TableRating type="star" rating={value} />,
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
id: 5,
|
|
354
|
+
key: 'recommended',
|
|
355
|
+
label: 'Recommended',
|
|
356
|
+
render: (value) => <TableRating type="zap" rating={value} />,
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
id: 5,
|
|
360
|
+
key: 'familyFriendly',
|
|
361
|
+
label: 'Family friendly',
|
|
362
|
+
render: (value) => <TableTrueFalse value={value} />,
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
id: 6,
|
|
366
|
+
key: 'boxOffice',
|
|
367
|
+
label: 'Box office',
|
|
368
|
+
render: (value) =>
|
|
369
|
+
value.toLocaleString('de-DE', {
|
|
370
|
+
style: 'currency',
|
|
371
|
+
currency: 'EUR',
|
|
372
|
+
}),
|
|
373
|
+
},
|
|
374
|
+
],
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
id: 3,
|
|
378
|
+
label: 'SUBSECTION 2',
|
|
168
379
|
cells: [
|
|
169
380
|
{
|
|
170
381
|
id: 1,
|
|
@@ -247,7 +458,14 @@ export const ComparisonTableWithData = () => {
|
|
|
247
458
|
boxOffice: 258908054,
|
|
248
459
|
},
|
|
249
460
|
];
|
|
250
|
-
return
|
|
461
|
+
return (
|
|
462
|
+
<ComparisonTable
|
|
463
|
+
data={data}
|
|
464
|
+
headers={headers}
|
|
465
|
+
collapsibleSections
|
|
466
|
+
hideDetails
|
|
467
|
+
/>
|
|
468
|
+
);
|
|
251
469
|
};
|
|
252
470
|
|
|
253
471
|
<ComparisonTableWithData />;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import React, { useRef, useState } from 'react';
|
|
2
|
-
import { ScrollSync, ScrollSyncPane } from 'react-scroll-sync';
|
|
3
1
|
import classNames from 'classnames';
|
|
2
|
+
import { ScrollSync, ScrollSyncPane } from 'react-scroll-sync';
|
|
4
3
|
|
|
4
|
+
import { AccordionItem } from './components/AccordionItem';
|
|
5
|
+
import Chevron from './components/Chevron';
|
|
5
6
|
import Row from './components/Row';
|
|
6
|
-
import TableArrows
|
|
7
|
+
import TableArrows from './components/TableArrows';
|
|
8
|
+
import TableInfoButton from './components/TableInfoButton';
|
|
7
9
|
import TableRating from './components/TableRating';
|
|
8
|
-
import TableTrueFalse from './components/TableTrueFalse';
|
|
9
10
|
import TableRowHeader from './components/TableRowHeader';
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { useActiveTableArrows } from './hooks/useActiveTableArrows';
|
|
13
|
-
|
|
11
|
+
import TableTrueFalse from './components/TableTrueFalse';
|
|
12
|
+
import { useComparisonTable } from './hooks/useComparisonTable';
|
|
14
13
|
import baseStyles from './style.module.scss';
|
|
15
14
|
|
|
16
15
|
export interface CellBaseProps<T> {
|
|
@@ -21,7 +20,7 @@ export interface CellBaseProps<T> {
|
|
|
21
20
|
* @param value The current data value
|
|
22
21
|
* @param element The complete data object
|
|
23
22
|
*/
|
|
24
|
-
render?: (value: any, element: T) => React.ReactNode; //TODO: add typing to value param
|
|
23
|
+
render?: (value: any, element: T) => React.ReactNode; // TODO: add typing to value param
|
|
25
24
|
}
|
|
26
25
|
|
|
27
26
|
interface CellWithId<T> extends CellBaseProps<T> {
|
|
@@ -46,6 +45,12 @@ export interface ComparisonTableProps<T> {
|
|
|
46
45
|
headers: Array<TableHeader<T>>;
|
|
47
46
|
data: Array<T>;
|
|
48
47
|
hideDetails?: boolean;
|
|
48
|
+
hideScrollBars?: boolean;
|
|
49
|
+
collapsibleSections?: boolean;
|
|
50
|
+
cellWidth?: number;
|
|
51
|
+
firstColumnWidth?: number;
|
|
52
|
+
stickyHeaderTopOffset?: number;
|
|
53
|
+
growContent?: boolean;
|
|
49
54
|
styles?: {
|
|
50
55
|
header?: string;
|
|
51
56
|
container?: string;
|
|
@@ -55,57 +60,62 @@ export interface ComparisonTableProps<T> {
|
|
|
55
60
|
const ComparisonTable = <T extends { id: number }>(
|
|
56
61
|
props: ComparisonTableProps<T>
|
|
57
62
|
) => {
|
|
58
|
-
const {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
? contentWrapperRef.current
|
|
71
|
-
: null;
|
|
63
|
+
const {
|
|
64
|
+
headers,
|
|
65
|
+
data,
|
|
66
|
+
hideDetails,
|
|
67
|
+
styles,
|
|
68
|
+
hideScrollBars,
|
|
69
|
+
collapsibleSections,
|
|
70
|
+
cellWidth,
|
|
71
|
+
firstColumnWidth,
|
|
72
|
+
stickyHeaderTopOffset,
|
|
73
|
+
growContent,
|
|
74
|
+
} = props;
|
|
72
75
|
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
};
|
|
76
|
+
const {
|
|
77
|
+
headerWidth,
|
|
78
|
+
contentContainerRef,
|
|
79
|
+
selectedSection,
|
|
80
|
+
setSelectedSection,
|
|
81
|
+
selectedTabIndex,
|
|
82
|
+
scrollContainerCallbackRef,
|
|
83
|
+
handleArrowsClick,
|
|
84
|
+
toggleMoreRows,
|
|
85
|
+
showMore,
|
|
86
|
+
} = useComparisonTable();
|
|
85
87
|
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
};
|
|
88
|
+
const cssVariablesStyle = {
|
|
89
|
+
'--tableWidth': `${headerWidth}px`,
|
|
90
|
+
...(cellWidth ? { '--cellWidth': `${cellWidth}px` } : {}),
|
|
91
|
+
...(firstColumnWidth
|
|
92
|
+
? { '--firstColumnWidth': `${firstColumnWidth}px` }
|
|
93
|
+
: {}),
|
|
94
|
+
...(stickyHeaderTopOffset
|
|
95
|
+
? { '--stickyHeaderTopOffset': `${stickyHeaderTopOffset}px` }
|
|
96
|
+
: {}),
|
|
97
|
+
...(growContent ? { '--growContent': '100%' } : {}),
|
|
98
|
+
} as React.CSSProperties;
|
|
97
99
|
|
|
98
100
|
return (
|
|
99
101
|
<ScrollSync>
|
|
100
|
-
<div>
|
|
102
|
+
<div style={cssVariablesStyle}>
|
|
101
103
|
<div className={classNames(baseStyles.header, styles?.header)}>
|
|
102
104
|
<ScrollSyncPane>
|
|
103
|
-
<div
|
|
105
|
+
<div
|
|
106
|
+
className={classNames(baseStyles.container, {
|
|
107
|
+
[baseStyles.noScrollBars]: hideScrollBars,
|
|
108
|
+
})}
|
|
109
|
+
ref={scrollContainerCallbackRef}
|
|
110
|
+
>
|
|
104
111
|
<div className={classNames(baseStyles['overflow-container'])}>
|
|
105
112
|
<div className={baseStyles['group-container']}>
|
|
106
113
|
<TableArrows
|
|
107
114
|
onClick={handleArrowsClick}
|
|
108
|
-
active={
|
|
115
|
+
active={{
|
|
116
|
+
left: selectedTabIndex > 0,
|
|
117
|
+
right: selectedTabIndex < data.length - 1,
|
|
118
|
+
}}
|
|
109
119
|
/>
|
|
110
120
|
<Row<T>
|
|
111
121
|
key="table-header-row"
|
|
@@ -119,84 +129,123 @@ const ComparisonTable = <T extends { id: number }>(
|
|
|
119
129
|
</div>
|
|
120
130
|
</ScrollSyncPane>
|
|
121
131
|
</div>
|
|
122
|
-
<
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
headers
|
|
134
|
-
.filter(
|
|
135
|
-
(headerGroup) =>
|
|
136
|
-
!hideDetails || showMore || headerGroup.default
|
|
137
|
-
)
|
|
138
|
-
.map((headerGroup, headerGroupIndex) => (
|
|
139
|
-
<div key={headerGroup.id}>
|
|
140
|
-
{
|
|
141
|
-
/**
|
|
142
|
-
* Print a table subheader if the `label` value is present
|
|
143
|
-
*/
|
|
144
|
-
headerGroup.label && (
|
|
145
|
-
<div className={baseStyles['group-title']}>
|
|
146
|
-
<h4 className={`p-h4 ${baseStyles.sticky}`}>
|
|
147
|
-
{headerGroup.label}
|
|
148
|
-
</h4>
|
|
149
|
-
</div>
|
|
150
|
-
)
|
|
151
|
-
}
|
|
132
|
+
<div ref={contentContainerRef}>
|
|
133
|
+
{Array.isArray(headers) &&
|
|
134
|
+
headers
|
|
135
|
+
.filter(
|
|
136
|
+
(headerGroup) => !hideDetails || showMore || headerGroup.default
|
|
137
|
+
)
|
|
138
|
+
.map((headerGroup, headerGroupIndex) => {
|
|
139
|
+
const content = headerGroup.cells?.map((cell, index) => {
|
|
140
|
+
const rowId = `${headerGroup.id}-${
|
|
141
|
+
cell.key ?? 'addon'
|
|
142
|
+
}-${index}`;
|
|
152
143
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
cell.key ?? 'addon'
|
|
156
|
-
}-${index}`;
|
|
144
|
+
/** Do not render the first row */
|
|
145
|
+
if (index === 0 && headerGroupIndex === 0) return null;
|
|
157
146
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
147
|
+
return (
|
|
148
|
+
<Row<T> key={rowId} rowId={rowId} cell={cell} data={data} />
|
|
149
|
+
);
|
|
150
|
+
});
|
|
161
151
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
className={classNames(
|
|
176
|
-
baseStyles['show-details-container'],
|
|
177
|
-
baseStyles.sticky,
|
|
178
|
-
'mt48'
|
|
179
|
-
)}
|
|
180
|
-
>
|
|
181
|
-
<div>
|
|
182
|
-
<button
|
|
183
|
-
className={`w100 d-flex p-a p-h4 c-pointer ${baseStyles['show-details-button']}`}
|
|
184
|
-
onClick={toggleMoreRows}
|
|
152
|
+
return (
|
|
153
|
+
<>
|
|
154
|
+
{headerGroup.label && collapsibleSections ? (
|
|
155
|
+
<AccordionItem
|
|
156
|
+
className="mt8"
|
|
157
|
+
title={String(headerGroup.label)}
|
|
158
|
+
headerClassName="p24 br8"
|
|
159
|
+
isOpen={selectedSection === String(headerGroup.label)}
|
|
160
|
+
onOpen={() =>
|
|
161
|
+
setSelectedSection(String(headerGroup.label))
|
|
162
|
+
}
|
|
163
|
+
onClose={() => setSelectedSection('')}
|
|
164
|
+
key={String(headerGroup.label)}
|
|
185
165
|
>
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
166
|
+
<ScrollSyncPane>
|
|
167
|
+
<div
|
|
168
|
+
className={classNames(
|
|
169
|
+
baseStyles.container,
|
|
170
|
+
styles?.container,
|
|
171
|
+
{
|
|
172
|
+
[baseStyles.noScrollBars]: hideScrollBars,
|
|
173
|
+
}
|
|
174
|
+
)}
|
|
175
|
+
>
|
|
176
|
+
<div
|
|
177
|
+
className={classNames(
|
|
178
|
+
baseStyles['overflow-container']
|
|
179
|
+
)}
|
|
180
|
+
>
|
|
181
|
+
<div className={baseStyles['group-container']}>
|
|
182
|
+
{content}
|
|
183
|
+
</div>
|
|
184
|
+
</div>
|
|
185
|
+
</div>
|
|
186
|
+
</ScrollSyncPane>
|
|
187
|
+
</AccordionItem>
|
|
188
|
+
) : (
|
|
189
|
+
<ScrollSyncPane>
|
|
190
|
+
<div
|
|
191
|
+
className={classNames(
|
|
192
|
+
baseStyles.container,
|
|
193
|
+
styles?.container,
|
|
194
|
+
{
|
|
195
|
+
[baseStyles.noScrollBars]: hideScrollBars,
|
|
196
|
+
}
|
|
197
|
+
)}
|
|
198
|
+
>
|
|
199
|
+
<div
|
|
200
|
+
className={classNames(
|
|
201
|
+
baseStyles['overflow-container']
|
|
202
|
+
)}
|
|
203
|
+
>
|
|
204
|
+
<div className={baseStyles['group-container']}>
|
|
205
|
+
{
|
|
206
|
+
/**
|
|
207
|
+
* Print a table subheader if the `label` value is present
|
|
208
|
+
*/
|
|
209
|
+
headerGroup.label && !collapsibleSections && (
|
|
210
|
+
<div className={baseStyles['group-title']}>
|
|
211
|
+
<h4 className={`p-h4 ${baseStyles.sticky}`}>
|
|
212
|
+
{headerGroup.label}
|
|
213
|
+
</h4>
|
|
214
|
+
</div>
|
|
215
|
+
)
|
|
216
|
+
}
|
|
217
|
+
{content}
|
|
218
|
+
</div>
|
|
219
|
+
</div>
|
|
220
|
+
</div>
|
|
221
|
+
</ScrollSyncPane>
|
|
222
|
+
)}
|
|
223
|
+
</>
|
|
224
|
+
);
|
|
225
|
+
})}
|
|
226
|
+
{hideDetails && (
|
|
227
|
+
<div
|
|
228
|
+
className={classNames(
|
|
229
|
+
baseStyles['show-details-container'],
|
|
230
|
+
baseStyles.sticky,
|
|
231
|
+
'mt48'
|
|
232
|
+
)}
|
|
233
|
+
>
|
|
234
|
+
<div>
|
|
235
|
+
<button
|
|
236
|
+
className={`w100 d-flex p-a p-h4 c-pointer ${baseStyles['show-details-button']}`}
|
|
237
|
+
onClick={toggleMoreRows}
|
|
238
|
+
type="button"
|
|
239
|
+
>
|
|
240
|
+
{showMore ? 'Hide details' : 'Show details'}
|
|
241
|
+
<Chevron
|
|
242
|
+
className={showMore ? '' : baseStyles['icon-inverted']}
|
|
243
|
+
/>
|
|
244
|
+
</button>
|
|
196
245
|
</div>
|
|
197
246
|
</div>
|
|
198
|
-
|
|
199
|
-
</
|
|
247
|
+
)}
|
|
248
|
+
</div>
|
|
200
249
|
</div>
|
|
201
250
|
</ScrollSync>
|
|
202
251
|
);
|
|
@@ -204,8 +253,8 @@ const ComparisonTable = <T extends { id: number }>(
|
|
|
204
253
|
|
|
205
254
|
export {
|
|
206
255
|
ComparisonTable,
|
|
256
|
+
TableInfoButton,
|
|
207
257
|
TableRating,
|
|
208
|
-
TableTrueFalse,
|
|
209
258
|
TableRowHeader,
|
|
210
|
-
|
|
259
|
+
TableTrueFalse,
|
|
211
260
|
};
|
|
@@ -12,6 +12,20 @@
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
.noScrollBars {
|
|
16
|
+
// Disable the scrollbar in all browsers
|
|
17
|
+
scrollbar-width: none; /* Firefox */
|
|
18
|
+
-ms-overflow-style: none; /* Internet Explorer 10+ */
|
|
19
|
+
&::-webkit-scrollbar {
|
|
20
|
+
/* WebKit */
|
|
21
|
+
width: 0;
|
|
22
|
+
height: 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Disable snapping since it's not needed without scrollbars
|
|
26
|
+
scroll-snap-type: unset;
|
|
27
|
+
}
|
|
28
|
+
|
|
15
29
|
.overflow-container {
|
|
16
30
|
width: max-content;
|
|
17
31
|
min-width: 100%;
|
|
@@ -20,9 +34,8 @@
|
|
|
20
34
|
.group-container {
|
|
21
35
|
display: flex;
|
|
22
36
|
flex-flow: column;
|
|
23
|
-
width: max-content;
|
|
37
|
+
width: var(--growContent, max-content);
|
|
24
38
|
margin: auto;
|
|
25
|
-
min-width: calc(56rem + 48px);
|
|
26
39
|
}
|
|
27
40
|
|
|
28
41
|
.group-title {
|
|
@@ -58,7 +71,7 @@
|
|
|
58
71
|
|
|
59
72
|
.header {
|
|
60
73
|
position: sticky;
|
|
61
|
-
top: 0;
|
|
74
|
+
top: var(--stickyHeaderTopOffset, 0);
|
|
62
75
|
z-index: 2;
|
|
63
76
|
background-color: white;
|
|
64
77
|
|
|
@@ -74,9 +87,6 @@
|
|
|
74
87
|
|
|
75
88
|
.show-details-container {
|
|
76
89
|
width: 100%;
|
|
77
|
-
max-width: calc(100vw - 24px);
|
|
78
|
-
|
|
79
|
-
padding-left: 16px;
|
|
80
90
|
|
|
81
91
|
border: none;
|
|
82
92
|
}
|
|
@@ -160,14 +160,8 @@
|
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
.DayPicker-Day {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
border-radius: 50%;
|
|
166
|
-
vertical-align: middle;
|
|
167
|
-
text-align: center;
|
|
168
|
-
cursor: pointer;
|
|
169
|
-
|
|
170
|
-
font: normal 16px Lato;
|
|
163
|
+
min-width: 40px;
|
|
164
|
+
height: 40px;
|
|
171
165
|
}
|
|
172
166
|
|
|
173
167
|
.DayPicker-WeekNumber {
|