@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
package/src/plot/line.js CHANGED
@@ -2,14 +2,22 @@ import React 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 { styled } from '@mui/material/styles';
5
6
 
6
7
  import { types } from '@pie-lib/plot';
7
8
  import { dataToXBand } from '../utils';
8
9
  import { color } from '@pie-lib/render-ui';
9
10
  import Plot from './common/plot';
11
+ import { correct, incorrect } from '../common/styles';
12
+
13
+ const StyledLinePath = styled(LinePath)(() => ({
14
+ stroke: color.visualElementsColors.PLOT_FILL_COLOR,
15
+ '&.correct': correct('stroke'),
16
+ '&.incorrect': incorrect('stroke'),
17
+ }));
10
18
 
11
19
  const CustomBarElement = (props) => {
12
- const { index, pointDiameter, barX, barWidth, pointHeight, label, value, classes, scale, dottedOverline } = props;
20
+ const { index, pointDiameter, barX, barWidth, pointHeight, label, value, scale, dottedOverline } = props;
13
21
 
14
22
  const x = barX + (barWidth - pointDiameter) / 2;
15
23
  const y = scale.y(index) - (pointHeight - pointDiameter) / 2;
@@ -28,27 +36,27 @@ const CustomBarElement = (props) => {
28
36
  />
29
37
  ) : (
30
38
  <Group>
31
- <LinePath
39
+ <StyledLinePath
32
40
  data={[
33
41
  { x, y },
34
42
  { x: x + pointDiameter, y: y - pointDiameter },
35
43
  ]}
36
44
  key={`point-${label}-${value}-${index}-1`}
37
- className={classes.line}
45
+ className={'line'}
38
46
  x={(d) => d.x}
39
47
  y={(d) => d.y}
40
48
  strokeWidth={pointDiameter / 5}
41
49
  />
42
- <LinePath
50
+ <StyledLinePath
43
51
  data={[
44
52
  { x, y: y - pointDiameter },
45
53
  { x: x + pointDiameter, y },
46
54
  ]}
47
55
  key={`point-${label}-${value}-${index}-2`}
48
- className={classes.line}
49
56
  x={(d) => d.x}
50
57
  y={(d) => d.y}
51
58
  strokeWidth={pointDiameter / 5}
59
+ className={'line'}
52
60
  />
53
61
  </Group>
54
62
  );
@@ -62,8 +70,8 @@ CustomBarElement.propTypes = {
62
70
  pointHeight: PropTypes.number,
63
71
  value: PropTypes.number,
64
72
  label: PropTypes.string,
65
- classes: PropTypes.object,
66
73
  scale: PropTypes.object,
74
+ dottedOverline: PropTypes.bool,
67
75
  };
68
76
 
69
77
  export class LinePlot extends React.Component {
package/src/tool-menu.jsx CHANGED
@@ -3,57 +3,54 @@ import PropTypes from 'prop-types';
3
3
  import classNames from 'classnames';
4
4
  import { color } from '@pie-lib/render-ui';
5
5
 
6
- import { withStyles } from '@material-ui/core/styles';
7
- import cn from 'classnames';
8
- import Button from '@material-ui/core/Button';
6
+ import { styled } from '@mui/material/styles';
7
+ import Button from '@mui/material/Button';
9
8
  import Translator from '@pie-lib/translator';
10
9
 
11
10
  const { translator } = Translator;
12
11
 
13
- const buttonStyles = (theme) => ({
14
- root: {
15
- color: color.text(),
16
- border: `1px solid ${color.secondary()}`,
17
- fontSize: theme.typography.fontSize,
18
- },
19
- selected: {
12
+ const StyledMiniButton = styled(Button)(({ theme, selected, disabled }) => ({
13
+ color: color.text(),
14
+ border: `1px solid ${color.secondary()}`,
15
+ fontSize: theme.typography.fontSize,
16
+ ...(selected && {
20
17
  backgroundColor: color.background(),
21
18
  '& span': {
22
19
  color: color.primaryDark(),
23
20
  },
24
- },
25
- notSelected: {
21
+ }),
22
+ ...(!selected && !disabled && {
26
23
  '& span': {
27
24
  color: color.primary(),
28
25
  },
29
26
  backgroundColor: color.background(),
30
- },
31
- disabled: {
27
+ }),
28
+ ...(disabled && {
32
29
  '& span': {
33
30
  color: color.primary(),
34
31
  },
35
32
  backgroundColor: color.disabled(),
36
- },
37
- });
33
+ }),
34
+ }));
38
35
 
39
- export const MiniButton = withStyles(buttonStyles)((props) => {
40
- const { disabled, classes, className, selected, value, onClick } = props;
36
+ export const MiniButton = (props) => {
37
+ const { disabled, className, selected, value, onClick } = props;
41
38
  return (
42
- <Button
39
+ <StyledMiniButton
43
40
  size="small"
44
41
  disabled={disabled}
42
+ selected={selected}
45
43
  color={selected ? 'secondary' : 'default'}
46
- className={cn(classes.root, selected && classes.selected, className)}
47
- classes={{ disabled: cn(disabled && classes.disabled) }}
44
+ className={className}
48
45
  value={value}
49
46
  key={value}
50
47
  variant="outlined"
51
48
  onClick={onClick}
52
49
  >
53
50
  {value}
54
- </Button>
51
+ </StyledMiniButton>
55
52
  );
56
- });
53
+ };
57
54
  MiniButton.propTypes = {
58
55
  disabled: PropTypes.bool,
59
56
  className: PropTypes.string,