@cdc/map 4.24.12 → 4.25.1
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 +51010 -49337
- package/examples/annotation/index.json +1 -1
- package/examples/custom-map-layers.json +1 -1
- package/examples/default-geocode.json +2 -2
- package/examples/private/DEV-9989.json +229 -0
- package/examples/private/ardi.json +180 -0
- package/examples/private/colors 2.json +416 -0
- package/examples/private/colors.json +416 -0
- package/examples/private/colors.json.zip +0 -0
- package/examples/private/customColors.json +45348 -0
- package/examples/private/mmr.json +246 -0
- package/examples/private/test.json +1632 -0
- package/index.html +12 -14
- package/package.json +8 -3
- package/src/CdcMap.tsx +126 -394
- package/src/_stories/CdcMap.Legend.Gradient.stories.tsx +9 -0
- package/src/_stories/CdcMap.stories.tsx +1 -1
- package/src/_stories/GoogleMap.stories.tsx +19 -0
- package/src/_stories/_mock/DEV-10148.json +859 -0
- package/src/_stories/_mock/DEV-9989.json +229 -0
- package/src/_stories/_mock/example-city-state.json +1 -1
- package/src/_stories/_mock/google-map.json +819 -0
- package/src/components/Annotation/Annotation.Draggable.tsx +34 -43
- package/src/components/Annotation/AnnotationDropdown.tsx +4 -4
- package/src/components/CityList.tsx +2 -2
- package/src/components/DataTable.tsx +8 -9
- package/src/components/EditorPanel/components/EditorPanel.tsx +96 -270
- package/src/components/GoogleMap/components/GoogleMap.tsx +67 -0
- package/src/components/GoogleMap/index.tsx +3 -0
- package/src/components/Legend/components/Legend.tsx +40 -30
- package/src/components/Legend/components/LegendItem.Hex.tsx +7 -3
- package/src/components/Legend/components/index.scss +22 -16
- package/src/components/Modal.tsx +6 -5
- package/src/components/NavigationMenu.tsx +5 -4
- package/src/components/UsaMap/components/TerritoriesSection.tsx +56 -0
- package/src/components/UsaMap/components/Territory/Territory.Rectangle.tsx +3 -3
- package/src/components/UsaMap/components/UsaMap.County.tsx +1 -1
- package/src/components/UsaMap/components/UsaMap.Region.tsx +12 -8
- package/src/components/UsaMap/components/UsaMap.SingleState.tsx +2 -2
- package/src/components/UsaMap/components/UsaMap.State.tsx +23 -29
- package/src/components/WorldMap/WorldMap.tsx +3 -5
- package/src/context.ts +0 -12
- package/src/data/initial-state.js +2 -2
- package/src/data/supported-geos.js +23 -3
- package/src/helpers/applyColorToLegend.ts +3 -3
- package/src/helpers/closeModal.ts +9 -0
- package/src/helpers/handleMapAriaLabels.ts +38 -0
- package/src/helpers/indexOfIgnoreType.ts +8 -0
- package/src/helpers/navigationHandler.ts +21 -0
- package/src/helpers/toTitleCase.ts +44 -0
- package/src/helpers/validateFipsCodeLength.ts +30 -0
- package/src/hooks/useResizeObserver.ts +42 -0
- package/src/hooks/useTooltip.ts +4 -2
- package/src/index.jsx +1 -0
- package/src/scss/editor-panel.scss +2 -1
- package/src/scss/filters.scss +0 -5
- package/src/scss/main.scss +57 -61
- package/src/scss/map.scss +1 -13
- package/src/types/MapConfig.ts +20 -11
- package/src/types/MapContext.ts +4 -12
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
annotations: [],
|
|
3
3
|
general: {
|
|
4
|
+
navigationTarget: '_self',
|
|
4
5
|
noStateFoundMessage: 'Map Unavailable',
|
|
5
6
|
annotationDropdownText: 'Annotations',
|
|
6
7
|
geoBorderColor: 'darkGray',
|
|
@@ -11,8 +12,7 @@ export default {
|
|
|
11
12
|
showDownloadButton: false,
|
|
12
13
|
showDownloadMediaButton: false,
|
|
13
14
|
displayAsHex: false,
|
|
14
|
-
displayStateLabels:
|
|
15
|
-
territoriesLabel: 'Territories',
|
|
15
|
+
displayStateLabels: true,
|
|
16
16
|
territoriesAlwaysShow: false,
|
|
17
17
|
language: 'en',
|
|
18
18
|
geoType: 'single-state',
|
|
@@ -537,6 +537,9 @@ export const supportedTerritories = {
|
|
|
537
537
|
// prettier-ignore
|
|
538
538
|
export const supportedCities = {
|
|
539
539
|
'ALASKA NATIVE TRIBAL HEALTH CONSORTIUM': [-149.8067, 61.1827],
|
|
540
|
+
'ALBANY, NEW YORK': [-73.9665676, 42.6679788],
|
|
541
|
+
'ALBANY, NY': [-73.9665676, 42.6679788],
|
|
542
|
+
'ALBANY': [-73.9665676, 42.6679788],
|
|
540
543
|
'ALBUQUERQUE': [-106.650421, 35.084385],
|
|
541
544
|
'ALEXANDRIA': [-77.0469, 38.8048],
|
|
542
545
|
'AMERICAN INDIAN CANCER FOUNDATION': [-93.1777, 45.0119],
|
|
@@ -568,6 +571,7 @@ export const supportedCities = {
|
|
|
568
571
|
'COLUMBUS': [-82.998795, 39.961178],
|
|
569
572
|
'CORPUS CHRISTI': [-97.396378, 27.800583],
|
|
570
573
|
'DALLAS': [-96.796989, 32.776665],
|
|
574
|
+
'DC': [-77.036873, 38.907192],
|
|
571
575
|
'DENVER': [-104.990250, 39.739235],
|
|
572
576
|
'DETROIT': [-83.045753, 42.331429],
|
|
573
577
|
'DISTRICT OF COLUMBIA': [-77.036873, 38.907192],
|
|
@@ -601,10 +605,16 @@ export const supportedCities = {
|
|
|
601
605
|
'IRVINE': [-117.826508, 33.684566],
|
|
602
606
|
'IRVING': [-96.948891, 32.814018],
|
|
603
607
|
'JACKSONVILLE': [-81.655647, 30.332184],
|
|
608
|
+
'JAMAICA PLAINS, MA': [-71.1382393, 42.308217],
|
|
609
|
+
'JAMAICA PLAINS, MARYLAND': [-71.1382393, 42.308217],
|
|
610
|
+
'JAMAICA PLAINS': [-71.1382393, 42.308217],
|
|
604
611
|
'JERSEY CITY': [-74.077644, 40.728157],
|
|
605
612
|
'KANSAS CITY': [-94.578568, 39.099728],
|
|
606
613
|
'KAW NATION OF OKLAHOMA': [-96.8633, 36.7669],
|
|
607
614
|
'LAKEVIEW': [-104.9903, 39.7392],
|
|
615
|
+
'LANSING, MI': [-84.6418571, 42.721154],
|
|
616
|
+
'LANSING, MICHIGAN': [-84.6418571, 42.721154],
|
|
617
|
+
'LANSING': [-84.6418571, 42.721154],
|
|
608
618
|
'LAREDO': [-99.507553, 27.503561],
|
|
609
619
|
'LAS VEGAS': [-115.139832, 36.169941],
|
|
610
620
|
'LEXINGTON': [-84.503716, 38.040585],
|
|
@@ -638,6 +648,9 @@ export const supportedCities = {
|
|
|
638
648
|
'NORTHWEST PORTLAND AREA INDIAN HEALTH BOARD': [-122.6863, 45.5076],
|
|
639
649
|
'OAKLAND': [-122.271111, 37.804363],
|
|
640
650
|
'OKLAHOMA CITY': [-97.516426, 35.467560],
|
|
651
|
+
'OLYMPIA, WA': [-122.9382403, 47.0394791],
|
|
652
|
+
'OLYMPIA, WASHINGTON': [-122.9382403, 47.0394791],
|
|
653
|
+
'OLYMPIA': [-122.9382403, 47.0394791],
|
|
641
654
|
'OMAHA': [-95.934502, 41.256538],
|
|
642
655
|
'ORLANDO': [-81.379234, 28.538336],
|
|
643
656
|
'PASADENA':[-95.209099,29.691063],
|
|
@@ -650,7 +663,10 @@ export const supportedCities = {
|
|
|
650
663
|
'PROVO, UTAH': [-111.6585, 40.2338],
|
|
651
664
|
'RALEIGH': [-78.638176, 35.779591],
|
|
652
665
|
'RENO': [-119.813805, 39.529633],
|
|
653
|
-
'RICHMOND': [-
|
|
666
|
+
'RICHMOND, CA': [-122.4248668, 37.9559018],
|
|
667
|
+
'RICHMOND, CALIFORNIA': [-122.4248668, 37.9559018],
|
|
668
|
+
'RICHMOND, VA': [-77.436050, 37.540726],
|
|
669
|
+
'RICHMOND, VIRGINIA': [-77.436050, 37.540726],
|
|
654
670
|
'RIVERSIDE': [-117.375496, 33.980602],
|
|
655
671
|
'ROUND ROCK, TEXAS': [-97.6789, 30.5083],
|
|
656
672
|
'ROUND ROCK, TX': [-97.6789, 30.5083],
|
|
@@ -663,7 +679,6 @@ export const supportedCities = {
|
|
|
663
679
|
'SALEM, MASSACHUSETTS': [-70.8955, 42.5197],
|
|
664
680
|
'SALEM, OR': [-123.0351, 44.9429],
|
|
665
681
|
'SALEM, OREGON': [-123.0351, 44.9429],
|
|
666
|
-
'SALEM, OREGON': [-123.0351, 44.9429],
|
|
667
682
|
'SALT LAKE CITY': [-112.0605644, 40.7767833],
|
|
668
683
|
'SALUDA, VA': [-76.5950, 37.6064],
|
|
669
684
|
'SALUDA, VIRGINIA': [-76.5950, 37.6064],
|
|
@@ -686,7 +701,13 @@ export const supportedCities = {
|
|
|
686
701
|
'ST. PETERSBURG': [-82.640289, 27.767601],
|
|
687
702
|
'STOCKTON': [-121.290779, 37.957703],
|
|
688
703
|
'SYRACUSE': [-76.1742992, 43.0352913],
|
|
704
|
+
'TALLAHASSEE, FL': [-84.253917, 30.467056],
|
|
705
|
+
'TALLAHASSEE, FLORIDA': [-84.253917, 30.467056],
|
|
706
|
+
'TALLAHASSEE': [-84.253917, 30.467056],
|
|
689
707
|
'TAMPA': [-82.457176, 27.950575],
|
|
708
|
+
'TAYLORSVILLE, UT': [-111.9702728, 40.658078],
|
|
709
|
+
'TAYLORSVILLE, UTAH': [-111.9702728, 40.658078],
|
|
710
|
+
'TAYLORSVILLE': [-111.9702728, 40.658078],
|
|
690
711
|
'TOLEDO': [-83.537865, 41.652805],
|
|
691
712
|
'TUCSON': [-110.974709, 32.222607],
|
|
692
713
|
'TULSA': [-95.992775, 36.153980],
|
|
@@ -695,7 +716,6 @@ export const supportedCities = {
|
|
|
695
716
|
'VIRGINIA BEACH': [-75.977982, 36.852924],
|
|
696
717
|
'WARREN': [-80.8184, 41.2376],
|
|
697
718
|
'WASHINGTON D.C.': [-77.036873, 38.907192],
|
|
698
|
-
'DC': [-77.036873, 38.907192],
|
|
699
719
|
'WASHINGTON DC.': [-77.036873, 38.907192],
|
|
700
720
|
'WASHINGTON DC': [-77.036873, 38.907192],
|
|
701
721
|
'WICHITA': [-97.330055, 37.687176],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import colorPalettes from '@cdc/core/data/colorPalettes'
|
|
2
2
|
import chroma from 'chroma-js'
|
|
3
|
-
import { isOlderVersion } from '@cdc/core/helpers/ver/versionNeedsUpdate'
|
|
4
3
|
import { type ChartConfig } from '@cdc/chart/src/types/ChartConfig'
|
|
4
|
+
import isOlderVersion from '@cdc/core/helpers/isOlderVersion'
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* applyColorToLegend
|
|
@@ -45,7 +45,7 @@ export const applyColorToLegend = (legendIdx: number, config: ChartConfig, resul
|
|
|
45
45
|
|
|
46
46
|
// Special Classes (No Data)
|
|
47
47
|
if (result[legendIdx].special) {
|
|
48
|
-
if (
|
|
48
|
+
if (!config?.migrations?.addColorMigration) {
|
|
49
49
|
const specialClassColors = chroma.scale(['#D4D4D4', '#939393']).colors(specialClasses)
|
|
50
50
|
return specialClassColors[legendIdx]
|
|
51
51
|
} else {
|
|
@@ -57,7 +57,7 @@ export const applyColorToLegend = (legendIdx: number, config: ChartConfig, resul
|
|
|
57
57
|
if (config.color.includes('qualitative')) return mapColorPalette[colorIdx]
|
|
58
58
|
|
|
59
59
|
// If the current version is newer than 4.24.10, use the color palette
|
|
60
|
-
if (!
|
|
60
|
+
if (!config?.migrations?.addColorMigration) {
|
|
61
61
|
if (config.customColors) return mapColorPalette[legendIdx - specialClasses.length]
|
|
62
62
|
}
|
|
63
63
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const closeModal = ({ target }, modal: string, setModal: Function) => {
|
|
2
|
+
if (
|
|
3
|
+
'string' === typeof target.className &&
|
|
4
|
+
(target.className.includes('modal-close') || target.className.includes('modal-background')) &&
|
|
5
|
+
null !== modal
|
|
6
|
+
) {
|
|
7
|
+
setModal(null)
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export const handleMapAriaLabels = (state: MapConfig = '', testing = false) => {
|
|
2
|
+
if (testing) console.log(`handleMapAriaLabels Testing On: ${state}`) // eslint-disable-line
|
|
3
|
+
try {
|
|
4
|
+
if (!state.general.geoType) throw Error('handleMapAriaLabels: no geoType found in state')
|
|
5
|
+
const {
|
|
6
|
+
general: { title, geoType, statePicked }
|
|
7
|
+
} = state
|
|
8
|
+
let ariaLabel = ''
|
|
9
|
+
switch (geoType) {
|
|
10
|
+
case 'world':
|
|
11
|
+
ariaLabel += 'World map'
|
|
12
|
+
break
|
|
13
|
+
case 'us':
|
|
14
|
+
ariaLabel += 'United States map'
|
|
15
|
+
break
|
|
16
|
+
case 'us-county':
|
|
17
|
+
ariaLabel += `United States county map`
|
|
18
|
+
break
|
|
19
|
+
case 'single-state':
|
|
20
|
+
ariaLabel += `${statePicked.stateName} county map`
|
|
21
|
+
break
|
|
22
|
+
case 'us-region':
|
|
23
|
+
ariaLabel += `United States HHS Region map`
|
|
24
|
+
break
|
|
25
|
+
default:
|
|
26
|
+
ariaLabel = 'Data visualization container'
|
|
27
|
+
break
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (title) {
|
|
31
|
+
ariaLabel += ` with the title: ${title}`
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return ariaLabel
|
|
35
|
+
} catch (e) {
|
|
36
|
+
console.error('COVE: ', e.message) // eslint-disable-line
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export const navigationHandler = (
|
|
2
|
+
navigationTarget: '_self' | '_blank',
|
|
3
|
+
urlString: string,
|
|
4
|
+
customNavigationHandler?: Function
|
|
5
|
+
): void => {
|
|
6
|
+
// Call custom navigation method if passed
|
|
7
|
+
if (customNavigationHandler) {
|
|
8
|
+
customNavigationHandler(urlString)
|
|
9
|
+
return
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// Abort if value is blank
|
|
13
|
+
if (0 === urlString.length) {
|
|
14
|
+
throw Error('Blank string passed as URL. Navigation aborted.')
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const urlObj = new URL(urlString, window.location.origin)
|
|
18
|
+
|
|
19
|
+
// Open constructed link in new tab/window
|
|
20
|
+
window.open(urlObj.toString(), navigationTarget)
|
|
21
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// if city has a hyphen then in tooltip it ends up UPPER CASE instead of just regular Upper Case
|
|
2
|
+
// - this function is used to prevent that and instead give the formatting that is wanted
|
|
3
|
+
// Example: Desired city display in tooltip on map: "Inter-Tribal Indian Reservation"
|
|
4
|
+
export const titleCase = string => {
|
|
5
|
+
// guard clause else error in editor
|
|
6
|
+
if (!string) return
|
|
7
|
+
|
|
8
|
+
if (string !== undefined) {
|
|
9
|
+
const toTitleCase = word => word.charAt(0).toUpperCase() + word.substring(1).toLowerCase()
|
|
10
|
+
|
|
11
|
+
if (string.toUpperCase().includes('U.S.') || string.toUpperCase().includes('US')) {
|
|
12
|
+
return string
|
|
13
|
+
.split(' ')
|
|
14
|
+
.map(word => {
|
|
15
|
+
if (word.toUpperCase() === 'U.S.' || word.toUpperCase() === 'US') {
|
|
16
|
+
return word.toUpperCase()
|
|
17
|
+
} else {
|
|
18
|
+
return toTitleCase(word)
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
|
+
.join(' ')
|
|
22
|
+
}
|
|
23
|
+
// if hyphen found, then split, uppercase each word, and put back together
|
|
24
|
+
if (string.includes('–') || string.includes('-')) {
|
|
25
|
+
let dashSplit = string.includes('–') ? string.split('–') : string.split('-') // determine hyphen or en dash to split on
|
|
26
|
+
let splitCharacter = string.includes('–') ? '–' : '-' // print hyphen or en dash later on.
|
|
27
|
+
let frontSplit = dashSplit[0]
|
|
28
|
+
.split(' ')
|
|
29
|
+
.map(word => word.charAt(0).toUpperCase() + word.substring(1).toLowerCase())
|
|
30
|
+
.join(' ')
|
|
31
|
+
let backSplit = dashSplit[1]
|
|
32
|
+
.split(' ')
|
|
33
|
+
.map(word => word.charAt(0).toUpperCase() + word.substring(1).toLowerCase())
|
|
34
|
+
.join(' ')
|
|
35
|
+
return frontSplit + splitCharacter + backSplit
|
|
36
|
+
} else {
|
|
37
|
+
// just return with each word uppercase
|
|
38
|
+
return string
|
|
39
|
+
.split(' ')
|
|
40
|
+
.map(word => word.charAt(0).toUpperCase() + word.substring(1).toLowerCase())
|
|
41
|
+
.join(' ')
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { MapConfig } from '../types/MapConfig'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Validates and ensures proper formatting of FIPS codes in the provided `MapConfig` object.
|
|
5
|
+
*
|
|
6
|
+
* - If the `geoType` is "us-county" or "us" with associated data:
|
|
7
|
+
* - Iterates through each data entry in `newState.data`.
|
|
8
|
+
* - Checks if the value in the `geo` column is numeric and has a length of 4.
|
|
9
|
+
* - If so, prepends a `0` to ensure a valid 5-digit FIPS code.
|
|
10
|
+
* - Converts the `geo` column value to a string for consistency.
|
|
11
|
+
*
|
|
12
|
+
* @param newState - The state object containing map data and configuration.
|
|
13
|
+
* @returns The updated state object with corrected FIPS code formatting.
|
|
14
|
+
*/
|
|
15
|
+
export const validateFipsCodeLength = (newState: MapConfig) => {
|
|
16
|
+
if (newState.general.geoType === 'us-county' || (newState.general.geoType === 'us' && newState?.data)) {
|
|
17
|
+
newState?.data.forEach(dataPiece => {
|
|
18
|
+
if (dataPiece[newState.columns.geo.name]) {
|
|
19
|
+
if (
|
|
20
|
+
!isNaN(parseInt(dataPiece[newState.columns.geo.name])) &&
|
|
21
|
+
dataPiece[newState.columns.geo.name].length === 4
|
|
22
|
+
) {
|
|
23
|
+
dataPiece[newState.columns.geo.name] = 0 + dataPiece[newState.columns.geo.name]
|
|
24
|
+
}
|
|
25
|
+
dataPiece[newState.columns.geo.name] = dataPiece[newState.columns.geo.name].toString()
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
}
|
|
29
|
+
return newState
|
|
30
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { useState, useCallback, useEffect } from 'react'
|
|
2
|
+
import { type ViewPort } from '@cdc/core/types/ViewPort'
|
|
3
|
+
import { type DimensionsType } from '@cdc/core/types/Dimensions'
|
|
4
|
+
import getViewport from '@cdc/core/helpers/getViewport'
|
|
5
|
+
import ResizeObserver from 'resize-observer-polyfill'
|
|
6
|
+
|
|
7
|
+
export const useResizeObserver = (isEditor: boolean) => {
|
|
8
|
+
const [dimensions, setDimensions] = useState<DimensionsType>([0, 0])
|
|
9
|
+
const [currentViewport, setCurrentViewport] = useState<ViewPort>(null)
|
|
10
|
+
const [container, setContainer] = useState<HTMLElement | null>(null)
|
|
11
|
+
|
|
12
|
+
const resizeObserver = new ResizeObserver(entries => {
|
|
13
|
+
for (let entry of entries) {
|
|
14
|
+
let { width, height } = entry.contentRect
|
|
15
|
+
let newViewport = getViewport(entry.contentRect.width)
|
|
16
|
+
|
|
17
|
+
let editorWidth = 350
|
|
18
|
+
|
|
19
|
+
setCurrentViewport(newViewport)
|
|
20
|
+
|
|
21
|
+
if (isEditor) {
|
|
22
|
+
width = width - editorWidth
|
|
23
|
+
}
|
|
24
|
+
setDimensions([width, height])
|
|
25
|
+
}
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
const outerContainerRef = useCallback(node => {
|
|
29
|
+
if (node !== null) {
|
|
30
|
+
resizeObserver.observe(node)
|
|
31
|
+
}
|
|
32
|
+
setContainer(node)
|
|
33
|
+
|
|
34
|
+
return () => {
|
|
35
|
+
resizeObserver.disconnect()
|
|
36
|
+
}
|
|
37
|
+
}, [])
|
|
38
|
+
|
|
39
|
+
return { resizeObserver, dimensions, currentViewport, outerContainerRef, container }
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default useResizeObserver
|
package/src/hooks/useTooltip.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { displayDataAsText } from '../../../core/helpers/displayDataAsText'
|
|
2
|
+
|
|
1
3
|
const useTooltip = props => {
|
|
2
|
-
const { state, displayGeoName,
|
|
4
|
+
const { state, displayGeoName, supportedStatesFipsCodes } = props
|
|
3
5
|
|
|
4
6
|
const config = state
|
|
5
7
|
|
|
@@ -105,7 +107,7 @@ const useTooltip = props => {
|
|
|
105
107
|
let tooltipValue = handleTooltipSpecialClassText(specialClasses, column, row, '', columnKey)
|
|
106
108
|
|
|
107
109
|
if (!tooltipValue) {
|
|
108
|
-
tooltipValue = row ? displayDataAsText(row[column.name], columnKey) : 'No Data'
|
|
110
|
+
tooltipValue = row ? displayDataAsText(row[column.name], columnKey, state) : 'No Data'
|
|
109
111
|
}
|
|
110
112
|
|
|
111
113
|
toolTipText += handleTooltipPrimaryColumn(tooltipValue, column)
|
package/src/index.jsx
CHANGED
package/src/scss/filters.scss
CHANGED
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
label {
|
|
13
13
|
display: inherit;
|
|
14
14
|
margin-bottom: 5px;
|
|
15
|
-
font-weight: 600;
|
|
16
15
|
font-size: 16px;
|
|
17
16
|
}
|
|
18
17
|
}
|
|
@@ -22,10 +21,6 @@
|
|
|
22
21
|
flex-wrap: wrap;
|
|
23
22
|
}
|
|
24
23
|
|
|
25
|
-
label:not(:empty) {
|
|
26
|
-
margin-right: 0.4em;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
24
|
.single-filter {
|
|
30
25
|
margin-bottom: 0.5em;
|
|
31
26
|
}
|
package/src/scss/main.scss
CHANGED
|
@@ -48,7 +48,6 @@
|
|
|
48
48
|
.cdc-map-inner-container {
|
|
49
49
|
@import './map';
|
|
50
50
|
flex-grow: 1;
|
|
51
|
-
text-rendering: geometricPrecision;
|
|
52
51
|
color: #202020;
|
|
53
52
|
border: 0;
|
|
54
53
|
text-align: left;
|
|
@@ -81,10 +80,7 @@
|
|
|
81
80
|
content: ' ';
|
|
82
81
|
position: absolute;
|
|
83
82
|
top: 0;
|
|
84
|
-
left: -1em;
|
|
85
|
-
right: -1em;
|
|
86
83
|
bottom: 0;
|
|
87
|
-
background: rgba(0, 0, 0, 0.05);
|
|
88
84
|
z-index: 7;
|
|
89
85
|
}
|
|
90
86
|
.modal-content {
|
|
@@ -94,71 +90,72 @@
|
|
|
94
90
|
top: 50%;
|
|
95
91
|
left: 50%;
|
|
96
92
|
display: flex;
|
|
97
|
-
flex-direction:
|
|
98
|
-
border-radius: 5px;
|
|
93
|
+
flex-direction: column;
|
|
99
94
|
transform: translate(-50%, -50%);
|
|
100
|
-
border: rgba(0, 0, 0, 0.3)
|
|
101
|
-
box-shadow: rgba(0, 0, 0, 0.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
font-size: 1rem;
|
|
105
|
-
border-radius: 4px;
|
|
95
|
+
border: 1px solid rgba(0, 0, 0, 0.3);
|
|
96
|
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
97
|
+
border-radius: 5px;
|
|
98
|
+
padding: 16px 40px;
|
|
106
99
|
min-width: 250px;
|
|
107
|
-
padding: 16px 40px 16px 20px;
|
|
108
100
|
width: auto;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
101
|
+
max-height: 90vh; /* Constrain the modal's height to 90% of the viewport */
|
|
102
|
+
overflow-y: auto; /* Enable vertical scrolling if content overflows */
|
|
103
|
+
font-size: 1rem;
|
|
104
|
+
line-height: 1.4em;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.modal-content .content {
|
|
108
|
+
flex-grow: 1;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.modal-content .legend-item {
|
|
112
|
+
margin-right: 0.75em;
|
|
113
|
+
margin-top: 3px;
|
|
114
|
+
flex-shrink: 0;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.modal-content strong {
|
|
118
|
+
font-weight: 600;
|
|
119
|
+
font-size: 1.2em;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.modal-content .modal-close {
|
|
123
|
+
position: absolute;
|
|
124
|
+
right: 20px;
|
|
125
|
+
top: 18px;
|
|
126
|
+
cursor: pointer;
|
|
127
|
+
width: 1em;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.modal-content a.navigation-link {
|
|
131
|
+
text-decoration: underline;
|
|
132
|
+
cursor: pointer;
|
|
133
|
+
color: #075290;
|
|
134
|
+
display: flex;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.modal-content a.navigation-link svg {
|
|
138
|
+
display: inline-block;
|
|
139
|
+
max-width: 13px;
|
|
140
|
+
margin-left: 0.5em;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.modal-content.capitalize p {
|
|
144
|
+
text-transform: capitalize;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/* Responsive adjustments for smaller screens */
|
|
148
|
+
@media (max-width: 1048px) {
|
|
149
|
+
.modal-content {
|
|
150
|
+
width: 90%; /* Adjust width to fit smaller screens */
|
|
151
|
+
top: 10%; /* Offset from the top for better usability */
|
|
152
|
+
transform: translate(-50%, 0); /* Remove vertical centering */
|
|
155
153
|
}
|
|
156
154
|
}
|
|
157
155
|
}
|
|
158
156
|
}
|
|
159
157
|
|
|
160
158
|
p.subtext {
|
|
161
|
-
font-size: 0.9em;
|
|
162
159
|
em {
|
|
163
160
|
font-style: italic;
|
|
164
161
|
}
|
|
@@ -168,7 +165,6 @@
|
|
|
168
165
|
}
|
|
169
166
|
|
|
170
167
|
span.legend-item {
|
|
171
|
-
margin-right: 5px;
|
|
172
168
|
border-radius: 300px;
|
|
173
169
|
vertical-align: middle;
|
|
174
170
|
display: inline-block;
|
package/src/scss/map.scss
CHANGED
|
@@ -75,7 +75,6 @@ $medium: 768px;
|
|
|
75
75
|
position: relative;
|
|
76
76
|
flex-grow: 1;
|
|
77
77
|
width: 100%;
|
|
78
|
-
overflow: hidden;
|
|
79
78
|
.geo-point {
|
|
80
79
|
transition: 0.3s all;
|
|
81
80
|
circle {
|
|
@@ -102,10 +101,7 @@ $medium: 768px;
|
|
|
102
101
|
}
|
|
103
102
|
|
|
104
103
|
.territories-label {
|
|
105
|
-
|
|
106
|
-
font-size: 1.1em;
|
|
107
|
-
display: block;
|
|
108
|
-
margin-top: 15px;
|
|
104
|
+
font-size: 1em;
|
|
109
105
|
}
|
|
110
106
|
|
|
111
107
|
// Cities and Territories
|
|
@@ -194,7 +190,6 @@ $medium: 768px;
|
|
|
194
190
|
transform: none;
|
|
195
191
|
}
|
|
196
192
|
.territories {
|
|
197
|
-
font-size: 1em;
|
|
198
193
|
> span {
|
|
199
194
|
margin-left: 0;
|
|
200
195
|
}
|
|
@@ -327,10 +322,3 @@ canvas {
|
|
|
327
322
|
pointer-events: none;
|
|
328
323
|
display: none;
|
|
329
324
|
}
|
|
330
|
-
|
|
331
|
-
.data-table-container {
|
|
332
|
-
margin: 20px 0px 0px;
|
|
333
|
-
&.download-link-above {
|
|
334
|
-
margin-top: 0;
|
|
335
|
-
}
|
|
336
|
-
}
|
package/src/types/MapConfig.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { ComponentThemes } from '@cdc/core/types/ComponentThemes'
|
|
2
|
-
import { Visualization } from '@cdc/core/types/Visualization'
|
|
3
|
-
import { EditorColumnProperties } from '@cdc/core/types/EditorColumnProperties'
|
|
4
|
-
import { Version } from '@cdc/core/types/Version'
|
|
1
|
+
import { type ComponentThemes } from '@cdc/core/types/ComponentThemes'
|
|
2
|
+
import { type Visualization } from '@cdc/core/types/Visualization'
|
|
3
|
+
import { type EditorColumnProperties } from '@cdc/core/types/EditorColumnProperties'
|
|
4
|
+
import { type Version } from '@cdc/core/types/Version'
|
|
5
|
+
import { type VizFilter } from '@cdc/core/types/VizFilter'
|
|
5
6
|
|
|
6
7
|
export type MapVisualSettings = {
|
|
7
8
|
/** minBubbleSize - Minimum Circle Size when the map has a type of bubble */
|
|
@@ -15,9 +16,8 @@ export type MapVisualSettings = {
|
|
|
15
16
|
/** cityStyle - optional visual indicator of label on the Legend */
|
|
16
17
|
cityStyleLabel: string
|
|
17
18
|
/** geoCodeCircleSize - controls the size of the city style option (circle or pin) */
|
|
18
|
-
|
|
19
19
|
geoCodeCircleSize: number
|
|
20
|
-
/** showBubbleZeros - shows circles on maps when the data is provided even if
|
|
20
|
+
/** showBubbleZeros - shows circles on maps when the data is provided even if it's a zero value */
|
|
21
21
|
showBubbleZeros: boolean
|
|
22
22
|
/** additionalCityStyles - shows Circle, Square, Triangle, Rhombus/Diamond, Star, Map Pin on maps when the additionalCityStyles is added */
|
|
23
23
|
additionalCityStyles: [] | [{ label: string; column: string; value: string; shape: string }]
|
|
@@ -46,7 +46,7 @@ export type PrimaryColumnProperties = Pick<
|
|
|
46
46
|
EditorColumnProperties,
|
|
47
47
|
'dataTable' | 'label' | 'name' | 'prefix' | 'suffix' | 'tooltip'
|
|
48
48
|
>
|
|
49
|
-
|
|
49
|
+
|
|
50
50
|
export type LegendShapeItem = {
|
|
51
51
|
column: string
|
|
52
52
|
key: string
|
|
@@ -77,11 +77,11 @@ export type MapConfig = Visualization & {
|
|
|
77
77
|
navigate: NavigateColumnProperties
|
|
78
78
|
latitude: LatitudeColumnProperties
|
|
79
79
|
longitude: LongitudeColumnProperties
|
|
80
|
-
categorical: { name }
|
|
80
|
+
categorical: { name: string }
|
|
81
81
|
}
|
|
82
82
|
dataUrl: string
|
|
83
83
|
runtimeDataUrl: string
|
|
84
|
-
filters:
|
|
84
|
+
filters: VizFilter[]
|
|
85
85
|
general: {
|
|
86
86
|
allowMapZoom: boolean
|
|
87
87
|
convertFipsCodes: boolean
|
|
@@ -90,7 +90,16 @@ export type MapConfig = Visualization & {
|
|
|
90
90
|
fullBorder: boolean
|
|
91
91
|
geoBorderColor: string
|
|
92
92
|
geoLabelOverride: string
|
|
93
|
-
geoType:
|
|
93
|
+
geoType:
|
|
94
|
+
| 'us'
|
|
95
|
+
| 'us-region'
|
|
96
|
+
| 'us-county'
|
|
97
|
+
| 'world'
|
|
98
|
+
| 'us-geocode'
|
|
99
|
+
| 'world-geocode'
|
|
100
|
+
| 'bubble'
|
|
101
|
+
| 'single-state'
|
|
102
|
+
| 'google-map'
|
|
94
103
|
hasRegions: boolean
|
|
95
104
|
headerColor: ComponentThemes
|
|
96
105
|
hideGeoColumnInTooltip: boolean
|
|
@@ -150,7 +159,7 @@ export type MapConfig = Visualization & {
|
|
|
150
159
|
tooltips: {
|
|
151
160
|
appearanceType: 'hover' | 'click'
|
|
152
161
|
linkLabel: string
|
|
153
|
-
capitalizeLabels:
|
|
162
|
+
capitalizeLabels: boolean
|
|
154
163
|
opacity: number
|
|
155
164
|
}
|
|
156
165
|
runtime: {
|