@bytebrand/fe-ui-core 4.2.73 → 4.2.74
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/common.ts +1 -0
- package/package.json +1 -1
- package/source/components/OfferDetailedSection/partials/PanelConfig.styl +4 -0
- package/source/components/OfferPanel/OfferCheckboxGroup/OfferCheckboxGroup.styl +1 -4
- package/source/components/OfferPanel/OfferPanel.styl +4 -2
- package/source/components/_common/DropDown/FormDropDown.tsx +1 -2
- package/source/components/_common/Radio/FormRadioGroup.tsx +9 -34
- package/source/components/_common/TextField/FormTextField.story.js +21 -0
- package/source/components/_common/TextField/FormTextField.styl +35 -0
- package/source/components/_common/TextField/FormTextField.tsx +54 -0
package/common.ts
CHANGED
|
@@ -30,6 +30,7 @@ export { default as VehicleSliderForSRL } from './source/components/_common/Vehi
|
|
|
30
30
|
export { default as VehicleSmallCard } from './source/components/VehicleSmallCard/VehicleSmallCard';
|
|
31
31
|
export { default as OfferPanel } from './source/components/OfferPanel/OfferPanel';
|
|
32
32
|
|
|
33
|
+
export { default as FormTextField } from './source/components/_common/TextField/FormTextField';
|
|
33
34
|
export { default as Tooltip } from './source/components/_common/Tooltip/Tooltip';
|
|
34
35
|
export { default as TextField } from './source/components/_common/TextField/TextField';
|
|
35
36
|
export { default as FormattedNumber } from './source/components/FormattedNumber/FormattedNumber';
|
package/package.json
CHANGED
|
@@ -73,9 +73,6 @@
|
|
|
73
73
|
.labelContent
|
|
74
74
|
flex: 1 1 auto
|
|
75
75
|
color: $grey-3;
|
|
76
|
-
@media (min-width: 990px) and (max-width: 1112px)
|
|
77
|
-
max-width: 230px
|
|
78
|
-
padding-right: 10px !important;
|
|
79
76
|
|
|
80
77
|
.icon
|
|
81
78
|
display: block
|
|
@@ -120,4 +117,4 @@
|
|
|
120
117
|
font-size: 12px;
|
|
121
118
|
|
|
122
119
|
.hidePlus
|
|
123
|
-
display: inline-block
|
|
120
|
+
display: inline-block
|
|
@@ -167,14 +167,13 @@
|
|
|
167
167
|
[class*='MuiFormControlLabel-root']
|
|
168
168
|
height: 20px
|
|
169
169
|
min-height: 0
|
|
170
|
+
margin-left:0
|
|
170
171
|
.labelText
|
|
171
172
|
font-size: 12px;
|
|
172
173
|
font-weight: normal;
|
|
173
174
|
|
|
174
175
|
[class*='labelContent']
|
|
175
176
|
font-size: 12px
|
|
176
|
-
+media-phone-up()
|
|
177
|
-
padding-right: 62px;
|
|
178
177
|
|
|
179
178
|
|
|
180
179
|
.checkBoxGroup
|
|
@@ -190,3 +189,6 @@
|
|
|
190
189
|
margin: 0
|
|
191
190
|
justify-content: space-between
|
|
192
191
|
width: 100%
|
|
192
|
+
|
|
193
|
+
[class*='MuiIconButton-root']
|
|
194
|
+
padding:5px!important
|
|
@@ -4,8 +4,7 @@ import classnames from 'classnames';
|
|
|
4
4
|
import styles from './FormDropDown.styl';
|
|
5
5
|
|
|
6
6
|
import DropDown from './DropDown';
|
|
7
|
-
|
|
8
|
-
type ErrorPositionType = 'TopRight' | 'TopLeft' | 'BottomRight' | 'BottomLeft';
|
|
7
|
+
import { ErrorPositionType } from '../TextField/FormTextField';
|
|
9
8
|
|
|
10
9
|
interface IFormDropDownProps {
|
|
11
10
|
// mobx form field instance
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
|
+
import { observer } from 'mobx-react';
|
|
3
4
|
|
|
4
5
|
import RadioGroup from './RadioGroup';
|
|
5
6
|
import styles from './FormRadioGroup.styl';
|
|
@@ -7,19 +8,16 @@ import styles from './FormRadioGroup.styl';
|
|
|
7
8
|
interface IFormRadioGroupProps {
|
|
8
9
|
children: any;
|
|
9
10
|
className?: string;
|
|
11
|
+
|
|
12
|
+
// mobx form field instance
|
|
10
13
|
field: any;
|
|
14
|
+
|
|
11
15
|
containerClassName?: string;
|
|
12
16
|
childClassName?: string;
|
|
13
17
|
}
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
name?: string;
|
|
18
|
-
value?: string;
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
class FormRadioGroup extends React.Component<IFormRadioGroupProps, IFormRadioGroupState> {
|
|
19
|
+
@observer
|
|
20
|
+
class FormRadioGroup extends React.Component<IFormRadioGroupProps> {
|
|
23
21
|
static defaultProps = {
|
|
24
22
|
className: '',
|
|
25
23
|
label: false,
|
|
@@ -27,39 +25,16 @@ class FormRadioGroup extends React.Component<IFormRadioGroupProps, IFormRadioGro
|
|
|
27
25
|
childClassName: ''
|
|
28
26
|
};
|
|
29
27
|
|
|
30
|
-
constructor(props: IFormRadioGroupProps) {
|
|
31
|
-
super(props);
|
|
32
|
-
this.state = {
|
|
33
|
-
field: {
|
|
34
|
-
name: '',
|
|
35
|
-
value: ''
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
handleRadioChange = (event: React.ChangeEvent<HTMLInputElement>, value?: any) => {
|
|
41
|
-
const { name, onChange } = this.props.field;
|
|
42
|
-
this.setState(() => ({
|
|
43
|
-
field: {
|
|
44
|
-
name,
|
|
45
|
-
value
|
|
46
|
-
}
|
|
47
|
-
}));
|
|
48
|
-
onChange(event, value);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
28
|
render() {
|
|
52
|
-
const { className, containerClassName, childClassName
|
|
53
|
-
|
|
29
|
+
const { field, className, containerClassName, childClassName } = this.props;
|
|
30
|
+
|
|
54
31
|
const hasError = field.hasError;
|
|
55
32
|
const error = field.error;
|
|
56
33
|
|
|
57
34
|
const _props = {
|
|
58
|
-
|
|
59
|
-
value,
|
|
35
|
+
...field.bind(),
|
|
60
36
|
containerClassName,
|
|
61
37
|
childClassName,
|
|
62
|
-
onChange: this.handleRadioChange,
|
|
63
38
|
error: hasError
|
|
64
39
|
};
|
|
65
40
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { storiesOf } from '@storybook/react';
|
|
4
|
+
import FormTextField from './FormTextField';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
const field = {
|
|
8
|
+
error: 'Something went wrong',
|
|
9
|
+
hasError: true,
|
|
10
|
+
bind: () => {
|
|
11
|
+
const { bind, ...rest } = field;
|
|
12
|
+
return rest;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
storiesOf('_Common_UI', module)
|
|
17
|
+
.add('FormTextField', () => (
|
|
18
|
+
<div>
|
|
19
|
+
<FormTextField errorPosition='BottomRight' field={field}/>
|
|
20
|
+
</div>
|
|
21
|
+
));
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
.field
|
|
2
|
+
position: relative
|
|
3
|
+
|
|
4
|
+
.errorText
|
|
5
|
+
position: absolute
|
|
6
|
+
display: block
|
|
7
|
+
width: 100%
|
|
8
|
+
z-index: 1
|
|
9
|
+
font-family: "Arial Standard", Arial
|
|
10
|
+
font-weight: 400;
|
|
11
|
+
font-style: normal
|
|
12
|
+
font-size: 10px
|
|
13
|
+
color: rgb(204, 51, 51)
|
|
14
|
+
overflow: hidden
|
|
15
|
+
text-overflow: ellipsis
|
|
16
|
+
white-space: nowrap
|
|
17
|
+
box-sizing border-box
|
|
18
|
+
padding: 0 2px
|
|
19
|
+
|
|
20
|
+
.errorBottomLeft,
|
|
21
|
+
.errorTopLeft
|
|
22
|
+
text-align: left
|
|
23
|
+
|
|
24
|
+
.errorBottomRight,
|
|
25
|
+
.errorTopRight
|
|
26
|
+
text-align: right
|
|
27
|
+
|
|
28
|
+
.errorBottomLeft,
|
|
29
|
+
.errorBottomRight
|
|
30
|
+
bottom: -15px
|
|
31
|
+
|
|
32
|
+
.errorTopLeft,
|
|
33
|
+
.errorTopRight
|
|
34
|
+
top: -15px
|
|
35
|
+
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import { observer } from 'mobx-react';
|
|
4
|
+
|
|
5
|
+
import styles from './FormTextField.styl';
|
|
6
|
+
import TextField from './TextField';
|
|
7
|
+
|
|
8
|
+
export type ErrorPositionType = 'TopRight' | 'TopLeft' | 'BottomRight' | 'BottomLeft';
|
|
9
|
+
|
|
10
|
+
interface IFormTextFieldProps {
|
|
11
|
+
errorPosition?: ErrorPositionType;
|
|
12
|
+
className?: string;
|
|
13
|
+
// TODO: change this when mobx-react-form supports typescript
|
|
14
|
+
field: any;
|
|
15
|
+
type?: string;
|
|
16
|
+
|
|
17
|
+
min?: number;
|
|
18
|
+
step?: number;
|
|
19
|
+
max?: number;
|
|
20
|
+
|
|
21
|
+
onKeyPress?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@observer
|
|
25
|
+
class FormTextField extends React.Component<IFormTextFieldProps, {}> {
|
|
26
|
+
static defaultProps = {
|
|
27
|
+
className: '',
|
|
28
|
+
errorPosition: 'BottomLeft',
|
|
29
|
+
t: () => ''
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
render() {
|
|
33
|
+
const { className, errorPosition, field, type, min, step, max, onKeyPress } = this.props;
|
|
34
|
+
const errorClassName = classnames(styles.errorText, styles[`error${errorPosition}`]);
|
|
35
|
+
|
|
36
|
+
const hasError = field.hasError;
|
|
37
|
+
const error = field.error;
|
|
38
|
+
|
|
39
|
+
const props = {
|
|
40
|
+
...field.bind(),
|
|
41
|
+
min, step, max,
|
|
42
|
+
onKeyPress
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<div className={classnames(styles.field, className)}>
|
|
47
|
+
<TextField error={hasError && error} {...props} type={type || field.type} />
|
|
48
|
+
{hasError && error ? (<span className={errorClassName}>{error}</span>) : false}
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default FormTextField;
|