@cdc/map 4.24.12 → 4.25.2-25

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 (64) hide show
  1. package/dist/cdcmap.js +50119 -48822
  2. package/examples/annotation/index.json +1 -1
  3. package/examples/custom-map-layers.json +1 -1
  4. package/examples/default-geocode.json +2 -2
  5. package/examples/example-city-state.json +1 -1
  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/mmr.json +246 -0
  13. package/examples/private/test.json +1632 -0
  14. package/index.html +12 -14
  15. package/package.json +8 -3
  16. package/src/CdcMap.tsx +126 -396
  17. package/src/_stories/CdcMap.Filters.stories.tsx +19 -0
  18. package/src/_stories/CdcMap.Legend.Gradient.stories.tsx +9 -0
  19. package/src/_stories/CdcMap.stories.tsx +1 -1
  20. package/src/_stories/GoogleMap.stories.tsx +19 -0
  21. package/src/_stories/_mock/DEV-10148.json +859 -0
  22. package/src/_stories/_mock/DEV-9989.json +229 -0
  23. package/src/_stories/_mock/example-city-state.json +1 -1
  24. package/src/_stories/_mock/google-map.json +819 -0
  25. package/src/_stories/_mock/wastewater-map.json +210 -206
  26. package/src/components/Annotation/Annotation.Draggable.tsx +34 -43
  27. package/src/components/Annotation/AnnotationDropdown.tsx +4 -4
  28. package/src/components/CityList.tsx +3 -9
  29. package/src/components/DataTable.tsx +8 -9
  30. package/src/components/EditorPanel/components/EditorPanel.tsx +255 -490
  31. package/src/components/GoogleMap/components/GoogleMap.tsx +67 -0
  32. package/src/components/GoogleMap/index.tsx +3 -0
  33. package/src/components/Legend/components/Legend.tsx +40 -30
  34. package/src/components/Legend/components/LegendItem.Hex.tsx +7 -3
  35. package/src/components/Legend/components/index.scss +22 -16
  36. package/src/components/Modal.tsx +6 -5
  37. package/src/components/NavigationMenu.tsx +4 -3
  38. package/src/components/UsaMap/components/TerritoriesSection.tsx +66 -0
  39. package/src/components/UsaMap/components/Territory/Territory.Hexagon.tsx +15 -16
  40. package/src/components/UsaMap/components/Territory/Territory.Rectangle.tsx +3 -3
  41. package/src/components/UsaMap/components/UsaMap.County.tsx +1 -1
  42. package/src/components/UsaMap/components/UsaMap.Region.tsx +12 -8
  43. package/src/components/UsaMap/components/UsaMap.SingleState.tsx +2 -2
  44. package/src/components/UsaMap/components/UsaMap.State.tsx +23 -29
  45. package/src/components/WorldMap/WorldMap.tsx +3 -5
  46. package/src/context.ts +0 -12
  47. package/src/data/initial-state.js +2 -2
  48. package/src/data/supported-geos.js +23 -3
  49. package/src/helpers/applyColorToLegend.ts +3 -3
  50. package/src/helpers/closeModal.ts +9 -0
  51. package/src/helpers/handleMapAriaLabels.ts +38 -0
  52. package/src/helpers/indexOfIgnoreType.ts +8 -0
  53. package/src/helpers/navigationHandler.ts +21 -0
  54. package/src/helpers/toTitleCase.ts +44 -0
  55. package/src/helpers/validateFipsCodeLength.ts +30 -0
  56. package/src/hooks/useResizeObserver.ts +42 -0
  57. package/src/hooks/useTooltip.ts +4 -2
  58. package/src/index.jsx +1 -0
  59. package/src/scss/editor-panel.scss +2 -1
  60. package/src/scss/filters.scss +0 -5
  61. package/src/scss/main.scss +57 -61
  62. package/src/scss/map.scss +1 -13
  63. package/src/types/MapConfig.ts +20 -11
  64. package/src/types/MapContext.ts +4 -12
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useState, memo } from 'react'
1
+ import React, { useEffect, useState, memo, useContext } from 'react'
2
2
 
3
3
  import Papa from 'papaparse'
4
4
  import ExternalIcon from '../images/external-link.svg' // TODO: Move to Icon component
@@ -10,6 +10,8 @@ import MediaControls from '@cdc/core/components/MediaControls'
10
10
  import SkipTo from '@cdc/core/components/elements/SkipTo'
11
11
 
12
12
  import Loading from '@cdc/core/components/Loading'
13
+ import { navigationHandler } from '../helpers/navigationHandler'
14
+ import ConfigContext from '../context'
13
15
 
14
16
  /* eslint-disable jsx-a11y/no-noninteractive-tabindex, jsx-a11y/no-static-element-interactions */
15
17
  const DataTable = props => {
@@ -26,18 +28,15 @@ const DataTable = props => {
26
28
  displayDataAsText,
27
29
  applyLegendToRow,
28
30
  displayGeoName,
29
- navigationHandler,
30
- viewport,
31
31
  formatLegendLocation,
32
32
  tabbingId,
33
33
  setFilteredCountryCode
34
34
  } = props
35
35
 
36
+ const { currentViewport: viewport } = useContext(ConfigContext)
36
37
  const [expanded, setExpanded] = useState(expandDataTable)
37
38
  const [sortBy, setSortBy] = useState({ column: 'geo', asc: false })
38
-
39
39
  const [accessibilityLabel, setAccessibilityLabel] = useState('')
40
-
41
40
  const fileName = `${mapTitle || 'data-table'}.csv`
42
41
 
43
42
  // Catch all sorting method used on load by default but also on user click
@@ -118,14 +117,14 @@ const DataTable = props => {
118
117
  if (columns.navigate && row[columns.navigate.name]) {
119
118
  markup = (
120
119
  <span
121
- onClick={() => navigationHandler(row[columns.navigate.name])}
120
+ onClick={() => navigationHandler(state.general.navigationTarget, row[columns.navigate.name])}
122
121
  className='table-link'
123
122
  title='Click for more information (Opens in a new window)'
124
123
  role='link'
125
124
  tabIndex='0'
126
125
  onKeyDown={e => {
127
126
  if (e.keyCode === 13) {
128
- navigationHandler(row[columns.navigate.name])
127
+ navigationHandler(state.general.navigationTarget, row[columns.navigate.name])
129
128
  }
130
129
  }}
131
130
  >
@@ -192,7 +191,7 @@ const DataTable = props => {
192
191
 
193
192
  const TableMediaControls = ({ belowTable }) => {
194
193
  return (
195
- <MediaControls.Section classes={['download-links'] + (belowTable ? 'below-table' : '')}>
194
+ <MediaControls.Section classes={['download-links']}>
196
195
  <MediaControls.Link config={state} />
197
196
  {state.general.showDownloadButton && <DownloadButton />}
198
197
  </MediaControls.Section>
@@ -345,7 +344,7 @@ const DataTable = props => {
345
344
  </>
346
345
  )
347
346
  } else {
348
- cellValue = displayDataAsText(runtimeData[row][state.columns[column].name], column)
347
+ cellValue = displayDataAsText(runtimeData[row][state.columns[column].name], column, state)
349
348
  }
350
349
 
351
350
  return (