@holper/react-native-holper-storybook 0.6.72 → 0.6.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/lib/components/Input/index.js +53 -49
- package/lib/components/Input/style.js +22 -16
- package/package.json +1 -1
|
@@ -5,81 +5,85 @@ import style from "./style";
|
|
|
5
5
|
import { Colors } from "../../configs/constants";
|
|
6
6
|
|
|
7
7
|
const Input = ({
|
|
8
|
+
variant,
|
|
9
|
+
size,
|
|
8
10
|
disabled,
|
|
9
|
-
rightIcon,
|
|
10
|
-
rightIconWide,
|
|
11
11
|
leftIcon,
|
|
12
12
|
leftIconWide,
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
showLabel,
|
|
14
|
+
label,
|
|
15
15
|
count,
|
|
16
|
+
rightIcon,
|
|
17
|
+
value,
|
|
18
|
+
maxLength,
|
|
16
19
|
...props
|
|
17
20
|
}) => (
|
|
18
|
-
<View>
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
style[
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
leftIconWide ? style.leftWideIconContainer : {},
|
|
50
|
-
disabled ? style.disabled : {},
|
|
51
|
-
]}
|
|
52
|
-
>
|
|
53
|
-
{leftIcon}
|
|
21
|
+
<View style={style.container}>
|
|
22
|
+
{showLabel && <Text style={style.label}>{label}</Text>}
|
|
23
|
+
<View style={style.inputWrapper}>
|
|
24
|
+
<TextInput
|
|
25
|
+
style={[
|
|
26
|
+
style.input,
|
|
27
|
+
style[variant],
|
|
28
|
+
style[`${size}Size`],
|
|
29
|
+
leftIcon ? style.leftIcon : {},
|
|
30
|
+
leftIconWide ? style.leftIconWide : {},
|
|
31
|
+
disabled ? style.disabled : {},
|
|
32
|
+
]}
|
|
33
|
+
editable={!disabled}
|
|
34
|
+
allowFontScaling={false}
|
|
35
|
+
placeholderTextColor={Colors.midblue}
|
|
36
|
+
value={value}
|
|
37
|
+
maxLength={maxLength}
|
|
38
|
+
{...props}
|
|
39
|
+
/>
|
|
40
|
+
{leftIcon && (
|
|
41
|
+
<View
|
|
42
|
+
style={[
|
|
43
|
+
style.leftIconContainer,
|
|
44
|
+
leftIconWide ? style.leftWideIconContainer : {},
|
|
45
|
+
disabled ? style.disabled : {},
|
|
46
|
+
]}
|
|
47
|
+
>
|
|
48
|
+
{leftIcon}
|
|
49
|
+
</View>
|
|
50
|
+
)}
|
|
51
|
+
{rightIcon && <View style={style.rightIconContainer}>{rightIcon}</View>}
|
|
54
52
|
</View>
|
|
55
|
-
{
|
|
53
|
+
{count && (
|
|
56
54
|
<Text style={style.count}>
|
|
57
55
|
{value?.length || 0}/{maxLength}
|
|
58
56
|
</Text>
|
|
59
|
-
)
|
|
57
|
+
)}
|
|
60
58
|
</View>
|
|
61
59
|
);
|
|
62
60
|
|
|
63
61
|
Input.defaultProps = {
|
|
62
|
+
variant: "default",
|
|
64
63
|
disabled: false,
|
|
65
64
|
leftIcon: null,
|
|
66
65
|
leftIconWide: false,
|
|
66
|
+
showLabel: false,
|
|
67
|
+
label: "",
|
|
68
|
+
count: false,
|
|
67
69
|
rightIcon: null,
|
|
68
|
-
|
|
70
|
+
value: "",
|
|
71
|
+
maxLength: 100,
|
|
69
72
|
size: "fixed",
|
|
70
|
-
variant: "default",
|
|
71
|
-
count: 0,
|
|
72
73
|
};
|
|
73
74
|
|
|
74
75
|
Input.propTypes = {
|
|
76
|
+
variant: PropTypes.oneOf(["default", "completed", "error"]),
|
|
77
|
+
size: PropTypes.oneOf(["fixed", "fit"]),
|
|
75
78
|
disabled: PropTypes.bool,
|
|
76
79
|
leftIcon: PropTypes.node,
|
|
77
80
|
leftIconWide: PropTypes.bool,
|
|
81
|
+
showLabel: PropTypes.bool,
|
|
82
|
+
label: PropTypes.string,
|
|
83
|
+
count: PropTypes.bool,
|
|
78
84
|
rightIcon: PropTypes.node,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
variant: PropTypes.oneOf(["default", "completed", "error"]),
|
|
82
|
-
count: PropTypes.number,
|
|
85
|
+
value: PropTypes.string,
|
|
86
|
+
maxLength: PropTypes.number,
|
|
83
87
|
};
|
|
84
88
|
|
|
85
89
|
export default Input;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Dimensions } from
|
|
2
|
-
import { Colors, borderRadius } from
|
|
1
|
+
import { Dimensions } from "react-native";
|
|
2
|
+
import { Colors, borderRadius } from "../../configs/constants";
|
|
3
3
|
|
|
4
|
-
const { width } = Dimensions.get(
|
|
4
|
+
const { width } = Dimensions.get("window");
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
7
|
container: {
|
|
@@ -10,12 +10,12 @@ export default {
|
|
|
10
10
|
label: {
|
|
11
11
|
marginBottom: 4,
|
|
12
12
|
fontSize: 14,
|
|
13
|
-
fontFamily:
|
|
13
|
+
fontFamily: "poppins_regular",
|
|
14
14
|
color: Colors.darkblue,
|
|
15
|
-
fontWeight:
|
|
15
|
+
fontWeight: "bold",
|
|
16
16
|
},
|
|
17
17
|
inputWrapper: {
|
|
18
|
-
position:
|
|
18
|
+
position: "relative",
|
|
19
19
|
},
|
|
20
20
|
input: {
|
|
21
21
|
height: 50,
|
|
@@ -23,10 +23,16 @@ export default {
|
|
|
23
23
|
borderWidth: 1,
|
|
24
24
|
paddingHorizontal: 20,
|
|
25
25
|
color: Colors.darkblue,
|
|
26
|
-
fontFamily:
|
|
26
|
+
fontFamily: "poppins_regular",
|
|
27
27
|
backgroundColor: Colors.white,
|
|
28
28
|
marginVertical: 6,
|
|
29
29
|
},
|
|
30
|
+
fixedSize: {
|
|
31
|
+
width: width - 80,
|
|
32
|
+
},
|
|
33
|
+
fitSize: {
|
|
34
|
+
width: "100%",
|
|
35
|
+
},
|
|
30
36
|
default: {
|
|
31
37
|
borderColor: Colors.lightblue,
|
|
32
38
|
},
|
|
@@ -53,18 +59,18 @@ export default {
|
|
|
53
59
|
paddingRight: 70,
|
|
54
60
|
},
|
|
55
61
|
rightIconContainer: {
|
|
56
|
-
position:
|
|
62
|
+
position: "absolute",
|
|
57
63
|
right: 10,
|
|
58
64
|
top: 10,
|
|
59
65
|
height: 42,
|
|
60
|
-
justifyContent:
|
|
66
|
+
justifyContent: "center",
|
|
61
67
|
},
|
|
62
68
|
leftIconContainer: {
|
|
63
|
-
position:
|
|
69
|
+
position: "absolute",
|
|
64
70
|
left: 10,
|
|
65
71
|
top: 10,
|
|
66
72
|
height: 42,
|
|
67
|
-
justifyContent:
|
|
73
|
+
justifyContent: "center",
|
|
68
74
|
},
|
|
69
75
|
rightWideIconContainer: {
|
|
70
76
|
paddingLeft: 2,
|
|
@@ -75,22 +81,22 @@ export default {
|
|
|
75
81
|
borderRightWidth: 1,
|
|
76
82
|
},
|
|
77
83
|
rightIconContainer: {
|
|
78
|
-
position:
|
|
84
|
+
position: "absolute",
|
|
79
85
|
right: 10,
|
|
80
86
|
top: 10,
|
|
81
87
|
height: 42,
|
|
82
|
-
justifyContent:
|
|
88
|
+
justifyContent: "center",
|
|
83
89
|
},
|
|
84
90
|
count: {
|
|
85
|
-
textAlign:
|
|
91
|
+
textAlign: "right",
|
|
86
92
|
fontSize: 12,
|
|
87
93
|
color: Colors.gray,
|
|
88
|
-
fontFamily:
|
|
94
|
+
fontFamily: "poppins_regular",
|
|
89
95
|
fixedSize: {
|
|
90
96
|
width: width - 80,
|
|
91
97
|
},
|
|
92
98
|
fitSize: {
|
|
93
|
-
width:
|
|
99
|
+
width: "100%",
|
|
94
100
|
},
|
|
95
101
|
},
|
|
96
102
|
};
|