@cdc/map 4.25.8 → 4.25.11

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.
Files changed (137) hide show
  1. package/.claude/agents/typescript-organizer.md +118 -0
  2. package/.claude/settings.local.json +30 -0
  3. package/dist/{cdcmap-fce76882.es.js → cdcmap-BnB1QM5d.es.js} +6 -13
  4. package/dist/{cdcmap-c55ac1ea.es.js → cdcmap-D6CG2-Hb.es.js} +5 -12
  5. package/dist/{cdcmap-31a33da1.es.js → cdcmap-MXgURbdZ.es.js} +6 -13
  6. package/dist/{cdcmap-1a1724a1.es.js → cdcmap-dgT_1dIT.es.js} +136 -151
  7. package/dist/cdcmap.js +56991 -53706
  8. package/examples/example-city-state.json +9 -1
  9. package/examples/multi-country-centering.json +45 -0
  10. package/examples/private/c.json +290 -0
  11. package/examples/private/canvas-city-hover.json +787 -0
  12. package/examples/private/colors-2.json +221 -0
  13. package/examples/private/colors.json +221 -0
  14. package/examples/private/d.json +345 -0
  15. package/examples/private/g.json +1 -0
  16. package/examples/private/h.json +105911 -0
  17. package/examples/private/measles-data.json +378 -0
  18. package/examples/private/measles.json +211 -0
  19. package/examples/private/north-dakota.json +1132 -0
  20. package/examples/private/state-with-pattern.json +883 -0
  21. package/index.html +36 -34
  22. package/package.json +26 -5
  23. package/src/CdcMap.tsx +23 -8
  24. package/src/CdcMapComponent.tsx +238 -308
  25. package/src/_stories/CdcMap.ColumnWrap.stories.tsx +31 -0
  26. package/src/_stories/CdcMap.DistrictOfColumbia.stories.tsx +320 -0
  27. package/src/_stories/CdcMap.Editor.stories.tsx +3371 -0
  28. package/src/_stories/CdcMap.Filters.stories.tsx +2 -2
  29. package/src/_stories/CdcMap.Legend.Gradient.stories.tsx +3 -3
  30. package/src/_stories/CdcMap.Legend.stories.tsx +7 -4
  31. package/src/_stories/CdcMap.Patterns.stories.tsx +2 -2
  32. package/src/_stories/CdcMap.SmallMultiples.stories.tsx +35 -0
  33. package/src/_stories/CdcMap.Table.stories.tsx +2 -2
  34. package/src/_stories/CdcMap.stories.tsx +37 -9
  35. package/src/_stories/GoogleMap.stories.tsx +2 -2
  36. package/src/_stories/UsaMap.NoData.stories.tsx +2 -2
  37. package/src/_stories/_mock/column-wrap-test.json +265 -0
  38. package/src/_stories/_mock/equal-number.json +1109 -0
  39. package/src/_stories/_mock/multi-country-hide.json +78 -0
  40. package/src/_stories/_mock/multi-country.json +95 -0
  41. package/src/_stories/_mock/multi-state.json +887 -20403
  42. package/src/_stories/_mock/small_multiples/multi-state-small-multiples.json +8399 -0
  43. package/src/_stories/_mock/small_multiples/region-small-multiples.json +657 -0
  44. package/src/_stories/_mock/small_multiples/wastewater-map-small-multiples.json +221 -0
  45. package/src/_stories/_mock/us-bubble-cities.json +306 -0
  46. package/src/_stories/_mock/usa-state-gradient.json +2 -4
  47. package/src/components/BubbleList.tsx +17 -13
  48. package/src/components/CityList.tsx +85 -107
  49. package/src/components/EditorPanel/components/EditorPanel.tsx +787 -709
  50. package/src/components/EditorPanel/components/HexShapeSettings.tsx +58 -95
  51. package/src/components/EditorPanel/components/Panels/Panel.PatternSettings.tsx +34 -42
  52. package/src/components/EditorPanel/components/Panels/Panel.SmallMultiples.tsx +354 -0
  53. package/src/components/EditorPanel/components/Panels/index.tsx +3 -1
  54. package/src/components/Geo.tsx +22 -3
  55. package/src/components/Legend/components/Legend.tsx +76 -40
  56. package/src/components/Legend/components/LegendGroup/Legend.Group.tsx +10 -7
  57. package/src/components/Legend/components/index.scss +1 -1
  58. package/src/components/MapContainer.tsx +52 -0
  59. package/src/components/MapControls.tsx +44 -0
  60. package/src/components/NavigationMenu.tsx +27 -15
  61. package/src/components/SmallMultiples/SmallMultipleTile.tsx +163 -0
  62. package/src/components/SmallMultiples/SmallMultiples.css +32 -0
  63. package/src/components/SmallMultiples/SmallMultiples.tsx +150 -0
  64. package/src/components/SmallMultiples/SynchronizedTooltip.tsx +105 -0
  65. package/src/components/SmallMultiples/index.tsx +3 -0
  66. package/src/components/UsaMap/components/SingleState/SingleState.CountyOutput.tsx +36 -4
  67. package/src/components/UsaMap/components/TerritoriesSection.tsx +26 -12
  68. package/src/components/UsaMap/components/Territory/Territory.Hexagon.tsx +30 -4
  69. package/src/components/UsaMap/components/Territory/Territory.Rectangle.tsx +23 -4
  70. package/src/components/UsaMap/components/Territory/TerritoryShape.ts +6 -0
  71. package/src/components/UsaMap/components/UsaMap.County.tsx +123 -37
  72. package/src/components/UsaMap/components/UsaMap.Region.tsx +36 -5
  73. package/src/components/UsaMap/components/UsaMap.SingleState.tsx +30 -10
  74. package/src/components/UsaMap/components/UsaMap.State.tsx +53 -12
  75. package/src/components/UsaMap/helpers/map.ts +4 -4
  76. package/src/components/UsaMap/helpers/shapes.ts +9 -6
  77. package/src/components/WorldMap/WorldMap.tsx +193 -35
  78. package/src/components/ZoomControls.tsx +6 -9
  79. package/src/context/LegendMemoContext.tsx +30 -0
  80. package/src/context.ts +1 -40
  81. package/src/data/initial-state.js +153 -130
  82. package/src/data/supported-geos.js +25 -78
  83. package/src/helpers/addUIDs.ts +13 -2
  84. package/src/helpers/applyColorToLegend.ts +140 -20
  85. package/src/helpers/applyLegendToRow.ts +10 -6
  86. package/src/helpers/componentHelpers.ts +8 -0
  87. package/src/helpers/constants.ts +12 -14
  88. package/src/helpers/dataTableHelpers.ts +6 -0
  89. package/src/helpers/displayGeoName.ts +18 -3
  90. package/src/helpers/generateRuntimeLegend.ts +44 -10
  91. package/src/helpers/generateRuntimeLegendHash.ts +4 -2
  92. package/src/helpers/getColumnNames.ts +1 -1
  93. package/src/helpers/getCountriesPicked.ts +103 -0
  94. package/src/helpers/getMapContainerClasses.ts +7 -0
  95. package/src/helpers/getPatternForRow.ts +33 -0
  96. package/src/helpers/getStatesPicked.ts +8 -5
  97. package/src/helpers/index.ts +3 -3
  98. package/src/helpers/isLegendItemDisabled.ts +16 -0
  99. package/src/helpers/mapObserverHelpers.ts +40 -0
  100. package/src/helpers/resetLegendToggles.ts +3 -2
  101. package/src/helpers/smallMultiplesHelpers.ts +359 -0
  102. package/src/helpers/tests/titleCase.test.ts +76 -0
  103. package/src/helpers/titleCase.ts +13 -13
  104. package/src/helpers/toggleLegendActive.ts +6 -11
  105. package/src/helpers/urlDataHelpers.ts +70 -0
  106. package/src/hooks/useCountryZoom.tsx +241 -0
  107. package/src/hooks/useGeoClickHandler.ts +36 -2
  108. package/src/hooks/useLegendMemo.ts +17 -0
  109. package/src/hooks/useMapLayers.tsx +5 -4
  110. package/src/hooks/useProgrammaticMapTooltip.ts +110 -0
  111. package/src/hooks/useResizeObserver.ts +5 -2
  112. package/src/hooks/useStateZoom.tsx +30 -8
  113. package/src/hooks/useSynchronizedGeographies.ts +56 -0
  114. package/src/hooks/useTooltip.ts +1 -2
  115. package/src/index.jsx +1 -2
  116. package/src/scss/editor-panel.scss +4 -440
  117. package/src/scss/main.scss +1 -1
  118. package/src/scss/map.scss +12 -15
  119. package/src/store/map.actions.ts +7 -7
  120. package/src/store/map.reducer.ts +17 -6
  121. package/src/test/CdcMap.test.jsx +11 -0
  122. package/src/types/MapConfig.ts +46 -18
  123. package/src/types/MapContext.ts +6 -7
  124. package/src/types/runtimeLegend.ts +17 -1
  125. package/vite.config.js +2 -7
  126. package/vitest.config.ts +16 -0
  127. package/src/components/DataTable.tsx +0 -385
  128. package/src/components/EditorPanel/components/Inputs.tsx +0 -59
  129. package/src/coreStyles_map.scss +0 -3
  130. package/src/helpers/colorDistributions.ts +0 -12
  131. package/src/helpers/generateColorsArray.ts +0 -14
  132. package/src/helpers/tests/generateColorsArray.test.ts +0 -18
  133. package/src/helpers/tests/generateRuntimeLegendHash.test.ts +0 -11
  134. package/src/hooks/useActiveElement.ts +0 -19
  135. package/src/scss/mixins.scss +0 -47
  136. package/src/types/Annotations.ts +0 -24
  137. /package/dist/{cdcmap-548642e6.es.js → cdcmap-Ct2SB0vL.es.js} +0 -0
@@ -0,0 +1,221 @@
1
+ {
2
+ "annotations": [],
3
+ "general": {
4
+ "geoBorderColor": "darkGray",
5
+ "headerColor": "theme-blue",
6
+ "title": "",
7
+ "showTitle": true,
8
+ "showSidebar": true,
9
+ "showDownloadButton": false,
10
+ "showDownloadMediaButton": false,
11
+ "displayAsHex": false,
12
+ "displayStateLabels": false,
13
+ "territoriesAlwaysShow": false,
14
+ "language": "en",
15
+ "geoType": "us",
16
+ "geoLabelOverride": "State/Territory",
17
+ "hasRegions": false,
18
+ "fullBorder": false,
19
+ "type": "map",
20
+ "convertFipsCodes": true,
21
+ "palette": {
22
+ "isReversed": true
23
+ },
24
+ "allowMapZoom": true,
25
+ "hideGeoColumnInTooltip": false,
26
+ "hidePrimaryColumnInTooltip": false,
27
+ "statePicked": {
28
+ "fipsCode": "01",
29
+ "stateName": "Alabama"
30
+ },
31
+ "expandDataTable": false,
32
+ "annotationDropdownText": "Annotations",
33
+ "noStateFoundMessage": "Map Unavailable",
34
+ "subtext": "<div class=\"text-left\">Data last updated on <span data-timestamp=\"nwss_rsv_sc2_flua_combined_state_map:Data_as_of\"></span> and presented through <span data-timestamp=\"nwss_rsv_sc2_flua_combined_state_map:Data_Presented_Through\"></span>. ",
35
+ "navigationTarget": "_self"
36
+ },
37
+ "type": "map",
38
+ "color": "greenbluereverse",
39
+ "columns": {
40
+ "geo": {
41
+ "name": "State",
42
+ "label": "Location",
43
+ "tooltip": false,
44
+ "dataTable": true
45
+ },
46
+ "primary": {
47
+ "dataTable": true,
48
+ "tooltip": true,
49
+ "prefix": "",
50
+ "suffix": "",
51
+ "name": "activity_level_label",
52
+ "label": "Viral Activity Level",
53
+ "roundToPlace": 0
54
+ },
55
+ "navigate": {
56
+ "name": ""
57
+ },
58
+ "latitude": {
59
+ "name": ""
60
+ },
61
+ "longitude": {
62
+ "name": ""
63
+ },
64
+ "additionalColumn1": {
65
+ "label": "Sites Currently Reporting",
66
+ "dataTable": true,
67
+ "tooltips": false,
68
+ "prefix": "",
69
+ "suffix": "",
70
+ "name": "num_sites",
71
+ "tooltip": true
72
+ },
73
+ "additionalColumn2": {
74
+ "label": "Limited Coverage",
75
+ "dataTable": true,
76
+ "tooltips": false,
77
+ "prefix": "",
78
+ "suffix": "",
79
+ "tooltip": false,
80
+ "name": "hatch"
81
+ },
82
+ "additionalColumn3": {
83
+ "label": "",
84
+ "dataTable": false,
85
+ "tooltips": false,
86
+ "prefix": "",
87
+ "suffix": "",
88
+ "tooltip": true,
89
+ "useCommas": true,
90
+ "name": "hatch"
91
+ }
92
+ },
93
+ "legend": {
94
+ "descriptions": {},
95
+ "specialClasses": [],
96
+ "unified": false,
97
+ "singleColumn": false,
98
+ "singleRow": true,
99
+ "verticalSorted": false,
100
+ "showSpecialClassesLast": true,
101
+ "dynamicDescription": false,
102
+ "type": "category",
103
+ "numberOfItems": 8,
104
+ "position": "top",
105
+ "title": "Wastewater Viral Activity Level",
106
+ "categoryValuesOrder": ["Very Low", "Low", "Moderate", "High", "Very High", "No Data", "Minimal"],
107
+ "additionalCategories": ["No Data", "Very Low", "Low", "Moderate", "High", "Very High"],
108
+ "description": "",
109
+ "style": "gradient",
110
+ "subStyle": "linear blocks",
111
+ "tickRotation": "",
112
+ "singleColumnLegend": false,
113
+ "hideBorder": true
114
+ },
115
+ "filters": [],
116
+ "table": {
117
+ "label": "Data Table",
118
+ "expanded": false,
119
+ "limitHeight": true,
120
+ "height": "500",
121
+ "caption": "",
122
+ "showDownloadUrl": false,
123
+ "showDataTableLink": true,
124
+ "showFullGeoNameInCSV": false,
125
+ "forceDisplay": true,
126
+ "download": true,
127
+ "indexLabel": "State/Territory",
128
+ "wrapColumns": false,
129
+ "showDownloadLinkBelow": true
130
+ },
131
+ "tooltips": {
132
+ "appearanceType": "hover",
133
+ "linkLabel": "Learn More",
134
+ "capitalizeLabels": true,
135
+ "opacity": 90
136
+ },
137
+ "visual": {
138
+ "minBubbleSize": 1,
139
+ "maxBubbleSize": 20,
140
+ "extraBubbleBorder": false,
141
+ "cityStyle": "circle",
142
+ "geoCodeCircleSize": 2,
143
+ "showBubbleZeros": false,
144
+ "cityStyleLabel": "",
145
+ "additionalCityStyles": []
146
+ },
147
+ "mapPosition": {
148
+ "coordinates": [0, 30],
149
+ "zoom": 1
150
+ },
151
+ "map": {
152
+ "layers": [],
153
+ "patterns": [
154
+ {
155
+ "dataKey": "hatch",
156
+ "pattern": "lines",
157
+ "dataValue": "Limited Coverage",
158
+ "label": "Limited Coverage*",
159
+ "size": "medium"
160
+ }
161
+ ]
162
+ },
163
+ "hexMap": {
164
+ "type": "",
165
+ "shapeGroups": [
166
+ {
167
+ "legendTitle": "",
168
+ "legendDescription": "",
169
+ "items": [
170
+ {
171
+ "key": "",
172
+ "shape": "Arrow Up",
173
+ "column": "",
174
+ "operator": "=",
175
+ "value": ""
176
+ }
177
+ ]
178
+ }
179
+ ]
180
+ },
181
+ "smallMultiples": {
182
+ "mode": "by-column",
183
+ "tileColumn": "pathogen",
184
+ "tilesPerRowDesktop": 3,
185
+ "tilesPerRowMobile": "",
186
+ "tileOrderType": "custom",
187
+ "tileOrder": ["Influenza A", "RSV", "COVID-19"],
188
+ "tileTitles": {
189
+ "COVID-19": "COVID-19",
190
+ "Influenza A": "Influenza AAA",
191
+ "RSV": "RSV"
192
+ },
193
+ "synchronizedTooltips": true
194
+ },
195
+ "filterBehavior": "Filter Change",
196
+ "filterIntro": "",
197
+ "customColors": [
198
+ "#C8EFDA",
199
+ "#9FDAD0",
200
+ "#9FDAD0",
201
+ "#6BB0BD",
202
+ "#4B7F9B",
203
+ "#34547B",
204
+ "#B4B4B4",
205
+ "#B4B4B4",
206
+ "#B4B4B4",
207
+ "#B4B4B4"
208
+ ],
209
+ "datasets": {},
210
+ "dataFileName": "https://www.cdc.gov/wcms/vizdata/ncezid_didri/NWSSStateMapCombined.json",
211
+ "dataFileSourceType": "url",
212
+ "dataDescription": {
213
+ "horizontal": false,
214
+ "series": false
215
+ },
216
+ "version": "4.25.1",
217
+ "dataUrl": "https://www.cdc.gov/wcms/vizdata/ncezid_didri/NWSSStateMapCombined.json",
218
+ "migrations": {
219
+ "addColorMigration": true
220
+ }
221
+ }
@@ -0,0 +1,306 @@
1
+ {
2
+ "annotations": [],
3
+ "general": {
4
+ "title": "US Cities Bubble Map - CityList Test",
5
+ "subtext": "This bubble map uses CityList component to render bubble sizes based on data values",
6
+ "type": "bubble",
7
+ "geoType": "us",
8
+ "headerColor": "theme-green",
9
+ "showSidebar": true,
10
+ "showTitle": true,
11
+ "showDownloadButton": true,
12
+ "expandDataTable": false,
13
+ "backgroundColor": "#ffffff",
14
+ "geoBorderColor": "darkGray",
15
+ "territoriesLabel": "Territories",
16
+ "language": "en",
17
+ "hasRegions": false,
18
+ "showDownloadMediaButton": false,
19
+ "displayAsHex": false,
20
+ "displayStateLabels": false,
21
+ "fullBorder": false,
22
+ "palette": {
23
+ "isReversed": false
24
+ },
25
+ "allowMapZoom": true,
26
+ "hideGeoColumnInTooltip": false,
27
+ "hidePrimaryColumnInTooltip": false,
28
+ "territoriesAlwaysShow": false,
29
+ "geoLabelOverride": "",
30
+ "noDataFoundMessage": "No data found",
31
+ "convertFipsCodes": false
32
+ },
33
+ "type": "map",
34
+ "color": "orangered",
35
+ "columns": {
36
+ "geo": {
37
+ "name": "city",
38
+ "label": "City",
39
+ "tooltip": true,
40
+ "dataTable": true
41
+ },
42
+ "primary": {
43
+ "dataTable": true,
44
+ "tooltip": true,
45
+ "prefix": "",
46
+ "suffix": " cases",
47
+ "name": "covid_cases",
48
+ "label": "COVID-19 Cases"
49
+ },
50
+ "latitude": {
51
+ "name": "latitude",
52
+ "label": "Latitude"
53
+ },
54
+ "longitude": {
55
+ "name": "longitude",
56
+ "label": "Longitude"
57
+ },
58
+ "navigate": {
59
+ "name": ""
60
+ }
61
+ },
62
+ "legend": {
63
+ "descriptions": {},
64
+ "specialClasses": [],
65
+ "unified": false,
66
+ "singleColumn": true,
67
+ "dynamicDescription": false,
68
+ "type": "equalinterval",
69
+ "numberOfItems": 5,
70
+ "position": "side",
71
+ "title": "COVID-19 Cases",
72
+ "showTitle": true,
73
+ "reversedOrder": false,
74
+ "singleColumnLegend": false,
75
+ "hideBorder": false
76
+ },
77
+ "filters": [],
78
+ "table": {
79
+ "label": "Data Table",
80
+ "expanded": false,
81
+ "limitHeight": false,
82
+ "height": "",
83
+ "caption": "",
84
+ "showDownloadUrl": false,
85
+ "showDataTableLink": true,
86
+ "showFullGeoNameInCSV": false,
87
+ "forceDisplay": true,
88
+ "download": true,
89
+ "indexLabel": "",
90
+ "wrapColumns": false,
91
+ "showDownloadLinkBelow": true
92
+ },
93
+ "tooltips": {
94
+ "appearanceType": "hover",
95
+ "linkLabel": "Learn More",
96
+ "capitalizeLabels": true,
97
+ "opacity": 90
98
+ },
99
+ "runtime": {
100
+ "editorErrorMessage": []
101
+ },
102
+ "visual": {
103
+ "minBubbleSize": 5,
104
+ "maxBubbleSize": 40,
105
+ "extraBubbleBorder": true,
106
+ "cityStyle": "circle",
107
+ "geoCodeCircleSize": 12,
108
+ "showBubbleZeros": true,
109
+ "cityStyleLabel": "City Bubbles",
110
+ "additionalCityStyles": []
111
+ },
112
+ "mapPosition": {
113
+ "coordinates": [0, 39],
114
+ "zoom": 1
115
+ },
116
+ "map": {
117
+ "layers": [],
118
+ "patterns": []
119
+ },
120
+ "hexMap": {
121
+ "type": "",
122
+ "shapeGroups": []
123
+ },
124
+ "data": [
125
+ {
126
+ "city": "New York",
127
+ "latitude": 40.7128,
128
+ "longitude": -74.0060,
129
+ "covid_cases": 2845
130
+ },
131
+ {
132
+ "city": "Los Angeles",
133
+ "latitude": 34.0522,
134
+ "longitude": -118.2437,
135
+ "covid_cases": 2234
136
+ },
137
+ {
138
+ "city": "Chicago",
139
+ "latitude": 41.8781,
140
+ "longitude": -87.6298,
141
+ "covid_cases": 1567
142
+ },
143
+ {
144
+ "city": "Houston",
145
+ "latitude": 29.7604,
146
+ "longitude": -95.3698,
147
+ "covid_cases": 1890
148
+ },
149
+ {
150
+ "city": "Phoenix",
151
+ "latitude": 33.4484,
152
+ "longitude": -112.0740,
153
+ "covid_cases": 1234
154
+ },
155
+ {
156
+ "city": "Philadelphia",
157
+ "latitude": 39.9526,
158
+ "longitude": -75.1652,
159
+ "covid_cases": 1678
160
+ },
161
+ {
162
+ "city": "San Antonio",
163
+ "latitude": 29.4241,
164
+ "longitude": -98.4936,
165
+ "covid_cases": 987
166
+ },
167
+ {
168
+ "city": "San Diego",
169
+ "latitude": 32.7157,
170
+ "longitude": -117.1611,
171
+ "covid_cases": 1456
172
+ },
173
+ {
174
+ "city": "Dallas",
175
+ "latitude": 32.7767,
176
+ "longitude": -96.7970,
177
+ "covid_cases": 1789
178
+ },
179
+ {
180
+ "city": "San Jose",
181
+ "latitude": 37.3382,
182
+ "longitude": -121.8863,
183
+ "covid_cases": 934
184
+ },
185
+ {
186
+ "city": "Austin",
187
+ "latitude": 30.2672,
188
+ "longitude": -97.7431,
189
+ "covid_cases": 876
190
+ },
191
+ {
192
+ "city": "Jacksonville",
193
+ "latitude": 30.3322,
194
+ "longitude": -81.6557,
195
+ "covid_cases": 743
196
+ },
197
+ {
198
+ "city": "Fort Worth",
199
+ "latitude": 32.7555,
200
+ "longitude": -97.3308,
201
+ "covid_cases": 654
202
+ },
203
+ {
204
+ "city": "Columbus",
205
+ "latitude": 39.9612,
206
+ "longitude": -82.9988,
207
+ "covid_cases": 567
208
+ },
209
+ {
210
+ "city": "Charlotte",
211
+ "latitude": 35.2271,
212
+ "longitude": -80.8431,
213
+ "covid_cases": 789
214
+ },
215
+ {
216
+ "city": "San Francisco",
217
+ "latitude": 37.7749,
218
+ "longitude": -122.4194,
219
+ "covid_cases": 1123
220
+ },
221
+ {
222
+ "city": "Indianapolis",
223
+ "latitude": 39.7684,
224
+ "longitude": -86.1581,
225
+ "covid_cases": 445
226
+ },
227
+ {
228
+ "city": "Seattle",
229
+ "latitude": 47.6062,
230
+ "longitude": -122.3321,
231
+ "covid_cases": 823
232
+ },
233
+ {
234
+ "city": "Denver",
235
+ "latitude": 39.7392,
236
+ "longitude": -104.9903,
237
+ "covid_cases": 634
238
+ },
239
+ {
240
+ "city": "Boston",
241
+ "latitude": 42.3601,
242
+ "longitude": -71.0589,
243
+ "covid_cases": 976
244
+ },
245
+ {
246
+ "city": "El Paso",
247
+ "latitude": 31.7619,
248
+ "longitude": -106.4850,
249
+ "covid_cases": 312
250
+ },
251
+ {
252
+ "city": "Nashville",
253
+ "latitude": 36.1627,
254
+ "longitude": -86.7816,
255
+ "covid_cases": 456
256
+ },
257
+ {
258
+ "city": "Detroit",
259
+ "latitude": 42.3314,
260
+ "longitude": -83.0458,
261
+ "covid_cases": 578
262
+ },
263
+ {
264
+ "city": "Oklahoma City",
265
+ "latitude": 35.4676,
266
+ "longitude": -97.5164,
267
+ "covid_cases": 289
268
+ },
269
+ {
270
+ "city": "Portland",
271
+ "latitude": 45.5152,
272
+ "longitude": -122.6784,
273
+ "covid_cases": 387
274
+ },
275
+ {
276
+ "city": "Las Vegas",
277
+ "latitude": 36.1699,
278
+ "longitude": -115.1398,
279
+ "covid_cases": 534
280
+ },
281
+ {
282
+ "city": "Memphis",
283
+ "latitude": 35.1495,
284
+ "longitude": -90.0490,
285
+ "covid_cases": 267
286
+ },
287
+ {
288
+ "city": "Louisville",
289
+ "latitude": 38.2527,
290
+ "longitude": -85.7585,
291
+ "covid_cases": 189
292
+ },
293
+ {
294
+ "city": "Baltimore",
295
+ "latitude": 39.2904,
296
+ "longitude": -76.6122,
297
+ "covid_cases": 445
298
+ },
299
+ {
300
+ "city": "Milwaukee",
301
+ "latitude": 43.0389,
302
+ "longitude": -87.9065,
303
+ "covid_cases": 334
304
+ }
305
+ ]
306
+ }
@@ -114,7 +114,7 @@
114
114
  { "STATE": "Alabama", "Rate": 130, "Location": "Vehicle", "URL": "https://www.cdc.gov/" },
115
115
  { "STATE": "Alaska", "Rate": 40, "Location": "Work", "URL": "https://www.cdc.gov/" },
116
116
  { "STATE": "American Samoa", "Rate": 55, "Location": "Home", "URL": "https://www.cdc.gov/" },
117
- { "STATE": "Arizona", "Rate": 57, "Location": "School", "URL": "https://www.cdc.gov/" },
117
+ { "STATE": "Arizona", "Rate": 0, "Location": "School", "URL": "https://www.cdc.gov/" },
118
118
  { "STATE": "Arkansas", "Rate": 60, "Location": "School", "URL": "https://www.cdc.gov/" },
119
119
  { "STATE": "California", "Rate": 30, "Location": "Home", "URL": "https://www.cdc.gov/" },
120
120
  { "STATE": "Colorado", "Rate": 40, "Location": "Vehicle", "URL": "https://www.cdc.gov/" },
@@ -123,7 +123,6 @@
123
123
  { "STATE": "DC", "Rate": 60, "Location": "Home", "URL": "https://www.cdc.gov/" },
124
124
  { "STATE": "Florida", "Rate": 30, "Location": "Work", "URL": "https://www.cdc.gov/" },
125
125
  { "STATE": "Georgia", "Rate": 40, "Location": "Work", "URL": "https://www.cdc.gov/" },
126
- { "STATE": "Guam", "Rate": 55, "Location": "Home", "URL": "https://www.cdc.gov/" },
127
126
  { "STATE": "Hawaii", "Rate": 57, "Location": "School", "URL": "https://www.cdc.gov/" },
128
127
  { "STATE": "Idaho", "Rate": 60, "Location": "School", "URL": "https://www.cdc.gov/" },
129
128
  { "STATE": "Illinois", "Rate": 30, "Location": "Work", "URL": "https://www.cdc.gov/" },
@@ -177,7 +176,7 @@
177
176
  { "STATE": "Alabama", "Rate": 130, "Location": "Vehicle", "URL": "https://www.cdc.gov/" },
178
177
  { "STATE": "Alaska", "Rate": 40, "Location": "Work", "URL": "https://www.cdc.gov/" },
179
178
  { "STATE": "American Samoa", "Rate": 55, "Location": "Home", "URL": "https://www.cdc.gov/" },
180
- { "STATE": "Arizona", "Rate": 57, "Location": "School", "URL": "https://www.cdc.gov/" },
179
+ { "STATE": "Arizona", "Rate": 0, "Location": "School", "URL": "https://www.cdc.gov/" },
181
180
  { "STATE": "Arkansas", "Rate": 60, "Location": "School", "URL": "https://www.cdc.gov/" },
182
181
  { "STATE": "California", "Rate": 30, "Location": "Home", "URL": "https://www.cdc.gov/" },
183
182
  { "STATE": "Colorado", "Rate": 40, "Location": "Vehicle", "URL": "https://www.cdc.gov/" },
@@ -186,7 +185,6 @@
186
185
  { "STATE": "DC", "Rate": 60, "Location": "Home", "URL": "https://www.cdc.gov/" },
187
186
  { "STATE": "Florida", "Rate": 30, "Location": "Work", "URL": "https://www.cdc.gov/" },
188
187
  { "STATE": "Georgia", "Rate": 40, "Location": "Work", "URL": "https://www.cdc.gov/" },
189
- { "STATE": "Guam", "Rate": 55, "Location": "Home", "URL": "https://www.cdc.gov/" },
190
188
  { "STATE": "Hawaii", "Rate": 57, "Location": "School", "URL": "https://www.cdc.gov/" },
191
189
  { "STATE": "Idaho", "Rate": 60, "Location": "School", "URL": "https://www.cdc.gov/" },
192
190
  { "STATE": "Illinois", "Rate": 30, "Location": "Work", "URL": "https://www.cdc.gov/" },
@@ -3,6 +3,7 @@ import { scaleLinear } from 'd3-scale'
3
3
  import { countryCoordinates } from '../data/country-coordinates'
4
4
  import stateCoordinates from '../data/state-coordinates'
5
5
  import ConfigContext, { MapDispatchContext } from '../context'
6
+ import { useLegendMemoContext } from '../context/LegendMemoContext'
6
7
  import { type Coordinate, DataRow } from '../types/MapConfig'
7
8
  import useApplyTooltipsToGeo from '../hooks/useApplyTooltipsToGeo'
8
9
  import { applyLegendToRow } from '../helpers/applyLegendToRow'
@@ -16,9 +17,9 @@ type BubbleListProps = {
16
17
  customProjection?: GeoProjection
17
18
  }
18
19
 
19
- export const BubbleList: React.FC<BubbleListProps> = ({ customProjection }) => {
20
- const { config, tooltipId, legendMemo, legendSpecialClassLastMemo, setRuntimeData, runtimeData, runtimeLegend } =
21
- useContext<MapContext>(ConfigContext)
20
+ const BubbleList: React.FC<BubbleListProps> = ({ customProjection }) => {
21
+ const { config, tooltipId, runtimeData, runtimeLegend } = useContext<MapContext>(ConfigContext)
22
+ const { legendMemo, legendSpecialClassLastMemo } = useLegendMemoContext()
22
23
  const { columns, data, general, visual } = config
23
24
  const { geoType, allowMapZoom } = general
24
25
  const { minBubbleSize, maxBubbleSize, showBubbleZeros, extraBubbleBorder } = visual
@@ -65,7 +66,7 @@ export const BubbleList: React.FC<BubbleListProps> = ({ customProjection }) => {
65
66
  dispatch({ type: 'SET_POSITION', payload: { coordinates: reversedCoordinates, zoom: 3 } })
66
67
 
67
68
  // ...and show the data for the clicked country
68
- setRuntimeData(_tempRuntimeData)
69
+ dispatch({ type: 'SET_RUNTIME_DATA', payload: _tempRuntimeData })
69
70
  }
70
71
 
71
72
  const sortedRuntimeData: DataRow = Object.values(runtimeData).sort((a, b) =>
@@ -77,7 +78,7 @@ export const BubbleList: React.FC<BubbleListProps> = ({ customProjection }) => {
77
78
  if (geoType === 'world') {
78
79
  return (
79
80
  sortedRuntimeData &&
80
- sortedRuntimeData.map(country => {
81
+ sortedRuntimeData.map((country, index) => {
81
82
  let coordinates = countryCoordinates[country.uid]
82
83
 
83
84
  if (!coordinates) return true
@@ -99,10 +100,9 @@ export const BubbleList: React.FC<BubbleListProps> = ({ customProjection }) => {
99
100
  if (!projection(coordinates)) return true
100
101
 
101
102
  const circle = (
102
- <>
103
+ <React.Fragment key={`circle-fragment-${countryName.replace(' ', '')}`}>
103
104
  <circle
104
105
  tabIndex={-1}
105
- key={`circle-${countryName.replace(' ', '')}`}
106
106
  className={`bubble country--${countryName}`}
107
107
  cx={Number(projection(coordinates[1], coordinates[0])[0]) || 0}
108
108
  cy={Number(projection(coordinates[1], coordinates[0])[1]) || 0}
@@ -111,6 +111,7 @@ export const BubbleList: React.FC<BubbleListProps> = ({ customProjection }) => {
111
111
  stroke={legendColors[0]}
112
112
  strokeWidth={1.25}
113
113
  fillOpacity={0.4}
114
+ onMouseEnter={() => {}}
114
115
  onPointerDown={e => {
115
116
  pointerX = e.clientX
116
117
  pointerY = e.clientY
@@ -138,7 +139,7 @@ export const BubbleList: React.FC<BubbleListProps> = ({ customProjection }) => {
138
139
  {extraBubbleBorder && (
139
140
  <circle
140
141
  tabIndex={-1}
141
- key={`circle-${countryName.replace(' ', '')}`}
142
+ key={`circle-border-${countryName.replace(' ', '')}`}
142
143
  className='bubble'
143
144
  cx={Number(projection(coordinates[1], coordinates[0])[0]) || 0}
144
145
  cy={Number(projection(coordinates[1], coordinates[0])[1]) || 0}
@@ -146,6 +147,7 @@ export const BubbleList: React.FC<BubbleListProps> = ({ customProjection }) => {
146
147
  fill={'transparent'}
147
148
  stroke={'white'}
148
149
  strokeWidth={0.5}
150
+ onMouseEnter={() => {}}
149
151
  onPointerDown={e => {
150
152
  pointerX = e.clientX
151
153
  pointerY = e.clientY
@@ -170,11 +172,11 @@ export const BubbleList: React.FC<BubbleListProps> = ({ customProjection }) => {
170
172
  data-tooltip-html={toolTip}
171
173
  />
172
174
  )}
173
- </>
175
+ </React.Fragment>
174
176
  )
175
177
 
176
178
  return (
177
- <g key={`group-${countryName.replace(' ', '')}`} tabIndex={-1}>
179
+ <g key={`group-${index}-${countryName.replace(' ', '')}`} tabIndex={-1}>
178
180
  {circle}
179
181
  </g>
180
182
  )
@@ -185,7 +187,7 @@ export const BubbleList: React.FC<BubbleListProps> = ({ customProjection }) => {
185
187
  if (geoType === 'us') {
186
188
  return (
187
189
  sortedRuntimeData &&
188
- sortedRuntimeData.map(item => {
190
+ sortedRuntimeData.map((item, index) => {
189
191
  let stateData = stateCoordinates[item.uid]
190
192
  if (Number(size(item[primaryColumnName])) === 0) return
191
193
 
@@ -223,6 +225,7 @@ export const BubbleList: React.FC<BubbleListProps> = ({ customProjection }) => {
223
225
  stroke={legendColors[0]}
224
226
  strokeWidth={1.25}
225
227
  fillOpacity={0.4}
228
+ onMouseEnter={() => {}}
226
229
  onPointerDown={e => {
227
230
  pointerX = e.clientX
228
231
  pointerY = e.clientY
@@ -249,7 +252,7 @@ export const BubbleList: React.FC<BubbleListProps> = ({ customProjection }) => {
249
252
  {extraBubbleBorder && (
250
253
  <circle
251
254
  tabIndex={-1}
252
- key={`circle-${stateName.replace(' ', '')}`}
255
+ key={`circle-border-${stateName.replace(' ', '')}`}
253
256
  className='bubble'
254
257
  cx={projection(coordinates)[0] || 0}
255
258
  cy={projection(coordinates)[1] || 0}
@@ -258,6 +261,7 @@ export const BubbleList: React.FC<BubbleListProps> = ({ customProjection }) => {
258
261
  stroke={'white'}
259
262
  strokeWidth={0.5}
260
263
  fillOpacity={0.4}
264
+ onMouseEnter={() => {}}
261
265
  onPointerDown={e => {
262
266
  pointerX = e.clientX
263
267
  pointerY = e.clientY
@@ -285,7 +289,7 @@ export const BubbleList: React.FC<BubbleListProps> = ({ customProjection }) => {
285
289
  </>
286
290
  )
287
291
 
288
- return <g key={`group-${stateName.replace(' ', '')}`}>{circle}</g>
292
+ return <g key={`group-${index}-${stateName.replace(' ', '')}`}>{circle}</g>
289
293
  })
290
294
  )
291
295
  }