@cdc/core 4.25.11 → 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.
Files changed (77) hide show
  1. package/_stories/Gallery.Charts.stories.tsx +307 -0
  2. package/_stories/Gallery.DataBite.stories.tsx +72 -0
  3. package/_stories/Gallery.Maps.stories.tsx +230 -0
  4. package/_stories/Gallery.WaffleChart.stories.tsx +187 -0
  5. package/_stories/PageART.stories.tsx +192 -0
  6. package/_stories/PageBRFSS.stories.tsx +289 -0
  7. package/_stories/PageCancerRegistries.stories.tsx +199 -0
  8. package/_stories/PageEasternEquineEncephalitis.stories.tsx +202 -0
  9. package/_stories/PageExcessiveAlcoholUse.stories.tsx +196 -0
  10. package/_stories/PageMaternalMortality.stories.tsx +192 -0
  11. package/_stories/PageOralHealth.stories.tsx +196 -0
  12. package/_stories/PageRespiratory.stories.tsx +332 -0
  13. package/_stories/PageSmokingTobacco.stories.tsx +195 -0
  14. package/_stories/PageStateDiabetesProfiles.stories.tsx +196 -0
  15. package/_stories/PageWastewater.stories.tsx +463 -0
  16. package/assets/icon-magnifying-glass.svg +5 -0
  17. package/assets/icon-warming-stripes.svg +13 -0
  18. package/components/AdvancedEditor/AdvancedEditor.tsx +4 -0
  19. package/components/AdvancedEditor/EmbedEditor.tsx +281 -0
  20. package/components/ComboBox/ComboBox.tsx +345 -0
  21. package/components/ComboBox/combobox.styles.css +185 -0
  22. package/components/ComboBox/index.ts +1 -0
  23. package/components/DataTable/DataTable.tsx +132 -58
  24. package/components/DataTable/data-table.css +216 -215
  25. package/components/DataTable/helpers/mapCellMatrix.tsx +14 -6
  26. package/components/EditorPanel/ColumnsEditor.tsx +37 -19
  27. package/components/EditorPanel/DataTableEditor.tsx +51 -25
  28. package/components/EditorPanel/EditorPanel.styles.css +16 -0
  29. package/components/EditorPanel/EditorPanel.tsx +144 -0
  30. package/components/EditorPanel/EditorPanelDispatch.tsx +75 -0
  31. package/components/EditorPanel/FieldSetWrapper.tsx +66 -23
  32. package/components/EditorPanel/Inputs.tsx +33 -7
  33. package/components/EditorPanel/VizFilterEditor/VizFilterEditor.tsx +236 -175
  34. package/components/EditorPanel/sections/VisualSection.tsx +169 -0
  35. package/components/Filters/Filters.tsx +31 -5
  36. package/components/Filters/helpers/getNestedOptions.ts +2 -1
  37. package/components/Filters/helpers/handleSorting.ts +1 -1
  38. package/components/Layout/components/Sidebar/components/sidebar.styles.scss +82 -0
  39. package/components/Layout/components/Visualization/index.tsx +16 -1
  40. package/components/Layout/components/Visualization/visualizations.scss +7 -0
  41. package/components/Legend/Legend.Gradient.tsx +1 -1
  42. package/components/MediaControls.tsx +53 -27
  43. package/components/ui/Icon.tsx +3 -1
  44. package/components/ui/Title/index.tsx +30 -2
  45. package/components/ui/Title/title.styles.css +42 -0
  46. package/dist/cove-main.css +26 -3
  47. package/dist/cove-main.css.map +1 -1
  48. package/generateViteConfig.js +8 -1
  49. package/helpers/addValuesToFilters.ts +6 -1
  50. package/helpers/coveUpdateWorker.ts +19 -12
  51. package/helpers/embedCodeGenerator.ts +109 -0
  52. package/helpers/getUniqueValues.ts +19 -0
  53. package/helpers/hashObj.ts +25 -0
  54. package/helpers/isRightAlignedTableValue.js +5 -0
  55. package/helpers/metrics/helpers.ts +1 -0
  56. package/helpers/pivotData.ts +2 -2
  57. package/helpers/prepareScreenshot.ts +268 -0
  58. package/helpers/queryStringUtils.ts +29 -0
  59. package/helpers/tests/prepareScreenshot.test.ts +414 -0
  60. package/helpers/tests/queryStringUtils.test.ts +381 -0
  61. package/helpers/tests/testStandaloneBuild.ts +23 -5
  62. package/helpers/useDataVizClasses.ts +0 -1
  63. package/helpers/ver/4.26.1.ts +80 -0
  64. package/hooks/useDataColumns.ts +63 -0
  65. package/hooks/useFilterManagement.ts +94 -0
  66. package/hooks/useLegendSeparators.ts +26 -0
  67. package/hooks/useListManagement.ts +192 -0
  68. package/package.json +4 -3
  69. package/styles/_button-section.scss +0 -3
  70. package/types/Axis.ts +1 -0
  71. package/types/ForecastingSeriesKey.ts +1 -0
  72. package/types/MarkupInclude.ts +1 -0
  73. package/types/Series.ts +3 -0
  74. package/types/Table.ts +1 -0
  75. package/types/Visualization.ts +1 -0
  76. package/types/VizFilter.ts +1 -0
  77. package/LICENSE +0 -201
@@ -0,0 +1,307 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite'
2
+ import { within, expect } from 'storybook/test'
3
+ import Chart from '@cdc/chart'
4
+
5
+ // Fallback step function for test descriptions
6
+ const step = async (description: string, fn: () => Promise<void> | void) => {
7
+ console.log(`▶ ${description}`)
8
+ await fn()
9
+ console.log(`✓ ${description}`)
10
+ }
11
+
12
+ const meta: Meta = {
13
+ title: 'Regression Tests/Gallery/Charts',
14
+ parameters: {
15
+ layout: 'fullscreen',
16
+ docs: {
17
+ description: {
18
+ component: 'Chart visualization examples from the CDC COVE Gallery'
19
+ }
20
+ }
21
+ },
22
+ tags: ['autodocs']
23
+ }
24
+
25
+ export default meta
26
+
27
+ type Story = StoryObj<typeof Chart>
28
+
29
+ // Helper function to test chart rendering
30
+ const testChartRendering = async (canvasElement: HTMLElement, storyName: string) => {
31
+ const canvas = within(canvasElement)
32
+
33
+ await step('Wait for chart to render', async () => {
34
+ const svgElement = await canvas.findByRole('img', { hidden: true }, { timeout: 10000 })
35
+ expect(svgElement).toBeInTheDocument()
36
+ })
37
+
38
+ await step('Verify chart SVG is present', async () => {
39
+ const chartSvg = canvasElement.querySelector('svg')
40
+ expect(chartSvg).toBeInTheDocument()
41
+ })
42
+
43
+ await step('Verify COVE module wrapper is present', async () => {
44
+ const coveModule = canvasElement.querySelector('.cdc-open-viz-module')
45
+ expect(coveModule).toBeInTheDocument()
46
+ })
47
+
48
+ console.log(` ${storyName} chart rendered successfully`)
49
+ }
50
+
51
+ // Bar Charts
52
+ export const Bar_Chart_Time_Based: Story = {
53
+ render: () => <Chart configUrl="https://www.cdc.gov/cove/examples/Example_Bar_Chart.json" />,
54
+ play: async ({ canvasElement }) => {
55
+ await testChartRendering(canvasElement, 'Bar Chart Time Based')
56
+ }
57
+ }
58
+
59
+ export const Bar_Chart_Categorical: Story = {
60
+ render: () => <Chart configUrl="https://www.cdc.gov/cove/examples/example-category-bar-char.json" />,
61
+ play: async ({ canvasElement }) => {
62
+ await testChartRendering(canvasElement, 'Bar Chart Categorical')
63
+ }
64
+ }
65
+
66
+ export const Bar_Chart_With_Highlighted_Value: Story = {
67
+ render: () => <Chart configUrl="https://www.cdc.gov/cove/examples/bar-chart-with-highlighte.json" />,
68
+ play: async ({ canvasElement }) => {
69
+ await testChartRendering(canvasElement, 'Bar Chart With Highlighted Value')
70
+ }
71
+ }
72
+
73
+ export const Bar_Chart_With_Confidence_Intervals: Story = {
74
+ render: () => <Chart configUrl="https://www.cdc.gov/cove/examples/Example_Bar_CI_1.json" />,
75
+ play: async ({ canvasElement }) => {
76
+ await testChartRendering(canvasElement, 'Bar Chart With Confidence Intervals')
77
+ }
78
+ }
79
+
80
+ export const Bar_Chart_With_Suppressed_Values: Story = {
81
+ render: () => <Chart configUrl="https://www.cdc.gov/cove/examples/bar-chart-with-suppressed-values.json" />,
82
+ play: async ({ canvasElement }) => {
83
+ await testChartRendering(canvasElement, 'Bar Chart With Suppressed Values')
84
+ }
85
+ }
86
+
87
+ export const Horizontal_Bar_Chart: Story = {
88
+ render: () => <Chart configUrl="https://www.cdc.gov/cove/examples/Horizontal_Bar_Chart_Viz.json" />,
89
+ play: async ({ canvasElement }) => {
90
+ await testChartRendering(canvasElement, 'Horizontal Bar Chart')
91
+ }
92
+ }
93
+
94
+ // Box and Whiskers Plots
95
+ export const Box_Plot_With_Outliers: Story = {
96
+ render: () => <Chart configUrl="https://www.cdc.gov/cove/examples/box-plot-outliers.json" />,
97
+ play: async ({ canvasElement }) => {
98
+ await testChartRendering(canvasElement, 'Box Plot With Outliers')
99
+ }
100
+ }
101
+
102
+ export const Horizontal_Box_Plot: Story = {
103
+ render: () => <Chart configUrl="https://www.cdc.gov/cove/examples/horizontal-box-plot.json" />,
104
+ play: async ({ canvasElement }) => {
105
+ await testChartRendering(canvasElement, 'Horizontal Box Plot')
106
+ }
107
+ }
108
+
109
+ // Bump Chart
110
+ export const Bump_Chart: Story = {
111
+ render: () => <Chart configUrl="https://www.cdc.gov/cove/examples/bump-chart.json" />,
112
+ play: async ({ canvasElement }) => {
113
+ await testChartRendering(canvasElement, 'Bump Chart')
114
+ }
115
+ }
116
+
117
+ // Combo Bar/Line Charts
118
+ export const Combo_Bar_And_Area: Story = {
119
+ render: () => <Chart configUrl="https://www.cdc.gov/cove/examples/Combo_Bar_Line_Viz.json" />,
120
+ play: async ({ canvasElement }) => {
121
+ await testChartRendering(canvasElement, 'Combo Bar And Area')
122
+ }
123
+ }
124
+
125
+ export const Epi_Style_Bar_Chart: Story = {
126
+ render: () => <Chart configUrl="https://www.cdc.gov/cove/examples/example-epi-style-bar-chart.json" />,
127
+ play: async ({ canvasElement }) => {
128
+ await testChartRendering(canvasElement, 'Epi Style Bar Chart')
129
+ }
130
+ }
131
+
132
+ // Deviation Bar Chart
133
+ export const Deviation_Bar_Chart: Story = {
134
+ render: () => <Chart configUrl="https://www.cdc.gov/cove/examples/example-deviation-bar-chart.json" />,
135
+ play: async ({ canvasElement }) => {
136
+ await testChartRendering(canvasElement, 'Deviation Bar Chart')
137
+ }
138
+ }
139
+
140
+ // Forecast Charts
141
+ export const Forecast_Chart_Single_CI: Story = {
142
+ render: () => <Chart configUrl="https://www.cdc.gov/cove/examples/forecast-chart-one-CI.json" />,
143
+ play: async ({ canvasElement }) => {
144
+ await testChartRendering(canvasElement, 'Forecast Chart Single CI')
145
+ }
146
+ }
147
+
148
+ export const Forecast_Chart_Multiple_CIs: Story = {
149
+ render: () => <Chart configUrl="https://www.cdc.gov/cove/examples/forecast-chart-2-CIs.json" />,
150
+ play: async ({ canvasElement }) => {
151
+ await testChartRendering(canvasElement, 'Forecast Chart Multiple CIs')
152
+ }
153
+ }
154
+
155
+ // Line Charts
156
+ export const Line_Chart_Standard: Story = {
157
+ render: () => <Chart configUrl="https://www.cdc.gov/cove/examples/Line_Chart_Viz.json" />,
158
+ play: async ({ canvasElement }) => {
159
+ await testChartRendering(canvasElement, 'Line Chart Standard')
160
+ }
161
+ }
162
+
163
+ export const Line_Chart_With_Regions: Story = {
164
+ render: () => <Chart configUrl="https://www.cdc.gov/cove/examples/Line_Chart_Regions_Viz.json" />,
165
+ play: async ({ canvasElement }) => {
166
+ await testChartRendering(canvasElement, 'Line Chart With Regions')
167
+ }
168
+ }
169
+
170
+ export const Line_Chart_Isolated: Story = {
171
+ render: () => <Chart configUrl="https://www.cdc.gov/cove/examples/Line_Chart_Isolated.json" />,
172
+ play: async ({ canvasElement }) => {
173
+ await testChartRendering(canvasElement, 'Line Chart Isolated')
174
+ }
175
+ }
176
+
177
+ export const Line_Chart_Line_Weights: Story = {
178
+ render: () => <Chart configUrl="https://www.cdc.gov/cove/examples/Line_Chart_Line_Weights.json" />,
179
+ play: async ({ canvasElement }) => {
180
+ await testChartRendering(canvasElement, 'Line Chart Line Weights')
181
+ }
182
+ }
183
+
184
+ export const Line_Chart_With_Open_Circles: Story = {
185
+ render: () => <Chart configUrl="https://www.cdc.gov/cove/examples/line-chart-with-open-circles.json" />,
186
+ play: async ({ canvasElement }) => {
187
+ await testChartRendering(canvasElement, 'Line Chart With Open Circles')
188
+ }
189
+ }
190
+
191
+ export const Line_Chart_With_Suppression: Story = {
192
+ render: () => <Chart configUrl="https://www.cdc.gov/cove/examples/line-chart-with-suppression.json" />,
193
+ play: async ({ canvasElement }) => {
194
+ await testChartRendering(canvasElement, 'Line Chart With Suppression')
195
+ }
196
+ }
197
+
198
+ // Lollipop Bar Chart
199
+ export const Lollipop_Horizontal_Bar_Chart: Story = {
200
+ render: () => <Chart configUrl="https://www.cdc.gov/cove/examples/lollipop-style-horizontal-bar-chart.json" />,
201
+ play: async ({ canvasElement }) => {
202
+ await testChartRendering(canvasElement, 'Lollipop Horizontal Bar Chart')
203
+ }
204
+ }
205
+
206
+ // Pie and Donut Charts
207
+ export const Pie_Chart: Story = {
208
+ render: () => <Chart configUrl="https://www.cdc.gov/cove/examples/Example_Pie_viz.json" />,
209
+ play: async ({ canvasElement }) => {
210
+ await testChartRendering(canvasElement, 'Pie Chart')
211
+ }
212
+ }
213
+
214
+ export const Donut_Chart: Story = {
215
+ render: () => <Chart configUrl="https://www.cdc.gov/cove/examples/Donut-Chart.json" />,
216
+ play: async ({ canvasElement }) => {
217
+ await testChartRendering(canvasElement, 'Donut Chart')
218
+ }
219
+ }
220
+
221
+ // Scatter Plots
222
+ export const Scatter_Plot_Negative_Trend: Story = {
223
+ render: () => <Chart configUrl="https://www.cdc.gov/cove/examples/scatter-plot-negative-trend.json" />,
224
+ play: async ({ canvasElement }) => {
225
+ await testChartRendering(canvasElement, 'Scatter Plot Negative Trend')
226
+ }
227
+ }
228
+
229
+ export const Scatter_Plot_Multi_Series: Story = {
230
+ render: () => <Chart configUrl="https://www.cdc.gov/cove/examples/scatter-plot-multi-series.json" />,
231
+ play: async ({ canvasElement }) => {
232
+ await testChartRendering(canvasElement, 'Scatter Plot Multi Series')
233
+ }
234
+ }
235
+
236
+ export const Scatter_Plot_Nonlinear_Trend: Story = {
237
+ render: () => <Chart configUrl="https://www.cdc.gov/cove/examples/scatter-plot-nonlinear-trend.json" />,
238
+ play: async ({ canvasElement }) => {
239
+ await testChartRendering(canvasElement, 'Scatter Plot Nonlinear Trend')
240
+ }
241
+ }
242
+
243
+ // Sparklines
244
+ export const Sparkline_Dashboard: Story = {
245
+ render: () => <Chart configUrl="https://www.cdc.gov/cove/examples/sparkline-dash.json" />,
246
+ play: async ({ canvasElement }) => {
247
+ await testChartRendering(canvasElement, 'Sparkline Dashboard')
248
+ }
249
+ }
250
+
251
+ export const Sparkline_2016_Outreach_Var2: Story = {
252
+ render: () => <Chart configUrl="https://www.cdc.gov/cove/examples/2016-outreach-2.json" />,
253
+ play: async ({ canvasElement }) => {
254
+ await testChartRendering(canvasElement, 'Sparkline 2016 Outreach Var2')
255
+ }
256
+ }
257
+
258
+ export const Sparkline_2016_Outreach_Var3: Story = {
259
+ render: () => <Chart configUrl="https://www.cdc.gov/cove/examples/2016-outreach-3.json" />,
260
+ play: async ({ canvasElement }) => {
261
+ await testChartRendering(canvasElement, 'Sparkline 2016 Outreach Var3')
262
+ }
263
+ }
264
+
265
+ export const Sparkline_2016_Outreach_Var4: Story = {
266
+ render: () => <Chart configUrl="https://www.cdc.gov/cove/examples/2016-outreach-4.json" />,
267
+ play: async ({ canvasElement }) => {
268
+ await testChartRendering(canvasElement, 'Sparkline 2016 Outreach Var4')
269
+ }
270
+ }
271
+
272
+ // Stacked Area Charts
273
+ export const Stacked_Area_Chart: Story = {
274
+ render: () => <Chart configUrl="https://www.cdc.gov/cove/examples/example-stacked-area-chart.json" />,
275
+ play: async ({ canvasElement }) => {
276
+ await testChartRendering(canvasElement, 'Stacked Area Chart')
277
+ }
278
+ }
279
+
280
+ export const Area_Chart_With_Annotations: Story = {
281
+ render: () => <Chart configUrl="https://www.cdc.gov/cove/examples/area-chart-with-annotations_1.json" />,
282
+ play: async ({ canvasElement }) => {
283
+ await testChartRendering(canvasElement, 'Area Chart With Annotations')
284
+ }
285
+ }
286
+
287
+ export const Area_Chart_With_Categorical_Axis: Story = {
288
+ render: () => <Chart configUrl="https://www.cdc.gov/cove/examples/example-area-chart-with-cat-axis.json" />,
289
+ play: async ({ canvasElement }) => {
290
+ await testChartRendering(canvasElement, 'Area Chart With Categorical Axis')
291
+ }
292
+ }
293
+
294
+ // Stacked Bar Charts
295
+ export const Stacked_Horizontal_Bar_Chart: Story = {
296
+ render: () => <Chart configUrl="https://www.cdc.gov/cove/examples/example-stacked-horizontal-chart.json" />,
297
+ play: async ({ canvasElement }) => {
298
+ await testChartRendering(canvasElement, 'Stacked Horizontal Bar Chart')
299
+ }
300
+ }
301
+
302
+ export const Stacked_Vertical_Bar_Chart: Story = {
303
+ render: () => <Chart configUrl="https://www.cdc.gov/cove/examples/Stacked_Bar_Viz.json" />,
304
+ play: async ({ canvasElement }) => {
305
+ await testChartRendering(canvasElement, 'Stacked Vertical Bar Chart')
306
+ }
307
+ }
@@ -0,0 +1,72 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite'
2
+ import { within, expect } from 'storybook/test'
3
+ import DataBite from '@cdc/data-bite'
4
+
5
+ // Fallback step function for test descriptions
6
+ const step = async (description: string, fn: () => Promise<void> | void) => {
7
+ console.log(`▶ ${description}`)
8
+ await fn()
9
+ console.log(`✓ ${description}`)
10
+ }
11
+
12
+ const meta: Meta = {
13
+ title: 'Regression Tests/Gallery/Data Bites',
14
+ parameters: {
15
+ layout: 'fullscreen',
16
+ docs: {
17
+ description: {
18
+ component: 'Data Bite visualization examples from the CDC COVE Gallery'
19
+ }
20
+ }
21
+ },
22
+ tags: ['autodocs']
23
+ }
24
+
25
+ export default meta
26
+
27
+ type Story = StoryObj<typeof DataBite>
28
+
29
+ // Helper function to test data bite rendering
30
+ const testDataBiteRendering = async (canvasElement: HTMLElement, storyName: string) => {
31
+ const canvas = within(canvasElement)
32
+
33
+ await step('Wait for data bite to render', async () => {
34
+ const dataBiteElement = await canvas.findByRole('img', { hidden: true }, { timeout: 10000 })
35
+ expect(dataBiteElement).toBeInTheDocument()
36
+ })
37
+
38
+ await step('Verify COVE module wrapper is present', async () => {
39
+ const coveModule = canvasElement.querySelector('.cdc-open-viz-module')
40
+ expect(coveModule).toBeInTheDocument()
41
+ })
42
+
43
+ console.log(` ${storyName} data bite rendered successfully`)
44
+ }
45
+
46
+ export const Data_Bite_Circle_Average: Story = {
47
+ render: () => <DataBite configUrl="https://www.cdc.gov/wcms/4.0/cdc-wp/data-presentation/examples/Data_Bite_Circle_Average.json" />,
48
+ play: async ({ canvasElement }) => {
49
+ await testDataBiteRendering(canvasElement, 'Data Bite Circle Average')
50
+ }
51
+ }
52
+
53
+ export const Data_Bite_Text_Max_Pic: Story = {
54
+ render: () => <DataBite configUrl="https://www.cdc.gov/wcms/4.0/cdc-wp/data-presentation/examples/Data_Bite_Text_Max_Pic.json" />,
55
+ play: async ({ canvasElement }) => {
56
+ await testDataBiteRendering(canvasElement, 'Data Bite Text Max Pic')
57
+ }
58
+ }
59
+
60
+ export const Data_Bite_Circle_Sum: Story = {
61
+ render: () => <DataBite configUrl="https://www.cdc.gov/wcms/4.0/cdc-wp/data-presentation/examples/Data_Bite_Circle_Sum.json" />,
62
+ play: async ({ canvasElement }) => {
63
+ await testDataBiteRendering(canvasElement, 'Data Bite Circle Sum')
64
+ }
65
+ }
66
+
67
+ export const Data_Bite_Text_Average_Pic: Story = {
68
+ render: () => <DataBite configUrl="https://www.cdc.gov/wcms/4.0/cdc-wp/data-presentation/examples/Data_Bite_Text_Average_Pic.json" />,
69
+ play: async ({ canvasElement }) => {
70
+ await testDataBiteRendering(canvasElement, 'Data Bite Text Average Pic')
71
+ }
72
+ }
@@ -0,0 +1,230 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite'
2
+ import { within, expect } from 'storybook/test'
3
+ import CdcMap from '@cdc/map'
4
+
5
+ // Fallback step function for test descriptions
6
+ const step = async (description: string, fn: () => Promise<void> | void) => {
7
+ console.log(`▶ ${description}`)
8
+ await fn()
9
+ console.log(`✓ ${description}`)
10
+ }
11
+
12
+ const meta: Meta = {
13
+ title: 'Regression Tests/Gallery/Maps',
14
+ parameters: {
15
+ layout: 'fullscreen',
16
+ docs: {
17
+ description: {
18
+ component: 'Map visualization examples from the CDC COVE Gallery'
19
+ }
20
+ }
21
+ },
22
+ tags: ['autodocs']
23
+ }
24
+
25
+ export default meta
26
+
27
+ type Story = StoryObj<typeof CdcMap>
28
+
29
+ // Helper function to test map rendering
30
+ const testMapRendering = async (canvasElement: HTMLElement, storyName: string) => {
31
+ const canvas = within(canvasElement)
32
+
33
+ await step('Wait for map to render', async () => {
34
+ const mapElement = await canvas.findByRole('img', { hidden: true }, { timeout: 10000 })
35
+ expect(mapElement).toBeInTheDocument()
36
+ })
37
+
38
+ await step('Verify SVG element is present', async () => {
39
+ const svgElement = canvasElement.querySelector('svg')
40
+ expect(svgElement).toBeInTheDocument()
41
+ })
42
+
43
+ await step('Verify COVE module wrapper is present', async () => {
44
+ const coveModule = canvasElement.querySelector('.cdc-open-viz-module')
45
+ expect(coveModule).toBeInTheDocument()
46
+ })
47
+
48
+ console.log(` ${storyName} map rendered successfully`)
49
+ }
50
+
51
+ // Bubble Maps
52
+ export const Bubble_Map_World: Story = {
53
+ render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/example-Bubble-Map-world.json" />,
54
+ play: async ({ canvasElement }) => {
55
+ await testMapRendering(canvasElement, 'Bubble Map World')
56
+ }
57
+ }
58
+
59
+ export const Bubble_Map_US: Story = {
60
+ render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/Example-Bubble-US-Data-Map.json" />,
61
+ play: async ({ canvasElement }) => {
62
+ await testMapRendering(canvasElement, 'Bubble Map US')
63
+ }
64
+ }
65
+
66
+ // Categorical Maps
67
+ 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" />,
69
+ play: async ({ canvasElement }) => {
70
+ await testMapRendering(canvasElement, 'Categorical Map With Special Classes')
71
+ }
72
+ }
73
+
74
+ export const Qualitative_Categorical_Map: Story = {
75
+ render: () => <CdcMap configUrl="https://www.cdc.gov/cove/data-files/qualitative-map.json" />,
76
+ play: async ({ canvasElement }) => {
77
+ await testMapRendering(canvasElement, 'Qualitative Categorical Map')
78
+ }
79
+ }
80
+
81
+ // Custom Layer Map
82
+ export const Custom_Layer_Map: Story = {
83
+ render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/custom-layer-map.json" />,
84
+ play: async ({ canvasElement }) => {
85
+ await testMapRendering(canvasElement, 'Custom Layer Map')
86
+ }
87
+ }
88
+
89
+ // Filterable Data Maps
90
+ export const Map_Multiple_Filters: Story = {
91
+ render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/map-multiple-filters.json" />,
92
+ play: async ({ canvasElement }) => {
93
+ await testMapRendering(canvasElement, 'Map Multiple Filters')
94
+ }
95
+ }
96
+
97
+ export const Map_Tab_Filters: Story = {
98
+ render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/map-tab-filters.json" />,
99
+ play: async ({ canvasElement }) => {
100
+ await testMapRendering(canvasElement, 'Map Tab Filters')
101
+ }
102
+ }
103
+
104
+ // Geocode Map
105
+ export const US_Geocode_Map: Story = {
106
+ render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/example-u-s-geo-code-dat.json" />,
107
+ play: async ({ canvasElement }) => {
108
+ await testMapRendering(canvasElement, 'US Geocode Map')
109
+ }
110
+ }
111
+
112
+ // HHS Region Map
113
+ export const HHS_Regions_Map: Story = {
114
+ render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/example-hhs-regions-data.json" />,
115
+ play: async ({ canvasElement }) => {
116
+ await testMapRendering(canvasElement, 'HHS Regions Map')
117
+ }
118
+ }
119
+
120
+ // Hex Maps
121
+ export const Standard_Hex_Map: Story = {
122
+ render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/Hex_Map.json" />,
123
+ play: async ({ canvasElement }) => {
124
+ await testMapRendering(canvasElement, 'Standard Hex Map')
125
+ }
126
+ }
127
+
128
+ export const Hex_Map_With_Filter: Story = {
129
+ render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/example-hex-map-with-filter.json" />,
130
+ play: async ({ canvasElement }) => {
131
+ await testMapRendering(canvasElement, 'Hex Map With Filter')
132
+ }
133
+ }
134
+
135
+ export const Hex_Map_With_Arrows: Story = {
136
+ render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/Hex_Map_Arrows.json" />,
137
+ play: async ({ canvasElement }) => {
138
+ await testMapRendering(canvasElement, 'Hex Map With Arrows')
139
+ }
140
+ }
141
+
142
+ // Map with Cities
143
+ export const US_Map_With_Cities: Story = {
144
+ render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/city-data-map-example.json" />,
145
+ play: async ({ canvasElement }) => {
146
+ await testMapRendering(canvasElement, 'US Map With Cities')
147
+ }
148
+ }
149
+
150
+ // Navigation-Only Maps
151
+ export const US_Navigation_Map: Story = {
152
+ render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/us-nav-map.json" />,
153
+ play: async ({ canvasElement }) => {
154
+ await testMapRendering(canvasElement, 'US Navigation Map')
155
+ }
156
+ }
157
+
158
+ export const World_Navigation_Map: Story = {
159
+ render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/world-nav-map-example.json" />,
160
+ play: async ({ canvasElement }) => {
161
+ await testMapRendering(canvasElement, 'World Navigation Map')
162
+ }
163
+ }
164
+
165
+ // Numeric Maps
166
+ export const Equal_Interval_Map: Story = {
167
+ render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/equal-interval-map.json" />,
168
+ play: async ({ canvasElement }) => {
169
+ await testMapRendering(canvasElement, 'Equal Interval Map')
170
+ }
171
+ }
172
+
173
+ export const Equal_Number_Map: Story = {
174
+ render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/equal-number-map.json" />,
175
+ play: async ({ canvasElement }) => {
176
+ await testMapRendering(canvasElement, 'Equal Number Map')
177
+ }
178
+ }
179
+
180
+ export const Equal_Number_Map_New_Quantile: Story = {
181
+ render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/equal-number-map_new_quantile.json" />,
182
+ play: async ({ canvasElement }) => {
183
+ await testMapRendering(canvasElement, 'Equal Number Map New Quantile')
184
+ }
185
+ }
186
+
187
+ // Single State Maps
188
+ export const Single_State_Map_Counties: Story = {
189
+ render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/example-data-map-counties.json" />,
190
+ play: async ({ canvasElement }) => {
191
+ await testMapRendering(canvasElement, 'Single State Map Counties')
192
+ }
193
+ }
194
+
195
+ export const Single_State_With_Census_Toggle: Story = {
196
+ render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/single-state-map-with-census-toggle.json" />,
197
+ play: async ({ canvasElement }) => {
198
+ await testMapRendering(canvasElement, 'Single State With Census Toggle')
199
+ }
200
+ }
201
+
202
+ 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" />,
204
+ play: async ({ canvasElement }) => {
205
+ await testMapRendering(canvasElement, 'Single State Filter With Zoom')
206
+ }
207
+ }
208
+
209
+ 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" />,
211
+ play: async ({ canvasElement }) => {
212
+ await testMapRendering(canvasElement, 'Multi State County Map')
213
+ }
214
+ }
215
+
216
+ // US County Map
217
+ export const US_County_Level_Map: Story = {
218
+ render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/US-County-Level-Map.json" />,
219
+ play: async ({ canvasElement }) => {
220
+ await testMapRendering(canvasElement, 'US County Level Map')
221
+ }
222
+ }
223
+
224
+ // World Map
225
+ export const World_Data_Map: Story = {
226
+ render: () => <CdcMap configUrl="https://www.cdc.gov/cove/examples/world-data-map-example.json" />,
227
+ play: async ({ canvasElement }) => {
228
+ await testMapRendering(canvasElement, 'World Data Map')
229
+ }
230
+ }