@cdc/map 4.23.2 → 4.23.4

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 (36) hide show
  1. package/dist/cdcmap.js +24661 -24191
  2. package/examples/custom-map-layers.json +764 -0
  3. package/examples/default-county.json +169 -155
  4. package/examples/default-geocode.json +744 -744
  5. package/examples/default-hex.json +3 -5
  6. package/examples/example-city-state-no-territories.json +703 -0
  7. package/examples/example-city-state.json +26 -7
  8. package/examples/example-city-stateBAD.json +744 -0
  9. package/examples/gallery/city-state.json +478 -478
  10. package/examples/testing-layer-2.json +1 -0
  11. package/examples/testing-layer.json +96 -0
  12. package/examples/world-geocode-data.json +18 -0
  13. package/examples/world-geocode.json +108 -0
  14. package/index.html +35 -29
  15. package/package.json +6 -3
  16. package/src/CdcMap.jsx +179 -111
  17. package/src/components/CityList.jsx +35 -35
  18. package/src/components/CountyMap.jsx +309 -446
  19. package/src/components/DataTable.jsx +7 -31
  20. package/src/components/EditorPanel.jsx +468 -217
  21. package/src/components/Sidebar.jsx +2 -0
  22. package/src/components/UsaMap.jsx +34 -23
  23. package/src/components/WorldMap.jsx +40 -8
  24. package/src/data/feature-test.json +73 -0
  25. package/src/data/initial-state.js +10 -3
  26. package/src/data/supported-geos.js +7 -7
  27. package/src/hooks/useMapLayers.jsx +243 -0
  28. package/src/index.jsx +4 -8
  29. package/src/scss/editor-panel.scss +97 -97
  30. package/src/scss/filters.scss +0 -2
  31. package/src/scss/main.scss +25 -26
  32. package/src/scss/map.scss +12 -0
  33. package/src/test/CdcMap.test.jsx +19 -0
  34. package/vite.config.js +3 -3
  35. package/src/components/Filters.jsx +0 -113
  36. package/src/hooks/useColorPalette.ts +0 -88
@@ -0,0 +1 @@
1
+ {"type":"Topology","arcs":[[[0,96],[101,-7],[-1,-89],[-87,12],[-13,84]]],"transform":{"scale":[0.13053063168316828,0.06265089895833335],"translate":[-105.5395304,42.6239805]},"objects":{"Untitled layer (2)":{"type":"GeometryCollection","geometries":[{"arcs":[[0]],"type":"Polygon","properties":{"name":"Polygon 3","styleUrl":"#poly-000000-1200-77-nodesc","fill-opacity":0.30196078431372547,"fill":"#000000","stroke-opacity":1,"stroke":"#000000","stroke-width":1.2}}]}}}
@@ -0,0 +1,96 @@
1
+ {
2
+ "type": "Topology",
3
+ "arcs": [
4
+ [
5
+ [
6
+ 129,
7
+ 163
8
+ ],
9
+ [
10
+ 14,
11
+ -127
12
+ ],
13
+ [
14
+ -143,
15
+ 114
16
+ ],
17
+ [
18
+ 129,
19
+ 13
20
+ ]
21
+ ],
22
+ [
23
+ [
24
+ 245,
25
+ 0
26
+ ],
27
+ [
28
+ -14,
29
+ 49
30
+ ],
31
+ [
32
+ 23,
33
+ -2
34
+ ],
35
+ [
36
+ 9,
37
+ -42
38
+ ],
39
+ [
40
+ -18,
41
+ -5
42
+ ]
43
+ ]
44
+ ],
45
+ "transform": {
46
+ "scale": [
47
+ 0.13050833117870725,
48
+ 0.06478136993865032
49
+ ],
50
+ "translate": [
51
+ -116.2166096,
52
+ 31.6689211
53
+ ]
54
+ },
55
+ "objects": {
56
+ "cove": {
57
+ "type": "GeometryCollection",
58
+ "geometries": [
59
+ {
60
+ "arcs": [
61
+ [
62
+ 0
63
+ ]
64
+ ],
65
+ "type": "Polygon",
66
+ "properties": {
67
+ "name": "Polygon 2",
68
+ "styleUrl": "#poly-000000-1200-77-nodesc",
69
+ "fill-opacity": 0.30196078431372547,
70
+ "fill": "blue",
71
+ "stroke-opacity": 1,
72
+ "stroke": "red",
73
+ "stroke-width": 5
74
+ }
75
+ },
76
+ {
77
+ "arcs": [
78
+ [
79
+ 1
80
+ ]
81
+ ],
82
+ "type": "Polygon",
83
+ "properties": {
84
+ "name": "Polygon 5",
85
+ "styleUrl": "#poly-000000-1200-77-nodesc",
86
+ "fill-opacity": 0.30196078431372547,
87
+ "fill": "green",
88
+ "stroke-opacity": 0,
89
+ "stroke": "#000000",
90
+ "stroke-width": 1.2
91
+ }
92
+ }
93
+ ]
94
+ }
95
+ }
96
+ }
@@ -0,0 +1,18 @@
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
+ ]
@@ -0,0 +1,108 @@
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
+ }
package/index.html CHANGED
@@ -1,39 +1,45 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
6
+ <style type="text/css">
7
+ body {
8
+ margin: 0;
9
+ }
3
10
 
4
- <head>
5
- <meta charset="utf-8" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
7
- <style type="text/css">
8
- body {
9
- margin: 0;
10
- }
11
+ .cdc-map-outer-container {
12
+ min-height: 100vh;
13
+ }
14
+ </style>
15
+ </head>
11
16
 
12
- .cdc-map-outer-container {
13
- min-height: 100vh;
14
- }
15
- </style>
16
- </head>
17
-
18
- <body>
19
- <!-- DEFAULT EXAMPLES -->
20
- <!-- <div class="react-container react-container--maps" data-config="/examples/default-county.json"></div> -->
21
- <!-- <div class="react-container react-container&#45;&#45;maps" data-config="/examples/default-geocode.json"></div>-->
17
+ <body>
18
+ <!-- DEFAULT EXAMPLES -->
19
+ <!-- <div class="react-container react-container--maps" data-config="/examples/default-county.json"></div> -->
20
+ <!-- <div class="react-container react-container&#45;&#45;maps" data-config="/examples/default-geocode.json"></div> -->
22
21
  <!-- <div class="react-container react-container&#45;&#45;maps" data-config="/examples/default-usa-regions.json"></div> -->
23
- <!-- <div class="react-container react-container&#45;&#45;maps" data-config="/examples/default-single-state.json"></div>-->
24
- <!-- <div class="react-container react-container&#45;&#45;maps" data-config="/examples/default-world.json"></div>-->
25
- <!-- <div class="react-container react-container&#45;&#45;maps" data-config="/examples/bubble-us.json"></div>-->
26
- <!-- <div class="react-container react-container&#45;&#45;maps" data-config="/examples/bubble-world.json"></div> -->
22
+ <!-- <div class="react-container react-container&#45;&#45;maps" data-config="/examples/default-single-state.json"></div> -->
23
+ <!-- <div class="react-container react-container&#45;&#45;maps" data-config="/examples/default-world.json"></div> -->
24
+ <!-- <div class="react-container react-container&#45;&#45;maps" data-config="/examples/bubble-us.json"></div>-->
25
+ <!-- <div class="react-container react-container&#45;&#45;maps" data-config="/examples/bubble-world.json"></div> -->
27
26
 
28
- <!-- TP4 EXAMPLES -->
29
- <div class="react-container react-container--maps" data-config="/examples/example-city-state.json"></div>
30
- <!-- <div class="react-container react-container--maps" data-config="/examples/example-world-map.json"></div> -->
31
- <!-- <div class="react-container react-container--maps" data-config="/examples/default-hex.json"></div> -->
27
+ <!-- TP4 EXAMPLES -->
28
+ <!-- <div class="react-container react-container--maps" data-config="/examples/example-city-state.json"></div> -->
29
+ <!-- <div class="react-container react-container--maps" data-config="/examples/custom-map-layers.json"></div> -->
30
+ <!-- <div class="react-container react-container--maps" data-config="/examples/example-city-stateBAD.json"></div> -->
31
+ <!-- <div class="react-container react-container--maps" data-config="/examples/example-world-map.json"></div> -->
32
+ <!-- <div class="react-container react-container--maps" data-config="/examples/default-hex.json"></div> -->
32
33
 
33
- <!-- <div class="react-container" data-config="/examples/example-hex-map-with-filter.json"></div> -->
34
+ <!-- TP4 EXAMPLES -->
35
+ <div class="react-container react-container--maps" data-config="/examples/example-city-state.json"></div>
36
+ <!-- <div class="react-container react-container--maps" data-config="/examples/example-city-state-no-territories.json"></div> -->
37
+ <!-- <div class="react-container react-container--maps" data-config="/examples/example-world-map.json"></div> -->
38
+ <!-- <div class="react-container react-container--maps" data-config="/examples/default-hex.json"></div> -->
34
39
 
35
- <noscript>You need to enable JavaScript to run this app.</noscript>
36
- <script type="module" src="./src/index.jsx"></script>
37
- </body>
40
+ <div class="react-container" data-config="/examples/example-hex-map-with-filter.json"></div>
38
41
 
42
+ <noscript>You need to enable JavaScript to run this app.</noscript>
43
+ <script type="module" src="./src/index.jsx"></script>
44
+ </body>
39
45
  </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdc/map",
3
- "version": "4.23.2",
3
+ "version": "4.23.4",
4
4
  "description": "React component for visualizing tabular data on a map of the United States or the world.",
5
5
  "moduleName": "CdcMap",
6
6
  "main": "dist/cdcmap",
@@ -8,6 +8,8 @@
8
8
  "scripts": {
9
9
  "start": "vite --open",
10
10
  "build": "vite build",
11
+ "test": "vitest watch --reporter verbose",
12
+ "test:ui": "vitest --ui",
11
13
  "preview": "vite preview",
12
14
  "graph": "nx graph",
13
15
  "prepublishOnly": "lerna run --scope @cdc/map build"
@@ -22,7 +24,7 @@
22
24
  },
23
25
  "license": "Apache-2.0",
24
26
  "dependencies": {
25
- "@cdc/core": "^4.23.2",
27
+ "@cdc/core": "^4.23.4",
26
28
  "@emotion/core": "^10.0.28",
27
29
  "@emotion/react": "^11.1.5",
28
30
  "@hello-pangea/dnd": "^16.2.0",
@@ -35,6 +37,7 @@
35
37
  "d3-zoom": "^3.0.0",
36
38
  "html-react-parser": "^3.0.8",
37
39
  "html2canvas": "^1.0.0-rc.7",
40
+ "lodash.debounce": "^4.0.8",
38
41
  "papaparse": "^5.3.0",
39
42
  "react-accessible-accordion": "^3.0.1",
40
43
  "react-table": "^7.5.0",
@@ -48,5 +51,5 @@
48
51
  "react": "^18.2.0",
49
52
  "react-dom": "^18.2.0"
50
53
  },
51
- "gitHead": "cd4216f47b1c41bfbc1de3b704f70c52cc7293c2"
54
+ "gitHead": "dcd395d76f70b2d113f2b4c6fe50a52522655cd1"
52
55
  }