@cdc/map 4.24.12 → 4.25.2-25
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 +50119 -48822
- package/examples/annotation/index.json +1 -1
- package/examples/custom-map-layers.json +1 -1
- package/examples/default-geocode.json +2 -2
- package/examples/example-city-state.json +1 -1
- package/examples/private/DEV-9989.json +229 -0
- package/examples/private/ardi.json +180 -0
- package/examples/private/colors 2.json +416 -0
- package/examples/private/colors.json +416 -0
- package/examples/private/colors.json.zip +0 -0
- package/examples/private/customColors.json +45348 -0
- package/examples/private/mmr.json +246 -0
- package/examples/private/test.json +1632 -0
- package/index.html +12 -14
- package/package.json +8 -3
- package/src/CdcMap.tsx +126 -396
- package/src/_stories/CdcMap.Filters.stories.tsx +19 -0
- package/src/_stories/CdcMap.Legend.Gradient.stories.tsx +9 -0
- package/src/_stories/CdcMap.stories.tsx +1 -1
- package/src/_stories/GoogleMap.stories.tsx +19 -0
- package/src/_stories/_mock/DEV-10148.json +859 -0
- package/src/_stories/_mock/DEV-9989.json +229 -0
- package/src/_stories/_mock/example-city-state.json +1 -1
- package/src/_stories/_mock/google-map.json +819 -0
- package/src/_stories/_mock/wastewater-map.json +210 -206
- package/src/components/Annotation/Annotation.Draggable.tsx +34 -43
- package/src/components/Annotation/AnnotationDropdown.tsx +4 -4
- package/src/components/CityList.tsx +3 -9
- package/src/components/DataTable.tsx +8 -9
- package/src/components/EditorPanel/components/EditorPanel.tsx +255 -490
- package/src/components/GoogleMap/components/GoogleMap.tsx +67 -0
- package/src/components/GoogleMap/index.tsx +3 -0
- package/src/components/Legend/components/Legend.tsx +40 -30
- package/src/components/Legend/components/LegendItem.Hex.tsx +7 -3
- package/src/components/Legend/components/index.scss +22 -16
- package/src/components/Modal.tsx +6 -5
- package/src/components/NavigationMenu.tsx +4 -3
- package/src/components/UsaMap/components/TerritoriesSection.tsx +66 -0
- package/src/components/UsaMap/components/Territory/Territory.Hexagon.tsx +15 -16
- package/src/components/UsaMap/components/Territory/Territory.Rectangle.tsx +3 -3
- package/src/components/UsaMap/components/UsaMap.County.tsx +1 -1
- package/src/components/UsaMap/components/UsaMap.Region.tsx +12 -8
- package/src/components/UsaMap/components/UsaMap.SingleState.tsx +2 -2
- package/src/components/UsaMap/components/UsaMap.State.tsx +23 -29
- package/src/components/WorldMap/WorldMap.tsx +3 -5
- package/src/context.ts +0 -12
- package/src/data/initial-state.js +2 -2
- package/src/data/supported-geos.js +23 -3
- package/src/helpers/applyColorToLegend.ts +3 -3
- package/src/helpers/closeModal.ts +9 -0
- package/src/helpers/handleMapAriaLabels.ts +38 -0
- package/src/helpers/indexOfIgnoreType.ts +8 -0
- package/src/helpers/navigationHandler.ts +21 -0
- package/src/helpers/toTitleCase.ts +44 -0
- package/src/helpers/validateFipsCodeLength.ts +30 -0
- package/src/hooks/useResizeObserver.ts +42 -0
- package/src/hooks/useTooltip.ts +4 -2
- package/src/index.jsx +1 -0
- package/src/scss/editor-panel.scss +2 -1
- package/src/scss/filters.scss +0 -5
- package/src/scss/main.scss +57 -61
- package/src/scss/map.scss +1 -13
- package/src/types/MapConfig.ts +20 -11
- package/src/types/MapContext.ts +4 -12
package/src/scss/main.scss
CHANGED
|
@@ -48,7 +48,6 @@
|
|
|
48
48
|
.cdc-map-inner-container {
|
|
49
49
|
@import './map';
|
|
50
50
|
flex-grow: 1;
|
|
51
|
-
text-rendering: geometricPrecision;
|
|
52
51
|
color: #202020;
|
|
53
52
|
border: 0;
|
|
54
53
|
text-align: left;
|
|
@@ -81,10 +80,7 @@
|
|
|
81
80
|
content: ' ';
|
|
82
81
|
position: absolute;
|
|
83
82
|
top: 0;
|
|
84
|
-
left: -1em;
|
|
85
|
-
right: -1em;
|
|
86
83
|
bottom: 0;
|
|
87
|
-
background: rgba(0, 0, 0, 0.05);
|
|
88
84
|
z-index: 7;
|
|
89
85
|
}
|
|
90
86
|
.modal-content {
|
|
@@ -94,71 +90,72 @@
|
|
|
94
90
|
top: 50%;
|
|
95
91
|
left: 50%;
|
|
96
92
|
display: flex;
|
|
97
|
-
flex-direction:
|
|
98
|
-
border-radius: 5px;
|
|
93
|
+
flex-direction: column;
|
|
99
94
|
transform: translate(-50%, -50%);
|
|
100
|
-
border: rgba(0, 0, 0, 0.3)
|
|
101
|
-
box-shadow: rgba(0, 0, 0, 0.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
font-size: 1rem;
|
|
105
|
-
border-radius: 4px;
|
|
95
|
+
border: 1px solid rgba(0, 0, 0, 0.3);
|
|
96
|
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
97
|
+
border-radius: 5px;
|
|
98
|
+
padding: 16px 40px;
|
|
106
99
|
min-width: 250px;
|
|
107
|
-
padding: 16px 40px 16px 20px;
|
|
108
100
|
width: auto;
|
|
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
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
101
|
+
max-height: 90vh; /* Constrain the modal's height to 90% of the viewport */
|
|
102
|
+
overflow-y: auto; /* Enable vertical scrolling if content overflows */
|
|
103
|
+
font-size: 1rem;
|
|
104
|
+
line-height: 1.4em;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.modal-content .content {
|
|
108
|
+
flex-grow: 1;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.modal-content .legend-item {
|
|
112
|
+
margin-right: 0.75em;
|
|
113
|
+
margin-top: 3px;
|
|
114
|
+
flex-shrink: 0;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.modal-content strong {
|
|
118
|
+
font-weight: 600;
|
|
119
|
+
font-size: 1.2em;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.modal-content .modal-close {
|
|
123
|
+
position: absolute;
|
|
124
|
+
right: 20px;
|
|
125
|
+
top: 18px;
|
|
126
|
+
cursor: pointer;
|
|
127
|
+
width: 1em;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.modal-content a.navigation-link {
|
|
131
|
+
text-decoration: underline;
|
|
132
|
+
cursor: pointer;
|
|
133
|
+
color: #075290;
|
|
134
|
+
display: flex;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.modal-content a.navigation-link svg {
|
|
138
|
+
display: inline-block;
|
|
139
|
+
max-width: 13px;
|
|
140
|
+
margin-left: 0.5em;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.modal-content.capitalize p {
|
|
144
|
+
text-transform: capitalize;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/* Responsive adjustments for smaller screens */
|
|
148
|
+
@media (max-width: 1048px) {
|
|
149
|
+
.modal-content {
|
|
150
|
+
width: 90%; /* Adjust width to fit smaller screens */
|
|
151
|
+
top: 10%; /* Offset from the top for better usability */
|
|
152
|
+
transform: translate(-50%, 0); /* Remove vertical centering */
|
|
155
153
|
}
|
|
156
154
|
}
|
|
157
155
|
}
|
|
158
156
|
}
|
|
159
157
|
|
|
160
158
|
p.subtext {
|
|
161
|
-
font-size: 0.9em;
|
|
162
159
|
em {
|
|
163
160
|
font-style: italic;
|
|
164
161
|
}
|
|
@@ -168,7 +165,6 @@
|
|
|
168
165
|
}
|
|
169
166
|
|
|
170
167
|
span.legend-item {
|
|
171
|
-
margin-right: 5px;
|
|
172
168
|
border-radius: 300px;
|
|
173
169
|
vertical-align: middle;
|
|
174
170
|
display: inline-block;
|
package/src/scss/map.scss
CHANGED
|
@@ -75,7 +75,6 @@ $medium: 768px;
|
|
|
75
75
|
position: relative;
|
|
76
76
|
flex-grow: 1;
|
|
77
77
|
width: 100%;
|
|
78
|
-
overflow: hidden;
|
|
79
78
|
.geo-point {
|
|
80
79
|
transition: 0.3s all;
|
|
81
80
|
circle {
|
|
@@ -102,10 +101,7 @@ $medium: 768px;
|
|
|
102
101
|
}
|
|
103
102
|
|
|
104
103
|
.territories-label {
|
|
105
|
-
|
|
106
|
-
font-size: 1.1em;
|
|
107
|
-
display: block;
|
|
108
|
-
margin-top: 15px;
|
|
104
|
+
font-size: 1em;
|
|
109
105
|
}
|
|
110
106
|
|
|
111
107
|
// Cities and Territories
|
|
@@ -194,7 +190,6 @@ $medium: 768px;
|
|
|
194
190
|
transform: none;
|
|
195
191
|
}
|
|
196
192
|
.territories {
|
|
197
|
-
font-size: 1em;
|
|
198
193
|
> span {
|
|
199
194
|
margin-left: 0;
|
|
200
195
|
}
|
|
@@ -327,10 +322,3 @@ canvas {
|
|
|
327
322
|
pointer-events: none;
|
|
328
323
|
display: none;
|
|
329
324
|
}
|
|
330
|
-
|
|
331
|
-
.data-table-container {
|
|
332
|
-
margin: 20px 0px 0px;
|
|
333
|
-
&.download-link-above {
|
|
334
|
-
margin-top: 0;
|
|
335
|
-
}
|
|
336
|
-
}
|
package/src/types/MapConfig.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { ComponentThemes } from '@cdc/core/types/ComponentThemes'
|
|
2
|
-
import { Visualization } from '@cdc/core/types/Visualization'
|
|
3
|
-
import { EditorColumnProperties } from '@cdc/core/types/EditorColumnProperties'
|
|
4
|
-
import { Version } from '@cdc/core/types/Version'
|
|
1
|
+
import { type ComponentThemes } from '@cdc/core/types/ComponentThemes'
|
|
2
|
+
import { type Visualization } from '@cdc/core/types/Visualization'
|
|
3
|
+
import { type EditorColumnProperties } from '@cdc/core/types/EditorColumnProperties'
|
|
4
|
+
import { type Version } from '@cdc/core/types/Version'
|
|
5
|
+
import { type VizFilter } from '@cdc/core/types/VizFilter'
|
|
5
6
|
|
|
6
7
|
export type MapVisualSettings = {
|
|
7
8
|
/** minBubbleSize - Minimum Circle Size when the map has a type of bubble */
|
|
@@ -15,9 +16,8 @@ export type MapVisualSettings = {
|
|
|
15
16
|
/** cityStyle - optional visual indicator of label on the Legend */
|
|
16
17
|
cityStyleLabel: string
|
|
17
18
|
/** geoCodeCircleSize - controls the size of the city style option (circle or pin) */
|
|
18
|
-
|
|
19
19
|
geoCodeCircleSize: number
|
|
20
|
-
/** showBubbleZeros - shows circles on maps when the data is provided even if
|
|
20
|
+
/** showBubbleZeros - shows circles on maps when the data is provided even if it's a zero value */
|
|
21
21
|
showBubbleZeros: boolean
|
|
22
22
|
/** additionalCityStyles - shows Circle, Square, Triangle, Rhombus/Diamond, Star, Map Pin on maps when the additionalCityStyles is added */
|
|
23
23
|
additionalCityStyles: [] | [{ label: string; column: string; value: string; shape: string }]
|
|
@@ -46,7 +46,7 @@ export type PrimaryColumnProperties = Pick<
|
|
|
46
46
|
EditorColumnProperties,
|
|
47
47
|
'dataTable' | 'label' | 'name' | 'prefix' | 'suffix' | 'tooltip'
|
|
48
48
|
>
|
|
49
|
-
|
|
49
|
+
|
|
50
50
|
export type LegendShapeItem = {
|
|
51
51
|
column: string
|
|
52
52
|
key: string
|
|
@@ -77,11 +77,11 @@ export type MapConfig = Visualization & {
|
|
|
77
77
|
navigate: NavigateColumnProperties
|
|
78
78
|
latitude: LatitudeColumnProperties
|
|
79
79
|
longitude: LongitudeColumnProperties
|
|
80
|
-
categorical: { name }
|
|
80
|
+
categorical: { name: string }
|
|
81
81
|
}
|
|
82
82
|
dataUrl: string
|
|
83
83
|
runtimeDataUrl: string
|
|
84
|
-
filters:
|
|
84
|
+
filters: VizFilter[]
|
|
85
85
|
general: {
|
|
86
86
|
allowMapZoom: boolean
|
|
87
87
|
convertFipsCodes: boolean
|
|
@@ -90,7 +90,16 @@ export type MapConfig = Visualization & {
|
|
|
90
90
|
fullBorder: boolean
|
|
91
91
|
geoBorderColor: string
|
|
92
92
|
geoLabelOverride: string
|
|
93
|
-
geoType:
|
|
93
|
+
geoType:
|
|
94
|
+
| 'us'
|
|
95
|
+
| 'us-region'
|
|
96
|
+
| 'us-county'
|
|
97
|
+
| 'world'
|
|
98
|
+
| 'us-geocode'
|
|
99
|
+
| 'world-geocode'
|
|
100
|
+
| 'bubble'
|
|
101
|
+
| 'single-state'
|
|
102
|
+
| 'google-map'
|
|
94
103
|
hasRegions: boolean
|
|
95
104
|
headerColor: ComponentThemes
|
|
96
105
|
hideGeoColumnInTooltip: boolean
|
|
@@ -150,7 +159,7 @@ export type MapConfig = Visualization & {
|
|
|
150
159
|
tooltips: {
|
|
151
160
|
appearanceType: 'hover' | 'click'
|
|
152
161
|
linkLabel: string
|
|
153
|
-
capitalizeLabels:
|
|
162
|
+
capitalizeLabels: boolean
|
|
154
163
|
opacity: number
|
|
155
164
|
}
|
|
156
165
|
runtime: {
|
package/src/types/MapContext.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { type MapConfig
|
|
1
|
+
import { type MapConfig } from './MapConfig'
|
|
2
|
+
import { type ViewPort } from '@cdc/core/types/ViewPort'
|
|
2
3
|
|
|
3
4
|
export type MapContext = {
|
|
4
5
|
applyLegendToRow
|
|
5
6
|
applyTooltipsToGeo
|
|
6
|
-
|
|
7
|
-
columnsInData
|
|
8
|
-
currentViewport: ViewportSize
|
|
7
|
+
currentViewport: ViewPort
|
|
9
8
|
data
|
|
10
9
|
displayDataAsText
|
|
11
10
|
displayGeoName
|
|
@@ -16,7 +15,6 @@ export type MapContext = {
|
|
|
16
15
|
handleCircleClick: Function
|
|
17
16
|
handleDragStateChange: Function
|
|
18
17
|
isDraggingAnnotation: boolean
|
|
19
|
-
handleMapAriaLabels
|
|
20
18
|
hasZoom
|
|
21
19
|
innerContainerRef
|
|
22
20
|
isDashboard
|
|
@@ -25,7 +23,6 @@ export type MapContext = {
|
|
|
25
23
|
isFilterValueSupported: boolean
|
|
26
24
|
loadConfig
|
|
27
25
|
logo: string
|
|
28
|
-
navigationHandler
|
|
29
26
|
position
|
|
30
27
|
resetLegendToggles
|
|
31
28
|
runtimeFilters
|
|
@@ -38,13 +35,8 @@ export type MapContext = {
|
|
|
38
35
|
setRuntimeFilters
|
|
39
36
|
setRuntimeLegend
|
|
40
37
|
setSharedFilterValue
|
|
41
|
-
setState
|
|
38
|
+
setState: (newState: MapConfig) => MapConfig
|
|
42
39
|
state: MapConfig
|
|
43
|
-
supportedCities
|
|
44
|
-
supportedCounties
|
|
45
|
-
supportedCountries
|
|
46
|
-
supportedTerritories
|
|
47
|
-
titleCase
|
|
48
40
|
viewport
|
|
49
41
|
setStateToShow: (string) => void
|
|
50
42
|
stateToShow: string
|