@momo-kits/step 0.102.5 → 0.103.1-beta.2

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 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 {Colors, Icon, Text} from '@momo-kits/foundation';
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 iconSource = error ? 'navigation_close' : 'notifications_check';
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
- return (
25
- <View
26
- style={[iconStyle, styles.center, {backgroundColor, borderColor}, style]}>
27
- {useNumber ? (
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
- <Icon
38
- size={checkIconSize}
39
- color={Colors.black_01}
40
- source={iconSource}
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
  };
@@ -1,10 +1,10 @@
1
- import React, {FC} from 'react';
2
- import {FlexAlignType, View} from 'react-native';
3
- import {Step, StepsProps} from './types';
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 = (i: Step, ii: number) => {
19
- const {title, description, error, time} = steps[ii];
20
- let typoStyle = getStepTypo(activeIndex, ii, error, size);
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 (ii === 0) {
35
+ if (index === 0) {
32
36
  alignItems = 'flex-start';
33
37
  textAlign = 'left';
34
- } else if (ii === steps.length - 1) {
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
- ii !== steps.length - 1 && align !== 'center' && align !== 'stretch';
45
+ index !== steps.length - 1 && align !== 'center' && align !== 'stretch';
42
46
 
43
47
  return (
44
- <View
45
- key={`Step ${ii}`}
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(i, ii, align)}
65
+ {renderStepIcon(item, index, align, disabled)}
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={typoStyle.description.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
- </View>
84
+ </TouchableOpacity>
77
85
  );
78
86
  };
79
87
 
80
- const renderStepIcon = (i: Step, ii: number, align: string = 'center') => {
81
- const {error} = steps[ii];
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, ii, error, steps.length);
96
+ const stepStyle = getStepColor(activeIndex, index, error, steps.length, disabled);
84
97
  const {backgroundColor, borderColor, lineColorRight, lineColorLeft} =
85
98
  stepStyle;
86
99
 
87
- const lineLeftHide = (align === 'stretch' && ii === 0) || align === 'left';
100
+ const lineLeftHide =
101
+ (align === 'stretch' && index === 0) || align === 'left';
88
102
  const lineRightHide =
89
- (align === 'stretch' && ii === steps.length - 1) || align === 'right';
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={ii}
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((i, ii) => {
135
- return renderStepItem(i, ii);
150
+ {steps.map((item, index) => {
151
+ return renderStepItem(item, index);
136
152
  })}
137
153
  </View>
138
154
  );
package/StepsVertical.tsx CHANGED
@@ -1,37 +1,59 @@
1
+ import {ApplicationContext, Colors, Spacing, Text} from '@momo-kits/foundation';
1
2
  import React, {FC, useContext} from 'react';
2
- import {View} from 'react-native';
3
+ import {View, TouchableOpacity} 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,
11
11
  activeIndex,
12
12
  size,
13
13
  useNumber = false,
14
+ onPress,
15
+ disabled,
14
16
  }) => {
15
17
  const {theme} = useContext(ApplicationContext);
16
18
 
17
- const renderStepItem = (i: Step, ii: number) => {
18
- const {error, description, title, time} = steps[ii];
19
+ const renderStepItem = (item: Step, index: number) => {
20
+ const {error, description, title, time} = item;
19
21
 
20
- const stepStyle = getStepColor(activeIndex, ii, error, steps.length);
21
- let typoStyle = getStepTypo(activeIndex, ii, error, size);
22
+ const stepStyle = getStepColor(activeIndex, index, error, steps.length);
23
+ const typoStyle = getStepTypo(activeIndex, index, error, size, 'vertical');
22
24
 
23
25
  const {backgroundColor, borderColor} = stepStyle;
24
26
  const lineColor =
25
- activeIndex > ii
27
+ activeIndex > index
26
28
  ? theme.colors.primary + '33'
27
29
  : theme.colors.background.default;
30
+
31
+ /**
32
+ * build description
33
+ */
34
+ const buildDescription = () => {
35
+ if (typeof description == 'string') {
36
+ return (
37
+ <Text
38
+ color={disabled ? theme.colors.text.disable : typoStyle.title.color}
39
+ typography={typoStyle.description.typography}>
40
+ {description}
41
+ </Text>
42
+ );
43
+ }
44
+ return description;
45
+ };
46
+
28
47
  return (
29
- <View
30
- key={`Step ${ii}`}
48
+ <TouchableOpacity
49
+ key={`Step ${index}`}
31
50
  style={{
32
51
  flexDirection: 'row',
33
52
  marginBottom: Spacing.XS,
34
- }}>
53
+ }}
54
+ disabled={disabled || !onPress}
55
+ onPress={() => onPress && onPress(item, index)}
56
+ >
35
57
  <View
36
58
  style={{
37
59
  alignItems: 'center',
@@ -41,12 +63,13 @@ const StepsVertical: FC<StepsProps> = ({
41
63
  <StepIcon
42
64
  size={size}
43
65
  error={error}
44
- backgroundColor={backgroundColor}
45
- borderColor={borderColor}
66
+ backgroundColor={disabled ? Colors.pink_08 : backgroundColor}
67
+ borderColor={disabled ? Colors.pink_10 : borderColor}
46
68
  useNumber={useNumber}
47
- index={ii}
69
+ index={index}
70
+ isActive={activeIndex === index}
48
71
  />
49
- {ii !== steps.length - 1 && (
72
+ {index !== steps.length - 1 && (
50
73
  <View
51
74
  style={[
52
75
  styles.lineVertical,
@@ -57,38 +80,36 @@ const StepsVertical: FC<StepsProps> = ({
57
80
  </View>
58
81
  <View style={{flex: 1}}>
59
82
  <View
60
- style={[
61
- {
62
- flexDirection: 'row',
63
- justifyContent: 'space-between',
64
- },
65
- ]}>
83
+ style={{
84
+ flexDirection: 'row',
85
+ justifyContent: 'space-between',
86
+ }}>
66
87
  <Text
67
88
  numberOfLines={2}
68
89
  style={{marginRight: Spacing.S, flex: 1}}
69
- color={typoStyle.title.color}
90
+ color={
91
+ disabled ? theme.colors.text.disable : typoStyle.title.color
92
+ }
70
93
  typography={typoStyle.title.typography}>
71
94
  {title}
72
95
  </Text>
73
96
  <Text
74
- color={typoStyle.time.color}
97
+ color={
98
+ disabled ? theme.colors.text.disable : typoStyle.time.color
99
+ }
75
100
  typography={typoStyle.time.typography}>
76
101
  {time}
77
102
  </Text>
78
103
  </View>
79
- <Text
80
- color={typoStyle.description.color}
81
- typography={typoStyle.description.typography}>
82
- {description}
83
- </Text>
104
+ {buildDescription()}
84
105
  </View>
85
- </View>
106
+ </TouchableOpacity>
86
107
  );
87
108
  };
88
109
  return (
89
110
  <View style={{width: '100%'}}>
90
- {steps.map((i, ii) => {
91
- return renderStepItem(i, ii);
111
+ {steps.map((item, index: number) => {
112
+ return renderStepItem(item, index);
92
113
  })}
93
114
  </View>
94
115
  );
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/step",
3
- "version": "0.102.5",
3
+ "version": "0.103.1-beta.2",
4
4
  "private": false,
5
5
  "main": "index.tsx",
6
6
  "dependencies": {},
package/publish.sh CHANGED
@@ -7,7 +7,7 @@ rsync -r --exclude=/dist ./* dist
7
7
  cd dist
8
8
 
9
9
  if [ "$1" == "stable" ]; then
10
- npm version $(npm view @momo-kits/step@stable version)
10
+ npm version $(npm view @momo-kits/foundation@stable version)
11
11
  npm version patch
12
12
  npm publish --tag stable --access=public
13
13
  elif [ "$1" == "latest" ]; then
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
- align?: 'left' | 'right' | 'center' | 'stretch';
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,68 +1,99 @@
1
- import {useContext} from 'react';
2
1
  import {ApplicationContext, Colors, Typography} from '@momo-kits/foundation';
2
+ import {Step} from '@momo-kits/step';
3
+ import {useContext} from 'react';
3
4
 
4
- type StepStatus = 'inactive' | 'active' | 'completed' | 'error';
5
+ type StepStatus = 'incomplete' | 'current' | 'completed' | 'error' | 'disable';
5
6
  type StepTypo = {
6
7
  typography: Typography;
7
8
  color: string;
8
9
  };
9
10
 
11
+ const getStatus = (
12
+ activeIndex: number,
13
+ currentIndex: number,
14
+ error?: boolean,
15
+ disabled?: boolean
16
+ ): StepStatus => {
17
+ if (disabled) return 'disable';
18
+ if (error) return 'error';
19
+ if (activeIndex === currentIndex) return 'current';
20
+ if (activeIndex > currentIndex) return 'completed';
21
+ return 'incomplete';
22
+ };
23
+ const checkSizeAndStepType = (
24
+ stepType?: 'vertical' | 'horizontal',
25
+ size?: 'small' | 'large'
26
+ ) => {
27
+ return (
28
+ stepType === 'horizontal' || (stepType === 'vertical' && size === 'small')
29
+ );
30
+ };
31
+
32
+ const getTypoTitle = (
33
+ status: StepStatus,
34
+ size?: 'small' | 'large',
35
+ stepType?: 'vertical' | 'horizontal'
36
+ ): Typography => {
37
+ const defaultTypo =
38
+ !!size && stepType === 'vertical'
39
+ ? 'body_default_regular'
40
+ : 'description_default_regular';
41
+
42
+ switch (status) {
43
+ case 'current':
44
+ case 'error': {
45
+ return checkSizeAndStepType(stepType, size)
46
+ ? 'header_xs_semibold'
47
+ : 'header_s_semibold';
48
+ }
49
+ case 'incomplete':
50
+ case 'completed': {
51
+ return checkSizeAndStepType(stepType, size)
52
+ ? 'description_default_regular'
53
+ : 'body_default_regular';
54
+ }
55
+ default: {
56
+ return defaultTypo;
57
+ }
58
+ }
59
+ };
60
+
10
61
  export const getStepTypo = (
11
62
  activeIndex: number,
12
63
  currentIndex: number,
13
64
  error?: boolean,
14
65
  size?: 'small' | 'large',
66
+ stepType?: 'vertical' | 'horizontal'
15
67
  ) => {
16
68
  const {theme} = useContext(ApplicationContext);
69
+ const status = getStatus(activeIndex, currentIndex, error);
17
70
 
18
71
  let title: StepTypo = {
19
72
  color: theme.colors.text.default,
20
- typography: 'description_default_regular',
73
+ typography: getTypoTitle(status, size, stepType),
21
74
  };
22
75
  let description: StepTypo = {
23
76
  color: theme.colors.text.hint,
24
- typography: 'description_default_regular',
77
+ typography: !!size
78
+ ? 'description_xs_regular'
79
+ : 'description_default_regular',
25
80
  };
26
81
  let time: StepTypo = {
27
82
  color: theme.colors.text.hint,
28
83
  typography: 'description_xs_regular',
29
84
  };
30
85
 
31
- let status: StepStatus = 'inactive';
32
- if (activeIndex > currentIndex) {
33
- status = 'completed';
34
- }
35
- if (activeIndex === currentIndex) {
36
- status = 'active';
37
- }
38
- if (error) {
39
- status = 'error';
40
- }
41
-
42
86
  switch (status) {
43
- case 'active': {
44
- title.typography = 'header_xs_semibold';
45
- break;
46
- }
47
-
48
- case 'completed': {
49
- title.color = theme.colors.text.disable;
50
- description.color = theme.colors.text.disable;
51
- time.color = theme.colors.text.disable;
87
+ case 'current': {
88
+ title.color = theme.colors.primary;
52
89
  break;
53
90
  }
54
-
55
91
  case 'error': {
56
- title.typography = 'header_xs_semibold';
57
92
  title.color = theme.colors.error.primary;
58
93
  break;
59
94
  }
60
95
  }
61
96
 
62
- if (size === 'small') {
63
- description.typography = 'description_xs_regular';
64
- }
65
-
66
97
  return {title, description, time};
67
98
  };
68
99
 
@@ -71,6 +102,7 @@ export const getStepColor = (
71
102
  currentIndex: number,
72
103
  error?: boolean,
73
104
  length: number = 1,
105
+ disabled?: boolean
74
106
  ) => {
75
107
  const {theme} = useContext(ApplicationContext);
76
108
  const DEFAULT_LINE_COLOR = theme.colors.background.default;
@@ -80,20 +112,15 @@ export const getStepColor = (
80
112
  let borderColor = theme.colors.border.default;
81
113
  let lineColorLeft = DEFAULT_LINE_COLOR;
82
114
  let lineColorRight = DEFAULT_LINE_COLOR;
83
- let status: StepStatus = 'inactive';
115
+ const status = getStatus(activeIndex, currentIndex, error, disabled);
84
116
 
85
117
  if (activeIndex > currentIndex) {
86
- status = 'completed';
87
118
  lineColorLeft = COMPLETED_LINE_COLOR;
88
119
  lineColorRight = COMPLETED_LINE_COLOR;
89
120
  }
90
121
  if (activeIndex === currentIndex) {
91
- status = 'active';
92
122
  lineColorLeft = COMPLETED_LINE_COLOR;
93
123
  }
94
- if (error) {
95
- status = 'error';
96
- }
97
124
 
98
125
  if (currentIndex === 0) {
99
126
  lineColorLeft = 'transparent';
@@ -103,15 +130,15 @@ export const getStepColor = (
103
130
  }
104
131
 
105
132
  switch (status) {
106
- case 'active': {
133
+ case 'current': {
107
134
  backgroundColor = theme.colors.primary;
108
135
  borderColor = theme.colors.background.tonal;
109
136
  break;
110
137
  }
111
138
 
112
139
  case 'completed': {
113
- backgroundColor = theme.colors.primary + '33';
114
- borderColor = theme.colors.background.selected;
140
+ backgroundColor = theme.colors.primary;
141
+ borderColor = theme.colors.background.tonal;
115
142
  break;
116
143
  }
117
144
 
@@ -120,7 +147,29 @@ export const getStepColor = (
120
147
  borderColor = theme.colors.error.container;
121
148
  break;
122
149
  }
150
+
151
+ case 'disable': {
152
+ backgroundColor = Colors.pink_08;
153
+ borderColor = Colors.pink_10;
154
+ break;
155
+ }
123
156
  }
124
157
 
125
158
  return {backgroundColor, borderColor, lineColorLeft, lineColorRight, status};
126
159
  };
160
+
161
+ export const getOnPressCompleted = (
162
+ item: Step,
163
+ activeIndex: number,
164
+ currentIndex: number,
165
+ error?: boolean,
166
+ disabled?: boolean,
167
+ onPress?: (item: Step, index: number) => void
168
+ ) => {
169
+ const status = getStatus(activeIndex, currentIndex, error, disabled);
170
+
171
+ if (status === 'completed' && onPress) {
172
+ return () => onPress(item, currentIndex);
173
+ }
174
+ return undefined;
175
+ };