@cdc/core 4.26.1 → 4.26.2

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 (99) hide show
  1. package/.claude/agents/qa-test-developer.md +126 -0
  2. package/CLAUDE.local.md +67 -0
  3. package/_stories/Gallery.Charts.stories.tsx +34 -41
  4. package/_stories/Gallery.DataBite.stories.tsx +14 -7
  5. package/_stories/Gallery.Maps.stories.tsx +36 -27
  6. package/_stories/Gallery.WaffleChart.stories.tsx +1 -1
  7. package/_stories/PageART.stories.tsx +4 -3
  8. package/_stories/PageBRFSS.stories.tsx +20 -15
  9. package/_stories/PageCancerRegistries.stories.tsx +14 -14
  10. package/_stories/PageEasternEquineEncephalitis.stories.tsx +30 -16
  11. package/_stories/PageExcessiveAlcoholUse.stories.tsx +148 -143
  12. package/_stories/PageMaternalMortality.stories.tsx +4 -3
  13. package/_stories/PageOralHealth.stories.tsx +14 -9
  14. package/_stories/PageSmokingTobacco.stories.tsx +14 -9
  15. package/_stories/PageStateDiabetesProfiles.stories.tsx +14 -9
  16. package/_stories/PageWastewater.stories.tsx +40 -26
  17. package/_stories/VegaImport.stories.tsx +401 -0
  18. package/_stories/vega-fixtures/bars-with-line.json +444 -0
  19. package/_stories/vega-fixtures/bars.json +58 -0
  20. package/_stories/vega-fixtures/combo-bar-rolling-mean.json +88 -0
  21. package/_stories/vega-fixtures/combo.json +68 -0
  22. package/_stories/vega-fixtures/grouped-horizontal-bars.json +83 -0
  23. package/_stories/vega-fixtures/grouped-horizontal-bars2.json +231 -0
  24. package/_stories/vega-fixtures/horizontal-bar.json +427 -0
  25. package/_stories/vega-fixtures/horizontal-bars-with-bad-colors.json +197 -0
  26. package/_stories/vega-fixtures/horizontal-bars2.json +58 -0
  27. package/_stories/vega-fixtures/lines.json +227 -0
  28. package/_stories/vega-fixtures/measles-bars.json +348 -0
  29. package/_stories/vega-fixtures/measles-map.json +11101 -0
  30. package/_stories/vega-fixtures/measles-stacked-bars.json +2147 -0
  31. package/_stories/vega-fixtures/multi-dataset.json +255 -0
  32. package/_stories/vega-fixtures/no-data.json +14 -0
  33. package/_stories/vega-fixtures/pie-chart.json +94 -0
  34. package/_stories/vega-fixtures/repeat-spec.json +47 -0
  35. package/_stories/vega-fixtures/stacked-area.json +222 -0
  36. package/_stories/vega-fixtures/stacked-bar-with-rect.json +3412 -0
  37. package/_stories/vega-fixtures/stacked-bars-with-line.json +364 -0
  38. package/_stories/vega-fixtures/stacked-bars.json +212 -0
  39. package/_stories/vega-fixtures/stacked-horizontal-bars.json +140 -0
  40. package/_stories/vega-fixtures/warning-combo.json +59 -0
  41. package/_stories/vega-fixtures/warning-scatter-and-line.json +1182 -0
  42. package/assets/icon-chart-area.svg +1 -0
  43. package/assets/icon-chart-radar.svg +23 -0
  44. package/assets/logo2.svg +31 -0
  45. package/components/AdvancedEditor/EmbedEditor.tsx +270 -38
  46. package/components/CustomColorsEditor/CustomColorsEditor.tsx +3 -10
  47. package/components/DataTable/helpers/getSeriesName.ts +6 -0
  48. package/components/EditorPanel/VizFilterEditor/NestedDropdownEditor.tsx +14 -6
  49. package/components/EditorPanel/VizFilterEditor/VizFilterEditor.tsx +4 -0
  50. package/components/EditorPanel/VizFilterEditor/components/FilterOrder.tsx +33 -29
  51. package/components/Layout/components/Sidebar/components/sidebar.styles.scss +2 -2
  52. package/components/Layout/components/Visualization/index.tsx +11 -0
  53. package/components/MediaControls.tsx +0 -1
  54. package/components/_stories/CustomColorsEditor.stories.tsx +37 -0
  55. package/components/_stories/DataTable.stories.tsx +1 -0
  56. package/data/colorPalettes.ts +18 -5
  57. package/data/mapColorPalettes.ts +10 -0
  58. package/devTemplate/dev.js +235 -0
  59. package/devTemplate/index.html +30 -0
  60. package/devTemplate/preview.html +1503 -0
  61. package/devTemplate/sidebar.css +151 -0
  62. package/dist/cove-main.css +2803 -4471
  63. package/dist/cove-main.css.map +1 -1
  64. package/generateViteConfig.js +111 -2
  65. package/helpers/DataTransform.ts +1 -5
  66. package/helpers/cove/date.ts +33 -1
  67. package/helpers/cove/string.ts +29 -0
  68. package/helpers/coveUpdateWorker.ts +3 -1
  69. package/helpers/embed/embedCodeGenerator.ts +80 -0
  70. package/helpers/embed/embedHelper.js +158 -0
  71. package/helpers/embed/filterUtils.ts +121 -0
  72. package/helpers/embed/index.ts +21 -0
  73. package/helpers/embed/urlValidation.ts +119 -0
  74. package/helpers/filterVizData.ts +6 -1
  75. package/helpers/getFileExtension.ts +0 -6
  76. package/helpers/metrics/types.ts +3 -0
  77. package/helpers/palettes/colorDistributions.ts +1 -1
  78. package/helpers/palettes/utils.ts +12 -12
  79. package/helpers/parseCsvWithQuotes.ts +15 -14
  80. package/helpers/prepareScreenshot.ts +27 -7
  81. package/helpers/testing.ts +44 -0
  82. package/helpers/tests/DataTransform.test.ts +125 -0
  83. package/helpers/tests/date.test.ts +64 -0
  84. package/helpers/vegaConfig.ts +1 -1
  85. package/helpers/vegaConfigImport.ts +160 -0
  86. package/helpers/ver/4.26.1.ts +1 -1
  87. package/helpers/ver/4.26.2.ts +84 -0
  88. package/helpers/ver/tests/4.26.1.test.ts +105 -0
  89. package/helpers/ver/tests/4.26.2.test.ts +298 -0
  90. package/helpers/viewports.ts +2 -0
  91. package/package.json +27 -32
  92. package/styles/v2/components/editor.scss +9 -9
  93. package/styles/v2/utils/_grid.scss +8 -3
  94. package/types/Annotation.ts +10 -11
  95. package/types/General.ts +2 -0
  96. package/types/Palette.ts +21 -0
  97. package/types/Visualization.ts +6 -0
  98. package/_stories/StoryRenderingTests.stories.tsx +0 -164
  99. package/helpers/embedCodeGenerator.ts +0 -109
@@ -31,13 +31,15 @@ const testMapRendering = async (canvasElement: HTMLElement, storyName: string) =
31
31
  const canvas = within(canvasElement)
32
32
 
33
33
  await step('Wait for map to render', async () => {
34
- const mapElement = await canvas.findByRole('img', { hidden: true }, { timeout: 10000 })
34
+ const mapElement = await canvas
35
+ .findByRole('img', { hidden: true }, { timeout: 10000 })
36
+ .catch(() => canvasElement.querySelector('canvas'))
35
37
  expect(mapElement).toBeInTheDocument()
36
38
  })
37
39
 
38
- await step('Verify SVG element is present', async () => {
39
- const svgElement = canvasElement.querySelector('svg')
40
- expect(svgElement).toBeInTheDocument()
40
+ await step('Verify SVG or canvas element is present', async () => {
41
+ const vizElement = canvasElement.querySelector('svg, canvas')
42
+ expect(vizElement).toBeInTheDocument()
41
43
  })
42
44
 
43
45
  await step('Verify COVE module wrapper is present', async () => {
@@ -50,14 +52,14 @@ const testMapRendering = async (canvasElement: HTMLElement, storyName: string) =
50
52
 
51
53
  // Bubble Maps
52
54
  export const Bubble_Map_World: Story = {
53
- render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/example-Bubble-Map-world.json" />,
55
+ render: () => <CdcMap configUrl='https://www.cdc.gov/cove/examples/example-Bubble-Map-world.json' />,
54
56
  play: async ({ canvasElement }) => {
55
57
  await testMapRendering(canvasElement, 'Bubble Map World')
56
58
  }
57
59
  }
58
60
 
59
61
  export const Bubble_Map_US: Story = {
60
- render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/Example-Bubble-US-Data-Map.json" />,
62
+ render: () => <CdcMap configUrl='https://www.cdc.gov/cove/examples/Example-Bubble-US-Data-Map.json' />,
61
63
  play: async ({ canvasElement }) => {
62
64
  await testMapRendering(canvasElement, 'Bubble Map US')
63
65
  }
@@ -65,14 +67,16 @@ export const Bubble_Map_US: Story = {
65
67
 
66
68
  // Categorical Maps
67
69
  export const Categorical_Map_With_Special_Classes: Story = {
68
- render: () => <CdcMap configUrl="https://www.cdc.gov/cove/data-files/Scale-Based-Categorical-Map-With-Special-Classes.json" />,
70
+ render: () => (
71
+ <CdcMap configUrl='https://www.cdc.gov/cove/data-files/Scale-Based-Categorical-Map-With-Special-Classes.json' />
72
+ ),
69
73
  play: async ({ canvasElement }) => {
70
74
  await testMapRendering(canvasElement, 'Categorical Map With Special Classes')
71
75
  }
72
76
  }
73
77
 
74
78
  export const Qualitative_Categorical_Map: Story = {
75
- render: () => <CdcMap configUrl="https://www.cdc.gov/cove/data-files/qualitative-map.json" />,
79
+ render: () => <CdcMap configUrl='https://www.cdc.gov/cove/data-files/qualitative-map.json' />,
76
80
  play: async ({ canvasElement }) => {
77
81
  await testMapRendering(canvasElement, 'Qualitative Categorical Map')
78
82
  }
@@ -80,7 +84,7 @@ export const Qualitative_Categorical_Map: Story = {
80
84
 
81
85
  // Custom Layer Map
82
86
  export const Custom_Layer_Map: Story = {
83
- render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/custom-layer-map.json" />,
87
+ render: () => <CdcMap configUrl='https://www.cdc.gov/cove/examples/custom-layer-map.json' />,
84
88
  play: async ({ canvasElement }) => {
85
89
  await testMapRendering(canvasElement, 'Custom Layer Map')
86
90
  }
@@ -88,14 +92,14 @@ export const Custom_Layer_Map: Story = {
88
92
 
89
93
  // Filterable Data Maps
90
94
  export const Map_Multiple_Filters: Story = {
91
- render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/map-multiple-filters.json" />,
95
+ render: () => <CdcMap configUrl='https://www.cdc.gov/cove/examples/map-multiple-filters.json' />,
92
96
  play: async ({ canvasElement }) => {
93
97
  await testMapRendering(canvasElement, 'Map Multiple Filters')
94
98
  }
95
99
  }
96
100
 
97
101
  export const Map_Tab_Filters: Story = {
98
- render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/map-tab-filters.json" />,
102
+ render: () => <CdcMap configUrl='https://www.cdc.gov/cove/examples/map-tab-filters.json' />,
99
103
  play: async ({ canvasElement }) => {
100
104
  await testMapRendering(canvasElement, 'Map Tab Filters')
101
105
  }
@@ -103,7 +107,7 @@ export const Map_Tab_Filters: Story = {
103
107
 
104
108
  // Geocode Map
105
109
  export const US_Geocode_Map: Story = {
106
- render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/example-u-s-geo-code-dat.json" />,
110
+ render: () => <CdcMap configUrl='https://www.cdc.gov/cove/examples/example-u-s-geo-code-dat.json' />,
107
111
  play: async ({ canvasElement }) => {
108
112
  await testMapRendering(canvasElement, 'US Geocode Map')
109
113
  }
@@ -111,7 +115,7 @@ export const US_Geocode_Map: Story = {
111
115
 
112
116
  // HHS Region Map
113
117
  export const HHS_Regions_Map: Story = {
114
- render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/example-hhs-regions-data.json" />,
118
+ render: () => <CdcMap configUrl='https://www.cdc.gov/cove/examples/example-hhs-regions-data.json' />,
115
119
  play: async ({ canvasElement }) => {
116
120
  await testMapRendering(canvasElement, 'HHS Regions Map')
117
121
  }
@@ -119,21 +123,21 @@ export const HHS_Regions_Map: Story = {
119
123
 
120
124
  // Hex Maps
121
125
  export const Standard_Hex_Map: Story = {
122
- render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/Hex_Map.json" />,
126
+ render: () => <CdcMap configUrl='https://www.cdc.gov/cove/examples/Hex_Map.json' />,
123
127
  play: async ({ canvasElement }) => {
124
128
  await testMapRendering(canvasElement, 'Standard Hex Map')
125
129
  }
126
130
  }
127
131
 
128
132
  export const Hex_Map_With_Filter: Story = {
129
- render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/example-hex-map-with-filter.json" />,
133
+ render: () => <CdcMap configUrl='https://www.cdc.gov/cove/examples/example-hex-map-with-filter.json' />,
130
134
  play: async ({ canvasElement }) => {
131
135
  await testMapRendering(canvasElement, 'Hex Map With Filter')
132
136
  }
133
137
  }
134
138
 
135
139
  export const Hex_Map_With_Arrows: Story = {
136
- render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/Hex_Map_Arrows.json" />,
140
+ render: () => <CdcMap configUrl='https://www.cdc.gov/cove/examples/Hex_Map_Arrows.json' />,
137
141
  play: async ({ canvasElement }) => {
138
142
  await testMapRendering(canvasElement, 'Hex Map With Arrows')
139
143
  }
@@ -141,7 +145,7 @@ export const Hex_Map_With_Arrows: Story = {
141
145
 
142
146
  // Map with Cities
143
147
  export const US_Map_With_Cities: Story = {
144
- render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/city-data-map-example.json" />,
148
+ render: () => <CdcMap configUrl='https://www.cdc.gov/cove/examples/city-data-map-example.json' />,
145
149
  play: async ({ canvasElement }) => {
146
150
  await testMapRendering(canvasElement, 'US Map With Cities')
147
151
  }
@@ -149,14 +153,14 @@ export const US_Map_With_Cities: Story = {
149
153
 
150
154
  // Navigation-Only Maps
151
155
  export const US_Navigation_Map: Story = {
152
- render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/us-nav-map.json" />,
156
+ render: () => <CdcMap configUrl='https://www.cdc.gov/cove/examples/us-nav-map.json' />,
153
157
  play: async ({ canvasElement }) => {
154
158
  await testMapRendering(canvasElement, 'US Navigation Map')
155
159
  }
156
160
  }
157
161
 
158
162
  export const World_Navigation_Map: Story = {
159
- render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/world-nav-map-example.json" />,
163
+ render: () => <CdcMap configUrl='https://www.cdc.gov/cove/examples/world-nav-map-example.json' />,
160
164
  play: async ({ canvasElement }) => {
161
165
  await testMapRendering(canvasElement, 'World Navigation Map')
162
166
  }
@@ -164,21 +168,21 @@ export const World_Navigation_Map: Story = {
164
168
 
165
169
  // Numeric Maps
166
170
  export const Equal_Interval_Map: Story = {
167
- render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/equal-interval-map.json" />,
171
+ render: () => <CdcMap configUrl='https://www.cdc.gov/cove/examples/equal-interval-map.json' />,
168
172
  play: async ({ canvasElement }) => {
169
173
  await testMapRendering(canvasElement, 'Equal Interval Map')
170
174
  }
171
175
  }
172
176
 
173
177
  export const Equal_Number_Map: Story = {
174
- render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/equal-number-map.json" />,
178
+ render: () => <CdcMap configUrl='https://www.cdc.gov/cove/examples/equal-number-map.json' />,
175
179
  play: async ({ canvasElement }) => {
176
180
  await testMapRendering(canvasElement, 'Equal Number Map')
177
181
  }
178
182
  }
179
183
 
180
184
  export const Equal_Number_Map_New_Quantile: Story = {
181
- render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/equal-number-map_new_quantile.json" />,
185
+ render: () => <CdcMap configUrl='https://www.cdc.gov/cove/examples/equal-number-map_new_quantile.json' />,
182
186
  play: async ({ canvasElement }) => {
183
187
  await testMapRendering(canvasElement, 'Equal Number Map New Quantile')
184
188
  }
@@ -186,28 +190,33 @@ export const Equal_Number_Map_New_Quantile: Story = {
186
190
 
187
191
  // Single State Maps
188
192
  export const Single_State_Map_Counties: Story = {
189
- render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/example-data-map-counties.json" />,
193
+ render: () => <CdcMap configUrl='https://www.cdc.gov/cove/examples/example-data-map-counties.json' />,
190
194
  play: async ({ canvasElement }) => {
191
195
  await testMapRendering(canvasElement, 'Single State Map Counties')
192
196
  }
193
197
  }
194
198
 
199
+ /*
200
+ Commented out because the config is pointing at a data file on wcms-wp.cdc.gov which is not accessible.
195
201
  export const Single_State_With_Census_Toggle: Story = {
196
202
  render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/single-state-map-with-census-toggle.json" />,
197
203
  play: async ({ canvasElement }) => {
198
204
  await testMapRendering(canvasElement, 'Single State With Census Toggle')
199
205
  }
200
206
  }
207
+ */
201
208
 
202
209
  export const Single_State_Filter_With_Zoom: Story = {
203
- render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/single-state-filter-change-with-zoom.json" />,
210
+ render: () => <CdcMap configUrl='https://www.cdc.gov/cove/examples/single-state-filter-change-with-zoom.json' />,
204
211
  play: async ({ canvasElement }) => {
205
212
  await testMapRendering(canvasElement, 'Single State Filter With Zoom')
206
213
  }
207
214
  }
208
215
 
209
216
  export const Multi_State_County_Map: Story = {
210
- render: () => <CdcMap configUrl="https://www.cdc.gov/wcms/4.0/cdc-wp/data-presentation/examples/multistate-county-map.json" />,
217
+ render: () => (
218
+ <CdcMap configUrl='https://www.cdc.gov/wcms/4.0/cdc-wp/data-presentation/examples/multistate-county-map.json' />
219
+ ),
211
220
  play: async ({ canvasElement }) => {
212
221
  await testMapRendering(canvasElement, 'Multi State County Map')
213
222
  }
@@ -215,7 +224,7 @@ export const Multi_State_County_Map: Story = {
215
224
 
216
225
  // US County Map
217
226
  export const US_County_Level_Map: Story = {
218
- render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/US-County-Level-Map.json" />,
227
+ render: () => <CdcMap configUrl='https://www.cdc.gov/cove/examples/US-County-Level-Map.json' />,
219
228
  play: async ({ canvasElement }) => {
220
229
  await testMapRendering(canvasElement, 'US County Level Map')
221
230
  }
@@ -223,7 +232,7 @@ export const US_County_Level_Map: Story = {
223
232
 
224
233
  // World Map
225
234
  export const World_Data_Map: Story = {
226
- render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/world-data-map-example.json" />,
235
+ render: () => <CdcMap configUrl='https://www.cdc.gov/cove/examples/world-data-map-example.json' />,
227
236
  play: async ({ canvasElement }) => {
228
237
  await testMapRendering(canvasElement, 'World Data Map')
229
238
  }
@@ -54,7 +54,7 @@ const testWaffleChartRendering = async (canvasElement: HTMLElement, storyName: s
54
54
  })
55
55
 
56
56
  await step('Verify waffle chart container is present', async () => {
57
- const waffleContainer = canvasElement.querySelector('.cove-waffle-chart')
57
+ const waffleContainer = canvasElement.querySelector('.cove-waffle-chart, .cove-gauge-chart')
58
58
  expect(waffleContainer).toBeInTheDocument()
59
59
  })
60
60
 
@@ -16,7 +16,8 @@ const meta: Meta = {
16
16
  layout: 'fullscreen',
17
17
  docs: {
18
18
  description: {
19
- component: 'Stories for visualizations from the CDC ART (Assisted Reproductive Technology) Surveillance State-Specific page (https://www.cdc.gov/art/php/surveillance-state-specific/index.html)'
19
+ component:
20
+ 'Stories for visualizations from the CDC ART (Assisted Reproductive Technology) Surveillance State-Specific page (https://www.cdc.gov/art/php/surveillance-state-specific/index.html)'
20
21
  }
21
22
  }
22
23
  },
@@ -140,7 +141,7 @@ const testDashboardRendering = async (canvasElement: HTMLElement, storyName: str
140
141
  const timeout = 20000
141
142
 
142
143
  const checkDashboard = () => {
143
- const dashboardElement = canvasElement.querySelector('.cove-dashboard')
144
+ const dashboardElement = canvasElement.querySelector('.type-dashboard')
144
145
  const loadingDiv = canvasElement.querySelector('div')
145
146
 
146
147
  // Log current state for debugging
@@ -161,7 +162,7 @@ const testDashboardRendering = async (canvasElement: HTMLElement, storyName: str
161
162
  })
162
163
 
163
164
  await step('Verify dashboard wrapper is present', async () => {
164
- const dashboard = canvasElement.querySelector('.cove-dashboard')
165
+ const dashboard = canvasElement.querySelector('.type-dashboard')
165
166
  expect(dashboard).toBeInTheDocument()
166
167
  })
167
168
 
@@ -16,7 +16,8 @@ const meta: Meta = {
16
16
  layout: 'fullscreen',
17
17
  docs: {
18
18
  description: {
19
- component: 'Stories for visualizations from the CDC Behavioral Risk Factor Surveillance System (BRFSS) Prevalence Data & Data Analysis Tools page (https://www.cdc.gov/brfss/brfssprevalence/index.html)'
19
+ component:
20
+ 'Stories for visualizations from the CDC Behavioral Risk Factor Surveillance System (BRFSS) Prevalence Data & Data Analysis Tools page (https://www.cdc.gov/brfss/brfssprevalence/index.html)'
20
21
  }
21
22
  }
22
23
  },
@@ -93,12 +94,16 @@ const useConfigWithAbsoluteDataUrl = (configUrl: string) => {
93
94
 
94
95
  newDatasets[absoluteKey] = {
95
96
  ...dataset,
96
- dataFileName: (dataset as any).dataFileName && !(dataset as any).dataFileName.startsWith('http')
97
- ? `https://www.cdc.gov/${(dataset as any).dataFileName.replace(/^(\.\.\/)+/, '').replace(/^\//, '')}`
98
- : (dataset as any).dataFileName,
99
- dataUrl: (dataset as any).dataUrl && !(dataset as any).dataUrl.startsWith('http')
100
- ? `https://www.cdc.gov/${(dataset as any).dataUrl.replace(/^(\.\.\/)+/, '').replace(/^\//, '')}`
101
- : (dataset as any).dataUrl
97
+ dataFileName:
98
+ (dataset as any).dataFileName && !(dataset as any).dataFileName.startsWith('http')
99
+ ? `https://www.cdc.gov/${(dataset as any).dataFileName
100
+ .replace(/^(\.\.\/)+/, '')
101
+ .replace(/^\//, '')}`
102
+ : (dataset as any).dataFileName,
103
+ dataUrl:
104
+ (dataset as any).dataUrl && !(dataset as any).dataUrl.startsWith('http')
105
+ ? `https://www.cdc.gov/${(dataset as any).dataUrl.replace(/^(\.\.\/)+/, '').replace(/^\//, '')}`
106
+ : (dataset as any).dataUrl
102
107
  }
103
108
  }
104
109
  })
@@ -140,7 +145,7 @@ const testDashboardRendering = async (canvasElement: HTMLElement, storyName: str
140
145
  const timeout = 30000 // Longer timeout for external data loading
141
146
 
142
147
  const checkDashboard = () => {
143
- const dashboardElement = canvasElement.querySelector('.cove-dashboard')
148
+ const dashboardElement = canvasElement.querySelector('.type-dashboard')
144
149
  const loadingDiv = canvasElement.querySelector('div')
145
150
 
146
151
  // Log current state for debugging
@@ -161,7 +166,7 @@ const testDashboardRendering = async (canvasElement: HTMLElement, storyName: str
161
166
  })
162
167
 
163
168
  await step('Verify dashboard wrapper is present', async () => {
164
- const dashboard = canvasElement.querySelector('.cove-dashboard')
169
+ const dashboard = canvasElement.querySelector('.type-dashboard')
165
170
  expect(dashboard).toBeInTheDocument()
166
171
  })
167
172
 
@@ -224,15 +229,15 @@ export const All_BRFSS_Dashboards: StoryObj = {
224
229
  }
225
230
 
226
231
  return (
227
- <div className="container-fluid p-4">
228
- <h1 className="mb-4">BRFSS Prevalence Data - All Dashboards</h1>
232
+ <div className='container-fluid p-4'>
233
+ <h1 className='mb-4'>BRFSS Prevalence Data - All Dashboards</h1>
229
234
 
230
- <section className="mb-5">
235
+ <section className='mb-5'>
231
236
  <h2>Explore by Location</h2>
232
237
  <Dashboard config={locationConfig} />
233
238
  </section>
234
239
 
235
- <section className="mb-5">
240
+ <section className='mb-5'>
236
241
  <h2>Explore by Topic</h2>
237
242
  <Dashboard config={topicConfig} />
238
243
  </section>
@@ -266,7 +271,7 @@ export const All_BRFSS_Dashboards: StoryObj = {
266
271
  const timeout = 40000
267
272
 
268
273
  const checkDashboards = () => {
269
- const dashboards = canvasElement.querySelectorAll('.cove-dashboard')
274
+ const dashboards = canvasElement.querySelectorAll('.type-dashboard')
270
275
  if (dashboards.length >= 2) {
271
276
  resolve()
272
277
  } else if (Date.now() - startTime > timeout) {
@@ -280,7 +285,7 @@ export const All_BRFSS_Dashboards: StoryObj = {
280
285
  })
281
286
 
282
287
  await step('Verify both dashboards are present', async () => {
283
- const dashboards = canvasElement.querySelectorAll('.cove-dashboard')
288
+ const dashboards = canvasElement.querySelectorAll('.type-dashboard')
284
289
  expect(dashboards.length).toBe(2)
285
290
  })
286
291
 
@@ -16,7 +16,8 @@ const meta: Meta = {
16
16
  layout: 'fullscreen',
17
17
  docs: {
18
18
  description: {
19
- component: 'Stories for visualizations from the CDC National Program of Cancer Registries (NPCR) Contact page (https://www.cdc.gov/national-program-cancer-registries/contact/index.html)'
19
+ component:
20
+ 'Stories for visualizations from the CDC National Program of Cancer Registries (NPCR) Contact page (https://www.cdc.gov/national-program-cancer-registries/contact/index.html)'
20
21
  }
21
22
  }
22
23
  },
@@ -92,12 +93,16 @@ const useConfigWithAbsoluteDataUrl = (configUrl: string) => {
92
93
 
93
94
  newDatasets[absoluteKey] = {
94
95
  ...dataset,
95
- dataFileName: (dataset as any).dataFileName && !(dataset as any).dataFileName.startsWith('http')
96
- ? `https://www.cdc.gov/${(dataset as any).dataFileName.replace(/^(\.\.\/)+/, '').replace(/^\//, '')}`
97
- : (dataset as any).dataFileName,
98
- dataUrl: (dataset as any).dataUrl && !(dataset as any).dataUrl.startsWith('http')
99
- ? `https://www.cdc.gov/${(dataset as any).dataUrl.replace(/^(\.\.\/)+/, '').replace(/^\//, '')}`
100
- : (dataset as any).dataUrl
96
+ dataFileName:
97
+ (dataset as any).dataFileName && !(dataset as any).dataFileName.startsWith('http')
98
+ ? `https://www.cdc.gov/${(dataset as any).dataFileName
99
+ .replace(/^(\.\.\/)+/, '')
100
+ .replace(/^\//, '')}`
101
+ : (dataset as any).dataFileName,
102
+ dataUrl:
103
+ (dataset as any).dataUrl && !(dataset as any).dataUrl.startsWith('http')
104
+ ? `https://www.cdc.gov/${(dataset as any).dataUrl.replace(/^(\.\.\/)+/, '').replace(/^\//, '')}`
105
+ : (dataset as any).dataUrl
101
106
  }
102
107
  }
103
108
  })
@@ -139,7 +144,7 @@ const testDashboardRendering = async (canvasElement: HTMLElement, storyName: str
139
144
  const timeout = 20000
140
145
 
141
146
  const checkDashboard = () => {
142
- const dashboardElement = canvasElement.querySelector('.cove-dashboard')
147
+ const dashboardElement = canvasElement.querySelector('.type-dashboard')
143
148
  const loadingDiv = canvasElement.querySelector('div')
144
149
 
145
150
  // Log current state for debugging
@@ -160,7 +165,7 @@ const testDashboardRendering = async (canvasElement: HTMLElement, storyName: str
160
165
  })
161
166
 
162
167
  await step('Verify dashboard wrapper is present', async () => {
163
- const dashboard = canvasElement.querySelector('.cove-dashboard')
168
+ const dashboard = canvasElement.querySelector('.type-dashboard')
164
169
  expect(dashboard).toBeInTheDocument()
165
170
  })
166
171
 
@@ -169,11 +174,6 @@ const testDashboardRendering = async (canvasElement: HTMLElement, storyName: str
169
174
  expect(coveModules.length).toBeGreaterThan(0)
170
175
  })
171
176
 
172
- await step('Verify map visualization is present', async () => {
173
- const mapElement = canvasElement.querySelector('svg')
174
- expect(mapElement).toBeInTheDocument()
175
- })
176
-
177
177
  console.log(` ${storyName} dashboard rendered successfully`)
178
178
  }
179
179
 
@@ -37,18 +37,32 @@ const CONFIG_URLS = {
37
37
  type MapStory = StoryObj<typeof CdcMap>
38
38
  type DashboardStory = StoryObj<typeof Dashboard>
39
39
 
40
- // Helper function to test map rendering
40
+ // Helper function to test map rendering (supports both SVG and canvas-based maps)
41
41
  const testMapRendering = async (canvasElement: HTMLElement, storyName: string) => {
42
- const canvas = within(canvasElement)
43
-
44
42
  await step('Wait for map to render', async () => {
45
- const mapElement = await canvas.findByRole('img', { hidden: true }, { timeout: 10000 })
46
- expect(mapElement).toBeInTheDocument()
43
+ await new Promise<void>((resolve, reject) => {
44
+ const startTime = Date.now()
45
+ const timeout = 15000
46
+
47
+ const checkMap = () => {
48
+ const svgMap = canvasElement.querySelector('svg[role="img"]')
49
+ const canvasMap = canvasElement.querySelector('canvas')
50
+ if (svgMap || canvasMap) {
51
+ resolve()
52
+ } else if (Date.now() - startTime > timeout) {
53
+ reject(new Error(`Timeout: No map element (svg or canvas) found after ${timeout}ms`))
54
+ } else {
55
+ setTimeout(checkMap, 100)
56
+ }
57
+ }
58
+ checkMap()
59
+ })
47
60
  })
48
61
 
49
- await step('Verify SVG element is present', async () => {
50
- const svgElement = canvasElement.querySelector('svg')
51
- expect(svgElement).toBeInTheDocument()
62
+ await step('Verify map visualization is present', async () => {
63
+ const svgMap = canvasElement.querySelector('svg[role="img"]')
64
+ const canvasMap = canvasElement.querySelector('canvas')
65
+ expect(svgMap || canvasMap).toBeTruthy()
52
66
  })
53
67
 
54
68
  await step('Verify COVE module wrapper is present', async () => {
@@ -67,7 +81,7 @@ const testDashboardRendering = async (canvasElement: HTMLElement, storyName: str
67
81
  const timeout = 15000
68
82
 
69
83
  const checkDashboard = () => {
70
- const dashboardElement = canvasElement.querySelector('.cove-dashboard')
84
+ const dashboardElement = canvasElement.querySelector('.type-dashboard')
71
85
  if (dashboardElement) {
72
86
  resolve()
73
87
  } else if (Date.now() - startTime > timeout) {
@@ -81,7 +95,7 @@ const testDashboardRendering = async (canvasElement: HTMLElement, storyName: str
81
95
  })
82
96
 
83
97
  await step('Verify dashboard wrapper is present', async () => {
84
- const dashboard = canvasElement.querySelector('.cove-dashboard')
98
+ const dashboard = canvasElement.querySelector('.type-dashboard')
85
99
  expect(dashboard).toBeInTheDocument()
86
100
  })
87
101
 
@@ -144,25 +158,25 @@ export const Connecticut_2022: MapStory = {
144
158
  */
145
159
  export const All_EEE_Visualizations: StoryObj = {
146
160
  render: () => (
147
- <div className="container-fluid p-4">
148
- <h1 className="mb-4">Eastern Equine Encephalitis - Historic Data</h1>
161
+ <div className='container-fluid p-4'>
162
+ <h1 className='mb-4'>Eastern Equine Encephalitis - Historic Data</h1>
149
163
 
150
- <section className="mb-5">
164
+ <section className='mb-5'>
151
165
  <h2>Cumulative Data for 2003–2024</h2>
152
166
  <Dashboard configUrl={CONFIG_URLS.cumulativeData} />
153
167
  </section>
154
168
 
155
- <section className="mb-5">
169
+ <section className='mb-5'>
156
170
  <h2>Explore Human Data for 2003–2024</h2>
157
171
  <Dashboard configUrl={CONFIG_URLS.exploreHumanData} />
158
172
  </section>
159
173
 
160
- <section className="mb-5">
174
+ <section className='mb-5'>
161
175
  <h2>Explore County Level Data for 2003–2024</h2>
162
176
  <CdcMap configUrl={CONFIG_URLS.exploreCountyData} />
163
177
  </section>
164
178
 
165
- <section className="mb-5">
179
+ <section className='mb-5'>
166
180
  <h2>Connecticut 2022 Data</h2>
167
181
  <CdcMap configUrl={CONFIG_URLS.ct2022} />
168
182
  </section>