@pie-lib/graphing-solution-set 2.34.3-next.2 → 2.34.3-next.203
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 +15 -67
- package/lib/axis/arrow.js +19 -55
- package/lib/axis/arrow.js.map +1 -1
- package/lib/axis/axes.js +103 -193
- package/lib/axis/axes.js.map +1 -1
- package/lib/axis/index.js +1 -6
- package/lib/axis/index.js.map +1 -1
- package/lib/bg.js +21 -49
- package/lib/bg.js.map +1 -1
- package/lib/container/actions.js +2 -8
- package/lib/container/actions.js.map +1 -1
- package/lib/container/index.js +14 -60
- package/lib/container/index.js.map +1 -1
- package/lib/container/marks.js +1 -6
- package/lib/container/marks.js.map +1 -1
- package/lib/container/middleware.js +2 -8
- package/lib/container/middleware.js.map +1 -1
- package/lib/container/reducer.js +1 -8
- package/lib/container/reducer.js.map +1 -1
- package/lib/coordinates-label.js +23 -55
- package/lib/coordinates-label.js.map +1 -1
- package/lib/graph-with-controls.js +129 -203
- package/lib/graph-with-controls.js.map +1 -1
- package/lib/graph.js +61 -126
- package/lib/graph.js.map +1 -1
- package/lib/grid-setup.js +169 -225
- package/lib/grid-setup.js.map +1 -1
- package/lib/grid.js +29 -74
- package/lib/grid.js.map +1 -1
- package/lib/index.js +1 -12
- package/lib/index.js.map +1 -1
- package/lib/labels.js +85 -185
- package/lib/labels.js.map +1 -1
- package/lib/mark-label.js +39 -88
- package/lib/mark-label.js.map +1 -1
- package/lib/toggle-bar.js +155 -243
- package/lib/toggle-bar.js.map +1 -1
- package/lib/tool-menu.js +93 -200
- package/lib/tool-menu.js.map +1 -1
- package/lib/tools/index.js +2 -7
- package/lib/tools/index.js.map +1 -1
- package/lib/tools/line/component.js +48 -62
- package/lib/tools/line/component.js.map +1 -1
- package/lib/tools/line/index.js +1 -6
- package/lib/tools/line/index.js.map +1 -1
- package/lib/tools/polygon/component.js +76 -173
- package/lib/tools/polygon/component.js.map +1 -1
- package/lib/tools/polygon/index.js +6 -23
- package/lib/tools/polygon/index.js.map +1 -1
- package/lib/tools/polygon/line.js +48 -85
- package/lib/tools/polygon/line.js.map +1 -1
- package/lib/tools/polygon/polygon.js +62 -102
- package/lib/tools/polygon/polygon.js.map +1 -1
- package/lib/tools/shared/arrow-head.js +7 -20
- package/lib/tools/shared/arrow-head.js.map +1 -1
- package/lib/tools/shared/line/index.js +89 -185
- package/lib/tools/shared/line/index.js.map +1 -1
- package/lib/tools/shared/line/line-path.js +71 -95
- package/lib/tools/shared/line/line-path.js.map +1 -1
- package/lib/tools/shared/line/with-root-edge.js +22 -56
- package/lib/tools/shared/line/with-root-edge.js.map +1 -1
- package/lib/tools/shared/point/arrow-point.js +18 -45
- package/lib/tools/shared/point/arrow-point.js.map +1 -1
- package/lib/tools/shared/point/arrow.js +16 -42
- package/lib/tools/shared/point/arrow.js.map +1 -1
- package/lib/tools/shared/point/base-point.js +44 -58
- package/lib/tools/shared/point/base-point.js.map +1 -1
- package/lib/tools/shared/point/index.js +38 -52
- package/lib/tools/shared/point/index.js.map +1 -1
- package/lib/tools/shared/styles.js +8 -31
- package/lib/tools/shared/styles.js.map +1 -1
- package/lib/tools/shared/types.js +1 -5
- package/lib/tools/shared/types.js.map +1 -1
- package/lib/undo-redo.js +27 -67
- package/lib/undo-redo.js.map +1 -1
- package/lib/use-debounce.js +4 -11
- package/lib/use-debounce.js.map +1 -1
- package/lib/utils.js +56 -131
- package/lib/utils.js.map +1 -1
- package/package.json +26 -31
- package/src/__tests__/graph-with-controls.test.jsx +23 -10
- package/src/__tests__/graph.test.jsx +36 -171
- package/src/__tests__/grid.test.jsx +9 -6
- package/src/__tests__/labels.test.jsx +11 -8
- package/src/__tests__/mark-label.test.jsx +15 -17
- package/src/__tests__/toggle-bar.test.jsx +46 -17
- package/src/__tests__/tool-menu.test.jsx +12 -8
- package/src/__tests__/undo-redo.test.jsx +9 -8
- package/src/__tests__/utils.js +3 -0
- package/src/axis/__tests__/arrow.test.jsx +21 -17
- package/src/axis/__tests__/axes.test.jsx +117 -155
- package/src/axis/arrow.jsx +7 -12
- package/src/axis/axes.jsx +41 -51
- package/src/coordinates-label.jsx +13 -18
- package/src/graph-with-controls.jsx +90 -93
- package/src/grid-setup.jsx +203 -205
- package/src/grid.jsx +2 -4
- package/src/labels.jsx +84 -125
- package/src/mark-label.jsx +14 -25
- package/src/toggle-bar.jsx +135 -163
- package/src/tool-menu.jsx +136 -195
- package/src/tools/line/__tests__/component.test.jsx +7 -7
- package/src/tools/line/component.jsx +29 -29
- package/src/tools/polygon/__tests__/component.test.jsx +13 -152
- package/src/tools/polygon/__tests__/line.test.jsx +7 -9
- package/src/tools/polygon/__tests__/polygon.test.jsx +8 -8
- package/src/tools/polygon/component.jsx +2 -4
- package/src/tools/polygon/line.jsx +26 -24
- package/src/tools/polygon/polygon.jsx +35 -40
- package/src/tools/shared/__tests__/arrow-head.test.jsx +16 -17
- package/src/tools/shared/line/__tests__/index.test.jsx +26 -163
- package/src/tools/shared/line/__tests__/line-path.test.jsx +9 -9
- package/src/tools/shared/line/__tests__/with-root-edge.test.jsx +14 -24
- package/src/tools/shared/line/index.jsx +3 -3
- package/src/tools/shared/line/line-path.jsx +51 -48
- package/src/tools/shared/line/with-root-edge.jsx +1 -1
- package/src/tools/shared/point/__tests__/arrow-point.test.jsx +15 -11
- package/src/tools/shared/point/__tests__/base-point.test.jsx +14 -11
- package/src/tools/shared/point/base-point.jsx +33 -6
- package/src/tools/shared/point/index.jsx +30 -32
- package/src/undo-redo.jsx +16 -24
- package/esm/index.css +0 -847
- package/esm/index.js +0 -233259
- package/esm/index.js.map +0 -1
- package/esm/package.json +0 -3
- package/src/__tests__/__snapshots__/graph-with-controls.test.jsx.snap +0 -114
- package/src/__tests__/__snapshots__/graph.test.jsx.snap +0 -213
- package/src/__tests__/__snapshots__/grid.test.jsx.snap +0 -54
- package/src/__tests__/__snapshots__/labels.test.jsx.snap +0 -30
- package/src/__tests__/__snapshots__/mark-label.test.jsx.snap +0 -37
- package/src/__tests__/__snapshots__/toggle-bar.test.jsx.snap +0 -7
- package/src/__tests__/__snapshots__/tool-menu.test.jsx.snap +0 -35
- package/src/__tests__/__snapshots__/undo-redo.test.jsx.snap +0 -15
- package/src/axis/__tests__/__snapshots__/arrow.test.jsx.snap +0 -33
- package/src/axis/__tests__/__snapshots__/axes.test.jsx.snap +0 -122
- package/src/tools/line/__tests__/__snapshots__/component.test.jsx.snap +0 -20
- package/src/tools/polygon/__tests__/__snapshots__/component.test.jsx.snap +0 -94
- package/src/tools/polygon/__tests__/__snapshots__/line.test.jsx.snap +0 -44
- package/src/tools/polygon/__tests__/__snapshots__/polygon.test.jsx.snap +0 -53
- package/src/tools/shared/__tests__/__snapshots__/arrow-head.test.jsx.snap +0 -32
- package/src/tools/shared/line/__tests__/__snapshots__/index.test.jsx.snap +0 -360
- package/src/tools/shared/line/__tests__/__snapshots__/line-path.test.jsx.snap +0 -57
- package/src/tools/shared/line/__tests__/__snapshots__/with-root-edge.test.jsx.snap +0 -63
- package/src/tools/shared/point/__tests__/__snapshots__/arrow-point.test.jsx.snap +0 -55
- package/src/tools/shared/point/__tests__/__snapshots__/base-point.test.jsx.snap +0 -43
|
@@ -1,15 +1,38 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import classNames from 'classnames';
|
|
4
3
|
import { types } from '@pie-lib/plot';
|
|
5
4
|
import CoordinatesLabel from '../../../coordinates-label';
|
|
6
5
|
import ReactDOM from 'react-dom';
|
|
7
6
|
import { thinnerShapesNeeded } from '../../../utils';
|
|
8
7
|
import { color } from '@pie-lib/render-ui';
|
|
8
|
+
import { styled } from '@mui/material/styles';
|
|
9
|
+
import { disabled as disabledStyle, correct, incorrect, missing } from '../styles';
|
|
10
|
+
|
|
11
|
+
const StyledPointGroup = styled('g')(({ disabled, correctness }) => ({
|
|
12
|
+
cursor: 'pointer',
|
|
13
|
+
'& circle': {
|
|
14
|
+
fill: 'currentColor',
|
|
15
|
+
},
|
|
16
|
+
...(disabled && {
|
|
17
|
+
...disabledStyle('fill'),
|
|
18
|
+
...disabledStyle('color'),
|
|
19
|
+
}),
|
|
20
|
+
...(correctness === 'correct' && {
|
|
21
|
+
...correct('fill'),
|
|
22
|
+
...correct('color'),
|
|
23
|
+
}),
|
|
24
|
+
...(correctness === 'incorrect' && {
|
|
25
|
+
...incorrect('fill'),
|
|
26
|
+
...incorrect('color'),
|
|
27
|
+
}),
|
|
28
|
+
...(correctness === 'missing' && {
|
|
29
|
+
...missing('fill'),
|
|
30
|
+
...missing('color'),
|
|
31
|
+
}),
|
|
32
|
+
}));
|
|
9
33
|
|
|
10
34
|
export class RawBp extends React.Component {
|
|
11
35
|
static propTypes = {
|
|
12
|
-
classes: PropTypes.object,
|
|
13
36
|
className: PropTypes.string,
|
|
14
37
|
coordinatesOnHover: PropTypes.bool,
|
|
15
38
|
correctness: PropTypes.string,
|
|
@@ -18,6 +41,9 @@ export class RawBp extends React.Component {
|
|
|
18
41
|
x: PropTypes.number,
|
|
19
42
|
y: PropTypes.number,
|
|
20
43
|
graphProps: types.GraphPropsType.isRequired,
|
|
44
|
+
onClick: PropTypes.func,
|
|
45
|
+
onTouchStart: PropTypes.func,
|
|
46
|
+
onTouchEnd: PropTypes.func,
|
|
21
47
|
};
|
|
22
48
|
|
|
23
49
|
constructor(props) {
|
|
@@ -27,7 +53,6 @@ export class RawBp extends React.Component {
|
|
|
27
53
|
|
|
28
54
|
render() {
|
|
29
55
|
const {
|
|
30
|
-
classes,
|
|
31
56
|
className,
|
|
32
57
|
coordinatesOnHover,
|
|
33
58
|
x,
|
|
@@ -63,8 +88,10 @@ export class RawBp extends React.Component {
|
|
|
63
88
|
onTouchEnd={onTouchEnd}
|
|
64
89
|
onClick={onClick}
|
|
65
90
|
/>
|
|
66
|
-
<
|
|
67
|
-
|
|
91
|
+
<StyledPointGroup
|
|
92
|
+
disabled={disabled}
|
|
93
|
+
correctness={correctness}
|
|
94
|
+
className={className}
|
|
68
95
|
onMouseEnter={() => this.setState({ showCoordinates: true })}
|
|
69
96
|
onMouseLeave={() => this.setState({ showCoordinates: false })}
|
|
70
97
|
>
|
|
@@ -79,7 +106,7 @@ export class RawBp extends React.Component {
|
|
|
79
106
|
coordinatesOnHover &&
|
|
80
107
|
showCoordinates &&
|
|
81
108
|
ReactDOM.createPortal(<CoordinatesLabel graphProps={graphProps} x={x} y={y} />, labelNode)}
|
|
82
|
-
</
|
|
109
|
+
</StyledPointGroup>
|
|
83
110
|
</>
|
|
84
111
|
);
|
|
85
112
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
2
4
|
import { gridDraggable } from '@pie-lib/plot';
|
|
3
5
|
import * as utils from '../../../utils';
|
|
4
6
|
import { disabled, correct, incorrect, missing } from '../styles';
|
|
@@ -24,37 +26,33 @@ const opts = {
|
|
|
24
26
|
},
|
|
25
27
|
};
|
|
26
28
|
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
missing: {
|
|
51
|
-
'& circle, & polygon': {
|
|
52
|
-
...missing(),
|
|
53
|
-
},
|
|
54
|
-
},
|
|
29
|
+
const StyledPointWrapper = styled('g', {
|
|
30
|
+
shouldForwardProp: (prop) => !['disabled', 'correctness'].includes(prop),
|
|
31
|
+
})(({ disabled: isDisabled, correctness }) => ({
|
|
32
|
+
'& circle, & polygon': {
|
|
33
|
+
cursor: 'pointer',
|
|
34
|
+
fill: color.defaults.SECONDARY,
|
|
35
|
+
...(isDisabled && disabled()),
|
|
36
|
+
...(correctness === 'correct' && correct()),
|
|
37
|
+
...(correctness === 'incorrect' && incorrect()),
|
|
38
|
+
...(correctness === 'missing' && missing()),
|
|
39
|
+
},
|
|
40
|
+
}));
|
|
41
|
+
|
|
42
|
+
const withStyledWrapper = (WrappedComponent) => {
|
|
43
|
+
const WrappedComponentWithStyles = (props) => (
|
|
44
|
+
<StyledPointWrapper disabled={props.disabled} correctness={props.correctness}>
|
|
45
|
+
<WrappedComponent {...props} />
|
|
46
|
+
</StyledPointWrapper>
|
|
47
|
+
);
|
|
48
|
+
WrappedComponentWithStyles.displayName = `withStyledWrapper(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`;
|
|
49
|
+
WrappedComponentWithStyles.propTypes = {
|
|
50
|
+
disabled: PropTypes.bool,
|
|
51
|
+
correctness: PropTypes.string,
|
|
55
52
|
};
|
|
53
|
+
return WrappedComponentWithStyles;
|
|
56
54
|
};
|
|
57
55
|
|
|
58
|
-
export const BasePoint =
|
|
59
|
-
export const ArrowPoint =
|
|
60
|
-
export const Arrow =
|
|
56
|
+
export const BasePoint = gridDraggable(opts)(withStyledWrapper(RawBp));
|
|
57
|
+
export const ArrowPoint = gridDraggable(opts)(withStyledWrapper(RawArrow));
|
|
58
|
+
export const Arrow = gridDraggable(opts)(withStyledWrapper(BaseArrow));
|
package/src/undo-redo.jsx
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import
|
|
4
|
-
import Button from '@material
|
|
5
|
-
import { withStyles } from '@material-ui/core';
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
|
+
import Button from '@mui/material/Button';
|
|
6
5
|
import { color } from '@pie-lib/render-ui';
|
|
7
6
|
import Translator from '@pie-lib/translator';
|
|
8
7
|
|
|
9
8
|
const { translator } = Translator;
|
|
10
9
|
|
|
10
|
+
const StyledButton = styled(Button)(({ theme }) => ({
|
|
11
|
+
color: color.text(),
|
|
12
|
+
fontWeight: 'bold',
|
|
13
|
+
marginBottom: theme.spacing(0.5),
|
|
14
|
+
'&:not(:last-of-type)': {
|
|
15
|
+
marginRight: theme.spacing(0.5),
|
|
16
|
+
},
|
|
17
|
+
}));
|
|
18
|
+
|
|
11
19
|
export class UndoRedo extends React.Component {
|
|
12
20
|
static propTypes = {
|
|
13
|
-
classes: PropTypes.object,
|
|
14
21
|
className: PropTypes.string,
|
|
15
22
|
onReset: PropTypes.func.isRequired,
|
|
16
23
|
language: PropTypes.string,
|
|
@@ -18,30 +25,15 @@ export class UndoRedo extends React.Component {
|
|
|
18
25
|
static defaultProps = {};
|
|
19
26
|
|
|
20
27
|
render() {
|
|
21
|
-
const {
|
|
28
|
+
const { className, onReset = false, language } = this.props;
|
|
22
29
|
return (
|
|
23
|
-
<div className={
|
|
24
|
-
<
|
|
30
|
+
<div className={className}>
|
|
31
|
+
<StyledButton onClick={() => onReset()}>
|
|
25
32
|
{translator.t('graphing.reset', { lng: language })}
|
|
26
|
-
</
|
|
33
|
+
</StyledButton>
|
|
27
34
|
</div>
|
|
28
35
|
);
|
|
29
36
|
}
|
|
30
37
|
}
|
|
31
38
|
|
|
32
|
-
|
|
33
|
-
button: {
|
|
34
|
-
color: color.text(),
|
|
35
|
-
fontWeight: 'bold',
|
|
36
|
-
marginBottom: theme.spacing.unit / 2,
|
|
37
|
-
'&:not(:last-of-type)': {
|
|
38
|
-
marginRight: theme.spacing.unit / 2,
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
undoRedoDiv: {
|
|
42
|
-
display: 'flex',
|
|
43
|
-
flexDirection: 'row',
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
export default withStyles(styles)(UndoRedo);
|
|
39
|
+
export default UndoRedo;
|