@cdc/core 4.25.3 → 4.25.6-1
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/assets/icon-close.svg +1 -1
- package/components/Alert/components/Alert.tsx +1 -1
- package/components/DataTable/DataTable.tsx +18 -16
- package/components/DataTable/DataTableStandAlone.tsx +15 -9
- package/components/DataTable/components/CellAnchor.tsx +1 -1
- package/components/DataTable/components/ChartHeader.tsx +8 -5
- package/components/DataTable/components/DataTableEditorPanel.tsx +25 -3
- package/components/DataTable/components/MapHeader.tsx +1 -0
- package/components/DataTable/helpers/chartCellMatrix.tsx +14 -10
- package/components/DataTable/helpers/getChartCellValue.ts +42 -26
- package/components/DataTable/helpers/mapCellMatrix.tsx +25 -7
- package/components/DownloadButton.tsx +17 -2
- package/components/EditorPanel/DataTableEditor.tsx +1 -1
- package/components/EditorPanel/FootnotesEditor.tsx +76 -22
- package/components/EditorPanel/Inputs.tsx +12 -4
- package/components/EditorPanel/VizFilterEditor/NestedDropdownEditor.tsx +3 -2
- package/components/EditorPanel/VizFilterEditor/VizFilterEditor.tsx +51 -35
- package/components/Filters/Filters.tsx +158 -461
- package/components/Filters/components/Dropdown.tsx +39 -0
- package/components/Filters/components/Tabs.tsx +82 -0
- package/components/Filters/helpers/getChangedFilters.ts +31 -0
- package/components/Filters/helpers/getNestedOptions.ts +2 -2
- package/components/Filters/helpers/handleSorting.ts +2 -2
- package/components/Filters/helpers/tests/getChangedFilters.test.ts +92 -0
- package/components/Filters/helpers/tests/getNestedOptions.test.ts +31 -0
- package/components/Filters/index.ts +1 -1
- package/components/Footnotes/Footnotes.tsx +1 -1
- package/components/Footnotes/FootnotesStandAlone.tsx +8 -33
- package/components/Layout/components/Visualization/index.tsx +4 -3
- package/components/Legend/Legend.Gradient.tsx +68 -24
- package/components/MultiSelect/MultiSelect.tsx +3 -6
- package/components/MultiSelect/multiselect.styles.css +2 -0
- package/components/NestedDropdown/NestedDropdown.tsx +21 -21
- package/components/RichTooltip/RichTooltip.tsx +37 -0
- package/components/RichTooltip/richTooltip.css +16 -0
- package/components/Table/Table.tsx +142 -142
- package/components/Table/components/Row.tsx +1 -1
- package/components/Table/table.styles.css +10 -0
- package/components/_stories/DataTable.stories.tsx +9 -2
- package/components/_stories/Table.stories.tsx +1 -1
- package/components/_stories/styles.scss +0 -4
- package/components/ui/Accordion.jsx +8 -1
- package/components/ui/Title/index.tsx +4 -1
- package/components/ui/Title/{Title.scss → title.styles.css} +0 -2
- package/components/ui/_stories/Colors.stories.mdx +220 -0
- package/components/ui/_stories/IconGallery.stories.mdx +14 -0
- package/components/ui/_stories/Title.stories.tsx +29 -4
- package/components/ui/accordion.styles.css +3 -0
- package/data/colorPalettes.js +0 -1
- package/dist/cove-main.css +3 -8
- package/dist/cove-main.css.map +1 -1
- package/helpers/constants.ts +6 -0
- package/helpers/cove/accessibility.ts +7 -8
- package/helpers/cove/number.ts +5 -3
- package/helpers/coveUpdateWorker.ts +9 -1
- package/helpers/filterOrderOptions.ts +17 -0
- package/helpers/formatConfigBeforeSave.ts +19 -32
- package/helpers/isNumber.ts +20 -0
- package/helpers/isRightAlignedTableValue.js +1 -1
- package/helpers/pivotData.ts +16 -11
- package/helpers/tests/pivotData.test.ts +74 -0
- package/helpers/updateFieldFactory.ts +1 -0
- package/helpers/ver/4.25.3.ts +25 -2
- package/helpers/ver/4.25.4.ts +110 -0
- package/helpers/ver/4.25.6.ts +36 -0
- package/helpers/ver/4.25.7.ts +26 -0
- package/helpers/ver/tests/4.25.4.test.ts +89 -0
- package/helpers/ver/tests/4.25.6.test.ts +84 -0
- package/helpers/viewports.ts +4 -0
- package/package.json +7 -6
- package/styles/_global-variables.scss +3 -0
- package/styles/_global.scss +0 -4
- package/styles/_reset.scss +0 -6
- package/styles/filters.scss +0 -4
- package/styles/v2/main.scss +0 -5
- package/types/Axis.ts +2 -0
- package/types/DataSet.ts +14 -0
- package/types/Footnotes.ts +5 -2
- package/types/General.ts +1 -0
- package/types/Legend.ts +1 -0
- package/types/Table.ts +1 -0
- package/types/Visualization.ts +3 -12
- package/types/VizFilter.ts +3 -0
- package/components/ui/_stories/Colors.stories.tsx +0 -92
- package/components/ui/_stories/Icon.stories.tsx +0 -29
- package/helpers/cove/fontSettings.ts +0 -2
- package/helpers/isNumber.js +0 -24
- package/helpers/isNumberLog.js +0 -18
- /package/helpers/{fetchRemoteData.js → fetchRemoteData.ts} +0 -0
|
@@ -50,7 +50,7 @@ const Options: React.FC<{
|
|
|
50
50
|
onKeyUp={handleKeyUp}
|
|
51
51
|
className={`nested-dropdown-group-${filterIndex}`}
|
|
52
52
|
>
|
|
53
|
-
<span className={'font-weight-bold'}>{label} </span>
|
|
53
|
+
<span className={'font-weight-bold fw-bold'}>{label} </span>
|
|
54
54
|
{
|
|
55
55
|
<span className='list-arrow' aria-hidden='true'>
|
|
56
56
|
{isTierOneExpanded ? (
|
|
@@ -241,7 +241,7 @@ const NestedDropdown: React.FC<NestedDropdownProps> = ({
|
|
|
241
241
|
setInputHasFocus(false)
|
|
242
242
|
setIsListOpened(false)
|
|
243
243
|
} else {
|
|
244
|
-
;(e.relatedTarget as HTMLElement).focus()
|
|
244
|
+
; (e.relatedTarget as HTMLElement).focus()
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
247
|
|
|
@@ -260,7 +260,7 @@ const NestedDropdown: React.FC<NestedDropdownProps> = ({
|
|
|
260
260
|
onKeyUp={handleKeyUp}
|
|
261
261
|
>
|
|
262
262
|
<div
|
|
263
|
-
className={`nested-dropdown-input-container${loading || !options
|
|
263
|
+
className={`nested-dropdown-input-container${loading || !options?.length ? ' disabled' : ''}`}
|
|
264
264
|
aria-label='searchInput'
|
|
265
265
|
aria-disabled={loading}
|
|
266
266
|
role='textbox'
|
|
@@ -276,7 +276,7 @@ const NestedDropdown: React.FC<NestedDropdownProps> = ({
|
|
|
276
276
|
value={userSearchTerm !== null ? userSearchTerm : inputValue}
|
|
277
277
|
onChange={handleSearchTermChange}
|
|
278
278
|
placeholder={loading ? 'Loading...' : '- Select -'}
|
|
279
|
-
disabled={loading || !options
|
|
279
|
+
disabled={loading || !options?.length}
|
|
280
280
|
onClick={() => {
|
|
281
281
|
if (inputHasFocus) setIsListOpened(!isListOpened)
|
|
282
282
|
}}
|
|
@@ -302,23 +302,23 @@ const NestedDropdown: React.FC<NestedDropdownProps> = ({
|
|
|
302
302
|
>
|
|
303
303
|
{filterOptions.length
|
|
304
304
|
? filterOptions.map(([group, subgroup], index) => {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
305
|
+
const [groupValue, groupText] = group
|
|
306
|
+
const groupTextValue = String(groupText || groupValue)
|
|
307
|
+
return (
|
|
308
|
+
<Options
|
|
309
|
+
key={groupTextValue + '_' + index}
|
|
310
|
+
handleBlur={handleOnBlur}
|
|
311
|
+
subOptions={subgroup}
|
|
312
|
+
filterIndex={filterIndex}
|
|
313
|
+
label={groupTextValue}
|
|
314
|
+
handleSubGroupSelect={subGroupValue => {
|
|
315
|
+
chooseSelectedSubGroup(groupValue, subGroupValue)
|
|
316
|
+
}}
|
|
317
|
+
userSelectedLabel={activeGroup + activeSubGroup}
|
|
318
|
+
userSearchTerm={userSearchTerm || ''}
|
|
319
|
+
/>
|
|
320
|
+
)
|
|
321
|
+
})
|
|
322
322
|
: 'There are no matching items'}
|
|
323
323
|
</ul>
|
|
324
324
|
</div>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Tooltip as ReactTooltip } from 'react-tooltip'
|
|
3
|
+
import './richTooltip.css'
|
|
4
|
+
|
|
5
|
+
const RichTooltip = ({ linkText, href = null, tooltipOpacity = 100, tooltipContent }) => {
|
|
6
|
+
return (
|
|
7
|
+
<>
|
|
8
|
+
<a
|
|
9
|
+
className='tooltip-link'
|
|
10
|
+
data-tooltip-content={tooltipContent}
|
|
11
|
+
data-tooltip-id='supression-tooltip'
|
|
12
|
+
href={href}
|
|
13
|
+
>
|
|
14
|
+
{linkText}
|
|
15
|
+
</a>
|
|
16
|
+
|
|
17
|
+
<ReactTooltip
|
|
18
|
+
id='supression-tooltip'
|
|
19
|
+
place='top'
|
|
20
|
+
effect='solid'
|
|
21
|
+
variant='light'
|
|
22
|
+
style={{
|
|
23
|
+
background: `rgba(255, 255, 255, ${tooltipOpacity})`,
|
|
24
|
+
color: 'var(--cool-gray-90)',
|
|
25
|
+
padding: '9px 18px',
|
|
26
|
+
boxShadow: '0px 2px 2px rgba(28, 29, 31, 0.45)',
|
|
27
|
+
maxWidth: '239px',
|
|
28
|
+
fontSize: 'var(--filter-label-font-size)',
|
|
29
|
+
fontFamily: 'var(--app-font-main)',
|
|
30
|
+
borderRadius: '4px'
|
|
31
|
+
}}
|
|
32
|
+
/>
|
|
33
|
+
</>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default RichTooltip
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
.tooltip-link {
|
|
2
|
+
text-decoration: underline;
|
|
3
|
+
text-decoration-color: var(--cool-gray-90);
|
|
4
|
+
text-decoration-style: dotted;
|
|
5
|
+
text-decoration-thickness: 2px;
|
|
6
|
+
text-underline-offset: 0.25rem;
|
|
7
|
+
position: relative;
|
|
8
|
+
cursor: pointer;
|
|
9
|
+
color: var(--cool-gray-90);
|
|
10
|
+
font-family: var(--app-font-main);
|
|
11
|
+
font-size: 0.833rem !important;
|
|
12
|
+
}
|
|
13
|
+
.tooltip-link:hover {
|
|
14
|
+
text-decoration-color: #009ec1;
|
|
15
|
+
color: var(--cool-gray-90);
|
|
16
|
+
}
|
|
@@ -1,142 +1,142 @@
|
|
|
1
|
-
import { ReactNode } from 'react'
|
|
2
|
-
import Row from './components/Row'
|
|
3
|
-
import GroupRow from './components/GroupRow'
|
|
4
|
-
import { CellMatrix } from './types/CellMatrix'
|
|
5
|
-
import { RowType } from './types/RowType'
|
|
6
|
-
import { PreliminaryDataItem } from '@cdc/chart/src/types/ChartConfig'
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
type TableProps = {
|
|
10
|
-
childrenMatrix: CellMatrix | Map<string, CellMatrix>
|
|
11
|
-
noData?: boolean
|
|
12
|
-
tableName: string
|
|
13
|
-
caption: string
|
|
14
|
-
stickyHeader?: boolean
|
|
15
|
-
headContent: ReactNode
|
|
16
|
-
tableOptions: {
|
|
17
|
-
className: string
|
|
18
|
-
'aria-live'?: 'off' | 'assertive' | 'polite'
|
|
19
|
-
hidden?: boolean
|
|
20
|
-
'aria-rowcount'?: number
|
|
21
|
-
cellMinWidth?: number
|
|
22
|
-
}
|
|
23
|
-
wrapColumns?: boolean
|
|
24
|
-
hasRowType?: boolean // if it has row type then the first column is the row type which will explain how to render the row
|
|
25
|
-
viewport: 'lg' | 'md' | 'sm' | 'xs' | 'xxs'
|
|
26
|
-
preliminaryData?: PreliminaryDataItem[]
|
|
27
|
-
rightAlignedCols: object
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
type Position = 'sticky'
|
|
31
|
-
|
|
32
|
-
const Table = ({
|
|
33
|
-
childrenMatrix,
|
|
34
|
-
noData,
|
|
35
|
-
tableName,
|
|
36
|
-
caption,
|
|
37
|
-
stickyHeader,
|
|
38
|
-
headContent,
|
|
39
|
-
tableOptions,
|
|
40
|
-
wrapColumns,
|
|
41
|
-
hasRowType,
|
|
42
|
-
viewport,
|
|
43
|
-
preliminaryData,
|
|
44
|
-
rightAlignedCols
|
|
45
|
-
}: TableProps) => {
|
|
46
|
-
const headStyle = stickyHeader ? { position: 'sticky' as Position, top: 0, zIndex: 2 } : {}
|
|
47
|
-
const isGroupedMatrix = !Array.isArray(childrenMatrix)
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<table {...tableOptions}>
|
|
51
|
-
<caption className='visually-hidden'>{caption}</caption>
|
|
52
|
-
{noData ? (
|
|
53
|
-
<tr>
|
|
54
|
-
<td className='py-5 text-center'>No Data</td>
|
|
55
|
-
</tr>
|
|
56
|
-
) : (
|
|
57
|
-
<>
|
|
58
|
-
<thead style={headStyle}>{headContent}</thead>
|
|
59
|
-
<tbody>
|
|
60
|
-
{isGroupedMatrix
|
|
61
|
-
? Array.from(childrenMatrix.keys()).flatMap(groupName => {
|
|
62
|
-
let colSpan = 0
|
|
63
|
-
const rows = childrenMatrix.get(groupName).map((row, i) => {
|
|
64
|
-
colSpan = row.length
|
|
65
|
-
const key = `${tableName}-${groupName}-row-${i}`
|
|
66
|
-
return (
|
|
67
|
-
<Row
|
|
68
|
-
preliminaryData={preliminaryData}
|
|
69
|
-
key={key}
|
|
70
|
-
rowKey={key}
|
|
71
|
-
childRow={row}
|
|
72
|
-
wrapColumns={wrapColumns}
|
|
73
|
-
cellMinWidth={tableOptions.cellMinWidth}
|
|
74
|
-
viewport={viewport}
|
|
75
|
-
rightAlignedCols={rightAlignedCols}
|
|
76
|
-
/>
|
|
77
|
-
)
|
|
78
|
-
})
|
|
79
|
-
return [<GroupRow label={groupName} colSpan={colSpan} key={`${tableName}-${groupName}`} />, ...rows]
|
|
80
|
-
})
|
|
81
|
-
: childrenMatrix.map((childRow, i) => {
|
|
82
|
-
let childRowCopy = [...childRow]
|
|
83
|
-
let rowType = undefined
|
|
84
|
-
if (hasRowType) rowType = childRowCopy.shift()
|
|
85
|
-
const key = `${tableName}-row-${i}`
|
|
86
|
-
if (rowType === undefined) {
|
|
87
|
-
return (
|
|
88
|
-
<Row
|
|
89
|
-
preliminaryData={preliminaryData}
|
|
90
|
-
key={key}
|
|
91
|
-
rowKey={key}
|
|
92
|
-
childRow={childRow}
|
|
93
|
-
wrapColumns={wrapColumns}
|
|
94
|
-
cellMinWidth={tableOptions.cellMinWidth}
|
|
95
|
-
viewport={viewport}
|
|
96
|
-
rightAlignedCols={rightAlignedCols}
|
|
97
|
-
/>
|
|
98
|
-
)
|
|
99
|
-
} else {
|
|
100
|
-
switch (rowType) {
|
|
101
|
-
case RowType.row_group:
|
|
102
|
-
return <GroupRow label={childRowCopy[0]} colSpan={childRowCopy.length} key={key} />
|
|
103
|
-
case RowType.total:
|
|
104
|
-
return (
|
|
105
|
-
<Row
|
|
106
|
-
preliminaryData={preliminaryData}
|
|
107
|
-
key={key}
|
|
108
|
-
rowKey={key}
|
|
109
|
-
childRow={childRowCopy}
|
|
110
|
-
isTotal={true}
|
|
111
|
-
wrapColumns={wrapColumns}
|
|
112
|
-
cellMinWidth={tableOptions.cellMinWidth}
|
|
113
|
-
viewport={viewport}
|
|
114
|
-
rightAlignedCols={rightAlignedCols}
|
|
115
|
-
/>
|
|
116
|
-
)
|
|
117
|
-
case RowType.row_group_total:
|
|
118
|
-
return <GroupRow label={childRowCopy[0]} colSpan={1} key={key} data={childRowCopy.slice(1)} />
|
|
119
|
-
default:
|
|
120
|
-
return (
|
|
121
|
-
<Row
|
|
122
|
-
preliminaryData={preliminaryData}
|
|
123
|
-
key={key}
|
|
124
|
-
rowKey={key}
|
|
125
|
-
childRow={childRowCopy}
|
|
126
|
-
wrapColumns={wrapColumns}
|
|
127
|
-
cellMinWidth={tableOptions.cellMinWidth}
|
|
128
|
-
viewport={viewport}
|
|
129
|
-
rightAlignedCols={rightAlignedCols}
|
|
130
|
-
/>
|
|
131
|
-
)
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
})}
|
|
135
|
-
</tbody>
|
|
136
|
-
</>
|
|
137
|
-
)}
|
|
138
|
-
</table>
|
|
139
|
-
)
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
export default Table
|
|
1
|
+
import { ReactNode } from 'react'
|
|
2
|
+
import Row from './components/Row'
|
|
3
|
+
import GroupRow from './components/GroupRow'
|
|
4
|
+
import { CellMatrix } from './types/CellMatrix'
|
|
5
|
+
import { RowType } from './types/RowType'
|
|
6
|
+
import { PreliminaryDataItem } from '@cdc/chart/src/types/ChartConfig'
|
|
7
|
+
import './table.styles.css'
|
|
8
|
+
|
|
9
|
+
type TableProps = {
|
|
10
|
+
childrenMatrix: CellMatrix | Map<string, CellMatrix>
|
|
11
|
+
noData?: boolean
|
|
12
|
+
tableName: string
|
|
13
|
+
caption: string
|
|
14
|
+
stickyHeader?: boolean
|
|
15
|
+
headContent: ReactNode
|
|
16
|
+
tableOptions: {
|
|
17
|
+
className: string
|
|
18
|
+
'aria-live'?: 'off' | 'assertive' | 'polite'
|
|
19
|
+
hidden?: boolean
|
|
20
|
+
'aria-rowcount'?: number
|
|
21
|
+
cellMinWidth?: number
|
|
22
|
+
}
|
|
23
|
+
wrapColumns?: boolean
|
|
24
|
+
hasRowType?: boolean // if it has row type then the first column is the row type which will explain how to render the row
|
|
25
|
+
viewport: 'lg' | 'md' | 'sm' | 'xs' | 'xxs'
|
|
26
|
+
preliminaryData?: PreliminaryDataItem[]
|
|
27
|
+
rightAlignedCols: object
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
type Position = 'sticky'
|
|
31
|
+
|
|
32
|
+
const Table = ({
|
|
33
|
+
childrenMatrix,
|
|
34
|
+
noData,
|
|
35
|
+
tableName,
|
|
36
|
+
caption,
|
|
37
|
+
stickyHeader,
|
|
38
|
+
headContent,
|
|
39
|
+
tableOptions,
|
|
40
|
+
wrapColumns,
|
|
41
|
+
hasRowType,
|
|
42
|
+
viewport,
|
|
43
|
+
preliminaryData,
|
|
44
|
+
rightAlignedCols
|
|
45
|
+
}: TableProps) => {
|
|
46
|
+
const headStyle = stickyHeader ? { position: 'sticky' as Position, top: 0, zIndex: 2 } : {}
|
|
47
|
+
const isGroupedMatrix = !Array.isArray(childrenMatrix)
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<table {...tableOptions}>
|
|
51
|
+
<caption className='visually-hidden'>{caption}</caption>
|
|
52
|
+
{noData ? (
|
|
53
|
+
<tr>
|
|
54
|
+
<td className='py-5 text-center'>No Data</td>
|
|
55
|
+
</tr>
|
|
56
|
+
) : (
|
|
57
|
+
<>
|
|
58
|
+
<thead style={headStyle}>{headContent}</thead>
|
|
59
|
+
<tbody>
|
|
60
|
+
{isGroupedMatrix
|
|
61
|
+
? Array.from(childrenMatrix.keys()).flatMap(groupName => {
|
|
62
|
+
let colSpan = 0
|
|
63
|
+
const rows = childrenMatrix.get(groupName).map((row, i) => {
|
|
64
|
+
colSpan = row.length
|
|
65
|
+
const key = `${tableName}-${groupName}-row-${i}`
|
|
66
|
+
return (
|
|
67
|
+
<Row
|
|
68
|
+
preliminaryData={preliminaryData}
|
|
69
|
+
key={key}
|
|
70
|
+
rowKey={key}
|
|
71
|
+
childRow={row}
|
|
72
|
+
wrapColumns={wrapColumns}
|
|
73
|
+
cellMinWidth={tableOptions.cellMinWidth}
|
|
74
|
+
viewport={viewport}
|
|
75
|
+
rightAlignedCols={rightAlignedCols}
|
|
76
|
+
/>
|
|
77
|
+
)
|
|
78
|
+
})
|
|
79
|
+
return [<GroupRow label={groupName} colSpan={colSpan} key={`${tableName}-${groupName}`} />, ...rows]
|
|
80
|
+
})
|
|
81
|
+
: childrenMatrix.map((childRow, i) => {
|
|
82
|
+
let childRowCopy = [...childRow]
|
|
83
|
+
let rowType = undefined
|
|
84
|
+
if (hasRowType) rowType = childRowCopy.shift()
|
|
85
|
+
const key = `${tableName}-row-${i}`
|
|
86
|
+
if (rowType === undefined) {
|
|
87
|
+
return (
|
|
88
|
+
<Row
|
|
89
|
+
preliminaryData={preliminaryData}
|
|
90
|
+
key={key}
|
|
91
|
+
rowKey={key}
|
|
92
|
+
childRow={childRow}
|
|
93
|
+
wrapColumns={wrapColumns}
|
|
94
|
+
cellMinWidth={tableOptions.cellMinWidth}
|
|
95
|
+
viewport={viewport}
|
|
96
|
+
rightAlignedCols={rightAlignedCols}
|
|
97
|
+
/>
|
|
98
|
+
)
|
|
99
|
+
} else {
|
|
100
|
+
switch (rowType) {
|
|
101
|
+
case RowType.row_group:
|
|
102
|
+
return <GroupRow label={childRowCopy[0]} colSpan={childRowCopy.length} key={key} />
|
|
103
|
+
case RowType.total:
|
|
104
|
+
return (
|
|
105
|
+
<Row
|
|
106
|
+
preliminaryData={preliminaryData}
|
|
107
|
+
key={key}
|
|
108
|
+
rowKey={key}
|
|
109
|
+
childRow={childRowCopy}
|
|
110
|
+
isTotal={true}
|
|
111
|
+
wrapColumns={wrapColumns}
|
|
112
|
+
cellMinWidth={tableOptions.cellMinWidth}
|
|
113
|
+
viewport={viewport}
|
|
114
|
+
rightAlignedCols={rightAlignedCols}
|
|
115
|
+
/>
|
|
116
|
+
)
|
|
117
|
+
case RowType.row_group_total:
|
|
118
|
+
return <GroupRow label={childRowCopy[0]} colSpan={1} key={key} data={childRowCopy.slice(1)} />
|
|
119
|
+
default:
|
|
120
|
+
return (
|
|
121
|
+
<Row
|
|
122
|
+
preliminaryData={preliminaryData}
|
|
123
|
+
key={key}
|
|
124
|
+
rowKey={key}
|
|
125
|
+
childRow={childRowCopy}
|
|
126
|
+
wrapColumns={wrapColumns}
|
|
127
|
+
cellMinWidth={tableOptions.cellMinWidth}
|
|
128
|
+
viewport={viewport}
|
|
129
|
+
rightAlignedCols={rightAlignedCols}
|
|
130
|
+
/>
|
|
131
|
+
)
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
})}
|
|
135
|
+
</tbody>
|
|
136
|
+
</>
|
|
137
|
+
)}
|
|
138
|
+
</table>
|
|
139
|
+
)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export default Table
|
|
@@ -43,7 +43,7 @@ const Row: FC<RowProps> = props => {
|
|
|
43
43
|
<Cell
|
|
44
44
|
ariaLabel={style?.color ? 'suppressed data' : ''}
|
|
45
45
|
key={rowKey + '__' + i}
|
|
46
|
-
style={{ whiteSpace, minWidth, textAlign, ...style }}
|
|
46
|
+
style={{ whiteSpace, minWidth, textAlign, textOverflow: 'ellipsis', ...style }}
|
|
47
47
|
isBold={isTotal}
|
|
48
48
|
>
|
|
49
49
|
{child}
|
|
@@ -8,6 +8,7 @@ import CityStateExample from './_mocks/example-city-state.json'
|
|
|
8
8
|
import { displayGeoName } from '@cdc/map/src/helpers/displayGeoName'
|
|
9
9
|
import rowTypeData from './_mocks/row_type.json'
|
|
10
10
|
import { TableConfig } from '../DataTable/types/TableConfig'
|
|
11
|
+
import ConfigContext from '@cdc/map/src/context'
|
|
11
12
|
|
|
12
13
|
const meta: Meta<typeof DataTable> = {
|
|
13
14
|
title: 'Components/Organisms/DataTable',
|
|
@@ -36,7 +37,6 @@ export const Primary: Story = {
|
|
|
36
37
|
export const CityState: Story = {
|
|
37
38
|
args: {
|
|
38
39
|
config: CityStateExample,
|
|
39
|
-
dataConfig: CityStateExample,
|
|
40
40
|
rawData: CityStateExample.data,
|
|
41
41
|
runtimeData: CityStateExample.data,
|
|
42
42
|
expandDataTable: true,
|
|
@@ -46,7 +46,14 @@ export const CityState: Story = {
|
|
|
46
46
|
columns: CityStateExample.columns,
|
|
47
47
|
applyLegendToRow: () => ['#000'],
|
|
48
48
|
displayGeoName
|
|
49
|
-
}
|
|
49
|
+
},
|
|
50
|
+
decorators: [
|
|
51
|
+
Story => (
|
|
52
|
+
<ConfigContext.Provider value={{ config: CityStateExample }}>
|
|
53
|
+
<Story />
|
|
54
|
+
</ConfigContext.Provider>
|
|
55
|
+
)
|
|
56
|
+
]
|
|
50
57
|
}
|
|
51
58
|
|
|
52
59
|
export const Grouped: Story = {
|
|
@@ -37,7 +37,7 @@ function createGroupMatrix(): Record<string, ReactNode[][]> {
|
|
|
37
37
|
return { group_1: [base, base], group_2: [base, base] }
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
const Grouped: Story = {
|
|
41
41
|
args: {
|
|
42
42
|
childrenMatrix: createGroupMatrix(),
|
|
43
43
|
tableName: 'COVE Table',
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import React, { Children } from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Accordion as AccordionComponent,
|
|
4
|
+
AccordionItem,
|
|
5
|
+
AccordionItemHeading,
|
|
6
|
+
AccordionItemPanel,
|
|
7
|
+
AccordionItemButton
|
|
8
|
+
} from 'react-accessible-accordion'
|
|
3
9
|
import PropTypes from 'prop-types'
|
|
4
10
|
|
|
5
11
|
import Icon from './Icon'
|
|
6
12
|
import Tooltip from './Tooltip'
|
|
7
13
|
|
|
8
14
|
import '../../styles/v2/components/accordion.scss'
|
|
15
|
+
import './accordion.styles.css'
|
|
9
16
|
|
|
10
17
|
//Define the "slots" to be populated by subcomponents
|
|
11
18
|
const AccordionSection = children => children
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import parse from 'html-react-parser'
|
|
3
|
-
import './
|
|
3
|
+
import './title.styles.css'
|
|
4
|
+
import { Visualization } from '../../../types/Visualization'
|
|
4
5
|
|
|
5
6
|
type HeaderProps = {
|
|
6
7
|
title?: string
|
|
@@ -10,6 +11,8 @@ type HeaderProps = {
|
|
|
10
11
|
style?: React.CSSProperties
|
|
11
12
|
showTitle?: boolean
|
|
12
13
|
ariaLevel?: number
|
|
14
|
+
config: Visualization
|
|
15
|
+
theme?: string
|
|
13
16
|
}
|
|
14
17
|
|
|
15
18
|
const Title = (props: HeaderProps) => {
|
|
@@ -43,7 +43,6 @@
|
|
|
43
43
|
margin-bottom: 0 !important;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
// THEMES
|
|
47
46
|
&.theme-purple {
|
|
48
47
|
background: #712177;
|
|
49
48
|
border-bottom-color: #b890bb;
|
|
@@ -94,7 +93,6 @@
|
|
|
94
93
|
}
|
|
95
94
|
}
|
|
96
95
|
|
|
97
|
-
// fix sparkline bottom margin gap
|
|
98
96
|
.type-sparkline.type-chart .cove-component__header {
|
|
99
97
|
margin: 0px !important;
|
|
100
98
|
}
|