@cdc/map 4.24.11 → 4.24.12-2

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.
Files changed (49) hide show
  1. package/dist/cdcmap.js +34008 -33475
  2. package/examples/default-geocode.json +13 -4
  3. package/examples/default-usa-regions.json +267 -117
  4. package/examples/example-city-state.json +6 -3
  5. package/examples/pattern.json +861 -0
  6. package/examples/private/DEV-9989.json +229 -0
  7. package/examples/private/ardi.json +180 -0
  8. package/examples/private/colors 2.json +416 -0
  9. package/examples/private/colors.json +416 -0
  10. package/examples/private/colors.json.zip +0 -0
  11. package/examples/private/customColors.json +45348 -0
  12. package/examples/private/default-patterns.json +867 -0
  13. package/examples/private/test.json +1632 -0
  14. package/index.html +4 -5
  15. package/package.json +3 -3
  16. package/src/CdcMap.tsx +82 -79
  17. package/src/_stories/{CdcMapLegend.stories.tsx → CdcMap.Legend.Gradient.stories.tsx} +1 -20
  18. package/src/_stories/CdcMap.Legend.stories.tsx +40 -0
  19. package/src/_stories/CdcMap.Patterns.stories.tsx +29 -0
  20. package/src/_stories/CdcMap.stories.tsx +59 -0
  21. package/src/_stories/UsaMap.NoData.stories.tsx +19 -0
  22. package/src/_stories/_mock/custom-layer-map.json +1117 -0
  23. package/src/_stories/_mock/default-patterns.json +865 -0
  24. package/src/_stories/_mock/example-city-state.json +858 -0
  25. package/src/components/CityList.tsx +5 -2
  26. package/src/components/EditorPanel/components/EditorPanel.tsx +39 -256
  27. package/src/components/EditorPanel/components/Panels/Panel.PatternSettings.tsx +1 -1
  28. package/src/components/Legend/components/Legend.tsx +22 -6
  29. package/src/components/Legend/components/index.scss +16 -23
  30. package/src/components/UsaMap/components/SingleState/SingleState.CountyOutput.tsx +40 -6
  31. package/src/components/UsaMap/components/SingleState/SingleState.StateOutput.tsx +10 -2
  32. package/src/components/UsaMap/components/Territory/Territory.Hexagon.tsx +1 -1
  33. package/src/components/UsaMap/components/Territory/Territory.Rectangle.tsx +14 -13
  34. package/src/components/UsaMap/components/UsaMap.County.tsx +11 -13
  35. package/src/components/UsaMap/components/UsaMap.Region.tsx +59 -16
  36. package/src/components/UsaMap/components/UsaMap.SingleState.tsx +2 -1
  37. package/src/components/UsaMap/components/UsaMap.State.tsx +58 -60
  38. package/src/components/WorldMap/WorldMap.tsx +77 -16
  39. package/src/data/initial-state.js +2 -1
  40. package/src/helpers/applyColorToLegend.ts +80 -0
  41. package/src/helpers/colors.ts +23 -0
  42. package/src/hooks/useTooltip.ts +9 -6
  43. package/src/scss/filters.scss +0 -3
  44. package/src/scss/main.scss +0 -1
  45. package/src/scss/map.scss +11 -59
  46. package/src/types/MapConfig.ts +7 -1
  47. package/src/types/MapContext.ts +1 -0
  48. package/examples/default-patterns.json +0 -579
  49. package/src/scss/datatable.scss +0 -6
@@ -1,6 +1,7 @@
1
1
  import React, { useContext } from 'react'
2
2
  import ConfigContext from '../../../../context'
3
3
  import { MapContext } from '../../../../types/MapContext'
4
+ import { getGeoFillColor } from '../../../../helpers/colors'
4
5
 
5
6
  interface CountyOutputProps {
6
7
  counties: any[]
@@ -11,7 +12,10 @@ interface CountyOutputProps {
11
12
  }
12
13
 
13
14
  const CountyOutput: React.FC<CountyOutputProps> = ({ path, counties, scale, geoStrokeColor, tooltipId }) => {
14
- const { applyTooltipsToGeo, applyLegendToRow, displayGeoName, state, data, geoClickHandler } = useContext<MapContext>(ConfigContext)
15
+ const { applyTooltipsToGeo, applyLegendToRow, displayGeoName, state, data, geoClickHandler } =
16
+ useContext<MapContext>(ConfigContext)
17
+
18
+ const geoFillColor = getGeoFillColor(state)
15
19
  return (
16
20
  <>
17
21
  {counties.map(county => {
@@ -50,19 +54,49 @@ const CountyOutput: React.FC<CountyOutputProps> = ({ path, counties, scale, geoS
50
54
  }
51
55
 
52
56
  // When to add pointer cursor
53
- if ((state.columns.navigate && geoData[state.columns.navigate.name]) || state.tooltips.appearanceType === 'hover') {
57
+ if (
58
+ (state.columns.navigate && geoData[state.columns.navigate.name]) ||
59
+ state.tooltips.appearanceType === 'hover'
60
+ ) {
54
61
  styles.cursor = 'pointer'
55
62
  }
56
63
 
57
64
  return (
58
- <g key={`key--${county.id}`} className={`county county--${geoDisplayName.split(' ').join('')} county--${geoData[state.columns.geo.name]}`} style={styles} onClick={() => geoClickHandler(geoDisplayName, geoData)} data-tooltip-id={`tooltip__${tooltipId}`} data-tooltip-html={toolTip}>
59
- <path tabIndex={-1} className={`county`} stroke={geoStrokeColor} d={countyPath} strokeWidth={0.75 / scale} />
65
+ <g
66
+ key={`key--${county.id}`}
67
+ className={`county county--${geoDisplayName.split(' ').join('')} county--${
68
+ geoData[state.columns.geo.name]
69
+ }`}
70
+ style={styles}
71
+ onClick={() => geoClickHandler(geoDisplayName, geoData)}
72
+ data-tooltip-id={`tooltip__${tooltipId}`}
73
+ data-tooltip-html={toolTip}
74
+ >
75
+ <path
76
+ tabIndex={-1}
77
+ className={`county`}
78
+ stroke={geoStrokeColor}
79
+ d={countyPath}
80
+ strokeWidth={0.75 / scale}
81
+ />
60
82
  </g>
61
83
  )
62
84
  } else {
63
85
  return (
64
- <g key={`key--${county.id}`} className={`county county--${geoDisplayName.split(' ').join('')}`} style={{ fill: '#e6e6e6' }} data-tooltip-id={`tooltip__${tooltipId}`} data-tooltip-html={toolTip}>
65
- <path tabIndex={-1} className={`county`} stroke={geoStrokeColor} d={countyPath} strokeWidth={0.75 / scale} />
86
+ <g
87
+ key={`key--${county.id}`}
88
+ className={`county county--${geoDisplayName.split(' ').join('')}`}
89
+ style={{ fill: geoFillColor }}
90
+ data-tooltip-id={`tooltip__${tooltipId}`}
91
+ data-tooltip-html={toolTip}
92
+ >
93
+ <path
94
+ tabIndex={-1}
95
+ className={`county`}
96
+ stroke={geoStrokeColor}
97
+ d={countyPath}
98
+ strokeWidth={0.75 / scale}
99
+ />
66
100
  </g>
67
101
  )
68
102
  }
@@ -1,6 +1,7 @@
1
1
  import { useContext } from 'react'
2
2
  import { mesh, Topology } from 'topojson-client'
3
3
  import ConfigContext from '../../../../context'
4
+ import { getGeoFillColor, getGeoStrokeColor } from '../../../../helpers/colors'
4
5
 
5
6
  type StateOutputProps = {
6
7
  topoData: Topology
@@ -15,12 +16,19 @@ const StateOutput: React.FC<StateOutputProps> = ({ topoData, path, scale, stateT
15
16
  return s.properties.name === state.general.statePicked.stateName
16
17
  })
17
18
 
18
- const geoStrokeColor = state.general.geoBorderColor === 'darkGray' ? 'rgba(0, 0, 0, 0.2)' : 'rgba(255,255,255,0.7)'
19
+ const geoStrokeColor = getGeoStrokeColor(state)
20
+ const geoFillColor = getGeoFillColor(state)
19
21
 
20
22
  let stateLines = path(mesh(topoData, geo[0]))
21
23
 
22
24
  return (
23
- <g key={'single-state'} className='single-state' style={{ fill: '#E6E6E6' }} stroke={geoStrokeColor} strokeWidth={0.95 / scale}>
25
+ <g
26
+ key={'single-state'}
27
+ className='single-state'
28
+ style={{ fill: geoFillColor }}
29
+ stroke={geoStrokeColor}
30
+ strokeWidth={0.95 / scale}
31
+ >
24
32
  <path tabIndex={-1} className='state-path' d={stateLines} />
25
33
  </g>
26
34
  )
@@ -176,7 +176,7 @@ const TerritoryHexagon = ({
176
176
 
177
177
  return (
178
178
  territoryData && (
179
- <svg viewBox='0 0 45 51' className='territory-wrapper--hex'>
179
+ <svg viewBox='-1 -1 46 53' className='territory-wrapper--hex'>
180
180
  <g {...props} data-tooltip-html={dataTooltipHtml} data-tooltip-id={dataTooltipId} onClick={handleShapeClick}>
181
181
  <polygon
182
182
  stroke={stroke}
@@ -2,7 +2,7 @@ import { useContext } from 'react'
2
2
  import { PatternLines, PatternCircles, PatternWaves } from '@visx/pattern'
3
3
  import ConfigContext from './../../../../context'
4
4
  import { type MapContext } from '../../../../types/MapContext'
5
- import { patternSizes } from './../../helpers/patternSizes'
5
+ import { patternSizes } from '../../helpers/patternSizes'
6
6
  import { getContrastColor } from '@cdc/core/helpers/cove/accessibility'
7
7
  import { type TerritoryShape } from './TerritoryShape'
8
8
 
@@ -17,15 +17,16 @@ const TerritoryRectangle: React.FC<TerritoryShape> = ({
17
17
  territory,
18
18
  text,
19
19
  textColor,
20
+ backgroundColor,
20
21
  ...props
21
22
  }) => {
22
- const { state, supportedTerritories } = useContext<MapContext>(ConfigContext)
23
+ const { state } = useContext<MapContext>(ConfigContext)
23
24
  const { territoryData, ...otherProps } = props
24
25
  const rectanglePath =
25
- 'M40,0.5 C41.2426407,0.5 42.3676407,1.00367966 43.1819805,1.81801948 C43.9963203,2.63235931 44.5,3.75735931 44.5,5 L44.5,5 L44.5,23 C44.5,24.2426407 43.9963203,25.3676407 43.1819805,26.1819805 C42.3676407,26.9963203 41.2426407,27.5 40,27.5 L40,27.5 L5,27.5 C3.75735931,27.5 2.63235931,26.9963203 1.81801948,26.1819805 C1.00367966,25.3676407 0.5,24.2426407 0.5,23 L0.5,23 L0.5,5 C0.5,3.75735931 1.00367966,2.63235931 1.81801948,1.81801948 C2.63235931,1.00367966 3.75735931,0.5 5,0.5 L5,0.5 Z'
26
+ 'M42,0.5 C42.8284271,0.5 43.5,1.17157288 43.5,2 L43.5,2 L43.5,26 C43.5,26.8284271 42.8284271,27.5 42,27.5 L42,27.5 L3,27.5 C2.17157288,27.5 1.5,26.8284271 1.5,26 L1.5,26 L1.5,2 C1.5,1.17157288 2.17157288,0.5 3,0.5 L3,0.5 Z'
26
27
 
27
28
  return (
28
- <svg viewBox='0 0 45 28' key={territory} className={territory}>
29
+ <svg viewBox='0 0 45 29' key={territory} className={territory}>
29
30
  <g
30
31
  {...otherProps}
31
32
  strokeLinejoin='round'
@@ -41,7 +42,7 @@ const TerritoryRectangle: React.FC<TerritoryShape> = ({
41
42
  x='50%'
42
43
  y='54%'
43
44
  fill={text}
44
- style={{ stroke: textColor, strokeWidth: 1 }}
45
+ style={{ stroke: 'none' }}
45
46
  className='territory-text'
46
47
  paintOrder='stroke'
47
48
  onClick={handleShapeClick}
@@ -52,8 +53,8 @@ const TerritoryRectangle: React.FC<TerritoryShape> = ({
52
53
  </text>
53
54
 
54
55
  {state.map.patterns.map((patternData, patternIndex) => {
55
- const patternColor = getContrastColor('#FFF', props.style.fill)
56
- const hasMatchingValues = supportedTerritories[territory]?.includes(patternData?.dataValue)
56
+ const patternColor = patternData.color || getContrastColor('#FFF', backgroundColor)
57
+ const hasMatchingValues = patternData.dataValue === territoryData?.[patternData.dataKey]
57
58
 
58
59
  if (!hasMatchingValues) return null
59
60
  if (!patternData.pattern) return null
@@ -62,7 +63,7 @@ const TerritoryRectangle: React.FC<TerritoryShape> = ({
62
63
  <>
63
64
  {patternData?.pattern === 'waves' && (
64
65
  <PatternWaves
65
- id={`territory-${patternData?.dataKey}--${patternIndex}`}
66
+ id={`territory-${territory}-${patternData?.dataKey}--${patternIndex}`}
66
67
  height={patternSizes[patternData?.size] ?? 10}
67
68
  width={patternSizes[patternData?.size] ?? 10}
68
69
  fill={patternColor}
@@ -71,7 +72,7 @@ const TerritoryRectangle: React.FC<TerritoryShape> = ({
71
72
  )}
72
73
  {patternData?.pattern === 'circles' && (
73
74
  <PatternCircles
74
- id={`territory-${patternData?.dataKey}--${patternIndex}`}
75
+ id={`territory-${territory}-${patternData?.dataKey}--${patternIndex}`}
75
76
  height={patternSizes[patternData?.size] ?? 10}
76
77
  width={patternSizes[patternData?.size] ?? 10}
77
78
  fill={patternColor}
@@ -80,7 +81,7 @@ const TerritoryRectangle: React.FC<TerritoryShape> = ({
80
81
  )}
81
82
  {patternData?.pattern === 'lines' && (
82
83
  <PatternLines
83
- id={`territory-${patternData?.dataKey}--${patternIndex}`}
84
+ id={`territory-${territory}-${patternData?.dataKey}--${patternIndex}`}
84
85
  height={patternSizes[patternData?.size] ?? 6}
85
86
  width={patternSizes[patternData?.size] ?? 6}
86
87
  stroke={patternColor}
@@ -92,11 +93,11 @@ const TerritoryRectangle: React.FC<TerritoryShape> = ({
92
93
  stroke={stroke}
93
94
  strokeWidth={strokeWidth}
94
95
  d={rectanglePath}
95
- fill={`url(#territory-${patternData?.dataKey}--${patternIndex})`}
96
+ fill={`url(#territory-${territory}-${patternData?.dataKey}--${patternIndex})`}
96
97
  color={patternData ? 'white' : textColor}
97
98
  className={[
98
- `territory-pattern-${patternData.dataKey}`,
99
- `territory-pattern-${patternData.dataKey}--${patternData.dataValue}`
99
+ `territory-pattern-${patternData?.dataKey}`,
100
+ `territory-pattern-${patternData?.dataKey}--${patternData.dataValue}`
100
101
  ].join(' ')}
101
102
  />
102
103
  <text
@@ -21,6 +21,7 @@ import {
21
21
  drawShape,
22
22
  createShapeProperties
23
23
  } from '../helpers/shapes'
24
+ import { getGeoStrokeColor } from '../../../helpers/colors'
24
25
 
25
26
  const getCountyTopoURL = year => {
26
27
  return `https://www.cdc.gov/TemplatePackage/contrib/data/county-topography/cb_${year}_us_county_20m.json`
@@ -131,22 +132,23 @@ const CountyMap = props => {
131
132
  const {
132
133
  applyLegendToRow,
133
134
  applyTooltipsToGeo,
135
+ container,
134
136
  containerEl,
135
137
  data,
136
138
  displayGeoName,
137
139
  geoClickHandler,
138
140
  handleMapAriaLabels,
141
+ runtimeFilters,
139
142
  runtimeLegend,
143
+ setState,
140
144
  state,
141
- runtimeFilters,
142
145
  tooltipId,
143
146
  tooltipRef,
144
- container,
145
- setState
146
147
  } = useContext(ConfigContext)
147
148
 
148
149
  // CREATE STATE LINES
149
150
  const projection = geoAlbersUsaTerritories()
151
+ const geoStrokeColor = getGeoStrokeColor(state)
150
152
 
151
153
  const [focus, setFocus] = useState({})
152
154
  const [topoData, setTopoData] = useState({})
@@ -210,9 +212,7 @@ const CountyMap = props => {
210
212
  }
211
213
 
212
214
  const runtimeKeys = Object.keys(data)
213
-
214
- const geoStrokeColor = state.general.geoBorderColor === 'darkGray' ? 'rgb(90, 90, 90)' : 'rgb(255, 255, 255)'
215
- const lineWidth = 0.3
215
+ const lineWidth = 1
216
216
 
217
217
  const onReset = () => {
218
218
  setState({
@@ -449,7 +449,7 @@ const CountyMap = props => {
449
449
  }
450
450
 
451
451
  if (focus.index !== -1) {
452
- context.strokeStyle = 'black'
452
+ context.strokeStyle = geoStrokeColor
453
453
  context.lineWidth = 1
454
454
  context.beginPath()
455
455
  path(topoData.mapData[focus.index])
@@ -493,7 +493,6 @@ const CountyMap = props => {
493
493
 
494
494
  // Enforces stroke style of the county lines
495
495
  context.strokeStyle = geoStrokeColor
496
- context.lineWidth = lineWidth
497
496
 
498
497
  // Iterates through each state/county topo and renders it
499
498
  topoData.mapData.forEach((geo, i) => {
@@ -518,7 +517,7 @@ const CountyMap = props => {
518
517
 
519
518
  // If the focused state is found in the geo data, render it with a thicker outline
520
519
  if (focus.index !== -1) {
521
- context.strokeStyle = 'black'
520
+ context.strokeStyle = geoStrokeColor
522
521
  context.lineWidth = 2
523
522
  context.beginPath()
524
523
  path(topoData.mapData[focus.index])
@@ -531,8 +530,7 @@ const CountyMap = props => {
531
530
  context.beginPath()
532
531
  path(layer)
533
532
  context.fillStyle = layer.properties.fill
534
- context.globalAlpha = layer.properties['fill-opacity']
535
- context.strokeStyle = layer.properties['stroke']
533
+ context.strokeStyle = geoStrokeColor
536
534
  context.lineWidth = layer.properties['stroke-width']
537
535
  context.fill()
538
536
  context.stroke()
@@ -540,7 +538,7 @@ const CountyMap = props => {
540
538
  }
541
539
 
542
540
  if (state.general.type === 'us-geocode') {
543
- context.strokeStyle = 'black'
541
+ context.strokeStyle = geoStrokeColor
544
542
  const geoRadius = (state.visual.geoCodeCircleSize || 5) * (focus.id ? 2 : 1)
545
543
  const { additionalCityStyles } = state.visual || []
546
544
  const cityStyles = Object.values(data)
@@ -604,7 +602,7 @@ const CountyMap = props => {
604
602
  className='county-map-canvas'
605
603
  ></canvas>
606
604
 
607
- <button className={`btn btn-primary btn--reset`} onClick={onReset} ref={resetButton} tabIndex='0'>
605
+ <button className={`btn btn--reset btn-primary`} onClick={onReset} ref={resetButton} tabIndex='0'>
608
606
  Reset Zoom
609
607
  </button>
610
608
  </ErrorBoundary>
@@ -11,6 +11,7 @@ import ErrorBoundary from '@cdc/core/components/ErrorBoundary'
11
11
  import topoJSON from '../data/us-regions-topo-2.json'
12
12
  import ConfigContext from '../../../context'
13
13
  import Annotation from '../../Annotation'
14
+ import { getGeoFillColor, getGeoStrokeColor } from '../../../helpers/colors'
14
15
 
15
16
  const { features: unitedStates } = feature(topoJSON, topoJSON.objects.regions)
16
17
 
@@ -69,7 +70,8 @@ const UsaRegionMap = props => {
69
70
  setTerritoriesData(territoriesList)
70
71
  }, [data])
71
72
 
72
- const geoStrokeColor = state.general.geoBorderColor === 'darkGray' ? 'rgba(0, 0, 0, 0.2)' : 'rgba(255,255,255,0.7)'
73
+ const geoStrokeColor = getGeoStrokeColor(state)
74
+ const geoFillColor = getGeoFillColor(state)
73
75
 
74
76
  const territories = territoriesData.map(territory => {
75
77
  const Shape = Rect
@@ -79,7 +81,7 @@ const UsaRegionMap = props => {
79
81
  let toolTip
80
82
 
81
83
  let styles: React.CSSProperties = {
82
- fill: '#E6E6E6',
84
+ fill: geoFillColor,
83
85
  color: '#202020'
84
86
  }
85
87
 
@@ -97,7 +99,10 @@ const UsaRegionMap = props => {
97
99
  let needsPointer = false
98
100
 
99
101
  // If we need to add a pointer cursor
100
- if ((state.columns.navigate && territoryData[state.columns.navigate.name]) || state.tooltips.appearanceType === 'click') {
102
+ if (
103
+ (state.columns.navigate && territoryData[state.columns.navigate.name]) ||
104
+ state.tooltips.appearanceType === 'click'
105
+ ) {
101
106
  needsPointer = true
102
107
  }
103
108
 
@@ -113,7 +118,19 @@ const UsaRegionMap = props => {
113
118
  }
114
119
  }
115
120
 
116
- return <Shape key={label} label={label} css={styles} text={styles.color} stroke={geoStrokeColor} strokeWidth={1.5} onClick={() => geoClickHandler(territory, territoryData)} data-tooltip-id={`tooltip__${tooltipId}`} data-tooltip-html={toolTip} />
121
+ return (
122
+ <Shape
123
+ key={label}
124
+ label={label}
125
+ css={styles}
126
+ text={styles.color}
127
+ stroke={geoStrokeColor}
128
+ strokeWidth={1}
129
+ onClick={() => geoClickHandler(territory, territoryData)}
130
+ data-tooltip-id={`tooltip__${tooltipId}`}
131
+ data-tooltip-html={toolTip}
132
+ />
133
+ )
117
134
  }
118
135
  })
119
136
 
@@ -130,8 +147,22 @@ const UsaRegionMap = props => {
130
147
 
131
148
  return (
132
149
  <g>
133
- <line x1={centroid[0]} y1={centroid[1]} x2={centroid[0] + dx} y2={centroid[1] + dy} stroke='rgba(0,0,0,.5)' strokeWidth={1} />
134
- <text x={4} strokeWidth='0' fontSize={13} style={{ fill: '#202020' }} alignmentBaseline='middle' transform={`translate(${centroid[0] + dx}, ${centroid[1] + dy})`}>
150
+ <line
151
+ x1={centroid[0]}
152
+ y1={centroid[1]}
153
+ x2={centroid[0] + dx}
154
+ y2={centroid[1] + dy}
155
+ stroke='rgba(0,0,0,.5)'
156
+ strokeWidth={1}
157
+ />
158
+ <text
159
+ x={4}
160
+ strokeWidth='0'
161
+ fontSize={13}
162
+ style={{ fill: '#202020' }}
163
+ alignmentBaseline='middle'
164
+ transform={`translate(${centroid[0] + dx}, ${centroid[1] + dy})`}
165
+ >
135
166
  {abbr.substring(3)}
136
167
  </text>
137
168
  </g>
@@ -146,7 +177,7 @@ const UsaRegionMap = props => {
146
177
  const key = isHex ? geo.properties.iso + '-hex-group' : geo.properties.iso + '-group'
147
178
 
148
179
  let styles = {
149
- fill: '#E6E6E6',
180
+ fill: geoFillColor,
150
181
  cursor: 'default'
151
182
  }
152
183
 
@@ -172,28 +203,32 @@ const UsaRegionMap = props => {
172
203
  const toolTip = applyTooltipsToGeo(geoDisplayName, geoData)
173
204
 
174
205
  styles = {
175
- fill: state.general.type !== 'bubble' ? legendColors[0] : '#E6E6E6',
206
+ fill: state.general.type !== 'bubble' ? legendColors[0] : geoFillColor,
176
207
  cursor: 'default',
177
208
  '&:hover': {
178
- fill: state.general.type !== 'bubble' ? legendColors[1] : '#e6e6e6'
209
+ fill: state.general.type !== 'bubble' ? legendColors[1] : geoFillColor
179
210
  },
180
211
  '&:active': {
181
- fill: state.general.type !== 'bubble' ? legendColors[2] : '#e6e6e6'
212
+ fill: state.general.type !== 'bubble' ? legendColors[2] : geoFillColor
182
213
  }
183
214
  }
184
215
 
185
216
  // When to add pointer cursor
186
- if ((state.columns.navigate && geoData[state.columns.navigate.name]) || state.tooltips.appearanceType === 'click') {
217
+ if (
218
+ (state.columns.navigate && geoData[state.columns.navigate.name]) ||
219
+ state.tooltips.appearanceType === 'click'
220
+ ) {
187
221
  styles.cursor = 'pointer'
188
222
  }
189
223
 
190
224
  const TerratoryRect = props => {
191
225
  const { posX = 0, tName } = props
192
226
  const textColor = getContrastColor('#FFF', legendColors[0])
227
+ const geoStrokeColor = getGeoStrokeColor(state)
193
228
  return (
194
229
  <>
195
- <rect x={posX} width='36' height='24' rx='6' stroke='#fff' strokeWidth='1' />
196
- <text x={posX + 8} y='17' fill={textColor}>
230
+ <rect x={posX} width='36' height='24' rx='2' stroke={geoStrokeColor} strokeWidth='1' />
231
+ <text textAnchor='middle' x={36 / 2 + posX} y='17' fill={textColor}>
197
232
  {tName}
198
233
  </text>
199
234
  </>
@@ -203,8 +238,16 @@ const UsaRegionMap = props => {
203
238
  const circleRadius = 15
204
239
 
205
240
  return (
206
- <g key={key} className='geo-group' style={styles} onClick={() => geoClickHandler(geoDisplayName, geoData)} data-tooltip-id={`tooltip__${tooltipId}`} data-tooltip-html={toolTip} tabIndex={-1}>
207
- <path tabIndex={-1} className='single-geo' stroke={geoStrokeColor} strokeWidth={1.3} d={path} />
241
+ <g
242
+ key={key}
243
+ className='geo-group'
244
+ style={styles}
245
+ onClick={() => geoClickHandler(geoDisplayName, geoData)}
246
+ data-tooltip-id={`tooltip__${tooltipId}`}
247
+ data-tooltip-html={toolTip}
248
+ tabIndex={-1}
249
+ >
250
+ <path tabIndex={-1} className='single-geo' stroke={geoStrokeColor} strokeWidth={1} d={path} />
208
251
  <g id={`region-${index + 1}-label`}>
209
252
  <circle fill='#fff' stroke='#999' cx={circleRadius} cy={circleRadius} r={circleRadius} />
210
253
  <text fill='#333' x='15px' y='20px' textAnchor='middle'>
@@ -239,7 +282,7 @@ const UsaRegionMap = props => {
239
282
  // Default return state, just geo with no additional information
240
283
  return (
241
284
  <g key={key} className='geo-group' style={styles}>
242
- <path tabIndex={-1} className='single-geo' stroke={geoStrokeColor} strokeWidth={1.3} d={path} />
285
+ <path tabIndex={-1} className='single-geo' stroke={geoStrokeColor} strokeWidth={1} d={path} />
243
286
  {(isHex || showLabel) && geoLabel(geo, styles.fill, projection)}
244
287
  </g>
245
288
  )
@@ -14,6 +14,7 @@ import ZoomControls from '../../ZoomControls'
14
14
  import { MapContext } from '../../../types/MapContext'
15
15
  import useStateZoom from '../../../hooks/useStateZoom'
16
16
  import { Text } from '@visx/text'
17
+ import { getGeoStrokeColor } from '../../../helpers/colors'
17
18
 
18
19
  // SVG ITEMS
19
20
  const WIDTH = 880
@@ -49,7 +50,7 @@ const SingleStateMap = props => {
49
50
  const cityListProjection = geoAlbersUsaTerritories()
50
51
  .translate([WIDTH / 2, HEIGHT / 2])
51
52
  .scale(1)
52
- const geoStrokeColor = state.general.geoBorderColor === 'darkGray' ? 'rgba(0, 0, 0, 0.2)' : 'rgba(255,255,255,0.7)'
53
+ const geoStrokeColor = getGeoStrokeColor(state)
53
54
  const path = geoPath().projection(projection)
54
55
 
55
56
  useEffect(() => {