@cdc/map 4.26.4 → 4.26.5
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/CONFIG.md +70 -37
- package/LICENSE +201 -0
- package/README.md +6 -2
- package/dist/cdcmap.js +23502 -22964
- package/examples/default-county.json +3 -0
- package/examples/minimal-example.json +6 -2
- package/package.json +3 -3
- package/src/CdcMapComponent.tsx +13 -3
- package/src/_stories/CdcMap.AltText.stories.tsx +122 -0
- package/src/_stories/CdcMap.Editor.ColumnsSectionTests.stories.tsx +15 -16
- package/src/_stories/CdcMap.FocusVisibility.stories.tsx +87 -0
- package/src/_stories/CdcMap.HiddenMount.stories.tsx +69 -0
- package/src/_stories/CdcMap.ResetBehavior.stories.tsx +32 -0
- package/src/_stories/CdcMap.Zoom.stories.tsx +111 -0
- package/src/_stories/CdcMap.smoke.stories.tsx +48 -0
- package/src/_stories/_mock/alt_text_metadata.json +65 -0
- package/src/_stories/_mock/world-bubble-reset.json +138 -0
- package/src/_stories/_mock/world-data-zoom-filters.json +166 -0
- package/src/components/BubbleList.tsx +13 -0
- package/src/components/EditorPanel/components/EditorPanel.tsx +134 -0
- package/src/components/FilterControls.tsx +21 -0
- package/src/components/SmallMultiples/SmallMultiples.tsx +2 -2
- package/src/components/UsaMap/components/UsaMap.County.tsx +39 -9
- package/src/components/UsaMap/components/UsaMap.Region.tsx +5 -2
- package/src/components/UsaMap/components/UsaMap.SingleState.tsx +33 -10
- package/src/components/UsaMap/components/UsaMap.State.tsx +9 -2
- package/src/components/WorldMap/WorldMap.tsx +37 -4
- package/src/components/ZoomableGroup.tsx +23 -3
- package/src/components/filterControls.styles.css +6 -0
- package/src/data/initial-state.js +2 -0
- package/src/helpers/countyTerritories.ts +1 -1
- package/src/helpers/generateRuntimeFilters.ts +2 -1
- package/src/helpers/handleMapAriaLabels.ts +45 -30
- package/src/helpers/shouldAutoResetSingleStateZoom.ts +22 -0
- package/src/helpers/tests/handleMapAriaLabels.test.ts +71 -0
- package/src/helpers/tests/shouldAutoResetSingleStateZoom.test.ts +71 -0
- package/src/hooks/useGeoClickHandler.ts +13 -1
- package/src/hooks/useStateZoom.tsx +39 -20
- package/src/hooks/useTooltip.test.tsx +2 -16
- package/src/index.jsx +5 -2
- package/src/scss/main.scss +6 -21
- package/src/scss/map.scss +20 -0
- package/src/types/MapConfig.ts +5 -0
- package/src/types/MapContext.ts +3 -0
package/CONFIG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# `@cdc/map` Configuration Reference
|
|
2
2
|
|
|
3
|
-
This document covers the `@cdc/map`-owned config contract. Shared nested structures such as `filters`, `table`, `annotations`, `markupVariables`, `general.palette`,
|
|
3
|
+
This document covers the `@cdc/map`-owned config contract. Shared nested structures such as `filters`, `table`, `annotations`, `markupVariables`, `general.palette`, and the shared column/property shapes are documented in the [`@cdc/core` config reference](https://github.com/CDCgov/cdc-open-viz/blob/main/packages/core/CONFIG.md).
|
|
4
4
|
|
|
5
5
|
To follow those shared types locally, use `packages/core/CONFIG.md` in this monorepo or `node_modules/@cdc/core/CONFIG.md` in an installed app. If neither path is available, use the GitHub link above.
|
|
6
6
|
|
|
@@ -27,24 +27,25 @@ The copy-pasteable minimum config lives in [README.md](./README.md). Its source
|
|
|
27
27
|
| Field | Type | Required | Default | Description | Allowed values / Notes |
|
|
28
28
|
| --- | --- | --- | --- | --- | --- |
|
|
29
29
|
| `type` | `string` | Yes | None | Identifies the package. | Must be `map`. |
|
|
30
|
-
| `version` | `string` | No | None | Saved COVE version for migration purposes. | Use
|
|
31
|
-
| `
|
|
30
|
+
| `version` | `string` | No | None | Saved COVE version for migration purposes. | Use a semantic COVE version for authored configs so migrations can reason about saved-version order. |
|
|
31
|
+
| `locale` | `string` | No | Browser/runtime default | Locale used by markup-variable and shared formatting helpers. | Any valid `Intl` locale is accepted. |
|
|
32
32
|
|
|
33
|
-
The following data-loading fields are shared and documented in core: `data`, `dataUrl`, `
|
|
33
|
+
The following authorable data-loading fields are shared and documented in core: `data`, `dataUrl`, `dataDescription`, `dataMetadata`, and `dataKey` for dashboard-driven embeds. `dataMetadata` may be loader-populated, but consumers should preserve or author it when metadata-backed alt text, markup variables, or footnotes need it. Runtime/file metadata such as `runtimeDataUrl` may still appear in saved configs, but consumers usually do not author those fields directly.
|
|
34
34
|
|
|
35
35
|
## Geography and Columns
|
|
36
36
|
|
|
37
37
|
| Field | Type | Required | Default | Description | Allowed values / Notes |
|
|
38
38
|
| --- | --- | --- | --- | --- | --- |
|
|
39
|
-
| `general.geoType` | `string` | Yes | `single-state` | Chooses the geography family being rendered. | `us`, `us-region`, `us-county`, `world`, `us-geocode
|
|
39
|
+
| `general.geoType` | `string` | Yes | `single-state` | Chooses the geography family being rendered. | `us`, `us-region`, `us-county`, `world`, `single-state`, `google-map`. Geocode maps use `general.type: "us-geocode"` with `geoType: "us-county"` or `general.type: "world-geocode"` with `geoType: "world"`. Bubble maps use `general.type: "bubble"` with a supported geography such as `us` or `world`. |
|
|
40
40
|
| `general.type` | `string` | Yes | `data` | Chooses the interaction mode. | `data`, `navigation`, `us-geocode`, `world-geocode`, `bubble` |
|
|
41
41
|
| `columns.geo` | `object` | Yes | See package defaults | Geography lookup column. | Uses shared column properties from core; `displayColumn` is map-specific and is used when the displayed geography label differs from the lookup field. |
|
|
42
42
|
| `columns.primary` | `object` | Conditionally | See package defaults | Main data column used for classification and tooltips. | Uses shared column properties from core. Required for data maps and bubble maps. |
|
|
43
43
|
| `columns.navigate` | `object` | Conditionally | `{ name: '' }` | URL column used in navigation mode. | Required when `general.type` is `navigation`. |
|
|
44
|
-
| `columns.latitude` | `object` | Conditionally | `{ name: '' }` | Latitude column for geocode and
|
|
45
|
-
| `columns.longitude` | `object` | Conditionally | `{ name: '' }` | Longitude column for geocode and
|
|
44
|
+
| `columns.latitude` | `object` | Conditionally | `{ name: '' }` | Latitude column for coordinate-based geocode and Google maps. | Required for `us-geocode`, `world-geocode`, and `google-map`. US/world bubble maps can resolve positions from built-in geography coordinates. |
|
|
45
|
+
| `columns.longitude` | `object` | Conditionally | `{ name: '' }` | Longitude column for coordinate-based geocode and Google maps. | Required for `us-geocode`, `world-geocode`, and `google-map`. US/world bubble maps can resolve positions from built-in geography coordinates. |
|
|
46
46
|
| `columns.categorical` | `object` | No | `{ name: '' }` | Category column for bubble maps using categorical legends. | `name` only. |
|
|
47
47
|
| `columns.hsa` | `object` | No | `{ name: '' }` | Optional HSA column used by county maps when HSA boundaries are shown. | `name` only. |
|
|
48
|
+
| `columns.additionalColumnN` | `object` | No | None | Additional persisted column configs for tooltip and data-table output. | Editor-created keys such as `additionalColumn0` use shared column display fields. |
|
|
48
49
|
|
|
49
50
|
## Copy And Shell Controls
|
|
50
51
|
|
|
@@ -57,43 +58,62 @@ The following data-loading fields are shared and documented in core: `data`, `da
|
|
|
57
58
|
| `general.language` | `string` | No | `en` | Language code used by some map helpers and editor defaults. | Usually an ISO locale/language code. |
|
|
58
59
|
| `general.introText` | `string` | No | `''` | Intro copy shown in the shell. | Supports markup variables when enabled. |
|
|
59
60
|
| `general.subtext` | `string` | No | `''` | Supporting copy shown below the visualization. | Supports basic HTML plus markup variables when enabled. |
|
|
60
|
-
| `general.footnotes` | `string` | No | `''` |
|
|
61
|
+
| `general.footnotes` | `string` | No | `''` | Legacy/simple footnote copy. | Prefer top-level `footnotes` for structured static or data-driven footnotes. |
|
|
62
|
+
| `footnotes` | [`Footnotes`](https://github.com/CDCgov/cdc-open-viz/blob/main/packages/core/CONFIG.md#footnotes) | No | None | Structured static or data-driven footnotes rendered below the map. | Shared footnotes shape from `@cdc/core`. |
|
|
61
63
|
| `general.navigationTarget` | `string` | No | `_self` | Target used when the map opens navigation URLs. | `_self`, `_blank` |
|
|
62
|
-
| `general.showSidebar` | `boolean` | No | `true` | Shows the legend/sidebar region. | Set to `false` for navigation and bubble layouts. |
|
|
64
|
+
| `general.showSidebar` | `boolean \| "hidden"` | No | `true` | Shows the legend/sidebar region. | Author booleans for normal configs. Set to `false` for navigation and bubble layouts. Editor exports may contain `"hidden"`, but runtime treats that string as truthy, so it does not hide the legend. |
|
|
63
65
|
| `general.noDataMessage` | `string` | No | `No State Selected` | Message shown when a single-state map has no active selection. | Package-specific copy. |
|
|
64
66
|
| `general.annotationDropdownText` | `string` | No | `Annotations` | Label shown for the annotation dropdown. | Used when annotation dropdowns are enabled. |
|
|
65
|
-
| `general.showAnnotationDropdown` | `boolean` | No | `false` |
|
|
67
|
+
| `general.showAnnotationDropdown` | `boolean` | No | `false` | Changes desktop visibility classes for the annotation dropdown. | Annotation dropdown markup renders when annotations exist; this flag controls whether it is shown in desktop layouts. |
|
|
66
68
|
| `general.geoBorderColor` | `string` | No | `darkGray` | Border color used for geography outlines. | `darkGray`, `sameAsBackground`, and other editor-supported color tokens. |
|
|
67
69
|
| `general.geoLabelOverride` | `string` | No | `''` | Overrides the geography label used in tooltips and other copy. | Useful when the map should say "Country", "State/Territory", or similar. |
|
|
68
70
|
| `general.fullBorder` | `boolean` | No | `false` | Adds a full border around navigation maps. | Mainly relevant when `general.type` is `navigation`. |
|
|
69
|
-
| `general.headerColor` | `string` | No | `theme-blue` |
|
|
71
|
+
| `general.headerColor` | `string` | No | `theme-blue` | Map-owned header theme token. | Accepts shared [`ComponentThemes`](https://github.com/CDCgov/cdc-open-viz/blob/main/packages/core/CONFIG.md#componentthemes) values. |
|
|
70
72
|
| `general.displayStateLabels` | `boolean` | No | `true` | Shows state labels directly on the map. | `true`, `false` |
|
|
71
73
|
| `general.displayAsHex` | `boolean` | No | `false` | Switches the US map to a hex-style treatment. | Works with `hexMap`. |
|
|
72
74
|
| `general.equalNumberOptIn` | `boolean` | No | `false` | Enables the newer equal-number legend path. | Used when `legend.separateZero` and equal-number classification interact. |
|
|
73
75
|
| `general.allowMapZoom` | `boolean` | No | `true` | Enables zooming on supported map types. | Disabled in some editor flows and unsupported map modes. |
|
|
74
|
-
| `general.
|
|
76
|
+
| `general.showClearSelectionButton` | `boolean` | No | `true` | Shows a Clear Selection control for dashboard maps that set a shared filter. | Only meaningful when the map is used inside a dashboard as a `setBy` control and a selection is currently active. Current runtime support is implemented for the U.S. map. |
|
|
75
77
|
| `general.hideGeoColumnInTooltip` | `boolean` | No | `false` | Hides the geography field name in tooltips. | `true`, `false` |
|
|
76
78
|
| `general.hidePrimaryColumnInTooltip` | `boolean` | No | `false` | Hides the primary data field name in tooltips. | `true`, `false` |
|
|
77
|
-
| `general.showDownloadMediaButton` | `boolean` | No | `false` | Enables the media download button. | Often paired with the image/PDF toggles below. |
|
|
78
79
|
| `general.showDownloadImgButton` | `boolean` | No | `false` | Enables PNG/image download. | Editor-managed field. |
|
|
79
80
|
| `general.includeContextInDownload` | `boolean` | No | `false` | Includes heading and explanatory context in image downloads. | Only meaningful when image downloads are enabled. |
|
|
80
81
|
| `general.showDownloadPdfButton` | `boolean` | No | `false` | Enables PDF download. | Editor-managed field. |
|
|
81
82
|
| `general.showHSABoundaries` | `boolean` | No | `false` | Shows HSA boundaries on supported county maps. | Mainly relevant for health-system maps. |
|
|
82
83
|
| `general.showNeighboringStates` | `boolean` | No | `false` | Includes neighboring states in the county map outline. | Only relevant for county maps. |
|
|
83
84
|
| `general.showStateDropdown` | `boolean` | No | `false` | Shows a state picker in county views. | Only relevant for county maps. |
|
|
85
|
+
| `general.countyCensusYear`, `general.filterControlsCountyYear` | `string` | No | Package defaults | County census-year controls used by county map helpers and editor flows. | Only meaningful for county maps. |
|
|
86
|
+
| `general.filterControlsStatesPicked` | `string` | No | `''` | Source column used to derive selected states from filtered data. | Related to `general.statesPicked`; consumed by single-state/county helper logic. |
|
|
84
87
|
| `general.hideUnselectedStates` | `boolean` | No | `true` when states are picked | Controls whether selected-state maps hide or keep unselected states visible. | Only meaningful when `statesPicked` is populated on single-state maps. |
|
|
85
88
|
| `general.statesPicked` | `object[]` | No | `[]` | Selected states for single-state maps. | Each item has `fipsCode` and `stateName`. |
|
|
86
|
-
| `general.countriesPicked` | `object[]` | No | `[]` | Selected countries for world maps. | Each item has `iso` and `name`. |
|
|
89
|
+
| `general.countriesPicked` | `object[]` | No | `[]` | Selected countries for world maps. | Each item has `iso` and `name`. Use supported ISO 3166-1 alpha-3 codes for `iso`; two-letter codes can fail selection and centering. |
|
|
87
90
|
| `general.hideUnselectedCountries` | `boolean` | No | `false` | Controls whether unselected countries are hidden or grayed out. | Only meaningful when `countriesPicked` is populated. |
|
|
88
|
-
| `general.territoriesAlwaysShow` | `boolean` | No | `
|
|
89
|
-
| `general.territoriesLabel` | `string` | No |
|
|
91
|
+
| `general.territoriesAlwaysShow` | `boolean` | No | `false` in package initial state | Controls how U.S. territories are rendered on U.S. maps. | `true`, `false`. On county maps, `false` hides all territory counties, except migrated legacy configs with `migrations.showPuertoRico` can still render Puerto Rico for compatibility; `true` renders only territory counties with matching runtime data. On state maps, `false` renders only territories with matching runtime data; `true` renders all supported territories whether data exists or not. Normal loaded configs are seeded or migrated before rendering; lower-level geography helpers still treat an undefined value as enabled for legacy compatibility. |
|
|
92
|
+
| `general.territoriesLabel` | `string` | No | None | Label shown for the territories group in U.S. region maps. | Mainly relevant for `us-region`; legacy and example configs commonly use `Territories`. |
|
|
90
93
|
| `general.hasRegions` | `boolean` | No | `false` | Marks the map as region-aware for some data-loading and editor flows. | Mainly used by US regional map flows. |
|
|
91
94
|
|
|
92
95
|
The canonical palette configuration is shared in core. This package still accepts the legacy `color` field for older saved configs, but new configs should author `general.palette` instead.
|
|
93
96
|
|
|
94
97
|
## Classification And Palette
|
|
95
98
|
|
|
96
|
-
Legend configuration is shared with core. The map package honors the shared legend contract plus these map-specific behaviors:
|
|
99
|
+
Legend configuration is shared with core. The map package honors the shared legend contract plus these map-specific fields and behaviors:
|
|
100
|
+
|
|
101
|
+
| Field | Type | Required | Default | Description | Allowed values / Notes |
|
|
102
|
+
| --- | --- | --- | --- | --- | --- |
|
|
103
|
+
| `legend.type` | `string` | No | `equalnumber` | Chooses the classification strategy. | `equalnumber`, `equalinterval`, `category` |
|
|
104
|
+
| `legend.numberOfItems` | `number` | No | `5` | Number of legend classes for numeric legends. | Editor usually limits this to small integer values. |
|
|
105
|
+
| `legend.position` | `string` | No | `top` | Legend placement. | `top`, `bottom`, `left`, `right`, `side`, depending on layout. |
|
|
106
|
+
| `legend.style` | `string` | No | `gradient` | Legend marker or gradient style. | `circles`, `boxes`, `gradient` |
|
|
107
|
+
| `legend.subStyle` | `string` | No | `linear blocks` | Gradient legend treatment. | `linear blocks`, `smooth` |
|
|
108
|
+
| `legend.title`, `legend.description` | `string` | No | `''` | Legend heading and description. | Supports markup-variable processing in supported map flows. |
|
|
109
|
+
| `legend.descriptions` | `Record<string, string \| string[]>` | No | `{}` | Dynamic legend-description lookup used when `legend.dynamicDescription` is `true`. | Keys use the filter index and selected filter-value index, such as `0,0`. Editor-saved values may be strings or one-item string arrays. |
|
|
110
|
+
| `legend.specialClasses` | `{ key; label; value }[]` | No | `[]` | Extra legend classes for special cases. | Used for no-data or other override classes. |
|
|
111
|
+
| `legend.unified` | `boolean` | No | `false` | Uses unified legend behavior for compatible map modes. | `true`, `false` |
|
|
112
|
+
| `legend.singleColumn`, `legend.singleRow`, `legend.verticalSorted` | `boolean` | No | `false` | Layout and sorting controls for legend items. | Runtime may still adapt for available space. |
|
|
113
|
+
| `legend.showSpecialClassesLast` | `boolean` | No | `false` | Moves special classes to the end of the legend. | `true`, `false` |
|
|
114
|
+
| `legend.dynamicDescription` | `boolean` | No | `false` | Enables dynamic legend description behavior. | `true`, `false` |
|
|
115
|
+
|
|
116
|
+
When `legend` is omitted entirely, the package initial state supplies the defaults above. When a config provides a partial `legend` object, missing `numberOfItems`, `position`, `style`, and `hideBorder` can be backfilled from legacy defaults: `3`, `side`, `circles`, and `false`.
|
|
97
117
|
|
|
98
118
|
| Behavior | Details |
|
|
99
119
|
| --- | --- |
|
|
@@ -108,13 +128,16 @@ Legend configuration is shared with core. The map package honors the shared lege
|
|
|
108
128
|
|
|
109
129
|
## Filtering And Tables
|
|
110
130
|
|
|
111
|
-
Shared filter and table structures are documented in core. Map-specific behavior includes:
|
|
131
|
+
Shared filter and table structures are documented in [`@cdc/core`](https://github.com/CDCgov/cdc-open-viz/blob/main/packages/core/CONFIG.md#filters) and [`@cdc/core` table docs](https://github.com/CDCgov/cdc-open-viz/blob/main/packages/core/CONFIG.md#table). Map-specific behavior includes:
|
|
112
132
|
|
|
113
133
|
| Behavior | Details |
|
|
114
134
|
| --- | --- |
|
|
115
135
|
| `filterBehavior` | Controls whether the map updates immediately or waits for an explicit filter change in supporting editor flows. |
|
|
116
136
|
| `filterIntro` | Intro copy shown near the filter UI. |
|
|
117
137
|
| `table.forceDisplay` | Keeps the data table visible even when the current mode would normally hide it. |
|
|
138
|
+
| `table.showNonGeoData` | Includes non-geographic rows in map-related table output. |
|
|
139
|
+
| `table.showFullGeoNameInCSV` | Adds full geography names to CSV downloads when the formatter can resolve them. |
|
|
140
|
+
| `table.wrapColumns` | Allows map table cell content to wrap instead of staying on one line. |
|
|
118
141
|
|
|
119
142
|
## Map Features
|
|
120
143
|
|
|
@@ -124,14 +147,14 @@ Custom overlay or base layers added by the editor.
|
|
|
124
147
|
|
|
125
148
|
| Field | Type | Required | Default | Description | Allowed values / Notes |
|
|
126
149
|
| --- | --- | --- | --- | --- | --- |
|
|
127
|
-
| `name` | `string` |
|
|
128
|
-
| `url` | `string` | Yes | None | Layer source URL. |
|
|
129
|
-
| `namespace` | `string` |
|
|
130
|
-
| `fill` | `string` | No | `
|
|
131
|
-
| `fillOpacity` | `number` | No | `
|
|
132
|
-
| `stroke` | `string` | No | `
|
|
133
|
-
| `strokeWidth` | `number` | No | `
|
|
134
|
-
| `tooltip` | `
|
|
150
|
+
| `name` | `string` | No | None | Display name for the layer. | Editor-label metadata used in the accordion label; runtime rendering depends on `url` and `namespace`, not `name`. |
|
|
151
|
+
| `url` | `string` | Yes | None | Layer source URL. | Current runtime expects TopoJSON. Raw GeoJSON is not handled by this layer reader. |
|
|
152
|
+
| `namespace` | `string` | Yes | None | TopoJSON `objects` key used to select the layer geometry. | Required for rendering and also used when building layer ids. |
|
|
153
|
+
| `fill` | `string` | No | TopoJSON feature fill, then `transparent` | Fill color for the layer. | CSS color string. |
|
|
154
|
+
| `fillOpacity` | `number \| string` | No | TopoJSON `fill-opacity`, then `1` | Fill opacity for the layer. | Saved configs may contain either a number or numeric string. |
|
|
155
|
+
| `stroke` | `string` | No | TopoJSON feature stroke, then `transparent` | Stroke color for the layer. | CSS color string. |
|
|
156
|
+
| `strokeWidth` | `number \| string` | No | TopoJSON `stroke-width` when present | Stroke width for the layer. | Saved configs may contain either a number or numeric string. |
|
|
157
|
+
| `tooltip` | `string` | No | `''` | Tooltip text or HTML for the layer. | Empty string disables layer-specific tooltip content. |
|
|
135
158
|
|
|
136
159
|
### `map.patterns`
|
|
137
160
|
|
|
@@ -145,7 +168,6 @@ Pattern overlays applied to matching geography rows.
|
|
|
145
168
|
| `label` | `string` | No | `''` | Optional legend label for the pattern. | Displayed in the legend when present. |
|
|
146
169
|
| `size` | `string` | No | `medium` | Pattern density / size. | `small`, `medium`, `large` |
|
|
147
170
|
| `color` | `string` | No | `''` | Pattern color. | CSS color string. |
|
|
148
|
-
| `contrastCheck` | `boolean` | No | `true` | Result of the editor contrast check. | Usually managed by the editor. |
|
|
149
171
|
|
|
150
172
|
### `hexMap`
|
|
151
173
|
|
|
@@ -160,17 +182,16 @@ Pattern overlays applied to matching geography rows.
|
|
|
160
182
|
| --- | --- | --- | --- | --- | --- |
|
|
161
183
|
| `legendTitle` | `string` | No | `''` | Title for the shape group in the legend. | Optional. |
|
|
162
184
|
| `legendDescription` | `string` | No | `''` | Description for the shape group. | Optional. |
|
|
163
|
-
| `items` | `object[]` | No | `[]` | Shape rules that determine which arrow or icon is shown. | Each item
|
|
185
|
+
| `items` | `object[]` | No | `[]` | Shape rules that determine which arrow or icon is shown. | Each item matches by `key`, `operator`, and `value`. |
|
|
164
186
|
|
|
165
187
|
`hexMap.shapeGroups[].items[]`
|
|
166
188
|
|
|
167
189
|
| Field | Type | Required | Default | Description | Allowed values / Notes |
|
|
168
190
|
| --- | --- | --- | --- | --- | --- |
|
|
169
|
-
| `key` | `string` | No | `''` | Internal key for the hex-map rule. | Usually left blank in hand-authored configs. |
|
|
170
191
|
| `shape` | `string` | No | `Arrow Up` | Shape rendered for the rule. | Editor values include arrow directions. |
|
|
171
|
-
| `
|
|
192
|
+
| `key` | `string` | No | `''` | Source column/key to inspect. | Current editor and runtime use this field for hex-shape matching. |
|
|
172
193
|
| `operator` | `string` | No | `=` | Comparison operator. | `=`, `≠`, `<`, `>`, `<=`, `>=` |
|
|
173
|
-
| `value` | `string` | No | `''` | Comparison value. | Compared against the configured
|
|
194
|
+
| `value` | `string` | No | `''` | Comparison value. | Compared against the configured key. |
|
|
174
195
|
|
|
175
196
|
### `smallMultiples`
|
|
176
197
|
|
|
@@ -189,10 +210,16 @@ Only supported for `us`, `single-state`, and `us-region` map types.
|
|
|
189
210
|
|
|
190
211
|
### `annotations` and `markupVariables`
|
|
191
212
|
|
|
192
|
-
These structures are shared with core. In map configs,
|
|
213
|
+
These structures are shared with core. In map configs, annotation dropdown markup renders when annotations exist; `general.showAnnotationDropdown` controls the desktop visibility treatment. Markup variables are applied to title, intro, subtext, legend, and other supported text fields when `enableMarkupVariables` is true.
|
|
193
214
|
|
|
194
215
|
## Layout And Interactivity
|
|
195
216
|
|
|
217
|
+
### Accessibility
|
|
218
|
+
|
|
219
|
+
Map configs can include [`altText`](https://github.com/CDCgov/cdc-open-viz/blob/main/packages/core/CONFIG.md#alttextconfig), the shared `AltTextConfig` object from core. The map runtime first builds a map-specific SVG `aria-label` from the rendered geography and data context, then appends the resolved static or metadata-driven `altText` description when one is available.
|
|
220
|
+
|
|
221
|
+
Shared shell styling flags on `visual` follow core [`ComponentStyles`](https://github.com/CDCgov/cdc-open-viz/blob/main/packages/core/CONFIG.md#componentstyles). Map-specific `visual` fields are listed here because they affect marker, bubble, and geocode rendering.
|
|
222
|
+
|
|
196
223
|
| Field | Type | Required | Default | Description | Allowed values / Notes |
|
|
197
224
|
| --- | --- | --- | --- | --- | --- |
|
|
198
225
|
| `mapPosition.coordinates` | `[number, number]` | No | `[0, 30]` | Initial map center. | The runtime may reset this when the geography changes. |
|
|
@@ -214,7 +241,7 @@ These structures are shared with core. In map configs, the important package-spe
|
|
|
214
241
|
| `visual.additionalCityStyles` | `object[]` | No | `[]` | Extra city-style rules added in the editor. | Each rule uses `label`, `column`, `value`, and `shape`. |
|
|
215
242
|
| `tooltips.appearanceType` | `string` | No | `hover` | Chooses hover or click-based detail displays. | `hover`, `click` |
|
|
216
243
|
| `tooltips.linkLabel` | `string` | No | `Learn More` | Tooltip link label. | Used when `appearanceType` is `click`. |
|
|
217
|
-
| `tooltips.noDataLabel` | `string` | No | `
|
|
244
|
+
| `tooltips.noDataLabel` | `string` | No | `No Data` render fallback | Text shown for missing data in the tooltip. | Omitted or empty values render as `No Data`. |
|
|
218
245
|
| `tooltips.opacity` | `number` | No | `90` | Tooltip opacity. | 0-100 in editor flows. |
|
|
219
246
|
|
|
220
247
|
## Fields You Can Ignore
|
|
@@ -224,12 +251,18 @@ These fields may appear in saved configs, editor exports, or runtime state, but
|
|
|
224
251
|
| Field or group | Why you can ignore it |
|
|
225
252
|
| --- | --- |
|
|
226
253
|
| `runtime.*` | Internal runtime state created by the package during initialization. |
|
|
227
|
-
| `defaultData`, `formattedData`, `datasets`, `runtimeDataUrl
|
|
254
|
+
| `defaultData`, `formattedData`, `datasets`, `runtimeDataUrl` | Loader/runtime artifacts rather than hand-authored standalone config. |
|
|
255
|
+
| `color` | Legacy top-level palette token. Author `general.palette` for current configs. |
|
|
228
256
|
| `sharing.*` | Loader/export metadata that belongs to editor or embed flows. |
|
|
257
|
+
| `migrations.*` | Migration bookkeeping that records which update steps have run. Preserve `migrations.showPuertoRico` when encountered in migrated county maps; runtime still reads it as legacy compatibility metadata. Only set `migrations.showPuertoRico: false` when explicitly opting a county map out of the legacy Puerto Rico rendering shim. |
|
|
258
|
+
| `dataTable` | Top-level legacy/export artifact; table behavior is configured through `table`. |
|
|
229
259
|
| `usingWidgetLoader` | Internal loader flag. |
|
|
230
260
|
| `newViz` | Editor-only preview/confirmation flag. |
|
|
231
|
-
| `
|
|
232
|
-
| `general.
|
|
261
|
+
| `general.filterControlsStatePicked` | Legacy singular editor-control artifact; use `general.statesPicked` for authored selected-state config. |
|
|
262
|
+
| `general.convertFipsCodes` | Legacy/editor-authored FIPS conversion flag. Current runtime normalizes FIPS-like values during U.S. and county map load regardless of this value. |
|
|
263
|
+
| `general.showDownloadMediaButton` | Legacy editor control; current rendering uses `general.showDownloadImgButton` and `general.showDownloadPdfButton` directly. |
|
|
233
264
|
| `general.territoriesAlwayShow` | Misspelled legacy artifact from an older migration bug. The runtime repairs this to `general.territoriesAlwaysShow`; do not author it manually. |
|
|
265
|
+
| `map.patterns[].contrastCheck` | Editor validation state for pattern contrast; changing it does not affect rendered pattern matching or styling. |
|
|
266
|
+
| `hexMap.shapeGroups[].items[].column` | Legacy/stale hex-shape field; author `hexMap.shapeGroups[].items[].key` for current runtime matching. |
|
|
234
267
|
| `statePicked` | Legacy saved-config artifact from older editor flows. |
|
|
235
|
-
| `showDownloadButton`, `expandDataTable` | Legacy editor state from older configs. |
|
|
268
|
+
| `general.showDownloadButton`, `general.expandDataTable` | Legacy editor state from older configs. Current table behavior uses `table.download` and `table.expanded`. |
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -20,12 +20,16 @@ import CdcMap from '@cdc/map'
|
|
|
20
20
|
|
|
21
21
|
const config = {
|
|
22
22
|
version: '4.26.4',
|
|
23
|
-
color: 'pinkpurple',
|
|
24
23
|
general: {
|
|
25
24
|
title: 'Minimal US Map',
|
|
26
25
|
geoType: 'us',
|
|
27
26
|
type: 'data',
|
|
28
|
-
showTitle: true
|
|
27
|
+
showTitle: true,
|
|
28
|
+
palette: {
|
|
29
|
+
name: 'sequential_blue',
|
|
30
|
+
version: '2.0',
|
|
31
|
+
isReversed: false
|
|
32
|
+
}
|
|
29
33
|
},
|
|
30
34
|
type: 'map',
|
|
31
35
|
columns: {
|