@cdc/dashboard 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.
- package/dist/{cdcdashboard-fce76882.es.js → cdcdashboard-BnB1QM5d.es.js} +6 -13
- package/dist/{cdcdashboard-c55ac1ea.es.js → cdcdashboard-D6CG2-Hb.es.js} +5 -12
- package/dist/{cdcdashboard-31a33da1.es.js → cdcdashboard-MXgURbdZ.es.js} +6 -13
- package/dist/{cdcdashboard-1a1724a1.es.js → cdcdashboard-dgT_1dIT.es.js} +136 -151
- package/dist/cdcdashboard.js +80040 -75976
- package/examples/api-test/categories.json +18 -0
- package/examples/api-test/chart-data.json +602 -0
- package/examples/api-test/topics.json +47 -0
- package/examples/api-test/years.json +22 -0
- package/examples/markup-axis-label.json +4167 -0
- package/examples/private/DEV-10538.json +407 -0
- package/examples/private/DEV-11405.json +39112 -0
- package/examples/private/big-dashboard.json +39112 -0
- package/examples/private/brfs-2.json +1532 -0
- package/examples/private/brfs.json +2128 -2138
- package/examples/private/clade-2.json +430 -0
- package/examples/private/delete.json +32919 -0
- package/examples/private/diabetes.json +5582 -0
- package/examples/private/example-2.json +49796 -0
- package/examples/private/group-legend-test.json +328 -0
- package/examples/private/map.json +1211 -0
- package/examples/private/markup-footer/burden_toolkit_mortality_diabetes_attributable_deaths_data.csv +14041 -0
- package/examples/private/markup-footer/burden_toolkit_mortality_diabetes_attributable_deaths_per_100000_data.csv +14041 -0
- package/examples/private/markup-footer/burden_toolkit_mortality_qaly_data.csv +18721 -0
- package/examples/private/markup-footer/burden_toolkit_mortality_yll_data.csv +18721 -0
- package/examples/private/markup-footer/mortality-deaths-footnotes-age.csv +3 -0
- package/examples/private/markup-variables.json +1451 -0
- package/examples/private/markup.json +5471 -0
- package/examples/private/mpox.json +38128 -0
- package/examples/private/north-dakota.json +1132 -0
- package/examples/private/ophdst.json +38754 -0
- package/examples/private/pedro.json +1 -0
- package/examples/private/pivot.json +683 -0
- package/examples/private/reset.json +32920 -0
- package/examples/private/sewershed.json +435 -0
- package/examples/private/tobacco.json +1938 -0
- package/examples/test-api-filter-reset.json +132 -0
- package/index.html +2 -2
- package/package.json +16 -10
- package/src/CdcDashboard.tsx +1 -3
- package/src/CdcDashboardComponent.tsx +34 -16
- package/src/DashboardContext.tsx +5 -1
- package/src/_stories/Dashboard.API.stories.tsx +62 -0
- package/src/_stories/Dashboard.stories.tsx +492 -472
- package/src/_stories/_mock/api/cessation.json +1 -0
- package/src/_stories/_mock/api/data-explorer.json +1 -0
- package/src/_stories/_mock/api/explore-by-location.json +1 -0
- package/src/_stories/_mock/api/explore-by-topic.json +1 -0
- package/src/_stories/_mock/api/legislation.json +1 -0
- package/src/_stories/_mock/api/oral-health-data.json +1 -0
- package/src/_stories/_mock/custom-order-new-values.json +116 -0
- package/src/components/CollapsibleVisualizationRow.tsx +1 -1
- package/src/components/DashboardFilters/DashboardFilters.tsx +34 -23
- package/src/components/DashboardFilters/DashboardFiltersEditor/DashboardFiltersEditor.tsx +29 -12
- package/src/components/DashboardFilters/DashboardFiltersEditor/components/FilterEditor.tsx +81 -112
- package/src/components/DashboardFilters/DashboardFiltersEditor/components/NestedDropDownDashboard.tsx +82 -52
- package/src/components/DashboardFilters/DashboardFiltersWrapper.tsx +130 -31
- package/src/components/DashboardFilters/_stories/DashboardFilters.stories.tsx +80 -21
- package/src/components/DataDesignerModal.tsx +227 -210
- package/src/components/Header/Header.tsx +13 -12
- package/src/components/Toggle/Toggle.tsx +48 -47
- package/src/components/VisualizationRow.tsx +13 -6
- package/src/components/VisualizationsPanel/VisualizationsPanel.tsx +2 -0
- package/src/components/Widget/Widget.tsx +47 -18
- package/src/helpers/addValuesToDashboardFilters.ts +111 -60
- package/src/helpers/apiFilterHelpers.ts +190 -166
- package/src/helpers/filterData.ts +52 -7
- package/src/helpers/filterResetHelpers.ts +102 -0
- package/src/helpers/formatConfigBeforeSave.ts +137 -0
- package/src/helpers/getVizConfig.ts +36 -18
- package/src/helpers/loadAPIFilters.ts +109 -99
- package/src/helpers/reloadURLHelpers.ts +1 -1
- package/src/helpers/tests/filterResetHelpers.test.ts +532 -0
- package/src/helpers/tests/formatConfigBeforeSave.test.ts +69 -0
- package/src/index.tsx +1 -1
- package/src/scss/editor-panel.scss +3 -431
- package/src/scss/grid.scss +7 -5
- package/src/scss/main.scss +1 -24
- package/src/store/errorMessage/errorMessage.reducer.ts +1 -1
- package/src/types/DashboardFilters.ts +9 -8
- package/src/types/InitialState.ts +12 -12
- package/vite.config.js +1 -1
- package/vitest.config.ts +16 -0
- package/src/coreStyles_dashboard.scss +0 -3
- package/src/helpers/getAutoLoadVisualization.ts +0 -11
- package/src/scss/mixins.scss +0 -47
- package/src/scss/variables.scss +0 -5
- /package/dist/{cdcdashboard-548642e6.es.js → cdcdashboard-Ct2SB0vL.es.js} +0 -0
|
@@ -1,472 +1,492 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
-
import { faker } from '@faker-js/faker'
|
|
3
|
-
import APIFiltersMapData from './_mock/api-filter-map.json'
|
|
4
|
-
import APIFiltersChartData from './_mock/api-filter-chart.json'
|
|
5
|
-
import APIFilterErrorConfig from './_mock/api-filter-error.json'
|
|
6
|
-
import ExampleConfig_1 from './_mock/dashboard-gallery.json'
|
|
7
|
-
import ExampleConfig_2 from './_mock/dashboard-2.json'
|
|
8
|
-
import ExampleConfig_3 from './_mock/dashboard_no_filter.json'
|
|
9
|
-
import SingleStateDashboardFilters from './_mock/single-state-dashboard-filters.json'
|
|
10
|
-
import Dashboard_Filter from './_mock/dashboard-filter.json'
|
|
11
|
-
import MultiVizConfig from './_mock/multi-viz.json'
|
|
12
|
-
import MultiDashboardConfig from './_mock/multi-dashboards.json'
|
|
13
|
-
import Dashboard from '../CdcDashboard'
|
|
14
|
-
import StandaloneTable from './_mock/standalone-table.json'
|
|
15
|
-
import GroupPivotConfig from './_mock/group-pivot-filter.json'
|
|
16
|
-
import PivotFitlerConfig from './_mock/pivot-filter.json'
|
|
17
|
-
import { type DashboardConfig as Config } from '../types/DashboardConfig'
|
|
18
|
-
import { userEvent, within } from '
|
|
19
|
-
import ToggleExampleConfig from './_mock/toggle-example.json'
|
|
20
|
-
import _ from 'lodash'
|
|
21
|
-
import { footnotesSymbols } from '@cdc/core/helpers/footnoteSymbols'
|
|
22
|
-
import FootnotesConfig from '@cdc/core/types/Footnotes'
|
|
23
|
-
import { ConfigRow } from '../types/ConfigRow'
|
|
24
|
-
import BumpChartConfig from './_mock/bump-chart.json'
|
|
25
|
-
import MethodologyConfig from './_mock/methodology.json'
|
|
26
|
-
import methodologyAPI from './_mock/methodologyAPI'
|
|
27
|
-
import TopSpacing_1 from './_mock/data-bite-dash-test.json'
|
|
28
|
-
import TopSpacing_2 from './_mock/data-bite-dash-test_1.json'
|
|
29
|
-
import TopSpacing_3 from './_mock/data-bite-dash-test_1_1.json'
|
|
30
|
-
import TopSpacing_4 from './_mock/data-bite-dash-test_1_1_1.json'
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
DashboardFilterDesc
|
|
37
|
-
DashboardFilterCust
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
{
|
|
212
|
-
matcher: {
|
|
213
|
-
name: '
|
|
214
|
-
url: 'path:/api/poc/
|
|
215
|
-
},
|
|
216
|
-
response: {
|
|
217
|
-
status: 200,
|
|
218
|
-
body: [{
|
|
219
|
-
}
|
|
220
|
-
},
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
canvas
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
2
|
+
import { faker } from '@faker-js/faker'
|
|
3
|
+
import APIFiltersMapData from './_mock/api-filter-map.json'
|
|
4
|
+
import APIFiltersChartData from './_mock/api-filter-chart.json'
|
|
5
|
+
import APIFilterErrorConfig from './_mock/api-filter-error.json'
|
|
6
|
+
import ExampleConfig_1 from './_mock/dashboard-gallery.json'
|
|
7
|
+
import ExampleConfig_2 from './_mock/dashboard-2.json'
|
|
8
|
+
import ExampleConfig_3 from './_mock/dashboard_no_filter.json'
|
|
9
|
+
import SingleStateDashboardFilters from './_mock/single-state-dashboard-filters.json'
|
|
10
|
+
import Dashboard_Filter from './_mock/dashboard-filter.json'
|
|
11
|
+
import MultiVizConfig from './_mock/multi-viz.json'
|
|
12
|
+
import MultiDashboardConfig from './_mock/multi-dashboards.json'
|
|
13
|
+
import Dashboard from '../CdcDashboard'
|
|
14
|
+
import StandaloneTable from './_mock/standalone-table.json'
|
|
15
|
+
import GroupPivotConfig from './_mock/group-pivot-filter.json'
|
|
16
|
+
import PivotFitlerConfig from './_mock/pivot-filter.json'
|
|
17
|
+
import { type DashboardConfig as Config } from '../types/DashboardConfig'
|
|
18
|
+
import { userEvent, within } from 'storybook/test'
|
|
19
|
+
import ToggleExampleConfig from './_mock/toggle-example.json'
|
|
20
|
+
import _ from 'lodash'
|
|
21
|
+
import { footnotesSymbols } from '@cdc/core/helpers/footnoteSymbols'
|
|
22
|
+
import FootnotesConfig from '@cdc/core/types/Footnotes'
|
|
23
|
+
import { ConfigRow } from '../types/ConfigRow'
|
|
24
|
+
import BumpChartConfig from './_mock/bump-chart.json'
|
|
25
|
+
import MethodologyConfig from './_mock/methodology.json'
|
|
26
|
+
import methodologyAPI from './_mock/methodologyAPI'
|
|
27
|
+
import TopSpacing_1 from './_mock/data-bite-dash-test.json'
|
|
28
|
+
import TopSpacing_2 from './_mock/data-bite-dash-test_1.json'
|
|
29
|
+
import TopSpacing_3 from './_mock/data-bite-dash-test_1_1.json'
|
|
30
|
+
import TopSpacing_4 from './_mock/data-bite-dash-test_1_1_1.json'
|
|
31
|
+
import CustomOrderNewValues from './_mock/custom-order-new-values.json'
|
|
32
|
+
import APIFilterResetConfig from '../../examples/test-api-filter-reset.json'
|
|
33
|
+
|
|
34
|
+
// Dashboard Filter Updates for Ascending, Descending, and Custom Order
|
|
35
|
+
import DashboardFilterAsc from './_mock/dashboard-filter-asc.json'
|
|
36
|
+
const DashboardFilterDesc = _.cloneDeep(DashboardFilterAsc)
|
|
37
|
+
const DashboardFilterCust = _.cloneDeep(DashboardFilterAsc)
|
|
38
|
+
DashboardFilterDesc.dashboard.sharedFilters[0].order = 'desc'
|
|
39
|
+
DashboardFilterCust.dashboard.sharedFilters[0].order = 'cust'
|
|
40
|
+
|
|
41
|
+
// On DashboardFilterCust change the sharedFilters[0].values and orderedValues to be in a custom order
|
|
42
|
+
const customOrder = ['American Samoa', 'Alaska', 'Alabama', 'Arizona', 'Arkansas']
|
|
43
|
+
DashboardFilterCust.dashboard.sharedFilters[0].orderedValues = customOrder
|
|
44
|
+
|
|
45
|
+
const meta: Meta<typeof Dashboard> = {
|
|
46
|
+
title: 'Components/Pages/Dashboard',
|
|
47
|
+
component: Dashboard
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
type Story = StoryObj<typeof Dashboard>
|
|
51
|
+
|
|
52
|
+
export const Dashboard_Filter_Asc: Story = {
|
|
53
|
+
args: {
|
|
54
|
+
config: DashboardFilterAsc,
|
|
55
|
+
isEditor: false
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export const Dashboard_Filter_Desc: Story = {
|
|
60
|
+
args: {
|
|
61
|
+
config: DashboardFilterDesc,
|
|
62
|
+
isEditor: false
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const Dashboard_Filter_Cust: Story = {
|
|
67
|
+
args: {
|
|
68
|
+
config: DashboardFilterCust,
|
|
69
|
+
isEditor: false
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export const CustomOrder_NewValues_AutoAppend: Story = {
|
|
74
|
+
args: {
|
|
75
|
+
config: CustomOrderNewValues,
|
|
76
|
+
isEditor: false
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export const Example_1: Story = {
|
|
81
|
+
args: {
|
|
82
|
+
config: ExampleConfig_1,
|
|
83
|
+
isEditor: false
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export const Example_2: Story = {
|
|
88
|
+
args: {
|
|
89
|
+
config: ExampleConfig_2,
|
|
90
|
+
isEditor: false
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export const Example_3: Story = {
|
|
95
|
+
args: {
|
|
96
|
+
config: ExampleConfig_3,
|
|
97
|
+
isEditor: false
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export const Bump_Chart_Dashboard: Story = {
|
|
102
|
+
args: {
|
|
103
|
+
config: BumpChartConfig,
|
|
104
|
+
isEditor: false
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export const Dashboard_Filters: Story = {
|
|
109
|
+
args: {
|
|
110
|
+
config: Dashboard_Filter,
|
|
111
|
+
isEditor: false
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export const API_Filter_Error: Story = {
|
|
116
|
+
args: {
|
|
117
|
+
config: APIFilterErrorConfig,
|
|
118
|
+
isEditor: false
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export const StandAloneTable: Story = {
|
|
123
|
+
args: {
|
|
124
|
+
config: StandaloneTable,
|
|
125
|
+
isEditor: false
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export const ToggleExample: Story = {
|
|
130
|
+
args: {
|
|
131
|
+
config: ToggleExampleConfig,
|
|
132
|
+
isEditor: false
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export const PivotFilter: Story = {
|
|
137
|
+
args: {
|
|
138
|
+
config: PivotFitlerConfig,
|
|
139
|
+
isEditor: false
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export const GroupPivotFilter: Story = {
|
|
144
|
+
args: {
|
|
145
|
+
config: GroupPivotConfig,
|
|
146
|
+
isEditor: false
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export const SingleStateDashboardWithFilters: Story = {
|
|
151
|
+
args: {
|
|
152
|
+
config: SingleStateDashboardFilters,
|
|
153
|
+
isEditor: false
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
faker.seed(123)
|
|
158
|
+
|
|
159
|
+
const countries = _.times(5, faker.location.country)
|
|
160
|
+
const categories = _.times(3, val => `category-${val + 1}`)
|
|
161
|
+
|
|
162
|
+
const data = []
|
|
163
|
+
countries.forEach((country, i) => {
|
|
164
|
+
categories.forEach((category, j) => {
|
|
165
|
+
if ((i + j) % 3 === 0) return
|
|
166
|
+
data.push({
|
|
167
|
+
Country: country,
|
|
168
|
+
'Sample Categories': category,
|
|
169
|
+
Data: faker.number.int({ min: 5, max: 50 })
|
|
170
|
+
})
|
|
171
|
+
})
|
|
172
|
+
})
|
|
173
|
+
|
|
174
|
+
const footnoteData = countries.map((country, i) => {
|
|
175
|
+
return { Country: country, symbol: footnotesSymbols[i][0], text: faker.lorem.sentence() }
|
|
176
|
+
})
|
|
177
|
+
|
|
178
|
+
const multiVizData = {
|
|
179
|
+
'valid-world-data.json': { data },
|
|
180
|
+
'footnote-data.json': { data: footnoteData }
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export const MultiDashboard: Story = {
|
|
184
|
+
args: {
|
|
185
|
+
config: MultiDashboardConfig,
|
|
186
|
+
isEditor: false
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const FNrows: ConfigRow[] = [{ ...MultiVizConfig.rows[0], footnotesId: 'footnote123' }]
|
|
191
|
+
const footnoteConfig: Partial<FootnotesConfig> = {
|
|
192
|
+
dataKey: 'footnote-data.json',
|
|
193
|
+
dynamicFootnotes: { symbolColumn: 'symbol', textColumn: 'text' },
|
|
194
|
+
staticFootnotes: [{ symbol: '**', text: 'This is a static Footnote' }]
|
|
195
|
+
}
|
|
196
|
+
const FNViz = { ...MultiVizConfig.visualizations, footnote123: footnoteConfig }
|
|
197
|
+
export const Footnotes: Story = {
|
|
198
|
+
args: {
|
|
199
|
+
config: { ...MultiVizConfig, datasets: multiVizData, rows: FNrows, visualizations: FNViz },
|
|
200
|
+
isEditor: false
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const sleep = ms => {
|
|
205
|
+
return new Promise(r => setTimeout(r, ms))
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const fetchMock = {
|
|
209
|
+
debug: true,
|
|
210
|
+
mocks: [
|
|
211
|
+
{
|
|
212
|
+
matcher: {
|
|
213
|
+
name: 'topicsFilter',
|
|
214
|
+
url: 'path:/api/poc/topics'
|
|
215
|
+
},
|
|
216
|
+
response: {
|
|
217
|
+
status: 200,
|
|
218
|
+
body: [{ TopicID: 'topicId', Topic: 'Some Topic' }]
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
matcher: {
|
|
223
|
+
name: 'indicatorsFilter',
|
|
224
|
+
url: 'path:/api/poc/indicators'
|
|
225
|
+
},
|
|
226
|
+
response: {
|
|
227
|
+
status: 200,
|
|
228
|
+
body: [{ IndicatorID: 'indicatorID', Indicator: 'Some Indicator' }]
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
...['Year', 'DataValueType', 'StratificationCategory', 'Stratification'].map(filter => {
|
|
232
|
+
return {
|
|
233
|
+
matcher: {
|
|
234
|
+
name: 'filters' + filter,
|
|
235
|
+
url: 'path:/api/POC/Filters/' + filter
|
|
236
|
+
},
|
|
237
|
+
response: {
|
|
238
|
+
status: 200,
|
|
239
|
+
body: _.times(5, i => ({ [filter]: `Some ${filter} ${i}` }))
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}),
|
|
243
|
+
{
|
|
244
|
+
matcher: {
|
|
245
|
+
name: 'locations',
|
|
246
|
+
url: 'path:/api/poc/locations'
|
|
247
|
+
},
|
|
248
|
+
response: {
|
|
249
|
+
status: 200,
|
|
250
|
+
body: [
|
|
251
|
+
{
|
|
252
|
+
LocationAbbr: 'MS',
|
|
253
|
+
LocationDesc: 'Mississippi'
|
|
254
|
+
}
|
|
255
|
+
]
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
matcher: {
|
|
260
|
+
name: 'tableData',
|
|
261
|
+
url: 'path:/api/POC/TableData'
|
|
262
|
+
},
|
|
263
|
+
response: {
|
|
264
|
+
status: 200,
|
|
265
|
+
body: [
|
|
266
|
+
{
|
|
267
|
+
LocationAbbr: 'MS',
|
|
268
|
+
LocationDesc: 'Mississippi',
|
|
269
|
+
Indicator: 'Some Indicator',
|
|
270
|
+
IndicatorID: 'ALC04',
|
|
271
|
+
Topic: 'Some Topic',
|
|
272
|
+
TopicID: 'ALC',
|
|
273
|
+
DataSource: null,
|
|
274
|
+
StratificationCategory: 'Overall',
|
|
275
|
+
Stratification: 'Overall',
|
|
276
|
+
StratificationId1: 'OVR',
|
|
277
|
+
StratificationCategoryId: 'OVERALL',
|
|
278
|
+
YearStart: null,
|
|
279
|
+
YearEnd: 2019,
|
|
280
|
+
DataValue: 2,
|
|
281
|
+
DataValueUnit: 'Number',
|
|
282
|
+
LowConfidenceLimit: 1.6,
|
|
283
|
+
HighConfidenceLimit: 2.9,
|
|
284
|
+
DataValueType: null,
|
|
285
|
+
DataValueTypeID: 'CRDMEDN'
|
|
286
|
+
}
|
|
287
|
+
]
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
matcher: {
|
|
292
|
+
name: 'methodologyYear',
|
|
293
|
+
url: 'path:/methodology',
|
|
294
|
+
query: {
|
|
295
|
+
$select: 'distinct year'
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
response: {
|
|
299
|
+
status: 200,
|
|
300
|
+
body: methodologyAPI('distinct year')
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
...['a', 'b'].map(methodology => {
|
|
304
|
+
return {
|
|
305
|
+
matcher: {
|
|
306
|
+
name: 'methodology' + methodology,
|
|
307
|
+
url: 'path:/methodology',
|
|
308
|
+
query: {
|
|
309
|
+
methodology: `"${methodology}"`
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
response: {
|
|
313
|
+
status: 200,
|
|
314
|
+
body: methodologyAPI('*', ['methodology', methodology])
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}),
|
|
318
|
+
...[1999, 2000, 2012, 2013].map(year => {
|
|
319
|
+
return {
|
|
320
|
+
matcher: {
|
|
321
|
+
name: 'methodology' + year,
|
|
322
|
+
url: 'path:/methodology',
|
|
323
|
+
query: {
|
|
324
|
+
$select: 'distinct methodology',
|
|
325
|
+
year
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
response: {
|
|
329
|
+
status: 200,
|
|
330
|
+
body: methodologyAPI('distinct methodology', ['year', year])
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
})
|
|
334
|
+
]
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
export const RegressionAPIFiltersMap: Story = {
|
|
338
|
+
args: {
|
|
339
|
+
config: APIFiltersMapData as unknown as Config,
|
|
340
|
+
isEditor: false
|
|
341
|
+
},
|
|
342
|
+
parameters: {
|
|
343
|
+
fetchMock
|
|
344
|
+
}
|
|
345
|
+
// TODO: Re-enable play function when fetch-mock is fully compatible with Storybook 9 + Vitest
|
|
346
|
+
// play: async ({ canvasElement }) => {
|
|
347
|
+
// const canvas = within(canvasElement)
|
|
348
|
+
// const user = userEvent.setup()
|
|
349
|
+
// // play is running before full rendering is complete so sleep function
|
|
350
|
+
// // is needed to delay the execution.
|
|
351
|
+
// // possible related bug: https://github.com/storybookjs/storybook/issues/18258
|
|
352
|
+
// await sleep(1000)
|
|
353
|
+
// const topicsFilter = canvas.getByLabelText('Category', { selector: 'select' })
|
|
354
|
+
// await user.selectOptions(topicsFilter, ['topicId'])
|
|
355
|
+
// await sleep(1000)
|
|
356
|
+
|
|
357
|
+
// const indicatorsFilter = canvas.getByLabelText('Indicator', { selector: 'select' })
|
|
358
|
+
// await user.selectOptions(indicatorsFilter, ['indicatorID'])
|
|
359
|
+
// const yearsFilter = canvas.getByLabelText('Year', { selector: 'select' })
|
|
360
|
+
// await user.selectOptions(yearsFilter, ['Some Year 0'])
|
|
361
|
+
// const stratCategoryFilter = canvas.getByLabelText('View By', { selector: 'select' })
|
|
362
|
+
// await user.selectOptions(stratCategoryFilter, ['Some StratificationCategory 0'])
|
|
363
|
+
// const stratFilter = canvas.getByLabelText('Stratification', { selector: 'select' })
|
|
364
|
+
// await user.selectOptions(stratFilter, ['Some Stratification 0'])
|
|
365
|
+
// await user.click(canvas.getByText('GO!'))
|
|
366
|
+
// }
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
export const RegressionAPIFiltersChart: Story = {
|
|
370
|
+
args: {
|
|
371
|
+
config: APIFiltersChartData as unknown as Config,
|
|
372
|
+
isEditor: false
|
|
373
|
+
},
|
|
374
|
+
parameters: {
|
|
375
|
+
fetchMock
|
|
376
|
+
}
|
|
377
|
+
// TODO: Re-enable play function when fetch-mock is fully compatible with Storybook 9 + Vitest
|
|
378
|
+
// play: async ({ canvasElement }) => {
|
|
379
|
+
// const canvas = within(canvasElement)
|
|
380
|
+
// const user = userEvent.setup()
|
|
381
|
+
// // play is running before full rendering is complete so sleep function
|
|
382
|
+
// // is needed to delay the execution.
|
|
383
|
+
// // possible related bug: https://github.com/storybookjs/storybook/issues/18258
|
|
384
|
+
// await sleep(1000)
|
|
385
|
+
// const locationFilter = canvas.getByLabelText('Location', { selector: 'select' })
|
|
386
|
+
// await user.selectOptions(locationFilter, ['MS'])
|
|
387
|
+
// const topicsFilter = canvas.getByLabelText('Category', { selector: 'select' })
|
|
388
|
+
// await user.selectOptions(topicsFilter, ['topicId'])
|
|
389
|
+
// const indicatorsFilter = canvas.getByLabelText('Indicator', { selector: 'select' })
|
|
390
|
+
// await user.selectOptions(indicatorsFilter, ['indicatorID'])
|
|
391
|
+
// await user.click(canvas.getByText('GO!'))
|
|
392
|
+
// await sleep(1000)
|
|
393
|
+
// const yearFilter = canvas.getByLabelText('Year', { selector: 'select' })
|
|
394
|
+
// await user.selectOptions(yearFilter, ['Some Year 1'])
|
|
395
|
+
// }
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
export const RegressionHiddenFilter: Story = {
|
|
399
|
+
args: {
|
|
400
|
+
config: MethodologyConfig,
|
|
401
|
+
isEditor: false
|
|
402
|
+
},
|
|
403
|
+
parameters: {
|
|
404
|
+
fetchMock
|
|
405
|
+
}
|
|
406
|
+
// TODO: Re-enable play function when fetch-mock is fully compatible with Storybook 9 + Vitest
|
|
407
|
+
// play: async ({ canvasElement }) => {
|
|
408
|
+
// const canvas = within(canvasElement)
|
|
409
|
+
// const user = userEvent.setup()
|
|
410
|
+
// // play is running before full rendering is complete so sleep function
|
|
411
|
+
// // is needed to delay the execution.
|
|
412
|
+
// // possible related bug: https://github.com/storybookjs/storybook/issues/18258
|
|
413
|
+
// await sleep(1000)
|
|
414
|
+
// const yearFilter = canvas.getByLabelText('Year', { selector: 'select' })
|
|
415
|
+
// await user.selectOptions(yearFilter, ['1999'])
|
|
416
|
+
// await user.click(canvas.getByText('GO!'))
|
|
417
|
+
// await sleep(500)
|
|
418
|
+
// canvas.getAllByText('alabama')
|
|
419
|
+
// canvas.getAllByText('alaska')
|
|
420
|
+
// canvas.getAllByText('arizona')
|
|
421
|
+
// await user.selectOptions(yearFilter, ['2012'])
|
|
422
|
+
// await user.click(canvas.getByText('GO!'))
|
|
423
|
+
// await sleep(500)
|
|
424
|
+
// canvas.getAllByText('new york')
|
|
425
|
+
// canvas.getAllByText('new jersey')
|
|
426
|
+
// canvas.getAllByText('new mexico')
|
|
427
|
+
// }
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
export const RegressionMultiVisualizationTests: Story = {
|
|
431
|
+
args: {
|
|
432
|
+
config: { ...MultiVizConfig, datasets: multiVizData },
|
|
433
|
+
isEditor: false
|
|
434
|
+
},
|
|
435
|
+
play: async ({ canvasElement }) => {
|
|
436
|
+
const canvas = within(canvasElement)
|
|
437
|
+
const user = userEvent.setup()
|
|
438
|
+
// play is running before full rendering is complete so sleep function
|
|
439
|
+
// is needed to delay the execution.
|
|
440
|
+
// possible related bug: https://github.com/storybookjs/storybook/issues/18258
|
|
441
|
+
await sleep(1000)
|
|
442
|
+
const categoryFilter = canvas.getByLabelText('Category', { selector: 'select' })
|
|
443
|
+
canvas.getAllByText('Paraguay')
|
|
444
|
+
canvas.getAllByText('Poland')
|
|
445
|
+
canvas.getAllByText('Iraq')
|
|
446
|
+
await user.selectOptions(categoryFilter, ['category-3'])
|
|
447
|
+
canvas.getAllByText('Paraguay')
|
|
448
|
+
canvas.getAllByText('Ethiopia')
|
|
449
|
+
canvas.getAllByText('Iraq')
|
|
450
|
+
await user.selectOptions(categoryFilter, ['category-1'])
|
|
451
|
+
canvas.getAllByText('Poland')
|
|
452
|
+
canvas.getAllByText('Ethiopia')
|
|
453
|
+
canvas.getAllByText('Curacao')
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
export const Top_Spacing_1: Story = {
|
|
458
|
+
args: {
|
|
459
|
+
config: TopSpacing_1,
|
|
460
|
+
isEditor: false
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
export const Top_Spacing_2: Story = {
|
|
465
|
+
args: {
|
|
466
|
+
config: TopSpacing_2,
|
|
467
|
+
isEditor: false
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
export const Top_Spacing_3: Story = {
|
|
472
|
+
args: {
|
|
473
|
+
config: TopSpacing_3,
|
|
474
|
+
isEditor: false
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
export const Top_Spacing_4: Story = {
|
|
479
|
+
args: {
|
|
480
|
+
config: TopSpacing_4,
|
|
481
|
+
isEditor: false
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
export const Clear_Filters_Button: Story = {
|
|
486
|
+
args: {
|
|
487
|
+
config: APIFilterResetConfig as unknown as Config,
|
|
488
|
+
isEditor: false
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
export default meta
|