@cdc/core 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.
Files changed (134) 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/_stories/StoryRenderingTests.stories.tsx +164 -0
  17. package/assets/icon-magnifying-glass.svg +5 -0
  18. package/assets/icon-warming-stripes.svg +13 -0
  19. package/components/AdvancedEditor/AdvancedEditor.tsx +7 -1
  20. package/components/AdvancedEditor/EmbedEditor.tsx +281 -0
  21. package/components/ComboBox/ComboBox.tsx +345 -0
  22. package/components/ComboBox/combobox.styles.css +185 -0
  23. package/components/ComboBox/index.ts +1 -0
  24. package/components/CustomColorsEditor/CustomColorsEditor.css +299 -0
  25. package/components/CustomColorsEditor/CustomColorsEditor.tsx +209 -0
  26. package/components/CustomColorsEditor/index.ts +1 -0
  27. package/components/DataTable/DataTable.tsx +132 -58
  28. package/components/DataTable/DataTableStandAlone.tsx +8 -3
  29. package/components/DataTable/components/DataTableEditorPanel.tsx +12 -2
  30. package/components/DataTable/data-table.css +217 -210
  31. package/components/DataTable/helpers/mapCellMatrix.tsx +28 -9
  32. package/components/DataTable/helpers/standardizeState.js +2 -2
  33. package/components/DataTable/helpers/tests/standardizeState.test.js +54 -0
  34. package/components/EditorPanel/ColumnsEditor.tsx +37 -19
  35. package/components/EditorPanel/DataTableEditor.tsx +54 -28
  36. package/components/EditorPanel/EditorPanel.styles.css +439 -0
  37. package/components/EditorPanel/EditorPanel.tsx +144 -0
  38. package/components/EditorPanel/EditorPanelDispatch.tsx +75 -0
  39. package/components/EditorPanel/FieldSetWrapper.tsx +66 -23
  40. package/components/EditorPanel/FootnotesEditor.tsx +44 -37
  41. package/components/EditorPanel/Inputs.tsx +44 -8
  42. package/components/EditorPanel/VizFilterEditor/NestedDropdownEditor.tsx +35 -62
  43. package/components/EditorPanel/VizFilterEditor/VizFilterEditor.tsx +246 -175
  44. package/components/EditorPanel/components/MarkupVariablesEditor.tsx +61 -22
  45. package/components/EditorPanel/sections/VisualSection.tsx +169 -0
  46. package/components/Filters/Filters.tsx +57 -10
  47. package/components/Filters/components/Dropdown.tsx +6 -1
  48. package/components/Filters/helpers/getNestedOptions.ts +2 -1
  49. package/components/Filters/helpers/handleSorting.ts +1 -1
  50. package/components/Footnotes/Footnotes.tsx +35 -25
  51. package/components/Footnotes/FootnotesStandAlone.tsx +42 -6
  52. package/components/HeaderThemeSelector/HeaderThemeSelector.css +43 -0
  53. package/components/HeaderThemeSelector/HeaderThemeSelector.stories.tsx +74 -0
  54. package/components/HeaderThemeSelector/HeaderThemeSelector.tsx +61 -0
  55. package/components/HeaderThemeSelector/index.ts +2 -0
  56. package/components/Layout/components/Sidebar/components/sidebar.styles.scss +82 -0
  57. package/components/Layout/components/Visualization/index.tsx +16 -1
  58. package/components/Layout/components/Visualization/visualizations.scss +7 -0
  59. package/components/Layout/styles/editor.scss +2 -1
  60. package/components/Legend/Legend.Gradient.tsx +1 -1
  61. package/components/Loader/Loader.tsx +1 -1
  62. package/components/MediaControls.tsx +63 -34
  63. package/components/PaletteConversionModal.tsx +7 -4
  64. package/components/PaletteSelector/PaletteSelector.css +49 -6
  65. package/components/Table/components/Cell.tsx +23 -2
  66. package/components/Table/components/Row.tsx +5 -3
  67. package/components/_stories/Filters.stories.tsx +20 -1
  68. package/components/_stories/Footnotes.CSV.stories.tsx +247 -0
  69. package/components/_stories/Footnotes.stories.tsx +768 -3
  70. package/components/_stories/Inputs.stories.tsx +2 -2
  71. package/components/_stories/styles.scss +0 -1
  72. package/components/ui/Accordion.jsx +1 -1
  73. package/components/ui/Icon.tsx +3 -1
  74. package/components/ui/Title/index.tsx +30 -2
  75. package/components/ui/Title/title.styles.css +42 -0
  76. package/components/ui/accordion.styles.css +57 -0
  77. package/data/chartColorPalettes.ts +1 -1
  78. package/dist/cove-main.css +75 -6
  79. package/dist/cove-main.css.map +1 -1
  80. package/generateViteConfig.js +8 -1
  81. package/helpers/addValuesToFilters.ts +11 -1
  82. package/helpers/constants.ts +37 -0
  83. package/helpers/cove/number.ts +33 -12
  84. package/helpers/coveUpdateWorker.ts +20 -11
  85. package/helpers/embedCodeGenerator.ts +109 -0
  86. package/helpers/fetchRemoteData.ts +3 -15
  87. package/helpers/getUniqueValues.ts +19 -0
  88. package/helpers/hashObj.ts +25 -0
  89. package/helpers/isRightAlignedTableValue.js +5 -0
  90. package/helpers/markupProcessor.ts +27 -12
  91. package/helpers/mergeCustomOrderValues.ts +37 -0
  92. package/helpers/metrics/helpers.ts +1 -0
  93. package/helpers/parseCsvWithQuotes.ts +65 -0
  94. package/helpers/pivotData.ts +2 -2
  95. package/helpers/prepareScreenshot.ts +268 -0
  96. package/helpers/queryStringUtils.ts +29 -0
  97. package/helpers/testing.ts +17 -4
  98. package/helpers/tests/prepareScreenshot.test.ts +414 -0
  99. package/helpers/tests/queryStringUtils.test.ts +381 -0
  100. package/helpers/tests/testStandaloneBuild.ts +23 -5
  101. package/helpers/useDataVizClasses.ts +0 -1
  102. package/helpers/ver/4.25.11.ts +13 -0
  103. package/helpers/ver/4.26.1.ts +80 -0
  104. package/helpers/viewports.ts +2 -0
  105. package/hooks/useDataColumns.ts +63 -0
  106. package/hooks/useFilterManagement.ts +94 -0
  107. package/hooks/useLegendSeparators.ts +26 -0
  108. package/hooks/useListManagement.ts +192 -0
  109. package/package.json +6 -4
  110. package/styles/_button-section.scss +0 -3
  111. package/styles/_common-components.css +73 -0
  112. package/styles/_global.scss +25 -5
  113. package/styles/base.scss +0 -50
  114. package/styles/cove-main.scss +3 -1
  115. package/styles/filters.scss +10 -3
  116. package/styles/v2/base/index.scss +0 -1
  117. package/styles/v2/components/editor.scss +14 -6
  118. package/styles/v2/utils/_breakpoints.scss +1 -1
  119. package/styles/v2/utils/index.scss +0 -1
  120. package/styles/waiting.scss +1 -1
  121. package/types/Axis.ts +1 -0
  122. package/types/ForecastingSeriesKey.ts +1 -0
  123. package/types/MarkupInclude.ts +5 -3
  124. package/types/MarkupVariable.ts +1 -1
  125. package/types/Series.ts +3 -0
  126. package/types/Table.ts +1 -0
  127. package/types/Visualization.ts +1 -0
  128. package/types/VizFilter.ts +2 -0
  129. package/LICENSE +0 -201
  130. package/styles/_mixins.scss +0 -13
  131. package/styles/_typography.scss +0 -0
  132. package/styles/v2/base/_typography.scss +0 -0
  133. package/styles/v2/components/guidance-block.scss +0 -74
  134. package/styles/v2/utils/_functions.scss +0 -0
@@ -1,17 +1,782 @@
1
1
  import { Meta, StoryObj } from '@storybook/react-vite'
2
2
  import Footnotes from '../Footnotes'
3
+ import FootnotesStandAlone from '../Footnotes/FootnotesStandAlone'
4
+ import Chart from '@cdc/chart'
5
+ import CdcMap from '@cdc/map'
3
6
 
4
7
  const meta: Meta<typeof Footnotes> = {
5
8
  title: 'Components/Organisms/Footnotes',
6
- component: Footnotes
9
+ component: Footnotes,
10
+ parameters: {
11
+ docs: {
12
+ description: {
13
+ component: 'Renders footnotes with support for symbols, HTML tags, and newlines. See "CSV Features" stories for dynamic footnotes from CSV data.'
14
+ }
15
+ }
16
+ }
7
17
  }
8
18
 
9
19
  export default meta
10
20
 
11
- type Story = StoryObj<typeof Footnotes>
21
+ type Story = StoryObj<typeof FootnotesStandAlone>
12
22
 
13
23
  export const Primary: Story = {
24
+ render: args => <FootnotesStandAlone {...args} />,
25
+ args: {
26
+ config: {
27
+ staticFootnotes: [
28
+ { symbol: '*', text: 'This is a footnote' },
29
+ { symbol: '†', text: 'This is another footnote' },
30
+ { text: 'This is a third footnote' }
31
+ ]
32
+ },
33
+ data: [],
34
+ markupVariables: [],
35
+ enableMarkupVariables: false,
36
+ filters: []
37
+ }
38
+ }
39
+
40
+ export const WithHTMLTags: Story = {
41
+ render: args => <FootnotesStandAlone {...args} />,
42
+ args: {
43
+ config: {
44
+ staticFootnotes: [
45
+ { symbol: '*', text: 'This footnote has a <br> tag for line break' },
46
+ { symbol: '†', text: 'This has <strong>bold text</strong> and <em>italic text</em>' },
47
+ { symbol: '**', text: 'Multiple tags: <strong>bold</strong>, <em>italic</em>, and <br>line break' }
48
+ ]
49
+ },
50
+ data: [],
51
+ markupVariables: [],
52
+ enableMarkupVariables: false,
53
+ filters: []
54
+ }
55
+ }
56
+
57
+ export const WithNewlines: Story = {
58
+ render: args => <FootnotesStandAlone {...args} />,
59
+ args: {
60
+ config: {
61
+ staticFootnotes: [
62
+ { symbol: '*', text: 'This footnote has a newline\nbetween these two lines' },
63
+ { symbol: '†', text: 'This footnote has multiple\nnewlines\ncreating three lines' },
64
+ { symbol: '**', text: 'This footnote has a newline\nand continues on the next line' }
65
+ ]
66
+ },
67
+ data: [],
68
+ markupVariables: [],
69
+ enableMarkupVariables: false,
70
+ filters: []
71
+ }
72
+ }
73
+
74
+ export const WithNewlinesAndHTML: Story = {
75
+ render: args => <FootnotesStandAlone {...args} />,
14
76
  args: {
15
- footnotes: [{ symbol: '*', text: 'This is a footnote' }, { symbol: '†', text: 'This is another footnote' }, { text: 'This is a third footnote' }]
77
+ config: {
78
+ staticFootnotes: [
79
+ { symbol: '*', text: 'Line 1\nLine 2 with <strong>bold</strong> text' },
80
+ { symbol: '†', text: 'First line\nSecond line with <em>italic</em>\nThird line with <br>HTML tag' },
81
+ { symbol: '**', text: 'Start\nMiddle with <strong>bold</strong>\nEnd' }
82
+ ]
83
+ },
84
+ data: [],
85
+ markupVariables: [],
86
+ enableMarkupVariables: false,
87
+ filters: []
16
88
  }
17
89
  }
90
+
91
+ // Chart example with footnotes editor
92
+ type ChartStory = StoryObj<typeof Chart>
93
+
94
+ export const ChartWithFootnotes: ChartStory = {
95
+ name: 'Chart with Footnotes Editor',
96
+ render: (args: any) => <Chart {...args} />,
97
+ args: {
98
+ config: {
99
+ type: 'chart',
100
+ visualizationType: 'Bar',
101
+ title: 'Planets in Our Solar System',
102
+ showTitle: true,
103
+ theme: 'theme-blue',
104
+ fontSize: 'medium',
105
+ orientation: 'vertical',
106
+ xAxis: {
107
+ dataKey: 'Planet',
108
+ label: 'Planet',
109
+ type: 'categorical'
110
+ },
111
+ yAxis: {
112
+ dataKey: 'Diameter',
113
+ label: 'Diameter (km)',
114
+ type: 'linear'
115
+ },
116
+ series: [
117
+ {
118
+ dataKey: 'Diameter',
119
+ type: 'Bar',
120
+ name: 'Diameter'
121
+ }
122
+ ],
123
+ data: [
124
+ { Planet: 'Mercury', Diameter: 4879, Type: 'Terrestrial', Year: 2023, HasRings: 'No' },
125
+ { Planet: 'Venus', Diameter: 12104, Type: 'Terrestrial', Year: 2023, HasRings: 'No' },
126
+ { Planet: 'Earth', Diameter: 12742, Type: 'Terrestrial', Year: 2023, HasRings: 'No' },
127
+ { Planet: 'Mars', Diameter: 6779, Type: 'Terrestrial', Year: 2023, HasRings: 'No' },
128
+ { Planet: 'Jupiter', Diameter: 139820, Type: 'Gas Giant', Year: 2024, HasRings: 'Yes' },
129
+ { Planet: 'Saturn', Diameter: 116460, Type: 'Gas Giant', Year: 2024, HasRings: 'Yes' },
130
+ { Planet: 'Uranus', Diameter: 50724, Type: 'Ice Giant', Year: 2024, HasRings: 'Yes' },
131
+ { Planet: 'Neptune', Diameter: 49244, Type: 'Ice Giant', Year: 2024, HasRings: 'Yes' }
132
+ ],
133
+ filters: [
134
+ {
135
+ columnName: 'Year',
136
+ label: 'Data Year',
137
+ active: true,
138
+ values: [2023, 2024],
139
+ setBy: 'url',
140
+ filterBy: [2023],
141
+ filterFootnotes: true
142
+ }
143
+ ],
144
+ enableMarkupVariables: true,
145
+ markupVariables: [
146
+ {
147
+ name: 'planet_types',
148
+ columnName: 'Type',
149
+ tag: '{{planet_types}}',
150
+ conditions: [],
151
+ addCommas: false
152
+ },
153
+ {
154
+ name: 'terrestrial_planets',
155
+ columnName: 'Planet',
156
+ tag: '{{terrestrial_planets}}',
157
+ conditions: [
158
+ {
159
+ columnName: 'Type',
160
+ isOrIsNotEqualTo: 'is',
161
+ value: 'Terrestrial'
162
+ }
163
+ ],
164
+ addCommas: false
165
+ },
166
+ {
167
+ name: 'planets_with_rings',
168
+ columnName: 'Planet',
169
+ tag: '{{planets_with_rings}}',
170
+ conditions: [
171
+ {
172
+ columnName: 'HasRings',
173
+ isOrIsNotEqualTo: 'is',
174
+ value: 'Yes'
175
+ }
176
+ ],
177
+ addCommas: false
178
+ },
179
+ {
180
+ name: 'data_year',
181
+ columnName: 'Year',
182
+ tag: '{{data_year}}',
183
+ conditions: [],
184
+ addCommas: false
185
+ }
186
+ ],
187
+ footnotes: {
188
+ staticFootnotes: [
189
+ { symbol: '*', text: 'Planet types shown: {{planet_types}}' },
190
+ { symbol: '†', text: 'Terrestrial planets: {{terrestrial_planets}}' },
191
+ { text: 'Planets with rings: {{planets_with_rings}}. Data year: {{data_year}}' }
192
+ ]
193
+ }
194
+ },
195
+ isEditor: true
196
+ }
197
+ }
198
+
199
+ // Map example with footnotes editor
200
+ type MapStory = StoryObj<typeof CdcMap>
201
+
202
+ export const MapWithFootnotes: MapStory = {
203
+ name: 'Map with Footnotes Editor',
204
+ render: (args: any) => <CdcMap {...args} />,
205
+ args: {
206
+ config: {
207
+ "annotations": [],
208
+ "general": {
209
+ "navigationTarget": "_self",
210
+ "noDataMessage": "No State Selected",
211
+ "annotationDropdownText": "Annotations",
212
+ "geoBorderColor": "darkGray",
213
+ "headerColor": "theme-blue",
214
+ "title": "",
215
+ "showTitle": true,
216
+ "showSidebar": true,
217
+ "showDownloadMediaButton": false,
218
+ "displayAsHex": false,
219
+ "displayStateLabels": false,
220
+ "territoriesAlwaysShow": false,
221
+ "language": "en",
222
+ "geoType": "us",
223
+ "geoLabelOverride": "",
224
+ "hasRegions": false,
225
+ "fullBorder": false,
226
+ "type": "data",
227
+ "convertFipsCodes": true,
228
+ "palette": {
229
+ "isReversed": true,
230
+ "name": "sequential_bluereverse",
231
+ "version": "2.0"
232
+ },
233
+ "allowMapZoom": true,
234
+ "hideGeoColumnInTooltip": false,
235
+ "hidePrimaryColumnInTooltip": false,
236
+ "statesPicked": [],
237
+ "expandDataTable": false
238
+ },
239
+ "type": "map",
240
+ "columns": {
241
+ "geo": {
242
+ "name": "State",
243
+ "label": "Location",
244
+ "tooltip": false,
245
+ "dataTable": true
246
+ },
247
+ "primary": {
248
+ "dataTable": true,
249
+ "tooltip": true,
250
+ "prefix": "",
251
+ "suffix": "%",
252
+ "name": "Coverage",
253
+ "label": "Coverage Rate (%)",
254
+ "roundToPlace": 0
255
+ },
256
+ "navigate": {
257
+ "name": "State",
258
+ "tooltip": false,
259
+ "dataTable": false
260
+ },
261
+ "latitude": {
262
+ "name": ""
263
+ },
264
+ "longitude": {
265
+ "name": ""
266
+ }
267
+ },
268
+ "legend": {
269
+ "descriptions": {
270
+ "High": "Coverage ≥ 80%",
271
+ "Medium": "Coverage 60-79%",
272
+ "Low": "Coverage < 60%"
273
+ },
274
+ "specialClasses": [],
275
+ "unified": false,
276
+ "singleColumn": false,
277
+ "singleRow": false,
278
+ "verticalSorted": false,
279
+ "showSpecialClassesLast": false,
280
+ "dynamicDescription": false,
281
+ "type": "equalnumber",
282
+ "numberOfItems": 3,
283
+ "position": "side",
284
+ "title": "",
285
+ "style": "circles",
286
+ "subStyle": "linear blocks",
287
+ "tickRotation": "",
288
+ "singleColumnLegend": false,
289
+ "hideBorder": false,
290
+ "groupBy": "",
291
+ "hide": false
292
+ },
293
+ "filters": [
294
+ {
295
+ "columnName": "Year",
296
+ "label": "Reporting Year",
297
+ "active": 2023,
298
+ "values": [
299
+ 2023,
300
+ 2024
301
+ ],
302
+ "setBy": "url",
303
+ "filterBy": [
304
+ 2023
305
+ ],
306
+ "filterFootnotes": true,
307
+ "id": 1762985265975,
308
+ "filterStyle": "dropdown"
309
+ }
310
+ ],
311
+ "table": {
312
+ "wrapColumns": false,
313
+ "label": "Data Table",
314
+ "expanded": false,
315
+ "limitHeight": false,
316
+ "height": "",
317
+ "caption": "",
318
+ "showDownloadUrl": false,
319
+ "showDataTableLink": true,
320
+ "showDownloadLinkBelow": true,
321
+ "showFullGeoNameInCSV": false,
322
+ "forceDisplay": true,
323
+ "download": true,
324
+ "indexLabel": "",
325
+ "cellMinWidth": "0",
326
+ "collapsible": true
327
+ },
328
+ "tooltips": {
329
+ "appearanceType": "hover",
330
+ "linkLabel": "Learn More",
331
+ "opacity": 90
332
+ },
333
+ "runtime": {
334
+ "editorErrorMessage": []
335
+ },
336
+ "visual": {
337
+ "minBubbleSize": 1,
338
+ "maxBubbleSize": 20,
339
+ "extraBubbleBorder": false,
340
+ "cityStyle": "circle",
341
+ "cityStyleLabel": "",
342
+ "showBubbleZeros": false,
343
+ "additionalCityStyles": [],
344
+ "geoCodeCircleSize": 8
345
+ },
346
+ "mapPosition": {
347
+ "coordinates": [
348
+ 0,
349
+ 30
350
+ ],
351
+ "zoom": 1
352
+ },
353
+ "map": {
354
+ "layers": [],
355
+ "patterns": []
356
+ },
357
+ "hexMap": {
358
+ "type": "",
359
+ "shapeGroups": [
360
+ {
361
+ "legendTitle": "",
362
+ "legendDescription": "",
363
+ "items": [
364
+ {
365
+ "key": "",
366
+ "shape": "Arrow Up",
367
+ "column": "",
368
+ "operator": "=",
369
+ "value": ""
370
+ }
371
+ ]
372
+ }
373
+ ]
374
+ },
375
+ "filterBehavior": "Filter Change",
376
+ "filterIntro": "",
377
+ "smallMultiples": {
378
+ "mode": "",
379
+ "tileColumn": "",
380
+ "tilesPerRowDesktop": 3,
381
+ "tilesPerRowMobile": 1,
382
+ "tileOrderType": "asc",
383
+ "tileOrder": [],
384
+ "tileTitles": {}
385
+ },
386
+ "markupVariables": [
387
+ {
388
+ "name": "all_categories",
389
+ "columnName": "Category",
390
+ "tag": "{{all_categories}}",
391
+ "conditions": [],
392
+ "addCommas": false
393
+ },
394
+ {
395
+ "name": "high_coverage_states",
396
+ "columnName": "State",
397
+ "tag": "{{high_coverage_states}}",
398
+ "conditions": [
399
+ {
400
+ "columnName": "Category",
401
+ "isOrIsNotEqualTo": "is",
402
+ "value": "High"
403
+ }
404
+ ],
405
+ "addCommas": false
406
+ },
407
+ {
408
+ "name": "medium_coverage_states",
409
+ "columnName": "State",
410
+ "tag": "{{medium_coverage_states}}",
411
+ "conditions": [
412
+ {
413
+ "columnName": "Category",
414
+ "isOrIsNotEqualTo": "is",
415
+ "value": "Medium"
416
+ }
417
+ ],
418
+ "addCommas": false
419
+ },
420
+ {
421
+ "name": "reporting_years",
422
+ "columnName": "Year",
423
+ "tag": "{{reporting_years}}",
424
+ "conditions": [],
425
+ "addCommas": false
426
+ },
427
+ {
428
+ "name": "vaccine_program",
429
+ "columnName": "Program",
430
+ "tag": "{{vaccine_program}}",
431
+ "conditions": [],
432
+ "addCommas": false
433
+ }
434
+ ],
435
+ "enableMarkupVariables": true,
436
+ "title": "Vaccination Coverage Rate by State",
437
+ "showTitle": true,
438
+ "theme": "theme-blue",
439
+ "fontSize": "medium",
440
+ "dataClassification": {
441
+ "numberOfItems": 3,
442
+ "method": "equalnumber"
443
+ },
444
+ "footnotes": {
445
+ "staticFootnotes": [
446
+ {
447
+ "symbol": "*",
448
+ "text": "Coverage categories shown: {{all_categories}}. High coverage states: {{high_coverage_states}}"
449
+ },
450
+ {
451
+ "symbol": "†",
452
+ "text": "Reporting year(s): {{reporting_years}}"
453
+ },
454
+ {
455
+ "text": "Program: {{vaccine_program}}. Medium coverage states: {{medium_coverage_states}}"
456
+ }
457
+ ]
458
+ },
459
+ "version": "4.25.10",
460
+ "migrations": {
461
+ "addColorMigration": true
462
+ },
463
+ "data": [
464
+ {
465
+ "geo": "AL",
466
+ "State": "Alabama",
467
+ "Coverage": 72.5,
468
+ "Year": 2023,
469
+ "Category": "Medium",
470
+ "Program": "Flu Vaccine"
471
+ },
472
+ {
473
+ "geo": "AK",
474
+ "State": "Alaska",
475
+ "Coverage": 68.3,
476
+ "Year": 2023,
477
+ "Category": "Medium",
478
+ "Program": "Flu Vaccine"
479
+ },
480
+ {
481
+ "geo": "AZ",
482
+ "State": "Arizona",
483
+ "Coverage": 75.8,
484
+ "Year": 2023,
485
+ "Category": "Medium",
486
+ "Program": "Flu Vaccine"
487
+ },
488
+ {
489
+ "geo": "CA",
490
+ "State": "California",
491
+ "Coverage": 82.4,
492
+ "Year": 2023,
493
+ "Category": "High",
494
+ "Program": "Flu Vaccine"
495
+ },
496
+ {
497
+ "geo": "CO",
498
+ "State": "Colorado",
499
+ "Coverage": 79.1,
500
+ "Year": 2023,
501
+ "Category": "Medium",
502
+ "Program": "Flu Vaccine"
503
+ },
504
+ {
505
+ "geo": "CT",
506
+ "State": "Connecticut",
507
+ "Coverage": 85.6,
508
+ "Year": 2023,
509
+ "Category": "High",
510
+ "Program": "Flu Vaccine"
511
+ },
512
+ {
513
+ "geo": "FL",
514
+ "State": "Florida",
515
+ "Coverage": 74.2,
516
+ "Year": 2023,
517
+ "Category": "Medium",
518
+ "Program": "Flu Vaccine"
519
+ },
520
+ {
521
+ "geo": "GA",
522
+ "State": "Georgia",
523
+ "Coverage": 70.9,
524
+ "Year": 2023,
525
+ "Category": "Medium",
526
+ "Program": "Flu Vaccine"
527
+ },
528
+ {
529
+ "geo": "IL",
530
+ "State": "Illinois",
531
+ "Coverage": 77.5,
532
+ "Year": 2023,
533
+ "Category": "Medium",
534
+ "Program": "Flu Vaccine"
535
+ },
536
+ {
537
+ "geo": "MA",
538
+ "State": "Massachusetts",
539
+ "Coverage": 87.3,
540
+ "Year": 2023,
541
+ "Category": "High",
542
+ "Program": "Flu Vaccine"
543
+ },
544
+ {
545
+ "geo": "NY",
546
+ "State": "New York",
547
+ "Coverage": 81.2,
548
+ "Year": 2023,
549
+ "Category": "High",
550
+ "Program": "Flu Vaccine"
551
+ },
552
+ {
553
+ "geo": "TX",
554
+ "State": "Texas",
555
+ "Coverage": 69.8,
556
+ "Year": 2023,
557
+ "Category": "Medium",
558
+ "Program": "Flu Vaccine"
559
+ },
560
+ {
561
+ "geo": "WA",
562
+ "State": "Washington",
563
+ "Coverage": 80.5,
564
+ "Year": 2023,
565
+ "Category": "High",
566
+ "Program": "Flu Vaccine"
567
+ },
568
+ {
569
+ "geo": "AL",
570
+ "State": "Alabama",
571
+ "Coverage": 74.8,
572
+ "Year": 2024,
573
+ "Category": "Medium",
574
+ "Program": "Flu Vaccine"
575
+ },
576
+ {
577
+ "geo": "AK",
578
+ "State": "Alaska",
579
+ "Coverage": 70.1,
580
+ "Year": 2024,
581
+ "Category": "Medium",
582
+ "Program": "Flu Vaccine"
583
+ },
584
+ {
585
+ "geo": "AZ",
586
+ "State": "Arizona",
587
+ "Coverage": 78.2,
588
+ "Year": 2024,
589
+ "Category": "Medium",
590
+ "Program": "Flu Vaccine"
591
+ },
592
+ {
593
+ "geo": "CA",
594
+ "State": "California",
595
+ "Coverage": 84.1,
596
+ "Year": 2024,
597
+ "Category": "High",
598
+ "Program": "Flu Vaccine"
599
+ },
600
+ {
601
+ "geo": "CO",
602
+ "State": "Colorado",
603
+ "Coverage": 81.3,
604
+ "Year": 2024,
605
+ "Category": "High",
606
+ "Program": "Flu Vaccine"
607
+ },
608
+ {
609
+ "geo": "CT",
610
+ "State": "Connecticut",
611
+ "Coverage": 87.9,
612
+ "Year": 2024,
613
+ "Category": "High",
614
+ "Program": "Flu Vaccine"
615
+ },
616
+ {
617
+ "geo": "FL",
618
+ "State": "Florida",
619
+ "Coverage": 76.5,
620
+ "Year": 2024,
621
+ "Category": "Medium",
622
+ "Program": "Flu Vaccine"
623
+ },
624
+ {
625
+ "geo": "GA",
626
+ "State": "Georgia",
627
+ "Coverage": 73.2,
628
+ "Year": 2024,
629
+ "Category": "Medium",
630
+ "Program": "Flu Vaccine"
631
+ },
632
+ {
633
+ "geo": "IL",
634
+ "State": "Illinois",
635
+ "Coverage": 79.8,
636
+ "Year": 2024,
637
+ "Category": "Medium",
638
+ "Program": "Flu Vaccine"
639
+ },
640
+ {
641
+ "geo": "MA",
642
+ "State": "Massachusetts",
643
+ "Coverage": 88.6,
644
+ "Year": 2024,
645
+ "Category": "High",
646
+ "Program": "Flu Vaccine"
647
+ },
648
+ {
649
+ "geo": "NY",
650
+ "State": "New York",
651
+ "Coverage": 83.4,
652
+ "Year": 2024,
653
+ "Category": "High",
654
+ "Program": "Flu Vaccine"
655
+ },
656
+ {
657
+ "geo": "TX",
658
+ "State": "Texas",
659
+ "Coverage": 72.1,
660
+ "Year": 2024,
661
+ "Category": "Medium",
662
+ "Program": "Flu Vaccine"
663
+ },
664
+ {
665
+ "geo": "WA",
666
+ "State": "Washington",
667
+ "Coverage": 82.7,
668
+ "Year": 2024,
669
+ "Category": "High",
670
+ "Program": "Flu Vaccine"
671
+ }
672
+ ]
673
+ },
674
+ isEditor: true
675
+ }
676
+ }
677
+
678
+ // Story demonstrating markup variables in footnotes
679
+ type StandAloneStory = StoryObj<typeof FootnotesStandAlone>
680
+
681
+ export const WithMarkupVariables: StandAloneStory = {
682
+ name: 'With Markup Variables',
683
+ render: args => <FootnotesStandAlone {...args} />,
684
+ args: {
685
+ config: {
686
+ staticFootnotes: [
687
+ {
688
+ symbol: '*',
689
+ text: 'Data shown for {{state_name}} with values from {{year}}'
690
+ },
691
+ {
692
+ symbol: '†',
693
+ text: 'The highest value recorded was {{max_value}}'
694
+ },
695
+ {
696
+ text: 'Category A states: {{category_a_states}}'
697
+ }
698
+ ]
699
+ },
700
+ data: [
701
+ { state: 'Alabama', value: 100, year: 2023, category: 'A' },
702
+ { state: 'Alaska', value: 200, year: 2023, category: 'B' },
703
+ { state: 'Arizona', value: 150, year: 2023, category: 'A' },
704
+ { state: 'Arkansas', value: 175, year: 2023, category: 'A' }
705
+ ],
706
+ markupVariables: [
707
+ {
708
+ name: 'state_name',
709
+ columnName: 'state',
710
+ tag: '{{state_name}}',
711
+ conditions: [],
712
+ addCommas: false
713
+ },
714
+ {
715
+ name: 'year',
716
+ columnName: 'year',
717
+ tag: '{{year}}',
718
+ conditions: [],
719
+ addCommas: false
720
+ },
721
+ {
722
+ name: 'max_value',
723
+ columnName: 'value',
724
+ tag: '{{max_value}}',
725
+ conditions: [],
726
+ addCommas: true
727
+ },
728
+ {
729
+ name: 'category_a_states',
730
+ columnName: 'state',
731
+ tag: '{{category_a_states}}',
732
+ conditions: [
733
+ {
734
+ columnName: 'category',
735
+ isOrIsNotEqualTo: 'is',
736
+ value: 'A'
737
+ }
738
+ ],
739
+ addCommas: false
740
+ }
741
+ ],
742
+ enableMarkupVariables: true,
743
+ filters: []
744
+ }
745
+ }
746
+
747
+ export const WithMarkupVariablesDisabled: StandAloneStory = {
748
+ name: 'With Markup Variables Disabled',
749
+ render: args => <FootnotesStandAlone {...args} />,
750
+ args: {
751
+ config: {
752
+ staticFootnotes: [
753
+ {
754
+ symbol: '*',
755
+ text: 'Data shown for {{state_name}} with values from {{year}}'
756
+ }
757
+ ]
758
+ },
759
+ data: [
760
+ { state: 'Alabama', value: 100, year: 2023 },
761
+ { state: 'Alaska', value: 200, year: 2023 }
762
+ ],
763
+ markupVariables: [
764
+ {
765
+ name: 'state_name',
766
+ columnName: 'state',
767
+ tag: '{{state_name}}',
768
+ conditions: [],
769
+ addCommas: false
770
+ },
771
+ {
772
+ name: 'year',
773
+ columnName: 'year',
774
+ tag: '{{year}}',
775
+ conditions: [],
776
+ addCommas: false
777
+ }
778
+ ],
779
+ enableMarkupVariables: false,
780
+ filters: []
781
+ },
782
+ }