@pie-lib/charting 5.36.1 → 5.37.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 +14 -20
  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 +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 +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 +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
@@ -4,7 +4,7 @@ import { LinePath } from '@vx/shape';
4
4
  import PropTypes from 'prop-types';
5
5
  import { types } from '@pie-lib/plot';
6
6
  import DraggableHandle, { DragHandle } from './drag-handle';
7
- import { withStyles } from '@material-ui/core/styles/index';
7
+ import { styled } from '@mui/material/styles';
8
8
  import isEqual from 'lodash/isEqual';
9
9
  import { color } from '@pie-lib/render-ui';
10
10
 
@@ -23,11 +23,17 @@ const getData = (data, domain) => {
23
23
  }));
24
24
  };
25
25
 
26
+ const StyledLinePath = styled(LinePath)(() => ({
27
+ fill: 'transparent',
28
+ stroke: color.defaults.TERTIARY,
29
+ strokeWidth: 3,
30
+ transition: 'stroke 200ms ease-in, stroke-width 200ms ease-in',
31
+ }));
32
+
26
33
  export class RawLine extends React.Component {
27
34
  static propTypes = {
28
35
  onChange: PropTypes.func,
29
36
  value: PropTypes.number,
30
- classes: PropTypes.object,
31
37
  label: PropTypes.string,
32
38
  xBand: PropTypes.func,
33
39
  index: PropTypes.number.isRequired,
@@ -78,18 +84,19 @@ export class RawLine extends React.Component {
78
84
  };
79
85
 
80
86
  render() {
81
- const { graphProps, data, classes, CustomDraggableComponent, defineChart, correctData } = this.props;
87
+ const { graphProps, data, CustomDraggableComponent, defineChart, correctData } = this.props;
82
88
  const { line: lineState, dragging } = this.state;
83
89
  const { scale } = graphProps;
84
90
  const lineToUse = dragging ? lineState : getData(data, graphProps.domain);
85
91
 
92
+ console.log('defineChart', lineToUse);
86
93
  return (
87
94
  <React.Fragment>
88
- <LinePath
95
+ <StyledLinePath
89
96
  data={lineToUse}
90
97
  x={(d) => scale.x(d.x)}
91
98
  y={(d) => scale.y(d.dragValue !== undefined ? d.dragValue : d.y)}
92
- className={classes.line}
99
+ className="line"
93
100
  />
94
101
  {lineToUse &&
95
102
  lineToUse.map((point, i) => {
@@ -97,6 +104,8 @@ export class RawLine extends React.Component {
97
104
  const enableDraggable = defineChart || point.interactive;
98
105
  const Component = enableDraggable ? DraggableHandle : DragHandle;
99
106
 
107
+ console.log('point', point);
108
+
100
109
  return (
101
110
  <Component
102
111
  key={`point-${point.x}-${i}`}
@@ -120,14 +129,14 @@ export class RawLine extends React.Component {
120
129
  }
121
130
  }
122
131
 
123
- const StyledLine = withStyles(() => ({
124
- line: {
132
+ const StyledLine = styled(RawLine)(() => ({
133
+ '& .line': {
125
134
  fill: 'transparent',
126
135
  stroke: color.defaults.TERTIARY,
127
136
  strokeWidth: 3,
128
137
  transition: 'stroke 200ms ease-in, stroke-width 200ms ease-in',
129
138
  },
130
- }))(RawLine);
139
+ }));
131
140
 
132
141
  export class Line extends React.Component {
133
142
  static propTypes = {
@@ -2,7 +2,7 @@ import React, { useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { LinePath } from '@vx/shape';
4
4
  import { Group } from '@vx/group';
5
- import classNames from 'classnames';
5
+ import { styled } from '@mui/material/styles';
6
6
 
7
7
  import { color } from '@pie-lib/render-ui';
8
8
  import { dataToXBand } from '../utils';
@@ -10,18 +10,44 @@ import { types } from '@pie-lib/plot';
10
10
  import RawLine from './common/line';
11
11
  import { CorrectnessIndicator, SmallCorrectPointIndicator } from '../common/correctness-indicators';
12
12
 
13
+ const StyledLinePath = styled(LinePath)(() => ({
14
+ stroke: color.defaults.TEXT,
15
+ transition: 'fill 200ms linear, height 200ms linear',
16
+ '&.non-interactive': {
17
+ stroke: color.disabled?.() || '#ccc',
18
+ },
19
+ }));
20
+
21
+ const StyledGroup = styled(Group)(({ correctness, interactive }) => ({
22
+ stroke: color.defaults.TEXT,
23
+ transition: 'fill 200ms linear, height 200ms linear',
24
+ ...(correctness && !interactive && {
25
+ fill: `${color.defaults.BLACK} !important`,
26
+ stroke: `${color.defaults.BLACK} !important`,
27
+ }),
28
+ '&.non-interactive': {
29
+ stroke: color.disabled?.() || '#ccc',
30
+ },
31
+ }));
32
+
33
+ const StyledTransparentHandle = styled('circle')(() => ({
34
+ height: '20px',
35
+ fill: 'transparent',
36
+ stroke: 'transparent',
37
+ }));
38
+
13
39
  const DraggableComponent = (props) => {
14
- const { classes = {}, className, scale, x, y, r, correctness, interactive, correctData, label, ...rest } = props;
40
+ const { className, scale, x, y, r, correctness, interactive, correctData, label, ...rest } = props;
15
41
  const [hover, setHover] = useState(false);
16
42
 
17
43
  const squareSize = r * 4;
18
44
  const squareHalf = squareSize / 2;
19
45
  const cx = scale.x(x);
20
46
  const cy = scale.y(y);
21
-
47
+
22
48
  return (
23
- <Group className={classNames(className, classes.line, correctness && !interactive && classes.disabledPoint)}>
24
- <LinePath
49
+ <StyledGroup className={className} correctness={correctness} interactive={interactive}>
50
+ <StyledLinePath
25
51
  data={[
26
52
  { x: scale.x(x) - r, y: scale.y(y) + r },
27
53
  { x: scale.x(x) + r, y: scale.y(y) - r },
@@ -32,7 +58,7 @@ const DraggableComponent = (props) => {
32
58
  strokeWidth={5}
33
59
  style={{ pointerEvents: 'none' }}
34
60
  />
35
- <LinePath
61
+ <StyledLinePath
36
62
  data={[
37
63
  { x: scale.x(x) - r, y: scale.y(y) - r },
38
64
  { x: scale.x(x) + r, y: scale.y(y) + r },
@@ -55,11 +81,10 @@ const DraggableComponent = (props) => {
55
81
  pointerEvents="none"
56
82
  />
57
83
  )}
58
- <circle
84
+ <StyledTransparentHandle
59
85
  cx={cx}
60
86
  cy={cy}
61
87
  r={r * 2}
62
- className={classNames(classes.transparentHandle)}
63
88
  onMouseEnter={() => setHover(true)}
64
89
  onMouseLeave={() => setHover(false)}
65
90
  {...rest}
@@ -69,7 +94,6 @@ const DraggableComponent = (props) => {
69
94
  scale={scale}
70
95
  x={x}
71
96
  y={y}
72
- classes={classes}
73
97
  r={r}
74
98
  correctness={correctness}
75
99
  interactive={interactive}
@@ -80,11 +104,10 @@ const DraggableComponent = (props) => {
80
104
  x={x}
81
105
  r={r}
82
106
  correctness={correctness}
83
- classes={classes}
84
107
  correctData={correctData}
85
108
  label={label}
86
109
  />
87
- </Group>
110
+ </StyledGroup>
88
111
  );
89
112
  };
90
113
 
@@ -94,11 +117,13 @@ DraggableComponent.propTypes = {
94
117
  y: PropTypes.number,
95
118
  r: PropTypes.number,
96
119
  className: PropTypes.string,
97
- classes: PropTypes.object,
98
120
  correctness: PropTypes.shape({
99
121
  value: PropTypes.string,
100
122
  label: PropTypes.string,
101
123
  }),
124
+ interactive: PropTypes.bool,
125
+ correctData: PropTypes.array,
126
+ label: PropTypes.string,
102
127
  };
103
128
 
104
129
  export class LineCross extends React.Component {
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import classNames from 'classnames';
3
+ import { styled } from '@mui/material/styles';
4
4
 
5
5
  import { types } from '@pie-lib/plot';
6
6
  import { color } from '@pie-lib/render-ui';
@@ -8,12 +8,23 @@ import { dataToXBand } from '../utils';
8
8
  import RawLine from './common/line';
9
9
  import { CorrectnessIndicator, SmallCorrectPointIndicator } from '../common/correctness-indicators';
10
10
 
11
+
12
+ const StyledHandle = styled('circle')(({ correctness, interactive }) => ({
13
+ }));
14
+
15
+
16
+ const StyledTransparentHandle = styled('circle')(() => ({
17
+ height: '20px',
18
+ fill: 'transparent', // keep it invisible
19
+ stroke: 'none',
20
+ pointerEvents: 'auto', // allow drag events
21
+ }));
22
+
11
23
  const DraggableComponent = ({
12
24
  scale,
13
25
  x,
14
26
  y,
15
27
  className,
16
- classes,
17
28
  r,
18
29
  correctness,
19
30
  interactive,
@@ -25,20 +36,28 @@ const DraggableComponent = ({
25
36
  const allowRolloverEvent = !correctness && interactive;
26
37
 
27
38
  return (
28
- <g onMouseEnter={() => setIsHovered(true)} onMouseLeave={() => setIsHovered(false)}>
29
- <circle
39
+ <g
40
+ onMouseEnter={() => setIsHovered(true)}
41
+ onMouseLeave={() => setIsHovered(false)}
42
+ onTouchStart={() => setIsHovered(true)}
43
+ onTouchEnd={() => setIsHovered(false)}
44
+ >
45
+ <StyledTransparentHandle
30
46
  cx={scale.x(x)}
31
47
  cy={scale.y(y)}
32
48
  r={r * 3}
33
- className={classNames(classes.transparentHandle, className)}
34
- pointerEvents={correctness ? 'none' : ''}
49
+ className={className}
50
+ onMouseEnter={() => setIsHovered(true)}
51
+ onMouseLeave={() => setIsHovered(false)}
35
52
  {...rest}
36
53
  />
37
- <circle
54
+ <StyledHandle
38
55
  cx={scale.x(x)}
39
56
  cy={scale.y(y)}
40
57
  r={r}
41
- className={classNames(className, classes.handle, correctness && !interactive && classes.disabledPoint)}
58
+ className={className}
59
+ correctness={correctness}
60
+ interactive={interactive}
42
61
  {...rest}
43
62
  />
44
63
  {/* show correctness indicators */}
@@ -46,7 +65,6 @@ const DraggableComponent = ({
46
65
  scale={scale}
47
66
  x={x}
48
67
  y={y}
49
- classes={classes}
50
68
  r={r}
51
69
  correctness={correctness}
52
70
  interactive={interactive}
@@ -58,7 +76,6 @@ const DraggableComponent = ({
58
76
  x={x}
59
77
  r={r}
60
78
  correctness={correctness}
61
- classes={classes}
62
79
  correctData={correctData}
63
80
  label={label}
64
81
  />
@@ -85,11 +102,13 @@ DraggableComponent.propTypes = {
85
102
  y: PropTypes.number,
86
103
  r: PropTypes.number,
87
104
  className: PropTypes.string,
88
- classes: PropTypes.object,
89
105
  correctness: PropTypes.shape({
90
106
  value: PropTypes.string,
91
107
  label: PropTypes.string,
92
108
  }),
109
+ interactive: PropTypes.bool,
110
+ correctData: PropTypes.array,
111
+ label: PropTypes.string,
93
112
  };
94
113
 
95
114
  export class LineDot extends React.Component {
@@ -1,6 +1,6 @@
1
1
  import React, { useState, useCallback, useEffect, useRef } from 'react';
2
2
  import classNames from 'classnames';
3
- import { withStyles } from '@material-ui/core/styles';
3
+ import { styled } from '@mui/material/styles';
4
4
  import AutosizeInput from 'react-input-autosize';
5
5
  import PropTypes from 'prop-types';
6
6
 
@@ -9,46 +9,46 @@ import { correct, incorrect, disabled } from './common/styles';
9
9
  import { color } from '@pie-lib/render-ui';
10
10
  import { renderMath } from '@pie-lib/math-rendering';
11
11
 
12
- const styles = (theme) => ({
13
- input: {
14
- float: 'right',
15
- fontFamily: theme.typography.fontFamily,
16
- fontSize: theme.typography.fontSize,
17
- border: 'none',
18
- '&.correct': correct('color'),
19
- '&.incorrect': incorrect('color'),
20
- '&.disabled': {
21
- backgroundColor: 'transparent !important',
22
- },
23
- '&.error': { border: `2px solid ${theme.palette.error.main}` },
24
- },
25
- mathInput: {
26
- pointerEvents: 'auto',
27
- textAlign: 'center',
28
- fontSize: theme.typography.fontSize + 2,
29
- fontFamily: theme.typography.fontFamily,
30
- color: color.primaryDark(),
31
- paddingTop: theme.typography.fontSize / 2,
12
+ const StyledContainer = styled('div')({
13
+ display: 'flex',
14
+ flexDirection: 'column',
15
+ alignItems: 'center',
16
+ });
17
+
18
+ const StyledInput = styled('input')(({ theme }) => ({
19
+ float: 'right',
20
+ fontFamily: theme.typography.fontFamily,
21
+ fontSize: theme.typography.fontSize,
22
+ border: 'none',
23
+ '&.correct': correct('color'),
24
+ '&.incorrect': incorrect('color'),
25
+ '&.disabled': {
26
+ backgroundColor: 'transparent !important',
32
27
  },
33
- disabled: {
28
+ '&.error': { border: `2px solid ${theme.palette.error.main}` },
29
+ }));
30
+
31
+ const StyledMathInput = styled('div')(({ theme }) => ({
32
+ pointerEvents: 'auto',
33
+ textAlign: 'center',
34
+ fontSize: theme.typography.fontSize + 2,
35
+ fontFamily: theme.typography.fontFamily,
36
+ color: color.primaryDark(),
37
+ paddingTop: theme.typography.fontSize / 2,
38
+ '&.disabled': {
34
39
  ...disabled('color'),
35
40
  backgroundColor: 'transparent !important',
36
41
  },
37
- error: {
42
+ '&.error': {
38
43
  border: `2px solid ${theme.palette.error.main}`,
39
44
  },
40
- correct: {
45
+ '&.correct': {
41
46
  ...correct('color'),
42
47
  },
43
- incorrect: {
48
+ '&.incorrect': {
44
49
  ...incorrect('color'),
45
50
  },
46
- flexContainer: {
47
- display: 'flex',
48
- flexDirection: 'column',
49
- alignItems: 'center',
50
- },
51
- });
51
+ }));
52
52
 
53
53
  function isFractionFormat(label) {
54
54
  const trimmedLabel = label?.trim() || '';
@@ -85,7 +85,6 @@ export const MarkLabel = (props) => {
85
85
 
86
86
  const {
87
87
  mark,
88
- classes,
89
88
  disabled,
90
89
  inputRef: externalInputRef,
91
90
  barWidth,
@@ -139,20 +138,20 @@ export const MarkLabel = (props) => {
139
138
  }, []);
140
139
 
141
140
  return (
142
- <div className={classes.flexContainer}>
141
+ <StyledContainer>
143
142
  {correctnessIndicator}
144
143
  {isMathRendering() ? (
145
- <div
144
+ <StyledMathInput
146
145
  ref={(r) => {
147
146
  root = r;
148
147
  externalInputRef(r);
149
148
  }}
150
149
  dangerouslySetInnerHTML={{ __html: getLabelMathFormat(label) }}
151
- className={classNames(classes.mathInput, {
152
- [classes.disabled]: disabled,
153
- [classes.error]: error,
154
- [classes.correct]: mark.editable && correctness?.label === 'correct',
155
- [classes.incorrect]: mark.editable && correctness?.label === 'incorrect',
150
+ className={classNames({
151
+ disabled: disabled,
152
+ error: error,
153
+ correct: mark.editable && correctness?.label === 'correct',
154
+ incorrect: mark.editable && correctness?.label === 'incorrect',
156
155
  })}
157
156
  onClick={() => setIsEditing(true)}
158
157
  style={{
@@ -163,17 +162,17 @@ export const MarkLabel = (props) => {
163
162
  visibility: isHiddenLabel ? 'hidden' : 'unset',
164
163
  marginTop: correctnessIndicator ? '24px' : '0',
165
164
  }}
166
- ></div>
165
+ ></StyledMathInput>
167
166
  ) : (
168
167
  <AutosizeInput
169
168
  inputRef={(r) => {
170
169
  _ref(r);
171
170
  externalInputRef(r);
172
171
  }}
172
+ name='mark-label-input'
173
173
  autoFocus={isEditing || autoFocus}
174
174
  disabled={disabled}
175
175
  inputClassName={classNames(
176
- classes.input,
177
176
  correctness && mark.editable ? correctness.label : null,
178
177
  disabled && 'disabled',
179
178
  error && 'error',
@@ -185,6 +184,7 @@ export const MarkLabel = (props) => {
185
184
  boxSizing: 'border-box',
186
185
  paddingLeft: 0,
187
186
  paddingRight: 0,
187
+ border: 'none',
188
188
  ...extraStyle,
189
189
  }}
190
190
  value={label}
@@ -203,7 +203,7 @@ export const MarkLabel = (props) => {
203
203
  onBlur={onChangeProp}
204
204
  />
205
205
  )}
206
- </div>
206
+ </StyledContainer>
207
207
  );
208
208
  };
209
209
 
@@ -213,7 +213,6 @@ MarkLabel.propTypes = {
213
213
  error: PropTypes.any,
214
214
  onChange: PropTypes.func,
215
215
  graphProps: types.GraphPropsType,
216
- classes: PropTypes.object,
217
216
  inputRef: PropTypes.func,
218
217
  mark: PropTypes.object,
219
218
  barWidth: PropTypes.number,
@@ -227,4 +226,4 @@ MarkLabel.propTypes = {
227
226
  correctnessIndicator: PropTypes.node,
228
227
  };
229
228
 
230
- export default withStyles(styles)(MarkLabel);
229
+ export default MarkLabel;
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import classNames from 'classnames';
4
- import Check from '@material-ui/icons/Check';
5
- import { withStyles } from '@material-ui/core/styles/index';
4
+ import Check from '@mui/icons-material/Check';
5
+ import { styled } from '@mui/material/styles';
6
6
  import { Group } from '@vx/group';
7
7
  import debug from 'debug';
8
8
 
@@ -19,7 +19,6 @@ export class RawPlot extends React.Component {
19
19
  static propTypes = {
20
20
  onChangeCategory: PropTypes.func,
21
21
  value: PropTypes.number,
22
- classes: PropTypes.object,
23
22
  label: PropTypes.string,
24
23
  xBand: PropTypes.func,
25
24
  index: PropTypes.number.isRequired,
@@ -68,7 +67,7 @@ export class RawPlot extends React.Component {
68
67
  this.setDragValue(next);
69
68
  };
70
69
 
71
- renderCorrectnessIcon = (barX, barWidth, correctVal, correctness, classes, scale, pointHeight, pointDiameter) => {
70
+ renderCorrectnessIcon = (barX, barWidth, correctVal, correctness, scale, pointHeight, pointDiameter) => {
72
71
  let iconY;
73
72
 
74
73
  if (correctVal === 0) {
@@ -83,7 +82,7 @@ export class RawPlot extends React.Component {
83
82
  return (
84
83
  <foreignObject x={barX + barWidth / 2 - ICON_SIZE / 2} y={iconY} width={ICON_SIZE} height={ICON_SIZE}>
85
84
  <Check
86
- className={classNames(classes.correctnessIcon, classes.correctIcon, classes.smallIcon)}
85
+ className={classNames('correctnessIcon', 'correctIcon', 'smallIcon')}
87
86
  title={correctness.label}
88
87
  />
89
88
  </foreignObject>
@@ -95,7 +94,6 @@ export class RawPlot extends React.Component {
95
94
  graphProps,
96
95
  value,
97
96
  label,
98
- classes,
99
97
  xBand,
100
98
  index,
101
99
  CustomBarElement,
@@ -103,6 +101,7 @@ export class RawPlot extends React.Component {
103
101
  correctness,
104
102
  defineChart,
105
103
  correctData,
104
+ className
106
105
  } = this.props;
107
106
 
108
107
  const { scale, range, size } = graphProps;
@@ -130,6 +129,7 @@ export class RawPlot extends React.Component {
130
129
  return (
131
130
  <React.Fragment>
132
131
  <g
132
+ className={className}
133
133
  onMouseEnter={this.handleMouseEnter}
134
134
  onMouseLeave={this.handleMouseLeave}
135
135
  onTouchStart={this.handleMouseEnter}
@@ -155,7 +155,6 @@ export class RawPlot extends React.Component {
155
155
  pointHeight,
156
156
  label,
157
157
  value,
158
- classes,
159
158
  scale,
160
159
  }),
161
160
  )}
@@ -173,7 +172,6 @@ export class RawPlot extends React.Component {
173
172
  barWidth,
174
173
  correctVal,
175
174
  correctness,
176
- classes,
177
175
  scale,
178
176
  pointHeight,
179
177
  pointDiameter,
@@ -202,7 +200,6 @@ export class RawPlot extends React.Component {
202
200
  pointHeight={pointHeight}
203
201
  label={label}
204
202
  value={value}
205
- classes={classes}
206
203
  scale={scale}
207
204
  dottedOverline={true}
208
205
  />
@@ -211,7 +208,6 @@ export class RawPlot extends React.Component {
211
208
  barWidth,
212
209
  correctVal,
213
210
  correctness,
214
- classes,
215
211
  scale,
216
212
  pointHeight,
217
213
  pointDiameter,
@@ -235,7 +231,6 @@ export class RawPlot extends React.Component {
235
231
  pointHeight,
236
232
  label,
237
233
  value,
238
- classes,
239
234
  scale,
240
235
  dottedOverline: true,
241
236
  }),
@@ -245,7 +240,6 @@ export class RawPlot extends React.Component {
245
240
  barWidth,
246
241
  correctVal,
247
242
  correctness,
248
- classes,
249
243
  scale,
250
244
  pointHeight,
251
245
  pointDiameter,
@@ -273,30 +267,30 @@ export class RawPlot extends React.Component {
273
267
  }
274
268
  }
275
269
 
276
- const Bar = withStyles((theme) => ({
277
- dot: {
270
+ const Bar = styled(RawPlot)(({ theme }) => ({
271
+ '& .dot': {
278
272
  fill: color.visualElementsColors.PLOT_FILL_COLOR,
279
273
  '&.correct': correct('stroke'),
280
274
  '&.incorrect': incorrect('stroke'),
281
275
  },
282
- dotColor: {
276
+ '& .dotColor': {
283
277
  fill: color.visualElementsColors.PLOT_FILL_COLOR,
284
278
  '&.correct': correct('fill'),
285
279
  '&.incorrect': incorrect('fill'),
286
280
  },
287
- line: {
281
+ '& .line': {
288
282
  stroke: color.visualElementsColors.PLOT_FILL_COLOR,
289
283
  '&.correct': correct('stroke'),
290
284
  '&.incorrect': incorrect('stroke'),
291
285
  },
292
- correctIcon: {
286
+ '& .correctIcon': {
293
287
  backgroundColor: color.correct(),
294
288
  },
295
- incorrectIcon: {
289
+ '& .incorrectIcon': {
296
290
  backgroundColor: color.incorrectWithIcon(),
297
291
  },
298
- correctnessIcon: {
299
- borderRadius: theme.spacing.unit * 2,
292
+ '& .correctnessIcon': {
293
+ borderRadius: theme.spacing(2),
300
294
  color: color.defaults.WHITE,
301
295
  fontSize: '16px',
302
296
  width: '16px',
@@ -305,13 +299,14 @@ const Bar = withStyles((theme) => ({
305
299
  border: `1px solid ${color.defaults.WHITE}`,
306
300
  stroke: 'initial',
307
301
  boxSizing: 'unset', // to override the default border-box in IBX
302
+ display: 'block',
308
303
  },
309
- smallIcon: {
304
+ '& .smallIcon': {
310
305
  fontSize: '10px',
311
306
  width: '10px',
312
307
  height: '10px',
313
308
  },
314
- }))(RawPlot);
309
+ }));
315
310
 
316
311
  export class Plot extends React.Component {
317
312
  static propTypes = {
package/src/plot/dot.js CHANGED
@@ -6,9 +6,17 @@ import { types } from '@pie-lib/plot';
6
6
  import { dataToXBand } from '../utils';
7
7
  import Plot from './common/plot';
8
8
  import { color } from '@pie-lib/render-ui';
9
+ import { styled } from '@mui/material/styles';
10
+ import { correct, incorrect } from '../common/styles';
11
+
12
+ const StyledCircle = styled(Circle)(() => ({
13
+ fill: color.visualElementsColors.PLOT_FILL_COLOR,
14
+ '&.correct': correct('stroke'),
15
+ '&.incorrect': incorrect('stroke'),
16
+ }));
9
17
 
10
18
  const CustomBarElement = (props) => {
11
- const { index, pointDiameter, barX, barWidth, pointHeight, label, value, classes, scale, dottedOverline } = props;
19
+ const { index, pointDiameter, barX, barWidth, pointHeight, label, value, scale, dottedOverline } = props;
12
20
 
13
21
  const r = pointDiameter / 2;
14
22
  const cx = barX + (barWidth - pointDiameter) / 2 + r;
@@ -26,7 +34,7 @@ const CustomBarElement = (props) => {
26
34
  fill="none"
27
35
  />
28
36
  ) : (
29
- <Circle key={`point-${label}-${value}-${index}`} className={classes.dot} cx={cx} cy={cy} r={r} />
37
+ <StyledCircle key={`point-${label}-${value}-${index}`} cx={cx} cy={cy} r={r} />
30
38
  );
31
39
  };
32
40
 
@@ -38,7 +46,6 @@ CustomBarElement.propTypes = {
38
46
  pointHeight: PropTypes.number,
39
47
  value: PropTypes.number,
40
48
  label: PropTypes.string,
41
- classes: PropTypes.object,
42
49
  scale: PropTypes.object,
43
50
  dottedOverline: PropTypes.bool,
44
51
  };