kitchen-simulator 5.0.0-test.16 → 5.0.0-test.17
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/package.json +3 -11
- package/src/_KitchenConfigurator.jsx +0 -43
- package/src/components/atoms/Snackbar/index.jsx +0 -43
- package/src/components/atoms/radio-button/index.jsx +0 -20
- package/src/components/atoms/radio-button/styles.js +0 -56
- package/src/components/button/MainButton.jsx +0 -157
- package/src/components/button/ToggleMeasureButton.jsx +0 -65
- package/src/components/content.jsx +0 -136
- package/src/components/molecules/slider/index.jsx +0 -15
- package/src/components/molecules/slider/styles.js +0 -0
- package/src/components/molecules/slider/styles.scss +0 -3
- package/src/components/style/button.jsx +0 -95
- package/src/components/style/cancel-button.jsx +0 -20
- package/src/components/style/content-container.jsx +0 -29
- package/src/components/style/content-title.jsx +0 -20
- package/src/components/style/delete-button.jsx +0 -23
- package/src/components/style/export.jsx +0 -48
- package/src/components/style/form-block.jsx +0 -13
- package/src/components/style/form-color-input.jsx +0 -27
- package/src/components/style/form-label.jsx +0 -15
- package/src/components/style/form-number-input.jsx +0 -196
- package/src/components/style/form-number-input_2.jsx +0 -191
- package/src/components/style/form-select.jsx +0 -38
- package/src/components/style/form-slider.jsx +0 -36
- package/src/components/style/form-submit-button.jsx +0 -23
- package/src/components/style/form-text-input.jsx +0 -65
- package/src/components/tutorial-view/Modal.jsx +0 -584
- package/src/components/tutorial-view/style.css +0 -111
- package/src/components/tutorial-view/styles.js +0 -65
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Button from './button';
|
|
3
|
-
|
|
4
|
-
const STYLE = {
|
|
5
|
-
borderColor: '#adadad',
|
|
6
|
-
backgroundColor: '#e6e6e6'
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const STYLE_HOVER = {
|
|
10
|
-
backgroundColor: '#d4d4d4',
|
|
11
|
-
borderColor: '#8c8c8c'
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export default function CancelButton({ children, ...rest }) {
|
|
15
|
-
return (
|
|
16
|
-
<Button style={STYLE} styleHover={STYLE_HOVER} {...rest}>
|
|
17
|
-
{children}
|
|
18
|
-
</Button>
|
|
19
|
-
);
|
|
20
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
const STYLE = {
|
|
5
|
-
padding: '0 20px',
|
|
6
|
-
overflowY: 'auto'
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export default function ContentContainer({
|
|
10
|
-
children,
|
|
11
|
-
width,
|
|
12
|
-
height,
|
|
13
|
-
style = {}
|
|
14
|
-
}) {
|
|
15
|
-
return (
|
|
16
|
-
<div
|
|
17
|
-
style={{ width, height, ...STYLE, ...style }}
|
|
18
|
-
onWheel={event => event.stopPropagation()}
|
|
19
|
-
>
|
|
20
|
-
{children}
|
|
21
|
-
</div>
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
ContentContainer.propsType = {
|
|
26
|
-
width: PropTypes.number.isRequired,
|
|
27
|
-
height: PropTypes.number.isRequired,
|
|
28
|
-
style: PropTypes.object
|
|
29
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import * as SharedStyle from '../../shared-style';
|
|
4
|
-
|
|
5
|
-
const STYLE = {
|
|
6
|
-
color: SharedStyle.PRIMARY_COLOR.alt,
|
|
7
|
-
fontWeight: 300
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export default function ContentTitle({ children, style = {}, ...rest }) {
|
|
11
|
-
return (
|
|
12
|
-
<h1 style={{ ...STYLE, ...style }} {...rest}>
|
|
13
|
-
{children}
|
|
14
|
-
</h1>
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
ContentTitle.propsType = {
|
|
19
|
-
style: PropTypes.object
|
|
20
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Button from './button';
|
|
3
|
-
import * as SharedStyle from '../../shared-style';
|
|
4
|
-
|
|
5
|
-
const STYLE = {
|
|
6
|
-
borderColor: '#c12e2a',
|
|
7
|
-
backgroundColor: '#c9302c',
|
|
8
|
-
color: SharedStyle.COLORS.white
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const STYLE_HOVER = {
|
|
12
|
-
backgroundColor: '#972726',
|
|
13
|
-
borderColor: '#c12e2a',
|
|
14
|
-
color: SharedStyle.COLORS.white
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export default function FormDeleteButton({ children, ...rest }) {
|
|
18
|
-
return (
|
|
19
|
-
<Button style={STYLE} styleHover={STYLE_HOVER} {...rest}>
|
|
20
|
-
{children}
|
|
21
|
-
</Button>
|
|
22
|
-
);
|
|
23
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import Button from './button';
|
|
2
|
-
import CancelButton from './cancel-button';
|
|
3
|
-
import ContentContainer from './content-container';
|
|
4
|
-
import ContentTitle from './content-title';
|
|
5
|
-
import DeleteButton from './delete-button';
|
|
6
|
-
import FormBlock from './form-block';
|
|
7
|
-
import FormColorInput from './form-color-input';
|
|
8
|
-
import FormLabel from './form-label';
|
|
9
|
-
import FormNumberInput from './form-number-input';
|
|
10
|
-
import FormSelect from './form-select';
|
|
11
|
-
import FormSlider from './form-slider';
|
|
12
|
-
import FormSubmitButton from './form-submit-button';
|
|
13
|
-
import FormTextInput from './form-text-input';
|
|
14
|
-
import FormNumberInput2 from './form-number-input_2';
|
|
15
|
-
|
|
16
|
-
export {
|
|
17
|
-
Button,
|
|
18
|
-
CancelButton,
|
|
19
|
-
ContentContainer,
|
|
20
|
-
ContentTitle,
|
|
21
|
-
DeleteButton,
|
|
22
|
-
FormBlock,
|
|
23
|
-
FormColorInput,
|
|
24
|
-
FormLabel,
|
|
25
|
-
FormNumberInput,
|
|
26
|
-
FormSelect,
|
|
27
|
-
FormSlider,
|
|
28
|
-
FormSubmitButton,
|
|
29
|
-
FormTextInput,
|
|
30
|
-
FormNumberInput2
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export default {
|
|
34
|
-
Button,
|
|
35
|
-
CancelButton,
|
|
36
|
-
ContentContainer,
|
|
37
|
-
ContentTitle,
|
|
38
|
-
DeleteButton,
|
|
39
|
-
FormBlock,
|
|
40
|
-
FormColorInput,
|
|
41
|
-
FormLabel,
|
|
42
|
-
FormNumberInput,
|
|
43
|
-
FormSelect,
|
|
44
|
-
FormSlider,
|
|
45
|
-
FormSubmitButton,
|
|
46
|
-
FormTextInput,
|
|
47
|
-
FormNumberInput2
|
|
48
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import FormTextInput from './form-text-input';
|
|
3
|
-
|
|
4
|
-
const STYLE = {
|
|
5
|
-
padding: 0,
|
|
6
|
-
border: 0
|
|
7
|
-
};
|
|
8
|
-
const EREG_NUMBER = /^.*$/;
|
|
9
|
-
|
|
10
|
-
export default function FormColorInput({ onChange, ...rest }) {
|
|
11
|
-
let onChangeCustom = event => {
|
|
12
|
-
let value = event.target.value;
|
|
13
|
-
if (EREG_NUMBER.test(value)) {
|
|
14
|
-
onChange(event);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<FormTextInput
|
|
20
|
-
type="color"
|
|
21
|
-
style={STYLE}
|
|
22
|
-
onChange={onChangeCustom}
|
|
23
|
-
autoComplete="off"
|
|
24
|
-
{...rest}
|
|
25
|
-
/>
|
|
26
|
-
);
|
|
27
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
const BASE_STYLE = {
|
|
4
|
-
display: 'block',
|
|
5
|
-
marginBottom: '2px',
|
|
6
|
-
fontSize: '12px'
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export default function FormLabel({ children, style, ...rest }) {
|
|
10
|
-
return (
|
|
11
|
-
<label style={{ ...BASE_STYLE, style }} {...rest}>
|
|
12
|
-
{children}
|
|
13
|
-
</label>
|
|
14
|
-
);
|
|
15
|
-
}
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import {
|
|
4
|
-
KEYBOARD_BUTTON_CODE,
|
|
5
|
-
TEXT_COLOR_NEUTRAL_0,
|
|
6
|
-
SECONDARY_PURPLE_COLOR,
|
|
7
|
-
DEFAULT_FONT_FAMILY
|
|
8
|
-
} from '../../constants';
|
|
9
|
-
import styled from 'styled-components';
|
|
10
|
-
import { isValidNumber } from '../../utils/helper';
|
|
11
|
-
|
|
12
|
-
const StyledInput = styled.input`
|
|
13
|
-
display: block;
|
|
14
|
-
padding: 15px 25px 12px 0px;
|
|
15
|
-
width: 120px;
|
|
16
|
-
color: ${TEXT_COLOR_NEUTRAL_0};
|
|
17
|
-
background-color: rgb(255, 255, 255);
|
|
18
|
-
border: 2px solid;
|
|
19
|
-
text-align: right;
|
|
20
|
-
float: right;
|
|
21
|
-
font-family: ${DEFAULT_FONT_FAMILY};
|
|
22
|
-
font-size: 16px;
|
|
23
|
-
font-weight: 600;
|
|
24
|
-
line-height: 17px;
|
|
25
|
-
border-radius: 5px;
|
|
26
|
-
outline: 0;
|
|
27
|
-
:focus {
|
|
28
|
-
border-color: ${SECONDARY_PURPLE_COLOR};
|
|
29
|
-
}
|
|
30
|
-
`;
|
|
31
|
-
|
|
32
|
-
export default class FormNumberInput extends Component {
|
|
33
|
-
constructor(props, context) {
|
|
34
|
-
super(props, context);
|
|
35
|
-
this.state = {
|
|
36
|
-
focus: false,
|
|
37
|
-
valid: true,
|
|
38
|
-
showedValue: props.value,
|
|
39
|
-
focusOn: false,
|
|
40
|
-
flag: true
|
|
41
|
-
};
|
|
42
|
-
this.input = React.createRef(null);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
componentDidMount() {
|
|
46
|
-
if (
|
|
47
|
-
this.input.current &&
|
|
48
|
-
['width', 'length'].includes(this.props.labelName.toLowerCase())
|
|
49
|
-
) {
|
|
50
|
-
this.input.current.focus();
|
|
51
|
-
this.input.current.select();
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
componentWillReceiveProps(nextProps) {
|
|
56
|
-
if (
|
|
57
|
-
this.props.value !== nextProps.value ||
|
|
58
|
-
this.props.focus !== nextProps.focus
|
|
59
|
-
) {
|
|
60
|
-
this.setState({ showedValue: nextProps.value, focusOn: nextProps.focus });
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
componentDidUpdate(prevProps, preprevState) {
|
|
65
|
-
if (
|
|
66
|
-
this.props.value !== prevProps.value &&
|
|
67
|
-
prevProps.labelName !== 'Ceiling Height'
|
|
68
|
-
) {
|
|
69
|
-
this.input.current.focus();
|
|
70
|
-
this.input.current.select();
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const { showedValue } = this.state;
|
|
74
|
-
const { min, max, isCeiling } = this.props;
|
|
75
|
-
|
|
76
|
-
if (!isCeiling) {
|
|
77
|
-
if (isValidNumber(min) && showedValue < min) {
|
|
78
|
-
this.setState({ showedValue: min });
|
|
79
|
-
} else if (isValidNumber(max) && showedValue > max) {
|
|
80
|
-
this.setState({ showedValue: max });
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return null;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
render() {
|
|
87
|
-
let {
|
|
88
|
-
value,
|
|
89
|
-
min,
|
|
90
|
-
max,
|
|
91
|
-
precision,
|
|
92
|
-
onChange,
|
|
93
|
-
onValid,
|
|
94
|
-
onInvalid,
|
|
95
|
-
style,
|
|
96
|
-
placeholder,
|
|
97
|
-
isCeiling
|
|
98
|
-
} = this.props;
|
|
99
|
-
let regexp = new RegExp(`^-?([0-9]+)?\\.?([0-9]{0,${precision}})?$`);
|
|
100
|
-
|
|
101
|
-
let currValue = regexp.test(this.state.showedValue)
|
|
102
|
-
? this.state.showedValue
|
|
103
|
-
: parseFloat(this.state.showedValue).toFixed(precision);
|
|
104
|
-
|
|
105
|
-
let different =
|
|
106
|
-
parseFloat(this.props.value).toFixed(precision) !==
|
|
107
|
-
parseFloat(this.state.showedValue).toFixed(precision);
|
|
108
|
-
|
|
109
|
-
let saveFn = e => {
|
|
110
|
-
e.stopPropagation();
|
|
111
|
-
|
|
112
|
-
if (this.state.valid) {
|
|
113
|
-
let savedValue =
|
|
114
|
-
this.state.showedValue !== '' && this.state.showedValue !== '-'
|
|
115
|
-
? parseFloat(this.state.showedValue)
|
|
116
|
-
: 0;
|
|
117
|
-
|
|
118
|
-
this.setState({ showedValue: savedValue });
|
|
119
|
-
onChange({ target: { value: savedValue } });
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
return (
|
|
124
|
-
<StyledInput
|
|
125
|
-
id="form_number_input"
|
|
126
|
-
autoFocus={this.state.focusOn}
|
|
127
|
-
readOnly={!!this.props.disabled}
|
|
128
|
-
type="text"
|
|
129
|
-
value={currValue}
|
|
130
|
-
style={style}
|
|
131
|
-
onChange={evt => {
|
|
132
|
-
this.context.projectActions.copyProperties('ddddd');
|
|
133
|
-
let valid = regexp.test(evt.nativeEvent.target.value);
|
|
134
|
-
|
|
135
|
-
if (valid) {
|
|
136
|
-
this.setState({
|
|
137
|
-
showedValue: evt.nativeEvent.target.value,
|
|
138
|
-
flag: false
|
|
139
|
-
});
|
|
140
|
-
if (onValid) onValid(evt.nativeEvent);
|
|
141
|
-
} else {
|
|
142
|
-
if (onInvalid) onInvalid(evt.nativeEvent);
|
|
143
|
-
}
|
|
144
|
-
this.setState({ valid });
|
|
145
|
-
}}
|
|
146
|
-
onFocus={e => this.setState({ focusOn: true })}
|
|
147
|
-
onBlur={e => this.setState({ focusOn: false })}
|
|
148
|
-
ref={this.input}
|
|
149
|
-
onKeyDown={e => {
|
|
150
|
-
var keyCode = e.keyCode || e.which;
|
|
151
|
-
if (
|
|
152
|
-
keyCode == KEYBOARD_BUTTON_CODE.ENTER ||
|
|
153
|
-
keyCode == KEYBOARD_BUTTON_CODE.TAB
|
|
154
|
-
) {
|
|
155
|
-
saveFn(e);
|
|
156
|
-
this.input.current.blur();
|
|
157
|
-
}
|
|
158
|
-
if (keyCode == KEYBOARD_BUTTON_CODE.ESC) {
|
|
159
|
-
this.context.projectActions.rollback();
|
|
160
|
-
}
|
|
161
|
-
}}
|
|
162
|
-
placeholder={placeholder}
|
|
163
|
-
/>
|
|
164
|
-
);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
FormNumberInput.propTypes = {
|
|
169
|
-
value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
170
|
-
style: PropTypes.object,
|
|
171
|
-
onChange: PropTypes.func.isRequired,
|
|
172
|
-
onValid: PropTypes.func,
|
|
173
|
-
onInvalid: PropTypes.func,
|
|
174
|
-
min: PropTypes.number,
|
|
175
|
-
max: PropTypes.number,
|
|
176
|
-
precision: PropTypes.number,
|
|
177
|
-
placeholder: PropTypes.string,
|
|
178
|
-
labelName: PropTypes.string,
|
|
179
|
-
isCeiling: PropTypes.string
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
FormNumberInput.contextTypes = {
|
|
183
|
-
translator: PropTypes.object.isRequired,
|
|
184
|
-
projectActions: PropTypes.object.isRequired,
|
|
185
|
-
linesActions: PropTypes.object.isRequired
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
FormNumberInput.defaultProps = {
|
|
189
|
-
value: 0,
|
|
190
|
-
style: {},
|
|
191
|
-
min: Number.MIN_SAFE_INTEGER,
|
|
192
|
-
max: Number.MAX_SAFE_INTEGER,
|
|
193
|
-
precision: 2,
|
|
194
|
-
disabled: false,
|
|
195
|
-
labelName: 'default'
|
|
196
|
-
};
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import * as SharedStyle from '../../shared-style';
|
|
4
|
-
import { MdUpdate } from 'react-icons/md';
|
|
5
|
-
import { KEYBOARD_BUTTON_CODE } from '../../constants';
|
|
6
|
-
|
|
7
|
-
const STYLE_INPUT = {
|
|
8
|
-
display: 'block',
|
|
9
|
-
width: '100%',
|
|
10
|
-
padding: '0 2px',
|
|
11
|
-
fontSize: '13px',
|
|
12
|
-
lineHeight: '1.25',
|
|
13
|
-
color: SharedStyle.PRIMARY_COLOR.input,
|
|
14
|
-
backgroundColor: SharedStyle.COLORS.white,
|
|
15
|
-
backgroundImage: 'none',
|
|
16
|
-
border: '1px solid rgba(0,0,0,.15)',
|
|
17
|
-
outline: 'none',
|
|
18
|
-
height: '30px'
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const confirmStyle = {
|
|
22
|
-
position: 'absolute',
|
|
23
|
-
cursor: 'pointer',
|
|
24
|
-
width: '20px',
|
|
25
|
-
height: '20px',
|
|
26
|
-
right: '5px',
|
|
27
|
-
top: '5px',
|
|
28
|
-
backgroundColor: SharedStyle.SECONDARY_COLOR.main,
|
|
29
|
-
color: '#FFF',
|
|
30
|
-
transition: 'all 0.1s linear'
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export default class FormNumberInput extends Component {
|
|
34
|
-
constructor(props, context) {
|
|
35
|
-
super(props, context);
|
|
36
|
-
this.state = {
|
|
37
|
-
focus: false,
|
|
38
|
-
valid: true,
|
|
39
|
-
showedValue: props.value,
|
|
40
|
-
disabled: props.disabled === true ? true : false,
|
|
41
|
-
focusOn: false
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
componentWillReceiveProps(nextProps) {
|
|
46
|
-
if (
|
|
47
|
-
this.props.value !== nextProps.value ||
|
|
48
|
-
this.props.focus !== nextProps.focus
|
|
49
|
-
) {
|
|
50
|
-
this.setState({ showedValue: nextProps.value, focusOn: nextProps.focus });
|
|
51
|
-
}
|
|
52
|
-
if (this.props.focus !== nextProps.focus) {
|
|
53
|
-
this.Input.focus();
|
|
54
|
-
this.Input.select();
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
render() {
|
|
59
|
-
let {
|
|
60
|
-
value,
|
|
61
|
-
min,
|
|
62
|
-
max,
|
|
63
|
-
precision,
|
|
64
|
-
onChange,
|
|
65
|
-
onValid,
|
|
66
|
-
onInvalid,
|
|
67
|
-
style,
|
|
68
|
-
placeholder
|
|
69
|
-
} = this.props;
|
|
70
|
-
let numericInputStyle = { ...STYLE_INPUT, ...style };
|
|
71
|
-
if (this.state.focusOn)
|
|
72
|
-
numericInputStyle.border = `1px solid ${SharedStyle.SECONDARY_COLOR.main}`;
|
|
73
|
-
let regexp = new RegExp(`^-?([0-9]+)?\\.?([0-9]{0,${precision}})?$`);
|
|
74
|
-
|
|
75
|
-
if (!isNaN(min) && isFinite(min) && this.state.showedValue < min)
|
|
76
|
-
this.setState({ showedValue: min }); // value = min;
|
|
77
|
-
if (!isNaN(max) && isFinite(max) && this.state.showedValue > max)
|
|
78
|
-
this.setState({ showedValue: max }); // value = max;
|
|
79
|
-
|
|
80
|
-
let currValue = regexp.test(this.state.showedValue)
|
|
81
|
-
? this.state.showedValue
|
|
82
|
-
: parseFloat(this.state.showedValue).toFixed(precision);
|
|
83
|
-
|
|
84
|
-
let different =
|
|
85
|
-
parseFloat(this.props.value).toFixed(precision) !==
|
|
86
|
-
parseFloat(this.state.showedValue).toFixed(precision);
|
|
87
|
-
|
|
88
|
-
let saveFn = e => {
|
|
89
|
-
e.stopPropagation();
|
|
90
|
-
|
|
91
|
-
if (this.state.valid) {
|
|
92
|
-
let savedValue =
|
|
93
|
-
this.state.showedValue !== '' && this.state.showedValue !== '-'
|
|
94
|
-
? parseFloat(this.state.showedValue)
|
|
95
|
-
: 0;
|
|
96
|
-
|
|
97
|
-
this.setState({ showedValue: savedValue });
|
|
98
|
-
onChange({ target: { value: savedValue } });
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
return (
|
|
103
|
-
<div style={{ position: 'relative' }}>
|
|
104
|
-
<input
|
|
105
|
-
autoFocus={this.state.focusOn}
|
|
106
|
-
readOnly={this.state.disabled}
|
|
107
|
-
type="text"
|
|
108
|
-
value={currValue}
|
|
109
|
-
style={numericInputStyle}
|
|
110
|
-
onChange={evt => {
|
|
111
|
-
let valid = regexp.test(evt.nativeEvent.target.value);
|
|
112
|
-
|
|
113
|
-
if (valid) {
|
|
114
|
-
this.setState({ showedValue: evt.nativeEvent.target.value });
|
|
115
|
-
if (onValid) onValid(evt.nativeEvent);
|
|
116
|
-
} else {
|
|
117
|
-
if (onInvalid) onInvalid(evt.nativeEvent);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
this.setState({ valid });
|
|
121
|
-
}}
|
|
122
|
-
onFocus={e => this.setState({ focusOn: true })}
|
|
123
|
-
onBlur={e => this.setState({ focusOn: false })}
|
|
124
|
-
ref={ele => {
|
|
125
|
-
this.Input = ele;
|
|
126
|
-
}}
|
|
127
|
-
onKeyDown={e => {
|
|
128
|
-
var keyCode = e.keyCode || e.which;
|
|
129
|
-
if (
|
|
130
|
-
keyCode == KEYBOARD_BUTTON_CODE.ENTER ||
|
|
131
|
-
keyCode == KEYBOARD_BUTTON_CODE.TAB
|
|
132
|
-
) {
|
|
133
|
-
saveFn(e);
|
|
134
|
-
this.Input.blur();
|
|
135
|
-
}
|
|
136
|
-
if (keyCode == KEYBOARD_BUTTON_CODE.ESC) {
|
|
137
|
-
this.context.projectActions.rollback();
|
|
138
|
-
}
|
|
139
|
-
}}
|
|
140
|
-
placeholder={placeholder}
|
|
141
|
-
/>
|
|
142
|
-
<div
|
|
143
|
-
onClick={e => {
|
|
144
|
-
if (different) saveFn(e);
|
|
145
|
-
}}
|
|
146
|
-
title={this.context.translator.t('Confirm')}
|
|
147
|
-
style={{
|
|
148
|
-
...confirmStyle,
|
|
149
|
-
visibility: different ? 'visible' : 'hidden',
|
|
150
|
-
opacity: different ? '1' : '0'
|
|
151
|
-
}}
|
|
152
|
-
>
|
|
153
|
-
<MdUpdate
|
|
154
|
-
style={{
|
|
155
|
-
width: '100%',
|
|
156
|
-
height: '100%',
|
|
157
|
-
padding: '0.2em',
|
|
158
|
-
color: '#FFF'
|
|
159
|
-
}}
|
|
160
|
-
/>
|
|
161
|
-
</div>
|
|
162
|
-
</div>
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
FormNumberInput.propTypes = {
|
|
168
|
-
value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
169
|
-
style: PropTypes.object,
|
|
170
|
-
onChange: PropTypes.func.isRequired,
|
|
171
|
-
onValid: PropTypes.func,
|
|
172
|
-
onInvalid: PropTypes.func,
|
|
173
|
-
min: PropTypes.number,
|
|
174
|
-
max: PropTypes.number,
|
|
175
|
-
precision: PropTypes.number,
|
|
176
|
-
placeholder: PropTypes.string
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
FormNumberInput.contextTypes = {
|
|
180
|
-
translator: PropTypes.object.isRequired,
|
|
181
|
-
projectActions: PropTypes.object.isRequired
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
FormNumberInput.defaultProps = {
|
|
185
|
-
value: 0,
|
|
186
|
-
style: {},
|
|
187
|
-
min: Number.MIN_SAFE_INTEGER,
|
|
188
|
-
max: Number.MAX_SAFE_INTEGER,
|
|
189
|
-
precision: 2,
|
|
190
|
-
disabled: false
|
|
191
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import * as SharedStyle from '../../shared-style';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import {
|
|
5
|
-
TEXT_COLOR_NEUTRAL_3,
|
|
6
|
-
DEFAULT_FONT_FAMILY,
|
|
7
|
-
SECONDARY_PURPLE_COLOR
|
|
8
|
-
} from '../../constants';
|
|
9
|
-
|
|
10
|
-
const StyledSelect = styled.select`
|
|
11
|
-
display: block;
|
|
12
|
-
width: 120px;
|
|
13
|
-
float: right;
|
|
14
|
-
padding: 15px 10px 12px 0px;
|
|
15
|
-
color: ${TEXT_COLOR_NEUTRAL_3};
|
|
16
|
-
border: 2px solid;
|
|
17
|
-
font-family: ${DEFAULT_FONT_FAMILY};
|
|
18
|
-
font-size: 12px;
|
|
19
|
-
font-weight: 600;
|
|
20
|
-
line-height: 17px;
|
|
21
|
-
text-align: right;
|
|
22
|
-
outline: none;
|
|
23
|
-
border-radius: 5px;
|
|
24
|
-
:hover {
|
|
25
|
-
border-color: ${SECONDARY_PURPLE_COLOR};
|
|
26
|
-
}
|
|
27
|
-
:focus {
|
|
28
|
-
border-color: ${SECONDARY_PURPLE_COLOR};
|
|
29
|
-
}
|
|
30
|
-
`;
|
|
31
|
-
|
|
32
|
-
export default function FormSelect({ children, style, ...rest }) {
|
|
33
|
-
return (
|
|
34
|
-
<StyledSelect type="text" style={style} {...rest}>
|
|
35
|
-
{children}
|
|
36
|
-
</StyledSelect>
|
|
37
|
-
);
|
|
38
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import ReactRange from '@mapbox/react-range';
|
|
3
|
-
import FormTextInput from './form-text-input';
|
|
4
|
-
|
|
5
|
-
const sliderContainerStyle = {
|
|
6
|
-
display: 'inline-block',
|
|
7
|
-
width: '80%',
|
|
8
|
-
marginRight: '5%'
|
|
9
|
-
};
|
|
10
|
-
const sliderStyle = { display: 'block', width: '100%', height: '30px' };
|
|
11
|
-
const textContainerStyle = {
|
|
12
|
-
display: 'inline-block',
|
|
13
|
-
width: '15%',
|
|
14
|
-
float: 'right'
|
|
15
|
-
};
|
|
16
|
-
const textStyle = { height: '34px', textAlign: 'center' };
|
|
17
|
-
|
|
18
|
-
export default function FormNumberInput({ value, onChange, ...rest }) {
|
|
19
|
-
return (
|
|
20
|
-
<div>
|
|
21
|
-
<div style={sliderContainerStyle}>
|
|
22
|
-
<ReactRange
|
|
23
|
-
type="range"
|
|
24
|
-
style={sliderStyle}
|
|
25
|
-
onChange={onChange}
|
|
26
|
-
value={value}
|
|
27
|
-
{...rest}
|
|
28
|
-
/>
|
|
29
|
-
</div>
|
|
30
|
-
|
|
31
|
-
<div style={textContainerStyle}>
|
|
32
|
-
<FormTextInput value={value} onChange={onChange} style={textStyle} />
|
|
33
|
-
</div>
|
|
34
|
-
</div>
|
|
35
|
-
);
|
|
36
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Button from './button';
|
|
3
|
-
import * as SharedStyle from '../../shared-style';
|
|
4
|
-
|
|
5
|
-
const STYLE = {
|
|
6
|
-
borderColor: '#415375',
|
|
7
|
-
backgroundColor: '#415375',
|
|
8
|
-
color: SharedStyle.COLORS.white
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const STYLE_HOVER = {
|
|
12
|
-
borderColor: '#1f3149',
|
|
13
|
-
backgroundColor: '#1f3149',
|
|
14
|
-
color: SharedStyle.COLORS.white
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export default function FormSubmitButton({ children, ...rest }) {
|
|
18
|
-
return (
|
|
19
|
-
<Button type="submit" style={STYLE} styleHover={STYLE_HOVER} {...rest}>
|
|
20
|
-
{children}
|
|
21
|
-
</Button>
|
|
22
|
-
);
|
|
23
|
-
}
|