@cdc/dashboard 1.1.1 → 1.1.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.
- package/dist/cdcdashboard.js +378 -0
- package/examples/default-data.json +368 -0
- package/examples/default.json +156 -0
- package/examples/test-example.json +1 -0
- package/package.json +13 -11
- package/src/CdcDashboard.js +491 -0
- package/src/components/Column.js +46 -0
- package/src/components/DataTable.tsx +172 -0
- package/src/components/EditorPanel.js +354 -0
- package/src/components/Grid.js +28 -0
- package/src/components/Header.js +15 -0
- package/src/components/Row.js +137 -0
- package/src/components/Widget.js +112 -0
- package/src/context.tsx +5 -0
- package/src/data/initial-state.js +17 -0
- package/src/images/icon-close.svg +1 -0
- package/src/images/icon-code.svg +3 -0
- package/src/images/icon-col-12.svg +3 -0
- package/src/images/icon-col-4-8.svg +3 -0
- package/src/images/icon-col-4.svg +3 -0
- package/src/images/icon-col-6.svg +3 -0
- package/src/images/icon-col-8-4.svg +3 -0
- package/src/images/icon-down.svg +1 -0
- package/src/images/icon-edit.svg +3 -0
- package/src/images/icon-grid.svg +4 -0
- package/src/images/icon-move.svg +8 -0
- package/src/images/icon-up.svg +1 -0
- package/src/images/warning.svg +1 -0
- package/src/index.html +27 -0
- package/src/index.js +17 -0
- package/src/scss/editor-panel.scss +652 -0
- package/src/scss/grid.scss +321 -0
- package/src/scss/main.scss +214 -0
- package/src/scss/mixins.scss +0 -0
- package/src/scss/variables.scss +1 -0
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
$blue-light: #8bc6f7;
|
|
2
|
+
$red: #f74242;
|
|
3
|
+
|
|
4
|
+
.layout-container {
|
|
5
|
+
display: flex;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.visualizations-panel {
|
|
9
|
+
background-color: #fff;
|
|
10
|
+
padding: 1em;
|
|
11
|
+
width: 350px;
|
|
12
|
+
border-right: #C7C7C7 1px solid;
|
|
13
|
+
position: fixed;
|
|
14
|
+
top: 3em;
|
|
15
|
+
bottom: 0;
|
|
16
|
+
z-index: 1;
|
|
17
|
+
overflow-y: auto;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.hidden.editor-panel + .builder-grid {
|
|
21
|
+
margin-left: 0 !important;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.config-needed {
|
|
25
|
+
color: $red;
|
|
26
|
+
font-size: .75em;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.builder-grid {
|
|
30
|
+
flex-grow: 1;
|
|
31
|
+
padding: 5em 3em 3em;
|
|
32
|
+
margin-left: calc(350px + 1em);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.column-container {
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-flow: row;
|
|
38
|
+
width: 100%;
|
|
39
|
+
position: relative;
|
|
40
|
+
top: 0;
|
|
41
|
+
padding: 1em;
|
|
42
|
+
border: 1px solid #C2C2C2;
|
|
43
|
+
transition: border 300ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
44
|
+
background-color: #F2F2F2;
|
|
45
|
+
user-select: none;
|
|
46
|
+
&.can-drop {
|
|
47
|
+
border-color: $blue-light;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.row-menu {
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: flex-start;
|
|
54
|
+
transition: opacity 300ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
55
|
+
user-select: none;
|
|
56
|
+
position: relative;
|
|
57
|
+
z-index: 1;
|
|
58
|
+
bottom: -1px;
|
|
59
|
+
> li:not(.spacer) + li:not(.spacer) {
|
|
60
|
+
margin-left: .3em;
|
|
61
|
+
}
|
|
62
|
+
.spacer {
|
|
63
|
+
flex-grow: 1;
|
|
64
|
+
}
|
|
65
|
+
svg {
|
|
66
|
+
width: 25px;
|
|
67
|
+
height: auto;
|
|
68
|
+
max-height: 20px;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.builder-grid > * + * {
|
|
73
|
+
margin-top: 2em;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.row-menu__btn:hover .row-menu__flyout {
|
|
77
|
+
transition: width .2s cubic-bezier(0.16, 1, 0.3, 1);
|
|
78
|
+
width: 144px;
|
|
79
|
+
li {
|
|
80
|
+
display: flex;
|
|
81
|
+
}
|
|
82
|
+
li + li {
|
|
83
|
+
margin-left: .3em;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.row-menu__flyout {
|
|
88
|
+
list-style: none;
|
|
89
|
+
display: flex;
|
|
90
|
+
justify-content: flex-start;
|
|
91
|
+
overflow: hidden;
|
|
92
|
+
transition: width .2s cubic-bezier(0.16, 1, 0.3, 1);
|
|
93
|
+
z-index: 1;
|
|
94
|
+
width: 25px;
|
|
95
|
+
li:not(.current) {
|
|
96
|
+
display: none;
|
|
97
|
+
}
|
|
98
|
+
li svg {
|
|
99
|
+
opacity: .7;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
li:hover svg, li.current svg {
|
|
103
|
+
opacity: 1;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.row-menu__list--item {
|
|
107
|
+
display: flex;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.row-menu__btn {
|
|
112
|
+
background-color: #C2C2C2;
|
|
113
|
+
border-radius: .2em .2em 0 0;
|
|
114
|
+
outline: none;
|
|
115
|
+
transition: background-color 300ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
116
|
+
cursor: pointer;
|
|
117
|
+
padding: .2em .3em;
|
|
118
|
+
display: flex;
|
|
119
|
+
fill: #fff;
|
|
120
|
+
+ .row-menu__btn {
|
|
121
|
+
margin-left: .2em;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.row-menu__btn-disabled {
|
|
126
|
+
pointer-events: none;
|
|
127
|
+
opacity: .3;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.row-menu__btn--edit {
|
|
131
|
+
display: block;
|
|
132
|
+
padding: 0;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.builder-column {
|
|
136
|
+
display: flex;
|
|
137
|
+
justify-content: center;
|
|
138
|
+
align-items: center;
|
|
139
|
+
position: relative;
|
|
140
|
+
height: 150px;
|
|
141
|
+
margin-left: 0.5rem;
|
|
142
|
+
margin-right: 0.5rem;
|
|
143
|
+
background-color: transparent;
|
|
144
|
+
border: 2px dashed #C2C2C2;
|
|
145
|
+
flex: 1 1 auto;
|
|
146
|
+
&:hover {
|
|
147
|
+
border-color: darken(#c2c2c2, 20%);
|
|
148
|
+
}
|
|
149
|
+
&.column--populated {
|
|
150
|
+
background: none;
|
|
151
|
+
border: none;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.column--drop {
|
|
156
|
+
background-color: #e8f4ff;
|
|
157
|
+
border: 2px dashed $blue-light;
|
|
158
|
+
background-image: none;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.column-size--12 {width: 100%;}
|
|
162
|
+
.column-size--8 {width: 66.666%;}
|
|
163
|
+
.column-size--6 {width: 50%;}
|
|
164
|
+
.column-size--4 {width: 33.333%;}
|
|
165
|
+
|
|
166
|
+
.builder-column__text {
|
|
167
|
+
padding: 0.5rem;
|
|
168
|
+
text-align: center;
|
|
169
|
+
font-weight: 400;
|
|
170
|
+
font-style: normal;
|
|
171
|
+
font-size: 13px;
|
|
172
|
+
line-height: 19px;
|
|
173
|
+
color: $mediumGray;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.widget {
|
|
177
|
+
display: flex;
|
|
178
|
+
height: 100%;
|
|
179
|
+
border: 1px solid $lightGray;
|
|
180
|
+
background-color: #fff;
|
|
181
|
+
text-align: center;
|
|
182
|
+
border-radius: 2px;
|
|
183
|
+
background-repeat: no-repeat;
|
|
184
|
+
background-position: right 5px top 5px;
|
|
185
|
+
width: 100%;
|
|
186
|
+
padding: 0;
|
|
187
|
+
position: relative;
|
|
188
|
+
cursor: move;
|
|
189
|
+
&:hover {
|
|
190
|
+
border-color: darken($lightGray, 20%);
|
|
191
|
+
.widget-menu-item svg {
|
|
192
|
+
fill: darken($mediumGray, 20%);
|
|
193
|
+
}
|
|
194
|
+
svg.drag-icon {
|
|
195
|
+
fill: darken($lightGray, 20%);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
svg.drag-icon {
|
|
199
|
+
fill: $lightGray;
|
|
200
|
+
position: absolute;
|
|
201
|
+
left: .3em;
|
|
202
|
+
top: .3em;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.widget__media {
|
|
207
|
+
display: flex;
|
|
208
|
+
justify-content: center;
|
|
209
|
+
align-items: center;
|
|
210
|
+
width: 100%;
|
|
211
|
+
height: 35px;
|
|
212
|
+
margin-top: 8px;
|
|
213
|
+
flex: 0 0 100%;
|
|
214
|
+
|
|
215
|
+
img {
|
|
216
|
+
width: auto;
|
|
217
|
+
height: auto;
|
|
218
|
+
max-height: 100%;
|
|
219
|
+
max-width: 100%;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.widget__content {
|
|
224
|
+
padding: 0.5rem;
|
|
225
|
+
text-align: center;
|
|
226
|
+
font-family: sans-serif;
|
|
227
|
+
font-weight: 400;
|
|
228
|
+
font-style: normal;
|
|
229
|
+
color: $darkGray;
|
|
230
|
+
flex-grow: 1;
|
|
231
|
+
max-height: 100%;
|
|
232
|
+
display: flex;
|
|
233
|
+
flex-direction: column;
|
|
234
|
+
align-items: center;
|
|
235
|
+
justify-content: center;
|
|
236
|
+
svg {
|
|
237
|
+
margin-bottom: .5em;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.widget-card {
|
|
242
|
+
position: relative;
|
|
243
|
+
display: flex;
|
|
244
|
+
flex-flow: column;
|
|
245
|
+
justify-content: center;
|
|
246
|
+
align-items: center;
|
|
247
|
+
width: 100%;
|
|
248
|
+
height: 100%;
|
|
249
|
+
border: 2px solid #eaeaea;
|
|
250
|
+
background-color: #fff;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.widget-card__media {
|
|
254
|
+
img {
|
|
255
|
+
max-height: 50px;
|
|
256
|
+
margin-bottom: 0.5rem;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.widget-menu {
|
|
261
|
+
position: absolute;
|
|
262
|
+
top: 6px;
|
|
263
|
+
right: 6px;
|
|
264
|
+
display: flex;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.widget-menu-item {
|
|
268
|
+
display: block;
|
|
269
|
+
width: 20px;
|
|
270
|
+
height: 20px;
|
|
271
|
+
cursor: pointer;
|
|
272
|
+
user-select: none;
|
|
273
|
+
svg {
|
|
274
|
+
fill: $mediumGray;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.btn.add-row {
|
|
279
|
+
font-size: 1.1em;
|
|
280
|
+
width: 100%;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.btn--fluid {
|
|
284
|
+
@extend .btn;
|
|
285
|
+
width: 100%;
|
|
286
|
+
text-align: center;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.builder-row {
|
|
290
|
+
position: relative;
|
|
291
|
+
.widget__content {
|
|
292
|
+
padding: 0 2em;
|
|
293
|
+
> svg {
|
|
294
|
+
width: 100%;
|
|
295
|
+
height: auto;
|
|
296
|
+
max-width: 100px;
|
|
297
|
+
max-height: 80px;
|
|
298
|
+
flex-grow: 1;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
&:hover {
|
|
302
|
+
.row-menu .row-menu__btn {
|
|
303
|
+
background-color: $blue;
|
|
304
|
+
|
|
305
|
+
&:hover {
|
|
306
|
+
background-color: lighten($blue, 8%);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
&.row-menu__btn--edit {
|
|
310
|
+
background-color: transparent;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
&.row-menu__btn--remove:hover {
|
|
314
|
+
background-color: $red;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
.column-container {
|
|
318
|
+
border-color: $blue;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
@import '~@cdc/core/styles/base';
|
|
2
|
+
@import "~@cdc/core/styles/heading-colors";
|
|
3
|
+
@import 'mixins';
|
|
4
|
+
@import 'variables';
|
|
5
|
+
|
|
6
|
+
.cdc-open-viz-module.type-dashboard {
|
|
7
|
+
@import 'editor-panel';
|
|
8
|
+
@import 'grid';
|
|
9
|
+
.loading > div.la-ball-beat {
|
|
10
|
+
margin-top: 20%;
|
|
11
|
+
}
|
|
12
|
+
.editor-heading {
|
|
13
|
+
background-color: #fff;
|
|
14
|
+
border-bottom: #C7C7C7 1px solid;
|
|
15
|
+
padding: 0 1em;
|
|
16
|
+
display: flex;
|
|
17
|
+
height: 3em;
|
|
18
|
+
justify-content: space-between;
|
|
19
|
+
align-items: center;
|
|
20
|
+
position: fixed;
|
|
21
|
+
width: 100%;
|
|
22
|
+
z-index: 99;
|
|
23
|
+
top: 0;
|
|
24
|
+
.heading-1 {
|
|
25
|
+
font-size: 1.2em;
|
|
26
|
+
&.back-to {
|
|
27
|
+
display: flex;
|
|
28
|
+
span {
|
|
29
|
+
font-weight: bold;
|
|
30
|
+
padding-right: .3em;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.toggle-bar {
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
display: flex;
|
|
38
|
+
list-style: none;
|
|
39
|
+
align-self: stretch;
|
|
40
|
+
position: relative;
|
|
41
|
+
bottom: -1px;
|
|
42
|
+
li {
|
|
43
|
+
padding: .6em 1.5em;
|
|
44
|
+
color: $mediumGray;
|
|
45
|
+
border-bottom: #C7C7C7 1px solid;
|
|
46
|
+
cursor: pointer;
|
|
47
|
+
&.active {
|
|
48
|
+
border-bottom-width: 5px;
|
|
49
|
+
border-bottom-color: $mediumGray;
|
|
50
|
+
color: $darkGray;
|
|
51
|
+
}
|
|
52
|
+
&:hover {
|
|
53
|
+
border-bottom-color: $darkGray;
|
|
54
|
+
color: $darkGray;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.visually-hidden {
|
|
61
|
+
position: fixed;
|
|
62
|
+
left: -10000px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.loader {
|
|
66
|
+
width: 100%;
|
|
67
|
+
text-align: center;
|
|
68
|
+
display: inline-block;
|
|
69
|
+
animation: spin 1s linear infinite;
|
|
70
|
+
|
|
71
|
+
&::before {
|
|
72
|
+
content: '\21BB';
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.btn {
|
|
77
|
+
background: #005eaa;
|
|
78
|
+
color: #fff;
|
|
79
|
+
border: 0;
|
|
80
|
+
padding: .4em .8em;
|
|
81
|
+
font-size: .9em;
|
|
82
|
+
display: block;
|
|
83
|
+
border-radius: 5px;
|
|
84
|
+
transition: .1s all;
|
|
85
|
+
cursor: pointer;
|
|
86
|
+
|
|
87
|
+
&[disabled] {
|
|
88
|
+
opacity: 0.5;
|
|
89
|
+
z-index: -1;
|
|
90
|
+
position: relative;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.warning-icon {
|
|
95
|
+
position: relative;
|
|
96
|
+
top: 2px;
|
|
97
|
+
width: 15px;
|
|
98
|
+
height: 15px;
|
|
99
|
+
margin-left: 5px;
|
|
100
|
+
|
|
101
|
+
path {
|
|
102
|
+
fill: #d8000c;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
div.dashboard-title {
|
|
107
|
+
color: white;
|
|
108
|
+
padding: .6em .8em;
|
|
109
|
+
border-bottom-width: 3px;
|
|
110
|
+
border-bottom-style: solid;
|
|
111
|
+
margin: 0;
|
|
112
|
+
color: #fff;
|
|
113
|
+
font-size: 1.1em;
|
|
114
|
+
position: relative;
|
|
115
|
+
em {
|
|
116
|
+
font-style: italic;
|
|
117
|
+
}
|
|
118
|
+
strong {
|
|
119
|
+
font-weight: bold;
|
|
120
|
+
}
|
|
121
|
+
&:not(:empty) {
|
|
122
|
+
margin: 0 0 1rem 0 !important;
|
|
123
|
+
padding: .6em .8em;
|
|
124
|
+
border-bottom-width: 3px;
|
|
125
|
+
border-bottom-style: solid;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.dashboard-description {
|
|
130
|
+
margin-bottom: 20px;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.dashboard-row {
|
|
134
|
+
display: flex;
|
|
135
|
+
flex-direction: column;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.dashboard-col {
|
|
139
|
+
margin: 0;
|
|
140
|
+
// Disable the module individual margin
|
|
141
|
+
.map-container, .cdc-chart-inner-container > * {
|
|
142
|
+
margin-left: 0;
|
|
143
|
+
margin-right: 0;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.dashboard-col-12 {
|
|
148
|
+
width: 100%;
|
|
149
|
+
}
|
|
150
|
+
@include breakpointClass(md) {
|
|
151
|
+
.dashboard-row {
|
|
152
|
+
flex-direction: row;
|
|
153
|
+
margin: 1em 0;
|
|
154
|
+
justify-content: space-between;
|
|
155
|
+
column-gap: 1em;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.dashboard-col-8 {
|
|
159
|
+
width: 66%;
|
|
160
|
+
}
|
|
161
|
+
.dashboard-col-6 {
|
|
162
|
+
width: 50%;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.dashboard-col-4 {
|
|
166
|
+
width: 33%;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
@include breakpointClass(sm) {
|
|
171
|
+
.dashboard-col {
|
|
172
|
+
margin-bottom: 1em;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
@include breakpointClass(xs) {
|
|
177
|
+
.dashboard-col {
|
|
178
|
+
margin-bottom: 1em;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.dashboard-filters-section {
|
|
183
|
+
margin: 0 0 1em;
|
|
184
|
+
}
|
|
185
|
+
.builder-grid .editor-heading {
|
|
186
|
+
position: relative;
|
|
187
|
+
right: -2em;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.cdc-dashboard-inner-container {
|
|
191
|
+
margin: 1em;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.sub-editor {
|
|
195
|
+
margin-top: 40px;
|
|
196
|
+
.sub-editor-heading {
|
|
197
|
+
display: flex;
|
|
198
|
+
align-items: center;
|
|
199
|
+
padding: 1em;
|
|
200
|
+
position: fixed;
|
|
201
|
+
top: 0;
|
|
202
|
+
width: 100%;
|
|
203
|
+
height: 40px;
|
|
204
|
+
background-color: red;
|
|
205
|
+
z-index: 101;
|
|
206
|
+
}
|
|
207
|
+
.editor-panel {
|
|
208
|
+
top: 40px;
|
|
209
|
+
}
|
|
210
|
+
.editor-toggle {
|
|
211
|
+
top: 3em;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
$editorWidth: 350px;
|