@cdc/core 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/_stories/StoryRenderingTests.stories.tsx +164 -0
- package/components/AdvancedEditor/AdvancedEditor.tsx +32 -9
- package/components/CustomColorsEditor/CustomColorsEditor.css +299 -0
- package/components/CustomColorsEditor/CustomColorsEditor.tsx +209 -0
- package/components/CustomColorsEditor/index.ts +1 -0
- package/components/DataTable/DataTable.tsx +56 -38
- package/components/DataTable/DataTableStandAlone.tsx +8 -3
- package/components/DataTable/components/ChartHeader.tsx +44 -14
- package/components/DataTable/components/DataTableEditorPanel.tsx +12 -2
- package/components/DataTable/components/ExpandCollapse.tsx +10 -1
- package/components/DataTable/components/MapHeader.tsx +24 -13
- package/components/DataTable/data-table.css +12 -0
- package/components/DataTable/helpers/chartCellMatrix.tsx +11 -8
- package/components/DataTable/helpers/mapCellMatrix.tsx +33 -4
- package/components/DataTable/helpers/standardizeState.js +2 -2
- package/components/DataTable/helpers/tests/standardizeState.test.js +54 -0
- package/components/DownloadButton.tsx +40 -14
- package/components/EditorPanel/DataTableEditor.tsx +3 -3
- package/components/EditorPanel/EditorPanel.styles.css +423 -0
- package/components/EditorPanel/FootnotesEditor.tsx +44 -37
- package/components/EditorPanel/Inputs.tsx +12 -2
- package/components/EditorPanel/VizFilterEditor/NestedDropdownEditor.tsx +35 -62
- package/components/EditorPanel/VizFilterEditor/VizFilterEditor.tsx +12 -2
- package/components/EditorPanel/components/MarkupHighlightedTextField.tsx +227 -0
- package/components/EditorPanel/components/MarkupVariablesEditor.tsx +450 -0
- package/components/EditorPanel/components/PanelMarkup.tsx +59 -0
- package/components/ErrorBoundary.jsx +3 -1
- package/components/Filters/Filters.tsx +52 -24
- package/components/Filters/components/Dropdown.tsx +6 -1
- package/components/Filters/components/Tabs.tsx +1 -0
- package/components/Footnotes/Footnotes.tsx +35 -25
- package/components/Footnotes/FootnotesStandAlone.tsx +42 -6
- package/components/HeaderThemeSelector/HeaderThemeSelector.css +43 -0
- package/components/HeaderThemeSelector/HeaderThemeSelector.stories.tsx +74 -0
- package/components/HeaderThemeSelector/HeaderThemeSelector.tsx +61 -0
- package/components/HeaderThemeSelector/index.ts +2 -0
- package/components/Layout/styles/editor.scss +2 -1
- package/components/Legend/Legend.Gradient.tsx +3 -6
- package/components/LegendShape.tsx +121 -3
- package/components/Loader/Loader.tsx +1 -1
- package/components/MediaControls.tsx +72 -21
- package/components/PaletteConversionModal.tsx +90 -0
- package/components/PaletteSelector/DeveloperPaletteRollback.tsx +114 -0
- package/components/PaletteSelector/PaletteSelector.css +94 -0
- package/components/PaletteSelector/PaletteSelector.tsx +112 -0
- package/components/PaletteSelector/index.ts +2 -0
- package/components/RichTooltip/RichTooltip.tsx +1 -0
- package/components/Table/Table.tsx +3 -1
- package/components/Table/components/Cell.tsx +23 -2
- package/components/Table/components/Row.tsx +5 -3
- package/components/_stories/BlurStrokeTest.stories.tsx +1 -1
- package/components/_stories/DataTable.stories.tsx +1 -1
- package/components/_stories/Filters.stories.tsx +21 -2
- package/components/_stories/Footnotes.CSV.stories.tsx +247 -0
- package/components/_stories/Footnotes.stories.tsx +769 -4
- package/components/_stories/Inputs.stories.tsx +3 -3
- package/components/_stories/MultiSelect.stories.tsx +3 -3
- package/components/_stories/NestedDropdown.stories.tsx +1 -1
- package/components/_stories/Table.stories.tsx +1 -1
- package/components/_stories/styles.scss +0 -1
- package/components/elements/_stories/Button.stories.tsx +1 -1
- package/components/elements/_stories/Card.stories.tsx +1 -1
- package/components/inputs/InputToggle.tsx +2 -0
- package/components/managers/DataDesigner.tsx +10 -9
- package/components/managers/_stories/DataDesigner.stories.tsx +1 -1
- package/components/ui/Accordion.jsx +1 -1
- package/components/ui/Tooltip.tsx +2 -1
- package/components/ui/_stories/Accordion.stories.tsx +1 -1
- package/components/ui/_stories/ColorPaletteMigration.stories.mdx +275 -0
- package/components/ui/_stories/Colors.stories.tsx +330 -0
- package/components/ui/_stories/IconGallery.stories.tsx +316 -0
- package/components/ui/_stories/Title.stories.tsx +1 -1
- package/components/ui/accordion.styles.css +57 -0
- package/contexts/EditorContext.ts +18 -0
- package/contexts/editor.actions.ts +28 -0
- package/contexts/editor.reducer.ts +94 -0
- package/data/chartColorPalettes.ts +118 -0
- package/data/colorPalettes.ts +9 -0
- package/data/mapColorPalettes.ts +45 -0
- package/data/sharedPalettes.ts +50 -0
- package/dist/cove-main.css +63 -14
- package/dist/cove-main.css.map +1 -1
- package/generateViteConfig.js +80 -0
- package/helpers/addValuesToFilters.ts +7 -3
- package/helpers/cloneConfig.ts +31 -0
- package/helpers/configDataHelpers.ts +128 -0
- package/helpers/configHelpers.ts +27 -0
- package/helpers/constants.ts +42 -2
- package/helpers/cove/number.ts +33 -12
- package/helpers/coveUpdateWorker.ts +15 -3
- package/helpers/fetchRemoteData.ts +3 -15
- package/helpers/filterColorPalettes.ts +152 -0
- package/helpers/generateColorsArray.ts +13 -0
- package/helpers/getColorPaletteVersion.ts +33 -0
- package/helpers/getPaletteAccessor.ts +18 -0
- package/helpers/markupProcessor.ts +220 -0
- package/helpers/mergeCustomOrderValues.ts +37 -0
- package/helpers/metrics/helpers.ts +42 -19
- package/helpers/metrics/types.ts +48 -9
- package/helpers/metrics/utils.ts +34 -0
- package/helpers/palettes/colorDistributions.ts +56 -0
- package/helpers/palettes/migratePaletteName.ts +150 -0
- package/helpers/palettes/standardizePaletteNames.ts +77 -0
- package/helpers/palettes/utils.ts +267 -0
- package/helpers/parseCsvWithQuotes.ts +65 -0
- package/helpers/queryStringUtils.ts +13 -0
- package/helpers/testing.ts +358 -0
- package/helpers/tests/addValuesToFilters.test.ts +1 -2
- package/helpers/tests/generateColorsArray.test.ts +24 -0
- package/helpers/tests/markupProcessor.test.ts +538 -0
- package/helpers/tests/testStandaloneBuild.ts +44 -0
- package/helpers/useMarkupVariables.ts +31 -0
- package/helpers/vegaConfig.ts +0 -1
- package/helpers/ver/4.24.10.ts +2 -1
- package/helpers/ver/4.24.11.ts +2 -1
- package/helpers/ver/4.24.3.ts +2 -1
- package/helpers/ver/4.24.4.ts +2 -1
- package/helpers/ver/4.24.5.ts +2 -1
- package/helpers/ver/4.24.7.ts +2 -1
- package/helpers/ver/4.24.9.ts +2 -1
- package/helpers/ver/4.25.1.ts +2 -1
- package/helpers/ver/4.25.10.ts +36 -0
- package/helpers/ver/4.25.11.ts +13 -0
- package/helpers/ver/4.25.3.ts +2 -1
- package/helpers/ver/4.25.4.ts +2 -1
- package/helpers/ver/4.25.6.ts +2 -1
- package/helpers/ver/4.25.7.ts +2 -1
- package/helpers/ver/4.25.8.ts +2 -1
- package/helpers/ver/4.25.9.ts +293 -0
- package/helpers/ver/tests/4.25.10.test.ts +204 -0
- package/helpers/ver/tests/4.25.8.test.ts +1 -1
- package/helpers/ver/tests/4.25.9.test.ts +51 -0
- package/helpers/viewports.ts +2 -0
- package/hooks/useColorPalette.ts +79 -0
- package/package.json +13 -4
- package/styles/_common-components.css +73 -0
- package/styles/_global.scss +32 -10
- package/styles/base.scss +8 -55
- package/styles/cove-main.scss +3 -1
- package/styles/filters.scss +10 -3
- package/styles/v2/base/index.scss +0 -1
- package/styles/v2/components/button.scss +4 -3
- package/styles/v2/components/editor.scss +16 -7
- package/styles/v2/layout/_data-table.scss +3 -2
- package/styles/v2/themes/_color-definitions.scss +18 -17
- package/styles/v2/utils/_breakpoints.scss +1 -1
- package/styles/v2/utils/index.scss +0 -1
- package/styles/waiting.scss +1 -1
- package/testing-setup.js +32 -0
- package/types/MarkupInclude.ts +8 -2
- package/types/MarkupVariable.ts +19 -0
- package/types/VizFilter.ts +2 -0
- package/vitest.config.ts +16 -0
- package/components/ui/_stories/Colors.stories.mdx +0 -220
- package/components/ui/_stories/IconGallery.stories.mdx +0 -14
- package/data/colorPalettes.js +0 -171
- package/helpers/formatConfigBeforeSave.ts +0 -135
- package/helpers/tests/formatConfigBeforeSave.test.ts +0 -68
- package/styles/_mixins.scss +0 -13
- package/styles/v2/base/_typography.scss +0 -0
- package/styles/v2/components/guidance-block.scss +0 -74
- package/styles/v2/utils/_functions.scss +0 -0
- /package/{styles/_typography.scss → testBuild.js} +0 -0
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import Footnotes from '@cdc/core/types/Footnotes'
|
|
2
|
-
import { AnyVisualization, Visualization } from '@cdc/core/types/Visualization'
|
|
3
|
-
import { DashboardConfig } from '@cdc/dashboard/src/types/DashboardConfig'
|
|
4
|
-
import { removeDashboardFilter } from '@cdc/dashboard/src/helpers/removeDashboardFilter'
|
|
5
|
-
import _ from 'lodash'
|
|
6
|
-
|
|
7
|
-
const cleanDashboardFootnotes = (config: DashboardConfig) => {
|
|
8
|
-
if (config.visualizations) {
|
|
9
|
-
Object.keys(config.visualizations).forEach(vizKey => {
|
|
10
|
-
const viz: Visualization = config.visualizations[vizKey]
|
|
11
|
-
if (viz.footnotes) {
|
|
12
|
-
delete config.visualizations[vizKey].footnotes.data
|
|
13
|
-
delete config.visualizations[vizKey].footnotes.formattedData
|
|
14
|
-
}
|
|
15
|
-
})
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const cleanDashboardData = (config: DashboardConfig) => {
|
|
20
|
-
if (config.datasets) {
|
|
21
|
-
Object.keys(config.datasets).forEach(datasetKey => {
|
|
22
|
-
delete config.datasets[datasetKey].formattedData
|
|
23
|
-
if (config.datasets[datasetKey].dataUrl) {
|
|
24
|
-
delete config.datasets[datasetKey].data
|
|
25
|
-
}
|
|
26
|
-
})
|
|
27
|
-
}
|
|
28
|
-
if (config.visualizations) {
|
|
29
|
-
Object.keys(config.visualizations).forEach(vizKey => {
|
|
30
|
-
config.visualizations[vizKey] = _.omit(config.visualizations[vizKey], [
|
|
31
|
-
'runtime',
|
|
32
|
-
'formattedData',
|
|
33
|
-
'data',
|
|
34
|
-
'editing',
|
|
35
|
-
'originalFormattedData'
|
|
36
|
-
])
|
|
37
|
-
})
|
|
38
|
-
}
|
|
39
|
-
if (config.rows) {
|
|
40
|
-
config.rows.forEach((row, i) => {
|
|
41
|
-
if (row.dataKey) {
|
|
42
|
-
config.rows[i] = _.omit(row, ['data', 'formattedData'])
|
|
43
|
-
}
|
|
44
|
-
})
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export const cleanSharedFilters = (config: DashboardConfig) => {
|
|
49
|
-
if (config.dashboard?.sharedFilters) {
|
|
50
|
-
const recursiveRemoveFilters = (sharedFilters, visualizations: Record<string, AnyVisualization>) => {
|
|
51
|
-
const usedFilters = _.uniq(
|
|
52
|
-
Object.values(visualizations).reduce((acc, viz) => {
|
|
53
|
-
if (viz.type === 'dashboardFilters') {
|
|
54
|
-
acc = acc.concat(viz.sharedFilterIndexes)
|
|
55
|
-
}
|
|
56
|
-
return acc
|
|
57
|
-
}, [])
|
|
58
|
-
)
|
|
59
|
-
for (let index = 0; index < sharedFilters.length; index++) {
|
|
60
|
-
const filter = sharedFilters[index]
|
|
61
|
-
if (!usedFilters.includes(index)) {
|
|
62
|
-
const [newSharedFilters, newVisualizations] = removeDashboardFilter(
|
|
63
|
-
index,
|
|
64
|
-
config.dashboard.sharedFilters,
|
|
65
|
-
config.visualizations
|
|
66
|
-
)
|
|
67
|
-
config.dashboard.sharedFilters = newSharedFilters
|
|
68
|
-
config.visualizations = newVisualizations
|
|
69
|
-
recursiveRemoveFilters(newSharedFilters, newVisualizations)
|
|
70
|
-
break
|
|
71
|
-
} else {
|
|
72
|
-
delete config.dashboard.sharedFilters[index].active
|
|
73
|
-
if (filter.subGrouping) delete config.dashboard.sharedFilters[index].subGrouping.active
|
|
74
|
-
if (filter.type === 'urlfilter') {
|
|
75
|
-
delete config.dashboard.sharedFilters[index].values
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
recursiveRemoveFilters(config.dashboard.sharedFilters, config.visualizations)
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const cleanVisualizationFilters = (config: DashboardConfig) => {
|
|
86
|
-
if (config.visualizations) {
|
|
87
|
-
Object.keys(config.visualizations).forEach(vizKey => {
|
|
88
|
-
const vizFilters = config.visualizations[vizKey].filters || []
|
|
89
|
-
vizFilters.forEach((_filter, index) => {
|
|
90
|
-
delete config.visualizations[vizKey].filters[index].active
|
|
91
|
-
delete config.visualizations[vizKey].filters[index].values
|
|
92
|
-
})
|
|
93
|
-
})
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const removeRuntimeDataURLs = (config: DashboardConfig) => {
|
|
98
|
-
if (config.datasets) {
|
|
99
|
-
Object.keys(config.datasets).forEach(datasetKey => {
|
|
100
|
-
delete config.datasets[datasetKey].runtimeDataUrl
|
|
101
|
-
})
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export const formatConfigBeforeSave = configToStrip => {
|
|
106
|
-
const strippedConfig = _.cloneDeep(configToStrip)
|
|
107
|
-
if (strippedConfig.type === 'dashboard') {
|
|
108
|
-
if (strippedConfig.multiDashboards) {
|
|
109
|
-
strippedConfig.multiDashboards.forEach((multiDashboard, i) => {
|
|
110
|
-
cleanDashboardData(strippedConfig.multiDashboards[i])
|
|
111
|
-
cleanSharedFilters(strippedConfig.multiDashboards[i])
|
|
112
|
-
cleanDashboardFootnotes(strippedConfig.multiDashboards[i])
|
|
113
|
-
cleanVisualizationFilters(strippedConfig.multiDashboards[i])
|
|
114
|
-
})
|
|
115
|
-
delete strippedConfig.dashboard
|
|
116
|
-
delete strippedConfig.rows
|
|
117
|
-
delete strippedConfig.visualizations
|
|
118
|
-
delete strippedConfig.label
|
|
119
|
-
}
|
|
120
|
-
delete strippedConfig.activeDashboard
|
|
121
|
-
cleanDashboardData(strippedConfig)
|
|
122
|
-
cleanSharedFilters(strippedConfig)
|
|
123
|
-
cleanDashboardFootnotes(strippedConfig)
|
|
124
|
-
cleanVisualizationFilters(strippedConfig)
|
|
125
|
-
removeRuntimeDataURLs(strippedConfig)
|
|
126
|
-
} else {
|
|
127
|
-
delete strippedConfig.runtime
|
|
128
|
-
delete strippedConfig.formattedData
|
|
129
|
-
if (strippedConfig.dataUrl) {
|
|
130
|
-
delete strippedConfig.data
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
return strippedConfig
|
|
135
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest'
|
|
2
|
-
import { cleanSharedFilters } from '../formatConfigBeforeSave'
|
|
3
|
-
import { DashboardConfig } from '@cdc/dashboard/src/types/DashboardConfig'
|
|
4
|
-
|
|
5
|
-
describe('cleanSharedFilters', () => {
|
|
6
|
-
it('should remove unused shared filters', () => {
|
|
7
|
-
const config: DashboardConfig = {
|
|
8
|
-
dashboard: {
|
|
9
|
-
sharedFilters: [
|
|
10
|
-
{ id: 1, type: 'filter1' },
|
|
11
|
-
{ id: 2, type: 'filter2' },
|
|
12
|
-
{ id: 3, type: 'filter3' },
|
|
13
|
-
{ id: 4, type: 'filter4' }
|
|
14
|
-
]
|
|
15
|
-
},
|
|
16
|
-
visualizations: {
|
|
17
|
-
viz1: { type: 'dashboardFilters', sharedFilterIndexes: [0, 3] },
|
|
18
|
-
viz2: { type: 'chart'}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
cleanSharedFilters(config)
|
|
23
|
-
|
|
24
|
-
expect(config.dashboard.sharedFilters).toEqual([{ id: 1, type: 'filter1' }, { id: 4, type: 'filter4' }])
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
it('should retain used shared filters and remove their active state', () => {
|
|
28
|
-
const config: DashboardConfig = {
|
|
29
|
-
dashboard: {
|
|
30
|
-
sharedFilters: [
|
|
31
|
-
{ id: 1, type: 'filter1', active: true },
|
|
32
|
-
{ id: 2, type: 'filter2', active: true }
|
|
33
|
-
]
|
|
34
|
-
},
|
|
35
|
-
visualizations: {
|
|
36
|
-
viz1: { type: 'dashboardFilters', sharedFilterIndexes: [0] },
|
|
37
|
-
viz2: { type: 'dashboardFilters', sharedFilterIndexes: [1] }
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
cleanSharedFilters(config)
|
|
42
|
-
|
|
43
|
-
expect(config.dashboard.sharedFilters).toEqual([
|
|
44
|
-
{ id: 1, type: 'filter1' },
|
|
45
|
-
{ id: 2, type: 'filter2' }
|
|
46
|
-
])
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
it('should remove values from urlfilter type shared filters', () => {
|
|
50
|
-
const config: DashboardConfig = {
|
|
51
|
-
dashboard: {
|
|
52
|
-
sharedFilters: [
|
|
53
|
-
{ id: 1, type: 'urlfilter', values: [1, 2, 3] },
|
|
54
|
-
{ id: 2, type: 'filter2' }
|
|
55
|
-
]
|
|
56
|
-
},
|
|
57
|
-
visualizations: {
|
|
58
|
-
viz1: { type: 'dashboardFilters', sharedFilterIndexes: [0] }
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
cleanSharedFilters(config)
|
|
63
|
-
|
|
64
|
-
expect(config.dashboard.sharedFilters).toEqual([
|
|
65
|
-
{ id: 1, type: 'urlfilter' }
|
|
66
|
-
])
|
|
67
|
-
})
|
|
68
|
-
})
|
package/styles/_mixins.scss
DELETED
|
File without changes
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
@import '../utils/variables';
|
|
2
|
-
@import '../themes/color-definitions';
|
|
3
|
-
|
|
4
|
-
.cove-guidance-block {
|
|
5
|
-
display: block;
|
|
6
|
-
position: relative;
|
|
7
|
-
padding: 0.75rem 1rem;
|
|
8
|
-
margin-left: 5px;
|
|
9
|
-
color: #444;
|
|
10
|
-
text-decoration: none;
|
|
11
|
-
border: $lightGray 1px solid;
|
|
12
|
-
border-left: none;
|
|
13
|
-
border-radius: 0 0.1875rem 0.1875rem 0;
|
|
14
|
-
transition: all 200ms $transition-expo-out;
|
|
15
|
-
|
|
16
|
-
&:before {
|
|
17
|
-
content: '';
|
|
18
|
-
position: absolute;
|
|
19
|
-
top: -1px;
|
|
20
|
-
left: -5px;
|
|
21
|
-
bottom: -1px;
|
|
22
|
-
width: 5px;
|
|
23
|
-
background: $blue;
|
|
24
|
-
border-radius: 0.1875rem 0 0 0.1875rem;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
&:hover,
|
|
28
|
-
&:focus,
|
|
29
|
-
&:active {
|
|
30
|
-
background: $lightestGray;
|
|
31
|
-
color: #444;
|
|
32
|
-
transition: 0.2s all;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
&:after {
|
|
36
|
-
content: '';
|
|
37
|
-
position: absolute;
|
|
38
|
-
inset: 0;
|
|
39
|
-
left: -4px;
|
|
40
|
-
margin: -4px;
|
|
41
|
-
border-radius: 0.1875rem;
|
|
42
|
-
outline: 2px solid transparent;
|
|
43
|
-
transition: outline 200ms $transition-expo-out;
|
|
44
|
-
pointer-events: none;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
&:focus,
|
|
48
|
-
&:active {
|
|
49
|
-
outline: none;
|
|
50
|
-
|
|
51
|
-
&:after {
|
|
52
|
-
outline: 2px solid rgba(161, 161, 161, 0.6);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
svg {
|
|
57
|
-
width: 60px;
|
|
58
|
-
color: $blue;
|
|
59
|
-
margin-right: 1rem;
|
|
60
|
-
|
|
61
|
-
path {
|
|
62
|
-
fill: currentColor;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.cove-guidance-block__header {
|
|
68
|
-
font-weight: bold;
|
|
69
|
-
font-size: 1.125rem;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.cove-guidance-block__content {
|
|
73
|
-
font-size: 0.875rem;
|
|
74
|
-
}
|
|
File without changes
|
|
File without changes
|