@holper/react-native-holper-storybook 0.6.71 → 0.6.73

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