@cdc/map 4.26.2 → 4.26.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.
- package/CONFIG.md +235 -0
- package/README.md +70 -24
- package/dist/cdcmap-CY9IcPSi.es.js +6 -0
- package/dist/cdcmap-DlpiY3fQ.es.js +4 -0
- package/dist/cdcmap.js +31260 -27946
- package/examples/{testing-layer-2.json → __data__/testing-layer-2.json} +1 -1
- package/examples/{testing-layer.json → __data__/testing-layer.json} +1 -1
- package/examples/county-hsa-toggle.json +51993 -0
- package/examples/custom-map-layers.json +2 -2
- package/examples/default-county.json +3 -3
- package/examples/minimal-example.json +69 -0
- package/examples/private/annotation-bug.json +642 -0
- package/examples/private/css-issue.json +314 -0
- package/examples/private/region-breaking.json +1639 -0
- package/examples/private/test1.json +27247 -0
- package/package.json +4 -4
- package/src/CdcMap.tsx +3 -14
- package/src/CdcMapComponent.tsx +302 -164
- package/src/_stories/CdcMap.Defaults.smoke.stories.tsx +76 -0
- package/src/_stories/CdcMap.Editor.ColumnsSectionTests.stories.tsx +601 -0
- package/src/_stories/CdcMap.Editor.DataTableSectionTests.stories.tsx +404 -0
- package/src/_stories/CdcMap.Editor.FiltersSectionTests.stories.tsx +229 -0
- package/src/_stories/CdcMap.Editor.GeneralSectionTests.stories.tsx +262 -0
- package/src/_stories/CdcMap.Editor.LegendSectionTests.stories.tsx +541 -0
- package/src/_stories/CdcMap.Editor.MultiCountryWorldMapTests.stories.tsx +359 -0
- package/src/_stories/CdcMap.Editor.PatternSettingsSectionTests.stories.tsx +516 -0
- package/src/_stories/CdcMap.Editor.SmallMultiplesSectionTests.stories.tsx +165 -0
- package/src/_stories/CdcMap.Editor.TextAnnotationsSectionTests.stories.tsx +145 -0
- package/src/_stories/CdcMap.Editor.TypeSectionTests.stories.tsx +312 -0
- package/src/_stories/CdcMap.Editor.VisualSectionTests.stories.tsx +359 -0
- package/src/_stories/CdcMap.Editor.ZoomControlsTests.stories.tsx +88 -0
- package/src/_stories/{CdcMap.stories.tsx → CdcMap.smoke.stories.tsx} +23 -1
- package/src/_stories/Map.HTMLInDataTable.stories.tsx +385 -0
- package/src/_stories/_mock/legends/legend-tests.json +3 -3
- package/src/_stories/_mock/multi-state-show-unselected.json +82 -0
- package/src/cdcMapComponent.styles.css +2 -2
- package/src/components/Annotation/Annotation.Draggable.styles.css +4 -4
- package/src/components/Annotation/AnnotationDropdown.styles.css +1 -1
- package/src/components/Annotation/AnnotationList.styles.css +13 -13
- package/src/components/Annotation/AnnotationList.tsx +1 -1
- package/src/components/EditorPanel/components/EditorPanel.tsx +905 -416
- package/src/components/EditorPanel/components/HexShapeSettings.tsx +1 -1
- package/src/components/EditorPanel/components/Panels/Panel.Annotate.tsx +112 -117
- package/src/components/EditorPanel/components/Panels/Panel.PatternSettings-style.css +1 -1
- package/src/components/EditorPanel/components/Panels/Panel.PatternSettings.tsx +31 -15
- package/src/components/EditorPanel/components/editorPanel.styles.css +55 -25
- package/src/components/Legend/components/Legend.tsx +12 -7
- package/src/components/Legend/components/LegendGroup/legend.group.css +5 -5
- package/src/components/Legend/components/LegendItem.Hex.tsx +4 -2
- package/src/components/Legend/components/index.scss +2 -3
- package/src/components/NavigationMenu.tsx +2 -1
- package/src/components/SmallMultiples/SmallMultiples.css +5 -5
- package/src/components/SmallMultiples/SynchronizedTooltip.tsx +1 -1
- package/src/components/UsaMap/components/SingleState/SingleState.StateOutput.tsx +32 -17
- package/src/components/UsaMap/components/TerritoriesSection.tsx +3 -2
- package/src/components/UsaMap/components/Territory/Territory.Rectangle.tsx +13 -8
- package/src/components/UsaMap/components/UsaMap.County.tsx +629 -231
- package/src/components/UsaMap/components/UsaMap.Region.styles.css +1 -1
- package/src/components/UsaMap/components/UsaMap.SingleState.styles.css +2 -2
- package/src/components/UsaMap/components/UsaMap.State.tsx +14 -9
- package/src/components/UsaMap/data/cb_2019_us_county_20m.json +75817 -1
- package/src/components/UsaMap/data/hsa_fips_mapping.json +3144 -0
- package/src/components/WorldMap/WorldMap.tsx +10 -13
- package/src/components/WorldMap/data/world-topo-updated.json +1 -0
- package/src/components/WorldMap/data/world-topo.json +1 -1
- package/src/components/WorldMap/worldMap.styles.css +1 -1
- package/src/components/ZoomControls.tsx +49 -18
- package/src/components/zoomControls.styles.css +27 -11
- package/src/data/initial-state.js +15 -5
- package/src/data/legacy-defaults.ts +8 -0
- package/src/data/supported-counties.json +1 -1
- package/src/data/supported-geos.js +19 -0
- package/src/helpers/colors.ts +2 -1
- package/src/helpers/countyTerritories.ts +38 -0
- package/src/helpers/dataTableHelpers.ts +85 -0
- package/src/helpers/displayGeoName.ts +19 -11
- package/src/helpers/getMapContainerClasses.ts +8 -2
- package/src/helpers/getMatchingPatternForRow.ts +67 -0
- package/src/helpers/getPatternForRow.ts +11 -18
- package/src/helpers/tests/countyTerritories.test.ts +87 -0
- package/src/helpers/tests/dataTableHelpers.test.ts +78 -0
- package/src/helpers/tests/displayGeoName.test.ts +17 -0
- package/src/helpers/tests/getMatchingPatternForRow.test.ts +150 -0
- package/src/helpers/tests/getPatternForRow.test.ts +140 -2
- package/src/helpers/urlDataHelpers.ts +7 -1
- package/src/hooks/useApplyTooltipsToGeo.tsx +7 -4
- package/src/hooks/useMapLayers.tsx +1 -1
- package/src/hooks/useResizeObserver.ts +36 -22
- package/src/hooks/useTooltip.test.tsx +64 -0
- package/src/hooks/useTooltip.ts +46 -15
- package/src/scss/editor-panel.scss +1 -1
- package/src/scss/main.scss +140 -6
- package/src/scss/map.scss +9 -4
- package/src/store/map.actions.ts +5 -0
- package/src/store/map.reducer.ts +13 -0
- package/src/test/CdcMap.test.jsx +26 -2
- package/src/types/MapConfig.ts +28 -4
- package/src/types/MapContext.ts +5 -1
- package/topojson-updater/README.txt +1 -1
- package/dist/cdcmap-Cf9_fbQf.es.js +0 -6
- package/examples/__data__/city-state-data.json +0 -668
- package/examples/city-state.json +0 -434
- package/examples/default-world-data.json +0 -1450
- package/examples/new-cities.json +0 -656
- package/src/_stories/CdcMap.Editor.stories.tsx +0 -3475
- package/src/helpers/componentHelpers.ts +0 -8
- package/topojson-updater/package-lock.json +0 -223
- /package/src/_stories/{CdcMap.ColumnWrap.stories.tsx → CdcMap.ColumnWrap.smoke.stories.tsx} +0 -0
- /package/src/_stories/{CdcMap.DistrictOfColumbia.stories.tsx → CdcMap.DistrictOfColumbia.smoke.stories.tsx} +0 -0
- /package/src/_stories/{CdcMap.Filters.stories.tsx → CdcMap.Filters.smoke.stories.tsx} +0 -0
- /package/src/_stories/{CdcMap.Legend.Gradient.stories.tsx → CdcMap.Legend.Gradient.smoke.stories.tsx} +0 -0
- /package/src/_stories/{CdcMap.Legend.stories.tsx → CdcMap.Legend.smoke.stories.tsx} +0 -0
- /package/src/_stories/{CdcMap.Patterns.stories.tsx → CdcMap.Patterns.smoke.stories.tsx} +0 -0
- /package/src/_stories/{CdcMap.SmallMultiples.stories.tsx → CdcMap.SmallMultiples.smoke.stories.tsx} +0 -0
- /package/src/_stories/{CdcMap.Table.stories.tsx → CdcMap.Table.smoke.stories.tsx} +0 -0
- /package/src/_stories/{CdcMap.ZeroColor.stories.tsx → CdcMap.ZeroColor.smoke.stories.tsx} +0 -0
- /package/src/_stories/{GoogleMap.stories.tsx → GoogleMap.smoke.stories.tsx} +0 -0
- /package/src/_stories/{UsaMap.NoData.stories.tsx → UsaMap.NoData.smoke.stories.tsx} +0 -0
|
@@ -13,27 +13,58 @@ type ZoomControlsProps = {
|
|
|
13
13
|
const ZoomControls: React.FC<ZoomControlsProps> = ({ handleZoomIn, handleZoomOut, handleZoomReset }) => {
|
|
14
14
|
const { config, setRuntimeData, position } = useContext<MapContext>(ConfigContext)
|
|
15
15
|
if (!config.general.allowMapZoom) return
|
|
16
|
+
|
|
17
|
+
const isUsGeocodeMap = config.general.type === 'us-geocode'
|
|
18
|
+
const shouldShowUsGeocodeReset = isUsGeocodeMap && position.zoom > 1
|
|
19
|
+
const shouldShowBottomReset = config.general.geoType === 'single-state' || config.general.type === 'bubble'
|
|
20
|
+
|
|
21
|
+
if (!isUsGeocodeMap) {
|
|
22
|
+
return (
|
|
23
|
+
<div className='zoom-controls' data-html2canvas-ignore='true'>
|
|
24
|
+
<button onClick={() => handleZoomIn(position)} aria-label='Zoom In'>
|
|
25
|
+
<svg viewBox='0 0 24 24' stroke='currentColor' strokeWidth='3'>
|
|
26
|
+
<line x1='12' y1='5' x2='12' y2='19' />
|
|
27
|
+
<line x1='5' y1='12' x2='19' y2='12' />
|
|
28
|
+
</svg>
|
|
29
|
+
</button>
|
|
30
|
+
<button onClick={() => handleZoomOut(position)} aria-label='Zoom Out'>
|
|
31
|
+
<svg viewBox='0 0 24 24' stroke='currentColor' strokeWidth='3'>
|
|
32
|
+
<line x1='5' y1='12' x2='19' y2='12' />
|
|
33
|
+
</svg>
|
|
34
|
+
</button>
|
|
35
|
+
{shouldShowBottomReset && (
|
|
36
|
+
<button onClick={() => handleZoomReset(setRuntimeData)} className='reset' aria-label='Reset Zoom'>
|
|
37
|
+
Reset Zoom
|
|
38
|
+
</button>
|
|
39
|
+
)}
|
|
40
|
+
</div>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
16
44
|
return (
|
|
17
|
-
|
|
18
|
-
<
|
|
19
|
-
<
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
<
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
{(config.general.type === 'world-geocode' ||
|
|
30
|
-
config.general.geoType === 'single-state' ||
|
|
31
|
-
config.general.type === 'bubble') && (
|
|
32
|
-
<button onClick={() => handleZoomReset(setRuntimeData)} className='reset' aria-label='Reset Zoom'>
|
|
33
|
-
Reset Zoom
|
|
45
|
+
<>
|
|
46
|
+
<div className='zoom-controls' data-html2canvas-ignore='true'>
|
|
47
|
+
<button onClick={() => handleZoomIn(position)} aria-label='Zoom In'>
|
|
48
|
+
<svg viewBox='0 0 24 24' stroke='currentColor' strokeWidth='3'>
|
|
49
|
+
<line x1='12' y1='5' x2='12' y2='19' />
|
|
50
|
+
<line x1='5' y1='12' x2='19' y2='12' />
|
|
51
|
+
</svg>
|
|
52
|
+
</button>
|
|
53
|
+
<button onClick={() => handleZoomOut(position)} aria-label='Zoom Out'>
|
|
54
|
+
<svg viewBox='0 0 24 24' stroke='currentColor' strokeWidth='3'>
|
|
55
|
+
<line x1='5' y1='12' x2='19' y2='12' />
|
|
56
|
+
</svg>
|
|
34
57
|
</button>
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
{shouldShowUsGeocodeReset && (
|
|
61
|
+
<div className='zoom-controls zoom-controls--top-right' data-html2canvas-ignore='true'>
|
|
62
|
+
<button onClick={() => handleZoomReset(setRuntimeData)} className='reset' aria-label='Reset Zoom'>
|
|
63
|
+
Reset Zoom
|
|
64
|
+
</button>
|
|
65
|
+
</div>
|
|
35
66
|
)}
|
|
36
|
-
|
|
67
|
+
</>
|
|
37
68
|
)
|
|
38
69
|
}
|
|
39
70
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
.zoom-controls {
|
|
2
|
-
display: flex;
|
|
3
|
-
position: absolute;
|
|
4
2
|
bottom: 2em;
|
|
3
|
+
display: flex;
|
|
5
4
|
left: 1em;
|
|
5
|
+
position: absolute;
|
|
6
6
|
z-index: 4;
|
|
7
7
|
> button.reset {
|
|
8
|
-
margin-left: 5px;
|
|
9
8
|
background: rgba(0, 0, 0, 0.65);
|
|
10
|
-
transition: 0.2s all;
|
|
11
9
|
color: #fff;
|
|
10
|
+
margin-left: 5px;
|
|
11
|
+
transition: 0.2s all;
|
|
12
12
|
&:hover {
|
|
13
13
|
background: rgba(0, 0, 0, 0.8);
|
|
14
14
|
transition: 0.2s all;
|
|
@@ -21,17 +21,17 @@
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
> button:not(.reset) {
|
|
24
|
-
display: flex;
|
|
25
24
|
align-items: center;
|
|
25
|
+
background: rgba(0, 0, 0, 0.65);
|
|
26
|
+
border: 0;
|
|
27
|
+
border-radius: 100%;
|
|
28
|
+
color: #fff;
|
|
29
|
+
display: flex;
|
|
30
|
+
height: 1.75em;
|
|
26
31
|
justify-content: center;
|
|
27
32
|
padding: 0.2em;
|
|
28
|
-
height: 1.75em;
|
|
29
|
-
width: 1.75em;
|
|
30
|
-
background: rgba(0, 0, 0, 0.65);
|
|
31
33
|
transition: 0.2s all;
|
|
32
|
-
|
|
33
|
-
border-radius: 100%;
|
|
34
|
-
border: 0;
|
|
34
|
+
width: 1.75em;
|
|
35
35
|
&:hover {
|
|
36
36
|
background: rgba(0, 0, 0, 0.8);
|
|
37
37
|
transition: 0.2s all;
|
|
@@ -51,3 +51,19 @@
|
|
|
51
51
|
margin-right: 0.25em;
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
+
|
|
55
|
+
.zoom-controls--top-right {
|
|
56
|
+
bottom: auto;
|
|
57
|
+
left: auto;
|
|
58
|
+
right: 1em;
|
|
59
|
+
top: 1em;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.zoom-controls--top-right > button.reset {
|
|
63
|
+
background: #005eaa;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.zoom-controls--top-right > button.reset:hover,
|
|
67
|
+
.zoom-controls--top-right > button.reset:focus {
|
|
68
|
+
background: #004b88;
|
|
69
|
+
}
|
|
@@ -41,6 +41,7 @@ const createInitialState = () => {
|
|
|
41
41
|
allowMapZoom: true,
|
|
42
42
|
hideGeoColumnInTooltip: false,
|
|
43
43
|
hidePrimaryColumnInTooltip: false,
|
|
44
|
+
hideUnselectedStates: true,
|
|
44
45
|
statesPicked: []
|
|
45
46
|
},
|
|
46
47
|
type: 'map',
|
|
@@ -49,7 +50,8 @@ const createInitialState = () => {
|
|
|
49
50
|
name: 'FIPS Codes',
|
|
50
51
|
label: 'Location',
|
|
51
52
|
tooltip: false,
|
|
52
|
-
dataTable: true
|
|
53
|
+
dataTable: true,
|
|
54
|
+
displayColumn: ''
|
|
53
55
|
},
|
|
54
56
|
primary: {
|
|
55
57
|
dataTable: true,
|
|
@@ -76,14 +78,14 @@ const createInitialState = () => {
|
|
|
76
78
|
showSpecialClassesLast: false,
|
|
77
79
|
dynamicDescription: false,
|
|
78
80
|
type: 'equalnumber',
|
|
79
|
-
numberOfItems:
|
|
80
|
-
position: '
|
|
81
|
+
numberOfItems: 5,
|
|
82
|
+
position: 'top',
|
|
81
83
|
title: '',
|
|
82
|
-
style: '
|
|
84
|
+
style: 'gradient',
|
|
83
85
|
subStyle: 'linear blocks',
|
|
84
86
|
tickRotation: '',
|
|
85
87
|
singleColumnLegend: false,
|
|
86
|
-
hideBorder:
|
|
88
|
+
hideBorder: true,
|
|
87
89
|
groupBy: ''
|
|
88
90
|
},
|
|
89
91
|
filters: [],
|
|
@@ -96,6 +98,7 @@ const createInitialState = () => {
|
|
|
96
98
|
height: '',
|
|
97
99
|
caption: '',
|
|
98
100
|
showDownloadUrl: false,
|
|
101
|
+
downloadUrlLabel: '',
|
|
99
102
|
showDataTableLink: true,
|
|
100
103
|
showDownloadLinkBelow: true,
|
|
101
104
|
showFullGeoNameInCSV: false,
|
|
@@ -114,6 +117,13 @@ const createInitialState = () => {
|
|
|
114
117
|
editorErrorMessage: []
|
|
115
118
|
},
|
|
116
119
|
visual: {
|
|
120
|
+
border: false,
|
|
121
|
+
borderColorTheme: false,
|
|
122
|
+
accent: false,
|
|
123
|
+
background: false,
|
|
124
|
+
hideBackgroundColor: false,
|
|
125
|
+
tp5Treatment: false,
|
|
126
|
+
tp5Background: false,
|
|
117
127
|
minBubbleSize: 1,
|
|
118
128
|
maxBubbleSize: 20,
|
|
119
129
|
extraBubbleBorder: false,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Preserves the OLD default values for properties changed in initial-state.js.
|
|
2
|
+
// When the backfill loop fills a missing property, it uses these values instead
|
|
3
|
+
// of the current defaults so that existing configs aren't visually affected.
|
|
4
|
+
//
|
|
5
|
+
// See backfillDefaults() in @cdc/core for the shared fill logic.
|
|
6
|
+
export const LEGACY_MAP_DEFAULTS: Record<string, Record<string, unknown>> = {
|
|
7
|
+
legend: { style: 'circles', position: 'side', numberOfItems: 3, hideBorder: false }
|
|
8
|
+
}
|