etendo-ui-library 1.0.25 → 1.0.26
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/.ondevice/storybook.requires.js +2 -5
- package/assets/fonts/Inter-Black.ttf +0 -0
- package/assets/fonts/Inter-Bold.ttf +0 -0
- package/assets/fonts/Inter-ExtraBold.ttf +0 -0
- package/assets/fonts/Inter-ExtraLight.ttf +0 -0
- package/assets/fonts/Inter-Light.ttf +0 -0
- package/assets/fonts/Inter-Medium.ttf +0 -0
- package/assets/fonts/Inter-Regular.ttf +0 -0
- package/assets/fonts/Inter-Thin.ttf +0 -0
- package/components/input/Input.stories.tsx +118 -0
- package/components/input/Input.style.ts +190 -0
- package/components/input/Input.test.tsx +28 -0
- package/components/input/Input.tsx +69 -0
- package/components/input/Input.types.ts +116 -0
- package/components/input/__snapshots__/Input.test.tsx.snap +114 -0
- package/components/input/components/InputField.tsx +107 -0
- package/components/input/components/InputHelperText.tsx +15 -0
- package/components/input/components/InputTitle.tsx +27 -0
- package/components/input/index.ts +6 -0
- package/helpers/utilimage.ts +6 -2
- package/helpers/utilsTypes.ts +8 -0
- package/package.json +1 -1
- package/storybook-static/0.af007743.iframe.bundle.js +1 -0
- package/storybook-static/4.05b37fe0.iframe.bundle.js +3 -0
- package/storybook-static/{4.7a0ebe65.iframe.bundle.js.LICENSE.txt → 4.05b37fe0.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/4.05b37fe0.iframe.bundle.js.map +1 -0
- package/storybook-static/5.e6214d22.iframe.bundle.js +1 -0
- package/storybook-static/{6.1e198358.iframe.bundle.js → 6.edcb01df.iframe.bundle.js} +3 -3
- package/storybook-static/{6.1e198358.iframe.bundle.js.LICENSE.txt → 6.edcb01df.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/6.edcb01df.iframe.bundle.js.map +1 -0
- package/storybook-static/{7.606df0d6.iframe.bundle.js → 7.7b615c14.iframe.bundle.js} +1 -1
- package/storybook-static/iframe.html +1 -1
- package/storybook-static/main.9c767b6a.iframe.bundle.js +1 -0
- package/storybook-static/{runtime~main.d44a6cf4.iframe.bundle.js → runtime~main.bdbd9590.iframe.bundle.js} +1 -1
- package/storybook-static/static/media/arrowPicker.190f9c4f.png +0 -0
- package/storybook-static/static/media/search.9a034d03.png +0 -0
- package/storybook-static/vendors~main.26d7e09c.iframe.bundle.js +3 -0
- package/storybook-static/{vendors~main.195287a6.iframe.bundle.js.LICENSE.txt → vendors~main.26d7e09c.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/vendors~main.26d7e09c.iframe.bundle.js.map +1 -0
- package/styles/colors.ts +34 -0
- package/styles/fonts.ts +9 -0
- package/build-storybook.log +0 -3047
- package/storybook-static/0.80458c68.iframe.bundle.js +0 -1
- package/storybook-static/4.7a0ebe65.iframe.bundle.js +0 -3
- package/storybook-static/4.7a0ebe65.iframe.bundle.js.map +0 -1
- package/storybook-static/5.e2d3b4fb.iframe.bundle.js +0 -1
- package/storybook-static/6.1e198358.iframe.bundle.js.map +0 -1
- package/storybook-static/main.97ce53dc.iframe.bundle.js +0 -1
- package/storybook-static/vendors~main.195287a6.iframe.bundle.js +0 -3
- package/storybook-static/vendors~main.195287a6.iframe.bundle.js.map +0 -1
|
@@ -24,13 +24,10 @@ if (parameters) {
|
|
|
24
24
|
addParameters(parameters);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
try {
|
|
29
|
-
argsEnhancers.forEach(enhancer => addArgsEnhancer(enhancer));
|
|
30
|
-
} catch {}
|
|
27
|
+
argsEnhancers.forEach(enhancer => addArgsEnhancer(enhancer));
|
|
31
28
|
|
|
32
29
|
const getStories = () => {
|
|
33
|
-
return [require('../components/**/*.stories')];
|
|
30
|
+
return [require('../components/**/*.stories.tsx')];
|
|
34
31
|
};
|
|
35
32
|
|
|
36
33
|
configure(getStories, module, false);
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Story, Meta} from '@storybook/react';
|
|
3
|
+
import Input from '../input/Input';
|
|
4
|
+
import {InputProps} from './Input.types';
|
|
5
|
+
|
|
6
|
+
const meta: Meta =
|
|
7
|
+
{
|
|
8
|
+
title: 'Input',
|
|
9
|
+
component: Input,
|
|
10
|
+
argTypes:{}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const Template: Story<InputProps> = (args) => <Input{...args}/>
|
|
14
|
+
|
|
15
|
+
export default meta;
|
|
16
|
+
export const OnlyRead = Template.bind({})
|
|
17
|
+
export const Picker = Template.bind({})
|
|
18
|
+
export const SearchPressable = Template.bind({})
|
|
19
|
+
export const SearchTextInput = Template.bind({})
|
|
20
|
+
export const TextPressable = Template.bind({})
|
|
21
|
+
export const TextInput = Template.bind({})
|
|
22
|
+
|
|
23
|
+
OnlyRead.args =
|
|
24
|
+
{
|
|
25
|
+
titleLabel:'Only Read',
|
|
26
|
+
helperText:'',
|
|
27
|
+
placeholder:'Write a password',
|
|
28
|
+
disabled:false,
|
|
29
|
+
value:'27/04/2022',
|
|
30
|
+
numberOfLines: 1,
|
|
31
|
+
typeField:'onlyRead',
|
|
32
|
+
isError:true,
|
|
33
|
+
onPress:()=> {console.log('Press Field')},
|
|
34
|
+
onChangeText:(text)=>console.log(text),
|
|
35
|
+
onFocus:()=> {console.log('On Focus')},
|
|
36
|
+
onBlur:()=> {console.log('On Blur')},
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
Picker.args =
|
|
40
|
+
{
|
|
41
|
+
titleLabel:'Picker',
|
|
42
|
+
helperText:'Only characters',
|
|
43
|
+
placeholder:'Write a password',
|
|
44
|
+
disabled:false,
|
|
45
|
+
value:'',
|
|
46
|
+
numberOfLines: 1,
|
|
47
|
+
typeField:'picker',
|
|
48
|
+
isError:false,
|
|
49
|
+
onPress:()=> {console.log('Press Field')},
|
|
50
|
+
onChangeText:(text)=>console.log(text),
|
|
51
|
+
onFocus:()=> {console.log('On Focus')},
|
|
52
|
+
onBlur:()=> {console.log('On Blur')},
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
SearchPressable.args =
|
|
56
|
+
{
|
|
57
|
+
titleLabel:'Search Presseable',
|
|
58
|
+
helperText:'Only characters',
|
|
59
|
+
placeholder:'Write a password',
|
|
60
|
+
disabled:false,
|
|
61
|
+
value:'',
|
|
62
|
+
numberOfLines: 1,
|
|
63
|
+
typeField:'searchPressable',
|
|
64
|
+
isError:false,
|
|
65
|
+
onPress:()=> {console.log('Press Field')},
|
|
66
|
+
onChangeText:(text)=>console.log(text),
|
|
67
|
+
onFocus:()=> {console.log('On Focus')},
|
|
68
|
+
onBlur:()=> {console.log('On Blur')},
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
SearchTextInput.args =
|
|
72
|
+
{
|
|
73
|
+
titleLabel:'Search TextInput',
|
|
74
|
+
helperText:'Only characters',
|
|
75
|
+
placeholder:'Write a password',
|
|
76
|
+
disabled:false,
|
|
77
|
+
value:'',
|
|
78
|
+
numberOfLines: 1,
|
|
79
|
+
typeField:'searchTextInput',
|
|
80
|
+
isError:false,
|
|
81
|
+
onPress:()=> {console.log('Press Field')},
|
|
82
|
+
onChangeText:(text)=>console.log(text),
|
|
83
|
+
onFocus:()=> {console.log('On Focus')},
|
|
84
|
+
onBlur:()=> {console.log('On Blur')},
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
TextPressable.args =
|
|
88
|
+
{
|
|
89
|
+
titleLabel:'Text Pressable',
|
|
90
|
+
helperText:'Only characters',
|
|
91
|
+
placeholder:'Write a password',
|
|
92
|
+
disabled:false,
|
|
93
|
+
value:'',
|
|
94
|
+
numberOfLines: 5,
|
|
95
|
+
typeField:'textPressable',
|
|
96
|
+
isError:false,
|
|
97
|
+
onPress:()=> {console.log('Press Field')},
|
|
98
|
+
onChangeText:(text)=>console.log(text),
|
|
99
|
+
onFocus:()=> {console.log('On Focus')},
|
|
100
|
+
onBlur:()=> {console.log('On Blur')},
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
TextInput.args =
|
|
105
|
+
{
|
|
106
|
+
titleLabel:'Text Input',
|
|
107
|
+
helperText:'Only characters',
|
|
108
|
+
placeholder:'Write a password',
|
|
109
|
+
disabled:false,
|
|
110
|
+
value:'',
|
|
111
|
+
numberOfLines: 5,
|
|
112
|
+
typeField:'textInput',
|
|
113
|
+
isError:false,
|
|
114
|
+
onPress:()=> {console.log('Press Field')},
|
|
115
|
+
onChangeText:(text)=>console.log(text),
|
|
116
|
+
onFocus:()=> {console.log('On Focus')},
|
|
117
|
+
onBlur:()=> {console.log('On Blur')},
|
|
118
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import {StyleSheet, TextStyle, ViewStyle} from 'react-native';
|
|
2
|
+
import {FONT_MEDIUM, FONT_REGULAR} from '../../styles/fonts';
|
|
3
|
+
import {InputVariantsType, TypeInputStyleVariant} from './Input.types';
|
|
4
|
+
import {
|
|
5
|
+
BLUE,
|
|
6
|
+
GREY_5,
|
|
7
|
+
GREY_60,
|
|
8
|
+
GREY_BLUE,
|
|
9
|
+
GREY_BLUE_50,
|
|
10
|
+
PURPLE_50,
|
|
11
|
+
RED,
|
|
12
|
+
RED_10,
|
|
13
|
+
WHITE,
|
|
14
|
+
} from '../../styles/colors';
|
|
15
|
+
|
|
16
|
+
export const inputVariants: InputVariantsType = {
|
|
17
|
+
onlyRead: {
|
|
18
|
+
field: {
|
|
19
|
+
type: 'text',
|
|
20
|
+
disabledField: true,
|
|
21
|
+
disabledSubmit: true,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
picker: {
|
|
25
|
+
field: {
|
|
26
|
+
type: 'text',
|
|
27
|
+
disabledField: false,
|
|
28
|
+
disabledSubmit: true,
|
|
29
|
+
image: {
|
|
30
|
+
imgHeight: 4,
|
|
31
|
+
imgWidth: 6,
|
|
32
|
+
imgRoute: require('../../assets/images/icons/arrowPicker.png'),
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
textInput: {
|
|
37
|
+
field: {
|
|
38
|
+
type: 'textInput',
|
|
39
|
+
disabledField: true,
|
|
40
|
+
disabledSubmit: false,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
textPressable: {
|
|
44
|
+
field: {
|
|
45
|
+
type: 'text',
|
|
46
|
+
disabledField: false,
|
|
47
|
+
disabledSubmit: false,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
searchTextInput: {
|
|
51
|
+
field: {
|
|
52
|
+
type: 'textInput',
|
|
53
|
+
disabledField: true,
|
|
54
|
+
disabledSubmit: false,
|
|
55
|
+
image: {
|
|
56
|
+
imgHeight: 12,
|
|
57
|
+
imgWidth: 13,
|
|
58
|
+
imgRoute: require('../../assets/images/icons/search.png'),
|
|
59
|
+
imgMarginRight: 5,
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
searchPressable: {
|
|
64
|
+
field: {
|
|
65
|
+
type: 'text',
|
|
66
|
+
disabledField: false,
|
|
67
|
+
disabledSubmit: false,
|
|
68
|
+
image: {
|
|
69
|
+
imgHeight: 12,
|
|
70
|
+
imgWidth: 13,
|
|
71
|
+
imgRoute: require('../../assets/images/icons/search.png'),
|
|
72
|
+
imgMarginRight: 5,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const defaultTitle:TextStyle = {
|
|
79
|
+
color: BLUE,
|
|
80
|
+
fontSize: 14,
|
|
81
|
+
//fontFamily: FONT_MEDIUM,
|
|
82
|
+
marginBottom:5,
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const defaultField:ViewStyle =
|
|
86
|
+
{
|
|
87
|
+
backgroundColor: WHITE,
|
|
88
|
+
borderWidth: 1,
|
|
89
|
+
borderColor: BLUE,
|
|
90
|
+
borderRadius: 3,
|
|
91
|
+
flexDirection: 'row',
|
|
92
|
+
alignItems:'center'
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const defaultText:TextStyle =
|
|
96
|
+
{
|
|
97
|
+
flex: 1,
|
|
98
|
+
paddingVertical: 5,
|
|
99
|
+
paddingLeft: 7,
|
|
100
|
+
color: BLUE,
|
|
101
|
+
fontSize: 14,
|
|
102
|
+
fontWeight: '500',
|
|
103
|
+
// fontFamily: FONT_MEDIUM,
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const defaultTextPlaceholder:TextStyle =
|
|
107
|
+
{
|
|
108
|
+
flex: 1,
|
|
109
|
+
paddingVertical: 5,
|
|
110
|
+
paddingLeft: 7,
|
|
111
|
+
color: GREY_BLUE,
|
|
112
|
+
fontSize: 14,
|
|
113
|
+
fontWeight: '500',
|
|
114
|
+
// fontFamily: FONT_MEDIUM,
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const defaultHelperText:TextStyle =
|
|
118
|
+
{
|
|
119
|
+
color: GREY_60,
|
|
120
|
+
fontSize: 14,
|
|
121
|
+
// fontFamily: FONT_REGULAR,
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export const inputStyleVariants: TypeInputStyleVariant = {
|
|
125
|
+
default: {
|
|
126
|
+
titleStyle: defaultTitle,
|
|
127
|
+
fieldStyle: {
|
|
128
|
+
field: defaultField,
|
|
129
|
+
focus: {
|
|
130
|
+
borderColor: PURPLE_50,
|
|
131
|
+
},
|
|
132
|
+
textDefault: defaultText,
|
|
133
|
+
textPlaceholder: defaultTextPlaceholder
|
|
134
|
+
},
|
|
135
|
+
helperStyle: defaultHelperText,
|
|
136
|
+
},
|
|
137
|
+
destructive: {
|
|
138
|
+
titleStyle: defaultTitle,
|
|
139
|
+
fieldStyle: {
|
|
140
|
+
focus: {
|
|
141
|
+
borderColor: RED_10,
|
|
142
|
+
},
|
|
143
|
+
field: [defaultField,{borderColor: RED}],
|
|
144
|
+
textDefault: defaultText,
|
|
145
|
+
textPlaceholder: defaultTextPlaceholder
|
|
146
|
+
},
|
|
147
|
+
helperStyle: [defaultHelperText,{color: RED,}]
|
|
148
|
+
},
|
|
149
|
+
disabled: {
|
|
150
|
+
titleStyle: [defaultTitle,{color: GREY_BLUE_50}],
|
|
151
|
+
fieldStyle: {
|
|
152
|
+
focus: {},
|
|
153
|
+
field: [defaultField,{borderColor: GREY_BLUE_50}],
|
|
154
|
+
textDefault: [defaultText,{color:GREY_BLUE_50}],
|
|
155
|
+
textPlaceholder: [defaultTextPlaceholder,{color:GREY_BLUE_50}]
|
|
156
|
+
},
|
|
157
|
+
helperStyle: [defaultHelperText,{color: GREY_BLUE_50}]
|
|
158
|
+
},
|
|
159
|
+
onlyRead: {
|
|
160
|
+
titleStyle: defaultTitle,
|
|
161
|
+
fieldStyle: {
|
|
162
|
+
field: [defaultField,{backgroundColor:GREY_5}],
|
|
163
|
+
focus: {},
|
|
164
|
+
textDefault: defaultText,
|
|
165
|
+
textPlaceholder: defaultTextPlaceholder,
|
|
166
|
+
},
|
|
167
|
+
helperStyle: defaultHelperText,
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
export const styles = StyleSheet.create({
|
|
172
|
+
inputContainer: {
|
|
173
|
+
flex: 1,
|
|
174
|
+
},
|
|
175
|
+
rowInputTitle: {
|
|
176
|
+
flexDirection: 'row',
|
|
177
|
+
alignItems: 'center',
|
|
178
|
+
},
|
|
179
|
+
rowHelperText: {
|
|
180
|
+
flexDirection: 'row',
|
|
181
|
+
alignItems: 'center',
|
|
182
|
+
marginTop: 5,
|
|
183
|
+
},
|
|
184
|
+
buttonContainerInputField: {
|
|
185
|
+
alignSelf: 'flex-start',
|
|
186
|
+
paddingHorizontal: 7,
|
|
187
|
+
justifyContent: 'center',
|
|
188
|
+
height:'100%',
|
|
189
|
+
},
|
|
190
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import renderer from 'react-test-renderer';
|
|
3
|
+
import Input from './Input';
|
|
4
|
+
|
|
5
|
+
describe('Running Test for Input', () => {
|
|
6
|
+
|
|
7
|
+
it('Check Input Error', () => {
|
|
8
|
+
|
|
9
|
+
const tree = renderer
|
|
10
|
+
.create(
|
|
11
|
+
<Input
|
|
12
|
+
titleLabel='Test'
|
|
13
|
+
helperText='Only characters'
|
|
14
|
+
placeholder='Write a password'
|
|
15
|
+
disabled={false}
|
|
16
|
+
value='Render Test'
|
|
17
|
+
onPress={()=> {console.log('Press Field')}}
|
|
18
|
+
onChangeText={(text)=>console.log(text)}
|
|
19
|
+
onFocus={()=> {console.log('On Focus')}}
|
|
20
|
+
onBlur={()=> {console.log('On Blur')}}
|
|
21
|
+
typeField='searchTextInput'
|
|
22
|
+
isError={true}
|
|
23
|
+
/>
|
|
24
|
+
)
|
|
25
|
+
.toJSON();
|
|
26
|
+
expect(tree).toMatchSnapshot();
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {View} from 'react-native';
|
|
3
|
+
import {inputStyleVariants, inputVariants, styles} from './Input.style';
|
|
4
|
+
import {InputProps} from './Input.types';
|
|
5
|
+
import {InputTitle, InputField, InputHelperText} from './index';
|
|
6
|
+
|
|
7
|
+
const Input = ({
|
|
8
|
+
value,
|
|
9
|
+
titleLabel,
|
|
10
|
+
titleImage,
|
|
11
|
+
helperText,
|
|
12
|
+
placeholder,
|
|
13
|
+
disabled,
|
|
14
|
+
maxLength,
|
|
15
|
+
numberOfLines,
|
|
16
|
+
typeField,
|
|
17
|
+
isError,
|
|
18
|
+
onPress,
|
|
19
|
+
onSubmit,
|
|
20
|
+
onFocus,
|
|
21
|
+
onBlur,
|
|
22
|
+
onChangeText,
|
|
23
|
+
}:InputProps) => {
|
|
24
|
+
|
|
25
|
+
const stateStyle = () => {
|
|
26
|
+
var style
|
|
27
|
+
if (typeField === 'onlyRead') {
|
|
28
|
+
style = inputStyleVariants.onlyRead;
|
|
29
|
+
} else if (disabled) {
|
|
30
|
+
style = inputStyleVariants.disabled;
|
|
31
|
+
} else if (isError) {
|
|
32
|
+
style = inputStyleVariants.destructive;
|
|
33
|
+
} else {
|
|
34
|
+
style = inputStyleVariants.default;
|
|
35
|
+
}
|
|
36
|
+
return style;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<View style={styles.inputContainer}>
|
|
41
|
+
<InputTitle
|
|
42
|
+
disabled={disabled}
|
|
43
|
+
title={titleLabel}
|
|
44
|
+
image={titleImage}
|
|
45
|
+
styleTitle={stateStyle().titleStyle}
|
|
46
|
+
/>
|
|
47
|
+
<InputField
|
|
48
|
+
disabled={disabled}
|
|
49
|
+
configField={inputVariants[typeField].field}
|
|
50
|
+
styleField={stateStyle().fieldStyle}
|
|
51
|
+
placeholder={placeholder}
|
|
52
|
+
value={value}
|
|
53
|
+
onPress={onPress}
|
|
54
|
+
onSubmit={onSubmit}
|
|
55
|
+
onFocus={onFocus ? onFocus : () => {}}
|
|
56
|
+
onBlur={onBlur ? onBlur : () => {}}
|
|
57
|
+
onChangeText={onChangeText}
|
|
58
|
+
maxLength={maxLength}
|
|
59
|
+
numberOfLines={numberOfLines}
|
|
60
|
+
/>
|
|
61
|
+
<InputHelperText
|
|
62
|
+
label={helperText}
|
|
63
|
+
styleHelper={stateStyle().helperStyle}
|
|
64
|
+
/>
|
|
65
|
+
</View>
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export default Input;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ColorValue,
|
|
3
|
+
GestureResponderEvent,
|
|
4
|
+
ImageSourcePropType,
|
|
5
|
+
NativeSyntheticEvent,
|
|
6
|
+
TextInputFocusEventData,
|
|
7
|
+
TextStyle,
|
|
8
|
+
ViewStyle,
|
|
9
|
+
} from 'react-native';
|
|
10
|
+
|
|
11
|
+
export type InputFieldType = 'textInput' | 'text';
|
|
12
|
+
|
|
13
|
+
export type InputTypeStyle =
|
|
14
|
+
| 'default'
|
|
15
|
+
| 'destructive'
|
|
16
|
+
| 'disabled'
|
|
17
|
+
| 'onlyRead';
|
|
18
|
+
|
|
19
|
+
export type InputFieldVariants =
|
|
20
|
+
| 'onlyRead'
|
|
21
|
+
| 'picker'
|
|
22
|
+
| 'textInput'
|
|
23
|
+
| 'textPressable'
|
|
24
|
+
| 'searchTextInput'
|
|
25
|
+
| 'searchPressable';
|
|
26
|
+
|
|
27
|
+
export type InputFieldConfigType = {
|
|
28
|
+
type: InputFieldType;
|
|
29
|
+
image?: ImageType;
|
|
30
|
+
width?: string | number;
|
|
31
|
+
height?: string | number;
|
|
32
|
+
disabledField?: boolean;
|
|
33
|
+
disabledSubmit?: boolean;
|
|
34
|
+
backgroundColor?: ColorValue;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type InputVariantsType = Record<
|
|
38
|
+
InputFieldVariants,
|
|
39
|
+
{field: InputFieldConfigType}
|
|
40
|
+
>
|
|
41
|
+
|
|
42
|
+
export type ImageType = {
|
|
43
|
+
imgRoute?: ImageSourcePropType;
|
|
44
|
+
imgWidth?: string | number;
|
|
45
|
+
imgHeight?: string | number;
|
|
46
|
+
imgMarginRight?: string | number;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type TypeInputStyleVariant = Record<
|
|
50
|
+
InputTypeStyle,
|
|
51
|
+
{
|
|
52
|
+
fieldStyle: {
|
|
53
|
+
field: ViewStyle | ViewStyle[];
|
|
54
|
+
focus: ViewStyle | ViewStyle[];
|
|
55
|
+
textDefault: TextStyle | TextStyle[];
|
|
56
|
+
textPlaceholder: TextStyle | TextStyle[];
|
|
57
|
+
};
|
|
58
|
+
titleStyle: TextStyle | TextStyle[];
|
|
59
|
+
helperStyle: TextStyle | TextStyle[];
|
|
60
|
+
}
|
|
61
|
+
>
|
|
62
|
+
|
|
63
|
+
export interface InputProps {
|
|
64
|
+
titleLabel?: string;
|
|
65
|
+
titleImage?: ImageType;
|
|
66
|
+
value: string;
|
|
67
|
+
helperText?: string;
|
|
68
|
+
placeholder?: string;
|
|
69
|
+
disabled?: boolean;
|
|
70
|
+
isError?: boolean;
|
|
71
|
+
maxLength?: number;
|
|
72
|
+
numberOfLines?: number;
|
|
73
|
+
typeField: InputFieldVariants;
|
|
74
|
+
onPress?: (event: GestureResponderEvent) => void;
|
|
75
|
+
onSubmit?: (event: GestureResponderEvent) => void;
|
|
76
|
+
onChangeText?: (text: string) => void;
|
|
77
|
+
onFocus?: (event: NativeSyntheticEvent<TextInputFocusEventData>) => void;
|
|
78
|
+
onBlur?: (event: NativeSyntheticEvent<TextInputFocusEventData>) => void;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface InputTitleProps {
|
|
82
|
+
title?: string;
|
|
83
|
+
image?: ImageType;
|
|
84
|
+
styleTitle: TextStyle | TextStyle[];
|
|
85
|
+
disabled?: boolean;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface InputHelperProps {
|
|
89
|
+
styleHelper: TextStyle | TextStyle[];
|
|
90
|
+
label?: string;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface InputFieldProps {
|
|
94
|
+
disabled?: boolean;
|
|
95
|
+
value?: string;
|
|
96
|
+
placeholder?: string;
|
|
97
|
+
configField: InputFieldConfigType;
|
|
98
|
+
styleField: {
|
|
99
|
+
field: ViewStyle | ViewStyle[];
|
|
100
|
+
focus: ViewStyle | ViewStyle[];
|
|
101
|
+
textDefault: TextStyle| TextStyle[];
|
|
102
|
+
textPlaceholder: TextStyle| TextStyle[];
|
|
103
|
+
};
|
|
104
|
+
maxLength?: number;
|
|
105
|
+
numberOfLines?: number;
|
|
106
|
+
onPress?: (event: GestureResponderEvent) => void;
|
|
107
|
+
onSubmit?: (event: GestureResponderEvent) => void;
|
|
108
|
+
onChangeText?: (text: string) => void;
|
|
109
|
+
onFocus: (event: NativeSyntheticEvent<TextInputFocusEventData>) => void;
|
|
110
|
+
onBlur: (event: NativeSyntheticEvent<TextInputFocusEventData>) => void;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface InputHelperProps {
|
|
114
|
+
styleHelper: TextStyle | TextStyle[];
|
|
115
|
+
label?: string;
|
|
116
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Running Test for Input Check Input Error 1`] = `
|
|
4
|
+
<View
|
|
5
|
+
style={
|
|
6
|
+
Object {
|
|
7
|
+
"flex": 1,
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
>
|
|
11
|
+
<View
|
|
12
|
+
style={
|
|
13
|
+
Object {
|
|
14
|
+
"alignItems": "center",
|
|
15
|
+
"flexDirection": "row",
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
>
|
|
19
|
+
<Text
|
|
20
|
+
style={
|
|
21
|
+
Object {
|
|
22
|
+
"color": "#202452",
|
|
23
|
+
"fontSize": 14,
|
|
24
|
+
"marginBottom": 5,
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
>
|
|
28
|
+
Test
|
|
29
|
+
</Text>
|
|
30
|
+
</View>
|
|
31
|
+
<View
|
|
32
|
+
accessibilityState={
|
|
33
|
+
Object {
|
|
34
|
+
"disabled": true,
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
accessible={true}
|
|
38
|
+
collapsable={false}
|
|
39
|
+
focusable={true}
|
|
40
|
+
onClick={[Function]}
|
|
41
|
+
onResponderGrant={[Function]}
|
|
42
|
+
onResponderMove={[Function]}
|
|
43
|
+
onResponderRelease={[Function]}
|
|
44
|
+
onResponderTerminate={[Function]}
|
|
45
|
+
onResponderTerminationRequest={[Function]}
|
|
46
|
+
onStartShouldSetResponder={[Function]}
|
|
47
|
+
style={
|
|
48
|
+
Object {
|
|
49
|
+
"alignItems": "center",
|
|
50
|
+
"backgroundColor": "#FFFFFF",
|
|
51
|
+
"borderColor": "#F36A62",
|
|
52
|
+
"borderRadius": 3,
|
|
53
|
+
"borderWidth": 1,
|
|
54
|
+
"flexDirection": "row",
|
|
55
|
+
"height": 26,
|
|
56
|
+
"opacity": 1,
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
>
|
|
60
|
+
<TextInput
|
|
61
|
+
editable={true}
|
|
62
|
+
focusable={true}
|
|
63
|
+
multiline={true}
|
|
64
|
+
onBlur={[Function]}
|
|
65
|
+
onChangeText={[Function]}
|
|
66
|
+
onFocus={[Function]}
|
|
67
|
+
placeholder="Write a password"
|
|
68
|
+
style={
|
|
69
|
+
Array [
|
|
70
|
+
Array [
|
|
71
|
+
Object {
|
|
72
|
+
"color": "#202452",
|
|
73
|
+
"flex": 1,
|
|
74
|
+
"fontSize": 14,
|
|
75
|
+
"fontWeight": "500",
|
|
76
|
+
"paddingLeft": 7,
|
|
77
|
+
"paddingVertical": 5,
|
|
78
|
+
},
|
|
79
|
+
Object {
|
|
80
|
+
"height": 26,
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
value="Render Test"
|
|
86
|
+
/>
|
|
87
|
+
</View>
|
|
88
|
+
<View
|
|
89
|
+
style={
|
|
90
|
+
Object {
|
|
91
|
+
"alignItems": "center",
|
|
92
|
+
"flexDirection": "row",
|
|
93
|
+
"marginTop": 5,
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
>
|
|
97
|
+
<Text
|
|
98
|
+
style={
|
|
99
|
+
Array [
|
|
100
|
+
Object {
|
|
101
|
+
"color": "#808080",
|
|
102
|
+
"fontSize": 14,
|
|
103
|
+
},
|
|
104
|
+
Object {
|
|
105
|
+
"color": "#F36A62",
|
|
106
|
+
},
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
>
|
|
110
|
+
Only characters
|
|
111
|
+
</Text>
|
|
112
|
+
</View>
|
|
113
|
+
</View>
|
|
114
|
+
`;
|