@widergy/mobile-ui 2.11.0 → 2.12.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 +7 -0
- package/lib/components/FilePicker/index.js +4 -1
- package/lib/components/MultipleFilePicker/components/Picker/index.js +5 -0
- package/lib/components/MultipleFilePicker/components/UploadedFiles/index.js +21 -4
- package/lib/components/MultipleFilePicker/index.js +8 -2
- package/lib/components/Picker/index.js +9 -1
- package/lib/components/RadioGroup/index.js +2 -2
- package/lib/components/UTSwitch/index.js +2 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [2.12.0](https://github.com/widergy/mobile-ui/compare/v2.11.0...v2.12.0) (2026-04-13)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* [AUTO-208] Test id's implementation to form fields ([#492](https://github.com/widergy/mobile-ui/issues/492)) ([7ac3c8b](https://github.com/widergy/mobile-ui/commit/7ac3c8b58a46f554e9bafbd88b4fb24ac6695d50))
|
|
7
|
+
|
|
1
8
|
# [2.11.0](https://github.com/widergy/mobile-ui/compare/v2.10.0...v2.11.0) (2026-04-13)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -22,6 +22,7 @@ class FilePicker extends Component {
|
|
|
22
22
|
handleShowPicker = async () => {
|
|
23
23
|
const {
|
|
24
24
|
allowedTypes = DEFAULT_ALLOWED_TYPES,
|
|
25
|
+
dataTestId,
|
|
25
26
|
onMaxSizeError,
|
|
26
27
|
onError,
|
|
27
28
|
onChange,
|
|
@@ -102,11 +103,13 @@ class FilePicker extends Component {
|
|
|
102
103
|
};
|
|
103
104
|
|
|
104
105
|
render() {
|
|
105
|
-
const { error, title, filePlaceholder, style, withMarkdownTitle, markdownStyles, disabled } =
|
|
106
|
+
const { error, title, filePlaceholder, style, withMarkdownTitle, markdownStyles, disabled, dataTestId } =
|
|
107
|
+
this.props;
|
|
106
108
|
const { fileName } = this.state;
|
|
107
109
|
return (
|
|
108
110
|
<View style={style}>
|
|
109
111
|
<Picker
|
|
112
|
+
dataTestId={dataTestId}
|
|
110
113
|
icon={UPLOAD_ICON}
|
|
111
114
|
error={error}
|
|
112
115
|
onAdd={this.handleShowPicker}
|
|
@@ -13,6 +13,7 @@ import styles from './styles';
|
|
|
13
13
|
|
|
14
14
|
const Picker = ({
|
|
15
15
|
maxFiles,
|
|
16
|
+
dataTestId,
|
|
16
17
|
disabled = false,
|
|
17
18
|
error,
|
|
18
19
|
filePlaceholder,
|
|
@@ -32,9 +33,11 @@ const Picker = ({
|
|
|
32
33
|
) : (
|
|
33
34
|
uploadedFiles.map((file, index) => (
|
|
34
35
|
<UploadedFile
|
|
36
|
+
dataTestId={dataTestId}
|
|
35
37
|
disabled={disabled}
|
|
36
38
|
file={file}
|
|
37
39
|
filePlaceholder={filePlaceholder}
|
|
40
|
+
index={index}
|
|
38
41
|
key={file.name}
|
|
39
42
|
onDelete={() => onDelete(index)}
|
|
40
43
|
/>
|
|
@@ -44,6 +47,7 @@ const Picker = ({
|
|
|
44
47
|
{uploadedFiles.length < maxFiles && (
|
|
45
48
|
<UTButton
|
|
46
49
|
colorTheme="primary"
|
|
50
|
+
dataTestId={dataTestId ? `${dataTestId}.uploadButton` : undefined}
|
|
47
51
|
disabled={disabled}
|
|
48
52
|
Icon="IconUpload"
|
|
49
53
|
onPress={onAdd}
|
|
@@ -72,6 +76,7 @@ const Picker = ({
|
|
|
72
76
|
|
|
73
77
|
Picker.propTypes = {
|
|
74
78
|
maxFiles: number,
|
|
79
|
+
dataTestId: string,
|
|
75
80
|
disabled: bool,
|
|
76
81
|
error: string,
|
|
77
82
|
filePlaceholder: string,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { string, bool, func, object } from 'prop-types';
|
|
1
|
+
import { string, bool, func, number, object } from 'prop-types';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
|
|
@@ -11,9 +11,16 @@ import UTLabel from '../../../UTLabel';
|
|
|
11
11
|
import { bytesFormater } from './utils';
|
|
12
12
|
import styles from './styles';
|
|
13
13
|
|
|
14
|
-
const UploadedFiles = ({
|
|
14
|
+
const UploadedFiles = ({
|
|
15
|
+
dataTestId,
|
|
16
|
+
disabled = false,
|
|
17
|
+
file,
|
|
18
|
+
filePlaceholder,
|
|
19
|
+
index,
|
|
20
|
+
onDelete
|
|
21
|
+
}) => {
|
|
15
22
|
return (
|
|
16
|
-
<Surface style={styles.container}>
|
|
23
|
+
<Surface style={styles.container} testID={dataTestId ? `${dataTestId}.preview.${index}` : undefined}>
|
|
17
24
|
<UTIcon name="IconCheck" size={32} colorTheme="accent" shade="04" />
|
|
18
25
|
<View style={styles.texts}>
|
|
19
26
|
<UTLabel numberOfLines={1} weight="medium">
|
|
@@ -23,15 +30,25 @@ const UploadedFiles = ({ disabled = false, file, filePlaceholder, onDelete }) =>
|
|
|
23
30
|
{bytesFormater(file.size)}
|
|
24
31
|
</UTLabel>
|
|
25
32
|
</View>
|
|
26
|
-
{!disabled &&
|
|
33
|
+
{!disabled && (
|
|
34
|
+
<UTButton
|
|
35
|
+
dataTestId={dataTestId ? `${dataTestId}.delete.${index}` : undefined}
|
|
36
|
+
Icon="IconTrash"
|
|
37
|
+
colorTheme="primary"
|
|
38
|
+
variant="text"
|
|
39
|
+
onPress={onDelete}
|
|
40
|
+
/>
|
|
41
|
+
)}
|
|
27
42
|
</Surface>
|
|
28
43
|
);
|
|
29
44
|
};
|
|
30
45
|
|
|
31
46
|
UploadedFiles.propTypes = {
|
|
47
|
+
dataTestId: string,
|
|
32
48
|
disabled: bool,
|
|
33
49
|
file: object,
|
|
34
50
|
filePlaceholder: string,
|
|
51
|
+
index: number,
|
|
35
52
|
onDelete: func
|
|
36
53
|
};
|
|
37
54
|
|
|
@@ -29,6 +29,7 @@ import styles from './styles';
|
|
|
29
29
|
const MultipleFilePicker = ({
|
|
30
30
|
allowedPDFUploadSizes,
|
|
31
31
|
allowedTypes,
|
|
32
|
+
dataTestId,
|
|
32
33
|
disabled,
|
|
33
34
|
enabledInputs: { camera, files, gallery } = { files: true },
|
|
34
35
|
error,
|
|
@@ -401,8 +402,9 @@ const MultipleFilePicker = ({
|
|
|
401
402
|
};
|
|
402
403
|
|
|
403
404
|
return (
|
|
404
|
-
<View style={style}>
|
|
405
|
+
<View style={style} testID={dataTestId}>
|
|
405
406
|
<Picker
|
|
407
|
+
dataTestId={dataTestId}
|
|
406
408
|
disabled={disabled}
|
|
407
409
|
error={error}
|
|
408
410
|
filePlaceholder={filePlaceholder}
|
|
@@ -421,25 +423,29 @@ const MultipleFilePicker = ({
|
|
|
421
423
|
Icon: 'IconCamera',
|
|
422
424
|
onPress: onPickCamera,
|
|
423
425
|
show: camera,
|
|
426
|
+
testIdModifier: 'camera',
|
|
424
427
|
text: 'Cámara'
|
|
425
428
|
},
|
|
426
429
|
{
|
|
427
430
|
Icon: 'IconPhoto',
|
|
428
431
|
onPress: onPickGallery,
|
|
429
432
|
show: gallery,
|
|
433
|
+
testIdModifier: 'gallery',
|
|
430
434
|
text: 'Fotos'
|
|
431
435
|
},
|
|
432
436
|
{
|
|
433
437
|
Icon: 'IconFileArrowRight',
|
|
434
438
|
onPress: onPickFiles,
|
|
435
439
|
show: files,
|
|
440
|
+
testIdModifier: 'files',
|
|
436
441
|
text: 'Archivos'
|
|
437
442
|
}
|
|
438
443
|
].map(
|
|
439
|
-
({ Icon, onPress, show, text }) =>
|
|
444
|
+
({ Icon, onPress, show, testIdModifier, text }) =>
|
|
440
445
|
show && (
|
|
441
446
|
<UTButton
|
|
442
447
|
colorTheme="secondary"
|
|
448
|
+
dataTestId={dataTestId ? `${dataTestId}.${testIdModifier}` : undefined}
|
|
443
449
|
Icon={Icon}
|
|
444
450
|
key={text}
|
|
445
451
|
onPress={onPress}
|
|
@@ -11,6 +11,7 @@ import { withTheme, themeType } from '../../theming';
|
|
|
11
11
|
import styles from './styles';
|
|
12
12
|
|
|
13
13
|
const Picker = ({
|
|
14
|
+
dataTestId,
|
|
14
15
|
icon,
|
|
15
16
|
error,
|
|
16
17
|
onAdd,
|
|
@@ -35,7 +36,13 @@ const Picker = ({
|
|
|
35
36
|
</Label>
|
|
36
37
|
)}
|
|
37
38
|
<View style={styles.fieldInput}>
|
|
38
|
-
<Touchable
|
|
39
|
+
<Touchable
|
|
40
|
+
borderless
|
|
41
|
+
style={styles.touchable}
|
|
42
|
+
dataTestId={dataTestId}
|
|
43
|
+
disabled={disabled}
|
|
44
|
+
onPress={onAdd}
|
|
45
|
+
>
|
|
39
46
|
<Input
|
|
40
47
|
backgroundColor="transparent"
|
|
41
48
|
value={fileName}
|
|
@@ -59,6 +66,7 @@ const Picker = ({
|
|
|
59
66
|
);
|
|
60
67
|
|
|
61
68
|
Picker.propTypes = {
|
|
69
|
+
dataTestId: string,
|
|
62
70
|
icon: string.isRequired,
|
|
63
71
|
error: oneOfType([string, bool]),
|
|
64
72
|
onAdd: func.isRequired,
|
|
@@ -18,12 +18,12 @@ class RadioGroup extends Component {
|
|
|
18
18
|
onOptionChange(option && option[keyField]);
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
renderOptions = option => {
|
|
21
|
+
renderOptions = (option, index) => {
|
|
22
22
|
const { selectedOption, radioProps, keyField, disabled, dataTestId } = this.props;
|
|
23
23
|
return (
|
|
24
24
|
<RadioButton
|
|
25
25
|
style={styles.radio}
|
|
26
|
-
dataTestId={dataTestId ? `${dataTestId}.
|
|
26
|
+
dataTestId={dataTestId ? `${dataTestId}.button.${index}` : undefined}
|
|
27
27
|
option={option}
|
|
28
28
|
key={option.id}
|
|
29
29
|
label={option.label}
|
|
@@ -9,6 +9,7 @@ import ownStyles from './styles';
|
|
|
9
9
|
import switchProptypes from './proptypes';
|
|
10
10
|
|
|
11
11
|
const UTSwitch = ({
|
|
12
|
+
dataTestId,
|
|
12
13
|
disabled,
|
|
13
14
|
style,
|
|
14
15
|
onColor,
|
|
@@ -101,6 +102,7 @@ const UTSwitch = ({
|
|
|
101
102
|
onPressIn={onClick}
|
|
102
103
|
onPressOut={onClickEnd}
|
|
103
104
|
hitSlop={hitSlop}
|
|
105
|
+
testID={dataTestId}
|
|
104
106
|
>
|
|
105
107
|
<Animated.View
|
|
106
108
|
style={[
|
package/package.json
CHANGED