@momo-kits/foundation 0.81.43 → 0.88.1-beta.1
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/Layout/ItemList.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, {forwardRef, useContext} from 'react';
|
|
2
2
|
import {FlatList, FlatListProps, View} from 'react-native';
|
|
3
3
|
import Item, {SpanNumber} from './Item';
|
|
4
4
|
import {GridContext} from './index';
|
|
@@ -11,39 +11,45 @@ export interface ItemListProps extends FlatListProps<any> {
|
|
|
11
11
|
widthSpan?: SpanNumber;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
const ItemList
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
14
|
+
const ItemList = forwardRef(
|
|
15
|
+
(
|
|
16
|
+
{
|
|
17
|
+
renderItem,
|
|
18
|
+
widthSpan,
|
|
19
|
+
style,
|
|
20
|
+
contentContainerStyle,
|
|
21
|
+
...props
|
|
22
|
+
}: ItemListProps,
|
|
23
|
+
ref,
|
|
24
|
+
) => {
|
|
25
|
+
const {gutterSize, numberOfColumns} = useContext(GridContext);
|
|
26
|
+
const widthItem = (widthSpan ?? numberOfColumns) as SpanNumber;
|
|
27
|
+
const numColumns = Math.floor(numberOfColumns / widthItem);
|
|
28
|
+
const indexBegin = props?.data?.map((_i, index) => index * numColumns);
|
|
29
|
+
const _renderItem = (item: any) => {
|
|
30
|
+
if (indexBegin?.includes(item?.index)) {
|
|
31
|
+
return <Item widthSpan={widthItem}>{renderItem?.(item)}</Item>;
|
|
32
|
+
}
|
|
33
|
+
return (
|
|
34
|
+
<View style={{paddingLeft: gutterSize}}>
|
|
35
|
+
<Item widthSpan={widthItem}>{renderItem?.(item)}</Item>
|
|
36
|
+
</View>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
29
40
|
return (
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
41
|
+
<FlatList
|
|
42
|
+
ref={ref as React.RefObject<FlatList>}
|
|
43
|
+
{...props}
|
|
44
|
+
numColumns={numColumns}
|
|
45
|
+
renderItem={_renderItem}
|
|
46
|
+
horizontal={false}
|
|
47
|
+
ItemSeparatorComponent={() => <View style={{height: gutterSize}} />}
|
|
48
|
+
style={[style, styles.protectedStyle]}
|
|
49
|
+
contentContainerStyle={[contentContainerStyle, styles.protectedStyle]}
|
|
50
|
+
/>
|
|
33
51
|
);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<FlatList
|
|
38
|
-
{...props}
|
|
39
|
-
numColumns={numColumns}
|
|
40
|
-
renderItem={_renderItem}
|
|
41
|
-
horizontal={false}
|
|
42
|
-
ItemSeparatorComponent={() => <View style={{height: gutterSize}} />}
|
|
43
|
-
style={[style, styles.protectedStyle]}
|
|
44
|
-
contentContainerStyle={[contentContainerStyle, styles.protectedStyle]}
|
|
45
|
-
/>
|
|
46
|
-
);
|
|
47
|
-
};
|
|
52
|
+
},
|
|
53
|
+
);
|
|
48
54
|
|
|
49
55
|
export default ItemList;
|
package/Layout/Section.tsx
CHANGED
|
@@ -107,8 +107,9 @@ const Section: React.FC<SectionProps> = ({
|
|
|
107
107
|
if (Array.isArray(children)) {
|
|
108
108
|
let cursor = 0;
|
|
109
109
|
let rows: any[] = [];
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
const arrayChild = children.filter(item => !!item);
|
|
111
|
+
for (let i = 0; i < arrayChild.length; ++i) {
|
|
112
|
+
const item = arrayChild[i];
|
|
112
113
|
const totalSpan = rows
|
|
113
114
|
.concat([item])
|
|
114
115
|
.map(i => i.props?.widthSpan)
|
|
@@ -124,7 +125,7 @@ const Section: React.FC<SectionProps> = ({
|
|
|
124
125
|
rows = [item];
|
|
125
126
|
}
|
|
126
127
|
|
|
127
|
-
if (i ==
|
|
128
|
+
if (i == arrayChild.length - 1) {
|
|
128
129
|
cursor += 1;
|
|
129
130
|
element.push(addRowView(rows, cursor, true));
|
|
130
131
|
}
|
|
@@ -13,7 +13,7 @@ const PaginationNumber: FC<ChildPaginationProps> = ({
|
|
|
13
13
|
return (
|
|
14
14
|
<View style={[style, styles.row]}>
|
|
15
15
|
<View style={styles.paginationNumberContainer}>
|
|
16
|
-
<Text color={Colors.black_01} typography={'
|
|
16
|
+
<Text color={Colors.black_01} typography={'label_default_medium'}>{`${
|
|
17
17
|
activeIndex + 1
|
|
18
18
|
}/${dataLength}`}</Text>
|
|
19
19
|
</View>
|
package/Popup/PopupNotify.tsx
CHANGED
|
@@ -192,12 +192,12 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
192
192
|
]}>
|
|
193
193
|
{!!image && <Image source={{uri: image}} style={styles.image} />}
|
|
194
194
|
<View style={styles.content}>
|
|
195
|
-
<Text typography={'
|
|
195
|
+
<Text typography={'header_default_bold'} numberOfLines={1}>
|
|
196
196
|
{title}
|
|
197
197
|
</Text>
|
|
198
198
|
<Description style={[styles.description, descriptionStyle]}>
|
|
199
199
|
<Text
|
|
200
|
-
typography={'
|
|
200
|
+
typography={'body_default_regular'}
|
|
201
201
|
onTextLayout={({nativeEvent: {lines}}) => {
|
|
202
202
|
const enableScroll = lines.length > 3;
|
|
203
203
|
if (enableScroll != scrollContent) {
|
|
@@ -210,7 +210,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
210
210
|
{!!error && (
|
|
211
211
|
<View style={styles.information}>
|
|
212
212
|
<Text
|
|
213
|
-
typography={'
|
|
213
|
+
typography={'description_xs_regular'}
|
|
214
214
|
color={theme.colors.text.hint}
|
|
215
215
|
numberOfLines={1}>
|
|
216
216
|
{translate?.('errorCode')}
|
package/Radio/index.tsx
CHANGED
|
@@ -7,6 +7,10 @@ import styles from './styles';
|
|
|
7
7
|
import {ApplicationContext} from '../Application';
|
|
8
8
|
import {Spacing} from '../Consts';
|
|
9
9
|
|
|
10
|
+
const {
|
|
11
|
+
ScreenContext,
|
|
12
|
+
} = require('react-native/Libraries/Components/ScreenContext');
|
|
13
|
+
|
|
10
14
|
const Radio: FC<RadioProps> = ({
|
|
11
15
|
value,
|
|
12
16
|
groupValue,
|
|
@@ -37,28 +41,38 @@ const Radio: FC<RadioProps> = ({
|
|
|
37
41
|
};
|
|
38
42
|
}
|
|
39
43
|
|
|
44
|
+
const screenInfo = useContext<any>(ScreenContext);
|
|
45
|
+
|
|
40
46
|
return (
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
{
|
|
48
|
-
flexDirection: 'row',
|
|
49
|
-
alignItems: 'center',
|
|
47
|
+
<ScreenContext.Provider
|
|
48
|
+
value={{
|
|
49
|
+
...screenInfo,
|
|
50
|
+
componentName: 'Radio',
|
|
51
|
+
params: {
|
|
52
|
+
value,
|
|
50
53
|
},
|
|
51
|
-
|
|
52
|
-
<
|
|
54
|
+
}}>
|
|
55
|
+
<TouchableOpacity
|
|
56
|
+
onPress={onChange}
|
|
57
|
+
disabled={disabled}
|
|
53
58
|
style={[
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
style,
|
|
60
|
+
{
|
|
61
|
+
flexDirection: 'row',
|
|
62
|
+
alignItems: 'center',
|
|
63
|
+
},
|
|
64
|
+
]}>
|
|
65
|
+
<View
|
|
66
|
+
style={[
|
|
67
|
+
styles.radio,
|
|
68
|
+
checkBoxStyle,
|
|
69
|
+
disabledStyle,
|
|
70
|
+
{marginRight: label ? Spacing.XS : 0},
|
|
71
|
+
]}
|
|
72
|
+
/>
|
|
73
|
+
{!!label && <Text typography={'body_default_regular'}>{label}</Text>}
|
|
74
|
+
</TouchableOpacity>
|
|
75
|
+
</ScreenContext.Provider>
|
|
62
76
|
);
|
|
63
77
|
};
|
|
64
78
|
|
package/Switch/index.tsx
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
import React, {FC} from 'react';
|
|
1
|
+
import React, {FC, useContext} from 'react';
|
|
2
2
|
import {TouchableOpacity, View} from 'react-native';
|
|
3
3
|
import {SwitchProps} from './types';
|
|
4
4
|
import styles from './styles';
|
|
5
5
|
import {Colors} from '../Consts';
|
|
6
6
|
|
|
7
|
+
const {
|
|
8
|
+
ScreenContext,
|
|
9
|
+
} = require('react-native/Libraries/Components/ScreenContext');
|
|
10
|
+
|
|
7
11
|
const Switch: FC<SwitchProps> = props => {
|
|
8
12
|
const {value, onChange, disabled, style} = props;
|
|
9
13
|
const circleBackgroundColor = value ? Colors.black_01 : Colors.black_03;
|
|
10
14
|
const circleAlign = value ? 'flex-end' : 'flex-start';
|
|
15
|
+
const screenInfo = useContext<any>(ScreenContext);
|
|
11
16
|
|
|
12
17
|
let backgroundColor = value ? Colors.green_03 : Colors.black_07;
|
|
13
18
|
if (disabled) {
|
|
@@ -15,19 +20,27 @@ const Switch: FC<SwitchProps> = props => {
|
|
|
15
20
|
}
|
|
16
21
|
|
|
17
22
|
return (
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
<ScreenContext.Provider
|
|
24
|
+
value={{
|
|
25
|
+
...screenInfo,
|
|
26
|
+
componentName: 'Switch',
|
|
27
|
+
params: {
|
|
28
|
+
value,
|
|
29
|
+
},
|
|
30
|
+
}}>
|
|
31
|
+
<TouchableOpacity
|
|
32
|
+
disabled={disabled}
|
|
33
|
+
onPress={() => onChange?.(!value)}
|
|
34
|
+
style={[
|
|
35
|
+
style,
|
|
36
|
+
styles.container,
|
|
37
|
+
{backgroundColor, alignItems: circleAlign},
|
|
38
|
+
]}>
|
|
39
|
+
<View style={[styles.circle, {backgroundColor: circleBackgroundColor}]}>
|
|
40
|
+
<View style={[styles.circleSmall, {backgroundColor}]} />
|
|
41
|
+
</View>
|
|
42
|
+
</TouchableOpacity>
|
|
43
|
+
</ScreenContext.Provider>
|
|
31
44
|
);
|
|
32
45
|
};
|
|
33
46
|
|
package/Tag/index.tsx
CHANGED
package/Text/index.tsx
CHANGED
|
@@ -84,6 +84,7 @@ const Text: React.FC<TextProps> = ({
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
return {
|
|
87
|
+
...typoStyle,
|
|
87
88
|
fontFamily,
|
|
88
89
|
fontSize: scaleSize(fontSize),
|
|
89
90
|
lineHeight: scaleSize(lineHeight),
|
|
@@ -104,7 +105,7 @@ const Text: React.FC<TextProps> = ({
|
|
|
104
105
|
};
|
|
105
106
|
|
|
106
107
|
Text.defaultProps = {
|
|
107
|
-
typography: '
|
|
108
|
+
typography: 'body_default_regular',
|
|
108
109
|
};
|
|
109
110
|
|
|
110
111
|
export {Text, scaleSize};
|
package/Text/styles.ts
CHANGED
|
@@ -1,4 +1,42 @@
|
|
|
1
1
|
export default {
|
|
2
|
+
headline_default_bold: {fontSize: 24, lineHeight: 32, fontWeight: '700'},
|
|
3
|
+
header_m_bold: {fontSize: 18, lineHeight: 28, fontWeight: '700'},
|
|
4
|
+
header_default_bold: {fontSize: 16, lineHeight: 22, fontWeight: '700'},
|
|
5
|
+
header_s_semibold: {fontSize: 14, lineHeight: 20, fontWeight: '600'},
|
|
6
|
+
header_xs_semibold: {fontSize: 12, lineHeight: 16, fontWeight: '600'},
|
|
7
|
+
body_default_regular: {fontSize: 14, lineHeight: 20, fontWeight: '400'},
|
|
8
|
+
body_regularstrikethrought: {
|
|
9
|
+
fontSize: 14,
|
|
10
|
+
lineHeight: 20,
|
|
11
|
+
fontWeight: '400',
|
|
12
|
+
textDecorationLine: 'line-through',
|
|
13
|
+
},
|
|
14
|
+
description_default_regular: {
|
|
15
|
+
fontSize: 12,
|
|
16
|
+
lineHeight: 16,
|
|
17
|
+
fontWeight: '400',
|
|
18
|
+
},
|
|
19
|
+
description_default_regularstrikethrought: {
|
|
20
|
+
fontSize: 12,
|
|
21
|
+
lineHeight: 16,
|
|
22
|
+
fontWeight: '400',
|
|
23
|
+
textDecorationLine: 'line-through',
|
|
24
|
+
},
|
|
25
|
+
description_xs_regular: {fontSize: 10, lineHeight: 14, fontWeight: '400'},
|
|
26
|
+
description_xs_regularstrikethrought: {
|
|
27
|
+
fontSize: 10,
|
|
28
|
+
lineHeight: 14,
|
|
29
|
+
fontWeight: '400',
|
|
30
|
+
textDecorationLine: 'line-through',
|
|
31
|
+
},
|
|
32
|
+
label_default_medium: {fontSize: 14, lineHeight: 20, fontWeight: '500'},
|
|
33
|
+
label_s_medium: {fontSize: 12, lineHeight: 16, fontWeight: '500'},
|
|
34
|
+
label_xs_medium: {fontSize: 10, lineHeight: 14, fontWeight: '500'},
|
|
35
|
+
action_default_bold: {fontSize: 16, lineHeight: 22, fontWeight: '700'},
|
|
36
|
+
action_s_bold: {fontSize: 14, lineHeight: 20, fontWeight: '700'},
|
|
37
|
+
action_xs_bold: {fontSize: 12, lineHeight: 16, fontWeight: '700'},
|
|
38
|
+
action_xxs_bold: {fontSize: 10, lineHeight: 14, fontWeight: '700'},
|
|
39
|
+
/**non-support**/
|
|
2
40
|
headline_default: {
|
|
3
41
|
fontSize: 28,
|
|
4
42
|
lineHeight: 34,
|
package/Text/types.ts
CHANGED
|
@@ -14,27 +14,21 @@ export type TypographyWeight = {
|
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
export type Typography =
|
|
17
|
-
| '
|
|
18
|
-
| '
|
|
19
|
-
| '
|
|
20
|
-
| '
|
|
21
|
-
| '
|
|
22
|
-
| '
|
|
23
|
-
| '
|
|
24
|
-
| '
|
|
25
|
-
| '
|
|
26
|
-
| '
|
|
27
|
-
| '
|
|
28
|
-
| '
|
|
29
|
-
| '
|
|
30
|
-
| '
|
|
31
|
-
| '
|
|
32
|
-
| '
|
|
33
|
-
| '
|
|
34
|
-
| '
|
|
35
|
-
| 'label_xs'
|
|
36
|
-
| 'label_s'
|
|
37
|
-
| 'action_default'
|
|
38
|
-
| 'action_xxs'
|
|
39
|
-
| 'action_xs'
|
|
40
|
-
| 'action_s';
|
|
17
|
+
| 'headline_default_bold'
|
|
18
|
+
| 'header_m_bold'
|
|
19
|
+
| 'header_default_bold'
|
|
20
|
+
| 'header_s_semibold'
|
|
21
|
+
| 'header_xs_semibold'
|
|
22
|
+
| 'body_default_regular'
|
|
23
|
+
| 'body_regularstrikethrought'
|
|
24
|
+
| 'description_default_regular'
|
|
25
|
+
| 'description_default_regularstrikethrought'
|
|
26
|
+
| 'description_xs_regular'
|
|
27
|
+
| 'description_xs_regularstrikethrought'
|
|
28
|
+
| 'label_default_medium'
|
|
29
|
+
| 'label_s_medium'
|
|
30
|
+
| 'label_xs_medium'
|
|
31
|
+
| 'action_default_bold'
|
|
32
|
+
| 'action_s_bold'
|
|
33
|
+
| 'action_xs_bold'
|
|
34
|
+
| 'action_xxs_bold';
|
package/Title/index.tsx
CHANGED
|
@@ -39,7 +39,7 @@ const Title: FC<TitleProps> = ({
|
|
|
39
39
|
const renderAction = () => {
|
|
40
40
|
return !!actionTitle && titleFlex ? (
|
|
41
41
|
<TouchableOpacity onPress={onPressAction}>
|
|
42
|
-
<Text typography={'
|
|
42
|
+
<Text typography={'action_s_bold'} color={theme.colors.primary}>
|
|
43
43
|
{actionTitle}
|
|
44
44
|
</Text>
|
|
45
45
|
</TouchableOpacity>
|
|
@@ -116,7 +116,7 @@ const Title: FC<TitleProps> = ({
|
|
|
116
116
|
{!!description && type !== 'screen' && (
|
|
117
117
|
<Text
|
|
118
118
|
numberOfLines={1}
|
|
119
|
-
typography={'
|
|
119
|
+
typography={'description_default_regular'}
|
|
120
120
|
color={theme.colors.text.secondary}>
|
|
121
121
|
{description}
|
|
122
122
|
</Text>
|
package/package.json
CHANGED
package/verify.js
CHANGED
|
@@ -27,8 +27,9 @@ try {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
if (
|
|
30
|
-
miniInfo?.
|
|
31
|
-
miniInfo?.
|
|
30
|
+
miniInfo?.dependencies?.['@momo-platform/momo-core'] &&
|
|
31
|
+
miniInfo?.dependencies?.['@momo-platform/momo-core'] !==
|
|
32
|
+
packageInfo?.version
|
|
32
33
|
) {
|
|
33
34
|
console.error(
|
|
34
35
|
`Package ${packageInfo.name} version: ${packageInfo.version} require install resolutions @momo-platform/momo-core ${packageInfo.version}`,
|