@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.
- package/dist/cdcmap.js +21645 -21544
- package/examples/default-county.json +1 -1
- package/examples/default-geocode.json +744 -744
- package/examples/default-hex.json +3 -5
- package/examples/example-city-state-no-territories.json +703 -0
- package/examples/example-city-state.json +4 -7
- package/examples/example-city-stateBAD.json +744 -0
- package/examples/gallery/city-state.json +478 -478
- package/examples/world-geocode-data.json +18 -0
- package/examples/world-geocode.json +108 -0
- package/index.html +34 -29
- package/package.json +6 -3
- package/src/CdcMap.jsx +127 -64
- package/src/components/CityList.jsx +35 -35
- package/src/components/CountyMap.jsx +285 -447
- package/src/components/DataTable.jsx +7 -31
- package/src/components/EditorPanel.jsx +227 -102
- package/src/components/Sidebar.jsx +2 -0
- package/src/components/UsaMap.jsx +24 -19
- package/src/components/WorldMap.jsx +40 -8
- package/src/data/feature-test.json +73 -0
- package/src/data/initial-state.js +3 -0
- package/src/data/supported-geos.js +7 -7
- package/src/scss/map.scss +12 -0
- package/src/test/CdcMap.test.jsx +19 -0
- package/vite.config.js +3 -3
- package/src/hooks/useColorPalette.ts +0 -88
|
@@ -10,39 +10,14 @@ import CoveMediaControls from '@cdc/core/components/CoveMediaControls'
|
|
|
10
10
|
|
|
11
11
|
import Loading from '@cdc/core/components/Loading'
|
|
12
12
|
|
|
13
|
+
/* eslint-disable jsx-a11y/no-noninteractive-tabindex, jsx-a11y/no-static-element-interactions */
|
|
13
14
|
const DataTable = props => {
|
|
14
|
-
const {
|
|
15
|
-
state,
|
|
16
|
-
tableTitle,
|
|
17
|
-
indexTitle,
|
|
18
|
-
mapTitle,
|
|
19
|
-
rawData,
|
|
20
|
-
showDownloadImgButton,
|
|
21
|
-
showDownloadPdfButton,
|
|
22
|
-
showDownloadButton,
|
|
23
|
-
runtimeData,
|
|
24
|
-
runtimeLegend,
|
|
25
|
-
headerColor,
|
|
26
|
-
expandDataTable,
|
|
27
|
-
columns,
|
|
28
|
-
displayDataAsText,
|
|
29
|
-
applyLegendToRow,
|
|
30
|
-
displayGeoName,
|
|
31
|
-
navigationHandler,
|
|
32
|
-
viewport,
|
|
33
|
-
formatLegendLocation,
|
|
34
|
-
tabbingId,
|
|
35
|
-
setFilteredCountryCode,
|
|
36
|
-
innerContainerRef,
|
|
37
|
-
imageRef
|
|
38
|
-
} = props
|
|
15
|
+
const { state, tableTitle, indexTitle, mapTitle, rawData, runtimeData, headerColor, expandDataTable, columns, displayDataAsText, applyLegendToRow, displayGeoName, navigationHandler, viewport, formatLegendLocation, tabbingId, setFilteredCountryCode } = props
|
|
39
16
|
|
|
40
17
|
const [expanded, setExpanded] = useState(expandDataTable)
|
|
41
18
|
|
|
42
19
|
const [accessibilityLabel, setAccessibilityLabel] = useState('')
|
|
43
20
|
|
|
44
|
-
const [ready, setReady] = useState(false)
|
|
45
|
-
|
|
46
21
|
const fileName = `${mapTitle || 'data-table'}.csv`
|
|
47
22
|
|
|
48
23
|
// Catch all sorting method used on load by default but also on user click
|
|
@@ -202,10 +177,11 @@ const DataTable = props => {
|
|
|
202
177
|
|
|
203
178
|
const legendColor = applyLegendToRow(rowObj)
|
|
204
179
|
|
|
180
|
+
var labelValue
|
|
205
181
|
if (state.general.geoType !== 'us-county' || state.general.type === 'us-geocode') {
|
|
206
|
-
|
|
182
|
+
labelValue = displayGeoName(row.original)
|
|
207
183
|
} else {
|
|
208
|
-
|
|
184
|
+
labelValue = formatLegendLocation(row.original)
|
|
209
185
|
}
|
|
210
186
|
|
|
211
187
|
labelValue = getCellAnchor(labelValue, rowObj)
|
|
@@ -232,7 +208,7 @@ const DataTable = props => {
|
|
|
232
208
|
})
|
|
233
209
|
|
|
234
210
|
return newTableColumns
|
|
235
|
-
}, [indexTitle, columns, runtimeData, getCellAnchor, displayDataAsText, applyLegendToRow, customSort, displayGeoName, state.legend.specialClasses])
|
|
211
|
+
}, [indexTitle, columns, runtimeData, getCellAnchor, displayDataAsText, applyLegendToRow, customSort, displayGeoName, state.legend.specialClasses]) // eslint-disable-line
|
|
236
212
|
|
|
237
213
|
const tableData = useMemo(
|
|
238
214
|
() =>
|
|
@@ -301,7 +277,7 @@ const DataTable = props => {
|
|
|
301
277
|
}
|
|
302
278
|
}}
|
|
303
279
|
>
|
|
304
|
-
<Icon display={expanded ? 'minus' : 'plus'} base/>
|
|
280
|
+
<Icon display={expanded ? 'minus' : 'plus'} base />
|
|
305
281
|
{tableTitle}
|
|
306
282
|
</div>
|
|
307
283
|
<div className='table-container' style={{ maxHeight: state.dataTable.limitHeight && `${state.dataTable.height}px`, overflowY: 'scroll' }}>
|