@cdc/map 4.23.11 → 4.24.2
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 +52413 -46767
- package/examples/default-patterns.json +581 -0
- package/examples/default-usa.json +159 -57
- package/examples/test.json +0 -9614
- package/examples/zika.json +1194 -0
- package/index.html +17 -6
- package/package.json +3 -3
- package/src/CdcMap.tsx +39 -31
- package/src/components/CityList.jsx +34 -23
- package/src/components/{EditorPanel.jsx → EditorPanel/components/EditorPanel.tsx} +31 -64
- package/src/components/{HexShapeSettings.jsx → EditorPanel/components/HexShapeSettings.tsx} +2 -51
- package/src/components/EditorPanel/components/Inputs.tsx +59 -0
- package/src/components/EditorPanel/components/Panel.PatternSettings.tsx +140 -0
- package/src/components/EditorPanel/components/Panels.tsx +7 -0
- package/src/components/EditorPanel/index.tsx +3 -0
- package/src/components/Geo.jsx +4 -2
- package/src/components/Legend/components/Legend.tsx +183 -0
- package/src/components/Legend/components/LegendItem.Hex.tsx +49 -0
- package/src/components/Legend/components/index.scss +235 -0
- package/src/components/Legend/index.tsx +3 -0
- package/src/components/UsaMap/components/Territory/Territory.Hexagon.tsx +129 -0
- package/src/components/UsaMap/components/Territory/Territory.Rectangle.tsx +66 -0
- package/src/components/UsaMap/components/Territory/index.tsx +9 -0
- package/src/components/{CountyMap.jsx → UsaMap/components/UsaMap.County.tsx} +9 -9
- package/src/components/{UsaRegionMap.jsx → UsaMap/components/UsaMap.Region.tsx} +1 -3
- package/src/components/{SingleStateMap.jsx → UsaMap/components/UsaMap.SingleState.tsx} +8 -10
- package/src/components/{UsaMap.jsx → UsaMap/components/UsaMap.State.tsx} +55 -127
- package/src/components/UsaMap/index.tsx +13 -0
- package/src/components/{WorldMap.jsx → WorldMap/components/WorldMap.jsx} +20 -14
- package/src/components/WorldMap/data/world-topo-guiana-update.json +1 -0
- package/src/components/WorldMap/data/world-topo-old.json +1 -0
- package/src/components/WorldMap/data/world-topo-recent.json +39194 -0
- package/src/components/WorldMap/data/world-topo.json +1 -0
- package/src/components/WorldMap/index.tsx +3 -0
- package/src/context.ts +2 -1
- package/src/data/initial-state.js +5 -3
- package/src/data/supported-geos.js +21 -1
- package/src/hooks/useTooltip.ts +4 -4
- package/src/scss/editor-panel.scss +2 -3
- package/src/scss/main.scss +11 -1
- package/src/scss/map.scss +22 -12
- package/src/types/MapConfig.ts +149 -0
- package/src/types/MapContext.ts +45 -0
- package/src/types/runtimeLegend.ts +1 -0
- package/examples/world-geocode-data.json +0 -18
- package/examples/world-geocode.json +0 -108
- package/src/components/Sidebar.tsx +0 -142
- package/src/data/abbreviations.js +0 -57
- package/src/data/feature-test.json +0 -73
- package/src/data/newtest.json +0 -1
- package/src/data/state-abbreviations.js +0 -60
- package/src/data/supported-cities.csv +0 -165
- package/src/data/test.json +0 -1
- package/src/data/world-topo.json +0 -1
- package/src/scss/sidebar.scss +0 -230
- /package/src/{data → components/UsaMap/data}/cb_2019_us_county_20m.json +0 -0
- /package/src/{data → components/UsaMap/data}/us-hex-topo.json +0 -0
- /package/src/{data → components/UsaMap/data}/us-regions-topo-2.json +0 -0
- /package/src/{data → components/UsaMap/data}/us-regions-topo.json +0 -0
- /package/src/{data → components/UsaMap/data}/us-topo.json +0 -0
|
@@ -0,0 +1,149 @@
|
|
|
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
|
+
|
|
5
|
+
export type MapVisualSettings = {
|
|
6
|
+
/** minBubbleSize - Minimum Circle Size when the map has a type of bubble */
|
|
7
|
+
minBubbleSize: number
|
|
8
|
+
/** maxBubbleSize - Maximum Circle Size when the map has a type of bubble */
|
|
9
|
+
maxBubbleSize: number
|
|
10
|
+
/** extraBubbleBorder - Bubble Maps > adds a white circle around the bubble to show contrast on other bubbles */
|
|
11
|
+
extraBubbleBorder: boolean
|
|
12
|
+
/** cityStyle - visual indicator of cities on state maps */
|
|
13
|
+
cityStyle: 'circle' | 'pin'
|
|
14
|
+
/** geoCodeCircleSize - controls the size of the city style option (circle or pin) */
|
|
15
|
+
geoCodeCircleSize: number
|
|
16
|
+
/** showBubbleZeros - shows circles on maps when the data is provided even if its a zero value */
|
|
17
|
+
showBubbleZeros: boolean
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
type PatternSelection = {
|
|
21
|
+
// dropdown selection for getting the column used on a pattern
|
|
22
|
+
dataKey: string
|
|
23
|
+
// text field input to match values found in the column
|
|
24
|
+
dataValue: string
|
|
25
|
+
// style of pattern to use
|
|
26
|
+
pattern: 'lines' | 'circles' | 'waves'
|
|
27
|
+
// optional legend update
|
|
28
|
+
label: string
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export type GeoColumnProperties = Pick<EditorColumnProperties, 'name' | 'label' | 'tooltip' | 'dataTable'>
|
|
32
|
+
export type LatitudeColumnProperties = Pick<EditorColumnProperties, 'name'>
|
|
33
|
+
export type LongitudeColumnProperties = Pick<EditorColumnProperties, 'name'>
|
|
34
|
+
export type NavigateColumnProperties = Pick<EditorColumnProperties, 'name'>
|
|
35
|
+
export type PrimaryColumnProperties = Pick<EditorColumnProperties, 'dataTable' | 'label' | 'name' | 'prefix' | 'suffix' | 'tooltip'>
|
|
36
|
+
|
|
37
|
+
export type LegendShapeItem = {
|
|
38
|
+
column: string
|
|
39
|
+
key: string
|
|
40
|
+
operator: string
|
|
41
|
+
shape: string
|
|
42
|
+
value: string
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export type LegendGrouping = {
|
|
46
|
+
legendTitle: string
|
|
47
|
+
legendDescription: string
|
|
48
|
+
items: LegendShapeItem[]
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export type HexMapSettings = {
|
|
52
|
+
type: 'shapes' | 'standard'
|
|
53
|
+
shapeGroups: LegendGrouping[]
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export type Coordinate = [number, number]
|
|
57
|
+
|
|
58
|
+
export type MapConfig = Visualization & {
|
|
59
|
+
color: string // map color palette
|
|
60
|
+
customColors: string[] // custom color palette
|
|
61
|
+
columns: {
|
|
62
|
+
geo: GeoColumnProperties
|
|
63
|
+
primary: PrimaryColumnProperties
|
|
64
|
+
navigate: NavigateColumnProperties
|
|
65
|
+
latitude: LatitudeColumnProperties
|
|
66
|
+
longitude: LongitudeColumnProperties
|
|
67
|
+
categorical: { name }
|
|
68
|
+
}
|
|
69
|
+
dataUrl: string
|
|
70
|
+
runtimeDataUrl: string
|
|
71
|
+
filters: any[]
|
|
72
|
+
general: {
|
|
73
|
+
allowMapZoom: boolean
|
|
74
|
+
convertFipsCodes: boolean
|
|
75
|
+
displayAsHex: boolean
|
|
76
|
+
displayStateLabels: boolean
|
|
77
|
+
fullBorder: boolean
|
|
78
|
+
geoBorderColor: string
|
|
79
|
+
geoLabelOverride: string
|
|
80
|
+
geoType: 'us' | 'us-county' | 'world'
|
|
81
|
+
hasRegions: boolean
|
|
82
|
+
headerColor: ComponentThemes
|
|
83
|
+
hideGeoColumnInTooltip: boolean
|
|
84
|
+
hidePrimaryColumnInTooltip: boolean
|
|
85
|
+
language: string
|
|
86
|
+
palette: {
|
|
87
|
+
isReversed: boolean
|
|
88
|
+
}
|
|
89
|
+
showDownloadButton: boolean
|
|
90
|
+
showDownloadMediaButton: boolean
|
|
91
|
+
showSidebar: boolean
|
|
92
|
+
showTitle: boolean
|
|
93
|
+
statePicked: {
|
|
94
|
+
fipsCode: string
|
|
95
|
+
stateName: string
|
|
96
|
+
}
|
|
97
|
+
territoriesAlwaysShow: boolean
|
|
98
|
+
territoriesLabel: string
|
|
99
|
+
title: string
|
|
100
|
+
type: 'data' | 'navigation' | 'us-geocode' | 'world-geocode' | 'bubble'
|
|
101
|
+
}
|
|
102
|
+
legend: {
|
|
103
|
+
additionalCategories
|
|
104
|
+
categoryValuesOrder
|
|
105
|
+
description
|
|
106
|
+
descriptions: {}
|
|
107
|
+
specialClasses: { key; label; value }[]
|
|
108
|
+
unified: boolean
|
|
109
|
+
separateZero: boolean
|
|
110
|
+
singleColumn: boolean
|
|
111
|
+
singleRow: boolean
|
|
112
|
+
verticalSorted: boolean
|
|
113
|
+
showSpecialClassesLast: boolean
|
|
114
|
+
dynamicDescription: boolean
|
|
115
|
+
type: string
|
|
116
|
+
numberOfItems: number
|
|
117
|
+
position: string
|
|
118
|
+
title: string
|
|
119
|
+
}
|
|
120
|
+
table: {
|
|
121
|
+
label: string
|
|
122
|
+
expanded: boolean
|
|
123
|
+
limitHeight: boolean
|
|
124
|
+
height: string
|
|
125
|
+
caption: string
|
|
126
|
+
showDownloadUrl: boolean
|
|
127
|
+
showFullGeoNameInCSV: boolean
|
|
128
|
+
forceDisplay: boolean
|
|
129
|
+
download: boolean
|
|
130
|
+
indexLabel: string
|
|
131
|
+
}
|
|
132
|
+
tooltips: {
|
|
133
|
+
appearanceType: 'hover' | 'click'
|
|
134
|
+
linkLabel: string
|
|
135
|
+
capitalizeLabels: true
|
|
136
|
+
opacity: number
|
|
137
|
+
}
|
|
138
|
+
runtime: {
|
|
139
|
+
editorErrorMessage: string[]
|
|
140
|
+
}
|
|
141
|
+
mapPosition: { coordinates: Coordinate; zoom: number }
|
|
142
|
+
map: {
|
|
143
|
+
layers: { url; namespace; fill; fillOpacity; stroke; strokeWidth; tooltip }[]
|
|
144
|
+
patterns: PatternSelection[]
|
|
145
|
+
}
|
|
146
|
+
hexMap: HexMapSettings
|
|
147
|
+
filterBehavior: string
|
|
148
|
+
visual: MapVisualSettings
|
|
149
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type MapConfig } from './MapConfig'
|
|
2
|
+
|
|
3
|
+
export type MapContext = {
|
|
4
|
+
applyLegendToRow
|
|
5
|
+
applyTooltipsToGeo
|
|
6
|
+
closeModal
|
|
7
|
+
columnsInData
|
|
8
|
+
currentViewport
|
|
9
|
+
data
|
|
10
|
+
displayDataAsText
|
|
11
|
+
displayGeoName
|
|
12
|
+
filteredCountryCode
|
|
13
|
+
generateColorsArray
|
|
14
|
+
generateRuntimeData
|
|
15
|
+
geoClickHandler
|
|
16
|
+
handleCircleClick: Function
|
|
17
|
+
handleMapAriaLabels
|
|
18
|
+
hasZoom
|
|
19
|
+
innerContainerRef
|
|
20
|
+
isDashboard
|
|
21
|
+
isDebug
|
|
22
|
+
isEditor
|
|
23
|
+
loadConfig
|
|
24
|
+
navigationHandler
|
|
25
|
+
position
|
|
26
|
+
resetLegendToggles
|
|
27
|
+
runtimeFilters
|
|
28
|
+
runtimeLegend
|
|
29
|
+
setAccessibleStatus
|
|
30
|
+
setFilteredCountryCode
|
|
31
|
+
setParentConfig
|
|
32
|
+
setPosition
|
|
33
|
+
setRuntimeData
|
|
34
|
+
setRuntimeFilters
|
|
35
|
+
setRuntimeLegend
|
|
36
|
+
setSharedFilterValue
|
|
37
|
+
setState
|
|
38
|
+
state: MapConfig
|
|
39
|
+
supportedCities
|
|
40
|
+
supportedCounties
|
|
41
|
+
supportedCountries
|
|
42
|
+
supportedTerritories
|
|
43
|
+
titleCase
|
|
44
|
+
viewport
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type RuntimeLegend = { disabled; bin; color; special }[]
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"Country": "Argentina",
|
|
4
|
-
"Cases": "100",
|
|
5
|
-
"Category": "Has not historically reported monkeypox",
|
|
6
|
-
"AsOf": "11 Jul 2022 5:00 PM EDT",
|
|
7
|
-
"longitude": "-63.6",
|
|
8
|
-
"latitude": "-38.4"
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
"Country": "New York City",
|
|
12
|
-
"Cases": "10",
|
|
13
|
-
"Category": "Has not historically reported monkeypox",
|
|
14
|
-
"AsOf": "11 Jul 2022 5:00 PM EDT",
|
|
15
|
-
"longitude": "-74.006",
|
|
16
|
-
"latitude": "40.712"
|
|
17
|
-
}
|
|
18
|
-
]
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"general": {
|
|
3
|
-
"title": "Default World Map",
|
|
4
|
-
"subtext": "",
|
|
5
|
-
"type": "world-geocode",
|
|
6
|
-
"geoType": "world",
|
|
7
|
-
"headerColor": "theme-blue",
|
|
8
|
-
"geoBorderColor": "darkGray",
|
|
9
|
-
"showSidebar": true,
|
|
10
|
-
"showTitle": true,
|
|
11
|
-
"showDownloadButton": true,
|
|
12
|
-
"expandDataTable": true,
|
|
13
|
-
"equalNumberOptIn": true,
|
|
14
|
-
"showDownloadMediaButton": false,
|
|
15
|
-
"displayAsHex": false,
|
|
16
|
-
"displayStateLabels": false,
|
|
17
|
-
"territoriesLabel": "Territories",
|
|
18
|
-
"language": "en",
|
|
19
|
-
"geoLabelOverride": "",
|
|
20
|
-
"hasRegions": false,
|
|
21
|
-
"fullBorder": false,
|
|
22
|
-
"palette": {
|
|
23
|
-
"isReversed": false
|
|
24
|
-
},
|
|
25
|
-
"allowMapZoom": true,
|
|
26
|
-
"hideGeoColumnInTooltip": false,
|
|
27
|
-
"hidePrimaryColumnInTooltip": false,
|
|
28
|
-
"statePicked": {
|
|
29
|
-
"fipsCode": "01",
|
|
30
|
-
"stateName": "Alabama"
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
"type": "map",
|
|
34
|
-
"color": "pinkpurple",
|
|
35
|
-
"columns": {
|
|
36
|
-
"geo": {
|
|
37
|
-
"name": "Country",
|
|
38
|
-
"label": "Location",
|
|
39
|
-
"tooltip": false,
|
|
40
|
-
"dataTable": true
|
|
41
|
-
},
|
|
42
|
-
"primary": {
|
|
43
|
-
"name": "Cases",
|
|
44
|
-
"label": "Data Label",
|
|
45
|
-
"prefix": "",
|
|
46
|
-
"suffix": "%",
|
|
47
|
-
"dataTable": true,
|
|
48
|
-
"tooltip": true
|
|
49
|
-
},
|
|
50
|
-
"navigate": {
|
|
51
|
-
"name": "Link",
|
|
52
|
-
"tooltip": false,
|
|
53
|
-
"dataTable": false
|
|
54
|
-
},
|
|
55
|
-
"latitude": {
|
|
56
|
-
"name": "latitude"
|
|
57
|
-
},
|
|
58
|
-
"longitude": {
|
|
59
|
-
"name": "longitude"
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
"legend": {
|
|
63
|
-
"numberOfItems": 3,
|
|
64
|
-
"position": "side",
|
|
65
|
-
"title": "Legend Title",
|
|
66
|
-
"description": "Legend Text",
|
|
67
|
-
"type": "equalnumber",
|
|
68
|
-
"specialClasses": [],
|
|
69
|
-
"separateZero": true,
|
|
70
|
-
"descriptions": {},
|
|
71
|
-
"unified": false,
|
|
72
|
-
"singleColumn": false,
|
|
73
|
-
"singleRow": false,
|
|
74
|
-
"dynamicDescription": false
|
|
75
|
-
},
|
|
76
|
-
"filters": [],
|
|
77
|
-
"dataTable": {
|
|
78
|
-
"title": "Data Table",
|
|
79
|
-
"forceDisplay": true
|
|
80
|
-
},
|
|
81
|
-
"table": {
|
|
82
|
-
"showDownloadUrl": false
|
|
83
|
-
},
|
|
84
|
-
"tooltips": {
|
|
85
|
-
"appearanceType": "hover",
|
|
86
|
-
"linkLabel": "Learn More",
|
|
87
|
-
"capitalizeLabels": true
|
|
88
|
-
},
|
|
89
|
-
"runtime": {
|
|
90
|
-
"editorErrorMessage": []
|
|
91
|
-
},
|
|
92
|
-
"visual": {
|
|
93
|
-
"minBubbleSize": 1,
|
|
94
|
-
"maxBubbleSize": 20,
|
|
95
|
-
"extraBubbleBorder": false,
|
|
96
|
-
"cityStyle": "circle",
|
|
97
|
-
"geoCodeCircleSize": 8,
|
|
98
|
-
"showBubbleZeros": false
|
|
99
|
-
},
|
|
100
|
-
"mapPosition": {
|
|
101
|
-
"coordinates": [
|
|
102
|
-
0,
|
|
103
|
-
30
|
|
104
|
-
],
|
|
105
|
-
"zoom": 1
|
|
106
|
-
},
|
|
107
|
-
"dataUrl": "http://localhost:8080/examples/world-geocode-data.json"
|
|
108
|
-
}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
//TODO: Move legends to core
|
|
2
|
-
import { useContext } from 'react'
|
|
3
|
-
import parse from 'html-react-parser'
|
|
4
|
-
|
|
5
|
-
import ErrorBoundary from '@cdc/core/components/ErrorBoundary'
|
|
6
|
-
import LegendCircle from '@cdc/core/components/LegendCircle'
|
|
7
|
-
import HexSetting from './HexShapeSettings'
|
|
8
|
-
import useDataVizClasses from '@cdc/core/helpers/useDataVizClasses'
|
|
9
|
-
import ConfigContext from '../context'
|
|
10
|
-
|
|
11
|
-
const Sidebar = () => {
|
|
12
|
-
// prettier-ignore
|
|
13
|
-
const {
|
|
14
|
-
displayDataAsText,
|
|
15
|
-
resetLegendToggles,
|
|
16
|
-
runtimeFilters,
|
|
17
|
-
runtimeLegend,
|
|
18
|
-
setAccessibleStatus,
|
|
19
|
-
setRuntimeLegend,
|
|
20
|
-
state,
|
|
21
|
-
viewport,
|
|
22
|
-
} = useContext(ConfigContext)
|
|
23
|
-
|
|
24
|
-
const { legend } = state
|
|
25
|
-
|
|
26
|
-
// Toggles if a legend is active and being applied to the map and data table.
|
|
27
|
-
const toggleLegendActive = (i, legendLabel) => {
|
|
28
|
-
const newValue = !runtimeLegend[i].disabled
|
|
29
|
-
|
|
30
|
-
runtimeLegend[i].disabled = newValue // Toggle!
|
|
31
|
-
|
|
32
|
-
let newLegend = [...runtimeLegend]
|
|
33
|
-
|
|
34
|
-
newLegend[i].disabled = newValue
|
|
35
|
-
|
|
36
|
-
const disabledAmt = runtimeLegend.disabledAmt ?? 0
|
|
37
|
-
|
|
38
|
-
newLegend['disabledAmt'] = newValue ? disabledAmt + 1 : disabledAmt - 1
|
|
39
|
-
|
|
40
|
-
setRuntimeLegend(newLegend)
|
|
41
|
-
|
|
42
|
-
setAccessibleStatus(`Disabled legend item ${legendLabel ?? ''}. Please reference the data table to see updated values.`)
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const legendList = runtimeLegend.map((entry, idx) => {
|
|
46
|
-
const entryMax = displayDataAsText(entry.max, 'primary')
|
|
47
|
-
|
|
48
|
-
const entryMin = displayDataAsText(entry.min, 'primary')
|
|
49
|
-
|
|
50
|
-
let formattedText = `${entryMin}${entryMax !== entryMin ? ` - ${entryMax}` : ''}`
|
|
51
|
-
|
|
52
|
-
// If interval, add some formatting
|
|
53
|
-
if (legend.type === 'equalinterval' && idx !== runtimeLegend.length - 1) {
|
|
54
|
-
formattedText = `${entryMin} - < ${entryMax}`
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const { disabled } = entry
|
|
58
|
-
|
|
59
|
-
if (legend.type === 'category') {
|
|
60
|
-
formattedText = displayDataAsText(entry.value, 'primary')
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (entry.max === 0 && entry.min === 0) {
|
|
64
|
-
formattedText = '0'
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
let legendLabel = formattedText
|
|
68
|
-
|
|
69
|
-
if (entry.hasOwnProperty('special')) {
|
|
70
|
-
legendLabel = entry.label || entry.value
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const handleListItemClass = () => {
|
|
74
|
-
let classes = ['legend-container__li']
|
|
75
|
-
if (disabled) classes.push('legend-container__li--disabled')
|
|
76
|
-
if (entry.hasOwnProperty('special')) classes.push('legend-container__li--special-class')
|
|
77
|
-
return classes
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return (
|
|
81
|
-
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-noninteractive-element-interactions
|
|
82
|
-
<li
|
|
83
|
-
className={handleListItemClass().join(' ')}
|
|
84
|
-
key={idx}
|
|
85
|
-
title={`Legend item ${legendLabel} - Click to disable`}
|
|
86
|
-
onClick={() => {
|
|
87
|
-
toggleLegendActive(idx, legendLabel)
|
|
88
|
-
}}
|
|
89
|
-
>
|
|
90
|
-
<LegendCircle fill={entry.color} /> <span className='label'>{legendLabel}</span>
|
|
91
|
-
</li>
|
|
92
|
-
)
|
|
93
|
-
})
|
|
94
|
-
|
|
95
|
-
const { legendClasses } = useDataVizClasses(state, viewport)
|
|
96
|
-
|
|
97
|
-
const handleReset = e => {
|
|
98
|
-
e.preventDefault()
|
|
99
|
-
resetLegendToggles()
|
|
100
|
-
setAccessibleStatus('Legend has been reset, please reference the data table to see updated values.')
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
return (
|
|
104
|
-
<ErrorBoundary component='Sidebar'>
|
|
105
|
-
<div className='legends'>
|
|
106
|
-
<aside id='legend' className={legendClasses.aside.join(' ') || ''} role='region' aria-label='Legend'>
|
|
107
|
-
<section className={legendClasses.section.join(' ') || ''} aria-label='Map Legend'>
|
|
108
|
-
{runtimeLegend.disabledAmt > 0 && (
|
|
109
|
-
<button onClick={handleReset} className={legendClasses.resetButton.join(' ') || ''}>
|
|
110
|
-
Clear
|
|
111
|
-
</button>
|
|
112
|
-
)}
|
|
113
|
-
{legend.title && <span className={legendClasses.title.join(' ') || ''}>{parse(legend.title)}</span>}
|
|
114
|
-
{legend.dynamicDescription === false && legend.description && <p className={legendClasses.description.join(' ') || ''}>{parse(legend.description)}</p>}
|
|
115
|
-
{legend.dynamicDescription === true &&
|
|
116
|
-
runtimeFilters.map((filter, idx) => {
|
|
117
|
-
const lookupStr = `${idx},${filter.values.indexOf(String(filter.active))}`
|
|
118
|
-
|
|
119
|
-
// Do we have a custom description for this?
|
|
120
|
-
const desc = legend.descriptions[lookupStr] || ''
|
|
121
|
-
|
|
122
|
-
if (desc.length > 0) {
|
|
123
|
-
return (
|
|
124
|
-
<p key={`dynamic-description-${lookupStr}`} className={`dynamic-legend-description-${lookupStr}`}>
|
|
125
|
-
{desc}
|
|
126
|
-
</p>
|
|
127
|
-
)
|
|
128
|
-
}
|
|
129
|
-
return true
|
|
130
|
-
})}
|
|
131
|
-
<ul className={legendClasses.ul.join(' ') || ''} aria-label='Legend items'>
|
|
132
|
-
{legendList}
|
|
133
|
-
</ul>
|
|
134
|
-
</section>
|
|
135
|
-
</aside>
|
|
136
|
-
{state.hexMap.shapeGroups?.length > 0 && state.hexMap.type === 'shapes' && state.general.displayAsHex && <HexSetting.Legend state={state} runtimeLegend={runtimeLegend} viewport={viewport} />}
|
|
137
|
-
</div>
|
|
138
|
-
</ErrorBoundary>
|
|
139
|
-
)
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
export default Sidebar
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
export const abbrs = {
|
|
2
|
-
Alabama: 'AL',
|
|
3
|
-
Alaska: 'AK',
|
|
4
|
-
Arizona: 'AZ',
|
|
5
|
-
Arkansas: 'AR',
|
|
6
|
-
California: 'CA',
|
|
7
|
-
Colorado: 'CO',
|
|
8
|
-
Connecticut: 'CT',
|
|
9
|
-
Delaware: 'DE',
|
|
10
|
-
Florida: 'FL',
|
|
11
|
-
Georgia: 'GA',
|
|
12
|
-
Hawaii: 'HI',
|
|
13
|
-
Idaho: 'ID',
|
|
14
|
-
Illinois: 'IL',
|
|
15
|
-
Indiana: 'IN',
|
|
16
|
-
Iowa: 'IA',
|
|
17
|
-
Kansas: 'KS',
|
|
18
|
-
Kentucky: 'KY',
|
|
19
|
-
Louisiana: 'LA',
|
|
20
|
-
Maine: 'ME',
|
|
21
|
-
Maryland: 'MD',
|
|
22
|
-
Massachusetts: 'MA',
|
|
23
|
-
Michigan: 'MI',
|
|
24
|
-
Minnesota: 'MN',
|
|
25
|
-
Mississippi: 'MS',
|
|
26
|
-
Missouri: 'MO',
|
|
27
|
-
Montana: 'MT',
|
|
28
|
-
Nebraska: 'NE',
|
|
29
|
-
Nevada: 'NV',
|
|
30
|
-
'New Hampshire': 'NH',
|
|
31
|
-
'New Jersey': 'NJ',
|
|
32
|
-
'New Mexico': 'NM',
|
|
33
|
-
'New York': 'NY',
|
|
34
|
-
'North Carolina': 'NC',
|
|
35
|
-
'North Dakota': 'ND',
|
|
36
|
-
Ohio: 'OH',
|
|
37
|
-
Oklahoma: 'OK',
|
|
38
|
-
Oregon: 'OR',
|
|
39
|
-
Pennsylvania: 'PA',
|
|
40
|
-
'Rhode Island': 'RI',
|
|
41
|
-
'South Carolina': 'SC',
|
|
42
|
-
'South Dakota': 'SD',
|
|
43
|
-
Tennessee: 'TN',
|
|
44
|
-
Texas: 'TX',
|
|
45
|
-
Utah: 'UT',
|
|
46
|
-
Vermont: 'VT',
|
|
47
|
-
Virginia: 'VA',
|
|
48
|
-
Washington: 'WA',
|
|
49
|
-
'West Virginia': 'WV',
|
|
50
|
-
Wisconsin: 'WI',
|
|
51
|
-
Wyoming: 'WY',
|
|
52
|
-
'District of Columbia': 'DC',
|
|
53
|
-
Guam: 'GU',
|
|
54
|
-
'Virgin Islands': 'VI',
|
|
55
|
-
'Puerto Rico': 'PR',
|
|
56
|
-
'American Samoa': 'AS',
|
|
57
|
-
};
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"type": "Topology",
|
|
3
|
-
"arcs": [
|
|
4
|
-
[
|
|
5
|
-
[
|
|
6
|
-
33,
|
|
7
|
-
100
|
|
8
|
-
],
|
|
9
|
-
[
|
|
10
|
-
-6,
|
|
11
|
-
9
|
|
12
|
-
],
|
|
13
|
-
[
|
|
14
|
-
30,
|
|
15
|
-
66
|
|
16
|
-
],
|
|
17
|
-
[
|
|
18
|
-
102,
|
|
19
|
-
-42
|
|
20
|
-
],
|
|
21
|
-
[
|
|
22
|
-
-118,
|
|
23
|
-
-133
|
|
24
|
-
],
|
|
25
|
-
[
|
|
26
|
-
11,
|
|
27
|
-
39
|
|
28
|
-
],
|
|
29
|
-
[
|
|
30
|
-
-52,
|
|
31
|
-
39
|
|
32
|
-
],
|
|
33
|
-
[
|
|
34
|
-
33,
|
|
35
|
-
22
|
|
36
|
-
]
|
|
37
|
-
]
|
|
38
|
-
],
|
|
39
|
-
"transform": {
|
|
40
|
-
"scale": [
|
|
41
|
-
0.04505085471698112,
|
|
42
|
-
0.04496205714285712
|
|
43
|
-
],
|
|
44
|
-
"translate": [
|
|
45
|
-
-116.2012448,
|
|
46
|
-
33.3764121
|
|
47
|
-
]
|
|
48
|
-
},
|
|
49
|
-
"objects": {
|
|
50
|
-
"Untitled layer": {
|
|
51
|
-
"type": "GeometryCollection",
|
|
52
|
-
"geometries": [
|
|
53
|
-
{
|
|
54
|
-
"arcs": [
|
|
55
|
-
[
|
|
56
|
-
0
|
|
57
|
-
]
|
|
58
|
-
],
|
|
59
|
-
"type": "Polygon",
|
|
60
|
-
"properties": {
|
|
61
|
-
"name": "new",
|
|
62
|
-
"styleUrl": "#poly-000000-1200-77-nodesc",
|
|
63
|
-
"fill-opacity": 0.30196078431372547,
|
|
64
|
-
"fill": "#000000",
|
|
65
|
-
"stroke-opacity": 1,
|
|
66
|
-
"stroke": "#000000",
|
|
67
|
-
"stroke-width": 1.2
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
]
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|