@momo-kits/step 0.103.2-rc.3 → 0.103.2-rc.30
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 +44 -16
- package/StepsHorizontal.tsx +45 -29
- package/StepsVertical.tsx +32 -18
- package/index.tsx +2 -2
- package/package.json +1 -1
- package/styles.ts +6 -2
- package/types.ts +55 -2
- package/utils.ts +19 -14
package/StepIcon.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import {Colors, Icon, Text} from '@momo-kits/foundation';
|
|
1
2
|
import React, {FC} from 'react';
|
|
2
3
|
import {View} from 'react-native';
|
|
3
|
-
import {StepIconProps} from './types';
|
|
4
4
|
import styles from './styles';
|
|
5
|
-
import {
|
|
5
|
+
import {StepIconProps} from './types';
|
|
6
6
|
|
|
7
7
|
const StepIcon: FC<StepIconProps> = ({
|
|
8
8
|
size = 'large',
|
|
@@ -12,34 +12,62 @@ const StepIcon: FC<StepIconProps> = ({
|
|
|
12
12
|
style,
|
|
13
13
|
useNumber,
|
|
14
14
|
index,
|
|
15
|
+
isActive,
|
|
16
|
+
customIcon,
|
|
15
17
|
}) => {
|
|
16
18
|
let iconStyle = styles.stepIcon;
|
|
17
19
|
let checkIconSize = 16;
|
|
18
|
-
let
|
|
20
|
+
let contentIconSize = 8;
|
|
19
21
|
|
|
20
22
|
if (size === 'small') {
|
|
21
23
|
iconStyle = styles.stepIconSmall;
|
|
22
24
|
checkIconSize = 12;
|
|
25
|
+
contentIconSize = 6;
|
|
23
26
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
|
|
28
|
+
let iconSource = error ? 'navigation_close' : 'notifications_check';
|
|
29
|
+
|
|
30
|
+
const renderIcon = () => {
|
|
31
|
+
// useNumber is true, render number
|
|
32
|
+
if (useNumber) {
|
|
33
|
+
return (
|
|
28
34
|
<Text
|
|
29
|
-
style={{
|
|
30
|
-
position: 'absolute',
|
|
31
|
-
}}
|
|
35
|
+
style={{position: 'absolute'}}
|
|
32
36
|
typography={'header_xs_semibold'}
|
|
33
37
|
color={Colors.black_01}>
|
|
34
38
|
{index + 1}
|
|
35
39
|
</Text>
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (isActive) {
|
|
44
|
+
// customIcon is true, render customIcon
|
|
45
|
+
if (customIcon) {
|
|
46
|
+
return (
|
|
47
|
+
<Icon
|
|
48
|
+
size={checkIconSize}
|
|
49
|
+
color={Colors.black_01}
|
|
50
|
+
source={customIcon}
|
|
51
|
+
/>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
// render default Icon
|
|
55
|
+
return (
|
|
56
|
+
<View
|
|
57
|
+
style={[styles.currIcon, {width: contentIconSize, aspectRatio: 1}]}
|
|
41
58
|
/>
|
|
42
|
-
)
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<Icon size={checkIconSize} color={Colors.black_01} source={iconSource} />
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<View
|
|
69
|
+
style={[iconStyle, styles.center, {backgroundColor, borderColor}, style]}>
|
|
70
|
+
{renderIcon()}
|
|
43
71
|
</View>
|
|
44
72
|
);
|
|
45
73
|
};
|
package/StepsHorizontal.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import {ApplicationContext, Colors, Spacing, Text} from '@momo-kits/foundation';
|
|
2
|
+
import React, {FC, useContext} from 'react';
|
|
3
|
+
import {FlexAlignType, TouchableOpacity, View} from 'react-native';
|
|
4
4
|
import StepIcon from './StepIcon';
|
|
5
|
-
import {Spacing, Text} from '@momo-kits/foundation';
|
|
6
|
-
import {getStepColor, getStepTypo} from './utils';
|
|
7
5
|
import styles from './styles';
|
|
6
|
+
import {Step, StepsProps} from './types';
|
|
7
|
+
import {getStepColor, getStepTypo} from './utils';
|
|
8
8
|
|
|
9
9
|
type TextAlign = 'left' | 'right' | 'center';
|
|
10
10
|
|
|
@@ -14,10 +14,14 @@ const StepsHorizontal: FC<StepsProps> = ({
|
|
|
14
14
|
activeIndex,
|
|
15
15
|
useNumber = false,
|
|
16
16
|
align = 'center',
|
|
17
|
+
customIcon,
|
|
18
|
+
onPress,
|
|
19
|
+
disabled,
|
|
17
20
|
}) => {
|
|
18
|
-
const renderStepItem = (
|
|
19
|
-
const {title, description, error, time} =
|
|
20
|
-
let typoStyle = getStepTypo(activeIndex,
|
|
21
|
+
const renderStepItem = (item: Step, index: number) => {
|
|
22
|
+
const {title, description, error, time} = item;
|
|
23
|
+
let typoStyle = getStepTypo(activeIndex, index, error, size, 'horizontal');
|
|
24
|
+
const {theme} = useContext(ApplicationContext);
|
|
21
25
|
let alignItems: FlexAlignType = 'center';
|
|
22
26
|
let textAlign: TextAlign = 'center';
|
|
23
27
|
|
|
@@ -28,39 +32,41 @@ const StepsHorizontal: FC<StepsProps> = ({
|
|
|
28
32
|
alignItems = 'flex-end';
|
|
29
33
|
textAlign = 'right';
|
|
30
34
|
} else if (align === 'stretch') {
|
|
31
|
-
if (
|
|
35
|
+
if (index === 0) {
|
|
32
36
|
alignItems = 'flex-start';
|
|
33
37
|
textAlign = 'left';
|
|
34
|
-
} else if (
|
|
38
|
+
} else if (index === steps.length - 1) {
|
|
35
39
|
textAlign = 'right';
|
|
36
40
|
alignItems = 'flex-end';
|
|
37
41
|
}
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
const haveMarginRight =
|
|
41
|
-
|
|
45
|
+
index !== steps.length - 1 && align !== 'center' && align !== 'stretch';
|
|
42
46
|
|
|
43
47
|
return (
|
|
44
|
-
<
|
|
45
|
-
key={`Step ${
|
|
48
|
+
<TouchableOpacity
|
|
49
|
+
key={`Step ${index}`}
|
|
46
50
|
style={{
|
|
47
51
|
flex: 1,
|
|
48
52
|
alignItems,
|
|
49
53
|
marginRight: haveMarginRight ? Spacing.XS : 0,
|
|
50
|
-
}}
|
|
54
|
+
}}
|
|
55
|
+
disabled={disabled || !onPress}
|
|
56
|
+
onPress={() => onPress && onPress(item, index)}>
|
|
51
57
|
{!!time && (
|
|
52
58
|
<Text
|
|
53
59
|
style={{textAlign}}
|
|
54
|
-
color={typoStyle.time.color}
|
|
60
|
+
color={disabled ? theme.colors.text.disable : typoStyle.time.color}
|
|
55
61
|
typography={typoStyle.time.typography}>
|
|
56
62
|
{time}
|
|
57
63
|
</Text>
|
|
58
64
|
)}
|
|
59
|
-
{renderStepIcon(
|
|
65
|
+
{renderStepIcon(item, index, align, false)}
|
|
60
66
|
{!!title && (
|
|
61
67
|
<Text
|
|
62
68
|
style={[styles.title, {textAlign}]}
|
|
63
|
-
color={typoStyle.title.color}
|
|
69
|
+
color={disabled ? theme.colors.text.disable : typoStyle.title.color}
|
|
64
70
|
typography={typoStyle.title.typography}>
|
|
65
71
|
{title}
|
|
66
72
|
</Text>
|
|
@@ -68,25 +74,33 @@ const StepsHorizontal: FC<StepsProps> = ({
|
|
|
68
74
|
{!!description && (
|
|
69
75
|
<Text
|
|
70
76
|
style={{textAlign}}
|
|
71
|
-
color={
|
|
77
|
+
color={
|
|
78
|
+
disabled ? theme.colors.text.disable : typoStyle.description.color
|
|
79
|
+
}
|
|
72
80
|
typography={typoStyle.description.typography}>
|
|
73
81
|
{description}
|
|
74
82
|
</Text>
|
|
75
83
|
)}
|
|
76
|
-
</
|
|
84
|
+
</TouchableOpacity>
|
|
77
85
|
);
|
|
78
86
|
};
|
|
79
87
|
|
|
80
|
-
const renderStepIcon = (
|
|
81
|
-
|
|
88
|
+
const renderStepIcon = (
|
|
89
|
+
item: Step,
|
|
90
|
+
index: number,
|
|
91
|
+
align: string = 'center',
|
|
92
|
+
disabled: boolean
|
|
93
|
+
) => {
|
|
94
|
+
const {error} = item;
|
|
82
95
|
|
|
83
|
-
const stepStyle = getStepColor(activeIndex,
|
|
96
|
+
const stepStyle = getStepColor(activeIndex, index, error, steps.length);
|
|
84
97
|
const {backgroundColor, borderColor, lineColorRight, lineColorLeft} =
|
|
85
98
|
stepStyle;
|
|
86
99
|
|
|
87
|
-
const lineLeftHide =
|
|
100
|
+
const lineLeftHide =
|
|
101
|
+
(align === 'stretch' && index === 0) || align === 'left';
|
|
88
102
|
const lineRightHide =
|
|
89
|
-
(align === 'stretch' &&
|
|
103
|
+
(align === 'stretch' && index === steps.length - 1) || align === 'right';
|
|
90
104
|
|
|
91
105
|
return (
|
|
92
106
|
<View style={styles.rowStep}>
|
|
@@ -104,15 +118,17 @@ const StepsHorizontal: FC<StepsProps> = ({
|
|
|
104
118
|
<StepIcon
|
|
105
119
|
size={size}
|
|
106
120
|
error={error}
|
|
107
|
-
backgroundColor={backgroundColor}
|
|
108
|
-
borderColor={borderColor}
|
|
121
|
+
backgroundColor={disabled ? Colors.pink_08 : backgroundColor}
|
|
122
|
+
borderColor={disabled ? Colors.pink_10 : borderColor}
|
|
109
123
|
style={{
|
|
110
124
|
marginRight: !lineRightHide ? Spacing.XS : 0,
|
|
111
125
|
marginLeft: !lineLeftHide ? Spacing.XS : 0,
|
|
112
126
|
marginVertical: Spacing.XS,
|
|
113
127
|
}}
|
|
114
|
-
index={
|
|
128
|
+
index={index}
|
|
115
129
|
useNumber={useNumber}
|
|
130
|
+
isActive={activeIndex === index}
|
|
131
|
+
customIcon={customIcon}
|
|
116
132
|
/>
|
|
117
133
|
{!lineRightHide && (
|
|
118
134
|
<View
|
|
@@ -131,8 +147,8 @@ const StepsHorizontal: FC<StepsProps> = ({
|
|
|
131
147
|
|
|
132
148
|
return (
|
|
133
149
|
<View style={{flexDirection: 'row'}}>
|
|
134
|
-
{steps.map((
|
|
135
|
-
return renderStepItem(
|
|
150
|
+
{steps.map((item, index) => {
|
|
151
|
+
return renderStepItem(item, index);
|
|
136
152
|
})}
|
|
137
153
|
</View>
|
|
138
154
|
);
|
package/StepsVertical.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import {ApplicationContext, Spacing, Text} from '@momo-kits/foundation';
|
|
1
2
|
import React, {FC, useContext} from 'react';
|
|
2
3
|
import {View} from 'react-native';
|
|
4
|
+
import StepIcon from './StepIcon';
|
|
5
|
+
import styles from './styles';
|
|
3
6
|
import {Step, StepsProps} from './types';
|
|
4
7
|
import {getStepColor, getStepTypo} from './utils';
|
|
5
|
-
import {ApplicationContext, Spacing, Text} from '@momo-kits/foundation';
|
|
6
|
-
import styles from './styles';
|
|
7
|
-
import StepIcon from './StepIcon';
|
|
8
8
|
|
|
9
9
|
const StepsVertical: FC<StepsProps> = ({
|
|
10
10
|
steps,
|
|
@@ -14,20 +14,37 @@ const StepsVertical: FC<StepsProps> = ({
|
|
|
14
14
|
}) => {
|
|
15
15
|
const {theme} = useContext(ApplicationContext);
|
|
16
16
|
|
|
17
|
-
const renderStepItem = (
|
|
18
|
-
const {error, description, title, time} =
|
|
17
|
+
const renderStepItem = (item: Step, index: number) => {
|
|
18
|
+
const {error, description, title, time} = item;
|
|
19
19
|
|
|
20
|
-
const stepStyle = getStepColor(activeIndex,
|
|
21
|
-
|
|
20
|
+
const stepStyle = getStepColor(activeIndex, index, error, steps.length);
|
|
21
|
+
const typoStyle = getStepTypo(activeIndex, index, error, size, 'vertical');
|
|
22
22
|
|
|
23
23
|
const {backgroundColor, borderColor} = stepStyle;
|
|
24
24
|
const lineColor =
|
|
25
|
-
activeIndex >
|
|
25
|
+
activeIndex > index
|
|
26
26
|
? theme.colors.primary + '33'
|
|
27
27
|
: theme.colors.background.default;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* build description
|
|
31
|
+
*/
|
|
32
|
+
const buildDescription = () => {
|
|
33
|
+
if (typeof description == 'string') {
|
|
34
|
+
return (
|
|
35
|
+
<Text
|
|
36
|
+
color={typoStyle.description.color}
|
|
37
|
+
typography={typoStyle.description.typography}>
|
|
38
|
+
{description}
|
|
39
|
+
</Text>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
return description;
|
|
43
|
+
};
|
|
44
|
+
|
|
28
45
|
return (
|
|
29
46
|
<View
|
|
30
|
-
key={`Step ${
|
|
47
|
+
key={`Step ${index}`}
|
|
31
48
|
style={{
|
|
32
49
|
flexDirection: 'row',
|
|
33
50
|
marginBottom: Spacing.XS,
|
|
@@ -44,9 +61,10 @@ const StepsVertical: FC<StepsProps> = ({
|
|
|
44
61
|
backgroundColor={backgroundColor}
|
|
45
62
|
borderColor={borderColor}
|
|
46
63
|
useNumber={useNumber}
|
|
47
|
-
index={
|
|
64
|
+
index={index}
|
|
65
|
+
isActive={activeIndex === index}
|
|
48
66
|
/>
|
|
49
|
-
{
|
|
67
|
+
{index !== steps.length - 1 && (
|
|
50
68
|
<View
|
|
51
69
|
style={[
|
|
52
70
|
styles.lineVertical,
|
|
@@ -76,19 +94,15 @@ const StepsVertical: FC<StepsProps> = ({
|
|
|
76
94
|
{time}
|
|
77
95
|
</Text>
|
|
78
96
|
</View>
|
|
79
|
-
|
|
80
|
-
color={typoStyle.description.color}
|
|
81
|
-
typography={typoStyle.description.typography}>
|
|
82
|
-
{description}
|
|
83
|
-
</Text>
|
|
97
|
+
{buildDescription()}
|
|
84
98
|
</View>
|
|
85
99
|
</View>
|
|
86
100
|
);
|
|
87
101
|
};
|
|
88
102
|
return (
|
|
89
103
|
<View style={{width: '100%'}}>
|
|
90
|
-
{steps.map((
|
|
91
|
-
return renderStepItem(
|
|
104
|
+
{steps.map((item, index: number) => {
|
|
105
|
+
return renderStepItem(item, index);
|
|
92
106
|
})}
|
|
93
107
|
</View>
|
|
94
108
|
);
|
package/index.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, {FC} from 'react';
|
|
2
2
|
import {View} from 'react-native';
|
|
3
|
-
import {Step, StepsProps} from './types';
|
|
3
|
+
import {Step, StepsProps, Align} from './types';
|
|
4
4
|
import StepsHorizontal from './StepsHorizontal';
|
|
5
5
|
import StepsVertical from './StepsVertical';
|
|
6
6
|
|
|
@@ -17,4 +17,4 @@ const Steps: FC<StepsProps> = ({horizontal = false, ...props}) => {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
export {Steps};
|
|
20
|
-
export type {StepsProps, Step};
|
|
20
|
+
export type {StepsProps, Step, Align};
|
package/package.json
CHANGED
package/styles.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {StyleSheet} from 'react-native';
|
|
2
1
|
import {Radius, scaleSize, Spacing} from '@momo-kits/foundation';
|
|
3
|
-
|
|
2
|
+
import {StyleSheet} from 'react-native';
|
|
4
3
|
export default StyleSheet.create({
|
|
5
4
|
stepIcon: {
|
|
6
5
|
width: 24,
|
|
@@ -53,4 +52,9 @@ export default StyleSheet.create({
|
|
|
53
52
|
fontSize: scaleSize(8),
|
|
54
53
|
lineHeight: scaleSize(12),
|
|
55
54
|
},
|
|
55
|
+
currIcon: {
|
|
56
|
+
backgroundColor: 'white',
|
|
57
|
+
borderRadius: Radius.L,
|
|
58
|
+
aspectRatio: 1,
|
|
59
|
+
},
|
|
56
60
|
});
|
package/types.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {ViewStyle} from 'react-native';
|
|
2
|
+
import React from 'react';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Properties for the Steps component, a guided progress through a sequence of procedural steps.
|
|
@@ -29,11 +30,34 @@ export type StepsProps = {
|
|
|
29
30
|
*/
|
|
30
31
|
activeIndex: number;
|
|
31
32
|
|
|
33
|
+
/**
|
|
34
|
+
* Optional. If `true`, the step numbers are displayed within the step icons.
|
|
35
|
+
*/
|
|
32
36
|
useNumber?: boolean;
|
|
33
37
|
|
|
34
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Optional. Specifies the alignment of the steps within the component.
|
|
40
|
+
*/
|
|
41
|
+
align?: Align;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Optional. If `true`, the step descriptions are displayed below the step titles.
|
|
45
|
+
*/
|
|
46
|
+
customIcon?: string;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Optional. If `true`, the step descriptions are displayed below the step titles.
|
|
50
|
+
*/
|
|
51
|
+
onPress?: (item: Step, index: number) => void;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Optional. If `true`, the user won't be able to interact with the Steps component.
|
|
55
|
+
*/
|
|
56
|
+
disabled?: boolean;
|
|
35
57
|
};
|
|
36
58
|
|
|
59
|
+
export type Align = 'left' | 'right' | 'center' | 'stretch';
|
|
60
|
+
|
|
37
61
|
/**
|
|
38
62
|
* Represents a single step within the Steps component. Each step has a
|
|
39
63
|
* title and can have optional properties such as a description or error state.
|
|
@@ -48,7 +72,7 @@ export type Step = {
|
|
|
48
72
|
* Optional. More detailed text about this particular step.
|
|
49
73
|
* It can provide users with guidance on what to expect or what's required.
|
|
50
74
|
*/
|
|
51
|
-
description?: string;
|
|
75
|
+
description?: string | React.ReactNode;
|
|
52
76
|
|
|
53
77
|
/**
|
|
54
78
|
* Optional. If `true`, the step is marked as having an error, typically displayed
|
|
@@ -98,7 +122,36 @@ export type StepIconProps = {
|
|
|
98
122
|
*/
|
|
99
123
|
style?: ViewStyle;
|
|
100
124
|
|
|
125
|
+
/**
|
|
126
|
+
* Optional. If `true`, the step number is displayed within the step icon.
|
|
127
|
+
*/
|
|
101
128
|
useNumber?: boolean;
|
|
102
129
|
|
|
130
|
+
/**
|
|
131
|
+
* Optional. The number to display within the step icon.
|
|
132
|
+
*/
|
|
103
133
|
index: number;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Optional. If `true`, the step icon is marked as active.
|
|
137
|
+
*/
|
|
138
|
+
isActive?: boolean;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Optional. Custom active icon
|
|
142
|
+
*/
|
|
143
|
+
customIcon?: string;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Properties for the ProgressInfo component, which displays a progress bar
|
|
148
|
+
*/
|
|
149
|
+
export type ProgressInfoProps = {
|
|
150
|
+
steps: Step[];
|
|
151
|
+
horizontal?: boolean;
|
|
152
|
+
size?: 'small' | 'large';
|
|
153
|
+
useNumber?: boolean;
|
|
154
|
+
align?: 'left' | 'right' | 'center' | 'stretch' | undefined;
|
|
155
|
+
showDescription?: boolean;
|
|
156
|
+
customIcon?: string;
|
|
104
157
|
};
|
package/utils.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {useContext} from 'react';
|
|
2
1
|
import {ApplicationContext, Colors, Typography} from '@momo-kits/foundation';
|
|
2
|
+
import {useContext} from 'react';
|
|
3
3
|
|
|
4
|
-
type StepStatus = '
|
|
4
|
+
type StepStatus = 'incomplete' | 'current' | 'completed' | 'error';
|
|
5
5
|
type StepTypo = {
|
|
6
6
|
typography: Typography;
|
|
7
7
|
color: string;
|
|
@@ -12,6 +12,7 @@ export const getStepTypo = (
|
|
|
12
12
|
currentIndex: number,
|
|
13
13
|
error?: boolean,
|
|
14
14
|
size?: 'small' | 'large',
|
|
15
|
+
stepType?: 'vertical' | 'horizontal'
|
|
15
16
|
) => {
|
|
16
17
|
const {theme} = useContext(ApplicationContext);
|
|
17
18
|
|
|
@@ -28,27 +29,31 @@ export const getStepTypo = (
|
|
|
28
29
|
typography: 'description_xs_regular',
|
|
29
30
|
};
|
|
30
31
|
|
|
31
|
-
let status: StepStatus = '
|
|
32
|
+
let status: StepStatus = 'incomplete';
|
|
32
33
|
if (activeIndex > currentIndex) {
|
|
33
34
|
status = 'completed';
|
|
34
35
|
}
|
|
35
36
|
if (activeIndex === currentIndex) {
|
|
36
|
-
status = '
|
|
37
|
+
status = 'current';
|
|
37
38
|
}
|
|
38
39
|
if (error) {
|
|
39
40
|
status = 'error';
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
switch (status) {
|
|
43
|
-
case '
|
|
44
|
+
case 'current': {
|
|
45
|
+
title.color = theme.colors.primary;
|
|
44
46
|
title.typography = 'header_xs_semibold';
|
|
45
47
|
break;
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
case 'completed': {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
if (
|
|
52
|
+
stepType === 'horizontal' ||
|
|
53
|
+
(stepType === 'vertical' && size === 'small')
|
|
54
|
+
) {
|
|
55
|
+
title.typography = 'description_default_regular';
|
|
56
|
+
} else title.typography = 'body_default_regular';
|
|
52
57
|
break;
|
|
53
58
|
}
|
|
54
59
|
|
|
@@ -70,7 +75,7 @@ export const getStepColor = (
|
|
|
70
75
|
activeIndex: number,
|
|
71
76
|
currentIndex: number,
|
|
72
77
|
error?: boolean,
|
|
73
|
-
length: number = 1
|
|
78
|
+
length: number = 1
|
|
74
79
|
) => {
|
|
75
80
|
const {theme} = useContext(ApplicationContext);
|
|
76
81
|
const DEFAULT_LINE_COLOR = theme.colors.background.default;
|
|
@@ -80,7 +85,7 @@ export const getStepColor = (
|
|
|
80
85
|
let borderColor = theme.colors.border.default;
|
|
81
86
|
let lineColorLeft = DEFAULT_LINE_COLOR;
|
|
82
87
|
let lineColorRight = DEFAULT_LINE_COLOR;
|
|
83
|
-
let status: StepStatus = '
|
|
88
|
+
let status: StepStatus = 'incomplete';
|
|
84
89
|
|
|
85
90
|
if (activeIndex > currentIndex) {
|
|
86
91
|
status = 'completed';
|
|
@@ -88,7 +93,7 @@ export const getStepColor = (
|
|
|
88
93
|
lineColorRight = COMPLETED_LINE_COLOR;
|
|
89
94
|
}
|
|
90
95
|
if (activeIndex === currentIndex) {
|
|
91
|
-
status = '
|
|
96
|
+
status = 'current';
|
|
92
97
|
lineColorLeft = COMPLETED_LINE_COLOR;
|
|
93
98
|
}
|
|
94
99
|
if (error) {
|
|
@@ -103,15 +108,15 @@ export const getStepColor = (
|
|
|
103
108
|
}
|
|
104
109
|
|
|
105
110
|
switch (status) {
|
|
106
|
-
case '
|
|
111
|
+
case 'current': {
|
|
107
112
|
backgroundColor = theme.colors.primary;
|
|
108
113
|
borderColor = theme.colors.background.tonal;
|
|
109
114
|
break;
|
|
110
115
|
}
|
|
111
116
|
|
|
112
117
|
case 'completed': {
|
|
113
|
-
backgroundColor = theme.colors.primary
|
|
114
|
-
borderColor = theme.colors.background.
|
|
118
|
+
backgroundColor = theme.colors.primary;
|
|
119
|
+
borderColor = theme.colors.background.tonal;
|
|
115
120
|
break;
|
|
116
121
|
}
|
|
117
122
|
|