@pie-lib/config-ui 11.30.2-next.0 → 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.
Files changed (91) hide show
  1. package/CHANGELOG.md +23 -8
  2. package/lib/alert-dialog.js +35 -42
  3. package/lib/alert-dialog.js.map +1 -1
  4. package/lib/checkbox.js +56 -71
  5. package/lib/checkbox.js.map +1 -1
  6. package/lib/choice-configuration/feedback-menu.js +29 -64
  7. package/lib/choice-configuration/feedback-menu.js.map +1 -1
  8. package/lib/choice-configuration/index.js +202 -260
  9. package/lib/choice-configuration/index.js.map +1 -1
  10. package/lib/choice-utils.js +6 -18
  11. package/lib/choice-utils.js.map +1 -1
  12. package/lib/feedback-config/feedback-selector.js +77 -114
  13. package/lib/feedback-config/feedback-selector.js.map +1 -1
  14. package/lib/feedback-config/group.js +26 -40
  15. package/lib/feedback-config/group.js.map +1 -1
  16. package/lib/feedback-config/index.js +38 -90
  17. package/lib/feedback-config/index.js.map +1 -1
  18. package/lib/form-section.js +24 -33
  19. package/lib/form-section.js.map +1 -1
  20. package/lib/help.js +39 -80
  21. package/lib/help.js.map +1 -1
  22. package/lib/index.js +1 -31
  23. package/lib/index.js.map +1 -1
  24. package/lib/input.js +21 -54
  25. package/lib/input.js.map +1 -1
  26. package/lib/inputs.js +61 -95
  27. package/lib/inputs.js.map +1 -1
  28. package/lib/langs.js +56 -100
  29. package/lib/langs.js.map +1 -1
  30. package/lib/layout/config-layout.js +61 -99
  31. package/lib/layout/config-layout.js.map +1 -1
  32. package/lib/layout/index.js +0 -3
  33. package/lib/layout/index.js.map +1 -1
  34. package/lib/layout/layout-contents.js +71 -101
  35. package/lib/layout/layout-contents.js.map +1 -1
  36. package/lib/layout/settings-box.js +27 -56
  37. package/lib/layout/settings-box.js.map +1 -1
  38. package/lib/mui-box/index.js +41 -57
  39. package/lib/mui-box/index.js.map +1 -1
  40. package/lib/number-text-field-custom.js +79 -161
  41. package/lib/number-text-field-custom.js.map +1 -1
  42. package/lib/number-text-field.js +57 -115
  43. package/lib/number-text-field.js.map +1 -1
  44. package/lib/radio-with-label.js +23 -31
  45. package/lib/radio-with-label.js.map +1 -1
  46. package/lib/settings/display-size.js +16 -32
  47. package/lib/settings/display-size.js.map +1 -1
  48. package/lib/settings/index.js +14 -47
  49. package/lib/settings/index.js.map +1 -1
  50. package/lib/settings/panel.js +151 -229
  51. package/lib/settings/panel.js.map +1 -1
  52. package/lib/settings/settings-radio-label.js +21 -30
  53. package/lib/settings/settings-radio-label.js.map +1 -1
  54. package/lib/settings/toggle.js +34 -46
  55. package/lib/settings/toggle.js.map +1 -1
  56. package/lib/tabs/index.js +22 -57
  57. package/lib/tabs/index.js.map +1 -1
  58. package/lib/tags-input/index.js +50 -99
  59. package/lib/tags-input/index.js.map +1 -1
  60. package/lib/two-choice.js +46 -90
  61. package/lib/two-choice.js.map +1 -1
  62. package/lib/with-stateful-model.js +8 -31
  63. package/lib/with-stateful-model.js.map +1 -1
  64. package/package.json +12 -10
  65. package/src/__tests__/number-text-field.test.jsx +1 -1
  66. package/src/alert-dialog.jsx +21 -19
  67. package/src/checkbox.jsx +42 -46
  68. package/src/choice-configuration/feedback-menu.jsx +6 -6
  69. package/src/choice-configuration/index.jsx +202 -195
  70. package/src/feedback-config/feedback-selector.jsx +51 -53
  71. package/src/feedback-config/group.jsx +21 -22
  72. package/src/feedback-config/index.jsx +27 -29
  73. package/src/form-section.jsx +18 -18
  74. package/src/help.jsx +20 -28
  75. package/src/input.jsx +1 -1
  76. package/src/inputs.jsx +34 -50
  77. package/src/langs.jsx +40 -46
  78. package/src/layout/config-layout.jsx +38 -36
  79. package/src/layout/layout-contents.jsx +34 -35
  80. package/src/layout/settings-box.jsx +16 -19
  81. package/src/mui-box/index.jsx +35 -43
  82. package/src/number-text-field-custom.jsx +30 -36
  83. package/src/number-text-field.jsx +22 -30
  84. package/src/radio-with-label.jsx +17 -13
  85. package/src/settings/display-size.jsx +12 -11
  86. package/src/settings/panel.jsx +86 -89
  87. package/src/settings/settings-radio-label.jsx +17 -13
  88. package/src/settings/toggle.jsx +29 -29
  89. package/src/tabs/index.jsx +8 -8
  90. package/src/tags-input/index.jsx +35 -38
  91. 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 { withStyles } from '@material-ui/core';
3
+ import { styled } from '@mui/material/styles';
5
4
  import Tabs from '../tabs';
6
- import classNames from 'classnames';
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, classes, dimensions } = this.props;
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
- <div className={classes.container} style={{ minHeight, minWidth, maxHeight, maxWidth }}>
88
+ <StyledContainer style={{ minHeight, minWidth, maxHeight, maxWidth }}>
69
89
  {mode === 'inline' && (
70
- <div className={classnames(classes.flow, classes.contentContainer)}>
71
- <div className={classnames(classes.configContainer, 'design-container')}>{children}</div>
90
+ <StyledFlow>
91
+ <StyledConfigContainer className="design-container">{children}</StyledConfigContainer>
72
92
  {hasSettingsPanel && (
73
- <div className={classnames(classes.settingsContainer, 'settings-container')}>{secondary}</div>
93
+ <StyledSettingsContainer className="settings-container">{secondary}</StyledSettingsContainer>
74
94
  )}
75
- </div>
95
+ </StyledFlow>
76
96
  )}
77
97
 
78
98
  {mode === 'tabbed' && hasSettingsPanel && (
79
- <Tabs onChange={this.onTabsChange} contentClassName={classes.contentContainer} indicatorColor="primary">
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
- <div className={classNames(classes.contentContainer, 'design-container')}>{children}</div>
110
+ <StyledContentContainer className="design-container">{children}</StyledContentContainer>
91
111
  )}
92
- </div>
112
+ </StyledContainer>
93
113
  );
94
114
  }
95
115
  }
96
116
 
97
- const styles = (theme) => ({
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 { withStyles } from '@material-ui/core/styles';
4
- import classNames from 'classnames';
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 { classes, className, children } = this.props;
26
+ const { className, children } = this.props;
17
27
 
18
- return <div className={classNames(classes.settingsBox, className)}>{children}</div>;
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 withStyles(styles)(SettingsBox);
32
+ export default SettingsBox;
@@ -1,61 +1,53 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { withStyles } from '@material-ui/core/styles';
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 MuiBox = withStyles((theme) => {
10
- const light = theme.palette.type === 'light';
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.type || 'light']);
12
+ log(theme.palette.primary[theme.palette.mode || 'light']);
14
13
 
15
14
  return {
16
- muiBox: {
17
- paddingTop: theme.spacing.unit,
18
- paddingBottom: theme.spacing.unit,
19
- position: 'relative',
20
- '&:before': {
21
- left: 0,
22
- right: 0,
23
- bottom: 0,
24
- height: '1px',
25
- content: '""',
26
- position: 'absolute',
27
- transition: 'background-color 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms',
28
- pointerEvents: 'none',
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
- focused: {
48
- '&:after': {
49
- transform: 'scaleX(1)',
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-ui/core/TextField';
4
- import classNames from 'classnames';
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-ui/core/IconButton';
8
- import InputAdornment from '@material-ui/core/InputAdornment';
9
- import Remove from '@material-ui/icons/Remove';
10
- import Add from '@material-ui/icons/Add';
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 styles = () => ({
14
- input: {
15
- '& input[type=number]': {
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
- iconButton: {
28
- padding: '2px',
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 = classNames(className, classes.input);
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
- <TextField
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
- <IconButton
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
- </IconButton>
307
+ </StyledIconButton>
313
308
  </InputAdornment>
314
309
  ),
315
310
  endAdornment: (
316
311
  <InputAdornment position="end">
317
- <IconButton
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
- </IconButton>
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 withStyles(styles)(NumberTextFieldCustom);
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-ui/core/TextField';
4
- import classNames from 'classnames';
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-ui/core/InputAdornment';
7
+ import InputAdornment from '@mui/material/InputAdornment';
9
8
  const log = debug('@pie-lib:config-ui:number-text-field');
10
9
 
11
- const styles = (theme) => ({
12
- root: {
13
- marginRight: theme.spacing.unit,
14
- '& label': {
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
- <TextField
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
- onKeyPress={(e) => {
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={names}
184
- InputLabelProps={{
185
- shrink: true,
186
- }}
187
- InputProps={{
188
- endAdornment: suffix && <InputAdornment position="end">{suffix}</InputAdornment>,
189
- className: inputClassName,
190
- disableUnderline: disableUnderline,
191
- }}
192
- inputProps={{
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 withStyles(styles)(NumberTextField);
194
+ export default NumberTextField;
@@ -1,22 +1,26 @@
1
- import FormControlLabel from '@material-ui/core/FormControlLabel';
2
- import Radio from '@material-ui/core/Radio';
1
+ import FormControlLabel from '@mui/material/FormControlLabel';
2
+ import Radio from '@mui/material/Radio';
3
3
  import React from 'react';
4
- import { withStyles } from '@material-ui/core/styles';
4
+ import { styled } from '@mui/material/styles';
5
5
  import { color } from '@pie-lib/render-ui';
6
6
 
7
- export default withStyles({
8
- label: {
7
+ const StyledFormControlLabel = styled(FormControlLabel)(() => ({
8
+ '& .MuiFormControlLabel-label': {
9
9
  left: '-5px',
10
10
  position: 'relative',
11
11
  },
12
- customColor: {
13
- color: `${color.tertiary()} !important`,
14
- },
15
- })(({ label, value, checked, onChange, classes }) => (
16
- <FormControlLabel
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
- classes={{ label: classes.label }}
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-ui/core/Typography';
4
- import { withStyles } from '@material-ui/core/styles';
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 DisplaySize = withStyles((theme) => ({
8
- displaySize: {
9
- display: 'flex',
10
- paddingTop: theme.spacing.unit,
11
- },
12
- }))(({ size, label, classes, onChange }) => {
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
- <div className={classes.displaySize}>
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
- </div>
39
+ </StyledDisplaySize>
39
40
  </div>
40
41
  );
41
- });
42
+ };
42
43
 
43
44
  DisplaySize.propTypes = {
44
45
  size: PropTypes.shape({