@cdc/map 4.24.4 → 4.24.5
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 +11221 -11179
- package/index.html +2 -2
- package/package.json +3 -3
- package/src/CdcMap.tsx +3 -3
- package/src/components/BubbleList.jsx +2 -1
- package/src/components/WorldMap/{components/WorldMap.jsx → WorldMap.tsx} +8 -9
- package/src/components/WorldMap/index.tsx +1 -1
- package/src/context.ts +2 -1
package/index.html
CHANGED
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
<!-- <div class="react-container react-container--maps" data-config="/examples/test.json"></div> -->
|
|
34
34
|
<!-- <div class="react-container react-container--maps" data-config="/examples/default-usa-regions.json"></div> -->
|
|
35
35
|
<!-- <div class="react-container react-container--maps" data-config="/examples/default-usa.json"></div> -->
|
|
36
|
-
<div class="react-container react-container--maps" data-config="https://www.cdc.gov/wcms/4.0/cdc-wp/data-presentation/examples/US-County-Level-Map.json"></div>
|
|
36
|
+
<!-- <div class="react-container react-container--maps" data-config="https://www.cdc.gov/wcms/4.0/cdc-wp/data-presentation/examples/US-County-Level-Map.json"></div> -->
|
|
37
37
|
<!-- <div class="react-container react-container--maps" data-config="/examples/default-geocode.json"></div> -->
|
|
38
38
|
<!-- <div class="react-container react-container--maps" data-config="/examples/default-single-state.json"></div> -->
|
|
39
|
-
|
|
39
|
+
<div class="react-container react-container--maps" data-config="/examples/bubble-us.json"></div>
|
|
40
40
|
<!-- <div class="react-container react-container--maps" data-config="/examples/bubble-world.json"></div> -->
|
|
41
41
|
|
|
42
42
|
<!-- TESTS DATA TABLE SORT-->
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cdc/map",
|
|
3
|
-
"version": "4.24.
|
|
3
|
+
"version": "4.24.5",
|
|
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",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@cdc/core": "^4.24.
|
|
27
|
+
"@cdc/core": "^4.24.5",
|
|
28
28
|
"@emotion/core": "^10.0.28",
|
|
29
29
|
"@emotion/react": "^11.1.5",
|
|
30
30
|
"@hello-pangea/dnd": "^16.2.0",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"react": "^18.2.0",
|
|
52
52
|
"react-dom": "^18.2.0"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "def85aaf4cd9dc1983e80f2900199f35de82af95"
|
|
55
55
|
}
|
package/src/CdcMap.tsx
CHANGED
|
@@ -1675,8 +1675,8 @@ const CdcMap = ({ className, config, navigationHandler: customNavigationHandler,
|
|
|
1675
1675
|
|
|
1676
1676
|
// this only shows in Dashboard config mode and only if Show Table is also set
|
|
1677
1677
|
const tableLink = (
|
|
1678
|
-
<a href={`#data-table-${state.
|
|
1679
|
-
{state.
|
|
1678
|
+
<a href={`#data-table-${state.dataKey}`} className='margin-left-href'>
|
|
1679
|
+
{state.dataKey} (Go to Table)
|
|
1680
1680
|
</a>
|
|
1681
1681
|
)
|
|
1682
1682
|
|
|
@@ -1704,7 +1704,7 @@ const CdcMap = ({ className, config, navigationHandler: customNavigationHandler,
|
|
|
1704
1704
|
{general.introText && <section className='introText'>{parse(general.introText)}</section>}
|
|
1705
1705
|
|
|
1706
1706
|
{/* prettier-ignore */}
|
|
1707
|
-
{state?.filters?.length > 0 && <Filters config={state} setConfig={setState} filteredData={runtimeFilters} setFilteredData={setRuntimeFilters} dimensions={dimensions} />}
|
|
1707
|
+
{state?.filters?.length > 0 && <Filters config={state} setConfig={setState} getUniqueValues={getUniqueValues} filteredData={runtimeFilters} setFilteredData={setRuntimeFilters} dimensions={dimensions} />}
|
|
1708
1708
|
|
|
1709
1709
|
<div
|
|
1710
1710
|
role='region'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useContext, useEffect } from 'react'
|
|
2
2
|
import { scaleLinear } from 'd3-scale'
|
|
3
3
|
import { countryCoordinates } from '../data/country-coordinates'
|
|
4
4
|
import stateCoordinates from '../data/state-coordinates'
|
|
@@ -7,6 +7,7 @@ import ConfigContext from './../../src/context'
|
|
|
7
7
|
export const BubbleList = ({ data: dataImport, state, projection, applyLegendToRow, applyTooltipsToGeo, handleCircleClick, runtimeData, displayGeoName }) => {
|
|
8
8
|
const maxDataValue = Math.max(...dataImport.map(d => d[state.columns.primary.name]))
|
|
9
9
|
const { tooltipId } = useContext(ConfigContext)
|
|
10
|
+
|
|
10
11
|
const hasBubblesWithZeroOnMap = state.visual.showBubbleZeros ? 0 : 1
|
|
11
12
|
// sort runtime data. Smaller bubbles should appear on top.
|
|
12
13
|
const sortedRuntimeData = Object.values(runtimeData).sort((a, b) => (a[state.columns.primary.name] < b[state.columns.primary.name] ? 1 : -1))
|
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import { memo, useContext } from 'react'
|
|
2
2
|
|
|
3
|
-
import { jsx } from '@emotion/react'
|
|
4
3
|
import ErrorBoundary from '@cdc/core/components/ErrorBoundary'
|
|
5
4
|
import { geoMercator } from 'd3-geo'
|
|
6
5
|
import { Mercator } from '@visx/geo'
|
|
7
6
|
import { feature } from 'topojson-client'
|
|
8
|
-
import topoJSON from '
|
|
9
|
-
import ZoomableGroup from '
|
|
10
|
-
import Geo from '
|
|
11
|
-
import CityList from '
|
|
12
|
-
import BubbleList from '
|
|
13
|
-
import ConfigContext from '
|
|
7
|
+
import topoJSON from './data/world-topo.json'
|
|
8
|
+
import ZoomableGroup from '../ZoomableGroup'
|
|
9
|
+
import Geo from '../Geo'
|
|
10
|
+
import CityList from '../CityList'
|
|
11
|
+
import BubbleList from '../BubbleList'
|
|
12
|
+
import ConfigContext from '../../context'
|
|
14
13
|
|
|
15
14
|
const { features: world } = feature(topoJSON, topoJSON.objects.countries)
|
|
16
15
|
|
|
17
16
|
let projection = geoMercator()
|
|
18
17
|
|
|
19
|
-
const WorldMap =
|
|
18
|
+
const WorldMap = () => {
|
|
20
19
|
// prettier-ignore
|
|
21
20
|
const {
|
|
22
21
|
applyLegendToRow,
|
|
@@ -127,7 +126,7 @@ const WorldMap = props => {
|
|
|
127
126
|
|
|
128
127
|
const geoStrokeColor = state.general.geoBorderColor === 'darkGray' ? 'rgba(0, 0, 0, 0.2)' : 'rgba(255,255,255,0.7)'
|
|
129
128
|
|
|
130
|
-
let styles = {
|
|
129
|
+
let styles: Record<string, string | Record<string, string>> = {
|
|
131
130
|
fill: '#E6E6E6',
|
|
132
131
|
cursor: 'default'
|
|
133
132
|
}
|
package/src/context.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createContext } from 'react'
|
|
2
|
-
import { MapConfig } from './MapConfig'
|
|
2
|
+
import { MapConfig } from './types/MapConfig'
|
|
3
3
|
|
|
4
4
|
type MapContext = {
|
|
5
5
|
applyLegendToRow
|
|
@@ -42,6 +42,7 @@ type MapContext = {
|
|
|
42
42
|
supportedCountries
|
|
43
43
|
supportedTerritories
|
|
44
44
|
titleCase
|
|
45
|
+
tooltipId: string
|
|
45
46
|
viewport
|
|
46
47
|
}
|
|
47
48
|
|