ikualo-ui-kit-mobile 0.1.2 → 0.1.4
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/.env +1 -0
- package/assets/styles/elements/pages.ts +2 -2
- package/package.json +1 -1
- package/src/elements/alerts/Alert.tsx +2 -1
- package/src/elements/buttons/BtnContained.tsx +1 -1
- package/src/elements/cards/CardList.tsx +3 -2
- package/src/elements/dialogs/DialogGeneral.tsx +3 -2
- package/src/elements/inputs/Input.tsx +1 -0
- package/src/elements/inputs/InputEmail.tsx +11 -10
- package/src/elements/inputs/InputPassword.tsx +5 -0
- package/src/elements/pages/PageTouchable.tsx +2 -1
package/.env
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
EXPO_API_DEV_URL=https://api-gw-dev.ikualo.com/api/v1/
|
|
@@ -5,9 +5,9 @@ const stylePages = StyleSheet.create({
|
|
|
5
5
|
'page-basic': { flex: 1, backgroundColor: theme.colors.background },
|
|
6
6
|
'page-basic-view': {
|
|
7
7
|
flex: 1,
|
|
8
|
-
|
|
8
|
+
paddingBottom: 16,
|
|
9
9
|
paddingHorizontal: 16,
|
|
10
10
|
},
|
|
11
11
|
});
|
|
12
12
|
|
|
13
|
-
export { stylePages };
|
|
13
|
+
export { stylePages };
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@ export const Alert = (props: IFAlertInfo) => {
|
|
|
16
16
|
useEffect(() => {
|
|
17
17
|
setTimeout(() => {
|
|
18
18
|
onClose();
|
|
19
|
-
}, miliSeconds ??
|
|
19
|
+
}, miliSeconds ?? 6000);
|
|
20
20
|
}, []);
|
|
21
21
|
return (
|
|
22
22
|
<Portal>
|
|
@@ -31,3 +31,4 @@ export const Alert = (props: IFAlertInfo) => {
|
|
|
31
31
|
</Portal>
|
|
32
32
|
);
|
|
33
33
|
}
|
|
34
|
+
|
|
@@ -40,7 +40,7 @@ export const BtnContained = (props: IfBtnContained) => {
|
|
|
40
40
|
]}
|
|
41
41
|
style={[stylesButtonContained['btn-contained'], style ?? '']}
|
|
42
42
|
mode="contained"
|
|
43
|
-
onPress={onPress}
|
|
43
|
+
onPress={() => !isLoading && onPress()}
|
|
44
44
|
>
|
|
45
45
|
{icon && <Image source={icon} />}
|
|
46
46
|
{text}
|
|
@@ -8,11 +8,12 @@ interface IfCardList {
|
|
|
8
8
|
options: { value: string | JSX.Element, id: string }[];
|
|
9
9
|
children?: React.ReactNode;
|
|
10
10
|
onSelectOption: (value: string) => void;
|
|
11
|
+
value?: string;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
export const CardList = (props: IfCardList) => {
|
|
14
|
-
const { options, onSelectOption } = props;
|
|
15
|
-
const [selectedOption, setSelectOption] = useState(0);
|
|
15
|
+
const { options, onSelectOption, value } = props;
|
|
16
|
+
const [selectedOption, setSelectOption] = useState(value ? options.findIndex((option) => option.id === value) : 0);
|
|
16
17
|
|
|
17
18
|
return (
|
|
18
19
|
<ScrollView>
|
|
@@ -21,11 +21,11 @@ interface IFDialogIcon {
|
|
|
21
21
|
children?: JSX.Element;
|
|
22
22
|
isDisabled?: boolean;
|
|
23
23
|
styleBtnContainer?: StyleProp<ViewStyle>;
|
|
24
|
-
|
|
24
|
+
isLoading?: boolean;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export const DialogGeneral = (props: IFDialogIcon) => {
|
|
28
|
-
const { isVisible, title, text, textCancel, textOk, icon, onDismiss, onConfirm, textStyle, additionalTextStyle, additionalText, isDisabled, children, styleBtnContainer, showClose } = props;
|
|
28
|
+
const { isLoading, isVisible, title, text, textCancel, textOk, icon, onDismiss, onConfirm, textStyle, additionalTextStyle, additionalText, isDisabled, children, styleBtnContainer, showClose } = props;
|
|
29
29
|
const icons = {
|
|
30
30
|
error: <MaterialIcons name="delete-forever" size={24} color={theme.colors.darkRed} />,
|
|
31
31
|
warning: <FontAwesome name="warning" size={24} color={theme.colors.darkWarning} />,
|
|
@@ -82,6 +82,7 @@ export const DialogGeneral = (props: IFDialogIcon) => {
|
|
|
82
82
|
<BtnContained
|
|
83
83
|
color={icon === 'error' ? 'error' : 'primary'}
|
|
84
84
|
size='sm'
|
|
85
|
+
isLoading={isLoading}
|
|
85
86
|
onPress={onConfirm}
|
|
86
87
|
text={textOk}
|
|
87
88
|
isDisabled={isDisabled}
|
|
@@ -117,6 +117,7 @@ export const Input = (props: IfInputText) => {
|
|
|
117
117
|
textColor={textColor}
|
|
118
118
|
style={[
|
|
119
119
|
styleInput['input-label'],
|
|
120
|
+
{ backgroundColor: theme.colors.white },
|
|
120
121
|
((!isValid && value?.trim() !== '') || errorRequired) && styleInput['input-error-focused'],
|
|
121
122
|
isFocus && isValid && !errorRequired && styleInput['input-text--focused'],
|
|
122
123
|
style ?? [],
|
|
@@ -69,7 +69,7 @@ export const InputEmail = (props: IfInputText) => {
|
|
|
69
69
|
onChangeText={handleInputChange}
|
|
70
70
|
theme={{
|
|
71
71
|
colors: {
|
|
72
|
-
primary:theme.colors.primary,
|
|
72
|
+
primary: theme.colors.primary,
|
|
73
73
|
onSurfaceVariant: theme.colors.boldBlack,
|
|
74
74
|
error: theme.colors.darkRed,
|
|
75
75
|
},
|
|
@@ -84,10 +84,11 @@ export const InputEmail = (props: IfInputText) => {
|
|
|
84
84
|
}}
|
|
85
85
|
error={error}
|
|
86
86
|
textColor={textColor}
|
|
87
|
-
style={[styleInput['input-label'],
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
style={[styleInput['input-label'],
|
|
88
|
+
{ backgroundColor: theme.colors.white },
|
|
89
|
+
isFocus && isValid && styleInput['input-text--focused'],
|
|
90
|
+
!isValid && styleInput['input-error-focused'],
|
|
91
|
+
style ?? []]}
|
|
91
92
|
contentStyle={[
|
|
92
93
|
styleInput['input-label'],
|
|
93
94
|
!isValid && !isFocus && value.trim() !== '' && styleInput['input-txt-error'],
|
|
@@ -97,15 +98,15 @@ export const InputEmail = (props: IfInputText) => {
|
|
|
97
98
|
underlineColor
|
|
98
99
|
? underlineColor
|
|
99
100
|
: isValid
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
? styleInput['input-text-underline'].color
|
|
102
|
+
: styleInput['input-txt-error'].borderBottomColor
|
|
102
103
|
}
|
|
103
104
|
activeUnderlineColor={
|
|
104
105
|
activeUnderlineColor
|
|
105
106
|
? activeUnderlineColor
|
|
106
107
|
: !isValid && value.trim() !== ''
|
|
107
|
-
|
|
108
|
-
|
|
108
|
+
? styleInput['input-text--activeUnderline'].color
|
|
109
|
+
: ''
|
|
109
110
|
}
|
|
110
111
|
/>
|
|
111
112
|
{isValid && (
|
|
@@ -121,4 +122,4 @@ export const InputEmail = (props: IfInputText) => {
|
|
|
121
122
|
)}
|
|
122
123
|
</View>
|
|
123
124
|
);
|
|
124
|
-
};
|
|
125
|
+
};
|
|
@@ -3,6 +3,7 @@ import { styleInput } from '../../../assets/styles/elements/inputs';
|
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
import { Image, View } from 'react-native';
|
|
5
5
|
import { icons } from '../../../assets/icons/_icons';
|
|
6
|
+
import { theme } from '../../config/paper.config';
|
|
6
7
|
|
|
7
8
|
interface IfInputPassword {
|
|
8
9
|
label?: string;
|
|
@@ -27,6 +28,7 @@ interface IfInputPassword {
|
|
|
27
28
|
pattern?: RegExp;
|
|
28
29
|
readonly?: boolean;
|
|
29
30
|
nonValidate?: boolean;
|
|
31
|
+
maxLength?: number;
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
export const InputPassword = (props: IfInputPassword) => {
|
|
@@ -52,6 +54,7 @@ export const InputPassword = (props: IfInputPassword) => {
|
|
|
52
54
|
onInvalid,
|
|
53
55
|
readonly,
|
|
54
56
|
nonValidate,
|
|
57
|
+
maxLength
|
|
55
58
|
} = props;
|
|
56
59
|
const patternPasswordDefault = pattern ?? /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*]).{8,}$/
|
|
57
60
|
|
|
@@ -93,10 +96,12 @@ export const InputPassword = (props: IfInputPassword) => {
|
|
|
93
96
|
icon={!showText ? icons.visibilityOff : icons.visibilityOn}
|
|
94
97
|
/>
|
|
95
98
|
}
|
|
99
|
+
maxLength={maxLength ?? 16}
|
|
96
100
|
placeholderTextColor={styleInput['input-txt'].color}
|
|
97
101
|
textColor={textColor}
|
|
98
102
|
style={[
|
|
99
103
|
styleInput['input-label'],
|
|
104
|
+
{ backgroundColor: theme.colors.white },
|
|
100
105
|
isFocus && isValid && styleInput['input-text--focused'],
|
|
101
106
|
!isValid && styleInput['input-error-focused'],
|
|
102
107
|
!isValid && !isFocus && value.trim() !== '' && styleInput['input-txt-error'],
|
|
@@ -14,7 +14,7 @@ export const PageTouchable = (props: IFPageTouchable) => {
|
|
|
14
14
|
<KeyboardAvoidingView style={{ flex: 1 }} behavior="height">
|
|
15
15
|
<TouchableWithoutFeedback onPress={() => Keyboard.dismiss()}>
|
|
16
16
|
<SafeAreaView style={{ flex: 1 }}>
|
|
17
|
-
<View style={{ flex: 1,
|
|
17
|
+
<View style={{ flex: 1, paddingHorizontal: 16, paddingBottom: 16, backgroundColor: theme.colors.background, ...customStyles }}>
|
|
18
18
|
{children}
|
|
19
19
|
</View>
|
|
20
20
|
</SafeAreaView>
|
|
@@ -23,3 +23,4 @@ export const PageTouchable = (props: IFPageTouchable) => {
|
|
|
23
23
|
</View>
|
|
24
24
|
);
|
|
25
25
|
};
|
|
26
|
+
|