@momo-kits/foundation 0.113.0-optimize.5 → 0.113.0-optimize.6
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/Button/index.tsx +0 -4
- package/CheckBox/index.tsx +2 -2
- package/CheckBox/types.ts +2 -5
- 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 +6 -18
- package/Input/InputDropDown.tsx +5 -8
- package/Input/InputMoney.tsx +3 -8
- package/Input/InputOTP.tsx +0 -2
- package/Input/InputSearch.tsx +4 -11
- package/Input/index.tsx +80 -34
- package/Radio/index.tsx +8 -4
- package/Radio/types.ts +2 -11
- 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/Button/index.tsx
CHANGED
|
@@ -87,9 +87,7 @@ const Button: FC<ButtonProps> = ({
|
|
|
87
87
|
iconLeft,
|
|
88
88
|
loading = false,
|
|
89
89
|
title = 'Button',
|
|
90
|
-
onPress,
|
|
91
90
|
params,
|
|
92
|
-
accessibilityLabel,
|
|
93
91
|
...rest
|
|
94
92
|
}) => {
|
|
95
93
|
const {theme, config} = useContext(ApplicationContext);
|
|
@@ -311,9 +309,7 @@ const Button: FC<ButtonProps> = ({
|
|
|
311
309
|
<TouchableOpacity
|
|
312
310
|
{...rest}
|
|
313
311
|
disabled={type === 'disabled'}
|
|
314
|
-
accessibilityLabel={accessibilityLabel}
|
|
315
312
|
activeOpacity={0.5}
|
|
316
|
-
onPress={onPress}
|
|
317
313
|
style={buttonStyle}>
|
|
318
314
|
{renderLeading()}
|
|
319
315
|
{renderTitle()}
|
package/CheckBox/index.tsx
CHANGED
|
@@ -14,7 +14,7 @@ const CheckBox: FC<CheckBoxProps> = ({
|
|
|
14
14
|
label,
|
|
15
15
|
indeterminate,
|
|
16
16
|
params,
|
|
17
|
-
|
|
17
|
+
...props
|
|
18
18
|
}) => {
|
|
19
19
|
const {theme} = useContext(ApplicationContext);
|
|
20
20
|
const haveValue = value || indeterminate;
|
|
@@ -46,7 +46,7 @@ const CheckBox: FC<CheckBoxProps> = ({
|
|
|
46
46
|
componentValue: indeterminate ? 'undetermined' : value,
|
|
47
47
|
}}>
|
|
48
48
|
<TouchableOpacity
|
|
49
|
-
|
|
49
|
+
{...props}
|
|
50
50
|
activeOpacity={0.8}
|
|
51
51
|
onPress={() => onChange?.(!value)}
|
|
52
52
|
disabled={disabled}
|
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,10 +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
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
|
@@ -37,9 +37,6 @@ const Input = 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,
|
|
@@ -56,7 +53,6 @@ const Input = forwardRef(
|
|
|
56
53
|
style,
|
|
57
54
|
params,
|
|
58
55
|
hintText,
|
|
59
|
-
accessibilityLabel,
|
|
60
56
|
editable = true,
|
|
61
57
|
onPressFloatingIcon,
|
|
62
58
|
onPressLeadingIcon,
|
|
@@ -128,24 +124,17 @@ const Input = forwardRef(
|
|
|
128
124
|
</TouchableOpacity>
|
|
129
125
|
);
|
|
130
126
|
}
|
|
131
|
-
if (
|
|
127
|
+
if (trailing) {
|
|
132
128
|
const renderIconTouchable = (icon: ReactNode) => {
|
|
133
129
|
return (
|
|
134
|
-
<TouchableOpacity
|
|
135
|
-
onPress={onPressTrailing ?? onPressIcon}
|
|
136
|
-
style={styles.icon}>
|
|
130
|
+
<TouchableOpacity onPress={onPressTrailing} style={styles.icon}>
|
|
137
131
|
{icon}
|
|
138
132
|
</TouchableOpacity>
|
|
139
133
|
);
|
|
140
134
|
};
|
|
141
|
-
|
|
142
|
-
if (trailingValue?.includes('_') || trailingValue?.includes('http')) {
|
|
135
|
+
if (trailing?.includes('_') || trailing?.includes('http')) {
|
|
143
136
|
return renderIconTouchable(
|
|
144
|
-
<Icon
|
|
145
|
-
color={color}
|
|
146
|
-
source={(icon || trailing) as string}
|
|
147
|
-
size={24}
|
|
148
|
-
/>
|
|
137
|
+
<Icon color={color} source={trailing} size={24} />
|
|
149
138
|
);
|
|
150
139
|
}
|
|
151
140
|
return renderIconTouchable(
|
|
@@ -153,7 +142,7 @@ const Input = forwardRef(
|
|
|
153
142
|
typography="action_xs_bold"
|
|
154
143
|
color={color ?? theme.colors.primary}
|
|
155
144
|
numberOfLines={1}>
|
|
156
|
-
{
|
|
145
|
+
{trailing!.substring(0, 15)}
|
|
157
146
|
</Text>
|
|
158
147
|
);
|
|
159
148
|
}
|
|
@@ -167,7 +156,7 @@ const Input = forwardRef(
|
|
|
167
156
|
const secure = secureTextInput && secureTextEntry;
|
|
168
157
|
let textColor = theme.colors.text.default;
|
|
169
158
|
let placeholderColor = theme.colors.text.hint;
|
|
170
|
-
let iconTintColor = trailingColor
|
|
159
|
+
let iconTintColor = trailingColor;
|
|
171
160
|
|
|
172
161
|
if (disabled) {
|
|
173
162
|
textColor = disabledColor;
|
|
@@ -205,7 +194,6 @@ const Input = forwardRef(
|
|
|
205
194
|
)}
|
|
206
195
|
<TextInput
|
|
207
196
|
{...props}
|
|
208
|
-
accessibilityLabel={accessibilityLabel}
|
|
209
197
|
editable={editable && !disabled}
|
|
210
198
|
secureTextEntry={secure}
|
|
211
199
|
textAlignVertical="center"
|
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,9 +24,9 @@ const InputDropDown = ({
|
|
|
25
24
|
leadingIconColor,
|
|
26
25
|
style,
|
|
27
26
|
params,
|
|
28
|
-
accessibilityLabel,
|
|
29
27
|
hintText,
|
|
30
28
|
multiline,
|
|
29
|
+
...props
|
|
31
30
|
}: InputDropDownProps) => {
|
|
32
31
|
const {theme} = useContext(ApplicationContext);
|
|
33
32
|
|
|
@@ -50,12 +49,12 @@ const InputDropDown = ({
|
|
|
50
49
|
styles.inputDropDownWrapper,
|
|
51
50
|
{backgroundColor: theme.colors.background.surface},
|
|
52
51
|
getSizeStyle(size, multiline),
|
|
53
|
-
getBorderColor(theme, false, errorMessage, disabled),
|
|
52
|
+
getBorderColor(theme, false, errorMessage, disabled as boolean),
|
|
54
53
|
]}>
|
|
55
54
|
<FloatingView
|
|
56
55
|
floatingValue={floatingValue}
|
|
57
56
|
floatingIconColor={floatingIconColor}
|
|
58
|
-
disabled={disabled}
|
|
57
|
+
disabled={disabled as boolean}
|
|
59
58
|
required={required}
|
|
60
59
|
floatingIcon={floatingIcon}
|
|
61
60
|
onPress={onPressFloatingIcon}
|
|
@@ -77,9 +76,7 @@ const InputDropDown = ({
|
|
|
77
76
|
/>
|
|
78
77
|
</View>
|
|
79
78
|
)}
|
|
80
|
-
<View
|
|
81
|
-
accessibilityLabel={accessibilityLabel}
|
|
82
|
-
style={styles.textViewDropDown}>
|
|
79
|
+
<View style={styles.textViewDropDown}>
|
|
83
80
|
<Text
|
|
84
81
|
numberOfLines={multiline ? undefined : 1}
|
|
85
82
|
typography={'body_default_regular'}
|
|
@@ -110,8 +107,8 @@ const InputDropDown = ({
|
|
|
110
107
|
state: 'enabled',
|
|
111
108
|
}}>
|
|
112
109
|
<TouchableOpacity
|
|
110
|
+
{...props}
|
|
113
111
|
activeOpacity={0.6}
|
|
114
|
-
onPress={onPress}
|
|
115
112
|
style={[style, styles.wrapper]}>
|
|
116
113
|
{renderInputView()}
|
|
117
114
|
<ErrorView
|
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,7 +47,6 @@ const InputMoney = forwardRef(
|
|
|
50
47
|
style,
|
|
51
48
|
params,
|
|
52
49
|
defaultValue = '',
|
|
53
|
-
accessibilityLabel,
|
|
54
50
|
hintText,
|
|
55
51
|
value: _value,
|
|
56
52
|
onPressFloatingIcon,
|
|
@@ -119,7 +115,7 @@ const InputMoney = forwardRef(
|
|
|
119
115
|
const disabledColor = theme.colors.text.disable;
|
|
120
116
|
let textColor = theme.colors.text.default;
|
|
121
117
|
let placeholderColor = theme.colors.text.hint;
|
|
122
|
-
let iconTintColor = trailingColor
|
|
118
|
+
let iconTintColor = trailingColor;
|
|
123
119
|
|
|
124
120
|
if (disabled) {
|
|
125
121
|
textColor = disabledColor;
|
|
@@ -146,7 +142,6 @@ const InputMoney = forwardRef(
|
|
|
146
142
|
<View style={styles.inputView}>
|
|
147
143
|
<TextInput
|
|
148
144
|
{...props}
|
|
149
|
-
accessibilityLabel={accessibilityLabel}
|
|
150
145
|
editable={!disabled}
|
|
151
146
|
ref={inputRef}
|
|
152
147
|
keyboardType={'number-pad'}
|
|
@@ -180,10 +175,10 @@ const InputMoney = forwardRef(
|
|
|
180
175
|
)}
|
|
181
176
|
<RenderTrailing
|
|
182
177
|
color={iconTintColor}
|
|
183
|
-
icon={
|
|
178
|
+
icon={trailing}
|
|
184
179
|
trailing={trailing}
|
|
185
180
|
onPressTrailing={onPressTrailing}
|
|
186
|
-
onPressIcon={
|
|
181
|
+
onPressIcon={onPressTrailing}
|
|
187
182
|
loading={loading}
|
|
188
183
|
/>
|
|
189
184
|
</View>
|
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/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
|
*/
|
|
@@ -252,8 +238,7 @@ export type CaretProps = {
|
|
|
252
238
|
length?: number;
|
|
253
239
|
};
|
|
254
240
|
|
|
255
|
-
export interface InputDropDownProps
|
|
256
|
-
extends Omit<InputProps, 'trailing' | 'trailingColor' | 'onPressTrailing'> {
|
|
241
|
+
export interface InputDropDownProps extends TouchableOpacityProps {
|
|
257
242
|
/**
|
|
258
243
|
* Optional. Defines the size of the InputDropDown component.
|
|
259
244
|
* 'small' - A smaller, less prominent input.
|
|
@@ -262,39 +247,100 @@ export interface InputDropDownProps
|
|
|
262
247
|
size?: 'small' | 'large';
|
|
263
248
|
|
|
264
249
|
/**
|
|
265
|
-
* Optional.
|
|
250
|
+
* Optional. Represents the text to be displayed in the InputDropDown component.
|
|
266
251
|
*/
|
|
267
|
-
|
|
252
|
+
value?: string;
|
|
268
253
|
|
|
269
254
|
/**
|
|
270
|
-
* Optional.
|
|
271
|
-
* Defaults to `false` if not provided.
|
|
255
|
+
* Optional. Represents the placeholder text to be displayed in the InputDropDown component.
|
|
272
256
|
*/
|
|
273
|
-
|
|
257
|
+
placeholder?: string;
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Optional. Represents the data for the dropdown.
|
|
261
|
+
*/
|
|
262
|
+
multiline?: boolean;
|
|
263
|
+
|
|
264
|
+
/**
|
|
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;
|
|
274
284
|
|
|
275
285
|
/**
|
|
276
|
-
*
|
|
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,
|
|
277
298
|
* indicating that the user must provide a value before submitting a form.
|
|
278
299
|
* Defaults to `false` if not provided.
|
|
279
300
|
*/
|
|
280
301
|
required?: boolean;
|
|
281
302
|
|
|
303
|
+
/**
|
|
304
|
+
* Optional. If `true`,
|
|
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.
|
|
322
|
+
*/
|
|
323
|
+
onPressLeadingIcon?: () => void;
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Optional. Represents the color of the leading icon in the Input component.
|
|
327
|
+
*/
|
|
328
|
+
leadingIconColor?: string;
|
|
329
|
+
|
|
282
330
|
/**
|
|
283
331
|
* Optional. params for element tracking.
|
|
284
332
|
*/
|
|
285
|
-
params?:
|
|
286
|
-
[key: string]: any;
|
|
287
|
-
};
|
|
333
|
+
params?: any;
|
|
288
334
|
|
|
289
335
|
/**
|
|
290
|
-
* Optional. Represents
|
|
336
|
+
* Optional. Represents text below the Input component.
|
|
291
337
|
*/
|
|
292
|
-
|
|
338
|
+
hintText?: string;
|
|
293
339
|
|
|
294
340
|
/**
|
|
295
|
-
* Optional. Represents the
|
|
341
|
+
* Optional. Represents the style of the Input component.
|
|
296
342
|
*/
|
|
297
|
-
|
|
343
|
+
onPressFloatingIcon?: () => void;
|
|
298
344
|
}
|
|
299
345
|
|
|
300
346
|
export type InputRef = {
|
package/Radio/index.tsx
CHANGED
|
@@ -15,7 +15,7 @@ const Radio: FC<RadioProps> = ({
|
|
|
15
15
|
label,
|
|
16
16
|
style,
|
|
17
17
|
params,
|
|
18
|
-
|
|
18
|
+
...props
|
|
19
19
|
}) => {
|
|
20
20
|
const {theme} = useContext(ApplicationContext);
|
|
21
21
|
const selected = value === groupValue;
|
|
@@ -49,9 +49,9 @@ const Radio: FC<RadioProps> = ({
|
|
|
49
49
|
action: 'click',
|
|
50
50
|
}}>
|
|
51
51
|
<TouchableOpacity
|
|
52
|
-
|
|
53
|
-
onPress={onChange}
|
|
52
|
+
{...props}
|
|
54
53
|
disabled={disabled}
|
|
54
|
+
onPress={onChange}
|
|
55
55
|
style={[
|
|
56
56
|
style,
|
|
57
57
|
{
|
|
@@ -67,7 +67,11 @@ const Radio: FC<RadioProps> = ({
|
|
|
67
67
|
{marginRight: label ? Spacing.S : 0},
|
|
68
68
|
]}
|
|
69
69
|
/>
|
|
70
|
-
{!!label &&
|
|
70
|
+
{!!label && (
|
|
71
|
+
<Text typography={'body_default_regular'} style={styles.radioText}>
|
|
72
|
+
{label}
|
|
73
|
+
</Text>
|
|
74
|
+
)}
|
|
71
75
|
</TouchableOpacity>
|
|
72
76
|
</ComponentContext.Provider>
|
|
73
77
|
);
|
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,10 +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
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
|
};
|