@pie-lib/charting 5.34.0 → 5.36.0-mui-update.0

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.
Files changed (77) hide show
  1. package/CHANGELOG.md +19 -4
  2. package/lib/actions-button.js +49 -88
  3. package/lib/actions-button.js.map +1 -1
  4. package/lib/axes.js +175 -233
  5. package/lib/axes.js.map +1 -1
  6. package/lib/bars/bar.js +13 -41
  7. package/lib/bars/bar.js.map +1 -1
  8. package/lib/bars/common/bars.js +55 -126
  9. package/lib/bars/common/bars.js.map +1 -1
  10. package/lib/bars/common/correct-check-icon.js +1 -6
  11. package/lib/bars/common/correct-check-icon.js.map +1 -1
  12. package/lib/bars/histogram.js +13 -41
  13. package/lib/bars/histogram.js.map +1 -1
  14. package/lib/chart-setup.js +110 -184
  15. package/lib/chart-setup.js.map +1 -1
  16. package/lib/chart-type.js +29 -38
  17. package/lib/chart-type.js.map +1 -1
  18. package/lib/chart-types.js +1 -10
  19. package/lib/chart-types.js.map +1 -1
  20. package/lib/chart.js +74 -146
  21. package/lib/chart.js.map +1 -1
  22. package/lib/common/correctness-indicators.js +74 -52
  23. package/lib/common/correctness-indicators.js.map +1 -1
  24. package/lib/common/drag-handle.js +67 -105
  25. package/lib/common/drag-handle.js.map +1 -1
  26. package/lib/common/drag-icon.js +6 -12
  27. package/lib/common/drag-icon.js.map +1 -1
  28. package/lib/common/styles.js +6 -24
  29. package/lib/common/styles.js.map +1 -1
  30. package/lib/grid.js +44 -81
  31. package/lib/grid.js.map +1 -1
  32. package/lib/index.js +0 -6
  33. package/lib/index.js.map +1 -1
  34. package/lib/key-legend.js +63 -87
  35. package/lib/key-legend.js.map +1 -1
  36. package/lib/line/common/drag-handle.js +69 -100
  37. package/lib/line/common/drag-handle.js.map +1 -1
  38. package/lib/line/common/line.js +44 -92
  39. package/lib/line/common/line.js.map +1 -1
  40. package/lib/line/line-cross.js +77 -87
  41. package/lib/line/line-cross.js.map +1 -1
  42. package/lib/line/line-dot.js +66 -78
  43. package/lib/line/line-dot.js.map +1 -1
  44. package/lib/mark-label.js +75 -117
  45. package/lib/mark-label.js.map +1 -1
  46. package/lib/plot/common/plot.js +76 -144
  47. package/lib/plot/common/plot.js.map +1 -1
  48. package/lib/plot/dot.js +31 -57
  49. package/lib/plot/dot.js.map +1 -1
  50. package/lib/plot/line.js +37 -62
  51. package/lib/plot/line.js.map +1 -1
  52. package/lib/tool-menu.js +48 -80
  53. package/lib/tool-menu.js.map +1 -1
  54. package/lib/utils.js +20 -77
  55. package/lib/utils.js.map +1 -1
  56. package/package.json +12 -9
  57. package/src/actions-button.jsx +36 -37
  58. package/src/axes.jsx +80 -75
  59. package/src/bars/common/bars.jsx +8 -23
  60. package/src/chart-setup.jsx +68 -78
  61. package/src/chart-type.js +26 -21
  62. package/src/chart.jsx +8 -20
  63. package/src/common/correctness-indicators.jsx +51 -13
  64. package/src/common/drag-handle.jsx +44 -59
  65. package/src/common/drag-icon.jsx +2 -2
  66. package/src/common/styles.js +1 -1
  67. package/src/grid.jsx +9 -13
  68. package/src/key-legend.jsx +62 -60
  69. package/src/line/common/drag-handle.jsx +57 -55
  70. package/src/line/common/line.jsx +17 -8
  71. package/src/line/line-cross.js +37 -12
  72. package/src/line/line-dot.js +30 -11
  73. package/src/mark-label.jsx +43 -44
  74. package/src/plot/common/plot.jsx +17 -22
  75. package/src/plot/dot.js +10 -3
  76. package/src/plot/line.js +14 -6
  77. package/src/tool-menu.jsx +20 -23
package/src/axes.jsx CHANGED
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { withStyles } from '@material-ui/core/styles';
3
+ import { styled } from '@mui/material/styles';
4
4
  import { AxisLeft, AxisBottom } from '@vx/axis';
5
- import Checkbox from '@material-ui/core/Checkbox';
5
+ import Checkbox from '@mui/material/Checkbox';
6
6
 
7
7
  import { types } from '@pie-lib/plot';
8
8
  import { color } from '@pie-lib/render-ui';
@@ -13,6 +13,70 @@ import { TickCorrectnessIndicator } from './common/correctness-indicators';
13
13
  import { bandKey, getTickValues, getRotateAngle } from './utils';
14
14
  import MarkLabel from './mark-label';
15
15
 
16
+ const StyledErrorText = styled('text')(({ theme }) => ({
17
+ fontSize: theme.typography.fontSize - 2,
18
+ fill: theme.palette.error.main,
19
+ }));
20
+
21
+ const StyledCheckbox = styled(Checkbox)(() => ({
22
+ color: `${color.tertiary()} !important`,
23
+ }));
24
+
25
+ // TODO: check if this styling works as intended once MUI migration is done
26
+ // Styled components for axis elements
27
+ const StyledAxisLeft = styled(AxisLeft)(() => ({
28
+ stroke: color.primaryDark(),
29
+ strokeWidth: 2,
30
+ '& .vx-axis-line': {
31
+ stroke: color.visualElementsColors.AXIS_LINE_COLOR,
32
+ strokeWidth: 2,
33
+ },
34
+ '& .vx-axis-tick': {
35
+ '& > line': {
36
+ stroke: color.primaryDark(),
37
+ strokeWidth: 2,
38
+ },
39
+ },
40
+ }));
41
+
42
+ const StyledAxisBottom = styled(AxisBottom)(({ theme }) => ({
43
+ stroke: color.primaryDark(),
44
+ strokeWidth: 2,
45
+ '& .vx-axis-line': {
46
+ stroke: color.visualElementsColors.AXIS_LINE_COLOR,
47
+ strokeWidth: 2,
48
+ },
49
+ '& .vx-axis-tick': {
50
+ '& > line': {
51
+ stroke: color.primaryDark(),
52
+ strokeWidth: 2,
53
+ },
54
+ fontFamily: theme.typography.body1?.fontFamily,
55
+ fontSize: theme.typography.fontSize,
56
+ textAnchor: 'middle',
57
+ },
58
+ }));
59
+
60
+ // Styled components for correctness indicators
61
+ const correctnessIconStyles = (theme) => ({
62
+ borderRadius: theme.spacing(2),
63
+ color: color.defaults.WHITE,
64
+ fontSize: '16px',
65
+ width: '16px',
66
+ height: '16px',
67
+ padding: '2px',
68
+ border: `1px solid ${color.defaults.WHITE}`,
69
+ boxSizing: 'unset', // to override the default border-box in IBX
70
+ });
71
+
72
+ const incorrectIconStyles = {
73
+ backgroundColor: color.incorrectWithIcon(),
74
+ };
75
+
76
+ const correctIconStyles = {
77
+ backgroundColor: color.correct(),
78
+ };
79
+
16
80
  export class TickComponent extends React.Component {
17
81
  static propTypes = {
18
82
  defineChart: PropTypes.bool,
@@ -112,7 +176,6 @@ export class TickComponent extends React.Component {
112
176
 
113
177
  render() {
114
178
  const {
115
- classes,
116
179
  categories,
117
180
  xBand,
118
181
  bandWidth,
@@ -137,6 +200,13 @@ export class TickComponent extends React.Component {
137
200
  return null;
138
201
  }
139
202
 
203
+ // Create classes object for TickCorrectnessIndicator compatibility
204
+ const classes = {
205
+ correctnessIcon: correctnessIconStyles,
206
+ incorrectIcon: incorrectIconStyles,
207
+ correctIcon: correctIconStyles,
208
+ };
209
+
140
210
  const { dialog } = this.state;
141
211
  const { changeEditable, changeInteractive } = chartingOptions || {};
142
212
  const index = parseInt(formattedValue.split('-')[0], 10);
@@ -193,9 +263,9 @@ export class TickComponent extends React.Component {
193
263
  </foreignObject>
194
264
 
195
265
  {error && index === 0 && (
196
- <text className={classes.error} y={y + 23} height={6} textAnchor="start">
266
+ <StyledErrorText y={y + 23} height={6} textAnchor="start">
197
267
  {distinctMessages}
198
- </text>
268
+ </StyledErrorText>
199
269
  )}
200
270
 
201
271
  {defineChart && index === 0 && (
@@ -257,8 +327,7 @@ export class TickComponent extends React.Component {
257
327
  height={4}
258
328
  style={{ pointerEvents: 'visible', overflow: 'visible' }}
259
329
  >
260
- <Checkbox
261
- className={classes.customColor}
330
+ <StyledCheckbox
262
331
  style={{ position: 'fixed' }}
263
332
  checked={interactive}
264
333
  onChange={(e) => this.changeInteractive(index, e.target.checked)}
@@ -274,8 +343,7 @@ export class TickComponent extends React.Component {
274
343
  height={4}
275
344
  style={{ pointerEvents: 'visible', overflow: 'visible' }}
276
345
  >
277
- <Checkbox
278
- className={classes.customColor}
346
+ <StyledCheckbox
279
347
  style={{ position: 'fixed' }}
280
348
  checked={editable}
281
349
  onChange={(e) => this.changeEditable(index, e.target.checked)}
@@ -316,7 +384,6 @@ TickComponent.propTypes = {
316
384
  formattedValue: PropTypes.string,
317
385
  onChangeCategory: PropTypes.func,
318
386
  onChange: PropTypes.func,
319
- classes: PropTypes.object,
320
387
  error: PropTypes.object,
321
388
  defineChart: PropTypes.bool,
322
389
  chartingOptions: PropTypes.object,
@@ -330,7 +397,6 @@ TickComponent.propTypes = {
330
397
  export class RawChartAxes extends React.Component {
331
398
  static propTypes = {
332
399
  bottomScale: PropTypes.func,
333
- classes: PropTypes.object.isRequired,
334
400
  categories: PropTypes.array,
335
401
  defineChart: PropTypes.bool,
336
402
  error: PropTypes.any,
@@ -386,7 +452,6 @@ export class RawChartAxes extends React.Component {
386
452
 
387
453
  render() {
388
454
  const {
389
- classes,
390
455
  graphProps,
391
456
  xBand,
392
457
  leftAxis,
@@ -405,7 +470,6 @@ export class RawChartAxes extends React.Component {
405
470
  showCorrectness,
406
471
  } = this.props;
407
472
 
408
- const { axis, axisLine, tick } = classes;
409
473
  const { scale = {}, range = {}, domain = {}, size = {} } = graphProps || {};
410
474
  const { height, width } = this.state;
411
475
 
@@ -432,7 +496,6 @@ export class RawChartAxes extends React.Component {
432
496
  hiddenLabelRef: (ref) => {
433
497
  this.hiddenLabelRef = ref;
434
498
  },
435
- classes,
436
499
  categories,
437
500
  xBand,
438
501
  bandWidth,
@@ -461,20 +524,15 @@ export class RawChartAxes extends React.Component {
461
524
  return (
462
525
  <React.Fragment>
463
526
  {leftAxis && (
464
- <AxisLeft
527
+ <StyledAxisLeft
465
528
  scale={scale.y}
466
- className={axis}
467
- axisLineClassName={axisLine}
468
529
  tickLength={10}
469
- tickClassName={tick}
470
530
  tickFormat={(value) => value}
471
531
  tickValues={rowTickValues}
472
532
  tickLabelProps={getTickLabelProps}
473
533
  />
474
534
  )}
475
- <AxisBottom
476
- axisLineClassName={axisLine}
477
- tickClassName={tick}
535
+ <StyledAxisBottom
478
536
  scale={bottomScale}
479
537
  labelProps={{ y: 60 + top }}
480
538
  top={scale.y && scale.y(range.min)}
@@ -489,59 +547,6 @@ export class RawChartAxes extends React.Component {
489
547
  }
490
548
  }
491
549
 
492
- const ChartAxes = withStyles(
493
- (theme) => ({
494
- axis: {
495
- stroke: color.primaryDark(),
496
- strokeWidth: 2,
497
- },
498
- axisLine: {
499
- stroke: color.visualElementsColors.AXIS_LINE_COLOR,
500
- strokeWidth: 2,
501
- },
502
- tick: {
503
- '& > line': {
504
- stroke: color.primaryDark(),
505
- strokeWidth: 2,
506
- },
507
- fontFamily: theme.typography.body1.fontFamily,
508
- fontSize: theme.typography.fontSize,
509
- textAnchor: 'middle',
510
- },
511
- dottedLine: {
512
- stroke: color.primaryLight(),
513
- opacity: 0.2,
514
- },
515
- error: {
516
- fontSize: theme.typography.fontSize - 2,
517
- fill: theme.palette.error.main,
518
- },
519
- customColor: {
520
- color: `${color.tertiary()} !important`,
521
- },
522
- correctnessIcon: {
523
- borderRadius: theme.spacing.unit * 2,
524
- color: color.defaults.WHITE,
525
- fontSize: '16px',
526
- width: '16px',
527
- height: '16px',
528
- padding: '2px',
529
- border: `1px solid ${color.defaults.WHITE}`,
530
- boxSizing: 'unset', // to override the default border-box in IBX
531
- },
532
- incorrectIcon: {
533
- backgroundColor: color.incorrectWithIcon(),
534
- },
535
- correctIcon: {
536
- backgroundColor: color.correct(),
537
- },
538
- tickContainer: {
539
- display: 'flex',
540
- flexDirection: 'column',
541
- alignItems: 'center',
542
- },
543
- }),
544
- { withTheme: true },
545
- )(RawChartAxes);
550
+ const ChartAxes = styled(RawChartAxes)(({ theme }) => ({}));
546
551
 
547
552
  export default ChartAxes;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Group } from '@vx/group';
4
4
  import { Bar as VxBar } from '@vx/shape';
5
- import { withStyles } from '@material-ui/core/styles/index';
5
+ import { styled } from '@mui/material/styles';
6
6
  import debug from 'debug';
7
7
 
8
8
  import { color } from '@pie-lib/render-ui';
@@ -51,12 +51,15 @@ const calculateFillColor = (isHovered, barColor, index, hoverHistogramColors, al
51
51
  return barColor || null;
52
52
  };
53
53
 
54
+ const StyledVxBar = styled(VxBar)(() => ({
55
+ fill: color.defaults.TERTIARY,
56
+ }));
57
+
54
58
  export class RawBar extends React.Component {
55
59
  static propTypes = {
56
60
  barColor: PropTypes.string,
57
61
  onChangeCategory: PropTypes.func,
58
62
  value: PropTypes.number,
59
- classes: PropTypes.object,
60
63
  label: PropTypes.string,
61
64
  xBand: PropTypes.func,
62
65
  index: PropTypes.number.isRequired,
@@ -140,7 +143,6 @@ export class RawBar extends React.Component {
140
143
  graphProps,
141
144
  value,
142
145
  label,
143
- classes,
144
146
  xBand,
145
147
  index,
146
148
  interactive,
@@ -174,12 +176,11 @@ export class RawBar extends React.Component {
174
176
  onTouchStart={this.handleMouseEnter}
175
177
  onTouchEnd={this.handleMouseLeave}
176
178
  >
177
- <VxBar
179
+ <StyledVxBar
178
180
  x={barX}
179
181
  y={scale.y(yy)}
180
182
  width={barWidth}
181
183
  height={barHeight}
182
- className={classes.bar}
183
184
  style={{ fill: fillColor }}
184
185
  />
185
186
  {correctness &&
@@ -196,12 +197,11 @@ export class RawBar extends React.Component {
196
197
 
197
198
  return (
198
199
  <>
199
- <VxBar
200
+ <StyledVxBar
200
201
  x={barX + 2} // add 2px for the stroke (the dashed border)
201
202
  y={yToRender}
202
203
  width={barWidth - 4} // substract 4px for the total stroke
203
204
  height={diffPx}
204
- className={classes.bar}
205
205
  style={{
206
206
  stroke: indicatorBarColor,
207
207
  strokeWidth: 2,
@@ -234,22 +234,7 @@ export class RawBar extends React.Component {
234
234
  }
235
235
  }
236
236
 
237
- const Bar = withStyles((theme) => ({
238
- bar: {
239
- fill: color.defaults.TERTIARY,
240
- },
241
- correctIcon: {
242
- backgroundColor: color.correct(),
243
- borderRadius: theme.spacing.unit * 2,
244
- color: color.defaults.WHITE,
245
- fontSize: '10px',
246
- width: '10px',
247
- height: '10px',
248
- padding: '2px',
249
- border: `1px solid ${color.defaults.WHITE}`,
250
- boxSizing: 'unset', // to override the default border-box in IBX
251
- },
252
- }))(RawBar);
237
+ const Bar = RawBar;
253
238
 
254
239
  export class Bars extends React.Component {
255
240
  static propTypes = {
@@ -1,8 +1,8 @@
1
1
  import React, { useState, useEffect } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { color } from '@pie-lib/render-ui';
4
- import { withStyles } from '@material-ui/core/styles';
5
- import Typography from '@material-ui/core/Typography';
4
+ import { styled } from '@mui/material/styles';
5
+ import Typography from '@mui/material/Typography';
6
6
  import ChartType from './chart-type';
7
7
  import { NumberTextFieldCustom } from '@pie-lib/config-ui';
8
8
  import { AlertDialog } from '@pie-lib/config-ui';
@@ -24,9 +24,52 @@ export const resetValues = (data, updateModel, range, onChange, model) => {
24
24
  }
25
25
  };
26
26
 
27
+ const StyledWrapper = styled('div')(() => ({
28
+ width: '450px',
29
+ }));
30
+
31
+ const StyledContent = styled('div')(({ theme }) => ({
32
+ display: 'flex',
33
+ flexDirection: 'column',
34
+ width: '100%',
35
+ marginTop: theme.spacing(3),
36
+ }));
37
+
38
+ const StyledColumnView = styled('div')(() => ({
39
+ display: 'flex',
40
+ flexDirection: 'column',
41
+ alignItems: 'center',
42
+ }));
43
+
44
+ const StyledRowView = styled('div')(() => ({
45
+ display: 'flex',
46
+ justifyContent: 'space-around',
47
+ alignItems: 'center',
48
+ }));
49
+
50
+ const StyledTextField = styled(NumberTextFieldCustom)(({ theme }) => ({
51
+ width: '130px',
52
+ margin: `${theme.spacing(1)} ${theme.spacing(0.5)}`,
53
+ }));
54
+
55
+ const StyledMediumTextField = styled(NumberTextFieldCustom)(({ theme }) => ({
56
+ width: '160px',
57
+ margin: `${theme.spacing(1)} ${theme.spacing(0.5)}`,
58
+ }));
59
+
60
+ const StyledDimensions = styled('div')(({ theme }) => ({
61
+ display: 'flex',
62
+ justifyContent: 'space-between',
63
+ alignItems: 'center',
64
+ margin: `${theme.spacing(3)} 0`,
65
+ }));
66
+
67
+ const StyledDisabled = styled(Typography)(() => ({
68
+ color: color.disabled(),
69
+ }));
70
+
27
71
  const ConfigureChartPanel = (props) => {
28
72
  const {
29
- classes,
30
73
  model,
31
74
  onChange,
32
75
  chartDimensions,
@@ -67,24 +110,22 @@ const ConfigureChartPanel = (props) => {
67
110
  const labelOptions = labelValues && labelValues.range ? { customValues: labelValues.range } : { min: 0, max: 10000 };
68
111
 
69
112
  const stepConfig = (
70
- <div className={classes.rowView}>
71
- <NumberTextFieldCustom
72
- className={classes.mediumTextField}
113
+ <StyledRowView>
114
+ <StyledMediumTextField
73
115
  label="Grid Interval"
74
116
  value={range.step}
75
117
  variant="outlined"
76
118
  onChange={(e, v) => onRangeChanged('step', v, e)}
77
119
  {...gridOptions}
78
120
  />
79
- <NumberTextFieldCustom
80
- className={classes.mediumTextField}
121
+ <StyledMediumTextField
81
122
  label={'Label Interval'}
82
123
  value={range.labelStep}
83
124
  variant={'outlined'}
84
125
  onChange={(e, v) => onRangeChanged('labelStep', v, e)}
85
126
  {...labelOptions}
86
127
  />
87
- </div>
128
+ </StyledRowView>
88
129
  );
89
130
 
90
131
  const handleAlertDialog = (openStatus, callback) => {
@@ -236,18 +277,17 @@ const ConfigureChartPanel = (props) => {
236
277
  };
237
278
 
238
279
  return (
239
- <div className={classes.wrapper}>
280
+ <StyledWrapper>
240
281
  <Typography variant={'subtitle1'}>Configure Chart</Typography>
241
- <div className={classes.content}>
242
- <div className={classes.rowView}>
282
+ <StyledContent>
283
+ <StyledRowView>
243
284
  <ChartType
244
285
  value={model.chartType}
245
286
  onChange={(e) => onChartTypeChange(e.target.value)}
246
287
  availableChartTypes={availableChartTypes}
247
288
  chartTypeLabel={chartTypeLabel}
248
289
  />
249
- <NumberTextFieldCustom
250
- className={classes.mediumTextField}
290
+ <StyledMediumTextField
251
291
  label="Max Value"
252
292
  value={range.max}
253
293
  min={rangeProps(model.chartType).min}
@@ -255,18 +295,17 @@ const ConfigureChartPanel = (props) => {
255
295
  variant="outlined"
256
296
  onChange={(e, v) => onRangeChanged('max', v, e)}
257
297
  />
258
- </div>
298
+ </StyledRowView>
259
299
  {!model.chartType.includes('Plot') && stepConfig}
260
300
 
261
301
  {showInConfigPanel && (
262
- <div className={classes.dimensions}>
302
+ <StyledDimensions>
263
303
  <div>
264
304
  <Typography>Dimensions(px)</Typography>
265
305
  </div>
266
306
 
267
- <div className={classes.columnView}>
268
- <NumberTextFieldCustom
269
- className={classes.textField}
307
+ <StyledColumnView>
308
+ <StyledTextField
270
309
  label={'Width'}
271
310
  value={size.width}
272
311
  min={widthConstraints.min}
@@ -275,12 +314,11 @@ const ConfigureChartPanel = (props) => {
275
314
  variant={'outlined'}
276
315
  onChange={(e, v) => onSizeChanged('width', v)}
277
316
  />
278
- <Typography className={classes.disabled}>Min 50, Max 700</Typography>
279
- </div>
317
+ <StyledDisabled>Min 50, Max 700</StyledDisabled>
318
+ </StyledColumnView>
280
319
 
281
- <div className={classes.columnView}>
282
- <NumberTextFieldCustom
283
- className={classes.textField}
320
+ <StyledColumnView>
321
+ <StyledTextField
284
322
  label={'Height'}
285
323
  value={size.height}
286
324
  min={heightConstraints.min}
@@ -289,11 +327,11 @@ const ConfigureChartPanel = (props) => {
289
327
  variant={'outlined'}
290
328
  onChange={(e, v) => onSizeChanged('height', v)}
291
329
  />
292
- <Typography className={classes.disabled}>Min 400, Max 700</Typography>
293
- </div>
294
- </div>
330
+ <StyledDisabled>Min 400, Max 700</StyledDisabled>
331
+ </StyledColumnView>
332
+ </StyledDimensions>
295
333
  )}
296
- </div>
334
+ </StyledContent>
297
335
 
298
336
  <AlertDialog
299
337
  open={alertDialog.open}
@@ -302,12 +340,11 @@ const ConfigureChartPanel = (props) => {
302
340
  onClose={alertDialog.onClose}
303
341
  onConfirm={alertDialog.onConfirm}
304
342
  />
305
- </div>
343
+ </StyledWrapper>
306
344
  );
307
345
  };
308
346
 
309
347
  ConfigureChartPanel.propTypes = {
310
- classes: PropTypes.object,
311
348
  chartDimensions: PropTypes.object,
312
349
  domain: PropTypes.object,
313
350
  gridValues: PropTypes.object,
@@ -322,51 +359,4 @@ ConfigureChartPanel.propTypes = {
322
359
  chartTypeLabel: PropTypes.string,
323
360
  };
324
361
 
325
- const styles = (theme) => ({
326
- wrapper: {
327
- width: '450px',
328
- },
329
- content: {
330
- display: 'flex',
331
- flexDirection: 'column',
332
- width: '100%',
333
- marginTop: theme.spacing.unit * 3,
334
- },
335
- columnView: {
336
- display: 'flex',
337
- flexDirection: 'column',
338
- alignItems: 'center',
339
- },
340
- rowView: {
341
- display: 'flex',
342
- justifyContent: 'space-around',
343
- alignItems: 'center',
344
- },
345
- textField: {
346
- width: '130px',
347
- margin: `${theme.spacing.unit}px ${theme.spacing.unit / 2}px`,
348
- },
349
- mediumTextField: {
350
- width: '160px',
351
- margin: `${theme.spacing.unit}px ${theme.spacing.unit / 2}px`,
352
- },
353
- largeTextField: {
354
- width: '230px',
355
- margin: `${theme.spacing.unit}px ${theme.spacing.unit / 2}px`,
356
- },
357
- text: {
358
- fontStyle: 'italic',
359
- margin: `${theme.spacing.unit}px 0`,
360
- },
361
- dimensions: {
362
- display: 'flex',
363
- justifyContent: 'space-between',
364
- alignItems: 'center',
365
- margin: `${theme.spacing.unit * 3}px 0`,
366
- },
367
- disabled: {
368
- color: color.disabled(),
369
- },
370
- });
371
-
372
- export default withStyles(styles)(ConfigureChartPanel);
362
+ export default ConfigureChartPanel;
package/src/chart-type.js CHANGED
@@ -1,24 +1,29 @@
1
1
  import React from 'react';
2
- import { withStyles } from '@material-ui/core/styles';
3
- import MenuItem from '@material-ui/core/MenuItem';
4
- import FormControl from '@material-ui/core/FormControl';
5
- import InputLabel from '@material-ui/core/InputLabel';
6
- import Select from '@material-ui/core/Select';
7
- import OutlinedInput from '@material-ui/core/OutlinedInput';
2
+ import { styled } from '@mui/material/styles';
3
+ import MenuItem from '@mui/material/MenuItem';
4
+ import FormControl from '@mui/material/FormControl';
5
+ import InputLabel from '@mui/material/InputLabel';
6
+ import Select from '@mui/material/Select';
7
+ import OutlinedInput from '@mui/material/OutlinedInput';
8
8
 
9
- const ChartType = withStyles(() => ({
10
- chartType: {
11
- width: '160px',
12
- },
13
- chartTypeLabel: {
14
- backgroundColor: 'transparent',
15
- },
16
- }))(({ onChange, value, classes, availableChartTypes, chartTypeLabel }) => (
17
- <div className={classes.chartType}>
18
- <FormControl variant={'outlined'} className={classes.chartType}>
19
- <InputLabel id="type-helper-label" className={classes.chartTypeLabel}>
9
+ const StyledContainer = styled('div')(() => ({
10
+ width: '160px',
11
+ }));
12
+
13
+ const StyledFormControl = styled(FormControl)(() => ({
14
+ width: '160px',
15
+ }));
16
+
17
+ const StyledInputLabel = styled(InputLabel)(() => ({
18
+ backgroundColor: 'transparent',
19
+ }));
20
+
21
+ const ChartType = ({ onChange, value, availableChartTypes, chartTypeLabel }) => (
22
+ <StyledContainer>
23
+ <StyledFormControl variant={'outlined'}>
24
+ <StyledInputLabel id="type-helper-label">
20
25
  {chartTypeLabel}
21
- </InputLabel>
26
+ </StyledInputLabel>
22
27
  <Select
23
28
  labelId="type-helper-label"
24
29
  value={value}
@@ -32,8 +37,8 @@ const ChartType = withStyles(() => ({
32
37
  {availableChartTypes?.dotPlot && <MenuItem value={'dotPlot'}>{availableChartTypes.dotPlot}</MenuItem>}
33
38
  {availableChartTypes?.linePlot && <MenuItem value={'linePlot'}>{availableChartTypes.linePlot}</MenuItem>}
34
39
  </Select>
35
- </FormControl>
36
- </div>
37
- ));
40
+ </StyledFormControl>
41
+ </StyledContainer>
42
+ );
38
43
 
39
44
  export default ChartType;