@widergy/mobile-ui 1.8.0 → 1.8.2
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/UTTopbar/index.js +2 -0
- package/lib/components/UTTracker/components/Connector/index.js +30 -0
- package/lib/components/UTTracker/components/Connector/styles.js +29 -0
- package/lib/components/UTTracker/components/Step/index.js +16 -22
- package/lib/components/UTTracker/components/Step/styles.js +12 -6
- package/lib/components/UTTracker/index.js +15 -16
- package/lib/components/UTTracker/propTypes.js +2 -2
- package/lib/components/UTWorkflowContainer/versions/V1/index.js +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.8.2](https://github.com/widergy/mobile-ui/compare/v1.8.1...v1.8.2) (2024-05-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* uttracker dashes ([#281](https://github.com/widergy/mobile-ui/issues/281)) ([d676fc2](https://github.com/widergy/mobile-ui/commit/d676fc24a4301779bc091cffe54f69bee375a8a8))
|
|
7
|
+
|
|
8
|
+
## [1.8.1](https://github.com/widergy/mobile-ui/compare/v1.8.0...v1.8.1) (2024-05-09)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* safeareaview for utworkflowcontainer ([#283](https://github.com/widergy/mobile-ui/issues/283)) ([f3bcac4](https://github.com/widergy/mobile-ui/commit/f3bcac45899d6859800264ce7e24c4f09d65ebea))
|
|
14
|
+
|
|
1
15
|
# [1.8.0](https://github.com/widergy/mobile-ui/compare/v1.7.0...v1.8.0) (2024-05-07)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -24,6 +24,7 @@ const UTTopbar = ({
|
|
|
24
24
|
|
|
25
25
|
const ownTheme = theme.UTWorkflowContainer?.topbar?.[colorTheme];
|
|
26
26
|
|
|
27
|
+
// If you are trying to render this in the example of mobile-ui, comment this useFocusEffect block or it will crash
|
|
27
28
|
useFocusEffect(
|
|
28
29
|
useCallback(() => {
|
|
29
30
|
const onBackPress = () => {
|
|
@@ -36,6 +37,7 @@ const UTTopbar = ({
|
|
|
36
37
|
return () => subscription.remove();
|
|
37
38
|
}, [goBack])
|
|
38
39
|
);
|
|
40
|
+
// up to here
|
|
39
41
|
|
|
40
42
|
return (
|
|
41
43
|
<View>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { bool, number } from 'prop-types';
|
|
4
|
+
import merge from 'lodash/merge';
|
|
5
|
+
import { ViewPropTypes } from 'deprecated-react-native-prop-types';
|
|
6
|
+
|
|
7
|
+
import { IS_IOS } from '../../../../utils/platformUtils/constants';
|
|
8
|
+
|
|
9
|
+
import ownStyles from './styles';
|
|
10
|
+
|
|
11
|
+
const Connector = ({ currentPosition = 0, first, nextPosition = 0, style }) => {
|
|
12
|
+
const themedStyles = merge({}, ownStyles, style);
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<View
|
|
16
|
+
style={[themedStyles.wrapper(currentPosition, first, nextPosition), IS_IOS && themedStyles.wrapperIOS]}
|
|
17
|
+
>
|
|
18
|
+
<View style={[themedStyles.connector, IS_IOS && themedStyles.connectorIOS]} />
|
|
19
|
+
</View>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
Connector.propTypes = {
|
|
24
|
+
currentPosition: number,
|
|
25
|
+
first: bool,
|
|
26
|
+
nextPosition: number,
|
|
27
|
+
style: ViewPropTypes.style
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default Connector;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import { OVAL_SIZE } from '../../styles';
|
|
4
|
+
|
|
5
|
+
export default StyleSheet.create({
|
|
6
|
+
connector: {
|
|
7
|
+
borderColor: 'gray',
|
|
8
|
+
borderLeftWidth: 2,
|
|
9
|
+
borderStyle: 'dashed',
|
|
10
|
+
flexGrow: 1
|
|
11
|
+
},
|
|
12
|
+
connectorIOS: {
|
|
13
|
+
borderWidth: 2,
|
|
14
|
+
margin: -3,
|
|
15
|
+
marginLeft: 0,
|
|
16
|
+
flex: 1
|
|
17
|
+
},
|
|
18
|
+
wrapper: (currentPosition, first, nextPosition) => ({
|
|
19
|
+
height: nextPosition - currentPosition - OVAL_SIZE - (first ? 5 : 0) - 10,
|
|
20
|
+
paddingLeft: OVAL_SIZE / 2 - 1,
|
|
21
|
+
position: 'absolute',
|
|
22
|
+
top: currentPosition + OVAL_SIZE + (first ? 5 : 0) + 5,
|
|
23
|
+
width: 2
|
|
24
|
+
}),
|
|
25
|
+
wrapperIOS: {
|
|
26
|
+
overflow: 'hidden',
|
|
27
|
+
width: OVAL_SIZE
|
|
28
|
+
}
|
|
29
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
|
-
import { bool, func } from 'prop-types';
|
|
3
|
+
import { bool, func, number } from 'prop-types';
|
|
4
4
|
import merge from 'lodash/merge';
|
|
5
5
|
|
|
6
6
|
import Label from '../../../Label';
|
|
@@ -12,30 +12,25 @@ import ownStyles, { ownVariantStyles } from './styles';
|
|
|
12
12
|
|
|
13
13
|
const ERROR_ICON_SIZE = 16;
|
|
14
14
|
|
|
15
|
-
const Step = ({
|
|
16
|
-
first,
|
|
17
|
-
isActive,
|
|
18
|
-
isCompleted,
|
|
19
|
-
last,
|
|
20
|
-
setFirstStepPosition,
|
|
21
|
-
setLastStepPosition,
|
|
22
|
-
step,
|
|
23
|
-
style = {},
|
|
24
|
-
variant
|
|
25
|
-
}) => {
|
|
15
|
+
const Step = ({ first, index, isActive, isCompleted, setStepsPositions, step, style = {}, variant }) => {
|
|
26
16
|
const stepCompleted = isCompleted(step.id);
|
|
27
17
|
const stepActive = isActive(step.id);
|
|
28
18
|
|
|
29
19
|
const themedStyles = merge({}, ownStyles, ownVariantStyles[variant], style[variant]);
|
|
30
|
-
|
|
31
20
|
const [stepIconOffset, setStepIconOffset] = useState(0);
|
|
21
|
+
const [currentPosition, setCurrentPosition] = useState(0);
|
|
22
|
+
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
setStepsPositions(prev => {
|
|
25
|
+
const newPrev = [...prev];
|
|
26
|
+
newPrev[index] = currentPosition + stepIconOffset;
|
|
27
|
+
return newPrev;
|
|
28
|
+
});
|
|
29
|
+
}, [stepIconOffset, currentPosition, setCurrentPosition, index, setStepsPositions]);
|
|
32
30
|
|
|
33
31
|
return (
|
|
34
32
|
<View
|
|
35
|
-
onLayout={e =>
|
|
36
|
-
if (first) setFirstStepPosition(e.nativeEvent.layout.y + stepIconOffset);
|
|
37
|
-
if (last) setLastStepPosition(e.nativeEvent.layout.y + stepIconOffset);
|
|
38
|
-
}}
|
|
33
|
+
onLayout={e => setCurrentPosition(e.nativeEvent.layout.y)}
|
|
39
34
|
style={[
|
|
40
35
|
themedStyles.outerContainer,
|
|
41
36
|
stepCompleted && themedStyles.completedOuterContainer,
|
|
@@ -44,7 +39,7 @@ const Step = ({
|
|
|
44
39
|
]}
|
|
45
40
|
>
|
|
46
41
|
<View
|
|
47
|
-
onLayout={e =>
|
|
42
|
+
onLayout={e => setStepIconOffset(e.nativeEvent.layout.y)}
|
|
48
43
|
style={[
|
|
49
44
|
themedStyles.container,
|
|
50
45
|
stepCompleted && themedStyles.completedContainer,
|
|
@@ -102,11 +97,10 @@ const Step = ({
|
|
|
102
97
|
|
|
103
98
|
Step.propTypes = {
|
|
104
99
|
first: bool,
|
|
100
|
+
index: number,
|
|
105
101
|
isActive: func,
|
|
106
102
|
isCompleted: func,
|
|
107
|
-
|
|
108
|
-
setFirstStepPosition: func,
|
|
109
|
-
setLastStepPosition: func,
|
|
103
|
+
setStepsPositions: func,
|
|
110
104
|
step: StepPropTypes,
|
|
111
105
|
variant: VariantPropTypes
|
|
112
106
|
};
|
|
@@ -14,12 +14,15 @@ export const ownVariantStyles = {
|
|
|
14
14
|
},
|
|
15
15
|
activeTitleColor: 'red',
|
|
16
16
|
completedContainer: {
|
|
17
|
-
borderColor: '
|
|
17
|
+
borderColor: 'red'
|
|
18
18
|
},
|
|
19
19
|
completedInnerContainer: {
|
|
20
|
-
backgroundColor: '
|
|
20
|
+
backgroundColor: 'red'
|
|
21
|
+
},
|
|
22
|
+
completedOuterContainer: {
|
|
23
|
+
opacity: 0.5
|
|
21
24
|
},
|
|
22
|
-
completedTitleColor: '
|
|
25
|
+
completedTitleColor: 'red'
|
|
23
26
|
},
|
|
24
27
|
[STANDARD]: {
|
|
25
28
|
activeContainer: {
|
|
@@ -30,12 +33,15 @@ export const ownVariantStyles = {
|
|
|
30
33
|
},
|
|
31
34
|
activeTitleColor: 'blue',
|
|
32
35
|
completedContainer: {
|
|
33
|
-
borderColor: '
|
|
36
|
+
borderColor: 'blue'
|
|
34
37
|
},
|
|
35
38
|
completedInnerContainer: {
|
|
36
|
-
backgroundColor: '
|
|
39
|
+
backgroundColor: 'blue'
|
|
40
|
+
},
|
|
41
|
+
completedOuterContainer: {
|
|
42
|
+
opacity: 0.5
|
|
37
43
|
},
|
|
38
|
-
completedTitleColor: '
|
|
44
|
+
completedTitleColor: 'blue'
|
|
39
45
|
}
|
|
40
46
|
};
|
|
41
47
|
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React, { Fragment, useState } from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
3
|
import merge from 'lodash/merge';
|
|
4
|
-
import { number, string } from 'prop-types';
|
|
4
|
+
import { number, object, string } from 'prop-types';
|
|
5
5
|
import Collapsible from 'react-native-collapsible';
|
|
6
|
-
import { ViewPropTypes } from 'deprecated-react-native-prop-types';
|
|
7
6
|
|
|
8
7
|
import Icon from '../Icon';
|
|
9
8
|
import Touchable from '../Touchable';
|
|
@@ -12,7 +11,7 @@ import { useTheme } from '../../theming';
|
|
|
12
11
|
|
|
13
12
|
import ownStyles, { DETAILS_ICON_CARD_SIZE, DETAILS_ICON_FLAT_SIZE, ownModeStyles } from './styles';
|
|
14
13
|
import Step from './components/Step';
|
|
15
|
-
import
|
|
14
|
+
import Connector from './components/Connector';
|
|
16
15
|
import SubStep from './components/SubStep';
|
|
17
16
|
import { DetailsTabPropTypes, ModePropTypes, StepsPropTypes, VariantPropTypes } from './propTypes';
|
|
18
17
|
import { CARD, FLAT, STANDARD } from './constants';
|
|
@@ -21,11 +20,8 @@ const UTTracker = ({ currentStep, detailsTab, mode = CARD, steps, style, title,
|
|
|
21
20
|
const theme = useTheme();
|
|
22
21
|
const themedStyles = merge({}, ownStyles, ownModeStyles[mode], theme.UTTracker, style);
|
|
23
22
|
|
|
24
|
-
const [stepperHeight, setStepperHeight] = useState(0);
|
|
25
|
-
const [lastStepPosition, setLastStepPosition] = useState(0);
|
|
26
|
-
const [firstStepPosition, setFirstStepPosition] = useState(0);
|
|
27
|
-
|
|
28
23
|
const [isCollapsed, setIsCollapsed] = useState(true);
|
|
24
|
+
const [stepsPositions, setStepsPositions] = useState([]);
|
|
29
25
|
|
|
30
26
|
const isCompleted = stepNumber => stepNumber < currentStep;
|
|
31
27
|
const isActive = stepNumber => stepNumber === currentStep;
|
|
@@ -57,22 +53,17 @@ const UTTracker = ({ currentStep, detailsTab, mode = CARD, steps, style, title,
|
|
|
57
53
|
</Touchable>
|
|
58
54
|
)}
|
|
59
55
|
{steps && (
|
|
60
|
-
<View
|
|
61
|
-
<Connectors
|
|
62
|
-
style={themedStyles.connectors}
|
|
63
|
-
{...{ firstStepPosition, lastStepPosition, stepperHeight }}
|
|
64
|
-
/>
|
|
56
|
+
<View>
|
|
65
57
|
{steps.map((step, index) => (
|
|
66
58
|
<Fragment key={step.id}>
|
|
67
59
|
<Step
|
|
68
60
|
first={index === 0}
|
|
69
|
-
last={index === steps.length - 1}
|
|
70
61
|
style={themedStyles.step}
|
|
71
62
|
{...{
|
|
63
|
+
index,
|
|
72
64
|
isActive,
|
|
73
65
|
isCompleted,
|
|
74
|
-
|
|
75
|
-
setLastStepPosition,
|
|
66
|
+
setStepsPositions,
|
|
76
67
|
step,
|
|
77
68
|
variant
|
|
78
69
|
}}
|
|
@@ -83,6 +74,13 @@ const UTTracker = ({ currentStep, detailsTab, mode = CARD, steps, style, title,
|
|
|
83
74
|
<SubStep key={subStep.id} {...subStep} style={themedStyles.subStep} />
|
|
84
75
|
))}
|
|
85
76
|
</Collapsible>
|
|
77
|
+
{index !== steps.length - 1 && (
|
|
78
|
+
<Connector
|
|
79
|
+
currentPosition={stepsPositions[index]}
|
|
80
|
+
first={index === 0}
|
|
81
|
+
nextPosition={stepsPositions[index + 1]}
|
|
82
|
+
/>
|
|
83
|
+
)}
|
|
86
84
|
</Fragment>
|
|
87
85
|
))}
|
|
88
86
|
</View>
|
|
@@ -112,7 +110,8 @@ UTTracker.propTypes = {
|
|
|
112
110
|
detailsTab: DetailsTabPropTypes,
|
|
113
111
|
mode: ModePropTypes,
|
|
114
112
|
steps: StepsPropTypes,
|
|
115
|
-
|
|
113
|
+
// eslint-disable-next-line react/forbid-prop-types
|
|
114
|
+
style: object,
|
|
116
115
|
title: string,
|
|
117
116
|
variant: VariantPropTypes
|
|
118
117
|
};
|
|
@@ -2,11 +2,11 @@ import { arrayOf, bool, number, oneOf, shape, string } from 'prop-types';
|
|
|
2
2
|
|
|
3
3
|
import { CARD, ERROR, FLAT, STANDARD } from './constants';
|
|
4
4
|
|
|
5
|
-
export const
|
|
5
|
+
export const SubStepPropTypes = shape({ id: number, subtitle: string, title: string });
|
|
6
6
|
|
|
7
7
|
export const StepPropTypes = shape({
|
|
8
8
|
id: number,
|
|
9
|
-
subSteps: arrayOf(
|
|
9
|
+
subSteps: arrayOf(SubStepPropTypes),
|
|
10
10
|
subtitle: string,
|
|
11
11
|
title: string
|
|
12
12
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { SafeAreaView, ScrollView } from 'react-native';
|
|
3
3
|
import { number, func, shape, bool, string, element } from 'prop-types';
|
|
4
4
|
import { merge } from 'lodash';
|
|
5
5
|
|
|
@@ -40,7 +40,7 @@ const UTWorkflowContainer = ({
|
|
|
40
40
|
const themedStyles = merge({}, ownStyles, theme?.UTWorkflowContainer, style);
|
|
41
41
|
|
|
42
42
|
return (
|
|
43
|
-
<
|
|
43
|
+
<SafeAreaView style={themedStyles.container}>
|
|
44
44
|
{topbar && <UTTopbar {...{ currentStage, currentStep, stages, stepsCount, theme, topbar }} />}
|
|
45
45
|
<ScrollView contentContainerStyle={themedStyles.content}>
|
|
46
46
|
{title && (
|
|
@@ -70,7 +70,7 @@ const UTWorkflowContainer = ({
|
|
|
70
70
|
}}
|
|
71
71
|
/>
|
|
72
72
|
)}
|
|
73
|
-
</
|
|
73
|
+
</SafeAreaView>
|
|
74
74
|
);
|
|
75
75
|
};
|
|
76
76
|
UTWorkflowContainer.propTypes = {
|
package/package.json
CHANGED