@momo-kits/stepper 0.111.1-rc.7 → 0.112.1-beta.0

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/NumberView.tsx CHANGED
@@ -10,6 +10,7 @@ const NumberView: FC<StepperValueProps> = ({
10
10
  editable = false,
11
11
  onValueChange,
12
12
  disabled,
13
+ accessibilityLabel,
13
14
  }) => {
14
15
  const {theme} = useContext(ApplicationContext);
15
16
  const sizeStyle =
@@ -39,6 +40,10 @@ const NumberView: FC<StepperValueProps> = ({
39
40
  onChangeText={onValueChange}
40
41
  keyboardType={'number-pad'}
41
42
  selectionColor={theme.colors.primary}
43
+ accessibilityLabel={accessibilityLabel}
44
+ accessibilityState={{
45
+ disabled: !editable,
46
+ }}
42
47
  />
43
48
  </View>
44
49
  );
package/StepperButton.tsx CHANGED
@@ -9,6 +9,7 @@ const StepperButton: FC<StepperButtonProps> = ({
9
9
  sign = '+',
10
10
  size = 'large',
11
11
  onPress,
12
+ accessibilityLabel,
12
13
  }) => {
13
14
  const {theme} = useContext(ApplicationContext);
14
15
 
@@ -20,7 +21,9 @@ const StepperButton: FC<StepperButtonProps> = ({
20
21
  : theme.colors.primary;
21
22
 
22
23
  return (
23
- <TouchableOpacity disabled={disabled} onPress={onPress} style={[sizeStyle]}>
24
+ <TouchableOpacity accessibilityLabel={accessibilityLabel} accessibilityState={{
25
+ disabled,
26
+ }} disabled={disabled} onPress={onPress} style={[sizeStyle]}>
24
27
  <Icon size={22} color={buttonColor} source={buttonIcon} />
25
28
  </TouchableOpacity>
26
29
  );
package/index.tsx CHANGED
@@ -21,6 +21,10 @@ const Stepper = forwardRef(
21
21
  step = 1,
22
22
  editable = false,
23
23
  onValueChange,
24
+ accessibilityLabel,
25
+ accessbibilityLabelMinus,
26
+ accessbibilityLabelPlus,
27
+ accessbibilityLabelNumber
24
28
  }: StepperProps,
25
29
  ref
26
30
  ) => {
@@ -92,12 +96,13 @@ const Stepper = forwardRef(
92
96
  const viewStatus = getViewDisabledStatus();
93
97
 
94
98
  return (
95
- <View style={styles.stepper}>
99
+ <View style={styles.stepper} accessibilityLabel={accessibilityLabel}>
96
100
  <StepperButton
97
101
  onPress={onMinus}
98
102
  sign={'-'}
99
103
  size={size}
100
104
  disabled={viewStatus.minus}
105
+ accessibilityLabel={accessbibilityLabelMinus}
101
106
  />
102
107
  <NumberView
103
108
  onValueChange={_onValueChange}
@@ -105,11 +110,13 @@ const Stepper = forwardRef(
105
110
  value={value}
106
111
  disabled={viewStatus.number}
107
112
  editable={editable}
113
+ accessibilityLabel={accessbibilityLabelNumber}
108
114
  />
109
115
  <StepperButton
110
116
  onPress={onPlus}
111
117
  size={size}
112
118
  disabled={viewStatus.plus}
119
+ accessibilityLabel={accessbibilityLabelPlus}
113
120
  />
114
121
  </View>
115
122
  );
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
- "name": "@momo-kits/stepper",
3
- "version": "0.111.1-rc.7",
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
- "publishConfig": {
18
- "registry": "https://registry.npmjs.org/"
19
- }
2
+ "name": "@momo-kits/stepper",
3
+ "version": "0.112.1-beta.0",
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
+ "publishConfig": {
18
+ "registry": "https://registry.npmjs.org/"
19
+ }
20
20
  }
package/types.ts CHANGED
@@ -25,6 +25,11 @@ export type StepperButtonProps = {
25
25
  * A callback function that is triggered when the button is pressed.
26
26
  */
27
27
  onPress: () => void;
28
+
29
+ /**
30
+ * Optional. Assign accessibility label to the button for automated testing.
31
+ */
32
+ accessibilityLabel?: string;
28
33
  };
29
34
 
30
35
  /**
@@ -58,6 +63,11 @@ export type StepperValueProps = {
58
63
  * Optional. A callback function that is triggered when the value changes, receiving the new value as a parameter.
59
64
  */
60
65
  onValueChange?: (value: string) => void;
66
+
67
+ /**
68
+ * Optional. Assign accessibility label to the button for automated testing.
69
+ */
70
+ accessibilityLabel?: string;
61
71
  };
62
72
 
63
73
  /**
@@ -111,6 +121,26 @@ export type StepperProps = {
111
121
  * Optional. Custom styles to apply to the Stepper component. Can be used to adjust the visual presentation or layout.
112
122
  */
113
123
  style?: ViewStyle | ViewStyle[];
124
+
125
+ /**
126
+ * Optional. Assign accessibility label to the button for automated testing.
127
+ */
128
+ accessibilityLabel?: string;
129
+
130
+ /**
131
+ * Optional. Assign accessibility label to the button for automated testing.
132
+ */
133
+ accessbibilityLabelPlus?: string;
134
+
135
+ /**
136
+ * Optional. Assign accessibility label to the button for automated testing.
137
+ */
138
+ accessbibilityLabelMinus?: string;
139
+
140
+ /**
141
+ * Optional. Assign accessibility label to the button for automated testing.
142
+ */
143
+ accessbibilityLabelNumber?: string;
114
144
  };
115
145
 
116
146
  /**