@cdc/editor 4.24.9 → 4.24.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.
@@ -1,12 +1,10 @@
1
1
  import React, { useContext } from 'react'
2
2
 
3
- import CdcMap from '@cdc/map' // TODO: Lazy load this
4
- import CdcChart from '@cdc/chart' // TODO: Lazy load this
5
- import CdcDataBite from '@cdc/data-bite'
6
- import CdcWaffleChart from '@cdc/waffle-chart'
7
- import CdcMarkupInclude from '@cdc/markup-include'
8
-
9
- import '../scss/configure-tab.scss'
3
+ import CdcMap from '@cdc/map/src/CdcMap' // TODO: Lazy load this
4
+ import CdcChart from '../../../chart/src/CdcChart' // TODO: Lazy load this
5
+ import CdcDataBite from '@cdc/data-bite/src/CdcDataBite'
6
+ import CdcWaffleChart from '@cdc/waffle-chart/src/CdcWaffleChart'
7
+ import CdcMarkupInclude from '@cdc/markup-include/src/CdcMarkupInclude'
10
8
 
11
9
  import ErrorBoundary from '@cdc/core/components/ErrorBoundary'
12
10
  import ConfigContext from '../ConfigContext'
@@ -21,7 +19,14 @@ export default function ConfigureTab({ containerEl }) {
21
19
  case 'map':
22
20
  return (
23
21
  <ErrorBoundary component='CdcMap'>
24
- <CdcMap isEditor={true} isDebug={isDebug} config={config} hostname={hostname} setConfig={setTempConfig} containerEl={containerEl} />
22
+ <CdcMap
23
+ isEditor={true}
24
+ isDebug={isDebug}
25
+ config={config}
26
+ hostname={hostname}
27
+ setConfig={setTempConfig}
28
+ containerEl={containerEl}
29
+ />
25
30
  </ErrorBoundary>
26
31
  )
27
32
  case 'waffle-chart':
@@ -40,7 +40,9 @@ export default function DataImport() {
40
40
  }
41
41
  const transform = new DataTransform()
42
42
 
43
- const [externalURL, setExternalURL] = useState(config.dataFileSourceType === 'url' ? config.dataFileName : config.dataUrl || '')
43
+ const [externalURL, setExternalURL] = useState(
44
+ config.dataFileSourceType === 'url' ? config.dataFileName : config.dataUrl || ''
45
+ )
44
46
 
45
47
  const [keepURL, setKeepURL] = useState(!!config.dataUrl)
46
48
 
@@ -59,13 +61,13 @@ export default function DataImport() {
59
61
  if (size === undefined) return ''
60
62
 
61
63
  if (size > Math.pow(1024, 3)) {
62
- return Math.round((size / Math.pow(1024, 3)) * 100) / 100 + ' GB'
64
+ return Math.round((size / Math.pow(1024, 3)) * 100) / 100 + 'GB'
63
65
  } else if (size > Math.pow(1024, 2)) {
64
- return Math.round((size / Math.pow(1024, 2)) * 100) / 100 + ' MB'
66
+ return Math.round((size / Math.pow(1024, 2)) * 100) / 100 + 'MB'
65
67
  } else if (size > 1024) {
66
- return Math.round((size / 1024) * 100) / 100 + ' KB'
68
+ return Math.round((size / 1024) * 100) / 100 + 'KB'
67
69
  } else {
68
- return size + ' B'
70
+ return size + 'B'
69
71
  }
70
72
  }
71
73
 
@@ -88,7 +90,11 @@ export default function DataImport() {
88
90
  }
89
91
 
90
92
  const getFileExtension = (url: URL) => {
91
- return isSolrCsv(externalURL) ? '.csv' : isSolrJson(externalURL) ? '.json' : Object.keys(supportedDataTypes).find(extension => url.pathname.endsWith(extension))
93
+ return isSolrCsv(externalURL)
94
+ ? '.csv'
95
+ : isSolrJson(externalURL)
96
+ ? '.json'
97
+ : Object.keys(supportedDataTypes).find(extension => url.pathname.endsWith(extension))
92
98
  }
93
99
 
94
100
  const loadExternal = async () => {
@@ -96,7 +102,8 @@ export default function DataImport() {
96
102
  // Is URL valid?
97
103
 
98
104
  try {
99
- dataURL = isSolrCsv(externalURL) || isSolrJson(externalURL) ? externalURL : new URL(externalURL, window.location.origin)
105
+ dataURL =
106
+ isSolrCsv(externalURL) || isSolrJson(externalURL) ? externalURL : new URL(externalURL, window.location.origin)
100
107
  } catch {
101
108
  throw errorMessages.urlInvalid
102
109
  }
@@ -116,7 +123,11 @@ export default function DataImport() {
116
123
  const csvTypes = ['text/csv', 'text/plain']
117
124
  if ((fileExtension === '.csv' && csvTypes.includes(responseBlob.type)) || isSolrCsv(externalURL)) {
118
125
  responseBlob = responseBlob.slice(0, responseBlob.size, 'text/csv')
119
- } else if (responseBlob.type === 'application/json' || (fileExtension === '.json' && responseBlob.type === 'text/plain') || isSolrJson(externalURL)) {
126
+ } else if (
127
+ responseBlob.type === 'application/json' ||
128
+ (fileExtension === '.json' && responseBlob.type === 'text/plain') ||
129
+ isSolrJson(externalURL)
130
+ ) {
120
131
  responseBlob = responseBlob.slice(0, responseBlob.size, 'application/json')
121
132
  }
122
133
  })
@@ -146,7 +157,8 @@ export default function DataImport() {
146
157
  */
147
158
  const loadData = async (fileBlob = null, fileName, editingDatasetKey) => {
148
159
  let fileData = fileBlob
149
- const fileSource = fileData?.path ?? fileName ?? externalURL
160
+ let fileSource = fileData?.path ?? fileName ?? externalURL
161
+ if (fileSource && typeof fileSource === 'string') fileSource = fileSource.trim()
150
162
  const fileSourceType = fileBlob ? 'file' : 'url'
151
163
 
152
164
  // Get the raw data as text from the file
@@ -332,19 +344,43 @@ export default function DataImport() {
332
344
  }
333
345
 
334
346
  const { getRootProps, getInputProps, isDragActive } = useDropzone({ onDrop })
335
- const { getRootProps: getRootProps2, getInputProps: getInputProps2, isDragActive: isDragActive2 } = useDropzone({ onDrop })
347
+ const {
348
+ getRootProps: getRootProps2,
349
+ getInputProps: getInputProps2,
350
+ isDragActive: isDragActive2
351
+ } = useDropzone({ onDrop })
336
352
 
337
353
  const loadDataFromUrl = () => {
338
354
  return (
339
355
  <>
340
356
  <form className='input-group d-flex' onSubmit={e => e.preventDefault()}>
341
- <input id='external-data' type='text' className='form-control flex-grow-1 border-right-0' placeholder='e.g., https://data.cdc.gov/resources/file.json' aria-label='Load data from external URL' aria-describedby='load-data' value={externalURL} onChange={e => setExternalURL(e.target.value)} />
342
- <button className='input-group-text btn btn-primary px-4' type='submit' id='load-data' onClick={() => loadData(null, externalURL, editingDataset)}>
357
+ <input
358
+ id='external-data'
359
+ type='text'
360
+ className='form-control flex-grow-1 border-right-0'
361
+ placeholder='e.g., https://data.cdc.gov/resources/file.json'
362
+ aria-label='Load data from external URL'
363
+ aria-describedby='load-data'
364
+ value={externalURL}
365
+ onChange={e => setExternalURL(e.target.value)}
366
+ />
367
+ <button
368
+ className='rounded-0 border-0 btn btn-primary px-4'
369
+ type='submit'
370
+ id='load-data'
371
+ onClick={() => loadData(null, externalURL, editingDataset)}
372
+ >
343
373
  Load
344
374
  </button>
345
375
  </form>
346
376
  <label htmlFor='keep-url' className='mt-1 d-flex keep-url'>
347
- <input type='checkbox' id='keep-url' checked={keepURL} onChange={() => changeKeepURL(!keepURL, editingDataset)} /> Always load from URL (normally will only pull once)
377
+ <input
378
+ type='checkbox'
379
+ id='keep-url'
380
+ checked={keepURL}
381
+ onChange={() => changeKeepURL(!keepURL, editingDataset)}
382
+ />{' '}
383
+ Always load from URL (normally will only pull once)
348
384
  </label>
349
385
  </>
350
386
  )
@@ -365,7 +401,15 @@ export default function DataImport() {
365
401
  return (
366
402
  //todo convert to modal
367
403
  <>
368
- <button className='btn danger' onClick={() => resetEditor({ type: config.type, visualizationType: config.visualizationType } as Visualization, 'Resetting will remove your data and settings. Do you want to continue?')}>
404
+ <button
405
+ className='btn danger'
406
+ onClick={() =>
407
+ resetEditor(
408
+ { type: config.type, visualizationType: config.visualizationType } as Visualization,
409
+ 'Resetting will remove your data and settings. Do you want to continue?'
410
+ )
411
+ }
412
+ >
369
413
  Clear
370
414
  <CloseIcon />
371
415
  </button>
@@ -444,7 +488,8 @@ export default function DataImport() {
444
488
  readyToConfigure = Object.keys(config.datasets).length > 0
445
489
  } else {
446
490
  configureData = config
447
- readyToConfigure = !!config.formattedData || (config.data && config.dataDescription && transform.autoStandardize(config.data))
491
+ readyToConfigure =
492
+ !!config.formattedData || (config.data && config.dataDescription && transform.autoStandardize(config.data))
448
493
  }
449
494
 
450
495
  if (config.visualizationType === 'Sankey' && config.data) {
@@ -504,7 +549,10 @@ export default function DataImport() {
504
549
  <Icon display='question' />
505
550
  </Tooltip.Target>
506
551
  <Tooltip.Content>
507
- <p style={{ padding: '0.5rem' }}>Name of the query string parameter that will be appended to the URL above with the values provided below.</p>
552
+ <p style={{ padding: '0.5rem' }}>
553
+ Name of the query string parameter that will be appended to the URL above with the values
554
+ provided below.
555
+ </p>
508
556
  </Tooltip.Content>
509
557
  </Tooltip>
510
558
  </span>{' '}
@@ -560,7 +608,10 @@ export default function DataImport() {
560
608
  <form
561
609
  onSubmit={e => {
562
610
  e.preventDefault()
563
- if (!config.filters[i].orderedValues || config.filters[i].orderedValues.indexOf(e.target[0].value) === -1) {
611
+ if (
612
+ !config.filters[i].orderedValues ||
613
+ config.filters[i].orderedValues.indexOf(e.target[0].value) === -1
614
+ ) {
564
615
  let newFilters = [...config.filters]
565
616
  newFilters[i].orderedValues = newFilters[i].orderedValues || []
566
617
  newFilters[i].orderedValues.push(e.target[0].value)
@@ -582,7 +633,12 @@ export default function DataImport() {
582
633
  <button
583
634
  className='btn full-width'
584
635
  onClick={() => {
585
- setConfig({ ...config, filters: config.filters ? [...config.filters, { type: 'url', key: Date.now() }] : [{ type: 'url', key: Date.now() }] })
636
+ setConfig({
637
+ ...config,
638
+ filters: config.filters
639
+ ? [...config.filters, { type: 'url', key: Date.now() }]
640
+ : [{ type: 'url', key: Date.now() }]
641
+ })
586
642
  }}
587
643
  >
588
644
  Add New URL Filter
@@ -604,7 +660,7 @@ export default function DataImport() {
604
660
  <th>Name</th>
605
661
  <th>Size</th>
606
662
  <th>Type</th>
607
- <th colSpan={4}>Actions</th>
663
+ <th colSpan={3}>Actions</th>
608
664
  </tr>
609
665
  </thead>
610
666
  <tbody>
@@ -613,18 +669,26 @@ export default function DataImport() {
613
669
  config.datasets[datasetKey].dataFileName && (
614
670
  <tr key={`tr-${datasetKey}`}>
615
671
  <td>
616
- <input className='dataset-name-input' type='text' defaultValue={datasetKey} onBlur={e => renameDataset(datasetKey, e.target.value)} />
672
+ <input
673
+ className='dataset-name-input'
674
+ type='text'
675
+ defaultValue={datasetKey}
676
+ onBlur={e => renameDataset(datasetKey, e.target.value)}
677
+ />
617
678
  </td>
618
- <td>{displaySize(config.datasets[datasetKey].dataFileSize)}</td>
619
- <td>{config.datasets[datasetKey].dataFileFormat}</td>
679
+ <td className='p-1'>{displaySize(config.datasets[datasetKey].dataFileSize)}</td>
680
+ <td className='p-1'>{config.datasets[datasetKey].dataFileFormat}</td>
620
681
  <td>
621
- <button className='btn btn-primary' onClick={() => setGlobalDatasetProp(datasetKey, 'preview', true)}>
622
- Preview Data
682
+ <button
683
+ className='btn btn-link p-1'
684
+ onClick={() => setGlobalDatasetProp(datasetKey, 'preview', true)}
685
+ >
686
+ Preview
623
687
  </button>
624
688
  </td>
625
689
  <td>
626
690
  <button
627
- className='btn btn-primary'
691
+ className='btn btn-link p-1'
628
692
  onClick={() => {
629
693
  if (editingDataset === datasetKey) {
630
694
  setEditingDataset(undefined)
@@ -632,16 +696,18 @@ export default function DataImport() {
632
696
  setKeepURL(false)
633
697
  } else {
634
698
  setEditingDataset(datasetKey)
635
- setExternalURL(config.datasets[datasetKey].dataUrl || config.datasets[datasetKey].dataFileName)
699
+ setExternalURL(
700
+ config.datasets[datasetKey].dataUrl || config.datasets[datasetKey].dataFileName
701
+ )
636
702
  setKeepURL(!!config.datasets[datasetKey].dataUrl)
637
703
  }
638
704
  }}
639
705
  >
640
- Edit Data
706
+ Edit
641
707
  </button>
642
708
  </td>
643
709
  <td>
644
- <button className='btn btn-primary' onClick={() => removeDataset(datasetKey)}>
710
+ <button className='btn btn-danger' onClick={() => removeDataset(datasetKey)}>
645
711
  X
646
712
  </button>
647
713
  </td>
@@ -661,7 +727,14 @@ export default function DataImport() {
661
727
  <div className='file-loaded-area'>
662
728
  {(config.dataFileSourceType === 'file' || !config.dataFileSourceType) && (
663
729
  <div className='data-source-options'>
664
- <div className={isDragActive2 ? 'drag-active cdcdataviz-file-selector loaded-file' : 'cdcdataviz-file-selector loaded-file'} {...getRootProps2()}>
730
+ <div
731
+ className={
732
+ isDragActive2
733
+ ? 'drag-active cdcdataviz-file-selector loaded-file'
734
+ : 'cdcdataviz-file-selector loaded-file'
735
+ }
736
+ {...getRootProps2()}
737
+ >
665
738
  <input {...getInputProps2()} />
666
739
  {isDragActive2 ? (
667
740
  <p>Drop file here</p>
@@ -688,7 +761,15 @@ export default function DataImport() {
688
761
  </>
689
762
  )}
690
763
 
691
- {showDataDesigner && <DataDesigner visualizationKey={null} configureData={configureData} updateDescriptionProp={(key, value) => updateDescriptionProp(configureData.dataFileName, key, value)} config={config} setConfig={setConfig} />}
764
+ {showDataDesigner && (
765
+ <DataDesigner
766
+ visualizationKey={null}
767
+ configureData={configureData}
768
+ updateDescriptionProp={(key, value) => updateDescriptionProp(configureData.dataFileName, key, value)}
769
+ config={config}
770
+ setConfig={setConfig}
771
+ />
772
+ )}
692
773
  </>
693
774
  )}
694
775
 
@@ -698,7 +779,10 @@ export default function DataImport() {
698
779
  <Tabs startingTab={editingDataset && config.datasets[editingDataset].dataFileSourceType === 'url' ? 1 : 0}>
699
780
  <TabPane title='Upload File' icon={<FileUploadIcon className='inline-icon' />}>
700
781
  {sharepath && <p className='alert--info'>The share path set for this website is: {sharepath}</p>}
701
- <div className={isDragActive ? 'drag-active cdcdataviz-file-selector' : 'cdcdataviz-file-selector'} {...getRootProps()}>
782
+ <div
783
+ className={isDragActive ? 'drag-active cdcdataviz-file-selector' : 'cdcdataviz-file-selector'}
784
+ {...getRootProps()}
785
+ >
702
786
  <input {...getInputProps()} />
703
787
  {isDragActive ? (
704
788
  <p>Drop file here</p>
@@ -720,7 +804,11 @@ export default function DataImport() {
720
804
  (Array.isArray(errors)
721
805
  ? errors.map((message, index) => (
722
806
  <div className='error-box slim mt-2' key={`error-${message}`}>
723
- <span>{message}</span> <CloseIcon className='inline-icon dismiss-error' onClick={() => setErrors(errors.filter((val, i) => i !== index))} />
807
+ <span>{message}</span>{' '}
808
+ <CloseIcon
809
+ className='inline-icon dismiss-error'
810
+ onClick={() => setErrors(errors.filter((val, i) => i !== index))}
811
+ />
724
812
  </div>
725
813
  ))
726
814
  : errors.message)}
@@ -733,22 +821,30 @@ export default function DataImport() {
733
821
  )}
734
822
 
735
823
  {config.type === 'dashboard' && !addingDataset && (
736
- <p>
824
+ <div className='mt-2'>
737
825
  <button className='btn btn-primary' onClick={() => setAddingDataset(true)}>
738
826
  + Add More Files
739
827
  </button>
740
- </p>
828
+ </div>
741
829
  )}
742
830
 
743
831
  {readyToConfigure && (
744
- <p>
745
- <button className='btn btn-primary' onClick={() => dispatch({ type: 'EDITOR_SET_GLOBALACTIVE', payload: 2 })}>
832
+ <div className='mt-2'>
833
+ <button
834
+ className='btn btn-primary'
835
+ onClick={() => dispatch({ type: 'EDITOR_SET_GLOBALACTIVE', payload: 2 })}
836
+ >
746
837
  Configure your visualization
747
838
  </button>
748
- </p>
839
+ </div>
749
840
  )}
750
841
 
751
- <a href='https://www.cdc.gov/wcms/4.0/cdc-wp/data-presentation/data-map.html' target='_blank' rel='noopener noreferrer' className='guidance-link'>
842
+ <a
843
+ href='https://www.cdc.gov/wcms/4.0/cdc-wp/data-presentation/data-map.html'
844
+ target='_blank'
845
+ rel='noopener noreferrer'
846
+ className='guidance-link'
847
+ >
752
848
  <div>
753
849
  <h3>Get Help</h3>
754
850
  <p>Documentation and examples on formatting data and configuring visualizations.</p>
@@ -1,13 +1,24 @@
1
1
  import React, { useState, useContext, useMemo, useCallback, useEffect, memo } from 'react'
2
- import { useTable, useBlockLayout, useGlobalFilter, useSortBy, useResizeColumns, usePagination } from 'react-table'
2
+ import {
3
+ useTable,
4
+ useBlockLayout,
5
+ useFlexLayout,
6
+ useGlobalFilter,
7
+ useSortBy,
8
+ useResizeColumns,
9
+ usePagination
10
+ } from 'react-table'
3
11
  import ConfigContext, { EditorDispatchContext } from '../ConfigContext'
4
12
  import { useDebounce } from 'use-debounce'
5
13
  import fetchRemoteData from '@cdc/core/helpers/fetchRemoteData'
14
+ import { MdNavigateNext } from 'react-icons/md'
15
+ import { GrFormPrevious } from 'react-icons/gr'
6
16
 
7
17
  // Core
8
18
  import validateFipsCodeLength from '@cdc/core/helpers/validateFipsCodeLength'
9
19
  import { errorMessages } from '../helpers/errorMessages'
10
20
  import { DataSet } from '@cdc/dashboard/src/types/DataSet'
21
+ import Icon from '@cdc/core/components/ui/Icon'
11
22
 
12
23
  const TableFilter = memo(({ globalFilter, setGlobalFilter, disabled = false }: any) => {
13
24
  const [filterValue, setFilterValue] = useState(globalFilter)
@@ -24,7 +35,16 @@ const TableFilter = memo(({ globalFilter, setGlobalFilter, disabled = false }: a
24
35
  setFilterValue(e.target.value)
25
36
  }
26
37
 
27
- return <input className='filter' value={filterValue} onChange={onChange} type='search' placeholder='Filter...' disabled={disabled} />
38
+ return (
39
+ <input
40
+ className='filter'
41
+ value={filterValue}
42
+ onChange={onChange}
43
+ type='search'
44
+ placeholder='Filter...'
45
+ disabled={disabled}
46
+ />
47
+ )
28
48
  })
29
49
 
30
50
  const Header = memo(({ globalFilter, data, setGlobalFilter }: any) => (
@@ -35,13 +55,28 @@ const Header = memo(({ globalFilter, data, setGlobalFilter }: any) => (
35
55
  ))
36
56
 
37
57
  const Footer = memo(({ previousPage, nextPage, canPreviousPage, canNextPage, pageNumber, totalPages }: any) => (
38
- <footer className='data-table-pagination'>
58
+ <footer className='data-table-pagination mt-2'>
39
59
  <ul>
40
60
  <li>
41
- <button onClick={() => previousPage()} className='btn btn-prev' disabled={!canPreviousPage} title='Previous Page'></button>
61
+ <button
62
+ onClick={() => previousPage()}
63
+ className='btn btn-prev display-flex align-items-center justify-content-center'
64
+ disabled={!canPreviousPage}
65
+ title='Previous Page'
66
+ >
67
+ {' '}
68
+ <GrFormPrevious />
69
+ </button>
42
70
  </li>
43
- <li>
44
- <button onClick={() => nextPage()} className='btn btn-next' disabled={!canNextPage} title='Next Page'></button>
71
+ <li className='mr-2'>
72
+ <button
73
+ onClick={() => nextPage()}
74
+ className='btn btn-next display-flex align-items-center justify-content-center'
75
+ disabled={!canNextPage}
76
+ title='Next Page'
77
+ >
78
+ <MdNavigateNext />
79
+ </button>
45
80
  </li>
46
81
  </ul>
47
82
  <span>
@@ -124,8 +159,7 @@ const PreviewDataTable = () => {
124
159
  const columnConfig = {
125
160
  id: `column-${columnName}`,
126
161
  accessor: row => row[columnName],
127
- Header: columnName,
128
- width: 250
162
+ Header: columnName
129
163
  }
130
164
 
131
165
  return columnConfig
@@ -167,7 +201,14 @@ const PreviewDataTable = () => {
167
201
  pageOptions,
168
202
  nextPage,
169
203
  previousPage
170
- } = useTable({ columns: tableColumns, data: tableData, initialState: { pageSize: 25 } }, useBlockLayout, useGlobalFilter, useSortBy, useResizeColumns, usePagination)
204
+ } = useTable(
205
+ { columns: tableColumns, data: tableData, initialState: { pageSize: 25 } },
206
+ useFlexLayout,
207
+ useGlobalFilter,
208
+ useSortBy,
209
+ useResizeColumns,
210
+ usePagination
211
+ )
171
212
 
172
213
  const PlaceholderTable = () => {
173
214
  return (
@@ -178,7 +219,7 @@ const PreviewDataTable = () => {
178
219
  <p>Import data to preview</p>
179
220
  </section>
180
221
  </section>
181
- <div className='table-container'>
222
+ <div className='table-container mt-2'>
182
223
  <table className='editor data-table' role='table'>
183
224
  <thead>
184
225
  <tr>
@@ -206,47 +247,58 @@ const PreviewDataTable = () => {
206
247
 
207
248
  if (!tableData) return [<Header key='header' />, <PlaceholderTable key='table' />]
208
249
 
209
- const footerProps = { previousPage, nextPage, canPreviousPage, canNextPage, pageNumber: pageIndex + 1, totalPages: pageOptions.length }
250
+ const footerProps = {
251
+ previousPage,
252
+ nextPage,
253
+ canPreviousPage,
254
+ canNextPage,
255
+ pageNumber: pageIndex + 1,
256
+ totalPages: pageOptions.length
257
+ }
210
258
 
211
259
  const Table = () => (
212
- <>
213
- <section className='data-table-container'>
214
- <div className='table-container'>
215
- <table className='data-table' {...getTableProps()} aria-hidden='true'>
216
- <thead>
217
- {headerGroups.map(headerGroup => (
218
- <tr {...headerGroup.getHeaderGroupProps()}>
219
- {headerGroup.headers.map(column => (
220
- <th scope='col' {...column.getHeaderProps(column.getSortByToggleProps())} className={column.isSorted ? (column.isSortedDesc ? 'sort sort-desc' : 'sort sort-asc') : ''} title={column.Header}>
221
- {column.render('Header')}
222
- <div {...column.getResizerProps()} className='resizer' />
223
- </th>
224
- ))}
225
- </tr>
260
+ <div className='table-responsive'>
261
+ <table className='mt-2 w-100 table table-striped data-table table-sm ' aria-hidden='true' {...getTableProps}>
262
+ <thead>
263
+ {headerGroups.map(headerGroup => (
264
+ <tr {...headerGroup.getHeaderGroupProps()}>
265
+ {headerGroup.headers.map(column => (
266
+ <th
267
+ scope='col'
268
+ {...column.getHeaderProps(column.getSortByToggleProps())}
269
+ className={column.isSorted ? (column.isSortedDesc ? 'sort sort-desc' : 'sort sort-asc') : ''}
270
+ title={column.Header}
271
+ >
272
+ {column.render('Header')}
273
+ <div {...column.getResizerProps()} className='resizer' />
274
+ </th>
226
275
  ))}
227
- </thead>
228
- <tbody {...getTableBodyProps()}>
229
- {page.map(row => {
230
- prepareRow(row)
231
- return (
232
- <tr {...row.getRowProps()}>
233
- {row.cells.map(cell => (
234
- <td {...cell.getCellProps()} title={cell.value}>
235
- {cell.render('Cell')}
236
- </td>
237
- ))}
238
- </tr>
239
- )
240
- })}
241
- </tbody>
242
- </table>
243
- </div>
244
- </section>
276
+ </tr>
277
+ ))}
278
+ </thead>
279
+ <tbody {...getTableBodyProps()}>
280
+ {page.map(row => {
281
+ prepareRow(row)
282
+ return (
283
+ <tr {...row.getRowProps()}>
284
+ {row.cells.map(cell => (
285
+ <td {...cell.getCellProps()} title={cell.value}>
286
+ {cell.render('Cell')}
287
+ </td>
288
+ ))}
289
+ </tr>
290
+ )
291
+ })}
292
+ </tbody>
293
+ </table>
245
294
  <Footer {...footerProps} />
246
- </>
295
+ </div>
247
296
  )
248
297
 
249
- return [<Header key='header' data={tableData} setGlobalFilter={setGlobalFilter} globalFilter={globalFilter} />, <Table key='table' />]
298
+ return [
299
+ <Header key='header' data={tableData} setGlobalFilter={setGlobalFilter} globalFilter={globalFilter} />,
300
+ <Table key='table' />
301
+ ]
250
302
  }
251
303
 
252
304
  export default PreviewDataTable
@@ -0,0 +1,2 @@
1
+ @import '@cdc/core/styles/base';
2
+ @import '@cdc/core/styles/variables';
package/src/index.jsx CHANGED
@@ -2,6 +2,7 @@ import React from 'react'
2
2
  import ReactDOM from 'react-dom/client'
3
3
 
4
4
  import CdcEditor from './CdcEditor'
5
+ import './coreStyles_editor.scss'
5
6
 
6
7
  // Allow URL query to preselect a tab in standalone mode
7
8
  const standaloneParams = new URLSearchParams(window.location.search)
@@ -1,5 +1,3 @@
1
- @import '@cdc/core/styles/variables';
2
-
3
1
  $xxs: 350px;
4
2
  $xs: 576px;
5
3
  $sm: 768px;
@@ -8,25 +8,31 @@
8
8
  ul + .heading-2 {
9
9
  margin-top: 1em;
10
10
  }
11
- .grid {
11
+ .visualization-grid {
12
12
  margin-top: 1em;
13
13
  list-style: none;
14
- display: flex;
15
- li {
16
- margin-right: 1rem;
17
- margin-bottom: 1rem;
18
- width: 165px;
14
+ display: grid;
15
+ &.category_general {
16
+ grid-template-columns: repeat(4, 180px);
19
17
  }
18
+ &.category_charts {
19
+ grid-template-columns: repeat(7, 180px);
20
+ grid-row-gap: 50px;
21
+ }
22
+ &.category_maps {
23
+ grid-template-columns: repeat(5, 180px);
24
+ }
25
+
20
26
  button {
21
27
  background-color: #fff;
22
- color: $baseColor;
28
+ color: var(--baseColor);
23
29
  border: solid 1px;
24
30
  border-color: rgb(199, 199, 199);
25
31
  padding: 1.3em $gbl-padding;
26
32
  height: 100%;
27
33
  align-items: center;
28
34
  display: flex;
29
- border: $lightGray 1px solid;
35
+ border: var(--lightGray) 1px solid;
30
36
  margin-right: 1em;
31
37
  cursor: pointer;
32
38
  transition: 0.1s all;