@momo-kits/foundation 0.154.2-beta.4 → 0.155.1-beta.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/BottomSheet.tsx +15 -10
- package/Application/BottomTab/BottomTabBar.tsx +7 -2
- package/Application/BottomTab/CustomBottomTabItem.tsx +8 -1
- package/Application/Components/HeaderAnimated.tsx +2 -12
- package/Application/Components/HeaderBackground.tsx +7 -3
- package/Application/Components/HeaderExtendHeader.tsx +6 -12
- package/Application/Components/HeaderRight.tsx +0 -9
- package/Application/Components/HeaderTitle.tsx +13 -17
- package/Application/Components/NavigationButton.tsx +0 -9
- package/Application/Components/SearchHeader.tsx +9 -4
- package/Application/Localize.ts +2 -2
- package/Application/StackScreen.tsx +2 -11
- package/Application/index.ts +0 -2
- package/Badge/Badge.tsx +9 -2
- package/Badge/BadgeDot.tsx +15 -5
- package/Badge/BadgeRibbon.tsx +10 -2
- package/Badge/styles.ts +1 -0
- package/Button/index.tsx +7 -8
- package/Button/styles.ts +2 -0
- package/CheckBox/index.tsx +13 -2
- package/CheckBox/styles.ts +5 -4
- package/Icon/index.tsx +15 -2
- package/IconButton/index.tsx +9 -2
- package/IconButton/styles.ts +3 -2
- package/Image/index.tsx +12 -2
- package/Image/styles.ts +3 -1
- package/Input/Input.tsx +15 -2
- package/Input/InputDropDown.tsx +13 -2
- package/Input/InputMoney.tsx +15 -2
- package/Input/InputOTP.tsx +20 -3
- package/Input/InputPhoneNumber.tsx +15 -2
- package/Input/InputSearch.tsx +15 -2
- package/Input/InputTextArea.tsx +12 -10
- package/Input/styles.ts +1 -0
- package/Layout/Card.tsx +5 -1
- package/Layout/Item.tsx +5 -1
- package/Layout/Section.tsx +5 -1
- package/Layout/styles.ts +3 -2
- package/Pagination/PaginationDot.tsx +8 -2
- package/Pagination/PaginationNumber.tsx +13 -6
- package/Pagination/PaginationScroll.tsx +11 -2
- package/Pagination/PaginationWhiteDot.tsx +14 -7
- package/Pagination/styles.ts +4 -3
- package/Popup/PopupNotify.tsx +4 -1
- package/Popup/PopupPromotion.tsx +8 -2
- package/Radio/index.tsx +9 -1
- package/Radio/styles.ts +5 -4
- package/Switch/index.tsx +6 -2
- package/Switch/styles.ts +3 -1
- package/Tag/index.tsx +28 -16
- package/Title/index.tsx +10 -2
- package/Title/styles.ts +4 -3
- package/package.json +1 -1
- package/Application/TooltipPortal.tsx +0 -125
- package/Tag/styles.ts +0 -25
package/Button/index.tsx
CHANGED
|
@@ -13,6 +13,7 @@ import { useComponentId } from '../Application';
|
|
|
13
13
|
import {
|
|
14
14
|
ApplicationContext,
|
|
15
15
|
ComponentContext,
|
|
16
|
+
MiniAppContext,
|
|
16
17
|
SkeletonContext,
|
|
17
18
|
} from '../Context';
|
|
18
19
|
import { Text } from '../Text';
|
|
@@ -71,10 +72,13 @@ const Button: FC<ButtonProps> = ({
|
|
|
71
72
|
...rest
|
|
72
73
|
}) => {
|
|
73
74
|
const { theme, config } = useContext(ApplicationContext);
|
|
75
|
+
const context = useContext<any>(MiniAppContext);
|
|
74
76
|
const skeleton = useContext(SkeletonContext);
|
|
75
77
|
const animationRef = useRef<LottieView>(null);
|
|
76
78
|
const pressAnim = useSharedValue(0);
|
|
77
79
|
|
|
80
|
+
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
81
|
+
|
|
78
82
|
const componentName = 'Button';
|
|
79
83
|
const { componentId } = useComponentId(
|
|
80
84
|
`${componentName}/${title}`,
|
|
@@ -111,9 +115,7 @@ const Button: FC<ButtonProps> = ({
|
|
|
111
115
|
const hasLeft = !!left;
|
|
112
116
|
const hasRight = !!right;
|
|
113
117
|
|
|
114
|
-
const loadingOnLeft =
|
|
115
|
-
(!hasLeft && !hasRight) ||
|
|
116
|
-
(hasLeft && !hasRight);
|
|
118
|
+
const loadingOnLeft = (!hasLeft && !hasRight) || (hasLeft && !hasRight);
|
|
117
119
|
|
|
118
120
|
return isLeft === loadingOnLeft;
|
|
119
121
|
};
|
|
@@ -316,10 +318,7 @@ const Button: FC<ButtonProps> = ({
|
|
|
316
318
|
full && { width: '100%' },
|
|
317
319
|
loading && { opacity: 0.75 },
|
|
318
320
|
]);
|
|
319
|
-
const buttonStyle = StyleSheet.flatten([
|
|
320
|
-
sizeStyle,
|
|
321
|
-
typeStyle,
|
|
322
|
-
]);
|
|
321
|
+
const buttonStyle = StyleSheet.flatten([sizeStyle, typeStyle]);
|
|
323
322
|
|
|
324
323
|
const animatedStyle = useAnimatedStyle(() => {
|
|
325
324
|
return {
|
|
@@ -351,7 +350,7 @@ const Button: FC<ButtonProps> = ({
|
|
|
351
350
|
}}
|
|
352
351
|
disabled={isDisabled}
|
|
353
352
|
activeOpacity={0.75}
|
|
354
|
-
style={containerStyle}
|
|
353
|
+
style={[containerStyle, showBaseLineDebug && styles.debugBaseLine]}
|
|
355
354
|
onPressIn={animateIn}
|
|
356
355
|
onPressOut={animateOut}
|
|
357
356
|
>
|
package/Button/styles.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
|
+
import { Colors } from '../Consts';
|
|
2
3
|
|
|
3
4
|
export default StyleSheet.create({
|
|
4
5
|
large: {
|
|
@@ -60,4 +61,5 @@ export default StyleSheet.create({
|
|
|
60
61
|
skeleton: {
|
|
61
62
|
paddingHorizontal: 0,
|
|
62
63
|
},
|
|
64
|
+
debugBaseLine: { borderWidth: 1, borderColor: Colors.green_06 },
|
|
63
65
|
});
|
package/CheckBox/index.tsx
CHANGED
|
@@ -3,7 +3,11 @@ import { TouchableOpacity, View } from 'react-native';
|
|
|
3
3
|
import { CheckBoxProps } from './types';
|
|
4
4
|
import styles from './styles';
|
|
5
5
|
import { useComponentId } from '../Application';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
ApplicationContext,
|
|
8
|
+
ComponentContext,
|
|
9
|
+
MiniAppContext,
|
|
10
|
+
} from '../Context';
|
|
7
11
|
import { Text } from '../Text';
|
|
8
12
|
import { Icon } from '../Icon';
|
|
9
13
|
|
|
@@ -19,6 +23,7 @@ const CheckBox: FC<CheckBoxProps> = ({
|
|
|
19
23
|
...props
|
|
20
24
|
}) => {
|
|
21
25
|
const { theme } = useContext(ApplicationContext);
|
|
26
|
+
const context = useContext<any>(MiniAppContext);
|
|
22
27
|
const haveValue = value || indeterminate;
|
|
23
28
|
const iconSource = indeterminate ? 'ic_minus' : 'ic_checked';
|
|
24
29
|
let borderColor = theme.colors.text.default;
|
|
@@ -29,6 +34,8 @@ const CheckBox: FC<CheckBoxProps> = ({
|
|
|
29
34
|
props.accessibilityLabel,
|
|
30
35
|
);
|
|
31
36
|
|
|
37
|
+
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
38
|
+
|
|
32
39
|
if (haveValue) {
|
|
33
40
|
borderColor = theme.colors.primary;
|
|
34
41
|
backgroundColor = theme.colors.primary;
|
|
@@ -64,7 +71,11 @@ const CheckBox: FC<CheckBoxProps> = ({
|
|
|
64
71
|
disabled,
|
|
65
72
|
...accessibilityState,
|
|
66
73
|
}}
|
|
67
|
-
style={[
|
|
74
|
+
style={[
|
|
75
|
+
style,
|
|
76
|
+
styles.container,
|
|
77
|
+
showBaseLineDebug && styles.debugBaseLine,
|
|
78
|
+
]}
|
|
68
79
|
>
|
|
69
80
|
<View
|
|
70
81
|
style={[
|
package/CheckBox/styles.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {StyleSheet} from 'react-native';
|
|
2
|
-
import {Radius, Spacing} from '../Consts';
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
import { Radius, Spacing, Colors } from '../Consts';
|
|
3
3
|
|
|
4
4
|
export default StyleSheet.create({
|
|
5
5
|
checkbox: {
|
|
@@ -11,6 +11,7 @@ export default StyleSheet.create({
|
|
|
11
11
|
justifyContent: 'center',
|
|
12
12
|
alignItems: 'center',
|
|
13
13
|
},
|
|
14
|
-
container: {flexDirection: 'row', alignItems: 'center'},
|
|
15
|
-
label: {flexShrink: 1}
|
|
14
|
+
container: { flexDirection: 'row', alignItems: 'center' },
|
|
15
|
+
label: { flexShrink: 1 },
|
|
16
|
+
debugBaseLine: { borderWidth: 1, borderColor: Colors.green_06 },
|
|
16
17
|
});
|
package/Icon/index.tsx
CHANGED
|
@@ -2,8 +2,10 @@ import React, { useContext } from 'react';
|
|
|
2
2
|
import IconSources from '../Assets/icon.json';
|
|
3
3
|
import IconBankSources from '../Assets/icon_bank.json';
|
|
4
4
|
import { IconProps } from './types';
|
|
5
|
-
import { ApplicationContext } from '../Context';
|
|
5
|
+
import { ApplicationContext, MiniAppContext } from '../Context';
|
|
6
6
|
import { Image } from '../Image';
|
|
7
|
+
import { StyleSheet } from 'react-native';
|
|
8
|
+
import { Colors } from '../Consts';
|
|
7
9
|
|
|
8
10
|
const Icon: React.FC<IconProps> = ({
|
|
9
11
|
source = 'ic_back',
|
|
@@ -13,6 +15,9 @@ const Icon: React.FC<IconProps> = ({
|
|
|
13
15
|
...props
|
|
14
16
|
}) => {
|
|
15
17
|
const { theme } = useContext(ApplicationContext);
|
|
18
|
+
const context = useContext<any>(MiniAppContext);
|
|
19
|
+
|
|
20
|
+
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
16
21
|
|
|
17
22
|
/**
|
|
18
23
|
* get icon source maps or remote http
|
|
@@ -34,11 +39,19 @@ const Icon: React.FC<IconProps> = ({
|
|
|
34
39
|
{...props}
|
|
35
40
|
loading={false}
|
|
36
41
|
source={getIconSource()}
|
|
37
|
-
style={[
|
|
42
|
+
style={[
|
|
43
|
+
style,
|
|
44
|
+
{ width: size, height: size },
|
|
45
|
+
showBaseLineDebug && styles.debugBaseLine,
|
|
46
|
+
]}
|
|
38
47
|
resizeMode="contain"
|
|
39
48
|
{...tintColorProps}
|
|
40
49
|
/>
|
|
41
50
|
);
|
|
42
51
|
};
|
|
43
52
|
|
|
53
|
+
const styles = StyleSheet.create({
|
|
54
|
+
debugBaseLine: { borderWidth: 1, borderColor: Colors.green_06 },
|
|
55
|
+
});
|
|
56
|
+
|
|
44
57
|
export { Icon, IconSources, IconBankSources };
|
package/IconButton/index.tsx
CHANGED
|
@@ -4,7 +4,11 @@ import {
|
|
|
4
4
|
TouchableOpacity,
|
|
5
5
|
TouchableOpacityProps,
|
|
6
6
|
} from 'react-native';
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
ApplicationContext,
|
|
9
|
+
ComponentContext,
|
|
10
|
+
MiniAppContext,
|
|
11
|
+
} from '../Context';
|
|
8
12
|
import { Colors } from '../Consts';
|
|
9
13
|
import { Icon } from '../Icon';
|
|
10
14
|
import styles from './styles';
|
|
@@ -40,6 +44,9 @@ const IconButton: React.FC<IconButtonProps> = ({
|
|
|
40
44
|
...rest
|
|
41
45
|
}) => {
|
|
42
46
|
const { theme } = useContext(ApplicationContext);
|
|
47
|
+
const context = useContext<any>(MiniAppContext);
|
|
48
|
+
|
|
49
|
+
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
43
50
|
|
|
44
51
|
/**
|
|
45
52
|
* get size icon button
|
|
@@ -126,7 +133,7 @@ const IconButton: React.FC<IconButtonProps> = ({
|
|
|
126
133
|
{...rest}
|
|
127
134
|
disabled={type === 'disabled'}
|
|
128
135
|
activeOpacity={activeOpacity}
|
|
129
|
-
style={buttonStyle}
|
|
136
|
+
style={[buttonStyle, showBaseLineDebug && styles.debugBaseLine]}
|
|
130
137
|
>
|
|
131
138
|
<Icon size={iconSize} source={icon} color={getIconColor()} />
|
|
132
139
|
</TouchableOpacity>
|
package/IconButton/styles.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {StyleSheet} from 'react-native';
|
|
2
|
-
import {Radius} from '../Consts';
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
import { Radius, Colors } from '../Consts';
|
|
3
3
|
|
|
4
4
|
export default StyleSheet.create({
|
|
5
5
|
large: {
|
|
@@ -16,4 +16,5 @@ export default StyleSheet.create({
|
|
|
16
16
|
justifyContent: 'center',
|
|
17
17
|
alignItems: 'center',
|
|
18
18
|
},
|
|
19
|
+
debugBaseLine: { borderWidth: 1, borderColor: Colors.green_06 },
|
|
19
20
|
});
|
package/Image/index.tsx
CHANGED
|
@@ -5,6 +5,7 @@ import styles from './styles';
|
|
|
5
5
|
import {
|
|
6
6
|
ApplicationContext,
|
|
7
7
|
ComponentContext,
|
|
8
|
+
MiniAppContext,
|
|
8
9
|
SkeletonContext,
|
|
9
10
|
} from '../Context';
|
|
10
11
|
import { Skeleton } from '../Skeleton';
|
|
@@ -31,13 +32,18 @@ const Image: React.FC<ImageProps> = ({
|
|
|
31
32
|
}) => {
|
|
32
33
|
const { theme } = useContext(ApplicationContext);
|
|
33
34
|
const component: any = useContext(ComponentContext);
|
|
35
|
+
const context = useContext<any>(MiniAppContext);
|
|
34
36
|
const skeleton = useContext(SkeletonContext);
|
|
35
37
|
const error = useRef(false);
|
|
36
38
|
const [status, setStatus] = useState<Status>('success');
|
|
37
39
|
|
|
40
|
+
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
41
|
+
|
|
38
42
|
let accessibilityLabel: any = `img|${getImageName(source)}`;
|
|
39
43
|
if (component?.componentId) {
|
|
40
|
-
accessibilityLabel = `${component?.componentId}|img
|
|
44
|
+
accessibilityLabel = `${component?.componentId}|img|${getImageName(
|
|
45
|
+
source,
|
|
46
|
+
)}`;
|
|
41
47
|
}
|
|
42
48
|
/**
|
|
43
49
|
* render content loading | fail | rendered
|
|
@@ -73,7 +79,11 @@ const Image: React.FC<ImageProps> = ({
|
|
|
73
79
|
{...rest}
|
|
74
80
|
{...{ accessibilityLabel: rest.accessibilityLabel ?? accessibilityLabel }}
|
|
75
81
|
source={source}
|
|
76
|
-
style={[
|
|
82
|
+
style={[
|
|
83
|
+
styles.container,
|
|
84
|
+
style,
|
|
85
|
+
showBaseLineDebug && styles.debugBaseLine,
|
|
86
|
+
]}
|
|
77
87
|
onProgress={() => {
|
|
78
88
|
error.current = false;
|
|
79
89
|
if (status !== 'loading' && loading) {
|
package/Image/styles.ts
CHANGED
package/Input/Input.tsx
CHANGED
|
@@ -26,7 +26,11 @@ import {
|
|
|
26
26
|
import { InputProps } from './index';
|
|
27
27
|
import styles from './styles';
|
|
28
28
|
import SystemTextInput from './SystemTextInput';
|
|
29
|
-
import {
|
|
29
|
+
import {
|
|
30
|
+
ApplicationContext,
|
|
31
|
+
ComponentContext,
|
|
32
|
+
MiniAppContext,
|
|
33
|
+
} from '../Context';
|
|
30
34
|
|
|
31
35
|
/**
|
|
32
36
|
* Input default component
|
|
@@ -69,6 +73,7 @@ const Input = forwardRef(
|
|
|
69
73
|
ref,
|
|
70
74
|
) => {
|
|
71
75
|
const { theme } = useContext(ApplicationContext);
|
|
76
|
+
const context = useContext<any>(MiniAppContext);
|
|
72
77
|
const scaledFontSize = useScaleSize(14);
|
|
73
78
|
const scaleHeight = useScaleSize(size === 'small' ? 48 : 56, 1.1);
|
|
74
79
|
const [focused, setFocused] = useState(false);
|
|
@@ -76,6 +81,8 @@ const Input = forwardRef(
|
|
|
76
81
|
const inputRef = useRef<TextInput | null>(null);
|
|
77
82
|
const componentName = 'Input';
|
|
78
83
|
|
|
84
|
+
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
85
|
+
|
|
79
86
|
const { componentId } = useComponentId(
|
|
80
87
|
`${componentName}/${placeholder}`,
|
|
81
88
|
props.accessibilityLabel,
|
|
@@ -250,7 +257,13 @@ const Input = forwardRef(
|
|
|
250
257
|
state: inputState,
|
|
251
258
|
}}
|
|
252
259
|
>
|
|
253
|
-
<View
|
|
260
|
+
<View
|
|
261
|
+
style={[
|
|
262
|
+
style,
|
|
263
|
+
styles.wrapper,
|
|
264
|
+
showBaseLineDebug && styles.debugBaseLine,
|
|
265
|
+
]}
|
|
266
|
+
>
|
|
254
267
|
{renderInputView()}
|
|
255
268
|
<ErrorView
|
|
256
269
|
errorMessage={errorMessage}
|
package/Input/InputDropDown.tsx
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
2
|
import { TouchableOpacity, View } from 'react-native';
|
|
3
3
|
import { useComponentId } from '../Application';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
ApplicationContext,
|
|
6
|
+
ComponentContext,
|
|
7
|
+
MiniAppContext,
|
|
8
|
+
} from '../Context';
|
|
5
9
|
import { Icon } from '../Icon';
|
|
6
10
|
import {
|
|
7
11
|
ErrorView,
|
|
@@ -35,9 +39,12 @@ const InputDropDown = ({
|
|
|
35
39
|
...props
|
|
36
40
|
}: InputDropDownProps) => {
|
|
37
41
|
const { theme } = useContext(ApplicationContext);
|
|
42
|
+
const context = useContext<any>(MiniAppContext);
|
|
38
43
|
const scaleHeight = useScaleSize(size === 'small' ? 48 : 56, 1.1);
|
|
39
44
|
const componentName = 'InputDropDown';
|
|
40
45
|
|
|
46
|
+
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
47
|
+
|
|
41
48
|
const { componentId } = useComponentId(
|
|
42
49
|
`${componentName}/${placeholder}`,
|
|
43
50
|
props.accessibilityLabel,
|
|
@@ -133,7 +140,11 @@ const InputDropDown = ({
|
|
|
133
140
|
accessibilityLabel={`${componentId}|touch`}
|
|
134
141
|
accessibilityState={{ disabled: disabled as boolean }}
|
|
135
142
|
activeOpacity={0.6}
|
|
136
|
-
style={[
|
|
143
|
+
style={[
|
|
144
|
+
style,
|
|
145
|
+
styles.wrapper,
|
|
146
|
+
showBaseLineDebug && styles.debugBaseLine,
|
|
147
|
+
]}
|
|
137
148
|
>
|
|
138
149
|
{renderInputView()}
|
|
139
150
|
<ErrorView
|
package/Input/InputMoney.tsx
CHANGED
|
@@ -15,7 +15,11 @@ import {
|
|
|
15
15
|
View,
|
|
16
16
|
} from 'react-native';
|
|
17
17
|
import { useComponentId } from '../Application';
|
|
18
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
ApplicationContext,
|
|
20
|
+
ComponentContext,
|
|
21
|
+
MiniAppContext,
|
|
22
|
+
} from '../Context';
|
|
19
23
|
import { Icon } from '../Icon';
|
|
20
24
|
import { useScaleSize } from '../Text';
|
|
21
25
|
import { Spacing } from '../Consts';
|
|
@@ -62,6 +66,7 @@ const InputMoney = forwardRef(
|
|
|
62
66
|
ref,
|
|
63
67
|
) => {
|
|
64
68
|
const { theme } = useContext(ApplicationContext);
|
|
69
|
+
const context = useContext<any>(MiniAppContext);
|
|
65
70
|
const scaleHeight = useScaleSize(size === 'small' ? 48 : 56, 1.1);
|
|
66
71
|
const scaledFontSize = useScaleSize(20);
|
|
67
72
|
const [focused, setFocused] = useState(false);
|
|
@@ -71,6 +76,8 @@ const InputMoney = forwardRef(
|
|
|
71
76
|
const inputRef = useRef<TextInput>(null);
|
|
72
77
|
const componentName = 'InputMoney';
|
|
73
78
|
|
|
79
|
+
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
80
|
+
|
|
74
81
|
const { componentId } = useComponentId(
|
|
75
82
|
`${componentName}/${placeholder}`,
|
|
76
83
|
props.accessibilityLabel,
|
|
@@ -295,7 +302,13 @@ const InputMoney = forwardRef(
|
|
|
295
302
|
state: inputState,
|
|
296
303
|
}}
|
|
297
304
|
>
|
|
298
|
-
<View
|
|
305
|
+
<View
|
|
306
|
+
style={[
|
|
307
|
+
style,
|
|
308
|
+
styles.wrapper,
|
|
309
|
+
showBaseLineDebug && styles.debugBaseLine,
|
|
310
|
+
]}
|
|
311
|
+
>
|
|
299
312
|
{renderInputView()}
|
|
300
313
|
<ErrorView
|
|
301
314
|
errorMessage={errorMessage}
|
package/Input/InputOTP.tsx
CHANGED
|
@@ -9,6 +9,7 @@ import React, {
|
|
|
9
9
|
} from 'react';
|
|
10
10
|
import {
|
|
11
11
|
Animated,
|
|
12
|
+
PixelRatio,
|
|
12
13
|
TextInput,
|
|
13
14
|
TextInputFocusEvent,
|
|
14
15
|
TouchableOpacity,
|
|
@@ -22,7 +23,11 @@ import { CaretProps, InputOTPProps } from './index';
|
|
|
22
23
|
import styles from './styles';
|
|
23
24
|
import { Icon } from '../Icon';
|
|
24
25
|
import SystemTextInput from './SystemTextInput';
|
|
25
|
-
import {
|
|
26
|
+
import {
|
|
27
|
+
ApplicationContext,
|
|
28
|
+
ComponentContext,
|
|
29
|
+
MiniAppContext,
|
|
30
|
+
} from '../Context';
|
|
26
31
|
|
|
27
32
|
const OTPCaret: FC<CaretProps> = ({ index, length }) => {
|
|
28
33
|
const DURATION = 300;
|
|
@@ -90,9 +95,12 @@ const InputOTP = forwardRef(
|
|
|
90
95
|
const [focused, setFocused] = useState(false);
|
|
91
96
|
const inputRef = useRef<TextInput | null>(null);
|
|
92
97
|
const { theme } = useContext(ApplicationContext);
|
|
98
|
+
const context = useContext<any>(MiniAppContext);
|
|
93
99
|
|
|
94
100
|
const componentName = 'InputOTP';
|
|
95
101
|
|
|
102
|
+
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
103
|
+
|
|
96
104
|
const { componentId } = useComponentId(
|
|
97
105
|
`${componentName}/${placeholder}`,
|
|
98
106
|
props.accessibilityLabel,
|
|
@@ -135,6 +143,8 @@ const InputOTP = forwardRef(
|
|
|
135
143
|
_onChangeText('');
|
|
136
144
|
};
|
|
137
145
|
|
|
146
|
+
const fontScale = PixelRatio.getFontScale();
|
|
147
|
+
|
|
138
148
|
const renderInputs = (inputLength: number) => {
|
|
139
149
|
const TextInputs: React.ReactNode[] = [];
|
|
140
150
|
for (let i = 0; i < inputLength; i++) {
|
|
@@ -182,7 +192,8 @@ const InputOTP = forwardRef(
|
|
|
182
192
|
style={
|
|
183
193
|
(index !== value.length - 1 ||
|
|
184
194
|
(focused && value.length !== MAX_LENGTH)) && {
|
|
185
|
-
marginRight:
|
|
195
|
+
marginRight:
|
|
196
|
+
fontScale > 1 && value.length > 6 ? Spacing.M : Spacing.L,
|
|
186
197
|
}
|
|
187
198
|
}
|
|
188
199
|
typography={'header_m_bold'}
|
|
@@ -265,7 +276,13 @@ const InputOTP = forwardRef(
|
|
|
265
276
|
state: 'enabled',
|
|
266
277
|
}}
|
|
267
278
|
>
|
|
268
|
-
<View
|
|
279
|
+
<View
|
|
280
|
+
style={[
|
|
281
|
+
style,
|
|
282
|
+
styles.otpWrapper,
|
|
283
|
+
showBaseLineDebug && styles.debugBaseLine,
|
|
284
|
+
]}
|
|
285
|
+
>
|
|
269
286
|
{renderInputView()}
|
|
270
287
|
<ErrorView
|
|
271
288
|
errorMessage={errorMessage}
|
|
@@ -14,7 +14,11 @@ import {
|
|
|
14
14
|
View,
|
|
15
15
|
} from 'react-native';
|
|
16
16
|
import { useComponentId } from '../Application';
|
|
17
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
ApplicationContext,
|
|
19
|
+
ComponentContext,
|
|
20
|
+
MiniAppContext,
|
|
21
|
+
} from '../Context';
|
|
18
22
|
import { Colors, Spacing, Styles } from '../Consts';
|
|
19
23
|
import { Icon } from '../Icon';
|
|
20
24
|
import { useScaleSize, Text } from '../Text';
|
|
@@ -62,12 +66,15 @@ const InputPhoneNumber = forwardRef(
|
|
|
62
66
|
ref,
|
|
63
67
|
) => {
|
|
64
68
|
const { theme } = useContext(ApplicationContext);
|
|
69
|
+
const context = useContext<any>(MiniAppContext);
|
|
65
70
|
const scaleHeight = useScaleSize(size === 'small' ? 48 : 56, 1.1);
|
|
66
71
|
const [focused, setFocused] = useState(false);
|
|
67
72
|
const haveValue = !!value || !!defaultValue;
|
|
68
73
|
const inputRef = useRef<TextInput | null>(null);
|
|
69
74
|
const componentName = 'InputPhoneNumber';
|
|
70
75
|
|
|
76
|
+
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
77
|
+
|
|
71
78
|
const { componentId } = useComponentId(
|
|
72
79
|
`${componentName}/${placeholder}`,
|
|
73
80
|
props.accessibilityLabel,
|
|
@@ -249,7 +256,13 @@ const InputPhoneNumber = forwardRef(
|
|
|
249
256
|
state: inputState,
|
|
250
257
|
}}
|
|
251
258
|
>
|
|
252
|
-
<View
|
|
259
|
+
<View
|
|
260
|
+
style={[
|
|
261
|
+
style,
|
|
262
|
+
styles.wrapper,
|
|
263
|
+
showBaseLineDebug && styles.debugBaseLine,
|
|
264
|
+
]}
|
|
265
|
+
>
|
|
253
266
|
{renderInputView()}
|
|
254
267
|
<ErrorView
|
|
255
268
|
errorMessage={errorMessage}
|
package/Input/InputSearch.tsx
CHANGED
|
@@ -17,7 +17,11 @@ import {
|
|
|
17
17
|
View,
|
|
18
18
|
} from 'react-native';
|
|
19
19
|
import { useComponentId } from '../Application';
|
|
20
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
ApplicationContext,
|
|
22
|
+
ComponentContext,
|
|
23
|
+
MiniAppContext,
|
|
24
|
+
} from '../Context';
|
|
21
25
|
import { Icon } from '../Icon';
|
|
22
26
|
import { Text, useScaleSize } from '../Text';
|
|
23
27
|
import { InputRef, InputSearchProps } from './index';
|
|
@@ -138,8 +142,11 @@ const InputSearch: ForwardRefRenderFunction<InputRef, InputSearchProps> = (
|
|
|
138
142
|
ref,
|
|
139
143
|
) => {
|
|
140
144
|
const { theme } = useContext(ApplicationContext);
|
|
145
|
+
const context = useContext<any>(MiniAppContext);
|
|
141
146
|
const scaledFontSize = useScaleSize(14);
|
|
142
147
|
|
|
148
|
+
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
149
|
+
|
|
143
150
|
const [focused, setFocused] = useState(false);
|
|
144
151
|
const [internalText, setInternalText] = useState(defaultValue || '');
|
|
145
152
|
const currentValue = value !== undefined ? value : internalText;
|
|
@@ -298,7 +305,13 @@ const InputSearch: ForwardRefRenderFunction<InputRef, InputSearchProps> = (
|
|
|
298
305
|
state: inputState,
|
|
299
306
|
}}
|
|
300
307
|
>
|
|
301
|
-
<View
|
|
308
|
+
<View
|
|
309
|
+
style={[
|
|
310
|
+
style,
|
|
311
|
+
styles.searchInputContainer,
|
|
312
|
+
showBaseLineDebug && styles.debugBaseLine,
|
|
313
|
+
]}
|
|
314
|
+
>
|
|
302
315
|
<View
|
|
303
316
|
style={[
|
|
304
317
|
styles.searchInputWrapper,
|
package/Input/InputTextArea.tsx
CHANGED
|
@@ -13,16 +13,11 @@ import {
|
|
|
13
13
|
TouchableOpacity,
|
|
14
14
|
View,
|
|
15
15
|
} from 'react-native';
|
|
16
|
-
import { ApplicationContext } from '../Context';
|
|
16
|
+
import { ApplicationContext, MiniAppContext } from '../Context';
|
|
17
17
|
import { Icon } from '../Icon';
|
|
18
18
|
import { Text, useScaleSize } from '../Text';
|
|
19
19
|
import { Spacing } from '../Consts';
|
|
20
|
-
import {
|
|
21
|
-
ErrorView,
|
|
22
|
-
FloatingView,
|
|
23
|
-
getBorderColor,
|
|
24
|
-
MAX_LENGTH,
|
|
25
|
-
} from './common';
|
|
20
|
+
import { ErrorView, FloatingView, getBorderColor, MAX_LENGTH } from './common';
|
|
26
21
|
import { InputTextAreaProps } from './index';
|
|
27
22
|
import styles from './styles';
|
|
28
23
|
import SystemTextInput from './SystemTextInput';
|
|
@@ -52,16 +47,17 @@ const InputTextArea = forwardRef(
|
|
|
52
47
|
}: InputTextAreaProps,
|
|
53
48
|
ref,
|
|
54
49
|
) => {
|
|
55
|
-
|
|
56
50
|
const componentName = 'InputTextArea';
|
|
57
51
|
|
|
58
|
-
|
|
59
52
|
const { componentId } = useComponentId(
|
|
60
53
|
`${componentName}/${placeholder}`,
|
|
61
54
|
props.accessibilityLabel,
|
|
62
55
|
);
|
|
63
56
|
const { theme } = useContext(ApplicationContext);
|
|
57
|
+
const context = useContext<any>(MiniAppContext);
|
|
64
58
|
const DEFAULT_HEIGHT = useScaleSize(104);
|
|
59
|
+
|
|
60
|
+
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
65
61
|
const scaledFontSize = useScaleSize(14);
|
|
66
62
|
const [focused, setFocused] = useState(false);
|
|
67
63
|
const [inputValue, setInputValue] = useState(defaultValue ?? '');
|
|
@@ -201,7 +197,13 @@ const InputTextArea = forwardRef(
|
|
|
201
197
|
};
|
|
202
198
|
|
|
203
199
|
return (
|
|
204
|
-
<View
|
|
200
|
+
<View
|
|
201
|
+
style={[
|
|
202
|
+
style,
|
|
203
|
+
styles.wrapper,
|
|
204
|
+
showBaseLineDebug && styles.debugBaseLine,
|
|
205
|
+
]}
|
|
206
|
+
>
|
|
205
207
|
{renderInputView()}
|
|
206
208
|
<ErrorView
|
|
207
209
|
errorMessage={errorMessage}
|
package/Input/styles.ts
CHANGED
package/Layout/Card.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { useGridSystem } from './utils';
|
|
|
4
4
|
import { GridContextProps } from './types';
|
|
5
5
|
import { GridContext, GridSystem } from './index';
|
|
6
6
|
import { Image } from '../Image';
|
|
7
|
-
import { ApplicationContext } from '../Context';
|
|
7
|
+
import { ApplicationContext, MiniAppContext } from '../Context';
|
|
8
8
|
import styles from './styles';
|
|
9
9
|
import { Colors, Radius, Shadow, Spacing } from '../Consts';
|
|
10
10
|
|
|
@@ -28,8 +28,11 @@ const Card: React.FC<CardProps> = ({
|
|
|
28
28
|
...props
|
|
29
29
|
}) => {
|
|
30
30
|
const { showGrid, theme } = useContext(ApplicationContext);
|
|
31
|
+
const context = useContext<any>(MiniAppContext);
|
|
31
32
|
const { numberOfColumns } = useGridSystem();
|
|
32
33
|
|
|
34
|
+
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
35
|
+
|
|
33
36
|
const gutterSize = 8;
|
|
34
37
|
const margin = 12;
|
|
35
38
|
const widthSection = Dimensions.get('window').width - margin * 2;
|
|
@@ -81,6 +84,7 @@ const Card: React.FC<CardProps> = ({
|
|
|
81
84
|
},
|
|
82
85
|
!!backgroundImage && { backgroundColor: undefined },
|
|
83
86
|
useShadow && Shadow.Light,
|
|
87
|
+
showBaseLineDebug && styles.debugBaseLine,
|
|
84
88
|
]}
|
|
85
89
|
>
|
|
86
90
|
{!!backgroundImage && (
|
package/Layout/Item.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
2
|
import { View, ViewProps } from 'react-native';
|
|
3
3
|
import { GridContext } from './index';
|
|
4
|
-
import { ApplicationContext } from '../Context';
|
|
4
|
+
import { ApplicationContext, MiniAppContext } from '../Context';
|
|
5
5
|
import styles from './styles';
|
|
6
6
|
import { SpanNumber } from './types';
|
|
7
7
|
|
|
@@ -24,8 +24,11 @@ const Item: React.FC<ItemProps> = ({
|
|
|
24
24
|
style,
|
|
25
25
|
}) => {
|
|
26
26
|
const { showGrid } = useContext(ApplicationContext);
|
|
27
|
+
const context = useContext<any>(MiniAppContext);
|
|
27
28
|
const grid = useContext(GridContext);
|
|
28
29
|
|
|
30
|
+
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
31
|
+
|
|
29
32
|
/**
|
|
30
33
|
* render overlay view only dev mode
|
|
31
34
|
*/
|
|
@@ -42,6 +45,7 @@ const Item: React.FC<ItemProps> = ({
|
|
|
42
45
|
width: grid.getSizeSpan(widthSpan ?? grid.numberOfColumns),
|
|
43
46
|
height: heightSpan ? grid.getSizeSpan(heightSpan) : undefined,
|
|
44
47
|
},
|
|
48
|
+
showBaseLineDebug && styles.debugBaseLine,
|
|
45
49
|
]}
|
|
46
50
|
>
|
|
47
51
|
{children}
|