@cdc/waffle-chart 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.
@@ -1,81 +1,38 @@
1
- import React, { useState, useEffect, memo, useContext } from 'react'
2
- import cloneConfig from '@cdc/core/helpers/cloneConfig'
1
+ import React, { useEffect, memo, useContext } from 'react'
3
2
  import _ from 'lodash'
4
- import ErrorBoundary from '@cdc/core/components/ErrorBoundary'
5
3
 
6
4
  import ConfigContext from '../ConfigContext'
7
5
 
6
+ import { EditorPanel as BaseEditorPanel } from '@cdc/core/components/EditorPanel/EditorPanel'
7
+ import AdvancedEditor from '@cdc/core/components/AdvancedEditor'
8
8
  import Accordion from '@cdc/core/components/ui/Accordion'
9
9
  import Button from '@cdc/core/components/elements/Button'
10
10
  import Icon from '@cdc/core/components/ui/Icon'
11
11
  import Tooltip from '@cdc/core/components/ui/Tooltip'
12
- import InputText from '@cdc/core/components/inputs/InputText'
13
- import InputSelect from '@cdc/core/components/inputs/InputSelect'
14
- import InputCheckbox from '@cdc/core/components/inputs/InputCheckbox'
12
+ import { TextField, Select, CheckBox } from '@cdc/core/components/EditorPanel/Inputs'
15
13
  import { updateFieldFactory } from '@cdc/core/helpers/updateFieldFactory'
16
- import Layout from '@cdc/core/components/Layout'
14
+ import { useFilterManagement } from '@cdc/core/hooks/useFilterManagement'
15
+ import { useDataColumns } from '@cdc/core/hooks/useDataColumns'
16
+ import { VisualSection } from '@cdc/core/components/EditorPanel/sections/VisualSection'
17
17
 
18
18
  import '@cdc/core/styles/v2/components/editor.scss'
19
19
  import WarningImage from '../images/warning.svg'
20
20
 
21
21
  import { DATA_OPERATORS, DATA_FUNCTIONS } from '../CdcWaffleChart'
22
22
 
23
- const headerColors = [
24
- 'theme-blue',
25
- 'theme-purple',
26
- 'theme-brown',
27
- 'theme-teal',
28
- 'theme-pink',
29
- 'theme-orange',
30
- 'theme-slate',
31
- 'theme-indigo',
32
- 'theme-cyan',
33
- 'theme-green',
34
- 'theme-amber'
35
- ]
36
-
37
- const CheckBox = memo(
38
- ({ label, value, fieldName, section = null, subsection = null, tooltip, updateField, ...attributes }) => (
39
- <label className='checkbox'>
40
- <input
41
- type='checkbox'
42
- name={fieldName}
43
- checked={value}
44
- onChange={() => {
45
- updateField(section, subsection, fieldName, !value)
46
- }}
47
- {...attributes}
48
- />
49
- <span className='edit-label column-heading'>{label}</span>
50
- <span className='cove-icon'>{tooltip}</span>
51
- </label>
52
- )
53
- )
54
-
55
23
  const EditorPanel = memo(props => {
56
24
  const { config, updateConfig, loading, data, setParentConfig, isDashboard } = useContext(ConfigContext)
57
25
  const { showConfigConfirm } = props
58
- const [displayPanel, setDisplayPanel] = useState(true)
59
26
  const inputSelectStyle = condition => (condition ? { backgroundColor: '#ffd2d2', color: '#d8000c' } : {})
60
27
 
61
28
  const updateField = updateFieldFactory(config, updateConfig, true)
62
29
 
63
- useEffect(() => {
64
- // Pass up to Editor if needed
65
- if (setParentConfig) {
66
- const newConfig = convertStateToConfig()
67
- setParentConfig(newConfig)
68
- }
69
- // eslint-disable-next-line react-hooks/exhaustive-deps
70
- }, [config])
71
-
72
- useEffect(() => {
73
- if (!showConfigConfirm) {
74
- let newConfig = { ...config }
75
- delete newConfig.newViz
76
- updateConfig(newConfig)
77
- }
78
- }, [])
30
+ // Filters
31
+ const { addNewFilter, removeFilter, updateFilterProp, getFilterColumnValues } = useFilterManagement(
32
+ config,
33
+ updateConfig,
34
+ data
35
+ )
79
36
 
80
37
  useEffect(() => {
81
38
  //Verify comparate data type
@@ -93,111 +50,44 @@ const EditorPanel = memo(props => {
93
50
  }
94
51
  }, [config.dataConditionalOperator, config.dataConditionalComparate])
95
52
 
96
- const onBackClick = () => {
97
- setDisplayPanel(!displayPanel)
98
- updateConfig({
99
- ...config,
100
- showEditorPanel: !displayPanel
101
- })
102
-
103
- // if (isDashboard) {
104
- // updateConfig({ ...config, editing: false })
105
- // } else {
106
- // setDisplayPanel(!displayPanel)
107
- // }
108
- }
109
-
110
- const convertStateToConfig = () => {
111
- let strippedState = cloneConfig(config)
112
- delete strippedState.newViz
113
- delete strippedState.runtime
114
-
115
- return strippedState
116
- }
117
-
118
- const addNewFilter = () => {
119
- let filters = config.filters ? [...config.filters] : []
120
- filters.push({ values: [] })
121
- updateConfig({ ...config, filters })
122
- }
123
-
124
- const removeFilter = index => {
125
- let filters = [...config.filters]
126
- filters.splice(index, 1)
127
- updateConfig({ ...config, filters })
128
- }
129
-
130
- const updateFilterProp = (name, index, value) => {
131
- let filters = [...config.filters]
132
- filters[index][name] = value
133
- updateConfig({ ...config, filters })
134
- }
135
-
136
- const getColumns = (filter = true) => {
137
- let columns = {}
138
-
139
- data.map(row => Object.keys(row).forEach(columnName => (columns[columnName] = true)))
140
-
141
- return Object.keys(columns)
142
- }
143
-
144
- const getFilterColumnValues = index => {
145
- let filterDataOptions = []
146
- const filterColumnName = config.filters[index].columnName
147
- if (data && filterColumnName) {
148
- data.forEach(function (row) {
149
- if (undefined !== row[filterColumnName] && -1 === filterDataOptions.indexOf(row[filterColumnName])) {
150
- filterDataOptions.push(row[filterColumnName])
151
- }
152
- })
153
- filterDataOptions.sort()
154
- }
155
- return filterDataOptions
156
- }
53
+ // Extract column names from data with memoization (replaces getColumns)
54
+ const columns = useDataColumns(data)
157
55
  //visualizationType
158
56
 
159
- const approvedWaffleChartOptions = ['Waffle', 'Gauge']
57
+ const approvedWaffleChartOptions = [
58
+ { value: 'Waffle', label: 'Waffle' },
59
+ { value: 'TP5 Waffle', label: 'TP5 Style Waffle' },
60
+ { value: 'Gauge', label: 'Gauge' }
61
+ ]
160
62
 
161
63
  const editorContent = (
162
64
  <Accordion>
163
65
  <Accordion.Section title='General'>
164
- <div className='cove-accordion__panel-section'>
165
- <div style={{ width: '100%', display: 'block' }} className='cove-input-group'>
166
- <InputSelect
167
- value={config.visualizationType}
168
- fieldName='visualizationType'
169
- label='Chart Type'
170
- updateField={updateField}
171
- options={approvedWaffleChartOptions}
172
- className='cove-input'
173
- />
174
- {config.visualizationType === 'Gauge' && (
175
- <InputSelect
176
- value={config.visualizationSubType}
177
- fieldName='visualizationSubType'
178
- label='Chart Subtype'
179
- updateField={updateField}
180
- options={['Linear']}
181
- className='cove-input'
182
- />
183
- )}
184
- </div>
185
- </div>
186
- <InputText
66
+ <Select
67
+ value={config.visualizationType}
68
+ fieldName='visualizationType'
69
+ label='Chart Type'
70
+ updateField={updateField}
71
+ options={approvedWaffleChartOptions}
72
+ />
73
+ {config.visualizationType === 'Gauge' && (
74
+ <Select
75
+ value={config.visualizationSubType}
76
+ fieldName='visualizationSubType'
77
+ label='Chart Subtype'
78
+ updateField={updateField}
79
+ options={['Linear']}
80
+ />
81
+ )}
82
+ <TextField
187
83
  value={config.title}
188
84
  fieldName='title'
189
85
  label='Title'
190
86
  placeholder='Chart Title'
191
87
  updateField={updateField}
192
88
  />
193
- <InputCheckbox
194
- size='small'
195
- label='show title'
196
- value={config.showTitle}
197
- fieldName='showTitle'
198
- updateField={updateField}
199
- />
200
- <InputText
89
+ <CheckBox label='show title' value={config.showTitle} fieldName='showTitle' updateField={updateField} />
90
+ <TextField
201
91
  type='textarea'
202
92
  value={config.content}
203
93
  fieldName='content'
@@ -218,7 +108,7 @@ const EditorPanel = memo(props => {
218
108
  }
219
109
  />
220
110
 
221
- <InputText
111
+ <TextField
222
112
  value={config.subtext}
223
113
  fieldName='subtext'
224
114
  label='Subtext/Citation'
@@ -247,20 +137,19 @@ const EditorPanel = memo(props => {
247
137
  <h4 style={{ fontWeight: '600' }}>Numerator</h4>
248
138
  <div className='cove-accordion__panel-section'>
249
139
  <div className='cove-input-group'>
250
- <InputSelect
140
+ <Select
251
141
  style={inputSelectStyle(!config.dataColumn)}
252
142
  value={config.dataColumn || ''}
253
143
  fieldName='dataColumn'
254
144
  label='Data Column'
255
145
  updateField={updateField}
256
146
  initial='Select'
257
- options={getColumns()}
258
- className='cove-input'
147
+ options={columns}
259
148
  />
260
149
  </div>
261
150
 
262
151
  <div className='cove-input-group'>
263
- <InputSelect
152
+ <Select
264
153
  style={inputSelectStyle(!config.dataFunction)}
265
154
  value={config.dataFunction || ''}
266
155
  fieldName='dataFunction'
@@ -268,7 +157,6 @@ const EditorPanel = memo(props => {
268
157
  updateField={updateField}
269
158
  initial='Select'
270
159
  options={DATA_FUNCTIONS}
271
- className='cove-input'
272
160
  />
273
161
  </div>
274
162
 
@@ -278,27 +166,25 @@ const EditorPanel = memo(props => {
278
166
  </label>
279
167
  <div className='cove-accordion__panel-row cove-accordion__small-inputs'>
280
168
  <div className='cove-accordion__panel-col'>
281
- <InputSelect
169
+ <Select
282
170
  value={config.dataConditionalColumn || ''}
283
171
  fieldName='dataConditionalColumn'
284
172
  updateField={updateField}
285
173
  initial='Select'
286
- options={getColumns()}
287
- className='cove-input'
174
+ options={columns}
288
175
  />
289
176
  </div>
290
177
  <div className='cove-accordion__panel-col'>
291
- <InputSelect
178
+ <Select
292
179
  value={config.dataConditionalOperator || ''}
293
180
  fieldName='dataConditionalOperator'
294
181
  updateField={updateField}
295
182
  initial='Select'
296
183
  options={DATA_OPERATORS}
297
- className='cove-input'
298
184
  />
299
185
  </div>
300
186
  <div className='cove-accordion__panel-col'>
301
- <InputText
187
+ <TextField
302
188
  value={config.dataConditionalComparate}
303
189
  fieldName={'dataConditionalComparate'}
304
190
  updateField={updateField}
@@ -322,12 +208,7 @@ const EditorPanel = memo(props => {
322
208
  <div className='cove-accordion__panel-col'>
323
209
  <div style={{ display: 'flex', justifyContent: 'flex-end' }}>
324
210
  <label className='cove-accordion__panel-label--inline'>Select from data</label>
325
- <InputCheckbox
326
- size='small'
327
- value={config.customDenom}
328
- fieldName='customDenom'
329
- updateField={updateField}
330
- />
211
+ <CheckBox value={config.customDenom} fieldName='customDenom' updateField={updateField} />
331
212
  </div>
332
213
  </div>
333
214
  </div>
@@ -335,7 +216,7 @@ const EditorPanel = memo(props => {
335
216
  {!config.customDenom && (
336
217
  <div className='cove-accordion__panel-row align-center'>
337
218
  <div className='cove-accordion__panel-col'>
338
- <InputText value={config.dataDenom} fieldName='dataDenom' updateField={updateField} />
219
+ <TextField value={config.dataDenom} fieldName='dataDenom' updateField={updateField} />
339
220
  </div>
340
221
  <div className='cove-accordion__panel-col' style={{ display: 'flex', alignItems: 'center' }}>
341
222
  <label className='cove-accordion__panel-label--muted'>default (100)</label>
@@ -344,15 +225,15 @@ const EditorPanel = memo(props => {
344
225
  )}
345
226
  {config.customDenom && (
346
227
  <>
347
- <InputSelect
228
+ <Select
348
229
  value={config.dataDenomColumn || ''}
349
230
  fieldName='dataDenomColumn'
350
231
  label='Data Column'
351
232
  updateField={updateField}
352
233
  initial='Select'
353
- options={getColumns()}
234
+ options={columns}
354
235
  />
355
- <InputSelect
236
+ <Select
356
237
  value={config.dataDenomFunction || ''}
357
238
  fieldName='dataDenomFunction'
358
239
  label='Data Function'
@@ -366,13 +247,13 @@ const EditorPanel = memo(props => {
366
247
  <ul className='column-edit'>
367
248
  <li className='three-col'>
368
249
  <div style={{ marginRight: '1rem' }}>
369
- <InputText value={config.prefix} fieldName='prefix' label='Prefix' updateField={updateField} />
250
+ <TextField value={config.prefix} fieldName='prefix' label='Prefix' updateField={updateField} />
370
251
  </div>
371
252
  <div style={{ marginRight: '1rem' }}>
372
- <InputText value={config.suffix} fieldName='suffix' label='Suffix' updateField={updateField} />
253
+ <TextField value={config.suffix} fieldName='suffix' label='Suffix' updateField={updateField} />
373
254
  </div>
374
255
  <div>
375
- <InputText
256
+ <TextField
376
257
  type='number'
377
258
  value={config.roundToPlace}
378
259
  fieldName='roundToPlace'
@@ -386,25 +267,19 @@ const EditorPanel = memo(props => {
386
267
  <>
387
268
  <hr className='cove-accordion__divider' />
388
269
  <div className='cove-accordion__panel-section reverse-labels'>
389
- <InputText
390
- inline
391
- size='small'
270
+ <TextField
392
271
  value={config.valueDescription}
393
272
  label='Value Descriptor'
394
273
  fieldName='valueDescription'
395
274
  updateField={updateField}
396
275
  />
397
- <InputCheckbox
398
- inline
399
- size='small'
276
+ <CheckBox
400
277
  value={config.showPercent}
401
278
  label='Show Percentage'
402
279
  fieldName='showPercent'
403
280
  updateField={updateField}
404
281
  />
405
- <InputCheckbox
406
- inline
407
- size='small'
282
+ <CheckBox
408
283
  label='Show Denominator'
409
284
  value={config.showDenominator}
410
285
  fieldName='showDenominator'
@@ -414,18 +289,20 @@ const EditorPanel = memo(props => {
414
289
  </>
415
290
  )}
416
291
  <label style={{ marginBottom: '1rem' }}>
417
- <span className='edit-label'>Data Point Filters</span>
418
- <Tooltip style={{ textTransform: 'none' }}>
419
- <Tooltip.Target>
420
- <Icon display='question' style={{ marginLeft: '0.5rem' }} />
421
- </Tooltip.Target>
422
- <Tooltip.Content>
423
- <p>
424
- To refine the highlighted data point, specify one or more filters (e.g., "Male" and "Female" for a
425
- column called "Sex").
426
- </p>
427
- </Tooltip.Content>
428
- </Tooltip>
292
+ <span className='edit-label'>
293
+ Data Point Filters
294
+ <Tooltip style={{ textTransform: 'none' }}>
295
+ <Tooltip.Target>
296
+ <Icon display='question' style={{ marginLeft: '0.5rem' }} />
297
+ </Tooltip.Target>
298
+ <Tooltip.Content>
299
+ <p>
300
+ To refine the highlighted data point, specify one or more filters (e.g., "Male" and "Female" for a
301
+ column called "Sex").
302
+ </p>
303
+ </Tooltip.Content>
304
+ </Tooltip>
305
+ </span>
429
306
  </label>
430
307
 
431
308
  {config.filters && (
@@ -441,38 +318,24 @@ const EditorPanel = memo(props => {
441
318
  >
442
319
  Remove
443
320
  </button>
444
- <label>
445
- <span className='edit-label column-heading'>Column</span>
446
- <select
447
- value={filter.columnName}
448
- onChange={e => {
449
- updateFilterProp('columnName', index, e.target.value)
450
- }}
451
- >
452
- <option value=''>- Select Option -</option>
453
- {getColumns().map((dataKey, index) => (
454
- <option value={dataKey} key={index}>
455
- {dataKey}
456
- </option>
457
- ))}
458
- </select>
459
- </label>
460
- <label>
461
- <span className='edit-label column-heading'>Column Value</span>
462
- <select
463
- value={filter.columnValue}
464
- onChange={e => {
465
- updateFilterProp('columnValue', index, e.target.value)
466
- }}
467
- >
468
- <option value=''>- Select Option -</option>
469
- {getFilterColumnValues(index).map((dataKey, index) => (
470
- <option value={dataKey} key={index}>
471
- {dataKey}
472
- </option>
473
- ))}
474
- </select>
475
- </label>
321
+ <Select
322
+ label='Column'
323
+ value={filter.columnName || ''}
324
+ options={columns}
325
+ initial='- Select Option -'
326
+ onChange={e => {
327
+ updateFilterProp('columnName', index, e.target.value)
328
+ }}
329
+ />
330
+ <Select
331
+ label='Column Value'
332
+ value={filter.columnValue || ''}
333
+ options={getFilterColumnValues(index)}
334
+ initial='- Select Option -'
335
+ onChange={e => {
336
+ updateFilterProp('columnValue', index, e.target.value)
337
+ }}
338
+ />
476
339
  </fieldset>
477
340
  ))}
478
341
  </ul>
@@ -481,160 +344,120 @@ const EditorPanel = memo(props => {
481
344
  Add Filter
482
345
  </Button>
483
346
  </Accordion.Section>
484
- <Accordion.Section title='Visual'>
347
+ <Accordion.Section title='Chart Settings'>
485
348
  {config.visualizationType !== 'Gauge' && (
486
- <InputSelect
349
+ <Select
487
350
  value={config.shape}
488
351
  fieldName='shape'
489
352
  label='Shape'
490
353
  updateField={updateField}
491
354
  options={['circle', 'square', 'person']}
492
- className='cove-input'
493
355
  />
494
356
  )}
495
- {config.visualizationType !== 'Gauge' && (
496
- <div
497
- className='cove-accordion__panel-row cove-accordion__small-inputs'
498
- style={{ marginTop: '1rem', marginBottom: '1rem' }}
499
- >
500
- <div className='cove-accordion__panel-col'>
501
- <InputText
502
- type='number'
503
- value={config.nodeWidth}
504
- fieldName='nodeWidth'
505
- label='Width'
506
- updateField={updateField}
507
- />
357
+ {config.visualizationType !== 'Gauge' && config.visualizationType !== 'TP5 Waffle' && (
358
+ <>
359
+ <div
360
+ className='cove-accordion__panel-row cove-accordion__small-inputs'
361
+ style={{ marginTop: '1rem', marginBottom: '1rem' }}
362
+ >
363
+ <div className='cove-accordion__panel-col'>
364
+ <TextField
365
+ type='number'
366
+ value={config.nodeWidth}
367
+ fieldName='nodeWidth'
368
+ label='Width'
369
+ updateField={updateField}
370
+ />
371
+ </div>
372
+ <div className='cove-accordion__panel-col'>
373
+ <TextField
374
+ type='number'
375
+ value={config.nodeSpacer}
376
+ fieldName='nodeSpacer'
377
+ label='Spacer'
378
+ updateField={updateField}
379
+ />
380
+ </div>
508
381
  </div>
509
- <div className='cove-accordion__panel-col'>
510
- <InputText
511
- type='number'
512
- value={config.nodeSpacer}
513
- fieldName='nodeSpacer'
514
- label='Spacer'
382
+
383
+ <div className='cove-input-group'>
384
+ <Select
385
+ value={config.orientation}
386
+ fieldName='orientation'
387
+ label='Layout'
515
388
  updateField={updateField}
389
+ options={['horizontal', 'vertical']}
516
390
  />
517
391
  </div>
518
- </div>
519
- )}
520
392
 
521
- <div className='cove-input-group'>
522
- {config.visualizationType !== 'Gauge' && (
523
- <InputSelect
524
- value={config.orientation}
525
- fieldName='orientation'
526
- label='Layout'
527
- updateField={updateField}
528
- className='cove-input'
529
- options={['horizontal', 'vertical']}
530
- />
531
- )}
532
- </div>
533
-
534
- <div className='cove-input-group'>
535
- <label>
536
- <span className='edit-label column-heading cove-input__label'>Data Point Font Size</span>
537
- </label>
538
- <div className='cove-accordion__panel-row cove-accordion__small-inputs align-center'>
539
- <div className='cove-accordion__panel-col'>
540
- <InputText type='number' value={config.fontSize} fieldName='fontSize' updateField={updateField} />
541
- </div>
542
- <div className='cove-accordion__panel-col' style={{ display: 'flex', alignItems: 'center' }}>
543
- <label className='accordion__panel-label--muted'> default (50px)</label>
393
+ <div className='cove-input-group'>
394
+ <label>
395
+ <span className='edit-label column-heading cove-input__label'>Data Point Font Size</span>
396
+ </label>
397
+ <div className='cove-accordion__panel-row cove-accordion__small-inputs align-center'>
398
+ <div className='cove-accordion__panel-col'>
399
+ <TextField type='number' value={config.fontSize} fieldName='fontSize' updateField={updateField} />
400
+ </div>
401
+ <div className='cove-accordion__panel-col' style={{ display: 'flex', alignItems: 'center' }}>
402
+ <label className='accordion__panel-label--muted'> default (50px)</label>
403
+ </div>
404
+ </div>
544
405
  </div>
545
- </div>
546
- </div>
547
-
548
- <InputSelect
549
- value={config.overallFontSize}
550
- fieldName='overallFontSize'
551
- label='Overall Font Size'
552
- updateField={updateField}
553
- options={['small', 'medium', 'large']}
554
- className='cove-input'
555
- />
556
-
557
- <label>
558
- <span className='edit-label cove-input__label'>Theme</span>
559
- <ul className='color-palette'>
560
- {headerColors.map(palette => (
561
- <li
562
- title={palette}
563
- key={palette}
564
- onClick={() => {
565
- updateConfig({ ...config, theme: palette })
566
- }}
567
- className={config.theme === palette ? 'selected ' + palette : palette}
568
- ></li>
569
- ))}
570
- </ul>
571
- </label>
406
+ </>
407
+ )}
408
+ </Accordion.Section>
572
409
 
573
- <div className='cove-accordion__panel-section reverse-labels'>
574
- <InputCheckbox
575
- inline
576
- size='small'
577
- value={config.visual.border}
410
+ {/* Visual section for TP5 style */}
411
+ {config.visualizationType === 'TP5 Waffle' && (
412
+ <Accordion.Section title='Visual'>
413
+ <CheckBox
414
+ value={config.visual?.whiteBackground}
578
415
  section='visual'
579
- fieldName='border'
580
- label='Display Border'
416
+ fieldName='whiteBackground'
417
+ label='Use White Background Style'
581
418
  updateField={updateField}
582
419
  />
583
- <InputCheckbox
584
- inline
585
- size='small'
586
- value={config.visual.borderColorTheme}
587
- section='visual'
588
- fieldName='borderColorTheme'
589
- label='Use theme border color'
590
- updateField={updateField}
591
- />
592
- <InputCheckbox
593
- size='small'
594
- value={config.visual.accent}
595
- section='visual'
596
- fieldName='accent'
597
- label='Use Accent Style'
598
- updateField={updateField}
599
- />
600
- <InputCheckbox
601
- size='small'
602
- value={config.visual.background}
603
- section='visual'
604
- fieldName='background'
605
- label='Use Theme Background Color'
606
- updateField={updateField}
607
- />
608
- <InputCheckbox
609
- size='small'
610
- value={config.visual.hideBackgroundColor}
611
- section='visual'
612
- fieldName='hideBackgroundColor'
613
- label='Hide Background Color'
420
+ </Accordion.Section>
421
+ )}
422
+
423
+ {/* Visual section for other styles */}
424
+ {config.visualizationType !== 'TP5 Waffle' && (
425
+ <Accordion.Section title='Visual'>
426
+ <VisualSection
427
+ config={config}
614
428
  updateField={updateField}
429
+ updateConfig={updateConfig}
430
+ beforeCheckboxes={
431
+ <Select
432
+ value={config.overallFontSize}
433
+ fieldName='overallFontSize'
434
+ label='Overall Font Size'
435
+ updateField={updateField}
436
+ options={['small', 'medium', 'large']}
437
+ />
438
+ }
615
439
  />
616
- </div>
617
- </Accordion.Section>
440
+ </Accordion.Section>
441
+ )}
618
442
  </Accordion>
619
443
  )
620
444
 
621
- if (loading) return null
622
-
623
445
  return (
624
- <ErrorBoundary component='EditorPanel'>
625
- <>
626
- <Layout.Sidebar
627
- displayPanel={displayPanel}
628
- onBackClick={onBackClick}
629
- isDashboard={isDashboard}
630
- title='Configure Waffle Chart'
631
- showEditorPanel={displayPanel}
632
- >
446
+ <BaseEditorPanel
447
+ config={config}
448
+ updateConfig={updateConfig}
449
+ loading={loading}
450
+ setParentConfig={setParentConfig}
451
+ isDashboard={isDashboard}
452
+ title='Configure Waffle Chart'
453
+ >
454
+ {({ convertStateToConfig }) => (
455
+ <>
633
456
  {editorContent}
634
- </Layout.Sidebar>
635
- {props.children}
636
- </>
637
- </ErrorBoundary>
457
+ <AdvancedEditor loadConfig={updateConfig} config={config} convertStateToConfig={convertStateToConfig} />
458
+ </>
459
+ )}
460
+ </BaseEditorPanel>
638
461
  )
639
462
  })
640
463