@momo-kits/step 0.92.1-tracking.8 → 0.92.3-tracking.3

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,14 @@
1
1
  import React, {FC, useContext} from 'react';
2
- import {View} from 'react-native';
2
+ import {TextStyle, View} from 'react-native';
3
3
  import {StepIconProps} from './types';
4
4
  import styles from './styles';
5
- import {ApplicationContext, Icon, Colors} from '@momo-kits/foundation';
5
+ import {
6
+ ApplicationContext,
7
+ Colors,
8
+ Icon,
9
+ Text,
10
+ Typography,
11
+ } from '@momo-kits/foundation';
6
12
 
7
13
  const StepIcon: FC<StepIconProps> = ({
8
14
  size = 'large',
@@ -10,8 +16,9 @@ const StepIcon: FC<StepIconProps> = ({
10
16
  borderColor,
11
17
  error,
12
18
  style,
19
+ useNumber,
20
+ index,
13
21
  }) => {
14
- const {theme} = useContext(ApplicationContext);
15
22
  let iconStyle = styles.stepIcon;
16
23
  let checkIconSize = 16;
17
24
  let iconSource = error ? 'navigation_close' : 'notifications_check';
@@ -23,7 +30,22 @@ const StepIcon: FC<StepIconProps> = ({
23
30
  return (
24
31
  <View
25
32
  style={[iconStyle, styles.center, {backgroundColor, borderColor}, style]}>
26
- <Icon size={checkIconSize} color={Colors.black_01} source={iconSource} />
33
+ {useNumber ? (
34
+ <Text
35
+ style={{
36
+ position: 'absolute',
37
+ }}
38
+ typography={'header_xs_semibold'}
39
+ color={Colors.black_01}>
40
+ {index + 1}
41
+ </Text>
42
+ ) : (
43
+ <Icon
44
+ size={checkIconSize}
45
+ color={Colors.black_01}
46
+ source={iconSource}
47
+ />
48
+ )}
27
49
  </View>
28
50
  );
29
51
  };
@@ -6,15 +6,23 @@ import {Spacing, Text, getAccessibilityID} from '@momo-kits/foundation';
6
6
  import {getStepColor, getStepTypo} from './utils';
7
7
  import styles from './styles';
8
8
 
9
- const StepsHorizontal: FC<StepsProps> = ({steps, size, activeIndex}) => {
9
+ const StepsHorizontal: FC<StepsProps> = ({
10
+ steps,
11
+ size,
12
+ activeIndex,
13
+ useNumber = false,
14
+ }) => {
10
15
  const renderStepItem = (i: Step, ii: number) => {
11
16
  const {title, description, error, time} = steps[ii];
12
17
  let typoStyle = getStepTypo(activeIndex, ii, error, size);
13
- const {status} = getStepColor(activeIndex, ii, error, steps.length)
14
- const accessibilityID = getAccessibilityID?.(`ic_step_${ii}_${status}`)
18
+ const {status} = getStepColor(activeIndex, ii, error, steps.length);
19
+ const accessibilityID = getAccessibilityID?.(`ic_step_${ii}_${status}`);
15
20
 
16
21
  return (
17
- <View {...accessibilityID} key={`Step ${ii}`} style={{flex: 1, alignItems: 'center'}}>
22
+ <View
23
+ {...accessibilityID}
24
+ key={`Step ${ii}`}
25
+ style={{flex: 1, alignItems: 'center'}}>
18
26
  {!!time && (
19
27
  <Text
20
28
  style={styles.textCenter}
@@ -70,6 +78,8 @@ const StepsHorizontal: FC<StepsProps> = ({steps, size, activeIndex}) => {
70
78
  backgroundColor={backgroundColor}
71
79
  borderColor={borderColor}
72
80
  style={{marginHorizontal: Spacing.XS, marginVertical: Spacing.XS}}
81
+ index={ii}
82
+ useNumber={useNumber}
73
83
  />
74
84
  <View
75
85
  style={[
@@ -87,7 +97,6 @@ const StepsHorizontal: FC<StepsProps> = ({steps, size, activeIndex}) => {
87
97
  return (
88
98
  <View style={{flexDirection: 'row'}}>
89
99
  {steps.map((i, ii) => {
90
-
91
100
  return renderStepItem(i, ii);
92
101
  })}
93
102
  </View>
package/StepsVertical.tsx CHANGED
@@ -2,11 +2,21 @@ import React, {FC, useContext} from 'react';
2
2
  import {View} from 'react-native';
3
3
  import {Step, StepsProps} from './types';
4
4
  import {getStepColor, getStepTypo} from './utils';
5
- import {ApplicationContext, getAccessibilityID, Spacing, Text} from '@momo-kits/foundation';
5
+ import {
6
+ ApplicationContext,
7
+ getAccessibilityID,
8
+ Spacing,
9
+ Text,
10
+ } from '@momo-kits/foundation';
6
11
  import styles from './styles';
7
12
  import StepIcon from './StepIcon';
8
13
 
9
- const StepsVertical: FC<StepsProps> = ({steps, activeIndex, size}) => {
14
+ const StepsVertical: FC<StepsProps> = ({
15
+ steps,
16
+ activeIndex,
17
+ size,
18
+ useNumber = false,
19
+ }) => {
10
20
  const {theme} = useContext(ApplicationContext);
11
21
 
12
22
  const renderStepItem = (i: Step, ii: number) => {
@@ -14,8 +24,8 @@ const StepsVertical: FC<StepsProps> = ({steps, activeIndex, size}) => {
14
24
 
15
25
  const stepStyle = getStepColor(activeIndex, ii, error, steps.length);
16
26
  let typoStyle = getStepTypo(activeIndex, ii, error, size);
17
- const {status} = getStepColor(activeIndex, ii, error, steps.length)
18
- const accessibilityID = getAccessibilityID?.(`ic_step_${ii}_${status}`)
27
+ const {status} = getStepColor(activeIndex, ii, error, steps.length);
28
+ const accessibilityID = getAccessibilityID?.(`ic_step_${ii}_${status}`);
19
29
 
20
30
  const {backgroundColor, borderColor} = stepStyle;
21
31
  const lineColor =
@@ -24,7 +34,7 @@ const StepsVertical: FC<StepsProps> = ({steps, activeIndex, size}) => {
24
34
  : theme.colors.background.default;
25
35
  return (
26
36
  <View
27
- {...accessibilityID}
37
+ {...accessibilityID}
28
38
  key={`Step ${ii}`}
29
39
  style={{
30
40
  flexDirection: 'row',
@@ -41,6 +51,8 @@ const StepsVertical: FC<StepsProps> = ({steps, activeIndex, size}) => {
41
51
  error={error}
42
52
  backgroundColor={backgroundColor}
43
53
  borderColor={borderColor}
54
+ useNumber={useNumber}
55
+ index={ii}
44
56
  />
45
57
  {ii !== steps.length - 1 && (
46
58
  <View
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/step",
3
- "version": "0.92.1-tracking.8",
3
+ "version": "0.92.3-tracking.3",
4
4
  "private": false,
5
5
  "main": "index.tsx",
6
6
  "dependencies": {},
package/styles.ts CHANGED
@@ -1,18 +1,18 @@
1
1
  import {StyleSheet} from 'react-native';
2
- import {Colors, Radius, Spacing} from '@momo-kits/foundation';
2
+ import {Colors, Radius, scaleSize, Spacing} from '@momo-kits/foundation';
3
3
 
4
4
  export default StyleSheet.create({
5
5
  stepIcon: {
6
- width: 24,
7
- height: 24,
6
+ width: scaleSize(24),
7
+ height: scaleSize(24),
8
8
  borderWidth: 2,
9
- borderRadius: Radius.M,
9
+ borderRadius: scaleSize(Radius.L),
10
10
  },
11
11
  stepIconSmall: {
12
- width: 16,
13
- height: 16,
12
+ width: scaleSize(16),
13
+ height: scaleSize(16),
14
14
  borderWidth: 2,
15
- borderRadius: Radius.S,
15
+ borderRadius: scaleSize(Radius.M),
16
16
  },
17
17
  lineHorizontal: {
18
18
  height: 2,
@@ -45,4 +45,12 @@ export default StyleSheet.create({
45
45
  textCenter: {
46
46
  textAlign: 'center',
47
47
  },
48
+ largeText: {
49
+ fontSize: scaleSize(12),
50
+ lineHeight: scaleSize(16),
51
+ },
52
+ smallText: {
53
+ fontSize: scaleSize(8),
54
+ lineHeight: scaleSize(12),
55
+ },
48
56
  });
package/types.ts CHANGED
@@ -28,6 +28,8 @@ export type StepsProps = {
28
28
  * starting from 0 for the first step.
29
29
  */
30
30
  activeIndex: number;
31
+
32
+ useNumber?: boolean;
31
33
  };
32
34
 
33
35
  /**
@@ -93,4 +95,8 @@ export type StepIconProps = {
93
95
  * Can be used to adjust the visual presentation or layout.
94
96
  */
95
97
  style?: ViewStyle;
98
+
99
+ useNumber?: boolean;
100
+
101
+ index: number;
96
102
  };