@momo-kits/step 0.92.1-beta.4 → 0.92.1-rc.10

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