@widergy/mobile-ui 1.51.0 → 2.0.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 +18 -0
- package/lib/components/Carousel/components/CarouselContainer/index.js +5 -3
- package/lib/components/FilePicker/constants.js +1 -4
- package/lib/components/FilePicker/index.js +33 -17
- package/lib/components/ImagePicker/ModalSelectionOption/index.js +14 -2
- package/lib/components/ImagePicker/index.js +5 -1
- package/lib/components/ImagePicker/layout.js +65 -5
- package/lib/components/MultipleFilePicker/index.js +275 -35
- package/lib/components/MultipleFilePicker/propTypes.js +16 -1
- package/lib/components/MultipleFilePicker/utils.js +44 -13
- package/lib/components/Overlay/index.js +8 -3
- package/lib/components/PhotoAlbum/index.js +28 -4
- package/lib/components/RateChart/components/RateStagesGraph/components/Bars/index.js +5 -4
- package/lib/components/UTActionCard/components/Header/index.js +1 -0
- package/lib/components/UTActionCard/components/Header/utils.js +4 -1
- package/lib/components/UTCheckBox/index.js +3 -15
- package/lib/components/UTCheckBox/theme.js +4 -18
- package/lib/components/UTCheckList/index.js +11 -7
- package/lib/components/UTDetailDrawer/index.js +4 -4
- package/lib/components/UTIcon/index.js +0 -1
- package/lib/components/UTIcon/utils.js +3 -3
- package/lib/components/UTModal/index.js +2 -0
- package/lib/components/UTRating/index.js +4 -3
- package/lib/components/UTRating/styles.js +3 -1
- package/lib/components/UTTabs/index.js +14 -6
- package/lib/components/UTTabs/styles.js +51 -19
- package/lib/components/UTTopbar/index.js +3 -5
- package/lib/components/UTTracker/components/Step/styles.js +8 -4
- package/lib/components/UTWorkflowContainer/versions/V1/index.js +19 -4
- package/lib/reactotronConfig.js +36 -3
- package/lib/utils/fileUtils.js/index.js +15 -10
- package/package.json +12 -10
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import React, { useCallback } from 'react';
|
|
1
|
+
import React, { useCallback, useEffect } from 'react';
|
|
2
2
|
import { BackHandler, View } from 'react-native';
|
|
3
3
|
import { number } from 'prop-types';
|
|
4
|
-
import { useFocusEffect } from '@react-navigation/native';
|
|
5
4
|
|
|
6
5
|
import { TEST_IDS } from '../../constants/testIds';
|
|
7
6
|
import UTButton from '../UTButton';
|
|
@@ -25,8 +24,8 @@ const UTTopbar = ({
|
|
|
25
24
|
}) => {
|
|
26
25
|
const ownTheme = theme.UTWorkflowContainer?.topbar?.[colorTheme];
|
|
27
26
|
|
|
28
|
-
//
|
|
29
|
-
|
|
27
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
28
|
+
useEffect(
|
|
30
29
|
useCallback(() => {
|
|
31
30
|
const onBackPress = () => {
|
|
32
31
|
goBack();
|
|
@@ -38,7 +37,6 @@ const UTTopbar = ({
|
|
|
38
37
|
return () => subscription.remove();
|
|
39
38
|
}, [goBack])
|
|
40
39
|
);
|
|
41
|
-
// up to here
|
|
42
40
|
|
|
43
41
|
return (
|
|
44
42
|
<View>
|
|
@@ -10,13 +10,15 @@ export const getVariantStyles = theme => ({
|
|
|
10
10
|
borderColor: theme.Palette.error['04']
|
|
11
11
|
},
|
|
12
12
|
activeInnerContainer: {
|
|
13
|
-
backgroundColor: theme.Palette.error['04']
|
|
13
|
+
backgroundColor: theme.Palette.error['04'],
|
|
14
|
+
borderRadius: OVAL_SIZE / 4
|
|
14
15
|
},
|
|
15
16
|
completedContainer: {
|
|
16
17
|
borderColor: theme.Palette.error['04']
|
|
17
18
|
},
|
|
18
19
|
completedInnerContainer: {
|
|
19
|
-
backgroundColor: theme.Palette.error['04']
|
|
20
|
+
backgroundColor: theme.Palette.error['04'],
|
|
21
|
+
borderRadius: OVAL_SIZE / 4
|
|
20
22
|
}
|
|
21
23
|
},
|
|
22
24
|
[STANDARD]: {
|
|
@@ -24,13 +26,15 @@ export const getVariantStyles = theme => ({
|
|
|
24
26
|
borderColor: theme.Palette.accent['04']
|
|
25
27
|
},
|
|
26
28
|
activeInnerContainer: {
|
|
27
|
-
backgroundColor: theme.Palette.accent['04']
|
|
29
|
+
backgroundColor: theme.Palette.accent['04'],
|
|
30
|
+
borderRadius: OVAL_SIZE / 4
|
|
28
31
|
},
|
|
29
32
|
completedContainer: {
|
|
30
33
|
borderColor: theme.Palette.accent['04']
|
|
31
34
|
},
|
|
32
35
|
completedInnerContainer: {
|
|
33
|
-
backgroundColor: theme.Palette.accent['04']
|
|
36
|
+
backgroundColor: theme.Palette.accent['04'],
|
|
37
|
+
borderRadius: OVAL_SIZE / 4
|
|
34
38
|
}
|
|
35
39
|
}
|
|
36
40
|
});
|
|
@@ -2,7 +2,6 @@ import React, { useEffect, useState } from 'react';
|
|
|
2
2
|
import { ScrollView, View, KeyboardAvoidingView, Keyboard } from 'react-native';
|
|
3
3
|
import { number, func, shape, bool, string, element, oneOfType, any, objectOf } from 'prop-types';
|
|
4
4
|
import { merge } from 'lodash';
|
|
5
|
-
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
6
5
|
|
|
7
6
|
import { useTheme } from '../../../../theming';
|
|
8
7
|
import UTHeader from '../../../UTHeader';
|
|
@@ -17,6 +16,15 @@ import BottomActions from './components/BottomActions';
|
|
|
17
16
|
import ActionButtonPropTypes from './components/BottomActions/components/ActionButton/types';
|
|
18
17
|
import { MessagePropTypes, SummaryPropTypes } from './types';
|
|
19
18
|
|
|
19
|
+
let useSafeAreaInsets;
|
|
20
|
+
try {
|
|
21
|
+
// eslint-disable-next-line no-eval, global-require
|
|
22
|
+
const safeArea = require('react-native-safe-area-context');
|
|
23
|
+
useSafeAreaInsets = safeArea?.useSafeAreaInsets;
|
|
24
|
+
} catch (e) {
|
|
25
|
+
useSafeAreaInsets = undefined;
|
|
26
|
+
}
|
|
27
|
+
|
|
20
28
|
const UTWorkflowContainer = ({
|
|
21
29
|
banner,
|
|
22
30
|
children,
|
|
@@ -39,9 +47,10 @@ const UTWorkflowContainer = ({
|
|
|
39
47
|
title,
|
|
40
48
|
topbar,
|
|
41
49
|
useMarkdown,
|
|
42
|
-
wizardConfig
|
|
50
|
+
wizardConfig,
|
|
51
|
+
topSafeAreaDisabled = false
|
|
43
52
|
}) => {
|
|
44
|
-
const { bottom: bottomSafeArea, top: topSafeArea } = useSafeAreaInsets();
|
|
53
|
+
const { bottom: bottomSafeArea, top: topSafeArea } = useSafeAreaInsets?.() || {};
|
|
45
54
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
46
55
|
useEffect(() => () => onExit?.(), []);
|
|
47
56
|
|
|
@@ -65,7 +74,12 @@ const UTWorkflowContainer = ({
|
|
|
65
74
|
|
|
66
75
|
return (
|
|
67
76
|
<KeyboardAvoidingView behavior={IS_IOS ? 'padding' : ''} style={themedStyles.layoutContainer}>
|
|
68
|
-
<View
|
|
77
|
+
<View
|
|
78
|
+
style={[
|
|
79
|
+
themedStyles.container,
|
|
80
|
+
topbar && !topSafeAreaDisabled && themedStyles.topSafeArea(topSafeArea)
|
|
81
|
+
]}
|
|
82
|
+
>
|
|
69
83
|
{topbar && <UTTopbar {...{ currentStage, currentStep, stages, stepsCount, theme, topbar }} />}
|
|
70
84
|
<ScrollView
|
|
71
85
|
contentContainerStyle={themedStyles.content}
|
|
@@ -129,6 +143,7 @@ UTWorkflowContainer.propTypes = {
|
|
|
129
143
|
tagline: string,
|
|
130
144
|
title: oneOfType([string, element]),
|
|
131
145
|
topbar: TopbarPropTypes,
|
|
146
|
+
topSafeAreaDisabled: bool,
|
|
132
147
|
useMarkdown: bool,
|
|
133
148
|
wizardConfig: shape({
|
|
134
149
|
variant: string,
|
package/lib/reactotronConfig.js
CHANGED
|
@@ -1,7 +1,40 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable import/no-extraneous-dependencies */
|
|
2
|
+
/*
|
|
3
|
+
Reactotron opcional: no importamos el paquete directamente para evitar fallos
|
|
4
|
+
cuando no está instalado en el consumidor. Si el consumidor quiere usarlo,
|
|
5
|
+
puede exponer una instancia en un global llamado REACTOTRON antes de cargar la lib.
|
|
6
|
+
*/
|
|
2
7
|
|
|
3
|
-
const configureReactotron =
|
|
4
|
-
|
|
8
|
+
const configureReactotron = host => {
|
|
9
|
+
let g;
|
|
10
|
+
if (typeof global !== 'undefined') g = global;
|
|
11
|
+
else if (typeof window !== 'undefined') g = window;
|
|
12
|
+
const Reactotron = g && g.REACTOTRON ? g.REACTOTRON : null;
|
|
13
|
+
|
|
14
|
+
if (!Reactotron) {
|
|
15
|
+
if (typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
16
|
+
// eslint-disable-next-line no-console
|
|
17
|
+
console.log('[Reactotron] no disponible; se omite configuración');
|
|
18
|
+
}
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const config = host ? { host } : undefined;
|
|
22
|
+
Reactotron.configure(config).useReactNative().connect();
|
|
23
|
+
if (typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
24
|
+
// Limpia la timeline y deja un rastro en consola/Reactotron
|
|
25
|
+
try {
|
|
26
|
+
Reactotron.clear?.();
|
|
27
|
+
} catch (err) {
|
|
28
|
+
// noop
|
|
29
|
+
}
|
|
30
|
+
// eslint-disable-next-line no-console
|
|
31
|
+
console.log(`[Reactotron] connect -> host=${host ?? 'default'}`);
|
|
32
|
+
try {
|
|
33
|
+
Reactotron.log?.(`Reactotron connected -> host=${host ?? 'default'}`);
|
|
34
|
+
} catch (err) {
|
|
35
|
+
// noop
|
|
36
|
+
}
|
|
37
|
+
}
|
|
5
38
|
};
|
|
6
39
|
|
|
7
40
|
export default configureReactotron;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import ImageResizer from '@bam.tech/react-native-image-resizer';
|
|
1
|
+
import * as ExpoImageManipulator from 'expo-image-manipulator';
|
|
3
2
|
|
|
4
3
|
import { IS_IOS } from '../platformUtils/constants';
|
|
5
4
|
|
|
@@ -36,14 +35,20 @@ export const retrieveFile = async (uri, type) => {
|
|
|
36
35
|
let blob;
|
|
37
36
|
|
|
38
37
|
if (type ? type.includes('image') : isImageByUri(uri)) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
38
|
+
if (ExpoImageManipulator?.manipulateAsync) {
|
|
39
|
+
try {
|
|
40
|
+
const actions = [{ resize: { width: IMG_SIZE, height: IMG_SIZE } }];
|
|
41
|
+
const options = {
|
|
42
|
+
compress: IMG_QUALITY / 100,
|
|
43
|
+
format: ExpoImageManipulator?.SaveFormat?.JPEG ?? 'jpeg',
|
|
44
|
+
base64: false
|
|
45
|
+
};
|
|
46
|
+
const result = await ExpoImageManipulator.manipulateAsync(uri, actions, options);
|
|
47
|
+
blob = await uriToBlob(result.uri);
|
|
48
|
+
} catch (err) {
|
|
49
|
+
blob = await uriToBlob(uriToUse);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
47
52
|
} else {
|
|
48
53
|
blob = await uriToBlob(uriToUse);
|
|
49
54
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@widergy/mobile-ui",
|
|
3
3
|
"description": "Widergy Mobile Components",
|
|
4
4
|
"author": "widergy",
|
|
5
|
-
"version": "
|
|
5
|
+
"version": "2.0.1",
|
|
6
6
|
"repository": "https://github.com/widergy/mobile-ui.git",
|
|
7
7
|
"main": "lib/index.js",
|
|
8
8
|
"files": [
|
|
@@ -23,11 +23,9 @@
|
|
|
23
23
|
"prepare": "husky install"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@bam.tech/react-native-image-resizer": "^3.0.7",
|
|
27
26
|
"prop-types": "*",
|
|
28
27
|
"react": "*",
|
|
29
28
|
"react-native": "*",
|
|
30
|
-
"react-native-document-picker": "^9.0.1",
|
|
31
29
|
"react-native-image-picker": "^5.0.0",
|
|
32
30
|
"react-native-linear-gradient": "^2.8.3",
|
|
33
31
|
"react-native-pager-view": "^6.2.0",
|
|
@@ -35,22 +33,26 @@
|
|
|
35
33
|
"react-native-vector-icons": "^10.0.0"
|
|
36
34
|
},
|
|
37
35
|
"dependencies": {
|
|
38
|
-
"@react-native-masked-view/masked-view": "^0.3.
|
|
36
|
+
"@react-native-masked-view/masked-view": "^0.3.2",
|
|
39
37
|
"@react-navigation/native": "^6.1.9",
|
|
40
|
-
"@tabler/icons-react-native": "^3.
|
|
38
|
+
"@tabler/icons-react-native": "^3.34.1",
|
|
41
39
|
"@widergy/web-utils": "^2.0.0",
|
|
42
40
|
"core-js": "3",
|
|
43
|
-
"deprecated-react-native-prop-types": "^
|
|
41
|
+
"deprecated-react-native-prop-types": "^5.0.0",
|
|
42
|
+
"expo-document-picker": "^13.1.6",
|
|
43
|
+
"expo-image-manipulator": "^13.1.7",
|
|
44
|
+
"expo-image-picker": "^16.1.4",
|
|
45
|
+
"invariant": "^2.2.4",
|
|
44
46
|
"lodash": "^4.17.21",
|
|
45
47
|
"numeral": "^2.0.6",
|
|
46
48
|
"pdf-lib": "^1.17.1",
|
|
47
49
|
"react-native-collapsible": "^1.6.1",
|
|
48
50
|
"react-native-linear-gradient": "^2.8.3",
|
|
49
51
|
"react-native-markdown-display": "^7.0.0-alpha.2",
|
|
50
|
-
"react-native-modal": "^13.0.
|
|
51
|
-
"react-native-pager-view": "^6.
|
|
52
|
-
"react-native-safe-area-context": "^
|
|
53
|
-
"react-native-svg": "^
|
|
52
|
+
"react-native-modal": "^13.0.2",
|
|
53
|
+
"react-native-pager-view": "^6.8.0",
|
|
54
|
+
"react-native-safe-area-context": "^5.2.0",
|
|
55
|
+
"react-native-svg": "^15.11.2",
|
|
54
56
|
"react-native-uuid": "^2.0.3"
|
|
55
57
|
},
|
|
56
58
|
"devDependencies": {
|