@cdc/core 4.23.10 → 4.23.11
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/LICENSE +201 -0
- package/assets/icon-deviation-bar.svg +1 -0
- package/components/DataTable/DataTable.tsx +205 -0
- package/components/DataTable/components/BoxplotHeader.tsx +16 -0
- package/components/DataTable/components/CellAnchor.tsx +44 -0
- package/components/DataTable/components/ChartHeader.tsx +91 -0
- package/components/DataTable/components/ExpandCollapse.tsx +21 -0
- package/components/DataTable/components/Icons.tsx +10 -0
- package/components/DataTable/components/MapHeader.tsx +56 -0
- package/components/DataTable/components/SkipNav.tsx +7 -0
- package/components/DataTable/helpers/boxplotCellMatrix.tsx +64 -0
- package/components/DataTable/helpers/chartCellMatrix.tsx +78 -0
- package/components/DataTable/helpers/customSort.ts +55 -0
- package/components/DataTable/helpers/getChartCellValue.ts +55 -0
- package/components/DataTable/helpers/getDataSeriesColumns.ts +28 -0
- package/components/DataTable/helpers/getSeriesName.ts +26 -0
- package/components/DataTable/helpers/mapCellMatrix.tsx +56 -0
- package/components/DataTable/helpers/regionCellMatrix.tsx +13 -0
- package/components/DataTable/helpers/standardizeState.js +76 -0
- package/components/DataTable/index.ts +1 -0
- package/components/DataTable/types/TableConfig.ts +57 -0
- package/components/DownloadButton.tsx +29 -0
- package/components/LegendCircle.jsx +2 -2
- package/components/Table/Table.tsx +49 -0
- package/components/Table/components/Cell.tsx +9 -0
- package/components/Table/components/GroupRow.tsx +16 -0
- package/components/Table/components/Row.tsx +19 -0
- package/components/Table/index.ts +1 -0
- package/components/Table/types/CellMatrix.ts +4 -0
- package/components/_stories/DataTable.stories.tsx +62 -0
- package/components/_stories/Table.stories.tsx +53 -0
- package/components/_stories/_mocks/dashboard_no_filter.json +121 -0
- package/components/_stories/_mocks/example-city-state.json +808 -0
- package/components/_stories/styles.scss +9 -0
- package/components/managers/{DataDesigner.jsx → DataDesigner.tsx} +96 -87
- package/components/ui/Title/Title.scss +95 -0
- package/components/ui/Title/index.tsx +34 -0
- package/components/ui/_stories/Title.stories.tsx +21 -0
- package/helpers/DataTransform.ts +45 -18
- package/helpers/cove/string.ts +11 -0
- package/helpers/fetchRemoteData.js +1 -1
- package/package.json +2 -2
- package/styles/_data-table.scss +1 -0
- package/styles/heading-colors.scss +0 -3
- package/styles/v2/layout/_component.scss +0 -11
- package/types/Axis.ts +6 -0
- package/types/Color.ts +5 -0
- package/types/ComponentStyles.ts +7 -0
- package/types/ComponentThemes.ts +13 -0
- package/types/EditorColumnProperties.ts +8 -0
- package/types/Runtime.ts +9 -0
- package/types/Series.ts +1 -0
- package/types/Visualization.ts +21 -0
- package/components/DataTable.jsx +0 -754
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
|
|
3
|
+
import DataTable from '../DataTable'
|
|
4
|
+
import './styles.scss'
|
|
5
|
+
import Example_1 from './_mocks/dashboard_no_filter.json'
|
|
6
|
+
import CityStateExample from './_mocks/example-city-state.json'
|
|
7
|
+
import { displayGeoName } from '@cdc/map/src/helpers/displayGeoName'
|
|
8
|
+
|
|
9
|
+
const meta: Meta<typeof DataTable> = {
|
|
10
|
+
title: 'Components/Organisms/DataTable',
|
|
11
|
+
component: DataTable
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default meta
|
|
15
|
+
|
|
16
|
+
type Story = StoryObj<typeof DataTable>
|
|
17
|
+
|
|
18
|
+
const datasetKey = 'dashboard_example_map.csv'
|
|
19
|
+
|
|
20
|
+
export const Primary: Story = {
|
|
21
|
+
args: {
|
|
22
|
+
config: Example_1,
|
|
23
|
+
dataConfig: Example_1.datasets[datasetKey],
|
|
24
|
+
rawData: Example_1.datasets[datasetKey].data,
|
|
25
|
+
runtimeData: Example_1.datasets[datasetKey].data,
|
|
26
|
+
expandDataTable: true,
|
|
27
|
+
tableTitle: 'COVE DataTable',
|
|
28
|
+
viewport: 'lg',
|
|
29
|
+
tabbingId: datasetKey
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const CityState: Story = {
|
|
34
|
+
args: {
|
|
35
|
+
config: CityStateExample,
|
|
36
|
+
dataConfig: CityStateExample,
|
|
37
|
+
rawData: CityStateExample.data,
|
|
38
|
+
runtimeData: CityStateExample.data,
|
|
39
|
+
expandDataTable: true,
|
|
40
|
+
tableTitle: 'CityStateExample DataTable',
|
|
41
|
+
viewport: 'lg',
|
|
42
|
+
tabbingId: '#asdf',
|
|
43
|
+
columns: CityStateExample.columns,
|
|
44
|
+
applyLegendToRow: () => ['#000'],
|
|
45
|
+
displayGeoName,
|
|
46
|
+
displayDataAsText: d => d
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export const Grouped: Story = {
|
|
51
|
+
args: {
|
|
52
|
+
config: Example_1,
|
|
53
|
+
dataConfig: Example_1.datasets[datasetKey],
|
|
54
|
+
rawData: Example_1.datasets[datasetKey].data,
|
|
55
|
+
runtimeData: Example_1.datasets[datasetKey].data,
|
|
56
|
+
expandDataTable: true,
|
|
57
|
+
tableTitle: 'COVE DataTable',
|
|
58
|
+
groupBy: 'TimeZone',
|
|
59
|
+
viewport: 'lg',
|
|
60
|
+
tabbingId: datasetKey
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
|
|
3
|
+
import Table from '../Table'
|
|
4
|
+
import { ReactNode } from 'react'
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof Table> = {
|
|
7
|
+
title: 'Components/Molecules/Table',
|
|
8
|
+
component: Table
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default meta
|
|
12
|
+
|
|
13
|
+
type Story = StoryObj<typeof Table>
|
|
14
|
+
|
|
15
|
+
function createMatrix(): ReactNode[][] {
|
|
16
|
+
const base = ['a', 'b', 'c'].map(el => <>{el}</>)
|
|
17
|
+
return [base, base]
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const Ungrouped: Story = {
|
|
21
|
+
args: {
|
|
22
|
+
childrenMatrix: createMatrix(),
|
|
23
|
+
tableName: 'COVE Table',
|
|
24
|
+
headContent: (
|
|
25
|
+
<tr>
|
|
26
|
+
<th>first</th>
|
|
27
|
+
<th>second</th>
|
|
28
|
+
<th>third</th>
|
|
29
|
+
</tr>
|
|
30
|
+
),
|
|
31
|
+
tableOptions: { className: 'table table-bordered' }
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function createGroupMatrix(): Record<string, ReactNode[][]> {
|
|
36
|
+
const base = ['a', 'b', 'c'].map(el => <>{el}</>)
|
|
37
|
+
return { group_1: [base, base], group_2: [base, base] }
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const Grouped: Story = {
|
|
41
|
+
args: {
|
|
42
|
+
childrenMatrix: createGroupMatrix(),
|
|
43
|
+
tableName: 'COVE Table',
|
|
44
|
+
headContent: (
|
|
45
|
+
<tr>
|
|
46
|
+
<th>first</th>
|
|
47
|
+
<th>second</th>
|
|
48
|
+
<th>third</th>
|
|
49
|
+
</tr>
|
|
50
|
+
),
|
|
51
|
+
tableOptions: { className: 'table table-bordered' }
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
{
|
|
2
|
+
"dashboard": {
|
|
3
|
+
"theme": "theme-blue",
|
|
4
|
+
"title": "Dashboard with No Filters"
|
|
5
|
+
},
|
|
6
|
+
"rows": [
|
|
7
|
+
[
|
|
8
|
+
{
|
|
9
|
+
"width": 12,
|
|
10
|
+
"widget": "map1629143821077"
|
|
11
|
+
},
|
|
12
|
+
{},
|
|
13
|
+
{}
|
|
14
|
+
],
|
|
15
|
+
[
|
|
16
|
+
{
|
|
17
|
+
"width": 6,
|
|
18
|
+
"widget": "data-bite1629144030877"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"width": 6,
|
|
22
|
+
"widget": "data-bite1629144267659"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"width": null
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
],
|
|
29
|
+
"table": {
|
|
30
|
+
"label": "Data Table",
|
|
31
|
+
"show": true
|
|
32
|
+
},
|
|
33
|
+
"type": "dashboard",
|
|
34
|
+
"uuid": 1629144022257,
|
|
35
|
+
"datasets": {
|
|
36
|
+
"dashboard_example_map.csv": {
|
|
37
|
+
"data": [
|
|
38
|
+
{
|
|
39
|
+
"Location": "Alabama",
|
|
40
|
+
"TimeZone": 1,
|
|
41
|
+
"Rate": 1375
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"Location": "Alaska",
|
|
45
|
+
"TimeZone": 1,
|
|
46
|
+
"Rate": 1377
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"Location": "American Samoa",
|
|
50
|
+
"TimeZone": 1,
|
|
51
|
+
"Rate": 1388
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"Location": "Arizona",
|
|
55
|
+
"TimeZone": 1,
|
|
56
|
+
"Rate": 1401
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"Location": "Arkansas",
|
|
60
|
+
"TimeZone": 1,
|
|
61
|
+
"Rate": 1398
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"Location": "California",
|
|
65
|
+
"TimeZone": 2,
|
|
66
|
+
"Rate": 1381
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"Location": "Colorado",
|
|
70
|
+
"TimeZone": 2,
|
|
71
|
+
"Rate": 1369
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"Location": "Connecticut",
|
|
75
|
+
"TimeZone": 2,
|
|
76
|
+
"Rate": 1403
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"Location": "Delaware\t",
|
|
80
|
+
"TimeZone": 2,
|
|
81
|
+
"Rate": "1384"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"Location": "District of Columbia",
|
|
85
|
+
"TimeZone": 2,
|
|
86
|
+
"Rate": 1400
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"Location": "Florida",
|
|
90
|
+
"TimeZone": 2,
|
|
91
|
+
"Rate": 1387
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"Location": "Georgia",
|
|
95
|
+
"TimeZone": 3,
|
|
96
|
+
"Rate": 1365
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"Location": "Guam",
|
|
100
|
+
"TimeZone": 3,
|
|
101
|
+
"Rate": 1356
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"Location": "Hawaii",
|
|
105
|
+
"TimeZone": 3,
|
|
106
|
+
"Rate": 1362
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"Location": "Idaho",
|
|
110
|
+
"TimeZone": 3,
|
|
111
|
+
"Rate": 1374
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
"dataFileSize": 971,
|
|
115
|
+
"dataFileName": "dashboard_example_map.csv",
|
|
116
|
+
"dataFileSourceType": "file",
|
|
117
|
+
"dataFileFormat": "CSV",
|
|
118
|
+
"preview": true
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|