@cdc/chart 1.3.2 → 1.3.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 (35) hide show
  1. package/dist/cdcchart.js +77 -4
  2. package/examples/age-adjusted-rates.json +1218 -0
  3. package/examples/case-rate-example-config.json +36 -0
  4. package/examples/case-rate-example-data.json +33602 -0
  5. package/examples/date-exclusions-config.json +62 -0
  6. package/examples/date-exclusions-data.json +162 -0
  7. package/examples/horizontal-chart.json +35 -0
  8. package/examples/horizontal-stacked-bar-chart.json +36 -0
  9. package/examples/line-chart.json +76 -0
  10. package/examples/paired-bar-data.json +14 -0
  11. package/examples/paired-bar-example.json +48 -0
  12. package/examples/paired-bar-formatted.json +37 -0
  13. package/examples/planet-chart-horizontal-example-config.json +35 -0
  14. package/examples/planet-example-config.json +1 -0
  15. package/examples/private/newtest.csv +101 -0
  16. package/examples/private/test.json +10124 -0
  17. package/package.json +9 -5
  18. package/src/CdcChart.tsx +417 -149
  19. package/src/components/BarChart.tsx +431 -24
  20. package/src/components/BarStackVertical.js +0 -0
  21. package/src/components/DataTable.tsx +55 -28
  22. package/src/components/EditorPanel.js +914 -260
  23. package/src/components/LineChart.tsx +4 -3
  24. package/src/components/LinearChart.tsx +258 -88
  25. package/src/components/PairedBarChart.tsx +144 -0
  26. package/src/components/PieChart.tsx +30 -16
  27. package/src/components/SparkLine.js +206 -0
  28. package/src/data/initial-state.js +59 -32
  29. package/src/hooks/useActiveElement.js +19 -0
  30. package/src/hooks/useColorPalette.ts +83 -0
  31. package/src/hooks/useReduceData.ts +43 -0
  32. package/src/index.html +49 -13
  33. package/src/index.tsx +6 -2
  34. package/src/scss/editor-panel.scss +12 -4
  35. package/src/scss/main.scss +112 -3
@@ -1,3 +1,8 @@
1
+ //TODO: Remove after COVE refactor
2
+ .cove {
3
+ @import "@cdc/core/styles/v2/layout/tooltip.scss";
4
+ }
5
+
1
6
  .editor-panel {
2
7
  display: flex;
3
8
  flex-direction: column;
@@ -310,6 +315,7 @@
310
315
  display: block;
311
316
  font-size: .8em;
312
317
  font-weight: 600;
318
+ user-select: none;
313
319
 
314
320
  &:not(:first-child) {
315
321
  margin-top: 1em;
@@ -327,10 +333,6 @@
327
333
  &.checkbox {
328
334
  display: flex;
329
335
 
330
- span {
331
- display: inline;
332
- }
333
-
334
336
  input {
335
337
  margin-left: 0;
336
338
  width: inherit;
@@ -638,6 +640,12 @@
638
640
  opacity: 0.5;
639
641
  cursor: auto;
640
642
  }
643
+
644
+ [type="radio"] {
645
+ border: 1px solid #8c8f94;
646
+ border-radius: 50%;
647
+ margin-right: 5px;
648
+ }
641
649
  }
642
650
 
643
651
  .editor-toggle {
@@ -2,11 +2,23 @@
2
2
  @import "~@cdc/core/styles/heading-colors";
3
3
  @import 'mixins';
4
4
  @import 'variables';
5
+ @import '~@cdc/core/styles/v2/themes/color-definitions';
6
+
7
+ .form-container {
8
+ overflow: scroll;
9
+ }
10
+
11
+ .d-flex { display: flex; }
12
+ .flex-column-reverse {
13
+ flex-direction: column-reverse;
14
+ }
5
15
 
6
16
  .cdc-open-viz-module.type-chart {
7
- @import 'datatable';
17
+ @import 'DataTable';
8
18
  @import 'editor-panel';
9
19
 
20
+ border-radius: 3px;
21
+
10
22
  .visually-hidden {
11
23
  position: fixed;
12
24
  left: -10000px;
@@ -41,9 +53,11 @@
41
53
  }
42
54
 
43
55
  .warning-icon {
56
+ position: relative;
57
+ top: 2px;
44
58
  width: 15px;
45
59
  height: 15px;
46
- margin-top: 7px;
60
+ margin-left: 5px;
47
61
 
48
62
  path {
49
63
  fill: #d8000c;
@@ -59,6 +73,9 @@
59
73
  border-bottom-width: 3px;
60
74
  border-bottom-style: solid;
61
75
 
76
+ border-top-left-radius: 3px;
77
+ border-top-right-radius: 3px;
78
+
62
79
  em {
63
80
  font-style: italic;
64
81
  }
@@ -240,7 +257,7 @@
240
257
  }
241
258
 
242
259
  @include breakpointClass(md) {
243
- .filters-section, .chart-container {
260
+ .filters-section, .chart-container:not(.sparkline) {
244
261
  margin-left: 1em;
245
262
  margin-right: 1em;
246
263
  }
@@ -314,4 +331,96 @@
314
331
  }
315
332
  }
316
333
  }
334
+ [tabindex]:focus-visible {
335
+ outline: 2px solid rgb(0, 95, 204) !important;
336
+ }
337
+ }
338
+
339
+ #paired-bar-legend {
340
+
341
+ text-align: center;
342
+
343
+ div {
344
+ margin: 0 0.5em;
345
+ display: flex;
346
+ }
347
+
348
+ .indicator {
349
+ width: 1em;
350
+ height: 1em;
351
+ vertical-align: middle;
352
+ margin: 0.25em;
353
+ }
354
+ }
355
+
356
+
357
+ .isEditor.type-sparkline .cdc-chart-inner-container {
358
+ margin: 3em auto 0;
359
+ max-width: 60%;
360
+ }
361
+
362
+ .cdc-open-viz-module.type-chart.lg.type-sparkline .chart-container > svg {
363
+ width: 100%;
364
+ }
365
+
366
+ .chart-container.sparkline {
367
+ display: flex !important;
368
+ flex-wrap: wrap !important;
369
+ }
370
+
371
+ .cdc-open-viz-module.type-chart.type-sparkline {
372
+
373
+ .cove-component__content {
374
+ background: #F2F2F2;
375
+ }
376
+
377
+ .cove-component__content.component--hideBackgroundColor {
378
+ background: transparent;
379
+ }
380
+
381
+ .chart-title:not(:empty) {
382
+ margin-bottom: 0 !important;
383
+ }
384
+
385
+ .cove-component__content .chart-container {
386
+ padding: 1em;
387
+ }
388
+
389
+ .cove-component__content:not(.no-borders) {
390
+ border: 1px solid $lightGray
391
+ }
392
+
393
+ .cove-component__header ~ .cove-component__content:not(.no-borders) {
394
+ border-top: none !important;
395
+ }
396
+
397
+ .subtext {
398
+ margin-top: 0px;
399
+ }
400
+
401
+ .isEditor {
402
+ position: relative;
403
+ }
404
+
405
+ .subtext {
406
+ margin-bottom: 15px;
407
+ }
408
+
409
+ }
410
+
411
+ .cdc-open-viz-module .cove-component__content.sparkline {
412
+ padding: 1em;
413
+ }
414
+
415
+ .cove-component__content.sparkline {
416
+ border-bottom-left-radius: 3px;
417
+ border-bottom-right-radius: 3px;
418
+
419
+ .visx-axis-tick:first-of-type {
420
+ transform: translate(20px, 0)
421
+ }
422
+
423
+ .visx-axis-tick:last-of-type {
424
+ transform: translate(-20px, 0)
425
+ }
317
426
  }