@momo-kits/foundation 0.81.1-optimize.21 → 0.81.1-rc.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 +27 -23
- package/Application/BottomTab/BottomTabBar.tsx +2 -2
- package/Application/BottomTab/index.tsx +2 -3
- package/Application/Components.tsx +288 -42
- package/Application/Localize.ts +44 -0
- package/Application/ModalScreen.tsx +2 -2
- package/Application/Navigation.ts +4 -18
- package/Application/NavigationContainer.tsx +10 -21
- package/Application/Navigator.ts +14 -16
- package/Application/StackScreen.tsx +211 -113
- package/Application/index.ts +5 -3
- package/Application/types.ts +30 -11
- package/Application/utils.tsx +60 -18
- package/Badge/BadgeDotAnimation.tsx +95 -0
- package/Badge/index.tsx +2 -1
- package/Badge/styles.ts +50 -6
- package/Button/index.tsx +0 -1
- package/Icon/types.ts +0 -1
- package/Input/Input.tsx +51 -17
- package/Input/InputDropDown.tsx +44 -47
- package/Input/InputMoney.tsx +56 -6
- package/Input/InputOTP.tsx +10 -6
- package/Input/InputSearch.tsx +259 -146
- package/Input/TextTyping.tsx +113 -0
- package/Input/common.tsx +29 -10
- package/Input/index.tsx +75 -74
- package/Input/styles.ts +43 -7
- package/Layout/FloatingButton.tsx +1 -1
- package/Layout/GridSystem.tsx +1 -1
- package/Layout/ItemList.tsx +3 -2
- package/Layout/Screen.tsx +174 -91
- package/Layout/styles.ts +0 -6
- package/Layout/types.ts +1 -1
- package/Pagination/PaginationScroll.tsx +2 -2
- package/Pagination/styles.ts +1 -1
- package/Popup/PopupNotify.tsx +3 -3
- package/Tag/index.tsx +9 -2
- package/Tag/styles.ts +3 -2
- package/Tag/types.ts +12 -0
- package/Title/index.tsx +6 -9
- package/Title/styles.ts +4 -4
- package/code-scanner.js +4 -4
- package/package.json +6 -5
- package/publish.sh +12 -22
- package/verify.js +36 -42
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,6 +6,8 @@ import InputOTP from './InputOTP';
|
|
|
6
6
|
import InputSearch from './InputSearch';
|
|
7
7
|
import InputTextArea from './InputTextArea';
|
|
8
8
|
|
|
9
|
+
export type OTPInputLength = 2 | 4 | 6 | 8 | 10;
|
|
10
|
+
|
|
9
11
|
export interface InputProps extends TextInputProps {
|
|
10
12
|
/**
|
|
11
13
|
* Optional. Defines the size of the Input component.
|
|
@@ -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.
|
|
@@ -82,11 +107,6 @@ export interface InputProps extends TextInputProps {
|
|
|
82
107
|
*/
|
|
83
108
|
fontWeight?: 'Regular' | 'Bold';
|
|
84
109
|
|
|
85
|
-
/**
|
|
86
|
-
* Optional. callback function to be called when the icon is pressed.
|
|
87
|
-
*/
|
|
88
|
-
onPressIcon?: () => void;
|
|
89
|
-
|
|
90
110
|
/**
|
|
91
111
|
* Optional. params for element tracking.
|
|
92
112
|
*/
|
|
@@ -96,10 +116,11 @@ export interface InputProps extends TextInputProps {
|
|
|
96
116
|
* Optional. Represents text below the Input component.
|
|
97
117
|
*/
|
|
98
118
|
hintText?: string;
|
|
119
|
+
|
|
120
|
+
onPressFloatingIcon?: (e: GestureResponderEvent) => void;
|
|
99
121
|
}
|
|
100
122
|
|
|
101
|
-
export interface InputTextAreaProps
|
|
102
|
-
extends Omit<InputProps, 'size' | 'icon' | 'iconColor'> {
|
|
123
|
+
export interface InputTextAreaProps extends Omit<InputProps, 'size'> {
|
|
103
124
|
/**
|
|
104
125
|
* Optional. Defines the height of the InputTextArea component.
|
|
105
126
|
* It can be used to set a specific height for the text area.
|
|
@@ -125,14 +146,37 @@ export interface InputSearchProps extends TextInputProps {
|
|
|
125
146
|
onPressButtonText?: () => void;
|
|
126
147
|
|
|
127
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.
|
|
128
156
|
* Optional. Represents the color of the icon in the Input component.
|
|
129
157
|
*/
|
|
130
158
|
iconColor?: string;
|
|
131
159
|
|
|
160
|
+
/**
|
|
161
|
+
* @deprecated Use `onPressTrailing` instead.
|
|
162
|
+
* Optional. callback function to be called when the icon is pressed.
|
|
163
|
+
*/
|
|
164
|
+
onPressIcon?: () => void;
|
|
165
|
+
|
|
132
166
|
/**
|
|
133
167
|
* Optional. Represents the name or key of the icon to be displayed in the Input component.
|
|
134
168
|
*/
|
|
135
|
-
|
|
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;
|
|
136
180
|
|
|
137
181
|
/**
|
|
138
182
|
* Optional. If `true`, the user won't be able to interact with the Input component.
|
|
@@ -143,12 +187,21 @@ export interface InputSearchProps extends TextInputProps {
|
|
|
143
187
|
* Optional. Represents the style of the InputSearch component.
|
|
144
188
|
*/
|
|
145
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;
|
|
146
201
|
}
|
|
147
202
|
|
|
148
203
|
export interface InputMoneyProps extends Omit<InputProps, 'placeholder'> {}
|
|
149
204
|
|
|
150
|
-
export type OTPInputLength = 2 | 4 | 6 | 8 | 10;
|
|
151
|
-
|
|
152
205
|
export interface InputOTPProps
|
|
153
206
|
extends Omit<InputProps, 'size' | 'icon' | 'iconColor'> {
|
|
154
207
|
/**
|
|
@@ -181,7 +234,8 @@ export type CaretProps = {
|
|
|
181
234
|
length?: number;
|
|
182
235
|
};
|
|
183
236
|
|
|
184
|
-
export interface InputDropDownProps
|
|
237
|
+
export interface InputDropDownProps
|
|
238
|
+
extends Omit<InputProps, 'trailing' | 'trailingColor' | 'onPressTrailing'> {
|
|
185
239
|
/**
|
|
186
240
|
* Optional. Defines the size of the InputDropDown component.
|
|
187
241
|
* 'small' - A smaller, less prominent input.
|
|
@@ -189,57 +243,17 @@ export interface InputDropDownProps extends InputProps {
|
|
|
189
243
|
*/
|
|
190
244
|
size?: 'small' | 'large';
|
|
191
245
|
|
|
192
|
-
/**
|
|
193
|
-
* Optional. The current value of the InputDropDown.
|
|
194
|
-
*/
|
|
195
|
-
value?: string;
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* Optional. Text that is displayed when there is no value set in the InputDropDown.
|
|
199
|
-
*/
|
|
200
|
-
placeholder?: string;
|
|
201
|
-
|
|
202
246
|
/**
|
|
203
247
|
* Optional. Function to be called when the InputDropDown is pressed.
|
|
204
248
|
*/
|
|
205
249
|
onPress?: () => void;
|
|
206
250
|
|
|
207
|
-
/**
|
|
208
|
-
* Optional. Represents the value for the floating title in the InputDropDown component.
|
|
209
|
-
*/
|
|
210
|
-
floatingValue?: string;
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* Optional. Represents the name or key of the floating icon to be displayed in the InputDropDown component.
|
|
214
|
-
*/
|
|
215
|
-
floatingIcon?: string;
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Optional. Represents the error message to be displayed below the InputDropDown component when there is an error.
|
|
219
|
-
*/
|
|
220
|
-
errorMessage?: string;
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* Optional. Represents the name or key of the icon to be displayed in the InputDropDown component.
|
|
224
|
-
*/
|
|
225
|
-
icon?: string;
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* Optional. Represents the color of the icon in the InputDropDown component.
|
|
229
|
-
*/
|
|
230
|
-
iconColor?: string;
|
|
231
|
-
|
|
232
251
|
/**
|
|
233
252
|
* Optional. If `true`, the user won't be able to interact with the InputDropDown component.
|
|
234
253
|
* Defaults to `false` if not provided.
|
|
235
254
|
*/
|
|
236
255
|
disabled?: boolean;
|
|
237
256
|
|
|
238
|
-
/**
|
|
239
|
-
* Optional. Represents the color of the floating icon in the InputDropDown component.
|
|
240
|
-
*/
|
|
241
|
-
floatingIconColor?: string;
|
|
242
|
-
|
|
243
257
|
/**
|
|
244
258
|
* Optional. If `true`, the InputDropDown component is marked as required,
|
|
245
259
|
* indicating that the user must provide a value before submitting a form.
|
|
@@ -247,28 +261,6 @@ export interface InputDropDownProps extends InputProps {
|
|
|
247
261
|
*/
|
|
248
262
|
required?: boolean;
|
|
249
263
|
|
|
250
|
-
/**
|
|
251
|
-
* Optional. If `true`,
|
|
252
|
-
* includes spacing when InputDropDown does not have an error message.
|
|
253
|
-
* Defaults to `false` if not provided.
|
|
254
|
-
*/
|
|
255
|
-
errorSpacing?: boolean;
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* If `true`, the icon of the input will show an indicator for loading.
|
|
259
|
-
*/
|
|
260
|
-
loading?: boolean;
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* Optional. Represents the leading icon in the InputDropDown component.
|
|
264
|
-
*/
|
|
265
|
-
leadingIcon?: string;
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* Optional. Represents the color of the leading icon in the InputDropDown component.
|
|
269
|
-
*/
|
|
270
|
-
leadingIconColor?: string;
|
|
271
|
-
|
|
272
264
|
/**
|
|
273
265
|
* Optional. params for element tracking.
|
|
274
266
|
*/
|
|
@@ -280,6 +272,15 @@ export interface InputDropDownProps extends InputProps {
|
|
|
280
272
|
* Optional. Represents the style of the InputDropDown component.
|
|
281
273
|
*/
|
|
282
274
|
style?: ViewStyle | ViewStyle[];
|
|
275
|
+
|
|
276
|
+
multiline?: boolean;
|
|
283
277
|
}
|
|
284
278
|
|
|
279
|
+
export type InputRef = {
|
|
280
|
+
clear: () => void;
|
|
281
|
+
focus: () => void | undefined;
|
|
282
|
+
blur: () => void | undefined;
|
|
283
|
+
setText: (text: string) => void;
|
|
284
|
+
};
|
|
285
|
+
|
|
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({
|
|
@@ -29,12 +29,12 @@ export default StyleSheet.create({
|
|
|
29
29
|
left: Spacing.S,
|
|
30
30
|
paddingHorizontal: Spacing.S,
|
|
31
31
|
flexDirection: 'row',
|
|
32
|
+
alignItems: 'center',
|
|
32
33
|
},
|
|
33
34
|
floatingIcon: {marginLeft: Spacing.XS},
|
|
34
|
-
errorIcon: {marginRight: Spacing.XS},
|
|
35
|
+
errorIcon: {marginRight: Spacing.XS, marginTop: Spacing.XXS},
|
|
35
36
|
errorView: {
|
|
36
37
|
flexDirection: 'row',
|
|
37
|
-
alignItems: 'center',
|
|
38
38
|
marginTop: Spacing.XS,
|
|
39
39
|
},
|
|
40
40
|
inputView: {
|
|
@@ -133,20 +133,27 @@ export default StyleSheet.create({
|
|
|
133
133
|
paddingVertical: Spacing.S,
|
|
134
134
|
fontWeight: 'bold',
|
|
135
135
|
},
|
|
136
|
-
|
|
136
|
+
inputStyle: {
|
|
137
|
+
color: Colors.black_12,
|
|
138
|
+
fontSize: scaleSize(12),
|
|
139
|
+
height: Platform.select({
|
|
140
|
+
android: 60,
|
|
141
|
+
ios: 36,
|
|
142
|
+
}),
|
|
143
|
+
},
|
|
137
144
|
//OTP
|
|
138
145
|
otpWrapper: {
|
|
139
146
|
width: '100%',
|
|
140
147
|
marginTop: Spacing.M,
|
|
141
148
|
},
|
|
142
149
|
otpInput: {
|
|
143
|
-
height:
|
|
150
|
+
height: 56,
|
|
144
151
|
borderRadius: Radius.S,
|
|
145
152
|
borderWidth: 1,
|
|
146
153
|
},
|
|
147
154
|
otpFloatingView: {
|
|
148
155
|
position: 'absolute',
|
|
149
|
-
top:
|
|
156
|
+
top: -Spacing.M + 2,
|
|
150
157
|
alignSelf: 'center',
|
|
151
158
|
paddingHorizontal: Spacing.S,
|
|
152
159
|
},
|
|
@@ -157,4 +164,33 @@ export default StyleSheet.create({
|
|
|
157
164
|
alignItems: 'center',
|
|
158
165
|
justifyContent: 'center',
|
|
159
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
|
+
},
|
|
160
196
|
});
|
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;
|