@pie-lib/config-ui 11.26.6-esmbeta.0 → 11.27.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 (94) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/lib/alert-dialog.js +23 -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 +24 -63
  7. package/lib/choice-configuration/feedback-menu.js.map +1 -1
  8. package/lib/choice-configuration/index.js +201 -257
  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 +30 -65
  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 +72 -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 +142 -228
  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 -17
  65. package/src/__tests__/number-text-field.test.jsx +1 -1
  66. package/src/alert-dialog.jsx +14 -18
  67. package/src/checkbox.jsx +42 -46
  68. package/src/choice-configuration/feedback-menu.jsx +5 -5
  69. package/src/choice-configuration/index.jsx +205 -193
  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 +27 -23
  79. package/src/layout/layout-contents.jsx +34 -34
  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 +83 -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
  92. package/esm/index.js +0 -78747
  93. package/esm/index.js.map +0 -1
  94. package/esm/package.json +0 -1
@@ -1,11 +1,11 @@
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 get from 'lodash/get';
5
5
  import set from 'lodash/set';
6
- import Select from '@material-ui/core/Select';
7
- import Input from '@material-ui/core/Input';
8
- import MenuItem from '@material-ui/core/MenuItem';
6
+ import Select from '@mui/material/Select';
7
+ import Input from '@mui/material/Input';
8
+ import MenuItem from '@mui/material/MenuItem';
9
9
  import debug from 'debug';
10
10
 
11
11
  import Toggle from './toggle';
@@ -13,7 +13,7 @@ import { NChoice } from '../two-choice';
13
13
  import SettingsRadioLabel from './settings-radio-label';
14
14
  import NumberTextField from '../number-text-field';
15
15
  import Checkbox from '../checkbox';
16
- import Typography from '@material-ui/core/Typography';
16
+ import Typography from '@mui/material/Typography';
17
17
 
18
18
  const log = debug('pie-lib:config-ui:settings:panel');
19
19
 
@@ -46,10 +46,23 @@ CheckboxChoice.propTypes = {
46
46
  onChange: PropTypes.func,
47
47
  };
48
48
 
49
- const Radio = ({ classes, label, value, onChange, choices }) => {
49
+ const StyledNChoice = styled(NChoice)(({ theme }) => ({
50
+ marginTop: theme.spacing(0.5),
51
+ paddingBottom: theme.spacing(0.5),
52
+ width: '100%',
53
+ '& > label': {
54
+ color: 'rgba(0, 0, 0, 0.89)',
55
+ transform: 'translate(0, 10px) scale(1)',
56
+ fontSize: '14px',
57
+ },
58
+ '& > div': {
59
+ marginTop: theme.spacing(2.5),
60
+ },
61
+ }));
62
+
63
+ const Radio = ({ label, value, onChange, choices }) => {
50
64
  return (
51
- <NChoice
52
- className={classes.radioSettings}
65
+ <StyledNChoice
53
66
  direction="horizontal"
54
67
  customLabel={SettingsRadioLabel}
55
68
  value={value}
@@ -62,44 +75,27 @@ const Radio = ({ classes, label, value, onChange, choices }) => {
62
75
 
63
76
  Radio.propTypes = { ...baseTypes, choices: PropTypes.arrayOf(PropTypes.shape(labelValue)) };
64
77
 
65
- const StyledRadio = withStyles((theme) => ({
66
- radioSettings: {
67
- marginTop: theme.spacing.unit / 2,
68
- paddingBottom: theme.spacing.unit / 2,
69
- width: '100%',
70
- '& > label': {
71
- color: 'rgba(0, 0, 0, 0.89)',
72
- transform: 'translate(0, 10px) scale(1)',
73
- fontSize: '14px',
74
- },
75
- '& > div': {
76
- marginTop: theme.spacing.unit * 2.5,
77
- },
78
- },
79
- label: {
80
- display: 'none',
81
- },
82
- }))(Radio);
78
+ const StyledRadio = Radio;
83
79
 
84
- const Dropdown = withStyles((theme) => ({
85
- label: {
86
- margin: 0,
87
- fontSize: theme.typography.fontSize,
88
- },
89
- wrapper: {
90
- marginTop: theme.spacing.unit / 2,
91
- border: '2px solid lightgrey',
92
- borderRadius: '4px',
93
- padding: `0 ${theme.spacing.unit}px`,
94
- },
95
- }))(({ classes, label, value, onChange, choices = [] }) => {
80
+ const StyledLabel = styled('p')(({ theme }) => ({
81
+ margin: 0,
82
+ fontSize: theme.typography.fontSize,
83
+ }));
84
+
85
+ const StyledSelect = styled(Select)(({ theme }) => ({
86
+ marginTop: theme.spacing(0.5),
87
+ border: '2px solid lightgrey',
88
+ borderRadius: '4px',
89
+ padding: `0 ${theme.spacing(1)}px`,
90
+ }));
91
+
92
+ const Dropdown = ({ label, value, onChange, choices = [] }) => {
96
93
  const getItemLabel = (l) => (typeof l === 'string' ? l : l.label);
97
94
  const getItemValue = (l) => (typeof l === 'string' ? l : l.value);
98
95
  return (
99
96
  <div>
100
- {label && <p className={classes.label}>{label}</p>}
101
- <Select
102
- className={classes.wrapper}
97
+ {label && <StyledLabel>{label}</StyledLabel>}
98
+ <StyledSelect
103
99
  value={value || (choices && choices[0])}
104
100
  onChange={({ target }) => onChange(target.value)}
105
101
  input={<Input id={`dropdown-${label}`} />}
@@ -110,55 +106,51 @@ const Dropdown = withStyles((theme) => ({
110
106
  {getItemLabel(l)}
111
107
  </MenuItem>
112
108
  ))}
113
- </Select>
109
+ </StyledSelect>
114
110
  </div>
115
111
  );
116
- });
112
+ };
117
113
 
118
114
  Dropdown.propTypes = { ...baseTypes, choices: PropTypes.arrayOf(PropTypes.string) };
119
115
 
120
- const TextField = withStyles((theme) => ({
121
- field: {
122
- marginRight: theme.spacing.unit * 3,
123
- marginTop: theme.spacing.unit,
124
- },
125
- }))(({ classes, label }) => {
126
- return <Typography className={classes.field}>{label}</Typography>;
127
- });
128
-
129
- const NumberField = withStyles((theme) => ({
130
- field: {
131
- width: '35%',
132
- marginRight: theme.spacing.unit * 3,
133
- marginTop: theme.spacing.unit,
134
- },
135
- wrapper: {
136
- marginTop: theme.spacing.unit / 2,
116
+ const StyledTypography = styled(Typography)(({ theme }) => ({
117
+ marginRight: theme.spacing(3),
118
+ marginTop: theme.spacing(1),
119
+ }));
120
+
121
+ const TextField = ({ label }) => {
122
+ return <StyledTypography>{label}</StyledTypography>;
123
+ };
124
+
125
+ const StyledNumberTextField = styled(NumberTextField)(({ theme }) => ({
126
+ width: '35%',
127
+ marginRight: theme.spacing(3),
128
+ marginTop: theme.spacing(1),
129
+ '& .MuiInputBase-root': {
130
+ marginTop: theme.spacing(0.5),
137
131
  border: '2px solid lightgrey',
138
132
  borderRadius: '4px',
139
- padding: `0 ${theme.spacing.unit}px`,
133
+ padding: `0 ${theme.spacing(1)}px`,
140
134
  },
141
- }))(({ classes, label, value, onChange = () => {}, suffix, min, max }) => {
135
+ }));
136
+
137
+ const NumberField = ({ label, value, onChange = () => {}, suffix, min, max }) => {
142
138
  return (
143
- <NumberTextField
139
+ <StyledNumberTextField
144
140
  label={label || 'Label'}
145
141
  value={value}
146
142
  max={max}
147
143
  min={min}
148
144
  onChange={(ev, value) => onChange(value)}
149
145
  suffix={suffix}
150
- className={classes.field}
151
146
  showErrorWhenOutsideRange
152
- inputClassName={classes.wrapper}
153
147
  disableUnderline
154
- classes={classes}
155
148
  />
156
149
  );
157
- });
150
+ };
158
151
 
159
152
  NumberField.propTypes = {
160
153
  ...baseTypes,
161
- classes: PropTypes.object,
162
154
  suffix: PropTypes.string,
163
155
  min: PropTypes.number,
164
156
  max: PropTypes.number,
@@ -184,22 +176,24 @@ const tagMap = {
184
176
  textField: TextField,
185
177
  };
186
178
 
187
- const Group = withStyles((theme) => ({
188
- group: {
189
- margin: `0 0 ${theme.spacing.unit * 2}px 0`,
190
- },
191
- groupHeader: {
192
- color: '#495B8F',
193
- fontSize: theme.typography.fontSize + 2,
194
- fontWeight: 600,
195
- marginBottom: theme.spacing.unit,
196
- },
197
- numberFields: {
198
- fontSize: theme.typography.fontSize,
199
- marginBottom: 0,
200
- },
201
- }))((props) => {
202
- const { classes, model, label, group, configuration, onChange } = props;
179
+ const StyledGroup = styled('div')(({ theme }) => ({
180
+ margin: `0 0 ${theme.spacing(2)}px 0`,
181
+ }));
182
+
183
+ const StyledGroupHeader = styled('div')(({ theme }) => ({
184
+ color: '#495B8F',
185
+ fontSize: theme.typography.fontSize + 2,
186
+ fontWeight: 600,
187
+ marginBottom: theme.spacing(1),
188
+ }));
189
+
190
+ const StyledNumberFields = styled('p')(({ theme }) => ({
191
+ fontSize: theme.typography.fontSize,
192
+ marginBottom: 0,
193
+ }));
194
+
195
+ const Group = (props) => {
196
+ const { model, label, group, configuration, onChange } = props;
203
197
 
204
198
  /**
205
199
  * @param group - the group of settings
@@ -227,7 +221,7 @@ const Group = withStyles((theme) => ({
227
221
  if (type === 'numberFields') {
228
222
  return (
229
223
  <div key={`numberField-${label}`}>
230
- <p className={classes.numberFields}>{label}</p>
224
+ <StyledNumberFields>{label}</StyledNumberFields>
231
225
  {Object.keys(fields).map((fieldKey) => {
232
226
  return getTag(group, `${key}.${fieldKey}`, `${key}.fields.${fieldKey}`);
233
227
  })}
@@ -251,15 +245,15 @@ const Group = withStyles((theme) => ({
251
245
  };
252
246
 
253
247
  return (
254
- <div className={classes.group}>
255
- <div className={classes.groupHeader}>{label}</div>
248
+ <StyledGroup>
249
+ <StyledGroupHeader>{label}</StyledGroupHeader>
256
250
 
257
251
  {Object.keys(group).map((key) => {
258
252
  return content(group, key);
259
253
  })}
260
- </div>
254
+ </StyledGroup>
261
255
  );
262
- });
256
+ };
263
257
 
264
258
  export class Panel extends React.Component {
265
259
  static propTypes = {
@@ -1,24 +1,28 @@
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((theme) => ({
8
- label: {
7
+ const StyledFormControlLabel = styled(FormControlLabel)(({ theme }) => ({
8
+ '& .MuiFormControlLabel-label': {
9
9
  color: 'rgba(0, 0, 0, 0.89)',
10
10
  fontSize: theme.typography.fontSize - 2,
11
11
  left: '-5px',
12
12
  position: 'relative',
13
13
  },
14
- customColor: {
15
- color: `${color.tertiary()} !important`,
16
- },
17
- }))(({ label, value, checked, onChange, classes }) => (
18
- <FormControlLabel
14
+ }));
15
+
16
+ const StyledRadio = styled(Radio)(() => ({
17
+ color: `${color.tertiary()} !important`,
18
+ }));
19
+
20
+ const SettingsRadioLabel = ({ label, value, checked, onChange }) => (
21
+ <StyledFormControlLabel
19
22
  value={value}
20
- classes={{ label: classes.label }}
21
- control={<Radio className={classes.customColor} checked={checked} onChange={onChange} />}
23
+ control={<StyledRadio checked={checked} onChange={onChange} />}
22
24
  label={label}
23
25
  />
24
- ));
26
+ );
27
+
28
+ export default SettingsRadioLabel;
@@ -1,44 +1,44 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import InputLabel from '@material-ui/core/InputLabel';
4
- import { withStyles } from '@material-ui/core/styles';
5
- import Switch from '@material-ui/core/Switch';
6
- import classNames from 'classnames';
3
+ import InputLabel from '@mui/material/InputLabel';
4
+ import { styled } from '@mui/material/styles';
5
+ import Switch from '@mui/material/Switch';
7
6
  import { color } from '@pie-lib/render-ui';
8
7
 
9
- const Toggle = withStyles((theme) => ({
10
- toggle: {
11
- display: 'flex',
12
- width: '100%',
13
- justifyContent: 'space-between',
14
- },
15
- label: {
16
- color: 'rgba(0, 0, 0, 0.89)',
17
- fontSize: theme.typography.fontSize,
18
- paddingTop: theme.spacing.unit * 2,
19
- },
20
- checkedThumb: {
8
+ const StyledToggle = styled('div')(() => ({
9
+ display: 'flex',
10
+ width: '100%',
11
+ justifyContent: 'space-between',
12
+ }));
13
+
14
+ const StyledInputLabel = styled(InputLabel)(({ theme }) => ({
15
+ color: 'rgba(0, 0, 0, 0.89)',
16
+ fontSize: theme.typography.fontSize,
17
+ paddingTop: theme.spacing(2),
18
+ }));
19
+
20
+ const StyledSwitch = styled(Switch)(({ checked }) => ({
21
+ '&.Mui-checked .MuiSwitch-thumb': {
21
22
  color: `${color.tertiary()} !important`,
22
23
  },
23
- checkedBar: {
24
+ '&.Mui-checked .MuiSwitch-track': {
24
25
  backgroundColor: `${color.tertiaryLight()} !important`,
25
26
  },
26
- }))(({ checked, disabled, label, toggle, classes }) => (
27
- <div className={classes.toggle}>
28
- <InputLabel className={classes.label}>{label}</InputLabel>
29
- <Switch
30
- classes={{
31
- checked: classNames(classes.checkedThumb),
32
- bar: classNames({
33
- [classes.checkedBar]: checked,
34
- }),
35
- }}
27
+ '& .MuiSwitch-track': {
28
+ backgroundColor: checked ? `${color.tertiaryLight()} !important` : undefined,
29
+ },
30
+ }));
31
+
32
+ const Toggle = ({ checked, disabled, label, toggle }) => (
33
+ <StyledToggle>
34
+ <StyledInputLabel>{label}</StyledInputLabel>
35
+ <StyledSwitch
36
36
  checked={checked}
37
37
  disabled={disabled}
38
38
  onChange={(e) => toggle(e.target.checked)}
39
39
  />
40
- </div>
41
- ));
40
+ </StyledToggle>
41
+ );
42
42
 
43
43
  Toggle.propTypes = {
44
44
  checked: PropTypes.bool,
@@ -1,13 +1,14 @@
1
1
  import React from 'react';
2
2
 
3
- import MuiTabs from '@material-ui/core/Tabs';
4
- import MuiTab from '@material-ui/core/Tab';
3
+ import MuiTabs from '@mui/material/Tabs';
4
+ import MuiTab from '@mui/material/Tab';
5
5
  import PropTypes from 'prop-types';
6
- import { withStyles } from '@material-ui/core';
6
+ import { styled } from '@mui/material/styles';
7
+
8
+ const StyledMuiTab = styled(MuiTab)(() => ({}));
7
9
 
8
10
  export class Tabs extends React.Component {
9
11
  static propTypes = {
10
- classes: PropTypes.object,
11
12
  className: PropTypes.string,
12
13
  contentClassName: PropTypes.string,
13
14
  contentStyle: PropTypes.object,
@@ -25,14 +26,13 @@ export class Tabs extends React.Component {
25
26
 
26
27
  render() {
27
28
  const { value } = this.state;
28
- const { children, className, contentClassName, contentStyle = {}, classes } = this.props;
29
- const tabClasses = { root: classes.tabRoot };
29
+ const { children, className, contentClassName, contentStyle = {} } = this.props;
30
30
 
31
31
  return (
32
32
  <div className={className}>
33
33
  <MuiTabs indicatorColor="primary" value={value} onChange={this.handleChange}>
34
34
  {React.Children.map(children, (c, index) =>
35
- c && c.props.title ? <MuiTab classes={tabClasses} key={index} label={c.props.title} /> : null,
35
+ c && c.props.title ? <StyledMuiTab key={index} label={c.props.title} /> : null,
36
36
  )}
37
37
  </MuiTabs>
38
38
 
@@ -44,4 +44,4 @@ export class Tabs extends React.Component {
44
44
  }
45
45
  }
46
46
 
47
- export default withStyles(() => ({ tabRoot: {} }))(Tabs);
47
+ export default Tabs;
@@ -1,27 +1,48 @@
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 uniq from 'lodash/uniq';
5
- import Chip from '@material-ui/core/Chip';
5
+ import Chip from '@mui/material/Chip';
6
6
  import MuiBox from '../mui-box';
7
7
 
8
8
  const ENTER = 13;
9
9
 
10
- const Tag = withStyles(() => ({
11
- tag: {
12
- padding: '0px',
13
- margin: '1px',
14
- },
15
- }))(({ classes, label, onDelete }) => <Chip className={classes.tag} label={label} onDelete={onDelete} />);
10
+ const StyledChip = styled(Chip)(() => ({
11
+ padding: '0px',
12
+ margin: '1px',
13
+ }));
14
+
15
+ const Tag = ({ label, onDelete }) => <StyledChip label={label} onDelete={onDelete} />;
16
16
 
17
17
  Tag.propTypes = {
18
18
  label: PropTypes.string.isRequired,
19
19
  onDelete: PropTypes.func.isRequired,
20
20
  };
21
21
 
22
+ const StyledTagsInput = styled('div')(({ theme }) => ({
23
+ border: `0px solid ${theme.palette.background.paper}`,
24
+ display: 'flex',
25
+ flexWrap: 'wrap',
26
+ }));
27
+
28
+ const StyledInput = styled('input')(({ theme }) => ({
29
+ padding: '2px',
30
+ margin: '1px',
31
+ minWidth: '30px',
32
+ width: '100%',
33
+ flex: '1',
34
+ border: `0px solid ${theme.palette.background.paper}`,
35
+ height: '28px',
36
+ fontSize: theme.typography.fontSize,
37
+ fontFamily: theme.typography.fontFamily,
38
+ outline: 'none',
39
+ '&:focus': {
40
+ outline: 'none',
41
+ },
42
+ }));
43
+
22
44
  export class TagsInput extends React.Component {
23
45
  static propTypes = {
24
- classes: PropTypes.object.isRequired,
25
46
  tags: PropTypes.arrayOf(PropTypes.string).isRequired,
26
47
  onChange: PropTypes.func.isRequired,
27
48
  };
@@ -70,50 +91,26 @@ export class TagsInput extends React.Component {
70
91
  };
71
92
 
72
93
  render() {
73
- const { classes, tags } = this.props;
94
+ const { tags } = this.props;
74
95
  return (
75
96
  <MuiBox focused={this.state.focused}>
76
- <div className={classes.tagsInput}>
97
+ <StyledTagsInput>
77
98
  {(tags || []).map((t, index) => (
78
99
  <Tag key={index} label={t} onDelete={() => this.deleteTag(t)} />
79
100
  ))}
80
- <input
101
+ <StyledInput
81
102
  ref={(r) => (this.input = r)}
82
103
  onKeyDown={this.onKeyDown}
83
104
  onChange={this.onChange}
84
- className={classes.input}
85
105
  value={this.state.value}
86
106
  onFocus={this.onFocus}
87
107
  onBlur={this.onBlur}
88
108
  type="text"
89
109
  />
90
- </div>
110
+ </StyledTagsInput>
91
111
  </MuiBox>
92
112
  );
93
113
  }
94
114
  }
95
115
 
96
- const styles = (theme) => ({
97
- tagsInput: {
98
- border: `0px solid ${theme.palette.background.paper}`,
99
- display: 'flex',
100
- flexWrap: 'wrap',
101
- },
102
- input: {
103
- padding: '2px',
104
- margin: '1px',
105
- minWidth: '30px',
106
- width: '100%',
107
- flex: '1',
108
- border: `0px solid ${theme.palette.background.paper}`,
109
- height: '28px',
110
- fontSize: theme.typography.fontSize,
111
- fontFamily: theme.typography.fontFamily,
112
- outline: 'none',
113
- '&:focus': {
114
- outline: 'none',
115
- },
116
- },
117
- });
118
-
119
- export default withStyles(styles)(TagsInput);
116
+ export default TagsInput;
@@ -2,22 +2,19 @@ import { InputContainer } from '@pie-lib/render-ui';
2
2
  import PropTypes from 'prop-types';
3
3
  import RadioWithLabel from './radio-with-label';
4
4
  import React from 'react';
5
- import classNames from 'classnames';
6
- import { withStyles } from '@material-ui/core/styles';
5
+ import { styled } from '@mui/material/styles';
7
6
 
8
- const styles = (theme) => ({
9
- group: {
10
- display: 'flex',
11
- flexWrap: 'wrap',
12
- paddingLeft: 0,
13
- marginTop: theme.spacing.unit,
14
- },
15
- vertical: {
7
+ const StyledGroup = styled('div')(({ theme, direction }) => ({
8
+ display: 'flex',
9
+ flexWrap: 'wrap',
10
+ paddingLeft: 0,
11
+ marginTop: theme.spacing(1),
12
+ ...(direction === 'vertical' && {
16
13
  flexDirection: 'column',
17
- },
18
- });
14
+ }),
15
+ }));
19
16
 
20
- class RawNChoice extends React.Component {
17
+ class NChoice extends React.Component {
21
18
  static propTypes = {
22
19
  header: PropTypes.string.isRequired,
23
20
  className: PropTypes.string,
@@ -26,7 +23,6 @@ class RawNChoice extends React.Component {
26
23
  value: PropTypes.string,
27
24
  onChange: PropTypes.func.isRequired,
28
25
  direction: PropTypes.oneOf(['horizontal', 'vertical']),
29
- classes: PropTypes.object.isRequired,
30
26
  };
31
27
 
32
28
  handleChange = (event) => {
@@ -34,7 +30,7 @@ class RawNChoice extends React.Component {
34
30
  };
35
31
 
36
32
  render() {
37
- const { header, className, classes, customLabel, opts, value, direction } = this.props;
33
+ const { header, className, customLabel, opts, value, direction } = this.props;
38
34
 
39
35
  const preppedOpts = opts.map((o) => {
40
36
  return typeof o === 'string' ? { label: o, value: o } : o;
@@ -43,7 +39,7 @@ class RawNChoice extends React.Component {
43
39
 
44
40
  return (
45
41
  <InputContainer label={header} className={className}>
46
- <div className={classNames(classes.group, classes[direction])}>
42
+ <StyledGroup direction={direction}>
47
43
  {preppedOpts.map((o, index) => (
48
44
  <LabelComponent
49
45
  value={o.value}
@@ -53,13 +49,13 @@ class RawNChoice extends React.Component {
53
49
  label={o.label}
54
50
  />
55
51
  ))}
56
- </div>
52
+ </StyledGroup>
57
53
  </InputContainer>
58
54
  );
59
55
  }
60
56
  }
61
57
 
62
- export const NChoice = withStyles(styles)(RawNChoice);
58
+ export { NChoice };
63
59
 
64
60
  const labelValue = PropTypes.shape({ label: PropTypes.string, value: PropTypes.string });
65
61
 
@@ -91,4 +87,4 @@ class TwoChoice extends React.Component {
91
87
  }
92
88
  }
93
89
 
94
- export default withStyles(styles)(TwoChoice);
90
+ export default TwoChoice;