@momo-kits/foundation 0.80.8 → 0.81.1
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.tsx +56 -14
- package/Application/ModalScreen.tsx +24 -7
- package/Application/Navigation.ts +3 -5
- package/Application/NavigationContainer.tsx +2 -2
- package/Application/index.ts +12 -5
- package/Application/types.ts +14 -6
- package/Application/utils.tsx +40 -73
- package/Image/index.tsx +21 -11
- package/Input/Input.tsx +5 -3
- package/Input/InputDropDown.tsx +102 -106
- package/Input/InputMoney.tsx +6 -3
- package/Input/InputOTP.tsx +7 -9
- package/Input/InputSearch.tsx +6 -9
- package/Input/InputTextArea.tsx +5 -3
- package/Input/common.tsx +2 -2
- package/Input/index.tsx +43 -19
- package/Layout/Card.tsx +13 -3
- package/Layout/Screen.tsx +223 -176
- package/Layout/styles.ts +12 -0
- package/Layout/utils.ts +2 -7
- package/Pagination/PaginationDot.tsx +6 -1
- package/Pagination/PaginationNumber.tsx +7 -4
- package/Pagination/PaginationWhiteDot.tsx +6 -1
- package/Pagination/styles.ts +3 -0
- package/Pagination/types.ts +2 -0
- package/Radio/types.ts +2 -2
- package/Title/index.tsx +0 -1
- package/Title/types.ts +40 -0
- package/package.json +2 -2
package/Input/InputDropDown.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, {useContext} from 'react';
|
|
2
2
|
import {TextInput, TouchableOpacity, View} from 'react-native';
|
|
3
3
|
import {ApplicationContext} from '../Application';
|
|
4
4
|
import styles from './styles';
|
|
@@ -8,117 +8,113 @@ import {Icon} from '../Icon';
|
|
|
8
8
|
import {Loader} from '../Loader';
|
|
9
9
|
import {Styles} from '../Consts';
|
|
10
10
|
|
|
11
|
-
const InputDropDown =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const {theme} = useContext(ApplicationContext);
|
|
35
|
-
const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
|
|
36
|
-
const full = !!value || !!placeholder;
|
|
37
|
-
const renderIcon = (color: string | undefined) => {
|
|
38
|
-
if (loading) {
|
|
39
|
-
return <Loader type={'spinner'} color={color} />;
|
|
40
|
-
}
|
|
41
|
-
if (icon) {
|
|
42
|
-
return <Icon color={color} source={icon} size={24} />;
|
|
43
|
-
}
|
|
44
|
-
};
|
|
11
|
+
const InputDropDown = ({
|
|
12
|
+
value,
|
|
13
|
+
floatingValue,
|
|
14
|
+
floatingIcon,
|
|
15
|
+
size,
|
|
16
|
+
onPress,
|
|
17
|
+
placeholder,
|
|
18
|
+
errorMessage,
|
|
19
|
+
icon = 'arrow_chevron_down_small',
|
|
20
|
+
disabled,
|
|
21
|
+
floatingIconColor,
|
|
22
|
+
iconColor,
|
|
23
|
+
required,
|
|
24
|
+
errorSpacing,
|
|
25
|
+
loading,
|
|
26
|
+
leadingIcon,
|
|
27
|
+
leadingIconColor,
|
|
28
|
+
style,
|
|
29
|
+
...props
|
|
30
|
+
}: InputDropDownProps) => {
|
|
31
|
+
const {theme} = useContext(ApplicationContext);
|
|
32
|
+
const full = !!value || !!placeholder;
|
|
33
|
+
const accessibilityLabel = `InputDropDown/${floatingValue ?? placeholder}`;
|
|
45
34
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
35
|
+
const renderIcon = (color: string | undefined) => {
|
|
36
|
+
if (loading) {
|
|
37
|
+
return <Loader type={'spinner'} color={color} />;
|
|
38
|
+
}
|
|
39
|
+
if (icon) {
|
|
40
|
+
return <Icon color={color} source={icon} size={24} />;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
51
43
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
44
|
+
const renderInputView = () => {
|
|
45
|
+
const disabledColor = theme.colors.text.disable;
|
|
46
|
+
let textColor = theme.colors.text.default;
|
|
47
|
+
let placeholderColor = theme.colors.text.hint;
|
|
48
|
+
let iconTintColor = iconColor;
|
|
57
49
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
getSizeStyle(size),
|
|
64
|
-
getBorderColor(theme, false, errorMessage, disabled),
|
|
65
|
-
]}>
|
|
66
|
-
<FloatingView
|
|
67
|
-
floatingValue={floatingValue}
|
|
68
|
-
floatingIconColor={floatingIconColor}
|
|
69
|
-
disabled={disabled}
|
|
70
|
-
required={required}
|
|
71
|
-
floatingIcon={floatingIcon}
|
|
72
|
-
/>
|
|
73
|
-
<View style={full ? styles.inputView : Styles.row}>
|
|
74
|
-
{!!leadingIcon && (
|
|
75
|
-
<View style={styles.leadingIconContainer}>
|
|
76
|
-
<Icon
|
|
77
|
-
color={leadingIconColor}
|
|
78
|
-
source={leadingIcon}
|
|
79
|
-
size={size === 'small' ? 24 : 32}
|
|
80
|
-
/>
|
|
81
|
-
</View>
|
|
82
|
-
)}
|
|
83
|
-
{full && (
|
|
84
|
-
<TextInput
|
|
85
|
-
{...props}
|
|
86
|
-
onPressIn={onPress}
|
|
87
|
-
accessibilityLabel={`TextInput`}
|
|
88
|
-
editable={false}
|
|
89
|
-
textAlignVertical="top"
|
|
90
|
-
ref={inputRef}
|
|
91
|
-
style={[
|
|
92
|
-
styles.input,
|
|
93
|
-
{
|
|
94
|
-
color: textColor,
|
|
95
|
-
fontFamily: `${theme.font}-Regular`,
|
|
96
|
-
},
|
|
97
|
-
]}
|
|
98
|
-
textBreakStrategy="highQuality"
|
|
99
|
-
value={value}
|
|
100
|
-
placeholder={placeholder}
|
|
101
|
-
selectionColor={theme.colors.primary}
|
|
102
|
-
placeholderTextColor={placeholderColor}
|
|
103
|
-
/>
|
|
104
|
-
)}
|
|
105
|
-
</View>
|
|
106
|
-
<View style={styles.iconView}>{renderIcon(iconTintColor)}</View>
|
|
107
|
-
</View>
|
|
108
|
-
);
|
|
109
|
-
};
|
|
50
|
+
if (disabled) {
|
|
51
|
+
textColor = disabledColor;
|
|
52
|
+
placeholderColor = disabledColor;
|
|
53
|
+
iconTintColor = disabledColor;
|
|
54
|
+
}
|
|
110
55
|
|
|
111
56
|
return (
|
|
112
|
-
<
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
57
|
+
<View
|
|
58
|
+
style={[
|
|
59
|
+
styles.inputWrapper,
|
|
60
|
+
{backgroundColor: theme.colors.background.surface},
|
|
61
|
+
getSizeStyle(size),
|
|
62
|
+
getBorderColor(theme, false, errorMessage, disabled),
|
|
63
|
+
]}>
|
|
64
|
+
<FloatingView
|
|
65
|
+
floatingValue={floatingValue}
|
|
66
|
+
floatingIconColor={floatingIconColor}
|
|
67
|
+
disabled={disabled}
|
|
68
|
+
required={required}
|
|
69
|
+
floatingIcon={floatingIcon}
|
|
70
|
+
/>
|
|
71
|
+
<View style={full ? styles.inputView : Styles.row}>
|
|
72
|
+
{!!leadingIcon && (
|
|
73
|
+
<View style={styles.leadingIconContainer}>
|
|
74
|
+
<Icon
|
|
75
|
+
color={leadingIconColor}
|
|
76
|
+
source={leadingIcon}
|
|
77
|
+
size={size === 'small' ? 24 : 32}
|
|
78
|
+
/>
|
|
79
|
+
</View>
|
|
80
|
+
)}
|
|
81
|
+
{full && (
|
|
82
|
+
<TextInput
|
|
83
|
+
{...props}
|
|
84
|
+
onPressIn={onPress}
|
|
85
|
+
accessibilityLabel={accessibilityLabel}
|
|
86
|
+
editable={false}
|
|
87
|
+
textAlignVertical="top"
|
|
88
|
+
style={[
|
|
89
|
+
styles.input,
|
|
90
|
+
{
|
|
91
|
+
color: textColor,
|
|
92
|
+
fontFamily: `${theme.font}-Regular`,
|
|
93
|
+
},
|
|
94
|
+
]}
|
|
95
|
+
textBreakStrategy="highQuality"
|
|
96
|
+
value={value}
|
|
97
|
+
placeholder={placeholder}
|
|
98
|
+
selectionColor={theme.colors.primary}
|
|
99
|
+
placeholderTextColor={placeholderColor}
|
|
100
|
+
/>
|
|
101
|
+
)}
|
|
102
|
+
</View>
|
|
103
|
+
<View style={styles.iconView}>{renderIcon(iconTintColor)}</View>
|
|
104
|
+
</View>
|
|
119
105
|
);
|
|
120
|
-
}
|
|
121
|
-
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<TouchableOpacity
|
|
110
|
+
onPress={onPress}
|
|
111
|
+
style={[style, full && styles.wrapper]}
|
|
112
|
+
accessibilityLabel={accessibilityLabel}>
|
|
113
|
+
{renderInputView()}
|
|
114
|
+
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
115
|
+
</TouchableOpacity>
|
|
116
|
+
);
|
|
117
|
+
};
|
|
122
118
|
|
|
123
119
|
InputDropDown.defaultProps = {
|
|
124
120
|
size: 'small',
|
package/Input/InputMoney.tsx
CHANGED
|
@@ -29,6 +29,7 @@ const InputMoney = forwardRef(
|
|
|
29
29
|
iconColor,
|
|
30
30
|
required,
|
|
31
31
|
errorSpacing,
|
|
32
|
+
style,
|
|
32
33
|
...props
|
|
33
34
|
}: InputMoneyProps,
|
|
34
35
|
ref,
|
|
@@ -37,6 +38,8 @@ const InputMoney = forwardRef(
|
|
|
37
38
|
const [focused, setFocused] = useState(false);
|
|
38
39
|
const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
|
|
39
40
|
const [value, setValue] = useState('');
|
|
41
|
+
const accessibilityLabel = `InputMoney/${floatingValue}`;
|
|
42
|
+
|
|
40
43
|
const onClearText = () => {
|
|
41
44
|
inputRef?.current?.clear();
|
|
42
45
|
setValue('');
|
|
@@ -91,7 +94,7 @@ const InputMoney = forwardRef(
|
|
|
91
94
|
<View style={styles.inputView}>
|
|
92
95
|
<TextInput
|
|
93
96
|
{...props}
|
|
94
|
-
accessibilityLabel={
|
|
97
|
+
accessibilityLabel={accessibilityLabel}
|
|
95
98
|
editable={!disabled}
|
|
96
99
|
textAlignVertical="top"
|
|
97
100
|
ref={inputRef}
|
|
@@ -131,8 +134,8 @@ const InputMoney = forwardRef(
|
|
|
131
134
|
|
|
132
135
|
return (
|
|
133
136
|
<View
|
|
134
|
-
style={styles.wrapper}
|
|
135
|
-
accessibilityLabel={
|
|
137
|
+
style={[style, styles.wrapper]}
|
|
138
|
+
accessibilityLabel={accessibilityLabel}>
|
|
136
139
|
{renderInputView()}
|
|
137
140
|
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
138
141
|
</View>
|
package/Input/InputOTP.tsx
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, {FC, useContext, useEffect, useRef, useState} from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Animated,
|
|
4
|
-
KeyboardType,
|
|
5
4
|
NativeSyntheticEvent,
|
|
6
5
|
TextInput,
|
|
7
6
|
TextInputFocusEventData,
|
|
@@ -69,6 +68,7 @@ const InputOTP: FC<InputOTPProps> = ({
|
|
|
69
68
|
onFocus,
|
|
70
69
|
onBlur,
|
|
71
70
|
dataType = 'number',
|
|
71
|
+
style,
|
|
72
72
|
...props
|
|
73
73
|
}) => {
|
|
74
74
|
const MAX_LENGTH = 10;
|
|
@@ -76,6 +76,7 @@ const InputOTP: FC<InputOTPProps> = ({
|
|
|
76
76
|
const [focused, setFocused] = useState(false);
|
|
77
77
|
const inputRef = useRef<TextInput>(null);
|
|
78
78
|
const {theme} = useContext(ApplicationContext);
|
|
79
|
+
const accessibilityLabel = `InputOTP/${floatingValue ?? placeholder}`;
|
|
79
80
|
|
|
80
81
|
const onFocusInput = () => {
|
|
81
82
|
setFocused(true);
|
|
@@ -157,9 +158,6 @@ const InputOTP: FC<InputOTPProps> = ({
|
|
|
157
158
|
};
|
|
158
159
|
|
|
159
160
|
const renderInputView = () => {
|
|
160
|
-
let placeholderColor = theme.colors.text.hint;
|
|
161
|
-
const keyboardType: KeyboardType =
|
|
162
|
-
dataType === 'number' ? 'number-pad' : 'default';
|
|
163
161
|
return (
|
|
164
162
|
<View
|
|
165
163
|
style={[
|
|
@@ -182,16 +180,16 @@ const InputOTP: FC<InputOTPProps> = ({
|
|
|
182
180
|
<View style={styles.inputView}>
|
|
183
181
|
<TextInput
|
|
184
182
|
{...props}
|
|
185
|
-
accessibilityLabel={
|
|
183
|
+
accessibilityLabel={accessibilityLabel}
|
|
186
184
|
ref={inputRef}
|
|
187
185
|
value={value}
|
|
188
186
|
onChangeText={_onChangeText}
|
|
189
|
-
keyboardType={
|
|
187
|
+
keyboardType={dataType === 'number' ? 'number-pad' : 'default'}
|
|
190
188
|
onFocus={onFocusInput}
|
|
191
189
|
onBlur={onBlurInput}
|
|
192
190
|
style={{opacity: 0}}
|
|
193
191
|
selectionColor={theme.colors.primary}
|
|
194
|
-
placeholderTextColor={
|
|
192
|
+
placeholderTextColor={theme.colors.text.hint}
|
|
195
193
|
/>
|
|
196
194
|
</View>
|
|
197
195
|
</View>
|
|
@@ -202,8 +200,8 @@ const InputOTP: FC<InputOTPProps> = ({
|
|
|
202
200
|
<TouchableOpacity
|
|
203
201
|
activeOpacity={1}
|
|
204
202
|
onPress={onFocusInput}
|
|
205
|
-
style={styles.otpWrapper}
|
|
206
|
-
accessibilityLabel={
|
|
203
|
+
style={[style, styles.otpWrapper]}
|
|
204
|
+
accessibilityLabel={accessibilityLabel}>
|
|
207
205
|
{renderInputView()}
|
|
208
206
|
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
209
207
|
</TouchableOpacity>
|
package/Input/InputSearch.tsx
CHANGED
|
@@ -37,7 +37,7 @@ const InputSearch = forwardRef(
|
|
|
37
37
|
const [focused, setFocused] = useState(false);
|
|
38
38
|
const [haveValue, setHaveValue] = useState(!!value || !!defaultValue);
|
|
39
39
|
const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
|
|
40
|
-
|
|
40
|
+
const accessibilityLabel = `InputMoney/${placeholder}`;
|
|
41
41
|
|
|
42
42
|
const _onFocus = (e: NativeSyntheticEvent<TextInputFocusEventData>) => {
|
|
43
43
|
setFocused(true);
|
|
@@ -60,19 +60,16 @@ const InputSearch = forwardRef(
|
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
const renderInputView = () => {
|
|
63
|
-
let textColor = theme.colors.text.default;
|
|
64
|
-
let placeholderColor = theme.colors.text.hint;
|
|
65
|
-
|
|
66
63
|
return (
|
|
67
64
|
<TextInput
|
|
68
65
|
{...props}
|
|
69
|
-
accessibilityLabel={
|
|
66
|
+
accessibilityLabel={accessibilityLabel}
|
|
70
67
|
textAlignVertical="top"
|
|
71
68
|
ref={inputRef}
|
|
72
69
|
style={[
|
|
73
70
|
styles.searchInput,
|
|
74
71
|
{
|
|
75
|
-
color:
|
|
72
|
+
color: theme.colors.text.default,
|
|
76
73
|
},
|
|
77
74
|
]}
|
|
78
75
|
value={value}
|
|
@@ -81,7 +78,7 @@ const InputSearch = forwardRef(
|
|
|
81
78
|
onBlur={_onBlur}
|
|
82
79
|
placeholder={placeholder}
|
|
83
80
|
selectionColor={theme.colors.primary}
|
|
84
|
-
placeholderTextColor={
|
|
81
|
+
placeholderTextColor={theme.colors.text.hint}
|
|
85
82
|
/>
|
|
86
83
|
);
|
|
87
84
|
};
|
|
@@ -112,7 +109,7 @@ const InputSearch = forwardRef(
|
|
|
112
109
|
]}
|
|
113
110
|
/>
|
|
114
111
|
<Icon
|
|
115
|
-
color={
|
|
112
|
+
color={iconColor}
|
|
116
113
|
source={icon}
|
|
117
114
|
style={styles.iconSearchInput}
|
|
118
115
|
/>
|
|
@@ -124,7 +121,7 @@ const InputSearch = forwardRef(
|
|
|
124
121
|
return (
|
|
125
122
|
<View
|
|
126
123
|
style={[style, styles.searchInputContainer]}
|
|
127
|
-
accessibilityLabel={
|
|
124
|
+
accessibilityLabel={accessibilityLabel}>
|
|
128
125
|
<View
|
|
129
126
|
style={[
|
|
130
127
|
styles.searchInputWrapper,
|
package/Input/InputTextArea.tsx
CHANGED
|
@@ -37,6 +37,7 @@ const InputTextArea = forwardRef(
|
|
|
37
37
|
maxLength,
|
|
38
38
|
required,
|
|
39
39
|
errorSpacing,
|
|
40
|
+
style,
|
|
40
41
|
...props
|
|
41
42
|
}: InputTextAreaProps,
|
|
42
43
|
ref,
|
|
@@ -45,6 +46,7 @@ const InputTextArea = forwardRef(
|
|
|
45
46
|
const [focused, setFocused] = useState(false);
|
|
46
47
|
const [inputValue, setInputValue] = useState(defaultValue ?? '');
|
|
47
48
|
const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
|
|
49
|
+
const accessibilityLabel = `InputTextArea/${floatingValue ?? placeholder}`;
|
|
48
50
|
|
|
49
51
|
const onClearText = () => {
|
|
50
52
|
inputRef?.current?.clear();
|
|
@@ -106,7 +108,7 @@ const InputTextArea = forwardRef(
|
|
|
106
108
|
<View style={styles.textAreaView}>
|
|
107
109
|
<TextInput
|
|
108
110
|
{...props}
|
|
109
|
-
accessibilityLabel={
|
|
111
|
+
accessibilityLabel={accessibilityLabel}
|
|
110
112
|
ref={inputRef}
|
|
111
113
|
editable={!disabled}
|
|
112
114
|
textAlignVertical="top"
|
|
@@ -147,8 +149,8 @@ const InputTextArea = forwardRef(
|
|
|
147
149
|
|
|
148
150
|
return (
|
|
149
151
|
<View
|
|
150
|
-
style={styles.wrapper}
|
|
151
|
-
accessibilityLabel={
|
|
152
|
+
style={[style, styles.wrapper]}
|
|
153
|
+
accessibilityLabel={accessibilityLabel}>
|
|
152
154
|
{renderInputView()}
|
|
153
155
|
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
154
156
|
</View>
|
package/Input/common.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {View, ViewStyle} from 'react-native';
|
|
2
2
|
import styles from './styles';
|
|
3
|
-
import {Text} from '../Text';
|
|
3
|
+
import {scaleSize, Text} from '../Text';
|
|
4
4
|
import React, {FC, useContext} from 'react';
|
|
5
5
|
import {ApplicationContext} from '../Application';
|
|
6
6
|
import {Icon} from '../Icon';
|
|
@@ -16,7 +16,7 @@ type FloatingViewProps = {
|
|
|
16
16
|
style?: ViewStyle;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
export const DEFAULT_HEIGHT =
|
|
19
|
+
export const DEFAULT_HEIGHT = scaleSize(104);
|
|
20
20
|
export const MAX_LENGTH = 300;
|
|
21
21
|
|
|
22
22
|
export const getBorderColor = (
|
package/Input/index.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import InputSearch from './InputSearch';
|
|
|
4
4
|
import InputMoney from './InputMoney';
|
|
5
5
|
import InputOTP from './InputOTP';
|
|
6
6
|
import InputDropDown from './InputDropDown';
|
|
7
|
-
import {TextInputProps} from 'react-native';
|
|
7
|
+
import {TextInputProps, ViewStyle} from 'react-native';
|
|
8
8
|
|
|
9
9
|
export interface InputProps extends TextInputProps {
|
|
10
10
|
/**
|
|
@@ -123,73 +123,95 @@ export interface InputMoneyProps extends InputPropsWithoutPlaceholder {}
|
|
|
123
123
|
export type OTPInputLength = 2 | 4 | 6 | 8 | 10;
|
|
124
124
|
|
|
125
125
|
export interface InputOTPProps extends InputPropsWithoutSizeAndIcon {
|
|
126
|
+
/**
|
|
127
|
+
* Optional. Defines the length of the OTP (One Time Password) input.
|
|
128
|
+
* Can be 2, 4, 6, 8, or 10.
|
|
129
|
+
*/
|
|
126
130
|
length?: OTPInputLength;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Optional. Defines the data type of the OTP input.
|
|
134
|
+
* 'string' - The OTP input will be treated as a string.
|
|
135
|
+
* 'number' - The OTP input will be treated as a number.
|
|
136
|
+
*/
|
|
127
137
|
dataType?: 'string' | 'number';
|
|
128
138
|
}
|
|
129
139
|
|
|
130
140
|
export type CaretProps = {
|
|
141
|
+
/**
|
|
142
|
+
* Optional. The index of the caret in the input field.
|
|
143
|
+
* Represents the position where the caret is located.
|
|
144
|
+
*/
|
|
131
145
|
index?: number;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Optional. The total length of the input field in which the caret is present.
|
|
149
|
+
* This dictates the maximum value of the 'index' property.
|
|
150
|
+
*/
|
|
132
151
|
length?: number;
|
|
133
152
|
};
|
|
134
153
|
|
|
135
|
-
export
|
|
154
|
+
export interface InputDropDownProps {
|
|
136
155
|
/**
|
|
137
|
-
*
|
|
156
|
+
* Optional. Defines the size of the InputDropDown component.
|
|
157
|
+
* 'small' - A smaller, less prominent input.
|
|
158
|
+
* 'large' - A larger, more prominent input.
|
|
138
159
|
*/
|
|
139
160
|
size?: 'small' | 'large';
|
|
140
161
|
|
|
141
162
|
/**
|
|
142
|
-
*
|
|
163
|
+
* Optional. The current value of the InputDropDown.
|
|
143
164
|
*/
|
|
144
165
|
value?: string;
|
|
145
166
|
|
|
146
167
|
/**
|
|
147
|
-
*
|
|
168
|
+
* Optional. Text that is displayed when there is no value set in the InputDropDown.
|
|
148
169
|
*/
|
|
149
170
|
placeholder?: string;
|
|
150
171
|
|
|
151
172
|
/**
|
|
152
|
-
*
|
|
173
|
+
* Optional. Function to be called when the InputDropDown is pressed.
|
|
153
174
|
*/
|
|
154
175
|
onPress?: () => void;
|
|
176
|
+
|
|
155
177
|
/**
|
|
156
|
-
* Optional. Represents the value for the floating title in the
|
|
178
|
+
* Optional. Represents the value for the floating title in the InputDropDown component.
|
|
157
179
|
*/
|
|
158
180
|
floatingValue?: string;
|
|
159
181
|
|
|
160
182
|
/**
|
|
161
|
-
* Optional. Represents the name or key of the floating icon to be displayed in the
|
|
183
|
+
* Optional. Represents the name or key of the floating icon to be displayed in the InputDropDown component.
|
|
162
184
|
*/
|
|
163
185
|
floatingIcon?: string;
|
|
164
186
|
|
|
165
187
|
/**
|
|
166
|
-
* Optional. Represents the error message to be displayed below the
|
|
188
|
+
* Optional. Represents the error message to be displayed below the InputDropDown component when there is an error.
|
|
167
189
|
*/
|
|
168
190
|
errorMessage?: string;
|
|
169
191
|
|
|
170
192
|
/**
|
|
171
|
-
* Optional. Represents the name or key of the icon to be displayed in the
|
|
193
|
+
* Optional. Represents the name or key of the icon to be displayed in the InputDropDown component.
|
|
172
194
|
*/
|
|
173
195
|
icon?: string;
|
|
174
196
|
|
|
175
197
|
/**
|
|
176
|
-
* Optional. Represents the color of the icon in the
|
|
198
|
+
* Optional. Represents the color of the icon in the InputDropDown component.
|
|
177
199
|
*/
|
|
178
200
|
iconColor?: string;
|
|
179
201
|
|
|
180
202
|
/**
|
|
181
|
-
* Optional. If `true`, the user won't be able to interact with the
|
|
203
|
+
* Optional. If `true`, the user won't be able to interact with the InputDropDown component.
|
|
182
204
|
* Defaults to `false` if not provided.
|
|
183
205
|
*/
|
|
184
206
|
disabled?: boolean;
|
|
185
207
|
|
|
186
208
|
/**
|
|
187
|
-
* Optional. Represents the color of the floating icon in the
|
|
209
|
+
* Optional. Represents the color of the floating icon in the InputDropDown component.
|
|
188
210
|
*/
|
|
189
211
|
floatingIconColor?: string;
|
|
190
212
|
|
|
191
213
|
/**
|
|
192
|
-
* Optional. If `true`, the
|
|
214
|
+
* Optional. If `true`, the InputDropDown component is marked as required,
|
|
193
215
|
* indicating that the user must provide a value before submitting a form.
|
|
194
216
|
* Defaults to `false` if not provided.
|
|
195
217
|
*/
|
|
@@ -197,25 +219,27 @@ export type InputDropDownProps = {
|
|
|
197
219
|
|
|
198
220
|
/**
|
|
199
221
|
* Optional. If `true`,
|
|
200
|
-
*
|
|
222
|
+
* includes spacing when InputDropDown does not have an error message.
|
|
201
223
|
* Defaults to `false` if not provided.
|
|
202
224
|
*/
|
|
203
225
|
errorSpacing?: boolean;
|
|
204
226
|
|
|
205
227
|
/**
|
|
206
|
-
*
|
|
228
|
+
* If `true`, the icon of the input will show an indicator for loading.
|
|
207
229
|
*/
|
|
208
230
|
loading?: boolean;
|
|
209
231
|
|
|
210
232
|
/**
|
|
211
|
-
*
|
|
233
|
+
* Optional. Represents the leading icon in the InputDropDown component.
|
|
212
234
|
*/
|
|
213
235
|
leadingIcon?: string;
|
|
214
236
|
|
|
215
237
|
/**
|
|
216
|
-
* Optional. Represents the color of the leading icon in the
|
|
238
|
+
* Optional. Represents the color of the leading icon in the InputDropDown component.
|
|
217
239
|
*/
|
|
218
240
|
leadingIconColor?: string;
|
|
219
|
-
|
|
241
|
+
|
|
242
|
+
style: ViewStyle | ViewStyle[];
|
|
243
|
+
}
|
|
220
244
|
|
|
221
245
|
export {Input, InputTextArea, InputSearch, InputMoney, InputOTP, InputDropDown};
|
package/Layout/Card.tsx
CHANGED
|
@@ -7,16 +7,23 @@ import Item from './Item';
|
|
|
7
7
|
import {Image} from '../Image';
|
|
8
8
|
import {ApplicationContext} from '../Application';
|
|
9
9
|
import styles from './styles';
|
|
10
|
-
import {Colors, Spacing} from '../Consts';
|
|
10
|
+
import {Colors, Shadow, Spacing} from '../Consts';
|
|
11
11
|
|
|
12
12
|
export interface CardProps extends ViewProps {
|
|
13
13
|
/**
|
|
14
14
|
* Optional. Background image for the card.
|
|
15
15
|
*/
|
|
16
16
|
backgroundImage?: string;
|
|
17
|
+
|
|
18
|
+
useShadow?: boolean;
|
|
17
19
|
}
|
|
18
20
|
|
|
19
|
-
const Card: React.FC<CardProps> = ({
|
|
21
|
+
const Card: React.FC<CardProps> = ({
|
|
22
|
+
children,
|
|
23
|
+
style,
|
|
24
|
+
backgroundImage,
|
|
25
|
+
useShadow = false,
|
|
26
|
+
}) => {
|
|
20
27
|
const {showGrid} = useContext(ApplicationContext);
|
|
21
28
|
const {numberOfColumns} = useGridSystem();
|
|
22
29
|
|
|
@@ -127,6 +134,7 @@ const Card: React.FC<CardProps> = ({children, style, backgroundImage}) => {
|
|
|
127
134
|
return element;
|
|
128
135
|
};
|
|
129
136
|
|
|
137
|
+
const {theme} = useContext(ApplicationContext);
|
|
130
138
|
return (
|
|
131
139
|
<GridContext.Provider value={gridContext}>
|
|
132
140
|
<View
|
|
@@ -137,12 +145,14 @@ const Card: React.FC<CardProps> = ({children, style, backgroundImage}) => {
|
|
|
137
145
|
{
|
|
138
146
|
width: widthSection,
|
|
139
147
|
marginHorizontal: gridContext.margin,
|
|
148
|
+
backgroundColor: theme.colors.background.surface,
|
|
140
149
|
},
|
|
150
|
+
useShadow && Shadow.Light,
|
|
141
151
|
]}>
|
|
142
152
|
{!!backgroundImage && (
|
|
143
153
|
<Image
|
|
144
154
|
source={{uri: backgroundImage}}
|
|
145
|
-
style={
|
|
155
|
+
style={styles.imageBackground}
|
|
146
156
|
/>
|
|
147
157
|
)}
|
|
148
158
|
{renderView(validateChildren(children, [Item]))}
|