@momo-kits/foundation 0.92.7-rc.21 → 0.92.7-rc.22
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/Application/BottomSheet.tsx +216 -0
- package/Application/BottomTab/BottomTabBar.tsx +62 -223
- package/Application/BottomTab/index.tsx +15 -11
- package/Application/Components.tsx +291 -45
- package/Application/Localize.ts +44 -0
- package/Application/ModalScreen.tsx +11 -181
- package/Application/Navigation.ts +4 -18
- package/Application/NavigationContainer.tsx +10 -28
- package/Application/Navigator.ts +14 -16
- package/Application/StackScreen.tsx +222 -42
- package/Application/index.ts +5 -3
- package/Application/types.ts +47 -29
- package/Application/utils.tsx +61 -19
- package/Assets/icon_bank.json +1 -1
- package/Badge/BadgeDotAnimation.tsx +95 -0
- package/Badge/index.tsx +2 -1
- package/Badge/styles.ts +50 -6
- package/Button/index.tsx +7 -8
- package/Icon/index.tsx +1 -1
- package/Icon/types.ts +1 -2
- package/Image/index.tsx +0 -1
- package/Input/Input.tsx +51 -17
- package/Input/InputDropDown.tsx +42 -45
- package/Input/InputMoney.tsx +65 -6
- package/Input/InputOTP.tsx +14 -13
- package/Input/InputSearch.tsx +259 -146
- package/Input/InputTextArea.tsx +0 -1
- package/Input/TextTyping.tsx +113 -0
- package/Input/common.tsx +29 -10
- package/Input/index.tsx +84 -89
- package/Input/styles.ts +44 -7
- package/Input/utils.ts +1 -1
- package/Layout/Card.tsx +4 -3
- package/Layout/FloatingButton.tsx +3 -3
- package/Layout/GridSystem.tsx +1 -1
- package/Layout/ItemList.tsx +3 -2
- package/Layout/Screen.tsx +188 -102
- package/Layout/Section.tsx +4 -3
- package/Layout/styles.ts +0 -6
- package/Layout/types.ts +1 -1
- package/Layout/utils.ts +2 -2
- package/Loader/index.tsx +2 -0
- package/Pagination/PaginationScroll.tsx +2 -2
- package/Pagination/styles.ts +1 -1
- package/Popup/PopupNotify.tsx +7 -7
- package/Popup/PopupPromotion.tsx +1 -1
- package/Popup/types.ts +1 -1
- package/Tag/index.tsx +9 -2
- package/Tag/styles.ts +3 -2
- package/Tag/types.ts +12 -0
- package/Title/index.tsx +20 -7
- package/Title/styles.ts +4 -4
- package/code-scanner.js +141 -124
- package/index.ts +7 -0
- package/package.json +5 -4
- package/publish.sh +16 -21
- package/tsconfig.json +1 -1
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import React, {FC, memo, useEffect, useRef} from 'react';
|
|
2
|
+
import {Platform, StyleSheet, TextInput, TextStyle} from 'react-native';
|
|
3
|
+
import {Colors} from '../Consts';
|
|
4
|
+
import {scaleSize} from '../Text';
|
|
5
|
+
|
|
6
|
+
export interface TextTypingProps {
|
|
7
|
+
data: string[];
|
|
8
|
+
timeDelayEnd?: number;
|
|
9
|
+
timeDelayNextChar?: number;
|
|
10
|
+
inputStyle?: TextStyle;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const TextTyping: FC<TextTypingProps> = ({
|
|
14
|
+
data = [],
|
|
15
|
+
timeDelayEnd = 2000,
|
|
16
|
+
timeDelayNextChar = 20,
|
|
17
|
+
inputStyle = {},
|
|
18
|
+
}) => {
|
|
19
|
+
const textRef = useRef<TextInput>(null);
|
|
20
|
+
|
|
21
|
+
const currentIndex = useRef<number>(0);
|
|
22
|
+
const currentCharIndex = useRef<number>(0);
|
|
23
|
+
const currentText = useRef('');
|
|
24
|
+
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
setTimeout(() => {
|
|
27
|
+
playAnimation();
|
|
28
|
+
}, 1000);
|
|
29
|
+
}, []);
|
|
30
|
+
|
|
31
|
+
const playAnimation = () => {
|
|
32
|
+
const handleResetList = () => {
|
|
33
|
+
currentIndex.current = 0;
|
|
34
|
+
handleAnimation();
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const handleAnimation = () => {
|
|
38
|
+
const listChar = data?.[currentIndex.current]?.split('') || [];
|
|
39
|
+
listChar.length !== 0 && showChar(listChar?.[currentCharIndex.current]);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
currentIndex.current >= data?.length
|
|
43
|
+
? handleResetList()
|
|
44
|
+
: handleAnimation();
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const showChar = (char?: string) => {
|
|
48
|
+
const handleResetString = () => {
|
|
49
|
+
setTimeout(() => {
|
|
50
|
+
reset();
|
|
51
|
+
}, timeDelayEnd);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const handleShowChar = () => {
|
|
55
|
+
setTimeout(() => {
|
|
56
|
+
textRef.current?.setNativeProps?.({
|
|
57
|
+
text: currentText.current + char,
|
|
58
|
+
});
|
|
59
|
+
currentText.current += char;
|
|
60
|
+
currentCharIndex.current++;
|
|
61
|
+
playAnimation();
|
|
62
|
+
}, timeDelayNextChar);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
currentCharIndex.current >= (data?.[currentIndex.current]?.length || 0)
|
|
66
|
+
? handleResetString()
|
|
67
|
+
: handleShowChar();
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const reset = () => {
|
|
71
|
+
const handleNextString = () => {
|
|
72
|
+
currentIndex.current++;
|
|
73
|
+
playAnimation();
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const handleReset = () => {
|
|
77
|
+
setTimeout(() => {
|
|
78
|
+
textRef.current?.setNativeProps?.({
|
|
79
|
+
text: currentText.current.slice(0, -1),
|
|
80
|
+
});
|
|
81
|
+
currentText.current = currentText.current.slice(0, -1);
|
|
82
|
+
currentCharIndex.current--;
|
|
83
|
+
reset();
|
|
84
|
+
}, timeDelayNextChar);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
currentCharIndex.current <= 0 ? handleNextString() : handleReset();
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<TextInput
|
|
92
|
+
style={[styles.inputStyle, inputStyle]}
|
|
93
|
+
ref={textRef}
|
|
94
|
+
editable={false}
|
|
95
|
+
autoCorrect={false}
|
|
96
|
+
pointerEvents={'none'}
|
|
97
|
+
numberOfLines={1}
|
|
98
|
+
/>
|
|
99
|
+
);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export default memo(TextTyping);
|
|
103
|
+
|
|
104
|
+
const styles = StyleSheet.create({
|
|
105
|
+
inputStyle: {
|
|
106
|
+
color: Colors.black_12,
|
|
107
|
+
fontSize: scaleSize(12),
|
|
108
|
+
height: Platform.select({
|
|
109
|
+
android: 60,
|
|
110
|
+
ios: 36,
|
|
111
|
+
}),
|
|
112
|
+
},
|
|
113
|
+
});
|
package/Input/common.tsx
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import React, {FC, useContext} from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
GestureResponderEvent,
|
|
4
|
+
TouchableOpacity,
|
|
5
|
+
View,
|
|
6
|
+
ViewStyle,
|
|
7
|
+
} from 'react-native';
|
|
3
8
|
import {ApplicationContext} from '../Application';
|
|
4
9
|
import {Theme} from '../Application/types';
|
|
5
10
|
import {Styles} from '../Consts';
|
|
@@ -14,6 +19,7 @@ type FloatingViewProps = {
|
|
|
14
19
|
floatingIcon?: string;
|
|
15
20
|
required?: boolean;
|
|
16
21
|
style?: ViewStyle;
|
|
22
|
+
onPress?: (e: GestureResponderEvent) => void;
|
|
17
23
|
};
|
|
18
24
|
|
|
19
25
|
export const DEFAULT_HEIGHT = scaleSize(104);
|
|
@@ -23,7 +29,7 @@ export const getBorderColor = (
|
|
|
23
29
|
theme: Theme,
|
|
24
30
|
focused: boolean,
|
|
25
31
|
errorMessage?: string,
|
|
26
|
-
disabled?: boolean
|
|
32
|
+
disabled?: boolean
|
|
27
33
|
) => {
|
|
28
34
|
let borderColor = theme.colors.border.default;
|
|
29
35
|
|
|
@@ -42,7 +48,18 @@ export const getBorderColor = (
|
|
|
42
48
|
return {borderColor};
|
|
43
49
|
};
|
|
44
50
|
|
|
45
|
-
export const getSizeStyle = (
|
|
51
|
+
export const getSizeStyle = (
|
|
52
|
+
size?: 'small' | 'large',
|
|
53
|
+
multiline: boolean = false
|
|
54
|
+
) => {
|
|
55
|
+
if (multiline)
|
|
56
|
+
return [
|
|
57
|
+
styles.multilineContainer,
|
|
58
|
+
{
|
|
59
|
+
minHeight: size === 'small' ? 48 : 56,
|
|
60
|
+
},
|
|
61
|
+
];
|
|
62
|
+
|
|
46
63
|
if (size === 'small') {
|
|
47
64
|
return styles.smallContainer;
|
|
48
65
|
}
|
|
@@ -70,7 +87,6 @@ export const ErrorView: FC<{
|
|
|
70
87
|
<Text
|
|
71
88
|
style={Styles.flex}
|
|
72
89
|
color={errorMessage ? errorColor : hintColor}
|
|
73
|
-
numberOfLines={2}
|
|
74
90
|
typography={'description_default_regular'}>
|
|
75
91
|
{errorMessage ?? hintTextDefault}
|
|
76
92
|
</Text>
|
|
@@ -90,6 +106,7 @@ export const FloatingView: FC<FloatingViewProps> = ({
|
|
|
90
106
|
floatingIcon,
|
|
91
107
|
required,
|
|
92
108
|
style,
|
|
109
|
+
onPress,
|
|
93
110
|
}) => {
|
|
94
111
|
const {theme} = useContext(ApplicationContext);
|
|
95
112
|
|
|
@@ -122,12 +139,14 @@ export const FloatingView: FC<FloatingViewProps> = ({
|
|
|
122
139
|
)}
|
|
123
140
|
</Text>
|
|
124
141
|
{!!floatingIcon && (
|
|
125
|
-
<
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
142
|
+
<TouchableOpacity activeOpacity={onPress ? 0.6 : 1} onPress={onPress}>
|
|
143
|
+
<Icon
|
|
144
|
+
color={floatingIconTintColor}
|
|
145
|
+
source={floatingIcon}
|
|
146
|
+
size={16}
|
|
147
|
+
style={styles.floatingIcon}
|
|
148
|
+
/>
|
|
149
|
+
</TouchableOpacity>
|
|
131
150
|
)}
|
|
132
151
|
</View>
|
|
133
152
|
);
|
package/Input/index.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {TextInputProps, ViewStyle} from 'react-native';
|
|
1
|
+
import {GestureResponderEvent, TextInputProps, ViewStyle} from 'react-native';
|
|
2
2
|
import Input from './Input';
|
|
3
3
|
import InputDropDown from './InputDropDown';
|
|
4
4
|
import InputMoney from './InputMoney';
|
|
@@ -6,12 +6,7 @@ import InputOTP from './InputOTP';
|
|
|
6
6
|
import InputSearch from './InputSearch';
|
|
7
7
|
import InputTextArea from './InputTextArea';
|
|
8
8
|
|
|
9
|
-
export
|
|
10
|
-
focus: () => void;
|
|
11
|
-
blur: () => void;
|
|
12
|
-
clear: () => void;
|
|
13
|
-
setText: (text: string) => void;
|
|
14
|
-
}
|
|
9
|
+
export type OTPInputLength = 2 | 4 | 6 | 8 | 10;
|
|
15
10
|
|
|
16
11
|
export interface InputProps extends TextInputProps {
|
|
17
12
|
/**
|
|
@@ -35,15 +30,38 @@ export interface InputProps extends TextInputProps {
|
|
|
35
30
|
errorMessage?: string;
|
|
36
31
|
|
|
37
32
|
/**
|
|
33
|
+
* @deprecated Use `trailing` instead.
|
|
38
34
|
* Optional. Represents the name or key of the icon to be displayed in the Input component.
|
|
39
35
|
*/
|
|
40
36
|
icon?: string;
|
|
41
37
|
|
|
42
38
|
/**
|
|
39
|
+
* @deprecated Use `trailingColor` instead.
|
|
43
40
|
* Optional. Represents the color of the icon in the Input component.
|
|
44
41
|
*/
|
|
45
42
|
iconColor?: string;
|
|
46
43
|
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated Use `onPressTrailing` instead.
|
|
46
|
+
* Optional. callback function to be called when the icon is pressed.
|
|
47
|
+
*/
|
|
48
|
+
onPressIcon?: () => void;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Optional. Represents the name or key of the icon to be displayed in the Input component.
|
|
52
|
+
*/
|
|
53
|
+
trailing?: string;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Optional. Represents the color of the icon in the Input component.
|
|
57
|
+
*/
|
|
58
|
+
trailingColor?: string;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Optional. callback function to be called when the icon is pressed.
|
|
62
|
+
*/
|
|
63
|
+
onPressTrailing?: () => void;
|
|
64
|
+
|
|
47
65
|
/**
|
|
48
66
|
* Optional. If `true`, the user won't be able to interact with the Input component.
|
|
49
67
|
* Defaults to `false` if not provided.
|
|
@@ -89,11 +107,6 @@ export interface InputProps extends TextInputProps {
|
|
|
89
107
|
*/
|
|
90
108
|
fontWeight?: 'Regular' | 'Bold';
|
|
91
109
|
|
|
92
|
-
/**
|
|
93
|
-
* Optional. callback function to be called when the icon is pressed.
|
|
94
|
-
*/
|
|
95
|
-
onPressIcon?: () => void;
|
|
96
|
-
|
|
97
110
|
/**
|
|
98
111
|
* Optional. params for element tracking.
|
|
99
112
|
*/
|
|
@@ -103,16 +116,11 @@ export interface InputProps extends TextInputProps {
|
|
|
103
116
|
* Optional. Represents text below the Input component.
|
|
104
117
|
*/
|
|
105
118
|
hintText?: string;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
type InputPropsWithoutSizeAndIcon = Omit<
|
|
109
|
-
InputProps,
|
|
110
|
-
'size' | 'icon' | 'iconColor'
|
|
111
|
-
>;
|
|
112
119
|
|
|
113
|
-
|
|
120
|
+
onPressFloatingIcon?: (e: GestureResponderEvent) => void;
|
|
121
|
+
}
|
|
114
122
|
|
|
115
|
-
export interface InputTextAreaProps extends
|
|
123
|
+
export interface InputTextAreaProps extends Omit<InputProps, 'size'> {
|
|
116
124
|
/**
|
|
117
125
|
* Optional. Defines the height of the InputTextArea component.
|
|
118
126
|
* It can be used to set a specific height for the text area.
|
|
@@ -132,31 +140,70 @@ export interface InputSearchProps extends TextInputProps {
|
|
|
132
140
|
*/
|
|
133
141
|
showButtonText?: boolean;
|
|
134
142
|
|
|
143
|
+
/**
|
|
144
|
+
* Optional. Represents the value for the floating title in the InputSearch component.
|
|
145
|
+
*/
|
|
135
146
|
onPressButtonText?: () => void;
|
|
136
147
|
|
|
137
148
|
/**
|
|
149
|
+
* @deprecated Use `trailing` instead.
|
|
150
|
+
* Optional. Represents the name or key of the icon to be displayed in the Input component.
|
|
151
|
+
*/
|
|
152
|
+
icon?: string;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* @deprecated Use `trailingColor` instead.
|
|
138
156
|
* Optional. Represents the color of the icon in the Input component.
|
|
139
157
|
*/
|
|
140
158
|
iconColor?: string;
|
|
141
159
|
|
|
160
|
+
/**
|
|
161
|
+
* @deprecated Use `onPressTrailing` instead.
|
|
162
|
+
* Optional. callback function to be called when the icon is pressed.
|
|
163
|
+
*/
|
|
164
|
+
onPressIcon?: () => void;
|
|
165
|
+
|
|
142
166
|
/**
|
|
143
167
|
* Optional. Represents the name or key of the icon to be displayed in the Input component.
|
|
144
168
|
*/
|
|
145
|
-
|
|
169
|
+
trailing?: string;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Optional. Represents the color of the icon in the Input component.
|
|
173
|
+
*/
|
|
174
|
+
trailingColor?: string;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Optional. callback function to be called when the icon is pressed.
|
|
178
|
+
*/
|
|
179
|
+
onPressTrailing?: () => void;
|
|
146
180
|
|
|
147
181
|
/**
|
|
148
|
-
*
|
|
182
|
+
* Optional. If `true`, the user won't be able to interact with the Input component.
|
|
149
183
|
*/
|
|
150
184
|
hasColorBG?: boolean;
|
|
151
185
|
|
|
186
|
+
/**
|
|
187
|
+
* Optional. Represents the style of the InputSearch component.
|
|
188
|
+
*/
|
|
152
189
|
params?: any;
|
|
153
|
-
}
|
|
154
190
|
|
|
155
|
-
|
|
191
|
+
/**
|
|
192
|
+
* Optional. Represents the data for typing animation.
|
|
193
|
+
*/
|
|
194
|
+
typingData?: string[];
|
|
156
195
|
|
|
157
|
-
|
|
196
|
+
/**
|
|
197
|
+
* Optional. Represents the callback function to be called when the search button is pressed.
|
|
198
|
+
* @param e
|
|
199
|
+
*/
|
|
200
|
+
onPress?: (e: GestureResponderEvent) => void;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export interface InputMoneyProps extends Omit<InputProps, 'placeholder'> {}
|
|
158
204
|
|
|
159
|
-
export interface InputOTPProps
|
|
205
|
+
export interface InputOTPProps
|
|
206
|
+
extends Omit<InputProps, 'size' | 'icon' | 'iconColor'> {
|
|
160
207
|
/**
|
|
161
208
|
* Optional. Defines the length of the OTP (One Time Password) input.
|
|
162
209
|
* Can be 2, 4, 6, 8, or 10.
|
|
@@ -187,7 +234,8 @@ export type CaretProps = {
|
|
|
187
234
|
length?: number;
|
|
188
235
|
};
|
|
189
236
|
|
|
190
|
-
export interface InputDropDownProps
|
|
237
|
+
export interface InputDropDownProps
|
|
238
|
+
extends Omit<InputProps, 'trailing' | 'trailingColor' | 'onPressTrailing'> {
|
|
191
239
|
/**
|
|
192
240
|
* Optional. Defines the size of the InputDropDown component.
|
|
193
241
|
* 'small' - A smaller, less prominent input.
|
|
@@ -195,57 +243,17 @@ export interface InputDropDownProps extends InputProps {
|
|
|
195
243
|
*/
|
|
196
244
|
size?: 'small' | 'large';
|
|
197
245
|
|
|
198
|
-
/**
|
|
199
|
-
* Optional. The current value of the InputDropDown.
|
|
200
|
-
*/
|
|
201
|
-
value?: string;
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Optional. Text that is displayed when there is no value set in the InputDropDown.
|
|
205
|
-
*/
|
|
206
|
-
placeholder?: string;
|
|
207
|
-
|
|
208
246
|
/**
|
|
209
247
|
* Optional. Function to be called when the InputDropDown is pressed.
|
|
210
248
|
*/
|
|
211
249
|
onPress?: () => void;
|
|
212
250
|
|
|
213
|
-
/**
|
|
214
|
-
* Optional. Represents the value for the floating title in the InputDropDown component.
|
|
215
|
-
*/
|
|
216
|
-
floatingValue?: string;
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Optional. Represents the name or key of the floating icon to be displayed in the InputDropDown component.
|
|
220
|
-
*/
|
|
221
|
-
floatingIcon?: string;
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* Optional. Represents the error message to be displayed below the InputDropDown component when there is an error.
|
|
225
|
-
*/
|
|
226
|
-
errorMessage?: string;
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* Optional. Represents the name or key of the icon to be displayed in the InputDropDown component.
|
|
230
|
-
*/
|
|
231
|
-
icon?: string;
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* Optional. Represents the color of the icon in the InputDropDown component.
|
|
235
|
-
*/
|
|
236
|
-
iconColor?: string;
|
|
237
|
-
|
|
238
251
|
/**
|
|
239
252
|
* Optional. If `true`, the user won't be able to interact with the InputDropDown component.
|
|
240
253
|
* Defaults to `false` if not provided.
|
|
241
254
|
*/
|
|
242
255
|
disabled?: boolean;
|
|
243
256
|
|
|
244
|
-
/**
|
|
245
|
-
* Optional. Represents the color of the floating icon in the InputDropDown component.
|
|
246
|
-
*/
|
|
247
|
-
floatingIconColor?: string;
|
|
248
|
-
|
|
249
257
|
/**
|
|
250
258
|
* Optional. If `true`, the InputDropDown component is marked as required,
|
|
251
259
|
* indicating that the user must provide a value before submitting a form.
|
|
@@ -253,28 +261,6 @@ export interface InputDropDownProps extends InputProps {
|
|
|
253
261
|
*/
|
|
254
262
|
required?: boolean;
|
|
255
263
|
|
|
256
|
-
/**
|
|
257
|
-
* Optional. If `true`,
|
|
258
|
-
* includes spacing when InputDropDown does not have an error message.
|
|
259
|
-
* Defaults to `false` if not provided.
|
|
260
|
-
*/
|
|
261
|
-
errorSpacing?: boolean;
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* If `true`, the icon of the input will show an indicator for loading.
|
|
265
|
-
*/
|
|
266
|
-
loading?: boolean;
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* Optional. Represents the leading icon in the InputDropDown component.
|
|
270
|
-
*/
|
|
271
|
-
leadingIcon?: string;
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
* Optional. Represents the color of the leading icon in the InputDropDown component.
|
|
275
|
-
*/
|
|
276
|
-
leadingIconColor?: string;
|
|
277
|
-
|
|
278
264
|
/**
|
|
279
265
|
* Optional. params for element tracking.
|
|
280
266
|
*/
|
|
@@ -286,6 +272,15 @@ export interface InputDropDownProps extends InputProps {
|
|
|
286
272
|
* Optional. Represents the style of the InputDropDown component.
|
|
287
273
|
*/
|
|
288
274
|
style?: ViewStyle | ViewStyle[];
|
|
275
|
+
|
|
276
|
+
multiline?: boolean;
|
|
289
277
|
}
|
|
290
278
|
|
|
279
|
+
export type InputRef = {
|
|
280
|
+
clear: () => void;
|
|
281
|
+
focus: () => void | undefined;
|
|
282
|
+
blur: () => void | undefined;
|
|
283
|
+
setText: (text: string) => void;
|
|
284
|
+
};
|
|
285
|
+
|
|
291
286
|
export {Input, InputDropDown, InputMoney, InputOTP, InputSearch, InputTextArea};
|
package/Input/styles.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {StyleSheet} from 'react-native';
|
|
2
|
-
import {Radius, Spacing} from '../Consts';
|
|
1
|
+
import {Platform, StyleSheet} from 'react-native';
|
|
2
|
+
import {Colors, Radius, Spacing} from '../Consts';
|
|
3
3
|
import {scaleSize} from '../Text';
|
|
4
4
|
|
|
5
5
|
export default StyleSheet.create({
|
|
@@ -8,6 +8,7 @@ export default StyleSheet.create({
|
|
|
8
8
|
flex: 1,
|
|
9
9
|
paddingLeft: Spacing.M,
|
|
10
10
|
fontSize: scaleSize(14),
|
|
11
|
+
height: '100%',
|
|
11
12
|
},
|
|
12
13
|
wrapper: {
|
|
13
14
|
width: '100%',
|
|
@@ -28,12 +29,12 @@ export default StyleSheet.create({
|
|
|
28
29
|
left: Spacing.S,
|
|
29
30
|
paddingHorizontal: Spacing.S,
|
|
30
31
|
flexDirection: 'row',
|
|
32
|
+
alignItems: 'center',
|
|
31
33
|
},
|
|
32
34
|
floatingIcon: {marginLeft: Spacing.XS},
|
|
33
|
-
errorIcon: {marginRight: Spacing.XS},
|
|
35
|
+
errorIcon: {marginRight: Spacing.XS, marginTop: Spacing.XXS},
|
|
34
36
|
errorView: {
|
|
35
37
|
flexDirection: 'row',
|
|
36
|
-
alignItems: 'center',
|
|
37
38
|
marginTop: Spacing.XS,
|
|
38
39
|
},
|
|
39
40
|
inputView: {
|
|
@@ -132,20 +133,27 @@ export default StyleSheet.create({
|
|
|
132
133
|
paddingVertical: Spacing.S,
|
|
133
134
|
fontWeight: 'bold',
|
|
134
135
|
},
|
|
135
|
-
|
|
136
|
+
inputStyle: {
|
|
137
|
+
color: Colors.black_12,
|
|
138
|
+
fontSize: scaleSize(12),
|
|
139
|
+
height: Platform.select({
|
|
140
|
+
android: 60,
|
|
141
|
+
ios: 36,
|
|
142
|
+
}),
|
|
143
|
+
},
|
|
136
144
|
//OTP
|
|
137
145
|
otpWrapper: {
|
|
138
146
|
width: '100%',
|
|
139
147
|
marginTop: Spacing.M,
|
|
140
148
|
},
|
|
141
149
|
otpInput: {
|
|
142
|
-
height:
|
|
150
|
+
height: 56,
|
|
143
151
|
borderRadius: Radius.S,
|
|
144
152
|
borderWidth: 1,
|
|
145
153
|
},
|
|
146
154
|
otpFloatingView: {
|
|
147
155
|
position: 'absolute',
|
|
148
|
-
top:
|
|
156
|
+
top: -Spacing.M + 2,
|
|
149
157
|
alignSelf: 'center',
|
|
150
158
|
paddingHorizontal: Spacing.S,
|
|
151
159
|
},
|
|
@@ -156,4 +164,33 @@ export default StyleSheet.create({
|
|
|
156
164
|
alignItems: 'center',
|
|
157
165
|
justifyContent: 'center',
|
|
158
166
|
},
|
|
167
|
+
|
|
168
|
+
//DropDown
|
|
169
|
+
inputDropDownWrapper: {
|
|
170
|
+
flexDirection: 'row',
|
|
171
|
+
marginTop: Spacing.S,
|
|
172
|
+
},
|
|
173
|
+
inputDropDownView: {
|
|
174
|
+
flex: 1,
|
|
175
|
+
flexDirection: 'row',
|
|
176
|
+
paddingLeft: Spacing.M,
|
|
177
|
+
},
|
|
178
|
+
iconViewDropDown: {
|
|
179
|
+
flexDirection: 'row',
|
|
180
|
+
marginRight: Spacing.M,
|
|
181
|
+
},
|
|
182
|
+
textViewDropDown: {
|
|
183
|
+
flex: 1,
|
|
184
|
+
marginVertical: Spacing.M,
|
|
185
|
+
marginRight: Spacing.S,
|
|
186
|
+
justifyContent: 'center',
|
|
187
|
+
},
|
|
188
|
+
multilineContainer: {
|
|
189
|
+
borderWidth: 1,
|
|
190
|
+
borderRadius: Radius.S,
|
|
191
|
+
},
|
|
192
|
+
leadingIconContainerDropDown: {
|
|
193
|
+
borderRadius: Radius.XS,
|
|
194
|
+
overflow: 'hidden',
|
|
195
|
+
},
|
|
159
196
|
});
|
package/Input/utils.ts
CHANGED
|
@@ -61,7 +61,7 @@ const formatMoneyToNumber = (money: string, currencyUnit: string) => {
|
|
|
61
61
|
};
|
|
62
62
|
const checkTyping = (text: string, value: boolean, setValue: any) => {
|
|
63
63
|
let typing = text?.length > 0;
|
|
64
|
-
if (typing
|
|
64
|
+
if (typing !== value) {
|
|
65
65
|
setValue(typing);
|
|
66
66
|
}
|
|
67
67
|
};
|
package/Layout/Card.tsx
CHANGED
|
@@ -86,7 +86,7 @@ const Card: React.FC<CardProps> = ({
|
|
|
86
86
|
{rows.map((i: React.ReactElement, index: number) => {
|
|
87
87
|
return (
|
|
88
88
|
<View key={`Item${cursor}${index}`} style={{flexDirection: 'row'}}>
|
|
89
|
-
{index
|
|
89
|
+
{index !== 0 && (
|
|
90
90
|
<View style={{width: gridContext.gutterSize}}></View>
|
|
91
91
|
)}
|
|
92
92
|
{i}
|
|
@@ -126,14 +126,14 @@ const Card: React.FC<CardProps> = ({
|
|
|
126
126
|
rows = [item];
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
if (i
|
|
129
|
+
if (i === arrayChild.length - 1) {
|
|
130
130
|
cursor += 1;
|
|
131
131
|
element.push(addRowView(rows, cursor, true));
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
} else {
|
|
135
135
|
element.push(children);
|
|
136
|
-
if (children?.type
|
|
136
|
+
if (children?.type === Fragment) {
|
|
137
137
|
return renderView(children?.props.children);
|
|
138
138
|
}
|
|
139
139
|
}
|
|
@@ -144,6 +144,7 @@ const Card: React.FC<CardProps> = ({
|
|
|
144
144
|
<GridContext.Provider value={gridContext}>
|
|
145
145
|
<View
|
|
146
146
|
{...props}
|
|
147
|
+
onLayout={undefined}
|
|
147
148
|
style={[
|
|
148
149
|
{backgroundColor: theme.colors.background.surface},
|
|
149
150
|
style,
|
|
@@ -34,7 +34,7 @@ export const FloatingButton: React.FC<FloatingButtonProps> = ({
|
|
|
34
34
|
}: FloatingButtonProps) => {
|
|
35
35
|
const {theme} = useContext(ApplicationContext);
|
|
36
36
|
const maxWidth = useRef(0);
|
|
37
|
-
const minWidth = size
|
|
37
|
+
const minWidth = size === 'small' ? 36 : 48;
|
|
38
38
|
const [opacityAnimated] = useState(new Animated.Value(0)); // Initial opacity set to 0
|
|
39
39
|
const [widthAnimated, setWidthAnimated] = useState<Animated.Value>();
|
|
40
40
|
const lastOffset = useRef(0);
|
|
@@ -84,7 +84,7 @@ export const FloatingButton: React.FC<FloatingButtonProps> = ({
|
|
|
84
84
|
});
|
|
85
85
|
|
|
86
86
|
return () => {
|
|
87
|
-
if (listener
|
|
87
|
+
if (listener) {
|
|
88
88
|
animatedValue?.removeListener(listener);
|
|
89
89
|
}
|
|
90
90
|
};
|
|
@@ -123,7 +123,7 @@ export const FloatingButton: React.FC<FloatingButtonProps> = ({
|
|
|
123
123
|
right: position === 'right' ? 12 : undefined,
|
|
124
124
|
alignSelf: position === 'center' ? 'center' : 'flex-end',
|
|
125
125
|
width: widthAnimated,
|
|
126
|
-
height: size
|
|
126
|
+
height: size === 'small' ? 36 : 48,
|
|
127
127
|
backgroundColor: theme.colors.primary,
|
|
128
128
|
bottom,
|
|
129
129
|
},
|
package/Layout/GridSystem.tsx
CHANGED
|
@@ -53,7 +53,7 @@ const GridSystem: React.FC<any> = ({
|
|
|
53
53
|
{list.map((_, index) => {
|
|
54
54
|
return (
|
|
55
55
|
<View style={{flexDirection: 'row'}} key={index.toString()}>
|
|
56
|
-
{index
|
|
56
|
+
{index !== 0 && <View style={{width: grid.gutterSize}} />}
|
|
57
57
|
<View
|
|
58
58
|
key={`Grid${index.toString()}`}
|
|
59
59
|
pointerEvents="none"
|
package/Layout/ItemList.tsx
CHANGED
|
@@ -20,7 +20,7 @@ const ItemList = forwardRef(
|
|
|
20
20
|
contentContainerStyle,
|
|
21
21
|
...props
|
|
22
22
|
}: ItemListProps,
|
|
23
|
-
ref
|
|
23
|
+
ref
|
|
24
24
|
) => {
|
|
25
25
|
const {gutterSize, numberOfColumns} = useContext(GridContext);
|
|
26
26
|
const widthItem = (widthSpan ?? numberOfColumns) as SpanNumber;
|
|
@@ -41,6 +41,7 @@ const ItemList = forwardRef(
|
|
|
41
41
|
<FlatList
|
|
42
42
|
ref={ref as React.RefObject<FlatList>}
|
|
43
43
|
{...props}
|
|
44
|
+
key={`ItemList-${numColumns}`}
|
|
44
45
|
numColumns={numColumns}
|
|
45
46
|
renderItem={_renderItem}
|
|
46
47
|
horizontal={false}
|
|
@@ -49,7 +50,7 @@ const ItemList = forwardRef(
|
|
|
49
50
|
contentContainerStyle={[contentContainerStyle, styles.protectedStyle]}
|
|
50
51
|
/>
|
|
51
52
|
);
|
|
52
|
-
}
|
|
53
|
+
}
|
|
53
54
|
);
|
|
54
55
|
|
|
55
56
|
export default ItemList;
|