@widergy/mobile-ui 1.29.5 → 1.30.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/CHANGELOG.md +14 -0
- package/lib/components/MultipleFilePicker/index.js +8 -2
- package/lib/components/MultipleFilePicker/utils.js +52 -5
- package/lib/components/UTIcon/components/EnergyIcons/EnergyIconCarbonFootprint.svg +6 -0
- package/lib/components/UTIcon/components/EnergyIcons/EnergyIconConsumption.svg +7 -0
- package/lib/components/UTIcon/constants.js +31 -27
- package/lib/components/UTIcon/index.js +3 -0
- package/lib/components/UTIcon/utils.js +12 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.30.1](https://github.com/widergy/mobile-ui/compare/v1.30.0...v1.30.1) (2024-11-01)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* [EVE-4316] attachment list fix ([055a2c5](https://github.com/widergy/mobile-ui/commit/055a2c508c266b763777d8c13a13f6d8f07265ab))
|
|
7
|
+
|
|
8
|
+
# [1.30.0](https://github.com/widergy/mobile-ui/compare/v1.29.5...v1.30.0) (2024-10-30)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* [UG-2034] new icons ([#381](https://github.com/widergy/mobile-ui/issues/381)) ([d0e9ce2](https://github.com/widergy/mobile-ui/commit/d0e9ce2f2379253bb1b2f79c193478312e1d1cc0))
|
|
14
|
+
|
|
1
15
|
## [1.29.5](https://github.com/widergy/mobile-ui/compare/v1.29.4...v1.29.5) (2024-10-29)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -13,7 +13,13 @@ import UTBottomSheet from '../UTBottomSheet';
|
|
|
13
13
|
import UTButton from '../UTButton';
|
|
14
14
|
|
|
15
15
|
import { DEFAULT_MAX_SIZE } from './constants';
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
getDocumentPickerType,
|
|
18
|
+
getInitialValuesFrom,
|
|
19
|
+
isFileFormatInvalid,
|
|
20
|
+
isFileSizeInvaid,
|
|
21
|
+
isFileTypeInvalid
|
|
22
|
+
} from './utils';
|
|
17
23
|
import filePickerPropTypes from './propTypes';
|
|
18
24
|
import Picker from './components/Picker';
|
|
19
25
|
import styles from './styles';
|
|
@@ -70,7 +76,7 @@ const MultipleFilePicker = ({
|
|
|
70
76
|
const onPickFiles = async () => {
|
|
71
77
|
const documents = await DocumentPicker.pick({
|
|
72
78
|
allowMultiSelection: true,
|
|
73
|
-
type: allowedTypes
|
|
79
|
+
type: isEmpty(allowedTypes) ? DocumentPicker.types.allFiles : allowedTypes.map(getDocumentPickerType)
|
|
74
80
|
});
|
|
75
81
|
|
|
76
82
|
if (uploadedFiles.length + documents.length > maxFiles)
|
|
@@ -1,5 +1,44 @@
|
|
|
1
|
-
import { PDFDocument } from 'pdf-lib';
|
|
2
1
|
import { isEmpty } from 'lodash';
|
|
2
|
+
import { PDFDocument } from 'pdf-lib';
|
|
3
|
+
// eslint-disable-next-line import/no-unresolved
|
|
4
|
+
import DocumentPicker from 'react-native-document-picker';
|
|
5
|
+
|
|
6
|
+
const mimeTypes = {
|
|
7
|
+
allFiles: '*/*',
|
|
8
|
+
audio: 'audio/*',
|
|
9
|
+
csv: 'text/csv',
|
|
10
|
+
doc: 'application/msword',
|
|
11
|
+
docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
12
|
+
images: 'image/*',
|
|
13
|
+
json: 'application/json',
|
|
14
|
+
pdf: 'application/pdf',
|
|
15
|
+
plainText: 'text/plain',
|
|
16
|
+
ppt: 'application/vnd.ms-powerpoint',
|
|
17
|
+
pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
|
18
|
+
video: 'video/*',
|
|
19
|
+
xls: 'application/vnd.ms-excel',
|
|
20
|
+
xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
21
|
+
zip: 'application/zip'
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const extensions = {
|
|
25
|
+
allFiles: '*',
|
|
26
|
+
audio:
|
|
27
|
+
'.3g2 .3gp .aac .adt .adts .aif .aifc .aiff .asf .au .m3u .m4a .m4b .mid .midi .mp2 .mp3 .rmi .snd .wav .wax .wma',
|
|
28
|
+
csv: '.csv',
|
|
29
|
+
doc: '.doc',
|
|
30
|
+
docx: '.docx',
|
|
31
|
+
images: '.jpeg .jpg .png .gif .bmp .svg .heic .heif',
|
|
32
|
+
json: '.json',
|
|
33
|
+
pdf: '.pdf',
|
|
34
|
+
plainText: '.txt',
|
|
35
|
+
ppt: '.ppt',
|
|
36
|
+
pptx: '.pptx',
|
|
37
|
+
video: '.mp4 .avi .mov .wmv',
|
|
38
|
+
xls: '.xls',
|
|
39
|
+
xlsx: '.xlsx',
|
|
40
|
+
zip: '.zip .gz'
|
|
41
|
+
};
|
|
3
42
|
|
|
4
43
|
const lengthMatches = (length1, length2, toleranceInPercentage) => {
|
|
5
44
|
const delta = length1 * (toleranceInPercentage / 100);
|
|
@@ -39,11 +78,19 @@ const pdfAspectRatioValidation = async (file, allowedPDFUploadSizes) => {
|
|
|
39
78
|
});
|
|
40
79
|
};
|
|
41
80
|
|
|
81
|
+
export const getFileType = extension =>
|
|
82
|
+
Object.entries(extensions).find(([, value]) => value.includes(extension))[0];
|
|
83
|
+
|
|
84
|
+
export const getMimeType = extension => {
|
|
85
|
+
const fileType = getFileType(extension);
|
|
86
|
+
const mimeType = mimeTypes[fileType];
|
|
87
|
+
return mimeType.replace('*', extension.replace(/\./g, ''));
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export const getDocumentPickerType = extension => DocumentPicker.types[getFileType(extension)];
|
|
91
|
+
|
|
42
92
|
export const isFileTypeInvalid = (document, allowedTypes, fileTypeError, onError) => {
|
|
43
|
-
const isInvalid = !(
|
|
44
|
-
allowedTypes.includes(document.type) ||
|
|
45
|
-
(document.type.includes('image') && allowedTypes.includes('image/*'))
|
|
46
|
-
);
|
|
93
|
+
const isInvalid = !allowedTypes.map(getMimeType).includes(document.type);
|
|
47
94
|
if (isInvalid) onError(fileTypeError || 'Tipo de archivo inválido.');
|
|
48
95
|
return isInvalid;
|
|
49
96
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg width="32" height="32" viewBox="0 0 26 26" stroke="currentColor" fill="none" xmlns="http://www.w3.org/2000/svg" stroke-width="2">
|
|
2
|
+
<path d="M21.7202 15.1902C20.9202 18.3602 16.5302 20.2802 13.0702 20.0602C12.4102 19.3902 10.1702 16.7202 11.0102 13.2802C11.9902 9.26018 18.0102 7.71018 20.9302 5.86018C21.5502 5.47018 22.7302 11.2102 21.7202 15.1902Z" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3
|
+
<path d="M18.5201 11.1602C14.9501 12.3102 12.5401 16.1902 13.0701 20.0602" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4
|
+
<path d="M8.41028 19.3202C6.36028 18.5002 4.63028 17.0602 4.16028 15.1902C3.15028 11.2102 4.33028 5.47018 4.95028 5.86018" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5
|
+
<path d="M4.9502 5.86035C6.2902 6.71035 8.2702 7.49035 10.1302 8.48035" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
6
|
+
</svg>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<svg width="32" height="32" viewBox="0 0 49 48" stroke="currentColor" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M18.6446 0.828056C18.3112 0.828056 18.0179 1.04806 17.9246 1.36806L10.0769 28.2743C10.0108 28.501
|
|
3
|
+
10.0552 28.7455 10.1969 28.9343C10.3385 29.1232 10.5608 29.2343 10.7969 29.2343H21.1583L19.0214 46.3288C18.9783 46.674 19.1781 47.0035 19.5041
|
|
4
|
+
47.1248C19.8301 47.2461 20.1967 47.1273 20.3897 46.8379L38.3272 19.9316C38.4806 19.7015 38.4949 19.4056 38.3644 19.1617C38.2339 18.9178 37.9798
|
|
5
|
+
18.7656 37.7032 18.7656H27.5745L33.921 1.8414C34.0074 1.61108 33.9753 1.35304 33.8352 1.15086C33.6951 0.948679 33.4648 0.828056 33.2188
|
|
6
|
+
0.828056H18.6446Z" stroke="currentColor"/>
|
|
7
|
+
</svg>
|
|
@@ -1,11 +1,26 @@
|
|
|
1
1
|
import { COLOR_SHADES, COLOR_THEMES } from '../../constants/Palette';
|
|
2
2
|
|
|
3
|
+
import BrandIconAmex from './components/EnergyIcons/BrandIconAmex.svg';
|
|
4
|
+
import BrandIconBancoEstado from './components/EnergyIcons/BrandIconBancoEstado.svg';
|
|
5
|
+
import BrandIconDiners from './components/EnergyIcons/BrandIconDiners.svg';
|
|
6
|
+
import BrandIconMacro from './components/EnergyIcons/BrandIconMacro.svg';
|
|
7
|
+
import BrandIconMagna from './components/EnergyIcons/BrandIconMagna.svg';
|
|
8
|
+
import BrandIconMasterCard from './components/EnergyIcons/BrandIconMasterCard.svg';
|
|
9
|
+
import BrandIconMercadoPago from './components/EnergyIcons/BrandIconMercadoPago.svg';
|
|
10
|
+
import BrandIconPlusPago from './components/EnergyIcons/BrandIconPlusPago.svg';
|
|
11
|
+
import BrandIconRedcompra from './components/EnergyIcons/BrandIconRedcompra.svg';
|
|
12
|
+
import BrandIconTapp from './components/EnergyIcons/BrandIconTapp.svg';
|
|
13
|
+
import BrandIconTbk from './components/EnergyIcons/BrandIconTbk.svg';
|
|
14
|
+
import BrandIconVisa from './components/EnergyIcons/BrandIconVisa.svg';
|
|
15
|
+
import BrandIconWebpayOneClick from './components/EnergyIcons/BrandIconWebpayOneClick.svg';
|
|
3
16
|
import EnergyIconArrowBack from './components/EnergyIcons/EnergyIconArrowBack.svg';
|
|
4
17
|
import EnergyIconCamera from './components/EnergyIcons/EnergyIconCamera.svg';
|
|
5
18
|
import EnergyIconCar from './components/EnergyIcons/EnergyIconCar.svg';
|
|
19
|
+
import EnergyIconCarbonFootprint from './components/EnergyIcons/EnergyIconCarbonFootprint.svg';
|
|
6
20
|
import EnergyIconCart from './components/EnergyIcons/EnergyIconCart.svg';
|
|
7
21
|
import EnergyIconChartPie from './components/EnergyIcons/EnergyIconChartPie.svg';
|
|
8
22
|
import EnergyIconCheckCircle from './components/EnergyIcons/EnergyIconCheckCircle.svg';
|
|
23
|
+
import EnergyIconConsumption from './components/EnergyIcons/EnergyIconConsumption.svg';
|
|
9
24
|
import EnergyIconDelete from './components/EnergyIcons/EnergyIconDelete.svg';
|
|
10
25
|
import EnergyIconDeleteOutline from './components/EnergyIcons/EnergyIconDeleteOutline.svg';
|
|
11
26
|
import EnergyIconDeleteVariant from './components/EnergyIcons/EnergyIconDeleteVariant.svg';
|
|
@@ -20,19 +35,6 @@ import EnergyIconMyLocation from './components/EnergyIcons/EnergyIconMyLocation.
|
|
|
20
35
|
import EnergyIconSettings from './components/EnergyIcons/EnergyIconSettings.svg';
|
|
21
36
|
import EnergyIconShare from './components/EnergyIcons/EnergyIconShare.svg';
|
|
22
37
|
import EnergyIconTruck from './components/EnergyIcons/EnergyIconTruck.svg';
|
|
23
|
-
import BrandIconAmex from './components/EnergyIcons/BrandIconAmex.svg';
|
|
24
|
-
import BrandIconBancoEstado from './components/EnergyIcons/BrandIconBancoEstado.svg';
|
|
25
|
-
import BrandIconDiners from './components/EnergyIcons/BrandIconDiners.svg';
|
|
26
|
-
import BrandIconMacro from './components/EnergyIcons/BrandIconMacro.svg';
|
|
27
|
-
import BrandIconMagna from './components/EnergyIcons/BrandIconMagna.svg';
|
|
28
|
-
import BrandIconMasterCard from './components/EnergyIcons/BrandIconMasterCard.svg';
|
|
29
|
-
import BrandIconMercadoPago from './components/EnergyIcons/BrandIconMercadoPago.svg';
|
|
30
|
-
import BrandIconPlusPago from './components/EnergyIcons/BrandIconPlusPago.svg';
|
|
31
|
-
import BrandIconRedcompra from './components/EnergyIcons/BrandIconRedcompra.svg';
|
|
32
|
-
import BrandIconTapp from './components/EnergyIcons/BrandIconTapp.svg';
|
|
33
|
-
import BrandIconTbk from './components/EnergyIcons/BrandIconTbk.svg';
|
|
34
|
-
import BrandIconVisa from './components/EnergyIcons/BrandIconVisa.svg';
|
|
35
|
-
import BrandIconWebpayOneClick from './components/EnergyIcons/BrandIconWebpayOneClick.svg';
|
|
36
38
|
|
|
37
39
|
export const DEFAULT_PROPS = {
|
|
38
40
|
color: COLOR_THEMES.dark
|
|
@@ -41,12 +43,27 @@ export const DEFAULT_PROPS = {
|
|
|
41
43
|
export const DEFAULT_INTERNAL_SHADE = COLOR_SHADES.shade02;
|
|
42
44
|
|
|
43
45
|
export const ENERGY_ICONS = {
|
|
46
|
+
BrandIconAmex,
|
|
47
|
+
BrandIconBancoEstado,
|
|
48
|
+
BrandIconDiners,
|
|
49
|
+
BrandIconMacro,
|
|
50
|
+
BrandIconMagna,
|
|
51
|
+
BrandIconMasterCard,
|
|
52
|
+
BrandIconMercadoPago,
|
|
53
|
+
BrandIconPlusPago,
|
|
54
|
+
BrandIconRedcompra,
|
|
55
|
+
BrandIconTapp,
|
|
56
|
+
BrandIconTbk,
|
|
57
|
+
BrandIconVisa,
|
|
58
|
+
BrandIconWebpayOneClick,
|
|
44
59
|
EnergyIconArrowBack,
|
|
45
60
|
EnergyIconCamera,
|
|
46
61
|
EnergyIconCar,
|
|
62
|
+
EnergyIconCarbonFootprint,
|
|
47
63
|
EnergyIconCart,
|
|
48
64
|
EnergyIconChartPie,
|
|
49
65
|
EnergyIconCheckCircle,
|
|
66
|
+
EnergyIconConsumption,
|
|
50
67
|
EnergyIconDelete,
|
|
51
68
|
EnergyIconDeleteOutline,
|
|
52
69
|
EnergyIconDeleteVariant,
|
|
@@ -60,18 +77,5 @@ export const ENERGY_ICONS = {
|
|
|
60
77
|
EnergyIconMyLocation,
|
|
61
78
|
EnergyIconSettings,
|
|
62
79
|
EnergyIconShare,
|
|
63
|
-
EnergyIconTruck
|
|
64
|
-
BrandIconAmex,
|
|
65
|
-
BrandIconBancoEstado,
|
|
66
|
-
BrandIconDiners,
|
|
67
|
-
BrandIconMacro,
|
|
68
|
-
BrandIconMagna,
|
|
69
|
-
BrandIconMasterCard,
|
|
70
|
-
BrandIconMercadoPago,
|
|
71
|
-
BrandIconPlusPago,
|
|
72
|
-
BrandIconRedcompra,
|
|
73
|
-
BrandIconTapp,
|
|
74
|
-
BrandIconTbk,
|
|
75
|
-
BrandIconVisa,
|
|
76
|
-
BrandIconWebpayOneClick
|
|
80
|
+
EnergyIconTruck
|
|
77
81
|
};
|
|
@@ -15,6 +15,7 @@ const UTIcon = ({
|
|
|
15
15
|
colorTheme = 'dark',
|
|
16
16
|
fillShade,
|
|
17
17
|
fillTheme,
|
|
18
|
+
iconStyles,
|
|
18
19
|
name,
|
|
19
20
|
shade,
|
|
20
21
|
size,
|
|
@@ -31,6 +32,7 @@ const UTIcon = ({
|
|
|
31
32
|
colorTheme,
|
|
32
33
|
fillShade,
|
|
33
34
|
fillTheme,
|
|
35
|
+
iconStyles,
|
|
34
36
|
name,
|
|
35
37
|
shade,
|
|
36
38
|
size,
|
|
@@ -62,6 +64,7 @@ UTIcon.propTypes = {
|
|
|
62
64
|
colorTheme: string,
|
|
63
65
|
fillShade: string,
|
|
64
66
|
fillTheme: string,
|
|
67
|
+
iconStyles: object,
|
|
65
68
|
name: string,
|
|
66
69
|
shade: string,
|
|
67
70
|
size: oneOfType([number, string]),
|
|
@@ -3,7 +3,17 @@ import { retrieveColor } from './theme';
|
|
|
3
3
|
|
|
4
4
|
export const isUTIcon = icon => typeof icon === 'string';
|
|
5
5
|
|
|
6
|
-
export const getIconProps = ({
|
|
6
|
+
export const getIconProps = ({
|
|
7
|
+
color,
|
|
8
|
+
colorTheme,
|
|
9
|
+
fillShade,
|
|
10
|
+
fillTheme,
|
|
11
|
+
iconStyles,
|
|
12
|
+
name,
|
|
13
|
+
shade,
|
|
14
|
+
size,
|
|
15
|
+
theme
|
|
16
|
+
}) => {
|
|
7
17
|
const themeColor = retrieveColor({ colorTheme: color || colorTheme, theme, shade });
|
|
8
18
|
const filled = name.endsWith('Filled');
|
|
9
19
|
const isEnergyIcon = name.startsWith('Energy');
|
|
@@ -19,7 +29,7 @@ export const getIconProps = ({ color, colorTheme, fillShade, fillTheme, name, sh
|
|
|
19
29
|
};
|
|
20
30
|
|
|
21
31
|
return {
|
|
22
|
-
style: [filled && { color: themeColor }],
|
|
32
|
+
style: [filled && { color: themeColor }, iconStyles],
|
|
23
33
|
...(internalFill && { fill: internalFill }),
|
|
24
34
|
...(isEnergyIcon || isBrandIcon ? customIconProps : defaultIconProps)
|
|
25
35
|
};
|
package/package.json
CHANGED