@cdc/core 4.23.11 → 4.24.2

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 (57) hide show
  1. package/components/DataTable/DataTable.tsx +39 -10
  2. package/components/DataTable/components/ChartHeader.tsx +17 -5
  3. package/components/DataTable/components/ExpandCollapse.tsx +1 -1
  4. package/components/DataTable/helpers/chartCellMatrix.tsx +16 -2
  5. package/components/DataTable/helpers/customColumns.ts +25 -0
  6. package/components/DataTable/helpers/customSort.ts +9 -0
  7. package/components/DataTable/helpers/getChartCellValue.ts +2 -1
  8. package/components/DataTable/helpers/getDataSeriesColumns.ts +2 -1
  9. package/components/DataTable/helpers/getSeriesName.ts +15 -20
  10. package/components/DataTable/helpers/mapCellMatrix.tsx +4 -0
  11. package/components/DataTable/types/TableConfig.ts +11 -40
  12. package/components/EditorPanel/DataTableEditor.tsx +133 -0
  13. package/components/EditorPanel/Inputs.tsx +150 -0
  14. package/components/Filters.jsx +17 -15
  15. package/components/MediaControls.jsx +1 -1
  16. package/components/MultiSelect/MultiSelect.tsx +95 -0
  17. package/components/MultiSelect/index.ts +1 -0
  18. package/components/MultiSelect/multiselect.styles.css +50 -0
  19. package/components/Table/Table.tsx +23 -3
  20. package/components/Table/components/Cell.tsx +3 -3
  21. package/components/Table/components/GroupRow.tsx +6 -2
  22. package/components/Table/components/Row.tsx +9 -2
  23. package/components/Table/types/RowType.ts +5 -0
  24. package/components/_stories/DataTable.stories.tsx +41 -0
  25. package/components/_stories/EditorPanel.stories.tsx +53 -0
  26. package/components/_stories/Inputs.stories.tsx +37 -0
  27. package/components/_stories/MultiSelect.stories.tsx +24 -0
  28. package/components/_stories/_mocks/row_type.json +42 -0
  29. package/components/inputs/{InputSelect.jsx → InputSelect.tsx} +15 -5
  30. package/components/managers/DataDesigner.tsx +8 -8
  31. package/components/ui/{Icon.jsx → Icon.tsx} +3 -3
  32. package/components/ui/_stories/Colors.stories.tsx +92 -0
  33. package/components/ui/_stories/Icon.stories.tsx +17 -10
  34. package/helpers/DataTransform.ts +30 -2
  35. package/helpers/fetchRemoteData.js +5 -5
  36. package/helpers/getFileExtension.ts +28 -5
  37. package/helpers/getViewport.ts +23 -0
  38. package/helpers/isSolr.js +13 -0
  39. package/helpers/withDevTools.ts +50 -0
  40. package/package.json +2 -2
  41. package/styles/_data-table.scss +2 -5
  42. package/styles/_global-variables.scss +75 -0
  43. package/styles/base.scss +89 -69
  44. package/types/Action.ts +1 -0
  45. package/types/Axis.ts +39 -2
  46. package/types/BoxPlot.ts +21 -0
  47. package/types/Column.ts +16 -0
  48. package/types/FilterBehavior.ts +1 -0
  49. package/types/General.ts +9 -0
  50. package/types/Runtime.ts +21 -1
  51. package/types/Series.ts +1 -1
  52. package/types/Table.ts +21 -0
  53. package/types/UpdateFieldFunc.ts +1 -0
  54. package/types/ViewPort.ts +2 -0
  55. package/types/Visualization.ts +15 -9
  56. package/types/WCMSProps.ts +11 -0
  57. package/helpers/getViewport.js +0 -21
package/styles/base.scss CHANGED
@@ -51,6 +51,7 @@
51
51
  // Imports
52
52
  @import 'reset';
53
53
  @import 'variables';
54
+ @import 'global-variables';
54
55
  @import 'mixins';
55
56
  @import 'filters';
56
57
 
@@ -58,6 +59,10 @@ body.post-type-cdc_visualization .visx-tooltip {
58
59
  z-index: 1000000;
59
60
  }
60
61
 
62
+ body.post-type-cdc_visualization .cdc-editor .configure .editor-panel {
63
+ top: 0 !important;
64
+ }
65
+
61
66
  .cdc-open-viz-module {
62
67
  position: relative;
63
68
  color: $baseColor;
@@ -71,73 +76,88 @@ body.post-type-cdc_visualization .visx-tooltip {
71
76
  @import 'button-section';
72
77
  @import 'series-list';
73
78
  @import 'typography';
74
- }
75
79
 
76
- $theme: (
77
- 'amber': (
78
- '#fbab18',
79
- '#ffd54f',
80
- '#ffecb3',
81
- '#fff7e1'
82
- ),
83
- 'blue': (
84
- '#005eaa',
85
- '#88c3ea',
86
- '#c0e9ff',
87
- '#edf9ff'
88
- ),
89
- 'brown': (
90
- '#705043',
91
- '#ad907b',
92
- '#d7ccc8',
93
- '#f2ebe8'
94
- ),
95
- 'cyan': (
96
- '#006778',
97
- '#65b0bd',
98
- '#cce5e9',
99
- '#ebf5f6'
100
- ),
101
- 'green': (
102
- '#4b830d',
103
- '#84bc49',
104
- '#dcedc8',
105
- '#f1f8e9'
106
- ),
107
- 'indigo': (
108
- '#26418f',
109
- '#92a6dd',
110
- '#dee8ff',
111
- '#f2f6ff'
112
- ),
113
- 'orange': (
114
- '#bb4d00',
115
- '#ffad42',
116
- '#ffe97d',
117
- '#fff4cf'
118
- ),
119
- 'pink': (
120
- '#af4448',
121
- '#e57373',
122
- '#ffc2c2',
123
- '#ffe7e7'
124
- ),
125
- 'purple': (
126
- '#712177',
127
- '#b890bb',
128
- '#e3d3e4',
129
- '#f7f2f7'
130
- ),
131
- 'slate': (
132
- '#29434e',
133
- '#7e9ba5',
134
- '#b6c6d2',
135
- '#e2e8ed'
136
- ),
137
- 'teal': (
138
- '#00695c',
139
- '#4ebaaa',
140
- '#ceece7',
141
- '#ebf7f5'
142
- )
143
- );
80
+ .editor-panel.cove {
81
+ position: absolute;
82
+ height: 100vh;
83
+ top: 0;
84
+ .editor-toggle {
85
+ position: absolute !important;
86
+ top: 10px !important;
87
+ }
88
+
89
+ .editor-panel {
90
+ position: absolute !important;
91
+ top: 0 !important;
92
+ }
93
+ }
94
+
95
+ $theme: (
96
+ 'amber': (
97
+ '#fbab18',
98
+ '#ffd54f',
99
+ '#ffecb3',
100
+ '#fff7e1'
101
+ ),
102
+ 'blue': (
103
+ '#005eaa',
104
+ '#88c3ea',
105
+ '#c0e9ff',
106
+ '#edf9ff'
107
+ ),
108
+ 'brown': (
109
+ '#705043',
110
+ '#ad907b',
111
+ '#d7ccc8',
112
+ '#f2ebe8'
113
+ ),
114
+ 'cyan': (
115
+ '#006778',
116
+ '#65b0bd',
117
+ '#cce5e9',
118
+ '#ebf5f6'
119
+ ),
120
+ 'green': (
121
+ '#4b830d',
122
+ '#84bc49',
123
+ '#dcedc8',
124
+ '#f1f8e9'
125
+ ),
126
+ 'indigo': (
127
+ '#26418f',
128
+ '#92a6dd',
129
+ '#dee8ff',
130
+ '#f2f6ff'
131
+ ),
132
+ 'orange': (
133
+ '#bb4d00',
134
+ '#ffad42',
135
+ '#ffe97d',
136
+ '#fff4cf'
137
+ ),
138
+ 'pink': (
139
+ '#af4448',
140
+ '#e57373',
141
+ '#ffc2c2',
142
+ '#ffe7e7'
143
+ ),
144
+ 'purple': (
145
+ '#712177',
146
+ '#b890bb',
147
+ '#e3d3e4',
148
+ '#f7f2f7'
149
+ ),
150
+ 'slate': (
151
+ '#29434e',
152
+ '#7e9ba5',
153
+ '#b6c6d2',
154
+ '#e2e8ed'
155
+ ),
156
+ 'teal': (
157
+ '#00695c',
158
+ '#4ebaaa',
159
+ '#ceece7',
160
+ '#ebf7f5'
161
+ )
162
+ );
163
+ }
@@ -0,0 +1 @@
1
+ export type Action<T, P> = { type: T; payload?: P }
package/types/Axis.ts CHANGED
@@ -1,6 +1,43 @@
1
+ export type Anchor = {
2
+ value: string
3
+ color: string
4
+ lineStyle: string
5
+ }
6
+
1
7
  export type Axis = {
8
+ scalePadding: number
9
+ anchors?: Anchor[]
2
10
  dataKey: string
3
- type: string
4
- dateParseFormat: string
5
11
  dateDisplayFormat: string
12
+ dateParseFormat: string
13
+ displayNumbersOnBar?: boolean
14
+ enablePadding?: boolean
15
+ gridLines?: boolean
16
+ hideAxis?: boolean
17
+ hideLabel?: boolean
18
+ hideTicks?: boolean
19
+ label?: string
20
+ labelOffset?: number
21
+ labelPlacement?: string
22
+ max?: string
23
+ maxTickRotation?: number
24
+ min?: string
25
+ numTicks?: number
26
+ rightAxisSize?: number
27
+ rightHideAxis?: boolean
28
+ rightHideLabel?: boolean
29
+ rightHideTicks?: boolean
30
+ rightLabel?: string
31
+ rightLabelOffsetSize?: number
32
+ rightMax?: string
33
+ rightNumTicks?: number
34
+ sortDates?: boolean
35
+ sortKey?: string
36
+ showTargetLabel?: boolean
37
+ size?: number
38
+ target?: number
39
+ targetLabel?: string
40
+ tickRotation?: number
41
+ tickWidthMax?: number
42
+ type: string
6
43
  }
@@ -0,0 +1,21 @@
1
+ export type BoxPlot = {
2
+ tableData: Object[]
3
+ labels: {
4
+ mean: string
5
+ maximum: string
6
+ minimum: string
7
+ iqr: string
8
+ median: string
9
+ q1: string
10
+ q3: string
11
+ outliers: string
12
+ values: string
13
+ total: string
14
+ lowerBounds: string
15
+ upperBounds: string
16
+ }
17
+ plots: []
18
+ categories: string[]
19
+ firstQuartilePercentage: number
20
+ geoType: string
21
+ }
@@ -0,0 +1,16 @@
1
+ export type Column = {
2
+ name?: string
3
+ label: string
4
+ prefix: string
5
+ suffix: string
6
+ roundToPlace: number
7
+ commas: boolean
8
+ dataTable: boolean
9
+ showInViz: boolean
10
+ startingPoint: string
11
+ series?: string
12
+ tooltips: boolean
13
+ forestPlot: boolean
14
+ forestPlotAlignRight: boolean
15
+ forestPlotStartingPoint: number
16
+ }
@@ -0,0 +1 @@
1
+ export type FilterBehavior = 'Apply Button' | 'Filter Change'
@@ -0,0 +1,9 @@
1
+ import { BoxPlot } from './BoxPlot'
2
+
3
+ export type General = {
4
+ boxplot: BoxPlot
5
+ geoType: string
6
+ type: string
7
+ showDownloadButton: boolean
8
+ allowMapZoom?: boolean
9
+ }
package/types/Runtime.ts CHANGED
@@ -1,9 +1,29 @@
1
+ import { Axis } from './Axis'
2
+
3
+ export type ForecastingSeriesKey = {
4
+ stages: {
5
+ key: string
6
+ color: string
7
+ }[]
8
+ }
9
+
10
+ export type BarSeriesKey = {
11
+ key: string
12
+ color: string
13
+ }
14
+
1
15
  export type Runtime = {
16
+ barSeriesKeys?: BarSeriesKey[]
17
+ forecastingSeriesKeys?: ForecastingSeriesKey[]
2
18
  originalXAxis: {
3
19
  dataKey: string
4
20
  name: string
5
21
  axis: string
6
22
  }
7
- seriesKeys: []
23
+ xAxis: Axis
24
+ yAxis: Axis
25
+ seriesKeys: any[]
26
+ seriesLabels: Record<string, any>
27
+ seriesLabelsAll: string[]
8
28
  editorErrorMessage: string
9
29
  }
package/types/Series.ts CHANGED
@@ -1 +1 @@
1
- export type Series = { dataKey: string; name: string; axis: string }[]
1
+ export type Series = { dataKey: string; name: string; axis: string; type: string }[]
package/types/Table.ts ADDED
@@ -0,0 +1,21 @@
1
+ export type Table = {
2
+ cellMinWidth?: number
3
+ label?: string
4
+ show?: boolean
5
+ showVertical?: boolean
6
+ indexLabel?: string
7
+ caption?: string
8
+ limitHeight?: boolean
9
+ height?: number
10
+ expanded?: boolean
11
+ showDataTableLink?: boolean
12
+ showDownloadUrl?: boolean
13
+ download?: boolean
14
+ customTableConfig?: boolean
15
+ excludeColumns?: string[]
16
+ showDownloadImgButton?: boolean
17
+ showDownloadPdfButton?: boolean
18
+ downloadImageButton?: boolean
19
+ downloadPdfButton?: boolean
20
+ dateDisplayFormat: string
21
+ }
@@ -0,0 +1 @@
1
+ export type UpdateFieldFunc<T> = (section: string | null, subsection: string | null, fieldName: string, value: T) => void
@@ -0,0 +1,2 @@
1
+ import { viewports } from '../helpers/getViewport'
2
+ export type ViewPort = keyof typeof viewports
@@ -1,21 +1,27 @@
1
1
  export type Visualization = {
2
- visualizationType: string
3
- dataKey: string
4
- formattedData: any
5
- dataDescription: Object
2
+ autoLoad: boolean
6
3
  data: any
7
- originalFormattedData: any
4
+ dataDescription: Object
5
+ dataFileName: string
6
+ dataFileSourceType: string
7
+ dataKey: string
8
+ datasets: Record<string, any>
8
9
  editing: boolean
9
- type: 'chart' | 'map' | 'data-bite' | 'waffle-chart' | 'markup-include' | 'filtered-text' | 'filter-dropdowns'
10
+ formattedData?: Object[]
11
+ general: any
12
+ hide: any[]
13
+ multiDashboards?: any[]
10
14
  newViz: boolean
11
15
  openModal: boolean
12
- hide: any[]
13
- autoLoad: boolean
16
+ originalFormattedData: any
17
+ orientation: 'vertical' | 'horizontal'
14
18
  table: {
15
19
  showDataTableLink: boolean
16
20
  }
17
- general: any
18
21
  title: string
22
+ type: 'dashboard' | 'chart' | 'map' | 'data-bite' | 'waffle-chart' | 'markup-include' | 'filtered-text' | 'filter-dropdowns'
19
23
  uid: string
20
24
  usesSharedFilter: any
25
+ visualizationType: string
26
+ visualizationSubType: string
21
27
  }
@@ -0,0 +1,11 @@
1
+ import { ReactElement } from 'react'
2
+
3
+ export type WCMSProps = {
4
+ config?: any
5
+ configUrl?: string
6
+ isEditor?: boolean
7
+ isDebug?: boolean
8
+ hostname?: string
9
+ containerEl?: ReactElement
10
+ sharepath?: string
11
+ }
@@ -1,21 +0,0 @@
1
- export default function getViewport(size) {
2
- let result = 'lg'
3
-
4
- const viewports = {
5
- lg: 1200,
6
- md: 992,
7
- sm: 768,
8
- xs: 576,
9
- xxs: 350
10
- }
11
-
12
- if (size > 1200) return result
13
-
14
- for (let viewport in viewports) {
15
- if (size <= viewports[viewport]) {
16
- result = viewport
17
- }
18
- }
19
-
20
- return result
21
- }