@cdc/core 4.24.3 → 4.24.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 (72) hide show
  1. package/assets/icon-command.svg +3 -0
  2. package/assets/icon-rotate-left.svg +3 -0
  3. package/components/AdvancedEditor.jsx +9 -0
  4. package/components/DataTable/DataTable.tsx +20 -15
  5. package/components/DataTable/DataTableStandAlone.tsx +51 -4
  6. package/components/DataTable/components/ChartHeader.tsx +3 -2
  7. package/components/DataTable/components/DataTableEditorPanel.tsx +20 -3
  8. package/components/DataTable/components/ExpandCollapse.tsx +22 -16
  9. package/components/DataTable/helpers/chartCellMatrix.tsx +3 -2
  10. package/components/DataTable/helpers/getChartCellValue.ts +21 -1
  11. package/components/DataTable/helpers/getDataSeriesColumns.ts +37 -16
  12. package/components/DataTable/helpers/getSeriesName.ts +2 -1
  13. package/components/DataTable/helpers/mapCellMatrix.tsx +2 -2
  14. package/components/DataTable/helpers/{customColumns.ts → removeNullColumns.ts} +3 -3
  15. package/components/DataTable/types/TableConfig.ts +11 -21
  16. package/components/EditorPanel/ColumnsEditor.tsx +304 -260
  17. package/components/EditorPanel/DataTableEditor.tsx +119 -48
  18. package/components/EditorPanel/VizFilterEditor.tsx +234 -0
  19. package/components/EditorWrapper/EditorWrapper.tsx +48 -0
  20. package/components/EditorWrapper/editor-wrapper.style.css +14 -0
  21. package/components/Filters.jsx +78 -61
  22. package/components/Layout/components/Responsive.tsx +184 -0
  23. package/components/Layout/components/Sidebar/components/Sidebar.tsx +47 -0
  24. package/components/Layout/components/Sidebar/components/sidebar.styles.scss +902 -0
  25. package/components/Layout/components/Sidebar/index.tsx +3 -0
  26. package/components/Layout/components/Visualization/index.tsx +81 -0
  27. package/components/Layout/components/Visualization/visualizations.scss +33 -0
  28. package/components/Layout/index.tsx +11 -0
  29. package/components/Layout/styles/editor-grid-view.scss +156 -0
  30. package/components/Layout/styles/editor-utils.scss +197 -0
  31. package/components/Layout/styles/editor.scss +144 -0
  32. package/components/LegendCircle.jsx +4 -3
  33. package/components/MediaControls.jsx +1 -1
  34. package/components/Table/Table.tsx +7 -5
  35. package/components/Table/components/Row.tsx +6 -2
  36. package/components/Table/types/RowType.ts +3 -0
  37. package/components/Waiting.jsx +11 -1
  38. package/components/_stories/DataTable.stories.tsx +1 -2
  39. package/components/_stories/EditorPanel.stories.tsx +1 -0
  40. package/components/createBarElement.jsx +37 -34
  41. package/components/elements/SkipTo.tsx +37 -5
  42. package/components/managers/DataDesigner.tsx +18 -18
  43. package/components/ui/Icon.tsx +5 -1
  44. package/helpers/DataTransform.ts +9 -32
  45. package/helpers/coveUpdateWorker.ts +21 -0
  46. package/helpers/footnoteSymbols.ts +11 -0
  47. package/helpers/useDataVizClasses.js +1 -5
  48. package/helpers/ver/4.23.4.ts +27 -0
  49. package/helpers/ver/4.24.3.ts +56 -0
  50. package/helpers/ver/4.24.5.ts +32 -0
  51. package/package.json +2 -2
  52. package/styles/_data-table.scss +8 -0
  53. package/styles/_global.scss +7 -4
  54. package/styles/_reset.scss +7 -6
  55. package/styles/_variables.scss +3 -0
  56. package/styles/base.scss +0 -18
  57. package/styles/v2/base/index.scss +1 -1
  58. package/styles/v2/components/ui/tooltip.scss +0 -21
  59. package/types/Axis.ts +4 -0
  60. package/types/Column.ts +1 -0
  61. package/types/ConfigureData.ts +8 -0
  62. package/types/DataDescription.ts +9 -0
  63. package/types/Legend.ts +1 -0
  64. package/types/MarkupInclude.ts +26 -0
  65. package/types/Runtime.ts +1 -0
  66. package/types/Series.ts +1 -1
  67. package/types/Table.ts +15 -13
  68. package/types/Visualization.ts +14 -10
  69. package/types/VizFilter.ts +13 -0
  70. package/helpers/coveUpdateWorker.js +0 -19
  71. package/helpers/ver/4.23.js +0 -10
  72. package/helpers/ver/4.24.3.js +0 -25
@@ -28,6 +28,9 @@ div.data-table-heading {
28
28
  z-index: 2;
29
29
  position: relative;
30
30
  }
31
+ @include breakpoint(xs) {
32
+ font-size: $font-small + 0.2em;
33
+ }
31
34
  }
32
35
 
33
36
  table.horizontal {
@@ -139,6 +142,7 @@ table.data-table {
139
142
 
140
143
  td {
141
144
  padding: 0.3em 0.7em;
145
+
142
146
  border-right: 1px solid rgba(0, 0, 0, 0.1);
143
147
  }
144
148
 
@@ -151,6 +155,10 @@ table.data-table {
151
155
  &:last-child {
152
156
  border-right: 0 !important;
153
157
  }
158
+
159
+ @include breakpoint(xs) {
160
+ font-size: $font-small;
161
+ }
154
162
  }
155
163
  tr {
156
164
  & > * {
@@ -38,7 +38,11 @@ strong {
38
38
  border: 0 !important;
39
39
  display: flex;
40
40
  }
41
-
41
+ .cdcdataviz-sr-only-focusable:focus {
42
+ width: fit-content;
43
+ margin-bottom: 0.5em;
44
+ margin-left: 1em;
45
+ }
42
46
  .inline-icon {
43
47
  width: 1em !important;
44
48
  height: auto !important;
@@ -80,9 +84,9 @@ strong {
80
84
  }
81
85
  &.danger {
82
86
  background-color: $red;
83
- padding: 0em 0.6em 0.0em;
87
+ padding: 0em 0.6em 0em;
84
88
  height: 1.6em;
85
- font-size: 0.8 em;
89
+ font-size: 0.8 em;
86
90
  color: #fff;
87
91
  &:hover {
88
92
  background-color: darken($red, 5%);
@@ -193,4 +197,3 @@ section.footnotes {
193
197
  .margin-left-href {
194
198
  margin-left: 15px;
195
199
  }
196
-
@@ -141,15 +141,16 @@
141
141
  top: -0.5em;
142
142
  }
143
143
 
144
- header sup {
145
- /* Allow line breaks using html in the header. */
146
- top: initial;
147
- line-height: initial;
148
- }
149
-
150
144
  sub {
151
145
  /* Move the subscripted text down, but only
152
146
  half as far down as the superscript moved up */
153
147
  bottom: -0.25em;
154
148
  }
149
+
150
+ ul > li:first-child {
151
+ margin-top: auto;
152
+ }
153
+ ul > li:last-of-type {
154
+ margin-bottom: auto;
155
+ }
155
156
  }
@@ -61,3 +61,6 @@ $amber-primary: #fbab18 !default;
61
61
  $amber-secondary: #ffd54f !default;
62
62
  $amber-tertiary: #ffecb3 !default;
63
63
  $amber-quaternary: #fff7e1 !default;
64
+
65
+ /// Fonts
66
+ $font-small: 0.7em;
package/styles/base.scss CHANGED
@@ -82,24 +82,6 @@ body.post-type-cdc_visualization .cdc-editor .configure .editor-panel {
82
82
  color-adjust: exact !important; /* Firefox 48 – 96 */
83
83
  print-color-adjust: exact !important; /* Firefox 97+, Safari 15.4+ */
84
84
 
85
- .editor-panel.cove {
86
- position: absolute;
87
- height: 100vh;
88
- top: 0;
89
- max-width: 350px;
90
- width: 350px;
91
-
92
- .editor-toggle {
93
- position: absolute !important;
94
- top: 10px !important;
95
- }
96
-
97
- .editor-panel {
98
- position: absolute !important;
99
- top: 0 !important;
100
- }
101
- }
102
-
103
85
  $theme: (
104
86
  'amber': (
105
87
  '#fbab18',
@@ -1,4 +1,4 @@
1
- //@import "reset"; TODO: Enable after cove refactor
1
+ // @import 'reset'; //TODO: Enable after cove refactor
2
2
  @import 'typography';
3
3
 
4
4
  @import 'general';
@@ -27,27 +27,6 @@
27
27
  }
28
28
  }
29
29
 
30
- // editor-panel
31
- .editor-panel {
32
- .cove-label + .cove-tooltip {
33
- top: 1px;
34
- margin-left: 0.5rem;
35
- font-size: 0.75rem;
36
- }
37
-
38
- .cove-accordion__button .cove-tooltip {
39
- display: inline-flex;
40
- right: 1.5rem;
41
- line-height: inherit;
42
- }
43
-
44
- .cove-list-group__item .cove-tooltip {
45
- width: 100%;
46
- display: block;
47
- line-height: inherit;
48
- }
49
- }
50
-
51
30
  // begin actual tooltip styles
52
31
  .react-tooltip,
53
32
  .tooltip {
package/types/Axis.ts CHANGED
@@ -19,6 +19,8 @@ export type Axis = {
19
19
  label?: string
20
20
  labelOffset?: number
21
21
  labelPlacement?: string
22
+ manual?: boolean
23
+ manualStep?: number
22
24
  max?: string
23
25
  maxTickRotation?: number
24
26
  min?: string
@@ -35,6 +37,8 @@ export type Axis = {
35
37
  sortDates?: boolean
36
38
  sortKey?: string
37
39
  showTargetLabel?: boolean
40
+ showSuppressedLine: boolean
41
+ showSuppressedSymbol: boolean
38
42
  size?: number
39
43
  target?: number
40
44
  targetLabel?: string
package/types/Column.ts CHANGED
@@ -6,6 +6,7 @@ export type Column = {
6
6
  roundToPlace: number
7
7
  commas: boolean
8
8
  dataTable: boolean
9
+ order?: number
9
10
  showInViz: boolean
10
11
  startingPoint: string
11
12
  series?: string
@@ -0,0 +1,8 @@
1
+ import { DataDescription } from './DataDescription'
2
+
3
+ export type ConfigureData = {
4
+ dataDescription: Partial<DataDescription>
5
+ data: Object[]
6
+ formattedData?: Object[]
7
+ dataKey: string // This is the key of the dataset in the config
8
+ }
@@ -0,0 +1,9 @@
1
+ export type DataDescription = {
2
+ series: boolean
3
+ horizontal: boolean
4
+ singleRow: boolean
5
+ seriesKey: string
6
+ xKey: string
7
+ valueKeysTallSupport: string[]
8
+ ignoredKeys: string[]
9
+ }
package/types/Legend.ts CHANGED
@@ -7,6 +7,7 @@ export type Legend = {
7
7
  description: string
8
8
  // show or hide the legend
9
9
  hide: boolean
10
+ hideSuppressedLabels: boolean
10
11
  highlightOnHover: boolean
11
12
  label: string
12
13
  lineMode: boolean
@@ -0,0 +1,26 @@
1
+ import { Runtime } from '@cdc/core/types/Runtime'
2
+ import { Variable } from '@cdc/markup-include/src/types/Variable'
3
+ import { Visualization } from './Visualization'
4
+
5
+ export type MarkupIncludeConfig = Visualization & {
6
+ contentEditor: {
7
+ // Changing the base config object creates an infinite loop, nesting it is a workaround
8
+ inlineHTML: string
9
+ markupVariables: Variable[]
10
+ showHeader: boolean
11
+ srcUrl: string
12
+ title: string
13
+ useInlineHTML: boolean
14
+ }
15
+ data?: Object[]
16
+ formattedData: {}
17
+ newViz?: boolean
18
+ runtime?: Runtime
19
+ visual: {
20
+ border: boolean
21
+ accent: boolean
22
+ background: boolean
23
+ hideBackgroundColor: boolean
24
+ borderColorTheme: boolean
25
+ }
26
+ }
package/types/Runtime.ts CHANGED
@@ -28,4 +28,5 @@ export type Runtime = {
28
28
  editorErrorMessage: string
29
29
  lineSeriesKeys: any[]
30
30
  horizontal: boolean
31
+ uniqueId: number | string
31
32
  }
package/types/Series.ts CHANGED
@@ -1 +1 @@
1
- export type Series = { dataKey: string; name: string; axis: string; type: string }[]
1
+ export type Series = { dataKey: string; name: string; axis: string; type: string; tooltip: boolean }[]
package/types/Table.ts CHANGED
@@ -1,21 +1,23 @@
1
1
  export type Table = {
2
+ caption?: string
2
3
  cellMinWidth?: number
3
- label?: string
4
- show?: boolean
5
- showVertical?: boolean
4
+ collapsible?: boolean
5
+ dateDisplayFormat?: string
6
+ download?: boolean
7
+ downloadImageButton?: boolean
8
+ downloadPdfButton?: boolean
9
+ excludeColumns?: string[]
10
+ expanded?: boolean
11
+ fontSize: 'small' | 'medium' | 'large'
12
+ groupBy?: string
13
+ height?: number
6
14
  indexLabel?: string
7
- caption?: string
15
+ label?: string
8
16
  limitHeight?: boolean
9
- height?: number
10
- expanded?: boolean
17
+ show?: boolean
11
18
  showDataTableLink?: boolean
12
- showDownloadUrl?: boolean
13
- download?: boolean
14
- customTableConfig?: boolean
15
- excludeColumns?: string[]
16
19
  showDownloadImgButton?: boolean
17
20
  showDownloadPdfButton?: boolean
18
- downloadImageButton?: boolean
19
- downloadPdfButton?: boolean
20
- dateDisplayFormat?: string
21
+ showDownloadUrl?: boolean
22
+ showVertical?: boolean
21
23
  }
@@ -5,35 +5,39 @@ import { Series } from './Series'
5
5
  import { Table } from './Table'
6
6
  import { ConfidenceInterval } from './ConfidenceInterval'
7
7
  import { BaseVisualizationType } from './BaseVisualizationType'
8
+ import { ConfigureData } from './ConfigureData'
9
+ import { VizFilter } from './VizFilter'
10
+ import { FilterBehavior } from './FilterBehavior'
11
+ import { General } from './General'
8
12
 
9
- export type Visualization = {
13
+ export type Visualization = ConfigureData & {
10
14
  autoLoad: boolean
11
- columns: Record<string, Column>
15
+ columns: Record<string, Partial<Column>>
12
16
  confidenceKeys: ConfidenceInterval
13
- data: any
14
- dataDescription: Object
15
17
  dataFileName: string
16
18
  dataFileSourceType: string
17
19
  dataFormat: any
18
- dataKey: string
19
20
  datasets: Record<string, any>
20
21
  editing: boolean
21
- formattedData?: Object[] & Record<string, Object>
22
- general: any
22
+ filterBehavior: FilterBehavior
23
+ filters: VizFilter[]
24
+ general: General
23
25
  hide: any[]
24
26
  legend: Legend
25
27
  multiDashboards?: any[]
26
28
  newViz: boolean
27
29
  openModal: boolean
28
- originalFormattedData: any
29
30
  orientation: 'vertical' | 'horizontal'
31
+ originalFormattedData: any
30
32
  series: Series
33
+ showEditorPanel: boolean
31
34
  table: Table
35
+ theme: string
32
36
  title: string
33
37
  type: BaseVisualizationType
34
- uid: string
38
+ uid: string // this is the actual key of the visualization object
35
39
  usesSharedFilter: any
36
- visualizationType: string
37
40
  visualizationSubType: string
41
+ visualizationType: string
38
42
  xAxis: Axis
39
43
  }
@@ -0,0 +1,13 @@
1
+ export type VizFilter = {
2
+ active: string
3
+ columnName: string
4
+ filterStyle: 'tab' | 'pill' | 'tab bar' | 'dropdown'
5
+ label: string
6
+ order: 'asc' | 'desc' | 'cust'
7
+ orderedValues?: string[]
8
+ queryParameter: string
9
+ setByQueryParameter: string
10
+ showDropdown: boolean
11
+ type: 'url'
12
+ values: string[]
13
+ }
@@ -1,19 +0,0 @@
1
- // If config key names or position in the config have been changed with a version change,
2
- // process those config entries and format old values into new
3
- import update_4_23 from './ver/4.23'
4
- import update_4_24_3 from './ver/4.24.3'
5
-
6
- // 4.23.6 ------------------------------------------------------
7
- const coveUpdateWorker = async config => {
8
- let genConfig = config
9
-
10
- // v4.23
11
- genConfig = await update_4_23(genConfig)
12
-
13
- // v4.24.3
14
- genConfig = await update_4_24_3(genConfig)
15
-
16
- return genConfig
17
- }
18
-
19
- export default coveUpdateWorker
@@ -1,10 +0,0 @@
1
- const update_4_23 = async config => {
2
- const ver = 4.23
3
-
4
- let newConfig = { ...config }
5
-
6
- newConfig.validated = ver
7
- return newConfig
8
- }
9
-
10
- export default update_4_23
@@ -1,25 +0,0 @@
1
- const update_4_24_3 = async config => {
2
- const ver = '4.24.3'
3
-
4
- let newConfig = { ...config }
5
-
6
- newConfig.validated = ver
7
-
8
- if (newConfig.type === 'chart') {
9
- if (newConfig.xAxis.sortDates) {
10
- newConfig.xAxis.type = 'date-time'
11
- }
12
- newConfig.table.download = true
13
-
14
- delete newConfig.xAxis.sortDates
15
- }
16
-
17
- if (newConfig.type === 'map') {
18
- newConfig.table.download = true
19
- newConfig.general.showDownloadButton = true
20
- }
21
-
22
- return newConfig
23
- }
24
-
25
- export default update_4_24_3