@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.
- package/CHANGELOG.md +36 -0
- package/lib/alert-dialog.js +23 -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 +24 -63
- package/lib/choice-configuration/feedback-menu.js.map +1 -1
- package/lib/choice-configuration/index.js +201 -257
- 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 +30 -65
- 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 +72 -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 +142 -228
- 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 -17
- package/src/__tests__/number-text-field.test.jsx +1 -1
- package/src/alert-dialog.jsx +14 -18
- package/src/checkbox.jsx +42 -46
- package/src/choice-configuration/feedback-menu.jsx +5 -5
- package/src/choice-configuration/index.jsx +205 -193
- 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 +27 -23
- package/src/layout/layout-contents.jsx +34 -34
- 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 +83 -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
- package/esm/index.js +0 -78747
- package/esm/index.js.map +0 -1
- package/esm/package.json +0 -1
package/src/settings/panel.jsx
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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 get from 'lodash/get';
|
|
5
5
|
import set from 'lodash/set';
|
|
6
|
-
import Select from '@material
|
|
7
|
-
import Input from '@material
|
|
8
|
-
import MenuItem from '@material
|
|
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
|
|
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
|
|
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
|
-
<
|
|
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 =
|
|
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
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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 && <
|
|
101
|
-
<
|
|
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
|
-
</
|
|
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
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
return <
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
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
|
|
133
|
+
padding: `0 ${theme.spacing(1)}px`,
|
|
140
134
|
},
|
|
141
|
-
}))
|
|
135
|
+
}));
|
|
136
|
+
|
|
137
|
+
const NumberField = ({ label, value, onChange = () => {}, suffix, min, max }) => {
|
|
142
138
|
return (
|
|
143
|
-
<
|
|
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
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}))
|
|
202
|
-
|
|
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
|
-
<
|
|
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
|
-
<
|
|
255
|
-
<
|
|
248
|
+
<StyledGroup>
|
|
249
|
+
<StyledGroupHeader>{label}</StyledGroupHeader>
|
|
256
250
|
|
|
257
251
|
{Object.keys(group).map((key) => {
|
|
258
252
|
return content(group, key);
|
|
259
253
|
})}
|
|
260
|
-
</
|
|
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
|
|
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)(({ 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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
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;
|
package/src/settings/toggle.jsx
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import InputLabel from '@material
|
|
4
|
-
import {
|
|
5
|
-
import Switch from '@material
|
|
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
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
24
|
+
'&.Mui-checked .MuiSwitch-track': {
|
|
24
25
|
backgroundColor: `${color.tertiaryLight()} !important`,
|
|
25
26
|
},
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
</
|
|
41
|
-
)
|
|
40
|
+
</StyledToggle>
|
|
41
|
+
);
|
|
42
42
|
|
|
43
43
|
Toggle.propTypes = {
|
|
44
44
|
checked: PropTypes.bool,
|
package/src/tabs/index.jsx
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import MuiTabs from '@material
|
|
4
|
-
import MuiTab from '@material
|
|
3
|
+
import MuiTabs from '@mui/material/Tabs';
|
|
4
|
+
import MuiTab from '@mui/material/Tab';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import {
|
|
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 = {}
|
|
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 ? <
|
|
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
|
|
47
|
+
export default Tabs;
|
package/src/tags-input/index.jsx
CHANGED
|
@@ -1,27 +1,48 @@
|
|
|
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 uniq from 'lodash/uniq';
|
|
5
|
-
import Chip from '@material
|
|
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
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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 {
|
|
94
|
+
const { tags } = this.props;
|
|
74
95
|
return (
|
|
75
96
|
<MuiBox focused={this.state.focused}>
|
|
76
|
-
<
|
|
97
|
+
<StyledTagsInput>
|
|
77
98
|
{(tags || []).map((t, index) => (
|
|
78
99
|
<Tag key={index} label={t} onDelete={() => this.deleteTag(t)} />
|
|
79
100
|
))}
|
|
80
|
-
<
|
|
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
|
-
</
|
|
110
|
+
</StyledTagsInput>
|
|
91
111
|
</MuiBox>
|
|
92
112
|
);
|
|
93
113
|
}
|
|
94
114
|
}
|
|
95
115
|
|
|
96
|
-
|
|
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;
|
package/src/two-choice.jsx
CHANGED
|
@@ -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
|
|
6
|
-
import { withStyles } from '@material-ui/core/styles';
|
|
5
|
+
import { styled } from '@mui/material/styles';
|
|
7
6
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
|
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,
|
|
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
|
-
<
|
|
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
|
-
</
|
|
52
|
+
</StyledGroup>
|
|
57
53
|
</InputContainer>
|
|
58
54
|
);
|
|
59
55
|
}
|
|
60
56
|
}
|
|
61
57
|
|
|
62
|
-
export
|
|
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
|
|
90
|
+
export default TwoChoice;
|