@widergy/mobile-ui 1.19.0 → 1.19.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/UTBadge/constants.js +2 -10
- package/lib/components/UTBadge/theme.js +8 -15
- package/lib/components/UTButton/constants.js +8 -7
- package/lib/components/UTButton/index.js +12 -16
- package/lib/components/UTButton/theme.js +31 -85
- package/lib/components/UTIcon/constants.js +4 -23
- package/lib/components/UTIcon/theme.js +2 -7
- package/lib/components/UTLabel/constants.js +2 -21
- package/lib/components/UTLabel/theme.js +4 -9
- package/lib/components/UTModal/index.js +5 -5
- package/lib/components/UTModal/styles.js +0 -1
- package/lib/components/UTSelectableCard/styles.js +1 -0
- package/lib/components/UTTracker/README.md +3 -1
- package/lib/components/UTTracker/components/Connector/index.js +4 -2
- package/lib/components/UTTracker/components/Connector/styles.js +26 -25
- package/lib/components/UTTracker/components/Step/index.js +14 -31
- package/lib/components/UTTracker/components/Step/styles.js +46 -56
- package/lib/components/UTTracker/components/SubStep/index.js +7 -3
- package/lib/components/UTTracker/components/SubStep/styles.js +1 -3
- package/lib/components/UTTracker/index.js +44 -28
- package/lib/components/UTTracker/styles.js +50 -43
- package/lib/constants/Palette.js +20 -0
- package/lib/utils/styleUtils/index.js +9 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.19.2](https://github.com/widergy/mobile-ui/compare/v1.19.1...v1.19.2) (2024-08-26)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* update utbadge and counter on utbutton ([#343](https://github.com/widergy/mobile-ui/issues/343)) ([6dcc9dd](https://github.com/widergy/mobile-ui/commit/6dcc9dd1b9bd00b126cf50b0dcf66d87a2a94559))
|
|
7
|
+
|
|
8
|
+
## [1.19.1](https://github.com/widergy/mobile-ui/compare/v1.19.0...v1.19.1) (2024-08-26)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* standarize uttracker ([#336](https://github.com/widergy/mobile-ui/issues/336)) ([b832deb](https://github.com/widergy/mobile-ui/commit/b832deb20b87ee771c4d4ce15c9e80ea4b24974f))
|
|
14
|
+
|
|
1
15
|
# [1.19.0](https://github.com/widergy/mobile-ui/compare/v1.18.6...v1.19.0) (2024-08-23)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
alert: 'error',
|
|
3
|
-
identity: 'accent',
|
|
4
|
-
identitySecondary: 'neutral',
|
|
5
|
-
information: 'information',
|
|
6
|
-
negative: 'negative',
|
|
7
|
-
success: 'success',
|
|
8
|
-
warning: 'warning'
|
|
9
|
-
};
|
|
1
|
+
import { COLOR_THEMES } from '../../constants/Palette';
|
|
10
2
|
|
|
11
3
|
export const DEFAULT_PROPS = {
|
|
12
|
-
colorTheme:
|
|
4
|
+
colorTheme: COLOR_THEMES.error
|
|
13
5
|
};
|
|
@@ -1,23 +1,16 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { COLOR_THEMES } from '../../constants/Palette';
|
|
4
|
+
import { getDefaultColorShade } from '../../utils/styleUtils';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
const colorName = COLORS_MAPPER[colorTheme] || COLORS_MAPPER[DEFAULT_PROPS.colorTheme];
|
|
7
|
-
const paletteTheme = theme.Palette[colorName];
|
|
6
|
+
import { DEFAULT_PROPS } from './constants';
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
warning: paletteTheme['05'],
|
|
13
|
-
success: paletteTheme['05'],
|
|
14
|
-
identity: paletteTheme['05'],
|
|
15
|
-
identitySecondary: paletteTheme['05'],
|
|
16
|
-
negative: paletteTheme['04']
|
|
17
|
-
};
|
|
8
|
+
export const variantsColorTheme = (theme, colorTheme) => {
|
|
9
|
+
const colorThemeDefinition = theme.Palette[colorTheme] || theme.Palette[DEFAULT_PROPS.colorTheme];
|
|
10
|
+
const colorShade = getDefaultColorShade(colorTheme);
|
|
18
11
|
|
|
19
12
|
return {
|
|
20
|
-
backgroundColor:
|
|
13
|
+
backgroundColor: colorThemeDefinition[colorShade]
|
|
21
14
|
};
|
|
22
15
|
};
|
|
23
16
|
|
|
@@ -51,6 +44,6 @@ export const retrieveStyle = ({ theme, colorTheme, children }) => {
|
|
|
51
44
|
...textTheme,
|
|
52
45
|
...variantTheme
|
|
53
46
|
},
|
|
54
|
-
textColorTheme: colorTheme
|
|
47
|
+
textColorTheme: [COLOR_THEMES.negative, COLOR_THEMES.light].includes(colorTheme) ? 'dark' : 'negative'
|
|
55
48
|
};
|
|
56
49
|
};
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
export const ELEVATION = 2;
|
|
2
2
|
export const PRESSED_ELEVATION = 2;
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
export const VARIANTS_NAMES = {
|
|
5
|
+
filled: 'filled',
|
|
6
|
+
outlined: 'outlined',
|
|
7
|
+
semitransparent: 'semitransparent',
|
|
8
|
+
shadow: 'shadow',
|
|
9
|
+
text: 'text'
|
|
10
|
+
};
|
|
4
11
|
|
|
5
12
|
export const SIZES = {
|
|
6
13
|
SMALL: 'small',
|
|
@@ -20,9 +27,3 @@ export const COLORS_MAPPER = {
|
|
|
20
27
|
secondary: 'neutral',
|
|
21
28
|
success: 'success'
|
|
22
29
|
};
|
|
23
|
-
|
|
24
|
-
export const COUNTER_THEMES = {
|
|
25
|
-
IDENTITY: 'identity',
|
|
26
|
-
IDENTITY_SECONDARY: 'identitySecondary',
|
|
27
|
-
NEGATIVE: 'negative'
|
|
28
|
-
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Pressable, View } from 'react-native';
|
|
3
3
|
|
|
4
|
+
import { COLOR_THEMES } from '../../constants/Palette';
|
|
4
5
|
import { isUTIcon } from '../UTIcon/utils';
|
|
5
6
|
import { useTheme } from '../../theming';
|
|
6
7
|
import UTBadge from '../UTBadge';
|
|
@@ -8,8 +9,8 @@ import UTIcon from '../UTIcon';
|
|
|
8
9
|
import UTLabel from '../UTLabel';
|
|
9
10
|
import UTLoading from '../UTLoading';
|
|
10
11
|
|
|
12
|
+
import { COLORS_MAPPER, ICON_PLACEMENTS, VARIANTS_NAMES } from './constants';
|
|
11
13
|
import { defaultProps, propTypes } from './proptypes';
|
|
12
|
-
import { ICON_PLACEMENTS } from './constants';
|
|
13
14
|
import { retrieveStyle } from './theme';
|
|
14
15
|
|
|
15
16
|
const UTButton = ({
|
|
@@ -29,7 +30,6 @@ const UTButton = ({
|
|
|
29
30
|
|
|
30
31
|
const {
|
|
31
32
|
buttonStyles: themeButtonStyles,
|
|
32
|
-
counterStyles,
|
|
33
33
|
childrenContainerStyles: themeChildrenContainerStyles,
|
|
34
34
|
disabledStyles,
|
|
35
35
|
iconStyles: themeIconStyles,
|
|
@@ -37,7 +37,6 @@ const UTButton = ({
|
|
|
37
37
|
} = retrieveStyle({
|
|
38
38
|
style,
|
|
39
39
|
colorTheme,
|
|
40
|
-
iconPlacement,
|
|
41
40
|
size,
|
|
42
41
|
theme,
|
|
43
42
|
variant
|
|
@@ -45,10 +44,16 @@ const UTButton = ({
|
|
|
45
44
|
|
|
46
45
|
const iconStyles = children ? themeIconStyles.icon : themeIconStyles.iconOnly;
|
|
47
46
|
|
|
48
|
-
const
|
|
47
|
+
const counterColorTheme =
|
|
48
|
+
variant === VARIANTS_NAMES.filled
|
|
49
|
+
? colorTheme === COLOR_THEMES.negative
|
|
50
|
+
? COLOR_THEMES.dark
|
|
51
|
+
: COLOR_THEMES.negative
|
|
52
|
+
: COLORS_MAPPER[colorTheme];
|
|
49
53
|
|
|
50
54
|
const buttonStyles = ({ pressed }) => [
|
|
51
55
|
themeButtonStyles,
|
|
56
|
+
!children && themeButtonStyles.iconOnly,
|
|
52
57
|
(disabled || loading) && disabledStyles,
|
|
53
58
|
pressed ? themeButtonStyles.pressed : themeButtonStyles.notPressed
|
|
54
59
|
];
|
|
@@ -57,13 +62,13 @@ const UTButton = ({
|
|
|
57
62
|
Icon &&
|
|
58
63
|
(isUTIcon(Icon) ? (
|
|
59
64
|
(() => {
|
|
60
|
-
const {
|
|
65
|
+
const { size: iconSize, color, ...remainingIconStyles } = iconStyles;
|
|
61
66
|
|
|
62
67
|
return (
|
|
63
68
|
<UTIcon
|
|
64
69
|
colorTheme={textStyles.colorTheme}
|
|
65
70
|
name={Icon}
|
|
66
|
-
size={
|
|
71
|
+
size={iconSize}
|
|
67
72
|
style={remainingIconStyles}
|
|
68
73
|
/>
|
|
69
74
|
);
|
|
@@ -74,17 +79,8 @@ const UTButton = ({
|
|
|
74
79
|
|
|
75
80
|
const RenderedChildren = (
|
|
76
81
|
<View style={themeChildrenContainerStyles}>
|
|
82
|
+
{count && <UTBadge colorTheme={counterColorTheme}>{count}</UTBadge>}
|
|
77
83
|
{iconPlacement === ICON_PLACEMENTS.LEFT && IconToShow}
|
|
78
|
-
{count && count > 0 ? (
|
|
79
|
-
<UTBadge
|
|
80
|
-
colorTheme={counterTheme}
|
|
81
|
-
style={
|
|
82
|
-
iconPlacement === ICON_PLACEMENTS.LEFT && !children ? iconLeftAndCounter : remainingCounterStyles
|
|
83
|
-
}
|
|
84
|
-
>
|
|
85
|
-
{count}
|
|
86
|
-
</UTBadge>
|
|
87
|
-
) : null}
|
|
88
84
|
{children && (
|
|
89
85
|
<UTLabel colorTheme={textStyles.colorTheme} variant={textStyles.variant} weight={textStyles.weight}>
|
|
90
86
|
{children}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { COLOR_THEMES } from '../../constants/Palette';
|
|
1
2
|
import { getShadow } from '../../utils/styleUtils';
|
|
2
|
-
import { COLOR_THEMES } from '../UTLabel/constants';
|
|
3
3
|
|
|
4
|
-
import { COLORS_MAPPER,
|
|
4
|
+
import { COLORS_MAPPER, ELEVATION, PRESSED_ELEVATION } from './constants';
|
|
5
5
|
import { defaultProps } from './proptypes';
|
|
6
6
|
|
|
7
7
|
const baseButtonTheme = () => ({
|
|
@@ -14,29 +14,22 @@ const baseButtonTheme = () => ({
|
|
|
14
14
|
borderWidth: 0,
|
|
15
15
|
minWidth: 'auto',
|
|
16
16
|
paddingHorizontal: 12,
|
|
17
|
-
paddingVertical: 8
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
iconLeftAndCounter: {
|
|
23
|
-
marginLeft: 8,
|
|
24
|
-
marginRight: 0
|
|
17
|
+
paddingVertical: 8,
|
|
18
|
+
iconOnly: {
|
|
19
|
+
paddingHorizontal: 8,
|
|
20
|
+
paddingVertical: 8
|
|
21
|
+
}
|
|
25
22
|
},
|
|
26
23
|
icon: {
|
|
27
|
-
|
|
24
|
+
size: 20
|
|
28
25
|
},
|
|
29
26
|
iconOnly: {
|
|
30
|
-
|
|
31
|
-
height: 24,
|
|
32
|
-
marginHorizontal: -4,
|
|
33
|
-
marginLeft: 0,
|
|
34
|
-
marginRight: 0,
|
|
35
|
-
width: 24
|
|
27
|
+
size: 24
|
|
36
28
|
},
|
|
37
29
|
childrenContainer: {
|
|
38
30
|
alignItems: 'center',
|
|
39
31
|
display: 'flex',
|
|
32
|
+
columnGap: 8,
|
|
40
33
|
flexDirection: 'row',
|
|
41
34
|
justifyContent: 'flex-start'
|
|
42
35
|
}
|
|
@@ -61,12 +54,8 @@ const variantsColorTheme = (theme, colorTheme, variant) => {
|
|
|
61
54
|
backgroundColor: actionTheme['05']
|
|
62
55
|
}
|
|
63
56
|
},
|
|
64
|
-
counter: {
|
|
65
|
-
colorTheme:
|
|
66
|
-
colorTheme === COLORS_MAPPER.negative ? COUNTER_THEMES.IDENTITY_SECONDARY : COUNTER_THEMES.NEGATIVE
|
|
67
|
-
},
|
|
68
57
|
text: {
|
|
69
|
-
colorTheme: colorTheme === COLORS_MAPPER.negative ? COLOR_THEMES.
|
|
58
|
+
colorTheme: colorTheme === COLORS_MAPPER.negative ? COLOR_THEMES.neutral : COLOR_THEMES.negative
|
|
70
59
|
},
|
|
71
60
|
icon: {
|
|
72
61
|
color: colorTheme === COLORS_MAPPER.negative ? neutralTheme['05'] : negativeTheme['05']
|
|
@@ -82,14 +71,6 @@ const variantsColorTheme = (theme, colorTheme, variant) => {
|
|
|
82
71
|
backgroundColor: actionTheme['03']
|
|
83
72
|
}
|
|
84
73
|
},
|
|
85
|
-
counter: {
|
|
86
|
-
colorTheme:
|
|
87
|
-
colorTheme === COLORS_MAPPER.negative
|
|
88
|
-
? colorTheme
|
|
89
|
-
: colorTheme === PRIMARY
|
|
90
|
-
? COUNTER_THEMES.IDENTITY
|
|
91
|
-
: COUNTER_THEMES.IDENTITY_SECONDARY
|
|
92
|
-
},
|
|
93
74
|
text: {
|
|
94
75
|
colorTheme: colorName
|
|
95
76
|
},
|
|
@@ -106,14 +87,6 @@ const variantsColorTheme = (theme, colorTheme, variant) => {
|
|
|
106
87
|
backgroundColor: actionTheme['02']
|
|
107
88
|
}
|
|
108
89
|
},
|
|
109
|
-
counter: {
|
|
110
|
-
colorTheme:
|
|
111
|
-
colorTheme === COLORS_MAPPER.negative
|
|
112
|
-
? colorTheme
|
|
113
|
-
: colorTheme === PRIMARY
|
|
114
|
-
? COUNTER_THEMES.IDENTITY
|
|
115
|
-
: COUNTER_THEMES.IDENTITY_SECONDARY
|
|
116
|
-
},
|
|
117
90
|
text: {
|
|
118
91
|
colorTheme: colorName
|
|
119
92
|
},
|
|
@@ -130,14 +103,6 @@ const variantsColorTheme = (theme, colorTheme, variant) => {
|
|
|
130
103
|
backgroundColor: actionTheme['02']
|
|
131
104
|
}
|
|
132
105
|
},
|
|
133
|
-
counter: {
|
|
134
|
-
colorTheme:
|
|
135
|
-
colorTheme === COLORS_MAPPER.negative
|
|
136
|
-
? colorTheme
|
|
137
|
-
: colorTheme === PRIMARY
|
|
138
|
-
? COUNTER_THEMES.IDENTITY
|
|
139
|
-
: COUNTER_THEMES.IDENTITY_SECONDARY
|
|
140
|
-
},
|
|
141
106
|
text: {
|
|
142
107
|
colorTheme: colorName
|
|
143
108
|
},
|
|
@@ -157,14 +122,6 @@ const variantsColorTheme = (theme, colorTheme, variant) => {
|
|
|
157
122
|
},
|
|
158
123
|
notPressed: shadow
|
|
159
124
|
},
|
|
160
|
-
counter: {
|
|
161
|
-
colorTheme:
|
|
162
|
-
colorTheme === COLORS_MAPPER.negative
|
|
163
|
-
? colorTheme
|
|
164
|
-
: colorTheme === PRIMARY
|
|
165
|
-
? COUNTER_THEMES.IDENTITY
|
|
166
|
-
: COUNTER_THEMES.IDENTITY_SECONDARY
|
|
167
|
-
},
|
|
168
125
|
text: {
|
|
169
126
|
colorTheme: colorName
|
|
170
127
|
},
|
|
@@ -182,33 +139,41 @@ const sizeButtonTheme = size => {
|
|
|
182
139
|
large: {
|
|
183
140
|
button: {
|
|
184
141
|
paddingHorizontal: 16,
|
|
185
|
-
paddingVertical: 12
|
|
142
|
+
paddingVertical: 12,
|
|
143
|
+
iconOnly: {
|
|
144
|
+
paddingHorizontal: 12,
|
|
145
|
+
paddingVertical: 12
|
|
146
|
+
}
|
|
186
147
|
},
|
|
187
148
|
text: {
|
|
188
149
|
variant: 'body',
|
|
189
150
|
weight: 'medium'
|
|
190
151
|
},
|
|
191
152
|
icon: {
|
|
192
|
-
|
|
153
|
+
size: 20
|
|
193
154
|
},
|
|
194
155
|
iconOnly: {
|
|
195
|
-
|
|
156
|
+
size: 24
|
|
196
157
|
}
|
|
197
158
|
},
|
|
198
159
|
small: {
|
|
199
160
|
button: {
|
|
200
161
|
paddingHorizontal: 8,
|
|
201
|
-
paddingVertical: 4
|
|
162
|
+
paddingVertical: 4,
|
|
163
|
+
iconOnly: {
|
|
164
|
+
paddingHorizontal: 4,
|
|
165
|
+
paddingVertical: 4
|
|
166
|
+
}
|
|
202
167
|
},
|
|
203
168
|
text: {
|
|
204
169
|
weight: 'medium',
|
|
205
170
|
variant: 'small'
|
|
206
171
|
},
|
|
207
172
|
icon: {
|
|
208
|
-
|
|
173
|
+
size: 20
|
|
209
174
|
},
|
|
210
175
|
iconOnly: {
|
|
211
|
-
|
|
176
|
+
size: 20
|
|
212
177
|
}
|
|
213
178
|
}
|
|
214
179
|
};
|
|
@@ -216,23 +181,10 @@ const sizeButtonTheme = size => {
|
|
|
216
181
|
return definition[size] || {};
|
|
217
182
|
};
|
|
218
183
|
|
|
219
|
-
const
|
|
220
|
-
const definition = {
|
|
221
|
-
left: {
|
|
222
|
-
marginRight: 8
|
|
223
|
-
},
|
|
224
|
-
right: {
|
|
225
|
-
marginLeft: 8
|
|
226
|
-
}
|
|
227
|
-
};
|
|
228
|
-
return definition[iconPlacement] || {};
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
export const retrieveStyle = ({ style = {}, colorTheme, variant, theme, size, iconPlacement }) => {
|
|
184
|
+
export const retrieveStyle = ({ style = {}, colorTheme, variant, theme, size }) => {
|
|
232
185
|
const baseTheme = baseButtonTheme();
|
|
233
186
|
const variantTheme = variantsColorTheme(theme, colorTheme, variant);
|
|
234
187
|
const sizeTheme = sizeButtonTheme(size);
|
|
235
|
-
const iconPlacementTheme = iconButtonPlacementTheme(iconPlacement);
|
|
236
188
|
|
|
237
189
|
const buttonStyles = {
|
|
238
190
|
...baseTheme.button,
|
|
@@ -241,14 +193,6 @@ export const retrieveStyle = ({ style = {}, colorTheme, variant, theme, size, ic
|
|
|
241
193
|
...style.root
|
|
242
194
|
};
|
|
243
195
|
|
|
244
|
-
const counterStyles = {
|
|
245
|
-
...baseTheme.counter,
|
|
246
|
-
...variantTheme.counter,
|
|
247
|
-
iconLeftAndCounter: {
|
|
248
|
-
...baseTheme.iconLeftAndCounter
|
|
249
|
-
}
|
|
250
|
-
};
|
|
251
|
-
|
|
252
196
|
const textStyles = {
|
|
253
197
|
colorTheme: variantTheme.text.colorTheme,
|
|
254
198
|
variant: sizeTheme.text?.variant || baseTheme.text?.variant,
|
|
@@ -260,7 +204,6 @@ export const retrieveStyle = ({ style = {}, colorTheme, variant, theme, size, ic
|
|
|
260
204
|
...baseTheme.icon,
|
|
261
205
|
...sizeTheme.icon,
|
|
262
206
|
...variantTheme.icon,
|
|
263
|
-
...iconPlacementTheme,
|
|
264
207
|
...style.icon
|
|
265
208
|
},
|
|
266
209
|
iconOnly: {
|
|
@@ -271,11 +214,14 @@ export const retrieveStyle = ({ style = {}, colorTheme, variant, theme, size, ic
|
|
|
271
214
|
}
|
|
272
215
|
};
|
|
273
216
|
|
|
274
|
-
const childrenContainerStyles = {
|
|
217
|
+
const childrenContainerStyles = {
|
|
218
|
+
...baseTheme.childrenContainer,
|
|
219
|
+
...style.childrenContainer
|
|
220
|
+
};
|
|
275
221
|
|
|
276
222
|
const disabledStyles = {
|
|
277
223
|
opacity: 0.5
|
|
278
224
|
};
|
|
279
225
|
|
|
280
|
-
return { buttonStyles,
|
|
226
|
+
return { buttonStyles, textStyles, disabledStyles, iconStyles, childrenContainerStyles };
|
|
281
227
|
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { COLOR_SHADES, COLOR_THEMES } from '../../constants/Palette';
|
|
2
|
+
|
|
1
3
|
import EnergyIconCar from './components/EnergyIcons/EnergyIconCar.svg';
|
|
2
4
|
import EnergyIconCart from './components/EnergyIcons/EnergyIconCart.svg';
|
|
3
5
|
import EnergyIconChartPie from './components/EnergyIcons/EnergyIconChartPie.svg';
|
|
@@ -7,32 +9,11 @@ import EnergyIconHome2 from './components/EnergyIcons/EnergyIconHome2.svg';
|
|
|
7
9
|
import EnergyIconHome3 from './components/EnergyIcons/EnergyIconHome3.svg';
|
|
8
10
|
import EnergyIconTruck from './components/EnergyIcons/EnergyIconTruck.svg';
|
|
9
11
|
|
|
10
|
-
export const SHADES = {
|
|
11
|
-
shade01: '01',
|
|
12
|
-
shade02: '02',
|
|
13
|
-
shade03: '03',
|
|
14
|
-
shade04: '04',
|
|
15
|
-
shade05: '05'
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const COLOR_THEMES = {
|
|
19
|
-
accent: 'accent',
|
|
20
|
-
dark: 'dark',
|
|
21
|
-
error: 'error',
|
|
22
|
-
gray: 'gray',
|
|
23
|
-
information: 'information',
|
|
24
|
-
light: 'light',
|
|
25
|
-
negative: 'negative',
|
|
26
|
-
neutral: 'neutral',
|
|
27
|
-
success: 'success',
|
|
28
|
-
warning: 'warning'
|
|
29
|
-
};
|
|
30
|
-
|
|
31
12
|
export const DEFAULT_PROPS = {
|
|
32
|
-
color:
|
|
13
|
+
color: COLOR_THEMES.dark
|
|
33
14
|
};
|
|
34
15
|
|
|
35
|
-
export const DEFAULT_INTERNAL_SHADE =
|
|
16
|
+
export const DEFAULT_INTERNAL_SHADE = COLOR_SHADES.shade02;
|
|
36
17
|
|
|
37
18
|
export const ENERGY_ICONS = {
|
|
38
19
|
EnergyIconCar,
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getDefaultColorShade } from '../../utils/styleUtils';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
colorTheme === COLOR_THEMES.gray
|
|
5
|
-
? SHADES.shade04
|
|
6
|
-
: colorTheme === COLOR_THEMES.light
|
|
7
|
-
? SHADES.shade01
|
|
8
|
-
: SHADES.shade05;
|
|
3
|
+
import { DEFAULT_PROPS } from './constants';
|
|
9
4
|
|
|
10
5
|
export const retrieveColor = ({ colorTheme, shade, theme }) => {
|
|
11
6
|
const colorThemeDefinition = theme.Palette[colorTheme] || theme.Palette[DEFAULT_PROPS.color];
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
shade01: '01',
|
|
3
|
-
shade02: '02',
|
|
4
|
-
shade03: '03',
|
|
5
|
-
shade04: '04',
|
|
6
|
-
shade05: '05'
|
|
7
|
-
};
|
|
1
|
+
import { COLOR_THEMES } from '../../constants/Palette';
|
|
8
2
|
|
|
9
3
|
export const VARIANTS_SIZES = {
|
|
10
4
|
title1: 30,
|
|
@@ -37,21 +31,8 @@ export const WEIGHTS = {
|
|
|
37
31
|
black: 900
|
|
38
32
|
};
|
|
39
33
|
|
|
40
|
-
export const COLOR_THEMES = {
|
|
41
|
-
ACCENT: 'accent',
|
|
42
|
-
DARK: 'dark',
|
|
43
|
-
ERROR: 'error',
|
|
44
|
-
GRAY: 'gray',
|
|
45
|
-
INFORMATION: 'information',
|
|
46
|
-
LIGHT: 'light',
|
|
47
|
-
NEGATIVE: 'negative',
|
|
48
|
-
NEUTRAL: 'neutral',
|
|
49
|
-
SUCCESS: 'success',
|
|
50
|
-
WARNING: 'warning'
|
|
51
|
-
};
|
|
52
|
-
|
|
53
34
|
export const DEFAULT_PROPS = {
|
|
54
|
-
colorTheme: COLOR_THEMES.
|
|
35
|
+
colorTheme: COLOR_THEMES.dark,
|
|
55
36
|
field: {},
|
|
56
37
|
style: {},
|
|
57
38
|
variant: 'body',
|
|
@@ -1,17 +1,12 @@
|
|
|
1
|
+
import { COLOR_SHADES } from '../../constants/Palette';
|
|
2
|
+
import { getDefaultColorShade } from '../../utils/styleUtils';
|
|
1
3
|
import { IS_IOS } from '../../utils/platformUtils/constants';
|
|
2
4
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const getDefaultColorShade = colorTheme =>
|
|
6
|
-
colorTheme === COLOR_THEMES.GRAY
|
|
7
|
-
? SHADES.shade04
|
|
8
|
-
: colorTheme === COLOR_THEMES.LIGHT
|
|
9
|
-
? SHADES.shade01
|
|
10
|
-
: SHADES.shade05;
|
|
5
|
+
import { DEFAULT_PROPS, LINE_HEIGHTS, VARIANTS_SIZES, WEIGHTS } from './constants';
|
|
11
6
|
|
|
12
7
|
const variantsColorTheme = (colorTheme, shade, theme) => {
|
|
13
8
|
const colorThemeDefinition = theme.Palette[colorTheme] || theme.Palette[DEFAULT_PROPS.colorTheme];
|
|
14
|
-
const colorShade = Object.values(
|
|
9
|
+
const colorShade = Object.values(COLOR_SHADES).includes(shade) ? shade : getDefaultColorShade(colorTheme);
|
|
15
10
|
return colorThemeDefinition[colorShade] || '#000';
|
|
16
11
|
};
|
|
17
12
|
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { View, TouchableWithoutFeedback, Keyboard, Modal, ImageBackground } from 'react-native';
|
|
3
3
|
import _ from 'lodash';
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import UTLabel from '../UTLabel';
|
|
6
6
|
import Button from '../Button';
|
|
7
7
|
import Touchable from '../Touchable';
|
|
8
8
|
import Icon from '../Icon';
|
|
@@ -89,14 +89,14 @@ const UTModal = ({
|
|
|
89
89
|
)}
|
|
90
90
|
|
|
91
91
|
{!!title && (
|
|
92
|
-
<
|
|
92
|
+
<UTLabel variant="title3" weight="medium" style={styles.title}>
|
|
93
93
|
{title}
|
|
94
|
-
</
|
|
94
|
+
</UTLabel>
|
|
95
95
|
)}
|
|
96
96
|
{!!subtitle && (
|
|
97
|
-
<
|
|
97
|
+
<UTLabel colorTheme="gray" {...subtitleProps} style={styles.subtitle}>
|
|
98
98
|
{subtitle}
|
|
99
|
-
</
|
|
99
|
+
</UTLabel>
|
|
100
100
|
)}
|
|
101
101
|
|
|
102
102
|
{children}
|
|
@@ -9,6 +9,8 @@ This component displays a vertical stepper intended to track progress
|
|
|
9
9
|
| Name | Type | Default | Description |
|
|
10
10
|
| ----------- | ----------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
11
11
|
| title | string | | Displays the title above the tracker. |
|
|
12
|
+
| subtitle | string | | Displays under the title |
|
|
13
|
+
| description | string | | Displays under the subtitle |
|
|
12
14
|
| mode | card \| flat | card | Defines whether the component should display as a card or as the bare components without any background. |
|
|
13
15
|
| variant | standard \| error | standard | Defines the color scheme of the tracker steps and the icon on the active step. |
|
|
14
16
|
| steps | stepsType | | Displays a step with a rounded icon on the left for each object received. |
|
|
@@ -19,6 +21,6 @@ This component displays a vertical stepper intended to track progress
|
|
|
19
21
|
|
|
20
22
|
| Type | Shape |
|
|
21
23
|
| ------------ | ------------------------------------------------------------------------------ |
|
|
22
|
-
| stepsType | `{ id: number, title: string,
|
|
24
|
+
| stepsType | `{ id: number, title: string, subSteps: [...subStepsType] }` |
|
|
23
25
|
| subStepsType | `{ id: number, title: string, subtitle: string }` |
|
|
24
26
|
| detailsType | `{ enabled: bool, title: string }` |
|
|
@@ -5,11 +5,13 @@ import merge from 'lodash/merge';
|
|
|
5
5
|
import { ViewPropTypes } from 'deprecated-react-native-prop-types';
|
|
6
6
|
|
|
7
7
|
import { IS_IOS } from '../../../../utils/platformUtils/constants';
|
|
8
|
+
import { useTheme } from '../../../../theming';
|
|
8
9
|
|
|
9
|
-
import
|
|
10
|
+
import { getConnectorStyles } from './styles';
|
|
10
11
|
|
|
11
12
|
const Connector = ({ currentPosition = 0, first, nextPosition = 0, style }) => {
|
|
12
|
-
const
|
|
13
|
+
const theme = useTheme();
|
|
14
|
+
const themedStyles = merge({}, getConnectorStyles(theme), style);
|
|
13
15
|
|
|
14
16
|
return (
|
|
15
17
|
<View
|
|
@@ -2,28 +2,29 @@ import { StyleSheet } from 'react-native';
|
|
|
2
2
|
|
|
3
3
|
import { OVAL_SIZE } from '../../styles';
|
|
4
4
|
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
5
|
+
export const getConnectorStyles = theme =>
|
|
6
|
+
StyleSheet.create({
|
|
7
|
+
connector: {
|
|
8
|
+
borderColor: theme.Palette.gray['04'],
|
|
9
|
+
borderLeftWidth: 2,
|
|
10
|
+
borderStyle: 'dashed',
|
|
11
|
+
flexGrow: 1
|
|
12
|
+
},
|
|
13
|
+
connectorIOS: {
|
|
14
|
+
borderWidth: 2,
|
|
15
|
+
margin: -3,
|
|
16
|
+
marginLeft: 0,
|
|
17
|
+
flex: 1
|
|
18
|
+
},
|
|
19
|
+
wrapper: (currentPosition, first, nextPosition) => ({
|
|
20
|
+
height: nextPosition - currentPosition - OVAL_SIZE - (first ? 5 : 0) - 10,
|
|
21
|
+
paddingLeft: OVAL_SIZE / 2 - 1,
|
|
22
|
+
position: 'absolute',
|
|
23
|
+
top: currentPosition + OVAL_SIZE + (first ? 5 : 0) + 5,
|
|
24
|
+
width: 2
|
|
25
|
+
}),
|
|
26
|
+
wrapperIOS: {
|
|
27
|
+
overflow: 'hidden',
|
|
28
|
+
width: OVAL_SIZE
|
|
29
|
+
}
|
|
30
|
+
});
|
|
@@ -3,12 +3,13 @@ import { View } from 'react-native';
|
|
|
3
3
|
import { bool, func, number } from 'prop-types';
|
|
4
4
|
import merge from 'lodash/merge';
|
|
5
5
|
|
|
6
|
-
import Label from '../../../Label';
|
|
7
6
|
import { StepPropTypes, VariantPropTypes } from '../../propTypes';
|
|
8
|
-
import
|
|
7
|
+
import UTIcon from '../../../UTIcon';
|
|
8
|
+
import UTLabel from '../../../UTLabel';
|
|
9
9
|
import { ERROR } from '../../constants';
|
|
10
|
+
import { useTheme } from '../../../../theming';
|
|
10
11
|
|
|
11
|
-
import
|
|
12
|
+
import { getVariantStyles, getStepStyles } from './styles';
|
|
12
13
|
|
|
13
14
|
const ERROR_ICON_SIZE = 16;
|
|
14
15
|
|
|
@@ -16,7 +17,9 @@ const Step = ({ first, index, isActive, isCompleted, setStepsPositions, step, st
|
|
|
16
17
|
const stepCompleted = isCompleted(step.id);
|
|
17
18
|
const stepActive = isActive(step.id);
|
|
18
19
|
|
|
19
|
-
const
|
|
20
|
+
const theme = useTheme();
|
|
21
|
+
const ownStyles = getStepStyles(theme);
|
|
22
|
+
const themedStyles = merge({}, ownStyles, getVariantStyles(theme)[variant], style[variant]);
|
|
20
23
|
const [stepIconOffset, setStepIconOffset] = useState(0);
|
|
21
24
|
const [currentPosition, setCurrentPosition] = useState(0);
|
|
22
25
|
|
|
@@ -54,41 +57,21 @@ const Step = ({ first, index, isActive, isCompleted, setStepsPositions, step, st
|
|
|
54
57
|
]}
|
|
55
58
|
>
|
|
56
59
|
{stepActive && variant === ERROR && (
|
|
57
|
-
<
|
|
58
|
-
color="white"
|
|
59
|
-
height={ERROR_ICON_SIZE}
|
|
60
|
-
name="close"
|
|
61
|
-
size={ERROR_ICON_SIZE}
|
|
62
|
-
style={themedStyles.icon}
|
|
63
|
-
type="antdesign"
|
|
64
|
-
width={ERROR_ICON_SIZE}
|
|
65
|
-
/>
|
|
60
|
+
<UTIcon name="IconX" colorTheme="negative" size={ERROR_ICON_SIZE} style={themedStyles.icon} />
|
|
66
61
|
)}
|
|
67
62
|
</View>
|
|
68
63
|
</View>
|
|
69
64
|
<View style={themedStyles.textContainer}>
|
|
70
65
|
{step.title && (
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
? themedStyles.activeTitleColor
|
|
77
|
-
: themedStyles.titleColor
|
|
66
|
+
<UTLabel
|
|
67
|
+
variant="small"
|
|
68
|
+
weight="medium"
|
|
69
|
+
colorTheme={
|
|
70
|
+
stepCompleted ? 'gray' : stepActive ? (variant === ERROR ? 'error' : 'accent') : 'dark'
|
|
78
71
|
}
|
|
79
72
|
>
|
|
80
73
|
{step.title}
|
|
81
|
-
</
|
|
82
|
-
)}
|
|
83
|
-
{step.subtitle && (
|
|
84
|
-
<Label color={themedStyles.subtitleColor} style={themedStyles.subtitle}>
|
|
85
|
-
{step.subtitle}
|
|
86
|
-
</Label>
|
|
87
|
-
)}
|
|
88
|
-
{step.description && (
|
|
89
|
-
<Label color={themedStyles.descriptionColor} style={themedStyles.description}>
|
|
90
|
-
{step.description}
|
|
91
|
-
</Label>
|
|
74
|
+
</UTLabel>
|
|
92
75
|
)}
|
|
93
76
|
</View>
|
|
94
77
|
</View>
|
|
@@ -3,84 +3,74 @@ import { StyleSheet } from 'react-native';
|
|
|
3
3
|
import { OVAL_SIZE } from '../../styles';
|
|
4
4
|
import { ERROR, STANDARD } from '../../constants';
|
|
5
5
|
|
|
6
|
-
export const
|
|
6
|
+
export const getVariantStyles = theme => ({
|
|
7
7
|
[ERROR]: {
|
|
8
8
|
activeContainer: {
|
|
9
|
-
backgroundColor: '
|
|
10
|
-
borderColor: '
|
|
9
|
+
backgroundColor: theme.Palette.error['04'],
|
|
10
|
+
borderColor: theme.Palette.error['04']
|
|
11
11
|
},
|
|
12
12
|
activeInnerContainer: {
|
|
13
|
-
backgroundColor: '
|
|
13
|
+
backgroundColor: theme.Palette.error['04']
|
|
14
14
|
},
|
|
15
|
-
activeTitleColor: 'red',
|
|
16
15
|
completedContainer: {
|
|
17
|
-
borderColor: '
|
|
16
|
+
borderColor: theme.Palette.error['04']
|
|
18
17
|
},
|
|
19
18
|
completedInnerContainer: {
|
|
20
|
-
backgroundColor: '
|
|
19
|
+
backgroundColor: theme.Palette.error['04']
|
|
21
20
|
},
|
|
22
21
|
completedOuterContainer: {
|
|
23
22
|
opacity: 0.5
|
|
24
|
-
}
|
|
25
|
-
completedTitleColor: 'red'
|
|
23
|
+
}
|
|
26
24
|
},
|
|
27
25
|
[STANDARD]: {
|
|
28
26
|
activeContainer: {
|
|
29
|
-
borderColor: '
|
|
27
|
+
borderColor: theme.Palette.accent['04']
|
|
30
28
|
},
|
|
31
29
|
activeInnerContainer: {
|
|
32
|
-
backgroundColor: '
|
|
30
|
+
backgroundColor: theme.Palette.accent['04']
|
|
33
31
|
},
|
|
34
|
-
activeTitleColor: 'blue',
|
|
35
32
|
completedContainer: {
|
|
36
|
-
borderColor: '
|
|
33
|
+
borderColor: theme.Palette.accent['04']
|
|
37
34
|
},
|
|
38
35
|
completedInnerContainer: {
|
|
39
|
-
backgroundColor: '
|
|
36
|
+
backgroundColor: theme.Palette.accent['04']
|
|
40
37
|
},
|
|
41
38
|
completedOuterContainer: {
|
|
42
39
|
opacity: 0.5
|
|
43
|
-
}
|
|
44
|
-
completedTitleColor: 'blue'
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export default StyleSheet.create({
|
|
49
|
-
container: {
|
|
50
|
-
alignItems: 'center',
|
|
51
|
-
backgroundColor: 'white',
|
|
52
|
-
borderColor: 'gray',
|
|
53
|
-
borderRadius: OVAL_SIZE / 2,
|
|
54
|
-
borderWidth: OVAL_SIZE / 10,
|
|
55
|
-
height: OVAL_SIZE,
|
|
56
|
-
justifyContent: 'center',
|
|
57
|
-
marginRight: 16,
|
|
58
|
-
width: OVAL_SIZE
|
|
59
|
-
},
|
|
60
|
-
description: {
|
|
61
|
-
marginTop: 4
|
|
62
|
-
},
|
|
63
|
-
descriptionColor: 'gray',
|
|
64
|
-
icon: {
|
|
65
|
-
position: 'absolute',
|
|
66
|
-
right: -3,
|
|
67
|
-
top: -3
|
|
68
|
-
},
|
|
69
|
-
innerContainer: {
|
|
70
|
-
backgroundColor: 'white',
|
|
71
|
-
borderRadius: OVAL_SIZE / 4,
|
|
72
|
-
height: OVAL_SIZE / 2,
|
|
73
|
-
width: OVAL_SIZE / 2
|
|
74
|
-
},
|
|
75
|
-
outerContainer: {
|
|
76
|
-
alignItems: 'center',
|
|
77
|
-
flexDirection: 'row'
|
|
78
|
-
},
|
|
79
|
-
stepMargin: { marginTop: 24 },
|
|
80
|
-
subtitle: {
|
|
81
|
-
marginTop: 4
|
|
82
|
-
},
|
|
83
|
-
textContainer: {
|
|
84
|
-
width: '90%'
|
|
40
|
+
}
|
|
85
41
|
}
|
|
86
42
|
});
|
|
43
|
+
|
|
44
|
+
export const getStepStyles = theme =>
|
|
45
|
+
StyleSheet.create({
|
|
46
|
+
container: {
|
|
47
|
+
alignItems: 'center',
|
|
48
|
+
backgroundColor: 'transparent',
|
|
49
|
+
borderColor: theme.Palette.gray['04'],
|
|
50
|
+
borderRadius: OVAL_SIZE / 2,
|
|
51
|
+
borderWidth: OVAL_SIZE / 10,
|
|
52
|
+
height: OVAL_SIZE,
|
|
53
|
+
justifyContent: 'center',
|
|
54
|
+
marginRight: 16,
|
|
55
|
+
width: OVAL_SIZE
|
|
56
|
+
},
|
|
57
|
+
icon: {
|
|
58
|
+
position: 'absolute',
|
|
59
|
+
right: -3,
|
|
60
|
+
top: -3
|
|
61
|
+
},
|
|
62
|
+
innerContainer: {
|
|
63
|
+
backgroundColor: 'transparent',
|
|
64
|
+
borderRadius: OVAL_SIZE / 4,
|
|
65
|
+
height: OVAL_SIZE / 2,
|
|
66
|
+
width: OVAL_SIZE / 2
|
|
67
|
+
},
|
|
68
|
+
outerContainer: {
|
|
69
|
+
alignItems: 'center',
|
|
70
|
+
flexDirection: 'row'
|
|
71
|
+
},
|
|
72
|
+
stepMargin: { marginTop: 24 },
|
|
73
|
+
textContainer: {
|
|
74
|
+
width: '90%'
|
|
75
|
+
}
|
|
76
|
+
});
|
|
@@ -4,7 +4,7 @@ import { string } from 'prop-types';
|
|
|
4
4
|
import merge from 'lodash/merge';
|
|
5
5
|
import { ViewPropTypes } from 'deprecated-react-native-prop-types';
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import UTLabel from '../../../UTLabel';
|
|
8
8
|
|
|
9
9
|
import ownStyles from './styles';
|
|
10
10
|
|
|
@@ -13,8 +13,12 @@ const SubStep = ({ style, subtitle, title }) => {
|
|
|
13
13
|
|
|
14
14
|
return (
|
|
15
15
|
<View style={themedStyles.container}>
|
|
16
|
-
<
|
|
17
|
-
|
|
16
|
+
<UTLabel colorTheme="gray" variant="small">
|
|
17
|
+
{title}
|
|
18
|
+
</UTLabel>
|
|
19
|
+
<UTLabel colorTheme="gray" shade="01" variant="small">
|
|
20
|
+
{subtitle}
|
|
21
|
+
</UTLabel>
|
|
18
22
|
</View>
|
|
19
23
|
);
|
|
20
24
|
};
|
|
@@ -4,21 +4,33 @@ import merge from 'lodash/merge';
|
|
|
4
4
|
import { number, object, string } from 'prop-types';
|
|
5
5
|
import Collapsible from 'react-native-collapsible';
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import UTIcon from '../UTIcon';
|
|
8
|
+
import UTLabel from '../UTLabel';
|
|
8
9
|
import Touchable from '../Touchable';
|
|
9
|
-
import Label from '../Label';
|
|
10
10
|
import { useTheme } from '../../theming';
|
|
11
|
+
import Surface from '../Surface';
|
|
11
12
|
|
|
12
|
-
import
|
|
13
|
+
import { getUTTrackerStyles, getModeStyles } from './styles';
|
|
13
14
|
import Step from './components/Step';
|
|
14
15
|
import Connector from './components/Connector';
|
|
15
16
|
import SubStep from './components/SubStep';
|
|
16
17
|
import { DetailsTabPropTypes, ModePropTypes, StepsPropTypes, VariantPropTypes } from './propTypes';
|
|
17
|
-
import { CARD, FLAT, STANDARD } from './constants';
|
|
18
|
+
import { CARD, ERROR, FLAT, STANDARD } from './constants';
|
|
18
19
|
|
|
19
|
-
const UTTracker = ({
|
|
20
|
+
const UTTracker = ({
|
|
21
|
+
currentStep,
|
|
22
|
+
detailsTab,
|
|
23
|
+
description,
|
|
24
|
+
mode = CARD,
|
|
25
|
+
steps,
|
|
26
|
+
subtitle,
|
|
27
|
+
style,
|
|
28
|
+
title,
|
|
29
|
+
variant = STANDARD
|
|
30
|
+
}) => {
|
|
20
31
|
const theme = useTheme();
|
|
21
|
-
const
|
|
32
|
+
const ownStyles = getUTTrackerStyles(theme);
|
|
33
|
+
const themedStyles = merge({}, ownStyles, getModeStyles(theme)[mode], theme.UTTracker, style);
|
|
22
34
|
|
|
23
35
|
const [isCollapsed, setIsCollapsed] = useState(true);
|
|
24
36
|
const [stepsPositions, setStepsPositions] = useState([]);
|
|
@@ -26,8 +38,10 @@ const UTTracker = ({ currentStep, detailsTab, mode = CARD, steps, style, title,
|
|
|
26
38
|
const isCompleted = stepNumber => stepNumber < currentStep;
|
|
27
39
|
const isActive = stepNumber => stepNumber === currentStep;
|
|
28
40
|
|
|
41
|
+
const WrapperComponent = mode === CARD ? Surface : View;
|
|
42
|
+
|
|
29
43
|
return (
|
|
30
|
-
<
|
|
44
|
+
<WrapperComponent style={themedStyles.outerContainer}>
|
|
31
45
|
<View style={[themedStyles.container, !detailsTab && ownStyles.roundedBorders]}>
|
|
32
46
|
{title && (
|
|
33
47
|
<Touchable
|
|
@@ -36,24 +50,31 @@ const UTTracker = ({ currentStep, detailsTab, mode = CARD, steps, style, title,
|
|
|
36
50
|
style={themedStyles.titleTouchable}
|
|
37
51
|
>
|
|
38
52
|
<View style={themedStyles.titleContainer}>
|
|
39
|
-
<
|
|
53
|
+
<UTLabel variant="subtitle1" weight="medium">
|
|
40
54
|
{title}
|
|
41
|
-
</
|
|
55
|
+
</UTLabel>
|
|
42
56
|
{detailsTab?.enabled && mode === FLAT && (
|
|
43
|
-
<
|
|
44
|
-
color={themedStyles.detailsIconColor || 'black'}
|
|
45
|
-
height={DETAILS_ICON_FLAT_SIZE}
|
|
46
|
-
name={isCollapsed ? 'chevron-down' : 'chevron-up'}
|
|
47
|
-
size={DETAILS_ICON_FLAT_SIZE}
|
|
48
|
-
type="feather"
|
|
49
|
-
width={DETAILS_ICON_FLAT_SIZE}
|
|
50
|
-
/>
|
|
57
|
+
<UTIcon name={isCollapsed ? 'IconChevronDown' : 'IconChevronUp'} colorTheme="neutral" />
|
|
51
58
|
)}
|
|
52
59
|
</View>
|
|
53
60
|
</Touchable>
|
|
54
61
|
)}
|
|
62
|
+
{(subtitle || description) && (
|
|
63
|
+
<View style={[themedStyles.subtitleAndDescription, variant === ERROR && themedStyles.errorBanner]}>
|
|
64
|
+
{subtitle && (
|
|
65
|
+
<UTLabel variant="small" weight="medium" style={themedStyles.subtitle}>
|
|
66
|
+
{subtitle}
|
|
67
|
+
</UTLabel>
|
|
68
|
+
)}
|
|
69
|
+
{description && (
|
|
70
|
+
<UTLabel colorTheme="gray" variant="small" style={themedStyles.description}>
|
|
71
|
+
{description}
|
|
72
|
+
</UTLabel>
|
|
73
|
+
)}
|
|
74
|
+
</View>
|
|
75
|
+
)}
|
|
55
76
|
{steps && (
|
|
56
|
-
<View>
|
|
77
|
+
<View style={(title || subtitle || description) && themedStyles.stepsContainer}>
|
|
57
78
|
{steps.map((step, index) => (
|
|
58
79
|
<Fragment key={step.id}>
|
|
59
80
|
<Step
|
|
@@ -89,27 +110,22 @@ const UTTracker = ({ currentStep, detailsTab, mode = CARD, steps, style, title,
|
|
|
89
110
|
{detailsTab?.enabled && mode === CARD && (
|
|
90
111
|
<Touchable onPress={() => setIsCollapsed(!isCollapsed)} style={themedStyles.detailsTab}>
|
|
91
112
|
<Fragment>
|
|
92
|
-
<
|
|
93
|
-
<
|
|
94
|
-
color={themedStyles.detailsIconColor || 'black'}
|
|
95
|
-
height={DETAILS_ICON_CARD_SIZE}
|
|
96
|
-
name={isCollapsed ? 'chevron-down' : 'chevron-up'}
|
|
97
|
-
size={DETAILS_ICON_CARD_SIZE}
|
|
98
|
-
type="feather"
|
|
99
|
-
width={DETAILS_ICON_CARD_SIZE}
|
|
100
|
-
/>
|
|
113
|
+
<UTLabel weight="medium">{detailsTab.title}</UTLabel>
|
|
114
|
+
<UTIcon name={isCollapsed ? 'IconChevronDown' : 'IconChevronUp'} colorTheme="neutral" />
|
|
101
115
|
</Fragment>
|
|
102
116
|
</Touchable>
|
|
103
117
|
)}
|
|
104
|
-
</
|
|
118
|
+
</WrapperComponent>
|
|
105
119
|
);
|
|
106
120
|
};
|
|
107
121
|
|
|
108
122
|
UTTracker.propTypes = {
|
|
109
123
|
currentStep: number,
|
|
110
124
|
detailsTab: DetailsTabPropTypes,
|
|
125
|
+
description: string,
|
|
111
126
|
mode: ModePropTypes,
|
|
112
127
|
steps: StepsPropTypes,
|
|
128
|
+
subtitle: string,
|
|
113
129
|
// eslint-disable-next-line react/forbid-prop-types
|
|
114
130
|
style: object,
|
|
115
131
|
title: string,
|
|
@@ -3,55 +3,62 @@ import { StyleSheet } from 'react-native';
|
|
|
3
3
|
import { CARD, FLAT } from './constants';
|
|
4
4
|
|
|
5
5
|
export const OVAL_SIZE = 20;
|
|
6
|
-
export const DETAILS_ICON_CARD_SIZE = 20;
|
|
7
|
-
export const DETAILS_ICON_FLAT_SIZE = 24;
|
|
8
6
|
|
|
9
|
-
export const
|
|
7
|
+
export const getModeStyles = theme => ({
|
|
10
8
|
[CARD]: {
|
|
11
|
-
|
|
12
|
-
backgroundColor: '
|
|
13
|
-
elevation: 2,
|
|
14
|
-
shadowColor: 'black',
|
|
15
|
-
shadowOffset: {
|
|
16
|
-
height: 3,
|
|
17
|
-
width: 0
|
|
18
|
-
},
|
|
19
|
-
shadowOpacity: 0.1
|
|
9
|
+
outerContainer: {
|
|
10
|
+
backgroundColor: theme.Palette.light['01']
|
|
20
11
|
}
|
|
21
12
|
},
|
|
22
13
|
[FLAT]: {
|
|
23
|
-
|
|
14
|
+
outerContainer: {
|
|
24
15
|
backgroundColor: 'transparent'
|
|
25
16
|
}
|
|
26
17
|
}
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export default StyleSheet.create({
|
|
30
|
-
container: {
|
|
31
|
-
borderTopLeftRadius: 8,
|
|
32
|
-
borderTopRightRadius: 8,
|
|
33
|
-
padding: 16
|
|
34
|
-
},
|
|
35
|
-
detailsTab: {
|
|
36
|
-
backgroundColor: 'white',
|
|
37
|
-
borderBottomLeftRadius: 8,
|
|
38
|
-
borderBottomRightRadius: 8,
|
|
39
|
-
borderColor: 'lightgray',
|
|
40
|
-
borderTopWidth: 1,
|
|
41
|
-
flexDirection: 'row',
|
|
42
|
-
justifyContent: 'space-between',
|
|
43
|
-
paddingHorizontal: 16,
|
|
44
|
-
paddingVertical: 12
|
|
45
|
-
},
|
|
46
|
-
roundedBorders: {
|
|
47
|
-
borderBottomLeftRadius: 8,
|
|
48
|
-
borderBottomRightRadius: 8
|
|
49
|
-
},
|
|
50
|
-
titleContainer: {
|
|
51
|
-
flexDirection: 'row',
|
|
52
|
-
justifyContent: 'space-between'
|
|
53
|
-
},
|
|
54
|
-
titleTouchable: {
|
|
55
|
-
marginBottom: 24
|
|
56
|
-
}
|
|
57
18
|
});
|
|
19
|
+
|
|
20
|
+
export const getUTTrackerStyles = theme =>
|
|
21
|
+
StyleSheet.create({
|
|
22
|
+
container: {
|
|
23
|
+
borderTopLeftRadius: 8,
|
|
24
|
+
borderTopRightRadius: 8,
|
|
25
|
+
padding: 16
|
|
26
|
+
},
|
|
27
|
+
detailsTab: {
|
|
28
|
+
backgroundColor: theme.Palette.light['01'],
|
|
29
|
+
borderBottomLeftRadius: 8,
|
|
30
|
+
borderBottomRightRadius: 8,
|
|
31
|
+
borderColor: theme.Palette.light['04'],
|
|
32
|
+
borderTopWidth: 1,
|
|
33
|
+
flexDirection: 'row',
|
|
34
|
+
justifyContent: 'space-between',
|
|
35
|
+
paddingHorizontal: 16,
|
|
36
|
+
paddingVertical: 12
|
|
37
|
+
},
|
|
38
|
+
errorBanner: {
|
|
39
|
+
backgroundColor: theme.Palette.error['01'],
|
|
40
|
+
borderRadius: 4,
|
|
41
|
+
padding: 8
|
|
42
|
+
},
|
|
43
|
+
outerContainer: {
|
|
44
|
+
borderRadius: 8
|
|
45
|
+
},
|
|
46
|
+
roundedBorders: {
|
|
47
|
+
borderBottomLeftRadius: 8,
|
|
48
|
+
borderBottomRightRadius: 8
|
|
49
|
+
},
|
|
50
|
+
stepsContainer: {
|
|
51
|
+
marginTop: 24
|
|
52
|
+
},
|
|
53
|
+
subtitle: {
|
|
54
|
+
marginBottom: 4
|
|
55
|
+
},
|
|
56
|
+
subtitleAndDescription: {},
|
|
57
|
+
titleContainer: {
|
|
58
|
+
flexDirection: 'row',
|
|
59
|
+
justifyContent: 'space-between'
|
|
60
|
+
},
|
|
61
|
+
titleTouchable: {
|
|
62
|
+
marginBottom: 8
|
|
63
|
+
}
|
|
64
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const COLOR_SHADES = {
|
|
2
|
+
shade01: '01',
|
|
3
|
+
shade02: '02',
|
|
4
|
+
shade03: '03',
|
|
5
|
+
shade04: '04',
|
|
6
|
+
shade05: '05'
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const COLOR_THEMES = {
|
|
10
|
+
accent: 'accent',
|
|
11
|
+
dark: 'dark',
|
|
12
|
+
error: 'error',
|
|
13
|
+
gray: 'gray',
|
|
14
|
+
information: 'information',
|
|
15
|
+
light: 'light',
|
|
16
|
+
negative: 'negative',
|
|
17
|
+
neutral: 'neutral',
|
|
18
|
+
success: 'success',
|
|
19
|
+
warning: 'warning'
|
|
20
|
+
};
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import isArray from 'lodash/isArray';
|
|
2
2
|
import mergeWith from 'lodash/mergeWith';
|
|
3
3
|
|
|
4
|
+
import { COLOR_SHADES, COLOR_THEMES } from '../../constants/Palette';
|
|
5
|
+
|
|
4
6
|
export const SHADOW_OPACITY = 0.1;
|
|
5
7
|
|
|
8
|
+
export const getDefaultColorShade = colorTheme =>
|
|
9
|
+
colorTheme === COLOR_THEMES.gray
|
|
10
|
+
? COLOR_SHADES.shade04
|
|
11
|
+
: colorTheme === COLOR_THEMES.light
|
|
12
|
+
? COLOR_SHADES.shade01
|
|
13
|
+
: COLOR_SHADES.shade05;
|
|
14
|
+
|
|
6
15
|
const shadowLevels = {
|
|
7
16
|
1: {
|
|
8
17
|
elevation: 6,
|
package/package.json
CHANGED