@pie-lib/charting 5.32.8-next.12 → 5.33.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.
- package/CHANGELOG.md +7 -32
- package/lib/actions-button.js +49 -88
- package/lib/actions-button.js.map +1 -1
- package/lib/axes.js +175 -233
- package/lib/axes.js.map +1 -1
- package/lib/bars/bar.js +13 -41
- package/lib/bars/bar.js.map +1 -1
- package/lib/bars/common/bars.js +55 -126
- package/lib/bars/common/bars.js.map +1 -1
- package/lib/bars/common/correct-check-icon.js +1 -6
- package/lib/bars/common/correct-check-icon.js.map +1 -1
- package/lib/bars/histogram.js +13 -41
- package/lib/bars/histogram.js.map +1 -1
- package/lib/chart-setup.js +110 -184
- package/lib/chart-setup.js.map +1 -1
- package/lib/chart-type.js +29 -38
- package/lib/chart-type.js.map +1 -1
- package/lib/chart-types.js +1 -10
- package/lib/chart-types.js.map +1 -1
- package/lib/chart.js +74 -146
- package/lib/chart.js.map +1 -1
- package/lib/common/correctness-indicators.js +74 -52
- package/lib/common/correctness-indicators.js.map +1 -1
- package/lib/common/drag-handle.js +67 -105
- package/lib/common/drag-handle.js.map +1 -1
- package/lib/common/drag-icon.js +6 -12
- package/lib/common/drag-icon.js.map +1 -1
- package/lib/common/styles.js +6 -24
- package/lib/common/styles.js.map +1 -1
- package/lib/grid.js +44 -81
- package/lib/grid.js.map +1 -1
- package/lib/index.js +0 -6
- package/lib/index.js.map +1 -1
- package/lib/key-legend.js +63 -87
- package/lib/key-legend.js.map +1 -1
- package/lib/line/common/drag-handle.js +69 -100
- package/lib/line/common/drag-handle.js.map +1 -1
- package/lib/line/common/line.js +44 -92
- package/lib/line/common/line.js.map +1 -1
- package/lib/line/line-cross.js +77 -87
- package/lib/line/line-cross.js.map +1 -1
- package/lib/line/line-dot.js +66 -78
- package/lib/line/line-dot.js.map +1 -1
- package/lib/mark-label.js +75 -117
- package/lib/mark-label.js.map +1 -1
- package/lib/plot/common/plot.js +76 -144
- package/lib/plot/common/plot.js.map +1 -1
- package/lib/plot/dot.js +31 -57
- package/lib/plot/dot.js.map +1 -1
- package/lib/plot/line.js +37 -62
- package/lib/plot/line.js.map +1 -1
- package/lib/tool-menu.js +48 -80
- package/lib/tool-menu.js.map +1 -1
- package/lib/utils.js +20 -77
- package/lib/utils.js.map +1 -1
- package/package.json +12 -9
- package/src/actions-button.jsx +36 -37
- package/src/axes.jsx +80 -75
- package/src/bars/common/bars.jsx +8 -23
- package/src/chart-setup.jsx +68 -78
- package/src/chart-type.js +26 -21
- package/src/chart.jsx +8 -20
- package/src/common/correctness-indicators.jsx +51 -13
- package/src/common/drag-handle.jsx +44 -59
- package/src/common/drag-icon.jsx +2 -2
- package/src/common/styles.js +1 -1
- package/src/grid.jsx +9 -13
- package/src/key-legend.jsx +62 -60
- package/src/line/common/drag-handle.jsx +57 -55
- package/src/line/common/line.jsx +17 -8
- package/src/line/line-cross.js +37 -12
- package/src/line/line-dot.js +30 -11
- package/src/mark-label.jsx +43 -44
- package/src/plot/common/plot.jsx +17 -22
- package/src/plot/dot.js +10 -3
- package/src/plot/line.js +14 -6
- package/src/tool-menu.jsx +20 -23
package/src/plot/common/plot.jsx
CHANGED
|
@@ -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 '@
|
|
5
|
-
import {
|
|
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,
|
|
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(
|
|
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 =
|
|
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
|
|
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
|
-
}))
|
|
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,
|
|
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
|
-
<
|
|
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
|
};
|
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,
|
|
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
|
-
<
|
|
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={
|
|
45
|
+
className={'line'}
|
|
38
46
|
x={(d) => d.x}
|
|
39
47
|
y={(d) => d.y}
|
|
40
48
|
strokeWidth={pointDiameter / 5}
|
|
41
49
|
/>
|
|
42
|
-
<
|
|
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 {
|
|
7
|
-
import
|
|
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
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
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 =
|
|
40
|
-
const { disabled,
|
|
36
|
+
export const MiniButton = (props) => {
|
|
37
|
+
const { disabled, className, selected, value, onClick } = props;
|
|
41
38
|
return (
|
|
42
|
-
<
|
|
39
|
+
<StyledMiniButton
|
|
43
40
|
size="small"
|
|
44
41
|
disabled={disabled}
|
|
42
|
+
selected={selected}
|
|
45
43
|
color={selected ? 'secondary' : 'default'}
|
|
46
|
-
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
|
-
</
|
|
51
|
+
</StyledMiniButton>
|
|
55
52
|
);
|
|
56
|
-
}
|
|
53
|
+
};
|
|
57
54
|
MiniButton.propTypes = {
|
|
58
55
|
disabled: PropTypes.bool,
|
|
59
56
|
className: PropTypes.string,
|