@pie-lib/charting 5.36.2-next.0 → 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
@@ -1,28 +1,66 @@
1
1
  import React from 'react';
2
- import classNames from 'classnames';
3
- import Check from '@material-ui/icons/Check';
4
- import Close from '@material-ui/icons/Close';
2
+ import { styled } from '@mui/material/styles';
3
+ import Check from '@mui/icons-material/Check';
4
+ import Close from '@mui/icons-material/Close';
5
+ import { color as enumColor } from '@pie-lib/render-ui';
5
6
 
6
- export const CorrectnessIndicator = ({ scale, x, y, classes, r, correctness, interactive }) => {
7
+ const StyledCorrectIcon = styled(Check)(({ theme }) => ({
8
+ borderRadius: theme.spacing(2),
9
+ color: enumColor.defaults.WHITE,
10
+ fontSize: '16px',
11
+ width: '16px',
12
+ height: '16px',
13
+ padding: '2px',
14
+ border: `1px solid ${enumColor.defaults.WHITE}`,
15
+ stroke: 'initial',
16
+ boxSizing: 'unset', // to override the default border-box in IBX
17
+ backgroundColor: enumColor.correct(),
18
+ display: 'block',
19
+ '&.small': {
20
+ fontSize: '10px',
21
+ width: '10px',
22
+ height: '10px',
23
+ },
24
+ }));
25
+
26
+ const StyledIncorrectIcon = styled(Close)(({ theme }) => ({
27
+ borderRadius: theme.spacing(2),
28
+ color: enumColor.defaults.WHITE,
29
+ fontSize: '16px',
30
+ width: '16px',
31
+ height: '16px',
32
+ padding: '2px',
33
+ border: `1px solid ${enumColor.defaults.WHITE}`,
34
+ stroke: 'initial',
35
+ boxSizing: 'unset', // to override the default border-box in IBX
36
+ backgroundColor: enumColor.incorrectWithIcon(),
37
+ display: 'block',
38
+ '&.small': {
39
+ fontSize: '10px',
40
+ width: '10px',
41
+ height: '10px',
42
+ },
43
+ }));
44
+
45
+ export const CorrectnessIndicator = ({ scale, x, y, r, correctness, interactive }) => {
7
46
  if (!correctness || !interactive) return null;
8
47
  const cx = scale ? scale.x(x) : x;
9
48
  const cy = scale ? scale.y(y) : y;
10
49
  const isCorrect = correctness.value === 'correct';
11
- const iconClass = isCorrect ? classes.correctIcon : classes.incorrectIcon;
12
50
 
13
51
  // the icon is 16px + 2px padding + 1px border, so total size is 22px
14
52
  return (
15
53
  <foreignObject x={cx - 11} y={cy - 11} width={22} height={22}>
16
54
  {isCorrect ? (
17
- <Check className={classNames(classes.correctnessIcon, iconClass)} title={correctness.label} />
55
+ <StyledCorrectIcon title={correctness.label} />
18
56
  ) : (
19
- <Close className={classNames(classes.correctnessIcon, iconClass)} title={correctness.label} />
57
+ <StyledIncorrectIcon title={correctness.label} />
20
58
  )}
21
59
  </foreignObject>
22
60
  );
23
61
  };
24
62
 
25
- export const SmallCorrectPointIndicator = ({ scale, x, r, correctness, classes, correctData, label }) => {
63
+ export const SmallCorrectPointIndicator = ({ scale, x, r, correctness, correctData, label }) => {
26
64
  if (correctness && correctness.value === 'incorrect') {
27
65
  const correctVal = parseFloat(correctData.find((d) => d.label === label)?.value);
28
66
  if (isNaN(correctVal)) return null;
@@ -33,8 +71,8 @@ export const SmallCorrectPointIndicator = ({ scale, x, r, correctness, classes,
33
71
  // small circle has 10px font + 2px padding + 1px border, so total size is 15px
34
72
  return (
35
73
  <foreignObject x={xToRender} y={yToRender} width={15} height={15}>
36
- <Check
37
- className={classNames(classes.correctnessIcon, classes.correctIcon, classes.smallIcon)}
74
+ <StyledCorrectIcon
75
+ className="small"
38
76
  title={correctness.label}
39
77
  />
40
78
  </foreignObject>
@@ -44,12 +82,12 @@ export const SmallCorrectPointIndicator = ({ scale, x, r, correctness, classes,
44
82
  return null;
45
83
  };
46
84
 
47
- export const TickCorrectnessIndicator = ({ classes, correctness, interactive }) => {
85
+ export const TickCorrectnessIndicator = ({ correctness, interactive }) => {
48
86
  if (!correctness || !interactive) return null;
49
87
 
50
88
  return correctness.value === 'correct' ? (
51
- <Check className={classNames(classes.correctnessIcon, classes.correctIcon)} title={correctness.label} />
89
+ <StyledCorrectIcon title={correctness.label} />
52
90
  ) : (
53
- <Close className={classNames(classes.correctnessIcon, classes.incorrectIcon)} title={correctness.label} />
91
+ <StyledIncorrectIcon title={correctness.label} />
54
92
  );
55
93
  };
@@ -1,22 +1,52 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import classNames from 'classnames';
4
- import { withStyles } from '@material-ui/core/styles';
5
- import Check from '@material-ui/icons/Check';
6
- import Close from '@material-ui/icons/Close';
3
+ import { styled } from '@mui/material/styles';
4
+ import Check from '@mui/icons-material/Check';
5
+ import Close from '@mui/icons-material/Close';
7
6
 
8
7
  import { gridDraggable, utils, types } from '@pie-lib/plot';
9
8
  import { color as enumColor } from '@pie-lib/render-ui';
10
- import { correct, incorrect, disabled } from './styles';
11
9
  import { getScale } from '../utils';
12
10
  import DragIcon from './drag-icon';
13
11
 
12
+ const StyledSvg = styled('svg')(() => ({
13
+ overflow: 'visible !important',
14
+ }));
15
+
16
+ const StyledEllipse = styled('ellipse')(() => ({
17
+ fill: 'transparent',
18
+ clipPath: 'polygon(50% 0%, 100% 0%, 100% 50%, 0% 50%, 0% 0%)',
19
+ }));
20
+
21
+ const StyledCorrectIcon = styled(Check)(() => ({
22
+ backgroundColor: enumColor.correct(),
23
+ borderRadius: '16px', // equivalent to theme.spacing(2) for most themes
24
+ color: enumColor.defaults.WHITE,
25
+ fontSize: '16px',
26
+ padding: '2px',
27
+ border: `4px solid ${enumColor.defaults.WHITE}`,
28
+ width: '16px',
29
+ height: '16px',
30
+ boxSizing: 'unset', // to override the default border-box in IBX
31
+ }));
32
+
33
+ const StyledIncorrectIcon = styled(Close)(() => ({
34
+ backgroundColor: enumColor.incorrectWithIcon(),
35
+ borderRadius: '16px', // equivalent to theme.spacing(2) for most themes
36
+ color: enumColor.defaults.WHITE,
37
+ fontSize: '16px',
38
+ padding: '2px',
39
+ border: `4px solid ${enumColor.defaults.WHITE}`,
40
+ width: '16px',
41
+ height: '16px',
42
+ boxSizing: 'unset', // to override the default border-box in IBX
43
+ }));
44
+
14
45
  const RawDragHandle = ({
15
46
  x,
16
47
  y,
17
48
  width,
18
49
  graphProps,
19
- classes,
20
50
  className,
21
51
  interactive,
22
52
  defineChart,
@@ -30,18 +60,18 @@ const RawDragHandle = ({
30
60
  const scaleValue = getScale(width)?.scale;
31
61
 
32
62
  return (
33
- <svg x={x} y={scale.y(y) - 10} width={width} overflow="visible" className={classes.svgOverflowVisible}>
63
+ <StyledSvg x={x} y={scale.y(y) - 10} width={width} overflow="visible">
34
64
  {isHovered && !correctness && interactive && (
35
- <DragIcon width={width} scaleValue={scaleValue} color={enumColor.defaults.BORDER_GRAY} classes={classes} />
65
+ <DragIcon width={width} scaleValue={scaleValue} color={enumColor.defaults.BORDER_GRAY} />
36
66
  )}
37
67
  {interactive && !correctness && (
38
- <ellipse
68
+ <StyledEllipse
39
69
  cx={width / 2}
40
70
  cy={10}
41
71
  rx={width / 2}
42
72
  // the drag icon has a 22px fixed r value, so the ry value is 3 times that in order to cover all the area
43
73
  ry={66}
44
- className={classNames(classes.transparentHandle, className)}
74
+ className={className}
45
75
  {...rest}
46
76
  />
47
77
  )}
@@ -62,13 +92,13 @@ const RawDragHandle = ({
62
92
  {correctness && interactive && !isPlot && (
63
93
  <foreignObject x={width / 2 - 14} y={0} width={40} height={40}>
64
94
  {correctness.value === 'correct' ? (
65
- <Check className={classNames(classes.correctnessIcon, classes.correctIcon)} title={correctness.label} />
95
+ <StyledCorrectIcon title={correctness.label} />
66
96
  ) : (
67
- <Close className={classNames(classes.correctnessIcon, classes.incorrectIcon)} title={correctness.label} />
97
+ <StyledIncorrectIcon title={correctness.label} />
68
98
  )}
69
99
  </foreignObject>
70
100
  )}
71
- </svg>
101
+ </StyledSvg>
72
102
  );
73
103
  };
74
104
 
@@ -77,7 +107,6 @@ RawDragHandle.propTypes = {
77
107
  y: PropTypes.number.isRequired,
78
108
  width: PropTypes.number,
79
109
  graphProps: types.GraphPropsType.isRequired,
80
- classes: PropTypes.object.isRequired,
81
110
  className: PropTypes.string,
82
111
  interactive: PropTypes.bool,
83
112
  isHovered: PropTypes.bool,
@@ -88,51 +117,7 @@ RawDragHandle.propTypes = {
88
117
  color: PropTypes.string,
89
118
  };
90
119
 
91
- export const DragHandle = withStyles((theme) => ({
92
- handle: {
93
- height: '10px',
94
- fill: 'transparent',
95
- transition: 'fill 200ms linear, height 200ms linear',
96
- '&.correct': correct('fill'),
97
- '&.incorrect': incorrect('fill'),
98
- '&.non-interactive': disabled('fill'),
99
- },
100
- transparentHandle: {
101
- fill: 'transparent',
102
- clipPath: 'polygon(50% 0%, 100% 0%, 100% 50%, 0% 50%, 0% 0%)',
103
- },
104
- handleContainer: {
105
- height: 30,
106
- '&:hover': {
107
- '& .handle': {
108
- fill: enumColor.secondaryDark(),
109
- height: '16px',
110
- },
111
- },
112
- '&.non-interactive': disabled('fill'),
113
- '&.incorrect': incorrect('fill'),
114
- '&.correct': correct('fill'),
115
- },
116
- svgOverflowVisible: {
117
- overflow: 'visible !important',
118
- },
119
- correctIcon: {
120
- backgroundColor: enumColor.correct(),
121
- },
122
- incorrectIcon: {
123
- backgroundColor: enumColor.incorrectWithIcon(),
124
- },
125
- correctnessIcon: {
126
- borderRadius: theme.spacing.unit * 2,
127
- color: enumColor.defaults.WHITE,
128
- fontSize: '16px',
129
- padding: '2px',
130
- border: `4px solid ${enumColor.defaults.WHITE}`,
131
- width: '16px',
132
- height: '16px',
133
- boxSizing: 'unset', // to override the default border-box in IBX
134
- },
135
- }))(RawDragHandle);
120
+ export const DragHandle = RawDragHandle;
136
121
 
137
122
  export const D = gridDraggable({
138
123
  axis: 'y',
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { getAdjustedX, getScale } from '../utils';
3
3
 
4
- const DragIcon = ({ width, scaleValue, color, classes }) => (
4
+ const DragIcon = ({ width, scaleValue, color }) => (
5
5
  <svg
6
6
  x={getAdjustedX(width, scaleValue)}
7
7
  y={getScale(width)?.deltay}
@@ -10,7 +10,7 @@ const DragIcon = ({ width, scaleValue, color, classes }) => (
10
10
  height={width}
11
11
  overflow="visible"
12
12
  viewBox={`0 0 ${width} ${width}`}
13
- className={classes.svgOverflowVisible}
13
+ style={{ overflow: 'visible !important' }}
14
14
  >
15
15
  <g xmlns="http://www.w3.org/2000/svg" fill="currentColor" stroke="currentColor" transform={`scale(${scaleValue})`}>
16
16
  <circle cx="28.5" cy="23.5" r="22" fill="white" stroke="currentColor" />
@@ -16,4 +16,4 @@ export const incorrect = (key = 'fill') => ({
16
16
  [key]: color.incorrect(),
17
17
  pointerEvents: 'none',
18
18
  border: `solid 1px ${color.incorrect()}`,
19
- });
19
+ });
package/src/grid.jsx CHANGED
@@ -1,15 +1,17 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { withStyles } from '@material-ui/core/styles';
4
- import classNames from 'classnames';
3
+ import { styled } from '@mui/material/styles';
5
4
  import { GridRows, GridColumns } from '@vx/grid';
6
5
 
7
6
  import { types } from '@pie-lib/plot';
8
7
  import { color } from '@pie-lib/render-ui';
9
8
 
9
+ const StyledGridGroup = styled('g')(() => ({
10
+ stroke: color.primaryLight(),
11
+ }));
12
+
10
13
  export class Grid extends React.Component {
11
14
  static propTypes = {
12
- classes: PropTypes.object.isRequired,
13
15
  className: PropTypes.string,
14
16
  graphProps: types.GraphPropsType.isRequired,
15
17
  xBand: PropTypes.func,
@@ -20,7 +22,7 @@ export class Grid extends React.Component {
20
22
  static defaultProps = {};
21
23
 
22
24
  render() {
23
- const { classes, className, graphProps, xBand, rowTickValues, columnTickValues } = this.props;
25
+ const { className, graphProps, xBand, rowTickValues, columnTickValues } = this.props;
24
26
  const { scale = {}, size = {}, range = {} } = graphProps || {};
25
27
  const { step = 0, labelStep = 0 } = range;
26
28
  const highlightNonLabel = step && labelStep && step < labelStep;
@@ -38,7 +40,7 @@ export class Grid extends React.Component {
38
40
  );
39
41
 
40
42
  return (
41
- <g className={classNames(classes.grid, className)}>
43
+ <StyledGridGroup className={className}>
42
44
  <GridRows
43
45
  scale={scale.y}
44
46
  width={size.width}
@@ -58,15 +60,9 @@ export class Grid extends React.Component {
58
60
  }}
59
61
  />
60
62
  <GridColumns scale={xBand} height={size.height} offset={xBand.bandwidth() / 2} tickValues={columnTickValues} />
61
- </g>
63
+ </StyledGridGroup>
62
64
  );
63
65
  }
64
66
  }
65
67
 
66
- const styles = () => ({
67
- grid: {
68
- stroke: color.primaryLight(),
69
- },
70
- });
71
-
72
- export default withStyles(styles)(Grid);
68
+ export default Grid;
@@ -1,75 +1,77 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { withStyles } from '@material-ui/core/styles';
4
- import Check from '@material-ui/icons/Check';
5
- import Close from '@material-ui/icons/Close';
3
+ import { styled } from '@mui/material/styles';
4
+ import Check from '@mui/icons-material/Check';
5
+ import Close from '@mui/icons-material/Close';
6
6
  import { color } from '@pie-lib/render-ui';
7
7
  import Translator from '@pie-lib/translator';
8
8
 
9
- const styles = (theme) => ({
10
- container: {
11
- backgroundColor: color.defaults.WHITE,
12
- padding: theme.spacing.unit * 2,
13
- width: '355px',
14
- boxShadow: 'inset 0px 1px 5px 0px #9297A6',
15
- display: 'flex',
16
- flexDirection: 'column',
17
- gap: '16px',
18
- },
19
- row: {
20
- display: 'flex',
21
- alignItems: 'center',
22
- gap: '12px',
23
- },
24
- title: {
25
- fontSize: theme.typography.h6.fontSize,
26
- fontWeight: '700',
27
- },
28
- smallText: {
29
- marginLeft: '2px',
30
- },
31
- correctIcon: {
32
- backgroundColor: color.correct(),
33
- borderRadius: theme.spacing.unit * 2,
34
- color: color.defaults.WHITE,
35
- },
36
- incorrectIcon: {
37
- backgroundColor: color.incorrectWithIcon(),
38
- borderRadius: theme.spacing.unit * 2,
39
- color: color.defaults.WHITE,
40
- },
9
+ const StyledContainer = styled('div')(({ theme }) => ({
10
+ backgroundColor: color.defaults.WHITE,
11
+ padding: theme.spacing(2),
12
+ width: '355px',
13
+ boxShadow: 'inset 0px 1px 5px 0px #9297A6',
14
+ display: 'flex',
15
+ flexDirection: 'column',
16
+ gap: '16px',
17
+ }));
41
18
 
42
- lastRow: {
43
- marginLeft: '3px',
44
- display: 'flex',
45
- alignItems: 'center',
46
- gap: '12px',
47
- },
48
- });
19
+ const StyledRow = styled('div')(() => ({
20
+ display: 'flex',
21
+ alignItems: 'center',
22
+ gap: '12px',
23
+ }));
24
+
25
+ const StyledTitle = styled('div')(({ theme }) => ({
26
+ fontSize: theme.typography.h6.fontSize,
27
+ fontWeight: '700',
28
+ }));
29
+
30
+ const StyledSmallText = styled('div')(() => ({
31
+ marginLeft: '2px',
32
+ }));
33
+
34
+ const StyledCorrectIcon = styled(Check)(({ theme }) => ({
35
+ backgroundColor: color.correct(),
36
+ borderRadius: theme.spacing(2),
37
+ color: color.defaults.WHITE,
38
+ }));
39
+
40
+ const StyledIncorrectIcon = styled(Close)(({ theme }) => ({
41
+ backgroundColor: color.incorrectWithIcon(),
42
+ borderRadius: theme.spacing(2),
43
+ color: color.defaults.WHITE,
44
+ }));
45
+
46
+ const StyledLastRow = styled('div')(() => ({
47
+ marginLeft: '3px',
48
+ display: 'flex',
49
+ alignItems: 'center',
50
+ gap: '12px',
51
+ }));
49
52
 
50
53
  const { translator } = Translator;
51
54
 
52
- const KeyLegend = ({ classes, language }) => (
53
- <div className={classes.container}>
54
- <div className={classes.title}>Key</div>
55
- <div className={classes.row}>
56
- <Close className={classes.incorrectIcon} />
57
- <div className={classes.text}>{translator.t('charting.keyLegend.incorrectAnswer', { lng: language })}</div>
58
- </div>
59
- <div className={classes.row}>
60
- <Check className={classes.correctIcon} />
61
- <div className={classes.text}>{translator.t('charting.keyLegend.correctAnswer', { lng: language })}</div>
62
- </div>
63
- <div className={classes.lastRow}>
64
- <Check className={classes.correctIcon} fontSize={'small'} />
65
- <div className={classes.smallText}>{translator.t('charting.keyLegend.correctKeyAnswer', { lng: language })}</div>
66
- </div>
67
- </div>
55
+ const KeyLegend = ({ language }) => (
56
+ <StyledContainer>
57
+ <StyledTitle>Key</StyledTitle>
58
+ <StyledRow>
59
+ <StyledIncorrectIcon />
60
+ <div>{translator.t('charting.keyLegend.incorrectAnswer', { lng: language })}</div>
61
+ </StyledRow>
62
+ <StyledRow>
63
+ <StyledCorrectIcon />
64
+ <div>{translator.t('charting.keyLegend.correctAnswer', { lng: language })}</div>
65
+ </StyledRow>
66
+ <StyledLastRow>
67
+ <StyledCorrectIcon fontSize={'small'} />
68
+ <StyledSmallText>{translator.t('charting.keyLegend.correctKeyAnswer', { lng: language })}</StyledSmallText>
69
+ </StyledLastRow>
70
+ </StyledContainer>
68
71
  );
69
72
 
70
73
  KeyLegend.propTypes = {
71
- classes: PropTypes.object.isRequired,
72
74
  language: PropTypes.string,
73
75
  };
74
76
 
75
- export default withStyles(styles)(KeyLegend);
77
+ export default KeyLegend;
@@ -1,19 +1,62 @@
1
1
  import React from 'react';
2
2
  import classNames from 'classnames';
3
3
  import PropTypes from 'prop-types';
4
- import { withStyles } from '@material-ui/core/styles/index';
4
+ import { styled } from '@mui/material/styles';
5
5
 
6
6
  import { gridDraggable, utils, types } from '@pie-lib/plot';
7
7
  import { color } from '@pie-lib/render-ui';
8
8
  import { disabled } from '../../common/styles';
9
9
 
10
+ const StyledDragHandle = styled('g')(({ theme }) => ({
11
+ color: 'black',
12
+ '& .handle': {
13
+ transition: 'fill 200ms linear, height 200ms linear',
14
+ '&.non-interactive': disabled('fill'),
15
+ },
16
+ '& .transparentHandle': {
17
+ height: '20px',
18
+ fill: 'transparent',
19
+ stroke: 'transparent',
20
+ },
21
+ '& .line': {
22
+ stroke: color.defaults.TEXT,
23
+ transition: 'fill 200ms linear, height 200ms linear',
24
+ '&.non-interactive': disabled('stroke'),
25
+ },
26
+ '& .disabledPoint': {
27
+ fill: color.defaults.BLACK + ' !important',
28
+ stroke: color.defaults.BLACK + ' !important',
29
+ },
30
+ '& .correctIcon': {
31
+ backgroundColor: color.correct(),
32
+ },
33
+ '& .incorrectIcon': {
34
+ backgroundColor: color.incorrectWithIcon(),
35
+ },
36
+ '& .correctnessIcon': {
37
+ borderRadius: theme.spacing(2),
38
+ color: color.defaults.WHITE,
39
+ fontSize: '16px',
40
+ width: '16px',
41
+ height: '16px',
42
+ padding: '2px',
43
+ border: `1px solid ${color.defaults.WHITE}`,
44
+ stroke: 'initial',
45
+ boxSizing: 'unset', // to override the default border-box in IBX
46
+ },
47
+ '& .smallIcon': {
48
+ fontSize: '10px',
49
+ width: '10px',
50
+ height: '10px',
51
+ },
52
+ }));
53
+
10
54
  class RawDragHandle extends React.Component {
11
55
  static propTypes = {
12
56
  x: PropTypes.number.isRequired,
13
57
  y: PropTypes.number.isRequired,
14
58
  width: PropTypes.number,
15
59
  graphProps: types.GraphPropsType.isRequired,
16
- classes: PropTypes.object.isRequired,
17
60
  className: PropTypes.string,
18
61
  interactive: PropTypes.bool,
19
62
  CustomDraggableComponent: PropTypes.func,
@@ -28,7 +71,6 @@ class RawDragHandle extends React.Component {
28
71
  x,
29
72
  y,
30
73
  graphProps,
31
- classes,
32
74
  className,
33
75
  interactive,
34
76
  CustomDraggableComponent,
@@ -38,62 +80,22 @@ class RawDragHandle extends React.Component {
38
80
  const { scale } = graphProps;
39
81
 
40
82
  return (
41
- <CustomDraggableComponent
42
- scale={scale}
43
- x={x}
44
- y={y}
45
- classes={classes}
46
- className={classNames(className, !interactive && 'non-interactive')}
47
- correctness={correctness}
48
- interactive={interactive}
49
- {...rest}
50
- />
83
+ <StyledDragHandle>
84
+ <CustomDraggableComponent
85
+ scale={scale}
86
+ x={x}
87
+ y={y}
88
+ className={classNames(className, !interactive && 'non-interactive')}
89
+ correctness={correctness}
90
+ interactive={interactive}
91
+ {...rest}
92
+ />
93
+ </StyledDragHandle>
51
94
  );
52
95
  }
53
96
  }
54
97
 
55
- export const DragHandle = withStyles((theme) => ({
56
- handle: {
57
- transition: 'fill 200ms linear, height 200ms linear',
58
- '&.non-interactive': disabled('fill'),
59
- },
60
- transparentHandle: {
61
- height: '20px',
62
- fill: 'transparent',
63
- stroke: 'transparent',
64
- },
65
- line: {
66
- stroke: color.defaults.TEXT,
67
- transition: 'fill 200ms linear, height 200ms linear',
68
- '&.non-interactive': disabled('stroke'),
69
- },
70
- disabledPoint: {
71
- fill: color.defaults.BLACK + ' !important',
72
- stroke: color.defaults.BLACK + ' !important',
73
- },
74
- correctIcon: {
75
- backgroundColor: color.correct(),
76
- },
77
- incorrectIcon: {
78
- backgroundColor: color.incorrectWithIcon(),
79
- },
80
- correctnessIcon: {
81
- borderRadius: theme.spacing.unit * 2,
82
- color: color.defaults.WHITE,
83
- fontSize: '16px',
84
- width: '16px',
85
- height: '16px',
86
- padding: '2px',
87
- border: `1px solid ${color.defaults.WHITE}`,
88
- stroke: 'initial',
89
- boxSizing: 'unset', // to override the default border-box in IBX
90
- },
91
- smallIcon: {
92
- fontSize: '10px',
93
- width: '10px',
94
- height: '10px',
95
- },
96
- }))(RawDragHandle);
98
+ export const DragHandle = RawDragHandle;
97
99
 
98
100
  const DraggableHandle = gridDraggable({
99
101
  axis: 'y',