@widergy/mobile-ui 0.31.2 → 0.32.0
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/CHANGELOG.md +28 -0
- package/lib/components/CheckList/components/CheckBoxRenderer/index.js +2 -1
- package/lib/components/CheckList/index.js +12 -3
- package/lib/components/CheckList/styles.js +3 -0
- package/lib/components/FilePicker/index.js +11 -3
- package/lib/components/ImagePicker/ModalSelectionOption/index.js +62 -0
- package/lib/components/ImagePicker/ModalSelectionOption/styles.js +35 -0
- package/lib/components/ImagePicker/constants.js +2 -7
- package/lib/components/ImagePicker/index.js +13 -11
- package/lib/components/ImagePicker/layout.js +81 -43
- package/lib/components/ImageRadio/index.js +42 -25
- package/lib/components/ImageRadio/styles.js +34 -1
- package/lib/components/UTTextInput/flavors/FilledInput/index.js +2 -1
- package/lib/components/UTTextInput/flavors/OutlinedInput/index.js +2 -1
- package/lib/components/UTTextInput/flavors/StandardInput/index.js +2 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
# [0.32.0](https://github.com/widergy/mobile-ui/compare/v0.31.5...v0.32.0) (2021-12-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* new borderless prop for borderless searchbar ([#209](https://github.com/widergy/mobile-ui/issues/209)) ([8d5f9ae](https://github.com/widergy/mobile-ui/commit/8d5f9ae55d7e8ed6dea53d3d9e16b0a9dfcdf7b3))
|
|
7
|
+
|
|
8
|
+
## [0.31.5](https://github.com/widergy/mobile-ui/compare/v0.31.4...v0.31.5) (2021-11-16)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* improve image radio ([#206](https://github.com/widergy/mobile-ui/issues/206)) ([dd415e4](https://github.com/widergy/mobile-ui/commit/dd415e41323c2dd3ac7d9a43a490f86fa8947400))
|
|
14
|
+
|
|
15
|
+
## [0.31.4](https://github.com/widergy/mobile-ui/compare/v0.31.3...v0.31.4) (2021-11-09)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* add disabled props to select all checkbox ([#207](https://github.com/widergy/mobile-ui/issues/207)) ([6657729](https://github.com/widergy/mobile-ui/commit/6657729d9178d8d193459162da9ee68c6268da27))
|
|
21
|
+
|
|
22
|
+
## [0.31.3](https://github.com/widergy/mobile-ui/compare/v0.31.2...v0.31.3) (2021-11-09)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* application update to api 30 ([#205](https://github.com/widergy/mobile-ui/issues/205)) ([7c8480b](https://github.com/widergy/mobile-ui/commit/7c8480bcf1d66958840680d9769a72a163be6d96))
|
|
28
|
+
|
|
1
29
|
## [0.31.2](https://github.com/widergy/mobile-ui/compare/v0.31.1...v0.31.2) (2021-11-03)
|
|
2
30
|
|
|
3
31
|
|
|
@@ -24,7 +24,8 @@ const CheckBoxRenderer = ({
|
|
|
24
24
|
}) => {
|
|
25
25
|
const { Component, label, subLabel, disabled, value, required } = item;
|
|
26
26
|
|
|
27
|
-
const disableContainerStyle =
|
|
27
|
+
const disableContainerStyle =
|
|
28
|
+
disabledStyleEnabled && (disabled || required) ? disabledStyle || styles.disabled : {};
|
|
28
29
|
const alternateColorStyle = alternateColors && index % 2 ? coloredStyle || styles.colored : {};
|
|
29
30
|
return (
|
|
30
31
|
<Checkbox
|
|
@@ -90,9 +90,13 @@ class CheckList extends PureComponent {
|
|
|
90
90
|
separatorStyle,
|
|
91
91
|
selectAllSeparator,
|
|
92
92
|
includesSeparator,
|
|
93
|
-
error
|
|
93
|
+
error,
|
|
94
|
+
disabledSelectAll,
|
|
95
|
+
disabledStyleEnabled,
|
|
96
|
+
disabledStyle
|
|
94
97
|
} = this.props;
|
|
95
|
-
|
|
98
|
+
const disableContainerStyle =
|
|
99
|
+
disabledStyleEnabled && disabledSelectAll ? disabledStyle || styles.disabled : {};
|
|
96
100
|
return (
|
|
97
101
|
<View style={[styles.container, style]}>
|
|
98
102
|
{!!title && <Label style={styles.title}>{title}</Label>}
|
|
@@ -105,8 +109,13 @@ class CheckList extends PureComponent {
|
|
|
105
109
|
checkedColor={checkedColor}
|
|
106
110
|
labelsContainerStyle={selectAlllabelStyle}
|
|
107
111
|
reversed={reversedSelectAll}
|
|
108
|
-
style={[
|
|
112
|
+
style={[
|
|
113
|
+
selectAllContainerStyle,
|
|
114
|
+
alternateColors ? coloredStyle || styles.colored : {},
|
|
115
|
+
disableContainerStyle
|
|
116
|
+
]}
|
|
109
117
|
textProps={textProps}
|
|
118
|
+
disabled={disabledSelectAll}
|
|
110
119
|
/>
|
|
111
120
|
)}
|
|
112
121
|
{!!selectAllSeparator && !hideSelectAll && <SeparatorBar style={separatorStyle} />}
|
|
@@ -30,10 +30,18 @@ class FilePicker extends Component {
|
|
|
30
30
|
allowedPDFUploadSizes,
|
|
31
31
|
pdfFormatError
|
|
32
32
|
} = this.props;
|
|
33
|
+
const promisePicker = new Promise(async (resolve, reject) => {
|
|
34
|
+
try {
|
|
35
|
+
const picker = await DocumentPicker.pick({
|
|
36
|
+
type: allowedTypes && !onlyPDFAllowed(allowedTypes) ? allowedTypes : DocumentPicker.types.allFiles
|
|
37
|
+
});
|
|
38
|
+
return resolve(picker[0]);
|
|
39
|
+
} catch (error) {
|
|
40
|
+
return reject(error);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
33
43
|
try {
|
|
34
|
-
const document = await
|
|
35
|
-
type: allowedTypes && !onlyPDFAllowed(allowedTypes) ? allowedTypes : DocumentPicker.types.allFiles
|
|
36
|
-
});
|
|
44
|
+
const document = await promisePicker;
|
|
37
45
|
const isPDF = document.type.includes('pdf');
|
|
38
46
|
const isImage = document.type.includes('image');
|
|
39
47
|
if (onlyPDFAllowed(allowedTypes) && !isPDF) {
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, TouchableOpacity } from 'react-native';
|
|
3
|
+
import { Colors } from 'react-native/Libraries/NewAppScreen';
|
|
4
|
+
|
|
5
|
+
import Modal from '../../Modal';
|
|
6
|
+
import Label from '../../Label';
|
|
7
|
+
import imagePickerPropTypes from '../propTypes';
|
|
8
|
+
|
|
9
|
+
import styles from './styles';
|
|
10
|
+
|
|
11
|
+
const optionsModalDefault = {
|
|
12
|
+
title: 'Seleccionar imagen',
|
|
13
|
+
takePhotoButtonTitle: 'Tomar una foto',
|
|
14
|
+
chooseFromLibraryButtonTitle: 'Elegir desde galería',
|
|
15
|
+
cancelButtonTitle: 'CANCELAR'
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const ModalSelectionOption = ({
|
|
19
|
+
openModalSelection,
|
|
20
|
+
closeModalSelection,
|
|
21
|
+
openOptionSelected,
|
|
22
|
+
optionsModal
|
|
23
|
+
}) => {
|
|
24
|
+
const { title, takePhotoButtonTitle, chooseFromLibraryButtonTitle, cancelButtonTitle } =
|
|
25
|
+
optionsModal ?? optionsModalDefault;
|
|
26
|
+
return (
|
|
27
|
+
<Modal
|
|
28
|
+
visible={openModalSelection}
|
|
29
|
+
dismissable
|
|
30
|
+
onDismiss={closeModalSelection}
|
|
31
|
+
style={styles.displayImageModal}
|
|
32
|
+
elevation={0}
|
|
33
|
+
>
|
|
34
|
+
<Label bold style={styles.title}>
|
|
35
|
+
{title}
|
|
36
|
+
</Label>
|
|
37
|
+
<View style={styles.container}>
|
|
38
|
+
<TouchableOpacity onPress={() => openOptionSelected(true)} style={styles.button}>
|
|
39
|
+
<Label medium bold>
|
|
40
|
+
{takePhotoButtonTitle}
|
|
41
|
+
</Label>
|
|
42
|
+
</TouchableOpacity>
|
|
43
|
+
<TouchableOpacity onPress={() => openOptionSelected(false)} style={styles.button}>
|
|
44
|
+
<Label medium bold>
|
|
45
|
+
{chooseFromLibraryButtonTitle}
|
|
46
|
+
</Label>
|
|
47
|
+
</TouchableOpacity>
|
|
48
|
+
</View>
|
|
49
|
+
<View style={styles.cancelButtonContent}>
|
|
50
|
+
<TouchableOpacity onPress={closeModalSelection} style={[styles.button, styles.cancelButton]}>
|
|
51
|
+
<Label medium bold color={Colors.primary}>
|
|
52
|
+
{cancelButtonTitle}
|
|
53
|
+
</Label>
|
|
54
|
+
</TouchableOpacity>
|
|
55
|
+
</View>
|
|
56
|
+
</Modal>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
ModalSelectionOption.propTypes = imagePickerPropTypes;
|
|
61
|
+
|
|
62
|
+
export default ModalSelectionOption;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
horizontalScale,
|
|
5
|
+
moderateHorizontalScale,
|
|
6
|
+
moderateVerticalScale,
|
|
7
|
+
WINDOW_HEIGHT
|
|
8
|
+
} from '../../../utils/scaleUtils';
|
|
9
|
+
|
|
10
|
+
const styles = StyleSheet.create({
|
|
11
|
+
title: {
|
|
12
|
+
marginTop: moderateVerticalScale(-5)
|
|
13
|
+
},
|
|
14
|
+
container: {
|
|
15
|
+
marginLeft: horizontalScale(5)
|
|
16
|
+
},
|
|
17
|
+
displayImageModal: {
|
|
18
|
+
height: WINDOW_HEIGHT * 0.275
|
|
19
|
+
},
|
|
20
|
+
button: {
|
|
21
|
+
marginTop: moderateVerticalScale(2),
|
|
22
|
+
paddingTop: moderateVerticalScale(20),
|
|
23
|
+
borderRadius: 5
|
|
24
|
+
},
|
|
25
|
+
cancelButton: {
|
|
26
|
+
paddingLeft: moderateHorizontalScale(10)
|
|
27
|
+
},
|
|
28
|
+
cancelButtonContent: {
|
|
29
|
+
width: '100%',
|
|
30
|
+
display: 'flex',
|
|
31
|
+
alignItems: 'flex-end'
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export default styles;
|
|
@@ -3,13 +3,8 @@ import { MEGABYTE } from '../../utils/fileUtils.js';
|
|
|
3
3
|
export const ADD_ICON = 'add-a-photo';
|
|
4
4
|
|
|
5
5
|
export const options = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
path: 'images'
|
|
9
|
-
},
|
|
10
|
-
takePhotoButtonTitle: 'Tomar una foto',
|
|
11
|
-
chooseFromLibraryButtonTitle: 'Elegir desde galería',
|
|
12
|
-
cancelButtonTitle: 'Cancelar'
|
|
6
|
+
mediaType: 'photo',
|
|
7
|
+
quality: 0.8
|
|
13
8
|
};
|
|
14
9
|
|
|
15
10
|
export const DEFAULT_MAX_SIZE = 10 * MEGABYTE;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
// eslint-disable-next-line import/no-unresolved
|
|
3
|
-
import ImagePicker from 'react-native-image-picker';
|
|
4
2
|
|
|
5
3
|
import { retrieveFile } from '../../utils/fileUtils.js';
|
|
6
4
|
|
|
@@ -34,18 +32,22 @@ const ImagePickerComponent = ({
|
|
|
34
32
|
const [imageModalOpen, setImageModalOpen] = useState(false);
|
|
35
33
|
const mergedOptions = { ...options, ...pickerOptions };
|
|
36
34
|
|
|
37
|
-
const handleShowImagePicker =
|
|
38
|
-
|
|
35
|
+
const handleShowImagePicker = sourceImage => {
|
|
36
|
+
if (sourceImage?.errorCode) {
|
|
37
|
+
onError(sourceImage.errorCode);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
sourceImage(mergedOptions, async response => {
|
|
39
41
|
if (response.didCancel) return;
|
|
40
|
-
if (response.
|
|
41
|
-
onError(response.
|
|
42
|
+
if (response.errorCode) {
|
|
43
|
+
onError(response.errorCode);
|
|
42
44
|
return;
|
|
43
45
|
}
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
|
|
46
|
+
const { assets } = response;
|
|
47
|
+
const item = assets[0];
|
|
48
|
+
const file = await retrieveFile(item.uri, item.type);
|
|
47
49
|
if (!file) {
|
|
48
|
-
onError(response.
|
|
50
|
+
onError(response.errorCode);
|
|
49
51
|
return;
|
|
50
52
|
}
|
|
51
53
|
|
|
@@ -55,7 +57,7 @@ const ImagePickerComponent = ({
|
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
if (onChange) {
|
|
58
|
-
const fileNameAndSource = { source:
|
|
60
|
+
const fileNameAndSource = { source: item.uri, fileName: item.fileName };
|
|
59
61
|
onChange({ file, ...fileNameAndSource });
|
|
60
62
|
setImage(fileNameAndSource);
|
|
61
63
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
// eslint-disable-next-line react-native/split-platform-components
|
|
3
|
+
import { View, Image, TouchableWithoutFeedback, PermissionsAndroid } from 'react-native';
|
|
4
|
+
// eslint-disable-next-line import/no-unresolved
|
|
5
|
+
import { launchCamera, launchImageLibrary } from 'react-native-image-picker';
|
|
3
6
|
|
|
7
|
+
import { IS_IOS } from '../../utils/platformUtils/constants';
|
|
4
8
|
import Picker from '../Picker';
|
|
5
9
|
import Modal from '../Modal';
|
|
6
10
|
import Label from '../Label';
|
|
@@ -8,6 +12,7 @@ import Label from '../Label';
|
|
|
8
12
|
import styles from './styles';
|
|
9
13
|
import { ADD_ICON } from './constants';
|
|
10
14
|
import imagePickerPropTypes from './propTypes';
|
|
15
|
+
import ModalSelectionOption from './ModalSelectionOption';
|
|
11
16
|
|
|
12
17
|
const ImagePicker = ({
|
|
13
18
|
editable,
|
|
@@ -27,48 +32,81 @@ const ImagePicker = ({
|
|
|
27
32
|
style,
|
|
28
33
|
onOpenImageModal,
|
|
29
34
|
withMarkdownTitle,
|
|
30
|
-
markdownStyles
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
35
|
+
markdownStyles,
|
|
36
|
+
optionsModal
|
|
37
|
+
}) => {
|
|
38
|
+
const [openModalSelection, setOpenModalSelection] = useState(false);
|
|
39
|
+
const visibleModalSelection = () => setOpenModalSelection(true);
|
|
40
|
+
const closeModalSelection = () => setOpenModalSelection(false);
|
|
41
|
+
const requestPermissionCamera = async () => {
|
|
42
|
+
try {
|
|
43
|
+
const granted = await PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.CAMERA);
|
|
44
|
+
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
|
|
45
|
+
return launchCamera;
|
|
46
|
+
}
|
|
47
|
+
return { errorCode: 'Son necesarios permisos para utilizar la cámara' };
|
|
48
|
+
} catch (err) {
|
|
49
|
+
return { errorCode: 'Son necesarios permisos para utilizar la cámara' };
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const openOptionSelected = async selected => {
|
|
53
|
+
closeModalSelection();
|
|
54
|
+
return (
|
|
55
|
+
editable &&
|
|
56
|
+
onShowImagePicker(
|
|
57
|
+
selected ? (IS_IOS ? launchCamera : await requestPermissionCamera()) : launchImageLibrary
|
|
58
|
+
)
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<View style={[styles.container, style]}>
|
|
64
|
+
<Picker
|
|
65
|
+
icon={ADD_ICON}
|
|
66
|
+
error={error}
|
|
67
|
+
onAdd={visibleModalSelection}
|
|
68
|
+
onDelete={onOpenDeleteModal}
|
|
69
|
+
filePlaceholder={filePlaceholder}
|
|
70
|
+
title={title}
|
|
71
|
+
fileName={image ? image.fileName : ''}
|
|
72
|
+
withMarkdownTitle={withMarkdownTitle}
|
|
73
|
+
markdownStyles={markdownStyles}
|
|
74
|
+
/>
|
|
75
|
+
{image && (
|
|
76
|
+
<View style={styles.imageContainer}>
|
|
77
|
+
<TouchableWithoutFeedback onPress={onOpenImageModal} style={styles.touchable}>
|
|
78
|
+
<Image source={{ uri: image.source }} style={styles.image} resizeMode="contain" />
|
|
79
|
+
</TouchableWithoutFeedback>
|
|
80
|
+
</View>
|
|
81
|
+
)}
|
|
82
|
+
<Modal
|
|
83
|
+
title={deleteImageModalTitle}
|
|
84
|
+
visible={deleteModalOpen}
|
|
85
|
+
acceptButton={acceptButton}
|
|
86
|
+
cancelButton={cancelButton}
|
|
87
|
+
>
|
|
88
|
+
<Label>{deleteImageModalText}</Label>
|
|
89
|
+
</Modal>
|
|
90
|
+
<Modal
|
|
91
|
+
visible={imageModalOpen}
|
|
92
|
+
dismissable
|
|
93
|
+
onDismiss={onCloseImageModal}
|
|
94
|
+
style={styles.displayImageModal}
|
|
95
|
+
elevation={0}
|
|
96
|
+
>
|
|
97
|
+
<TouchableWithoutFeedback onPress={onCloseImageModal}>
|
|
98
|
+
<Image source={image && { uri: image.source }} style={styles.displayImage} resizeMode="contain" />
|
|
48
99
|
</TouchableWithoutFeedback>
|
|
49
|
-
</
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
>
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
<Modal
|
|
60
|
-
visible={imageModalOpen}
|
|
61
|
-
dismissable
|
|
62
|
-
onDismiss={onCloseImageModal}
|
|
63
|
-
style={styles.displayImageModal}
|
|
64
|
-
elevation={0}
|
|
65
|
-
>
|
|
66
|
-
<TouchableWithoutFeedback onPress={onCloseImageModal}>
|
|
67
|
-
<Image source={image && { uri: image.source }} style={styles.displayImage} resizeMode="contain" />
|
|
68
|
-
</TouchableWithoutFeedback>
|
|
69
|
-
</Modal>
|
|
70
|
-
</View>
|
|
71
|
-
);
|
|
100
|
+
</Modal>
|
|
101
|
+
<ModalSelectionOption
|
|
102
|
+
openModalSelection={openModalSelection}
|
|
103
|
+
closeModalSelection={closeModalSelection}
|
|
104
|
+
openOptionSelected={openOptionSelected}
|
|
105
|
+
optionsModal={optionsModal}
|
|
106
|
+
/>
|
|
107
|
+
</View>
|
|
108
|
+
);
|
|
109
|
+
};
|
|
72
110
|
|
|
73
111
|
ImagePicker.propTypes = imagePickerPropTypes;
|
|
74
112
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { View, ViewPropTypes } from 'react-native';
|
|
3
|
-
import { string, arrayOf, shape, func, number } from 'prop-types';
|
|
3
|
+
import { string, arrayOf, shape, func, number, any } from 'prop-types';
|
|
4
4
|
import _ from 'lodash';
|
|
5
5
|
|
|
6
6
|
import Label from '../Label';
|
|
@@ -9,37 +9,53 @@ import Touchable from '../Touchable';
|
|
|
9
9
|
|
|
10
10
|
import OwnStyles, { IMAGE_SIZE } from './styles';
|
|
11
11
|
|
|
12
|
-
const ImageRadio = ({ options, title, onChange, value, style }) => {
|
|
12
|
+
const ImageRadio = ({ options, title, onChange, value, style, variant = {} }) => {
|
|
13
13
|
const styles = _.merge({}, OwnStyles, style);
|
|
14
14
|
const handleOnChange = option => {
|
|
15
15
|
if (option) onChange(option.value);
|
|
16
16
|
};
|
|
17
|
+
const { vertical, transparent_background: transparentBackground } = variant;
|
|
17
18
|
const isSelected = option => option.value === value;
|
|
19
|
+
|
|
18
20
|
return (
|
|
19
21
|
<View style={styles.container}>
|
|
20
22
|
<Label>{title}</Label>
|
|
21
|
-
{
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
<View style={styles.
|
|
33
|
-
<
|
|
34
|
-
{
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
23
|
+
<View style={[styles.innerContainer, vertical && styles.verticalInnerContainer]}>
|
|
24
|
+
{options.map(option => (
|
|
25
|
+
<Touchable
|
|
26
|
+
key={option.id}
|
|
27
|
+
onPress={() => handleOnChange(option)}
|
|
28
|
+
style={[
|
|
29
|
+
styles.touchable,
|
|
30
|
+
vertical && styles.verticalTouchable,
|
|
31
|
+
isSelected(option) && !vertical && styles.selected
|
|
32
|
+
]}
|
|
33
|
+
>
|
|
34
|
+
<View style={vertical ? styles.touchableInnerContainerVertical : styles.touchableInnerContainer}>
|
|
35
|
+
<ImageIcon
|
|
36
|
+
size={IMAGE_SIZE}
|
|
37
|
+
image={isSelected(option) ? option.selectedImage : option.unselectedImage}
|
|
38
|
+
/>
|
|
39
|
+
<View style={!vertical ? styles.labels : styles.verticalLabels}>
|
|
40
|
+
<Label
|
|
41
|
+
white={!transparentBackground && isSelected(option)}
|
|
42
|
+
style={!vertical ? styles.label : styles.verticalLabel}
|
|
43
|
+
h4
|
|
44
|
+
>
|
|
45
|
+
{option.name}
|
|
46
|
+
</Label>
|
|
47
|
+
<Label
|
|
48
|
+
style={!vertical ? styles.label : styles.verticalLabel}
|
|
49
|
+
white={!transparentBackground && isSelected(option)}
|
|
50
|
+
h5
|
|
51
|
+
>
|
|
52
|
+
{option.description}
|
|
53
|
+
</Label>
|
|
54
|
+
</View>
|
|
39
55
|
</View>
|
|
40
|
-
</
|
|
41
|
-
|
|
42
|
-
|
|
56
|
+
</Touchable>
|
|
57
|
+
))}
|
|
58
|
+
</View>
|
|
43
59
|
</View>
|
|
44
60
|
);
|
|
45
61
|
};
|
|
@@ -58,7 +74,8 @@ ImageRadio.propTypes = {
|
|
|
58
74
|
title: string,
|
|
59
75
|
onChange: func,
|
|
60
76
|
value: string,
|
|
61
|
-
style: ViewPropTypes.style
|
|
77
|
+
style: ViewPropTypes.style,
|
|
78
|
+
variant: shape(any)
|
|
62
79
|
};
|
|
63
80
|
|
|
64
81
|
export default ImageRadio;
|
|
@@ -7,6 +7,16 @@ export default StyleSheet.create({
|
|
|
7
7
|
justifyContent: 'center',
|
|
8
8
|
alignItems: 'center'
|
|
9
9
|
},
|
|
10
|
+
innerContainer: {
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
width: '100%',
|
|
13
|
+
paddingVertical: 34,
|
|
14
|
+
paddingHorizontal: 34
|
|
15
|
+
},
|
|
16
|
+
verticalInnerContainer: {
|
|
17
|
+
flexDirection: 'row',
|
|
18
|
+
marginHorizontal: 50
|
|
19
|
+
},
|
|
10
20
|
optionContainer: {
|
|
11
21
|
marginTop: verticalScale(10)
|
|
12
22
|
},
|
|
@@ -20,16 +30,39 @@ export default StyleSheet.create({
|
|
|
20
30
|
marginTop: verticalScale(32),
|
|
21
31
|
width: '100%'
|
|
22
32
|
},
|
|
33
|
+
verticalTouchable: {
|
|
34
|
+
flexDirection: 'column',
|
|
35
|
+
alignItems: 'center',
|
|
36
|
+
marginHorizontal: 5,
|
|
37
|
+
width: '50%',
|
|
38
|
+
borderWidth: 0.6
|
|
39
|
+
},
|
|
23
40
|
selected: {
|
|
24
41
|
backgroundColor: '#3FBFE7'
|
|
25
42
|
},
|
|
43
|
+
|
|
44
|
+
touchableInnerContainerVertical: {
|
|
45
|
+
alignItems: 'center'
|
|
46
|
+
},
|
|
47
|
+
touchableInnerContainer: {
|
|
48
|
+
flexDirection: 'row',
|
|
49
|
+
alignItems: 'center'
|
|
50
|
+
},
|
|
26
51
|
labels: {
|
|
27
52
|
margin: 15,
|
|
28
53
|
marginLeft: horizontalScale(35),
|
|
29
54
|
maxWidth: 150,
|
|
30
55
|
textAlign: 'left'
|
|
31
56
|
},
|
|
32
|
-
|
|
57
|
+
verticalLabels: {
|
|
58
|
+
paddingTop: 20,
|
|
59
|
+
maxWidth: 150
|
|
60
|
+
},
|
|
61
|
+
label: {
|
|
62
|
+
paddingBottom: verticalScale(5),
|
|
63
|
+
paddingLeft: horizontalScale(15)
|
|
64
|
+
},
|
|
65
|
+
verticalLabel: {
|
|
33
66
|
paddingBottom: verticalScale(5)
|
|
34
67
|
},
|
|
35
68
|
iconBadge: {
|
|
@@ -37,6 +37,7 @@ const FilledInput = ({
|
|
|
37
37
|
tooltipProps,
|
|
38
38
|
multiline,
|
|
39
39
|
captionLabel,
|
|
40
|
+
borderless,
|
|
40
41
|
...props
|
|
41
42
|
}) => {
|
|
42
43
|
const [initialHeight, setInitialHeight] = useState(inputHeight);
|
|
@@ -104,7 +105,7 @@ const FilledInput = ({
|
|
|
104
105
|
</InputLabel>
|
|
105
106
|
)}
|
|
106
107
|
</View>
|
|
107
|
-
<InputAnimatedBorder variant="filled" focused={focused} error={error} value={value} />
|
|
108
|
+
{!borderless && (<InputAnimatedBorder variant="filled" focused={focused} error={error} value={value} />)}
|
|
108
109
|
</View>
|
|
109
110
|
{!!tooltip && (
|
|
110
111
|
<View style={[ownStyles.tooltipContainer, multiline && { height: initialHeight }]}>
|
|
@@ -38,6 +38,7 @@ const OutlinedInput = ({
|
|
|
38
38
|
tooltipProps,
|
|
39
39
|
multiline,
|
|
40
40
|
captionLabel,
|
|
41
|
+
borderless,
|
|
41
42
|
...props
|
|
42
43
|
}) => {
|
|
43
44
|
const focusedColor = themeStyles?.focused?.color || theme.colors.primary;
|
|
@@ -68,7 +69,7 @@ const OutlinedInput = ({
|
|
|
68
69
|
disabled && themeStyles?.containerDisabled,
|
|
69
70
|
// eslint-disable-next-line react-native/no-inline-styles
|
|
70
71
|
{
|
|
71
|
-
borderWidth: focused ? 2 : disabled ? themeStyles?.inactive?.disabledBorderWidth ?? 1 : 1,
|
|
72
|
+
borderWidth: borderless ? 0 : focused ? 2 : disabled ? themeStyles?.inactive?.disabledBorderWidth ?? 1 : 1,
|
|
72
73
|
borderColor: active ? activeColor : inactiveColor
|
|
73
74
|
},
|
|
74
75
|
styles?.inputContainer
|
|
@@ -36,6 +36,7 @@ const StandardInput = ({
|
|
|
36
36
|
tooltipIconProps,
|
|
37
37
|
tooltipProps,
|
|
38
38
|
captionLabel,
|
|
39
|
+
borderless,
|
|
39
40
|
...props
|
|
40
41
|
}) => (
|
|
41
42
|
<View style={[ownStyles.container, themeStyles?.root, styles?.container]}>
|
|
@@ -92,7 +93,7 @@ const StandardInput = ({
|
|
|
92
93
|
</InputLabel>
|
|
93
94
|
)}
|
|
94
95
|
</View>
|
|
95
|
-
<InputAnimatedBorder variant="standard" focused={focused} error={error} value={value} />
|
|
96
|
+
{!borderless && (<InputAnimatedBorder variant="standard" focused={focused} error={error} value={value} />)}
|
|
96
97
|
</View>
|
|
97
98
|
{!!tooltip && (
|
|
98
99
|
<View style={ownStyles.tooltipContainer}>
|
package/package.json
CHANGED