@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
@@ -19,7 +19,15 @@
19
19
  "displayStateLabels": false,
20
20
  "fullBorder": false,
21
21
  "palette": {
22
- "isReversed": false
22
+ "isReversed": false,
23
+ "customColors": [
24
+ "red",
25
+ "red",
26
+ "orange",
27
+ "orange",
28
+ "yellow",
29
+ "yellow"
30
+ ]
23
31
  },
24
32
  "allowMapZoom": true,
25
33
  "hideGeoColumnInTooltip": false,
@@ -0,0 +1,45 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "geo": "US",
5
+ "value": 100
6
+ },
7
+ {
8
+ "geo": "CA",
9
+ "value": 200
10
+ },
11
+ {
12
+ "geo": "MX",
13
+ "value": 150
14
+ }
15
+ ],
16
+ "columns": {
17
+ "geo": {
18
+ "name": "geo"
19
+ },
20
+ "primary": {
21
+ "name": "value"
22
+ }
23
+ },
24
+ "type": "world",
25
+ "general": {
26
+ "geoType": "world",
27
+ "type": "data",
28
+ "title": "Multi-Country Centering Test",
29
+ "showTitle": true,
30
+ "countriesPicked": [
31
+ { "iso": "US", "name": "United States" },
32
+ { "iso": "CA", "name": "Canada" },
33
+ { "iso": "MX", "name": "Mexico" }
34
+ ],
35
+ "hideUnselectedCountries": true,
36
+ "allowMapZoom": true
37
+ },
38
+ "legend": {
39
+ "descriptions": {
40
+ "US": "United States",
41
+ "CA": "Canada",
42
+ "MX": "Mexico"
43
+ }
44
+ }
45
+ }
@@ -0,0 +1,290 @@
1
+ {
2
+ "annotations": [],
3
+ "general": {
4
+ "navigationTarget": "_self",
5
+ "noDataMessage": "No State Selected",
6
+ "annotationDropdownText": "Annotations",
7
+ "geoBorderColor": "darkGray",
8
+ "headerColor": "theme-blue",
9
+ "title": "<em>4.25.09</em> Single State Map",
10
+ "showTitle": true,
11
+ "showSidebar": true,
12
+ "showDownloadMediaButton": false,
13
+ "displayAsHex": false,
14
+ "displayStateLabels": true,
15
+ "territoriesAlwaysShow": false,
16
+ "language": "en",
17
+ "geoType": "single-state",
18
+ "geoLabelOverride": "",
19
+ "hasRegions": false,
20
+ "fullBorder": false,
21
+ "type": "map",
22
+ "convertFipsCodes": true,
23
+ "palette": {
24
+ "isReversed": true,
25
+ "name": "sequential_blue",
26
+ "version": "2.0"
27
+ },
28
+ "allowMapZoom": false,
29
+ "hideGeoColumnInTooltip": false,
30
+ "hidePrimaryColumnInTooltip": false,
31
+ "statesPicked": [
32
+ {
33
+ "fipsCode": "02",
34
+ "stateName": "Alaska"
35
+ }
36
+ ],
37
+ "expandDataTable": false,
38
+ "filterControlsCountyYear": "YEAR"
39
+ },
40
+ "type": "map",
41
+ "columns": {
42
+ "geo": {
43
+ "name": "FIPS",
44
+ "label": "Location",
45
+ "tooltip": false,
46
+ "dataTable": true
47
+ },
48
+ "primary": {
49
+ "dataTable": true,
50
+ "tooltip": true,
51
+ "prefix": "",
52
+ "suffix": "",
53
+ "name": "VALUE",
54
+ "label": "VALUE",
55
+ "roundToPlace": 0
56
+ },
57
+ "navigate": {
58
+ "name": ""
59
+ },
60
+ "latitude": {
61
+ "name": ""
62
+ },
63
+ "longitude": {
64
+ "name": ""
65
+ }
66
+ },
67
+ "legend": {
68
+ "descriptions": {},
69
+ "specialClasses": [],
70
+ "unified": false,
71
+ "singleColumn": false,
72
+ "singleRow": false,
73
+ "verticalSorted": false,
74
+ "showSpecialClassesLast": false,
75
+ "dynamicDescription": false,
76
+ "type": "equalnumber",
77
+ "numberOfItems": 6,
78
+ "position": "side",
79
+ "title": "",
80
+ "style": "circles",
81
+ "subStyle": "linear blocks",
82
+ "tickRotation": "",
83
+ "singleColumnLegend": false,
84
+ "hideBorder": false,
85
+ "groupBy": ""
86
+ },
87
+ "filters": [
88
+ {
89
+ "values": [
90
+ "2019",
91
+ "2020"
92
+ ],
93
+ "filterStyle": "dropdown",
94
+ "id": 1758288563175,
95
+ "showDropdown": true,
96
+ "active": "2019",
97
+ "columnName": "YEAR",
98
+ "orderedValues": [
99
+ "2019",
100
+ "2020"
101
+ ],
102
+ "label": "Year"
103
+ }
104
+ ],
105
+ "table": {
106
+ "wrapColumns": false,
107
+ "label": "Data Table",
108
+ "expanded": false,
109
+ "limitHeight": false,
110
+ "height": "",
111
+ "caption": "",
112
+ "showDownloadUrl": false,
113
+ "showDataTableLink": true,
114
+ "showDownloadLinkBelow": true,
115
+ "showFullGeoNameInCSV": false,
116
+ "forceDisplay": true,
117
+ "download": true,
118
+ "indexLabel": "",
119
+ "cellMinWidth": "0",
120
+ "collapsible": true
121
+ },
122
+ "tooltips": {
123
+ "appearanceType": "hover",
124
+ "linkLabel": "Learn More",
125
+ "opacity": 90
126
+ },
127
+ "runtime": {
128
+ "editorErrorMessage": []
129
+ },
130
+ "visual": {
131
+ "minBubbleSize": 1,
132
+ "maxBubbleSize": 20,
133
+ "extraBubbleBorder": false,
134
+ "cityStyle": "circle",
135
+ "cityStyleLabel": "",
136
+ "showBubbleZeros": false,
137
+ "additionalCityStyles": [],
138
+ "geoCodeCircleSize": 8
139
+ },
140
+ "mapPosition": {
141
+ "coordinates": [
142
+ 0,
143
+ 30
144
+ ],
145
+ "zoom": 1
146
+ },
147
+ "map": {
148
+ "layers": [],
149
+ "patterns": []
150
+ },
151
+ "hexMap": {
152
+ "type": "",
153
+ "shapeGroups": [
154
+ {
155
+ "legendTitle": "",
156
+ "legendDescription": "",
157
+ "items": [
158
+ {
159
+ "key": "",
160
+ "shape": "Arrow Up",
161
+ "column": "",
162
+ "operator": "=",
163
+ "value": ""
164
+ }
165
+ ]
166
+ }
167
+ ]
168
+ },
169
+ "filterBehavior": "Filter Change",
170
+ "filterIntro": "",
171
+ "errors": [],
172
+ "currentViewport": "lg",
173
+ "id": 22,
174
+ "category": "Maps",
175
+ "label": "U.S. State",
176
+ "subType": "single-state",
177
+ "icon": {
178
+ "key": null,
179
+ "ref": null,
180
+ "props": {},
181
+ "_owner": null
182
+ },
183
+ "content": "Present a choropleth map of an individual U.S. state.",
184
+ "activeVizButtonID": 22,
185
+ "dataFileName": "https://wcms-wp.cdc.gov/wcms/4.0/cdc-wp/data-presentation/data/county-year.csv",
186
+ "dataFileSourceType": "url",
187
+ "dataDescription": {
188
+ "horizontal": false,
189
+ "series": false
190
+ },
191
+ "version": "4.25.9",
192
+ "migrations": {
193
+ "addColorMigration": true
194
+ },
195
+ "data": [
196
+ {
197
+ "FIPS": "02261",
198
+ "YEAR": "2019",
199
+ "VALUE": 100
200
+ },
201
+ {
202
+ "FIPS": "02290",
203
+ "YEAR": "2019",
204
+ "VALUE": 150
205
+ },
206
+ {
207
+ "FIPS": "02185",
208
+ "YEAR": "2019",
209
+ "VALUE": 200
210
+ },
211
+ {
212
+ "FIPS": "02050",
213
+ "YEAR": "2019",
214
+ "VALUE": 250
215
+ },
216
+ {
217
+ "FIPS": "02063",
218
+ "YEAR": "2020",
219
+ "VALUE": 50
220
+ },
221
+ {
222
+ "FIPS": "02066",
223
+ "YEAR": "2020",
224
+ "VALUE": 100
225
+ },
226
+ {
227
+ "FIPS": "02290",
228
+ "YEAR": "2020",
229
+ "VALUE": 150
230
+ },
231
+ {
232
+ "FIPS": "02185",
233
+ "YEAR": "2020",
234
+ "VALUE": 200
235
+ },
236
+ {
237
+ "FIPS": "02050",
238
+ "YEAR": "2020",
239
+ "VALUE": 250
240
+ }
241
+ ],
242
+ "formattedData": [
243
+ {
244
+ "FIPS": "02261",
245
+ "YEAR": "2019",
246
+ "VALUE": "100"
247
+ },
248
+ {
249
+ "FIPS": "02290",
250
+ "YEAR": "2019",
251
+ "VALUE": "150"
252
+ },
253
+ {
254
+ "FIPS": "02185",
255
+ "YEAR": "2019",
256
+ "VALUE": "200"
257
+ },
258
+ {
259
+ "FIPS": "02050",
260
+ "YEAR": "2019",
261
+ "VALUE": "250"
262
+ },
263
+ {
264
+ "FIPS": "02063",
265
+ "YEAR": "2020",
266
+ "VALUE": "50"
267
+ },
268
+ {
269
+ "FIPS": "02066",
270
+ "YEAR": "2020",
271
+ "VALUE": "100"
272
+ },
273
+ {
274
+ "FIPS": "02290",
275
+ "YEAR": "2020",
276
+ "VALUE": "150"
277
+ },
278
+ {
279
+ "FIPS": "02185",
280
+ "YEAR": "2020",
281
+ "VALUE": "200"
282
+ },
283
+ {
284
+ "FIPS": "02050",
285
+ "YEAR": "2020",
286
+ "VALUE": "250"
287
+ }
288
+ ],
289
+ "datasets": {}
290
+ }