@momo-kits/step 0.125.4-rc.6 → 0.150.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/StepsHorizontal.tsx +4 -4
- package/StepsVertical.tsx +31 -20
- package/package.json +18 -19
- package/publish.sh +3 -12
- package/utils.ts +2 -2
package/StepsHorizontal.tsx
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import StepIcon from './StepIcon';
|
|
10
10
|
import styles from './styles';
|
|
11
11
|
import {Step, StepsProps} from './types';
|
|
12
|
-
import {
|
|
12
|
+
import {GetStepColor, GetStepTypo} from './utils';
|
|
13
13
|
|
|
14
14
|
type TextAlign = 'left' | 'right' | 'center';
|
|
15
15
|
|
|
@@ -25,11 +25,11 @@ const StepsHorizontal: FC<StepsProps> = ({
|
|
|
25
25
|
accessibilityLabel = 'steps-horizontal',
|
|
26
26
|
}) => {
|
|
27
27
|
const [timeHeight, setTimeHeight] = useState(0);
|
|
28
|
+
const { theme } = useContext(ApplicationContext);
|
|
28
29
|
|
|
29
30
|
const renderStepItem = (item: Step, index: number) => {
|
|
30
31
|
const {title, description, error, time} = item;
|
|
31
|
-
let typoStyle =
|
|
32
|
-
const {theme} = useContext(ApplicationContext);
|
|
32
|
+
let typoStyle = GetStepTypo(activeIndex, index, error, size, 'horizontal');
|
|
33
33
|
let alignItems: FlexAlignType = 'center';
|
|
34
34
|
let textAlign: TextAlign = 'center';
|
|
35
35
|
|
|
@@ -119,7 +119,7 @@ const StepsHorizontal: FC<StepsProps> = ({
|
|
|
119
119
|
) => {
|
|
120
120
|
const {error} = item;
|
|
121
121
|
|
|
122
|
-
const stepStyle =
|
|
122
|
+
const stepStyle = GetStepColor(
|
|
123
123
|
activeIndex,
|
|
124
124
|
index,
|
|
125
125
|
error,
|
package/StepsVertical.tsx
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
ApplicationContext,
|
|
3
|
+
Colors,
|
|
4
|
+
Spacing,
|
|
5
|
+
Text,
|
|
6
|
+
} from '@momo-kits/foundation';
|
|
7
|
+
import React, { FC, useContext } from 'react';
|
|
8
|
+
import { View, TouchableOpacity } from 'react-native';
|
|
4
9
|
import StepIcon from './StepIcon';
|
|
5
10
|
import styles from './styles';
|
|
6
|
-
import {Step, StepsProps} from './types';
|
|
7
|
-
import {
|
|
11
|
+
import { Step, StepsProps } from './types';
|
|
12
|
+
import { GetStepColor, GetStepTypo } from './utils';
|
|
8
13
|
|
|
9
14
|
const StepsVertical: FC<StepsProps> = ({
|
|
10
15
|
steps,
|
|
@@ -15,15 +20,15 @@ const StepsVertical: FC<StepsProps> = ({
|
|
|
15
20
|
disabled,
|
|
16
21
|
accessibilityLabel = 'steps-vertical',
|
|
17
22
|
}) => {
|
|
18
|
-
const {theme} = useContext(ApplicationContext);
|
|
23
|
+
const { theme } = useContext(ApplicationContext);
|
|
19
24
|
|
|
20
25
|
const renderStepItem = (item: Step, index: number) => {
|
|
21
|
-
const {error, description, title, time} = item;
|
|
26
|
+
const { error, description, title, time } = item;
|
|
22
27
|
|
|
23
|
-
const stepStyle =
|
|
24
|
-
const typoStyle =
|
|
28
|
+
const stepStyle = GetStepColor(activeIndex, index, error, steps.length);
|
|
29
|
+
const typoStyle = GetStepTypo(activeIndex, index, error, size, 'vertical');
|
|
25
30
|
|
|
26
|
-
const {backgroundColor, borderColor} = stepStyle;
|
|
31
|
+
const { backgroundColor, borderColor } = stepStyle;
|
|
27
32
|
const lineColor =
|
|
28
33
|
activeIndex > index
|
|
29
34
|
? theme.colors.primary + '33'
|
|
@@ -38,7 +43,8 @@ const StepsVertical: FC<StepsProps> = ({
|
|
|
38
43
|
<Text
|
|
39
44
|
color={disabled ? theme.colors.text.disable : typoStyle.title.color}
|
|
40
45
|
typography={typoStyle.description.typography}
|
|
41
|
-
accessibilityLabel={`${accessibilityLabel}-description-${index}`}
|
|
46
|
+
accessibilityLabel={`${accessibilityLabel}-description-${index}`}
|
|
47
|
+
>
|
|
42
48
|
{description}
|
|
43
49
|
</Text>
|
|
44
50
|
);
|
|
@@ -55,13 +61,15 @@ const StepsVertical: FC<StepsProps> = ({
|
|
|
55
61
|
}}
|
|
56
62
|
disabled={disabled || !onPress}
|
|
57
63
|
onPress={() => onPress && onPress(item, index)}
|
|
58
|
-
accessibilityLabel={`${accessibilityLabel}-touch-${index}`}
|
|
64
|
+
accessibilityLabel={`${accessibilityLabel}-touch-${index}`}
|
|
65
|
+
>
|
|
59
66
|
<View
|
|
60
67
|
style={{
|
|
61
68
|
alignItems: 'center',
|
|
62
69
|
marginRight: Spacing.M,
|
|
63
70
|
minHeight: 48,
|
|
64
|
-
}}
|
|
71
|
+
}}
|
|
72
|
+
>
|
|
65
73
|
<StepIcon
|
|
66
74
|
size={size}
|
|
67
75
|
error={error}
|
|
@@ -75,25 +83,27 @@ const StepsVertical: FC<StepsProps> = ({
|
|
|
75
83
|
<View
|
|
76
84
|
style={[
|
|
77
85
|
styles.lineVertical,
|
|
78
|
-
{backgroundColor: lineColor, marginVertical: Spacing.XS},
|
|
86
|
+
{ backgroundColor: lineColor, marginVertical: Spacing.XS },
|
|
79
87
|
]}
|
|
80
88
|
/>
|
|
81
89
|
)}
|
|
82
90
|
</View>
|
|
83
|
-
<View style={{flex: 1}}>
|
|
91
|
+
<View style={{ flex: 1 }}>
|
|
84
92
|
<View
|
|
85
93
|
style={{
|
|
86
94
|
flexDirection: 'row',
|
|
87
95
|
justifyContent: 'space-between',
|
|
88
|
-
}}
|
|
96
|
+
}}
|
|
97
|
+
>
|
|
89
98
|
<Text
|
|
90
99
|
numberOfLines={2}
|
|
91
|
-
style={{marginRight: Spacing.S, flex: 1}}
|
|
100
|
+
style={{ marginRight: Spacing.S, flex: 1 }}
|
|
92
101
|
color={
|
|
93
102
|
disabled ? theme.colors.text.disable : typoStyle.title.color
|
|
94
103
|
}
|
|
95
104
|
typography={typoStyle.title.typography}
|
|
96
|
-
accessibilityLabel={`${accessibilityLabel}-title-${index}`}
|
|
105
|
+
accessibilityLabel={`${accessibilityLabel}-title-${index}`}
|
|
106
|
+
>
|
|
97
107
|
{title}
|
|
98
108
|
</Text>
|
|
99
109
|
<Text
|
|
@@ -101,7 +111,8 @@ const StepsVertical: FC<StepsProps> = ({
|
|
|
101
111
|
disabled ? theme.colors.text.disable : typoStyle.time.color
|
|
102
112
|
}
|
|
103
113
|
typography={typoStyle.time.typography}
|
|
104
|
-
accessibilityLabel={`${accessibilityLabel}-time-${index}`}
|
|
114
|
+
accessibilityLabel={`${accessibilityLabel}-time-${index}`}
|
|
115
|
+
>
|
|
105
116
|
{time}
|
|
106
117
|
</Text>
|
|
107
118
|
</View>
|
|
@@ -111,7 +122,7 @@ const StepsVertical: FC<StepsProps> = ({
|
|
|
111
122
|
);
|
|
112
123
|
};
|
|
113
124
|
return (
|
|
114
|
-
<View style={{width: '100%'}}>
|
|
125
|
+
<View style={{ width: '100%' }}>
|
|
115
126
|
{steps.map((item, index: number) => {
|
|
116
127
|
return renderStepItem(item, index);
|
|
117
128
|
})}
|
package/package.json
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
}
|
|
2
|
+
"name": "@momo-kits/step",
|
|
3
|
+
"version": "0.150.1-beta.1",
|
|
4
|
+
"private": false,
|
|
5
|
+
"main": "index.tsx",
|
|
6
|
+
"peerDependencies": {
|
|
7
|
+
"@momo-kits/foundation": "latest",
|
|
8
|
+
"react": "*",
|
|
9
|
+
"react-native": "*"
|
|
10
|
+
},
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"@momo-platform/versions": "4.1.11"
|
|
13
|
+
},
|
|
14
|
+
"license": "MoMo",
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"registry": "https://registry.npmjs.org/"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {}
|
|
19
|
+
}
|
package/publish.sh
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
|
|
3
|
-
# Prepare dist files
|
|
4
|
-
rm -rf dist
|
|
5
|
-
mkdir dist
|
|
6
|
-
rsync -r --exclude=/dist ./* dist
|
|
7
|
-
cd dist
|
|
8
|
-
|
|
9
|
-
|
|
10
3
|
if [ "$1" == "stable" ]; then
|
|
11
4
|
npm version $(npm view @momo-kits/foundation@stable version)
|
|
12
5
|
npm version patch
|
|
@@ -14,15 +7,13 @@ if [ "$1" == "stable" ]; then
|
|
|
14
7
|
elif [ "$1" == "latest" ]; then
|
|
15
8
|
npm version $(npm view @momo-kits/foundation@latest version)
|
|
16
9
|
npm publish --tag latest --access=public
|
|
17
|
-
|
|
10
|
+
elif [ "$1" == "beta" ]; then
|
|
18
11
|
npm version $(npm view @momo-kits/step@beta version)
|
|
19
12
|
npm version prerelease --preid=beta
|
|
20
13
|
npm publish --tag beta --access=public
|
|
14
|
+
else
|
|
15
|
+
npm publish --tag alpha --access=public
|
|
21
16
|
fi
|
|
22
17
|
|
|
23
18
|
PACKAGE_NAME=$(npm pkg get name)
|
|
24
19
|
NEW_PACKAGE_VERSION=$(npm pkg get version)
|
|
25
|
-
|
|
26
|
-
# Clean up
|
|
27
|
-
cd ..
|
|
28
|
-
rm -rf dist
|
package/utils.ts
CHANGED
|
@@ -58,7 +58,7 @@ const getTypoTitle = (
|
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
-
export const
|
|
61
|
+
export const GetStepTypo = (
|
|
62
62
|
activeIndex: number,
|
|
63
63
|
currentIndex: number,
|
|
64
64
|
error?: boolean,
|
|
@@ -97,7 +97,7 @@ export const getStepTypo = (
|
|
|
97
97
|
return {title, description, time};
|
|
98
98
|
};
|
|
99
99
|
|
|
100
|
-
export const
|
|
100
|
+
export const GetStepColor = (
|
|
101
101
|
activeIndex: number,
|
|
102
102
|
currentIndex: number,
|
|
103
103
|
error?: boolean,
|