@cdc/dashboard 4.26.4 → 4.26.5

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 (91) hide show
  1. package/CONFIG.md +77 -30
  2. package/LICENSE +201 -0
  3. package/dist/cdcdashboard.js +49936 -49166
  4. package/examples/dashboard-conditions-filters-incomplete.json +221 -0
  5. package/examples/dashboard-missing-datasets-multi.json +174 -0
  6. package/examples/dashboard-missing-datasets-single.json +121 -0
  7. package/examples/dashboard-multi-dashboard-version-regression.json +146 -0
  8. package/examples/dashboard-shared-filter-row-delete-cleanup.json +186 -0
  9. package/examples/dashboard-stale-dataset-keys.json +181 -0
  10. package/examples/dashboard-tiered-filter-regression.json +190 -0
  11. package/examples/private/cfa-dashboard.json +651 -0
  12. package/examples/private/data-bite-wrap.json +6936 -0
  13. package/examples/private/multi-dash-fix.json +16963 -0
  14. package/examples/private/versions.json +41612 -0
  15. package/examples/us-map-filter-example.json +1074 -0
  16. package/package.json +9 -9
  17. package/src/CdcDashboard.tsx +6 -2
  18. package/src/CdcDashboardComponent.tsx +178 -87
  19. package/src/DashboardCopyPasteContext.test.tsx +33 -0
  20. package/src/DashboardCopyPasteContext.tsx +48 -0
  21. package/src/_stories/Dashboard.EditorRegression.stories.tsx +72 -0
  22. package/src/_stories/Dashboard.Regression.stories.tsx +196 -0
  23. package/src/_stories/Dashboard.Zoom.stories.tsx +88 -0
  24. package/src/_stories/Dashboard.stories.tsx +294 -0
  25. package/src/_stories/FilteredTextMigrationComparison.stories.tsx +87 -0
  26. package/src/components/Column.test.tsx +176 -0
  27. package/src/components/Column.tsx +214 -13
  28. package/src/components/DashboardConditionModal.test.tsx +420 -0
  29. package/src/components/DashboardConditionModal.tsx +367 -0
  30. package/src/components/DashboardConditionSummary.tsx +59 -0
  31. package/src/components/DashboardEditors.tsx +8 -0
  32. package/src/components/DashboardFilters/DashboardFilters.test.tsx +139 -1
  33. package/src/components/DashboardFilters/DashboardFilters.tsx +192 -174
  34. package/src/components/DashboardFilters/DashboardFiltersEditor/DashboardFiltersEditor.test.tsx +164 -0
  35. package/src/components/DashboardFilters/DashboardFiltersEditor/DashboardFiltersEditor.tsx +41 -2
  36. package/src/components/DashboardFilters/DashboardFiltersEditor/components/FilterEditor.test.tsx +180 -3
  37. package/src/components/DashboardFilters/DashboardFiltersEditor/components/FilterEditor.tsx +15 -32
  38. package/src/components/DashboardFilters/DashboardFiltersWrapper.test.tsx +142 -0
  39. package/src/components/DashboardFilters/DashboardFiltersWrapper.tsx +32 -27
  40. package/src/components/DashboardFilters/dashboardfilter.styles.css +42 -27
  41. package/src/components/DataDesignerModal.tsx +2 -1
  42. package/src/components/Grid.tsx +8 -4
  43. package/src/components/Header/Header.tsx +36 -17
  44. package/src/components/Row.test.tsx +228 -0
  45. package/src/components/Row.tsx +93 -18
  46. package/src/components/VisualizationRow.test.tsx +396 -0
  47. package/src/components/VisualizationRow.tsx +110 -35
  48. package/src/components/VisualizationsPanel/VisualizationsPanel.test.tsx +49 -0
  49. package/src/components/VisualizationsPanel/VisualizationsPanel.tsx +14 -13
  50. package/src/components/Widget/Widget.test.tsx +218 -0
  51. package/src/components/Widget/Widget.tsx +119 -17
  52. package/src/components/Widget/widget.styles.css +31 -18
  53. package/src/components/dashboard-condition-modal.css +76 -0
  54. package/src/components/dashboard-condition-summary.css +87 -0
  55. package/src/helpers/addValuesToDashboardFilters.ts +3 -5
  56. package/src/helpers/addVisualization.ts +15 -4
  57. package/src/helpers/cloneDashboardWidget.ts +127 -0
  58. package/src/helpers/dashboardColumnWidgets.ts +99 -0
  59. package/src/helpers/dashboardConditionUi.ts +47 -0
  60. package/src/helpers/dashboardConditions.ts +200 -0
  61. package/src/helpers/dashboardFilterTargets.ts +156 -0
  62. package/src/helpers/filterData.ts +4 -9
  63. package/src/helpers/filterVisibility.ts +20 -0
  64. package/src/helpers/formatConfigBeforeSave.ts +2 -2
  65. package/src/helpers/getFilteredData.ts +18 -5
  66. package/src/helpers/getUpdateConfig.ts +43 -12
  67. package/src/helpers/getVizRowColumnLocator.ts +11 -1
  68. package/src/helpers/iconHash.tsx +9 -3
  69. package/src/helpers/mapDataToConfig.ts +31 -29
  70. package/src/helpers/reloadURLHelpers.ts +25 -5
  71. package/src/helpers/removeDashboardFilter.ts +33 -33
  72. package/src/helpers/tests/addVisualization.test.ts +53 -9
  73. package/src/helpers/tests/cloneDashboardWidget.test.ts +136 -0
  74. package/src/helpers/tests/dashboardColumnWidgets.test.ts +99 -0
  75. package/src/helpers/tests/dashboardConditionUi.test.ts +41 -0
  76. package/src/helpers/tests/dashboardConditions.test.ts +428 -0
  77. package/src/helpers/tests/formatConfigBeforeSave.test.ts +51 -0
  78. package/src/helpers/tests/getFilteredData.test.ts +265 -86
  79. package/src/helpers/tests/getUpdateConfig.test.ts +338 -0
  80. package/src/helpers/tests/reloadURLHelpers.test.ts +394 -238
  81. package/src/index.tsx +6 -3
  82. package/src/scss/grid.scss +249 -20
  83. package/src/scss/main.scss +108 -29
  84. package/src/store/dashboard.actions.ts +17 -4
  85. package/src/store/dashboard.reducer.test.ts +538 -0
  86. package/src/store/dashboard.reducer.ts +135 -22
  87. package/src/test/CdcDashboard.test.tsx +148 -0
  88. package/src/test/CdcDashboardComponent.test.tsx +935 -2
  89. package/src/types/ConfigRow.ts +15 -0
  90. package/src/types/DashboardFilters.ts +4 -0
  91. package/src/types/SharedFilter.ts +1 -0
@@ -0,0 +1,186 @@
1
+ {
2
+ "type": "dashboard",
3
+ "version": "4.26.5",
4
+ "dashboard": {
5
+ "theme": "theme-blue",
6
+ "title": "Regression: Shared Filter Row Delete Cleanup",
7
+ "description": "<p>Use this fixture to delete several rows that participate in shared-filter targeting. The shared filters intentionally include stale <code>usedBy</code> references so cleanup logic has to tolerate missing targets.</p>",
8
+ "sharedFilters": [
9
+ {
10
+ "key": "Region",
11
+ "label": "Region",
12
+ "type": "datafilter",
13
+ "filterStyle": "dropdown",
14
+ "columnName": "Region",
15
+ "showDropdown": true,
16
+ "active": "North",
17
+ "values": ["North", "South"],
18
+ "orderedValues": ["North", "South"],
19
+ "usedBy": ["chart-alpha", "chart-beta", "chart-gamma", "missing-widget"],
20
+ "resetLabel": "Select a region"
21
+ },
22
+ {
23
+ "key": "Status",
24
+ "label": "Status",
25
+ "type": "datafilter",
26
+ "filterStyle": "dropdown",
27
+ "columnName": "Status",
28
+ "showDropdown": true,
29
+ "active": "Open",
30
+ "values": ["Open", "Closed"],
31
+ "orderedValues": ["Open", "Closed"],
32
+ "usedBy": ["chart-alpha", "chart-beta", "missing-widget-2"],
33
+ "resetLabel": "Select a status"
34
+ },
35
+ {
36
+ "key": "Year",
37
+ "label": "Year",
38
+ "type": "datafilter",
39
+ "filterStyle": "dropdown",
40
+ "columnName": "Year",
41
+ "showDropdown": true,
42
+ "active": "2024",
43
+ "values": ["2023", "2024"],
44
+ "orderedValues": ["2023", "2024"],
45
+ "usedBy": ["chart-gamma"],
46
+ "resetLabel": "Select a year"
47
+ }
48
+ ]
49
+ },
50
+ "rows": [
51
+ {
52
+ "columns": [
53
+ {
54
+ "width": 12,
55
+ "widget": "dashboard-filters"
56
+ }
57
+ ]
58
+ },
59
+ {
60
+ "columns": [
61
+ {
62
+ "width": 12,
63
+ "widget": "chart-alpha"
64
+ }
65
+ ]
66
+ },
67
+ {
68
+ "columns": [
69
+ {
70
+ "width": 12,
71
+ "widget": "chart-beta"
72
+ }
73
+ ]
74
+ },
75
+ {
76
+ "columns": [
77
+ {
78
+ "width": 12,
79
+ "widget": "chart-gamma"
80
+ }
81
+ ]
82
+ }
83
+ ],
84
+ "visualizations": {
85
+ "dashboard-filters": {
86
+ "uid": "dashboard-filters",
87
+ "type": "dashboardFilters",
88
+ "visualizationType": "dashboardFilters",
89
+ "sharedFilterIndexes": [0, 1, 2],
90
+ "filterBehavior": "Filter Change",
91
+ "autoLoad": true
92
+ },
93
+ "chart-alpha": {
94
+ "uid": "chart-alpha",
95
+ "type": "chart",
96
+ "visualizationType": "Bar",
97
+ "title": "Row A",
98
+ "dataKey": "shared-filter-data",
99
+ "xAxis": {
100
+ "dataKey": "Label"
101
+ },
102
+ "series": [
103
+ {
104
+ "dataKey": "Value"
105
+ }
106
+ ],
107
+ "theme": "theme-blue"
108
+ },
109
+ "chart-beta": {
110
+ "uid": "chart-beta",
111
+ "type": "chart",
112
+ "visualizationType": "Bar",
113
+ "title": "Row B",
114
+ "dataKey": "shared-filter-data",
115
+ "xAxis": {
116
+ "dataKey": "Label"
117
+ },
118
+ "series": [
119
+ {
120
+ "dataKey": "Value"
121
+ }
122
+ ],
123
+ "theme": "theme-blue"
124
+ },
125
+ "chart-gamma": {
126
+ "uid": "chart-gamma",
127
+ "type": "chart",
128
+ "visualizationType": "Bar",
129
+ "title": "Row C",
130
+ "dataKey": "shared-filter-data",
131
+ "xAxis": {
132
+ "dataKey": "Label"
133
+ },
134
+ "series": [
135
+ {
136
+ "dataKey": "Value"
137
+ }
138
+ ],
139
+ "theme": "theme-blue"
140
+ }
141
+ },
142
+ "datasets": {
143
+ "shared-filter-data": {
144
+ "data": [
145
+ {
146
+ "Region": "North",
147
+ "Status": "Open",
148
+ "Year": "2024",
149
+ "Label": "North Open 2024",
150
+ "Value": 40
151
+ },
152
+ {
153
+ "Region": "North",
154
+ "Status": "Closed",
155
+ "Year": "2024",
156
+ "Label": "North Closed 2024",
157
+ "Value": 22
158
+ },
159
+ {
160
+ "Region": "South",
161
+ "Status": "Open",
162
+ "Year": "2024",
163
+ "Label": "South Open 2024",
164
+ "Value": 15
165
+ },
166
+ {
167
+ "Region": "North",
168
+ "Status": "Open",
169
+ "Year": "2023",
170
+ "Label": "North Open 2023",
171
+ "Value": 30
172
+ }
173
+ ],
174
+ "preview": true,
175
+ "dataFileName": "shared-filter-data.json",
176
+ "dataFileSourceType": "file",
177
+ "dataFileFormat": "JSON"
178
+ }
179
+ },
180
+ "table": {
181
+ "label": "Data Table",
182
+ "show": false,
183
+ "showDownloadUrl": false,
184
+ "showVertical": true
185
+ }
186
+ }
@@ -0,0 +1,181 @@
1
+ {
2
+ "type": "dashboard",
3
+ "version": "4.26.5",
4
+ "dashboard": {
5
+ "theme": "theme-blue",
6
+ "title": "Regression: Stale Dataset Keys",
7
+ "description": "<p>This dashboard mixes valid and stale <code>dataKey</code> references. It is intended to verify that config mapping skips missing datasets instead of crashing.</p>"
8
+ },
9
+ "rows": [
10
+ {
11
+ "columns": [
12
+ {
13
+ "width": 12,
14
+ "widget": "intro-markup"
15
+ }
16
+ ]
17
+ },
18
+ {
19
+ "columns": [
20
+ {
21
+ "width": 6,
22
+ "widget": "valid-viz-data-bite"
23
+ },
24
+ {
25
+ "width": 6,
26
+ "widget": "stale-viz-chart"
27
+ }
28
+ ]
29
+ },
30
+ {
31
+ "dataKey": "missing-row-dataset",
32
+ "dataDescription": {
33
+ "horizontal": false,
34
+ "series": false
35
+ },
36
+ "columns": [
37
+ {
38
+ "width": 6,
39
+ "widget": "stale-row-chart"
40
+ },
41
+ {
42
+ "width": 6,
43
+ "widget": "valid-row-chart"
44
+ }
45
+ ]
46
+ },
47
+ {
48
+ "dataKey": "valid-row-dataset",
49
+ "dataDescription": {
50
+ "horizontal": false,
51
+ "series": false
52
+ },
53
+ "columns": [
54
+ {
55
+ "width": 12,
56
+ "widget": "valid-row-chart-2"
57
+ }
58
+ ]
59
+ }
60
+ ],
61
+ "visualizations": {
62
+ "intro-markup": {
63
+ "uid": "intro-markup",
64
+ "type": "markup-include",
65
+ "visualizationType": "markup-include",
66
+ "theme": "theme-blue",
67
+ "contentEditor": {
68
+ "title": "How to use this fixture",
69
+ "showHeader": true,
70
+ "srcUrl": "",
71
+ "useInlineHTML": true,
72
+ "inlineHTML": "<p><strong>Expected:</strong> the valid widgets render normally, while widgets pointing at missing datasets stay unresolved instead of crashing the page.</p><p>This fixture covers both visualization-level and row-level stale <code>dataKey</code> references.</p>"
73
+ }
74
+ },
75
+ "valid-viz-data-bite": {
76
+ "uid": "valid-viz-data-bite",
77
+ "type": "data-bite",
78
+ "visualizationType": "data-bite",
79
+ "title": "Valid viz.dataKey",
80
+ "biteBody": "This uses a valid dataset and should continue to render.",
81
+ "dataKey": "valid-viz-dataset",
82
+ "dataColumn": "Value",
83
+ "dataFunction": "Pass Through",
84
+ "theme": "theme-blue"
85
+ },
86
+ "stale-viz-chart": {
87
+ "uid": "stale-viz-chart",
88
+ "type": "chart",
89
+ "visualizationType": "Bar",
90
+ "title": "Stale viz.dataKey",
91
+ "dataKey": "renamed-viz-dataset",
92
+ "xAxis": {
93
+ "dataKey": "Category"
94
+ },
95
+ "series": [
96
+ {
97
+ "dataKey": "Value"
98
+ }
99
+ ],
100
+ "theme": "theme-blue"
101
+ },
102
+ "stale-row-chart": {
103
+ "uid": "stale-row-chart",
104
+ "type": "chart",
105
+ "visualizationType": "Bar",
106
+ "title": "Stale row.dataKey",
107
+ "xAxis": {
108
+ "dataKey": "Category"
109
+ },
110
+ "series": [
111
+ {
112
+ "dataKey": "Value"
113
+ }
114
+ ],
115
+ "theme": "theme-blue"
116
+ },
117
+ "valid-row-chart": {
118
+ "uid": "valid-row-chart",
119
+ "type": "markup-include",
120
+ "visualizationType": "markup-include",
121
+ "theme": "theme-blue",
122
+ "contentEditor": {
123
+ "title": "Companion widget",
124
+ "showHeader": true,
125
+ "srcUrl": "",
126
+ "useInlineHTML": true,
127
+ "inlineHTML": "<p>This row deliberately mixes one stale row-level data target with a non-data widget so the row itself can still render while the stale chart stays safely unresolved.</p>"
128
+ }
129
+ },
130
+ "valid-row-chart-2": {
131
+ "uid": "valid-row-chart-2",
132
+ "type": "chart",
133
+ "visualizationType": "Bar",
134
+ "title": "Valid row.dataKey",
135
+ "xAxis": {
136
+ "dataKey": "Category"
137
+ },
138
+ "series": [
139
+ {
140
+ "dataKey": "Value"
141
+ }
142
+ ],
143
+ "theme": "theme-blue"
144
+ }
145
+ },
146
+ "datasets": {
147
+ "valid-viz-dataset": {
148
+ "data": [
149
+ {
150
+ "Value": 123
151
+ }
152
+ ],
153
+ "preview": true,
154
+ "dataFileName": "valid-viz-dataset.json",
155
+ "dataFileSourceType": "file",
156
+ "dataFileFormat": "JSON"
157
+ },
158
+ "valid-row-dataset": {
159
+ "data": [
160
+ {
161
+ "Category": "Valid Row A",
162
+ "Value": 10
163
+ },
164
+ {
165
+ "Category": "Valid Row B",
166
+ "Value": 25
167
+ }
168
+ ],
169
+ "preview": true,
170
+ "dataFileName": "valid-row-dataset.json",
171
+ "dataFileSourceType": "file",
172
+ "dataFileFormat": "JSON"
173
+ }
174
+ },
175
+ "table": {
176
+ "label": "Data Table",
177
+ "show": false,
178
+ "showDownloadUrl": false,
179
+ "showVertical": true
180
+ }
181
+ }
@@ -0,0 +1,190 @@
1
+ {
2
+ "type": "dashboard",
3
+ "version": "4.26.5",
4
+ "dashboard": {
5
+ "theme": "theme-blue",
6
+ "title": "Regression: Tiered Filtering",
7
+ "description": "<p>This fixture supports 1-tier, 2-tier, and 3-tier checks on the same page. The saved <code>tier</code> values are intentionally strings so save/reload does not depend on number parsing.</p>",
8
+ "sharedFilters": [
9
+ {
10
+ "key": "Region",
11
+ "label": "Region",
12
+ "type": "datafilter",
13
+ "filterStyle": "dropdown",
14
+ "columnName": "Region",
15
+ "showDropdown": true,
16
+ "active": "North",
17
+ "values": ["North", "South"],
18
+ "orderedValues": ["North", "South"],
19
+ "usedBy": ["chart-tier-1", "chart-tier-2", "chart-tier-3"],
20
+ "tier": "1",
21
+ "resetLabel": "Select a region"
22
+ },
23
+ {
24
+ "key": "Category",
25
+ "label": "Category",
26
+ "type": "datafilter",
27
+ "filterStyle": "dropdown",
28
+ "columnName": "Category",
29
+ "showDropdown": true,
30
+ "active": "Alpha",
31
+ "values": ["Alpha", "Beta"],
32
+ "orderedValues": ["Alpha", "Beta"],
33
+ "usedBy": ["chart-tier-2", "chart-tier-3"],
34
+ "parents": ["Region"],
35
+ "tier": "2",
36
+ "resetLabel": "Select a category"
37
+ },
38
+ {
39
+ "key": "Detail",
40
+ "label": "Detail",
41
+ "type": "datafilter",
42
+ "filterStyle": "dropdown",
43
+ "columnName": "Detail",
44
+ "showDropdown": true,
45
+ "active": "One",
46
+ "values": ["One", "Two"],
47
+ "orderedValues": ["One", "Two"],
48
+ "usedBy": ["chart-tier-3"],
49
+ "parents": ["Category"],
50
+ "tier": "3",
51
+ "resetLabel": "Select a detail"
52
+ }
53
+ ]
54
+ },
55
+ "rows": [
56
+ {
57
+ "columns": [
58
+ {
59
+ "width": 12,
60
+ "widget": "tiered-filters"
61
+ }
62
+ ]
63
+ },
64
+ {
65
+ "columns": [
66
+ {
67
+ "width": 4,
68
+ "widget": "chart-tier-1"
69
+ },
70
+ {
71
+ "width": 4,
72
+ "widget": "chart-tier-2"
73
+ },
74
+ {
75
+ "width": 4,
76
+ "widget": "chart-tier-3"
77
+ }
78
+ ]
79
+ }
80
+ ],
81
+ "visualizations": {
82
+ "tiered-filters": {
83
+ "uid": "tiered-filters",
84
+ "type": "dashboardFilters",
85
+ "visualizationType": "dashboardFilters",
86
+ "sharedFilterIndexes": [0, 1, 2],
87
+ "filterBehavior": "Filter Change",
88
+ "autoLoad": true
89
+ },
90
+ "chart-tier-1": {
91
+ "uid": "chart-tier-1",
92
+ "type": "chart",
93
+ "visualizationType": "Bar",
94
+ "title": "1 tier: Region only",
95
+ "dataKey": "tiered-filter-data",
96
+ "xAxis": {
97
+ "dataKey": "Label"
98
+ },
99
+ "series": [
100
+ {
101
+ "dataKey": "Value"
102
+ }
103
+ ],
104
+ "theme": "theme-blue"
105
+ },
106
+ "chart-tier-2": {
107
+ "uid": "chart-tier-2",
108
+ "type": "chart",
109
+ "visualizationType": "Bar",
110
+ "title": "2 tiers: Region + Category",
111
+ "dataKey": "tiered-filter-data",
112
+ "xAxis": {
113
+ "dataKey": "Label"
114
+ },
115
+ "series": [
116
+ {
117
+ "dataKey": "Value"
118
+ }
119
+ ],
120
+ "theme": "theme-blue"
121
+ },
122
+ "chart-tier-3": {
123
+ "uid": "chart-tier-3",
124
+ "type": "chart",
125
+ "visualizationType": "Bar",
126
+ "title": "3 tiers: Region + Category + Detail",
127
+ "dataKey": "tiered-filter-data",
128
+ "xAxis": {
129
+ "dataKey": "Label"
130
+ },
131
+ "series": [
132
+ {
133
+ "dataKey": "Value"
134
+ }
135
+ ],
136
+ "theme": "theme-blue"
137
+ }
138
+ },
139
+ "datasets": {
140
+ "tiered-filter-data": {
141
+ "data": [
142
+ {
143
+ "Region": "North",
144
+ "Category": "Alpha",
145
+ "Detail": "One",
146
+ "Label": "North Alpha One",
147
+ "Value": 11
148
+ },
149
+ {
150
+ "Region": "North",
151
+ "Category": "Alpha",
152
+ "Detail": "Two",
153
+ "Label": "North Alpha Two",
154
+ "Value": 12
155
+ },
156
+ {
157
+ "Region": "North",
158
+ "Category": "Beta",
159
+ "Detail": "One",
160
+ "Label": "North Beta One",
161
+ "Value": 13
162
+ },
163
+ {
164
+ "Region": "South",
165
+ "Category": "Alpha",
166
+ "Detail": "One",
167
+ "Label": "South Alpha One",
168
+ "Value": 21
169
+ },
170
+ {
171
+ "Region": "South",
172
+ "Category": "Beta",
173
+ "Detail": "Two",
174
+ "Label": "South Beta Two",
175
+ "Value": 22
176
+ }
177
+ ],
178
+ "preview": true,
179
+ "dataFileName": "tiered-filter-data.json",
180
+ "dataFileSourceType": "file",
181
+ "dataFileFormat": "JSON"
182
+ }
183
+ },
184
+ "table": {
185
+ "label": "Data Table",
186
+ "show": false,
187
+ "showDownloadUrl": false,
188
+ "showVertical": true
189
+ }
190
+ }