@cdc/map 4.25.8 → 4.25.10
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/.claude/settings.local.json +30 -0
- package/dist/cdcmap.js +54263 -52600
- package/examples/private/c.json +290 -0
- package/examples/private/canvas-city-hover.json +787 -0
- package/examples/private/d.json +345 -0
- package/examples/private/g.json +1 -0
- package/examples/private/h.json +105911 -0
- package/examples/private/measles-data.json +378 -0
- package/examples/private/measles.json +211 -0
- package/examples/private/north-dakota.json +1132 -0
- package/examples/private/state-with-pattern.json +883 -0
- package/index.html +35 -34
- package/package.json +26 -5
- package/src/CdcMap.tsx +23 -8
- package/src/CdcMapComponent.tsx +215 -309
- package/src/_stories/CdcMap.Filters.stories.tsx +2 -2
- package/src/_stories/CdcMap.Legend.Gradient.stories.tsx +3 -3
- package/src/_stories/CdcMap.Legend.stories.tsx +7 -4
- package/src/_stories/CdcMap.Patterns.stories.tsx +2 -2
- package/src/_stories/CdcMap.Table.stories.tsx +2 -2
- package/src/_stories/CdcMap.stories.tsx +15 -5
- package/src/_stories/GoogleMap.stories.tsx +2 -2
- package/src/_stories/UsaMap.NoData.stories.tsx +2 -2
- package/src/_stories/_mock/equal-number.json +1109 -0
- package/src/_stories/_mock/us-bubble-cities.json +306 -0
- package/src/components/BubbleList.tsx +16 -12
- package/src/components/CityList.tsx +85 -107
- package/src/components/DataTable.tsx +37 -9
- package/src/components/EditorPanel/components/EditorPanel.tsx +177 -165
- package/src/components/EditorPanel/components/HexShapeSettings.tsx +3 -2
- package/src/components/EditorPanel/components/Panels/Panel.PatternSettings.tsx +7 -5
- package/src/components/Geo.tsx +2 -0
- package/src/components/Legend/components/Legend.tsx +109 -73
- package/src/components/Legend/components/LegendGroup/Legend.Group.tsx +10 -7
- package/src/components/MapContainer.tsx +52 -0
- package/src/components/MapControls.tsx +44 -0
- package/src/components/NavigationMenu.tsx +11 -2
- package/src/components/UsaMap/components/SingleState/SingleState.CountyOutput.tsx +24 -7
- package/src/components/UsaMap/components/UsaMap.County.tsx +111 -37
- package/src/components/UsaMap/components/UsaMap.Region.tsx +23 -5
- package/src/components/UsaMap/components/UsaMap.SingleState.tsx +6 -6
- package/src/components/UsaMap/components/UsaMap.State.tsx +28 -10
- package/src/components/UsaMap/helpers/map.ts +2 -2
- package/src/components/WorldMap/WorldMap.tsx +113 -25
- package/src/components/ZoomControls.tsx +6 -9
- package/src/context/LegendMemoContext.tsx +30 -0
- package/src/context.ts +1 -40
- package/src/data/initial-state.js +143 -130
- package/src/data/supported-geos.js +17 -2
- package/src/helpers/applyColorToLegend.ts +116 -20
- package/src/helpers/applyLegendToRow.ts +10 -6
- package/src/helpers/componentHelpers.ts +8 -0
- package/src/helpers/constants.ts +12 -0
- package/src/helpers/dataTableHelpers.ts +6 -0
- package/src/helpers/displayGeoName.ts +1 -1
- package/src/helpers/generateRuntimeLegend.ts +44 -8
- package/src/helpers/generateRuntimeLegendHash.ts +4 -2
- package/src/helpers/getColumnNames.ts +1 -1
- package/src/helpers/getPatternForRow.ts +36 -0
- package/src/helpers/getStatesPicked.ts +8 -5
- package/src/helpers/index.ts +11 -3
- package/src/helpers/isLegendItemDisabled.ts +16 -0
- package/src/helpers/mapObserverHelpers.ts +40 -0
- package/src/helpers/resetLegendToggles.ts +3 -2
- package/src/helpers/toggleLegendActive.ts +6 -11
- package/src/helpers/urlDataHelpers.ts +70 -0
- package/src/hooks/useGeoClickHandler.ts +35 -1
- package/src/hooks/useLegendMemo.ts +17 -0
- package/src/hooks/useMapLayers.tsx +5 -4
- package/src/hooks/useStateZoom.tsx +25 -6
- package/src/hooks/useTooltip.ts +1 -2
- package/src/index.jsx +0 -2
- package/src/store/map.reducer.ts +17 -6
- package/src/test/CdcMap.test.jsx +11 -0
- package/src/types/MapConfig.ts +23 -14
- package/src/types/MapContext.ts +0 -7
- package/src/types/runtimeLegend.ts +17 -1
- package/vite.config.js +2 -7
- package/vitest.config.ts +16 -0
- package/src/coreStyles_map.scss +0 -3
- package/src/helpers/colorDistributions.ts +0 -12
- package/src/helpers/generateColorsArray.ts +0 -14
- package/src/helpers/tests/generateColorsArray.test.ts +0 -18
- package/src/helpers/tests/generateRuntimeLegendHash.test.ts +0 -11
|
@@ -3,6 +3,7 @@ import { geoMercator } from 'd3-geo'
|
|
|
3
3
|
import { Mercator } from '@visx/geo'
|
|
4
4
|
import { feature } from 'topojson-client'
|
|
5
5
|
import ConfigContext, { MapDispatchContext } from '../../context'
|
|
6
|
+
import { useLegendMemoContext } from '../../context/LegendMemoContext'
|
|
6
7
|
import ErrorBoundary from '@cdc/core/components/ErrorBoundary'
|
|
7
8
|
import ZoomableGroup from '../ZoomableGroup'
|
|
8
9
|
import Geo from '../Geo'
|
|
@@ -28,23 +29,23 @@ import { applyLegendToRow } from '../../helpers/applyLegendToRow'
|
|
|
28
29
|
|
|
29
30
|
import './worldMap.styles.css'
|
|
30
31
|
import { publishAnalyticsEvent } from '@cdc/core/helpers/metrics/helpers'
|
|
32
|
+
import { getVizTitle, getVizSubType } from '@cdc/core/helpers/metrics/utils'
|
|
31
33
|
|
|
32
34
|
let projection = geoMercator()
|
|
33
35
|
|
|
34
36
|
const WorldMap = () => {
|
|
35
37
|
// prettier-ignore
|
|
36
38
|
const {
|
|
37
|
-
|
|
39
|
+
runtimeData,
|
|
38
40
|
position,
|
|
39
|
-
setRuntimeData,
|
|
40
41
|
config,
|
|
41
42
|
tooltipId,
|
|
42
43
|
runtimeLegend,
|
|
43
|
-
legendMemo,
|
|
44
|
-
legendSpecialClassLastMemo,
|
|
45
44
|
interactionLabel
|
|
46
45
|
} = useContext(ConfigContext)
|
|
47
46
|
|
|
47
|
+
const { legendMemo, legendSpecialClassLastMemo } = useLegendMemoContext()
|
|
48
|
+
|
|
48
49
|
const { type, allowMapZoom } = config.general
|
|
49
50
|
|
|
50
51
|
const [world, setWorld] = useState(null)
|
|
@@ -65,38 +66,97 @@ const WorldMap = () => {
|
|
|
65
66
|
return <></>
|
|
66
67
|
}
|
|
67
68
|
|
|
68
|
-
const
|
|
69
|
+
const handleFiltersReset = () => {
|
|
69
70
|
const newRuntimeData = generateRuntimeData(config)
|
|
70
|
-
publishAnalyticsEvent(
|
|
71
|
-
|
|
71
|
+
publishAnalyticsEvent({
|
|
72
|
+
vizType: config.type,
|
|
73
|
+
vizSubType: getVizSubType(config),
|
|
74
|
+
eventType: 'map_filter_reset',
|
|
75
|
+
eventAction: 'click',
|
|
76
|
+
eventLabel: interactionLabel,
|
|
77
|
+
vizTitle: getVizTitle(config)
|
|
78
|
+
})
|
|
72
79
|
dispatch({ type: 'SET_FILTERED_COUNTRY_CODE', payload: '' })
|
|
73
|
-
|
|
80
|
+
dispatch({ type: 'SET_RUNTIME_DATA', payload: newRuntimeData })
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const handleZoomReset = _setRuntimeData => {
|
|
84
|
+
publishAnalyticsEvent({
|
|
85
|
+
vizType: config.type,
|
|
86
|
+
vizSubType: getVizSubType(config),
|
|
87
|
+
eventType: 'map_reset_zoom_level',
|
|
88
|
+
eventAction: 'click',
|
|
89
|
+
eventLabel: interactionLabel,
|
|
90
|
+
vizTitle: getVizTitle(config)
|
|
91
|
+
})
|
|
92
|
+
dispatch({ type: 'SET_POSITION', payload: { coordinates: [0, 30], zoom: 1 } })
|
|
74
93
|
}
|
|
75
94
|
|
|
76
95
|
const handleZoomIn = position => {
|
|
77
96
|
if (position.zoom >= 4) return
|
|
78
|
-
publishAnalyticsEvent(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
'
|
|
83
|
-
|
|
97
|
+
publishAnalyticsEvent({
|
|
98
|
+
vizType: config.type,
|
|
99
|
+
vizSubType: getVizSubType(config),
|
|
100
|
+
eventType: `zoom_in`,
|
|
101
|
+
eventAction: 'click',
|
|
102
|
+
eventLabel: interactionLabel,
|
|
103
|
+
vizTitle: getVizTitle(config),
|
|
104
|
+
specifics: `zoom_level: ${Math.floor(position.zoom * 1.5)}`
|
|
105
|
+
})
|
|
106
|
+
publishAnalyticsEvent({
|
|
107
|
+
vizType: config.type,
|
|
108
|
+
vizSubType: getVizSubType(config),
|
|
109
|
+
eventType: `zoom_in`,
|
|
110
|
+
eventAction: 'click',
|
|
111
|
+
eventLabel: interactionLabel,
|
|
112
|
+
vizTitle: getVizTitle(config),
|
|
113
|
+
specifics: `location: ${position.coordinates}`
|
|
114
|
+
})
|
|
84
115
|
dispatch({ type: 'SET_POSITION', payload: { coordinates: position.coordinates, zoom: position.zoom * 1.5 } })
|
|
85
116
|
}
|
|
86
117
|
|
|
87
118
|
const handleZoomOut = position => {
|
|
88
119
|
if (position.zoom <= 1) return
|
|
89
|
-
publishAnalyticsEvent(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
'
|
|
94
|
-
|
|
120
|
+
publishAnalyticsEvent({
|
|
121
|
+
vizType: config.type,
|
|
122
|
+
vizSubType: getVizSubType(config),
|
|
123
|
+
eventType: `zoom_out`,
|
|
124
|
+
eventAction: 'click',
|
|
125
|
+
eventLabel: interactionLabel,
|
|
126
|
+
vizTitle: getVizTitle(config),
|
|
127
|
+
specifics: `zoom_level: ${Math.floor(position.zoom / 1.5)}`
|
|
128
|
+
})
|
|
129
|
+
publishAnalyticsEvent({
|
|
130
|
+
vizType: config.type,
|
|
131
|
+
vizSubType: getVizSubType(config),
|
|
132
|
+
eventType: `zoom_out`,
|
|
133
|
+
eventAction: 'click',
|
|
134
|
+
eventLabel: interactionLabel,
|
|
135
|
+
vizTitle: getVizTitle(config),
|
|
136
|
+
specifics: `location: ${position.coordinates}`
|
|
137
|
+
})
|
|
95
138
|
dispatch({ type: 'SET_POSITION', payload: { coordinates: position.coordinates, zoom: position.zoom / 1.5 } })
|
|
96
139
|
}
|
|
97
140
|
|
|
98
141
|
const handleMoveEnd = position => {
|
|
99
|
-
publishAnalyticsEvent(
|
|
142
|
+
publishAnalyticsEvent({
|
|
143
|
+
vizType: config.type,
|
|
144
|
+
vizSubType: getVizSubType(config),
|
|
145
|
+
eventType: 'map_panned',
|
|
146
|
+
eventAction: 'drag',
|
|
147
|
+
eventLabel: interactionLabel,
|
|
148
|
+
vizTitle: getVizTitle(config),
|
|
149
|
+
specifics: `zoom: ${position.zoom}`
|
|
150
|
+
})
|
|
151
|
+
publishAnalyticsEvent({
|
|
152
|
+
vizType: config.type,
|
|
153
|
+
vizSubType: getVizSubType(config),
|
|
154
|
+
eventType: 'map_panned',
|
|
155
|
+
eventAction: 'drag',
|
|
156
|
+
eventLabel: interactionLabel,
|
|
157
|
+
vizTitle: getVizTitle(config),
|
|
158
|
+
specifics: `coordinates: ${position.coordinates}`
|
|
159
|
+
})
|
|
100
160
|
dispatch({ type: 'SET_POSITION', payload: position })
|
|
101
161
|
}
|
|
102
162
|
|
|
@@ -105,7 +165,7 @@ const WorldMap = () => {
|
|
|
105
165
|
// If the geo.properties.config value is found in the data use that, otherwise fall back to geo.properties.iso
|
|
106
166
|
const dataHasStateName = config.data.some(d => d[config.columns.geo.name] === geo.properties.state)
|
|
107
167
|
const geoKey =
|
|
108
|
-
geo.properties.state &&
|
|
168
|
+
geo.properties.state && runtimeData[geo.properties.state]
|
|
109
169
|
? geo.properties.state
|
|
110
170
|
: geo.properties.name
|
|
111
171
|
? geo.properties.name
|
|
@@ -116,7 +176,7 @@ const WorldMap = () => {
|
|
|
116
176
|
}
|
|
117
177
|
if (!geoKey) return null
|
|
118
178
|
|
|
119
|
-
let geoData =
|
|
179
|
+
let geoData = runtimeData[geoKey]
|
|
120
180
|
|
|
121
181
|
const geoDisplayName = displayGeoName(supportedCountries[geoKey]?.[0])
|
|
122
182
|
let legendColors
|
|
@@ -169,6 +229,20 @@ const WorldMap = () => {
|
|
|
169
229
|
stroke={geoStrokeColor}
|
|
170
230
|
strokeWidth={strokeWidth}
|
|
171
231
|
onClick={() => geoClickHandler(geoDisplayName, geoData)}
|
|
232
|
+
onMouseEnter={() => {
|
|
233
|
+
// Track hover analytics event if this is a new location
|
|
234
|
+
const locationName = geoDisplayName.replace(/[^a-zA-Z0-9]/g, '_')
|
|
235
|
+
publishAnalyticsEvent({
|
|
236
|
+
vizType: config.type,
|
|
237
|
+
vizSubType: getVizSubType(config),
|
|
238
|
+
eventType: `map_hover`,
|
|
239
|
+
eventAction: 'hover',
|
|
240
|
+
eventLabel: interactionLabel,
|
|
241
|
+
vizTitle: getVizTitle(config),
|
|
242
|
+
location: geoDisplayName,
|
|
243
|
+
specifics: `location: ${locationName?.toLowerCase()}`
|
|
244
|
+
})
|
|
245
|
+
}}
|
|
172
246
|
data-tooltip-id={`tooltip__${tooltipId}`}
|
|
173
247
|
data-tooltip-html={toolTip}
|
|
174
248
|
tabIndex={-1}
|
|
@@ -186,6 +260,20 @@ const WorldMap = () => {
|
|
|
186
260
|
strokeWidth={strokeWidth}
|
|
187
261
|
styles={styles}
|
|
188
262
|
path={path}
|
|
263
|
+
onMouseEnter={() => {
|
|
264
|
+
// Track hover analytics event if this is a new location
|
|
265
|
+
const locationName = geoDisplayName.replace(/[^a-zA-Z0-9]/g, '_')
|
|
266
|
+
publishAnalyticsEvent({
|
|
267
|
+
vizType: config.type,
|
|
268
|
+
vizSubType: getVizSubType(config),
|
|
269
|
+
eventType: `map_hover`,
|
|
270
|
+
eventAction: 'hover',
|
|
271
|
+
eventLabel: interactionLabel,
|
|
272
|
+
vizTitle: getVizTitle(config),
|
|
273
|
+
location: geoDisplayName,
|
|
274
|
+
specifics: `location: ${locationName?.toLowerCase()}`
|
|
275
|
+
})
|
|
276
|
+
}}
|
|
189
277
|
data-tooltip-id={`tooltip__${tooltipId}`}
|
|
190
278
|
data-tooltip-html={toolTip}
|
|
191
279
|
/>
|
|
@@ -207,7 +295,7 @@ const WorldMap = () => {
|
|
|
207
295
|
<ErrorBoundary component='WorldMap'>
|
|
208
296
|
{allowMapZoom ? (
|
|
209
297
|
<svg viewBox={SVG_VIEWBOX} role='img' aria-label={handleMapAriaLabels(config)}>
|
|
210
|
-
<rect height={SVG_HEIGHT} width={SVG_WIDTH} onClick={
|
|
298
|
+
<rect height={SVG_HEIGHT} width={SVG_WIDTH} onClick={handleFiltersReset} fill='white' />
|
|
211
299
|
<ZoomableGroup
|
|
212
300
|
zoom={position.zoom}
|
|
213
301
|
center={position.coordinates}
|
|
@@ -236,7 +324,7 @@ const WorldMap = () => {
|
|
|
236
324
|
</svg>
|
|
237
325
|
)}
|
|
238
326
|
{(type === 'data' || (type === 'world-geocode' && allowMapZoom) || (type === 'bubble' && allowMapZoom)) && (
|
|
239
|
-
<ZoomControls handleZoomIn={handleZoomIn} handleZoomOut={handleZoomOut}
|
|
327
|
+
<ZoomControls handleZoomIn={handleZoomIn} handleZoomOut={handleZoomOut} handleZoomReset={handleZoomReset} />
|
|
240
328
|
)}
|
|
241
329
|
</ErrorBoundary>
|
|
242
330
|
)
|
|
@@ -7,10 +7,10 @@ import './zoomControls.styles.css'
|
|
|
7
7
|
type ZoomControlsProps = {
|
|
8
8
|
handleZoomIn: (coordinates: [Number, Number]) => void
|
|
9
9
|
handleZoomOut: (coordinates: [Number, Number]) => void
|
|
10
|
-
|
|
10
|
+
handleZoomReset: (setRuntimeData: Function) => void
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
const ZoomControls: React.FC<ZoomControlsProps> = ({ handleZoomIn, handleZoomOut,
|
|
13
|
+
const ZoomControls: React.FC<ZoomControlsProps> = ({ handleZoomIn, handleZoomOut, handleZoomReset }) => {
|
|
14
14
|
const { config, setRuntimeData, position } = useContext<MapContext>(ConfigContext)
|
|
15
15
|
if (!config.general.allowMapZoom) return
|
|
16
16
|
return (
|
|
@@ -26,13 +26,10 @@ const ZoomControls: React.FC<ZoomControlsProps> = ({ handleZoomIn, handleZoomOut
|
|
|
26
26
|
<line x1='5' y1='12' x2='19' y2='12' />
|
|
27
27
|
</svg>
|
|
28
28
|
</button>
|
|
29
|
-
{config.general.type === '
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
)}
|
|
34
|
-
{(config.general.type === 'world-geocode' || config.general.geoType === 'single-state') && (
|
|
35
|
-
<button onClick={() => handleReset(setRuntimeData)} className='reset' aria-label='Reset Zoom'>
|
|
29
|
+
{(config.general.type === 'world-geocode' ||
|
|
30
|
+
config.general.geoType === 'single-state' ||
|
|
31
|
+
config.general.type === 'bubble') && (
|
|
32
|
+
<button onClick={() => handleZoomReset(setRuntimeData)} className='reset' aria-label='Reset Zoom'>
|
|
36
33
|
Reset Zoom
|
|
37
34
|
</button>
|
|
38
35
|
)}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React, { createContext, useContext } from 'react'
|
|
2
|
+
|
|
3
|
+
interface LegendMemoContextType {
|
|
4
|
+
legendMemo: React.RefObject<Map<any, any>>
|
|
5
|
+
legendSpecialClassLastMemo: React.RefObject<Map<any, any>>
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const LegendMemoContext = createContext<LegendMemoContextType | null>(null)
|
|
9
|
+
|
|
10
|
+
export const LegendMemoProvider: React.FC<{
|
|
11
|
+
children: React.ReactNode
|
|
12
|
+
legendMemo: React.RefObject<Map<any, any>>
|
|
13
|
+
legendSpecialClassLastMemo: React.RefObject<Map<any, any>>
|
|
14
|
+
}> = ({ children, legendMemo, legendSpecialClassLastMemo }) => {
|
|
15
|
+
return (
|
|
16
|
+
<LegendMemoContext.Provider value={{ legendMemo, legendSpecialClassLastMemo }}>
|
|
17
|
+
{children}
|
|
18
|
+
</LegendMemoContext.Provider>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const useLegendMemoContext = () => {
|
|
23
|
+
const context = useContext(LegendMemoContext)
|
|
24
|
+
if (!context) {
|
|
25
|
+
throw new Error('useLegendMemoContext must be used within a LegendMemoProvider')
|
|
26
|
+
}
|
|
27
|
+
return context
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default LegendMemoContext
|
package/src/context.ts
CHANGED
|
@@ -1,46 +1,7 @@
|
|
|
1
1
|
import { createContext, Dispatch } from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import { MapContext } from './types/MapContext'
|
|
3
3
|
import MapActions from './store/map.actions'
|
|
4
4
|
|
|
5
|
-
type MapContext = {
|
|
6
|
-
container
|
|
7
|
-
setSharedFilter
|
|
8
|
-
customNavigationHandler
|
|
9
|
-
tooltipRef
|
|
10
|
-
containerEl
|
|
11
|
-
applyLegendToRow
|
|
12
|
-
data
|
|
13
|
-
displayGeoName
|
|
14
|
-
filteredCountryCode
|
|
15
|
-
generateColorsArray
|
|
16
|
-
generateRuntimeData
|
|
17
|
-
geoClickHandler
|
|
18
|
-
handleCircleClick: Function
|
|
19
|
-
innerContainerRef
|
|
20
|
-
isDashboard
|
|
21
|
-
isEditor
|
|
22
|
-
mapId: string
|
|
23
|
-
loadConfig
|
|
24
|
-
position
|
|
25
|
-
resetLegendToggles
|
|
26
|
-
runtimeFilters
|
|
27
|
-
runtimeLegend
|
|
28
|
-
setParentConfig
|
|
29
|
-
setRuntimeData
|
|
30
|
-
setRuntimeFilters
|
|
31
|
-
setRuntimeLegend
|
|
32
|
-
setSharedFilterValue
|
|
33
|
-
setConfig: Function
|
|
34
|
-
config: MapConfig
|
|
35
|
-
tooltipId: string
|
|
36
|
-
legendMemo
|
|
37
|
-
legendSpecialClassLastMemo
|
|
38
|
-
translate
|
|
39
|
-
scale
|
|
40
|
-
annotations
|
|
41
|
-
interactionLabel?: string
|
|
42
|
-
}
|
|
43
|
-
|
|
44
5
|
export const MapDispatchContext = createContext<Dispatch<MapActions>>(() => {})
|
|
45
6
|
|
|
46
7
|
const ConfigContext = createContext({} as MapContext)
|
|
@@ -1,135 +1,148 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
territoriesAlwaysShow: false,
|
|
16
|
-
language: 'en',
|
|
17
|
-
geoType: 'single-state',
|
|
18
|
-
geoLabelOverride: '',
|
|
19
|
-
hasRegions: false,
|
|
20
|
-
fullBorder: false,
|
|
21
|
-
type: 'data',
|
|
22
|
-
convertFipsCodes: true,
|
|
23
|
-
palette: {
|
|
24
|
-
isReversed: false
|
|
25
|
-
},
|
|
26
|
-
allowMapZoom: true,
|
|
27
|
-
hideGeoColumnInTooltip: false,
|
|
28
|
-
hidePrimaryColumnInTooltip: false,
|
|
29
|
-
statesPicked: [
|
|
30
|
-
{
|
|
31
|
-
fipsCode: '01',
|
|
32
|
-
stateName: 'Alabama'
|
|
1
|
+
import { USE_V2_MIGRATION } from '@cdc/core/helpers/constants'
|
|
2
|
+
|
|
3
|
+
// Dynamic initial state based on migration flag
|
|
4
|
+
const createInitialState = () => {
|
|
5
|
+
const paletteDefaults = USE_V2_MIGRATION
|
|
6
|
+
? {
|
|
7
|
+
isReversed: true,
|
|
8
|
+
name: 'sequential_bluereverse',
|
|
9
|
+
version: '2.0'
|
|
10
|
+
}
|
|
11
|
+
: {
|
|
12
|
+
isReversed: true,
|
|
13
|
+
name: 'bluegreen',
|
|
14
|
+
version: '1.0'
|
|
33
15
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
annotations: [],
|
|
19
|
+
general: {
|
|
20
|
+
navigationTarget: '_self',
|
|
21
|
+
noDataMessage: 'No State Selected',
|
|
22
|
+
annotationDropdownText: 'Annotations',
|
|
23
|
+
geoBorderColor: 'darkGray',
|
|
24
|
+
headerColor: 'theme-blue',
|
|
25
|
+
title: '',
|
|
26
|
+
showTitle: true,
|
|
27
|
+
showSidebar: true,
|
|
28
|
+
showDownloadMediaButton: false,
|
|
29
|
+
displayAsHex: false,
|
|
30
|
+
displayStateLabels: true,
|
|
31
|
+
territoriesAlwaysShow: false,
|
|
32
|
+
language: 'en',
|
|
33
|
+
geoType: 'single-state',
|
|
34
|
+
geoLabelOverride: '',
|
|
35
|
+
hasRegions: false,
|
|
36
|
+
fullBorder: false,
|
|
37
|
+
type: 'data',
|
|
38
|
+
convertFipsCodes: true,
|
|
39
|
+
palette: paletteDefaults,
|
|
40
|
+
allowMapZoom: true,
|
|
41
|
+
hideGeoColumnInTooltip: false,
|
|
42
|
+
hidePrimaryColumnInTooltip: false,
|
|
43
|
+
statesPicked: []
|
|
44
44
|
},
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
type: 'map',
|
|
46
|
+
columns: {
|
|
47
|
+
geo: {
|
|
48
|
+
name: 'FIPS Codes',
|
|
49
|
+
label: 'Location',
|
|
50
|
+
tooltip: false,
|
|
51
|
+
dataTable: true
|
|
52
|
+
},
|
|
53
|
+
primary: {
|
|
54
|
+
dataTable: true,
|
|
55
|
+
tooltip: true,
|
|
56
|
+
prefix: '',
|
|
57
|
+
suffix: '',
|
|
58
|
+
name: '',
|
|
59
|
+
label: '',
|
|
60
|
+
roundToPlace: 0
|
|
61
|
+
},
|
|
62
|
+
navigate: {
|
|
63
|
+
name: ''
|
|
64
|
+
},
|
|
65
|
+
latitude: { name: '' },
|
|
66
|
+
longitude: { name: '' }
|
|
53
67
|
},
|
|
54
|
-
|
|
55
|
-
|
|
68
|
+
legend: {
|
|
69
|
+
descriptions: {},
|
|
70
|
+
specialClasses: [],
|
|
71
|
+
unified: false,
|
|
72
|
+
singleColumn: false,
|
|
73
|
+
singleRow: false,
|
|
74
|
+
verticalSorted: false,
|
|
75
|
+
showSpecialClassesLast: false,
|
|
76
|
+
dynamicDescription: false,
|
|
77
|
+
type: 'equalnumber',
|
|
78
|
+
numberOfItems: 3,
|
|
79
|
+
position: 'side',
|
|
80
|
+
title: '',
|
|
81
|
+
style: 'circles',
|
|
82
|
+
subStyle: 'linear blocks',
|
|
83
|
+
tickRotation: '',
|
|
84
|
+
singleColumnLegend: false,
|
|
85
|
+
hideBorder: false,
|
|
86
|
+
groupBy: ''
|
|
56
87
|
},
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
geoCodeCircleSize: 8,
|
|
116
|
-
showBubbleZeros: false
|
|
117
|
-
},
|
|
118
|
-
mapPosition: { coordinates: [0, 30], zoom: 1 },
|
|
119
|
-
map: {
|
|
120
|
-
layers: [],
|
|
121
|
-
patterns: []
|
|
122
|
-
},
|
|
123
|
-
hexMap: {
|
|
124
|
-
type: '',
|
|
125
|
-
shapeGroups: [
|
|
126
|
-
{
|
|
127
|
-
legendTitle: '',
|
|
128
|
-
legendDescription: '',
|
|
129
|
-
items: [{ key: '', shape: 'Arrow Up', column: '', operator: '=', value: '' }]
|
|
130
|
-
}
|
|
131
|
-
]
|
|
132
|
-
},
|
|
133
|
-
filterBehavior: 'Filter Change',
|
|
134
|
-
filterIntro: ''
|
|
88
|
+
filters: [],
|
|
89
|
+
data: [],
|
|
90
|
+
table: {
|
|
91
|
+
wrapColumns: false,
|
|
92
|
+
label: 'Data Table',
|
|
93
|
+
expanded: false,
|
|
94
|
+
limitHeight: false,
|
|
95
|
+
height: '',
|
|
96
|
+
caption: '',
|
|
97
|
+
showDownloadUrl: false,
|
|
98
|
+
showDataTableLink: true,
|
|
99
|
+
showDownloadLinkBelow: true,
|
|
100
|
+
showFullGeoNameInCSV: false,
|
|
101
|
+
forceDisplay: true,
|
|
102
|
+
download: false,
|
|
103
|
+
indexLabel: '',
|
|
104
|
+
cellMinWidth: '0',
|
|
105
|
+
collapsible: true
|
|
106
|
+
},
|
|
107
|
+
tooltips: {
|
|
108
|
+
appearanceType: 'hover',
|
|
109
|
+
linkLabel: 'Learn More',
|
|
110
|
+
opacity: 90
|
|
111
|
+
},
|
|
112
|
+
runtime: {
|
|
113
|
+
editorErrorMessage: []
|
|
114
|
+
},
|
|
115
|
+
visual: {
|
|
116
|
+
minBubbleSize: 1,
|
|
117
|
+
maxBubbleSize: 20,
|
|
118
|
+
extraBubbleBorder: false,
|
|
119
|
+
cityStyle: 'circle',
|
|
120
|
+
cityStyleLabel: '',
|
|
121
|
+
showBubbleZeros: false,
|
|
122
|
+
additionalCityStyles: [],
|
|
123
|
+
geoCodeCircleSize: 8,
|
|
124
|
+
showBubbleZeros: false
|
|
125
|
+
},
|
|
126
|
+
mapPosition: { coordinates: [0, 30], zoom: 1 },
|
|
127
|
+
map: {
|
|
128
|
+
layers: [],
|
|
129
|
+
patterns: []
|
|
130
|
+
},
|
|
131
|
+
hexMap: {
|
|
132
|
+
type: '',
|
|
133
|
+
shapeGroups: [
|
|
134
|
+
{
|
|
135
|
+
legendTitle: '',
|
|
136
|
+
legendDescription: '',
|
|
137
|
+
items: [{ key: '', shape: 'Arrow Up', column: '', operator: '=', value: '' }]
|
|
138
|
+
}
|
|
139
|
+
]
|
|
140
|
+
},
|
|
141
|
+
filterBehavior: 'Filter Change',
|
|
142
|
+
filterIntro: '',
|
|
143
|
+
markupVariables: [],
|
|
144
|
+
enableMarkupVariables: false
|
|
145
|
+
}
|
|
135
146
|
}
|
|
147
|
+
|
|
148
|
+
export default createInitialState()
|
|
@@ -512,7 +512,14 @@ export const supportedCountries = {
|
|
|
512
512
|
NIU: ['Niue', 'Niue (New Zealand)'],
|
|
513
513
|
NFK: ['Norfolk Island', 'Norfolk Island (Australia)'],
|
|
514
514
|
MKD: ['North Macedonia', 'Republic of North Macedonia', 'Macedonia'],
|
|
515
|
-
MNP: [
|
|
515
|
+
MNP: [
|
|
516
|
+
'Northern Mariana Islands',
|
|
517
|
+
'N. Mariana Is.',
|
|
518
|
+
'Northern Mariana Islands (U.S.)',
|
|
519
|
+
'Commonwealth of Northern Mariana Islands',
|
|
520
|
+
'Commonwealth of the Northern Mariana Islands',
|
|
521
|
+
'Commonwealth of the Northern Mariana Islands (CNMI)'
|
|
522
|
+
],
|
|
516
523
|
NOR: ['Norway'],
|
|
517
524
|
OMN: ['Oman'],
|
|
518
525
|
PAK: ['Pakistan'],
|
|
@@ -643,7 +650,15 @@ export const supportedTerritories = {
|
|
|
643
650
|
'US-GU': ['GUAM', 'GU'],
|
|
644
651
|
'US-PR': ['PUERTO RICO', 'PR'],
|
|
645
652
|
'US-VI': ['U.S. VIRGIN ISLANDS', 'VI', 'US VIRGIN ISLANDS', 'VIRGIN ISLANDS'],
|
|
646
|
-
'US-MP': [
|
|
653
|
+
'US-MP': [
|
|
654
|
+
'NORTHERN MARIANA ISLANDS',
|
|
655
|
+
'MP',
|
|
656
|
+
'CNMI',
|
|
657
|
+
'NORTHERN MARIANAS',
|
|
658
|
+
'COMMONWEALTH OF NORTHERN MARIANA ISLANDS',
|
|
659
|
+
'COMMONWEALTH OF THE NORTHERN MARIANA ISLANDS',
|
|
660
|
+
'COMMONWEALTH OF THE NORTHERN MARIANA ISLANDS (CNMI)'
|
|
661
|
+
],
|
|
647
662
|
'US-FM': ['MICRONESIA', 'FM', 'Federated States of Micronesia'], // Note: Key is not an official ISO code
|
|
648
663
|
'US-PW': ['PALAU', 'PW'], // Note: Key is not an official ISO code
|
|
649
664
|
'US-MH': ['MARSHALL ISLANDS', 'MH', 'RMI'] // Note: Key is not an official ISO code
|