@cdc/editor 4.25.10 → 4.26.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.
@@ -0,0 +1,3 @@
1
+ M_short_indicator_text,M_footnote_text_to_define_short_text,M_datasource_footnotetext,M_footnote_context1,M_footnote_context2,M_footnote_context3
2
+ Cause-specific Deaths,ATD = Attributable to Diabetes,"Data Sources: Centers for Disease Control and Prevention, National Center for Health Statistics. Multiple Cause of Death 1999-2013 from CDC WONDER Online Database, 2013 United States Renal Data System.","All Causes of Death (Estimated): Reports the estimated number of deaths from all causes attributable to diabetes as a rate (per 100,000 persons age 15+). ","Cardiovascular Disease (Estimated): Reports the estimated number of deaths from cardiovascular disease attributable to diabetes as a rate (per 100,000 persons age 15+). ","End-stage Renal Disease: Reports the number of deaths from end-stage renal disease attributable to diabetes as a rate (per 100,000 persons age 15+). "
3
+ Diabetes Cause of Death,,"Data Sources: Centers for Disease Control and Prevention, National Center for Health Statistics. Multiple Cause of Death 2021 from CDC WONDER Online Database.",Number of Deaths: Reports the number of deaths with diabetes as the underlying cause of death.,,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdc/editor",
3
- "version": "4.25.10",
3
+ "version": "4.26.1",
4
4
  "description": "React component for generating a new component entry",
5
5
  "moduleName": "CdcEditor",
6
6
  "main": "dist/cdceditor",
@@ -25,13 +25,13 @@
25
25
  },
26
26
  "license": "Apache-2.0",
27
27
  "dependencies": {
28
- "@cdc/chart": "^4.25.10",
29
- "@cdc/core": "^4.25.10",
30
- "@cdc/dashboard": "^4.25.10",
31
- "@cdc/data-bite": "^4.25.10",
32
- "@cdc/map": "^4.25.10",
33
- "@cdc/markup-include": "^4.25.10",
34
- "@cdc/waffle-chart": "^4.25.10",
28
+ "@cdc/chart": "^4.26.1",
29
+ "@cdc/core": "^4.26.1",
30
+ "@cdc/dashboard": "^4.26.1",
31
+ "@cdc/data-bite": "^4.26.1",
32
+ "@cdc/map": "^4.26.1",
33
+ "@cdc/markup-include": "^4.26.1",
34
+ "@cdc/waffle-chart": "^4.26.1",
35
35
  "axios": "^1.9.0",
36
36
  "d3": "^7.9.0",
37
37
  "react-dropzone": "^14.3.8",
@@ -44,9 +44,8 @@
44
44
  "devDependencies": {
45
45
  "@rollup/plugin-dsv": "^3.0.2",
46
46
  "@vitejs/plugin-react": "^4.3.4",
47
- "vite": "^4.4.11",
48
47
  "vite-plugin-css-injected-by-js": "^2.4.0",
49
- "vite-plugin-svgr": "^2.4.0"
48
+ "vite-plugin-svgr": "^4.2.0"
50
49
  },
51
- "gitHead": "c2db758e74ab9b9ca1667a6f9cb41dd0dccf985d"
50
+ "gitHead": "7e3b27098c4eb7a24bc9c3654ad53f88d6419f16"
52
51
  }
@@ -26,6 +26,7 @@ import SankeyIcon from '@cdc/core/assets/icon-sankey.svg'
26
26
  import ComboChartIcon from '@cdc/core/assets/icon-combo-chart.svg'
27
27
  import EpiChartIcon from '@cdc/core/assets/icon-epi-chart.svg'
28
28
  import TableIcon from '@cdc/core/assets/icon-table.svg'
29
+ import WarmingStripesIcon from '@cdc/core/assets/icon-warming-stripes.svg'
29
30
  import Icon from '@cdc/core/components/ui/Icon'
30
31
 
31
32
  import {
@@ -276,6 +277,67 @@ const ChooseTab: React.FC = (): JSX.Element => {
276
277
  export default ChooseTab
277
278
 
278
279
  const buttons = [
280
+ // General - sorted by label
281
+ {
282
+ id: 15,
283
+ category: 'General',
284
+ label: 'Dashboard',
285
+ type: 'dashboard',
286
+ subType: null,
287
+ orientation: null,
288
+ icon: <DashboardIcon />,
289
+ content: 'Present multiple data visualizations with shared filter controls.'
290
+ },
291
+ {
292
+ id: 16,
293
+ category: 'General',
294
+ label: 'Data Bite',
295
+ type: 'data-bite',
296
+ subType: null,
297
+ orientation: null,
298
+ icon: <DataBiteIcon />,
299
+ content: 'Highlight a single aggregated value (e.g., sum or median).'
300
+ },
301
+ {
302
+ id: 24,
303
+ category: 'General',
304
+ label: 'Data Table',
305
+ type: 'table',
306
+ subType: null,
307
+ icon: <TableIcon />
308
+ },
309
+ {
310
+ id: 18,
311
+ category: 'General',
312
+ label: 'Gauge Chart',
313
+ type: 'waffle-chart',
314
+ subType: 'Gauge',
315
+ orientation: null,
316
+ icon: <GaugeChartIcon />,
317
+ content: `Specify the calculation of a single data point (such as a percentage value) and present it on a horizontal
318
+ scale.`
319
+ },
320
+ {
321
+ id: 17,
322
+ category: 'General',
323
+ label: 'Waffle Chart',
324
+ type: 'waffle-chart',
325
+ subType: 'Waffle',
326
+ orientation: null,
327
+ icon: <WaffleChartIcon />,
328
+ content: 'Highlight a piece of data in relationship to a data set.'
329
+ },
330
+ // Charts - sorted by label
331
+ {
332
+ id: 6,
333
+ category: 'Charts',
334
+ label: 'Area Chart',
335
+ type: 'chart',
336
+ subType: 'Area Chart',
337
+ orientation: 'vertical',
338
+ icon: <AreaChartIcon />,
339
+ content: 'Display an area chart to visualize quantities over time.'
340
+ },
279
341
  {
280
342
  id: 1,
281
343
  category: 'Charts',
@@ -294,6 +356,36 @@ const buttons = [
294
356
  icon: <BarIcon />,
295
357
  content: 'Use bars to show comparisons between data categories.'
296
358
  },
359
+ {
360
+ id: 9,
361
+ category: 'Charts',
362
+ label: 'Box Plot',
363
+ type: 'chart',
364
+ subType: 'Box Plot',
365
+ orientation: 'vertical',
366
+ icon: <BoxPlotIcon />,
367
+ content: 'Display a box plot to visualize the distribution of numerical data through quartiles.'
368
+ },
369
+ {
370
+ id: 3,
371
+ category: 'Charts',
372
+ label: 'Combo Chart',
373
+ type: 'chart',
374
+ subType: 'Combo',
375
+ orientation: 'vertical',
376
+ icon: <ComboChartIcon />,
377
+ content: 'Use bars to show comparisons between data categories.'
378
+ },
379
+ {
380
+ id: 14,
381
+ category: 'Charts',
382
+ label: 'Deviation Bar',
383
+ type: 'chart',
384
+ subType: 'Deviation Bar',
385
+ orientation: 'Pie',
386
+ icon: <DeviationIcon />,
387
+ content: 'Use deviation bars to display how individual values differ from a target'
388
+ },
297
389
  {
298
390
  id: 2,
299
391
  category: 'Charts',
@@ -314,13 +406,24 @@ const buttons = [
314
406
  content: 'Use bars to show comparisons between data categories.'
315
407
  },
316
408
  {
317
- id: 3,
409
+ id: 7,
318
410
  category: 'Charts',
319
- label: 'Combo Chart',
411
+ label: 'Forecast Chart',
320
412
  type: 'chart',
321
- subType: 'Combo',
413
+ subType: 'Forecasting',
322
414
  orientation: 'vertical',
323
- icon: <ComboChartIcon />,
415
+ icon: <ForecastIcon />,
416
+ content: 'Display a forecasting chart to predict future data trends.'
417
+ },
418
+ {
419
+ id: 12,
420
+ category: 'Charts',
421
+ label: 'Horizontal Bar (Stacked)',
422
+ type: 'chart',
423
+ subType: 'Bar',
424
+ visualizationSubType: 'stacked',
425
+ orientation: 'horizontal',
426
+ icon: <HorizontalStackIcon />,
324
427
  content: 'Use bars to show comparisons between data categories.'
325
428
  },
326
429
  {
@@ -344,24 +447,24 @@ const buttons = [
344
447
  content: 'Use paired bars to show comparisons between two different data categories.'
345
448
  },
346
449
  {
347
- id: 6,
450
+ id: 13,
348
451
  category: 'Charts',
349
- label: 'Area Chart',
452
+ label: 'Pie',
350
453
  type: 'chart',
351
- subType: 'Area Chart',
352
- orientation: 'vertical',
353
- icon: <AreaChartIcon />,
354
- content: 'Display an area chart to visualize quantities over time.'
454
+ subType: 'Pie',
455
+ orientation: 'Pie',
456
+ icon: <PieIcon />,
457
+ content: 'Present the numerical proportions of a data series.'
355
458
  },
356
459
  {
357
- id: 7,
460
+ id: 10,
358
461
  category: 'Charts',
359
- label: 'Forecast Chart',
462
+ label: 'Sankey Diagram',
360
463
  type: 'chart',
361
- subType: 'Forecasting',
464
+ subType: 'Sankey',
362
465
  orientation: 'vertical',
363
- icon: <ForecastIcon />,
364
- content: 'Display a forecasting chart to predict future data trends.'
466
+ icon: <SankeyIcon />,
467
+ content: 'Display a sankey diagram'
365
468
  },
366
469
  {
367
470
  id: 8,
@@ -374,116 +477,37 @@ const buttons = [
374
477
  content: 'Display a scatter plot to explore relationships between numeric variables.'
375
478
  },
376
479
  {
377
- id: 9,
378
- category: 'Charts',
379
- label: 'Box Plot',
380
- type: 'chart',
381
- subType: 'Box Plot',
382
- orientation: 'vertical',
383
- icon: <BoxPlotIcon />,
384
- content: 'Display a box plot to visualize the distribution of numerical data through quartiles.'
385
- },
386
- {
387
- id: 10,
388
- category: 'Charts',
389
- label: 'Sankey Diagram',
390
- type: 'chart',
391
- subType: 'Sankey',
392
- orientation: 'vertical',
393
- icon: <SankeyIcon />,
394
- content: 'Display a sankey diagram'
395
- },
396
- {
397
- id: 11,
480
+ id: 25,
398
481
  category: 'Charts',
399
- label: 'Forecast Chart',
482
+ label: 'Warming Stripes',
400
483
  type: 'chart',
401
- subType: 'Forecasting',
484
+ subType: 'Warming Stripes',
402
485
  orientation: 'vertical',
403
- icon: <ForecastIcon />,
404
- content: 'Display a forecasting chart'
405
- },
406
- {
407
- id: 12,
408
- category: 'Charts',
409
- label: 'Horizontal Bar (Stacked)',
410
- type: 'chart',
411
- subType: 'Bar',
412
- visualizationSubType: 'stacked',
413
- orientation: 'horizontal',
414
- icon: <HorizontalStackIcon />,
415
- content: 'Use bars to show comparisons between data categories.'
416
- },
417
- {
418
- id: 13,
419
- category: 'Charts',
420
- label: 'Pie',
421
- type: 'chart',
422
- subType: 'Pie',
423
- orientation: 'Pie',
424
- icon: <PieIcon />,
425
- content: 'Present the numerical proportions of a data series.'
426
- },
427
- {
428
- id: 14,
429
- category: 'Charts',
430
- label: 'Deviation Bar',
431
- type: 'chart',
432
- subType: 'Deviation Bar',
433
- orientation: 'Pie',
434
- icon: <DeviationIcon />,
435
- content: 'Use deviation bars to display how individual values differ from a target'
436
- },
437
- {
438
- id: 15,
439
- category: 'General',
440
- label: 'Dashboard',
441
- type: 'dashboard',
442
- subType: null,
443
- orientation: null,
444
- icon: <DashboardIcon />,
445
- content: 'Present multiple data visualizations with shared filter controls.'
446
- },
447
- {
448
- id: 16,
449
- category: 'General',
450
- label: 'Data Bite',
451
- type: 'data-bite',
452
- subType: null,
453
- orientation: null,
454
- icon: <DataBiteIcon />,
455
- content: 'Highlight a single aggregated value (e.g., sum or median).'
456
- },
457
- {
458
- id: 17,
459
- category: 'General',
460
- label: 'Waffle Chart',
461
- type: 'waffle-chart',
462
- subType: 'Waffle',
463
- orientation: null,
464
- icon: <WaffleChartIcon />,
465
- content: 'Highlight a piece of data in relationship to a data set.'
486
+ legend: {
487
+ position: 'bottom'
488
+ },
489
+ icon: <WarmingStripesIcon />,
490
+ content: 'Display temperature anomalies over time using color-coded vertical stripes.'
466
491
  },
492
+ // Maps - sorted by label
467
493
  {
468
- id: 18,
469
- category: 'General',
470
- label: 'Gauge Chart',
471
- type: 'waffle-chart',
472
- subType: 'Gauge',
473
- orientation: null,
474
- icon: <GaugeChartIcon />,
475
- content: `Specify the calculation of a single data point (such as a percentage value) and present it on a horizontal
476
- scale.`
494
+ id: 23,
495
+ category: 'Maps',
496
+ label: 'U.S. Geocode',
497
+ type: 'map',
498
+ subType: 'us-county',
499
+ generalType: 'us-geocode',
500
+ icon: <UsaIcon />,
501
+ content: 'United States GeoCode'
477
502
  },
478
503
  {
479
- id: 19,
504
+ id: 22,
480
505
  category: 'Maps',
481
- label: 'United States (State- or County-Level)',
506
+ label: 'U.S. State',
482
507
  type: 'map',
483
- subType: 'us',
484
- icon: <UsaIcon />,
485
- content: 'Present a U.S. choropleth map at state or county level.',
486
- position: 'right'
508
+ subType: 'single-state',
509
+ icon: <AlabamaGraphic />,
510
+ content: 'Present a choropleth map of an individual U.S. state.'
487
511
  },
488
512
  {
489
513
  id: 20,
@@ -495,6 +519,16 @@ const buttons = [
495
519
  content: 'Present a U.S. choropleth map at state or county level.',
496
520
  position: 'right'
497
521
  },
522
+ {
523
+ id: 19,
524
+ category: 'Maps',
525
+ label: 'United States (State- or County-Level)',
526
+ type: 'map',
527
+ subType: 'us',
528
+ icon: <UsaIcon />,
529
+ content: 'Present a U.S. choropleth map at state or county level.',
530
+ position: 'right'
531
+ },
498
532
  {
499
533
  id: 21,
500
534
  category: 'Maps',
@@ -503,32 +537,5 @@ const buttons = [
503
537
  subType: 'world',
504
538
  icon: <GlobeIcon />,
505
539
  content: 'Present a choropleth map of the world.'
506
- },
507
- {
508
- id: 22,
509
- category: 'Maps',
510
- label: 'U.S. State',
511
- type: 'map',
512
- subType: 'single-state',
513
- icon: <AlabamaGraphic />,
514
- content: 'Present a choropleth map of an individual U.S. state.'
515
- },
516
- {
517
- id: 23,
518
- category: 'Maps',
519
- label: 'U.S. Geocode',
520
- type: 'map',
521
- subType: 'us-county',
522
- generalType: 'us-geocode',
523
- icon: <UsaIcon />,
524
- content: 'United States GeoCode'
525
- },
526
- {
527
- id: 24,
528
- category: 'General',
529
- label: 'Data Table',
530
- type: 'table',
531
- subType: null,
532
- icon: <TableIcon />
533
540
  }
534
541
  ]
@@ -30,7 +30,11 @@ export default function ConfigureTab({ containerEl }) {
30
30
  </ErrorBoundary>
31
31
  )
32
32
  case 'waffle-chart':
33
- if (config.visualizationType === 'Waffle' || config.visualizationType === 'Gauge') {
33
+ if (
34
+ config.visualizationType === 'Waffle' ||
35
+ config.visualizationType === 'TP5 Waffle' ||
36
+ config.visualizationType === 'Gauge'
37
+ ) {
34
38
  return (
35
39
  <ErrorBoundary component='CdcWaffleChart'>
36
40
  <CdcWaffleChart isEditor={true} isDebug={isDebug} config={config} setConfig={setTempConfig} />
@@ -1,5 +1,6 @@
1
1
  import React, { useContext } from 'react'
2
2
  import SampleDataContext from './samples/SampleDataContext'
3
+ import { cityTemperature } from '@visx/mock-data'
3
4
 
4
5
  // Data Samples
5
6
  import validMapData from './samples/valid-data-map.csv?raw'
@@ -17,6 +18,13 @@ import validRegionData from './samples/valid-region-data.json?raw'
17
18
  import validSankeyData from './samples/valid-sankey-data.json?raw'
18
19
  import pivotData from './samples/pivotData.json?raw'
19
20
 
21
+ // Convert visx cityTemperature data to CSV format
22
+ const visxTemperatureData = (() => {
23
+ const headers = Object.keys(cityTemperature[0])
24
+ const rows = cityTemperature.map(row => Object.values(row).join(','))
25
+ return [headers.join(','), ...rows].join('\n')
26
+ })()
27
+
20
28
  // Add additional data to samples
21
29
  const sampleData = {
22
30
  charts: [
@@ -54,6 +62,11 @@ const sampleData = {
54
62
  text: 'Pivot Table Data',
55
63
  fileName: 'pivotData.json',
56
64
  data: pivotData
65
+ },
66
+ {
67
+ text: 'Warming Stripes Temperature Data',
68
+ fileName: 'visx-temperature-data.csv',
69
+ data: visxTemperatureData
57
70
  }
58
71
  ],
59
72
  maps: [
@@ -1,17 +1,37 @@
1
- Group_Category,Value
2
- category one,21
3
- category one,19
4
- category one,23
5
- category one,24
6
- category two,18
7
- category two,10
8
- category two,12
9
- category two,19
10
- category three,30
11
- category three,35
12
- category three,36
13
- category three,40
14
- category four,50
15
- category four,54
16
- category four,42
17
- category four,159
1
+ Group,Score
2
+ Group A,8
3
+ Group A,24
4
+ Group A,32
5
+ Group A,40
6
+ Group A,43
7
+ Group A,72
8
+ Group A,83
9
+ Group A,90
10
+ Group A,92
11
+ Group A,96
12
+ Group A,112
13
+ Group A,278
14
+ Group B,5
15
+ Group B,10
16
+ Group B,15
17
+ Group B,20
18
+ Group B,25
19
+ Group B,30
20
+ Group B,35
21
+ Group B,40
22
+ Group B,45
23
+ Group B,50
24
+ Group B,55
25
+ Group B,60
26
+ Group C,12
27
+ Group C,44
28
+ Group C,46
29
+ Group C,63
30
+ Group C,76
31
+ Group C,88
32
+ Group C,94
33
+ Group C,99
34
+ Group C,112
35
+ Group C,118
36
+ Group C,240
37
+ Group C,256
@@ -260,36 +260,43 @@ const PreviewDataTable = () => {
260
260
  <div className='table-responsive'>
261
261
  <table className='mt-2 w-100 table table-striped data-table table-sm ' aria-hidden='true' {...getTableProps}>
262
262
  <thead>
263
- {headerGroups.map(headerGroup => (
264
- <tr {...headerGroup.getHeaderGroupProps()}>
265
- {headerGroup.headers.map(column => {
266
- const { key, ...headerProps } = column.getHeaderProps(column.getSortByToggleProps())
267
- return (
268
- <th
269
- key={key}
270
- scope='col'
271
- {...headerProps}
272
- className={column.isSorted ? (column.isSortedDesc ? 'sort sort-desc' : 'sort sort-asc') : ''}
273
- title={column.Header}
274
- >
275
- {column.render('Header')}
276
- <div {...column.getResizerProps()} className='resizer' />
277
- </th>
278
- )
279
- })}
280
- </tr>
281
- ))}
263
+ {headerGroups.map(headerGroup => {
264
+ const { key, ...headerGroupProps } = headerGroup.getHeaderGroupProps()
265
+ return (
266
+ <tr key={key} {...headerGroupProps}>
267
+ {headerGroup.headers.map(column => {
268
+ const { key: columnKey, ...headerProps } = column.getHeaderProps(column.getSortByToggleProps())
269
+ return (
270
+ <th
271
+ key={columnKey}
272
+ scope='col'
273
+ {...headerProps}
274
+ className={column.isSorted ? (column.isSortedDesc ? 'sort sort-desc' : 'sort sort-asc') : ''}
275
+ title={column.Header}
276
+ >
277
+ {column.render('Header')}
278
+ <div {...column.getResizerProps()} className='resizer' />
279
+ </th>
280
+ )
281
+ })}
282
+ </tr>
283
+ )
284
+ })}
282
285
  </thead>
283
286
  <tbody {...getTableBodyProps()}>
284
287
  {page.map(row => {
285
288
  prepareRow(row)
289
+ const { key, ...rowProps } = row.getRowProps()
286
290
  return (
287
- <tr {...row.getRowProps()}>
288
- {row.cells.map(cell => (
289
- <td {...cell.getCellProps()} title={cell.value}>
290
- {cell.render('Cell')}
291
- </td>
292
- ))}
291
+ <tr key={key} {...rowProps}>
292
+ {row.cells.map(cell => {
293
+ const { key: cellKey, ...cellProps } = cell.getCellProps()
294
+ return (
295
+ <td key={cellKey} {...cellProps} title={cell.value}>
296
+ {cell.render('Cell')}
297
+ </td>
298
+ )
299
+ })}
293
300
  </tr>
294
301
  )
295
302
  })}