@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.
@@ -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
- size,
14
- variant,
13
+ showLabel,
14
+ label,
15
15
  count,
16
+ rightIcon,
17
+ value,
18
+ maxLength,
16
19
  ...props
17
20
  }) => (
18
- <View>
19
- <TextInput
20
- style={[
21
- style.input,
22
- style[variant],
23
- style[`${size}Size`],
24
- rightIcon && style.rightIcon,
25
- leftIcon && style.leftIcon,
26
- rightIconWide && style.rightIconWide,
27
- leftIconWide && style.leftIconWide,
28
- disabled && style.disabled,
29
- ]}
30
- editable={!disabled}
31
- allowFontScaling={false}
32
- placeholderTextColor={Colors.midblue}
33
- {...props}
34
- />
35
- <View
36
- style={[
37
- style[variant],
38
- style.rightIconContainer,
39
- rightIconWide ? style.rightWideIconContainer : {},
40
- disabled ? style.disabled : {},
41
- ]}
42
- >
43
- {rightIcon}
44
- </View>
45
- <View
46
- style={[
47
- style[variant],
48
- style.leftIconContainer,
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
- {!!count ? (
53
+ {count && (
56
54
  <Text style={style.count}>
57
55
  {value?.length || 0}/{maxLength}
58
56
  </Text>
59
- ) : null}
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
- rightIconWide: false,
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
- rightIconWide: PropTypes.bool,
80
- size: PropTypes.oneOf(["fixed", "fit"]),
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 'react-native';
2
- import { Colors, borderRadius } from '../../configs/constants';
1
+ import { Dimensions } from "react-native";
2
+ import { Colors, borderRadius } from "../../configs/constants";
3
3
 
4
- const { width } = Dimensions.get('window');
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: 'poppins_regular',
13
+ fontFamily: "poppins_regular",
14
14
  color: Colors.darkblue,
15
- fontWeight: 'bold',
15
+ fontWeight: "bold",
16
16
  },
17
17
  inputWrapper: {
18
- position: 'relative',
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: 'poppins_regular',
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: 'absolute',
62
+ position: "absolute",
57
63
  right: 10,
58
64
  top: 10,
59
65
  height: 42,
60
- justifyContent: 'center',
66
+ justifyContent: "center",
61
67
  },
62
68
  leftIconContainer: {
63
- position: 'absolute',
69
+ position: "absolute",
64
70
  left: 10,
65
71
  top: 10,
66
72
  height: 42,
67
- justifyContent: 'center',
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: 'absolute',
84
+ position: "absolute",
79
85
  right: 10,
80
86
  top: 10,
81
87
  height: 42,
82
- justifyContent: 'center',
88
+ justifyContent: "center",
83
89
  },
84
90
  count: {
85
- textAlign: 'right',
91
+ textAlign: "right",
86
92
  fontSize: 12,
87
93
  color: Colors.gray,
88
- fontFamily: 'poppins_regular',
94
+ fontFamily: "poppins_regular",
89
95
  fixedSize: {
90
96
  width: width - 80,
91
97
  },
92
98
  fitSize: {
93
- width: '100%',
99
+ width: "100%",
94
100
  },
95
101
  },
96
102
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "main": "lib/index.js",
3
3
  "name": "@holper/react-native-holper-storybook",
4
4
  "description": "A component library for Holper projects",
5
- "version": "0.6.72",
5
+ "version": "0.6.74",
6
6
  "license": "MIT",
7
7
  "files": [
8
8
  "lib",