@cdc/map 4.23.2 → 4.23.3

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.
@@ -45,26 +45,7 @@ const CityList = ({ data, state, geoClickHandler, applyTooltipsToGeo, displayGeo
45
45
  return true
46
46
  }
47
47
 
48
- const styles = {
49
- fill: legendColors[0],
50
- opacity: setSharedFilterValue && isFilterValueSupported && data[city][state.columns.geo.name] !== setSharedFilterValue ? 0.5 : 1,
51
- stroke: setSharedFilterValue && isFilterValueSupported && data[city][state.columns.geo.name] === setSharedFilterValue ? 'rgba(0, 0, 0, 1)' : 'rgba(0, 0, 0, 0.4)',
52
- '&:hover': {
53
- fill: legendColors[1],
54
- outline: 0
55
- },
56
- '&:active': {
57
- fill: legendColors[2],
58
- outline: 0
59
- }
60
- }
61
-
62
- const toolTip = applyTooltipsToGeo(cityDisplayName, data[city])
63
-
64
- // If we need to add a cursor pointer
65
- if ((state.columns.navigate && geoData?.[state.columns.navigate.name] && geoData[state.columns.navigate.name]) || state.tooltips.appearanceType === 'click') {
66
- styles.cursor = 'pointer'
67
- }
48
+ const toolTip = applyTooltipsToGeo(cityDisplayName, isGeoCodeMap ? geoData : data[city])
68
49
 
69
50
  const radius = state.general.geoType === 'us' && !isGeoCodeMap ? 8 : isGeoCodeMap ? state.visual.geoCodeCircleSize : 4
70
51
 
@@ -72,23 +53,19 @@ const CityList = ({ data, state, geoClickHandler, applyTooltipsToGeo, displayGeo
72
53
  fillOpacity: state.general.type === 'bubble' ? 0.4 : 1
73
54
  }
74
55
 
75
- const circle = <circle cx={0} cy={0} r={state.general.type === 'bubble' ? size(geoData[state.columns.primary.name]) : radius}
76
- title='Click for more information'
77
- onClick={() => geoClickHandler(cityDisplayName, geoData)}
78
- data-tooltip-id="tooltip"
79
- data-tooltip-html={toolTip}
80
- {...additionalProps}
81
- />
56
+ const circle = <circle cx={0} cy={0} r={state.general.type === 'bubble' ? size(geoData[state.columns.primary.name]) : radius} title='Click for more information' onClick={() => geoClickHandler(cityDisplayName, geoData)} data-tooltip-id='tooltip' data-tooltip-html={toolTip} {...additionalProps} />
82
57
 
83
58
  const pin = (
84
- <path className='marker' 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'
85
- title='Click for more information'
86
- onClick={() => geoClickHandler(cityDisplayName, geoData)}
87
- strokeWidth={2}
88
- stroke={'black'}
89
- data-tooltip-id="tooltip"
90
- data-tooltip-html={toolTip}
91
- {...additionalProps}
59
+ <path
60
+ className='marker'
61
+ 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'
62
+ title='Click for more information'
63
+ onClick={() => geoClickHandler(cityDisplayName, geoData)}
64
+ strokeWidth={2}
65
+ stroke={'black'}
66
+ data-tooltip-id='tooltip'
67
+ data-tooltip-html={toolTip}
68
+ {...additionalProps}
92
69
  />
93
70
  )
94
71
 
@@ -98,9 +75,32 @@ const CityList = ({ data, state, geoClickHandler, applyTooltipsToGeo, displayGeo
98
75
  transform = `translate(${projection(supportedCities[city])})`
99
76
  }
100
77
 
78
+ let needsPointer = false
79
+
101
80
  if (isGeoCodeMap) {
102
81
  let coords = [Number(geoData?.[state.columns.longitude.name]), Number(geoData?.[state.columns.latitude.name])]
103
82
  transform = `translate(${projection(coords)})`
83
+ needsPointer = true
84
+ }
85
+
86
+ const styles = {
87
+ fill: legendColors[0],
88
+ opacity: setSharedFilterValue && isFilterValueSupported && data[city][state.columns.geo.name] !== setSharedFilterValue ? 0.5 : 1,
89
+ stroke: setSharedFilterValue && isFilterValueSupported && data[city][state.columns.geo.name] === setSharedFilterValue ? 'rgba(0, 0, 0, 1)' : 'rgba(0, 0, 0, 0.4)',
90
+ '&:hover': {
91
+ fill: legendColors[1],
92
+ outline: 0
93
+ },
94
+ '&:active': {
95
+ fill: legendColors[2],
96
+ outline: 0
97
+ },
98
+ cursor: needsPointer ? 'pointer' : 'default'
99
+ }
100
+
101
+ // If we need to add a cursor pointer
102
+ if ((state.columns.navigate && geoData?.[state.columns.navigate.name] && geoData[state.columns.navigate.name]) || state.tooltips.appearanceType === 'click') {
103
+ styles.cursor = 'pointer'
104
104
  }
105
105
 
106
106
  return (