@cdc/map 2.6.4 → 9.22.9
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 +22 -16
- package/examples/default-county.json +64 -12
- package/examples/default-hex.json +3 -1
- package/examples/example-city-state.json +10 -1
- package/examples/gallery/categorical-qualitative.json +797 -0
- package/examples/gallery/categorical-scale-based.json +739 -0
- package/examples/gallery/city-state.json +479 -0
- package/examples/gallery/county.json +22731 -0
- package/examples/gallery/equal-interval.json +1027 -0
- package/examples/gallery/equal-number.json +1027 -0
- package/examples/gallery/filterable.json +909 -0
- package/examples/gallery/hex-filtered.json +420 -0
- package/examples/gallery/hex.json +413 -0
- package/examples/gallery/single-state.json +21402 -0
- package/examples/gallery/world.json +1592 -0
- package/examples/private/city-state.json +428 -0
- package/examples/private/cty-issue.json +42768 -0
- package/examples/private/default-usa.json +460 -0
- package/examples/private/legend-issue.json +1 -0
- package/examples/private/map-rounding-error.json +42759 -0
- package/examples/private/monkeypox.json +376 -0
- package/examples/private/valid-data-map.csv +59 -0
- package/examples/private/wcmsrd-14492-data.json +292 -0
- package/examples/private/wcmsrd-14492.json +114 -0
- package/package.json +3 -3
- package/src/CdcMap.js +204 -127
- package/src/components/BubbleList.js +9 -5
- package/src/components/CityList.js +22 -4
- package/src/components/CountyMap.js +13 -4
- package/src/components/DataTable.js +9 -9
- package/src/components/EditorPanel.js +239 -121
- package/src/components/Modal.js +2 -1
- package/src/components/NavigationMenu.js +4 -3
- package/src/components/Sidebar.js +14 -19
- package/src/components/SingleStateMap.js +10 -4
- package/src/components/UsaMap.js +82 -30
- package/src/components/UsaRegionMap.js +3 -2
- package/src/components/WorldMap.js +7 -2
- package/src/data/{dfc-map.json → county-map.json} +0 -0
- package/src/data/initial-state.js +2 -1
- package/src/data/supported-geos.js +5 -0
- package/src/index.html +3 -8
- package/src/scss/editor-panel.scss +2 -2
- package/src/scss/main.scss +1 -1
- package/src/scss/map.scss +4 -0
- package/src/scss/sidebar.scss +2 -1
|
@@ -12,7 +12,9 @@ const CityList = (({
|
|
|
12
12
|
displayGeoName,
|
|
13
13
|
applyLegendToRow,
|
|
14
14
|
projection,
|
|
15
|
-
titleCase
|
|
15
|
+
titleCase,
|
|
16
|
+
setSharedFilterValue,
|
|
17
|
+
isFilterValueSupported
|
|
16
18
|
}) => {
|
|
17
19
|
const [citiesData, setCitiesData] = useState({});
|
|
18
20
|
|
|
@@ -51,8 +53,8 @@ const CityList = (({
|
|
|
51
53
|
|
|
52
54
|
const styles = {
|
|
53
55
|
fill: legendColors[0],
|
|
54
|
-
|
|
55
|
-
stroke: 'rgba(0, 0, 0, 0.4)',
|
|
56
|
+
opacity: setSharedFilterValue && isFilterValueSupported && data[city][state.columns.geo.name] !== setSharedFilterValue ? .5 : 1,
|
|
57
|
+
stroke: setSharedFilterValue && isFilterValueSupported && data[city][state.columns.geo.name] === setSharedFilterValue ? 'rgba(0, 0, 0, 1)' : 'rgba(0, 0, 0, 0.4)',
|
|
56
58
|
'&:hover': {
|
|
57
59
|
fill: legendColors[1],
|
|
58
60
|
outline: 0
|
|
@@ -91,6 +93,21 @@ const CityList = (({
|
|
|
91
93
|
/>
|
|
92
94
|
);
|
|
93
95
|
|
|
96
|
+
const pin = (
|
|
97
|
+
<path
|
|
98
|
+
className="marker"
|
|
99
|
+
d="M0,0l-8.8-17.7C-12.1-24.3-7.4-32,0-32h0c7.4,0,12.1,7.7,8.8,14.3L0,0z"
|
|
100
|
+
title="Click for more information"
|
|
101
|
+
onClick={() => geoClickHandler(cityDisplayName, geoData)}
|
|
102
|
+
data-tip={toolTip}
|
|
103
|
+
data-for="tooltip"
|
|
104
|
+
strokeWidth={2}
|
|
105
|
+
stroke={'black'}
|
|
106
|
+
{...additionalProps}
|
|
107
|
+
>
|
|
108
|
+
</path>
|
|
109
|
+
);
|
|
110
|
+
|
|
94
111
|
let transform = `translate(${projection(supportedCities[city])})`
|
|
95
112
|
|
|
96
113
|
return (
|
|
@@ -100,7 +117,8 @@ const CityList = (({
|
|
|
100
117
|
css={styles}
|
|
101
118
|
className="geo-point"
|
|
102
119
|
>
|
|
103
|
-
{circle}
|
|
120
|
+
{state.visual.cityStyle === 'circle' && circle }
|
|
121
|
+
{state.visual.cityStyle === 'pin' && pin }
|
|
104
122
|
</g>
|
|
105
123
|
);
|
|
106
124
|
});
|
|
@@ -8,7 +8,7 @@ import { feature, mesh } from 'topojson-client';
|
|
|
8
8
|
import { CustomProjection } from '@visx/geo';
|
|
9
9
|
import colorPalettes from '../../../core/data/colorPalettes'
|
|
10
10
|
import { geoAlbersUsaTerritories } from 'd3-composite-projections';
|
|
11
|
-
import testJSON from '../data/
|
|
11
|
+
import testJSON from '../data/county-map.json';
|
|
12
12
|
import { abbrs } from '../data/abbreviations';
|
|
13
13
|
|
|
14
14
|
const offsets = {
|
|
@@ -58,17 +58,17 @@ const nudges = {
|
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
function CountyMapChecks(prevState, nextState) {
|
|
61
|
+
const equalNumberOptIn = prevState.state.general.equalNumberOptIn && nextState.state.general.equalNumberOptIn;
|
|
61
62
|
const equalColumnName = prevState.state.general.type && nextState.state.general.type;
|
|
62
63
|
const equalNavColumn = prevState.state.columns.navigate && nextState.state.columns.navigate;
|
|
63
64
|
const equalLegend = prevState.runtimeLegend === nextState.runtimeLegend;
|
|
64
65
|
const equalBorderColors = prevState.state.general.geoBorderColor === nextState.state.general.geoBorderColor; // update when geoborder color changes
|
|
65
66
|
const equalMapColors = prevState.state.color === nextState.state.color; // update when map colors change
|
|
66
67
|
const equalData = prevState.data === nextState.data; // update when data changes
|
|
67
|
-
return equalMapColors && equalData && equalBorderColors && equalLegend && equalColumnName && equalNavColumn ? true : false;
|
|
68
|
+
return equalMapColors && equalData && equalBorderColors && equalLegend && equalColumnName && equalNavColumn && equalNumberOptIn ? true : false;
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
const CountyMap = (props) => {
|
|
71
|
-
|
|
72
72
|
let mapData = states.concat(counties);
|
|
73
73
|
|
|
74
74
|
const {
|
|
@@ -80,6 +80,7 @@ const CountyMap = (props) => {
|
|
|
80
80
|
displayGeoName,
|
|
81
81
|
rebuildTooltips,
|
|
82
82
|
containerEl,
|
|
83
|
+
handleMapAriaLabels
|
|
83
84
|
} = props;
|
|
84
85
|
|
|
85
86
|
useEffect(() => {
|
|
@@ -518,7 +519,15 @@ const CountyMap = (props) => {
|
|
|
518
519
|
if(!data) <Loading />
|
|
519
520
|
return (
|
|
520
521
|
<ErrorBoundary component='CountyMap'>
|
|
521
|
-
<svg
|
|
522
|
+
<svg
|
|
523
|
+
viewBox={`0 0 ${WIDTH} ${HEIGHT}`}
|
|
524
|
+
preserveAspectRatio='xMinYMin'
|
|
525
|
+
className='svg-container'
|
|
526
|
+
data-scale={scale ? scale : ''}
|
|
527
|
+
data-translate={translate ? translate : ''}
|
|
528
|
+
role="img"
|
|
529
|
+
aria-label={handleMapAriaLabels(state)}
|
|
530
|
+
>
|
|
522
531
|
<rect
|
|
523
532
|
className='background center-container ocean'
|
|
524
533
|
width={WIDTH}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
useTable, useSortBy, useResizeColumns, useBlockLayout
|
|
6
6
|
} from 'react-table';
|
|
7
7
|
import Papa from 'papaparse';
|
|
8
|
-
import ExternalIcon from '../images/external-link.svg';
|
|
8
|
+
import ExternalIcon from '../images/external-link.svg'; // TODO: Move to Icon component
|
|
9
9
|
|
|
10
10
|
import ErrorBoundary from '@cdc/core/components/ErrorBoundary';
|
|
11
11
|
import LegendCircle from '@cdc/core/components/LegendCircle';
|
|
@@ -288,7 +288,7 @@ const DataTable = (props) => {
|
|
|
288
288
|
if(!state.data) return <Loading />
|
|
289
289
|
return (
|
|
290
290
|
<ErrorBoundary component="DataTable">
|
|
291
|
-
<section id={
|
|
291
|
+
<section id={tabbingId.replace('#', '')} className={`data-table-container ${viewport}`} aria-label={accessibilityLabel}>
|
|
292
292
|
<a id='skip-nav' className='cdcdataviz-sr-only-focusable' href={`#${skipId}`}>
|
|
293
293
|
Skip Navigation or Skip to Content
|
|
294
294
|
</a>
|
|
@@ -298,17 +298,17 @@ const DataTable = (props) => {
|
|
|
298
298
|
tabIndex="0"
|
|
299
299
|
onKeyDown={(e) => { if (e.keyCode === 13) { setExpanded(!expanded); } }}
|
|
300
300
|
>
|
|
301
|
-
|
|
301
|
+
|
|
302
302
|
{tableTitle}
|
|
303
303
|
</div>
|
|
304
|
-
<div
|
|
304
|
+
<div
|
|
305
305
|
className="table-container"
|
|
306
|
-
style={ { maxHeight: state.dataTable.limitHeight && `${state.dataTable.height}px`, overflowY: 'scroll' } }
|
|
306
|
+
style={ { maxHeight: state.dataTable.limitHeight && `${state.dataTable.height}px`, overflowY: 'scroll' } }
|
|
307
307
|
>
|
|
308
308
|
<table
|
|
309
|
-
height={expanded ? null : 0} {...getTableProps()}
|
|
310
|
-
aria-live="assertive"
|
|
311
|
-
className={expanded ? 'data-table' : 'data-table cdcdataviz-sr-only'}
|
|
309
|
+
height={expanded ? null : 0} {...getTableProps()}
|
|
310
|
+
aria-live="assertive"
|
|
311
|
+
className={expanded ? 'data-table' : 'data-table cdcdataviz-sr-only'}
|
|
312
312
|
hidden={!expanded}
|
|
313
313
|
aria-rowcount={state?.data.length ? state.data.length : '-1' }
|
|
314
314
|
>
|
|
@@ -317,7 +317,7 @@ const DataTable = (props) => {
|
|
|
317
317
|
{headerGroups.map((headerGroup) => (
|
|
318
318
|
<tr {...headerGroup.getHeaderGroupProps()}>
|
|
319
319
|
{headerGroup.headers.map((column) => (
|
|
320
|
-
<th
|
|
320
|
+
<th
|
|
321
321
|
tabIndex="0"
|
|
322
322
|
title={column.Header}
|
|
323
323
|
role="columnheader"
|