@cdc/map 4.25.8 → 4.25.11
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/.claude/agents/typescript-organizer.md +118 -0
- package/.claude/settings.local.json +30 -0
- package/dist/{cdcmap-fce76882.es.js → cdcmap-BnB1QM5d.es.js} +6 -13
- package/dist/{cdcmap-c55ac1ea.es.js → cdcmap-D6CG2-Hb.es.js} +5 -12
- package/dist/{cdcmap-31a33da1.es.js → cdcmap-MXgURbdZ.es.js} +6 -13
- package/dist/{cdcmap-1a1724a1.es.js → cdcmap-dgT_1dIT.es.js} +136 -151
- package/dist/cdcmap.js +56991 -53706
- package/examples/example-city-state.json +9 -1
- package/examples/multi-country-centering.json +45 -0
- package/examples/private/c.json +290 -0
- package/examples/private/canvas-city-hover.json +787 -0
- package/examples/private/colors-2.json +221 -0
- package/examples/private/colors.json +221 -0
- package/examples/private/d.json +345 -0
- package/examples/private/g.json +1 -0
- package/examples/private/h.json +105911 -0
- package/examples/private/measles-data.json +378 -0
- package/examples/private/measles.json +211 -0
- package/examples/private/north-dakota.json +1132 -0
- package/examples/private/state-with-pattern.json +883 -0
- package/index.html +36 -34
- package/package.json +26 -5
- package/src/CdcMap.tsx +23 -8
- package/src/CdcMapComponent.tsx +238 -308
- package/src/_stories/CdcMap.ColumnWrap.stories.tsx +31 -0
- package/src/_stories/CdcMap.DistrictOfColumbia.stories.tsx +320 -0
- package/src/_stories/CdcMap.Editor.stories.tsx +3371 -0
- package/src/_stories/CdcMap.Filters.stories.tsx +2 -2
- package/src/_stories/CdcMap.Legend.Gradient.stories.tsx +3 -3
- package/src/_stories/CdcMap.Legend.stories.tsx +7 -4
- package/src/_stories/CdcMap.Patterns.stories.tsx +2 -2
- package/src/_stories/CdcMap.SmallMultiples.stories.tsx +35 -0
- package/src/_stories/CdcMap.Table.stories.tsx +2 -2
- package/src/_stories/CdcMap.stories.tsx +37 -9
- package/src/_stories/GoogleMap.stories.tsx +2 -2
- package/src/_stories/UsaMap.NoData.stories.tsx +2 -2
- package/src/_stories/_mock/column-wrap-test.json +265 -0
- package/src/_stories/_mock/equal-number.json +1109 -0
- package/src/_stories/_mock/multi-country-hide.json +78 -0
- package/src/_stories/_mock/multi-country.json +95 -0
- package/src/_stories/_mock/multi-state.json +887 -20403
- package/src/_stories/_mock/small_multiples/multi-state-small-multiples.json +8399 -0
- package/src/_stories/_mock/small_multiples/region-small-multiples.json +657 -0
- package/src/_stories/_mock/small_multiples/wastewater-map-small-multiples.json +221 -0
- package/src/_stories/_mock/us-bubble-cities.json +306 -0
- package/src/_stories/_mock/usa-state-gradient.json +2 -4
- package/src/components/BubbleList.tsx +17 -13
- package/src/components/CityList.tsx +85 -107
- package/src/components/EditorPanel/components/EditorPanel.tsx +787 -709
- package/src/components/EditorPanel/components/HexShapeSettings.tsx +58 -95
- package/src/components/EditorPanel/components/Panels/Panel.PatternSettings.tsx +34 -42
- package/src/components/EditorPanel/components/Panels/Panel.SmallMultiples.tsx +354 -0
- package/src/components/EditorPanel/components/Panels/index.tsx +3 -1
- package/src/components/Geo.tsx +22 -3
- package/src/components/Legend/components/Legend.tsx +76 -40
- package/src/components/Legend/components/LegendGroup/Legend.Group.tsx +10 -7
- package/src/components/Legend/components/index.scss +1 -1
- package/src/components/MapContainer.tsx +52 -0
- package/src/components/MapControls.tsx +44 -0
- package/src/components/NavigationMenu.tsx +27 -15
- package/src/components/SmallMultiples/SmallMultipleTile.tsx +163 -0
- package/src/components/SmallMultiples/SmallMultiples.css +32 -0
- package/src/components/SmallMultiples/SmallMultiples.tsx +150 -0
- package/src/components/SmallMultiples/SynchronizedTooltip.tsx +105 -0
- package/src/components/SmallMultiples/index.tsx +3 -0
- package/src/components/UsaMap/components/SingleState/SingleState.CountyOutput.tsx +36 -4
- package/src/components/UsaMap/components/TerritoriesSection.tsx +26 -12
- package/src/components/UsaMap/components/Territory/Territory.Hexagon.tsx +30 -4
- package/src/components/UsaMap/components/Territory/Territory.Rectangle.tsx +23 -4
- package/src/components/UsaMap/components/Territory/TerritoryShape.ts +6 -0
- package/src/components/UsaMap/components/UsaMap.County.tsx +123 -37
- package/src/components/UsaMap/components/UsaMap.Region.tsx +36 -5
- package/src/components/UsaMap/components/UsaMap.SingleState.tsx +30 -10
- package/src/components/UsaMap/components/UsaMap.State.tsx +53 -12
- package/src/components/UsaMap/helpers/map.ts +4 -4
- package/src/components/UsaMap/helpers/shapes.ts +9 -6
- package/src/components/WorldMap/WorldMap.tsx +193 -35
- package/src/components/ZoomControls.tsx +6 -9
- package/src/context/LegendMemoContext.tsx +30 -0
- package/src/context.ts +1 -40
- package/src/data/initial-state.js +153 -130
- package/src/data/supported-geos.js +25 -78
- package/src/helpers/addUIDs.ts +13 -2
- package/src/helpers/applyColorToLegend.ts +140 -20
- package/src/helpers/applyLegendToRow.ts +10 -6
- package/src/helpers/componentHelpers.ts +8 -0
- package/src/helpers/constants.ts +12 -14
- package/src/helpers/dataTableHelpers.ts +6 -0
- package/src/helpers/displayGeoName.ts +18 -3
- package/src/helpers/generateRuntimeLegend.ts +44 -10
- package/src/helpers/generateRuntimeLegendHash.ts +4 -2
- package/src/helpers/getColumnNames.ts +1 -1
- package/src/helpers/getCountriesPicked.ts +103 -0
- package/src/helpers/getMapContainerClasses.ts +7 -0
- package/src/helpers/getPatternForRow.ts +33 -0
- package/src/helpers/getStatesPicked.ts +8 -5
- package/src/helpers/index.ts +3 -3
- package/src/helpers/isLegendItemDisabled.ts +16 -0
- package/src/helpers/mapObserverHelpers.ts +40 -0
- package/src/helpers/resetLegendToggles.ts +3 -2
- package/src/helpers/smallMultiplesHelpers.ts +359 -0
- package/src/helpers/tests/titleCase.test.ts +76 -0
- package/src/helpers/titleCase.ts +13 -13
- package/src/helpers/toggleLegendActive.ts +6 -11
- package/src/helpers/urlDataHelpers.ts +70 -0
- package/src/hooks/useCountryZoom.tsx +241 -0
- package/src/hooks/useGeoClickHandler.ts +36 -2
- package/src/hooks/useLegendMemo.ts +17 -0
- package/src/hooks/useMapLayers.tsx +5 -4
- package/src/hooks/useProgrammaticMapTooltip.ts +110 -0
- package/src/hooks/useResizeObserver.ts +5 -2
- package/src/hooks/useStateZoom.tsx +30 -8
- package/src/hooks/useSynchronizedGeographies.ts +56 -0
- package/src/hooks/useTooltip.ts +1 -2
- package/src/index.jsx +1 -2
- package/src/scss/editor-panel.scss +4 -440
- package/src/scss/main.scss +1 -1
- package/src/scss/map.scss +12 -15
- package/src/store/map.actions.ts +7 -7
- package/src/store/map.reducer.ts +17 -6
- package/src/test/CdcMap.test.jsx +11 -0
- package/src/types/MapConfig.ts +46 -18
- package/src/types/MapContext.ts +6 -7
- package/src/types/runtimeLegend.ts +17 -1
- package/vite.config.js +2 -7
- package/vitest.config.ts +16 -0
- package/src/components/DataTable.tsx +0 -385
- package/src/components/EditorPanel/components/Inputs.tsx +0 -59
- package/src/coreStyles_map.scss +0 -3
- package/src/helpers/colorDistributions.ts +0 -12
- package/src/helpers/generateColorsArray.ts +0 -14
- package/src/helpers/tests/generateColorsArray.test.ts +0 -18
- package/src/helpers/tests/generateRuntimeLegendHash.test.ts +0 -11
- package/src/hooks/useActiveElement.ts +0 -19
- package/src/scss/mixins.scss +0 -47
- package/src/types/Annotations.ts +0 -24
- /package/dist/{cdcmap-548642e6.es.js → cdcmap-Ct2SB0vL.es.js} +0 -0
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export const colorDistributions = {
|
|
2
|
-
1: [1],
|
|
3
|
-
2: [1, 3],
|
|
4
|
-
3: [1, 3, 5],
|
|
5
|
-
4: [0, 2, 4, 6],
|
|
6
|
-
5: [0, 2, 4, 6, 7],
|
|
7
|
-
6: [0, 2, 3, 4, 5, 7],
|
|
8
|
-
7: [0, 2, 3, 4, 5, 6, 7],
|
|
9
|
-
8: [0, 2, 3, 4, 5, 6, 7, 8],
|
|
10
|
-
9: [0, 1, 2, 3, 4, 5, 6, 7, 8],
|
|
11
|
-
10: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
12
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import chroma from 'chroma-js'
|
|
2
|
-
import { DEFAULT_MAP_BACKGROUND } from './constants'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Generate an array of colors based on a given color [color, hoverColor, darkColor]
|
|
6
|
-
* @param {string} color - The base color to generate the array from
|
|
7
|
-
* @param {boolean} special - A flag to determine if the hover color should be brighter or saturated
|
|
8
|
-
* @returns {string[]} - An array of colors
|
|
9
|
-
*/
|
|
10
|
-
export const generateColorsArray = (color: string = DEFAULT_MAP_BACKGROUND, special: boolean = false) => {
|
|
11
|
-
let colorObj = chroma(color)
|
|
12
|
-
let hoverColor = special ? colorObj.brighten(0.5).hex() : colorObj.saturate(1.3).hex()
|
|
13
|
-
return [color, hoverColor, colorObj.darken(0.3).hex()]
|
|
14
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { generateColorsArray } from '../generateColorsArray'
|
|
2
|
-
|
|
3
|
-
describe('generateColorsArray', () => {
|
|
4
|
-
it('should return an array of colors', () => {
|
|
5
|
-
const colors = generateColorsArray('#fde0dd', false)
|
|
6
|
-
expect(colors).toEqual(expect.arrayContaining(['#fde0dd', '#ffd0c9', '#edd1ce']))
|
|
7
|
-
})
|
|
8
|
-
|
|
9
|
-
it('should return a brighter hover color when special flag is true', () => {
|
|
10
|
-
const colors = generateColorsArray('#fde0dd', true)
|
|
11
|
-
expect(colors[1]).toEqual('#fffaf7')
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
it('should return a darker color for the third element in the array', () => {
|
|
15
|
-
const colors = generateColorsArray('#fde0dd', false)
|
|
16
|
-
expect(colors[2]).toBe('#edd1ce')
|
|
17
|
-
})
|
|
18
|
-
})
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { generateRuntimeLegendHash } from '../generateRuntimeLegendHash'
|
|
2
|
-
import usaExample from './../../../examples/default-usa.json'
|
|
3
|
-
|
|
4
|
-
describe('generateRuntimeLegendHash', () => {
|
|
5
|
-
it('should return a hash value for a given state and runtime filters', () => {
|
|
6
|
-
const runtimeFilters = []
|
|
7
|
-
const expectedHash = 1253406922
|
|
8
|
-
const result = generateRuntimeLegendHash(usaExample, runtimeFilters)
|
|
9
|
-
expect(result).toBe(expectedHash)
|
|
10
|
-
})
|
|
11
|
-
})
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect } from 'react'
|
|
2
|
-
// Use for accessibility testing
|
|
3
|
-
const useActiveElement = () => {
|
|
4
|
-
const [active, setActive] = useState(document.activeElement)
|
|
5
|
-
|
|
6
|
-
const handleFocusIn = e => {
|
|
7
|
-
setActive(document.activeElement)
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
useEffect(() => {
|
|
11
|
-
document.addEventListener('focusin', handleFocusIn)
|
|
12
|
-
return () => {
|
|
13
|
-
document.removeEventListener('focusin', handleFocusIn)
|
|
14
|
-
}
|
|
15
|
-
}, [])
|
|
16
|
-
|
|
17
|
-
return active
|
|
18
|
-
}
|
|
19
|
-
export default useActiveElement
|
package/src/scss/mixins.scss
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
@mixin breakpoint($class) {
|
|
2
|
-
@if $class == xs {
|
|
3
|
-
@media (max-width: 767px) {
|
|
4
|
-
@content;
|
|
5
|
-
}
|
|
6
|
-
} @else if $class == sm {
|
|
7
|
-
@media (min-width: 768px) {
|
|
8
|
-
@content;
|
|
9
|
-
}
|
|
10
|
-
} @else if $class == md {
|
|
11
|
-
@media (min-width: 960px) {
|
|
12
|
-
@content;
|
|
13
|
-
}
|
|
14
|
-
} @else if $class == lg {
|
|
15
|
-
@media (min-width: 1300px) {
|
|
16
|
-
@content;
|
|
17
|
-
}
|
|
18
|
-
} @else {
|
|
19
|
-
@warn "Breakpoint mixin supports: xs, sm, md, lg";
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
@mixin breakpointClass($class) {
|
|
24
|
-
@if $class == xs {
|
|
25
|
-
&.xs,
|
|
26
|
-
&.xxs {
|
|
27
|
-
@content;
|
|
28
|
-
}
|
|
29
|
-
} @else if $class == sm {
|
|
30
|
-
&.sm,
|
|
31
|
-
&.md,
|
|
32
|
-
&.lg {
|
|
33
|
-
@content;
|
|
34
|
-
}
|
|
35
|
-
} @else if $class == md {
|
|
36
|
-
&.md,
|
|
37
|
-
&.lg {
|
|
38
|
-
@content;
|
|
39
|
-
}
|
|
40
|
-
} @else if $class == lg {
|
|
41
|
-
&.lg {
|
|
42
|
-
@content;
|
|
43
|
-
}
|
|
44
|
-
} @else {
|
|
45
|
-
@warn "Breakpoint Class mixin supports: xs, sm, md, lg";
|
|
46
|
-
}
|
|
47
|
-
}
|
package/src/types/Annotations.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
type Annotation = {
|
|
2
|
-
/** The x-coordinate of the annotation */
|
|
3
|
-
x: number
|
|
4
|
-
/** The y-coordinate of the annotation */
|
|
5
|
-
y: number
|
|
6
|
-
/** The x-offset for the annotation's text */
|
|
7
|
-
dx: number
|
|
8
|
-
/** The y-offset for the annotation's text */
|
|
9
|
-
dy: number
|
|
10
|
-
/** The opacity level of the annotation */
|
|
11
|
-
opacity: number
|
|
12
|
-
/** The text content of the annotation */
|
|
13
|
-
text: string
|
|
14
|
-
/** The type of connection for the annotation */
|
|
15
|
-
connectionType: string
|
|
16
|
-
edit: {
|
|
17
|
-
/** Indicates if the label can be edited */
|
|
18
|
-
label: boolean
|
|
19
|
-
/** Indicates if the subject can be edited */
|
|
20
|
-
subject: boolean
|
|
21
|
-
}
|
|
22
|
-
/** The type of marker used for the annotation */
|
|
23
|
-
marker: 'arrow' | 'circle'
|
|
24
|
-
}
|
|
File without changes
|