@cdc/map 2.6.0 → 2.6.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 (61) hide show
  1. package/convert-topojson.js +70 -0
  2. package/dist/cdcmap.js +190 -0
  3. package/examples/default-county.json +105 -0
  4. package/examples/default-single-state.json +109 -0
  5. package/examples/default-usa.json +968 -0
  6. package/examples/default-world.json +1495 -0
  7. package/examples/example-city-state.json +474 -0
  8. package/examples/example-world-map.json +1596 -0
  9. package/examples/gender-rate-map.json +1 -0
  10. package/package.json +50 -50
  11. package/src/CdcMap.js +1384 -0
  12. package/src/components/CityList.js +93 -0
  13. package/src/components/CountyMap.js +556 -0
  14. package/src/components/DataTable.js +357 -0
  15. package/src/components/EditorPanel.js +2111 -0
  16. package/src/components/Geo.js +21 -0
  17. package/src/components/Modal.js +31 -0
  18. package/src/components/NavigationMenu.js +66 -0
  19. package/src/components/Sidebar.js +167 -0
  20. package/src/components/SingleStateMap.js +326 -0
  21. package/src/components/UsaMap.js +342 -0
  22. package/src/components/WorldMap.js +175 -0
  23. package/src/components/ZoomableGroup.js +47 -0
  24. package/src/data/abbreviations.js +57 -0
  25. package/src/data/color-palettes.js +200 -0
  26. package/src/data/county-map-halfquality.json +58453 -0
  27. package/src/data/county-map-quarterquality.json +1 -0
  28. package/src/data/county-topo.json +1 -0
  29. package/src/data/dfc-map.json +1 -0
  30. package/src/data/initial-state.js +60 -0
  31. package/src/data/newtest.json +1 -0
  32. package/src/data/state-abbreviations.js +60 -0
  33. package/src/data/supported-geos.js +3775 -0
  34. package/src/data/test.json +1 -0
  35. package/src/data/us-hex-topo.json +1 -0
  36. package/src/data/us-topo.json +1 -0
  37. package/src/data/world-topo.json +1 -0
  38. package/src/hooks/useActiveElement.js +19 -0
  39. package/src/hooks/useZoomPan.js +110 -0
  40. package/src/images/active-checkmark.svg +1 -0
  41. package/src/images/asc.svg +1 -0
  42. package/src/images/close.svg +1 -0
  43. package/src/images/desc.svg +1 -0
  44. package/src/images/external-link.svg +1 -0
  45. package/src/images/icon-download-img.svg +1 -0
  46. package/src/images/icon-download-pdf.svg +1 -0
  47. package/src/images/inactive-checkmark.svg +1 -0
  48. package/src/images/map-folded.svg +1 -0
  49. package/src/index.html +29 -0
  50. package/src/index.js +20 -0
  51. package/src/scss/btn.scss +69 -0
  52. package/src/scss/datatable.scss +7 -0
  53. package/src/scss/editor-panel.scss +654 -0
  54. package/src/scss/main.scss +224 -0
  55. package/src/scss/map.scss +188 -0
  56. package/src/scss/sidebar.scss +146 -0
  57. package/src/scss/tooltips.scss +30 -0
  58. package/src/scss/variables.scss +1 -0
  59. package/uploads/upload-example-city-state.json +392 -0
  60. package/uploads/upload-example-world-data.json +1490 -0
  61. package/LICENSE +0 -201
@@ -0,0 +1,654 @@
1
+ .cdc-open-viz-module {
2
+ .geo-buttons {
3
+ list-style: none;
4
+ display: flex;
5
+ color: $mediumGray;
6
+ svg {
7
+ display: block;
8
+ max-width: 80px;
9
+ max-height: 40px;
10
+ margin: .5em auto;
11
+ box-sizing: border-box;
12
+ path {
13
+ fill: currentColor
14
+ }
15
+ }
16
+ li {
17
+ padding: .3em .75em;
18
+ display: flex;
19
+ border: $lightGray 1px solid;
20
+ width: 40%;
21
+ align-items: center;
22
+ margin-right: 1em;
23
+ cursor: pointer;
24
+ overflow: hidden;
25
+ flex-direction: column;
26
+ transition: .2s all;
27
+ svg {
28
+ display: block;
29
+ height: 25px;
30
+ margin: .5em auto;
31
+ max-width: 100%;
32
+ }
33
+ span {
34
+ text-transform: none;
35
+ font-size: 1em;
36
+ }
37
+ &:hover {
38
+ background: #F2F2F2;
39
+ transition: .2s all;
40
+ }
41
+ &.active {
42
+ background: #fff;
43
+ border-color: #005eaa;
44
+ color: #005eaa;
45
+ position: relative;
46
+ path {
47
+ fill: #005eaa;
48
+ }
49
+ &:before {
50
+ content: " ";
51
+ width: 5px;
52
+ background: #005eaa;
53
+ left: 0;
54
+ top: 0;
55
+ bottom: 0;
56
+ position: absolute;
57
+ }
58
+ }
59
+ }
60
+ }
61
+
62
+ .editor-toggle {
63
+ background: #F2F2F2;
64
+ border-radius: 60px;
65
+ color: #000;
66
+ font-size: 1em;
67
+ border: 0;
68
+ position: fixed;
69
+ z-index: 100;
70
+ transition: .1s background;
71
+ cursor: pointer;
72
+ width: 25px;
73
+ height: 25px;
74
+ left: 307px;
75
+ top: 10px;
76
+ box-shadow: rgba(0,0,0,.5) 0 1px 2px;
77
+ &:before {
78
+ top: 43%;
79
+ left: 50%;
80
+ transform: translate(-50%, -50%);
81
+ position: absolute;
82
+ content: "\00ab";
83
+ }
84
+ &.collapsed {
85
+ left: 1em;
86
+ margin-left: 0;
87
+ &:before {
88
+ content: "\00bb";
89
+ }
90
+ }
91
+ &:hover {
92
+ background: rgba(255,255,255,1)
93
+ }
94
+ }
95
+
96
+ .editor-panel {
97
+ background: #fff;
98
+ width: $editorWidth;
99
+ overflow-y: overlay;
100
+ position: fixed;
101
+ z-index: 7;
102
+ display: flex;
103
+ flex-direction: column;
104
+ left: 0;
105
+ top: 0;
106
+ bottom: 0;
107
+ .remove-column {
108
+ font-size: 13px;
109
+ }
110
+ .__react_component_tooltip {
111
+ padding: 5px;
112
+ max-width: 300px;
113
+ }
114
+ .tooltip {
115
+ position: relative;
116
+ }
117
+ .helper {
118
+ position: relative;
119
+ opacity: .7;
120
+ cursor: pointer;
121
+ width: 17px;
122
+ height: 17px;
123
+ align-self: center;
124
+ margin-left: .3rem;
125
+ }
126
+
127
+ .accordion__heading {
128
+ background: $lightestGray;
129
+ }
130
+ .form-container {
131
+ border-right: $lightGray 1px solid;
132
+ flex-grow: 1;
133
+ }
134
+ .guidance-link {
135
+ margin: 2em 1em 0;
136
+ padding: .75em 1em;
137
+ align-items: center;
138
+ .heading-3 {
139
+ font-weight: 600;
140
+ font-size: 1.2em;
141
+ }
142
+ svg {
143
+ width: 60px;
144
+ color: $blue;
145
+ margin-right: 1rem;
146
+ height: 60px; // IE11
147
+ path {
148
+ fill: currentColor;
149
+ }
150
+ }
151
+ }
152
+ .warning {
153
+ color: #D8000C;
154
+ background-color: #FFD2D2;
155
+ padding: .75em 1em;
156
+ margin: 1em 0;
157
+ font-size: .8em;
158
+ border: #D8000C 1px solid;
159
+ border-radius: .4em;
160
+ strong {
161
+ font-weight: 600;
162
+ display: block;
163
+ }
164
+ }
165
+ .accordion__button {
166
+ cursor: pointer;
167
+ font-size: 1em;
168
+ padding: .3em 1em;
169
+ width: 100%;
170
+ text-align: left;
171
+ position: relative;
172
+ border-bottom: 1px solid rgba(0, 0, 0, 0.2);
173
+ }
174
+
175
+ .accordion__button:before {
176
+ display: inline-block;
177
+ content: '';
178
+ height: 7px;
179
+ width: 7px;
180
+ margin-right: 1em;
181
+ border-bottom: 2px solid currentColor;
182
+ border-right: 2px solid currentColor;
183
+ transform: rotate(-45deg);
184
+ right: 0;
185
+ position: absolute;
186
+ top: 50%;
187
+ transform: rotate(-45deg) translateY(-50%);
188
+ transition: .1s all;
189
+ }
190
+
191
+ .accordion__button[aria-expanded='true']::before,
192
+ .accordion__button[aria-selected='true']::before {
193
+ top: 45%;
194
+ transform: rotate(45deg) translateY(-50%);
195
+ margin-right: 1.3em;
196
+ transition: .1s all;
197
+ }
198
+
199
+ .accordion__panel {
200
+ border-bottom: 1px solid rgba(0, 0, 0, 0.2);
201
+ padding: 1em 1.25em 2em;
202
+ animation: fadein 0.2s ease-in;
203
+ span.h5 {
204
+ font-size: .8em;
205
+ }
206
+ }
207
+
208
+ .advanced {
209
+ padding: 0 1em 1em;
210
+ text-align: left;
211
+ p {
212
+ font-size: .8rem;
213
+ }
214
+ .advanced-toggle-link {
215
+ padding-top: 1em;
216
+ display: block;
217
+ text-align: left;
218
+ cursor: pointer;
219
+ color: rgba(0,0,0,.5);
220
+ text-decoration: underline;
221
+ span {
222
+ text-decoration: none;
223
+ display: inline-block;
224
+ font-family: monospace;
225
+ padding-right: 5px;
226
+ }
227
+ &:hover {
228
+ color: rgba(0,0,0,.7);
229
+ }
230
+ }
231
+ textarea {
232
+ height: 400px;
233
+ width: 100%;
234
+ font-size: .9em;
235
+ padding: .5em;
236
+ font-family: monospace;
237
+ box-sizing: border-box
238
+ }
239
+ }
240
+
241
+ @keyframes fadein {
242
+ 0% {
243
+ opacity: 0;
244
+ }
245
+
246
+ 100% {
247
+ opacity: 1;
248
+ }
249
+ }
250
+
251
+ .base-label {
252
+ background: #565656;
253
+ color: #fff;
254
+ font-size: 1.1em;
255
+ padding: .6em 1em;
256
+ position: relative;
257
+ border-bottom:#565656 3px solid;
258
+ z-index: 3;
259
+ }
260
+
261
+ label {
262
+ text-transform: uppercase;
263
+ display: block;
264
+ font-size: .8em;
265
+ font-weight: 600;
266
+ &:not(:first-child) {
267
+ margin-top: 1em;
268
+ }
269
+ span.edit-label {
270
+ margin-bottom: .3em;
271
+ display: flex;
272
+ }
273
+ span.column-heading {
274
+ font-size: 1em;
275
+ }
276
+ &.checkbox {
277
+ margin-top: .5rem;
278
+ display: flex;
279
+ span {
280
+ display: inline;
281
+ }
282
+ input {
283
+ margin-left: 0;
284
+ width: inherit;
285
+ display: inline;
286
+ }
287
+ }
288
+ }
289
+ input[type="text"], input[role="combobox"], input[type="number"], textarea {
290
+ min-width: 100%;
291
+ max-width: 100%; // Doing this prevents width of textarea from being changed
292
+ }
293
+ textarea {
294
+ min-height: 140px;
295
+ }
296
+ .header .color-palette li {
297
+ width: 21px;
298
+ height: 21px;
299
+ border-radius: 40px;
300
+ margin-right: 2.8px;
301
+ }
302
+ .color-palette {
303
+ display: flex;
304
+ max-width: 100%;
305
+ padding: 0;
306
+ margin: .5em 0 0 0;
307
+ list-style: none;
308
+ flex-wrap: wrap;
309
+ li {
310
+ width: 45px;
311
+ height: 23px;
312
+ margin-right: 4px;
313
+ margin-bottom: 10px;
314
+ display: flex;
315
+ border-radius: 5px;
316
+ overflow: hidden;
317
+ cursor: pointer;
318
+ position: relative;
319
+ .click-target {
320
+ position: absolute;
321
+ top: 0;
322
+ left: 0;
323
+ right: 0;
324
+ bottom: 0;
325
+ }
326
+ &.selected {
327
+ border: rgba(0,0,0, .8) 2px solid;
328
+ }
329
+ span {
330
+ width: 33.3%;
331
+ }
332
+ }
333
+ }
334
+
335
+ fieldset {
336
+ display: block;
337
+ }
338
+
339
+ .primary-fieldset {
340
+ padding: 0;
341
+ margin: 0;
342
+ border: 0;
343
+ }
344
+
345
+ ul.column-edit {
346
+ list-style: none;
347
+ li {
348
+ margin-top: 1em;
349
+ }
350
+ .three-col {
351
+ display: flex;
352
+ justify-content: space-between;
353
+ > label {
354
+ margin-top: 0;
355
+ width: 30%;
356
+ display: inline-block;
357
+ input[type="text"], input[type="number"] {
358
+ width: 50px;
359
+ }
360
+ }
361
+ }
362
+ }
363
+
364
+ &.hidden {
365
+ display: none;
366
+ }
367
+
368
+ .emove-column {
369
+ float: right;
370
+ text-transform: uppercase;
371
+ color: #C32B2B;
372
+ font-size: .7em;
373
+ line-height: 1.6em;
374
+ border-radius: 5px;
375
+ margin: 0 auto;
376
+ transition: .1s all;
377
+ border: 0;
378
+ text-decoration: underline;
379
+ outline: 0;
380
+ cursor: pointer;
381
+ font-weight: bold;
382
+ }
383
+
384
+ .edit-block {
385
+ padding-left: 1em;
386
+ border-left: rgba(0, 0, 0, 0.2) 4px solid;
387
+ transition: .2s all;
388
+ &:not(:first-child) {
389
+ margin-top: 2em;
390
+ }
391
+ input[type="text"], input[type="number"] {
392
+ font-size: 1em;
393
+ }
394
+ label {
395
+ margin-top: 0;
396
+ }
397
+ label + label {
398
+ margin-top: 1em;
399
+ }
400
+ &:hover {
401
+ border-left: rgba(0, 0, 0, 0.7) 4px solid;
402
+ transition: .2s all;
403
+ }
404
+ }
405
+
406
+ .data-toggle {
407
+ list-style: none;
408
+ li {
409
+ padding-left: 2em;
410
+ position: relative;
411
+ &:before {
412
+ content: " ";
413
+ position: absolute;
414
+ left: 20px;
415
+ top: 0;
416
+ bottom: 0;
417
+ border-left: rgba(0, 0, 0, 0.2) 4px solid;
418
+ transition: .2s all;
419
+ }
420
+ &:after {
421
+ content: " ";
422
+ background: url('../images/inactive-checkmark.svg') no-repeat;
423
+ width: 14px;
424
+ height: 14px;
425
+ background-size: 14px;
426
+ position: absolute;
427
+ left: 0;
428
+ top: 50%;
429
+ transform: translateY(-50%);
430
+ z-index: 40;
431
+ opacity: .5;
432
+ transition: .2s opacity;
433
+ }
434
+ transition: .2s opacity;
435
+ cursor: pointer;
436
+ opacity: .7;
437
+ &:not(:first-child) {
438
+ margin-top: 1em;
439
+ }
440
+ input[type="text"], input[type="number"] {
441
+ font-size: 1em;
442
+ }
443
+ label {
444
+ margin-top: 0;
445
+ }
446
+ label + label {
447
+ margin-top: 1em;
448
+ }
449
+ &:hover {
450
+ &:before {
451
+ border-left: rgba(0, 0, 0, 0.7) 4px solid;
452
+ transition: .2s all;
453
+ }
454
+ &:after{
455
+ opacity: 1;
456
+ transition: .2s all;
457
+ }
458
+ }
459
+ &.active {
460
+ position: relative;
461
+ opacity: 1;
462
+ &:before {
463
+ border-left: rgba(0, 0, 0, 0.7) 4px solid;
464
+ }
465
+ &:after {
466
+ content: " ";
467
+ background-image: url(../images/active-checkmark.svg);
468
+ opacity: 1;
469
+ transition: .2s opacity;
470
+ }
471
+ }
472
+ }
473
+ }
474
+
475
+ span.subtext {
476
+ display: block;
477
+ color: rgba(0,0,0,.5);
478
+ text-transform: none;
479
+ font-weight: normal;
480
+ }
481
+
482
+ .btn {
483
+ margin-top: 1em;
484
+ }
485
+ .sort-list {
486
+ list-style: none;
487
+ > li {
488
+ margin-right: .3em;
489
+ margin-bottom: .3em;
490
+ }
491
+ }
492
+ .sort-list li > div {
493
+ display: block;
494
+ box-sizing: border-box;
495
+ border: 1px solid #D1D1D1;
496
+ border-radius: 2px;
497
+ background: #F1F1F1;
498
+ padding: .4em .6em;
499
+ font-size: .8em;
500
+ margin-bottom: .3em;
501
+ cursor: move;
502
+ z-index: 999;
503
+ }
504
+
505
+ .info {
506
+ font-size: .8em;
507
+ line-height: 1.4em;
508
+ font-style: italic;
509
+ padding-top: 10px;
510
+ }
511
+
512
+ .react-tags__search {
513
+ width: 100%;
514
+ }
515
+
516
+ .react-tags {
517
+ position: relative;
518
+ input.react-tags__search-input {
519
+ font-size: .8rem;
520
+ }
521
+ /* clicking anywhere will focus the input */
522
+ cursor: text;
523
+ span {
524
+ display: inline
525
+ }
526
+ }
527
+
528
+ .react-tags.is-focused {
529
+ border-color: rgba(0, 0, 0, 0.7);
530
+ }
531
+
532
+ .react-tags__selected {
533
+ display: inline;
534
+ }
535
+
536
+ .react-tags__selected-tag {
537
+ display: inline-block;
538
+ box-sizing: border-box;
539
+ border: 1px solid #D1D1D1;
540
+ border-radius: 2px;
541
+ background: #F1F1F1;
542
+ padding: .4em .6em;
543
+ font-size: .8em;
544
+ margin-right: .3em;
545
+ margin-bottom: .3em;
546
+ }
547
+
548
+ .react-tags__selected-tag:after {
549
+ content: '\2715';
550
+ color: #AAA;
551
+ margin-left: 8px;
552
+ }
553
+
554
+ .react-tags__selected-tag:hover,
555
+ .react-tags__selected-tag:focus {
556
+ border-color: #B1B1B1;
557
+ }
558
+
559
+ .react-tags__search {
560
+ display: inline-block;
561
+
562
+ /* prevent autoresize overflowing the container */
563
+ max-width: 100%;
564
+ }
565
+
566
+ @media screen and (min-width: 30em) {
567
+
568
+ .react-tags__search {
569
+ /* this will become the offsetParent for suggestions */
570
+ position: relative;
571
+ }
572
+
573
+ }
574
+
575
+ .react-tags__search input {
576
+ /* prevent autoresize overflowing the container */
577
+ max-width: 100%;
578
+
579
+ /* emove styles and layout from this element */
580
+ margin: 0;
581
+ outline: none;
582
+ padding: .5em .3em;
583
+
584
+ /* match the font styles */
585
+ font-size: inherit;
586
+ line-height: inherit;
587
+ }
588
+
589
+ .react-tags__search input::-ms-clear {
590
+ display: none;
591
+ }
592
+
593
+ .react-tags__suggestions {
594
+ position: absolute;
595
+ top: 100%;
596
+ left: 0;
597
+ width: 100%;
598
+ }
599
+
600
+ @media screen and (min-width: 30em) {
601
+
602
+ .react-tags__suggestions {
603
+ width: 240px;
604
+ }
605
+
606
+ }
607
+
608
+ .react-tags__suggestions ul {
609
+ margin: 4px -1px;
610
+ padding: 0;
611
+ list-style: none;
612
+ background: white;
613
+ border: 1px solid #D1D1D1;
614
+ border-radius: 2px;
615
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
616
+ }
617
+
618
+ .react-tags__suggestions li {
619
+ border-bottom: 1px solid #ddd;
620
+ padding: 6px 8px;
621
+ }
622
+
623
+ .react-tags__suggestions li mark {
624
+ text-decoration: underline;
625
+ background: none;
626
+ font-weight: 600;
627
+ }
628
+
629
+ .react-tags__suggestions li:hover {
630
+ cursor: pointer;
631
+ background: #eee;
632
+ }
633
+
634
+ .react-tags__suggestions li.is-active {
635
+ background: #b7cfe0;
636
+ }
637
+
638
+ .react-tags__suggestions li.is-disabled {
639
+ opacity: 0.5;
640
+ cursor: auto;
641
+ }
642
+
643
+ }
644
+
645
+ @include breakpointClass(md) {
646
+ .editor-panel:not(.hidden) + .cdc-map-inner-container {
647
+ padding-left: $editorWidth;
648
+ }
649
+ .waiting {
650
+ background-color: #fff;
651
+ padding-left: $editorWidth;
652
+ }
653
+ }
654
+ }