@cdc/map 2.6.2 → 2.6.3
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/cdcmap.js +27 -27
- package/examples/default-county.json +105 -0
- package/examples/default-single-state.json +109 -0
- package/examples/default-usa.json +744 -603
- package/examples/example-city-state.json +474 -0
- package/examples/example-world-map.json +1596 -0
- package/examples/gender-rate-map.json +1 -0
- package/package.json +50 -47
- package/src/CdcMap.js +422 -159
- package/src/components/CityList.js +3 -2
- package/src/components/CountyMap.js +556 -0
- package/src/components/DataTable.js +73 -19
- package/src/components/EditorPanel.js +2088 -1230
- package/src/components/Sidebar.js +5 -5
- package/src/components/SingleStateMap.js +326 -0
- package/src/components/UsaMap.js +20 -3
- package/src/data/abbreviations.js +57 -0
- package/src/data/color-palettes.js +10 -1
- package/src/data/county-map-halfquality.json +58453 -0
- package/src/data/county-map-quarterquality.json +1 -0
- package/src/data/county-topo.json +1 -0
- package/src/data/dfc-map.json +1 -0
- package/src/data/initial-state.js +2 -2
- package/src/data/newtest.json +1 -0
- package/src/data/state-abbreviations.js +60 -0
- package/src/data/supported-geos.js +3504 -151
- package/src/data/test.json +1 -0
- package/src/hooks/useActiveElement.js +19 -0
- package/src/index.html +27 -20
- package/src/index.js +8 -4
- package/src/scss/datatable.scss +2 -1
- package/src/scss/main.scss +10 -1
- package/src/scss/map.scss +153 -123
- package/src/scss/sidebar.scss +0 -1
- package/uploads/upload-example-city-state.json +392 -0
- package/uploads/upload-example-world-data.json +1490 -0
- package/LICENSE +0 -201
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {useState, useEffect} from 'react'
|
|
2
|
+
// Use for accessibility testing
|
|
3
|
+
const useActiveElement = () => {
|
|
4
|
+
const [active, setActive] = useState(document.activeElement);
|
|
5
|
+
|
|
6
|
+
const handleFocusIn = (e) => {
|
|
7
|
+
setActive(document.activeElement);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
document.addEventListener('focusin', handleFocusIn)
|
|
12
|
+
return () => {
|
|
13
|
+
document.removeEventListener('focusin', handleFocusIn)
|
|
14
|
+
};
|
|
15
|
+
}, [])
|
|
16
|
+
|
|
17
|
+
return active;
|
|
18
|
+
}
|
|
19
|
+
export default useActiveElement;
|
package/src/index.html
CHANGED
|
@@ -1,22 +1,29 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
2
|
<html lang="en">
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
|
|
6
|
+
<style type="text/css">
|
|
7
|
+
body {
|
|
8
|
+
margin: 0;
|
|
9
|
+
}
|
|
10
|
+
.cdc-map-outer-container {
|
|
11
|
+
min-height: 100vh;
|
|
12
|
+
}
|
|
13
|
+
</style>
|
|
14
|
+
</head>
|
|
15
|
+
<body>
|
|
16
|
+
<!-- DEFAULT EXAMPLES -->
|
|
17
|
+
<!-- <div class="react-container react-container--maps" data-config="/examples/default-county.json"></div> -->
|
|
18
|
+
<!-- <div class="react-container react-container--maps" data-config="/examples/default-usa.json"></div> -->
|
|
19
|
+
<!-- <div class="react-container react-container--maps" data-config="/examples/default-world.json"></div> -->
|
|
20
|
+
<!-- <div class="react-container react-container--maps" data-config="/examples/default-single-state.json"></div> -->
|
|
21
|
+
|
|
22
|
+
<!-- TP4 EXAMPLES -->
|
|
23
|
+
<div class="react-container react-container--maps" data-config="/examples/example-city-state.json"></div>
|
|
24
|
+
<!-- <div class="react-container react-container--maps" data-config="/examples/example-world-map.json"></div> -->
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
28
|
+
</body>
|
|
29
|
+
</html>
|
package/src/index.js
CHANGED
|
@@ -9,8 +9,12 @@ let isEditor = window.location.href.includes('editor=true');
|
|
|
9
9
|
const domContainer = document.querySelector('.react-container')
|
|
10
10
|
|
|
11
11
|
ReactDOM.render(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
<StrictMode>
|
|
13
|
+
<CdcMap
|
|
14
|
+
isEditor={isEditor}
|
|
15
|
+
configUrl={domContainer.attributes['data-config'].value}
|
|
16
|
+
containerEl={domContainer}
|
|
17
|
+
/>
|
|
18
|
+
</StrictMode>,
|
|
19
|
+
domContainer
|
|
16
20
|
);
|
package/src/scss/datatable.scss
CHANGED
package/src/scss/main.scss
CHANGED
|
@@ -170,6 +170,10 @@
|
|
|
170
170
|
display: inline-block;
|
|
171
171
|
height: 1em;
|
|
172
172
|
width: 1em;
|
|
173
|
+
min-width: 1em;
|
|
174
|
+
min-height: 1em;
|
|
175
|
+
max-width: 1em;
|
|
176
|
+
max-height: 1em;
|
|
173
177
|
border: rgba(0,0,0,.3) 1px solid;
|
|
174
178
|
}
|
|
175
179
|
|
|
@@ -212,4 +216,9 @@
|
|
|
212
216
|
cursor: pointer;
|
|
213
217
|
}
|
|
214
218
|
}
|
|
215
|
-
|
|
219
|
+
|
|
220
|
+
[tabIndex]:focus {
|
|
221
|
+
outline-color: rgb(0, 95, 204)
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
}
|
package/src/scss/map.scss
CHANGED
|
@@ -1,158 +1,188 @@
|
|
|
1
1
|
// Map Download UI
|
|
2
2
|
.map-downloads {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
3
|
+
position: relative;
|
|
4
|
+
z-index: 3;
|
|
5
|
+
|
|
6
|
+
.map-downloads__ui.btn-group {
|
|
7
|
+
transform: scale(0.8);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.map-downloads__ui {
|
|
11
|
+
position: absolute;
|
|
12
|
+
top: 0.5em;
|
|
13
|
+
left: 0.5em;
|
|
14
|
+
transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1);
|
|
15
|
+
box-shadow: 0 5px 12px -8px rgba(0, 0, 0, 0.5);
|
|
16
|
+
user-select: none;
|
|
17
|
+
height: 42px;
|
|
18
|
+
}
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
.map-container {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
&.full-border {
|
|
23
|
+
border: #c2c2c2 1px solid;
|
|
24
|
+
}
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
header + .map-container.full-border {
|
|
28
|
-
|
|
28
|
+
border-top: 0; // When they have a header, don't add a border top
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
// World Specific Styles
|
|
32
32
|
.map-container.world {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
&.data .geography-container {
|
|
34
|
+
border-bottom: $lightGray 1px solid;
|
|
35
|
+
}
|
|
36
|
+
.geography-container {
|
|
37
|
+
cursor: move;
|
|
38
|
+
}
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
@include breakpointClass(md) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
// US Specific
|
|
43
|
+
.map-container.us {
|
|
44
|
+
margin: 0 1em;
|
|
45
|
+
}
|
|
46
|
+
// Data Specific
|
|
47
|
+
.map-container.data {
|
|
48
|
+
&.side {
|
|
49
|
+
flex-direction: row;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
.geography-container {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
55
|
+
position: relative;
|
|
56
|
+
flex-grow: 1;
|
|
57
|
+
width: 100%;
|
|
58
|
+
overflow: hidden;
|
|
59
|
+
.geo-point {
|
|
60
|
+
transition: 0.3s all;
|
|
61
|
+
circle {
|
|
62
|
+
fill: inherit;
|
|
63
|
+
transition: 0.1s transform;
|
|
64
|
+
}
|
|
65
|
+
&:hover {
|
|
66
|
+
transition: 0.2s all;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
.map-logo {
|
|
70
|
+
position: absolute;
|
|
71
|
+
bottom: 2em;
|
|
72
|
+
right: 1em;
|
|
73
|
+
z-index: 3;
|
|
74
|
+
width: 75px;
|
|
75
|
+
}
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
.single-geo {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
transition: 0.2s fill;
|
|
80
|
+
cursor: pointer;
|
|
81
|
+
&:focus {
|
|
82
|
+
outline: 0;
|
|
83
|
+
}
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
// Cities and Territories
|
|
86
87
|
.territories {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
88
|
+
margin: 2em 100px 2em 0;
|
|
89
|
+
font-size: 1.1em;
|
|
90
|
+
display: flex;
|
|
91
|
+
align-items: center;
|
|
92
|
+
> span {
|
|
93
|
+
margin-left: 1em;
|
|
94
|
+
margin-right: 0.5em;
|
|
95
|
+
}
|
|
96
|
+
svg {
|
|
97
|
+
max-width: 35px;
|
|
98
|
+
min-width: 25px;
|
|
99
|
+
margin-left: 0.5em;
|
|
100
|
+
transition: 0.3s all;
|
|
101
|
+
text {
|
|
102
|
+
font-size: 0.95em;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
103
105
|
}
|
|
104
106
|
|
|
105
107
|
.zoom-controls {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
108
|
+
display: flex;
|
|
109
|
+
position: absolute;
|
|
110
|
+
bottom: 2em;
|
|
111
|
+
left: 1em;
|
|
112
|
+
z-index: 4;
|
|
113
|
+
> button {
|
|
114
|
+
display: flex;
|
|
115
|
+
align-items: center;
|
|
116
|
+
justify-content: center;
|
|
117
|
+
padding: 0.2em;
|
|
118
|
+
height: 1.75em;
|
|
119
|
+
width: 1.75em;
|
|
120
|
+
background: rgba(0, 0, 0, 0.65);
|
|
121
|
+
transition: 0.2s all;
|
|
122
|
+
color: #fff;
|
|
123
|
+
border-radius: 100%;
|
|
124
|
+
border: 0;
|
|
125
|
+
&:hover {
|
|
126
|
+
background: rgba(0, 0, 0, 0.8);
|
|
127
|
+
transition: 0.2s all;
|
|
128
|
+
}
|
|
129
|
+
&:active {
|
|
130
|
+
transform: scale(0.9);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
> button:first-child {
|
|
134
|
+
margin-right: 0.25em;
|
|
135
|
+
}
|
|
134
136
|
}
|
|
135
137
|
|
|
136
138
|
@include breakpointClass(sm) {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
139
|
+
.zoom-controls > button {
|
|
140
|
+
height: 2.5em;
|
|
141
|
+
width: 2.5em;
|
|
142
|
+
}
|
|
141
143
|
}
|
|
142
144
|
|
|
143
145
|
@include breakpointClass(md) {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
146
|
+
.map-downloads .map-downloads__ui.btn-group {
|
|
147
|
+
top: 1em;
|
|
148
|
+
left: 1em;
|
|
149
|
+
transform: none;
|
|
150
|
+
}
|
|
151
|
+
.territories {
|
|
152
|
+
font-size: 1em;
|
|
153
|
+
> span {
|
|
154
|
+
margin-left: 0;
|
|
155
|
+
}
|
|
156
|
+
svg {
|
|
157
|
+
max-width: 45px;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.countyMapGroup {
|
|
163
|
+
transition: transform 1s;
|
|
164
|
+
will-change: transform;
|
|
165
|
+
transform-origin: center;
|
|
166
|
+
stroke: none !important;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// .state {
|
|
170
|
+
// display: none;
|
|
171
|
+
// }
|
|
172
|
+
|
|
173
|
+
.state {
|
|
174
|
+
&--inactive:hover path {
|
|
175
|
+
cursor: pointer;
|
|
176
|
+
transition: fill 0.5s;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.county--path {
|
|
181
|
+
fill: white;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.btn--reset {
|
|
185
|
+
position: absolute;
|
|
186
|
+
top: 10px;
|
|
187
|
+
right: 10px;
|
|
158
188
|
}
|