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