@momo-kits/foundation 0.81.43 → 0.88.1-beta.3
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.tsx +29 -11
- package/Application/Components.tsx +153 -153
- package/Application/NavigationContainer.tsx +1 -1
- package/Application/Navigator.ts +7 -0
- package/Application/StackScreen.tsx +12 -2
- package/Application/types.ts +17 -5
- package/Application/utils.tsx +15 -0
- package/Badge/Badge.tsx +1 -1
- package/Badge/BadgeRibbon.tsx +2 -2
- package/Badge/styles.ts +5 -2
- package/Button/index.tsx +35 -19
- package/CheckBox/index.tsx +34 -21
- package/IconButton/index.tsx +21 -8
- package/Input/Input.tsx +20 -6
- package/Input/InputMoney.tsx +20 -6
- package/Input/InputOTP.tsx +33 -13
- package/Input/InputSearch.tsx +43 -27
- package/Input/InputTextArea.tsx +3 -1
- package/Input/common.tsx +5 -3
- package/Input/index.tsx +4 -0
- package/Layout/Card.tsx +8 -8
- package/Layout/ItemList.tsx +39 -33
- package/Layout/Section.tsx +4 -3
- package/Pagination/PaginationNumber.tsx +1 -1
- package/Popup/PopupNotify.tsx +3 -3
- package/Radio/index.tsx +33 -19
- package/Switch/index.tsx +27 -14
- package/Tag/index.tsx +1 -1
- package/Text/index.tsx +2 -1
- package/Text/styles.ts +38 -0
- package/Text/types.ts +18 -24
- package/Title/index.tsx +2 -2
- package/package.json +1 -1
- package/verify.js +3 -2
package/Button/index.tsx
CHANGED
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
TouchableOpacityProps,
|
|
7
7
|
View,
|
|
8
8
|
} from 'react-native';
|
|
9
|
-
|
|
10
9
|
import LinearGradient from 'react-native-linear-gradient';
|
|
11
10
|
import {ApplicationContext} from '../Application';
|
|
12
11
|
import {Text} from '../Text';
|
|
@@ -15,6 +14,11 @@ import {Colors, Spacing} from '../Consts';
|
|
|
15
14
|
import styles from './styles';
|
|
16
15
|
import {Icon} from '../Icon';
|
|
17
16
|
import {Loader} from '../Loader';
|
|
17
|
+
import {ScreenInfo} from '../Application/types';
|
|
18
|
+
|
|
19
|
+
const {
|
|
20
|
+
ScreenContext,
|
|
21
|
+
} = require('react-native/Libraries/Components/ScreenContext');
|
|
18
22
|
|
|
19
23
|
const AnimationLinear = Animated.createAnimatedComponent(LinearGradient);
|
|
20
24
|
|
|
@@ -70,6 +74,8 @@ export interface ButtonProps extends TouchableOpacityProps {
|
|
|
70
74
|
* A callback function that is called when the button is pressed.
|
|
71
75
|
*/
|
|
72
76
|
onPress: () => void;
|
|
77
|
+
|
|
78
|
+
trackingParams?: any;
|
|
73
79
|
}
|
|
74
80
|
|
|
75
81
|
const Button: FC<ButtonProps> = ({
|
|
@@ -82,6 +88,7 @@ const Button: FC<ButtonProps> = ({
|
|
|
82
88
|
loading = false,
|
|
83
89
|
title = 'Button',
|
|
84
90
|
onPress,
|
|
91
|
+
trackingParams,
|
|
85
92
|
...rest
|
|
86
93
|
}) => {
|
|
87
94
|
const {theme, config} = useContext(ApplicationContext);
|
|
@@ -94,6 +101,8 @@ const Button: FC<ButtonProps> = ({
|
|
|
94
101
|
end: {x: 0, y: 0.5},
|
|
95
102
|
};
|
|
96
103
|
}
|
|
104
|
+
|
|
105
|
+
const screenInfo = useContext<ScreenInfo>(ScreenContext);
|
|
97
106
|
const getSizeStyle = () => {
|
|
98
107
|
const styleSheet: {[key: string]: any} = styles;
|
|
99
108
|
return styleSheet[size ?? 'small'];
|
|
@@ -172,14 +181,14 @@ const Button: FC<ButtonProps> = ({
|
|
|
172
181
|
const getTypography = (): Typography => {
|
|
173
182
|
switch (size) {
|
|
174
183
|
case 'large':
|
|
175
|
-
return '
|
|
184
|
+
return 'action_default_bold';
|
|
176
185
|
case 'medium':
|
|
177
|
-
return '
|
|
186
|
+
return 'action_s_bold';
|
|
178
187
|
case 'small':
|
|
179
|
-
return '
|
|
188
|
+
return 'action_xs_bold';
|
|
180
189
|
|
|
181
190
|
default:
|
|
182
|
-
return '
|
|
191
|
+
return 'action_default_bold';
|
|
183
192
|
}
|
|
184
193
|
};
|
|
185
194
|
|
|
@@ -291,20 +300,27 @@ const Button: FC<ButtonProps> = ({
|
|
|
291
300
|
const activeOpacity = type === 'disabled' ? 0.75 : 0.5;
|
|
292
301
|
|
|
293
302
|
return (
|
|
294
|
-
<
|
|
295
|
-
{
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
303
|
+
<ScreenContext.Provider
|
|
304
|
+
value={{
|
|
305
|
+
...screenInfo,
|
|
306
|
+
componentName: 'Button',
|
|
307
|
+
params: trackingParams,
|
|
308
|
+
state: type === 'disabled' ? 'disabled' : 'enabled',
|
|
309
|
+
}}>
|
|
310
|
+
<TouchableOpacity
|
|
311
|
+
{...rest}
|
|
312
|
+
activeOpacity={activeOpacity}
|
|
313
|
+
onPress={onPressButton}
|
|
314
|
+
style={buttonStyle}>
|
|
315
|
+
{renderLeading()}
|
|
316
|
+
{renderTitle()}
|
|
317
|
+
{renderTrailing()}
|
|
318
|
+
{gradientPros && (
|
|
319
|
+
<AnimationLinear {...gradientPros} style={styles.gradientView} />
|
|
320
|
+
)}
|
|
321
|
+
{gradientPros && <View style={styles.strokeView} />}
|
|
322
|
+
</TouchableOpacity>
|
|
323
|
+
</ScreenContext.Provider>
|
|
308
324
|
);
|
|
309
325
|
};
|
|
310
326
|
|
package/CheckBox/index.tsx
CHANGED
|
@@ -6,6 +6,10 @@ import {ApplicationContext} from '../Application';
|
|
|
6
6
|
import {Text} from '../Text';
|
|
7
7
|
import {Icon} from '../Icon';
|
|
8
8
|
|
|
9
|
+
const {
|
|
10
|
+
ScreenContext,
|
|
11
|
+
} = require('react-native/Libraries/Components/ScreenContext');
|
|
12
|
+
|
|
9
13
|
const CheckBox: FC<CheckBoxProps> = ({
|
|
10
14
|
value,
|
|
11
15
|
disabled,
|
|
@@ -19,6 +23,7 @@ const CheckBox: FC<CheckBoxProps> = ({
|
|
|
19
23
|
const iconSource = indeterminate ? 'ic_minus' : 'ic_checked';
|
|
20
24
|
let borderColor = theme.colors.text.default;
|
|
21
25
|
let backgroundColor = theme.colors.background.surface;
|
|
26
|
+
const screenInfo = useContext<any>(ScreenContext);
|
|
22
27
|
|
|
23
28
|
if (haveValue) {
|
|
24
29
|
borderColor = theme.colors.primary;
|
|
@@ -35,27 +40,35 @@ const CheckBox: FC<CheckBoxProps> = ({
|
|
|
35
40
|
}
|
|
36
41
|
|
|
37
42
|
return (
|
|
38
|
-
<
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
{
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
43
|
+
<ScreenContext.Provider
|
|
44
|
+
value={{
|
|
45
|
+
...screenInfo,
|
|
46
|
+
componentName: 'CheckBox',
|
|
47
|
+
params: {
|
|
48
|
+
value,
|
|
49
|
+
},
|
|
50
|
+
}}>
|
|
51
|
+
<TouchableOpacity
|
|
52
|
+
activeOpacity={0.8}
|
|
53
|
+
onPress={() => onChange?.(!value)}
|
|
54
|
+
disabled={disabled}
|
|
55
|
+
style={[style, styles.container]}>
|
|
56
|
+
<View
|
|
57
|
+
style={[
|
|
58
|
+
{borderColor, backgroundColor, borderWidth: 1},
|
|
59
|
+
styles.checkbox,
|
|
60
|
+
]}>
|
|
61
|
+
{haveValue && (
|
|
62
|
+
<Icon
|
|
63
|
+
color={theme.colors.background.surface}
|
|
64
|
+
size={20}
|
|
65
|
+
source={iconSource}
|
|
66
|
+
/>
|
|
67
|
+
)}
|
|
68
|
+
</View>
|
|
69
|
+
{!!label && <Text typography={'body_default_regular'}>{label}</Text>}
|
|
70
|
+
</TouchableOpacity>
|
|
71
|
+
</ScreenContext.Provider>
|
|
59
72
|
);
|
|
60
73
|
};
|
|
61
74
|
|
package/IconButton/index.tsx
CHANGED
|
@@ -10,6 +10,10 @@ import {Colors} from '../Consts';
|
|
|
10
10
|
import {Icon} from '../Icon';
|
|
11
11
|
import styles from './styles';
|
|
12
12
|
|
|
13
|
+
const {
|
|
14
|
+
ScreenContext,
|
|
15
|
+
} = require('react-native/Libraries/Components/ScreenContext');
|
|
16
|
+
|
|
13
17
|
export interface IconButtonProps extends TouchableOpacityProps {
|
|
14
18
|
/**
|
|
15
19
|
* Represents the name or key of the icon to be displayed on the IconButton.
|
|
@@ -36,6 +40,7 @@ const IconButton: React.FC<IconButtonProps> = ({
|
|
|
36
40
|
...rest
|
|
37
41
|
}) => {
|
|
38
42
|
const {theme} = useContext(ApplicationContext);
|
|
43
|
+
const screenInfo = useContext<any>(ScreenContext);
|
|
39
44
|
|
|
40
45
|
/**
|
|
41
46
|
* get size icon button
|
|
@@ -121,14 +126,22 @@ const IconButton: React.FC<IconButtonProps> = ({
|
|
|
121
126
|
const iconSize = size === 'small' ? 16 : 24;
|
|
122
127
|
|
|
123
128
|
return (
|
|
124
|
-
<
|
|
125
|
-
{
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
<ScreenContext.Provider
|
|
130
|
+
value={{
|
|
131
|
+
...screenInfo,
|
|
132
|
+
componentName: 'IconButton',
|
|
133
|
+
params: {
|
|
134
|
+
icon,
|
|
135
|
+
},
|
|
136
|
+
}}>
|
|
137
|
+
<TouchableOpacity
|
|
138
|
+
{...rest}
|
|
139
|
+
activeOpacity={activeOpacity}
|
|
140
|
+
onPress={onPressButton}
|
|
141
|
+
style={buttonStyle}>
|
|
142
|
+
<Icon size={iconSize} source={icon} color={getIconColor()} />
|
|
143
|
+
</TouchableOpacity>
|
|
144
|
+
</ScreenContext.Provider>
|
|
132
145
|
);
|
|
133
146
|
};
|
|
134
147
|
|
package/Input/Input.tsx
CHANGED
|
@@ -13,6 +13,10 @@ import {InputProps} from './index';
|
|
|
13
13
|
import {Icon} from '../Icon';
|
|
14
14
|
import {checkTyping} from './utils';
|
|
15
15
|
import {Loader} from '../Loader';
|
|
16
|
+
import {ScreenInfo} from '../Application/types';
|
|
17
|
+
const {
|
|
18
|
+
ScreenContext,
|
|
19
|
+
} = require('react-native/Libraries/Components/ScreenContext');
|
|
16
20
|
|
|
17
21
|
const Input = forwardRef(
|
|
18
22
|
(
|
|
@@ -38,6 +42,7 @@ const Input = forwardRef(
|
|
|
38
42
|
fontWeight = 'Regular',
|
|
39
43
|
onPressIcon,
|
|
40
44
|
style,
|
|
45
|
+
trackingParams,
|
|
41
46
|
...props
|
|
42
47
|
}: InputProps,
|
|
43
48
|
ref,
|
|
@@ -47,6 +52,7 @@ const Input = forwardRef(
|
|
|
47
52
|
const [haveValue, setHaveValue] = useState(!!value || !!props.defaultValue);
|
|
48
53
|
const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
|
|
49
54
|
const accessibilityLabel = `Input/${floatingValue ?? placeholder}`;
|
|
55
|
+
const screenInfo = useContext<ScreenInfo>(ScreenContext);
|
|
50
56
|
|
|
51
57
|
const onClearText = () => {
|
|
52
58
|
inputRef?.current?.clear();
|
|
@@ -160,12 +166,20 @@ const Input = forwardRef(
|
|
|
160
166
|
};
|
|
161
167
|
|
|
162
168
|
return (
|
|
163
|
-
<
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
+
<ScreenContext.Provider
|
|
170
|
+
value={{
|
|
171
|
+
...screenInfo,
|
|
172
|
+
componentName: 'Input',
|
|
173
|
+
params: trackingParams,
|
|
174
|
+
state: disabled ? 'disabled' : 'enabled',
|
|
175
|
+
}}>
|
|
176
|
+
<View
|
|
177
|
+
style={[style, styles.wrapper]}
|
|
178
|
+
accessibilityLabel={accessibilityLabel}>
|
|
179
|
+
{renderInputView()}
|
|
180
|
+
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
181
|
+
</View>
|
|
182
|
+
</ScreenContext.Provider>
|
|
169
183
|
);
|
|
170
184
|
},
|
|
171
185
|
);
|
package/Input/InputMoney.tsx
CHANGED
|
@@ -12,6 +12,10 @@ import {ErrorView, FloatingView, getBorderColor, getSizeStyle} from './common';
|
|
|
12
12
|
import {InputMoneyProps} from './index';
|
|
13
13
|
import {Icon} from '../Icon';
|
|
14
14
|
import {formatMoneyToNumber, formatNumberToMoney} from './utils';
|
|
15
|
+
import {ScreenInfo} from '../Application/types';
|
|
16
|
+
const {
|
|
17
|
+
ScreenContext,
|
|
18
|
+
} = require('react-native/Libraries/Components/ScreenContext');
|
|
15
19
|
|
|
16
20
|
const InputMoney = forwardRef(
|
|
17
21
|
(
|
|
@@ -30,6 +34,7 @@ const InputMoney = forwardRef(
|
|
|
30
34
|
required = false,
|
|
31
35
|
errorSpacing,
|
|
32
36
|
style,
|
|
37
|
+
trackingParams,
|
|
33
38
|
defaultValue = '',
|
|
34
39
|
...props
|
|
35
40
|
}: InputMoneyProps,
|
|
@@ -39,6 +44,7 @@ const InputMoney = forwardRef(
|
|
|
39
44
|
const [focused, setFocused] = useState(false);
|
|
40
45
|
const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
|
|
41
46
|
const accessibilityLabel = `InputMoney/${floatingValue}`;
|
|
47
|
+
const screenInfo = useContext<ScreenInfo>(ScreenContext);
|
|
42
48
|
|
|
43
49
|
const validateText = (text: string) => {
|
|
44
50
|
const valueFormat = formatMoneyToNumber(text, 'đ');
|
|
@@ -142,12 +148,20 @@ const InputMoney = forwardRef(
|
|
|
142
148
|
};
|
|
143
149
|
|
|
144
150
|
return (
|
|
145
|
-
<
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
+
<ScreenContext.Provider
|
|
152
|
+
value={{
|
|
153
|
+
...screenInfo,
|
|
154
|
+
componentName: 'InputMoney',
|
|
155
|
+
params: trackingParams,
|
|
156
|
+
state: 'enable',
|
|
157
|
+
}}>
|
|
158
|
+
<View
|
|
159
|
+
style={[style, styles.wrapper]}
|
|
160
|
+
accessibilityLabel={accessibilityLabel}>
|
|
161
|
+
{renderInputView()}
|
|
162
|
+
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
163
|
+
</View>
|
|
164
|
+
</ScreenContext.Provider>
|
|
151
165
|
);
|
|
152
166
|
},
|
|
153
167
|
);
|
package/Input/InputOTP.tsx
CHANGED
|
@@ -21,6 +21,10 @@ import styles from './styles';
|
|
|
21
21
|
import {ErrorView, getBorderColor} from './common';
|
|
22
22
|
import {ApplicationContext} from '../Application';
|
|
23
23
|
import {Spacing} from '../Consts';
|
|
24
|
+
import {ScreenInfo} from '../Application/types';
|
|
25
|
+
const {
|
|
26
|
+
ScreenContext,
|
|
27
|
+
} = require('react-native/Libraries/Components/ScreenContext');
|
|
24
28
|
|
|
25
29
|
const OTPCaret: FC<CaretProps> = ({index, length}) => {
|
|
26
30
|
const DURATION = 300;
|
|
@@ -57,7 +61,7 @@ const OTPCaret: FC<CaretProps> = ({index, length}) => {
|
|
|
57
61
|
opacity,
|
|
58
62
|
}}
|
|
59
63
|
/>
|
|
60
|
-
<Text color={theme.colors.text.hint} typography={'
|
|
64
|
+
<Text color={theme.colors.text.hint} typography={'body_default_regular'}>
|
|
61
65
|
-
|
|
62
66
|
</Text>
|
|
63
67
|
</View>
|
|
@@ -78,6 +82,7 @@ const InputOTP = forwardRef(
|
|
|
78
82
|
onFocus,
|
|
79
83
|
onBlur,
|
|
80
84
|
dataType = 'number',
|
|
85
|
+
trackingParams,
|
|
81
86
|
style,
|
|
82
87
|
...props
|
|
83
88
|
}: InputOTPProps,
|
|
@@ -89,6 +94,7 @@ const InputOTP = forwardRef(
|
|
|
89
94
|
const inputRef = useRef<TextInput>(null);
|
|
90
95
|
const {theme} = useContext(ApplicationContext);
|
|
91
96
|
const accessibilityLabel = `InputOTP/${floatingValue ?? placeholder}`;
|
|
97
|
+
const screenInfo = useContext<ScreenInfo>(ScreenContext);
|
|
92
98
|
|
|
93
99
|
useImperativeHandle(ref, () => ({
|
|
94
100
|
onChangeText: (text: string) => {
|
|
@@ -135,7 +141,9 @@ const InputOTP = forwardRef(
|
|
|
135
141
|
? theme.colors.text.default
|
|
136
142
|
: theme.colors.text.hint
|
|
137
143
|
}
|
|
138
|
-
typography={
|
|
144
|
+
typography={
|
|
145
|
+
!!value[i] ? 'header_m_bold' : 'body_default_regular'
|
|
146
|
+
}>
|
|
139
147
|
{value[i] || '-'}
|
|
140
148
|
</Text>
|
|
141
149
|
)}
|
|
@@ -150,7 +158,9 @@ const InputOTP = forwardRef(
|
|
|
150
158
|
|
|
151
159
|
if (!focused && value.length === 0 && !!placeholder) {
|
|
152
160
|
return (
|
|
153
|
-
<Text
|
|
161
|
+
<Text
|
|
162
|
+
color={theme.colors.text.hint}
|
|
163
|
+
typography={'description_default_regular'}>
|
|
154
164
|
{placeholder}
|
|
155
165
|
</Text>
|
|
156
166
|
);
|
|
@@ -167,7 +177,7 @@ const InputOTP = forwardRef(
|
|
|
167
177
|
marginRight: Spacing.L,
|
|
168
178
|
}
|
|
169
179
|
}
|
|
170
|
-
typography={'
|
|
180
|
+
typography={'header_m_bold'}>
|
|
171
181
|
{letter}
|
|
172
182
|
</Text>
|
|
173
183
|
);
|
|
@@ -191,7 +201,9 @@ const InputOTP = forwardRef(
|
|
|
191
201
|
styles.otpFloatingView,
|
|
192
202
|
{backgroundColor: theme.colors.background.surface},
|
|
193
203
|
]}>
|
|
194
|
-
<Text typography={'
|
|
204
|
+
<Text typography={'description_default_regular'}>
|
|
205
|
+
{floatingValue}
|
|
206
|
+
</Text>
|
|
195
207
|
</View>
|
|
196
208
|
)}
|
|
197
209
|
<View style={styles.otpInputsView}>
|
|
@@ -217,14 +229,22 @@ const InputOTP = forwardRef(
|
|
|
217
229
|
};
|
|
218
230
|
|
|
219
231
|
return (
|
|
220
|
-
<
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
232
|
+
<ScreenContext.Provider
|
|
233
|
+
value={{
|
|
234
|
+
...screenInfo,
|
|
235
|
+
componentName: 'InputOTP',
|
|
236
|
+
params: trackingParams,
|
|
237
|
+
state: 'enable',
|
|
238
|
+
}}>
|
|
239
|
+
<TouchableOpacity
|
|
240
|
+
activeOpacity={1}
|
|
241
|
+
onPress={onFocusInput}
|
|
242
|
+
style={[style, styles.otpWrapper]}
|
|
243
|
+
accessibilityLabel={accessibilityLabel}>
|
|
244
|
+
{renderInputView()}
|
|
245
|
+
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
246
|
+
</TouchableOpacity>
|
|
247
|
+
</ScreenContext.Provider>
|
|
228
248
|
);
|
|
229
249
|
},
|
|
230
250
|
);
|
package/Input/InputSearch.tsx
CHANGED
|
@@ -12,6 +12,10 @@ import styles from './styles';
|
|
|
12
12
|
import {Icon} from '../Icon';
|
|
13
13
|
import {Text} from '../Text';
|
|
14
14
|
import {checkTyping} from './utils';
|
|
15
|
+
import {ScreenInfo} from '../Application/types';
|
|
16
|
+
const {
|
|
17
|
+
ScreenContext,
|
|
18
|
+
} = require('react-native/Libraries/Components/ScreenContext');
|
|
15
19
|
|
|
16
20
|
const InputSearch = forwardRef(
|
|
17
21
|
(
|
|
@@ -29,6 +33,7 @@ const InputSearch = forwardRef(
|
|
|
29
33
|
style,
|
|
30
34
|
defaultValue,
|
|
31
35
|
onPressButtonText,
|
|
36
|
+
trackingParams,
|
|
32
37
|
...props
|
|
33
38
|
}: InputSearchProps,
|
|
34
39
|
ref,
|
|
@@ -38,6 +43,7 @@ const InputSearch = forwardRef(
|
|
|
38
43
|
const [haveValue, setHaveValue] = useState(!!value || !!defaultValue);
|
|
39
44
|
const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
|
|
40
45
|
const accessibilityLabel = `InputMoney/${placeholder}`;
|
|
46
|
+
const screenInfo = useContext<ScreenInfo>(ScreenContext);
|
|
41
47
|
|
|
42
48
|
const _onFocus = (e: NativeSyntheticEvent<TextInputFocusEventData>) => {
|
|
43
49
|
setFocused(true);
|
|
@@ -119,35 +125,45 @@ const InputSearch = forwardRef(
|
|
|
119
125
|
);
|
|
120
126
|
};
|
|
121
127
|
return (
|
|
122
|
-
<
|
|
123
|
-
|
|
124
|
-
|
|
128
|
+
<ScreenContext.Provider
|
|
129
|
+
value={{
|
|
130
|
+
...screenInfo,
|
|
131
|
+
componentName: 'InputSearch',
|
|
132
|
+
params: trackingParams,
|
|
133
|
+
state: 'enabled',
|
|
134
|
+
}}>
|
|
125
135
|
<View
|
|
126
|
-
style={[
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
136
|
+
style={[style, styles.searchInputContainer]}
|
|
137
|
+
accessibilityLabel={accessibilityLabel}>
|
|
138
|
+
<View
|
|
139
|
+
style={[
|
|
140
|
+
styles.searchInputWrapper,
|
|
141
|
+
{
|
|
142
|
+
backgroundColor: theme.colors.background.surface,
|
|
143
|
+
borderColor: theme.colors.background.surface,
|
|
144
|
+
},
|
|
145
|
+
showBorder && {borderColor: theme.colors.border.default},
|
|
146
|
+
focused && {borderColor: theme.colors.primary},
|
|
147
|
+
]}>
|
|
148
|
+
<Icon
|
|
149
|
+
source={'navigation_search'}
|
|
150
|
+
size={24}
|
|
151
|
+
color={theme.colors.text.hint}
|
|
152
|
+
/>
|
|
153
|
+
{renderInputView()}
|
|
154
|
+
{renderIconView()}
|
|
155
|
+
</View>
|
|
156
|
+
{showButtonText && (
|
|
157
|
+
<TouchableOpacity onPress={onPressButtonText}>
|
|
158
|
+
<Text
|
|
159
|
+
typography={'action_default_bold'}
|
|
160
|
+
style={styles.textButton}>
|
|
161
|
+
{buttonText}
|
|
162
|
+
</Text>
|
|
163
|
+
</TouchableOpacity>
|
|
164
|
+
)}
|
|
142
165
|
</View>
|
|
143
|
-
|
|
144
|
-
<TouchableOpacity onPress={onPressButtonText}>
|
|
145
|
-
<Text typography={'action_default'} style={styles.textButton}>
|
|
146
|
-
{buttonText}
|
|
147
|
-
</Text>
|
|
148
|
-
</TouchableOpacity>
|
|
149
|
-
)}
|
|
150
|
-
</View>
|
|
166
|
+
</ScreenContext.Provider>
|
|
151
167
|
);
|
|
152
168
|
},
|
|
153
169
|
);
|
package/Input/InputTextArea.tsx
CHANGED
|
@@ -71,7 +71,9 @@ const InputTextArea = forwardRef(
|
|
|
71
71
|
const renderCountingView = () => {
|
|
72
72
|
return (
|
|
73
73
|
<View style={styles.countingView}>
|
|
74
|
-
<Text
|
|
74
|
+
<Text
|
|
75
|
+
color={theme.colors.text.hint}
|
|
76
|
+
typography={'description_xs_regular'}>
|
|
75
77
|
{`${inputValue.length}/${maxLength}`}
|
|
76
78
|
</Text>
|
|
77
79
|
</View>
|
package/Input/common.tsx
CHANGED
|
@@ -64,7 +64,7 @@ export const ErrorView: FC<{errorMessage?: string; errorSpacing?: boolean}> = ({
|
|
|
64
64
|
style={Styles.flex}
|
|
65
65
|
color={errorColor}
|
|
66
66
|
numberOfLines={2}
|
|
67
|
-
typography={'
|
|
67
|
+
typography={'description_default_regular'}>
|
|
68
68
|
{errorMessage}
|
|
69
69
|
</Text>
|
|
70
70
|
</View>
|
|
@@ -104,10 +104,12 @@ export const FloatingView: FC<FloatingViewProps> = ({
|
|
|
104
104
|
},
|
|
105
105
|
style,
|
|
106
106
|
]}>
|
|
107
|
-
<Text color={floatingTextColor} typography={'
|
|
107
|
+
<Text color={floatingTextColor} typography={'label_s_medium'}>
|
|
108
108
|
{floatingValue}
|
|
109
109
|
{required && (
|
|
110
|
-
<Text
|
|
110
|
+
<Text
|
|
111
|
+
typography={'label_s_medium'}
|
|
112
|
+
color={theme.colors.error.primary}>
|
|
111
113
|
*
|
|
112
114
|
</Text>
|
|
113
115
|
)}
|
package/Input/index.tsx
CHANGED
|
@@ -80,6 +80,8 @@ export interface InputProps extends TextInputProps {
|
|
|
80
80
|
fontWeight?: 'Regular' | 'Bold';
|
|
81
81
|
|
|
82
82
|
onPressIcon?: () => void;
|
|
83
|
+
|
|
84
|
+
trackingParams?: any;
|
|
83
85
|
}
|
|
84
86
|
|
|
85
87
|
type InputPropsWithoutSizeAndIcon = Omit<
|
|
@@ -126,6 +128,8 @@ export interface InputSearchProps extends TextInputProps {
|
|
|
126
128
|
* Optional. Represents the name or key of the icon to be displayed in the Input component.
|
|
127
129
|
*/
|
|
128
130
|
icon?: string;
|
|
131
|
+
|
|
132
|
+
trackingParams?: any;
|
|
129
133
|
}
|
|
130
134
|
|
|
131
135
|
export interface InputMoneyProps extends InputPropsWithoutPlaceholder {}
|
package/Layout/Card.tsx
CHANGED
|
@@ -29,7 +29,7 @@ const Card: React.FC<CardProps> = ({
|
|
|
29
29
|
useShadow = false,
|
|
30
30
|
...props
|
|
31
31
|
}) => {
|
|
32
|
-
const {showGrid} = useContext(ApplicationContext);
|
|
32
|
+
const {showGrid, theme} = useContext(ApplicationContext);
|
|
33
33
|
const {numberOfColumns} = useGridSystem();
|
|
34
34
|
|
|
35
35
|
const gutterSize = 8;
|
|
@@ -47,6 +47,7 @@ const Card: React.FC<CardProps> = ({
|
|
|
47
47
|
return span * sizePerSpan + (span - 1) * gutterSize;
|
|
48
48
|
},
|
|
49
49
|
};
|
|
50
|
+
|
|
50
51
|
/**
|
|
51
52
|
* render overlay only dev mode
|
|
52
53
|
*/
|
|
@@ -107,8 +108,9 @@ const Card: React.FC<CardProps> = ({
|
|
|
107
108
|
if (Array.isArray(children)) {
|
|
108
109
|
let cursor = 0;
|
|
109
110
|
let rows: any[] = [];
|
|
110
|
-
|
|
111
|
-
|
|
111
|
+
const arrayChild = children.filter(item => !!item);
|
|
112
|
+
for (let i = 0; i < arrayChild.length; ++i) {
|
|
113
|
+
const item = arrayChild[i];
|
|
112
114
|
const totalSpan = rows
|
|
113
115
|
.concat([item])
|
|
114
116
|
.map(i => i.props?.widthSpan)
|
|
@@ -124,7 +126,7 @@ const Card: React.FC<CardProps> = ({
|
|
|
124
126
|
rows = [item];
|
|
125
127
|
}
|
|
126
128
|
|
|
127
|
-
if (i ==
|
|
129
|
+
if (i == arrayChild.length - 1) {
|
|
128
130
|
cursor += 1;
|
|
129
131
|
element.push(addRowView(rows, cursor, true));
|
|
130
132
|
}
|
|
@@ -138,23 +140,21 @@ const Card: React.FC<CardProps> = ({
|
|
|
138
140
|
return element;
|
|
139
141
|
};
|
|
140
142
|
|
|
141
|
-
const {theme} = useContext(ApplicationContext);
|
|
142
143
|
return (
|
|
143
144
|
<GridContext.Provider value={gridContext}>
|
|
144
145
|
<View
|
|
145
146
|
{...props}
|
|
146
147
|
accessibilityLabel={`Card`}
|
|
147
148
|
style={[
|
|
149
|
+
{backgroundColor: theme.colors.background.surface},
|
|
148
150
|
style,
|
|
149
151
|
styles.protectedStyle,
|
|
150
152
|
styles.card,
|
|
151
153
|
{
|
|
152
154
|
width: widthSection,
|
|
153
155
|
marginHorizontal: margin,
|
|
154
|
-
backgroundColor: backgroundImage
|
|
155
|
-
? undefined
|
|
156
|
-
: theme.colors.background.surface,
|
|
157
156
|
},
|
|
157
|
+
!!backgroundImage && {backgroundColor: undefined},
|
|
158
158
|
useShadow && Shadow.Light,
|
|
159
159
|
]}>
|
|
160
160
|
{!!backgroundImage && (
|