@momo-kits/foundation 0.113.0-optimize.6 → 0.113.0-optimize.8
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/Application/Components/NavigationButton.tsx +6 -2
- package/Application/types.ts +6 -8
- package/Application/utils.tsx +0 -8
- package/Badge/Badge.tsx +10 -2
- package/Badge/types.ts +2 -0
- package/Button/index.tsx +14 -1
- package/CheckBox/index.tsx +12 -3
- package/CheckBox/types.ts +10 -2
- package/Icon/index.tsx +2 -2
- package/Icon/types.ts +5 -0
- package/IconButton/index.tsx +4 -3
- package/Image/index.tsx +2 -3
- package/Input/Input.tsx +41 -10
- package/Input/InputDropDown.tsx +20 -7
- package/Input/InputMoney.tsx +16 -3
- package/Input/InputOTP.tsx +2 -0
- package/Input/InputSearch.tsx +11 -4
- package/Input/common.tsx +9 -2
- package/Input/index.tsx +71 -75
- package/Layout/Card.tsx +4 -1
- package/Layout/Section.tsx +4 -1
- package/Radio/index.tsx +11 -4
- package/Radio/types.ts +16 -2
- package/Switch/index.tsx +2 -2
- package/Switch/types.ts +11 -2
- package/Tag/index.tsx +9 -2
- package/Tag/types.ts +12 -0
- package/package.json +1 -1
|
@@ -12,8 +12,10 @@ import {BadgeDot} from '../../Badge';
|
|
|
12
12
|
const NavigationButton: React.FC<NavigationButtonProps> = ({
|
|
13
13
|
icon,
|
|
14
14
|
tintColor,
|
|
15
|
+
onPress,
|
|
15
16
|
showBadge = false,
|
|
16
|
-
|
|
17
|
+
accessibilityLabel = '',
|
|
18
|
+
disabled = false,
|
|
17
19
|
}) => {
|
|
18
20
|
const {theme} = useContext(ApplicationContext);
|
|
19
21
|
let buttonStyle: ViewStyle = {};
|
|
@@ -27,8 +29,10 @@ const NavigationButton: React.FC<NavigationButtonProps> = ({
|
|
|
27
29
|
return (
|
|
28
30
|
<View style={{width: 28}}>
|
|
29
31
|
<TouchableOpacity
|
|
30
|
-
{
|
|
32
|
+
disabled={disabled}
|
|
33
|
+
accessibilityLabel={accessibilityLabel}
|
|
31
34
|
style={[styles.navigationButton, buttonStyle]}
|
|
35
|
+
onPress={onPress}
|
|
32
36
|
hitSlop={{top: 7, bottom: 7, left: 7, right: 7}}>
|
|
33
37
|
<Icon
|
|
34
38
|
source={icon}
|
package/Application/types.ts
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import {EventArg} from '@react-navigation/core';
|
|
2
2
|
import {StackNavigationOptions} from '@react-navigation/stack';
|
|
3
3
|
import React, {ReactNode} from 'react';
|
|
4
|
-
import {
|
|
5
|
-
Animated,
|
|
6
|
-
TouchableOpacityProps,
|
|
7
|
-
ViewProps,
|
|
8
|
-
ViewStyle,
|
|
9
|
-
} from 'react-native';
|
|
4
|
+
import {Animated, ViewProps, ViewStyle} from 'react-native';
|
|
10
5
|
import {PopupNotifyProps} from '../Popup/types';
|
|
11
6
|
import Localize from './Localize';
|
|
12
7
|
import Navigation from './Navigation';
|
|
@@ -152,11 +147,14 @@ export type BottomSheetParams = {
|
|
|
152
147
|
keyboardVerticalOffset?: number;
|
|
153
148
|
};
|
|
154
149
|
|
|
155
|
-
export
|
|
150
|
+
export type NavigationButtonProps = {
|
|
156
151
|
icon: string;
|
|
157
152
|
tintColor?: string;
|
|
153
|
+
onPress: () => void;
|
|
158
154
|
showBadge?: boolean;
|
|
159
|
-
|
|
155
|
+
accessibilityLabel?: string;
|
|
156
|
+
disabled?: boolean;
|
|
157
|
+
};
|
|
160
158
|
|
|
161
159
|
export type HeaderTitleProps = {
|
|
162
160
|
type: 'default' | 'user' | 'location' | 'journey';
|
package/Application/utils.tsx
CHANGED
|
@@ -169,14 +169,6 @@ const setAutomationID = (accessibilityLabel = '') => {
|
|
|
169
169
|
}
|
|
170
170
|
};
|
|
171
171
|
|
|
172
|
-
export const getImageName = (source: any): string => {
|
|
173
|
-
const parts = source?.uri?.split?.('/');
|
|
174
|
-
if (parts?.length > 0) {
|
|
175
|
-
return parts?.[parts.length - 1];
|
|
176
|
-
}
|
|
177
|
-
return '';
|
|
178
|
-
};
|
|
179
|
-
|
|
180
172
|
export {
|
|
181
173
|
getStackOptions,
|
|
182
174
|
getDialogOptions,
|
package/Badge/Badge.tsx
CHANGED
|
@@ -7,7 +7,12 @@ import styles from './styles';
|
|
|
7
7
|
import {Colors} from '../Consts';
|
|
8
8
|
import {Text} from '../Text';
|
|
9
9
|
|
|
10
|
-
const Badge: FC<BadgeProps> = ({
|
|
10
|
+
const Badge: FC<BadgeProps> = ({
|
|
11
|
+
label = 'Label',
|
|
12
|
+
style,
|
|
13
|
+
backgroundColor,
|
|
14
|
+
accessibilityLabel,
|
|
15
|
+
}) => {
|
|
11
16
|
const {theme} = useContext(ApplicationContext);
|
|
12
17
|
|
|
13
18
|
const isValidatedColor = () => {
|
|
@@ -46,7 +51,10 @@ const Badge: FC<BadgeProps> = ({label = 'Label', style, backgroundColor}) => {
|
|
|
46
51
|
|
|
47
52
|
return (
|
|
48
53
|
<View style={[style, styles.badge, {backgroundColor: badgeColor}]}>
|
|
49
|
-
<Text
|
|
54
|
+
<Text
|
|
55
|
+
color={Colors.black_01}
|
|
56
|
+
typography={'action_xxs_bold'}
|
|
57
|
+
accessibilityLabel={accessibilityLabel}>
|
|
50
58
|
{formatTitle()}
|
|
51
59
|
</Text>
|
|
52
60
|
</View>
|
package/Badge/types.ts
CHANGED
package/Button/index.tsx
CHANGED
|
@@ -76,6 +76,8 @@ export interface ButtonProps extends TouchableOpacityProps {
|
|
|
76
76
|
onPress: () => void;
|
|
77
77
|
|
|
78
78
|
params?: any;
|
|
79
|
+
|
|
80
|
+
accessibilityLabelTitle?: string;
|
|
79
81
|
}
|
|
80
82
|
|
|
81
83
|
const Button: FC<ButtonProps> = ({
|
|
@@ -87,7 +89,9 @@ const Button: FC<ButtonProps> = ({
|
|
|
87
89
|
iconLeft,
|
|
88
90
|
loading = false,
|
|
89
91
|
title = 'Button',
|
|
92
|
+
onPress,
|
|
90
93
|
params,
|
|
94
|
+
accessibilityLabelTitle,
|
|
91
95
|
...rest
|
|
92
96
|
}) => {
|
|
93
97
|
const {theme, config} = useContext(ApplicationContext);
|
|
@@ -223,7 +227,11 @@ const Button: FC<ButtonProps> = ({
|
|
|
223
227
|
const typography = getTypography();
|
|
224
228
|
const textColor = getTextColor();
|
|
225
229
|
return (
|
|
226
|
-
<Text
|
|
230
|
+
<Text
|
|
231
|
+
typography={typography}
|
|
232
|
+
color={textColor}
|
|
233
|
+
numberOfLines={1}
|
|
234
|
+
accessibilityLabel={accessibilityLabelTitle}>
|
|
227
235
|
{title}
|
|
228
236
|
</Text>
|
|
229
237
|
);
|
|
@@ -309,7 +317,12 @@ const Button: FC<ButtonProps> = ({
|
|
|
309
317
|
<TouchableOpacity
|
|
310
318
|
{...rest}
|
|
311
319
|
disabled={type === 'disabled'}
|
|
320
|
+
accessibilityState={{
|
|
321
|
+
...rest.accessibilityState,
|
|
322
|
+
disabled: type === 'disabled',
|
|
323
|
+
}}
|
|
312
324
|
activeOpacity={0.5}
|
|
325
|
+
onPress={onPress}
|
|
313
326
|
style={buttonStyle}>
|
|
314
327
|
{renderLeading()}
|
|
315
328
|
{renderTitle()}
|
package/CheckBox/index.tsx
CHANGED
|
@@ -14,7 +14,9 @@ const CheckBox: FC<CheckBoxProps> = ({
|
|
|
14
14
|
label,
|
|
15
15
|
indeterminate,
|
|
16
16
|
params,
|
|
17
|
-
|
|
17
|
+
accessibilityLabel,
|
|
18
|
+
accessibilityState,
|
|
19
|
+
accessibilityLabelLabel,
|
|
18
20
|
}) => {
|
|
19
21
|
const {theme} = useContext(ApplicationContext);
|
|
20
22
|
const haveValue = value || indeterminate;
|
|
@@ -46,7 +48,8 @@ const CheckBox: FC<CheckBoxProps> = ({
|
|
|
46
48
|
componentValue: indeterminate ? 'undetermined' : value,
|
|
47
49
|
}}>
|
|
48
50
|
<TouchableOpacity
|
|
49
|
-
{
|
|
51
|
+
accessibilityLabel={accessibilityLabel}
|
|
52
|
+
accessibilityState={accessibilityState}
|
|
50
53
|
activeOpacity={0.8}
|
|
51
54
|
onPress={() => onChange?.(!value)}
|
|
52
55
|
disabled={disabled}
|
|
@@ -64,7 +67,13 @@ const CheckBox: FC<CheckBoxProps> = ({
|
|
|
64
67
|
/>
|
|
65
68
|
)}
|
|
66
69
|
</View>
|
|
67
|
-
{!!label &&
|
|
70
|
+
{!!label && (
|
|
71
|
+
<Text
|
|
72
|
+
typography={'body_default_regular'}
|
|
73
|
+
accessibilityLabel={accessibilityLabelLabel}>
|
|
74
|
+
{label}
|
|
75
|
+
</Text>
|
|
76
|
+
)}
|
|
68
77
|
</TouchableOpacity>
|
|
69
78
|
</ComponentContext.Provider>
|
|
70
79
|
);
|
package/CheckBox/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {TouchableOpacityProps} from 'react-native';
|
|
1
|
+
import {TouchableOpacityProps, ViewStyle} from 'react-native';
|
|
2
2
|
|
|
3
3
|
export interface CheckBoxProps extends TouchableOpacityProps {
|
|
4
4
|
/**
|
|
@@ -31,7 +31,15 @@ export interface CheckBoxProps extends TouchableOpacityProps {
|
|
|
31
31
|
indeterminate?: boolean;
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
* Optional.
|
|
34
|
+
* Optional. Used to apply custom styling to the CheckBox component.
|
|
35
|
+
* Accepts an object of style properties.
|
|
35
36
|
*/
|
|
37
|
+
style?: ViewStyle;
|
|
38
|
+
|
|
36
39
|
params?: any;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Optional. Represents the label for the CheckBox component.
|
|
43
|
+
*/
|
|
44
|
+
accessibilityLabelLabel?: string;
|
|
37
45
|
}
|
package/Icon/index.tsx
CHANGED
|
@@ -10,7 +10,7 @@ const Icon: React.FC<IconProps> = ({
|
|
|
10
10
|
size = 24,
|
|
11
11
|
color,
|
|
12
12
|
style = {},
|
|
13
|
-
|
|
13
|
+
accessibilityLabel,
|
|
14
14
|
}) => {
|
|
15
15
|
const {theme} = useContext(ApplicationContext);
|
|
16
16
|
|
|
@@ -31,11 +31,11 @@ const Icon: React.FC<IconProps> = ({
|
|
|
31
31
|
|
|
32
32
|
return (
|
|
33
33
|
<Image
|
|
34
|
-
{...props}
|
|
35
34
|
loading={false}
|
|
36
35
|
source={getIconSource()}
|
|
37
36
|
style={[style, {width: size, height: size}]}
|
|
38
37
|
resizeMode="contain"
|
|
38
|
+
accessibilityLabel={accessibilityLabel}
|
|
39
39
|
{...tintColorProps}
|
|
40
40
|
/>
|
|
41
41
|
);
|
package/Icon/types.ts
CHANGED
package/IconButton/index.tsx
CHANGED
|
@@ -26,9 +26,6 @@ export interface IconButtonProps extends TouchableOpacityProps {
|
|
|
26
26
|
*/
|
|
27
27
|
size?: 'large' | 'small';
|
|
28
28
|
|
|
29
|
-
/**
|
|
30
|
-
* Optional. Params for tracking
|
|
31
|
-
*/
|
|
32
29
|
params?: any;
|
|
33
30
|
}
|
|
34
31
|
|
|
@@ -36,7 +33,9 @@ const IconButton: React.FC<IconButtonProps> = ({
|
|
|
36
33
|
type = 'primary',
|
|
37
34
|
icon,
|
|
38
35
|
size,
|
|
36
|
+
onPress,
|
|
39
37
|
params,
|
|
38
|
+
accessibilityLabel,
|
|
40
39
|
...rest
|
|
41
40
|
}) => {
|
|
42
41
|
const {theme} = useContext(ApplicationContext);
|
|
@@ -125,7 +124,9 @@ const IconButton: React.FC<IconButtonProps> = ({
|
|
|
125
124
|
<TouchableOpacity
|
|
126
125
|
{...rest}
|
|
127
126
|
disabled={type === 'disabled'}
|
|
127
|
+
accessibilityLabel={accessibilityLabel}
|
|
128
128
|
activeOpacity={activeOpacity}
|
|
129
|
+
onPress={onPress}
|
|
129
130
|
style={buttonStyle}>
|
|
130
131
|
<Icon size={iconSize} source={icon} color={getIconColor()} />
|
|
131
132
|
</TouchableOpacity>
|
package/Image/index.tsx
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import React, {useContext, useRef, useState} from 'react';
|
|
2
2
|
import {StyleSheet, View} from 'react-native';
|
|
3
|
-
import FastImage from 'react-native-fast-image';
|
|
3
|
+
import FastImage, {Source} from 'react-native-fast-image';
|
|
4
4
|
import styles from './styles';
|
|
5
5
|
import {ApplicationContext, SkeletonContext} from '../Application';
|
|
6
6
|
import {Skeleton} from '../Skeleton';
|
|
7
7
|
import {Icon} from '../Icon';
|
|
8
8
|
import {Styles} from '../Consts';
|
|
9
9
|
import {ImageProps} from './types';
|
|
10
|
-
import {getImageName} from '../Application/utils';
|
|
11
10
|
|
|
12
11
|
type Status = 'success' | 'loading' | 'error';
|
|
13
12
|
|
|
@@ -25,7 +24,7 @@ const Image: React.FC<ImageProps> = ({
|
|
|
25
24
|
const [status, setStatus] = useState<Status>('success');
|
|
26
25
|
|
|
27
26
|
const test: any = {
|
|
28
|
-
accessibilityLabel: accessibilityLabel || `img|${
|
|
27
|
+
accessibilityLabel: accessibilityLabel || `img|${(source as Source).uri}`,
|
|
29
28
|
};
|
|
30
29
|
|
|
31
30
|
/**
|
package/Input/Input.tsx
CHANGED
|
@@ -13,7 +13,11 @@ import {
|
|
|
13
13
|
TouchableOpacity,
|
|
14
14
|
View,
|
|
15
15
|
} from 'react-native';
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
ApplicationContext,
|
|
18
|
+
ComponentContext,
|
|
19
|
+
setAutomationID,
|
|
20
|
+
} from '../Application';
|
|
17
21
|
import {Icon} from '../Icon';
|
|
18
22
|
import {Loader} from '../Loader';
|
|
19
23
|
import {exportFontFamily, Text} from '../Text';
|
|
@@ -37,6 +41,9 @@ const Input = forwardRef(
|
|
|
37
41
|
onBlur,
|
|
38
42
|
onFocus,
|
|
39
43
|
errorMessage,
|
|
44
|
+
icon,
|
|
45
|
+
iconColor,
|
|
46
|
+
onPressIcon,
|
|
40
47
|
trailing,
|
|
41
48
|
trailingColor,
|
|
42
49
|
onPressTrailing,
|
|
@@ -53,10 +60,16 @@ const Input = forwardRef(
|
|
|
53
60
|
style,
|
|
54
61
|
params,
|
|
55
62
|
hintText,
|
|
63
|
+
accessibilityLabel,
|
|
56
64
|
editable = true,
|
|
57
65
|
onPressFloatingIcon,
|
|
58
66
|
onPressLeadingIcon,
|
|
59
67
|
showClearIcon = true,
|
|
68
|
+
accessibilityLabelErrorMessage,
|
|
69
|
+
accessibilityLabelFloatingValue,
|
|
70
|
+
accessibilityLabelLeadingIcon,
|
|
71
|
+
accessibilityLabelTrailingIcon,
|
|
72
|
+
accessibilityLabelClearIcon,
|
|
60
73
|
...props
|
|
61
74
|
}: InputProps,
|
|
62
75
|
ref
|
|
@@ -113,7 +126,8 @@ const Input = forwardRef(
|
|
|
113
126
|
return (
|
|
114
127
|
<TouchableOpacity
|
|
115
128
|
onPress={() => setSecureTextInput(!secureTextInput)}
|
|
116
|
-
style={styles.icon}
|
|
129
|
+
style={styles.icon}
|
|
130
|
+
accessibilityLabel={accessibilityLabelTrailingIcon}>
|
|
117
131
|
<Icon
|
|
118
132
|
color={color}
|
|
119
133
|
size={24}
|
|
@@ -124,17 +138,24 @@ const Input = forwardRef(
|
|
|
124
138
|
</TouchableOpacity>
|
|
125
139
|
);
|
|
126
140
|
}
|
|
127
|
-
if (trailing) {
|
|
141
|
+
if (icon || trailing) {
|
|
128
142
|
const renderIconTouchable = (icon: ReactNode) => {
|
|
129
143
|
return (
|
|
130
|
-
<TouchableOpacity
|
|
144
|
+
<TouchableOpacity
|
|
145
|
+
onPress={onPressTrailing ?? onPressIcon}
|
|
146
|
+
style={styles.icon}>
|
|
131
147
|
{icon}
|
|
132
148
|
</TouchableOpacity>
|
|
133
149
|
);
|
|
134
150
|
};
|
|
135
|
-
|
|
151
|
+
const trailingValue = icon || trailing;
|
|
152
|
+
if (trailingValue?.includes('_') || trailingValue?.includes('http')) {
|
|
136
153
|
return renderIconTouchable(
|
|
137
|
-
<Icon
|
|
154
|
+
<Icon
|
|
155
|
+
color={color}
|
|
156
|
+
source={(icon || trailing) as string}
|
|
157
|
+
size={24}
|
|
158
|
+
/>
|
|
138
159
|
);
|
|
139
160
|
}
|
|
140
161
|
return renderIconTouchable(
|
|
@@ -142,7 +163,7 @@ const Input = forwardRef(
|
|
|
142
163
|
typography="action_xs_bold"
|
|
143
164
|
color={color ?? theme.colors.primary}
|
|
144
165
|
numberOfLines={1}>
|
|
145
|
-
{
|
|
166
|
+
{trailingValue!.substring(0, 15)}
|
|
146
167
|
</Text>
|
|
147
168
|
);
|
|
148
169
|
}
|
|
@@ -156,7 +177,7 @@ const Input = forwardRef(
|
|
|
156
177
|
const secure = secureTextInput && secureTextEntry;
|
|
157
178
|
let textColor = theme.colors.text.default;
|
|
158
179
|
let placeholderColor = theme.colors.text.hint;
|
|
159
|
-
let iconTintColor = trailingColor;
|
|
180
|
+
let iconTintColor = trailingColor ?? iconColor;
|
|
160
181
|
|
|
161
182
|
if (disabled) {
|
|
162
183
|
textColor = disabledColor;
|
|
@@ -179,11 +200,14 @@ const Input = forwardRef(
|
|
|
179
200
|
required={required}
|
|
180
201
|
floatingIcon={floatingIcon}
|
|
181
202
|
onPress={onPressFloatingIcon}
|
|
203
|
+
accessibilityLabel={accessibilityLabelFloatingValue}
|
|
182
204
|
/>
|
|
183
205
|
<View style={styles.inputView}>
|
|
184
206
|
{!!leadingIcon && (
|
|
185
207
|
<View style={styles.leadingIconContainer}>
|
|
186
|
-
<TouchableOpacity
|
|
208
|
+
<TouchableOpacity
|
|
209
|
+
onPress={onPressLeadingIcon}
|
|
210
|
+
accessibilityLabel={accessibilityLabelLeadingIcon}>
|
|
187
211
|
<Icon
|
|
188
212
|
color={leadingIconColor}
|
|
189
213
|
source={leadingIcon}
|
|
@@ -194,6 +218,11 @@ const Input = forwardRef(
|
|
|
194
218
|
)}
|
|
195
219
|
<TextInput
|
|
196
220
|
{...props}
|
|
221
|
+
{...setAutomationID(accessibilityLabel)}
|
|
222
|
+
accessibilityState={{
|
|
223
|
+
...props.accessibilityState,
|
|
224
|
+
disabled: disabled,
|
|
225
|
+
}}
|
|
197
226
|
editable={editable && !disabled}
|
|
198
227
|
secureTextEntry={secure}
|
|
199
228
|
textAlignVertical="center"
|
|
@@ -222,7 +251,8 @@ const Input = forwardRef(
|
|
|
222
251
|
{showClearIcon && focused && haveValue && (
|
|
223
252
|
<TouchableOpacity
|
|
224
253
|
style={styles.iconWrapper}
|
|
225
|
-
onPress={onClearText}
|
|
254
|
+
onPress={onClearText}
|
|
255
|
+
accessibilityLabel={accessibilityLabelClearIcon}>
|
|
226
256
|
<Icon
|
|
227
257
|
source="24_navigation_close_circle_full"
|
|
228
258
|
size={16}
|
|
@@ -260,6 +290,7 @@ const Input = forwardRef(
|
|
|
260
290
|
errorMessage={errorMessage}
|
|
261
291
|
errorSpacing={errorSpacing}
|
|
262
292
|
hintText={hintText}
|
|
293
|
+
accessibilityLabel={accessibilityLabelErrorMessage}
|
|
263
294
|
/>
|
|
264
295
|
</View>
|
|
265
296
|
</ComponentContext.Provider>
|
package/Input/InputDropDown.tsx
CHANGED
|
@@ -14,6 +14,7 @@ const InputDropDown = ({
|
|
|
14
14
|
floatingIcon,
|
|
15
15
|
onPressFloatingIcon,
|
|
16
16
|
size = 'small',
|
|
17
|
+
onPress,
|
|
17
18
|
placeholder,
|
|
18
19
|
errorMessage,
|
|
19
20
|
disabled = false,
|
|
@@ -24,9 +25,13 @@ const InputDropDown = ({
|
|
|
24
25
|
leadingIconColor,
|
|
25
26
|
style,
|
|
26
27
|
params,
|
|
28
|
+
accessibilityLabel,
|
|
27
29
|
hintText,
|
|
28
30
|
multiline,
|
|
29
|
-
|
|
31
|
+
accessibilityLabelText,
|
|
32
|
+
accessibilityLabelTouchable,
|
|
33
|
+
accessibilityLabelErrorMessage,
|
|
34
|
+
accessibilityLabelFloatingValue,
|
|
30
35
|
}: InputDropDownProps) => {
|
|
31
36
|
const {theme} = useContext(ApplicationContext);
|
|
32
37
|
|
|
@@ -49,15 +54,16 @@ const InputDropDown = ({
|
|
|
49
54
|
styles.inputDropDownWrapper,
|
|
50
55
|
{backgroundColor: theme.colors.background.surface},
|
|
51
56
|
getSizeStyle(size, multiline),
|
|
52
|
-
getBorderColor(theme, false, errorMessage, disabled
|
|
57
|
+
getBorderColor(theme, false, errorMessage, disabled),
|
|
53
58
|
]}>
|
|
54
59
|
<FloatingView
|
|
55
60
|
floatingValue={floatingValue}
|
|
56
61
|
floatingIconColor={floatingIconColor}
|
|
57
|
-
disabled={disabled
|
|
62
|
+
disabled={disabled}
|
|
58
63
|
required={required}
|
|
59
64
|
floatingIcon={floatingIcon}
|
|
60
65
|
onPress={onPressFloatingIcon}
|
|
66
|
+
accessibilityLabel={accessibilityLabelFloatingValue}
|
|
61
67
|
/>
|
|
62
68
|
<View style={styles.inputDropDownView}>
|
|
63
69
|
{!!leadingIcon && (
|
|
@@ -76,11 +82,14 @@ const InputDropDown = ({
|
|
|
76
82
|
/>
|
|
77
83
|
</View>
|
|
78
84
|
)}
|
|
79
|
-
<View
|
|
85
|
+
<View
|
|
86
|
+
accessibilityLabel={accessibilityLabel}
|
|
87
|
+
style={styles.textViewDropDown}>
|
|
80
88
|
<Text
|
|
81
89
|
numberOfLines={multiline ? undefined : 1}
|
|
82
90
|
typography={'body_default_regular'}
|
|
83
|
-
color={value ? textColor : placeholderColor}
|
|
91
|
+
color={value ? textColor : placeholderColor}
|
|
92
|
+
accessibilityLabel={accessibilityLabelText}>
|
|
84
93
|
{value || placeholder}
|
|
85
94
|
</Text>
|
|
86
95
|
</View>
|
|
@@ -107,14 +116,18 @@ const InputDropDown = ({
|
|
|
107
116
|
state: 'enabled',
|
|
108
117
|
}}>
|
|
109
118
|
<TouchableOpacity
|
|
110
|
-
{...props}
|
|
111
119
|
activeOpacity={0.6}
|
|
112
|
-
|
|
120
|
+
onPress={onPress}
|
|
121
|
+
style={[style, styles.wrapper]}
|
|
122
|
+
accessibilityLabel={accessibilityLabelTouchable}
|
|
123
|
+
accessibilityState={{disabled}}
|
|
124
|
+
disabled={disabled}>
|
|
113
125
|
{renderInputView()}
|
|
114
126
|
<ErrorView
|
|
115
127
|
errorMessage={errorMessage}
|
|
116
128
|
errorSpacing={errorSpacing}
|
|
117
129
|
hintText={hintText}
|
|
130
|
+
accessibilityLabel={accessibilityLabelErrorMessage}
|
|
118
131
|
/>
|
|
119
132
|
</TouchableOpacity>
|
|
120
133
|
</ComponentContext.Provider>
|
package/Input/InputMoney.tsx
CHANGED
|
@@ -37,6 +37,9 @@ const InputMoney = forwardRef(
|
|
|
37
37
|
onBlur,
|
|
38
38
|
onFocus,
|
|
39
39
|
errorMessage,
|
|
40
|
+
icon,
|
|
41
|
+
iconColor,
|
|
42
|
+
onPressIcon,
|
|
40
43
|
trailing,
|
|
41
44
|
trailingColor,
|
|
42
45
|
onPressTrailing,
|
|
@@ -47,12 +50,15 @@ const InputMoney = forwardRef(
|
|
|
47
50
|
style,
|
|
48
51
|
params,
|
|
49
52
|
defaultValue = '',
|
|
53
|
+
accessibilityLabel,
|
|
50
54
|
hintText,
|
|
51
55
|
value: _value,
|
|
52
56
|
onPressFloatingIcon,
|
|
53
57
|
placeholder = '0đ',
|
|
54
58
|
currency = 'đ',
|
|
55
59
|
showClearIcon = true,
|
|
60
|
+
accessibilityLabelErrorMessage,
|
|
61
|
+
accessibilityLabelFloatingValue,
|
|
56
62
|
...props
|
|
57
63
|
}: InputMoneyProps,
|
|
58
64
|
ref
|
|
@@ -115,7 +121,7 @@ const InputMoney = forwardRef(
|
|
|
115
121
|
const disabledColor = theme.colors.text.disable;
|
|
116
122
|
let textColor = theme.colors.text.default;
|
|
117
123
|
let placeholderColor = theme.colors.text.hint;
|
|
118
|
-
let iconTintColor = trailingColor;
|
|
124
|
+
let iconTintColor = trailingColor ?? iconColor;
|
|
119
125
|
|
|
120
126
|
if (disabled) {
|
|
121
127
|
textColor = disabledColor;
|
|
@@ -138,10 +144,16 @@ const InputMoney = forwardRef(
|
|
|
138
144
|
required={required}
|
|
139
145
|
floatingIcon={floatingIcon}
|
|
140
146
|
onPress={onPressFloatingIcon}
|
|
147
|
+
accessibilityLabel={accessibilityLabelFloatingValue}
|
|
141
148
|
/>
|
|
142
149
|
<View style={styles.inputView}>
|
|
143
150
|
<TextInput
|
|
144
151
|
{...props}
|
|
152
|
+
accessibilityLabel={accessibilityLabel}
|
|
153
|
+
accessibilityState={{
|
|
154
|
+
...props.accessibilityState,
|
|
155
|
+
disabled: disabled,
|
|
156
|
+
}}
|
|
145
157
|
editable={!disabled}
|
|
146
158
|
ref={inputRef}
|
|
147
159
|
keyboardType={'number-pad'}
|
|
@@ -175,10 +187,10 @@ const InputMoney = forwardRef(
|
|
|
175
187
|
)}
|
|
176
188
|
<RenderTrailing
|
|
177
189
|
color={iconTintColor}
|
|
178
|
-
icon={
|
|
190
|
+
icon={icon}
|
|
179
191
|
trailing={trailing}
|
|
180
192
|
onPressTrailing={onPressTrailing}
|
|
181
|
-
onPressIcon={
|
|
193
|
+
onPressIcon={onPressIcon}
|
|
182
194
|
loading={loading}
|
|
183
195
|
/>
|
|
184
196
|
</View>
|
|
@@ -212,6 +224,7 @@ const InputMoney = forwardRef(
|
|
|
212
224
|
errorMessage={errorMessage}
|
|
213
225
|
errorSpacing={errorSpacing}
|
|
214
226
|
hintText={hintText}
|
|
227
|
+
accessibilityLabel={accessibilityLabelErrorMessage}
|
|
215
228
|
/>
|
|
216
229
|
</View>
|
|
217
230
|
</ComponentContext.Provider>
|
package/Input/InputOTP.tsx
CHANGED
|
@@ -77,6 +77,7 @@ const InputOTP = forwardRef(
|
|
|
77
77
|
dataType = 'number',
|
|
78
78
|
params,
|
|
79
79
|
style,
|
|
80
|
+
accessibilityLabel,
|
|
80
81
|
hintText,
|
|
81
82
|
...props
|
|
82
83
|
}: InputOTPProps,
|
|
@@ -209,6 +210,7 @@ const InputOTP = forwardRef(
|
|
|
209
210
|
<View style={styles.otpRealInputWrapper}>
|
|
210
211
|
<TextInput
|
|
211
212
|
{...props}
|
|
213
|
+
accessibilityLabel={accessibilityLabel}
|
|
212
214
|
ref={inputRef}
|
|
213
215
|
value={value}
|
|
214
216
|
onChangeText={_onChangeText}
|
package/Input/InputSearch.tsx
CHANGED
|
@@ -118,6 +118,9 @@ const InputSearch: ForwardRefRenderFunction<InputRef, InputSearchProps> = (
|
|
|
118
118
|
onFocus,
|
|
119
119
|
onBlur,
|
|
120
120
|
value,
|
|
121
|
+
icon,
|
|
122
|
+
iconColor,
|
|
123
|
+
onPressIcon,
|
|
121
124
|
trailing,
|
|
122
125
|
trailingColor,
|
|
123
126
|
onPressTrailing,
|
|
@@ -129,6 +132,7 @@ const InputSearch: ForwardRefRenderFunction<InputRef, InputSearchProps> = (
|
|
|
129
132
|
onPressButtonText,
|
|
130
133
|
params,
|
|
131
134
|
backgroundColor,
|
|
135
|
+
accessibilityLabel,
|
|
132
136
|
onPress,
|
|
133
137
|
typingData,
|
|
134
138
|
...props
|
|
@@ -198,6 +202,7 @@ const InputSearch: ForwardRefRenderFunction<InputRef, InputSearchProps> = (
|
|
|
198
202
|
return (
|
|
199
203
|
<TextInput
|
|
200
204
|
{...props}
|
|
205
|
+
accessibilityLabel={accessibilityLabel}
|
|
201
206
|
textAlignVertical="center"
|
|
202
207
|
allowFontScaling={false}
|
|
203
208
|
ref={inputRef}
|
|
@@ -234,8 +239,10 @@ const InputSearch: ForwardRefRenderFunction<InputRef, InputSearchProps> = (
|
|
|
234
239
|
/>
|
|
235
240
|
</TouchableOpacity>
|
|
236
241
|
)}
|
|
237
|
-
{!!trailing && (
|
|
238
|
-
<TouchableOpacity
|
|
242
|
+
{!!(icon || trailing) && (
|
|
243
|
+
<TouchableOpacity
|
|
244
|
+
style={Styles.row}
|
|
245
|
+
onPress={onPressTrailing ?? onPressIcon}>
|
|
239
246
|
<View
|
|
240
247
|
style={[
|
|
241
248
|
styles.divider,
|
|
@@ -245,8 +252,8 @@ const InputSearch: ForwardRefRenderFunction<InputRef, InputSearchProps> = (
|
|
|
245
252
|
]}
|
|
246
253
|
/>
|
|
247
254
|
<Icon
|
|
248
|
-
color={trailingColor}
|
|
249
|
-
source={trailing as string}
|
|
255
|
+
color={iconColor || trailingColor}
|
|
256
|
+
source={(icon || trailing) as string}
|
|
250
257
|
style={styles.iconSearchInput}
|
|
251
258
|
/>
|
|
252
259
|
</TouchableOpacity>
|
package/Input/common.tsx
CHANGED
|
@@ -22,6 +22,7 @@ type FloatingViewProps = {
|
|
|
22
22
|
required?: boolean;
|
|
23
23
|
style?: ViewStyle;
|
|
24
24
|
onPress?: (e: GestureResponderEvent) => void;
|
|
25
|
+
accessibilityLabel?: string;
|
|
25
26
|
};
|
|
26
27
|
|
|
27
28
|
type TrailingProps = {
|
|
@@ -80,7 +81,8 @@ export const ErrorView: FC<{
|
|
|
80
81
|
errorMessage?: string;
|
|
81
82
|
errorSpacing?: boolean;
|
|
82
83
|
hintText?: string;
|
|
83
|
-
|
|
84
|
+
accessibilityLabel?: string;
|
|
85
|
+
}> = ({errorMessage, errorSpacing, hintText, accessibilityLabel}) => {
|
|
84
86
|
const {theme} = useContext(ApplicationContext);
|
|
85
87
|
const errorColor = theme.colors.error.primary;
|
|
86
88
|
const hintColor = theme.colors.text.hint;
|
|
@@ -98,6 +100,7 @@ export const ErrorView: FC<{
|
|
|
98
100
|
<Text
|
|
99
101
|
style={Styles.flex}
|
|
100
102
|
color={errorMessage ? errorColor : hintColor}
|
|
103
|
+
accessibilityLabel={accessibilityLabel}
|
|
101
104
|
typography={'description_default_regular'}>
|
|
102
105
|
{errorMessage ?? hintTextDefault}
|
|
103
106
|
</Text>
|
|
@@ -118,6 +121,7 @@ export const FloatingView: FC<FloatingViewProps> = ({
|
|
|
118
121
|
required,
|
|
119
122
|
style,
|
|
120
123
|
onPress,
|
|
124
|
+
accessibilityLabel,
|
|
121
125
|
}) => {
|
|
122
126
|
const {theme} = useContext(ApplicationContext);
|
|
123
127
|
|
|
@@ -139,7 +143,10 @@ export const FloatingView: FC<FloatingViewProps> = ({
|
|
|
139
143
|
},
|
|
140
144
|
style,
|
|
141
145
|
]}>
|
|
142
|
-
<Text
|
|
146
|
+
<Text
|
|
147
|
+
color={floatingTextColor}
|
|
148
|
+
typography={'label_s_medium'}
|
|
149
|
+
accessibilityLabel={accessibilityLabel}>
|
|
143
150
|
{floatingValue}
|
|
144
151
|
{required && (
|
|
145
152
|
<Text
|
package/Input/index.tsx
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
GestureResponderEvent,
|
|
3
|
-
TextInputProps,
|
|
4
|
-
TouchableOpacityProps,
|
|
5
|
-
} from 'react-native';
|
|
1
|
+
import {GestureResponderEvent, TextInputProps, ViewStyle} from 'react-native';
|
|
6
2
|
import Input from './Input';
|
|
7
3
|
import InputDropDown from './InputDropDown';
|
|
8
4
|
import InputMoney from './InputMoney';
|
|
@@ -33,6 +29,24 @@ export interface InputProps extends TextInputProps {
|
|
|
33
29
|
*/
|
|
34
30
|
errorMessage?: string;
|
|
35
31
|
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated Use `trailing` instead.
|
|
34
|
+
* Optional. Represents the name or key of the icon to be displayed in the Input component.
|
|
35
|
+
*/
|
|
36
|
+
icon?: string;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated Use `trailingColor` instead.
|
|
40
|
+
* Optional. Represents the color of the icon in the Input component.
|
|
41
|
+
*/
|
|
42
|
+
iconColor?: string;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated Use `onPressTrailing` instead.
|
|
46
|
+
* Optional. callback function to be called when the icon is pressed.
|
|
47
|
+
*/
|
|
48
|
+
onPressIcon?: () => void;
|
|
49
|
+
|
|
36
50
|
/**
|
|
37
51
|
* Optional. Represents the name or key of the icon to be displayed in the Input component.
|
|
38
52
|
*/
|
|
@@ -117,6 +131,36 @@ export interface InputProps extends TextInputProps {
|
|
|
117
131
|
* Optional. Represents the style of the Input component.
|
|
118
132
|
*/
|
|
119
133
|
showClearIcon?: boolean;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Optional. Represents the accessibility label for the error message.
|
|
137
|
+
* This is read out by screen readers.
|
|
138
|
+
*/
|
|
139
|
+
accessibilityLabelErrorMessage?: string;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Optional. Represents the accessibility label for the Floating Value.
|
|
143
|
+
* This is read out by screen readers.
|
|
144
|
+
*/
|
|
145
|
+
accessibilityLabelFloatingValue?: string;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Optional. Represents the accessibility label for the leading Icon.
|
|
149
|
+
* This is read out by screen readers.
|
|
150
|
+
*/
|
|
151
|
+
accessibilityLabelLeadingIcon?: string;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Optional. Represents the accessibility label for the trailing Icon.
|
|
155
|
+
* This is read out by screen readers.
|
|
156
|
+
*/
|
|
157
|
+
accessibilityLabelTrailingIcon?: string;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Optional. Represents the accessibility label for the clear Icon.
|
|
161
|
+
* This is read out by screen readers.
|
|
162
|
+
*/
|
|
163
|
+
accessibilityLabelClearIcon?: string;
|
|
120
164
|
}
|
|
121
165
|
|
|
122
166
|
export interface InputTextAreaProps extends Omit<InputProps, 'size'> {
|
|
@@ -238,7 +282,8 @@ export type CaretProps = {
|
|
|
238
282
|
length?: number;
|
|
239
283
|
};
|
|
240
284
|
|
|
241
|
-
export interface InputDropDownProps
|
|
285
|
+
export interface InputDropDownProps
|
|
286
|
+
extends Omit<InputProps, 'trailing' | 'trailingColor' | 'onPressTrailing'> {
|
|
242
287
|
/**
|
|
243
288
|
* Optional. Defines the size of the InputDropDown component.
|
|
244
289
|
* 'small' - A smaller, less prominent input.
|
|
@@ -247,100 +292,51 @@ export interface InputDropDownProps extends TouchableOpacityProps {
|
|
|
247
292
|
size?: 'small' | 'large';
|
|
248
293
|
|
|
249
294
|
/**
|
|
250
|
-
* Optional.
|
|
251
|
-
*/
|
|
252
|
-
value?: string;
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* Optional. Represents the placeholder text to be displayed in the InputDropDown component.
|
|
256
|
-
*/
|
|
257
|
-
placeholder?: string;
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
* Optional. Represents the data for the dropdown.
|
|
295
|
+
* Optional. Function to be called when the InputDropDown is pressed.
|
|
261
296
|
*/
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* Optional. Represents the value for the floating title in the Input component.
|
|
266
|
-
*/
|
|
267
|
-
floatingValue?: string;
|
|
297
|
+
onPress?: () => void;
|
|
268
298
|
|
|
269
299
|
/**
|
|
270
|
-
* Optional.
|
|
271
|
-
|
|
272
|
-
floatingIcon?: string;
|
|
273
|
-
|
|
274
|
-
/**
|
|
275
|
-
* Optional. Represents the error message to be displayed below the Input component when there is an error.
|
|
276
|
-
*/
|
|
277
|
-
errorMessage?: string;
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* @deprecated Use `trailing` instead.
|
|
281
|
-
* Optional. Represents the name or key of the icon to be displayed in the Input component.
|
|
282
|
-
*/
|
|
283
|
-
icon?: string;
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* @deprecated Use `onPressTrailing` instead.
|
|
287
|
-
* Optional. callback function to be called when the icon is pressed.
|
|
288
|
-
*/
|
|
289
|
-
onPressIcon?: () => void;
|
|
290
|
-
|
|
291
|
-
/**
|
|
292
|
-
* Optional. Represents the color of the floating icon in the Input component.
|
|
300
|
+
* Optional. If `true`, the user won't be able to interact with the InputDropDown component.
|
|
301
|
+
* Defaults to `false` if not provided.
|
|
293
302
|
*/
|
|
294
|
-
|
|
303
|
+
disabled?: boolean;
|
|
295
304
|
|
|
296
305
|
/**
|
|
297
|
-
* Optional. If `true`, the
|
|
306
|
+
* Optional. If `true`, the InputDropDown component is marked as required,
|
|
298
307
|
* indicating that the user must provide a value before submitting a form.
|
|
299
308
|
* Defaults to `false` if not provided.
|
|
300
309
|
*/
|
|
301
310
|
required?: boolean;
|
|
302
311
|
|
|
303
312
|
/**
|
|
304
|
-
* Optional.
|
|
305
|
-
* include spacing when Input not have error message.
|
|
306
|
-
* Defaults to `false` if not provided.
|
|
307
|
-
*/
|
|
308
|
-
errorSpacing?: boolean;
|
|
309
|
-
|
|
310
|
-
/**
|
|
311
|
-
* If true, the icon of input will use be show indicator loading.
|
|
312
|
-
*/
|
|
313
|
-
loading?: boolean;
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* Optional. Represents the leading icon in the Input component.
|
|
317
|
-
*/
|
|
318
|
-
leadingIcon?: string;
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
* Optional. callback function to be called when the leading icon is pressed.
|
|
313
|
+
* Optional. params for element tracking.
|
|
322
314
|
*/
|
|
323
|
-
|
|
315
|
+
params?: {
|
|
316
|
+
[key: string]: any;
|
|
317
|
+
};
|
|
324
318
|
|
|
325
319
|
/**
|
|
326
|
-
* Optional. Represents the
|
|
320
|
+
* Optional. Represents the style of the InputDropDown component.
|
|
327
321
|
*/
|
|
328
|
-
|
|
322
|
+
style?: ViewStyle | ViewStyle[];
|
|
329
323
|
|
|
330
324
|
/**
|
|
331
|
-
* Optional.
|
|
325
|
+
* Optional. Represents the data for the dropdown.
|
|
332
326
|
*/
|
|
333
|
-
|
|
327
|
+
multiline?: boolean;
|
|
334
328
|
|
|
335
329
|
/**
|
|
336
|
-
* Optional. Represents
|
|
330
|
+
* Optional. Represents the accessibility label for the InputDropDown component.
|
|
331
|
+
* This is read out by screen readers.
|
|
337
332
|
*/
|
|
338
|
-
|
|
333
|
+
accessibilityLabelText?: string;
|
|
339
334
|
|
|
340
335
|
/**
|
|
341
|
-
* Optional. Represents the
|
|
336
|
+
* Optional. Represents the accessibility Touchable for the InputDropDown component.
|
|
337
|
+
* This is read out by screen readers.
|
|
342
338
|
*/
|
|
343
|
-
|
|
339
|
+
accessibilityLabelTouchable?: string;
|
|
344
340
|
}
|
|
345
341
|
|
|
346
342
|
export type InputRef = {
|
package/Layout/Card.tsx
CHANGED
|
@@ -27,6 +27,7 @@ const Card: React.FC<CardProps> = ({
|
|
|
27
27
|
style,
|
|
28
28
|
backgroundImage,
|
|
29
29
|
useShadow = false,
|
|
30
|
+
accessibilityLabel,
|
|
30
31
|
...props
|
|
31
32
|
}) => {
|
|
32
33
|
const {showGrid, theme} = useContext(ApplicationContext);
|
|
@@ -156,7 +157,9 @@ const Card: React.FC<CardProps> = ({
|
|
|
156
157
|
},
|
|
157
158
|
!!backgroundImage && {backgroundColor: undefined},
|
|
158
159
|
useShadow && Shadow.Light,
|
|
159
|
-
]}
|
|
160
|
+
]}
|
|
161
|
+
accessibilityLabel={accessibilityLabel}
|
|
162
|
+
>
|
|
160
163
|
{!!backgroundImage && (
|
|
161
164
|
<Image
|
|
162
165
|
source={{uri: backgroundImage}}
|
package/Layout/Section.tsx
CHANGED
|
@@ -33,6 +33,7 @@ const Section: React.FC<SectionProps> = ({
|
|
|
33
33
|
useMargin = true,
|
|
34
34
|
backgroundImage,
|
|
35
35
|
style,
|
|
36
|
+
accessibilityLabel,
|
|
36
37
|
...props
|
|
37
38
|
}) => {
|
|
38
39
|
const {showGrid} = useContext(ApplicationContext);
|
|
@@ -161,7 +162,9 @@ const Section: React.FC<SectionProps> = ({
|
|
|
161
162
|
flexDirection: 'row',
|
|
162
163
|
flexWrap: 'wrap',
|
|
163
164
|
},
|
|
164
|
-
]}
|
|
165
|
+
]}
|
|
166
|
+
accessibilityLabel={accessibilityLabel}
|
|
167
|
+
>
|
|
165
168
|
{!!backgroundImage && (
|
|
166
169
|
<Image
|
|
167
170
|
source={{uri: backgroundImage}}
|
package/Radio/index.tsx
CHANGED
|
@@ -15,7 +15,9 @@ const Radio: FC<RadioProps> = ({
|
|
|
15
15
|
label,
|
|
16
16
|
style,
|
|
17
17
|
params,
|
|
18
|
-
|
|
18
|
+
accessibilityLabel,
|
|
19
|
+
accessibilityLabelText,
|
|
20
|
+
accessibilityState,
|
|
19
21
|
}) => {
|
|
20
22
|
const {theme} = useContext(ApplicationContext);
|
|
21
23
|
const selected = value === groupValue;
|
|
@@ -49,9 +51,10 @@ const Radio: FC<RadioProps> = ({
|
|
|
49
51
|
action: 'click',
|
|
50
52
|
}}>
|
|
51
53
|
<TouchableOpacity
|
|
52
|
-
{
|
|
53
|
-
|
|
54
|
+
accessibilityLabel={accessibilityLabel}
|
|
55
|
+
accessibilityState={accessibilityState}
|
|
54
56
|
onPress={onChange}
|
|
57
|
+
disabled={disabled}
|
|
55
58
|
style={[
|
|
56
59
|
style,
|
|
57
60
|
{
|
|
@@ -68,7 +71,10 @@ const Radio: FC<RadioProps> = ({
|
|
|
68
71
|
]}
|
|
69
72
|
/>
|
|
70
73
|
{!!label && (
|
|
71
|
-
<Text
|
|
74
|
+
<Text
|
|
75
|
+
typography={'body_default_regular'}
|
|
76
|
+
style={styles.radioText}
|
|
77
|
+
accessibilityLabel={accessibilityLabelText}>
|
|
72
78
|
{label}
|
|
73
79
|
</Text>
|
|
74
80
|
)}
|
|
@@ -78,3 +84,4 @@ const Radio: FC<RadioProps> = ({
|
|
|
78
84
|
};
|
|
79
85
|
|
|
80
86
|
export {Radio};
|
|
87
|
+
export type {RadioProps};
|
package/Radio/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {TouchableOpacityProps} from 'react-native';
|
|
1
|
+
import {TouchableOpacityProps, ViewStyle} from 'react-native';
|
|
2
2
|
|
|
3
3
|
export interface RadioProps extends TouchableOpacityProps {
|
|
4
4
|
/**
|
|
@@ -7,6 +7,12 @@ export interface RadioProps extends TouchableOpacityProps {
|
|
|
7
7
|
*/
|
|
8
8
|
value: any;
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* `disabled`: Optional. If `true`, the user won't be able to interact with the Radio component.
|
|
12
|
+
* Defaults to `false` if not provided.
|
|
13
|
+
*/
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
|
|
10
16
|
/**
|
|
11
17
|
* `label`: Optional. Represents the text label displayed next to the Radio component.
|
|
12
18
|
*/
|
|
@@ -25,7 +31,15 @@ export interface RadioProps extends TouchableOpacityProps {
|
|
|
25
31
|
groupValue: any;
|
|
26
32
|
|
|
27
33
|
/**
|
|
28
|
-
* Optional.
|
|
34
|
+
* `style`: Optional. Used to apply custom styling to the Radio component.
|
|
35
|
+
* Accepts an object of style properties.
|
|
29
36
|
*/
|
|
37
|
+
style?: ViewStyle;
|
|
38
|
+
|
|
30
39
|
params?: any;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* `accessibilityLabelText`: Optional. Represents the label for the Radio Label component.
|
|
43
|
+
*/
|
|
44
|
+
accessibilityLabelText?: string;
|
|
31
45
|
}
|
package/Switch/index.tsx
CHANGED
|
@@ -11,7 +11,7 @@ const Switch: FC<SwitchProps> = ({
|
|
|
11
11
|
disabled = false,
|
|
12
12
|
style,
|
|
13
13
|
params,
|
|
14
|
-
|
|
14
|
+
accessibilityLabel,
|
|
15
15
|
}) => {
|
|
16
16
|
const circleBackgroundColor = value ? Colors.black_01 : Colors.black_03;
|
|
17
17
|
const circleAlign = value ? 'flex-end' : 'flex-start';
|
|
@@ -31,8 +31,8 @@ const Switch: FC<SwitchProps> = ({
|
|
|
31
31
|
action: 'click',
|
|
32
32
|
}}>
|
|
33
33
|
<TouchableOpacity
|
|
34
|
-
{...props}
|
|
35
34
|
disabled={disabled}
|
|
35
|
+
accessibilityLabel={accessibilityLabel}
|
|
36
36
|
onPress={() => onChange?.(!value)}
|
|
37
37
|
style={[
|
|
38
38
|
style,
|
package/Switch/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {TouchableOpacityProps} from 'react-native';
|
|
1
|
+
import {TouchableOpacityProps, ViewStyle} from 'react-native';
|
|
2
2
|
|
|
3
3
|
export interface SwitchProps extends TouchableOpacityProps {
|
|
4
4
|
/**
|
|
@@ -13,7 +13,16 @@ export interface SwitchProps extends TouchableOpacityProps {
|
|
|
13
13
|
onChange: (value: boolean) => void;
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* Optional.
|
|
16
|
+
* `disabled`: Optional. If `true`, the user won't be able to interact with the Switch component.
|
|
17
|
+
* Defaults to `false` if not provided.
|
|
17
18
|
*/
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* `style`: Optional. Used to apply custom styling to the Switch component.
|
|
23
|
+
* Accepts an object of style properties.
|
|
24
|
+
*/
|
|
25
|
+
style?: ViewStyle;
|
|
26
|
+
|
|
18
27
|
params?: any;
|
|
19
28
|
}
|
package/Tag/index.tsx
CHANGED
|
@@ -31,6 +31,8 @@ const Tag: FC<TagProps> = ({
|
|
|
31
31
|
size = 'large',
|
|
32
32
|
style,
|
|
33
33
|
customColor,
|
|
34
|
+
accessibilityLabelContainer,
|
|
35
|
+
accessibilityLabelText,
|
|
34
36
|
}) => {
|
|
35
37
|
let labelColor = textColor[color];
|
|
36
38
|
let tagColor = backgroundColor[color];
|
|
@@ -60,7 +62,9 @@ const Tag: FC<TagProps> = ({
|
|
|
60
62
|
}
|
|
61
63
|
|
|
62
64
|
return (
|
|
63
|
-
<View
|
|
65
|
+
<View
|
|
66
|
+
style={[style, sizeStyle, {backgroundColor: tagColor}]}
|
|
67
|
+
accessibilityLabel={accessibilityLabelContainer}>
|
|
64
68
|
{!!icon && (
|
|
65
69
|
<Icon
|
|
66
70
|
style={styles.icon}
|
|
@@ -69,7 +73,10 @@ const Tag: FC<TagProps> = ({
|
|
|
69
73
|
color={labelColor}
|
|
70
74
|
/>
|
|
71
75
|
)}
|
|
72
|
-
<Text
|
|
76
|
+
<Text
|
|
77
|
+
color={labelColor}
|
|
78
|
+
typography={'label_s_medium'}
|
|
79
|
+
accessibilityLabel={accessibilityLabelText}>
|
|
73
80
|
{label}
|
|
74
81
|
</Text>
|
|
75
82
|
</View>
|
package/Tag/types.ts
CHANGED
|
@@ -33,4 +33,16 @@ export type TagProps = {
|
|
|
33
33
|
* that can be applied to the Tag component.
|
|
34
34
|
*/
|
|
35
35
|
customColor?: string;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Overrides the text that's read by the screen reader when the user interacts with the element. By default, the
|
|
39
|
+
* label is constructed by traversing all the children and accumulating all the Text nodes separated by space.
|
|
40
|
+
*/
|
|
41
|
+
accessibilityLabelContainer?: string;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Overrides the text that's read by the screen reader when the user interacts with the element. By default, the
|
|
45
|
+
* label is constructed by traversing all the children and accumulating all the Text nodes separated by space.
|
|
46
|
+
*/
|
|
47
|
+
accessibilityLabelText?: string;
|
|
36
48
|
};
|