@momo-kits/step 0.168.1-rn862.1 → 0.169.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/StepIcon.tsx +2 -2
- package/StepsHorizontal.tsx +27 -19
- package/StepsVertical.tsx +6 -20
- package/package.json +7 -7
- package/styles.ts +32 -0
package/StepIcon.tsx
CHANGED
|
@@ -43,7 +43,7 @@ const StepIcon: FC<StepIconProps> = ({
|
|
|
43
43
|
if (useNumber) {
|
|
44
44
|
return (
|
|
45
45
|
<Text
|
|
46
|
-
style={
|
|
46
|
+
style={styles.numberLabel}
|
|
47
47
|
typography={'header_xs_semibold'}
|
|
48
48
|
color={Colors.black_01}>
|
|
49
49
|
{index + 1}
|
|
@@ -65,7 +65,7 @@ const StepIcon: FC<StepIconProps> = ({
|
|
|
65
65
|
// render default Icon
|
|
66
66
|
return (
|
|
67
67
|
<View
|
|
68
|
-
style={[styles.currIcon, {width: contentIconSize
|
|
68
|
+
style={[styles.currIcon, {width: contentIconSize}]}
|
|
69
69
|
/>
|
|
70
70
|
);
|
|
71
71
|
}
|
package/StepsHorizontal.tsx
CHANGED
|
@@ -56,23 +56,28 @@ const StepsHorizontal: FC<StepsProps> = ({
|
|
|
56
56
|
|
|
57
57
|
const haveMarginRight =
|
|
58
58
|
index !== steps.length - 1 && align !== 'center' && align !== 'stretch';
|
|
59
|
+
const marginRight = haveMarginRight ? Spacing.XS : 0;
|
|
59
60
|
|
|
60
61
|
return (
|
|
61
62
|
<TouchableOpacity
|
|
62
63
|
key={`Step ${index}`}
|
|
63
|
-
style={
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
style={[
|
|
65
|
+
styles.flex1,
|
|
66
|
+
{
|
|
67
|
+
alignItems,
|
|
68
|
+
marginRight,
|
|
69
|
+
},
|
|
70
|
+
]}
|
|
68
71
|
disabled={disabled || !onPress}
|
|
69
72
|
onPress={() => onPress && onPress(item, index)}
|
|
70
73
|
accessibilityLabel={`${accessibilityLabel}-touch-${index}`}>
|
|
71
74
|
<View
|
|
72
|
-
style={
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
style={[
|
|
76
|
+
styles.timeContainer,
|
|
77
|
+
{
|
|
78
|
+
minHeight: timeHeight,
|
|
79
|
+
},
|
|
80
|
+
]}>
|
|
76
81
|
{!!time && (
|
|
77
82
|
<Text
|
|
78
83
|
onLayout={onTimesLayout}
|
|
@@ -114,8 +119,8 @@ const StepsHorizontal: FC<StepsProps> = ({
|
|
|
114
119
|
const renderStepIcon = (
|
|
115
120
|
item: Step,
|
|
116
121
|
index: number,
|
|
117
|
-
|
|
118
|
-
|
|
122
|
+
stepAlign: string = 'center',
|
|
123
|
+
stepDisabled?: boolean
|
|
119
124
|
) => {
|
|
120
125
|
const {error} = item;
|
|
121
126
|
|
|
@@ -124,15 +129,18 @@ const StepsHorizontal: FC<StepsProps> = ({
|
|
|
124
129
|
index,
|
|
125
130
|
error,
|
|
126
131
|
steps.length,
|
|
127
|
-
|
|
132
|
+
stepDisabled
|
|
128
133
|
);
|
|
129
134
|
const {backgroundColor, borderColor, lineColorRight, lineColorLeft} =
|
|
130
135
|
stepStyle;
|
|
131
136
|
|
|
132
137
|
const lineLeftHide =
|
|
133
|
-
(
|
|
138
|
+
(stepAlign === 'stretch' && index === 0) || stepAlign === 'left';
|
|
134
139
|
const lineRightHide =
|
|
135
|
-
(
|
|
140
|
+
(stepAlign === 'stretch' && index === steps.length - 1) ||
|
|
141
|
+
stepAlign === 'right';
|
|
142
|
+
const iconMarginRight = !lineRightHide ? Spacing.XS : 0;
|
|
143
|
+
const iconMarginLeft = !lineLeftHide ? Spacing.XS : 0;
|
|
136
144
|
|
|
137
145
|
return (
|
|
138
146
|
<View style={styles.rowStep}>
|
|
@@ -150,11 +158,11 @@ const StepsHorizontal: FC<StepsProps> = ({
|
|
|
150
158
|
<StepIcon
|
|
151
159
|
size={size}
|
|
152
160
|
error={error}
|
|
153
|
-
backgroundColor={
|
|
154
|
-
borderColor={
|
|
161
|
+
backgroundColor={stepDisabled ? Colors.pink_08 : backgroundColor}
|
|
162
|
+
borderColor={stepDisabled ? Colors.pink_10 : borderColor}
|
|
155
163
|
style={{
|
|
156
|
-
marginRight:
|
|
157
|
-
marginLeft:
|
|
164
|
+
marginRight: iconMarginRight,
|
|
165
|
+
marginLeft: iconMarginLeft,
|
|
158
166
|
marginVertical: Spacing.XS,
|
|
159
167
|
}}
|
|
160
168
|
index={index}
|
|
@@ -178,7 +186,7 @@ const StepsHorizontal: FC<StepsProps> = ({
|
|
|
178
186
|
};
|
|
179
187
|
|
|
180
188
|
return (
|
|
181
|
-
<View style={
|
|
189
|
+
<View style={styles.row}>
|
|
182
190
|
{steps.map((item, index) => {
|
|
183
191
|
return renderStepItem(item, index);
|
|
184
192
|
})}
|
package/StepsVertical.tsx
CHANGED
|
@@ -53,21 +53,12 @@ const StepsVertical: FC<StepsProps> = ({
|
|
|
53
53
|
return (
|
|
54
54
|
<TouchableOpacity
|
|
55
55
|
key={`Step ${index}`}
|
|
56
|
-
style={
|
|
57
|
-
flexDirection: 'row',
|
|
58
|
-
marginBottom: Spacing.XS,
|
|
59
|
-
}}
|
|
56
|
+
style={styles.verticalItem}
|
|
60
57
|
disabled={disabled || !onPress}
|
|
61
58
|
onPress={() => onPress && onPress(item, index)}
|
|
62
59
|
accessibilityLabel={`${accessibilityLabel}-touch-${index}`}
|
|
63
60
|
>
|
|
64
|
-
<View
|
|
65
|
-
style={{
|
|
66
|
-
alignItems: 'center',
|
|
67
|
-
marginRight: Spacing.M,
|
|
68
|
-
minHeight: 48,
|
|
69
|
-
}}
|
|
70
|
-
>
|
|
61
|
+
<View style={styles.stepIconColumn}>
|
|
71
62
|
<StepIcon
|
|
72
63
|
size={size}
|
|
73
64
|
error={error}
|
|
@@ -86,16 +77,11 @@ const StepsVertical: FC<StepsProps> = ({
|
|
|
86
77
|
/>
|
|
87
78
|
)}
|
|
88
79
|
</View>
|
|
89
|
-
<View style={
|
|
90
|
-
<View
|
|
91
|
-
style={{
|
|
92
|
-
flexDirection: 'row',
|
|
93
|
-
justifyContent: 'space-between',
|
|
94
|
-
}}
|
|
95
|
-
>
|
|
80
|
+
<View style={styles.flex1}>
|
|
81
|
+
<View style={styles.titleRow}>
|
|
96
82
|
<Text
|
|
97
83
|
numberOfLines={2}
|
|
98
|
-
style={
|
|
84
|
+
style={styles.verticalTitle}
|
|
99
85
|
color={
|
|
100
86
|
disabled ? theme.colors.text.disable : typoStyle.title.color
|
|
101
87
|
}
|
|
@@ -120,7 +106,7 @@ const StepsVertical: FC<StepsProps> = ({
|
|
|
120
106
|
);
|
|
121
107
|
};
|
|
122
108
|
return (
|
|
123
|
-
<View style={
|
|
109
|
+
<View style={styles.fullWidth}>
|
|
124
110
|
{steps.map((item, index: number) => {
|
|
125
111
|
return renderStepItem(item, index);
|
|
126
112
|
})}
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momo-kits/step",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.169.1",
|
|
4
4
|
"private": false,
|
|
5
|
-
"license": "MoMo",
|
|
6
5
|
"main": "index.tsx",
|
|
7
|
-
"publishConfig": {
|
|
8
|
-
"registry": "https://registry.npmjs.org/"
|
|
9
|
-
},
|
|
10
|
-
"dependencies": {},
|
|
11
6
|
"peerDependencies": {
|
|
12
7
|
"@momo-kits/foundation": "latest",
|
|
13
8
|
"react": "*",
|
|
14
9
|
"react-native": "*"
|
|
15
|
-
}
|
|
10
|
+
},
|
|
11
|
+
"license": "MoMo",
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"registry": "https://registry.npmjs.org/"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {}
|
|
16
16
|
}
|
package/styles.ts
CHANGED
|
@@ -44,4 +44,36 @@ export default StyleSheet.create({
|
|
|
44
44
|
borderRadius: Radius.L,
|
|
45
45
|
aspectRatio: 1,
|
|
46
46
|
},
|
|
47
|
+
row: {
|
|
48
|
+
flexDirection: 'row',
|
|
49
|
+
},
|
|
50
|
+
flex1: {
|
|
51
|
+
flex: 1,
|
|
52
|
+
},
|
|
53
|
+
fullWidth: {
|
|
54
|
+
width: '100%',
|
|
55
|
+
},
|
|
56
|
+
numberLabel: {
|
|
57
|
+
position: 'absolute',
|
|
58
|
+
},
|
|
59
|
+
timeContainer: {
|
|
60
|
+
justifyContent: 'flex-end',
|
|
61
|
+
},
|
|
62
|
+
verticalItem: {
|
|
63
|
+
flexDirection: 'row',
|
|
64
|
+
marginBottom: Spacing.XS,
|
|
65
|
+
},
|
|
66
|
+
stepIconColumn: {
|
|
67
|
+
alignItems: 'center',
|
|
68
|
+
marginRight: Spacing.M,
|
|
69
|
+
minHeight: 48,
|
|
70
|
+
},
|
|
71
|
+
titleRow: {
|
|
72
|
+
flexDirection: 'row',
|
|
73
|
+
justifyContent: 'space-between',
|
|
74
|
+
},
|
|
75
|
+
verticalTitle: {
|
|
76
|
+
marginRight: Spacing.S,
|
|
77
|
+
flex: 1,
|
|
78
|
+
},
|
|
47
79
|
});
|