@momo-kits/foundation 0.76.1-beta.2 → 0.77.1-optimize.2
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/BottomTab/BottomTabBar.tsx +478 -0
- package/Application/BottomTab/index.tsx +134 -0
- package/Application/Components.tsx +339 -161
- package/Application/ModalScreen.tsx +113 -99
- package/Application/Navigation.ts +22 -16
- package/Application/NavigationContainer.tsx +99 -48
- package/Application/Navigator.ts +110 -41
- package/Application/StackScreen.tsx +126 -8
- package/Application/index.ts +23 -4
- package/Application/types.ts +84 -33
- package/Application/utils.tsx +90 -50
- package/Assets/DotAnimation.json +256 -0
- package/Assets/SpinnerAnimation.json +1027 -0
- package/Assets/icon.json +83 -5
- package/Assets/icon_bank.json +506 -0
- package/Assets/language.json +202 -0
- package/Badge/Badge.tsx +56 -0
- package/Badge/BadgeDot.tsx +11 -0
- package/Badge/BadgeRibbon.tsx +125 -0
- package/Badge/Shape.tsx +29 -0
- package/Badge/index.tsx +7 -0
- package/Badge/styles.ts +58 -0
- package/Badge/types.ts +63 -0
- package/Button/index.tsx +90 -39
- package/Button/styles.ts +19 -0
- package/CheckBox/index.tsx +58 -43
- package/CheckBox/styles.ts +1 -1
- package/CheckBox/types.ts +6 -4
- package/Consts/colors+spacing+radius.ts +18 -0
- package/Consts/styles.ts +0 -26
- package/Consts/theme.ts +4 -0
- package/Divider/index.tsx +2 -0
- package/Icon/index.tsx +13 -9
- package/Icon/types.ts +4 -3
- package/IconButton/index.tsx +24 -15
- package/Image/index.tsx +60 -48
- package/Image/styles.ts +1 -9
- package/Image/types.ts +5 -1
- package/Input/Input.tsx +227 -116
- package/Input/InputDropDown.tsx +132 -0
- package/Input/InputMoney.tsx +174 -111
- package/Input/InputOTP.tsx +257 -0
- package/Input/InputSearch.tsx +160 -132
- package/Input/InputTextArea.tsx +150 -123
- package/Input/common.tsx +42 -17
- package/Input/index.tsx +204 -18
- package/Input/styles.ts +44 -7
- package/Input/utils.ts +2 -2
- package/Layout/Card.tsx +67 -29
- package/Layout/FloatingButton.tsx +128 -0
- package/Layout/GridSystem.tsx +31 -21
- package/Layout/Item.tsx +21 -25
- package/Layout/ItemList.tsx +55 -0
- package/Layout/ItemSectionList.tsx +39 -0
- package/Layout/Screen.tsx +348 -153
- package/Layout/Section.tsx +66 -34
- package/Layout/index.ts +13 -3
- package/Layout/styles.ts +101 -0
- package/Layout/types.ts +1 -39
- package/Layout/utils.ts +27 -52
- package/Loader/DotLoader.tsx +37 -0
- package/Loader/Loader.tsx +13 -0
- package/Loader/ProgressBar.tsx +44 -0
- package/Loader/Spinner.tsx +29 -0
- package/Loader/index.tsx +4 -0
- package/Loader/styles.ts +10 -0
- package/Loader/types.ts +35 -0
- package/Loader/utils.ts +25 -0
- package/Pagination/PaginationDot.tsx +7 -2
- package/Pagination/PaginationNumber.tsx +8 -6
- package/Pagination/PaginationScroll.tsx +0 -1
- package/Pagination/PaginationWhiteDot.tsx +8 -5
- package/Pagination/styles.ts +3 -0
- package/Pagination/types.ts +2 -0
- package/Popup/PopupNotify.tsx +102 -44
- package/Popup/PopupPromotion.tsx +63 -22
- package/Popup/types.ts +15 -4
- package/Radio/index.tsx +35 -21
- package/Radio/types.ts +7 -5
- package/Skeleton/index.tsx +1 -1
- package/Skeleton/types.ts +3 -0
- package/Switch/index.tsx +35 -24
- package/Switch/types.ts +5 -3
- package/Tag/index.tsx +2 -4
- package/Text/index.tsx +27 -22
- package/Text/styles.ts +38 -0
- package/Text/types.ts +25 -13
- package/Text/utils.ts +1 -1
- package/Title/index.tsx +186 -0
- package/Title/styles.ts +79 -0
- package/Title/types.ts +20 -0
- package/code-scanner.js +143 -0
- package/index.ts +8 -1
- package/migrate_typo.js +56 -0
- package/package.json +14 -9
- package/tsconfig.json +24 -0
- package/verify.js +47 -0
- package/Application/BottomTab.tsx +0 -52
- package/Application/NavigationButton.tsx +0 -54
- package/Assets/header-background.png +0 -0
package/Input/common.tsx
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {View} from 'react-native';
|
|
2
|
-
import styles from './styles';
|
|
3
|
-
import {Text} from '../Text';
|
|
4
1
|
import React, {FC, useContext} from 'react';
|
|
2
|
+
import {View, ViewStyle} from 'react-native';
|
|
5
3
|
import {ApplicationContext} from '../Application';
|
|
6
|
-
import {
|
|
4
|
+
import {Theme} from '../Application/types';
|
|
7
5
|
import {Styles} from '../Consts';
|
|
6
|
+
import {Icon} from '../Icon';
|
|
7
|
+
import {scaleSize, Text} from '../Text';
|
|
8
|
+
import styles from './styles';
|
|
8
9
|
|
|
9
10
|
type FloatingViewProps = {
|
|
10
11
|
floatingValue?: string;
|
|
@@ -12,18 +13,25 @@ type FloatingViewProps = {
|
|
|
12
13
|
disabled?: boolean;
|
|
13
14
|
floatingIcon?: string;
|
|
14
15
|
required?: boolean;
|
|
16
|
+
style?: ViewStyle;
|
|
15
17
|
};
|
|
16
18
|
|
|
17
|
-
export
|
|
19
|
+
export interface InputRef {
|
|
20
|
+
focus: () => void;
|
|
21
|
+
blur: () => void;
|
|
22
|
+
clear: () => void;
|
|
23
|
+
setText: (text: string) => void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const DEFAULT_HEIGHT = scaleSize(104);
|
|
18
27
|
export const MAX_LENGTH = 300;
|
|
19
28
|
|
|
20
29
|
export const getBorderColor = (
|
|
30
|
+
theme: Theme,
|
|
21
31
|
focused: boolean,
|
|
22
32
|
errorMessage?: string,
|
|
23
33
|
disabled?: boolean,
|
|
24
34
|
) => {
|
|
25
|
-
const {theme} = useContext(ApplicationContext);
|
|
26
|
-
|
|
27
35
|
let borderColor = theme.colors.border.default;
|
|
28
36
|
|
|
29
37
|
if (focused) {
|
|
@@ -47,26 +55,39 @@ export const getSizeStyle = (size?: 'small' | 'large') => {
|
|
|
47
55
|
}
|
|
48
56
|
return styles.container;
|
|
49
57
|
};
|
|
50
|
-
export const ErrorView: FC<{
|
|
58
|
+
export const ErrorView: FC<{
|
|
59
|
+
errorMessage?: string;
|
|
60
|
+
errorSpacing?: boolean;
|
|
61
|
+
hintText?: string;
|
|
62
|
+
}> = ({errorMessage, errorSpacing, hintText}) => {
|
|
51
63
|
const {theme} = useContext(ApplicationContext);
|
|
52
64
|
const errorColor = theme.colors.error.primary;
|
|
53
|
-
|
|
65
|
+
const hintColor = theme.colors.text.hint;
|
|
66
|
+
const hintTextDefault = hintText ?? 'Không thể chỉnh sửa';
|
|
67
|
+
if (errorMessage || hintText) {
|
|
54
68
|
return (
|
|
55
69
|
<View style={styles.errorView}>
|
|
56
70
|
<View style={styles.errorIcon}>
|
|
57
|
-
<Icon
|
|
71
|
+
<Icon
|
|
72
|
+
color={errorMessage ? errorColor : hintColor}
|
|
73
|
+
source="ic_error"
|
|
74
|
+
size={16}
|
|
75
|
+
/>
|
|
58
76
|
</View>
|
|
59
77
|
<Text
|
|
60
78
|
style={Styles.flex}
|
|
61
|
-
color={errorColor}
|
|
62
|
-
numberOfLines={
|
|
63
|
-
typography={'
|
|
64
|
-
{errorMessage}
|
|
79
|
+
color={errorMessage ? errorColor : hintColor}
|
|
80
|
+
numberOfLines={2}
|
|
81
|
+
typography={'description_default_regular'}>
|
|
82
|
+
{errorMessage ?? hintTextDefault}
|
|
65
83
|
</Text>
|
|
66
84
|
</View>
|
|
67
85
|
);
|
|
68
86
|
}
|
|
69
|
-
|
|
87
|
+
if (errorSpacing) {
|
|
88
|
+
return <View style={[styles.errorView, {height: 18}]} />;
|
|
89
|
+
}
|
|
90
|
+
return <View />;
|
|
70
91
|
};
|
|
71
92
|
|
|
72
93
|
export const FloatingView: FC<FloatingViewProps> = ({
|
|
@@ -75,6 +96,7 @@ export const FloatingView: FC<FloatingViewProps> = ({
|
|
|
75
96
|
disabled,
|
|
76
97
|
floatingIcon,
|
|
77
98
|
required,
|
|
99
|
+
style,
|
|
78
100
|
}) => {
|
|
79
101
|
const {theme} = useContext(ApplicationContext);
|
|
80
102
|
|
|
@@ -94,11 +116,14 @@ export const FloatingView: FC<FloatingViewProps> = ({
|
|
|
94
116
|
backgroundColor: theme.colors.background.surface,
|
|
95
117
|
zIndex: 10,
|
|
96
118
|
},
|
|
119
|
+
style,
|
|
97
120
|
]}>
|
|
98
|
-
<Text color={floatingTextColor} typography={'
|
|
121
|
+
<Text color={floatingTextColor} typography={'label_s_medium'}>
|
|
99
122
|
{floatingValue}
|
|
100
123
|
{required && (
|
|
101
|
-
<Text
|
|
124
|
+
<Text
|
|
125
|
+
typography={'label_s_medium'}
|
|
126
|
+
color={theme.colors.error.primary}>
|
|
102
127
|
*
|
|
103
128
|
</Text>
|
|
104
129
|
)}
|
package/Input/index.tsx
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import {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
|
-
import
|
|
5
|
+
import InputOTP from './InputOTP';
|
|
6
|
+
import InputSearch from './InputSearch';
|
|
7
|
+
import InputTextArea from './InputTextArea';
|
|
6
8
|
|
|
7
9
|
export interface InputProps extends TextInputProps {
|
|
8
10
|
/**
|
|
@@ -30,6 +32,11 @@ export interface InputProps extends TextInputProps {
|
|
|
30
32
|
*/
|
|
31
33
|
icon?: string;
|
|
32
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Optional. Represents the color of the icon in the Input component.
|
|
37
|
+
*/
|
|
38
|
+
iconColor?: string;
|
|
39
|
+
|
|
33
40
|
/**
|
|
34
41
|
* Optional. If `true`, the user won't be able to interact with the Input component.
|
|
35
42
|
* Defaults to `false` if not provided.
|
|
@@ -41,27 +48,61 @@ export interface InputProps extends TextInputProps {
|
|
|
41
48
|
*/
|
|
42
49
|
floatingIconColor?: string;
|
|
43
50
|
|
|
44
|
-
/**
|
|
45
|
-
* Optional. Represents the color of the icon in the Input component.
|
|
46
|
-
*/
|
|
47
|
-
iconColor?: string;
|
|
48
|
-
|
|
49
51
|
/**
|
|
50
52
|
* Optional. If `true`, the Input component is marked as required,
|
|
51
53
|
* indicating that the user must provide a value before submitting a form.
|
|
52
54
|
* Defaults to `false` if not provided.
|
|
53
55
|
*/
|
|
54
56
|
required?: boolean;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Optional. If `true`,
|
|
60
|
+
* include spacing when Input not have error message.
|
|
61
|
+
* Defaults to `false` if not provided.
|
|
62
|
+
*/
|
|
63
|
+
errorSpacing?: boolean;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* If true, the icon of input will use be show indicator loading.
|
|
67
|
+
*/
|
|
68
|
+
loading?: boolean;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Optional. Represents the leading icon in the Input component.
|
|
72
|
+
*/
|
|
73
|
+
leadingIcon?: string;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Optional. Represents the color of the leading icon in the Input component.
|
|
77
|
+
*/
|
|
78
|
+
leadingIconColor?: string;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Optional. Represents the font weight of the text in the Input component.
|
|
82
|
+
*/
|
|
83
|
+
fontWeight?: 'Regular' | 'Bold';
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Optional. callback function to be called when the icon is pressed.
|
|
87
|
+
*/
|
|
88
|
+
onPressIcon?: () => void;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Optional. params for element tracking.
|
|
92
|
+
*/
|
|
93
|
+
params?: any;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Optional. Represents text below the Input component.
|
|
97
|
+
*/
|
|
98
|
+
hintText?: string;
|
|
55
99
|
}
|
|
56
100
|
|
|
57
101
|
type InputPropsWithoutSizeAndIcon = Omit<
|
|
58
102
|
InputProps,
|
|
59
103
|
'size' | 'icon' | 'iconColor'
|
|
60
104
|
>;
|
|
61
|
-
|
|
62
|
-
InputProps,
|
|
63
|
-
'required' | 'size' | 'errorMessage' | 'disabled'
|
|
64
|
-
>;
|
|
105
|
+
|
|
65
106
|
type InputPropsWithoutPlaceholder = Omit<InputProps, 'placeholder'>;
|
|
66
107
|
|
|
67
108
|
export interface InputTextAreaProps extends InputPropsWithoutSizeAndIcon {
|
|
@@ -72,7 +113,7 @@ export interface InputTextAreaProps extends InputPropsWithoutSizeAndIcon {
|
|
|
72
113
|
height?: number;
|
|
73
114
|
}
|
|
74
115
|
|
|
75
|
-
export interface InputSearchProps extends
|
|
116
|
+
export interface InputSearchProps extends TextInputProps {
|
|
76
117
|
/**
|
|
77
118
|
* Optional. Represents the text to be displayed on the search button within the InputSearch component.
|
|
78
119
|
*/
|
|
@@ -84,15 +125,160 @@ export interface InputSearchProps extends InputPropsOmitForSearch {
|
|
|
84
125
|
*/
|
|
85
126
|
showButtonText?: boolean;
|
|
86
127
|
|
|
128
|
+
onPressButtonText?: () => void;
|
|
129
|
+
|
|
87
130
|
/**
|
|
88
|
-
* Optional.
|
|
89
|
-
* Defaults to `true` if not provided.
|
|
131
|
+
* Optional. Represents the color of the icon in the Input component.
|
|
90
132
|
*/
|
|
91
|
-
|
|
133
|
+
iconColor?: string;
|
|
92
134
|
|
|
93
|
-
|
|
135
|
+
/**
|
|
136
|
+
* Optional. Represents the name or key of the icon to be displayed in the Input component.
|
|
137
|
+
*/
|
|
138
|
+
icon?: string;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
*
|
|
142
|
+
*/
|
|
143
|
+
hasColorBG?: boolean;
|
|
144
|
+
|
|
145
|
+
params?: any;
|
|
94
146
|
}
|
|
95
147
|
|
|
96
148
|
export interface InputMoneyProps extends InputPropsWithoutPlaceholder {}
|
|
97
149
|
|
|
98
|
-
export
|
|
150
|
+
export type OTPInputLength = 2 | 4 | 6 | 8 | 10;
|
|
151
|
+
|
|
152
|
+
export interface InputOTPProps extends InputPropsWithoutSizeAndIcon {
|
|
153
|
+
/**
|
|
154
|
+
* Optional. Defines the length of the OTP (One Time Password) input.
|
|
155
|
+
* Can be 2, 4, 6, 8, or 10.
|
|
156
|
+
*/
|
|
157
|
+
length?: OTPInputLength;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Optional. Defines the data type of the OTP input.
|
|
161
|
+
* 'string' - The OTP input will be treated as a string.
|
|
162
|
+
* 'number' - The OTP input will be treated as a number.
|
|
163
|
+
*/
|
|
164
|
+
dataType?: 'string' | 'number';
|
|
165
|
+
|
|
166
|
+
floatingValue: string;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export type CaretProps = {
|
|
170
|
+
/**
|
|
171
|
+
* Optional. The index of the caret in the input field.
|
|
172
|
+
* Represents the position where the caret is located.
|
|
173
|
+
*/
|
|
174
|
+
index?: number;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Optional. The total length of the input field in which the caret is present.
|
|
178
|
+
* This dictates the maximum value of the 'index' property.
|
|
179
|
+
*/
|
|
180
|
+
length?: number;
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
export interface InputDropDownProps extends InputProps {
|
|
184
|
+
/**
|
|
185
|
+
* Optional. Defines the size of the InputDropDown component.
|
|
186
|
+
* 'small' - A smaller, less prominent input.
|
|
187
|
+
* 'large' - A larger, more prominent input.
|
|
188
|
+
*/
|
|
189
|
+
size?: 'small' | 'large';
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Optional. The current value of the InputDropDown.
|
|
193
|
+
*/
|
|
194
|
+
value?: string;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Optional. Text that is displayed when there is no value set in the InputDropDown.
|
|
198
|
+
*/
|
|
199
|
+
placeholder?: string;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Optional. Function to be called when the InputDropDown is pressed.
|
|
203
|
+
*/
|
|
204
|
+
onPress?: () => void;
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Optional. Represents the value for the floating title in the InputDropDown component.
|
|
208
|
+
*/
|
|
209
|
+
floatingValue?: string;
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Optional. Represents the name or key of the floating icon to be displayed in the InputDropDown component.
|
|
213
|
+
*/
|
|
214
|
+
floatingIcon?: string;
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Optional. Represents the error message to be displayed below the InputDropDown component when there is an error.
|
|
218
|
+
*/
|
|
219
|
+
errorMessage?: string;
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Optional. Represents the name or key of the icon to be displayed in the InputDropDown component.
|
|
223
|
+
*/
|
|
224
|
+
icon?: string;
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Optional. Represents the color of the icon in the InputDropDown component.
|
|
228
|
+
*/
|
|
229
|
+
iconColor?: string;
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Optional. If `true`, the user won't be able to interact with the InputDropDown component.
|
|
233
|
+
* Defaults to `false` if not provided.
|
|
234
|
+
*/
|
|
235
|
+
disabled?: boolean;
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Optional. Represents the color of the floating icon in the InputDropDown component.
|
|
239
|
+
*/
|
|
240
|
+
floatingIconColor?: string;
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Optional. If `true`, the InputDropDown component is marked as required,
|
|
244
|
+
* indicating that the user must provide a value before submitting a form.
|
|
245
|
+
* Defaults to `false` if not provided.
|
|
246
|
+
*/
|
|
247
|
+
required?: boolean;
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Optional. If `true`,
|
|
251
|
+
* includes spacing when InputDropDown does not have an error message.
|
|
252
|
+
* Defaults to `false` if not provided.
|
|
253
|
+
*/
|
|
254
|
+
errorSpacing?: boolean;
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* If `true`, the icon of the input will show an indicator for loading.
|
|
258
|
+
*/
|
|
259
|
+
loading?: boolean;
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Optional. Represents the leading icon in the InputDropDown component.
|
|
263
|
+
*/
|
|
264
|
+
leadingIcon?: string;
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Optional. Represents the color of the leading icon in the InputDropDown component.
|
|
268
|
+
*/
|
|
269
|
+
leadingIconColor?: string;
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Optional. params for element tracking.
|
|
273
|
+
*/
|
|
274
|
+
params?: {
|
|
275
|
+
[key: string]: any;
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Optional. Represents the style of the InputDropDown component.
|
|
280
|
+
*/
|
|
281
|
+
style?: ViewStyle | ViewStyle[];
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
export {Input, InputDropDown, InputMoney, InputOTP, InputSearch, InputTextArea};
|
package/Input/styles.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import {StyleSheet} from 'react-native';
|
|
2
2
|
import {Radius, Spacing} from '../Consts';
|
|
3
|
+
import {scaleSize} from '../Text';
|
|
3
4
|
|
|
4
5
|
export default StyleSheet.create({
|
|
5
6
|
//input style
|
|
6
|
-
input: {
|
|
7
|
+
input: {
|
|
8
|
+
flex: 1,
|
|
9
|
+
paddingLeft: Spacing.M,
|
|
10
|
+
fontSize: scaleSize(14),
|
|
11
|
+
},
|
|
7
12
|
wrapper: {
|
|
8
13
|
width: '100%',
|
|
9
14
|
},
|
|
@@ -11,7 +16,6 @@ export default StyleSheet.create({
|
|
|
11
16
|
borderWidth: 1,
|
|
12
17
|
borderRadius: Radius.S,
|
|
13
18
|
height: 56,
|
|
14
|
-
paddingVertical: 8,
|
|
15
19
|
},
|
|
16
20
|
smallContainer: {
|
|
17
21
|
borderRadius: Radius.S,
|
|
@@ -33,8 +37,14 @@ export default StyleSheet.create({
|
|
|
33
37
|
marginTop: Spacing.XS,
|
|
34
38
|
},
|
|
35
39
|
inputView: {
|
|
36
|
-
justifyContent: 'space-between',
|
|
37
40
|
flex: 1,
|
|
41
|
+
flexDirection: 'row',
|
|
42
|
+
alignItems: 'center',
|
|
43
|
+
},
|
|
44
|
+
leadingIconContainer: {
|
|
45
|
+
marginLeft: Spacing.M,
|
|
46
|
+
borderRadius: Radius.XS,
|
|
47
|
+
overflow: 'hidden',
|
|
38
48
|
},
|
|
39
49
|
iconView: {
|
|
40
50
|
flexDirection: 'row',
|
|
@@ -43,8 +53,7 @@ export default StyleSheet.create({
|
|
|
43
53
|
marginRight: Spacing.M,
|
|
44
54
|
},
|
|
45
55
|
icon: {
|
|
46
|
-
|
|
47
|
-
height: 24,
|
|
56
|
+
marginLeft: Spacing.S,
|
|
48
57
|
},
|
|
49
58
|
iconWrapper: {
|
|
50
59
|
width: 24,
|
|
@@ -65,6 +74,8 @@ export default StyleSheet.create({
|
|
|
65
74
|
width: '100%',
|
|
66
75
|
flex: 1,
|
|
67
76
|
paddingRight: Spacing.XS,
|
|
77
|
+
paddingVertical: Spacing.XS,
|
|
78
|
+
fontSize: scaleSize(14),
|
|
68
79
|
},
|
|
69
80
|
textAreaWrapper: {
|
|
70
81
|
borderWidth: 1,
|
|
@@ -89,7 +100,6 @@ export default StyleSheet.create({
|
|
|
89
100
|
searchInputWrapper: {
|
|
90
101
|
flexDirection: 'row',
|
|
91
102
|
borderRadius: Radius.XL,
|
|
92
|
-
borderWidth: 1,
|
|
93
103
|
paddingHorizontal: Spacing.S,
|
|
94
104
|
alignItems: 'center',
|
|
95
105
|
flex: 1,
|
|
@@ -98,6 +108,8 @@ export default StyleSheet.create({
|
|
|
98
108
|
height: 36,
|
|
99
109
|
marginLeft: Spacing.S,
|
|
100
110
|
flex: 1,
|
|
111
|
+
fontSize: scaleSize(14),
|
|
112
|
+
paddingVertical: Spacing.XS,
|
|
101
113
|
},
|
|
102
114
|
searchInputView: {
|
|
103
115
|
flexDirection: 'row',
|
|
@@ -116,7 +128,32 @@ export default StyleSheet.create({
|
|
|
116
128
|
width: '100%',
|
|
117
129
|
paddingLeft: Spacing.M,
|
|
118
130
|
height: '100%',
|
|
119
|
-
fontSize: 20,
|
|
131
|
+
fontSize: scaleSize(20),
|
|
132
|
+
paddingVertical: Spacing.S,
|
|
120
133
|
fontWeight: 'bold',
|
|
121
134
|
},
|
|
135
|
+
|
|
136
|
+
//OTP
|
|
137
|
+
otpWrapper: {
|
|
138
|
+
width: '100%',
|
|
139
|
+
marginTop: Spacing.M,
|
|
140
|
+
},
|
|
141
|
+
otpInput: {
|
|
142
|
+
height: scaleSize(56),
|
|
143
|
+
borderRadius: Radius.S,
|
|
144
|
+
borderWidth: 1,
|
|
145
|
+
},
|
|
146
|
+
otpFloatingView: {
|
|
147
|
+
position: 'absolute',
|
|
148
|
+
top: scaleSize(-Spacing.M + 2),
|
|
149
|
+
alignSelf: 'center',
|
|
150
|
+
paddingHorizontal: Spacing.S,
|
|
151
|
+
},
|
|
152
|
+
otpInputsView: {
|
|
153
|
+
width: '100%',
|
|
154
|
+
height: '100%',
|
|
155
|
+
flexDirection: 'row',
|
|
156
|
+
alignItems: 'center',
|
|
157
|
+
justifyContent: 'center',
|
|
158
|
+
},
|
|
122
159
|
});
|
package/Input/utils.ts
CHANGED
|
@@ -3,7 +3,7 @@ const formatNumberToMoney = (number: number, currency = '') => {
|
|
|
3
3
|
return `0${currency}`;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
const array = [];
|
|
6
|
+
const array: string[] = [];
|
|
7
7
|
let result = '';
|
|
8
8
|
let isNegative = false;
|
|
9
9
|
|
|
@@ -23,7 +23,7 @@ const formatNumberToMoney = (number: number, currency = '') => {
|
|
|
23
23
|
array.push(',');
|
|
24
24
|
count = 0;
|
|
25
25
|
} else {
|
|
26
|
-
array.push(numberString[i]);
|
|
26
|
+
array.push(numberString[i] as string);
|
|
27
27
|
}
|
|
28
28
|
if (count === 3 && i >= 1) {
|
|
29
29
|
array.push('.');
|
package/Layout/Card.tsx
CHANGED
|
@@ -1,12 +1,35 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {Dimensions, View} from 'react-native';
|
|
1
|
+
import React, {Fragment, useContext} from 'react';
|
|
2
|
+
import {Dimensions, View, ViewProps} from 'react-native';
|
|
3
3
|
import {useGridSystem, validateChildren} from './utils';
|
|
4
|
-
import {
|
|
5
|
-
import {GridContext} from './index';
|
|
6
|
-
import {GRIDVIEW} from '../Consts';
|
|
4
|
+
import {GridContextProps} from './types';
|
|
5
|
+
import {GridContext, GridSystem} from './index';
|
|
7
6
|
import Item from './Item';
|
|
7
|
+
import {Image} from '../Image';
|
|
8
|
+
import {ApplicationContext} from '../Application';
|
|
9
|
+
import styles from './styles';
|
|
10
|
+
import {Colors, Radius, Shadow, Spacing} from '../Consts';
|
|
11
|
+
import ItemList from './ItemList';
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
export interface CardProps extends ViewProps {
|
|
14
|
+
/**
|
|
15
|
+
* Optional. Background image for the card.
|
|
16
|
+
*/
|
|
17
|
+
backgroundImage?: string;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Optional. Use shadow for the card.
|
|
21
|
+
*/
|
|
22
|
+
useShadow?: boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const Card: React.FC<CardProps> = ({
|
|
26
|
+
children,
|
|
27
|
+
style,
|
|
28
|
+
backgroundImage,
|
|
29
|
+
useShadow = false,
|
|
30
|
+
...props
|
|
31
|
+
}) => {
|
|
32
|
+
const {showGrid, theme} = useContext(ApplicationContext);
|
|
10
33
|
const {numberOfColumns} = useGridSystem();
|
|
11
34
|
|
|
12
35
|
const gutterSize = 8;
|
|
@@ -19,29 +42,26 @@ const Card: React.FC<CardProps> = ({children, style}) => {
|
|
|
19
42
|
const gridContext: GridContextProps = {
|
|
20
43
|
numberOfColumns,
|
|
21
44
|
gutterSize,
|
|
22
|
-
margin,
|
|
23
45
|
sizePerSpan,
|
|
24
46
|
getSizeSpan: span => {
|
|
25
47
|
return span * sizePerSpan + (span - 1) * gutterSize;
|
|
26
48
|
},
|
|
27
49
|
};
|
|
50
|
+
|
|
28
51
|
/**
|
|
29
52
|
* render overlay only dev mode
|
|
30
53
|
*/
|
|
31
54
|
const renderOverlay = () => {
|
|
32
55
|
return (
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
borderWidth: 1,
|
|
43
|
-
}}
|
|
44
|
-
/>
|
|
56
|
+
<>
|
|
57
|
+
<GridSystem
|
|
58
|
+
width={widthSection}
|
|
59
|
+
gutterSize={Spacing.S}
|
|
60
|
+
screenGrid={false}
|
|
61
|
+
gridColor={Colors.red_01}
|
|
62
|
+
/>
|
|
63
|
+
<View pointerEvents={'none'} style={styles.boxGridCard} />
|
|
64
|
+
</>
|
|
45
65
|
);
|
|
46
66
|
};
|
|
47
67
|
|
|
@@ -88,8 +108,9 @@ const Card: React.FC<CardProps> = ({children, style}) => {
|
|
|
88
108
|
if (Array.isArray(children)) {
|
|
89
109
|
let cursor = 0;
|
|
90
110
|
let rows: any[] = [];
|
|
91
|
-
|
|
92
|
-
|
|
111
|
+
const arrayChild = children.filter(item => !!item);
|
|
112
|
+
for (let i = 0; i < arrayChild.length; ++i) {
|
|
113
|
+
const item = arrayChild[i];
|
|
93
114
|
const totalSpan = rows
|
|
94
115
|
.concat([item])
|
|
95
116
|
.map(i => i.props?.widthSpan)
|
|
@@ -105,13 +126,16 @@ const Card: React.FC<CardProps> = ({children, style}) => {
|
|
|
105
126
|
rows = [item];
|
|
106
127
|
}
|
|
107
128
|
|
|
108
|
-
if (i ==
|
|
129
|
+
if (i == arrayChild.length - 1) {
|
|
109
130
|
cursor += 1;
|
|
110
131
|
element.push(addRowView(rows, cursor, true));
|
|
111
132
|
}
|
|
112
133
|
}
|
|
113
134
|
} else {
|
|
114
135
|
element.push(children);
|
|
136
|
+
if (children?.type == Fragment) {
|
|
137
|
+
return renderView(children?.props.children);
|
|
138
|
+
}
|
|
115
139
|
}
|
|
116
140
|
return element;
|
|
117
141
|
};
|
|
@@ -119,19 +143,33 @@ const Card: React.FC<CardProps> = ({children, style}) => {
|
|
|
119
143
|
return (
|
|
120
144
|
<GridContext.Provider value={gridContext}>
|
|
121
145
|
<View
|
|
122
|
-
|
|
146
|
+
{...props}
|
|
123
147
|
style={[
|
|
148
|
+
{backgroundColor: theme.colors.background.surface},
|
|
124
149
|
style,
|
|
150
|
+
styles.protectedStyle,
|
|
151
|
+
styles.card,
|
|
125
152
|
{
|
|
126
153
|
width: widthSection,
|
|
127
|
-
marginHorizontal:
|
|
128
|
-
padding: 12,
|
|
129
|
-
flexDirection: 'row',
|
|
130
|
-
flexWrap: 'wrap',
|
|
154
|
+
marginHorizontal: margin,
|
|
131
155
|
},
|
|
156
|
+
!!backgroundImage && {backgroundColor: undefined},
|
|
157
|
+
useShadow && Shadow.Light,
|
|
132
158
|
]}>
|
|
133
|
-
{
|
|
134
|
-
|
|
159
|
+
{!!backgroundImage && (
|
|
160
|
+
<Image
|
|
161
|
+
source={{uri: backgroundImage}}
|
|
162
|
+
style={[
|
|
163
|
+
styles.imageBackground,
|
|
164
|
+
{
|
|
165
|
+
width: widthSection,
|
|
166
|
+
borderRadius: Radius.M,
|
|
167
|
+
},
|
|
168
|
+
]}
|
|
169
|
+
/>
|
|
170
|
+
)}
|
|
171
|
+
{renderView(validateChildren(children, [Item, ItemList]))}
|
|
172
|
+
{showGrid && renderOverlay()}
|
|
135
173
|
</View>
|
|
136
174
|
</GridContext.Provider>
|
|
137
175
|
);
|