@widergy/mobile-ui 1.18.4 → 1.18.6
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/UTSelectableCard/index.js +11 -10
- package/lib/components/UTSelectableCard/styles.js +85 -71
- package/lib/components/UTWorkflowContainer/versions/V1/components/BottomActions/index.js +11 -18
- package/lib/utils/styleUtils/index.js +15 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.18.6](https://github.com/widergy/mobile-ui/compare/v1.18.5...v1.18.6) (2024-08-23)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* utselectablecard border radius ([#331](https://github.com/widergy/mobile-ui/issues/331)) ([00f17a6](https://github.com/widergy/mobile-ui/commit/00f17a6ac99f764df6f82b61fd733a7fddae8e27))
|
|
7
|
+
|
|
8
|
+
## [1.18.5](https://github.com/widergy/mobile-ui/compare/v1.18.4...v1.18.5) (2024-08-23)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* utlabel for workflow message ([#339](https://github.com/widergy/mobile-ui/issues/339)) ([a9124d8](https://github.com/widergy/mobile-ui/commit/a9124d8b9205dba965c7d2b6e3a25365d794689a))
|
|
14
|
+
|
|
1
15
|
## [1.18.4](https://github.com/widergy/mobile-ui/compare/v1.18.3...v1.18.4) (2024-08-21)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { bool, func, number, shape, string } from 'prop-types';
|
|
3
3
|
import { Image, View } from 'react-native';
|
|
4
|
-
import
|
|
5
|
-
import { isEmpty } from 'lodash';
|
|
4
|
+
import isEmpty from 'lodash/isEmpty';
|
|
6
5
|
|
|
7
6
|
import Touchable from '../Touchable';
|
|
8
7
|
import Surface from '../Surface';
|
|
@@ -10,8 +9,9 @@ import UTTooltip from '../UTTooltip';
|
|
|
10
9
|
import { useTheme } from '../../theming';
|
|
11
10
|
import UTIcon from '../UTIcon';
|
|
12
11
|
import UTLabel from '../UTLabel';
|
|
12
|
+
import { mergeMultipleStyles } from '../../utils/styleUtils';
|
|
13
13
|
|
|
14
|
-
import { getColorTheme,
|
|
14
|
+
import { getColorTheme, ownStyles, ICON_SIZE, getAppearanceStyles, ownSizeStyles } from './styles';
|
|
15
15
|
|
|
16
16
|
const UTSelectableCard = ({
|
|
17
17
|
additionalInfo = {},
|
|
@@ -28,9 +28,10 @@ const UTSelectableCard = ({
|
|
|
28
28
|
tooltip
|
|
29
29
|
}) => {
|
|
30
30
|
const theme = useTheme();
|
|
31
|
-
const themedStyles =
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
const themedStyles = mergeMultipleStyles(
|
|
32
|
+
ownStyles,
|
|
33
|
+
getAppearanceStyles(theme)[appearance],
|
|
34
|
+
ownSizeStyles[size],
|
|
34
35
|
theme?.UTSelectableCard,
|
|
35
36
|
style
|
|
36
37
|
);
|
|
@@ -43,10 +44,10 @@ const UTSelectableCard = ({
|
|
|
43
44
|
disabled={disabled}
|
|
44
45
|
onPress={() => onPress?.()}
|
|
45
46
|
style={[
|
|
46
|
-
themedStyles
|
|
47
|
-
selected && themedStyles
|
|
48
|
-
disabled && themedStyles
|
|
49
|
-
themedStyles
|
|
47
|
+
themedStyles.appearance,
|
|
48
|
+
selected && themedStyles.selectedContainer,
|
|
49
|
+
disabled && themedStyles.disabledContainer,
|
|
50
|
+
themedStyles.size
|
|
50
51
|
]}
|
|
51
52
|
>
|
|
52
53
|
<View style={themedStyles.container}>
|
|
@@ -2,88 +2,102 @@ import { StyleSheet } from 'react-native';
|
|
|
2
2
|
|
|
3
3
|
export const ICON_SIZE = 40;
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
additionalInfo: {
|
|
8
|
-
textAlign: 'right'
|
|
9
|
-
},
|
|
10
|
-
checkIcon: {
|
|
11
|
-
marginLeft: 16
|
|
12
|
-
},
|
|
13
|
-
column: {
|
|
14
|
-
alignSelf: 'center'
|
|
15
|
-
},
|
|
16
|
-
container: {
|
|
17
|
-
alignItems: 'center',
|
|
18
|
-
display: 'flex',
|
|
19
|
-
flexDirection: 'row'
|
|
20
|
-
},
|
|
21
|
-
description: {
|
|
22
|
-
marginTop: 4
|
|
23
|
-
},
|
|
24
|
-
icon: {
|
|
25
|
-
marginRight: 16
|
|
26
|
-
},
|
|
27
|
-
outerContainer: {
|
|
28
|
-
borderRadius: 4
|
|
29
|
-
},
|
|
30
|
-
selectedTitleAndTooltip: {
|
|
31
|
-
maxWidth: 300
|
|
32
|
-
},
|
|
33
|
-
textContainer: {
|
|
34
|
-
display: 'flex',
|
|
35
|
-
flexDirection: 'row',
|
|
36
|
-
flexGrow: 1,
|
|
37
|
-
justifyContent: 'space-between'
|
|
38
|
-
},
|
|
39
|
-
titleAndTooltip: {
|
|
40
|
-
alignItems: 'center',
|
|
41
|
-
display: 'flex',
|
|
42
|
-
flexDirection: 'row'
|
|
43
|
-
},
|
|
44
|
-
titleMargin: {
|
|
45
|
-
marginRight: 8
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
// Sizes
|
|
49
|
-
mediumSize: {
|
|
50
|
-
padding: 24
|
|
51
|
-
},
|
|
52
|
-
smallSize: {
|
|
53
|
-
padding: 16
|
|
54
|
-
},
|
|
5
|
+
const WHITE = 'white';
|
|
6
|
+
const GRAY = 'gray';
|
|
55
7
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
8
|
+
export const getAppearanceStyles = (theme = {}) => ({
|
|
9
|
+
[WHITE]: {
|
|
10
|
+
appearance: {
|
|
11
|
+
backgroundColor: theme.Palette.light['01'],
|
|
59
12
|
borderColor: 'transparent',
|
|
13
|
+
borderRadius: 4,
|
|
60
14
|
borderWidth: 2
|
|
61
15
|
},
|
|
62
|
-
|
|
63
|
-
backgroundColor: theme.
|
|
16
|
+
disabledContainer: {
|
|
17
|
+
backgroundColor: theme.Palette.light['03'],
|
|
64
18
|
borderColor: 'transparent',
|
|
65
19
|
borderWidth: 2
|
|
66
20
|
},
|
|
67
|
-
|
|
68
|
-
borderColor: theme.
|
|
21
|
+
selectedContainer: {
|
|
22
|
+
borderColor: theme.Palette.accent['05'],
|
|
69
23
|
borderWidth: 2
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
backgroundColor: theme.
|
|
75
|
-
borderColor: theme.
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
[GRAY]: {
|
|
27
|
+
appearance: {
|
|
28
|
+
backgroundColor: theme.Palette.light['03'],
|
|
29
|
+
borderColor: theme.Palette.light['05'],
|
|
30
|
+
borderRadius: 4,
|
|
76
31
|
borderWidth: 1
|
|
77
32
|
},
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
borderWidth: 2
|
|
33
|
+
disabledContainer: {
|
|
34
|
+
borderWidth: 1
|
|
81
35
|
},
|
|
82
|
-
|
|
83
|
-
backgroundColor: theme.
|
|
84
|
-
borderColor: theme.
|
|
85
|
-
borderWidth:
|
|
36
|
+
selectedContainer: {
|
|
37
|
+
backgroundColor: theme.Palette.accent['01'],
|
|
38
|
+
borderColor: theme.Palette.accent['03'],
|
|
39
|
+
borderWidth: 1
|
|
86
40
|
}
|
|
87
|
-
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const MEDIUM = 'medium';
|
|
45
|
+
const SMALL = 'small';
|
|
46
|
+
|
|
47
|
+
export const ownSizeStyles = {
|
|
48
|
+
[MEDIUM]: {
|
|
49
|
+
size: {
|
|
50
|
+
padding: 24
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
[SMALL]: {
|
|
54
|
+
size: {
|
|
55
|
+
padding: 16
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const ownStyles = StyleSheet.create({
|
|
61
|
+
additionalInfo: {
|
|
62
|
+
textAlign: 'right'
|
|
63
|
+
},
|
|
64
|
+
checkIcon: {
|
|
65
|
+
marginLeft: 16
|
|
66
|
+
},
|
|
67
|
+
column: {
|
|
68
|
+
alignSelf: 'center'
|
|
69
|
+
},
|
|
70
|
+
container: {
|
|
71
|
+
alignItems: 'center',
|
|
72
|
+
display: 'flex',
|
|
73
|
+
flexDirection: 'row'
|
|
74
|
+
},
|
|
75
|
+
description: {
|
|
76
|
+
marginTop: 4
|
|
77
|
+
},
|
|
78
|
+
icon: {
|
|
79
|
+
marginRight: 16
|
|
80
|
+
},
|
|
81
|
+
outerContainer: {
|
|
82
|
+
borderRadius: 4
|
|
83
|
+
},
|
|
84
|
+
selectedTitleAndTooltip: {
|
|
85
|
+
maxWidth: 300
|
|
86
|
+
},
|
|
87
|
+
textContainer: {
|
|
88
|
+
display: 'flex',
|
|
89
|
+
flexDirection: 'row',
|
|
90
|
+
flexGrow: 1,
|
|
91
|
+
justifyContent: 'space-between'
|
|
92
|
+
},
|
|
93
|
+
titleAndTooltip: {
|
|
94
|
+
alignItems: 'center',
|
|
95
|
+
display: 'flex',
|
|
96
|
+
flexDirection: 'row'
|
|
97
|
+
},
|
|
98
|
+
titleMargin: {
|
|
99
|
+
marginRight: 8
|
|
100
|
+
}
|
|
101
|
+
});
|
|
88
102
|
|
|
89
103
|
export const getColorTheme = (selected, disabled) => (selected ? 'accent' : disabled ? 'gray' : 'dark');
|
|
@@ -3,9 +3,9 @@ import { View } from 'react-native';
|
|
|
3
3
|
import merge from 'lodash/merge';
|
|
4
4
|
import { number } from 'prop-types';
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import UTLabel from '../../../../../UTLabel';
|
|
7
7
|
import Surface from '../../../../../Surface';
|
|
8
|
-
import
|
|
8
|
+
import UTIcon from '../../../../../UTIcon';
|
|
9
9
|
import Checkbox from '../../../../../Checkbox';
|
|
10
10
|
import { MessagePropTypes, SummaryPropTypes } from '../../types';
|
|
11
11
|
import UTButton from '../../../../../UTButton';
|
|
@@ -17,7 +17,7 @@ import ownStyles from './styles';
|
|
|
17
17
|
import { NEXT, RETURN } from './constants';
|
|
18
18
|
|
|
19
19
|
const BottomActions = ({ bottomSafeArea, message, nextButton, returnButton, summary, style }) => {
|
|
20
|
-
const messageIcon = message?.
|
|
20
|
+
const messageIcon = message?.Icon;
|
|
21
21
|
const MESSAGE_ICON_SIZE = 16;
|
|
22
22
|
const checkboxProps = summary?.checkbox;
|
|
23
23
|
|
|
@@ -33,10 +33,12 @@ const BottomActions = ({ bottomSafeArea, message, nextButton, returnButton, summ
|
|
|
33
33
|
<Checkbox {...checkboxProps} />
|
|
34
34
|
) : (
|
|
35
35
|
<View style={themedStyles.summaryTitles}>
|
|
36
|
-
<
|
|
36
|
+
<UTLabel colorTheme="gray" variant="small" style={themedStyles.summaryTitlesChild}>
|
|
37
37
|
{summary.title}
|
|
38
|
-
</
|
|
39
|
-
<
|
|
38
|
+
</UTLabel>
|
|
39
|
+
<UTLabel weight="medium" variant="subtitle1">
|
|
40
|
+
{summary.mainInfo}
|
|
41
|
+
</UTLabel>
|
|
40
42
|
</View>
|
|
41
43
|
)}
|
|
42
44
|
{summary.actions && !checkboxProps && (
|
|
@@ -73,19 +75,10 @@ const BottomActions = ({ bottomSafeArea, message, nextButton, returnButton, summ
|
|
|
73
75
|
themedStyles[`message${message.variant?.charAt(0).toUpperCase()}${message.variant?.slice(1)}`]
|
|
74
76
|
]}
|
|
75
77
|
>
|
|
76
|
-
<
|
|
78
|
+
<UTLabel colorTheme="negative" weight="medium" style={themedStyles.messageChild}>
|
|
77
79
|
{message.title}
|
|
78
|
-
</
|
|
79
|
-
{messageIcon &&
|
|
80
|
-
<Icon
|
|
81
|
-
color="white"
|
|
82
|
-
height={MESSAGE_ICON_SIZE}
|
|
83
|
-
name={messageIcon.name}
|
|
84
|
-
size={MESSAGE_ICON_SIZE}
|
|
85
|
-
type={messageIcon.type}
|
|
86
|
-
width={MESSAGE_ICON_SIZE}
|
|
87
|
-
/>
|
|
88
|
-
)}
|
|
80
|
+
</UTLabel>
|
|
81
|
+
{messageIcon && <UTIcon colorTheme="negative" name={messageIcon} size={MESSAGE_ICON_SIZE} />}
|
|
89
82
|
</View>
|
|
90
83
|
)}
|
|
91
84
|
<View style={themedStyles.actionsContainer}>
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import isArray from 'lodash/isArray';
|
|
2
|
+
import mergeWith from 'lodash/mergeWith';
|
|
3
|
+
|
|
1
4
|
export const SHADOW_OPACITY = 0.1;
|
|
2
5
|
|
|
3
6
|
const shadowLevels = {
|
|
@@ -65,6 +68,18 @@ export const getCustomStyles = (variants, props, styles, stylePrefix = '') =>
|
|
|
65
68
|
.map(variant => (props[variant] ? styles[`${variant}${stylePrefix}`] : null))
|
|
66
69
|
.filter(style => style !== null);
|
|
67
70
|
|
|
71
|
+
const asArray = value => (isArray(value) ? value : [value]);
|
|
72
|
+
|
|
73
|
+
export const mergeMultipleStyles = (...params) => {
|
|
74
|
+
return mergeWith({}, ...params, (valueA, valueB) => {
|
|
75
|
+
if (valueA && valueB && (isArray(valueA) || isArray(valueB))) {
|
|
76
|
+
return [...asArray(valueA), ...asArray(valueB)];
|
|
77
|
+
}
|
|
78
|
+
// By returning `undefined`, lodash will use its default merging behavior for objects
|
|
79
|
+
return undefined;
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
|
|
68
83
|
export default {
|
|
69
84
|
generateLayoutMeasuresObject,
|
|
70
85
|
getCustomStyles
|
package/package.json
CHANGED