@momo-kits/foundation 0.81.49 → 0.81.51-beta.0
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 +278 -0
- package/Application/{BottomTab.tsx → BottomTab/index.tsx} +42 -18
- package/Application/Components.tsx +356 -91
- package/Application/Localize.ts +44 -0
- package/Application/ModalScreen.tsx +14 -185
- package/Application/Navigation.ts +5 -19
- package/Application/NavigationContainer.tsx +62 -72
- package/Application/Navigator.ts +154 -48
- package/Application/StackScreen.tsx +289 -32
- package/Application/constants.ts +9 -0
- package/Application/index.ts +13 -15
- package/Application/types.ts +81 -35
- package/Application/utils.tsx +76 -30
- package/Assets/icon_bank.json +1 -1
- package/Badge/Badge.tsx +1 -1
- package/Badge/BadgeDotAnimation.tsx +95 -0
- package/Badge/index.tsx +2 -1
- package/Badge/styles.ts +50 -6
- package/Button/index.tsx +44 -26
- package/CheckBox/index.tsx +37 -26
- package/CheckBox/types.ts +5 -3
- package/Consts/colors+spacing+radius.ts +14 -0
- package/Icon/index.tsx +9 -8
- package/Icon/types.ts +2 -2
- package/IconButton/index.tsx +24 -14
- package/Image/index.tsx +23 -8
- package/Image/types.ts +2 -0
- package/Input/Input.tsx +116 -26
- package/Input/InputDropDown.tsx +66 -51
- package/Input/InputMoney.tsx +106 -15
- package/Input/InputOTP.tsx +49 -26
- package/Input/InputSearch.tsx +252 -99
- package/Input/InputTextArea.tsx +26 -6
- package/Input/TextTyping.tsx +113 -0
- package/Input/common.tsx +48 -22
- package/Input/index.tsx +112 -77
- package/Input/styles.ts +48 -11
- package/Input/utils.ts +1 -1
- package/Layout/Card.tsx +4 -3
- package/Layout/FloatingButton.tsx +168 -0
- package/Layout/GridSystem.tsx +1 -1
- package/Layout/ItemList.tsx +3 -2
- package/Layout/Screen.tsx +242 -121
- package/Layout/Section.tsx +4 -3
- package/Layout/styles.ts +11 -13
- package/Layout/types.ts +1 -1
- package/Layout/utils.ts +4 -4
- package/Loader/index.tsx +2 -0
- package/Pagination/PaginationScroll.tsx +2 -2
- package/Pagination/styles.ts +1 -1
- package/Popup/PopupNotify.tsx +57 -46
- package/Popup/PopupPromotion.tsx +6 -8
- package/Popup/types.ts +1 -7
- package/Radio/index.tsx +35 -20
- package/Radio/types.ts +5 -3
- package/Switch/index.tsx +32 -18
- package/Switch/types.ts +5 -3
- package/Tag/index.tsx +9 -2
- package/Tag/styles.ts +3 -2
- package/Tag/types.ts +12 -0
- package/Text/index.tsx +24 -5
- package/Text/styles.ts +8 -8
- package/Text/types.ts +19 -1
- package/Title/index.tsx +170 -103
- package/Title/styles.ts +36 -9
- package/Title/types.ts +16 -48
- package/code-scanner.js +125 -16
- package/index.ts +7 -0
- package/migrate_typo.js +56 -0
- package/package.json +10 -9
- 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,11 +1,16 @@
|
|
|
1
|
-
import {View, ViewStyle} from 'react-native';
|
|
2
|
-
import styles from './styles';
|
|
3
|
-
import {scaleSize, Text} from '../Text';
|
|
4
1
|
import React, {FC, useContext} from 'react';
|
|
2
|
+
import {
|
|
3
|
+
GestureResponderEvent,
|
|
4
|
+
TouchableOpacity,
|
|
5
|
+
View,
|
|
6
|
+
ViewStyle,
|
|
7
|
+
} from 'react-native';
|
|
5
8
|
import {ApplicationContext} from '../Application';
|
|
6
|
-
import {Icon} from '../Icon';
|
|
7
|
-
import {Styles} from '../Consts';
|
|
8
9
|
import {Theme} from '../Application/types';
|
|
10
|
+
import {Styles} from '../Consts';
|
|
11
|
+
import {Icon} from '../Icon';
|
|
12
|
+
import {scaleSize, Text} from '../Text';
|
|
13
|
+
import styles from './styles';
|
|
9
14
|
|
|
10
15
|
type FloatingViewProps = {
|
|
11
16
|
floatingValue?: string;
|
|
@@ -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,30 +48,47 @@ 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
|
}
|
|
49
66
|
return styles.container;
|
|
50
67
|
};
|
|
51
|
-
export const ErrorView: FC<{
|
|
52
|
-
errorMessage
|
|
53
|
-
errorSpacing
|
|
54
|
-
|
|
68
|
+
export const ErrorView: FC<{
|
|
69
|
+
errorMessage?: string;
|
|
70
|
+
errorSpacing?: boolean;
|
|
71
|
+
hintText?: string;
|
|
72
|
+
}> = ({errorMessage, errorSpacing, hintText}) => {
|
|
55
73
|
const {theme} = useContext(ApplicationContext);
|
|
56
74
|
const errorColor = theme.colors.error.primary;
|
|
57
|
-
|
|
75
|
+
const hintColor = theme.colors.text.hint;
|
|
76
|
+
const hintTextDefault = hintText ?? 'Không thể chỉnh sửa';
|
|
77
|
+
if (errorMessage || hintText) {
|
|
58
78
|
return (
|
|
59
79
|
<View style={styles.errorView}>
|
|
60
80
|
<View style={styles.errorIcon}>
|
|
61
|
-
<Icon
|
|
81
|
+
<Icon
|
|
82
|
+
color={errorMessage ? errorColor : hintColor}
|
|
83
|
+
source="ic_error"
|
|
84
|
+
size={16}
|
|
85
|
+
/>
|
|
62
86
|
</View>
|
|
63
87
|
<Text
|
|
64
88
|
style={Styles.flex}
|
|
65
|
-
color={errorColor}
|
|
66
|
-
numberOfLines={2}
|
|
89
|
+
color={errorMessage ? errorColor : hintColor}
|
|
67
90
|
typography={'description_default_regular'}>
|
|
68
|
-
{errorMessage}
|
|
91
|
+
{errorMessage ?? hintTextDefault}
|
|
69
92
|
</Text>
|
|
70
93
|
</View>
|
|
71
94
|
);
|
|
@@ -83,6 +106,7 @@ export const FloatingView: FC<FloatingViewProps> = ({
|
|
|
83
106
|
floatingIcon,
|
|
84
107
|
required,
|
|
85
108
|
style,
|
|
109
|
+
onPress,
|
|
86
110
|
}) => {
|
|
87
111
|
const {theme} = useContext(ApplicationContext);
|
|
88
112
|
|
|
@@ -115,12 +139,14 @@ export const FloatingView: FC<FloatingViewProps> = ({
|
|
|
115
139
|
)}
|
|
116
140
|
</Text>
|
|
117
141
|
{!!floatingIcon && (
|
|
118
|
-
<
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
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>
|
|
124
150
|
)}
|
|
125
151
|
</View>
|
|
126
152
|
);
|
package/Input/index.tsx
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import {GestureResponderEvent, TextInputProps, ViewStyle} from 'react-native';
|
|
1
2
|
import Input from './Input';
|
|
2
|
-
import
|
|
3
|
-
import InputSearch from './InputSearch';
|
|
3
|
+
import InputDropDown from './InputDropDown';
|
|
4
4
|
import InputMoney from './InputMoney';
|
|
5
5
|
import InputOTP from './InputOTP';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import InputSearch from './InputSearch';
|
|
7
|
+
import InputTextArea from './InputTextArea';
|
|
8
|
+
|
|
9
|
+
export type OTPInputLength = 2 | 4 | 6 | 8 | 10;
|
|
8
10
|
|
|
9
11
|
export interface InputProps extends TextInputProps {
|
|
10
12
|
/**
|
|
@@ -28,15 +30,38 @@ export interface InputProps extends TextInputProps {
|
|
|
28
30
|
errorMessage?: string;
|
|
29
31
|
|
|
30
32
|
/**
|
|
33
|
+
* @deprecated Use `trailing` instead.
|
|
31
34
|
* Optional. Represents the name or key of the icon to be displayed in the Input component.
|
|
32
35
|
*/
|
|
33
36
|
icon?: string;
|
|
34
37
|
|
|
35
38
|
/**
|
|
39
|
+
* @deprecated Use `trailingColor` instead.
|
|
36
40
|
* Optional. Represents the color of the icon in the Input component.
|
|
37
41
|
*/
|
|
38
42
|
iconColor?: string;
|
|
39
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
|
+
|
|
40
65
|
/**
|
|
41
66
|
* Optional. If `true`, the user won't be able to interact with the Input component.
|
|
42
67
|
* Defaults to `false` if not provided.
|
|
@@ -77,19 +102,25 @@ export interface InputProps extends TextInputProps {
|
|
|
77
102
|
*/
|
|
78
103
|
leadingIconColor?: string;
|
|
79
104
|
|
|
105
|
+
/**
|
|
106
|
+
* Optional. Represents the font weight of the text in the Input component.
|
|
107
|
+
*/
|
|
80
108
|
fontWeight?: 'Regular' | 'Bold';
|
|
81
109
|
|
|
82
|
-
|
|
83
|
-
|
|
110
|
+
/**
|
|
111
|
+
* Optional. params for element tracking.
|
|
112
|
+
*/
|
|
113
|
+
params?: any;
|
|
84
114
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
115
|
+
/**
|
|
116
|
+
* Optional. Represents text below the Input component.
|
|
117
|
+
*/
|
|
118
|
+
hintText?: string;
|
|
89
119
|
|
|
90
|
-
|
|
120
|
+
onPressFloatingIcon?: (e: GestureResponderEvent) => void;
|
|
121
|
+
}
|
|
91
122
|
|
|
92
|
-
export interface InputTextAreaProps extends
|
|
123
|
+
export interface InputTextAreaProps extends Omit<InputProps, 'size'> {
|
|
93
124
|
/**
|
|
94
125
|
* Optional. Defines the height of the InputTextArea component.
|
|
95
126
|
* It can be used to set a specific height for the text area.
|
|
@@ -109,26 +140,70 @@ export interface InputSearchProps extends TextInputProps {
|
|
|
109
140
|
*/
|
|
110
141
|
showButtonText?: boolean;
|
|
111
142
|
|
|
143
|
+
/**
|
|
144
|
+
* Optional. Represents the value for the floating title in the InputSearch component.
|
|
145
|
+
*/
|
|
112
146
|
onPressButtonText?: () => void;
|
|
113
147
|
|
|
114
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.
|
|
115
156
|
* Optional. Represents the color of the icon in the Input component.
|
|
116
157
|
*/
|
|
117
158
|
iconColor?: string;
|
|
118
159
|
|
|
160
|
+
/**
|
|
161
|
+
* @deprecated Use `onPressTrailing` instead.
|
|
162
|
+
* Optional. callback function to be called when the icon is pressed.
|
|
163
|
+
*/
|
|
164
|
+
onPressIcon?: () => void;
|
|
165
|
+
|
|
119
166
|
/**
|
|
120
167
|
* Optional. Represents the name or key of the icon to be displayed in the Input component.
|
|
121
168
|
*/
|
|
122
|
-
|
|
169
|
+
trailing?: string;
|
|
123
170
|
|
|
124
|
-
|
|
125
|
-
|
|
171
|
+
/**
|
|
172
|
+
* Optional. Represents the color of the icon in the Input component.
|
|
173
|
+
*/
|
|
174
|
+
trailingColor?: string;
|
|
126
175
|
|
|
127
|
-
|
|
176
|
+
/**
|
|
177
|
+
* Optional. callback function to be called when the icon is pressed.
|
|
178
|
+
*/
|
|
179
|
+
onPressTrailing?: () => void;
|
|
128
180
|
|
|
129
|
-
|
|
181
|
+
/**
|
|
182
|
+
* Optional. If `true`, the user won't be able to interact with the Input component.
|
|
183
|
+
*/
|
|
184
|
+
hasColorBG?: boolean;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Optional. Represents the style of the InputSearch component.
|
|
188
|
+
*/
|
|
189
|
+
params?: any;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Optional. Represents the data for typing animation.
|
|
193
|
+
*/
|
|
194
|
+
typingData?: string[];
|
|
195
|
+
|
|
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
|
+
}
|
|
130
202
|
|
|
131
|
-
export interface
|
|
203
|
+
export interface InputMoneyProps extends Omit<InputProps, 'placeholder'> {}
|
|
204
|
+
|
|
205
|
+
export interface InputOTPProps
|
|
206
|
+
extends Omit<InputProps, 'size' | 'icon' | 'iconColor'> {
|
|
132
207
|
/**
|
|
133
208
|
* Optional. Defines the length of the OTP (One Time Password) input.
|
|
134
209
|
* Can be 2, 4, 6, 8, or 10.
|
|
@@ -141,6 +216,8 @@ export interface InputOTPProps extends InputPropsWithoutSizeAndIcon {
|
|
|
141
216
|
* 'number' - The OTP input will be treated as a number.
|
|
142
217
|
*/
|
|
143
218
|
dataType?: 'string' | 'number';
|
|
219
|
+
|
|
220
|
+
floatingValue: string;
|
|
144
221
|
}
|
|
145
222
|
|
|
146
223
|
export type CaretProps = {
|
|
@@ -157,7 +234,8 @@ export type CaretProps = {
|
|
|
157
234
|
length?: number;
|
|
158
235
|
};
|
|
159
236
|
|
|
160
|
-
export interface InputDropDownProps
|
|
237
|
+
export interface InputDropDownProps
|
|
238
|
+
extends Omit<InputProps, 'trailing' | 'trailingColor' | 'onPressTrailing'> {
|
|
161
239
|
/**
|
|
162
240
|
* Optional. Defines the size of the InputDropDown component.
|
|
163
241
|
* 'small' - A smaller, less prominent input.
|
|
@@ -165,57 +243,17 @@ export interface InputDropDownProps {
|
|
|
165
243
|
*/
|
|
166
244
|
size?: 'small' | 'large';
|
|
167
245
|
|
|
168
|
-
/**
|
|
169
|
-
* Optional. The current value of the InputDropDown.
|
|
170
|
-
*/
|
|
171
|
-
value?: string;
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Optional. Text that is displayed when there is no value set in the InputDropDown.
|
|
175
|
-
*/
|
|
176
|
-
placeholder?: string;
|
|
177
|
-
|
|
178
246
|
/**
|
|
179
247
|
* Optional. Function to be called when the InputDropDown is pressed.
|
|
180
248
|
*/
|
|
181
249
|
onPress?: () => void;
|
|
182
250
|
|
|
183
|
-
/**
|
|
184
|
-
* Optional. Represents the value for the floating title in the InputDropDown component.
|
|
185
|
-
*/
|
|
186
|
-
floatingValue?: string;
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Optional. Represents the name or key of the floating icon to be displayed in the InputDropDown component.
|
|
190
|
-
*/
|
|
191
|
-
floatingIcon?: string;
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Optional. Represents the error message to be displayed below the InputDropDown component when there is an error.
|
|
195
|
-
*/
|
|
196
|
-
errorMessage?: string;
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Optional. Represents the name or key of the icon to be displayed in the InputDropDown component.
|
|
200
|
-
*/
|
|
201
|
-
icon?: string;
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Optional. Represents the color of the icon in the InputDropDown component.
|
|
205
|
-
*/
|
|
206
|
-
iconColor?: string;
|
|
207
|
-
|
|
208
251
|
/**
|
|
209
252
|
* Optional. If `true`, the user won't be able to interact with the InputDropDown component.
|
|
210
253
|
* Defaults to `false` if not provided.
|
|
211
254
|
*/
|
|
212
255
|
disabled?: boolean;
|
|
213
256
|
|
|
214
|
-
/**
|
|
215
|
-
* Optional. Represents the color of the floating icon in the InputDropDown component.
|
|
216
|
-
*/
|
|
217
|
-
floatingIconColor?: string;
|
|
218
|
-
|
|
219
257
|
/**
|
|
220
258
|
* Optional. If `true`, the InputDropDown component is marked as required,
|
|
221
259
|
* indicating that the user must provide a value before submitting a form.
|
|
@@ -224,28 +262,25 @@ export interface InputDropDownProps {
|
|
|
224
262
|
required?: boolean;
|
|
225
263
|
|
|
226
264
|
/**
|
|
227
|
-
* Optional.
|
|
228
|
-
* includes spacing when InputDropDown does not have an error message.
|
|
229
|
-
* Defaults to `false` if not provided.
|
|
265
|
+
* Optional. params for element tracking.
|
|
230
266
|
*/
|
|
231
|
-
|
|
267
|
+
params?: {
|
|
268
|
+
[key: string]: any;
|
|
269
|
+
};
|
|
232
270
|
|
|
233
271
|
/**
|
|
234
|
-
*
|
|
272
|
+
* Optional. Represents the style of the InputDropDown component.
|
|
235
273
|
*/
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
* Optional. Represents the leading icon in the InputDropDown component.
|
|
240
|
-
*/
|
|
241
|
-
leadingIcon?: string;
|
|
274
|
+
style?: ViewStyle | ViewStyle[];
|
|
242
275
|
|
|
243
|
-
|
|
244
|
-
* Optional. Represents the color of the leading icon in the InputDropDown component.
|
|
245
|
-
*/
|
|
246
|
-
leadingIconColor?: string;
|
|
247
|
-
|
|
248
|
-
style: ViewStyle | ViewStyle[];
|
|
276
|
+
multiline?: boolean;
|
|
249
277
|
}
|
|
250
278
|
|
|
251
|
-
export
|
|
279
|
+
export type InputRef = {
|
|
280
|
+
clear: () => void;
|
|
281
|
+
focus: () => void | undefined;
|
|
282
|
+
blur: () => void | undefined;
|
|
283
|
+
setText: (text: string) => void;
|
|
284
|
+
};
|
|
285
|
+
|
|
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({
|
|
@@ -7,7 +7,8 @@ export default StyleSheet.create({
|
|
|
7
7
|
input: {
|
|
8
8
|
flex: 1,
|
|
9
9
|
paddingLeft: Spacing.M,
|
|
10
|
-
fontSize: scaleSize(
|
|
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: {
|
|
@@ -53,7 +54,7 @@ export default StyleSheet.create({
|
|
|
53
54
|
marginRight: Spacing.M,
|
|
54
55
|
},
|
|
55
56
|
icon: {
|
|
56
|
-
marginLeft: Spacing.S
|
|
57
|
+
marginLeft: Spacing.S,
|
|
57
58
|
},
|
|
58
59
|
iconWrapper: {
|
|
59
60
|
width: 24,
|
|
@@ -75,7 +76,7 @@ export default StyleSheet.create({
|
|
|
75
76
|
flex: 1,
|
|
76
77
|
paddingRight: Spacing.XS,
|
|
77
78
|
paddingVertical: Spacing.XS,
|
|
78
|
-
fontSize: scaleSize(
|
|
79
|
+
fontSize: scaleSize(14),
|
|
79
80
|
},
|
|
80
81
|
textAreaWrapper: {
|
|
81
82
|
borderWidth: 1,
|
|
@@ -108,7 +109,7 @@ export default StyleSheet.create({
|
|
|
108
109
|
height: 36,
|
|
109
110
|
marginLeft: Spacing.S,
|
|
110
111
|
flex: 1,
|
|
111
|
-
fontSize: scaleSize(
|
|
112
|
+
fontSize: scaleSize(14),
|
|
112
113
|
paddingVertical: Spacing.XS,
|
|
113
114
|
},
|
|
114
115
|
searchInputView: {
|
|
@@ -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: -Spacing.
|
|
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,
|