@momo-kits/foundation 0.169.7-beta.2 → 0.169.7-beta.4
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.hooks.ts +8 -8
- package/Application/BottomSheet.parts.tsx +34 -44
- package/Application/BottomSheet.tsx +37 -40
- package/Application/BottomTab/ActiveIndicator.tsx +14 -15
- package/Application/BottomTab/BottomTabBar.tsx +62 -49
- package/Application/BottomTab/BottomTabInset.tsx +4 -8
- package/Application/BottomTab/CurvedContainer.tsx +12 -14
- package/Application/BottomTab/CustomBottomTabItem.tsx +13 -13
- package/Application/BottomTab/DuoBarCompression.tsx +19 -13
- package/Application/BottomTab/DuoRailTabBar.tsx +24 -20
- package/Application/BottomTab/DuoTabBar.tsx +10 -8
- package/Application/BottomTab/TabBarIcon.tsx +29 -15
- package/Application/BottomTab/TabScreen.tsx +5 -1
- package/Application/BottomTab/index.tsx +30 -33
- package/Application/BottomTab/metrics.ts +23 -23
- package/Application/BottomTab/tabItems.ts +1 -1
- package/Application/BottomTab/usePressLift.ts +2 -2
- package/Application/Components/BackgroundImageView.tsx +0 -4
- package/Application/Components/DuoGlassBackground.tsx +4 -5
- package/Application/Components/HeaderAnimated.tsx +0 -4
- package/Application/Components/HeaderBackground.tsx +0 -4
- package/Application/Components/HeaderExtendHeader.tsx +10 -11
- package/Application/Components/HeaderLeft.tsx +1 -2
- package/Application/Components/HeaderRight.tsx +1 -2
- package/Application/Components/HeaderTitle.shared.ts +9 -11
- package/Application/Components/HeaderTitle.tsx +3 -4
- package/Application/Components/HeaderToolkitAction.tsx +20 -17
- package/Application/Components/NavigationButton.tsx +1 -2
- package/Application/Components/SearchHeader.tsx +10 -17
- package/Application/Components/TitleJourney.tsx +2 -2
- package/Application/Components/TitleLocation.tsx +2 -2
- package/Application/Components/TitleUser.tsx +2 -2
- package/Application/Components/useToolkitActions.tsx +32 -17
- package/Application/KitAdoption/AdoptionBadge.tsx +119 -0
- package/Application/KitAdoption/AdoptionProbe.tsx +166 -0
- package/Application/KitAdoption/AdoptionStore.ts +80 -0
- package/Application/KitAdoption/Authorship/utils.ts +137 -0
- package/Application/KitAdoption/Slots/utils.ts +68 -0
- package/Application/KitAdoption/constants.ts +120 -0
- package/Application/KitAdoption/index.ts +12 -0
- package/Application/KitAdoption/styles.ts +55 -0
- package/Application/KitAdoption/types.ts +61 -0
- package/Application/KitAdoption/utils.ts +376 -0
- package/Application/Localize.ts +0 -7
- package/Application/ModalScreen.tsx +10 -10
- package/Application/Navigation.ts +16 -14
- package/Application/NavigationContainer.tsx +18 -19
- package/Application/Navigator.ts +48 -20
- package/Application/ScaleSizeProvider.tsx +6 -13
- package/Application/StackScreen.tracking.ts +33 -11
- package/Application/StackScreen.tsx +54 -10
- package/Application/TooltipPortal.tsx +5 -12
- package/Application/WidgetContainer.tsx +4 -10
- package/Application/__tests__/KitAdoption.integration.test.tsx +253 -0
- package/Application/__tests__/KitAdoption.test.ts +283 -0
- package/Application/__tests__/KitAdoptionAuthorship.test.ts +132 -0
- package/Application/__tests__/KitAdoptionStore.test.ts +110 -0
- package/Application/__tests__/KitAdoptionStructural.test.ts +193 -0
- package/Application/__tests__/modalLayout.test.ts +128 -0
- package/Application/modalLayout.ts +14 -16
- package/Application/navigationOptions.tsx +17 -21
- package/Badge/Badge.tsx +0 -5
- package/Badge/BadgeDot.tsx +0 -1
- package/Badge/BadgeDotAnimation.tsx +7 -15
- package/Badge/BadgeRibbon.tsx +38 -46
- package/Badge/Shape.tsx +0 -2
- package/Badge/types.ts +2 -2
- package/Button/index.tsx +16 -5
- package/Button/utils.ts +15 -9
- package/CheckBox/index.tsx +0 -4
- package/Consts/theme.ts +10 -10
- package/Context/index.ts +1 -5
- package/Divider/DashDivider.tsx +0 -1
- package/Divider/index.tsx +0 -4
- package/FoundationList/index.tsx +0 -4
- package/Icon/index.tsx +6 -6
- package/Icon/types.ts +1 -1
- package/IconButton/index.tsx +12 -4
- package/Image/index.tsx +7 -9
- package/Input/Input.tsx +9 -8
- package/Input/InputDropDown.tsx +12 -10
- package/Input/InputMoney.tsx +8 -12
- package/Input/InputMoneyView.tsx +7 -14
- package/Input/InputOTP.tsx +33 -35
- package/Input/InputPhoneNumber.tsx +9 -8
- package/Input/InputSearch.tsx +6 -4
- package/Input/InputTextArea.tsx +0 -4
- package/Input/SearchTextTyping.tsx +0 -4
- package/Input/SystemTextInput.tsx +2 -7
- package/Input/TextTyping.tsx +0 -4
- package/Input/common.tsx +12 -26
- package/Input/index.tsx +20 -17
- package/Input/moneyUtils.ts +4 -10
- package/Input/styles.ts +5 -0
- package/Input/utils.ts +12 -14
- package/Layout/Card.tsx +4 -7
- package/Layout/FloatingButton.tsx +0 -4
- package/Layout/Item.tsx +2 -6
- package/Layout/ItemList.tsx +7 -9
- package/Layout/ItemSectionList.tsx +1 -2
- package/Layout/ReservedRegions.tsx +25 -25
- package/Layout/Screen.tsx +58 -56
- package/Layout/Section.tsx +5 -8
- package/Layout/TrackingScope.tsx +0 -1
- package/Layout/screenContent.tsx +2 -4
- package/Layout/screenFooter.tsx +18 -28
- package/Layout/screenHeader.tsx +31 -34
- package/Layout/screenQuickReturn.tsx +20 -17
- package/Layout/screenScroll.ts +7 -4
- package/Layout/screenTypes.ts +2 -3
- package/Layout/types.ts +4 -2
- package/Layout/utils.ts +37 -31
- package/Loader/DotLoader.tsx +0 -4
- package/Loader/Loader.tsx +0 -4
- package/Loader/ProgressBar.tsx +0 -1
- package/Loader/Spinner.tsx +0 -4
- package/Loader/utils.ts +7 -11
- package/Pagination/Dot.tsx +0 -4
- package/Pagination/PaginationDot.tsx +0 -1
- package/Pagination/PaginationNumber.tsx +3 -5
- package/Pagination/PaginationScroll.tsx +0 -5
- package/Pagination/PaginationWhiteDot.tsx +0 -1
- package/Pagination/index.tsx +0 -4
- package/Pagination/types.ts +2 -2
- package/Popup/PopupNotify.tsx +48 -44
- package/Popup/PopupPromotion.tsx +7 -4
- package/Popup/types.ts +4 -4
- package/Popup/utils.ts +0 -4
- package/Radio/index.tsx +0 -4
- package/Skeleton/index.tsx +0 -8
- package/Switch/index.tsx +0 -1
- package/Tag/index.tsx +1 -5
- package/Tag/types.ts +3 -3
- package/Text/index.tsx +3 -14
- package/Text/styles.ts +1 -1
- package/Text/types.ts +6 -1
- package/Text/utils.ts +4 -20
- package/Title/index.tsx +32 -41
- package/ViewBoundary/index.tsx +2 -4
- package/index.ts +6 -0
- package/package.json +1 -1
package/Badge/BadgeRibbon.tsx
CHANGED
|
@@ -8,10 +8,6 @@ import { Text } from '../Text';
|
|
|
8
8
|
import { Colors } from '../Consts';
|
|
9
9
|
import { Image } from '../Image';
|
|
10
10
|
|
|
11
|
-
/**
|
|
12
|
-
* Corner ribbon label in the warning color, skewed or `isRound`. Right-corner
|
|
13
|
-
* ribbons are rotated 180deg with the text counter-rotated to stay upright.
|
|
14
|
-
*/
|
|
15
11
|
const BadgeRibbon: FC<BadgeRibbonProps> = ({
|
|
16
12
|
position = 'top_right',
|
|
17
13
|
label = 'Label',
|
|
@@ -37,16 +33,39 @@ const BadgeRibbon: FC<BadgeRibbonProps> = ({
|
|
|
37
33
|
const textTransform = useMemo(() => [{ rotateZ: textRotate }], [textRotate]);
|
|
38
34
|
|
|
39
35
|
const ribbonTail = isUpTail ? <UpTail /> : <DownTail />;
|
|
40
|
-
const renderRoundContent = () =>
|
|
41
|
-
|
|
36
|
+
const renderRoundContent = () => (
|
|
37
|
+
<View
|
|
38
|
+
collapsable={false}
|
|
39
|
+
style={[
|
|
40
|
+
styles.ribbonContent,
|
|
41
|
+
{
|
|
42
|
+
backgroundColor: theme.colors.warning.primary,
|
|
43
|
+
marginTop: textMargin,
|
|
44
|
+
},
|
|
45
|
+
]}
|
|
46
|
+
>
|
|
47
|
+
<View
|
|
48
|
+
collapsable={false}
|
|
49
|
+
style={[styles.ribbonLabelWrapper, { transform: textTransform }]}
|
|
50
|
+
>
|
|
51
|
+
<Text
|
|
52
|
+
style={styles.ribbonLabel}
|
|
53
|
+
color={Colors.black_01}
|
|
54
|
+
typography="label_xs_medium"
|
|
55
|
+
>
|
|
56
|
+
{label}
|
|
57
|
+
</Text>
|
|
58
|
+
</View>
|
|
59
|
+
</View>
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
const renderSkewContent = () => (
|
|
63
|
+
<View style={[styles.ribbonSkewRow, { marginTop: skewMargin }]}>
|
|
42
64
|
<View
|
|
43
65
|
collapsable={false}
|
|
44
66
|
style={[
|
|
45
|
-
styles.
|
|
46
|
-
{
|
|
47
|
-
backgroundColor: theme.colors.warning.primary,
|
|
48
|
-
marginTop: textMargin,
|
|
49
|
-
},
|
|
67
|
+
styles.ribbonSkewContent,
|
|
68
|
+
{ backgroundColor: theme.colors.warning.primary },
|
|
50
69
|
]}
|
|
51
70
|
>
|
|
52
71
|
<View
|
|
@@ -62,41 +81,14 @@ const BadgeRibbon: FC<BadgeRibbonProps> = ({
|
|
|
62
81
|
</Text>
|
|
63
82
|
</View>
|
|
64
83
|
</View>
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
style={[
|
|
74
|
-
styles.ribbonSkewContent,
|
|
75
|
-
{ backgroundColor: theme.colors.warning.primary },
|
|
76
|
-
]}
|
|
77
|
-
>
|
|
78
|
-
<View
|
|
79
|
-
collapsable={false}
|
|
80
|
-
style={[styles.ribbonLabelWrapper, { transform: textTransform }]}
|
|
81
|
-
>
|
|
82
|
-
<Text
|
|
83
|
-
style={styles.ribbonLabel}
|
|
84
|
-
color={Colors.black_01}
|
|
85
|
-
typography="label_xs_medium"
|
|
86
|
-
>
|
|
87
|
-
{label}
|
|
88
|
-
</Text>
|
|
89
|
-
</View>
|
|
90
|
-
</View>
|
|
91
|
-
<Image
|
|
92
|
-
source={{
|
|
93
|
-
uri: 'https://static.momocdn.net/app/img/kits/utils/Tail_4x.png',
|
|
94
|
-
}}
|
|
95
|
-
style={styles.skew}
|
|
96
|
-
/>
|
|
97
|
-
</View>
|
|
98
|
-
);
|
|
99
|
-
};
|
|
84
|
+
<Image
|
|
85
|
+
source={{
|
|
86
|
+
uri: 'https://static.momocdn.net/app/img/kits/utils/Tail_4x.png',
|
|
87
|
+
}}
|
|
88
|
+
style={styles.skew}
|
|
89
|
+
/>
|
|
90
|
+
</View>
|
|
91
|
+
);
|
|
100
92
|
|
|
101
93
|
const content = isRound ? renderRoundContent() : renderSkewContent();
|
|
102
94
|
|
package/Badge/Shape.tsx
CHANGED
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import styles from './styles';
|
|
3
3
|
import {Image} from '../Image';
|
|
4
4
|
|
|
5
|
-
/** Ribbon tail image pointing up (the down tail rotated 180deg). */
|
|
6
5
|
const UpTail = () => {
|
|
7
6
|
return (
|
|
8
7
|
<Image
|
|
@@ -15,7 +14,6 @@ const UpTail = () => {
|
|
|
15
14
|
);
|
|
16
15
|
};
|
|
17
16
|
|
|
18
|
-
/** Ribbon tail image pointing down. */
|
|
19
17
|
const DownTail = () => {
|
|
20
18
|
return (
|
|
21
19
|
<Image
|
package/Badge/types.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {ViewStyle} from 'react-native';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Props for a Badge component. It
|
|
4
|
+
* Props for a general Badge component. It can display a wide range of badges including simple labels, numbers, or dots.
|
|
5
5
|
*/
|
|
6
6
|
export type BadgeProps = {
|
|
7
7
|
/**
|
|
@@ -20,7 +20,7 @@ export type BadgeProps = {
|
|
|
20
20
|
backgroundColor?: string;
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
*
|
|
24
24
|
*/
|
|
25
25
|
accessibilityLabel?: string;
|
|
26
26
|
};
|
package/Button/index.tsx
CHANGED
|
@@ -63,11 +63,6 @@ export interface ButtonProps extends TouchableOpacityProps {
|
|
|
63
63
|
params?: any;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
/**
|
|
67
|
-
* Design-system button: `type` sets the colors, `size` the height and text,
|
|
68
|
-
* and `loading` swaps an icon slot for a spinner. Primary buttons use the mini
|
|
69
|
-
* app gradient from `config.navigationBar.buttonColors` when set.
|
|
70
|
-
*/
|
|
71
66
|
const Button: FC<ButtonProps> = ({
|
|
72
67
|
type = 'primary',
|
|
73
68
|
size = 'large',
|
|
@@ -95,21 +90,33 @@ const Button: FC<ButtonProps> = ({
|
|
|
95
90
|
rest.accessibilityLabel,
|
|
96
91
|
);
|
|
97
92
|
|
|
93
|
+
/**
|
|
94
|
+
* animate press in (Reanimated)
|
|
95
|
+
*/
|
|
98
96
|
const animateIn = (event: GestureResponderEvent) => {
|
|
99
97
|
rest?.onPressIn?.(event);
|
|
100
98
|
pressAnim.value = withTiming(1, { duration: 100 });
|
|
101
99
|
};
|
|
102
100
|
|
|
101
|
+
/**
|
|
102
|
+
* animate press out (Reanimated)
|
|
103
|
+
*/
|
|
103
104
|
const animateOut = (event: GestureResponderEvent) => {
|
|
104
105
|
rest?.onPressOut?.(event);
|
|
105
106
|
pressAnim.value = withTiming(0, { duration: 100 });
|
|
106
107
|
};
|
|
107
108
|
|
|
109
|
+
/**
|
|
110
|
+
* export size style
|
|
111
|
+
*/
|
|
108
112
|
const getSizeStyle = () => {
|
|
109
113
|
const styleSheet: { [key: string]: any } = styles;
|
|
110
114
|
return styleSheet[size ?? 'small'];
|
|
111
115
|
};
|
|
112
116
|
|
|
117
|
+
/**
|
|
118
|
+
* render title
|
|
119
|
+
*/
|
|
113
120
|
const renderTitle = () => {
|
|
114
121
|
const typography = getTypography(size);
|
|
115
122
|
const textColor = getTextColor(type, theme, color);
|
|
@@ -120,6 +127,10 @@ const Button: FC<ButtonProps> = ({
|
|
|
120
127
|
);
|
|
121
128
|
};
|
|
122
129
|
|
|
130
|
+
/**
|
|
131
|
+
* render icon
|
|
132
|
+
* @param position
|
|
133
|
+
*/
|
|
123
134
|
const renderIcon = (position: 'left' | 'right') => {
|
|
124
135
|
const iconSize = getIconSize(size);
|
|
125
136
|
const space = getIconSpace(size);
|
package/Button/utils.ts
CHANGED
|
@@ -4,8 +4,10 @@ import { Typography } from '../Text/types';
|
|
|
4
4
|
import { ButtonProps } from './index';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* determine loading position
|
|
8
|
+
* @param left
|
|
9
|
+
* @param right
|
|
10
|
+
* @param isLeft
|
|
9
11
|
*/
|
|
10
12
|
export const shouldShowLoading = (
|
|
11
13
|
left?: string,
|
|
@@ -21,8 +23,7 @@ export const shouldShowLoading = (
|
|
|
21
23
|
};
|
|
22
24
|
|
|
23
25
|
/**
|
|
24
|
-
*
|
|
25
|
-
* overrides the outline border.
|
|
26
|
+
* export type style
|
|
26
27
|
*/
|
|
27
28
|
export const getTypeStyle = (
|
|
28
29
|
type: ButtonProps['type'],
|
|
@@ -63,7 +64,9 @@ export const getTypeStyle = (
|
|
|
63
64
|
}
|
|
64
65
|
};
|
|
65
66
|
|
|
66
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* export icon size
|
|
69
|
+
*/
|
|
67
70
|
export const getIconSize = (size: ButtonProps['size']) => {
|
|
68
71
|
switch (size) {
|
|
69
72
|
case 'large':
|
|
@@ -76,7 +79,9 @@ export const getIconSize = (size: ButtonProps['size']) => {
|
|
|
76
79
|
}
|
|
77
80
|
};
|
|
78
81
|
|
|
79
|
-
/**
|
|
82
|
+
/**
|
|
83
|
+
* export icon space
|
|
84
|
+
*/
|
|
80
85
|
export const getIconSpace = (size: ButtonProps['size']) => {
|
|
81
86
|
switch (size) {
|
|
82
87
|
case 'large':
|
|
@@ -89,7 +94,9 @@ export const getIconSpace = (size: ButtonProps['size']) => {
|
|
|
89
94
|
}
|
|
90
95
|
};
|
|
91
96
|
|
|
92
|
-
/**
|
|
97
|
+
/**
|
|
98
|
+
* export typography style
|
|
99
|
+
*/
|
|
93
100
|
export const getTypography = (size: ButtonProps['size']): Typography => {
|
|
94
101
|
switch (size) {
|
|
95
102
|
case 'large':
|
|
@@ -104,8 +111,7 @@ export const getTypography = (size: ButtonProps['size']): Typography => {
|
|
|
104
111
|
};
|
|
105
112
|
|
|
106
113
|
/**
|
|
107
|
-
*
|
|
108
|
-
* overrides the outline and text types.
|
|
114
|
+
* export text color
|
|
109
115
|
*/
|
|
110
116
|
export const getTextColor = (
|
|
111
117
|
type: ButtonProps['type'],
|
package/CheckBox/index.tsx
CHANGED
|
@@ -11,10 +11,6 @@ import {
|
|
|
11
11
|
import { Text } from '../Text';
|
|
12
12
|
import { Icon } from '../Icon';
|
|
13
13
|
|
|
14
|
-
/**
|
|
15
|
-
* Checkbox with an optional label. `indeterminate` shows a minus icon and is
|
|
16
|
-
* styled and announced as checked.
|
|
17
|
-
*/
|
|
18
14
|
const CheckBox: FC<CheckBoxProps> = ({
|
|
19
15
|
value,
|
|
20
16
|
disabled = false,
|
package/Consts/theme.ts
CHANGED
|
@@ -62,22 +62,22 @@ const defaultDarkTheme: Theme = {
|
|
|
62
62
|
secondary: Colors.pink_08,
|
|
63
63
|
gradient: '#FDCADE',
|
|
64
64
|
background: {
|
|
65
|
-
default: '#121212',
|
|
66
|
-
surface: '#1e1e1e',
|
|
65
|
+
default: '#121212', // Dark background
|
|
66
|
+
surface: '#1e1e1e', // Slightly lighter surface background
|
|
67
67
|
tonal: Colors.pink_10,
|
|
68
|
-
pressed: '#1a1a1a',
|
|
68
|
+
pressed: '#1a1a1a', // Pressed state background
|
|
69
69
|
selected: Colors.pink_11,
|
|
70
|
-
disable: '#303030',
|
|
70
|
+
disable: '#303030', // Disabled state background
|
|
71
71
|
},
|
|
72
72
|
text: {
|
|
73
|
-
default: '#ffffff',
|
|
74
|
-
secondary: '#b0b0b0',
|
|
75
|
-
hint: '#727272',
|
|
76
|
-
disable: '#505050',
|
|
73
|
+
default: '#ffffff', // White text for better contrast
|
|
74
|
+
secondary: '#b0b0b0', // Light gray secondary text
|
|
75
|
+
hint: '#727272', // Hint text color
|
|
76
|
+
disable: '#505050', // Disabled text color
|
|
77
77
|
},
|
|
78
78
|
border: {
|
|
79
|
-
default: '#2a2a2a',
|
|
80
|
-
disable: '#242424',
|
|
79
|
+
default: '#2a2a2a', // Darker borders
|
|
80
|
+
disable: '#242424', // Disabled state border color
|
|
81
81
|
},
|
|
82
82
|
success: {
|
|
83
83
|
primary: Colors.green_03,
|
package/Context/index.ts
CHANGED
|
@@ -5,15 +5,11 @@ import { defaultContext } from '../Consts';
|
|
|
5
5
|
const Context = createContext({});
|
|
6
6
|
const ApplicationContext = createContext(defaultContext);
|
|
7
7
|
|
|
8
|
-
// Shared by the host app via `Platform`; standalone falls back to a local one.
|
|
9
8
|
const MiniAppContext = (Platform as any).MiniAppContext ?? Context;
|
|
10
9
|
const ScreenContext = (Platform as any).ScreenContext ?? Context;
|
|
11
10
|
const ComponentContext = (Platform as any).ComponentContext ?? Context;
|
|
12
11
|
const SkeletonContext = createContext({ loading: false });
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated Not read: wrap the subtree in `ScaleSizeProvider`, which caps the
|
|
15
|
-
* font scale through MiniAppContext. Kept for mini apps built on older kits.
|
|
16
|
-
*/
|
|
12
|
+
/** @deprecated Max font scale is fixed at 1.5; this context is no longer read. */
|
|
17
13
|
const ScaleSizeContext = createContext<{ scaleSizeMaxRate?: number }>({
|
|
18
14
|
scaleSizeMaxRate: undefined,
|
|
19
15
|
});
|
package/Divider/DashDivider.tsx
CHANGED
|
@@ -11,7 +11,6 @@ export interface DashDividerProps {
|
|
|
11
11
|
style?: ViewStyle;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
/** 1px dashed horizontal line in the default border color. */
|
|
15
14
|
const DashDivider: React.FC<DashDividerProps> = ({ style }) => {
|
|
16
15
|
const { theme } = useContext(ApplicationContext);
|
|
17
16
|
const borderColor = theme.colors.border.default;
|
package/Divider/index.tsx
CHANGED
|
@@ -18,10 +18,6 @@ export interface DividerProps {
|
|
|
18
18
|
type?: 'dash' | 'default';
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
/**
|
|
22
|
-
* 1px horizontal line in the default border color. `type='dash'` renders
|
|
23
|
-
* `DashDivider`, which always has a 4px vertical margin.
|
|
24
|
-
*/
|
|
25
21
|
const Divider: React.FC<DividerProps> = ({
|
|
26
22
|
style,
|
|
27
23
|
useMargin = true,
|
package/FoundationList/index.tsx
CHANGED
|
@@ -5,10 +5,6 @@ import { FlatListProps } from 'react-native';
|
|
|
5
5
|
type CombinedListProps<ItemT> = FlatListProps<ItemT> &
|
|
6
6
|
Partial<FlashListProps<ItemT>>;
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
* FlashList typed to also accept FlatList props, so FlatList call sites can
|
|
10
|
-
* switch to it without type changes.
|
|
11
|
-
*/
|
|
12
8
|
const FoundationList = <ItemT,>(props: CombinedListProps<ItemT>) => {
|
|
13
9
|
return <FlashList {...props} />;
|
|
14
10
|
};
|
package/Icon/index.tsx
CHANGED
|
@@ -7,10 +7,6 @@ import { Image } from '../Image';
|
|
|
7
7
|
import { StyleSheet } from 'react-native';
|
|
8
8
|
import { Colors } from '../Consts';
|
|
9
9
|
|
|
10
|
-
/**
|
|
11
|
-
* Tinted icon from the bundled icon map (unknown names fall back to
|
|
12
|
-
* `ic_warning`) or from a URL. `color={null}` keeps the image's own colors.
|
|
13
|
-
*/
|
|
14
10
|
const Icon: React.FC<IconProps> = ({
|
|
15
11
|
source = 'ic_back',
|
|
16
12
|
size = 24,
|
|
@@ -23,6 +19,9 @@ const Icon: React.FC<IconProps> = ({
|
|
|
23
19
|
|
|
24
20
|
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
25
21
|
|
|
22
|
+
/**
|
|
23
|
+
* get icon source maps or remote http
|
|
24
|
+
*/
|
|
26
25
|
const getIconSource = (): any => {
|
|
27
26
|
if (source && !source.includes('http')) {
|
|
28
27
|
let icon: { [key: string]: { uri: string } } = IconSources;
|
|
@@ -31,8 +30,9 @@ const Icon: React.FC<IconProps> = ({
|
|
|
31
30
|
return { uri: source };
|
|
32
31
|
};
|
|
33
32
|
|
|
34
|
-
const
|
|
35
|
-
|
|
33
|
+
const tintColorProps = color !== null && {
|
|
34
|
+
tintColor: color ?? theme.colors.text.default,
|
|
35
|
+
};
|
|
36
36
|
|
|
37
37
|
return (
|
|
38
38
|
<Image
|
package/Icon/types.ts
CHANGED
package/IconButton/index.tsx
CHANGED
|
@@ -41,10 +41,6 @@ export interface IconButtonProps extends TouchableOpacityProps {
|
|
|
41
41
|
params?: any;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
/**
|
|
45
|
-
* Icon-only button. `type` sets the background and icon color; `'disabled'`
|
|
46
|
-
* also blocks presses.
|
|
47
|
-
*/
|
|
48
44
|
const IconButton: React.FC<IconButtonProps> = ({
|
|
49
45
|
type = 'primary',
|
|
50
46
|
icon,
|
|
@@ -58,6 +54,9 @@ const IconButton: React.FC<IconButtonProps> = ({
|
|
|
58
54
|
|
|
59
55
|
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
60
56
|
|
|
57
|
+
/**
|
|
58
|
+
* get size icon button
|
|
59
|
+
*/
|
|
61
60
|
const getSizeStyle = () => {
|
|
62
61
|
switch (size) {
|
|
63
62
|
case 'small':
|
|
@@ -69,10 +68,16 @@ const IconButton: React.FC<IconButtonProps> = ({
|
|
|
69
68
|
}
|
|
70
69
|
};
|
|
71
70
|
|
|
71
|
+
/**
|
|
72
|
+
* get shape icon button
|
|
73
|
+
*/
|
|
72
74
|
const getShapeStyle = () => {
|
|
73
75
|
return shape === 'square' ? styles.square : styles.circle;
|
|
74
76
|
};
|
|
75
77
|
|
|
78
|
+
/**
|
|
79
|
+
* get style for icon button by type
|
|
80
|
+
*/
|
|
76
81
|
const getTypeStyle = () => {
|
|
77
82
|
switch (type) {
|
|
78
83
|
case 'disabled':
|
|
@@ -106,6 +111,9 @@ const IconButton: React.FC<IconButtonProps> = ({
|
|
|
106
111
|
}
|
|
107
112
|
};
|
|
108
113
|
|
|
114
|
+
/**
|
|
115
|
+
* get color for icon
|
|
116
|
+
*/
|
|
109
117
|
const getIconColor = () => {
|
|
110
118
|
switch (type) {
|
|
111
119
|
case 'disabled':
|
package/Image/index.tsx
CHANGED
|
@@ -15,7 +15,6 @@ import { ImageProps } from './types';
|
|
|
15
15
|
|
|
16
16
|
type Status = 'success' | 'loading' | 'error';
|
|
17
17
|
|
|
18
|
-
/** Last path segment of a `{ uri }` source, used in QA labels; '' otherwise. */
|
|
19
18
|
export const getImageName = (source: any): string => {
|
|
20
19
|
const parts = source?.uri?.split?.('/');
|
|
21
20
|
if (parts?.length > 0) {
|
|
@@ -24,10 +23,6 @@ export const getImageName = (source: any): string => {
|
|
|
24
23
|
return '';
|
|
25
24
|
};
|
|
26
25
|
|
|
27
|
-
/**
|
|
28
|
-
* FastImage that shows a skeleton while loading (if `loading`) or inside a
|
|
29
|
-
* loading `SkeletonProvider`, and a fail icon on error.
|
|
30
|
-
*/
|
|
31
26
|
const Image: React.FC<ImageProps> = ({
|
|
32
27
|
style,
|
|
33
28
|
source,
|
|
@@ -49,12 +44,15 @@ const Image: React.FC<ImageProps> = ({
|
|
|
49
44
|
|
|
50
45
|
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
51
46
|
|
|
52
|
-
|
|
53
|
-
let accessibilityLabel: any = `img|${imageName}`;
|
|
47
|
+
let accessibilityLabel: any = `img|${getImageName(source)}`;
|
|
54
48
|
if (component?.componentId) {
|
|
55
|
-
accessibilityLabel = `${component?.componentId}|img|${
|
|
49
|
+
accessibilityLabel = `${component?.componentId}|img|${getImageName(
|
|
50
|
+
source,
|
|
51
|
+
)}`;
|
|
56
52
|
}
|
|
57
|
-
|
|
53
|
+
/**
|
|
54
|
+
* render content loading | fail | rendered
|
|
55
|
+
*/
|
|
58
56
|
const renderContent = () => {
|
|
59
57
|
if (status === 'loading' || status === 'error') {
|
|
60
58
|
let content = <Skeleton />;
|
package/Input/Input.tsx
CHANGED
|
@@ -31,8 +31,7 @@ import {
|
|
|
31
31
|
} from '../Context';
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
35
|
-
* hint row; controlled via `value` or uncontrolled via `defaultValue`.
|
|
34
|
+
* Input default component
|
|
36
35
|
*/
|
|
37
36
|
const Input = forwardRef(
|
|
38
37
|
(
|
|
@@ -132,17 +131,15 @@ const Input = forwardRef(
|
|
|
132
131
|
};
|
|
133
132
|
});
|
|
134
133
|
|
|
134
|
+
/**
|
|
135
|
+
* Render input view
|
|
136
|
+
*/
|
|
135
137
|
const renderInputView = () => {
|
|
136
138
|
const disabledColor = theme.colors.text.disable;
|
|
137
139
|
const secure = secureTextEntry;
|
|
138
140
|
let textColor = theme.colors.text.default;
|
|
139
141
|
let placeholderColor = theme.colors.text.hint;
|
|
140
142
|
let iconTintColor = trailingColor;
|
|
141
|
-
let secureTextStyle = styles.secureTextLarge;
|
|
142
|
-
|
|
143
|
-
if (size === 'small') {
|
|
144
|
-
secureTextStyle = styles.secureTextSmall;
|
|
145
|
-
}
|
|
146
143
|
|
|
147
144
|
if (disabled) {
|
|
148
145
|
textColor = disabledColor;
|
|
@@ -202,7 +199,11 @@ const Input = forwardRef(
|
|
|
202
199
|
color: textColor,
|
|
203
200
|
fontFamily: exportFontFamily(fontWeight ?? 'regular'),
|
|
204
201
|
},
|
|
205
|
-
secure &&
|
|
202
|
+
secure &&
|
|
203
|
+
haveValue &&
|
|
204
|
+
(size === 'small'
|
|
205
|
+
? styles.secureTextSmall
|
|
206
|
+
: styles.secureTextLarge),
|
|
206
207
|
]}
|
|
207
208
|
defaultValue={defaultValue}
|
|
208
209
|
allowFontScaling={false}
|
package/Input/InputDropDown.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
|
-
import { TouchableOpacity, View
|
|
2
|
+
import { TouchableOpacity, View } from 'react-native';
|
|
3
3
|
import { useComponentId } from '../Application';
|
|
4
4
|
import {
|
|
5
5
|
ApplicationContext,
|
|
@@ -18,10 +18,6 @@ import { Text, useScaleSize } from '../Text';
|
|
|
18
18
|
import styles from './styles';
|
|
19
19
|
import { Spacing } from '../Consts';
|
|
20
20
|
|
|
21
|
-
/**
|
|
22
|
-
* Pressable field styled like an input with a chevron; shows `value` or
|
|
23
|
-
* `placeholder`. Opening the picker is left to `onPress`.
|
|
24
|
-
*/
|
|
25
21
|
const InputDropDown = ({
|
|
26
22
|
value,
|
|
27
23
|
floatingValue,
|
|
@@ -54,19 +50,18 @@ const InputDropDown = ({
|
|
|
54
50
|
props.accessibilityLabel,
|
|
55
51
|
);
|
|
56
52
|
|
|
53
|
+
/**
|
|
54
|
+
* Render the input view
|
|
55
|
+
*/
|
|
57
56
|
const renderInputView = () => {
|
|
58
57
|
const disabledColor = theme.colors.text.disable;
|
|
59
58
|
let textColor = theme.colors.text.default;
|
|
60
59
|
let placeholderColor = theme.colors.text.hint;
|
|
61
|
-
let chevronStyle: ViewStyle = styles.iconViewDropDownSingle;
|
|
62
60
|
|
|
63
61
|
if (disabled) {
|
|
64
62
|
textColor = disabledColor;
|
|
65
63
|
placeholderColor = disabledColor;
|
|
66
64
|
}
|
|
67
|
-
if (multiline) {
|
|
68
|
-
chevronStyle = styles.iconViewDropDownMultiline;
|
|
69
|
-
}
|
|
70
65
|
|
|
71
66
|
return (
|
|
72
67
|
<View
|
|
@@ -116,7 +111,14 @@ const InputDropDown = ({
|
|
|
116
111
|
</Text>
|
|
117
112
|
</View>
|
|
118
113
|
</View>
|
|
119
|
-
<View
|
|
114
|
+
<View
|
|
115
|
+
style={[
|
|
116
|
+
styles.iconViewDropDown,
|
|
117
|
+
multiline
|
|
118
|
+
? styles.iconViewDropDownMultiline
|
|
119
|
+
: styles.iconViewDropDownSingle,
|
|
120
|
+
]}
|
|
121
|
+
>
|
|
120
122
|
<Icon source={'arrow_chevron_down_small'} />
|
|
121
123
|
</View>
|
|
122
124
|
</View>
|
package/Input/InputMoney.tsx
CHANGED
|
@@ -16,11 +16,6 @@ import { InputMoneyView } from './InputMoneyView';
|
|
|
16
16
|
import { findEdit, moneyFormatter } from './moneyUtils';
|
|
17
17
|
import styles from './styles';
|
|
18
18
|
|
|
19
|
-
/**
|
|
20
|
-
* Money input: keeps digits only, shows them grouped with a currency suffix and
|
|
21
|
-
* reports raw digits to `onChangeText`. On Android it restores the caret by the
|
|
22
|
-
* count of digits after it, since regrouping shifts positions.
|
|
23
|
-
*/
|
|
24
19
|
const InputMoney = forwardRef(
|
|
25
20
|
(
|
|
26
21
|
{
|
|
@@ -93,9 +88,9 @@ const InputMoney = forwardRef(
|
|
|
93
88
|
|
|
94
89
|
useEffect(() => {
|
|
95
90
|
if (!caretSelection) return;
|
|
96
|
-
setCaretSelection(current =>
|
|
97
|
-
|
|
98
|
-
|
|
91
|
+
setCaretSelection(current =>
|
|
92
|
+
current === caretSelection ? undefined : current,
|
|
93
|
+
);
|
|
99
94
|
}, [caretSelection]);
|
|
100
95
|
|
|
101
96
|
const updateDisplayValue = (numeric: string) => {
|
|
@@ -147,10 +142,11 @@ const InputMoney = forwardRef(
|
|
|
147
142
|
lastRawText.current = text;
|
|
148
143
|
const formattedEdit = findEdit(lastDisplayValue, text);
|
|
149
144
|
const rawEdit = findEdit(raw, text);
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
145
|
+
const { old, start, suffix } =
|
|
146
|
+
raw && rawEdit.size < formattedEdit.size ? rawEdit : formattedEdit;
|
|
147
|
+
caretDigitsAfter.current = parseInputText(
|
|
148
|
+
text.slice(text.length - suffix),
|
|
149
|
+
).length;
|
|
154
150
|
if (text.length < old.length && digits === numericValue) {
|
|
155
151
|
const index = parseInputText(text.slice(0, start)).length - 1;
|
|
156
152
|
if (index >= 0) {
|