@momo-kits/step 0.169.8 → 0.169.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.
@@ -58,7 +58,7 @@ const StepsHorizontal: FC<StepsProps> = ({
58
58
  }
59
59
  }
60
60
 
61
- const onTimesLayout = (e: LayoutChangeEvent) => {
61
+ const handleTimesLayout = (e: LayoutChangeEvent) => {
62
62
  const { height } = e.nativeEvent.layout;
63
63
  if (height !== timeHeight && height > timeHeight) setTimeHeight(height);
64
64
  };
@@ -91,7 +91,7 @@ const StepsHorizontal: FC<StepsProps> = ({
91
91
  >
92
92
  {!!time && (
93
93
  <Text
94
- onLayout={onTimesLayout}
94
+ onLayout={handleTimesLayout}
95
95
  style={{ textAlign }}
96
96
  color={
97
97
  disabled ? theme.colors.text.disable : typoStyle.time.color
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/step",
3
- "version": "0.169.8",
3
+ "version": "0.169.10",
4
4
  "private": false,
5
5
  "main": "index.tsx",
6
6
  "peerDependencies": {
package/utils.ts CHANGED
@@ -2,6 +2,9 @@ import { ApplicationContext, Colors, Typography } from '@momo-kits/foundation';
2
2
  import { Step } from '@momo-kits/step';
3
3
  import { useContext } from 'react';
4
4
 
5
+ /** Hex alpha (20%) appended to the primary color for a passed connector line. */
6
+ const COMPLETED_LINE_ALPHA = '33';
7
+
5
8
  type StepStatus = 'incomplete' | 'current' | 'completed' | 'error' | 'disable';
6
9
  type StepTypo = {
7
10
  typography: Typography;
@@ -31,6 +34,7 @@ const checkSizeAndStepType = (
31
34
  );
32
35
  };
33
36
 
37
+ /** Title typography: semibold for current/error steps, smaller when compact. */
34
38
  const getTypoTitle = (
35
39
  status: StepStatus,
36
40
  size?: 'small' | 'large',
@@ -110,21 +114,21 @@ export const GetStepColor = (
110
114
  disabled?: boolean,
111
115
  ) => {
112
116
  const { theme } = useContext(ApplicationContext);
113
- const DEFAULT_LINE_COLOR = theme.colors.border.default;
114
- const COMPLETED_LINE_COLOR = theme.colors.primary + '33';
117
+ const defaultLineColor = theme.colors.border.default;
118
+ const completedLineColor = theme.colors.primary + COMPLETED_LINE_ALPHA;
115
119
 
116
120
  let backgroundColor = Colors.black_06;
117
121
  let borderColor = theme.colors.border.default;
118
- let lineColorLeft = DEFAULT_LINE_COLOR;
119
- let lineColorRight = DEFAULT_LINE_COLOR;
122
+ let lineColorLeft = defaultLineColor;
123
+ let lineColorRight = defaultLineColor;
120
124
  const status = getStatus(activeIndex, currentIndex, error, disabled);
121
125
 
122
126
  if (activeIndex > currentIndex) {
123
- lineColorLeft = COMPLETED_LINE_COLOR;
124
- lineColorRight = COMPLETED_LINE_COLOR;
127
+ lineColorLeft = completedLineColor;
128
+ lineColorRight = completedLineColor;
125
129
  }
126
130
  if (activeIndex === currentIndex) {
127
- lineColorLeft = COMPLETED_LINE_COLOR;
131
+ lineColorLeft = completedLineColor;
128
132
  }
129
133
 
130
134
  if (currentIndex === 0) {