ikualo-ui-kit-mobile 0.2.1 → 0.2.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/assets/styles/elements/buttons.ts +0 -1
- package/assets/styles/elements/dropdown.ts +0 -1
- package/assets/styles/elements/select.ts +4 -1
- package/package.json +1 -1
- package/src/elements/headers/HeaderPage.tsx +9 -6
- package/src/elements/select/Select.tsx +22 -11
- package/src/elements/select/SelectList.tsx +2 -2
|
@@ -6,7 +6,6 @@ const styleDropdown = StyleSheet.create({
|
|
|
6
6
|
width: 'auto',
|
|
7
7
|
flexDirection: 'row',
|
|
8
8
|
justifyContent: 'flex-end',
|
|
9
|
-
marginTop: 28
|
|
10
9
|
},
|
|
11
10
|
'dropdown-menu': { flexDirection: 'row', alignItems: 'center' },
|
|
12
11
|
'dropdown-content': { backgroundColor: 'white', borderRadius: 16, padding: 16 },
|
|
@@ -10,6 +10,9 @@ export const stylesSelect = StyleSheet.create({
|
|
|
10
10
|
'select-container-disabled': {
|
|
11
11
|
backgroundColor: theme.colors.disabled,
|
|
12
12
|
},
|
|
13
|
+
'select-placeholder-readonly': {
|
|
14
|
+
color: theme.colors.grayText,
|
|
15
|
+
},
|
|
13
16
|
'select-content': {
|
|
14
17
|
borderBottomWidth: 1,
|
|
15
18
|
borderBottomColor: theme.colors.primary,
|
|
@@ -32,4 +35,4 @@ export const stylesSelect = StyleSheet.create({
|
|
|
32
35
|
borderBlockColor: theme.colors.lightPrimary,
|
|
33
36
|
padding: 16,
|
|
34
37
|
},
|
|
35
|
-
});
|
|
38
|
+
});
|
package/package.json
CHANGED
|
@@ -8,13 +8,14 @@ import { theme } from '../../config/paper.config';
|
|
|
8
8
|
|
|
9
9
|
interface IFHeaderPage {
|
|
10
10
|
title: string;
|
|
11
|
+
hideBack?: boolean;
|
|
11
12
|
navigateTo?: 'Back' | string;
|
|
12
13
|
onPressBack?: () => void;
|
|
13
14
|
onPressRight?: () => void;
|
|
14
15
|
right: 'icon' | 'close' | 'help' | ''
|
|
15
16
|
}
|
|
16
17
|
export const HeaderPage = (props: IFHeaderPage) => {
|
|
17
|
-
const { navigateTo, title, onPressBack, onPressRight, right } = props;
|
|
18
|
+
const { navigateTo, title, onPressBack, onPressRight, right, hideBack } = props;
|
|
18
19
|
const { navigate, goBack } = useNavigation();
|
|
19
20
|
const navigateToScreen = () => {
|
|
20
21
|
onPressBack && onPressBack();
|
|
@@ -45,11 +46,13 @@ export const HeaderPage = (props: IFHeaderPage) => {
|
|
|
45
46
|
]
|
|
46
47
|
return (
|
|
47
48
|
<View style={stylesHeader['header']}>
|
|
48
|
-
|
|
49
|
-
<
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
{!hideBack &&
|
|
50
|
+
<TouchableOpacity onPress={navigateToScreen}>
|
|
51
|
+
<View style={stylesHeader['header-icon-back']}>
|
|
52
|
+
<FontAwesome6 name="chevron-left" size={16} color={theme.colors.primary} />
|
|
53
|
+
</View>
|
|
54
|
+
</TouchableOpacity>
|
|
55
|
+
}
|
|
53
56
|
<View style={{ flex: 1, alignItems: 'center' }}>
|
|
54
57
|
<Text variant="bodyMedium" style={stylesHeader['header-title']}>
|
|
55
58
|
{title}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { TouchableNativeFeedback, View, Image } from 'react-native';
|
|
1
|
+
import { TouchableNativeFeedback, View, Image, Touchable } from 'react-native';
|
|
2
2
|
import { Text } from 'react-native-paper';
|
|
3
3
|
import { ReactElement, useState } from 'react';
|
|
4
4
|
import { icons } from '../../../assets/icons/_icons';
|
|
5
5
|
import { SelectList } from '../../';
|
|
6
6
|
import { stylesSelect } from '../../../assets/styles/elements/select';
|
|
7
|
+
import SimpleLineIcons from '@expo/vector-icons/SimpleLineIcons';
|
|
8
|
+
import { TouchableWithoutFeedback } from 'react-native-gesture-handler';
|
|
7
9
|
|
|
8
10
|
interface IFSelect {
|
|
9
11
|
label: string;
|
|
@@ -12,33 +14,42 @@ interface IFSelect {
|
|
|
12
14
|
options: { value: string; label: ReactElement }[];
|
|
13
15
|
onSelect: (value: string) => void;
|
|
14
16
|
value?: string;
|
|
17
|
+
showInLabel?: "placeholder" | "label",
|
|
18
|
+
isReadOnly?: boolean;
|
|
15
19
|
}
|
|
16
20
|
export const Select = (props: IFSelect) => {
|
|
17
|
-
const { placeholder, options, onSelect, label, isDisabled, value } = props;
|
|
21
|
+
const { placeholder, options, onSelect, label, isDisabled, value, showInLabel, isReadOnly } = props;
|
|
18
22
|
const [showList, setShowList] = useState(false);
|
|
19
23
|
const [selected, setSelected] = useState<ReactElement | null>(
|
|
20
24
|
options?.find((option) => option.value === value)?.label ?? null
|
|
21
25
|
);
|
|
22
26
|
return (
|
|
23
27
|
<>
|
|
24
|
-
<
|
|
28
|
+
<TouchableWithoutFeedback
|
|
25
29
|
onPress={() => {
|
|
26
|
-
!isDisabled && setShowList(true);
|
|
30
|
+
(!isDisabled && !isReadOnly) && setShowList(true);
|
|
27
31
|
}}
|
|
28
32
|
>
|
|
29
33
|
<View
|
|
30
|
-
style={[
|
|
34
|
+
style={[
|
|
35
|
+
stylesSelect['select-container'],
|
|
36
|
+
isDisabled && stylesSelect['select-container-disabled'],
|
|
37
|
+
]}
|
|
31
38
|
>
|
|
32
39
|
<Text style={stylesSelect['select-label']}>{selected && label}</Text>
|
|
33
|
-
<View style={stylesSelect['select-content']
|
|
34
|
-
|
|
35
|
-
<
|
|
40
|
+
<View style={[stylesSelect['select-content'],
|
|
41
|
+
]}>
|
|
42
|
+
<Text style={[
|
|
43
|
+
stylesSelect['select-placeholder'],
|
|
44
|
+
isReadOnly && stylesSelect['select-placeholder-readonly'],
|
|
45
|
+
]}>{selected ?? placeholder}</Text>
|
|
46
|
+
{!isReadOnly && <SimpleLineIcons name={showList ? "arrow-up" : "arrow-down"} size={10} color="black" />}
|
|
36
47
|
</View>
|
|
37
48
|
</View>
|
|
38
|
-
</
|
|
49
|
+
</TouchableWithoutFeedback>
|
|
39
50
|
<SelectList
|
|
40
51
|
children={options}
|
|
41
|
-
label={placeholder}
|
|
52
|
+
label={showInLabel === "label" ? label : placeholder}
|
|
42
53
|
onDismiss={() => setShowList(false)}
|
|
43
54
|
onSelect={(value) => {
|
|
44
55
|
setSelected(value.label);
|
|
@@ -48,4 +59,4 @@ export const Select = (props: IFSelect) => {
|
|
|
48
59
|
/>
|
|
49
60
|
</>
|
|
50
61
|
);
|
|
51
|
-
};
|
|
62
|
+
};
|
|
@@ -25,7 +25,7 @@ export const SelectList = (props: IFSelectList) => {
|
|
|
25
25
|
>
|
|
26
26
|
<TouchableWithoutFeedback>
|
|
27
27
|
<View style={stylesDialog.modalBackground}>
|
|
28
|
-
<View style={[stylesDialog['dialog-down'], stylesDialog['dialog-bottom']]}>
|
|
28
|
+
<View style={[stylesDialog['dialog-down'], stylesDialog['dialog-bottom'], { maxHeight: '90%' }]}>
|
|
29
29
|
|
|
30
30
|
<TouchableHighlight onPress={onDismiss} underlayColor={theme.colors.lightPrimary} style={stylesDialog['dialog-down-select-close']}>
|
|
31
31
|
<Icon
|
|
@@ -35,7 +35,7 @@ export const SelectList = (props: IFSelectList) => {
|
|
|
35
35
|
/>
|
|
36
36
|
</TouchableHighlight>
|
|
37
37
|
<Text style={[stylesDialog['dialog-select-title']]}>{label}</Text>
|
|
38
|
-
<ScrollView
|
|
38
|
+
<ScrollView>
|
|
39
39
|
{children?.map((child, index) => {
|
|
40
40
|
return (
|
|
41
41
|
<TouchableNativeFeedback
|