@cdc/core 4.23.3 → 4.23.5
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/external-link.svg +1 -0
- package/components/CoveMediaControls.jsx +6 -2
- package/components/DataTable.jsx +630 -0
- package/components/Filters.jsx +421 -0
- package/components/LegendCircle.jsx +2 -2
- package/components/ui/Icon.jsx +2 -1
- package/data/colorPalettes.js +3 -3
- package/helpers/DataTransform.js +54 -0
- package/helpers/isNumberLog.js +3 -3
- package/helpers/validateFipsCodeLength.js +1 -1
- package/package.json +2 -2
- package/styles/_data-table.scss +10 -0
- package/styles/_global.scss +5 -0
- package/styles/_series-list.scss +92 -0
- package/styles/base.scss +6 -0
- package/styles/filters.scss +122 -0
- package/styles/v2/themes/_color-definitions.scss +49 -0
- package/helpers/cleanData.js +0 -50
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
&.cdc-map-outer-container .editor-panel .series-item,
|
|
2
|
+
&.type-chart .editor-panel .series-item {
|
|
3
|
+
list-style: none;
|
|
4
|
+
position: relative;
|
|
5
|
+
|
|
6
|
+
$border: 1px solid #ccc;
|
|
7
|
+
|
|
8
|
+
@at-root .accordion:first-of-type .series-item__title {
|
|
9
|
+
border-top: $border;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@at-root .accordion:last-of-type .series-item__title {
|
|
13
|
+
border-bottom: $border;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.accordion__button {
|
|
17
|
+
border-bottom: unset;
|
|
18
|
+
|
|
19
|
+
&.hide-arrow:before {
|
|
20
|
+
display: none;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.accordion__panel {
|
|
25
|
+
border-left: $border;
|
|
26
|
+
border-right: $border;
|
|
27
|
+
padding: 10px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.series-list__remove {
|
|
31
|
+
margin-left: auto;
|
|
32
|
+
margin-right: 20px;
|
|
33
|
+
border: 1px solid red;
|
|
34
|
+
border-radius: 10px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.hide-arrow .series-list__remove {
|
|
38
|
+
margin-right: 0px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
label {
|
|
42
|
+
font-size: 0.8rem;
|
|
43
|
+
font-weight: normal;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.series-item__title {
|
|
47
|
+
width: 100%;
|
|
48
|
+
background-color: #f5f5f5;
|
|
49
|
+
border-right: $border;
|
|
50
|
+
border-left: $border;
|
|
51
|
+
display: block;
|
|
52
|
+
padding: 5px;
|
|
53
|
+
|
|
54
|
+
.accordion__button {
|
|
55
|
+
border-bottom: none !important;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
li {
|
|
60
|
+
padding: 5px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.series_item__title {
|
|
64
|
+
font-size: 12px;
|
|
65
|
+
font-weight: bold;
|
|
66
|
+
text-transform: uppercase;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.series-item__dropdown {
|
|
70
|
+
display: block;
|
|
71
|
+
margin-bottom: 8px;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// chart series list
|
|
75
|
+
&--chart {
|
|
76
|
+
padding: 5px 5px 0;
|
|
77
|
+
|
|
78
|
+
.accordion__button {
|
|
79
|
+
display: flex;
|
|
80
|
+
padding-left: 5px !important;
|
|
81
|
+
|
|
82
|
+
.cove-icon {
|
|
83
|
+
padding-right: 5px;
|
|
84
|
+
margin-right: 10px;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
&:last-child {
|
|
89
|
+
padding-bottom: 5px;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
package/styles/base.scss
CHANGED
|
@@ -52,6 +52,11 @@
|
|
|
52
52
|
@import 'reset';
|
|
53
53
|
@import 'variables';
|
|
54
54
|
@import 'mixins';
|
|
55
|
+
@import 'filters';
|
|
56
|
+
|
|
57
|
+
body.post-type-cdc_visualization .visx-tooltip {
|
|
58
|
+
z-index: 1000000;
|
|
59
|
+
}
|
|
55
60
|
|
|
56
61
|
.cdc-open-viz-module {
|
|
57
62
|
position: relative;
|
|
@@ -64,6 +69,7 @@
|
|
|
64
69
|
@import 'data-table';
|
|
65
70
|
@import 'global';
|
|
66
71
|
@import 'button-section';
|
|
72
|
+
@import 'series-list';
|
|
67
73
|
}
|
|
68
74
|
|
|
69
75
|
$theme: (
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
.filters-section {
|
|
2
|
+
&__wrapper {
|
|
3
|
+
flex-wrap: wrap;
|
|
4
|
+
display: flex;
|
|
5
|
+
gap: 7px 15px;
|
|
6
|
+
margin-top: 15px;
|
|
7
|
+
margin-bottom: 15px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
&__intro-text {
|
|
11
|
+
display: block;
|
|
12
|
+
width: 100%;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
&__buttons {
|
|
16
|
+
width: 100%;
|
|
17
|
+
.apply {
|
|
18
|
+
margin-right: 10px;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// note the diff of section and no section above.
|
|
24
|
+
// Can't use nested selectors with top level section overwrites
|
|
25
|
+
section.filters-section {
|
|
26
|
+
// border: 1px solid #c7c7c7;
|
|
27
|
+
// padding: 10px;
|
|
28
|
+
border-radius: 10px;
|
|
29
|
+
margin-bottom: 10px;
|
|
30
|
+
display: block !important;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
div.single-filters {
|
|
34
|
+
display: flex;
|
|
35
|
+
flex-wrap: wrap;
|
|
36
|
+
margin: 15px 0;
|
|
37
|
+
|
|
38
|
+
select {
|
|
39
|
+
width: auto !important;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
label {
|
|
43
|
+
width: 100%;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&__tab-bar {
|
|
47
|
+
&:first-child {
|
|
48
|
+
border-top-left-radius: 15px;
|
|
49
|
+
border-bottom-left-radius: 15px;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.single-filters--dropdown {
|
|
55
|
+
width: auto;
|
|
56
|
+
display: flex;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.single-filters--tab {
|
|
60
|
+
width: 100%;
|
|
61
|
+
display: flex;
|
|
62
|
+
flex-wrap: wrap;
|
|
63
|
+
|
|
64
|
+
.tab {
|
|
65
|
+
width: 25%;
|
|
66
|
+
min-height: 40px;
|
|
67
|
+
border: none;
|
|
68
|
+
padding: 0.5em 0;
|
|
69
|
+
background: none;
|
|
70
|
+
border-top-left-radius: 5px;
|
|
71
|
+
border-top-right-radius: 5px;
|
|
72
|
+
margin-top: 5px;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.tab--active {
|
|
76
|
+
border-bottom: none;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.single-filters--pill {
|
|
81
|
+
width: 100%;
|
|
82
|
+
display: flex;
|
|
83
|
+
flex-wrap: wrap;
|
|
84
|
+
|
|
85
|
+
.pill {
|
|
86
|
+
border: none;
|
|
87
|
+
width: 95%;
|
|
88
|
+
height: 60px;
|
|
89
|
+
background: none;
|
|
90
|
+
border-radius: 30px;
|
|
91
|
+
box-shadow: 0 2px 5px #d3d3d3;
|
|
92
|
+
vertical-align: middle;
|
|
93
|
+
margin-bottom: 15px;
|
|
94
|
+
margin-right: 10px;
|
|
95
|
+
margin-left: 10px;
|
|
96
|
+
white-space: break-spaces;
|
|
97
|
+
word-break: break-word;
|
|
98
|
+
|
|
99
|
+
&__wrapper {
|
|
100
|
+
width: 25%;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.single-filters__tab-bar {
|
|
106
|
+
background: #f2f2f2;
|
|
107
|
+
display: flex !important;
|
|
108
|
+
flex-wrap: wrap;
|
|
109
|
+
width: 100%;
|
|
110
|
+
border-radius: 15px;
|
|
111
|
+
|
|
112
|
+
button.button__tab-bar {
|
|
113
|
+
flex: 1 1 0px;
|
|
114
|
+
padding: 10px;
|
|
115
|
+
background: none;
|
|
116
|
+
transition: background 2s;
|
|
117
|
+
&--active {
|
|
118
|
+
background: #fff;
|
|
119
|
+
border-radius: 15px;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -147,6 +147,55 @@ $theme: (
|
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
+
// Charts filter styles
|
|
151
|
+
.cdc-open-viz-module {
|
|
152
|
+
@each $theme-name, $theme-colors in $theme {
|
|
153
|
+
&.theme-#{$theme-name} {
|
|
154
|
+
.single-filters--tab .tab--active {
|
|
155
|
+
border: 1px solid string.unquote(nth($theme-colors, 1));
|
|
156
|
+
border-top: 3px solid string.unquote(nth($theme-colors, 1));
|
|
157
|
+
border-bottom: none;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.single-filters--tab .tab:not(.tab--active) {
|
|
161
|
+
border-bottom: 1px solid string.unquote(nth($theme-colors, 1));
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.single-filters--pill .pill--active {
|
|
165
|
+
background-color: string.unquote(nth($theme-colors, 1));
|
|
166
|
+
color: #fff;
|
|
167
|
+
}
|
|
168
|
+
.filters-section button.cove-button:not([disabled]) {
|
|
169
|
+
background-color: string.unquote(nth($theme-colors, 1)) !important;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.theme-#{$theme-name} {
|
|
174
|
+
.single-filters--tab .tab--active {
|
|
175
|
+
border: 1px solid string.unquote(nth($theme-colors, 1));
|
|
176
|
+
border-top: 3px solid string.unquote(nth($theme-colors, 1));
|
|
177
|
+
border-bottom: none;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.single-filters--tab .tab:not(.tab--active) {
|
|
181
|
+
border-bottom: 1px solid string.unquote(nth($theme-colors, 1));
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.single-filters--pill .pill--active {
|
|
185
|
+
background-color: string.unquote(nth($theme-colors, 1));
|
|
186
|
+
color: #fff;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.button__tab-bar--active {
|
|
190
|
+
outline: 2px solid string.unquote(nth($theme-colors, 1));
|
|
191
|
+
}
|
|
192
|
+
.apply:not([disabled]) {
|
|
193
|
+
background-color: string.unquote(nth($theme-colors, 1)) !important;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
150
199
|
$baseColor: #333;
|
|
151
200
|
$blue: #005eaa;
|
|
152
201
|
$lightestGray: #f2f2f2;
|
package/helpers/cleanData.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* cleanData
|
|
3
|
-
*
|
|
4
|
-
// This cleans a data set by:
|
|
5
|
-
// - removing commas and $ signs from any numbers to try to plot the point
|
|
6
|
-
// - removing any data points that are NOT composed of of all digits (but allow a decimal point)
|
|
7
|
-
// Without this the charts "break" and do not render
|
|
8
|
-
*
|
|
9
|
-
* Inputs: data as array, excludeKey indicates which key to use to NOT clean
|
|
10
|
-
* Example: "Date" should not be cleaned if part of the data
|
|
11
|
-
*
|
|
12
|
-
* Output: returns the cleanedData
|
|
13
|
-
*
|
|
14
|
-
* Set testing = true if you need to see before and after data
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
export default function cleanData (data, excludeKey, testing = false) {
|
|
18
|
-
let cleanedupData = []
|
|
19
|
-
if (testing) console.log('## Data to clean=', data)
|
|
20
|
-
if (excludeKey === undefined) {
|
|
21
|
-
excludeKey = "Date" // have a default value
|
|
22
|
-
}
|
|
23
|
-
data.forEach(function (d, i) {
|
|
24
|
-
if (testing) console.log("clean", i, " d", d);
|
|
25
|
-
let cleanedBar = {}
|
|
26
|
-
Object.keys(d).forEach(function (key) {
|
|
27
|
-
if (key === excludeKey) {
|
|
28
|
-
// pass thru
|
|
29
|
-
cleanedBar[key] = d[key]
|
|
30
|
-
} else {
|
|
31
|
-
// remove comma and dollar signs
|
|
32
|
-
if (testing) console.log("typeof d[key] is ", typeof d[key]);
|
|
33
|
-
let tmp = "";
|
|
34
|
-
if (typeof d[key] === 'string') {
|
|
35
|
-
tmp = d[key] !== null && d[key] !== '' ? d[key].replace(/[,\$]/g, '') : ''
|
|
36
|
-
} else {
|
|
37
|
-
tmp = d[key] !== null && d[key] !== '' ? d[key] : ''
|
|
38
|
-
}
|
|
39
|
-
if ((tmp !== '' && tmp !== null && !isNaN(tmp)) || (tmp !== '' && tmp !== null && /\d+\.?\d*/.test(tmp))) {
|
|
40
|
-
cleanedBar[key] = tmp
|
|
41
|
-
} else { cleanedBar[key] = '' }
|
|
42
|
-
// if you get here, then return nothing to skip bad data point
|
|
43
|
-
}
|
|
44
|
-
})
|
|
45
|
-
if (testing) console.log("cleanedBar=", cleanedBar);
|
|
46
|
-
cleanedupData.push(cleanedBar)
|
|
47
|
-
})
|
|
48
|
-
if (testing) console.log('## cleanedData =', cleanedupData)
|
|
49
|
-
return cleanedupData
|
|
50
|
-
}
|