@pie-lib/config-ui 11.30.1 → 11.31.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 +23 -8
- package/lib/alert-dialog.js +35 -42
- package/lib/alert-dialog.js.map +1 -1
- package/lib/checkbox.js +56 -71
- package/lib/checkbox.js.map +1 -1
- package/lib/choice-configuration/feedback-menu.js +29 -64
- package/lib/choice-configuration/feedback-menu.js.map +1 -1
- package/lib/choice-configuration/index.js +202 -260
- package/lib/choice-configuration/index.js.map +1 -1
- package/lib/choice-utils.js +6 -18
- package/lib/choice-utils.js.map +1 -1
- package/lib/feedback-config/feedback-selector.js +77 -114
- package/lib/feedback-config/feedback-selector.js.map +1 -1
- package/lib/feedback-config/group.js +26 -40
- package/lib/feedback-config/group.js.map +1 -1
- package/lib/feedback-config/index.js +38 -90
- package/lib/feedback-config/index.js.map +1 -1
- package/lib/form-section.js +24 -33
- package/lib/form-section.js.map +1 -1
- package/lib/help.js +39 -80
- package/lib/help.js.map +1 -1
- package/lib/index.js +1 -31
- package/lib/index.js.map +1 -1
- package/lib/input.js +21 -54
- package/lib/input.js.map +1 -1
- package/lib/inputs.js +61 -95
- package/lib/inputs.js.map +1 -1
- package/lib/langs.js +56 -100
- package/lib/langs.js.map +1 -1
- package/lib/layout/config-layout.js +61 -99
- package/lib/layout/config-layout.js.map +1 -1
- package/lib/layout/index.js +0 -3
- package/lib/layout/index.js.map +1 -1
- package/lib/layout/layout-contents.js +71 -101
- package/lib/layout/layout-contents.js.map +1 -1
- package/lib/layout/settings-box.js +27 -56
- package/lib/layout/settings-box.js.map +1 -1
- package/lib/mui-box/index.js +41 -57
- package/lib/mui-box/index.js.map +1 -1
- package/lib/number-text-field-custom.js +79 -161
- package/lib/number-text-field-custom.js.map +1 -1
- package/lib/number-text-field.js +57 -115
- package/lib/number-text-field.js.map +1 -1
- package/lib/radio-with-label.js +23 -31
- package/lib/radio-with-label.js.map +1 -1
- package/lib/settings/display-size.js +16 -32
- package/lib/settings/display-size.js.map +1 -1
- package/lib/settings/index.js +14 -47
- package/lib/settings/index.js.map +1 -1
- package/lib/settings/panel.js +151 -229
- package/lib/settings/panel.js.map +1 -1
- package/lib/settings/settings-radio-label.js +21 -30
- package/lib/settings/settings-radio-label.js.map +1 -1
- package/lib/settings/toggle.js +34 -46
- package/lib/settings/toggle.js.map +1 -1
- package/lib/tabs/index.js +22 -57
- package/lib/tabs/index.js.map +1 -1
- package/lib/tags-input/index.js +50 -99
- package/lib/tags-input/index.js.map +1 -1
- package/lib/two-choice.js +46 -90
- package/lib/two-choice.js.map +1 -1
- package/lib/with-stateful-model.js +8 -31
- package/lib/with-stateful-model.js.map +1 -1
- package/package.json +12 -10
- package/src/__tests__/number-text-field.test.jsx +1 -1
- package/src/alert-dialog.jsx +21 -19
- package/src/checkbox.jsx +42 -46
- package/src/choice-configuration/feedback-menu.jsx +6 -6
- package/src/choice-configuration/index.jsx +202 -195
- package/src/feedback-config/feedback-selector.jsx +51 -53
- package/src/feedback-config/group.jsx +21 -22
- package/src/feedback-config/index.jsx +27 -29
- package/src/form-section.jsx +18 -18
- package/src/help.jsx +20 -28
- package/src/input.jsx +1 -1
- package/src/inputs.jsx +34 -50
- package/src/langs.jsx +40 -46
- package/src/layout/config-layout.jsx +38 -36
- package/src/layout/layout-contents.jsx +34 -35
- package/src/layout/settings-box.jsx +16 -19
- package/src/mui-box/index.jsx +35 -43
- package/src/number-text-field-custom.jsx +30 -36
- package/src/number-text-field.jsx +22 -30
- package/src/radio-with-label.jsx +17 -13
- package/src/settings/display-size.jsx +12 -11
- package/src/settings/panel.jsx +86 -89
- package/src/settings/settings-radio-label.jsx +17 -13
- package/src/settings/toggle.jsx +29 -29
- package/src/tabs/index.jsx +8 -8
- package/src/tags-input/index.jsx +35 -38
- package/src/two-choice.jsx +15 -19
|
@@ -1,16 +1,36 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import classnames from 'classnames';
|
|
3
2
|
import PropTypes from 'prop-types';
|
|
4
|
-
import {
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
5
4
|
import Tabs from '../tabs';
|
|
6
|
-
|
|
5
|
+
|
|
6
|
+
const StyledContainer = styled('div')(({ theme }) => ({
|
|
7
|
+
display: 'flex',
|
|
8
|
+
flexDirection: 'column',
|
|
9
|
+
position: 'relative',
|
|
10
|
+
}));
|
|
11
|
+
|
|
12
|
+
const StyledFlow = styled('div')(() => ({
|
|
13
|
+
display: 'flex',
|
|
14
|
+
justifyContent: 'space-between',
|
|
15
|
+
}));
|
|
16
|
+
|
|
17
|
+
const StyledContentContainer = styled('div')(({ theme }) => ({
|
|
18
|
+
padding: `${theme.spacing(2)} 0`,
|
|
19
|
+
}));
|
|
20
|
+
|
|
21
|
+
const StyledConfigContainer = styled('div')(() => ({
|
|
22
|
+
flex: '1',
|
|
23
|
+
}));
|
|
24
|
+
|
|
25
|
+
const StyledSettingsContainer = styled('div')(({ theme }) => ({
|
|
26
|
+
marginLeft: theme.spacing(2),
|
|
27
|
+
}));
|
|
7
28
|
|
|
8
29
|
class RawLayoutContents extends React.Component {
|
|
9
30
|
static propTypes = {
|
|
10
31
|
mode: PropTypes.oneOf(['tabbed', 'inline']),
|
|
11
32
|
secondary: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
|
|
12
33
|
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
|
|
13
|
-
classes: PropTypes.object,
|
|
14
34
|
dimensions: PropTypes.object,
|
|
15
35
|
};
|
|
16
36
|
|
|
@@ -47,7 +67,7 @@ class RawLayoutContents extends React.Component {
|
|
|
47
67
|
// }
|
|
48
68
|
|
|
49
69
|
render() {
|
|
50
|
-
const { mode, secondary, children,
|
|
70
|
+
const { mode, secondary, children, dimensions } = this.props;
|
|
51
71
|
const { minHeight, minWidth, maxHeight, maxWidth } = dimensions || {};
|
|
52
72
|
const configuration = this.getConfiguration();
|
|
53
73
|
|
|
@@ -65,18 +85,18 @@ class RawLayoutContents extends React.Component {
|
|
|
65
85
|
}
|
|
66
86
|
|
|
67
87
|
return (
|
|
68
|
-
<
|
|
88
|
+
<StyledContainer style={{ minHeight, minWidth, maxHeight, maxWidth }}>
|
|
69
89
|
{mode === 'inline' && (
|
|
70
|
-
<
|
|
71
|
-
<
|
|
90
|
+
<StyledFlow>
|
|
91
|
+
<StyledConfigContainer className="design-container">{children}</StyledConfigContainer>
|
|
72
92
|
{hasSettingsPanel && (
|
|
73
|
-
<
|
|
93
|
+
<StyledSettingsContainer className="settings-container">{secondary}</StyledSettingsContainer>
|
|
74
94
|
)}
|
|
75
|
-
</
|
|
95
|
+
</StyledFlow>
|
|
76
96
|
)}
|
|
77
97
|
|
|
78
98
|
{mode === 'tabbed' && hasSettingsPanel && (
|
|
79
|
-
<Tabs onChange={this.onTabsChange} contentClassName=
|
|
99
|
+
<Tabs onChange={this.onTabsChange} contentClassName="content-container" indicatorColor="primary">
|
|
80
100
|
<div title="Design" className="design-container">
|
|
81
101
|
{children}
|
|
82
102
|
</div>
|
|
@@ -87,32 +107,11 @@ class RawLayoutContents extends React.Component {
|
|
|
87
107
|
)}
|
|
88
108
|
|
|
89
109
|
{mode === 'tabbed' && !hasSettingsPanel && (
|
|
90
|
-
<
|
|
110
|
+
<StyledContentContainer className="design-container">{children}</StyledContentContainer>
|
|
91
111
|
)}
|
|
92
|
-
</
|
|
112
|
+
</StyledContainer>
|
|
93
113
|
);
|
|
94
114
|
}
|
|
95
115
|
}
|
|
96
116
|
|
|
97
|
-
|
|
98
|
-
flow: {
|
|
99
|
-
display: 'flex',
|
|
100
|
-
justifyContent: 'space-between',
|
|
101
|
-
},
|
|
102
|
-
container: {
|
|
103
|
-
display: 'flex',
|
|
104
|
-
flexDirection: 'column',
|
|
105
|
-
position: 'relative',
|
|
106
|
-
},
|
|
107
|
-
contentContainer: {
|
|
108
|
-
padding: `${theme.spacing.unit * 2}px 0`,
|
|
109
|
-
},
|
|
110
|
-
configContainer: {
|
|
111
|
-
flex: '1',
|
|
112
|
-
},
|
|
113
|
-
settingsContainer: {
|
|
114
|
-
marginLeft: theme.spacing.unit * 2,
|
|
115
|
-
},
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
export default withStyles(styles)(RawLayoutContents);
|
|
117
|
+
export default RawLayoutContents;
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
|
+
|
|
5
|
+
const StyledSettingsBox = styled('div')(({ theme }) => ({
|
|
6
|
+
backgroundColor: theme.palette.background.paper,
|
|
7
|
+
border: `2px solid ${theme.palette.grey[200]}`,
|
|
8
|
+
display: 'flex',
|
|
9
|
+
flexDirection: 'column',
|
|
10
|
+
justifyContent: 'flex-start',
|
|
11
|
+
minWidth: '275px',
|
|
12
|
+
maxWidth: '300px',
|
|
13
|
+
padding: '20px 4px 4px 20px',
|
|
14
|
+
zIndex: 99,
|
|
15
|
+
}));
|
|
5
16
|
|
|
6
17
|
export class SettingsBox extends React.Component {
|
|
7
18
|
static propTypes = {
|
|
8
|
-
classes: PropTypes.object.isRequired,
|
|
9
19
|
className: PropTypes.string,
|
|
10
20
|
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
|
|
11
21
|
};
|
|
@@ -13,23 +23,10 @@ export class SettingsBox extends React.Component {
|
|
|
13
23
|
static defaultProps = {};
|
|
14
24
|
|
|
15
25
|
render() {
|
|
16
|
-
const {
|
|
26
|
+
const { className, children } = this.props;
|
|
17
27
|
|
|
18
|
-
return <
|
|
28
|
+
return <StyledSettingsBox className={className}>{children}</StyledSettingsBox>;
|
|
19
29
|
}
|
|
20
30
|
}
|
|
21
|
-
const styles = (theme) => ({
|
|
22
|
-
settingsBox: {
|
|
23
|
-
backgroundColor: theme.palette.background.paper,
|
|
24
|
-
border: `2px solid ${theme.palette.grey[200]}`,
|
|
25
|
-
display: 'flex',
|
|
26
|
-
flexDirection: 'column',
|
|
27
|
-
justifyContent: 'flex-start',
|
|
28
|
-
minWidth: '275px',
|
|
29
|
-
maxWidth: '300px',
|
|
30
|
-
padding: '20px 4px 4px 20px',
|
|
31
|
-
zIndex: 99,
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
31
|
|
|
35
|
-
export default
|
|
32
|
+
export default SettingsBox;
|
package/src/mui-box/index.jsx
CHANGED
|
@@ -1,61 +1,53 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import {
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
4
|
import debug from 'debug';
|
|
5
|
-
import classNames from 'classnames';
|
|
6
5
|
|
|
7
6
|
const log = debug('pie-elements:config-ui:mui-box');
|
|
8
7
|
|
|
9
|
-
const
|
|
10
|
-
const light = theme.palette.
|
|
8
|
+
const StyledMuiBox = styled('div')(({ theme, focused }) => {
|
|
9
|
+
const light = theme.palette.mode === 'light';
|
|
11
10
|
const bottomLineColor = light ? 'rgba(0, 0, 0, 0.42)' : 'rgba(255, 255, 255, 0.7)';
|
|
12
11
|
|
|
13
|
-
log(theme.palette.primary[theme.palette.
|
|
12
|
+
log(theme.palette.primary[theme.palette.mode || 'light']);
|
|
14
13
|
|
|
15
14
|
return {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
backgroundColor: bottomLineColor,
|
|
30
|
-
},
|
|
31
|
-
'&:hover:before': {
|
|
32
|
-
height: '2px',
|
|
33
|
-
},
|
|
34
|
-
'&:after': {
|
|
35
|
-
left: 0,
|
|
36
|
-
right: 0,
|
|
37
|
-
bottom: 0,
|
|
38
|
-
height: '2px',
|
|
39
|
-
content: '""',
|
|
40
|
-
position: 'absolute',
|
|
41
|
-
transform: 'scaleX(0)',
|
|
42
|
-
transition: 'transform 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms',
|
|
43
|
-
pointerEvents: 'none',
|
|
44
|
-
backgroundColor: theme.palette.primary[theme.palette.type], //'#304ffe'
|
|
45
|
-
},
|
|
15
|
+
paddingTop: theme.spacing(1),
|
|
16
|
+
paddingBottom: theme.spacing(1),
|
|
17
|
+
position: 'relative',
|
|
18
|
+
'&:before': {
|
|
19
|
+
left: 0,
|
|
20
|
+
right: 0,
|
|
21
|
+
bottom: 0,
|
|
22
|
+
height: '1px',
|
|
23
|
+
content: '""',
|
|
24
|
+
position: 'absolute',
|
|
25
|
+
transition: 'background-color 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms',
|
|
26
|
+
pointerEvents: 'none',
|
|
27
|
+
backgroundColor: bottomLineColor,
|
|
46
28
|
},
|
|
47
|
-
|
|
48
|
-
'
|
|
49
|
-
|
|
50
|
-
|
|
29
|
+
'&:hover:before': {
|
|
30
|
+
height: '2px',
|
|
31
|
+
},
|
|
32
|
+
'&:after': {
|
|
33
|
+
left: 0,
|
|
34
|
+
right: 0,
|
|
35
|
+
bottom: 0,
|
|
36
|
+
height: '2px',
|
|
37
|
+
content: '""',
|
|
38
|
+
position: 'absolute',
|
|
39
|
+
transform: focused ? 'scaleX(1)' : 'scaleX(0)',
|
|
40
|
+
transition: 'transform 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms',
|
|
41
|
+
pointerEvents: 'none',
|
|
42
|
+
backgroundColor: theme.palette.primary[theme.palette.mode], //'#304ffe'
|
|
51
43
|
},
|
|
52
44
|
};
|
|
53
|
-
})(({ children, classes, focused }) => {
|
|
54
|
-
const names = classNames(classes.muiBox, focused && classes.focused);
|
|
55
|
-
|
|
56
|
-
return <div className={names}>{children}</div>;
|
|
57
45
|
});
|
|
58
46
|
|
|
47
|
+
const MuiBox = ({ children, focused }) => {
|
|
48
|
+
return <StyledMuiBox focused={focused}>{children}</StyledMuiBox>;
|
|
49
|
+
};
|
|
50
|
+
|
|
59
51
|
MuiBox.propTypes = {
|
|
60
52
|
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
|
|
61
53
|
focused: PropTypes.bool.isRequired,
|
|
@@ -1,33 +1,31 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import TextField from '@material
|
|
4
|
-
import
|
|
5
|
-
import { withStyles } from '@material-ui/core/styles';
|
|
3
|
+
import TextField from '@mui/material/TextField';
|
|
4
|
+
import { styled } from '@mui/material/styles';
|
|
6
5
|
import isFinite from 'lodash/isFinite';
|
|
7
|
-
import IconButton from '@material
|
|
8
|
-
import InputAdornment from '@material
|
|
9
|
-
import Remove from '@
|
|
10
|
-
import Add from '@
|
|
6
|
+
import IconButton from '@mui/material/IconButton';
|
|
7
|
+
import InputAdornment from '@mui/material/InputAdornment';
|
|
8
|
+
import Remove from '@mui/icons-material/Remove';
|
|
9
|
+
import Add from '@mui/icons-material/Add';
|
|
11
10
|
import * as math from 'mathjs';
|
|
12
11
|
|
|
13
|
-
const
|
|
14
|
-
input: {
|
|
15
|
-
|
|
16
|
-
'-moz-appearance': 'textfield',
|
|
17
|
-
},
|
|
18
|
-
'& input[type=number]::-webkit-outer-spin-button': {
|
|
19
|
-
'-webkit-appearance': 'none',
|
|
20
|
-
margin: 0,
|
|
21
|
-
},
|
|
22
|
-
'& input[type=number]::-webkit-inner-spin-button': {
|
|
23
|
-
'-webkit-appearance': 'none',
|
|
24
|
-
margin: 0,
|
|
25
|
-
},
|
|
12
|
+
const StyledTextField = styled(TextField)(() => ({
|
|
13
|
+
'& input[type=number]': {
|
|
14
|
+
MozAppearance: 'textfield',
|
|
26
15
|
},
|
|
27
|
-
|
|
28
|
-
|
|
16
|
+
'& input[type=number]::-webkit-outer-spin-button': {
|
|
17
|
+
WebkitAppearance: 'none',
|
|
18
|
+
margin: 0,
|
|
29
19
|
},
|
|
30
|
-
|
|
20
|
+
'& input[type=number]::-webkit-inner-spin-button': {
|
|
21
|
+
WebkitAppearance: 'none',
|
|
22
|
+
margin: 0,
|
|
23
|
+
},
|
|
24
|
+
}));
|
|
25
|
+
|
|
26
|
+
const StyledIconButton = styled(IconButton)(() => ({
|
|
27
|
+
padding: '2px',
|
|
28
|
+
}));
|
|
31
29
|
|
|
32
30
|
const fallbackNumber = (min, max) => {
|
|
33
31
|
if (!isFinite(min) && !isFinite(max)) {
|
|
@@ -45,7 +43,6 @@ const fallbackNumber = (min, max) => {
|
|
|
45
43
|
|
|
46
44
|
export class NumberTextFieldCustom extends React.Component {
|
|
47
45
|
static propTypes = {
|
|
48
|
-
classes: PropTypes.object.isRequired,
|
|
49
46
|
className: PropTypes.string,
|
|
50
47
|
customValues: PropTypes.array,
|
|
51
48
|
disabled: PropTypes.bool,
|
|
@@ -242,7 +239,6 @@ export class NumberTextFieldCustom extends React.Component {
|
|
|
242
239
|
render() {
|
|
243
240
|
const {
|
|
244
241
|
className,
|
|
245
|
-
classes,
|
|
246
242
|
label,
|
|
247
243
|
disabled,
|
|
248
244
|
error,
|
|
@@ -257,7 +253,7 @@ export class NumberTextFieldCustom extends React.Component {
|
|
|
257
253
|
type = 'number',
|
|
258
254
|
} = this.props;
|
|
259
255
|
const { value } = this.state;
|
|
260
|
-
const names =
|
|
256
|
+
const names = className;
|
|
261
257
|
//Logic to disable the increment and decrement buttons
|
|
262
258
|
let disabledStart = false;
|
|
263
259
|
let disabledEnd = false;
|
|
@@ -270,7 +266,7 @@ export class NumberTextFieldCustom extends React.Component {
|
|
|
270
266
|
}
|
|
271
267
|
|
|
272
268
|
return (
|
|
273
|
-
<
|
|
269
|
+
<StyledTextField
|
|
274
270
|
variant={variant}
|
|
275
271
|
inputRef={(ref) => (this.inputRef = ref)}
|
|
276
272
|
disabled={disabled}
|
|
@@ -303,24 +299,22 @@ export class NumberTextFieldCustom extends React.Component {
|
|
|
303
299
|
disableUnderline: disableUnderline,
|
|
304
300
|
startAdornment: (
|
|
305
301
|
<InputAdornment position="start">
|
|
306
|
-
<
|
|
307
|
-
className={classes.iconButton}
|
|
302
|
+
<StyledIconButton
|
|
308
303
|
disabled={disabled ? disabled : disabledStart}
|
|
309
304
|
onClick={(e) => this.changeValue(e, -1, true)}
|
|
310
|
-
|
|
305
|
+
size="large">
|
|
311
306
|
<Remove fontSize="small" />
|
|
312
|
-
</
|
|
307
|
+
</StyledIconButton>
|
|
313
308
|
</InputAdornment>
|
|
314
309
|
),
|
|
315
310
|
endAdornment: (
|
|
316
311
|
<InputAdornment position="end">
|
|
317
|
-
<
|
|
318
|
-
className={classes.iconButton}
|
|
312
|
+
<StyledIconButton
|
|
319
313
|
disabled={disabled ? disabled : disabledEnd}
|
|
320
314
|
onClick={(e) => this.changeValue(e, 1, true)}
|
|
321
|
-
|
|
315
|
+
size="large">
|
|
322
316
|
<Add fontSize="small" />
|
|
323
|
-
</
|
|
317
|
+
</StyledIconButton>
|
|
324
318
|
</InputAdornment>
|
|
325
319
|
),
|
|
326
320
|
}}
|
|
@@ -334,4 +328,4 @@ export class NumberTextFieldCustom extends React.Component {
|
|
|
334
328
|
}
|
|
335
329
|
}
|
|
336
330
|
|
|
337
|
-
export default
|
|
331
|
+
export default NumberTextFieldCustom;
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import TextField from '@material
|
|
4
|
-
import
|
|
5
|
-
import { withStyles } from '@material-ui/core/styles';
|
|
3
|
+
import TextField from '@mui/material/TextField';
|
|
4
|
+
import { styled } from '@mui/material/styles';
|
|
6
5
|
import debug from 'debug';
|
|
7
6
|
import isFinite from 'lodash/isFinite';
|
|
8
|
-
import InputAdornment from '@material
|
|
7
|
+
import InputAdornment from '@mui/material/InputAdornment';
|
|
9
8
|
const log = debug('@pie-lib:config-ui:number-text-field');
|
|
10
9
|
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
width: 'max-content',
|
|
16
|
-
},
|
|
10
|
+
const StyledTextField = styled(TextField)(({ theme }) => ({
|
|
11
|
+
marginRight: theme.spacing(1),
|
|
12
|
+
'& label': {
|
|
13
|
+
width: 'max-content',
|
|
17
14
|
},
|
|
18
|
-
});
|
|
15
|
+
}));
|
|
19
16
|
|
|
20
17
|
const fallbackNumber = (min, max) => {
|
|
21
18
|
if (!isFinite(min) && !isFinite(max)) {
|
|
@@ -33,7 +30,6 @@ const fallbackNumber = (min, max) => {
|
|
|
33
30
|
export class NumberTextField extends React.Component {
|
|
34
31
|
static propTypes = {
|
|
35
32
|
disabled: PropTypes.bool,
|
|
36
|
-
classes: PropTypes.object.isRequired,
|
|
37
33
|
className: PropTypes.string,
|
|
38
34
|
inputClassName: PropTypes.string,
|
|
39
35
|
onChange: PropTypes.func.isRequired,
|
|
@@ -146,7 +142,6 @@ export class NumberTextField extends React.Component {
|
|
|
146
142
|
render() {
|
|
147
143
|
const {
|
|
148
144
|
className,
|
|
149
|
-
classes,
|
|
150
145
|
label,
|
|
151
146
|
disabled,
|
|
152
147
|
suffix,
|
|
@@ -157,12 +152,11 @@ export class NumberTextField extends React.Component {
|
|
|
157
152
|
showErrorWhenOutsideRange,
|
|
158
153
|
variant,
|
|
159
154
|
} = this.props;
|
|
160
|
-
const names = classNames(classes.root, className);
|
|
161
155
|
|
|
162
156
|
const error = showErrorWhenOutsideRange && this.getError();
|
|
163
157
|
return (
|
|
164
|
-
<
|
|
165
|
-
variant={variant || 'standard'}
|
|
158
|
+
<StyledTextField
|
|
159
|
+
variant={disableUnderline ? 'filled' : (variant || 'standard')}
|
|
166
160
|
inputRef={(ref) => {
|
|
167
161
|
this.inputRef = ref;
|
|
168
162
|
}}
|
|
@@ -173,25 +167,23 @@ export class NumberTextField extends React.Component {
|
|
|
173
167
|
helperText={error}
|
|
174
168
|
onChange={this.onChange}
|
|
175
169
|
onBlur={this.onBlur}
|
|
176
|
-
|
|
170
|
+
onKeyDown={(e) => {
|
|
177
171
|
// once the Enter key is pressed, we force input blur
|
|
178
172
|
if (e.key === 'Enter' && this.inputRef) {
|
|
179
173
|
this.inputRef.blur();
|
|
180
174
|
}
|
|
181
175
|
}}
|
|
182
176
|
type="number"
|
|
183
|
-
className={
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
min,
|
|
194
|
-
max,
|
|
177
|
+
className={className}
|
|
178
|
+
slotProps={{
|
|
179
|
+
input: {
|
|
180
|
+
endAdornment: suffix && <InputAdornment position="end">{suffix}</InputAdornment>,
|
|
181
|
+
className: inputClassName,
|
|
182
|
+
inputProps: {
|
|
183
|
+
min,
|
|
184
|
+
max,
|
|
185
|
+
},
|
|
186
|
+
},
|
|
195
187
|
}}
|
|
196
188
|
margin="normal"
|
|
197
189
|
/>
|
|
@@ -199,4 +191,4 @@ export class NumberTextField extends React.Component {
|
|
|
199
191
|
}
|
|
200
192
|
}
|
|
201
193
|
|
|
202
|
-
export default
|
|
194
|
+
export default NumberTextField;
|
package/src/radio-with-label.jsx
CHANGED
|
@@ -1,22 +1,26 @@
|
|
|
1
|
-
import FormControlLabel from '@material
|
|
2
|
-
import Radio from '@material
|
|
1
|
+
import FormControlLabel from '@mui/material/FormControlLabel';
|
|
2
|
+
import Radio from '@mui/material/Radio';
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { styled } from '@mui/material/styles';
|
|
5
5
|
import { color } from '@pie-lib/render-ui';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
label: {
|
|
7
|
+
const StyledFormControlLabel = styled(FormControlLabel)(() => ({
|
|
8
|
+
'& .MuiFormControlLabel-label': {
|
|
9
9
|
left: '-5px',
|
|
10
10
|
position: 'relative',
|
|
11
11
|
},
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
}));
|
|
13
|
+
|
|
14
|
+
const StyledRadio = styled(Radio)(() => ({
|
|
15
|
+
color: `${color.tertiary()} !important`,
|
|
16
|
+
}));
|
|
17
|
+
|
|
18
|
+
const RadioWithLabel = ({ label, value, checked, onChange }) => (
|
|
19
|
+
<StyledFormControlLabel
|
|
17
20
|
value={value}
|
|
18
|
-
|
|
19
|
-
control={<Radio className={classes.customColor} checked={checked} onChange={onChange} />}
|
|
21
|
+
control={<StyledRadio checked={checked} onChange={onChange} />}
|
|
20
22
|
label={label}
|
|
21
23
|
/>
|
|
22
|
-
)
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export default RadioWithLabel;
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import Typography from '@material
|
|
4
|
-
import {
|
|
3
|
+
import Typography from '@mui/material/Typography';
|
|
4
|
+
import { styled } from '@mui/material/styles';
|
|
5
5
|
import NumberTextField from '../number-text-field';
|
|
6
6
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
const StyledDisplaySize = styled('div')(({ theme }) => ({
|
|
8
|
+
display: 'flex',
|
|
9
|
+
paddingTop: theme.spacing(1),
|
|
10
|
+
}));
|
|
11
|
+
|
|
12
|
+
const DisplaySize = ({ size, label, onChange }) => {
|
|
13
13
|
const updateSize = (key, v) => {
|
|
14
14
|
onChange({ ...size, [key]: v });
|
|
15
15
|
};
|
|
16
|
+
|
|
16
17
|
return (
|
|
17
18
|
<div>
|
|
18
19
|
<Typography>{label}</Typography>
|
|
19
|
-
<
|
|
20
|
+
<StyledDisplaySize>
|
|
20
21
|
<NumberTextField
|
|
21
22
|
label="Width"
|
|
22
23
|
type="number"
|
|
@@ -35,10 +36,10 @@ const DisplaySize = withStyles((theme) => ({
|
|
|
35
36
|
value={size.height}
|
|
36
37
|
onChange={(e, v) => updateSize('height', v)}
|
|
37
38
|
/>
|
|
38
|
-
</
|
|
39
|
+
</StyledDisplaySize>
|
|
39
40
|
</div>
|
|
40
41
|
);
|
|
41
|
-
}
|
|
42
|
+
};
|
|
42
43
|
|
|
43
44
|
DisplaySize.propTypes = {
|
|
44
45
|
size: PropTypes.shape({
|