@cdc/core 4.22.10 → 4.23.1

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 (75) hide show
  1. package/README.md +1 -1
  2. package/components/AdvancedEditor.js +52 -67
  3. package/components/ErrorBoundary.jsx +10 -11
  4. package/components/GlobalContext.jsx +2 -6
  5. package/components/LegendCircle.jsx +3 -4
  6. package/components/Loading.jsx +14 -12
  7. package/components/Waiting.jsx +14 -5
  8. package/components/elements/Button.jsx +34 -45
  9. package/components/elements/Card.jsx +1 -1
  10. package/components/inputs/InputCheckbox.jsx +32 -35
  11. package/components/inputs/InputGroup.jsx +38 -17
  12. package/components/inputs/InputSelect.jsx +27 -23
  13. package/components/inputs/InputText.jsx +9 -25
  14. package/components/inputs/InputToggle.jsx +29 -33
  15. package/components/managers/DataDesigner.jsx +87 -64
  16. package/components/ui/Accordion.jsx +18 -30
  17. package/components/ui/Icon.jsx +34 -35
  18. package/components/ui/LoadSpin.jsx +6 -11
  19. package/components/ui/Modal.jsx +40 -44
  20. package/components/ui/Overlay.jsx +12 -23
  21. package/components/ui/OverlayFrame.jsx +1 -5
  22. package/components/ui/Tooltip.jsx +8 -28
  23. package/data/colorPalettes.js +29 -266
  24. package/data/dataDesignerTables.js +107 -107
  25. package/data/themes.js +13 -13
  26. package/helpers/CoveMediaControls.js +139 -0
  27. package/helpers/DataTransform.js +92 -92
  28. package/helpers/cacheBustingString.js +3 -3
  29. package/helpers/events.js +5 -6
  30. package/helpers/fetchRemoteData.js +33 -33
  31. package/helpers/getViewport.js +15 -15
  32. package/helpers/numberFromString.js +7 -7
  33. package/helpers/updatePaletteNames.js +15 -17
  34. package/helpers/useDataVizClasses.js +38 -35
  35. package/helpers/validateFipsCodeLength.js +41 -56
  36. package/package.json +4 -2
  37. package/styles/_button-section.scss +35 -0
  38. package/styles/_data-table.scss +39 -27
  39. package/styles/_global.scss +29 -24
  40. package/styles/_mixins.scss +12 -12
  41. package/styles/_reset.scss +85 -16
  42. package/styles/_variables.scss +5 -5
  43. package/styles/base.scss +100 -48
  44. package/styles/heading-colors.scss +6 -2
  45. package/styles/loading.scss +62 -60
  46. package/styles/v2/base/_file-selector.scss +2 -2
  47. package/styles/v2/base/_general.scss +1 -1
  48. package/styles/v2/base/_reset.scss +2 -2
  49. package/styles/v2/base/index.scss +4 -4
  50. package/styles/v2/components/accordion.scss +13 -13
  51. package/styles/v2/components/button.scss +3 -3
  52. package/styles/v2/components/card.scss +1 -1
  53. package/styles/v2/components/data-designer.scss +7 -6
  54. package/styles/v2/components/editor.scss +52 -51
  55. package/styles/v2/components/guidance-block.scss +6 -6
  56. package/styles/v2/components/input/_input-check-radio.scss +7 -7
  57. package/styles/v2/components/input/_input-group.scss +2 -2
  58. package/styles/v2/components/input/_input-slider.scss +2 -3
  59. package/styles/v2/components/input/index.scss +6 -6
  60. package/styles/v2/components/loadspin.scss +1 -1
  61. package/styles/v2/components/modal.scss +2 -2
  62. package/styles/v2/components/overlay.scss +4 -4
  63. package/styles/v2/layout/_alert.scss +8 -8
  64. package/styles/v2/layout/_component.scss +1 -1
  65. package/styles/v2/layout/_data-table.scss +12 -11
  66. package/styles/v2/layout/_progression.scss +8 -6
  67. package/styles/v2/layout/index.scss +5 -5
  68. package/styles/v2/main.scss +7 -7
  69. package/styles/v2/themes/_color-definitions.scss +77 -24
  70. package/styles/v2/themes/index.scss +1 -1
  71. package/styles/v2/utils/_animations.scss +2 -2
  72. package/styles/v2/utils/_breakpoints.scss +53 -12
  73. package/styles/v2/utils/_variables.scss +5 -5
  74. package/styles/v2/utils/index.scss +8 -8
  75. package/styles/waiting.scss +22 -23
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdc/core",
3
- "version": "4.22.10",
3
+ "version": "4.23.1",
4
4
  "description": "Core elements of the CDC Open Visualization project",
5
5
  "author": "Daniel Immke <npm@daniel.do>",
6
6
  "homepage": "https://github.com/CDCgov/cdc-open-viz#readme",
@@ -20,6 +20,8 @@
20
20
  "react-dom": ">=16"
21
21
  },
22
22
  "dependencies": {
23
+ "html2canvas": "^1.4.1",
24
+ "html2pdf.js": "^0.10.1",
23
25
  "papaparse": "^5.3.0",
24
26
  "prop-types": "^15.8.1",
25
27
  "react-accessible-accordion": "^3.3.4",
@@ -30,5 +32,5 @@
30
32
  "resolutions": {
31
33
  "@types/react": "17.x"
32
34
  },
33
- "gitHead": "a7eb551a98c7363d3be58cb81dfc8bbc00522804"
35
+ "gitHead": "58163844cc9ce2c379235413b19f49679eab4bef"
34
36
  }
@@ -0,0 +1,35 @@
1
+ // buttons that appear above data tables
2
+ .download-buttons {
3
+ display: flex;
4
+ justify-content: flex-end;
5
+ margin: 0 1em; // align w/ data table
6
+
7
+ .btn:not(:last-child) {
8
+ margin-right: 10px;
9
+ }
10
+ .btn-download {
11
+ float: unset;
12
+ }
13
+ }
14
+
15
+ // links that appear above data tables
16
+ .download-links {
17
+ padding: 0px 1em;
18
+ display: flex;
19
+ justify-content: flex-end;
20
+
21
+ a:not(:last-child) {
22
+ margin-right: 10px;
23
+ }
24
+ }
25
+
26
+ // odd wrapper thats different on dashboards
27
+ .cdc-dashboard-inner-container {
28
+ .download-links {
29
+ padding: unset;
30
+ margin-bottom: 5px;
31
+ }
32
+ .download-buttons {
33
+ margin: unset;
34
+ }
35
+ }
@@ -1,4 +1,6 @@
1
- .collapsed + .table-container { border-bottom: none; }
1
+ .collapsed + .table-container {
2
+ border-bottom: none;
3
+ }
2
4
  .table-container {
3
5
  overflow-x: auto;
4
6
  border-right: 1px solid $lightGray;
@@ -8,13 +10,13 @@
8
10
 
9
11
  div.data-table-heading {
10
12
  background: rgba(0, 0, 0, 0.05);
11
- padding: .5em .7em;
13
+ padding: 0.5em 0.7em;
12
14
  border: $lightGray 1px solid;
13
15
  border-bottom: 0;
14
16
  cursor: pointer;
15
17
  background-image: url(~@cdc/core/assets/icon-minus.svg);
16
18
  background-size: 15px 15px; // Need to define both for IE11
17
- background-position: right .7em center;
19
+ background-position: right 0.7em center;
18
20
  background-repeat: no-repeat;
19
21
  &:focus {
20
22
  z-index: 2;
@@ -23,7 +25,7 @@ div.data-table-heading {
23
25
  &.collapsed {
24
26
  background-image: url(~@cdc/core/assets/icon-plus.svg);
25
27
  background-size: 15px 15px; // Need to define both for IE11
26
- background-position: right .7em center;
28
+ background-position: right 0.7em center;
27
29
  background-repeat: no-repeat;
28
30
  border-bottom: $lightGray 1px solid;
29
31
  }
@@ -39,7 +41,7 @@ table.data-table {
39
41
  overflow: auto;
40
42
  appearance: none;
41
43
  * {
42
- box-sizing: border-box
44
+ box-sizing: border-box;
43
45
  }
44
46
 
45
47
  thead {
@@ -67,14 +69,14 @@ table.data-table {
67
69
  top: 0;
68
70
  bottom: 0;
69
71
  right: 0;
70
- touch-action:none;
72
+ touch-action: none;
71
73
  }
72
74
  tr {
73
75
  text-align: left;
74
76
  }
75
77
  th,
76
78
  td {
77
- padding: .5em 1.3em .5em .7em;
79
+ padding: 0.5em 1.3em 0.5em 0.7em;
78
80
  line-height: normal;
79
81
  position: relative;
80
82
  text-align: left;
@@ -88,7 +90,7 @@ table.data-table {
88
90
  th.sort {
89
91
  background-color: darken($mediumGray, 10%);
90
92
  background-repeat: no-repeat;
91
- background-position: right .5em center;
93
+ background-position: right 0.5em center;
92
94
  background-size: 10px 5px;
93
95
  }
94
96
 
@@ -104,7 +106,7 @@ table.data-table {
104
106
 
105
107
  th:last-child,
106
108
  td:last-child {
107
- border-right: 0
109
+ border-right: 0;
108
110
  }
109
111
  }
110
112
 
@@ -112,21 +114,21 @@ table.data-table {
112
114
  tr {
113
115
  width: 100%;
114
116
  &:hover {
115
- background: rgba(0, 0, 0, 0.05)
117
+ background: rgba(0, 0, 0, 0.05);
116
118
  }
117
119
  }
118
120
  }
119
121
 
120
122
  tr {
121
- border-bottom: solid 1px #E5E5E5;
123
+ border-bottom: solid 1px #e5e5e5;
122
124
  min-width: 100%; // Needed to fill content up
123
125
  &:last-child {
124
- border-bottom: 0
126
+ border-bottom: 0;
125
127
  }
126
128
  }
127
129
 
128
130
  td {
129
- padding: .3em .7em;
131
+ padding: 0.3em 0.7em;
130
132
  border-right: 1px solid rgba(0, 0, 0, 0.1);
131
133
  }
132
134
 
@@ -138,17 +140,19 @@ table.data-table {
138
140
  &:last-child {
139
141
  border-right: 0 !important;
140
142
  }
141
- &:first-child {
142
- flex-grow: 1;
143
- }
143
+ }
144
+
145
+ th {
146
+ flex-grow: 1;
144
147
  }
145
148
 
146
149
  td {
147
150
  position: relative;
151
+ flex-grow: 1;
148
152
  }
149
153
 
150
154
  td a {
151
- padding: .3em .7em;
155
+ padding: 0.3em 0.7em;
152
156
  position: absolute;
153
157
  top: 0;
154
158
  bottom: 0;
@@ -178,16 +182,17 @@ table.data-table {
178
182
  h3 {
179
183
  font-size: 1.3rem;
180
184
  font-weight: 600;
181
- margin-bottom: .3rem;
185
+ margin-bottom: 0.3rem;
182
186
  }
183
187
  }
184
188
  tr:hover {
185
189
  background: #fff;
186
190
  }
187
- th, td {
191
+ th,
192
+ td {
188
193
  width: 50%;
189
194
  &::before {
190
- content: "\00a0";
195
+ content: '\00a0';
191
196
  }
192
197
  }
193
198
  }
@@ -201,18 +206,18 @@ table.data-table {
201
206
  margin: 0 1rem 0 0;
202
207
  display: flex;
203
208
  li + li {
204
- margin-left: .3rem;
209
+ margin-left: 0.3rem;
205
210
  }
206
211
  button {
207
212
  background: $mediumGray;
208
- padding: .6rem .8rem;
213
+ padding: 0.6rem 0.8rem;
209
214
  &:hover {
210
215
  background: lighten($mediumGray, 5%);
211
216
  }
212
217
  }
213
218
  button.btn-next {
214
219
  &::before {
215
- content: " ";
220
+ content: ' ';
216
221
  background-image: url(~@cdc/core/assets/icon-caret-filled-up.svg);
217
222
  background-size: 10px 5px;
218
223
  width: 10px;
@@ -223,7 +228,7 @@ table.data-table {
223
228
  }
224
229
  button.btn-prev {
225
230
  &::before {
226
- content: " ";
231
+ content: ' ';
227
232
  background-image: url(~@cdc/core/assets/icon-caret-filled-up.svg);
228
233
  background-size: 10px 5px;
229
234
  width: 10px;
@@ -234,7 +239,7 @@ table.data-table {
234
239
  }
235
240
  button[disabled] {
236
241
  background: $mediumGray;
237
- opacity: .3;
242
+ opacity: 0.3;
238
243
  cursor: default;
239
244
  &:hover {
240
245
  background: $mediumGray;
@@ -247,9 +252,16 @@ table.data-table {
247
252
  color: #fff;
248
253
  float: right;
249
254
  text-decoration: none;
250
- transition: .3s all;
255
+ transition: 0.3s all;
251
256
  margin: 1em 0;
252
257
  &:hover {
253
- transition: .3s all;
258
+ transition: 0.3s all;
259
+ }
260
+ }
261
+ .cove,
262
+ .cdc-open-viz-module {
263
+ .download-links a:not(:last-child) {
264
+ margin-right: 10px;
265
+ display: inline-block;
254
266
  }
255
267
  }
@@ -7,11 +7,11 @@ strong {
7
7
  }
8
8
 
9
9
  .error-box {
10
- background: #FFC2C2;
10
+ background: #ffc2c2;
11
11
  display: flex;
12
12
  justify-content: space-between;
13
- padding: .3rem 1rem;
14
- font-size: .9rem;
13
+ padding: 0.3rem 1rem;
14
+ font-size: 0.9rem;
15
15
  strong {
16
16
  font-weight: 600;
17
17
  }
@@ -20,7 +20,7 @@ strong {
20
20
  }
21
21
  .dismiss-error {
22
22
  flex-shrink: 0;
23
- font-size: .8rem;
23
+ font-size: 0.8rem;
24
24
  cursor: pointer;
25
25
  }
26
26
  }
@@ -42,7 +42,7 @@ strong {
42
42
  .inline-icon {
43
43
  width: 1em !important;
44
44
  height: auto !important;
45
- @media all and (-ms-high-contrast:none) {
45
+ @media all and (-ms-high-contrast: none) {
46
46
  height: 30px !important;
47
47
  }
48
48
  font-size: 1rem;
@@ -56,26 +56,26 @@ strong {
56
56
  background: #005eaa;
57
57
  color: #fff;
58
58
  border: 0;
59
- padding: .4em .8em;
59
+ padding: 0.4em 0.8em;
60
60
  font-size: 1em;
61
61
  display: block;
62
- border-radius: .3em;
63
- transition: .1s background-color;
62
+ border-radius: 0.3em;
63
+ transition: 0.1s background-color;
64
64
  cursor: pointer;
65
65
  &.full-width {
66
66
  width: 100%;
67
67
  }
68
68
  &:hover {
69
- transition: .1s background-color;
69
+ transition: 0.1s background-color;
70
70
  }
71
71
  &.secondary {
72
- font-size: .8em;
73
- padding: .3em 1em;
72
+ font-size: 0.8em;
73
+ padding: 0.3em 1em;
74
74
  background: rgba(0, 0, 0, 0.3);
75
75
  display: inline-block;
76
76
  margin-bottom: 1em;
77
77
  &:hover {
78
- background: rgba(0,0,0,.5);
78
+ background: rgba(0, 0, 0, 0.5);
79
79
  }
80
80
  }
81
81
  &.danger {
@@ -87,7 +87,7 @@ strong {
87
87
  }
88
88
 
89
89
  &:hover {
90
- transition: .1s all;
90
+ transition: 0.1s all;
91
91
  background: lighten(#005eaa, 5%);
92
92
  }
93
93
 
@@ -100,14 +100,19 @@ strong {
100
100
  }
101
101
  }
102
102
 
103
- input[type="text"], input[type="date"], input[role="combobox"], input[type="number"], input[type="search"], textarea {
104
- padding: .5em .5em;
103
+ input[type='text'],
104
+ input[type='date'],
105
+ input[role='combobox'],
106
+ input[type='number'],
107
+ input[type='search'],
108
+ textarea {
109
+ padding: 0.5em 0.5em;
105
110
  font-size: 1em;
106
111
  font-weight: normal;
107
112
  font-family: sans-serif;
108
- border: rgba(0,0,0,.3) 1px solid !important;
113
+ border: rgba(0, 0, 0, 0.3) 1px solid !important;
109
114
  &:focus {
110
- border: rgba(0,0,0,.7) 1px solid !important;
115
+ border: rgba(0, 0, 0, 0.7) 1px solid !important;
111
116
  outline: 0;
112
117
  }
113
118
  }
@@ -129,16 +134,16 @@ select {
129
134
 
130
135
  .guidance-link {
131
136
  margin: 2em 0 1em;
132
- padding: .75em 1em;
137
+ padding: 0.75em 1em;
133
138
  display: flex;
134
139
  text-decoration: none;
135
140
  color: #444;
136
141
  border: $lightGray 1px solid;
137
142
  position: relative;
138
- transition: .2s all;
143
+ transition: 0.2s all;
139
144
  font-size: 1em;
140
145
  &:before {
141
- content: " ";
146
+ content: ' ';
142
147
  width: 5px;
143
148
  background: $blue;
144
149
  left: -1px;
@@ -148,11 +153,11 @@ select {
148
153
  }
149
154
  &:hover {
150
155
  background: $lightestGray;
151
- transition: .2s all;
156
+ transition: 0.2s all;
152
157
  color: #444;
153
158
  }
154
159
  > div {
155
- font-size: .9em;
160
+ font-size: 0.9em;
156
161
  }
157
162
  svg {
158
163
  width: 60px;
@@ -173,11 +178,11 @@ section.introText {
173
178
  }
174
179
 
175
180
  section.footnotes {
176
- border-top: 1px solid #DDD;
181
+ border-top: 1px solid #ddd;
177
182
  margin-top: 20px;
178
183
  padding: 15px;
179
184
  }
180
185
 
181
186
  .cdc-chart-inner-container .subtext {
182
187
  padding: 15px;
183
- }
188
+ }
@@ -1,13 +1,13 @@
1
1
  @mixin emptyState {
2
- background: rgba(255, 255, 255, 0.5);
3
- top: 0;
4
- left: 0;
5
- right: 0;
6
- bottom: 0;
7
- position: absolute;
8
- text-align: center;
9
- display: flex;
10
- align-items: center;
11
- justify-content: center;
12
- z-index: 7;
13
- }
2
+ background: rgba(255, 255, 255, 0.5);
3
+ top: 0;
4
+ left: 0;
5
+ right: 0;
6
+ bottom: 0;
7
+ position: absolute;
8
+ text-align: center;
9
+ display: flex;
10
+ align-items: center;
11
+ justify-content: center;
12
+ z-index: 7;
13
+ }
@@ -10,7 +10,7 @@
10
10
  // match cdc site outline
11
11
  :focus,
12
12
  [tabindex]:focus-visible {
13
- outline: 2px solid rgba(255,102,1,.9) !important;
13
+ outline: 2px solid rgba(255, 102, 1, 0.9) !important;
14
14
  }
15
15
 
16
16
  .outline-none {
@@ -18,19 +18,85 @@
18
18
  }
19
19
  }
20
20
  .cdc-open-viz-module {
21
- div, span, applet, object, iframe,
22
- h1, h2, h3, h4, h5, h6, p, blockquote, pre,
23
- a, abbr, acronym, address, big, cite, code,
24
- del, dfn, em, img, ins, kbd, q, s, samp,
25
- small, strike, strong, sub, sup, tt, var,
26
- b, u, i, center,
27
- dl, dt, dd, ol, ul, li,
28
- fieldset, form, label, legend,
29
- table, caption, tbody, tfoot, thead, tr, th, td,
30
- article, aside, canvas, details, embed,
31
- figure, figcaption, footer, header, hgroup,
32
- menu, nav, output, ruby, section, summary,
33
- time, mark, audio, video {
21
+ div,
22
+ span,
23
+ applet,
24
+ object,
25
+ iframe,
26
+ h1,
27
+ h2,
28
+ h3,
29
+ h4,
30
+ h5,
31
+ h6,
32
+ p,
33
+ blockquote,
34
+ pre,
35
+ a,
36
+ abbr,
37
+ acronym,
38
+ address,
39
+ big,
40
+ cite,
41
+ code,
42
+ del,
43
+ dfn,
44
+ em,
45
+ img,
46
+ ins,
47
+ kbd,
48
+ q,
49
+ s,
50
+ samp,
51
+ small,
52
+ strike,
53
+ strong,
54
+ sub,
55
+ sup,
56
+ tt,
57
+ var,
58
+ b,
59
+ u,
60
+ i,
61
+ center,
62
+ dl,
63
+ dt,
64
+ dd,
65
+ ol,
66
+ ul,
67
+ li,
68
+ fieldset,
69
+ form,
70
+ label,
71
+ legend,
72
+ table,
73
+ caption,
74
+ tbody,
75
+ tfoot,
76
+ thead,
77
+ tr,
78
+ th,
79
+ td,
80
+ article,
81
+ aside,
82
+ canvas,
83
+ details,
84
+ embed,
85
+ figure,
86
+ figcaption,
87
+ footer,
88
+ header,
89
+ hgroup,
90
+ menu,
91
+ nav,
92
+ output,
93
+ ruby,
94
+ section,
95
+ summary,
96
+ time,
97
+ mark,
98
+ audio,
99
+ video {
34
100
  margin: 0;
35
101
  padding: 0;
36
102
  border: 0;
@@ -47,9 +113,12 @@
47
113
  }
48
114
  }
49
115
 
50
- * {box-sizing: border-box}
116
+ * {
117
+ box-sizing: border-box;
118
+ }
51
119
 
52
- sub, sup {
120
+ sub,
121
+ sup {
53
122
  /* Specified in % so that the sup/sup is the
54
123
  right size relative to the surrounding text */
55
124
  font-size: 75%;
@@ -1,15 +1,15 @@
1
1
  $baseColor: #333;
2
- $blue: #005EAA;
3
- $lightestGray: #F2F2F2;
4
- $lightGray: #C7C7C7;
2
+ $blue: #005eaa;
3
+ $lightestGray: #f2f2f2;
4
+ $lightGray: #c7c7c7;
5
5
  $mediumGray: #565656;
6
6
  $darkGray: #333;
7
7
  $red: #d8000c;
8
8
  $white: #fff;
9
9
 
10
- $primary: #005eaa !default;
10
+ $primary: #005eaa !default;
11
11
  $secondary: #88c3ea !default;
12
- $tertiary: #c0e9ff !default;
12
+ $tertiary: #c0e9ff !default;
13
13
  $quaternary: #edf9ff !default;
14
14
 
15
15
  $purple-primary: #712177 !default;