@widergy/mobile-ui 1.0.0 → 1.2.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 +14 -0
- package/lib/components/Button/constants.js +5 -0
- package/lib/components/Button/index.js +24 -8
- package/lib/components/Button/styles.js +9 -6
- package/lib/components/Checkbox/styles.js +3 -3
- package/lib/components/Icon/assets/eye-off.svg +5 -0
- package/lib/components/Icon/assets/eye.svg +3 -0
- package/lib/components/Icon/constants.js +5 -2
- package/lib/components/Icon/index.js +15 -3
- package/lib/components/Icon/propTypes.js +3 -1
- package/lib/components/UTBanner/index.js +42 -0
- package/lib/components/UTBanner/styles.js +14 -0
- package/lib/components/UTHeader/index.js +56 -0
- package/lib/components/UTHeader/styles.js +16 -0
- package/lib/components/UTStepper/components/Connectors/index.js +33 -0
- package/lib/components/UTStepper/components/Connectors/styles.js +26 -0
- package/lib/components/UTStepper/components/Step/index.js +50 -0
- package/lib/components/UTStepper/components/Step/styles.js +47 -0
- package/lib/components/UTStepper/index.js +34 -0
- package/lib/components/UTStepper/styles.js +12 -0
- package/lib/components/UTStepper/types.js +3 -0
- package/lib/components/UTTextInput/components/BaseInput/index.js +1 -3
- package/lib/components/UTTopbar/index.js +64 -0
- package/lib/components/UTTopbar/styles.js +16 -0
- package/lib/components/UTTopbar/types.js +8 -0
- package/lib/components/UTWorkflowContainer/index.js +10 -102
- package/lib/components/UTWorkflowContainer/{components → versions/V0/components}/BottomStepHandler/index.js +4 -4
- package/lib/components/UTWorkflowContainer/{components → versions/V0/components}/BottomStepHandler/styles.js +3 -3
- package/lib/components/UTWorkflowContainer/{components → versions/V0/components}/Header/index.js +9 -9
- package/lib/components/UTWorkflowContainer/{components → versions/V0/components}/Header/styles.js +3 -3
- package/lib/components/UTWorkflowContainer/{components → versions/V0/components}/StepsHandler/components/ActionButton/index.js +2 -2
- package/lib/components/UTWorkflowContainer/{components → versions/V0/components}/StepsHandler/components/ActionButton/styles.js +12 -12
- package/lib/components/UTWorkflowContainer/{components → versions/V0/components}/StepsHandler/components/ActionButton/types.js +9 -9
- package/lib/components/UTWorkflowContainer/{components → versions/V0/components}/StepsHandler/index.js +6 -6
- package/lib/components/UTWorkflowContainer/{components → versions/V0/components}/StepsHandler/styles.js +3 -3
- package/lib/components/UTWorkflowContainer/versions/V0/index.js +108 -0
- package/lib/components/UTWorkflowContainer/{styles.js → versions/V0/styles.js} +4 -4
- package/lib/components/UTWorkflowContainer/versions/V1/components/BottomActions/components/ActionButton/index.js +35 -0
- package/lib/components/UTWorkflowContainer/versions/V1/components/BottomActions/components/ActionButton/styles.js +13 -0
- package/lib/components/UTWorkflowContainer/versions/V1/components/BottomActions/components/ActionButton/types.js +9 -0
- package/lib/components/UTWorkflowContainer/versions/V1/components/BottomActions/constants.js +2 -0
- package/lib/components/UTWorkflowContainer/versions/V1/components/BottomActions/index.js +110 -0
- package/lib/components/UTWorkflowContainer/versions/V1/components/BottomActions/styles.js +75 -0
- package/lib/components/UTWorkflowContainer/versions/V1/index.js +94 -0
- package/lib/components/UTWorkflowContainer/versions/V1/styles.js +14 -0
- package/lib/components/UTWorkflowContainer/versions/V1/types.js +24 -0
- package/package.json +1 -1
- /package/lib/components/UTWorkflowContainer/{README.md → versions/V0/README.md} +0 -0
- /package/lib/components/UTWorkflowContainer/{components → versions/V0/components}/Header/utils.js +0 -0
- /package/lib/components/UTWorkflowContainer/{components → versions/V0/components}/StepsHandler/constants.js +0 -0
- /package/lib/components/UTWorkflowContainer/{components → versions/V0/components}/StepsHandler/utils.js +0 -0
|
@@ -1,108 +1,16 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import {
|
|
3
|
-
import { View } from 'react-native';
|
|
4
|
-
import { number, func, shape, bool, string, oneOf } from 'prop-types';
|
|
5
|
-
import _ from 'lodash';
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { string } from 'prop-types';
|
|
6
3
|
|
|
7
|
-
import
|
|
8
|
-
import
|
|
4
|
+
import V0 from './versions/V0';
|
|
5
|
+
import V1 from './versions/V1';
|
|
9
6
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
import BottomStepHandler from './components/BottomStepHandler';
|
|
14
|
-
|
|
15
|
-
const UTWorkflowContainer = ({
|
|
16
|
-
stepsCount,
|
|
17
|
-
currentStep,
|
|
18
|
-
nextButton,
|
|
19
|
-
returnButton,
|
|
20
|
-
onExit,
|
|
21
|
-
hideStepCounter,
|
|
22
|
-
children,
|
|
23
|
-
styles = {},
|
|
24
|
-
title,
|
|
25
|
-
subtitle,
|
|
26
|
-
stepCounter,
|
|
27
|
-
bottomHandler,
|
|
28
|
-
hideHeader = false,
|
|
29
|
-
useMarkdown
|
|
30
|
-
}) => {
|
|
31
|
-
useEffect(() => () => onExit?.(), []);
|
|
32
|
-
const theme = useTheme();
|
|
33
|
-
|
|
34
|
-
const themedStyles = _.merge({}, ownStyles, theme?.UTWorkflowContainer, styles);
|
|
35
|
-
|
|
36
|
-
const { titleProps, subtitleProps } = themedStyles?.labelProps || {};
|
|
37
|
-
|
|
38
|
-
const Title = React.isValidElement(title) ? (
|
|
39
|
-
title
|
|
40
|
-
) : (
|
|
41
|
-
<Label big bold {...titleProps} style={themedStyles.title}>
|
|
42
|
-
{title}
|
|
43
|
-
</Label>
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
const Subtitle = React.isValidElement(subtitle) ? (
|
|
47
|
-
subtitle
|
|
48
|
-
) : (
|
|
49
|
-
<Label
|
|
50
|
-
medium
|
|
51
|
-
{...subtitleProps}
|
|
52
|
-
style={themedStyles.subtitle}
|
|
53
|
-
markdownStyles={themedStyles.markdown}
|
|
54
|
-
useMarkdown={useMarkdown}
|
|
55
|
-
>
|
|
56
|
-
{subtitle}
|
|
57
|
-
</Label>
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
return (
|
|
61
|
-
<View style={themedStyles.container}>
|
|
62
|
-
{!hideHeader && (
|
|
63
|
-
<Header
|
|
64
|
-
stepsCount={stepsCount}
|
|
65
|
-
currentStep={currentStep}
|
|
66
|
-
nextButton={nextButton}
|
|
67
|
-
returnButton={returnButton}
|
|
68
|
-
hideStepCounter={hideStepCounter}
|
|
69
|
-
themedStyles={themedStyles}
|
|
70
|
-
styles={styles}
|
|
71
|
-
stepCounter={stepCounter}
|
|
72
|
-
bottomHandler={bottomHandler}
|
|
73
|
-
/>
|
|
74
|
-
)}
|
|
75
|
-
{!!title && Title}
|
|
76
|
-
{!!subtitle && Subtitle}
|
|
77
|
-
{children}
|
|
78
|
-
{bottomHandler && (
|
|
79
|
-
<BottomStepHandler
|
|
80
|
-
stepsCount={stepsCount}
|
|
81
|
-
currentStep={currentStep}
|
|
82
|
-
styles={styles}
|
|
83
|
-
nextButton={nextButton}
|
|
84
|
-
themedStyles={themedStyles}
|
|
85
|
-
returnButton={returnButton}
|
|
86
|
-
hideStepCounter={hideStepCounter}
|
|
87
|
-
stepCounter={stepCounter}
|
|
88
|
-
/>
|
|
89
|
-
)}
|
|
90
|
-
</View>
|
|
91
|
-
);
|
|
7
|
+
const UTWorkflowContainer = ({ version = 'V0', ...props }) => {
|
|
8
|
+
const Component = { V0, V1 }[version];
|
|
9
|
+
return <Component {...props} />;
|
|
92
10
|
};
|
|
11
|
+
|
|
93
12
|
UTWorkflowContainer.propTypes = {
|
|
94
|
-
|
|
95
|
-
currentStep: number.isRequired,
|
|
96
|
-
nextButton: ActionButtonPropTypes.isRequired,
|
|
97
|
-
returnButton: ActionButtonPropTypes.isRequired,
|
|
98
|
-
onExit: func,
|
|
99
|
-
hideStepCounter: bool,
|
|
100
|
-
styles: shape(ViewPropTypes?.style),
|
|
101
|
-
title: string,
|
|
102
|
-
subtitle: string,
|
|
103
|
-
stepCounter: oneOf([func, string]),
|
|
104
|
-
bottomHandler: bool,
|
|
105
|
-
hideHeader: bool,
|
|
106
|
-
useMarkdown: bool
|
|
13
|
+
version: string
|
|
107
14
|
};
|
|
15
|
+
|
|
108
16
|
export default UTWorkflowContainer;
|
|
@@ -28,7 +28,7 @@ const BottomStepHandler = ({
|
|
|
28
28
|
nextButton={nextButton}
|
|
29
29
|
returnButton={returnButton}
|
|
30
30
|
hideStepCounter={hideStepCounter}
|
|
31
|
-
styles={{
|
|
31
|
+
styles={{ stepCounter: styles?.bottomStepCounter, stepsHandler: styles?.bottomStepHandler }}
|
|
32
32
|
themedStyles={mergedStyles}
|
|
33
33
|
stepCounter={stepCounter}
|
|
34
34
|
/>
|
|
@@ -37,13 +37,13 @@ const BottomStepHandler = ({
|
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
BottomStepHandler.propTypes = {
|
|
40
|
-
stepsCount: number.isRequired,
|
|
41
40
|
currentStep: number.isRequired,
|
|
41
|
+
hideStepCounter: bool,
|
|
42
42
|
nextButton: ActionButtonPropTypes.isRequired,
|
|
43
43
|
returnButton: ActionButtonPropTypes.isRequired,
|
|
44
|
-
hideStepCounter: bool,
|
|
45
|
-
styles: shape(ViewPropTypes?.style),
|
|
46
44
|
stepCounter: oneOf([func, string]),
|
|
45
|
+
stepsCount: number.isRequired,
|
|
46
|
+
styles: shape(ViewPropTypes?.style),
|
|
47
47
|
// eslint-disable-next-line react/forbid-prop-types
|
|
48
48
|
themedStyles: any
|
|
49
49
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
2
|
|
|
3
|
-
import { verticalScale } from '
|
|
3
|
+
import { verticalScale } from '../../../../../../utils/scaleUtils';
|
|
4
4
|
|
|
5
5
|
export const BAR_HEIGHT = verticalScale(10);
|
|
6
6
|
|
|
7
7
|
export default StyleSheet.create({
|
|
8
8
|
bottomStepContainer: {
|
|
9
9
|
alignItems: 'center',
|
|
10
|
+
marginTop: 'auto',
|
|
10
11
|
overflow: 'hidden',
|
|
11
|
-
width: '100%'
|
|
12
|
-
marginTop: 'auto'
|
|
12
|
+
width: '100%'
|
|
13
13
|
}
|
|
14
14
|
});
|
package/lib/components/UTWorkflowContainer/{components → versions/V0/components}/Header/index.js
RENAMED
|
@@ -3,7 +3,7 @@ import { ViewPropTypes } from 'deprecated-react-native-prop-types';
|
|
|
3
3
|
import { View } from 'react-native';
|
|
4
4
|
import { number, bool, shape, oneOf, func, string } from 'prop-types';
|
|
5
5
|
|
|
6
|
-
import UTProgressBar from '
|
|
6
|
+
import UTProgressBar from '../../../../../UTProgressBar';
|
|
7
7
|
import StepsHandler from '../StepsHandler';
|
|
8
8
|
import ActionButtonPropTypes from '../StepsHandler/components/ActionButton/types';
|
|
9
9
|
|
|
@@ -26,13 +26,13 @@ const Header = ({
|
|
|
26
26
|
value={getProgressValue(currentStep, stepsCount)}
|
|
27
27
|
styles={{
|
|
28
28
|
barContainer: {
|
|
29
|
-
marginTop: -BAR_HEIGHT / 2,
|
|
30
|
-
marginBottom: -BAR_HEIGHT / 2 + 25,
|
|
31
29
|
height: BAR_HEIGHT,
|
|
30
|
+
marginBottom: -BAR_HEIGHT / 2 + 25,
|
|
31
|
+
marginTop: -BAR_HEIGHT / 2,
|
|
32
32
|
...styles?.barContainer
|
|
33
33
|
},
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
borderStyle: styles?.borderStyle || UTProgressBar.BorderStyles.SLOPE,
|
|
35
|
+
progressBar: styles?.progressBar
|
|
36
36
|
}}
|
|
37
37
|
/>
|
|
38
38
|
{!bottomHandler && (
|
|
@@ -51,14 +51,14 @@ const Header = ({
|
|
|
51
51
|
);
|
|
52
52
|
|
|
53
53
|
Header.propTypes = {
|
|
54
|
-
|
|
54
|
+
bottomHandler: bool,
|
|
55
55
|
currentStep: number.isRequired,
|
|
56
|
+
hideStepCounter: bool,
|
|
56
57
|
nextButton: ActionButtonPropTypes.isRequired,
|
|
57
58
|
returnButton: ActionButtonPropTypes.isRequired,
|
|
58
|
-
hideStepCounter: bool,
|
|
59
|
-
styles: shape(ViewPropTypes?.style),
|
|
60
59
|
stepCounter: oneOf([func, string]),
|
|
61
|
-
|
|
60
|
+
stepsCount: number.isRequired,
|
|
61
|
+
styles: shape(ViewPropTypes?.style),
|
|
62
62
|
themedStyles: shape(ViewPropTypes?.style)
|
|
63
63
|
};
|
|
64
64
|
|
package/lib/components/UTWorkflowContainer/{components → versions/V0/components}/Header/styles.js
RENAMED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
2
|
|
|
3
|
-
import { verticalScale } from '
|
|
3
|
+
import { verticalScale } from '../../../../../../utils/scaleUtils';
|
|
4
4
|
|
|
5
5
|
export const BAR_HEIGHT = verticalScale(10);
|
|
6
6
|
|
|
7
7
|
export default StyleSheet.create({
|
|
8
8
|
container: {
|
|
9
9
|
alignItems: 'center',
|
|
10
|
+
marginBottom: verticalScale(30),
|
|
10
11
|
overflow: 'hidden',
|
|
11
|
-
width: '100%'
|
|
12
|
-
marginBottom: verticalScale(30)
|
|
12
|
+
width: '100%'
|
|
13
13
|
}
|
|
14
14
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Icon from 'react-native-vector-icons/AntDesign';
|
|
3
3
|
|
|
4
|
-
import Touchable from '
|
|
5
|
-
import { withTheme } from '
|
|
4
|
+
import Touchable from '../../../../../../../Touchable';
|
|
5
|
+
import { withTheme } from '../../../../../../../../theming';
|
|
6
6
|
|
|
7
7
|
import createStyles, { DEFAULT_ICON_SIZE } from './styles';
|
|
8
8
|
import ActionButtonProptypes from './types';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
2
|
|
|
3
|
-
import { horizontalScale } from '
|
|
3
|
+
import { horizontalScale } from '../../../../../../../../utils/scaleUtils';
|
|
4
4
|
|
|
5
5
|
const BUTTON_SIZE = horizontalScale(45);
|
|
6
6
|
const BORDER_WIDTH = 1.5;
|
|
@@ -8,29 +8,29 @@ export const DEFAULT_ICON_SIZE = horizontalScale(20);
|
|
|
8
8
|
|
|
9
9
|
export default theme =>
|
|
10
10
|
StyleSheet.create({
|
|
11
|
-
disabled: {
|
|
12
|
-
opacity: 0.5
|
|
13
|
-
},
|
|
14
|
-
shown: {
|
|
15
|
-
opacity: 1
|
|
16
|
-
},
|
|
17
11
|
borderless: {
|
|
18
12
|
borderWidth: 0
|
|
19
13
|
},
|
|
20
14
|
container: {
|
|
21
15
|
alignItems: 'center',
|
|
22
|
-
justifyContent: 'center',
|
|
23
|
-
padding: 10,
|
|
24
|
-
borderRadius: 100,
|
|
25
16
|
borderColor: theme.colors.primary,
|
|
17
|
+
borderRadius: 100,
|
|
26
18
|
borderWidth: BORDER_WIDTH,
|
|
27
19
|
height: BUTTON_SIZE,
|
|
20
|
+
justifyContent: 'center',
|
|
21
|
+
padding: 10,
|
|
28
22
|
width: BUTTON_SIZE
|
|
29
23
|
},
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
disabled: {
|
|
25
|
+
opacity: 0.5
|
|
32
26
|
},
|
|
33
27
|
hidden: {
|
|
34
28
|
opacity: 0
|
|
29
|
+
},
|
|
30
|
+
icon: {
|
|
31
|
+
marginTop: BORDER_WIDTH
|
|
32
|
+
},
|
|
33
|
+
shown: {
|
|
34
|
+
opacity: 1
|
|
35
35
|
}
|
|
36
36
|
});
|
|
@@ -2,19 +2,19 @@ import { string, bool, func, number, shape } from 'prop-types';
|
|
|
2
2
|
import { ViewPropTypes } from 'deprecated-react-native-prop-types';
|
|
3
3
|
import { Text } from 'react-native';
|
|
4
4
|
|
|
5
|
-
import TouchablePropTypes from '
|
|
6
|
-
import { themeType } from '
|
|
5
|
+
import TouchablePropTypes from '../../../../../../../Touchable/propTypes';
|
|
6
|
+
import { themeType } from '../../../../../../../../theming';
|
|
7
7
|
|
|
8
8
|
export default shape({
|
|
9
|
-
name: string,
|
|
10
|
-
disabled: bool,
|
|
11
|
-
onPress: func,
|
|
12
9
|
borderless: bool,
|
|
13
|
-
size: number,
|
|
14
10
|
color: string,
|
|
11
|
+
disabled: bool,
|
|
12
|
+
IconProps: shape(Text?.propTypes),
|
|
15
13
|
IconStyle: ViewPropTypes?.style,
|
|
16
|
-
|
|
14
|
+
name: string,
|
|
15
|
+
onPress: func,
|
|
16
|
+
size: number,
|
|
17
|
+
theme: themeType,
|
|
17
18
|
TouchableProps: shape(TouchablePropTypes),
|
|
18
|
-
|
|
19
|
-
theme: themeType
|
|
19
|
+
TouchableStyle: ViewPropTypes?.style
|
|
20
20
|
});
|
|
@@ -4,7 +4,7 @@ import { View } from 'react-native';
|
|
|
4
4
|
import { number, bool, shape, oneOf, func, string, any, elementType } from 'prop-types';
|
|
5
5
|
import _ from 'lodash';
|
|
6
6
|
|
|
7
|
-
import Label from '
|
|
7
|
+
import Label from '../../../../../Label';
|
|
8
8
|
|
|
9
9
|
import ownStyles from './styles';
|
|
10
10
|
import { defaultStepCounter } from './utils';
|
|
@@ -65,16 +65,16 @@ const StepsHandler = ({
|
|
|
65
65
|
};
|
|
66
66
|
|
|
67
67
|
StepsHandler.propTypes = {
|
|
68
|
+
currentStep: number.isRequired,
|
|
69
|
+
hideStepCounter: bool,
|
|
68
70
|
nextButton: ActionButtonPropTypes.isRequired,
|
|
69
71
|
returnButton: ActionButtonPropTypes.isRequired,
|
|
72
|
+
stepCounter: oneOf([string, func]),
|
|
73
|
+
StepCounterComponent: elementType,
|
|
70
74
|
stepsCount: number.isRequired,
|
|
71
|
-
currentStep: number.isRequired,
|
|
72
|
-
hideStepCounter: bool,
|
|
73
75
|
styles: shape(ViewPropTypes?.style),
|
|
74
|
-
stepCounter: oneOf([string, func]),
|
|
75
76
|
// eslint-disable-next-line react/forbid-prop-types
|
|
76
|
-
themedStyles: any
|
|
77
|
-
StepCounterComponent: elementType
|
|
77
|
+
themedStyles: any
|
|
78
78
|
};
|
|
79
79
|
|
|
80
80
|
export default StepsHandler;
|
|
@@ -2,9 +2,9 @@ import { StyleSheet } from 'react-native';
|
|
|
2
2
|
|
|
3
3
|
export default StyleSheet.create({
|
|
4
4
|
stepsHandler: {
|
|
5
|
-
width: '100%',
|
|
6
|
-
flexDirection: 'row',
|
|
7
5
|
alignItems: 'center',
|
|
8
|
-
|
|
6
|
+
flexDirection: 'row',
|
|
7
|
+
justifyContent: 'space-between',
|
|
8
|
+
width: '100%'
|
|
9
9
|
}
|
|
10
10
|
});
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { ViewPropTypes } from 'deprecated-react-native-prop-types';
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
import { number, func, shape, bool, string, oneOf } from 'prop-types';
|
|
5
|
+
import _ from 'lodash';
|
|
6
|
+
|
|
7
|
+
import Label from '../../../Label';
|
|
8
|
+
import { useTheme } from '../../../../theming';
|
|
9
|
+
|
|
10
|
+
import ownStyles from './styles';
|
|
11
|
+
import Header from './components/Header';
|
|
12
|
+
import ActionButtonPropTypes from './components/StepsHandler/components/ActionButton/types';
|
|
13
|
+
import BottomStepHandler from './components/BottomStepHandler';
|
|
14
|
+
|
|
15
|
+
const UTWorkflowContainer = ({
|
|
16
|
+
stepsCount,
|
|
17
|
+
currentStep,
|
|
18
|
+
nextButton,
|
|
19
|
+
returnButton,
|
|
20
|
+
onExit,
|
|
21
|
+
hideStepCounter,
|
|
22
|
+
children,
|
|
23
|
+
styles = {},
|
|
24
|
+
title,
|
|
25
|
+
subtitle,
|
|
26
|
+
stepCounter,
|
|
27
|
+
bottomHandler,
|
|
28
|
+
hideHeader = false,
|
|
29
|
+
useMarkdown
|
|
30
|
+
}) => {
|
|
31
|
+
useEffect(() => () => onExit?.(), []);
|
|
32
|
+
const theme = useTheme();
|
|
33
|
+
|
|
34
|
+
const themedStyles = _.merge({}, ownStyles, theme?.UTWorkflowContainer, styles);
|
|
35
|
+
|
|
36
|
+
const { titleProps, subtitleProps } = themedStyles?.labelProps || {};
|
|
37
|
+
|
|
38
|
+
const Title = React.isValidElement(title) ? (
|
|
39
|
+
title
|
|
40
|
+
) : (
|
|
41
|
+
<Label big bold {...titleProps} style={themedStyles.title}>
|
|
42
|
+
{title}
|
|
43
|
+
</Label>
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
const Subtitle = React.isValidElement(subtitle) ? (
|
|
47
|
+
subtitle
|
|
48
|
+
) : (
|
|
49
|
+
<Label
|
|
50
|
+
medium
|
|
51
|
+
{...subtitleProps}
|
|
52
|
+
style={themedStyles.subtitle}
|
|
53
|
+
markdownStyles={themedStyles.markdown}
|
|
54
|
+
useMarkdown={useMarkdown}
|
|
55
|
+
>
|
|
56
|
+
{subtitle}
|
|
57
|
+
</Label>
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<View style={themedStyles.container}>
|
|
62
|
+
{!hideHeader && (
|
|
63
|
+
<Header
|
|
64
|
+
stepsCount={stepsCount}
|
|
65
|
+
currentStep={currentStep}
|
|
66
|
+
nextButton={nextButton}
|
|
67
|
+
returnButton={returnButton}
|
|
68
|
+
hideStepCounter={hideStepCounter}
|
|
69
|
+
themedStyles={themedStyles}
|
|
70
|
+
styles={styles}
|
|
71
|
+
stepCounter={stepCounter}
|
|
72
|
+
bottomHandler={bottomHandler}
|
|
73
|
+
/>
|
|
74
|
+
)}
|
|
75
|
+
{!!title && Title}
|
|
76
|
+
{!!subtitle && Subtitle}
|
|
77
|
+
{children}
|
|
78
|
+
{bottomHandler && (
|
|
79
|
+
<BottomStepHandler
|
|
80
|
+
stepsCount={stepsCount}
|
|
81
|
+
currentStep={currentStep}
|
|
82
|
+
styles={styles}
|
|
83
|
+
nextButton={nextButton}
|
|
84
|
+
themedStyles={themedStyles}
|
|
85
|
+
returnButton={returnButton}
|
|
86
|
+
hideStepCounter={hideStepCounter}
|
|
87
|
+
stepCounter={stepCounter}
|
|
88
|
+
/>
|
|
89
|
+
)}
|
|
90
|
+
</View>
|
|
91
|
+
);
|
|
92
|
+
};
|
|
93
|
+
UTWorkflowContainer.propTypes = {
|
|
94
|
+
bottomHandler: bool,
|
|
95
|
+
currentStep: number.isRequired,
|
|
96
|
+
hideHeader: bool,
|
|
97
|
+
hideStepCounter: bool,
|
|
98
|
+
nextButton: ActionButtonPropTypes.isRequired,
|
|
99
|
+
onExit: func,
|
|
100
|
+
returnButton: ActionButtonPropTypes.isRequired,
|
|
101
|
+
stepCounter: oneOf([func, string]),
|
|
102
|
+
stepsCount: number.isRequired,
|
|
103
|
+
styles: shape(ViewPropTypes?.style),
|
|
104
|
+
subtitle: string,
|
|
105
|
+
title: string,
|
|
106
|
+
useMarkdown: bool
|
|
107
|
+
};
|
|
108
|
+
export default UTWorkflowContainer;
|
|
@@ -4,12 +4,12 @@ const BORDER_RADIUS_SIZE = 20;
|
|
|
4
4
|
|
|
5
5
|
export default StyleSheet.create({
|
|
6
6
|
container: {
|
|
7
|
-
flex: 1,
|
|
8
7
|
alignItems: 'center',
|
|
9
8
|
backgroundColor: 'white',
|
|
10
|
-
borderRadius: BORDER_RADIUS_SIZE,
|
|
11
|
-
paddingHorizontal: BORDER_RADIUS_SIZE / 1.25,
|
|
12
9
|
borderColor: '#e2e2e2',
|
|
13
|
-
|
|
10
|
+
borderRadius: BORDER_RADIUS_SIZE,
|
|
11
|
+
borderWidth: 1,
|
|
12
|
+
flex: 1,
|
|
13
|
+
paddingHorizontal: BORDER_RADIUS_SIZE / 1.25
|
|
14
14
|
}
|
|
15
15
|
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { string, func, bool } from 'prop-types';
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
import _ from 'lodash';
|
|
5
|
+
|
|
6
|
+
import Button from '../../../../../../../Button';
|
|
7
|
+
|
|
8
|
+
import ownStyles from './styles';
|
|
9
|
+
|
|
10
|
+
const ActionButton = ({ hidden, disabled, onPress, label, mode, style }) => {
|
|
11
|
+
const themedStyles = _.merge({}, ownStyles, style);
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<View style={themedStyles.actionButton}>
|
|
15
|
+
<Button
|
|
16
|
+
disabled={disabled || hidden}
|
|
17
|
+
mode={mode}
|
|
18
|
+
lowerCase
|
|
19
|
+
title={label}
|
|
20
|
+
onPress={onPress}
|
|
21
|
+
containerStyle={themedStyles.buttonContainer}
|
|
22
|
+
/>
|
|
23
|
+
</View>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
ActionButton.propTypes = {
|
|
28
|
+
disabled: bool,
|
|
29
|
+
hidden: bool,
|
|
30
|
+
label: string,
|
|
31
|
+
mode: string,
|
|
32
|
+
onPress: func
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default ActionButton;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import _ from 'lodash';
|
|
4
|
+
|
|
5
|
+
import Label from '../../../../../Label';
|
|
6
|
+
import Button from '../../../../../Button';
|
|
7
|
+
import Icon from '../../../../../Icon';
|
|
8
|
+
import Checkbox from '../../../../../Checkbox';
|
|
9
|
+
import { MessagePropTypes, SummaryPropTypes } from '../../types';
|
|
10
|
+
|
|
11
|
+
import ActionButton from './components/ActionButton';
|
|
12
|
+
import ActionButtonPropTypes from './components/ActionButton/types';
|
|
13
|
+
import ownStyles, { ICON_SIZE } from './styles';
|
|
14
|
+
import { NEXT, RETURN } from './constants';
|
|
15
|
+
|
|
16
|
+
const BottomActions = ({ nextButton, returnButton, summary, message, theme }) => {
|
|
17
|
+
const messageIcon = message?.icon;
|
|
18
|
+
const MESSAGE_ICON_SIZE = 16;
|
|
19
|
+
const checkboxProps = summary?.checkbox;
|
|
20
|
+
|
|
21
|
+
const themedStyles = _.merge({}, ownStyles, theme?.UTWorkflowContainer);
|
|
22
|
+
const nextButtonEnabled = nextButton && !nextButton.hidden;
|
|
23
|
+
const returnButtonEnabled = returnButton && !returnButton.hidden;
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<View style={ownStyles.bottomNav}>
|
|
27
|
+
{summary && (
|
|
28
|
+
<View style={[ownStyles.summary, checkboxProps && ownStyles.summaryCheckbox]}>
|
|
29
|
+
{checkboxProps ? (
|
|
30
|
+
<Checkbox {...checkboxProps} />
|
|
31
|
+
) : (
|
|
32
|
+
<View style={ownStyles.summaryTitles}>
|
|
33
|
+
<Label disabled medium style={ownStyles.summaryTitlesChild}>
|
|
34
|
+
{summary.title}
|
|
35
|
+
</Label>
|
|
36
|
+
<Label>{summary.mainInfo}</Label>
|
|
37
|
+
</View>
|
|
38
|
+
)}
|
|
39
|
+
{summary.actions && !checkboxProps && (
|
|
40
|
+
<View style={ownStyles.summaryActions}>
|
|
41
|
+
{summary.actions.map((action, index) => (
|
|
42
|
+
<Button
|
|
43
|
+
key={action.name}
|
|
44
|
+
secondary
|
|
45
|
+
icon={
|
|
46
|
+
action.icon && {
|
|
47
|
+
height: action.icon.height || ICON_SIZE,
|
|
48
|
+
name: action.icon.name,
|
|
49
|
+
size: action.icon.size || ICON_SIZE,
|
|
50
|
+
type: action.icon.type,
|
|
51
|
+
width: action.icon.width || ICON_SIZE
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
title={action.title}
|
|
55
|
+
labelColor={themedStyles.summaryActions?.labelColor || 'blue'}
|
|
56
|
+
containerStyle={ownStyles.summaryActionContainer}
|
|
57
|
+
contentStyle={!action.title && ownStyles.summaryActionButton}
|
|
58
|
+
onPress={action.onPress}
|
|
59
|
+
outerContainerStyles={index !== summary.actions.length - 1 && ownStyles.summaryActionsChild}
|
|
60
|
+
/>
|
|
61
|
+
))}
|
|
62
|
+
</View>
|
|
63
|
+
)}
|
|
64
|
+
</View>
|
|
65
|
+
)}
|
|
66
|
+
{message && (
|
|
67
|
+
<View
|
|
68
|
+
style={[
|
|
69
|
+
themedStyles.message,
|
|
70
|
+
themedStyles[`message${message.variant?.charAt(0).toUpperCase()}${message.variant?.slice(1)}`]
|
|
71
|
+
]}
|
|
72
|
+
>
|
|
73
|
+
<Label white style={ownStyles.messageChild}>
|
|
74
|
+
{message.title}
|
|
75
|
+
</Label>
|
|
76
|
+
{messageIcon && (
|
|
77
|
+
<Icon
|
|
78
|
+
name={messageIcon.name}
|
|
79
|
+
type={messageIcon.type}
|
|
80
|
+
size={MESSAGE_ICON_SIZE}
|
|
81
|
+
width={MESSAGE_ICON_SIZE}
|
|
82
|
+
height={MESSAGE_ICON_SIZE}
|
|
83
|
+
color="white"
|
|
84
|
+
/>
|
|
85
|
+
)}
|
|
86
|
+
</View>
|
|
87
|
+
)}
|
|
88
|
+
<View style={ownStyles.actionsContainer}>
|
|
89
|
+
{returnButtonEnabled && (
|
|
90
|
+
<ActionButton
|
|
91
|
+
mode="text"
|
|
92
|
+
label={returnButton.label || RETURN}
|
|
93
|
+
style={nextButtonEnabled && { actionButton: ownStyles.actionsChild }}
|
|
94
|
+
{...returnButton}
|
|
95
|
+
/>
|
|
96
|
+
)}
|
|
97
|
+
{nextButtonEnabled && <ActionButton label={nextButton.label || NEXT} {...nextButton} />}
|
|
98
|
+
</View>
|
|
99
|
+
</View>
|
|
100
|
+
);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
BottomActions.propTypes = {
|
|
104
|
+
message: MessagePropTypes,
|
|
105
|
+
nextButton: ActionButtonPropTypes,
|
|
106
|
+
returnButton: ActionButtonPropTypes,
|
|
107
|
+
summary: SummaryPropTypes
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export default BottomActions;
|