@cdc/editor 4.23.5 → 4.23.6

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdc/editor",
3
- "version": "4.23.5",
3
+ "version": "4.23.6",
4
4
  "description": "React component for generating a new component entry",
5
5
  "moduleName": "CdcEditor",
6
6
  "main": "dist/cdceditor",
@@ -24,13 +24,13 @@
24
24
  },
25
25
  "license": "Apache-2.0",
26
26
  "dependencies": {
27
- "@cdc/chart": "^4.23.5",
28
- "@cdc/core": "^4.23.5",
29
- "@cdc/dashboard": "^4.23.5",
30
- "@cdc/data-bite": "^4.23.5",
31
- "@cdc/map": "^4.23.5",
32
- "@cdc/markup-include": "^4.23.5",
33
- "@cdc/waffle-chart": "^4.23.5",
27
+ "@cdc/chart": "^4.23.6",
28
+ "@cdc/core": "^4.23.6",
29
+ "@cdc/dashboard": "^4.23.6",
30
+ "@cdc/data-bite": "^4.23.6",
31
+ "@cdc/map": "^4.23.6",
32
+ "@cdc/markup-include": "^4.23.6",
33
+ "@cdc/waffle-chart": "^4.23.6",
34
34
  "axios": "^0.21.1",
35
35
  "d3": "^7.0.0",
36
36
  "html-react-parser": "^3.0.8",
@@ -43,5 +43,5 @@
43
43
  "react": "^18.2.0",
44
44
  "react-dom": "^18.2.0"
45
45
  },
46
- "gitHead": "34add3436994ca3cf13e51f313add4d70377f53e"
46
+ "gitHead": "aaed0388b487adfeb3e7e278b4ce74df09cbaade"
47
47
  }
@@ -19,6 +19,8 @@ import HorizontalStackIcon from '@cdc/core/assets/icon-chart-bar-stacked.svg'
19
19
  import ScatterPlotIcon from '@cdc/core/assets/icon-chart-scatterplot.svg'
20
20
  import BoxPlotIcon from '@cdc/core/assets/icon-chart-box-whisker.svg'
21
21
  import AreaChartIcon from '@cdc/core/assets/icon-area-chart.svg'
22
+ import GaugeChartIcon from '@cdc/core/assets/icon-linear-gauge.svg'
23
+ import InfoIcon from '@cdc/core/assets/icon-info.svg'
22
24
 
23
25
  export default function ChooseTab() {
24
26
  const { config, setConfig, setGlobalActive, tempConfig, setTempConfig } = useContext(ConfigContext)
@@ -37,18 +39,16 @@ export default function ChooseTab() {
37
39
  let isSubType = false
38
40
  let isHorizontalStackedChart = false
39
41
  let classNames
40
-
41
42
  if (type === 'map' && config.general) {
42
43
  let geoType = config.general.geoType
43
44
  isSubType = subType === geoType
44
45
  }
45
-
46
46
  if (type === 'chart') {
47
47
  isSubType = subType === config.visualizationType
48
48
  isHorizontalStackedChart = orientation === config.orientation && stacked === true
49
49
  }
50
50
 
51
- if (type === 'dashboard' || type === 'data-bite' || type === 'waffle-chart' || type === 'markup-include') isSubType = true
51
+ if (type === 'dashboard' || type === 'data-bite' || type === 'markup-include') isSubType = true
52
52
 
53
53
  // TODO: sorry, we should refactor this at some point.
54
54
  // trying to get this out for 4.22.5 - this is so stacked horizontal and bar charts aren't highlighted at the same time.
@@ -137,11 +137,19 @@ export default function ChooseTab() {
137
137
  <li>
138
138
  <Tooltip>
139
139
  <Tooltip.Target>
140
- <IconButton label='Waffle Chart' type='waffle-chart' icon={<WaffleChartIcon />} />
140
+ <IconButton label='Waffle Chart' type='chart' subType='Waffle' icon={<WaffleChartIcon />} />
141
141
  </Tooltip.Target>
142
142
  <Tooltip.Content>Highlight a piece of data in relationship to a data set.</Tooltip.Content>
143
143
  </Tooltip>
144
144
  </li>
145
+ {/* <li>
146
+ <Tooltip>
147
+ <Tooltip.Target>
148
+ <IconButton label='Gauge Chart' type='chart' subType='Gauge' icon={<GaugeChartIcon />} />
149
+ </Tooltip.Target>
150
+ <Tooltip.Content>Specify the calculation of a single data point (such as a percentage value) and present it on a horizontal scale.</Tooltip.Content>
151
+ </Tooltip>
152
+ </li> */}
145
153
  </ul>
146
154
 
147
155
  <div className='heading-2'>Charts</div>
@@ -214,6 +222,14 @@ export default function ChooseTab() {
214
222
  <Tooltip.Content>Display an area chart</Tooltip.Content>
215
223
  </Tooltip>
216
224
  </li>
225
+ {/* <li>
226
+ <Tooltip>
227
+ <Tooltip.Target>
228
+ <IconButton label='Forecast Chart' type='chart' subType='Forecasting' orientation='vertical' icon={<InfoIcon />} />
229
+ </Tooltip.Target>
230
+ <Tooltip.Content>Display a forecasting chart</Tooltip.Content>
231
+ </Tooltip>
232
+ </li> */}
217
233
  </ul>
218
234
 
219
235
  <div className='heading-2'>Maps</div>
@@ -25,11 +25,19 @@ export default function ConfigureTab({ containerEl }) {
25
25
  </ErrorBoundary>
26
26
  )
27
27
  case 'chart':
28
- return (
29
- <ErrorBoundary component='CdcChart'>
30
- <CdcChart isEditor={true} isDebug={isDebug} config={config} setConfig={setTempConfig} />
31
- </ErrorBoundary>
32
- )
28
+ if (config.visualizationType === 'Waffle' || config.visualizationType === 'Gauge') {
29
+ return (
30
+ <ErrorBoundary component='CdcWaffleChart'>
31
+ <CdcWaffleChart isEditor={true} isDebug={isDebug} config={config} setConfig={setTempConfig} />
32
+ </ErrorBoundary>
33
+ )
34
+ } else {
35
+ return (
36
+ <ErrorBoundary component='CdcChart'>
37
+ <CdcChart isEditor={true} isDebug={isDebug} config={config} setConfig={setTempConfig} />
38
+ </ErrorBoundary>
39
+ )
40
+ }
33
41
  case 'dashboard':
34
42
  return (
35
43
  <ErrorBoundary component='CdcDashboard'>
@@ -42,12 +50,6 @@ export default function ConfigureTab({ containerEl }) {
42
50
  <CdcDataBite isEditor={true} isDebug={isDebug} config={config} setConfig={setTempConfig} />
43
51
  </ErrorBoundary>
44
52
  )
45
- case 'waffle-chart':
46
- return (
47
- <ErrorBoundary component='CdcDashboard'>
48
- <CdcWaffleChart isEditor={true} isDebug={isDebug} config={config} setConfig={setTempConfig} />
49
- </ErrorBoundary>
50
- )
51
53
  case 'markup-include':
52
54
  return (
53
55
  <ErrorBoundary component='CdcDashboard'>
@@ -209,7 +209,6 @@ export default function DataImport() {
209
209
  // Validate parsed data and set if no issues.
210
210
  try {
211
211
  text = transform.autoStandardize(text)
212
-
213
212
  if (config.data && config.series) {
214
213
  if (dataExists(text, config.series, config?.xAxis.dataKey)) {
215
214
  if (config.type === 'dashboard') {
@@ -262,7 +261,6 @@ export default function DataImport() {
262
261
  } else {
263
262
  if (config.type === 'dashboard') {
264
263
  let newDatasets = { ...config.datasets }
265
-
266
264
  Object.keys(newDatasets).forEach(datasetKey => (newDatasets[datasetKey].preview = false))
267
265
 
268
266
  newDatasets[editingDatasetKey || fileSource] = {
@@ -10,6 +10,7 @@ import validScatterPlot from './../samples/valid-scatterplot.csv?raw'
10
10
  import validBoxPlotData from './../samples/valid-boxplot.csv?raw'
11
11
  import validAreaChart from './../samples/valid-area-chart.json?raw'
12
12
  import validWorldGeocodeData from './../samples/valid-world-geocode.json?raw'
13
+ import validForecastData from './../samples/valid-forecast-data.csv?raw'
13
14
 
14
15
  // Add additional data to samples
15
16
  const sampleData = {
@@ -34,6 +35,11 @@ const sampleData = {
34
35
  fileName: 'valid-area-chart.json',
35
36
  data: validAreaChart
36
37
  }
38
+ // {
39
+ // text: 'Forecast Chart Data',
40
+ // fileName: 'valid-forecast-data.csv',
41
+ // data: validForecastData
42
+ // }
37
43
  ],
38
44
  maps: [
39
45
  {