@cdc/core 4.24.10 → 4.24.12

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 (62) hide show
  1. package/components/AdvancedEditor/AdvancedEditor.tsx +17 -13
  2. package/components/Alert/components/Alert.tsx +39 -8
  3. package/components/DataTable/DataTable.tsx +31 -10
  4. package/components/DataTable/components/ExpandCollapse.tsx +1 -1
  5. package/components/DataTable/components/SortIcon/sort-icon.css +15 -0
  6. package/components/DataTable/data-table.css +4 -22
  7. package/components/DataTable/helpers/boxplotCellMatrix.tsx +19 -14
  8. package/components/DataTable/helpers/getChartCellValue.ts +25 -7
  9. package/components/EditorPanel/ColumnsEditor.tsx +81 -36
  10. package/components/EditorPanel/DataTableEditor.tsx +62 -56
  11. package/components/EditorPanel/FieldSetWrapper.tsx +2 -2
  12. package/components/EditorPanel/Inputs.tsx +26 -16
  13. package/components/EditorPanel/VizFilterEditor/VizFilterEditor.tsx +43 -56
  14. package/components/Filters/Filters.tsx +16 -11
  15. package/components/Footnotes/FootnotesStandAlone.tsx +17 -4
  16. package/components/Layout/components/Sidebar/components/sidebar.styles.scss +0 -4
  17. package/components/Layout/components/Visualization/visualizations.scss +1 -1
  18. package/components/Legend/Legend.Gradient.tsx +50 -35
  19. package/components/Loader/Loader.tsx +10 -5
  20. package/components/MultiSelect/MultiSelect.tsx +56 -33
  21. package/components/MultiSelect/multiselect.styles.css +20 -7
  22. package/components/NestedDropdown/NestedDropdown.tsx +55 -32
  23. package/components/NestedDropdown/nesteddropdown.styles.css +26 -13
  24. package/components/Table/Table.tsx +102 -34
  25. package/components/Table/components/Row.tsx +1 -1
  26. package/components/_stories/DataTable.stories.tsx +14 -0
  27. package/components/_stories/Filters.stories.tsx +57 -0
  28. package/components/_stories/_mocks/DataTable/no-data.json +108 -0
  29. package/components/inputs/{InputToggle.jsx → InputToggle.tsx} +35 -29
  30. package/components/ui/Icon.tsx +19 -6
  31. package/dist/cove-main.css +26 -57
  32. package/dist/cove-main.css.map +1 -1
  33. package/helpers/DataTransform.ts +2 -1
  34. package/helpers/cove/{number.js → number.ts} +25 -11
  35. package/helpers/fetchRemoteData.js +32 -37
  36. package/helpers/formatConfigBeforeSave.ts +1 -0
  37. package/helpers/gatherQueryParams.ts +2 -3
  38. package/helpers/queryStringUtils.ts +16 -1
  39. package/helpers/useDataVizClasses.ts +44 -21
  40. package/helpers/ver/versionNeedsUpdate.ts +2 -0
  41. package/helpers/viewports.ts +8 -7
  42. package/package.json +2 -2
  43. package/styles/_button-section.scss +1 -1
  44. package/styles/_global-variables.scss +9 -4
  45. package/styles/_global.scss +21 -22
  46. package/styles/_reset.scss +0 -12
  47. package/styles/filters.scss +0 -22
  48. package/styles/v2/base/_reset.scss +0 -7
  49. package/styles/v2/components/editor.scss +0 -4
  50. package/styles/v2/components/icon.scss +1 -1
  51. package/types/Axis.ts +2 -0
  52. package/types/BoxPlot.ts +5 -3
  53. package/types/Color.ts +1 -1
  54. package/types/Legend.ts +1 -2
  55. package/types/MarkupInclude.ts +1 -0
  56. package/types/Runtime.ts +3 -1
  57. package/types/Series.ts +8 -1
  58. package/types/Table.ts +1 -1
  59. package/types/Version.ts +1 -0
  60. package/types/Visualization.ts +7 -8
  61. package/components/ui/Select.jsx +0 -30
  62. package/helpers/getGradientLegendWidth.ts +0 -15
@@ -2,6 +2,7 @@ $colors: (
2
2
  'baseColor': #333,
3
3
  'blue': #005eaa,
4
4
  'lightestGray': #f2f2f2,
5
+ 'gray2': #f5f5f5,
5
6
  'lightGray': #c7c7c7,
6
7
  'mediumGray': #565656,
7
8
  'darkGray': #333,
@@ -62,6 +63,11 @@ $colors: (
62
63
  'amber-secondary': #ffd54f,
63
64
  'amber-tertiary': #ffecb3,
64
65
  'amber-quaternary': #fff7e1,
66
+
67
+ 'cool-gray-90': #1c1d1f,
68
+ 'cool-gray-50': #71767a,
69
+ 'cool-gray-30': #a9aeb1,
70
+ 'cool-gray-10': #dfe1e2
65
71
  );
66
72
 
67
73
  @mixin theme() {
@@ -75,6 +81,7 @@ $colors: (
75
81
  @include theme();
76
82
 
77
83
  :root {
84
+ --editorContentPadding: 30px;
78
85
  --editorWidth: 350px;
79
86
  --breakpoint-xs: 480px;
80
87
  --breakpoint-sm: 768px;
@@ -84,10 +91,8 @@ $colors: (
84
91
  --font-size: 17px;
85
92
  }
86
93
 
87
-
88
- @media (max-width: 768px) {
94
+ @media (max-width: 576px) {
89
95
  :root {
90
- --font-size: 0.9em;
96
+ --font-size: 13px;
91
97
  }
92
98
  }
93
-
@@ -53,15 +53,6 @@ strong {
53
53
  }
54
54
 
55
55
  .btn {
56
- background: #005eaa;
57
- color: #fff;
58
- border: 0;
59
- padding: 0.4em 0.8em;
60
- font-size: 1em;
61
- display: block;
62
- border-radius: 0.3em;
63
- transition: 0.1s background-color;
64
- cursor: pointer;
65
56
  &.full-width {
66
57
  width: 100%;
67
58
  }
@@ -89,17 +80,11 @@ strong {
89
80
  }
90
81
  }
91
82
 
92
- &:hover {
93
- transition: 0.1s all;
94
- background: lighten(#005eaa, 5%);
95
- }
96
-
97
83
  svg {
98
84
  width: 16px;
99
85
  height: 16px;
100
86
  position: relative;
101
87
  top: 2px;
102
- margin-left: 5px;
103
88
  }
104
89
  }
105
90
 
@@ -122,13 +107,6 @@ textarea {
122
107
  textarea {
123
108
  min-height: 140px;
124
109
  }
125
- select {
126
- width: 100%;
127
- font-size: 1em;
128
- font-weight: normal;
129
- text-transform: none;
130
- border: rgba(0, 0, 0, 0.3) 1px solid !important;
131
- }
132
110
 
133
111
  .input-group-text {
134
112
  border-top-left-radius: 0;
@@ -194,3 +172,24 @@ section.footnotes {
194
172
  .margin-left-href {
195
173
  margin-left: 15px;
196
174
  }
175
+
176
+ .btn.btn-primary:not([disabled]) {
177
+ background-color: $blue;
178
+ border-color: $blue;
179
+ &:hover:not([disabled]) {
180
+ background-color: darken($blue, 5%);
181
+ border-color: darken($blue, 5%);
182
+ }
183
+ }
184
+
185
+
186
+ // after migration to TP5 this declaration should be removed and all references
187
+ // to it should be replaced with .form-select
188
+ .cove-form-select {
189
+ display: block;
190
+ width: 100%;
191
+ padding: 0.375rem 0.75rem;
192
+ border-radius: 0.25rem;
193
+ border: 1px solid var(--lightGray);
194
+ color: var(--darkGray);
195
+ }
@@ -19,8 +19,6 @@
19
19
  }
20
20
  }
21
21
  .cdc-open-viz-module {
22
- div,
23
- span,
24
22
  applet,
25
23
  object,
26
24
  iframe,
@@ -67,8 +65,6 @@
67
65
  ul,
68
66
  li,
69
67
  fieldset,
70
- form,
71
- label,
72
68
  legend,
73
69
  caption,
74
70
  article,
@@ -99,14 +95,6 @@
99
95
  vertical-align: baseline;
100
96
  }
101
97
 
102
- button {
103
- border: 0;
104
- cursor: pointer;
105
- &:focus {
106
- outline: 0;
107
- }
108
- }
109
-
110
98
  * {
111
99
  box-sizing: border-box;
112
100
  }
@@ -26,24 +26,7 @@
26
26
  }
27
27
  }
28
28
 
29
- // note the diff of section and no section above.
30
- // Can't use nested selectors with top level section overwrites
31
- section.filters-section {
32
- // border: 1px solid #c7c7c7;
33
- // padding: 10px;
34
- border-radius: 10px;
35
- margin-bottom: 10px;
36
- display: block !important;
37
- }
38
-
39
29
  div.single-filters {
40
- display: flex;
41
- flex-wrap: wrap;
42
- margin: 15px 0;
43
-
44
- select {
45
- width: auto !important;
46
- }
47
30
 
48
31
  label {
49
32
  width: 100%;
@@ -57,11 +40,6 @@ div.single-filters {
57
40
  }
58
41
  }
59
42
 
60
- .single-filters--dropdown {
61
- width: auto;
62
- display: flex;
63
- }
64
-
65
43
  .single-filters--tab {
66
44
  width: 100%;
67
45
  display: flex;
@@ -43,13 +43,6 @@ picture {
43
43
  display: block;
44
44
  }
45
45
 
46
- input,
47
- button,
48
- textarea,
49
- select {
50
- font: inherit;
51
- }
52
-
53
46
  sub,
54
47
  sup {
55
48
  font-size: 75%;
@@ -250,10 +250,6 @@
250
250
  font-weight: normal;
251
251
  }
252
252
 
253
- .btn {
254
- margin-top: 1em;
255
- }
256
-
257
253
  .sort-list {
258
254
  list-style: none;
259
255
 
@@ -1,6 +1,6 @@
1
1
  .cove-icon {
2
2
  display: inline-flex;
3
- width: 1em;
3
+ width: 1rem;
4
4
  height: auto;
5
5
  justify-content: center;
6
6
  align-items: center;
package/types/Axis.ts CHANGED
@@ -27,6 +27,7 @@ export type Axis = {
27
27
  maxTickRotation?: number
28
28
  min?: string
29
29
  numTicks?: number
30
+ padding?: number
30
31
  paddingPercent?: number
31
32
  rightAxisSize?: number
32
33
  rightHideAxis?: boolean
@@ -48,4 +49,5 @@ export type Axis = {
48
49
  type: string
49
50
  axisBBox: number
50
51
  maxValue: string
52
+ sortByRecentDate: boolean
51
53
  }
package/types/BoxPlot.ts CHANGED
@@ -10,12 +10,14 @@ export type BoxPlot = {
10
10
  q3: string
11
11
  outliers: string
12
12
  values: string
13
- total: string
13
+ count: string
14
14
  lowerBounds: string
15
15
  upperBounds: string
16
16
  }
17
- plots: []
17
+ plotNonOutlierValues: boolean
18
+ plots: [{ columnOutliers: []; columnLowerBounds: number; columnUpperBounds: number }]
18
19
  categories: string[]
19
- firstQuartilePercentage: number
20
20
  geoType: string
21
+ hideOutliers: boolean
22
+ borders: string
21
23
  }
package/types/Color.ts CHANGED
@@ -2,4 +2,4 @@ type RGB = `rgb(${number}, ${number}, ${number})`
2
2
  type RGBA = `rgba(${number}, ${number}, ${number}, ${number})`
3
3
  type HEX = `#${string}`
4
4
 
5
- type Color = RGB | RGBA | HEX
5
+ export type Color = RGB | RGBA | HEX
package/types/Legend.ts CHANGED
@@ -10,8 +10,7 @@ export type Legend = {
10
10
  hideSuppressedLabels: boolean
11
11
  highlightOnHover: boolean
12
12
  label: string
13
- lineMode: boolean
14
- position: string
13
+ position: 'left' | 'bottom' | 'top' | 'right' | 'side'
15
14
  reverseLabelOrder: boolean
16
15
  singleRow: boolean
17
16
  type: string
@@ -5,6 +5,7 @@ import { Visualization } from './Visualization'
5
5
  export type MarkupIncludeConfig = Visualization & {
6
6
  contentEditor: {
7
7
  // Changing the base config object creates an infinite loop, nesting it is a workaround
8
+ allowHideSection?: boolean
8
9
  inlineHTML: string
9
10
  markupVariables: Variable[]
10
11
  showHeader: boolean
package/types/Runtime.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Axis } from './Axis'
2
+ import { Series } from './Series'
2
3
 
3
4
  export type ForecastingSeriesKey = {
4
5
  stages: {
@@ -17,7 +18,8 @@ export type Runtime = {
17
18
  }
18
19
  xAxis: Axis
19
20
  yAxis: Axis
20
- seriesKeys: any[]
21
+ series: Series
22
+ seriesKeys: string[]
21
23
  seriesLabels: Record<string, any>
22
24
  seriesLabelsAll: string[]
23
25
  editorErrorMessage: string
package/types/Series.ts CHANGED
@@ -1 +1,8 @@
1
- export type Series = { dataKey: string; name: string; axis: string; type: string; tooltip: boolean }[]
1
+ export type Series = {
2
+ dataKey: string
3
+ name: string
4
+ axis: string
5
+ type: string
6
+ tooltip: boolean
7
+ dynamicCategory?: string
8
+ }[]
package/types/Table.ts CHANGED
@@ -1,4 +1,4 @@
1
- type Pivot = {
1
+ export type Pivot = {
2
2
  columnName: string
3
3
  valueColumns: string[]
4
4
  }
@@ -0,0 +1 @@
1
+ export type version = `${number}.${number}.${number}`
@@ -19,20 +19,19 @@ import { DashboardFilters } from '@cdc/dashboard/src/types/DashboardFilters'
19
19
  type DeprecatedVisualizationType = {
20
20
  columns: Record<string, Partial<Column>>
21
21
  confidenceKeys: ConfidenceInterval
22
- dataFileName: string
23
- dataFileSourceType: string
22
+ dataFileName?: string
23
+ dataFileSourceType?: string
24
24
  dataFormat: any
25
- datasets: Record<string, any>
25
+ datasets?: Record<string, any>
26
26
  filters: VizFilter[]
27
27
  general: General
28
28
  legend: Legend
29
29
  multiDashboards?: any[]
30
30
  newViz: boolean
31
31
  isResponsiveTicks: boolean
32
- barThickness: string
33
- openModal: boolean
32
+ openModal?: boolean
34
33
  orientation: 'vertical' | 'horizontal'
35
- originalFormattedData: any
34
+ originalFormattedData?: any
36
35
  runtime?: Runtime
37
36
  series: Series
38
37
  table: Table
@@ -49,7 +48,7 @@ type DeprecatedVisualizationType = {
49
48
  | 'filtered-text'
50
49
  | 'table'
51
50
  | 'navigation'
52
- usesSharedFilter: any
51
+ usesSharedFilter?: any
53
52
  visualizationSubType: string
54
53
  visualizationType: string
55
54
  xAxis: Axis
@@ -63,7 +62,7 @@ type StatefulProperties = {
63
62
 
64
63
  export type CommonVisualizationProperties = Partial<StatefulProperties> & {
65
64
  showEditorPanel?: boolean
66
- uid?: string // this is the actual key of the visualization object
65
+ uid?: string | number // this is the actual key of the visualization object
67
66
  visualizationType?: string
68
67
  filterBehavior: FilterBehavior
69
68
  } & Partial<ConfigureData>
@@ -1,30 +0,0 @@
1
- import React from 'react'
2
-
3
- const Select = ({ label, value, options, fieldName, section = null, subsection = null, required = false, tooltip, onchange, initial: initialValue, ...attributes }) => {
4
- let optionsJsx = options.map((optionName, index) => (
5
- <option value={optionName} key={index}>
6
- {optionName}
7
- </option>
8
- ))
9
-
10
- if (initialValue) {
11
- optionsJsx.unshift(
12
- <option value='' key='initial'>
13
- {initialValue}
14
- </option>
15
- )
16
- }
17
-
18
- return (
19
- <label>
20
- <span className='edit-label'>
21
- {label}
22
- {tooltip}
23
- </span>
24
- <select className={required && !value ? 'warning' : ''} name={fieldName} value={value} onChange={onchange} {...attributes}>
25
- {optionsJsx}
26
- </select>
27
- </label>
28
- )
29
- }
30
- export default Select
@@ -1,15 +0,0 @@
1
- export const getGradientLegendWidth = (containerWidth: number, currentViewport: string): number => {
2
- const newWidth = Number(containerWidth)
3
- switch (currentViewport) {
4
- case 'lg':
5
- return newWidth / 3
6
- case 'md':
7
- return newWidth / 2
8
- case 'sm':
9
- case 'xs':
10
- case 'xxs':
11
- return newWidth / 1.4
12
- default:
13
- return newWidth
14
- }
15
- }