@cdc/data-bite 1.1.3 → 9.22.9

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/src/index.html CHANGED
@@ -13,7 +13,16 @@
13
13
  </style>
14
14
  </head>
15
15
  <body>
16
- <div class="react-container" data-config="/examples/example-config.json"></div>
16
+ <!-- Original -->
17
+ <div class="react-container" data-config="/examples/example-config.json"></div>
18
+
19
+ <!-- DATA PRESENTATION GALLERY: https://www.cdc.gov/wcms/4.0/cdc-wp/data-presentation/data_bites.html#examples -->
20
+ <!-- <div class="react-container" data-config="/examples/gallery/calculated-average.json"></div> -->
21
+ <!-- <div class="react-container" data-config="/examples/gallery/calculated-with-pic.json"></div> -->
22
+ <!-- <div class="react-container" data-config="/examples/gallery/max-value.json"></div> -->
23
+ <!-- <div class="react-container" data-config="/examples/gallery/sum-of-data.json"></div> -->
24
+
25
+
17
26
  <noscript>You need to enable JavaScript to run this app.</noscript>
18
27
  </body>
19
- </html>
28
+ </html>
@@ -2,7 +2,7 @@
2
2
 
3
3
  &.is-editor {
4
4
  position: relative;
5
- .cdc-data-bite-inner-container {
5
+ .cove-component__inner {
6
6
  margin: 3em auto 0;
7
7
  max-width: 35em;
8
8
  }
@@ -12,7 +12,7 @@
12
12
  color: $primary;
13
13
  }
14
14
 
15
- .bite-header {
15
+ .cove-component__header {
16
16
  background-color: $primary;
17
17
  }
18
18
  }
@@ -21,7 +21,7 @@
21
21
  .bite-value {
22
22
  color: $purple-primary;
23
23
  }
24
- .bite-header {
24
+ .cove-component__header {
25
25
  background-color: $purple-primary;
26
26
  }
27
27
  }
@@ -30,7 +30,7 @@
30
30
  .bite-value {
31
31
  color: $amber-primary;
32
32
  }
33
- .bite-header {
33
+ .cove-component__header {
34
34
  background-color: $amber-primary;
35
35
  }
36
36
  }
@@ -39,7 +39,7 @@
39
39
  .bite-value {
40
40
  color: $orange-primary;
41
41
  }
42
- .bite-header {
42
+ .cove-component__header {
43
43
  background-color: $orange-primary;
44
44
  }
45
45
  }
@@ -48,7 +48,7 @@
48
48
  .bite-value {
49
49
  color: $brown-primary;
50
50
  }
51
- .bite-header {
51
+ .cove-component__header {
52
52
  background-color: $brown-primary;
53
53
  }
54
54
  }
@@ -57,7 +57,7 @@
57
57
  .bite-value {
58
58
  color: $teal-primary;
59
59
  }
60
- .bite-header {
60
+ .cove-component__header {
61
61
  background-color: $teal-primary;
62
62
  }
63
63
  }
@@ -66,7 +66,7 @@
66
66
  .bite-value {
67
67
  color: $pink-primary;
68
68
  }
69
- .bite-header {
69
+ .cove-component__header {
70
70
  background-color: $pink-primary;
71
71
  }
72
72
  }
@@ -75,7 +75,7 @@
75
75
  .bite-value {
76
76
  color: $slate-primary;
77
77
  }
78
- .bite-header {
78
+ .cove-component__header {
79
79
  background-color: $slate-primary;
80
80
  }
81
81
  }
@@ -84,7 +84,7 @@
84
84
  .bite-value {
85
85
  color: $indigo-primary;
86
86
  }
87
- .bite-header {
87
+ .cove-component__header {
88
88
  background-color: $indigo-primary;
89
89
  }
90
90
  }
@@ -93,7 +93,7 @@
93
93
  .bite-value {
94
94
  color: $cyan-primary;
95
95
  }
96
- .bite-header {
96
+ .cove-component__header {
97
97
  background-color: $cyan-primary;
98
98
  }
99
99
  }
@@ -102,11 +102,11 @@
102
102
  .bite-value {
103
103
  color: $green-primary;
104
104
  }
105
- .bite-header {
105
+ .cove-component__header {
106
106
  background-color: $green-primary;
107
107
  }
108
108
  }
109
- .bite-header {
109
+ .cove-component__header {
110
110
  padding: 0 1em;
111
111
  left: 0;
112
112
  top: 0;
@@ -118,16 +118,56 @@
118
118
  }
119
119
  }
120
120
 
121
+ // TODO after v2 refactor remove header reference colors
122
+ // Use .font-color/.bg-color, etc. in color definitions or something similar
123
+ // Remove box shadows if we're no longer using them
124
+ .cove-component__inner {
121
125
 
126
+ // Visual: Shadow
127
+ &.shadow {
128
+ box-shadow: rgba(0, 0, 0, 0.2) 0 3px 10px;
129
+ }
130
+
131
+ // General: Bite Style > Graphic
132
+ .bite__style--graphic {
133
+ .bite-content { flex: 1; }
134
+ }
135
+
136
+ // General: Bite Style > End
137
+ &.bite__style--end .bite-text { margin-bottom: 0 !important; }
138
+
139
+ // General: Bite Style > Split
140
+ &.bite__style--split {
141
+ .bite-content {
142
+ flex-direction: row !important;
143
+ }
144
+ .bite-value {
145
+ flex-basis: 25%;
146
+ align-self: center;
147
+ text-align: center;
148
+ }
149
+ .bite-content__text-wrap {
150
+ flex: 75% !important;
151
+ }
152
+ }
153
+
154
+ // General: Compact View
155
+ &.bite--isCompactStyle .bite .cove-component__content .bite-content {
156
+ align-items: center;
157
+ p.bite-text {
158
+ margin-bottom: 0;
159
+ }
160
+ }
161
+
162
+ &.bite--isCompactStyle .bite .cove-component__content {
163
+ align-items: center;
164
+ }
122
165
 
123
- .cdc-data-bite-inner-container {
124
- .bite-header + .bite { border-top: 0; }
166
+ .cove-component__header + .bite { border-top: 0; }
125
167
  .bite {
126
168
  position: relative;
127
169
  overflow: hidden;
128
170
  border-top: none;
129
- background: $lightestGray;
130
- border: solid 1px $lightGray;
131
171
  border-bottom-left-radius: 3px;
132
172
  border-bottom-right-radius: 3px;
133
173
 
@@ -136,19 +176,28 @@
136
176
  border-top-right-radius: 3px;
137
177
  }
138
178
 
179
+ .bite-content-container.component--hideBackgroundColor {
180
+ background: transparent;
181
+ }
182
+
139
183
  &.no-borders {
140
184
  border: none;
141
185
  }
142
186
 
143
- &.shadow {
144
- box-shadow: rgba(0, 0, 0, 0.2) 0 3px 10px;
187
+
188
+ &-content__text-wrap {
189
+ height: 100%;
190
+ display: flex;
191
+ flex-wrap: wrap;
192
+ width: 100%;
145
193
  }
194
+
146
195
  &.theme-blue {
147
196
  .bite-value {
148
197
  color: $primary;
149
198
  }
150
199
 
151
- .bite-header {
200
+ .cove-component__header {
152
201
  background-color: $primary;
153
202
  }
154
203
  }
@@ -157,7 +206,7 @@
157
206
  .bite-value {
158
207
  color: $purple-primary;
159
208
  }
160
- .bite-header {
209
+ .cove-component__header {
161
210
  background-color: $purple-primary;
162
211
  }
163
212
  }
@@ -166,7 +215,7 @@
166
215
  .bite-value {
167
216
  color: $amber-primary;
168
217
  }
169
- .bite-header {
218
+ .cove-component__header {
170
219
  background-color: $amber-primary;
171
220
  }
172
221
  }
@@ -175,7 +224,7 @@
175
224
  .bite-value {
176
225
  color: $orange-primary;
177
226
  }
178
- .bite-header {
227
+ .cove-component__header {
179
228
  background-color: $orange-primary;
180
229
  }
181
230
  }
@@ -184,7 +233,7 @@
184
233
  .bite-value {
185
234
  color: $brown-primary;
186
235
  }
187
- .bite-header {
236
+ .cove-component__header {
188
237
  background-color: $brown-primary;
189
238
  }
190
239
  }
@@ -193,7 +242,7 @@
193
242
  .bite-value {
194
243
  color: $teal-primary;
195
244
  }
196
- .bite-header {
245
+ .cove-component__header {
197
246
  background-color: $teal-primary;
198
247
  }
199
248
  }
@@ -202,7 +251,7 @@
202
251
  .bite-value {
203
252
  color: $pink-primary;
204
253
  }
205
- .bite-header {
254
+ .cove-component__header {
206
255
  background-color: $pink-primary;
207
256
  }
208
257
  }
@@ -211,7 +260,7 @@
211
260
  .bite-value {
212
261
  color: $slate-primary;
213
262
  }
214
- .bite-header {
263
+ .cove-component__header {
215
264
  background-color: $slate-primary;
216
265
  }
217
266
  }
@@ -220,7 +269,7 @@
220
269
  .bite-value {
221
270
  color: $indigo-primary;
222
271
  }
223
- .bite-header {
272
+ .cove-component__header {
224
273
  background-color: $indigo-primary;
225
274
  }
226
275
  }
@@ -229,7 +278,7 @@
229
278
  .bite-value {
230
279
  color: $cyan-primary;
231
280
  }
232
- .bite-header {
281
+ .cove-component__header {
233
282
  background-color: $cyan-primary;
234
283
  }
235
284
  }
@@ -238,7 +287,7 @@
238
287
  .bite-value {
239
288
  color: $green-primary;
240
289
  }
241
- .bite-header {
290
+ .cove-component__header {
242
291
  background-color: $green-primary;
243
292
  }
244
293
  }
@@ -255,9 +304,9 @@
255
304
  border-radius: .3em;
256
305
  }
257
306
 
258
- .bite-content-container {
307
+ .cove-component__content {
259
308
  display: flex;
260
- padding: 1em 1em;
309
+ padding: 1em;
261
310
  justify-content: space-between;
262
311
 
263
312
  .bite-content {
@@ -278,12 +327,14 @@
278
327
  .bite-text {
279
328
  margin-bottom: 15px;
280
329
  color: #222;
281
- flex: 1 0 auto;
282
330
  }
283
331
 
284
332
  .bite-subtext {
285
333
  font-size: .9em;
286
334
  font-style: italic;
335
+ flex-basis: 100%;
336
+ width: 100%;
337
+ align-self: flex-end;
287
338
  }
288
339
  }
289
340
  }
@@ -302,13 +353,13 @@
302
353
  width: 33%;
303
354
  margin-left: 1.5em;
304
355
  }
305
- .bite-content-container {
356
+ .cove-component__content {
306
357
  flex-direction: row-reverse;
307
358
  }
308
359
  }
309
360
 
310
361
  &.bite-top {
311
- .bite-content-container {
362
+ .cove-component__content {
312
363
  flex-direction: column;
313
364
 
314
365
  .bite-image {
@@ -327,7 +378,7 @@
327
378
  }
328
379
 
329
380
  &.bite-bottom {
330
- .bite-content-container {
381
+ .cove-component__content {
331
382
  flex-direction: column;
332
383
 
333
384
  .bite-image {
@@ -346,7 +397,7 @@
346
397
  }
347
398
 
348
399
  &.bite-back {
349
- .bite-content-container {
400
+ .cove-component__content {
350
401
  .bite-image {
351
402
  border-radius: 0 0 0.3em 0.3em;
352
403
  position: absolute;
@@ -372,3 +423,14 @@
372
423
  .cove-component__header + .bite { border-top: 0; }
373
424
  }
374
425
  }
426
+
427
+
428
+ .cove-component__content {
429
+ background: $lightestGray;
430
+
431
+ &:not(.no-borders) {
432
+ border-color: $lightGray;
433
+ border-width: 1px;
434
+ border-style: solid;
435
+ }
436
+ }
@@ -207,7 +207,6 @@
207
207
  display: block;
208
208
  text-align: left;
209
209
  cursor: pointer;
210
- color: rgba(0,0,0,.5);
211
210
  text-decoration: underline;
212
211
  span {
213
212
  text-decoration: none;
@@ -62,10 +62,10 @@
62
62
  opacity: 1;
63
63
  }
64
64
 
65
- &.font-small .cdc-data-bite-inner-container .bite-content-container {
65
+ &.font-small .bite-content-container {
66
66
  font-size: .9em !important;
67
67
  }
68
- &.font-large .cdc-data-bite-inner-container .bite-content-container {
68
+ &.font-large .bite-content-container {
69
69
  font-size: 1.1em !important;
70
70
  }
71
71
  // Medium is just the default
package/LICENSE DELETED
@@ -1,201 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright [yyyy] [name of copyright owner]
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.