@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.
Files changed (137) hide show
  1. package/.claude/agents/typescript-organizer.md +118 -0
  2. package/.claude/settings.local.json +30 -0
  3. package/dist/{cdcmap-fce76882.es.js → cdcmap-BnB1QM5d.es.js} +6 -13
  4. package/dist/{cdcmap-c55ac1ea.es.js → cdcmap-D6CG2-Hb.es.js} +5 -12
  5. package/dist/{cdcmap-31a33da1.es.js → cdcmap-MXgURbdZ.es.js} +6 -13
  6. package/dist/{cdcmap-1a1724a1.es.js → cdcmap-dgT_1dIT.es.js} +136 -151
  7. package/dist/cdcmap.js +56991 -53706
  8. package/examples/example-city-state.json +9 -1
  9. package/examples/multi-country-centering.json +45 -0
  10. package/examples/private/c.json +290 -0
  11. package/examples/private/canvas-city-hover.json +787 -0
  12. package/examples/private/colors-2.json +221 -0
  13. package/examples/private/colors.json +221 -0
  14. package/examples/private/d.json +345 -0
  15. package/examples/private/g.json +1 -0
  16. package/examples/private/h.json +105911 -0
  17. package/examples/private/measles-data.json +378 -0
  18. package/examples/private/measles.json +211 -0
  19. package/examples/private/north-dakota.json +1132 -0
  20. package/examples/private/state-with-pattern.json +883 -0
  21. package/index.html +36 -34
  22. package/package.json +26 -5
  23. package/src/CdcMap.tsx +23 -8
  24. package/src/CdcMapComponent.tsx +238 -308
  25. package/src/_stories/CdcMap.ColumnWrap.stories.tsx +31 -0
  26. package/src/_stories/CdcMap.DistrictOfColumbia.stories.tsx +320 -0
  27. package/src/_stories/CdcMap.Editor.stories.tsx +3371 -0
  28. package/src/_stories/CdcMap.Filters.stories.tsx +2 -2
  29. package/src/_stories/CdcMap.Legend.Gradient.stories.tsx +3 -3
  30. package/src/_stories/CdcMap.Legend.stories.tsx +7 -4
  31. package/src/_stories/CdcMap.Patterns.stories.tsx +2 -2
  32. package/src/_stories/CdcMap.SmallMultiples.stories.tsx +35 -0
  33. package/src/_stories/CdcMap.Table.stories.tsx +2 -2
  34. package/src/_stories/CdcMap.stories.tsx +37 -9
  35. package/src/_stories/GoogleMap.stories.tsx +2 -2
  36. package/src/_stories/UsaMap.NoData.stories.tsx +2 -2
  37. package/src/_stories/_mock/column-wrap-test.json +265 -0
  38. package/src/_stories/_mock/equal-number.json +1109 -0
  39. package/src/_stories/_mock/multi-country-hide.json +78 -0
  40. package/src/_stories/_mock/multi-country.json +95 -0
  41. package/src/_stories/_mock/multi-state.json +887 -20403
  42. package/src/_stories/_mock/small_multiples/multi-state-small-multiples.json +8399 -0
  43. package/src/_stories/_mock/small_multiples/region-small-multiples.json +657 -0
  44. package/src/_stories/_mock/small_multiples/wastewater-map-small-multiples.json +221 -0
  45. package/src/_stories/_mock/us-bubble-cities.json +306 -0
  46. package/src/_stories/_mock/usa-state-gradient.json +2 -4
  47. package/src/components/BubbleList.tsx +17 -13
  48. package/src/components/CityList.tsx +85 -107
  49. package/src/components/EditorPanel/components/EditorPanel.tsx +787 -709
  50. package/src/components/EditorPanel/components/HexShapeSettings.tsx +58 -95
  51. package/src/components/EditorPanel/components/Panels/Panel.PatternSettings.tsx +34 -42
  52. package/src/components/EditorPanel/components/Panels/Panel.SmallMultiples.tsx +354 -0
  53. package/src/components/EditorPanel/components/Panels/index.tsx +3 -1
  54. package/src/components/Geo.tsx +22 -3
  55. package/src/components/Legend/components/Legend.tsx +76 -40
  56. package/src/components/Legend/components/LegendGroup/Legend.Group.tsx +10 -7
  57. package/src/components/Legend/components/index.scss +1 -1
  58. package/src/components/MapContainer.tsx +52 -0
  59. package/src/components/MapControls.tsx +44 -0
  60. package/src/components/NavigationMenu.tsx +27 -15
  61. package/src/components/SmallMultiples/SmallMultipleTile.tsx +163 -0
  62. package/src/components/SmallMultiples/SmallMultiples.css +32 -0
  63. package/src/components/SmallMultiples/SmallMultiples.tsx +150 -0
  64. package/src/components/SmallMultiples/SynchronizedTooltip.tsx +105 -0
  65. package/src/components/SmallMultiples/index.tsx +3 -0
  66. package/src/components/UsaMap/components/SingleState/SingleState.CountyOutput.tsx +36 -4
  67. package/src/components/UsaMap/components/TerritoriesSection.tsx +26 -12
  68. package/src/components/UsaMap/components/Territory/Territory.Hexagon.tsx +30 -4
  69. package/src/components/UsaMap/components/Territory/Territory.Rectangle.tsx +23 -4
  70. package/src/components/UsaMap/components/Territory/TerritoryShape.ts +6 -0
  71. package/src/components/UsaMap/components/UsaMap.County.tsx +123 -37
  72. package/src/components/UsaMap/components/UsaMap.Region.tsx +36 -5
  73. package/src/components/UsaMap/components/UsaMap.SingleState.tsx +30 -10
  74. package/src/components/UsaMap/components/UsaMap.State.tsx +53 -12
  75. package/src/components/UsaMap/helpers/map.ts +4 -4
  76. package/src/components/UsaMap/helpers/shapes.ts +9 -6
  77. package/src/components/WorldMap/WorldMap.tsx +193 -35
  78. package/src/components/ZoomControls.tsx +6 -9
  79. package/src/context/LegendMemoContext.tsx +30 -0
  80. package/src/context.ts +1 -40
  81. package/src/data/initial-state.js +153 -130
  82. package/src/data/supported-geos.js +25 -78
  83. package/src/helpers/addUIDs.ts +13 -2
  84. package/src/helpers/applyColorToLegend.ts +140 -20
  85. package/src/helpers/applyLegendToRow.ts +10 -6
  86. package/src/helpers/componentHelpers.ts +8 -0
  87. package/src/helpers/constants.ts +12 -14
  88. package/src/helpers/dataTableHelpers.ts +6 -0
  89. package/src/helpers/displayGeoName.ts +18 -3
  90. package/src/helpers/generateRuntimeLegend.ts +44 -10
  91. package/src/helpers/generateRuntimeLegendHash.ts +4 -2
  92. package/src/helpers/getColumnNames.ts +1 -1
  93. package/src/helpers/getCountriesPicked.ts +103 -0
  94. package/src/helpers/getMapContainerClasses.ts +7 -0
  95. package/src/helpers/getPatternForRow.ts +33 -0
  96. package/src/helpers/getStatesPicked.ts +8 -5
  97. package/src/helpers/index.ts +3 -3
  98. package/src/helpers/isLegendItemDisabled.ts +16 -0
  99. package/src/helpers/mapObserverHelpers.ts +40 -0
  100. package/src/helpers/resetLegendToggles.ts +3 -2
  101. package/src/helpers/smallMultiplesHelpers.ts +359 -0
  102. package/src/helpers/tests/titleCase.test.ts +76 -0
  103. package/src/helpers/titleCase.ts +13 -13
  104. package/src/helpers/toggleLegendActive.ts +6 -11
  105. package/src/helpers/urlDataHelpers.ts +70 -0
  106. package/src/hooks/useCountryZoom.tsx +241 -0
  107. package/src/hooks/useGeoClickHandler.ts +36 -2
  108. package/src/hooks/useLegendMemo.ts +17 -0
  109. package/src/hooks/useMapLayers.tsx +5 -4
  110. package/src/hooks/useProgrammaticMapTooltip.ts +110 -0
  111. package/src/hooks/useResizeObserver.ts +5 -2
  112. package/src/hooks/useStateZoom.tsx +30 -8
  113. package/src/hooks/useSynchronizedGeographies.ts +56 -0
  114. package/src/hooks/useTooltip.ts +1 -2
  115. package/src/index.jsx +1 -2
  116. package/src/scss/editor-panel.scss +4 -440
  117. package/src/scss/main.scss +1 -1
  118. package/src/scss/map.scss +12 -15
  119. package/src/store/map.actions.ts +7 -7
  120. package/src/store/map.reducer.ts +17 -6
  121. package/src/test/CdcMap.test.jsx +11 -0
  122. package/src/types/MapConfig.ts +46 -18
  123. package/src/types/MapContext.ts +6 -7
  124. package/src/types/runtimeLegend.ts +17 -1
  125. package/vite.config.js +2 -7
  126. package/vitest.config.ts +16 -0
  127. package/src/components/DataTable.tsx +0 -385
  128. package/src/components/EditorPanel/components/Inputs.tsx +0 -59
  129. package/src/coreStyles_map.scss +0 -3
  130. package/src/helpers/colorDistributions.ts +0 -12
  131. package/src/helpers/generateColorsArray.ts +0 -14
  132. package/src/helpers/tests/generateColorsArray.test.ts +0 -18
  133. package/src/helpers/tests/generateRuntimeLegendHash.test.ts +0 -11
  134. package/src/hooks/useActiveElement.ts +0 -19
  135. package/src/scss/mixins.scss +0 -47
  136. package/src/types/Annotations.ts +0 -24
  137. /package/dist/{cdcmap-548642e6.es.js → cdcmap-Ct2SB0vL.es.js} +0 -0
@@ -1,3 +1,6 @@
1
+ // Map-specific Editor Panel Styles
2
+ // Common editor panel styles are imported from @cdc/core/styles/editor-panel-base via cove-main.scss
3
+
1
4
  .post-type-cdc_visualization {
2
5
  .cove {
3
6
  // Temp Radio button fix
@@ -14,8 +17,8 @@
14
17
  // End Temp Radio button fix
15
18
  }
16
19
  }
17
- .cdc-open-viz-module {
18
20
 
21
+ .cdc-open-viz-module {
19
22
  .editor-panel {
20
23
  .cove-input-group,
21
24
  .cove-accordion__small-inputs {
@@ -92,287 +95,9 @@
92
95
  margin-left: 0.3rem;
93
96
  }
94
97
 
95
-
96
- .form-container {
97
- border-right: var(--lightGray) 1px solid;
98
- flex-grow: 1;
99
- }
100
-
101
- .guidance-link {
102
- margin: 2em 1em 0;
103
- padding: 0.75em 1em;
104
- align-items: center;
105
- .heading-3 {
106
- font-weight: 600;
107
- font-size: 1.2em;
108
- }
109
- svg {
110
- width: 60px;
111
- color: var(--blue);
112
- margin-right: 1rem;
113
- height: 60px; // IE11
114
- path {
115
- fill: currentColor;
116
- }
117
- }
118
- }
119
- .warning {
120
- color: #d8000c;
121
- background-color: #ffd2d2;
122
- padding: 0.75em 1em;
123
- margin: 1em 0;
124
- font-size: 0.8em;
125
- border: #d8000c 1px solid;
126
- border-radius: 0.4em;
127
- strong {
128
- font-weight: 600;
129
- display: block;
130
- }
131
- }
132
- .accordion__button {
133
- cursor: pointer;
134
- font-size: 1em;
135
- padding: 0.3em 1em;
136
- width: 100%;
137
- text-align: left;
138
- position: relative;
139
- border-bottom: 1px solid rgba(0, 0, 0, 0.2);
140
- }
141
-
142
- .accordion__button:before {
143
- display: inline-block;
144
- content: '';
145
- height: 7px;
146
- width: 7px;
147
- margin-right: 1em;
148
- border-bottom: 2px solid currentColor;
149
- border-right: 2px solid currentColor;
150
- right: 0;
151
- position: absolute;
152
- top: 50%;
153
- transform: rotate(-45deg) translateY(-50%);
154
- transition: 0.1s all;
155
- }
156
-
157
- .accordion__button[aria-expanded='true']::before,
158
- .accordion__button[aria-selected='true']::before {
159
- top: 45%;
160
- transform: rotate(45deg) translateY(-50%);
161
- margin-right: 1.3em;
162
- transition: 0.1s all;
163
- }
164
-
165
- .accordion__panel {
166
- border-bottom: 1px solid rgba(0, 0, 0, 0.2);
167
- padding: 1em 1.25em 2em;
168
- animation: fadein 0.2s ease-in;
169
- span.h5 {
170
- font-size: 0.8em;
171
- }
172
- & p.layer-purpose-details {
173
- margin-top: 1em;
174
- }
175
- }
176
-
177
- .advanced {
178
- padding: 0 1em 1em;
179
- text-align: left;
180
- p {
181
- font-size: 0.8rem;
182
- }
183
- .advanced-toggle-link {
184
- padding-top: 1em;
185
- display: block;
186
- text-align: left;
187
- cursor: pointer;
188
- text-decoration: underline;
189
- span {
190
- text-decoration: none;
191
- display: inline-block;
192
- font-family: monospace;
193
- padding-right: 5px;
194
- }
195
- &:hover {
196
- color: rgba(0, 0, 0, 0.7);
197
- }
198
- }
199
- textarea {
200
- height: 400px;
201
- width: 100%;
202
- font-size: 0.9em;
203
- padding: 0.5em;
204
- font-family: monospace;
205
- box-sizing: border-box;
206
- }
207
- }
208
-
209
- @keyframes fadein {
210
- 0% {
211
- opacity: 0;
212
- }
213
-
214
- 100% {
215
- opacity: 1;
216
- }
217
- }
218
-
219
- .base-label {
220
- background: #565656;
221
- color: #fff;
222
- font-size: 1.1em;
223
- padding: 0.6em 1em;
224
- position: relative;
225
- border-bottom: #565656 3px solid;
226
- z-index: 3;
227
- }
228
-
229
- label {
230
- text-transform: uppercase;
231
- display: block;
232
- font-size: 0.8em;
233
- font-weight: 600;
234
- &:not(:first-child) {
235
- margin-top: 1em;
236
- }
237
- span.edit-label {
238
- margin-bottom: 0.3em;
239
- display: flex;
240
- }
241
- span.column-heading {
242
- font-size: 1em;
243
- }
244
- &.checkbox {
245
- margin-top: 0.5rem;
246
- display: flex;
247
-
248
- input {
249
- margin-left: 0;
250
- width: inherit;
251
- display: inline;
252
- }
253
- }
254
- }
255
- input[type='text'],
256
- input[role='combobox'],
257
- input[type='number'],
258
- textarea {
259
- min-width: 100%;
260
- max-width: 100%; // Doing this prevents width of textarea from being changed
261
- }
262
98
  textarea {
263
99
  min-height: 140px;
264
100
  }
265
- .header .color-palette li {
266
- width: 21px;
267
- height: 21px;
268
- border-radius: 40px;
269
- margin-right: 2.8px;
270
- }
271
- .color-palette {
272
- display: flex;
273
- max-width: 100%;
274
- padding: 0;
275
- margin: 0.5em 0 0 0;
276
- list-style: none;
277
- flex-wrap: wrap;
278
- li {
279
- width: 45px;
280
- height: 23px;
281
- margin-right: 4px;
282
- margin-bottom: 10px;
283
- display: flex;
284
- border-radius: 5px;
285
- overflow: hidden;
286
- cursor: pointer;
287
- position: relative;
288
- .click-target {
289
- position: absolute;
290
- top: 0;
291
- left: 0;
292
- right: 0;
293
- bottom: 0;
294
- }
295
- &.selected {
296
- border: rgba(0, 0, 0, 0.8) 2px solid;
297
- }
298
- span {
299
- width: 33.3%;
300
- }
301
- }
302
- }
303
-
304
- fieldset {
305
- display: block;
306
- }
307
-
308
- .primary-fieldset {
309
- padding: 0;
310
- margin: 0;
311
- border: 0;
312
- }
313
-
314
- ul.column-edit {
315
- list-style: none;
316
- li {
317
- margin-top: 1em;
318
- }
319
- .three-col {
320
- display: flex;
321
- justify-content: space-between;
322
- > label {
323
- margin-top: 0;
324
- width: 30%;
325
- display: inline-block;
326
- input[type='text'],
327
- input[type='number'] {
328
- width: 50px;
329
- }
330
- }
331
- }
332
- }
333
-
334
- &.hidden {
335
- display: none;
336
- }
337
-
338
- .emove-column {
339
- float: right;
340
- text-transform: uppercase;
341
- color: #c32b2b;
342
- font-size: 0.7em;
343
- line-height: 1.6em;
344
- border-radius: 5px;
345
- margin: 0 auto;
346
- transition: 0.1s all;
347
- border: 0;
348
- text-decoration: underline;
349
- outline: 0;
350
- cursor: pointer;
351
- font-weight: bold;
352
- }
353
-
354
- .edit-block {
355
- padding-left: 1em;
356
- border-left: rgba(0, 0, 0, 0.2) 4px solid;
357
- transition: 0.2s all;
358
- &:not(:first-child) {
359
- margin-top: 2em;
360
- }
361
- input[type='text'],
362
- input[type='number'] {
363
- font-size: 1em;
364
- }
365
- label {
366
- margin-top: 0;
367
- }
368
- label + label {
369
- margin-top: 1em;
370
- }
371
- &:hover {
372
- border-left: rgba(0, 0, 0, 0.7) 4px solid;
373
- transition: 0.2s all;
374
- }
375
- }
376
101
 
377
102
  .data-toggle {
378
103
  list-style: none;
@@ -443,167 +168,6 @@
443
168
  }
444
169
  }
445
170
  }
446
-
447
- span.subtext {
448
- display: block;
449
- color: rgba(0, 0, 0, 0.5);
450
- text-transform: none;
451
- font-weight: normal;
452
- }
453
-
454
- .sort-list {
455
- list-style: none;
456
- > li {
457
- margin-right: 0.3em;
458
- margin-bottom: 0.3em;
459
- }
460
- }
461
- .sort-list li > div {
462
- display: block;
463
- box-sizing: border-box;
464
- border: 1px solid #d1d1d1;
465
- border-radius: 2px;
466
- background: #f1f1f1;
467
- padding: 0.4em 0.6em;
468
- font-size: 0.8em;
469
- margin-bottom: 0.3em;
470
- cursor: move;
471
- z-index: 999;
472
- }
473
-
474
- .info {
475
- font-size: 0.8em;
476
- line-height: 1.4em;
477
- font-style: italic;
478
- padding-top: 10px;
479
- }
480
-
481
- .react-tags__search {
482
- width: 100%;
483
- }
484
-
485
- .react-tags {
486
- position: relative;
487
- input.react-tags__search-input {
488
- font-size: 0.8rem;
489
- }
490
- /* clicking anywhere will focus the input */
491
- cursor: text;
492
- span {
493
- display: inline;
494
- }
495
- }
496
-
497
- .react-tags.is-focused {
498
- border-color: rgba(0, 0, 0, 0.7);
499
- }
500
-
501
- .react-tags__selected {
502
- display: inline;
503
- }
504
-
505
- .react-tags__selected-tag {
506
- display: inline-block;
507
- box-sizing: border-box;
508
- border: 1px solid #d1d1d1;
509
- border-radius: 2px;
510
- background: #f1f1f1;
511
- padding: 0.4em 0.6em;
512
- font-size: 0.8em;
513
- margin-right: 0.3em;
514
- margin-bottom: 0.3em;
515
- }
516
-
517
- .react-tags__selected-tag:after {
518
- content: '\2715';
519
- color: #aaa;
520
- margin-left: 8px;
521
- }
522
-
523
- .react-tags__selected-tag:hover,
524
- .react-tags__selected-tag:focus {
525
- border-color: #b1b1b1;
526
- }
527
-
528
- .react-tags__search {
529
- display: inline-block;
530
-
531
- /* prevent autoresize overflowing the container */
532
- max-width: 100%;
533
- }
534
-
535
- @media screen and (min-width: 30em) {
536
- .react-tags__search {
537
- /* this will become the offsetParent for suggestions */
538
- position: relative;
539
- }
540
- }
541
-
542
- .react-tags__search input {
543
- /* prevent autoresize overflowing the container */
544
- max-width: 100%;
545
-
546
- /* emove styles and layout from this element */
547
- margin: 0;
548
- outline: none;
549
- padding: 0.5em 0.3em;
550
-
551
- /* match the font styles */
552
- font-size: inherit;
553
- line-height: inherit;
554
- }
555
-
556
- .react-tags__search input::-ms-clear {
557
- display: none;
558
- }
559
-
560
- .react-tags__suggestions {
561
- position: absolute;
562
- top: 100%;
563
- left: 0;
564
- width: 100%;
565
- }
566
-
567
- @media screen and (min-width: 30em) {
568
- .react-tags__suggestions {
569
- width: 240px;
570
- }
571
- }
572
-
573
- .react-tags__suggestions ul {
574
- margin: 4px -1px;
575
- padding: 0;
576
- list-style: none;
577
- background: white;
578
- border: 1px solid #d1d1d1;
579
- border-radius: 2px;
580
- box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
581
- }
582
-
583
- .react-tags__suggestions li {
584
- border-bottom: 1px solid #ddd;
585
- padding: 6px 8px;
586
- }
587
-
588
- .react-tags__suggestions li mark {
589
- text-decoration: underline;
590
- background: none;
591
- font-weight: 600;
592
- }
593
-
594
- .react-tags__suggestions li:hover {
595
- cursor: pointer;
596
- background: #eee;
597
- }
598
-
599
- .react-tags__suggestions li.is-active {
600
- background: #b7cfe0;
601
- }
602
-
603
- .react-tags__suggestions li.is-disabled {
604
- opacity: 0.5;
605
- cursor: auto;
606
- }
607
171
  }
608
172
 
609
173
  @include breakpointClass(md) {
@@ -1,4 +1,4 @@
1
- @import 'mixins';
1
+ @import '@cdc/core/styles/v2/utils/breakpoints';
2
2
  @import 'editor-panel';
3
3
  @import '@cdc/core/styles/accessibility';
4
4
 
package/src/scss/map.scss CHANGED
@@ -33,25 +33,28 @@ $medium: 768px;
33
33
  &:focus {
34
34
  outline: 0;
35
35
  }
36
+
37
+ // Multi-country map states - use higher specificity
38
+ &.hidden {
39
+ display: none !important;
40
+ }
41
+
42
+ &.grayed-out {
43
+ opacity: 0.3;
44
+ fill: #d3d3d3 !important;
45
+ }
36
46
  }
37
47
 
38
48
  .territories-label {
39
- font-size: 0.8rem;
40
49
  font-weight: 700;
41
50
  }
42
51
 
43
- @include breakpointClass(sm) {
44
- .territories-label {
45
- font-size: 1rem;
46
- }
47
- }
48
-
49
52
  // Cities and Territories
50
53
  .territories {
51
54
  gap: 0.5em;
52
55
  svg {
53
- max-width: 30px;
54
- min-width: 30px;
56
+ max-width: var(--territory-svg-max-width, 30px);
57
+ min-width: var(--territory-svg-min-width, 30px);
55
58
  transition: 0.3s all;
56
59
 
57
60
  text {
@@ -73,11 +76,6 @@ $medium: 768px;
73
76
  width: 2.5em;
74
77
  }
75
78
  }
76
- .territories {
77
- svg {
78
- max-width: 45px;
79
- }
80
- }
81
79
  }
82
80
 
83
81
  .state {
@@ -98,7 +96,6 @@ $medium: 768px;
98
96
  display: none;
99
97
  }
100
98
 
101
-
102
99
  .county-borders {
103
100
  fill: none;
104
101
  stroke-width: 1px;
@@ -1,9 +1,9 @@
1
- import { MapConfig, Coordinate } from '../types/MapConfig'
2
- import { GeneratedLegend } from '../hooks/useGenerateRuntimeLegend'
3
- import { VizFilter } from '@cdc/core/types/VizFilter'
1
+ import { type MapConfig, type Coordinate } from '../types/MapConfig'
2
+ import { type RuntimeLegend } from '../types/runtimeLegend'
3
+ import { type VizFilter } from '@cdc/core/types/VizFilter'
4
4
  import { type Action } from '@cdc/core/types/Action'
5
- import { RuntimeData } from '../types/RuntimeData'
6
- import { Modal } from '../types/Modal'
5
+ import { type RuntimeData } from '../types/RuntimeData'
6
+ import { type Modal } from '../types/Modal'
7
7
 
8
8
  // Action Types
9
9
  type SET_ACCESSIBLE_STATUS = Action<'SET_ACCESSIBLE_STATUS', string>
@@ -18,13 +18,13 @@ type SET_POSITION = Action<'SET_POSITION', { coordinates: Coordinate; zoom: numb
18
18
  type SET_REQUIRED_COLUMNS = Action<'SET_REQUIRED_COLUMNS', string[]>
19
19
  type SET_RUNTIME_DATA = Action<'SET_RUNTIME_DATA', RuntimeData>
20
20
  type SET_RUNTIME_FILTERS = Action<'SET_RUNTIME_FILTERS', VizFilter[]>
21
- type SET_RUNTIME_LEGEND = Action<'SET_RUNTIME_LEGEND', GeneratedLegend | []>
21
+ type SET_RUNTIME_LEGEND = Action<'SET_RUNTIME_LEGEND', RuntimeLegend | []>
22
22
  type SET_SCALE = Action<'SET_SCALE', number>
23
23
  type SET_STATES_TO_SHOW = Action<'SET_STATES_TO_SHOW', string[]>
24
24
  type SET_TOPO_DATA = Action<'SET_TOPO_DATA', any>
25
25
  type SET_TRANSLATE = Action<'SET_TRANSLATE', [number, number]>
26
26
 
27
- export type MapActions =
27
+ type MapActions =
28
28
  | SET_ACCESSIBLE_STATUS
29
29
  | SET_CONFIG
30
30
  | SET_COVE_LOADED_HAS_RAN
@@ -1,13 +1,24 @@
1
- import { MapConfig } from '../types/MapConfig'
1
+ import { MapConfig, RuntimeFilters } from '../types/MapConfig'
2
2
  import MapActions from './map.actions'
3
3
  import defaults from './../data/initial-state'
4
4
  import { devToolsWrapper } from '@cdc/core/helpers/withDevTools'
5
5
  import _ from 'lodash'
6
+ import { Modal } from '../types/Modal'
7
+ import { GeneratedLegend } from '../helpers/generateRuntimeLegend'
8
+ import { RuntimeData } from '../types/RuntimeData'
6
9
 
7
10
  export const getInitialState = (configObj = {}): MapState => {
11
+ // Create defaults without palette version to avoid overriding legacy configs
12
+ const defaultsWithoutPaletteaName = { ...defaults }
13
+
14
+ // Only apply palette defaults if the loaded config explicitly has general.palette
15
+ // if (!configObj?.general?.palette?.name) {
16
+ // delete defaultsWithoutPaletteaName.general?.palette.name
17
+ // }
18
+
8
19
  return {
9
20
  dataUrl: configObj.dataUrl || '',
10
- config: _.merge({}, defaults, configObj),
21
+ config: _.merge({}, defaultsWithoutPaletteaName, configObj),
11
22
  loading: false,
12
23
  accessibleStatus: '',
13
24
  coveLoadedHasRan: false,
@@ -42,10 +53,10 @@ export type MapState = {
42
53
  projection: object | null
43
54
  requiredColumns: string[]
44
55
  scale: number
45
- modal: object | null
46
- runtimeData: object
47
- runtimeFilters: object[]
48
- runtimeLegend: object[]
56
+ modal: Modal | null
57
+ runtimeData: RuntimeData | { init: boolean }
58
+ runtimeFilters: RuntimeFilters
59
+ runtimeLegend: GeneratedLegend | []
49
60
  statesToShow: string[]
50
61
  dataUrl: string
51
62
  }
@@ -0,0 +1,11 @@
1
+ import path from 'path'
2
+ import { testStandaloneBuild } from '@cdc/core/helpers/tests/testStandaloneBuild.ts'
3
+ import { describe, it, expect } from 'vitest'
4
+
5
+ describe('Map', () => {
6
+ it('Can be built in isolation', async () => {
7
+ const pkgDir = path.join(__dirname, '..')
8
+ const result = testStandaloneBuild(pkgDir)
9
+ expect(result).toBe(true)
10
+ })
11
+ })