@cdc/map 4.25.10 → 4.26.1
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/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 +58397 -55987
- package/examples/example-city-state.json +9 -1
- package/examples/multi-country-centering.json +45 -0
- package/examples/private/city_styles_variable.json +877 -0
- package/examples/private/colors-2.json +221 -0
- package/examples/private/colors.json +221 -0
- package/examples/private/map-filter-issue.json +2260 -0
- package/examples/private/map-legend.json +5303 -0
- package/index.html +27 -36
- package/package.json +6 -5
- package/src/CdcMapComponent.tsx +86 -26
- 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 +3426 -0
- package/src/_stories/CdcMap.SmallMultiples.stories.tsx +35 -0
- package/src/_stories/CdcMap.stories.tsx +116 -4
- package/src/_stories/_mock/column-wrap-test.json +265 -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/usa-state-gradient.json +3 -4
- package/src/components/BubbleList.tsx +1 -1
- package/src/components/CityList.tsx +24 -18
- package/src/components/EditorPanel/components/EditorPanel.tsx +2380 -2206
- package/src/components/EditorPanel/components/HexShapeSettings.tsx +55 -93
- package/src/components/EditorPanel/components/Panels/Panel.Annotate.tsx +0 -19
- package/src/components/EditorPanel/components/Panels/Panel.PatternSettings.tsx +27 -37
- package/src/components/EditorPanel/components/Panels/Panel.SmallMultiples.tsx +351 -0
- package/src/components/EditorPanel/components/Panels/index.tsx +3 -1
- package/src/components/Geo.tsx +20 -3
- package/src/components/Legend/components/Legend.tsx +58 -75
- package/src/components/Legend/components/LegendGroup/Legend.Group.tsx +1 -1
- package/src/components/Legend/components/index.scss +23 -6
- package/src/components/NavigationMenu.tsx +16 -13
- 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 +18 -3
- 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 +29 -9
- package/src/components/UsaMap/components/Territory/TerritoryShape.ts +7 -0
- package/src/components/UsaMap/components/UsaMap.County.tsx +16 -4
- package/src/components/UsaMap/components/UsaMap.Region.tsx +14 -1
- package/src/components/UsaMap/components/UsaMap.SingleState.tsx +29 -12
- package/src/components/UsaMap/components/UsaMap.State.tsx +30 -5
- package/src/components/UsaMap/helpers/map.ts +2 -2
- package/src/components/UsaMap/helpers/shapes.ts +9 -6
- package/src/components/WorldMap/WorldMap.tsx +81 -11
- package/src/data/initial-state.js +11 -0
- package/src/data/supported-geos.js +8 -76
- package/src/helpers/addUIDs.ts +13 -2
- package/src/helpers/applyColorToLegend.ts +25 -1
- package/src/helpers/applyLegendToRow.ts +5 -3
- package/src/helpers/constants.ts +3 -15
- package/src/helpers/displayGeoName.ts +22 -4
- package/src/helpers/generateRuntimeFilters.ts +1 -1
- package/src/helpers/generateRuntimeLegend.ts +1 -3
- package/src/helpers/generateRuntimeLegendHash.ts +1 -1
- package/src/helpers/getCountriesPicked.ts +103 -0
- package/src/helpers/getMapContainerClasses.ts +7 -0
- package/src/helpers/getPatternForRow.ts +2 -5
- package/src/helpers/index.ts +2 -4
- package/src/helpers/isLegendItemDisabled.ts +2 -2
- package/src/helpers/resetLegendToggles.ts +1 -0
- package/src/helpers/smallMultiplesHelpers.ts +359 -0
- package/src/helpers/tests/hashObj.test.ts +1 -1
- package/src/helpers/tests/titleCase.test.ts +76 -0
- package/src/helpers/titleCase.ts +13 -13
- package/src/helpers/toggleLegendActive.ts +76 -8
- package/src/helpers/urlDataHelpers.ts +1 -1
- package/src/hooks/useCountryZoom.tsx +241 -0
- package/src/hooks/useGeoClickHandler.ts +1 -1
- package/src/hooks/useProgrammaticMapTooltip.ts +110 -0
- package/src/hooks/useResizeObserver.ts +8 -2
- package/src/hooks/useStateZoom.tsx +7 -4
- package/src/hooks/useSynchronizedGeographies.ts +56 -0
- package/src/index.jsx +1 -0
- 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/test/CdcMap.test.jsx +1 -1
- package/src/types/MapConfig.ts +32 -11
- package/src/types/MapContext.ts +6 -0
- package/src/types/runtimeLegend.ts +2 -1
- package/LICENSE +0 -201
- package/src/components/DataTable.tsx +0 -413
- package/src/components/EditorPanel/components/Inputs.tsx +0 -59
- package/src/components/MapControls.tsx +0 -44
- package/src/helpers/getUniqueValues.ts +0 -19
- package/src/helpers/hashObj.ts +0 -25
- package/src/hooks/useActiveElement.ts +0 -19
- package/src/hooks/useLegendSeparators.ts +0 -26
- 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
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
2
|
+
import CdcMap from '../CdcMap'
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof CdcMap> = {
|
|
5
|
+
title: 'Components/Templates/Map/Geographic Name Formatting',
|
|
6
|
+
component: CdcMap
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default meta
|
|
10
|
+
|
|
11
|
+
type Story = StoryObj<typeof CdcMap>
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Tests that "District of Columbia" is displayed correctly with lowercase "of"
|
|
15
|
+
* regardless of input casing (DISTRICT OF COLUMBIA, District Of Columbia, etc.)
|
|
16
|
+
*/
|
|
17
|
+
export const DistrictOfColumbia: Story = {
|
|
18
|
+
args: {
|
|
19
|
+
config: {
|
|
20
|
+
type: 'map',
|
|
21
|
+
general: {
|
|
22
|
+
type: 'data',
|
|
23
|
+
geoType: 'us',
|
|
24
|
+
displayAsHex: false,
|
|
25
|
+
displayGeoName: true,
|
|
26
|
+
title: 'District of Columbia - Title Case Test',
|
|
27
|
+
showTitle: true,
|
|
28
|
+
showSidebar: true
|
|
29
|
+
},
|
|
30
|
+
columns: {
|
|
31
|
+
geo: {
|
|
32
|
+
name: 'State',
|
|
33
|
+
label: 'State'
|
|
34
|
+
},
|
|
35
|
+
primary: {
|
|
36
|
+
name: 'Value',
|
|
37
|
+
label: 'Population (thousands)',
|
|
38
|
+
tooltip: true,
|
|
39
|
+
dataTable: true
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
legend: {
|
|
43
|
+
type: 'equalnumber',
|
|
44
|
+
numberOfItems: 5,
|
|
45
|
+
position: 'side'
|
|
46
|
+
},
|
|
47
|
+
tooltips: {
|
|
48
|
+
appearanceType: 'hover',
|
|
49
|
+
capitalizeLabels: true
|
|
50
|
+
},
|
|
51
|
+
data: [
|
|
52
|
+
{ State: 'DISTRICT OF COLUMBIA', Value: 689 },
|
|
53
|
+
{ State: 'Virginia', Value: 8631 },
|
|
54
|
+
{ State: 'Maryland', Value: 6177 },
|
|
55
|
+
{ State: 'Delaware', Value: 1003 },
|
|
56
|
+
{ State: 'West Virginia', Value: 1775 }
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Tests US Territories with special formatting:
|
|
64
|
+
* - "Federated States of Micronesia" (lowercase "of")
|
|
65
|
+
* - "Commonwealth of the Northern Mariana Islands" (lowercase "of" and "the")
|
|
66
|
+
* - "U.S. Virgin Islands" (special case with periods in U.S.)
|
|
67
|
+
*/
|
|
68
|
+
export const USTerritories: Story = {
|
|
69
|
+
args: {
|
|
70
|
+
config: {
|
|
71
|
+
type: 'map',
|
|
72
|
+
general: {
|
|
73
|
+
type: 'data',
|
|
74
|
+
geoType: 'us',
|
|
75
|
+
displayAsHex: false,
|
|
76
|
+
displayGeoName: true,
|
|
77
|
+
title: 'US Territories - Special Name Formatting',
|
|
78
|
+
showTitle: true,
|
|
79
|
+
showSidebar: true
|
|
80
|
+
},
|
|
81
|
+
columns: {
|
|
82
|
+
geo: {
|
|
83
|
+
name: 'Territory',
|
|
84
|
+
label: 'Territory'
|
|
85
|
+
},
|
|
86
|
+
primary: {
|
|
87
|
+
name: 'Value',
|
|
88
|
+
label: 'Population (thousands)',
|
|
89
|
+
tooltip: true,
|
|
90
|
+
dataTable: true
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
legend: {
|
|
94
|
+
type: 'equalnumber',
|
|
95
|
+
numberOfItems: 7,
|
|
96
|
+
position: 'side'
|
|
97
|
+
},
|
|
98
|
+
tooltips: {
|
|
99
|
+
appearanceType: 'hover',
|
|
100
|
+
capitalizeLabels: true
|
|
101
|
+
},
|
|
102
|
+
data: [
|
|
103
|
+
{ Territory: 'FEDERATED STATES OF MICRONESIA', Value: 113 },
|
|
104
|
+
{ Territory: 'COMMONWEALTH OF THE NORTHERN MARIANA ISLANDS', Value: 57 },
|
|
105
|
+
{ Territory: 'U.S. VIRGIN ISLANDS', Value: 106 },
|
|
106
|
+
{ Territory: 'AMERICAN SAMOA', Value: 49 },
|
|
107
|
+
{ Territory: 'GUAM', Value: 168 },
|
|
108
|
+
{ Territory: 'PUERTO RICO', Value: 3194 },
|
|
109
|
+
{ Territory: 'PALAU', Value: 18 }
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Tests various input casings for "District of Columbia" to ensure
|
|
117
|
+
* all variations produce the correct output with lowercase "of"
|
|
118
|
+
*/
|
|
119
|
+
export const DistrictOfColumbiaVariations: Story = {
|
|
120
|
+
args: {
|
|
121
|
+
config: {
|
|
122
|
+
type: 'map',
|
|
123
|
+
general: {
|
|
124
|
+
type: 'data',
|
|
125
|
+
geoType: 'us',
|
|
126
|
+
displayAsHex: false,
|
|
127
|
+
displayGeoName: true,
|
|
128
|
+
title: 'District of Columbia - All Input Variations',
|
|
129
|
+
showTitle: true,
|
|
130
|
+
showSidebar: true
|
|
131
|
+
},
|
|
132
|
+
columns: {
|
|
133
|
+
geo: {
|
|
134
|
+
name: 'State',
|
|
135
|
+
label: 'State'
|
|
136
|
+
},
|
|
137
|
+
primary: {
|
|
138
|
+
name: 'Value',
|
|
139
|
+
label: 'Test Value',
|
|
140
|
+
tooltip: true,
|
|
141
|
+
dataTable: true
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
legend: {
|
|
145
|
+
type: 'equalnumber',
|
|
146
|
+
numberOfItems: 6,
|
|
147
|
+
position: 'side'
|
|
148
|
+
},
|
|
149
|
+
tooltips: {
|
|
150
|
+
appearanceType: 'hover',
|
|
151
|
+
capitalizeLabels: true
|
|
152
|
+
},
|
|
153
|
+
data: [
|
|
154
|
+
{ State: 'DISTRICT OF COLUMBIA', Value: 100 },
|
|
155
|
+
{ State: 'District Of Columbia', Value: 101 },
|
|
156
|
+
{ State: 'district of columbia', Value: 102 },
|
|
157
|
+
{ State: 'District of Columbia', Value: 103 },
|
|
158
|
+
{ State: 'DC', Value: 104 },
|
|
159
|
+
{ State: 'WASHINGTON DC', Value: 105 }
|
|
160
|
+
]
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Tests world countries with special name formatting using ALL CAPS input:
|
|
167
|
+
* - "Republic of the Congo" (lowercase "of" and "the")
|
|
168
|
+
* - "Democratic Republic of the Congo" (lowercase "of" and "the")
|
|
169
|
+
* - "Bolivia (Plurinational State of)" (lowercase "of")
|
|
170
|
+
* - "Iran (Islamic Republic of)" (lowercase "of")
|
|
171
|
+
* - Countries with "and" in their names (lowercase "and")
|
|
172
|
+
*/
|
|
173
|
+
export const WorldCountriesAllCaps: Story = {
|
|
174
|
+
args: {
|
|
175
|
+
config: {
|
|
176
|
+
type: 'map',
|
|
177
|
+
general: {
|
|
178
|
+
type: 'data',
|
|
179
|
+
geoType: 'world',
|
|
180
|
+
displayAsHex: false,
|
|
181
|
+
title: 'World Countries - ALL CAPS Input Test',
|
|
182
|
+
showTitle: true,
|
|
183
|
+
showSidebar: true
|
|
184
|
+
},
|
|
185
|
+
columns: {
|
|
186
|
+
geo: {
|
|
187
|
+
name: 'Country',
|
|
188
|
+
label: 'Country'
|
|
189
|
+
},
|
|
190
|
+
primary: {
|
|
191
|
+
name: 'Value',
|
|
192
|
+
label: 'Test Value',
|
|
193
|
+
tooltip: true,
|
|
194
|
+
dataTable: true
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
legend: {
|
|
198
|
+
type: 'equalnumber',
|
|
199
|
+
numberOfItems: 10,
|
|
200
|
+
position: 'side'
|
|
201
|
+
},
|
|
202
|
+
tooltips: {
|
|
203
|
+
appearanceType: 'hover',
|
|
204
|
+
capitalizeLabels: true
|
|
205
|
+
},
|
|
206
|
+
data: [
|
|
207
|
+
{ Country: 'REPUBLIC OF THE CONGO', Value: 100 },
|
|
208
|
+
{ Country: 'DEMOCRATIC REPUBLIC OF THE CONGO', Value: 101 },
|
|
209
|
+
{ Country: 'BOLIVIA (PLURINATIONAL STATE OF)', Value: 102 },
|
|
210
|
+
{ Country: 'IRAN (ISLAMIC REPUBLIC OF)', Value: 103 },
|
|
211
|
+
{ Country: 'ANTIGUA AND BARBUDA', Value: 104 },
|
|
212
|
+
{ Country: 'BOSNIA AND HERZEGOVINA', Value: 105 },
|
|
213
|
+
{ Country: 'TRINIDAD AND TOBAGO', Value: 106 },
|
|
214
|
+
{ Country: 'SAINT KITTS AND NEVIS', Value: 107 },
|
|
215
|
+
{ Country: 'SAO TOME AND PRINCIPE', Value: 108 },
|
|
216
|
+
{ Country: 'HEARD ISLAND AND MCDONALD ISLANDS', Value: 109 }
|
|
217
|
+
]
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Tests hyphenated geographic names to ensure proper title casing
|
|
224
|
+
* for both parts of the hyphenated name
|
|
225
|
+
*/
|
|
226
|
+
export const HyphenatedNames: Story = {
|
|
227
|
+
args: {
|
|
228
|
+
config: {
|
|
229
|
+
type: 'map',
|
|
230
|
+
general: {
|
|
231
|
+
type: 'data',
|
|
232
|
+
geoType: 'us',
|
|
233
|
+
displayAsHex: false,
|
|
234
|
+
displayGeoName: true,
|
|
235
|
+
title: 'Hyphenated Geographic Names',
|
|
236
|
+
showTitle: true,
|
|
237
|
+
showSidebar: true
|
|
238
|
+
},
|
|
239
|
+
columns: {
|
|
240
|
+
geo: {
|
|
241
|
+
name: 'County',
|
|
242
|
+
label: 'County'
|
|
243
|
+
},
|
|
244
|
+
primary: {
|
|
245
|
+
name: 'Value',
|
|
246
|
+
label: 'Test Value',
|
|
247
|
+
tooltip: true,
|
|
248
|
+
dataTable: true
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
legend: {
|
|
252
|
+
type: 'equalnumber',
|
|
253
|
+
numberOfItems: 5,
|
|
254
|
+
position: 'side'
|
|
255
|
+
},
|
|
256
|
+
tooltips: {
|
|
257
|
+
appearanceType: 'hover',
|
|
258
|
+
capitalizeLabels: true
|
|
259
|
+
},
|
|
260
|
+
data: [
|
|
261
|
+
{ County: 'ANNE ARUNDEL-BALTIMORE', Value: 100 },
|
|
262
|
+
{ County: 'WINSTON-SALEM', Value: 101 },
|
|
263
|
+
{ County: 'SAINT-PIERRE', Value: 102 }
|
|
264
|
+
]
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Tests multi-word state names to ensure proper capitalization
|
|
271
|
+
*/
|
|
272
|
+
export const MultiWordStateNames: Story = {
|
|
273
|
+
args: {
|
|
274
|
+
config: {
|
|
275
|
+
type: 'map',
|
|
276
|
+
general: {
|
|
277
|
+
type: 'data',
|
|
278
|
+
geoType: 'us',
|
|
279
|
+
displayAsHex: false,
|
|
280
|
+
displayGeoName: true,
|
|
281
|
+
title: 'Multi-Word State Names',
|
|
282
|
+
showTitle: true,
|
|
283
|
+
showSidebar: true
|
|
284
|
+
},
|
|
285
|
+
columns: {
|
|
286
|
+
geo: {
|
|
287
|
+
name: 'State',
|
|
288
|
+
label: 'State'
|
|
289
|
+
},
|
|
290
|
+
primary: {
|
|
291
|
+
name: 'Value',
|
|
292
|
+
label: 'Test Value',
|
|
293
|
+
tooltip: true,
|
|
294
|
+
dataTable: true
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
legend: {
|
|
298
|
+
type: 'equalnumber',
|
|
299
|
+
numberOfItems: 8,
|
|
300
|
+
position: 'side'
|
|
301
|
+
},
|
|
302
|
+
tooltips: {
|
|
303
|
+
appearanceType: 'hover',
|
|
304
|
+
capitalizeLabels: true
|
|
305
|
+
},
|
|
306
|
+
data: [
|
|
307
|
+
{ State: 'NEW HAMPSHIRE', Value: 100 },
|
|
308
|
+
{ State: 'NEW JERSEY', Value: 101 },
|
|
309
|
+
{ State: 'NEW MEXICO', Value: 102 },
|
|
310
|
+
{ State: 'NEW YORK', Value: 103 },
|
|
311
|
+
{ State: 'NORTH CAROLINA', Value: 104 },
|
|
312
|
+
{ State: 'NORTH DAKOTA', Value: 105 },
|
|
313
|
+
{ State: 'SOUTH CAROLINA', Value: 106 },
|
|
314
|
+
{ State: 'SOUTH DAKOTA', Value: 107 },
|
|
315
|
+
{ State: 'WEST VIRGINIA', Value: 108 },
|
|
316
|
+
{ State: 'RHODE ISLAND', Value: 109 }
|
|
317
|
+
]
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|