@cdc/waffle-chart 4.22.10 → 4.23.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.
@@ -16,27 +16,29 @@ import '@cdc/core/styles/v2/components/editor.scss'
16
16
 
17
17
  import { DATA_OPERATORS, DATA_FUNCTIONS } from '../CdcWaffleChart'
18
18
 
19
- const headerColors = [ 'theme-blue', 'theme-purple', 'theme-brown', 'theme-teal', 'theme-pink', 'theme-orange', 'theme-slate', 'theme-indigo', 'theme-cyan', 'theme-green', 'theme-amber' ]
19
+ const headerColors = ['theme-blue', 'theme-purple', 'theme-brown', 'theme-teal', 'theme-pink', 'theme-orange', 'theme-slate', 'theme-indigo', 'theme-cyan', 'theme-green', 'theme-amber']
20
20
 
21
21
  const CheckBox = memo(({ label, value, fieldName, section = null, subsection = null, tooltip, updateField, ...attributes }) => (
22
- <label className="checkbox">
23
- <input type="checkbox" name={fieldName} checked={value} onChange={() => { updateField(section, subsection, fieldName, !value) }} {...attributes} />
24
- <span className="edit-label column-heading">{label}</span><span className="cove-icon">{tooltip}</span>
22
+ <label className='checkbox'>
23
+ <input
24
+ type='checkbox'
25
+ name={fieldName}
26
+ checked={value}
27
+ onChange={() => {
28
+ updateField(section, subsection, fieldName, !value)
29
+ }}
30
+ {...attributes}
31
+ />
32
+ <span className='edit-label column-heading'>{label}</span>
33
+ <span className='cove-icon'>{tooltip}</span>
25
34
  </label>
26
35
  ))
27
36
 
28
- const EditorPanel = memo((props) => {
29
- const {
30
- config,
31
- updateConfig,
32
- loading,
33
- data,
34
- setParentConfig,
35
- isDashboard
36
- } = useContext(ConfigContext)
37
+ const EditorPanel = memo(props => {
38
+ const { config, updateConfig, loading, data, setParentConfig, isDashboard } = useContext(ConfigContext)
37
39
 
38
- const [ displayPanel, setDisplayPanel ] = useState(true)
39
- const [ showConfigConfirm, setShowConfigConfirm ] = useState(false)
40
+ const [displayPanel, setDisplayPanel] = useState(true)
41
+ const [showConfigConfirm, setShowConfigConfirm] = useState(false)
40
42
 
41
43
  const updateField = (section, subsection, fieldName, newValue) => {
42
44
  // Top level
@@ -53,11 +55,11 @@ const EditorPanel = memo((props) => {
53
55
 
54
56
  const isArray = Array.isArray(config[section])
55
57
 
56
- let sectionValue = isArray ? [ ...config[section], newValue ] : { ...config[section], [fieldName]: newValue }
58
+ let sectionValue = isArray ? [...config[section], newValue] : { ...config[section], [fieldName]: newValue }
57
59
 
58
60
  if (null !== subsection) {
59
61
  if (isArray) {
60
- sectionValue = [ ...config[section] ]
62
+ sectionValue = [...config[section]]
61
63
  sectionValue[subsection] = { ...sectionValue[subsection], [fieldName]: newValue }
62
64
  } else if (typeof newValue === 'string') {
63
65
  sectionValue[subsection] = newValue
@@ -71,16 +73,15 @@ const EditorPanel = memo((props) => {
71
73
  }
72
74
 
73
75
  useEffect(() => {
74
-
75
76
  // Pass up to Editor if needed
76
77
  if (setParentConfig) {
77
78
  const newConfig = convertStateToConfig()
78
79
  setParentConfig(newConfig)
79
80
  }
80
81
  // eslint-disable-next-line react-hooks/exhaustive-deps
81
- }, [ config ])
82
+ }, [config])
82
83
 
83
- useEffect(()=> {
84
+ useEffect(() => {
84
85
  if (!showConfigConfirm) {
85
86
  let newConfig = { ...config }
86
87
  delete newConfig.newViz
@@ -90,7 +91,7 @@ const EditorPanel = memo((props) => {
90
91
 
91
92
  useEffect(() => {
92
93
  //Verify comparate data type
93
- let operators = [ '<', '>', '<=', '>=' ]
94
+ let operators = ['<', '>', '<=', '>=']
94
95
  if (config.dataConditionalComparate !== '') {
95
96
  if (operators.indexOf(config.dataConditionalOperator) > -1 && isNaN(config.dataConditionalComparate)) {
96
97
  updateConfig({ ...config, invalidComparate: true })
@@ -102,7 +103,7 @@ const EditorPanel = memo((props) => {
102
103
  } else {
103
104
  updateConfig({ ...config, invalidComparate: false })
104
105
  }
105
- }, [ config.dataConditionalOperator, config.dataConditionalComparate ])
106
+ }, [config.dataConditionalOperator, config.dataConditionalComparate])
106
107
 
107
108
  const onBackClick = () => {
108
109
  setDisplayPanel(!displayPanel)
@@ -116,8 +117,8 @@ const EditorPanel = memo((props) => {
116
117
 
117
118
  const Error = () => {
118
119
  return (
119
- <section className="waiting">
120
- <section className="waiting-container">
120
+ <section className='waiting'>
121
+ <section className='waiting-container'>
121
122
  <h3>Error With Configuration</h3>
122
123
  <p>{config.runtime.editorErrorMessage}</p>
123
124
  </section>
@@ -126,7 +127,7 @@ const EditorPanel = memo((props) => {
126
127
  }
127
128
 
128
129
  const Confirm = () => {
129
- const confirmDone = (e) => {
130
+ const confirmDone = e => {
130
131
  e.preventDefault()
131
132
  let newConfig = { ...config }
132
133
  delete newConfig.newViz
@@ -134,11 +135,13 @@ const EditorPanel = memo((props) => {
134
135
  }
135
136
 
136
137
  return (
137
- <section className="waiting">
138
- <section className="waiting-container">
138
+ <section className='waiting'>
139
+ <section className='waiting-container'>
139
140
  <h3>Finish Configuring</h3>
140
141
  <p>Set all required options to the left and confirm below to display a preview of the chart.</p>
141
- <button className="btn" style={{ margin: '1em auto' }} onClick={confirmDone}>I'm Done</button>
142
+ <button className='btn' style={{ margin: '1em auto' }} onClick={confirmDone}>
143
+ I'm Done
144
+ </button>
142
145
  </section>
143
146
  </section>
144
147
  )
@@ -153,19 +156,19 @@ const EditorPanel = memo((props) => {
153
156
  }
154
157
 
155
158
  const addNewFilter = () => {
156
- let filters = config.filters ? [ ...config.filters ] : []
159
+ let filters = config.filters ? [...config.filters] : []
157
160
  filters.push({ values: [] })
158
161
  updateConfig({ ...config, filters })
159
162
  }
160
163
 
161
- const removeFilter = (index) => {
162
- let filters = [ ...config.filters ]
164
+ const removeFilter = index => {
165
+ let filters = [...config.filters]
163
166
  filters.splice(index, 1)
164
167
  updateConfig({ ...config, filters })
165
168
  }
166
169
 
167
170
  const updateFilterProp = (name, index, value) => {
168
- let filters = [ ...config.filters ]
171
+ let filters = [...config.filters]
169
172
  filters[index][name] = value
170
173
  updateConfig({ ...config, filters })
171
174
  }
@@ -173,12 +176,12 @@ const EditorPanel = memo((props) => {
173
176
  const getColumns = (filter = true) => {
174
177
  let columns = {}
175
178
 
176
- data.map(row => Object.keys(row).forEach(columnName => columns[columnName] = true))
179
+ data.map(row => Object.keys(row).forEach(columnName => (columns[columnName] = true)))
177
180
 
178
181
  return Object.keys(columns)
179
182
  }
180
183
 
181
- const getFilterColumnValues = (index) => {
184
+ const getFilterColumnValues = index => {
182
185
  let filterDataOptions = []
183
186
  const filterColumnName = config.filters[index].columnName
184
187
  if (data && filterColumnName) {
@@ -194,31 +197,22 @@ const EditorPanel = memo((props) => {
194
197
 
195
198
  const editorContent = (
196
199
  <Accordion>
197
- <Accordion.Section title="General">
198
- <InputText
199
- value={config.title}
200
- fieldName="title"
201
- label="Title"
202
- placeholder="Waffle Chart Title"
203
- updateField={updateField}
204
- />
200
+ <Accordion.Section title='General'>
201
+ <InputText value={config.title} fieldName='title' label='Title' placeholder='Waffle Chart Title' updateField={updateField} />
205
202
 
206
203
  <InputText
207
- type="textarea"
204
+ type='textarea'
208
205
  value={config.content}
209
- fieldName="content"
210
- label="Message"
206
+ fieldName='content'
207
+ label='Message'
211
208
  updateField={updateField}
212
209
  tooltip={
213
- <Tooltip style={{ textTransform: "none" }}>
210
+ <Tooltip style={{ textTransform: 'none' }}>
214
211
  <Tooltip.Target>
215
- <Icon display="question" style={{ marginLeft: "0.5rem" }} />
212
+ <Icon display='question' style={{ marginLeft: '0.5rem' }} />
216
213
  </Tooltip.Target>
217
214
  <Tooltip.Content>
218
- <p>
219
- Enter the message text for the visualization. The following
220
- HTML tags are supported: strong, em, sup, and sub.
221
- </p>
215
+ <p>Enter the message text for the visualization. The following HTML tags are supported: strong, em, sup, and sub.</p>
222
216
  </Tooltip.Content>
223
217
  </Tooltip>
224
218
  }
@@ -226,228 +220,130 @@ const EditorPanel = memo((props) => {
226
220
 
227
221
  <InputText
228
222
  value={config.subtext}
229
- fieldName="subtext"
230
- label="Subtext/Citation"
231
- placeholder="Waffle Chart Subtext or Citation"
223
+ fieldName='subtext'
224
+ label='Subtext/Citation'
225
+ placeholder='Waffle Chart Subtext or Citation'
232
226
  updateField={updateField}
233
227
  tooltip={
234
- <Tooltip style={{ textTransform: "none" }}>
228
+ <Tooltip style={{ textTransform: 'none' }}>
235
229
  <Tooltip.Target>
236
- <Icon display="question" style={{ marginLeft: "0.5rem" }} />
230
+ <Icon display='question' style={{ marginLeft: '0.5rem' }} />
237
231
  </Tooltip.Target>
238
232
  <Tooltip.Content>
239
- <p>
240
- Enter supporting text to display below the data visualization,
241
- if applicable. The following HTML tags are supported: strong,
242
- em, sup, and sub.
243
- </p>
233
+ <p>Enter supporting text to display below the data visualization, if applicable. The following HTML tags are supported: strong, em, sup, and sub.</p>
244
234
  </Tooltip.Content>
245
235
  </Tooltip>
246
236
  }
247
237
  />
248
238
  </Accordion.Section>
249
- <Accordion.Section title="Data">
250
- <h4 style={{ fontWeight: "600" }}>Numerator</h4>
251
- <div className="cove-accordion__panel-section">
252
- <div className="cove-input-group">
253
- <InputSelect
254
- value={config.dataColumn || ""}
255
- fieldName="dataColumn"
256
- label="Data Column"
257
- updateField={updateField}
258
- initial="Select"
259
- options={getColumns()}
260
- className="cove-input"
261
- />
239
+ <Accordion.Section title='Data'>
240
+ <h4 style={{ fontWeight: '600' }}>Numerator</h4>
241
+ <div className='cove-accordion__panel-section'>
242
+ <div className='cove-input-group'>
243
+ <InputSelect value={config.dataColumn || ''} fieldName='dataColumn' label='Data Column' updateField={updateField} initial='Select' options={getColumns()} className='cove-input' />
262
244
  </div>
263
245
 
264
- <div className="cove-input-group">
265
- <InputSelect
266
- value={config.dataFunction || ""}
267
- fieldName="dataFunction"
268
- label="Data Function"
269
- updateField={updateField}
270
- initial="Select"
271
- options={DATA_FUNCTIONS}
272
- className="cove-input"
273
- />
246
+ <div className='cove-input-group'>
247
+ <InputSelect value={config.dataFunction || ''} fieldName='dataFunction' label='Data Function' updateField={updateField} initial='Select' options={DATA_FUNCTIONS} className='cove-input' />
274
248
  </div>
275
249
 
276
- <div className="cove-input-group">
250
+ <div className='cove-input-group'>
277
251
  <label>
278
- <span className="edit-label cove-input__label">Data Conditional</span>
252
+ <span className='edit-label cove-input__label'>Data Conditional</span>
279
253
  </label>
280
- <div className="cove-accordion__panel-row cove-accordion__small-inputs">
281
- <div className="cove-accordion__panel-col">
282
- <InputSelect
283
- value={config.dataConditionalColumn || ""}
284
- fieldName="dataConditionalColumn"
285
- updateField={updateField}
286
- initial="Select"
287
- options={getColumns()}
288
- className="cove-input"
289
- />
254
+ <div className='cove-accordion__panel-row cove-accordion__small-inputs'>
255
+ <div className='cove-accordion__panel-col'>
256
+ <InputSelect value={config.dataConditionalColumn || ''} fieldName='dataConditionalColumn' updateField={updateField} initial='Select' options={getColumns()} className='cove-input' />
290
257
  </div>
291
- <div className="cove-accordion__panel-col">
292
- <InputSelect
293
- value={config.dataConditionalOperator || ""}
294
- fieldName="dataConditionalOperator"
295
- updateField={updateField}
296
- initial="Select"
297
- options={DATA_OPERATORS}
298
- className="cove-input"
299
- />
258
+ <div className='cove-accordion__panel-col'>
259
+ <InputSelect value={config.dataConditionalOperator || ''} fieldName='dataConditionalOperator' updateField={updateField} initial='Select' options={DATA_OPERATORS} className='cove-input' />
300
260
  </div>
301
- <div className="cove-accordion__panel-col">
302
- <InputText
303
- value={config.dataConditionalComparate}
304
- fieldName={"dataConditionalComparate"}
305
- updateField={updateField}
306
- className={
307
- config.invalidComparate ? "cove-accordion__input-error" : ""
308
- }
309
- style={{ minHeight: "2rem" }}
310
- />
261
+ <div className='cove-accordion__panel-col'>
262
+ <InputText value={config.dataConditionalComparate} fieldName={'dataConditionalComparate'} updateField={updateField} className={config.invalidComparate ? 'cove-accordion__input-error' : ''} style={{ minHeight: '2rem' }} />
311
263
  </div>
312
264
  </div>
313
265
  </div>
314
266
 
315
- {config.invalidComparate && (
316
- <div className="cove-accordion__panel-error">
317
- Non-numerical comparate values can only be used with = or ≠.
318
- </div>
319
- )}
267
+ {config.invalidComparate && <div className='cove-accordion__panel-error'>Non-numerical comparate values can only be used with = or ≠.</div>}
320
268
  </div>
321
- <div className="cove-accordion__panel-row align-center">
322
- <div className="cove-accordion__panel-col">
323
- <h4 style={{ fontWeight: "600" }}>Denominator</h4>
269
+ <div className='cove-accordion__panel-row align-center'>
270
+ <div className='cove-accordion__panel-col'>
271
+ <h4 style={{ fontWeight: '600' }}>Denominator</h4>
324
272
  </div>
325
- <div className="cove-accordion__panel-col">
326
- <div style={{ display: "flex", justifyContent: "flex-end" }}>
327
- <label className="cove-accordion__panel-label--inline">
328
- Select from data
329
- </label>
330
- <InputCheckbox
331
- size="small"
332
- value={config.customDenom}
333
- fieldName="customDenom"
334
- updateField={updateField}
335
- />
273
+ <div className='cove-accordion__panel-col'>
274
+ <div style={{ display: 'flex', justifyContent: 'flex-end' }}>
275
+ <label className='cove-accordion__panel-label--inline'>Select from data</label>
276
+ <InputCheckbox size='small' value={config.customDenom} fieldName='customDenom' updateField={updateField} />
336
277
  </div>
337
278
  </div>
338
279
  </div>
339
- <div className="cove-accordion__panel-section">
280
+ <div className='cove-accordion__panel-section'>
340
281
  {!config.customDenom && (
341
- <div className="cove-accordion__panel-row align-center">
342
- <div className="cove-accordion__panel-col">
343
- <InputText
344
- value={config.dataDenom}
345
- fieldName="dataDenom"
346
- updateField={updateField}
347
- />
282
+ <div className='cove-accordion__panel-row align-center'>
283
+ <div className='cove-accordion__panel-col'>
284
+ <InputText value={config.dataDenom} fieldName='dataDenom' updateField={updateField} />
348
285
  </div>
349
- <div
350
- className="cove-accordion__panel-col"
351
- style={{ display: "flex", alignItems: "center" }}
352
- >
353
- <label className="cove-accordion__panel-label--muted">
354
- default (100)
355
- </label>
286
+ <div className='cove-accordion__panel-col' style={{ display: 'flex', alignItems: 'center' }}>
287
+ <label className='cove-accordion__panel-label--muted'>default (100)</label>
356
288
  </div>
357
289
  </div>
358
290
  )}
359
291
  {config.customDenom && (
360
292
  <>
361
- <InputSelect
362
- value={config.dataDenomColumn || ""}
363
- fieldName="dataDenomColumn"
364
- label="Data Column"
365
- updateField={updateField}
366
- initial="Select"
367
- options={getColumns()}
368
- />
369
- <InputSelect
370
- value={config.dataDenomFunction || ""}
371
- fieldName="dataDenomFunction"
372
- label="Data Function"
373
- updateField={updateField}
374
- initial="Select"
375
- options={DATA_FUNCTIONS}
376
- />
293
+ <InputSelect value={config.dataDenomColumn || ''} fieldName='dataDenomColumn' label='Data Column' updateField={updateField} initial='Select' options={getColumns()} />
294
+ <InputSelect value={config.dataDenomFunction || ''} fieldName='dataDenomFunction' label='Data Function' updateField={updateField} initial='Select' options={DATA_FUNCTIONS} />
377
295
  </>
378
296
  )}
379
297
  </div>
380
- <ul className="column-edit">
381
- <li className="three-col">
382
- <div style={{ marginRight: "1rem" }}>
383
- <InputText
384
- value={config.prefix}
385
- fieldName="prefix"
386
- label="Prefix"
387
- updateField={updateField}
388
- />
298
+ <ul className='column-edit'>
299
+ <li className='three-col'>
300
+ <div style={{ marginRight: '1rem' }}>
301
+ <InputText value={config.prefix} fieldName='prefix' label='Prefix' updateField={updateField} />
389
302
  </div>
390
- <div style={{ marginRight: "1rem" }}>
391
- <InputText
392
- value={config.suffix}
393
- fieldName="suffix"
394
- label="Suffix"
395
- updateField={updateField}
396
- />
303
+ <div style={{ marginRight: '1rem' }}>
304
+ <InputText value={config.suffix} fieldName='suffix' label='Suffix' updateField={updateField} />
397
305
  </div>
398
306
  <div>
399
- <InputText
400
- type="number"
401
- value={config.roundToPlace}
402
- fieldName="roundToPlace"
403
- label="Round"
404
- updateField={updateField}
405
- />
307
+ <InputText type='number' value={config.roundToPlace} fieldName='roundToPlace' label='Round' updateField={updateField} />
406
308
  </div>
407
309
  </li>
408
310
  </ul>
409
311
 
410
- <hr className="cove-accordion__divider" />
312
+ <hr className='cove-accordion__divider' />
411
313
 
412
- <label style={{ marginBottom: "1rem" }}>
413
- <span className="edit-label">Data Point Filters</span>
414
- <Tooltip style={{ textTransform: "none" }}>
314
+ <label style={{ marginBottom: '1rem' }}>
315
+ <span className='edit-label'>Data Point Filters</span>
316
+ <Tooltip style={{ textTransform: 'none' }}>
415
317
  <Tooltip.Target>
416
- <Icon display="question" style={{ marginLeft: "0.5rem" }} />
318
+ <Icon display='question' style={{ marginLeft: '0.5rem' }} />
417
319
  </Tooltip.Target>
418
320
  <Tooltip.Content>
419
- <p>
420
- To refine the highlighted data point, specify one or more
421
- filters (e.g., "Male" and "Female" for a column called "Sex").
422
- </p>
321
+ <p>To refine the highlighted data point, specify one or more filters (e.g., "Male" and "Female" for a column called "Sex").</p>
423
322
  </Tooltip.Content>
424
323
  </Tooltip>
425
324
  </label>
426
325
  {config.filters && (
427
- <ul
428
- className="filters-list"
429
- style={{ paddingLeft: 0, marginBottom: "1rem" }}
430
- >
326
+ <ul className='filters-list' style={{ paddingLeft: 0, marginBottom: '1rem' }}>
431
327
  {config.filters.map((filter, index) => (
432
- <fieldset className="edit-block" key={index}>
328
+ <fieldset className='edit-block' key={index}>
433
329
  <button
434
- type="button"
435
- className="remove-column"
330
+ type='button'
331
+ className='remove-column'
436
332
  onClick={() => {
437
- removeFilter(index);
333
+ removeFilter(index)
438
334
  }}
439
335
  >
440
336
  Remove
441
337
  </button>
442
338
  <label>
443
- <span className="edit-label column-heading">Column</span>
339
+ <span className='edit-label column-heading'>Column</span>
444
340
  <select
445
341
  value={filter.columnName}
446
- onChange={(e) => {
447
- updateFilterProp("columnName", index, e.target.value);
342
+ onChange={e => {
343
+ updateFilterProp('columnName', index, e.target.value)
448
344
  }}
449
345
  >
450
- <option value="">- Select Option -</option>
346
+ <option value=''>- Select Option -</option>
451
347
  {getColumns().map((dataKey, index) => (
452
348
  <option value={dataKey} key={index}>
453
349
  {dataKey}
@@ -456,16 +352,14 @@ const EditorPanel = memo((props) => {
456
352
  </select>
457
353
  </label>
458
354
  <label>
459
- <span className="edit-label column-heading">
460
- Column Value
461
- </span>
355
+ <span className='edit-label column-heading'>Column Value</span>
462
356
  <select
463
357
  value={filter.columnValue}
464
- onChange={(e) => {
465
- updateFilterProp("columnValue", index, e.target.value);
358
+ onChange={e => {
359
+ updateFilterProp('columnValue', index, e.target.value)
466
360
  }}
467
361
  >
468
- <option value="">- Select Option -</option>
362
+ <option value=''>- Select Option -</option>
469
363
  {getFilterColumnValues(index).map((dataKey, index) => (
470
364
  <option value={dataKey} key={index}>
471
365
  {dataKey}
@@ -481,136 +375,81 @@ const EditorPanel = memo((props) => {
481
375
  Add Filter
482
376
  </Button>
483
377
  </Accordion.Section>
484
- <Accordion.Section title="Visual">
485
- <InputSelect
486
- value={config.shape}
487
- fieldName="shape"
488
- label="Shape"
489
- updateField={updateField}
490
- options={["circle", "square", "person"]}
491
- className="cove-input"
492
- />
378
+ <Accordion.Section title='Visual'>
379
+ <InputSelect value={config.shape} fieldName='shape' label='Shape' updateField={updateField} options={['circle', 'square', 'person']} className='cove-input' />
493
380
 
494
- <div
495
- className="cove-accordion__panel-row cove-accordion__small-inputs"
496
- style={{ marginTop: "1rem", marginBottom: "1rem" }}
497
- >
498
- <div className="cove-accordion__panel-col">
499
- <InputText
500
- type="number"
501
- value={config.nodeWidth}
502
- fieldName="nodeWidth"
503
- label="Width"
504
- updateField={updateField}
505
- />
381
+ <div className='cove-accordion__panel-row cove-accordion__small-inputs' style={{ marginTop: '1rem', marginBottom: '1rem' }}>
382
+ <div className='cove-accordion__panel-col'>
383
+ <InputText type='number' value={config.nodeWidth} fieldName='nodeWidth' label='Width' updateField={updateField} />
506
384
  </div>
507
- <div className="cove-accordion__panel-col">
508
- <InputText
509
- type="number"
510
- value={config.nodeSpacer}
511
- fieldName="nodeSpacer"
512
- label="Spacer"
513
- updateField={updateField}
514
- />
385
+ <div className='cove-accordion__panel-col'>
386
+ <InputText type='number' value={config.nodeSpacer} fieldName='nodeSpacer' label='Spacer' updateField={updateField} />
515
387
  </div>
516
388
  </div>
517
389
 
518
- <div className="cove-input-group">
519
- <InputSelect
520
- value={config.orientation}
521
- fieldName="orientation"
522
- label="Layout"
523
- updateField={updateField}
524
- className="cove-input"
525
- options={["horizontal", "vertical"]}
526
- />
390
+ <div className='cove-input-group'>
391
+ <InputSelect value={config.orientation} fieldName='orientation' label='Layout' updateField={updateField} className='cove-input' options={['horizontal', 'vertical']} />
527
392
  </div>
528
393
 
529
- <div className="cove-input-group">
394
+ <div className='cove-input-group'>
530
395
  <label>
531
- <span className="edit-label column-heading cove-input__label">
532
- Data Point Font Size
533
- </span>
396
+ <span className='edit-label column-heading cove-input__label'>Data Point Font Size</span>
534
397
  </label>
535
- <div className="cove-accordion__panel-row cove-accordion__small-inputs align-center">
536
- <div className="cove-accordion__panel-col">
537
- <InputText
538
- type="number"
539
- value={config.fontSize}
540
- fieldName="fontSize"
541
- updateField={updateField}
542
- />
398
+ <div className='cove-accordion__panel-row cove-accordion__small-inputs align-center'>
399
+ <div className='cove-accordion__panel-col'>
400
+ <InputText type='number' value={config.fontSize} fieldName='fontSize' updateField={updateField} />
543
401
  </div>
544
- <div
545
- className="cove-accordion__panel-col"
546
- style={{ display: "flex", alignItems: "center" }}
547
- >
548
- <label className="accordion__panel-label--muted">
549
- default (50px)
550
- </label>
402
+ <div className='cove-accordion__panel-col' style={{ display: 'flex', alignItems: 'center' }}>
403
+ <label className='accordion__panel-label--muted'>default (50px)</label>
551
404
  </div>
552
405
  </div>
553
406
  </div>
554
407
 
555
- <InputSelect
556
- value={config.overallFontSize}
557
- fieldName="overallFontSize"
558
- label="Overall Font Size"
559
- updateField={updateField}
560
- options={["small", "medium", "large"]}
561
- className="cove-input"
562
- />
408
+ <InputSelect value={config.overallFontSize} fieldName='overallFontSize' label='Overall Font Size' updateField={updateField} options={['small', 'medium', 'large']} className='cove-input' />
563
409
 
564
410
  <label>
565
- <span className="edit-label cove-input__label">Theme</span>
566
- <ul className="color-palette">
567
- {headerColors.map((palette) => (
411
+ <span className='edit-label cove-input__label'>Theme</span>
412
+ <ul className='color-palette'>
413
+ {headerColors.map(palette => (
568
414
  <li
569
415
  title={palette}
570
416
  key={palette}
571
417
  onClick={() => {
572
- updateConfig({ ...config, theme: palette });
418
+ updateConfig({ ...config, theme: palette })
573
419
  }}
574
- className={
575
- config.theme === palette ? "selected " + palette : palette
576
- }
420
+ className={config.theme === palette ? 'selected ' + palette : palette}
577
421
  ></li>
578
422
  ))}
579
423
  </ul>
580
424
  </label>
581
-
582
- <div className="cove-accordion__panel-section reverse-labels">
583
- <InputCheckbox inline size='small' value={config.visual.border} section="visual" fieldName="border" label="Display Border" updateField={updateField} />
584
- <InputCheckbox inline size='small' value={config.visual.borderColorTheme} section="visual" fieldName="borderColorTheme" label="Use theme border color" updateField={updateField} />
585
- <InputCheckbox size='small' value={config.visual.accent} section="visual" fieldName="accent" label="Use Accent Style" updateField={updateField} />
586
- <InputCheckbox size='small' value={config.visual.background} section="visual" fieldName="background" label="Use Theme Background Color" updateField={updateField} />
587
- <InputCheckbox size='small' value={config.visual.hideBackgroundColor} section="visual" fieldName="hideBackgroundColor" label="Hide Background Color" updateField={updateField} />
425
+
426
+ <div className='cove-accordion__panel-section reverse-labels'>
427
+ <InputCheckbox inline size='small' value={config.visual.border} section='visual' fieldName='border' label='Display Border' updateField={updateField} />
428
+ <InputCheckbox inline size='small' value={config.visual.borderColorTheme} section='visual' fieldName='borderColorTheme' label='Use theme border color' updateField={updateField} />
429
+ <InputCheckbox size='small' value={config.visual.accent} section='visual' fieldName='accent' label='Use Accent Style' updateField={updateField} />
430
+ <InputCheckbox size='small' value={config.visual.background} section='visual' fieldName='background' label='Use Theme Background Color' updateField={updateField} />
431
+ <InputCheckbox size='small' value={config.visual.hideBackgroundColor} section='visual' fieldName='hideBackgroundColor' label='Hide Background Color' updateField={updateField} />
588
432
  </div>
589
433
  </Accordion.Section>
590
434
  </Accordion>
591
- );
435
+ )
592
436
 
593
437
  if (loading) return null
594
438
 
595
439
  return (
596
- <ErrorBoundary component="EditorPanel">
597
- <div className="cove-editor">
598
- {!config.newViz && config.runtime && config.runtime.editorErrorMessage && <Error/>}
599
- {config.newViz && showConfigConfirm && <Confirm/>}
600
- <button className={`cove-editor--toggle` + (!displayPanel ? ` collapsed` : ``)}
601
- title={displayPanel ? `Collapse Editor` : `Expand Editor`} onClick={onBackClick}/>
440
+ <ErrorBoundary component='EditorPanel'>
441
+ <div className='cove-editor'>
442
+ {!config.newViz && config.runtime && config.runtime.editorErrorMessage && <Error />}
443
+ {config.newViz && showConfigConfirm && <Confirm />}
444
+ <button className={`cove-editor--toggle` + (!displayPanel ? ` collapsed` : ``)} title={displayPanel ? `Collapse Editor` : `Expand Editor`} onClick={onBackClick} />
602
445
  <section className={`cove-editor__panel` + (displayPanel ? `` : ' hidden')}>
603
- <div className="cove-editor__panel-container">
604
- <h2 className="cove-editor__heading">Configure Waffle Chart</h2>
605
- <section className="cove-editor__content">
606
- {editorContent}
607
- </section>
446
+ <div className='cove-editor__panel-container'>
447
+ <h2 className='cove-editor__heading'>Configure Waffle Chart</h2>
448
+ <section className='cove-editor__content'>{editorContent}</section>
608
449
  </div>
609
450
  </section>
610
- <div className="cove-editor__content">
611
- <div className="cove-editor__content-wrap">
612
- {props.children}
613
- </div>
451
+ <div className='cove-editor__content'>
452
+ <div className='cove-editor__content-wrap'>{props.children}</div>
614
453
  </div>
615
454
  </div>
616
455
  </ErrorBoundary>