@cdc/map 4.25.3 → 4.25.6

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 (119) hide show
  1. package/.idea/map.iml +12 -0
  2. package/.idea/modules.xml +8 -0
  3. package/.idea/vcs.xml +6 -0
  4. package/dist/cdcmap.js +31254 -32242
  5. package/examples/hex-colors.json +3 -3
  6. package/examples/m2.json +32904 -0
  7. package/examples/private/test.json +470 -1457
  8. package/examples/private/{mmr.json → wastewatermap.json} +86 -115
  9. package/index.html +36 -63
  10. package/package.json +7 -19
  11. package/src/CdcMap.tsx +56 -1552
  12. package/src/CdcMapComponent.tsx +608 -0
  13. package/src/_stories/CdcMap.Legend.Gradient.stories.tsx +10 -0
  14. package/src/_stories/CdcMap.Legend.stories.tsx +67 -0
  15. package/src/_stories/CdcMap.Table.stories.tsx +19 -0
  16. package/src/_stories/CdcMap.stories.tsx +12 -1
  17. package/src/_stories/UsaMap.NoData.stories.tsx +4 -4
  18. package/src/_stories/_mock/default-patterns.json +8 -5
  19. package/src/_stories/_mock/legend-bins.json +428 -0
  20. package/{examples/private/default-patterns.json → src/_stories/_mock/legends/legend-tests.json} +36 -131
  21. package/src/cdcMapComponent.styles.css +9 -0
  22. package/src/components/Annotation/Annotation.Draggable.tsx +27 -26
  23. package/src/components/Annotation/AnnotationDropdown.tsx +5 -6
  24. package/src/components/BubbleList.tsx +135 -49
  25. package/src/components/CityList.tsx +89 -87
  26. package/src/components/DataTable.tsx +8 -8
  27. package/src/components/EditorPanel/components/EditorPanel.tsx +823 -885
  28. package/src/components/EditorPanel/components/Error.tsx +9 -2
  29. package/src/components/EditorPanel/components/HexShapeSettings.tsx +127 -141
  30. package/src/components/EditorPanel/components/Panels/Panel.Annotate.tsx +55 -86
  31. package/src/components/EditorPanel/components/Panels/Panel.PatternSettings.tsx +89 -75
  32. package/src/components/EditorPanel/components/editorPanel.styles.css +95 -0
  33. package/src/components/Geo.tsx +9 -1
  34. package/src/components/GoogleMap/components/GoogleMap.tsx +1 -1
  35. package/src/components/Legend/components/Legend.tsx +92 -87
  36. package/src/components/Legend/components/LegendGroup/Legend.Group.tsx +128 -0
  37. package/src/components/Legend/components/LegendGroup/legend.group.css +27 -0
  38. package/src/components/Legend/components/LegendItem.Hex.tsx +4 -1
  39. package/src/components/Legend/components/index.scss +74 -17
  40. package/src/components/Modal.tsx +17 -7
  41. package/src/components/NavigationMenu.tsx +11 -9
  42. package/src/components/UsaMap/components/SingleState/SingleState.CountyOutput.tsx +12 -8
  43. package/src/components/UsaMap/components/SingleState/SingleState.StateOutput.tsx +4 -4
  44. package/src/components/UsaMap/components/TerritoriesSection.tsx +33 -10
  45. package/src/components/UsaMap/components/Territory/Territory.Hexagon.tsx +12 -10
  46. package/src/components/UsaMap/components/Territory/Territory.Rectangle.tsx +12 -14
  47. package/src/components/UsaMap/components/Territory/TerritoryShape.ts +2 -1
  48. package/src/components/UsaMap/components/UsaMap.County.tsx +138 -96
  49. package/src/components/UsaMap/components/UsaMap.Region.styles.css +72 -0
  50. package/src/components/UsaMap/components/UsaMap.Region.tsx +56 -103
  51. package/src/components/UsaMap/components/UsaMap.SingleState.styles.css +10 -0
  52. package/src/components/UsaMap/components/UsaMap.SingleState.tsx +65 -74
  53. package/src/components/UsaMap/components/UsaMap.State.tsx +112 -91
  54. package/src/components/UsaMap/helpers/map.ts +1 -1
  55. package/src/components/UsaMap/helpers/shapes.ts +20 -7
  56. package/src/components/WorldMap/WorldMap.tsx +64 -118
  57. package/src/components/WorldMap/worldMap.styles.css +28 -0
  58. package/src/components/ZoomControls.tsx +15 -13
  59. package/src/components/zoomControls.styles.css +53 -0
  60. package/src/context.ts +17 -9
  61. package/src/data/initial-state.js +5 -2
  62. package/src/helpers/addUIDs.ts +150 -0
  63. package/src/helpers/applyColorToLegend.ts +39 -64
  64. package/src/helpers/applyLegendToRow.ts +51 -0
  65. package/src/helpers/colorDistributions.ts +12 -0
  66. package/src/helpers/constants.ts +44 -0
  67. package/src/helpers/displayGeoName.ts +9 -2
  68. package/src/helpers/formatLegendLocation.ts +3 -2
  69. package/src/helpers/generateColorsArray.ts +2 -1
  70. package/src/helpers/generateRuntimeData.ts +78 -0
  71. package/src/helpers/generateRuntimeFilters.ts +63 -0
  72. package/src/helpers/generateRuntimeLegend.ts +566 -0
  73. package/src/helpers/generateRuntimeLegendHash.ts +16 -15
  74. package/src/helpers/getColumnNames.ts +19 -0
  75. package/src/helpers/getMapContainerClasses.ts +23 -0
  76. package/src/helpers/getStatePicked.ts +8 -0
  77. package/src/helpers/handleMapTabbing.ts +31 -0
  78. package/src/helpers/hashObj.ts +1 -1
  79. package/src/helpers/index.ts +22 -0
  80. package/src/helpers/navigationHandler.ts +3 -3
  81. package/src/helpers/resetLegendToggles.ts +13 -0
  82. package/src/helpers/setBinNumbers.ts +5 -0
  83. package/src/helpers/sortSpecialClassesLast.ts +7 -0
  84. package/src/helpers/tests/getColumnNames.test.ts +52 -0
  85. package/src/helpers/titleCase.ts +1 -1
  86. package/src/helpers/toggleLegendActive.ts +25 -0
  87. package/src/hooks/useApplyTooltipsToGeo.tsx +51 -0
  88. package/src/hooks/useColumnsRequiredChecker.ts +51 -0
  89. package/src/hooks/useGeoClickHandler.ts +45 -0
  90. package/src/hooks/useLegendSeparators.ts +26 -0
  91. package/src/hooks/useMapLayers.tsx +34 -60
  92. package/src/hooks/useModal.ts +22 -0
  93. package/src/hooks/useResizeObserver.ts +4 -5
  94. package/src/hooks/useStateZoom.tsx +52 -75
  95. package/src/hooks/useTooltip.ts +2 -3
  96. package/src/index.jsx +3 -9
  97. package/src/scss/editor-panel.scss +3 -99
  98. package/src/scss/main.scss +1 -19
  99. package/src/scss/map.scss +15 -220
  100. package/src/store/map.actions.ts +46 -0
  101. package/src/store/map.reducer.ts +96 -0
  102. package/src/types/Annotations.ts +24 -0
  103. package/src/types/MapConfig.ts +23 -3
  104. package/src/types/MapContext.ts +36 -35
  105. package/src/types/Modal.ts +1 -0
  106. package/src/types/RuntimeData.ts +3 -0
  107. package/examples/private/DEV-9644.json +0 -184
  108. package/examples/private/DEV-9989.json +0 -229
  109. package/examples/private/ardi.json +0 -180
  110. package/examples/private/colors 2.json +0 -416
  111. package/examples/private/colors.json +0 -416
  112. package/examples/private/colors.json.zip +0 -0
  113. package/examples/private/customColors.json +0 -45348
  114. package/examples/test.json +0 -183
  115. package/src/helpers/closeModal.ts +0 -9
  116. package/src/scss/btn.scss +0 -69
  117. package/src/scss/filters.scss +0 -27
  118. package/src/scss/variables.scss +0 -1
  119. /package/src/hooks/{useActiveElement.js → useActiveElement.ts} +0 -0
@@ -1,229 +0,0 @@
1
- {
2
- "annotations": [],
3
- "general": {
4
- "geoType": "world",
5
- "type": "data",
6
- "noStateFoundMessage": "Map Unavailable",
7
- "annotationDropdownText": "Annotations",
8
- "geoBorderColor": "darkGray",
9
- "headerColor": "theme-blue",
10
- "title": "Outbreaks Map",
11
- "showTitle": true,
12
- "showSidebar": false,
13
- "showDownloadButton": false,
14
- "showDownloadMediaButton": false,
15
- "displayAsHex": false,
16
- "displayStateLabels": false,
17
- "territoriesLabel": "Territories",
18
- "territoriesAlwaysShow": false,
19
- "language": "en",
20
- "geoLabelOverride": "Country",
21
- "hasRegions": false,
22
- "fullBorder": false,
23
- "convertFipsCodes": true,
24
- "palette": {
25
- "isReversed": false
26
- },
27
- "allowMapZoom": true,
28
- "hideGeoColumnInTooltip": false,
29
- "hidePrimaryColumnInTooltip": false,
30
- "statePicked": {
31
- "fipsCode": "01",
32
- "stateName": "Alabama"
33
- }
34
- },
35
- "type": "map",
36
- "color": "colorblindsafe",
37
- "columns": {
38
- "geo": {
39
- "name": "Country",
40
- "label": "Location",
41
- "tooltip": false,
42
- "dataTable": true
43
- },
44
- "primary": {
45
- "dataTable": false,
46
- "tooltip": false,
47
- "prefix": "",
48
- "suffix": "",
49
- "name": "Country",
50
- "label": "",
51
- "roundToPlace": 0
52
- },
53
- "navigate": {
54
- "name": ""
55
- },
56
- "latitude": {
57
- "name": ""
58
- },
59
- "longitude": {
60
- "name": ""
61
- },
62
- "additionalColumn1": {
63
- "label": "Disease",
64
- "dataTable": true,
65
- "tooltips": false,
66
- "prefix": "",
67
- "suffix": "",
68
- "name": "Disease ",
69
- "tooltip": true
70
- },
71
- "additionalColumn2": {
72
- "label": "Outbreak",
73
- "dataTable": true,
74
- "tooltips": false,
75
- "prefix": "",
76
- "suffix": "",
77
- "name": "Outbreak Description",
78
- "tooltip": true
79
- }
80
- },
81
- "legend": {
82
- "descriptions": {},
83
- "specialClasses": [],
84
- "unified": false,
85
- "singleColumn": false,
86
- "dynamicDescription": false,
87
- "type": "category",
88
- "numberOfItems": 3,
89
- "position": "bottom",
90
- "title": "Legend",
91
- "singleRow": false,
92
- "verticalSorted": false,
93
- "showSpecialClassesLast": false,
94
- "style": "circles",
95
- "subStyle": "linear blocks",
96
- "tickRotation": "",
97
- "singleColumnLegend": false,
98
- "hideBorder": false
99
- },
100
- "filters": [],
101
- "table": {
102
- "wrapColumns": false,
103
- "label": "Data Table",
104
- "expanded": false,
105
- "limitHeight": false,
106
- "height": "",
107
- "caption": "",
108
- "showDownloadUrl": false,
109
- "showDataTableLink": true,
110
- "showFullGeoNameInCSV": false,
111
- "forceDisplay": true,
112
- "download": true,
113
- "indexLabel": "",
114
- "showDownloadLinkBelow": true
115
- },
116
- "tooltips": {
117
- "appearanceType": "click",
118
- "linkLabel": "Learn More",
119
- "capitalizeLabels": false,
120
- "opacity": 90
121
- },
122
- "runtime": {
123
- "editorErrorMessage": []
124
- },
125
- "visual": {
126
- "minBubbleSize": 1,
127
- "maxBubbleSize": 20,
128
- "extraBubbleBorder": false,
129
- "cityStyle": "circle",
130
- "geoCodeCircleSize": 2,
131
- "showBubbleZeros": false,
132
- "cityStyleLabel": "",
133
- "additionalCityStyles": []
134
- },
135
- "mapPosition": {
136
- "coordinates": [
137
- 0,
138
- 30
139
- ],
140
- "zoom": 1
141
- },
142
- "map": {
143
- "layers": [],
144
- "patterns": []
145
- },
146
- "hexMap": {
147
- "type": "",
148
- "shapeGroups": [
149
- {
150
- "legendTitle": "",
151
- "legendDescription": "",
152
- "items": [
153
- {
154
- "key": "",
155
- "shape": "Arrow up",
156
- "column": "",
157
- "operator": "=",
158
- "value": ""
159
- }
160
- ]
161
- }
162
- ]
163
- },
164
- "filterBehavior": "Filter Change",
165
- "filterIntro": "",
166
- "dataTable": {
167
- "title": "Country List",
168
- "forceDisplay": false
169
- },
170
- "data": [
171
- {
172
- "Country": "Democratic Republic of the Congo",
173
- "Disease ": "Mpox",
174
- "Outbreak Description": "In 2024, the outbreak of clade I mpox across Central and Eastern Africa was declared a Public Health Emergency of International Concern by WHO. CDCs longstanding work in the Democratic Republic of the Congo (DRC) including building diagnostic capacity and training disease detectives � helped detect clade I soon after it first appeared. CDC is working with other U.S. Government agencies, international, and in-country partners in affected countries to improve surveillance, emergency management, contact investigations, vaccine distribution, case management, laboratory capacity, and infection prevention and control, while sharing guidance and deploying subject matter experts across multiple response pillars. CDC also helped U.S. systems prepare for and rapidly detect imported cases, which happened successfully when a clade I mpox case was reported in November in California. "
175
- },
176
- {
177
- "Country": "Cambodia",
178
- "Disease ": "H5N1 Bird flu",
179
- "Outbreak Description": "Repeated outbreaks of H5N1 bird flu in Asia pose a potential risk to the U.S. and the world. CDCs influenza experts have worked globally for 20 plus years, including daily global monitoring of bird flu. When we detect unusual activity, we investigate through global partnerships.?CDC�s work to strengthen surveillance and labs, train responders, and grow strong relationships has been essential to robust responses to recent outbreaks in Cambodia and Vietnam. This work is also essential to getting ahead of threats to the health and safety of Americans. CDC is also the lead for human health in the current U.S. Government response to H5N1 in dairy cows and other animals, and we share what we learn back with our global partners."
180
- },
181
- {
182
- "Country": "Palestine",
183
- "Disease ": "Polio",
184
- "Outbreak Description": "For the first time in nearly 20 years, polio was detected in Gaza in 2024.?Polio anywhere represents a threat everywhere. When positive samples were identified in July, CDC quickly sprang into action through its partners in the Global Polio Eradication Initiative to plan and implement a response. CDC worked with USG partners to help negotiate a pause in the fighting for a critical vaccination campaign. In September, over 95% of the eligible children in Gaza were vaccinated for polio, despite the ongoing conflict. Quick responses to outbreaks are essential to reaching our goal of a polio-free world."
185
- },
186
- {
187
- "Country": "United States",
188
- "Disease ": "Dengue",
189
- "Outbreak Description": "In 2024, more than 12 million dengue cases have been reported, making it the highest year on record. This caused a higher number of cases in travelers to those areas, increasing the risk of importation to the United States. Local transmission of dengue has also been reported in 2024 in Florida, California, and Texas. CDC activated its dengue response to support Puerto Rico and prepare for increased transmission in other areas of the United States, working closely with state and local health officials to respond to the current outbreaks while providing technical assistance and support in epidemiology, vector control, clinical management, and diagnostics.�"
190
- },
191
- {
192
- "Country": "United States",
193
- "Disease ": "Oropuche",
194
- "Outbreak Description": "Oropouche virus is an emerging vector-borne disease with symptoms similar to dengue. In late 2023 and 2024, Oropouche began to spread to areas outside the Amazon basin. Travel-related cases also began appearing in the United States. In some cases, infection during pregnancy was associated with fetal death and possible birth defects. In September, CDC released new clinical tests that can diagnose Oropouche virus infection earlier in the illness and help clinicians provide appropriate care for pregnant patients and their infants. CDC also expanded its ArboNET system to pick up cases in the U.S. and has been working with partner countries to clarify the risks during pregnancy and potential harm to unborn babies. "
195
- },
196
- {
197
- "Country": "Belize",
198
- "Disease ": "New World Screwworm",
199
- "Outbreak Description": "In 2024, CDC initiated a human health response to an incursion of New World Screwworm (NWS) flies in Central America. Previously eliminated from North America, this health threat poses a significant economic and veterinary concern, as the fly larvae largely target cows. In partnership with the U.S. Department of Agriculture and Department of State, CDC developed and shared human health information on the prevention, detection, and clinical management of NWS. CDC�s parasitic morphology lab serves as the primary center for species confirmation of the NWS larvae. "
200
- },
201
- {
202
- "Country": "Brazil",
203
- "Disease ": "Measles",
204
- "Outbreak Description": " In 2024, WHO reported that global measles cases surged to ~10.3 million in 2023, a 20% increase from the previous year, with 57 countries reporting large outbreaks. Travel-related measles cases continue to impact the United States and create an ongoing risk. But 2024 also brought hopeful news: CDC is part of a longstanding partnership with PAHO that helped Brazil achieve measles elimination. This key milestone restored the Americas as the only WHO region to eliminate measles. "
205
- },
206
- {
207
- "Country": "Rwanda",
208
- "Disease ": "Marburg",
209
- "Outbreak Description": "In September 2024, Rwanda reported their first recorded outbreak of Marburg virus disease (Marburg), a rare, severe viral hemorrhagic fever that can have up to a 90% fatality rate. CDC has a longstanding presence in Rwanda, with a country office there since 2002. In addition, CDC deployed subject matter experts to support the response to Marburg within 72 hours of being notified of the outbreak by the Government of Rwanda. CDC team members are partnering with Rwandan health authorities and members of interagency Marburg response pillars � infection prevention and control, laboratory, and surveillance (for which CDC is the co-lead) � to contain the outbreak, protect lives and strengthen core public health capabilities. "
210
- }
211
- ],
212
- "dataFileName": "Outbreaks-Map_Test_12-02-2024_04_minus.csv",
213
- "dataFileSourceType": "file",
214
- "validated": 4.23,
215
- "version": "4.24.10",
216
- "id": 21,
217
- "category": "Maps",
218
- "label": "World",
219
- "subType": "world",
220
- "icon": {
221
- "key": null,
222
- "ref": null,
223
- "props": {},
224
- "_owner": null
225
- },
226
- "content": "Present a choropleth map of the world.",
227
- "datasets": {},
228
- "activeVizButtonID": 21
229
- }
@@ -1,180 +0,0 @@
1
- {
2
- "annotations": [],
3
- "general": {
4
- "noStateFoundMessage": "Map Unavailable",
5
- "annotationDropdownText": "Annotations",
6
- "geoBorderColor": "darkGray",
7
- "headerColor": "theme-blue",
8
- "title": "",
9
- "showTitle": true,
10
- "showSidebar": true,
11
- "showDownloadButton": true,
12
- "showDownloadMediaButton": false,
13
- "displayAsHex": false,
14
- "displayStateLabels": false,
15
- "territoriesLabel": "Territories",
16
- "territoriesAlwaysShow": false,
17
- "language": "en",
18
- "geoType": "us",
19
- "geoLabelOverride": "",
20
- "hasRegions": false,
21
- "fullBorder": false,
22
- "type": "map",
23
- "convertFipsCodes": true,
24
- "palette": {
25
- "isReversed": false
26
- },
27
- "allowMapZoom": false,
28
- "hideGeoColumnInTooltip": false,
29
- "hidePrimaryColumnInTooltip": false,
30
- "statePicked": {
31
- "fipsCode": "01",
32
- "stateName": "Alabama"
33
- },
34
- "expandDataTable": false,
35
- "subtext": "<div class=\"text-left\">Data last updated on <span data-timestamp=\"ARIBaselineMetricMap:Data_as_of\"></span> and presented through <span data-timestamp=\"ARIBaselineMetricMap:Data_Presented_Through\"></span>. <a href=\"https://data.cdc.gov/Public-Health-Surveillance/Level-of-Acute-Respiratory-Illness-ARI-Activity-by/f3zz-zga5/about_data\">View this dataset</a> on data.cdc.gov.</div>"
36
- },
37
- "type": "map",
38
- "color": "pinkpurple",
39
- "columns": {
40
- "geo": {
41
- "name": "geography",
42
- "label": "Location",
43
- "tooltip": false,
44
- "dataTable": true
45
- },
46
- "primary": {
47
- "dataTable": true,
48
- "tooltip": true,
49
- "prefix": "",
50
- "suffix": "",
51
- "name": "label",
52
- "label": "Respiratory Illness Level",
53
- "roundToPlace": 0
54
- },
55
- "navigate": {
56
- "name": ""
57
- },
58
- "latitude": {
59
- "name": ""
60
- },
61
- "longitude": {
62
- "name": ""
63
- }
64
- },
65
- "legend": {
66
- "descriptions": {},
67
- "specialClasses": [],
68
- "unified": false,
69
- "singleColumn": false,
70
- "singleRow": true,
71
- "verticalSorted": false,
72
- "showSpecialClassesLast": false,
73
- "dynamicDescription": false,
74
- "type": "category",
75
- "numberOfItems": 3,
76
- "position": "top",
77
- "title": "Acute Respiratory Illness",
78
- "style": "gradient",
79
- "subStyle": "linear blocks",
80
- "tickRotation": "",
81
- "singleColumnLegend": false,
82
- "hideBorder": true,
83
- "categoryValuesOrder": [
84
- "Minimal",
85
- "Low",
86
- "Moderate",
87
- "High",
88
- "Very High",
89
- "Data Unavailable"
90
- ],
91
- "additionalCategories": [
92
- "Data Unavailable",
93
- "Minimal",
94
- "Low",
95
- "Moderate",
96
- "High",
97
- "Very High"
98
- ]
99
- },
100
- "filters": [],
101
- "table": {
102
- "wrapColumns": false,
103
- "label": "Data Table",
104
- "expanded": false,
105
- "limitHeight": false,
106
- "height": "",
107
- "caption": "",
108
- "showDownloadUrl": false,
109
- "showDataTableLink": true,
110
- "showFullGeoNameInCSV": false,
111
- "forceDisplay": true,
112
- "download": true,
113
- "indexLabel": "",
114
- "showDownloadLinkBelow": true
115
- },
116
- "tooltips": {
117
- "appearanceType": "hover",
118
- "linkLabel": "Learn More",
119
- "capitalizeLabels": true,
120
- "opacity": 90
121
- },
122
- "visual": {
123
- "minBubbleSize": 1,
124
- "maxBubbleSize": 20,
125
- "extraBubbleBorder": false,
126
- "cityStyle": "circle",
127
- "cityStyleLabel": "",
128
- "showBubbleZeros": false,
129
- "additionalCityStyles": [],
130
- "geoCodeCircleSize": "5"
131
- },
132
- "mapPosition": {
133
- "coordinates": [
134
- 0,
135
- 30
136
- ],
137
- "zoom": 1
138
- },
139
- "map": {
140
- "layers": [],
141
- "patterns": []
142
- },
143
- "hexMap": {
144
- "type": "",
145
- "shapeGroups": [
146
- {
147
- "legendTitle": "",
148
- "legendDescription": "",
149
- "items": [
150
- {
151
- "key": "",
152
- "shape": "Arrow Up",
153
- "column": "",
154
- "operator": "=",
155
- "value": ""
156
- }
157
- ]
158
- }
159
- ]
160
- },
161
- "filterBehavior": "Filter Change",
162
- "dataFileName": "https://www.cdc.gov/wcms/vizdata/Respitory_Viruses/ARIBaselineMetricMap.json",
163
- "customColors": [
164
- "#D7F2ED",
165
- "#D7F2ED",
166
- "#B8E5AC",
167
- "#FEA82F",
168
- "#F45B53",
169
- "#A03169",
170
- "#EBEBEB",
171
- "#EBEBEB"
172
- ],
173
- "dataFileSourceType": "url",
174
- "dataDescription": {
175
- "horizontal": false,
176
- "series": false
177
- },
178
- "version": "4.24.10",
179
- "dataUrl": "https://www.cdc.gov/wcms/vizdata/Respitory_Viruses/ARIBaselineMetricMap.json"
180
- }