@cdc/core 1.1.2 → 1.1.3

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 (63) hide show
  1. package/assets/alabama-graphic.svg +23 -0
  2. package/assets/check.svg +3 -0
  3. package/assets/dashboard.svg +11 -0
  4. package/assets/file-upload-solid.svg +1 -0
  5. package/assets/horizontal-stacked-bar.svg +1 -0
  6. package/assets/icon-code.svg +3 -0
  7. package/assets/icon-grid.svg +4 -0
  8. package/assets/icon-info.svg +3 -0
  9. package/assets/icon-warning.svg +3 -0
  10. package/assets/link.svg +1 -0
  11. package/assets/map-folded.svg +1 -0
  12. package/assets/paired-bar.svg +11 -0
  13. package/assets/upload-solid.svg +1 -0
  14. package/assets/usa-region-graphic.svg +393 -0
  15. package/components/AdvancedEditor.js +74 -0
  16. package/components/GlobalContext.jsx +41 -0
  17. package/components/Loading.js +3 -2
  18. package/components/elements/Button.jsx +12 -0
  19. package/components/inputs/InputCheckbox.jsx +59 -0
  20. package/components/inputs/InputSelect.jsx +49 -0
  21. package/components/inputs/InputText.jsx +68 -0
  22. package/components/inputs/InputToggle.jsx +95 -0
  23. package/components/ui/Accordion.jsx +64 -0
  24. package/components/ui/Icon.jsx +63 -0
  25. package/components/ui/Modal.jsx +87 -0
  26. package/components/ui/Overlay.jsx +84 -0
  27. package/components/ui/OverlayFrame.jsx +16 -0
  28. package/components/ui/Tooltip.jsx +55 -0
  29. package/data/colorPalettes.js +240 -0
  30. package/helpers/events.js +15 -0
  31. package/helpers/numberFromString.js +4 -3
  32. package/helpers/updatePaletteNames.js +18 -0
  33. package/helpers/validateFipsCodeLength.js +67 -0
  34. package/package.json +16 -2
  35. package/styles/_data-table.scss +8 -2
  36. package/styles/_global.scss +5 -3
  37. package/styles/v2/base/_general.scss +46 -0
  38. package/styles/v2/base/_reset.scss +81 -0
  39. package/styles/v2/base/_typography.scss +0 -0
  40. package/styles/v2/base/index.scss +3 -0
  41. package/styles/v2/components/accordion.scss +156 -0
  42. package/styles/v2/components/button.scss +178 -0
  43. package/styles/v2/components/editor.scss +487 -0
  44. package/styles/v2/components/icon.scss +23 -0
  45. package/styles/v2/components/input.scss +372 -0
  46. package/styles/v2/components/modal.scss +64 -0
  47. package/styles/v2/components/overlay.scss +80 -0
  48. package/styles/v2/layout/_alert.scss +36 -0
  49. package/styles/v2/layout/_component.scss +31 -0
  50. package/styles/v2/layout/_data-table.scss +278 -0
  51. package/styles/v2/layout/_header.scss +13 -0
  52. package/styles/v2/layout/_link.scss +46 -0
  53. package/styles/v2/layout/_progression.scss +80 -0
  54. package/styles/v2/layout/_tooltip.scss +132 -0
  55. package/styles/v2/layout/index.scss +7 -0
  56. package/styles/v2/main.scss +15 -0
  57. package/styles/v2/themes/_color-definitions.scss +129 -0
  58. package/styles/v2/themes/index.scss +1 -0
  59. package/styles/v2/utils/_animations.scss +63 -0
  60. package/styles/v2/utils/_functions.scss +0 -0
  61. package/styles/v2/utils/_mixins.scss +29 -0
  62. package/styles/v2/utils/_variables.scss +2 -0
  63. package/styles/v2/utils/index.scss +4 -0
@@ -0,0 +1,372 @@
1
+ @import "../utils/variables";
2
+ @import "../themes/index";
3
+
4
+ input, datalist, textarea, select {
5
+ transition: border-color 200ms $transition-expo-out;
6
+ font-family: sans-serif;
7
+ }
8
+
9
+ input[type="text"],
10
+ input[type="number"],
11
+ input[type="date"],
12
+ input[type="search"],
13
+ datalist, textarea, select {
14
+ padding: 0.5em 0.5em;
15
+ border-width: 1px;
16
+ border-style: solid;
17
+ border-color: #cbcbcb;
18
+ border-radius: 3px;
19
+ width: 100%;
20
+
21
+ &::placeholder {
22
+ transition: opacity 400ms $transition-expo-out;
23
+ color: #b3b3b3;
24
+ opacity: 1;
25
+ }
26
+
27
+ &:focus {
28
+ border-width: 1px;
29
+ border-style: solid;
30
+ border-color: #4c4c4c;
31
+ outline: 0;
32
+
33
+ &::placeholder {
34
+ opacity: 0;
35
+ }
36
+ }
37
+ }
38
+
39
+ select {
40
+ &.input--small {
41
+ padding: 0;
42
+ }
43
+ }
44
+
45
+ input[type="text"] {
46
+ }
47
+
48
+ textarea {
49
+ width: 100%;
50
+ min-height: 140px;
51
+ max-width: 100%;
52
+ line-height: 1.5em;
53
+ }
54
+
55
+ label {
56
+ display: block;
57
+ font-size: 0.8em;
58
+ text-transform: uppercase;
59
+ user-select: none;
60
+
61
+ &:not(:first-child) {
62
+ margin-top: 1em;
63
+ }
64
+ }
65
+
66
+ .cove-input-group {
67
+ &:not(:last-child) {
68
+ margin-bottom: 1.5em;
69
+ }
70
+
71
+ > label {
72
+ margin-bottom: 0.5rem;
73
+ }
74
+
75
+ .cove-input-group--checkbox:last-of-type,
76
+ .cove-input-group--radio:last-of-type {
77
+ margin-bottom: 0;
78
+ }
79
+ }
80
+
81
+ .cove-input-group--checkbox {
82
+ margin-bottom: 1rem;
83
+ }
84
+
85
+ .cove-input-group--checkbox,
86
+ .cove-input-group--radio {
87
+ display: flex;
88
+ align-items: center;
89
+
90
+ label,
91
+ input[type="checkbox"],
92
+ input[type="radio"] {
93
+ cursor: pointer;
94
+ user-select: none;
95
+ }
96
+
97
+ label {
98
+ padding-right: 6px;
99
+
100
+ + input[type="checkbox"],
101
+ + input[type="radio"] {
102
+ margin-left: 0;
103
+ }
104
+ }
105
+
106
+ input[type="checkbox"],
107
+ input[type="radio"] {
108
+ display: inline-block;
109
+ margin-right: 0;
110
+ margin-left: 0;
111
+
112
+ + label {
113
+ padding-right: 0;
114
+ padding-left: 6px;
115
+ }
116
+ }
117
+
118
+ input[type="radio"] {
119
+ margin-bottom: 5px;
120
+ }
121
+ }
122
+
123
+ .cove-input--hidden {
124
+ position: absolute;
125
+ z-index: -999;
126
+ width: 1px;
127
+ height: 1px;
128
+ margin: 0;
129
+ opacity: 0;
130
+ pointer-events: none;
131
+ }
132
+
133
+ .cove-input__toggle {
134
+ display: inline-block;
135
+ position: relative;
136
+ width: 60px;
137
+ height: 26px;
138
+ padding: 3px;
139
+ cursor: pointer;
140
+
141
+ &.active {
142
+ .cove-input__toggle-button {
143
+ left: 100%;
144
+ transform: translateX(-100%);
145
+ }
146
+
147
+ .cove-input__toggle-track {
148
+ background-color: #75b936;
149
+ }
150
+ }
151
+
152
+ &.toggle--block {
153
+ width: unset;
154
+ aspect-ratio: 1.85/1;
155
+ padding: 4px;
156
+
157
+ .cove-input__toggle-button {
158
+ border-radius: 10%;
159
+ box-shadow: 0 2px 5px 0 rgb(0 0 0 / 20%);
160
+ }
161
+
162
+ .cove-input__toggle-track {
163
+ border-radius: 4px;
164
+ box-shadow: 0 0 0 transparent;
165
+ }
166
+
167
+ &.active {
168
+ .cove-input__toggle-track {
169
+ box-shadow: inset -40px 0 10px -10px rgb(0 0 0 / 15%);
170
+ }
171
+ }
172
+ }
173
+
174
+ &.toggle--pill {
175
+ width: 60px;
176
+ height: 25px;
177
+
178
+ .cove-input__toggle-button {
179
+ border-radius: 999px;
180
+ aspect-ratio: 1.75/1;
181
+
182
+ &::before,
183
+ &::after {
184
+ content: '';
185
+ display: block;
186
+ width: 1px;
187
+ height: calc(100% - 10px);
188
+ background: linear-gradient(0deg, rgba(255, 255, 255, 1) 0%, rgba(227, 227, 227, 1) 30%, rgba(227, 227, 227, 1) 70%, rgba(255, 255, 255, 1) 100%);
189
+ position: absolute;
190
+ top: 5px;
191
+ }
192
+
193
+ &::before {
194
+ left: 42%;
195
+ }
196
+
197
+ &::after {
198
+ right: 42%;
199
+ }
200
+ }
201
+ }
202
+
203
+ &.toggle--3d {
204
+ .cove-input__toggle-button {
205
+ background: radial-gradient(circle at 100% 0%, rgba(255, 255, 255, 1) 45%, rgb(200 200 200) 100%);
206
+ box-shadow: 0 1px 3px 1px rgb(0 0 0 / 40%), inset 0 0 3px 2px #fff;
207
+ height: 160%;
208
+ top: -30%;
209
+ transform: translateX(-20%);
210
+
211
+ &:after {
212
+ content: '';
213
+ display: block;
214
+ position: absolute;
215
+ top: 0;
216
+ left: 0;
217
+ width: calc(100% - 6px);
218
+ height: calc(100% - 6px);
219
+ border: 1px solid #ececec;
220
+ border-radius: 999px;
221
+ margin: 3px;
222
+ }
223
+ }
224
+
225
+ .cove-input__toggle-track {
226
+ box-shadow: inset 1px 1px 3px rgb(0 0 0 / 40%)
227
+ }
228
+
229
+ &.active {
230
+ .cove-input__toggle-button {
231
+ transform: translateX(-80%);
232
+ }
233
+
234
+ .cove-input__toggle-track {
235
+ box-shadow: inset 1px 1px 3px rgb(0 0 0 / 60%)
236
+ }
237
+ }
238
+ }
239
+ }
240
+
241
+ .cove-input__toggle--small {
242
+ @extend .cove-input__toggle;
243
+ width: 40px;
244
+ height: 20px;
245
+
246
+ &.toggle--pill {
247
+ width: 45px;
248
+ height: 20px;
249
+
250
+ .cove-input__toggle-button {
251
+ aspect-ratio: 1.5/1;
252
+
253
+ &:before,
254
+ &:after {
255
+ display: none;
256
+ }
257
+ }
258
+ }
259
+
260
+ &.toggle--3d {
261
+ .cove-input__toggle-button {
262
+ box-shadow: 0 1px 2px 2px rgb(0 0 0 / 22%), inset 0 0 3px 2px #fff;
263
+
264
+ &:after {
265
+ width: calc(100% - 4px);
266
+ height: calc(100% - 4px);
267
+ margin: 2px;
268
+ }
269
+ }
270
+ }
271
+ }
272
+
273
+ .cove-input__toggle--large {
274
+ @extend .cove-input__toggle;
275
+ width: 80px;
276
+ height: 35px;
277
+
278
+ &.toggle--pill {
279
+ width: 80px;
280
+ height: 30px;
281
+ }
282
+
283
+ &.toggle--3d {
284
+ .cove-input__toggle-button {
285
+
286
+ &:after {
287
+ width: calc(100% - 8px);
288
+ height: calc(100% - 8px);
289
+ margin: 4px;
290
+ }
291
+ }
292
+ }
293
+ }
294
+
295
+ .cove-input__toggle-button {
296
+ position: relative;
297
+ left: 0;
298
+ height: 100%;
299
+ aspect-ratio: 1/1;
300
+ background-color: #fff;
301
+ box-shadow: -2px 4px 10px -7px rgb(0 0 0);
302
+ border-radius: 100%;
303
+ transition: all 200ms $transition-expo-out;
304
+ z-index: 2;
305
+ }
306
+
307
+ .cove-input__toggle-track {
308
+ position: absolute;
309
+ top: 0;
310
+ left: 0;
311
+ width: 100%;
312
+ height: 100%;
313
+ background-color: #ccc;
314
+ border-radius: 999px;
315
+ transition: all 200ms $transition-expo-out;
316
+ }
317
+
318
+ .cove-input__checkbox {
319
+ display: inline-block;
320
+ width: 1.75rem;
321
+ aspect-ratio: 1/1;
322
+ cursor: pointer;
323
+
324
+ &--small {
325
+ @extend .cove-input__checkbox;
326
+ width: 1.25rem;
327
+ }
328
+
329
+ &--large {
330
+ @extend .cove-input__checkbox;
331
+ width: 2.25rem;
332
+ }
333
+
334
+ &.active {
335
+ .cove-input__checkbox-box {
336
+ background-color: #fff;
337
+
338
+ &.custom-color {
339
+ box-shadow: none;
340
+ }
341
+ }
342
+
343
+ .cove-input__checkbox-check {
344
+ opacity: 1;
345
+ transform: translateY(-1px);
346
+ }
347
+ }
348
+ }
349
+
350
+ .cove-input__checkbox-box {
351
+ position: relative;
352
+ width: 100%;
353
+ height: 100%;
354
+ background-color: #f4f4f4;
355
+ border-radius: 3px;
356
+ box-shadow: inset 0 0 0 1px #c4c4c4;
357
+ transition: all 150ms $transition-expo-out;
358
+ }
359
+
360
+ .cove-input__checkbox-check {
361
+ position: absolute;
362
+ top: 0;
363
+ right: 0;
364
+ bottom: 0;
365
+ left: 0;
366
+ margin: 3px;
367
+ fill: #fff;
368
+ pointer-events: none;
369
+ transform: translateY(-1px);
370
+ transition: all 250ms $transition-expo-out;
371
+ opacity: 0;
372
+ }
@@ -0,0 +1,64 @@
1
+ @import "../utils/variables";
2
+ @import "../themes/index";
3
+
4
+ .cove-modal {
5
+ background-color: #fff;
6
+ border-radius: 5px;
7
+ box-shadow: 3px 3px 10px rgb(0 0 0 / 20%);
8
+ font-family: system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Droid Sans, Helvetica Neue, Fira Sans, sans-serif;
9
+ }
10
+
11
+ .cove-modal__header {
12
+ display: block;
13
+ position: relative;
14
+ min-height: 2.25rem;
15
+ padding: 1rem 2.5rem 1.5rem 1rem;
16
+ font-size: 1.25rem;
17
+ font-weight: 600;
18
+ line-height: 1em;
19
+ border-radius: 5px 5px 0 0;
20
+ box-shadow: inset 0 -1px 0 0 rgb(0 0 0 / 10%);
21
+ }
22
+
23
+ .cove-modal__theme--light {
24
+ .cove-modal__header {
25
+ color: #fff;
26
+ }
27
+ }
28
+
29
+ .cove-modal__content {
30
+ padding: 1rem;
31
+ }
32
+
33
+ .cove-modal__footer {
34
+ padding: 0 1rem 1rem;
35
+ box-shadow: inset 0 1px 0 0 rgb(0 0 0 / 10%);
36
+ }
37
+
38
+ .cove-modal--close {
39
+ display: flex;
40
+ justify-content: center;
41
+ align-items: center;
42
+ position: absolute;
43
+ top: 0;
44
+ right: 0;
45
+ height: 100%;
46
+ min-height: 2.25rem;
47
+ max-height: 3.25rem;
48
+ padding: 10px;
49
+ font-size: 1.25rem;
50
+ background-color: transparent;
51
+ border-radius: 0 5px 0 0;
52
+ border: 0;
53
+ cursor: pointer;
54
+ color: inherit;
55
+
56
+ &:active,
57
+ &:focus {
58
+ box-shadow: inset 0 0 0 2px rgb(204 204 204 / 40%);
59
+ }
60
+
61
+ .cove-icon {
62
+ flex: 0 0 auto;
63
+ }
64
+ }
@@ -0,0 +1,80 @@
1
+ @import "../utils/variables";
2
+ @import "../themes/index";
3
+
4
+ .cove-overlay {
5
+ display: flex;
6
+ justify-content: center;
7
+ align-items: center;
8
+ position: fixed;
9
+ top: 0;
10
+ right: 0;
11
+ bottom: 0;
12
+ left: 0;
13
+ z-index: 20;
14
+
15
+ &.animate-in {
16
+ .cove-overlay__bg {
17
+ animation: fadeIn 400ms $transition-expo-out 0s 1 forwards;
18
+ }
19
+
20
+ .cove-overlay__container {
21
+ animation: fadeInUp 700ms $transition-expo-out 50ms 1 forwards;
22
+ }
23
+ }
24
+
25
+ &.animate-out {
26
+ .cove-overlay__bg {
27
+ animation: fadeOut 400ms $transition-expo-out 0s 1 forwards;
28
+ }
29
+
30
+ .cove-overlay__container {
31
+ animation: fadeOut 400ms $transition-expo-out 0s 1 forwards;
32
+ transform: translateY(0);
33
+ }
34
+ }
35
+
36
+ &.show {
37
+ .cove-overlay__bg {
38
+ opacity: 1
39
+ }
40
+
41
+ .cove-overlay__container {
42
+ opacity: 1;
43
+ transform: translateY(0)
44
+ }
45
+ }
46
+ }
47
+
48
+ .cove-overlay__bg {
49
+ position: absolute;
50
+ width: 100%;
51
+ height: 100%;
52
+ background-color: rgba(0, 0, 0, 0.3);
53
+ cursor: pointer;
54
+ opacity: 0;
55
+ }
56
+
57
+ .cove-overlay__wrapper {
58
+ width: 100%;
59
+ height: 100%;
60
+ display: flex;
61
+ justify-content: center;
62
+ align-items: center;
63
+ margin-left: auto;
64
+ margin-right: auto;
65
+ }
66
+
67
+ .cove-overlay__container {
68
+ display: block;
69
+ width: 100%;
70
+ max-width: 600px;
71
+ transform: translateY(25px);
72
+ opacity: 0;
73
+ z-index: 1;
74
+ }
75
+
76
+ .overlay-error {
77
+ .cove-overlay__container {
78
+ animation: shake-horizontal 400ms 1 ease-in-out;
79
+ }
80
+ }
@@ -0,0 +1,36 @@
1
+ .error-box {
2
+ display: flex;
3
+ padding: .3rem 1rem;
4
+ justify-content: space-between;
5
+ background: #FFC2C2;
6
+ font-size: .9rem;
7
+
8
+ strong {
9
+ font-weight: 600;
10
+ }
11
+
12
+ p {
13
+ margin: 0;
14
+ }
15
+
16
+ .dismiss-error {
17
+ flex-shrink: 0;
18
+ font-size: .8rem;
19
+ cursor: pointer;
20
+ }
21
+ }
22
+
23
+ .warning {
24
+ color: #D8000C;
25
+ background-color: #FFD2D2;
26
+ border: #D8000C 1px solid;
27
+ padding: .75em 1em;
28
+ margin: 1em 0;
29
+ font-size: .8em;
30
+ border-radius: .4em;
31
+
32
+ strong {
33
+ font-weight: 600;
34
+ display: block;
35
+ }
36
+ }
@@ -0,0 +1,31 @@
1
+ .cove-component {
2
+ border-radius: 3px;
3
+ // box-shadow: rgba(0, 0, 0, 0.2) 3px 6px 10px; // no box shadows
4
+ }
5
+
6
+ .cove-component__header {
7
+ width: 100%;
8
+ padding: 0.6rem 0.8rem;
9
+ border-bottom-width: 3px;
10
+ border-bottom-style: solid;
11
+ border-radius: 3px 3px 0 0;
12
+ font-size: 1.1rem;
13
+ transition: background-color 200ms ease, border-color 200ms ease;
14
+ color: #fff;
15
+ }
16
+
17
+ .cove-component__content {
18
+ padding-top: 1rem;
19
+ background: $lightestGray;
20
+ border: solid 1px #ccc;
21
+ border-top: none;
22
+ border-radius: 0 0 3px 3px;
23
+
24
+ &.no-borders {
25
+ border: none;
26
+ }
27
+ }
28
+
29
+ .cove-component__content-wrap {
30
+ padding: 0 1rem 1rem;
31
+ }