@cdc/chart 1.3.4 → 4.22.11

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/LICENSE +201 -0
  2. package/README.md +5 -5
  3. package/dist/cdcchart.js +6 -6
  4. package/examples/age-adjusted-rates.json +1486 -1218
  5. package/examples/case-rate-example-config.json +1 -1
  6. package/examples/covid-confidence-example-config.json +33 -33
  7. package/examples/covid-example-config.json +34 -34
  8. package/examples/covid-example-data-confidence.json +30 -30
  9. package/examples/covid-example-data.json +20 -20
  10. package/examples/cutoff-example-config.json +36 -34
  11. package/examples/cutoff-example-data.json +36 -36
  12. package/examples/date-exclusions-config.json +1 -1
  13. package/examples/dynamic-legends.json +125 -0
  14. package/examples/gallery/bar-chart-horizontal/horizontal-bar-chart-with-numbers-on-bar.json +192 -0
  15. package/examples/gallery/bar-chart-horizontal/horizontal-bar-chart.json +231 -0
  16. package/examples/gallery/bar-chart-horizontal/horizontal-stacked.json +240 -0
  17. package/examples/gallery/bar-chart-vertical/combo-line-chart.json +137 -0
  18. package/examples/gallery/bar-chart-vertical/vertical-bar-chart-categorical.json +80 -0
  19. package/examples/gallery/bar-chart-vertical/vertical-bar-chart-stacked.json +81 -0
  20. package/examples/gallery/bar-chart-vertical/vertical-bar-chart-with-confidence.json +68 -0
  21. package/examples/gallery/bar-chart-vertical/vertical-bar-chart.json +111 -0
  22. package/examples/gallery/lollipop/lollipop-style-horizontal.json +216 -0
  23. package/examples/gallery/paired-bar/paired-bar-chart.json +196 -0
  24. package/examples/horizontal-chart.json +36 -33
  25. package/examples/horizontal-stacked-bar-chart.json +34 -34
  26. package/examples/line-chart.json +75 -75
  27. package/examples/paired-bar-data.json +16 -14
  28. package/examples/paired-bar-example.json +48 -46
  29. package/examples/paired-bar-formatted.json +36 -36
  30. package/examples/planet-chart-horizontal-example-config.json +33 -33
  31. package/examples/planet-combo-example-config.json +34 -29
  32. package/examples/planet-example-config.json +35 -33
  33. package/examples/planet-example-data.json +56 -56
  34. package/examples/planet-pie-example-config.json +28 -26
  35. package/examples/private/filters.json +170 -0
  36. package/examples/private/line-test-data.json +22 -0
  37. package/examples/private/line-test-two.json +210 -0
  38. package/examples/private/line-test.json +102 -0
  39. package/examples/private/new.json +48800 -0
  40. package/examples/private/shawn.json +1106 -0
  41. package/examples/private/test.json +10123 -10123
  42. package/examples/private/yaxis-test.json +133 -0
  43. package/examples/private/yaxis-testing.csv +27 -0
  44. package/examples/private/yaxis.json +28 -0
  45. package/examples/stacked-vertical-bar-example.json +228 -0
  46. package/examples/temp-example-config.json +61 -54
  47. package/examples/temp-example-data.json +1 -1
  48. package/package.json +2 -2
  49. package/src/CdcChart.tsx +370 -458
  50. package/src/components/BarChart.tsx +449 -441
  51. package/src/components/DataTable.tsx +164 -180
  52. package/src/components/EditorPanel.js +1066 -663
  53. package/src/components/Legend.js +284 -0
  54. package/src/components/LineChart.tsx +114 -63
  55. package/src/components/LinearChart.tsx +394 -358
  56. package/src/components/PairedBarChart.tsx +216 -135
  57. package/src/components/PieChart.tsx +106 -135
  58. package/src/components/SparkLine.js +184 -205
  59. package/src/components/useIntersectionObserver.tsx +27 -0
  60. package/src/context.tsx +3 -3
  61. package/src/data/initial-state.js +44 -7
  62. package/src/hooks/useActiveElement.js +13 -13
  63. package/src/hooks/useChartClasses.js +41 -0
  64. package/src/hooks/useColorPalette.ts +56 -63
  65. package/src/hooks/useLegendClasses.js +28 -0
  66. package/src/hooks/useReduceData.ts +69 -37
  67. package/src/hooks/useRightAxis.js +25 -0
  68. package/src/hooks/useTopAxis.js +6 -0
  69. package/src/index.html +54 -55
  70. package/src/index.tsx +13 -16
  71. package/src/scss/DataTable.scss +5 -4
  72. package/src/scss/editor-panel.scss +103 -71
  73. package/src/scss/main.scss +277 -38
  74. package/src/scss/variables.scss +1 -1
  75. package/src/components/BarStackVertical.js +0 -0
@@ -1,6 +1,6 @@
1
1
  //TODO: Remove after COVE refactor
2
2
  .cove {
3
- @import "@cdc/core/styles/v2/layout/tooltip.scss";
3
+ @import '@cdc/core/styles/v2/layout/tooltip.scss';
4
4
  }
5
5
 
6
6
  .editor-panel {
@@ -25,7 +25,7 @@
25
25
 
26
26
  > label {
27
27
  width: 48%;
28
- margin-top: 0 !important
28
+ margin-top: 0 !important;
29
29
  }
30
30
  }
31
31
 
@@ -36,12 +36,12 @@
36
36
 
37
37
  .helper {
38
38
  position: relative;
39
- opacity: .7;
39
+ opacity: 0.7;
40
40
  cursor: pointer;
41
41
  width: 17px;
42
42
  height: 17px;
43
43
  align-self: center;
44
- margin-left: .3rem;
44
+ margin-left: 0.3rem;
45
45
  margin-top: -0.3rem;
46
46
  border: none !important;
47
47
  box-shadow: none !important;
@@ -66,15 +66,15 @@
66
66
  border: $lightGray 1px solid;
67
67
 
68
68
  &:empty {
69
- border: none !important
69
+ border: none !important;
70
70
  }
71
71
 
72
72
  li {
73
- padding: .3em .5em;
73
+ padding: 0.3em 0.5em;
74
74
  display: flex;
75
75
  align-items: center;
76
76
  justify-content: space-between;
77
- font-size: .9em;
77
+ font-size: 0.9em;
78
78
 
79
79
  &:hover {
80
80
  background-color: $lightestGray;
@@ -132,7 +132,7 @@
132
132
  }
133
133
 
134
134
  .series-list__dropdown {
135
- font-size: .8em;
135
+ font-size: 0.8em;
136
136
  }
137
137
 
138
138
  .series-list__remove {
@@ -167,7 +167,7 @@
167
167
 
168
168
  .number-narrow {
169
169
  min-width: auto;
170
- width: 75px
170
+ width: 75px;
171
171
  }
172
172
  }
173
173
 
@@ -178,7 +178,7 @@
178
178
 
179
179
  .guidance-link {
180
180
  margin: 2em 1em 0;
181
- padding: .75em 1em;
181
+ padding: 0.75em 1em;
182
182
 
183
183
  svg {
184
184
  width: 60px;
@@ -192,13 +192,13 @@
192
192
  }
193
193
 
194
194
  .warning {
195
- color: #D8000C;
196
- background-color: #FFD2D2;
197
- padding: .75em 1em;
195
+ color: #d8000c;
196
+ background-color: #ffd2d2;
197
+ padding: 0.75em 1em;
198
198
  margin: 1em 0;
199
- font-size: .8em;
200
- border: #D8000C 1px solid;
201
- border-radius: .4em;
199
+ font-size: 0.8em;
200
+ border: #d8000c 1px solid;
201
+ border-radius: 0.4em;
202
202
 
203
203
  strong {
204
204
  font-weight: 600;
@@ -209,7 +209,7 @@
209
209
  .accordion__button {
210
210
  cursor: pointer;
211
211
  font-size: 1em;
212
- padding: .3em 1em;
212
+ padding: 0.3em 1em;
213
213
  width: 100%;
214
214
  text-align: left;
215
215
  position: relative;
@@ -227,14 +227,14 @@
227
227
  position: absolute;
228
228
  top: 50%;
229
229
  transform: rotate(-45deg) translateY(-50%);
230
- transition: .1s all;
230
+ transition: 0.1s all;
231
231
  }
232
232
 
233
233
  &[aria-expanded='true']::before {
234
234
  transform: rotate(45deg) translateY(-50%);
235
235
  transform-origin: right;
236
236
  margin-right: 1.3em;
237
- transition: .1s all;
237
+ transition: 0.1s all;
238
238
  }
239
239
  }
240
240
 
@@ -248,7 +248,7 @@
248
248
  }
249
249
 
250
250
  h5 {
251
- font-size: .8em;
251
+ font-size: 0.8em;
252
252
  }
253
253
  }
254
254
 
@@ -257,7 +257,7 @@
257
257
  text-align: left;
258
258
 
259
259
  p {
260
- font-size: .8rem;
260
+ font-size: 0.8rem;
261
261
  }
262
262
 
263
263
  .advanced-toggle-link {
@@ -265,7 +265,6 @@
265
265
  display: block;
266
266
  text-align: left;
267
267
  cursor: pointer;
268
- color: rgba(0, 0, 0, .5);
269
268
  text-decoration: underline;
270
269
 
271
270
  span {
@@ -276,17 +275,17 @@
276
275
  }
277
276
 
278
277
  &:hover {
279
- color: rgba(0, 0, 0, .7);
278
+ color: rgba(0, 0, 0, 0.7);
280
279
  }
281
280
  }
282
281
 
283
282
  textarea {
284
283
  height: 400px;
285
284
  width: 100%;
286
- font-size: .9em;
287
- padding: .5em;
285
+ font-size: 0.9em;
286
+ padding: 0.5em;
288
287
  font-family: monospace;
289
- box-sizing: border-box
288
+ box-sizing: border-box;
290
289
  }
291
290
  }
292
291
 
@@ -304,16 +303,17 @@
304
303
  background: #565656;
305
304
  color: #fff;
306
305
  font-size: 1.1em;
307
- padding: .6em 1em;
306
+ padding: 0.6em 1em;
308
307
  position: relative;
309
308
  border-bottom: #565656 3px solid;
310
309
  z-index: 3;
311
310
  }
312
311
 
312
+ legend,
313
313
  label {
314
314
  text-transform: uppercase;
315
315
  display: block;
316
- font-size: .8em;
316
+ font-size: 0.8em;
317
317
  font-weight: 600;
318
318
  user-select: none;
319
319
 
@@ -322,7 +322,7 @@
322
322
  }
323
323
 
324
324
  span.edit-label {
325
- margin-bottom: .3em;
325
+ margin-bottom: 0.3em;
326
326
  display: block;
327
327
  }
328
328
 
@@ -341,7 +341,33 @@
341
341
  }
342
342
  }
343
343
 
344
- input[type="text"], input[role="combobox"], input[type="number"], textarea {
344
+ legend {
345
+ font-weight: normal;
346
+ margin-bottom: 0.3em;
347
+ }
348
+
349
+ legend + span {
350
+ float: left;
351
+ }
352
+
353
+ .radio-label {
354
+ font-weight: normal;
355
+ }
356
+
357
+ .accordion__panel fieldset:not(:first-child) {
358
+ margin-top: 1em;
359
+ }
360
+
361
+ .accordion__panel fieldset {
362
+ label:not(:first-child) {
363
+ margin-top: 0rem;
364
+ }
365
+ }
366
+
367
+ input[type='text'],
368
+ input[role='combobox'],
369
+ input[type='number'],
370
+ textarea {
345
371
  min-width: 100%;
346
372
  max-width: 100%; // Doing this prevents width of textarea from being changed
347
373
  }
@@ -350,7 +376,7 @@
350
376
  min-height: 140px;
351
377
  }
352
378
 
353
- .header .color-palette li {
379
+ .header .color-palette button {
354
380
  width: 21px;
355
381
  height: 21px;
356
382
  border-radius: 40px;
@@ -361,11 +387,11 @@
361
387
  display: flex;
362
388
  max-width: 100%;
363
389
  padding: 0;
364
- margin: .5em 0 0 0;
390
+ margin: 0.5em 0 0 0;
365
391
  list-style: none;
366
392
  flex-wrap: wrap;
367
393
 
368
- li {
394
+ button {
369
395
  width: 45px;
370
396
  height: 23px;
371
397
  margin-right: 4px;
@@ -375,6 +401,7 @@
375
401
  overflow: hidden;
376
402
  cursor: pointer;
377
403
  position: relative;
404
+ padding: 0;
378
405
 
379
406
  .click-target {
380
407
  position: absolute;
@@ -385,17 +412,22 @@
385
412
  }
386
413
 
387
414
  &.selected {
388
- border: rgba(0, 0, 0, .8) 2px solid;
415
+ border: rgba(0, 0, 0, 0.8) 2px solid;
389
416
  }
390
417
 
391
418
  span {
392
419
  width: 33.3%;
420
+ height: 100%;
393
421
  }
394
422
  }
395
423
  }
396
424
 
397
425
  fieldset {
398
426
  display: block;
427
+
428
+ .float-left {
429
+ float: left;
430
+ }
399
431
  }
400
432
 
401
433
  .primary-fieldset {
@@ -420,7 +452,8 @@
420
452
  width: 30%;
421
453
  display: inline-block;
422
454
 
423
- input[type="text"], input[type="number"] {
455
+ input[type='text'],
456
+ input[type='number'] {
424
457
  width: 50px;
425
458
  }
426
459
  }
@@ -430,12 +463,12 @@
430
463
  .emove-column {
431
464
  float: right;
432
465
  text-transform: uppercase;
433
- color: #C32B2B;
434
- font-size: .7em;
466
+ color: #c32b2b;
467
+ font-size: 0.7em;
435
468
  line-height: 1.6em;
436
469
  border-radius: 5px;
437
470
  margin: 0 auto;
438
- transition: .1s all;
471
+ transition: 0.1s all;
439
472
  border: 0;
440
473
  text-decoration: underline;
441
474
  outline: 0;
@@ -446,13 +479,14 @@
446
479
  .edit-block {
447
480
  padding-left: 1em;
448
481
  border-left: rgba(0, 0, 0, 0.2) 4px solid;
449
- transition: .2s all;
482
+ transition: 0.2s all;
450
483
 
451
484
  &:not(:first-child) {
452
485
  margin-top: 2em;
453
486
  }
454
487
 
455
- input[type="text"], input[type="number"] {
488
+ input[type='text'],
489
+ input[type='number'] {
456
490
  font-size: 1em;
457
491
  }
458
492
 
@@ -466,13 +500,13 @@
466
500
 
467
501
  &:hover {
468
502
  border-left: rgba(0, 0, 0, 0.7) 4px solid;
469
- transition: .2s all;
503
+ transition: 0.2s all;
470
504
  }
471
505
  }
472
506
 
473
507
  span.subtext {
474
508
  display: block;
475
- color: rgba(0, 0, 0, .5);
509
+ color: rgba(0, 0, 0, 0.5);
476
510
  text-transform: none;
477
511
  font-weight: normal;
478
512
  }
@@ -485,25 +519,25 @@
485
519
  list-style: none;
486
520
 
487
521
  > li {
488
- margin-right: .3em;
489
- margin-bottom: .3em;
522
+ margin-right: 0.3em;
523
+ margin-bottom: 0.3em;
490
524
  }
491
525
  }
492
526
 
493
527
  .sort-list li > div {
494
528
  display: block;
495
529
  box-sizing: border-box;
496
- border: 1px solid #D1D1D1;
530
+ border: 1px solid #d1d1d1;
497
531
  border-radius: 2px;
498
- background: #F1F1F1;
499
- padding: .4em .6em;
500
- font-size: .8em;
501
- margin-bottom: .3em;
532
+ background: #f1f1f1;
533
+ padding: 0.4em 0.6em;
534
+ font-size: 0.8em;
535
+ margin-bottom: 0.3em;
502
536
  cursor: move;
503
537
  }
504
538
 
505
539
  .info {
506
- font-size: .8em;
540
+ font-size: 0.8em;
507
541
  line-height: 1.4em;
508
542
  font-style: italic;
509
543
  padding-top: 10px;
@@ -517,14 +551,14 @@
517
551
  position: relative;
518
552
 
519
553
  input.react-tags__search-input {
520
- font-size: .8rem;
554
+ font-size: 0.8rem;
521
555
  }
522
556
 
523
557
  /* clicking anywhere will focus the input */
524
558
  cursor: text;
525
559
 
526
560
  span {
527
- display: inline
561
+ display: inline;
528
562
  }
529
563
  }
530
564
 
@@ -539,24 +573,24 @@
539
573
  .react-tags__selected-tag {
540
574
  display: inline-block;
541
575
  box-sizing: border-box;
542
- border: 1px solid #D1D1D1;
576
+ border: 1px solid #d1d1d1;
543
577
  border-radius: 2px;
544
- background: #F1F1F1;
545
- padding: .4em .6em;
546
- font-size: .8em;
547
- margin-right: .3em;
548
- margin-bottom: .3em;
578
+ background: #f1f1f1;
579
+ padding: 0.4em 0.6em;
580
+ font-size: 0.8em;
581
+ margin-right: 0.3em;
582
+ margin-bottom: 0.3em;
549
583
  }
550
584
 
551
585
  .react-tags__selected-tag:after {
552
586
  content: '\2715';
553
- color: #AAA;
587
+ color: #aaa;
554
588
  margin-left: 8px;
555
589
  }
556
590
 
557
591
  .react-tags__selected-tag:hover,
558
592
  .react-tags__selected-tag:focus {
559
- border-color: #B1B1B1;
593
+ border-color: #b1b1b1;
560
594
  }
561
595
 
562
596
  .react-tags__search {
@@ -567,12 +601,10 @@
567
601
  }
568
602
 
569
603
  @media screen and (min-width: 30em) {
570
-
571
604
  .react-tags__search {
572
605
  /* this will become the offsetParent for suggestions */
573
606
  position: relative;
574
607
  }
575
-
576
608
  }
577
609
 
578
610
  .react-tags__search input {
@@ -582,7 +614,7 @@
582
614
  /* emove styles and layout from this element */
583
615
  margin: 0;
584
616
  outline: none;
585
- padding: .5em .3em;
617
+ padding: 0.5em 0.3em;
586
618
 
587
619
  /* match the font styles */
588
620
  font-size: inherit;
@@ -611,7 +643,7 @@
611
643
  padding: 0;
612
644
  list-style: none;
613
645
  background: white;
614
- border: 1px solid #D1D1D1;
646
+ border: 1px solid #d1d1d1;
615
647
  border-radius: 2px;
616
648
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
617
649
  }
@@ -641,7 +673,7 @@
641
673
  cursor: auto;
642
674
  }
643
675
 
644
- [type="radio"] {
676
+ input[type='radio'] {
645
677
  border: 1px solid #8c8f94;
646
678
  border-radius: 50%;
647
679
  margin-right: 5px;
@@ -649,27 +681,27 @@
649
681
  }
650
682
 
651
683
  .editor-toggle {
652
- background: #F2F2F2;
684
+ background: #f2f2f2;
653
685
  border-radius: 60px;
654
686
  color: #000;
655
687
  font-size: 1em;
656
688
  border: 0;
657
689
  position: fixed;
658
690
  z-index: 100;
659
- transition: .1s background;
691
+ transition: 0.1s background;
660
692
  cursor: pointer;
661
693
  width: 25px;
662
694
  height: 25px;
663
695
  left: 307px;
664
696
  top: 10px;
665
- box-shadow: rgba(0, 0, 0, .5) 0 1px 2px;
697
+ box-shadow: rgba(0, 0, 0, 0.5) 0 1px 2px;
666
698
 
667
699
  &:before {
668
700
  top: 43%;
669
701
  left: 50%;
670
702
  transform: translate(-50%, -50%);
671
703
  position: absolute;
672
- content: "\00ab";
704
+ content: '\00ab';
673
705
  }
674
706
 
675
707
  &.collapsed {
@@ -677,12 +709,12 @@
677
709
  margin-left: 0;
678
710
 
679
711
  &:before {
680
- content: "\00bb";
712
+ content: '\00bb';
681
713
  }
682
714
  }
683
715
 
684
716
  &:hover {
685
- background: rgba(255, 255, 255, 1)
717
+ background: rgba(255, 255, 255, 1);
686
718
  }
687
719
  }
688
720