@pie-lib/charting 5.36.2-next.0 → 5.38.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 +26 -15
  2. package/lib/actions-button.js +60 -90
  3. package/lib/actions-button.js.map +1 -1
  4. package/lib/axes.js +154 -234
  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 +38 -43
  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 +43 -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 +44 -39
  58. package/src/axes.jsx +61 -75
  59. package/src/bars/common/bars.jsx +8 -23
  60. package/src/chart-setup.jsx +68 -78
  61. package/src/chart-type.js +29 -22
  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 +16 -9
  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,51 @@ 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
+ const StyledAxesGroup = styled('g')(({ theme }) => ({
26
+ '& .vx-axis-line': {
27
+ stroke: color.visualElementsColors.AXIS_LINE_COLOR,
28
+ strokeWidth: 2,
29
+ },
30
+ '& .vx-axis-tick': {
31
+ fill: color.visualElementsColors.AXIS_TICK_COLOR,
32
+ '& line': {
33
+ stroke: color.visualElementsColors.AXIS_TICK_COLOR,
34
+ strokeWidth: 2,
35
+ },
36
+ fontFamily: theme.typography.body1?.fontFamily,
37
+ fontSize: theme.typography.fontSize,
38
+ textAnchor: 'middle',
39
+ },
40
+ }));
41
+
42
+ const correctnessIconStyles = (theme) => ({
43
+ borderRadius: theme.spacing(2),
44
+ color: color.defaults.WHITE,
45
+ fontSize: '16px',
46
+ width: '16px',
47
+ height: '16px',
48
+ padding: '2px',
49
+ border: `1px solid ${color.defaults.WHITE}`,
50
+ boxSizing: 'unset', // to override the default border-box in IBX
51
+ });
52
+
53
+ const incorrectIconStyles = {
54
+ backgroundColor: color.incorrectWithIcon(),
55
+ };
56
+
57
+ const correctIconStyles = {
58
+ backgroundColor: color.correct(),
59
+ };
60
+
16
61
  export class TickComponent extends React.Component {
17
62
  static propTypes = {
18
63
  defineChart: PropTypes.bool,
@@ -112,7 +157,6 @@ export class TickComponent extends React.Component {
112
157
 
113
158
  render() {
114
159
  const {
115
- classes,
116
160
  categories,
117
161
  xBand,
118
162
  bandWidth,
@@ -137,6 +181,13 @@ export class TickComponent extends React.Component {
137
181
  return null;
138
182
  }
139
183
 
184
+ // Create classes object for TickCorrectnessIndicator compatibility
185
+ const classes = {
186
+ correctnessIcon: correctnessIconStyles,
187
+ incorrectIcon: incorrectIconStyles,
188
+ correctIcon: correctIconStyles,
189
+ };
190
+
140
191
  const { dialog } = this.state;
141
192
  const { changeEditable, changeInteractive } = chartingOptions || {};
142
193
  const index = parseInt(formattedValue.split('-')[0], 10);
@@ -193,9 +244,9 @@ export class TickComponent extends React.Component {
193
244
  </foreignObject>
194
245
 
195
246
  {error && index === 0 && (
196
- <text className={classes.error} y={y + 23} height={6} textAnchor="start">
247
+ <StyledErrorText y={y + 23} height={6} textAnchor="start">
197
248
  {distinctMessages}
198
- </text>
249
+ </StyledErrorText>
199
250
  )}
200
251
 
201
252
  {defineChart && index === 0 && (
@@ -257,8 +308,7 @@ export class TickComponent extends React.Component {
257
308
  height={4}
258
309
  style={{ pointerEvents: 'visible', overflow: 'visible' }}
259
310
  >
260
- <Checkbox
261
- className={classes.customColor}
311
+ <StyledCheckbox
262
312
  style={{ position: 'fixed' }}
263
313
  checked={interactive}
264
314
  onChange={(e) => this.changeInteractive(index, e.target.checked)}
@@ -274,8 +324,7 @@ export class TickComponent extends React.Component {
274
324
  height={4}
275
325
  style={{ pointerEvents: 'visible', overflow: 'visible' }}
276
326
  >
277
- <Checkbox
278
- className={classes.customColor}
327
+ <StyledCheckbox
279
328
  style={{ position: 'fixed' }}
280
329
  checked={editable}
281
330
  onChange={(e) => this.changeEditable(index, e.target.checked)}
@@ -316,7 +365,6 @@ TickComponent.propTypes = {
316
365
  formattedValue: PropTypes.string,
317
366
  onChangeCategory: PropTypes.func,
318
367
  onChange: PropTypes.func,
319
- classes: PropTypes.object,
320
368
  error: PropTypes.object,
321
369
  defineChart: PropTypes.bool,
322
370
  chartingOptions: PropTypes.object,
@@ -330,7 +378,6 @@ TickComponent.propTypes = {
330
378
  export class RawChartAxes extends React.Component {
331
379
  static propTypes = {
332
380
  bottomScale: PropTypes.func,
333
- classes: PropTypes.object.isRequired,
334
381
  categories: PropTypes.array,
335
382
  defineChart: PropTypes.bool,
336
383
  error: PropTypes.any,
@@ -386,7 +433,6 @@ export class RawChartAxes extends React.Component {
386
433
 
387
434
  render() {
388
435
  const {
389
- classes,
390
436
  graphProps,
391
437
  xBand,
392
438
  leftAxis,
@@ -405,7 +451,6 @@ export class RawChartAxes extends React.Component {
405
451
  showCorrectness,
406
452
  } = this.props;
407
453
 
408
- const { axis, axisLine, tick } = classes;
409
454
  const { scale = {}, range = {}, domain = {}, size = {} } = graphProps || {};
410
455
  const { height, width } = this.state;
411
456
 
@@ -432,7 +477,6 @@ export class RawChartAxes extends React.Component {
432
477
  hiddenLabelRef: (ref) => {
433
478
  this.hiddenLabelRef = ref;
434
479
  },
435
- classes,
436
480
  categories,
437
481
  xBand,
438
482
  bandWidth,
@@ -459,22 +503,17 @@ export class RawChartAxes extends React.Component {
459
503
  };
460
504
 
461
505
  return (
462
- <React.Fragment>
506
+ <StyledAxesGroup>
463
507
  {leftAxis && (
464
508
  <AxisLeft
465
509
  scale={scale.y}
466
- className={axis}
467
- axisLineClassName={axisLine}
468
510
  tickLength={10}
469
- tickClassName={tick}
470
511
  tickFormat={(value) => value}
471
512
  tickValues={rowTickValues}
472
513
  tickLabelProps={getTickLabelProps}
473
514
  />
474
515
  )}
475
516
  <AxisBottom
476
- axisLineClassName={axisLine}
477
- tickClassName={tick}
478
517
  scale={bottomScale}
479
518
  labelProps={{ y: 60 + top }}
480
519
  top={scale.y && scale.y(range.min)}
@@ -484,64 +523,11 @@ export class RawChartAxes extends React.Component {
484
523
  autoFocus={autoFocus}
485
524
  onAutoFocusUsed={onAutoFocusUsed}
486
525
  />
487
- </React.Fragment>
526
+ </StyledAxesGroup>
488
527
  );
489
528
  }
490
529
  }
491
530
 
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);
531
+ const ChartAxes = styled(RawChartAxes)(({ theme }) => ({}));
546
532
 
547
533
  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,29 +1,36 @@
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';
8
7
 
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}>
8
+ const StyledContainer = styled('div')(() => ({
9
+ width: '160px',
10
+ }));
11
+
12
+ const StyledFormControl = styled(FormControl)(() => ({
13
+ width: '160px',
14
+ }));
15
+
16
+ const StyledInputLabel = styled(InputLabel)(() => ({
17
+ backgroundColor: 'transparent',
18
+ }));
19
+
20
+ const ChartType = ({ onChange, value, availableChartTypes, chartTypeLabel }) => (
21
+ <StyledContainer>
22
+ <StyledFormControl variant={'outlined'}>
23
+ <StyledInputLabel id="type-helper-label">
20
24
  {chartTypeLabel}
21
- </InputLabel>
25
+ </StyledInputLabel>
22
26
  <Select
23
27
  labelId="type-helper-label"
28
+ id="type-helper-label-select"
29
+ name="chartType"
24
30
  value={value}
25
31
  onChange={onChange}
26
- input={<OutlinedInput labelWidth={75} name="type" />}
32
+ label={chartTypeLabel}
33
+ MenuProps={{transitionDuration: { enter: 225, exit: 195 }}}
27
34
  >
28
35
  {availableChartTypes?.histogram && <MenuItem value={'histogram'}>{availableChartTypes.histogram}</MenuItem>}
29
36
  {availableChartTypes?.bar && <MenuItem value={'bar'}>{availableChartTypes.bar}</MenuItem>}
@@ -32,8 +39,8 @@ const ChartType = withStyles(() => ({
32
39
  {availableChartTypes?.dotPlot && <MenuItem value={'dotPlot'}>{availableChartTypes.dotPlot}</MenuItem>}
33
40
  {availableChartTypes?.linePlot && <MenuItem value={'linePlot'}>{availableChartTypes.linePlot}</MenuItem>}
34
41
  </Select>
35
- </FormControl>
36
- </div>
37
- ));
42
+ </StyledFormControl>
43
+ </StyledContainer>
44
+ );
38
45
 
39
46
  export default ChartType;