@cdc/dashboard 4.24.7 → 4.24.9

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 (40) hide show
  1. package/dist/cdcdashboard.js +128394 -122305
  2. package/examples/single-state-dashboard-filters.json +421 -0
  3. package/examples/state-level.json +90136 -0
  4. package/examples/state-points.json +10474 -0
  5. package/examples/test-file.json +147 -0
  6. package/examples/testing.json +94456 -0
  7. package/index.html +18 -6
  8. package/package.json +9 -9
  9. package/src/CdcDashboardComponent.tsx +154 -90
  10. package/src/DashboardContext.tsx +7 -1
  11. package/src/_stories/Dashboard.stories.tsx +124 -10
  12. package/src/_stories/_mock/api-filter-map.json +1 -1
  13. package/src/_stories/_mock/bump-chart.json +3554 -0
  14. package/src/_stories/_mock/methodology.json +412 -0
  15. package/src/_stories/_mock/methodologyAPI.ts +90 -0
  16. package/src/_stories/_mock/multi-viz.json +1 -1
  17. package/src/_stories/_mock/single-state-dashboard-filters.json +390 -0
  18. package/src/components/DashboardFilters/DashboardFilters.tsx +39 -17
  19. package/src/components/DashboardFilters/DashboardFiltersEditor/DashboardFiltersEditor.tsx +2 -2
  20. package/src/components/DashboardFilters/DashboardFiltersEditor/components/FilterEditor.tsx +141 -31
  21. package/src/components/DashboardFilters/DashboardFiltersWrapper.tsx +66 -18
  22. package/src/components/Header/Header.tsx +0 -5
  23. package/src/components/MultiConfigTabs/MultiConfigTabs.tsx +20 -8
  24. package/src/components/Row.tsx +1 -1
  25. package/src/components/VisualizationRow.tsx +98 -17
  26. package/src/components/Widget.tsx +1 -0
  27. package/src/helpers/FilterBehavior.ts +4 -0
  28. package/src/helpers/addValuesToDashboardFilters.ts +49 -0
  29. package/src/helpers/apiFilterHelpers.ts +69 -18
  30. package/src/helpers/changeFilterActive.ts +16 -7
  31. package/src/helpers/getFilteredData.ts +4 -4
  32. package/src/helpers/iconHash.tsx +2 -0
  33. package/src/helpers/loadAPIFilters.ts +74 -0
  34. package/src/helpers/reloadURLHelpers.ts +13 -3
  35. package/src/helpers/tests/addValuesToDashboardFilters.test.ts +44 -0
  36. package/src/helpers/tests/apiFilterHelpers.test.ts +156 -0
  37. package/src/helpers/tests/getFilteredData.test.ts +86 -0
  38. package/src/helpers/tests/loadAPIFiltersWrapper.test.ts +176 -0
  39. package/src/helpers/tests/reloadURLHelpers.test.ts +195 -0
  40. package/src/types/SharedFilter.ts +2 -1
@@ -0,0 +1,421 @@
1
+ {
2
+ "dashboard": {
3
+ "theme": "theme-blue",
4
+ "sharedFilters": [
5
+ {
6
+ "key": "New Dashboard Filter 1",
7
+ "showDropdown": true,
8
+ "values": [
9
+ "Florida",
10
+ "California",
11
+ "Guam"
12
+ ],
13
+ "type": "datafilter",
14
+ "columnName": "State",
15
+ "tier": 1,
16
+ "usedBy": [
17
+ "map1721943918271"
18
+ ]
19
+ }
20
+ ]
21
+ },
22
+ "rows": [
23
+ {
24
+ "columns": [
25
+ {
26
+ "width": 12,
27
+ "widget": "dashboardFilters1721943964161"
28
+ }
29
+ ],
30
+ "uuid": 1721943975299
31
+ },
32
+ {
33
+ "uuid": 1721943975299,
34
+ "columns": [
35
+ {
36
+ "width": 12,
37
+ "widget": "map1721943918271"
38
+ },
39
+ {},
40
+ {}
41
+ ]
42
+ }
43
+ ],
44
+ "visualizations": {
45
+ "map1721943918271": {
46
+ "annotations": [],
47
+ "general": {
48
+ "geoType": "single-state",
49
+ "annotationDropdownText": "Annotations",
50
+ "geoBorderColor": "darkGray",
51
+ "headerColor": "theme-blue",
52
+ "title": "",
53
+ "showTitle": true,
54
+ "showSidebar": true,
55
+ "showDownloadButton": true,
56
+ "showDownloadMediaButton": false,
57
+ "displayAsHex": false,
58
+ "displayStateLabels": false,
59
+ "territoriesLabel": "Territories",
60
+ "territoriesAlwaysShow": false,
61
+ "language": "en",
62
+ "geoLabelOverride": "",
63
+ "hasRegions": false,
64
+ "fullBorder": false,
65
+ "type": "data",
66
+ "convertFipsCodes": true,
67
+ "palette": {
68
+ "isReversed": false
69
+ },
70
+ "allowMapZoom": true,
71
+ "hideGeoColumnInTooltip": false,
72
+ "hidePrimaryColumnInTooltip": false,
73
+ "expandDataTable": false,
74
+ "filterControlsStatePicked": "State",
75
+ "statePicked": {
76
+ "fipsCode": "01",
77
+ "stateName": "Alabama"
78
+ }
79
+ },
80
+ "type": "map",
81
+ "color": "pinkpurple",
82
+ "columns": {
83
+ "geo": {
84
+ "name": "FIPS Codes",
85
+ "label": "Location",
86
+ "tooltip": false,
87
+ "dataTable": true
88
+ },
89
+ "primary": {
90
+ "dataTable": true,
91
+ "tooltip": true,
92
+ "prefix": "",
93
+ "suffix": "",
94
+ "name": "Insured Rate",
95
+ "label": "",
96
+ "roundToPlace": 0
97
+ },
98
+ "navigate": {
99
+ "name": ""
100
+ },
101
+ "latitude": {
102
+ "name": "Latitude"
103
+ },
104
+ "longitude": {
105
+ "name": "Longitude"
106
+ }
107
+ },
108
+ "legend": {
109
+ "descriptions": {},
110
+ "specialClasses": [],
111
+ "unified": false,
112
+ "singleColumn": false,
113
+ "singleRow": false,
114
+ "verticalSorted": false,
115
+ "showSpecialClassesLast": false,
116
+ "dynamicDescription": false,
117
+ "type": "equalnumber",
118
+ "numberOfItems": 3,
119
+ "position": "side",
120
+ "title": "Legend"
121
+ },
122
+ "filters": [],
123
+ "table": {
124
+ "wrapColumns": false,
125
+ "label": "Data Table",
126
+ "expanded": false,
127
+ "limitHeight": false,
128
+ "height": "",
129
+ "caption": "",
130
+ "showDownloadUrl": false,
131
+ "showDataTableLink": true,
132
+ "showFullGeoNameInCSV": false,
133
+ "forceDisplay": true,
134
+ "download": true,
135
+ "indexLabel": ""
136
+ },
137
+ "tooltips": {
138
+ "appearanceType": "hover",
139
+ "linkLabel": "Learn More",
140
+ "capitalizeLabels": true,
141
+ "opacity": 90
142
+ },
143
+ "visual": {
144
+ "minBubbleSize": 1,
145
+ "maxBubbleSize": 20,
146
+ "extraBubbleBorder": false,
147
+ "cityStyle": "circle",
148
+ "cityStyleLabel": "",
149
+ "showBubbleZeros": false,
150
+ "additionalCityStyles": [],
151
+ "geoCodeCircleSize": "2"
152
+ },
153
+ "mapPosition": {
154
+ "coordinates": [
155
+ 0,
156
+ 30
157
+ ],
158
+ "zoom": 1
159
+ },
160
+ "map": {
161
+ "layers": [],
162
+ "patterns": []
163
+ },
164
+ "hexMap": {
165
+ "type": "",
166
+ "shapeGroups": [
167
+ {
168
+ "legendTitle": "",
169
+ "legendDescription": "",
170
+ "items": [
171
+ {
172
+ "key": "",
173
+ "shape": "Arrow Up",
174
+ "column": "",
175
+ "operator": "=",
176
+ "value": ""
177
+ }
178
+ ]
179
+ }
180
+ ]
181
+ },
182
+ "filterBehavior": "Filter Change",
183
+ "openModal": true,
184
+ "uid": "map1721943918271",
185
+ "dataDescription": {
186
+ "horizontal": false,
187
+ "series": false
188
+ },
189
+ "dataKey": "test-single-county-file.json",
190
+ "editing": false,
191
+ "originalFormattedData": [
192
+ {
193
+ "Insured Rate": 8,
194
+ "Coverage Status": "Insured",
195
+ "FIPS Codes": "12057",
196
+ "Year (Good filter option)": "2010",
197
+ "link": "",
198
+ "Latitude": "",
199
+ "Longitude": "",
200
+ "State": "Florida"
201
+ },
202
+ {
203
+ "Insured Rate": 25,
204
+ "Coverage Status": "Insured",
205
+ "FIPS Codes": "55005",
206
+ "Year (Good filter option)": "2010",
207
+ "link": "",
208
+ "Latitude": "",
209
+ "Longitude": "",
210
+ "State": "California"
211
+ },
212
+ {
213
+ "Insured Rate": 25,
214
+ "Coverage Status": "Insured",
215
+ "FIPS Codes": "12103",
216
+ "Year (Good filter option)": "2010",
217
+ "link": "",
218
+ "Latitude": "",
219
+ "Longitude": "",
220
+ "State": "Florida"
221
+ },
222
+ {
223
+ "Insured Rate": 25,
224
+ "Coverage Status": "Insured",
225
+ "FIPS Codes": "12103",
226
+ "Year (Good filter option)": "2010",
227
+ "link": "",
228
+ "Latitude": "",
229
+ "Longitude": "",
230
+ "State": "Guam"
231
+ },
232
+ {
233
+ "Insured Rate": 25,
234
+ "Coverage Status": "Insured",
235
+ "FIPS Codes": "32005",
236
+ "Year (Good filter option)": "2010",
237
+ "link": "",
238
+ "Latitude": "",
239
+ "Longitude": "",
240
+ "State": "California"
241
+ },
242
+ {
243
+ "Insured Rate": 18,
244
+ "Coverage Status": "Insured",
245
+ "FIPS Codes": "06075",
246
+ "Year (Good filter option)": "2010",
247
+ "link": "",
248
+ "Latitude": "",
249
+ "Longitude": "",
250
+ "State": "California"
251
+ },
252
+ {
253
+ "Insured Rate": 3,
254
+ "Coverage Status": "Insured",
255
+ "FIPS Codes": "06027",
256
+ "Year (Good filter option)": "2010",
257
+ "link": "",
258
+ "Latitude": "",
259
+ "Longitude": "",
260
+ "State": "California"
261
+ },
262
+ {
263
+ "Insured Rate": 25,
264
+ "Coverage Status": "Insured",
265
+ "FIPS Codes": "06029",
266
+ "Year (Good filter option)": "2010",
267
+ "link": "",
268
+ "Latitude": "",
269
+ "Longitude": "",
270
+ "State": "California"
271
+ },
272
+ {
273
+ "Insured Rate": 60,
274
+ "Coverage Status": "Insured",
275
+ "FIPS Codes": "Yosemite",
276
+ "Year (Good filter option)": "2010",
277
+ "link": "",
278
+ "Latitude": "37.865101",
279
+ "Longitude": "-119.538330",
280
+ "State": "California"
281
+ }
282
+ ],
283
+ "version": "4.24.9"
284
+ },
285
+ "dashboardFilters1721943964161": {
286
+ "filters": [],
287
+ "filterBehavior": "Filter Change",
288
+ "newViz": true,
289
+ "openModal": true,
290
+ "uid": "dashboardFilters1721943964161",
291
+ "type": "dashboardFilters",
292
+ "sharedFilterIndexes": [
293
+ 0
294
+ ],
295
+ "visualizationType": "dashboardFilters",
296
+ "editing": false
297
+ }
298
+ },
299
+ "table": {
300
+ "label": "Data Table",
301
+ "show": true,
302
+ "showDownloadUrl": false,
303
+ "showVertical": true
304
+ },
305
+ "newViz": true,
306
+ "datasets": {
307
+ "test-single-county-file.json": {
308
+ "data": [
309
+ {
310
+ "Insured Rate": 8,
311
+ "Coverage Status": "Insured",
312
+ "FIPS Codes": "12057",
313
+ "Year (Good filter option)": "2010",
314
+ "link": "",
315
+ "Latitude": "",
316
+ "Longitude": "",
317
+ "State": "Florida"
318
+ },
319
+ {
320
+ "Insured Rate": 25,
321
+ "Coverage Status": "Insured",
322
+ "FIPS Codes": "55005",
323
+ "Year (Good filter option)": "2010",
324
+ "link": "",
325
+ "Latitude": "",
326
+ "Longitude": "",
327
+ "State": "California"
328
+ },
329
+ {
330
+ "Insured Rate": 25,
331
+ "Coverage Status": "Insured",
332
+ "FIPS Codes": "12103",
333
+ "Year (Good filter option)": "2010",
334
+ "link": "",
335
+ "Latitude": "",
336
+ "Longitude": "",
337
+ "State": "Florida"
338
+ },
339
+ {
340
+ "Insured Rate": "0",
341
+ "Coverage Status": "Insured",
342
+ "FIPS Codes": "12103",
343
+ "Year (Good filter option)": "2010",
344
+ "link": "",
345
+ "Latitude": "",
346
+ "Longitude": "",
347
+ "State": "Arizona "
348
+ },
349
+ {
350
+ "Insured Rate": 25,
351
+ "Coverage Status": "Insured",
352
+ "FIPS Codes": "32005",
353
+ "Year (Good filter option)": "2010",
354
+ "link": "",
355
+ "Latitude": "",
356
+ "Longitude": "",
357
+ "State": "California"
358
+ },
359
+ {
360
+ "Insured Rate": 18,
361
+ "Coverage Status": "Insured",
362
+ "FIPS Codes": "06075",
363
+ "Year (Good filter option)": "2010",
364
+ "link": "",
365
+ "Latitude": "",
366
+ "Longitude": "",
367
+ "State": "California"
368
+ },
369
+ {
370
+ "Insured Rate": 3,
371
+ "Coverage Status": "Insured",
372
+ "FIPS Codes": "06027",
373
+ "Year (Good filter option)": "2010",
374
+ "link": "",
375
+ "Latitude": "",
376
+ "Longitude": "",
377
+ "State": "California"
378
+ },
379
+ {
380
+ "Insured Rate": 25,
381
+ "Coverage Status": "Insured",
382
+ "FIPS Codes": "06029",
383
+ "Year (Good filter option)": "2010",
384
+ "link": "",
385
+ "Latitude": "",
386
+ "Longitude": "",
387
+ "State": "California"
388
+ },
389
+ {
390
+ "Insured Rate": 60,
391
+ "Coverage Status": "Insured",
392
+ "FIPS Codes": "Yosemite",
393
+ "Year (Good filter option)": "2010",
394
+ "link": "",
395
+ "Latitude": "37.865101",
396
+ "Longitude": "-119.538330",
397
+ "State": "California"
398
+ },
399
+ {
400
+ "Insured Rate": 60,
401
+ "Coverage Status": "Insured",
402
+ "FIPS Codes": "Yosemite",
403
+ "Year (Good filter option)": "2010",
404
+ "link": "",
405
+ "Latitude": "37.865101",
406
+ "Longitude": "-119.538330",
407
+ "State": "Test Location"
408
+ }
409
+ ],
410
+ "dataFileSize": 1764,
411
+ "dataFileName": "test-single-county-file.json",
412
+ "dataFileSourceType": "file",
413
+ "dataFileFormat": "JSON",
414
+ "preview": true
415
+ }
416
+ },
417
+ "type": "dashboard",
418
+ "runtime": {},
419
+ "version": "4.24.9",
420
+ "uuid": 1721943961122
421
+ }