@cdc/core 4.24.3 → 4.24.4

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 (49) 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 +9 -3
  5. package/components/DataTable/components/ExpandCollapse.tsx +22 -16
  6. package/components/DataTable/helpers/chartCellMatrix.tsx +2 -2
  7. package/components/DataTable/helpers/mapCellMatrix.tsx +2 -2
  8. package/components/DataTable/types/TableConfig.ts +1 -0
  9. package/components/EditorPanel/ColumnsEditor.tsx +2 -1
  10. package/components/EditorPanel/DataTableEditor.tsx +17 -1
  11. package/components/Filters.jsx +8 -7
  12. package/components/Layout/components/Responsive.tsx +184 -0
  13. package/components/Layout/components/Sidebar/components/Sidebar.tsx +47 -0
  14. package/components/Layout/components/Sidebar/components/sidebar.styles.scss +902 -0
  15. package/components/Layout/components/Sidebar/index.tsx +3 -0
  16. package/components/Layout/components/Visualization/index.tsx +79 -0
  17. package/components/Layout/components/Visualization/visualizations.scss +33 -0
  18. package/components/Layout/index.tsx +11 -0
  19. package/components/Layout/styles/editor-grid-view.scss +156 -0
  20. package/components/Layout/styles/editor-utils.scss +197 -0
  21. package/components/Layout/styles/editor.scss +144 -0
  22. package/components/LegendCircle.jsx +4 -3
  23. package/components/MediaControls.jsx +1 -1
  24. package/components/Table/Table.tsx +7 -5
  25. package/components/Table/components/Row.tsx +6 -2
  26. package/components/Table/types/RowType.ts +3 -0
  27. package/components/Waiting.jsx +11 -1
  28. package/components/_stories/styles.scss +1 -0
  29. package/components/createBarElement.jsx +37 -34
  30. package/components/elements/SkipTo.tsx +37 -5
  31. package/components/managers/DataDesigner.tsx +18 -18
  32. package/components/ui/Icon.tsx +5 -1
  33. package/helpers/{coveUpdateWorker.js → coveUpdateWorker.ts} +7 -7
  34. package/helpers/useDataVizClasses.js +5 -5
  35. package/helpers/ver/4.24.3.ts +56 -0
  36. package/package.json +2 -2
  37. package/styles/_data-table.scss +8 -0
  38. package/styles/_global.scss +7 -4
  39. package/styles/_variables.scss +3 -0
  40. package/styles/base.scss +0 -18
  41. package/styles/v2/base/index.scss +1 -1
  42. package/styles/v2/components/ui/tooltip.scss +0 -21
  43. package/types/Axis.ts +2 -0
  44. package/types/ConfigureData.ts +8 -0
  45. package/types/DataDescription.ts +9 -0
  46. package/types/Table.ts +1 -0
  47. package/types/Visualization.ts +3 -6
  48. package/helpers/ver/4.23.js +0 -10
  49. package/helpers/ver/4.24.3.js +0 -25
@@ -0,0 +1,3 @@
1
+ import Sidebar from './components/Sidebar'
2
+
3
+ export default Sidebar
@@ -0,0 +1,79 @@
1
+ // main visualization wrapper
2
+ import { ChartConfig } from '@cdc/chart/src/types/ChartConfig'
3
+ import React, { forwardRef, useRef } from 'react'
4
+ import { Config as DataBiteConfig } from '@cdc/data-bite/src/types/Config'
5
+ import './visualizations.scss'
6
+ import { Config as WaffleChartConfig } from '@cdc/waffle-chart/src/types/Config'
7
+
8
+ type VisualizationWrapper = {
9
+ config: ChartConfig | DataBiteConfig | WaffleChartConfig
10
+ isEditor: boolean
11
+ currentViewport: string
12
+ imageId: string
13
+ children: React.ReactNode
14
+ }
15
+
16
+ const Visualization: React.FC<VisualizationWrapper> = forwardRef((props, ref) => {
17
+ const { config = {}, isEditor = false, currentViewport = 'lg', imageId = '', showEditorPanel = true } = props
18
+
19
+ const getWrappingClasses = () => {
20
+ let classes = ['cdc-open-viz-module', `${currentViewport}`, `font-${config?.fontSize}`, `${config?.theme}`]
21
+ isEditor && classes.push('spacing-wrapper')
22
+ isEditor && classes.push('isEditor')
23
+
24
+ if (isEditor && showEditorPanel) {
25
+ classes = classes.filter(item => item !== 'editor-panel--hidden')
26
+ classes.push('editor-panel--visible')
27
+ }
28
+
29
+ if (isEditor && !showEditorPanel) {
30
+ classes = classes.filter(item => item !== 'editor-panel--visible')
31
+ classes.push('editor-panel--hidden')
32
+ }
33
+
34
+ if (config.type === 'chart') {
35
+ classes.push('type-chart')
36
+ config?.visualizationType === 'Spark Line' && classes.push(`type-sparkline`)
37
+ return classes
38
+ }
39
+ if (config.type === 'map') {
40
+ classes.push(`type-map`)
41
+ }
42
+
43
+ if (config.type === 'data-bite') {
44
+ classes.push('cdc-open-viz-module', 'type-data-bite', currentViewport, config.theme, `font-${config.fontSize}`)
45
+ if (isEditor) {
46
+ classes.push('is-editor')
47
+ }
48
+ }
49
+
50
+ if (config.type === 'markup-include') {
51
+ classes.push('markup-include', 'cdc-open-viz-module')
52
+ }
53
+
54
+ if (config.type === 'waffle-chart') {
55
+ classes.push('cove', 'cdc-open-viz-module', 'type-waffle-chart', currentViewport, config.theme, 'font-' + config.overallFontSize)
56
+
57
+ if (isEditor) {
58
+ classes.push('is-editor')
59
+ }
60
+
61
+ classes.push('cove-component', 'waffle-chart')
62
+ }
63
+ return classes
64
+ }
65
+
66
+ return (
67
+ // prettier-ignore
68
+ <div
69
+ {...(config.type === 'chart' ? { 'data-lollipop': config.isLollipopChart } : {})}
70
+ className={getWrappingClasses().join(' ')}
71
+ data-download-id={imageId}
72
+ ref={ref}
73
+ >
74
+ {props.children}
75
+ </div>
76
+ )
77
+ })
78
+
79
+ export default Visualization
@@ -0,0 +1,33 @@
1
+ .cdc-open-viz-module.isEditor {
2
+ overflow: auto;
3
+ display: grid;
4
+ transition: grid-template-columns 400ms ease-in-out;
5
+
6
+ .editor-panel__toggle {
7
+ transition: left 400ms ease-in-out;
8
+ }
9
+
10
+ .sidebar {
11
+ transition: left 400ms ease-in-out;
12
+ }
13
+
14
+ &.editor-panel--visible {
15
+ grid-template-areas: 'panel content';
16
+ grid-template-columns: 350px calc(100% - 350px);
17
+ }
18
+
19
+ &.editor-panel--hidden {
20
+ grid-template-areas: 'panel content';
21
+ grid-template-columns: 0px 100%;
22
+ }
23
+
24
+ .cove-editor__content,
25
+ .cove-component__content {
26
+ grid-area: content;
27
+ position: relative;
28
+ left: 0;
29
+ width: 100% !important;
30
+ padding-left: 0px !important;
31
+ grid-area: content;
32
+ }
33
+ }
@@ -0,0 +1,11 @@
1
+ import Responsive from './components/Responsive'
2
+ import Sidebar from './components/Sidebar'
3
+ import VisualizationWrapper from './components/Visualization'
4
+
5
+ const Layout = {
6
+ Responsive,
7
+ Sidebar,
8
+ VisualizationWrapper
9
+ }
10
+
11
+ export default Layout
@@ -0,0 +1,156 @@
1
+ .cove-editor__grid-caret--bottom {
2
+ @at-root {
3
+ .cove-editor__content[data-grid] #{&}::before,
4
+ .cove-editor__content[data-grid] #{&}::after {
5
+ content: '';
6
+ display: block;
7
+ position: absolute;
8
+ bottom: -20px;
9
+ width: 14px;
10
+ height: 14px;
11
+ border-color: #949da4;
12
+ border-style: solid;
13
+ border-width: 0;
14
+ transition: opacity $editorAnimationTimer ease;
15
+ opacity: 1;
16
+ }
17
+
18
+ .cove-editor__content[data-grid] #{&}::before {
19
+ left: -20px;
20
+ border-top-width: 2px;
21
+ border-right-width: 2px;
22
+ }
23
+
24
+ .cove-editor__content[data-grid] #{&}::after {
25
+ right: -20px;
26
+ border-top-width: 2px;
27
+ border-left-width: 2px;
28
+ }
29
+
30
+ .cove-editor.panel-shown #{&}::before,
31
+ .cove-editor.panel-shown #{&}::after {
32
+ opacity: 1;
33
+ }
34
+ }
35
+ }
36
+
37
+ .cove-editor__grid-caret--top {
38
+ @at-root {
39
+ .cove-editor__content[data-grid] #{&}::before,
40
+ .cove-editor__content[data-grid] #{&}::after {
41
+ content: '';
42
+ display: block;
43
+ position: absolute;
44
+ top: -20px;
45
+ width: 14px;
46
+ height: 14px;
47
+ border-color: #949da4;
48
+ border-style: solid;
49
+ border-width: 0;
50
+ transition: opacity $editorAnimationTimer ease;
51
+ opacity: 1;
52
+ }
53
+
54
+ .cove-editor__content[data-grid] #{&}::before {
55
+ left: -20px;
56
+ border-right-width: 2px;
57
+ border-bottom-width: 2px;
58
+ }
59
+
60
+ .cove-editor__content[data-grid] #{&}::after {
61
+ right: -20px;
62
+ border-bottom-width: 2px;
63
+ border-left-width: 2px;
64
+ }
65
+
66
+ .cove-editor.panel-shown #{&}::before,
67
+ .cove-editor.panel-shown #{&}::after {
68
+ opacity: 1;
69
+ }
70
+ }
71
+ }
72
+
73
+ .cove-editor__content-wrap--x {
74
+ display: flex;
75
+ align-items: center;
76
+ position: absolute;
77
+ width: 100%;
78
+ min-width: 35rem;
79
+ max-width: 50%;
80
+ min-height: 100vh;
81
+ margin-right: auto;
82
+ margin-left: auto;
83
+ transition: max-width $editorAnimationTimer cubic-bezier(0.16, 1, 0.3, 1);
84
+
85
+ @at-root {
86
+ .cove-dashboard #{&} {
87
+ min-height: calc(100vh - 3rem);
88
+ }
89
+
90
+ .cove-tabs #{&} {
91
+ // min-height: calc(100vh - #{$wizardTabsHeight});
92
+ }
93
+
94
+ .cove-editor__content[data-grid] #{&}::before,
95
+ .cove-editor__content[data-grid] #{&}::after {
96
+ content: '';
97
+ width: 1px;
98
+ height: 100%;
99
+ top: 0;
100
+ display: block;
101
+ position: absolute;
102
+ background-image: repeating-linear-gradient(0deg, #949da4, #949da4 18px, transparent 18px, transparent 26px);
103
+ transition: opacity $editorAnimationTimer ease;
104
+ opacity: 1;
105
+ }
106
+
107
+ .cove-editor.panel-shown #{&}::before,
108
+ .cove-editor.panel-shown #{&}::after {
109
+ opacity: 1;
110
+ }
111
+
112
+ .cove-editor__content[data-grid] #{&}::before {
113
+ left: -1px;
114
+ }
115
+
116
+ .cove-editor__content[data-grid] #{&}::after {
117
+ right: -1px;
118
+ }
119
+ }
120
+ }
121
+
122
+ .cove-editor__content-wrap--y {
123
+ position: relative;
124
+ width: 100%;
125
+ margin-top: 5rem;
126
+ margin-bottom: 5rem;
127
+
128
+ @at-root {
129
+ .cove-editor__content[data-grid] #{&}::before,
130
+ .cove-editor__content[data-grid] #{&}::after {
131
+ content: '';
132
+ display: block;
133
+ position: absolute;
134
+ left: 50%;
135
+ width: 100vw;
136
+ height: 1px;
137
+ background-image: repeating-linear-gradient(90deg, #949da4, #949da4 18px, transparent 18px, transparent 26px);
138
+ transform: translateX(-50%);
139
+ transition: opacity $editorAnimationTimer ease;
140
+ opacity: 1;
141
+ }
142
+
143
+ .cove-editor.panel-shown #{&}::before,
144
+ .cove-editor.panel-shown #{&}::after {
145
+ opacity: 1;
146
+ }
147
+
148
+ .cove-editor__content[data-grid] #{&}::before {
149
+ top: -1px;
150
+ }
151
+
152
+ .cove-editor__content[data-grid] #{&}::after {
153
+ bottom: -1px;
154
+ }
155
+ }
156
+ }
@@ -0,0 +1,197 @@
1
+ $editorAnimationTimer: 400ms;
2
+ $primary: #3e92d5;
3
+
4
+ .cdc-open-viz-module .cove-editor-utils__hotkeys {
5
+ display: inline-flex;
6
+ flex-flow: row nowrap;
7
+ position: fixed;
8
+ bottom: 5rem;
9
+ left: 24rem;
10
+ padding: 0.5rem 1rem;
11
+ font-size: 0.875rem;
12
+ color: #a0a9b0;
13
+ background-color: #fff;
14
+ box-shadow: 5px 5px 10px 0 rgb(0 0 0 / 15%);
15
+ border-radius: 0.375rem;
16
+ transition: opacity $editorAnimationTimer ease, background-color 0s linear $editorAnimationTimer;
17
+ user-select: none;
18
+
19
+ &--left,
20
+ &--right {
21
+ > * {
22
+ transition: color 150ms ease;
23
+ }
24
+ }
25
+
26
+ &--left {
27
+ margin-right: 0.5rem;
28
+ font-weight: bold;
29
+ text-align: right;
30
+ }
31
+
32
+ &--right {
33
+ font-style: italic;
34
+
35
+ > * {
36
+ display: flex;
37
+ }
38
+ }
39
+
40
+ .hotkey--active {
41
+ color: #3e92d5;
42
+ }
43
+
44
+ @at-root {
45
+ .cove-editor:not(.panel-shown) #{&} {
46
+ opacity: 0;
47
+ transition: opacity $editorAnimationTimer ease, background-color 0s linear;
48
+ }
49
+
50
+ .cove-editor.panel-shown #{&} {
51
+ background-color: rgb(231 231 231 / 80%);
52
+ opacity: 1;
53
+ }
54
+ }
55
+ }
56
+
57
+ .cdc-open-viz-module .cove-editor-utils__breakpoints {
58
+ position: fixed;
59
+ bottom: 5rem;
60
+ right: 4rem;
61
+ padding: 0.5rem 1rem;
62
+ background-color: #fff;
63
+ border-radius: 999px;
64
+ box-shadow: 5px 5px 10px 0 rgb(0 0 0 / 15%);
65
+ user-select: none;
66
+
67
+ button {
68
+ padding: 0;
69
+ background: transparent;
70
+ }
71
+
72
+ @at-root {
73
+ .cove-editor:not(.panel-shown) #{&} {
74
+ animation: editorUtilsDown $editorAnimationTimer ease forwards;
75
+ }
76
+
77
+ .cove-editor.panel-shown #{&} {
78
+ animation: editorUtilsUp $editorAnimationTimer ease forwards;
79
+ }
80
+ }
81
+ }
82
+
83
+ .cove-editor-utils__breakpoints--px {
84
+ display: block;
85
+ position: absolute;
86
+ top: -2rem;
87
+ width: 100%;
88
+ font-size: 0.875rem;
89
+ text-align: center;
90
+ color: #949da4;
91
+ }
92
+
93
+ .cove-editor-utils__breakpoints-list {
94
+ display: flex;
95
+ padding-left: 0;
96
+ margin: 0;
97
+ list-style: none;
98
+ }
99
+
100
+ .cdc-open-viz-module .cove-editor-utils__breakpoints-item {
101
+ display: block;
102
+ position: relative;
103
+ margin-right: 1rem;
104
+ font-size: 0.875em;
105
+ color: $primary;
106
+ transition-property: border, color, transform;
107
+ cursor: pointer;
108
+
109
+ &:last-of-type {
110
+ margin-right: 0;
111
+ }
112
+
113
+ &:not(:last-of-type) {
114
+ &::after {
115
+ content: '';
116
+ display: inline-block;
117
+ position: absolute;
118
+ top: 0;
119
+ width: 1px;
120
+ height: 100%;
121
+ margin-left: 0.5rem;
122
+ background-color: #d3d3d3;
123
+ pointer-events: none;
124
+ }
125
+ }
126
+
127
+ &::before {
128
+ content: '';
129
+ position: absolute;
130
+ right: 0;
131
+ bottom: -1px;
132
+ left: 0;
133
+ height: 2px;
134
+ border-bottom: 2px dotted transparent;
135
+ transition-property: border;
136
+ pointer-events: none;
137
+ }
138
+
139
+ &.active::before {
140
+ border-bottom: 2px dotted #88c3ea;
141
+ }
142
+
143
+ > .cove-editor-utils__breakpoints-grid {
144
+ display: inline-flex;
145
+ height: 1.25rem;
146
+ padding-right: 0.125rem;
147
+ padding-left: 0.25rem;
148
+ }
149
+
150
+ > .cove-editor-utils__breakpoints-reset {
151
+ display: inline-flex;
152
+ height: 1.25rem;
153
+ }
154
+
155
+ @at-root {
156
+ //Gray out
157
+ .cove-editor-utils__breakpoints-list #{&} .cove-editor-utils__breakpoints-grid {
158
+ color: #b4b4b4;
159
+ }
160
+
161
+ .cove-editor-utils__breakpoints-list:hover #{&},
162
+ .cove-editor-utils__breakpoints-list.has-active #{&}:not(.active) {
163
+ color: #888;
164
+ }
165
+
166
+ //Colored
167
+ .cove-editor__content[data-grid='true'] #{&} .cove-editor-utils__breakpoints-grid,
168
+ .cove-editor-utils__breakpoints-list.has-active #{&} .cove-editor-utils__breakpoints-reset {
169
+ color: $primary !important;
170
+ }
171
+
172
+ .cove-editor-utils__breakpoints-list:hover #{&}.active,
173
+ .cove-editor-utils__breakpoints-list #{&}:hover,
174
+ .cove-editor-utils__breakpoints-list #{&}:hover .cove-editor-utils__breakpoints-grid,
175
+ .cove-editor-utils__breakpoints-list.has-active #{&}:hover {
176
+ color: $primary;
177
+ }
178
+ }
179
+ }
180
+
181
+ @keyframes editorUtilsUp {
182
+ 0% {
183
+ bottom: -3rem;
184
+ }
185
+ 100% {
186
+ bottom: 2rem;
187
+ }
188
+ }
189
+
190
+ @keyframes editorUtilsDown {
191
+ 0% {
192
+ bottom: 2rem;
193
+ }
194
+ 100% {
195
+ bottom: -3rem;
196
+ }
197
+ }
@@ -0,0 +1,144 @@
1
+ $editorAnimationTimer: 400ms;
2
+ $editorWidth: 350px;
3
+ $mediumGray: #e6e6e6;
4
+
5
+ @import 'editor-grid-view.scss';
6
+
7
+ .cdc-open-viz-module.isEditor {
8
+ background: $mediumGray !important;
9
+ }
10
+
11
+ // .cdc-open-viz-module .form-container {
12
+ // height: 100%;
13
+ // }
14
+
15
+ .cove-editor {
16
+ display: grid;
17
+ grid-template-areas: 'panel content';
18
+ grid-template-columns: auto 1fr;
19
+ position: relative;
20
+ height: 100vh;
21
+ max-height: 100%;
22
+ overflow: hidden;
23
+ isolation: isolate;
24
+
25
+ @at-root {
26
+ .cove-dashboard #{&} {
27
+ height: calc(100vh - 3rem);
28
+ }
29
+
30
+ .cove-tabs #{&} {
31
+ // height: calc(100vh - #{$wizardTabsHeight});
32
+ }
33
+ }
34
+ }
35
+
36
+ .cove-editor__toggle {
37
+ position: absolute;
38
+ top: 0.5rem;
39
+ left: 309px;
40
+ width: 1.5rem;
41
+ height: 1.5rem;
42
+ color: #000;
43
+ background-color: #f2f2f2;
44
+ border: 0;
45
+ border-radius: 999px;
46
+ transition: left 300ms ease 60ms, background-color 200ms ease;
47
+ box-shadow: rgba(0, 0, 0, 0.5) 0 1px 2px;
48
+ user-select: none;
49
+ cursor: pointer;
50
+ z-index: 8;
51
+
52
+ &:before {
53
+ content: '\00ab';
54
+ position: absolute;
55
+ top: 46%;
56
+ left: 50%;
57
+ transform: translate(-50%, -50%);
58
+ pointer-events: none;
59
+ user-select: none;
60
+ }
61
+
62
+ &.collapsed {
63
+ left: 1rem;
64
+ margin-left: 0;
65
+
66
+ &:before {
67
+ content: '\00bb';
68
+ }
69
+ }
70
+
71
+ &:hover {
72
+ background-color: #fff;
73
+ }
74
+ }
75
+
76
+ .cove-editor__panel {
77
+ grid-area: panel;
78
+ position: relative;
79
+ width: 0;
80
+ max-height: 100vh;
81
+ // padding-top: 2.5rem;
82
+ background-color: #fff;
83
+ //border-right: 1px solid #c2c2c2;
84
+ transition: width $editorAnimationTimer ease;
85
+ overflow: hidden;
86
+ box-shadow: 1px 0 0 rgb(0 0 0 / 15%);
87
+ z-index: 7;
88
+
89
+ @at-root {
90
+ .cove-editor {
91
+ width: $editorWidth;
92
+ }
93
+ }
94
+ }
95
+
96
+ // .cove-editor__panel-heading {
97
+ // box-sizing: border-box;
98
+ // position: absolute;
99
+ // top: 0;
100
+ // right: 0;
101
+ // width: $editorWidth;
102
+ // padding: 0.5rem 1.125rem;
103
+ // margin: 0;
104
+ // font-size: 1.125em;
105
+ // line-height: 1.5rem;
106
+ // color: #fff;
107
+ // background-color: $mediumGray;
108
+ // user-select: none;
109
+ // z-index: 1;
110
+ // }
111
+
112
+ // .cove-editor__panel-container {
113
+ // float: right;
114
+ // width: $editorWidth - 1px;
115
+ // min-width: $editorWidth - 1px;
116
+ // height: 100%;
117
+ // overflow: hidden auto;
118
+ // }
119
+
120
+ .cove-editor__divider {
121
+ margin-top: 1.5rem;
122
+ margin-bottom: 1.5rem;
123
+ border: 0;
124
+ border-top: 1px solid #e2e2e2;
125
+ }
126
+
127
+ .cove-editor__content {
128
+ display: flex;
129
+ position: relative;
130
+ height: 100vh;
131
+ grid-area: content;
132
+ justify-content: center;
133
+ position: relative;
134
+ background-color: #e6e6e6;
135
+ transition: background-color 400ms cubic-bezier(0.16, 1, 0.3, 1);
136
+ overflow: hidden auto;
137
+ width: calc(100% - $editorWidth);
138
+ left: $editorWidth;
139
+ @at-root {
140
+ .cove-editor.panel-shown #{&} {
141
+ background-color: #e7e7e7;
142
+ }
143
+ }
144
+ }
@@ -1,13 +1,14 @@
1
1
  import React from 'react'
2
2
 
3
- export default function LegendCircle({ fill, borderColor, display = 'inline-block' }) {
3
+ export default function LegendCircle({ fill, borderColor, display = 'inline-block', viewport }) {
4
+ const dimensions = ['sm', 'xs', 'xxs'].includes(viewport) ? { width: '0.7em', height: '0.7em' } : { width: '1em', height: '1em' }
4
5
  const styles = {
5
6
  marginRight: '5px',
6
7
  borderRadius: '300px',
7
8
  verticalAlign: 'middle',
8
9
  display: display,
9
- height: '1em',
10
- width: '1em',
10
+ height: dimensions.height || '1em',
11
+ width: dimensions.width || '1em',
11
12
  border: borderColor ? `${borderColor} 1px solid` : 'rgba(0,0,0,.3) 1px solid',
12
13
  backgroundColor: fill
13
14
  }
@@ -59,7 +59,7 @@ const generateMedia = (state, type, elementToCapture) => {
59
59
 
60
60
  switch (type) {
61
61
  case 'image':
62
- html2canvas(baseSvg, {foreignObjectRendering: true, x: -1 * (window.pageXOffset + baseSvg.getBoundingClientRect().left), y: -1 * (window.pageYOffset + baseSvg.getBoundingClientRect().top)}).then(canvas => {
62
+ html2canvas(baseSvg).then(canvas => {
63
63
  saveImageAs(canvas.toDataURL(), filename + '.png')
64
64
  })
65
65
  return
@@ -19,11 +19,13 @@ type TableProps = {
19
19
  }
20
20
  wrapColumns?: boolean
21
21
  hasRowType?: boolean // if it has row type then the first column is the row type which will explain how to render the row
22
+ fontSize: 'small' | 'medium' | 'large'
23
+ viewport: 'lg' | 'md' | 'sm' | 'xs' | 'xxs'
22
24
  }
23
25
 
24
26
  type Position = 'sticky'
25
27
 
26
- const Table = ({ childrenMatrix, tableName, caption, stickyHeader, headContent, tableOptions, wrapColumns, hasRowType }: TableProps) => {
28
+ const Table = ({ childrenMatrix, tableName, caption, stickyHeader, headContent, tableOptions, wrapColumns, hasRowType, fontSize, viewport }: TableProps) => {
27
29
  const headStyle = stickyHeader ? { position: 'sticky' as Position, top: 0, zIndex: 2 } : {}
28
30
  const isGroupedMatrix = !Array.isArray(childrenMatrix)
29
31
  return (
@@ -37,7 +39,7 @@ const Table = ({ childrenMatrix, tableName, caption, stickyHeader, headContent,
37
39
  const rows = childrenMatrix[groupName].map((row, i) => {
38
40
  colSpan = row.length
39
41
  const key = `${tableName}-${groupName}-row-${i}`
40
- return <Row key={key} rowKey={key} childRow={row} wrapColumns={wrapColumns} cellMinWidth={tableOptions.cellMinWidth} />
42
+ return <Row key={key} rowKey={key} childRow={row} wrapColumns={wrapColumns} cellMinWidth={tableOptions.cellMinWidth} fontSize={fontSize} viewport={viewport} />
41
43
  })
42
44
  return [<GroupRow label={groupName} colSpan={colSpan} key={`${tableName}-${groupName}`} />, ...rows]
43
45
  })
@@ -47,17 +49,17 @@ const Table = ({ childrenMatrix, tableName, caption, stickyHeader, headContent,
47
49
  if (hasRowType) rowType = childRowCopy.shift()
48
50
  const key = `${tableName}-row-${i}`
49
51
  if (rowType === undefined) {
50
- return <Row key={key} rowKey={key} childRow={childRow} wrapColumns={wrapColumns} cellMinWidth={tableOptions.cellMinWidth} />
52
+ return <Row key={key} rowKey={key} childRow={childRow} wrapColumns={wrapColumns} cellMinWidth={tableOptions.cellMinWidth} fontSize={fontSize} viewport={viewport} />
51
53
  } else {
52
54
  switch (rowType) {
53
55
  case RowType.row_group:
54
56
  return <GroupRow label={childRowCopy[0]} colSpan={childRowCopy.length} key={key} />
55
57
  case RowType.total:
56
- return <Row key={key} rowKey={key} childRow={childRowCopy} isTotal={true} wrapColumns={wrapColumns} cellMinWidth={tableOptions.cellMinWidth} />
58
+ return <Row key={key} rowKey={key} childRow={childRowCopy} isTotal={true} wrapColumns={wrapColumns} cellMinWidth={tableOptions.cellMinWidth} fontSize={fontSize} viewport={viewport} />
57
59
  case RowType.row_group_total:
58
60
  return <GroupRow label={childRowCopy[0]} colSpan={1} key={key} data={childRowCopy.slice(1)} />
59
61
  default:
60
- return <Row key={key} rowKey={key} childRow={childRowCopy} wrapColumns={wrapColumns} cellMinWidth={tableOptions.cellMinWidth} />
62
+ return <Row key={key} rowKey={key} childRow={childRowCopy} wrapColumns={wrapColumns} cellMinWidth={tableOptions.cellMinWidth} fontSize={fontSize} viewport={viewport} />
61
63
  }
62
64
  }
63
65
  })}